tdf#137105: crash in table with Style Inspector active
[LibreOffice.git] / lotuswordpro / source / filter / lwpfnlayout.cxx
blobf95a1eddb62244dd7c859d82e9d09dae96caa6b3
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 * For LWP filter architecture prototype - footnote layouts
61 #include "lwpfnlayout.hxx"
63 LwpFootnoteLayout::LwpFootnoteLayout(LwpObjectHeader const &objHdr, LwpSvStream *pStrm)
64 :LwpTableLayout(objHdr, pStrm)
68 LwpFootnoteLayout::~LwpFootnoteLayout()
71 /**
72 * @descr Read object info
74 void LwpFootnoteLayout::Read()
76 LwpTableLayout::Read();
77 m_pObjStrm->SkipExtra();
80 /**
81 * @descr Do nothing
83 void LwpFootnoteLayout::RegisterStyle()
87 /**
88 * @descr Do nothing
90 void LwpFootnoteLayout::XFConvert(XFContentContainer * /*pCont*/)
94 LwpFnRowLayout::LwpFnRowLayout(LwpObjectHeader const &objHdr, LwpSvStream *pStrm)
95 :LwpRowLayout(objHdr, pStrm)
99 LwpFnRowLayout::~LwpFnRowLayout()
103 * @descr Read object info
105 void LwpFnRowLayout::Read()
107 LwpRowLayout::Read();
108 m_pObjStrm->SkipExtra();
112 * @descr Register footnote/endnote contents style
114 void LwpFnRowLayout::RegisterStyle()
116 // register cells' style
117 LwpObjectID* pCellID = &GetChildHead();
118 LwpCellLayout * pCellLayout = dynamic_cast<LwpCellLayout *>(pCellID->obj().get());
120 while(pCellLayout)
122 pCellLayout->SetFoundry(m_pFoundry);
123 pCellLayout->RegisterStyle();
124 pCellID = &pCellLayout->GetNext();
125 pCellLayout = dynamic_cast<LwpCellLayout *>(pCellID->obj().get());
130 * @descr Do nothing
132 void LwpFnRowLayout::XFConvert(XFContentContainer * /*pCont*/)
136 LwpFnCellLayout::LwpFnCellLayout(LwpObjectHeader const &objHdr, LwpSvStream *pStrm)
137 :LwpCellLayout(objHdr, pStrm)
141 LwpFnCellLayout::~LwpFnCellLayout()
145 * @descr Read object info
147 void LwpFnCellLayout::Read()
149 LwpCellLayout::Read();
150 m_pObjStrm->SkipExtra();
154 * @descr Register footnote/endnote contents style
156 void LwpFnCellLayout::RegisterStyle()
158 // content object register styles
159 rtl::Reference<LwpObject> pObj = m_Content.obj();
160 if (pObj.is())
162 pObj->SetFoundry(m_pFoundry);
163 pObj->DoRegisterStyle();
168 * @descr Do nothing
170 void LwpFnCellLayout::XFConvert(XFContentContainer * /*pCont*/)
174 LwpEndnoteLayout::LwpEndnoteLayout(LwpObjectHeader const &objHdr, LwpSvStream *pStrm)
175 :LwpTableLayout(objHdr, pStrm)
179 LwpEndnoteLayout::~LwpEndnoteLayout()
183 * @descr Read object info
185 void LwpEndnoteLayout::Read()
187 LwpTableLayout::Read();
188 m_pObjStrm->SkipExtra();
192 * @descr Register footnote/endnote contents style
194 void LwpEndnoteLayout::RegisterStyle()
196 // register style of rows
197 LwpObjectID* pRowID = &GetChildHead();
198 LwpRowLayout * pRowLayout = dynamic_cast<LwpRowLayout *>(pRowID->obj().get());
199 while (pRowLayout)
201 pRowLayout->SetFoundry(m_pFoundry);
202 pRowLayout->RegisterStyle();
204 pRowID = &pRowLayout->GetNext();
205 pRowLayout = dynamic_cast<LwpRowLayout *>(pRowID->obj().get());
210 * @descr Do nothing
212 void LwpEndnoteLayout::XFConvert(XFContentContainer * /*pCont*/)
216 LwpEnSuperTableLayout::LwpEnSuperTableLayout(LwpObjectHeader const &objHdr, LwpSvStream *pStrm)
217 :LwpSuperTableLayout(objHdr, pStrm)
221 LwpEnSuperTableLayout::~LwpEnSuperTableLayout()
225 * @descr Read object info
227 void LwpEnSuperTableLayout::Read()
229 LwpSuperTableLayout::Read();
230 m_pObjStrm->SkipExtra();
233 void LwpEnSuperTableLayout::RegisterStyle()
235 // if this layout is style of real table entry
236 LwpVirtualLayout* pTableLayout = GetMainTableLayout();
237 if (pTableLayout != nullptr)
239 pTableLayout->SetFoundry(m_pFoundry);
240 pTableLayout->DoRegisterStyle();
245 * @descr Do nothing
247 void LwpEnSuperTableLayout::XFConvert(XFContentContainer * /*pCont*/)
252 * @short Get child endnote layout
253 * @return pointer to endnote layout
255 LwpVirtualLayout* LwpEnSuperTableLayout::GetMainTableLayout()
257 LwpObjectID *pID = &GetChildTail();
259 LwpVirtualLayout *pPrevLayout = nullptr;
260 while(!pID->IsNull())
262 LwpVirtualLayout* pLayout = dynamic_cast<LwpVirtualLayout*>(pID->obj().get());
263 if (!pLayout || pLayout == pPrevLayout)
265 break;
267 if (pLayout->GetLayoutType() == LWP_ENDNOTE_LAYOUT)
269 return pLayout;
271 pID = &pLayout->GetPrevious();
272 pPrevLayout = pLayout;
275 return nullptr;
278 LwpFnSuperTableLayout::LwpFnSuperTableLayout(LwpObjectHeader const &objHdr, LwpSvStream *pStrm)
279 :LwpEnSuperTableLayout(objHdr, pStrm)
283 LwpFnSuperTableLayout::~LwpFnSuperTableLayout()
287 * @descr Read object info
289 void LwpFnSuperTableLayout::Read()
291 LwpEnSuperTableLayout::Read();
292 m_pObjStrm->SkipExtra();
296 * @descr Do nothing
298 void LwpFnSuperTableLayout::RegisterStyle()
303 * @descr Do nothing
305 void LwpFnSuperTableLayout::XFConvert(XFContentContainer * /*pCont*/)
310 * @short Get child footnote layout
311 * @return pointer to footnote layout
313 LwpVirtualLayout* LwpFnSuperTableLayout::GetMainTableLayout()
315 LwpObjectID *pID = &GetChildTail();
317 while(pID && !pID->IsNull())
319 LwpVirtualLayout * pLayout = dynamic_cast<LwpVirtualLayout *>(pID->obj().get());
320 if(!pLayout)
322 break;
324 if (pLayout->GetLayoutType() == LWP_FOOTNOTE_LAYOUT)
326 return pLayout;
328 pID = &pLayout->GetPrevious();
331 return nullptr;
334 LwpContFromLayout::LwpContFromLayout(LwpObjectHeader const &objHdr, LwpSvStream *pStrm)
335 :LwpPlacableLayout(objHdr, pStrm)
339 LwpContFromLayout::~LwpContFromLayout()
343 * @descr Read object info
345 void LwpContFromLayout::Read()
347 LwpPlacableLayout::Read();
348 m_pObjStrm->SkipExtra();
352 * @descr Do nothing
354 void LwpContFromLayout::RegisterStyle()
359 * @descr Do nothing
361 void LwpContFromLayout::XFConvert(XFContentContainer * /*pCont*/)
365 LwpContOnLayout::LwpContOnLayout(LwpObjectHeader const &objHdr, LwpSvStream *pStrm)
366 :LwpPlacableLayout(objHdr, pStrm)
370 LwpContOnLayout::~LwpContOnLayout()
374 * @descr Read object info
376 void LwpContOnLayout::Read()
378 LwpPlacableLayout::Read();
379 m_pObjStrm->SkipExtra();
383 * @descr Do nothing
385 void LwpContOnLayout::RegisterStyle()
390 * @descr Do nothing
392 void LwpContOnLayout::XFConvert(XFContentContainer * /*pCont*/)
396 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */