xref: /trunk/main/sw/source/ui/envelp/labfmt.hxx (revision 914d351e5f5b84e4342a86d6ab8d4aca7308b9bd)
11d2dbeb0SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
31d2dbeb0SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
41d2dbeb0SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
51d2dbeb0SAndrew Rist  * distributed with this work for additional information
61d2dbeb0SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
71d2dbeb0SAndrew Rist  * to you under the Apache License, Version 2.0 (the
81d2dbeb0SAndrew Rist  * "License"); you may not use this file except in compliance
91d2dbeb0SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
111d2dbeb0SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
131d2dbeb0SAndrew Rist  * Unless required by applicable law or agreed to in writing,
141d2dbeb0SAndrew Rist  * software distributed under the License is distributed on an
151d2dbeb0SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
161d2dbeb0SAndrew Rist  * KIND, either express or implied.  See the License for the
171d2dbeb0SAndrew Rist  * specific language governing permissions and limitations
181d2dbeb0SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
201d2dbeb0SAndrew Rist  *************************************************************/
211d2dbeb0SAndrew Rist 
221d2dbeb0SAndrew 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;
103*737f4475STsutomu Uchino     FixedText    aPaperWidthText;
104*737f4475STsutomu Uchino     MetricField  aPaperWidthField;
105*737f4475STsutomu Uchino     FixedText    aPaperHeightText;
106*737f4475STsutomu Uchino     MetricField  aPaperHeightField;
107cdf0e10cSrcweir     PushButton   aSavePB;
108cdf0e10cSrcweir 
109cdf0e10cSrcweir     Timer aPreviewTimer;
110cdf0e10cSrcweir     sal_Bool  bModified;
111cdf0e10cSrcweir 
112cdf0e10cSrcweir     SwLabItem    aItem;
113cdf0e10cSrcweir 
114cdf0e10cSrcweir      SwLabFmtPage(Window* pParent, const SfxItemSet& rSet);
115cdf0e10cSrcweir     ~SwLabFmtPage();
116cdf0e10cSrcweir 
117cdf0e10cSrcweir     DECL_LINK( ModifyHdl, Edit * );
118cdf0e10cSrcweir     DECL_LINK( PreviewHdl, Timer * );
119cdf0e10cSrcweir     DECL_LINK( LoseFocusHdl, Control * );
120cdf0e10cSrcweir     DECL_LINK( SaveHdl, PushButton* );
121cdf0e10cSrcweir 
122cdf0e10cSrcweir     void ChangeMinMax();
123cdf0e10cSrcweir 
124cdf0e10cSrcweir     using TabPage::ActivatePage;
125cdf0e10cSrcweir     using TabPage::DeactivatePage;
126cdf0e10cSrcweir     using Window::GetParent;
127cdf0e10cSrcweir 
128cdf0e10cSrcweir public:
129cdf0e10cSrcweir 
130cdf0e10cSrcweir     static SfxTabPage* Create(Window* pParent, const SfxItemSet& rSet);
131cdf0e10cSrcweir 
132cdf0e10cSrcweir     virtual void ActivatePage(const SfxItemSet& rSet);
133cdf0e10cSrcweir     virtual int  DeactivatePage(SfxItemSet* pSet = 0);
134cdf0e10cSrcweir             void FillItem(SwLabItem& rItem);
135cdf0e10cSrcweir     virtual sal_Bool FillItemSet(SfxItemSet& rSet);
136cdf0e10cSrcweir     virtual void Reset(const SfxItemSet& rSet);
137cdf0e10cSrcweir 
GetParent()138cdf0e10cSrcweir     SwLabDlg* GetParent() {return (SwLabDlg*) SfxTabPage::GetParent()->GetParent();}
139cdf0e10cSrcweir };
140cdf0e10cSrcweir /* -----------------------------23.01.01 10:26--------------------------------
141cdf0e10cSrcweir 
142cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
143cdf0e10cSrcweir class SwSaveLabelDlg : public ModalDialog
144cdf0e10cSrcweir {
145cdf0e10cSrcweir     FixedLine       aOptionsFL;
146cdf0e10cSrcweir     FixedText       aMakeFT;
147cdf0e10cSrcweir     ComboBox        aMakeCB;
148cdf0e10cSrcweir     FixedText       aTypeFT;
149cdf0e10cSrcweir     Edit            aTypeED;
150cdf0e10cSrcweir 
151cdf0e10cSrcweir     OKButton        aOKPB;
152cdf0e10cSrcweir     CancelButton    aCancelPB;
153cdf0e10cSrcweir     HelpButton      aHelpPB;
154cdf0e10cSrcweir 
155cdf0e10cSrcweir     QueryBox        aQueryMB;
156cdf0e10cSrcweir 
157cdf0e10cSrcweir     sal_Bool        bSuccess;
158cdf0e10cSrcweir     SwLabFmtPage*   pLabPage;
159cdf0e10cSrcweir     SwLabRec&       rLabRec;
160cdf0e10cSrcweir 
161cdf0e10cSrcweir     DECL_LINK(OkHdl, OKButton*);
162cdf0e10cSrcweir     DECL_LINK(ModifyHdl, Edit*);
163cdf0e10cSrcweir 
164cdf0e10cSrcweir public:
165cdf0e10cSrcweir     SwSaveLabelDlg(SwLabFmtPage* pParent, SwLabRec& rRec);
166cdf0e10cSrcweir 
SetLabel(const rtl::OUString & rMake,const rtl::OUString & rType)167cdf0e10cSrcweir     void    SetLabel(const rtl::OUString& rMake, const rtl::OUString& rType)
168cdf0e10cSrcweir         {
169cdf0e10cSrcweir             aMakeCB.SetText(String(rMake));
170cdf0e10cSrcweir             aTypeED.SetText(String(rType));
171cdf0e10cSrcweir         }
172cdf0e10cSrcweir     sal_Bool GetLabel(SwLabItem& rItem);
173cdf0e10cSrcweir };
174cdf0e10cSrcweir #endif
175