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