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 :
20 : #ifndef INCLUDED_VCL_DIALOG_HXX
21 : #define INCLUDED_VCL_DIALOG_HXX
22 :
23 : #include <tools/solar.h>
24 : #include <vcl/dllapi.h>
25 : #include <vcl/syswin.hxx>
26 : #include <vcl/timer.hxx>
27 :
28 : // parameter to pass to the dialog constructor if really no parent is wanted
29 : // whereas NULL chooses the default dialog parent
30 : #define DIALOG_NO_PARENT (reinterpret_cast<vcl::Window*>(0xffffffff))
31 :
32 :
33 : // - Dialog -
34 :
35 : struct DialogImpl;
36 : class VclBox;
37 : class VclButtonBox;
38 :
39 : class VCL_DLLPUBLIC Dialog : public SystemWindow
40 : {
41 : private:
42 : Dialog* mpPrevExecuteDlg;
43 : DialogImpl* mpDialogImpl;
44 : long mnMousePositioned;
45 : bool mbInExecute;
46 : bool mbOldSaveBack;
47 : bool mbInClose;
48 : bool mbModalMode;
49 :
50 : VclButtonBox* mpActionArea;
51 : VclBox* mpContentArea;
52 :
53 : SAL_DLLPRIVATE void ImplInitDialogData();
54 : SAL_DLLPRIVATE void ImplInitSettings();
55 :
56 : // Copy assignment is forbidden and not implemented.
57 : SAL_DLLPRIVATE Dialog (const Dialog &);
58 : SAL_DLLPRIVATE Dialog & operator= (const Dialog &);
59 :
60 : DECL_DLLPRIVATE_LINK( ImplAsyncCloseHdl, void* );
61 :
62 : protected:
63 : using Window::ImplInit;
64 : SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle );
65 :
66 : public:
67 238 : SAL_DLLPRIVATE bool IsInClose() const { return mbInClose; }
68 : virtual void doDeferredInit(WinBits nBits) SAL_OVERRIDE;
69 :
70 : protected:
71 : explicit Dialog( WindowType nType );
72 : explicit Dialog( vcl::Window* pParent, const OString& rID, const OUString& rUIXMLDescription, WindowType nType );
73 : virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) SAL_OVERRIDE;
74 : virtual void settingOptimalLayoutSize(VclBox *pBox) SAL_OVERRIDE;
75 :
76 : protected:
77 : friend class VclBuilder;
78 : void set_action_area(VclButtonBox *pBox);
79 : void set_content_area(VclBox *pBox);
80 :
81 : public:
82 : explicit Dialog( vcl::Window* pParent, WinBits nStyle = WB_STDDIALOG );
83 : explicit Dialog( vcl::Window* pParent, const OString& rID, const OUString& rUIXMLDescription );
84 : virtual ~Dialog();
85 :
86 : virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
87 : virtual void StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE;
88 : virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
89 :
90 : virtual void queue_resize(StateChangedType eReason = StateChangedType::LAYOUT) SAL_OVERRIDE;
91 : virtual bool set_property(const OString &rKey, const OString &rValue) SAL_OVERRIDE;
92 0 : VclButtonBox* get_action_area() { return mpActionArea;}
93 0 : VclBox* get_content_area() { return mpContentArea;}
94 :
95 : virtual bool Close() SAL_OVERRIDE;
96 :
97 : virtual short Execute();
98 2 : bool IsInExecute() const { return mbInExecute; }
99 :
100 : // Dialog::Execute replacement API
101 : public:
102 : // Link impl: DECL_LINK( MyEndDialogHdl, Dialog* ); <= param is dialog just ended
103 : virtual void StartExecuteModal( const Link& rEndDialogHdl );
104 : long GetResult() const;
105 : private:
106 : bool ImplStartExecuteModal();
107 : void ImplEndExecuteModal();
108 : public:
109 :
110 : // Dialog::Execute replacement API
111 :
112 :
113 : void EndDialog( long nResult = 0 );
114 : static void EndAllDialogs( vcl::Window* pParent=NULL );
115 :
116 : void GetDrawWindowBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder,
117 : sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const;
118 :
119 : void SetModalInputMode( bool bModal );
120 : void SetModalInputMode( bool bModal, bool bSubModalDialogs );
121 0 : bool IsModalInputMode() const { return mbModalMode; }
122 :
123 : void GrabFocusToFirstControl();
124 : };
125 :
126 : // - ModelessDialog -
127 0 : class VCL_DLLPUBLIC ModelessDialog : public Dialog
128 : {
129 : // Copy assignment is forbidden and not implemented.
130 : SAL_DLLPRIVATE ModelessDialog (const ModelessDialog &);
131 : SAL_DLLPRIVATE ModelessDialog & operator= (const ModelessDialog &);
132 :
133 : public:
134 : explicit ModelessDialog( vcl::Window* pParent, const OString& rID, const OUString& rUIXMLDescription );
135 : };
136 :
137 : // - ModalDialog -
138 0 : class VCL_DLLPUBLIC ModalDialog : public Dialog
139 : {
140 : public:
141 : explicit ModalDialog( vcl::Window* pParent, WinBits nStyle = WB_STDMODAL );
142 : explicit ModalDialog( vcl::Window* pParent, const OString& rID, const OUString& rUIXMLDescription );
143 :
144 : protected:
145 : using Window::Show;
146 : void Show( bool bVisible = true );
147 : using Window::Hide;
148 : void Hide();
149 :
150 : private:
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 // INCLUDED_VCL_DIALOG_HXX
158 :
159 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|