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