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 
31 #include <svx/strings.hrc>
32 #include <svx/dialmgr.hxx>
33 #include <page.hxx>
34 #include <svx/pageitem.hxx>
35 #include <editeng/brushitem.hxx>
36 #include <editeng/boxitem.hxx>
37 #include <editeng/shaditem.hxx>
38 #include <editeng/pbinitem.hxx>
39 #include <editeng/lrspitem.hxx>
40 #include <editeng/ulspitem.hxx>
41 #include <editeng/sizeitem.hxx>
42 #include <editeng/frmdiritem.hxx>
43 #include <svx/dlgutil.hxx>
44 #include <editeng/paperinf.hxx>
45 #include <svl/stritem.hxx>
46 #include <editeng/eerdll.hxx>
47 #include <editeng/editrids.hrc>
48 #include <svx/svxids.hrc>
50 #include <svl/slstitm.hxx>
51 #include <svx/xdef.hxx>
54 
55 // static ----------------------------------------------------------------
56 
57 // #i19922# - tdf#126051 see svx/source/dialog/hdft.cxx and sw/source/uibase/sidebar/PageMarginControl.hxx
58 static const long MINBODY = 56; // 1mm in twips rounded
59 
60 const sal_uInt16 SvxPageDescPage::pRanges[] =
61 {
62  SID_ATTR_BORDER_OUTER,
63  SID_ATTR_BORDER_SHADOW,
64  SID_ATTR_LRSPACE,
65  SID_ATTR_PAGE_SHARED,
66  SID_SWREGISTER_COLLECTION,
67  SID_SWREGISTER_MODE,
68  0
69 };
70 // ------- Mapping page layout ------------------------------------------
71 
72 const SvxPageUsage aArr[] =
73 {
74  SvxPageUsage::All,
75  SvxPageUsage::Mirror,
76  SvxPageUsage::Right,
77  SvxPageUsage::Left
78 };
79 
80 
81 static sal_uInt16 PageUsageToPos_Impl( SvxPageUsage nUsage )
82 {
83  for ( size_t i = 0; i < SAL_N_ELEMENTS(aArr); ++i )
84  if ( aArr[i] == nUsage )
85  return i;
86  return 3;
87 }
88 
89 
90 static SvxPageUsage PosToPageUsage_Impl( sal_uInt16 nPos )
91 {
92  if ( nPos >= SAL_N_ELEMENTS(aArr) )
93  return SvxPageUsage::NONE;
94  return aArr[nPos];
95 }
96 
97 
98 static 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 
109 static long ConvertLong_Impl( const long nIn, MapUnit eUnit )
110 {
111  return OutputDevice::LogicToLogic( nIn, eUnit, MapUnit::MapTwip );
112 }
113 
114 static bool IsEqualSize_Impl( const SvxSizeItem* pSize, const Size& rSize )
115 {
116  if ( pSize )
117  {
118  Size aSize = pSize->GetSize();
119  long nDiffW = std::abs( rSize.Width () - aSize.Width () );
120  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 
135 std::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_xOrientationFT(m_xBuilder->weld_label("labelOrientation"))
153  , m_xPortraitBtn(m_xBuilder->weld_radio_button("radiobuttonPortrait"))
154  , m_xLandscapeBtn(m_xBuilder->weld_radio_button("radiobuttonLandscape"))
155  , m_xTextFlowLbl(m_xBuilder->weld_label("labelTextFlow"))
156  , m_xTextFlowBox(new svx::FrameDirectionListBox(m_xBuilder->weld_combo_box("comboTextFlowBox")))
157  , m_xPaperTrayBox(m_xBuilder->weld_combo_box("comboPaperTray"))
158  , m_xLeftMarginLbl(m_xBuilder->weld_label("labelLeftMargin"))
159  , m_xLeftMarginEdit(m_xBuilder->weld_metric_spin_button("spinMargLeft", FieldUnit::CM))
160  , m_xRightMarginLbl(m_xBuilder->weld_label("labelRightMargin"))
161  , m_xRightMarginEdit(m_xBuilder->weld_metric_spin_button("spinMargRight", FieldUnit::CM))
162  , m_xTopMarginEdit(m_xBuilder->weld_metric_spin_button("spinMargTop", FieldUnit::CM))
163  , m_xBottomMarginEdit(m_xBuilder->weld_metric_spin_button("spinMargBot", FieldUnit::CM))
164  , m_xPageText(m_xBuilder->weld_label("labelPageLayout"))
165  , m_xLayoutBox(m_xBuilder->weld_combo_box("comboPageLayout"))
166  , m_xNumberFormatText(m_xBuilder->weld_label("labelPageNumbers"))
167  , m_xNumberFormatBox(new SvxPageNumberListBox(m_xBuilder->weld_combo_box("comboLayoutFormat")))
168  , m_xTblAlignFT(m_xBuilder->weld_label("labelTblAlign"))
169  , m_xHorzBox(m_xBuilder->weld_check_button("checkbuttonHorz"))
170  , m_xVertBox(m_xBuilder->weld_check_button("checkbuttonVert"))
171  , m_xAdaptBox(m_xBuilder->weld_check_button("checkAdaptBox"))
172  , m_xRegisterCB(m_xBuilder->weld_check_button("checkRegisterTrue"))
173  , m_xRegisterFT(m_xBuilder->weld_label("labelRegisterStyle"))
174  , m_xRegisterLB(m_xBuilder->weld_combo_box("comboRegisterStyle"))
175  // Strings stored in UI
176  , m_xInsideLbl(m_xBuilder->weld_label("labelInner"))
177  , m_xOutsideLbl(m_xBuilder->weld_label("labelOuter"))
178  , m_xPrintRangeQueryText(m_xBuilder->weld_label("labelMsg"))
179  , m_xBspWin(new weld::CustomWeld(*m_xBuilder, "drawingareaPageDirection", m_aBspWin))
180 {
181  m_xRegisterLB->set_size_request(m_xRegisterLB->get_approximate_digit_width() * 20, -1);
182 
183  bBorderModified = false;
184  m_aBspWin.EnableRTL(false);
185 
186  // this page needs ExchangeSupport
188 
189  SvtLanguageOptions aLangOptions;
190  bool bCJK = aLangOptions.IsAsianTypographyEnabled();
191  bool bCTL = aLangOptions.IsCTLFontEnabled();
192  bool bWeb = false;
193  const SfxPoolItem* pItem;
194 
195  SfxObjectShell* pShell;
196  if(SfxItemState::SET == rAttr.GetItemState(SID_HTML_MODE, false, &pItem) ||
197  ( nullptr != (pShell = SfxObjectShell::Current()) &&
198  nullptr != (pItem = pShell->GetItem(SID_HTML_MODE))))
199  bWeb = 0 != (static_cast<const SfxUInt16Item*>(pItem)->GetValue() & HTMLMODE_ON);
200 
201  // fill text flow listbox with valid entries
202 
203  m_xTextFlowBox->append(SvxFrameDirection::Horizontal_LR_TB, SvxResId(RID_SVXSTR_PAGEDIR_LTR_HORI));
204 
205  if (bCTL)
206  m_xTextFlowBox->append(SvxFrameDirection::Horizontal_RL_TB, SvxResId(RID_SVXSTR_PAGEDIR_RTL_HORI));
207 
208 
209  // #109989# do not show vertical directions in Writer/Web
210  if( !bWeb && bCJK )
211  {
212  m_xTextFlowBox->append(SvxFrameDirection::Vertical_RL_TB, SvxResId(RID_SVXSTR_PAGEDIR_RTL_VERT));
213  m_xTextFlowBox->append(SvxFrameDirection::Vertical_LR_TB, SvxResId(RID_SVXSTR_PAGEDIR_LTR_VERT));
214  }
215 
216  // #109989# show the text direction box in Writer/Web too
217  if( (bCJK || bCTL) &&
218  SfxItemState::UNKNOWN < rAttr.GetItemState(GetWhich( SID_ATTR_FRAMEDIRECTION )))
219  {
220  m_xTextFlowLbl->show();
221  m_xTextFlowBox->show();
222  m_xTextFlowBox->connect_changed(LINK(this, SvxPageDescPage, FrameDirectionModify_Impl));
223 
225  }
226  Init_Impl();
227 
228  FieldUnit eFUnit = GetModuleFieldUnit( rAttr );
229  SetFieldUnit( *m_xLeftMarginEdit, eFUnit );
230  SetFieldUnit( *m_xRightMarginEdit, eFUnit );
231  SetFieldUnit( *m_xTopMarginEdit, eFUnit );
232  SetFieldUnit( *m_xBottomMarginEdit, eFUnit );
233  SetFieldUnit( *m_xPaperWidthEdit, eFUnit );
234  SetFieldUnit( *m_xPaperHeightEdit, eFUnit );
235 
236  if ( SfxViewShell::Current() && SfxViewShell::Current()->GetPrinter() )
237  {
239  }
240  else
241  {
243  mbDelPrinter = true;
244  }
245 
246  MapMode aOldMode = mpDefPrinter->GetMapMode();
247  mpDefPrinter->SetMapMode(MapMode(MapUnit::MapTwip));
248 
249  // set first- and last-values for the margins
250  Size aPaperSize = mpDefPrinter->GetPaperSize();
251  Size aPrintSize = mpDefPrinter->GetOutputSize();
252 
253  /*
254  * To convert a point ( 0,0 ) into logic coordinates
255  * looks like nonsense; but it makes sense when the
256  * coordinate system's origin has been moved.
257  */
259  mpDefPrinter->SetMapMode( aOldMode );
260 
261  nFirstLeftMargin = m_xLeftMarginEdit->convert_value_from(m_xLeftMarginEdit->normalize(aPrintOffset.X()), FieldUnit::TWIP);
262  nFirstRightMargin = m_xRightMarginEdit->convert_value_from(m_xRightMarginEdit->normalize(aPaperSize.Width() - aPrintSize.Width() - aPrintOffset.X()), FieldUnit::TWIP);
263  nFirstTopMargin = m_xTopMarginEdit->convert_value_from(m_xTopMarginEdit->normalize(aPrintOffset.Y() ), FieldUnit::TWIP);
264  nFirstBottomMargin = m_xBottomMarginEdit->convert_value_from(m_xBottomMarginEdit->normalize(aPaperSize.Height() - aPrintSize.Height() - aPrintOffset.Y()), FieldUnit::TWIP );
265  nLastLeftMargin = m_xLeftMarginEdit->convert_value_from(m_xLeftMarginEdit->normalize(aPrintOffset.X() + aPrintSize.Width()), FieldUnit::TWIP);
266  nLastRightMargin = m_xRightMarginEdit->convert_value_from(m_xRightMarginEdit->normalize(aPrintOffset.X() + aPrintSize.Width()), FieldUnit::TWIP);
267  nLastTopMargin = m_xTopMarginEdit->convert_value_from(m_xTopMarginEdit->normalize(aPrintOffset.Y() + aPrintSize.Height()), FieldUnit::TWIP);
268  nLastBottomMargin = m_xBottomMarginEdit->convert_value_from(m_xBottomMarginEdit->normalize(aPrintOffset.Y() + aPrintSize.Height()), FieldUnit::TWIP);
269 
270  // #i4219# get DrawingLayer options
271  const SvtOptionsDrawinglayer aDrawinglayerOpt;
272 
273  // #i4219# take Maximum now from configuration (1/100th cm)
274  // was: 11900 -> 119 cm ;new value 3 meters -> 300 cm -> 30000
275  m_xPaperWidthEdit->set_max(m_xPaperWidthEdit->normalize(aDrawinglayerOpt.GetMaximumPaperWidth()), FieldUnit::CM);
276  m_xPaperHeightEdit->set_max(m_xPaperHeightEdit->normalize(aDrawinglayerOpt.GetMaximumPaperHeight()), FieldUnit::CM);
277 
278  // #i4219# also for margins (1/100th cm). Was: 9999, keeping.
279  m_xLeftMarginEdit->set_max(m_xLeftMarginEdit->normalize(aDrawinglayerOpt.GetMaximumPaperLeftMargin()), FieldUnit::MM);
280  m_xRightMarginEdit->set_max(m_xRightMarginEdit->normalize(aDrawinglayerOpt.GetMaximumPaperRightMargin()), FieldUnit::MM);
281  m_xTopMarginEdit->set_max(m_xTopMarginEdit->normalize(aDrawinglayerOpt.GetMaximumPaperTopMargin()), FieldUnit::MM);
282  m_xBottomMarginEdit->set_max(m_xBottomMarginEdit->normalize(aDrawinglayerOpt.GetMaximumPaperBottomMargin()), FieldUnit::MM);
283 
284  // Get the i18n framework numberings and add them to the listbox.
285  SvxNumOptionsTabPageHelper::GetI18nNumbering(m_xNumberFormatBox->get_widget(), std::numeric_limits<sal_uInt16>::max());
286 }
287 
289 {
290  if(mbDelPrinter)
291  {
293  mbDelPrinter = false;
294  }
295 }
296 
298 {
299  // adjust the handler
300  m_xLayoutBox->connect_changed(LINK(this, SvxPageDescPage, LayoutHdl_Impl));
301 
302  m_xPaperSizeBox->connect_changed(LINK(this, SvxPageDescPage, PaperSizeSelect_Impl));
303  m_xPaperWidthEdit->connect_value_changed( LINK(this, SvxPageDescPage, PaperSizeModify_Impl));
304  m_xPaperHeightEdit->connect_value_changed(LINK(this, SvxPageDescPage, PaperSizeModify_Impl));
305  m_xLandscapeBtn->connect_clicked(LINK(this, SvxPageDescPage, SwapOrientation_Impl));
306  m_xPortraitBtn->connect_clicked(LINK(this, SvxPageDescPage, SwapOrientation_Impl));
307 
308  Link<weld::MetricSpinButton&, void> aLink = LINK(this, SvxPageDescPage, BorderModify_Impl);
309  m_xLeftMarginEdit->connect_value_changed(aLink);
310  m_xRightMarginEdit->connect_value_changed(aLink);
311  m_xTopMarginEdit->connect_value_changed(aLink);
312  m_xBottomMarginEdit->connect_value_changed(aLink);
313 
314  m_xHorzBox->connect_toggled(LINK(this, SvxPageDescPage, CenterHdl_Impl));
315  m_xVertBox->connect_toggled(LINK(this, SvxPageDescPage, CenterHdl_Impl));
316 }
317 
319 {
320  SfxItemPool* pPool = rSet->GetPool();
321  DBG_ASSERT( pPool, "Where is the pool?" );
322  MapUnit eUnit = pPool->GetMetric( GetWhich( SID_ATTR_LRSPACE ) );
323 
324  // adjust margins (right/left)
325  const SfxPoolItem* pItem = GetItem( *rSet, SID_ATTR_LRSPACE );
326 
327  if ( pItem )
328  {
329  const SvxLRSpaceItem& rLRSpace = static_cast<const SvxLRSpaceItem&>(*pItem);
330  SetMetricValue( *m_xLeftMarginEdit, rLRSpace.GetLeft(), eUnit );
332  static_cast<sal_uInt16>(ConvertLong_Impl( rLRSpace.GetLeft(), eUnit )) );
333  SetMetricValue( *m_xRightMarginEdit, rLRSpace.GetRight(), eUnit );
335  static_cast<sal_uInt16>(ConvertLong_Impl( rLRSpace.GetRight(), eUnit )) );
336  }
337 
338  // adjust margins (top/bottom)
339  pItem = GetItem( *rSet, SID_ATTR_ULSPACE );
340 
341  if ( pItem )
342  {
343  const SvxULSpaceItem& rULSpace = static_cast<const SvxULSpaceItem&>(*pItem);
344  SetMetricValue( *m_xTopMarginEdit, rULSpace.GetUpper(), eUnit );
346  static_cast<sal_uInt16>(ConvertLong_Impl( static_cast<long>(rULSpace.GetUpper()), eUnit )) );
347  SetMetricValue( *m_xBottomMarginEdit, rULSpace.GetLower(), eUnit );
349  static_cast<sal_uInt16>(ConvertLong_Impl( static_cast<long>(rULSpace.GetLower()), eUnit )) );
350  }
351 
352  // general page data
353  SvxNumType eNumType = SVX_NUM_ARABIC;
354  bLandscape = ( mpDefPrinter->GetOrientation() == Orientation::Landscape );
355  SvxPageUsage nUse = SvxPageUsage::All;
356  pItem = GetItem( *rSet, SID_ATTR_PAGE );
357 
358  if ( pItem )
359  {
360  const SvxPageItem& rItem = static_cast<const SvxPageItem&>(*pItem);
361  eNumType = rItem.GetNumType();
362  nUse = rItem.GetPageUsage();
363  bLandscape = rItem.IsLandscape();
364  }
365 
366  // alignment
367  m_xLayoutBox->set_active(::PageUsageToPos_Impl(nUse));
368  m_aBspWin.SetUsage( nUse );
369  LayoutHdl_Impl( *m_xLayoutBox );
370 
371  //adjust numeration type of the page style
372  m_xNumberFormatBox->set_active_id(eNumType);
373 
374  m_xPaperTrayBox->clear();
376  pItem = GetItem( *rSet, SID_ATTR_PAGE_PAPERBIN );
377 
378  if ( pItem )
379  {
380  nPaperBin = static_cast<const SvxPaperBinItem*>(pItem)->GetValue();
381 
382  if ( nPaperBin >= mpDefPrinter->GetPaperBinCount() )
383  nPaperBin = PAPERBIN_PRINTER_SETTINGS;
384  }
385 
386  OUString aBinName;
387 
388  if ( PAPERBIN_PRINTER_SETTINGS == nPaperBin )
389  aBinName = EditResId(RID_SVXSTR_PAPERBIN_SETTINGS);
390  else
391  aBinName = mpDefPrinter->GetPaperBinName( static_cast<sal_uInt16>(nPaperBin) );
392 
393  m_xPaperTrayBox->append(OUString::number(nPaperBin), aBinName);
394  m_xPaperTrayBox->set_active_text(aBinName);
395  // reset focus handler to default first so know none already connected
396  m_xPaperTrayBox->connect_focus_in(Link<weld::Widget&, void>());
397  // update the list when widget gets focus
398  m_xPaperTrayBox->connect_focus_in(LINK(this, SvxPageDescPage, PaperBinHdl_Impl));
399 
401  pItem = GetItem( *rSet, SID_ATTR_PAGE_SIZE );
402 
403  if ( pItem )
404  aPaperSize = static_cast<const SvxSizeItem*>(pItem)->GetSize();
405 
406  bool bOrientationSupport =
407  mpDefPrinter->HasSupport( PrinterSupport::SetOrientation );
408 
409  if ( !bOrientationSupport &&
410  aPaperSize.Width() > aPaperSize.Height() )
411  bLandscape = true;
412 
413  // tdf#130548 disable callbacks on the other of a pair of the radiogroup
414  // when toggling its partner
415  m_xLandscapeBtn->connect_clicked(Link<weld::Button&, void>());
416  m_xPortraitBtn->connect_clicked(Link<weld::Button&, void>());
417 
418  m_xLandscapeBtn->set_active(bLandscape);
419  m_xPortraitBtn->set_active(!bLandscape);
420 
421  m_xLandscapeBtn->connect_clicked(LINK(this, SvxPageDescPage, SwapOrientation_Impl));
422  m_xPortraitBtn->connect_clicked(LINK(this, SvxPageDescPage, SwapOrientation_Impl));
423 
424  m_aBspWin.SetSize( Size( ConvertLong_Impl( aPaperSize.Width(), eUnit ),
425  ConvertLong_Impl( aPaperSize.Height(), eUnit ) ) );
426 
427  aPaperSize = OutputDevice::LogicToLogic(aPaperSize, MapMode(eUnit), MapMode(MapUnit::Map100thMM));
428  if ( bLandscape )
429  Swap( aPaperSize );
430 
431  // Actual Paper Format
432  Paper ePaper = SvxPaperInfo::GetSvxPaper( aPaperSize, MapUnit::Map100thMM );
433 
434  if ( PAPER_USER != ePaper )
435  aPaperSize = SvxPaperInfo::GetPaperSize( ePaper, MapUnit::Map100thMM );
436 
437  if ( bLandscape )
438  Swap( aPaperSize );
439 
440  // write values into the edits
441  SetMetricValue( *m_xPaperHeightEdit, aPaperSize.Height(), MapUnit::Map100thMM );
442  SetMetricValue( *m_xPaperWidthEdit, aPaperSize.Width(), MapUnit::Map100thMM );
443  m_xPaperSizeBox->clear();
444 
445  m_xPaperSizeBox->FillPaperSizeEntries( ( ePaperStart == PAPER_A3 ) ? PaperSizeApp::Std : PaperSizeApp::Draw );
446  m_xPaperSizeBox->set_active_id( ePaper );
447 
448  // application specific
449 
450  switch ( eMode )
451  {
453  {
454  m_xTblAlignFT->show();
455  m_xHorzBox->show();
456  m_xVertBox->show();
458 
459  // horizontal alignment
460  pItem = GetItem( *rSet, SID_ATTR_PAGE_EXT1 );
461  m_xHorzBox->set_active(pItem && static_cast<const SfxBoolItem*>(pItem)->GetValue());
462 
463  // vertical alignment
464  pItem = GetItem( *rSet, SID_ATTR_PAGE_EXT2 );
465  m_xVertBox->set_active(pItem && static_cast<const SfxBoolItem*>(pItem)->GetValue());
466 
467  // set example window on the table
468  m_aBspWin.SetTable( true );
469  m_aBspWin.SetHorz(m_xHorzBox->get_active());
470  m_aBspWin.SetVert(m_xVertBox->get_active());
471 
472  break;
473  }
474 
476  {
478  m_xAdaptBox->show();
479  pItem = GetItem( *rSet, SID_ATTR_PAGE_EXT1 );
480  m_xAdaptBox->set_active( pItem &&
481  static_cast<const SfxBoolItem*>(pItem)->GetValue() );
482 
484  m_xLayoutBox->hide();
485  m_xPageText->hide();
486 
487  break;
488  }
489  default: ;//prevent warning
490  }
491 
492 
493  // display background and border in the example
494  ResetBackground_Impl( *rSet );
496  RangeHdl_Impl();
497 
498  InitHeadFoot_Impl( *rSet );
499 
500  bBorderModified = false;
501  SwapFirstValues_Impl( false );
503 
504  m_xLeftMarginEdit->save_value();
505  m_xRightMarginEdit->save_value();
506  m_xTopMarginEdit->save_value();
507  m_xBottomMarginEdit->save_value();
508  m_xLayoutBox->save_value();
509  m_xNumberFormatBox->save_value();
510  m_xPaperSizeBox->save_value();
511  m_xPaperWidthEdit->save_value();
512  m_xPaperHeightEdit->save_value();
513  m_xPortraitBtn->save_state();
514  m_xLandscapeBtn->save_state();
515  m_xPaperTrayBox->save_value();
516  m_xVertBox->save_state();
517  m_xHorzBox->save_state();
518  m_xAdaptBox->save_state();
519 
520  CheckMarginEdits( true );
521 
522 
523  if(SfxItemState::SET == rSet->GetItemState(SID_SWREGISTER_MODE))
524  {
525  m_xRegisterCB->set_active(static_cast<const SfxBoolItem&>(rSet->Get(
526  SID_SWREGISTER_MODE)).GetValue());
527  m_xRegisterCB->save_state();
528  RegisterModify(*m_xRegisterCB);
529  }
530  if(SfxItemState::SET == rSet->GetItemState(SID_SWREGISTER_COLLECTION))
531  {
532  m_xRegisterLB->set_active_text(
533  static_cast<const SfxStringItem&>(rSet->Get(SID_SWREGISTER_COLLECTION)).GetValue());
534  m_xRegisterLB->save_value();
535  }
536 
537  SfxItemState eState = rSet->GetItemState( GetWhich( SID_ATTR_FRAMEDIRECTION ),
538  true, &pItem );
539  if( SfxItemState::UNKNOWN != eState )
540  {
541  SvxFrameDirection nVal = SfxItemState::SET == eState
542  ? static_cast<const SvxFrameDirectionItem*>(pItem)->GetValue()
543  : SvxFrameDirection::Horizontal_LR_TB;
544  m_xTextFlowBox->set_active_id(nVal);
545 
546  m_xTextFlowBox->save_value();
548  }
549 }
550 
552 {
554  SetUserData(m_xAdaptBox->get_active() ? OUString("1") : OUString("0")) ;
555 
556 }
557 
559 {
560  bool bModified = false;
561  const SfxItemSet& rOldSet = GetItemSet();
562  SfxItemPool* pPool = rOldSet.GetPool();
563  DBG_ASSERT( pPool, "Where is the pool?" );
564  sal_uInt16 nWhich = GetWhich( SID_ATTR_LRSPACE );
565  MapUnit eUnit = pPool->GetMetric( nWhich );
566  const SfxPoolItem* pOld = nullptr;
567 
568  // copy old left and right margins
569  SvxLRSpaceItem aMargin( static_cast<const SvxLRSpaceItem&>(rOldSet.Get( nWhich )) );
570 
571  // copy old top and bottom margins
572  nWhich = GetWhich( SID_ATTR_ULSPACE );
573  SvxULSpaceItem aTopMargin( static_cast<const SvxULSpaceItem&>(rOldSet.Get( nWhich )) );
574 
575  if (m_xLeftMarginEdit->get_value_changed_from_saved())
576  {
577  aMargin.SetLeft( static_cast<sal_uInt16>(GetCoreValue( *m_xLeftMarginEdit, eUnit )) );
578  bModified = true;
579  }
580 
581  if (m_xRightMarginEdit->get_value_changed_from_saved())
582  {
583  aMargin.SetRight( static_cast<sal_uInt16>(GetCoreValue( *m_xRightMarginEdit, eUnit )) );
584  bModified = true;
585  }
586 
587  // set left and right margins
588  if (bModified)
589  {
590  pOld = GetOldItem( *rSet, SID_ATTR_LRSPACE );
591 
592  if ( !pOld || *static_cast<const SvxLRSpaceItem*>(pOld) != aMargin )
593  rSet->Put( aMargin );
594  else
595  bModified = false;
596  }
597 
598  bool bMod = false;
599 
600  if (m_xTopMarginEdit->get_value_changed_from_saved())
601  {
602  aTopMargin.SetUpper( static_cast<sal_uInt16>(GetCoreValue( *m_xTopMarginEdit, eUnit )) );
603  bMod = true;
604  }
605 
606  if (m_xBottomMarginEdit->get_value_changed_from_saved())
607  {
608  aTopMargin.SetLower( static_cast<sal_uInt16>(GetCoreValue( *m_xBottomMarginEdit, eUnit )) );
609  bMod = true;
610  }
611 
612  // set top and bottom margins
613 
614  if ( bMod )
615  {
616  pOld = GetOldItem( *rSet, SID_ATTR_ULSPACE );
617 
618  if ( !pOld || *static_cast<const SvxULSpaceItem*>(pOld) != aTopMargin )
619  {
620  bModified = true;
621  rSet->Put( aTopMargin );
622  }
623  }
624 
625  // paper tray
626  nWhich = GetWhich( SID_ATTR_PAGE_PAPERBIN );
627  sal_Int32 nPos = m_xPaperTrayBox->get_active();
628  sal_uInt16 nBin = m_xPaperTrayBox->get_id(nPos).toInt32();
629  pOld = GetOldItem( *rSet, SID_ATTR_PAGE_PAPERBIN );
630 
631  if ( !pOld || static_cast<const SvxPaperBinItem*>(pOld)->GetValue() != nBin )
632  {
633  rSet->Put( SvxPaperBinItem( nWhich, static_cast<sal_uInt8>(nBin) ) );
634  bModified = true;
635  }
636 
637  Paper ePaper = m_xPaperSizeBox->get_active_id();
638  bool bChecked = m_xLandscapeBtn->get_active();
639 
640  if ( PAPER_USER == ePaper )
641  {
642  if ( m_xPaperSizeBox->get_value_changed_from_saved() ||
643  m_xPaperWidthEdit->get_value_changed_from_saved() ||
644  m_xPaperHeightEdit->get_value_changed_from_saved() ||
645  m_xLandscapeBtn->get_state_changed_from_saved() )
646  {
647  Size aSize( GetCoreValue( *m_xPaperWidthEdit, eUnit ),
648  GetCoreValue( *m_xPaperHeightEdit, eUnit ) );
649  pOld = GetOldItem( *rSet, SID_ATTR_PAGE_SIZE );
650 
651  if ( !pOld || static_cast<const SvxSizeItem*>(pOld)->GetSize() != aSize )
652  {
653  rSet->Put( SvxSizeItem( GetWhich(SID_ATTR_PAGE_SIZE), aSize ) );
654  bModified = true;
655  }
656  }
657  }
658  else
659  {
660  if (m_xPaperSizeBox->get_value_changed_from_saved() || m_xLandscapeBtn->get_state_changed_from_saved())
661  {
662  Size aSize( SvxPaperInfo::GetPaperSize( ePaper, eUnit ) );
663 
664  if ( bChecked )
665  Swap( aSize );
666 
667  pOld = GetOldItem( *rSet, SID_ATTR_PAGE_SIZE );
668 
669  if ( !pOld || static_cast<const SvxSizeItem*>(pOld)->GetSize() != aSize )
670  {
671  rSet->Put( SvxSizeItem( GetWhich(SID_ATTR_PAGE_SIZE), aSize ) );
672  bModified = true;
673  }
674  }
675  }
676 
677  nWhich = GetWhich( SID_ATTR_PAGE );
678  SvxPageItem aPage( static_cast<const SvxPageItem&>(rOldSet.Get( nWhich )) );
679  bMod = m_xLayoutBox->get_value_changed_from_saved();
680 
681  if ( bMod )
682  aPage.SetPageUsage(::PosToPageUsage_Impl(m_xLayoutBox->get_active()));
683 
684  if (m_xLandscapeBtn->get_state_changed_from_saved())
685  {
686  aPage.SetLandscape(bChecked);
687  bMod = true;
688  }
689 
690  //Get the NumType value
691  if (m_xNumberFormatBox->get_value_changed_from_saved())
692  {
693  SvxNumType nEntryData = m_xNumberFormatBox->get_active_id();
694  aPage.SetNumType( nEntryData );
695  bMod = true;
696  }
697 
698  if ( bMod )
699  {
700  pOld = GetOldItem( *rSet, SID_ATTR_PAGE );
701 
702  if ( !pOld || *static_cast<const SvxPageItem*>(pOld) != aPage )
703  {
704  rSet->Put( aPage );
705  bModified = true;
706  }
707  }
708  else if ( SfxItemState::DEFAULT == rOldSet.GetItemState( nWhich ) )
709  rSet->ClearItem( nWhich );
710  else
711  rSet->Put( rOldSet.Get( nWhich ) );
712 
713  // evaluate mode specific controls
714 
715  switch ( eMode )
716  {
718  {
719  if (m_xHorzBox->get_state_changed_from_saved())
720  {
721  SfxBoolItem aHorz( GetWhich( SID_ATTR_PAGE_EXT1 ),
722  m_xHorzBox->get_active() );
723  rSet->Put( aHorz );
724  bModified = true;
725  }
726 
727  if (m_xVertBox->get_state_changed_from_saved())
728  {
729  SfxBoolItem aVert( GetWhich( SID_ATTR_PAGE_EXT2 ),
730  m_xVertBox->get_active() );
731  rSet->Put( aVert );
732  bModified = true;
733  }
734  break;
735  }
736 
738  {
739  // always put so that draw can evaluate this
740  rSet->Put( SfxBoolItem( GetWhich( SID_ATTR_PAGE_EXT1 ),
741  m_xAdaptBox->get_active() ) );
742  bModified = true;
743  break;
744  }
745  default: ;//prevent warning
746 
747  }
748 
749  if (m_xRegisterCB->get_visible() &&
750  (m_xRegisterCB->get_active() || m_xRegisterCB->get_state_changed_from_saved()))
751  {
752  const SfxBoolItem& rRegItem = static_cast<const SfxBoolItem&>(rOldSet.Get(SID_SWREGISTER_MODE));
753  std::unique_ptr<SfxBoolItem> pRegItem(rRegItem.Clone());
754  bool bCheck = m_xRegisterCB->get_active();
755  pRegItem->SetValue(bCheck);
756  rSet->Put(std::move(pRegItem));
757  bModified = true;
758  if(bCheck)
759  {
760  bModified = true;
761  rSet->Put(SfxStringItem(SID_SWREGISTER_COLLECTION,
762  m_xRegisterLB->get_active_text()));
763  }
764  }
765 
766  if (m_xTextFlowBox->get_visible() && m_xTextFlowBox->get_value_changed_from_saved())
767  {
768  SvxFrameDirection eDirection = m_xTextFlowBox->get_active_id();
769  rSet->Put( SvxFrameDirectionItem( eDirection, GetWhich( SID_ATTR_FRAMEDIRECTION ) ) );
770  bModified = true;
771  }
772 
773  return bModified;
774 }
775 
777 {
778  // switch inside outside
779  const SvxPageUsage nUsage = PosToPageUsage_Impl(m_xLayoutBox->get_active());
780 
781  if (nUsage == SvxPageUsage::Mirror)
782  {
783  m_xLeftMarginLbl->hide();
784  m_xRightMarginLbl->hide();
785  m_xInsideLbl->show();
786  m_xOutsideLbl->show();
787  }
788  else
789  {
790  m_xLeftMarginLbl->show();
791  m_xRightMarginLbl->show();
792  m_xInsideLbl->hide();
793  m_xOutsideLbl->hide();
794  }
795  UpdateExample_Impl( true );
796 }
797 
798 IMPL_LINK_NOARG(SvxPageDescPage, PaperBinHdl_Impl, weld::Widget&, void)
799 {
800  // tdf#124226 disconnect so not called again, unless Reset occurs
801  m_xPaperTrayBox->connect_focus_in(Link<weld::Widget&, void>());
802 
803  OUString aOldName = m_xPaperTrayBox->get_active_text();
804  m_xPaperTrayBox->freeze();
805  m_xPaperTrayBox->clear();
806  m_xPaperTrayBox->append(OUString::number(PAPERBIN_PRINTER_SETTINGS), EditResId(RID_SVXSTR_PAPERBIN_SETTINGS));
807  OUString aPaperBin(EditResId(RID_SVXSTR_PAPERBIN));
808  const sal_uInt16 nBinCount = mpDefPrinter->GetPaperBinCount();
809 
810  for (sal_uInt16 i = 0; i < nBinCount; ++i)
811  {
812  OUString aName = mpDefPrinter->GetPaperBinName(i);
813  if (aName.isEmpty())
814  {
815  aName = aPaperBin + " " + OUString::number( i+1 );
816  }
817  m_xPaperTrayBox->append(OUString::number(i), aName);
818  }
819  m_xPaperTrayBox->set_active_text(aOldName);
820  m_xPaperTrayBox->thaw();
821 
822  // tdf#123650 explicitly grab-focus after the modification otherwise gtk loses track
823  // of there the focus should be
824  m_xPaperTrayBox->grab_focus();
825 }
826 
827 IMPL_LINK_NOARG(SvxPageDescPage, PaperSizeSelect_Impl, weld::ComboBox&, void)
828 {
829  Paper ePaper = m_xPaperSizeBox->get_active_id();
830 
831  if ( ePaper == PAPER_USER )
832  return;
833 
834  Size aSize( SvxPaperInfo::GetPaperSize( ePaper, MapUnit::Map100thMM ) );
835 
836  if (m_xLandscapeBtn->get_active())
837  Swap( aSize );
838 
839  if ( aSize.Height() < m_xPaperHeightEdit->get_min( FieldUnit::MM_100TH ) )
840  m_xPaperHeightEdit->set_min(
841  m_xPaperHeightEdit->normalize( aSize.Height() ), FieldUnit::MM_100TH );
842  if ( aSize.Width() < m_xPaperWidthEdit->get_min( FieldUnit::MM_100TH ) )
843  m_xPaperWidthEdit->set_min(
844  m_xPaperWidthEdit->normalize( aSize.Width() ), FieldUnit::MM_100TH );
845  SetMetricValue( *m_xPaperHeightEdit, aSize.Height(), MapUnit::Map100thMM );
846  SetMetricValue( *m_xPaperWidthEdit, aSize.Width(), MapUnit::Map100thMM );
847 
848  CalcMargin_Impl();
849 
850  RangeHdl_Impl();
851  UpdateExample_Impl( true );
852 
854  return;
855 
856  // Draw: if paper format the margin shall be 1 cm
857  long nTmp = 0;
858  bool bScreen = (( PAPER_SCREEN_4_3 == ePaper )||( PAPER_SCREEN_16_9 == ePaper)||( PAPER_SCREEN_16_10 == ePaper));
859 
860  if ( !bScreen )
861  // no margin if screen
862  nTmp = 1; // accordingly 1 cm
863 
864  if ( bScreen || m_xRightMarginEdit->get_value(FieldUnit::NONE) == 0 )
865  SetMetricValue( *m_xRightMarginEdit, nTmp, MapUnit::MapCM );
866  if ( bScreen || m_xLeftMarginEdit->get_value(FieldUnit::NONE) == 0 )
867  SetMetricValue( *m_xLeftMarginEdit, nTmp, MapUnit::MapCM );
868  if ( bScreen || m_xBottomMarginEdit->get_value(FieldUnit::NONE) == 0 )
869  SetMetricValue( *m_xBottomMarginEdit, nTmp, MapUnit::MapCM );
870  if ( bScreen || m_xTopMarginEdit->get_value(FieldUnit::NONE) == 0 )
871  SetMetricValue( *m_xTopMarginEdit, nTmp, MapUnit::MapCM );
872  UpdateExample_Impl( true );
873 }
874 
876 {
877  sal_uInt16 nWhich = GetWhich( SID_ATTR_LRSPACE );
878  MapUnit eUnit = GetItemSet().GetPool()->GetMetric( nWhich );
879  Size aSize( GetCoreValue( *m_xPaperWidthEdit, eUnit ),
880  GetCoreValue( *m_xPaperHeightEdit, eUnit ) );
881 
882  if ( aSize.Width() > aSize.Height() )
883  {
884  m_xLandscapeBtn->set_active(true);
885  bLandscape = true;
886  }
887  else
888  {
889  m_xPortraitBtn->set_active(true);
890  bLandscape = false;
891  }
892 
893  Paper ePaper = SvxPaperInfo::GetSvxPaper( aSize, eUnit );
894  m_xPaperSizeBox->set_active_id( ePaper );
895  UpdateExample_Impl( true );
896 
897  RangeHdl_Impl();
898 }
899 
900 IMPL_LINK(SvxPageDescPage, SwapOrientation_Impl, weld::Button&, rBtn, void)
901 {
902  if (
903  !((!bLandscape && &rBtn == m_xLandscapeBtn.get()) ||
904  (bLandscape && &rBtn == m_xPortraitBtn.get()))
905  )
906  return;
907 
908  bLandscape = m_xLandscapeBtn->get_active();
909 
910  const long lWidth = GetCoreValue( *m_xPaperWidthEdit, MapUnit::Map100thMM );
911  const long lHeight = GetCoreValue( *m_xPaperHeightEdit, MapUnit::Map100thMM );
912 
913  // swap width and height
914  SetMetricValue(*m_xPaperWidthEdit, lHeight, MapUnit::Map100thMM);
915  SetMetricValue(*m_xPaperHeightEdit, lWidth, MapUnit::Map100thMM);
916 
917  // recalculate margins if necessary
918  CalcMargin_Impl();
919 
920  PaperSizeSelect_Impl(m_xPaperSizeBox->get_widget());
921  RangeHdl_Impl();
922  SwapFirstValues_Impl(bBorderModified);
923  UpdateExample_Impl(true);
924 }
925 
927 {
928  MapMode aOldMode = mpDefPrinter->GetMapMode();
929  Orientation eOri = Orientation::Portrait;
930 
931  if ( bLandscape )
932  eOri = Orientation::Landscape;
934  mpDefPrinter->SetOrientation( eOri );
935  mpDefPrinter->SetMapMode(MapMode(MapUnit::MapTwip));
936 
937  // set first- and last-values for margins
938  Size aPaperSize = mpDefPrinter->GetPaperSize();
939  Size aPrintSize = mpDefPrinter->GetOutputSize();
940  /*
941  * To convert a point ( 0,0 ) into logic coordinates
942  * looks like nonsense; but it makes sense if the
943  * coordinate system's origin has been moved.
944  */
946  mpDefPrinter->SetMapMode( aOldMode );
947  mpDefPrinter->SetOrientation( eOldOri );
948 
949  sal_Int64 nSetL = m_xLeftMarginEdit->denormalize(
950  m_xLeftMarginEdit->get_value( FieldUnit::TWIP ) );
951  sal_Int64 nSetR = m_xRightMarginEdit->denormalize(
952  m_xRightMarginEdit->get_value( FieldUnit::TWIP ) );
953  sal_Int64 nSetT = m_xTopMarginEdit->denormalize(
954  m_xTopMarginEdit->get_value( FieldUnit::TWIP ) );
955  sal_Int64 nSetB = m_xBottomMarginEdit->denormalize(
956  m_xBottomMarginEdit->get_value( FieldUnit::TWIP ) );
957 
958  long nNewL = aPrintOffset.X();
959  long nNewR = aPaperSize.Width() - aPrintSize.Width() - aPrintOffset.X();
960  long nNewT = aPrintOffset.Y();
961  long nNewB = aPaperSize.Height() - aPrintSize.Height() - aPrintOffset.Y();
962 
963  nFirstLeftMargin = m_xLeftMarginEdit->convert_value_from(m_xLeftMarginEdit->normalize(nNewL), FieldUnit::TWIP);
964  nFirstRightMargin = m_xRightMarginEdit->convert_value_from(m_xRightMarginEdit->normalize(nNewR), FieldUnit::TWIP);
965  nFirstTopMargin = m_xTopMarginEdit->convert_value_from(m_xTopMarginEdit->normalize(nNewT), FieldUnit::TWIP);
966  nFirstBottomMargin = m_xBottomMarginEdit->convert_value_from(m_xBottomMarginEdit->normalize(nNewB), FieldUnit::TWIP);
967 
968  if ( !bSet )
969  return;
970 
971  if ( nSetL < nNewL )
972  m_xLeftMarginEdit->set_value( m_xLeftMarginEdit->normalize( nNewL ),
973  FieldUnit::TWIP );
974  if ( nSetR < nNewR )
975  m_xRightMarginEdit->set_value( m_xRightMarginEdit->normalize( nNewR ),
976  FieldUnit::TWIP );
977  if ( nSetT < nNewT )
978  m_xTopMarginEdit->set_value( m_xTopMarginEdit->normalize( nNewT ),
979  FieldUnit::TWIP );
980  if ( nSetB < nNewB )
981  m_xBottomMarginEdit->set_value( m_xBottomMarginEdit->normalize( nNewB ),
982  FieldUnit::TWIP );
983 }
984 
986 {
987  if ( !bBorderModified )
988  bBorderModified = true;
989  UpdateExample_Impl();
990 
991  RangeHdl_Impl();
992 }
993 
994 void SvxPageDescPage::UpdateExample_Impl( bool bResetbackground )
995 {
996  // Size
997  Size aSize( GetCoreValue( *m_xPaperWidthEdit, MapUnit::MapTwip ),
998  GetCoreValue( *m_xPaperHeightEdit, MapUnit::MapTwip ) );
999 
1000  m_aBspWin.SetSize( aSize );
1001 
1002  // Margins
1003  m_aBspWin.SetTop( GetCoreValue( *m_xTopMarginEdit, MapUnit::MapTwip ) );
1004  m_aBspWin.SetBottom( GetCoreValue( *m_xBottomMarginEdit, MapUnit::MapTwip ) );
1005  m_aBspWin.SetLeft( GetCoreValue( *m_xLeftMarginEdit, MapUnit::MapTwip ) );
1006  m_aBspWin.SetRight( GetCoreValue( *m_xRightMarginEdit, MapUnit::MapTwip ) );
1007 
1008  // Layout
1010  if ( bResetbackground )
1012  m_aBspWin.Invalidate();
1013 }
1014 
1015 
1017 {
1018  sal_uInt16 nWhich(GetWhich(SID_ATTR_PAGE_HEADERSET));
1019 
1020  if (SfxItemState::SET == rSet.GetItemState(nWhich, false))
1021  {
1022  const SvxSetItem& rSetItem = static_cast< const SvxSetItem& >(rSet.Get(nWhich, false));
1023  const SfxItemSet& rTmpSet = rSetItem.GetItemSet();
1024  const SfxBoolItem& rOn = static_cast< const SfxBoolItem& >(rTmpSet.Get(GetWhich(SID_ATTR_PAGE_ON)));
1025 
1026  if(rOn.GetValue())
1027  {
1029 
1031  {
1032  // create FillAttributes directly from DrawingLayer FillStyle entries
1033  aHeaderFillAttributes = std::make_shared<drawinglayer::attribute::SdrAllFillAttributesHelper>(rTmpSet);
1034  }
1035  else
1036  {
1037  nWhich = GetWhich(SID_ATTR_BRUSH);
1038 
1039  if(SfxItemState::SET == rTmpSet.GetItemState(nWhich))
1040  {
1041  // create FillAttributes from SvxBrushItem
1042  const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(rTmpSet.Get(nWhich));
1044 
1046  aHeaderFillAttributes = std::make_shared<drawinglayer::attribute::SdrAllFillAttributesHelper>(aTempSet);
1047  }
1048  }
1049 
1050  m_aBspWin.setHeaderFillAttributes(aHeaderFillAttributes);
1051  }
1052  }
1053 
1054  nWhich = GetWhich(SID_ATTR_PAGE_FOOTERSET);
1055 
1056  if (SfxItemState::SET == rSet.GetItemState(nWhich, false))
1057  {
1058  const SvxSetItem& rSetItem = static_cast< const SvxSetItem& >(rSet.Get(nWhich,false));
1059  const SfxItemSet& rTmpSet = rSetItem.GetItemSet();
1060  const SfxBoolItem& rOn = static_cast< const SfxBoolItem& >(rTmpSet.Get(GetWhich(SID_ATTR_PAGE_ON)));
1061 
1062  if(rOn.GetValue())
1063  {
1065 
1067  {
1068  // create FillAttributes directly from DrawingLayer FillStyle entries
1069  aFooterFillAttributes = std::make_shared<drawinglayer::attribute::SdrAllFillAttributesHelper>(rTmpSet);
1070  }
1071  else
1072  {
1073  nWhich = GetWhich(SID_ATTR_BRUSH);
1074 
1075  if(SfxItemState::SET == rTmpSet.GetItemState(nWhich))
1076  {
1077  // create FillAttributes from SvxBrushItem
1078  const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(rTmpSet.Get(nWhich));
1080 
1082  aFooterFillAttributes = std::make_shared<drawinglayer::attribute::SdrAllFillAttributesHelper>(aTempSet);
1083  }
1084  }
1085 
1086  m_aBspWin.setFooterFillAttributes(aFooterFillAttributes);
1087  }
1088  }
1089 
1091  const SfxPoolItem* pItem = nullptr;
1092 
1094  {
1095  // create FillAttributes directly from DrawingLayer FillStyle entries
1096  aPageFillAttributes = std::make_shared<drawinglayer::attribute::SdrAllFillAttributesHelper>(rSet);
1097  }
1098  else
1099  {
1100  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  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  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  long nHHeight = m_aBspWin.GetHdHeight();
1302  long nHDist = m_aBspWin.GetHdDist();
1303 
1304  long nFHeight = m_aBspWin.GetFtHeight();
1305  long nFDist = m_aBspWin.GetFtDist();
1306 
1307  long nHFLeft = std::max(m_aBspWin.GetHdLeft(), m_aBspWin.GetFtLeft());
1308  long nHFRight = std::max(m_aBspWin.GetHdRight(), m_aBspWin.GetFtRight());
1309 
1310  // current values for page margins
1311  long nBT = static_cast<long>(m_xTopMarginEdit->denormalize(m_xTopMarginEdit->get_value(FieldUnit::TWIP)));
1312  long nBB = static_cast<long>(m_xBottomMarginEdit->denormalize(m_xBottomMarginEdit->get_value(FieldUnit::TWIP)));
1313  long nBL = static_cast<long>(m_xLeftMarginEdit->denormalize(m_xLeftMarginEdit->get_value(FieldUnit::TWIP)));
1314  long nBR = static_cast<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  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  long nH = static_cast<long>(m_xPaperHeightEdit->denormalize(m_xPaperHeightEdit->get_value(FieldUnit::TWIP)));
1341  long nW = static_cast<long>(m_xPaperWidthEdit->denormalize(m_xPaperWidthEdit->get_value(FieldUnit::TWIP)));
1342 
1343  // Top
1344  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  long nBT = GetCoreValue( *m_xTopMarginEdit, MapUnit::MapTwip );
1368  long nBB = GetCoreValue( *m_xBottomMarginEdit, MapUnit::MapTwip );
1369 
1370  long nBL = GetCoreValue( *m_xLeftMarginEdit, MapUnit::MapTwip );
1371  long nBR = GetCoreValue( *m_xRightMarginEdit, MapUnit::MapTwip );
1372 
1373  long nH = GetCoreValue( *m_xPaperHeightEdit, MapUnit::MapTwip );
1374  long nW = GetCoreValue( *m_xPaperWidthEdit, MapUnit::MapTwip );
1375 
1376  long nWidth = nBL + nBR + MINBODY;
1377  long nHeight = nBT + nBB + MINBODY;
1378 
1379  if ( !(nWidth > nW || nHeight > nH) )
1380  return;
1381 
1382  if ( nWidth > nW )
1383  {
1384  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  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, long nFirstMargin, long nLastMargin, MarginPosition nPos )
1461 {
1462  bool bRet = false;
1463  bool bCheck = ( ( m_nPos & nPos ) == 0 );
1464  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: */
long GetLeft() const
bool IsLandscape() const
bool GetValue() const
long Width() const
long GetFtHeight() const
void SetFieldUnit(weld::MetricSpinButton &rField, FieldUnit eUnit, bool bAll)
static const long MINBODY
Definition: page.cxx:58
#define MARGIN_LEFT
Definition: page.cxx:128
void SetFtRight(long nNew)
void SetHdRight(long nNew)
SVX_PAGE_MODE_PRESENTATION
FieldUnit
sal_uInt16 GetPaperBinCount() const
void SetBottom(long nNew)
std::unique_ptr< weld::MetricSpinButton > m_xPaperWidthEdit
Definition: page.hxx:94
#define MARGIN_BOTTOM
Definition: page.cxx:131
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 SetHdDist(long nNew)
long AdjustWidth(long n)
PAPER_SCREEN_16_10
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
long Height() 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:130
bool mbDelPrinter
Definition: page.hxx:87
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:776
SvxFrameDirection
static SfxObjectShell * Current()
MarginPosition m_nPos
Definition: page.hxx:84
void SetHdLeft(long nNew)
OUString sStandardRegister
Definition: page.hxx:69
PAPER_SCREEN_4_3
long AdjustHeight(long n)
Orientation GetOrientation() const
void SetMapMode()
long nFirstRightMargin
Definition: page.hxx:71
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)
long nFirstLeftMargin
Definition: page.hxx:70
std::unique_ptr< weld::Label > m_xNumberFormatText
Definition: page.hxx:112
sal_uInt32 GetMaximumPaperWidth() const
FieldUnit GetModuleFieldUnit(const SfxItemSet &rSet)
SvxNumType
void SetFtLeft(long nNew)
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)
Paper
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:1016
void SetLeft(const long nL, const sal_uInt16 nProp=100)
SvxNumType GetNumType() const
OUString SvxResId(const char *pId)
void Init_Impl()
Definition: page.cxx:297
static sal_uInt16 PageUsageToPos_Impl(SvxPageUsage nUsage)
Definition: page.cxx:81
void SetExchangeSupport()
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
void ResetBackground()
void SetFrameDirection(SvxFrameDirection nDirection)
bool bLandscape
Definition: page.hxx:79
static bool IsEqualSize_Impl(const SvxSizeItem *pSize, const Size &rSize)
Definition: page.cxx:114
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:288
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:135
void SetRight(const long nR, const sal_uInt16 nProp=100)
Orientation
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
long GetHdRight() const
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
void SetTop(long nNew)
sal_uInt16 CalcShadowSpace(SvxShadowItemSide nShadow) const
void SetHeader(bool bNew)
int GetCoreValue(const weld::MetricSpinButton &rField, MapUnit eUnit)
Size GetOutputSize() const
HTMLMODE_ON
void SetFtHeight(long nNew)
void SetHdHeight(long nNew)
const SfxItemSet * GetItemSet(const SfxPoolItem &rAttr)
std::unique_ptr< weld::Label > m_xTextFlowLbl
Definition: page.hxx:99
long nLastBottomMargin
Definition: page.hxx:77
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:994
long GetHdLeft() const
void set_value(int nValue, FieldUnit eValueUnit)
long GetFtDist() const
static SvxPageUsage PosToPageUsage_Impl(sal_uInt16 nPos)
Definition: page.cxx:90
void SwapFirstValues_Impl(bool bSet)
Definition: page.cxx:926
static Size GetPaperSize(Paper ePaper, MapUnit eUnit=MapUnit::MapTwip)
std::unique_ptr< weld::RadioButton > m_xLandscapeBtn
Definition: page.hxx:98
long nLastRightMargin
Definition: page.hxx:75
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
long GetFtLeft() const
std::vector< OUString > & GetList()
SVX_PAGE_MODE_STANDARD
std::unique_ptr< weld::Label > m_xTblAlignFT
Definition: page.hxx:115
long nLastTopMargin
Definition: page.hxx:76
std::unique_ptr< weld::Label > m_xPageText
Definition: page.hxx:110
SvxPageUsage
Point PixelToLogic(const Point &rDevicePt) const
SvxModeType
bool bBorderModified
Definition: page.hxx:80
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)
SvxPageDescPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
Definition: page.cxx:140
weld::Window * GetFrameWeld() const
virtual bool FillItemSet(SfxItemSet *rOutSet) override
Definition: page.cxx:558
long GetHdDist() const
SfxItemState
long GetFtRight() const
virtual void FillUserData() override
Definition: page.cxx:551
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
PAPER_A3
bool SetOrientation(Orientation eOrient)
long nLastLeftMargin
Definition: page.hxx:74
static Size GetMinBorderSpace_Impl(const SvxShadowItem &rShadow, const SvxBoxItem &rBox)
Definition: page.cxx:98
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
static VclPtr< reference_type > Create(Arg &&...arg)
bool mbEnableDrawingLayerFillStyles
Definition: page.hxx:88
void SetRight(long nNew)
void CalcMargin_Impl()
Definition: page.cxx:1364
virtual SfxPrinter * GetPrinter(bool bCreate=false)
const SvxPageUsage aArr[]
Definition: page.cxx:72
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage)
long GetRight() const
sal_uInt16 CalcLineSpace(SvxBoxItemLine nLine, bool bEvenIfNoLine=false) const
DeactivateRC
int get_value(FieldUnit eDestUnit) const
MapUnit
long GetHdHeight() const
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:129
std::unique_ptr< weld::ComboBox > m_xPaperTrayBox
Definition: page.hxx:101
virtual void Reset(const SfxItemSet *rSet) override
Definition: page.cxx:318
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:900
void SetUpper(const sal_uInt16 nU, const sal_uInt16 nProp=100)
std::unique_ptr< weld::CheckButton > m_xRegisterCB
Definition: page.hxx:121
PAPER_USER
void setWidth(long nWidth)
void SetLeft(long nNew)
std::unique_ptr< weld::CheckButton > m_xAdaptBox
Definition: page.hxx:119
bool IsPrinterRangeOverflow(weld::MetricSpinButton &rField, long nFirstMargin, long nLastMargin, MarginPosition nPos)
Definition: page.cxx:1459
void SetVert(bool bNew)
const Size & GetSize() const
long nFirstTopMargin
Definition: page.hxx:72
sal_uInt16 nPos
sal_uInt16 GetWhich(sal_uInt16 nSlot, bool bDeep=true) const
void SetFtDist(long nNew)
long nFirstBottomMargin
Definition: page.hxx:73
PAPER_SCREEN_16_9
sal_Int16 nValue
sal_uInt16 GetUpper() const
static Paper GetSvxPaper(const Size &rSize, MapUnit eUnit)
Size GetPaperSize() const
void setHeight(long nHeight)
static long ConvertLong_Impl(const long nIn, MapUnit eUnit)
Definition: page.cxx:109