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,
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 /*************************************************************************
57 * For LWP filter architecture prototype
58 ************************************************************************/
59 /*************************************************************************
62 ************************************************************************/
64 #include "lwppara.hxx"
65 #include "lwpglobalmgr.hxx"
66 #include "lwpfilehdr.hxx"
67 #include "lwpparaproperty.hxx"
68 #include "lwptools.hxx"
69 #include "lwpparastyle.hxx"
70 #include "xfilter/xffont.hxx"
71 #include "xfilter/xftextstyle.hxx"
72 #include "xfilter/xfstylemanager.hxx"
73 #include "xfilter/xfparagraph.hxx"
74 #include "xfilter/xftextcontent.hxx"
75 #include "xfilter/xftextspan.hxx"
76 #include "xfilter/xfmargins.hxx"
77 #include "xfilter/xftabstop.hxx"
78 #include "xfilter/xflinebreak.hxx"
79 #include "xfilter/xfsection.hxx"
80 #include "xfilter/xfsectionstyle.hxx"
81 #include "xfilter/xfcolor.hxx"
82 #include "xfilter/xfhyperlink.hxx"
83 #include "xfilter/xfliststyle.hxx"
84 #include "lwpcharsetmgr.hxx"
85 #include "lwpsection.hxx"
86 #include "lwplayout.hxx"
87 #include "lwpusewhen.hxx"
88 #include "lwpbulletstylemgr.hxx"
89 #include "lwpstory.hxx"
90 #include "lwpsilverbullet.hxx"
91 #include "xfilter/xflist.hxx"
92 #include "xfilter/xfframe.hxx"
94 #include "lwpdivinfo.hxx"
96 #include "lwpholder.hxx"
97 #include "lwppagehint.hxx"
99 #include "lwpdropcapmgr.hxx"
100 #include "lwptable.hxx"
101 LwpPara::LwpPara(LwpObjectHeader
& objHdr
, LwpSvStream
* pStrm
)
102 : LwpDLVList(objHdr
, pStrm
), m_pBreaks(NULL
), m_pIndentOverride(NULL
), m_bHasBullet(sal_False
), m_bBullContinue(sal_False
),
103 /*m_pParaNumbering(NULL),*/ m_pSilverBullet(NULL
), m_pBullOver(NULL
),m_bHasDropcap(sal_False
),m_nLines(0),m_nChars(0),
104 m_BelowSpacing(0),m_pDropcapLayout(NULL
), m_pXFContainer(NULL
)
107 m_SectionStyleName
= A2OUSTR("");
108 m_AllText
= A2OUSTR("");
119 /* if (m_pParaNumbering)
121 delete m_pParaNumbering;
122 m_pParaNumbering = NULL;
130 if(m_pIndentOverride
)
132 delete m_pIndentOverride
;
135 LwpParaProperty
* pNextProp
;
138 pNextProp
= m_pProps
->GetNext();
140 m_pProps
= pNextProp
;
149 sal_Bool Notify
= sal_False
;
150 // m_Fribs.SetPara(this);
151 // LwpParaPropListProperty *PropList = NULL;
152 if(LwpFileHeader::m_nFileRevision
<0x0006)
154 else if(LwpFileHeader::m_nFileRevision
<0x000B)
155 m_pObjStrm
->QuickRead(&Simple
, sizeof(Simple
));
159 m_pObjStrm
->QuickRead(&Flag
, sizeof(Flag
));
161 const int DISK_SIMPLE
= 1;
162 const int DISK_NOTIFY
= 2;
164 Simple
= (Flag
& DISK_SIMPLE
) ? sal_True
: sal_False
;
165 Notify
= (Flag
& DISK_NOTIFY
) ? sal_True
: sal_False
;
170 m_pObjStrm
->QuickRead(&m_nOrdinal
, sizeof(m_nOrdinal
));
171 if(LwpFileHeader::m_nFileRevision
<0x000B)
175 /*pCForked3NotifyList Notify = new CForked3NotifyList(this);
176 Notify->GetExtraList()->QuickRead(pFile);
177 Notify->QuickRead(pFile);
178 if(Notify->GetExtraList()->IsEmpty() &&
182 cNotifyList = Notify;*/
188 LwpForked3NotifyList
* pNotifyList
= new LwpForked3NotifyList();
189 pNotifyList
->GetExtraList()->Read(m_pObjStrm
);
190 pNotifyList
->Read(m_pObjStrm
);
198 m_pObjStrm
->QuickRead(&m_nFlags
, sizeof(m_nFlags
));
199 m_ParaStyle
.ReadIndexed(m_pObjStrm
);
203 m_Hint
.Read(m_pObjStrm
);
204 if (IsBadHintsInFile())
206 // This hint is no good, so throw it away -- SDC 9/28/95
211 m_Story
.ReadIndexed(m_pObjStrm
);
214 if(LwpFileHeader::m_nFileRevision
<0x000B)
218 /*PropList = new CParaPropListProperty(this);
219 PropList->GetList()->QuickRead(pFile);
220 if(PropList->GetList()->IsEmpty())
226 m_pObjStrm
->QuickRead(&m_nLevel
, sizeof(m_nLevel
));
238 m_Fribs
.SetPara(this);//add by 2/1, for silver bullet
239 m_Fribs
.ReadPara(m_pObjStrm
);
241 m_pProps
= LwpParaProperty::ReadPropertyList(m_pObjStrm
,this);
244 void LwpPara::Parse(IXFStream
* pOutputStream
)
246 m_pXFContainer
= new XFContentContainer
;
247 XFConvert(m_pXFContainer
);
248 m_pXFContainer
->ToXml(pOutputStream
);
249 m_pXFContainer
->Reset();
250 delete m_pXFContainer
;
251 m_pXFContainer
= NULL
;
254 void LwpPara::XFConvert(XFContentContainer
* pCont
)
256 m_pXFContainer
= pCont
;
258 if (static_cast<LwpStory
*>(m_Story
.obj())->GetDropcapFlag() == sal_True
)
260 ParseDropcapContent();
261 /*LwpObject* pNextPara = GetNext()->obj();
263 pNextPara->XFConvert(pCont);*/
267 //Add the break before para
268 if (m_pBreaks
&& m_nOrdinal
!=0)
269 AddBreakBefore(pCont
);
271 //Create an XFPara for this VO_PARA
272 XFParagraph
*pPara
= new XFParagraph
;
273 pPara
->SetStyleName(m_StyleName
);
275 if(m_SectionStyleName
.getLength()>0)
277 XFSection
* pSection
= CreateXFSection();
278 LwpStory
* pStory
= static_cast<LwpStory
*> ( m_Story
.obj() );
279 pStory
->AddXFContent(pSection
);
280 //pSection->Add(pPara);
281 m_pXFContainer
= pSection
;
284 if (m_bHasBullet
&& m_pSilverBullet
)
286 XFContentContainer
* pListItem
= AddBulletList(m_pXFContainer
);
289 pListItem
->Add(pPara
);
294 LwpBulletStyleMgr
* pBulletStyleMgr
= this->GetBulletStyleMgr();
297 pBulletStyleMgr
->SetCurrentSilverBullet(LwpObjectID());
298 pBulletStyleMgr
->SetContinueFlag(sal_False
);
300 m_pXFContainer
->Add(pPara
);
303 m_Fribs
.SetXFPara(pPara
);
307 AddBreakAfter(m_pXFContainer
);
309 // maybe useful for futer version
311 // AddTabStopForTOC();
313 //Caller is responsible for calling the next para object
314 /*LwpObject* pNextPara = GetNext()->obj();
316 pNextPara->XFConvert( m_pXFContainer );*/
319 sal_Bool
LwpPara::RegisterMasterPage(XFParaStyle
* pBaseStyle
)
321 sal_Bool bSuccess
= sal_False
;
323 LwpStory
* pStory
= static_cast<LwpStory
*>(m_Story
.obj());
324 //if pagelayout is modified, register the pagelayout
325 if(pStory
->IsPMModified())
327 sal_Bool bNewSection
= sal_False
;
328 bNewSection
= pStory
->IsNeedSection();
329 LwpPageLayout
* pLayout
= pStory
->GetCurrentLayout();
332 RegisterNewSectionStyle(pLayout
);
336 //register master page style
337 XFParaStyle
* pOverStyle
= new XFParaStyle();
338 *pOverStyle
= *pBaseStyle
;
339 pOverStyle
->SetStyleName( A2OUSTR(""));
340 pOverStyle
->SetMasterPage(pLayout
->GetStyleName());
341 if (m_ParentStyleName
.getLength())
342 pOverStyle
->SetParentStyleName(m_ParentStyleName
); //Add by 2005/12/12
343 XFStyleManager
* pXFStyleManager
= LwpGlobalMgr::GetInstance()->GetXFStyleManager();
344 m_StyleName
= pXFStyleManager
->AddStyle(pOverStyle
)->GetStyleName();
349 * @short register paragraph style
351 void LwpPara::RegisterStyle()
353 // m_Fribs.SetPara(this);
354 // m_Fribs.RegisterStyle();
359 XFParaStyle
* pBaseStyle
= static_cast<XFParaStyle
*>(m_pFoundry
->GetStyleManager()->GetStyle(m_ParaStyle
));
360 if (pBaseStyle
== NULL
) return;
361 m_StyleName
= pBaseStyle
->GetStyleName();//such intf to be added
362 m_ParentStyleName
= m_StyleName
;//Add by ,2005/12/12
363 XFStyleManager
* pXFStyleManager
= LwpGlobalMgr::GetInstance()->GetXFStyleManager();
365 if (GetParaStyle()->GetIndent())
367 m_pIndentOverride
= new LwpIndentOverride
;
368 *m_pIndentOverride
= *(GetParaStyle()->GetIndent()); //add by 2-6,for indent hierachy
371 // m_pIndentOverride = NULL;
373 XFParaStyle
* pOverStyle
= NULL
;
374 sal_Bool noSpacing
= sal_True
;
375 sal_Bool noIndent
= sal_True
;
376 LwpParaProperty
* pBulletProps
= NULL
, *pNumberingProps
= NULL
;
378 if (m_pProps
!= NULL
)
380 pOverStyle
= new XFParaStyle
;
381 *pOverStyle
= *pBaseStyle
;
382 pOverStyle
->SetStyleName(A2OUSTR(""));
383 LwpParaProperty
* pProps
= m_pProps
;
385 LwpParaStyle
* pParaStyle
= static_cast<LwpParaStyle
*>(m_ParaStyle
.obj());
388 PropType
= pProps
->GetType();
393 LwpAlignmentOverride aAlign
;
394 if (!pParaStyle
->GetAlignment())
395 OverrideAlignment(NULL
,static_cast<LwpParaAlignProperty
*>(pProps
)->GetAlignment(),pOverStyle
);
398 aAlign
= *(pParaStyle
->GetAlignment());
399 OverrideAlignment(&aAlign
,static_cast<LwpParaAlignProperty
*>(pProps
)->GetAlignment(),pOverStyle
);
403 case PP_LOCAL_INDENT
:
405 noIndent
= sal_False
;
406 if (!pParaStyle
->GetIndent())
407 OverrideIndent(NULL
,static_cast<LwpParaIndentProperty
*>(pProps
)->GetIndent(),pOverStyle
);
411 OverrideIndent(m_pIndentOverride
,static_cast<LwpParaIndentProperty
*>(pProps
)->GetIndent(),pOverStyle
);
415 case PP_LOCAL_SPACING
:
417 LwpSpacingOverride aSpacing
;
418 noSpacing
= sal_False
;
419 if (!pParaStyle
->GetSpacing())
420 OverrideSpacing(NULL
,static_cast<LwpParaSpacingProperty
*>(pProps
)->GetSpacing(),pOverStyle
);
423 aSpacing
= *(pParaStyle
->GetSpacing());
424 OverrideSpacing(&aSpacing
,static_cast<LwpParaSpacingProperty
*>(pProps
)->GetSpacing(),pOverStyle
);
429 case PP_LOCAL_BORDER
:
431 OverrideParaBorder(pProps
, pOverStyle
);
434 case PP_LOCAL_BREAKS
:
436 OverrideParaBreaks(pProps
, pOverStyle
);
439 case PP_LOCAL_BULLET
:
441 pBulletProps
= pProps
;
442 // OverrideParaBullet(pProps);
445 case PP_LOCAL_NUMBERING
:
447 pNumberingProps
= pProps
;
448 // OverrideParaNumbering(pProps);
452 case PP_LOCAL_TABRACK
:
455 /*LwpTabOverride* pTabOverride=pParaStyle->GetTabOverride();
458 OverrideTab(NULL,static_cast<LwpParaTabRackProperty*>(pProps)->GetTab(),pOverStyle);
462 OverrideTab(pTabOverride,static_cast<LwpParaTabRackProperty*>(pProps)->GetTab(),pOverStyle);
466 case PP_LOCAL_BACKGROUND
:
468 /* LwpBackgroundOverride aBackground;
469 if (!pParaStyle->GetBackground())
470 OverrideBackground(NULL,static_cast<LwpParaBackGroundProperty*>(pProps)->GetBackground(),pOverStyle);
473 aBackground = *(pParaStyle->GetaBackground());
474 OverrideBackground(&aBackground,static_cast<LwpParaBackGroundProperty*>(pProps)->GetBackground(),pOverStyle);
477 // modified by , 06/03/2005
478 LwpBackgroundOverride
* pBGOver
= static_cast<LwpParaBackGroundProperty
*>(pProps
)->GetBackground();
481 LwpBackgroundStuff
* pBGStuff
= pBGOver
->GetBGStuff();
482 if (pBGStuff
&& !pBGStuff
->IsTransparent() )
484 if (pBGStuff
->IsPatternFill())
486 XFBGImage
* pXFBGImage
= pBGStuff
->GetFillPattern();
487 pOverStyle
->SetBackImage(pXFBGImage
);
491 LwpColor
* pColor
= pBGStuff
->GetFillColor();
492 if (pColor
&& pColor
->IsValidColor())
494 XFColor
aXFColor( pColor
->To24Color());
495 pOverStyle
->SetBackColor( aXFColor
);
506 pProps
= pProps
->GetNext();
509 if (noIndent
&& m_pIndentOverride
)
511 if (m_pIndentOverride
->IsUseRelative() && GetParent())
513 OverrideIndent(NULL
,m_pIndentOverride
,pOverStyle
);
516 if (m_ParentStyleName
.getLength())
517 pOverStyle
->SetParentStyleName(m_ParentStyleName
); //Add by 2005/12/12
518 m_StyleName
= pXFStyleManager
->AddStyle(pOverStyle
)->GetStyleName();
521 else //use named style
523 if (m_pIndentOverride
)
525 if (m_pIndentOverride
->IsUseRelative() && GetParent())
527 pOverStyle
= new XFParaStyle
;
528 *pOverStyle
= *pBaseStyle
;
529 OverrideIndent(NULL
,m_pIndentOverride
,pOverStyle
);
530 if (m_ParentStyleName
.getLength())
531 pOverStyle
->SetParentStyleName(m_ParentStyleName
); //Add by 2005/12/12
532 m_StyleName
= pXFStyleManager
->AddStyle(pOverStyle
)->GetStyleName();
539 XFParaStyle
* pOldStyle
= pXFStyleManager
->FindParaStyle(m_StyleName
);
540 if (pOldStyle
->GetNumberRight())
542 pOverStyle
= new XFParaStyle
;
543 *pOverStyle
= *pOldStyle
;
544 pOverStyle
->SetAlignType(enumXFAlignStart
);
545 if (m_ParentStyleName
.getLength())
546 pOverStyle
->SetParentStyleName(m_ParentStyleName
); //Add by 2005/12/12
547 m_StyleName
= pXFStyleManager
->AddStyle(pOverStyle
)->GetStyleName();
551 // override bullet and numbering
552 OverrideParaBullet(pBulletProps
);
553 OverrideParaNumbering(pNumberingProps
);
556 //register bullet style
557 LwpBulletStyleMgr
* pBulletStyleMgr
= this->GetBulletStyleMgr();
560 // if has bullet or numbering
563 //if it's normal bullet
566 if (m_pSilverBullet
->HasName())
568 m_aBulletStyleName
= m_pSilverBullet
->GetBulletStyleName();
570 else if (!m_pBullOver
->IsEditable())
572 m_aBulletStyleName
= pBulletStyleMgr
->RegisterBulletStyle(this, m_pBullOver
, m_pIndentOverride
);
576 if (m_pSilverBullet
->IsBulletOrdered())
578 rtl::OUString aPreBullStyleName
;
579 LwpNumberingOverride
* pNumbering
= this->GetParaNumbering();
580 sal_uInt16 nPosition
= pNumbering
->GetPosition();
581 sal_Bool bLesser
= m_pSilverBullet
->IsLesserLevel(nPosition
);
582 sal_Bool bResetSection
= m_pSilverBullet
->IsNewSection(nPosition
);
584 LwpPara
* pPara
= this;
585 LwpPara
* pPrePara
= NULL
;
586 LwpSilverBullet
* pParaSilverBullet
= NULL
;
587 sal_uInt16 nNum
= 0, nOffset
= 0, nLevel
= 0, nFoundLevel
= 0xffff, nFoundBound
= 0;
589 nFoundBound
= nLevel
= pNumbering
->GetLevel();
590 if (nPosition
== pNumbering
->GetPosition())
594 bHeading
= pNumbering
->IsHeading();
598 /*// When we hit the hint paragraph, we can stop and check the hint.
599 if (qNumberHint && (qPara == qNumberHint->GetPara()) &&
600 qNumberHint->Lookup(qSilverBullet, Level, Position, &Offset))
606 pParaSilverBullet
= pPara
->GetSilverBullet();
607 pNumbering
= pPara
->GetParaNumbering();
609 if (*(pPara
->GetObjectID()) != *(this->GetObjectID()))
611 if (!pParaSilverBullet
)
616 /* If lesser, stop when we hit an outline style whose level is
617 * higher than our current level.
619 // restart based on Outline level?
620 if (pNumbering
&& bLesser
&& (bHeading
? pNumbering
->IsHeading() : sal_True
))
622 if (nFoundLevel
!= 0xffff)
624 if (pNumbering
->GetLevel() < nFoundLevel
)
628 if ((pNumbering
->GetLevel() == nFoundLevel
)
629 && (*(pParaSilverBullet
->GetObjectID()) != *(m_pSilverBullet
->GetObjectID())
630 || pNumbering
->GetPosition() != nPosition
))
637 if (pNumbering
&& pNumbering
->GetLevel() < nFoundBound
&& pParaSilverBullet
638 && (*(pParaSilverBullet
->GetObjectID()) != *(m_pSilverBullet
->GetObjectID())
639 || pNumbering
->GetPosition() != nPosition
))
641 nFoundBound
= pNumbering
->GetLevel();
647 && qSpecificStyle == qPara->GetParaStyle(LTRUE))
650 // See if we crossed a section boundary
653 CurrPos.SetPara(qPara);
654 if (CurrPos <= SectionPos)
659 // Don't bump the number if this bullet is skipped
660 if (m_pBullOver
->IsSkip())
662 else if ( pParaSilverBullet
663 && *(pParaSilverBullet
->GetObjectID()) == *(m_pSilverBullet
->GetObjectID())
664 && pNumbering
&& nPosition
== pNumbering
->GetPosition())
668 if (nFoundLevel
!= 0xffff)
670 if (nFoundLevel
== pNumbering
->GetLevel())
672 aPreBullStyleName
= pPara
->GetBulletStyleName();
676 else if (pNumbering
->GetLevel() <= nLevel
)
678 if (pNumbering
->GetLevel() >= nFoundBound
)
682 nFoundLevel
= pNumbering
->GetLevel();
683 aPreBullStyleName
= pPara
->GetBulletStyleName();
689 aPreBullStyleName
= pPara
->GetBulletStyleName();
694 if (pPara
&& pPara
->GetPrevious())
695 pPrePara
= static_cast<LwpPara
*>(pPara
->GetPrevious()->obj(VO_PARA
));
701 LwpStory
* pStory
= pPara
->GetStory();
702 pPrePara
= pStory
->GetLastParaOfPreviousStory();
711 nNum
= nNum
? nNum
: 1;
715 m_aBulletStyleName
= aPreBullStyleName
;
716 m_bBullContinue
= sal_True
;
720 m_bBullContinue
= sal_False
;
721 if (this->IsInCell())
723 XFListStyle
* pOldStyle
= static_cast<XFListStyle
*>(pXFStyleManager
->FindStyle(m_aBulletStyleName
));
726 XFListStyle
* pNewStyle
= new XFListStyle(*pOldStyle
);
727 m_aBulletStyleName
= pXFStyleManager
->AddStyle(pNewStyle
)->GetStyleName();
732 LwpStory
* pMyStory
= this->GetStory();
735 if (pMyStory
->IsBullStyleUsedBefore(m_aBulletStyleName
, m_aParaNumbering
.GetPosition()))
737 //m_bBullContinue = sal_True;
741 pMyStory
->AddBullStyleName2List(m_aBulletStyleName
, m_aParaNumbering
.GetPosition());
752 if (noSpacing
&& GetPrevious())
754 LwpPara
* pPrePara
= static_cast<LwpPara
*>(GetPrevious()->obj());
755 if (pPrePara
&& pPrePara
->GetBelowSpacing()!=0)
757 pOverStyle
= new XFParaStyle
;
758 *pOverStyle
= *GetXFParaStyle();
759 XFMargins
* pMargin
= &pOverStyle
->GetMargins();
760 pMargin
->SetTop(pMargin
->GetTop()+pPrePara
->GetBelowSpacing());
761 if (m_ParentStyleName
.getLength())
762 pOverStyle
->SetParentStyleName(m_ParentStyleName
); //Add by 2005/12/12
763 m_StyleName
= pXFStyleManager
->AddStyle(pOverStyle
)->GetStyleName();
768 if(m_Fribs
.HasFrib(FRIB_TAG_TAB
))
770 XFParaStyle
* pParaStyle
= new XFParaStyle
;
771 *pParaStyle
= *GetXFParaStyle();
772 //pOverStyle->SetStyleName(A2OUSTR(""));
773 this->RegisterTabStyle(pParaStyle
);
774 if (m_ParentStyleName
.getLength())
775 pParaStyle
->SetParentStyleName(m_ParentStyleName
); //Add by 2005/12/12
776 m_StyleName
= pXFStyleManager
->AddStyle(pParaStyle
)->GetStyleName();
779 //register master page;
780 RegisterMasterPage(GetXFParaStyle());
782 // reg auto style,lay here for pagebreak need overrided para style
783 m_Fribs
.SetPara(this);
784 m_Fribs
.RegisterStyle();
786 if (m_bHasDropcap
== sal_True
)
789 XFParaStyle
* pStyle
= new XFParaStyle
;
790 *pStyle
= *GetXFParaStyle();
791 pStyle
->SetDropCap(m_nChars
-1,m_nLines
);
792 if (m_ParentStyleName
.getLength())
793 pStyle
->SetParentStyleName(m_ParentStyleName
); //Add by 2005/12/12
794 m_StyleName
= pXFStyleManager
->AddStyle(pStyle
)->GetStyleName();
796 // maybe useful for futer version
797 // deleted because Leader of Table is not supported in this version
798 //AddTabStyleForTOC();
801 void LwpPara::RegisterNewSectionStyle(LwpPageLayout
*pLayout
)
806 XFSectionStyle
* pSectStyle
= new XFSectionStyle();
807 XFColumns
* pColumns
= pLayout
->GetXFColumns();
810 pSectStyle
->SetColumns(pColumns
);
812 XFStyleManager
* pXFStyleManager
= LwpGlobalMgr::GetInstance()->GetXFStyleManager();
813 m_SectionStyleName
= pXFStyleManager
->AddStyle(pSectStyle
)->GetStyleName();
816 XFSection
* LwpPara::CreateXFSection()
818 XFSection
* pXFSection
= new XFSection();
819 pXFSection
->SetStyleName(m_SectionStyleName
);
820 m_SectionStyleName
= A2OUSTR("");
824 /**************************************************************************
825 * @descr: register tab style
829 **************************************************************************/
830 void LwpPara::RegisterTabStyle(XFParaStyle
* pXFParaStyle
)
832 LwpTabOverride aFinaOverride
;
833 LwpTabOverride
* pBase
= NULL
;
834 //get the tabrack from the current layout
835 LwpStory
* pStory
= static_cast<LwpStory
*>(m_Story
.obj());
836 LwpMiddleLayout
* pLayout
= pStory
->GetTabLayout();
839 pBase
= pLayout
->GetTabOverride();
842 pBase
->Override(&aFinaOverride
);
846 //get the tabrack from the base parastyle
847 LwpParaStyle
* pParaStyle
= GetParaStyle();
848 pBase
= pParaStyle
->GetTabOverride();
851 pBase
->Override(&aFinaOverride
);
853 //get the tabrack from the local property
854 pBase
= GetLocalTabOverride();
857 pBase
->Override(&aFinaOverride
);
860 LwpParaStyle::ApplyTab(pXFParaStyle
, &aFinaOverride
);
863 * @short parse dropcap text
865 void LwpPara::ParseDropcapContent()
869 XFParagraph
* pDropcap
= GetFoundry()->GetDropcapMgr()->GetXFPara();
872 m_Fribs
.SetXFPara(pDropcap
);
877 * @short add paragraph break attribute
879 void LwpPara::AddBreakBefore(XFContentContainer
* pCont
)
883 if (m_pBreaks
->IsPageBreakBefore())
885 XFParagraph
*pPara
= new XFParagraph();
886 pPara
->SetStyleName(m_BefPageBreakName
);
889 else if (m_pBreaks
->IsColumnBreakBefore())
891 XFParagraph
*pPara
= new XFParagraph();
892 pPara
->SetStyleName(m_BefColumnBreakName
);
897 void LwpPara::AddBreakAfter(XFContentContainer
* pCont
)
901 if (m_pBreaks
->IsPageBreakAfter())
903 XFParagraph
*pPara
= new XFParagraph();
904 pPara
->SetStyleName(m_AftPageBreakName
);
907 else if (m_pBreaks
->IsColumnBreakAfter())
909 XFParagraph
*pPara
= new XFParagraph();
910 pPara
->SetStyleName(m_AftColumnBreakName
);
915 LwpVirtualLayout
* LwpPara::GetLayoutWithMyStory()
917 LwpStory
* pMyStory
= NULL
;
918 if (!m_Story
.IsNull())
920 pMyStory
= static_cast<LwpStory
*>(m_Story
.obj(VO_STORY
));
926 return pMyStory
->GetLayout(NULL
);
932 LwpBulletStyleMgr
* LwpPara::GetBulletStyleMgr()
936 return m_pFoundry
->GetBulletStyleMgr();
942 XFContentContainer
* LwpPara::AddBulletList(XFContentContainer
* pCont
)
944 LwpBulletStyleMgr
* pBulletStyleMgr
= this->GetBulletStyleMgr();
945 if (!pBulletStyleMgr
)
951 sal_uInt16 nLevel
= m_nLevel
;
952 sal_Bool bOrdered
= sal_False
;
953 LwpStory
* pMyStory
= this->GetStory();
955 pBulletStyleMgr
->SetContinueFlag(m_bBullContinue
);
957 if (m_pSilverBullet
->IsBulletOrdered())
959 LwpObjectID aSilverBulletID
= pBulletStyleMgr
->GetCurrentSilverBullet();
960 if (aSilverBulletID
.IsNull())
962 pBulletStyleMgr
->SetContinueFlag(sal_False
);
964 else if (pMyStory
&& pMyStory
->IsBullStyleUsedBefore(m_aBulletStyleName
, this->m_aParaNumbering
.GetPosition()))
966 pBulletStyleMgr
->SetContinueFlag(sal_True
);
968 /* else if (aSilverBulletID == *(m_pSilverBullet->GetObjectID()))
970 LwpNumberingOverride* pNumOver = pBulletStyleMgr->GetCurrentNumOver();
973 pBulletStyleMgr->SetContinueFlag(sal_False);
975 else if (m_aParaNumbering.GetPosition() == pNumOver->GetPosition())
977 pBulletStyleMgr->SetContinueFlag(sal_True);
982 pBulletStyleMgr->SetContinueFlag(sal_False);
985 pBulletStyleMgr
->SetCurrentNumOver(m_aParaNumbering
);
986 pBulletStyleMgr
->SetCurrentSilverBullet(*(m_pSilverBullet
->GetObjectID()));
990 if (m_pSilverBullet
->IsBulletOrdered())
994 if (m_pSilverBullet
->HasName())
996 // nLevel = m_pParaNumbering->GetPosition();
997 nLevel
= m_aParaNumbering
.GetPosition();
998 m_nLevel
= nLevel
;//add by ,for get para level
999 // m_aBulletStyleName = m_pSilverBullet->GetBulletStyleName();
1002 return ( pBulletStyleMgr
->AddBulletList(pCont
, bOrdered
, m_aBulletStyleName
,
1003 nLevel
, m_pBullOver
->IsSkip()) );
1006 LwpNumberingOverride
* LwpPara::GetParaNumbering()
1008 return &m_aParaNumbering
;
1010 LwpNumberingOverride
* pNumbering
= NULL
;
1011 LwpParaStyle
* pStyle
= this->GetParaStyle();
1014 pNumbering
= pStyle
->GetNumberingOverride();
1019 /* if (m_pParaNumbering)
1021 m_pParaNumbering->Override(pNumbering);
1023 m_aParaNumbering
.Override(pNumbering
);
1028 // return m_pParaNumbering;
1029 return &m_aParaNumbering
;
1034 void LwpForked3NotifyList::Read(LwpObjectStream
* pObjStrm
)
1036 m_PersistentList
.Read(pObjStrm
);
1039 void LwpNotifyListPersistent::Read(LwpObjectStream
* pObjStrm
)
1041 m_Head
.ReadIndexed(pObjStrm
);
1042 pObjStrm
->SkipExtra();
1045 void LwpPara::Release()