fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / lotuswordpro / source / filter / lwpfribframe.cxx
blobfc16cfd106a7b0fcd22e9efab182a3bce019d77b
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
60 /*************************************************************************
61 * Change History
62 Mar 2005 Created
63 ************************************************************************/
64 #include "lwpfribframe.hxx"
65 #include "xfilter/xfstylemanager.hxx"
66 #include "lwpglobalmgr.hxx"
67 #include "xfilter/xfchange.hxx"
68 /**
69 * @short: Read frame frib
70 * @param:
71 * @param:
74 void LwpFribFrame::Read(LwpObjectStream* pObjStrm, sal_uInt16 /*len*/)
76 m_objLayout.ReadIndexed(pObjStrm);
79 /**
80 * @descr: Get the layout object which the frib points to
83 rtl::Reference<LwpObject> LwpFribFrame::GetLayout()
85 return m_objLayout.obj();
88 /**
89 * @descr: register frame style
90 * @param: pFoundry - current foundry pointer
93 void LwpFribFrame::RegisterStyle(LwpFoundry* pFoundry)
95 rtl::Reference<LwpObject> pObject = m_objLayout.obj();
97 if (pObject.is() && pObject->GetTag() == VO_DROPCAPLAYOUT)
99 LwpDropcapLayout *pLayout = dynamic_cast<LwpDropcapLayout*>(pObject.get());
100 if (!pLayout)
101 return;
102 pLayout->RegisterStyle(pFoundry);
104 else
106 //register frame style
107 LwpPlacableLayout* pLayout = dynamic_cast<LwpPlacableLayout*>(pObject.get());
108 if (!pLayout)
109 return;
110 pLayout->SetFoundry(pFoundry);
111 pLayout->RegisterStyle();
113 //register next frib text style
114 sal_uInt8 nType = pLayout->GetRelativeType();
115 if(LwpLayoutRelativityGuts::LAY_INLINE_NEWLINE == nType
116 && HasNextFrib())
118 XFParaStyle* pOldStyle = m_pPara->GetXFParaStyle();
119 if (pOldStyle->GetMasterPage().isEmpty())
120 m_StyleName = pOldStyle->GetStyleName();
121 else
123 XFParaStyle* pParaStyle = new XFParaStyle;
124 *pParaStyle = *(pOldStyle);
125 XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
126 m_StyleName = pXFStyleManager->AddStyle(pParaStyle).m_pStyle->GetStyleName();
129 //remember the current paragraph font size which will be used in parsing frame
130 pLayout->SetFont(GetFont());
133 void LwpFribFrame::SetParaDropcap(LwpPara* pPara)
135 rtl::Reference<LwpObject> pObject = m_objLayout.obj();
137 if (pObject.is() && pObject->GetTag() == VO_DROPCAPLAYOUT)
139 pPara->SetParaDropcap(true);
140 pPara->SetDropcapLayout(dynamic_cast<LwpDropcapLayout*>(pObject.get()));
142 else
143 pPara->SetParaDropcap(false);
147 * @descr: convert frame
150 void LwpFribFrame::XFConvert(XFContentContainer* pCont)
152 XFContentContainer* pXFContentContainer = pCont;
153 LwpVirtualLayout* pLayout = dynamic_cast<LwpVirtualLayout*>(GetLayout().get());
154 if (!pLayout)
155 return;
156 sal_uInt8 nType = pLayout->GetRelativeType();
157 if( LwpLayoutRelativityGuts::LAY_PARA_RELATIVE == nType)
159 LwpVirtualLayout* pContainerLayout = pLayout->GetContainerLayout();
160 if(pContainerLayout && pContainerLayout->IsFrame())
162 //same page as text and in frame
163 pXFContentContainer = m_pPara->GetXFContainer();
165 else if(pContainerLayout && pContainerLayout->IsCell())
167 //same page as text and in cell, get the first xfpara
168 rtl::Reference<XFContent> first(
169 pCont->FindFirstContent(enumXFContentPara));
170 XFContentContainer* pXFFirtPara = static_cast<XFContentContainer*>(first.get());
171 if(pXFFirtPara)
172 pXFContentContainer = pXFFirtPara;
175 OUString sChangeID;
176 if(m_bRevisionFlag)
178 LwpGlobalMgr* pGlobal = LwpGlobalMgr::GetInstance();
179 LwpChangeMgr* pChangeMgr = pGlobal->GetLwpChangeMgr();
180 sChangeID = pChangeMgr->GetChangeID(this);
181 if (!sChangeID.isEmpty())
183 XFChangeStart* pChangeStart = new XFChangeStart;
184 pChangeStart->SetChangeID(sChangeID);
185 pXFContentContainer->Add(pChangeStart);
189 pLayout->XFConvert(pXFContentContainer);
191 if(m_bRevisionFlag)
193 if (!sChangeID.isEmpty())
195 XFChangeEnd* pChangeEnd = new XFChangeEnd;
196 pChangeEnd->SetChangeID(sChangeID);
197 pXFContentContainer->Add(pChangeEnd);
201 if(LwpLayoutRelativityGuts::LAY_INLINE_NEWLINE == nType
202 && HasNextFrib())
204 XFParagraph* pXFPara = new XFParagraph();
205 pXFPara->SetStyleName(m_StyleName);
206 m_pPara->AddXFContent(pXFPara);
207 m_pPara->GetFribs().SetXFPara(pXFPara);
213 * @descr: Read Ruby frame
216 void LwpFribRubyFrame::Read(LwpObjectStream* pObjStrm, sal_uInt16 /*len*/)
218 m_objLayout.ReadIndexed(pObjStrm);
221 * @descr: Register Ruby frame style
224 void LwpFribRubyFrame::RegisterStyle(LwpFoundry* pFoundry)
226 LwpRubyLayout* pLayout = GetLayout();
227 if (pLayout)
229 pLayout->SetFoundry(pFoundry);
230 pLayout->RegisterStyle();
234 * @descr: convert Ruby frame
237 void LwpFribRubyFrame::XFConvert(XFContentContainer* /*pCont*/)
239 LwpRubyLayout* pLayout = GetLayout();
240 if (pLayout)
242 pLayout->ConvertContentText();
246 LwpRubyLayout* LwpFribRubyFrame::GetLayout()
248 return dynamic_cast<LwpRubyLayout*>(m_objLayout.obj().get());
251 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */