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 <memory>
48 #include <com/sun/star/uno/Reference.h>
49 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
50 #include <com/sun/star/document/XDocumentProperties.hpp>
51 
52 using namespace ::com::sun::star;
53 
54 namespace {
55 
57 {
58  SPLITDOC_TO_GLOBALDOC,
59  SPLITDOC_TO_HTML
60 };
61 
62 }
63 
64 bool SwDoc::GenerateGlobalDoc( const OUString& rPath,
65  const SwTextFormatColl* pSplitColl )
66 {
67  return SplitDoc( SPLITDOC_TO_GLOBALDOC, rPath, false, pSplitColl );
68 }
69 
70 bool SwDoc::GenerateGlobalDoc( const OUString& rPath, int nOutlineLevel )
71 {
72  return SplitDoc( SPLITDOC_TO_GLOBALDOC, rPath, true, nullptr, nOutlineLevel );
73 }
74 
75 bool SwDoc::GenerateHTMLDoc( const OUString& rPath, int nOutlineLevel )
76 {
77  return SplitDoc( SPLITDOC_TO_HTML, rPath, true, nullptr, nOutlineLevel );
78 }
79 
80 bool SwDoc::GenerateHTMLDoc( const OUString& rPath,
81  const SwTextFormatColl* pSplitColl )
82 {
83  return SplitDoc( SPLITDOC_TO_HTML, rPath, false, pSplitColl );
84 }
85 
86 // two helpers for outline mode
87 static SwNodePtr GetStartNode( SwOutlineNodes const * pOutlNds, int nOutlineLevel, SwOutlineNodes::size_type* nOutl )
88 {
89  SwNodePtr pNd;
90 
91  for( ; *nOutl < pOutlNds->size(); ++(*nOutl) )
92  if( ( pNd = (*pOutlNds)[ *nOutl ])->GetTextNode()->GetAttrOutlineLevel() == nOutlineLevel && !pNd->FindTableNode() )
93  {
94  return pNd;
95  }
96 
97  return nullptr;
98 }
99 
100 static SwNodePtr GetEndNode( SwOutlineNodes const * pOutlNds, int nOutlineLevel, SwOutlineNodes::size_type* nOutl )
101 {
102  SwNodePtr pNd;
103 
104  for( ++(*nOutl); (*nOutl) < pOutlNds->size(); ++(*nOutl) )
105  {
106  pNd = (*pOutlNds)[ *nOutl ];
107 
108  const int nLevel = pNd->GetTextNode()->GetAttrOutlineLevel();
109 
110  if( ( 0 < nLevel && nLevel <= nOutlineLevel ) &&
111  !pNd->FindTableNode() )
112  {
113  return pNd;
114  }
115  }
116  return nullptr;
117 }
118 
119 // two helpers for collection mode
120 static SwNodePtr GetStartNode( const SwOutlineNodes* pOutlNds, const SwTextFormatColl* pSplitColl, SwOutlineNodes::size_type* nOutl )
121 {
122  SwNodePtr pNd;
123  for( ; *nOutl < pOutlNds->size(); ++(*nOutl) )
124  if( ( pNd = (*pOutlNds)[ *nOutl ])->GetTextNode()->
125  GetTextColl() == pSplitColl &&
126  !pNd->FindTableNode() )
127  {
128  return pNd;
129  }
130  return nullptr;
131 }
132 
133 static SwNodePtr GetEndNode( const SwOutlineNodes* pOutlNds, const SwTextFormatColl* pSplitColl, SwOutlineNodes::size_type* nOutl )
134 {
135  SwNodePtr pNd;
136 
137  for( ++(*nOutl); *nOutl < pOutlNds->size(); ++(*nOutl) )
138  {
139  pNd = (*pOutlNds)[ *nOutl ];
140  SwTextFormatColl* pTColl = pNd->GetTextNode()->GetTextColl();
141 
142  if( ( pTColl == pSplitColl ||
143  ( pSplitColl->GetAttrOutlineLevel() > 0 &&
144  pTColl->GetAttrOutlineLevel() > 0 &&
145  pTColl->GetAttrOutlineLevel() <
146  pSplitColl->GetAttrOutlineLevel() )) &&
147  !pNd->FindTableNode() )
148  {
149  return pNd;
150  }
151  }
152  return nullptr;
153 }
154 
155 bool SwDoc::SplitDoc( sal_uInt16 eDocType, const OUString& rPath, bool bOutline, const SwTextFormatColl* pSplitColl, int nOutlineLevel )
156 {
157  // Iterate over all the template's Nodes, creating an own
158  // document for every single one and replace linked sections (GlobalDoc) for links (HTML).
159  // Finally, we save this document as a GlobalDoc/HTMLDoc.
160  if( !mpDocShell || !mpDocShell->GetMedium() ||
161  ( SPLITDOC_TO_GLOBALDOC == eDocType && GetDocumentSettingManager().get(DocumentSettingId::GLOBAL_DOCUMENT) ) )
162  return false;
163 
164  SwOutlineNodes::size_type nOutl = 0;
165  SwOutlineNodes* pOutlNds = const_cast<SwOutlineNodes*>(&GetNodes().GetOutLineNds());
166  std::unique_ptr<SwOutlineNodes> xTmpOutlNds;
167  SwNodePtr pStartNd;
168 
169  if ( !bOutline) {
170  if( pSplitColl )
171  {
172  // If it isn't an OutlineNumbering, then use an own array and collect the Nodes.
173  if( pSplitColl->GetAttrOutlineLevel() == 0 )
174  {
175  xTmpOutlNds.reset(new SwOutlineNodes);
176  pOutlNds = xTmpOutlNds.get();
177  SwIterator<SwTextNode,SwFormatColl> aIter( *pSplitColl );
178  for( SwTextNode* pTNd = aIter.First(); pTNd; pTNd = aIter.Next() )
179  if( pTNd->GetNodes().IsDocNodes() )
180  pOutlNds->insert( pTNd );
181 
182  if( pOutlNds->empty() )
183  return false;
184  }
185  }
186  else
187  {
188  // Look for the 1st level OutlineTemplate
189  const SwTextFormatColls& rFormatColls =*GetTextFormatColls();
190  for( SwTextFormatColls::size_type n = rFormatColls.size(); n; )
191  if ( rFormatColls[ --n ]->GetAttrOutlineLevel() == 1 )
192  {
193  pSplitColl = rFormatColls[ n ];
194  break;
195  }
196 
197  if( !pSplitColl )
198  return false;
199  }
200  }
201 
202  std::shared_ptr<const SfxFilter> pFilter;
203  switch( eDocType )
204  {
205  case SPLITDOC_TO_HTML:
206  pFilter = SwIoSystem::GetFilterOfFormat("HTML");
207  break;
208 
209  default:
211  eDocType = SPLITDOC_TO_GLOBALDOC;
212  break;
213  }
214 
215  if( !pFilter )
216  return false;
217 
218  // Deactivate Undo/Redline in any case
219  GetIDocumentUndoRedo().DoUndo(false);
221 
222  OUString sExt = pFilter->GetSuffixes().getToken(0, ',');
223  if( sExt.isEmpty() )
224  {
225  sExt = ".sxw";
226  }
227  else
228  {
229  if( '.' != sExt[ 0 ] )
230  {
231  sExt = "." + sExt;
232  }
233  }
234 
235  INetURLObject aEntry(rPath);
236  OUString sLeading(aEntry.GetBase());
237  aEntry.removeSegment();
238  OUString sPath = aEntry.GetMainURL( INetURLObject::DecodeMechanism::NONE );
239  utl::TempFile aTemp(sLeading, true, &sExt, &sPath);
240  aTemp.EnableKillingFile();
241 
242  DateTime aTmplDate( DateTime::SYSTEM );
243  {
244  tools::Time a2Min( 0 ); a2Min.SetMin( 2 );
245  aTmplDate += a2Min;
246  }
247 
248  // Skip all invalid ones
249  while( nOutl < pOutlNds->size() &&
250  (*pOutlNds)[ nOutl ]->GetIndex() < GetNodes().GetEndOfExtras().GetIndex() )
251  ++nOutl;
252 
253  do {
254  if( bOutline )
255  pStartNd = GetStartNode( pOutlNds, nOutlineLevel, &nOutl );
256  else
257  pStartNd = GetStartNode( pOutlNds, pSplitColl, &nOutl );
258 
259  if( pStartNd )
260  {
261  SwNodePtr pEndNd;
262  if( bOutline )
263  pEndNd = GetEndNode( pOutlNds, nOutlineLevel, &nOutl );
264  else
265  pEndNd = GetEndNode( pOutlNds, pSplitColl, &nOutl );
266  SwNodeIndex aEndIdx( pEndNd ? *pEndNd
267  : GetNodes().GetEndOfContent() );
268 
269  // Write out the Nodes completely
270  OUString sFileName;
271  if( pStartNd->GetIndex() + 1 < aEndIdx.GetIndex() )
272  {
273  SfxObjectShellLock xDocSh( new SwDocShell( SfxObjectCreateMode::INTERNAL ));
274  if( xDocSh->DoInitNew() )
275  {
276  SwDoc* pDoc = static_cast<SwDocShell*>(&xDocSh)->GetDoc();
277 
278  uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
279  static_cast<SwDocShell*>(&xDocSh)->GetModel(),
280  uno::UNO_QUERY_THROW);
281  uno::Reference<document::XDocumentProperties> xDocProps(
282  xDPS->getDocumentProperties());
283  OSL_ENSURE(xDocProps.is(), "Doc has no DocumentProperties");
284  // the GlobalDoc is the template
285  xDocProps->setTemplateName(OUString());
286  ::util::DateTime uDT = aTmplDate.GetUNODateTime();
287  xDocProps->setTemplateDate(uDT);
288  xDocProps->setTemplateURL(rPath);
289  // Set the new doc's title to the text of the "split para".
290  // If the current doc has a title, insert it at the begin.
291  OUString sTitle( xDocProps->getTitle() );
292  if (!sTitle.isEmpty())
293  sTitle += ": ";
294  sTitle += pStartNd->GetTextNode()->GetExpandText(nullptr);
295  xDocProps->setTitle( sTitle );
296 
297  // Replace template
298  pDoc->ReplaceStyles( *this );
299 
300  // Take over chapter numbering
301  if( mpOutlineRule )
303 
304  SwNodeRange aRg( *pStartNd, 0, aEndIdx.GetNode() );
305  SwNodeIndex aTmpIdx( pDoc->GetNodes().GetEndOfContent() );
306  GetNodes().Copy_( aRg, aTmpIdx, false );
307 
308  // Delete the initial TextNode
309  SwNodeIndex aIdx( pDoc->GetNodes().GetEndOfExtras(), 2 );
310  if( aIdx.GetIndex() + 1 !=
311  pDoc->GetNodes().GetEndOfContent().GetIndex() )
312  pDoc->GetNodes().Delete( aIdx );
313 
314  // All Flys in the section
316 
317  // And what's with all the Bookmarks?
318  // ?????
319 
320  utl::TempFile aTempFile2(sLeading, true, &sExt, &sPath);
321  sFileName = aTempFile2.GetURL();
322  SfxMedium* pTmpMed = new SfxMedium( sFileName,
323  StreamMode::STD_READWRITE );
324  pTmpMed->SetFilter( pFilter );
325 
326  // We need to have a Layout for the HTMLFilter, so that
327  // TextFrames/Controls/OLE objects can be exported correctly as graphics.
328  if( SPLITDOC_TO_HTML == eDocType &&
329  !pDoc->GetSpzFrameFormats()->empty() )
330  {
332  }
333  xDocSh->DoSaveAs( *pTmpMed );
334  xDocSh->DoSaveCompleted( pTmpMed );
335 
336  // do not insert a FileLinkSection in case of error
337  if( xDocSh->GetError() )
338  sFileName.clear();
339  }
340  xDocSh->DoClose();
341  }
342 
343  // We can now insert the section
344  if( !sFileName.isEmpty() )
345  {
346  switch( eDocType )
347  {
348  case SPLITDOC_TO_HTML:
349  {
350  // Delete all nodes in the section and, in the "start node",
351  // set the Link to the saved document.
352  sal_uLong nNodeDiff = aEndIdx.GetIndex() -
353  pStartNd->GetIndex() - 1;
354  if( nNodeDiff )
355  {
356  SwPaM aTmp( *pStartNd, aEndIdx.GetNode(), 1, -1 );
357  aTmp.GetPoint()->nContent.Assign( nullptr, 0 );
358  aTmp.GetMark()->nContent.Assign( nullptr, 0 );
359  SwNodeIndex aSIdx( aTmp.GetMark()->nNode );
360  SwNodeIndex aEIdx( aTmp.GetPoint()->nNode );
361 
362  // Try to move past the end
363  if( !aTmp.Move( fnMoveForward, GoInNode ) )
364  {
365  // well then, back to the beginning
366  aTmp.Exchange();
367  if( !aTmp.Move( fnMoveBackward, GoInNode ))
368  {
369  OSL_FAIL( "no more Nodes!" );
370  }
371  }
372  // Move Bookmarks and so forth
373  CorrAbs( aSIdx, aEIdx, *aTmp.GetPoint(), true);
374 
375  // If FlyFrames are still around, delete these too
376  for( SwFrameFormats::size_type n = 0; n < GetSpzFrameFormats()->size(); ++n )
377  {
378  SwFrameFormat* pFly = (*GetSpzFrameFormats())[n];
379  const SwFormatAnchor* pAnchor = &pFly->GetAnchor();
380  SwPosition const*const pAPos =
381  pAnchor->GetContentAnchor();
382  if (pAPos &&
383  ((RndStdIds::FLY_AT_PARA == pAnchor->GetAnchorId()) ||
384  (RndStdIds::FLY_AT_CHAR == pAnchor->GetAnchorId())) &&
385  aSIdx <= pAPos->nNode &&
386  pAPos->nNode < aEIdx )
387  {
389  --n;
390  }
391  }
392 
393  GetNodes().Delete( aSIdx, nNodeDiff );
394  }
395 
396  // set the link in the StartNode
397  SwFormatINetFormat aINet( sFileName , OUString() );
398  SwTextNode* pTNd = pStartNd->GetTextNode();
399  pTNd->InsertItem(aINet, 0, pTNd->GetText().getLength());
400 
401  // If the link cannot be found anymore,
402  // it has to be a bug!
403  if( !pOutlNds->Seek_Entry( pStartNd, &nOutl ))
404  pStartNd = nullptr;
405  ++nOutl ;
406  }
407  break;
408 
409  default:
410  {
411  const OUString sNm(INetURLObject(sFileName).GetLastName());
413  GetUniqueSectionName( &sNm ));
414  SwSectionFormat* pFormat = MakeSectionFormat();
415  aSectData.SetLinkFileName(sFileName);
416  aSectData.SetProtectFlag(true);
417 
418  --aEndIdx; // in the InsertSection the end is inclusive
419  while( aEndIdx.GetNode().IsStartNode() )
420  --aEndIdx;
421 
422  // If any Section ends or starts in the new sectionrange,
423  // they must end or start before or after the range!
424  SwSectionNode* pSectNd = pStartNd->FindSectionNode();
425  while( pSectNd && pSectNd->EndOfSectionIndex()
426  <= aEndIdx.GetIndex() )
427  {
428  const SwNode* pSectEnd = pSectNd->EndOfSectionNode();
429  if( pSectNd->GetIndex() + 1 ==
430  pStartNd->GetIndex() )
431  {
432  bool bMvIdx = aEndIdx == *pSectEnd;
433  DelSectionFormat( pSectNd->GetSection().GetFormat() );
434  if( bMvIdx )
435  --aEndIdx;
436  }
437  else
438  {
439  SwNodeRange aRg( *pStartNd, *pSectEnd );
440  SwNodeIndex aIdx( *pSectEnd, 1 );
441  GetNodes().MoveNodes( aRg, GetNodes(), aIdx );
442  }
443  pSectNd = pStartNd->FindSectionNode();
444  }
445 
446  pSectNd = aEndIdx.GetNode().FindSectionNode();
447  while( pSectNd && pSectNd->GetIndex() >
448  pStartNd->GetIndex() )
449  {
450  // #i15712# don't attempt to split sections if
451  // they are fully enclosed in [pSectNd,aEndIdx].
452  if( aEndIdx < pSectNd->EndOfSectionIndex() )
453  {
454  SwNodeRange aRg( *pSectNd, 1, aEndIdx, 1 );
455  SwNodeIndex aIdx( *pSectNd );
456  GetNodes().MoveNodes( aRg, GetNodes(), aIdx );
457  }
458 
459  pSectNd = pStartNd->FindSectionNode();
460  }
461 
462  // -> #i26762#
463  // Ensure order of start and end of section is sane.
464  SwNodeIndex aStartIdx(*pStartNd);
465 
466  if (aEndIdx >= aStartIdx)
467  {
468  pSectNd = GetNodes().InsertTextSection(aStartIdx,
469  *pFormat, aSectData, nullptr, &aEndIdx, false);
470  }
471  else
472  {
473  pSectNd = GetNodes().InsertTextSection(aEndIdx,
474  *pFormat, aSectData, nullptr, &aStartIdx, false);
475  }
476  // <- #i26762#
477 
479  }
480  break;
481  }
482  }
483  }
484  } while( pStartNd );
485 
486  xTmpOutlNds.reset();
487 
488  switch( eDocType )
489  {
490  case SPLITDOC_TO_HTML:
492  {
493  // save all remaining sections
494  while( !GetSections().empty() )
495  DelSectionFormat( GetSections().front() );
496 
498  pFilter = pFCntnr->GetFilter4EA( pFilter->GetTypeName(), SfxFilterFlags::EXPORT );
499  }
500  break;
501 
502  default:
503  // save the Globaldoc
506  }
507 
508  // The medium isn't locked after reopening the document.
509  SfxRequest aReq( SID_SAVEASDOC, SfxCallMode::SYNCHRON, GetAttrPool() );
510  aReq.AppendItem( SfxStringItem( SID_FILE_NAME, rPath ) );
511  aReq.AppendItem( SfxBoolItem( SID_SAVETO, true ) );
512  if(pFilter)
513  aReq.AppendItem( SfxStringItem( SID_FILTER_NAME, pFilter->GetName() ) );
514  const SfxBoolItem *pRet = static_cast<const SfxBoolItem*>(mpDocShell->ExecuteSlot( aReq ));
515 
516  return pRet && pRet->GetValue();
517 }
518 
519 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const SfxPoolItem * ExecuteSlot(SfxRequest &rReq, const SfxInterface *pIF=nullptr)
SwSplitDocType
Definition: docglbl.cxx:56
bool GetValue() const
SwSectionNode * FindSectionNode()
Search section node, in which it is.
Definition: ndsect.cxx:955
const SwEndNode * EndOfSectionNode() const
Definition: node.hxx:682
SwSectionNode * InsertTextSection(SwNodeIndex const &rNdIdx, SwSectionFormat &rSectionFormat, SwSectionData const &, SwTOXBase const *const pTOXBase, SwNodeIndex const *const pEnde, bool const bInsAtStart=true, bool const bCreateFrames=true)
Insert a new SwSection.
Definition: ndsect.cxx:779
sal_uLong GetIndex() const
Definition: node.hxx:282
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:106
void SetLinkFileName(OUString const &rNew)
Definition: section.hxx:118
const OUString & GetText() const
Definition: ndtxt.hxx:210
virtual bool get(DocumentSettingId id) const override
Return the specified document setting.
void DelSectionFormat(SwSectionFormat *pFormat, bool bDelNodes=false)
Definition: ndsect.cxx:512
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:80
void CreateLink(LinkCreateType eType)
Definition: section.cxx:1489
sal_Int64 n
Definition: doc.hxx:185
TElementType * Next()
Definition: calbck.hxx:373
OUString GetUniqueSectionName(const OUString *pChkStr=nullptr) const
Definition: ndsect.cxx:1351
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:337
IDocumentUndoRedo & GetIDocumentUndoRedo()
Definition: doc.cxx:143
void Copy_(const SwNodeRange &rRg, const SwNodeIndex &rInsPos, bool bNewFrames=true) const
Definition: ndarr.hxx:176
const SwFrameFormats * GetSpzFrameFormats() const
Definition: doc.hxx:738
void ReplaceStyles(const SwDoc &rSource, bool bIncludePageStyles=true)
Definition: docfmt.cxx:1520
int GetAttrOutlineLevel() const
Returns outline level of this text node.
Definition: ndtxt.cxx:4023
const SwSection & GetSection() const
Definition: node.hxx:541
OUString GetBase() const
void Delete(const SwNodeIndex &rPos, sal_uLong nNodes=1)
delete nodes
Definition: nodes.cxx:1065
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:624
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:257
bool empty() const
Definition: docary.hxx:224
void CopyFlyInFlyImpl(const SwNodeRange &rRg, SwPaM const *const pCopiedPaM, const SwNodeIndex &rStartIdx, const bool bCopyFlyAtFly=false, bool bCopyText=false) const
RedlineFlags on.
SwSectionFormat * MakeSectionFormat()
Definition: ndsect.cxx:505
size_type size() 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:155
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:87
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:67
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:906
const SwPosition * GetPoint() const
Definition: pam.hxx:207
std::vector< SwTextFormatColl * >::size_type size_type
Definition: docary.hxx:70
OUString const & GetURL() const
SwIndex & Assign(SwIndexReg *, sal_Int32)
Definition: index.cxx:198
RndStdIds GetAnchorId() const
Definition: fmtanchr.hxx:65
const SwPosition * GetContentAnchor() const
Definition: fmtanchr.hxx:67
::sw::DocumentContentOperationsManager const & GetDocumentContentOperationsManager() const
Definition: doc.cxx:324
TElementType * First()
Definition: calbck.hxx:342
FlyAnchors.
Definition: fmtanchr.hxx:34
size_t size() const
Definition: docary.hxx:91
SwNumRule * mpOutlineRule
Definition: doc.hxx:251
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
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
Definition: doc.cxx:404
void SetOutlineNumRule(const SwNumRule &rRule)
Definition: docnum.cxx:112
bool GenerateGlobalDoc(const OUString &rPath, const SwTextFormatColl *pSplitColl)
Definition: docglbl.cxx:64
OUString GetMainURL(DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
sal_uLong EndOfSectionIndex() const
Definition: node.hxx:677
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:79
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
Definition: doc.cxx:334
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:3374
void CorrAbs(const SwNodeIndex &rOldNode, const SwPosition &rNewPos, const sal_Int32 nOffset=0, bool bMoveCursor=false)
Definition: doccorr.cxx:162
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:185
void SetMin(sal_uInt16 nNewMin)
SwMoveFnCollection const & fnMoveBackward
Definition: paminit.cxx:58
SwTableNode * FindTableNode()
Search table node, in which it is.
Definition: node.cxx:349
ErrCode GetError() const
static SwNodePtr GetEndNode(SwOutlineNodes const *pOutlNds, int nOutlineLevel, SwOutlineNodes::size_type *nOutl)
Definition: docglbl.cxx:100
const sw::mark::IMark * GetMark() const
Definition: index.hxx:104
void AppendItem(const SfxPoolItem &)
size_t size() const
Definition: docary.hxx:225
SwFrameFormatsBase::size_type size_type
Definition: docary.hxx:217
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:1332
void SetFilter(const std::shared_ptr< const SfxFilter > &pFilter)
void EnableKillingFile(bool bEnable=true)
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1313
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:842
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:836
SfxMedium * GetMedium() const