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,
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 #include <lwpglobalmgr.hxx>
57 #include "lwpcharacterstyle.hxx"
59 #include "lwpfootnote.hxx"
60 #include "lwppagehint.hxx"
61 #include "lwpdivinfo.hxx"
62 #include "lwpholder.hxx"
63 #include "lwpstory.hxx"
64 #include "lwpsilverbullet.hxx"
65 #include "lwpsortopt.hxx"
66 #include "lwplayout.hxx"
67 #include "lwppagelayout.hxx"
68 #include "lwpuidoc.hxx"
69 #include "lwpusrdicts.hxx"
70 #include "lwpprtinfo.hxx"
71 #include "lwpverdocument.hxx"
72 #include <xfilter/xftextstyle.hxx>
73 #include <xfilter/xfstylemanager.hxx>
74 #include <o3tl/sorted_vector.hxx>
76 LwpDocument::LwpDocument(LwpObjectHeader
const& objHdr
, LwpSvStream
* pStrm
)
77 : LwpDLNFPVList(objHdr
, pStrm
)
78 , m_bGettingFirstDivisionWithContentsThatIsNotOLE(false)
79 , m_bGettingPreviousDivisionWithContents(false)
80 , m_bGettingGetLastDivisionWithContents(false)
82 , m_nPersistentFlags(0)
86 LwpDocument::~LwpDocument() {}
88 * @descr Read VO_Document from object stream
90 void LwpDocument::Read()
92 LwpDLNFPVList::Read();
96 m_nPersistentFlags
= m_pObjStrm
->QuickReaduInt32();
98 //Skip the SortOption and UIDocument
100 LwpSortOption
aDocSort(m_pObjStrm
.get());
101 LwpUIDocument
aUIDoc(m_pObjStrm
.get());
104 m_oLnOpts
.emplace(m_pObjStrm
.get());
106 //Skip LwpUserDictFiles
108 LwpUserDictFiles
aUsrDicts(m_pObjStrm
.get());
113 //Skip LwpPrinterInfo
114 LwpPrinterInfo
aPrtInfo(m_pObjStrm
.get());
117 m_xOwnedFoundry
.reset(new LwpFoundry(m_pObjStrm
.get(), this));
119 m_DivOpts
.ReadIndexed(m_pObjStrm
.get());
123 m_FootnoteOpts
.ReadIndexed(m_pObjStrm
.get());
124 m_DocData
.ReadIndexed(m_pObjStrm
.get());
128 //Skip the docdata used in old version
129 LwpObjectID dummyDocData
;
130 dummyDocData
.ReadIndexed(m_pObjStrm
.get());
132 m_DivInfo
.ReadIndexed(m_pObjStrm
.get());
133 m_Epoch
.Read(m_pObjStrm
.get());
134 m_WYSIWYGPageHints
.ReadIndexed(m_pObjStrm
.get());
135 m_VerDoc
.ReadIndexed(m_pObjStrm
.get());
136 m_STXInfo
.ReadIndexed(m_pObjStrm
.get());
140 * @descr Read plug related data from m_pObjStram
142 void LwpDocument::ReadPlug()
144 m_DocSockID
.ReadIndexed(m_pObjStrm
.get());
145 m_nFlags
= m_pObjStrm
->QuickReaduInt16();
146 m_pObjStrm
->SkipExtra();
150 * @descr Parse obj to IXFStream
152 void LwpDocument::Parse(IXFStream
* pOutputStream
)
154 //check the name and skip script division
155 if (!IsSkippedDivision())
157 //the frames which anchor are to page must output before other contents
158 ParseFrameInPage(pOutputStream
);
159 ParseDocContent(pOutputStream
);
162 rtl::Reference
<LwpObject
> pDocSock
= GetSocket().obj(VO_DOCSOCK
);
165 pDocSock
->DoParse(pOutputStream
);
169 bool LwpDocument::IsSkippedDivision()
173 LwpDivInfo
* pDiv
= dynamic_cast<LwpDivInfo
*>(GetDivInfoID().obj(VO_DIVISIONINFO
).get());
176 sDivName
= pDiv
->GetDivName();
177 if (!sDivName
.isEmpty() && !pDiv
->IsGotoable()) //including toa,scripts division
179 //skip endnote division
180 OUString strClassName
= pDiv
->GetClassName();
181 if ((strClassName
== STR_DivisionEndnote
) || (strClassName
== STR_DivisionGroupEndnote
)
182 || (strClassName
== STR_DocumentEndnote
))
184 LwpPageLayout
* pPageLayout
185 = dynamic_cast<LwpPageLayout
*>(pDiv
->GetInitialLayoutID().obj(VO_PAGELAYOUT
).get());
189 = dynamic_cast<LwpStory
*>(pPageLayout
->GetContent().obj(VO_STORY
).get());
192 //This judgement maybe have problem. If there is only one para in the story,
193 //this endnote division has no other contents except endnote table.
194 LwpObjectID
& rFirst
= pStory
->GetFirstPara();
195 LwpObjectID
& rLast
= pStory
->GetLastPara();
205 * @descr Register all styles in this division
207 void LwpDocument::RegisterStyle()
209 RegisterDefaultParaStyles();
210 RegisterGraphicsStyles();
211 RegisterBulletStyles();
213 RegisterTextStyles();
214 RegisterLayoutStyles();
215 RegisterStylesInPara();
217 RegisterLinenumberStyles();
218 RegisterFootnoteStyles();
220 //Register styles in other document connected with this document: next doc, children doc
221 rtl::Reference
<LwpObject
> pDocSock
= GetSocket().obj();
224 pDocSock
->DoRegisterStyle();
228 * @descr Register all named para styles
230 void LwpDocument::RegisterTextStyles()
232 //Register all text styles: para styles, character styles
233 LwpDLVListHeadHolder
* pTextStyleHolder
235 ? dynamic_cast<LwpDLVListHeadHolder
*>(m_xOwnedFoundry
->GetTextStyleHead().obj().get())
237 if (pTextStyleHolder
)
239 LwpTextStyle
* pTextStyle
240 = dynamic_cast<LwpTextStyle
*>(pTextStyleHolder
->GetHeadID().obj().get());
243 if (pTextStyle
->GetFoundry())
244 throw std::runtime_error("loop in register text style");
245 pTextStyle
->SetFoundry(m_xOwnedFoundry
.get());
246 pTextStyle
->RegisterStyle();
247 pTextStyle
= dynamic_cast<LwpTextStyle
*>(pTextStyle
->GetNext().obj().get());
250 ChangeStyleName(); //for click here block
253 * @descr Register all layouts styles (page master and master page)
254 * All para styles used in master page (header and footer) are registered and then showed
256 void LwpDocument::RegisterLayoutStyles()
260 //Register all layout styles, before register all styles in para
261 m_xOwnedFoundry
->RegisterAllLayouts();
264 //set initial pagelayout in story for parsing pagelayout
265 LwpDivInfo
* pDivInfo
= dynamic_cast<LwpDivInfo
*>(m_DivInfo
.obj(VO_DIVISIONINFO
).get());
269 LwpPageLayout
* pPageLayout
270 = dynamic_cast<LwpPageLayout
*>(pDivInfo
->GetInitialLayoutID().obj(VO_PAGELAYOUT
).get());
273 //In Ole division, the content of pagelayout is VO_OLEOBJECT
274 LwpStory
* pStory
= dynamic_cast<LwpStory
*>(pPageLayout
->GetContent().obj(VO_STORY
).get());
277 //add all the pagelayout in order into the pagelayout list;
278 pStory
->SortPageLayout();
279 pStory
->SetCurrentLayout(pPageLayout
);
284 * @descr Register all styles used in para
286 void LwpDocument::RegisterStylesInPara()
288 //Register all automatic styles in para
289 rtl::Reference
<LwpHeadContent
> xContent(
290 m_xOwnedFoundry
? dynamic_cast<LwpHeadContent
*>(
291 m_xOwnedFoundry
->GetContentManager().GetContentList().obj().get())
296 rtl::Reference
<LwpStory
> xStory(
297 dynamic_cast<LwpStory
*>(xContent
->GetChildHead().obj(VO_STORY
).get()));
298 o3tl::sorted_vector
<LwpStory
*> aSeen
;
301 bool bAlreadySeen
= !aSeen
.insert(xStory
.get()).second
;
303 throw std::runtime_error("loop in conversion");
304 //Register the child para
305 xStory
->SetFoundry(m_xOwnedFoundry
.get());
306 xStory
->DoRegisterStyle();
307 xStory
.set(dynamic_cast<LwpStory
*>(xStory
->GetNext().obj(VO_STORY
).get()));
311 * @descr Register all bullet styles used in this division
313 void LwpDocument::RegisterBulletStyles()
315 if (!m_xOwnedFoundry
)
317 //Register bullet styles
318 LwpDLVListHeadHolder
* pBulletHead
= dynamic_cast<LwpDLVListHeadHolder
*>(
319 m_xOwnedFoundry
->GetBulletManagerID().obj(VO_HEADHOLDER
).get());
322 LwpSilverBullet
* pBullet
= dynamic_cast<LwpSilverBullet
*>(pBulletHead
->GetHeadID().obj().get());
323 o3tl::sorted_vector
<LwpSilverBullet
*> aSeen
;
326 bool bAlreadySeen
= !aSeen
.insert(pBullet
).second
;
328 throw std::runtime_error("loop in conversion");
329 pBullet
->SetFoundry(m_xOwnedFoundry
.get());
330 pBullet
->RegisterStyle();
331 pBullet
= dynamic_cast<LwpSilverBullet
*>(pBullet
->GetNext().obj().get());
335 * @descr Register all styles used in VO_Graphic
337 void LwpDocument::RegisterGraphicsStyles()
339 if (!m_xOwnedFoundry
)
341 //Register all graphics styles, the first object should register the next;
342 rtl::Reference
<LwpObject
> pGraphic
= m_xOwnedFoundry
->GetGraphicListHead().obj(VO_GRAPHIC
);
345 pGraphic
->SetFoundry(m_xOwnedFoundry
.get());
346 pGraphic
->DoRegisterStyle();
349 * @descr Register line number styles
351 void LwpDocument::RegisterLinenumberStyles()
355 m_oLnOpts
->RegisterStyle();
359 * @descr Register footnote/endnote configuration for the entire document
361 void LwpDocument::RegisterFootnoteStyles()
363 //Register footnote and endnote configuration for the entire document
364 if (!m_FootnoteOpts
.IsNull())
366 LwpFootnoteOptions
* pFootnoteOpts
367 = dynamic_cast<LwpFootnoteOptions
*>(m_FootnoteOpts
.obj().get());
370 pFootnoteOpts
->SetMasterPage(u
"Endnote"_ustr
);
371 pFootnoteOpts
->RegisterStyle();
374 //Register endnote page style for endnote configuration, use the last division that has endnote for the endnote page style
375 //This page style must register after its division default styles have registered
376 LwpDocument
* pEndnoteDiv
= GetLastDivisionThatHasEndnote();
377 if (this != pEndnoteDiv
)
380 LwpDLVListHeadTailHolder
* pHeadTail
381 = dynamic_cast<LwpDLVListHeadTailHolder
*>(GetPageHintsID().obj().get());
385 LwpPageHint
* pPageHint
= dynamic_cast<LwpPageHint
*>(pHeadTail
->GetTail().obj().get());
386 if (pPageHint
&& !pPageHint
->GetPageLayoutID().IsNull())
388 LwpPageLayout
* pPageLayout
389 = dynamic_cast<LwpPageLayout
*>(pPageHint
->GetPageLayoutID().obj().get());
392 pPageLayout
->SetFoundry(GetFoundry());
393 pPageLayout
->RegisterEndnoteStyle();
399 * @descr Register default para styles
401 void LwpDocument::RegisterDefaultParaStyles()
407 //LwpDocument* pFirstDoc = GetFirstDivision();
408 LwpDocument
* pFirstDoc
= GetFirstDivisionWithContentsThatIsNotOLE();
411 LwpVerDocument
* pVerDoc
= dynamic_cast<LwpVerDocument
*>(pFirstDoc
->GetVerDoc().obj().get());
414 pVerDoc
->RegisterStyle();
420 * @descr Parse content in this division to IXFStream
421 * LwpDocument->LwpDivInfo->LwpPageLayout.Parse()
423 void LwpDocument::ParseDocContent(IXFStream
* pOutputStream
)
425 //Parse content in PageLayout
426 LwpDivInfo
* pDivInfo
= dynamic_cast<LwpDivInfo
*>(m_DivInfo
.obj().get());
427 if (pDivInfo
== nullptr)
430 rtl::Reference
<LwpObject
> pLayoutObj
= pDivInfo
->GetInitialLayoutID().obj();
431 if (!pLayoutObj
.is())
433 //master document not supported now.
436 pLayoutObj
->SetFoundry(m_xOwnedFoundry
.get());
437 pLayoutObj
->DoParse(pOutputStream
);
441 * @descr Get the footnoteoptions from the root document
443 LwpObjectID
* LwpDocument::GetValidFootnoteOpts()
445 LwpDocument
* pRoot
= GetRootDocument();
448 return &pRoot
->GetFootnoteOpts();
454 * @descr Get the endnote type
456 sal_uInt16
LwpDocument::GetEndnoteType()
458 LwpDivInfo
* pDivInfo
= dynamic_cast<LwpDivInfo
*>(GetDivInfoID().obj().get());
461 OUString strClassName
= pDivInfo
->GetClassName();
462 if (strClassName
== STR_DivisionEndnote
)
463 return FN_DIVISION_SEPARATE
;
464 if (strClassName
== STR_DivisionGroupEndnote
)
465 return FN_DIVISIONGROUP_SEPARATE
;
466 if (strClassName
== STR_DocumentEndnote
)
467 return FN_DOCUMENT_SEPARATE
;
471 * @descr Get previous division
473 LwpDocument
* LwpDocument::GetPreviousDivision()
475 LwpDocSock
* pDocSock
= dynamic_cast<LwpDocSock
*>(GetSocket().obj().get());
478 return dynamic_cast<LwpDocument
*>(pDocSock
->GetPrevious().obj().get());
483 * @descr Get next division
485 LwpDocument
* LwpDocument::GetNextDivision()
487 LwpDocSock
* pDocSock
= dynamic_cast<LwpDocSock
*>(GetSocket().obj().get());
490 return dynamic_cast<LwpDocument
*>(pDocSock
->GetNext().obj().get());
495 * @descr Get parent division
497 LwpDocument
* LwpDocument::GetParentDivision()
499 LwpDocSock
* pDocSock
= dynamic_cast<LwpDocSock
*>(GetSocket().obj().get());
502 return dynamic_cast<LwpDocument
*>(pDocSock
->GetParent().obj().get());
507 * @descr Get previous division in group, copy from lwp source code
509 LwpDocument
* LwpDocument::GetPreviousInGroup()
511 LwpDocument
* pPrev
= nullptr;
513 for (pPrev
= GetPreviousDivision(); pPrev
; pPrev
= pPrev
->GetPreviousDivision())
515 LwpDivInfo
* pDivInfo
= dynamic_cast<LwpDivInfo
*>(pPrev
->GetDivInfoID().obj().get());
516 if (pDivInfo
&& pDivInfo
->HasContents())
522 * @descr Get previous division in group, copy from lwp source code
524 LwpDocument
* LwpDocument::GetNextInGroup()
526 LwpDocument
* pNext
= nullptr;
528 for (pNext
= GetNextDivision(); pNext
; pNext
= pNext
->GetNextDivision())
530 LwpDivInfo
* pDivInfo
= dynamic_cast<LwpDivInfo
*>(pNext
->GetDivInfoID().obj().get());
531 if (pDivInfo
&& pDivInfo
->HasContents())
538 * @descr Get previous division which has contents, copy from lwp source code
540 LwpDocument
* LwpDocument::GetPreviousDivisionWithContents()
542 if (m_bGettingPreviousDivisionWithContents
)
543 throw std::runtime_error("recursion in page divisions");
544 m_bGettingPreviousDivisionWithContents
= true;
545 LwpDocument
* pRet
= nullptr;
547 if (GetPreviousDivision())
548 pRet
= GetPreviousDivision()->GetLastDivisionWithContents();
549 if (!pRet
&& GetParentDivision())
550 pRet
= GetParentDivision()->GetPreviousDivisionWithContents();
552 m_bGettingPreviousDivisionWithContents
= false;
557 * @descr Get last division which has contents, copy from lwp source code
559 LwpDocument
* LwpDocument::GetLastDivisionWithContents()
561 if (m_bGettingGetLastDivisionWithContents
)
562 throw std::runtime_error("recursion in page divisions");
563 m_bGettingGetLastDivisionWithContents
= true;
564 LwpDocument
* pRet
= nullptr;
566 LwpDivInfo
* pDivInfo
= dynamic_cast<LwpDivInfo
*>(GetDivInfoID().obj().get());
567 if (pDivInfo
&& pDivInfo
->HasContents())
572 LwpDocument
* pDivision
= GetLastDivision();
574 o3tl::sorted_vector
<LwpDocument
*> aSeen
;
575 while (pDivision
&& pDivision
!= this)
577 bool bAlreadySeen
= !aSeen
.insert(pDivision
).second
;
579 throw std::runtime_error("loop in conversion");
580 LwpDocument
* pContentDivision
= pDivision
->GetLastDivisionWithContents();
581 if (pContentDivision
)
583 pRet
= pContentDivision
;
586 pDivision
= pDivision
->GetPreviousDivision();
590 m_bGettingGetLastDivisionWithContents
= false;
594 * @descr Get last division in group which has contents, copy from lwp source code
596 LwpDocument
* LwpDocument::GetLastInGroupWithContents()
598 LwpDocument
* pLast
= nullptr;
599 LwpDocument
* pNext
= this;
603 LwpDivInfo
* pDivInfo
= dynamic_cast<LwpDivInfo
*>(pNext
->GetDivInfoID().obj().get());
604 if (pDivInfo
&& pDivInfo
->HasContents())
606 pNext
= pNext
->GetNextInGroup();
613 * @descr Get last division
615 LwpDocument
* LwpDocument::GetLastDivision()
617 LwpDocSock
* pDocSock
= dynamic_cast<LwpDocSock
*>(GetSocket().obj().get());
619 return dynamic_cast<LwpDocument
*>(pDocSock
->GetChildTail().obj().get());
624 * @descr Get first division
626 LwpDocument
* LwpDocument::GetFirstDivision()
628 LwpDocSock
* pDocSock
= dynamic_cast<LwpDocSock
*>(GetSocket().obj().get());
630 return dynamic_cast<LwpDocument
*>(pDocSock
->GetChildHead().obj().get());
635 * @descr Get root document
637 LwpDocument
* LwpDocument::GetRootDocument()
639 LwpDocument
* pRoot
= this;
640 o3tl::sorted_vector
<LwpDocument
*> aSeen
;
643 bool bAlreadySeen
= !aSeen
.insert(pRoot
).second
;
645 throw std::runtime_error("loop in conversion");
646 if (!pRoot
->IsChildDoc())
648 pRoot
= pRoot
->GetParentDivision();
653 * @descr Get first division with contents that is not ole, copy from lwp-source code
655 LwpDocument
* LwpDocument::ImplGetFirstDivisionWithContentsThatIsNotOLE()
657 LwpDivInfo
* pDivInfo
= dynamic_cast<LwpDivInfo
*>(GetDivInfoID().obj().get());
658 if (pDivInfo
&& pDivInfo
->HasContents() && !pDivInfo
->IsOleDivision())
661 LwpDocument
* pDivision
= GetFirstDivision();
662 o3tl::sorted_vector
<LwpDocument
*> aSeen
;
665 bool bAlreadySeen
= !aSeen
.insert(pDivision
).second
;
667 throw std::runtime_error("loop in conversion");
668 LwpDocument
* pContentDivision
= pDivision
->GetFirstDivisionWithContentsThatIsNotOLE();
669 if (pContentDivision
)
670 return pContentDivision
;
671 pDivision
= pDivision
->GetNextDivision();
676 * @descr Get last division that has endnote
678 LwpDocument
* LwpDocument::GetLastDivisionThatHasEndnote()
680 LwpDocument
* pRoot
= GetRootDocument();
681 LwpDocument
* pLastDoc
= pRoot
? pRoot
->GetLastDivisionWithContents() : nullptr;
682 o3tl::sorted_vector
<LwpDocument
*> aSeen
;
685 bool bAlreadySeen
= !aSeen
.insert(pLastDoc
).second
;
687 throw std::runtime_error("loop in conversion");
688 if (pLastDoc
->GetEnSuperTableLayout().is())
690 pLastDoc
= pLastDoc
->GetPreviousDivisionWithContents();
695 * @descr Get endnote supertable layout, every division has only one endnote supertable layout.
697 rtl::Reference
<LwpVirtualLayout
> LwpDocument::GetEnSuperTableLayout()
699 LwpHeadLayout
* pHeadLayout
700 = dynamic_cast<LwpHeadLayout
*>(GetFoundry()->GetLayout().obj().get());
703 return pHeadLayout
->FindEnSuperTableLayout();
705 return rtl::Reference
<LwpVirtualLayout
>();
709 * @descr Get the numbers of page before pEndDivision, copy from lwp source code
711 bool LwpDocument::GetNumberOfPages(LwpDocument
* pEndDivision
, sal_uInt16
& nCount
)
713 if (this == pEndDivision
)
716 LwpDivInfo
* pDivInfo
= dynamic_cast<LwpDivInfo
*>(m_DivInfo
.obj().get());
719 pDivInfo
->GetNumberOfPages(nCount
);
722 LwpDocument
* pDivision
= GetFirstDivision();
725 if (pDivision
->GetNumberOfPages(pEndDivision
, nCount
))
727 pDivision
= pDivision
->GetNextDivision();
732 * @descr Get the numbers of page before current division
734 sal_uInt16
LwpDocument::GetNumberOfPagesBefore()
736 sal_uInt16 nPageNumber
= 0;
737 LwpDocument
* pRoot
= GetRootDocument();
739 pRoot
->GetNumberOfPages(this, nPageNumber
);
744 * @descr Parse the frame which anchor is to page before parse other contents,
745 * This method is called when the document is root document.
747 void LwpDocument::ParseFrameInPage(IXFStream
* pOutputStream
)
752 rtl::Reference
<XFContentContainer
> xXFContainer(new XFContentContainer
);
753 XFConvertFrameInPage(xXFContainer
.get());
754 xXFContainer
->ToXml(pOutputStream
);
758 * @descr Parse the frame which anchor is to page in the entire document
760 void LwpDocument::XFConvertFrameInPage(XFContentContainer
* pCont
)
762 LwpDocument
* pDivision
= GetFirstDivision();
764 LwpDivInfo
* pDivInfo
= dynamic_cast<LwpDivInfo
*>(GetDivInfoID().obj().get());
767 LwpPageLayout
* pPageLayout
768 = dynamic_cast<LwpPageLayout
*>(pDivInfo
->GetInitialLayoutID().obj().get());
771 LwpStory
* pStory
= dynamic_cast<LwpStory
*>(pPageLayout
->GetContent().obj().get());
773 pStory
->XFConvertFrameInPage(pCont
);
778 pDivision
->XFConvertFrameInPage(pCont
);
779 pDivision
= pDivision
->GetNextDivision();
783 * @descr change click here to placeholder
785 void LwpDocument::ChangeStyleName()
787 XFStyleManager
* pXFStyleManager
= LwpGlobalMgr::GetInstance()->GetXFStyleManager();
788 XFTextStyle
* pStyle
= dynamic_cast<XFTextStyle
*>(pXFStyleManager
->FindStyle(u
"ClickHere"));
791 pStyle
->SetStyleName(u
"Placeholder"_ustr
);
794 LwpDocSock::LwpDocSock(LwpObjectHeader
const& objHdr
, LwpSvStream
* pStrm
)
795 : LwpDLNFVList(objHdr
, pStrm
)
800 * @descr read VO_DOCSOCK from file
802 void LwpDocSock::Read()
804 LwpDLNFVList::Read();
805 m_Doc
.ReadIndexed(m_pObjStrm
.get());
806 m_pObjStrm
->SkipExtra();
809 * @descr register styles in documents plugged
811 void LwpDocSock::RegisterStyle()
813 rtl::Reference
<LwpObject
> pDoc
= GetNext().obj();
815 pDoc
->DoRegisterStyle();
817 pDoc
= GetChildHead().obj();
819 pDoc
->DoRegisterStyle();
822 * @descr parse contents of documents plugged
824 void LwpDocSock::Parse(IXFStream
* pOutputStream
)
826 rtl::Reference
<LwpObject
> pDoc
= GetChildHead().obj();
828 pDoc
->DoParse(pOutputStream
);
830 pDoc
= GetNext().obj();
832 pDoc
->DoParse(pOutputStream
);
835 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */