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