StarObjectText.hxx Source File documentation

StarObjectText.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; c-default-style: "k&r"; indent-tabs-mode: nil; tab-width: 2; c-basic-offset: 2 -*- */
2
3 /* libstaroffice
4 * Version: MPL 2.0 / LGPLv2+
5 *
6 * The contents of this file are subject to the Mozilla Public License Version
7 * 2.0 (the "License"); you may not use this file except in compliance with
8 * the License or as specified alternatively below. You may obtain a copy of
9 * the License at http://www.mozilla.org/MPL/
10 *
11 * Software distributed under the License is distributed on an "AS IS" basis,
12 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 * for the specific language governing rights and limitations under the
14 * License.
15 *
16 * Major Contributor(s):
17 * Copyright (C) 2002 William Lachance (wrlach@gmail.com)
18 * Copyright (C) 2002,2004 Marc Maurer (uwog@uwog.net)
19 * Copyright (C) 2004-2006 Fridrich Strba (fridrich.strba@bluewin.ch)
20 * Copyright (C) 2006, 2007 Andrew Ziem
21 * Copyright (C) 2011, 2012 Alonso Laurent (alonso@loria.fr)
22 *
23 *
24 * All Rights Reserved.
25 *
26 * For minor contributions see the git repository.
27 *
28 * Alternatively, the contents of this file may be used under the terms of
29 * the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
30 * in which case the provisions of the LGPLv2+ are applicable
31 * instead of those above.
32 */
33
34 /*
35 * Parser to convert a text zone/OLE in a StarOffice document
36 *
37 */
38 #ifndef STAR_OBJECT_TEXT
39 # define STAR_OBJECT_TEXT
40
41 #include <vector>
42
43 #include "libstaroffice_internal.hxx"
44 #include "StarObject.hxx"
45
46 class StarState;
47
48 namespace StarObjectTextInternal
49 {
51 struct Zone {
53 Zone()
54 {
55 }
57 virtual ~Zone();
59 virtual bool send(STOFFListenerPtr listener, StarState &state) const=0;
61 virtual void inventoryPage(StarState &/*state*/) const
62 {
63 }
64 };
65
67 struct Content {
69 Content()
70 : m_sectionName("")
71 , m_zoneList()
72 {
73 }
75 ~Content();
77 bool send(STOFFListenerPtr listener, StarState &state) const;
79 void inventoryPages(StarState &state) const;
81 librevenge::RVNGString m_sectionName;
83 std::vector<std::shared_ptr<Zone> > m_zoneList;
84 };
85
86 struct GraphZone;
87 struct OLEZone;
88 struct SectionZone;
89 struct TextZone;
90 struct State;
91 }
92
93 class StarZone;
94
100 class StarObjectText final : public StarObject
101 {
102 public:
104 StarObjectText(StarObject const &orig, bool duplicateState);
106 ~StarObjectText() final;
107
108 // try to parse all zone
109 bool parse();
110
112 bool updatePageSpans(std::vector<STOFFPageSpan> &pageSpan, int &numPages);
114 bool sendPages(STOFFTextListenerPtr listener);
115
117 static bool readSWImageMap(StarZone &zone);
118
120 bool readSWContent(StarZone &zone, std::shared_ptr<StarObjectTextInternal::Content> &content);
121 protected:
122 //
123 // low level
124 //
125
127 bool readSfxStyleSheets(STOFFInputStreamPtr input, std::string const &fileName);
129 bool readWriterDocument(STOFFInputStreamPtr input, std::string const &fileName);
130
132 bool readDrawingLayer(STOFFInputStreamPtr input, std::string const &fileName);
133
134 protected:
136 bool readSWGraphNode(StarZone &zone, std::shared_ptr<StarObjectTextInternal::GraphZone> &graphZone);
138 bool readSWJobSetUp(StarZone &zone);
140 bool readSWOLENode(StarZone &zone, std::shared_ptr<StarObjectTextInternal::OLEZone> &ole);
142 bool readSWSection(StarZone &zone, std::shared_ptr<StarObjectTextInternal::SectionZone> &section);
144 bool readSWTextZone(StarZone &zone, std::shared_ptr<StarObjectTextInternal::TextZone> &textZone);
145 //
146 // data
147 //
148
150 std::shared_ptr<StarObjectTextInternal::State> m_textState;
151 private:
152 StarObjectText &operator=(StarObjectText const &orig) = delete;
153 };
154 #endif
155 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
StarObjectTextInternal::Zone::~Zone
virtual ~Zone()
destructor
Definition: StarObjectText.cxx:75
StarObjectTextInternal::Content::m_sectionName
librevenge::RVNGString m_sectionName
the section name
Definition: StarObjectText.hxx:81
StarObjectTextInternal::Content::send
bool send(STOFFListenerPtr listener, StarState &state) const
try to send the data to a listener
Definition: StarObjectText.cxx:97
StarObjectText::readSWGraphNode
bool readSWGraphNode(StarZone &zone, std::shared_ptr< StarObjectTextInternal::GraphZone > &graphZone)
try to read a OLE node : &#39;g&#39;
Definition: StarObjectText.cxx:987
StarObjectTextInternal::Zone::send
virtual bool send(STOFFListenerPtr listener, StarState &state) const =0
try to send the data to a listener
StarObjectText::operator=
StarObjectText & operator=(StarObjectText const &orig)=delete
StarState
class to store an state: ie.
Definition: StarState.hxx:66
StarObjectText::~StarObjectText
~StarObjectText() final
destructor
Definition: StarObjectText.cxx:659
STOFFTextListenerPtr
std::shared_ptr< STOFFTextListener > STOFFTextListenerPtr
a smart pointer of STOFFTextListener
Definition: libstaroffice_internal.hxx:496
StarObjectTextInternal::OLEZone
Internal: a OLEZone of StarObjectTextInteral.
Definition: StarObjectText.cxx:192
STOFFInputStreamPtr
std::shared_ptr< STOFFInputStream > STOFFInputStreamPtr
a smart pointer of STOFFInputStream
Definition: libstaroffice_internal.hxx:484
StarObject.hxx
StarObjectText::m_textState
std::shared_ptr< StarObjectTextInternal::State > m_textState
the state
Definition: StarObjectText.hxx:150
StarObjectTextInternal::SectionZone
Internal: a sectionZone of StarObjectTextInteral.
Definition: StarObjectText.cxx:244
StarObjectTextInternal::Zone
Internal: a basic sone of StarObjectTextInternal.
Definition: StarObjectText.hxx:51
StarObjectTextInternal::Content
Internal: a set of zone.
Definition: StarObjectText.hxx:67
StarObjectTextInternal::Content::m_zoneList
std::vector< std::shared_ptr< Zone > > m_zoneList
the list of text zone
Definition: StarObjectText.hxx:83
StarObjectText::readSfxStyleSheets
bool readSfxStyleSheets(STOFFInputStreamPtr input, std::string const &fileName)
try to read a text style zone: SfxStyleSheets
Definition: StarObjectText.cxx:801
StarObjectText::readSWTextZone
bool readSWTextZone(StarZone &zone, std::shared_ptr< StarObjectTextInternal::TextZone > &textZone)
try to read some content : &#39;T&#39;
Definition: StarObjectText.cxx:1344
StarObjectText::readSWOLENode
bool readSWOLENode(StarZone &zone, std::shared_ptr< StarObjectTextInternal::OLEZone > &ole)
try to read a OLE node : &#39;O&#39;
Definition: StarObjectText.cxx:1216
StarObjectTextInternal::State
Internal: the state of a StarObjectText.
Definition: StarObjectText.cxx:623
StarObjectTextInternal
Internal: the structures of a StarObjectText.
Definition: StarObjectText.cxx:71
StarObjectText::readSWImageMap
static bool readSWImageMap(StarZone &zone)
try to read a image map zone : &#39;X&#39;
Definition: StarObjectText.cxx:1104
StarObjectTextInternal::TextZone
Internal: a textZone of StarObjectTextInteral.
Definition: StarObjectText.cxx:292
StarObjectText::readSWContent
bool readSWContent(StarZone &zone, std::shared_ptr< StarObjectTextInternal::Content > &content)
try to read some content : &#39;N&#39;
Definition: StarObjectText.cxx:857
StarObjectText::readSWJobSetUp
bool readSWJobSetUp(StarZone &zone)
try to read a SW zone setup : &#39;J&#39;
Definition: StarObjectText.cxx:1188
StarObjectTextInternal::Content::Content
Content()
constructor
Definition: StarObjectText.hxx:69
libstaroffice_internal.hxx
StarObjectText::parse
bool parse()
Definition: StarObjectText.cxx:717
StarObjectTextInternal::Zone::Zone
Zone()
constructor
Definition: StarObjectText.hxx:53
StarObjectText::sendPages
bool sendPages(STOFFTextListenerPtr listener)
try to send the different page
Definition: StarObjectText.cxx:693
StarObjectTextInternal::GraphZone
Internal: a graphZone of StarObjectTextInteral.
Definition: StarObjectText.cxx:144
StarObjectTextInternal::Content::~Content
~Content()
destructor
Definition: StarObjectText.cxx:79
StarObjectText::readWriterDocument
bool readWriterDocument(STOFFInputStreamPtr input, std::string const &fileName)
the main zone
Definition: StarObjectText.cxx:1596
StarObjectText::StarObjectText
StarObjectText(StarObject const &orig, bool duplicateState)
constructor
Definition: StarObjectText.cxx:653
StarObjectText::readDrawingLayer
bool readDrawingLayer(STOFFInputStreamPtr input, std::string const &fileName)
the drawing layers ?
Definition: StarObjectText.cxx:1509
StarObjectText::updatePageSpans
bool updatePageSpans(std::vector< STOFFPageSpan > &pageSpan, int &numPages)
try to update the page span (to create draw document)
Definition: StarObjectText.cxx:667
STOFFListenerPtr
std::shared_ptr< STOFFListener > STOFFListenerPtr
a smart pointer of STOFFListener
Definition: libstaroffice_internal.hxx:486
StarObjectText
the main class to read a StarOffice sdw file
Definition: StarObjectText.hxx:100
StarObjectText::readSWSection
bool readSWSection(StarZone &zone, std::shared_ptr< StarObjectTextInternal::SectionZone > &section)
try to read a section : &#39;I&#39;
Definition: StarObjectText.cxx:1265
StarObject
an object corresponding to an OLE directory
Definition: StarObject.hxx:64
StarZone
a zone in a StarOffice file
Definition: StarZone.hxx:56
StarObjectTextInternal::Zone::inventoryPage
virtual void inventoryPage(StarState &) const
try to inventory the different pages
Definition: StarObjectText.hxx:61
StarObjectTextInternal::Content::inventoryPages
void inventoryPages(StarState &state) const
try to inventory the different pages
Definition: StarObjectText.cxx:83