update credits
[LibreOffice.git] / include / sfx2 / basedlgs.hxx
blob95278e89e60585d6d2c55ba6a99baee2a760e154
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef _BASEDLGS_HXX
20 #define _BASEDLGS_HXX
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>
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;
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
47 SFX2_DLLPUBLIC inline void reverseUniqueHelpIdHack(Window &rWindow)
49 if (rWindow.GetHelpId().isEmpty())
50 rWindow.SetHelpId(rWindow.GetUniqueId());
53 // class SfxModalDialog --------------------------------------------------
55 class SFX2_DLLPUBLIC SfxModalDialog: public ModalDialog
57 sal_uInt32 nUniqId;
58 String aExtraData;
59 const SfxItemSet* pInputSet;
60 SfxItemSet* pOutputSet;
62 private:
63 SAL_DLLPRIVATE SfxModalDialog(SfxModalDialog &); // not defined
64 SAL_DLLPRIVATE void operator =(SfxModalDialog &); // not defined
66 SAL_DLLPRIVATE void SetDialogData_Impl();
67 SAL_DLLPRIVATE void GetDialogData_Impl();
68 SAL_DLLPRIVATE void init();
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 );
75 String& GetExtraData() { return aExtraData; }
76 sal_uInt32 GetUniqId() const { return nUniqId; }
77 void SetUniqId(sal_uInt32 nSettingsId) { nUniqId = nSettingsId; }
78 SfxItemSet* GetItemSet() { return pOutputSet; }
79 void CreateOutputItemSet( SfxItemPool& rPool );
80 void CreateOutputItemSet( const SfxItemSet& rInput );
81 void SetInputSet( const SfxItemSet* pInSet ) { pInputSet = pInSet; }
82 SfxItemSet* GetOutputSetImpl() { return pOutputSet; }
84 public:
85 ~SfxModalDialog();
86 const SfxItemSet* GetOutputItemSet() const { return pOutputSet; }
87 const SfxItemSet* GetInputItemSet() const { return pInputSet; }
90 // class SfxModelessDialog --------------------------------------------------
91 class SfxModelessDialog_Impl;
92 class SFX2_DLLPUBLIC SfxModelessDialog: public ModelessDialog
94 SfxBindings* pBindings;
95 Size aSize;
96 SfxModelessDialog_Impl* pImp;
98 SAL_DLLPRIVATE SfxModelessDialog(SfxModelessDialog &); // not defined
99 SAL_DLLPRIVATE void operator =(SfxModelessDialog &); // not defined
101 void Init(SfxBindings *pBindinx, SfxChildWindow *pCW);
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 );
114 public:
115 virtual void FillInfo(SfxChildWinInfo&) const;
116 void Initialize (SfxChildWinInfo* pInfo);
117 virtual long Notify( NotifyEvent& rNEvt );
118 SfxBindings& GetBindings()
119 { return *pBindings; }
121 DECL_LINK(TimerHdl, void *);
125 // class SfxFloatingWindow --------------------------------------------------
126 class SfxFloatingWindow_Impl;
127 class SFX2_DLLPUBLIC SfxFloatingWindow: public FloatingWindow
129 SfxBindings* pBindings;
130 Size aSize;
131 SfxFloatingWindow_Impl* pImp;
133 SAL_DLLPRIVATE SfxFloatingWindow(SfxFloatingWindow &); // not defined
134 SAL_DLLPRIVATE void operator =(SfxFloatingWindow &); // not defined
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();
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 SfxBindings& GetBindings()
153 { return *pBindings; }
155 public:
156 virtual void FillInfo(SfxChildWinInfo&) const;
157 void Initialize (SfxChildWinInfo* pInfo);
159 DECL_LINK(TimerHdl, void *);
163 // class SfxNoLayoutSingleTabDialog --------------------------------------------------
165 struct SingleTabDlgImpl
167 SfxTabPage* m_pSfxPage;
168 FixedLine* m_pLine;
169 String m_sInfoURL;
170 Link m_aInfoLink;
172 SingleTabDlgImpl()
173 : m_pSfxPage(NULL)
174 , m_pLine(NULL)
179 typedef sal_uInt16* (*GetTabPageRanges)(); // liefert internationale Which-Werte
181 class SFX2_DLLPUBLIC SfxSingleTabDialogBase : public SfxModalDialog
183 public:
184 //layout ctor
185 SfxSingleTabDialogBase(Window* pParent, const SfxItemSet& rOptionsSet);
187 //non-layout ctors
188 SfxSingleTabDialogBase( Window* pParent, const SfxItemSet& rOptionsSet, sal_uInt16 nUniqueId );
189 SfxSingleTabDialogBase( Window* pParent, sal_uInt16 nUniqueId, const SfxItemSet* pInSet = 0 );
191 virtual ~SfxSingleTabDialogBase();
193 SfxTabPage* GetTabPage() const { return pImpl->m_pSfxPage; }
195 OKButton* GetOKButton() const { return pOKBtn; }
196 CancelButton* GetCancelButton() const { return pCancelBtn; }
198 protected:
199 GetTabPageRanges fnGetRanges;
201 OKButton* pOKBtn;
202 CancelButton* pCancelBtn;
203 HelpButton* pHelpBtn;
205 SingleTabDlgImpl* pImpl;
207 DECL_DLLPRIVATE_LINK(OKHdl_Impl, void *);
210 class SFX2_DLLPUBLIC SfxSingleTabDialog : public SfxSingleTabDialogBase
212 public:
213 SfxSingleTabDialog(Window* pParent, const SfxItemSet& rOptionsSet)
214 : SfxSingleTabDialogBase(pParent, rOptionsSet)
217 void setTabPage(SfxTabPage* pTabPage, GetTabPageRanges pRangesFunc = 0, sal_uInt32 nSettingsId = 0);
220 //Old school deprecated non-layout aware version
221 class SFX2_DLLPUBLIC SfxNoLayoutSingleTabDialog : public SfxSingleTabDialogBase
223 public:
224 SfxNoLayoutSingleTabDialog(Window* pParent, const SfxItemSet& rOptionsSet, sal_uInt16 nUniqueId)
225 : SfxSingleTabDialogBase(pParent, rOptionsSet, nUniqueId)
228 SfxNoLayoutSingleTabDialog(Window* pParent, sal_uInt16 nUniqueId, const SfxItemSet* pInSet = 0)
229 : SfxSingleTabDialogBase(pParent, nUniqueId, pInSet)
232 ~SfxNoLayoutSingleTabDialog();
233 void SetTabPage(SfxTabPage* pTabPage, GetTabPageRanges pRangesFunc = 0);
236 #endif
238 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */