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 SvxSizeItem* pSize = nullptr;
131  const SvxLongLRSpaceItem* pLRItem = nullptr;
132  const SvxLongULSpaceItem* pULItem = nullptr;
133  if ( SfxViewFrame::Current() )
134  {
135  const SfxPoolItem* pItem;
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 tools::Long nML = m_xLeftMarginEdit->denormalize( m_xLeftMarginEdit->get_value( FieldUnit::TWIP ) );
242  const tools::Long nMR = m_xRightMarginEdit->denormalize( m_xRightMarginEdit->get_value( FieldUnit::TWIP ) );
243  const tools::Long nMT = m_xTopMarginEdit->denormalize( m_xTopMarginEdit->get_value( FieldUnit::TWIP ) );
244  const tools::Long nMB = m_xBottomMarginEdit->denormalize( m_xBottomMarginEdit->get_value( FieldUnit::TWIP ) );
245 
246  const tools::Long nPH = OutputDevice::LogicToLogic( rPageSize.Height(), m_eUnit, MapUnit::MapTwip );
247  const tools::Long nPW = OutputDevice::LogicToLogic( rPageSize.Width(), m_eUnit, MapUnit::MapTwip );
248 
249  // Left
250  tools::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() + aTop;
335  aHelpText += m_xWidthHeightField->get_text() + aBottom;
337  aHelpText += m_xWidthHeightField->get_text();
338  }
339  else
340  {
341  aHelpText.clear();
342  }
343  m_xLast->set_tooltip_text( aHelpText );
344 }
345 
346 IMPL_LINK( PageMarginControl, SelectMarginHdl, weld::Button&, rControl, void )
347 {
348  bool bMirrored = false;
349  bool bApplyNewPageMargins = true;
350  if( &rControl == m_xNarrow.get() )
351  {
352  m_nPageLeftMargin = SWPAGE_NARROW_VALUE;
353  m_nPageRightMargin = SWPAGE_NARROW_VALUE;
354  m_nPageTopMargin = SWPAGE_NARROW_VALUE;
355  m_nPageBottomMargin = SWPAGE_NARROW_VALUE;
356  bMirrored = false;
357  }
358  if( &rControl == m_xNormal.get() )
359  {
360  m_nPageLeftMargin = SWPAGE_NORMAL_VALUE;
361  m_nPageRightMargin = SWPAGE_NORMAL_VALUE;
362  m_nPageTopMargin = SWPAGE_NORMAL_VALUE;
363  m_nPageBottomMargin = SWPAGE_NORMAL_VALUE;
364  bMirrored = false;
365  }
366  if( &rControl == m_xWide.get() )
367  {
368  m_nPageLeftMargin = SWPAGE_WIDE_VALUE2;
369  m_nPageRightMargin = SWPAGE_WIDE_VALUE2;
370  m_nPageTopMargin = SWPAGE_WIDE_VALUE1;
371  m_nPageBottomMargin = SWPAGE_WIDE_VALUE1;
372  bMirrored = false;
373  }
374  if( &rControl == m_xMirrored.get() )
375  {
376  m_nPageLeftMargin = SWPAGE_WIDE_VALUE3;
377  m_nPageRightMargin = SWPAGE_WIDE_VALUE1;
378  m_nPageTopMargin = SWPAGE_WIDE_VALUE1;
379  m_nPageBottomMargin = SWPAGE_WIDE_VALUE1;
380  bMirrored = true;
381  }
382  if( &rControl == m_xLast.get() )
383  {
384  if ( m_bUserCustomValuesAvailable )
385  {
386  m_nPageLeftMargin = m_nUserCustomPageLeftMargin;
387  m_nPageRightMargin = m_nUserCustomPageRightMargin;
388  m_nPageTopMargin = m_nUserCustomPageTopMargin;
389  m_nPageBottomMargin = m_nUserCustomPageBottomMargin;
390  bMirrored = m_bUserCustomMirrored;
391  }
392  else
393  {
394  bApplyNewPageMargins = false;
395  }
396  }
397 
398  if ( !bApplyNewPageMargins )
399  return;
400 
401  const css::uno::Reference< css::document::XUndoManager > xUndoManager( getUndoManager( SfxViewFrame::Current()->GetFrame().GetFrameInterface() ) );
402  if ( xUndoManager.is() )
403  xUndoManager->enterUndoContext( "" );
404 
405  ExecuteMarginLRChange( m_nPageLeftMargin, m_nPageRightMargin );
406  ExecuteMarginULChange( m_nPageTopMargin, m_nPageBottomMargin );
407  if ( m_bMirrored != bMirrored )
408  {
409  m_bMirrored = bMirrored;
410  ExecutePageLayoutChange( m_bMirrored );
411  }
412 
413  if ( xUndoManager.is() )
414  xUndoManager->leaveUndoContext();
415 
416  m_bCustomValuesUsed = false;
417  m_xControl->EndPopupMode();
418 }
419 
421  const tools::Long nPageLeftMargin,
422  const tools::Long nPageRightMargin )
423 {
424  if ( SfxViewFrame::Current() )
425  {
426  SvxLongLRSpaceItem aPageLRMarginItem( 0, 0, SID_ATTR_PAGE_LRSPACE );
427  aPageLRMarginItem.SetLeft( nPageLeftMargin );
428  aPageLRMarginItem.SetRight( nPageRightMargin );
429  SfxViewFrame::Current()->GetBindings().GetDispatcher()->ExecuteList( SID_ATTR_PAGE_LRSPACE,
430  SfxCallMode::RECORD, { &aPageLRMarginItem } );
431  }
432 }
433 
435  const tools::Long nPageTopMargin,
436  const tools::Long nPageBottomMargin )
437 {
438  if ( SfxViewFrame::Current() )
439  {
440  SvxLongULSpaceItem aPageULMarginItem( 0, 0, SID_ATTR_PAGE_ULSPACE );
441  aPageULMarginItem.SetUpper( nPageTopMargin );
442  aPageULMarginItem.SetLower( nPageBottomMargin );
443  SfxViewFrame::Current()->GetBindings().GetDispatcher()->ExecuteList( SID_ATTR_PAGE_ULSPACE,
444  SfxCallMode::RECORD, { &aPageULMarginItem } );
445  }
446 }
447 
448 void PageMarginControl::ExecutePageLayoutChange( const bool bMirrored )
449 {
450  if ( SfxViewFrame::Current() )
451  {
452  SvxPageItem aPageItem( SID_ATTR_PAGE );
453  aPageItem.SetPageUsage( bMirrored ? SvxPageUsage::Mirror : SvxPageUsage::All );
455  SfxCallMode::RECORD, { &aPageItem } );
456  }
457 }
458 
460 {
461  m_nPageLeftMargin = GetCoreValue( *m_xLeftMarginEdit, m_eUnit );
462  m_nPageRightMargin = GetCoreValue( *m_xRightMarginEdit, m_eUnit );
463  ExecuteMarginLRChange( m_nPageLeftMargin, m_nPageRightMargin );
464  SetMetricFieldMaxValues( m_aPageSize );
465  m_bCustomValuesUsed = true;
466 }
467 
469 {
470  m_nPageTopMargin = GetCoreValue( *m_xTopMarginEdit, m_eUnit );
471  m_nPageBottomMargin = GetCoreValue( *m_xBottomMarginEdit, m_eUnit );
472  ExecuteMarginULChange( m_nPageTopMargin, m_nPageBottomMargin );
473  SetMetricFieldMaxValues( m_aPageSize );
474  m_bCustomValuesUsed = true;
475 }
476 
478 {
479  bool bUserCustomValuesAvailable = false;
480 
481  SvtViewOptions aWinOpt( EViewType::Window, SWPAGE_LEFT_GVALUE );
482  if ( aWinOpt.Exists() )
483  {
484  css::uno::Sequence < css::beans::NamedValue > aSeq = aWinOpt.GetUserData();
485  OUString aTmp;
486  if ( aSeq.hasElements())
487  aSeq[0].Value >>= aTmp;
488  OUString aWinData( aTmp );
489  m_nUserCustomPageLeftMargin = aWinData.toInt32();
490  bUserCustomValuesAvailable = true;
491  }
492 
493  SvtViewOptions aWinOpt2( EViewType::Window, SWPAGE_RIGHT_GVALUE );
494  if ( aWinOpt2.Exists() )
495  {
496  css::uno::Sequence < css::beans::NamedValue > aSeq = aWinOpt2.GetUserData();
497  OUString aTmp;
498  if ( aSeq.hasElements())
499  aSeq[0].Value >>= aTmp;
500  OUString aWinData( aTmp );
501  m_nUserCustomPageRightMargin = aWinData.toInt32();
502  bUserCustomValuesAvailable = true;
503  }
504 
505  SvtViewOptions aWinOpt3( EViewType::Window, SWPAGE_TOP_GVALUE );
506  if ( aWinOpt3.Exists() )
507  {
508  css::uno::Sequence < css::beans::NamedValue > aSeq = aWinOpt3.GetUserData();
509  OUString aTmp;
510  if ( aSeq.hasElements() )
511  aSeq[0].Value >>= aTmp;
512  OUString aWinData( aTmp );
513  m_nUserCustomPageTopMargin = aWinData.toInt32();
514  bUserCustomValuesAvailable = true;
515  }
516 
517  SvtViewOptions aWinOpt4( EViewType::Window, SWPAGE_DOWN_GVALUE );
518  if ( aWinOpt4.Exists() )
519  {
520  css::uno::Sequence < css::beans::NamedValue > aSeq = aWinOpt4.GetUserData();
521  OUString aTmp;
522  if ( aSeq.hasElements())
523  aSeq[0].Value >>= aTmp;
524  OUString aWinData( aTmp );
525  m_nUserCustomPageBottomMargin = aWinData.toInt32();
526  bUserCustomValuesAvailable = true;
527  }
528 
529  SvtViewOptions aWinOpt5( EViewType::Window, SWPAGE_MIRROR_GVALUE );
530  if ( aWinOpt5.Exists() )
531  {
532  css::uno::Sequence < css::beans::NamedValue > aSeq = aWinOpt5.GetUserData();
533  OUString aTmp;
534  if ( aSeq.hasElements())
535  aSeq[0].Value >>= aTmp;
536  OUString aWinData( aTmp );
537  m_bUserCustomMirrored = aWinData.toInt32() != 0;
538  bUserCustomValuesAvailable = true;
539  }
540 
541  return bUserCustomValuesAvailable;
542 }
543 
545 {
546  if ( !m_bCustomValuesUsed )
547  {
548  return;
549  }
550 
551  css::uno::Sequence < css::beans::NamedValue > aSeq( 1 );
552  SvtViewOptions aWinOpt( EViewType::Window, SWPAGE_LEFT_GVALUE );
553 
554  aSeq[0].Name = "mnPageLeftMargin";
555  aSeq[0].Value <<= OUString::number( m_nPageLeftMargin );
556  aWinOpt.SetUserData( aSeq );
557 
558  SvtViewOptions aWinOpt2( EViewType::Window, SWPAGE_RIGHT_GVALUE );
559  aSeq[0].Name = "mnPageRightMargin";
560  aSeq[0].Value <<= OUString::number( m_nPageRightMargin );
561  aWinOpt2.SetUserData( aSeq );
562 
563  SvtViewOptions aWinOpt3( EViewType::Window, SWPAGE_TOP_GVALUE );
564  aSeq[0].Name = "mnPageTopMargin";
565  aSeq[0].Value <<= OUString::number( m_nPageTopMargin );
566  aWinOpt3.SetUserData( aSeq );
567 
568  SvtViewOptions aWinOpt4( EViewType::Window, SWPAGE_DOWN_GVALUE );
569  aSeq[0].Name = "mnPageBottomMargin";
570  aSeq[0].Value <<= OUString::number( m_nPageBottomMargin );
571  aWinOpt4.SetUserData( aSeq );
572 
573  SvtViewOptions aWinOpt5( EViewType::Window, SWPAGE_MIRROR_GVALUE );
574  aSeq[0].Name = "mbMirrored";
575  aSeq[0].Value <<= OUString::number( m_bMirrored ? 1 : 0 );
576  aWinOpt5.SetUserData( aSeq );
577 }
578 
579 } // end of namespace sw::sidebar
580 
581 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define SWPAGE_NARROW_VALUE
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)
void SetUpper(tools::Long lArgLeft)
std::unique_ptr< weld::Button > m_xMirrored
void SetPageUsage(SvxPageUsage eU)
static void ExecutePageLayoutChange(const bool bMirrored)
std::string GetValue
SAL_WARN_UNUSED_RESULT Point LogicToLogic(const Point &rPtSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
Reference< XControl > m_xControl
std::unique_ptr< weld::Label > m_xRight
long Long
void SetLower(tools::Long lArgRight)
const tools::Long MINBODY
static FieldUnit GetCurrentFieldUnit()
std::unique_ptr< weld::MetricSpinButton > m_xLeftMarginEdit
IMPL_LINK(PageColumnControl, ColumnButtonClickHdl_Impl, weld::Button &, rButton, void)
tools::Long GetUpper() const
virtual void GrabFocus() override
tools::Long GetRight() const
SfxApplication * SfxGetpApp()
Value
constexpr tools::Long Width() const
virtual MapUnit GetMetric(sal_uInt16 nWhich) const
std::unique_ptr< weld::Button > m_xNormal
tools::Long GetLeft() const
Reference< XController > xController
std::unique_ptr< weld::Label > m_xLeft
#define SWPAGE_MIRROR_GVALUE
std::unique_ptr< weld::Button > m_xLast
void SetRight(tools::Long lArgRight)
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 ExecuteMarginULChange(const tools::Long nPageTopMargin, const tools::Long nPageBottomMargin)
static void ExecuteMarginLRChange(const tools::Long nPageLeftMargin, const tools::Long nPageRightMargin)
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
std::unique_ptr< weld::Label > m_xInner
#define SWPAGE_DOWN_GVALUE
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
constexpr tools::Long Height() const
std::unique_ptr< weld::MetricSpinButton > m_xTopMarginEdit
std::unique_ptr< weld::Button > m_xNarrow
bool Exists() const
Sequence< sal_Int8 > aSeq
tools::Long GetLower() const
std::unique_ptr< weld::MetricSpinButton > m_xRightMarginEdit
SfxDispatcher * GetDispatcher() const
MapUnit
Reference< XModel > xModel
#define SWPAGE_NORMAL_VALUE
#define SWPAGE_WIDE_VALUE3
void SetLeft(tools::Long lArgLeft)
OUString SwResId(std::string_view aId)
Definition: swmodule.cxx:165
const Size & GetSize() const
std::unique_ptr< weld::MetricSpinButton > m_xWidthHeightField
std::unique_ptr< weld::Builder > m_xBuilder