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 m_aPageSize = pSize->GetSize();
209
210 if ( m_bMirrored )
211 {
212 m_xLeft->hide();
213 m_xRight->hide();
214 m_xInner->show();
215 m_xOuter->show();
216 }
217 else
218 {
219 m_xLeft->show();
220 m_xRight->show();
221 m_xInner->hide();
222 m_xOuter->hide();
223 }
224}
225
227{
228 m_xNarrow->grab_focus();
229}
230
232{
234}
235
237{
238 const tools::Long nML = m_xLeftMarginEdit->denormalize( m_xLeftMarginEdit->get_value( FieldUnit::TWIP ) );
239 const tools::Long nMR = m_xRightMarginEdit->denormalize( m_xRightMarginEdit->get_value( FieldUnit::TWIP ) );
240 const tools::Long nMT = m_xTopMarginEdit->denormalize( m_xTopMarginEdit->get_value( FieldUnit::TWIP ) );
241 const tools::Long nMB = m_xBottomMarginEdit->denormalize( m_xBottomMarginEdit->get_value( FieldUnit::TWIP ) );
242
243 const tools::Long nPH = OutputDevice::LogicToLogic( rPageSize.Height(), m_eUnit, MapUnit::MapTwip );
244 const tools::Long nPW = OutputDevice::LogicToLogic( rPageSize.Width(), m_eUnit, MapUnit::MapTwip );
245
246 // Left
247 tools::Long nMax = nPW - nMR - MINBODY;
248 m_xLeftMarginEdit->set_max( m_xLeftMarginEdit->normalize( nMax ), FieldUnit::TWIP );
249
250 // Right
251 nMax = nPW - nML - MINBODY;
252 m_xRightMarginEdit->set_max( m_xRightMarginEdit->normalize( nMax ), FieldUnit::TWIP );
253
254 //Top
255 nMax = nPH - nMB - MINBODY;
256 m_xTopMarginEdit->set_max( m_xTopMarginEdit->normalize( nMax ), FieldUnit::TWIP );
257
258 //Bottom
259 nMax = nPH - nMT - MINBODY;
260 m_xBottomMarginEdit->set_max( m_xTopMarginEdit->normalize( nMax ), FieldUnit::TWIP );
261}
262
263void PageMarginControl::FillHelpText( const bool bUserCustomValuesAvailable )
264{
265 const OUString aLeft = SwResId( STR_MARGIN_TOOLTIP_LEFT );
266 const OUString aRight = SwResId( STR_MARGIN_TOOLTIP_RIGHT );
267 const OUString aTop = SwResId( STR_MARGIN_TOOLTIP_TOP );
268 const OUString aBottom = SwResId( STR_MARGIN_TOOLTIP_BOT );
269
271 const OUString aNarrowValText = m_xWidthHeightField->get_text();
272 OUString aHelpText = aLeft +
273 aNarrowValText +
274 aRight +
275 aNarrowValText +
276 aTop +
277 aNarrowValText +
278 aBottom +
279 aNarrowValText;
280 m_xNarrow->set_tooltip_text( aHelpText );
281
283 const OUString aNormalValText = m_xWidthHeightField->get_text();
284 aHelpText = aLeft +
285 aNormalValText +
286 aRight +
287 aNormalValText +
288 aTop +
289 aNormalValText +
290 aBottom +
291 aNormalValText;
292 m_xNormal->set_tooltip_text( aHelpText );
293
295 const OUString aWide1ValText = m_xWidthHeightField->get_text();
297 const OUString aWide2ValText = m_xWidthHeightField->get_text();
298 aHelpText = aLeft +
299 aWide2ValText +
300 aRight +
301 aWide2ValText +
302 aTop +
303 aWide1ValText +
304 aBottom +
305 aWide1ValText;
306 m_xWide->set_tooltip_text( aHelpText );
307
308 const OUString aInner = SwResId( STR_MARGIN_TOOLTIP_INNER );
309 const OUString aOuter = SwResId( STR_MARGIN_TOOLTIP_OUTER );
310
312 const OUString aWide3ValText = m_xWidthHeightField->get_text();
313 aHelpText = aInner +
314 aWide3ValText +
315 aOuter +
316 aWide1ValText +
317 aTop +
318 aWide1ValText +
319 aBottom +
320 aWide1ValText;
321 m_xMirrored->set_tooltip_text( aHelpText );
322
323 if ( bUserCustomValuesAvailable )
324 {
325 aHelpText = m_bUserCustomMirrored ? aInner : aLeft;
327 aHelpText += m_xWidthHeightField->get_text();
328 aHelpText += m_bUserCustomMirrored ? aOuter : aRight;
330 aHelpText += m_xWidthHeightField->get_text() + aTop;
332 aHelpText += m_xWidthHeightField->get_text() + aBottom;
334 aHelpText += m_xWidthHeightField->get_text();
335 }
336 else
337 {
338 aHelpText.clear();
339 }
340 m_xLast->set_tooltip_text( aHelpText );
341}
342
343IMPL_LINK( PageMarginControl, SelectMarginHdl, weld::Button&, rControl, void )
344{
345 bool bMirrored = false;
346 bool bApplyNewPageMargins = true;
347 if( &rControl == m_xNarrow.get() )
348 {
349 m_nPageLeftMargin = SWPAGE_NARROW_VALUE;
350 m_nPageRightMargin = SWPAGE_NARROW_VALUE;
351 m_nPageTopMargin = SWPAGE_NARROW_VALUE;
352 m_nPageBottomMargin = SWPAGE_NARROW_VALUE;
353 bMirrored = false;
354 }
355 if( &rControl == m_xNormal.get() )
356 {
357 m_nPageLeftMargin = SWPAGE_NORMAL_VALUE;
358 m_nPageRightMargin = SWPAGE_NORMAL_VALUE;
359 m_nPageTopMargin = SWPAGE_NORMAL_VALUE;
360 m_nPageBottomMargin = SWPAGE_NORMAL_VALUE;
361 bMirrored = false;
362 }
363 if( &rControl == m_xWide.get() )
364 {
365 m_nPageLeftMargin = SWPAGE_WIDE_VALUE2;
366 m_nPageRightMargin = SWPAGE_WIDE_VALUE2;
367 m_nPageTopMargin = SWPAGE_WIDE_VALUE1;
368 m_nPageBottomMargin = SWPAGE_WIDE_VALUE1;
369 bMirrored = false;
370 }
371 if( &rControl == m_xMirrored.get() )
372 {
373 m_nPageLeftMargin = SWPAGE_WIDE_VALUE3;
374 m_nPageRightMargin = SWPAGE_WIDE_VALUE1;
375 m_nPageTopMargin = SWPAGE_WIDE_VALUE1;
376 m_nPageBottomMargin = SWPAGE_WIDE_VALUE1;
377 bMirrored = true;
378 }
379 if( &rControl == m_xLast.get() )
380 {
381 if ( m_bUserCustomValuesAvailable )
382 {
383 m_nPageLeftMargin = m_nUserCustomPageLeftMargin;
384 m_nPageRightMargin = m_nUserCustomPageRightMargin;
385 m_nPageTopMargin = m_nUserCustomPageTopMargin;
386 m_nPageBottomMargin = m_nUserCustomPageBottomMargin;
387 bMirrored = m_bUserCustomMirrored;
388 }
389 else
390 {
391 bApplyNewPageMargins = false;
392 }
393 }
394
395 if ( !bApplyNewPageMargins )
396 return;
397
398 const css::uno::Reference< css::document::XUndoManager > xUndoManager( getUndoManager( SfxViewFrame::Current()->GetFrame().GetFrameInterface() ) );
399 if ( xUndoManager.is() )
400 xUndoManager->enterUndoContext( "" );
401
402 ExecuteMarginLRChange( m_nPageLeftMargin, m_nPageRightMargin );
403 ExecuteMarginULChange( m_nPageTopMargin, m_nPageBottomMargin );
404 if ( m_bMirrored != bMirrored )
405 {
406 m_bMirrored = bMirrored;
407 ExecutePageLayoutChange( m_bMirrored );
408 }
409
410 if ( xUndoManager.is() )
411 xUndoManager->leaveUndoContext();
412
413 m_bCustomValuesUsed = false;
414 m_xControl->EndPopupMode();
415}
416
418 const tools::Long nPageLeftMargin,
419 const tools::Long nPageRightMargin )
420{
421 if ( SfxViewFrame::Current() )
422 {
423 SvxLongLRSpaceItem aPageLRMarginItem( 0, 0, SID_ATTR_PAGE_LRSPACE );
424 aPageLRMarginItem.SetLeft( nPageLeftMargin );
425 aPageLRMarginItem.SetRight( nPageRightMargin );
426 SfxViewFrame::Current()->GetBindings().GetDispatcher()->ExecuteList( SID_ATTR_PAGE_LRSPACE,
427 SfxCallMode::RECORD, { &aPageLRMarginItem } );
428 }
429}
430
432 const tools::Long nPageTopMargin,
433 const tools::Long nPageBottomMargin )
434{
435 if ( SfxViewFrame::Current() )
436 {
437 SvxLongULSpaceItem aPageULMarginItem( 0, 0, SID_ATTR_PAGE_ULSPACE );
438 aPageULMarginItem.SetUpper( nPageTopMargin );
439 aPageULMarginItem.SetLower( nPageBottomMargin );
440 SfxViewFrame::Current()->GetBindings().GetDispatcher()->ExecuteList( SID_ATTR_PAGE_ULSPACE,
441 SfxCallMode::RECORD, { &aPageULMarginItem } );
442 }
443}
444
446{
447 if ( SfxViewFrame::Current() )
448 {
449 SvxPageItem aPageItem( SID_ATTR_PAGE );
450 aPageItem.SetPageUsage( bMirrored ? SvxPageUsage::Mirror : SvxPageUsage::All );
452 SfxCallMode::RECORD, { &aPageItem } );
453 }
454}
455
457{
458 m_nPageLeftMargin = GetCoreValue( *m_xLeftMarginEdit, m_eUnit );
459 m_nPageRightMargin = GetCoreValue( *m_xRightMarginEdit, m_eUnit );
460 ExecuteMarginLRChange( m_nPageLeftMargin, m_nPageRightMargin );
461 SetMetricFieldMaxValues( m_aPageSize );
462 m_bCustomValuesUsed = true;
463}
464
466{
467 m_nPageTopMargin = GetCoreValue( *m_xTopMarginEdit, m_eUnit );
468 m_nPageBottomMargin = GetCoreValue( *m_xBottomMarginEdit, m_eUnit );
469 ExecuteMarginULChange( m_nPageTopMargin, m_nPageBottomMargin );
470 SetMetricFieldMaxValues( m_aPageSize );
471 m_bCustomValuesUsed = true;
472}
473
475{
476 bool bUserCustomValuesAvailable = false;
477
478 SvtViewOptions aWinOpt( EViewType::Window, SWPAGE_LEFT_GVALUE );
479 if ( aWinOpt.Exists() )
480 {
481 css::uno::Sequence < css::beans::NamedValue > aSeq = aWinOpt.GetUserData();
482 OUString aTmp;
483 if ( aSeq.hasElements())
484 aSeq[0].Value >>= aTmp;
485 OUString aWinData( aTmp );
486 m_nUserCustomPageLeftMargin = aWinData.toInt32();
487 bUserCustomValuesAvailable = true;
488 }
489
490 SvtViewOptions aWinOpt2( EViewType::Window, SWPAGE_RIGHT_GVALUE );
491 if ( aWinOpt2.Exists() )
492 {
493 css::uno::Sequence < css::beans::NamedValue > aSeq = aWinOpt2.GetUserData();
494 OUString aTmp;
495 if ( aSeq.hasElements())
496 aSeq[0].Value >>= aTmp;
497 OUString aWinData( aTmp );
498 m_nUserCustomPageRightMargin = aWinData.toInt32();
499 bUserCustomValuesAvailable = true;
500 }
501
502 SvtViewOptions aWinOpt3( EViewType::Window, SWPAGE_TOP_GVALUE );
503 if ( aWinOpt3.Exists() )
504 {
505 css::uno::Sequence < css::beans::NamedValue > aSeq = aWinOpt3.GetUserData();
506 OUString aTmp;
507 if ( aSeq.hasElements() )
508 aSeq[0].Value >>= aTmp;
509 OUString aWinData( aTmp );
510 m_nUserCustomPageTopMargin = aWinData.toInt32();
511 bUserCustomValuesAvailable = true;
512 }
513
514 SvtViewOptions aWinOpt4( EViewType::Window, SWPAGE_DOWN_GVALUE );
515 if ( aWinOpt4.Exists() )
516 {
517 css::uno::Sequence < css::beans::NamedValue > aSeq = aWinOpt4.GetUserData();
518 OUString aTmp;
519 if ( aSeq.hasElements())
520 aSeq[0].Value >>= aTmp;
521 OUString aWinData( aTmp );
522 m_nUserCustomPageBottomMargin = aWinData.toInt32();
523 bUserCustomValuesAvailable = true;
524 }
525
526 SvtViewOptions aWinOpt5( EViewType::Window, SWPAGE_MIRROR_GVALUE );
527 if ( aWinOpt5.Exists() )
528 {
529 css::uno::Sequence < css::beans::NamedValue > aSeq = aWinOpt5.GetUserData();
530 OUString aTmp;
531 if ( aSeq.hasElements())
532 aSeq[0].Value >>= aTmp;
533 OUString aWinData( aTmp );
534 m_bUserCustomMirrored = aWinData.toInt32() != 0;
535 bUserCustomValuesAvailable = true;
536 }
537
538 return bUserCustomValuesAvailable;
539}
540
542{
543 if ( !m_bCustomValuesUsed )
544 {
545 return;
546 }
547
548 css::uno::Sequence < css::beans::NamedValue > aSeq( 1 );
549 auto pSeq = aSeq.getArray();
550 SvtViewOptions aWinOpt( EViewType::Window, SWPAGE_LEFT_GVALUE );
551
552 pSeq[0].Name = "mnPageLeftMargin";
553 pSeq[0].Value <<= OUString::number( m_nPageLeftMargin );
554 aWinOpt.SetUserData( aSeq );
555
556 SvtViewOptions aWinOpt2( EViewType::Window, SWPAGE_RIGHT_GVALUE );
557 pSeq[0].Name = "mnPageRightMargin";
558 pSeq[0].Value <<= OUString::number( m_nPageRightMargin );
559 aWinOpt2.SetUserData( aSeq );
560
561 SvtViewOptions aWinOpt3( EViewType::Window, SWPAGE_TOP_GVALUE );
562 pSeq[0].Name = "mnPageTopMargin";
563 pSeq[0].Value <<= OUString::number( m_nPageTopMargin );
564 aWinOpt3.SetUserData( aSeq );
565
566 SvtViewOptions aWinOpt4( EViewType::Window, SWPAGE_DOWN_GVALUE );
567 pSeq[0].Name = "mnPageBottomMargin";
568 pSeq[0].Value <<= OUString::number( m_nPageBottomMargin );
569 aWinOpt4.SetUserData( aSeq );
570
571 SvtViewOptions aWinOpt5( EViewType::Window, SWPAGE_MIRROR_GVALUE );
572 pSeq[0].Name = "mbMirrored";
573 pSeq[0].Value <<= OUString::number( m_bMirrored ? 1 : 0 );
574 aWinOpt5.SetUserData( aSeq );
575}
576
577} // end of namespace sw::sidebar
578
579/* 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:164
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