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