xref: /aoo41x/main/sw/source/ui/envelp/labfmt.hxx (revision 1d2dbeb0)
1*1d2dbeb0SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*1d2dbeb0SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*1d2dbeb0SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*1d2dbeb0SAndrew Rist  * distributed with this work for additional information
6*1d2dbeb0SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*1d2dbeb0SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*1d2dbeb0SAndrew Rist  * "License"); you may not use this file except in compliance
9*1d2dbeb0SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*1d2dbeb0SAndrew Rist  *
11*1d2dbeb0SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*1d2dbeb0SAndrew Rist  *
13*1d2dbeb0SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*1d2dbeb0SAndrew Rist  * software distributed under the License is distributed on an
15*1d2dbeb0SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*1d2dbeb0SAndrew Rist  * KIND, either express or implied.  See the License for the
17*1d2dbeb0SAndrew Rist  * specific language governing permissions and limitations
18*1d2dbeb0SAndrew Rist  * under the License.
19*1d2dbeb0SAndrew Rist  *
20*1d2dbeb0SAndrew Rist  *************************************************************/
21*1d2dbeb0SAndrew Rist 
22*1d2dbeb0SAndrew Rist 
23cdf0e10cSrcweir #ifndef _LABFMT_HXX
24cdf0e10cSrcweir #define _LABFMT_HXX
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include "swuilabimp.hxx"
27cdf0e10cSrcweir #include "labimg.hxx"
28cdf0e10cSrcweir #include <vcl/msgbox.hxx>
29cdf0e10cSrcweir class SwLabFmtPage;
30cdf0e10cSrcweir 
31cdf0e10cSrcweir // class SwLabPreview -------------------------------------------------------
32cdf0e10cSrcweir 
33cdf0e10cSrcweir class SwLabPreview : public Window
34cdf0e10cSrcweir {
35cdf0e10cSrcweir 	long lOutWPix;
36cdf0e10cSrcweir 	long lOutHPix;
37cdf0e10cSrcweir 	long lOutWPix23;
38cdf0e10cSrcweir 	long lOutHPix23;
39cdf0e10cSrcweir 
40cdf0e10cSrcweir     Color aGrayColor;
41cdf0e10cSrcweir 
42cdf0e10cSrcweir 	String aHDistStr;
43cdf0e10cSrcweir 	String aVDistStr;
44cdf0e10cSrcweir 	String aWidthStr;
45cdf0e10cSrcweir 	String aHeightStr;
46cdf0e10cSrcweir 	String aLeftStr;
47cdf0e10cSrcweir 	String aUpperStr;
48cdf0e10cSrcweir 	String aColsStr;
49cdf0e10cSrcweir 	String aRowsStr;
50cdf0e10cSrcweir 
51cdf0e10cSrcweir 	long lHDistWidth;
52cdf0e10cSrcweir 	long lVDistWidth;
53cdf0e10cSrcweir 	long lHeightWidth;
54cdf0e10cSrcweir 	long lLeftWidth;
55cdf0e10cSrcweir 	long lUpperWidth;
56cdf0e10cSrcweir 	long lColsWidth;
57cdf0e10cSrcweir 
58cdf0e10cSrcweir 	long lXWidth;
59cdf0e10cSrcweir 	long lXHeight;
60cdf0e10cSrcweir 
61cdf0e10cSrcweir 	SwLabItem aItem;
62cdf0e10cSrcweir 
63cdf0e10cSrcweir 	void Paint(const Rectangle&);
64cdf0e10cSrcweir 
65cdf0e10cSrcweir 	void DrawArrow(const Point& rP1, const Point& rP2, sal_Bool bArrow);
66cdf0e10cSrcweir 
67cdf0e10cSrcweir 	using Window::GetParent;
GetParent()68cdf0e10cSrcweir 	SwLabFmtPage* GetParent() {return (SwLabFmtPage*) Window::GetParent();}
69cdf0e10cSrcweir 
70cdf0e10cSrcweir     using Window::Update;
71cdf0e10cSrcweir 
72cdf0e10cSrcweir public:
73cdf0e10cSrcweir 
74cdf0e10cSrcweir 	 SwLabPreview(const SwLabFmtPage* pParent, const ResId& rResID);
75cdf0e10cSrcweir 	~SwLabPreview();
76cdf0e10cSrcweir 
77cdf0e10cSrcweir 	void Update(const SwLabItem& rItem);
78cdf0e10cSrcweir };
79cdf0e10cSrcweir 
80cdf0e10cSrcweir // class SwLabFmtPage -------------------------------------------------------
81cdf0e10cSrcweir 
82cdf0e10cSrcweir class SwLabFmtPage : public SfxTabPage
83cdf0e10cSrcweir {
84cdf0e10cSrcweir 	FixedInfo		aMakeFI;
85cdf0e10cSrcweir 	FixedInfo		aTypeFI;
86cdf0e10cSrcweir 	SwLabPreview aPreview;
87cdf0e10cSrcweir 	FixedText	 aHDistText;
88cdf0e10cSrcweir 	MetricField	 aHDistField;
89cdf0e10cSrcweir 	FixedText	 aVDistText;
90cdf0e10cSrcweir 	MetricField	 aVDistField;
91cdf0e10cSrcweir 	FixedText	 aWidthText;
92cdf0e10cSrcweir 	MetricField	 aWidthField;
93cdf0e10cSrcweir 	FixedText	 aHeightText;
94cdf0e10cSrcweir 	MetricField	 aHeightField;
95cdf0e10cSrcweir 	FixedText	 aLeftText;
96cdf0e10cSrcweir 	MetricField	 aLeftField;
97cdf0e10cSrcweir 	FixedText	 aUpperText;
98cdf0e10cSrcweir 	MetricField	 aUpperField;
99cdf0e10cSrcweir 	FixedText	 aColsText;
100cdf0e10cSrcweir 	NumericField aColsField;
101cdf0e10cSrcweir 	FixedText	 aRowsText;
102cdf0e10cSrcweir 	NumericField aRowsField;
103cdf0e10cSrcweir 	PushButton 	 aSavePB;
104cdf0e10cSrcweir 
105cdf0e10cSrcweir 	Timer aPreviewTimer;
106cdf0e10cSrcweir 	sal_Bool  bModified;
107cdf0e10cSrcweir 
108cdf0e10cSrcweir 	SwLabItem	 aItem;
109cdf0e10cSrcweir 
110cdf0e10cSrcweir 	 SwLabFmtPage(Window* pParent, const SfxItemSet& rSet);
111cdf0e10cSrcweir 	~SwLabFmtPage();
112cdf0e10cSrcweir 
113cdf0e10cSrcweir 	DECL_LINK( ModifyHdl, Edit * );
114cdf0e10cSrcweir 	DECL_LINK( PreviewHdl, Timer * );
115cdf0e10cSrcweir 	DECL_LINK( LoseFocusHdl, Control * );
116cdf0e10cSrcweir 	DECL_LINK( SaveHdl, PushButton* );
117cdf0e10cSrcweir 
118cdf0e10cSrcweir 	void ChangeMinMax();
119cdf0e10cSrcweir 
120cdf0e10cSrcweir     using TabPage::ActivatePage;
121cdf0e10cSrcweir     using TabPage::DeactivatePage;
122cdf0e10cSrcweir     using Window::GetParent;
123cdf0e10cSrcweir 
124cdf0e10cSrcweir public:
125cdf0e10cSrcweir 
126cdf0e10cSrcweir 	static SfxTabPage* Create(Window* pParent, const SfxItemSet& rSet);
127cdf0e10cSrcweir 
128cdf0e10cSrcweir 	virtual void ActivatePage(const SfxItemSet& rSet);
129cdf0e10cSrcweir 	virtual int  DeactivatePage(SfxItemSet* pSet = 0);
130cdf0e10cSrcweir 			void FillItem(SwLabItem& rItem);
131cdf0e10cSrcweir 	virtual sal_Bool FillItemSet(SfxItemSet& rSet);
132cdf0e10cSrcweir 	virtual void Reset(const SfxItemSet& rSet);
133cdf0e10cSrcweir 
GetParent()134cdf0e10cSrcweir 	SwLabDlg* GetParent() {return (SwLabDlg*) SfxTabPage::GetParent()->GetParent();}
135cdf0e10cSrcweir };
136cdf0e10cSrcweir /* -----------------------------23.01.01 10:26--------------------------------
137cdf0e10cSrcweir 
138cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
139cdf0e10cSrcweir class SwSaveLabelDlg : public ModalDialog
140cdf0e10cSrcweir {
141cdf0e10cSrcweir     FixedLine       aOptionsFL;
142cdf0e10cSrcweir 	FixedText		aMakeFT;
143cdf0e10cSrcweir 	ComboBox		aMakeCB;
144cdf0e10cSrcweir 	FixedText		aTypeFT;
145cdf0e10cSrcweir 	Edit			aTypeED;
146cdf0e10cSrcweir 
147cdf0e10cSrcweir 	OKButton		aOKPB;
148cdf0e10cSrcweir 	CancelButton	aCancelPB;
149cdf0e10cSrcweir 	HelpButton		aHelpPB;
150cdf0e10cSrcweir 
151cdf0e10cSrcweir 	QueryBox		aQueryMB;
152cdf0e10cSrcweir 
153cdf0e10cSrcweir 	sal_Bool 		bSuccess;
154cdf0e10cSrcweir 	SwLabFmtPage* 	pLabPage;
155cdf0e10cSrcweir 	SwLabRec&		rLabRec;
156cdf0e10cSrcweir 
157cdf0e10cSrcweir 	DECL_LINK(OkHdl, OKButton*);
158cdf0e10cSrcweir 	DECL_LINK(ModifyHdl, Edit*);
159cdf0e10cSrcweir 
160cdf0e10cSrcweir public:
161cdf0e10cSrcweir 	SwSaveLabelDlg(SwLabFmtPage* pParent, SwLabRec& rRec);
162cdf0e10cSrcweir 
SetLabel(const rtl::OUString & rMake,const rtl::OUString & rType)163cdf0e10cSrcweir 	void	SetLabel(const rtl::OUString& rMake, const rtl::OUString& rType)
164cdf0e10cSrcweir 		{
165cdf0e10cSrcweir 			aMakeCB.SetText(String(rMake));
166cdf0e10cSrcweir 			aTypeED.SetText(String(rType));
167cdf0e10cSrcweir 		}
168cdf0e10cSrcweir 	sal_Bool GetLabel(SwLabItem& rItem);
169cdf0e10cSrcweir };
170cdf0e10cSrcweir #endif
171cdf0e10cSrcweir 
172