xref: /trunk/main/sw/source/ui/envelp/labfmt.hxx (revision 737f4475)
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 	FixedText    aPaperWidthText;
104 	MetricField  aPaperWidthField;
105 	FixedText    aPaperHeightText;
106 	MetricField  aPaperHeightField;
107 	PushButton 	 aSavePB;
108 
109 	Timer aPreviewTimer;
110 	sal_Bool  bModified;
111 
112 	SwLabItem	 aItem;
113 
114 	 SwLabFmtPage(Window* pParent, const SfxItemSet& rSet);
115 	~SwLabFmtPage();
116 
117 	DECL_LINK( ModifyHdl, Edit * );
118 	DECL_LINK( PreviewHdl, Timer * );
119 	DECL_LINK( LoseFocusHdl, Control * );
120 	DECL_LINK( SaveHdl, PushButton* );
121 
122 	void ChangeMinMax();
123 
124     using TabPage::ActivatePage;
125     using TabPage::DeactivatePage;
126     using Window::GetParent;
127 
128 public:
129 
130 	static SfxTabPage* Create(Window* pParent, const SfxItemSet& rSet);
131 
132 	virtual void ActivatePage(const SfxItemSet& rSet);
133 	virtual int  DeactivatePage(SfxItemSet* pSet = 0);
134 			void FillItem(SwLabItem& rItem);
135 	virtual sal_Bool FillItemSet(SfxItemSet& rSet);
136 	virtual void Reset(const SfxItemSet& rSet);
137 
GetParent()138 	SwLabDlg* GetParent() {return (SwLabDlg*) SfxTabPage::GetParent()->GetParent();}
139 };
140 /* -----------------------------23.01.01 10:26--------------------------------
141 
142  ---------------------------------------------------------------------------*/
143 class SwSaveLabelDlg : public ModalDialog
144 {
145     FixedLine       aOptionsFL;
146 	FixedText		aMakeFT;
147 	ComboBox		aMakeCB;
148 	FixedText		aTypeFT;
149 	Edit			aTypeED;
150 
151 	OKButton		aOKPB;
152 	CancelButton	aCancelPB;
153 	HelpButton		aHelpPB;
154 
155 	QueryBox		aQueryMB;
156 
157 	sal_Bool 		bSuccess;
158 	SwLabFmtPage* 	pLabPage;
159 	SwLabRec&		rLabRec;
160 
161 	DECL_LINK(OkHdl, OKButton*);
162 	DECL_LINK(ModifyHdl, Edit*);
163 
164 public:
165 	SwSaveLabelDlg(SwLabFmtPage* pParent, SwLabRec& rRec);
166 
SetLabel(const rtl::OUString & rMake,const rtl::OUString & rType)167 	void	SetLabel(const rtl::OUString& rMake, const rtl::OUString& rType)
168 		{
169 			aMakeCB.SetText(String(rMake));
170 			aTypeED.SetText(String(rType));
171 		}
172 	sal_Bool GetLabel(SwLabItem& rItem);
173 };
174 #endif
175 
176