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 - footnote layouts
59  */
60 
61 #include "lwpfnlayout.hxx"
62 
LwpFootnoteLayout(LwpObjectHeader const & objHdr,LwpSvStream * pStrm)63 LwpFootnoteLayout::LwpFootnoteLayout(LwpObjectHeader const &objHdr, LwpSvStream *pStrm)
64     :LwpTableLayout(objHdr, pStrm)
65 {
66 }
67 
~LwpFootnoteLayout()68 LwpFootnoteLayout::~LwpFootnoteLayout()
69 {}
70 
71 /**
72  * @descr  Read object info
73  */
Read()74 void LwpFootnoteLayout::Read()
75 {
76     LwpTableLayout::Read();
77     m_pObjStrm->SkipExtra();
78 }
79 
80 /**
81  * @descr  Do nothing
82  */
RegisterStyle()83 void LwpFootnoteLayout::RegisterStyle()
84 {
85 }
86 
87 /**
88  * @descr  Do nothing
89  */
XFConvert(XFContentContainer *)90 void LwpFootnoteLayout::XFConvert(XFContentContainer * /*pCont*/)
91 {
92 }
93 
LwpFnRowLayout(LwpObjectHeader const & objHdr,LwpSvStream * pStrm)94 LwpFnRowLayout::LwpFnRowLayout(LwpObjectHeader const &objHdr, LwpSvStream *pStrm)
95     :LwpRowLayout(objHdr, pStrm)
96 {
97 }
98 
~LwpFnRowLayout()99 LwpFnRowLayout::~LwpFnRowLayout()
100 {}
101 
102 /**
103  * @descr  Read object info
104  */
Read()105 void LwpFnRowLayout::Read()
106 {
107     LwpRowLayout::Read();
108     m_pObjStrm->SkipExtra();
109 }
110 
111 /**
112  * @descr  Register footnote/endnote contents style
113  */
RegisterStyle()114 void LwpFnRowLayout::RegisterStyle()
115 {
116     // register cells' style
117     LwpObjectID* pCellID = &GetChildHead();
118     LwpCellLayout * pCellLayout = dynamic_cast<LwpCellLayout *>(pCellID->obj().get());
119 
120     while(pCellLayout)
121     {
122         pCellLayout->SetFoundry(m_pFoundry);
123         pCellLayout->RegisterStyle();
124         pCellID = &pCellLayout->GetNext();
125         pCellLayout = dynamic_cast<LwpCellLayout *>(pCellID->obj().get());
126     }
127 }
128 
129 /**
130  * @descr  Do nothing
131  */
XFConvert(XFContentContainer *)132 void LwpFnRowLayout::XFConvert(XFContentContainer * /*pCont*/)
133 {
134 }
135 
LwpFnCellLayout(LwpObjectHeader const & objHdr,LwpSvStream * pStrm)136 LwpFnCellLayout::LwpFnCellLayout(LwpObjectHeader const &objHdr, LwpSvStream *pStrm)
137     :LwpCellLayout(objHdr, pStrm)
138 {
139 }
140 
~LwpFnCellLayout()141 LwpFnCellLayout::~LwpFnCellLayout()
142 {}
143 
144 /**
145  * @descr  Read object info
146  */
Read()147 void LwpFnCellLayout::Read()
148 {
149     LwpCellLayout::Read();
150     m_pObjStrm->SkipExtra();
151 }
152 
153 /**
154  * @descr  Register footnote/endnote contents style
155  */
RegisterStyle()156 void LwpFnCellLayout::RegisterStyle()
157 {
158     // content object register styles
159     rtl::Reference<LwpObject> pObj = m_Content.obj();
160     if (pObj.is())
161     {
162         pObj->SetFoundry(m_pFoundry);
163         pObj->DoRegisterStyle();
164     }
165 }
166 
167 /**
168  * @descr  Do nothing
169  */
XFConvert(XFContentContainer *)170 void LwpFnCellLayout::XFConvert(XFContentContainer * /*pCont*/)
171 {
172 }
173 
LwpEndnoteLayout(LwpObjectHeader const & objHdr,LwpSvStream * pStrm)174 LwpEndnoteLayout::LwpEndnoteLayout(LwpObjectHeader const &objHdr, LwpSvStream *pStrm)
175     :LwpTableLayout(objHdr, pStrm)
176 {
177 }
178 
~LwpEndnoteLayout()179 LwpEndnoteLayout::~LwpEndnoteLayout()
180 {}
181 
182 /**
183  * @descr  Read object info
184  */
Read()185 void LwpEndnoteLayout::Read()
186 {
187     LwpTableLayout::Read();
188     m_pObjStrm->SkipExtra();
189 }
190 
191 /**
192  * @descr  Register footnote/endnote contents style
193  */
RegisterStyle()194 void LwpEndnoteLayout::RegisterStyle()
195 {
196     // register style of rows
197     LwpObjectID* pRowID = &GetChildHead();
198     LwpRowLayout * pRowLayout = dynamic_cast<LwpRowLayout *>(pRowID->obj().get());
199     while (pRowLayout)
200     {
201         pRowLayout->SetFoundry(m_pFoundry);
202         pRowLayout->RegisterStyle();
203 
204         pRowID = &pRowLayout->GetNext();
205         pRowLayout = dynamic_cast<LwpRowLayout *>(pRowID->obj().get());
206     }
207 }
208 
209 /**
210  * @descr  Do nothing
211  */
XFConvert(XFContentContainer *)212 void LwpEndnoteLayout::XFConvert(XFContentContainer * /*pCont*/)
213 {
214 }
215 
LwpEnSuperTableLayout(LwpObjectHeader const & objHdr,LwpSvStream * pStrm)216 LwpEnSuperTableLayout::LwpEnSuperTableLayout(LwpObjectHeader const &objHdr, LwpSvStream *pStrm)
217     :LwpSuperTableLayout(objHdr, pStrm)
218 {
219 }
220 
~LwpEnSuperTableLayout()221 LwpEnSuperTableLayout::~LwpEnSuperTableLayout()
222 {}
223 
224 /**
225  * @descr  Read object info
226  */
Read()227 void LwpEnSuperTableLayout::Read()
228 {
229     LwpSuperTableLayout::Read();
230     m_pObjStrm->SkipExtra();
231 }
232 
RegisterStyle()233 void LwpEnSuperTableLayout::RegisterStyle()
234 {
235     // if this layout is style of real table entry
236     LwpVirtualLayout* pTableLayout = GetMainTableLayout();
237     if (pTableLayout != nullptr)
238     {
239         pTableLayout->SetFoundry(m_pFoundry);
240         pTableLayout->DoRegisterStyle();
241     }
242 }
243 
244 /**
245  * @descr  Do nothing
246  */
XFConvert(XFContentContainer *)247 void LwpEnSuperTableLayout::XFConvert(XFContentContainer * /*pCont*/)
248 {
249 }
250 
251 /**
252  * @short   Get child endnote layout
253  * @return pointer to endnote layout
254  */
GetMainTableLayout()255 LwpVirtualLayout* LwpEnSuperTableLayout::GetMainTableLayout()
256 {
257     LwpObjectID *pID = &GetChildTail();
258 
259     LwpVirtualLayout *pPrevLayout = nullptr;
260     while(!pID->IsNull())
261     {
262         LwpVirtualLayout* pLayout = dynamic_cast<LwpVirtualLayout*>(pID->obj().get());
263         if (!pLayout || pLayout == pPrevLayout)
264         {
265             break;
266         }
267         if (pLayout->GetLayoutType() == LWP_ENDNOTE_LAYOUT)
268         {
269             return pLayout;
270         }
271         pID = &pLayout->GetPrevious();
272         pPrevLayout = pLayout;
273     }
274 
275     return nullptr;
276 }
277 
LwpFnSuperTableLayout(LwpObjectHeader const & objHdr,LwpSvStream * pStrm)278 LwpFnSuperTableLayout::LwpFnSuperTableLayout(LwpObjectHeader const &objHdr, LwpSvStream *pStrm)
279     :LwpEnSuperTableLayout(objHdr, pStrm)
280 {
281 }
282 
~LwpFnSuperTableLayout()283 LwpFnSuperTableLayout::~LwpFnSuperTableLayout()
284 {}
285 
286 /**
287  * @descr  Read object info
288  */
Read()289 void LwpFnSuperTableLayout::Read()
290 {
291     LwpEnSuperTableLayout::Read();
292     m_pObjStrm->SkipExtra();
293 }
294 
295 /**
296  * @descr  Do nothing
297  */
RegisterStyle()298 void LwpFnSuperTableLayout::RegisterStyle()
299 {
300 }
301 
302 /**
303  * @descr  Do nothing
304  */
XFConvert(XFContentContainer *)305 void LwpFnSuperTableLayout::XFConvert(XFContentContainer * /*pCont*/)
306 {
307 }
308 
309 /**
310  * @short   Get child footnote layout
311  * @return pointer to footnote layout
312  */
GetMainTableLayout()313 LwpVirtualLayout* LwpFnSuperTableLayout::GetMainTableLayout()
314 {
315     LwpObjectID *pID = &GetChildTail();
316 
317     while(pID && !pID->IsNull())
318     {
319         LwpVirtualLayout * pLayout = dynamic_cast<LwpVirtualLayout *>(pID->obj().get());
320         if(!pLayout)
321         {
322             break;
323         }
324         if (pLayout->GetLayoutType() == LWP_FOOTNOTE_LAYOUT)
325         {
326             return pLayout;
327         }
328         pID = &pLayout->GetPrevious();
329     }
330 
331     return nullptr;
332 }
333 
LwpContFromLayout(LwpObjectHeader const & objHdr,LwpSvStream * pStrm)334 LwpContFromLayout::LwpContFromLayout(LwpObjectHeader const &objHdr, LwpSvStream *pStrm)
335     :LwpPlacableLayout(objHdr, pStrm)
336 {
337 }
338 
~LwpContFromLayout()339 LwpContFromLayout::~LwpContFromLayout()
340 {}
341 
342 /**
343  * @descr  Read object info
344  */
Read()345 void LwpContFromLayout::Read()
346 {
347     LwpPlacableLayout::Read();
348     m_pObjStrm->SkipExtra();
349 }
350 
351 /**
352  * @descr  Do nothing
353  */
RegisterStyle()354 void LwpContFromLayout::RegisterStyle()
355 {
356 }
357 
358 /**
359  * @descr  Do nothing
360  */
XFConvert(XFContentContainer *)361 void LwpContFromLayout::XFConvert(XFContentContainer * /*pCont*/)
362 {
363 }
364 
LwpContOnLayout(LwpObjectHeader const & objHdr,LwpSvStream * pStrm)365 LwpContOnLayout::LwpContOnLayout(LwpObjectHeader const &objHdr, LwpSvStream *pStrm)
366     :LwpPlacableLayout(objHdr, pStrm)
367 {
368 }
369 
~LwpContOnLayout()370 LwpContOnLayout::~LwpContOnLayout()
371 {}
372 
373 /**
374  * @descr  Read object info
375  */
Read()376 void LwpContOnLayout::Read()
377 {
378     LwpPlacableLayout::Read();
379     m_pObjStrm->SkipExtra();
380 }
381 
382 /**
383  * @descr  Do nothing
384  */
RegisterStyle()385 void LwpContOnLayout::RegisterStyle()
386 {
387 }
388 
389 /**
390  * @descr  Do nothing
391  */
XFConvert(XFContentContainer *)392 void LwpContOnLayout::XFConvert(XFContentContainer * /*pCont*/)
393 {
394 }
395 
396 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
397