xref: /trunk/main/sw/source/ui/inc/envlop.hxx (revision 1d2dbeb0)
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 _ENVLOP_HXX
24 #define _ENVLOP_HXX
25 
26 #ifndef _SV_MEDIT_HXX
27 #include <svtools/svmedit.hxx>
28 #endif
29 #include <sfx2/tabdlg.hxx>
30 
31 #ifndef _FIXED_HXX //autogen
32 #include <vcl/fixed.hxx>
33 #endif
34 
35 #ifndef _EDIT_HXX //autogen
36 #include <vcl/edit.hxx>
37 #endif
38 
39 #ifndef _LSTBOX_HXX //autogen
40 #include <vcl/lstbox.hxx>
41 #endif
42 
43 #ifndef _IMAGEBTN_HXX //autogen
44 #include <vcl/button.hxx>
45 #endif
46 
47 #include "envimg.hxx"
48 
49 #define GetFldVal(rField)         (rField).Denormalize((rField).GetValue(FUNIT_TWIP))
50 #define SetFldVal(rField, lValue) (rField).SetValue((rField).Normalize(lValue), FUNIT_TWIP)
51 
52 class SwEnvPage;
53 class SwEnvFmtPage;
54 class SwWrtShell;
55 class Printer;
56 
57 // class SwEnvPreview ---------------------------------------------------------
58 
59 class SwEnvPreview : public Window
60 {
61 	void Paint(const Rectangle&);
62 
63 public:
64 
65 	 SwEnvPreview(SfxTabPage* pParent, const ResId& rResID);
66 	~SwEnvPreview();
67 
68 protected:
69     virtual void DataChanged( const DataChangedEvent& rDCEvt );
70 };
71 
72 // class SwEnvDlg -----------------------------------------------------------
73 
74 class SwEnvDlg : public SfxTabDialog
75 {
76 friend class SwEnvPage;
77 friend class SwEnvFmtPage;
78 friend class SwEnvPrtPage;
79 friend class SwEnvPreview;
80 
81 	String			sInsert;
82 	String 			sChange;
83 	SwEnvItem		aEnvItem;
84 	SwWrtShell		*pSh;
85 	Printer			*pPrinter;
86 	SfxItemSet		*pAddresseeSet;
87 	SfxItemSet		*pSenderSet;
88 
89 	virtual void	PageCreated( sal_uInt16 nId, SfxTabPage &rPage );
90 	virtual short	Ok();
91 
92 public:
93 	 SwEnvDlg(Window* pParent, const SfxItemSet& rSet, SwWrtShell* pWrtSh, Printer* pPrt, sal_Bool bInsert);
94 	~SwEnvDlg();
95 };
96 
97 // class SwEnvPage ----------------------------------------------------------
98 
99 class SwEnvPage : public SfxTabPage
100 {
101 	FixedText     aAddrText;
102 	MultiLineEdit aAddrEdit;
103 	FixedText	  aDatabaseFT;
104 	ListBox 	  aDatabaseLB;
105 	FixedText	  aTableFT;
106 	ListBox 	  aTableLB;
107 	ImageButton   aInsertBT;
108 	FixedText	  aDBFieldFT;
109 	ListBox 	  aDBFieldLB;
110 	CheckBox      aSenderBox;
111 	MultiLineEdit aSenderEdit;
112 	SwEnvPreview  aPreview;
113 
114 	SwWrtShell*   pSh;
115 	String        sActDBName;
116 
117 	 SwEnvPage(Window* pParent, const SfxItemSet& rSet);
118 	~SwEnvPage();
119 
120 	DECL_LINK( DatabaseHdl, ListBox * );
121 	DECL_LINK( FieldHdl, Button * );
122 	DECL_LINK( SenderHdl, Button * );
123 
124 	void InitDatabaseBox();
125 
126 	using Window::GetParent;
GetParent()127 	SwEnvDlg* GetParent() {return (SwEnvDlg*) SfxTabPage::GetParent()->GetParent();}
128 
129     using SfxTabPage::ActivatePage;
130     using SfxTabPage::DeactivatePage;
131 
132 public:
133 
134 	static SfxTabPage* Create(Window* pParent, const SfxItemSet& rSet);
135 
136 	virtual void ActivatePage(const SfxItemSet& rSet);
137 	virtual int  DeactivatePage(SfxItemSet* pSet = 0);
138 			void FillItem(SwEnvItem& rItem);
139 	virtual sal_Bool FillItemSet(SfxItemSet& rSet);
140 	virtual void Reset(const SfxItemSet& rSet);
141 };
142 
143 #endif
144 
145 
146