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