xref: /aoo42x/main/sw/source/ui/envelp/labfmt.hxx (revision cdf0e10c)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir #ifndef _LABFMT_HXX
28*cdf0e10cSrcweir #define _LABFMT_HXX
29*cdf0e10cSrcweir 
30*cdf0e10cSrcweir #include "swuilabimp.hxx"
31*cdf0e10cSrcweir #include "labimg.hxx"
32*cdf0e10cSrcweir #include <vcl/msgbox.hxx>
33*cdf0e10cSrcweir class SwLabFmtPage;
34*cdf0e10cSrcweir 
35*cdf0e10cSrcweir // class SwLabPreview -------------------------------------------------------
36*cdf0e10cSrcweir 
37*cdf0e10cSrcweir class SwLabPreview : public Window
38*cdf0e10cSrcweir {
39*cdf0e10cSrcweir 	long lOutWPix;
40*cdf0e10cSrcweir 	long lOutHPix;
41*cdf0e10cSrcweir 	long lOutWPix23;
42*cdf0e10cSrcweir 	long lOutHPix23;
43*cdf0e10cSrcweir 
44*cdf0e10cSrcweir     Color aGrayColor;
45*cdf0e10cSrcweir 
46*cdf0e10cSrcweir 	String aHDistStr;
47*cdf0e10cSrcweir 	String aVDistStr;
48*cdf0e10cSrcweir 	String aWidthStr;
49*cdf0e10cSrcweir 	String aHeightStr;
50*cdf0e10cSrcweir 	String aLeftStr;
51*cdf0e10cSrcweir 	String aUpperStr;
52*cdf0e10cSrcweir 	String aColsStr;
53*cdf0e10cSrcweir 	String aRowsStr;
54*cdf0e10cSrcweir 
55*cdf0e10cSrcweir 	long lHDistWidth;
56*cdf0e10cSrcweir 	long lVDistWidth;
57*cdf0e10cSrcweir 	long lHeightWidth;
58*cdf0e10cSrcweir 	long lLeftWidth;
59*cdf0e10cSrcweir 	long lUpperWidth;
60*cdf0e10cSrcweir 	long lColsWidth;
61*cdf0e10cSrcweir 
62*cdf0e10cSrcweir 	long lXWidth;
63*cdf0e10cSrcweir 	long lXHeight;
64*cdf0e10cSrcweir 
65*cdf0e10cSrcweir 	SwLabItem aItem;
66*cdf0e10cSrcweir 
67*cdf0e10cSrcweir 	void Paint(const Rectangle&);
68*cdf0e10cSrcweir 
69*cdf0e10cSrcweir 	void DrawArrow(const Point& rP1, const Point& rP2, sal_Bool bArrow);
70*cdf0e10cSrcweir 
71*cdf0e10cSrcweir 	using Window::GetParent;
72*cdf0e10cSrcweir 	SwLabFmtPage* GetParent() {return (SwLabFmtPage*) Window::GetParent();}
73*cdf0e10cSrcweir 
74*cdf0e10cSrcweir     using Window::Update;
75*cdf0e10cSrcweir 
76*cdf0e10cSrcweir public:
77*cdf0e10cSrcweir 
78*cdf0e10cSrcweir 	 SwLabPreview(const SwLabFmtPage* pParent, const ResId& rResID);
79*cdf0e10cSrcweir 	~SwLabPreview();
80*cdf0e10cSrcweir 
81*cdf0e10cSrcweir 	void Update(const SwLabItem& rItem);
82*cdf0e10cSrcweir };
83*cdf0e10cSrcweir 
84*cdf0e10cSrcweir // class SwLabFmtPage -------------------------------------------------------
85*cdf0e10cSrcweir 
86*cdf0e10cSrcweir class SwLabFmtPage : public SfxTabPage
87*cdf0e10cSrcweir {
88*cdf0e10cSrcweir 	FixedInfo		aMakeFI;
89*cdf0e10cSrcweir 	FixedInfo		aTypeFI;
90*cdf0e10cSrcweir 	SwLabPreview aPreview;
91*cdf0e10cSrcweir 	FixedText	 aHDistText;
92*cdf0e10cSrcweir 	MetricField	 aHDistField;
93*cdf0e10cSrcweir 	FixedText	 aVDistText;
94*cdf0e10cSrcweir 	MetricField	 aVDistField;
95*cdf0e10cSrcweir 	FixedText	 aWidthText;
96*cdf0e10cSrcweir 	MetricField	 aWidthField;
97*cdf0e10cSrcweir 	FixedText	 aHeightText;
98*cdf0e10cSrcweir 	MetricField	 aHeightField;
99*cdf0e10cSrcweir 	FixedText	 aLeftText;
100*cdf0e10cSrcweir 	MetricField	 aLeftField;
101*cdf0e10cSrcweir 	FixedText	 aUpperText;
102*cdf0e10cSrcweir 	MetricField	 aUpperField;
103*cdf0e10cSrcweir 	FixedText	 aColsText;
104*cdf0e10cSrcweir 	NumericField aColsField;
105*cdf0e10cSrcweir 	FixedText	 aRowsText;
106*cdf0e10cSrcweir 	NumericField aRowsField;
107*cdf0e10cSrcweir 	PushButton 	 aSavePB;
108*cdf0e10cSrcweir 
109*cdf0e10cSrcweir 	Timer aPreviewTimer;
110*cdf0e10cSrcweir 	sal_Bool  bModified;
111*cdf0e10cSrcweir 
112*cdf0e10cSrcweir 	SwLabItem	 aItem;
113*cdf0e10cSrcweir 
114*cdf0e10cSrcweir 	 SwLabFmtPage(Window* pParent, const SfxItemSet& rSet);
115*cdf0e10cSrcweir 	~SwLabFmtPage();
116*cdf0e10cSrcweir 
117*cdf0e10cSrcweir 	DECL_LINK( ModifyHdl, Edit * );
118*cdf0e10cSrcweir 	DECL_LINK( PreviewHdl, Timer * );
119*cdf0e10cSrcweir 	DECL_LINK( LoseFocusHdl, Control * );
120*cdf0e10cSrcweir 	DECL_LINK( SaveHdl, PushButton* );
121*cdf0e10cSrcweir 
122*cdf0e10cSrcweir 	void ChangeMinMax();
123*cdf0e10cSrcweir 
124*cdf0e10cSrcweir     using TabPage::ActivatePage;
125*cdf0e10cSrcweir     using TabPage::DeactivatePage;
126*cdf0e10cSrcweir     using Window::GetParent;
127*cdf0e10cSrcweir 
128*cdf0e10cSrcweir public:
129*cdf0e10cSrcweir 
130*cdf0e10cSrcweir 	static SfxTabPage* Create(Window* pParent, const SfxItemSet& rSet);
131*cdf0e10cSrcweir 
132*cdf0e10cSrcweir 	virtual void ActivatePage(const SfxItemSet& rSet);
133*cdf0e10cSrcweir 	virtual int  DeactivatePage(SfxItemSet* pSet = 0);
134*cdf0e10cSrcweir 			void FillItem(SwLabItem& rItem);
135*cdf0e10cSrcweir 	virtual sal_Bool FillItemSet(SfxItemSet& rSet);
136*cdf0e10cSrcweir 	virtual void Reset(const SfxItemSet& rSet);
137*cdf0e10cSrcweir 
138*cdf0e10cSrcweir 	SwLabDlg* GetParent() {return (SwLabDlg*) SfxTabPage::GetParent()->GetParent();}
139*cdf0e10cSrcweir };
140*cdf0e10cSrcweir /* -----------------------------23.01.01 10:26--------------------------------
141*cdf0e10cSrcweir 
142*cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
143*cdf0e10cSrcweir class SwSaveLabelDlg : public ModalDialog
144*cdf0e10cSrcweir {
145*cdf0e10cSrcweir     FixedLine       aOptionsFL;
146*cdf0e10cSrcweir 	FixedText		aMakeFT;
147*cdf0e10cSrcweir 	ComboBox		aMakeCB;
148*cdf0e10cSrcweir 	FixedText		aTypeFT;
149*cdf0e10cSrcweir 	Edit			aTypeED;
150*cdf0e10cSrcweir 
151*cdf0e10cSrcweir 	OKButton		aOKPB;
152*cdf0e10cSrcweir 	CancelButton	aCancelPB;
153*cdf0e10cSrcweir 	HelpButton		aHelpPB;
154*cdf0e10cSrcweir 
155*cdf0e10cSrcweir 	QueryBox		aQueryMB;
156*cdf0e10cSrcweir 
157*cdf0e10cSrcweir 	sal_Bool 		bSuccess;
158*cdf0e10cSrcweir 	SwLabFmtPage* 	pLabPage;
159*cdf0e10cSrcweir 	SwLabRec&		rLabRec;
160*cdf0e10cSrcweir 
161*cdf0e10cSrcweir 	DECL_LINK(OkHdl, OKButton*);
162*cdf0e10cSrcweir 	DECL_LINK(ModifyHdl, Edit*);
163*cdf0e10cSrcweir 
164*cdf0e10cSrcweir public:
165*cdf0e10cSrcweir 	SwSaveLabelDlg(SwLabFmtPage* pParent, SwLabRec& rRec);
166*cdf0e10cSrcweir 
167*cdf0e10cSrcweir 	void	SetLabel(const rtl::OUString& rMake, const rtl::OUString& rType)
168*cdf0e10cSrcweir 		{
169*cdf0e10cSrcweir 			aMakeCB.SetText(String(rMake));
170*cdf0e10cSrcweir 			aTypeED.SetText(String(rType));
171*cdf0e10cSrcweir 		}
172*cdf0e10cSrcweir 	sal_Bool GetLabel(SwLabItem& rItem);
173*cdf0e10cSrcweir };
174*cdf0e10cSrcweir #endif
175*cdf0e10cSrcweir 
176