/src/libreoffice/lotuswordpro/inc/lwpfoundry.hxx
Line | Count | Source |
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 | | * For LWP filter architecture prototype |
59 | | ************************************************************************/ |
60 | | |
61 | | #ifndef INCLUDED_LOTUSWORDPRO_INC_LWPFOUNDRY_HXX |
62 | | #define INCLUDED_LOTUSWORDPRO_INC_LWPFOUNDRY_HXX |
63 | | |
64 | | #include <config_lgpl.h> |
65 | | #include "lwpobjid.hxx" |
66 | | #include "lwpobjstrm.hxx" |
67 | | #include "lwpfont.hxx" |
68 | | #include "lwpdropcapmgr.hxx" |
69 | | #include "xfilter/ixfstyle.hxx" |
70 | | #include <unordered_map> |
71 | | #include <memory> |
72 | | |
73 | | class LwpDocument; |
74 | | class LwpBookMark; |
75 | | |
76 | | class LwpVersionManager |
77 | | { |
78 | | public: |
79 | | LwpVersionManager() = delete; |
80 | | static void Read(LwpObjectStream *pStrm); |
81 | | static void Skip(LwpObjectStream *pStrm); |
82 | | }; |
83 | | |
84 | | class LwpObjectManager |
85 | | { |
86 | | public: |
87 | 18.4k | LwpObjectManager(){} |
88 | | private: |
89 | | LwpObjectID m_Division; |
90 | | public: |
91 | | void Read(LwpObjectStream *pStrm); |
92 | | }; |
93 | | |
94 | | class LwpNumberManager |
95 | | { |
96 | | public: |
97 | 18.4k | LwpNumberManager(){} |
98 | | private: |
99 | | LwpObjectID m_TableRange; |
100 | | public: |
101 | | void Read(LwpObjectStream *pStrm); |
102 | 919 | const LwpObjectID& GetTableRangeID() const { return m_TableRange;} |
103 | | }; |
104 | | |
105 | | class LwpBulletManager |
106 | | { |
107 | | public: |
108 | 18.4k | LwpBulletManager(){} |
109 | | private: |
110 | | LwpObjectID m_Head; |
111 | | public: |
112 | | void Read(LwpObjectStream *pStrm); |
113 | 13.9k | LwpObjectID& GetHeadID() { return m_Head;} |
114 | | }; |
115 | | |
116 | | class LwpContent; |
117 | | class LwpContentManager |
118 | | { |
119 | | public: |
120 | 18.4k | LwpContentManager(){} |
121 | | private: |
122 | | LwpObjectID m_ContentList; |
123 | | LwpObjectID m_EnumHead; |
124 | | LwpObjectID m_EnumTail; |
125 | | LwpObjectID m_OleObjCount; |
126 | | |
127 | | LwpObjectID m_GrapHead; |
128 | | LwpObjectID m_GrapTail; |
129 | | LwpObjectID m_OleHead; |
130 | | LwpObjectID m_OleTail; |
131 | | public: |
132 | 12.7k | LwpObjectID& GetContentList() { return m_ContentList; } |
133 | 14.1k | LwpObjectID& GetGraphicListHead() { return m_GrapHead; } |
134 | | LwpContent* EnumContents(LwpContent* pContent); |
135 | | |
136 | | public: |
137 | | void Read(LwpObjectStream *pStrm); |
138 | | }; |
139 | | |
140 | | class LwpPieceManager |
141 | | { |
142 | | public: |
143 | 7.70k | LwpPieceManager(){} |
144 | | private: |
145 | | LwpObjectID m_GeometryPieceList; |
146 | | LwpObjectID m_ScalePieceList; |
147 | | LwpObjectID m_MarginsPieceList; |
148 | | LwpObjectID m_ColumnsPieceList; |
149 | | LwpObjectID m_BorderStuffPieceList; |
150 | | LwpObjectID m_GutterStuffPieceList; |
151 | | LwpObjectID m_BackgroundStuffPieceList; |
152 | | LwpObjectID m_JoinStuffPieceList; |
153 | | LwpObjectID m_ShadowPieceList; |
154 | | LwpObjectID m_NumericsPieceList; |
155 | | LwpObjectID m_RelativityPieceList; |
156 | | LwpObjectID m_AlignmentPieceList; |
157 | | LwpObjectID m_IndentPieceList; |
158 | | LwpObjectID m_ParaBorderPieceList; |
159 | | LwpObjectID m_SpacingPieceList; |
160 | | LwpObjectID m_BreaksPieceList; |
161 | | LwpObjectID m_NumberingPieceList; |
162 | | LwpObjectID m_TabPieceList; |
163 | | LwpObjectID m_CharacterBorderPieceList; |
164 | | LwpObjectID m_AmikakePieceList; |
165 | | |
166 | | LwpObjectID m_ParaBackgroundPieceList; |
167 | | LwpObjectID m_ExternalBorderStuffPieceList; |
168 | | LwpObjectID m_ExternalJoinStuffPieceList; |
169 | | |
170 | | public: |
171 | | void Read(LwpObjectStream *pStrm); |
172 | | }; |
173 | | |
174 | | class LwpOrderedObject; |
175 | | class LwpListList; |
176 | | class LwpOrderedObjectManager final |
177 | | { |
178 | | public: |
179 | 18.4k | LwpOrderedObjectManager(){} |
180 | | void Read(LwpObjectStream *pStrm); |
181 | | LwpOrderedObject* Enumerate(LwpOrderedObject* pLast); |
182 | | private: |
183 | | LwpListList* GetNextActiveListList(LwpListList* pLast); |
184 | | |
185 | | LwpObjectID m_Head; |
186 | | }; |
187 | | |
188 | | class LwpStyleManager; |
189 | | class LwpSection; |
190 | | class LwpBulletStyleMgr; |
191 | | class LwpFoundry |
192 | | { |
193 | | public: |
194 | | LwpFoundry( LwpObjectStream *pStrm, LwpDocument* pDoc ); |
195 | | ~LwpFoundry(); |
196 | | void Read(LwpObjectStream *pStrm); |
197 | | void RegisterAllLayouts(); |
198 | | private: |
199 | | LwpDocument* m_pDoc; |
200 | | bool m_bRegisteredAll; |
201 | | private: //file members |
202 | | LwpObjectManager m_ObjMgr; |
203 | | LwpObjectID m_MarkerHead; |
204 | | LwpObjectID m_FootnoteMgr; |
205 | | LwpNumberManager m_NumMgr; |
206 | | LwpBulletManager m_BulMgr; |
207 | | LwpOrderedObjectManager m_SectionList; |
208 | | |
209 | | LwpObjectID m_Layout; //The head layout |
210 | | LwpObjectID m_TextStyle; |
211 | | LwpObjectID m_DefaultTextStyle; |
212 | | LwpObjectID m_DefaultClickStyle; |
213 | | LwpObjectID m_PageStyle; |
214 | | LwpObjectID m_FrameStyle; |
215 | | LwpObjectID m_TableStyle; |
216 | | LwpObjectID m_CellStyle; |
217 | | LwpObjectID m_DftFrameStyle; |
218 | | LwpObjectID m_DftPageStyle; |
219 | | LwpObjectID m_DftTableStyle; |
220 | | LwpObjectID m_DftCellStyle; |
221 | | LwpObjectID m_DftColumnStyle; |
222 | | LwpObjectID m_DftLeftColumnStyle; |
223 | | LwpObjectID m_DftRighColumnStyle; |
224 | | |
225 | | LwpObjectID m_BookMarkHead; |
226 | | LwpObjectID m_DdeLinkHead; |
227 | | LwpObjectID m_DirtBagHead; |
228 | | LwpObjectID m_NamedOutlineSeqHead; |
229 | | LwpObjectID m_EnumLayoutHead; |
230 | | LwpObjectID m_EnumLayoutTail; |
231 | | |
232 | | LwpObjectID m_NamedObjects; |
233 | | sal_uInt32 m_nLastClickHere; |
234 | | |
235 | | LwpObjectID m_SmartTextMgr; |
236 | | |
237 | | LwpContentManager m_ContentMgr; |
238 | | LwpFontManager m_FontMgr; |
239 | | std::unique_ptr<LwpPieceManager> m_xPieceMgr; |
240 | | |
241 | | LwpObjectID m_DftDropCapStyle; |
242 | | LwpObjectID m_DftHeaderStyle; |
243 | | |
244 | | LwpObjectID m_DftFooterStyle; |
245 | | private: |
246 | | void ReadStyles(LwpObjectStream *pStrm); |
247 | | public: |
248 | 12.8k | LwpContentManager& GetContentManager() { return m_ContentMgr; } |
249 | 14.1k | LwpObjectID& GetGraphicListHead() { return m_ContentMgr.GetGraphicListHead(); } |
250 | 46.5k | LwpFontManager& GetFontManager() { return m_FontMgr;} |
251 | 13.9k | LwpObjectID& GetTextStyleHead() { return m_TextStyle;} |
252 | 1.10k | LwpObjectID& GetLayout() {return m_Layout;} |
253 | 13.9k | LwpObjectID& GetBulletManagerID() { return m_BulMgr.GetHeadID();} |
254 | 2.37M | LwpDocument* GetDocument(){ return m_pDoc;} |
255 | 919 | LwpNumberManager& GetNumberManager() { return m_NumMgr;} |
256 | | LwpObjectID * GetDefaultTextStyle() ; |
257 | | private: |
258 | | std::unique_ptr<LwpStyleManager> m_xStyleMgr; |
259 | | LwpDropcapMgr m_aDropcapMgr; |
260 | | std::unique_ptr<LwpBulletStyleMgr> m_xBulletStyleMgr; |
261 | | public: |
262 | 85.0k | LwpStyleManager* GetStyleManager() { return m_xStyleMgr.get(); } |
263 | | LwpBookMark* GetBookMark(LwpObjectID objMarker); |
264 | 6 | LwpDropcapMgr& GetDropcapMgr() { return m_aDropcapMgr; } |
265 | | LwpContent* EnumContents(LwpContent* pContent); |
266 | | LwpSection* EnumSections(LwpSection* pSection); |
267 | 60.1k | LwpBulletStyleMgr* GetBulletStyleMgr() { return m_xBulletStyleMgr.get(); } |
268 | | |
269 | | LwpObjectID* FindParaStyleByName(std::u16string_view name); |
270 | | OUString FindActualStyleName(const OUString& name); |
271 | | }; |
272 | | |
273 | | class LwpStyleManager |
274 | | { |
275 | | public: |
276 | | LwpStyleManager(); |
277 | | ~LwpStyleManager(); |
278 | | private: |
279 | | LwpFoundry* m_pFoundry; |
280 | | struct hashFunc |
281 | | { |
282 | | size_t operator()( const LwpObjectID& rName ) const |
283 | 82.3k | { |
284 | 82.3k | return rName.HashCode(); |
285 | 82.3k | } |
286 | | }; |
287 | | struct eqFunc |
288 | | { |
289 | | bool operator()( const LwpObjectID& rKey1, const LwpObjectID& rKey2 ) const |
290 | 41.0k | { |
291 | 41.0k | return(rKey1==rKey2); |
292 | 41.0k | } |
293 | | }; |
294 | | |
295 | | typedef std::unordered_map<LwpObjectID, IXFStyle*, hashFunc, eqFunc> LwpStyleMap; |
296 | | LwpStyleMap m_StyleList; |
297 | | public: |
298 | 18.4k | void SetFoundry(LwpFoundry* pFoundry){m_pFoundry = pFoundry;} |
299 | | void AddStyle(LwpObjectID styleObjID, std::unique_ptr<IXFStyle> pStyle); |
300 | | IXFStyle* GetStyle(const LwpObjectID &styleObjID); |
301 | | }; |
302 | | #endif |
303 | | |
304 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |