LibreOffice Module sw (master)  1
docdesc.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 <cmdid.h>
21 #include <init.hxx>
22 #include <editeng/lrspitem.hxx>
23 #include <editeng/ulspitem.hxx>
24 #include <editeng/paperinf.hxx>
25 #include <editeng/frmdiritem.hxx>
26 #include <sfx2/bindings.hxx>
27 #include <sfx2/dispatch.hxx>
28 #include <tools/globname.hxx>
29 #include <sal/log.hxx>
30 #include <osl/diagnose.h>
32 #include <fmtfsize.hxx>
33 #include <fmthdft.hxx>
34 #include <fmtcntnt.hxx>
35 #include <ftninfo.hxx>
36 #include <fesh.hxx>
37 #include <ndole.hxx>
38 #include <mdiexp.hxx>
39 #include <doc.hxx>
40 #include <IDocumentUndoRedo.hxx>
43 #include <IDocumentState.hxx>
45 #include <rootfrm.hxx>
46 #include <poolfmt.hxx>
47 #include <docsh.hxx>
48 #include <ftnidx.hxx>
49 #include <fmtftn.hxx>
50 #include <txtftn.hxx>
51 #include <fldbas.hxx>
52 #include <strings.hrc>
53 #include <hints.hxx>
54 #include <SwUndoPageDesc.hxx>
55 #include <pagedeschint.hxx>
56 #include <tgrditem.hxx>
57 #include <unotools/configmgr.hxx>
58 #include <unotools/syslocale.hxx>
59 #include <svx/swframetypes.hxx>
60 #include <o3tl/unit_conversion.hxx>
61 
62 #include <com/sun/star/embed/XEmbeddedObject.hpp>
63 
64 using namespace com::sun::star;
65 
66 static void lcl_DefaultPageFormat( sal_uInt16 nPoolFormatId,
67  SwFrameFormat &rFormat1,
68  SwFrameFormat &rFormat2,
69  SwFrameFormat &rFormat3,
70  SwFrameFormat &rFormat4)
71 {
72  // --> #i41075# Printer on demand
73  // This function does not require a printer anymore.
74  // The default page size is obtained from the application
75  //locale
76 
78  const Size aPhysSize = SvxPaperInfo::GetDefaultPaperSize();
79  aFrameSize.SetSize( aPhysSize );
80 
81  // Prepare for default margins.
82  // Margins have a default minimum size.
83  // If the printer forces a larger margins, that's ok too.
84  // The HTML page desc had A4 as page size always.
85  // This has been changed to take the page size from the printer.
86  // Unfortunately, the margins of the HTML page desc are smaller than
87  // the margins used here in general, so one extra case is required.
88  // In the long term, this needs to be changed to always keep the
89  // margins from the page desc.
90  sal_Int32 nMinTop, nMinBottom, nMinLeft, nMinRight;
91  if( RES_POOLPAGE_HTML == nPoolFormatId )
92  {
93  nMinRight = nMinTop = nMinBottom = o3tl::convert(1, o3tl::Length::cm, o3tl::Length::twip);
95  }
96  else if (!utl::ConfigManager::IsFuzzing() && MeasurementSystem::Metric == SvtSysLocale().GetLocaleData().getMeasurementSystemEnum() )
97  {
98  nMinTop = nMinBottom = nMinLeft = nMinRight = 1134; // 2 centimeters
99  }
100  else
101  {
102  nMinTop = nMinBottom = 1440; // as in MS Word: 1 Inch
103  nMinLeft = nMinRight = 1800; // 1,25 Inch
104  }
105 
106  // set margins
109 
110  aUL.SetUpper( static_cast<sal_uInt16>(nMinTop) );
111  aUL.SetLower( static_cast<sal_uInt16>(nMinBottom) );
112  aLR.SetRight( nMinRight );
113  aLR.SetLeft( nMinLeft );
114 
115  rFormat1.SetFormatAttr( aFrameSize );
116  rFormat1.SetFormatAttr( aLR );
117  rFormat1.SetFormatAttr( aUL );
118 
119  rFormat2.SetFormatAttr( aFrameSize );
120  rFormat2.SetFormatAttr( aLR );
121  rFormat2.SetFormatAttr( aUL );
122 
123  rFormat3.SetFormatAttr( aFrameSize );
124  rFormat3.SetFormatAttr( aLR );
125  rFormat3.SetFormatAttr( aUL );
126 
127  rFormat4.SetFormatAttr( aFrameSize );
128  rFormat4.SetFormatAttr( aLR );
129  rFormat4.SetFormatAttr( aUL );
130 }
131 
132 static void lcl_DescSetAttr( const SwFrameFormat &rSource, SwFrameFormat &rDest,
133  const bool bPage = true )
134 {
135  // We should actually use ItemSet's Intersect here, but that doesn't work
136  // correctly if we have different WhichRanges.
137 
138  // Take over the attributes which are of interest.
139  sal_uInt16 const aIdArr[] = {
140  RES_FRM_SIZE, RES_UL_SPACE, // [83..86
141  RES_BACKGROUND, RES_SHADOW, // [99..101
142  RES_COL, RES_COL, // [103
143  RES_TEXTGRID, RES_TEXTGRID, // [109
144  RES_FRAMEDIR, RES_FRAMEDIR, // [114
149 
150  // take over DrawingLayer FillStyles
152 
153  0};
154 
155  const SfxPoolItem* pItem;
156  for( sal_uInt16 n = 0; aIdArr[ n ]; n += 2 )
157  {
158  for( sal_uInt16 nId = aIdArr[ n ]; nId <= aIdArr[ n+1]; ++nId )
159  {
160  // #i45539#
161  // bPage == true:
162  // All in aIdArr except from RES_HEADER_FOOTER_EAT_SPACING
163  // bPage == false:
164  // All in aIdArr except from RES_COL and RES_PAPER_BIN:
165  bool bExecuteId(true);
166 
167  if(bPage)
168  {
169  // When Page
170  switch(nId)
171  {
172  // All in aIdArr except from RES_HEADER_FOOTER_EAT_SPACING
174  // take out SvxBrushItem; it's the result of the fallback
175  // at SwFormat::GetItemState and not really in state SfxItemState::SET
176  case RES_BACKGROUND:
177  bExecuteId = false;
178  break;
179  default:
180  break;
181  }
182  }
183  else
184  {
185  // When not Page
186  switch(nId)
187  {
188  // When not Page: All in aIdArr except these:
189  case RES_COL:
190  case RES_PAPER_BIN:
192  case RES_RTL_GUTTER:
193  bExecuteId = false;
194  break;
195  default:
196  break;
197  }
198  }
199 
200  if(bExecuteId)
201  {
202  if (SfxItemState::SET == rSource.GetItemState(nId, false, &pItem))
203  {
204  rDest.SetFormatAttr(*pItem);
205  }
206  else
207  {
208  rDest.ResetFormatAttr(nId);
209  }
210  }
211  }
212  }
213 
214  // Transmit pool and help IDs too
215  rDest.SetPoolFormatId( rSource.GetPoolFormatId() );
216  rDest.SetPoolHelpId( rSource.GetPoolHelpId() );
217  rDest.SetPoolHlpFileId( rSource.GetPoolHlpFileId() );
218 }
219 
220 namespace
221 {
222  SwFrameFormat& getFrameFormat(SwPageDesc &rDesc, bool bLeft, bool bFirst)
223  {
224  if (bFirst)
225  {
226  if (bLeft)
227  return rDesc.GetFirstLeft();
228  return rDesc.GetFirstMaster();
229  }
230  return rDesc.GetLeft();
231  }
232 
233  const SwFrameFormat& getConstFrameFormat(const SwPageDesc &rDesc, bool bLeft, bool bFirst)
234  {
235  return getFrameFormat(const_cast<SwPageDesc&>(rDesc), bLeft, bFirst);
236  }
237 }
238 
239 void SwDoc::CopyMasterHeader(const SwPageDesc &rChged, const SwFormatHeader &rHead, SwPageDesc &rDesc, bool bLeft, bool bFirst)
240 {
241  assert(bLeft || bFirst);
242  SwFrameFormat& rDescFrameFormat = getFrameFormat(rDesc, bLeft, bFirst);
243  if (bFirst && bLeft)
244  {
245  // special case: always shared with something
246  rDescFrameFormat.SetFormatAttr( rChged.IsFirstShared()
247  ? rDesc.GetLeft().GetHeader()
248  : rDesc.GetFirstMaster().GetHeader());
249  }
250  else if ((bFirst ? rChged.IsFirstShared() : rChged.IsHeaderShared())
251  || !rHead.IsActive())
252  {
253  // Left or first shares the header with the Master.
254  rDescFrameFormat.SetFormatAttr( rDesc.GetMaster().GetHeader() );
255  }
256  else if ( rHead.IsActive() )
257  { // Left or first gets its own header if the Format doesn't already have one.
258  // If it already has one and it points to the same Section as the
259  // Right one, it needs to get an own Header.
260  // The content is evidently copied.
261  const SwFormatHeader &rFormatHead = rDescFrameFormat.GetHeader();
262  if ( !rFormatHead.IsActive() )
263  {
264  SwFormatHeader aHead( getIDocumentLayoutAccess().MakeLayoutFormat( RndStdIds::HEADERL, nullptr ) );
265  rDescFrameFormat.SetFormatAttr( aHead );
266  // take over additional attributes (margins, borders ...)
267  ::lcl_DescSetAttr( *rHead.GetHeaderFormat(), *aHead.GetHeaderFormat(), false);
268  }
269  else
270  {
271  const SwFrameFormat *pRight = rHead.GetHeaderFormat();
272  const SwFormatContent &aRCnt = pRight->GetContent();
273  const SwFormatContent &aCnt = rFormatHead.GetHeaderFormat()->GetContent();
274 
275  if (!aCnt.GetContentIdx())
276  {
277  const SwFrameFormat& rChgedFrameFormat = getConstFrameFormat(rChged, bLeft, bFirst);
278  rDescFrameFormat.SetFormatAttr( rChgedFrameFormat.GetHeader() );
279  }
280  else if ((*aRCnt.GetContentIdx() == *aCnt.GetContentIdx()) ||
281  // The ContentIdx is _always_ different when called from
282  // SwDocStyleSheet::SetItemSet, because it deep-copies the
283  // PageDesc. So check if it was previously shared.
284  (bFirst ? rDesc.IsFirstShared() : rDesc.IsHeaderShared()))
285  {
286  SwFrameFormat *pFormat = new SwFrameFormat( GetAttrPool(),
287  bFirst ? "First header" : "Left header",
288  GetDfltFrameFormat() );
289  ::lcl_DescSetAttr( *pRight, *pFormat, false );
290  // The section which the right header attribute is pointing
291  // is copied, and the Index to the StartNode is set to
292  // the left or first header attribute.
293  SwNodeIndex aTmp( GetNodes().GetEndOfAutotext() );
295  SwNodeRange aRange( aRCnt.GetContentIdx()->GetNode(), 0,
296  *aRCnt.GetContentIdx()->GetNode().EndOfSectionNode() );
297  aTmp = *pSttNd->EndOfSectionNode();
298  GetNodes().Copy_( aRange, aTmp, false );
299  aTmp = *pSttNd;
300  GetDocumentContentOperationsManager().CopyFlyInFlyImpl(aRange, nullptr, aTmp);
301  SwPaM const source(aRange.aStart, aRange.aEnd);
302  SwPosition dest(aTmp);
303  sw::CopyBookmarks(source, dest);
304  pFormat->SetFormatAttr( SwFormatContent( pSttNd ) );
305  rDescFrameFormat.SetFormatAttr( SwFormatHeader( pFormat ) );
306  }
307  else
308  ::lcl_DescSetAttr( *pRight,
309  *const_cast<SwFrameFormat*>(rFormatHead.GetHeaderFormat()), false );
310  }
311  }
312 }
313 
314 void SwDoc::CopyMasterFooter(const SwPageDesc &rChged, const SwFormatFooter &rFoot, SwPageDesc &rDesc, bool bLeft, bool bFirst)
315 {
316  assert(bLeft || bFirst);
317  SwFrameFormat& rDescFrameFormat = getFrameFormat(rDesc, bLeft, bFirst);
318  if (bFirst && bLeft)
319  {
320  // special case: always shared with something
321  rDescFrameFormat.SetFormatAttr( rChged.IsFirstShared()
322  ? rDesc.GetLeft().GetFooter()
323  : rDesc.GetFirstMaster().GetFooter());
324  }
325  else if ((bFirst ? rChged.IsFirstShared() : rChged.IsFooterShared())
326  || !rFoot.IsActive())
327  {
328  // Left or first shares the Header with the Master.
329  rDescFrameFormat.SetFormatAttr( rDesc.GetMaster().GetFooter() );
330  }
331  else if ( rFoot.IsActive() )
332  { // Left or first gets its own Footer if the Format does not already have one.
333  // If the Format already has a Footer and it points to the same section as the Right one,
334  // it needs to get an own one.
335  // The content is evidently copied.
336  const SwFormatFooter &rFormatFoot = rDescFrameFormat.GetFooter();
337  if ( !rFormatFoot.IsActive() )
338  {
339  SwFormatFooter aFoot( getIDocumentLayoutAccess().MakeLayoutFormat( RndStdIds::FOOTER, nullptr ) );
340  rDescFrameFormat.SetFormatAttr( aFoot );
341  // Take over additional attributes (margins, borders ...).
342  ::lcl_DescSetAttr( *rFoot.GetFooterFormat(), *aFoot.GetFooterFormat(), false);
343  }
344  else
345  {
346  const SwFrameFormat *pRight = rFoot.GetFooterFormat();
347  const SwFormatContent &aRCnt = pRight->GetContent();
348  const SwFormatContent &aLCnt = rFormatFoot.GetFooterFormat()->GetContent();
349  if( !aLCnt.GetContentIdx() )
350  {
351  const SwFrameFormat& rChgedFrameFormat = getConstFrameFormat(rChged, bLeft, bFirst);
352  rDescFrameFormat.SetFormatAttr( rChgedFrameFormat.GetFooter() );
353  }
354  else if ((*aRCnt.GetContentIdx() == *aLCnt.GetContentIdx()) ||
355  // The ContentIdx is _always_ different when called from
356  // SwDocStyleSheet::SetItemSet, because it deep-copies the
357  // PageDesc. So check if it was previously shared.
358  (bFirst ? rDesc.IsFirstShared() : rDesc.IsFooterShared()))
359  {
360  SwFrameFormat *pFormat = new SwFrameFormat( GetAttrPool(),
361  bFirst ? "First footer" : "Left footer",
362  GetDfltFrameFormat() );
363  ::lcl_DescSetAttr( *pRight, *pFormat, false );
364  // The section to which the right footer attribute is pointing
365  // is copied, and the Index to the StartNode is set to
366  // the left footer attribute.
367  SwNodeIndex aTmp( GetNodes().GetEndOfAutotext() );
369  SwNodeRange aRange( aRCnt.GetContentIdx()->GetNode(), 0,
370  *aRCnt.GetContentIdx()->GetNode().EndOfSectionNode() );
371  aTmp = *pSttNd->EndOfSectionNode();
372  GetNodes().Copy_( aRange, aTmp, false );
373  aTmp = *pSttNd;
374  GetDocumentContentOperationsManager().CopyFlyInFlyImpl(aRange, nullptr, aTmp);
375  SwPaM const source(aRange.aStart, aRange.aEnd);
376  SwPosition dest(aTmp);
377  sw::CopyBookmarks(source, dest);
378  pFormat->SetFormatAttr( SwFormatContent( pSttNd ) );
379  rDescFrameFormat.SetFormatAttr( SwFormatFooter( pFormat ) );
380  }
381  else
382  ::lcl_DescSetAttr( *pRight,
383  *const_cast<SwFrameFormat*>(rFormatFoot.GetFooterFormat()), false );
384  }
385  }
386 }
387 
388 void SwDoc::ChgPageDesc( size_t i, const SwPageDesc &rChged )
389 {
390  assert(i < m_PageDescs.size() && "PageDescs is out of range.");
391 
392  SwPageDesc& rDesc = *m_PageDescs[i];
393  SwRootFrame* pTmpRoot = getIDocumentLayoutAccess().GetCurrentLayout();
394 
395  if (GetIDocumentUndoRedo().DoesUndo())
396  {
397  // Stash header formats as needed.
398  const SwFormatHeader& rLeftHead = rChged.GetLeft().GetHeader();
399  const SwFormatHeader& rFirstMasterHead = rChged.GetFirstMaster().GetHeader();
400  const SwFormatHeader& rFirstLeftHead = rChged.GetFirstLeft().GetHeader();
401  const bool bStashLeftHead = !rDesc.IsHeaderShared() && rChged.IsHeaderShared();
402  const bool bStashFirstMasterHead = !rDesc.IsFirstShared() && rChged.IsFirstShared();
403  const bool bStashFirstLeftHead = (!rDesc.IsHeaderShared() && rChged.IsHeaderShared()) || (!rDesc.IsFirstShared() && rChged.IsFirstShared());
404  if (bStashLeftHead && rLeftHead.GetRegisteredIn() && !rDesc.HasStashedFormat(true, true, false))
405  rDesc.StashFrameFormat(rChged.GetLeft(), true, true, false);
406  if (bStashFirstMasterHead && rFirstMasterHead.GetRegisteredIn() && !rDesc.HasStashedFormat(true, false, true))
407  rDesc.StashFrameFormat(rChged.GetFirstMaster(), true, false, true);
408  if (bStashFirstLeftHead && rFirstLeftHead.GetRegisteredIn() && !rDesc.HasStashedFormat(true, true, true))
409  rDesc.StashFrameFormat(rChged.GetFirstLeft(), true, true, true);
410 
411  // Stash footer formats as needed.
412  const SwFormatFooter& rLeftFoot = rChged.GetLeft().GetFooter();
413  const SwFormatFooter& rFirstMasterFoot = rChged.GetFirstMaster().GetFooter();
414  const SwFormatFooter& rFirstLeftFoot = rChged.GetFirstLeft().GetFooter();
415  const bool bStashLeftFoot = !rDesc.IsFooterShared() && rChged.IsFooterShared();
416  const bool bStashFirstMasterFoot = !rDesc.IsFirstShared() && rChged.IsFirstShared();
417  const bool bStashFirstLeftFoot = (!rDesc.IsFooterShared() && rChged.IsFooterShared()) || (!rDesc.IsFirstShared() && rChged.IsFirstShared());
418  if (bStashLeftFoot && rLeftFoot.GetRegisteredIn() && !rDesc.HasStashedFormat(false, true, false))
419  rDesc.StashFrameFormat(rChged.GetLeft(), false, true, false);
420  if (bStashFirstMasterFoot && rFirstMasterFoot.GetRegisteredIn() && !rDesc.HasStashedFormat(false, false, true))
421  rDesc.StashFrameFormat(rChged.GetFirstMaster(), false, false, true);
422  if (bStashFirstLeftFoot && rFirstLeftFoot.GetRegisteredIn() && !rDesc.HasStashedFormat(false, true, true))
423  rDesc.StashFrameFormat(rChged.GetFirstLeft(), false, true, true);
424 
425  GetIDocumentUndoRedo().AppendUndo(std::make_unique<SwUndoPageDesc>(rDesc, rChged, this));
426  }
427  ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo());
428 
429  // Mirror at first if needed.
430  if ( rChged.GetUseOn() == UseOnPage::Mirror )
431  const_cast<SwPageDesc&>(rChged).Mirror();
432  else
433  {
434  // Or else transfer values from Master to Left
435  ::lcl_DescSetAttr(rChged.GetMaster(),
436  const_cast<SwPageDesc&>(rChged).GetLeft());
437  }
438  ::lcl_DescSetAttr(rChged.GetMaster(),
439  const_cast<SwPageDesc&>(rChged).GetFirstMaster());
440  ::lcl_DescSetAttr(rChged.GetLeft(),
441  const_cast<SwPageDesc&>(rChged).GetFirstLeft());
442 
443  // Take over NumType.
444  if( rChged.GetNumType().GetNumberingType() != rDesc.GetNumType().GetNumberingType() )
445  {
446  rDesc.SetNumType( rChged.GetNumType() );
447  // Notify page number fields that NumFormat has changed
448  getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::PageNumber )->UpdateFields();
449  getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::RefPageGet )->UpdateFields();
450 
451  // If the numbering scheme has changed we could have QuoVadis/ErgoSum texts
452  // that refer to a changed page, so we invalidate foot notes.
453  SwFootnoteIdxs& rFootnoteIdxs = GetFootnoteIdxs();
454  for( SwFootnoteIdxs::size_type nPos = 0; nPos < rFootnoteIdxs.size(); ++nPos )
455  {
456  SwTextFootnote *pTextFootnote = rFootnoteIdxs[ nPos ];
457  const SwFormatFootnote &rFootnote = pTextFootnote->GetFootnote();
458  pTextFootnote->SetNumber(rFootnote.GetNumber(), rFootnote.GetNumberRLHidden(), rFootnote.GetNumStr());
459  }
460  }
461 
462  // Take over orientation
463  rDesc.SetLandscape( rChged.GetLandscape() );
464 
465  // Synch header.
466  const SwFormatHeader& rMasterHead = rChged.GetMaster().GetHeader();
467  rDesc.GetMaster().SetFormatAttr( rMasterHead );
468  const bool bRestoreStashedLeftHead = rDesc.IsHeaderShared() && !rChged.IsHeaderShared();
469  const bool bRestoreStashedFirstMasterHead = rDesc.IsFirstShared() && !rChged.IsFirstShared();
470  const bool bRestoreStashedFirstLeftHead = (rDesc.IsHeaderShared() && !rChged.IsHeaderShared()) || (rDesc.IsFirstShared() && !rChged.IsFirstShared());
471  const SwFrameFormat* pStashedLeftFormat = bRestoreStashedLeftHead ? rChged.GetStashedFrameFormat(true, true, false) : nullptr;
472  const SwFrameFormat* pStashedFirstMasterFormat = bRestoreStashedFirstMasterHead ? rChged.GetStashedFrameFormat(true, false, true) : nullptr;
473  const SwFrameFormat* pStashedFirstLeftFormat = bRestoreStashedFirstLeftHead ? rChged.GetStashedFrameFormat(true, true, true) : nullptr;
474  CopyMasterHeader(rChged, pStashedLeftFormat ? pStashedLeftFormat->GetHeader() : rMasterHead, rDesc, true, false); // Copy left header
475  CopyMasterHeader(rChged, pStashedFirstMasterFormat ? pStashedFirstMasterFormat->GetHeader() : rMasterHead, rDesc, false, true); // Copy first master
476  CopyMasterHeader(rChged, pStashedFirstLeftFormat ? pStashedFirstLeftFormat->GetHeader() : rMasterHead, rDesc, true, true); // Copy first left
477 
478  if (pStashedLeftFormat)
479  rDesc.RemoveStashedFormat(true, true, false);
480 
481  if (pStashedFirstMasterFormat)
482  rDesc.RemoveStashedFormat(true, false, true);
483 
484  if (pStashedFirstLeftFormat)
485  rDesc.RemoveStashedFormat(true, true, true);
486 
487  rDesc.ChgHeaderShare( rChged.IsHeaderShared() );
488 
489  // Synch Footer.
490  const SwFormatFooter& rMasterFoot = rChged.GetMaster().GetFooter();
491  rDesc.GetMaster().SetFormatAttr( rMasterFoot );
492  const bool bRestoreStashedLeftFoot = rDesc.IsFooterShared() && !rChged.IsFooterShared();
493  const bool bRestoreStashedFirstMasterFoot = rDesc.IsFirstShared() && !rChged.IsFirstShared();
494  const bool bRestoreStashedFirstLeftFoot = (rDesc.IsFooterShared() && !rChged.IsFooterShared()) || (rDesc.IsFirstShared() && !rChged.IsFirstShared());
495  const SwFrameFormat* pStashedLeftFoot = bRestoreStashedLeftFoot ? rChged.GetStashedFrameFormat(false, true, false) : nullptr;
496  const SwFrameFormat* pStashedFirstMasterFoot = bRestoreStashedFirstMasterFoot ? rChged.GetStashedFrameFormat(false, false, true) : nullptr;
497  const SwFrameFormat* pStashedFirstLeftFoot = bRestoreStashedFirstLeftFoot ? rChged.GetStashedFrameFormat(false, true, true) : nullptr;
498  CopyMasterFooter(rChged, pStashedLeftFoot ? pStashedLeftFoot->GetFooter() : rMasterFoot, rDesc, true, false); // Copy left footer
499  CopyMasterFooter(rChged, pStashedFirstMasterFoot ? pStashedFirstMasterFoot->GetFooter() : rMasterFoot, rDesc, false, true); // Copy first master
500  CopyMasterFooter(rChged, pStashedFirstLeftFoot ? pStashedFirstLeftFoot->GetFooter() : rMasterFoot, rDesc, true, true); // Copy first left
501 
502  if (pStashedLeftFormat)
503  rDesc.RemoveStashedFormat(false, true, false);
504 
505  if (pStashedFirstMasterFoot)
506  rDesc.RemoveStashedFormat(false, false, true);
507 
508  if (pStashedFirstLeftFoot)
509  rDesc.RemoveStashedFormat(false, true, true);
510 
511  rDesc.ChgFooterShare( rChged.IsFooterShared() );
512  // there is just one first shared flag for both header and footer?
513  rDesc.ChgFirstShare( rChged.IsFirstShared() );
514 
515  if ( rDesc.GetName() != rChged.GetName() )
516  rDesc.SetName( rChged.GetName() );
517 
518  // A RegisterChange is triggered, if necessary
519  rDesc.SetRegisterFormatColl( rChged.GetRegisterFormatColl() );
520 
521  // If UseOn or the Follow change, the paragraphs need to know about it.
522  bool bUseOn = false;
523  bool bFollow = false;
524  if (rDesc.GetUseOn() != rChged.GetUseOn())
525  {
526  rDesc.SetUseOn( rChged.GetUseOn() );
527  bUseOn = true;
528  }
529  if (rDesc.GetFollow() != rChged.GetFollow())
530  {
531  if (rChged.GetFollow() == &rChged)
532  {
533  if (rDesc.GetFollow() != &rDesc)
534  {
535  rDesc.SetFollow( &rDesc );
536  bFollow = true;
537  }
538  }
539  else
540  {
541  rDesc.SetFollow( rChged.m_pFollow );
542  bFollow = true;
543  }
544  }
545 
546  if ( (bUseOn || bFollow) && pTmpRoot)
547  // Inform layout!
548  {
549  for( auto aLayout : GetAllLayouts() )
550  aLayout->AllCheckPageDescs();
551  }
552 
553  // Take over the page attributes.
554  ::lcl_DescSetAttr( rChged.GetMaster(), rDesc.GetMaster() );
555  ::lcl_DescSetAttr( rChged.GetLeft(), rDesc.GetLeft() );
556  ::lcl_DescSetAttr( rChged.GetFirstMaster(), rDesc.GetFirstMaster() );
557  ::lcl_DescSetAttr( rChged.GetFirstLeft(), rDesc.GetFirstLeft() );
558 
559  // If the FootnoteInfo changes, the pages are triggered.
560  if( !(rDesc.GetFootnoteInfo() == rChged.GetFootnoteInfo()) )
561  {
562  rDesc.SetFootnoteInfo( rChged.GetFootnoteInfo() );
563  sw::PageFootnoteHint aHint;
564  rDesc.GetMaster().CallSwClientNotify(aHint);
565  rDesc.GetLeft().CallSwClientNotify(aHint);
566  rDesc.GetFirstMaster().CallSwClientNotify(aHint);
567  rDesc.GetFirstLeft().CallSwClientNotify(aHint);
568  }
569  getIDocumentState().SetModified();
570 
571  SfxBindings* pBindings =
572  ( GetDocShell() && GetDocShell()->GetDispatcher() ) ? GetDocShell()->GetDispatcher()->GetBindings() : nullptr;
573  if ( pBindings )
574  {
575  pBindings->Invalidate( SID_ATTR_PAGE_COLUMN );
576  pBindings->Invalidate( SID_ATTR_PAGE );
577  pBindings->Invalidate( SID_ATTR_PAGE_SIZE );
578  pBindings->Invalidate( SID_ATTR_PAGE_ULSPACE );
579  pBindings->Invalidate( SID_ATTR_PAGE_LRSPACE );
580  }
581 
582  //h/f of first-left page must not be unique but same as first master or left
583  assert((rDesc.IsFirstShared())
584  ? rDesc.GetFirstLeft().GetHeader().GetHeaderFormat() == rDesc.GetLeft().GetHeader().GetHeaderFormat()
585  : rDesc.GetFirstLeft().GetHeader().GetHeaderFormat() == rDesc.GetFirstMaster().GetHeader().GetHeaderFormat());
586  assert((rDesc.IsFirstShared())
587  ? rDesc.GetFirstLeft().GetFooter().GetFooterFormat() == rDesc.GetLeft().GetFooter().GetFooterFormat()
588  : rDesc.GetFirstLeft().GetFooter().GetFooterFormat() == rDesc.GetFirstMaster().GetFooter().GetFooterFormat());
589 }
590 
592 // #i7983#
594 {
595  if (nullptr == pDel)
596  return;
597 
598  // mba: test iteration as clients are removed while iteration
599  SwPageDescHint aHint( m_PageDescs[0] );
600  pDel->CallSwClientNotify( aHint );
601 
602  bool bHasLayout = getIDocumentLayoutAccess().HasLayout();
603  if ( mpFootnoteInfo->DependsOn( pDel ) )
604  {
605  mpFootnoteInfo->ChgPageDesc( m_PageDescs[0] );
606  if ( bHasLayout )
607  {
608  for( auto aLayout : GetAllLayouts() )
609  aLayout->CheckFootnotePageDescs(false);
610  }
611  }
612  else if ( mpEndNoteInfo->DependsOn( pDel ) )
613  {
614  mpEndNoteInfo->ChgPageDesc( m_PageDescs[0] );
615  if ( bHasLayout )
616  {
617  for( auto aLayout : GetAllLayouts() )
618  aLayout->CheckFootnotePageDescs(true);
619  }
620  }
621 
622  for (SwPageDesc* pPageDesc : m_PageDescs)
623  {
624  if (pPageDesc->GetFollow() == pDel)
625  {
626  pPageDesc->SetFollow(nullptr);
627  if( bHasLayout )
628  {
629  for( auto aLayout : GetAllLayouts() )
630  aLayout->AllCheckPageDescs();
631  }
632  }
633  }
634 }
635 
636 void SwDoc::BroadcastStyleOperation(const OUString& rName, SfxStyleFamily eFamily,
637  SfxHintId nOp)
638 {
639  if (mpDocShell)
640  {
641  SfxStyleSheetBasePool * pPool = mpDocShell->GetStyleSheetPool();
642 
643  if (pPool)
644  {
645  SfxStyleSheetBase* pBase = pPool->Find(rName, eFamily);
646 
647  if (pBase != nullptr)
648  pPool->Broadcast(SfxStyleSheetHint( nOp, *pBase ));
649  }
650  }
651 }
652 
653 void SwDoc::DelPageDesc( size_t i, bool bBroadcast )
654 {
655  OSL_ENSURE(i < m_PageDescs.size(), "PageDescs is out of range.");
656  OSL_ENSURE( i != 0, "You cannot delete the default Pagedesc.");
657  if ( i == 0 )
658  return;
659 
660  SwPageDesc &rDel = *m_PageDescs[i];
661 
662  if (bBroadcast)
663  BroadcastStyleOperation(rDel.GetName(), SfxStyleFamily::Page,
664  SfxHintId::StyleSheetErased);
665 
666  if (GetIDocumentUndoRedo().DoesUndo())
667  {
668  GetIDocumentUndoRedo().AppendUndo(
669  std::make_unique<SwUndoPageDescDelete>(rDel, this));
670  }
671 
672  PreDelPageDesc(&rDel); // #i7983#
673 
674  m_PageDescs.erase(m_PageDescs.begin() + i);
675  getIDocumentState().SetModified();
676 }
677 
678 SwPageDesc* SwDoc::MakePageDesc(const OUString &rName, const SwPageDesc *pCpy,
679  bool bRegardLanguage, bool bBroadcast)
680 {
681  SwPageDesc *pNew;
682  if( pCpy )
683  {
684  pNew = new SwPageDesc( *pCpy );
685  pNew->SetName( rName );
686  if( rName != pCpy->GetName() )
687  {
688  pNew->SetPoolFormatId( USHRT_MAX );
689  pNew->SetPoolHelpId( USHRT_MAX );
690  pNew->SetPoolHlpFileId( UCHAR_MAX );
691  }
692  }
693  else
694  {
695  pNew = new SwPageDesc( rName, GetDfltFrameFormat(), this );
696  // Set the default page format.
697  lcl_DefaultPageFormat( USHRT_MAX, pNew->GetMaster(), pNew->GetLeft(), pNew->GetFirstMaster(), pNew->GetFirstLeft() );
698 
699  SvxFrameDirection aFrameDirection = bRegardLanguage ?
701  : SvxFrameDirection::Horizontal_LR_TB;
702 
703  pNew->GetMaster().SetFormatAttr( SvxFrameDirectionItem(aFrameDirection, RES_FRAMEDIR) );
704  pNew->GetLeft().SetFormatAttr( SvxFrameDirectionItem(aFrameDirection, RES_FRAMEDIR) );
705  pNew->GetFirstMaster().SetFormatAttr( SvxFrameDirectionItem(aFrameDirection, RES_FRAMEDIR) );
706  pNew->GetFirstLeft().SetFormatAttr( SvxFrameDirectionItem(aFrameDirection, RES_FRAMEDIR) );
707  }
708 
709  std::pair<SwPageDescs::const_iterator, bool> res = m_PageDescs.push_back( pNew );
710  SAL_WARN_IF(!res.second, "sw", "MakePageDesc called with existing name" );
711 
712  if (bBroadcast)
713  BroadcastStyleOperation(rName, SfxStyleFamily::Page,
714  SfxHintId::StyleSheetCreated);
715 
716  if (GetIDocumentUndoRedo().DoesUndo())
717  {
718  GetIDocumentUndoRedo().AppendUndo(std::make_unique<SwUndoPageDescCreate>(pNew, this));
719  }
720 
721  getIDocumentState().SetModified();
722  return pNew;
723 }
724 
725 void SwDoc::PrtOLENotify( bool bAll )
726 {
727  SwFEShell *pShell = nullptr;
728  {
729  SwViewShell *pSh = getIDocumentLayoutAccess().GetCurrentViewShell();
730  if ( pSh )
731  {
732  for(SwViewShell& rShell : pSh->GetRingContainer())
733  {
734  if(auto pFEShell = dynamic_cast<SwFEShell*>( &rShell))
735  {
736  pShell = pFEShell;
737  break;
738  }
739  }
740  }
741  }
742  if ( !pShell )
743  {
744  // This doesn't make sense without a Shell and thus without a client, because
745  // the communication about size changes is implemented by these components.
746  // Because we don't have a Shell we remember this unfortunate situation
747  // in the document,
748  // which is made up for later on when creating the first Shell.
749  mbOLEPrtNotifyPending = true;
750  if ( bAll )
751  mbAllOLENotify = true;
752  }
753  else
754  {
755  if ( mbAllOLENotify )
756  bAll = true;
757 
758  mbOLEPrtNotifyPending = mbAllOLENotify = false;
759 
760  std::unique_ptr<SwOLENodes> pNodes = SwContentNode::CreateOLENodesArray( *GetDfltGrfFormatColl(), !bAll );
761  if ( pNodes )
762  {
763  ::StartProgress( STR_STATSTR_SWGPRTOLENOTIFY,
764  0, pNodes->size(), GetDocShell());
765  getIDocumentLayoutAccess().GetCurrentLayout()->StartAllAction();
766 
767  for( SwOLENodes::size_type i = 0; i < pNodes->size(); ++i )
768  {
769  ::SetProgressState( i, GetDocShell() );
770 
771  SwOLENode* pOLENd = (*pNodes)[i];
772  pOLENd->SetOLESizeInvalid( false );
773 
774  // At first load the Infos and see if it's not already in the exclude list.
776 
777  svt::EmbeddedObjectRef& xObj = pOLENd->GetOLEObj().GetObject();
778  if ( xObj.is() )
779  aName = SvGlobalName( xObj->getClassID() );
780  else // Not yet loaded
781  {
782  // TODO/LATER: retrieve ClassID of an unloaded object
783  // aName = ????
784  }
785 
786  bool bFound = false;
787  for ( std::vector<SvGlobalName>::size_type j = 0;
788  j < pGlobalOLEExcludeList->size() && !bFound;
789  ++j )
790  {
791  bFound = (*pGlobalOLEExcludeList)[j] == aName;
792  }
793  if ( bFound )
794  continue;
795 
796  // We don't know it, so the object has to be loaded.
797  // If it doesn't want to be informed
798  if ( xObj.is() )
799  {
800  pGlobalOLEExcludeList->push_back( aName );
801  }
802  }
803  pNodes.reset();
804  getIDocumentLayoutAccess().GetCurrentLayout()->EndAllAction();
805  ::EndProgress( GetDocShell() );
806  }
807  }
808 }
809 
810 IMPL_LINK_NOARG( SwDoc, DoUpdateModifiedOLE, Timer *, void )
811 {
812  SwFEShell* pSh = static_cast<SwFEShell*>(GetEditShell());
813  if( !pSh )
814  return;
815 
816  mbOLEPrtNotifyPending = mbAllOLENotify = false;
817 
818  std::unique_ptr<SwOLENodes> pNodes = SwContentNode::CreateOLENodesArray( *GetDfltGrfFormatColl(), true );
819  if( !pNodes )
820  return;
821 
822  ::StartProgress( STR_STATSTR_SWGPRTOLENOTIFY,
823  0, pNodes->size(), GetDocShell());
824  getIDocumentLayoutAccess().GetCurrentLayout()->StartAllAction();
825  SwUpdateAttr aHint(0,0,0);
826  for( SwOLENodes::size_type i = 0; i < pNodes->size(); ++i )
827  {
828  ::SetProgressState( i, GetDocShell() );
829 
830  SwOLENode* pOLENd = (*pNodes)[i];
831  pOLENd->SetOLESizeInvalid( false );
832 
833  // We don't know it, so the object has to be loaded.
834  // If it doesn't want to be informed
835  if( pOLENd->GetOLEObj().GetOleRef().is() ) // Broken?
836  {
837  pOLENd->UpdateAttr(aHint);
838  }
839  }
840  getIDocumentLayoutAccess().GetCurrentLayout()->EndAllAction();
841  ::EndProgress( GetDocShell() );
842 }
843 
844 static SwPageDesc* lcl_FindPageDesc( const SwPageDescs *pPageDescs,
845  size_t *pPos, const OUString &rName )
846 {
847  SwPageDesc* res = nullptr;
848  SwPageDescs::const_iterator it = pPageDescs->find( rName );
849  if( it != pPageDescs->end() )
850  {
851  res = *it;
852  if( pPos )
853  *pPos = std::distance( pPageDescs->begin(), it );
854  }
855  else if( pPos )
856  *pPos = SIZE_MAX;
857  return res;
858 }
859 
860 SwPageDesc* SwDoc::FindPageDesc( const OUString & rName, size_t* pPos ) const
861 {
862  return lcl_FindPageDesc( &m_PageDescs, pPos, rName );
863 }
864 
865 bool SwDoc::ContainsPageDesc( const SwPageDesc *pDesc, size_t* pPos ) const
866 {
867  if( pDesc == nullptr )
868  return false;
869  if( !m_PageDescs.contains( const_cast <SwPageDesc*>( pDesc ) ) ) {
870  if( pPos )
871  *pPos = SIZE_MAX;
872  return false;
873  }
874  if( ! pPos )
875  return true;
876 
878  &m_PageDescs, pPos, pDesc->GetName() );
879  SAL_WARN_IF( desc != pDesc, "sw", "SwPageDescs container is broken!" );
880  return true;
881 }
882 
883 void SwDoc::DelPageDesc( const OUString & rName, bool bBroadcast )
884 {
885  size_t nI;
886 
887  if (FindPageDesc(rName, &nI))
888  DelPageDesc(nI, bBroadcast);
889 }
890 
891 void SwDoc::ChgPageDesc( const OUString & rName, const SwPageDesc & rDesc)
892 {
893  size_t nI;
894 
895  if (FindPageDesc(rName, &nI))
896  ChgPageDesc(nI, rDesc);
897 }
898 
899 /*
900  * The HTML import cannot resist changing the page descriptions, I don't
901  * know why. This function is meant to check the page descriptors for invalid
902  * values.
903  */
905 {
906  for ( size_t i = 0; i < GetPageDescCnt(); ++i )
907  {
908  SwPageDesc& rDesc = GetPageDesc( i );
909 
910  SwFrameFormat& rMaster = rDesc.GetMaster();
911  SwFrameFormat& rLeft = rDesc.GetLeft();
912 
913  const SwFormatFrameSize& rMasterSize = rMaster.GetFrameSize();
914  const SwFormatFrameSize& rLeftSize = rLeft.GetFrameSize();
915 
916  const bool bSetSize = INVALID_TWIPS == rMasterSize.GetWidth() ||
917  INVALID_TWIPS == rMasterSize.GetHeight() ||
918  INVALID_TWIPS == rLeftSize.GetWidth() ||
919  INVALID_TWIPS == rLeftSize.GetHeight();
920 
921  if ( bSetSize )
922  lcl_DefaultPageFormat( rDesc.GetPoolFormatId(), rDesc.GetMaster(), rDesc.GetLeft(), rDesc.GetFirstMaster(), rDesc.GetFirstLeft() );
923  }
924 }
925 
926 void SwDoc::SetDefaultPageMode(bool bSquaredPageMode)
927 {
928  if( !bSquaredPageMode == !IsSquaredPageMode() )
929  return;
930 
931  const SwTextGridItem& rGrid = GetDefault( RES_TEXTGRID );
932  SwTextGridItem aNewGrid = rGrid;
933  aNewGrid.SetSquaredMode(bSquaredPageMode);
934  aNewGrid.Init();
935  SetDefault(aNewGrid);
936 
937  for ( size_t i = 0; i < GetPageDescCnt(); ++i )
938  {
939  SwPageDesc& rDesc = GetPageDesc( i );
940 
941  SwFrameFormat& rMaster = rDesc.GetMaster();
942  SwFrameFormat& rLeft = rDesc.GetLeft();
943 
944  SwTextGridItem aGrid(rMaster.GetFormatAttr(RES_TEXTGRID));
945  aGrid.SwitchPaperMode( bSquaredPageMode );
946  rMaster.SetFormatAttr(aGrid);
947  rLeft.SetFormatAttr(aGrid);
948  }
949 }
950 
952 {
953  const SwTextGridItem& rGrid = GetDefault( RES_TEXTGRID );
954  return rGrid.IsSquaredMode();
955 }
956 
957 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SvxNumType GetNumberingType() const
const SwEndNode * EndOfSectionNode() const
Definition: node.hxx:686
Starts a section of nodes in the document model.
Definition: node.hxx:312
static void lcl_DescSetAttr(const SwFrameFormat &rSource, SwFrameFormat &rDest, const bool bPage=true)
Definition: docdesc.cxx:132
constexpr TypedWhichId< SvxFrameDirectionItem > RES_FRAMEDIR(120)
tools::Long GetWidth() const
constexpr TypedWhichId< SvXMLAttrContainerItem > RES_UNKNOWNATR_CONTAINER(RES_UNKNOWNATR_BEGIN)
static std::unique_ptr< SwOLENodes > CreateOLENodesArray(const SwFormatColl &rColl, bool bOnlyWithInvalidSize)
Definition: node.cxx:2066
bool ContainsPageDesc(const SwPageDesc *pDesc, size_t *pPos) const
Definition: docdesc.cxx:865
SfxHintId
constexpr TypedWhichId< SwHeaderAndFooterEatSpacingItem > RES_HEADER_FOOTER_EAT_SPACING(121)
void SetRight(const tools::Long nR, const sal_uInt16 nProp=100)
static void lcl_DefaultPageFormat(sal_uInt16 nPoolFormatId, SwFrameFormat &rFormat1, SwFrameFormat &rFormat2, SwFrameFormat &rFormat3, SwFrameFormat &rFormat4)
Definition: docdesc.cxx:66
const_iterator end() const
Definition: pagedesc.hxx:457
Marks a position in the document model.
Definition: pam.hxx:35
const_iterator begin() const
Definition: pagedesc.hxx:456
SwFrameFormat & GetLeft()
Definition: pagedesc.hxx:240
#define SID_ATTR_PAGE_COLUMN
Definition: cmdid.h:860
void SetPoolHelpId(sal_uInt16 nId)
Definition: format.hxx:152
const SwOLEObj & GetOLEObj() const
Definition: ndole.hxx:112
const SwFormatHeader & GetHeader(bool=true) const
Definition: fmthdft.hxx:97
const_iterator find(const OUString &name) const
Definition: pagedesc.hxx:450
void SetPoolHelpId(sal_uInt16 const nId)
Definition: pagedesc.hxx:279
constexpr TypedWhichId< SwFormatCol > RES_COL(109)
void CopyMasterHeader(const SwPageDesc &rChged, const SwFormatHeader &rHead, SwPageDesc &pDesc, bool bLeft, bool bFirst)
Definition: docdesc.cxx:239
void DelPageDesc(const OUString &rName, bool bBroadcast=false)
Definition: docdesc.cxx:883
constexpr TypedWhichId< SwFormatFrameSize > RES_FRM_SIZE(89)
sal_uInt16 char char * pDesc
constexpr TypedWhichId< SvxPaperBinItem > RES_PAPER_BIN(90)
SwFrameFormat & GetFirstMaster()
Definition: pagedesc.hxx:241
css::uno::Reference< css::embed::XEmbeddedObject > const & GetOleRef()
Definition: ndole.cxx:915
sal_Int64 n
Definition: doc.hxx:187
sal_Int16 nId
SwNode & GetNode() const
Definition: ndindex.hxx:119
Content, content of frame (header, footer, fly).
Definition: fmtcntnt.hxx:31
void EndProgress(SwDocShell const *pDocShell)
Definition: mainwn.cxx:92
SvxFrameDirection
void Invalidate(sal_uInt16 nId)
#define INVALID_TWIPS
Definition: swtypes.hxx:52
The root element of a Writer document layout.
Definition: rootfrm.hxx:82
UseOnPage GetUseOn() const
Definition: pagedesc.hxx:354
const OUString & GetName() const
Definition: pagedesc.hxx:197
bool IsActive() const
Definition: fmthdft.hxx:89
std::vector< SvGlobalName > * pGlobalOLEExcludeList
Definition: init.cxx:440
void SetSquaredMode(bool bNew)
Definition: tgrditem.hxx:106
const SwPageFootnoteInfo & GetFootnoteInfo() const
Definition: pagedesc.hxx:206
void StartProgress(const char *pMessResId, tools::Long nStartValue, tools::Long nEndValue, SwDocShell *pDocShell)
Definition: mainwn.cxx:52
void SetPoolFormatId(sal_uInt16 nId)
Definition: format.hxx:148
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
sal_uInt16 GetPoolFormatId() const
Query and set PoolFormat-Id.
Definition: pagedesc.hxx:276
void PrtOLENotify(bool bAll)
Definition: docdesc.cxx:725
ByPos::const_iterator const_iterator
Definition: pagedesc.hxx:432
IMPL_LINK_NOARG(SwDoc, DoUpdateModifiedOLE, Timer *, void)
Definition: docdesc.cxx:810
svt::EmbeddedObjectRef & GetObject()
Definition: ndole.cxx:967
static bool IsFuzzing()
Footer, for pageformats Client of FrameFormat describing the footer.
Definition: fmthdft.hxx:64
constexpr TypedWhichId< SfxBoolItem > RES_RTL_GUTTER(132)
void SetPoolHlpFileId(sal_uInt8 nId)
Definition: format.hxx:154
virtual void SetName(const OUString &rNewName, bool bBroadcast=false) override
Definition: atrfrm.cxx:2471
bool IsSquaredMode() const
Definition: tgrditem.hxx:104
void SetPoolHlpFileId(sal_uInt8 const nId)
Definition: pagedesc.hxx:281
const OUString & GetNumStr() const
Definition: fmtftn.hxx:68
SfxStyleFamily
size_type size() const
sal_uInt16 GetPoolFormatId() const
Get and set Pool style IDs.
Definition: format.hxx:147
constexpr auto convert(N n, sal_Int64 mul, sal_Int64 div)
void SetLower(const sal_uInt16 nL, const sal_uInt16 nProp=100)
SwPageDesc * FindPageDesc(const OUString &rName, size_t *pPos=nullptr) const
Definition: docdesc.cxx:860
static Size GetDefaultPaperSize(MapUnit eUnit=MapUnit::MapTwip)
void SetNumber(sal_uInt16 nNumber, sal_uInt16 nNumberRLHidden, const OUString &sNumStr)
Definition: atrftn.cxx:361
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:136
bool IsHeaderShared() const
Definition: pagedesc.hxx:320
void CheckDefaultPageFormat()
The html import sometimes overwrites the page sizes set in the page descriptions. ...
Definition: docdesc.cxx:904
Style of a layout element.
Definition: frmfmt.hxx:58
SfxBindings * GetBindings() const
constexpr TypedWhichId< SfxBoolItem > RES_BACKGROUND_FULL_SIZE(131)
int i
const SwFrameFormat * GetFooterFormat() const
Definition: fmthdft.hxx:85
const SwFrameFormat * GetStashedFrameFormat(bool bHeader, bool bLeft, bool bFirst) const
Used to restore hidden header/footer formats.
Definition: pagedesc.cxx:445
bool GetLandscape() const
Definition: pagedesc.hxx:200
SwPageDesc * MakePageDesc(const OUString &rName, const SwPageDesc *pCpy=nullptr, bool bRegardLanguage=true, bool bBroadcast=false)
Definition: docdesc.cxx:678
sal_uInt16 GetNumberRLHidden() const
Definition: fmtftn.hxx:70
constexpr sal_uInt16 XATTR_FILL_FIRST(XATTRSET_LINE+1)
sal_uInt8 GetPoolHlpFileId() const
Definition: format.hxx:153
const SwFormatFooter & GetFooter(bool=true) const
Definition: fmthdft.hxx:99
const SwTextFormatColl * GetRegisterFormatColl() const
retrieve the style for the grid alignment
Definition: pagedesc.cxx:224
void ChgPageDesc(const OUString &rName, const SwPageDesc &)
Definition: docdesc.cxx:891
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
Definition: format.cxx:388
Marks a node in the document model.
Definition: ndindex.hxx:31
bool IsFooterShared() const
Definition: pagedesc.hxx:324
ring_container GetRingContainer()
Definition: ring.hxx:240
void CopyMasterFooter(const SwPageDesc &rChged, const SwFormatFooter &rFoot, SwPageDesc &pDesc, bool bLeft, bool bFirst)
Definition: docdesc.cxx:314
void SetPoolFormatId(sal_uInt16 const nId)
Definition: pagedesc.hxx:277
tools::Long GetHeight() const
void SetDefaultPageMode(bool bSquaredPageMode)
Definition: docdesc.cxx:926
const SwFormatFootnote & GetFootnote() const
Definition: txatbase.hxx:204
Frame cannot be moved in Var-direction.
const SwPageDesc * GetFollow() const
Definition: pagedesc.hxx:268
const SwNodeIndex * GetContentIdx() const
Definition: fmtcntnt.hxx:46
virtual bool SetFormatAttr(const SfxPoolItem &rAttr)
Definition: format.cxx:450
void UpdateAttr(const SwUpdateAttr &)
Definition: node.cxx:1099
SwFrameFormat & GetMaster()
Definition: pagedesc.hxx:239
void Broadcast(const SfxHint &rHint)
virtual bool ResetFormatAttr(sal_uInt16 nWhich1, sal_uInt16 nWhich2=0)
Definition: format.cxx:624
constexpr TypedWhichId< SwTextGridItem > RES_TEXTGRID(115)
bool IsSquaredPageMode() const
Definition: docdesc.cxx:951
constexpr TypedWhichId< SvxBrushItem > RES_BACKGROUND(105)
void SetLeft(const tools::Long nL, const sal_uInt16 nProp=100)
sal_uInt16 GetPoolHelpId() const
Get and set Help-IDs for document templates.
Definition: format.hxx:151
#define SAL_WARN_IF(condition, area, stream)
static SwPageDesc * lcl_FindPageDesc(const SwPageDescs *pPageDescs, size_t *pPos, const OUString &rName)
Definition: docdesc.cxx:844
void SwitchPaperMode(bool bNew)
Definition: atrfrm.cxx:2359
const o3tl::enumarray< SvxAdjust, unsigned short > aSvxToUnoAdjust USHRT_MAX
Definition: unosett.cxx:254
SwFrameFormat & GetFirstLeft()
Definition: pagedesc.hxx:242
OUString aName
void SetProgressState(tools::Long nPosition, SwDocShell const *pDocShell)
Definition: mainwn.cxx:82
LanguageType GetAppLanguage()
Definition: init.cxx:732
SwPageDesc * m_pFollow
Definition: pagedesc.hxx:164
const SwModify * GetRegisteredIn() const
Definition: calbck.hxx:159
void SetSize(const Size &rSize)
bool SetName(const OUString &rNewName)
Definition: pagedesc.cxx:148
const SfxPoolItem & GetFormatAttr(sal_uInt16 nWhich, bool bInParents=true) const
If bInParents is FALSE, search only in this format for attribute.
Definition: format.cxx:369
constexpr TypedWhichId< SvxLRSpaceItem > RES_LR_SPACE(91)
Header, for PageFormats Client of FrameFormat describing the header.
Definition: fmthdft.hxx:33
const SwFormatFrameSize & GetFrameSize(bool=true) const
Definition: fmtfsize.hxx:104
const SwFormatContent & GetContent(bool=true) const
Definition: fmtcntnt.hxx:55
virtual void CallSwClientNotify(const SfxHint &rHint) const override
Definition: calbck.cxx:324
SvxFrameDirection GetDefaultFrameDirection(LanguageType nLanguage)
Return the AutoCollection by its Id.
Definition: poolfmt.cxx:79
void SetOLESizeInvalid(bool b)
Definition: ndole.hxx:134
SfxDispatcher * GetDispatcher() const
constexpr sal_uInt16 XATTR_FILL_LAST(XATTR_FILLBACKGROUND)
bool IsFirstShared() const
Definition: pagedesc.cxx:396
bool IsActive() const
Definition: fmthdft.hxx:58
std::vector< SwTextFootnote * >::size_type size_type
void PreDelPageDesc(SwPageDesc const *pDel)
All descriptors whose Follow point to the to-be-deleted have to be adapted.
Definition: docdesc.cxx:593
virtual SfxStyleSheetBase * Find(const OUString &, SfxStyleFamily eFam, SfxStyleSearchBits n=SfxStyleSearchBits::All)
void SetUpper(const sal_uInt16 nU, const sal_uInt16 nProp=100)
sal_uInt16 GetNumber() const
Definition: fmtftn.hxx:69
void CopyBookmarks(const SwPaM &rPam, SwPosition &rCpyPam)
constexpr TypedWhichId< SvxULSpaceItem > RES_UL_SPACE(92)
constexpr TypedWhichId< SvxShadowItem > RES_SHADOW(107)
void BroadcastStyleOperation(const OUString &rName, SfxStyleFamily eFamily, SfxHintId nOp)
Definition: docdesc.cxx:636
static SwPageDesc * FindPageDesc(SwDoc *pDoc, sal_uInt16 nPoolId)
Definition: htmlcss1.cxx:1327
const SwFrameFormat * GetHeaderFormat() const
Definition: fmthdft.hxx:54
sal_uInt16 nPos
const LocaleDataWrapper & GetLocaleData()
static SwStartNode * MakeEmptySection(const SwNodeIndex &rIdx, SwStartNodeType=SwNormalStartNode)
Create an empty section of Start- and EndNote.
Definition: nodes.cxx:1885
const SvxNumberType & GetNumType() const
Definition: pagedesc.hxx:203