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 : 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(vcl::Window *pParent, const OString& 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 0 : const SfxItemSet* GetOutputItemSet() const { return pOutputSet; }
85 0 : const SfxItemSet* GetInputItemSet() const { return pInputSet; }
86 : };
87 :
88 : // class SfxModelessDialog --------------------------------------------------
89 : class SfxModelessDialog_Impl;
90 : class SFX2_DLLPUBLIC SfxModelessDialog: public ModelessDialog
91 : {
92 : SfxBindings* pBindings;
93 : Size aSize;
94 : SfxModelessDialog_Impl* pImp;
95 :
96 : SAL_DLLPRIVATE SfxModelessDialog(SfxModelessDialog &); // not defined
97 : SAL_DLLPRIVATE void operator =(SfxModelessDialog &); // not defined
98 :
99 : void Init(SfxBindings *pBindinx, SfxChildWindow *pCW);
100 :
101 : protected:
102 : SfxModelessDialog( SfxBindings*, SfxChildWindow*,
103 : vcl::Window*, const OString& rID, const OUString& rUIXMLDescription );
104 : virtual ~SfxModelessDialog();
105 : virtual bool Close() SAL_OVERRIDE;
106 : virtual void Resize() SAL_OVERRIDE;
107 : virtual void Move() SAL_OVERRIDE;
108 : virtual void StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE;
109 :
110 : public:
111 : virtual void FillInfo(SfxChildWinInfo&) const;
112 : void Initialize (SfxChildWinInfo* pInfo);
113 : virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
114 0 : SfxBindings& GetBindings()
115 0 : { return *pBindings; }
116 :
117 : DECL_LINK(TimerHdl, void *);
118 :
119 : };
120 :
121 : // class SfxFloatingWindow --------------------------------------------------
122 : class SfxFloatingWindow_Impl;
123 : class SFX2_DLLPUBLIC SfxFloatingWindow: public FloatingWindow
124 : {
125 : SfxBindings* pBindings;
126 : Size aSize;
127 : SfxFloatingWindow_Impl* pImp;
128 :
129 : SAL_DLLPRIVATE SfxFloatingWindow(SfxFloatingWindow &); // not defined
130 : SAL_DLLPRIVATE void operator =(SfxFloatingWindow &); // not defined
131 :
132 : protected:
133 : SfxFloatingWindow( SfxBindings *pBindings,
134 : SfxChildWindow *pCW,
135 : vcl::Window* pParent,
136 : WinBits nWinBits=WB_STDMODELESS);
137 : SfxFloatingWindow( SfxBindings *pBindings,
138 : SfxChildWindow *pCW,
139 : vcl::Window* pParent,
140 : const OString& rID, const OUString& rUIXMLDescription,
141 : const css::uno::Reference<css::frame::XFrame> &rFrame = css::uno::Reference<css::frame::XFrame>());
142 : virtual ~SfxFloatingWindow();
143 :
144 : virtual void StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE;
145 : virtual bool Close() SAL_OVERRIDE;
146 : virtual void Resize() SAL_OVERRIDE;
147 : virtual void Move() SAL_OVERRIDE;
148 : virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
149 13 : SfxBindings& GetBindings()
150 13 : { return *pBindings; }
151 :
152 : public:
153 : virtual void FillInfo(SfxChildWinInfo&) const;
154 : void Initialize (SfxChildWinInfo* pInfo);
155 :
156 : DECL_LINK(TimerHdl, void *);
157 :
158 : };
159 :
160 : // class SfxNoLayoutSingleTabDialog --------------------------------------------------
161 :
162 0 : struct SingleTabDlgImpl
163 : {
164 : SfxTabPage* m_pSfxPage;
165 : FixedLine* m_pLine;
166 : OUString m_sInfoURL;
167 : Link m_aInfoLink;
168 :
169 0 : SingleTabDlgImpl()
170 : : m_pSfxPage(NULL)
171 0 : , m_pLine(NULL)
172 : {
173 0 : }
174 : };
175 :
176 : typedef const sal_uInt16* (*GetTabPageRanges)(); // liefert internationale Which-Werte
177 :
178 : class SFX2_DLLPUBLIC SfxSingleTabDialog : public SfxModalDialog
179 : {
180 : public:
181 : SfxSingleTabDialog(vcl::Window *pParent, const SfxItemSet& rOptionsSet,
182 : const OString& rID = OString("SingleTabDialog"),
183 : const OUString& rUIXMLDescription = OUString("sfx/ui/singletabdialog.ui"));
184 :
185 : SfxSingleTabDialog(vcl::Window *pParent, const SfxItemSet* pInSet = 0,
186 : const OString& rID = OString("SingleTabDialog"),
187 : const OUString& rUIXMLDescription = OUString("sfx/ui/singletabdialog.ui"));
188 :
189 : virtual ~SfxSingleTabDialog();
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 : OKButton* pOKBtn;
201 : CancelButton* pCancelBtn;
202 : 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: */
|