LibreOffice Module sw (master) 1
docfmt.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 <libxml/xmlwriter.h>
21#include <hintids.hxx>
22#include <svl/itemiter.hxx>
23#include <svl/numformat.hxx>
24#include <editeng/tstpitem.hxx>
25#include <editeng/lrspitem.hxx>
27#include <editeng/rsiditem.hxx>
28#include <editeng/colritem.hxx>
29#include <officecfg/Office/Common.hxx>
30#include <osl/diagnose.h>
31#include <svl/zforlist.hxx>
34#include <sal/log.hxx>
35#include <com/sun/star/i18n/WordType.hpp>
36#include <com/sun/star/i18n/XBreakIterator.hpp>
37#include <fmtpdsc.hxx>
38#include <fmthdft.hxx>
39#include <fmtcntnt.hxx>
40#include <doc.hxx>
41#include <docfunc.hxx>
42#include <drawdoc.hxx>
43#include <MarkManager.hxx>
45#include <IDocumentUndoRedo.hxx>
49#include <IDocumentState.hxx>
53#include <rootfrm.hxx>
54#include <txtfrm.hxx>
55#include <hints.hxx>
56#include <ndtxt.hxx>
57#include <pam.hxx>
58#include <UndoCore.hxx>
59#include <UndoAttribute.hxx>
60#include <UndoInsert.hxx>
61#include <pagedesc.hxx>
62#include <rolbck.hxx>
63#include <mvsave.hxx>
64#include <txatbase.hxx>
65#include <swtblfmt.hxx>
66#include <charfmt.hxx>
67#include <docary.hxx>
68#include <paratr.hxx>
69#include <redline.hxx>
70#include <reffld.hxx>
71#include <fmtinfmt.hxx>
72#include <breakit.hxx>
73#include <SwUndoFmt.hxx>
74#include <UndoManager.hxx>
75#include <swmodule.hxx>
76#include <modcfg.hxx>
77#include <frameformats.hxx>
78#include <textboxhelper.hxx>
80#include <memory>
81
82using namespace ::com::sun::star::i18n;
83using namespace ::com::sun::star::lang;
84using namespace ::com::sun::star::uno;
85
86/*
87 * Internal functions
88 */
89
90static void SetTextFormatCollNext( SwTextFormatColl* pTextColl, const SwTextFormatColl* pDel )
91{
92 if ( &pTextColl->GetNextTextFormatColl() == pDel )
93 {
94 pTextColl->SetNextTextFormatColl( *pTextColl );
95 }
96}
97
98static bool lcl_RstAttr( SwNode* pNd, void* pArgs )
99{
101 SwContentNode* pNode = pNd->GetContentNode();
102 if (pPara && pPara->pLayout && pPara->pLayout->HasMergedParas()
103 && pNode && pNode->GetRedlineMergeFlag() == SwNode::Merge::Hidden)
104 {
105 return true;
106 }
107 if( pNode && pNode->HasSwAttrSet() )
108 {
109 const bool bLocked = pNode->IsModifyLocked();
110 pNode->LockModify();
111
112 SwDoc& rDoc = pNode->GetDoc();
113
114 // remove unused attribute RES_LR_SPACE
115 // add list attributes
119 RES_PAGEDESC, RES_BREAK> aSavedAttrsSet(rDoc.GetAttrPool());
120 const SfxItemSet* pAttrSetOfNode = pNode->GetpSwAttrSet();
121
122 std::vector<sal_uInt16> aClearWhichIds;
123 // restoring all paragraph list attributes
124 {
126 aListAttrSet.Set(*pAttrSetOfNode);
127 if ( aListAttrSet.Count() )
128 {
129 aSavedAttrsSet.Put(aListAttrSet);
130 SfxItemIter aIter( aListAttrSet );
131 const SfxPoolItem* pItem = aIter.GetCurItem();
132 while( pItem )
133 {
134 aClearWhichIds.push_back( pItem->Which() );
135 pItem = aIter.NextItem();
136 }
137 }
138 }
139
140 const SfxPoolItem* pItem;
141
142 sal_uInt16 const aSavIds[3] = { RES_PAGEDESC, RES_BREAK, RES_PARATR_NUMRULE };
143 for (sal_uInt16 aSavId : aSavIds)
144 {
145 if (SfxItemState::SET == pAttrSetOfNode->GetItemState(aSavId, false, &pItem))
146 {
147 bool bSave = false;
148 switch( aSavId )
149 {
150 case RES_PAGEDESC:
151 bSave = nullptr != pItem->StaticWhichCast(RES_PAGEDESC).GetPageDesc();
152 break;
153 case RES_BREAK:
154 bSave = SvxBreak::NONE != pItem->StaticWhichCast(RES_BREAK).GetBreak();
155 break;
157 bSave = !pItem->StaticWhichCast(RES_PARATR_NUMRULE).GetValue().isEmpty();
158 break;
159 }
160 if( bSave )
161 {
162 aSavedAttrsSet.Put(*pItem);
163 aClearWhichIds.push_back(aSavId);
164 }
165 }
166 }
167
168 // do not clear items directly from item set and only clear to be kept
169 // attributes, if no deletion item set is found.
170 const bool bKeepAttributes =
171 !pPara || !pPara->pDelSet || pPara->pDelSet->Count() == 0;
172 if ( bKeepAttributes )
173 {
174 pNode->ResetAttr( aClearWhichIds );
175 }
176
177 if( !bLocked )
178 pNode->UnlockModify();
179
180 if( pPara )
181 {
182 SwRegHistory aRegH( pNode, *pNode, pPara->pHistory );
183
184 if( pPara->pDelSet && pPara->pDelSet->Count() )
185 {
186 OSL_ENSURE( !bKeepAttributes,
187 "<lcl_RstAttr(..)> - certain attributes are kept, but not needed." );
188 SfxItemIter aIter( *pPara->pDelSet );
189 for (pItem = aIter.GetCurItem(); pItem; pItem = aIter.NextItem())
190 {
191 if ( ( pItem->Which() != RES_PAGEDESC &&
192 pItem->Which() != RES_BREAK &&
193 pItem->Which() != RES_PARATR_NUMRULE ) ||
194 ( aSavedAttrsSet.GetItemState( pItem->Which(), false ) != SfxItemState::SET ) )
195 {
196 pNode->ResetAttr( pItem->Which() );
197 }
198 }
199 }
200 else if( pPara->bResetAll )
201 pNode->ResetAllAttr();
202 else
204 }
205 else
206 pNode->ResetAllAttr();
207
208 // only restore saved attributes, if needed
209 if (bKeepAttributes && aSavedAttrsSet.Count())
210 {
211 pNode->LockModify();
212
213 pNode->SetAttr(aSavedAttrsSet);
214
215 if( !bLocked )
216 pNode->UnlockModify();
217 }
218 }
219 return true;
220}
221
222void SwDoc::RstTextAttrs(const SwPaM &rRg, bool bInclRefToxMark,
223 bool bExactRange, SwRootFrame const*const pLayout)
224{
225 SwHistory* pHst = nullptr;
226 SwDataChanged aTmp( rRg );
227 if (GetIDocumentUndoRedo().DoesUndo())
228 {
229 std::unique_ptr<SwUndoResetAttr> pUndo(new SwUndoResetAttr( rRg, RES_CHRFMT ));
230 pHst = &pUndo->GetHistory();
231 GetIDocumentUndoRedo().AppendUndo(std::move(pUndo));
232 }
233 auto [pStt, pEnd] = rRg.StartEnd(); // SwPosition*
235 pStt, pEnd, pHst, nullptr, pLayout );
236 aPara.bInclRefToxMark = bInclRefToxMark;
237 aPara.bExactRange = bExactRange;
238 GetNodes().ForEach( pStt->GetNodeIndex(), pEnd->GetNodeIndex()+1,
241}
242
243void SwDoc::ResetAttrs( const SwPaM &rRg,
244 bool bTextAttr,
246 const bool bSendDataChangedEvents,
247 SwRootFrame const*const pLayout)
248{
249 SwPaM* pPam = const_cast<SwPaM*>(&rRg);
250 std::optional<SwPaM> oExtraPaM;
251 if( !bTextAttr && !rAttrs.empty() && RES_TXTATR_END > *(rAttrs.begin()) )
252 bTextAttr = true;
253
254 if( !rRg.HasMark() )
255 {
256 SwTextNode* pTextNd = rRg.GetPoint()->GetNode().GetTextNode();
257 if( !pTextNd )
258 return ;
259
260 oExtraPaM.emplace( *rRg.GetPoint() );
261 pPam = &*oExtraPaM;
262
263 SwPosition& rSt = *pPam->GetPoint();
264 sal_Int32 nMkPos, nPtPos = rSt.GetContentIndex();
265
266 // Special case: if the Cursor is located within a URL attribute, we take over it's area
267 SwTextAttr const*const pURLAttr(
269 if (pURLAttr && !pURLAttr->GetINetFormat().GetValue().isEmpty())
270 {
271 nMkPos = pURLAttr->GetStart();
272 nPtPos = *pURLAttr->End();
273 }
274 else
275 {
276 assert(g_pBreakIt && g_pBreakIt->GetBreakIter().is());
277 Boundary aBndry = g_pBreakIt->GetBreakIter()->getWordBoundary(
278 pTextNd->GetText(), nPtPos,
279 g_pBreakIt->GetLocale( pTextNd->GetLang( nPtPos ) ),
280 WordType::ANY_WORD /*ANYWORD_IGNOREWHITESPACES*/,
281 true);
282
283 if( aBndry.startPos < nPtPos && nPtPos < aBndry.endPos )
284 {
285 nMkPos = aBndry.startPos;
286 nPtPos = aBndry.endPos;
287 }
288 else
289 {
290 nPtPos = nMkPos = rSt.GetContentIndex();
291 if( bTextAttr )
292 pTextNd->DontExpandFormat( nPtPos );
293 }
294 }
295
296 rSt.SetContent(nMkPos);
297 pPam->SetMark();
298 pPam->GetPoint()->SetContent(nPtPos);
299 }
300
301 // #i96644#
302 std::optional< SwDataChanged > oDataChanged;
303 if ( bSendDataChangedEvents )
304 {
305 oDataChanged.emplace( *pPam );
306 }
307 SwHistory* pHst = nullptr;
308 if (GetIDocumentUndoRedo().DoesUndo())
309 {
310 std::unique_ptr<SwUndoResetAttr> pUndo(new SwUndoResetAttr( rRg,
311 bTextAttr ? sal_uInt16(RES_CONDTXTFMTCOLL) : sal_uInt16(RES_TXTFMTCOLL) ));
312 if( !rAttrs.empty() )
313 {
314 pUndo->SetAttrs( o3tl::sorted_vector(rAttrs) );
315 }
316 pHst = &pUndo->GetHistory();
317 GetIDocumentUndoRedo().AppendUndo(std::move(pUndo));
318 }
319
320 auto [pStt, pEnd] = pPam->StartEnd(); // SwPosition*
322 pStt, pEnd, pHst, nullptr, pLayout);
323
324 // mst: not including META here; it seems attrs with CH_TXTATR are omitted
329 aDelSet(GetAttrPool());
330 for( auto it = rAttrs.rbegin(); it != rAttrs.rend(); ++it )
331 {
332 if( POOLATTR_END > *it )
333 aDelSet.Put( *GetDfltAttr( *it ));
334 }
335 if( aDelSet.Count() )
336 aPara.pDelSet = &aDelSet;
337
338 bool bAdd = true;
339 SwNodeIndex aTmpStt( pStt->GetNode() );
340 SwNodeIndex aTmpEnd( pEnd->GetNode() );
341 if( pStt->GetContentIndex() ) // just one part
342 {
343 // set up a later, and all CharFormatAttr -> TextFormatAttr
344 SwTextNode* pTNd = aTmpStt.GetNode().GetTextNode();
345 if( pTNd && pTNd->HasSwAttrSet() && pTNd->GetpSwAttrSet()->Count() )
346 {
347 if (pHst)
348 {
349 SwRegHistory history(pTNd, *pTNd, pHst);
350 pTNd->FormatToTextAttr(pTNd);
351 }
352 else
353 {
354 pTNd->FormatToTextAttr(pTNd);
355 }
356 }
357
358 ++aTmpStt;
359 }
360 if( pEnd->GetContentIndex() == pEnd->GetNode().GetContentNode()->Len() )
361 {
362 // set up a later, and all CharFormatAttr -> TextFormatAttr
363 ++aTmpEnd;
364 bAdd = false;
365 }
366 else if( pStt->GetNode() != pEnd->GetNode() || !pStt->GetContentIndex() )
367 {
368 SwTextNode* pTNd = aTmpEnd.GetNode().GetTextNode();
369 if( pTNd && pTNd->HasSwAttrSet() && pTNd->GetpSwAttrSet()->Count() )
370 {
371 if (pHst)
372 {
373 SwRegHistory history(pTNd, *pTNd, pHst);
374 pTNd->FormatToTextAttr(pTNd);
375 }
376 else
377 {
378 pTNd->FormatToTextAttr(pTNd);
379 }
380 }
381 }
382
383 if( aTmpStt < aTmpEnd )
384 GetNodes().ForEach( pStt->GetNode(), aTmpEnd.GetNode(), lcl_RstAttr, &aPara );
385 else if( !rRg.HasMark() )
386 {
387 aPara.bResetAll = false ;
388 ::lcl_RstAttr( &pStt->GetNode(), &aPara );
389 aPara.bResetAll = true ;
390 }
391
392 if( bTextAttr )
393 {
394 if( bAdd )
395 ++aTmpEnd;
396 GetNodes().ForEach( pStt->GetNode(), aTmpEnd.GetNode(), sw::DocumentContentOperationsManager::lcl_RstTextAttr, &aPara );
397 }
398
400
401 oDataChanged.reset(); //before delete pPam
402}
403
405void SwDoc::UpdateRsid( const SwPaM &rRg, const sal_Int32 nLen )
406{
407 if (!SW_MOD()->GetModuleConfig()->IsStoreRsid())
408 return;
409
410 SwTextNode *pTextNode = rRg.GetPoint()->GetNode().GetTextNode();
411 if (!pTextNode)
412 {
413 return;
414 }
415 const sal_Int32 nStart(rRg.GetPoint()->GetContentIndex() - nLen);
417
419 aSet.Put(aRsid);
420 bool const bRet(pTextNode->SetAttr(aSet, nStart,
421 rRg.GetPoint()->GetContentIndex()));
422
423 if (bRet && GetIDocumentUndoRedo().DoesUndo())
424 {
425 SwUndo *const pLastUndo = GetUndoManager().GetLastUndo();
426 SwUndoInsert *const pUndoInsert(dynamic_cast<SwUndoInsert*>(pLastUndo));
427 // this function is called after Insert so expects to find SwUndoInsert
428 assert(pUndoInsert);
429 if (pUndoInsert)
430 {
431 pUndoInsert->SetWithRsid();
432 }
433 }
434}
435
436bool SwDoc::UpdateParRsid( SwTextNode *pTextNode, sal_uInt32 nVal )
437{
438 if (!SW_MOD()->GetModuleConfig()->IsStoreRsid())
439 return false;
440
441 if (!pTextNode)
442 {
443 return false;
444 }
445
446 SvxRsidItem aRsid( nVal ? nVal : mnRsid, RES_PARATR_RSID );
447 return pTextNode->SetAttr( aRsid );
448}
449
452void SwDoc::SetAttr( const SfxPoolItem& rAttr, SwFormat& rFormat )
453{
454 SfxItemSet aSet( GetAttrPool(), rAttr.Which(), rAttr.Which() );
455 aSet.Put( rAttr );
456 SetAttr( aSet, rFormat );
457}
458
461void SwDoc::SetAttr( const SfxItemSet& rSet, SwFormat& rFormat )
462{
463 if (GetIDocumentUndoRedo().DoesUndo())
464 {
465 SwUndoFormatAttrHelper aTmp( rFormat );
466 rFormat.SetFormatAttr( rSet );
467 if ( aTmp.GetUndo() )
468 {
469 GetIDocumentUndoRedo().AppendUndo( aTmp.ReleaseUndo() );
470 }
471 else
472 {
473 GetIDocumentUndoRedo().ClearRedo();
474 }
475 }
476 else
477 {
478 rFormat.SetFormatAttr( rSet );
479 }
480
481 // If the format is a shape, and it has a textbox, sync.
482 auto pShapeFormat = dynamic_cast<SwFrameFormat*>(&rFormat);
483 if (pShapeFormat && SwTextBoxHelper::isTextBox(pShapeFormat, RES_DRAWFRMFMT))
484 {
485 if (auto pObj = pShapeFormat->FindRealSdrObject())
486 {
487 SwTextBoxHelper::syncFlyFrameAttr(*pShapeFormat, rSet, pObj);
488 SwTextBoxHelper::changeAnchor(pShapeFormat, pObj);
489 }
490 }
491
493}
494
495void SwDoc::ResetAttrAtFormat( const sal_uInt16 nWhichId,
496 SwFormat& rChangedFormat )
497{
498 std::unique_ptr<SwUndo> pUndo;
499 if (GetIDocumentUndoRedo().DoesUndo())
500 pUndo.reset(new SwUndoFormatResetAttr( rChangedFormat, nWhichId ));
501
502 const bool bAttrReset = rChangedFormat.ResetFormatAttr( nWhichId );
503
504 if ( bAttrReset )
505 {
506 if ( pUndo )
507 {
508 GetIDocumentUndoRedo().AppendUndo( std::move(pUndo) );
509 }
510
512 }
513}
514
515static bool lcl_SetNewDefTabStops( SwTwips nOldWidth, SwTwips nNewWidth,
516 SvxTabStopItem& rChgTabStop )
517{
518 // Set the default values of all TabStops to the new value.
519 // Attention: we always work with the PoolAttribute here, so that
520 // we don't calculate the same value on the same TabStop (pooled!) for all sets.
521 // We send a FormatChg to modify.
522
523 sal_uInt16 nOldCnt = rChgTabStop.Count();
524 if( !nOldCnt || nOldWidth == nNewWidth )
525 return false;
526
527 // Find the default's beginning
528 sal_uInt16 n;
529 for( n = nOldCnt; n ; --n )
530 if( SvxTabAdjust::Default != rChgTabStop[n - 1].GetAdjustment() )
531 break;
532 ++n;
533 if( n < nOldCnt ) // delete the DefTabStops
534 rChgTabStop.Remove( n, nOldCnt - n );
535 return true;
536}
537
540void SwDoc::SetDefault( const SfxPoolItem& rAttr )
541{
542 SfxItemSet aSet( GetAttrPool(), rAttr.Which(), rAttr.Which() );
543 aSet.Put( rAttr );
544 SetDefault( aSet );
545}
546
547void SwDoc::SetDefault( const SfxItemSet& rSet )
548{
549 if( !rSet.Count() )
550 return;
551
552 sw::BroadcastingModify aCallMod;
553 SwAttrSet aOld( GetAttrPool(), rSet.GetRanges() ),
554 aNew( GetAttrPool(), rSet.GetRanges() );
555 SfxItemIter aIter( rSet );
556 const SfxPoolItem* pItem = aIter.GetCurItem();
558 do
559 {
560 bool bCheckSdrDflt = false;
561 const sal_uInt16 nWhich = pItem->Which();
562 aOld.Put( GetAttrPool().GetDefaultItem( nWhich ) );
564 aNew.Put( GetAttrPool().GetDefaultItem( nWhich ) );
565
566 if (isCHRATR(nWhich) || isTXTATR(nWhich))
567 {
568 aCallMod.Add( mpDfltTextFormatColl.get() );
569 aCallMod.Add( mpDfltCharFormat.get() );
570 bCheckSdrDflt = nullptr != pSdrPool;
571 }
572 else if ( isPARATR(nWhich) ||
573 isPARATR_LIST(nWhich) )
574 {
575 aCallMod.Add( mpDfltTextFormatColl.get() );
576 bCheckSdrDflt = nullptr != pSdrPool;
577 }
578 else if (isGRFATR(nWhich))
579 {
580 aCallMod.Add( mpDfltGrfFormatColl.get() );
581 }
582 else if (isFRMATR(nWhich) || isDrawingLayerAttribute(nWhich) )
583 {
584 aCallMod.Add( mpDfltGrfFormatColl.get() );
585 aCallMod.Add( mpDfltTextFormatColl.get() );
586 aCallMod.Add( mpDfltFrameFormat.get() );
587 }
588 else if (isBOXATR(nWhich))
589 {
590 aCallMod.Add( mpDfltFrameFormat.get() );
591 }
592
593 // also copy the defaults
594 if( bCheckSdrDflt )
595 {
596 sal_uInt16 nSlotId = GetAttrPool().GetSlotId( nWhich );
597 if( 0 != nSlotId && nSlotId != nWhich )
598 {
599 sal_uInt16 nEdtWhich = pSdrPool->GetWhich( nSlotId );
600 if( 0 != nEdtWhich && nSlotId != nEdtWhich )
601 {
602 std::unique_ptr<SfxPoolItem> pCpy(pItem->Clone());
603 pCpy->SetWhich( nEdtWhich );
604 pSdrPool->SetPoolDefaultItem( *pCpy );
605 }
606 }
607 }
608
609 pItem = aIter.NextItem();
610 } while (pItem);
611
612 if( aNew.Count() && aCallMod.HasWriterListeners() )
613 {
614 if (GetIDocumentUndoRedo().DoesUndo())
615 {
616 GetIDocumentUndoRedo().AppendUndo( std::make_unique<SwUndoDefaultAttr>( aOld, *this ) );
617 }
618
619 const SvxTabStopItem* pTmpItem = aNew.GetItemIfSet( RES_PARATR_TABSTOP, false );
620 if( pTmpItem && pTmpItem->Count() )
621 {
622 // Set the default values of all TabStops to the new value.
623 // Attention: we always work with the PoolAttribute here, so that
624 // we don't calculate the same value on the same TabStop (pooled!) for all sets.
625 // We send a FormatChg to modify.
626 SwTwips nNewWidth = (*pTmpItem)[ 0 ].GetTabPos(),
627 nOldWidth = aOld.Get(RES_PARATR_TABSTOP)[ 0 ].GetTabPos();
628
629 bool bChg = false;
630 for (const SfxPoolItem* pItem2 : GetAttrPool().GetItemSurrogates(RES_PARATR_TABSTOP))
631 {
632 if(auto pTabStopItem = pItem2->DynamicWhichCast(RES_PARATR_TABSTOP))
633 bChg |= lcl_SetNewDefTabStops( nOldWidth, nNewWidth,
634 *const_cast<SvxTabStopItem*>(pTabStopItem) );
635 }
636
638 aOld.ClearItem( RES_PARATR_TABSTOP );
639 if( bChg )
640 {
641 SwFormatChg aChgFormat( mpDfltCharFormat.get() );
642 // notify the frames
643 aCallMod.CallSwClientNotify(sw::LegacyModifyHint( &aChgFormat, &aChgFormat ));
644 }
645 }
646 }
647
648 if( aNew.Count() && aCallMod.HasWriterListeners() )
649 {
650 SwAttrSetChg aChgOld( aOld, aOld );
651 SwAttrSetChg aChgNew( aNew, aNew );
652 aCallMod.CallSwClientNotify(sw::LegacyModifyHint( &aChgOld, &aChgNew )); // all changed are sent
653 }
654
655 // remove the default formats from the object again
657 for(SwClient* pClient = aClientIter.First(); pClient; pClient = aClientIter.Next())
658 aCallMod.Remove( pClient );
659
661}
662
664const SfxPoolItem& SwDoc::GetDefault( sal_uInt16 nFormatHint ) const
665{
666 return GetAttrPool().GetDefaultItem( nFormatHint );
667}
668
670void SwDoc::DelCharFormat(size_t nFormat, bool bBroadcast)
671{
672 SwCharFormat * pDel = (*mpCharFormatTable)[nFormat];
673
674 if (bBroadcast)
675 BroadcastStyleOperation(pDel->GetName(), SfxStyleFamily::Char,
676 SfxHintId::StyleSheetErased);
677
678 if (GetIDocumentUndoRedo().DoesUndo())
679 {
680 GetIDocumentUndoRedo().AppendUndo(
681 std::make_unique<SwUndoCharFormatDelete>(pDel, *this));
682 }
683
684 delete (*mpCharFormatTable)[nFormat];
685 mpCharFormatTable->erase(mpCharFormatTable->begin() + nFormat);
686
688}
689
690void SwDoc::DelCharFormat( SwCharFormat const *pFormat, bool bBroadcast )
691{
692 size_t nFormat = mpCharFormatTable->GetPos( pFormat );
693 OSL_ENSURE( SIZE_MAX != nFormat, "Format not found," );
694 DelCharFormat( nFormat, bBroadcast );
695}
696
697void SwDoc::DelFrameFormat( SwFrameFormat *pFormat, bool bBroadcast )
698{
699 if( dynamic_cast<const SwTableBoxFormat*>( pFormat) != nullptr || dynamic_cast<const SwTableLineFormat*>( pFormat) != nullptr )
700 {
701 OSL_ENSURE( false, "Format is not in the DocArray any more, "
702 "so it can be deleted with delete" );
703 delete pFormat;
704 }
705 else
706 {
707 // The format has to be in the one or the other, we'll see in which one.
708 if (mpFrameFormatTable->ContainsFormat(*pFormat))
709 {
710 if (bBroadcast)
712 SfxStyleFamily::Frame,
713 SfxHintId::StyleSheetErased);
714
715 if (GetIDocumentUndoRedo().DoesUndo())
716 {
717 GetIDocumentUndoRedo().AppendUndo(
718 std::make_unique<SwUndoFrameFormatDelete>(pFormat, *this));
719 }
720
721 mpFrameFormatTable->erase( pFormat );
722 delete pFormat;
723 }
724 else
725 {
726 bool contains = GetSpzFrameFormats()->ContainsFormat(*pFormat);
727 OSL_ENSURE( contains, "FrameFormat not found." );
728 if( contains )
729 {
730 GetSpzFrameFormats()->erase( pFormat );
731 delete pFormat;
732 }
733 }
734 }
735}
736
738{
740 OSL_ENSURE( it != mpTableFrameFormatTable->end(), "Format not found," );
741 mpTableFrameFormatTable->erase( it );
742 delete pFormat;
743}
744
745SwFrameFormat* SwDoc::FindFrameFormatByName( const OUString& rName ) const
746{
747 return mpFrameFormatTable->FindFormatByName( rName );
748}
749
751SwFlyFrameFormat *SwDoc::MakeFlyFrameFormat( const OUString &rFormatName,
752 SwFrameFormat *pDerivedFrom )
753{
754 SwFlyFrameFormat *pFormat = new SwFlyFrameFormat( GetAttrPool(), rFormatName, pDerivedFrom );
755 GetSpzFrameFormats()->push_back(pFormat);
757 return pFormat;
758}
759
760SwDrawFrameFormat *SwDoc::MakeDrawFrameFormat( const OUString &rFormatName,
761 SwFrameFormat *pDerivedFrom )
762{
763 SwDrawFrameFormat *pFormat = new SwDrawFrameFormat( GetAttrPool(), rFormatName, pDerivedFrom);
764 GetSpzFrameFormats()->push_back(pFormat);
766 return pFormat;
767}
768
769size_t SwDoc::GetTableFrameFormatCount(bool bUsed) const
770{
771 if (!bUsed)
772 {
773 return mpTableFrameFormatTable->size();
774 }
775
777 size_t nCount = 0;
778 for (SwFrameFormat* const & pFormat : *mpTableFrameFormatTable)
779 {
780 if (!pFormat->GetInfo(aGetHt))
781 nCount++;
782 }
783 return nCount;
784}
785
786SwFrameFormat& SwDoc::GetTableFrameFormat(size_t nFormat, bool bUsed) const
787{
788 if (!bUsed)
789 {
790 return *((*mpTableFrameFormatTable)[nFormat]);
791 }
792
794
795 size_t index = 0;
796
797 for (SwFrameFormat* const & pFormat : *mpTableFrameFormatTable)
798 {
799 if (!pFormat->GetInfo(aGetHt))
800 {
801 if (index == nFormat)
802 return *pFormat;
803 else
804 index++;
805 }
806 }
807 throw std::out_of_range("Format index out of range.");
808}
809
810SwTableFormat* SwDoc::MakeTableFrameFormat( const OUString &rFormatName,
811 SwFrameFormat *pDerivedFrom )
812{
813 SwTableFormat* pFormat = new SwTableFormat( GetAttrPool(), rFormatName, pDerivedFrom );
814 mpTableFrameFormatTable->push_back( pFormat );
816
817 return pFormat;
818}
819
820SwFrameFormat *SwDoc::MakeFrameFormat(const OUString &rFormatName,
821 SwFrameFormat *pDerivedFrom,
822 bool bBroadcast, bool bAuto)
823{
824 SwFrameFormat *pFormat = new SwFrameFormat( GetAttrPool(), rFormatName, pDerivedFrom );
825
826 pFormat->SetAuto(bAuto);
827 mpFrameFormatTable->push_back( pFormat );
829
830 if (GetIDocumentUndoRedo().DoesUndo())
831 {
832 GetIDocumentUndoRedo().AppendUndo(
833 std::make_unique<SwUndoFrameFormatCreate>(pFormat, pDerivedFrom, *this));
834 }
835
836 if (bBroadcast)
837 {
838 BroadcastStyleOperation(rFormatName, SfxStyleFamily::Frame,
839 SfxHintId::StyleSheetCreated);
840 }
841
842 return pFormat;
843}
844
845SwFormat *SwDoc::MakeFrameFormat_(const OUString &rFormatName,
846 SwFormat *pDerivedFrom,
847 bool bBroadcast, bool bAuto)
848{
849 SwFrameFormat *pFrameFormat = dynamic_cast<SwFrameFormat*>(pDerivedFrom);
850 pFrameFormat = MakeFrameFormat( rFormatName, pFrameFormat, bBroadcast, bAuto );
851 return pFrameFormat;
852}
853
854SwCharFormat *SwDoc::MakeCharFormat( const OUString &rFormatName,
855 SwCharFormat *pDerivedFrom,
856 bool bBroadcast )
857{
858 SwCharFormat *pFormat = new SwCharFormat( GetAttrPool(), rFormatName, pDerivedFrom );
859 mpCharFormatTable->insert( pFormat );
860 pFormat->SetAuto(false);
862
863 if (GetIDocumentUndoRedo().DoesUndo())
864 {
865 GetIDocumentUndoRedo().AppendUndo(
866 std::make_unique<SwUndoCharFormatCreate>(pFormat, pDerivedFrom, *this));
867 }
868
869 if (bBroadcast)
870 {
871 BroadcastStyleOperation(rFormatName, SfxStyleFamily::Char,
872 SfxHintId::StyleSheetCreated);
873 }
874
875 return pFormat;
876}
877
878SwFormat *SwDoc::MakeCharFormat_(const OUString &rFormatName,
879 SwFormat *pDerivedFrom,
880 bool bBroadcast, bool /*bAuto*/)
881{
882 SwCharFormat *pCharFormat = dynamic_cast<SwCharFormat*>(pDerivedFrom);
883 pCharFormat = MakeCharFormat( rFormatName, pCharFormat, bBroadcast );
884 return pCharFormat;
885}
886
888SwTextFormatColl* SwDoc::MakeTextFormatColl( const OUString &rFormatName,
889 SwTextFormatColl *pDerivedFrom,
890 bool bBroadcast)
891{
892 SwTextFormatColl *pFormatColl = new SwTextFormatColl( GetAttrPool(), rFormatName,
893 pDerivedFrom );
894 mpTextFormatCollTable->push_back(pFormatColl);
895 pFormatColl->SetAuto(false);
897
898 if (GetIDocumentUndoRedo().DoesUndo())
899 {
900 GetIDocumentUndoRedo().AppendUndo(
901 std::make_unique<SwUndoTextFormatCollCreate>(pFormatColl, pDerivedFrom,
902 *this));
903 }
904
905 if (bBroadcast)
906 BroadcastStyleOperation(rFormatName, SfxStyleFamily::Para,
907 SfxHintId::StyleSheetCreated);
908
909 return pFormatColl;
910}
911
912SwFormat *SwDoc::MakeTextFormatColl_(const OUString &rFormatName,
913 SwFormat *pDerivedFrom,
914 bool bBroadcast, bool /*bAuto*/)
915{
916 SwTextFormatColl *pTextFormatColl = dynamic_cast<SwTextFormatColl*>(pDerivedFrom);
917 pTextFormatColl = MakeTextFormatColl( rFormatName, pTextFormatColl, bBroadcast );
918 return pTextFormatColl;
919}
920
922 SwTextFormatColl *pDerivedFrom,
923 bool bBroadcast)
924{
926 rFormatName, pDerivedFrom );
927 mpTextFormatCollTable->push_back(pFormatColl);
928 pFormatColl->SetAuto(false);
930
931 if (GetIDocumentUndoRedo().DoesUndo())
932 {
933 GetIDocumentUndoRedo().AppendUndo(
934 std::make_unique<SwUndoCondTextFormatCollCreate>(pFormatColl, pDerivedFrom,
935 *this));
936 }
937
938 if (bBroadcast)
939 BroadcastStyleOperation(rFormatName, SfxStyleFamily::Para,
940 SfxHintId::StyleSheetCreated);
941
942 return pFormatColl;
943}
944
945// GRF
946SwGrfFormatColl* SwDoc::MakeGrfFormatColl( const OUString &rFormatName,
947 SwGrfFormatColl *pDerivedFrom )
948{
949 SwGrfFormatColl *pFormatColl = new SwGrfFormatColl( GetAttrPool(), rFormatName,
950 pDerivedFrom );
951 mpGrfFormatCollTable->push_back( pFormatColl );
952 pFormatColl->SetAuto(false);
954 return pFormatColl;
955}
956
957void SwDoc::DelTextFormatColl(size_t nFormatColl, bool bBroadcast)
958{
959 OSL_ENSURE( nFormatColl, "Remove of Coll 0." );
960
961 // Who has the to-be-deleted as their Next?
962 SwTextFormatColl *pDel = (*mpTextFormatCollTable)[nFormatColl];
963 if( mpDfltTextFormatColl.get() == pDel )
964 return; // never delete default!
965
966 if (bBroadcast)
967 BroadcastStyleOperation(pDel->GetName(), SfxStyleFamily::Para,
968 SfxHintId::StyleSheetErased);
969
970 if (GetIDocumentUndoRedo().DoesUndo())
971 {
972 std::unique_ptr<SwUndoTextFormatCollDelete> pUndo;
973 if (RES_CONDTXTFMTCOLL == pDel->Which())
974 {
975 pUndo.reset(new SwUndoCondTextFormatCollDelete(pDel, *this));
976 }
977 else
978 {
979 pUndo.reset(new SwUndoTextFormatCollDelete(pDel, *this));
980 }
981
982 GetIDocumentUndoRedo().AppendUndo(std::move(pUndo));
983 }
984
985 // Remove the FormatColl
986 mpTextFormatCollTable->erase(mpTextFormatCollTable->begin() + nFormatColl);
987 // Correct next
988 for( SwTextFormatColls::const_iterator it = mpTextFormatCollTable->begin() + 1; it != mpTextFormatCollTable->end(); ++it )
989 SetTextFormatCollNext( *it, pDel );
990 delete pDel;
992}
993
994void SwDoc::DelTextFormatColl( SwTextFormatColl const *pColl, bool bBroadcast )
995{
996 size_t nFormat = mpTextFormatCollTable->GetPos( pColl );
997 OSL_ENSURE( SIZE_MAX != nFormat, "Collection not found," );
998 DelTextFormatColl( nFormat, bBroadcast );
999}
1000
1001static bool lcl_SetTextFormatColl( SwNode* pNode, void* pArgs )
1002{
1003 SwContentNode* pCNd = pNode->GetTextNode();
1004
1005 if( pCNd == nullptr)
1006 return true;
1007
1009
1010 if (pPara->pLayout && pPara->pLayout->HasMergedParas())
1011 {
1013 {
1014 return true;
1015 }
1016 if (pCNd->IsTextNode())
1017 {
1018 pCNd = sw::GetParaPropsNode(*pPara->pLayout, *pCNd);
1019 }
1020 }
1021
1022 SwTextFormatColl* pFormat = static_cast<SwTextFormatColl*>(pPara->pFormatColl);
1023 if ( pPara->bReset )
1024 {
1025 lcl_RstAttr(pCNd, pPara);
1026
1027 // #i62675# check, if paragraph style has changed
1028 if ( pPara->bResetListAttrs &&
1029 pFormat != pCNd->GetFormatColl() &&
1030 pFormat->GetItemState( RES_PARATR_NUMRULE ) == SfxItemState::SET )
1031 {
1032 // Check, if the list style of the paragraph will change.
1033 bool bChangeOfListStyleAtParagraph( true );
1034 SwTextNode& rTNd(*pCNd->GetTextNode());
1035 {
1036 SwNumRule* pNumRuleAtParagraph(rTNd.GetNumRule());
1037 if ( pNumRuleAtParagraph )
1038 {
1039 const SwNumRuleItem& rNumRuleItemAtParagraphStyle =
1040 pFormat->GetNumRule();
1041 if ( rNumRuleItemAtParagraphStyle.GetValue() ==
1042 pNumRuleAtParagraph->GetName() )
1043 {
1044 bChangeOfListStyleAtParagraph = false;
1045 }
1046 }
1047 }
1048
1049 if ( bChangeOfListStyleAtParagraph )
1050 {
1051 std::unique_ptr< SwRegHistory > pRegH;
1052 if ( pPara->pHistory )
1053 {
1054 pRegH.reset(new SwRegHistory(&rTNd, rTNd, pPara->pHistory));
1055 }
1056
1058
1059 // reset all list attributes
1065 }
1066 }
1067 }
1068
1069 // add to History so that old data is saved, if necessary
1070 if( pPara->pHistory )
1071 pPara->pHistory->Add( pCNd->GetFormatColl(), pCNd->GetIndex(),
1073
1074 pCNd->ChgFormatColl( pFormat );
1075
1076 pPara->nWhich++;
1077
1078 return true;
1079}
1080
1082 SwTextFormatColl *pFormat,
1083 const bool bReset,
1084 const bool bResetListAttrs,
1085 SwRootFrame const*const pLayout)
1086{
1087 SwDataChanged aTmp( rRg );
1088 auto [pStt, pEnd] = rRg.StartEnd(); // SwPosition*
1089 SwHistory* pHst = nullptr;
1090 bool bRet = true;
1091
1092 if (GetIDocumentUndoRedo().DoesUndo())
1093 {
1094 std::unique_ptr<SwUndoFormatColl> pUndo(new SwUndoFormatColl( rRg, pFormat,
1095 bReset,
1096 bResetListAttrs ));
1097 pHst = pUndo->GetHistory();
1098 GetIDocumentUndoRedo().AppendUndo(std::move(pUndo));
1099 }
1100
1102 pStt, pEnd, pHst, nullptr, pLayout);
1103 aPara.pFormatColl = pFormat;
1104 aPara.bReset = bReset;
1105 // #i62675#
1106 aPara.bResetListAttrs = bResetListAttrs;
1107
1108 GetNodes().ForEach( pStt->GetNodeIndex(), pEnd->GetNodeIndex()+1,
1109 lcl_SetTextFormatColl, &aPara );
1110 if( !aPara.nWhich )
1111 bRet = false; // didn't find a valid Node
1112
1113 if (bRet)
1114 {
1116 }
1117
1118 return bRet;
1119}
1120
1123 const SwFormatsBase& rFormatArr,
1124 FNCopyFormat fnCopyFormat, const SwFormat& rDfltFormat )
1125{
1126 // It's no autoformat, default format or collection format,
1127 // then search for it.
1128 if( !rFormat.IsAuto() || !rFormat.GetRegisteredIn() )
1129 for( size_t n = 0; n < rFormatArr.GetFormatCount(); ++n )
1130 {
1131 // Does the Doc already contain the template?
1132 if( rFormatArr.GetFormat(n)->GetName()==rFormat.GetName() )
1133 return rFormatArr.GetFormat(n);
1134 }
1135
1136 // Search for the "parent" first
1137 SwFormat* pParent = const_cast<SwFormat*>(&rDfltFormat);
1138 if( rFormat.DerivedFrom() && pParent != rFormat.DerivedFrom() )
1139 pParent = CopyFormat( *rFormat.DerivedFrom(), rFormatArr,
1140 fnCopyFormat, rDfltFormat );
1141
1142 // Create the format and copy the attributes
1143 // #i40550#
1144 SwFormat* pNewFormat = (this->*fnCopyFormat)( rFormat.GetName(), pParent, false, true );
1145 pNewFormat->SetAuto( rFormat.IsAuto() );
1146 pNewFormat->CopyAttrs( rFormat ); // copy the attributes
1147
1148 pNewFormat->SetPoolFormatId( rFormat.GetPoolFormatId() );
1149 pNewFormat->SetPoolHelpId( rFormat.GetPoolHelpId() );
1150
1151 // Always set the HelpFile Id to default!
1152 pNewFormat->SetPoolHlpFileId( UCHAR_MAX );
1153
1154 return pNewFormat;
1155}
1156
1159{
1160 return static_cast<SwFrameFormat*>(CopyFormat( rFormat, *GetFrameFormats(), &SwDoc::MakeFrameFormat_,
1161 *GetDfltFrameFormat() ));
1162}
1163
1166{
1167 return static_cast<SwCharFormat*>(CopyFormat( rFormat, *GetCharFormats(),
1169 *GetDfltCharFormat() ));
1170}
1171
1174{
1175 SwTextFormatColl* pNewColl = FindTextFormatCollByName( rColl.GetName() );
1176 if( pNewColl )
1177 return pNewColl;
1178
1179 // search for the "parent" first
1180 SwTextFormatColl* pParent = mpDfltTextFormatColl.get();
1181 if( pParent != rColl.DerivedFrom() )
1182 pParent = CopyTextColl( *static_cast<SwTextFormatColl*>(rColl.DerivedFrom()) );
1183
1184 if( RES_CONDTXTFMTCOLL == rColl.Which() )
1185 {
1186 pNewColl = new SwConditionTextFormatColl( GetAttrPool(), rColl.GetName(),
1187 pParent);
1188 mpTextFormatCollTable->push_back( pNewColl );
1189 pNewColl->SetAuto(false);
1191
1192 // copy the conditions
1193 static_cast<SwConditionTextFormatColl*>(pNewColl)->SetConditions(
1194 static_cast<const SwConditionTextFormatColl&>(rColl).GetCondColls() );
1195 }
1196 else
1197 pNewColl = MakeTextFormatColl( rColl.GetName(), pParent );
1198
1199 // copy the auto formats or the attributes
1200 pNewColl->CopyAttrs( rColl );
1201
1204 pNewColl->SetPoolFormatId( rColl.GetPoolFormatId() );
1205 pNewColl->SetPoolHelpId( rColl.GetPoolHelpId() );
1206
1207 // Always set the HelpFile Id to default!
1208 pNewColl->SetPoolHlpFileId( UCHAR_MAX );
1209
1210 if( &rColl.GetNextTextFormatColl() != &rColl )
1212
1213 // create the NumRule if necessary
1214 if( this != rColl.GetDoc() )
1215 {
1216 const SwNumRuleItem* pItem = pNewColl->GetItemIfSet( RES_PARATR_NUMRULE,
1217 false );
1218 if( pItem )
1219 {
1220 const OUString& rName = pItem->GetValue();
1221 if( !rName.isEmpty() )
1222 {
1223 const SwNumRule* pRule = rColl.GetDoc()->FindNumRulePtr( rName );
1224 if( pRule && !pRule->IsAutoRule() )
1225 {
1226 SwNumRule* pDestRule = FindNumRulePtr( rName );
1227 if( pDestRule )
1228 pDestRule->SetInvalidRule( true );
1229 else
1230 MakeNumRule( rName, pRule );
1231 }
1232 }
1233 }
1234 }
1235 return pNewColl;
1236}
1237
1240{
1241 SwGrfFormatColl* pNewColl = mpGrfFormatCollTable->FindFormatByName( rColl.GetName() );
1242 if( pNewColl )
1243 return pNewColl;
1244
1245 // Search for the "parent" first
1246 SwGrfFormatColl* pParent = mpDfltGrfFormatColl.get();
1247 if( pParent != rColl.DerivedFrom() )
1248 pParent = CopyGrfColl( *static_cast<SwGrfFormatColl*>(rColl.DerivedFrom()) );
1249
1250 // if not, copy them
1251 pNewColl = MakeGrfFormatColl( rColl.GetName(), pParent );
1252
1253 // copy the attributes
1254 pNewColl->CopyAttrs( rColl );
1255
1256 pNewColl->SetPoolFormatId( rColl.GetPoolFormatId() );
1257 pNewColl->SetPoolHelpId( rColl.GetPoolHelpId() );
1258
1259 // Always set the HelpFile Id to default!
1260 pNewColl->SetPoolHlpFileId( UCHAR_MAX );
1261
1262 return pNewColl;
1263}
1264
1265void SwDoc::CopyFormatArr( const SwFormatsBase& rSourceArr,
1266 SwFormatsBase const & rDestArr,
1267 FNCopyFormat fnCopyFormat,
1268 SwFormat& rDfltFormat )
1269{
1270 SwFormat* pSrc, *pDest;
1271
1272 // 1st step: Create all formats (skip the 0th - it's the default one)
1273 for( size_t nSrc = rSourceArr.GetFormatCount(); nSrc > 1; )
1274 {
1275 pSrc = rSourceArr.GetFormat( --nSrc );
1276 if( pSrc->IsDefault() || pSrc->IsAuto() )
1277 continue;
1278
1279 if( nullptr == rDestArr.FindFormatByName( pSrc->GetName() ) )
1280 {
1281 if( RES_CONDTXTFMTCOLL == pSrc->Which() )
1282 MakeCondTextFormatColl( pSrc->GetName(), static_cast<SwTextFormatColl*>(&rDfltFormat) );
1283 else
1284 // #i40550#
1285 (this->*fnCopyFormat)( pSrc->GetName(), &rDfltFormat, false, true );
1286 }
1287 }
1288
1289 // 2nd step: Copy all attributes, set the right parents
1290 for( size_t nSrc = rSourceArr.GetFormatCount(); nSrc > 1; )
1291 {
1292 pSrc = rSourceArr.GetFormat( --nSrc );
1293 if( pSrc->IsDefault() || pSrc->IsAuto() )
1294 continue;
1295
1296 pDest = rDestArr.FindFormatByName( pSrc->GetName() );
1297 pDest->SetAuto(false);
1298 pDest->DelDiffs( *pSrc );
1299
1300 // #i94285#: existing <SwFormatPageDesc> instance, before copying attributes
1301 const SwFormatPageDesc* pItem;
1302 if( &GetAttrPool() != pSrc->GetAttrSet().GetPool()
1303 && (pItem = pSrc->GetAttrSet().GetItemIfSet( RES_PAGEDESC, false ))
1304 && pItem->GetPageDesc() )
1305 {
1306 SwFormatPageDesc aPageDesc( *pItem );
1307 const OUString& rNm = aPageDesc.GetPageDesc()->GetName();
1308 SwPageDesc* pPageDesc = FindPageDesc( rNm );
1309 if( !pPageDesc )
1310 {
1311 pPageDesc = MakePageDesc(rNm);
1312 }
1313 aPageDesc.RegisterToPageDesc( *pPageDesc );
1314 SwAttrSet aTmpAttrSet( pSrc->GetAttrSet() );
1315 aTmpAttrSet.Put( aPageDesc );
1316 pDest->SetFormatAttr( aTmpAttrSet );
1317 }
1318 else
1319 {
1320 pDest->SetFormatAttr( pSrc->GetAttrSet() );
1321 }
1322
1323 pDest->SetPoolFormatId( pSrc->GetPoolFormatId() );
1324 pDest->SetPoolHelpId( pSrc->GetPoolHelpId() );
1325
1326 // Always set the HelpFile Id to default!
1327 pDest->SetPoolHlpFileId( UCHAR_MAX );
1328
1329 if( pSrc->DerivedFrom() )
1330 pDest->SetDerivedFrom( rDestArr.FindFormatByName(
1331 pSrc->DerivedFrom()->GetName() ) );
1332 if( RES_TXTFMTCOLL == pSrc->Which() ||
1333 RES_CONDTXTFMTCOLL == pSrc->Which() )
1334 {
1335 SwTextFormatColl* pSrcColl = static_cast<SwTextFormatColl*>(pSrc),
1336 * pDstColl = static_cast<SwTextFormatColl*>(pDest);
1337 if( &pSrcColl->GetNextTextFormatColl() != pSrcColl )
1338 pDstColl->SetNextTextFormatColl(
1339 *static_cast<SwTextFormatColl*>(rDestArr.FindFormatByName( pSrcColl->GetNextTextFormatColl().GetName() )) );
1340
1342 pDstColl->AssignToListLevelOfOutlineStyle(pSrcColl->GetAssignedOutlineStyleLevel());
1343
1344 if( RES_CONDTXTFMTCOLL == pSrc->Which() )
1345 {
1346 if (pDstColl->Which() != RES_CONDTXTFMTCOLL)
1347 {
1348 // Target already had a style with a matching name, but it's not a conditional
1349 // style, then don't copy the conditions.
1350 continue;
1351 }
1352
1353 // Copy the conditions, but delete the old ones first!
1354 static_cast<SwConditionTextFormatColl*>(pDstColl)->SetConditions(
1355 static_cast<SwConditionTextFormatColl*>(pSrc)->GetCondColls() );
1356 }
1357 }
1358 }
1359}
1360
1362 const SwFrameFormat& rSrcFormat, SwFrameFormat& rDestFormat )
1363{
1364 // Treat the header and footer attributes in the right way:
1365 // Copy content nodes across documents!
1366 sal_uInt16 nAttr = bCpyHeader ? sal_uInt16(RES_HEADER) : sal_uInt16(RES_FOOTER);
1367 const SfxPoolItem* pItem;
1368 if( SfxItemState::SET != rSrcFormat.GetAttrSet().GetItemState( nAttr, false, &pItem ))
1369 return ;
1370
1371 // The header only contains the reference to the format from the other document!
1372 std::unique_ptr<SfxPoolItem> pNewItem(pItem->Clone());
1373
1374 SwFrameFormat* pOldFormat;
1375 if( bCpyHeader )
1376 pOldFormat = pNewItem->StaticWhichCast(RES_HEADER).GetHeaderFormat();
1377 else
1378 pOldFormat = pNewItem->StaticWhichCast(RES_FOOTER).GetFooterFormat();
1379
1380 if( !pOldFormat )
1381 return;
1382
1383 SwFrameFormat* pNewFormat = new SwFrameFormat( GetAttrPool(), "CpyDesc",
1385 pNewFormat->CopyAttrs( *pOldFormat );
1386
1387 if( const SwFormatContent* pContent = pNewFormat->GetAttrSet().GetItemIfSet(
1388 RES_CNTNT, false ) )
1389 {
1390 if( pContent->GetContentIdx() )
1391 {
1392 const SwNodes& rSrcNds = rSrcFormat.GetDoc()->GetNodes();
1393 SwStartNode* pSttNd = SwNodes::MakeEmptySection( GetNodes().GetEndOfAutotext(),
1394 bCpyHeader
1397 const SwNode& rCSttNd = pContent->GetContentIdx()->GetNode();
1398 SwNodeRange aRg( rCSttNd, SwNodeOffset(0), *rCSttNd.EndOfSectionNode() );
1399 rSrcNds.Copy_( aRg, *pSttNd->EndOfSectionNode() );
1400 rSrcFormat.GetDoc()->GetDocumentContentOperationsManager().CopyFlyInFlyImpl(aRg, nullptr, *pSttNd);
1401 // TODO: investigate calling CopyWithFlyInFly?
1402 SwPaM const source(aRg.aStart, aRg.aEnd);
1403 SwPosition dest(*pSttNd);
1404 sw::CopyBookmarks(source, dest);
1405 pNewFormat->SetFormatAttr( SwFormatContent( pSttNd ));
1406 }
1407 else
1408 pNewFormat->ResetFormatAttr( RES_CNTNT );
1409 }
1410 if( bCpyHeader )
1411 pNewItem->StaticWhichCast(RES_HEADER).RegisterToFormat(*pNewFormat);
1412 else
1413 pNewItem->StaticWhichCast(RES_FOOTER).RegisterToFormat(*pNewFormat);
1414 rDestFormat.SetFormatAttr( *pNewItem );
1415}
1416
1417void SwDoc::CopyPageDesc( const SwPageDesc& rSrcDesc, SwPageDesc& rDstDesc,
1418 bool bCopyPoolIds )
1419{
1420 bool bNotifyLayout = false;
1422
1423 rDstDesc.SetLandscape( rSrcDesc.GetLandscape() );
1424 rDstDesc.SetNumType( rSrcDesc.GetNumType() );
1425 if( rDstDesc.ReadUseOn() != rSrcDesc.ReadUseOn() )
1426 {
1427 rDstDesc.WriteUseOn( rSrcDesc.ReadUseOn() );
1428 bNotifyLayout = true;
1429 }
1430
1431 if( bCopyPoolIds )
1432 {
1433 rDstDesc.SetPoolFormatId( rSrcDesc.GetPoolFormatId() );
1434 rDstDesc.SetPoolHelpId( rSrcDesc.GetPoolHelpId() );
1435 // Always set the HelpFile Id to default!
1436 rDstDesc.SetPoolHlpFileId( UCHAR_MAX );
1437 }
1438
1439 if( rSrcDesc.GetFollow() != &rSrcDesc )
1440 {
1441 const SwPageDesc* pSrcFollow = rSrcDesc.GetFollow();
1442 SwPageDesc* pFollow = FindPageDesc( pSrcFollow->GetName() );
1443 if( !pFollow )
1444 {
1445 // copy
1446 pFollow = MakePageDesc( pSrcFollow->GetName() );
1447 CopyPageDesc( *pSrcFollow, *pFollow );
1448 }
1449 rDstDesc.SetFollow( pFollow );
1450 bNotifyLayout = true;
1451 }
1452
1453 // the header and footer attributes are copied separately
1454 // the content sections have to be copied in their entirety
1455 {
1456 SfxItemSet aAttrSet( rSrcDesc.GetMaster().GetAttrSet() );
1457 aAttrSet.ClearItem( RES_HEADER );
1458 aAttrSet.ClearItem( RES_FOOTER );
1459
1460 rDstDesc.GetMaster().DelDiffs( aAttrSet );
1461 rDstDesc.GetMaster().SetFormatAttr( aAttrSet );
1462
1463 aAttrSet.ClearItem();
1464 aAttrSet.Put( rSrcDesc.GetLeft().GetAttrSet() );
1465 aAttrSet.ClearItem( RES_HEADER );
1466 aAttrSet.ClearItem( RES_FOOTER );
1467
1468 rDstDesc.GetLeft().DelDiffs( aAttrSet );
1469 rDstDesc.GetLeft().SetFormatAttr( aAttrSet );
1470
1471 aAttrSet.ClearItem();
1472 aAttrSet.Put( rSrcDesc.GetFirstMaster().GetAttrSet() );
1473 aAttrSet.ClearItem( RES_HEADER );
1474 aAttrSet.ClearItem( RES_FOOTER );
1475
1476 rDstDesc.GetFirstMaster().DelDiffs( aAttrSet );
1477 rDstDesc.GetFirstMaster().SetFormatAttr( aAttrSet );
1478
1479 aAttrSet.ClearItem();
1480 aAttrSet.Put( rSrcDesc.GetFirstLeft().GetAttrSet() );
1481 aAttrSet.ClearItem( RES_HEADER );
1482 aAttrSet.ClearItem( RES_FOOTER );
1483
1484 rDstDesc.GetFirstLeft().DelDiffs( aAttrSet );
1485 rDstDesc.GetFirstLeft().SetFormatAttr( aAttrSet );
1486 }
1487
1488 CopyHeader( rSrcDesc.GetMaster(), rDstDesc.GetMaster() );
1489 CopyFooter( rSrcDesc.GetMaster(), rDstDesc.GetMaster() );
1490 if( !rDstDesc.IsHeaderShared() )
1491 CopyHeader( rSrcDesc.GetLeft(), rDstDesc.GetLeft() );
1492 else
1493 rDstDesc.GetLeft().SetFormatAttr( rDstDesc.GetMaster().GetHeader() );
1494 if( !rDstDesc.IsFirstShared() )
1495 {
1496 CopyHeader( rSrcDesc.GetFirstMaster(), rDstDesc.GetFirstMaster() );
1497 rDstDesc.GetFirstLeft().SetFormatAttr(rDstDesc.GetFirstMaster().GetHeader());
1498 }
1499 else
1500 {
1501 rDstDesc.GetFirstMaster().SetFormatAttr( rDstDesc.GetMaster().GetHeader() );
1502 rDstDesc.GetFirstLeft().SetFormatAttr(rDstDesc.GetLeft().GetHeader());
1503 }
1504
1505 if( !rDstDesc.IsFooterShared() )
1506 CopyFooter( rSrcDesc.GetLeft(), rDstDesc.GetLeft() );
1507 else
1508 rDstDesc.GetLeft().SetFormatAttr( rDstDesc.GetMaster().GetFooter() );
1509 if( !rDstDesc.IsFirstShared() )
1510 {
1511 CopyFooter( rSrcDesc.GetFirstMaster(), rDstDesc.GetFirstMaster() );
1512 rDstDesc.GetFirstLeft().SetFormatAttr(rDstDesc.GetFirstMaster().GetFooter());
1513 }
1514 else
1515 {
1516 rDstDesc.GetFirstMaster().SetFormatAttr( rDstDesc.GetMaster().GetFooter() );
1517 rDstDesc.GetFirstLeft().SetFormatAttr(rDstDesc.GetLeft().GetFooter());
1518 }
1519
1520 if( bNotifyLayout && pTmpRoot )
1521 {
1522 for( auto aLayout : GetAllLayouts() )
1523 aLayout->AllCheckPageDescs();
1524 }
1525
1526 // If foot notes change the pages have to be triggered
1527 if( !(rDstDesc.GetFootnoteInfo() == rSrcDesc.GetFootnoteInfo()) )
1528 {
1530 rDstDesc.SetFootnoteInfo( rSrcDesc.GetFootnoteInfo() );
1531 rDstDesc.GetMaster().CallSwClientNotify(aHint);
1532 rDstDesc.GetLeft().CallSwClientNotify(aHint);
1533 rDstDesc.GetFirstMaster().CallSwClientNotify(aHint);
1534 rDstDesc.GetFirstLeft().CallSwClientNotify(aHint);
1535 }
1536
1537 // Copy the stashed formats as well between the page descriptors...
1538 for (bool bFirst : { true, false })
1539 for (bool bLeft : { true, false })
1540 for (bool bHeader : { true, false })
1541 {
1542 if (!bLeft && !bFirst)
1543 continue;
1544 if (auto pStashedFormat = rSrcDesc.GetStashedFrameFormat(bHeader, bLeft, bFirst))
1545 rDstDesc.StashFrameFormat(*pStashedFormat, bHeader, bLeft, bFirst);
1546 }
1547}
1548
1549void SwDoc::ReplaceStyles( const SwDoc& rSource, bool bIncludePageStyles )
1550{
1551 ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo());
1552
1559
1560 //To-Do:
1561 // a) in rtf export don't export our hideous pgdsctbl
1562 // extension to rtf anymore
1563 // b) in sd rtf import (View::InsertData) don't use
1564 // a super-fragile test for mere presence of \trowd to
1565 // indicate import of rtf into a table
1566 // c) then drop use of bIncludePageStyles
1567 if (bIncludePageStyles)
1568 {
1569 // and now the page templates
1570 SwPageDescs::size_type nCnt = rSource.m_PageDescs.size();
1571 if( nCnt )
1572 {
1573 // a different Doc -> Number formatter needs to be merged
1574 SwTableNumFormatMerge aTNFM( rSource, *this );
1575
1576 // 1st step: Create all formats (skip the 0th - it's the default!)
1577 while( nCnt )
1578 {
1579 const SwPageDesc &rSrc = *rSource.m_PageDescs[ --nCnt ];
1580 if( nullptr == FindPageDesc( rSrc.GetName() ) )
1581 MakePageDesc( rSrc.GetName() );
1582 }
1583
1584 // 2nd step: Copy all attributes, set the right parents
1585 for (SwPageDescs::size_type i = rSource.m_PageDescs.size(); i; )
1586 {
1587 const SwPageDesc &rSrc = *rSource.m_PageDescs[ --i ];
1588 SwPageDesc* pDesc = FindPageDesc( rSrc.GetName() );
1589 CopyPageDesc( rSrc, *pDesc);
1590 }
1591 }
1592 }
1593
1594 // then there are the numbering templates
1595 const SwNumRuleTable::size_type nCnt = rSource.GetNumRuleTable().size();
1596 if( nCnt )
1597 {
1598 const SwNumRuleTable& rArr = rSource.GetNumRuleTable();
1599 for( SwNumRuleTable::size_type n = 0; n < nCnt; ++n )
1600 {
1601 const SwNumRule& rR = *rArr[ n ];
1602 SwNumRule* pNew = FindNumRulePtr( rR.GetName());
1603 if( pNew )
1604 pNew->CopyNumRule(*this, rR);
1605 else
1606 {
1607 if( !rR.IsAutoRule() )
1608 MakeNumRule( rR.GetName(), &rR );
1609 else
1610 {
1611 // as we reset all styles, there shouldn't be any unknown
1612 // automatic SwNumRules, because all should have been
1613 // created by the style copying!
1614 // So just warn and ignore.
1615 SAL_WARN( "sw.core", "Found unknown auto SwNumRule during reset!" );
1616 }
1617 }
1618 }
1619 }
1620
1621 if (undoGuard.UndoWasEnabled())
1622 {
1623 // nodes array was modified!
1624 GetIDocumentUndoRedo().DelAllUndoObj();
1625 }
1626
1628}
1629
1630void SwDoc::MoveLeftMargin(const SwPaM& rPam, bool bRight, bool bModulus,
1631 SwRootFrame const*const pLayout)
1632{
1633 SwHistory* pHistory = nullptr;
1634 if (GetIDocumentUndoRedo().DoesUndo())
1635 {
1636 std::unique_ptr<SwUndoMoveLeftMargin> pUndo(new SwUndoMoveLeftMargin( rPam, bRight,
1637 bModulus ));
1638 pHistory = &pUndo->GetHistory();
1639 GetIDocumentUndoRedo().AppendUndo( std::move(pUndo) );
1640 }
1641
1642 const SvxTabStopItem& rTabItem = GetDefault( RES_PARATR_TABSTOP );
1643 const sal_Int32 nDefDist = rTabItem.Count() ? rTabItem[0].GetTabPos() : 1134;
1644 const SwPosition &rStt = *rPam.Start(), &rEnd = *rPam.End();
1645 SwNodeIndex aIdx( rStt.GetNode() );
1646 while( aIdx <= rEnd.GetNode() )
1647 {
1648 SwTextNode* pTNd = aIdx.GetNode().GetTextNode();
1649 if( pTNd )
1650 {
1651 pTNd = sw::GetParaPropsNode(*pLayout, aIdx.GetNode());
1652 SvxFirstLineIndentItem firstLine(pTNd->SwContentNode::GetAttr(RES_MARGIN_FIRSTLINE));
1653 SvxTextLeftMarginItem leftMargin(pTNd->SwContentNode::GetAttr(RES_MARGIN_TEXTLEFT));
1654
1655 // #i93873# See also lcl_MergeListLevelIndentAsLRSpaceItem in thints.cxx
1657 if (indents != ::sw::ListLevelIndents::No)
1658 {
1659 const SwNumRule* pRule = pTNd->GetNumRule();
1660 if ( pRule )
1661 {
1662 const int nListLevel = pTNd->GetActualListLevel();
1663 if ( nListLevel >= 0 )
1664 {
1665 const SwNumFormat& rFormat = pRule->Get(o3tl::narrowing<sal_uInt16>(nListLevel));
1667 {
1669 {
1670 leftMargin.SetTextLeft(rFormat.GetIndentAt());
1671 }
1672 if (indents & ::sw::ListLevelIndents::FirstLine)
1673 {
1674 firstLine.SetTextFirstLineOffset(static_cast<short>(rFormat.GetFirstLineIndent()));
1675 }
1676 }
1677 }
1678 }
1679 }
1680
1681 tools::Long nNext = leftMargin.GetTextLeft();
1682 if( bModulus )
1683 nNext = ( nNext / nDefDist ) * nDefDist;
1684
1685 if( bRight )
1686 nNext += nDefDist;
1687 else
1688 if(nNext >0) // fdo#75936 set limit for decreasing indent
1689 nNext -= nDefDist;
1690
1691 leftMargin.SetTextLeft( nNext );
1692
1693 SwRegHistory aRegH( pTNd, *pTNd, pHistory );
1694 pTNd->SetAttr(firstLine);
1695 pTNd->SetAttr(leftMargin);
1696 aIdx = *sw::GetFirstAndLastNode(*pLayout, aIdx.GetNode()).second;
1697 }
1698 ++aIdx;
1699 }
1701}
1702
1703bool SwDoc::DontExpandFormat( const SwPosition& rPos, bool bFlag )
1704{
1705 bool bRet = false;
1706 SwTextNode* pTextNd = rPos.GetNode().GetTextNode();
1707 if( pTextNd )
1708 {
1709 bRet = pTextNd->DontExpandFormat( rPos.GetContentIndex(), bFlag );
1710 if( bRet && GetIDocumentUndoRedo().DoesUndo() )
1711 {
1712 GetIDocumentUndoRedo().AppendUndo( std::make_unique<SwUndoDontExpandFormat>(rPos) );
1713 }
1714 }
1715 return bRet;
1716}
1717
1719{
1721 pFormat->SetFormatName("TableBox" + OUString::number(reinterpret_cast<sal_IntPtr>(pFormat)));
1723 return pFormat;
1724}
1725
1727{
1729 pFormat->SetFormatName("TableLine" + OUString::number(reinterpret_cast<sal_IntPtr>(pFormat)));
1731 return pFormat;
1732}
1733
1735{
1736 if (mpNumberFormatter == nullptr)
1737 {
1744 };
1745}
1746
1748 : pNFormat( nullptr )
1749{
1750 // a different Doc -> Number formatter needs to be merged
1751 if( &rSrc != &rDest )
1752 {
1753 SvNumberFormatter* pN = const_cast<SwDoc&>(rSrc).GetNumberFormatter( false );
1754 if( pN )
1755 {
1756 pNFormat = rDest.GetNumberFormatter();
1757 pNFormat->MergeFormatter( *pN );
1758 }
1759 }
1760
1761 if( &rSrc != &rDest )
1763 MergeWithOtherDoc( rDest );
1764}
1765
1767{
1768 if( pNFormat )
1770}
1771
1772void SwDoc::SetTextFormatCollByAutoFormat( const SwPosition& rPos, sal_uInt16 nPoolId,
1773 const SfxItemSet* pSet )
1774{
1775 SwPaM aPam( rPos );
1776 SwTextNode* pTNd = rPos.GetNode().GetTextNode();
1777 assert(pTNd);
1778
1780 {
1781 // create the redline object
1782 const SwTextFormatColl& rColl = *pTNd->GetTextColl();
1783 SwRangeRedline* pRedl = new SwRangeRedline( RedlineType::FmtColl, aPam );
1784 pRedl->SetMark();
1785
1786 // Only those items that are not set by the Set again in the Node
1787 // are of interest. Thus, we take the difference.
1788 SwRedlineExtraData_FormatColl aExtraData( rColl.GetName(),
1789 rColl.GetPoolFormatId() );
1790 if( pSet && pTNd->HasSwAttrSet() )
1791 {
1792 SfxItemSet aTmp( *pTNd->GetpSwAttrSet() );
1793 aTmp.Differentiate( *pSet );
1794 // we handle the adjust item separately
1795 const SfxPoolItem* pItem;
1796 if( SfxItemState::SET == pTNd->GetpSwAttrSet()->GetItemState(
1797 RES_PARATR_ADJUST, false, &pItem ))
1798 aTmp.Put( *pItem );
1799 aExtraData.SetItemSet( aTmp );
1800 }
1801 pRedl->SetExtraData( &aExtraData );
1802
1803 //TODO: Undo is still missing!
1805 }
1806
1807 SetTextFormatColl( aPam, getIDocumentStylePoolAccess().GetTextCollFromPool( nPoolId ) );
1808
1809 if (pSet && pSet->Count())
1810 {
1811 aPam.SetMark();
1812 aPam.GetMark()->SetContent(pTNd->GetText().getLength());
1813 // sw_redlinehide: don't need layout currently because the only caller
1814 // passes in the properties node
1815 assert(static_cast<SwTextFrame const*>(pTNd->getLayoutFrame(nullptr))->GetTextNodeForParaProps() == pTNd);
1817 }
1818}
1819
1820void SwDoc::SetFormatItemByAutoFormat( const SwPaM& rPam, const SfxItemSet& rSet )
1821{
1822 SwTextNode* pTNd = rPam.GetPoint()->GetNode().GetTextNode();
1823 assert(pTNd);
1824
1826
1828 {
1829 // create the redline object
1830 SwRangeRedline* pRedl = new SwRangeRedline( RedlineType::Format, rPam );
1831 if( !pRedl->HasMark() )
1832 pRedl->SetMark();
1833
1834 // Only those items that are not set by the Set again in the Node
1835 // are of interest. Thus, we take the difference.
1836 SwRedlineExtraData_Format aExtraData( rSet );
1837
1838 pRedl->SetExtraData( &aExtraData );
1839
1840 //TODO: Undo is still missing!
1842
1844 }
1845
1846 const sal_Int32 nEnd(rPam.End()->GetContentIndex());
1847 std::vector<WhichPair> whichIds;
1848 SfxItemIter iter(rSet);
1849 for (SfxPoolItem const* pItem = iter.GetCurItem(); pItem; pItem = iter.NextItem())
1850 {
1851 whichIds.push_back({pItem->Which(), pItem->Which()});
1852 }
1853 SfxItemSet currentSet(GetAttrPool(), WhichRangesContainer(whichIds.data(), whichIds.size()));
1854 pTNd->GetParaAttr(currentSet, nEnd, nEnd);
1855 for (const WhichPair& rPair : whichIds)
1856 { // yuk - want to explicitly set the pool defaults too :-/
1857 currentSet.Put(currentSet.Get(rPair.first));
1858 }
1859
1861
1862 // fdo#62536: DONTEXPAND does not work when there is already an AUTOFMT
1863 // here, so insert the old attributes as an empty hint to stop expand
1864 SwPaM endPam(*pTNd, nEnd);
1865 endPam.SetMark();
1866 getIDocumentContentOperations().InsertItemSet(endPam, currentSet);
1867
1869}
1870
1871void SwDoc::ChgFormat(SwFormat & rFormat, const SfxItemSet & rSet)
1872{
1873 if (GetIDocumentUndoRedo().DoesUndo())
1874 {
1875 // copying <rSet> to <aSet>
1876 SfxItemSet aSet(rSet);
1877 // remove from <aSet> all items, which are already set at the format
1878 aSet.Differentiate(rFormat.GetAttrSet());
1879 // <aSet> contains now all *new* items for the format
1880
1881 // copying current format item set to <aOldSet>
1882 SfxItemSet aOldSet(rFormat.GetAttrSet());
1883 // insert new items into <aOldSet>
1884 aOldSet.Put(aSet);
1885 // invalidate all new items in <aOldSet> in order to clear these items,
1886 // if the undo action is triggered.
1887 {
1888 SfxItemIter aIter(aSet);
1889
1890 for (const SfxPoolItem* pItem = aIter.GetCurItem(); pItem; pItem = aIter.NextItem())
1891 {
1892 aOldSet.InvalidateItem(pItem->Which());
1893 }
1894 }
1895
1896 GetIDocumentUndoRedo().AppendUndo(
1897 std::make_unique<SwUndoFormatAttr>(std::move(aOldSet), rFormat, /*bSaveDrawPt*/true));
1898 }
1899
1900 rFormat.SetFormatAttr(rSet);
1901}
1902
1903void SwDoc::RenameFormat(SwFormat & rFormat, const OUString & sNewName,
1904 bool bBroadcast)
1905{
1906 SfxStyleFamily eFamily = SfxStyleFamily::All;
1907
1908 if (GetIDocumentUndoRedo().DoesUndo())
1909 {
1910 std::unique_ptr<SwUndo> pUndo;
1911
1912 switch (rFormat.Which())
1913 {
1914 case RES_CHRFMT:
1915 pUndo.reset(new SwUndoRenameCharFormat(rFormat.GetName(), sNewName, *this));
1916 eFamily = SfxStyleFamily::Char;
1917 break;
1918 case RES_TXTFMTCOLL:
1919 pUndo.reset(new SwUndoRenameFormatColl(rFormat.GetName(), sNewName, *this));
1920 eFamily = SfxStyleFamily::Para;
1921 break;
1922 case RES_FRMFMT:
1923 pUndo.reset(new SwUndoRenameFrameFormat(rFormat.GetName(), sNewName, *this));
1924 eFamily = SfxStyleFamily::Frame;
1925 break;
1926
1927 default:
1928 break;
1929 }
1930
1931 if (pUndo)
1932 {
1933 GetIDocumentUndoRedo().AppendUndo(std::move(pUndo));
1934 }
1935 }
1936
1937 // name change means the o3tl::sorted_array is not property sorted
1938 if (rFormat.Which() == RES_CHRFMT)
1939 mpCharFormatTable->SetFormatNameAndReindex(static_cast<SwCharFormat*>(&rFormat), sNewName);
1940 else
1941 rFormat.SetFormatName(sNewName);
1942
1943 if (bBroadcast)
1944 BroadcastStyleOperation(sNewName, eFamily, SfxHintId::StyleSheetModified);
1945}
1946
1948{
1949 bool bOwns = false;
1950 if (!pWriter)
1951 {
1952 pWriter = xmlNewTextWriterFilename("nodes.xml", 0);
1953 xmlTextWriterSetIndent(pWriter,1);
1954 (void)xmlTextWriterSetIndentString(pWriter, BAD_CAST(" "));
1955 (void)xmlTextWriterStartDocument(pWriter, nullptr, nullptr, nullptr);
1956 bOwns = true;
1957 }
1958 (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SwDoc"));
1959 (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this);
1960
1961 m_pNodes->dumpAsXml(pWriter);
1962 m_PageDescs.dumpAsXml(pWriter);
1963 maDBData.dumpAsXml(pWriter);
1964 mpMarkManager->dumpAsXml(pWriter);
1965 m_pContentControlManager->dumpAsXml(pWriter);
1966 m_pUndoManager->dumpAsXml(pWriter);
1967 m_pDocumentSettingManager->dumpAsXml(pWriter);
1969 mpTextFormatCollTable->dumpAsXml(pWriter);
1970 mpCharFormatTable->dumpAsXml(pWriter);
1971 mpFrameFormatTable->dumpAsXml(pWriter, "frmFormatTable");
1972 mpSpzFrameFormatTable->dumpAsXml(pWriter, "spzFrameFormatTable");
1973 mpSectionFormatTable->dumpAsXml(pWriter);
1974 mpTableFrameFormatTable->dumpAsXml(pWriter, "tableFrameFormatTable");
1975 mpNumRuleTable->dumpAsXml(pWriter);
1978 if (const SdrModel* pModel = getIDocumentDrawModelAccess().GetDrawModel())
1979 pModel->dumpAsXml(pWriter);
1980
1981 (void)xmlTextWriterStartElement(pWriter, BAD_CAST("mbModified"));
1982 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"), BAD_CAST(OString::boolean(getIDocumentState().IsModified()).getStr()));
1983 (void)xmlTextWriterEndElement(pWriter);
1984
1985 (void)xmlTextWriterEndElement(pWriter);
1986 if (bOwns)
1987 {
1988 (void)xmlTextWriterEndDocument(pWriter);
1989 xmlFreeTextWriter(pWriter);
1990 }
1991}
1992
1994{
1995 (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SwDBData"));
1996
1997 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("sDataSource"), BAD_CAST(sDataSource.toUtf8().getStr()));
1998 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("sCommand"), BAD_CAST(sCommand.toUtf8().getStr()));
1999 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nCommandType"), BAD_CAST(OString::number(nCommandType).getStr()));
2000
2001 (void)xmlTextWriterEndElement(pWriter);
2002}
2003
2004std::set<Color> SwDoc::GetDocColors()
2005{
2006 std::set<Color> aDocColors;
2007 SwAttrPool& rPool = GetAttrPool();
2008 const sal_uInt16 pAttribs[] = {RES_CHRATR_COLOR, RES_CHRATR_HIGHLIGHT, RES_BACKGROUND};
2009 for (sal_uInt16 nAttrib : pAttribs)
2010 {
2011 for (const SfxPoolItem* pItem : rPool.GetItemSurrogates(nAttrib))
2012 {
2013 auto pColorItem = static_cast<const SvxColorItem*>(pItem);
2014 Color aColor( pColorItem->GetValue() );
2015 if (COL_AUTO != aColor)
2016 aDocColors.insert(aColor);
2017 }
2018 }
2019 return aDocColors;
2020}
2021
2022// #i69627#
2023namespace docfunc
2024{
2026 {
2027 // If a parent paragraph style of one of the paragraph styles, which
2028 // are assigned to the list levels of the outline style, has a list style
2029 // set or inherits a list style from its parent style, the outline style
2030 // has to be written as a normal list style to the OpenDocument file
2031 // format or the OpenOffice.org file format.
2032 bool bRet( false );
2033
2034 const SwTextFormatColls* pTextFormatColls( rDoc.GetTextFormatColls() );
2035 if ( pTextFormatColls )
2036 {
2037 for ( auto pTextFormatColl : *pTextFormatColls )
2038 {
2039 if ( pTextFormatColl->IsDefault() ||
2040 ! pTextFormatColl->IsAssignedToListLevelOfOutlineStyle() )
2041 {
2042 continue;
2043 }
2044
2045 const SwTextFormatColl* pParentTextFormatColl =
2046 dynamic_cast<const SwTextFormatColl*>( pTextFormatColl->DerivedFrom());
2047 if ( !pParentTextFormatColl )
2048 continue;
2049
2050 if ( SfxItemState::SET == pParentTextFormatColl->GetItemState( RES_PARATR_NUMRULE ) )
2051 {
2052 // #i106218# consider that the outline style is set
2053 const SwNumRuleItem& rDirectItem = pParentTextFormatColl->GetNumRule();
2054 if ( rDirectItem.GetValue() != rDoc.GetOutlineNumRule()->GetName() )
2055 {
2056 bRet = true;
2057 break;
2058 }
2059 }
2060 }
2061
2062 }
2063 return bRet;
2064 }
2065}
2066
2068 : m_PosIndex( m_Array.get<0>() )
2069 , m_TypeAndNameIndex( m_Array.get<1>() )
2070{
2071}
2072
2074{
2076}
2077
2079{
2080 ByTypeAndName::iterator it = m_TypeAndNameIndex.find(
2081 std::make_tuple(x->GetName(), x->Which(), x) );
2082 return m_Array.project<0>( it );
2083}
2084
2085SwFrameFormats::ByTypeAndName::const_iterator
2086SwFrameFormats::findByTypeAndName( sal_uInt16 type, const OUString& name ) const
2087{
2088 return m_TypeAndNameIndex.find( std::make_tuple(name, type) );
2089}
2090
2091std::pair<SwFrameFormats::ByTypeAndName::const_iterator, SwFrameFormats::ByTypeAndName::const_iterator>
2092SwFrameFormats::findRangeByName( const OUString& rName ) const
2093{
2094 auto it = m_TypeAndNameIndex.lower_bound( std::make_tuple(rName, sal_uInt16(0)) );
2095 auto itEnd = m_TypeAndNameIndex.upper_bound( std::make_tuple(rName, SAL_MAX_UINT16) );
2096 return { it, itEnd };
2097}
2098
2100{
2101 auto it = m_TypeAndNameIndex.lower_bound( std::make_tuple(rName, sal_uInt16(0)) );
2102 if (it != m_TypeAndNameIndex.end() && (*it)->GetName() == rName)
2103 return *it;
2104 return nullptr;
2105}
2106
2108{
2109 if ( empty() )
2110 return;
2111 const int _offset = keepDefault ? 1 : 0;
2112 for( const_iterator it = begin() + _offset; it != end(); ++it )
2113 delete *it;
2114 if ( _offset )
2115 m_PosIndex.erase( begin() + _offset, end() );
2116 else
2117 m_Array.clear();
2118}
2119
2120std::pair<SwFrameFormats::const_iterator,bool> SwFrameFormats::push_back( const value_type& x )
2121{
2122 SAL_WARN_IF(x->m_ffList != nullptr, "sw.core", "Inserting already assigned item");
2123 assert(x->m_ffList == nullptr);
2124 x->m_ffList = this;
2125 return m_PosIndex.push_back( x );
2126}
2127
2129{
2130 const_iterator const ret = find( x );
2131 SAL_WARN_IF(x->m_ffList != this, "sw.core", "Removing invalid / unassigned item");
2132 if (ret != end()) {
2133 assert( x == *ret );
2134 m_PosIndex.erase( ret );
2135 x->m_ffList = nullptr;
2136 return true;
2137 }
2138 return false;
2139}
2140
2142{
2143 erase( begin() + index_ );
2144}
2145
2147{
2148 (*position)->m_ffList = nullptr;
2149 m_PosIndex.erase( begin() + (position - begin()) );
2150}
2151
2153{
2154 return (x.m_ffList == this);
2155}
2156
2158{
2159 return find(const_cast<SwFrameFormat*>(p)) != end();
2160}
2161
2163{
2164 std::pair<iterator,bool> res = m_PosIndex.push_front( x );
2165 if( ! res.second )
2166 newDefault( res.first );
2167 return res.second;
2168}
2169
2171{
2172 if (position == begin())
2173 return;
2174 m_PosIndex.relocate( begin(), position );
2175}
2176
2177/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
@ Ignore
ignore Redlines
SwBreakIt * g_pBreakIt
Definition: breakit.cxx:34
const OUString & GetValue() const
virtual void InsertItemSet(const SwPaM &rRg, const SfxItemSet &, const SetAttrMode nFlags=SetAttrMode::DEFAULT, SwRootFrame const *pLayout=nullptr)=0
virtual SwFieldType * GetSysFieldType(const SwFieldIds eWhich) const =0
virtual const SwFieldTypes * GetFieldTypes() const =0
virtual const SwRootFrame * GetCurrentLayout() const =0
virtual const SwExtraRedlineTable & GetExtraRedlineTable() const =0
virtual void SetRedlineFlags_intern(RedlineFlags eMode)=0
Set a new redline mode.
virtual const SwRedlineTable & GetRedlineTable() const =0
virtual AppendResult AppendRedline(SwRangeRedline *pNewRedl, bool bCallDelete)=0
Append a new redline.
virtual RedlineFlags GetRedlineFlags() const =0
Query the currently set redline mode.
virtual void SetModified()=0
Must be called manually at changes of format.
const SfxPoolItem * GetCurItem() const
const SfxPoolItem * NextItem()
Item2Range GetItemSurrogates(sal_uInt16 nWhich) const
sal_uInt16 GetWhich(sal_uInt16 nSlot, bool bDeep=true) const
SfxItemPool * GetSecondaryPool() const
const SfxPoolItem & GetDefaultItem(sal_uInt16 nWhich) const
sal_uInt16 GetSlotId(sal_uInt16 nWhich) const
void SetPoolDefaultItem(const SfxPoolItem &)
const WhichRangesContainer & GetRanges() const
sal_uInt16 Count() const
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
void Differentiate(const SfxItemSet &rSet)
void InvalidateItem(sal_uInt16 nWhich)
T & StaticWhichCast(TypedWhichId< T > nId)
sal_uInt16 Which() const
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const=0
void SetEvalDateFormat(NfEvalDateFormat eEDF)
void SetYear2000(sal_uInt16 nVal)
SvNumberFormatterIndexTable * MergeFormatter(SvNumberFormatter &rNewTable)
void SetTextFirstLineOffset(const short nF, const sal_uInt16 nProp=100)
tools::Long GetIndentAt() const
tools::Long GetFirstLineIndent() const
SvxNumPositionAndSpaceMode GetPositionAndSpaceMode() const
sal_uInt16 Count() const
void Remove(const sal_uInt16 nPos, const sal_uInt16 nLen=1)
void SetTextLeft(const tools::Long nL, const sal_uInt16 nProp=100)
tools::Long GetTextLeft() const
SwAttrPool * GetPool() const
Definition: swatrset.hxx:190
css::uno::Reference< css::i18n::XBreakIterator > const & GetBreakIter() const
Definition: breakit.hxx:63
const css::lang::Locale & GetLocale(const LanguageType aLang)
Definition: breakit.hxx:68
Represents the style of a text portion.
Definition: charfmt.hxx:27
const SwFormatCollConditions & GetCondColls() const
Definition: fmtcol.hxx:257
SwFormatColl * GetFormatColl() const
Definition: node.hxx:497
bool HasSwAttrSet() const
Definition: node.hxx:494
SwContentFrame * getLayoutFrame(const SwRootFrame *, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr) const
Definition: node.cxx:1225
virtual bool SetAttr(const SfxPoolItem &)
made virtual
Definition: node.cxx:1596
const SwAttrSet * GetpSwAttrSet() const
Definition: node.hxx:493
virtual SwFormatColl * ChgFormatColl(SwFormatColl *)
Definition: node.cxx:1260
virtual bool ResetAttr(sal_uInt16 nWhich1, sal_uInt16 nWhich2=0)
Definition: node.cxx:1689
virtual sal_uInt16 ResetAllAttr()
Definition: node.cxx:1759
Definition: doc.hxx:195
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
void CopyPageDescHeaderFooterImpl(bool bCpyHeader, const SwFrameFormat &rSrcFormat, SwFrameFormat &rDestFormat)
Definition: docfmt.cxx:1361
void RstTextAttrs(const SwPaM &rRg, bool bInclRefToxMark=false, bool bExactRange=false, SwRootFrame const *pLayout=nullptr)
Definition: docfmt.cxx:222
SwTextFormatColl * CopyTextColl(const SwTextFormatColl &rColl)
copy TextNodes
Definition: docfmt.cxx:1173
bool mbIsAutoFormatRedline
Definition: doc.hxx:322
SwPageDesc * FindPageDesc(const OUString &rName, size_t *pPos=nullptr) const
Definition: docdesc.cxx:947
SwFormat * MakeFrameFormat_(const OUString &, SwFormat *, bool, bool)
Definition: docfmt.cxx:845
void CopyFormatArr(const SwFormatsBase &rSourceArr, SwFormatsBase const &rDestArr, FNCopyFormat fnCopyFormat, SwFormat &rDfltFormat)
Definition: docfmt.cxx:1265
std::unique_ptr< SwFrameFormats > mpTableFrameFormatTable
Definition: doc.hxx:251
SwTableBoxFormat * MakeTableBoxFormat()
Definition: docfmt.cxx:1718
SwConditionTextFormatColl * MakeCondTextFormatColl(const OUString &rFormatName, SwTextFormatColl *pDerivedFrom, bool bBroadcast=false)
Definition: docfmt.cxx:921
void EnsureNumberFormatter()
Definition: docfmt.cxx:1734
size_t GetTableFrameFormatCount(bool bUsed) const
Definition: docfmt.cxx:769
const std::unique_ptr< ::SwContentControlManager > m_pContentControlManager
Definition: doc.hxx:219
void DelCharFormat(size_t nFormat, bool bBroadcast=false)
Delete the formats.
Definition: docfmt.cxx:670
std::unique_ptr< SwGrfFormatColl > mpDfltGrfFormatColl
Definition: doc.hxx:245
SwFlyFrameFormat * MakeFlyFrameFormat(const OUString &rFormatName, SwFrameFormat *pDerivedFrom)
Create the formats.
Definition: docfmt.cxx:751
SwFrameFormat * MakeFrameFormat(const OUString &rFormatName, SwFrameFormat *pDerivedFrom, bool bBroadcast=false, bool bAuto=true)
Definition: docfmt.cxx:820
void BroadcastStyleOperation(const OUString &rName, SfxStyleFamily eFamily, SfxHintId nOp)
Definition: docdesc.cxx:723
IDocumentState const & getIDocumentState() const
Definition: doc.cxx:402
SwFormat * MakeTextFormatColl_(const OUString &, SwFormat *, bool, bool)
Definition: docfmt.cxx:912
SwFormat * CopyFormat(const SwFormat &rFormat, const SwFormatsBase &rFormatArr, FNCopyFormat fnCopyFormat, const SwFormat &rDfltFormat)
Copy the formats to itself.
Definition: docfmt.cxx:1122
void SetTextFormatCollByAutoFormat(const SwPosition &rPos, sal_uInt16 nPoolId, const SfxItemSet *pSet)
Definition: docfmt.cxx:1772
const SwCharFormat * GetDfltCharFormat() const
Definition: doc.hxx:764
void ChgFormat(SwFormat &rFormat, const SfxItemSet &rSet)
Definition: docfmt.cxx:1871
std::unique_ptr< SwTextFormatColls > mpTextFormatCollTable
Definition: doc.hxx:252
const std::unique_ptr< ::sw::UndoManager > m_pUndoManager
Definition: doc.hxx:223
o3tl::sorted_vector< SwRootFrame * > GetAllLayouts()
Definition: doclay.cxx:1683
void UpdateRsid(const SwPaM &rRg, sal_Int32 nLen)
Set the rsid of the next nLen symbols of rRg to the current session number.
Definition: docfmt.cxx:405
void dumpAsXml(xmlTextWriterPtr=nullptr) const
Dumps the entire nodes structure to the given destination (file nodes.xml in the current directory by...
Definition: docfmt.cxx:1947
SwTableLineFormat * MakeTableLineFormat()
Definition: docfmt.cxx:1726
SvNumberFormatter * mpNumberFormatter
Definition: doc.hxx:275
SwNumRule * FindNumRulePtr(const OUString &rName) const
Definition: docnum.cxx:2443
SwTableFormat * MakeTableFrameFormat(const OUString &rFormatName, SwFrameFormat *pDerivedFrom)
Definition: docfmt.cxx:810
SwGrfFormatColl * CopyGrfColl(const SwGrfFormatColl &rColl)
copy the graphic nodes
Definition: docfmt.cxx:1239
std::unique_ptr< SwNodes > m_pNodes
Definition: doc.hxx:202
void SetAttr(const SfxPoolItem &, SwFormat &)
Set attribute in given format.1y If Undo is enabled, the old values is added to the Undo history.
Definition: docfmt.cxx:452
void SetDefault(const SfxPoolItem &)
Set attribute as new default attribute in current document.
Definition: docfmt.cxx:540
const SwNumRuleTable & GetNumRuleTable() const
Definition: doc.hxx:1077
void RenameFormat(SwFormat &rFormat, const OUString &sNewName, bool bBroadcast=false)
Definition: docfmt.cxx:1903
std::unique_ptr< SwCharFormats > mpCharFormatTable
Definition: doc.hxx:248
SwNumRule * GetOutlineNumRule() const
Definition: doc.hxx:1035
const SwCharFormats * GetCharFormats() const
Definition: doc.hxx:751
SwDBData maDBData
Definition: doc.hxx:210
SwPageDescs m_PageDescs
Definition: doc.hxx:204
IDocumentContentOperations const & getIDocumentContentOperations() const
Definition: doc.cxx:323
IDocumentUndoRedo & GetIDocumentUndoRedo()
Definition: doc.cxx:152
SwNodes & GetNodes()
Definition: doc.hxx:420
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
Definition: doc.cxx:365
std::unique_ptr< SwFrameFormats > mpFrameFormatTable
Definition: doc.hxx:247
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
Definition: doc.cxx:343
sal_uInt32 mnRsid
Definition: doc.hxx:305
SwPageDesc * MakePageDesc(const OUString &rName, const SwPageDesc *pCpy=nullptr, bool bRegardLanguage=true, bool bBroadcast=false)
Definition: docdesc.cxx:765
std::unique_ptr< SwFrameFormats > mpSpzFrameFormatTable
Definition: doc.hxx:249
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
Definition: doc.cxx:413
std::unique_ptr< SwTextFormatColl > mpDfltTextFormatColl
Definition: doc.hxx:244
SwCharFormat * CopyCharFormat(const SwCharFormat &)
copy the char format
Definition: docfmt.cxx:1165
SwFrameFormat * CopyFrameFormat(const SwFrameFormat &)
copy the frame format
Definition: docfmt.cxx:1158
const SfxPoolItem & GetDefault(sal_uInt16 nFormatHint) const
Get the default attribute in this document.
Definition: docfmt.cxx:664
const SwTextFormatColls * GetTextFormatColls() const
Definition: doc.hxx:789
IDocumentStylePoolAccess const & getIDocumentStylePoolAccess() const
Definition: doc.cxx:434
::sw::DocumentContentOperationsManager const & GetDocumentContentOperationsManager() const
Definition: doc.cxx:333
void ResetAttrs(const SwPaM &rRg, bool bTextAttr=true, const o3tl::sorted_vector< sal_uInt16 > &rAttrs=o3tl::sorted_vector< sal_uInt16 >(), const bool bSendDataChangedEvents=true, SwRootFrame const *pLayout=nullptr)
Reset attributes.
Definition: docfmt.cxx:243
const std::unique_ptr< ::sw::mark::MarkManager > mpMarkManager
Definition: doc.hxx:217
std::unique_ptr< SwNumRuleTable > mpNumRuleTable
Definition: doc.hxx:277
const SwFrameFormats * GetFrameFormats() const
Definition: doc.hxx:749
bool DontExpandFormat(const SwPosition &rPos, bool bFlag=true)
Definition: docfmt.cxx:1703
SwTextFormatColl * FindTextFormatCollByName(const OUString &rName) const
Definition: doc.hxx:810
SwGrfFormatColl * MakeGrfFormatColl(const OUString &rFormatName, SwGrfFormatColl *pDerivedFrom)
Definition: docfmt.cxx:946
std::unique_ptr< SwSectionFormats > mpSectionFormatTable
Definition: doc.hxx:250
void DelTextFormatColl(size_t nFormat, bool bBroadcast=false)
Definition: docfmt.cxx:957
void DelFrameFormat(SwFrameFormat *pFormat, bool bBroadcast=false)
Definition: docfmt.cxx:697
bool UpdateParRsid(SwTextNode *pTextNode, sal_uInt32 nVal=0)
Definition: docfmt.cxx:436
SwTextFormatColl * MakeTextFormatColl(const OUString &rFormatName, SwTextFormatColl *pDerivedFrom, bool bBroadcast=false)
Create the FormatCollections.
Definition: docfmt.cxx:888
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1331
void ResetAttrAtFormat(const sal_uInt16 nWhichId, SwFormat &rChangedFormat)
Definition: docfmt.cxx:495
void DelTableFrameFormat(SwTableFormat *pFormat)
Definition: docfmt.cxx:737
std::unique_ptr< SwCharFormat > mpDfltCharFormat
Definition: doc.hxx:243
IDocumentDrawModelAccess const & getIDocumentDrawModelAccess() const
Definition: doc.cxx:163
std::unique_ptr< SwFrameFormat > mpDfltFrameFormat
Definition: doc.hxx:240
SwCharFormat * MakeCharFormat(const OUString &rFormatName, SwCharFormat *pDerivedFrom, bool bBroadcast=false)
Definition: docfmt.cxx:854
const SwFrameFormat * GetDfltFrameFormat() const
Definition: doc.hxx:758
std::set< Color > GetDocColors()
Definition: docfmt.cxx:2004
SwFormat * MakeCharFormat_(const OUString &, SwFormat *, bool, bool)
Definition: docfmt.cxx:878
const SwFrameFormats * GetSpzFrameFormats() const
Definition: doc.hxx:755
SwFrameFormat & GetTableFrameFormat(size_t nFormat, bool bUsed) const
Definition: docfmt.cxx:786
SwDrawFrameFormat * MakeDrawFrameFormat(const OUString &rFormatName, SwFrameFormat *pDerivedFrom)
Definition: docfmt.cxx:760
const std::unique_ptr< ::sw::DocumentSettingManager > m_pDocumentSettingManager
Definition: doc.hxx:224
void ReplaceStyles(const SwDoc &rSource, bool bIncludePageStyles=true)
Definition: docfmt.cxx:1549
bool SetTextFormatColl(const SwPaM &rRg, SwTextFormatColl *pFormat, const bool bReset=true, const bool bResetListAttrs=false, SwRootFrame const *pLayout=nullptr)
Add 4th optional parameter <bResetListAttrs>.
Definition: docfmt.cxx:1081
void CopyFooter(const SwFrameFormat &rSrcFormat, SwFrameFormat &rDestFormat)
Copy footer (with contents) from SrcFormat to DestFormat.
Definition: doc.hxx:910
SvNumberFormatter * GetNumberFormatter(bool bCreate=true)
Definition: doc.hxx:1423
::sw::UndoManager & GetUndoManager()
Definition: doc.cxx:141
void CopyHeader(const SwFrameFormat &rSrcFormat, SwFrameFormat &rDestFormat)
Copy header (with contents) from SrcFormat to DestFormat (can also be copied into other document).
Definition: doc.hxx:905
void SetFormatItemByAutoFormat(const SwPaM &rPam, const SfxItemSet &)
Definition: docfmt.cxx:1820
sal_uInt16 MakeNumRule(const OUString &rName, const SwNumRule *pCpy=nullptr, bool bBroadcast=false, const SvxNumberFormat::SvxNumPositionAndSpaceMode eDefaultNumberFormatPositionAndSpaceMode=SvxNumberFormat::LABEL_WIDTH_AND_POSITION)
Definition: docnum.cxx:2477
SwFrameFormat * FindFrameFormatByName(const OUString &rName) const
Definition: docfmt.cxx:745
std::unique_ptr< SwGrfFormatColls > mpGrfFormatCollTable
Definition: doc.hxx:253
void MoveLeftMargin(const SwPaM &rPam, bool bRight, bool bModulus, SwRootFrame const *pLayout=nullptr)
Adjust left margin via object bar (similar to adjustment of numerations).
Definition: docfmt.cxx:1630
void dumpAsXml(xmlTextWriterPtr pWriter) const
Definition: docredln.cxx:95
void dumpAsXml(xmlTextWriterPtr pWriter) const
Definition: fldbas.cxx:222
Content, content of frame (header, footer, fly).
Definition: fmtcntnt.hxx:32
const OUString & GetValue() const
Definition: fmtinfmt.hxx:75
Pagedescriptor Client of SwPageDesc that is "described" by the attribute.
Definition: fmtpdsc.hxx:36
void RegisterToPageDesc(SwPageDesc &)
Definition: atrfrm.cxx:714
SwPageDesc * GetPageDesc()
Definition: fmtpdsc.hxx:61
Base class for various Writer styles.
Definition: format.hxx:47
bool IsDefault() const
Definition: format.hxx:129
const SwDoc * GetDoc() const
The document is set in SwAttrPool now, therefore you always can access it.
Definition: format.hxx:139
sal_uInt16 GetPoolFormatId() const
Get and set Pool style IDs.
Definition: format.hxx:163
void SetPoolHelpId(sal_uInt16 nId)
Definition: format.hxx:168
void SetPoolFormatId(sal_uInt16 nId)
Definition: format.hxx:164
virtual bool ResetFormatAttr(sal_uInt16 nWhich1, sal_uInt16 nWhich2=0)
Definition: format.cxx:618
virtual void SetFormatName(const OUString &rNewName, bool bBroadcast=false)
Definition: format.cxx:145
const SwFormatFooter & GetFooter(bool=true) const
Definition: fmthdft.hxx:99
sal_uInt16 Which() const
for Querying of Writer-functions.
Definition: format.hxx:82
const OUString & GetName() const
Definition: format.hxx:131
sal_uInt16 GetPoolHelpId() const
Get and set Help-IDs for document templates.
Definition: format.hxx:167
void SetAuto(bool bNew)
Definition: format.hxx:179
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
Definition: format.cxx:385
const SwFormatHeader & GetHeader(bool=true) const
Definition: fmthdft.hxx:97
const SwNumRuleItem & GetNumRule(bool=true) const
Definition: paratr.hxx:241
void SetPoolHlpFileId(sal_uInt8 nId)
Definition: format.hxx:170
const SwAttrSet & GetAttrSet() const
For querying the attribute array.
Definition: format.hxx:136
bool SetDerivedFrom(SwFormat *pDerivedFrom=nullptr)
0 is Default.
Definition: format.cxx:318
SwFormat * DerivedFrom() const
Definition: format.hxx:128
void CopyAttrs(const SwFormat &)
Copy attributes even among documents.
Definition: format.cxx:171
virtual bool SetFormatAttr(const SfxPoolItem &rAttr)
Definition: format.cxx:447
bool IsAuto() const
Query / set AutoFormat-flag.
Definition: format.hxx:178
void DelDiffs(const SfxItemSet &rSet)
Delete all attributes that are not in rFormat.
Definition: format.cxx:666
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
Templatized version of GetItemState() to directly return the correct type.
Definition: format.hxx:111
provides some methods for generic operations on lists that contain SwFormat* subclasses.
Definition: docary.hxx:44
virtual SwFormat * GetFormat(size_t idx) const =0
virtual SwFormat * FindFormatByName(const OUString &rName) const
Definition: format.cxx:766
virtual size_t GetFormatCount() const =0
Style of a layout element.
Definition: frmfmt.hxx:62
virtual void SetFormatName(const OUString &rNewName, bool bBroadcast=false) override
Definition: atrfrm.cxx:2593
const_iterator find(const value_type &x) const
Definition: docfmt.cxx:2078
ByPos::const_iterator const_iterator
bool empty() const
std::pair< ByTypeAndName::const_iterator, ByTypeAndName::const_iterator > findRangeByName(const OUString &name) const
Definition: docfmt.cxx:2092
SwFrameFormatsBase m_Array
virtual SwFrameFormat * FindFormatByName(const OUString &rName) const override
Definition: docfmt.cxx:2099
bool ContainsFormat(SwFrameFormat const &rFormat) const
fast check if given format is contained here @precond pFormat must not have been deleted
Definition: docfmt.cxx:2152
SwFrameFormatsBase::size_type size_type
bool IsAlive(SwFrameFormat const *) const
not so fast check that given format is still alive (i.e. contained here)
Definition: docfmt.cxx:2157
ByTypeAndName::const_iterator findByTypeAndName(sal_uInt16 type, const OUString &name) const
Definition: docfmt.cxx:2086
bool erase(const value_type &x)
Definition: docfmt.cxx:2128
bool newDefault(const value_type &x)
Definition: docfmt.cxx:2162
void DeleteAndDestroyAll(bool keepDefault=false)
Definition: docfmt.cxx:2107
SwFrameFormatsBase::value_type value_type
const_iterator begin() const
ByTypeAndName & m_TypeAndNameIndex
virtual ~SwFrameFormats() override
Definition: docfmt.cxx:2073
const_iterator end() const
std::pair< const_iterator, bool > push_back(const value_type &x)
Definition: docfmt.cxx:2120
ByPos & m_PosIndex
Get reference.
Definition: reffld.hxx:66
void Add(const SfxPoolItem *pOldValue, const SfxPoolItem *pNewValue, SwNodeOffset nNodeIdx)
Definition: rolbck.cxx:1027
TElementType * Next()
Definition: calbck.hxx:380
TElementType * First()
Definition: calbck.hxx:372
Marks a node in the document model.
Definition: ndindex.hxx:31
SwNode & GetNode() const
Definition: ndindex.hxx:123
SwNodeIndex aStart
Definition: ndindex.hxx:136
SwNodeIndex aEnd
Definition: ndindex.hxx:137
Base class of the Writer document model elements.
Definition: node.hxx:98
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:903
SwNodeOffset GetIndex() const
Definition: node.hxx:312
SwDoc & GetDoc()
Definition: node.hxx:233
bool IsTextNode() const
Definition: node.hxx:687
Merge GetRedlineMergeFlag() const
Definition: node.hxx:116
SwContentNode * GetContentNode()
Definition: node.hxx:666
const SwEndNode * EndOfSectionNode() const
Definition: node.hxx:733
void ForEach(FnForEach_SwNodes fnForEach, void *pArgs=nullptr)
Definition: ndarr.hxx:143
static SwStartNode * MakeEmptySection(SwNode &rWhere, SwStartNodeType=SwNormalStartNode)
Create an empty section of Start- and EndNote.
Definition: nodes.cxx:1917
void Copy_(const SwNodeRange &rRg, SwNode &rInsPos, bool bNewFrames=true) const
Definition: ndarr.hxx:179
bool IsAutoRule() const
Definition: numrule.hxx:229
const SwNumFormat & Get(sal_uInt16 i) const
Definition: number.cxx:87
void SetInvalidRule(bool bFlag)
Definition: number.cxx:958
const OUString & GetName() const
Definition: numrule.hxx:224
SwNumRule & CopyNumRule(SwDoc &, const SwNumRule &)
A kind of copy-constructor to make sure the num formats are attached to the correctCharFormats of a d...
Definition: number.cxx:901
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:187
const SwPosition * GetMark() const
Definition: pam.hxx:263
virtual void SetMark()
Unless this is called, the getter method of Mark will return Point.
Definition: pam.cxx:642
std::pair< const SwPosition *, const SwPosition * > StartEnd() const
Because sometimes the cost of the operator<= can add up.
Definition: pam.hxx:277
const SwPosition * End() const
Definition: pam.hxx:271
const SwPosition * GetPoint() const
Definition: pam.hxx:261
const SwPosition * Start() const
Definition: pam.hxx:266
bool HasMark() const
A PaM marks a selection if Point and Mark are distinct positions.
Definition: pam.hxx:259
sal_uInt16 GetPoolFormatId() const
Query and set PoolFormat-Id.
Definition: pagedesc.hxx:275
sal_uInt16 GetPoolHelpId() const
Definition: pagedesc.hxx:277
void StashFrameFormat(const SwFrameFormat &rFormat, bool bHeader, bool bLeft, bool bFirst)
Remember original header/footer formats even when they are hidden by "sharing".
Definition: pagedesc.cxx:409
const OUString & GetName() const
Definition: pagedesc.hxx:196
void SetPoolHlpFileId(sal_uInt8 const nId)
Definition: pagedesc.hxx:280
void SetFollow(const SwPageDesc *pNew)
Definition: pagedesc.hxx:314
SwFrameFormat & GetMaster()
Definition: pagedesc.hxx:238
bool IsHeaderShared() const
Definition: pagedesc.hxx:319
const SvxNumberType & GetNumType() const
Definition: pagedesc.hxx:202
bool IsFirstShared() const
Definition: pagedesc.cxx:396
bool IsFooterShared() const
Definition: pagedesc.hxx:323
SwFrameFormat & GetFirstLeft()
Definition: pagedesc.hxx:241
SwFrameFormat & GetFirstMaster()
Definition: pagedesc.hxx:240
void SetPoolFormatId(sal_uInt16 const nId)
Definition: pagedesc.hxx:276
void SetPoolHelpId(sal_uInt16 const nId)
Definition: pagedesc.hxx:278
bool GetLandscape() const
Definition: pagedesc.hxx:199
void SetNumType(const SvxNumberType &rNew)
Definition: pagedesc.hxx:203
void SetFootnoteInfo(const SwPageFootnoteInfo &rNew)
Definition: pagedesc.hxx:207
SwFrameFormat & GetLeft()
Definition: pagedesc.hxx:239
const SwPageDesc * GetFollow() const
Definition: pagedesc.hxx:267
void WriteUseOn(UseOnPage const eNew)
Definition: pagedesc.hxx:235
const SwPageFootnoteInfo & GetFootnoteInfo() const
Definition: pagedesc.hxx:205
UseOnPage ReadUseOn() const
Definition: pagedesc.hxx:236
void SetLandscape(bool bNew)
Definition: pagedesc.hxx:200
const SwFrameFormat * GetStashedFrameFormat(bool bHeader, bool bLeft, bool bFirst) const
Used to restore hidden header/footer formats.
Definition: pagedesc.cxx:445
SwPageDescsBase::size_type size_type
Definition: pagedesc.hxx:432
size_t size() const
Definition: pagedesc.hxx:442
void dumpAsXml(xmlTextWriterPtr pWriter) const
Definition: pagedesc.cxx:791
void SetExtraData(const SwRedlineExtraData *pData)
ExtraData gets copied, the pointer is therefore not taken over by the RedLineObject.
Definition: redline.hxx:229
void SetItemSet(const SfxItemSet &rSet)
Definition: docredln.cxx:947
void dumpAsXml(xmlTextWriterPtr pWriter) const
Definition: docredln.cxx:849
The root element of a Writer document layout.
Definition: rootfrm.hxx:83
bool HasMergedParas() const
Definition: wsfrm.cxx:4757
Starts a section of nodes in the document model.
Definition: node.hxx:348
SwTableNumFormatMerge(const SwDoc &rSrc, SwDoc &rDest)
Definition: docfmt.cxx:1747
SvNumberFormatter * pNFormat
Definition: mvsave.hxx:182
A wrapper around SfxPoolItem to store the start position of (usually) a text portion,...
Definition: txatbase.hxx:44
const sal_Int32 * End() const
Definition: txatbase.hxx:156
sal_Int32 GetStart() const
Definition: txatbase.hxx:88
const SwFormatINetFormat & GetINetFormat() const
Definition: txatbase.hxx:244
static bool changeAnchor(SwFrameFormat *pShape, SdrObject *pObj)
Sets the anchor of the associated textframe of the given shape, and returns true on success.
static void syncFlyFrameAttr(SwFrameFormat &rShape, SfxItemSet const &rSet, SdrObject *pObj)
Similar to syncProperty(), but used by the internal API (e.g. for UI purposes).
static bool isTextBox(const SwFrameFormat *pFormat, sal_uInt16 nType, const SdrObject *pObject=nullptr)
Is the frame format a text box?
Represents the style of a paragraph.
Definition: fmtcol.hxx:61
bool IsAssignedToListLevelOfOutlineStyle() const
Definition: fmtcol.hxx:122
SwTextFormatColl & GetNextTextFormatColl() const
Definition: fmtcol.hxx:106
void AssignToListLevelOfOutlineStyle(const int nAssignedListLevel)
Definition: fmtcol.cxx:685
void SetNextTextFormatColl(SwTextFormatColl &rNext)
Inline implementations.
Definition: fmtcol.hxx:266
int GetAssignedOutlineStyleLevel() const
Definition: fmtcol.cxx:678
Represents the visualization of a paragraph.
Definition: txtfrm.hxx:166
SwTextNode const * GetTextNodeForParaProps() const
Definition: txtfrm.cxx:1303
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:112
bool GetParaAttr(SfxItemSet &rSet, sal_Int32 nStt, sal_Int32 nEnd, const bool bOnlyTextAttr=false, const bool bGetFromChrFormat=true, const bool bMergeIndentValuesOfNumRule=false, SwRootFrame const *pLayout=nullptr) const
Query the attributes of textnode over the range.
Definition: thints.cxx:2140
void FormatToTextAttr(SwTextNode *pNd)
Convey attributes of an AttrSet (AutoFormat) to SwpHintsArray.
Definition: thints.cxx:2539
::sw::ListLevelIndents AreListLevelIndentsApplicable() const
Determines, if the list level indent attributes can be applied to the paragraph.
Definition: ndtxt.cxx:4639
virtual bool SetAttr(const SfxPoolItem &) override
overriding to handle change of certain paragraph attributes
Definition: ndtxt.cxx:5091
SwNumRule * GetNumRule(bool bInParent=true) const
Returns numbering rule of this text node.
Definition: ndtxt.cxx:2919
int GetActualListLevel(SwListRedlineType eRedline=SwListRedlineType::SHOW) const
Returns the actual list level of this text node, when it is a list item.
Definition: ndtxt.cxx:4273
SwTextAttr * GetTextAttrAt(sal_Int32 const nIndex, sal_uInt16 const nWhich, ::sw::GetTextAttrMode const eMode=::sw::GetTextAttrMode::Default) const
get the innermost text attribute covering position nIndex.
Definition: ndtxt.cxx:1802
const OUString & GetText() const
Definition: ndtxt.hxx:244
LanguageType GetLang(const sal_Int32 nBegin, const sal_Int32 nLen=0, sal_uInt16 nScript=0) const
Definition: thints.cxx:3469
bool DontExpandFormat(sal_Int32 nContentIdx, bool bFlag=true, bool bFormatToTextAttributes=true)
When appropriate set DontExpand-flag at INet or character styles respectively.
Definition: ndtxt.cxx:1679
SwTextFormatColl * GetTextColl() const
Definition: ndtxt.hxx:897
SwUndoFormatAttr * GetUndo() const
std::unique_ptr< SwUndoFormatAttr > ReleaseUndo()
Typing one or more characters to a single paragraph.
Definition: UndoInsert.hxx:43
void SetWithRsid()
Definition: UndoInsert.hxx:90
std::vector< SwTextFormatColl * >::const_iterator const_iterator
Definition: docary.hxx:65
std::vector< SwNumRule * >::size_type size_type
Definition: docary.hxx:66
size_t size() const
Definition: docary.hxx:87
const_reverse_iterator rend() const
const_iterator begin() const
const_reverse_iterator rbegin() const
bool empty() const
static bool lcl_RstTextAttr(SwNode *pNd, void *pArgs)
@params pArgs contains the document's ChrFormatTable Is need for selections at the beginning/end and ...
void CopyFlyInFlyImpl(const SwNodeRange &rRg, SwPaM const *const pCopiedPaM, SwNode &rStartIdx, const bool bCopyFlyAtFly=false, SwCopyFlags flags=SwCopyFlags::Default) const
bool UndoWasEnabled() const
SwUndo * GetLastUndo()
Definition: docundo.cxx:239
static bool IsFuzzing()
constexpr ::Color COL_AUTO(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
int nCount
struct _xmlTextWriter * xmlTextWriterPtr
static void SetTextFormatCollNext(SwTextFormatColl *pTextColl, const SwTextFormatColl *pDel)
Definition: docfmt.cxx:90
static bool lcl_RstAttr(SwNode *pNd, void *pArgs)
Definition: docfmt.cxx:98
static bool lcl_SetTextFormatColl(SwNode *pNode, void *pArgs)
Definition: docfmt.cxx:1001
static bool lcl_SetNewDefTabStops(SwTwips nOldWidth, SwTwips nNewWidth, SvxTabStopItem &rChgTabStop)
Definition: docfmt.cxx:515
float x
constexpr TypedWhichId< SfxStringItem > RES_PARATR_LIST_ID(RES_PARATR_LIST_BEGIN)
bool isTXTATR(const sal_uInt16 nWhich)
Definition: hintids.hxx:486
bool isCHRATR(const sal_uInt16 nWhich)
Definition: hintids.hxx:474
constexpr sal_uInt16 RES_CHRATR_END(46)
bool isPARATR_LIST(const sal_uInt16 nWhich)
Definition: hintids.hxx:494
constexpr sal_uInt16 RES_PARATR_BEGIN(RES_TXTATR_END)
constexpr TypedWhichId< SvxFirstLineIndentItem > RES_MARGIN_FIRSTLINE(91)
constexpr sal_uInt16 RES_UNKNOWNATR_END(160)
constexpr TypedWhichId< SwConditionTextFormatColl > RES_CONDTXTFMTCOLL(166)
constexpr TypedWhichId< SwFormatHeader > RES_HEADER(102)
bool isDrawingLayerAttribute(const sal_uInt16 nWhich)
Definition: hintids.hxx:502
constexpr TypedWhichId< SfxInt16Item > RES_PARATR_LIST_LEVEL(83)
constexpr sal_uInt16 RES_FRMATR_END(141)
constexpr TypedWhichId< SfxInt16Item > RES_PARATR_LIST_RESTARTVALUE(85)
constexpr TypedWhichId< SwFormatINetFormat > RES_TXTATR_INETFMT(51)
constexpr TypedWhichId< SwFormatPageDesc > RES_PAGEDESC(99)
constexpr TypedWhichId< SvxBrushItem > RES_CHRATR_HIGHLIGHT(42)
constexpr TypedWhichId< SvxBrushItem > RES_BACKGROUND(111)
constexpr TypedWhichId< SvxAdjustItem > RES_PARATR_ADJUST(64)
constexpr TypedWhichId< SvxTabStopItem > RES_PARATR_TABSTOP(68)
constexpr sal_uInt16 RES_CHRATR_BEGIN(HINT_BEGIN)
constexpr sal_uInt16 RES_PARATR_LIST_BEGIN(RES_PARATR_END)
constexpr TypedWhichId< SwCharFormat > RES_CHRFMT(RES_FMT_BEGIN)
constexpr TypedWhichId< SwFormatFooter > RES_FOOTER(103)
constexpr TypedWhichId< SwNumRuleItem > RES_PARATR_NUMRULE(72)
constexpr sal_uInt16 RES_UNKNOWNATR_BEGIN(RES_BOXATR_END)
constexpr TypedWhichId< SwDrawFrameFormat > RES_DRAWFRMFMT(165)
constexpr TypedWhichId< SvxRsidItem > RES_CHRATR_RSID(39)
constexpr sal_uInt16 RES_PARATR_LIST_END(88)
constexpr TypedWhichId< SvxFormatBreakItem > RES_BREAK(100)
bool isFRMATR(const sal_uInt16 nWhich)
Definition: hintids.hxx:498
bool isBOXATR(const sal_uInt16 nWhich)
Definition: hintids.hxx:510
constexpr TypedWhichId< SvxTextLeftMarginItem > RES_MARGIN_TEXTLEFT(92)
constexpr TypedWhichId< SwTextFormatColl > RES_TXTFMTCOLL(163)
constexpr TypedWhichId< SvXMLAttrContainerItem > RES_TXTATR_UNKNOWN_CONTAINER(54)
constexpr TypedWhichId< SfxBoolItem > RES_PARATR_LIST_ISCOUNTED(86)
constexpr TypedWhichId< SfxBoolItem > RES_PARATR_LIST_ISRESTART(84)
constexpr TypedWhichId< SvxRsidItem > RES_PARATR_RSID(80)
bool isPARATR(const sal_uInt16 nWhich)
Definition: hintids.hxx:490
constexpr TypedWhichId< SwFormatContent > RES_CNTNT(101)
constexpr TypedWhichId< SvxColorItem > RES_CHRATR_COLOR(3)
constexpr sal_uInt16 RES_TXTATR_END(RES_TXTATR_NOEND_END)
constexpr sal_uInt16 POOLATTR_END(RES_UNKNOWNATR_END)
constexpr TypedWhichId< SwFrameFormat > RES_FRMFMT(161)
bool isGRFATR(const sal_uInt16 nWhich)
Definition: hintids.hxx:506
const SfxPoolItem * GetDfltAttr(sal_uInt16 nWhich)
Get the default attribute from corresponding default attribute table.
Definition: hints.cxx:147
const char * name
void * p
sal_Int64 n
#define LANGUAGE_SYSTEM
sal_uInt32 index_
#define SAL_WARN_IF(condition, area, stream)
#define SAL_WARN(area, stream)
def position(n=-1)
Reference< XComponentContext > getProcessComponentContext()
bool HasOutlineStyleToBeWrittenAsNormalListStyle(SwDoc &rDoc)
method to check, if the outline style has to written as a normal list style
Definition: docfmt.cxx:2025
int i
index
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
std::pair< SwTextNode *, SwTextNode * > GetFirstAndLastNode(SwRootFrame const &rLayout, SwNode const &rPos)
Definition: txtfrm.cxx:354
void CopyBookmarks(const SwPaM &rPam, const SwPosition &rCpyPam)
SwTextNode * GetParaPropsNode(SwRootFrame const &rLayout, SwNode const &rNode)
Definition: txtfrm.cxx:330
ListLevelIndents
Definition: paratr.hxx:52
long Long
@ SwHeaderStartNode
Definition: ndtyp.hxx:56
@ SwFooterStartNode
Definition: ndtyp.hxx:57
o3tl::strong_int< sal_Int32, struct Tag_SwNodeOffset > SwNodeOffset
Definition: nodeoffset.hxx:16
static SfxItemSet & rSet
sal_Int32 nCommandType
Definition: swdbdata.hxx:32
OUString sDataSource
Definition: swdbdata.hxx:30
void dumpAsXml(xmlTextWriterPtr pWriter) const
Definition: docfmt.cxx:1993
OUString sCommand
Definition: swdbdata.hxx:31
Marks a position in the document model.
Definition: pam.hxx:37
SwNode & GetNode() const
Definition: pam.hxx:80
void SetContent(sal_Int32 nContentIndex)
Set content index, only valid to call this if the position points to a SwContentNode subclass.
Definition: pam.cxx:266
sal_Int32 GetContentIndex() const
Definition: pam.hxx:84
bool bExactRange
From the attributes included in the range, delete only the ones which have exactly same range....
SfxStyleFamily
#define SW_MOD()
Definition: swmodule.hxx:256
tools::Long SwTwips
Definition: swtypes.hxx:51
#define SAL_MAX_UINT16
ResultType type
std::pair< sal_uInt16, sal_uInt16 > WhichPair
NF_EVALDATEFORMAT_FORMAT_INTL