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 INCLUDED_SFX2_BASEDLGS_HXX
20 : #define INCLUDED_SFX2_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 : OUString 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 :
74 0 : OUString& GetExtraData() { return aExtraData; }
75 0 : sal_uInt32 GetUniqId() const { return nUniqId; }
76 0 : void SetUniqId(sal_uInt32 nSettingsId) { nUniqId = nSettingsId; }
77 0 : SfxItemSet* GetItemSet() { return pOutputSet; }
78 : void CreateOutputItemSet( SfxItemPool& rPool );
79 : void CreateOutputItemSet( const SfxItemSet& rInput );
80 0 : void SetInputSet( const SfxItemSet* pInSet ) { pInputSet = pInSet; }
81 0 : SfxItemSet* GetOutputSetImpl() { return pOutputSet; }
82 :
83 : public:
84 : virtual ~SfxModalDialog();
85 0 : const SfxItemSet* GetOutputItemSet() const { return pOutputSet; }
86 0 : const SfxItemSet* GetInputItemSet() const { return pInputSet; }
87 : };
88 :
89 : // class SfxModelessDialog --------------------------------------------------
90 : class SfxModelessDialog_Impl;
91 : class SFX2_DLLPUBLIC SfxModelessDialog: public ModelessDialog
92 : {
93 : SfxBindings* pBindings;
94 : Size aSize;
95 : SfxModelessDialog_Impl* pImp;
96 :
97 : SAL_DLLPRIVATE SfxModelessDialog(SfxModelessDialog &); // not defined
98 : SAL_DLLPRIVATE void operator =(SfxModelessDialog &); // not defined
99 :
100 : void Init(SfxBindings *pBindinx, SfxChildWindow *pCW);
101 :
102 : protected:
103 : SfxModelessDialog( SfxBindings*, SfxChildWindow*,
104 : Window*, const ResId& );
105 : SfxModelessDialog( SfxBindings*, SfxChildWindow*,
106 : Window*, const OString& rID, const OUString& rUIXMLDescription );
107 : virtual ~SfxModelessDialog();
108 : virtual bool Close() SAL_OVERRIDE;
109 : virtual void Resize() SAL_OVERRIDE;
110 : virtual void Move() SAL_OVERRIDE;
111 : virtual void StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE;
112 :
113 : public:
114 : virtual void FillInfo(SfxChildWinInfo&) const;
115 : void Initialize (SfxChildWinInfo* pInfo);
116 : virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
117 0 : SfxBindings& GetBindings()
118 0 : { return *pBindings; }
119 :
120 : DECL_LINK(TimerHdl, void *);
121 :
122 : };
123 :
124 : // class SfxFloatingWindow --------------------------------------------------
125 : class SfxFloatingWindow_Impl;
126 : class SFX2_DLLPUBLIC SfxFloatingWindow: public FloatingWindow
127 : {
128 : SfxBindings* pBindings;
129 : Size aSize;
130 : SfxFloatingWindow_Impl* pImp;
131 :
132 : SAL_DLLPRIVATE SfxFloatingWindow(SfxFloatingWindow &); // not defined
133 : SAL_DLLPRIVATE void operator =(SfxFloatingWindow &); // not defined
134 :
135 : protected:
136 : SfxFloatingWindow( SfxBindings *pBindings,
137 : SfxChildWindow *pCW,
138 : Window* pParent,
139 : WinBits nWinBits=WB_STDMODELESS);
140 : SfxFloatingWindow( SfxBindings *pBindings,
141 : SfxChildWindow *pCW,
142 : Window* pParent,
143 : const ResId& rResId);
144 : virtual ~SfxFloatingWindow();
145 :
146 : virtual void StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE;
147 : virtual bool Close() SAL_OVERRIDE;
148 : virtual void Resize() SAL_OVERRIDE;
149 : virtual void Move() SAL_OVERRIDE;
150 : virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
151 0 : SfxBindings& GetBindings()
152 0 : { return *pBindings; }
153 :
154 : public:
155 : virtual void FillInfo(SfxChildWinInfo&) const;
156 : void Initialize (SfxChildWinInfo* pInfo);
157 :
158 : DECL_LINK(TimerHdl, void *);
159 :
160 : };
161 :
162 : // class SfxNoLayoutSingleTabDialog --------------------------------------------------
163 :
164 0 : struct SingleTabDlgImpl
165 : {
166 : SfxTabPage* m_pSfxPage;
167 : FixedLine* m_pLine;
168 : OUString m_sInfoURL;
169 : Link m_aInfoLink;
170 :
171 0 : SingleTabDlgImpl()
172 : : m_pSfxPage(NULL)
173 0 : , m_pLine(NULL)
174 : {
175 0 : }
176 : };
177 :
178 : typedef sal_uInt16* (*GetTabPageRanges)(); // liefert internationale Which-Werte
179 :
180 : class SFX2_DLLPUBLIC SfxSingleTabDialog : public SfxModalDialog
181 : {
182 : public:
183 : SfxSingleTabDialog(Window *pParent, const SfxItemSet& rOptionsSet,
184 : const OString& rID = OString("SingleTabDialog"),
185 : const OUString& rUIXMLDescription = OUString("sfx/ui/singletabdialog.ui"));
186 :
187 : SfxSingleTabDialog(Window *pParent, const SfxItemSet* pInSet = 0,
188 : const OString& rID = OString("SingleTabDialog"),
189 : const OUString& rUIXMLDescription = OUString("sfx/ui/singletabdialog.ui"));
190 :
191 : virtual ~SfxSingleTabDialog();
192 :
193 : void SetTabPage(SfxTabPage* pTabPage, GetTabPageRanges pRangesFunc = 0, sal_uInt32 nSettingsId = 0);
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 : #endif
212 :
213 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|