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 <editeng/tstpitem.hxx>
24 #include <editeng/lrspitem.hxx>
26 #include <editeng/rsiditem.hxx>
27 #include <editeng/colritem.hxx>
28 #include <officecfg/Office/Common.hxx>
29 #include <osl/diagnose.h>
30 #include <svl/zforlist.hxx>
32 #include <unotools/configmgr.hxx>
33 #include <sal/log.hxx>
34 #include <com/sun/star/i18n/WordType.hpp>
35 #include <com/sun/star/i18n/XBreakIterator.hpp>
36 #include <fmtpdsc.hxx>
37 #include <fmthdft.hxx>
38 #include <fmtcntnt.hxx>
39 #include <doc.hxx>
40 #include <docfunc.hxx>
41 #include <drawdoc.hxx>
42 #include <MarkManager.hxx>
44 #include <IDocumentUndoRedo.hxx>
48 #include <IDocumentState.hxx>
52 #include <rootfrm.hxx>
53 #include <txtfrm.hxx>
54 #include <hints.hxx>
55 #include <ndtxt.hxx>
56 #include <pam.hxx>
57 #include <UndoCore.hxx>
58 #include <UndoAttribute.hxx>
59 #include <UndoInsert.hxx>
60 #include <pagedesc.hxx>
61 #include <rolbck.hxx>
62 #include <mvsave.hxx>
63 #include <txatbase.hxx>
64 #include <swtblfmt.hxx>
65 #include <charfmt.hxx>
66 #include <docary.hxx>
67 #include <paratr.hxx>
68 #include <redline.hxx>
69 #include <reffld.hxx>
70 #include <fmtinfmt.hxx>
71 #include <breakit.hxx>
72 #include <SwUndoFmt.hxx>
73 #include <UndoManager.hxx>
74 #include <swmodule.hxx>
75 #include <modcfg.hxx>
76 #include <frameformats.hxx>
77 #include <memory>
78 
79 using namespace ::com::sun::star::i18n;
80 using namespace ::com::sun::star::lang;
81 using namespace ::com::sun::star::uno;
82 
83 /*
84  * Internal functions
85  */
86 
87 static void SetTextFormatCollNext( SwTextFormatColl* pTextColl, const SwTextFormatColl* pDel )
88 {
89  if ( &pTextColl->GetNextTextFormatColl() == pDel )
90  {
91  pTextColl->SetNextTextFormatColl( *pTextColl );
92  }
93 }
94 
95 static bool lcl_RstAttr( const SwNodePtr& rpNd, void* pArgs )
96 {
98  SwContentNode* pNode = rpNd->GetContentNode();
99  if (pPara && pPara->pLayout && pPara->pLayout->HasMergedParas()
100  && pNode && pNode->GetRedlineMergeFlag() == SwNode::Merge::Hidden)
101  {
102  return true;
103  }
104  if( pNode && pNode->HasSwAttrSet() )
105  {
106  const bool bLocked = pNode->IsModifyLocked();
107  pNode->LockModify();
108 
109  SwDoc& rDoc = pNode->GetDoc();
110 
111  // remove unused attribute RES_LR_SPACE
112  // add list attributes
113  SfxItemSet aSavedAttrsSet(
114  rDoc.GetAttrPool(),
115  svl::Items<
119  const SfxItemSet* pAttrSetOfNode = pNode->GetpSwAttrSet();
120 
121  std::vector<sal_uInt16> aClearWhichIds;
122  // restoring all paragraph list attributes
123  {
124  SfxItemSet aListAttrSet( rDoc.GetAttrPool(), svl::Items<RES_PARATR_LIST_BEGIN, RES_PARATR_LIST_END - 1> );
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( 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  for( auto it = rAttrs.rbegin(); it != rAttrs.rend(); ++it )
327  {
328  if( POOLATTR_END > *it )
329  aDelSet.Put( *GetDfltAttr( *it ));
330  }
331  if( aDelSet.Count() )
332  aPara.pDelSet = &aDelSet;
333 
334  bool bAdd = true;
335  SwNodeIndex aTmpStt( pStt->nNode );
336  SwNodeIndex aTmpEnd( pEnd->nNode );
337  if( pStt->nContent.GetIndex() ) // just one part
338  {
339  // set up a later, and all CharFormatAttr -> TextFormatAttr
340  SwTextNode* pTNd = aTmpStt.GetNode().GetTextNode();
341  if( pTNd && pTNd->HasSwAttrSet() && pTNd->GetpSwAttrSet()->Count() )
342  {
343  if (pHst)
344  {
345  SwRegHistory history(pTNd, *pTNd, pHst);
346  pTNd->FormatToTextAttr(pTNd);
347  }
348  else
349  {
350  pTNd->FormatToTextAttr(pTNd);
351  }
352  }
353 
354  ++aTmpStt;
355  }
356  if( pEnd->nContent.GetIndex() == pEnd->nNode.GetNode().GetContentNode()->Len() )
357  {
358  // set up a later, and all CharFormatAttr -> TextFormatAttr
359  ++aTmpEnd;
360  bAdd = false;
361  }
362  else if( pStt->nNode != pEnd->nNode || !pStt->nContent.GetIndex() )
363  {
364  SwTextNode* pTNd = aTmpEnd.GetNode().GetTextNode();
365  if( pTNd && pTNd->HasSwAttrSet() && pTNd->GetpSwAttrSet()->Count() )
366  {
367  if (pHst)
368  {
369  SwRegHistory history(pTNd, *pTNd, pHst);
370  pTNd->FormatToTextAttr(pTNd);
371  }
372  else
373  {
374  pTNd->FormatToTextAttr(pTNd);
375  }
376  }
377  }
378 
379  if( aTmpStt < aTmpEnd )
380  GetNodes().ForEach( pStt->nNode, aTmpEnd, lcl_RstAttr, &aPara );
381  else if( !rRg.HasMark() )
382  {
383  aPara.bResetAll = false ;
384  ::lcl_RstAttr( &pStt->nNode.GetNode(), &aPara );
385  aPara.bResetAll = true ;
386  }
387 
388  if( bTextAttr )
389  {
390  if( bAdd )
391  ++aTmpEnd;
393  }
394 
396 
397  xDataChanged.reset(); //before delete pPam
398 
399  if( pPam != &rRg )
400  delete pPam;
401 }
402 
404 void SwDoc::UpdateRsid( const SwPaM &rRg, const sal_Int32 nLen )
405 {
406  if (!SW_MOD()->GetModuleConfig()->IsStoreRsid())
407  return;
408 
409  SwTextNode *pTextNode = rRg.GetPoint()->nNode.GetNode().GetTextNode();
410  if (!pTextNode)
411  {
412  return;
413  }
414  const sal_Int32 nStart(rRg.GetPoint()->nContent.GetIndex() - nLen);
416 
417  SfxItemSet aSet(GetAttrPool(), svl::Items<RES_CHRATR_RSID, RES_CHRATR_RSID>);
418  aSet.Put(aRsid);
419  bool const bRet(pTextNode->SetAttr(aSet, nStart,
420  rRg.GetPoint()->nContent.GetIndex()));
421 
422  if (bRet && GetIDocumentUndoRedo().DoesUndo())
423  {
424  SwUndo *const pLastUndo = GetUndoManager().GetLastUndo();
425  SwUndoInsert *const pUndoInsert(dynamic_cast<SwUndoInsert*>(pLastUndo));
426  // this function is called after Insert so expects to find SwUndoInsert
427  assert(pUndoInsert);
428  if (pUndoInsert)
429  {
430  pUndoInsert->SetWithRsid();
431  }
432  }
433 }
434 
435 bool SwDoc::UpdateParRsid( SwTextNode *pTextNode, sal_uInt32 nVal )
436 {
437  if (!SW_MOD()->GetModuleConfig()->IsStoreRsid())
438  return false;
439 
440  if (!pTextNode)
441  {
442  return false;
443  }
444 
445  SvxRsidItem aRsid( nVal ? nVal : mnRsid, RES_PARATR_RSID );
446  return pTextNode->SetAttr( aRsid );
447 }
448 
451 void SwDoc::SetAttr( const SfxPoolItem& rAttr, SwFormat& rFormat )
452 {
453  SfxItemSet aSet( GetAttrPool(), rAttr.Which(), rAttr.Which() );
454  aSet.Put( rAttr );
455  SetAttr( aSet, rFormat );
456 }
457 
460 void SwDoc::SetAttr( const SfxItemSet& rSet, SwFormat& rFormat )
461 {
462  if (GetIDocumentUndoRedo().DoesUndo())
463  {
464  SwUndoFormatAttrHelper aTmp( rFormat );
465  rFormat.SetFormatAttr( rSet );
466  if ( aTmp.GetUndo() )
467  {
469  }
470  else
471  {
473  }
474  }
475  else
476  {
477  rFormat.SetFormatAttr( rSet );
478  }
480 }
481 
482 void SwDoc::ResetAttrAtFormat( const sal_uInt16 nWhichId,
483  SwFormat& rChangedFormat )
484 {
485  std::unique_ptr<SwUndo> pUndo;
486  if (GetIDocumentUndoRedo().DoesUndo())
487  pUndo.reset(new SwUndoFormatResetAttr( rChangedFormat, nWhichId ));
488 
489  const bool bAttrReset = rChangedFormat.ResetFormatAttr( nWhichId );
490 
491  if ( bAttrReset )
492  {
493  if ( pUndo )
494  {
495  GetIDocumentUndoRedo().AppendUndo( std::move(pUndo) );
496  }
497 
499  }
500 }
501 
502 static bool lcl_SetNewDefTabStops( SwTwips nOldWidth, SwTwips nNewWidth,
503  SvxTabStopItem& rChgTabStop )
504 {
505  // Set the default values of all TabStops to the new value.
506  // Attention: we always work with the PoolAttribute here, so that
507  // we don't calculate the same value on the same TabStop (pooled!) for all sets.
508  // We send a FormatChg to modify.
509 
510  sal_uInt16 nOldCnt = rChgTabStop.Count();
511  if( !nOldCnt || nOldWidth == nNewWidth )
512  return false;
513 
514  // Find the default's beginning
515  sal_uInt16 n;
516  for( n = nOldCnt; n ; --n )
517  if( SvxTabAdjust::Default != rChgTabStop[n - 1].GetAdjustment() )
518  break;
519  ++n;
520  if( n < nOldCnt ) // delete the DefTabStops
521  rChgTabStop.Remove( n, nOldCnt - n );
522  return true;
523 }
524 
527 void SwDoc::SetDefault( const SfxPoolItem& rAttr )
528 {
529  SfxItemSet aSet( GetAttrPool(), rAttr.Which(), rAttr.Which() );
530  aSet.Put( rAttr );
531  SetDefault( aSet );
532 }
533 
534 void SwDoc::SetDefault( const SfxItemSet& rSet )
535 {
536  if( !rSet.Count() )
537  return;
538 
539  sw::BroadcastingModify aCallMod;
540  SwAttrSet aOld( GetAttrPool(), rSet.GetRanges() ),
541  aNew( GetAttrPool(), rSet.GetRanges() );
542  SfxItemIter aIter( rSet );
543  const SfxPoolItem* pItem = aIter.GetCurItem();
544  SfxItemPool* pSdrPool = GetAttrPool().GetSecondaryPool();
545  do
546  {
547  bool bCheckSdrDflt = false;
548  const sal_uInt16 nWhich = pItem->Which();
549  aOld.Put( GetAttrPool().GetDefaultItem( nWhich ) );
550  GetAttrPool().SetPoolDefaultItem( *pItem );
551  aNew.Put( GetAttrPool().GetDefaultItem( nWhich ) );
552 
553  if (isCHRATR(nWhich) || isTXTATR(nWhich))
554  {
555  aCallMod.Add( mpDfltTextFormatColl.get() );
556  aCallMod.Add( mpDfltCharFormat.get() );
557  bCheckSdrDflt = nullptr != pSdrPool;
558  }
559  else if ( isPARATR(nWhich) ||
560  isPARATR_LIST(nWhich) )
561  {
562  aCallMod.Add( mpDfltTextFormatColl.get() );
563  bCheckSdrDflt = nullptr != pSdrPool;
564  }
565  else if (isGRFATR(nWhich))
566  {
567  aCallMod.Add( mpDfltGrfFormatColl.get() );
568  }
569  else if (isFRMATR(nWhich) || isDrawingLayerAttribute(nWhich) )
570  {
571  aCallMod.Add( mpDfltGrfFormatColl.get() );
572  aCallMod.Add( mpDfltTextFormatColl.get() );
573  aCallMod.Add( mpDfltFrameFormat.get() );
574  }
575  else if (isBOXATR(nWhich))
576  {
577  aCallMod.Add( mpDfltFrameFormat.get() );
578  }
579 
580  // also copy the defaults
581  if( bCheckSdrDflt )
582  {
583  sal_uInt16 nSlotId = GetAttrPool().GetSlotId( nWhich );
584  if( 0 != nSlotId && nSlotId != nWhich )
585  {
586  sal_uInt16 nEdtWhich = pSdrPool->GetWhich( nSlotId );
587  if( 0 != nEdtWhich && nSlotId != nEdtWhich )
588  {
589  std::unique_ptr<SfxPoolItem> pCpy(pItem->Clone());
590  pCpy->SetWhich( nEdtWhich );
591  pSdrPool->SetPoolDefaultItem( *pCpy );
592  }
593  }
594  }
595 
596  pItem = aIter.NextItem();
597  } while (pItem);
598 
599  if( aNew.Count() && aCallMod.HasWriterListeners() )
600  {
602  {
603  GetIDocumentUndoRedo().AppendUndo( std::make_unique<SwUndoDefaultAttr>( aOld, *this ) );
604  }
605 
606  const SfxPoolItem* pTmpItem;
607  if( ( SfxItemState::SET ==
608  aNew.GetItemState( RES_PARATR_TABSTOP, false, &pTmpItem ) ) &&
609  pTmpItem->StaticWhichCast(RES_PARATR_TABSTOP).Count() )
610  {
611  // Set the default values of all TabStops to the new value.
612  // Attention: we always work with the PoolAttribute here, so that
613  // we don't calculate the same value on the same TabStop (pooled!) for all sets.
614  // We send a FormatChg to modify.
615  SwTwips nNewWidth = pTmpItem->StaticWhichCast(RES_PARATR_TABSTOP)[ 0 ].GetTabPos(),
616  nOldWidth = aOld.Get(RES_PARATR_TABSTOP)[ 0 ].GetTabPos();
617 
618  bool bChg = false;
619  for (const SfxPoolItem* pItem2 : GetAttrPool().GetItemSurrogates(RES_PARATR_TABSTOP))
620  {
621  if(auto pTabStopItem = pItem2->DynamicWhichCast(RES_PARATR_TABSTOP))
622  bChg |= lcl_SetNewDefTabStops( nOldWidth, nNewWidth,
623  *const_cast<SvxTabStopItem*>(pTabStopItem) );
624  }
625 
626  aNew.ClearItem( RES_PARATR_TABSTOP );
627  aOld.ClearItem( RES_PARATR_TABSTOP );
628  if( bChg )
629  {
630  SwFormatChg aChgFormat( mpDfltCharFormat.get() );
631  // notify the frames
632  aCallMod.CallSwClientNotify(sw::LegacyModifyHint( &aChgFormat, &aChgFormat ));
633  }
634  }
635  }
636 
637  if( aNew.Count() && aCallMod.HasWriterListeners() )
638  {
639  SwAttrSetChg aChgOld( aOld, aOld );
640  SwAttrSetChg aChgNew( aNew, aNew );
641  aCallMod.CallSwClientNotify(sw::LegacyModifyHint( &aChgOld, &aChgNew )); // all changed are sent
642  }
643 
644  // remove the default formats from the object again
645  SwIterator<SwClient, sw::BroadcastingModify> aClientIter(aCallMod);
646  for(SwClient* pClient = aClientIter.First(); pClient; pClient = aClientIter.Next())
647  aCallMod.Remove( pClient );
648 
650 }
651 
653 const SfxPoolItem& SwDoc::GetDefault( sal_uInt16 nFormatHint ) const
654 {
655  return GetAttrPool().GetDefaultItem( nFormatHint );
656 }
657 
659 void SwDoc::DelCharFormat(size_t nFormat, bool bBroadcast)
660 {
661  SwCharFormat * pDel = (*mpCharFormatTable)[nFormat];
662 
663  if (bBroadcast)
664  BroadcastStyleOperation(pDel->GetName(), SfxStyleFamily::Char,
665  SfxHintId::StyleSheetErased);
666 
668  {
670  std::make_unique<SwUndoCharFormatDelete>(pDel, *this));
671  }
672 
673  delete (*mpCharFormatTable)[nFormat];
674  mpCharFormatTable->erase(mpCharFormatTable->begin() + nFormat);
675 
677 }
678 
679 void SwDoc::DelCharFormat( SwCharFormat const *pFormat, bool bBroadcast )
680 {
681  size_t nFormat = mpCharFormatTable->GetPos( pFormat );
682  OSL_ENSURE( SIZE_MAX != nFormat, "Format not found," );
683  DelCharFormat( nFormat, bBroadcast );
684 }
685 
686 void SwDoc::DelFrameFormat( SwFrameFormat *pFormat, bool bBroadcast )
687 {
688  if( dynamic_cast<const SwTableBoxFormat*>( pFormat) != nullptr || dynamic_cast<const SwTableLineFormat*>( pFormat) != nullptr )
689  {
690  OSL_ENSURE( false, "Format is not in the DocArray any more, "
691  "so it can be deleted with delete" );
692  delete pFormat;
693  }
694  else
695  {
696  // The format has to be in the one or the other, we'll see in which one.
697  if (mpFrameFormatTable->ContainsFormat(*pFormat))
698  {
699  if (bBroadcast)
700  BroadcastStyleOperation(pFormat->GetName(),
701  SfxStyleFamily::Frame,
702  SfxHintId::StyleSheetErased);
703 
705  {
707  std::make_unique<SwUndoFrameFormatDelete>(pFormat, *this));
708  }
709 
710  mpFrameFormatTable->erase( pFormat );
711  delete pFormat;
712  }
713  else
714  {
715  bool contains = GetSpzFrameFormats()->ContainsFormat(*pFormat);
716  OSL_ENSURE( contains, "FrameFormat not found." );
717  if( contains )
718  {
719  GetSpzFrameFormats()->erase( pFormat );
720  delete pFormat;
721  }
722  }
723  }
724 }
725 
727 {
729  OSL_ENSURE( it != mpTableFrameFormatTable->end(), "Format not found," );
730  mpTableFrameFormatTable->erase( it );
731  delete pFormat;
732 }
733 
734 SwFrameFormat* SwDoc::FindFrameFormatByName( const OUString& rName ) const
735 {
736  return mpFrameFormatTable->FindFormatByName( rName );
737 }
738 
740 SwFlyFrameFormat *SwDoc::MakeFlyFrameFormat( const OUString &rFormatName,
741  SwFrameFormat *pDerivedFrom )
742 {
743  SwFlyFrameFormat *pFormat = new SwFlyFrameFormat( GetAttrPool(), rFormatName, pDerivedFrom );
744  GetSpzFrameFormats()->push_back(pFormat);
746  return pFormat;
747 }
748 
749 SwDrawFrameFormat *SwDoc::MakeDrawFrameFormat( const OUString &rFormatName,
750  SwFrameFormat *pDerivedFrom )
751 {
752  SwDrawFrameFormat *pFormat = new SwDrawFrameFormat( GetAttrPool(), rFormatName, pDerivedFrom);
753  GetSpzFrameFormats()->push_back(pFormat);
755  return pFormat;
756 }
757 
758 size_t SwDoc::GetTableFrameFormatCount(bool bUsed) const
759 {
760  if (!bUsed)
761  {
762  return mpTableFrameFormatTable->size();
763  }
764 
765  SwAutoFormatGetDocNode aGetHt(&GetNodes());
766  size_t nCount = 0;
767  for (SwFrameFormat* const & pFormat : *mpTableFrameFormatTable)
768  {
769  if (!pFormat->GetInfo(aGetHt))
770  nCount++;
771  }
772  return nCount;
773 }
774 
775 SwFrameFormat& SwDoc::GetTableFrameFormat(size_t nFormat, bool bUsed) const
776 {
777  if (!bUsed)
778  {
779  return *((*mpTableFrameFormatTable)[nFormat]);
780  }
781 
782  SwAutoFormatGetDocNode aGetHt(&GetNodes());
783 
784  size_t index = 0;
785 
786  for (SwFrameFormat* const & pFormat : *mpTableFrameFormatTable)
787  {
788  if (!pFormat->GetInfo(aGetHt))
789  {
790  if (index == nFormat)
791  return *pFormat;
792  else
793  index++;
794  }
795  }
796  throw std::out_of_range("Format index out of range.");
797 }
798 
799 SwTableFormat* SwDoc::MakeTableFrameFormat( const OUString &rFormatName,
800  SwFrameFormat *pDerivedFrom )
801 {
802  SwTableFormat* pFormat = new SwTableFormat( GetAttrPool(), rFormatName, pDerivedFrom );
803  mpTableFrameFormatTable->push_back( pFormat );
805 
806  return pFormat;
807 }
808 
809 SwFrameFormat *SwDoc::MakeFrameFormat(const OUString &rFormatName,
810  SwFrameFormat *pDerivedFrom,
811  bool bBroadcast, bool bAuto)
812 {
813  SwFrameFormat *pFormat = new SwFrameFormat( GetAttrPool(), rFormatName, pDerivedFrom );
814 
815  pFormat->SetAuto(bAuto);
816  mpFrameFormatTable->push_back( pFormat );
818 
819  if (GetIDocumentUndoRedo().DoesUndo())
820  {
822  std::make_unique<SwUndoFrameFormatCreate>(pFormat, pDerivedFrom, *this));
823  }
824 
825  if (bBroadcast)
826  {
827  BroadcastStyleOperation(rFormatName, SfxStyleFamily::Frame,
828  SfxHintId::StyleSheetCreated);
829  }
830 
831  return pFormat;
832 }
833 
834 SwFormat *SwDoc::MakeFrameFormat_(const OUString &rFormatName,
835  SwFormat *pDerivedFrom,
836  bool bBroadcast, bool bAuto)
837 {
838  SwFrameFormat *pFrameFormat = dynamic_cast<SwFrameFormat*>(pDerivedFrom);
839  pFrameFormat = MakeFrameFormat( rFormatName, pFrameFormat, bBroadcast, bAuto );
840  return pFrameFormat;
841 }
842 
843 SwCharFormat *SwDoc::MakeCharFormat( const OUString &rFormatName,
844  SwCharFormat *pDerivedFrom,
845  bool bBroadcast )
846 {
847  SwCharFormat *pFormat = new SwCharFormat( GetAttrPool(), rFormatName, pDerivedFrom );
848  mpCharFormatTable->insert( pFormat );
849  pFormat->SetAuto(false);
851 
852  if (GetIDocumentUndoRedo().DoesUndo())
853  {
855  std::make_unique<SwUndoCharFormatCreate>(pFormat, pDerivedFrom, *this));
856  }
857 
858  if (bBroadcast)
859  {
860  BroadcastStyleOperation(rFormatName, SfxStyleFamily::Char,
861  SfxHintId::StyleSheetCreated);
862  }
863 
864  return pFormat;
865 }
866 
867 SwFormat *SwDoc::MakeCharFormat_(const OUString &rFormatName,
868  SwFormat *pDerivedFrom,
869  bool bBroadcast, bool /*bAuto*/)
870 {
871  SwCharFormat *pCharFormat = dynamic_cast<SwCharFormat*>(pDerivedFrom);
872  pCharFormat = MakeCharFormat( rFormatName, pCharFormat, bBroadcast );
873  return pCharFormat;
874 }
875 
877 SwTextFormatColl* SwDoc::MakeTextFormatColl( const OUString &rFormatName,
878  SwTextFormatColl *pDerivedFrom,
879  bool bBroadcast)
880 {
881  SwTextFormatColl *pFormatColl = new SwTextFormatColl( GetAttrPool(), rFormatName,
882  pDerivedFrom );
883  mpTextFormatCollTable->push_back(pFormatColl);
884  pFormatColl->SetAuto(false);
886 
887  if (GetIDocumentUndoRedo().DoesUndo())
888  {
890  std::make_unique<SwUndoTextFormatCollCreate>(pFormatColl, pDerivedFrom,
891  *this));
892  }
893 
894  if (bBroadcast)
895  BroadcastStyleOperation(rFormatName, SfxStyleFamily::Para,
896  SfxHintId::StyleSheetCreated);
897 
898  return pFormatColl;
899 }
900 
901 SwFormat *SwDoc::MakeTextFormatColl_(const OUString &rFormatName,
902  SwFormat *pDerivedFrom,
903  bool bBroadcast, bool /*bAuto*/)
904 {
905  SwTextFormatColl *pTextFormatColl = dynamic_cast<SwTextFormatColl*>(pDerivedFrom);
906  pTextFormatColl = MakeTextFormatColl( rFormatName, pTextFormatColl, bBroadcast );
907  return pTextFormatColl;
908 }
909 
910 //FEATURE::CONDCOLL
912  SwTextFormatColl *pDerivedFrom,
913  bool bBroadcast)
914 {
916  rFormatName, pDerivedFrom );
917  mpTextFormatCollTable->push_back(pFormatColl);
918  pFormatColl->SetAuto(false);
920 
921  if (GetIDocumentUndoRedo().DoesUndo())
922  {
924  std::make_unique<SwUndoCondTextFormatCollCreate>(pFormatColl, pDerivedFrom,
925  *this));
926  }
927 
928  if (bBroadcast)
929  BroadcastStyleOperation(rFormatName, SfxStyleFamily::Para,
930  SfxHintId::StyleSheetCreated);
931 
932  return pFormatColl;
933 }
934 //FEATURE::CONDCOLL
935 
936 // GRF
937 SwGrfFormatColl* SwDoc::MakeGrfFormatColl( const OUString &rFormatName,
938  SwGrfFormatColl *pDerivedFrom )
939 {
940  SwGrfFormatColl *pFormatColl = new SwGrfFormatColl( GetAttrPool(), rFormatName,
941  pDerivedFrom );
942  mpGrfFormatCollTable->push_back( pFormatColl );
943  pFormatColl->SetAuto(false);
945  return pFormatColl;
946 }
947 
948 void SwDoc::DelTextFormatColl(size_t nFormatColl, bool bBroadcast)
949 {
950  OSL_ENSURE( nFormatColl, "Remove of Coll 0." );
951 
952  // Who has the to-be-deleted as their Next?
953  SwTextFormatColl *pDel = (*mpTextFormatCollTable)[nFormatColl];
954  if( mpDfltTextFormatColl.get() == pDel )
955  return; // never delete default!
956 
957  if (bBroadcast)
958  BroadcastStyleOperation(pDel->GetName(), SfxStyleFamily::Para,
959  SfxHintId::StyleSheetErased);
960 
962  {
963  std::unique_ptr<SwUndoTextFormatCollDelete> pUndo;
964  if (RES_CONDTXTFMTCOLL == pDel->Which())
965  {
966  pUndo.reset(new SwUndoCondTextFormatCollDelete(pDel, *this));
967  }
968  else
969  {
970  pUndo.reset(new SwUndoTextFormatCollDelete(pDel, *this));
971  }
972 
973  GetIDocumentUndoRedo().AppendUndo(std::move(pUndo));
974  }
975 
976  // Remove the FormatColl
977  mpTextFormatCollTable->erase(mpTextFormatCollTable->begin() + nFormatColl);
978  // Correct next
979  for( SwTextFormatColls::const_iterator it = mpTextFormatCollTable->begin() + 1; it != mpTextFormatCollTable->end(); ++it )
980  SetTextFormatCollNext( *it, pDel );
981  delete pDel;
983 }
984 
985 void SwDoc::DelTextFormatColl( SwTextFormatColl const *pColl, bool bBroadcast )
986 {
987  size_t nFormat = mpTextFormatCollTable->GetPos( pColl );
988  OSL_ENSURE( SIZE_MAX != nFormat, "Collection not found," );
989  DelTextFormatColl( nFormat, bBroadcast );
990 }
991 
992 static bool lcl_SetTextFormatColl( const SwNodePtr& rpNode, void* pArgs )
993 {
994  SwContentNode* pCNd = rpNode->GetTextNode();
995 
996  if( pCNd == nullptr)
997  return true;
998 
1000 
1001  if (pPara->pLayout && pPara->pLayout->HasMergedParas())
1002  {
1004  {
1005  return true;
1006  }
1007  if (pCNd->IsTextNode())
1008  {
1009  pCNd = sw::GetParaPropsNode(*pPara->pLayout, SwNodeIndex(*pCNd));
1010  }
1011  }
1012 
1013  SwTextFormatColl* pFormat = static_cast<SwTextFormatColl*>(pPara->pFormatColl);
1014  if ( pPara->bReset )
1015  {
1016  lcl_RstAttr(pCNd, pPara);
1017 
1018  // #i62675# check, if paragraph style has changed
1019  if ( pPara->bResetListAttrs &&
1020  pFormat != pCNd->GetFormatColl() &&
1021  pFormat->GetItemState( RES_PARATR_NUMRULE ) == SfxItemState::SET )
1022  {
1023  // Check, if the list style of the paragraph will change.
1024  bool bChangeOfListStyleAtParagraph( true );
1025  SwTextNode& rTNd(dynamic_cast<SwTextNode&>(*pCNd));
1026  {
1027  SwNumRule* pNumRuleAtParagraph(rTNd.GetNumRule());
1028  if ( pNumRuleAtParagraph )
1029  {
1030  const SwNumRuleItem& rNumRuleItemAtParagraphStyle =
1031  pFormat->GetNumRule();
1032  if ( rNumRuleItemAtParagraphStyle.GetValue() ==
1033  pNumRuleAtParagraph->GetName() )
1034  {
1035  bChangeOfListStyleAtParagraph = false;
1036  }
1037  }
1038  }
1039 
1040  if ( bChangeOfListStyleAtParagraph )
1041  {
1042  std::unique_ptr< SwRegHistory > pRegH;
1043  if ( pPara->pHistory )
1044  {
1045  pRegH.reset(new SwRegHistory(&rTNd, rTNd, pPara->pHistory));
1046  }
1047 
1048  pCNd->ResetAttr( RES_PARATR_NUMRULE );
1049 
1050  // reset all list attributes
1055  pCNd->ResetAttr( RES_PARATR_LIST_ID );
1056  }
1057  }
1058  }
1059 
1060  // add to History so that old data is saved, if necessary
1061  if( pPara->pHistory )
1062  pPara->pHistory->Add( pCNd->GetFormatColl(), pCNd->GetIndex(),
1063  SwNodeType::Text );
1064 
1065  pCNd->ChgFormatColl( pFormat );
1066 
1067  pPara->nWhich++;
1068 
1069  return true;
1070 }
1071 
1073  SwTextFormatColl *pFormat,
1074  const bool bReset,
1075  const bool bResetListAttrs,
1076  SwRootFrame const*const pLayout)
1077 {
1078  SwDataChanged aTmp( rRg );
1079  const SwPosition *pStt = rRg.Start(), *pEnd = rRg.End();
1080  SwHistory* pHst = nullptr;
1081  bool bRet = true;
1082 
1083  if (GetIDocumentUndoRedo().DoesUndo())
1084  {
1085  std::unique_ptr<SwUndoFormatColl> pUndo(new SwUndoFormatColl( rRg, pFormat,
1086  bReset,
1087  bResetListAttrs ));
1088  pHst = pUndo->GetHistory();
1089  GetIDocumentUndoRedo().AppendUndo(std::move(pUndo));
1090  }
1091 
1093  pStt, pEnd, pHst, nullptr, pLayout);
1094  aPara.pFormatColl = pFormat;
1095  aPara.bReset = bReset;
1096  // #i62675#
1097  aPara.bResetListAttrs = bResetListAttrs;
1098 
1099  GetNodes().ForEach( pStt->nNode.GetIndex(), pEnd->nNode.GetIndex()+1,
1100  lcl_SetTextFormatColl, &aPara );
1101  if( !aPara.nWhich )
1102  bRet = false; // didn't find a valid Node
1103 
1104  if (bRet)
1105  {
1107  }
1108 
1109  return bRet;
1110 }
1111 
1114  const SwFormatsBase& rFormatArr,
1115  FNCopyFormat fnCopyFormat, const SwFormat& rDfltFormat )
1116 {
1117  // It's no autoformat, default format or collection format,
1118  // then search for it.
1119  if( !rFormat.IsAuto() || !rFormat.GetRegisteredIn() )
1120  for( size_t n = 0; n < rFormatArr.GetFormatCount(); ++n )
1121  {
1122  // Does the Doc already contain the template?
1123  if( rFormatArr.GetFormat(n)->GetName()==rFormat.GetName() )
1124  return rFormatArr.GetFormat(n);
1125  }
1126 
1127  // Search for the "parent" first
1128  SwFormat* pParent = const_cast<SwFormat*>(&rDfltFormat);
1129  if( rFormat.DerivedFrom() && pParent != rFormat.DerivedFrom() )
1130  pParent = CopyFormat( *rFormat.DerivedFrom(), rFormatArr,
1131  fnCopyFormat, rDfltFormat );
1132 
1133  // Create the format and copy the attributes
1134  // #i40550#
1135  SwFormat* pNewFormat = (this->*fnCopyFormat)( rFormat.GetName(), pParent, false, true );
1136  pNewFormat->SetAuto( rFormat.IsAuto() );
1137  pNewFormat->CopyAttrs( rFormat ); // copy the attributes
1138 
1139  pNewFormat->SetPoolFormatId( rFormat.GetPoolFormatId() );
1140  pNewFormat->SetPoolHelpId( rFormat.GetPoolHelpId() );
1141 
1142  // Always set the HelpFile Id to default!
1143  pNewFormat->SetPoolHlpFileId( UCHAR_MAX );
1144 
1145  return pNewFormat;
1146 }
1147 
1150 {
1151  return static_cast<SwFrameFormat*>(CopyFormat( rFormat, *GetFrameFormats(), &SwDoc::MakeFrameFormat_,
1152  *GetDfltFrameFormat() ));
1153 }
1154 
1157 {
1158  return static_cast<SwCharFormat*>(CopyFormat( rFormat, *GetCharFormats(),
1160  *GetDfltCharFormat() ));
1161 }
1162 
1165 {
1166  SwTextFormatColl* pNewColl = FindTextFormatCollByName( rColl.GetName() );
1167  if( pNewColl )
1168  return pNewColl;
1169 
1170  // search for the "parent" first
1171  SwTextFormatColl* pParent = mpDfltTextFormatColl.get();
1172  if( pParent != rColl.DerivedFrom() )
1173  pParent = CopyTextColl( *static_cast<SwTextFormatColl*>(rColl.DerivedFrom()) );
1174 
1175 //FEATURE::CONDCOLL
1176  if( RES_CONDTXTFMTCOLL == rColl.Which() )
1177  {
1178  pNewColl = new SwConditionTextFormatColl( GetAttrPool(), rColl.GetName(),
1179  pParent);
1180  mpTextFormatCollTable->push_back( pNewColl );
1181  pNewColl->SetAuto(false);
1183 
1184  // copy the conditions
1185  static_cast<SwConditionTextFormatColl*>(pNewColl)->SetConditions(
1186  static_cast<const SwConditionTextFormatColl&>(rColl).GetCondColls() );
1187  }
1188  else
1189 //FEATURE::CONDCOLL
1190  pNewColl = MakeTextFormatColl( rColl.GetName(), pParent );
1191 
1192  // copy the auto formats or the attributes
1193  pNewColl->CopyAttrs( rColl );
1194 
1197  pNewColl->SetPoolFormatId( rColl.GetPoolFormatId() );
1198  pNewColl->SetPoolHelpId( rColl.GetPoolHelpId() );
1199 
1200  // Always set the HelpFile Id to default!
1201  pNewColl->SetPoolHlpFileId( UCHAR_MAX );
1202 
1203  if( &rColl.GetNextTextFormatColl() != &rColl )
1205 
1206  // create the NumRule if necessary
1207  if( this != rColl.GetDoc() )
1208  {
1209  const SfxPoolItem* pItem;
1210  if( SfxItemState::SET == pNewColl->GetItemState( RES_PARATR_NUMRULE,
1211  false, &pItem ))
1212  {
1213  const OUString& rName = pItem->StaticWhichCast(RES_PARATR_NUMRULE).GetValue();
1214  if( !rName.isEmpty() )
1215  {
1216  const SwNumRule* pRule = rColl.GetDoc()->FindNumRulePtr( rName );
1217  if( pRule && !pRule->IsAutoRule() )
1218  {
1219  SwNumRule* pDestRule = FindNumRulePtr( rName );
1220  if( pDestRule )
1221  pDestRule->SetInvalidRule( true );
1222  else
1223  MakeNumRule( rName, pRule );
1224  }
1225  }
1226  }
1227  }
1228  return pNewColl;
1229 }
1230 
1233 {
1234  SwGrfFormatColl* pNewColl = mpGrfFormatCollTable->FindFormatByName( rColl.GetName() );
1235  if( pNewColl )
1236  return pNewColl;
1237 
1238  // Search for the "parent" first
1239  SwGrfFormatColl* pParent = mpDfltGrfFormatColl.get();
1240  if( pParent != rColl.DerivedFrom() )
1241  pParent = CopyGrfColl( *static_cast<SwGrfFormatColl*>(rColl.DerivedFrom()) );
1242 
1243  // if not, copy them
1244  pNewColl = MakeGrfFormatColl( rColl.GetName(), pParent );
1245 
1246  // copy the attributes
1247  pNewColl->CopyAttrs( rColl );
1248 
1249  pNewColl->SetPoolFormatId( rColl.GetPoolFormatId() );
1250  pNewColl->SetPoolHelpId( rColl.GetPoolHelpId() );
1251 
1252  // Always set the HelpFile Id to default!
1253  pNewColl->SetPoolHlpFileId( UCHAR_MAX );
1254 
1255  return pNewColl;
1256 }
1257 
1258 void SwDoc::CopyFormatArr( const SwFormatsBase& rSourceArr,
1259  SwFormatsBase const & rDestArr,
1260  FNCopyFormat fnCopyFormat,
1261  SwFormat& rDfltFormat )
1262 {
1263  SwFormat* pSrc, *pDest;
1264 
1265  // 1st step: Create all formats (skip the 0th - it's the default one)
1266  for( size_t nSrc = rSourceArr.GetFormatCount(); nSrc > 1; )
1267  {
1268  pSrc = rSourceArr.GetFormat( --nSrc );
1269  if( pSrc->IsDefault() || pSrc->IsAuto() )
1270  continue;
1271 
1272  if( nullptr == rDestArr.FindFormatByName( pSrc->GetName() ) )
1273  {
1274  if( RES_CONDTXTFMTCOLL == pSrc->Which() )
1275  MakeCondTextFormatColl( pSrc->GetName(), static_cast<SwTextFormatColl*>(&rDfltFormat) );
1276  else
1277  // #i40550#
1278  (this->*fnCopyFormat)( pSrc->GetName(), &rDfltFormat, false, true );
1279  }
1280  }
1281 
1282  // 2nd step: Copy all attributes, set the right parents
1283  for( size_t nSrc = rSourceArr.GetFormatCount(); nSrc > 1; )
1284  {
1285  pSrc = rSourceArr.GetFormat( --nSrc );
1286  if( pSrc->IsDefault() || pSrc->IsAuto() )
1287  continue;
1288 
1289  pDest = rDestArr.FindFormatByName( pSrc->GetName() );
1290  pDest->SetAuto(false);
1291  pDest->DelDiffs( *pSrc );
1292 
1293  // #i94285#: existing <SwFormatPageDesc> instance, before copying attributes
1294  const SfxPoolItem* pItem;
1295  if( &GetAttrPool() != pSrc->GetAttrSet().GetPool()
1296  && SfxItemState::SET == pSrc->GetAttrSet().GetItemState( RES_PAGEDESC, false, &pItem )
1297  && pItem->StaticWhichCast(RES_PAGEDESC).GetPageDesc() )
1298  {
1299  SwFormatPageDesc aPageDesc( pItem->StaticWhichCast(RES_PAGEDESC) );
1300  const OUString& rNm = aPageDesc.GetPageDesc()->GetName();
1301  SwPageDesc* pPageDesc = FindPageDesc( rNm );
1302  if( !pPageDesc )
1303  {
1304  pPageDesc = MakePageDesc(rNm);
1305  }
1306  aPageDesc.RegisterToPageDesc( *pPageDesc );
1307  SwAttrSet aTmpAttrSet( pSrc->GetAttrSet() );
1308  aTmpAttrSet.Put( aPageDesc );
1309  pDest->SetFormatAttr( aTmpAttrSet );
1310  }
1311  else
1312  {
1313  pDest->SetFormatAttr( pSrc->GetAttrSet() );
1314  }
1315 
1316  pDest->SetPoolFormatId( pSrc->GetPoolFormatId() );
1317  pDest->SetPoolHelpId( pSrc->GetPoolHelpId() );
1318 
1319  // Always set the HelpFile Id to default!
1320  pDest->SetPoolHlpFileId( UCHAR_MAX );
1321 
1322  if( pSrc->DerivedFrom() )
1323  pDest->SetDerivedFrom( rDestArr.FindFormatByName(
1324  pSrc->DerivedFrom()->GetName() ) );
1325  if( RES_TXTFMTCOLL == pSrc->Which() ||
1326  RES_CONDTXTFMTCOLL == pSrc->Which() )
1327  {
1328  SwTextFormatColl* pSrcColl = static_cast<SwTextFormatColl*>(pSrc),
1329  * pDstColl = static_cast<SwTextFormatColl*>(pDest);
1330  if( &pSrcColl->GetNextTextFormatColl() != pSrcColl )
1331  pDstColl->SetNextTextFormatColl(
1332  *static_cast<SwTextFormatColl*>(rDestArr.FindFormatByName( pSrcColl->GetNextTextFormatColl().GetName() )) );
1333 
1334  if(pSrcColl->IsAssignedToListLevelOfOutlineStyle())
1335  pDstColl->AssignToListLevelOfOutlineStyle(pSrcColl->GetAssignedOutlineStyleLevel());
1336 
1337 //FEATURE::CONDCOLL
1338  if( RES_CONDTXTFMTCOLL == pSrc->Which() )
1339  {
1340  if (pDstColl->Which() != RES_CONDTXTFMTCOLL)
1341  {
1342  // Target already had a style with a matching name, but it's not a conditional
1343  // style, then don't copy the conditions.
1344  continue;
1345  }
1346 
1347  // Copy the conditions, but delete the old ones first!
1348  static_cast<SwConditionTextFormatColl*>(pDstColl)->SetConditions(
1349  static_cast<SwConditionTextFormatColl*>(pSrc)->GetCondColls() );
1350  }
1351 //FEATURE::CONDCOLL
1352  }
1353  }
1354 }
1355 
1357  const SwFrameFormat& rSrcFormat, SwFrameFormat& rDestFormat )
1358 {
1359  // Treat the header and footer attributes in the right way:
1360  // Copy content nodes across documents!
1361  sal_uInt16 nAttr = bCpyHeader ? sal_uInt16(RES_HEADER) : sal_uInt16(RES_FOOTER);
1362  const SfxPoolItem* pItem;
1363  if( SfxItemState::SET != rSrcFormat.GetAttrSet().GetItemState( nAttr, false, &pItem ))
1364  return ;
1365 
1366  // The header only contains the reference to the format from the other document!
1367  std::unique_ptr<SfxPoolItem> pNewItem(pItem->Clone());
1368 
1369  SwFrameFormat* pOldFormat;
1370  if( bCpyHeader )
1371  pOldFormat = pNewItem->StaticWhichCast(RES_HEADER).GetHeaderFormat();
1372  else
1373  pOldFormat = pNewItem->StaticWhichCast(RES_FOOTER).GetFooterFormat();
1374 
1375  if( !pOldFormat )
1376  return;
1377 
1378  SwFrameFormat* pNewFormat = new SwFrameFormat( GetAttrPool(), "CpyDesc",
1379  GetDfltFrameFormat() );
1380  pNewFormat->CopyAttrs( *pOldFormat );
1381 
1382  if( SfxItemState::SET == pNewFormat->GetAttrSet().GetItemState(
1383  RES_CNTNT, false, &pItem ))
1384  {
1386  if( pContent->GetContentIdx() )
1387  {
1388  SwNodeIndex aTmpIdx( GetNodes().GetEndOfAutotext() );
1389  const SwNodes& rSrcNds = rSrcFormat.GetDoc()->GetNodes();
1390  SwStartNode* pSttNd = SwNodes::MakeEmptySection( aTmpIdx,
1391  bCpyHeader
1393  : SwFooterStartNode );
1394  const SwNode& rCSttNd = pContent->GetContentIdx()->GetNode();
1395  SwNodeRange aRg( rCSttNd, 0, *rCSttNd.EndOfSectionNode() );
1396  aTmpIdx = *pSttNd->EndOfSectionNode();
1397  rSrcNds.Copy_( aRg, aTmpIdx );
1398  aTmpIdx = *pSttNd;
1399  rSrcFormat.GetDoc()->GetDocumentContentOperationsManager().CopyFlyInFlyImpl(aRg, nullptr, aTmpIdx);
1400  // TODO: investigate calling CopyWithFlyInFly?
1401  SwPaM const source(aRg.aStart, aRg.aEnd);
1402  SwPosition dest(aTmpIdx);
1403  sw::CopyBookmarks(source, dest);
1404  pNewFormat->SetFormatAttr( SwFormatContent( pSttNd ));
1405  }
1406  else
1407  pNewFormat->ResetFormatAttr( RES_CNTNT );
1408  }
1409  if( bCpyHeader )
1410  pNewItem->StaticWhichCast(RES_HEADER).RegisterToFormat(*pNewFormat);
1411  else
1412  pNewItem->StaticWhichCast(RES_FOOTER).RegisterToFormat(*pNewFormat);
1413  rDestFormat.SetFormatAttr( *pNewItem );
1414 }
1415 
1416 void SwDoc::CopyPageDesc( const SwPageDesc& rSrcDesc, SwPageDesc& rDstDesc,
1417  bool bCopyPoolIds )
1418 {
1419  bool bNotifyLayout = false;
1421 
1422  rDstDesc.SetLandscape( rSrcDesc.GetLandscape() );
1423  rDstDesc.SetNumType( rSrcDesc.GetNumType() );
1424  if( rDstDesc.ReadUseOn() != rSrcDesc.ReadUseOn() )
1425  {
1426  rDstDesc.WriteUseOn( rSrcDesc.ReadUseOn() );
1427  bNotifyLayout = true;
1428  }
1429 
1430  if( bCopyPoolIds )
1431  {
1432  rDstDesc.SetPoolFormatId( rSrcDesc.GetPoolFormatId() );
1433  rDstDesc.SetPoolHelpId( rSrcDesc.GetPoolHelpId() );
1434  // Always set the HelpFile Id to default!
1435  rDstDesc.SetPoolHlpFileId( UCHAR_MAX );
1436  }
1437 
1438  if( rSrcDesc.GetFollow() != &rSrcDesc )
1439  {
1440  const SwPageDesc* pSrcFollow = rSrcDesc.GetFollow();
1441  SwPageDesc* pFollow = FindPageDesc( pSrcFollow->GetName() );
1442  if( !pFollow )
1443  {
1444  // copy
1445  pFollow = MakePageDesc( pSrcFollow->GetName() );
1446  CopyPageDesc( *pSrcFollow, *pFollow );
1447  }
1448  rDstDesc.SetFollow( pFollow );
1449  bNotifyLayout = true;
1450  }
1451 
1452  // the header and footer attributes are copied separately
1453  // the content sections have to be copied in their entirety
1454  {
1455  SfxItemSet aAttrSet( rSrcDesc.GetMaster().GetAttrSet() );
1456  aAttrSet.ClearItem( RES_HEADER );
1457  aAttrSet.ClearItem( RES_FOOTER );
1458 
1459  rDstDesc.GetMaster().DelDiffs( aAttrSet );
1460  rDstDesc.GetMaster().SetFormatAttr( aAttrSet );
1461 
1462  aAttrSet.ClearItem();
1463  aAttrSet.Put( rSrcDesc.GetLeft().GetAttrSet() );
1464  aAttrSet.ClearItem( RES_HEADER );
1465  aAttrSet.ClearItem( RES_FOOTER );
1466 
1467  rDstDesc.GetLeft().DelDiffs( aAttrSet );
1468  rDstDesc.GetLeft().SetFormatAttr( aAttrSet );
1469 
1470  aAttrSet.ClearItem();
1471  aAttrSet.Put( rSrcDesc.GetFirstMaster().GetAttrSet() );
1472  aAttrSet.ClearItem( RES_HEADER );
1473  aAttrSet.ClearItem( RES_FOOTER );
1474 
1475  rDstDesc.GetFirstMaster().DelDiffs( aAttrSet );
1476  rDstDesc.GetFirstMaster().SetFormatAttr( aAttrSet );
1477 
1478  aAttrSet.ClearItem();
1479  aAttrSet.Put( rSrcDesc.GetFirstLeft().GetAttrSet() );
1480  aAttrSet.ClearItem( RES_HEADER );
1481  aAttrSet.ClearItem( RES_FOOTER );
1482 
1483  rDstDesc.GetFirstLeft().DelDiffs( aAttrSet );
1484  rDstDesc.GetFirstLeft().SetFormatAttr( aAttrSet );
1485  }
1486 
1487  CopyHeader( rSrcDesc.GetMaster(), rDstDesc.GetMaster() );
1488  CopyFooter( rSrcDesc.GetMaster(), rDstDesc.GetMaster() );
1489  if( !rDstDesc.IsHeaderShared() )
1490  CopyHeader( rSrcDesc.GetLeft(), rDstDesc.GetLeft() );
1491  else
1492  rDstDesc.GetLeft().SetFormatAttr( rDstDesc.GetMaster().GetHeader() );
1493  if( !rDstDesc.IsFirstShared() )
1494  {
1495  CopyHeader( rSrcDesc.GetFirstMaster(), rDstDesc.GetFirstMaster() );
1496  rDstDesc.GetFirstLeft().SetFormatAttr(rDstDesc.GetFirstMaster().GetHeader());
1497  }
1498  else
1499  {
1500  rDstDesc.GetFirstMaster().SetFormatAttr( rDstDesc.GetMaster().GetHeader() );
1501  rDstDesc.GetFirstLeft().SetFormatAttr(rDstDesc.GetLeft().GetHeader());
1502  }
1503 
1504  if( !rDstDesc.IsFooterShared() )
1505  CopyFooter( rSrcDesc.GetLeft(), rDstDesc.GetLeft() );
1506  else
1507  rDstDesc.GetLeft().SetFormatAttr( rDstDesc.GetMaster().GetFooter() );
1508  if( !rDstDesc.IsFirstShared() )
1509  {
1510  CopyFooter( rSrcDesc.GetFirstMaster(), rDstDesc.GetFirstMaster() );
1511  rDstDesc.GetFirstLeft().SetFormatAttr(rDstDesc.GetFirstMaster().GetFooter());
1512  }
1513  else
1514  {
1515  rDstDesc.GetFirstMaster().SetFormatAttr( rDstDesc.GetMaster().GetFooter() );
1516  rDstDesc.GetFirstLeft().SetFormatAttr(rDstDesc.GetLeft().GetFooter());
1517  }
1518 
1519  if( bNotifyLayout && pTmpRoot )
1520  {
1521  for( auto aLayout : GetAllLayouts() )
1522  aLayout->AllCheckPageDescs();
1523  }
1524 
1525  // If foot notes change the pages have to be triggered
1526  if( !(rDstDesc.GetFootnoteInfo() == rSrcDesc.GetFootnoteInfo()) )
1527  {
1528  sw::PageFootnoteHint aHint;
1529  rDstDesc.SetFootnoteInfo( rSrcDesc.GetFootnoteInfo() );
1530  rDstDesc.GetMaster().CallSwClientNotify(aHint);
1531  rDstDesc.GetLeft().CallSwClientNotify(aHint);
1532  rDstDesc.GetFirstMaster().CallSwClientNotify(aHint);
1533  rDstDesc.GetFirstLeft().CallSwClientNotify(aHint);
1534  }
1535 
1536  // Copy the stashed formats as well between the page descriptors...
1537  for (bool bFirst : { true, false })
1538  for (bool bLeft : { true, false })
1539  for (bool bHeader : { true, false })
1540  {
1541  if (!bLeft && !bFirst)
1542  continue;
1543  if (auto pStashedFormat = rSrcDesc.GetStashedFrameFormat(bHeader, bLeft, bFirst))
1544  rDstDesc.StashFrameFormat(*pStashedFormat, bHeader, bLeft, bFirst);
1545  }
1546 }
1547 
1548 void SwDoc::ReplaceStyles( const SwDoc& rSource, bool bIncludePageStyles )
1549 {
1550  ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo());
1551 
1558 
1559  //To-Do:
1560  // a) in rtf export don't export our hideous pgdsctbl
1561  // extension to rtf anymore
1562  // b) in sd rtf import (View::InsertData) don't use
1563  // a super-fragile test for mere presence of \trowd to
1564  // indicate import of rtf into a table
1565  // c) then drop use of bIncludePageStyles
1566  if (bIncludePageStyles)
1567  {
1568  // and now the page templates
1569  SwPageDescs::size_type nCnt = rSource.m_PageDescs.size();
1570  if( nCnt )
1571  {
1572  // a different Doc -> Number formatter needs to be merged
1573  SwTableNumFormatMerge aTNFM( rSource, *this );
1574 
1575  // 1st step: Create all formats (skip the 0th - it's the default!)
1576  while( nCnt )
1577  {
1578  const SwPageDesc &rSrc = *rSource.m_PageDescs[ --nCnt ];
1579  if( nullptr == FindPageDesc( rSrc.GetName() ) )
1580  MakePageDesc( rSrc.GetName() );
1581  }
1582 
1583  // 2nd step: Copy all attributes, set the right parents
1584  for (SwPageDescs::size_type i = rSource.m_PageDescs.size(); i; )
1585  {
1586  const SwPageDesc &rSrc = *rSource.m_PageDescs[ --i ];
1587  SwPageDesc* pDesc = FindPageDesc( rSrc.GetName() );
1588  CopyPageDesc( rSrc, *pDesc);
1589  }
1590  }
1591  }
1592 
1593  // then there are the numbering templates
1594  const SwNumRuleTable::size_type nCnt = rSource.GetNumRuleTable().size();
1595  if( nCnt )
1596  {
1597  const SwNumRuleTable& rArr = rSource.GetNumRuleTable();
1598  for( SwNumRuleTable::size_type n = 0; n < nCnt; ++n )
1599  {
1600  const SwNumRule& rR = *rArr[ n ];
1601  SwNumRule* pNew = FindNumRulePtr( rR.GetName());
1602  if( pNew )
1603  pNew->CopyNumRule(*this, rR);
1604  else
1605  {
1606  if( !rR.IsAutoRule() )
1607  MakeNumRule( rR.GetName(), &rR );
1608  else
1609  {
1610  // as we reset all styles, there shouldn't be any unknown
1611  // automatic SwNumRules, because all should have been
1612  // created by the style copying!
1613  // So just warn and ignore.
1614  SAL_WARN( "sw.core", "Found unknown auto SwNumRule during reset!" );
1615  }
1616  }
1617  }
1618  }
1619 
1620  if (undoGuard.UndoWasEnabled())
1621  {
1622  // nodes array was modified!
1624  }
1625 
1627 }
1628 
1629 void SwDoc::MoveLeftMargin(const SwPaM& rPam, bool bRight, bool bModulus,
1630  SwRootFrame const*const pLayout)
1631 {
1632  SwHistory* pHistory = nullptr;
1633  if (GetIDocumentUndoRedo().DoesUndo())
1634  {
1635  std::unique_ptr<SwUndoMoveLeftMargin> pUndo(new SwUndoMoveLeftMargin( rPam, bRight,
1636  bModulus ));
1637  pHistory = &pUndo->GetHistory();
1638  GetIDocumentUndoRedo().AppendUndo( std::move(pUndo) );
1639  }
1640 
1641  const SvxTabStopItem& rTabItem = GetDefault( RES_PARATR_TABSTOP );
1642  const sal_Int32 nDefDist = rTabItem.Count() ? rTabItem[0].GetTabPos() : 1134;
1643  const SwPosition &rStt = *rPam.Start(), &rEnd = *rPam.End();
1644  SwNodeIndex aIdx( rStt.nNode );
1645  while( aIdx <= rEnd.nNode )
1646  {
1647  SwTextNode* pTNd = aIdx.GetNode().GetTextNode();
1648  if( pTNd )
1649  {
1650  pTNd = sw::GetParaPropsNode(*pLayout, aIdx);
1651  SvxLRSpaceItem aLS(pTNd->SwContentNode::GetAttr(RES_LR_SPACE).StaticWhichCast(RES_LR_SPACE));
1652 
1653  // #i93873# See also lcl_MergeListLevelIndentAsLRSpaceItem in thints.cxx
1654  if ( pTNd->AreListLevelIndentsApplicable() )
1655  {
1656  const SwNumRule* pRule = pTNd->GetNumRule();
1657  if ( pRule )
1658  {
1659  const int nListLevel = pTNd->GetActualListLevel();
1660  if ( nListLevel >= 0 )
1661  {
1662  const SwNumFormat& rFormat = pRule->Get(o3tl::narrowing<sal_uInt16>(nListLevel));
1664  {
1665  aLS.SetTextLeft( rFormat.GetIndentAt() );
1666  aLS.SetTextFirstLineOffset( static_cast<short>(rFormat.GetFirstLineIndent()) );
1667  }
1668  }
1669  }
1670  }
1671 
1672  tools::Long nNext = aLS.GetTextLeft();
1673  if( bModulus )
1674  nNext = ( nNext / nDefDist ) * nDefDist;
1675 
1676  if( bRight )
1677  nNext += nDefDist;
1678  else
1679  if(nNext >0) // fdo#75936 set limit for decreasing indent
1680  nNext -= nDefDist;
1681 
1682  aLS.SetTextLeft( nNext );
1683 
1684  SwRegHistory aRegH( pTNd, *pTNd, pHistory );
1685  pTNd->SetAttr( aLS );
1686  aIdx = *sw::GetFirstAndLastNode(*pLayout, aIdx).second;
1687  }
1688  ++aIdx;
1689  }
1691 }
1692 
1693 bool SwDoc::DontExpandFormat( const SwPosition& rPos, bool bFlag )
1694 {
1695  bool bRet = false;
1696  SwTextNode* pTextNd = rPos.nNode.GetNode().GetTextNode();
1697  if( pTextNd )
1698  {
1699  bRet = pTextNd->DontExpandFormat( rPos.nContent, bFlag );
1700  if( bRet && GetIDocumentUndoRedo().DoesUndo() )
1701  {
1702  GetIDocumentUndoRedo().AppendUndo( std::make_unique<SwUndoDontExpandFormat>(rPos) );
1703  }
1704  }
1705  return bRet;
1706 }
1707 
1709 {
1711  pFormat->SetName("TableBox" + OUString::number(reinterpret_cast<sal_IntPtr>(pFormat)));
1713  return pFormat;
1714 }
1715 
1717 {
1719  pFormat->SetName("TableLine" + OUString::number(reinterpret_cast<sal_IntPtr>(pFormat)));
1721  return pFormat;
1722 }
1723 
1725 {
1726  if (mpNumberFormatter == nullptr)
1727  {
1728  LanguageType eLang = LANGUAGE_SYSTEM;
1734  };
1735 }
1736 
1738  : pNFormat( nullptr )
1739 {
1740  // a different Doc -> Number formatter needs to be merged
1741  if( &rSrc != &rDest )
1742  {
1743  SvNumberFormatter* pN = const_cast<SwDoc&>(rSrc).GetNumberFormatter( false );
1744  if( pN )
1745  {
1746  pNFormat = rDest.GetNumberFormatter();
1747  pNFormat->MergeFormatter( *pN );
1748  }
1749  }
1750 
1751  if( &rSrc != &rDest )
1753  MergeWithOtherDoc( rDest );
1754 }
1755 
1757 {
1758  if( pNFormat )
1760 }
1761 
1762 void SwDoc::SetTextFormatCollByAutoFormat( const SwPosition& rPos, sal_uInt16 nPoolId,
1763  const SfxItemSet* pSet )
1764 {
1765  SwPaM aPam( rPos );
1766  SwTextNode* pTNd = rPos.nNode.GetNode().GetTextNode();
1767  assert(pTNd);
1768 
1770  {
1771  // create the redline object
1772  const SwTextFormatColl& rColl = *pTNd->GetTextColl();
1773  SwRangeRedline* pRedl = new SwRangeRedline( RedlineType::FmtColl, aPam );
1774  pRedl->SetMark();
1775 
1776  // Only those items that are not set by the Set again in the Node
1777  // are of interest. Thus, we take the difference.
1778  SwRedlineExtraData_FormatColl aExtraData( rColl.GetName(),
1779  rColl.GetPoolFormatId() );
1780  if( pSet && pTNd->HasSwAttrSet() )
1781  {
1782  SfxItemSet aTmp( *pTNd->GetpSwAttrSet() );
1783  aTmp.Differentiate( *pSet );
1784  // we handle the adjust item separately
1785  const SfxPoolItem* pItem;
1786  if( SfxItemState::SET == pTNd->GetpSwAttrSet()->GetItemState(
1787  RES_PARATR_ADJUST, false, &pItem ))
1788  aTmp.Put( *pItem );
1789  aExtraData.SetItemSet( aTmp );
1790  }
1791  pRedl->SetExtraData( &aExtraData );
1792 
1793  //TODO: Undo is still missing!
1794  getIDocumentRedlineAccess().AppendRedline( pRedl, true );
1795  }
1796 
1797  SetTextFormatColl( aPam, getIDocumentStylePoolAccess().GetTextCollFromPool( nPoolId ) );
1798 
1799  if (pSet && pSet->Count())
1800  {
1801  aPam.SetMark();
1802  aPam.GetMark()->nContent.Assign(pTNd, pTNd->GetText().getLength());
1803  // sw_redlinehide: don't need layout currently because the only caller
1804  // passes in the properties node
1805  assert(static_cast<SwTextFrame const*>(pTNd->getLayoutFrame(nullptr))->GetTextNodeForParaProps() == pTNd);
1807  }
1808 }
1809 
1810 void SwDoc::SetFormatItemByAutoFormat( const SwPaM& rPam, const SfxItemSet& rSet )
1811 {
1812  SwTextNode* pTNd = rPam.GetPoint()->nNode.GetNode().GetTextNode();
1813  assert(pTNd);
1814 
1816 
1818  {
1819  // create the redline object
1820  SwRangeRedline* pRedl = new SwRangeRedline( RedlineType::Format, rPam );
1821  if( !pRedl->HasMark() )
1822  pRedl->SetMark();
1823 
1824  // Only those items that are not set by the Set again in the Node
1825  // are of interest. Thus, we take the difference.
1826  SwRedlineExtraData_Format aExtraData( rSet );
1827 
1828  pRedl->SetExtraData( &aExtraData );
1829 
1830  //TODO: Undo is still missing!
1831  getIDocumentRedlineAccess().AppendRedline( pRedl, true );
1832 
1834  }
1835 
1836  const sal_Int32 nEnd(rPam.End()->nContent.GetIndex());
1837  std::vector<WhichPair> whichIds;
1838  SfxItemIter iter(rSet);
1839  for (SfxPoolItem const* pItem = iter.GetCurItem(); pItem; pItem = iter.NextItem())
1840  {
1841  whichIds.push_back({pItem->Which(), pItem->Which()});
1842  }
1843  SfxItemSet currentSet(GetAttrPool(), WhichRangesContainer(whichIds.data(), whichIds.size()));
1844  pTNd->GetParaAttr(currentSet, nEnd, nEnd);
1845  for (const WhichPair& rPair : whichIds)
1846  { // yuk - want to explicitly set the pool defaults too :-/
1847  currentSet.Put(currentSet.Get(rPair.first));
1848  }
1849 
1851 
1852  // fdo#62536: DONTEXPAND does not work when there is already an AUTOFMT
1853  // here, so insert the old attributes as an empty hint to stop expand
1854  SwPaM endPam(*pTNd, nEnd);
1855  endPam.SetMark();
1856  getIDocumentContentOperations().InsertItemSet(endPam, currentSet);
1857 
1859 }
1860 
1861 void SwDoc::ChgFormat(SwFormat & rFormat, const SfxItemSet & rSet)
1862 {
1863  if (GetIDocumentUndoRedo().DoesUndo())
1864  {
1865  // copying <rSet> to <aSet>
1866  SfxItemSet aSet(rSet);
1867  // remove from <aSet> all items, which are already set at the format
1868  aSet.Differentiate(rFormat.GetAttrSet());
1869  // <aSet> contains now all *new* items for the format
1870 
1871  // copying current format item set to <aOldSet>
1872  SfxItemSet aOldSet(rFormat.GetAttrSet());
1873  // insert new items into <aOldSet>
1874  aOldSet.Put(aSet);
1875  // invalidate all new items in <aOldSet> in order to clear these items,
1876  // if the undo action is triggered.
1877  {
1878  SfxItemIter aIter(aSet);
1879 
1880  for (const SfxPoolItem* pItem = aIter.GetCurItem(); pItem; pItem = aIter.NextItem())
1881  {
1882  aOldSet.InvalidateItem(pItem->Which());
1883  }
1884  }
1885 
1887  std::make_unique<SwUndoFormatAttr>(aOldSet, rFormat, /*bSaveDrawPt*/true));
1888  }
1889 
1890  rFormat.SetFormatAttr(rSet);
1891 }
1892 
1893 void SwDoc::RenameFormat(SwFormat & rFormat, const OUString & sNewName,
1894  bool bBroadcast)
1895 {
1896  SfxStyleFamily eFamily = SfxStyleFamily::All;
1897 
1898  if (GetIDocumentUndoRedo().DoesUndo())
1899  {
1900  std::unique_ptr<SwUndo> pUndo;
1901 
1902  switch (rFormat.Which())
1903  {
1904  case RES_CHRFMT:
1905  pUndo.reset(new SwUndoRenameCharFormat(rFormat.GetName(), sNewName, *this));
1906  eFamily = SfxStyleFamily::Char;
1907  break;
1908  case RES_TXTFMTCOLL:
1909  pUndo.reset(new SwUndoRenameFormatColl(rFormat.GetName(), sNewName, *this));
1910  eFamily = SfxStyleFamily::Para;
1911  break;
1912  case RES_FRMFMT:
1913  pUndo.reset(new SwUndoRenameFrameFormat(rFormat.GetName(), sNewName, *this));
1914  eFamily = SfxStyleFamily::Frame;
1915  break;
1916 
1917  default:
1918  break;
1919  }
1920 
1921  if (pUndo)
1922  {
1923  GetIDocumentUndoRedo().AppendUndo(std::move(pUndo));
1924  }
1925  }
1926 
1927  // name change means the o3tl::sorted_array is not property sorted
1928  if (rFormat.Which() == RES_CHRFMT)
1929  mpCharFormatTable->SetFormatNameAndReindex(static_cast<SwCharFormat*>(&rFormat), sNewName);
1930  else
1931  rFormat.SetName(sNewName);
1932 
1933  if (bBroadcast)
1934  BroadcastStyleOperation(sNewName, eFamily, SfxHintId::StyleSheetModified);
1935 }
1936 
1938 {
1939  bool bOwns = false;
1940  if (!pWriter)
1941  {
1942  pWriter = xmlNewTextWriterFilename("nodes.xml", 0);
1943  xmlTextWriterSetIndent(pWriter,1);
1944  (void)xmlTextWriterSetIndentString(pWriter, BAD_CAST(" "));
1945  (void)xmlTextWriterStartDocument(pWriter, nullptr, nullptr, nullptr);
1946  bOwns = true;
1947  }
1948  (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SwDoc"));
1949  (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this);
1950 
1951  m_pNodes->dumpAsXml(pWriter);
1952  m_PageDescs.dumpAsXml(pWriter);
1953  maDBData.dumpAsXml(pWriter);
1954  mpMarkManager->dumpAsXml(pWriter);
1955  m_pUndoManager->dumpAsXml(pWriter);
1956  m_pDocumentSettingManager->dumpAsXml(pWriter);
1958  mpTextFormatCollTable->dumpAsXml(pWriter);
1959  mpCharFormatTable->dumpAsXml(pWriter);
1960  mpFrameFormatTable->dumpAsXml(pWriter, "frmFormatTable");
1961  mpSpzFrameFormatTable->dumpAsXml(pWriter, "spzFrameFormatTable");
1962  mpSectionFormatTable->dumpAsXml(pWriter);
1963  mpTableFrameFormatTable->dumpAsXml(pWriter, "tableFrameFormatTable");
1964  mpNumRuleTable->dumpAsXml(pWriter);
1967  if (const SdrModel* pModel = getIDocumentDrawModelAccess().GetDrawModel())
1968  pModel->dumpAsXml(pWriter);
1969 
1970  (void)xmlTextWriterStartElement(pWriter, BAD_CAST("mbModified"));
1971  (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"), BAD_CAST(OString::boolean(getIDocumentState().IsModified()).getStr()));
1972  (void)xmlTextWriterEndElement(pWriter);
1973 
1974  (void)xmlTextWriterEndElement(pWriter);
1975  if (bOwns)
1976  {
1977  (void)xmlTextWriterEndDocument(pWriter);
1978  xmlFreeTextWriter(pWriter);
1979  }
1980 }
1981 
1983 {
1984  (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SwDBData"));
1985 
1986  (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("sDataSource"), BAD_CAST(sDataSource.toUtf8().getStr()));
1987  (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("sCommand"), BAD_CAST(sCommand.toUtf8().getStr()));
1988  (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nCommandType"), BAD_CAST(OString::number(nCommandType).getStr()));
1989 
1990  (void)xmlTextWriterEndElement(pWriter);
1991 }
1992 
1993 std::set<Color> SwDoc::GetDocColors()
1994 {
1995  std::set<Color> aDocColors;
1996  SwAttrPool& rPool = GetAttrPool();
1997  const sal_uInt16 pAttribs[] = {RES_CHRATR_COLOR, RES_CHRATR_HIGHLIGHT, RES_BACKGROUND};
1998  for (sal_uInt16 nAttrib : pAttribs)
1999  {
2000  for (const SfxPoolItem* pItem : rPool.GetItemSurrogates(nAttrib))
2001  {
2002  auto pColorItem = static_cast<const SvxColorItem*>(pItem);
2003  Color aColor( pColorItem->GetValue() );
2004  if (COL_AUTO != aColor)
2005  aDocColors.insert(aColor);
2006  }
2007  }
2008  return aDocColors;
2009 }
2010 
2011 // #i69627#
2012 namespace docfunc
2013 {
2015  {
2016  // If a parent paragraph style of one of the paragraph styles, which
2017  // are assigned to the list levels of the outline style, has a list style
2018  // set or inherits a list style from its parent style, the outline style
2019  // has to be written as a normal list style to the OpenDocument file
2020  // format or the OpenOffice.org file format.
2021  bool bRet( false );
2022 
2023  const SwTextFormatColls* pTextFormatColls( rDoc.GetTextFormatColls() );
2024  if ( pTextFormatColls )
2025  {
2026  for ( auto pTextFormatColl : *pTextFormatColls )
2027  {
2028  if ( pTextFormatColl->IsDefault() ||
2029  ! pTextFormatColl->IsAssignedToListLevelOfOutlineStyle() )
2030  {
2031  continue;
2032  }
2033 
2034  const SwTextFormatColl* pParentTextFormatColl =
2035  dynamic_cast<const SwTextFormatColl*>( pTextFormatColl->DerivedFrom());
2036  if ( !pParentTextFormatColl )
2037  continue;
2038 
2039  if ( SfxItemState::SET == pParentTextFormatColl->GetItemState( RES_PARATR_NUMRULE ) )
2040  {
2041  // #i106218# consider that the outline style is set
2042  const SwNumRuleItem& rDirectItem = pParentTextFormatColl->GetNumRule();
2043  if ( rDirectItem.GetValue() != rDoc.GetOutlineNumRule()->GetName() )
2044  {
2045  bRet = true;
2046  break;
2047  }
2048  }
2049  }
2050 
2051  }
2052  return bRet;
2053  }
2054 }
2055 
2057  : m_PosIndex( m_Array.get<0>() )
2058  , m_TypeAndNameIndex( m_Array.get<1>() )
2059 {
2060 }
2061 
2063 {
2065 }
2066 
2068 {
2069  ByTypeAndName::iterator it = m_TypeAndNameIndex.find(
2070  boost::make_tuple(x->GetName(), x->Which(), x) );
2071  return m_Array.project<0>( it );
2072 }
2073 
2074 SwFrameFormats::ByTypeAndName::const_iterator
2075 SwFrameFormats::findByTypeAndName( sal_uInt16 type, const OUString& name ) const
2076 {
2077  return m_TypeAndNameIndex.find( boost::make_tuple(name, type) );
2078 }
2079 
2080 std::pair<SwFrameFormats::ByTypeAndName::const_iterator, SwFrameFormats::ByTypeAndName::const_iterator>
2081 SwFrameFormats::findRangeByName( const OUString& rName ) const
2082 {
2083  auto it = m_TypeAndNameIndex.lower_bound( boost::make_tuple(rName, sal_uInt16(0)) );
2084  auto itEnd = m_TypeAndNameIndex.upper_bound( boost::make_tuple(rName, SAL_MAX_UINT16) );
2085  return { it, itEnd };
2086 }
2087 
2088 SwFrameFormat* SwFrameFormats::FindFormatByName( const OUString& rName ) const
2089 {
2090  auto it = m_TypeAndNameIndex.lower_bound( boost::make_tuple(rName, sal_uInt16(0)) );
2091  if (it != m_TypeAndNameIndex.end() && (*it)->GetName() == rName)
2092  return *it;
2093  return nullptr;
2094 }
2095 
2096 void SwFrameFormats::DeleteAndDestroyAll( bool keepDefault )
2097 {
2098  if ( empty() )
2099  return;
2100  const int _offset = keepDefault ? 1 : 0;
2101  for( const_iterator it = begin() + _offset; it != end(); ++it )
2102  delete *it;
2103  if ( _offset )
2104  m_PosIndex.erase( begin() + _offset, end() );
2105  else
2106  m_Array.clear();
2107 }
2108 
2109 std::pair<SwFrameFormats::const_iterator,bool> SwFrameFormats::push_back( const value_type& x )
2110 {
2111  SAL_WARN_IF(x->m_ffList != nullptr, "sw.core", "Inserting already assigned item");
2112  assert(x->m_ffList == nullptr);
2113  x->m_ffList = this;
2114  return m_PosIndex.push_back( x );
2115 }
2116 
2118 {
2119  const_iterator const ret = find( x );
2120  SAL_WARN_IF(x->m_ffList != this, "sw.core", "Removing invalid / unassigned item");
2121  if (ret != end()) {
2122  assert( x == *ret );
2123  m_PosIndex.erase( ret );
2124  x->m_ffList = nullptr;
2125  return true;
2126  }
2127  return false;
2128 }
2129 
2131 {
2132  erase( begin() + index_ );
2133 }
2134 
2135 void SwFrameFormats::erase( const_iterator const& position )
2136 {
2137  (*position)->m_ffList = nullptr;
2138  m_PosIndex.erase( begin() + (position - begin()) );
2139 }
2140 
2142 {
2143  return (x.m_ffList == this);
2144 }
2145 
2146 bool SwFrameFormats::IsAlive(SwFrameFormat const*const p) const
2147 {
2148  return find(const_cast<SwFrameFormat*>(p)) != end();
2149 }
2150 
2152 {
2153  std::pair<iterator,bool> res = m_PosIndex.push_front( x );
2154  if( ! res.second )
2155  newDefault( res.first );
2156  return res.second;
2157 }
2158 
2160 {
2161  if (position == begin())
2162  return;
2163  m_PosIndex.relocate( begin(), position );
2164 }
2165 
2166 /* 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:799
SwTextFormatColl * MakeTextFormatColl(const OUString &rFormatName, SwTextFormatColl *pDerivedFrom, bool bBroadcast=false)
Create the FormatCollections.
Definition: docfmt.cxx:877
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:74
tools::Long GetFirstLineIndent() const
SwPageDescs m_PageDescs
Definition: doc.hxx:198
bool erase(const value_type &x)
Definition: docfmt.cxx:2117
void EnsureNumberFormatter()
Definition: docfmt.cxx:1724
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:1113
SwTableLineFormat * MakeTableLineFormat()
Definition: docfmt.cxx:1716
sal_Int32 nCommandType
Definition: swdbdata.hxx:32
void Add(SwClient *pDepend)
Definition: calbck.cxx:173
int GetAssignedOutlineStyleLevel() const
Definition: fmtcol.cxx:599
Represents the style of a paragraph.
Definition: fmtcol.hxx:56
static bool lcl_SetNewDefTabStops(SwTwips nOldWidth, SwTwips nNewWidth, SvxTabStopItem &rChgTabStop)
Definition: docfmt.cxx:502
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:435
size_t size() const
Definition: pagedesc.hxx:442
bool isCHRATR(const sal_uInt16 nWhich)
Definition: hintids.hxx:472
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:2109
SwCharFormat * MakeCharFormat(const OUString &rFormatName, SwCharFormat *pDerivedFrom, bool bBroadcast=false)
Definition: docfmt.cxx:843
bool Set(const SfxItemSet &, bool bDeep=true)
const OUString & GetText() const
Definition: ndtxt.hxx:215
virtual const SwRootFrame * GetCurrentLayout() const =0
static constexpr auto Items
const SwFormatHeader & GetHeader(bool=true) const
Definition: fmthdft.hxx:97
constexpr TypedWhichId< SwFormatHeader > RES_HEADER(96)
static bool lcl_RstTextAttr(const SwNodePtr &rpNd, void *pArgs)
pArgs contains the document's ChrFormatTable Is need for selections at the beginning/end and with no ...
virtual bool SetAttr(const SfxPoolItem &) override
overriding to handle change of certain paragraph attributes
Definition: ndtxt.cxx:4856
std::pair< sal_uInt16, sal_uInt16 > WhichPair
bool isFRMATR(const sal_uInt16 nWhich)
Definition: hintids.hxx:496
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:484
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:2067
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:809
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:1595
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)
TElementType * Next()
Definition: calbck.hxx:333
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:1149
constexpr TypedWhichId< SvxFormatBreakItem > RES_BREAK(94)
SwNode & GetNode() const
Definition: ndindex.hxx:119
bool isDrawingLayerAttribute(const sal_uInt16 nWhich)
Definition: hintids.hxx:500
const OUString & GetName() const
Definition: numrule.hxx:225
void RenameFormat(SwFormat &rFormat, const OUString &sNewName, bool bBroadcast=false)
Definition: docfmt.cxx:1893
Content, content of frame (header, footer, fly).
Definition: fmtcntnt.hxx:31
bool AreListLevelIndentsApplicable() const
Determines, if the list level indent attributes can be applied to the paragraph.
Definition: ndtxt.cxx:4397
constexpr TypedWhichId< SwConditionTextFormatColl > RES_CONDTXTFMTCOLL(160)
SwGrfFormatColl * MakeGrfFormatColl(const OUString &rFormatName, SwGrfFormatColl *pDerivedFrom)
Definition: docfmt.cxx:937
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:1716
SwDrawFrameFormat * MakeDrawFrameFormat(const OUString &rFormatName, SwFrameFormat *pDerivedFrom)
Definition: docfmt.cxx:749
std::vector< SwTextFormatColl * >::const_iterator const_iterator
Definition: docary.hxx:66
SwFormat * MakeFrameFormat_(const OUString &, SwFormat *, bool, bool)
Definition: docfmt.cxx:834
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:197
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:176
int GetActualListLevel() const
Returns the actual list level of this text node, when it is a list item.
Definition: ndtxt.cxx:4087
const SwFrameFormats * GetSpzFrameFormats() const
Definition: doc.hxx:744
SwFrameFormatsBase::value_type value_type
void ReplaceStyles(const SwDoc &rSource, bool bIncludePageStyles=true)
Definition: docfmt.cxx:1548
ByTypeAndName & m_TypeAndNameIndex
void SetFollow(const SwPageDesc *pNew)
Definition: pagedesc.hxx:314
SwFrameFormat * FindFrameFormatByName(const OUString &rName) const
Definition: docfmt.cxx:734
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:740
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:2146
static bool lcl_SetTextFormatColl(const SwNodePtr &rpNode, void *pArgs)
Definition: docfmt.cxx:992
void DelTableFrameFormat(SwTableFormat *pFormat)
Definition: docfmt.cxx:726
void DelCharFormat(size_t nFormat, bool bBroadcast=false)
Delete the formats.
Definition: docfmt.cxx:659
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:114
const SwCharFormat * GetDfltCharFormat() const
Definition: doc.hxx:753
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:504
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:1072
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:451
void SetNextTextFormatColl(SwTextFormatColl &rNext)
Inline implementations.
Definition: fmtcol.hxx:257
SwFormat * MakeCharFormat_(const OUString &, SwFormat *, bool, bool)
Definition: docfmt.cxx:867
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:653
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:2560
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:1810
SwTextFormatColl * CopyTextColl(const SwTextFormatColl &rColl)
copy TextNodes
Definition: docfmt.cxx:1164
void SetPoolHlpFileId(sal_uInt8 const nId)
Definition: pagedesc.hxx:280
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:2062
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:1654
void DelTextFormatColl(size_t nFormat, bool bBroadcast=false)
Definition: docfmt.cxx:948
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:2401
std::pair< ByTypeAndName::const_iterator, ByTypeAndName::const_iterator > findRangeByName(const OUString &name) const
Definition: docfmt.cxx:2081
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:58
::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:1937
T & StaticWhichCast(TypedWhichId< T > nId)
static void SetTextFormatCollNext(SwTextFormatColl *pTextColl, const SwTextFormatColl *pDel)
Definition: docfmt.cxx:87
void ForEach(FnForEach_SwNodes fnForEach, void *pArgs=nullptr)
Definition: ndarr.hxx:143
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:901
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:2055
::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:325
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:1993
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
::rtl::Reference< Content > pContent
size_t size() const
Definition: docary.hxx:88
void UnlockModify()
Definition: calbck.hxx:204
void dumpAsXml(xmlTextWriterPtr pWriter) const
Definition: fldbas.cxx:212
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:2798
void dumpAsXml(xmlTextWriterPtr pWriter) const
Definition: docredln.cxx:740
IDocumentState const & getIDocumentState() const
Definition: doc.cxx:394
void LockModify()
Definition: calbck.hxx:203
ByTypeAndName::const_iterator findByTypeAndName(sal_uInt16 type, const OUString &name) const
Definition: docfmt.cxx:2075
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:1726
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
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
void SetTextFormatCollByAutoFormat(const SwPosition &rPos, sal_uInt16 nPoolId, const SfxItemSet *pSet)
Definition: docfmt.cxx:1762
const SfxPoolItem & GetDefaultItem(sal_uInt16 nWhich) const
SvxNumPositionAndSpaceMode GetPositionAndSpaceMode() const
void Add(const SfxPoolItem *pOldValue, const SfxPoolItem *pNewValue, sal_uLong nNodeIdx)
Definition: rolbck.cxx:1035
std::unique_ptr< SwUndoFormatAttr > ReleaseUndo()
SvNumberFormatter * mpNumberFormatter
Definition: doc.hxx:268
tools::Long SwTwips
Definition: swtypes.hxx:50
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:482
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:488
SwGrfFormatColl * CopyGrfColl(const SwGrfFormatColl &rColl)
copy the graphic nodes
Definition: docfmt.cxx:1232
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:606
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
static bool lcl_RstAttr(const SwNodePtr &rpNd, void *pArgs)
Definition: docfmt.cxx:95
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:1356
const_reverse_iterator rbegin() const
const SwNumFormat & Get(sal_uInt16 i) const
Definition: number.cxx:79
bool IsModifyLocked() const
Definition: calbck.hxx:205
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:527
SwFrameFormat & GetMaster()
Definition: pagedesc.hxx:238
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
SwTableNumFormatMerge(const SwDoc &rSrc, SwDoc &rDest)
Definition: docfmt.cxx:1737
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:1416
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:1629
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:927
virtual bool SetAttr(const SfxPoolItem &)
made virtual
Definition: node.cxx:1559
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:404
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:1156
SwConditionTextFormatColl * MakeCondTextFormatColl(const OUString &rFormatName, SwTextFormatColl *pDerivedFrom, bool bBroadcast=false)
Definition: docfmt.cxx:911
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:1693
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:159
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:2435
size_t GetTableFrameFormatCount(bool bUsed) const
Definition: docfmt.cxx:758
constexpr TypedWhichId< SvxLRSpaceItem > RES_LR_SPACE(91)
Get reference.
Definition: reffld.hxx:65
constexpr sal_uInt16 RES_CHRATR_END(46)
SwFrameFormat & GetTableFrameFormat(size_t nFormat, bool bUsed) const
Definition: docfmt.cxx:775
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:2014
void ChgFormat(SwFormat &rFormat, const SfxItemSet &rSet)
Definition: docfmt.cxx:1861
void DelFrameFormat(SwFrameFormat *pFormat, bool bBroadcast=false)
Definition: docfmt.cxx:686
void CopyFormatArr(const SwFormatsBase &rSourceArr, SwFormatsBase const &rDestArr, FNCopyFormat fnCopyFormat, SwFormat &rDfltFormat)
Definition: docfmt.cxx:1258
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:2141
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:2151
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:2454
virtual const SwRedlineTable & GetRedlineTable() const =0
const SwFrameFormats * GetFrameFormats() const
Definition: doc.hxx:738
NF_EVALDATEFORMAT_FORMAT_INTL
void DeleteAndDestroyAll(bool keepDefault=false)
Definition: docfmt.cxx:2096
bool isBOXATR(const sal_uInt16 nWhich)
Definition: hintids.hxx:508
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:2088
void CopyBookmarks(const SwPaM &rPam, SwPosition &rCpyPam)
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:1708
void dumpAsXml(xmlTextWriterPtr pWriter) const
Definition: docfmt.cxx:1982
const SfxPoolItem * GetCurItem() const
SwTextFormatColl & GetNextTextFormatColl() const
Definition: fmtcol.hxx:102
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:850
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:492
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:870
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:844
typedef void(CALLTYPE *GetFuncDataPtr)(sal_uInt16 &nNo
const SvxNumberType & GetNumType() const
Definition: pagedesc.hxx:202