1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef _SV_DIALOG_HXX 25 #define _SV_DIALOG_HXX 26 27 #include <vcl/sv.h> 28 #include <vcl/dllapi.h> 29 #include <vcl/syswin.hxx> 30 31 // parameter to pass to the dialogue constructor if really no parent is wanted 32 // whereas NULL chooses the deafult dialogue parent 33 #define DIALOG_NO_PARENT ((Window*)0xffffffff) 34 35 // ---------- 36 // - Dialog - 37 // ---------- 38 39 struct DialogImpl; 40 41 class VCL_DLLPUBLIC Dialog : public SystemWindow 42 { 43 private: 44 Window* mpDialogParent; 45 Dialog* mpPrevExecuteDlg; 46 DialogImpl* mpDialogImpl; 47 long mnMousePositioned; 48 sal_Bool mbInExecute; 49 sal_Bool mbOldSaveBack; 50 sal_Bool mbInClose; 51 sal_Bool mbModalMode; 52 53 SAL_DLLPRIVATE void ImplInitDialogData(); 54 SAL_DLLPRIVATE void ImplInitSettings(); 55 56 //#if 0 // _SOLAR__PRIVATE 57 // Copy assignment is forbidden and not implemented. 58 SAL_DLLPRIVATE Dialog (const Dialog &); 59 SAL_DLLPRIVATE Dialog & operator= (const Dialog &); 60 61 DECL_DLLPRIVATE_LINK( ImplAsyncCloseHdl, void* ); 62 protected: 63 using Window::ImplInit; 64 SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle ); 65 SAL_DLLPRIVATE void ImplDialogRes( const ResId& rResId ); 66 SAL_DLLPRIVATE void ImplCenterDialog(); 67 68 public: IsInClose() const69 SAL_DLLPRIVATE sal_Bool IsInClose() const { return mbInClose; } 70 //#endif 71 72 protected: 73 Dialog( WindowType nType ); 74 virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ); 75 76 public: 77 explicit Dialog( Window* pParent, WinBits nStyle = WB_STDDIALOG ); 78 explicit Dialog( Window* pParent, const ResId& ); 79 virtual ~Dialog(); 80 81 virtual long Notify( NotifyEvent& rNEvt ); 82 virtual void StateChanged( StateChangedType nStateChange ); 83 virtual void DataChanged( const DataChangedEvent& rDCEvt ); 84 85 virtual sal_Bool Close(); 86 87 virtual short Execute(); IsInExecute() const88 sal_Bool IsInExecute() const { return mbInExecute; } 89 90 //////////////////////////////////////// 91 // Dialog::Execute replacement API 92 public: 93 // Link impl: DECL_LINK( MyEndDialogHdl, Dialog* ); <= param is dialog just ended 94 virtual void StartExecuteModal( const Link& rEndDialogHdl ); 95 sal_Bool IsStartedModal() const; 96 long GetResult() const; 97 private: 98 sal_Bool ImplStartExecuteModal(); 99 void ImplEndExecuteModal(); 100 public: 101 102 // Dialog::Execute replacement API 103 //////////////////////////////////////// 104 105 void EndDialog( long nResult = 0 ); 106 static void EndAllDialogs( Window* pParent=NULL ); 107 108 void GetDrawWindowBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder, 109 sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const; 110 111 void SetModalInputMode( sal_Bool bModal ); 112 void SetModalInputMode( sal_Bool bModal, sal_Bool bSubModalDialogs ); IsModalInputMode() const113 sal_Bool IsModalInputMode() const { return mbModalMode; } 114 115 void GrabFocusToFirstControl(); 116 }; 117 118 // ------------------ 119 // - ModelessDialog - 120 // ------------------ 121 122 class VCL_DLLPUBLIC ModelessDialog : public Dialog 123 { 124 //#if 0 // _SOLAR__PRIVATE 125 // Copy assignment is forbidden and not implemented. 126 SAL_DLLPRIVATE ModelessDialog (const ModelessDialog &); 127 SAL_DLLPRIVATE ModelessDialog & operator= (const ModelessDialog &); 128 //#endif 129 130 public: 131 explicit ModelessDialog( Window* pParent, WinBits nStyle = WB_STDMODELESS ); 132 explicit ModelessDialog( Window* pParent, const ResId& ); 133 }; 134 135 // --------------- 136 // - ModalDialog - 137 // --------------- 138 139 class VCL_DLLPUBLIC ModalDialog : public Dialog 140 { 141 public: 142 explicit ModalDialog( Window* pParent, WinBits nStyle = WB_STDMODAL ); 143 explicit ModalDialog( Window* pParent, const ResId& ); 144 145 private: 146 using Window::Show; 147 void Show( sal_Bool bVisible = sal_True ); 148 using Window::Hide; 149 void Hide(); 150 151 //#if 0 // _SOLAR__PRIVATE 152 // Copy assignment is forbidden and not implemented. 153 SAL_DLLPRIVATE ModalDialog (const ModalDialog &); 154 SAL_DLLPRIVATE ModalDialog & operator= (const ModalDialog &); 155 //#endif 156 }; 157 158 #endif // _SV_DIALOG_HXX 159 160