LibreOffice Module lotuswordpro (master) 1
lwpfribbreaks.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 ************************************************************************/
56/*************************************************************************
57 * @file
58 * For LWP filter architecture prototype
59 ************************************************************************/
60
61#include "lwpfribbreaks.hxx"
62#include "lwpfribheader.hxx"
63#include "lwppagelayout.hxx"
64#include "lwpstory.hxx"
66#include <lwpglobalmgr.hxx>
67
69{
70 // XFParaStyle* pBaseStyle = static_cast<XFParaStyle*>(pFoundry->GetStyleManager()->GetStyle(styleID));
71 XFParaStyle* pBaseStyle = pPara->GetXFParaStyle();
72 if (pBaseStyle == nullptr)
73 return;
74 // m_StyleName = pBaseStyle->GetStyleName();
75
76 std::unique_ptr<XFParaStyle> pOverStyle(new XFParaStyle);
77 *pOverStyle = *pBaseStyle;
78 pOverStyle->SetStyleName("");
79
80 //New code
81 LwpStory* pStory = dynamic_cast<LwpStory*>(pPara->GetStoryID().obj().get());
82 LwpPageLayout* pCurLayout = pStory ? pStory->GetCurrentLayout() : nullptr;
83 if (pCurLayout && (pCurLayout->GetNumCols() == 1))
84
85 {
86 // if (!GetNext() || GetNext()->GetType()==FRIB_TAG_EOP)
87 pOverStyle->SetBreaks(enumXFBreakBefPage);
88 // else
89 // pOverStyle->SetBreaks(enumXFBreakBefPage);
90 }
91 else
92 {
93 if (!GetNext() || GetNext()->GetType() == FRIB_TAG_EOP)
94 pOverStyle->SetBreaks(enumXFBreakAftColumn);
95 else
96 pOverStyle->SetBreaks(enumXFBreakBefColumn);
97 }
99 m_StyleName = pXFStyleManager->AddStyle(std::move(pOverStyle)).m_pStyle->GetStyleName();
100}
101
103 : LwpFrib(pPara)
104 , m_bLastFrib(false)
105{
106}
107
109
110void LwpFribPageBreak::Read(LwpObjectStream* pObjStrm, sal_uInt16 /*len*/)
111{
112 m_Layout.ReadIndexed(pObjStrm);
113}
114
116{
117 XFParaStyle* pBaseStyle = pPara->GetXFParaStyle();
118 if (pBaseStyle == nullptr)
119 return;
120
121 LwpPageLayout* pLayout = dynamic_cast<LwpPageLayout*>(m_Layout.obj().get());
122 if (pLayout)
123 {
124 m_pMasterPage.reset(new LwpMasterPage(pPara, pLayout));
125 m_pMasterPage->RegisterMasterPage(this);
126 return;
127 }
128
129 std::unique_ptr<XFParaStyle> pOverStyle(new XFParaStyle);
130 *pOverStyle = *pBaseStyle;
131 pOverStyle->SetStyleName("");
132 pOverStyle->SetMasterPage(pBaseStyle->GetMasterPage());
133
134 if (!GetNext() || GetNext()->GetType() == FRIB_TAG_EOP)
135 m_bLastFrib = true;
136 else
137 m_bLastFrib = false;
138
139 if (m_bLastFrib)
140 pOverStyle->SetBreaks(enumXFBreakAftPage);
141 else
142 pOverStyle->SetBreaks(enumXFBreakBefPage);
143
145 m_StyleName = pXFStyleManager->AddStyle(std::move(pOverStyle)).m_pStyle->GetStyleName();
146}
147
149{
150 if (m_pMasterPage)
151 {
152 m_pMasterPage->ParseSection(this);
153 }
154}
155
156/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual OUString GetStyleName()=0
@descr: return the style name.
void RegisterBreakStyle(LwpPara *pPara)
void RegisterBreakStyle(LwpPara *pPara)
void Read(LwpObjectStream *pObjStrm, sal_uInt16 len) override
LwpFribPageBreak(LwpPara *pPara)
LwpObjectID m_Layout
virtual ~LwpFribPageBreak() override
std::unique_ptr< LwpMasterPage > m_pMasterPage
LwpFrib * GetNext()
Definition: lwpfrib.hxx:96
OUString m_StyleName
Definition: lwpfrib.hxx:108
sal_uInt8 GetType() const
Definition: lwpfrib.hxx:98
XFStyleManager * GetXFStyleManager()
static LwpGlobalMgr * GetInstance(LwpSvStream *pSvStream=nullptr)
virtual sal_uInt16 GetNumCols() override
@descr: Get columns number
Definition: lwplayout.cxx:1517
Process page layout for inserting pagelayout or section.
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
LwpObjectID & GetStoryID()
Definition: lwppara.hxx:333
XFParaStyle * GetXFParaStyle()
get paragraph xfstyle
Definition: lwppara1.cxx:118
LwpPageLayout * GetCurrentLayout()
Definition: lwpstory.hxx:114
Style object for aragraph.
Definition: xfparastyle.hxx:93
const OUString & GetMasterPage() const
Style manager for the filter.
IXFStyleRet AddStyle(std::unique_ptr< IXFStyle > pStyle)
virtual void SetStyleName(const OUString &styleName) override
@descr set style name.
Definition: xfstyle.cxx:75
@ FRIB_TAG_EOP
IXFStyle * m_pStyle
Definition: xfstylecont.hxx:71
@ enumXFBreakBefPage
Definition: xfdefs.hxx:222
@ enumXFBreakAftColumn
Definition: xfdefs.hxx:225
@ enumXFBreakBefColumn
Definition: xfdefs.hxx:223
@ enumXFBreakAftPage
Definition: xfdefs.hxx:224