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,
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 ************************************************************************/
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() {}
72 * @descr Read object info
74 void LwpFootnoteLayout::Read()
76 LwpTableLayout::Read();
77 m_pObjStrm
->SkipExtra();
83 void LwpFootnoteLayout::RegisterStyle() {}
88 void LwpFootnoteLayout::XFConvert(XFContentContainer
* /*pCont*/) {}
90 LwpFnRowLayout::LwpFnRowLayout(LwpObjectHeader
const& objHdr
, LwpSvStream
* pStrm
)
91 : LwpRowLayout(objHdr
, pStrm
)
95 LwpFnRowLayout::~LwpFnRowLayout() {}
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
;
118 bool bAlreadySeen
= !aSeen
.insert(pCellLayout
).second
;
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());
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();
158 pObj
->SetFoundry(m_pFoundry
);
159 pObj
->DoRegisterStyle();
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());
194 pRowLayout
->SetFoundry(m_pFoundry
);
195 pRowLayout
->RegisterStyle();
197 pRowID
= &pRowLayout
->GetNext();
198 pRowLayout
= dynamic_cast<LwpRowLayout
*>(pRowID
->obj().get());
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();
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());
253 bool bAlreadySeen
= !aSeen
.insert(pLayout
).second
;
255 throw std::runtime_error("loop in conversion");
256 if (pLayout
->GetLayoutType() == LWP_ENDNOTE_LAYOUT
)
258 pID
= &pLayout
->GetPrevious();
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();
283 void LwpFnSuperTableLayout::RegisterStyle() {}
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());
305 if (pLayout
->GetLayoutType() == LWP_FOOTNOTE_LAYOUT
)
309 pID
= &pLayout
->GetPrevious();
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();
334 void LwpContFromLayout::RegisterStyle() {}
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();
360 void LwpContOnLayout::RegisterStyle() {}
365 void LwpContOnLayout::XFConvert(XFContentContainer
* /*pCont*/) {}
367 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */