xref: /trunk/main/sfx2/inc/sfx2/basedlgs.hxx (revision 353d8f4d)
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 _BASEDLGS_HXX
24 #define _BASEDLGS_HXX
25 
26 #include "sal/config.h"
27 #include "sfx2/dllapi.h"
28 #include "sal/types.h"
29 #ifndef _FLOATWIN_HXX //autogen
30 #include <vcl/floatwin.hxx>
31 #endif
32 #include <vcl/timer.hxx>
33 #ifndef _DIALOG_HXX //autogen
34 #include <vcl/dialog.hxx>
35 #endif
36 
37 class TabPage;
38 class SfxTabPage;
39 class SfxBindings;
40 class SfxChildWindow;
41 struct SfxChildWinInfo;
42 class SfxItemSet;
43 class SfxItemPool;
44 class OKButton;
45 class CancelButton;
46 class HelpButton;
47 class Button;
48 class FixedLine;
49 
50 // class SfxModalDefParentHelper -----------------------------------------
51 
52 class SfxModalDefParentHelper
53 {
54 private:
55 	Window *pOld;
56 
57 public:
58 	SfxModalDefParentHelper(Window* pWindow);
59 	~SfxModalDefParentHelper();
60 };
61 
62 // class SfxModalDialog --------------------------------------------------
63 
64 class SFX2_DLLPUBLIC SfxModalDialog: public ModalDialog
65 {
66 	sal_uInt32				nUniqId;
67 	String					aExtraData;
68 	const SfxItemSet*		pInputSet;
69 	SfxItemSet*				pOutputSet;
70 
71 private:
72     SAL_DLLPRIVATE SfxModalDialog(SfxModalDialog &); // not defined
73     SAL_DLLPRIVATE void operator =(SfxModalDialog &); // not defined
74 
75     SAL_DLLPRIVATE void SetDialogData_Impl();
76     SAL_DLLPRIVATE void GetDialogData_Impl();
77     SAL_DLLPRIVATE void init();
78 
79 protected:
80 	SfxModalDialog(Window *pParent, const ResId& );
81 	SfxModalDialog(Window* pParent, sal_uInt32 nUniqueId, WinBits nWinStyle = WB_STDMODAL );
82 
GetExtraData()83 	String& 			GetExtraData()		{ return aExtraData; }
GetUniqId() const84 	sal_uInt32			GetUniqId() const	{ return nUniqId; }
GetItemSet()85 	SfxItemSet*			GetItemSet()		{ return pOutputSet; }
86 	void				CreateOutputItemSet( SfxItemPool& rPool );
87 	void				CreateOutputItemSet( const SfxItemSet& rInput );
SetInputSet(const SfxItemSet * pInSet)88 	void				SetInputSet( const SfxItemSet* pInSet ) { pInputSet = pInSet; }
GetOutputSetImpl()89 	SfxItemSet*			GetOutputSetImpl() { return pOutputSet; }
90 
91 public:
92 	~SfxModalDialog();
GetOutputItemSet() const93 	const SfxItemSet*	GetOutputItemSet() const { return pOutputSet; }
GetInputItemSet() const94 	const SfxItemSet*	GetInputItemSet() const { return pInputSet; }
95 };
96 
97 // class SfxModelessDialog --------------------------------------------------
98 class SfxModelessDialog_Impl;
99 class SFX2_DLLPUBLIC SfxModelessDialog: public ModelessDialog
100 {
101 	SfxBindings*			pBindings;
102 	Size					aSize;
103     SfxModelessDialog_Impl* pImp;
104 
105     SAL_DLLPRIVATE SfxModelessDialog(SfxModelessDialog &); // not defined
106     SAL_DLLPRIVATE void operator =(SfxModelessDialog &); // not defined
107 
108 protected:
109 							SfxModelessDialog( SfxBindings*, SfxChildWindow*,
110 								Window*, const ResId& );
111 							SfxModelessDialog( SfxBindings*, SfxChildWindow*,
112 								Window*, WinBits nWinStyle = WB_STDMODELESS );
113 							~SfxModelessDialog();
114 	virtual sal_Bool			Close();
115 	virtual void			Resize();
116     virtual void            Move();
117     virtual void            StateChanged( StateChangedType nStateChange );
118 
119 public:
120 	virtual void        	FillInfo(SfxChildWinInfo&) const;
121 	void					Initialize (SfxChildWinInfo* pInfo);
122 	virtual long			Notify( NotifyEvent& rNEvt );
GetBindings()123     SfxBindings&            GetBindings()
124                             { return *pBindings; }
125 
126     DECL_LINK( TimerHdl, Timer* );
127 
128 };
129 
130 // class SfxFloatingWindow --------------------------------------------------
131 class SfxFloatingWindow_Impl;
132 class SFX2_DLLPUBLIC SfxFloatingWindow: public FloatingWindow
133 {
134 	SfxBindings*			pBindings;
135 	Size					aSize;
136     SfxFloatingWindow_Impl* pImp;
137 
138     SAL_DLLPRIVATE SfxFloatingWindow(SfxFloatingWindow &); // not defined
139     SAL_DLLPRIVATE void operator =(SfxFloatingWindow &); // not defined
140 
141 protected:
142 							SfxFloatingWindow( SfxBindings *pBindings,
143 											  SfxChildWindow *pCW,
144 											  Window* pParent,
145 											  WinBits nWinBits=WB_STDMODELESS);
146 							SfxFloatingWindow( SfxBindings *pBindings,
147 											  SfxChildWindow *pCW,
148 											  Window* pParent,
149 											  const ResId& rResId);
150 							~SfxFloatingWindow();
151 
152     virtual void            StateChanged( StateChangedType nStateChange );
153 	virtual sal_Bool			Close();
154 	virtual void			Resize();
155     virtual void            Move();
156 	virtual long			Notify( NotifyEvent& rNEvt );
GetBindings()157     SfxBindings&            GetBindings()
158                             { return *pBindings; }
159 
160 public:
161 	virtual void        	FillInfo(SfxChildWinInfo&) const;
162 	void					Initialize (SfxChildWinInfo* pInfo);
163 
164     DECL_LINK( TimerHdl, Timer* );
165 
166 };
167 
168 // class SfxSingleTabDialog --------------------------------------------------
169 
170 namespace svt { class FixedHyperlinkImage; }
171 
172 struct SingleTabDlgImpl
173 {
174     TabPage*                    m_pTabPage;
175     SfxTabPage*                 m_pSfxPage;
176     FixedLine*                  m_pLine;
177     ::svt::FixedHyperlinkImage* m_pInfoImage;
178     String                      m_sInfoURL;
179     Link                        m_aInfoLink;
180 
SingleTabDlgImplSingleTabDlgImpl181     SingleTabDlgImpl() :
182         m_pTabPage( NULL ), m_pSfxPage( NULL ), m_pLine( NULL ), m_pInfoImage( NULL ) {}
183 };
184 
185 typedef sal_uInt16* (*GetTabPageRanges)(); // liefert internationale Which-Werte
186 
187 class SFX2_DLLPUBLIC SfxSingleTabDialog : public SfxModalDialog
188 {
189 public:
190 	SfxSingleTabDialog( Window* pParent, const SfxItemSet& rOptionsSet, sal_uInt16 nUniqueId );
191     SfxSingleTabDialog( Window* pParent, sal_uInt16 nUniqueId, const SfxItemSet* pInSet = 0 );
192     SfxSingleTabDialog( Window* pParent, sal_uInt16 nUniqueId, const String& rInfoURL );
193 
194 	virtual             ~SfxSingleTabDialog();
195 
196     void                SetPage( TabPage* pNewPage );
197     void                SetTabPage( SfxTabPage* pTabPage, GetTabPageRanges pRangesFunc = 0 );
GetTabPage() const198     SfxTabPage*         GetTabPage() const { return pImpl->m_pSfxPage; }
199 
200 	const sal_uInt16*		GetInputRanges( const SfxItemPool& rPool );
201 //	void				SetInputSet( const SfxItemSet* pInSet ) { pOptions = pInSet; }
202 //	const SfxItemSet*	GetOutputItemSet() const { return pOutSet; }
GetOKButton() const203 	OKButton*			GetOKButton() const { return pOKBtn; }
GetCancelButton() const204 	CancelButton*		GetCancelButton() const { return pCancelBtn; }
205     void                SetInfoLink( const Link& rLink );
206 
207 private:
208     GetTabPageRanges    fnGetRanges;
209 	sal_uInt16*				pRanges;
210 
211 	OKButton*			pOKBtn;
212 	CancelButton*		pCancelBtn;
213 	HelpButton*			pHelpBtn;
214 
215     SingleTabDlgImpl*   pImpl;
216 //	const SfxItemSet*	pOptions;
217 //	SfxItemSet*			pOutSet;
218 
219 	DECL_DLLPRIVATE_LINK( OKHdl_Impl, Button * );
220 };
221 
222 #endif
223 
224