LibreOffice Module lotuswordpro (master) 1
lwpfribframe.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*************************************************************************
3 *
4 * The Contents of this file are made available subject to the terms of
5 * either of the following licenses
6 *
7 * - GNU Lesser General Public License Version 2.1
8 * - Sun Industry Standards Source License Version 1.1
9 *
10 * Sun Microsystems Inc., October, 2000
11 *
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
16 *
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.
20 *
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.
25 *
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
30 *
31 *
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.
38 *
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.
45 *
46 * The Initial Developer of the Original Code is: IBM Corporation
47 *
48 * Copyright: 2008 by IBM Corporation
49 *
50 * All Rights Reserved.
51 *
52 * Contributor(s): _______________________________________
53 *
54 *
55 ************************************************************************/
61#include "lwpfribframe.hxx"
63#include <lwpglobalmgr.hxx>
64#include <xfilter/xfchange.hxx>
68void LwpFribFrame::Read(LwpObjectStream* pObjStrm, sal_uInt16 /*len*/)
69{
70 m_objLayout.ReadIndexed(pObjStrm);
71}
72
78
85{
87
88 if (pObject.is() && pObject->GetTag() == VO_DROPCAPLAYOUT)
89 {
90 LwpDropcapLayout* pLayout = dynamic_cast<LwpDropcapLayout*>(pObject.get());
91 if (!pLayout)
92 return;
93 pLayout->RegisterStyle(pFoundry);
94 }
95 else
96 {
97 //register frame style
98 LwpPlacableLayout* pLayout = dynamic_cast<LwpPlacableLayout*>(pObject.get());
99 if (!pLayout)
100 return;
101 pLayout->SetFoundry(pFoundry);
102 pLayout->DoRegisterStyle();
103
104 //register next frib text style
105 sal_uInt8 nType = pLayout->GetRelativeType();
107 {
108 XFParaStyle* pOldStyle = m_pPara->GetXFParaStyle();
109 if (pOldStyle->GetMasterPage().isEmpty())
110 m_StyleName = pOldStyle->GetStyleName();
111 else
112 {
113 std::unique_ptr<XFParaStyle> pParaStyle(new XFParaStyle);
114 *pParaStyle = *pOldStyle;
117 = pXFStyleManager->AddStyle(std::move(pParaStyle)).m_pStyle->GetStyleName();
118 }
119 }
120 //remember the current paragraph font size which will be used in parsing frame
121 pLayout->SetFont(GetFont());
122 }
123}
125{
127
128 if (pObject.is() && pObject->GetTag() == VO_DROPCAPLAYOUT)
129 {
130 pPara->SetParaDropcap(true);
131 pPara->SetDropcapLayout(dynamic_cast<LwpDropcapLayout*>(pObject.get()));
132 }
133 else
134 pPara->SetParaDropcap(false);
135}
136
142{
143 XFContentContainer* pXFContentContainer = pCont;
144 LwpVirtualLayout* pLayout = dynamic_cast<LwpVirtualLayout*>(GetLayout().get());
145 if (!pLayout)
146 return;
147 sal_uInt8 nType = pLayout->GetRelativeType();
149 {
150 rtl::Reference<LwpVirtualLayout> xContainerLayout(pLayout->GetContainerLayout());
151 if (xContainerLayout.is() && xContainerLayout->IsFrame())
152 {
153 //same page as text and in frame
154 pXFContentContainer = m_pPara->GetXFContainer();
155 }
156 else if (xContainerLayout.is() && xContainerLayout->IsCell())
157 {
158 //same page as text and in cell, get the first xfpara
160 XFContentContainer* pXFFirtPara = static_cast<XFContentContainer*>(first.get());
161 if (pXFFirtPara)
162 pXFContentContainer = pXFFirtPara;
163 }
164 }
165 OUString sChangeID;
166 if (m_bRevisionFlag)
167 {
169 LwpChangeMgr* pChangeMgr = pGlobal->GetLwpChangeMgr();
170 sChangeID = pChangeMgr->GetChangeID(this);
171 if (!sChangeID.isEmpty())
172 {
174 xChangeStart->SetChangeID(sChangeID);
175 pXFContentContainer->Add(xChangeStart.get());
176 }
177 }
178
179 pLayout->DoXFConvert(pXFContentContainer);
180
181 if (m_bRevisionFlag)
182 {
183 if (!sChangeID.isEmpty())
184 {
186 xChangeEnd->SetChangeID(sChangeID);
187 pXFContentContainer->Add(xChangeEnd.get());
188 }
189 }
190
192 {
194 xXFPara->SetStyleName(m_StyleName);
195 m_pPara->AddXFContent(xXFPara.get());
196 m_pPara->GetFribs().SetXFPara(xXFPara.get());
197 }
198}
199
204void LwpFribRubyFrame::Read(LwpObjectStream* pObjStrm, sal_uInt16 /*len*/)
205{
206 m_objLayout.ReadIndexed(pObjStrm);
207}
213{
214 LwpRubyLayout* pLayout = GetLayout();
215 if (pLayout)
216 {
217 pLayout->SetFoundry(pFoundry);
218 pLayout->RegisterStyle();
219 }
220}
226{
227 LwpRubyLayout* pLayout = GetLayout();
228 if (pLayout)
229 {
230 pLayout->ConvertContentText();
231 }
232}
233
235{
236 return dynamic_cast<LwpRubyLayout*>(m_objLayout.obj().get());
237}
238
239/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual OUString GetStyleName()=0
@descr: return the style name.
OUString GetChangeID(LwpFrib *pFrib)
void RegisterStyle(LwpFoundry *pFoundry)
void SetParaDropcap(LwpPara *pPara)
void RegisterStyle(LwpFoundry *pFoundry) override
@descr: register frame style
void XFConvert(XFContentContainer *pCont)
@descr: convert frame
rtl::Reference< LwpObject > GetLayout() const
@descr: Get the layout object which the frib points to
void Read(LwpObjectStream *pObjStrm, sal_uInt16 len) override
: Read frame frib
LwpObjectID m_objLayout
void SetXFPara(XFParagraph *Para)
Definition: lwpfribptr.hxx:85
void RegisterStyle(LwpFoundry *pFoundry) override
@descr: Register Ruby frame style
void XFConvert()
@descr: convert Ruby frame
LwpRubyLayout * GetLayout()
void Read(LwpObjectStream *pObjStrm, sal_uInt16 len) override
@descr: Read Ruby frame
LwpObjectID m_objLayout
LwpPara * m_pPara
Definition: lwpfrib.hxx:104
OUString m_StyleName
Definition: lwpfrib.hxx:108
rtl::Reference< XFFont > GetFont()
@descr: Get the current frib font style
Definition: lwpfrib.cxx:410
bool m_bRevisionFlag
Definition: lwpfrib.hxx:138
bool HasNextFrib()
@descr: Whether there are other fribs following current frib.
Definition: lwpfrib.cxx:378
XFStyleManager * GetXFStyleManager()
LwpChangeMgr * GetLwpChangeMgr()
static LwpGlobalMgr * GetInstance(LwpSvStream *pSvStream=nullptr)
void ReadIndexed(LwpSvStream *pStrm)
@descr Read object id with indexed format from stream if index>0, lowid is get from time table per th...
Definition: lwpobjid.cxx:96
rtl::Reference< LwpObject > obj(VO_TYPE tag=VO_INVALID) const
@descr get object from object factory per the object id
Definition: lwpobjid.cxx:183
stream class for LwpObject body data provide stream like interface to read object data
Definition: lwpobjstrm.hxx:77
void DoRegisterStyle()
Definition: lwpobj.hxx:107
void SetFoundry(LwpFoundry *pFoundry)
Definition: lwpobj.hxx:137
void DoXFConvert(XFContentContainer *pCont)
Definition: lwpobj.hxx:127
LwpFribPtr & GetFribs()
Definition: lwppara.hxx:303
void AddXFContent(XFContent *pCont)
Definition: lwppara.hxx:315
void SetParaDropcap(bool bFlag)
Definition: lwppara.hxx:343
XFContentContainer * GetXFContainer()
Definition: lwppara.hxx:307
XFParaStyle * GetXFParaStyle()
get paragraph xfstyle
Definition: lwppara1.cxx:118
void SetDropcapLayout(LwpDropcapLayout *pLayout)
Definition: lwppara.hxx:347
virtual sal_uInt8 GetRelativeType() override
@descr: Get relative type
Definition: lwplayout.cxx:2033
void SetFont(rtl::Reference< XFFont > const &pFont)
@descr: Set font style for setting position of frame
Definition: lwplayout.cxx:2115
void RegisterStyle() override
@descr register frame style
virtual sal_uInt8 GetRelativeType()
@descr: get the relative type
Definition: lwplayout.cxx:288
virtual rtl::Reference< LwpVirtualLayout > GetContainerLayout()
Definition: lwplayout.hxx:196
A container for content.
virtual void Add(XFContent *pContent)
@descr Add content.
rtl::Reference< XFContent > FindFirstContent(enumXFContent type)
@descr helper function, find first content by type.
Style object for aragraph.
Definition: xfparastyle.hxx:93
const OUString & GetMasterPage() const
Paragraph object for SODC.
Definition: xfparagraph.hxx:73
Style manager for the filter.
IXFStyleRet AddStyle(std::unique_ptr< IXFStyle > pStyle)
virtual OUString GetStyleName() override
@descr get style name.
Definition: xfstyle.cxx:70
EmbeddedObjectRef * pObject
@ VO_DROPCAPLAYOUT
Definition: lwpdefs.hxx:150
For LWP filter architecture prototype - footnote.
constexpr OUStringLiteral first
QPRO_FUNC_TYPE nType
IXFStyle * m_pStyle
Definition: xfstylecont.hxx:71
unsigned char sal_uInt8
@ enumXFContentPara
Definition: xfdefs.hxx:68