LibreOffice Module sw (master)  1
PageMarginControl.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 <sal/config.h>
22 
23 #include "PageMarginControl.hxx"
24 #include <strings.hrc>
25 
26 #include <editeng/sizeitem.hxx>
27 #include <sfx2/app.hxx>
28 #include <sfx2/dispatch.hxx>
29 #include <sfx2/module.hxx>
30 #include <sfx2/viewfrm.hxx>
31 #include <svx/pageitem.hxx>
32 #include <svx/rulritem.hxx>
33 #include <svl/itempool.hxx>
34 #include <svl/intitem.hxx>
35 #include <svtools/unitconv.hxx>
36 #include <unotools/viewoptions.hxx>
37 
38 #include <swtypes.hxx>
39 #include <cmdid.h>
40 #include <PageMarginPopup.hxx>
41 
42 #include <com/sun/star/document/XUndoManagerSupplier.hpp>
43 #include <com/sun/star/beans/NamedValue.hpp>
44 #include <com/sun/star/frame/XFrame.hpp>
45 
46 #define SWPAGE_LEFT_GVALUE "Sw_Page_Left"
47 #define SWPAGE_RIGHT_GVALUE "Sw_Page_Right"
48 #define SWPAGE_TOP_GVALUE "Sw_Page_Top"
49 #define SWPAGE_DOWN_GVALUE "Sw_Page_Down"
50 #define SWPAGE_MIRROR_GVALUE "Sw_Page_Mirrored"
51 
52 namespace
53 {
54  FieldUnit lcl_GetFieldUnit()
55  {
56  FieldUnit eUnit = FieldUnit::INCH;
57  const SfxPoolItem* pItem = nullptr;
58  SfxItemState eState = SfxViewFrame::Current()->GetBindings().GetDispatcher()->QueryState( SID_ATTR_METRIC, pItem );
59  if ( pItem && eState >= SfxItemState::DEFAULT )
60  {
61  eUnit = static_cast<FieldUnit>(static_cast<const SfxUInt16Item*>( pItem )->GetValue());
62  }
63  else
64  {
66  }
67 
68  return eUnit;
69  }
70 
71  MapUnit lcl_GetUnit()
72  {
73  SfxItemPool &rPool = SfxGetpApp()->GetPool();
74  sal_uInt16 nWhich = rPool.GetWhich( SID_ATTR_PAGE_SIZE );
75  return rPool.GetMetric( nWhich );
76  }
77 
78  css::uno::Reference< css::document::XUndoManager > getUndoManager( const css::uno::Reference< css::frame::XFrame >& rxFrame )
79  {
80  const css::uno::Reference< css::frame::XController >& xController = rxFrame->getController();
81  if ( xController.is() )
82  {
83  const css::uno::Reference< css::frame::XModel >& xModel = xController->getModel();
84  if ( xModel.is() )
85  {
86  const css::uno::Reference< css::document::XUndoManagerSupplier > xSuppUndo( xModel, css::uno::UNO_QUERY_THROW );
87  return css::uno::Reference< css::document::XUndoManager >( xSuppUndo->getUndoManager(), css::uno::UNO_SET_THROW );
88  }
89  }
90 
91  return css::uno::Reference< css::document::XUndoManager > ();
92  }
93 }
94 
95 namespace sw::sidebar {
96 
98  : WeldToolbarPopup(pControl->getFrameInterface(), pParent, "modules/swriter/ui/pagemargincontrol.ui", "PageMarginControl")
99  , m_xLeft(m_xBuilder->weld_label("leftLabel"))
100  , m_xRight(m_xBuilder->weld_label("rightLabel"))
101  , m_xInner(m_xBuilder->weld_label("innerLabel"))
102  , m_xOuter(m_xBuilder->weld_label("outerLabel"))
103  , m_xLeftMarginEdit(m_xBuilder->weld_metric_spin_button("left", FieldUnit::CM))
104  , m_xRightMarginEdit(m_xBuilder->weld_metric_spin_button("right", FieldUnit::CM))
105  , m_xTopMarginEdit(m_xBuilder->weld_metric_spin_button("top", FieldUnit::CM))
106  , m_xBottomMarginEdit(m_xBuilder->weld_metric_spin_button("bottom", FieldUnit::CM))
107  , m_xWidthHeightField(m_xBuilder->weld_metric_spin_button("hidden", FieldUnit::CM))
108  , m_xControl(pControl)
109  , m_nPageLeftMargin(0)
110  , m_nPageRightMargin(0)
111  , m_nPageTopMargin(0)
112  , m_nPageBottomMargin(0)
113  , m_bMirrored(false)
114  , m_eUnit( lcl_GetUnit() )
115  , m_bUserCustomValuesAvailable( false )
116  , m_nUserCustomPageLeftMargin( 0 )
117  , m_nUserCustomPageRightMargin( 0 )
118  , m_nUserCustomPageTopMargin( 0 )
119  , m_nUserCustomPageBottomMargin( 0 )
120  , m_bUserCustomMirrored( false )
121  , m_bCustomValuesUsed( false )
122 {
123  m_xWidthHeightField->set_unit(FieldUnit::CM);
124  m_xWidthHeightField->set_range(0, 9999, FieldUnit::NONE);
125  m_xWidthHeightField->set_digits(2);
126  m_xWidthHeightField->set_increments(10, 100, FieldUnit::NONE);
127  SetFieldUnit( *m_xWidthHeightField, lcl_GetFieldUnit() );
128 
129  bool bLandscape = false;
130  const SfxPoolItem* pItem;
131  const SvxSizeItem* pSize = nullptr;
132  const SvxLongLRSpaceItem* pLRItem = nullptr;
133  const SvxLongULSpaceItem* pULItem = nullptr;
134  if ( SfxViewFrame::Current() )
135  {
136  SfxViewFrame::Current()->GetBindings().GetDispatcher()->QueryState( SID_ATTR_PAGE, pItem );
137  bLandscape = static_cast<const SvxPageItem*>( pItem )->IsLandscape();
138  m_bMirrored = static_cast<const SvxPageItem*>( pItem )->GetPageUsage() == SvxPageUsage::Mirror;
139  SfxViewFrame::Current()->GetBindings().GetDispatcher()->QueryState( SID_ATTR_PAGE_SIZE, pItem );
140  pSize = static_cast<const SvxSizeItem*>( pItem );
141  SfxViewFrame::Current()->GetBindings().GetDispatcher()->QueryState( SID_ATTR_PAGE_LRSPACE, pItem );
142  pLRItem = static_cast<const SvxLongLRSpaceItem*>( pItem );
143  SfxViewFrame::Current()->GetBindings().GetDispatcher()->QueryState( SID_ATTR_PAGE_ULSPACE, pItem );
144  pULItem = static_cast<const SvxLongULSpaceItem*>( pItem );
145  }
146 
147  if ( pLRItem )
148  {
149  m_nPageLeftMargin = pLRItem->GetLeft();
150  m_nPageRightMargin = pLRItem->GetRight();
151  }
152 
153  if ( pULItem )
154  {
155  m_nPageTopMargin = pULItem->GetUpper();
156  m_nPageBottomMargin = pULItem->GetLower();
157  }
158 
159  if ( bLandscape )
160  {
161  m_xNarrow = m_xBuilder->weld_button("narrowL");
162  m_xNormal = m_xBuilder->weld_button("normalL");
163  m_xWide = m_xBuilder->weld_button("wideL");
164  m_xMirrored = m_xBuilder->weld_button("mirroredL");
165  m_xLast = m_xBuilder->weld_button("lastL");
166  }
167  else
168  {
169  m_xNarrow = m_xBuilder->weld_button("narrow");
170  m_xNormal = m_xBuilder->weld_button("normal");
171  m_xWide = m_xBuilder->weld_button("wide");
172  m_xMirrored = m_xBuilder->weld_button("mirrored");
173  m_xLast = m_xBuilder->weld_button("last");
174  }
175 
176  m_xNarrow->show();
177  m_xNormal->show();
178  m_xWide->show();
179  m_xMirrored->show();
180  m_xLast->show();
181 
182  m_xNarrow->connect_clicked( LINK( this, PageMarginControl, SelectMarginHdl ) );
183  m_xNormal->connect_clicked( LINK( this, PageMarginControl, SelectMarginHdl ) );
184  m_xWide->connect_clicked( LINK( this, PageMarginControl, SelectMarginHdl ) );
185  m_xMirrored->connect_clicked( LINK( this, PageMarginControl, SelectMarginHdl ) );
186  m_xLast->connect_clicked( LINK( this, PageMarginControl, SelectMarginHdl ) );
187 
189 
191 
192  Link<weld::MetricSpinButton&,void> aLinkLR = LINK( this, PageMarginControl, ModifyLRMarginHdl );
193  m_xLeftMarginEdit->connect_value_changed( aLinkLR );
195  SetFieldUnit( *m_xLeftMarginEdit, lcl_GetFieldUnit() );
196 
197  m_xRightMarginEdit->connect_value_changed( aLinkLR );
199  SetFieldUnit( *m_xRightMarginEdit, lcl_GetFieldUnit() );
200 
201  Link<weld::MetricSpinButton&,void> aLinkUL = LINK( this, PageMarginControl, ModifyULMarginHdl );
202  m_xTopMarginEdit->connect_value_changed( aLinkUL );
204  SetFieldUnit( *m_xTopMarginEdit, lcl_GetFieldUnit() );
205 
206  m_xBottomMarginEdit->connect_value_changed( aLinkUL );
208  SetFieldUnit( *m_xBottomMarginEdit, lcl_GetFieldUnit() );
209 
210  m_aPageSize = pSize->GetSize();
212 
213  if ( m_bMirrored )
214  {
215  m_xLeft->hide();
216  m_xRight->hide();
217  m_xInner->show();
218  m_xOuter->show();
219  }
220  else
221  {
222  m_xLeft->show();
223  m_xRight->show();
224  m_xInner->hide();
225  m_xOuter->hide();
226  }
227 }
228 
230 {
231  m_xNarrow->grab_focus();
232 }
233 
235 {
237 }
238 
240 {
241  const long nML = m_xLeftMarginEdit->denormalize( m_xLeftMarginEdit->get_value( FieldUnit::TWIP ) );
242  const long nMR = m_xRightMarginEdit->denormalize( m_xRightMarginEdit->get_value( FieldUnit::TWIP ) );
243  const long nMT = m_xTopMarginEdit->denormalize( m_xTopMarginEdit->get_value( FieldUnit::TWIP ) );
244  const long nMB = m_xBottomMarginEdit->denormalize( m_xBottomMarginEdit->get_value( FieldUnit::TWIP ) );
245 
246  const long nPH = OutputDevice::LogicToLogic( rPageSize.Height(), m_eUnit, MapUnit::MapTwip );
247  const long nPW = OutputDevice::LogicToLogic( rPageSize.Width(), m_eUnit, MapUnit::MapTwip );
248 
249  // Left
250  long nMax = nPW - nMR - MINBODY;
251  m_xLeftMarginEdit->set_max( m_xLeftMarginEdit->normalize( nMax ), FieldUnit::TWIP );
252 
253  // Right
254  nMax = nPW - nML - MINBODY;
255  m_xRightMarginEdit->set_max( m_xRightMarginEdit->normalize( nMax ), FieldUnit::TWIP );
256 
257  //Top
258  nMax = nPH - nMB - MINBODY;
259  m_xTopMarginEdit->set_max( m_xTopMarginEdit->normalize( nMax ), FieldUnit::TWIP );
260 
261  //Bottom
262  nMax = nPH - nMT - MINBODY;
263  m_xBottomMarginEdit->set_max( m_xTopMarginEdit->normalize( nMax ), FieldUnit::TWIP );
264 }
265 
266 void PageMarginControl::FillHelpText( const bool bUserCustomValuesAvailable )
267 {
268  const OUString aLeft = SwResId( STR_MARGIN_TOOLTIP_LEFT );
269  const OUString aRight = SwResId( STR_MARGIN_TOOLTIP_RIGHT );
270  const OUString aTop = SwResId( STR_MARGIN_TOOLTIP_TOP );
271  const OUString aBottom = SwResId( STR_MARGIN_TOOLTIP_BOT );
272 
274  const OUString aNarrowValText = m_xWidthHeightField->get_text();
275  OUString aHelpText = aLeft +
276  aNarrowValText +
277  aRight +
278  aNarrowValText +
279  aTop +
280  aNarrowValText +
281  aBottom +
282  aNarrowValText;
283  m_xNarrow->set_tooltip_text( aHelpText );
284 
286  const OUString aNormalValText = m_xWidthHeightField->get_text();
287  aHelpText = aLeft +
288  aNormalValText +
289  aRight +
290  aNormalValText +
291  aTop +
292  aNormalValText +
293  aBottom +
294  aNormalValText;
295  m_xNormal->set_tooltip_text( aHelpText );
296 
298  const OUString aWide1ValText = m_xWidthHeightField->get_text();
300  const OUString aWide2ValText = m_xWidthHeightField->get_text();
301  aHelpText = aLeft +
302  aWide2ValText +
303  aRight +
304  aWide2ValText +
305  aTop +
306  aWide1ValText +
307  aBottom +
308  aWide1ValText;
309  m_xWide->set_tooltip_text( aHelpText );
310 
311  const OUString aInner = SwResId( STR_MARGIN_TOOLTIP_INNER );
312  const OUString aOuter = SwResId( STR_MARGIN_TOOLTIP_OUTER );
313 
315  const OUString aWide3ValText = m_xWidthHeightField->get_text();
316  aHelpText = aInner +
317  aWide3ValText +
318  aOuter +
319  aWide1ValText +
320  aTop +
321  aWide1ValText +
322  aBottom +
323  aWide1ValText;
324  m_xMirrored->set_tooltip_text( aHelpText );
325 
326  if ( bUserCustomValuesAvailable )
327  {
328  aHelpText = m_bUserCustomMirrored ? aInner : aLeft;
330  aHelpText += m_xWidthHeightField->get_text();
331  aHelpText += m_bUserCustomMirrored ? aOuter : aRight;
333  aHelpText += m_xWidthHeightField->get_text();
334  aHelpText += aTop;
336  aHelpText += m_xWidthHeightField->get_text();
337  aHelpText += aBottom;
339  aHelpText += m_xWidthHeightField->get_text();
340  }
341  else
342  {
343  aHelpText.clear();
344  }
345  m_xLast->set_tooltip_text( aHelpText );
346 }
347 
348 IMPL_LINK( PageMarginControl, SelectMarginHdl, weld::Button&, rControl, void )
349 {
350  bool bMirrored = false;
351  bool bApplyNewPageMargins = true;
352  if( &rControl == m_xNarrow.get() )
353  {
354  m_nPageLeftMargin = SWPAGE_NARROW_VALUE;
355  m_nPageRightMargin = SWPAGE_NARROW_VALUE;
356  m_nPageTopMargin = SWPAGE_NARROW_VALUE;
357  m_nPageBottomMargin = SWPAGE_NARROW_VALUE;
358  bMirrored = false;
359  }
360  if( &rControl == m_xNormal.get() )
361  {
362  m_nPageLeftMargin = SWPAGE_NORMAL_VALUE;
363  m_nPageRightMargin = SWPAGE_NORMAL_VALUE;
364  m_nPageTopMargin = SWPAGE_NORMAL_VALUE;
365  m_nPageBottomMargin = SWPAGE_NORMAL_VALUE;
366  bMirrored = false;
367  }
368  if( &rControl == m_xWide.get() )
369  {
370  m_nPageLeftMargin = SWPAGE_WIDE_VALUE2;
371  m_nPageRightMargin = SWPAGE_WIDE_VALUE2;
372  m_nPageTopMargin = SWPAGE_WIDE_VALUE1;
373  m_nPageBottomMargin = SWPAGE_WIDE_VALUE1;
374  bMirrored = false;
375  }
376  if( &rControl == m_xMirrored.get() )
377  {
378  m_nPageLeftMargin = SWPAGE_WIDE_VALUE3;
379  m_nPageRightMargin = SWPAGE_WIDE_VALUE1;
380  m_nPageTopMargin = SWPAGE_WIDE_VALUE1;
381  m_nPageBottomMargin = SWPAGE_WIDE_VALUE1;
382  bMirrored = true;
383  }
384  if( &rControl == m_xLast.get() )
385  {
386  if ( m_bUserCustomValuesAvailable )
387  {
388  m_nPageLeftMargin = m_nUserCustomPageLeftMargin;
389  m_nPageRightMargin = m_nUserCustomPageRightMargin;
390  m_nPageTopMargin = m_nUserCustomPageTopMargin;
391  m_nPageBottomMargin = m_nUserCustomPageBottomMargin;
392  bMirrored = m_bUserCustomMirrored;
393  }
394  else
395  {
396  bApplyNewPageMargins = false;
397  }
398  }
399 
400  if ( !bApplyNewPageMargins )
401  return;
402 
403  const css::uno::Reference< css::document::XUndoManager > xUndoManager( getUndoManager( SfxViewFrame::Current()->GetFrame().GetFrameInterface() ) );
404  if ( xUndoManager.is() )
405  xUndoManager->enterUndoContext( "" );
406 
407  ExecuteMarginLRChange( m_nPageLeftMargin, m_nPageRightMargin );
408  ExecuteMarginULChange( m_nPageTopMargin, m_nPageBottomMargin );
409  if ( m_bMirrored != bMirrored )
410  {
411  m_bMirrored = bMirrored;
412  ExecutePageLayoutChange( m_bMirrored );
413  }
414 
415  if ( xUndoManager.is() )
416  xUndoManager->leaveUndoContext();
417 
418  m_bCustomValuesUsed = false;
419  m_xControl->EndPopupMode();
420 }
421 
423  const long nPageLeftMargin,
424  const long nPageRightMargin )
425 {
426  if ( SfxViewFrame::Current() )
427  {
428  std::unique_ptr<SvxLongLRSpaceItem> pPageLRMarginItem( new SvxLongLRSpaceItem( 0, 0, SID_ATTR_PAGE_LRSPACE ) );
429  pPageLRMarginItem->SetLeft( nPageLeftMargin );
430  pPageLRMarginItem->SetRight( nPageRightMargin );
431  SfxViewFrame::Current()->GetBindings().GetDispatcher()->ExecuteList( SID_ATTR_PAGE_LRSPACE,
432  SfxCallMode::RECORD, { pPageLRMarginItem.get() } );
433  pPageLRMarginItem.reset();
434  }
435 }
436 
438  const long nPageTopMargin,
439  const long nPageBottomMargin )
440 {
441  if ( SfxViewFrame::Current() )
442  {
443  std::unique_ptr<SvxLongULSpaceItem> pPageULMarginItem( new SvxLongULSpaceItem( 0, 0, SID_ATTR_PAGE_ULSPACE ) );
444  pPageULMarginItem->SetUpper( nPageTopMargin );
445  pPageULMarginItem->SetLower( nPageBottomMargin );
446  SfxViewFrame::Current()->GetBindings().GetDispatcher()->ExecuteList( SID_ATTR_PAGE_ULSPACE,
447  SfxCallMode::RECORD, { pPageULMarginItem.get() } );
448  pPageULMarginItem.reset();
449  }
450 }
451 
452 void PageMarginControl::ExecutePageLayoutChange( const bool bMirrored )
453 {
454  if ( SfxViewFrame::Current() )
455  {
456  std::unique_ptr<SvxPageItem> pPageItem( new SvxPageItem( SID_ATTR_PAGE ) );
457  pPageItem->SetPageUsage( bMirrored ? SvxPageUsage::Mirror : SvxPageUsage::All );
459  SfxCallMode::RECORD, { pPageItem.get() } );
460  pPageItem.reset();
461  }
462 }
463 
465 {
466  m_nPageLeftMargin = GetCoreValue( *m_xLeftMarginEdit, m_eUnit );
467  m_nPageRightMargin = GetCoreValue( *m_xRightMarginEdit, m_eUnit );
468  ExecuteMarginLRChange( m_nPageLeftMargin, m_nPageRightMargin );
469  SetMetricFieldMaxValues( m_aPageSize );
470  m_bCustomValuesUsed = true;
471 }
472 
474 {
475  m_nPageTopMargin = GetCoreValue( *m_xTopMarginEdit, m_eUnit );
476  m_nPageBottomMargin = GetCoreValue( *m_xBottomMarginEdit, m_eUnit );
477  ExecuteMarginULChange( m_nPageTopMargin, m_nPageBottomMargin );
478  SetMetricFieldMaxValues( m_aPageSize );
479  m_bCustomValuesUsed = true;
480 }
481 
483 {
484  bool bUserCustomValuesAvailable = false;
485 
486  SvtViewOptions aWinOpt( EViewType::Window, SWPAGE_LEFT_GVALUE );
487  if ( aWinOpt.Exists() )
488  {
489  css::uno::Sequence < css::beans::NamedValue > aSeq = aWinOpt.GetUserData();
490  OUString aTmp;
491  if ( aSeq.hasElements())
492  aSeq[0].Value >>= aTmp;
493  OUString aWinData( aTmp );
494  m_nUserCustomPageLeftMargin = aWinData.toInt32();
495  bUserCustomValuesAvailable = true;
496  }
497 
498  SvtViewOptions aWinOpt2( EViewType::Window, SWPAGE_RIGHT_GVALUE );
499  if ( aWinOpt2.Exists() )
500  {
501  css::uno::Sequence < css::beans::NamedValue > aSeq = aWinOpt2.GetUserData();
502  OUString aTmp;
503  if ( aSeq.hasElements())
504  aSeq[0].Value >>= aTmp;
505  OUString aWinData( aTmp );
506  m_nUserCustomPageRightMargin = aWinData.toInt32();
507  bUserCustomValuesAvailable = true;
508  }
509 
510  SvtViewOptions aWinOpt3( EViewType::Window, SWPAGE_TOP_GVALUE );
511  if ( aWinOpt3.Exists() )
512  {
513  css::uno::Sequence < css::beans::NamedValue > aSeq = aWinOpt3.GetUserData();
514  OUString aTmp;
515  if ( aSeq.hasElements() )
516  aSeq[0].Value >>= aTmp;
517  OUString aWinData( aTmp );
518  m_nUserCustomPageTopMargin = aWinData.toInt32();
519  bUserCustomValuesAvailable = true;
520  }
521 
522  SvtViewOptions aWinOpt4( EViewType::Window, SWPAGE_DOWN_GVALUE );
523  if ( aWinOpt4.Exists() )
524  {
525  css::uno::Sequence < css::beans::NamedValue > aSeq = aWinOpt4.GetUserData();
526  OUString aTmp;
527  if ( aSeq.hasElements())
528  aSeq[0].Value >>= aTmp;
529  OUString aWinData( aTmp );
530  m_nUserCustomPageBottomMargin = aWinData.toInt32();
531  bUserCustomValuesAvailable = true;
532  }
533 
534  SvtViewOptions aWinOpt5( EViewType::Window, SWPAGE_MIRROR_GVALUE );
535  if ( aWinOpt5.Exists() )
536  {
537  css::uno::Sequence < css::beans::NamedValue > aSeq = aWinOpt5.GetUserData();
538  OUString aTmp;
539  if ( aSeq.hasElements())
540  aSeq[0].Value >>= aTmp;
541  OUString aWinData( aTmp );
542  m_bUserCustomMirrored = aWinData.toInt32() != 0;
543  bUserCustomValuesAvailable = true;
544  }
545 
546  return bUserCustomValuesAvailable;
547 }
548 
550 {
551  if ( !m_bCustomValuesUsed )
552  {
553  return;
554  }
555 
556  css::uno::Sequence < css::beans::NamedValue > aSeq( 1 );
557  SvtViewOptions aWinOpt( EViewType::Window, SWPAGE_LEFT_GVALUE );
558 
559  aSeq[0].Name = "mnPageLeftMargin";
560  aSeq[0].Value <<= OUString::number( m_nPageLeftMargin );
561  aWinOpt.SetUserData( aSeq );
562 
563  SvtViewOptions aWinOpt2( EViewType::Window, SWPAGE_RIGHT_GVALUE );
564  aSeq[0].Name = "mnPageRightMargin";
565  aSeq[0].Value <<= OUString::number( m_nPageRightMargin );
566  aWinOpt2.SetUserData( aSeq );
567 
568  SvtViewOptions aWinOpt3( EViewType::Window, SWPAGE_TOP_GVALUE );
569  aSeq[0].Name = "mnPageTopMargin";
570  aSeq[0].Value <<= OUString::number( m_nPageTopMargin );
571  aWinOpt3.SetUserData( aSeq );
572 
573  SvtViewOptions aWinOpt4( EViewType::Window, SWPAGE_DOWN_GVALUE );
574  aSeq[0].Name = "mnPageBottomMargin";
575  aSeq[0].Value <<= OUString::number( m_nPageBottomMargin );
576  aWinOpt4.SetUserData( aSeq );
577 
578  SvtViewOptions aWinOpt5( EViewType::Window, SWPAGE_MIRROR_GVALUE );
579  aSeq[0].Name = "mbMirrored";
580  aSeq[0].Value <<= OUString::number( (m_bMirrored ? 1 : 0) );
581  aWinOpt5.SetUserData( aSeq );
582 }
583 
584 } // end of namespace sw::sidebar
585 
586 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define SWPAGE_NARROW_VALUE
long Width() const
std::unique_ptr< weld::Button > m_xWide
void SetFieldUnit(weld::MetricSpinButton &rField, FieldUnit eUnit, bool bAll)
const SfxPoolItem * ExecuteList(sal_uInt16 nSlot, SfxCallMode nCall, std::initializer_list< SfxPoolItem const * > args, std::initializer_list< SfxPoolItem const * > internalargs=std::initializer_list< SfxPoolItem const * >())
css::uno::Sequence< css::beans::NamedValue > GetUserData() const
FieldUnit
void FillHelpText(const bool bUserCustomValuesAvailable)
std::unique_ptr< weld::Button > m_xMirrored
static void ExecutePageLayoutChange(const bool bMirrored)
std::string GetValue
Point LogicToLogic(const Point &rPtSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
Reference< XControl > m_xControl
long Height() const
std::unique_ptr< weld::Label > m_xRight
static FieldUnit GetCurrentFieldUnit()
std::unique_ptr< weld::MetricSpinButton > m_xLeftMarginEdit
IMPL_LINK(PageColumnControl, ColumnButtonClickHdl_Impl, weld::Button &, rButton, void)
virtual void GrabFocus() override
SfxApplication * SfxGetpApp()
Value
virtual MapUnit GetMetric(sal_uInt16 nWhich) const
std::unique_ptr< weld::Button > m_xNormal
Reference< XController > xController
std::unique_ptr< weld::Label > m_xLeft
#define SWPAGE_MIRROR_GVALUE
std::unique_ptr< weld::Button > m_xLast
long GetLower() const
SfxItemPool & GetPool() const
PageMarginControl(PageMarginPopup *pControl, weld::Widget *pParent)
std::unique_ptr< weld::Label > m_xOuter
#define SWPAGE_WIDE_VALUE1
void SetMetricFieldMaxValues(const Size &rPageSize)
SfxBindings & GetBindings()
int GetCoreValue(const weld::MetricSpinButton &rField, MapUnit eUnit)
void SetUserData(const css::uno::Sequence< css::beans::NamedValue > &lData)
static void ExecuteMarginLRChange(const long nPageLeftMargin, const long nPageRightMargin)
OUString SwResId(const char *pId)
Definition: swmodule.cxx:165
IMPL_LINK_NOARG(PageColumnControl, MoreButtonClickHdl_Impl, weld::Button &, void)
SfxItemState QueryState(sal_uInt16 nSID, const SfxPoolItem *&rpState)
#define SWPAGE_LEFT_GVALUE
void SetMetricValue(weld::MetricSpinButton &rField, int nCoreValue, MapUnit eUnit)
#define SWPAGE_RIGHT_GVALUE
static void ExecuteMarginULChange(const long nPageTopMargin, const long nPageBottomMargin)
long GetRight() const
std::unique_ptr< weld::Label > m_xInner
#define SWPAGE_DOWN_GVALUE
const long MINBODY
std::unique_ptr< weld::MetricSpinButton > m_xBottomMarginEdit
static SfxViewFrame * Current()
SfxItemState
#define SWPAGE_WIDE_VALUE2
#define SWPAGE_TOP_GVALUE
sal_uInt16 GetWhich(sal_uInt16 nSlot, bool bDeep=true) const
long GetLeft() const
std::unique_ptr< weld::MetricSpinButton > m_xTopMarginEdit
std::unique_ptr< weld::Button > m_xNarrow
bool Exists() const
Sequence< sal_Int8 > aSeq
std::unique_ptr< weld::MetricSpinButton > m_xRightMarginEdit
SfxDispatcher * GetDispatcher() const
MapUnit
Reference< XModel > xModel
#define SWPAGE_NORMAL_VALUE
#define SWPAGE_WIDE_VALUE3
long GetUpper() const
const Size & GetSize() const
std::unique_ptr< weld::MetricSpinButton > m_xWidthHeightField
std::unique_ptr< weld::Builder > m_xBuilder