1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
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>
34 struct SfxChildWinInfo
;
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
59 const SfxItemSet
* pInputSet
;
60 SfxItemSet
* pOutputSet
;
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();
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
; }
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
;
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
);
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();
112 virtual void StateChanged( StateChangedType nStateChange
);
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
;
131 SfxFloatingWindow_Impl
* pImp
;
133 SAL_DLLPRIVATE
SfxFloatingWindow(SfxFloatingWindow
&); // not defined
134 SAL_DLLPRIVATE
void operator =(SfxFloatingWindow
&); // not defined
137 SfxFloatingWindow( SfxBindings
*pBindings
,
140 WinBits nWinBits
=WB_STDMODELESS
);
141 SfxFloatingWindow( SfxBindings
*pBindings
,
144 const ResId
& rResId
);
145 ~SfxFloatingWindow();
147 virtual void StateChanged( StateChangedType nStateChange
);
148 virtual sal_Bool
Close();
149 virtual void Resize();
151 virtual long Notify( NotifyEvent
& rNEvt
);
152 SfxBindings
& GetBindings()
153 { return *pBindings
; }
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
;
179 typedef sal_uInt16
* (*GetTabPageRanges
)(); // liefert internationale Which-Werte
181 class SFX2_DLLPUBLIC SfxSingleTabDialogBase
: public SfxModalDialog
185 SfxSingleTabDialogBase(Window
* pParent
, const SfxItemSet
& rOptionsSet
);
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
; }
199 GetTabPageRanges fnGetRanges
;
202 CancelButton
* pCancelBtn
;
203 HelpButton
* pHelpBtn
;
205 SingleTabDlgImpl
* pImpl
;
207 DECL_DLLPRIVATE_LINK(OKHdl_Impl
, void *);
210 class SFX2_DLLPUBLIC SfxSingleTabDialog
: public SfxSingleTabDialogBase
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
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);
238 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */