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 sw::FrameFormats<SwFrameFormat*>() ),
236 mpCharFormatTable( new SwCharFormats ),
237 mpSpzFrameFormatTable( new sw::FrameFormats<sw::SpzFrameFormat*>() ),
238 mpSectionFormatTable( new SwSectionFormats ),
239 mpTableFrameFormatTable( new sw::TableFrameFormats() ),
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 s_pLast = this;
394}
395
402{
403 s_pLast = nullptr;
404
405 mxVbaFind.clear();
406
407 // nothing here should create Undo actions!
408 GetIDocumentUndoRedo().DoUndo(false);
409
410 if (mpDocShell)
411 {
412 mpDocShell->SetUndoManager(nullptr);
413 }
414
415 mpGrammarContact.reset();
417
418 getIDocumentTimerAccess().StopIdling(); // stop idle timer
419
420 mpURLStateChgd.reset();
421
422 // Deactivate Undo notification from Draw
423 if( GetDocumentDrawModelManager().GetDrawModel() )
424 {
427 }
428
429 m_pPgPViewPrtData.reset();
430
431 mbDtor = true;
432
433 //Clear the redline table before the nodes array is destroyed
436
437 const sw::UnoCursorHint aHint;
439 for(const auto& pWeakCursor : mvUnoCursorTable)
440 {
441 auto pCursor(pWeakCursor.lock());
442 if(pCursor)
443 pCursor->m_aNotifier.Broadcast(aHint);
444 }
445 mpACEWord.reset();
446
447 // Release the BaseLinks
448 {
449 ::sfx2::SvLinkSources aTemp(getIDocumentLinksAdministration().GetLinkManager().GetServers());
450 for( const auto& rpLinkSrc : aTemp )
451 rpLinkSrc->Closed();
452
453 if( !getIDocumentLinksAdministration().GetLinkManager().GetLinks().empty() )
455 }
456
457 // The ChapterNumbers/Numbers need to be deleted before the styles
458 // or we update all the time!
459 m_pNodes->m_aOutlineNodes.clear();
460 SwNodes & rUndoNodes( GetUndoManager().GetUndoNodes() );
461 rUndoNodes.m_aOutlineNodes.clear();
462
463 mpFootnoteIdxs->clear();
464
465 // indices could be registered in attributes
466 m_pUndoManager->DelAllUndoObj();
467
468 // The BookMarks contain indices to the Content. These must be deleted
469 // before deleting the Nodes.
470 mpMarkManager->clearAllMarks();
471
472 if( mpExtInputRing )
473 {
474 SwPaM* pTmp = mpExtInputRing;
475 mpExtInputRing = nullptr;
476 while( pTmp->GetNext() != pTmp )
477 {
478 // coverity[deref_arg] - the SwPaM delete moves a new entry into GetNext()
479 delete pTmp->GetNext();
480 }
481 delete pTmp;
482 }
483
484 // Any of the FrameFormats can still have indices registered.
485 // These need to be destroyed now at the latest.
486 for( SwFrameFormat* pFormat : *mpFrameFormatTable )
487 lcl_DelFormatIndices( pFormat );
488 for( SwFrameFormat* pFormat : *mpSpzFrameFormatTable )
489 lcl_DelFormatIndices( pFormat );
490 for( SwSectionFormat* pFormat : *mpSectionFormatTable )
491 lcl_DelFormatIndices( pFormat );
492
493 // The formats/styles that follow depend on the default formats.
494 // Destroy these only after destroying the FormatIndices, because the content
495 // of headers/footers has to be deleted as well. If in the headers/footers
496 // there are still Flys registered at that point, we have a problem.
497 for( SwPageDesc *pPageDesc : m_PageDescs )
498 delete pPageDesc;
500
501 // Delete content selections.
502 // Don't wait for the SwNodes dtor to destroy them; so that Formats
503 // do not have any dependencies anymore.
504 m_pNodes->DelNodes( SwNodeIndex(*m_pNodes), m_pNodes->Count() );
505 rUndoNodes.DelNodes( SwNodeIndex( rUndoNodes ), rUndoNodes.Count() );
506
507 // clear TOX after nodes - TOXMarks are gone now so SwTOXType has no clients
508 for (const auto& pType : *mpTOXTypes)
509 {
510 pType->CallSwClientNotify(sw::DocumentDyingHint());
511 }
512 mpTOXTypes->clear();
513 mpDefTOXBases.reset();
514
515 // Delete Formats, make it permanent some time in the future
516
517 // Delete for Collections
518 // So that we get rid of the dependencies
519 mpFootnoteInfo->EndListeningAll();
520 mpEndNoteInfo->EndListeningAll();
521
522 assert(mpDfltTextFormatColl.get() == (*mpTextFormatCollTable)[0]
523 && "Default-Text-Collection must always be at the start");
524
525 // Optimization: Based on the fact that Standard is always 2nd in the
526 // array, we should delete it as the last. With this we avoid
527 // reparenting the Formats all the time!
528 if( 2 < mpTextFormatCollTable->size() )
529 mpTextFormatCollTable->DeleteAndDestroy(2, mpTextFormatCollTable->size());
530 mpTextFormatCollTable->DeleteAndDestroy(1, mpTextFormatCollTable->size());
531 mpTextFormatCollTable.reset();
532
533 assert(mpDfltGrfFormatColl.get() == (*mpGrfFormatCollTable)[0]
534 && "DefaultGrfCollection must always be at the start");
535
536 mpGrfFormatCollTable->DeleteAndDestroy(1, mpGrfFormatCollTable->size());
537 mpGrfFormatCollTable.reset();
538
539 // Without explicitly freeing the DocumentDeviceManager
540 // and relying on the implicit freeing there would be a crash
541 // due to it happening after SwAttrPool is freed.
542 m_pDeviceAccess.reset();
543
544 /*
545 * DefaultFormats and DefaultFormatCollections (FormatColl)
546 * are at position 0 of their respective arrays.
547 * In order to not be deleted by the array's dtor, we remove them
548 * now.
549 */
550 mpFrameFormatTable->erase( mpFrameFormatTable->begin() );
551
552#if HAVE_FEATURE_DBCONNECTIVITY && !ENABLE_FUZZERS
553 // On load, SwDBManager::setEmbeddedName() may register a data source.
554 // If we have an embedded one, then sDataSource points to the registered name, so revoke it here.
555 if (!m_pOwnDBManager->getEmbeddedName().isEmpty() && !maDBData.sDataSource.isEmpty())
556 {
557 // Remove the revoke listener here first, so that we don't remove the data source from the document.
558 m_pOwnDBManager->releaseRevokeListener();
561 }
562 else if (!m_pOwnDBManager->getEmbeddedName().isEmpty())
563 {
564 // Remove the revoke listener here first, so that we don't remove the data source from the document.
565 m_pOwnDBManager->releaseRevokeListener();
566 // Remove connections which was committed but not used.
567 m_pOwnDBManager->RevokeNotUsedConnections();
568 }
569
570 m_pOwnDBManager.reset();
571#endif
572
573 // All Flys need to be destroyed before the Drawing Model,
574 // because Flys can still contain DrawContacts, when no
575 // Layout could be constructed due to a read error.
576 mpSpzFrameFormatTable->DeleteAndDestroyAll();
577
578 // Only now destroy the Model, the drawing objects - which are also
579 // contained in the Undo - need to remove their attributes from the
580 // Model. Also, DrawContacts could exist before this.
582 // Destroy DrawModel before the LinkManager, because it's always set
583 // in the DrawModel.
584 //The LinkManager gets destroyed automatically with m_pLinksAdministrationManager
585
586 // Clear the Tables before deleting the defaults, or we crash due to
587 // dependencies on defaults.
588 mpFrameFormatTable.reset();
589 mpSpzFrameFormatTable.reset();
590
591 mpStyleAccess.reset();
592
593 mpCharFormatTable.reset();
594 mpSectionFormatTable.reset();
596 mpDfltTextFormatColl.reset();
597 mpDfltGrfFormatColl.reset();
598 mpNumRuleTable.reset();
599
600 disposeXForms(); // #i113606#, dispose the XForms objects
601
602 {
603 std::scoped_lock lock(mNumberFormatterMutex);
604 delete mpNumberFormatter; mpNumberFormatter= nullptr;
605 }
606 mpFootnoteInfo.reset();
607 mpEndNoteInfo.reset();
608 mpLineNumberInfo.reset();
609 mpFootnoteIdxs.reset();
610 mpTOXTypes.reset();
611 mpEmptyPageFormat.reset();
612 mpColumnContFormat.reset();
613 mpDfltCharFormat.reset();
614 mpDfltFrameFormat.reset();
615 mpLayoutCache.reset();
616 mpAttrPool.clear();
617}
618
620{
621 if( mpDocShell == pDSh )
622 return;
623
624 if (mpDocShell)
625 {
626 mpDocShell->SetUndoManager(nullptr);
627 }
628 mpDocShell = pDSh;
629 if (mpDocShell)
630 {
633 }
634
636
637 // set DocShell pointer also on DrawModel
639 assert(!GetDocumentDrawModelManager().GetDrawModel() ||
640 GetDocumentDrawModelManager().GetDrawModel()->GetPersist() == GetPersist());
641}
642
643// Convenience method; to avoid excessive includes from docsh.hxx
644uno::Reference < embed::XStorage > SwDoc::GetDocStorage()
645{
646 if( mpDocShell )
647 return mpDocShell->GetStorage();
648 if( getIDocumentLinksAdministration().GetLinkManager().GetPersist() )
650 return nullptr;
651}
652
654{
656}
657
659{
660 GetIDocumentUndoRedo().DelAllUndoObj();
661 ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo());
662
663 // Deactivate Undo notification from Draw
664 if( GetDocumentDrawModelManager().GetDrawModel() )
665 {
668 }
669
670 // if there are still FlyFrames dangling around, delete them too
671 while ( !mpSpzFrameFormatTable->empty() )
673 assert(!GetDocumentDrawModelManager().GetDrawModel()
674 || !GetDocumentDrawModelManager().GetDrawModel()->GetPage(0)->GetObjCount());
675
678
679 mpACEWord.reset();
680
681 // The BookMarks contain indices to the Content. These must be deleted
682 // before deleting the Nodes.
683 mpMarkManager->clearAllMarks();
684 InitTOXTypes();
685
686 // create a dummy pagedesc for the layout
687 SwPageDesc* pDummyPgDsc = MakePageDesc("?DUMMY?");
688
689 SwNodeIndex aSttIdx( *GetNodes().GetEndOfContent().StartOfSectionNode(), 1 );
690 // create the first one over and over again (without attributes/style etc.
691 SwTextNode* pFirstNd = GetNodes().MakeTextNode( aSttIdx.GetNode(), mpDfltTextFormatColl.get() );
692
693 if( getIDocumentLayoutAccess().GetCurrentViewShell() )
694 {
695 // set the layout to the dummy pagedesc
696 pFirstNd->SetAttr( SwFormatPageDesc( pDummyPgDsc ));
697
698 SwPosition aPos( *pFirstNd );
699 SwPaM const tmpPaM(aSttIdx.GetNode(), GetNodes().GetEndOfContent());
700 ::PaMCorrAbs(tmpPaM, aPos);
701 }
702
703 GetNodes().Delete( aSttIdx,
704 GetNodes().GetEndOfContent().GetIndex() - aSttIdx.GetIndex() );
705
706 // #i62440#
707 // destruction of numbering rules and creation of new outline rule
708 // *after* the document nodes are deleted.
709 mpOutlineRule = nullptr;
710 for( SwNumRule* pNumRule : *mpNumRuleTable )
711 {
712 getIDocumentListsAccess().deleteListForListStyle(pNumRule->GetName());
713 delete pNumRule;
714 }
715 mpNumRuleTable->clear();
716 maNumRuleMap.clear();
717
718 // creation of new outline numbering rule
720 // #i89178#
722 OUTLINE_RULE );
724 // Counting of phantoms depends on <IsOldNumbering()>
726
727 // remove the dummy pagedesc from the array and delete all the old ones
728 size_t nDummyPgDsc = 0;
729 if (FindPageDesc(pDummyPgDsc->GetName(), &nDummyPgDsc))
730 m_PageDescs.erase( nDummyPgDsc );
731 for( SwPageDesc *pPageDesc : m_PageDescs )
732 delete pPageDesc;
734
735 // Delete for Collections
736 // So that we get rid of the dependencies
737 mpFootnoteInfo->EndListeningAll();
738 mpEndNoteInfo->EndListeningAll();
739
740 // Optimization: Based on the fact that Standard is always 2nd in the
741 // array, we should delete it as the last. With this we avoid
742 // reparenting the Formats all the time!
743 if( 2 < mpTextFormatCollTable->size() )
744 mpTextFormatCollTable->DeleteAndDestroy(2, mpTextFormatCollTable->size());
745 mpTextFormatCollTable->DeleteAndDestroy(1, mpTextFormatCollTable->size());
746 mpGrfFormatCollTable->DeleteAndDestroy(1, mpGrfFormatCollTable->size());
747 mpCharFormatTable->DeleteAndDestroyAll(/*keepDefault*/true);
748
749 if( getIDocumentLayoutAccess().GetCurrentViewShell() )
750 {
751 // search the FrameFormat of the root frm. This is not allowed to delete
752 mpFrameFormatTable->erase( getIDocumentLayoutAccess().GetCurrentViewShell()->GetLayout()->GetFormat() );
753 mpFrameFormatTable->DeleteAndDestroyAll( true );
754 mpFrameFormatTable->push_back( getIDocumentLayoutAccess().GetCurrentViewShell()->GetLayout()->GetFormat() );
755 }
756 else
757 mpFrameFormatTable->DeleteAndDestroyAll( true );
758
760
761 {
762 std::scoped_lock lock(mNumberFormatterMutex);
763 delete mpNumberFormatter; mpNumberFormatter= nullptr;
764 }
765
767 pFirstNd->ChgFormatColl( getIDocumentStylePoolAccess().GetTextCollFromPool( RES_POOLCOLL_STANDARD ));
768 nDummyPgDsc = m_PageDescs.size();
769 m_PageDescs.push_back( pDummyPgDsc );
770 // set the layout back to the new standard pagedesc
771 pFirstNd->ResetAllAttr();
772 // delete now the dummy pagedesc
773 DelPageDesc( nDummyPgDsc );
774}
775
777{
778 if( pNew )
779 {
781 {
782 *m_pPgPViewPrtData = *pNew;
783 }
784 else
785 {
786 m_pPgPViewPrtData.reset(new SwPagePreviewPrtData(*pNew));
787 }
788 }
789 else if (m_pPgPViewPrtData)
790 {
791 m_pPgPViewPrtData.reset();
792 }
794}
795
797{
798 if( getIDocumentLayoutAccess().GetCurrentViewShell() ) maOLEModifiedIdle.Start();
799}
800
803{
804 if( !mpLayoutCache )
805 mpLayoutCache.reset( new SwLayoutCache() );
806 if( !mpLayoutCache->IsLocked() )
807 {
808 mpLayoutCache->GetLockCount() |= 0x8000;
809 mpLayoutCache->Read( rStream );
810 mpLayoutCache->GetLockCount() &= 0x7fff;
811 }
812}
813
815{
816 SwLayoutCache::Write( rStream, *this );
817}
818
821{
822 // UGLY: this relies on SetClipBoard being called before GetXmlIdRegistry!
823 if (!m_pXmlIdRegistry)
824 {
825 m_pXmlIdRegistry.reset( ::sfx2::createXmlIdRegistry( IsClipBoard() ) );
826 }
827 return *m_pXmlIdRegistry;
828}
829
831{
833 SwTOXType* pNew = new SwTOXType(*this, TOX_CONTENT, pShellRes->aTOXContentName);
834 mpTOXTypes->emplace_back( pNew );
835 pNew = new SwTOXType(*this, TOX_INDEX, pShellRes->aTOXIndexName);
836 mpTOXTypes->emplace_back( pNew );
837 pNew = new SwTOXType(*this, TOX_USER, pShellRes->aTOXUserName);
838 mpTOXTypes->emplace_back( pNew );
839 pNew = new SwTOXType(*this, TOX_ILLUSTRATIONS, pShellRes->aTOXIllustrationsName);
840 mpTOXTypes->emplace_back( pNew );
841 pNew = new SwTOXType(*this, TOX_OBJECTS, pShellRes->aTOXObjectsName);
842 mpTOXTypes->emplace_back( pNew );
843 pNew = new SwTOXType(*this, TOX_TABLES, pShellRes->aTOXTablesName);
844 mpTOXTypes->emplace_back( pNew );
845 pNew = new SwTOXType(*this, TOX_AUTHORITIES, pShellRes->aTOXAuthoritiesName);
846 mpTOXTypes->emplace_back( pNew );
847 pNew = new SwTOXType(*this, TOX_CITATION, pShellRes->aTOXCitationName);
848 mpTOXTypes->emplace_back( pNew );
849}
850
851void SwDoc::ReplaceDefaults(const SwDoc& rSource)
852{
853 // copy property defaults
854 static const WhichRangesContainer aRangeOfDefaults(svl::Items<
861 >);
862
863 SfxItemSet aNewDefaults(GetAttrPool(), aRangeOfDefaults);
864
865 for (const WhichPair& rPair : aRangeOfDefaults)
866 {
867 for (sal_uInt16 nWhich = rPair.first;
868 nWhich <= rPair.second; ++nWhich)
869 {
870 const SfxPoolItem& rSourceAttr =
871 rSource.mpAttrPool->GetDefaultItem(nWhich);
872 if (rSourceAttr != mpAttrPool->GetDefaultItem(nWhich))
873 aNewDefaults.Put(rSourceAttr);
874 }
875 }
876
877 if (aNewDefaults.Count())
878 SetDefault(aNewDefaults);
879}
880
882{
883 m_pDocumentSettingManager->ReplaceCompatibilityOptions(rSource.GetDocumentSettingManager());
884}
885
886#ifdef DBG_UTIL
887#define CNTNT_DOC( doc ) \
888 ((doc)->GetNodes().GetEndOfContent().GetIndex() - (doc)->GetNodes().GetEndOfExtras().GetIndex() - SwNodeOffset(2))
889#define CNTNT_IDX( idx ) \
890 ((idx).GetNode().GetIndex() - GetNodes().GetEndOfExtras().GetIndex() - 1)
891#endif
892
893SfxObjectShell* SwDoc::CreateCopy( bool bCallInitNew, bool bEmpty ) const
894{
895 SAL_INFO( "sw.pageframe", "(SwDoc::CreateCopy in" );
896 rtl::Reference<SwDoc> xRet( new SwDoc );
897
898 // we have to use pointer here, since the callee has to decide whether
899 // SfxObjectShellLock or SfxObjectShellRef should be used sometimes the
900 // object will be returned with refcount set to 0 ( if no DoInitNew is done )
901 SfxObjectShell* pRetShell = new SwDocShell( *xRet, SfxObjectCreateMode::STANDARD );
902 if( bCallInitNew )
903 {
904 // it could happen that DoInitNew creates model,
905 // that increases the refcount of the object
906 pRetShell->DoInitNew();
907 }
908
909 xRet->ReplaceDefaults(*this);
910
911 xRet->ReplaceCompatibilityOptions(*this);
912
913 xRet->ReplaceStyles(*this);
914
915 uno::Reference<beans::XPropertySet> const xThisSet(
916 GetDocShell()->GetBaseModel(), uno::UNO_QUERY_THROW);
917 uno::Reference<beans::XPropertySet> const xRetSet(
918 pRetShell->GetBaseModel(), uno::UNO_QUERY_THROW);
919 uno::Sequence<beans::PropertyValue> aInteropGrabBag;
920 xThisSet->getPropertyValue("InteropGrabBag") >>= aInteropGrabBag;
921 xRetSet->setPropertyValue("InteropGrabBag", uno::Any(aInteropGrabBag));
922
923 if( !bEmpty )
924 {
925#ifdef DBG_UTIL
926 SAL_INFO( "sw.createcopy", "CC-Nd-Src: " << CNTNT_DOC( this ) );
927 SAL_INFO( "sw.createcopy", "CC-Nd: " << CNTNT_DOC( xRet ) );
928#endif
929 xRet->AppendDoc(*this, 0, bCallInitNew, 0, 0);
930#ifdef DBG_UTIL
931 SAL_INFO( "sw.createcopy", "CC-Nd: " << CNTNT_DOC( xRet ) );
932#endif
933 }
934
935 // remove the temporary shell if it is there as it was done before
936 xRet->SetTmpDocShell( nullptr );
937
938 SAL_INFO( "sw.pageframe", "SwDoc::CreateCopy out)" );
939 return pRetShell;
940}
941
942// save bulk letters as single documents
943static OUString lcl_FindUniqueName(SwWrtShell* pTargetShell, std::u16string_view rStartingPageDesc, sal_uLong nDocNo )
944{
945 do
946 {
947 OUString sTest = rStartingPageDesc + OUString::number( nDocNo );
948 if( !pTargetShell->FindPageDescByName( sTest ) )
949 return sTest;
950 ++nDocNo;
951 }
952 while( true );
953}
954
958{
959 // remember already checked page descs to avoid cycle
961 const SwPageDesc* pCurPageDesc = &rPageDesc;
962 while (aCheckedPageDescs.count(pCurPageDesc) == 0)
963 {
964 const SwFrameFormat& rMaster = pCurPageDesc->GetMaster();
965 if (rMaster.GetHeader().IsActive() || rMaster.GetFooter().IsActive())
966 return true;
967
968 aCheckedPageDescs.insert(pCurPageDesc);
969 pCurPageDesc = pCurPageDesc->GetFollow();
970 }
971 return false;
972}
973
975 SwWrtShell& rTargetShell,
976 const SwPageDesc& rSourcePageDesc,
977 const SwPageDesc& rTargetPageDesc,
978 const sal_uLong nDocNo )
979{
980 //now copy the follow page desc, too
981 // note: these may at any point form a cycle, so a loop is needed and it
982 // must be detected that the last iteration closes the cycle and doesn't
983 // copy the first page desc of the cycle again.
984 std::map<OUString, OUString> followMap{ { rSourcePageDesc.GetName(), rTargetPageDesc.GetName() } };
985 SwPageDesc const* pCurSourcePageDesc(&rSourcePageDesc);
986 SwPageDesc const* pCurTargetPageDesc(&rTargetPageDesc);
987 do
988 {
989 const SwPageDesc* pFollowPageDesc = pCurSourcePageDesc->GetFollow();
990 OUString sFollowPageDesc = pFollowPageDesc->GetName();
991 if (sFollowPageDesc == pCurSourcePageDesc->GetName())
992 {
993 break;
994 }
995 SwDoc* pTargetDoc = rTargetShell.GetDoc();
996 SwPageDesc* pTargetFollowPageDesc(nullptr);
997 auto const itMapped(followMap.find(sFollowPageDesc));
998 if (itMapped == followMap.end())
999 {
1000 OUString sNewFollowPageDesc = lcl_FindUniqueName(&rTargetShell, sFollowPageDesc, nDocNo);
1001 pTargetFollowPageDesc = pTargetDoc->MakePageDesc(sNewFollowPageDesc);
1002 pTargetDoc->CopyPageDesc(*pFollowPageDesc, *pTargetFollowPageDesc, false);
1003 }
1004 else
1005 {
1006 pTargetFollowPageDesc = pTargetDoc->FindPageDesc(itMapped->second);
1007 }
1008 SwPageDesc aDesc(*pCurTargetPageDesc);
1009 aDesc.SetFollow(pTargetFollowPageDesc);
1010 pTargetDoc->ChgPageDesc(pCurTargetPageDesc->GetName(), aDesc);
1011 if (itMapped != followMap.end())
1012 {
1013 break; // was already copied
1014 }
1015 pCurSourcePageDesc = pCurSourcePageDesc->GetFollow();
1016 pCurTargetPageDesc = pTargetFollowPageDesc;
1017 followMap[pCurSourcePageDesc->GetName()] = pCurTargetPageDesc->GetName();
1018 }
1019 while (true);
1020}
1021
1022// appends all pages of source SwDoc - based on SwFEShell::Paste( SwDoc* )
1023SwNodeIndex SwDoc::AppendDoc(const SwDoc& rSource, sal_uInt16 const nStartPageNumber,
1024 bool const bDeletePrevious, int pageOffset, const sal_uLong nDocNo)
1025{
1026 SAL_INFO( "sw.pageframe", "(SwDoc::AppendDoc in " << bDeletePrevious );
1027
1028 // GetEndOfExtras + 1 = StartOfContent == no content node!
1029 // This ensures it won't be merged in the SwTextNode at the position.
1030 SwNodeIndex aSourceIdx( rSource.GetNodes().GetEndOfExtras(), 1 );
1031 // CopyRange works on the range a [mark, point[ and considers an
1032 // index < point outside the selection.
1033 // @see IDocumentContentOperations::CopyRange
1034 SwNodeIndex aSourceEndIdx( rSource.GetNodes().GetEndOfContent(), 0 );
1035 SwPaM aCpyPam( aSourceIdx, aSourceEndIdx );
1036
1037#ifdef DBG_UTIL
1038 SAL_INFO( "sw.docappend", "NodeType 0x" << std::hex << static_cast<int>(aSourceIdx.GetNode().GetNodeType())
1039 << std::dec << " " << aSourceIdx.GetNode().GetIndex() );
1040 ++aSourceIdx;
1041 SAL_INFO( "sw.docappend", "NodeType 0x" << std::hex << static_cast<int>(aSourceIdx.GetNode().GetNodeType())
1042 << std::dec << " " << aSourceIdx.GetNode().GetIndex() );
1043 if ( aSourceIdx.GetNode().GetNodeType() != SwNodeType::End ) {
1044 ++aSourceIdx;
1045 SAL_INFO( "sw.docappend", "NodeType 0x" << std::hex << static_cast<int>(aSourceIdx.GetNode().GetNodeType()) << std::dec );
1046 --aSourceIdx;
1047 }
1048 --aSourceIdx;
1049 SAL_INFO( "sw.docappend", ".." );
1050 SAL_INFO( "sw.docappend", "NodeType 0x" << std::hex << static_cast<int>(aSourceEndIdx.GetNode().GetNodeType())
1051 << std::dec << " " << aSourceEndIdx.GetNode().GetIndex() );
1052 SAL_INFO( "sw.docappend", "NodeType 0x" << std::hex << static_cast<int>(aSourceEndIdx.GetNode().GetNodeType())
1053 << std::dec << " " << aSourceEndIdx.GetNode().GetIndex() );
1054 SAL_INFO( "sw.docappend", "Src-Nd: " << CNTNT_DOC( &rSource ) );
1055 SAL_INFO( "sw.docappend", "Nd: " << CNTNT_DOC( this ) );
1056#endif
1057
1058 SwWrtShell* pTargetShell = GetDocShell()->GetWrtShell();
1059 SwPageDesc* pTargetPageDesc = nullptr;
1060
1061 if ( pTargetShell ) {
1062#ifdef DBG_UTIL
1063 SAL_INFO( "sw.docappend", "Has target write shell" );
1064#endif
1065 pTargetShell->StartAllAction();
1066
1067 if( nDocNo > 0 )
1068 {
1069 // #i72517# put the styles to the target document
1070 // if the source uses headers or footers the target document
1071 // needs individual page styles
1072 const SwWrtShell *pSourceShell = rSource.GetDocShell()->GetWrtShell();
1073 const SwPageDesc& rSourcePageDesc = pSourceShell->GetPageDesc(
1074 pSourceShell->GetCurPageDesc());
1075 const OUString sStartingPageDesc = rSourcePageDesc.GetName();
1076 const bool bPageStylesWithHeaderFooter = lcl_PageDescOrFollowContainsHeaderFooter(rSourcePageDesc);
1077 if( bPageStylesWithHeaderFooter )
1078 {
1079 // create a new pagestyle
1080 // copy the pagedesc from the current document to the new
1081 // document and change the name of the to-be-applied style
1082 OUString sNewPageDescName = lcl_FindUniqueName(pTargetShell, sStartingPageDesc, nDocNo );
1083 pTargetPageDesc = MakePageDesc( sNewPageDescName );
1084 if( pTargetPageDesc )
1085 {
1086 CopyPageDesc( rSourcePageDesc, *pTargetPageDesc, false );
1087 lcl_CopyFollowPageDesc( *pTargetShell, rSourcePageDesc, *pTargetPageDesc, nDocNo );
1088 }
1089 }
1090 else
1091 pTargetPageDesc = pTargetShell->FindPageDescByName( sStartingPageDesc );
1092 }
1093
1094 // Otherwise we have to handle SwPlaceholderNodes as first node
1095 if ( pTargetPageDesc )
1096 {
1097 SwNodeIndex aBreakIdx( GetNodes().GetEndOfContent(), -1 );
1098 SwPosition aBreakPos( aBreakIdx );
1099 // insert new node - will be removed at the end...
1100 // (don't SplitNode() as it may move flys to the wrong node)
1102 SwFormatPageDesc pageDesc(pTargetPageDesc);
1103 pageDesc.SetNumOffset(nStartPageNumber);
1104 // set break on the last paragraph
1106 pageDesc, SetAttrMode::DEFAULT, pTargetShell->GetLayout());
1107 // tdf#148309 move to the last node - so that the "flush page break"
1108 // code below will format the frame of the node with the page break,
1109 // which is required for new page frames to be created! Else layout
1110 // performance will be terrible.
1111 pTargetShell->SttEndDoc(false);
1112
1113 // There is now a new empty text node on the new page. If it has
1114 // any marks, those are from the previous page: move them back
1115 // there, otherwise later we can't delete that empty text node.
1116 SwNodeIndex aNodeIndex(GetNodes().GetEndOfContent(), -1);
1117 if (SwTextNode* pTextNode = aNodeIndex.GetNode().GetTextNode())
1118 {
1119 // Position of the last paragraph on the previous page.
1120 --aNodeIndex;
1121 SwPaM aPaM(aNodeIndex);
1122 // Collect the marks starting or ending at this text node.
1125 for (const SwContentIndex* pIndex = pTextNode->GetFirstIndex(); pIndex; pIndex = pIndex->GetNext())
1126 {
1127 sw::mark::IMark* pMark = const_cast<sw::mark::IMark*>(pIndex->GetMark());
1128 if (!pMark)
1129 continue;
1130 if (!aSeenMarks.insert(pMark).second)
1131 continue;
1132 }
1133 // And move them back.
1134 for (sw::mark::IMark* pMark : aSeenMarks)
1135 pMarkAccess->repositionMark(pMark, aPaM);
1136 }
1137
1138 // Flush the page break, if we want to keep it
1139 if ( !bDeletePrevious )
1140 {
1141 SAL_INFO( "sw.pageframe", "(Flush pagebreak AKA EndAllAction" );
1142 assert(pTargetShell->GetCursor()->GetPoint()->GetNode().GetTextNode()->GetSwAttrSet().HasItem(RES_PAGEDESC));
1143 pTargetShell->EndAllAction();
1144 SAL_INFO( "sw.pageframe", "Flush changes AKA EndAllAction)" );
1145 pTargetShell->StartAllAction();
1146 }
1147 }
1148 }
1149#ifdef DBG_UTIL
1150 SAL_INFO( "sw.docappend", "Nd: " << CNTNT_DOC( this ) );
1151#endif
1152
1153 // -1, otherwise aFixupIdx would move to new EOC
1154 SwNodeIndex aFixupIdx( GetNodes().GetEndOfContent(), -1 );
1155
1156 // append at the end of document / content
1157 SwPaM aInsertPam( GetNodes().GetEndOfContent() );
1158
1159#ifdef DBG_UTIL
1160 SAL_INFO( "sw.docappend", "Pam-Nd: " << aCpyPam.GetPointNode().GetIndex() - aCpyPam.GetMarkNode().GetIndex() + 1
1161 << " (0x" << std::hex << static_cast<int>(aCpyPam.GetMarkNode().GetNodeType()) << std::dec
1162 << " " << aCpyPam.GetMarkNode().GetIndex()
1163 << " - 0x" << std::hex << static_cast<int>(aCpyPam.GetPointNode().GetNodeType()) << std::dec
1164 << " " << aCpyPam.GetPointNode().GetIndex() << ")" );
1165#endif
1166
1167 GetIDocumentUndoRedo().StartUndo( SwUndoId::INSGLOSSARY, nullptr );
1169
1170 // Position where the appended doc starts. Will be filled in later.
1171 // Initially uses GetEndOfContent() because SwNodeIndex has no default ctor.
1172 SwNodeIndex aStartAppendIndex( GetNodes().GetEndOfContent() );
1173
1174 {
1175 // **
1176 // ** refer to SwFEShell::Paste, if you change the following code **
1177 // **
1178
1179 SwPosition& rInsPos = *aInsertPam.GetPoint();
1180
1181 {
1182 SwNodeIndex aIndexBefore(rInsPos.GetNode());
1183
1184 --aIndexBefore;
1185#ifdef DBG_UTIL
1186 SAL_INFO( "sw.docappend", "CopyRange In: " << CNTNT_DOC( this ) );
1187#endif
1189 // Note: aCpyPam is invalid now
1190#ifdef DBG_UTIL
1191 SAL_INFO( "sw.docappend", "CopyRange Out: " << CNTNT_DOC( this ) );
1192#endif
1193
1194 ++aIndexBefore;
1195 SwPaM aPaM(aIndexBefore.GetNode(), rInsPos.GetNode());
1196
1197 aPaM.GetDoc().MakeUniqueNumRules(aPaM);
1198
1199 // Update the rsid of each pasted text node
1200 SwNodes &rDestNodes = GetNodes();
1201 SwNodeOffset const nEndIdx = aPaM.End()->GetNodeIndex();
1202
1203 for (SwNodeOffset nIdx = aPaM.Start()->GetNodeIndex();
1204 nIdx <= nEndIdx; ++nIdx)
1205 {
1206 SwTextNode *const pTextNode = rDestNodes[nIdx]->GetTextNode();
1207 if ( pTextNode )
1208 UpdateParRsid( pTextNode );
1209 }
1210 }
1211
1212 {
1213 SwNodeOffset iDelNodes(0);
1214 SwNodeIndex aDelIdx( aFixupIdx );
1215
1216 // we just need to set the new page description and reset numbering
1217 // this keeps all other settings as in the pasted document
1218 if ( nStartPageNumber || pTargetPageDesc ) {
1219 std::unique_ptr<SfxPoolItem> pNewItem;
1220 SwTextNode *aTextNd = nullptr;
1221 SwFormat *pFormat = nullptr;
1222
1223 // find the first node allowed to contain a RES_PAGEDESC
1224 while (true) {
1225 ++aFixupIdx;
1226
1227 SwNode &node = aFixupIdx.GetNode();
1228 if ( node.IsTextNode() ) {
1229 // every document contains at least one text node!
1230 aTextNd = node.GetTextNode();
1231 pNewItem.reset(aTextNd->GetAttr( RES_PAGEDESC ).Clone());
1232 break;
1233 }
1234 else if ( node.IsTableNode() ) {
1235 pFormat = node.GetTableNode()->GetTable().GetFrameFormat();
1236 pNewItem.reset(pFormat->GetFormatAttr( RES_PAGEDESC ).Clone());
1237 break;
1238 }
1239 }
1240
1241#ifdef DBG_UTIL
1242 SAL_INFO( "sw.docappend", "Idx Del " << CNTNT_IDX( aDelIdx ) );
1243 SAL_INFO( "sw.docappend", "Idx Fix " << CNTNT_IDX( aFixupIdx ) );
1244#endif
1245 // just update the original instead of overwriting
1246 SwFormatPageDesc *aDesc = static_cast< SwFormatPageDesc* >( pNewItem.get() );
1247#ifdef DBG_UTIL
1248 if ( aDesc->GetPageDesc() )
1249 SAL_INFO( "sw.docappend", "PD Update " << aDesc->GetPageDesc()->GetName() );
1250 else
1251 SAL_INFO( "sw.docappend", "PD New" );
1252#endif
1253 if ( nStartPageNumber )
1254 aDesc->SetNumOffset( nStartPageNumber );
1255 if ( pTargetPageDesc )
1256 aDesc->RegisterToPageDesc( *pTargetPageDesc );
1257 if ( aTextNd )
1258 aTextNd->SetAttr( *aDesc );
1259 else
1260 pFormat->SetFormatAttr( *aDesc );
1261
1262#ifdef DBG_UTIL
1263 SAL_INFO( "sw.docappend", "Idx " << CNTNT_IDX( aDelIdx ) );
1264#endif
1265 iDelNodes++;
1266 }
1267
1268 if ( bDeletePrevious )
1269 iDelNodes++;
1270
1271 if ( iDelNodes ) {
1272 // delete leading empty page(s), e.g. from InsertPageBreak or
1273 // new SwDoc. this has to be done before copying the page bound
1274 // frames, otherwise the drawing layer gets confused.
1275 if ( pTargetShell )
1276 pTargetShell->SttEndDoc( false );
1277 aDelIdx -= iDelNodes - 1;
1278#ifdef DBG_UTIL
1279 SAL_INFO( "sw.docappend", "iDelNodes: " << iDelNodes
1280 << " Idx: " << aDelIdx.GetNode().GetIndex()
1281 << " EOE: " << GetNodes().GetEndOfExtras().GetIndex() );
1282#endif
1283 GetNodes().Delete( aDelIdx, iDelNodes );
1284 aStartAppendIndex = aFixupIdx;
1285 }
1286 else
1287 {
1288 aStartAppendIndex = aFixupIdx;
1289 ++aStartAppendIndex;
1290 }
1291 }
1292
1293 // finally copy page bound frames
1294 for(sw::SpzFrameFormat* pCpyFormat: *rSource.GetSpzFrameFormats())
1295 {
1296 const SwFrameFormat& rCpyFormat = *pCpyFormat;
1297 SwFormatAnchor aAnchor( rCpyFormat.GetAnchor() );
1298 if (RndStdIds::FLY_AT_PAGE != aAnchor.GetAnchorId())
1299 continue;
1300 SAL_INFO( "sw.docappend", "PaAn: " << aAnchor.GetPageNum()
1301 << " => " << aAnchor.GetPageNum() + pageOffset );
1302 if ( pageOffset != 0 )
1303 aAnchor.SetPageNum( aAnchor.GetPageNum() + pageOffset );
1304 getIDocumentLayoutAccess().CopyLayoutFormat( rCpyFormat, aAnchor, true, true );
1305 }
1306 }
1307
1308 GetIDocumentUndoRedo().EndUndo( SwUndoId::INSGLOSSARY, nullptr );
1309
1312
1313 if ( pTargetShell )
1314 pTargetShell->EndAllAction();
1315
1316 SAL_INFO( "sw.pageframe", "SwDoc::AppendDoc out)" );
1317 return aStartAppendIndex;
1318}
1319
1320/* 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 SAL_WARN_UNUSED_RESULT SfxViewFrame * GetNext(const SfxViewFrame &rPrev, const SfxObjectShell *pDoc=nullptr, bool bOnlyVisible=true)
static SAL_WARN_UNUSED_RESULT 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:727
bool SttEndDoc(bool bStt)
Definition: crsrsh.cxx:579
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:2891
SwWrtShell * GetWrtShell()
Access to the SwWrtShell belonging to SwView.
Definition: docsh.hxx:225
Definition: doc.hxx:197
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:1436
bool mbDtor
TRUE: is in SwDoc DTOR.
Definition: doc.hxx:312
std::unique_ptr< SwFrameFormat > mpColumnContFormat
Definition: doc.hxx:244
css::uno::Reference< css::linguistic2::XProofreadingIterator > m_xGCIterator
Definition: doc.hxx:217
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:243
SwDoc()
Definition: docnew.cxx:203
void ReplaceDefaults(const SwDoc &rSource)
Definition: docnew.cxx:851
void AddNumRule(SwNumRule *pRule)
Add numbering rule to document.
Definition: docnum.cxx:2474
std::unordered_map< OUString, SwNumRule * > maNumRuleMap
Definition: doc.hxx:282
std::unique_ptr< SwGrfFormatColl > mpDfltGrfFormatColl
Definition: doc.hxx:247
SwDocShell * mpDocShell
Definition: doc.hxx:269
std::unique_ptr< SwTOXTypes > mpTOXTypes
Definition: doc.hxx:257
~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:401
::sw::DocumentDrawModelManager const & GetDocumentDrawModelManager() const
Definition: doc.cxx:179
std::vector< std::weak_ptr< SwUnoCursor > > mvUnoCursorTable
Definition: doc.hxx:1670
IDocumentState const & getIDocumentState() const
Definition: doc.cxx:408
css::uno::Reference< css::embed::XStorage > GetDocStorage()
Definition: docnew.cxx:644
std::unique_ptr< SwAutoCorrExceptWord > mpACEWord
For the automated takeover of auto-corrected words that are "re-corrected".
Definition: doc.hxx:272
void ReplaceCompatibilityOptions(const SwDoc &rSource)
Definition: docnew.cxx:881
void WriteLayoutCache(SvStream &rStream)
Definition: docnew.cxx:814
std::unique_ptr< SwTextFormatColls > mpTextFormatCollTable
Definition: doc.hxx:254
const std::unique_ptr< ::sw::UndoManager > m_pUndoManager
Definition: doc.hxx:225
void SetLanguage(const LanguageType eLang, const sal_uInt16 nId)
Definition: doc.cxx:1864
o3tl::sorted_vector< SwRootFrame * > GetAllLayouts()
Definition: doclay.cxx:1699
SfxObjectShell * CreateCopy(bool bCallInitNew, bool bEmpty) const
Definition: docnew.cxx:893
rtl::Reference< SwAttrPool > mpAttrPool
Definition: doc.hxx:205
std::unique_ptr< SwLineNumberInfo > mpLineNumberInfo
Definition: doc.hxx:266
void ClearDoc()
Definition: docnew.cxx:658
SvNumberFormatter * mpNumberFormatter
Definition: doc.hxx:277
bool IsClipBoard() const
Definition: doc.hxx:978
::sw::DocumentFieldsManager & GetDocumentFieldsManager()
Definition: doc.cxx:381
std::unique_ptr< SwNodes > m_pNodes
Definition: doc.hxx:204
void SetDefault(const SfxPoolItem &)
Set attribute as new default attribute in current document.
Definition: docfmt.cxx:548
std::unique_ptr< SwURLStateChanged > mpURLStateChgd
Definition: doc.hxx:274
void cleanupUnoCursorTable() const
Definition: doc.hxx:1673
std::unique_ptr< SwCharFormats > mpCharFormatTable
Definition: doc.hxx:250
std::unique_ptr< ::sw::DocumentDeviceManager > m_pDeviceAccess
Definition: doc.hxx:228
std::unique_ptr< ::sfx2::IXmlIdRegistry > m_pXmlIdRegistry
Definition: doc.hxx:303
IDocumentLinksAdministration const & getIDocumentLinksAdministration() const
Definition: doc.cxx:274
SwDBData maDBData
Definition: doc.hxx:212
SwNumRule * mpOutlineRule
Definition: doc.hxx:263
SwPageDescs m_PageDescs
Definition: doc.hxx:206
IDocumentContentOperations const & getIDocumentContentOperations() const
Definition: doc.cxx:329
IDocumentUndoRedo & GetIDocumentUndoRedo()
Definition: doc.cxx:158
SwNodes & GetNodes()
Definition: doc.hxx:422
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
Definition: doc.cxx:371
std::unique_ptr< SwFootnoteInfo > mpFootnoteInfo
Definition: doc.hxx:264
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
Definition: doc.cxx:349
css::uno::Reference< ooo::vba::word::XFind > mxVbaFind
Definition: doc.hxx:295
::sfx2::IXmlIdRegistry & GetXmlIdRegistry()
Definition: docnew.cxx:820
void SetOLEObjModified()
update all modified OLE-Objects.
Definition: docnew.cxx:796
sal_uInt32 mnRsid
Definition: doc.hxx:307
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:260
sal_uInt32 mnRsidRoot
Definition: doc.hxx:308
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
Definition: doc.cxx:419
std::unique_ptr< SwTextFormatColl > mpDfltTextFormatColl
Definition: doc.hxx:246
SfxObjectShell * GetPersist() const
Definition: docnew.cxx:653
IDocumentMarkAccess * getIDocumentMarkAccess()
Definition: docbm.cxx:1890
MissingDictionary
Definition: doc.hxx:334
IDocumentStylePoolAccess const & getIDocumentStylePoolAccess() const
Definition: doc.cxx:440
std::unique_ptr< sw::TableFrameFormats > mpTableFrameFormatTable
Definition: doc.hxx:253
std::unique_ptr< sw::FrameFormats< SwFrameFormat * > > mpFrameFormatTable
Definition: doc.hxx:249
SwExtTextInput * mpExtInputRing
Definition: doc.hxx:285
const std::unique_ptr< ::sw::mark::MarkManager > mpMarkManager
Definition: doc.hxx:219
SwNodeIndex AppendDoc(const SwDoc &rSource, sal_uInt16 nStartPageNumber, bool bDeletePrevious, int physicalPageOffset, const sal_uLong nDocNo)
Definition: docnew.cxx:1023
void InitTOXTypes()
Definition: docnew.cxx:830
void ChgPageDesc(const OUString &rName, const SwPageDesc &)
Definition: docdesc.cxx:978
std::unique_ptr< SwNumRuleTable > mpNumRuleTable
Definition: doc.hxx:279
std::unique_ptr< SwDefTOXBase_Impl > mpDefTOXBases
Definition: doc.hxx:258
std::unique_ptr< SwLayoutCache > mpLayoutCache
Layout cache to read and save with the document for a faster formatting.
Definition: doc.hxx:288
static SwDoc * s_pLast
The last, still alive SwDoc instance, for debugging.
Definition: doc.hxx:343
css::uno::Reference< css::linguistic2::XProofreadingIterator > const & GetGCIterator() const
Definition: docnew.cxx:123
std::unique_ptr< SwSectionFormats > mpSectionFormatTable
Definition: doc.hxx:252
bool UpdateParRsid(SwTextNode *pTextNode, sal_uInt32 nVal=0)
Definition: docfmt.cxx:442
std::unique_ptr< SwPagePreviewPrtData > m_pPgPViewPrtData
Definition: doc.hxx:284
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1337
void SetPreviewPrtData(const SwPagePreviewPrtData *pData)
Definition: docnew.cxx:776
void ReadLayoutCache(SvStream &rStream)
SwDoc: Reading and writing of the layout cache.
Definition: docnew.cxx:802
std::unique_ptr< SwCharFormat > mpDfltCharFormat
Definition: doc.hxx:245
std::unique_ptr< SwEndNoteInfo > mpEndNoteInfo
Definition: doc.hxx:265
std::unique_ptr< SwFrameFormat > mpDfltFrameFormat
Definition: doc.hxx:242
std::mutex mNumberFormatterMutex
Definition: doc.hxx:276
void disposeXForms()
Definition: docxforms.cxx:89
void MakeUniqueNumRules(const SwPaM &rPaM)
Definition: docnum.cxx:1230
const std::unique_ptr< ::sw::DocumentSettingManager > m_pDocumentSettingManager
Definition: doc.hxx:226
::sw::DocumentSettingManager & GetDocumentSettingManager()
Definition: doc.cxx:200
void SetDocShell(SwDocShell *pDSh)
Definition: docnew.cxx:619
const sw::FrameFormats< sw::SpzFrameFormat * > * GetSpzFrameFormats() const
Definition: doc.hxx:759
std::unique_ptr< sw::FrameFormats< sw::SpzFrameFormat * > > mpSpzFrameFormatTable
Definition: doc.hxx:251
void DelPageDesc(const OUString &rName, bool bBroadcast=false)
Definition: docdesc.cxx:970
std::unique_ptr< IStyleAccess > mpStyleAccess
Definition: doc.hxx:287
IDocumentTimerAccess const & getIDocumentTimerAccess() const
Definition: doc.cxx:263
SwDocShell * GetDocShell()
Definition: doc.hxx:1370
::sw::UndoManager & GetUndoManager()
Definition: doc.cxx:147
std::unique_ptr< sw::OnlineAccessibilityCheck > mpOnlineAccessibilityCheck
Definition: doc.hxx:292
std::unique_ptr< SwFootnoteIdxs > mpFootnoteIdxs
Definition: doc.hxx:267
SwDBManager * m_pDBManager
Definition: doc.hxx:261
std::unique_ptr< sw::GrammarContact > mpGrammarContact
Definition: doc.hxx:291
IDocumentListsAccess const & getIDocumentListsAccess() const
Definition: doc.cxx:307
Idle maOLEModifiedIdle
Definition: doc.hxx:211
std::unique_ptr< SwGrfFormatColls > mpGrfFormatCollTable
Definition: doc.hxx:255
void StartAllAction()
For all views of this document.
Definition: edws.cxx:86
void EndAllAction()
Definition: edws.cxx:97
void DeleteAndDestroyAll()
Definition: docredln.cxx:2129
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:1593
RndStdIds GetAnchorId() const
Definition: fmtanchr.hxx:67
SwNode * GetAnchorNode() const
Definition: atrfrm.cxx:1614
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:72
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:123
SwNodeOffset GetIndex() const
Definition: ndindex.hxx:111
Base class of the Writer document model elements.
Definition: node.hxx:98
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:901
SwNodeOffset GetIndex() const
Definition: node.hxx:312
bool IsTableNode() const
Definition: node.hxx:191
bool IsTextNode() const
Definition: node.hxx:190
SwTableNode * GetTableNode()
Definition: node.hxx:650
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:121
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:1070
void DelNodes(const SwNodeIndex &rStart, SwNodeOffset nCnt=SwNodeOffset(1))
Delete a number of nodes.
Definition: nodes.cxx:1372
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:188
SwNode & GetPointNode() const
Definition: pam.hxx:275
const SwPosition * End() const
Definition: pam.hxx:263
SwPaM * GetNext()
Definition: pam.hxx:314
SwDoc & GetDoc() const
Definition: pam.hxx:291
SwNode & GetMarkNode() const
Definition: pam.hxx:276
const SwPosition * GetPoint() const
Definition: pam.hxx:253
const SwPosition * Start() const
Definition: pam.hxx:258
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:686
Array of Undo-history.
Definition: docary.hxx:193
const SwTable & GetTable() const
Definition: node.hxx:542
SwTableFormat * GetFrameFormat()
Definition: swtable.hxx:209
Represents the style of a paragraph.
Definition: fmtcol.hxx:61
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:112
const SfxPoolItem & GetAttr(sal_uInt16 nWhich, bool bInParent=true) const
End: Data collected during idle time.
Definition: node.hxx:732
virtual bool SetAttr(const SfxPoolItem &) override
overriding to handle change of certain paragraph attributes
Definition: ndtxt.cxx:5066
virtual SwFormatColl * ChgFormatColl(SwFormatColl *) override
Definition: ndtxt.cxx:4060
virtual sal_uInt16 ResetAllAttr() override
Definition: ndtxt.cxx:5321
static ShellResource * GetShellRes()
Definition: viewsh.cxx:2664
SwRootFrame * GetLayout() const
Definition: viewsh.cxx:2163
SwDoc * GetDoc() const
Definition: viewsh.hxx:308
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:94
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:90
#define CNTNT_DOC(doc)
Definition: docnew.cxx:887
static OUString lcl_FindUniqueName(SwWrtShell *pTargetShell, std::u16string_view rStartingPageDesc, sal_uLong nDocNo)
Definition: docnew.cxx:943
static void lcl_CopyFollowPageDesc(SwWrtShell &rTargetShell, const SwPageDesc &rSourcePageDesc, const SwPageDesc &rTargetPageDesc, const sal_uLong nDocNo)
Definition: docnew.cxx:974
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:957
#define CNTNT_IDX(idx)
Definition: docnew.cxx:889
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_CHRATR_END(46)
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_LANGUAGE(10)
constexpr sal_uInt16 RES_PARATR_BEGIN(RES_TXTATR_END)
constexpr sal_uInt16 RES_UNKNOWNATR_END(160)
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_CTL_LANGUAGE(29)
constexpr sal_uInt16 RES_FRMATR_END(141)
constexpr TypedWhichId< SwFormatPageDesc > RES_PAGEDESC(99)
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_CJK_LANGUAGE(24)
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_PARATR_LIST_END(88)
constexpr TypedWhichId< SvxLRSpaceItem > RES_LR_SPACE(97)
constexpr TypedWhichId< SvxULSpaceItem > RES_UL_SPACE(98)
#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:1538
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.
FrameFormats<::SwTableFormat * > TableFrameFormats
@ 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:38
SwNode & GetNode() const
Definition: pam.hxx:81
SwNodeOffset GetNodeIndex() const
Definition: pam.hxx:78
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