xref: /trunk/main/sw/source/ui/envelp/labfmt.hxx (revision 1ecadb572e7010ff3b3382ad9bf179dbc6efadbb)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef _LABFMT_HXX
28 #define _LABFMT_HXX
29 
30 #include "swuilabimp.hxx"
31 #include "labimg.hxx"
32 #include <vcl/msgbox.hxx>
33 class SwLabFmtPage;
34 
35 // class SwLabPreview -------------------------------------------------------
36 
37 class SwLabPreview : public Window
38 {
39     long lOutWPix;
40     long lOutHPix;
41     long lOutWPix23;
42     long lOutHPix23;
43 
44     Color aGrayColor;
45 
46     String aHDistStr;
47     String aVDistStr;
48     String aWidthStr;
49     String aHeightStr;
50     String aLeftStr;
51     String aUpperStr;
52     String aColsStr;
53     String aRowsStr;
54 
55     long lHDistWidth;
56     long lVDistWidth;
57     long lHeightWidth;
58     long lLeftWidth;
59     long lUpperWidth;
60     long lColsWidth;
61 
62     long lXWidth;
63     long lXHeight;
64 
65     SwLabItem aItem;
66 
67     void Paint(const Rectangle&);
68 
69     void DrawArrow(const Point& rP1, const Point& rP2, sal_Bool bArrow);
70 
71     using Window::GetParent;
72     SwLabFmtPage* GetParent() {return (SwLabFmtPage*) Window::GetParent();}
73 
74     using Window::Update;
75 
76 public:
77 
78      SwLabPreview(const SwLabFmtPage* pParent, const ResId& rResID);
79     ~SwLabPreview();
80 
81     void Update(const SwLabItem& rItem);
82 };
83 
84 // class SwLabFmtPage -------------------------------------------------------
85 
86 class SwLabFmtPage : public SfxTabPage
87 {
88     FixedInfo       aMakeFI;
89     FixedInfo       aTypeFI;
90     SwLabPreview aPreview;
91     FixedText    aHDistText;
92     MetricField  aHDistField;
93     FixedText    aVDistText;
94     MetricField  aVDistField;
95     FixedText    aWidthText;
96     MetricField  aWidthField;
97     FixedText    aHeightText;
98     MetricField  aHeightField;
99     FixedText    aLeftText;
100     MetricField  aLeftField;
101     FixedText    aUpperText;
102     MetricField  aUpperField;
103     FixedText    aColsText;
104     NumericField aColsField;
105     FixedText    aRowsText;
106     NumericField aRowsField;
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 
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 
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