Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 : #ifndef _BASEDLGS_HXX
20 : #define _BASEDLGS_HXX
21 :
22 : #include "sal/config.h"
23 : #include "sfx2/dllapi.h"
24 : #include "sal/types.h"
25 : #include <vcl/builder.hxx>
26 : #include <vcl/dialog.hxx>
27 : #include <vcl/floatwin.hxx>
28 : #include <vcl/timer.hxx>
29 :
30 : class TabPage;
31 : class SfxTabPage;
32 : class SfxBindings;
33 : class SfxChildWindow;
34 : struct SfxChildWinInfo;
35 : class SfxItemSet;
36 : class SfxItemPool;
37 : class OKButton;
38 : class CancelButton;
39 : class HelpButton;
40 : class Button;
41 : class FixedLine;
42 :
43 : //There is a hack which hides the HelpId for a Dialog in SfxModelessDialog
44 : //and SfxDockingWindow, where it is changed into a UniqueId and cleared
45 : //This reverses the clear of the HelpId
46 :
47 0 : SFX2_DLLPUBLIC inline void reverseUniqueHelpIdHack(Window &rWindow)
48 : {
49 0 : if (rWindow.GetHelpId().isEmpty())
50 0 : rWindow.SetHelpId(rWindow.GetUniqueId());
51 0 : }
52 :
53 : // class SfxModalDialog --------------------------------------------------
54 :
55 : class SFX2_DLLPUBLIC SfxModalDialog: public ModalDialog
56 : {
57 : sal_uInt32 nUniqId;
58 : String aExtraData;
59 : const SfxItemSet* pInputSet;
60 : SfxItemSet* pOutputSet;
61 :
62 : private:
63 : SAL_DLLPRIVATE SfxModalDialog(SfxModalDialog &); // not defined
64 : SAL_DLLPRIVATE void operator =(SfxModalDialog &); // not defined
65 :
66 : SAL_DLLPRIVATE void SetDialogData_Impl();
67 : SAL_DLLPRIVATE void GetDialogData_Impl();
68 : SAL_DLLPRIVATE void init();
69 :
70 : protected:
71 : SfxModalDialog(Window *pParent, const ResId& );
72 : SfxModalDialog(Window *pParent, const OString& rID, const OUString& rUIXMLDescription);
73 : SfxModalDialog(Window* pParent, sal_uInt32 nUniqueId, WinBits nWinStyle = WB_STDMODAL );
74 :
75 0 : String& GetExtraData() { return aExtraData; }
76 0 : sal_uInt32 GetUniqId() const { return nUniqId; }
77 0 : void SetUniqId(sal_uInt32 nSettingsId) { nUniqId = nSettingsId; }
78 0 : SfxItemSet* GetItemSet() { return pOutputSet; }
79 : void CreateOutputItemSet( SfxItemPool& rPool );
80 : void CreateOutputItemSet( const SfxItemSet& rInput );
81 0 : void SetInputSet( const SfxItemSet* pInSet ) { pInputSet = pInSet; }
82 0 : SfxItemSet* GetOutputSetImpl() { return pOutputSet; }
83 :
84 : public:
85 : ~SfxModalDialog();
86 0 : const SfxItemSet* GetOutputItemSet() const { return pOutputSet; }
87 0 : const SfxItemSet* GetInputItemSet() const { return pInputSet; }
88 : };
89 :
90 : // class SfxModelessDialog --------------------------------------------------
91 : class SfxModelessDialog_Impl;
92 : class SFX2_DLLPUBLIC SfxModelessDialog: public ModelessDialog
93 : {
94 : SfxBindings* pBindings;
95 : Size aSize;
96 : SfxModelessDialog_Impl* pImp;
97 :
98 : SAL_DLLPRIVATE SfxModelessDialog(SfxModelessDialog &); // not defined
99 : SAL_DLLPRIVATE void operator =(SfxModelessDialog &); // not defined
100 :
101 : void Init(SfxBindings *pBindinx, SfxChildWindow *pCW);
102 :
103 : protected:
104 : SfxModelessDialog( SfxBindings*, SfxChildWindow*,
105 : Window*, const ResId& );
106 : SfxModelessDialog( SfxBindings*, SfxChildWindow*,
107 : Window*, const OString& rID, const OUString& rUIXMLDescription );
108 : ~SfxModelessDialog();
109 : virtual sal_Bool Close();
110 : virtual void Resize();
111 : virtual void Move();
112 : virtual void StateChanged( StateChangedType nStateChange );
113 :
114 : public:
115 : virtual void FillInfo(SfxChildWinInfo&) const;
116 : void Initialize (SfxChildWinInfo* pInfo);
117 : virtual long Notify( NotifyEvent& rNEvt );
118 0 : SfxBindings& GetBindings()
119 0 : { return *pBindings; }
120 :
121 : DECL_LINK(TimerHdl, void *);
122 :
123 : };
124 :
125 : // class SfxFloatingWindow --------------------------------------------------
126 : class SfxFloatingWindow_Impl;
127 : class SFX2_DLLPUBLIC SfxFloatingWindow: public FloatingWindow
128 : {
129 : SfxBindings* pBindings;
130 : Size aSize;
131 : SfxFloatingWindow_Impl* pImp;
132 :
133 : SAL_DLLPRIVATE SfxFloatingWindow(SfxFloatingWindow &); // not defined
134 : SAL_DLLPRIVATE void operator =(SfxFloatingWindow &); // not defined
135 :
136 : protected:
137 : SfxFloatingWindow( SfxBindings *pBindings,
138 : SfxChildWindow *pCW,
139 : Window* pParent,
140 : WinBits nWinBits=WB_STDMODELESS);
141 : SfxFloatingWindow( SfxBindings *pBindings,
142 : SfxChildWindow *pCW,
143 : Window* pParent,
144 : const ResId& rResId);
145 : ~SfxFloatingWindow();
146 :
147 : virtual void StateChanged( StateChangedType nStateChange );
148 : virtual sal_Bool Close();
149 : virtual void Resize();
150 : virtual void Move();
151 : virtual long Notify( NotifyEvent& rNEvt );
152 13 : SfxBindings& GetBindings()
153 13 : { return *pBindings; }
154 :
155 : public:
156 : virtual void FillInfo(SfxChildWinInfo&) const;
157 : void Initialize (SfxChildWinInfo* pInfo);
158 :
159 : DECL_LINK(TimerHdl, void *);
160 :
161 : };
162 :
163 : // class SfxNoLayoutSingleTabDialog --------------------------------------------------
164 :
165 0 : struct SingleTabDlgImpl
166 : {
167 : SfxTabPage* m_pSfxPage;
168 : FixedLine* m_pLine;
169 : String m_sInfoURL;
170 : Link m_aInfoLink;
171 :
172 0 : SingleTabDlgImpl()
173 : : m_pSfxPage(NULL)
174 0 : , m_pLine(NULL)
175 : {
176 0 : }
177 : };
178 :
179 : typedef sal_uInt16* (*GetTabPageRanges)(); // liefert internationale Which-Werte
180 :
181 : class SFX2_DLLPUBLIC SfxSingleTabDialogBase : public SfxModalDialog
182 : {
183 : public:
184 : //layout ctor
185 : SfxSingleTabDialogBase(Window *pParent, const SfxItemSet& rOptionsSet,
186 : const OString& rID, const OUString& rUIXMLDescription);
187 :
188 : //non-layout ctors
189 : SfxSingleTabDialogBase( Window* pParent, const SfxItemSet& rOptionsSet, sal_uInt16 nUniqueId );
190 : SfxSingleTabDialogBase( Window* pParent, sal_uInt16 nUniqueId, const SfxItemSet* pInSet = 0 );
191 :
192 : virtual ~SfxSingleTabDialogBase();
193 :
194 0 : SfxTabPage* GetTabPage() const { return pImpl->m_pSfxPage; }
195 :
196 0 : OKButton* GetOKButton() const { return pOKBtn; }
197 : CancelButton* GetCancelButton() const { return pCancelBtn; }
198 :
199 : protected:
200 : GetTabPageRanges fnGetRanges;
201 :
202 : OKButton* pOKBtn;
203 : CancelButton* pCancelBtn;
204 : HelpButton* pHelpBtn;
205 :
206 : SingleTabDlgImpl* pImpl;
207 :
208 : DECL_DLLPRIVATE_LINK(OKHdl_Impl, void *);
209 : };
210 :
211 0 : class SFX2_DLLPUBLIC SfxSingleTabDialog : public SfxSingleTabDialogBase
212 : {
213 : public:
214 0 : SfxSingleTabDialog(Window *pParent, const SfxItemSet& rOptionsSet,
215 : const OString& rID = OString("SingleTabDialog"),
216 : const OUString& rUIXMLDescription = OUString("sfx/ui/singletabdialog.ui"))
217 0 : : SfxSingleTabDialogBase(pParent, rOptionsSet, rID, rUIXMLDescription)
218 : {
219 0 : }
220 : void setTabPage(SfxTabPage* pTabPage, GetTabPageRanges pRangesFunc = 0, sal_uInt32 nSettingsId = 0);
221 : };
222 :
223 : //Old school deprecated non-layout aware version
224 : class SFX2_DLLPUBLIC SfxNoLayoutSingleTabDialog : public SfxSingleTabDialogBase
225 : {
226 : public:
227 0 : SfxNoLayoutSingleTabDialog(Window* pParent, const SfxItemSet& rOptionsSet, sal_uInt16 nUniqueId)
228 0 : : SfxSingleTabDialogBase(pParent, rOptionsSet, nUniqueId)
229 : {
230 0 : }
231 0 : SfxNoLayoutSingleTabDialog(Window* pParent, sal_uInt16 nUniqueId, const SfxItemSet* pInSet = 0)
232 0 : : SfxSingleTabDialogBase(pParent, nUniqueId, pInSet)
233 : {
234 0 : }
235 : ~SfxNoLayoutSingleTabDialog();
236 : void SetTabPage(SfxTabPage* pTabPage, GetTabPageRanges pRangesFunc = 0);
237 : };
238 :
239 : #endif
240 :
241 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|