1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * The Contents of this file are made available subject to the terms of
5 * either of the following licenses
7 * - GNU Lesser General Public License Version 2.1
8 * - Sun Industry Standards Source License Version 1.1
10 * Sun Microsystems Inc., October, 2000
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
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.
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.
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,
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.
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.
46 * The Initial Developer of the Original Code is: IBM Corporation
48 * Copyright: 2008 by IBM Corporation
50 * All Rights Reserved.
52 * Contributor(s): _______________________________________
55 ************************************************************************/
56 /*************************************************************************
58 * LwpDocument header file
59 ************************************************************************/
61 #ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPDOC_HXX
62 #define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPDOC_HXX
65 #include "lwpsortopt.hxx"
66 #include "lwpuidoc.hxx"
67 #include "lwplnopts.hxx"
68 #include "lwpusrdicts.hxx"
69 #include "lwpprtinfo.hxx"
70 #include "lwpdlvlist.hxx"
71 #include "lwpheader.hxx"
72 #include "lwpfoundry.hxx"
75 class LwpVirtualLayout
;
77 * @brief Document object, represent document and division
79 class LwpDocument
: public LwpDLNFPVList
82 LwpDocument(LwpObjectHeader
&objHdr
, LwpSvStream
* pStrm
);
83 virtual ~LwpDocument() override
;
86 LwpFoundry
* m_pOwnedFoundry
;
87 bool m_bGettingFirstDivisionWithContentsThatIsNotOLE
;
89 //Data members in file format
90 LwpObjectID m_DocSockID
;
92 sal_uInt32 m_nPersistentFlags
;
95 DOC_PROTECTED
= 0x00000004UL
,
96 DOC_CHILDDOC
= 0x00000800UL
99 //Code cleaning by change some members to local variables in Read()
100 //Reserve the comments for future use
101 //LwpSortOption* m_pDocSort;
102 //LwpUIDocument* m_pUIDoc;
103 LwpLineNumberOptions
* m_pLnOpts
;
104 //LwpUserDictFiles* m_pUsrDicts;
105 //LwpPrinterInfo* m_pPrtInfo;
107 LwpObjectID m_DivOpts
;
108 LwpObjectID m_FootnoteOpts
;
109 LwpObjectID m_DocData
;
110 LwpObjectID m_DivInfo
;
111 LwpAtomHolder m_Epoch
;
113 LwpObjectID m_WYSIWYGPageHints
;
114 LwpObjectID m_VerDoc
;
115 LwpObjectID m_STXInfo
;
118 void Read() override
;
120 void ParseDocContent(IXFStream
* pOutputStream
);
121 void RegisterTextStyles();
122 void RegisterLayoutStyles();
124 void RegisterStylesInPara();
125 void RegisterBulletStyles();
126 void RegisterGraphicsStyles();
127 void RegisterLinenumberStyles();
128 void RegisterFootnoteStyles();
129 void RegisterDefaultParaStyles();
132 void Parse(IXFStream
* pOutputStream
) override
;
133 void RegisterStyle() override
;
135 inline bool IsChildDoc();
136 inline bool GetHonorProtection();
137 inline LwpObjectID
& GetDocData();
138 inline LwpObjectID
& GetSocket();
140 inline LwpFoundry
* GetFoundry();
141 inline LwpObjectID
& GetDivInfoID();
142 inline LwpObjectID
& GetPageHintsID();
143 inline LwpObjectID
& GetFootnoteOpts();
144 inline LwpObjectID
& GetVerDoc();
145 LwpObjectID
* GetValidFootnoteOpts();
147 sal_uInt16
GetEndnoteType();
148 LwpDocument
* GetPreviousDivision();
149 LwpDocument
* GetNextDivision();
150 LwpDocument
* GetParentDivision();
151 LwpDocument
* GetPreviousInGroup();
153 LwpDocument
* GetNextInGroup();
154 LwpDocument
* GetPreviousDivisionWithContents();
155 LwpDocument
* GetLastDivisionWithContents();
156 LwpDocument
* GetLastInGroupWithContents();
157 LwpDocument
* GetRootDocument();
158 LwpDocument
* GetFirstDivisionWithContentsThatIsNotOLE()
160 if (m_bGettingFirstDivisionWithContentsThatIsNotOLE
)
161 throw std::runtime_error("recursion in page divisions");
162 m_bGettingFirstDivisionWithContentsThatIsNotOLE
= true;
163 LwpDocument
* pRet
= ImplGetFirstDivisionWithContentsThatIsNotOLE();
164 m_bGettingFirstDivisionWithContentsThatIsNotOLE
= false;
167 LwpDocument
* GetLastDivisionThatHasEndnote();
169 LwpDocument
* GetLastDivision();
170 LwpDocument
* GetFirstDivision();
171 rtl::Reference
<LwpVirtualLayout
> GetEnSuperTableLayout();
172 bool GetNumberOfPages(LwpDocument
* pEndDivision
, sal_uInt16
& nCount
);
174 sal_uInt16
GetNumberOfPagesBefore();
175 void ParseFrameInPage(IXFStream
* pOutputStream
);
178 void MaxNumberOfPages(sal_uInt16
& nNumPages
);
179 LwpDocument
* ImplGetFirstDivisionWithContentsThatIsNotOLE();
180 void XFConvertFrameInPage(XFContentContainer
* pCont
);
181 static void ChangeStyleName();
182 bool IsSkippedDivision();
185 inline bool LwpDocument::IsChildDoc()
187 return (m_nPersistentFlags
& DOC_CHILDDOC
) != 0;
189 inline bool LwpDocument::GetHonorProtection()
191 return (m_nPersistentFlags
& DOC_PROTECTED
) != 0;
193 inline LwpObjectID
& LwpDocument::GetSocket()
197 inline LwpFoundry
* LwpDocument::GetFoundry()
201 inline LwpObjectID
& LwpDocument::GetDivInfoID()
205 inline LwpObjectID
& LwpDocument::GetPageHintsID()
207 return m_WYSIWYGPageHints
;
209 inline LwpObjectID
& LwpDocument::GetFootnoteOpts()
211 return m_FootnoteOpts
;
213 inline LwpObjectID
& LwpDocument::GetDocData()
217 inline LwpObjectID
& LwpDocument::GetVerDoc()
223 * @brief DocumentSock object, divisions are embedded by document socket object
225 class LwpDocSock
: public LwpDLNFVList
228 LwpDocSock(LwpObjectHeader
&objHdr
, LwpSvStream
* pStrm
);
229 virtual ~LwpDocSock() override
{}
233 void Read() override
;
235 void RegisterStyle() override
;
236 void Parse(IXFStream
* pOutputStream
) override
;
241 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */