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