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