xref: /aoo41x/main/sw/source/ui/envelp/labfmt.hxx (revision 1d2dbeb0)
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 #ifndef _LABFMT_HXX
24 #define _LABFMT_HXX
25 
26 #include "swuilabimp.hxx"
27 #include "labimg.hxx"
28 #include <vcl/msgbox.hxx>
29 class SwLabFmtPage;
30 
31 // class SwLabPreview -------------------------------------------------------
32 
33 class SwLabPreview : public Window
34 {
35 	long lOutWPix;
36 	long lOutHPix;
37 	long lOutWPix23;
38 	long lOutHPix23;
39 
40     Color aGrayColor;
41 
42 	String aHDistStr;
43 	String aVDistStr;
44 	String aWidthStr;
45 	String aHeightStr;
46 	String aLeftStr;
47 	String aUpperStr;
48 	String aColsStr;
49 	String aRowsStr;
50 
51 	long lHDistWidth;
52 	long lVDistWidth;
53 	long lHeightWidth;
54 	long lLeftWidth;
55 	long lUpperWidth;
56 	long lColsWidth;
57 
58 	long lXWidth;
59 	long lXHeight;
60 
61 	SwLabItem aItem;
62 
63 	void Paint(const Rectangle&);
64 
65 	void DrawArrow(const Point& rP1, const Point& rP2, sal_Bool bArrow);
66 
67 	using Window::GetParent;
GetParent()68 	SwLabFmtPage* GetParent() {return (SwLabFmtPage*) Window::GetParent();}
69 
70     using Window::Update;
71 
72 public:
73 
74 	 SwLabPreview(const SwLabFmtPage* pParent, const ResId& rResID);
75 	~SwLabPreview();
76 
77 	void Update(const SwLabItem& rItem);
78 };
79 
80 // class SwLabFmtPage -------------------------------------------------------
81 
82 class SwLabFmtPage : public SfxTabPage
83 {
84 	FixedInfo		aMakeFI;
85 	FixedInfo		aTypeFI;
86 	SwLabPreview aPreview;
87 	FixedText	 aHDistText;
88 	MetricField	 aHDistField;
89 	FixedText	 aVDistText;
90 	MetricField	 aVDistField;
91 	FixedText	 aWidthText;
92 	MetricField	 aWidthField;
93 	FixedText	 aHeightText;
94 	MetricField	 aHeightField;
95 	FixedText	 aLeftText;
96 	MetricField	 aLeftField;
97 	FixedText	 aUpperText;
98 	MetricField	 aUpperField;
99 	FixedText	 aColsText;
100 	NumericField aColsField;
101 	FixedText	 aRowsText;
102 	NumericField aRowsField;
103 	PushButton 	 aSavePB;
104 
105 	Timer aPreviewTimer;
106 	sal_Bool  bModified;
107 
108 	SwLabItem	 aItem;
109 
110 	 SwLabFmtPage(Window* pParent, const SfxItemSet& rSet);
111 	~SwLabFmtPage();
112 
113 	DECL_LINK( ModifyHdl, Edit * );
114 	DECL_LINK( PreviewHdl, Timer * );
115 	DECL_LINK( LoseFocusHdl, Control * );
116 	DECL_LINK( SaveHdl, PushButton* );
117 
118 	void ChangeMinMax();
119 
120     using TabPage::ActivatePage;
121     using TabPage::DeactivatePage;
122     using Window::GetParent;
123 
124 public:
125 
126 	static SfxTabPage* Create(Window* pParent, const SfxItemSet& rSet);
127 
128 	virtual void ActivatePage(const SfxItemSet& rSet);
129 	virtual int  DeactivatePage(SfxItemSet* pSet = 0);
130 			void FillItem(SwLabItem& rItem);
131 	virtual sal_Bool FillItemSet(SfxItemSet& rSet);
132 	virtual void Reset(const SfxItemSet& rSet);
133 
GetParent()134 	SwLabDlg* GetParent() {return (SwLabDlg*) SfxTabPage::GetParent()->GetParent();}
135 };
136 /* -----------------------------23.01.01 10:26--------------------------------
137 
138  ---------------------------------------------------------------------------*/
139 class SwSaveLabelDlg : public ModalDialog
140 {
141     FixedLine       aOptionsFL;
142 	FixedText		aMakeFT;
143 	ComboBox		aMakeCB;
144 	FixedText		aTypeFT;
145 	Edit			aTypeED;
146 
147 	OKButton		aOKPB;
148 	CancelButton	aCancelPB;
149 	HelpButton		aHelpPB;
150 
151 	QueryBox		aQueryMB;
152 
153 	sal_Bool 		bSuccess;
154 	SwLabFmtPage* 	pLabPage;
155 	SwLabRec&		rLabRec;
156 
157 	DECL_LINK(OkHdl, OKButton*);
158 	DECL_LINK(ModifyHdl, Edit*);
159 
160 public:
161 	SwSaveLabelDlg(SwLabFmtPage* pParent, SwLabRec& rRec);
162 
SetLabel(const rtl::OUString & rMake,const rtl::OUString & rType)163 	void	SetLabel(const rtl::OUString& rMake, const rtl::OUString& rType)
164 		{
165 			aMakeCB.SetText(String(rMake));
166 			aTypeED.SetText(String(rType));
167 		}
168 	sal_Bool GetLabel(SwLabItem& rItem);
169 };
170 #endif
171 
172