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