tdf#131098 docx export: write fill property of graphic
[LibreOffice.git] / lotuswordpro / source / filter / lwpfnlayout.cxx
blobb91b86a3dab1721fa445c7be2a27c2888304856b
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"
62 #include <o3tl/sorted_vector.hxx>
64 LwpFootnoteLayout::LwpFootnoteLayout(LwpObjectHeader const& objHdr, LwpSvStream* pStrm)
65 : LwpTableLayout(objHdr, pStrm)
69 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() {}
85 /**
86 * @descr Do nothing
88 void LwpFootnoteLayout::XFConvert(XFContentContainer* /*pCont*/) {}
90 LwpFnRowLayout::LwpFnRowLayout(LwpObjectHeader const& objHdr, LwpSvStream* pStrm)
91 : LwpRowLayout(objHdr, pStrm)
95 LwpFnRowLayout::~LwpFnRowLayout() {}
97 /**
98 * @descr Read object info
100 void LwpFnRowLayout::Read()
102 LwpRowLayout::Read();
103 m_pObjStrm->SkipExtra();
107 * @descr Register footnote/endnote contents style
109 void LwpFnRowLayout::RegisterStyle()
111 // register cells' style
112 LwpObjectID* pCellID = &GetChildHead();
113 LwpCellLayout* pCellLayout = dynamic_cast<LwpCellLayout*>(pCellID->obj().get());
115 o3tl::sorted_vector<LwpCellLayout*> aSeen;
116 while (pCellLayout)
118 bool bAlreadySeen = !aSeen.insert(pCellLayout).second;
119 if (bAlreadySeen)
120 throw std::runtime_error("loop in conversion");
121 pCellLayout->SetFoundry(m_pFoundry);
122 pCellLayout->RegisterStyle();
123 pCellID = &pCellLayout->GetNext();
124 pCellLayout = dynamic_cast<LwpCellLayout*>(pCellID->obj().get());
129 * @descr Do nothing
131 void LwpFnRowLayout::XFConvert(XFContentContainer* /*pCont*/) {}
133 LwpFnCellLayout::LwpFnCellLayout(LwpObjectHeader const& objHdr, LwpSvStream* pStrm)
134 : LwpCellLayout(objHdr, pStrm)
138 LwpFnCellLayout::~LwpFnCellLayout() {}
141 * @descr Read object info
143 void LwpFnCellLayout::Read()
145 LwpCellLayout::Read();
146 m_pObjStrm->SkipExtra();
150 * @descr Register footnote/endnote contents style
152 void LwpFnCellLayout::RegisterStyle()
154 // content object register styles
155 rtl::Reference<LwpObject> pObj = m_Content.obj();
156 if (pObj.is())
158 pObj->SetFoundry(m_pFoundry);
159 pObj->DoRegisterStyle();
164 * @descr Do nothing
166 void LwpFnCellLayout::XFConvert(XFContentContainer* /*pCont*/) {}
168 LwpEndnoteLayout::LwpEndnoteLayout(LwpObjectHeader const& objHdr, LwpSvStream* pStrm)
169 : LwpTableLayout(objHdr, pStrm)
173 LwpEndnoteLayout::~LwpEndnoteLayout() {}
176 * @descr Read object info
178 void LwpEndnoteLayout::Read()
180 LwpTableLayout::Read();
181 m_pObjStrm->SkipExtra();
185 * @descr Register footnote/endnote contents style
187 void LwpEndnoteLayout::RegisterStyle()
189 // register style of rows
190 LwpObjectID* pRowID = &GetChildHead();
191 LwpRowLayout* pRowLayout = dynamic_cast<LwpRowLayout*>(pRowID->obj().get());
192 while (pRowLayout)
194 pRowLayout->SetFoundry(m_pFoundry);
195 pRowLayout->RegisterStyle();
197 pRowID = &pRowLayout->GetNext();
198 pRowLayout = dynamic_cast<LwpRowLayout*>(pRowID->obj().get());
203 * @descr Do nothing
205 void LwpEndnoteLayout::XFConvert(XFContentContainer* /*pCont*/) {}
207 LwpEnSuperTableLayout::LwpEnSuperTableLayout(LwpObjectHeader const& objHdr, LwpSvStream* pStrm)
208 : LwpSuperTableLayout(objHdr, pStrm)
212 LwpEnSuperTableLayout::~LwpEnSuperTableLayout() {}
215 * @descr Read object info
217 void LwpEnSuperTableLayout::Read()
219 LwpSuperTableLayout::Read();
220 m_pObjStrm->SkipExtra();
223 void LwpEnSuperTableLayout::RegisterStyle()
225 // if this layout is style of real table entry
226 LwpVirtualLayout* pTableLayout = GetMainTableLayout();
227 if (pTableLayout != nullptr)
229 pTableLayout->SetFoundry(m_pFoundry);
230 pTableLayout->DoRegisterStyle();
235 * @descr Do nothing
237 void LwpEnSuperTableLayout::XFConvert(XFContentContainer* /*pCont*/) {}
240 * @short Get child endnote layout
241 * @return pointer to endnote layout
243 LwpVirtualLayout* LwpEnSuperTableLayout::GetMainTableLayout()
245 LwpObjectID* pID = &GetChildTail();
247 o3tl::sorted_vector<LwpVirtualLayout*> aSeen;
248 while (!pID->IsNull())
250 LwpVirtualLayout* pLayout = dynamic_cast<LwpVirtualLayout*>(pID->obj().get());
251 if (!pLayout)
252 break;
253 bool bAlreadySeen = !aSeen.insert(pLayout).second;
254 if (bAlreadySeen)
255 throw std::runtime_error("loop in conversion");
256 if (pLayout->GetLayoutType() == LWP_ENDNOTE_LAYOUT)
257 return pLayout;
258 pID = &pLayout->GetPrevious();
261 return nullptr;
264 LwpFnSuperTableLayout::LwpFnSuperTableLayout(LwpObjectHeader const& objHdr, LwpSvStream* pStrm)
265 : LwpEnSuperTableLayout(objHdr, pStrm)
269 LwpFnSuperTableLayout::~LwpFnSuperTableLayout() {}
272 * @descr Read object info
274 void LwpFnSuperTableLayout::Read()
276 LwpEnSuperTableLayout::Read();
277 m_pObjStrm->SkipExtra();
281 * @descr Do nothing
283 void LwpFnSuperTableLayout::RegisterStyle() {}
286 * @descr Do nothing
288 void LwpFnSuperTableLayout::XFConvert(XFContentContainer* /*pCont*/) {}
291 * @short Get child footnote layout
292 * @return pointer to footnote layout
294 LwpVirtualLayout* LwpFnSuperTableLayout::GetMainTableLayout()
296 LwpObjectID* pID = &GetChildTail();
298 while (pID && !pID->IsNull())
300 LwpVirtualLayout* pLayout = dynamic_cast<LwpVirtualLayout*>(pID->obj().get());
301 if (!pLayout)
303 break;
305 if (pLayout->GetLayoutType() == LWP_FOOTNOTE_LAYOUT)
307 return pLayout;
309 pID = &pLayout->GetPrevious();
312 return nullptr;
315 LwpContFromLayout::LwpContFromLayout(LwpObjectHeader const& objHdr, LwpSvStream* pStrm)
316 : LwpPlacableLayout(objHdr, pStrm)
320 LwpContFromLayout::~LwpContFromLayout() {}
323 * @descr Read object info
325 void LwpContFromLayout::Read()
327 LwpPlacableLayout::Read();
328 m_pObjStrm->SkipExtra();
332 * @descr Do nothing
334 void LwpContFromLayout::RegisterStyle() {}
337 * @descr Do nothing
339 void LwpContFromLayout::XFConvert(XFContentContainer* /*pCont*/) {}
341 LwpContOnLayout::LwpContOnLayout(LwpObjectHeader const& objHdr, LwpSvStream* pStrm)
342 : LwpPlacableLayout(objHdr, pStrm)
346 LwpContOnLayout::~LwpContOnLayout() {}
349 * @descr Read object info
351 void LwpContOnLayout::Read()
353 LwpPlacableLayout::Read();
354 m_pObjStrm->SkipExtra();
358 * @descr Do nothing
360 void LwpContOnLayout::RegisterStyle() {}
363 * @descr Do nothing
365 void LwpContOnLayout::XFConvert(XFContentContainer* /*pCont*/) {}
367 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */