LibreOffice Module sw (master)  1
docnew.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #include <sal/config.h>
21 
22 #include <mutex>
23 #include <string_view>
24 
25 #include <config_features.h>
26 #include <config_fuzzers.h>
27 
28 #include <o3tl/sorted_vector.hxx>
29 
30 #include <doc.hxx>
31 #include <proofreadingiterator.hxx>
32 #include <com/sun/star/text/XFlatParagraphIteratorProvider.hpp>
33 #include <com/sun/star/linguistic2/XProofreadingIterator.hpp>
34 #include <com/sun/star/frame/XModel.hpp>
35 #include <com/sun/star/i18n/ScriptType.hpp>
36 
38 #include <comphelper/random.hxx>
39 #include <sfx2/viewfrm.hxx>
40 #include <sfx2/XmlIdRegistry.hxx>
41 #include <sal/log.hxx>
42 #include <osl/diagnose.h>
43 
44 #include <sfx2/linkmgr.hxx>
45 #include <editeng/ulspitem.hxx>
46 #include <editeng/lrspitem.hxx>
47 #include <svl/numformat.hxx>
48 #include <svl/zforlist.hxx>
49 #include <unotools/lingucfg.hxx>
50 #include <svx/svdpage.hxx>
51 #include <fmtcntnt.hxx>
52 #include <fmtanchr.hxx>
53 #include <fmtfsize.hxx>
54 #include <fmtfordr.hxx>
55 #include <fmtpdsc.hxx>
56 #include <pvprtdat.hxx>
57 #include <rootfrm.hxx>
58 #include <pagedesc.hxx>
59 #include <ndtxt.hxx>
60 #include <ftninfo.hxx>
61 #include <ftnidx.hxx>
62 #include <charfmt.hxx>
63 #include <frmfmt.hxx>
64 #include <poolfmt.hxx>
65 #include <dbmgr.hxx>
66 #include <docsh.hxx>
67 #include <acorrect.hxx>
68 #include <visiturl.hxx>
69 #include <docary.hxx>
70 #include <lineinfo.hxx>
71 #include <drawdoc.hxx>
72 #include <extinput.hxx>
73 #include <viewsh.hxx>
74 #include <doctxm.hxx>
75 #include <shellres.hxx>
76 #include <laycache.hxx>
77 #include <mvsave.hxx>
78 #include <istyleaccess.hxx>
79 #include "swstylemanager.hxx"
80 #include <IGrammarContact.hxx>
81 #include <tblafmt.hxx>
82 #include <MarkManager.hxx>
83 #include <UndoManager.hxx>
88 #include <DocumentTimerManager.hxx>
91 #include <DocumentListsManager.hxx>
97 #include <DocumentStateManager.hxx>
101 #include <wrtsh.hxx>
102 #include <unocrsr.hxx>
103 #include <fmthdft.hxx>
104 #include <frameformats.hxx>
105 
106 #include <numrule.hxx>
107 
108 #include <sfx2/Metadatable.hxx>
109 #include <fmtmeta.hxx>
110 
111 #include <svx/xfillit0.hxx>
112 #include <unotools/configmgr.hxx>
113 #include <i18nlangtag/mslangid.hxx>
114 
115 using namespace ::com::sun::star;
116 using namespace ::com::sun::star::document;
117 
118 constexpr OUStringLiteral DEFAULT_CHAR_FORMAT_NAME = u"Character style";
119 
120 /*
121  * global functions...
122  */
123  uno::Reference< linguistic2::XProofreadingIterator > const & SwDoc::GetGCIterator() const
124 {
126  {
127  uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() );
128  try
129  {
131  }
132  catch (const uno::Exception &)
133  {
134  OSL_FAIL( "No GCIterator" );
135  }
136  }
137 
138  return m_xGCIterator;
139 }
140 
141 bool SwDoc::StartGrammarChecking( bool bSkipStart )
142 {
143  // check for a visible view
144  bool bVisible = false;
145  bool bStarted = false;
146  const SwDocShell *pDocShell = GetDocShell();
147  SfxViewFrame *pFrame = SfxViewFrame::GetFirst( pDocShell, false );
148  while (pFrame && !bVisible)
149  {
150  if (pFrame->IsVisible())
151  bVisible = true;
152  pFrame = SfxViewFrame::GetNext( *pFrame, pDocShell, false );
153  }
154 
159  if (bVisible)
160  {
161  uno::Reference< linguistic2::XProofreadingIterator > xGCIterator( GetGCIterator() );
162  if ( xGCIterator.is() )
163  {
164  uno::Reference< lang::XComponent > xDoc = GetDocShell()->GetBaseModel();
165  uno::Reference< text::XFlatParagraphIteratorProvider > xFPIP( xDoc, uno::UNO_QUERY );
166 
167  // start automatic background checking if not active already
168  if ( xFPIP.is() && !xGCIterator->isProofreading( xDoc ) )
169  {
170  bStarted = true;
171  if ( !bSkipStart )
172  {
173  for (auto pLayout : GetAllLayouts())
174  { // we're starting it now, don't start grammar checker
175  // again until the user modifies the document
176  pLayout->SetNeedGrammarCheck(false);
177  }
178  xGCIterator->startProofreading( xDoc, xFPIP );
179  }
180  }
181  }
182  }
183 
184  return bStarted;
185 }
186 
187 /*
188  * internal functions
189  */
190 static void lcl_DelFormatIndices( SwFormat const * pFormat )
191 {
192  SwFormatContent &rFormatContent = const_cast<SwFormatContent&>(pFormat->GetContent());
193  if ( rFormatContent.GetContentIdx() )
194  rFormatContent.SetNewContentIdx( nullptr );
195  SwFormatAnchor &rFormatAnchor = const_cast<SwFormatAnchor&>(pFormat->GetAnchor());
196  if ( rFormatAnchor.GetContentAnchor() )
197  rFormatAnchor.SetAnchor( nullptr );
198 }
199 
200 /*
201  * exported methods
202  */
204  : m_pNodes(new SwNodes(*this)),
205  mpAttrPool(new SwAttrPool(this)),
206  maOLEModifiedIdle( "sw::SwDoc maOLEModifiedIdle" ),
207  mpMarkManager(new ::sw::mark::MarkManager(*this)),
208  m_pMetaFieldManager(new ::sw::MetaFieldManager()),
209  m_pDocumentDrawModelManager( new ::sw::DocumentDrawModelManager( *this ) ),
210  m_pDocumentRedlineManager( new ::sw::DocumentRedlineManager( *this ) ),
211  m_pDocumentStateManager( new ::sw::DocumentStateManager( *this ) ),
212  m_pUndoManager(new ::sw::UndoManager(
213  std::shared_ptr<SwNodes>(new SwNodes(*this)), *m_pDocumentDrawModelManager, *m_pDocumentRedlineManager, *m_pDocumentStateManager)),
214  m_pDocumentSettingManager(new ::sw::DocumentSettingManager(*this)),
215  m_pDocumentChartDataProviderManager( new sw::DocumentChartDataProviderManager( *this ) ),
216  m_pDeviceAccess( new ::sw::DocumentDeviceManager( *this ) ),
217  m_pDocumentTimerManager( new ::sw::DocumentTimerManager( *this ) ),
218  m_pDocumentLinksAdministrationManager( new ::sw::DocumentLinksAdministrationManager( *this ) ),
219  m_pDocumentListItemsManager( new ::sw::DocumentListItemsManager() ),
220  m_pDocumentListsManager( new ::sw::DocumentListsManager( *this ) ),
221  m_pDocumentOutlineNodesManager( new ::sw::DocumentOutlineNodesManager( *this ) ),
222  m_pDocumentContentOperationsManager( new ::sw::DocumentContentOperationsManager( *this ) ),
223  m_pDocumentFieldsManager( new ::sw::DocumentFieldsManager( *this ) ),
224  m_pDocumentStatisticsManager( new ::sw::DocumentStatisticsManager( *this ) ),
225  m_pDocumentLayoutManager( new ::sw::DocumentLayoutManager( *this ) ),
226  m_pDocumentStylePoolManager( new ::sw::DocumentStylePoolManager( *this ) ),
227  m_pDocumentExternalDataManager( new ::sw::DocumentExternalDataManager ),
228  mpDfltFrameFormat( new SwFrameFormat( GetAttrPool(), "Frameformat", nullptr ) ),
229  mpEmptyPageFormat( new SwFrameFormat( GetAttrPool(), "Empty Page", mpDfltFrameFormat.get() ) ),
230  mpColumnContFormat( new SwFrameFormat( GetAttrPool(), "Columncontainer", mpDfltFrameFormat.get() ) ),
231  mpDfltCharFormat( new SwCharFormat( GetAttrPool(), DEFAULT_CHAR_FORMAT_NAME, nullptr ) ),
232  mpDfltTextFormatColl( new SwTextFormatColl( GetAttrPool(), "Paragraph style" ) ),
233  mpDfltGrfFormatColl( new SwGrfFormatColl( GetAttrPool(), "Graphikformatvorlage" ) ),
234  mpFrameFormatTable( new SwFrameFormats() ),
235  mpCharFormatTable( new SwCharFormats ),
236  mpSpzFrameFormatTable( new SwFrameFormats() ),
237  mpSectionFormatTable( new SwSectionFormats ),
238  mpTableFrameFormatTable( new SwFrameFormats() ),
239  mpTextFormatCollTable( new SwTextFormatColls() ),
240  mpGrfFormatCollTable( new SwGrfFormatColls() ),
241  mpTOXTypes( new SwTOXTypes ),
242  mpDefTOXBases( new SwDefTOXBase_Impl() ),
243  mpOutlineRule( nullptr ),
244  mpFootnoteInfo( new SwFootnoteInfo ),
245  mpEndNoteInfo( new SwEndNoteInfo ),
246  mpLineNumberInfo( new SwLineNumberInfo ),
247  mpFootnoteIdxs( new SwFootnoteIdxs ),
248  mpDocShell( nullptr ),
249  mpNumberFormatter( nullptr ),
250  mpNumRuleTable( new SwNumRuleTable ),
251  mpExtInputRing( nullptr ),
252  mpGrammarContact(createGrammarContact()),
253  mpCellStyles(new SwCellStyleTable),
254  mReferenceCount(0),
255  mbDtor(false),
256  mbCopyIsMove(false),
257  mbInReading(false),
258  mbInWriting(false),
259  mbInMailMerge(false),
260  mbInXMLImport(false),
261  mbInWriterfilterImport(false),
262  mbUpdateTOX(false),
263  mbInLoadAsynchron(false),
264  mbIsAutoFormatRedline(false),
265  mbOLEPrtNotifyPending(false),
266  mbAllOLENotify(false),
267  mbInsOnlyTextGlssry(false),
268  mbContains_MSVBasic(false),
269  mbClipBoard( false ),
270  mbColumnSelection( false ),
271  mbIsPrepareSelAll(false),
272  meDictionaryMissing( MissingDictionary::Undefined ),
273  mbContainsAtPageObjWithContentAnchor(false), //#i119292#, fdo#37024
274 
275  meDocType(DOCTYPE_NATIVE)
276 {
277  // The DrawingLayer ItemPool which is used as 2nd pool for Writer documents' pool
278  // has a default for the XFillStyleItem of XFILL_SOLID and the color for it is the default
279  // fill color (blue7 or similar). This is a problem, in Writer we want the default fill
280  // style to be drawing::FillStyle_NONE. This cannot simply be done by changing it in the 2nd pool at the
281  // pool defaults when the DrawingLayer ItemPool is used for Writer, that would lead to
282  // countless problems like DrawObjects initial fill and others.
283  // It is also hard to find all places where the initial ItemSets for Writer (including
284  // style hierarchies) are created and to always set (but only at the root) the FillStyle
285  // to NONE fixed; that will add that attribute to the file format. It will be hard to reset
286  // attribute sets (which is done at import and using UI). Also not a good solution.
287  // Luckily Writer uses pDfltTextFormatColl as default parent for all paragraphs and similar, thus
288  // it is possible to set this attribute here. It will be not reset when importing.
289  mpDfltTextFormatColl->SetFormatAttr(XFillStyleItem(drawing::FillStyle_NONE));
290  mpDfltFrameFormat->SetFormatAttr(XFillStyleItem(drawing::FillStyle_NONE));
291  // prevent paragraph default margins being applied to everything
294 
295  /*
296  * DefaultFormats and DefaultFormatCollections (FormatColl)
297  * are inserted at position 0 at the respective array.
298  * The formats in the FormatColls are derived from the
299  * DefaultFormats and are also in the list.
300  */
301  /* Formats */
302  mpFrameFormatTable->push_back(mpDfltFrameFormat.get());
303  mpCharFormatTable->insert(mpDfltCharFormat.get());
304 
305  /* FormatColls */
306  // TXT
308  // GRF
309  mpGrfFormatCollTable->push_back(mpDfltGrfFormatColl.get());
310 
311  // Create PageDesc, EmptyPageFormat and ColumnFormat
312  if (m_PageDescs.empty())
314 
315  // Set to "Empty Page"
317  // Set BodyFormat for columns
319 
321 
322  // Create a default OutlineNumRule (for Filters)
324  // #i89178#
326  OUTLINE_RULE );
328  // Counting of phantoms depends on <IsOldNumbering()>
330 
331  new SwTextNode(
332  SwNodeIndex(GetUndoManager().GetUndoNodes().GetEndOfContent()),
333  mpDfltTextFormatColl.get() );
334  new SwTextNode( SwNodeIndex( GetNodes().GetEndOfContent() ),
335  getIDocumentStylePoolAccess().GetTextCollFromPool( RES_POOLCOLL_STANDARD ));
336 
337  maOLEModifiedIdle.SetPriority( TaskPriority::LOWEST );
338  maOLEModifiedIdle.SetInvokeHandler( LINK( this, SwDoc, DoUpdateModifiedOLE ));
339 
340 #if HAVE_FEATURE_DBCONNECTIVITY && !ENABLE_FUZZERS
341  // Create DBManager
342  m_pOwnDBManager.reset(new SwDBManager(this));
344 #else
345  m_pDBManager = nullptr;
346 #endif
347 
348  // create TOXTypes
349  InitTOXTypes();
350 
351  // pass empty item set containing the paragraph's list attributes
352  // as ignorable items to the stype manager.
353  {
354  SfxItemSetFixed<RES_PARATR_LIST_BEGIN, RES_PARATR_LIST_END-1> aIgnorableParagraphItems( GetAttrPool() );
355  mpStyleAccess = createStyleManager( &aIgnorableParagraphItems );
356  }
357 
358  static bool bHack = (getenv("LIBO_ONEWAY_STABLE_ODF_EXPORT") != nullptr);
359 
360  if (bHack)
361  {
362  mnRsid = 0;
363  }
364  else
365  {
366  // Initialize the session id of the current document to a random number
367  // smaller than 2^21.
369  }
370  mnRsidRoot = mnRsid;
371 
373  {
374  // Make sure that in case the document language is not set, then we don't return
375  // LANGUAGE_DONTKNOW, but the UI locale.
376  const SvtLinguConfig aLinguConfig;
377  SvtLinguOptions aOptions;
378  aLinguConfig.GetOptions(aOptions);
380  i18n::ScriptType::LATIN);
383  i18n::ScriptType::ASIAN);
386  i18n::ScriptType::COMPLEX);
388  }
389 
391 }
392 
399 {
400  // nothing here should create Undo actions!
401  GetIDocumentUndoRedo().DoUndo(false);
402 
403  if (mpDocShell)
404  {
405  mpDocShell->SetUndoManager(nullptr);
406  }
407 
408  mpGrammarContact.reset();
409 
410  getIDocumentTimerAccess().StopIdling(); // stop idle timer
411 
412  mpURLStateChgd.reset();
413 
414  // Deactivate Undo notification from Draw
415  if( GetDocumentDrawModelManager().GetDrawModel() )
416  {
418  ClrContourCache();
419  }
420 
421  m_pPgPViewPrtData.reset();
422 
423  mbDtor = true;
424 
425  //Clear the redline table before the nodes array is destroyed
428 
429  const sw::UnoCursorHint aHint;
431  for(const auto& pWeakCursor : mvUnoCursorTable)
432  {
433  auto pCursor(pWeakCursor.lock());
434  if(pCursor)
435  pCursor->m_aNotifier.Broadcast(aHint);
436  }
437  mpACEWord.reset();
438 
439  // Release the BaseLinks
440  {
441  ::sfx2::SvLinkSources aTemp(getIDocumentLinksAdministration().GetLinkManager().GetServers());
442  for( const auto& rpLinkSrc : aTemp )
443  rpLinkSrc->Closed();
444 
445  if( !getIDocumentLinksAdministration().GetLinkManager().GetLinks().empty() )
447  }
448 
449  // The ChapterNumbers/Numbers need to be deleted before the styles
450  // or we update all the time!
451  m_pNodes->m_pOutlineNodes->clear();
452  SwNodes & rUndoNodes( GetUndoManager().GetUndoNodes() );
453  rUndoNodes.m_pOutlineNodes->clear();
454 
455  mpFootnoteIdxs->clear();
456 
457  // indices could be registered in attributes
458  m_pUndoManager->DelAllUndoObj();
459 
460  // The BookMarks contain indices to the Content. These must be deleted
461  // before deleting the Nodes.
462  mpMarkManager->clearAllMarks();
463 
464  if( mpExtInputRing )
465  {
466  SwPaM* pTmp = mpExtInputRing;
467  mpExtInputRing = nullptr;
468  while( pTmp->GetNext() != pTmp )
469  delete pTmp->GetNext();
470  delete pTmp;
471  }
472 
473  for(const auto& pType : *mpTOXTypes)
474  pType->CallSwClientNotify(sw::DocumentDyingHint());
475  mpTOXTypes->clear();
476  mpDefTOXBases.reset();
477 
478  // Any of the FrameFormats can still have indices registered.
479  // These need to be destroyed now at the latest.
480  for( SwFrameFormat* pFormat : *mpFrameFormatTable )
481  lcl_DelFormatIndices( pFormat );
482  for( SwFrameFormat* pFormat : *mpSpzFrameFormatTable )
483  lcl_DelFormatIndices( pFormat );
484  for( SwSectionFormat* pFormat : *mpSectionFormatTable )
485  lcl_DelFormatIndices( pFormat );
486 
487  // The formats/styles that follow depend on the default formats.
488  // Destroy these only after destroying the FormatIndices, because the content
489  // of headers/footers has to be deleted as well. If in the headers/footers
490  // there are still Flys registered at that point, we have a problem.
491  for( SwPageDesc *pPageDesc : m_PageDescs )
492  delete pPageDesc;
493  m_PageDescs.clear();
494 
495  // Delete content selections.
496  // Don't wait for the SwNodes dtor to destroy them; so that Formats
497  // do not have any dependencies anymore.
498  m_pNodes->DelNodes( SwNodeIndex(*m_pNodes), m_pNodes->Count() );
499  rUndoNodes.DelNodes( SwNodeIndex( rUndoNodes ), rUndoNodes.Count() );
500 
501  // Delete Formats, make it permanent some time in the future
502 
503  // Delete for Collections
504  // So that we get rid of the dependencies
505  mpFootnoteInfo->EndListeningAll();
506  mpEndNoteInfo->EndListeningAll();
507 
508  assert(mpDfltTextFormatColl.get() == (*mpTextFormatCollTable)[0]
509  && "Default-Text-Collection must always be at the start");
510 
511  // Optimization: Based on the fact that Standard is always 2nd in the
512  // array, we should delete it as the last. With this we avoid
513  // reparenting the Formats all the time!
514  if( 2 < mpTextFormatCollTable->size() )
515  mpTextFormatCollTable->DeleteAndDestroy(2, mpTextFormatCollTable->size());
516  mpTextFormatCollTable->DeleteAndDestroy(1, mpTextFormatCollTable->size());
517  mpTextFormatCollTable.reset();
518 
519  assert(mpDfltGrfFormatColl.get() == (*mpGrfFormatCollTable)[0]
520  && "DefaultGrfCollection must always be at the start");
521 
522  mpGrfFormatCollTable->DeleteAndDestroy(1, mpGrfFormatCollTable->size());
523  mpGrfFormatCollTable.reset();
524 
525  // Without explicitly freeing the DocumentDeviceManager
526  // and relying on the implicit freeing there would be a crash
527  // due to it happening after SwAttrPool is freed.
528  m_pDeviceAccess.reset();
529 
530  /*
531  * DefaultFormats and DefaultFormatCollections (FormatColl)
532  * are at position 0 of their respective arrays.
533  * In order to not be deleted by the array's dtor, we remove them
534  * now.
535  */
536  mpFrameFormatTable->erase( mpFrameFormatTable->begin() );
537 
538 #if HAVE_FEATURE_DBCONNECTIVITY && !ENABLE_FUZZERS
539  // On load, SwDBManager::setEmbeddedName() may register a data source.
540  // If we have an embedded one, then sDataSource points to the registered name, so revoke it here.
541  if (!m_pOwnDBManager->getEmbeddedName().isEmpty() && !maDBData.sDataSource.isEmpty())
542  {
543  // Remove the revoke listener here first, so that we don't remove the data source from the document.
544  m_pOwnDBManager->releaseRevokeListener();
547  }
548  else if (!m_pOwnDBManager->getEmbeddedName().isEmpty())
549  {
550  // Remove the revoke listener here first, so that we don't remove the data source from the document.
551  m_pOwnDBManager->releaseRevokeListener();
552  // Remove connections which was committed but not used.
553  m_pOwnDBManager->RevokeNotUsedConnections();
554  }
555 
556  m_pOwnDBManager.reset();
557 #endif
558 
559  // All Flys need to be destroyed before the Drawing Model,
560  // because Flys can still contain DrawContacts, when no
561  // Layout could be constructed due to a read error.
562  mpSpzFrameFormatTable->DeleteAndDestroyAll();
563 
564  // Only now destroy the Model, the drawing objects - which are also
565  // contained in the Undo - need to remove their attributes from the
566  // Model. Also, DrawContacts could exist before this.
568  // Destroy DrawModel before the LinkManager, because it's always set
569  // in the DrawModel.
570  //The LinkManager gets destroyed automatically with m_pLinksAdministrationManager
571 
572  // Clear the Tables before deleting the defaults, or we crash due to
573  // dependencies on defaults.
574  mpFrameFormatTable.reset();
575  mpSpzFrameFormatTable.reset();
576 
577  mpStyleAccess.reset();
578 
579  mpCharFormatTable.reset();
580  mpSectionFormatTable.reset();
581  mpTableFrameFormatTable.reset();
582  mpDfltTextFormatColl.reset();
583  mpDfltGrfFormatColl.reset();
584  mpNumRuleTable.reset();
585 
586  disposeXForms(); // #i113606#, dispose the XForms objects
587 
588  {
589  std::scoped_lock lock(mNumberFormatterMutex);
590  delete mpNumberFormatter; mpNumberFormatter= nullptr;
591  }
592  mpFootnoteInfo.reset();
593  mpEndNoteInfo.reset();
594  mpLineNumberInfo.reset();
595  mpFootnoteIdxs.reset();
596  mpTOXTypes.reset();
597  mpEmptyPageFormat.reset();
598  mpColumnContFormat.reset();
599  mpDfltCharFormat.reset();
600  mpDfltFrameFormat.reset();
601  mpLayoutCache.reset();
602  mpAttrPool.clear();
603 }
604 
606 {
607  if( mpDocShell == pDSh )
608  return;
609 
610  if (mpDocShell)
611  {
612  mpDocShell->SetUndoManager(nullptr);
613  }
614  mpDocShell = pDSh;
615  if (mpDocShell)
616  {
619  }
620 
622 
623  // set DocShell pointer also on DrawModel
625  assert(!GetDocumentDrawModelManager().GetDrawModel() ||
626  GetDocumentDrawModelManager().GetDrawModel()->GetPersist() == GetPersist());
627 }
628 
629 // Convenience method; to avoid excessive includes from docsh.hxx
630 uno::Reference < embed::XStorage > SwDoc::GetDocStorage()
631 {
632  if( mpDocShell )
633  return mpDocShell->GetStorage();
634  if( getIDocumentLinksAdministration().GetLinkManager().GetPersist() )
636  return nullptr;
637 }
638 
640 {
642 }
643 
645 {
647  ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo());
648 
649  // Deactivate Undo notification from Draw
650  if( GetDocumentDrawModelManager().GetDrawModel() )
651  {
653  ClrContourCache();
654  }
655 
656  // if there are still FlyFrames dangling around, delete them too
657  while ( !mpSpzFrameFormatTable->empty() )
659  assert(!GetDocumentDrawModelManager().GetDrawModel()
660  || !GetDocumentDrawModelManager().GetDrawModel()->GetPage(0)->GetObjCount());
661 
664 
665  mpACEWord.reset();
666 
667  // The BookMarks contain indices to the Content. These must be deleted
668  // before deleting the Nodes.
669  mpMarkManager->clearAllMarks();
670  InitTOXTypes();
671 
672  // create a dummy pagedesc for the layout
673  SwPageDesc* pDummyPgDsc = MakePageDesc("?DUMMY?");
674 
675  SwNodeIndex aSttIdx( *GetNodes().GetEndOfContent().StartOfSectionNode(), 1 );
676  // create the first one over and over again (without attributes/style etc.
677  SwTextNode* pFirstNd = GetNodes().MakeTextNode( aSttIdx, mpDfltTextFormatColl.get() );
678 
680  {
681  // set the layout to the dummy pagedesc
682  pFirstNd->SetAttr( SwFormatPageDesc( pDummyPgDsc ));
683 
684  SwPosition aPos( *pFirstNd, SwIndex( pFirstNd ));
685  SwPaM const tmpPaM(aSttIdx, SwNodeIndex(GetNodes().GetEndOfContent()));
686  ::PaMCorrAbs(tmpPaM, aPos);
687  }
688 
689  GetNodes().Delete( aSttIdx,
690  GetNodes().GetEndOfContent().GetIndex() - aSttIdx.GetIndex() );
691 
692  // #i62440#
693  // destruction of numbering rules and creation of new outline rule
694  // *after* the document nodes are deleted.
695  mpOutlineRule = nullptr;
696  for( SwNumRule* pNumRule : *mpNumRuleTable )
697  {
698  getIDocumentListsAccess().deleteListForListStyle(pNumRule->GetName());
699  delete pNumRule;
700  }
701  mpNumRuleTable->clear();
702  maNumRuleMap.clear();
703 
704  // creation of new outline numbering rule
706  // #i89178#
708  OUTLINE_RULE );
710  // Counting of phantoms depends on <IsOldNumbering()>
712 
713  // remove the dummy pagedesc from the array and delete all the old ones
714  size_t nDummyPgDsc = 0;
715  if (FindPageDesc(pDummyPgDsc->GetName(), &nDummyPgDsc))
716  m_PageDescs.erase( nDummyPgDsc );
717  for( SwPageDesc *pPageDesc : m_PageDescs )
718  delete pPageDesc;
719  m_PageDescs.clear();
720 
721  // Delete for Collections
722  // So that we get rid of the dependencies
723  mpFootnoteInfo->EndListeningAll();
724  mpEndNoteInfo->EndListeningAll();
725 
726  // Optimization: Based on the fact that Standard is always 2nd in the
727  // array, we should delete it as the last. With this we avoid
728  // reparenting the Formats all the time!
729  if( 2 < mpTextFormatCollTable->size() )
730  mpTextFormatCollTable->DeleteAndDestroy(2, mpTextFormatCollTable->size());
731  mpTextFormatCollTable->DeleteAndDestroy(1, mpTextFormatCollTable->size());
732  mpGrfFormatCollTable->DeleteAndDestroy(1, mpGrfFormatCollTable->size());
733  mpCharFormatTable->DeleteAndDestroyAll(/*keepDefault*/true);
734 
735  if( getIDocumentLayoutAccess().GetCurrentViewShell() )
736  {
737  // search the FrameFormat of the root frm. This is not allowed to delete
738  mpFrameFormatTable->erase( getIDocumentLayoutAccess().GetCurrentViewShell()->GetLayout()->GetFormat() );
739  mpFrameFormatTable->DeleteAndDestroyAll( true );
740  mpFrameFormatTable->push_back( getIDocumentLayoutAccess().GetCurrentViewShell()->GetLayout()->GetFormat() );
741  }
742  else
743  mpFrameFormatTable->DeleteAndDestroyAll( true );
744 
746 
747  {
748  std::scoped_lock lock(mNumberFormatterMutex);
749  delete mpNumberFormatter; mpNumberFormatter= nullptr;
750  }
751 
753  pFirstNd->ChgFormatColl( getIDocumentStylePoolAccess().GetTextCollFromPool( RES_POOLCOLL_STANDARD ));
754  nDummyPgDsc = m_PageDescs.size();
755  m_PageDescs.push_back( pDummyPgDsc );
756  // set the layout back to the new standard pagedesc
757  pFirstNd->ResetAllAttr();
758  // delete now the dummy pagedesc
759  DelPageDesc( nDummyPgDsc );
760 }
761 
763 {
764  if( pNew )
765  {
766  if (m_pPgPViewPrtData)
767  {
768  *m_pPgPViewPrtData = *pNew;
769  }
770  else
771  {
772  m_pPgPViewPrtData.reset(new SwPagePreviewPrtData(*pNew));
773  }
774  }
775  else if (m_pPgPViewPrtData)
776  {
777  m_pPgPViewPrtData.reset();
778  }
780 }
781 
783 {
784  if( getIDocumentLayoutAccess().GetCurrentViewShell() ) maOLEModifiedIdle.Start();
785 }
786 
789 {
790  if( !mpLayoutCache )
791  mpLayoutCache.reset( new SwLayoutCache() );
792  if( !mpLayoutCache->IsLocked() )
793  {
794  mpLayoutCache->GetLockCount() |= 0x8000;
795  mpLayoutCache->Read( rStream );
796  mpLayoutCache->GetLockCount() &= 0x7fff;
797  }
798 }
799 
801 {
802  SwLayoutCache::Write( rStream, *this );
803 }
804 
806 {
807  const SwDoc& rDoc = rTextNode.GetDoc();
808  if (rDoc.IsInDtor())
809  return nullptr;
810  return rDoc.getGrammarContact();
811 }
812 
815 {
816  // UGLY: this relies on SetClipBoard being called before GetXmlIdRegistry!
817  if (!m_pXmlIdRegistry)
818  {
820  }
821  return *m_pXmlIdRegistry;
822 }
823 
825 {
827  SwTOXType* pNew = new SwTOXType(*this, TOX_CONTENT, pShellRes->aTOXContentName);
828  mpTOXTypes->emplace_back( pNew );
829  pNew = new SwTOXType(*this, TOX_INDEX, pShellRes->aTOXIndexName);
830  mpTOXTypes->emplace_back( pNew );
831  pNew = new SwTOXType(*this, TOX_USER, pShellRes->aTOXUserName);
832  mpTOXTypes->emplace_back( pNew );
833  pNew = new SwTOXType(*this, TOX_ILLUSTRATIONS, pShellRes->aTOXIllustrationsName);
834  mpTOXTypes->emplace_back( pNew );
835  pNew = new SwTOXType(*this, TOX_OBJECTS, pShellRes->aTOXObjectsName);
836  mpTOXTypes->emplace_back( pNew );
837  pNew = new SwTOXType(*this, TOX_TABLES, pShellRes->aTOXTablesName);
838  mpTOXTypes->emplace_back( pNew );
839  pNew = new SwTOXType(*this, TOX_AUTHORITIES, pShellRes->aTOXAuthoritiesName);
840  mpTOXTypes->emplace_back( pNew );
841  pNew = new SwTOXType(*this, TOX_CITATION, pShellRes->aTOXCitationName);
842  mpTOXTypes->emplace_back( pNew );
843 }
844 
845 void SwDoc::ReplaceDefaults(const SwDoc& rSource)
846 {
847  // copy property defaults
848  static const WhichRangesContainer aRangeOfDefaults(svl::Items<
855  >);
856 
857  SfxItemSet aNewDefaults(GetAttrPool(), aRangeOfDefaults);
858 
859  for (const WhichPair& rPair : aRangeOfDefaults)
860  {
861  for (sal_uInt16 nWhich = rPair.first;
862  nWhich <= rPair.second; ++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:630
::sfx2::IXmlIdRegistry * createXmlIdRegistry(const bool i_DocIsClipboard)
const std::unique_ptr< ::sw::UndoManager > m_pUndoManager
Definition: doc.hxx:216
sal_uInt32 mnRsidRoot
Definition: doc.hxx:297
SwNodeIndex AppendDoc(const SwDoc &rSource, sal_uInt16 nStartPageNumber, bool bDeletePrevious, int physicalPageOffset, const sal_uLong nDocNo)
Definition: docnew.cxx:1009
constexpr TypedWhichId< SwFormatPageDesc > RES_PAGEDESC(93)
SwPageDescs m_PageDescs
Definition: doc.hxx:198
sal_uLong GetIndex() const
Definition: node.hxx:291
sal_uLong Count() const
Definition: ndarr.hxx:139
bool bVisible
Represents the style of a paragraph.
Definition: fmtcol.hxx:56
std::unique_ptr< SwDefTOXBase_Impl > mpDefTOXBases
Definition: doc.hxx:249
Marks a position in the document model.
Definition: pam.hxx:35
Pagedescriptor Client of SwPageDesc that is "described" by the attribute.
Definition: fmtpdsc.hxx:35
bool UpdateParRsid(SwTextNode *pTextNode, sal_uInt32 nVal=0)
Definition: docfmt.cxx:436
void SetOLEObjModified()
update all modified OLE-Objects.
Definition: docnew.cxx:782
SwPageDesc * GetPageDesc()
Definition: fmtpdsc.hxx:61
static constexpr auto Items
const SwFormatHeader & GetHeader(bool=true) const
Definition: fmthdft.hxx:97
static ShellResource * GetShellRes()
Definition: viewsh.cxx:2595
IGrammarContact * getGrammarContact() const
Definition: doc.hxx:1555
bool SttEndDoc(bool bStt)
Definition: crsrsh.cxx:574
virtual sal_uInt16 ResetAllAttr() override
Definition: ndtxt.cxx:5098
SwDocShell * GetDocShell()
Definition: doc.hxx:1352
size_type count(const Value &v) const
virtual bool SetAttr(const SfxPoolItem &) override
overriding to handle change of certain paragraph attributes
Definition: ndtxt.cxx:4832
std::pair< sal_uInt16, sal_uInt16 > WhichPair
static void Write(SvStream &rStream, const SwDoc &rDoc)
writes the index (more precise: the difference between the index and the first index of the document ...
Definition: laycache.cxx:163
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const =0
void DelPageDesc(const OUString &rName, bool bBroadcast=false)
Definition: docdesc.cxx:964
SwNodeIndex nNode
Definition: pam.hxx:37
constexpr OUStringLiteral DEFAULT_CHAR_FORMAT_NAME
Definition: docnew.cxx:118
SwDBManager * m_pDBManager
Definition: doc.hxx:252
Idle maOLEModifiedIdle
Definition: doc.hxx:203
static bool lcl_PageDescOrFollowContainsHeaderFooter(const SwPageDesc &rPageDesc)
Returns whether the passed SwPageDesc& or any of its (transitive) follows contains a header or footer...
Definition: docnew.cxx:943
std::unique_ptr< SwNodes > m_pNodes
Definition: doc.hxx:196
virtual void SetModified()=0
Must be called manually at changes of format.
sal_uIntPtr sal_uLong
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_LANGUAGE(10)
OUString sDataSource
Definition: swdbdata.hxx:30
virtual SwUndoId EndUndo(SwUndoId const eUndoId, SwRewriter const *const pRewriter)=0
Closes undo block.
Provides access to the marks of a document.
Definition: doc.hxx:188
constexpr sal_uInt16 RES_FRMATR_END(133)
virtual void StopIdling()=0
Stop idle processing.
IDocumentLinksAdministration const & getIDocumentLinksAdministration() const
Definition: doc.cxx:260
virtual SwFrameFormat * CopyLayoutFormat(const SwFrameFormat &rSrc, const SwFormatAnchor &rNewAnchor, bool bSetTextFlyAtt, bool bMakeFrames)=0
LanguageType nDefaultLanguage_CJK
void SetDocShell(SwDocShell *pDocShell)
Definition: docundo.cxx:89
static LanguageType resolveSystemLanguageByScriptType(LanguageType nLang, sal_Int16 nType)
SwNode & GetNode() const
Definition: ndindex.hxx:119
Content, content of frame (header, footer, fly).
Definition: fmtcntnt.hxx:31
void ReplaceCompatibilityOptions(const SwDoc &rSource)
Definition: docnew.cxx:875
IDocumentMarkAccess * getIDocumentMarkAccess()
Definition: docbm.cxx:1790
Dialog to specify the properties of date form field.
IDocumentUndoRedo & GetIDocumentUndoRedo()
Definition: doc.cxx:144
rtl::Reference< SwAttrPool > mpAttrPool
Definition: doc.hxx:197
std::unordered_map< OUString, SwNumRule * > maNumRuleMap
Definition: doc.hxx:273
std::unique_ptr< IStyleAccess > mpStyleAccess
Definition: doc.hxx:278
SfxObjectShell * GetPersist() const
~SwDoc()
Speciality: a member of the class SwDoc is located at position 0 in the array of the Format and GDI o...
Definition: docnew.cxx:398
IDocumentContentOperations const & getIDocumentContentOperations() const
Definition: doc.cxx:315
void SetPageNum(sal_uInt16 nNew)
Definition: fmtanchr.hxx:72
void EndAllAction()
Definition: edws.cxx:97
OUString aTOXIndexName
Definition: shellres.hxx:53
SwTableFormat * GetFrameFormat()
Definition: swtable.hxx:204
const SwFrameFormats * GetSpzFrameFormats() const
Definition: doc.hxx:744
void SetNewContentIdx(const SwNodeIndex *pIdx)
Definition: atrfrm.cxx:595
OUString aTOXAuthoritiesName
Definition: shellres.hxx:59
void SetFollow(const SwPageDesc *pNew)
Definition: pagedesc.hxx:314
unsigned int uniform_uint_distribution(unsigned int a, unsigned int b)
const OUString & GetName() const
Definition: pagedesc.hxx:196
const SwIndex * GetNext() const
Definition: index.hxx:98
bool IsActive() const
Definition: fmthdft.hxx:89
Array of Undo-history.
Definition: docary.hxx:192
virtual void LockExpFields()=0
css::uno::Reference< css::embed::XStorage > const & GetStorage()
Used by the UI to modify the document model.
Definition: wrtsh.hxx:93
std::unique_ptr< SwURLStateChanged > mpURLStateChgd
Definition: doc.hxx:265
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
Definition: doc.cxx:357
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:805
SwTableNode * GetTableNode()
Definition: node.hxx:600
constexpr sal_uInt16 RES_PARATR_BEGIN(RES_TXTATR_END)
std::unique_ptr< SwFrameFormats > mpTableFrameFormatTable
Definition: doc.hxx:244
void cleanupUnoCursorTable() const
Definition: doc.hxx:1643
void ReplaceDefaults(const SwDoc &rSource)
Definition: docnew.cxx:845
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:788
check if target position is in fly anchored at source range
std::unique_ptr< SwNumRuleTable > mpNumRuleTable
Definition: doc.hxx:270
static bool IsFuzzing()
std::unique_ptr< IGrammarContact > mpGrammarContact
Definition: doc.hxx:282
sal_uLong GetIndex() const
Definition: ndindex.hxx:152
virtual void DelLayoutFormat(SwFrameFormat *pFormat)=0
virtual void DelAllUndoObj()=0
Delete all Undo actions.
std::unique_ptr< ::sw::DocumentDeviceManager > m_pDeviceAccess
Definition: doc.hxx:219
virtual void DoUndo(bool const bDoUndo)=0
Enable/Disable Undo.
sal_uInt32 mnRsid
Definition: doc.hxx:296
::sfx2::IXmlIdRegistry & GetXmlIdRegistry()
Definition: docnew.cxx:814
std::unique_ptr< SwFrameFormats > mpSpzFrameFormatTable
Definition: doc.hxx:242
OUString aTOXIllustrationsName
Definition: shellres.hxx:56
const SwTable & GetTable() const
Definition: node.hxx:499
SwDocShell * mpDocShell
Definition: doc.hxx:260
void DelNodes(const SwNodeIndex &rStart, sal_uLong nCnt=1)
Delete a number of nodes.
Definition: nodes.cxx:1332
SwDoc * GetDoc() const
Definition: viewsh.hxx:282
void SetUndoManager(SfxUndoManager *pNewUndoMgr)
o3tl::sorted_vector< SwRootFrame * > GetAllLayouts()
Definition: doclay.cxx:1670
bool mbDtor
TRUE: is in SwDoc DTOR.
Definition: doc.hxx:301
void InitTOXTypes()
Definition: docnew.cxx:824
SwPaM * GetNext()
Definition: pam.hxx:264
std::unique_ptr< SwOutlineNodes > m_pOutlineNodes
Array of all outline nodes.
Definition: ndarr.hxx:107
virtual SwPageDesc * GetPageDescFromPool(sal_uInt16 nId, bool bRegardLanguage=true)=0
Return required automatic page style.
Specific frame formats (frames, DrawObjects).
SwPageDesc * FindPageDesc(const OUString &rName, size_t *pPos=nullptr) const
Definition: docdesc.cxx:941
static void RevokeDataSource(const OUString &rName)
Unregister a data source.
Definition: dbmgr.cxx:2877
Base class for various Writer styles.
Definition: format.hxx:46
SwNode & GetEndOfContent() const
Regular ContentSection (i.e. the BodyText).
Definition: ndarr.hxx:160
SwDBData maDBData
Definition: doc.hxx:204
virtual void repositionMark(::sw::mark::IMark *io_pMark, const SwPaM &rPaM)=0
Moves an existing mark to a new selection and performs needed updates.
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:136
std::unique_ptr< SwTextFormatColls > mpTextFormatCollTable
Definition: doc.hxx:245
void AddNumRule(SwNumRule *pRule)
Add numbering rule to document.
Definition: docnum.cxx:2436
Style of a layout element.
Definition: frmfmt.hxx:59
::sw::UndoManager & GetUndoManager()
Definition: doc.cxx:133
virtual SwUndoId StartUndo(SwUndoId const eUndoId, SwRewriter const *const pRewriter)=0
Opens undo block.
void SetPreviewPrtData(const SwPagePreviewPrtData *pData)
Definition: docnew.cxx:762
virtual const SwExtraRedlineTable & GetExtraRedlineTable() const =0
void MakeUniqueNumRules(const SwPaM &rPaM)
Definition: docnum.cxx:1235
std::unique_ptr< SwTOXTypes > mpTOXTypes
Definition: doc.hxx:248
void erase(const value_type &x)
Definition: pagedesc.cxx:765
const SwFormatAnchor & GetAnchor(bool=true) const
Definition: fmtanchr.hxx:81
bool HasGrammarChecker() const
OUString aTOXObjectsName
Definition: shellres.hxx:57
SwDoc & GetDoc()
Definition: node.hxx:212
const SwPosition * GetPoint() const
Definition: pam.hxx:207
virtual bool CopyRange(SwPaM &rPam, SwPosition &rPos, SwCopyFlags flags) const =0
Copy a selected content range to a position.
std::unique_ptr< SwLayoutCache > mpLayoutCache
Layout cache to read and save with the document for a faster formatting.
Definition: doc.hxx:279
void Remove(SvBaseLink const *pLink)
void GetOptions(SvtLinguOptions &rOptions) const
void InitDrawModelAndDocShell(SwDocShell *pSwDocShell, SwDrawModel *pSwDrawDocument)
Definition: docshdrw.cxx:32
constexpr sal_uInt16 RES_PARATR_LIST_END(88)
std::vector< std::weak_ptr< SwUnoCursor > > mvUnoCursorTable
Definition: doc.hxx:1640
std::unique_ptr< SwEndNoteInfo > mpEndNoteInfo
Definition: doc.hxx:256
const SwPosition * GetContentAnchor() const
Definition: fmtanchr.hxx:67
const std::unique_ptr< ::sw::mark::MarkManager > mpMarkManager
Definition: doc.hxx:211
void DeleteAndDestroyAll()
Definition: docredln.cxx:663
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:759
sal_uInt16 Count() const
FlyAnchors.
Definition: fmtanchr.hxx:34
const SwPageDesc & GetPageDesc(size_t i) const
Definition: fedesc.cxx:126
std::unique_ptr< SwTextFormatColl > mpDfltTextFormatColl
Definition: doc.hxx:237
static SfxViewFrame * GetNext(const SfxViewFrame &rPrev, const SfxObjectShell *pDoc=nullptr, bool bOnlyVisible=true)
std::unique_ptr< SwFrameFormat > mpColumnContFormat
Definition: doc.hxx:235
Marks a character position inside a document model node.
Definition: index.hxx:33
float u
virtual SwFormatColl * ChgFormatColl(SwFormatColl *) override
Definition: ndtxt.cxx:3883
const SwFormatFooter & GetFooter(bool=true) const
Definition: fmthdft.hxx:99
css::uno::Reference< css::linguistic2::XProofreadingIterator > m_xGCIterator
Definition: doc.hxx:209
static OUString GetOutlineRuleName()
Definition: number.cxx:74
css::uno::Reference< css::frame::XModel3 > GetBaseModel() const
IDocumentState const & getIDocumentState() const
Definition: doc.cxx:394
virtual void deleteListForListStyle(const OUString &rListStyleName)=0
OUString aTOXCitationName
Definition: shellres.hxx:60
void WriteLayoutCache(SvStream &rStream)
Definition: docnew.cxx:800
SwWrtShell * GetWrtShell()
Access to the SwWrtShell belonging to SwView.
Definition: docsh.hxx:224
std::mutex mNumberFormatterMutex
Definition: doc.hxx:267
void ChgPageDesc(const OUString &rName, const SwPageDesc &)
Definition: docdesc.cxx:972
size
SwNumRule * mpOutlineRule
Definition: doc.hxx:254
std::unique_ptr< SwPagePreviewPrtData > m_pPgPViewPrtData
Definition: doc.hxx:275
Marks a node in the document model.
Definition: ndindex.hxx:31
constexpr sal_uInt16 RES_UNKNOWNATR_END(154)
OUString aTOXContentName
Definition: shellres.hxx:55
void SetLanguage(const LanguageType eLang, const sal_uInt16 nId)
Definition: doc.cxx:1826
void SetCountPhantoms(bool bCountPhantoms)
Definition: number.cxx:1050
std::unique_ptr< SwGrfFormatColls > mpGrfFormatCollTable
Definition: doc.hxx:246
constexpr sal_uInt16 XATTR_END
void SetDocShell(SwDocShell *pDSh)
Definition: docnew.cxx:605
Represents the style of a text portion.
Definition: charfmt.hxx:26
std::unique_ptr< SwFrameFormat > mpEmptyPageFormat
Definition: doc.hxx:234
Frame cannot be moved in Var-direction.
SvNumberFormatter * mpNumberFormatter
Definition: doc.hxx:268
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
Definition: doc.cxx:405
const SwPosition * Start() const
Definition: pam.hxx:212
static void lcl_DelFormatIndices(SwFormat const *pFormat)
Definition: docnew.cxx:190
copy break attributes even when source is single node
OUString aTOXUserName
Definition: shellres.hxx:54
< purpose of derivation from SwClient: character style for displaying the numbers.
Definition: lineinfo.hxx:37
css::uno::Reference< css::linguistic2::XProofreadingIterator > const & GetGCIterator() const
Definition: docnew.cxx:123
const SwPageDesc * GetFollow() const
Definition: pagedesc.hxx:267
const SwNodeIndex * GetContentIdx() const
Definition: fmtcntnt.hxx:46
constexpr sal_uInt16 RES_UNKNOWNATR_BEGIN(RES_BOXATR_END)
void disposeXForms()
Definition: docxforms.cxx:89
virtual bool SetFormatAttr(const SfxPoolItem &rAttr)
Definition: format.cxx:450
std::unique_ptr< SwSectionFormats > mpSectionFormatTable
Definition: doc.hxx:243
std::unique_ptr< ::sfx2::IXmlIdRegistry > m_pXmlIdRegistry
Definition: doc.hxx:292
void SetDefault(const SfxPoolItem &)
Set attribute as new default attribute in current document.
Definition: docfmt.cxx:540
SwFrameFormat & GetMaster()
Definition: pagedesc.hxx:238
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:79
void CopyPageDesc(const SwPageDesc &rSrcDesc, SwPageDesc &rDstDesc, bool bCopyPoolIds=true)
Copy the complete PageDesc - beyond document and "deep"! Optionally copying of PoolFormatId, -HlpId can be prevented.
Definition: docfmt.cxx:1429
SwDoc()
Definition: docnew.cxx:203
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
Definition: doc.cxx:335
std::unique_ptr< SwAutoCorrExceptWord > mpACEWord
For the automated takeover of auto-corrected words that are "re-corrected".
Definition: doc.hxx:263
constexpr sal_uInt16 RES_CHRATR_BEGIN(HINT_BEGIN)
SvxNumberFormat::SvxNumPositionAndSpaceMode GetDefaultPositionAndSpaceMode()
Definition: number.cxx:1500
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:236
virtual const SwViewShell * GetCurrentViewShell() const =0
Returns the layout set at the document.
void ClrContourCache(const SdrObject *pObj)
Definition: txtfly.cxx:134
void ClearDoc()
Definition: docnew.cxx:644
#define SAL_INFO(area, stream)
std::unique_ptr< SwCharFormats > mpCharFormatTable
Definition: doc.hxx:241
LanguageType nDefaultLanguage
bool IsClipBoard() const
Definition: doc.hxx:963
constexpr sal_uInt16 RES_PARATR_LIST_BEGIN(RES_PARATR_END)
bool DoInitNew(SfxMedium *pMedium=nullptr)
SwNodes & GetNodes()
Definition: doc.hxx:409
const SwPosition * End() const
Definition: pam.hxx:217
::sw::DocumentSettingManager & GetDocumentSettingManager()
Definition: doc.cxx:186
std::unique_ptr< SwFrameFormats > mpFrameFormatTable
Definition: doc.hxx:240
constexpr sal_uInt16 RES_PARATR_END(82)
SfxObjectShell * GetPersist() const
Definition: docnew.cxx:639
void PaMCorrAbs(const SwPaM &rRange, const SwPosition &rNewPos)
Function declarations so that everything below the CursorShell can move the Cursor once in a while...
Definition: doccorr.cxx:86
Organizer of the contact between SwTextNodes and grammar checker.
Reference< XComponentContext > getProcessComponentContext()
std::unique_ptr< SwFootnoteIdxs > mpFootnoteIdxs
Definition: doc.hxx:258
#define CNTNT_IDX(idx)
Definition: docnew.cxx: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:369
void SetInvokeHandler(const Link< Timer *, void > &rLink)
::sw::DocumentDrawModelManager const & GetDocumentDrawModelManager() const
Definition: doc.cxx:165
constexpr TypedWhichId< SvxLRSpaceItem > RES_LR_SPACE(91)
virtual bool AppendTextNode(SwPosition &rPos)=0
constexpr sal_uInt16 RES_CHRATR_END(46)
const SwFormatContent & GetContent(bool=true) const
Definition: fmtcntnt.hxx:55
virtual sfx2::LinkManager & GetLinkManager()=0
SwPageDesc * FindPageDescByName(const OUString &rName, bool bGetFromPool=false, size_t *pPos=nullptr)
Definition: fedesc.cxx:131
virtual void Start(bool bStartTimer=true) override
#define CNTNT_DOC(doc)
Definition: docnew.cxx:881
void DeleteAndDestroyAll()
Definition: docredln.cxx:1990
std::unique_ptr< SwDBManager, o3tl::default_delete< SwDBManager > > m_pOwnDBManager
Definition: doc.hxx:251
bool IsInDtor() const
Definition: doc.hxx:404
static SfxViewFrame * GetFirst(const SfxObjectShell *pDoc=nullptr, bool bOnlyVisible=true)
bool empty() const
Definition: pagedesc.hxx:441
void SetNumOffset(const ::std::optional< sal_uInt16 > &oNum)
Definition: fmtpdsc.hxx:65
bool IsTableNode() const
Definition: node.hxx:641
void SetPriority(TaskPriority ePriority)
std::unique_ptr< SwFrameFormat > mpDfltFrameFormat
Definition: doc.hxx:233
void InsertPageBreak(const OUString *pPageDesc=nullptr, const ::std::optional< sal_uInt16 > &rPgNum=std::nullopt)
Definition: wrtsh1.cxx:881
std::unique_ptr< SwLineNumberInfo > mpLineNumberInfo
Definition: doc.hxx:257
std::unique_ptr< IStyleAccess > createStyleManager(SfxItemSet const *pIgnorableParagraphItems)
SwDoc & GetDoc() const
Definition: pam.hxx:243
const std::unique_ptr< ::sw::DocumentSettingManager > m_pDocumentSettingManager
Definition: doc.hxx:217
virtual void UnlockExpFields()=0
bool StartGrammarChecking(bool bSkipStart=false)
Definition: docnew.cxx:141
virtual void UpdateFields(bool bCloseDB)=0
virtual const SwRedlineTable & GetRedlineTable() const =0
bool IsActive() const
Definition: fmthdft.hxx:58
std::pair< const_iterator, bool > insert(Value &&x)
const SfxPoolItem & GetAttr(sal_uInt16 nWhich, bool bInParent=true) const
SS for PoolItems: hard attributation.
Definition: node.hxx:722
SwNode & GetEndOfExtras() const
This is the last EndNode of a special section.
Definition: ndarr.hxx:158
::sw::DocumentFieldsManager & GetDocumentFieldsManager()
Definition: doc.cxx:367
void StartAllAction()
For all views of this document.
Definition: edws.cxx:86
std::unique_ptr< SwFootnoteInfo > mpFootnoteInfo
Definition: doc.hxx:255
void RegisterToPageDesc(SwPageDesc &)
Definition: atrfrm.cxx:714
OUString aTOXTablesName
Definition: shellres.hxx:58
IDocumentListsAccess const & getIDocumentListsAccess() const
Definition: doc.cxx:293
LanguageType nDefaultLanguage_CTL
size_t GetCurPageDesc(const bool bCalcFrame=true) const
Definition: fedesc.cxx:167
bool IsTextNode() const
Definition: node.hxx:637
Standard page.
Definition: poolfmt.hxx:170
void SetPersist(SfxObjectShell *p)
constexpr sal_uInt16 RES_FRMATR_BEGIN(RES_PARATR_LIST_END)
std::shared_ptr< osl::Mutex > const & lock()
constexpr TypedWhichId< SvxULSpaceItem > RES_UL_SPACE(92)
IGrammarContact * createGrammarContact()
Factory for a grammar contact.
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_CJK_LANGUAGE(24)
SwExtTextInput * mpExtInputRing
Definition: doc.hxx:276
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1319
std::unique_ptr< SwGrfFormatColl > mpDfltGrfFormatColl
Definition: doc.hxx:238
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:856
IDocumentTimerAccess const & getIDocumentTimerAccess() const
Definition: doc.cxx:249
SwTextNode * MakeTextNode(const SwNodeIndex &rWhere, SwTextFormatColl *pColl, bool bNewFrames=true)
Implementations of "Make...Node" are in the given .cxx-files.
Definition: ndtxt.cxx:105
void SetAnchor(const SwPosition *pPos)
Definition: atrfrm.cxx:1584
MissingDictionary
Definition: doc.hxx:323
virtual void ResetModified()=0
Base class of the Writer document model elements.
Definition: node.hxx:80