fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / lotuswordpro / source / filter / lwppara.cxx
blob7cebb589f0eaae8ae82a94a485962ef4d73de024
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
59 ************************************************************************/
60 /*************************************************************************
61 * Change History
62 Jan 2005 Created
63 ************************************************************************/
65 #include "lwppara.hxx"
66 #include "lwpglobalmgr.hxx"
67 #include "lwpfilehdr.hxx"
68 #include "lwpparaproperty.hxx"
69 #include "lwptools.hxx"
70 #include "lwpparastyle.hxx"
71 #include "xfilter/xffont.hxx"
72 #include "xfilter/xftextstyle.hxx"
73 #include "xfilter/xfstylemanager.hxx"
74 #include "xfilter/xfparagraph.hxx"
75 #include "xfilter/xftextcontent.hxx"
76 #include "xfilter/xftextspan.hxx"
77 #include "xfilter/xfmargins.hxx"
78 #include "xfilter/xftabstop.hxx"
79 #include "xfilter/xflinebreak.hxx"
80 #include "xfilter/xfsection.hxx"
81 #include "xfilter/xfsectionstyle.hxx"
82 #include "xfilter/xfcolor.hxx"
83 #include "xfilter/xfhyperlink.hxx"
84 #include "xfilter/xfliststyle.hxx"
85 #include "lwpcharsetmgr.hxx"
86 #include "lwpsection.hxx"
87 #include "lwplayout.hxx"
88 #include "lwpusewhen.hxx"
89 #include "lwpbulletstylemgr.hxx"
90 #include "lwpstory.hxx"
91 #include "lwpsilverbullet.hxx"
92 #include "xfilter/xflist.hxx"
93 #include "xfilter/xfframe.hxx"
95 #include "lwpdivinfo.hxx"
96 #include "lwpdoc.hxx"
97 #include "lwpholder.hxx"
98 #include "lwppagehint.hxx"
100 #include "lwpdropcapmgr.hxx"
101 #include "lwptable.hxx"
103 LwpPara::LwpPara(LwpObjectHeader& objHdr, LwpSvStream* pStrm)
104 : LwpDLVList(objHdr, pStrm)
105 , m_nOrdinal(0)
106 , m_nFlags(0)
107 , m_nLevel(0)
108 , m_pProps(NULL)
109 , m_pBreaks(NULL)
110 , m_pIndentOverride(NULL)
111 , m_FontID(0)
112 , m_AllText("")
113 , m_bHasBullet(false)
114 , m_pSilverBullet(NULL)
115 , m_pBullOver(NULL)
116 , m_bBullContinue(false)
117 , m_SectionStyleName("")
118 , m_bHasDropcap(false)
119 , m_nLines(0)
120 , m_nChars(0)
121 , m_pDropcapLayout(NULL)
122 , m_BelowSpacing(0)
123 , m_pXFContainer(NULL)
127 LwpPara::~LwpPara()
130 if (m_pBreaks)
132 delete m_pBreaks;
133 m_pBreaks = NULL;
135 /* if (m_pParaNumbering)
137 delete m_pParaNumbering;
138 m_pParaNumbering = NULL;
141 if (m_pBullOver)
143 delete m_pBullOver;
144 m_pBullOver = NULL;
146 if(m_pIndentOverride)
148 delete m_pIndentOverride;
151 LwpParaProperty* pNextProp;
152 while(m_pProps)
154 pNextProp = m_pProps->GetNext();
155 delete m_pProps;
156 m_pProps = pNextProp;
160 void LwpPara::Read()
162 LwpDLVList::Read();
164 bool Simple;
165 bool Notify = false;
166 if(LwpFileHeader::m_nFileRevision<0x0006)
167 Simple = false;
168 else if(LwpFileHeader::m_nFileRevision<0x000B)
169 Simple = m_pObjStrm->QuickReaduInt8() != 0;
170 else
172 sal_uInt8 Flag = m_pObjStrm->QuickReaduInt8();
174 const int DISK_SIMPLE = 1;
175 const int DISK_NOTIFY = 2;
177 Simple = (Flag & DISK_SIMPLE) != 0;
178 Notify = (Flag & DISK_NOTIFY) != 0;
181 if(!Simple)
183 m_nOrdinal = m_pObjStrm->QuickReaduInt32();
184 if(LwpFileHeader::m_nFileRevision<0x000B)
186 // TODO: to process
187 assert(false);
188 /*pCForked3NotifyList Notify = new CForked3NotifyList(this);
189 Notify->GetExtraList()->QuickRead(pFile);
190 Notify->QuickRead(pFile);
191 if(Notify->GetExtraList()->IsEmpty() &&
192 Notify->IsEmpty())
193 delete Notify;
194 else
195 cNotifyList = Notify;*/
197 else
199 if (Notify)
201 LwpForked3NotifyList* pNotifyList = new LwpForked3NotifyList();
202 pNotifyList->GetExtraList().Read(m_pObjStrm);
203 pNotifyList->Read(m_pObjStrm);
204 delete pNotifyList;
208 else
209 m_nOrdinal = 0x0001;
211 m_nFlags = m_pObjStrm->QuickReaduInt16();
212 m_ParaStyle.ReadIndexed(m_pObjStrm);
214 if(!Simple)
216 m_Hint.Read(m_pObjStrm);
219 m_Story.ReadIndexed(m_pObjStrm);
220 if(!Simple)
222 if(LwpFileHeader::m_nFileRevision<0x000B)
224 // TODO: to process
225 assert(false);
226 /*PropList = new CParaPropListProperty(this);
227 PropList->GetList()->QuickRead(pFile);
228 if(PropList->GetList()->IsEmpty())
230 delete PropList;
231 PropList = LNULL;
234 m_nLevel = m_pObjStrm->QuickReaduInt16();
236 // test
237 if (m_nLevel > 9)
239 m_nLevel = 9;
241 // test ends
243 else
244 m_nLevel = 0x0001;
246 m_Fribs.SetPara(this);//add by 2/1, for silver bullet
247 m_Fribs.ReadPara(m_pObjStrm);
249 m_pProps = LwpParaProperty::ReadPropertyList(m_pObjStrm,this);
252 void LwpPara::Parse(IXFStream* pOutputStream)
254 m_pXFContainer = new XFContentContainer;
255 XFConvert(m_pXFContainer);
256 m_pXFContainer->ToXml(pOutputStream);
257 m_pXFContainer->Reset();
258 delete m_pXFContainer;
259 m_pXFContainer = NULL;
262 void LwpPara::XFConvert(XFContentContainer* pCont)
264 m_pXFContainer = pCont;
266 LwpStory *pStory = dynamic_cast<LwpStory*>(m_Story.obj().get());
268 if (pStory && pStory->GetDropcapFlag())
270 ParseDropcapContent();
271 return;
274 //Add the break before para
275 if (m_pBreaks && m_nOrdinal!=0)
276 AddBreakBefore(pCont);
278 //Create an XFPara for this VO_PARA
279 XFParagraph *pPara = new XFParagraph;
280 pPara->SetStyleName(m_StyleName);
282 if(!m_SectionStyleName.isEmpty())
284 XFSection* pSection = CreateXFSection();
285 if (pStory)
286 pStory->AddXFContent(pSection);
287 //pSection->Add(pPara);
288 m_pXFContainer = pSection;
291 if (m_bHasBullet && m_pSilverBullet)
293 XFContentContainer* pListItem = AddBulletList(m_pXFContainer);
294 if (pListItem)
296 pListItem->Add(pPara);
299 else
301 LwpBulletStyleMgr* pBulletStyleMgr = this->GetBulletStyleMgr();
302 if (pBulletStyleMgr)
304 pBulletStyleMgr->SetCurrentSilverBullet(LwpObjectID());
305 pBulletStyleMgr->SetContinueFlag(false);
307 m_pXFContainer->Add(pPara);
310 m_Fribs.SetXFPara(pPara);
311 m_Fribs.XFConvert();
313 if (m_pBreaks)
314 AddBreakAfter(m_pXFContainer);
317 bool LwpPara::RegisterMasterPage(XFParaStyle* pBaseStyle)
319 bool bSuccess = false;
320 //get story
321 LwpStory* pStory = dynamic_cast<LwpStory*>(m_Story.obj().get());
322 //if pagelayout is modified, register the pagelayout
323 if(pStory && pStory->IsPMModified())
325 bool bNewSection = pStory->IsNeedSection();
326 LwpPageLayout* pLayout = pStory->GetCurrentLayout();
327 if(bNewSection)
329 RegisterNewSectionStyle(pLayout);
332 bSuccess = true;
333 //register master page style
334 XFParaStyle* pOverStyle = new XFParaStyle();
335 *pOverStyle = *pBaseStyle;
336 pOverStyle->SetStyleName( "");
337 pOverStyle->SetMasterPage(pLayout->GetStyleName());
338 if (!m_ParentStyleName.isEmpty())
339 pOverStyle->SetParentStyleName(m_ParentStyleName);
340 XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
341 m_StyleName = pXFStyleManager->AddStyle(pOverStyle).m_pStyle->GetStyleName();
343 return bSuccess;
346 * @short register paragraph style
348 void LwpPara::RegisterStyle()
349 { //1 reg autostyle
350 // m_Fribs.SetPara(this);
351 // m_Fribs.RegisterStyle();
353 //2 reg para style
354 if (!m_pFoundry)
355 return;
356 XFParaStyle* pBaseStyle = static_cast<XFParaStyle*>(m_pFoundry->GetStyleManager()->GetStyle(m_ParaStyle));
357 if (pBaseStyle == NULL) return;
358 m_StyleName = pBaseStyle->GetStyleName();//such intf to be added
359 m_ParentStyleName = m_StyleName;
360 XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
362 if (GetParaStyle()->GetIndent())
364 std::unique_ptr<LwpIndentOverride> pIndentOverride(GetParaStyle()->GetIndent()->clone());
365 delete m_pIndentOverride;
366 m_pIndentOverride = pIndentOverride.release();
369 XFParaStyle* pOverStyle = NULL;
370 bool noSpacing = true;
371 LwpParaProperty* pBulletProps = NULL, *pNumberingProps = NULL;
373 if (m_pProps != NULL)
375 bool noIndent = true;
376 pOverStyle = new XFParaStyle;
377 *pOverStyle = *pBaseStyle;
378 pOverStyle->SetStyleName("");
379 LwpParaProperty* pProps = m_pProps;
380 sal_uInt32 PropType;
381 LwpParaStyle& rParaStyle = dynamic_cast<LwpParaStyle&>(*m_ParaStyle.obj());
382 while (pProps)
384 PropType = pProps->GetType();
385 switch(PropType)
387 case PP_LOCAL_ALIGN:
389 if (!rParaStyle.GetAlignment())
390 OverrideAlignment(NULL,static_cast<LwpParaAlignProperty*>(pProps)->GetAlignment(),pOverStyle);
391 else
393 boost::scoped_ptr<LwpAlignmentOverride> const pAlign(
394 rParaStyle.GetAlignment()->clone());
395 OverrideAlignment(pAlign.get(),
396 static_cast<LwpParaAlignProperty*>(pProps)->GetAlignment(),
397 pOverStyle);
400 break;
401 case PP_LOCAL_INDENT:
403 noIndent = false;
404 if (!rParaStyle.GetIndent())
405 OverrideIndent(NULL,static_cast<LwpParaIndentProperty*>(pProps)->GetIndent(),pOverStyle);
407 else
409 OverrideIndent(m_pIndentOverride,static_cast<LwpParaIndentProperty*>(pProps)->GetIndent(),pOverStyle);
412 break;
413 case PP_LOCAL_SPACING:
415 noSpacing = false;
416 if (!rParaStyle.GetSpacing())
417 OverrideSpacing(NULL,static_cast<LwpParaSpacingProperty*>(pProps)->GetSpacing(),pOverStyle);
418 else
420 boost::scoped_ptr<LwpSpacingOverride> const
421 pSpacing(rParaStyle.GetSpacing()->clone());
422 OverrideSpacing(pSpacing.get(),
423 static_cast<LwpParaSpacingProperty*>(pProps)->GetSpacing(),
424 pOverStyle);
427 break;
428 case PP_LOCAL_BORDER:
430 OverrideParaBorder(pProps, pOverStyle);
431 break;
433 case PP_LOCAL_BREAKS:
435 OverrideParaBreaks(pProps, pOverStyle);
436 break;
438 case PP_LOCAL_BULLET:
440 pBulletProps = pProps;
441 // OverrideParaBullet(pProps);
442 break;
444 case PP_LOCAL_NUMBERING:
446 pNumberingProps = pProps;
447 // OverrideParaNumbering(pProps);
448 break;
450 //end
451 case PP_LOCAL_TABRACK:
453 //, 01/28/05
454 /*LwpTabOverride* pTabOverride=rParaStyle.GetTabOverride();
455 if(!pTabOverride)
457 OverrideTab(NULL,static_cast<LwpParaTabRackProperty*>(pProps)->GetTab(),pOverStyle);
459 else
461 OverrideTab(pTabOverride,static_cast<LwpParaTabRackProperty*>(pProps)->GetTab(),pOverStyle);
463 break;
465 case PP_LOCAL_BACKGROUND:
467 /* LwpBackgroundOverride aBackground;
468 if (!rParaStyle.GetBackground())
469 OverrideBackground(NULL,static_cast<LwpParaBackGroundProperty*>(pProps)->GetBackground(),pOverStyle);
470 else
472 aBackground = *(rParaStyle.GetaBackground());
473 OverrideBackground(&aBackground,static_cast<LwpParaBackGroundProperty*>(pProps)->GetBackground(),pOverStyle);
476 // modified by , 06/03/2005
477 LwpBackgroundOverride* pBGOver = static_cast<LwpParaBackGroundProperty*>(pProps)->GetBackground();
478 if (pBGOver)
480 LwpBackgroundStuff& rBGStuff = pBGOver->GetBGStuff();
481 if (!rBGStuff.IsTransparent() )
483 if (rBGStuff.IsPatternFill())
485 XFBGImage* pXFBGImage = rBGStuff.GetFillPattern();
486 pOverStyle->SetBackImage(pXFBGImage);
488 else
490 LwpColor* pColor = rBGStuff.GetFillColor();
491 if (pColor && pColor->IsValidColor())
493 XFColor aXFColor( pColor->To24Color());
494 pOverStyle->SetBackColor( aXFColor );
499 // end modified
500 break;
502 default:
503 break;
505 pProps = pProps->GetNext();
508 if (noIndent && m_pIndentOverride)
510 if (m_pIndentOverride->IsUseRelative() && GetParent())
512 OverrideIndent(NULL,m_pIndentOverride,pOverStyle);
515 if (!m_ParentStyleName.isEmpty())
516 pOverStyle->SetParentStyleName(m_ParentStyleName);
517 m_StyleName = pXFStyleManager->AddStyle(pOverStyle).m_pStyle->GetStyleName();
520 else //use named style
522 if (m_pIndentOverride)
524 if (m_pIndentOverride->IsUseRelative() && GetParent())
526 pOverStyle = new XFParaStyle;
527 *pOverStyle = *pBaseStyle;
528 OverrideIndent(NULL,m_pIndentOverride,pOverStyle);
529 if (!m_ParentStyleName.isEmpty())
530 pOverStyle->SetParentStyleName(m_ParentStyleName);
531 m_StyleName = pXFStyleManager->AddStyle(pOverStyle).m_pStyle->GetStyleName();
536 if (IsInCell())
538 XFParaStyle* pOldStyle = pXFStyleManager->FindParaStyle(m_StyleName);
539 if (pOldStyle->GetNumberRight())
541 pOverStyle = new XFParaStyle;
542 *pOverStyle = *pOldStyle;
543 pOverStyle->SetAlignType(enumXFAlignStart);
544 if (!m_ParentStyleName.isEmpty())
545 pOverStyle->SetParentStyleName(m_ParentStyleName);
546 m_StyleName = pXFStyleManager->AddStyle(pOverStyle).m_pStyle->GetStyleName();
550 // override bullet and numbering
551 OverrideParaBullet(pBulletProps);
552 OverrideParaNumbering(pNumberingProps);
554 //add by
555 //register bullet style
556 LwpBulletStyleMgr* pBulletStyleMgr = this->GetBulletStyleMgr();
557 if (pBulletStyleMgr)
559 // if has bullet or numbering
560 if (m_bHasBullet)
562 //if it's normal bullet
563 if (m_pSilverBullet)
565 if (m_pSilverBullet->HasName())
567 m_aBulletStyleName = m_pSilverBullet->GetBulletStyleName();
569 else if (!m_pBullOver->IsEditable())
571 m_aBulletStyleName = pBulletStyleMgr->RegisterBulletStyle(this, m_pBullOver, m_pIndentOverride);
574 // test codes
575 if (m_pSilverBullet->IsBulletOrdered())
577 OUString aPreBullStyleName;
578 LwpNumberingOverride* pNumbering = this->GetParaNumbering();
579 sal_uInt16 nPosition = pNumbering->GetPosition();
580 bool bLesser = m_pSilverBullet->IsLesserLevel(nPosition);
581 LwpPara* pPara = this;
582 LwpPara* pPrePara = NULL;
583 sal_uInt16 nNum = 0, nLevel = 0, nFoundLevel = 0xffff, nFoundBound = 0;
585 nFoundBound = nLevel = pNumbering->GetLevel();
586 if (nPosition == pNumbering->GetPosition())
588 nFoundBound++;
590 bool bHeading = pNumbering->IsHeading();
592 while(true)
594 /*// When we hit the hint paragraph, we can stop and check the hint.
595 if (qNumberHint && (qPara == qNumberHint->GetPara()) &&
596 qNumberHint->Lookup(qSilverBullet, Level, Position, &Offset))
598 Num += Offset;
599 break;
602 LwpSilverBullet* pParaSilverBullet = pPara->GetSilverBullet();
603 pNumbering = pPara->GetParaNumbering();
605 if (pPara->GetObjectID() != this->GetObjectID())
607 if (!pParaSilverBullet)
609 break;
612 /* If lesser, stop when we hit an outline style whose level is
613 * higher than our current level.
615 // restart based on Outline level?
616 if (pNumbering && bLesser && (!bHeading || pNumbering->IsHeading()))
618 if (nFoundLevel != 0xffff)
620 if (pNumbering->GetLevel() < nFoundLevel)
622 break;
624 if ((pNumbering->GetLevel() == nFoundLevel)
625 && (pParaSilverBullet->GetObjectID() != m_pSilverBullet->GetObjectID()
626 || pNumbering->GetPosition() != nPosition))
628 break;
631 else
633 if (pNumbering && pNumbering->GetLevel() < nFoundBound && pParaSilverBullet
634 && (pParaSilverBullet->GetObjectID() != m_pSilverBullet->GetObjectID()
635 || pNumbering->GetPosition() != nPosition))
637 nFoundBound = pNumbering->GetLevel();
642 /*if (qSpecificStyle
643 && qSpecificStyle == qPara->GetParaStyle(LTRUE))
644 break;
646 // See if we crossed a section boundary
647 if (ResetSection)
649 CurrPos.SetPara(qPara);
650 if (CurrPos <= SectionPos)
651 break;
655 // Don't bump the number if this bullet is skipped
656 if (m_pBullOver->IsSkip())
658 else if ( pParaSilverBullet
659 && pParaSilverBullet->GetObjectID() == m_pSilverBullet->GetObjectID()
660 && pNumbering && nPosition == pNumbering->GetPosition())
662 if (bLesser)
664 if (nFoundLevel != 0xffff)
666 if (nFoundLevel == pNumbering->GetLevel())
668 aPreBullStyleName = pPara->GetBulletStyleName();
669 nNum++;
672 else if (pNumbering->GetLevel() <= nLevel)
674 if (pNumbering->GetLevel() >= nFoundBound)
676 break;
678 nFoundLevel = pNumbering->GetLevel();
679 aPreBullStyleName = pPara->GetBulletStyleName();
680 nNum++;
683 else
685 aPreBullStyleName = pPara->GetBulletStyleName();
686 nNum++;
690 pPrePara = dynamic_cast<LwpPara*>(pPara->GetPrevious().obj(VO_PARA).get());
692 if (!pPrePara)
694 LwpStory* pStory = pPara->GetStory();
695 pPrePara = pStory->GetLastParaOfPreviousStory();
697 if (!pPrePara)
699 break;
702 pPara = pPrePara;
704 nNum = nNum ? nNum : 1;
706 if (nNum > 1)
708 m_aBulletStyleName = aPreBullStyleName;
709 m_bBullContinue = true;
711 else
713 m_bBullContinue = false;
714 if (this->IsInCell())
716 XFListStyle* pOldStyle = static_cast<XFListStyle*>(pXFStyleManager->FindStyle(m_aBulletStyleName));
717 if (pOldStyle)
719 XFListStyle* pNewStyle = new XFListStyle(*pOldStyle);
720 m_aBulletStyleName = pXFStyleManager->AddStyle(pNewStyle).m_pStyle->GetStyleName();
725 LwpStory* pMyStory = this->GetStory();
726 if (pMyStory)
728 if (pMyStory->IsBullStyleUsedBefore(m_aBulletStyleName, m_pParaNumbering->GetPosition()))
730 //m_bBullContinue = sal_True;
732 else
734 pMyStory->AddBullStyleName2List(m_aBulletStyleName, m_pParaNumbering->GetPosition());
739 // end of test codes
743 //end add
745 if (noSpacing)
747 LwpPara* pPrePara = dynamic_cast<LwpPara*>(GetPrevious().obj().get());
748 if (pPrePara && pPrePara->GetBelowSpacing()!=0)
750 pOverStyle = new XFParaStyle;
751 *pOverStyle = *GetXFParaStyle();
752 XFMargins* pMargin = &pOverStyle->GetMargins();
753 pMargin->SetTop(pMargin->GetTop()+pPrePara->GetBelowSpacing());
754 if (!m_ParentStyleName.isEmpty())
755 pOverStyle->SetParentStyleName(m_ParentStyleName);
756 m_StyleName = pXFStyleManager->AddStyle(pOverStyle).m_pStyle->GetStyleName();
760 //register tab style
761 if(m_Fribs.HasFrib(FRIB_TAG_TAB))
763 XFParaStyle* pParaStyle = new XFParaStyle;
764 *pParaStyle = *GetXFParaStyle();
765 //pOverStyle->SetStyleName("");
766 this->RegisterTabStyle(pParaStyle);
767 if (!m_ParentStyleName.isEmpty())
768 pParaStyle->SetParentStyleName(m_ParentStyleName);
769 m_StyleName = pXFStyleManager->AddStyle(pParaStyle).m_pStyle->GetStyleName();
772 //register master page;
773 RegisterMasterPage(GetXFParaStyle());
775 // reg auto style,lay here for pagebreak need overrided para style
776 m_Fribs.SetPara(this);
777 m_Fribs.RegisterStyle();
779 if (m_bHasDropcap)
781 GatherDropcapInfo();
782 XFParaStyle* pStyle = new XFParaStyle;
783 *pStyle = *GetXFParaStyle();
784 pStyle->SetDropCap(m_nChars-1,m_nLines);
785 if (!m_ParentStyleName.isEmpty())
786 pStyle->SetParentStyleName(m_ParentStyleName);
787 m_StyleName = pXFStyleManager->AddStyle(pStyle).m_pStyle->GetStyleName();
789 // maybe useful for futer version
790 // deleted because Leader of Table is not supported in this version
791 //AddTabStyleForTOC();
794 void LwpPara::RegisterNewSectionStyle(LwpPageLayout *pLayout)
796 if( !pLayout )
797 return;
799 XFSectionStyle* pSectStyle= new XFSectionStyle();
800 XFColumns* pColumns = pLayout->GetXFColumns();
801 if(pColumns)
803 pSectStyle->SetColumns(pColumns);
805 XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
806 m_SectionStyleName = pXFStyleManager->AddStyle(pSectStyle).m_pStyle->GetStyleName();
809 XFSection* LwpPara::CreateXFSection()
811 XFSection* pXFSection = new XFSection();
812 pXFSection->SetStyleName(m_SectionStyleName);
813 m_SectionStyleName.clear();
814 return pXFSection;
817 /**************************************************************************
818 * @descr: register tab style
819 * @param:
820 * @param:
821 * @return:
822 **************************************************************************/
823 void LwpPara::RegisterTabStyle(XFParaStyle* pXFParaStyle)
825 LwpTabOverride aFinaOverride;
826 LwpTabOverride* pBase = NULL;
827 //get the tabrack from the current layout
828 LwpStory* pStory = dynamic_cast<LwpStory*>(m_Story.obj().get());
829 LwpMiddleLayout* pLayout = pStory ? pStory->GetTabLayout() : NULL;
830 if(pLayout)
832 pBase = pLayout->GetTabOverride();
833 if(pBase)
835 pBase->Override(&aFinaOverride);
839 //get the tabrack from the base parastyle
840 LwpParaStyle* pParaStyle = GetParaStyle();
841 pBase = pParaStyle->GetTabOverride();
842 if(pBase)
844 pBase->Override(&aFinaOverride);
846 //get the tabrack from the local property
847 pBase = GetLocalTabOverride();
848 if(pBase)
850 pBase->Override(&aFinaOverride);
853 LwpParaStyle::ApplyTab(pXFParaStyle, &aFinaOverride);
856 * @short parse dropcap text
858 void LwpPara::ParseDropcapContent()
860 if (!GetFoundry())
861 return;
862 XFParagraph* pDropcap = GetFoundry()->GetDropcapMgr()->GetXFPara();
863 if (pDropcap)
865 m_Fribs.SetXFPara(pDropcap);
866 m_Fribs.XFConvert();
870 * @short add paragraph break attribute
872 void LwpPara::AddBreakBefore(XFContentContainer* pCont)
874 if (!m_pBreaks)
875 return;
876 if (m_pBreaks->IsPageBreakBefore())
878 XFParagraph *pPara = new XFParagraph();
879 pPara->SetStyleName(m_BefPageBreakName);
880 pCont->Add(pPara);
882 else if (m_pBreaks->IsColumnBreakBefore())
884 XFParagraph *pPara = new XFParagraph();
885 pPara->SetStyleName(m_BefColumnBreakName);
886 pCont->Add(pPara);
890 void LwpPara::AddBreakAfter(XFContentContainer* pCont)
892 if (!m_pBreaks)
893 return;
894 if (m_pBreaks->IsPageBreakAfter())
896 XFParagraph *pPara = new XFParagraph();
897 pPara->SetStyleName(m_AftPageBreakName);
898 pCont->Add(pPara);
900 else if (m_pBreaks->IsColumnBreakAfter())
902 XFParagraph *pPara = new XFParagraph();
903 pPara->SetStyleName(m_AftColumnBreakName);
904 pCont->Add(pPara);
908 LwpBulletStyleMgr* LwpPara::GetBulletStyleMgr()
910 if (m_pFoundry)
912 return m_pFoundry->GetBulletStyleMgr();
915 return NULL;
918 XFContentContainer* LwpPara::AddBulletList(XFContentContainer* pCont)
920 LwpBulletStyleMgr* pBulletStyleMgr = GetBulletStyleMgr();
921 if (!pBulletStyleMgr)
923 assert(false);
924 return NULL;
927 sal_uInt16 nLevel = m_nLevel;
928 bool bOrdered = false;
929 /*LwpStory* pMyStory =*/ GetStory();
931 pBulletStyleMgr->SetContinueFlag(m_bBullContinue);
933 if (m_pSilverBullet->IsBulletOrdered())
935 bOrdered = true;
937 if (m_pSilverBullet->HasName())
939 nLevel = m_pParaNumbering->GetPosition();
940 m_nLevel = nLevel;//add by ,for get para level
941 // m_aBulletStyleName = m_pSilverBullet->GetBulletStyleName();
944 return ( pBulletStyleMgr->AddBulletList(pCont, bOrdered, m_aBulletStyleName,
945 nLevel, m_pBullOver->IsSkip()) );
948 LwpNumberingOverride* LwpPara::GetParaNumbering()
950 return m_pParaNumbering.get();
953 void LwpForked3NotifyList::Read(LwpObjectStream* pObjStrm)
955 m_PersistentList.Read(pObjStrm);
958 void LwpNotifyListPersistent::Read(LwpObjectStream* pObjStrm)
960 m_Head.ReadIndexed(pObjStrm);
961 pObjStrm->SkipExtra();
964 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */