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>
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
46constexpr OUStringLiteral SWPAGE_LEFT_GVALUE = u"Sw_Page_Left";
47constexpr OUStringLiteral SWPAGE_RIGHT_GVALUE = u"Sw_Page_Right";
48constexpr OUStringLiteral SWPAGE_TOP_GVALUE = u"Sw_Page_Top";
49constexpr OUStringLiteral SWPAGE_DOWN_GVALUE = u"Sw_Page_Down";
50constexpr OUStringLiteral SWPAGE_MIRROR_GVALUE = u"Sw_Page_Mirrored";
51
52namespace
53{
54 FieldUnit lcl_GetFieldUnit()
55 {
56 FieldUnit eUnit = FieldUnit::INCH;
57 const SfxUInt16Item* 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>(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
95namespace 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 SvxPageItem* pPageItem;
136 SfxViewFrame::Current()->GetBindings().GetDispatcher()->QueryState( SID_ATTR_PAGE, pPageItem );
137 bLandscape = pPageItem->IsLandscape();
138 m_bMirrored = pPageItem->GetPageUsage() == SvxPageUsage::Mirror;
139 SfxViewFrame::Current()->GetBindings().GetDispatcher()->QueryState( SID_ATTR_PAGE_SIZE, pSize );
140 SfxViewFrame::Current()->GetBindings().GetDispatcher()->QueryState( SID_ATTR_PAGE_LRSPACE, pLRItem );
141 SfxViewFrame::Current()->GetBindings().GetDispatcher()->QueryState( SID_ATTR_PAGE_ULSPACE, pULItem );
142 }
143
144 if ( pLRItem )
145 {
146 m_nPageLeftMargin = pLRItem->GetLeft();
147 m_nPageRightMargin = pLRItem->GetRight();
148 }
149
150 if ( pULItem )
151 {
152 m_nPageTopMargin = pULItem->GetUpper();
153 m_nPageBottomMargin = pULItem->GetLower();
154 }
155
156 if ( bLandscape )
157 {
158 m_xNarrow = m_xBuilder->weld_button("narrowL");
159 m_xNormal = m_xBuilder->weld_button("normalL");
160 m_xWide = m_xBuilder->weld_button("wideL");
161 m_xMirrored = m_xBuilder->weld_button("mirroredL");
162 m_xLast = m_xBuilder->weld_button("lastL");
163 }
164 else
165 {
166 m_xNarrow = m_xBuilder->weld_button("narrow");
167 m_xNormal = m_xBuilder->weld_button("normal");
168 m_xWide = m_xBuilder->weld_button("wide");
169 m_xMirrored = m_xBuilder->weld_button("mirrored");
170 m_xLast = m_xBuilder->weld_button("last");
171 }
172
173 m_xNarrow->show();
174 m_xNormal->show();
175 m_xWide->show();
176 m_xMirrored->show();
177 m_xLast->show();
178
179 m_xNarrow->connect_clicked( LINK( this, PageMarginControl, SelectMarginHdl ) );
180 m_xNormal->connect_clicked( LINK( this, PageMarginControl, SelectMarginHdl ) );
181 m_xWide->connect_clicked( LINK( this, PageMarginControl, SelectMarginHdl ) );
182 m_xMirrored->connect_clicked( LINK( this, PageMarginControl, SelectMarginHdl ) );
183 m_xLast->connect_clicked( LINK( this, PageMarginControl, SelectMarginHdl ) );
184
186
188
189 Link<weld::MetricSpinButton&,void> aLinkLR = LINK( this, PageMarginControl, ModifyLRMarginHdl );
190 m_xLeftMarginEdit->connect_value_changed( aLinkLR );
192 SetFieldUnit( *m_xLeftMarginEdit, lcl_GetFieldUnit() );
193
194 m_xRightMarginEdit->connect_value_changed( aLinkLR );
196 SetFieldUnit( *m_xRightMarginEdit, lcl_GetFieldUnit() );
197
198 Link<weld::MetricSpinButton&,void> aLinkUL = LINK( this, PageMarginControl, ModifyULMarginHdl );
199 m_xTopMarginEdit->connect_value_changed( aLinkUL );
201 SetFieldUnit( *m_xTopMarginEdit, lcl_GetFieldUnit() );
202
203 m_xBottomMarginEdit->connect_value_changed( aLinkUL );
205 SetFieldUnit( *m_xBottomMarginEdit, lcl_GetFieldUnit() );
206
207 if (pSize)
208 {
209 m_aPageSize = pSize->GetSize();
211 }
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
266void 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
346IMPL_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
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 auto pSeq = aSeq.getArray();
553 SvtViewOptions aWinOpt( EViewType::Window, SWPAGE_LEFT_GVALUE );
554
555 pSeq[0].Name = "mnPageLeftMargin";
556 pSeq[0].Value <<= OUString::number( m_nPageLeftMargin );
557 aWinOpt.SetUserData( aSeq );
558
559 SvtViewOptions aWinOpt2( EViewType::Window, SWPAGE_RIGHT_GVALUE );
560 pSeq[0].Name = "mnPageRightMargin";
561 pSeq[0].Value <<= OUString::number( m_nPageRightMargin );
562 aWinOpt2.SetUserData( aSeq );
563
564 SvtViewOptions aWinOpt3( EViewType::Window, SWPAGE_TOP_GVALUE );
565 pSeq[0].Name = "mnPageTopMargin";
566 pSeq[0].Value <<= OUString::number( m_nPageTopMargin );
567 aWinOpt3.SetUserData( aSeq );
568
569 SvtViewOptions aWinOpt4( EViewType::Window, SWPAGE_DOWN_GVALUE );
570 pSeq[0].Name = "mnPageBottomMargin";
571 pSeq[0].Value <<= OUString::number( m_nPageBottomMargin );
572 aWinOpt4.SetUserData( aSeq );
573
574 SvtViewOptions aWinOpt5( EViewType::Window, SWPAGE_MIRROR_GVALUE );
575 pSeq[0].Name = "mbMirrored";
576 pSeq[0].Value <<= OUString::number( m_bMirrored ? 1 : 0 );
577 aWinOpt5.SetUserData( aSeq );
578}
579
580} // end of namespace sw::sidebar
581
582/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
constexpr OUStringLiteral SWPAGE_DOWN_GVALUE
constexpr OUStringLiteral SWPAGE_RIGHT_GVALUE
constexpr OUStringLiteral SWPAGE_LEFT_GVALUE
constexpr OUStringLiteral SWPAGE_MIRROR_GVALUE
constexpr OUStringLiteral SWPAGE_TOP_GVALUE
#define SWPAGE_WIDE_VALUE3
#define SWPAGE_NARROW_VALUE
#define SWPAGE_WIDE_VALUE2
#define SWPAGE_NORMAL_VALUE
constexpr tools::Long MINBODY
#define SWPAGE_WIDE_VALUE1
SfxApplication * SfxGetpApp()
sal_uInt16 GetValue() const
SAL_WARN_UNUSED_RESULT Point LogicToLogic(const Point &rPtSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
SfxDispatcher * GetDispatcher() const
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 * >())
SfxItemState QueryState(sal_uInt16 nSID, const SfxPoolItem *&rpState)
sal_uInt16 GetWhich(sal_uInt16 nSlot, bool bDeep=true) const
virtual MapUnit GetMetric(sal_uInt16 nWhich) const
static FieldUnit GetCurrentFieldUnit()
SfxItemPool & GetPool() const
static SfxViewFrame * Current()
SfxBindings & GetBindings()
constexpr tools::Long Height() const
constexpr tools::Long Width() const
void SetUserData(const css::uno::Sequence< css::beans::NamedValue > &lData)
css::uno::Sequence< css::beans::NamedValue > GetUserData() const
bool Exists() const
tools::Long GetRight() const
void SetLeft(tools::Long lArgLeft)
tools::Long GetLeft() const
void SetRight(tools::Long lArgRight)
tools::Long GetLower() const
void SetLower(tools::Long lArgRight)
tools::Long GetUpper() const
void SetUpper(tools::Long lArgLeft)
void SetPageUsage(SvxPageUsage eU)
SvxPageUsage GetPageUsage() const
bool IsLandscape() const
const Size & GetSize() const
std::unique_ptr< weld::Builder > m_xBuilder
virtual void GrabFocus() override
std::unique_ptr< weld::Button > m_xLast
std::unique_ptr< weld::Button > m_xNormal
PageMarginControl(PageMarginPopup *pControl, weld::Widget *pParent)
std::unique_ptr< weld::MetricSpinButton > m_xBottomMarginEdit
std::unique_ptr< weld::Button > m_xMirrored
std::unique_ptr< weld::MetricSpinButton > m_xWidthHeightField
std::unique_ptr< weld::Button > m_xNarrow
static void ExecutePageLayoutChange(const bool bMirrored)
std::unique_ptr< weld::Button > m_xWide
void SetMetricFieldMaxValues(const Size &rPageSize)
std::unique_ptr< weld::Label > m_xOuter
void FillHelpText(const bool bUserCustomValuesAvailable)
std::unique_ptr< weld::MetricSpinButton > m_xTopMarginEdit
std::unique_ptr< weld::MetricSpinButton > m_xRightMarginEdit
std::unique_ptr< weld::Label > m_xLeft
static void ExecuteMarginLRChange(const tools::Long nPageLeftMargin, const tools::Long nPageRightMargin)
std::unique_ptr< weld::MetricSpinButton > m_xLeftMarginEdit
std::unique_ptr< weld::Label > m_xInner
std::unique_ptr< weld::Label > m_xRight
static void ExecuteMarginULChange(const tools::Long nPageTopMargin, const tools::Long nPageBottomMargin)
float u
FieldUnit
Sequence< sal_Int8 > aSeq
MapUnit
IMPL_LINK_NOARG(PageColumnControl, MoreButtonClickHdl_Impl, weld::Button &, void)
IMPL_LINK(PageColumnControl, ColumnButtonClickHdl_Impl, weld::Button &, rButton, void)
long Long
SfxItemState
Reference< XController > xController
Reference< XModel > xModel
OUString SwResId(TranslateId aId)
Definition: swmodule.cxx:165
SVT_DLLPUBLIC sal_Int64 GetCoreValue(const weld::MetricSpinButton &rField, MapUnit eUnit)
SVT_DLLPUBLIC void SetMetricValue(weld::MetricSpinButton &rField, sal_Int64 nCoreValue, MapUnit eUnit)
SVT_DLLPUBLIC void SetFieldUnit(weld::MetricSpinButton &rCtrl, FieldUnit eUnit, bool bAll=false)
Reference< XControl > m_xControl