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