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