merge the formfield patch from ooo-build
[ooovba.git] / lotuswordpro / source / filter / lwpfribframe.cxx
blob448d0332153aa6b88a373fda8a544535ad67913c
1 /*************************************************************************
3 * The Contents of this file are made available subject to the terms of
4 * either of the following licenses
6 * - GNU Lesser General Public License Version 2.1
7 * - Sun Industry Standards Source License Version 1.1
9 * Sun Microsystems Inc., October, 2000
11 * GNU Lesser General Public License Version 2.1
12 * =============================================
13 * Copyright 2000 by Sun Microsystems, Inc.
14 * 901 San Antonio Road, Palo Alto, CA 94303, USA
16 * This library is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU Lesser General Public
18 * License version 2.1, as published by the Free Software Foundation.
20 * This library is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 * Lesser General Public License for more details.
25 * You should have received a copy of the GNU Lesser General Public
26 * License along with this library; if not, write to the Free Software
27 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
28 * MA 02111-1307 USA
31 * Sun Industry Standards Source License Version 1.1
32 * =================================================
33 * The contents of this file are subject to the Sun Industry Standards
34 * Source License Version 1.1 (the "License"); You may not use this file
35 * except in compliance with the License. You may obtain a copy of the
36 * License at http://www.openoffice.org/license.html.
38 * Software provided under this License is provided on an "AS IS" basis,
39 * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
40 * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
41 * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
42 * See the License for the specific provisions governing your rights and
43 * obligations concerning the Software.
45 * The Initial Developer of the Original Code is: IBM Corporation
47 * Copyright: 2008 by IBM Corporation
49 * All Rights Reserved.
51 * Contributor(s): _______________________________________
54 ************************************************************************/
55 /**
56 * @file
57 * For LWP filter architecture prototype - footnote
59 /*************************************************************************
60 * Change History
61 Mar 2005 Created
62 ************************************************************************/
63 #include "lwpfribframe.hxx"
64 #include "xfilter/xfstylemanager.hxx"
65 #include "lwpglobalmgr.hxx"
66 #include "xfilter/xfchange.hxx"
67 /**
68 * @short: Read frame frib
69 * @param:
70 * @param:
73 void LwpFribFrame::Read(LwpObjectStream* pObjStrm, sal_uInt16 len)
75 m_objLayout.ReadIndexed(pObjStrm);
78 /**
79 * @descr: Get the layout object which the frib points to
82 LwpObject* LwpFribFrame::GetLayout()
84 return m_objLayout.obj();
87 /**
88 * @descr: register frame style
89 * @param: pFoundry - current foundry pointer
92 void LwpFribFrame::RegisterStyle(LwpFoundry* pFoundry)
94 if (m_objLayout.obj()->GetTag() == VO_DROPCAPLAYOUT)
96 static_cast<LwpDropcapLayout*>(m_objLayout.obj())->RegisterStyle(pFoundry);
98 else
100 //register frame style, , 04/07/2005
101 LwpPlacableLayout* pLayout = static_cast<LwpPlacableLayout*>(m_objLayout.obj());
102 pLayout->SetFoundry(pFoundry);
103 pLayout->RegisterStyle();
105 //register next frib text style
106 sal_uInt8 nType = pLayout->GetRelativeType();
107 if(LwpLayoutRelativityGuts::LAY_INLINE_NEWLINE == nType
108 && HasNextFrib())
110 XFParaStyle* pOldStyle = m_pPara->GetXFParaStyle();
111 if (pOldStyle->GetMasterPage().getLength() == 0)
112 m_StyleName = pOldStyle->GetStyleName();
113 else
115 XFParaStyle* pParaStyle = new XFParaStyle;
116 *pParaStyle = *(pOldStyle);
117 XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
118 m_StyleName = pXFStyleManager->AddStyle(pParaStyle)->GetStyleName();
121 //remember the current paragraph font size which will be used in parsing frame
122 pLayout->SetFont(GetFont());
125 void LwpFribFrame::SetParaDropcap(LwpPara* pPara)
127 if (m_objLayout.obj()->GetTag() == VO_DROPCAPLAYOUT)
129 pPara->SetParaDropcap(sal_True);
130 pPara->SetDropcapLayout(static_cast<LwpDropcapLayout*>(m_objLayout.obj()));
132 else
133 pPara->SetParaDropcap(sal_False);
137 * @descr: convert frame
140 void LwpFribFrame::XFConvert(XFContentContainer* pCont)
142 XFContentContainer* pXFContentContainer = pCont;
143 LwpVirtualLayout* pLayout = static_cast<LwpVirtualLayout*>(GetLayout());
144 sal_uInt8 nType = pLayout->GetRelativeType();
145 if( LwpLayoutRelativityGuts::LAY_PARA_RELATIVE == nType)
147 LwpVirtualLayout* pContainerLayout = pLayout->GetContainerLayout();
148 if(pContainerLayout && pContainerLayout->IsFrame())
150 //same page as text and in frame
151 pXFContentContainer = m_pPara->GetXFContainer();
153 else if(pContainerLayout && pContainerLayout->IsCell())
155 //same page as text and in cell, get the first xfpara
156 XFContentContainer* pXFFirtPara = static_cast<XFContentContainer*>(pCont->FindFirstContent(enumXFContentPara));
157 if(pXFFirtPara)
158 pXFContentContainer = pXFFirtPara;
161 OUString sChangeID;
162 if(m_bRevisionFlag)
164 LwpGlobalMgr* pGlobal = LwpGlobalMgr::GetInstance();
165 LwpChangeMgr* pChangeMgr = pGlobal->GetLwpChangeMgr();
166 sChangeID = pChangeMgr->GetChangeID(this);
167 if (sChangeID.getLength())
169 XFChangeStart* pChangeStart = new XFChangeStart;
170 pChangeStart->SetChangeID(sChangeID);
171 pXFContentContainer->Add(pChangeStart);
175 pLayout->XFConvert(pXFContentContainer);
177 if(m_bRevisionFlag)
179 if (sChangeID.getLength())
181 XFChangeEnd* pChangeEnd = new XFChangeEnd;
182 pChangeEnd->SetChangeID(sChangeID);
183 pXFContentContainer->Add(pChangeEnd);
187 if(LwpLayoutRelativityGuts::LAY_INLINE_NEWLINE == nType
188 && HasNextFrib())
190 XFParagraph* pXFPara = new XFParagraph();
191 pXFPara->SetStyleName(m_StyleName);
192 m_pPara->AddXFContent(pXFPara);
193 m_pPara->GetFribs()->SetXFPara(pXFPara);
199 * @descr: Read Ruby frame
202 void LwpFribRubyFrame::Read(LwpObjectStream* pObjStrm, sal_uInt16 len)
204 m_objLayout.ReadIndexed(pObjStrm);
207 * @descr: Register Ruby frame style
210 void LwpFribRubyFrame::RegisterStyle(LwpFoundry* pFoundry)
212 LwpRubyLayout* pLayout = GetLayout();
213 if (pLayout)
215 pLayout->SetFoundry(pFoundry);
216 pLayout->RegisterStyle();
220 * @descr: convert Ruby frame
223 void LwpFribRubyFrame::XFConvert(XFContentContainer* pCont)
225 LwpRubyLayout* pLayout = GetLayout();
226 if (pLayout)
228 pLayout->ConvertContentText();
232 LwpRubyLayout* LwpFribRubyFrame::GetLayout()
234 return static_cast<LwpRubyLayout*>(m_objLayout.obj());