LibreOffice Module sw (master)  1
docglbl.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #include <osl/diagnose.h>
21 #include <unotools/tempfile.hxx>
22 #include <svl/stritem.hxx>
23 #include <svl/eitem.hxx>
24 #include <sfx2/docfile.hxx>
25 #include <sfx2/docfilt.hxx>
26 #include <sfx2/fcontnr.hxx>
27 #include <sfx2/bindings.hxx>
28 #include <sfx2/request.hxx>
29 #include <sfx2/sfxsids.hrc>
30 #include <sfx2/viewfrm.hxx>
31 #include <tools/datetime.hxx>
32 #include <fmtinfmt.hxx>
33 #include <fmtanchr.hxx>
34 #include <doc.hxx>
35 #include <IDocumentUndoRedo.hxx>
40 #include <docary.hxx>
41 #include <pam.hxx>
42 #include <ndtxt.hxx>
43 #include <docsh.hxx>
44 #include <section.hxx>
45 #include <calbck.hxx>
46 #include <iodetect.hxx>
47 #include <frameformats.hxx>
48 #include <memory>
49 #include <com/sun/star/uno/Reference.h>
50 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
51 #include <com/sun/star/document/XDocumentProperties.hpp>
52 #include <com/sun/star/frame/XModel.hpp>
53 
54 using namespace ::com::sun::star;
55 
56 namespace {
57 
59 {
60  SPLITDOC_TO_GLOBALDOC,
61  SPLITDOC_TO_HTML
62 };
63 
64 }
65 
66 bool SwDoc::GenerateGlobalDoc( const OUString& rPath,
67  const SwTextFormatColl* pSplitColl )
68 {
69  return SplitDoc( SPLITDOC_TO_GLOBALDOC, rPath, false, pSplitColl );
70 }
71 
72 bool SwDoc::GenerateGlobalDoc( const OUString& rPath, int nOutlineLevel )
73 {
74  return SplitDoc( SPLITDOC_TO_GLOBALDOC, rPath, true, nullptr, nOutlineLevel );
75 }
76 
77 bool SwDoc::GenerateHTMLDoc( const OUString& rPath, int nOutlineLevel )
78 {
79  return SplitDoc( SPLITDOC_TO_HTML, rPath, true, nullptr, nOutlineLevel );
80 }
81 
82 bool SwDoc::GenerateHTMLDoc( const OUString& rPath,
83  const SwTextFormatColl* pSplitColl )
84 {
85  return SplitDoc( SPLITDOC_TO_HTML, rPath, false, pSplitColl );
86 }
87 
88 // two helpers for outline mode
89 static SwNodePtr GetStartNode( SwOutlineNodes const * pOutlNds, int nOutlineLevel, SwOutlineNodes::size_type* nOutl )
90 {
91  for( ; *nOutl < pOutlNds->size(); ++(*nOutl) )
92  {
93  SwNodePtr pNd = (*pOutlNds)[ *nOutl ];
94  if( pNd->GetTextNode()->GetAttrOutlineLevel() == nOutlineLevel && !pNd->FindTableNode() )
95  {
96  return pNd;
97  }
98  }
99 
100  return nullptr;
101 }
102 
103 static SwNodePtr GetEndNode( SwOutlineNodes const * pOutlNds, int nOutlineLevel, SwOutlineNodes::size_type* nOutl )
104 {
105  SwNodePtr pNd;
106 
107  for( ++(*nOutl); (*nOutl) < pOutlNds->size(); ++(*nOutl) )
108  {
109  pNd = (*pOutlNds)[ *nOutl ];
110 
111  const int nLevel = pNd->GetTextNode()->GetAttrOutlineLevel();
112 
113  if( ( 0 < nLevel && nLevel <= nOutlineLevel ) &&
114  !pNd->FindTableNode() )
115  {
116  return pNd;
117  }
118  }
119  return nullptr;
120 }
121 
122 // two helpers for collection mode
123 static SwNodePtr GetStartNode( const SwOutlineNodes* pOutlNds, const SwTextFormatColl* pSplitColl, SwOutlineNodes::size_type* nOutl )
124 {
125  for( ; *nOutl < pOutlNds->size(); ++(*nOutl) )
126  {
127  SwNodePtr pNd = (*pOutlNds)[ *nOutl ];
128  if( pNd->GetTextNode()->GetTextColl() == pSplitColl &&
129  !pNd->FindTableNode() )
130  {
131  return pNd;
132  }
133  }
134  return nullptr;
135 }
136 
137 static SwNodePtr GetEndNode( const SwOutlineNodes* pOutlNds, const SwTextFormatColl* pSplitColl, SwOutlineNodes::size_type* nOutl )
138 {
139  SwNodePtr pNd;
140 
141  for( ++(*nOutl); *nOutl < pOutlNds->size(); ++(*nOutl) )
142  {
143  pNd = (*pOutlNds)[ *nOutl ];
144  SwTextFormatColl* pTColl = pNd->GetTextNode()->GetTextColl();
145 
146  if( ( pTColl == pSplitColl ||
147  ( pSplitColl->GetAttrOutlineLevel() > 0 &&
148  pTColl->GetAttrOutlineLevel() > 0 &&
149  pTColl->GetAttrOutlineLevel() <
150  pSplitColl->GetAttrOutlineLevel() )) &&
151  !pNd->FindTableNode() )
152  {
153  return pNd;
154  }
155  }
156  return nullptr;
157 }
158 
159 bool SwDoc::SplitDoc( sal_uInt16 eDocType, const OUString& rPath, bool bOutline, const SwTextFormatColl* pSplitColl, int nOutlineLevel )
160 {
161  // Iterate over all the template's Nodes, creating an own
162  // document for every single one and replace linked sections (GlobalDoc) for links (HTML).
163  // Finally, we save this document as a GlobalDoc/HTMLDoc.
164  if( !mpDocShell || !mpDocShell->GetMedium() ||
165  ( SPLITDOC_TO_GLOBALDOC == eDocType && GetDocumentSettingManager().get(DocumentSettingId::GLOBAL_DOCUMENT) ) )
166  return false;
167 
168  SwOutlineNodes::size_type nOutl = 0;
169  SwOutlineNodes* pOutlNds = const_cast<SwOutlineNodes*>(&GetNodes().GetOutLineNds());
170  std::unique_ptr<SwOutlineNodes> xTmpOutlNds;
171  SwNodePtr pStartNd;
172 
173  if ( !bOutline) {
174  if( pSplitColl )
175  {
176  // If it isn't an OutlineNumbering, then use an own array and collect the Nodes.
177  if( pSplitColl->GetAttrOutlineLevel() == 0 )
178  {
179  xTmpOutlNds.reset(new SwOutlineNodes);
180  pOutlNds = xTmpOutlNds.get();
181  SwIterator<SwTextNode,SwFormatColl> aIter( *pSplitColl );
182  for( SwTextNode* pTNd = aIter.First(); pTNd; pTNd = aIter.Next() )
183  if( pTNd->GetNodes().IsDocNodes() )
184  pOutlNds->insert( pTNd );
185 
186  if( pOutlNds->empty() )
187  return false;
188  }
189  }
190  else
191  {
192  // Look for the 1st level OutlineTemplate
193  const SwTextFormatColls& rFormatColls =*GetTextFormatColls();
194  for( SwTextFormatColls::size_type n = rFormatColls.size(); n; )
195  if ( rFormatColls[ --n ]->GetAttrOutlineLevel() == 1 )
196  {
197  pSplitColl = rFormatColls[ n ];
198  break;
199  }
200 
201  if( !pSplitColl )
202  return false;
203  }
204  }
205 
206  std::shared_ptr<const SfxFilter> pFilter;
207  switch( eDocType )
208  {
209  case SPLITDOC_TO_HTML:
210  pFilter = SwIoSystem::GetFilterOfFormat("HTML");
211  break;
212 
213  default:
215  eDocType = SPLITDOC_TO_GLOBALDOC;
216  break;
217  }
218 
219  if( !pFilter )
220  return false;
221 
222  // Deactivate Undo/Redline in any case
223  GetIDocumentUndoRedo().DoUndo(false);
225 
226  OUString sExt = pFilter->GetSuffixes().getToken(0, ',');
227  if( sExt.isEmpty() )
228  {
229  sExt = ".sxw";
230  }
231  else
232  {
233  if( '.' != sExt[ 0 ] )
234  {
235  sExt = "." + sExt;
236  }
237  }
238 
239  INetURLObject aEntry(rPath);
240  OUString sLeading(aEntry.GetBase());
241  aEntry.removeSegment();
242  OUString sPath = aEntry.GetMainURL( INetURLObject::DecodeMechanism::NONE );
243  utl::TempFile aTemp(sLeading, true, &sExt, &sPath);
244  aTemp.EnableKillingFile();
245 
246  DateTime aTmplDate( DateTime::SYSTEM );
247  {
248  tools::Time a2Min( 0 ); a2Min.SetMin( 2 );
249  aTmplDate += a2Min;
250  }
251 
252  // Skip all invalid ones
253  while( nOutl < pOutlNds->size() &&
254  (*pOutlNds)[ nOutl ]->GetIndex() < GetNodes().GetEndOfExtras().GetIndex() )
255  ++nOutl;
256 
257  do {
258  if( bOutline )
259  pStartNd = GetStartNode( pOutlNds, nOutlineLevel, &nOutl );
260  else
261  pStartNd = GetStartNode( pOutlNds, pSplitColl, &nOutl );
262 
263  if( pStartNd )
264  {
265  SwNodePtr pEndNd;
266  if( bOutline )
267  pEndNd = GetEndNode( pOutlNds, nOutlineLevel, &nOutl );
268  else
269  pEndNd = GetEndNode( pOutlNds, pSplitColl, &nOutl );
270  SwNodeIndex aEndIdx( pEndNd ? *pEndNd
271  : GetNodes().GetEndOfContent() );
272 
273  // Write out the Nodes completely
274  OUString sFileName;
275  if( pStartNd->GetIndex() + 1 < aEndIdx.GetIndex() )
276  {
277  SfxObjectShellLock xDocSh( new SwDocShell( SfxObjectCreateMode::INTERNAL ));
278  if( xDocSh->DoInitNew() )
279  {
280  SwDoc* pDoc = static_cast<SwDocShell*>(&xDocSh)->GetDoc();
281 
282  uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
283  static_cast<SwDocShell*>(&xDocSh)->GetModel(),
284  uno::UNO_QUERY_THROW);
285  uno::Reference<document::XDocumentProperties> xDocProps(
286  xDPS->getDocumentProperties());
287  OSL_ENSURE(xDocProps.is(), "Doc has no DocumentProperties");
288  // the GlobalDoc is the template
289  xDocProps->setTemplateName(OUString());
290  ::util::DateTime uDT = aTmplDate.GetUNODateTime();
291  xDocProps->setTemplateDate(uDT);
292  xDocProps->setTemplateURL(rPath);
293  // Set the new doc's title to the text of the "split para".
294  // If the current doc has a title, insert it at the begin.
295  OUString sTitle( xDocProps->getTitle() );
296  if (!sTitle.isEmpty())
297  sTitle += ": ";
298  sTitle += pStartNd->GetTextNode()->GetExpandText(nullptr);
299  xDocProps->setTitle( sTitle );
300 
301  // Replace template
302  pDoc->ReplaceStyles( *this );
303 
304  // Take over chapter numbering
305  if( mpOutlineRule )
307 
308  SwNodeRange aRg( *pStartNd, 0, aEndIdx.GetNode() );
309  SwNodeIndex aTmpIdx( pDoc->GetNodes().GetEndOfContent() );
310  GetNodes().Copy_( aRg, aTmpIdx, false );
311 
312  // Delete the initial TextNode
313  SwNodeIndex aIdx( pDoc->GetNodes().GetEndOfExtras(), 2 );
314  if( aIdx.GetIndex() + 1 !=
315  pDoc->GetNodes().GetEndOfContent().GetIndex() )
316  pDoc->GetNodes().Delete( aIdx );
317 
318  // All Flys in the section
320 
321  // And what's with all the Bookmarks?
322  // ?????
323 
324  utl::TempFile aTempFile2(sLeading, true, &sExt, &sPath);
325  sFileName = aTempFile2.GetURL();
326  SfxMedium* pTmpMed = new SfxMedium( sFileName,
327  StreamMode::STD_READWRITE );
328  pTmpMed->SetFilter( pFilter );
329 
330  // We need to have a Layout for the HTMLFilter, so that
331  // TextFrames/Controls/OLE objects can be exported correctly as graphics.
332  if( SPLITDOC_TO_HTML == eDocType &&
333  !pDoc->GetSpzFrameFormats()->empty() )
334  {
336  }
337  xDocSh->DoSaveAs( *pTmpMed );
338  xDocSh->DoSaveCompleted( pTmpMed );
339 
340  // do not insert a FileLinkSection in case of error
341  if( xDocSh->GetError() )
342  sFileName.clear();
343  }
344  xDocSh->DoClose();
345  }
346 
347  // We can now insert the section
348  if( !sFileName.isEmpty() )
349  {
350  switch( eDocType )
351  {
352  case SPLITDOC_TO_HTML:
353  {
354  // Delete all nodes in the section and, in the "start node",
355  // set the Link to the saved document.
356  sal_uLong nNodeDiff = aEndIdx.GetIndex() -
357  pStartNd->GetIndex() - 1;
358  if( nNodeDiff )
359  {
360  SwPaM aTmp( *pStartNd, aEndIdx.GetNode(), 1, -1 );
361  aTmp.GetPoint()->nContent.Assign( nullptr, 0 );
362  aTmp.GetMark()->nContent.Assign( nullptr, 0 );
363  SwNodeIndex aSIdx( aTmp.GetMark()->nNode );
364  SwNodeIndex aEIdx( aTmp.GetPoint()->nNode );
365 
366  // Try to move past the end
367  if( !aTmp.Move( fnMoveForward, GoInNode ) )
368  {
369  // well then, back to the beginning
370  aTmp.Exchange();
371  if( !aTmp.Move( fnMoveBackward, GoInNode ))
372  {
373  OSL_FAIL( "no more Nodes!" );
374  }
375  }
376  // Move Bookmarks and so forth
377  CorrAbs( aSIdx, aEIdx, *aTmp.GetPoint(), true);
378 
379  // If FlyFrames are still around, delete these too
380  for( SwFrameFormats::size_type n = 0; n < GetSpzFrameFormats()->size(); ++n )
381  {
382  SwFrameFormat* pFly = (*GetSpzFrameFormats())[n];
383  const SwFormatAnchor* pAnchor = &pFly->GetAnchor();
384  SwPosition const*const pAPos =
385  pAnchor->GetContentAnchor();
386  if (pAPos &&
387  ((RndStdIds::FLY_AT_PARA == pAnchor->GetAnchorId()) ||
388  (RndStdIds::FLY_AT_CHAR == pAnchor->GetAnchorId())) &&
389  aSIdx <= pAPos->nNode &&
390  pAPos->nNode < aEIdx )
391  {
393  --n;
394  }
395  }
396 
397  GetNodes().Delete( aSIdx, nNodeDiff );
398  }
399 
400  // set the link in the StartNode
401  SwFormatINetFormat aINet( sFileName , OUString() );
402  SwTextNode* pTNd = pStartNd->GetTextNode();
403  pTNd->InsertItem(aINet, 0, pTNd->GetText().getLength());
404 
405  // If the link cannot be found anymore,
406  // it has to be a bug!
407  if( !pOutlNds->Seek_Entry( pStartNd, &nOutl ))
408  pStartNd = nullptr;
409  ++nOutl ;
410  }
411  break;
412 
413  default:
414  {
415  const OUString sNm(INetURLObject(sFileName).GetLastName());
417  GetUniqueSectionName( &sNm ));
418  SwSectionFormat* pFormat = MakeSectionFormat();
419  aSectData.SetLinkFileName(sFileName);
420  aSectData.SetProtectFlag(true);
421 
422  --aEndIdx; // in the InsertSection the end is inclusive
423  while( aEndIdx.GetNode().IsStartNode() )
424  --aEndIdx;
425 
426  // If any Section ends or starts in the new sectionrange,
427  // they must end or start before or after the range!
428  SwSectionNode* pSectNd = pStartNd->FindSectionNode();
429  while( pSectNd && pSectNd->EndOfSectionIndex()
430  <= aEndIdx.GetIndex() )
431  {
432  const SwNode* pSectEnd = pSectNd->EndOfSectionNode();
433  if( pSectNd->GetIndex() + 1 ==
434  pStartNd->GetIndex() )
435  {
436  bool bMvIdx = aEndIdx == *pSectEnd;
437  DelSectionFormat( pSectNd->GetSection().GetFormat() );
438  if( bMvIdx )
439  --aEndIdx;
440  }
441  else
442  {
443  SwNodeRange aRg( *pStartNd, *pSectEnd );
444  SwNodeIndex aIdx( *pSectEnd, 1 );
445  GetNodes().MoveNodes( aRg, GetNodes(), aIdx );
446  }
447  pSectNd = pStartNd->FindSectionNode();
448  }
449 
450  pSectNd = aEndIdx.GetNode().FindSectionNode();
451  while( pSectNd && pSectNd->GetIndex() >
452  pStartNd->GetIndex() )
453  {
454  // #i15712# don't attempt to split sections if
455  // they are fully enclosed in [pSectNd,aEndIdx].
456  if( aEndIdx < pSectNd->EndOfSectionIndex() )
457  {
458  SwNodeRange aRg( *pSectNd, 1, aEndIdx, 1 );
459  SwNodeIndex aIdx( *pSectNd );
460  GetNodes().MoveNodes( aRg, GetNodes(), aIdx );
461  }
462 
463  pSectNd = pStartNd->FindSectionNode();
464  }
465 
466  // -> #i26762#
467  // Ensure order of start and end of section is sane.
468  SwNodeIndex aStartIdx(*pStartNd);
469 
470  if (aEndIdx >= aStartIdx)
471  {
472  pSectNd = GetNodes().InsertTextSection(aStartIdx,
473  *pFormat, aSectData, nullptr, &aEndIdx, false);
474  }
475  else
476  {
477  pSectNd = GetNodes().InsertTextSection(aEndIdx,
478  *pFormat, aSectData, nullptr, &aStartIdx, false);
479  }
480  // <- #i26762#
481 
483  }
484  break;
485  }
486  }
487  }
488  } while( pStartNd );
489 
490  xTmpOutlNds.reset();
491 
492  switch( eDocType )
493  {
494  case SPLITDOC_TO_HTML:
496  {
497  // save all remaining sections
498  while( !GetSections().empty() )
499  DelSectionFormat( GetSections().front() );
500 
502  pFilter = pFCntnr->GetFilter4EA( pFilter->GetTypeName(), SfxFilterFlags::EXPORT );
503  }
504  break;
505 
506  default:
507  // save the Globaldoc
510  }
511 
512  // The medium isn't locked after reopening the document.
513  SfxRequest aReq( SID_SAVEASDOC, SfxCallMode::SYNCHRON, GetAttrPool() );
514  aReq.AppendItem( SfxStringItem( SID_FILE_NAME, rPath ) );
515  aReq.AppendItem( SfxBoolItem( SID_SAVETO, true ) );
516  if(pFilter)
517  aReq.AppendItem( SfxStringItem( SID_FILTER_NAME, pFilter->GetName() ) );
518  const SfxBoolItem *pRet = static_cast<const SfxBoolItem*>(mpDocShell->ExecuteSlot( aReq ));
519 
520  return pRet && pRet->GetValue();
521 }
522 
523 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const SfxPoolItem * ExecuteSlot(SfxRequest &rReq, const SfxInterface *pIF=nullptr)
SwSplitDocType
Definition: docglbl.cxx:58
bool GetValue() const
SwSectionNode * FindSectionNode()
Search section node, in which it is.
Definition: ndsect.cxx:962
const SwEndNode * EndOfSectionNode() const
Definition: node.hxx:690
sal_uLong GetIndex() const
Definition: node.hxx:290
virtual SfxObjectFactory & GetFactory() const =0
Represents the style of a paragraph.
Definition: fmtcol.hxx:55
Marks a position in the document model.
Definition: pam.hxx:35
virtual bool DoSaveCompleted(SfxMedium *pNewStor=nullptr, bool bRegisterRecent=true)
SAL_DLLPRIVATE void SetProtectFlag(bool const bFlag)
Definition: section.hxx:105
void SetLinkFileName(OUString const &rNew)
Definition: section.hxx:117
const OUString & GetText() const
Definition: ndtxt.hxx:211
virtual bool get(DocumentSettingId id) const override
Return the specified document setting.
void DelSectionFormat(SwSectionFormat *pFormat, bool bDelNodes=false)
Definition: ndsect.cxx:516
virtual void SetRedlineFlags_intern(RedlineFlags eMode)=0
Set a new redline mode.
SwNodeIndex nNode
Definition: pam.hxx:37
std::shared_ptr< const SfxFilter > GetFilter4EA(const OUString &rEA, SfxFilterFlags nMust=SfxFilterFlags::IMPORT, SfxFilterFlags nDont=SFX_FILTER_NOTINSTALLED) const
sal_uIntPtr sal_uLong
bool GenerateHTMLDoc(const OUString &rPath, const SwTextFormatColl *pSplitColl)
Definition: docglbl.cxx:82
void CreateLink(LinkCreateType eType)
Definition: section.cxx:1484
sal_Int64 n
Definition: doc.hxx:184
TElementType * Next()
Definition: calbck.hxx:353
OUString GetUniqueSectionName(const OUString *pChkStr=nullptr) const
Definition: ndsect.cxx:1362
virtual void set(DocumentSettingId id, bool value) override
Set the specified document setting.
SwNode & GetNode() const
Definition: ndindex.hxx:119
SwSectionFormat * GetFormat()
Definition: section.hxx:336
IDocumentUndoRedo & GetIDocumentUndoRedo()
Definition: doc.cxx:144
void Copy_(const SwNodeRange &rRg, const SwNodeIndex &rInsPos, bool bNewFrames=true) const
Definition: ndarr.hxx:176
const SwFrameFormats * GetSpzFrameFormats() const
Definition: doc.hxx:739
void ReplaceStyles(const SwDoc &rSource, bool bIncludePageStyles=true)
Definition: docfmt.cxx:1529
int GetAttrOutlineLevel() const
Returns outline level of this text node.
Definition: ndtxt.cxx:3998
const SwSection & GetSection() const
Definition: node.hxx:549
OUString GetBase() const
void Delete(const SwNodeIndex &rPos, sal_uLong nNodes=1)
delete nodes
Definition: nodes.cxx:1072
constexpr auto SFX_INTERFACE_NONE
SwIndex nContent
Definition: pam.hxx:38
sal_uLong GetIndex() const
Definition: ndindex.hxx:152
virtual void DelLayoutFormat(SwFrameFormat *pFormat)=0
virtual void DoUndo(bool const bDoUndo)=0
Enable/Disable Undo.
bool IsStartNode() const
Definition: node.hxx:632
SwTextAttr * InsertItem(SfxPoolItem &rAttr, const sal_Int32 nStart, const sal_Int32 nEnd, const SetAttrMode nMode=SetAttrMode::DEFAULT)
create new text attribute from rAttr and insert it
Definition: thints.cxx:1255
SwDocShell * mpDocShell
Definition: doc.hxx:256
bool empty() const
RedlineFlags on.
SwSectionFormat * MakeSectionFormat()
Definition: ndsect.cxx:509
size_type size() const
void CopyFlyInFlyImpl(const SwNodeRange &rRg, SwPaM const *const pCopiedPaM, const SwNodeIndex &rStartIdx, const bool bCopyFlyAtFly=false, SwCopyFlags flags=SwCopyFlags::Default) const
bool SplitDoc(sal_uInt16 eDocType, const OUString &rPath, bool bOutline, const SwTextFormatColl *pSplitColl, int nOutlineLevel=0)
Create sub-documents according to the given collection.
Definition: docglbl.cxx:159
SwNode & GetEndOfContent() const
Regular ContentSection (i.e. the BodyText).
Definition: ndarr.hxx:163
css::util::DateTime GetUNODateTime() const
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:136
static SwNodePtr GetStartNode(SwOutlineNodes const *pOutlNds, int nOutlineLevel, SwOutlineNodes::size_type *nOutl)
Definition: docglbl.cxx:89
static SW_DLLPUBLIC std::shared_ptr< const SfxFilter > GetFilterOfFormat(const OUString &rFormat, const SfxFilterContainer *pCnt=nullptr)
find for an internal format name the corresponding filter entry
Definition: iodetect.cxx:69
Style of a layout element.
Definition: frmfmt.hxx:57
const SwFormatAnchor & GetAnchor(bool=true) const
Definition: fmtanchr.hxx:81
bool GoInNode(SwPaM &rPam, SwMoveFnCollection const &fnMove)
Definition: pam.cxx:954
const SwPosition * GetPoint() const
Definition: pam.hxx:207
std::vector< SwTextFormatColl * >::size_type size_type
Definition: docary.hxx:63
OUString const & GetURL() const
SwIndex & Assign(SwIndexReg *, sal_Int32)
Definition: index.cxx:206
RndStdIds GetAnchorId() const
Definition: fmtanchr.hxx:65
const SwPosition * GetContentAnchor() const
Definition: fmtanchr.hxx:67
::sw::DocumentContentOperationsManager const & GetDocumentContentOperationsManager() const
Definition: doc.cxx:325
TElementType * First()
Definition: calbck.hxx:345
FlyAnchors.
Definition: fmtanchr.hxx:34
size_t size() const
Definition: docary.hxx:84
SwNumRule * mpOutlineRule
Definition: doc.hxx:250
size
Marks a node in the document model.
Definition: ndindex.hxx:31
const SwOutlineNodes & GetOutLineNds() const
Array of all OutlineNodes.
Definition: ndarr.hxx:231
bool empty() const
SwSectionNode * InsertTextSection(SwNodeIndex const &rNdIdx, SwSectionFormat &rSectionFormat, SwSectionData const &, SwTOXBase const *const pTOXBase, SwNodeIndex const *const pEnd, bool const bInsAtStart=true, bool const bCreateFrames=true)
Insert a new SwSection.
Definition: ndsect.cxx:786
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
Definition: doc.cxx:405
void SetOutlineNumRule(const SwNumRule &rRule)
Definition: docnum.cxx:114
bool GenerateGlobalDoc(const OUString &rPath, const SwTextFormatColl *pSplitColl)
Definition: docglbl.cxx:66
OUString GetMainURL(DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
sal_uLong EndOfSectionIndex() const
Definition: node.hxx:685
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:80
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
Definition: doc.cxx:335
bool DoSaveAs(SfxMedium &rNewStor)
OUString GetExpandText(SwRootFrame const *pLayout, const sal_Int32 nIdx=0, const sal_Int32 nLen=-1, const bool bWithNum=false, const bool bAddSpaceAfterListLabelStr=false, const bool bWithSpacesForLevel=false, const ExpandMode eAdditionalMode=ExpandMode::ExpandFootnote) const
add 4th optional parameter indicating, when that a spa...
Definition: ndtxt.cxx:3349
void CorrAbs(const SwNodeIndex &rOldNode, const SwPosition &rNewPos, const sal_Int32 nOffset=0, bool bMoveCursor=false)
Definition: doccorr.cxx:167
const SwTextFormatColls * GetTextFormatColls() const
Definition: doc.hxx:775
static SfxViewFrame * LoadHiddenDocument(SfxObjectShell const &i_rDoc, SfxInterfaceId i_nViewId)
#define FILTER_XML
XML filter.
Definition: iodetect.hxx:35
SwMoveFnCollection const & fnMoveForward
SwPam::Move()/Find() default argument.
Definition: paminit.cxx:59
bool DoInitNew(SfxMedium *pMedium=nullptr)
SwNodes & GetNodes()
Definition: doc.hxx:403
::sw::DocumentSettingManager & GetDocumentSettingManager()
Definition: doc.cxx:186
void SetMin(sal_uInt16 nNewMin)
SwMoveFnCollection const & fnMoveBackward
Definition: paminit.cxx:58
SwTableNode * FindTableNode()
Search table node, in which it is.
Definition: node.cxx:352
ErrCode GetError() const
static SwNodePtr GetEndNode(SwOutlineNodes const *pOutlNds, int nOutlineLevel, SwOutlineNodes::size_type *nOutl)
Definition: docglbl.cxx:103
const sw::mark::IMark * GetMark() const
Definition: index.hxx:100
void AppendItem(const SfxPoolItem &)
size_t size() const
SwFrameFormatsBase::size_type size_type
bool Seek_Entry(SwNode *rP, size_type *pnPos) const
Definition: ndnum.cxx:32
SfxFilterContainer * GetFilterContainer() const
std::pair< const_iterator, bool > insert(Value &&x)
int GetAttrOutlineLevel() const
Definition: fmtcol.cxx:582
std::vector< SwNode * >::size_type size_type
SwNode & GetEndOfExtras() const
This is the last EndNode of a special section.
Definition: ndarr.hxx:161
SwSectionFormats & GetSections()
Definition: doc.hxx:1334
void SetFilter(const std::shared_ptr< const SfxFilter > &pFilter)
void EnableKillingFile(bool bEnable=true)
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1315
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:844
bool MoveNodes(const SwNodeRange &, SwNodes &rNodes, const SwNodeIndex &, bool bNewFrames=true)
move the node pointer
Definition: nodes.cxx:394
bool removeSegment(sal_Int32 nIndex=LAST_SEGMENT, bool bIgnoreFinalSlash=true)
Base class of the Writer document model elements.
Definition: node.hxx:79
SwTextFormatColl * GetTextColl() const
Definition: ndtxt.hxx:838
SfxMedium * GetMedium() const