LibreOffice Module sw (master)  1
docnew.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 <sal/config.h>
21 
22 #include <mutex>
23 #include <string_view>
24 
25 #include <config_features.h>
26 #include <config_fuzzers.h>
27 
28 #include <o3tl/sorted_vector.hxx>
29 
30 #include <doc.hxx>
31 #include <proofreadingiterator.hxx>
32 #include <com/sun/star/text/XFlatParagraphIteratorProvider.hpp>
33 #include <com/sun/star/linguistic2/XProofreadingIterator.hpp>
34 #include <com/sun/star/frame/XModel.hpp>
35 #include <com/sun/star/i18n/ScriptType.hpp>
36 
38 #include <comphelper/random.hxx>
39 #include <sfx2/viewfrm.hxx>
40 #include <sfx2/XmlIdRegistry.hxx>
41 #include <sal/log.hxx>
42 #include <osl/diagnose.h>
43 
44 #include <sfx2/linkmgr.hxx>
45 #include <editeng/ulspitem.hxx>
46 #include <editeng/lrspitem.hxx>
47 #include <svl/numformat.hxx>
48 #include <svl/zforlist.hxx>
49 #include <unotools/lingucfg.hxx>
50 #include <svx/svdpage.hxx>
51 #include <fmtcntnt.hxx>
52 #include <fmtanchr.hxx>
53 #include <fmtfsize.hxx>
54 #include <fmtfordr.hxx>
55 #include <fmtpdsc.hxx>
56 #include <pvprtdat.hxx>
57 #include <rootfrm.hxx>
58 #include <pagedesc.hxx>
59 #include <ndtxt.hxx>
60 #include <ftninfo.hxx>
61 #include <ftnidx.hxx>
62 #include <charfmt.hxx>
63 #include <frmfmt.hxx>
64 #include <poolfmt.hxx>
65 #include <dbmgr.hxx>
66 #include <docsh.hxx>
67 #include <acorrect.hxx>
68 #include <visiturl.hxx>
69 #include <docary.hxx>
70 #include <lineinfo.hxx>
71 #include <drawdoc.hxx>
72 #include <extinput.hxx>
73 #include <viewsh.hxx>
74 #include <doctxm.hxx>
75 #include <shellres.hxx>
76 #include <laycache.hxx>
77 #include <mvsave.hxx>
78 #include <istyleaccess.hxx>
79 #include "swstylemanager.hxx"
80 #include <IGrammarContact.hxx>
81 #include <tblafmt.hxx>
82 #include <MarkManager.hxx>
83 #include <UndoManager.hxx>
88 #include <DocumentTimerManager.hxx>
91 #include <DocumentListsManager.hxx>
97 #include <DocumentStateManager.hxx>
101 #include <wrtsh.hxx>
102 #include <unocrsr.hxx>
103 #include <fmthdft.hxx>
104 #include <frameformats.hxx>
105 
106 #include <numrule.hxx>
107 
108 #include <sfx2/Metadatable.hxx>
109 #include <fmtmeta.hxx>
110 
111 #include <svx/xfillit0.hxx>
112 #include <unotools/configmgr.hxx>
113 #include <i18nlangtag/mslangid.hxx>
114 
115 using namespace ::com::sun::star;
116 using namespace ::com::sun::star::document;
117 
118 constexpr OUStringLiteral DEFAULT_CHAR_FORMAT_NAME = u"Character style";
119 
120 /*
121  * global functions...
122  */
123  uno::Reference< linguistic2::XProofreadingIterator > const & SwDoc::GetGCIterator() const
124 {
126  {
127  uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() );
128  try
129  {
131  }
132  catch (const uno::Exception &)
133  {
134  OSL_FAIL( "No GCIterator" );
135  }
136  }
137 
138  return m_xGCIterator;
139 }
140 
141 bool SwDoc::StartGrammarChecking( bool bSkipStart )
142 {
143  // check for a visible view
144  bool bVisible = false;
145  bool bStarted = false;
146  const SwDocShell *pDocShell = GetDocShell();
147  SfxViewFrame *pFrame = SfxViewFrame::GetFirst( pDocShell, false );
148  while (pFrame && !bVisible)
149  {
150  if (pFrame->IsVisible())
151  bVisible = true;
152  pFrame = SfxViewFrame::GetNext( *pFrame, pDocShell, false );
153  }
154 
159  if (bVisible)
160  {
161  uno::Reference< linguistic2::XProofreadingIterator > xGCIterator( GetGCIterator() );
162  if ( xGCIterator.is() )
163  {
164  uno::Reference< lang::XComponent > xDoc = GetDocShell()->GetBaseModel();
165  uno::Reference< text::XFlatParagraphIteratorProvider > xFPIP( xDoc, uno::UNO_QUERY );
166 
167  // start automatic background checking if not active already
168  if ( xFPIP.is() && !xGCIterator->isProofreading( xDoc ) )
169  {
170  bStarted = true;
171  if ( !bSkipStart )
172  {
173  for (auto pLayout : GetAllLayouts())
174  { // we're starting it now, don't start grammar checker
175  // again until the user modifies the document
176  pLayout->SetNeedGrammarCheck(false);
177  }
178  xGCIterator->startProofreading( xDoc, xFPIP );
179  }
180  }
181  }
182  }
183 
184  return bStarted;
185 }
186 
187 /*
188  * internal functions
189  */
190 static void lcl_DelFormatIndices( SwFormat const * pFormat )
191 {
192  SwFormatContent &rFormatContent = const_cast<SwFormatContent&>(pFormat->GetContent());
193  if ( rFormatContent.GetContentIdx() )
194  rFormatContent.SetNewContentIdx( nullptr );
195  SwFormatAnchor &rFormatAnchor = const_cast<SwFormatAnchor&>(pFormat->GetAnchor());
196  if ( rFormatAnchor.GetContentAnchor() )
197  rFormatAnchor.SetAnchor( nullptr );
198 }
199 
200 /*
201  * exported methods
202  */
204  : m_pNodes(new SwNodes(*this)),
205  mpAttrPool(new SwAttrPool(this)),
206  maOLEModifiedIdle( "sw::SwDoc maOLEModifiedIdle" ),
207  mpMarkManager(new ::sw::mark::MarkManager(*this)),
208  m_pMetaFieldManager(new ::sw::MetaFieldManager()),
209  m_pDocumentDrawModelManager( new ::sw::DocumentDrawModelManager( *this ) ),
210  m_pDocumentRedlineManager( new ::sw::DocumentRedlineManager( *this ) ),
211  m_pDocumentStateManager( new ::sw::DocumentStateManager( *this ) ),
212  m_pUndoManager(new ::sw::UndoManager(
213  std::shared_ptr<SwNodes>(new SwNodes(*this)), *m_pDocumentDrawModelManager, *m_pDocumentRedlineManager, *m_pDocumentStateManager)),
214  m_pDocumentSettingManager(new ::sw::DocumentSettingManager(*this)),
215  m_pDocumentChartDataProviderManager( new sw::DocumentChartDataProviderManager( *this ) ),
216  m_pDeviceAccess( new ::sw::DocumentDeviceManager( *this ) ),
217  m_pDocumentTimerManager( new ::sw::DocumentTimerManager( *this ) ),
218  m_pDocumentLinksAdministrationManager( new ::sw::DocumentLinksAdministrationManager( *this ) ),
219  m_pDocumentListItemsManager( new ::sw::DocumentListItemsManager() ),
220  m_pDocumentListsManager( new ::sw::DocumentListsManager( *this ) ),
221  m_pDocumentOutlineNodesManager( new ::sw::DocumentOutlineNodesManager( *this ) ),
222  m_pDocumentContentOperationsManager( new ::sw::DocumentContentOperationsManager( *this ) ),
223  m_pDocumentFieldsManager( new ::sw::DocumentFieldsManager( *this ) ),
224  m_pDocumentStatisticsManager( new ::sw::DocumentStatisticsManager( *this ) ),
225  m_pDocumentLayoutManager( new ::sw::DocumentLayoutManager( *this ) ),
226  m_pDocumentStylePoolManager( new ::sw::DocumentStylePoolManager( *this ) ),
227  m_pDocumentExternalDataManager( new ::sw::DocumentExternalDataManager ),
228  mpDfltFrameFormat( new SwFrameFormat( GetAttrPool(), "Frameformat", nullptr ) ),
229  mpEmptyPageFormat( new SwFrameFormat( GetAttrPool(), "Empty Page", mpDfltFrameFormat.get() ) ),
230  mpColumnContFormat( new SwFrameFormat( GetAttrPool(), "Columncontainer", mpDfltFrameFormat.get() ) ),
231  mpDfltCharFormat( new SwCharFormat( GetAttrPool(), DEFAULT_CHAR_FORMAT_NAME, nullptr ) ),
232  mpDfltTextFormatColl( new SwTextFormatColl( GetAttrPool(), "Paragraph style" ) ),
233  mpDfltGrfFormatColl( new SwGrfFormatColl( GetAttrPool(), "Graphikformatvorlage" ) ),
234  mpFrameFormatTable( new SwFrameFormats() ),
235  mpCharFormatTable( new SwCharFormats ),
236  mpSpzFrameFormatTable( new SwFrameFormats() ),
237  mpSectionFormatTable( new SwSectionFormats ),
238  mpTableFrameFormatTable( new SwFrameFormats() ),
239  mpTextFormatCollTable( new SwTextFormatColls() ),
240  mpGrfFormatCollTable( new SwGrfFormatColls() ),
241  mpTOXTypes( new SwTOXTypes ),
242  mpDefTOXBases( new SwDefTOXBase_Impl() ),
243  mpOutlineRule( nullptr ),
244  mpFootnoteInfo( new SwFootnoteInfo ),
245  mpEndNoteInfo( new SwEndNoteInfo ),
246  mpLineNumberInfo( new SwLineNumberInfo ),
247  mpFootnoteIdxs( new SwFootnoteIdxs ),
248  mpDocShell( nullptr ),
249  mpNumberFormatter( nullptr ),
250  mpNumRuleTable( new SwNumRuleTable ),
251  mpExtInputRing( nullptr ),
252  mpGrammarContact(createGrammarContact()),
253  mpCellStyles(new SwCellStyleTable),
254  mReferenceCount(0),
255  mbDtor(false),
256  mbCopyIsMove(false),
257  mbInReading(false),
258  mbInWriting(false),
259  mbInMailMerge(false),
260  mbInXMLImport(false),
261  mbInWriterfilterImport(false),
262  mbUpdateTOX(false),
263  mbInLoadAsynchron(false),
264  mbIsAutoFormatRedline(false),
265  mbOLEPrtNotifyPending(false),
266  mbAllOLENotify(false),
267  mbInsOnlyTextGlssry(false),
268  mbContains_MSVBasic(false),
269  mbClipBoard( false ),
270  mbColumnSelection( false ),
271  mbIsPrepareSelAll(false),
272  meDictionaryMissing( MissingDictionary::Undefined ),
273  mbContainsAtPageObjWithContentAnchor(false), //#i119292#, fdo#37024
274 
275  meDocType(DOCTYPE_NATIVE)
276 {
277  // The DrawingLayer ItemPool which is used as 2nd pool for Writer documents' pool
278  // has a default for the XFillStyleItem of XFILL_SOLID and the color for it is the default
279  // fill color (blue7 or similar). This is a problem, in Writer we want the default fill
280  // style to be drawing::FillStyle_NONE. This cannot simply be done by changing it in the 2nd pool at the
281  // pool defaults when the DrawingLayer ItemPool is used for Writer, that would lead to
282  // countless problems like DrawObjects initial fill and others.
283  // It is also hard to find all places where the initial ItemSets for Writer (including
284  // style hierarchies) are created and to always set (but only at the root) the FillStyle
285  // to NONE fixed; that will add that attribute to the file format. It will be hard to reset
286  // attribute sets (which is done at import and using UI). Also not a good solution.
287  // Luckily Writer uses pDfltTextFormatColl as default parent for all paragraphs and similar, thus
288  // it is possible to set this attribute here. It will be not reset when importing.
289  mpDfltTextFormatColl->SetFormatAttr(XFillStyleItem(drawing::FillStyle_NONE));
290  mpDfltFrameFormat->SetFormatAttr(XFillStyleItem(drawing::FillStyle_NONE));
291  // prevent paragraph default margins being applied to everything
294 
295  /*
296  * DefaultFormats and DefaultFormatCollections (FormatColl)
297  * are inserted at position 0 at the respective array.
298  * The formats in the FormatColls are derived from the
299  * DefaultFormats and are also in the list.
300  */
301  /* Formats */
302  mpFrameFormatTable->push_back(mpDfltFrameFormat.get());
303  mpCharFormatTable->insert(mpDfltCharFormat.get());
304 
305  /* FormatColls */
306  // TXT
308  // GRF
309  mpGrfFormatCollTable->push_back(mpDfltGrfFormatColl.get());
310 
311  // Create PageDesc, EmptyPageFormat and ColumnFormat
312  if (m_PageDescs.empty())
314 
315  // Set to "Empty Page"
317  // Set BodyFormat for columns
319 
321 
322  // Create a default OutlineNumRule (for Filters)
324  // #i89178#
326  OUTLINE_RULE );
328  // Counting of phantoms depends on <IsOldNumbering()>
330 
331  new SwTextNode(
332  SwNodeIndex(GetUndoManager().GetUndoNodes().GetEndOfContent()),
333  mpDfltTextFormatColl.get() );
334  new SwTextNode( SwNodeIndex( GetNodes().GetEndOfContent() ),
335  getIDocumentStylePoolAccess().GetTextCollFromPool( RES_POOLCOLL_STANDARD ));
336 
337  maOLEModifiedIdle.SetPriority( TaskPriority::LOWEST );
338  maOLEModifiedIdle.SetInvokeHandler( LINK( this, SwDoc, DoUpdateModifiedOLE ));
339 
340 #if HAVE_FEATURE_DBCONNECTIVITY && !ENABLE_FUZZERS
341  // Create DBManager
342  m_pOwnDBManager.reset(new SwDBManager(this));
344 #else
345  m_pDBManager = nullptr;
346 #endif
347 
348  // create TOXTypes
349  InitTOXTypes();
350 
351  // pass empty item set containing the paragraph's list attributes
352  // as ignorable items to the stype manager.
353  {
354  SfxItemSetFixed<RES_PARATR_LIST_BEGIN, RES_PARATR_LIST_END-1> aIgnorableParagraphItems( GetAttrPool() );
355  mpStyleAccess = createStyleManager( &aIgnorableParagraphItems );
356  }
357 
358  static bool bHack = (getenv("LIBO_ONEWAY_STABLE_ODF_EXPORT") != nullptr);
359 
360  if (bHack)
361  {
362  mnRsid = 0;
363  }
364  else
365  {
366  // Initialize the session id of the current document to a random number
367  // smaller than 2^21.
369  }
370  mnRsidRoot = mnRsid;
371 
373  {
374  // Make sure that in case the document language is not set, then we don't return
375  // LANGUAGE_DONTKNOW, but the UI locale.
376  const SvtLinguConfig aLinguConfig;
377  SvtLinguOptions aOptions;
378  aLinguConfig.GetOptions(aOptions);
380  i18n::ScriptType::LATIN);
383  i18n::ScriptType::ASIAN);
386  i18n::ScriptType::COMPLEX);
388  }
389 
391 }
392 
399 {
400  // nothing here should create Undo actions!
401  GetIDocumentUndoRedo().DoUndo(false);
402 
403  if (mpDocShell)
404  {
405  mpDocShell->SetUndoManager(nullptr);
406  }
407 
408  mpGrammarContact.reset();
409 
410  getIDocumentTimerAccess().StopIdling(); // stop idle timer
411 
412  mpURLStateChgd.reset();
413 
414  // Deactivate Undo notification from Draw
415  if( GetDocumentDrawModelManager().GetDrawModel() )
416  {
418  ClrContourCache();
419  }
420 
421  m_pPgPViewPrtData.reset();
422 
423  mbDtor = true;
424 
425  //Clear the redline table before the nodes array is destroyed
428 
429  const sw::UnoCursorHint aHint;
431  for(const auto& pWeakCursor : mvUnoCursorTable)
432  {
433  auto pCursor(pWeakCursor.lock());
434  if(pCursor)
435  pCursor->m_aNotifier.Broadcast(aHint);
436  }
437  mpACEWord.reset();
438 
439  // Release the BaseLinks
440  {
441  ::sfx2::SvLinkSources aTemp(getIDocumentLinksAdministration().GetLinkManager().GetServers());
442  for( const auto& rpLinkSrc : aTemp )
443  rpLinkSrc->Closed();
444 
445  if( !getIDocumentLinksAdministration().GetLinkManager().GetLinks().empty() )
447  }
448 
449  // The ChapterNumbers/Numbers need to be deleted before the styles
450  // or we update all the time!
451  m_pNodes->m_pOutlineNodes->clear();
452  SwNodes & rUndoNodes( GetUndoManager().GetUndoNodes() );
453  rUndoNodes.m_pOutlineNodes->clear();
454 
455  mpFootnoteIdxs->clear();
456 
457  // indices could be registered in attributes
458  m_pUndoManager->DelAllUndoObj();
459 
460  // The BookMarks contain indices to the Content. These must be deleted
461  // before deleting the Nodes.
462  mpMarkManager->clearAllMarks();
463 
464  if( mpExtInputRing )
465  {
466  SwPaM* pTmp = mpExtInputRing;
467  mpExtInputRing = nullptr;
468  while( pTmp->GetNext() != pTmp )
469  delete pTmp->GetNext();
470  delete pTmp;
471  }
472 
473  // Any of the FrameFormats can still have indices registered.
474  // These need to be destroyed now at the latest.
475  for( SwFrameFormat* pFormat : *mpFrameFormatTable )
476  lcl_DelFormatIndices( pFormat );
477  for( SwFrameFormat* pFormat : *mpSpzFrameFormatTable )
478  lcl_DelFormatIndices( pFormat );
479  for( SwSectionFormat* pFormat : *mpSectionFormatTable )
480  lcl_DelFormatIndices( pFormat );
481 
482  // The formats/styles that follow depend on the default formats.
483  // Destroy these only after destroying the FormatIndices, because the content
484  // of headers/footers has to be deleted as well. If in the headers/footers
485  // there are still Flys registered at that point, we have a problem.
486  for( SwPageDesc *pPageDesc : m_PageDescs )
487  delete pPageDesc;
488  m_PageDescs.clear();
489 
490  // Delete content selections.
491  // Don't wait for the SwNodes dtor to destroy them; so that Formats
492  // do not have any dependencies anymore.
493  m_pNodes->DelNodes( SwNodeIndex(*m_pNodes), m_pNodes->Count() );
494  rUndoNodes.DelNodes( SwNodeIndex( rUndoNodes ), rUndoNodes.Count() );
495 
496  // clear TOX after nodes - TOXMarks are gone now so SwTOXType has no clients
497  for (const auto& pType : *mpTOXTypes)
498  {
499  pType->CallSwClientNotify(sw::DocumentDyingHint());
500  }
501  mpTOXTypes->clear();
502  mpDefTOXBases.reset();
503 
504  // Delete Formats, make it permanent some time in the future
505 
506  // Delete for Collections
507  // So that we get rid of the dependencies
508  mpFootnoteInfo->EndListeningAll();
509  mpEndNoteInfo->EndListeningAll();
510 
511  assert(mpDfltTextFormatColl.get() == (*mpTextFormatCollTable)[0]
512  && "Default-Text-Collection must always be at the start");
513 
514  // Optimization: Based on the fact that Standard is always 2nd in the
515  // array, we should delete it as the last. With this we avoid
516  // reparenting the Formats all the time!
517  if( 2 < mpTextFormatCollTable->size() )
518  mpTextFormatCollTable->DeleteAndDestroy(2, mpTextFormatCollTable->size());
519  mpTextFormatCollTable->DeleteAndDestroy(1, mpTextFormatCollTable->size());
520  mpTextFormatCollTable.reset();
521 
522  assert(mpDfltGrfFormatColl.get() == (*mpGrfFormatCollTable)[0]
523  && "DefaultGrfCollection must always be at the start");
524 
525  mpGrfFormatCollTable->DeleteAndDestroy(1, mpGrfFormatCollTable->size());
526  mpGrfFormatCollTable.reset();
527 
528  // Without explicitly freeing the DocumentDeviceManager
529  // and relying on the implicit freeing there would be a crash
530  // due to it happening after SwAttrPool is freed.
531  m_pDeviceAccess.reset();
532 
533  /*
534  * DefaultFormats and DefaultFormatCollections (FormatColl)
535  * are at position 0 of their respective arrays.
536  * In order to not be deleted by the array's dtor, we remove them
537  * now.
538  */
539  mpFrameFormatTable->erase( mpFrameFormatTable->begin() );
540 
541 #if HAVE_FEATURE_DBCONNECTIVITY && !ENABLE_FUZZERS
542  // On load, SwDBManager::setEmbeddedName() may register a data source.
543  // If we have an embedded one, then sDataSource points to the registered name, so revoke it here.
544  if (!m_pOwnDBManager->getEmbeddedName().isEmpty() && !maDBData.sDataSource.isEmpty())
545  {
546  // Remove the revoke listener here first, so that we don't remove the data source from the document.
547  m_pOwnDBManager->releaseRevokeListener();
550  }
551  else if (!m_pOwnDBManager->getEmbeddedName().isEmpty())
552  {
553  // Remove the revoke listener here first, so that we don't remove the data source from the document.
554  m_pOwnDBManager->releaseRevokeListener();
555  // Remove connections which was committed but not used.
556  m_pOwnDBManager->RevokeNotUsedConnections();
557  }
558 
559  m_pOwnDBManager.reset();
560 #endif
561 
562  // All Flys need to be destroyed before the Drawing Model,
563  // because Flys can still contain DrawContacts, when no
564  // Layout could be constructed due to a read error.
565  mpSpzFrameFormatTable->DeleteAndDestroyAll();
566 
567  // Only now destroy the Model, the drawing objects - which are also
568  // contained in the Undo - need to remove their attributes from the
569  // Model. Also, DrawContacts could exist before this.
571  // Destroy DrawModel before the LinkManager, because it's always set
572  // in the DrawModel.
573  //The LinkManager gets destroyed automatically with m_pLinksAdministrationManager
574 
575  // Clear the Tables before deleting the defaults, or we crash due to
576  // dependencies on defaults.
577  mpFrameFormatTable.reset();
578  mpSpzFrameFormatTable.reset();
579 
580  mpStyleAccess.reset();
581 
582  mpCharFormatTable.reset();
583  mpSectionFormatTable.reset();
584  mpTableFrameFormatTable.reset();
585  mpDfltTextFormatColl.reset();
586  mpDfltGrfFormatColl.reset();
587  mpNumRuleTable.reset();
588 
589  disposeXForms(); // #i113606#, dispose the XForms objects
590 
591  {
592  std::scoped_lock lock(mNumberFormatterMutex);
593  delete mpNumberFormatter; mpNumberFormatter= nullptr;
594  }
595  mpFootnoteInfo.reset();
596  mpEndNoteInfo.reset();
597  mpLineNumberInfo.reset();
598  mpFootnoteIdxs.reset();
599  mpTOXTypes.reset();
600  mpEmptyPageFormat.reset();
601  mpColumnContFormat.reset();
602  mpDfltCharFormat.reset();
603  mpDfltFrameFormat.reset();
604  mpLayoutCache.reset();
605  mpAttrPool.clear();
606 }
607 
609 {
610  if( mpDocShell == pDSh )
611  return;
612 
613  if (mpDocShell)
614  {
615  mpDocShell->SetUndoManager(nullptr);
616  }
617  mpDocShell = pDSh;
618  if (mpDocShell)
619  {
622  }
623 
625 
626  // set DocShell pointer also on DrawModel
628  assert(!GetDocumentDrawModelManager().GetDrawModel() ||
629  GetDocumentDrawModelManager().GetDrawModel()->GetPersist() == GetPersist());
630 }
631 
632 // Convenience method; to avoid excessive includes from docsh.hxx
633 uno::Reference < embed::XStorage > SwDoc::GetDocStorage()
634 {
635  if( mpDocShell )
636  return mpDocShell->GetStorage();
637  if( getIDocumentLinksAdministration().GetLinkManager().GetPersist() )
639  return nullptr;
640 }
641 
643 {
645 }
646 
648 {
650  ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo());
651 
652  // Deactivate Undo notification from Draw
653  if( GetDocumentDrawModelManager().GetDrawModel() )
654  {
656  ClrContourCache();
657  }
658 
659  // if there are still FlyFrames dangling around, delete them too
660  while ( !mpSpzFrameFormatTable->empty() )
662  assert(!GetDocumentDrawModelManager().GetDrawModel()
663  || !GetDocumentDrawModelManager().GetDrawModel()->GetPage(0)->GetObjCount());
664 
667 
668  mpACEWord.reset();
669 
670  // The BookMarks contain indices to the Content. These must be deleted
671  // before deleting the Nodes.
672  mpMarkManager->clearAllMarks();
673  InitTOXTypes();
674 
675  // create a dummy pagedesc for the layout
676  SwPageDesc* pDummyPgDsc = MakePageDesc("?DUMMY?");
677 
678  SwNodeIndex aSttIdx( *GetNodes().GetEndOfContent().StartOfSectionNode(), 1 );
679  // create the first one over and over again (without attributes/style etc.
680  SwTextNode* pFirstNd = GetNodes().MakeTextNode( aSttIdx, mpDfltTextFormatColl.get() );
681 
683  {
684  // set the layout to the dummy pagedesc
685  pFirstNd->SetAttr( SwFormatPageDesc( pDummyPgDsc ));
686 
687  SwPosition aPos( *pFirstNd, SwIndex( pFirstNd ));
688  SwPaM const tmpPaM(aSttIdx, SwNodeIndex(GetNodes().GetEndOfContent()));
689  ::PaMCorrAbs(tmpPaM, aPos);
690  }
691 
692  GetNodes().Delete( aSttIdx,
693  GetNodes().GetEndOfContent().GetIndex() - aSttIdx.GetIndex() );
694 
695  // #i62440#
696  // destruction of numbering rules and creation of new outline rule
697  // *after* the document nodes are deleted.
698  mpOutlineRule = nullptr;
699  for( SwNumRule* pNumRule : *mpNumRuleTable )
700  {
701  getIDocumentListsAccess().deleteListForListStyle(pNumRule->GetName());
702  delete pNumRule;
703  }
704  mpNumRuleTable->clear();
705  maNumRuleMap.clear();
706 
707  // creation of new outline numbering rule
709  // #i89178#
711  OUTLINE_RULE );
713  // Counting of phantoms depends on <IsOldNumbering()>
715 
716  // remove the dummy pagedesc from the array and delete all the old ones
717  size_t nDummyPgDsc = 0;
718  if (FindPageDesc(pDummyPgDsc->GetName(), &nDummyPgDsc))
719  m_PageDescs.erase( nDummyPgDsc );
720  for( SwPageDesc *pPageDesc : m_PageDescs )
721  delete pPageDesc;
722  m_PageDescs.clear();
723 
724  // Delete for Collections
725  // So that we get rid of the dependencies
726  mpFootnoteInfo->EndListeningAll();
727  mpEndNoteInfo->EndListeningAll();
728 
729  // Optimization: Based on the fact that Standard is always 2nd in the
730  // array, we should delete it as the last. With this we avoid
731  // reparenting the Formats all the time!
732  if( 2 < mpTextFormatCollTable->size() )
733  mpTextFormatCollTable->DeleteAndDestroy(2, mpTextFormatCollTable->size());
734  mpTextFormatCollTable->DeleteAndDestroy(1, mpTextFormatCollTable->size());
735  mpGrfFormatCollTable->DeleteAndDestroy(1, mpGrfFormatCollTable->size());
736  mpCharFormatTable->DeleteAndDestroyAll(/*keepDefault*/true);
737 
738  if( getIDocumentLayoutAccess().GetCurrentViewShell() )
739  {
740  // search the FrameFormat of the root frm. This is not allowed to delete
741  mpFrameFormatTable->erase( getIDocumentLayoutAccess().GetCurrentViewShell()->GetLayout()->GetFormat() );
742  mpFrameFormatTable->DeleteAndDestroyAll( true );
743  mpFrameFormatTable->push_back( getIDocumentLayoutAccess().GetCurrentViewShell()->GetLayout()->GetFormat() );
744  }
745  else
746  mpFrameFormatTable->DeleteAndDestroyAll( true );
747 
749 
750  {
751  std::scoped_lock lock(mNumberFormatterMutex);
752  delete mpNumberFormatter; mpNumberFormatter= nullptr;
753  }
754 
756  pFirstNd->ChgFormatColl( getIDocumentStylePoolAccess().GetTextCollFromPool( RES_POOLCOLL_STANDARD ));
757  nDummyPgDsc = m_PageDescs.size();
758  m_PageDescs.push_back( pDummyPgDsc );
759  // set the layout back to the new standard pagedesc
760  pFirstNd->ResetAllAttr();
761  // delete now the dummy pagedesc
762  DelPageDesc( nDummyPgDsc );
763 }
764 
766 {
767  if( pNew )
768  {
769  if (m_pPgPViewPrtData)
770  {
771  *m_pPgPViewPrtData = *pNew;
772  }
773  else
774  {
775  m_pPgPViewPrtData.reset(new SwPagePreviewPrtData(*pNew));
776  }
777  }
778  else if (m_pPgPViewPrtData)
779  {
780  m_pPgPViewPrtData.reset();
781  }
783 }
784 
786 {
787  if( getIDocumentLayoutAccess().GetCurrentViewShell() ) maOLEModifiedIdle.Start();
788 }
789 
792 {
793  if( !mpLayoutCache )
794  mpLayoutCache.reset( new SwLayoutCache() );
795  if( !mpLayoutCache->IsLocked() )
796  {
797  mpLayoutCache->GetLockCount() |= 0x8000;
798  mpLayoutCache->Read( rStream );
799  mpLayoutCache->GetLockCount() &= 0x7fff;
800  }
801 }
802 
804 {
805  SwLayoutCache::Write( rStream, *this );
806 }
807 
809 {
810  const SwDoc& rDoc = rTextNode.GetDoc();
811  if (rDoc.IsInDtor())
812  return nullptr;
813  return rDoc.getGrammarContact();
814 }
815 
818 {
819  // UGLY: this relies on SetClipBoard being called before GetXmlIdRegistry!
820  if (!m_pXmlIdRegistry)
821  {
823  }
824  return *m_pXmlIdRegistry;
825 }
826 
828 {
830  SwTOXType* pNew = new SwTOXType(*this, TOX_CONTENT, pShellRes->aTOXContentName);
831  mpTOXTypes->emplace_back( pNew );
832  pNew = new SwTOXType(*this, TOX_INDEX, pShellRes->aTOXIndexName);
833  mpTOXTypes->emplace_back( pNew );
834  pNew = new SwTOXType(*this, TOX_USER, pShellRes->aTOXUserName);
835  mpTOXTypes->emplace_back( pNew );
836  pNew = new SwTOXType(*this, TOX_ILLUSTRATIONS, pShellRes->aTOXIllustrationsName);
837  mpTOXTypes->emplace_back( pNew );
838  pNew = new SwTOXType(*this, TOX_OBJECTS, pShellRes->aTOXObjectsName);
839  mpTOXTypes->emplace_back( pNew );
840  pNew = new SwTOXType(*this, TOX_TABLES, pShellRes->aTOXTablesName);
841  mpTOXTypes->emplace_back( pNew );
842  pNew = new SwTOXType(*this, TOX_AUTHORITIES, pShellRes->aTOXAuthoritiesName);
843  mpTOXTypes->emplace_back( pNew );
844  pNew = new SwTOXType(*this, TOX_CITATION, pShellRes->aTOXCitationName);
845  mpTOXTypes->emplace_back( pNew );
846 }
847 
848 void SwDoc::ReplaceDefaults(const SwDoc& rSource)
849 {
850  // copy property defaults
851  static const WhichRangesContainer aRangeOfDefaults(svl::Items<
858  >);
859 
860  SfxItemSet aNewDefaults(GetAttrPool(), aRangeOfDefaults);
861 
862  for (const WhichPair& rPair : aRangeOfDefaults)
863  {
864  for (sal_uInt16 nWhich = rPair.first;
865  nWhich <= rPair.second; ++nWhich)
866  {
867  const SfxPoolItem& rSourceAttr =
868  rSource.mpAttrPool->GetDefaultItem(nWhich);
869  if (rSourceAttr != mpAttrPool->GetDefaultItem(nWhich))
870  aNewDefaults.Put(rSourceAttr);
871  }
872  }
873 
874  if (aNewDefaults.Count())
875  SetDefault(aNewDefaults);
876 }
877 
879 {
880  m_pDocumentSettingManager->ReplaceCompatibilityOptions(rSource.GetDocumentSettingManager());
881 }
882 
883 #ifdef DBG_UTIL
884 #define CNTNT_DOC( doc ) \
885  ((doc)->GetNodes().GetEndOfContent().GetIndex() - (doc)->GetNodes().GetEndOfExtras().GetIndex() - SwNodeOffset(2))
886 #define CNTNT_IDX( idx ) \
887  ((idx).GetNode().GetIndex() - GetNodes().GetEndOfExtras().GetIndex() - 1)
888 #endif
889 
890 SfxObjectShell* SwDoc::CreateCopy( bool bCallInitNew, bool bEmpty ) const
891 {
892  SAL_INFO( "sw.pageframe", "(SwDoc::CreateCopy in" );
893  rtl::Reference<SwDoc> xRet( new SwDoc );
894 
895  // we have to use pointer here, since the callee has to decide whether
896  // SfxObjectShellLock or SfxObjectShellRef should be used sometimes the
897  // object will be returned with refcount set to 0 ( if no DoInitNew is done )
898  SfxObjectShell* pRetShell = new SwDocShell( *xRet, SfxObjectCreateMode::STANDARD );
899  if( bCallInitNew )
900  {
901  // it could happen that DoInitNew creates model,
902  // that increases the refcount of the object
903  pRetShell->DoInitNew();
904  }
905 
906  xRet->ReplaceDefaults(*this);
907 
908  xRet->ReplaceCompatibilityOptions(*this);
909 
910  xRet->ReplaceStyles(*this);
911 
912  if( !bEmpty )
913  {
914 #ifdef DBG_UTIL
915  SAL_INFO( "sw.createcopy", "CC-Nd-Src: " << CNTNT_DOC( this ) );
916  SAL_INFO( "sw.createcopy", "CC-Nd: " << CNTNT_DOC( xRet ) );
917 #endif
918  xRet->AppendDoc(*this, 0, bCallInitNew, 0, 0);
919 #ifdef DBG_UTIL
920  SAL_INFO( "sw.createcopy", "CC-Nd: " << CNTNT_DOC( xRet ) );
921 #endif
922  }
923 
924  // remove the temporary shell if it is there as it was done before
925  xRet->SetTmpDocShell( nullptr );
926 
927  SAL_INFO( "sw.pageframe", "SwDoc::CreateCopy out)" );
928  return pRetShell;
929 }
930 
931 // save bulk letters as single documents
932 static OUString lcl_FindUniqueName(SwWrtShell* pTargetShell, std::u16string_view rStartingPageDesc, sal_uLong nDocNo )
933 {
934  do
935  {
936  OUString sTest = rStartingPageDesc + OUString::number( nDocNo );
937  if( !pTargetShell->FindPageDescByName( sTest ) )
938  return sTest;
939  ++nDocNo;
940  }
941  while( true );
942 }
943 
947 {
948  // remember already checked page descs to avoid cycle
949  o3tl::sorted_vector<const SwPageDesc*> aCheckedPageDescs;
950  const SwPageDesc* pCurPageDesc = &rPageDesc;
951  while (aCheckedPageDescs.count(pCurPageDesc) == 0)
952  {
953  const SwFrameFormat& rMaster = pCurPageDesc->GetMaster();
954  if (rMaster.GetHeader().IsActive() || rMaster.GetFooter().IsActive())
955  return true;
956 
957  aCheckedPageDescs.insert(pCurPageDesc);
958  pCurPageDesc = pCurPageDesc->GetFollow();
959  }
960  return false;
961 }
962 
964  SwWrtShell& rTargetShell,
965  const SwPageDesc& rSourcePageDesc,
966  const SwPageDesc& rTargetPageDesc,
967  const sal_uLong nDocNo )
968 {
969  //now copy the follow page desc, too
970  // note: these may at any point form a cycle, so a loop is needed and it
971  // must be detected that the last iteration closes the cycle and doesn't
972  // copy the first page desc of the cycle again.
973  std::map<OUString, OUString> followMap{ { rSourcePageDesc.GetName(), rTargetPageDesc.GetName() } };
974  SwPageDesc const* pCurSourcePageDesc(&rSourcePageDesc);
975  SwPageDesc const* pCurTargetPageDesc(&rTargetPageDesc);
976  do
977  {
978  const SwPageDesc* pFollowPageDesc = pCurSourcePageDesc->GetFollow();
979  OUString sFollowPageDesc = pFollowPageDesc->GetName();
980  if (sFollowPageDesc == pCurSourcePageDesc->GetName())
981  {
982  break;
983  }
984  SwDoc* pTargetDoc = rTargetShell.GetDoc();
985  SwPageDesc* pTargetFollowPageDesc(nullptr);
986  auto const itMapped(followMap.find(sFollowPageDesc));
987  if (itMapped == followMap.end())
988  {
989  OUString sNewFollowPageDesc = lcl_FindUniqueName(&rTargetShell, sFollowPageDesc, nDocNo);
990  pTargetFollowPageDesc = pTargetDoc->MakePageDesc(sNewFollowPageDesc);
991  pTargetDoc->CopyPageDesc(*pFollowPageDesc, *pTargetFollowPageDesc, false);
992  }
993  else
994  {
995  pTargetFollowPageDesc = pTargetDoc->FindPageDesc(itMapped->second);
996  }
997  SwPageDesc aDesc(*pCurTargetPageDesc);
998  aDesc.SetFollow(pTargetFollowPageDesc);
999  pTargetDoc->ChgPageDesc(pCurTargetPageDesc->GetName(), aDesc);
1000  if (itMapped != followMap.end())
1001  {
1002  break; // was already copied
1003  }
1004  pCurSourcePageDesc = pCurSourcePageDesc->GetFollow();
1005  pCurTargetPageDesc = pTargetFollowPageDesc;
1006  followMap[pCurSourcePageDesc->GetName()] = pCurTargetPageDesc->GetName();
1007  }
1008  while (true);
1009 }
1010 
1011 // appends all pages of source SwDoc - based on SwFEShell::Paste( SwDoc* )
1012 SwNodeIndex SwDoc::AppendDoc(const SwDoc& rSource, sal_uInt16 const nStartPageNumber,
1013  bool const bDeletePrevious, int pageOffset, const sal_uLong nDocNo)
1014 {
1015  SAL_INFO( "sw.pageframe", "(SwDoc::AppendDoc in " << bDeletePrevious );
1016 
1017  // GetEndOfExtras + 1 = StartOfContent == no content node!
1018  // This ensures it won't be merged in the SwTextNode at the position.
1019  SwNodeIndex aSourceIdx( rSource.GetNodes().GetEndOfExtras(), 1 );
1020  // CopyRange works on the range a [mark, point[ and considers an
1021  // index < point outside the selection.
1022  // @see IDocumentContentOperations::CopyRange
1023  SwNodeIndex aSourceEndIdx( rSource.GetNodes().GetEndOfContent(), 0 );
1024  SwPaM aCpyPam( aSourceIdx, aSourceEndIdx );
1025 
1026 #ifdef DBG_UTIL
1027  SAL_INFO( "sw.docappend", "NodeType 0x" << std::hex << static_cast<int>(aSourceIdx.GetNode().GetNodeType())
1028  << std::dec << " " << aSourceIdx.GetNode().GetIndex() );
1029  aSourceIdx++;
1030  SAL_INFO( "sw.docappend", "NodeType 0x" << std::hex << static_cast<int>(aSourceIdx.GetNode().GetNodeType())
1031  << std::dec << " " << aSourceIdx.GetNode().GetIndex() );
1032  if ( aSourceIdx.GetNode().GetNodeType() != SwNodeType::End ) {
1033  aSourceIdx++;
1034  SAL_INFO( "sw.docappend", "NodeType 0x" << std::hex << static_cast<int>(aSourceIdx.GetNode().GetNodeType()) << std::dec );
1035  aSourceIdx--;
1036  }
1037  aSourceIdx--;
1038  SAL_INFO( "sw.docappend", ".." );
1039  SAL_INFO( "sw.docappend", "NodeType 0x" << std::hex << static_cast<int>(aSourceEndIdx.GetNode().GetNodeType())
1040  << std::dec << " " << aSourceEndIdx.GetNode().GetIndex() );
1041  SAL_INFO( "sw.docappend", "NodeType 0x" << std::hex << static_cast<int>(aSourceEndIdx.GetNode().GetNodeType())
1042  << std::dec << " " << aSourceEndIdx.GetNode().GetIndex() );
1043  SAL_INFO( "sw.docappend", "Src-Nd: " << CNTNT_DOC( &rSource ) );
1044  SAL_INFO( "sw.docappend", "Nd: " << CNTNT_DOC( this ) );
1045 #endif
1046 
1047  SwWrtShell* pTargetShell = GetDocShell()->GetWrtShell();
1048  SwPageDesc* pTargetPageDesc = nullptr;
1049 
1050  if ( pTargetShell ) {
1051 #ifdef DBG_UTIL
1052  SAL_INFO( "sw.docappend", "Has target write shell" );
1053 #endif
1054  pTargetShell->StartAllAction();
1055 
1056  if( nDocNo > 0 )
1057  {
1058  // #i72517# put the styles to the target document
1059  // if the source uses headers or footers the target document
1060  // needs individual page styles
1061  const SwWrtShell *pSourceShell = rSource.GetDocShell()->GetWrtShell();
1062  const SwPageDesc& rSourcePageDesc = pSourceShell->GetPageDesc(
1063  pSourceShell->GetCurPageDesc());
1064  const OUString sStartingPageDesc = rSourcePageDesc.GetName();
1065  const bool bPageStylesWithHeaderFooter = lcl_PageDescOrFollowContainsHeaderFooter(rSourcePageDesc);
1066  if( bPageStylesWithHeaderFooter )
1067  {
1068  // create a new pagestyle
1069  // copy the pagedesc from the current document to the new
1070  // document and change the name of the to-be-applied style
1071  OUString sNewPageDescName = lcl_FindUniqueName(pTargetShell, sStartingPageDesc, nDocNo );
1072  pTargetPageDesc = MakePageDesc( sNewPageDescName );
1073  if( pTargetPageDesc )
1074  {
1075  CopyPageDesc( rSourcePageDesc, *pTargetPageDesc, false );
1076  lcl_CopyFollowPageDesc( *pTargetShell, rSourcePageDesc, *pTargetPageDesc, nDocNo );
1077  }
1078  }
1079  else
1080  pTargetPageDesc = pTargetShell->FindPageDescByName( sStartingPageDesc );
1081  }
1082 
1083  // Otherwise we have to handle SwPlaceholderNodes as first node
1084  if ( pTargetPageDesc )
1085  {
1086  SwNodeIndex aBreakIdx( GetNodes().GetEndOfContent(), -1 );
1087  SwPosition aBreakPos( aBreakIdx );
1088  // insert new node - will be removed at the end...
1089  // (don't SplitNode() as it may move flys to the wrong node)
1091  SwFormatPageDesc pageDesc(pTargetPageDesc);
1092  pageDesc.SetNumOffset(nStartPageNumber);
1093  // set break on the last paragraph
1095  pageDesc, SetAttrMode::DEFAULT, pTargetShell->GetLayout());
1096 
1097  // There is now a new empty text node on the new page. If it has
1098  // any marks, those are from the previous page: move them back
1099  // there, otherwise later we can't delete that empty text node.
1100  SwNodeIndex aNodeIndex(GetNodes().GetEndOfContent(), -1);
1101  if (SwTextNode* pTextNode = aNodeIndex.GetNode().GetTextNode())
1102  {
1103  // Position of the last paragraph on the previous page.
1104  --aNodeIndex;
1105  SwPaM aPaM(aNodeIndex);
1106  // Collect the marks starting or ending at this text node.
1109  for (const SwIndex* pIndex = pTextNode->GetFirstIndex(); pIndex; pIndex = pIndex->GetNext())
1110  {
1111  sw::mark::IMark* pMark = const_cast<sw::mark::IMark*>(pIndex->GetMark());
1112  if (!pMark)
1113  continue;
1114  if (!aSeenMarks.insert(pMark).second)
1115  continue;
1116  }
1117  // And move them back.
1118  for (sw::mark::IMark* pMark : aSeenMarks)
1119  pMarkAccess->repositionMark(pMark, aPaM);
1120  }
1121 
1122  // Flush the page break, if we want to keep it
1123  if ( !bDeletePrevious )
1124  {
1125  SAL_INFO( "sw.pageframe", "(Flush pagebreak AKA EndAllAction" );
1126  pTargetShell->EndAllAction();
1127  SAL_INFO( "sw.pageframe", "Flush changes AKA EndAllAction)" );
1128  pTargetShell->StartAllAction();
1129  }
1130  }
1131  }
1132 #ifdef DBG_UTIL
1133  SAL_INFO( "sw.docappend", "Nd: " << CNTNT_DOC( this ) );
1134 #endif
1135 
1136  // -1, otherwise aFixupIdx would move to new EOC
1137  SwNodeIndex aFixupIdx( GetNodes().GetEndOfContent(), -1 );
1138 
1139  // append at the end of document / content
1140  SwNodeIndex aTargetIdx( GetNodes().GetEndOfContent() );
1141  SwPaM aInsertPam( aTargetIdx );
1142 
1143 #ifdef DBG_UTIL
1144  SAL_INFO( "sw.docappend", "Pam-Nd: " << aCpyPam.GetNode().GetIndex() - aCpyPam.GetNode( false ).GetIndex() + 1
1145  << " (0x" << std::hex << static_cast<int>(aCpyPam.GetNode( false ).GetNodeType()) << std::dec
1146  << " " << aCpyPam.GetNode( false ).GetIndex()
1147  << " - 0x" << std::hex << static_cast<int>(aCpyPam.GetNode().GetNodeType()) << std::dec
1148  << " " << aCpyPam.GetNode().GetIndex() << ")" );
1149 #endif
1150 
1153 
1154  // Position where the appended doc starts. Will be filled in later.
1155  // Initially uses GetEndOfContent() because SwNodeIndex has no default ctor.
1156  SwNodeIndex aStartAppendIndex( GetNodes().GetEndOfContent() );
1157 
1158  {
1159  // **
1160  // ** refer to SwFEShell::Paste, if you change the following code **
1161  // **
1162 
1163  SwPosition& rInsPos = *aInsertPam.GetPoint();
1164 
1165  {
1166  SwNodeIndex aIndexBefore(rInsPos.nNode);
1167 
1168  aIndexBefore--;
1169 #ifdef DBG_UTIL
1170  SAL_INFO( "sw.docappend", "CopyRange In: " << CNTNT_DOC( this ) );
1171 #endif
1173  // Note: aCpyPam is invalid now
1174 #ifdef DBG_UTIL
1175  SAL_INFO( "sw.docappend", "CopyRange Out: " << CNTNT_DOC( this ) );
1176 #endif
1177 
1178  ++aIndexBefore;
1179  SwPaM aPaM(SwPosition(aIndexBefore),
1180  SwPosition(rInsPos.nNode));
1181 
1182  aPaM.GetDoc().MakeUniqueNumRules(aPaM);
1183 
1184  // Update the rsid of each pasted text node
1185  SwNodes &rDestNodes = GetNodes();
1186  SwNodeOffset const nEndIdx = aPaM.End()->nNode.GetIndex();
1187 
1188  for (SwNodeOffset nIdx = aPaM.Start()->nNode.GetIndex();
1189  nIdx <= nEndIdx; ++nIdx)
1190  {
1191  SwTextNode *const pTextNode = rDestNodes[nIdx]->GetTextNode();
1192  if ( pTextNode )
1193  UpdateParRsid( pTextNode );
1194  }
1195  }
1196 
1197  {
1198  SwNodeOffset iDelNodes(0);
1199  SwNodeIndex aDelIdx( aFixupIdx );
1200 
1201  // we just need to set the new page description and reset numbering
1202  // this keeps all other settings as in the pasted document
1203  if ( nStartPageNumber || pTargetPageDesc ) {
1204  std::unique_ptr<SfxPoolItem> pNewItem;
1205  SwTextNode *aTextNd = nullptr;
1206  SwFormat *pFormat = nullptr;
1207 
1208  // find the first node allowed to contain a RES_PAGEDESC
1209  while (true) {
1210  aFixupIdx++;
1211 
1212  SwNode &node = aFixupIdx.GetNode();
1213  if ( node.IsTextNode() ) {
1214  // every document contains at least one text node!
1215  aTextNd = node.GetTextNode();
1216  pNewItem.reset(aTextNd->GetAttr( RES_PAGEDESC ).Clone());
1217  break;
1218  }
1219  else if ( node.IsTableNode() ) {
1220  pFormat = node.GetTableNode()->GetTable().GetFrameFormat();
1221  pNewItem.reset(pFormat->GetFormatAttr( RES_PAGEDESC ).Clone());
1222  break;
1223  }
1224  }
1225 
1226 #ifdef DBG_UTIL
1227  SAL_INFO( "sw.docappend", "Idx Del " << CNTNT_IDX( aDelIdx ) );
1228  SAL_INFO( "sw.docappend", "Idx Fix " << CNTNT_IDX( aFixupIdx ) );
1229 #endif
1230  // just update the original instead of overwriting
1231  SwFormatPageDesc *aDesc = static_cast< SwFormatPageDesc* >( pNewItem.get() );
1232 #ifdef DBG_UTIL
1233  if ( aDesc->GetPageDesc() )
1234  SAL_INFO( "sw.docappend", "PD Update " << aDesc->GetPageDesc()->GetName() );
1235  else
1236  SAL_INFO( "sw.docappend", "PD New" );
1237 #endif
1238  if ( nStartPageNumber )
1239  aDesc->SetNumOffset( nStartPageNumber );
1240  if ( pTargetPageDesc )
1241  aDesc->RegisterToPageDesc( *pTargetPageDesc );
1242  if ( aTextNd )
1243  aTextNd->SetAttr( *aDesc );
1244  else
1245  pFormat->SetFormatAttr( *aDesc );
1246 
1247 #ifdef DBG_UTIL
1248  SAL_INFO( "sw.docappend", "Idx " << CNTNT_IDX( aDelIdx ) );
1249 #endif
1250  iDelNodes++;
1251  }
1252 
1253  if ( bDeletePrevious )
1254  iDelNodes++;
1255 
1256  if ( iDelNodes ) {
1257  // delete leading empty page(s), e.g. from InsertPageBreak or
1258  // new SwDoc. this has to be done before copying the page bound
1259  // frames, otherwise the drawing layer gets confused.
1260  if ( pTargetShell )
1261  pTargetShell->SttEndDoc( false );
1262  aDelIdx -= iDelNodes - 1;
1263 #ifdef DBG_UTIL
1264  SAL_INFO( "sw.docappend", "iDelNodes: " << iDelNodes
1265  << " Idx: " << aDelIdx.GetNode().GetIndex()
1266  << " EOE: " << GetNodes().GetEndOfExtras().GetIndex() );
1267 #endif
1268  GetNodes().Delete( aDelIdx, iDelNodes );
1269  aStartAppendIndex = aFixupIdx;
1270  }
1271  else
1272  {
1273  aStartAppendIndex = aFixupIdx;
1274  ++aStartAppendIndex;
1275  }
1276  }
1277 
1278  // finally copy page bound frames
1279  for ( auto pCpyFormat : *rSource.GetSpzFrameFormats() )
1280  {
1281  const SwFrameFormat& rCpyFormat = *pCpyFormat;
1282  SwFormatAnchor aAnchor( rCpyFormat.GetAnchor() );
1283  if (RndStdIds::FLY_AT_PAGE != aAnchor.GetAnchorId())
1284  continue;
1285  SAL_INFO( "sw.docappend", "PaAn: " << aAnchor.GetPageNum()
1286  << " => " << aAnchor.GetPageNum() + pageOffset );
1287  if ( pageOffset != 0 )
1288  aAnchor.SetPageNum( aAnchor.GetPageNum() + pageOffset );
1289  getIDocumentLayoutAccess().CopyLayoutFormat( rCpyFormat, aAnchor, true, true );
1290  }
1291  }
1292 
1294 
1297 
1298  if ( pTargetShell )
1299  pTargetShell->EndAllAction();
1300 
1301  SAL_INFO( "sw.pageframe", "SwDoc::AppendDoc out)" );
1302  return aStartAppendIndex;
1303 }
1304 
1305 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
css::uno::Reference< css::embed::XStorage > GetDocStorage()
Definition: docnew.cxx:633
::sfx2::IXmlIdRegistry * createXmlIdRegistry(const bool i_DocIsClipboard)
const std::unique_ptr< ::sw::UndoManager > m_pUndoManager
Definition: doc.hxx:216
sal_uInt32 mnRsidRoot
Definition: doc.hxx:297
SwNodeIndex AppendDoc(const SwDoc &rSource, sal_uInt16 nStartPageNumber, bool bDeletePrevious, int physicalPageOffset, const sal_uLong nDocNo)
Definition: docnew.cxx:1012
constexpr TypedWhichId< SwFormatPageDesc > RES_PAGEDESC(93)
SwPageDescs m_PageDescs
Definition: doc.hxx:198
bool bVisible
Represents the style of a paragraph.
Definition: fmtcol.hxx:56
std::unique_ptr< SwDefTOXBase_Impl > mpDefTOXBases
Definition: doc.hxx:249
Marks a position in the document model.
Definition: pam.hxx:36
Pagedescriptor Client of SwPageDesc that is "described" by the attribute.
Definition: fmtpdsc.hxx:35
bool UpdateParRsid(SwTextNode *pTextNode, sal_uInt32 nVal=0)
Definition: docfmt.cxx:436
void SetOLEObjModified()
update all modified OLE-Objects.
Definition: docnew.cxx:785
SwPageDesc * GetPageDesc()
Definition: fmtpdsc.hxx:61
static constexpr auto Items
const SwFormatHeader & GetHeader(bool=true) const
Definition: fmthdft.hxx:97
static ShellResource * GetShellRes()
Definition: viewsh.cxx:2652
IGrammarContact * getGrammarContact() const
Definition: doc.hxx:1555
bool SttEndDoc(bool bStt)
Definition: crsrsh.cxx:573
virtual sal_uInt16 ResetAllAttr() override
Definition: ndtxt.cxx:5116
SwDocShell * GetDocShell()
Definition: doc.hxx:1352
size_type count(const Value &v) const
virtual bool SetAttr(const SfxPoolItem &) override
overriding to handle change of certain paragraph attributes
Definition: ndtxt.cxx:4850
std::pair< sal_uInt16, sal_uInt16 > WhichPair
static void Write(SvStream &rStream, const SwDoc &rDoc)
writes the index (more precise: the difference between the index and the first index of the document ...
Definition: laycache.cxx:163
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const =0
void DelPageDesc(const OUString &rName, bool bBroadcast=false)
Definition: docdesc.cxx:964
SwNodeIndex nNode
Definition: pam.hxx:38
constexpr OUStringLiteral DEFAULT_CHAR_FORMAT_NAME
Definition: docnew.cxx:118
SwDBManager * m_pDBManager
Definition: doc.hxx:252
Idle maOLEModifiedIdle
Definition: doc.hxx:203
static bool lcl_PageDescOrFollowContainsHeaderFooter(const SwPageDesc &rPageDesc)
Returns whether the passed SwPageDesc& or any of its (transitive) follows contains a header or footer...
Definition: docnew.cxx:946
std::unique_ptr< SwNodes > m_pNodes
Definition: doc.hxx:196
virtual void SetModified()=0
Must be called manually at changes of format.
sal_uIntPtr sal_uLong
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_LANGUAGE(10)
OUString sDataSource
Definition: swdbdata.hxx:30
virtual SwUndoId EndUndo(SwUndoId const eUndoId, SwRewriter const *const pRewriter)=0
Closes undo block.
Provides access to the marks of a document.
Definition: doc.hxx:188
constexpr sal_uInt16 RES_FRMATR_END(133)
virtual void StopIdling()=0
Stop idle processing.
IDocumentLinksAdministration const & getIDocumentLinksAdministration() const
Definition: doc.cxx:260
virtual SwFrameFormat * CopyLayoutFormat(const SwFrameFormat &rSrc, const SwFormatAnchor &rNewAnchor, bool bSetTextFlyAtt, bool bMakeFrames)=0
LanguageType nDefaultLanguage_CJK
void SetDocShell(SwDocShell *pDocShell)
Definition: docundo.cxx:92
static LanguageType resolveSystemLanguageByScriptType(LanguageType nLang, sal_Int16 nType)
SwNode & GetNode() const
Definition: ndindex.hxx:121
Content, content of frame (header, footer, fly).
Definition: fmtcntnt.hxx:31
void ReplaceCompatibilityOptions(const SwDoc &rSource)
Definition: docnew.cxx:878
IDocumentMarkAccess * getIDocumentMarkAccess()
Definition: docbm.cxx:1790
Dialog to specify the properties of date form field.
IDocumentUndoRedo & GetIDocumentUndoRedo()
Definition: doc.cxx:144
virtual bool InsertPoolItem(const SwPaM &rRg, const SfxPoolItem &, const SetAttrMode nFlags=SetAttrMode::DEFAULT, SwRootFrame const *pLayout=nullptr, SwTextAttr **ppNewTextAttr=nullptr)=0
Insert an attribute.
rtl::Reference< SwAttrPool > mpAttrPool
Definition: doc.hxx:197
std::unordered_map< OUString, SwNumRule * > maNumRuleMap
Definition: doc.hxx:273
std::unique_ptr< IStyleAccess > mpStyleAccess
Definition: doc.hxx:278
SfxObjectShell * GetPersist() const
~SwDoc()
Speciality: a member of the class SwDoc is located at position 0 in the array of the Format and GDI o...
Definition: docnew.cxx:398
IDocumentContentOperations const & getIDocumentContentOperations() const
Definition: doc.cxx:315
void SetPageNum(sal_uInt16 nNew)
Definition: fmtanchr.hxx:72
void EndAllAction()
Definition: edws.cxx:97
OUString aTOXIndexName
Definition: shellres.hxx:53
SwTableFormat * GetFrameFormat()
Definition: swtable.hxx:205
const SwFrameFormats * GetSpzFrameFormats() const
Definition: doc.hxx:744
void SetNewContentIdx(const SwNodeIndex *pIdx)
Definition: atrfrm.cxx:595
OUString aTOXAuthoritiesName
Definition: shellres.hxx:59
void SetFollow(const SwPageDesc *pNew)
Definition: pagedesc.hxx:314
unsigned int uniform_uint_distribution(unsigned int a, unsigned int b)
const OUString & GetName() const
Definition: pagedesc.hxx:196
const SwIndex * GetNext() const
Definition: index.hxx:98
bool IsActive() const
Definition: fmthdft.hxx:89
Array of Undo-history.
Definition: docary.hxx:192
virtual void LockExpFields()=0
css::uno::Reference< css::embed::XStorage > const & GetStorage()
Used by the UI to modify the document model.
Definition: wrtsh.hxx:93
std::unique_ptr< SwURLStateChanged > mpURLStateChgd
Definition: doc.hxx:265
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
Definition: doc.cxx:357
IGrammarContact * getGrammarContact(const SwTextNode &rTextNode)
getGrammarContact() delivers the grammar contact of the document (for a given textnode) ...
Definition: docnew.cxx:808
SwTableNode * GetTableNode()
Definition: node.hxx:603
constexpr sal_uInt16 RES_PARATR_BEGIN(RES_TXTATR_END)
std::unique_ptr< SwFrameFormats > mpTableFrameFormatTable
Definition: doc.hxx:244
void DelNodes(const SwNodeIndex &rStart, SwNodeOffset nCnt=SwNodeOffset(1))
Delete a number of nodes.
Definition: nodes.cxx:1339
void cleanupUnoCursorTable() const
Definition: doc.hxx:1643
void ReplaceDefaults(const SwDoc &rSource)
Definition: docnew.cxx:848
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_CTL_LANGUAGE(29)
IDocumentStylePoolAccess const & getIDocumentStylePoolAccess() const
Definition: doc.cxx:426
void ReadLayoutCache(SvStream &rStream)
SwDoc: Reading and writing of the layout cache.
Definition: docnew.cxx:791
check if target position is in fly anchored at source range
std::unique_ptr< SwNumRuleTable > mpNumRuleTable
Definition: doc.hxx:270
static bool IsFuzzing()
std::unique_ptr< IGrammarContact > mpGrammarContact
Definition: doc.hxx:282
virtual void DelLayoutFormat(SwFrameFormat *pFormat)=0
virtual void DelAllUndoObj()=0
Delete all Undo actions.
std::unique_ptr< ::sw::DocumentDeviceManager > m_pDeviceAccess
Definition: doc.hxx:219
virtual void DoUndo(bool const bDoUndo)=0
Enable/Disable Undo.
sal_uInt32 mnRsid
Definition: doc.hxx:296
::sfx2::IXmlIdRegistry & GetXmlIdRegistry()
Definition: docnew.cxx:817
std::unique_ptr< SwFrameFormats > mpSpzFrameFormatTable
Definition: doc.hxx:242
OUString aTOXIllustrationsName
Definition: shellres.hxx:56
const SwTable & GetTable() const
Definition: node.hxx:500
SwDocShell * mpDocShell
Definition: doc.hxx:260
SwDoc * GetDoc() const
Definition: viewsh.hxx:282
void SetUndoManager(SfxUndoManager *pNewUndoMgr)
o3tl::sorted_vector< SwRootFrame * > GetAllLayouts()
Definition: doclay.cxx:1670
SwNodeOffset GetIndex() const
Definition: ndindex.hxx:154
bool mbDtor
TRUE: is in SwDoc DTOR.
Definition: doc.hxx:301
void InitTOXTypes()
Definition: docnew.cxx:827
SwPaM * GetNext()
Definition: pam.hxx:265
std::unique_ptr< SwOutlineNodes > m_pOutlineNodes
Array of all outline nodes.
Definition: ndarr.hxx:109
virtual SwPageDesc * GetPageDescFromPool(sal_uInt16 nId, bool bRegardLanguage=true)=0
Return required automatic page style.
Specific frame formats (frames, DrawObjects).
SwPageDesc * FindPageDesc(const OUString &rName, size_t *pPos=nullptr) const
Definition: docdesc.cxx:941
static void RevokeDataSource(const OUString &rName)
Unregister a data source.
Definition: dbmgr.cxx:2879
Base class for various Writer styles.
Definition: format.hxx:46
SwNode & GetEndOfContent() const
Regular ContentSection (i.e. the BodyText).
Definition: ndarr.hxx:162
SwDBData maDBData
Definition: doc.hxx:204
virtual void repositionMark(::sw::mark::IMark *io_pMark, const SwPaM &rPaM)=0
Moves an existing mark to a new selection and performs needed updates.
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:137
std::unique_ptr< SwTextFormatColls > mpTextFormatCollTable
Definition: doc.hxx:245
void AddNumRule(SwNumRule *pRule)
Add numbering rule to document.
Definition: docnum.cxx:2490
Style of a layout element.
Definition: frmfmt.hxx:59
::sw::UndoManager & GetUndoManager()
Definition: doc.cxx:133
virtual SwUndoId StartUndo(SwUndoId const eUndoId, SwRewriter const *const pRewriter)=0
Opens undo block.
void SetPreviewPrtData(const SwPagePreviewPrtData *pData)
Definition: docnew.cxx:765
virtual const SwExtraRedlineTable & GetExtraRedlineTable() const =0
void MakeUniqueNumRules(const SwPaM &rPaM)
Definition: docnum.cxx:1234
std::unique_ptr< SwTOXTypes > mpTOXTypes
Definition: doc.hxx:248
void erase(const value_type &x)
Definition: pagedesc.cxx:765
const SwFormatAnchor & GetAnchor(bool=true) const
Definition: fmtanchr.hxx:81
bool HasGrammarChecker() const
OUString aTOXObjectsName
Definition: shellres.hxx:57
SwDoc & GetDoc()
Definition: node.hxx:213
const SwPosition * GetPoint() const
Definition: pam.hxx:208
virtual bool CopyRange(SwPaM &rPam, SwPosition &rPos, SwCopyFlags flags) const =0
Copy a selected content range to a position.
std::unique_ptr< SwLayoutCache > mpLayoutCache
Layout cache to read and save with the document for a faster formatting.
Definition: doc.hxx:279
void Remove(SvBaseLink const *pLink)
void GetOptions(SvtLinguOptions &rOptions) const
void InitDrawModelAndDocShell(SwDocShell *pSwDocShell, SwDrawModel *pSwDrawDocument)
Definition: docshdrw.cxx:32
constexpr sal_uInt16 RES_PARATR_LIST_END(88)
std::vector< std::weak_ptr< SwUnoCursor > > mvUnoCursorTable
Definition: doc.hxx:1640
std::unique_ptr< SwEndNoteInfo > mpEndNoteInfo
Definition: doc.hxx:256
const SwPosition * GetContentAnchor() const
Definition: fmtanchr.hxx:67
const std::unique_ptr< ::sw::mark::MarkManager > mpMarkManager
Definition: doc.hxx:211
void DeleteAndDestroyAll()
Definition: docredln.cxx:642
static void lcl_CopyFollowPageDesc(SwWrtShell &rTargetShell, const SwPageDesc &rSourcePageDesc, const SwPageDesc &rTargetPageDesc, const sal_uLong nDocNo)
Definition: docnew.cxx:963
bool IsVisible() const
SfxObjectShell * CreateCopy(bool bCallInitNew, bool bEmpty) const
Definition: docnew.cxx:890
constexpr sal_uInt16 XATTR_START
SwNodeOffset GetIndex() const
Definition: node.hxx:292
SwPageDesc * MakePageDesc(const OUString &rName, const SwPageDesc *pCpy=nullptr, bool bRegardLanguage=true, bool bBroadcast=false)
Definition: docdesc.cxx:759
sal_uInt16 Count() const
FlyAnchors.
Definition: fmtanchr.hxx:34
std::unique_ptr< SwDBManager > m_pOwnDBManager
Definition: doc.hxx:251
const SwPageDesc & GetPageDesc(size_t i) const
Definition: fedesc.cxx:126
std::unique_ptr< SwTextFormatColl > mpDfltTextFormatColl
Definition: doc.hxx:237
static SfxViewFrame * GetNext(const SfxViewFrame &rPrev, const SfxObjectShell *pDoc=nullptr, bool bOnlyVisible=true)
std::unique_ptr< SwFrameFormat > mpColumnContFormat
Definition: doc.hxx:235
Marks a character position inside a document model node.
Definition: index.hxx:33
float u
virtual SwFormatColl * ChgFormatColl(SwFormatColl *) override
Definition: ndtxt.cxx:3901
const SwFormatFooter & GetFooter(bool=true) const
Definition: fmthdft.hxx:99
css::uno::Reference< css::linguistic2::XProofreadingIterator > m_xGCIterator
Definition: doc.hxx:209
static OUString GetOutlineRuleName()
Definition: number.cxx:81
css::uno::Reference< css::frame::XModel3 > GetBaseModel() const
IDocumentState const & getIDocumentState() const
Definition: doc.cxx:394
virtual void deleteListForListStyle(const OUString &rListStyleName)=0
OUString aTOXCitationName
Definition: shellres.hxx:60
void WriteLayoutCache(SvStream &rStream)
Definition: docnew.cxx:803
SwWrtShell * GetWrtShell()
Access to the SwWrtShell belonging to SwView.
Definition: docsh.hxx:225
std::mutex mNumberFormatterMutex
Definition: doc.hxx:267
void ChgPageDesc(const OUString &rName, const SwPageDesc &)
Definition: docdesc.cxx:972
size
SwNumRule * mpOutlineRule
Definition: doc.hxx:254
std::unique_ptr< SwPagePreviewPrtData > m_pPgPViewPrtData
Definition: doc.hxx:275
Marks a node in the document model.
Definition: ndindex.hxx:32
constexpr sal_uInt16 RES_UNKNOWNATR_END(154)
OUString aTOXContentName
Definition: shellres.hxx:55
void SetLanguage(const LanguageType eLang, const sal_uInt16 nId)
Definition: doc.cxx:1825
void SetCountPhantoms(bool bCountPhantoms)
Definition: number.cxx:1089
std::unique_ptr< SwGrfFormatColls > mpGrfFormatCollTable
Definition: doc.hxx:246
constexpr sal_uInt16 XATTR_END
void SetDocShell(SwDocShell *pDSh)
Definition: docnew.cxx:608
Represents the style of a text portion.
Definition: charfmt.hxx:26
std::unique_ptr< SwFrameFormat > mpEmptyPageFormat
Definition: doc.hxx:234
Frame cannot be moved in Var-direction.
SvNumberFormatter * mpNumberFormatter
Definition: doc.hxx:268
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
Definition: doc.cxx:405
virtual SotClipboardFormatId GetFormat(const TransferableDataHelper &aHelper) override
const SwPosition * Start() const
Definition: pam.hxx:213
static void lcl_DelFormatIndices(SwFormat const *pFormat)
Definition: docnew.cxx:190
copy break attributes even when source is single node
OUString aTOXUserName
Definition: shellres.hxx:54
< purpose of derivation from SwClient: character style for displaying the numbers.
Definition: lineinfo.hxx:37
css::uno::Reference< css::linguistic2::XProofreadingIterator > const & GetGCIterator() const
Definition: docnew.cxx:123
const SwPageDesc * GetFollow() const
Definition: pagedesc.hxx:267
const SwNodeIndex * GetContentIdx() const
Definition: fmtcntnt.hxx:46
constexpr sal_uInt16 RES_UNKNOWNATR_BEGIN(RES_BOXATR_END)
void disposeXForms()
Definition: docxforms.cxx:89
virtual bool SetFormatAttr(const SfxPoolItem &rAttr)
Definition: format.cxx:450
std::unique_ptr< SwSectionFormats > mpSectionFormatTable
Definition: doc.hxx:243
std::unique_ptr< ::sfx2::IXmlIdRegistry > m_pXmlIdRegistry
Definition: doc.hxx:292
void SetDefault(const SfxPoolItem &)
Set attribute as new default attribute in current document.
Definition: docfmt.cxx:540
SwFrameFormat & GetMaster()
Definition: pagedesc.hxx:238
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:79
void CopyPageDesc(const SwPageDesc &rSrcDesc, SwPageDesc &rDstDesc, bool bCopyPoolIds=true)
Copy the complete PageDesc - beyond document and "deep"! Optionally copying of PoolFormatId, -HlpId can be prevented.
Definition: docfmt.cxx:1429
SwDoc()
Definition: docnew.cxx:203
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
Definition: doc.cxx:335
std::unique_ptr< SwAutoCorrExceptWord > mpACEWord
For the automated takeover of auto-corrected words that are "re-corrected".
Definition: doc.hxx:263
constexpr sal_uInt16 RES_CHRATR_BEGIN(HINT_BEGIN)
SvxNumberFormat::SvxNumPositionAndSpaceMode GetDefaultPositionAndSpaceMode()
Definition: number.cxx:1539
static OUString lcl_FindUniqueName(SwWrtShell *pTargetShell, std::u16string_view rStartingPageDesc, sal_uLong nDocNo)
Definition: docnew.cxx:932
std::unique_ptr< SwCharFormat > mpDfltCharFormat
Definition: doc.hxx:236
virtual const SwViewShell * GetCurrentViewShell() const =0
Returns the layout set at the document.
void ClrContourCache(const SdrObject *pObj)
Definition: txtfly.cxx:134
void ClearDoc()
Definition: docnew.cxx:647
#define SAL_INFO(area, stream)
std::unique_ptr< SwCharFormats > mpCharFormatTable
Definition: doc.hxx:241
LanguageType nDefaultLanguage
bool IsClipBoard() const
Definition: doc.hxx:963
constexpr sal_uInt16 RES_PARATR_LIST_BEGIN(RES_PARATR_END)
bool DoInitNew(SfxMedium *pMedium=nullptr)
SwNodes & GetNodes()
Definition: doc.hxx:409
const SwPosition * End() const
Definition: pam.hxx:218
::sw::DocumentSettingManager & GetDocumentSettingManager()
Definition: doc.cxx:186
std::unique_ptr< SwFrameFormats > mpFrameFormatTable
Definition: doc.hxx:240
constexpr sal_uInt16 RES_PARATR_END(82)
SfxObjectShell * GetPersist() const
Definition: docnew.cxx:642
void PaMCorrAbs(const SwPaM &rRange, const SwPosition &rNewPos)
Function declarations so that everything below the CursorShell can move the Cursor once in a while...
Definition: doccorr.cxx:86
void Delete(const SwNodeIndex &rPos, SwNodeOffset nNodes=SwNodeOffset(1))
delete nodes
Definition: nodes.cxx:1085
Organizer of the contact between SwTextNodes and grammar checker.
Reference< XComponentContext > getProcessComponentContext()
std::unique_ptr< SwFootnoteIdxs > mpFootnoteIdxs
Definition: doc.hxx:258
#define CNTNT_IDX(idx)
Definition: docnew.cxx:886
const SfxPoolItem & GetFormatAttr(sal_uInt16 nWhich, bool bInParents=true) const
If bInParents is FALSE, search only in this format for attribute.
Definition: format.cxx:369
void SetInvokeHandler(const Link< Timer *, void > &rLink)
::sw::DocumentDrawModelManager const & GetDocumentDrawModelManager() const
Definition: doc.cxx:165
constexpr TypedWhichId< SvxLRSpaceItem > RES_LR_SPACE(91)
virtual bool AppendTextNode(SwPosition &rPos)=0
constexpr sal_uInt16 RES_CHRATR_END(46)
const SwFormatContent & GetContent(bool=true) const
Definition: fmtcntnt.hxx:55
SwNodeOffset Count() const
Definition: ndarr.hxx:141
virtual sfx2::LinkManager & GetLinkManager()=0
SwPageDesc * FindPageDescByName(const OUString &rName, bool bGetFromPool=false, size_t *pPos=nullptr)
Definition: fedesc.cxx:131
virtual void Start(bool bStartTimer=true) override
#define CNTNT_DOC(doc)
Definition: docnew.cxx:884
void DeleteAndDestroyAll()
Definition: docredln.cxx:2053
bool IsInDtor() const
Definition: doc.hxx:404
static SfxViewFrame * GetFirst(const SfxObjectShell *pDoc=nullptr, bool bOnlyVisible=true)
bool empty() const
Definition: pagedesc.hxx:441
void SetNumOffset(const ::std::optional< sal_uInt16 > &oNum)
Definition: fmtpdsc.hxx:65
bool IsTableNode() const
Definition: node.hxx:644
void SetPriority(TaskPriority ePriority)
std::unique_ptr< SwFrameFormat > mpDfltFrameFormat
Definition: doc.hxx:233
std::unique_ptr< SwLineNumberInfo > mpLineNumberInfo
Definition: doc.hxx:257
std::unique_ptr< IStyleAccess > createStyleManager(SfxItemSet const *pIgnorableParagraphItems)
SwDoc & GetDoc() const
Definition: pam.hxx:244
const std::unique_ptr< ::sw::DocumentSettingManager > m_pDocumentSettingManager
Definition: doc.hxx:217
virtual void UnlockExpFields()=0
bool StartGrammarChecking(bool bSkipStart=false)
Definition: docnew.cxx:141
virtual void UpdateFields(bool bCloseDB)=0
virtual const SwRedlineTable & GetRedlineTable() const =0
bool IsActive() const
Definition: fmthdft.hxx:58
std::pair< const_iterator, bool > insert(Value &&x)
const SfxPoolItem & GetAttr(sal_uInt16 nWhich, bool bInParent=true) const
SS for PoolItems: hard attributation.
Definition: node.hxx:725
SwNode & GetEndOfExtras() const
This is the last EndNode of a special section.
Definition: ndarr.hxx:160
::sw::DocumentFieldsManager & GetDocumentFieldsManager()
Definition: doc.cxx:367
void StartAllAction()
For all views of this document.
Definition: edws.cxx:86
std::unique_ptr< SwFootnoteInfo > mpFootnoteInfo
Definition: doc.hxx:255
SwRootFrame * GetLayout() const
Definition: viewsh.cxx:2166
void RegisterToPageDesc(SwPageDesc &)
Definition: atrfrm.cxx:714
OUString aTOXTablesName
Definition: shellres.hxx:58
IDocumentListsAccess const & getIDocumentListsAccess() const
Definition: doc.cxx:293
LanguageType nDefaultLanguage_CTL
size_t GetCurPageDesc(const bool bCalcFrame=true) const
Definition: fedesc.cxx:167
bool IsTextNode() const
Definition: node.hxx:640
Standard page.
Definition: poolfmt.hxx:170
void SetPersist(SfxObjectShell *p)
constexpr sal_uInt16 RES_FRMATR_BEGIN(RES_PARATR_LIST_END)
std::shared_ptr< osl::Mutex > const & lock()
constexpr TypedWhichId< SvxULSpaceItem > RES_UL_SPACE(92)
IGrammarContact * createGrammarContact()
Factory for a grammar contact.
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_CJK_LANGUAGE(24)
SwExtTextInput * mpExtInputRing
Definition: doc.hxx:276
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1319
std::unique_ptr< SwGrfFormatColl > mpDfltGrfFormatColl
Definition: doc.hxx:238
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:856
IDocumentTimerAccess const & getIDocumentTimerAccess() const
Definition: doc.cxx:249
SwTextNode * MakeTextNode(const SwNodeIndex &rWhere, SwTextFormatColl *pColl, bool bNewFrames=true)
Implementations of "Make...Node" are in the given .cxx-files.
Definition: ndtxt.cxx:105
void SetAnchor(const SwPosition *pPos)
Definition: atrfrm.cxx:1584
MissingDictionary
Definition: doc.hxx:323
virtual void ResetModified()=0
Base class of the Writer document model elements.
Definition: node.hxx:81