Branch data 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 : : /*#define DOC_USECONTENTS 0x00000008UL
102 : : #define DOC_LOCKREVISIONS 0x00000200UL
103 : : #define DOC_LOCAL 0x00000400UL
104 : : */
105 : : DOC_CHILDDOC = 0x00000800UL
106 : : /*#define DOC_DOPREVIEW 0x02000000UL
107 : : #define DOC_REBUILDENDNOTES 0x04000000UL
108 : : #define DOC_FILEPROTECTION 0x10000000UL
109 : : #define DOC_PERSISTENTBITS (DOC_PROTECTED | DOC_USECONTENTS | DOC_LOCKREVISIONS | DOC_LOCAL | DOC_CHILDDOC | DOC_DOPREVIEW | DOC_REBUILDENDNOTES | DOC_FILEPROTECTION)
110 : : */
111 : : };
112 : :
113 : : //Code cleaning by change some members to local variables in Read()
114 : : //Reserve the comments for future use
115 : : //LwpSortOption* m_pDocSort;
116 : : //LwpUIDocument* m_pUIDoc;
117 : : LwpLineNumberOptions* m_pLnOpts;
118 : : //LwpUserDictFiles* m_pUsrDicts;
119 : : //LwpPrinterInfo* m_pPrtInfo;
120 : :
121 : : LwpObjectID m_DivOpts;
122 : : LwpObjectID m_FootnoteOpts;
123 : : LwpObjectID m_DocData;
124 : : LwpObjectID m_DivInfo;
125 : : LwpAtomHolder m_Epoch;
126 : :
127 : : LwpObjectID m_WYSIWYGPageHints;
128 : : LwpObjectID m_VerDoc;
129 : : LwpObjectID m_STXInfo;
130 : :
131 : : protected:
132 : : void Read();
133 : : void ReadPlug();
134 : : void ParseDocContent(IXFStream* pOutputStream);
135 : : void RegisterTextStyles();
136 : : void RegisterLayoutStyles();
137 : :
138 : : void RegisterStylesInPara();
139 : : void RegisterBulletStyles();
140 : : void RegisterGraphicsStyles();
141 : : void RegisterLinenumberStyles();
142 : : void RegisterFootnoteStyles();
143 : : void RegisterDefaultParaStyles();
144 : :
145 : : public:
146 : : void Parse(IXFStream* pOutputStream);
147 : : void RegisterStyle();
148 : :
149 : : inline sal_Bool IsChildDoc();
150 : : inline sal_Bool HonorProtection();
151 : : inline LwpObjectID* GetContentList();
152 : : inline LwpObjectID* GetDocData();
153 : : inline LwpObjectID* GetSocket();
154 : :
155 : : inline LwpFoundry* GetFoundry();
156 : : inline LwpObjectID* GetDivInfoID();
157 : : inline LwpObjectID* GetPageHintsID();
158 : : inline LwpObjectID* GetFootnoteOpts();
159 : : inline LwpObjectID* GetVerDoc();
160 : : LwpObjectID* GetValidFootnoteOpts();
161 : :
162 : : sal_uInt16 GetEndnoteType();
163 : : LwpDocument* GetPreviousDivision();
164 : : LwpDocument* GetNextDivision();
165 : : LwpDocument* GetParentDivision();
166 : : LwpDocument* GetPreviousInGroup();
167 : :
168 : : LwpDocument* GetNextInGroup();
169 : : LwpDocument* GetPreviousDivisionWithContents();
170 : : LwpDocument* GetLastDivisionWithContents();
171 : : LwpDocument* GetLastInGroupWithContents();
172 : : LwpDocument* GetRootDocument();
173 : : LwpDocument* GetFirstDivisionWithContentsThatIsNotOLE();
174 : : LwpDocument* GetLastDivisionThatHasEndnote();
175 : :
176 : : LwpDocument* GetLastDivision();
177 : : LwpDocument* GetFirstDivision();
178 : : LwpVirtualLayout* GetEnSuperTableLayout();
179 : : sal_Bool GetNumberOfPages(LwpDocument* pEndDivision, sal_uInt16& nCount);
180 : :
181 : : sal_uInt16 GetNumberOfPagesBefore();
182 : : void ParseFrameInPage(IXFStream* pOutputStream);
183 : :
184 : : private:
185 : : void MaxNumberOfPages(sal_uInt16& nNumPages);
186 : : void XFConvertFrameInPage(XFContentContainer* pCont);
187 : : void ChangeStyleName();
188 : : sal_Bool IsSkippedDivision();
189 : : };
190 : :
191 : 1644 : inline sal_Bool LwpDocument::IsChildDoc()
192 : : {
193 [ + + ]: 1644 : return (sal_Bool) ((m_nPersistentFlags & DOC_CHILDDOC) ? sal_True : sal_False);
194 : : }
195 : 690 : inline sal_Bool LwpDocument::HonorProtection()
196 : : {
197 [ + - ]: 690 : return m_nPersistentFlags & DOC_PROTECTED ? sal_True : sal_False;
198 : : }
199 : : inline LwpObjectID* LwpDocument::GetContentList()
200 : : {
201 : : return(m_pFoundry->GetContentManager()->GetContentList());
202 : : }
203 : 945 : inline LwpObjectID* LwpDocument::GetSocket()
204 : : {
205 : 945 : return &m_DocSockID;
206 : : }
207 : 21 : inline LwpFoundry* LwpDocument::GetFoundry()
208 : : {
209 : 21 : return m_pFoundry;
210 : : }
211 : 102 : inline LwpObjectID* LwpDocument::GetDivInfoID()
212 : : {
213 : 102 : return &m_DivInfo;
214 : : }
215 : 0 : inline LwpObjectID* LwpDocument::GetPageHintsID()
216 : : {
217 : 0 : return &m_WYSIWYGPageHints;
218 : : }
219 : 24 : inline LwpObjectID* LwpDocument::GetFootnoteOpts()
220 : : {
221 : 24 : return &m_FootnoteOpts;
222 : : }
223 : 12 : inline LwpObjectID* LwpDocument::GetDocData()
224 : : {
225 : 12 : return &m_DocData;
226 : : }
227 : 12 : inline LwpObjectID* LwpDocument::GetVerDoc()
228 : : {
229 : 12 : return &m_VerDoc;
230 : : }
231 : :
232 : : /**
233 : : * @brief DocumentSock object, divisions are embedded by document socket object
234 : : */
235 : : class LwpDocSock : public LwpDLNFVList
236 : : {
237 : : public:
238 : : LwpDocSock(LwpObjectHeader &objHdr, LwpSvStream* pStrm);
239 [ - + ]: 48 : ~LwpDocSock(){}
240 : : private:
241 : : LwpObjectID m_Doc;
242 : : protected:
243 : : void Read();
244 : : public:
245 : : void RegisterStyle();
246 : : void Parse(IXFStream* pOutputStream);
247 : : };
248 : :
249 : : #endif
250 : :
251 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|