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 <cstdlib>
24 
25 #include "PageMarginControl.hxx"
26 #include <strings.hrc>
27 
28 #include <editeng/sizeitem.hxx>
29 #include <sfx2/app.hxx>
30 #include <sfx2/dispatch.hxx>
31 #include <sfx2/module.hxx>
32 #include <sfx2/viewfrm.hxx>
33 #include <svx/svxids.hrc>
34 #include <svx/pageitem.hxx>
35 #include <svx/rulritem.hxx>
36 #include <svl/itempool.hxx>
37 #include <svl/intitem.hxx>
38 #include <svtools/unitconv.hxx>
39 #include <unotools/viewoptions.hxx>
40 
41 #include <swtypes.hxx>
42 #include <cmdid.h>
43 
44 #include <com/sun/star/document/XUndoManagerSupplier.hpp>
45 #include <com/sun/star/beans/NamedValue.hpp>
46 #include <com/sun/star/frame/XFrame.hpp>
47 
48 #include <vcl/settings.hxx>
49 
50 #define SWPAGE_LEFT_GVALUE "Sw_Page_Left"
51 #define SWPAGE_RIGHT_GVALUE "Sw_Page_Right"
52 #define SWPAGE_TOP_GVALUE "Sw_Page_Top"
53 #define SWPAGE_DOWN_GVALUE "Sw_Page_Down"
54 #define SWPAGE_MIRROR_GVALUE "Sw_Page_Mirrored"
55 
56 namespace
57 {
58  FieldUnit lcl_GetFieldUnit()
59  {
60  FieldUnit eUnit = FieldUnit::INCH;
61  const SfxPoolItem* pItem = nullptr;
62  SfxItemState eState = SfxViewFrame::Current()->GetBindings().GetDispatcher()->QueryState( SID_ATTR_METRIC, pItem );
63  if ( pItem && eState >= SfxItemState::DEFAULT )
64  {
65  eUnit = static_cast<FieldUnit>(static_cast<const SfxUInt16Item*>( pItem )->GetValue());
66  }
67  else
68  {
70  }
71 
72  return eUnit;
73  }
74 
75  MapUnit lcl_GetUnit()
76  {
77  SfxItemPool &rPool = SfxGetpApp()->GetPool();
78  sal_uInt16 nWhich = rPool.GetWhich( SID_ATTR_PAGE_SIZE );
79  return rPool.GetMetric( nWhich );
80  }
81 
82  css::uno::Reference< css::document::XUndoManager > getUndoManager( const css::uno::Reference< css::frame::XFrame >& rxFrame )
83  {
84  const css::uno::Reference< css::frame::XController >& xController = rxFrame->getController();
85  if ( xController.is() )
86  {
87  const css::uno::Reference< css::frame::XModel >& xModel = xController->getModel();
88  if ( xModel.is() )
89  {
90  const css::uno::Reference< css::document::XUndoManagerSupplier > xSuppUndo( xModel, css::uno::UNO_QUERY_THROW );
91  return css::uno::Reference< css::document::XUndoManager >( xSuppUndo->getUndoManager(), css::uno::UNO_SET_THROW );
92  }
93  }
94 
95  return css::uno::Reference< css::document::XUndoManager > ();
96  }
97 }
98 
99 namespace sw { namespace sidebar {
100 
102  : SfxPopupWindow( nId, pParent, "PageMarginControl", "modules/swriter/ui/pagemargincontrol.ui" )
103  , m_nPageLeftMargin(0)
104  , m_nPageRightMargin(0)
105  , m_nPageTopMargin(0)
106  , m_nPageBottomMargin(0)
107  , m_bMirrored(false)
108  , m_eUnit( lcl_GetUnit() )
109  , m_bUserCustomValuesAvailable( false )
110  , m_nUserCustomPageLeftMargin( 0 )
111  , m_nUserCustomPageRightMargin( 0 )
112  , m_nUserCustomPageTopMargin( 0 )
113  , m_nUserCustomPageBottomMargin( 0 )
114  , m_bUserCustomMirrored( false )
115  , m_bCustomValuesUsed( false )
116 {
117  bool bLandscape = false;
118  const SfxPoolItem* pItem;
119  const SvxSizeItem* pSize = nullptr;
120  const SvxLongLRSpaceItem* pLRItem = nullptr;
121  const SvxLongULSpaceItem* pULItem = nullptr;
122  if ( SfxViewFrame::Current() )
123  {
124  SfxViewFrame::Current()->GetBindings().GetDispatcher()->QueryState( SID_ATTR_PAGE, pItem );
125  bLandscape = static_cast<const SvxPageItem*>( pItem )->IsLandscape();
126  m_bMirrored = static_cast<const SvxPageItem*>( pItem )->GetPageUsage() == SvxPageUsage::Mirror;
127  SfxViewFrame::Current()->GetBindings().GetDispatcher()->QueryState( SID_ATTR_PAGE_SIZE, pItem );
128  pSize = static_cast<const SvxSizeItem*>( pItem );
129  SfxViewFrame::Current()->GetBindings().GetDispatcher()->QueryState( SID_ATTR_PAGE_LRSPACE, pItem );
130  pLRItem = static_cast<const SvxLongLRSpaceItem*>( pItem );
131  SfxViewFrame::Current()->GetBindings().GetDispatcher()->QueryState( SID_ATTR_PAGE_ULSPACE, pItem );
132  pULItem = static_cast<const SvxLongULSpaceItem*>( pItem );
133  }
134 
135  if ( pLRItem )
136  {
137  m_nPageLeftMargin = pLRItem->GetLeft();
138  m_nPageRightMargin = pLRItem->GetRight();
139  }
140 
141  if ( pULItem )
142  {
143  m_nPageTopMargin = pULItem->GetUpper();
144  m_nPageBottomMargin = pULItem->GetLower();
145  }
146 
147  if ( bLandscape )
148  {
149  get( m_pNarrow, "narrowL" );
150  get( m_pNormal, "normalL" );
151  get( m_pWide, "wideL" );
152  get( m_pMirrored, "mirroredL" );
153  get( m_pLast, "lastL" );
154  }
155  else
156  {
157  get( m_pNarrow, "narrow" );
158  get( m_pNormal, "normal" );
159  get( m_pWide, "wide" );
160  get( m_pMirrored, "mirrored" );
161  get( m_pLast, "last" );
162  }
163 
164  m_pNarrow->Show();
165  m_pNormal->Show();
166  m_pWide->Show();
167  m_pMirrored->Show();
168  m_pLast->Show();
169 
170  m_pNarrow->SetClickHdl( LINK( this, PageMarginControl, SelectMarginHdl ) );
171  m_pNormal->SetClickHdl( LINK( this, PageMarginControl, SelectMarginHdl ) );
172  m_pWide->SetClickHdl( LINK( this, PageMarginControl, SelectMarginHdl ) );
173  m_pMirrored->SetClickHdl( LINK( this, PageMarginControl, SelectMarginHdl ) );
174  m_pLast->SetClickHdl( LINK( this, PageMarginControl, SelectMarginHdl ) );
175 
176  get( m_pContainer, "container" );
179  m_pWidthHeightField->SetUnit( FieldUnit::CM );
180  m_pWidthHeightField->SetMax( 9999 );
183  m_pWidthHeightField->SetLast( 9999 );
184  SetFieldUnit( *m_pWidthHeightField.get(), lcl_GetFieldUnit() );
185 
187 
188  FillHelpText( m_bUserCustomValuesAvailable );
189 
190  get( m_pLeftMarginEdit, "left" );
191  get( m_pRightMarginEdit, "right" );
192  get( m_pTopMarginEdit, "top" );
193  get( m_pBottomMarginEdit, "bottom" );
194 
195  Link<Edit&,void> aLinkLR = LINK( this, PageMarginControl, ModifyLRMarginHdl );
196  m_pLeftMarginEdit->SetModifyHdl( aLinkLR );
198  SetFieldUnit( *m_pLeftMarginEdit.get(), lcl_GetFieldUnit() );
199 
200  m_pRightMarginEdit->SetModifyHdl( aLinkLR );
202  SetFieldUnit( *m_pRightMarginEdit.get(), lcl_GetFieldUnit() );
203 
204  Link<Edit&,void> aLinkUL = LINK( this, PageMarginControl, ModifyULMarginHdl );
205  m_pTopMarginEdit->SetModifyHdl( aLinkUL );
207  SetFieldUnit( *m_pTopMarginEdit.get(), lcl_GetFieldUnit() );
208 
209  m_pBottomMarginEdit->SetModifyHdl( aLinkUL );
211  SetFieldUnit( *m_pBottomMarginEdit.get(), lcl_GetFieldUnit() );
212 
213  m_aPageSize = pSize->GetSize();
214  SetMetricFieldMaxValues( m_aPageSize );
215 
216  get( m_pLeft, "leftLabel" );
217  get( m_pRight, "rightLabel" );
218  get( m_pInner, "innerLabel" );
219  get( m_pOuter, "outerLabel" );
220 
221  if ( m_bMirrored )
222  {
223  m_pLeft->Hide();
224  m_pRight->Hide();
225  m_pInner->Show();
226  m_pOuter->Show();
227  }
228  else
229  {
230  m_pLeft->Show();
231  m_pRight->Show();
232  m_pInner->Hide();
233  m_pOuter->Hide();
234  }
235 }
236 
238 {
239  disposeOnce();
240 }
241 
243 {
245 
259 
262 
264 }
265 
267 {
268  const long nML = m_pLeftMarginEdit->Denormalize( m_pLeftMarginEdit->GetValue( FieldUnit::TWIP ) );
269  const long nMR = m_pRightMarginEdit->Denormalize( m_pRightMarginEdit->GetValue( FieldUnit::TWIP ) );
270  const long nMT = m_pTopMarginEdit->Denormalize( m_pTopMarginEdit->GetValue( FieldUnit::TWIP ) );
271  const long nMB = m_pBottomMarginEdit->Denormalize( m_pBottomMarginEdit->GetValue( FieldUnit::TWIP ) );
272 
273  const long nPH = LogicToLogic( rPageSize.Height(), m_eUnit, MapUnit::MapTwip );
274  const long nPW = LogicToLogic( rPageSize.Width(), m_eUnit, MapUnit::MapTwip );
275 
276  // Left
277  long nMax = nPW - nMR - MINBODY;
278  m_pLeftMarginEdit->SetMax( m_pLeftMarginEdit->Normalize( nMax ), FieldUnit::TWIP );
279 
280  // Right
281  nMax = nPW - nML - MINBODY;
282  m_pRightMarginEdit->SetMax( m_pRightMarginEdit->Normalize( nMax ), FieldUnit::TWIP );
283 
284  //Top
285  nMax = nPH - nMB - MINBODY;
286  m_pTopMarginEdit->SetMax( m_pTopMarginEdit->Normalize( nMax ), FieldUnit::TWIP );
287 
288  //Bottom
289  nMax = nPH - nMT - MINBODY;
290  m_pBottomMarginEdit->SetMax( m_pTopMarginEdit->Normalize( nMax ), FieldUnit::TWIP );
291 }
292 
293 void PageMarginControl::FillHelpText( const bool bUserCustomValuesAvailable )
294 {
295  const OUString aLeft = SwResId( STR_MARGIN_TOOLTIP_LEFT );
296  const OUString aRight = SwResId( STR_MARGIN_TOOLTIP_RIGHT );
297  const OUString aTop = SwResId( STR_MARGIN_TOOLTIP_TOP );
298  const OUString aBottom = SwResId( STR_MARGIN_TOOLTIP_BOT );
299 
301  const OUString aNarrowValText = m_pWidthHeightField->GetText();
302  OUString aHelpText = aLeft;
303  aHelpText += aNarrowValText;
304  aHelpText += aRight;
305  aHelpText += aNarrowValText;
306  aHelpText += aTop;
307  aHelpText += aNarrowValText;
308  aHelpText += aBottom;
309  aHelpText += aNarrowValText;
310  m_pNarrow->SetQuickHelpText( aHelpText );
311 
313  const OUString aNormalValText = m_pWidthHeightField->GetText();
314  aHelpText = aLeft;
315  aHelpText += aNormalValText;
316  aHelpText += aRight;
317  aHelpText += aNormalValText;
318  aHelpText += aTop;
319  aHelpText += aNormalValText;
320  aHelpText += aBottom;
321  aHelpText += aNormalValText;
322  m_pNormal->SetQuickHelpText( aHelpText );
323 
325  const OUString aWide1ValText = m_pWidthHeightField->GetText();
327  const OUString aWide2ValText = m_pWidthHeightField->GetText();
328  aHelpText = aLeft;
329  aHelpText += aWide2ValText;
330  aHelpText += aRight;
331  aHelpText += aWide2ValText;
332  aHelpText += aTop;
333  aHelpText += aWide1ValText;
334  aHelpText += aBottom;
335  aHelpText += aWide1ValText;
336  m_pWide->SetQuickHelpText( aHelpText );
337 
338  const OUString aInner = SwResId( STR_MARGIN_TOOLTIP_INNER );
339  const OUString aOuter = SwResId( STR_MARGIN_TOOLTIP_OUTER );
340 
342  const OUString aWide3ValText = m_pWidthHeightField->GetText();
343  aHelpText = aInner;
344  aHelpText += aWide3ValText;
345  aHelpText += aOuter;
346  aHelpText += aWide1ValText;
347  aHelpText += aTop;
348  aHelpText += aWide1ValText;
349  aHelpText += aBottom;
350  aHelpText += aWide1ValText;
351  m_pMirrored->SetQuickHelpText( aHelpText );
352 
353  if ( bUserCustomValuesAvailable )
354  {
355  aHelpText = m_bUserCustomMirrored ? aInner : aLeft;
357  aHelpText += m_pWidthHeightField->GetText();
358  aHelpText += m_bUserCustomMirrored ? aOuter : aRight;
360  aHelpText += m_pWidthHeightField->GetText();
361  aHelpText += aTop;
363  aHelpText += m_pWidthHeightField->GetText();
364  aHelpText += aBottom;
366  aHelpText += m_pWidthHeightField->GetText();
367  }
368  else
369  {
370  aHelpText.clear();
371  }
372  m_pLast->SetQuickHelpText( aHelpText );
373 }
374 
375 IMPL_LINK( PageMarginControl, SelectMarginHdl, Button*, pControl, void )
376 {
377  bool bMirrored = false;
378  bool bApplyNewPageMargins = true;
379  if( pControl == m_pNarrow.get() )
380  {
381  m_nPageLeftMargin = SWPAGE_NARROW_VALUE;
382  m_nPageRightMargin = SWPAGE_NARROW_VALUE;
383  m_nPageTopMargin = SWPAGE_NARROW_VALUE;
384  m_nPageBottomMargin = SWPAGE_NARROW_VALUE;
385  bMirrored = false;
386  }
387  if( pControl == m_pNormal.get() )
388  {
389  m_nPageLeftMargin = SWPAGE_NORMAL_VALUE;
390  m_nPageRightMargin = SWPAGE_NORMAL_VALUE;
391  m_nPageTopMargin = SWPAGE_NORMAL_VALUE;
392  m_nPageBottomMargin = SWPAGE_NORMAL_VALUE;
393  bMirrored = false;
394  }
395  if( pControl == m_pWide.get() )
396  {
397  m_nPageLeftMargin = SWPAGE_WIDE_VALUE2;
398  m_nPageRightMargin = SWPAGE_WIDE_VALUE2;
399  m_nPageTopMargin = SWPAGE_WIDE_VALUE1;
400  m_nPageBottomMargin = SWPAGE_WIDE_VALUE1;
401  bMirrored = false;
402  }
403  if( pControl == m_pMirrored.get() )
404  {
405  m_nPageLeftMargin = SWPAGE_WIDE_VALUE3;
406  m_nPageRightMargin = SWPAGE_WIDE_VALUE1;
407  m_nPageTopMargin = SWPAGE_WIDE_VALUE1;
408  m_nPageBottomMargin = SWPAGE_WIDE_VALUE1;
409  bMirrored = true;
410  }
411  if( pControl == m_pLast.get() )
412  {
413  if ( m_bUserCustomValuesAvailable )
414  {
415  m_nPageLeftMargin = m_nUserCustomPageLeftMargin;
416  m_nPageRightMargin = m_nUserCustomPageRightMargin;
417  m_nPageTopMargin = m_nUserCustomPageTopMargin;
418  m_nPageBottomMargin = m_nUserCustomPageBottomMargin;
419  bMirrored = m_bUserCustomMirrored;
420  }
421  else
422  {
423  bApplyNewPageMargins = false;
424  }
425  }
426 
427  if ( bApplyNewPageMargins )
428  {
429  const css::uno::Reference< css::document::XUndoManager > xUndoManager( getUndoManager( SfxViewFrame::Current()->GetFrame().GetFrameInterface() ) );
430  if ( xUndoManager.is() )
431  xUndoManager->enterUndoContext( "" );
432 
433  ExecuteMarginLRChange( m_nPageLeftMargin, m_nPageRightMargin );
434  ExecuteMarginULChange( m_nPageTopMargin, m_nPageBottomMargin );
435  if ( m_bMirrored != bMirrored )
436  {
437  m_bMirrored = bMirrored;
438  ExecutePageLayoutChange( m_bMirrored );
439  }
440 
441  if ( xUndoManager.is() )
442  xUndoManager->leaveUndoContext();
443 
444  m_bCustomValuesUsed = false;
445  EndPopupMode();
446  }
447 }
448 
450  const long nPageLeftMargin,
451  const long nPageRightMargin )
452 {
453  if ( SfxViewFrame::Current() )
454  {
455  std::unique_ptr<SvxLongLRSpaceItem> pPageLRMarginItem( new SvxLongLRSpaceItem( 0, 0, SID_ATTR_PAGE_LRSPACE ) );
456  pPageLRMarginItem->SetLeft( nPageLeftMargin );
457  pPageLRMarginItem->SetRight( nPageRightMargin );
458  SfxViewFrame::Current()->GetBindings().GetDispatcher()->ExecuteList( SID_ATTR_PAGE_LRSPACE,
459  SfxCallMode::RECORD, { pPageLRMarginItem.get() } );
460  pPageLRMarginItem.reset();
461  }
462 }
463 
465  const long nPageTopMargin,
466  const long nPageBottomMargin )
467 {
468  if ( SfxViewFrame::Current() )
469  {
470  std::unique_ptr<SvxLongULSpaceItem> pPageULMarginItem( new SvxLongULSpaceItem( 0, 0, SID_ATTR_PAGE_ULSPACE ) );
471  pPageULMarginItem->SetUpper( nPageTopMargin );
472  pPageULMarginItem->SetLower( nPageBottomMargin );
473  SfxViewFrame::Current()->GetBindings().GetDispatcher()->ExecuteList( SID_ATTR_PAGE_ULSPACE,
474  SfxCallMode::RECORD, { pPageULMarginItem.get() } );
475  pPageULMarginItem.reset();
476  }
477 }
478 
479 void PageMarginControl::ExecutePageLayoutChange( const bool bMirrored )
480 {
481  if ( SfxViewFrame::Current() )
482  {
483  std::unique_ptr<SvxPageItem> pPageItem( new SvxPageItem( SID_ATTR_PAGE ) );
484  pPageItem->SetPageUsage( bMirrored ? SvxPageUsage::Mirror : SvxPageUsage::All );
486  SfxCallMode::RECORD, { pPageItem.get() } );
487  pPageItem.reset();
488  }
489 }
490 
491 IMPL_LINK_NOARG( PageMarginControl, ModifyLRMarginHdl, Edit&, void )
492 {
493  m_nPageLeftMargin = GetCoreValue( *m_pLeftMarginEdit.get(), m_eUnit );
494  m_nPageRightMargin = GetCoreValue( *m_pRightMarginEdit.get(), m_eUnit );
495  ExecuteMarginLRChange( m_nPageLeftMargin, m_nPageRightMargin );
496  SetMetricFieldMaxValues( m_aPageSize );
497  m_bCustomValuesUsed = true;
498 }
499 
500 IMPL_LINK_NOARG( PageMarginControl, ModifyULMarginHdl, Edit&, void )
501 {
502  m_nPageTopMargin = GetCoreValue( *m_pTopMarginEdit.get(), m_eUnit );
503  m_nPageBottomMargin = GetCoreValue( *m_pBottomMarginEdit.get(), m_eUnit );
504  ExecuteMarginULChange( m_nPageTopMargin, m_nPageBottomMargin );
505  SetMetricFieldMaxValues( m_aPageSize );
506  m_bCustomValuesUsed = true;
507 }
508 
510 {
511  bool bUserCustomValuesAvailable = false;
512 
513  SvtViewOptions aWinOpt( EViewType::Window, SWPAGE_LEFT_GVALUE );
514  if ( aWinOpt.Exists() )
515  {
516  css::uno::Sequence < css::beans::NamedValue > aSeq = aWinOpt.GetUserData();
517  OUString aTmp;
518  if ( aSeq.hasElements())
519  aSeq[0].Value >>= aTmp;
520  OUString aWinData( aTmp );
521  m_nUserCustomPageLeftMargin = aWinData.toInt32();
522  bUserCustomValuesAvailable = true;
523  }
524 
525  SvtViewOptions aWinOpt2( EViewType::Window, SWPAGE_RIGHT_GVALUE );
526  if ( aWinOpt2.Exists() )
527  {
528  css::uno::Sequence < css::beans::NamedValue > aSeq = aWinOpt2.GetUserData();
529  OUString aTmp;
530  if ( aSeq.hasElements())
531  aSeq[0].Value >>= aTmp;
532  OUString aWinData( aTmp );
533  m_nUserCustomPageRightMargin = aWinData.toInt32();
534  bUserCustomValuesAvailable = true;
535  }
536 
537  SvtViewOptions aWinOpt3( EViewType::Window, SWPAGE_TOP_GVALUE );
538  if ( aWinOpt3.Exists() )
539  {
540  css::uno::Sequence < css::beans::NamedValue > aSeq = aWinOpt3.GetUserData();
541  OUString aTmp;
542  if ( aSeq.hasElements() )
543  aSeq[0].Value >>= aTmp;
544  OUString aWinData( aTmp );
545  m_nUserCustomPageTopMargin = aWinData.toInt32();
546  bUserCustomValuesAvailable = true;
547  }
548 
549  SvtViewOptions aWinOpt4( EViewType::Window, SWPAGE_DOWN_GVALUE );
550  if ( aWinOpt4.Exists() )
551  {
552  css::uno::Sequence < css::beans::NamedValue > aSeq = aWinOpt4.GetUserData();
553  OUString aTmp;
554  if ( aSeq.hasElements())
555  aSeq[0].Value >>= aTmp;
556  OUString aWinData( aTmp );
557  m_nUserCustomPageBottomMargin = aWinData.toInt32();
558  bUserCustomValuesAvailable = true;
559  }
560 
561  SvtViewOptions aWinOpt5( EViewType::Window, SWPAGE_MIRROR_GVALUE );
562  if ( aWinOpt5.Exists() )
563  {
564  css::uno::Sequence < css::beans::NamedValue > aSeq = aWinOpt5.GetUserData();
565  OUString aTmp;
566  if ( aSeq.hasElements())
567  aSeq[0].Value >>= aTmp;
568  OUString aWinData( aTmp );
569  m_bUserCustomMirrored = aWinData.toInt32() != 0;
570  bUserCustomValuesAvailable = true;
571  }
572 
573  return bUserCustomValuesAvailable;
574 }
575 
577 {
578  if ( !m_bCustomValuesUsed )
579  {
580  return;
581  }
582 
583  css::uno::Sequence < css::beans::NamedValue > aSeq( 1 );
584  SvtViewOptions aWinOpt( EViewType::Window, SWPAGE_LEFT_GVALUE );
585 
586  aSeq[0].Name = "mnPageLeftMargin";
587  aSeq[0].Value <<= OUString::number( m_nPageLeftMargin );
588  aWinOpt.SetUserData( aSeq );
589 
590  SvtViewOptions aWinOpt2( EViewType::Window, SWPAGE_RIGHT_GVALUE );
591  aSeq[0].Name = "mnPageRightMargin";
592  aSeq[0].Value <<= OUString::number( m_nPageRightMargin );
593  aWinOpt2.SetUserData( aSeq );
594 
595  SvtViewOptions aWinOpt3( EViewType::Window, SWPAGE_TOP_GVALUE );
596  aSeq[0].Name = "mnPageTopMargin";
597  aSeq[0].Value <<= OUString::number( m_nPageTopMargin );
598  aWinOpt3.SetUserData( aSeq );
599 
600  SvtViewOptions aWinOpt4( EViewType::Window, SWPAGE_DOWN_GVALUE );
601  aSeq[0].Name = "mnPageBottomMargin";
602  aSeq[0].Value <<= OUString::number( m_nPageBottomMargin );
603  aWinOpt4.SetUserData( aSeq );
604 
605  SvtViewOptions aWinOpt5( EViewType::Window, SWPAGE_MIRROR_GVALUE );
606  aSeq[0].Name = "mbMirrored";
607  aSeq[0].Value <<= OUString::number( (m_bMirrored ? 1 : 0) );
608  aWinOpt5.SetUserData( aSeq );
609 }
610 
611 } } // end of namespace sw::sidebar
612 
613 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define SWPAGE_NARROW_VALUE
long Width() const
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)
VclPtr< MetricField > m_pBottomMarginEdit
static void ExecutePageLayoutChange(const bool bMirrored)
void SetClickHdl(const Link< Button *, void > &rLink)
std::string GetValue
long Height() const
static FieldUnit GetCurrentFieldUnit()
void SetMax(sal_Int64 nNewMax, FieldUnit eInUnit)
Dialog to specify the properties of date form field.
Definition: accfrmobj.cxx:38
PageMarginControl(sal_uInt16 nId, vcl::Window *pParent)
VclPtr< MetricField > m_pRightMarginEdit
void SetQuickHelpText(const OUString &rHelpText)
void SetSpinSize(sal_Int64 nNewSize)
SfxApplication * SfxGetpApp()
Value
virtual MapUnit GetMetric(sal_uInt16 nWhich) const
sal_Int64 WinBits
VclPtr< MetricField > m_pTopMarginEdit
Reference< XController > xController
virtual void SetModifyHdl(const Link< Edit &, void > &rLink)
#define SWPAGE_MIRROR_GVALUE
VclPtr< MetricField > m_pWidthHeightField
long GetLower() const
SfxItemPool & GetPool() const
#define SWPAGE_WIDE_VALUE1
void SetMetricFieldMaxValues(const Size &rPageSize)
IMPL_LINK_NOARG(PageColumnControl, MoreButtonClickHdl_Impl, Button *, void)
sal_Int64 Normalize(sal_Int64 nValue) const
SfxBindings & GetBindings()
int GetCoreValue(const weld::MetricSpinButton &rField, MapUnit eUnit)
virtual OUString GetText() const override
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:191
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
sal_Int64 Denormalize(sal_Int64 nValue) const
static void ExecuteMarginULChange(const long nPageTopMargin, const long nPageBottomMargin)
long GetRight() const
void SetLast(sal_Int64 nNewLast, FieldUnit eInUnit)
virtual void SetUnit(FieldUnit meUnit) override
#define SWPAGE_DOWN_GVALUE
static const long MINBODY
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
static VclPtr< reference_type > Create(Arg &&...arg)
bool Exists() const
VclPtr< MetricField > m_pLeftMarginEdit
void SetDecimalDigits(sal_uInt16 nDigits)
virtual void dispose() override
SfxDispatcher * GetDispatcher() const
VclVBox * get() const
MapUnit
Reference< XModel > xModel
#define SWPAGE_NORMAL_VALUE
#define SWPAGE_WIDE_VALUE3
long GetUpper() const
sal_Int64 GetValue(FieldUnit eOutUnit) const
IMPL_LINK(PageColumnControl, ColumnButtonClickHdl_Impl, Button *, pButton, void)
virtual void dispose() override
const Size & GetSize() const
void Show(bool bVisible=true, ShowFlags nFlags=ShowFlags::NONE)