update dev300-m57
[ooovba.git] / lotuswordpro / source / filter / lwpfribtable.cxx
blob1ca54cd5964535c7ffb9a2af937e989aac6c33a1
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 #include "lwpfribtable.hxx"
56 #include "lwppara.hxx"
57 #include "lwptablelayout.hxx"
58 #include "lwpchangemgr.hxx"
59 #include "lwpglobalmgr.hxx"
60 #include "xfilter/xfstylemanager.hxx"
61 #include "xfilter/xfchange.hxx"
62 /**
63 * @short: Read table frib
64 * @param:
65 * @param:
68 void LwpFribTable::Read(LwpObjectStream* pObjStrm, sal_uInt16 len)
70 m_objTable.ReadIndexed(pObjStrm);
73 LwpSuperTableLayout* LwpFribTable::GetSuperTable()
75 return static_cast<LwpSuperTableLayout*>(m_objTable.obj());
78 void LwpFribTable::RegisterStyle()
80 GetSuperTable()->RegisterStyle();
81 XFParaStyle* pOldStyle = m_pPara->GetXFParaStyle();
82 if(HasNextFrib())
84 if (pOldStyle->GetMasterPage().getLength() == 0)
85 m_StyleName = pOldStyle->GetStyleName();
86 else
88 XFParaStyle* pParaStyle = new XFParaStyle;
89 *pParaStyle = *(pOldStyle);
90 XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
91 m_StyleName = pXFStyleManager->AddStyle(pParaStyle)->GetStyleName();
96 void LwpFribTable::Parse(IXFStream* pOutputStream)
98 GetSuperTable()->Parse(pOutputStream);
101 void LwpFribTable::XFConvert(XFContentContainer* pCont)
103 XFContentContainer* pXFContentContainer = pCont;
104 LwpSuperTableLayout* pSuper = GetSuperTable();
105 sal_uInt8 nType = pSuper->GetRelativeType();
106 LwpVirtualLayout* pContainer = pSuper->GetContainerLayout();
107 if (!pContainer)
108 return;
109 if ( LwpLayoutRelativityGuts::LAY_INLINE_NEWLINE == nType
110 && !pContainer->IsCell())
112 pXFContentContainer = m_pPara->GetXFContainer();
113 //delete the additional blank para, 06/28/2005
114 XFParagraph* pCurrPara = m_pPara->GetFribs()->GetXFPara();
115 if(!pCurrPara->HasContents())
117 if(pXFContentContainer->GetLastContent() == pCurrPara)
119 pXFContentContainer->RemoveLastContent();
122 //end,06/28/2005
124 else if( LwpLayoutRelativityGuts::LAY_PARA_RELATIVE == nType)
126 //same page as text and in frame
127 if(pContainer->IsFrame())
129 pXFContentContainer = m_pPara->GetXFContainer();
131 else if(pContainer->IsCell())
133 //same page as text and in cell, get the first xfpara
134 XFContentContainer* pXFFirtPara = static_cast<XFContentContainer*>(pCont->FindFirstContent(enumXFContentPara));
135 if(pXFFirtPara)
136 pXFContentContainer = pXFFirtPara;
139 OUString sChangeID;
140 if(m_bRevisionFlag)
142 LwpGlobalMgr* pGlobal = LwpGlobalMgr::GetInstance();
143 LwpChangeMgr* pChangeMgr = pGlobal->GetLwpChangeMgr();
144 sChangeID = pChangeMgr->GetChangeID(this);
145 if (sChangeID.getLength())
147 XFChangeStart* pChangeStart = new XFChangeStart;
148 pChangeStart->SetChangeID(sChangeID);
149 pXFContentContainer->Add(pChangeStart);
152 pSuper->XFConvert(pXFContentContainer);
154 if(m_bRevisionFlag)
156 if (sChangeID.getLength())
158 XFChangeEnd* pChangeEnd = new XFChangeEnd;
159 pChangeEnd->SetChangeID(sChangeID);
160 pXFContentContainer->Add(pChangeEnd);
164 if(LwpLayoutRelativityGuts::LAY_INLINE_NEWLINE == nType
165 && HasNextFrib())
167 XFParagraph* pXFPara = new XFParagraph();
168 pXFPara->SetStyleName(m_StyleName);
169 m_pPara->AddXFContent(pXFPara);
170 m_pPara->GetFribs()->SetXFPara(pXFPara);