LibreOffice Module sw (master)  1
PageMarginControl.hxx
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 #ifndef INCLUDED_SW_SOURCE_UIBASE_SIDEBAR_PAGEMARGINCONTROL_HXX
20 #define INCLUDED_SW_SOURCE_UIBASE_SIDEBAR_PAGEMARGINCONTROL_HXX
21 
22 #include <svtools/toolbarmenu.hxx>
23 
24 #define SWPAGE_NARROW_VALUE 720
25 #define SWPAGE_NORMAL_VALUE 1136
26 #define SWPAGE_WIDE_VALUE1 1440
27 #define SWPAGE_WIDE_VALUE2 2880
28 #define SWPAGE_WIDE_VALUE3 1800
29 
30 // #i19922# - tdf#126051 see cui/source/tabpages/page.cxx and svx/source/dialog/hdft.cxx
31 const long MINBODY = 56; // 1mm in twips rounded
32 
33 class PageMarginPopup;
34 
35 namespace sw::sidebar {
36 
37 class PageMarginControl final : public WeldToolbarPopup
38 {
39 public:
40  explicit PageMarginControl(PageMarginPopup* pControl, weld::Widget* pParent);
41  virtual void GrabFocus() override;
42  virtual ~PageMarginControl() override;
43 
44 private:
45  std::unique_ptr<weld::Button> m_xNarrow;
46  std::unique_ptr<weld::Button> m_xNormal;
47  std::unique_ptr<weld::Button> m_xWide;
48  std::unique_ptr<weld::Button> m_xMirrored;
49  std::unique_ptr<weld::Button> m_xLast;
50 
51  std::unique_ptr<weld::Label> m_xLeft;
52  std::unique_ptr<weld::Label> m_xRight;
53  std::unique_ptr<weld::Label> m_xInner;
54  std::unique_ptr<weld::Label> m_xOuter;
55 
56  std::unique_ptr<weld::MetricSpinButton> m_xLeftMarginEdit;
57  std::unique_ptr<weld::MetricSpinButton> m_xRightMarginEdit;
58  std::unique_ptr<weld::MetricSpinButton> m_xTopMarginEdit;
59  std::unique_ptr<weld::MetricSpinButton> m_xBottomMarginEdit;
60 
61  // hidden metric field
62  std::unique_ptr<weld::MetricSpinButton> m_xWidthHeightField;
63 
65 
71 
73 
75 
82 
84 
85  DECL_LINK( SelectMarginHdl, weld::Button&, void );
86  DECL_LINK( ModifyLRMarginHdl, weld::MetricSpinButton&, void );
87  DECL_LINK( ModifyULMarginHdl, weld::MetricSpinButton&, void );
88 
89  static void ExecuteMarginLRChange(
90  const long nPageLeftMargin,
91  const long nPageRightMargin );
92  static void ExecuteMarginULChange(
93  const long nPageTopMargin,
94  const long nPageBottomMargin );
95  static void ExecutePageLayoutChange( const bool bMirrored );
96 
97  void SetMetricFieldMaxValues(const Size& rPageSize);
98 
99  bool GetUserCustomValues();
100  void StoreUserCustomValues();
101 
102  void FillHelpText( const bool bUserCustomValuesAvailable );
103 };
104 
105 } // end of namespace sw::sidebar
106 
107 #endif
108 
109 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::unique_ptr< weld::Button > m_xWide
void FillHelpText(const bool bUserCustomValuesAvailable)
std::unique_ptr< weld::Button > m_xMirrored
static void ExecutePageLayoutChange(const bool bMirrored)
std::unique_ptr< weld::Label > m_xRight
rtl::Reference< PageMarginPopup > m_xControl
std::unique_ptr< weld::MetricSpinButton > m_xLeftMarginEdit
virtual void GrabFocus() override
std::unique_ptr< weld::Button > m_xNormal
std::unique_ptr< weld::Label > m_xLeft
std::unique_ptr< weld::Button > m_xLast
PageMarginControl(PageMarginPopup *pControl, weld::Widget *pParent)
std::unique_ptr< weld::Label > m_xOuter
void SetMetricFieldMaxValues(const Size &rPageSize)
static void ExecuteMarginLRChange(const long nPageLeftMargin, const long nPageRightMargin)
static void ExecuteMarginULChange(const long nPageTopMargin, const long nPageBottomMargin)
DECL_LINK(SelectMarginHdl, weld::Button &, void)
std::unique_ptr< weld::Label > m_xInner
const long MINBODY
std::unique_ptr< weld::MetricSpinButton > m_xBottomMarginEdit
std::unique_ptr< weld::MetricSpinButton > m_xTopMarginEdit
std::unique_ptr< weld::Button > m_xNarrow
std::unique_ptr< weld::MetricSpinButton > m_xRightMarginEdit
MapUnit
std::unique_ptr< weld::MetricSpinButton > m_xWidthHeightField