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