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>
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>
59#include <svx/swframetypes.hxx>
61
62#include <com/sun/star/embed/XEmbeddedObject.hpp>
63
64using namespace com::sun::star;
65
66static 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::toTwips(1, o3tl::Length::cm);
94 nMinLeft = o3tl::toTwips(2, o3tl::Length::cm);
95 }
96 else if (!utl::ConfigManager::IsFuzzing() && MeasurementSystem::Metric == SvtSysLocale().GetLocaleData().getMeasurementSystemEnum() )
97 {
98 nMinTop = nMinBottom = nMinLeft = nMinRight = o3tl::toTwips(2, o3tl::Length::cm);
99 }
100 else
101 {
102 nMinTop = nMinBottom = o3tl::toTwips(1, o3tl::Length::in); // as in MS Word
103 nMinLeft = nMinRight = o3tl::toTwips(1.25, o3tl::Length::in);
104 }
105
106 // set margins
109
110 aUL.SetUpper( o3tl::narrowing<sal_uInt16>(nMinTop) );
111 aUL.SetLower( o3tl::narrowing<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
132static 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
220namespace
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
239void 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 SwFormatContent &aCnt = rFormatHead.GetHeaderFormat()->GetContent();
272
273 if (!aCnt.GetContentIdx())
274 {
275 const SwFrameFormat& rChgedFrameFormat = getConstFrameFormat(rChged, bLeft, bFirst);
276 rDescFrameFormat.SetFormatAttr( rChgedFrameFormat.GetHeader() );
277 }
278 else
279 {
280 const SwFrameFormat *pRight = rHead.GetHeaderFormat();
281 if (!pRight)
282 return;
283 const SwFormatContent &aRCnt = pRight->GetContent();
284
285 if ((*aRCnt.GetContentIdx() == *aCnt.GetContentIdx()) ||
286 // The ContentIdx is _always_ different when called from
287 // SwDocStyleSheet::SetItemSet, because it deep-copies the
288 // PageDesc. So check if it was previously shared.
289 (bFirst ? rDesc.IsFirstShared() : rDesc.IsHeaderShared()))
290 {
291 SwFrameFormat *pFormat = new SwFrameFormat( GetAttrPool(),
292 bFirst ? "First header" : "Left header",
294 ::lcl_DescSetAttr( *pRight, *pFormat, false );
295 // The section which the right header attribute is pointing
296 // is copied, and the Index to the StartNode is set to
297 // the left or first header attribute.
298 SwNodeIndex aTmp( GetNodes().GetEndOfAutotext() );
300 SwNodeRange aRange( aRCnt.GetContentIdx()->GetNode(), SwNodeOffset(0),
301 *aRCnt.GetContentIdx()->GetNode().EndOfSectionNode() );
302 aTmp = *pSttNd->EndOfSectionNode();
303 GetNodes().Copy_( aRange, aTmp, false );
304 aTmp = *pSttNd;
306 SwPaM const source(aRange.aStart, aRange.aEnd);
307 SwPosition dest(aTmp);
308 sw::CopyBookmarks(source, dest);
309 pFormat->SetFormatAttr( SwFormatContent( pSttNd ) );
310 rDescFrameFormat.SetFormatAttr( SwFormatHeader( pFormat ) );
311 }
312 else
313 ::lcl_DescSetAttr( *pRight,
314 *const_cast<SwFrameFormat*>(rFormatHead.GetHeaderFormat()), false );
315 }
316 }
317 }
318}
319
320void SwDoc::CopyMasterFooter(const SwPageDesc &rChged, const SwFormatFooter &rFoot, SwPageDesc &rDesc, bool bLeft, bool bFirst)
321{
322 assert(bLeft || bFirst);
323 SwFrameFormat& rDescFrameFormat = getFrameFormat(rDesc, bLeft, bFirst);
324 if (bFirst && bLeft)
325 {
326 // special case: always shared with something
327 rDescFrameFormat.SetFormatAttr( rChged.IsFirstShared()
328 ? rDesc.GetLeft().GetFooter()
329 : rDesc.GetFirstMaster().GetFooter());
330 }
331 else if ((bFirst ? rChged.IsFirstShared() : rChged.IsFooterShared())
332 || !rFoot.IsActive())
333 {
334 // Left or first shares the Header with the Master.
335 rDescFrameFormat.SetFormatAttr( rDesc.GetMaster().GetFooter() );
336 }
337 else if ( rFoot.IsActive() )
338 { // Left or first gets its own Footer if the Format does not already have one.
339 // If the Format already has a Footer and it points to the same section as the Right one,
340 // it needs to get an own one.
341 // The content is evidently copied.
342 const SwFormatFooter &rFormatFoot = rDescFrameFormat.GetFooter();
343 if ( !rFormatFoot.IsActive() )
344 {
345 SwFormatFooter aFoot( getIDocumentLayoutAccess().MakeLayoutFormat( RndStdIds::FOOTER, nullptr ) );
346 rDescFrameFormat.SetFormatAttr( aFoot );
347 // Take over additional attributes (margins, borders ...).
348 ::lcl_DescSetAttr( *rFoot.GetFooterFormat(), *aFoot.GetFooterFormat(), false);
349 }
350 else
351 {
352 const SwFormatContent &aLCnt = rFormatFoot.GetFooterFormat()->GetContent();
353 if( !aLCnt.GetContentIdx() )
354 {
355 const SwFrameFormat& rChgedFrameFormat = getConstFrameFormat(rChged, bLeft, bFirst);
356 rDescFrameFormat.SetFormatAttr( rChgedFrameFormat.GetFooter() );
357 }
358 else
359 {
360 const SwFrameFormat *pRight = rFoot.GetFooterFormat();
361 if (!pRight)
362 return;
363 const SwFormatContent &aRCnt = pRight->GetContent();
364
365 if ((*aRCnt.GetContentIdx() == *aLCnt.GetContentIdx()) ||
366 // The ContentIdx is _always_ different when called from
367 // SwDocStyleSheet::SetItemSet, because it deep-copies the
368 // PageDesc. So check if it was previously shared.
369 (bFirst ? rDesc.IsFirstShared() : rDesc.IsFooterShared()))
370 {
371 SwFrameFormat *pFormat = new SwFrameFormat( GetAttrPool(),
372 bFirst ? "First footer" : "Left footer",
374 ::lcl_DescSetAttr( *pRight, *pFormat, false );
375 // The section to which the right footer attribute is pointing
376 // is copied, and the Index to the StartNode is set to
377 // the left footer attribute.
378 SwNodeIndex aTmp( GetNodes().GetEndOfAutotext() );
380 SwNodeRange aRange( aRCnt.GetContentIdx()->GetNode(), SwNodeOffset(0),
381 *aRCnt.GetContentIdx()->GetNode().EndOfSectionNode() );
382 aTmp = *pSttNd->EndOfSectionNode();
383 GetNodes().Copy_( aRange, aTmp, false );
384 aTmp = *pSttNd;
386 SwPaM const source(aRange.aStart, aRange.aEnd);
387 SwPosition dest(aTmp);
388 sw::CopyBookmarks(source, dest);
389 pFormat->SetFormatAttr( SwFormatContent( pSttNd ) );
390 rDescFrameFormat.SetFormatAttr( SwFormatFooter( pFormat ) );
391 }
392 else
393 ::lcl_DescSetAttr( *pRight,
394 *const_cast<SwFrameFormat*>(rFormatFoot.GetFooterFormat()), false );
395 }
396 }
397 }
398}
399
400void SwDoc::ChgPageDesc( size_t i, const SwPageDesc &rChged )
401{
402 assert(i < m_PageDescs.size() && "PageDescs is out of range.");
403
404 SwPageDesc& rDesc = *m_PageDescs[i];
406
407 if (GetIDocumentUndoRedo().DoesUndo())
408 {
409 // Stash header formats as needed.
410 const SwFormatHeader& rLeftHead = rChged.GetLeft().GetHeader();
411 const SwFormatHeader& rFirstMasterHead = rChged.GetFirstMaster().GetHeader();
412 const SwFormatHeader& rFirstLeftHead = rChged.GetFirstLeft().GetHeader();
413 const bool bStashLeftHead = !rDesc.IsHeaderShared() && rChged.IsHeaderShared();
414 const bool bStashFirstMasterHead = !rDesc.IsFirstShared() && rChged.IsFirstShared();
415 const bool bStashFirstLeftHead = (!rDesc.IsHeaderShared() && rChged.IsHeaderShared()) || (!rDesc.IsFirstShared() && rChged.IsFirstShared());
416 if (bStashLeftHead && rLeftHead.GetRegisteredIn() && !rDesc.HasStashedFormat(true, true, false))
417 rDesc.StashFrameFormat(rChged.GetLeft(), true, true, false);
418 if (bStashFirstMasterHead && rFirstMasterHead.GetRegisteredIn() && !rDesc.HasStashedFormat(true, false, true))
419 rDesc.StashFrameFormat(rChged.GetFirstMaster(), true, false, true);
420 if (bStashFirstLeftHead && rFirstLeftHead.GetRegisteredIn() && !rDesc.HasStashedFormat(true, true, true))
421 rDesc.StashFrameFormat(rChged.GetFirstLeft(), true, true, true);
422
423 // Stash footer formats as needed.
424 const SwFormatFooter& rLeftFoot = rChged.GetLeft().GetFooter();
425 const SwFormatFooter& rFirstMasterFoot = rChged.GetFirstMaster().GetFooter();
426 const SwFormatFooter& rFirstLeftFoot = rChged.GetFirstLeft().GetFooter();
427 const bool bStashLeftFoot = !rDesc.IsFooterShared() && rChged.IsFooterShared();
428 const bool bStashFirstMasterFoot = !rDesc.IsFirstShared() && rChged.IsFirstShared();
429 const bool bStashFirstLeftFoot = (!rDesc.IsFooterShared() && rChged.IsFooterShared()) || (!rDesc.IsFirstShared() && rChged.IsFirstShared());
430 if (bStashLeftFoot && rLeftFoot.GetRegisteredIn() && !rDesc.HasStashedFormat(false, true, false))
431 rDesc.StashFrameFormat(rChged.GetLeft(), false, true, false);
432 if (bStashFirstMasterFoot && rFirstMasterFoot.GetRegisteredIn() && !rDesc.HasStashedFormat(false, false, true))
433 rDesc.StashFrameFormat(rChged.GetFirstMaster(), false, false, true);
434 if (bStashFirstLeftFoot && rFirstLeftFoot.GetRegisteredIn() && !rDesc.HasStashedFormat(false, true, true))
435 rDesc.StashFrameFormat(rChged.GetFirstLeft(), false, true, true);
436
437 GetIDocumentUndoRedo().AppendUndo(std::make_unique<SwUndoPageDesc>(rDesc, rChged, this));
438 }
439 else
440 {
441 SwUndoId nBeingUndone(SwUndoId::EMPTY);
442 GetIDocumentUndoRedo().GetFirstRedoInfo(nullptr, &nBeingUndone);
443 if (SwUndoId::HEADER_FOOTER == nBeingUndone)
444 {
445 // The last format change is currently being undone. Remove header/footer and corresponding nodes.
446 auto rDescMasterHeaderFormat = rDesc.GetMaster().GetFormatAttr(RES_HEADER);
447 auto rDescLeftHeaderFormat = rDesc.GetLeft().GetFormatAttr(RES_HEADER);
448 auto rDescFirstLeftHeaderFormat = rDesc.GetFirstLeft().GetFormatAttr(RES_HEADER);
449 auto rDescMasterFooterFormat = rDesc.GetMaster().GetFormatAttr(RES_FOOTER);
450 auto rDescLeftFooterFormat = rDesc.GetLeft().GetFormatAttr(RES_FOOTER);
451 auto rDescFirstLeftFooterFormat = rDesc.GetFirstLeft().GetFormatAttr(RES_FOOTER);
452
453 auto rChgedMasterHeaderFormat = rChged.GetMaster().GetFormatAttr(RES_HEADER);
454 auto rChgedLeftHeaderFormat = rChged.GetLeft().GetFormatAttr(RES_HEADER);
455 auto rChgedFirstLeftHeaderFormat = rChged.GetFirstLeft().GetFormatAttr(RES_HEADER);
456 auto rChgedMasterFooterFormat = rChged.GetMaster().GetFormatAttr(RES_FOOTER);
457 auto rChgedLeftFooterFormat = rChged.GetLeft().GetFormatAttr(RES_FOOTER);
458 auto rChgedFirstLeftFooterFormat = rChged.GetFirstLeft().GetFormatAttr(RES_FOOTER);
459
466
467 auto lDelHFFormat = [this](SwClient* pToRemove, SwFrameFormat* pFormat)
468 {
469 // Code taken from lcl_DelHFFormat
470 pFormat->Remove(pToRemove);
471 SwFormatContent& rCnt = const_cast<SwFormatContent&>(pFormat->GetContent());
472 if (rCnt.GetContentIdx())
473 {
474 SwNode* pNode = nullptr;
475 {
476 SwNodeIndex aIdx(*rCnt.GetContentIdx(), 0);
477 pNode = &aIdx.GetNode();
478 SwNodeOffset nEnd = pNode->EndOfSectionIndex();
479 while (aIdx < nEnd)
480 {
481 if (pNode->IsContentNode() &&
482 static_cast<SwContentNode*>(pNode)->HasWriterListeners())
483 {
485 if (pShell)
486 {
487 pShell->ParkCursor(aIdx);
488 aIdx = nEnd - 1;
489 }
490 }
491 ++aIdx;
492 pNode = &aIdx.GetNode();
493 }
494 }
495 rCnt.SetNewContentIdx(nullptr);
496
497 ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo());
498
499 assert(pNode);
501 }
502 delete pFormat;
503 };
504
505 if (rDescMasterHeaderFormat.GetHeaderFormat() && rDescMasterHeaderFormat != rChgedMasterHeaderFormat)
506 lDelHFFormat(&rDescMasterHeaderFormat, rDescMasterHeaderFormat.GetHeaderFormat());
507 else if (rDescLeftHeaderFormat.GetHeaderFormat() && rDescLeftHeaderFormat != rChgedLeftHeaderFormat)
508 lDelHFFormat(&rDescLeftHeaderFormat, rDescLeftHeaderFormat.GetHeaderFormat());
509 else if (rDescFirstLeftHeaderFormat.GetHeaderFormat() && rDescFirstLeftHeaderFormat != rChgedFirstLeftHeaderFormat)
510 lDelHFFormat(&rDescFirstLeftHeaderFormat, rDescFirstLeftHeaderFormat.GetHeaderFormat());
511
512 else if (rDescMasterFooterFormat.GetFooterFormat() && rDescMasterFooterFormat != rChgedMasterFooterFormat)
513 lDelHFFormat(&rDescMasterFooterFormat, rDescMasterFooterFormat.GetFooterFormat());
514 else if (rDescLeftFooterFormat.GetFooterFormat() && rDescLeftFooterFormat != rChgedLeftFooterFormat)
515 lDelHFFormat(&rDescLeftFooterFormat, rDescLeftFooterFormat.GetFooterFormat());
516 else if (rDescFirstLeftFooterFormat.GetFooterFormat() && rDescFirstLeftFooterFormat != rChgedFirstLeftFooterFormat)
517 lDelHFFormat(&rDescFirstLeftFooterFormat, rDescFirstLeftFooterFormat.GetFooterFormat());
518 }
519 }
520 ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo());
521
522 // Mirror at first if needed.
523 if ( rChged.GetUseOn() == UseOnPage::Mirror )
524 const_cast<SwPageDesc&>(rChged).Mirror();
525 else
526 {
527 // Or else transfer values from Master to Left
529 const_cast<SwPageDesc&>(rChged).GetLeft());
530 }
532 const_cast<SwPageDesc&>(rChged).GetFirstMaster());
533 ::lcl_DescSetAttr(rChged.GetLeft(),
534 const_cast<SwPageDesc&>(rChged).GetFirstLeft());
535
536 // Take over NumType.
537 if( rChged.GetNumType().GetNumberingType() != rDesc.GetNumType().GetNumberingType() )
538 {
539 rDesc.SetNumType( rChged.GetNumType() );
540 // Notify page number fields that NumFormat has changed
543
544 // If the numbering scheme has changed we could have QuoVadis/ErgoSum texts
545 // that refer to a changed page, so we invalidate foot notes.
546 SwFootnoteIdxs& rFootnoteIdxs = GetFootnoteIdxs();
547 for( SwFootnoteIdxs::size_type nPos = 0; nPos < rFootnoteIdxs.size(); ++nPos )
548 {
549 SwTextFootnote *pTextFootnote = rFootnoteIdxs[ nPos ];
550 const SwFormatFootnote &rFootnote = pTextFootnote->GetFootnote();
551 pTextFootnote->SetNumber(rFootnote.GetNumber(), rFootnote.GetNumberRLHidden(), rFootnote.GetNumStr());
552 }
553 }
554
555 // Take over orientation
556 rDesc.SetLandscape( rChged.GetLandscape() );
557
558 // Synch header.
559 const SwFormatHeader& rMasterHead = rChged.GetMaster().GetHeader();
560 rDesc.GetMaster().SetFormatAttr( rMasterHead );
561 const bool bRestoreStashedLeftHead = rDesc.IsHeaderShared() && !rChged.IsHeaderShared();
562 const bool bRestoreStashedFirstMasterHead = rDesc.IsFirstShared() && !rChged.IsFirstShared();
563 const bool bRestoreStashedFirstLeftHead = (rDesc.IsHeaderShared() && !rChged.IsHeaderShared()) || (rDesc.IsFirstShared() && !rChged.IsFirstShared());
564 const SwFrameFormat* pStashedLeftFormat = bRestoreStashedLeftHead ? rChged.GetStashedFrameFormat(true, true, false) : nullptr;
565 const SwFrameFormat* pStashedFirstMasterFormat = bRestoreStashedFirstMasterHead ? rChged.GetStashedFrameFormat(true, false, true) : nullptr;
566 const SwFrameFormat* pStashedFirstLeftFormat = bRestoreStashedFirstLeftHead ? rChged.GetStashedFrameFormat(true, true, true) : nullptr;
567 CopyMasterHeader(rChged, pStashedLeftFormat ? pStashedLeftFormat->GetHeader() : rMasterHead, rDesc, true, false); // Copy left header
568 CopyMasterHeader(rChged, pStashedFirstMasterFormat ? pStashedFirstMasterFormat->GetHeader() : rMasterHead, rDesc, false, true); // Copy first master
569 CopyMasterHeader(rChged, pStashedFirstLeftFormat ? pStashedFirstLeftFormat->GetHeader() : rMasterHead, rDesc, true, true); // Copy first left
570
571 if (pStashedLeftFormat)
572 rDesc.RemoveStashedFormat(true, true, false);
573
574 if (pStashedFirstMasterFormat)
575 rDesc.RemoveStashedFormat(true, false, true);
576
577 if (pStashedFirstLeftFormat)
578 rDesc.RemoveStashedFormat(true, true, true);
579
580 rDesc.ChgHeaderShare( rChged.IsHeaderShared() );
581
582 // Synch Footer.
583 const SwFormatFooter& rMasterFoot = rChged.GetMaster().GetFooter();
584 rDesc.GetMaster().SetFormatAttr( rMasterFoot );
585 const bool bRestoreStashedLeftFoot = rDesc.IsFooterShared() && !rChged.IsFooterShared();
586 const bool bRestoreStashedFirstMasterFoot = rDesc.IsFirstShared() && !rChged.IsFirstShared();
587 const bool bRestoreStashedFirstLeftFoot = (rDesc.IsFooterShared() && !rChged.IsFooterShared()) || (rDesc.IsFirstShared() && !rChged.IsFirstShared());
588 const SwFrameFormat* pStashedLeftFoot = bRestoreStashedLeftFoot ? rChged.GetStashedFrameFormat(false, true, false) : nullptr;
589 const SwFrameFormat* pStashedFirstMasterFoot = bRestoreStashedFirstMasterFoot ? rChged.GetStashedFrameFormat(false, false, true) : nullptr;
590 const SwFrameFormat* pStashedFirstLeftFoot = bRestoreStashedFirstLeftFoot ? rChged.GetStashedFrameFormat(false, true, true) : nullptr;
591 CopyMasterFooter(rChged, pStashedLeftFoot ? pStashedLeftFoot->GetFooter() : rMasterFoot, rDesc, true, false); // Copy left footer
592 CopyMasterFooter(rChged, pStashedFirstMasterFoot ? pStashedFirstMasterFoot->GetFooter() : rMasterFoot, rDesc, false, true); // Copy first master
593 CopyMasterFooter(rChged, pStashedFirstLeftFoot ? pStashedFirstLeftFoot->GetFooter() : rMasterFoot, rDesc, true, true); // Copy first left
594
595 if (pStashedLeftFormat)
596 rDesc.RemoveStashedFormat(false, true, false);
597
598 if (pStashedFirstMasterFoot)
599 rDesc.RemoveStashedFormat(false, false, true);
600
601 if (pStashedFirstLeftFoot)
602 rDesc.RemoveStashedFormat(false, true, true);
603
604 rDesc.ChgFooterShare( rChged.IsFooterShared() );
605 // there is just one first shared flag for both header and footer?
606 rDesc.ChgFirstShare( rChged.IsFirstShared() );
607
608 if ( rDesc.GetName() != rChged.GetName() )
609 rDesc.SetName( rChged.GetName() );
610
611 // A RegisterChange is triggered, if necessary
613
614 // If UseOn or the Follow change, the paragraphs need to know about it.
615 bool bUseOn = false;
616 bool bFollow = false;
617 if (rDesc.GetUseOn() != rChged.GetUseOn())
618 {
619 rDesc.SetUseOn( rChged.GetUseOn() );
620 bUseOn = true;
621 }
622 if (rDesc.GetFollow() != rChged.GetFollow())
623 {
624 if (rChged.GetFollow() == &rChged)
625 {
626 if (rDesc.GetFollow() != &rDesc)
627 {
628 rDesc.SetFollow( &rDesc );
629 bFollow = true;
630 }
631 }
632 else
633 {
634 rDesc.SetFollow( rChged.m_pFollow );
635 bFollow = true;
636 }
637 }
638
639 if ( (bUseOn || bFollow) && pTmpRoot)
640 // Inform layout!
641 {
642 for( auto aLayout : GetAllLayouts() )
643 aLayout->AllCheckPageDescs();
644 }
645
646 // Take over the page attributes.
647 ::lcl_DescSetAttr( rChged.GetMaster(), rDesc.GetMaster() );
648 ::lcl_DescSetAttr( rChged.GetLeft(), rDesc.GetLeft() );
650 ::lcl_DescSetAttr( rChged.GetFirstLeft(), rDesc.GetFirstLeft() );
651
652 // If the FootnoteInfo changes, the pages are triggered.
653 if( !(rDesc.GetFootnoteInfo() == rChged.GetFootnoteInfo()) )
654 {
655 rDesc.SetFootnoteInfo( rChged.GetFootnoteInfo() );
657 rDesc.GetMaster().CallSwClientNotify(aHint);
658 rDesc.GetLeft().CallSwClientNotify(aHint);
659 rDesc.GetFirstMaster().CallSwClientNotify(aHint);
660 rDesc.GetFirstLeft().CallSwClientNotify(aHint);
661 }
663
664 SfxBindings* pBindings =
666 if ( pBindings )
667 {
668 pBindings->Invalidate( SID_ATTR_PAGE_COLUMN );
669 pBindings->Invalidate( SID_ATTR_PAGE );
670 pBindings->Invalidate( SID_ATTR_PAGE_SIZE );
671 pBindings->Invalidate( SID_ATTR_PAGE_ULSPACE );
672 pBindings->Invalidate( SID_ATTR_PAGE_LRSPACE );
673 }
674
675 //h/f of first-left page must not be unique but same as first master or left
676 assert((rDesc.IsFirstShared())
679 assert((rDesc.IsFirstShared())
682}
683
685// #i7983#
687{
688 if (nullptr == pDel)
689 return;
690
691 // mba: test iteration as clients are removed while iteration
692 SwPageDescHint aHint( m_PageDescs[0] );
693 pDel->CallSwClientNotify( aHint );
694
695 bool bHasLayout = getIDocumentLayoutAccess().HasLayout();
696 if ( mpFootnoteInfo->DependsOn( pDel ) )
697 {
698 mpFootnoteInfo->ChgPageDesc( m_PageDescs[0] );
699 if ( bHasLayout )
700 {
701 for( auto aLayout : GetAllLayouts() )
702 aLayout->CheckFootnotePageDescs(false);
703 }
704 }
705 else if ( mpEndNoteInfo->DependsOn( pDel ) )
706 {
707 mpEndNoteInfo->ChgPageDesc( m_PageDescs[0] );
708 if ( bHasLayout )
709 {
710 for( auto aLayout : GetAllLayouts() )
711 aLayout->CheckFootnotePageDescs(true);
712 }
713 }
714
715 for (SwPageDesc* pPageDesc : m_PageDescs)
716 {
717 if (pPageDesc->GetFollow() == pDel)
718 {
719 pPageDesc->SetFollow(nullptr);
720 if( bHasLayout )
721 {
722 for( auto aLayout : GetAllLayouts() )
723 aLayout->AllCheckPageDescs();
724 }
725 }
726 }
727}
728
729void SwDoc::BroadcastStyleOperation(const OUString& rName, SfxStyleFamily eFamily,
730 SfxHintId nOp)
731{
732 if (mpDocShell)
733 {
735
736 if (pPool)
737 {
738 SfxStyleSheetBase* pBase = pPool->Find(rName, eFamily);
739
740 if (pBase != nullptr)
741 pPool->Broadcast(SfxStyleSheetHint( nOp, *pBase ));
742 }
743 }
744}
745
746void SwDoc::DelPageDesc( size_t i, bool bBroadcast )
747{
748 OSL_ENSURE(i < m_PageDescs.size(), "PageDescs is out of range.");
749 OSL_ENSURE( i != 0, "You cannot delete the default Pagedesc.");
750 if ( i == 0 )
751 return;
752
753 SwPageDesc &rDel = *m_PageDescs[i];
754
755 if (bBroadcast)
756 BroadcastStyleOperation(rDel.GetName(), SfxStyleFamily::Page,
757 SfxHintId::StyleSheetErased);
758
759 if (GetIDocumentUndoRedo().DoesUndo())
760 {
762 std::make_unique<SwUndoPageDescDelete>(rDel, this));
763 }
764
765 PreDelPageDesc(&rDel); // #i7983#
766
769}
770
771SwPageDesc* SwDoc::MakePageDesc(const OUString &rName, const SwPageDesc *pCpy,
772 bool bRegardLanguage, bool bBroadcast)
773{
774 SwPageDesc *pNew;
775 if( pCpy )
776 {
777 pNew = new SwPageDesc( *pCpy );
778 pNew->SetName( rName );
779 if( rName != pCpy->GetName() )
780 {
781 pNew->SetPoolFormatId( USHRT_MAX );
782 pNew->SetPoolHelpId( USHRT_MAX );
783 pNew->SetPoolHlpFileId( UCHAR_MAX );
784 }
785 }
786 else
787 {
788 pNew = new SwPageDesc( rName, GetDfltFrameFormat(), this );
789 // Set the default page format.
790 lcl_DefaultPageFormat( USHRT_MAX, pNew->GetMaster(), pNew->GetLeft(), pNew->GetFirstMaster(), pNew->GetFirstLeft() );
791
792 SvxFrameDirection aFrameDirection = bRegardLanguage ?
794 : SvxFrameDirection::Horizontal_LR_TB;
795
796 pNew->GetMaster().SetFormatAttr( SvxFrameDirectionItem(aFrameDirection, RES_FRAMEDIR) );
797 pNew->GetLeft().SetFormatAttr( SvxFrameDirectionItem(aFrameDirection, RES_FRAMEDIR) );
800 }
801
802 std::pair<SwPageDescs::const_iterator, bool> res = m_PageDescs.push_back( pNew );
803 SAL_WARN_IF(!res.second, "sw", "MakePageDesc called with existing name" );
804
805 if (bBroadcast)
806 BroadcastStyleOperation(rName, SfxStyleFamily::Page,
807 SfxHintId::StyleSheetCreated);
808
809 if (GetIDocumentUndoRedo().DoesUndo())
810 {
811 GetIDocumentUndoRedo().AppendUndo(std::make_unique<SwUndoPageDescCreate>(pNew, this));
812 }
813
815 return pNew;
816}
817
818void SwDoc::PrtOLENotify( bool bAll )
819{
820 SwFEShell *pShell = nullptr;
821 {
823 if ( pSh )
824 {
825 for(SwViewShell& rShell : pSh->GetRingContainer())
826 {
827 if(auto pFEShell = dynamic_cast<SwFEShell*>( &rShell))
828 {
829 pShell = pFEShell;
830 break;
831 }
832 }
833 }
834 }
835 if ( !pShell )
836 {
837 // This doesn't make sense without a Shell and thus without a client, because
838 // the communication about size changes is implemented by these components.
839 // Because we don't have a Shell we remember this unfortunate situation
840 // in the document,
841 // which is made up for later on when creating the first Shell.
843 if ( bAll )
844 mbAllOLENotify = true;
845 }
846 else
847 {
848 if ( mbAllOLENotify )
849 bAll = true;
850
852
853 std::unique_ptr<SwOLENodes> pNodes = SwContentNode::CreateOLENodesArray( *GetDfltGrfFormatColl(), !bAll );
854 if ( pNodes )
855 {
856 ::StartProgress( STR_STATSTR_SWGPRTOLENOTIFY,
857 0, pNodes->size(), GetDocShell());
859
860 for( SwOLENodes::size_type i = 0; i < pNodes->size(); ++i )
861 {
863
864 SwOLENode* pOLENd = (*pNodes)[i];
865 pOLENd->SetOLESizeInvalid( false );
866
867 // At first load the Infos and see if it's not already in the exclude list.
869
870 svt::EmbeddedObjectRef& xObj = pOLENd->GetOLEObj().GetObject();
871 if ( xObj.is() )
872 aName = SvGlobalName( xObj->getClassID() );
873 else // Not yet loaded
874 {
875 // TODO/LATER: retrieve ClassID of an unloaded object
876 // aName = ????
877 }
878
879 bool bFound = false;
880 for ( std::vector<SvGlobalName>::size_type j = 0;
881 j < pGlobalOLEExcludeList->size() && !bFound;
882 ++j )
883 {
884 bFound = (*pGlobalOLEExcludeList)[j] == aName;
885 }
886 if ( bFound )
887 continue;
888
889 // We don't know it, so the object has to be loaded.
890 // If it doesn't want to be informed
891 if ( xObj.is() )
892 {
893 pGlobalOLEExcludeList->push_back( aName );
894 }
895 }
896 pNodes.reset();
899 }
900 }
901}
902
903IMPL_LINK_NOARG( SwDoc, DoUpdateModifiedOLE, Timer *, void )
904{
905 SwFEShell* pSh = static_cast<SwFEShell*>(GetEditShell());
906 if( !pSh )
907 return;
908
909 mbOLEPrtNotifyPending = mbAllOLENotify = false;
910
911 std::unique_ptr<SwOLENodes> pNodes = SwContentNode::CreateOLENodesArray( *GetDfltGrfFormatColl(), true );
912 if( !pNodes )
913 return;
914
915 ::StartProgress( STR_STATSTR_SWGPRTOLENOTIFY,
916 0, pNodes->size(), GetDocShell());
917 getIDocumentLayoutAccess().GetCurrentLayout()->StartAllAction();
918 SwUpdateAttr aHint(0,0,0);
919 for( SwOLENodes::size_type i = 0; i < pNodes->size(); ++i )
920 {
921 ::SetProgressState( i, GetDocShell() );
922
923 SwOLENode* pOLENd = (*pNodes)[i];
924 pOLENd->SetOLESizeInvalid( false );
925
926 // We don't know it, so the object has to be loaded.
927 // If it doesn't want to be informed
928 if( pOLENd->GetOLEObj().GetOleRef().is() ) // Broken?
929 {
930 pOLENd->UpdateAttr(aHint);
931 }
932 }
933 getIDocumentLayoutAccess().GetCurrentLayout()->EndAllAction();
934 ::EndProgress( GetDocShell() );
935}
936
937static SwPageDesc* lcl_FindPageDesc( const SwPageDescs *pPageDescs,
938 size_t *pPos, const OUString &rName )
939{
940 SwPageDesc* res = nullptr;
941 SwPageDescs::const_iterator it = pPageDescs->find( rName );
942 if( it != pPageDescs->end() )
943 {
944 res = *it;
945 if( pPos )
946 *pPos = std::distance( pPageDescs->begin(), it );
947 }
948 else if( pPos )
949 *pPos = SIZE_MAX;
950 return res;
951}
952
953SwPageDesc* SwDoc::FindPageDesc( const OUString & rName, size_t* pPos ) const
954{
955 return lcl_FindPageDesc( &m_PageDescs, pPos, rName );
956}
957
958bool SwDoc::ContainsPageDesc( const SwPageDesc *pDesc, size_t* pPos ) const
959{
960 if( pDesc == nullptr )
961 return false;
962 if( !m_PageDescs.contains( const_cast <SwPageDesc*>( pDesc ) ) ) {
963 if( pPos )
964 *pPos = SIZE_MAX;
965 return false;
966 }
967 if( ! pPos )
968 return true;
969
971 &m_PageDescs, pPos, pDesc->GetName() );
972 SAL_WARN_IF( desc != pDesc, "sw", "SwPageDescs container is broken!" );
973 return true;
974}
975
976void SwDoc::DelPageDesc( const OUString & rName, bool bBroadcast )
977{
978 size_t nI;
979
980 if (FindPageDesc(rName, &nI))
981 DelPageDesc(nI, bBroadcast);
982}
983
984void SwDoc::ChgPageDesc( const OUString & rName, const SwPageDesc & rDesc)
985{
986 size_t nI;
987
988 if (FindPageDesc(rName, &nI))
989 ChgPageDesc(nI, rDesc);
990}
991
992/*
993 * The HTML import cannot resist changing the page descriptions, I don't
994 * know why. This function is meant to check the page descriptors for invalid
995 * values.
996 */
998{
999 for ( size_t i = 0; i < GetPageDescCnt(); ++i )
1000 {
1001 SwPageDesc& rDesc = GetPageDesc( i );
1002
1003 SwFrameFormat& rMaster = rDesc.GetMaster();
1004 SwFrameFormat& rLeft = rDesc.GetLeft();
1005
1006 const SwFormatFrameSize& rMasterSize = rMaster.GetFrameSize();
1007 const SwFormatFrameSize& rLeftSize = rLeft.GetFrameSize();
1008
1009 const bool bSetSize = INVALID_TWIPS == rMasterSize.GetWidth() ||
1010 INVALID_TWIPS == rMasterSize.GetHeight() ||
1011 INVALID_TWIPS == rLeftSize.GetWidth() ||
1012 INVALID_TWIPS == rLeftSize.GetHeight();
1013
1014 if ( bSetSize )
1015 lcl_DefaultPageFormat( rDesc.GetPoolFormatId(), rDesc.GetMaster(), rDesc.GetLeft(), rDesc.GetFirstMaster(), rDesc.GetFirstLeft() );
1016 }
1017}
1018
1019void SwDoc::SetDefaultPageMode(bool bSquaredPageMode)
1020{
1021 if( !bSquaredPageMode == !IsSquaredPageMode() )
1022 return;
1023
1024 const SwTextGridItem& rGrid = GetDefault( RES_TEXTGRID );
1025 SwTextGridItem aNewGrid = rGrid;
1026 aNewGrid.SetSquaredMode(bSquaredPageMode);
1027 aNewGrid.Init();
1028 SetDefault(aNewGrid);
1029
1030 for ( size_t i = 0; i < GetPageDescCnt(); ++i )
1031 {
1032 SwPageDesc& rDesc = GetPageDesc( i );
1033
1034 SwFrameFormat& rMaster = rDesc.GetMaster();
1035 SwFrameFormat& rLeft = rDesc.GetLeft();
1036
1038 aGrid.SwitchPaperMode( bSquaredPageMode );
1039 rMaster.SetFormatAttr(aGrid);
1040 rLeft.SetFormatAttr(aGrid);
1041 }
1042}
1043
1045{
1046 const SwTextGridItem& rGrid = GetDefault( RES_TEXTGRID );
1047 return rGrid.IsSquaredMode();
1048}
1049
1050/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void DeleteSection(SwNode *pNode)=0
Delete section containing the node.
virtual SwFieldType * GetSysFieldType(const SwFieldIds eWhich) const =0
virtual const SwRootFrame * GetCurrentLayout() const =0
virtual bool HasLayout() const =0
virtual const SwViewShell * GetCurrentViewShell() const =0
Returns the layout set at the document.
virtual void SetModified()=0
Must be called manually at changes of format.
virtual void AppendUndo(std::unique_ptr< SwUndo > pUndo)=0
Add new Undo action.
virtual bool GetFirstRedoInfo(OUString *const o_pStr, SwUndoId *const o_pId, const SwView *pView=nullptr) const =0
Get Id and comment of first Redo action.
void Invalidate(sal_uInt16 nId)
void Broadcast(const SfxHint &rHint)
SfxBindings * GetBindings() const
SfxDispatcher * GetDispatcher() const
virtual SfxStyleSheetBase * Find(const OUString &, SfxStyleFamily eFam, SfxStyleSearchBits n=SfxStyleSearchBits::All) const
void SetRight(const tools::Long nR, const sal_uInt16 nProp=100)
void SetLeft(const tools::Long nL, const sal_uInt16 nProp=100)
SvxNumType GetNumberingType() const
static Size GetDefaultPaperSize(MapUnit eUnit=MapUnit::MapTwip)
tools::Long GetHeight() const
tools::Long GetWidth() const
void SetSize(const Size &rSize)
void SetLower(const sal_uInt16 nL, const sal_uInt16 nProp=100)
void SetUpper(const sal_uInt16 nU, const sal_uInt16 nProp=100)
const SwModify * GetRegisteredIn() const
Definition: calbck.hxx:164
static std::unique_ptr< SwOLENodes > CreateOLENodesArray(const SwFormatColl &rColl, bool bOnlyWithInvalidSize)
Definition: node.cxx:2068
void UpdateAttr(const SwUpdateAttr &)
Definition: node.cxx:1090
void ParkCursor(const SwNodeIndex &rIdx)
Remove selections and additional cursors of all shells.
Definition: crsrsh.cxx:2881
virtual SfxStyleSheetBasePool * GetStyleSheetPool() override
For Style PI.
Definition: docsh.cxx:1154
Definition: doc.hxx:188
void CheckDefaultPageFormat()
The html import sometimes overwrites the page sizes set in the page descriptions.
Definition: docdesc.cxx:997
SwPageDesc * FindPageDesc(const OUString &rName, size_t *pPos=nullptr) const
Definition: docdesc.cxx:953
bool ContainsPageDesc(const SwPageDesc *pDesc, size_t *pPos) const
Definition: docdesc.cxx:958
SwDocShell * mpDocShell
Definition: doc.hxx:259
void BroadcastStyleOperation(const OUString &rName, SfxStyleFamily eFamily, SfxHintId nOp)
Definition: docdesc.cxx:729
IDocumentState const & getIDocumentState() const
Definition: doc.cxx:394
void PreDelPageDesc(SwPageDesc const *pDel)
All descriptors whose Follow point to the to-be-deleted have to be adapted.
Definition: docdesc.cxx:686
o3tl::sorted_vector< SwRootFrame * > GetAllLayouts()
Definition: doclay.cxx:1668
const SwGrfFormatColl * GetDfltGrfFormatColl() const
Definition: doc.hxx:803
size_t GetPageDescCnt() const
Definition: doc.hxx:879
void SetDefault(const SfxPoolItem &)
Set attribute as new default attribute in current document.
Definition: docfmt.cxx:540
void PrtOLENotify(bool bAll)
Definition: docdesc.cxx:818
SwPageDescs m_PageDescs
Definition: doc.hxx:197
IDocumentContentOperations const & getIDocumentContentOperations() const
Definition: doc.cxx:315
IDocumentUndoRedo & GetIDocumentUndoRedo()
Definition: doc.cxx:144
SwNodes & GetNodes()
Definition: doc.hxx:408
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
Definition: doc.cxx:357
std::unique_ptr< SwFootnoteInfo > mpFootnoteInfo
Definition: doc.hxx:254
SwPageDesc * MakePageDesc(const OUString &rName, const SwPageDesc *pCpy=nullptr, bool bRegardLanguage=true, bool bBroadcast=false)
Definition: docdesc.cxx:771
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
Definition: doc.cxx:405
SwFootnoteIdxs & GetFootnoteIdxs()
Definition: doc.hxx:633
const SfxPoolItem & GetDefault(sal_uInt16 nFormatHint) const
Get the default attribute in this document.
Definition: docfmt.cxx:664
void CopyMasterFooter(const SwPageDesc &rChged, const SwFormatFooter &rFoot, SwPageDesc &pDesc, bool bLeft, bool bFirst)
Definition: docdesc.cxx:320
::sw::DocumentContentOperationsManager const & GetDocumentContentOperationsManager() const
Definition: doc.cxx:325
bool IsSquaredPageMode() const
Definition: docdesc.cxx:1044
void ChgPageDesc(const OUString &rName, const SwPageDesc &)
Definition: docdesc.cxx:984
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1318
void SetDefaultPageMode(bool bSquaredPageMode)
Definition: docdesc.cxx:1019
std::unique_ptr< SwEndNoteInfo > mpEndNoteInfo
Definition: doc.hxx:255
const SwFrameFormat * GetDfltFrameFormat() const
Definition: doc.hxx:746
bool mbAllOLENotify
Definition: doc.hxx:315
void DelPageDesc(const OUString &rName, bool bBroadcast=false)
Definition: docdesc.cxx:976
SwDocShell * GetDocShell()
Definition: doc.hxx:1351
bool mbOLEPrtNotifyPending
TRUE: Printer has changed.
Definition: doc.hxx:313
const SwPageDesc & GetPageDesc(const size_t i) const
Definition: doc.hxx:880
void CopyMasterHeader(const SwPageDesc &rChged, const SwFormatHeader &rHead, SwPageDesc &pDesc, bool bLeft, bool bFirst)
Definition: docdesc.cxx:239
virtual void UpdateFields()
Definition: fldbas.cxx:213
Content, content of frame (header, footer, fly).
Definition: fmtcntnt.hxx:32
void SetNewContentIdx(const SwNodeIndex *pIdx)
Definition: atrfrm.cxx:596
const SwNodeIndex * GetContentIdx() const
Definition: fmtcntnt.hxx:46
Footer, for pageformats Client of FrameFormat describing the footer.
Definition: fmthdft.hxx:65
bool IsActive() const
Definition: fmthdft.hxx:89
const SwFrameFormat * GetFooterFormat() const
Definition: fmthdft.hxx:85
sal_uInt16 GetNumber() const
Definition: fmtftn.hxx:69
const OUString & GetNumStr() const
Definition: fmtftn.hxx:68
sal_uInt16 GetNumberRLHidden() const
Definition: fmtftn.hxx:70
Header, for PageFormats Client of FrameFormat describing the header.
Definition: fmthdft.hxx:34
bool IsActive() const
Definition: fmthdft.hxx:58
const SwFrameFormat * GetHeaderFormat() const
Definition: fmthdft.hxx:54
sal_uInt16 GetPoolFormatId() const
Get and set Pool style IDs.
Definition: format.hxx:163
const SwFormatFrameSize & GetFrameSize(bool=true) const
Definition: fmtfsize.hxx:104
void SetPoolHelpId(sal_uInt16 nId)
Definition: format.hxx:168
void SetPoolFormatId(sal_uInt16 nId)
Definition: format.hxx:164
virtual bool ResetFormatAttr(sal_uInt16 nWhich1, sal_uInt16 nWhich2=0)
Definition: format.cxx:619
const SwFormatFooter & GetFooter(bool=true) const
Definition: fmthdft.hxx:99
sal_uInt16 GetPoolHelpId() const
Get and set Help-IDs for document templates.
Definition: format.hxx:167
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
Definition: format.cxx:386
const SwFormatHeader & GetHeader(bool=true) const
Definition: fmthdft.hxx:97
sal_uInt8 GetPoolHlpFileId() const
Definition: format.hxx:169
void SetPoolHlpFileId(sal_uInt8 nId)
Definition: format.hxx:170
const SfxPoolItem & GetFormatAttr(sal_uInt16 nWhich, bool bInParents=true) const
If bInParents is FALSE, search only in this format for attribute.
Definition: format.cxx:367
virtual bool SetFormatAttr(const SfxPoolItem &rAttr)
Definition: format.cxx:448
const SwFormatContent & GetContent(bool=true) const
Definition: fmtcntnt.hxx:55
Style of a layout element.
Definition: frmfmt.hxx:61
TElementType * First()
Definition: calbck.hxx:356
bool HasWriterListeners() const
Definition: calbck.hxx:202
Marks a node in the document model.
Definition: ndindex.hxx:31
SwNode & GetNode() const
Definition: ndindex.hxx:128
SwNodeIndex aStart
Definition: ndindex.hxx:141
SwNodeIndex aEnd
Definition: ndindex.hxx:142
Base class of the Writer document model elements.
Definition: node.hxx:83
bool IsContentNode() const
Definition: node.hxx:640
SwNodeOffset EndOfSectionIndex() const
Definition: node.hxx:689
const SwEndNode * EndOfSectionNode() const
Definition: node.hxx:694
void Copy_(const SwNodeRange &rRg, const SwNodeIndex &rInsPos, bool bNewFrames=true) const
Definition: ndarr.hxx:175
static SwStartNode * MakeEmptySection(const SwNodeIndex &rIdx, SwStartNodeType=SwNormalStartNode)
Create an empty section of Start- and EndNote.
Definition: nodes.cxx:1887
const SwOLEObj & GetOLEObj() const
Definition: ndole.hxx:115
void SetOLESizeInvalid(bool b)
Definition: ndole.hxx:137
svt::EmbeddedObjectRef & GetObject()
Definition: ndole.cxx:990
css::uno::Reference< css::embed::XEmbeddedObject > const & GetOleRef()
Definition: ndole.cxx:939
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:138
sal_uInt16 GetPoolFormatId() const
Query and set PoolFormat-Id.
Definition: pagedesc.hxx:275
void ChgFooterShare(bool bNew)
Definition: pagedesc.hxx:334
void StashFrameFormat(const SwFrameFormat &rFormat, bool bHeader, bool bLeft, bool bFirst)
Remember original header/footer formats even when they are hidden by "sharing".
Definition: pagedesc.cxx:409
const OUString & GetName() const
Definition: pagedesc.hxx:196
void SetPoolHlpFileId(sal_uInt8 const nId)
Definition: pagedesc.hxx:280
void SetFollow(const SwPageDesc *pNew)
Definition: pagedesc.hxx:314
SwFrameFormat & GetMaster()
Definition: pagedesc.hxx:238
bool IsHeaderShared() const
Definition: pagedesc.hxx:319
const SvxNumberType & GetNumType() const
Definition: pagedesc.hxx:202
void ChgHeaderShare(bool bNew)
Definition: pagedesc.hxx:327
bool IsFirstShared() const
Definition: pagedesc.cxx:396
bool IsFooterShared() const
Definition: pagedesc.hxx:323
SwFrameFormat & GetFirstLeft()
Definition: pagedesc.hxx:241
SwFrameFormat & GetFirstMaster()
Definition: pagedesc.hxx:240
void SetPoolFormatId(sal_uInt16 const nId)
Definition: pagedesc.hxx:276
void SetPoolHelpId(sal_uInt16 const nId)
Definition: pagedesc.hxx:278
bool GetLandscape() const
Definition: pagedesc.hxx:199
bool HasStashedFormat(bool bHeader, bool bLeft, bool bFirst)
Checks if the pagedescriptor has a stashed format according to the parameters or not.
Definition: pagedesc.cxx:473
UseOnPage GetUseOn() const
Definition: pagedesc.hxx:353
void SetNumType(const SvxNumberType &rNew)
Definition: pagedesc.hxx:203
bool SetName(const OUString &rNewName)
Definition: pagedesc.cxx:147
void SetFootnoteInfo(const SwPageFootnoteInfo &rNew)
Definition: pagedesc.hxx:207
SwPageDesc * m_pFollow
Definition: pagedesc.hxx:164
SwFrameFormat & GetLeft()
Definition: pagedesc.hxx:239
void ChgFirstShare(bool bNew)
Definition: pagedesc.cxx:401
const SwPageDesc * GetFollow() const
Definition: pagedesc.hxx:267
const SwPageFootnoteInfo & GetFootnoteInfo() const
Definition: pagedesc.hxx:205
void RemoveStashedFormat(bool bHeader, bool bLeft, bool bFirst)
Gives the feature of removing the stashed format by hand if it is necessary.
Definition: pagedesc.cxx:517
void SetRegisterFormatColl(const SwTextFormatColl *rFormat)
set the style for the grid alignment
Definition: pagedesc.cxx:211
void SetUseOn(UseOnPage eNew)
Same as WriteUseOn(), but the >= HeaderShare part of the bitfield is not modified.
Definition: pagedesc.hxx:341
void SetLandscape(bool bNew)
Definition: pagedesc.hxx:200
const SwFrameFormat * GetStashedFrameFormat(bool bHeader, bool bLeft, bool bFirst) const
Used to restore hidden header/footer formats.
Definition: pagedesc.cxx:445
const SwTextFormatColl * GetRegisterFormatColl() const
retrieve the style for the grid alignment
Definition: pagedesc.cxx:223
std::pair< const_iterator, bool > push_back(const value_type &x)
Definition: pagedesc.cxx:753
const_iterator begin() const
Definition: pagedesc.hxx:455
void erase(const value_type &x)
Definition: pagedesc.cxx:764
size_t size() const
Definition: pagedesc.hxx:442
const_iterator end() const
Definition: pagedesc.hxx:456
ByPos::const_iterator const_iterator
Definition: pagedesc.hxx:431
const_iterator find(const OUString &name) const
Definition: pagedesc.hxx:449
bool contains(const value_type &x) const
Definition: pagedesc.hxx:458
The root element of a Writer document layout.
Definition: rootfrm.hxx:82
void StartAllAction()
Set up Start-/EndAction for all Shells on an as high as possible (Shell section) level.
Definition: pagechg.cxx:1911
void EndAllAction(bool bVirDev=false)
Definition: pagechg.cxx:1923
Starts a section of nodes in the document model.
Definition: node.hxx:314
const SwFormatFootnote & GetFootnote() const
Definition: txatbase.hxx:208
void SetNumber(sal_uInt16 nNumber, sal_uInt16 nNumberRLHidden, const OUString &sNumStr)
Definition: atrftn.cxx:361
void SwitchPaperMode(bool bNew)
Definition: atrfrm.cxx:2451
void SetSquaredMode(bool bNew)
Definition: tgrditem.hxx:106
bool IsSquaredMode() const
Definition: tgrditem.hxx:104
size_type size() const
virtual void CallSwClientNotify(const SfxHint &rHint) const override
Definition: calbck.cxx:325
void CopyFlyInFlyImpl(const SwNodeRange &rRg, SwPaM const *const pCopiedPaM, const SwNodeIndex &rStartIdx, const bool bCopyFlyAtFly=false, SwCopyFlags flags=SwCopyFlags::Default) const
ring_container GetRingContainer()
Definition: ring.hxx:240
static bool IsFuzzing()
#define SID_ATTR_PAGE_COLUMN
Definition: cmdid.h:871
static void lcl_DescSetAttr(const SwFrameFormat &rSource, SwFrameFormat &rDest, const bool bPage=true)
Definition: docdesc.cxx:132
static void lcl_DefaultPageFormat(sal_uInt16 nPoolFormatId, SwFrameFormat &rFormat1, SwFrameFormat &rFormat2, SwFrameFormat &rFormat3, SwFrameFormat &rFormat4)
Definition: docdesc.cxx:66
IMPL_LINK_NOARG(SwDoc, DoUpdateModifiedOLE, Timer *, void)
Definition: docdesc.cxx:903
static SwPageDesc * lcl_FindPageDesc(const SwPageDescs *pPageDescs, size_t *pPos, const OUString &rName)
Definition: docdesc.cxx:937
@ Fixed
Frame cannot be moved in Var-direction.
SvxFrameDirection
SfxHintId
constexpr TypedWhichId< SvxFrameDirectionItem > RES_FRAMEDIR(120)
constexpr TypedWhichId< SwFormatHeader > RES_HEADER(96)
constexpr TypedWhichId< SvxShadowItem > RES_SHADOW(107)
constexpr TypedWhichId< SfxBoolItem > RES_RTL_GUTTER(132)
constexpr TypedWhichId< SwFormatCol > RES_COL(109)
constexpr TypedWhichId< SwTextGridItem > RES_TEXTGRID(115)
constexpr TypedWhichId< SwHeaderAndFooterEatSpacingItem > RES_HEADER_FOOTER_EAT_SPACING(121)
constexpr TypedWhichId< SwFormatFrameSize > RES_FRM_SIZE(89)
constexpr TypedWhichId< SvXMLAttrContainerItem > RES_UNKNOWNATR_CONTAINER(RES_UNKNOWNATR_BEGIN)
constexpr TypedWhichId< SvxULSpaceItem > RES_UL_SPACE(92)
constexpr TypedWhichId< SwFormatFooter > RES_FOOTER(97)
constexpr TypedWhichId< SfxBoolItem > RES_BACKGROUND_FULL_SIZE(131)
constexpr TypedWhichId< SvxPaperBinItem > RES_PAPER_BIN(90)
constexpr TypedWhichId< SvxLRSpaceItem > RES_LR_SPACE(91)
constexpr TypedWhichId< SvxBrushItem > RES_BACKGROUND(105)
std::vector< SvGlobalName > * pGlobalOLEExcludeList
Definition: init.cxx:433
LanguageType GetAppLanguage()
Definition: init.cxx:725
OUString aName
sal_Int64 n
sal_uInt16 nPos
#define SAL_WARN_IF(condition, area, stream)
void StartProgress(TranslateId pMessResId, tools::Long nStartValue, tools::Long nEndValue, SwDocShell *pDocShell)
Definition: mainwn.cxx:52
void EndProgress(SwDocShell const *pDocShell)
Definition: mainwn.cxx:92
void SetProgressState(tools::Long nPosition, SwDocShell const *pDocShell)
Definition: mainwn.cxx:82
int i
constexpr auto toTwips(N number, Length from)
void CopyBookmarks(const SwPaM &rPam, const SwPosition &rCpyPam)
const LocaleDataWrapper & GetLocaleData()
@ SwHeaderStartNode
Definition: ndtyp.hxx:56
@ SwFooterStartNode
Definition: ndtyp.hxx:57
sal_Int16 nId
SvxFrameDirection GetDefaultFrameDirection(LanguageType nLanguage)
Return the AutoCollection by its Id.
Definition: poolfmt.cxx:79
@ RES_POOLPAGE_HTML
HTML.
Definition: poolfmt.hxx:176
Marks a position in the document model.
Definition: pam.hxx:37
SfxStyleFamily
#define INVALID_TWIPS
Definition: swtypes.hxx:54
SwUndoId
Definition: swundo.hxx:30
constexpr sal_uInt16 XATTR_FILL_FIRST(XATTRSET_LINE+1)
constexpr sal_uInt16 XATTR_FILL_LAST(XATTR_FILLUSESLIDEBACKGROUND)