tdf#131098 docx export: write fill property of graphic
[LibreOffice.git] / lotuswordpro / source / filter / lwppara.cxx
blobf1ddeddae2abbce771f1b12ff4033f4e93a0a784
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 ************************************************************************/
61 #include "lwppara.hxx"
62 #include <lwpglobalmgr.hxx>
63 #include <lwpfilehdr.hxx>
64 #include "lwppagelayout.hxx"
65 #include "lwpparaproperty.hxx"
66 #include "lwpparastyle.hxx"
67 #include <xfilter/xfstylemanager.hxx>
68 #include <xfilter/xfparagraph.hxx>
69 #include <xfilter/xfmargins.hxx>
70 #include <xfilter/xfsection.hxx>
71 #include <xfilter/xfsectionstyle.hxx>
72 #include <xfilter/xfcolor.hxx>
73 #include <xfilter/xfliststyle.hxx>
74 #include "lwpfribheader.hxx"
75 #include "lwplayout.hxx"
76 #include "lwpbulletstylemgr.hxx"
77 #include "lwpstory.hxx"
78 #include "lwpsilverbullet.hxx"
80 #include <lwpdropcapmgr.hxx>
81 #include <memory>
82 #include <o3tl/sorted_vector.hxx>
84 LwpPara::LwpPara(LwpObjectHeader const & objHdr, LwpSvStream* pStrm)
85 : LwpDLVList(objHdr, pStrm)
86 , m_nOrdinal(0)
87 , m_nFlags(0)
88 , m_nLevel(0)
89 , m_FontID(0)
90 , m_AllText(u""_ustr)
91 , m_bHasBullet(false)
92 , m_pSilverBullet(nullptr)
93 , m_bBullContinue(false)
94 , m_SectionStyleName(u""_ustr)
95 , m_bHasDropcap(false)
96 , m_nLines(0)
97 , m_nChars(0)
98 , m_pDropcapLayout(nullptr)
99 , m_BelowSpacing(0)
103 LwpPara::~LwpPara()
107 void LwpPara::Read()
109 LwpDLVList::Read();
111 bool Simple;
112 bool Notify = false;
113 if(LwpFileHeader::m_nFileRevision<0x0006)
114 Simple = false;
115 else if(LwpFileHeader::m_nFileRevision<0x000B)
116 Simple = m_pObjStrm->QuickReaduInt8() != 0;
117 else
119 sal_uInt8 Flag = m_pObjStrm->QuickReaduInt8();
121 const int DISK_SIMPLE = 1;
122 const int DISK_NOTIFY = 2;
124 Simple = (Flag & DISK_SIMPLE) != 0;
125 Notify = (Flag & DISK_NOTIFY) != 0;
128 if(!Simple)
130 m_nOrdinal = m_pObjStrm->QuickReaduInt32();
131 if(LwpFileHeader::m_nFileRevision<0x000B)
133 assert(false);
135 else
137 if (Notify)
139 LwpForked3NotifyList aNotifyList;
140 aNotifyList.GetExtraList().Read(m_pObjStrm.get());
141 aNotifyList.Read(m_pObjStrm.get());
145 else
146 m_nOrdinal = 0x0001;
148 m_nFlags = m_pObjStrm->QuickReaduInt16();
149 m_ParaStyle.ReadIndexed(m_pObjStrm.get());
151 if(!Simple)
153 m_Hint.Read(m_pObjStrm.get());
156 m_Story.ReadIndexed(m_pObjStrm.get());
157 if(!Simple)
159 if(LwpFileHeader::m_nFileRevision<0x000B)
161 // TODO: to process
162 assert(false);
164 m_nLevel = m_pObjStrm->QuickReaduInt16();
166 if (m_nLevel > 9)
168 m_nLevel = 9;
171 else
172 m_nLevel = 0x0001;
174 m_Fribs.SetPara(this);// for silver bullet
175 m_Fribs.ReadPara(m_pObjStrm.get());
177 ReadPropertyList(m_pObjStrm.get());
180 void LwpPara::Parse(IXFStream* pOutputStream)
182 m_xXFContainer.set(new XFContentContainer);
183 XFConvert(m_xXFContainer.get());
184 if (!m_xXFContainer)
185 return;
186 m_xXFContainer->ToXml(pOutputStream);
187 m_xXFContainer->Reset();
188 m_xXFContainer.clear();
191 void LwpPara::XFConvert(XFContentContainer* pCont)
193 m_xXFContainer.set(pCont);
195 LwpStory *pStory = dynamic_cast<LwpStory*>(m_Story.obj().get());
197 if (pStory && pStory->GetDropcapFlag())
199 ParseDropcapContent();
200 return;
203 //Add the break before para
204 if (m_pBreaks && m_nOrdinal!=0)
205 AddBreakBefore(pCont);
207 //Create an XFPara for this VO_PARA
208 rtl::Reference<XFParagraph> xPara(new XFParagraph);
209 xPara->SetStyleName(m_StyleName);
211 if(!m_SectionStyleName.isEmpty())
213 rtl::Reference<XFSection> xSection(CreateXFSection());
214 if (pStory)
215 pStory->AddXFContent(xSection.get());
216 m_xXFContainer = xSection;
219 if (m_bHasBullet && m_pSilverBullet)
221 rtl::Reference<XFContentContainer> xListItem = AddBulletList(m_xXFContainer.get());
222 if (xListItem)
224 xListItem->Add(xPara.get());
227 else if (m_xXFContainer)
229 LwpBulletStyleMgr* pBulletStyleMgr = GetBulletStyleMgr();
230 if (pBulletStyleMgr)
232 pBulletStyleMgr->SetCurrentSilverBullet(LwpObjectID());
233 pBulletStyleMgr->SetContinueFlag(false);
235 m_xXFContainer->Add(xPara.get());
238 m_Fribs.SetXFPara(xPara.get());
239 m_Fribs.XFConvert();
241 if (m_pBreaks && m_xXFContainer)
242 AddBreakAfter(m_xXFContainer.get());
245 void LwpPara::RegisterMasterPage(XFParaStyle const * pBaseStyle)
247 //get story
248 LwpStory* pStory = dynamic_cast<LwpStory*>(m_Story.obj().get());
249 //if pagelayout is modified, register the pagelayout
250 if(!(pStory && pStory->IsPMModified()))
251 return;
253 bool bNewSection = pStory->IsNeedSection();
254 LwpPageLayout* pLayout = pStory->GetCurrentLayout();
255 if(bNewSection)
257 RegisterNewSectionStyle(pLayout);
260 //register master page style
261 std::unique_ptr<XFParaStyle> xOverStyle(new XFParaStyle);
262 *xOverStyle = *pBaseStyle;
263 xOverStyle->SetStyleName( u""_ustr);
264 xOverStyle->SetMasterPage(pLayout->GetStyleName());
265 if (!m_ParentStyleName.isEmpty())
266 xOverStyle->SetParentStyleName(m_ParentStyleName);
267 XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
268 m_StyleName = pXFStyleManager->AddStyle(std::move(xOverStyle)).m_pStyle->GetStyleName();
271 * @short register paragraph style
273 void LwpPara::RegisterStyle()
274 { //1 reg autostyle
275 // m_Fribs.SetPara(this);
276 // m_Fribs.RegisterStyle();
278 //2 reg para style
279 if (!m_pFoundry)
280 return;
281 XFParaStyle* pBaseStyle = dynamic_cast<XFParaStyle*>(m_pFoundry->GetStyleManager()->GetStyle(m_ParaStyle));
282 if (pBaseStyle == nullptr) return;
283 m_StyleName = pBaseStyle->GetStyleName();//such intf to be added
284 m_ParentStyleName = m_StyleName;
285 XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
287 LwpParaStyle* pParaStyle = GetParaStyle();
288 if (pParaStyle && pParaStyle->GetIndent())
290 std::unique_ptr<LwpIndentOverride> pIndentOverride(GetParaStyle()->GetIndent()->clone());
291 m_pIndentOverride = std::move(pIndentOverride);
294 std::unique_ptr<XFParaStyle> xOverStyle;
295 bool noSpacing = true;
296 LwpParaProperty* pBulletProps = nullptr, *pNumberingProps = nullptr;
298 if (!m_vProps.empty())
300 bool noIndent = true;
301 xOverStyle.reset(new XFParaStyle);
302 *xOverStyle = *pBaseStyle;
303 xOverStyle->SetStyleName(u""_ustr);
304 sal_uInt32 PropType;
305 LwpParaStyle& rParaStyle = dynamic_cast<LwpParaStyle&>(*m_ParaStyle.obj());
306 for (auto & pProps : m_vProps)
308 PropType = pProps->GetType();
309 switch(PropType)
311 case PP_LOCAL_ALIGN:
313 LwpAlignmentOverride *pAlignment = static_cast<LwpParaAlignProperty*>(pProps.get())->GetAlignment();
314 if (pAlignment)
316 if (!rParaStyle.GetAlignment())
317 OverrideAlignment(nullptr, pAlignment, xOverStyle.get());
318 else
320 std::unique_ptr<LwpAlignmentOverride> const pAlign(
321 rParaStyle.GetAlignment()->clone());
322 OverrideAlignment(pAlign.get(),
323 pAlignment,
324 xOverStyle.get());
327 break;
329 case PP_LOCAL_INDENT:
331 noIndent = false;
332 LwpIndentOverride *pIndent = static_cast<LwpParaIndentProperty*>(pProps.get())->GetIndent();
333 if (pIndent)
335 if (!rParaStyle.GetIndent())
336 OverrideIndent(nullptr, pIndent, xOverStyle.get());
337 else
338 OverrideIndent(m_pIndentOverride.get(), pIndent, xOverStyle.get());
340 break;
342 case PP_LOCAL_SPACING:
344 noSpacing = false;
345 LwpSpacingOverride *pSpacing = static_cast<LwpParaSpacingProperty*>(pProps.get())->GetSpacing();
346 if (pSpacing)
348 if (!rParaStyle.GetSpacing())
349 OverrideSpacing(nullptr, pSpacing, xOverStyle.get());
350 else
352 std::unique_ptr<LwpSpacingOverride> const
353 pNewSpacing(rParaStyle.GetSpacing()->clone());
354 OverrideSpacing(pNewSpacing.get(), pSpacing, xOverStyle.get());
357 break;
359 case PP_LOCAL_BORDER:
361 OverrideParaBorder(pProps.get(), xOverStyle.get());
362 break;
364 case PP_LOCAL_BREAKS:
366 OverrideParaBreaks(pProps.get(), xOverStyle.get());
367 break;
369 case PP_LOCAL_BULLET:
371 pBulletProps = pProps.get();
372 break;
374 case PP_LOCAL_NUMBERING:
376 pNumberingProps = pProps.get();
377 break;
379 case PP_LOCAL_TABRACK:
381 break;
383 case PP_LOCAL_BACKGROUND:
385 LwpBackgroundOverride* pBGOver = static_cast<LwpParaBackGroundProperty*>(pProps.get())->GetBackground();
386 if (pBGOver)
388 LwpBackgroundStuff& rBGStuff = pBGOver->GetBGStuff();
389 if (!rBGStuff.IsTransparent() )
391 if (rBGStuff.IsPatternFill())
393 std::unique_ptr<XFBGImage> xXFBGImage(rBGStuff.GetFillPattern());
394 xOverStyle->SetBackImage(xXFBGImage);
396 else
398 LwpColor* pColor = rBGStuff.GetFillColor();
399 if (pColor && pColor->IsValidColor())
401 XFColor aXFColor( pColor->To24Color());
402 xOverStyle->SetBackColor( aXFColor );
407 break;
409 default:
410 break;
414 if (noIndent && m_pIndentOverride)
416 if (m_pIndentOverride->IsUseRelative() && GetParent())
418 OverrideIndent(nullptr,m_pIndentOverride.get(),xOverStyle.get());
421 if (!m_ParentStyleName.isEmpty())
422 xOverStyle->SetParentStyleName(m_ParentStyleName);
423 m_StyleName = pXFStyleManager->AddStyle(std::move(xOverStyle)).m_pStyle->GetStyleName();
426 else //use named style
428 if (m_pIndentOverride)
430 if (m_pIndentOverride->IsUseRelative() && GetParent())
432 xOverStyle.reset(new XFParaStyle);
433 *xOverStyle = *pBaseStyle;
434 OverrideIndent(nullptr,m_pIndentOverride.get(),xOverStyle.get());
435 if (!m_ParentStyleName.isEmpty())
436 xOverStyle->SetParentStyleName(m_ParentStyleName);
437 m_StyleName = pXFStyleManager->AddStyle(std::move(xOverStyle)).m_pStyle->GetStyleName();
442 if (IsInCell())
444 XFParaStyle* pOldStyle = pXFStyleManager->FindParaStyle(m_StyleName);
445 if (pOldStyle->GetNumberRight())
447 xOverStyle.reset(new XFParaStyle);
448 *xOverStyle = *pOldStyle;
449 xOverStyle->SetAlignType(enumXFAlignStart);
450 if (!m_ParentStyleName.isEmpty())
451 xOverStyle->SetParentStyleName(m_ParentStyleName);
452 m_StyleName = pXFStyleManager->AddStyle(std::move(xOverStyle)).m_pStyle->GetStyleName();
456 // override bullet and numbering
457 OverrideParaBullet(pBulletProps);
458 OverrideParaNumbering(pNumberingProps);
460 //register bullet style
461 LwpBulletStyleMgr* pBulletStyleMgr = GetBulletStyleMgr();
462 if (pBulletStyleMgr)
464 // if has bullet or numbering
465 if (m_bHasBullet)
467 //if it's normal bullet
468 if (m_pSilverBullet)
470 if (m_pSilverBullet->HasName())
472 m_aBulletStyleName = m_pSilverBullet->GetBulletStyleName();
474 else if (!m_xBullOver->IsEditable())
476 m_aBulletStyleName = pBulletStyleMgr->RegisterBulletStyle(this, m_xBullOver.get(), m_pIndentOverride.get());
479 // test codes
480 if (m_pSilverBullet->IsBulletOrdered())
482 OUString aPreBullStyleName;
483 LwpNumberingOverride* pNumbering = GetParaNumbering();
484 sal_uInt16 nPosition = pNumbering->GetPosition();
485 bool bLesser = m_pSilverBullet->IsLesserLevel(nPosition);
486 LwpPara* pPara = this;
487 LwpPara* pPrePara = nullptr;
488 sal_uInt16 nNum = 0, nLevel = 0, nFoundLevel = 0xffff, nFoundBound = 0;
490 nFoundBound = nLevel = pNumbering->GetLevel();
491 if (nPosition == pNumbering->GetPosition())
493 nFoundBound++;
495 bool bHeading = pNumbering->IsHeading();
497 o3tl::sorted_vector<LwpPara*> aSeen;
498 while(true)
500 bool bAlreadySeen = !aSeen.insert(pPara).second;
501 if (bAlreadySeen)
502 throw std::runtime_error("loop in conversion");
503 LwpSilverBullet* pParaSilverBullet = pPara->GetSilverBullet();
504 pNumbering = pPara->GetParaNumbering();
506 if (pPara->GetObjectID() != GetObjectID())
508 if (!pParaSilverBullet)
510 break;
513 /* If lesser, stop when we hit an outline style whose level is
514 * higher than our current level.
516 // restart based on Outline level?
517 if (pNumbering && bLesser && (!bHeading || pNumbering->IsHeading()))
519 if (nFoundLevel != 0xffff)
521 if (pNumbering->GetLevel() < nFoundLevel)
523 break;
525 if ((pNumbering->GetLevel() == nFoundLevel)
526 && (pParaSilverBullet->GetObjectID() != m_pSilverBullet->GetObjectID()
527 || pNumbering->GetPosition() != nPosition))
529 break;
532 else
534 if (pNumbering->GetLevel() < nFoundBound
535 && (pParaSilverBullet->GetObjectID() != m_pSilverBullet->GetObjectID()
536 || pNumbering->GetPosition() != nPosition))
538 nFoundBound = pNumbering->GetLevel();
544 // Don't bump the number if this bullet is skipped
545 if (m_xBullOver->IsSkip())
547 else if ( pParaSilverBullet
548 && pParaSilverBullet->GetObjectID() == m_pSilverBullet->GetObjectID()
549 && pNumbering && nPosition == pNumbering->GetPosition())
551 if (bLesser)
553 if (nFoundLevel != 0xffff)
555 if (nFoundLevel == pNumbering->GetLevel())
557 aPreBullStyleName = pPara->GetBulletStyleName();
558 nNum++;
561 else if (pNumbering->GetLevel() <= nLevel)
563 if (pNumbering->GetLevel() >= nFoundBound)
565 break;
567 nFoundLevel = pNumbering->GetLevel();
568 aPreBullStyleName = pPara->GetBulletStyleName();
569 nNum++;
572 else
574 aPreBullStyleName = pPara->GetBulletStyleName();
575 nNum++;
579 pPrePara = dynamic_cast<LwpPara*>(pPara->GetPrevious().obj(VO_PARA).get());
581 if (!pPrePara)
583 LwpStory* pStory = pPara->GetStory();
584 pPrePara = pStory ? pStory->GetLastParaOfPreviousStory() : nullptr;
586 if (!pPrePara)
588 break;
591 pPara = pPrePara;
593 nNum = nNum ? nNum : 1;
595 if (nNum > 1)
597 m_aBulletStyleName = aPreBullStyleName;
598 m_bBullContinue = true;
600 else
602 m_bBullContinue = false;
603 if (IsInCell())
605 XFListStyle* pOldStyle = static_cast<XFListStyle*>(pXFStyleManager->FindStyle(m_aBulletStyleName));
606 if (pOldStyle)
608 std::unique_ptr<XFListStyle> xNewStyle(new XFListStyle(*pOldStyle));
609 m_aBulletStyleName = pXFStyleManager->AddStyle(std::move(xNewStyle)).m_pStyle->GetStyleName();
614 LwpStory* pMyStory = GetStory();
615 if (pMyStory)
617 if (pMyStory->IsBullStyleUsedBefore(m_aBulletStyleName, m_xParaNumbering->GetPosition()))
619 //m_bBullContinue = sal_True;
621 else
623 pMyStory->AddBullStyleName2List(m_aBulletStyleName, m_xParaNumbering->GetPosition());
628 // end of test codes
633 if (noSpacing)
635 LwpPara* pPrePara = dynamic_cast<LwpPara*>(GetPrevious().obj().get());
636 if (pPrePara && pPrePara->GetBelowSpacing()!=0)
638 xOverStyle.reset(new XFParaStyle);
639 *xOverStyle = *GetXFParaStyle();
640 XFMargins* pMargin = &xOverStyle->GetMargins();
641 pMargin->SetTop(pMargin->GetTop()+pPrePara->GetBelowSpacing());
642 if (!m_ParentStyleName.isEmpty())
643 xOverStyle->SetParentStyleName(m_ParentStyleName);
644 m_StyleName = pXFStyleManager->AddStyle(std::move(xOverStyle)).m_pStyle->GetStyleName();
648 //register tab style
649 if(m_Fribs.HasFrib(FRIB_TAG_TAB))
651 std::unique_ptr<XFParaStyle> xNewParaStyle(new XFParaStyle);
652 *xNewParaStyle = *GetXFParaStyle();
653 //xOverStyle->SetStyleName("");
654 RegisterTabStyle(xNewParaStyle.get());
655 if (!m_ParentStyleName.isEmpty())
656 xNewParaStyle->SetParentStyleName(m_ParentStyleName);
657 m_StyleName = pXFStyleManager->AddStyle(std::move(xNewParaStyle)).m_pStyle->GetStyleName();
660 //register master page;
661 RegisterMasterPage(GetXFParaStyle());
663 // reg auto style,lay here for pagebreak need overridden para style
664 m_Fribs.SetPara(this);
665 m_Fribs.RegisterStyle();
667 if (m_bHasDropcap)
669 GatherDropcapInfo();
670 std::unique_ptr<XFParaStyle> xStyle(new XFParaStyle);
671 *xStyle = *GetXFParaStyle();
672 xStyle->SetDropCap(m_nChars-1,m_nLines);
673 if (!m_ParentStyleName.isEmpty())
674 xStyle->SetParentStyleName(m_ParentStyleName);
675 m_StyleName = pXFStyleManager->AddStyle(std::move(xStyle)).m_pStyle->GetStyleName();
677 // maybe useful for further version
678 // deleted because Leader of Table is not supported in this version
679 //AddTabStyleForTOC();
682 void LwpPara::RegisterNewSectionStyle(LwpPageLayout *pLayout)
684 if( !pLayout )
685 return;
687 std::unique_ptr<XFSectionStyle> xSectStyle(new XFSectionStyle);
688 XFColumns* pColumns = pLayout->GetXFColumns();
689 if(pColumns)
691 xSectStyle->SetColumns(pColumns);
693 XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
694 m_SectionStyleName = pXFStyleManager->AddStyle(std::move(xSectStyle)).m_pStyle->GetStyleName();
697 rtl::Reference<XFSection> LwpPara::CreateXFSection()
699 rtl::Reference<XFSection> xXFSection(new XFSection);
700 xXFSection->SetStyleName(m_SectionStyleName);
701 m_SectionStyleName.clear();
702 return xXFSection;
705 /**************************************************************************
706 * @descr: register tab style
707 **************************************************************************/
708 void LwpPara::RegisterTabStyle(XFParaStyle* pXFParaStyle)
710 LwpTabOverride aFinaOverride;
711 LwpTabOverride* pBase = nullptr;
712 //get the tabrack from the current layout
713 LwpStory* pStory = dynamic_cast<LwpStory*>(m_Story.obj().get());
714 LwpMiddleLayout* pLayout = pStory ? pStory->GetTabLayout() : nullptr;
715 if(pLayout)
717 pBase = pLayout->GetTabOverride();
718 if(pBase)
720 pBase->Override(&aFinaOverride);
724 //get the tabrack from the base parastyle
725 LwpParaStyle* pParaStyle = GetParaStyle();
726 pBase = pParaStyle->GetTabOverride();
727 if(pBase)
729 pBase->Override(&aFinaOverride);
731 //get the tabrack from the local property
732 pBase = GetLocalTabOverride();
733 if(pBase)
735 pBase->Override(&aFinaOverride);
738 LwpParaStyle::ApplyTab(pXFParaStyle, &aFinaOverride);
741 * @short parse dropcap text
743 void LwpPara::ParseDropcapContent()
745 if (!GetFoundry())
746 return;
747 XFParagraph* pDropcap = GetFoundry()->GetDropcapMgr().GetXFPara();
748 if (pDropcap)
750 m_Fribs.SetXFPara(pDropcap);
751 m_Fribs.XFConvert();
755 * @short add paragraph break attribute
757 void LwpPara::AddBreakBefore(XFContentContainer* pCont)
759 if (!m_pBreaks || !pCont)
760 return;
761 if (m_pBreaks->IsPageBreakBefore())
763 rtl::Reference<XFParagraph> xPara(new XFParagraph);
764 xPara->SetStyleName(m_BefPageBreakName);
765 pCont->Add(xPara.get());
767 else if (m_pBreaks->IsColumnBreakBefore())
769 rtl::Reference<XFParagraph> xPara(new XFParagraph);
770 xPara->SetStyleName(m_BefColumnBreakName);
771 pCont->Add(xPara.get());
775 void LwpPara::AddBreakAfter(XFContentContainer* pCont)
777 if (!m_pBreaks)
778 return;
779 if (m_pBreaks->IsPageBreakAfter())
781 rtl::Reference<XFParagraph> xPara(new XFParagraph);
782 xPara->SetStyleName(m_AftPageBreakName);
783 pCont->Add(xPara.get());
785 else if (m_pBreaks->IsColumnBreakAfter())
787 rtl::Reference<XFParagraph> xPara(new XFParagraph);
788 xPara->SetStyleName(m_AftColumnBreakName);
789 pCont->Add(xPara.get());
793 LwpBulletStyleMgr* LwpPara::GetBulletStyleMgr()
795 if (m_pFoundry)
797 return m_pFoundry->GetBulletStyleMgr();
800 return nullptr;
803 rtl::Reference<XFContentContainer> LwpPara::AddBulletList(XFContentContainer* pCont)
805 LwpBulletStyleMgr* pBulletStyleMgr = GetBulletStyleMgr();
806 if (!pBulletStyleMgr)
808 assert(false);
809 return rtl::Reference<XFContentContainer>();
812 sal_uInt16 nLevel = m_nLevel;
813 bool bOrdered = false;
814 /*LwpStory* pMyStory =*/ GetStory();
816 pBulletStyleMgr->SetContinueFlag(m_bBullContinue);
818 if (m_pSilverBullet->IsBulletOrdered())
820 bOrdered = true;
822 if (m_pSilverBullet->HasName())
824 nLevel = m_xParaNumbering->GetPosition();
825 m_nLevel = nLevel;//for get para level
828 return pBulletStyleMgr->AddBulletList(pCont, bOrdered, m_aBulletStyleName,
829 nLevel, m_xBullOver->IsSkip());
832 LwpNumberingOverride* LwpPara::GetParaNumbering()
834 return m_xParaNumbering.get();
837 void LwpForked3NotifyList::Read(LwpObjectStream* pObjStrm)
839 m_PersistentList.Read(pObjStrm);
842 void LwpNotifyListPersistent::Read(LwpObjectStream* pObjStrm)
844 m_Head.ReadIndexed(pObjStrm);
845 pObjStrm->SkipExtra();
848 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */