LibreOffice Module cui (master) 1
page.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 <memory>
22#include <sfx2/objsh.hxx>
23#include <sfx2/printer.hxx>
24#include <sfx2/viewsh.hxx>
25#include <svl/cjkoptions.hxx>
26#include <svl/ctloptions.hxx>
27#include <svtools/unitconv.hxx>
28#include <vcl/svapp.hxx>
29#include <vcl/weld.hxx>
30#include <sfx2/htmlmode.hxx>
31#include <sal/macros.h>
32#include <osl/diagnose.h>
33
34#include <svx/strings.hrc>
35#include <svx/dialmgr.hxx>
36#include <page.hxx>
37#include <svx/pageitem.hxx>
38#include <editeng/brushitem.hxx>
39#include <editeng/boxitem.hxx>
40#include <editeng/shaditem.hxx>
41#include <editeng/pbinitem.hxx>
42#include <editeng/lrspitem.hxx>
43#include <editeng/ulspitem.hxx>
44#include <editeng/sizeitem.hxx>
46#include <svx/dlgutil.hxx>
47#include <editeng/paperinf.hxx>
48#include <svl/stritem.hxx>
49#include <editeng/eerdll.hxx>
50#include <editeng/editrids.hrc>
51#include <svx/svxids.hrc>
53#include <svl/slstitm.hxx>
54#include <svx/xdef.hxx>
57#include <sal/log.hxx>
58#include <svl/grabbagitem.hxx>
59
60// static ----------------------------------------------------------------
61
62// #i19922# - tdf#126051 see svx/source/dialog/hdft.cxx and sw/source/uibase/sidebar/PageMarginControl.hxx
63constexpr tools::Long MINBODY = o3tl::toTwips(1, o3tl::Length::mm); // 1mm in twips rounded
64
67 SID_ATTR_BORDER_OUTER, SID_ATTR_BORDER_SHADOW,
68 SID_ATTR_LRSPACE, SID_ATTR_PAGE_SHARED,
69 SID_SWREGISTER_COLLECTION, SID_SWREGISTER_MODE>);
70// ------- Mapping page layout ------------------------------------------
71
73{
74 SvxPageUsage::All,
75 SvxPageUsage::Mirror,
76 SvxPageUsage::Right,
77 SvxPageUsage::Left
78};
79
80
81static sal_uInt16 PageUsageToPos_Impl( SvxPageUsage nUsage )
82{
83 for ( size_t i = 0; i < std::size(aArr); ++i )
84 if ( aArr[i] == nUsage )
85 return i;
86 return 3;
87}
88
89
90static SvxPageUsage PosToPageUsage_Impl( sal_uInt16 nPos )
91{
92 if ( nPos >= std::size(aArr) )
93 return SvxPageUsage::NONE;
94 return aArr[nPos];
95}
96
97
98static Size GetMinBorderSpace_Impl( const SvxShadowItem& rShadow, const SvxBoxItem& rBox )
99{
100 Size aSz;
101 aSz.setHeight( rShadow.CalcShadowSpace( SvxShadowItemSide::BOTTOM ) + rBox.CalcLineSpace( SvxBoxItemLine::BOTTOM ) );
102 aSz.AdjustHeight(rShadow.CalcShadowSpace( SvxShadowItemSide::TOP ) + rBox.CalcLineSpace( SvxBoxItemLine::TOP ) );
103 aSz.setWidth( rShadow.CalcShadowSpace( SvxShadowItemSide::LEFT ) + rBox.CalcLineSpace( SvxBoxItemLine::LEFT ) );
104 aSz.AdjustWidth(rShadow.CalcShadowSpace( SvxShadowItemSide::RIGHT ) + rBox.CalcLineSpace( SvxBoxItemLine::RIGHT ) );
105 return aSz;
106}
107
108
110{
111 return OutputDevice::LogicToLogic( nIn, eUnit, MapUnit::MapTwip );
112}
113
114static bool IsEqualSize_Impl( const SvxSizeItem* pSize, const Size& rSize )
115{
116 if ( pSize )
117 {
118 Size aSize = pSize->GetSize();
119 tools::Long nDiffW = std::abs( rSize.Width () - aSize.Width () );
120 tools::Long nDiffH = std::abs( rSize.Height() - aSize.Height() );
121 return ( nDiffW < 10 && nDiffH < 10 );
122 }
123 else
124 return false;
125}
126
127
128#define MARGIN_LEFT ( MarginPosition(0x0001) )
129#define MARGIN_RIGHT ( MarginPosition(0x0002) )
130#define MARGIN_TOP ( MarginPosition(0x0004) )
131#define MARGIN_BOTTOM ( MarginPosition(0x0008) )
132
133// class SvxPageDescPage --------------------------------------------------
134
135std::unique_ptr<SfxTabPage> SvxPageDescPage::Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet )
136{
137 return std::make_unique<SvxPageDescPage>(pPage, pController, *rSet);
138}
139
141 : SfxTabPage(pPage, pController, "cui/ui/pageformatpage.ui", "PageFormatPage", &rAttr)
142 , bLandscape(false)
144 , ePaperStart(PAPER_A3)
145 , m_nPos(0)
146 , mpDefPrinter(nullptr)
147 , mbDelPrinter(false)
148 , mbEnableDrawingLayerFillStyles(false)
149 , m_xPaperSizeBox(new SvxPaperSizeListBox(m_xBuilder->weld_combo_box("comboPageFormat")))
150 , m_xPaperWidthEdit(m_xBuilder->weld_metric_spin_button("spinWidth", FieldUnit::CM))
151 , m_xPaperHeightEdit(m_xBuilder->weld_metric_spin_button("spinHeight", FieldUnit::CM))
152 , m_xPortraitBtn(m_xBuilder->weld_radio_button("radiobuttonPortrait"))
153 , m_xLandscapeBtn(m_xBuilder->weld_radio_button("radiobuttonLandscape"))
154 , m_xTextFlowLbl(m_xBuilder->weld_label("labelTextFlow"))
155 , m_xTextFlowBox(new svx::FrameDirectionListBox(m_xBuilder->weld_combo_box("comboTextFlowBox")))
156 , m_xPaperTrayBox(m_xBuilder->weld_combo_box("comboPaperTray"))
157 , m_xLeftMarginLbl(m_xBuilder->weld_label("labelLeftMargin"))
158 , m_xLeftMarginEdit(m_xBuilder->weld_metric_spin_button("spinMargLeft", FieldUnit::CM))
159 , m_xRightMarginLbl(m_xBuilder->weld_label("labelRightMargin"))
160 , m_xRightMarginEdit(m_xBuilder->weld_metric_spin_button("spinMargRight", FieldUnit::CM))
161 , m_xTopMarginEdit(m_xBuilder->weld_metric_spin_button("spinMargTop", FieldUnit::CM))
162 , m_xBottomMarginEdit(m_xBuilder->weld_metric_spin_button("spinMargBot", FieldUnit::CM))
163 , m_xGutterMarginLbl(m_xBuilder->weld_label("labelGutterMargin"))
164 , m_xGutterMarginEdit(m_xBuilder->weld_metric_spin_button("spinMargGut", FieldUnit::CM))
165 , m_xPageText(m_xBuilder->weld_label("labelPageLayout"))
166 , m_xLayoutBox(m_xBuilder->weld_combo_box("comboPageLayout"))
167 , m_xNumberFormatText(m_xBuilder->weld_label("labelPageNumbers"))
168 , m_xNumberFormatBox(new SvxPageNumberListBox(m_xBuilder->weld_combo_box("comboLayoutFormat")))
169 , m_xTblAlignFT(m_xBuilder->weld_label("labelTblAlign"))
170 , m_xHorzBox(m_xBuilder->weld_check_button("checkbuttonHorz"))
171 , m_xVertBox(m_xBuilder->weld_check_button("checkbuttonVert"))
172 , m_xAdaptBox(m_xBuilder->weld_check_button("checkAdaptBox"))
173 , m_xRegisterCB(m_xBuilder->weld_check_button("checkRegisterTrue"))
174 , m_xRegisterFT(m_xBuilder->weld_label("labelRegisterStyle"))
175 , m_xRegisterLB(m_xBuilder->weld_combo_box("comboRegisterStyle"))
176 , m_xGutterPositionFT(m_xBuilder->weld_label("labelGutterPosition"))
177 , m_xGutterPositionLB(m_xBuilder->weld_combo_box("comboGutterPosition"))
178 , m_xRtlGutterCB(m_xBuilder->weld_check_button("checkRtlGutter"))
179 , m_xBackgroundFullSizeCB(m_xBuilder->weld_check_button("checkBackgroundFullSize"))
180 // Strings stored in UI
181 , m_xInsideLbl(m_xBuilder->weld_label("labelInner"))
182 , m_xOutsideLbl(m_xBuilder->weld_label("labelOuter"))
183 , m_xPrintRangeQueryText(m_xBuilder->weld_label("labelMsg"))
184 , m_xBspWin(new weld::CustomWeld(*m_xBuilder, "drawingareaPageDirection", m_aBspWin))
185{
186 m_xRegisterLB->set_size_request(m_xRegisterLB->get_approximate_digit_width() * 20, -1);
187
188 bBorderModified = false;
189 m_aBspWin.EnableRTL(false);
190
191 // this page needs ExchangeSupport
193
196 bool bWeb = false;
197
198 const SfxUInt16Item* pHtmlModeItem = rAttr.GetItemIfSet(SID_HTML_MODE, false);
199 if (!pHtmlModeItem)
200 {
202 pHtmlModeItem = pShell->GetItem(SID_HTML_MODE);
203 }
204 if (pHtmlModeItem)
205 bWeb = 0 != (pHtmlModeItem->GetValue() & HTMLMODE_ON);
206
207 // fill text flow listbox with valid entries
208
209 m_xTextFlowBox->append(SvxFrameDirection::Horizontal_LR_TB, SvxResId(RID_SVXSTR_PAGEDIR_LTR_HORI));
210
211 if (bCTL)
212 m_xTextFlowBox->append(SvxFrameDirection::Horizontal_RL_TB, SvxResId(RID_SVXSTR_PAGEDIR_RTL_HORI));
213
214
215 // #109989# do not show vertical directions in Writer/Web
216 if( !bWeb && bCJK )
217 {
218 m_xTextFlowBox->append(SvxFrameDirection::Vertical_RL_TB, SvxResId(RID_SVXSTR_PAGEDIR_RTL_VERT));
219 m_xTextFlowBox->append(SvxFrameDirection::Vertical_LR_TB, SvxResId(RID_SVXSTR_PAGEDIR_LTR_VERT));
220 }
221
222 // #109989# show the text direction box in Writer/Web too
223 if( (bCJK || bCTL) &&
224 SfxItemState::UNKNOWN < rAttr.GetItemState(GetWhich( SID_ATTR_FRAMEDIRECTION )))
225 {
226 m_xTextFlowLbl->show();
227 m_xTextFlowBox->show();
228 m_xTextFlowBox->connect_changed(LINK(this, SvxPageDescPage, FrameDirectionModify_Impl));
229
231 }
232 Init_Impl();
233
234 FieldUnit eFUnit = GetModuleFieldUnit( rAttr );
237 SetFieldUnit( *m_xTopMarginEdit, eFUnit );
242
243 if ( SfxViewShell::Current() && SfxViewShell::Current()->GetPrinter() )
244 {
246 }
247 else
248 {
250 mbDelPrinter = true;
251 }
252
253 MapMode aOldMode = mpDefPrinter->GetMapMode();
254 mpDefPrinter->SetMapMode(MapMode(MapUnit::MapTwip));
255
256 // set first- and last-values for the margins
257 Size aPaperSize = mpDefPrinter->GetPaperSize();
258 Size aPrintSize = mpDefPrinter->GetOutputSize();
259
260 /*
261 * To convert a point ( 0,0 ) into logic coordinates
262 * looks like nonsense; but it makes sense when the
263 * coordinate system's origin has been moved.
264 */
265 Point aPrintOffset = mpDefPrinter->GetPageOffset() - mpDefPrinter->PixelToLogic( Point() );
266 mpDefPrinter->SetMapMode( aOldMode );
267
268 nFirstLeftMargin = m_xLeftMarginEdit->convert_value_from(m_xLeftMarginEdit->normalize(aPrintOffset.X()), FieldUnit::TWIP);
269 nFirstRightMargin = m_xRightMarginEdit->convert_value_from(m_xRightMarginEdit->normalize(aPaperSize.Width() - aPrintSize.Width() - aPrintOffset.X()), FieldUnit::TWIP);
270 nFirstTopMargin = m_xTopMarginEdit->convert_value_from(m_xTopMarginEdit->normalize(aPrintOffset.Y() ), FieldUnit::TWIP);
271 nFirstBottomMargin = m_xBottomMarginEdit->convert_value_from(m_xBottomMarginEdit->normalize(aPaperSize.Height() - aPrintSize.Height() - aPrintOffset.Y()), FieldUnit::TWIP );
272 nLastLeftMargin = m_xLeftMarginEdit->convert_value_from(m_xLeftMarginEdit->normalize(aPrintOffset.X() + aPrintSize.Width()), FieldUnit::TWIP);
273 nLastRightMargin = m_xRightMarginEdit->convert_value_from(m_xRightMarginEdit->normalize(aPrintOffset.X() + aPrintSize.Width()), FieldUnit::TWIP);
274 nLastTopMargin = m_xTopMarginEdit->convert_value_from(m_xTopMarginEdit->normalize(aPrintOffset.Y() + aPrintSize.Height()), FieldUnit::TWIP);
275 nLastBottomMargin = m_xBottomMarginEdit->convert_value_from(m_xBottomMarginEdit->normalize(aPrintOffset.Y() + aPrintSize.Height()), FieldUnit::TWIP);
276
277 // #i4219# take Maximum now from configuration (1/100th cm)
278 // was: 11900 -> 119 cm ;new value 3 meters -> 300 cm -> 30000
281
282 // #i4219# also for margins (1/100th cm). Was: 9999, keeping.
287 m_xGutterMarginEdit->set_max(
289 FieldUnit::MM);
290
291 // Get the i18n framework numberings and add them to the listbox.
292 SvxNumOptionsTabPageHelper::GetI18nNumbering(m_xNumberFormatBox->get_widget(), std::numeric_limits<sal_uInt16>::max());
293}
294
296{
297 if(mbDelPrinter)
298 {
300 mbDelPrinter = false;
301 }
302}
303
305{
306 // adjust the handler
307 m_xLayoutBox->connect_changed(LINK(this, SvxPageDescPage, LayoutHdl_Impl));
308 m_xGutterPositionLB->connect_changed(LINK(this, SvxPageDescPage, GutterPositionHdl_Impl));
309
310 m_xPaperSizeBox->connect_changed(LINK(this, SvxPageDescPage, PaperSizeSelect_Impl));
311 m_xPaperWidthEdit->connect_value_changed( LINK(this, SvxPageDescPage, PaperSizeModify_Impl));
312 m_xPaperHeightEdit->connect_value_changed(LINK(this, SvxPageDescPage, PaperSizeModify_Impl));
313 m_xLandscapeBtn->connect_toggled(LINK(this, SvxPageDescPage, SwapOrientation_Impl));
314 m_xPortraitBtn->connect_toggled(LINK(this, SvxPageDescPage, SwapOrientation_Impl));
315
316 Link<weld::MetricSpinButton&, void> aLink = LINK(this, SvxPageDescPage, BorderModify_Impl);
317 m_xLeftMarginEdit->connect_value_changed(aLink);
318 m_xRightMarginEdit->connect_value_changed(aLink);
319 m_xTopMarginEdit->connect_value_changed(aLink);
320 m_xBottomMarginEdit->connect_value_changed(aLink);
321 m_xGutterMarginEdit->connect_value_changed(aLink);
322
323 m_xHorzBox->connect_toggled(LINK(this, SvxPageDescPage, CenterHdl_Impl));
324 m_xVertBox->connect_toggled(LINK(this, SvxPageDescPage, CenterHdl_Impl));
325}
326
328{
329 SfxItemPool* pPool = rSet->GetPool();
330 SAL_WARN_IF(!pPool, "cui.tabpages", "Where is the pool?");
331 MapUnit eUnit = pPool->GetMetric( GetWhich( SID_ATTR_LRSPACE ) );
332
333 // adjust margins (right/left)
334 const SfxPoolItem* pItem = GetItem( *rSet, SID_ATTR_LRSPACE );
335
336 if ( pItem )
337 {
338 const SvxLRSpaceItem& rLRSpace = static_cast<const SvxLRSpaceItem&>(*pItem);
339 SetMetricValue( *m_xLeftMarginEdit, rLRSpace.GetLeft(), eUnit );
342 static_cast<sal_uInt16>(ConvertLong_Impl( rLRSpace.GetLeft(), eUnit )) );
343 SetMetricValue( *m_xRightMarginEdit, rLRSpace.GetRight(), eUnit );
345 static_cast<sal_uInt16>(ConvertLong_Impl( rLRSpace.GetRight(), eUnit )) );
346 }
347
348 // adjust margins (top/bottom)
349 pItem = GetItem( *rSet, SID_ATTR_ULSPACE );
350
351 if ( pItem )
352 {
353 const SvxULSpaceItem& rULSpace = static_cast<const SvxULSpaceItem&>(*pItem);
354 SetMetricValue( *m_xTopMarginEdit, rULSpace.GetUpper(), eUnit );
356 static_cast<sal_uInt16>(ConvertLong_Impl( static_cast<tools::Long>(rULSpace.GetUpper()), eUnit )) );
357 SetMetricValue( *m_xBottomMarginEdit, rULSpace.GetLower(), eUnit );
359 static_cast<sal_uInt16>(ConvertLong_Impl( static_cast<tools::Long>(rULSpace.GetLower()), eUnit )) );
360 }
361
362 if (const SfxGrabBagItem* pGragbagItem = rSet->GetItemIfSet(SID_ATTR_CHAR_GRABBAG))
363 {
364 bool bGutterAtTop{};
365 auto it = pGragbagItem->GetGrabBag().find("GutterAtTop");
366 if (it != pGragbagItem->GetGrabBag().end())
367 {
368 it->second >>= bGutterAtTop;
369 }
370
371 if (bGutterAtTop)
372 {
373 m_xGutterPositionLB->set_active(1);
374 }
375 else
376 {
377 // Left.
378 m_xGutterPositionLB->set_active(0);
379 }
380 it = pGragbagItem->GetGrabBag().find("RtlGutter");
381 bool bRtlGutter{};
382 if (it != pGragbagItem->GetGrabBag().end())
383 {
384 it->second >>= bRtlGutter;
385 m_xRtlGutterCB->set_active(bRtlGutter);
386 m_xRtlGutterCB->show();
387 }
388 it = pGragbagItem->GetGrabBag().find("BackgroundFullSize");
389 bool isBackgroundFullSize{};
390 if (it != pGragbagItem->GetGrabBag().end())
391 {
392 it->second >>= isBackgroundFullSize;
393 m_xBackgroundFullSizeCB->set_active(isBackgroundFullSize);
395 }
396 }
397
398 // general page data
399 SvxNumType eNumType = SVX_NUM_ARABIC;
400 bLandscape = ( mpDefPrinter->GetOrientation() == Orientation::Landscape );
401 SvxPageUsage nUse = SvxPageUsage::All;
402 pItem = GetItem( *rSet, SID_ATTR_PAGE );
403
404 if ( pItem )
405 {
406 const SvxPageItem& rItem = static_cast<const SvxPageItem&>(*pItem);
407 eNumType = rItem.GetNumType();
408 nUse = rItem.GetPageUsage();
409 bLandscape = rItem.IsLandscape();
410 }
411
412 // alignment
413 m_xLayoutBox->set_active(::PageUsageToPos_Impl(nUse));
414 m_aBspWin.SetUsage( nUse );
415 LayoutHdl_Impl( *m_xLayoutBox );
416
417 //adjust numeration type of the page style
418 m_xNumberFormatBox->set_active_id(eNumType);
419
420 m_xPaperTrayBox->clear();
422 pItem = GetItem( *rSet, SID_ATTR_PAGE_PAPERBIN );
423
424 if ( pItem )
425 {
426 nPaperBin = static_cast<const SvxPaperBinItem*>(pItem)->GetValue();
427
428 if ( nPaperBin >= mpDefPrinter->GetPaperBinCount() )
429 nPaperBin = PAPERBIN_PRINTER_SETTINGS;
430 }
431
432 OUString aBinName;
433
434 if ( PAPERBIN_PRINTER_SETTINGS == nPaperBin )
435 aBinName = EditResId(RID_SVXSTR_PAPERBIN_SETTINGS);
436 else
437 aBinName = mpDefPrinter->GetPaperBinName( static_cast<sal_uInt16>(nPaperBin) );
438
439 m_xPaperTrayBox->append(OUString::number(nPaperBin), aBinName);
440 m_xPaperTrayBox->set_active_text(aBinName);
441 // reset focus handler to default first so know none already connected
442 m_xPaperTrayBox->connect_focus_in(Link<weld::Widget&, void>());
443 // update the list when widget gets focus
444 m_xPaperTrayBox->connect_focus_in(LINK(this, SvxPageDescPage, PaperBinHdl_Impl));
445
447 pItem = GetItem( *rSet, SID_ATTR_PAGE_SIZE );
448
449 if ( pItem )
450 aPaperSize = static_cast<const SvxSizeItem*>(pItem)->GetSize();
451
452 bool bOrientationSupport =
453 mpDefPrinter->HasSupport( PrinterSupport::SetOrientation );
454
455 if ( !bOrientationSupport &&
456 aPaperSize.Width() > aPaperSize.Height() )
457 bLandscape = true;
458
459 // tdf#130548 disable callbacks on the other of a pair of the radiogroup
460 // when toggling its partner
463
464 m_xLandscapeBtn->set_active(bLandscape);
465 m_xPortraitBtn->set_active(!bLandscape);
466
467 m_xLandscapeBtn->connect_toggled(LINK(this, SvxPageDescPage, SwapOrientation_Impl));
468 m_xPortraitBtn->connect_toggled(LINK(this, SvxPageDescPage, SwapOrientation_Impl));
469
470 m_aBspWin.SetSize( Size( ConvertLong_Impl( aPaperSize.Width(), eUnit ),
471 ConvertLong_Impl( aPaperSize.Height(), eUnit ) ) );
472
473 aPaperSize = OutputDevice::LogicToLogic(aPaperSize, MapMode(eUnit), MapMode(MapUnit::Map100thMM));
474 if ( bLandscape )
475 Swap( aPaperSize );
476
477 // Actual Paper Format
478 Paper ePaper = SvxPaperInfo::GetSvxPaper( aPaperSize, MapUnit::Map100thMM );
479
480 if ( PAPER_USER != ePaper )
481 aPaperSize = SvxPaperInfo::GetPaperSize( ePaper, MapUnit::Map100thMM );
482
483 if ( bLandscape )
484 Swap( aPaperSize );
485
486 // write values into the edits
487 SetMetricValue( *m_xPaperHeightEdit, aPaperSize.Height(), MapUnit::Map100thMM );
488 SetMetricValue( *m_xPaperWidthEdit, aPaperSize.Width(), MapUnit::Map100thMM );
489 m_xPaperSizeBox->clear();
490
491 m_xPaperSizeBox->FillPaperSizeEntries( ( ePaperStart == PAPER_A3 ) ? PaperSizeApp::Std : PaperSizeApp::Draw );
492 m_xPaperSizeBox->set_active_id( ePaper );
493
494 // application specific
495
496 switch ( eMode )
497 {
499 {
500 m_xTblAlignFT->show();
501 m_xHorzBox->show();
502 m_xVertBox->show();
504
505 // horizontal alignment
506 pItem = GetItem( *rSet, SID_ATTR_PAGE_EXT1 );
507 m_xHorzBox->set_active(pItem && static_cast<const SfxBoolItem*>(pItem)->GetValue());
508
509 // vertical alignment
510 pItem = GetItem( *rSet, SID_ATTR_PAGE_EXT2 );
511 m_xVertBox->set_active(pItem && static_cast<const SfxBoolItem*>(pItem)->GetValue());
512
513 // set example window on the table
514 m_aBspWin.SetTable( true );
515 m_aBspWin.SetHorz(m_xHorzBox->get_active());
516 m_aBspWin.SetVert(m_xVertBox->get_active());
517
518 m_xGutterMarginLbl->hide();
519 m_xGutterMarginEdit->hide();
520 m_xGutterPositionFT->hide();
521 m_xGutterPositionLB->hide();
522
523 break;
524 }
525
527 {
529 m_xAdaptBox->show();
530 pItem = GetItem( *rSet, SID_ATTR_PAGE_EXT1 );
531 m_xAdaptBox->set_active( pItem &&
532 static_cast<const SfxBoolItem*>(pItem)->GetValue() );
533
535 m_xLayoutBox->hide();
536 m_xPageText->hide();
537
538 m_xGutterMarginLbl->hide();
539 m_xGutterMarginEdit->hide();
540 m_xGutterPositionFT->hide();
541 m_xGutterPositionLB->hide();
542
543 break;
544 }
545 default: ;//prevent warning
546 }
547
548
549 // display background and border in the example
553
555
556 bBorderModified = false;
557 SwapFirstValues_Impl( false );
559
560 m_xLeftMarginEdit->save_value();
561 m_xRightMarginEdit->save_value();
562 m_xTopMarginEdit->save_value();
563 m_xBottomMarginEdit->save_value();
564 m_xGutterMarginEdit->save_value();
565 m_xLayoutBox->save_value();
566 m_xNumberFormatBox->save_value();
567 m_xPaperSizeBox->save_value();
568 m_xPaperWidthEdit->save_value();
569 m_xPaperHeightEdit->save_value();
570 m_xPortraitBtn->save_state();
571 m_xLandscapeBtn->save_state();
572 m_xPaperTrayBox->save_value();
573 m_xVertBox->save_state();
574 m_xHorzBox->save_state();
575 m_xAdaptBox->save_state();
576 m_xGutterPositionLB->save_value();
577 m_xRtlGutterCB->save_state();
578 m_xBackgroundFullSizeCB->save_state();
579
580 CheckMarginEdits( true );
581
582
583 if(SfxItemState::SET == rSet->GetItemState(SID_SWREGISTER_MODE))
584 {
585 m_xRegisterCB->set_active(rSet->Get(SID_SWREGISTER_MODE).GetValue());
586 m_xRegisterCB->save_state();
587 RegisterModify(*m_xRegisterCB);
588 }
589 if(SfxItemState::SET == rSet->GetItemState(SID_SWREGISTER_COLLECTION))
590 {
591 m_xRegisterLB->set_active_text(
592 rSet->Get(SID_SWREGISTER_COLLECTION).GetValue());
593 m_xRegisterLB->save_value();
594 }
595
596 SfxItemState eState = rSet->GetItemState( GetWhich( SID_ATTR_FRAMEDIRECTION ),
597 true, &pItem );
598 if( SfxItemState::UNKNOWN != eState )
599 {
600 SvxFrameDirection nVal = SfxItemState::SET == eState
601 ? static_cast<const SvxFrameDirectionItem*>(pItem)->GetValue()
602 : SvxFrameDirection::Horizontal_LR_TB;
603 m_xTextFlowBox->set_active_id(nVal);
604
605 m_xTextFlowBox->save_value();
607 }
608}
609
611{
613 SetUserData(m_xAdaptBox->get_active() ? OUString("1") : OUString("0")) ;
614
615}
616
618{
619 bool bModified = false;
620 const SfxItemSet& rOldSet = GetItemSet();
621 SfxItemPool* pPool = rOldSet.GetPool();
622 DBG_ASSERT( pPool, "Where is the pool?" );
623 sal_uInt16 nWhich = GetWhich( SID_ATTR_LRSPACE );
624 MapUnit eUnit = pPool->GetMetric( nWhich );
625 const SfxPoolItem* pOld = nullptr;
626
627 // copy old left and right margins
628 SvxLRSpaceItem aMargin( static_cast<const SvxLRSpaceItem&>(rOldSet.Get( nWhich )) );
629
630 // copy old top and bottom margins
631 nWhich = GetWhich( SID_ATTR_ULSPACE );
632 SvxULSpaceItem aTopMargin( static_cast<const SvxULSpaceItem&>(rOldSet.Get( nWhich )) );
633
634 if (m_xLeftMarginEdit->get_value_changed_from_saved())
635 {
636 aMargin.SetLeft( static_cast<sal_uInt16>(GetCoreValue( *m_xLeftMarginEdit, eUnit )) );
637 bModified = true;
638 }
639
640 if (m_xRightMarginEdit->get_value_changed_from_saved())
641 {
642 aMargin.SetRight( static_cast<sal_uInt16>(GetCoreValue( *m_xRightMarginEdit, eUnit )) );
643 bModified = true;
644 }
645
646 if (m_xGutterMarginEdit->get_value_changed_from_saved())
647 {
648 aMargin.SetGutterMargin(static_cast<sal_uInt16>(GetCoreValue(*m_xGutterMarginEdit, eUnit)));
649 bModified = true;
650 }
651
652 // set left and right margins
653 if (bModified)
654 {
655 pOld = GetOldItem( *rSet, SID_ATTR_LRSPACE );
656
657 if ( !pOld || *static_cast<const SvxLRSpaceItem*>(pOld) != aMargin )
658 rSet->Put( aMargin );
659 else
660 bModified = false;
661 }
662
663 if (rOldSet.HasItem(SID_ATTR_CHAR_GRABBAG))
664 {
665 // Set gutter position.
666 SfxGrabBagItem aGrabBagItem(rOldSet.Get(SID_ATTR_CHAR_GRABBAG));
667 if (m_xGutterPositionLB->get_value_changed_from_saved())
668 {
669 bool bGutterAtTop = m_xGutterPositionLB->get_active() == 1;
670 aGrabBagItem.GetGrabBag()["GutterAtTop"] <<= bGutterAtTop;
671 bModified = true;
672 }
673 if (m_xRtlGutterCB->get_state_changed_from_saved())
674 {
675 bool const bRtlGutter(m_xRtlGutterCB->get_active());
676 aGrabBagItem.GetGrabBag()["RtlGutter"] <<= bRtlGutter;
677 bModified = true;
678 }
679 if (m_xBackgroundFullSizeCB->get_state_changed_from_saved())
680 {
681 bool const isBackgroundFullSize(m_xBackgroundFullSizeCB->get_active());
682 aGrabBagItem.GetGrabBag()["BackgroundFullSize"] <<= isBackgroundFullSize;
683 bModified = true;
684 }
685
686 if (bModified)
687 {
688 pOld = rOldSet.GetItem(SID_ATTR_CHAR_GRABBAG);
689
690 if (!pOld || static_cast<const SfxGrabBagItem&>(*pOld) != aGrabBagItem)
691 rSet->Put(aGrabBagItem);
692 else
693 bModified = false;
694 }
695 }
696
697 bool bMod = false;
698
699 if (m_xTopMarginEdit->get_value_changed_from_saved())
700 {
701 aTopMargin.SetUpper( static_cast<sal_uInt16>(GetCoreValue( *m_xTopMarginEdit, eUnit )) );
702 bMod = true;
703 }
704
705 if (m_xBottomMarginEdit->get_value_changed_from_saved())
706 {
707 aTopMargin.SetLower( static_cast<sal_uInt16>(GetCoreValue( *m_xBottomMarginEdit, eUnit )) );
708 bMod = true;
709 }
710
711 // set top and bottom margins
712
713 if ( bMod )
714 {
715 pOld = GetOldItem( *rSet, SID_ATTR_ULSPACE );
716
717 if ( !pOld || *static_cast<const SvxULSpaceItem*>(pOld) != aTopMargin )
718 {
719 bModified = true;
720 rSet->Put( aTopMargin );
721 }
722 }
723
724 // paper tray
725 TypedWhichId<SvxPaperBinItem> nPaperWhich = GetWhich( SID_ATTR_PAGE_PAPERBIN );
726 sal_Int32 nPos = m_xPaperTrayBox->get_active();
727 sal_uInt16 nBin = m_xPaperTrayBox->get_id(nPos).toInt32();
728 pOld = GetOldItem( *rSet, SID_ATTR_PAGE_PAPERBIN );
729
730 if ( !pOld || static_cast<const SvxPaperBinItem*>(pOld)->GetValue() != nBin )
731 {
732 rSet->Put( SvxPaperBinItem( nPaperWhich, static_cast<sal_uInt8>(nBin) ) );
733 bModified = true;
734 }
735
736 Paper ePaper = m_xPaperSizeBox->get_active_id();
737 bool bChecked = m_xLandscapeBtn->get_active();
738
739 if ( PAPER_USER == ePaper )
740 {
741 if ( m_xPaperSizeBox->get_value_changed_from_saved() ||
742 m_xPaperWidthEdit->get_value_changed_from_saved() ||
743 m_xPaperHeightEdit->get_value_changed_from_saved() ||
744 m_xLandscapeBtn->get_state_changed_from_saved() )
745 {
746 Size aSize( GetCoreValue( *m_xPaperWidthEdit, eUnit ),
747 GetCoreValue( *m_xPaperHeightEdit, eUnit ) );
748 pOld = GetOldItem( *rSet, SID_ATTR_PAGE_SIZE );
749
750 if ( !pOld || static_cast<const SvxSizeItem*>(pOld)->GetSize() != aSize )
751 {
752 rSet->Put( SvxSizeItem( GetWhich(SID_ATTR_PAGE_SIZE), aSize ) );
753 bModified = true;
754 }
755 }
756 }
757 else
758 {
759 if (m_xPaperSizeBox->get_value_changed_from_saved() || m_xLandscapeBtn->get_state_changed_from_saved())
760 {
761 Size aSize( SvxPaperInfo::GetPaperSize( ePaper, eUnit ) );
762
763 if ( bChecked )
764 Swap( aSize );
765
766 pOld = GetOldItem( *rSet, SID_ATTR_PAGE_SIZE );
767
768 if ( !pOld || static_cast<const SvxSizeItem*>(pOld)->GetSize() != aSize )
769 {
770 rSet->Put( SvxSizeItem( GetWhich(SID_ATTR_PAGE_SIZE), aSize ) );
771 bModified = true;
772 }
773 }
774 }
775
776 nWhich = GetWhich( SID_ATTR_PAGE );
777 SvxPageItem aPage( static_cast<const SvxPageItem&>(rOldSet.Get( nWhich )) );
778 bMod = m_xLayoutBox->get_value_changed_from_saved();
779
780 if ( bMod )
781 aPage.SetPageUsage(::PosToPageUsage_Impl(m_xLayoutBox->get_active()));
782
783 if (m_xLandscapeBtn->get_state_changed_from_saved())
784 {
785 aPage.SetLandscape(bChecked);
786 bMod = true;
787 }
788
789 //Get the NumType value
790 if (m_xNumberFormatBox->get_value_changed_from_saved())
791 {
792 SvxNumType nEntryData = m_xNumberFormatBox->get_active_id();
793 aPage.SetNumType( nEntryData );
794 bMod = true;
795 }
796
797 if ( bMod )
798 {
799 pOld = GetOldItem( *rSet, SID_ATTR_PAGE );
800
801 if ( !pOld || *static_cast<const SvxPageItem*>(pOld) != aPage )
802 {
803 rSet->Put( aPage );
804 bModified = true;
805 }
806 }
807 else if ( SfxItemState::DEFAULT == rOldSet.GetItemState( nWhich ) )
808 rSet->ClearItem( nWhich );
809 else
810 rSet->Put( rOldSet.Get( nWhich ) );
811
812 // evaluate mode specific controls
813
814 switch ( eMode )
815 {
817 {
818 if (m_xHorzBox->get_state_changed_from_saved())
819 {
820 SfxBoolItem aHorz( GetWhich( SID_ATTR_PAGE_EXT1 ),
821 m_xHorzBox->get_active() );
822 rSet->Put( aHorz );
823 bModified = true;
824 }
825
826 if (m_xVertBox->get_state_changed_from_saved())
827 {
828 SfxBoolItem aVert( GetWhich( SID_ATTR_PAGE_EXT2 ),
829 m_xVertBox->get_active() );
830 rSet->Put( aVert );
831 bModified = true;
832 }
833 break;
834 }
835
837 {
838 // always put so that draw can evaluate this
839 rSet->Put( SfxBoolItem( GetWhich( SID_ATTR_PAGE_EXT1 ),
840 m_xAdaptBox->get_active() ) );
841 bModified = true;
842 break;
843 }
844 default: ;//prevent warning
845
846 }
847
848 if (m_xRegisterCB->get_visible() &&
849 (m_xRegisterCB->get_active() || m_xRegisterCB->get_state_changed_from_saved()))
850 {
851 const SfxBoolItem& rRegItem = rOldSet.Get(SID_SWREGISTER_MODE);
852 std::unique_ptr<SfxBoolItem> pRegItem(rRegItem.Clone());
853 bool bCheck = m_xRegisterCB->get_active();
854 pRegItem->SetValue(bCheck);
855 rSet->Put(std::move(pRegItem));
856 bModified = true;
857 if(bCheck)
858 {
859 bModified = true;
860 rSet->Put(SfxStringItem(SID_SWREGISTER_COLLECTION,
861 m_xRegisterLB->get_active_text()));
862 }
863 }
864
865 if (m_xTextFlowBox->get_visible() && m_xTextFlowBox->get_value_changed_from_saved())
866 {
867 SvxFrameDirection eDirection = m_xTextFlowBox->get_active_id();
868 rSet->Put( SvxFrameDirectionItem( eDirection, GetWhich( SID_ATTR_FRAMEDIRECTION ) ) );
869 bModified = true;
870 }
871
872 return bModified;
873}
874
876{
877 // switch inside outside
878 const SvxPageUsage nUsage = PosToPageUsage_Impl(m_xLayoutBox->get_active());
879
880 if (nUsage == SvxPageUsage::Mirror)
881 {
882 m_xLeftMarginLbl->hide();
883 m_xRightMarginLbl->hide();
884 m_xInsideLbl->show();
885 m_xOutsideLbl->show();
886 }
887 else
888 {
889 m_xLeftMarginLbl->show();
890 m_xRightMarginLbl->show();
891 m_xInsideLbl->hide();
892 m_xOutsideLbl->hide();
893 }
894 UpdateExample_Impl( true );
895}
896
897IMPL_LINK_NOARG(SvxPageDescPage, GutterPositionHdl_Impl, weld::ComboBox&, void)
898{
899 UpdateExample_Impl(true);
900}
901
903{
904 // tdf#124226 disconnect so not called again, unless Reset occurs
905 m_xPaperTrayBox->connect_focus_in(Link<weld::Widget&, void>());
906
907 OUString aOldName = m_xPaperTrayBox->get_active_text();
908 m_xPaperTrayBox->freeze();
909 m_xPaperTrayBox->clear();
910 m_xPaperTrayBox->append(OUString::number(PAPERBIN_PRINTER_SETTINGS), EditResId(RID_SVXSTR_PAPERBIN_SETTINGS));
911 OUString aPaperBin(EditResId(RID_SVXSTR_PAPERBIN));
912 const sal_uInt16 nBinCount = mpDefPrinter->GetPaperBinCount();
913
914 for (sal_uInt16 i = 0; i < nBinCount; ++i)
915 {
916 OUString aName = mpDefPrinter->GetPaperBinName(i);
917 if (aName.isEmpty())
918 {
919 aName = aPaperBin + " " + OUString::number( i+1 );
920 }
921 m_xPaperTrayBox->append(OUString::number(i), aName);
922 }
923 m_xPaperTrayBox->thaw();
924 m_xPaperTrayBox->set_active_text(aOldName);
925
926 // tdf#123650 explicitly grab-focus after the modification otherwise gtk loses track
927 // of there the focus should be
928 m_xPaperTrayBox->grab_focus();
929}
930
931IMPL_LINK_NOARG(SvxPageDescPage, PaperSizeSelect_Impl, weld::ComboBox&, void)
932{
933 Paper ePaper = m_xPaperSizeBox->get_active_id();
934
935 if ( ePaper == PAPER_USER )
936 return;
937
938 Size aSize( SvxPaperInfo::GetPaperSize( ePaper, MapUnit::Map100thMM ) );
939
940 if (m_xLandscapeBtn->get_active())
941 Swap( aSize );
942
943 if ( aSize.Height() < m_xPaperHeightEdit->get_min( FieldUnit::MM_100TH ) )
944 m_xPaperHeightEdit->set_min(
945 m_xPaperHeightEdit->normalize( aSize.Height() ), FieldUnit::MM_100TH );
946 if ( aSize.Width() < m_xPaperWidthEdit->get_min( FieldUnit::MM_100TH ) )
947 m_xPaperWidthEdit->set_min(
948 m_xPaperWidthEdit->normalize( aSize.Width() ), FieldUnit::MM_100TH );
949 SetMetricValue( *m_xPaperHeightEdit, aSize.Height(), MapUnit::Map100thMM );
950 SetMetricValue( *m_xPaperWidthEdit, aSize.Width(), MapUnit::Map100thMM );
951
952 CalcMargin_Impl();
953
954 RangeHdl_Impl();
955 UpdateExample_Impl( true );
956
958 return;
959
960 // Draw: if paper format the margin shall be 1 cm
961 tools::Long nTmp = 0;
962 bool bScreen = (( PAPER_SCREEN_4_3 == ePaper )||( PAPER_SCREEN_16_9 == ePaper)||( PAPER_SCREEN_16_10 == ePaper)||( PAPER_WIDESCREEN == ePaper)||( PAPER_ONSCREENSHOW_4_3 == ePaper)||( PAPER_ONSCREENSHOW_16_9 == ePaper)||( PAPER_ONSCREENSHOW_16_10 == ePaper));
963
964 if ( !bScreen )
965 // no margin if screen
966 nTmp = 1; // accordingly 1 cm
967
968 if ( bScreen || m_xRightMarginEdit->get_value(FieldUnit::NONE) == 0 )
969 SetMetricValue( *m_xRightMarginEdit, nTmp, MapUnit::MapCM );
970 if ( bScreen || m_xLeftMarginEdit->get_value(FieldUnit::NONE) == 0 )
971 SetMetricValue( *m_xLeftMarginEdit, nTmp, MapUnit::MapCM );
972 if ( bScreen || m_xBottomMarginEdit->get_value(FieldUnit::NONE) == 0 )
973 SetMetricValue( *m_xBottomMarginEdit, nTmp, MapUnit::MapCM );
974 if ( bScreen || m_xTopMarginEdit->get_value(FieldUnit::NONE) == 0 )
975 SetMetricValue( *m_xTopMarginEdit, nTmp, MapUnit::MapCM );
976 UpdateExample_Impl( true );
977}
978
980{
981 sal_uInt16 nWhich = GetWhich( SID_ATTR_LRSPACE );
982 MapUnit eUnit = GetItemSet().GetPool()->GetMetric( nWhich );
983 Size aSize( GetCoreValue( *m_xPaperWidthEdit, eUnit ),
984 GetCoreValue( *m_xPaperHeightEdit, eUnit ) );
985
986 if ( aSize.Width() > aSize.Height() )
987 {
988 m_xLandscapeBtn->set_active(true);
989 bLandscape = true;
990 }
991 else
992 {
993 m_xPortraitBtn->set_active(true);
994 bLandscape = false;
995 }
996
997 Paper ePaper = SvxPaperInfo::GetSvxPaper( aSize, eUnit );
998 m_xPaperSizeBox->set_active_id( ePaper );
999 UpdateExample_Impl( true );
1000
1001 RangeHdl_Impl();
1002}
1003
1004IMPL_LINK(SvxPageDescPage, SwapOrientation_Impl, weld::Toggleable&, rBtn, void)
1005{
1006 if (!rBtn.get_active())
1007 return;
1008
1009 bLandscape = m_xLandscapeBtn->get_active();
1010
1011 const tools::Long lWidth = GetCoreValue( *m_xPaperWidthEdit, MapUnit::Map100thMM );
1012 const tools::Long lHeight = GetCoreValue( *m_xPaperHeightEdit, MapUnit::Map100thMM );
1013
1014 // swap width and height
1015 SetMetricValue(*m_xPaperWidthEdit, lHeight, MapUnit::Map100thMM);
1016 SetMetricValue(*m_xPaperHeightEdit, lWidth, MapUnit::Map100thMM);
1017
1018 // recalculate margins if necessary
1019 CalcMargin_Impl();
1020
1021 PaperSizeSelect_Impl(m_xPaperSizeBox->get_widget());
1022 RangeHdl_Impl();
1023 SwapFirstValues_Impl(bBorderModified);
1024 UpdateExample_Impl(true);
1025}
1026
1028{
1029 MapMode aOldMode = mpDefPrinter->GetMapMode();
1030 Orientation eOri = Orientation::Portrait;
1031
1032 if ( bLandscape )
1033 eOri = Orientation::Landscape;
1034 Orientation eOldOri = mpDefPrinter->GetOrientation();
1035 mpDefPrinter->SetOrientation( eOri );
1036 mpDefPrinter->SetMapMode(MapMode(MapUnit::MapTwip));
1037
1038 // set first- and last-values for margins
1039 Size aPaperSize = mpDefPrinter->GetPaperSize();
1040 Size aPrintSize = mpDefPrinter->GetOutputSize();
1041 /*
1042 * To convert a point ( 0,0 ) into logic coordinates
1043 * looks like nonsense; but it makes sense if the
1044 * coordinate system's origin has been moved.
1045 */
1046 Point aPrintOffset = mpDefPrinter->GetPageOffset() - mpDefPrinter->PixelToLogic( Point() );
1047 mpDefPrinter->SetMapMode( aOldMode );
1048 mpDefPrinter->SetOrientation( eOldOri );
1049
1050 sal_Int64 nSetL = m_xLeftMarginEdit->denormalize(
1051 m_xLeftMarginEdit->get_value( FieldUnit::TWIP ) );
1052 sal_Int64 nSetR = m_xRightMarginEdit->denormalize(
1053 m_xRightMarginEdit->get_value( FieldUnit::TWIP ) );
1054 sal_Int64 nSetT = m_xTopMarginEdit->denormalize(
1055 m_xTopMarginEdit->get_value( FieldUnit::TWIP ) );
1056 sal_Int64 nSetB = m_xBottomMarginEdit->denormalize(
1057 m_xBottomMarginEdit->get_value( FieldUnit::TWIP ) );
1058
1059 tools::Long nNewL = aPrintOffset.X();
1060 tools::Long nNewR = aPaperSize.Width() - aPrintSize.Width() - aPrintOffset.X();
1061 tools::Long nNewT = aPrintOffset.Y();
1062 tools::Long nNewB = aPaperSize.Height() - aPrintSize.Height() - aPrintOffset.Y();
1063
1064 nFirstLeftMargin = m_xLeftMarginEdit->convert_value_from(m_xLeftMarginEdit->normalize(nNewL), FieldUnit::TWIP);
1065 nFirstRightMargin = m_xRightMarginEdit->convert_value_from(m_xRightMarginEdit->normalize(nNewR), FieldUnit::TWIP);
1066 nFirstTopMargin = m_xTopMarginEdit->convert_value_from(m_xTopMarginEdit->normalize(nNewT), FieldUnit::TWIP);
1067 nFirstBottomMargin = m_xBottomMarginEdit->convert_value_from(m_xBottomMarginEdit->normalize(nNewB), FieldUnit::TWIP);
1068
1069 if ( !bSet )
1070 return;
1071
1072 if ( nSetL < nNewL )
1073 m_xLeftMarginEdit->set_value( m_xLeftMarginEdit->normalize( nNewL ),
1074 FieldUnit::TWIP );
1075 if ( nSetR < nNewR )
1076 m_xRightMarginEdit->set_value( m_xRightMarginEdit->normalize( nNewR ),
1077 FieldUnit::TWIP );
1078 if ( nSetT < nNewT )
1079 m_xTopMarginEdit->set_value( m_xTopMarginEdit->normalize( nNewT ),
1080 FieldUnit::TWIP );
1081 if ( nSetB < nNewB )
1082 m_xBottomMarginEdit->set_value( m_xBottomMarginEdit->normalize( nNewB ),
1083 FieldUnit::TWIP );
1084}
1085
1087{
1088 if ( !bBorderModified )
1089 bBorderModified = true;
1090 UpdateExample_Impl();
1091
1092 RangeHdl_Impl();
1093}
1094
1095void SvxPageDescPage::UpdateExample_Impl( bool bResetbackground )
1096{
1097 // Size
1098 Size aSize( GetCoreValue( *m_xPaperWidthEdit, MapUnit::MapTwip ),
1099 GetCoreValue( *m_xPaperHeightEdit, MapUnit::MapTwip ) );
1100
1101 m_aBspWin.SetSize( aSize );
1102
1103 // Margins
1104 bool bGutterAtTop = m_xGutterPositionLB->get_active() == 1;
1105 tools::Long nTop = GetCoreValue(*m_xTopMarginEdit, MapUnit::MapTwip);
1106 if (bGutterAtTop)
1107 {
1108 nTop += GetCoreValue(*m_xGutterMarginEdit, MapUnit::MapTwip);
1109 }
1110 m_aBspWin.SetTop(nTop);
1111 m_aBspWin.SetBottom( GetCoreValue( *m_xBottomMarginEdit, MapUnit::MapTwip ) );
1112 tools::Long nLeft = GetCoreValue(*m_xLeftMarginEdit, MapUnit::MapTwip);
1113 if (!bGutterAtTop)
1114 {
1115 nLeft += GetCoreValue(*m_xGutterMarginEdit, MapUnit::MapTwip);
1116 }
1117 m_aBspWin.SetLeft(nLeft);
1118 m_aBspWin.SetRight( GetCoreValue( *m_xRightMarginEdit, MapUnit::MapTwip ) );
1119
1120 // Layout
1122 if ( bResetbackground )
1124 m_aBspWin.Invalidate();
1125}
1126
1127
1129{
1130 sal_uInt16 nWhich(GetWhich(SID_ATTR_PAGE_HEADERSET));
1131
1132 if (SfxItemState::SET == rSet.GetItemState(nWhich, false))
1133 {
1134 const SvxSetItem& rSetItem = static_cast< const SvxSetItem& >(rSet.Get(nWhich, false));
1135 const SfxItemSet& rTmpSet = rSetItem.GetItemSet();
1136 const SfxBoolItem& rOn = rTmpSet.Get(GetWhich(SID_ATTR_PAGE_ON));
1137
1138 if(rOn.GetValue())
1139 {
1141
1143 {
1144 // create FillAttributes directly from DrawingLayer FillStyle entries
1145 aHeaderFillAttributes = std::make_shared<drawinglayer::attribute::SdrAllFillAttributesHelper>(rTmpSet);
1146 }
1147 else
1148 {
1149 nWhich = GetWhich(SID_ATTR_BRUSH);
1150
1151 if(SfxItemState::SET == rTmpSet.GetItemState(nWhich))
1152 {
1153 // create FillAttributes from SvxBrushItem
1154 const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(rTmpSet.Get(nWhich));
1156
1158 aHeaderFillAttributes = std::make_shared<drawinglayer::attribute::SdrAllFillAttributesHelper>(aTempSet);
1159 }
1160 }
1161
1162 m_aBspWin.setHeaderFillAttributes(aHeaderFillAttributes);
1163 }
1164 }
1165
1166 nWhich = GetWhich(SID_ATTR_PAGE_FOOTERSET);
1167
1168 if (SfxItemState::SET == rSet.GetItemState(nWhich, false))
1169 {
1170 const SvxSetItem& rSetItem = static_cast< const SvxSetItem& >(rSet.Get(nWhich,false));
1171 const SfxItemSet& rTmpSet = rSetItem.GetItemSet();
1172 const SfxBoolItem& rOn = rTmpSet.Get(GetWhich(SID_ATTR_PAGE_ON));
1173
1174 if(rOn.GetValue())
1175 {
1177
1179 {
1180 // create FillAttributes directly from DrawingLayer FillStyle entries
1181 aFooterFillAttributes = std::make_shared<drawinglayer::attribute::SdrAllFillAttributesHelper>(rTmpSet);
1182 }
1183 else
1184 {
1185 nWhich = GetWhich(SID_ATTR_BRUSH);
1186
1187 if(SfxItemState::SET == rTmpSet.GetItemState(nWhich))
1188 {
1189 // create FillAttributes from SvxBrushItem
1190 const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(rTmpSet.Get(nWhich));
1192
1194 aFooterFillAttributes = std::make_shared<drawinglayer::attribute::SdrAllFillAttributesHelper>(aTempSet);
1195 }
1196 }
1197
1198 m_aBspWin.setFooterFillAttributes(aFooterFillAttributes);
1199 }
1200 }
1201
1203
1205 {
1206 // create FillAttributes directly from DrawingLayer FillStyle entries
1207 aPageFillAttributes = std::make_shared<drawinglayer::attribute::SdrAllFillAttributesHelper>(rSet);
1208 }
1209 else
1210 {
1211 const SfxPoolItem* pItem = GetItem(rSet, SID_ATTR_BRUSH);
1212
1213 if(pItem)
1214 {
1215 // create FillAttributes from SvxBrushItem
1216 const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(*pItem);
1218
1220 aPageFillAttributes = std::make_shared<drawinglayer::attribute::SdrAllFillAttributesHelper>(aTempSet);
1221 }
1222 }
1223
1224 m_aBspWin.setPageFillAttributes(aPageFillAttributes);
1225}
1226
1228{
1229 bLandscape = m_xLandscapeBtn->get_active();
1230 const SfxPoolItem* pItem = GetItem( rSet, SID_ATTR_PAGE_SIZE );
1231
1232 if ( pItem )
1233 m_aBspWin.SetSize( static_cast<const SvxSizeItem*>(pItem)->GetSize() );
1234
1235 const SvxSetItem* pSetItem = nullptr;
1236
1237 // evaluate header attributes
1238
1239 if ( SfxItemState::SET ==
1240 rSet.GetItemState( GetWhich( SID_ATTR_PAGE_HEADERSET ),
1241 false, reinterpret_cast<const SfxPoolItem**>(&pSetItem) ) )
1242 {
1243 const SfxItemSet& rHeaderSet = pSetItem->GetItemSet();
1244 const SfxBoolItem& rHeaderOn =
1245 rHeaderSet.Get( GetWhich( SID_ATTR_PAGE_ON ) );
1246
1247 if ( rHeaderOn.GetValue() )
1248 {
1249 const SvxSizeItem& rSize =
1250 rHeaderSet.Get( GetWhich( SID_ATTR_PAGE_SIZE ) );
1251 const SvxULSpaceItem& rUL =
1252 rHeaderSet.Get( GetWhich( SID_ATTR_ULSPACE ) );
1253 tools::Long nDist = rUL.GetLower();
1254 m_aBspWin.SetHdHeight( rSize.GetSize().Height() - nDist );
1255 m_aBspWin.SetHdDist( nDist );
1256 const SvxLRSpaceItem& rLR =
1257 rHeaderSet.Get( GetWhich( SID_ATTR_LRSPACE ) );
1258 m_aBspWin.SetHdLeft( rLR.GetLeft() );
1259 m_aBspWin.SetHdRight( rLR.GetRight() );
1260 m_aBspWin.SetHeader( true );
1261 }
1262 else
1263 m_aBspWin.SetHeader( false );
1264
1265 // show background and border in the example
1267
1269 {
1270 // create FillAttributes directly from DrawingLayer FillStyle entries
1271 aHeaderFillAttributes = std::make_shared<drawinglayer::attribute::SdrAllFillAttributesHelper>(rHeaderSet);
1272 }
1273 else
1274 {
1275 const sal_uInt16 nWhich(GetWhich(SID_ATTR_BRUSH));
1276
1277 if(rHeaderSet.GetItemState(nWhich) >= SfxItemState::DEFAULT)
1278 {
1279 // aBspWin.SetHdColor(rItem.GetColor());
1280 const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(rHeaderSet.Get(nWhich));
1282
1284 aHeaderFillAttributes = std::make_shared<drawinglayer::attribute::SdrAllFillAttributesHelper>(aTempSet);
1285 }
1286 }
1287
1288 m_aBspWin.setHeaderFillAttributes(aHeaderFillAttributes);
1289 }
1290
1291 // evaluate footer attributes
1292
1293 if ( SfxItemState::SET !=
1294 rSet.GetItemState( GetWhich( SID_ATTR_PAGE_FOOTERSET ),
1295 false, reinterpret_cast<const SfxPoolItem**>(&pSetItem) ) )
1296 return;
1297
1298 const SfxItemSet& rFooterSet = pSetItem->GetItemSet();
1299 const SfxBoolItem& rFooterOn =
1300 rFooterSet.Get( GetWhich( SID_ATTR_PAGE_ON ) );
1301
1302 if ( rFooterOn.GetValue() )
1303 {
1304 const SvxSizeItem& rSize =
1305 rFooterSet.Get( GetWhich( SID_ATTR_PAGE_SIZE ) );
1306 const SvxULSpaceItem& rUL =
1307 rFooterSet.Get( GetWhich( SID_ATTR_ULSPACE ) );
1308 tools::Long nDist = rUL.GetUpper();
1309 m_aBspWin.SetFtHeight( rSize.GetSize().Height() - nDist );
1310 m_aBspWin.SetFtDist( nDist );
1311 const SvxLRSpaceItem& rLR =
1312 rFooterSet.Get( GetWhich( SID_ATTR_LRSPACE ) );
1313 m_aBspWin.SetFtLeft( rLR.GetLeft() );
1314 m_aBspWin.SetFtRight( rLR.GetRight() );
1315 m_aBspWin.SetFooter( true );
1316 }
1317 else
1318 m_aBspWin.SetFooter( false );
1319
1320 // show background and border in the example
1322
1324 {
1325 // create FillAttributes directly from DrawingLayer FillStyle entries
1326 aFooterFillAttributes = std::make_shared<drawinglayer::attribute::SdrAllFillAttributesHelper>(rFooterSet);
1327 }
1328 else
1329 {
1330 const sal_uInt16 nWhich(GetWhich(SID_ATTR_BRUSH));
1331
1332 if(rFooterSet.GetItemState(nWhich) >= SfxItemState::DEFAULT)
1333 {
1334 // aBspWin.SetFtColor(rItem.GetColor());
1335 const SvxBrushItem& rItem = static_cast<const SvxBrushItem&>(rFooterSet.Get(nWhich));
1337
1339 aFooterFillAttributes = std::make_shared<drawinglayer::attribute::SdrAllFillAttributesHelper>(aTempSet);
1340 }
1341 }
1342
1343 m_aBspWin.setFooterFillAttributes(aFooterFillAttributes);
1344}
1345
1347{
1351 RangeHdl_Impl();
1352}
1353
1355{
1356 // Inquiry whether the page margins are beyond the printing area.
1357 // If not, ask user whether they shall be taken.
1358 // If not, stay on the TabPage.
1359 Paper ePaper = m_xPaperSizeBox->get_active_id();
1360
1361 if ( ePaper != PAPER_SCREEN_4_3 && ePaper != PAPER_SCREEN_16_9 && ePaper != PAPER_SCREEN_16_10 && ePaper != PAPER_WIDESCREEN && ePaper != PAPER_ONSCREENSHOW_4_3 && ePaper != PAPER_ONSCREENSHOW_16_9 && ePaper != PAPER_ONSCREENSHOW_16_10 && IsMarginOutOfRange() )
1362 {
1363 std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(GetFrameWeld(),
1364 VclMessageType::Question, VclButtonsType::YesNo,
1365 m_xPrintRangeQueryText->get_label()));
1366 xQueryBox->set_default_response(RET_NO);
1367 if (xQueryBox->run() == RET_NO)
1368 {
1369 weld::MetricSpinButton* pField = nullptr;
1371 pField = m_xLeftMarginEdit.get();
1373 && !pField )
1374 pField = m_xRightMarginEdit.get();
1376 && !pField )
1377 pField = m_xTopMarginEdit.get();
1379 && !pField )
1380 pField = m_xBottomMarginEdit.get();
1381 if ( pField )
1382 pField->grab_focus();
1384 return DeactivateRC::KeepPage;
1385 }
1386 else
1387 CheckMarginEdits( false );
1388 }
1389
1390 if ( _pSet )
1391 {
1392 FillItemSet( _pSet );
1393
1394 // put portray/landscape if applicable
1395 sal_uInt16 nWh = GetWhich( SID_ATTR_PAGE_SIZE );
1396 MapUnit eUnit = GetItemSet().GetPool()->GetMetric( nWh );
1397 Size aSize( GetCoreValue( *m_xPaperWidthEdit, eUnit ),
1398 GetCoreValue( *m_xPaperHeightEdit, eUnit ) );
1399
1400 // put, if current size is different to the value in _pSet
1401 const SvxSizeItem* pSize = GetItem( *_pSet, SID_ATTR_PAGE_SIZE );
1402 if ( aSize.Width() && ( !pSize || !IsEqualSize_Impl( pSize, aSize ) ) )
1403 _pSet->Put( SvxSizeItem( nWh, aSize ) );
1404 }
1405
1406 return DeactivateRC::LeavePage;
1407}
1408
1410{
1411 // example window
1412 tools::Long nHHeight = m_aBspWin.GetHdHeight();
1413 tools::Long nHDist = m_aBspWin.GetHdDist();
1414
1415 tools::Long nFHeight = m_aBspWin.GetFtHeight();
1416 tools::Long nFDist = m_aBspWin.GetFtDist();
1417
1418 tools::Long nHFLeft = std::max(m_aBspWin.GetHdLeft(), m_aBspWin.GetFtLeft());
1419 tools::Long nHFRight = std::max(m_aBspWin.GetHdRight(), m_aBspWin.GetFtRight());
1420
1421 // current values for page margins
1422 tools::Long nBT = static_cast<tools::Long>(m_xTopMarginEdit->denormalize(m_xTopMarginEdit->get_value(FieldUnit::TWIP)));
1423 tools::Long nBB = static_cast<tools::Long>(m_xBottomMarginEdit->denormalize(m_xBottomMarginEdit->get_value(FieldUnit::TWIP)));
1424 tools::Long nBL = static_cast<tools::Long>(m_xLeftMarginEdit->denormalize(m_xLeftMarginEdit->get_value(FieldUnit::TWIP)));
1425 tools::Long nBR = static_cast<tools::Long>(m_xRightMarginEdit->denormalize(m_xRightMarginEdit->get_value(FieldUnit::TWIP)));
1426
1427 // calculate width of page border
1428 const SfxItemSet* _pSet = &GetItemSet();
1429 Size aBorder;
1430
1431 if ( _pSet->GetItemState( GetWhich(SID_ATTR_BORDER_SHADOW) ) >=
1432 SfxItemState::DEFAULT &&
1433 _pSet->GetItemState( GetWhich(SID_ATTR_BORDER_OUTER) ) >=
1434 SfxItemState::DEFAULT )
1435 {
1436 aBorder = GetMinBorderSpace_Impl(
1437 _pSet->Get(GetWhich(SID_ATTR_BORDER_SHADOW)),
1438 _pSet->Get(GetWhich(SID_ATTR_BORDER_OUTER)));
1439 }
1440
1441 // limits paper
1442 // maximum is 54 cm
1443
1444 tools::Long nMin = nHHeight + nHDist + nFDist + nFHeight + nBT + nBB +
1445 MINBODY + aBorder.Height();
1446 m_xPaperHeightEdit->set_min(m_xPaperHeightEdit->normalize(nMin), FieldUnit::TWIP);
1447
1448 nMin = MINBODY + nBL + nBR + aBorder.Width();
1449 m_xPaperWidthEdit->set_min(m_xPaperWidthEdit->normalize(nMin), FieldUnit::TWIP);
1450
1451 tools::Long nH = static_cast<tools::Long>(m_xPaperHeightEdit->denormalize(m_xPaperHeightEdit->get_value(FieldUnit::TWIP)));
1452 tools::Long nW = static_cast<tools::Long>(m_xPaperWidthEdit->denormalize(m_xPaperWidthEdit->get_value(FieldUnit::TWIP)));
1453
1454 // Top
1455 tools::Long nMax = nH - nBB - aBorder.Height() - MINBODY -
1456 nFDist - nFHeight - nHDist - nHHeight;
1457
1458 m_xTopMarginEdit->set_max(m_xTopMarginEdit->normalize(nMax), FieldUnit::TWIP);
1459
1460 // Bottom
1461 nMax = nH - nBT - aBorder.Height() - MINBODY -
1462 nFDist - nFHeight - nHDist - nHHeight;
1463
1464 m_xBottomMarginEdit->set_max(m_xTopMarginEdit->normalize(nMax), FieldUnit::TWIP);
1465
1466 // Left
1467 nMax = nW - nBR - MINBODY - aBorder.Width() - nHFLeft - nHFRight;
1468 m_xLeftMarginEdit->set_max(m_xLeftMarginEdit->normalize(nMax), FieldUnit::TWIP);
1469
1470 // Right
1471 nMax = nW - nBL - MINBODY - aBorder.Width() - nHFLeft - nHFRight;
1472 m_xRightMarginEdit->set_max(m_xRightMarginEdit->normalize(nMax), FieldUnit::TWIP);
1473}
1474
1476{
1477 // current values for page margins
1478 tools::Long nBT = GetCoreValue( *m_xTopMarginEdit, MapUnit::MapTwip );
1479 tools::Long nBB = GetCoreValue( *m_xBottomMarginEdit, MapUnit::MapTwip );
1480
1481 tools::Long nBL = GetCoreValue( *m_xLeftMarginEdit, MapUnit::MapTwip );
1482 tools::Long nBR = GetCoreValue( *m_xRightMarginEdit, MapUnit::MapTwip );
1483
1484 tools::Long nH = GetCoreValue( *m_xPaperHeightEdit, MapUnit::MapTwip );
1485 tools::Long nW = GetCoreValue( *m_xPaperWidthEdit, MapUnit::MapTwip );
1486
1487 tools::Long nWidth = nBL + nBR + MINBODY;
1488 tools::Long nHeight = nBT + nBB + MINBODY;
1489
1490 if ( nWidth <= nW && nHeight <= nH )
1491 return;
1492
1493 if ( nWidth > nW )
1494 {
1495 tools::Long nTmp = nBL <= nBR ? nBR : nBL;
1496 nTmp -= nWidth - nW;
1497
1498 if ( nBL <= nBR )
1499 SetMetricValue( *m_xRightMarginEdit, nTmp, MapUnit::MapTwip );
1500 else
1501 SetMetricValue( *m_xLeftMarginEdit, nTmp, MapUnit::MapTwip );
1502 }
1503
1504 if ( nHeight > nH )
1505 {
1506 tools::Long nTmp = nBT <= nBB ? nBB : nBT;
1507 nTmp -= nHeight - nH;
1508
1509 if ( nBT <= nBB )
1510 SetMetricValue( *m_xBottomMarginEdit, nTmp, MapUnit::MapTwip );
1511 else
1512 SetMetricValue( *m_xTopMarginEdit, nTmp, MapUnit::MapTwip );
1513 }
1514}
1515
1517{
1518 m_aBspWin.SetHorz(m_xHorzBox->get_active());
1519 m_aBspWin.SetVert(m_xVertBox->get_active());
1520 UpdateExample_Impl();
1521}
1522
1523void SvxPageDescPage::SetCollectionList(const std::vector<OUString> &aList)
1524{
1525 OSL_ENSURE(!aList.empty(), "Empty string list");
1526
1527 sStandardRegister = aList[0];
1528 m_xRegisterLB->freeze();
1529 for (size_t i = 1; i < aList.size(); ++i)
1530 m_xRegisterLB->append_text(aList[i]);
1531 m_xRegisterLB->thaw();
1532
1533 m_xRegisterCB->show();
1534 m_xRegisterFT->show();
1535 m_xRegisterLB->show();
1536 m_xRegisterCB->connect_toggled(LINK(this, SvxPageDescPage, RegisterModify));
1537}
1538
1539IMPL_LINK(SvxPageDescPage, RegisterModify, weld::Toggleable&, rBox, void)
1540{
1541 bool bEnable = false;
1542 if (rBox.get_active())
1543 {
1544 bEnable = true;
1545 if (m_xRegisterLB->get_active() == -1)
1546 m_xRegisterLB->set_active_text(sStandardRegister);
1547 }
1548 m_xRegisterFT->set_sensitive(bEnable);
1549 m_xRegisterLB->set_sensitive(bEnable);
1550}
1551
1553{
1554 m_xTextFlowBox->remove_id(SvxFrameDirection::Vertical_RL_TB);
1555 m_xTextFlowBox->remove_id(SvxFrameDirection::Vertical_LR_TB);
1556 if (m_xTextFlowBox->get_count() < 2)
1557 {
1558 m_xTextFlowLbl->hide();
1559 m_xTextFlowBox->hide();
1561 }
1562}
1563
1564IMPL_LINK_NOARG(SvxPageDescPage, FrameDirectionModify_Impl, weld::ComboBox&, void)
1565{
1566 m_aBspWin.SetFrameDirection(m_xTextFlowBox->get_active_id());
1567 m_aBspWin.Invalidate();
1568}
1569
1571 weld::MetricSpinButton& rField, tools::Long nFirstMargin, tools::Long nLastMargin, MarginPosition nPos )
1572{
1573 bool bRet = false;
1574 bool bCheck = ( ( m_nPos & nPos ) == 0 );
1575 tools::Long nValue = rField.get_value(FieldUnit::NONE);
1576 if ( bCheck &&
1577 ( nValue < nFirstMargin || nValue > nLastMargin ) &&
1579 {
1580 rField.set_value(nValue < nFirstMargin ? nFirstMargin : nLastMargin, FieldUnit::NONE);
1581 bRet = true;
1582 }
1583
1584 return bRet;
1585}
1586
1591{
1592 if ( _bClear )
1593 m_nPos = 0;
1594
1595 sal_Int64 nValue = m_xLeftMarginEdit->get_value(FieldUnit::NONE);
1596 if ( nValue < nFirstLeftMargin || nValue > nLastLeftMargin )
1598 nValue = m_xRightMarginEdit->get_value(FieldUnit::NONE);
1599 if ( nValue < nFirstRightMargin || nValue > nLastRightMargin )
1601 nValue = m_xTopMarginEdit->get_value(FieldUnit::NONE);
1602 if ( nValue < nFirstTopMargin || nValue > nLastTopMargin )
1603 m_nPos |= MARGIN_TOP;
1604 nValue = m_xBottomMarginEdit->get_value(FieldUnit::NONE);
1605 if ( nValue < nFirstBottomMargin || nValue > nLastBottomMargin )
1607}
1608
1610{
1611 bool bRet = ( ( ( !( m_nPos & MARGIN_LEFT ) &&
1612 m_xLeftMarginEdit->get_value_changed_from_saved() ) &&
1613 ( m_xLeftMarginEdit->get_value(FieldUnit::NONE) < nFirstLeftMargin ||
1614 m_xLeftMarginEdit->get_value(FieldUnit::NONE) > nLastLeftMargin ) ) ||
1615 ( ( !( m_nPos & MARGIN_RIGHT ) &&
1616 m_xRightMarginEdit->get_value_changed_from_saved() ) &&
1617 ( m_xRightMarginEdit->get_value(FieldUnit::NONE) < nFirstRightMargin ||
1618 m_xRightMarginEdit->get_value(FieldUnit::NONE) > nLastRightMargin ) ) ||
1619 ( ( !( m_nPos & MARGIN_TOP ) &&
1620 m_xTopMarginEdit->get_value_changed_from_saved() ) &&
1621 ( m_xTopMarginEdit->get_value(FieldUnit::NONE) < nFirstTopMargin ||
1622 m_xTopMarginEdit->get_value(FieldUnit::NONE) > nLastTopMargin ) ) ||
1623 ( ( !( m_nPos & MARGIN_BOTTOM ) &&
1624 m_xBottomMarginEdit->get_value_changed_from_saved() ) &&
1625 ( m_xBottomMarginEdit->get_value(FieldUnit::NONE) < nFirstBottomMargin ||
1626 m_xBottomMarginEdit->get_value(FieldUnit::NONE) > nLastBottomMargin ) ) );
1627 return bRet;
1628}
1629
1631{
1632 const SfxUInt16Item* pModeItem = aSet.GetItem(SID_ENUM_PAGE_MODE, false);
1633 const SfxUInt16Item* pPaperStartItem = aSet.GetItem(SID_PAPER_START, false);
1634 const SfxUInt16Item* pPaperEndItem = aSet.GetItem(SID_PAPER_END, false);
1635 const SfxStringListItem* pCollectListItem = aSet.GetItem<SfxStringListItem>(SID_COLLECT_LIST, false);
1636 const SfxBoolItem* pSupportDrawingLayerFillStyleItem = aSet.GetItem<SfxBoolItem>(SID_DRAWINGLAYER_FILLSTYLES, false);
1637 const SfxBoolItem* pIsImpressDoc = aSet.GetItem<SfxBoolItem>(SID_IMPRESS_DOC, false);
1638
1639 if (pModeItem)
1640 {
1641 eMode = static_cast<SvxModeType>(pModeItem->GetValue());
1642 }
1643
1644 if(pPaperStartItem && pPaperEndItem)
1645 {
1646 SetPaperFormatRanges(static_cast<Paper>(pPaperStartItem->GetValue()));
1647 }
1648
1649 if(pCollectListItem)
1650 {
1651 SetCollectionList(pCollectListItem->GetList());
1652 }
1653
1654 if(pSupportDrawingLayerFillStyleItem)
1655 {
1656 const bool bNew(pSupportDrawingLayerFillStyleItem->GetValue());
1657
1659 }
1660
1661 if (pIsImpressDoc)
1662 m_xNumberFormatText->set_label(SvxResId(STR_SLIDE_NUMBERS));
1663}
1664
1665/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define GetWhich(nSlot)
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, const ILibreOfficeKitNotifier *pNotifier=nullptr)
sal_uInt16 GetValue() const
SAL_WARN_UNUSED_RESULT Point LogicToLogic(const Point &rPtSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
constexpr tools::Long Y() const
constexpr tools::Long X() const
bool GetValue() const
virtual SfxBoolItem * Clone(SfxItemPool *=nullptr) const override
const std::map< OUString, css::uno::Any > & GetGrabBag() const
virtual MapUnit GetMetric(sal_uInt16 nWhich) const
SfxItemPool * GetPool() const
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
bool HasItem(sal_uInt16 nWhich, const SfxPoolItem **ppItem=nullptr) const
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
static SAL_WARN_UNUSED_RESULT SfxObjectShell * Current()
std::vector< OUString > & GetList()
const SfxItemSet & GetItemSet() const
void SetExchangeSupport()
void SetUserData(const OUString &rString)
static const SfxPoolItem * GetItem(const SfxItemSet &rSet, sal_uInt16 nSlot, bool bDeep=true)
const SfxPoolItem * GetOldItem(const SfxItemSet &rSet, sal_uInt16 nSlot, bool bDeep=true)
weld::Window * GetFrameWeld() const
sal_uInt16 GetWhich(sal_uInt16 nSlot, bool bDeep=true) const
virtual SfxPrinter * GetPrinter(bool bCreate=false)
static SAL_WARN_UNUSED_RESULT SfxViewShell * Current()
constexpr tools::Long Height() const
tools::Long AdjustHeight(tools::Long n)
void setWidth(tools::Long nWidth)
tools::Long AdjustWidth(tools::Long n)
void setHeight(tools::Long nHeight)
constexpr tools::Long Width() const
static bool IsCTLFontEnabled()
sal_Int16 CalcLineSpace(SvxBoxItemLine nLine, bool bEvenIfNoLine=false, bool bAllowNegative=false) const
void SetGutterMargin(const tools::Long nGutterMargin)
void SetRight(const tools::Long nR, const sal_uInt16 nProp=100)
tools::Long GetRight() const
tools::Long GetGutterMargin() const
tools::Long GetLeft() const
void SetLeft(const tools::Long nL, const sal_uInt16 nProp=100)
static void GetI18nNumbering(weld::ComboBox &rFmtLB, sal_uInt16 nDoNotRemove)
std::unique_ptr< weld::ComboBox > m_xGutterPositionLB
Definition: page.hxx:125
OUString sStandardRegister
Definition: page.hxx:68
std::unique_ptr< weld::CheckButton > m_xRtlGutterCB
Definition: page.hxx:126
std::unique_ptr< weld::RadioButton > m_xPortraitBtn
Definition: page.hxx:95
std::unique_ptr< weld::Label > m_xGutterPositionFT
Definition: page.hxx:124
tools::Long nFirstTopMargin
Definition: page.hxx:71
std::unique_ptr< weld::Label > m_xPageText
Definition: page.hxx:110
std::unique_ptr< weld::CheckButton > m_xVertBox
Definition: page.hxx:117
tools::Long nFirstLeftMargin
Definition: page.hxx:69
std::unique_ptr< weld::MetricSpinButton > m_xPaperHeightEdit
Definition: page.hxx:94
tools::Long nFirstRightMargin
Definition: page.hxx:70
virtual ~SvxPageDescPage() override
Definition: page.cxx:295
virtual bool FillItemSet(SfxItemSet *rOutSet) override
Definition: page.cxx:617
std::unique_ptr< SvxPageNumberListBox > m_xNumberFormatBox
Definition: page.hxx:113
std::unique_ptr< weld::Label > m_xPrintRangeQueryText
Definition: page.hxx:130
bool mbDelPrinter
Definition: page.hxx:86
MarginPosition m_nPos
Definition: page.hxx:83
std::unique_ptr< weld::Label > m_xGutterMarginLbl
Definition: page.hxx:107
std::unique_ptr< weld::Label > m_xRegisterFT
Definition: page.hxx:122
tools::Long nLastTopMargin
Definition: page.hxx:75
std::unique_ptr< weld::ComboBox > m_xPaperTrayBox
Definition: page.hxx:99
std::unique_ptr< weld::Label > m_xNumberFormatText
Definition: page.hxx:112
bool bBorderModified
Definition: page.hxx:79
std::unique_ptr< weld::ComboBox > m_xRegisterLB
Definition: page.hxx:123
void InitHeadFoot_Impl(const SfxItemSet &rSet)
Definition: page.cxx:1227
SvxPageWindow m_aBspWin
Definition: page.hxx:89
std::unique_ptr< weld::MetricSpinButton > m_xBottomMarginEdit
Definition: page.hxx:106
std::unique_ptr< weld::CheckButton > m_xRegisterCB
Definition: page.hxx:121
void DisableVerticalPageDir()
Disables vertical page direction entries in the text flow listbox.
Definition: page.cxx:1552
virtual void ActivatePage(const SfxItemSet &rSet) override
Definition: page.cxx:1346
std::unique_ptr< weld::CheckButton > m_xHorzBox
Definition: page.hxx:116
tools::Long nLastLeftMargin
Definition: page.hxx:73
std::unique_ptr< SvxPaperSizeListBox > m_xPaperSizeBox
Definition: page.hxx:92
void SetPaperFormatRanges(Paper eStart)
Definition: page.hxx:181
bool mbEnableDrawingLayerFillStyles
Definition: page.hxx:87
bool bLandscape
Definition: page.hxx:78
tools::Long nFirstBottomMargin
Definition: page.hxx:72
VclPtr< Printer > mpDefPrinter
Definition: page.hxx:84
std::unique_ptr< weld::Label > m_xTextFlowLbl
Definition: page.hxx:97
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
Definition: page.cxx:1354
void CalcMargin_Impl()
Definition: page.cxx:1475
bool IsMarginOutOfRange() const
Definition: page.cxx:1609
virtual void Reset(const SfxItemSet *rSet) override
Definition: page.cxx:327
SvxModeType eMode
Definition: page.hxx:80
std::unique_ptr< weld::MetricSpinButton > m_xLeftMarginEdit
Definition: page.hxx:102
void RangeHdl_Impl()
Definition: page.cxx:1409
tools::Long nLastBottomMargin
Definition: page.hxx:76
SvxPageDescPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
Definition: page.cxx:140
void CheckMarginEdits(bool _bClear)
Check if a value of a margin edit is outside the printer paper margins and save this information.
Definition: page.cxx:1590
std::unique_ptr< weld::CheckButton > m_xAdaptBox
Definition: page.hxx:119
std::unique_ptr< weld::Label > m_xTblAlignFT
Definition: page.hxx:115
tools::Long nLastRightMargin
Definition: page.hxx:74
void UpdateExample_Impl(bool bResetbackground=false)
Definition: page.cxx:1095
std::unique_ptr< svx::FrameDirectionListBox > m_xTextFlowBox
Definition: page.hxx:98
std::unique_ptr< weld::MetricSpinButton > m_xTopMarginEdit
Definition: page.hxx:105
void Init_Impl()
Definition: page.cxx:304
static const WhichRangesContainer pRanges
Definition: page.hxx:66
void SetCollectionList(const std::vector< OUString > &aList)
Definition: page.cxx:1523
void SwapFirstValues_Impl(bool bSet)
Definition: page.cxx:1027
void ResetBackground_Impl(const SfxItemSet &rSet)
Definition: page.cxx:1128
virtual void PageCreated(const SfxAllItemSet &aSet) override
Definition: page.cxx:1630
std::unique_ptr< weld::RadioButton > m_xLandscapeBtn
Definition: page.hxx:96
std::unique_ptr< weld::CheckButton > m_xBackgroundFullSizeCB
Definition: page.hxx:127
Paper ePaperStart
Definition: page.hxx:81
std::unique_ptr< weld::MetricSpinButton > m_xGutterMarginEdit
Definition: page.hxx:108
virtual void FillUserData() override
Definition: page.cxx:610
std::unique_ptr< weld::MetricSpinButton > m_xPaperWidthEdit
Definition: page.hxx:93
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rSet)
Definition: page.cxx:135
std::unique_ptr< weld::MetricSpinButton > m_xRightMarginEdit
Definition: page.hxx:104
bool IsPrinterRangeOverflow(weld::MetricSpinButton &rField, tools::Long nFirstMargin, tools::Long nLastMargin, MarginPosition nPos)
Definition: page.cxx:1570
std::unique_ptr< weld::ComboBox > m_xLayoutBox
Definition: page.hxx:111
void SetNumType(SvxNumType eNum)
SvxNumType GetNumType() const
void SetLandscape(bool bL)
void SetPageUsage(SvxPageUsage eU)
SvxPageUsage GetPageUsage() const
bool IsLandscape() const
void SetFrameDirection(SvxFrameDirection nDirection)
void setHeaderFillAttributes(const drawinglayer::attribute::SdrAllFillAttributesHelperPtr &rFillAttributes)
void SetUsage(SvxPageUsage eU)
void SetBottom(tools::Long nNew)
tools::Long GetFtDist() const
void SetHdLeft(tools::Long nNew)
void ResetBackground()
void SetHdHeight(tools::Long nNew)
void SetTable(bool bNew)
void SetHorz(bool bNew)
tools::Long GetHdLeft() const
void setPageFillAttributes(const drawinglayer::attribute::SdrAllFillAttributesHelperPtr &rFillAttributes)
void SetFtDist(tools::Long nNew)
void SetSize(const Size &rSize)
tools::Long GetHdRight() const
void SetLeft(tools::Long nNew)
void SetHdDist(tools::Long nNew)
void SetFtLeft(tools::Long nNew)
void SetFtRight(tools::Long nNew)
tools::Long GetFtRight() const
void SetHdRight(tools::Long nNew)
void setFooterFillAttributes(const drawinglayer::attribute::SdrAllFillAttributesHelperPtr &rFillAttributes)
tools::Long GetFtLeft() const
void SetFooter(bool bNew)
tools::Long GetHdHeight() const
void SetVert(bool bNew)
void SetFtHeight(tools::Long nNew)
tools::Long GetHdDist() const
void EnableFrameDirection(bool bEnable)
void SetHeader(bool bNew)
tools::Long GetFtHeight() const
void SetTop(tools::Long nNew)
void SetRight(tools::Long nNew)
static Paper GetSvxPaper(const Size &rSize, MapUnit eUnit)
static Size GetPaperSize(Paper ePaper, MapUnit eUnit=MapUnit::MapTwip)
sal_uInt16 CalcShadowSpace(SvxShadowItemSide nShadow) const
const Size & GetSize() const
void SetLower(const sal_uInt16 nL, const sal_uInt16 nProp=100)
sal_uInt16 GetUpper() const
void SetUpper(const sal_uInt16 nU, const sal_uInt16 nProp=100)
sal_uInt16 GetLower() const
void disposeAndClear()
static VclPtr< reference_type > Create(Arg &&... arg)
void set_value(sal_Int64 nValue, FieldUnit eValueUnit)
bool get_value_changed_from_saved() const
sal_Int64 get_value(FieldUnit eDestUnit) const
#define DBG_ASSERT(sCon, aError)
SVXCORE_DLLPUBLIC OUString SvxResId(TranslateId aId)
virtual tools::Long GetValue() const override
SVXCORE_DLLPUBLIC FieldUnit GetModuleFieldUnit(const SfxItemSet &)
OUString EditResId(TranslateId aId)
size_t m_nPos
SvxModeType
SVX_PAGE_MODE_STANDARD
SVX_PAGE_MODE_PRESENTATION
SVX_PAGE_MODE_CENTER
FieldUnit
sal_Int16 nValue
SvxFrameDirection
HTMLMODE_ON
OUString aName
Mode eMode
sal_uInt16 nPos
#define SAL_WARN_IF(condition, area, stream)
MapUnit
const SfxItemSet * GetItemSet(const SfxPoolItem &rAttr)
bool IsAsianTypographyEnabled()
sal_uInt32 GetMaximumPaperLeftMargin()
sal_uInt32 GetMaximumPaperHeight()
sal_uInt32 GetMaximumPaperBottomMargin()
sal_uInt32 GetMaximumPaperWidth()
sal_uInt32 GetMaximumPaperTopMargin()
sal_uInt32 GetMaximumPaperRightMargin()
std::shared_ptr< SdrAllFillAttributesHelper > SdrAllFillAttributesHelperPtr
int i
constexpr auto toTwips(N number, Length from)
static constexpr auto Items
long Long
static Size GetMinBorderSpace_Impl(const SvxShadowItem &rShadow, const SvxBoxItem &rBox)
Definition: page.cxx:98
static sal_uInt16 PageUsageToPos_Impl(SvxPageUsage nUsage)
Definition: page.cxx:81
#define MARGIN_RIGHT
Definition: page.cxx:129
static bool IsEqualSize_Impl(const SvxSizeItem *pSize, const Size &rSize)
Definition: page.cxx:114
#define MARGIN_LEFT
Definition: page.cxx:128
#define MARGIN_TOP
Definition: page.cxx:130
static tools::Long ConvertLong_Impl(const tools::Long nIn, MapUnit eUnit)
Definition: page.cxx:109
IMPL_LINK_NOARG(SvxPageDescPage, LayoutHdl_Impl, weld::ComboBox &, void)
Definition: page.cxx:875
constexpr tools::Long MINBODY
Definition: page.cxx:63
const SvxPageUsage aArr[]
Definition: page.cxx:72
IMPL_LINK(SvxPageDescPage, SwapOrientation_Impl, weld::Toggleable &, rBtn, void)
Definition: page.cxx:1004
#define MARGIN_BOTTOM
Definition: page.cxx:131
static SvxPageUsage PosToPageUsage_Impl(sal_uInt16 nPos)
Definition: page.cxx:90
sal_uInt16 MarginPosition
Definition: page.hxx:62
SvxPageUsage
Paper
PAPER_SCREEN_16_9
PAPER_ONSCREENSHOW_16_9
PAPER_USER
PAPER_SCREEN_4_3
PAPER_WIDESCREEN
PAPER_ONSCREENSHOW_16_10
PAPER_A3
PAPER_SCREEN_16_10
PAPER_ONSCREENSHOW_4_3
Size & Swap(Size &rSize)
#define PAPERBIN_PRINTER_SETTINGS
SfxItemState
Orientation
static SfxItemSet & rSet
SvxNumType
SVX_NUM_ARABIC
DeactivateRC
unsigned char sal_uInt8
SVT_DLLPUBLIC sal_Int64 GetCoreValue(const weld::MetricSpinButton &rField, MapUnit eUnit)
SVT_DLLPUBLIC void SetMetricValue(weld::MetricSpinButton &rField, sal_Int64 nCoreValue, MapUnit eUnit)
SVT_DLLPUBLIC void SetFieldUnit(weld::MetricSpinButton &rCtrl, FieldUnit eUnit, bool bAll=false)
SVXCORE_DLLPUBLIC void setSvxBrushItemAsFillAttributesToTargetSet(const SvxBrushItem &rBrush, SfxItemSet &rToSet)
RET_NO