update credits
[LibreOffice.git] / sw / source / ui / sidebar / PageMarginControl.hxx
blob1c6687c221e6c8023b5c9b6553cd227e81972870
1 /*
2 * This file is part of the LibreOffice project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 * This file incorporates work covered by the following license notice:
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 #ifndef _SW_SIDEBAR_PAGE_MARGIN_CONTROL_HXX_
19 #define _SW_SIDEBAR_PAGE_MARGIN_CONTROL_HXX_
21 #include <svx/sidebar/PopupControl.hxx>
23 #include <tools/fldunit.hxx>
24 #include <svl/poolitem.hxx>
25 #include <svx/rulritem.hxx>
26 #include <unotools/viewoptions.hxx>
27 #include <vcl/fixed.hxx>
28 #include <vcl/field.hxx>
29 #include <svtools/unitconv.hxx>
30 #include <vector>
32 #define SWPAGE_NARROW_VALUE 720
33 #define SWPAGE_NORMAL_VALUE 1136
34 #define SWPAGE_WIDE_VALUE1 1440
35 #define SWPAGE_WIDE_VALUE2 2880
36 #define SWPAGE_WIDE_VALUE3 1800
39 namespace svx { namespace sidebar {
40 class ValueSetWithTextControl;
41 } }
43 static const long MINBODY = 284; //0.5 cm in twips
45 namespace sw { namespace sidebar {
47 class PagePropertyPanel;
50 class PageMarginControl
51 : public ::svx::sidebar::PopupControl
53 public:
54 PageMarginControl(
55 Window* pParent,
56 PagePropertyPanel& rPanel,
57 const SvxLongLRSpaceItem& aPageLRMargin,
58 const SvxLongULSpaceItem& aPageULMargin,
59 const bool bMirrored,
60 const Size aPageSize,
61 const sal_Bool bLandscape,
62 const FieldUnit eFUnit,
63 const SfxMapUnit eUnit );
64 ~PageMarginControl(void);
66 private:
67 ::svx::sidebar::ValueSetWithTextControl* mpMarginValueSet;
69 FixedText maCustom;
70 FixedText maLeft;
71 FixedText maInner;
72 MetricField maLeftMarginEdit;
73 FixedText maRight;
74 FixedText maOuter;
75 MetricField maRightMarginEdit;
76 FixedText maTop;
77 MetricField maTopMarginEdit;
78 FixedText maBottom;
79 MetricField maBottomMarginEdit;
81 // hidden metric field
82 MetricField maWidthHeightField;
84 long mnPageLeftMargin;
85 long mnPageRightMargin;
86 long mnPageTopMargin;
87 long mnPageBottomMargin;
88 bool mbMirrored;
90 const SfxMapUnit meUnit;
92 bool mbUserCustomValuesAvailable;
93 long mnUserCustomPageLeftMargin;
94 long mnUserCustomPageRightMargin;
95 long mnUserCustomPageTopMargin;
96 long mnUserCustomPageBottomMargin;
97 bool mbUserCustomMirrored;
99 bool mbCustomValuesUsed;
101 PagePropertyPanel& mrPagePropPanel;
103 DECL_LINK( ImplMarginHdl, void* );
104 DECL_LINK( ModifyLRMarginHdl, MetricField* );
105 DECL_LINK( ModifyULMarginHdl, MetricField* );
107 void SetMetricFieldMaxValues( const Size aPageSize );
109 bool GetUserCustomValues();
110 void StoreUserCustomValues();
112 void FillValueSet(
113 const bool bLandscape,
114 const bool bUserCustomValuesAvailable );
115 void SelectValueSetItem();
118 } } // end of namespace sw::sidebar
120 #endif