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