merge the formfield patch from ooo-build
[ooovba.git] / lotuswordpro / source / filter / lwpdoc.cxx
blobf65fed5b65df91dcaef20f710688e42cbe6f2032
1 /*************************************************************************
3 * The Contents of this file are made available subject to the terms of
4 * either of the following licenses
6 * - GNU Lesser General Public License Version 2.1
7 * - Sun Industry Standards Source License Version 1.1
9 * Sun Microsystems Inc., October, 2000
11 * GNU Lesser General Public License Version 2.1
12 * =============================================
13 * Copyright 2000 by Sun Microsystems, Inc.
14 * 901 San Antonio Road, Palo Alto, CA 94303, USA
16 * This library is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU Lesser General Public
18 * License version 2.1, as published by the Free Software Foundation.
20 * This library is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 * Lesser General Public License for more details.
25 * You should have received a copy of the GNU Lesser General Public
26 * License along with this library; if not, write to the Free Software
27 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
28 * MA 02111-1307 USA
31 * Sun Industry Standards Source License Version 1.1
32 * =================================================
33 * The contents of this file are subject to the Sun Industry Standards
34 * Source License Version 1.1 (the "License"); You may not use this file
35 * except in compliance with the License. You may obtain a copy of the
36 * License at http://www.openoffice.org/license.html.
38 * Software provided under this License is provided on an "AS IS" basis,
39 * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
40 * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
41 * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
42 * See the License for the specific provisions governing your rights and
43 * obligations concerning the Software.
45 * The Initial Developer of the Original Code is: IBM Corporation
47 * Copyright: 2008 by IBM Corporation
49 * All Rights Reserved.
51 * Contributor(s): _______________________________________
54 ************************************************************************/
55 #include "lwpglobalmgr.hxx"
56 #include "lwpdoc.hxx"
57 #include "lwpfootnote.hxx"
58 #include "lwppagehint.hxx"
59 #include "lwpdivinfo.hxx"
60 #include "lwpholder.hxx"
61 #include "lwpparastyle.hxx"
62 #include "lwpstory.hxx"
63 #include "lwppara.hxx"
64 #include "lwpsilverbullet.hxx"
65 #include "lwplayout.hxx"
66 #include "lwppagelayout.hxx"
67 #include "xfilter/xfstylemanager.hxx"
68 #ifndef _OSL_THREAD_H_
69 #include <osl/thread.h>
70 #endif
72 LwpDocument::LwpDocument(LwpObjectHeader& objHdr, LwpSvStream* pStrm)
73 : LwpDLNFPVList(objHdr, pStrm), m_pLnOpts(NULL)
76 LwpDocument::~LwpDocument()
78 if(m_pLnOpts)
80 delete m_pLnOpts;
82 if(m_pFoundry)
84 delete m_pFoundry;
87 /**
88 * @descr Read VO_Document from object stream
89 **/
90 void LwpDocument::Read()
92 LwpDLNFPVList::Read();
94 ReadPlug();
96 m_pObjStrm->QuickRead(&m_nPersistentFlags, sizeof(m_nPersistentFlags));
98 //Skip the SortOption and UIDocument
100 LwpSortOption m_DocSort( m_pObjStrm );
101 LwpUIDocument m_UIDoc( m_pObjStrm );
104 m_pLnOpts = new LwpLineNumberOptions(m_pObjStrm);
106 //Skip LwpUserDictFiles
108 LwpUserDictFiles m_UsrDicts( m_pObjStrm );
111 if( !IsChildDoc())
113 //Skip LwpPrinterInfo
114 LwpPrinterInfo m_PrtInfo( m_pObjStrm );
117 m_pFoundry = new LwpFoundry(m_pObjStrm, this);
119 m_DivOpts.ReadIndexed(m_pObjStrm);
121 if(!IsChildDoc())
123 m_FootnoteOpts.ReadIndexed(m_pObjStrm);
124 m_DocData.ReadIndexed(m_pObjStrm);
126 else
128 //Skip the docdata used in old version
129 LwpObjectID dummyDocData;
130 dummyDocData.ReadIndexed(m_pObjStrm);
132 m_DivInfo.ReadIndexed(m_pObjStrm);
133 m_Epoch.Read(m_pObjStrm);
134 m_WYSIWYGPageHints.ReadIndexed(m_pObjStrm);
135 m_VerDoc.ReadIndexed(m_pObjStrm);
136 m_STXInfo.ReadIndexed(m_pObjStrm);
140 * @descr Read plug related data from m_pObjStram
142 void LwpDocument::ReadPlug()
144 m_DocSockID.ReadIndexed(m_pObjStrm);
145 m_pObjStrm->QuickRead(&m_nFlags, sizeof(m_nFlags));
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 LwpObject* pDocSock = GetSocket()->obj( VO_DOCSOCK );
163 if(pDocSock!=NULL)
165 pDocSock->Parse(pOutputStream);
169 sal_Bool LwpDocument::IsSkippedDivision()
171 OUString sDivName;
172 sal_uInt8 ret = sal_False;
173 LwpDivInfo* pDiv = static_cast<LwpDivInfo*>(GetDivInfoID()->obj(VO_DIVISIONINFO));
174 if (pDiv == NULL)
175 return sal_True;
176 sDivName = pDiv->GetDivName();
177 if (sDivName.getLength()>0 && !pDiv->IsGotoable())//including toa,scripts division
178 return sal_True;
179 //skip endnote division
180 OUString strClassName = pDiv->GetClassName();
181 if (strClassName.equals(A2OUSTR(STR_DivisionEndnote))
182 || strClassName.equals(A2OUSTR(STR_DivisionGroupEndnote))
183 || strClassName.equals(A2OUSTR(STR_DocumentEndnote)))
185 LwpPageLayout* pPageLayout =static_cast<LwpPageLayout*>(pDiv->GetInitialLayoutID()->obj(VO_PAGELAYOUT));
186 if(pPageLayout)
188 LwpStory* pStory = static_cast<LwpStory*>(pPageLayout->GetContent()->obj(VO_STORY));
189 if(pStory)
191 //This judgement maybe have problem. If there is only one para in the story,
192 //this endnote division has no other contents except endnote table.
193 LwpObjectID* pFirst = pStory->GetFirstPara();
194 LwpObjectID* pLast = pStory->GetLastPara();
195 if(*pFirst == *pLast)
196 ret = sal_True;
200 return ret;
204 * @descr Register all styles in this division
206 void LwpDocument::RegisterStyle()
208 RegisterDefaultParaStyles();
209 RegisterGraphicsStyles();
210 RegisterBulletStyles();
212 RegisterTextStyles();
213 RegisterLayoutStyles();
214 RegisterStylesInPara();
216 RegisterLinenumberStyles();
217 RegisterFootnoteStyles();
219 //Register styles in other document connected with this document: next doc, children doc
220 LwpObject* pDocSock = GetSocket()->obj();
221 if(pDocSock!=NULL)
223 pDocSock->RegisterStyle();
227 * @descr Register all named para styles
229 void LwpDocument::RegisterTextStyles()
231 //Register all text styles: para styles, character styles
232 LwpDLVListHeadHolder* pParaStyleHolder = static_cast<LwpDLVListHeadHolder*>(m_pFoundry->GetTextStyleHead()->obj());
233 if(pParaStyleHolder)
235 LwpTextStyle* pParaStyle = static_cast<LwpTextStyle*> (pParaStyleHolder->GetHeadID()->obj());
236 while(pParaStyle)
238 pParaStyle->SetFoundry(m_pFoundry);
239 pParaStyle->RegisterStyle();
240 pParaStyle = static_cast<LwpParaStyle*>(pParaStyle->GetNext()->obj());
243 ChangeStyleName();//add by ,for click here block,05/5/26
246 * @descr Register all layouts styles (page master and master page)
247 * All para styles used in master page (header and footer) are registered and then showed
249 void LwpDocument::RegisterLayoutStyles()
251 //Register all layout styles, before register all styles in para
252 m_pFoundry->RegisterAllLayouts();
254 //set initial pagelayout in story for parsing pagelayout
255 LwpDivInfo* pDivInfo = static_cast<LwpDivInfo*> (m_DivInfo.obj( VO_DIVISIONINFO));
256 LwpPageLayout* pPageLayout = NULL;
257 if(pDivInfo)
259 pPageLayout =static_cast<LwpPageLayout*>(pDivInfo->GetInitialLayoutID()->obj(VO_PAGELAYOUT));
260 if(pPageLayout)
262 //In Ole division, the content of pagelayout is VO_OLEOBJECT
263 LwpStory* pStory = static_cast<LwpStory*>(pPageLayout->GetContent()->obj(VO_STORY));
264 if(pStory)
266 //add all the pagelayout in order into the pagelayout list;
267 pStory->SortPageLayout();
268 pStory->SetCurrentLayout(pPageLayout);
274 * @descr Register all styles used in para
276 void LwpDocument::RegisterStylesInPara()
278 //Register all automatic styles in para
279 LwpHeadContent* pContent = static_cast<LwpHeadContent*> (m_pFoundry->GetContentManager()->GetContentList()->obj());
280 if(pContent)
282 LwpStory* pStory = static_cast<LwpStory*>(pContent->GetChildHead()->obj(VO_STORY));
283 while(pStory)
285 //Register the child para
286 pStory->SetFoundry(m_pFoundry);
287 pStory->RegisterStyle();
288 pStory = static_cast<LwpStory*>(pStory->GetNext()->obj(VO_STORY));
293 * @descr Register all bullet styles used in this division
295 void LwpDocument::RegisterBulletStyles()
297 //Register bullet styles
298 LwpDLVListHeadHolder* mBulletHead = static_cast<LwpDLVListHeadHolder*>
299 (m_pFoundry->GetBulletManagerID()->obj(VO_HEADHOLDER));
300 if( mBulletHead )
302 LwpSilverBullet* pBullet = static_cast<LwpSilverBullet*>
303 (mBulletHead->GetHeadID()->obj());
304 while(pBullet)
306 pBullet->SetFoundry(m_pFoundry);
307 pBullet->RegisterStyle();
308 pBullet = static_cast<LwpSilverBullet*> (pBullet->GetNext()->obj());
313 * @descr Register all styles used in VO_Graphic
315 void LwpDocument::RegisterGraphicsStyles()
317 //Register all graphics styles, the first object should register the next;
318 LwpObject* pGraphic = m_pFoundry->GetGraphicListHead()->obj(VO_GRAPHIC);
319 if(pGraphic)
321 pGraphic->SetFoundry(m_pFoundry);
322 pGraphic->RegisterStyle();
326 * @descr Register line number styles
328 void LwpDocument::RegisterLinenumberStyles()
330 if (!m_pLnOpts)
331 return;
332 m_pLnOpts->RegisterStyle();
336 * @descr Register footnote/endnote configuration for the entire document
338 void LwpDocument::RegisterFootnoteStyles()
340 //Register footnote and endnote configuration for the entire document
341 if(!m_FootnoteOpts.IsNull())
343 LwpFootnoteOptions* pFootnoteOpts = static_cast<LwpFootnoteOptions*>(m_FootnoteOpts.obj());
344 if (pFootnoteOpts)
346 pFootnoteOpts->SetMasterPage(A2OUSTR("Endnote"));
347 pFootnoteOpts->RegisterStyle();
350 //Register endnote page style for endnote configuration, use the last division that has endnote for the endnote page style
351 //This page style must register after its division default styles have registered
352 LwpDocument* pEndnoteDiv = GetLastDivisionThatHasEndnote();
353 if(this == pEndnoteDiv)
355 LwpDLVListHeadTailHolder* pHeadTail = static_cast<LwpDLVListHeadTailHolder*>(GetPageHintsID()->obj());
356 if(pHeadTail)
358 LwpPageHint* pPageHint =static_cast<LwpPageHint*>(pHeadTail->GetTail()->obj());
359 if(pPageHint && !pPageHint->GetPageLayoutID()->IsNull())
361 LwpPageLayout* pPageLayout = static_cast<LwpPageLayout*>(pPageHint->GetPageLayoutID()->obj());
362 if(pPageLayout)
364 pPageLayout->SetFoundry(GetFoundry());
365 pPageLayout->RegisterEndnoteStyle();
373 * @descr Register default para styles
375 #include "lwpverdocument.hxx"
376 void LwpDocument::RegisterDefaultParaStyles()
378 if(!IsChildDoc())
380 //Get First Division
381 //LwpDocument* pFirstDoc = GetFirstDivision();
382 LwpDocument* pFirstDoc = GetFirstDivisionWithContentsThatIsNotOLE();
383 if(pFirstDoc)
385 LwpVerDocument* pVerDoc = static_cast<LwpVerDocument*>(pFirstDoc->GetVerDoc()->obj());
386 if(pVerDoc)
388 pVerDoc->RegisterStyle();
396 * @descr Parse content in this division to IXFStream
397 * LwpDocument->LwpDivInfo->LwpPageLayout.Parse()
399 void LwpDocument::ParseDocContent(IXFStream* pOutputStream)
401 //Parse content in PageLayout
402 LwpDivInfo* pDivInfo = static_cast<LwpDivInfo*> (m_DivInfo.obj());
403 if(pDivInfo==NULL) return;
405 LwpObject* pLayoutObj = pDivInfo->GetInitialLayoutID()->obj();
406 if(pLayoutObj==NULL)
408 //Cause crash when parsing master document, master document not supported now.
409 //ParseMasterDoc(pOutputStream);
410 return;
412 pLayoutObj->SetFoundry(m_pFoundry);
413 pLayoutObj->Parse(pOutputStream);
416 * @descr Parse master doc in this division to IXFStream
419 void LwpDocument::ParseMasterDoc(IXFStream* pOutputStream)
421 LwpDivInfo* pDivInfo = static_cast<LwpDivInfo*> (m_DivInfo.obj());
422 if(pDivInfo==NULL) return;
423 LwpAtomHolder* pExternal = pDivInfo->GetExternalName();
424 if(pExternal && pExternal->HasValue())
426 OUString linkedfilepath = pExternal->str();
427 OUString fileURL = LwpTools::convertToFileUrl(OUStringToOString(linkedfilepath, osl_getThreadTextEncoding()));
428 XFSection* pSection = new XFSection();
429 pSection->SetSourceLink( fileURL);
430 pSection->ToXml(pOutputStream);
431 delete pSection;
435 * @descr Get the footnoteoptions from the root document
437 LwpObjectID* LwpDocument::GetValidFootnoteOpts()
439 LwpDocument* pRoot = GetRootDocument();
440 if(pRoot)
442 return pRoot->GetFootnoteOpts();
444 return NULL;
448 * @descr Get the endnote type
450 sal_uInt16 LwpDocument::GetEndnoteType()
452 LwpDivInfo* pDivInfo =static_cast<LwpDivInfo*>(GetDivInfoID()->obj());
453 if (!pDivInfo)
454 return FN_DONTCARE;
455 OUString strClassName = pDivInfo->GetClassName();
456 if (strClassName.equals(A2OUSTR(STR_DivisionEndnote)))
457 return FN_DIVISION_SEPARATE;
458 if (strClassName.equals(A2OUSTR(STR_DivisionGroupEndnote)))
459 return FN_DIVISIONGROUP_SEPARATE;
460 if (strClassName.equals(A2OUSTR(STR_DocumentEndnote)))
461 return FN_DOCUMENT_SEPARATE;
462 return FN_DONTCARE;
465 * @descr Get previous division
467 LwpDocument* LwpDocument::GetPreviousDivision()
469 LwpDocSock* pDocSock = static_cast<LwpDocSock*>(GetSocket()->obj());
470 if(pDocSock)
472 return static_cast<LwpDocument*>(pDocSock->GetPrevious()->obj());
474 return NULL;
477 * @descr Get next division
479 LwpDocument* LwpDocument::GetNextDivision()
481 LwpDocSock* pDocSock = static_cast<LwpDocSock*>(GetSocket()->obj());
482 if(pDocSock)
484 return static_cast<LwpDocument*>(pDocSock->GetNext()->obj());
486 return NULL;
489 * @descr Get parent division
491 LwpDocument* LwpDocument::GetParentDivision()
493 LwpDocSock* pDocSock = static_cast<LwpDocSock*>(GetSocket()->obj());
494 if(pDocSock)
496 return static_cast<LwpDocument*>(pDocSock->GetParent()->obj());
498 return NULL;
501 * @descr Get previous division in group, copy from lwp source code
503 LwpDocument* LwpDocument::GetPreviousInGroup()
505 LwpDocument* pPrev = NULL;
507 for (pPrev = GetPreviousDivision(); pPrev; pPrev = pPrev->GetPreviousDivision())
509 LwpDivInfo* pDivInfo =static_cast<LwpDivInfo*>(pPrev->GetDivInfoID()->obj());
510 if(pDivInfo && pDivInfo->HasContents())
511 return pPrev;
513 return NULL;
516 * @descr Get previous division in group, copy from lwp source code
518 LwpDocument* LwpDocument::GetNextInGroup()
520 LwpDocument* pNext = NULL;
522 for (pNext = GetNextDivision(); pNext; pNext = pNext->GetNextDivision())
524 LwpDivInfo* pDivInfo =static_cast<LwpDivInfo*>(pNext->GetDivInfoID()->obj());
525 if(pDivInfo && pDivInfo->HasContents())
526 return pNext;
529 return NULL;
532 * @descr Get previous division which has contents, copy from lwp source code
534 LwpDocument* LwpDocument::GetPreviousDivisionWithContents()
536 if(GetPreviousDivision())
538 LwpDocument* pDoc = GetPreviousDivision()->GetLastDivisionWithContents();
539 if (pDoc)
540 return pDoc;
542 if(GetParentDivision())
543 return GetParentDivision()->GetPreviousDivisionWithContents();
544 return NULL;
547 * @descr Get last division which has contents, copy from lwp source code
549 LwpDocument* LwpDocument::GetLastDivisionWithContents()
551 LwpDivInfo* pDivInfo =static_cast<LwpDivInfo*>(GetDivInfoID()->obj());
552 if(pDivInfo && pDivInfo->HasContents())
554 return this;
557 LwpDocument* pDivision = GetLastDivision();
558 LwpDocument* pContentDivision = NULL;
560 while(pDivision)
562 pContentDivision = pDivision->GetLastDivisionWithContents();
563 if(pContentDivision)
565 return pContentDivision;
567 pDivision = pDivision->GetPreviousDivision();
570 return NULL;
573 * @descr Get last division in group which has contents, copy from lwp source code
575 LwpDocument* LwpDocument::GetLastInGroupWithContents()
577 LwpDocument* pLast = NULL;
578 LwpDocument* pNext = this;
580 while (pNext)
582 LwpDivInfo* pDivInfo =static_cast<LwpDivInfo*>(pNext->GetDivInfoID()->obj());
583 if (pDivInfo && pDivInfo->HasContents())
584 pLast = pNext;
585 pNext = pNext->GetNextInGroup();
587 if (pLast)
588 return pLast;
589 return NULL;
592 * @descr Get last division
594 LwpDocument* LwpDocument::GetLastDivision()
596 LwpDocSock* pDocSock = static_cast<LwpDocSock*>(GetSocket()->obj());
597 if(pDocSock)
598 return static_cast<LwpDocument*>(pDocSock->GetChildTail()->obj());
599 return NULL;
603 * @descr Get first division
605 LwpDocument* LwpDocument::GetFirstDivision()
607 LwpDocSock* pDocSock = static_cast<LwpDocSock*>(GetSocket()->obj());
608 if(pDocSock)
609 return static_cast<LwpDocument*>(pDocSock->GetChildHead()->obj());
610 return NULL;
614 * @descr Get root document
616 LwpDocument* LwpDocument::GetRootDocument()
618 LwpDocument* pRoot = this;
619 while(pRoot)
621 if(!pRoot->IsChildDoc())
622 return pRoot;
623 pRoot = pRoot->GetParentDivision();
625 return NULL;
628 * @descr Get first division with contents that is not ole, copy from lwp-source code
630 LwpDocument* LwpDocument::GetFirstDivisionWithContentsThatIsNotOLE()
632 LwpDivInfo* pDivInfo =static_cast<LwpDivInfo*>(GetDivInfoID()->obj());
633 if(pDivInfo && pDivInfo->HasContents()
634 && !pDivInfo->IsOleDivision())
635 return this;
637 LwpDocument* pDivision = GetFirstDivision();
639 LwpDocument* pContentDivision = NULL;
641 while (pDivision)
643 pContentDivision = pDivision->GetFirstDivisionWithContentsThatIsNotOLE();
644 if(pContentDivision)
645 return pContentDivision;
646 pDivision = pDivision->GetNextDivision();
648 return NULL;
651 * @descr Get last division that has endnote
653 LwpDocument* LwpDocument::GetLastDivisionThatHasEndnote()
655 LwpDocument* pRoot = GetRootDocument();
656 LwpDocument *pLastDoc = pRoot->GetLastDivisionWithContents();
657 while(pLastDoc)
659 if(pLastDoc->GetEnSuperTableLayout())
660 return pLastDoc;
661 pLastDoc = pLastDoc->GetPreviousDivisionWithContents();
663 return NULL;
667 * @descr Get endnote supertable layout, every division has only one endnote supertable layout.
669 LwpVirtualLayout* LwpDocument::GetEnSuperTableLayout()
671 LwpHeadLayout* pHeadLayout =static_cast<LwpHeadLayout*>(GetFoundry()->GetLayout()->obj());
672 if(pHeadLayout)
674 return pHeadLayout->FindEnSuperTableLayout();
676 return NULL;
680 * @descr Get the numbers of page before pEndDivision, copy from lwp source code
682 sal_Bool LwpDocument::GetNumberOfPages(LwpDocument* pEndDivision, sal_uInt16& nCount)
684 if(this == pEndDivision)
685 return sal_True;
687 LwpDivInfo* pDivInfo = static_cast<LwpDivInfo*>(m_DivInfo.obj());
688 if(pDivInfo)
690 pDivInfo->GetNumberOfPages(nCount);
693 LwpDocument* pDivision = GetFirstDivision();
694 while(pDivision)
696 if(pDivision->GetNumberOfPages(pEndDivision,nCount))
697 return sal_True;
698 pDivision = pDivision->GetNextDivision();
701 return sal_False;
704 * @descr Get the numbers of page before curruent division
706 sal_uInt16 LwpDocument::GetNumberOfPagesBefore()
708 sal_uInt16 nPageNumber = 0;
709 LwpDocument* pRoot = GetRootDocument();
710 if(pRoot)
711 pRoot->GetNumberOfPages(this,nPageNumber);
712 return nPageNumber;
715 * @descr Get the numbers of page before this division
717 sal_uInt16 LwpDocument::GetMaxNumberOfPages()
719 sal_uInt16 nPageNumber = 0;
720 MaxNumberOfPages(nPageNumber);
721 return nPageNumber;
724 * @descr Get Max number of pages
726 void LwpDocument::MaxNumberOfPages(sal_uInt16& nNumPages)
728 LwpDocument* pDivision = GetFirstDivision();
730 LwpDivInfo* pDivInfo = static_cast<LwpDivInfo*>(m_DivInfo.obj());
731 if(pDivInfo)
732 nNumPages += pDivInfo->GetMaxNumberOfPages();
733 while(pDivision)
735 pDivision->MaxNumberOfPages(nNumPages);
736 pDivision = pDivision->GetNextDivision();
740 * @descr Parse the frame which anchor is to page before parse other contents,
741 * This method is called when the document is root document.
743 void LwpDocument::ParseFrameInPage(IXFStream * pOutputStream)
745 if(IsChildDoc())
746 return;
748 XFContentContainer* pXFContainer = new XFContentContainer;
750 XFConvertFrameInPage(pXFContainer);
752 pXFContainer->ToXml(pOutputStream);
753 delete pXFContainer;
754 pXFContainer = NULL;
757 * @descr Parse the frame which anchor is to page in the entire document
759 void LwpDocument::XFConvertFrameInPage(XFContentContainer * pCont)
761 LwpDocument* pDivision = GetFirstDivision();
763 LwpDivInfo* pDivInfo = static_cast<LwpDivInfo*> (GetDivInfoID()->obj());
764 if(pDivInfo)
766 LwpPageLayout* pPageLayout =static_cast<LwpPageLayout*>(pDivInfo->GetInitialLayoutID()->obj());
767 if(pPageLayout)
769 LwpStory* pStory = static_cast<LwpStory*>(pPageLayout->GetContent()->obj());
770 if(pStory)
771 pStory->XFConvertFrameInPage(pCont);
774 while(pDivision)
776 pDivision->XFConvertFrameInPage(pCont);
777 pDivision = pDivision->GetNextDivision();
781 * @descr change click here to placeholder
783 void LwpDocument::ChangeStyleName()
785 XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
786 XFTextStyle* pStyle = static_cast<XFTextStyle*>(pXFStyleManager->FindStyle(A2OUSTR("ClickHere")));
787 if (pStyle)
789 pStyle->SetStyleName(A2OUSTR("Placeholder"));
792 LwpDocSock::LwpDocSock(LwpObjectHeader& objHdr, LwpSvStream* pStrm)
793 :LwpDLNFVList(objHdr, pStrm)
797 * @descr read VO_DOCSOCK from file
799 void LwpDocSock::Read()
801 LwpDLNFVList::Read();
802 m_Doc.ReadIndexed(m_pObjStrm);
803 m_pObjStrm->SkipExtra();
806 * @descr register styles in documents plugged
808 void LwpDocSock::RegisterStyle()
810 LwpObject* pDoc = GetNext()->obj();
811 if(pDoc)
812 pDoc->RegisterStyle();
814 pDoc = GetChildHead()->obj();
815 if(pDoc)
816 pDoc->RegisterStyle();
819 * @descr parse contents of documents plugged
821 void LwpDocSock::Parse(IXFStream* pOutputStream)
823 LwpObject* pDoc = GetChildHead()->obj();
824 if(pDoc)
825 pDoc->Parse(pOutputStream);
827 pDoc = GetNext()->obj();
828 if(pDoc)
829 pDoc->Parse(pOutputStream);