Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / sw / source / uibase / sidebar / PageMarginControl.hxx
blobaa199dd4adde7a0c4d11de5420865c0e95ea86cc
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_SW_SOURCE_UIBASE_SIDEBAR_PAGEMARGINCONTROL_HXX
20 #define INCLUDED_SW_SOURCE_UIBASE_SIDEBAR_PAGEMARGINCONTROL_HXX
22 #include <sal/config.h>
24 #include <o3tl/unit_conversion.hxx>
25 #include <svtools/toolbarmenu.hxx>
27 #define SWPAGE_NARROW_VALUE 720
28 #define SWPAGE_NORMAL_VALUE 1136
29 #define SWPAGE_WIDE_VALUE1 1440
30 #define SWPAGE_WIDE_VALUE2 2880
31 #define SWPAGE_WIDE_VALUE3 1800
33 // #i19922# - tdf#126051 see cui/source/tabpages/page.cxx and svx/source/dialog/hdft.cxx
34 constexpr tools::Long MINBODY = o3tl::toTwips(1, o3tl::Length::mm); // 1mm in twips rounded
36 class PageMarginPopup;
38 namespace sw::sidebar {
40 class PageMarginControl final : public WeldToolbarPopup
42 public:
43 explicit PageMarginControl(PageMarginPopup* pControl, weld::Widget* pParent);
44 virtual void GrabFocus() override;
45 virtual ~PageMarginControl() override;
47 private:
48 std::unique_ptr<weld::Button> m_xNarrow;
49 std::unique_ptr<weld::Button> m_xNormal;
50 std::unique_ptr<weld::Button> m_xWide;
51 std::unique_ptr<weld::Button> m_xMirrored;
52 std::unique_ptr<weld::Button> m_xLast;
54 std::unique_ptr<weld::Label> m_xLeft;
55 std::unique_ptr<weld::Label> m_xRight;
56 std::unique_ptr<weld::Label> m_xInner;
57 std::unique_ptr<weld::Label> m_xOuter;
59 std::unique_ptr<weld::MetricSpinButton> m_xLeftMarginEdit;
60 std::unique_ptr<weld::MetricSpinButton> m_xRightMarginEdit;
61 std::unique_ptr<weld::MetricSpinButton> m_xTopMarginEdit;
62 std::unique_ptr<weld::MetricSpinButton> m_xBottomMarginEdit;
64 // hidden metric field
65 std::unique_ptr<weld::MetricSpinButton> m_xWidthHeightField;
67 rtl::Reference<PageMarginPopup> m_xControl;
69 tools::Long m_nPageLeftMargin;
70 tools::Long m_nPageRightMargin;
71 tools::Long m_nPageTopMargin;
72 tools::Long m_nPageBottomMargin;
73 bool m_bMirrored;
75 const MapUnit m_eUnit;
77 Size m_aPageSize;
79 bool m_bUserCustomValuesAvailable;
80 tools::Long m_nUserCustomPageLeftMargin;
81 tools::Long m_nUserCustomPageRightMargin;
82 tools::Long m_nUserCustomPageTopMargin;
83 tools::Long m_nUserCustomPageBottomMargin;
84 bool m_bUserCustomMirrored;
86 bool m_bCustomValuesUsed;
88 DECL_LINK( SelectMarginHdl, weld::Button&, void );
89 DECL_LINK( ModifyLRMarginHdl, weld::MetricSpinButton&, void );
90 DECL_LINK( ModifyULMarginHdl, weld::MetricSpinButton&, void );
92 static void ExecuteMarginLRChange(
93 const tools::Long nPageLeftMargin,
94 const tools::Long nPageRightMargin );
95 static void ExecuteMarginULChange(
96 const tools::Long nPageTopMargin,
97 const tools::Long nPageBottomMargin );
98 static void ExecutePageLayoutChange( const bool bMirrored );
100 void SetMetricFieldMaxValues(const Size& rPageSize);
102 bool GetUserCustomValues();
103 void StoreUserCustomValues();
105 void FillHelpText( const bool bUserCustomValuesAvailable );
108 } // end of namespace sw::sidebar
110 #endif
112 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */