cid#1606759 Data race condition
[LibreOffice.git] / lotuswordpro / source / filter / lwpdoc.hxx
blob24492dee76e9baba002ce2a502372a96eb0567bc
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,
29 * MA 02111-1307 USA
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 /*************************************************************************
57 * @file
58 * LwpDocument header file
59 ************************************************************************/
61 #ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPDOC_HXX
62 #define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPDOC_HXX
64 #include <config_lgpl.h>
65 #include "lwplnopts.hxx"
66 #include "lwpdlvlist.hxx"
67 #include <lwpfoundry.hxx>
68 #include <optional>
70 class IXFStream;
71 class LwpVirtualLayout;
72 /**
73 * @brief Document object, represent document and division
75 class LwpDocument : public LwpDLNFPVList
77 public:
78 LwpDocument(LwpObjectHeader const& objHdr, LwpSvStream* pStrm);
79 virtual ~LwpDocument() override;
81 private:
82 std::unique_ptr<LwpFoundry> m_xOwnedFoundry;
83 bool m_bGettingFirstDivisionWithContentsThatIsNotOLE;
84 bool m_bGettingPreviousDivisionWithContents;
85 bool m_bGettingGetLastDivisionWithContents;
87 //Data members in file format
88 LwpObjectID m_DocSockID;
89 sal_uInt16 m_nFlags;
90 sal_uInt32 m_nPersistentFlags;
91 enum
93 DOC_PROTECTED = 0x00000004UL,
94 DOC_CHILDDOC = 0x00000800UL
97 std::optional<LwpLineNumberOptions> m_oLnOpts;
99 LwpObjectID m_DivOpts;
100 LwpObjectID m_FootnoteOpts;
101 LwpObjectID m_DocData;
102 LwpObjectID m_DivInfo;
103 LwpAtomHolder m_Epoch;
105 LwpObjectID m_WYSIWYGPageHints;
106 LwpObjectID m_VerDoc;
107 LwpObjectID m_STXInfo;
109 protected:
110 void Read() override;
111 void ReadPlug();
112 void ParseDocContent(IXFStream* pOutputStream);
113 void RegisterTextStyles();
114 void RegisterLayoutStyles();
116 void RegisterStylesInPara();
117 void RegisterBulletStyles();
118 void RegisterGraphicsStyles();
119 void RegisterLinenumberStyles();
120 void RegisterFootnoteStyles();
121 void RegisterDefaultParaStyles();
123 public:
124 void Parse(IXFStream* pOutputStream) override;
125 void RegisterStyle() override;
127 inline bool IsChildDoc() const;
128 inline bool GetHonorProtection() const;
129 inline LwpObjectID& GetDocData();
130 inline LwpObjectID& GetSocket();
132 inline LwpFoundry* GetFoundry();
133 inline LwpObjectID& GetDivInfoID();
134 inline LwpObjectID& GetPageHintsID();
135 inline LwpObjectID& GetFootnoteOpts();
136 inline LwpObjectID& GetVerDoc();
137 LwpObjectID* GetValidFootnoteOpts();
139 sal_uInt16 GetEndnoteType();
140 LwpDocument* GetPreviousDivision();
141 LwpDocument* GetNextDivision();
142 LwpDocument* GetParentDivision();
143 LwpDocument* GetPreviousInGroup();
145 LwpDocument* GetNextInGroup();
146 LwpDocument* GetPreviousDivisionWithContents();
147 LwpDocument* GetLastDivisionWithContents();
148 LwpDocument* GetLastInGroupWithContents();
149 LwpDocument* GetRootDocument();
150 LwpDocument* GetFirstDivisionWithContentsThatIsNotOLE()
152 if (m_bGettingFirstDivisionWithContentsThatIsNotOLE)
153 throw std::runtime_error("recursion in page divisions");
154 m_bGettingFirstDivisionWithContentsThatIsNotOLE = true;
155 LwpDocument* pRet = ImplGetFirstDivisionWithContentsThatIsNotOLE();
156 m_bGettingFirstDivisionWithContentsThatIsNotOLE = false;
157 return pRet;
159 LwpDocument* GetLastDivisionThatHasEndnote();
161 LwpDocument* GetLastDivision();
162 LwpDocument* GetFirstDivision();
163 rtl::Reference<LwpVirtualLayout> GetEnSuperTableLayout();
164 bool GetNumberOfPages(LwpDocument* pEndDivision, sal_uInt16& nCount);
166 sal_uInt16 GetNumberOfPagesBefore();
167 void ParseFrameInPage(IXFStream* pOutputStream);
169 private:
170 LwpDocument* ImplGetFirstDivisionWithContentsThatIsNotOLE();
171 void XFConvertFrameInPage(XFContentContainer* pCont);
172 static void ChangeStyleName();
173 bool IsSkippedDivision();
176 inline bool LwpDocument::IsChildDoc() const { return (m_nPersistentFlags & DOC_CHILDDOC) != 0; }
177 inline bool LwpDocument::GetHonorProtection() const
179 return (m_nPersistentFlags & DOC_PROTECTED) != 0;
181 inline LwpObjectID& LwpDocument::GetSocket() { return m_DocSockID; }
182 inline LwpFoundry* LwpDocument::GetFoundry() { return m_xOwnedFoundry.get(); }
183 inline LwpObjectID& LwpDocument::GetDivInfoID() { return m_DivInfo; }
184 inline LwpObjectID& LwpDocument::GetPageHintsID() { return m_WYSIWYGPageHints; }
185 inline LwpObjectID& LwpDocument::GetFootnoteOpts() { return m_FootnoteOpts; }
186 inline LwpObjectID& LwpDocument::GetDocData() { return m_DocData; }
187 inline LwpObjectID& LwpDocument::GetVerDoc() { return m_VerDoc; }
190 * @brief DocumentSock object, divisions are embedded by document socket object
192 class LwpDocSock : public LwpDLNFVList
194 public:
195 LwpDocSock(LwpObjectHeader const& objHdr, LwpSvStream* pStrm);
197 private:
198 LwpObjectID m_Doc;
200 protected:
201 void Read() override;
203 public:
204 void RegisterStyle() override;
205 void Parse(IXFStream* pOutputStream) override;
208 #endif
210 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */