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 : inline void reverseUniqueHelpIdHack(vcl::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 : SfxModalDialog(SfxModalDialog &) SAL_DELETED_FUNCTION;
64 : void operator =(SfxModalDialog &) SAL_DELETED_FUNCTION;
65 :
66 : SAL_DLLPRIVATE void SetDialogData_Impl();
67 : SAL_DLLPRIVATE void GetDialogData_Impl();
68 : SAL_DLLPRIVATE void init();
69 :
70 : protected:
71 : SfxModalDialog(vcl::Window *pParent, const OUString& rID, const OUString& rUIXMLDescription);
72 :
73 0 : OUString& GetExtraData() { return aExtraData; }
74 0 : sal_uInt32 GetUniqId() const { return nUniqId; }
75 0 : void SetUniqId(sal_uInt32 nSettingsId) { nUniqId = nSettingsId; }
76 0 : SfxItemSet* GetItemSet() { return pOutputSet; }
77 : void CreateOutputItemSet( SfxItemPool& rPool );
78 : void CreateOutputItemSet( const SfxItemSet& rInput );
79 0 : void SetInputSet( const SfxItemSet* pInSet ) { pInputSet = pInSet; }
80 0 : SfxItemSet* GetOutputSetImpl() { return pOutputSet; }
81 :
82 : public:
83 : virtual ~SfxModalDialog();
84 : virtual void dispose() SAL_OVERRIDE;
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 : SfxModelessDialog(SfxModelessDialog &) SAL_DELETED_FUNCTION;
98 : void operator =(SfxModelessDialog &) SAL_DELETED_FUNCTION;
99 :
100 : void Init(SfxBindings *pBindinx, SfxChildWindow *pCW);
101 :
102 : protected:
103 : SfxModelessDialog( SfxBindings*, SfxChildWindow*,
104 : vcl::Window*, const OUString& rID, const OUString& rUIXMLDescription );
105 : virtual ~SfxModelessDialog();
106 : virtual void dispose() SAL_OVERRIDE;
107 : virtual bool Close() SAL_OVERRIDE;
108 : virtual void Resize() SAL_OVERRIDE;
109 : virtual void Move() SAL_OVERRIDE;
110 : virtual void StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE;
111 :
112 : public:
113 : virtual void FillInfo(SfxChildWinInfo&) const;
114 : void Initialize (SfxChildWinInfo* pInfo);
115 : virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
116 0 : SfxBindings& GetBindings()
117 0 : { return *pBindings; }
118 :
119 : DECL_LINK_TYPED(TimerHdl, Idle *, void);
120 :
121 : };
122 :
123 : // class SfxFloatingWindow --------------------------------------------------
124 : class SfxFloatingWindow_Impl;
125 : class SFX2_DLLPUBLIC SfxFloatingWindow: public FloatingWindow
126 : {
127 : SfxBindings* pBindings;
128 : Size aSize;
129 : SfxFloatingWindow_Impl* pImp;
130 :
131 : SfxFloatingWindow(SfxFloatingWindow &) SAL_DELETED_FUNCTION;
132 : void operator =(SfxFloatingWindow &) SAL_DELETED_FUNCTION;
133 :
134 : protected:
135 : SfxFloatingWindow( SfxBindings *pBindings,
136 : SfxChildWindow *pCW,
137 : vcl::Window* pParent,
138 : WinBits nWinBits=WB_STDMODELESS);
139 : SfxFloatingWindow( SfxBindings *pBindings,
140 : SfxChildWindow *pCW,
141 : vcl::Window* pParent,
142 : const OString& rID, const OUString& rUIXMLDescription,
143 : const css::uno::Reference<css::frame::XFrame> &rFrame = css::uno::Reference<css::frame::XFrame>());
144 : virtual ~SfxFloatingWindow();
145 : virtual void dispose() SAL_OVERRIDE;
146 :
147 : virtual void StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE;
148 : virtual bool Close() SAL_OVERRIDE;
149 : virtual void Resize() SAL_OVERRIDE;
150 : virtual void Move() SAL_OVERRIDE;
151 : virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
152 0 : SfxBindings& GetBindings()
153 0 : { return *pBindings; }
154 :
155 : public:
156 : virtual void FillInfo(SfxChildWinInfo&) const;
157 : void Initialize (SfxChildWinInfo* pInfo);
158 :
159 : DECL_LINK_TYPED(TimerHdl, Idle *, void);
160 :
161 : };
162 :
163 : // class SfxNoLayoutSingleTabDialog --------------------------------------------------
164 :
165 0 : struct SingleTabDlgImpl
166 : {
167 : VclPtr<SfxTabPage> m_pSfxPage;
168 : VclPtr<FixedLine> m_pLine;
169 : OUString m_sInfoURL;
170 : Link<> m_aInfoLink;
171 :
172 : SingleTabDlgImpl();
173 : };
174 :
175 : typedef const sal_uInt16* (*GetTabPageRanges)(); // liefert internationale Which-Werte
176 :
177 : class SFX2_DLLPUBLIC SfxSingleTabDialog : public SfxModalDialog
178 : {
179 : public:
180 : SfxSingleTabDialog(vcl::Window *pParent, const SfxItemSet& rOptionsSet,
181 : const OUString& rID = OUString("SingleTabDialog"),
182 : const OUString& rUIXMLDescription = OUString("sfx/ui/singletabdialog.ui"));
183 :
184 : SfxSingleTabDialog(vcl::Window *pParent, const SfxItemSet* pInSet = 0,
185 : const OUString& rID = OUString("SingleTabDialog"),
186 : const OUString& rUIXMLDescription = OUString("sfx/ui/singletabdialog.ui"));
187 :
188 : virtual ~SfxSingleTabDialog();
189 : virtual void dispose() SAL_OVERRIDE;
190 :
191 : void SetTabPage(SfxTabPage* pTabPage, GetTabPageRanges pRangesFunc = 0, sal_uInt32 nSettingsId = 0);
192 0 : SfxTabPage* GetTabPage() const { return pImpl->m_pSfxPage; }
193 :
194 0 : OKButton* GetOKButton() const { return pOKBtn; }
195 : CancelButton* GetCancelButton() const { return pCancelBtn; }
196 :
197 : protected:
198 : GetTabPageRanges fnGetRanges;
199 :
200 : VclPtr<OKButton> pOKBtn;
201 : VclPtr<CancelButton> pCancelBtn;
202 : VclPtr<HelpButton> pHelpBtn;
203 :
204 : SingleTabDlgImpl* pImpl;
205 :
206 : DECL_DLLPRIVATE_LINK(OKHdl_Impl, void *);
207 : };
208 :
209 : #endif
210 :
211 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|