Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _SV_DIALOG_HXX
30 : : #define _SV_DIALOG_HXX
31 : :
32 : : #include <tools/solar.h>
33 : : #include <vcl/dllapi.h>
34 : : #include <vcl/syswin.hxx>
35 : :
36 : : // parameter to pass to the dialogue constructor if really no parent is wanted
37 : : // whereas NULL chooses the deafult dialogue parent
38 : : #define DIALOG_NO_PARENT ((Window*)0xffffffff)
39 : :
40 : : // ----------
41 : : // - Dialog -
42 : : // ----------
43 : :
44 : : struct DialogImpl;
45 : :
46 : : class VCL_DLLPUBLIC Dialog : public SystemWindow
47 : : {
48 : : private:
49 : : Window* mpDialogParent;
50 : : Dialog* mpPrevExecuteDlg;
51 : : DialogImpl* mpDialogImpl;
52 : : long mnMousePositioned;
53 : : sal_Bool mbInExecute;
54 : : sal_Bool mbOldSaveBack;
55 : : sal_Bool mbInClose;
56 : : sal_Bool mbModalMode;
57 : : sal_Int8 mnCancelClose; //liuchen 2009-7-22, support Excel VBA UserForm_QueryClose event
58 : :
59 : : SAL_DLLPRIVATE void ImplInitDialogData();
60 : : SAL_DLLPRIVATE void ImplInitSettings();
61 : :
62 : : // Copy assignment is forbidden and not implemented.
63 : : SAL_DLLPRIVATE Dialog (const Dialog &);
64 : : SAL_DLLPRIVATE Dialog & operator= (const Dialog &);
65 : :
66 : : DECL_DLLPRIVATE_LINK( ImplAsyncCloseHdl, void* );
67 : : protected:
68 : : using Window::ImplInit;
69 : : SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle );
70 : : SAL_DLLPRIVATE void ImplDialogRes( const ResId& rResId );
71 : :
72 : : public:
73 : 0 : SAL_DLLPRIVATE sal_Bool IsInClose() const { return mbInClose; }
74 : :
75 : : protected:
76 : : Dialog( WindowType nType );
77 : : virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags );
78 : :
79 : : public:
80 : : Dialog( Window* pParent, WinBits nStyle = WB_STDDIALOG );
81 : : virtual ~Dialog();
82 : :
83 : : virtual long Notify( NotifyEvent& rNEvt );
84 : : virtual void StateChanged( StateChangedType nStateChange );
85 : : virtual void DataChanged( const DataChangedEvent& rDCEvt );
86 : :
87 : : virtual sal_Bool Close();
88 : :
89 : : virtual short Execute();
90 : 2 : sal_Bool IsInExecute() const { return mbInExecute; }
91 : :
92 : : sal_Int8 GetCloseFlag() const { return mnCancelClose; } //liuchen 2009-7-22, support Excel VBA UserForm_QueryClose event
93 : 0 : void SetCloseFlag( sal_Int8 nCancel ) { mnCancelClose = nCancel; } //liuchen 2009-7-22, support Excel VBA UserForm_QueryClose event
94 : :
95 : : ////////////////////////////////////////
96 : : // Dialog::Execute replacement API
97 : : public:
98 : : // Link impl: DECL_LINK( MyEndDialogHdl, Dialog* ); <= param is dialog just ended
99 : : virtual void StartExecuteModal( const Link& rEndDialogHdl );
100 : : long GetResult() const;
101 : : private:
102 : : sal_Bool ImplStartExecuteModal();
103 : : void ImplEndExecuteModal();
104 : : public:
105 : :
106 : : // Dialog::Execute replacement API
107 : : ////////////////////////////////////////
108 : :
109 : : void EndDialog( long nResult = 0 );
110 : : static void EndAllDialogs( Window* pParent=NULL );
111 : :
112 : : void GetDrawWindowBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder,
113 : : sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const;
114 : :
115 : : void SetModalInputMode( sal_Bool bModal );
116 : : void SetModalInputMode( sal_Bool bModal, sal_Bool bSubModalDialogs );
117 : : sal_Bool IsModalInputMode() const { return mbModalMode; }
118 : :
119 : : void GrabFocusToFirstControl();
120 : : };
121 : :
122 : : // ------------------
123 : : // - ModelessDialog -
124 : : // ------------------
125 : :
126 [ # # ]: 0 : class VCL_DLLPUBLIC ModelessDialog : public Dialog
127 : : {
128 : : // Copy assignment is forbidden and not implemented.
129 : : SAL_DLLPRIVATE ModelessDialog (const ModelessDialog &);
130 : : SAL_DLLPRIVATE ModelessDialog & operator= (const ModelessDialog &);
131 : :
132 : : public:
133 : : ModelessDialog( Window* pParent, const ResId& rResId );
134 : : };
135 : :
136 : : // ---------------
137 : : // - ModalDialog -
138 : : // ---------------
139 : :
140 [ # # ]: 0 : class VCL_DLLPUBLIC ModalDialog : public Dialog
141 : : {
142 : : public:
143 : : ModalDialog( Window* pParent, WinBits nStyle = WB_STDMODAL );
144 : : ModalDialog( Window* pParent, const ResId& rResId );
145 : :
146 : : private:
147 : : using Window::Show;
148 : : void Show( sal_Bool bVisible = sal_True );
149 : : using Window::Hide;
150 : : void Hide();
151 : :
152 : : // Copy assignment is forbidden and not implemented.
153 : : SAL_DLLPRIVATE ModalDialog (const ModalDialog &);
154 : : SAL_DLLPRIVATE ModalDialog & operator= (const ModalDialog &);
155 : : };
156 : :
157 : : #endif // _SV_DIALOG_HXX
158 : :
159 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|