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