Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*************************************************************************
3 : *
4 : * The Contents of this file are made available subject to the terms of
5 : * either of the following licenses
6 : *
7 : * - GNU Lesser General Public License Version 2.1
8 : * - Sun Industry Standards Source License Version 1.1
9 : *
10 : * Sun Microsystems Inc., October, 2000
11 : *
12 : * GNU Lesser General Public License Version 2.1
13 : * =============================================
14 : * Copyright 2000 by Sun Microsystems, Inc.
15 : * 901 San Antonio Road, Palo Alto, CA 94303, USA
16 : *
17 : * This library is free software; you can redistribute it and/or
18 : * modify it under the terms of the GNU Lesser General Public
19 : * License version 2.1, as published by the Free Software Foundation.
20 : *
21 : * This library is distributed in the hope that it will be useful,
22 : * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24 : * Lesser General Public License for more details.
25 : *
26 : * You should have received a copy of the GNU Lesser General Public
27 : * License along with this library; if not, write to the Free Software
28 : * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
29 : * MA 02111-1307 USA
30 : *
31 : *
32 : * Sun Industry Standards Source License Version 1.1
33 : * =================================================
34 : * The contents of this file are subject to the Sun Industry Standards
35 : * Source License Version 1.1 (the "License"); You may not use this file
36 : * except in compliance with the License. You may obtain a copy of the
37 : * License at http://www.openoffice.org/license.html.
38 : *
39 : * Software provided under this License is provided on an "AS IS" basis,
40 : * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
41 : * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
42 : * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
43 : * See the License for the specific provisions governing your rights and
44 : * obligations concerning the Software.
45 : *
46 : * The Initial Developer of the Original Code is: IBM Corporation
47 : *
48 : * Copyright: 2008 by IBM Corporation
49 : *
50 : * All Rights Reserved.
51 : *
52 : * Contributor(s): _______________________________________
53 : *
54 : *
55 : ************************************************************************/
56 : /*************************************************************************
57 : * @file
58 : * LwpDocument header file
59 : ************************************************************************/
60 : /*************************************************************************
61 : * Change History
62 : Jan 2005 Created
63 : Jun 2005 Code cleaning by change some members to local variables in Read()
64 : ************************************************************************/
65 :
66 : #ifndef _LWPDOCUMENT_HXX
67 : #define _LWPDOCUMENT_HXX
68 :
69 :
70 : #include "lwpobj.hxx"
71 : #include "lwpsortopt.hxx"
72 : #include "lwpuidoc.hxx"
73 : #include "lwplnopts.hxx"
74 : #include "lwpusrdicts.hxx"
75 : #include "lwpprtinfo.hxx"
76 : #include "lwpdlvlist.hxx"
77 : #include "lwpheader.hxx"
78 : #include "lwpfoundry.hxx"
79 :
80 : class IXFStream;
81 : class LwpVirtualLayout;
82 : /**
83 : * @brief Document object, represent document and division
84 : */
85 : class LwpDocument : public LwpDLNFPVList
86 : {
87 : public:
88 : LwpDocument(LwpObjectHeader &objHdr, LwpSvStream* pStrm);
89 : ~LwpDocument();
90 :
91 : private:
92 : LwpFoundry* m_pOwnedFoundry;
93 :
94 : //Data members in file format
95 : LwpObjectID m_DocSockID;
96 : sal_uInt16 m_nFlags;
97 : sal_uInt32 m_nPersistentFlags;
98 : enum
99 : {
100 : DOC_PROTECTED = 0x00000004UL,
101 : DOC_CHILDDOC = 0x00000800UL
102 : };
103 :
104 : //Code cleaning by change some members to local variables in Read()
105 : //Reserve the comments for future use
106 : //LwpSortOption* m_pDocSort;
107 : //LwpUIDocument* m_pUIDoc;
108 : LwpLineNumberOptions* m_pLnOpts;
109 : //LwpUserDictFiles* m_pUsrDicts;
110 : //LwpPrinterInfo* m_pPrtInfo;
111 :
112 : LwpObjectID m_DivOpts;
113 : LwpObjectID m_FootnoteOpts;
114 : LwpObjectID m_DocData;
115 : LwpObjectID m_DivInfo;
116 : LwpAtomHolder m_Epoch;
117 :
118 : LwpObjectID m_WYSIWYGPageHints;
119 : LwpObjectID m_VerDoc;
120 : LwpObjectID m_STXInfo;
121 :
122 : protected:
123 : void Read();
124 : void ReadPlug();
125 : void ParseDocContent(IXFStream* pOutputStream);
126 : void RegisterTextStyles();
127 : void RegisterLayoutStyles();
128 :
129 : void RegisterStylesInPara();
130 : void RegisterBulletStyles();
131 : void RegisterGraphicsStyles();
132 : void RegisterLinenumberStyles();
133 : void RegisterFootnoteStyles();
134 : void RegisterDefaultParaStyles();
135 :
136 : public:
137 : void Parse(IXFStream* pOutputStream);
138 : void RegisterStyle();
139 :
140 : inline sal_Bool IsChildDoc();
141 : inline sal_Bool HonorProtection();
142 : inline LwpObjectID* GetContentList();
143 : inline LwpObjectID* GetDocData();
144 : inline LwpObjectID* GetSocket();
145 :
146 : inline LwpFoundry* GetFoundry();
147 : inline LwpObjectID* GetDivInfoID();
148 : inline LwpObjectID* GetPageHintsID();
149 : inline LwpObjectID* GetFootnoteOpts();
150 : inline LwpObjectID* GetVerDoc();
151 : LwpObjectID* GetValidFootnoteOpts();
152 :
153 : sal_uInt16 GetEndnoteType();
154 : LwpDocument* GetPreviousDivision();
155 : LwpDocument* GetNextDivision();
156 : LwpDocument* GetParentDivision();
157 : LwpDocument* GetPreviousInGroup();
158 :
159 : LwpDocument* GetNextInGroup();
160 : LwpDocument* GetPreviousDivisionWithContents();
161 : LwpDocument* GetLastDivisionWithContents();
162 : LwpDocument* GetLastInGroupWithContents();
163 : LwpDocument* GetRootDocument();
164 : LwpDocument* GetFirstDivisionWithContentsThatIsNotOLE();
165 : LwpDocument* GetLastDivisionThatHasEndnote();
166 :
167 : LwpDocument* GetLastDivision();
168 : LwpDocument* GetFirstDivision();
169 : LwpVirtualLayout* GetEnSuperTableLayout();
170 : sal_Bool GetNumberOfPages(LwpDocument* pEndDivision, sal_uInt16& nCount);
171 :
172 : sal_uInt16 GetNumberOfPagesBefore();
173 : void ParseFrameInPage(IXFStream* pOutputStream);
174 :
175 : private:
176 : void MaxNumberOfPages(sal_uInt16& nNumPages);
177 : void XFConvertFrameInPage(XFContentContainer* pCont);
178 : void ChangeStyleName();
179 : sal_Bool IsSkippedDivision();
180 : };
181 :
182 548 : inline sal_Bool LwpDocument::IsChildDoc()
183 : {
184 548 : return (sal_Bool) ((m_nPersistentFlags & DOC_CHILDDOC) ? sal_True : sal_False);
185 : }
186 230 : inline sal_Bool LwpDocument::HonorProtection()
187 : {
188 230 : return m_nPersistentFlags & DOC_PROTECTED ? sal_True : sal_False;
189 : }
190 : inline LwpObjectID* LwpDocument::GetContentList()
191 : {
192 : return(m_pFoundry->GetContentManager()->GetContentList());
193 : }
194 315 : inline LwpObjectID* LwpDocument::GetSocket()
195 : {
196 315 : return &m_DocSockID;
197 : }
198 7 : inline LwpFoundry* LwpDocument::GetFoundry()
199 : {
200 7 : return m_pFoundry;
201 : }
202 34 : inline LwpObjectID* LwpDocument::GetDivInfoID()
203 : {
204 34 : return &m_DivInfo;
205 : }
206 0 : inline LwpObjectID* LwpDocument::GetPageHintsID()
207 : {
208 0 : return &m_WYSIWYGPageHints;
209 : }
210 8 : inline LwpObjectID* LwpDocument::GetFootnoteOpts()
211 : {
212 8 : return &m_FootnoteOpts;
213 : }
214 4 : inline LwpObjectID* LwpDocument::GetDocData()
215 : {
216 4 : return &m_DocData;
217 : }
218 4 : inline LwpObjectID* LwpDocument::GetVerDoc()
219 : {
220 4 : return &m_VerDoc;
221 : }
222 :
223 : /**
224 : * @brief DocumentSock object, divisions are embedded by document socket object
225 : */
226 : class LwpDocSock : public LwpDLNFVList
227 : {
228 : public:
229 : LwpDocSock(LwpObjectHeader &objHdr, LwpSvStream* pStrm);
230 16 : ~LwpDocSock(){}
231 : private:
232 : LwpObjectID m_Doc;
233 : protected:
234 : void Read();
235 : public:
236 : void RegisterStyle();
237 : void Parse(IXFStream* pOutputStream);
238 : };
239 :
240 : #endif
241 :
242 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|