1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef _SW_SIDEBAR_PAGE_MARGIN_CONTROL_HXX_ 25 #define _SW_SIDEBAR_PAGE_MARGIN_CONTROL_HXX_ 26 27 #include <svx/sidebar/PopupControl.hxx> 28 29 #include <tools/fldunit.hxx> 30 #include <svl/poolitem.hxx> 31 #include <svx/rulritem.hxx> 32 #include <unotools/viewoptions.hxx> 33 #include <vcl/fixed.hxx> 34 #include <vcl/field.hxx> 35 #include <svtools/unitconv.hxx> 36 #include <vector> 37 38 #define SWPAGE_NARROW_VALUE 720 39 #define SWPAGE_NORMAL_VALUE 1136 40 #define SWPAGE_WIDE_VALUE1 1440 41 #define SWPAGE_WIDE_VALUE2 2880 42 #define SWPAGE_WIDE_VALUE3 1800 43 44 45 namespace svx { namespace sidebar { 46 class ValueSetWithTextControl; 47 } } 48 49 static const long MINBODY = 284; //0.5 cm in twips 50 51 namespace sw { namespace sidebar { 52 53 class PagePropertyPanel; 54 55 56 class PageMarginControl 57 : public ::svx::sidebar::PopupControl 58 { 59 public: 60 PageMarginControl( 61 Window* pParent, 62 PagePropertyPanel& rPanel, 63 const SvxLongLRSpaceItem& aPageLRMargin, 64 const SvxLongULSpaceItem& aPageULMargin, 65 const bool bMirrored, 66 const Size aPageSize, 67 const sal_Bool bLandscape, 68 const FieldUnit eFUnit, 69 const SfxMapUnit eUnit ); 70 ~PageMarginControl(void); 71 72 private: 73 ::svx::sidebar::ValueSetWithTextControl* mpMarginValueSet; 74 75 FixedText maCustom; 76 FixedText maLeft; 77 FixedText maInner; 78 MetricField maLeftMarginEdit; 79 FixedText maRight; 80 FixedText maOuter; 81 MetricField maRightMarginEdit; 82 FixedText maTop; 83 MetricField maTopMarginEdit; 84 FixedText maBottom; 85 MetricField maBottomMarginEdit; 86 87 // hidden metric field 88 MetricField maWidthHeightField; 89 90 long mnPageLeftMargin; 91 long mnPageRightMargin; 92 long mnPageTopMargin; 93 long mnPageBottomMargin; 94 bool mbMirrored; 95 96 const SfxMapUnit meUnit; 97 98 bool mbUserCustomValuesAvailable; 99 long mnUserCustomPageLeftMargin; 100 long mnUserCustomPageRightMargin; 101 long mnUserCustomPageTopMargin; 102 long mnUserCustomPageBottomMargin; 103 bool mbUserCustomMirrored; 104 105 bool mbCustomValuesUsed; 106 107 PagePropertyPanel& mrPagePropPanel; 108 109 DECL_LINK( ImplMarginHdl, void* ); 110 DECL_LINK( ModifyLRMarginHdl, MetricField* ); 111 DECL_LINK( ModifyULMarginHdl, MetricField* ); 112 113 void SetMetricFieldMaxValues( const Size aPageSize ); 114 115 bool GetUserCustomValues(); 116 void StoreUserCustomValues(); 117 118 void FillValueSet( 119 const bool bLandscape, 120 const bool bUserCustomValuesAvailable ); 121 void SelectValueSetItem(); 122 }; 123 124 } } // end of namespace sw::sidebar 125 126 #endif 127 128 /* vim: set noet sw=4 ts=4: */ 129