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 <svl/aeitem.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 static const 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 
110 static long ConvertLong_Impl( const long nIn, MapUnit eUnit )
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  long nDiffW = std::abs( rSize.Width () - aSize.Width () );
121  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 
137 {
138  return VclPtr<SvxPageDescPage>::Create(pParent, *rSet);
139 }
140 
142  : SfxTabPage(pParent, "cui/ui/pageformatpage.ui", "PageFormatPage", &rAttr)
143  , bLandscape(false)
144  , eMode(SVX_PAGE_MODE_STANDARD)
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_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  disposeOnce();
291 }
292 
294 {
295  if(mbDelPrinter)
296  {
298  mbDelPrinter = false;
299  }
301 }
302 
304 {
305  // adjust the handler
306  m_xLayoutBox->connect_changed(LINK(this, SvxPageDescPage, LayoutHdl_Impl));
307 
308  m_xPaperSizeBox->connect_changed(LINK(this, SvxPageDescPage, PaperSizeSelect_Impl));
309  m_xPaperWidthEdit->connect_value_changed( LINK(this, SvxPageDescPage, PaperSizeModify_Impl));
310  m_xPaperHeightEdit->connect_value_changed(LINK(this, SvxPageDescPage, PaperSizeModify_Impl));
311  m_xLandscapeBtn->connect_clicked(LINK(this, SvxPageDescPage, SwapOrientation_Impl));
312  m_xPortraitBtn->connect_clicked(LINK(this, SvxPageDescPage, SwapOrientation_Impl));
313 
314  Link<weld::MetricSpinButton&, void> aLink = LINK(this, SvxPageDescPage, BorderModify_Impl);
315  m_xLeftMarginEdit->connect_value_changed(aLink);
316  m_xRightMarginEdit->connect_value_changed(aLink);
317  m_xTopMarginEdit->connect_value_changed(aLink);
318  m_xBottomMarginEdit->connect_value_changed(aLink);
319 
320  m_xHorzBox->connect_toggled(LINK(this, SvxPageDescPage, CenterHdl_Impl));
321  m_xVertBox->connect_toggled(LINK(this, SvxPageDescPage, CenterHdl_Impl));
322 }
323 
325 {
326  SfxItemPool* pPool = rSet->GetPool();
327  DBG_ASSERT( pPool, "Where is the pool?" );
328  MapUnit eUnit = pPool->GetMetric( GetWhich( SID_ATTR_LRSPACE ) );
329 
330  // adjust margins (right/left)
331  const SfxPoolItem* pItem = GetItem( *rSet, SID_ATTR_LRSPACE );
332 
333  if ( pItem )
334  {
335  const SvxLRSpaceItem& rLRSpace = static_cast<const SvxLRSpaceItem&>(*pItem);
336  SetMetricValue( *m_xLeftMarginEdit, rLRSpace.GetLeft(), eUnit );
338  static_cast<sal_uInt16>(ConvertLong_Impl( rLRSpace.GetLeft(), eUnit )) );
339  SetMetricValue( *m_xRightMarginEdit, rLRSpace.GetRight(), eUnit );
341  static_cast<sal_uInt16>(ConvertLong_Impl( rLRSpace.GetRight(), eUnit )) );
342  }
343 
344  // adjust margins (top/bottom)
345  pItem = GetItem( *rSet, SID_ATTR_ULSPACE );
346 
347  if ( pItem )
348  {
349  const SvxULSpaceItem& rULSpace = static_cast<const SvxULSpaceItem&>(*pItem);
350  SetMetricValue( *m_xTopMarginEdit, rULSpace.GetUpper(), eUnit );
352  static_cast<sal_uInt16>(ConvertLong_Impl( static_cast<long>(rULSpace.GetUpper()), eUnit )) );
353  SetMetricValue( *m_xBottomMarginEdit, rULSpace.GetLower(), eUnit );
355  static_cast<sal_uInt16>(ConvertLong_Impl( static_cast<long>(rULSpace.GetLower()), eUnit )) );
356  }
357 
358  // general page data
359  SvxNumType eNumType = SVX_NUM_ARABIC;
360  bLandscape = ( mpDefPrinter->GetOrientation() == Orientation::Landscape );
361  SvxPageUsage nUse = SvxPageUsage::All;
362  pItem = GetItem( *rSet, SID_ATTR_PAGE );
363 
364  if ( pItem )
365  {
366  const SvxPageItem& rItem = static_cast<const SvxPageItem&>(*pItem);
367  eNumType = rItem.GetNumType();
368  nUse = rItem.GetPageUsage();
369  bLandscape = rItem.IsLandscape();
370  }
371 
372  // alignment
373  m_xLayoutBox->set_active(::PageUsageToPos_Impl(nUse));
374  m_aBspWin.SetUsage( nUse );
375  LayoutHdl_Impl( *m_xLayoutBox );
376 
377  //adjust numeration type of the page style
378  //Get the Position of the saved NumType
379  for (int i=0; i < m_xNumberFormatBox->get_count(); ++i)
380  {
381  if (eNumType == m_xNumberFormatBox->get_id(i).toInt32())
382  {
383  m_xNumberFormatBox->set_active(i);
384  break;
385  }
386  }
387 
388  m_xPaperTrayBox->clear();
390  pItem = GetItem( *rSet, SID_ATTR_PAGE_PAPERBIN );
391 
392  if ( pItem )
393  {
394  nPaperBin = static_cast<const SvxPaperBinItem*>(pItem)->GetValue();
395 
396  if ( nPaperBin >= mpDefPrinter->GetPaperBinCount() )
397  nPaperBin = PAPERBIN_PRINTER_SETTINGS;
398  }
399 
400  OUString aBinName;
401 
402  if ( PAPERBIN_PRINTER_SETTINGS == nPaperBin )
403  aBinName = EditResId(RID_SVXSTR_PAPERBIN_SETTINGS);
404  else
405  aBinName = mpDefPrinter->GetPaperBinName( static_cast<sal_uInt16>(nPaperBin) );
406 
407  m_xPaperTrayBox->append(OUString::number(nPaperBin), aBinName);
408  m_xPaperTrayBox->set_active_text(aBinName);
409  // reset focus handler to default first so know none already connected
410  m_xPaperTrayBox->connect_focus_in(Link<weld::Widget&, void>());
411  // update the list when widget gets focus
412  m_xPaperTrayBox->connect_focus_in(LINK(this, SvxPageDescPage, PaperBinHdl_Impl));
413 
415  pItem = GetItem( *rSet, SID_ATTR_PAGE_SIZE );
416 
417  if ( pItem )
418  aPaperSize = static_cast<const SvxSizeItem*>(pItem)->GetSize();
419 
420  bool bOrientationSupport =
421  mpDefPrinter->HasSupport( PrinterSupport::SetOrientation );
422 
423  if ( !bOrientationSupport &&
424  aPaperSize.Width() > aPaperSize.Height() )
425  bLandscape = true;
426 
427  m_xLandscapeBtn->set_active(bLandscape);
428  m_xPortraitBtn->set_active(!bLandscape);
429 
430  m_aBspWin.SetSize( Size( ConvertLong_Impl( aPaperSize.Width(), eUnit ),
431  ConvertLong_Impl( aPaperSize.Height(), eUnit ) ) );
432 
433  aPaperSize = OutputDevice::LogicToLogic(aPaperSize, MapMode(eUnit), MapMode(MapUnit::Map100thMM));
434  if ( bLandscape )
435  Swap( aPaperSize );
436 
437  // Actual Paper Format
438  Paper ePaper = SvxPaperInfo::GetSvxPaper( aPaperSize, MapUnit::Map100thMM );
439 
440  if ( PAPER_USER != ePaper )
441  aPaperSize = SvxPaperInfo::GetPaperSize( ePaper, MapUnit::Map100thMM );
442 
443  if ( bLandscape )
444  Swap( aPaperSize );
445 
446  // write values into the edits
447  SetMetricValue( *m_xPaperHeightEdit, aPaperSize.Height(), MapUnit::Map100thMM );
448  SetMetricValue( *m_xPaperWidthEdit, aPaperSize.Width(), MapUnit::Map100thMM );
449  m_xPaperSizeBox->clear();
450 
451  m_xPaperSizeBox->FillPaperSizeEntries( ( ePaperStart == PAPER_A3 ) ? PaperSizeApp::Std : PaperSizeApp::Draw );
452  m_xPaperSizeBox->SetSelection( ePaper );
453 
454  // application specific
455 
456  switch ( eMode )
457  {
459  {
460  m_xTblAlignFT->show();
461  m_xHorzBox->show();
462  m_xVertBox->show();
464 
465  // horizontal alignment
466  pItem = GetItem( *rSet, SID_ATTR_PAGE_EXT1 );
467  m_xHorzBox->set_active(pItem && static_cast<const SfxBoolItem*>(pItem)->GetValue());
468 
469  // vertical alignment
470  pItem = GetItem( *rSet, SID_ATTR_PAGE_EXT2 );
471  m_xVertBox->set_active(pItem && static_cast<const SfxBoolItem*>(pItem)->GetValue());
472 
473  // set example window on the table
474  m_aBspWin.SetTable( true );
475  m_aBspWin.SetHorz(m_xHorzBox->get_active());
476  m_aBspWin.SetVert(m_xVertBox->get_active());
477 
478  break;
479  }
480 
482  {
484  m_xAdaptBox->show();
485  pItem = GetItem( *rSet, SID_ATTR_PAGE_EXT1 );
486  m_xAdaptBox->set_active( pItem &&
487  static_cast<const SfxBoolItem*>(pItem)->GetValue() );
488 
490  m_xLayoutBox->hide();
491  m_xPageText->hide();
492 
493  break;
494  }
495  default: ;//prevent warning
496  }
497 
498 
499  // display background and border in the example
500  ResetBackground_Impl( *rSet );
502  RangeHdl_Impl();
503 
504  InitHeadFoot_Impl( *rSet );
505 
506  bBorderModified = false;
507  SwapFirstValues_Impl( false );
509 
510  m_xLeftMarginEdit->save_value();
511  m_xRightMarginEdit->save_value();
512  m_xTopMarginEdit->save_value();
513  m_xBottomMarginEdit->save_value();
514  m_xLayoutBox->save_value();
515  m_xNumberFormatBox->save_value();
516  m_xPaperSizeBox->save_value();
517  m_xPaperWidthEdit->save_value();
518  m_xPaperHeightEdit->save_value();
519  m_xPortraitBtn->save_state();
520  m_xLandscapeBtn->save_state();
521  m_xPaperTrayBox->save_value();
522  m_xVertBox->save_state();
523  m_xHorzBox->save_state();
524  m_xAdaptBox->save_state();
525 
526  CheckMarginEdits( true );
527 
528 
529  if(SfxItemState::SET == rSet->GetItemState(SID_SWREGISTER_MODE))
530  {
531  m_xRegisterCB->set_active(static_cast<const SfxBoolItem&>(rSet->Get(
532  SID_SWREGISTER_MODE)).GetValue());
533  m_xRegisterCB->save_state();
534  RegisterModify(*m_xRegisterCB);
535  }
536  if(SfxItemState::SET == rSet->GetItemState(SID_SWREGISTER_COLLECTION))
537  {
538  m_xRegisterLB->set_active_text(
539  static_cast<const SfxStringItem&>(rSet->Get(SID_SWREGISTER_COLLECTION)).GetValue());
540  m_xRegisterLB->save_value();
541  }
542 
543  SfxItemState eState = rSet->GetItemState( GetWhich( SID_ATTR_FRAMEDIRECTION ),
544  true, &pItem );
545  if( SfxItemState::UNKNOWN != eState )
546  {
547  SvxFrameDirection nVal = SfxItemState::SET == eState
548  ? static_cast<const SvxFrameDirectionItem*>(pItem)->GetValue()
549  : SvxFrameDirection::Horizontal_LR_TB;
550  m_xTextFlowBox->set_active_id(nVal);
551 
552  m_xTextFlowBox->save_value();
554  }
555 }
556 
558 {
560  SetUserData(m_xAdaptBox->get_active() ? OUString("1") : OUString("0")) ;
561 
562 }
563 
565 {
566  bool bModified = false;
567  const SfxItemSet& rOldSet = GetItemSet();
568  SfxItemPool* pPool = rOldSet.GetPool();
569  DBG_ASSERT( pPool, "Where is the pool?" );
570  sal_uInt16 nWhich = GetWhich( SID_ATTR_LRSPACE );
571  MapUnit eUnit = pPool->GetMetric( nWhich );
572  const SfxPoolItem* pOld = nullptr;
573 
574  // copy old left and right margins
575  SvxLRSpaceItem aMargin( static_cast<const SvxLRSpaceItem&>(rOldSet.Get( nWhich )) );
576 
577  // copy old top and bottom margins
578  nWhich = GetWhich( SID_ATTR_ULSPACE );
579  SvxULSpaceItem aTopMargin( static_cast<const SvxULSpaceItem&>(rOldSet.Get( nWhich )) );
580 
581  if (m_xLeftMarginEdit->get_value_changed_from_saved())
582  {
583  aMargin.SetLeft( static_cast<sal_uInt16>(GetCoreValue( *m_xLeftMarginEdit, eUnit )) );
584  bModified = true;
585  }
586 
587  if (m_xRightMarginEdit->get_value_changed_from_saved())
588  {
589  aMargin.SetRight( static_cast<sal_uInt16>(GetCoreValue( *m_xRightMarginEdit, eUnit )) );
590  bModified = true;
591  }
592 
593  // set left and right margins
594  if (bModified)
595  {
596  pOld = GetOldItem( *rSet, SID_ATTR_LRSPACE );
597 
598  if ( !pOld || *static_cast<const SvxLRSpaceItem*>(pOld) != aMargin )
599  rSet->Put( aMargin );
600  else
601  bModified = false;
602  }
603 
604  bool bMod = false;
605 
606  if (m_xTopMarginEdit->get_value_changed_from_saved())
607  {
608  aTopMargin.SetUpper( static_cast<sal_uInt16>(GetCoreValue( *m_xTopMarginEdit, eUnit )) );
609  bMod = true;
610  }
611 
612  if (m_xBottomMarginEdit->get_value_changed_from_saved())
613  {
614  aTopMargin.SetLower( static_cast<sal_uInt16>(GetCoreValue( *m_xBottomMarginEdit, eUnit )) );
615  bMod = true;
616  }
617 
618  // set top and bottom margins
619 
620  if ( bMod )
621  {
622  pOld = GetOldItem( *rSet, SID_ATTR_ULSPACE );
623 
624  if ( !pOld || *static_cast<const SvxULSpaceItem*>(pOld) != aTopMargin )
625  {
626  bModified = true;
627  rSet->Put( aTopMargin );
628  }
629  }
630 
631  // paper tray
632  nWhich = GetWhich( SID_ATTR_PAGE_PAPERBIN );
633  sal_Int32 nPos = m_xPaperTrayBox->get_active();
634  sal_uInt16 nBin = m_xPaperTrayBox->get_id(nPos).toInt32();
635  pOld = GetOldItem( *rSet, SID_ATTR_PAGE_PAPERBIN );
636 
637  if ( !pOld || static_cast<const SvxPaperBinItem*>(pOld)->GetValue() != nBin )
638  {
639  rSet->Put( SvxPaperBinItem( nWhich, static_cast<sal_uInt8>(nBin) ) );
640  bModified = true;
641  }
642 
643  Paper ePaper = m_xPaperSizeBox->GetSelection();
644  bool bChecked = m_xLandscapeBtn->get_active();
645 
646  if ( PAPER_USER == ePaper )
647  {
648  if ( m_xPaperSizeBox->get_value_changed_from_saved() ||
649  m_xPaperWidthEdit->get_value_changed_from_saved() ||
650  m_xPaperHeightEdit->get_value_changed_from_saved() ||
651  m_xLandscapeBtn->get_state_changed_from_saved() )
652  {
653  Size aSize( GetCoreValue( *m_xPaperWidthEdit, eUnit ),
654  GetCoreValue( *m_xPaperHeightEdit, eUnit ) );
655  pOld = GetOldItem( *rSet, SID_ATTR_PAGE_SIZE );
656 
657  if ( !pOld || static_cast<const SvxSizeItem*>(pOld)->GetSize() != aSize )
658  {
659  rSet->Put( SvxSizeItem( GetWhich(SID_ATTR_PAGE_SIZE), aSize ) );
660  bModified = true;
661  }
662  }
663  }
664  else
665  {
666  if (m_xPaperSizeBox->get_value_changed_from_saved() || m_xLandscapeBtn->get_state_changed_from_saved())
667  {
668  Size aSize( SvxPaperInfo::GetPaperSize( ePaper, eUnit ) );
669 
670  if ( bChecked )
671  Swap( aSize );
672 
673  pOld = GetOldItem( *rSet, SID_ATTR_PAGE_SIZE );
674 
675  if ( !pOld || static_cast<const SvxSizeItem*>(pOld)->GetSize() != aSize )
676  {
677  rSet->Put( SvxSizeItem( GetWhich(SID_ATTR_PAGE_SIZE), aSize ) );
678  bModified = true;
679  }
680  }
681  }
682 
683  nWhich = GetWhich( SID_ATTR_PAGE );
684  SvxPageItem aPage( static_cast<const SvxPageItem&>(rOldSet.Get( nWhich )) );
685  bMod = m_xLayoutBox->get_value_changed_from_saved();
686 
687  if ( bMod )
688  aPage.SetPageUsage(::PosToPageUsage_Impl(m_xLayoutBox->get_active()));
689 
690  if (m_xLandscapeBtn->get_state_changed_from_saved())
691  {
692  aPage.SetLandscape(bChecked);
693  bMod = true;
694  }
695 
696  //Get the NumType value
697  nPos = m_xNumberFormatBox->get_active();
698  SvxNumType nEntryData = static_cast<SvxNumType>(m_xNumberFormatBox->get_id(nPos).toInt32());
699  if (m_xNumberFormatBox->get_value_changed_from_saved())
700  {
701  aPage.SetNumType( nEntryData );
702  bMod = true;
703  }
704 
705  if ( bMod )
706  {
707  pOld = GetOldItem( *rSet, SID_ATTR_PAGE );
708 
709  if ( !pOld || *static_cast<const SvxPageItem*>(pOld) != aPage )
710  {
711  rSet->Put( aPage );
712  bModified = true;
713  }
714  }
715  else if ( SfxItemState::DEFAULT == rOldSet.GetItemState( nWhich ) )
716  rSet->ClearItem( nWhich );
717  else
718  rSet->Put( rOldSet.Get( nWhich ) );
719 
720  // evaluate mode specific controls
721 
722  switch ( eMode )
723  {
725  {
726  if (m_xHorzBox->get_state_changed_from_saved())
727  {
728  SfxBoolItem aHorz( GetWhich( SID_ATTR_PAGE_EXT1 ),
729  m_xHorzBox->get_active() );
730  rSet->Put( aHorz );
731  bModified = true;
732  }
733 
734  if (m_xVertBox->get_state_changed_from_saved())
735  {
736  SfxBoolItem aVert( GetWhich( SID_ATTR_PAGE_EXT2 ),
737  m_xVertBox->get_active() );
738  rSet->Put( aVert );
739  bModified = true;
740  }
741  break;
742  }
743 
745  {
746  // always put so that draw can evaluate this
747  rSet->Put( SfxBoolItem( GetWhich( SID_ATTR_PAGE_EXT1 ),
748  m_xAdaptBox->get_active() ) );
749  bModified = true;
750  break;
751  }
752  default: ;//prevent warning
753 
754  }
755 
756  if (m_xRegisterCB->get_visible() &&
757  (m_xRegisterCB->get_active() || m_xRegisterCB->get_state_changed_from_saved()))
758  {
759  const SfxBoolItem& rRegItem = static_cast<const SfxBoolItem&>(rOldSet.Get(SID_SWREGISTER_MODE));
760  std::unique_ptr<SfxBoolItem> pRegItem(static_cast<SfxBoolItem*>(rRegItem.Clone()));
761  bool bCheck = m_xRegisterCB->get_active();
762  pRegItem->SetValue(bCheck);
763  rSet->Put(std::move(pRegItem));
764  bModified = true;
765  if(bCheck)
766  {
767  bModified = true;
768  rSet->Put(SfxStringItem(SID_SWREGISTER_COLLECTION,
769  m_xRegisterLB->get_active_text()));
770  }
771  }
772 
773  if (m_xTextFlowBox->get_visible() && m_xTextFlowBox->get_value_changed_from_saved())
774  {
775  SvxFrameDirection eDirection = m_xTextFlowBox->get_active_id();
776  rSet->Put( SvxFrameDirectionItem( eDirection, GetWhich( SID_ATTR_FRAMEDIRECTION ) ) );
777  bModified = true;
778  }
779 
780  return bModified;
781 }
782 
784 {
785  // switch inside outside
786  const SvxPageUsage nUsage = PosToPageUsage_Impl(m_xLayoutBox->get_active());
787 
788  if (nUsage == SvxPageUsage::Mirror)
789  {
790  m_xLeftMarginLbl->hide();
791  m_xRightMarginLbl->hide();
792  m_xInsideLbl->show();
793  m_xOutsideLbl->show();
794  }
795  else
796  {
797  m_xLeftMarginLbl->show();
798  m_xRightMarginLbl->show();
799  m_xInsideLbl->hide();
800  m_xOutsideLbl->hide();
801  }
802  UpdateExample_Impl( true );
803 }
804 
805 IMPL_LINK_NOARG(SvxPageDescPage, PaperBinHdl_Impl, weld::Widget&, void)
806 {
807  // tdf#124226 disconnect so not called again, unless Reset occurs
808  m_xPaperTrayBox->connect_focus_in(Link<weld::Widget&, void>());
809 
810  OUString aOldName = m_xPaperTrayBox->get_active_text();
811  m_xPaperTrayBox->freeze();
812  m_xPaperTrayBox->clear();
813  m_xPaperTrayBox->append(OUString::number(PAPERBIN_PRINTER_SETTINGS), EditResId(RID_SVXSTR_PAPERBIN_SETTINGS));
814  OUString aPaperBin(EditResId(RID_SVXSTR_PAPERBIN));
815  const sal_uInt16 nBinCount = mpDefPrinter->GetPaperBinCount();
816 
817  for (sal_uInt16 i = 0; i < nBinCount; ++i)
818  {
819  OUString aName = mpDefPrinter->GetPaperBinName(i);
820  if (aName.isEmpty())
821  {
822  aName = aPaperBin + " " + OUString::number( i+1 );
823  }
824  m_xPaperTrayBox->append(OUString::number(i), aName);
825  }
826  m_xPaperTrayBox->set_active_text(aOldName);
827  m_xPaperTrayBox->thaw();
828 
829  // tdf#123650 explicitly grab-focus after the modification otherwise gtk loses track
830  // of there the focus should be
831  m_xPaperTrayBox->grab_focus();
832 }
833 
834 IMPL_LINK_NOARG(SvxPageDescPage, PaperSizeSelect_Impl, weld::ComboBox&, void)
835 {
836  Paper ePaper = m_xPaperSizeBox->GetSelection();
837 
838  if ( ePaper != PAPER_USER )
839  {
840  Size aSize( SvxPaperInfo::GetPaperSize( ePaper, MapUnit::Map100thMM ) );
841 
842  if (m_xLandscapeBtn->get_active())
843  Swap( aSize );
844 
845  if ( aSize.Height() < m_xPaperHeightEdit->get_min( FieldUnit::MM_100TH ) )
846  m_xPaperHeightEdit->set_min(
847  m_xPaperHeightEdit->normalize( aSize.Height() ), FieldUnit::MM_100TH );
848  if ( aSize.Width() < m_xPaperWidthEdit->get_min( FieldUnit::MM_100TH ) )
849  m_xPaperWidthEdit->set_min(
850  m_xPaperWidthEdit->normalize( aSize.Width() ), FieldUnit::MM_100TH );
851  SetMetricValue( *m_xPaperHeightEdit, aSize.Height(), MapUnit::Map100thMM );
852  SetMetricValue( *m_xPaperWidthEdit, aSize.Width(), MapUnit::Map100thMM );
853 
854  CalcMargin_Impl();
855 
856  RangeHdl_Impl();
857  UpdateExample_Impl( true );
858 
859  if ( eMode == SVX_PAGE_MODE_PRESENTATION )
860  {
861  // Draw: if paper format the margin shall be 1 cm
862  long nTmp = 0;
863  bool bScreen = (( PAPER_SCREEN_4_3 == ePaper )||( PAPER_SCREEN_16_9 == ePaper)||( PAPER_SCREEN_16_10 == ePaper));
864 
865  if ( !bScreen )
866  // no margin if screen
867  nTmp = 1; // accordingly 1 cm
868 
869  if ( bScreen || m_xRightMarginEdit->get_value(FieldUnit::NONE) == 0 )
870  SetMetricValue( *m_xRightMarginEdit, nTmp, MapUnit::MapCM );
871  if ( bScreen || m_xLeftMarginEdit->get_value(FieldUnit::NONE) == 0 )
872  SetMetricValue( *m_xLeftMarginEdit, nTmp, MapUnit::MapCM );
873  if ( bScreen || m_xBottomMarginEdit->get_value(FieldUnit::NONE) == 0 )
874  SetMetricValue( *m_xBottomMarginEdit, nTmp, MapUnit::MapCM );
875  if ( bScreen || m_xTopMarginEdit->get_value(FieldUnit::NONE) == 0 )
876  SetMetricValue( *m_xTopMarginEdit, nTmp, MapUnit::MapCM );
877  UpdateExample_Impl( true );
878  }
879  }
880 }
881 
883 {
884  sal_uInt16 nWhich = GetWhich( SID_ATTR_LRSPACE );
885  MapUnit eUnit = GetItemSet().GetPool()->GetMetric( nWhich );
886  Size aSize( GetCoreValue( *m_xPaperWidthEdit, eUnit ),
887  GetCoreValue( *m_xPaperHeightEdit, eUnit ) );
888 
889  if ( aSize.Width() > aSize.Height() )
890  {
891  m_xLandscapeBtn->set_active(true);
892  bLandscape = true;
893  }
894  else
895  {
896  m_xPortraitBtn->set_active(true);
897  bLandscape = false;
898  }
899 
900  Paper ePaper = SvxPaperInfo::GetSvxPaper( aSize, eUnit );
901  m_xPaperSizeBox->SetSelection( ePaper );
902  UpdateExample_Impl( true );
903 
904  RangeHdl_Impl();
905 }
906 
907 IMPL_LINK(SvxPageDescPage, SwapOrientation_Impl, weld::Button&, rBtn, void)
908 {
909  if (
910  (!bLandscape && &rBtn == m_xLandscapeBtn.get()) ||
911  (bLandscape && &rBtn == m_xPortraitBtn.get())
912  )
913  {
914  bLandscape = m_xLandscapeBtn->get_active();
915 
916  const long lWidth = GetCoreValue( *m_xPaperWidthEdit, MapUnit::Map100thMM );
917  const long lHeight = GetCoreValue( *m_xPaperHeightEdit, MapUnit::Map100thMM );
918 
919  // swap width and height
920  SetMetricValue(*m_xPaperWidthEdit, lHeight, MapUnit::Map100thMM);
921  SetMetricValue(*m_xPaperHeightEdit, lWidth, MapUnit::Map100thMM);
922 
923  // recalculate margins if necessary
924  CalcMargin_Impl();
925 
926  PaperSizeSelect_Impl(m_xPaperSizeBox->get_widget());
927  RangeHdl_Impl();
928  SwapFirstValues_Impl(bBorderModified);
929  UpdateExample_Impl(true);
930  }
931 }
932 
934 {
935  MapMode aOldMode = mpDefPrinter->GetMapMode();
936  Orientation eOri = Orientation::Portrait;
937 
938  if ( bLandscape )
939  eOri = Orientation::Landscape;
941  mpDefPrinter->SetOrientation( eOri );
942  mpDefPrinter->SetMapMode(MapMode(MapUnit::MapTwip));
943 
944  // set first- and last-values for margins
945  Size aPaperSize = mpDefPrinter->GetPaperSize();
946  Size aPrintSize = mpDefPrinter->GetOutputSize();
947  /*
948  * To convert a point ( 0,0 ) into logic coordinates
949  * looks like nonsense; but it makes sense if the
950  * coordinate system's origin has been moved.
951  */
953  mpDefPrinter->SetMapMode( aOldMode );
954  mpDefPrinter->SetOrientation( eOldOri );
955 
956  sal_Int64 nSetL = m_xLeftMarginEdit->denormalize(
957  m_xLeftMarginEdit->get_value( FieldUnit::TWIP ) );
958  sal_Int64 nSetR = m_xRightMarginEdit->denormalize(
959  m_xRightMarginEdit->get_value( FieldUnit::TWIP ) );
960  sal_Int64 nSetT = m_xTopMarginEdit->denormalize(
961  m_xTopMarginEdit->get_value( FieldUnit::TWIP ) );
962  sal_Int64 nSetB = m_xBottomMarginEdit->denormalize(
963  m_xBottomMarginEdit->get_value( FieldUnit::TWIP ) );
964 
965  long nNewL = aPrintOffset.X();
966  long nNewR = aPaperSize.Width() - aPrintSize.Width() - aPrintOffset.X();
967  long nNewT = aPrintOffset.Y();
968  long nNewB = aPaperSize.Height() - aPrintSize.Height() - aPrintOffset.Y();
969 
970  nFirstLeftMargin = m_xLeftMarginEdit->convert_value_from(m_xLeftMarginEdit->normalize(nNewL), FieldUnit::TWIP);
971  nFirstRightMargin = m_xRightMarginEdit->convert_value_from(m_xRightMarginEdit->normalize(nNewR), FieldUnit::TWIP);
972  nFirstTopMargin = m_xTopMarginEdit->convert_value_from(m_xTopMarginEdit->normalize(nNewT), FieldUnit::TWIP);
973  nFirstBottomMargin = m_xBottomMarginEdit->convert_value_from(m_xBottomMarginEdit->normalize(nNewB), FieldUnit::TWIP);
974 
975  if ( bSet )
976  {
977  if ( nSetL < nNewL )
978  m_xLeftMarginEdit->set_value( m_xLeftMarginEdit->normalize( nNewL ),
979  FieldUnit::TWIP );
980  if ( nSetR < nNewR )
981  m_xRightMarginEdit->set_value( m_xRightMarginEdit->normalize( nNewR ),
982  FieldUnit::TWIP );
983  if ( nSetT < nNewT )
984  m_xTopMarginEdit->set_value( m_xTopMarginEdit->normalize( nNewT ),
985  FieldUnit::TWIP );
986  if ( nSetB < nNewB )
987  m_xBottomMarginEdit->set_value( m_xBottomMarginEdit->normalize( nNewB ),
988  FieldUnit::TWIP );
989  }
990 }
991 
993 {
994  if ( !bBorderModified )
995  bBorderModified = true;
996  UpdateExample_Impl();
997 
998  RangeHdl_Impl();
999 }
1000 
1001 void SvxPageDescPage::UpdateExample_Impl( bool bResetbackground )
1002 {
1003  // Size
1004  Size aSize( GetCoreValue( *m_xPaperWidthEdit, MapUnit::MapTwip ),
1005  GetCoreValue( *m_xPaperHeightEdit, MapUnit::MapTwip ) );
1006 
1007  m_aBspWin.SetSize( aSize );
1008 
1009  // Margins
1010  m_aBspWin.SetTop( GetCoreValue( *m_xTopMarginEdit, MapUnit::MapTwip ) );
1011  m_aBspWin.SetBottom( GetCoreValue( *m_xBottomMarginEdit, MapUnit::MapTwip ) );
1012  m_aBspWin.SetLeft( GetCoreValue( *m_xLeftMarginEdit, MapUnit::MapTwip ) );
1013  m_aBspWin.SetRight( GetCoreValue( *m_xRightMarginEdit, MapUnit::MapTwip ) );
1014 
1015  // Layout
1017  if ( bResetbackground )
1019  m_aBspWin.Invalidate();
1020 }
1021 
1022 
1024 {
1025  sal_uInt16 nWhich(GetWhich(SID_ATTR_PAGE_HEADERSET));
1026 
1027  if (SfxItemState::SET == rSet.GetItemState(nWhich, false))
1028  {
1029  const SvxSetItem& rSetItem = static_cast< const SvxSetItem& >(rSet.Get(nWhich, false));
1030  const SfxItemSet& rTmpSet = rSetItem.GetItemSet();
1031  const SfxBoolItem& rOn = static_cast< const SfxBoolItem& >(rTmpSet.Get(GetWhich(SID_ATTR_PAGE_ON)));
1032 
1033  if(rOn.GetValue())
1034  {
1036 
1038  {
1039  // create FillAttributes directly from DrawingLayer FillStyle entries
1040  aHeaderFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(rTmpSet));
1041  }
1042  else
1043  {
1044  nWhich = GetWhich(SID_ATTR_BRUSH);
1045 
1046  if(SfxItemState::SET == rTmpSet.GetItemState(nWhich))
1047  {
1048  // create FillAttributes from SvxBrushItem
1049  const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(rTmpSet.Get(nWhich));
1051 
1053  aHeaderFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(aTempSet));
1054  }
1055  }
1056 
1057  m_aBspWin.setHeaderFillAttributes(aHeaderFillAttributes);
1058  }
1059  }
1060 
1061  nWhich = GetWhich(SID_ATTR_PAGE_FOOTERSET);
1062 
1063  if (SfxItemState::SET == rSet.GetItemState(nWhich, false))
1064  {
1065  const SvxSetItem& rSetItem = static_cast< const SvxSetItem& >(rSet.Get(nWhich,false));
1066  const SfxItemSet& rTmpSet = rSetItem.GetItemSet();
1067  const SfxBoolItem& rOn = static_cast< const SfxBoolItem& >(rTmpSet.Get(GetWhich(SID_ATTR_PAGE_ON)));
1068 
1069  if(rOn.GetValue())
1070  {
1072 
1074  {
1075  // create FillAttributes directly from DrawingLayer FillStyle entries
1076  aFooterFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(rTmpSet));
1077  }
1078  else
1079  {
1080  nWhich = GetWhich(SID_ATTR_BRUSH);
1081 
1082  if(SfxItemState::SET == rTmpSet.GetItemState(nWhich))
1083  {
1084  // create FillAttributes from SvxBrushItem
1085  const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(rTmpSet.Get(nWhich));
1087 
1089  aFooterFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(aTempSet));
1090  }
1091  }
1092 
1093  m_aBspWin.setFooterFillAttributes(aFooterFillAttributes);
1094  }
1095  }
1096 
1098  const SfxPoolItem* pItem = nullptr;
1099 
1101  {
1102  // create FillAttributes directly from DrawingLayer FillStyle entries
1103  aPageFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(rSet));
1104  }
1105  else
1106  {
1107  pItem = GetItem(rSet, SID_ATTR_BRUSH);
1108 
1109  if(pItem)
1110  {
1111  // create FillAttributes from SvxBrushItem
1112  const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(*pItem);
1114 
1116  aPageFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(aTempSet));
1117  }
1118  }
1119 
1120  m_aBspWin.setPageFillAttributes(aPageFillAttributes);
1121 }
1122 
1124 {
1125  bLandscape = m_xLandscapeBtn->get_active();
1126  const SfxPoolItem* pItem = GetItem( rSet, SID_ATTR_PAGE_SIZE );
1127 
1128  if ( pItem )
1129  m_aBspWin.SetSize( static_cast<const SvxSizeItem*>(pItem)->GetSize() );
1130 
1131  const SvxSetItem* pSetItem = nullptr;
1132 
1133  // evaluate header attributes
1134 
1135  if ( SfxItemState::SET ==
1136  rSet.GetItemState( GetWhich( SID_ATTR_PAGE_HEADERSET ),
1137  false, reinterpret_cast<const SfxPoolItem**>(&pSetItem) ) )
1138  {
1139  const SfxItemSet& rHeaderSet = pSetItem->GetItemSet();
1140  const SfxBoolItem& rHeaderOn =
1141  static_cast<const SfxBoolItem&>(rHeaderSet.Get( GetWhich( SID_ATTR_PAGE_ON ) ));
1142 
1143  if ( rHeaderOn.GetValue() )
1144  {
1145  const SvxSizeItem& rSize = static_cast<const SvxSizeItem&>(
1146  rHeaderSet.Get( GetWhich( SID_ATTR_PAGE_SIZE ) ));
1147  const SvxULSpaceItem& rUL = static_cast<const SvxULSpaceItem&>(
1148  rHeaderSet.Get( GetWhich( SID_ATTR_ULSPACE ) ));
1149  long nDist = rUL.GetLower();
1150  m_aBspWin.SetHdHeight( rSize.GetSize().Height() - nDist );
1151  m_aBspWin.SetHdDist( nDist );
1152  const SvxLRSpaceItem& rLR = static_cast<const SvxLRSpaceItem&>(
1153  rHeaderSet.Get( GetWhich( SID_ATTR_LRSPACE ) ));
1154  m_aBspWin.SetHdLeft( rLR.GetLeft() );
1155  m_aBspWin.SetHdRight( rLR.GetRight() );
1156  m_aBspWin.SetHeader( true );
1157  }
1158  else
1159  m_aBspWin.SetHeader( false );
1160 
1161  // show background and border in the example
1163 
1165  {
1166  // create FillAttributes directly from DrawingLayer FillStyle entries
1167  aHeaderFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(rHeaderSet));
1168  }
1169  else
1170  {
1171  const sal_uInt16 nWhich(GetWhich(SID_ATTR_BRUSH));
1172 
1173  if(rHeaderSet.GetItemState(nWhich) >= SfxItemState::DEFAULT)
1174  {
1175  // aBspWin.SetHdColor(rItem.GetColor());
1176  const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(rHeaderSet.Get(nWhich));
1178 
1180  aHeaderFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(aTempSet));
1181  }
1182  }
1183 
1184  m_aBspWin.setHeaderFillAttributes(aHeaderFillAttributes);
1185  }
1186 
1187  // evaluate footer attributes
1188 
1189  if ( SfxItemState::SET ==
1190  rSet.GetItemState( GetWhich( SID_ATTR_PAGE_FOOTERSET ),
1191  false, reinterpret_cast<const SfxPoolItem**>(&pSetItem) ) )
1192  {
1193  const SfxItemSet& rFooterSet = pSetItem->GetItemSet();
1194  const SfxBoolItem& rFooterOn =
1195  static_cast<const SfxBoolItem&>(rFooterSet.Get( GetWhich( SID_ATTR_PAGE_ON ) ));
1196 
1197  if ( rFooterOn.GetValue() )
1198  {
1199  const SvxSizeItem& rSize = static_cast<const SvxSizeItem&>(
1200  rFooterSet.Get( GetWhich( SID_ATTR_PAGE_SIZE ) ));
1201  const SvxULSpaceItem& rUL = static_cast<const SvxULSpaceItem&>(
1202  rFooterSet.Get( GetWhich( SID_ATTR_ULSPACE ) ));
1203  long nDist = rUL.GetUpper();
1204  m_aBspWin.SetFtHeight( rSize.GetSize().Height() - nDist );
1205  m_aBspWin.SetFtDist( nDist );
1206  const SvxLRSpaceItem& rLR = static_cast<const SvxLRSpaceItem&>(
1207  rFooterSet.Get( GetWhich( SID_ATTR_LRSPACE ) ));
1208  m_aBspWin.SetFtLeft( rLR.GetLeft() );
1209  m_aBspWin.SetFtRight( rLR.GetRight() );
1210  m_aBspWin.SetFooter( true );
1211  }
1212  else
1213  m_aBspWin.SetFooter( false );
1214 
1215  // show background and border in the example
1217 
1219  {
1220  // create FillAttributes directly from DrawingLayer FillStyle entries
1221  aFooterFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(rFooterSet));
1222  }
1223  else
1224  {
1225  const sal_uInt16 nWhich(GetWhich(SID_ATTR_BRUSH));
1226 
1227  if(rFooterSet.GetItemState(nWhich) >= SfxItemState::DEFAULT)
1228  {
1229  // aBspWin.SetFtColor(rItem.GetColor());
1230  const SvxBrushItem& rItem = static_cast<const SvxBrushItem&>(rFooterSet.Get(nWhich));
1232 
1234  aFooterFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(aTempSet));
1235  }
1236  }
1237 
1238  m_aBspWin.setFooterFillAttributes(aFooterFillAttributes);
1239  }
1240 }
1241 
1243 {
1244  InitHeadFoot_Impl( rSet );
1246  ResetBackground_Impl( rSet );
1247  RangeHdl_Impl();
1248 }
1249 
1251 {
1252  // Inquiry whether the page margins are beyond the printing area.
1253  // If not, ask user whether they shall be taken.
1254  // If not, stay on the TabPage.
1255  Paper ePaper = m_xPaperSizeBox->GetSelection();
1256 
1257  if ( ePaper != PAPER_SCREEN_4_3 && ePaper != PAPER_SCREEN_16_9 && ePaper != PAPER_SCREEN_16_10 && IsMarginOutOfRange() )
1258  {
1259  std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(GetFrameWeld(),
1260  VclMessageType::Question, VclButtonsType::YesNo,
1261  m_xPrintRangeQueryText->get_label()));
1262  xQueryBox->set_default_response(RET_NO);
1263  if (xQueryBox->run() == RET_NO)
1264  {
1265  weld::MetricSpinButton* pField = nullptr;
1267  pField = m_xLeftMarginEdit.get();
1269  && !pField )
1270  pField = m_xRightMarginEdit.get();
1272  && !pField )
1273  pField = m_xTopMarginEdit.get();
1275  && !pField )
1276  pField = m_xBottomMarginEdit.get();
1277  if ( pField )
1278  pField->grab_focus();
1280  return DeactivateRC::KeepPage;
1281  }
1282  else
1283  CheckMarginEdits( false );
1284  }
1285 
1286  if ( _pSet )
1287  {
1288  FillItemSet( _pSet );
1289 
1290  // put portray/landscape if applicable
1291  sal_uInt16 nWh = GetWhich( SID_ATTR_PAGE_SIZE );
1292  MapUnit eUnit = GetItemSet().GetPool()->GetMetric( nWh );
1293  Size aSize( GetCoreValue( *m_xPaperWidthEdit, eUnit ),
1294  GetCoreValue( *m_xPaperHeightEdit, eUnit ) );
1295 
1296  // put, if current size is different to the value in _pSet
1297  const SvxSizeItem* pSize = GetItem( *_pSet, SID_ATTR_PAGE_SIZE );
1298  if ( aSize.Width() && ( !pSize || !IsEqualSize_Impl( pSize, aSize ) ) )
1299  _pSet->Put( SvxSizeItem( nWh, aSize ) );
1300  }
1301 
1302  return DeactivateRC::LeavePage;
1303 }
1304 
1306 {
1307  // example window
1308  long nHHeight = m_aBspWin.GetHdHeight();
1309  long nHDist = m_aBspWin.GetHdDist();
1310 
1311  long nFHeight = m_aBspWin.GetFtHeight();
1312  long nFDist = m_aBspWin.GetFtDist();
1313 
1314  long nHFLeft = std::max(m_aBspWin.GetHdLeft(), m_aBspWin.GetFtLeft());
1315  long nHFRight = std::max(m_aBspWin.GetHdRight(), m_aBspWin.GetFtRight());
1316 
1317  // current values for page margins
1318  long nBT = static_cast<long>(m_xTopMarginEdit->denormalize(m_xTopMarginEdit->get_value(FieldUnit::TWIP)));
1319  long nBB = static_cast<long>(m_xBottomMarginEdit->denormalize(m_xBottomMarginEdit->get_value(FieldUnit::TWIP)));
1320  long nBL = static_cast<long>(m_xLeftMarginEdit->denormalize(m_xLeftMarginEdit->get_value(FieldUnit::TWIP)));
1321  long nBR = static_cast<long>(m_xRightMarginEdit->denormalize(m_xRightMarginEdit->get_value(FieldUnit::TWIP)));
1322 
1323  // calculate width of page border
1324  const SfxItemSet* _pSet = &GetItemSet();
1325  Size aBorder;
1326 
1327  if ( _pSet->GetItemState( GetWhich(SID_ATTR_BORDER_SHADOW) ) >=
1328  SfxItemState::DEFAULT &&
1329  _pSet->GetItemState( GetWhich(SID_ATTR_BORDER_OUTER) ) >=
1330  SfxItemState::DEFAULT )
1331  {
1332  aBorder = GetMinBorderSpace_Impl(
1333  static_cast<const SvxShadowItem&>(_pSet->Get(GetWhich(SID_ATTR_BORDER_SHADOW))),
1334  static_cast<const SvxBoxItem&>(_pSet->Get(GetWhich(SID_ATTR_BORDER_OUTER))));
1335  }
1336 
1337  // limits paper
1338  // maximum is 54 cm
1339 
1340  long nMin = nHHeight + nHDist + nFDist + nFHeight + nBT + nBB +
1341  MINBODY + aBorder.Height();
1342  m_xPaperHeightEdit->set_min(m_xPaperHeightEdit->normalize(nMin), FieldUnit::TWIP);
1343 
1344  nMin = MINBODY + nBL + nBR + aBorder.Width();
1345  m_xPaperWidthEdit->set_min(m_xPaperWidthEdit->normalize(nMin), FieldUnit::TWIP);
1346 
1347  long nH = static_cast<long>(m_xPaperHeightEdit->denormalize(m_xPaperHeightEdit->get_value(FieldUnit::TWIP)));
1348  long nW = static_cast<long>(m_xPaperWidthEdit->denormalize(m_xPaperWidthEdit->get_value(FieldUnit::TWIP)));
1349 
1350  // Top
1351  long nMax = nH - nBB - aBorder.Height() - MINBODY -
1352  nFDist - nFHeight - nHDist - nHHeight;
1353 
1354  m_xTopMarginEdit->set_max(m_xTopMarginEdit->normalize(nMax), FieldUnit::TWIP);
1355 
1356  // Bottom
1357  nMax = nH - nBT - aBorder.Height() - MINBODY -
1358  nFDist - nFHeight - nHDist - nHHeight;
1359 
1360  m_xBottomMarginEdit->set_max(m_xTopMarginEdit->normalize(nMax), FieldUnit::TWIP);
1361 
1362  // Left
1363  nMax = nW - nBR - MINBODY - aBorder.Width() - nHFLeft - nHFRight;
1364  m_xLeftMarginEdit->set_max(m_xLeftMarginEdit->normalize(nMax), FieldUnit::TWIP);
1365 
1366  // Right
1367  nMax = nW - nBL - MINBODY - aBorder.Width() - nHFLeft - nHFRight;
1368  m_xRightMarginEdit->set_max(m_xRightMarginEdit->normalize(nMax), FieldUnit::TWIP);
1369 }
1370 
1372 {
1373  // current values for page margins
1374  long nBT = GetCoreValue( *m_xTopMarginEdit, MapUnit::MapTwip );
1375  long nBB = GetCoreValue( *m_xBottomMarginEdit, MapUnit::MapTwip );
1376 
1377  long nBL = GetCoreValue( *m_xLeftMarginEdit, MapUnit::MapTwip );
1378  long nBR = GetCoreValue( *m_xRightMarginEdit, MapUnit::MapTwip );
1379 
1380  long nH = GetCoreValue( *m_xPaperHeightEdit, MapUnit::MapTwip );
1381  long nW = GetCoreValue( *m_xPaperWidthEdit, MapUnit::MapTwip );
1382 
1383  long nWidth = nBL + nBR + MINBODY;
1384  long nHeight = nBT + nBB + MINBODY;
1385 
1386  if ( nWidth > nW || nHeight > nH )
1387  {
1388  if ( nWidth > nW )
1389  {
1390  long nTmp = nBL <= nBR ? nBR : nBL;
1391  nTmp -= nWidth - nW;
1392 
1393  if ( nBL <= nBR )
1394  SetMetricValue( *m_xRightMarginEdit, nTmp, MapUnit::MapTwip );
1395  else
1396  SetMetricValue( *m_xLeftMarginEdit, nTmp, MapUnit::MapTwip );
1397  }
1398 
1399  if ( nHeight > nH )
1400  {
1401  long nTmp = nBT <= nBB ? nBB : nBT;
1402  nTmp -= nHeight - nH;
1403 
1404  if ( nBT <= nBB )
1405  SetMetricValue( *m_xBottomMarginEdit, nTmp, MapUnit::MapTwip );
1406  else
1407  SetMetricValue( *m_xTopMarginEdit, nTmp, MapUnit::MapTwip );
1408  }
1409  }
1410 }
1411 
1413 {
1414  m_aBspWin.SetHorz(m_xHorzBox->get_active());
1415  m_aBspWin.SetVert(m_xVertBox->get_active());
1416  UpdateExample_Impl();
1417 }
1418 
1419 void SvxPageDescPage::SetCollectionList(const std::vector<OUString> &aList)
1420 {
1421  OSL_ENSURE(!aList.empty(), "Empty string list");
1422 
1423  sStandardRegister = aList[0];
1424  m_xRegisterLB->freeze();
1425  for (size_t i = 1; i < aList.size(); ++i)
1426  m_xRegisterLB->append_text(aList[i]);
1427  m_xRegisterLB->thaw();
1428 
1429  m_xRegisterCB->show();
1430  m_xRegisterFT->show();
1431  m_xRegisterLB->show();
1432  m_xRegisterCB->connect_toggled(LINK(this, SvxPageDescPage, RegisterModify));
1433 }
1434 
1435 IMPL_LINK(SvxPageDescPage, RegisterModify, weld::ToggleButton&, rBox, void)
1436 {
1437  bool bEnable = false;
1438  if (rBox.get_active())
1439  {
1440  bEnable = true;
1441  if (m_xRegisterLB->get_active() == -1)
1442  m_xRegisterLB->set_active_text(sStandardRegister);
1443  }
1444  m_xRegisterFT->set_sensitive(bEnable);
1445  m_xRegisterLB->set_sensitive(bEnable);
1446 }
1447 
1449 {
1450  m_xTextFlowBox->remove_id(SvxFrameDirection::Vertical_RL_TB);
1451  m_xTextFlowBox->remove_id(SvxFrameDirection::Vertical_LR_TB);
1452  if (m_xTextFlowBox->get_count() < 2)
1453  {
1454  m_xTextFlowLbl->hide();
1455  m_xTextFlowBox->hide();
1457  }
1458 }
1459 
1460 IMPL_LINK_NOARG(SvxPageDescPage, FrameDirectionModify_Impl, weld::ComboBox&, void)
1461 {
1462  m_aBspWin.SetFrameDirection(m_xTextFlowBox->get_active_id());
1463  m_aBspWin.Invalidate();
1464 }
1465 
1467  weld::MetricSpinButton& rField, long nFirstMargin, long nLastMargin, MarginPosition nPos )
1468 {
1469  bool bRet = false;
1470  bool bCheck = ( ( m_nPos & nPos ) == 0 );
1471  long nValue = rField.get_value(FieldUnit::NONE);
1472  if ( bCheck &&
1473  ( nValue < nFirstMargin || nValue > nLastMargin ) &&
1474  rField.get_value_changed_from_saved() )
1475  {
1476  rField.set_value(nValue < nFirstMargin ? nFirstMargin : nLastMargin, FieldUnit::NONE);
1477  bRet = true;
1478  }
1479 
1480  return bRet;
1481 }
1482 
1487 {
1488  if ( _bClear )
1489  m_nPos = 0;
1490 
1491  sal_Int64 nValue = m_xLeftMarginEdit->get_value(FieldUnit::NONE);
1492  if ( nValue < nFirstLeftMargin || nValue > nLastLeftMargin )
1493  m_nPos |= MARGIN_LEFT;
1494  nValue = m_xRightMarginEdit->get_value(FieldUnit::NONE);
1495  if ( nValue < nFirstRightMargin || nValue > nLastRightMargin )
1496  m_nPos |= MARGIN_RIGHT;
1497  nValue = m_xTopMarginEdit->get_value(FieldUnit::NONE);
1498  if ( nValue < nFirstTopMargin || nValue > nLastTopMargin )
1499  m_nPos |= MARGIN_TOP;
1500  nValue = m_xBottomMarginEdit->get_value(FieldUnit::NONE);
1501  if ( nValue < nFirstBottomMargin || nValue > nLastBottomMargin )
1502  m_nPos |= MARGIN_BOTTOM;
1503 }
1504 
1506 {
1507  bool bRet = ( ( ( !( m_nPos & MARGIN_LEFT ) &&
1508  m_xLeftMarginEdit->get_value_changed_from_saved() ) &&
1509  ( m_xLeftMarginEdit->get_value(FieldUnit::NONE) < nFirstLeftMargin ||
1510  m_xLeftMarginEdit->get_value(FieldUnit::NONE) > nLastLeftMargin ) ) ||
1511  ( ( !( m_nPos & MARGIN_RIGHT ) &&
1512  m_xRightMarginEdit->get_value_changed_from_saved() ) &&
1513  ( m_xRightMarginEdit->get_value(FieldUnit::NONE) < nFirstRightMargin ||
1514  m_xRightMarginEdit->get_value(FieldUnit::NONE) > nLastRightMargin ) ) ||
1515  ( ( !( m_nPos & MARGIN_TOP ) &&
1516  m_xTopMarginEdit->get_value_changed_from_saved() ) &&
1517  ( m_xTopMarginEdit->get_value(FieldUnit::NONE) < nFirstTopMargin ||
1518  m_xTopMarginEdit->get_value(FieldUnit::NONE) > nLastTopMargin ) ) ||
1519  ( ( !( m_nPos & MARGIN_BOTTOM ) &&
1520  m_xBottomMarginEdit->get_value_changed_from_saved() ) &&
1521  ( m_xBottomMarginEdit->get_value(FieldUnit::NONE) < nFirstBottomMargin ||
1522  m_xBottomMarginEdit->get_value(FieldUnit::NONE) > nLastBottomMargin ) ) );
1523  return bRet;
1524 }
1525 
1527 {
1528  const SfxAllEnumItem* pModeItem = aSet.GetItem<SfxAllEnumItem>(SID_ENUM_PAGE_MODE, false);
1529  const SfxAllEnumItem* pPaperStartItem = aSet.GetItem<SfxAllEnumItem>(SID_PAPER_START, false);
1530  const SfxAllEnumItem* pPaperEndItem = aSet.GetItem<SfxAllEnumItem>(SID_PAPER_END, false);
1531  const SfxStringListItem* pCollectListItem = aSet.GetItem<SfxStringListItem>(SID_COLLECT_LIST, false);
1532  const SfxBoolItem* pSupportDrawingLayerFillStyleItem = aSet.GetItem<SfxBoolItem>(SID_DRAWINGLAYER_FILLSTYLES, false);
1533 
1534  if (pModeItem)
1535  {
1536  eMode = static_cast<SvxModeType>(pModeItem->GetEnumValue());
1537  }
1538 
1539  if(pPaperStartItem && pPaperEndItem)
1540  {
1541  SetPaperFormatRanges(static_cast<Paper>(pPaperStartItem->GetEnumValue()));
1542  }
1543 
1544  if(pCollectListItem)
1545  {
1546  SetCollectionList(pCollectListItem->GetList());
1547  }
1548 
1549  if(pSupportDrawingLayerFillStyleItem)
1550  {
1551  const bool bNew(pSupportDrawingLayerFillStyleItem->GetValue());
1552 
1554  }
1555 }
1556 
1557 /* 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:59
#define MARGIN_LEFT
Definition: page.cxx:129
void SetFtRight(long nNew)
void SetHdRight(long nNew)
SVX_PAGE_MODE_PRESENTATION
FieldUnit
sal_uInt16 GetPaperBinCount() const
Orientation
SvxPageDescPage(TabPageParent pParent, const SfxItemSet &rSet)
Definition: page.cxx:141
void SetBottom(long nNew)
std::unique_ptr< weld::MetricSpinButton > m_xPaperWidthEdit
Definition: page.hxx:98
#define MARGIN_BOTTOM
Definition: page.cxx:132
Size & Swap(Size &rSize)
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:101
std::unique_ptr< weld::MetricSpinButton > m_xPaperHeightEdit
Definition: page.hxx:99
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:71
void RangeHdl_Impl()
Definition: page.cxx:1305
void setPageFillAttributes(const drawinglayer::attribute::SdrAllFillAttributesHelperPtr &rFillAttributes)
#define MARGIN_TOP
Definition: page.cxx:131
bool mbDelPrinter
Definition: page.hxx:91
void SetLandscape(bool bL)
sal_uInt16 MarginPosition
Definition: page.hxx:63
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
Definition: page.cxx:1250
std::unique_ptr< weld::MetricSpinButton > m_xRightMarginEdit
Definition: page.hxx:110
SvxModeType eMode
Definition: page.hxx:85
const MapMode & GetMapMode() const
IMPL_LINK_NOARG(SvxPageDescPage, LayoutHdl_Impl, weld::ComboBox &, void)
Definition: page.cxx:783
SvxFrameDirection
static SfxObjectShell * Current()
MarginPosition m_nPos
Definition: page.hxx:88
void SetHdLeft(long nNew)
OUString sStandardRegister
Definition: page.hxx:73
PAPER_SCREEN_4_3
long AdjustHeight(long n)
Orientation GetOrientation() const
void SetMapMode()
long nFirstRightMargin
Definition: page.hxx:75
std::unique_ptr< weld::Label > m_xRegisterFT
Definition: page.hxx:125
VclPtr< Printer > mpDefPrinter
Definition: page.hxx:89
static const SfxPoolItem * GetItem(const SfxItemSet &rSet, sal_uInt16 nSlot, bool bDeep=true)
long nFirstLeftMargin
Definition: page.hxx:74
sal_uInt32 GetMaximumPaperWidth() const
FieldUnit GetModuleFieldUnit(const SfxItemSet &rSet)
SvxNumType
void SetFtLeft(long nNew)
std::unique_ptr< SvxPageNumberListBox > m_xNumberFormatBox
Definition: page.hxx:116
Point GetPageOffset() const
RET_NO
bool IsMarginOutOfRange() const
Definition: page.cxx:1505
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:97
virtual void ActivatePage(const SfxItemSet &rSet) override
Definition: page.cxx:1242
void ResetBackground_Impl(const SfxItemSet &rSet)
Definition: page.cxx:1023
void SetLeft(const long nL, const sal_uInt16 nProp=100)
SvxNumType GetNumType() const
OUString SvxResId(const char *pId)
void Init_Impl()
Definition: page.cxx:303
static sal_uInt16 PageUsageToPos_Impl(SvxPageUsage nUsage)
Definition: page.cxx:82
void SetExchangeSupport()
weld::Window * GetFrameWeld(SfxFrame *pFrame)
void setFooterFillAttributes(const drawinglayer::attribute::SdrAllFillAttributesHelperPtr &rFillAttributes)
SvxPageWindow m_aBspWin
Definition: page.hxx:94
SVX_NUM_ARABIC
static SfxViewShell * Current()
std::shared_ptr< SdrAllFillAttributesHelper > SdrAllFillAttributesHelperPtr
void SetNumType(SvxNumType eNum)
sal_uInt32 GetMaximumPaperTopMargin() const
static VclPtr< SfxTabPage > Create(TabPageParent pParent, const SfxItemSet *rSet)
Definition: page.cxx:136
void ResetBackground()
void SetFrameDirection(SvxFrameDirection nDirection)
virtual void dispose() override
bool bLandscape
Definition: page.hxx:83
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:1419
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)
void SetRight(const long nR, const sal_uInt16 nProp=100)
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:1526
void SetTop(long nNew)
sal_uInt16 CalcShadowSpace(SvxShadowItemSide nShadow) const
void SetHeader(bool bNew)
int i
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:103
long nLastBottomMargin
Definition: page.hxx:81
void SetSize(const Size &rSize)
void setSvxBrushItemAsFillAttributesToTargetSet(const SvxBrushItem &rBrush, SfxItemSet &rToSet)
Paper ePaperStart
Definition: page.hxx:86
void UpdateExample_Impl(bool bResetbackground=false)
Definition: page.cxx:1001
long GetHdLeft() const
void set_value(int nValue, FieldUnit eValueUnit)
long GetFtDist() const
static SvxPageUsage PosToPageUsage_Impl(sal_uInt16 nPos)
Definition: page.cxx:91
void SwapFirstValues_Impl(bool bSet)
Definition: page.cxx:933
static Size GetPaperSize(Paper ePaper, MapUnit eUnit=MapUnit::MapTwip)
std::unique_ptr< weld::RadioButton > m_xLandscapeBtn
Definition: page.hxx:102
long nLastRightMargin
Definition: page.hxx:79
void SetMetricValue(weld::MetricSpinButton &rField, int nCoreValue, MapUnit eUnit)
std::unique_ptr< weld::ComboBox > m_xRegisterLB
Definition: page.hxx:126
bool get_value_changed_from_saved() const
SfxItemPool * GetPool() const
long GetFtLeft() const
long X() const
SVX_PAGE_MODE_STANDARD
std::unique_ptr< weld::Label > m_xTblAlignFT
Definition: page.hxx:118
long nLastTopMargin
Definition: page.hxx:80
std::unique_ptr< weld::Label > m_xPageText
Definition: page.hxx:114
SvxPageUsage
Point PixelToLogic(const Point &rDevicePt) const
SvxModeType
bool bBorderModified
Definition: page.hxx:84
sal_uInt32 GetMaximumPaperHeight() const
std::unique_ptr< weld::CheckButton > m_xHorzBox
Definition: page.hxx:119
SvxPageUsage GetPageUsage() const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
virtual bool FillItemSet(SfxItemSet *rOutSet) override
Definition: page.cxx:564
long GetHdDist() const
SfxItemState
long GetFtRight() const
virtual void FillUserData() override
Definition: page.cxx:557
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
std::unique_ptr< weld::MetricSpinButton > m_xLeftMarginEdit
Definition: page.hxx:108
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:1486
std::unique_ptr< weld::MetricSpinButton > m_xTopMarginEdit
Definition: page.hxx:111
PAPER_A3
bool SetOrientation(Orientation eOrient)
long nLastLeftMargin
Definition: page.hxx:78
static Size GetMinBorderSpace_Impl(const SvxShadowItem &rShadow, const SvxBoxItem &rBox)
Definition: page.cxx:99
void SetPaperFormatRanges(Paper eStart)
Definition: page.hxx:181
bool IsCTLFontEnabled() const
std::unique_ptr< weld::MetricSpinButton > m_xBottomMarginEdit
Definition: page.hxx:112
std::unique_ptr< svx::FrameDirectionListBox > m_xTextFlowBox
Definition: page.hxx:104
static VclPtr< reference_type > Create(Arg &&...arg)
bool mbEnableDrawingLayerFillStyles
Definition: page.hxx:92
void SetRight(long nNew)
void CalcMargin_Impl()
Definition: page.cxx:1371
virtual SfxPrinter * GetPrinter(bool bCreate=false)
const SvxPageUsage aArr[]
Definition: page.cxx:73
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
OString const aName
int get_value(FieldUnit eDestUnit) const
MapUnit
long GetHdHeight() const
std::unique_ptr< weld::ComboBox > m_xLayoutBox
Definition: page.hxx:115
std::unique_ptr< weld::Label > m_xPrintRangeQueryText
Definition: page.hxx:129
void SetUsage(SvxPageUsage eU)
static void GetI18nNumbering(ListBox &rFmtLB, sal_uInt16 nDoNotRemove)
void SetHorz(bool bNew)
#define MARGIN_RIGHT
Definition: page.cxx:130
std::unique_ptr< weld::ComboBox > m_xPaperTrayBox
Definition: page.hxx:105
virtual void Reset(const SfxItemSet *rSet) override
Definition: page.cxx:324
void InitHeadFoot_Impl(const SfxItemSet &rSet)
Definition: page.cxx:1123
void DisableVerticalPageDir()
Disables vertical page direction entries in the text flow listbox.
Definition: page.cxx:1448
std::unique_ptr< weld::CheckButton > m_xVertBox
Definition: page.hxx:120
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:907
void SetUpper(const sal_uInt16 nU, const sal_uInt16 nProp=100)
std::unique_ptr< weld::CheckButton > m_xRegisterCB
Definition: page.hxx:124
sal_Int32 nPos
PAPER_USER
void setWidth(long nWidth)
virtual SfxPoolItem * Clone(SfxItemPool *=nullptr) const override
void SetLeft(long nNew)
std::unique_ptr< weld::CheckButton > m_xAdaptBox
Definition: page.hxx:122
bool IsPrinterRangeOverflow(weld::MetricSpinButton &rField, long nFirstMargin, long nLastMargin, MarginPosition nPos)
Definition: page.cxx:1466
virtual void dispose() override
Definition: page.cxx:293
virtual sal_uInt16 GetEnumValue() const override
void SetVert(bool bNew)
long Y() const
const Size & GetSize() const
long nFirstTopMargin
Definition: page.hxx:76
sal_uInt16 GetWhich(sal_uInt16 nSlot, bool bDeep=true) const
void SetFtDist(long nNew)
long nFirstBottomMargin
Definition: page.hxx:77
PAPER_SCREEN_16_9
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:110