1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_svtools.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include "svtools/genericunodialog.hxx"
32*cdf0e10cSrcweir 
33*cdf0e10cSrcweir #include <com/sun/star/beans/NamedValue.hpp>
34*cdf0e10cSrcweir #include <com/sun/star/ucb/AlreadyInitializedException.hpp>
35*cdf0e10cSrcweir 
36*cdf0e10cSrcweir #include <toolkit/awt/vclxwindow.hxx>
37*cdf0e10cSrcweir #include <comphelper/extract.hxx>
38*cdf0e10cSrcweir #include <cppuhelper/typeprovider.hxx>
39*cdf0e10cSrcweir #include <comphelper/property.hxx>
40*cdf0e10cSrcweir #include <osl/diagnose.h>
41*cdf0e10cSrcweir #include <tools/diagnose_ex.h>
42*cdf0e10cSrcweir #include <vcl/msgbox.hxx>
43*cdf0e10cSrcweir #include <vos/mutex.hxx>
44*cdf0e10cSrcweir #include <vcl/svapp.hxx>
45*cdf0e10cSrcweir 
46*cdf0e10cSrcweir using namespace ::comphelper;
47*cdf0e10cSrcweir using namespace ::com::sun::star::uno;
48*cdf0e10cSrcweir using namespace ::com::sun::star::lang;
49*cdf0e10cSrcweir using namespace ::com::sun::star::beans;
50*cdf0e10cSrcweir using namespace ::com::sun::star::ucb;
51*cdf0e10cSrcweir 
52*cdf0e10cSrcweir //.........................................................................
53*cdf0e10cSrcweir namespace svt
54*cdf0e10cSrcweir {
55*cdf0e10cSrcweir //.........................................................................
56*cdf0e10cSrcweir 
57*cdf0e10cSrcweir //=========================================================================
58*cdf0e10cSrcweir //-------------------------------------------------------------------------
59*cdf0e10cSrcweir OGenericUnoDialog::OGenericUnoDialog(const Reference< XMultiServiceFactory >& _rxORB)
60*cdf0e10cSrcweir 		:OPropertyContainer(GetBroadcastHelper())
61*cdf0e10cSrcweir 		,m_pDialog(NULL)
62*cdf0e10cSrcweir 		,m_bExecuting(sal_False)
63*cdf0e10cSrcweir 		,m_bCanceled(sal_False)
64*cdf0e10cSrcweir 		,m_bTitleAmbiguous(sal_True)
65*cdf0e10cSrcweir         ,m_bInitialized( false )
66*cdf0e10cSrcweir         ,m_bNeedInitialization( false )
67*cdf0e10cSrcweir 		,m_aContext( _rxORB )
68*cdf0e10cSrcweir {
69*cdf0e10cSrcweir 	registerProperty(::rtl::OUString::createFromAscii(UNODIALOG_PROPERTY_TITLE), UNODIALOG_PROPERTY_ID_TITLE, PropertyAttribute::TRANSIENT,
70*cdf0e10cSrcweir 		&m_sTitle, getCppuType(&m_sTitle));
71*cdf0e10cSrcweir 	registerProperty(::rtl::OUString::createFromAscii(UNODIALOG_PROPERTY_PARENT), UNODIALOG_PROPERTY_ID_PARENT, PropertyAttribute::TRANSIENT,
72*cdf0e10cSrcweir 		&m_xParent, getCppuType(&m_xParent));
73*cdf0e10cSrcweir }
74*cdf0e10cSrcweir 
75*cdf0e10cSrcweir //-------------------------------------------------------------------------
76*cdf0e10cSrcweir OGenericUnoDialog::OGenericUnoDialog(const Reference< XComponentContext >& _rxContext)
77*cdf0e10cSrcweir 		:OPropertyContainer(GetBroadcastHelper())
78*cdf0e10cSrcweir 		,m_pDialog(NULL)
79*cdf0e10cSrcweir 		,m_bExecuting(sal_False)
80*cdf0e10cSrcweir 		,m_bCanceled(sal_False)
81*cdf0e10cSrcweir 		,m_bTitleAmbiguous(sal_True)
82*cdf0e10cSrcweir         ,m_bInitialized( false )
83*cdf0e10cSrcweir         ,m_bNeedInitialization( false )
84*cdf0e10cSrcweir         ,m_aContext(_rxContext)
85*cdf0e10cSrcweir {
86*cdf0e10cSrcweir 	registerProperty(::rtl::OUString::createFromAscii(UNODIALOG_PROPERTY_TITLE), UNODIALOG_PROPERTY_ID_TITLE, PropertyAttribute::TRANSIENT,
87*cdf0e10cSrcweir 		&m_sTitle, getCppuType(&m_sTitle));
88*cdf0e10cSrcweir 	registerProperty(::rtl::OUString::createFromAscii(UNODIALOG_PROPERTY_PARENT), UNODIALOG_PROPERTY_ID_PARENT, PropertyAttribute::TRANSIENT,
89*cdf0e10cSrcweir 		&m_xParent, getCppuType(&m_xParent));
90*cdf0e10cSrcweir }
91*cdf0e10cSrcweir 
92*cdf0e10cSrcweir //-------------------------------------------------------------------------
93*cdf0e10cSrcweir OGenericUnoDialog::~OGenericUnoDialog()
94*cdf0e10cSrcweir {
95*cdf0e10cSrcweir 	if ( m_pDialog )
96*cdf0e10cSrcweir 	{
97*cdf0e10cSrcweir 	    ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
98*cdf0e10cSrcweir 		::osl::MutexGuard aGuard( m_aMutex );
99*cdf0e10cSrcweir 		if ( m_pDialog )
100*cdf0e10cSrcweir 			destroyDialog();
101*cdf0e10cSrcweir 	}
102*cdf0e10cSrcweir }
103*cdf0e10cSrcweir 
104*cdf0e10cSrcweir //-------------------------------------------------------------------------
105*cdf0e10cSrcweir Any SAL_CALL OGenericUnoDialog::queryInterface(const Type& _rType) throw (RuntimeException)
106*cdf0e10cSrcweir {
107*cdf0e10cSrcweir 	Any aReturn = OGenericUnoDialogBase::queryInterface(_rType);
108*cdf0e10cSrcweir 
109*cdf0e10cSrcweir 	if (!aReturn.hasValue())
110*cdf0e10cSrcweir 		aReturn = ::cppu::queryInterface(_rType
111*cdf0e10cSrcweir 			,static_cast<XPropertySet*>(this)
112*cdf0e10cSrcweir 			,static_cast<XMultiPropertySet*>(this)
113*cdf0e10cSrcweir 			,static_cast<XFastPropertySet*>(this)
114*cdf0e10cSrcweir 		);
115*cdf0e10cSrcweir 
116*cdf0e10cSrcweir 	return aReturn;
117*cdf0e10cSrcweir }
118*cdf0e10cSrcweir 
119*cdf0e10cSrcweir //-------------------------------------------------------------------------
120*cdf0e10cSrcweir Sequence<Type> SAL_CALL OGenericUnoDialog::getTypes(  ) throw(RuntimeException)
121*cdf0e10cSrcweir {
122*cdf0e10cSrcweir     return ::comphelper::concatSequences(
123*cdf0e10cSrcweir         OGenericUnoDialogBase::getTypes(),
124*cdf0e10cSrcweir         ::comphelper::OPropertyContainer::getTypes()
125*cdf0e10cSrcweir     );
126*cdf0e10cSrcweir }
127*cdf0e10cSrcweir 
128*cdf0e10cSrcweir //-------------------------------------------------------------------------
129*cdf0e10cSrcweir Sequence<sal_Int8> SAL_CALL OGenericUnoDialog::getImplementationId(  ) throw(RuntimeException)
130*cdf0e10cSrcweir {
131*cdf0e10cSrcweir 	static ::cppu::OImplementationId aId;
132*cdf0e10cSrcweir 	return aId.getImplementationId();
133*cdf0e10cSrcweir }
134*cdf0e10cSrcweir 
135*cdf0e10cSrcweir //-------------------------------------------------------------------------
136*cdf0e10cSrcweir sal_Bool SAL_CALL OGenericUnoDialog::supportsService(const ::rtl::OUString& ServiceName) throw(RuntimeException)
137*cdf0e10cSrcweir {
138*cdf0e10cSrcweir 	Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames());
139*cdf0e10cSrcweir 	const ::rtl::OUString* pArray = aSupported.getConstArray();
140*cdf0e10cSrcweir 	for (sal_Int32 i = 0; i < aSupported.getLength(); ++i, ++pArray)
141*cdf0e10cSrcweir 		if (pArray->equals(ServiceName))
142*cdf0e10cSrcweir 			return sal_True;
143*cdf0e10cSrcweir 	return sal_False;
144*cdf0e10cSrcweir }
145*cdf0e10cSrcweir 
146*cdf0e10cSrcweir //-------------------------------------------------------------------------
147*cdf0e10cSrcweir void OGenericUnoDialog::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const Any& rValue ) throw(Exception)
148*cdf0e10cSrcweir {
149*cdf0e10cSrcweir 	// TODO : need some handling if we're currently executing ...
150*cdf0e10cSrcweir 
151*cdf0e10cSrcweir 	OPropertyContainer::setFastPropertyValue_NoBroadcast(nHandle, rValue);
152*cdf0e10cSrcweir 
153*cdf0e10cSrcweir 	if (UNODIALOG_PROPERTY_ID_TITLE == nHandle)
154*cdf0e10cSrcweir 	{
155*cdf0e10cSrcweir 		// from now on m_sTitle is valid
156*cdf0e10cSrcweir 		m_bTitleAmbiguous = sal_False;
157*cdf0e10cSrcweir 
158*cdf0e10cSrcweir 		if (m_pDialog)
159*cdf0e10cSrcweir 			m_pDialog->SetText(String(m_sTitle));
160*cdf0e10cSrcweir 	}
161*cdf0e10cSrcweir }
162*cdf0e10cSrcweir 
163*cdf0e10cSrcweir //-------------------------------------------------------------------------
164*cdf0e10cSrcweir sal_Bool OGenericUnoDialog::convertFastPropertyValue( Any& rConvertedValue, Any& rOldValue, sal_Int32 nHandle, const Any& rValue) throw(IllegalArgumentException)
165*cdf0e10cSrcweir {
166*cdf0e10cSrcweir 	switch (nHandle)
167*cdf0e10cSrcweir 	{
168*cdf0e10cSrcweir 		case UNODIALOG_PROPERTY_ID_PARENT:
169*cdf0e10cSrcweir 		{
170*cdf0e10cSrcweir 			Reference<starawt::XWindow> xNew;
171*cdf0e10cSrcweir 			::cppu::extractInterface(xNew, rValue);
172*cdf0e10cSrcweir 			if (xNew != m_xParent)
173*cdf0e10cSrcweir 			{
174*cdf0e10cSrcweir 				rConvertedValue <<= xNew;
175*cdf0e10cSrcweir 				rOldValue <<= m_xParent;
176*cdf0e10cSrcweir 				return sal_True;
177*cdf0e10cSrcweir 			}
178*cdf0e10cSrcweir 			return sal_False;
179*cdf0e10cSrcweir 		}
180*cdf0e10cSrcweir 	}
181*cdf0e10cSrcweir 	return OPropertyContainer::convertFastPropertyValue(rConvertedValue, rOldValue, nHandle, rValue);
182*cdf0e10cSrcweir }
183*cdf0e10cSrcweir 
184*cdf0e10cSrcweir //-------------------------------------------------------------------------
185*cdf0e10cSrcweir void SAL_CALL OGenericUnoDialog::setTitle( const ::rtl::OUString& _rTitle ) throw(RuntimeException)
186*cdf0e10cSrcweir {
187*cdf0e10cSrcweir     UnoDialogEntryGuard aGuard( *this );
188*cdf0e10cSrcweir 
189*cdf0e10cSrcweir 	try
190*cdf0e10cSrcweir 	{
191*cdf0e10cSrcweir 		setPropertyValue(::rtl::OUString::createFromAscii(UNODIALOG_PROPERTY_TITLE), makeAny(_rTitle));
192*cdf0e10cSrcweir 	}
193*cdf0e10cSrcweir 	catch(RuntimeException&)
194*cdf0e10cSrcweir 	{
195*cdf0e10cSrcweir 		// allowed to pass
196*cdf0e10cSrcweir 		throw;
197*cdf0e10cSrcweir 	}
198*cdf0e10cSrcweir 	catch( const Exception& )
199*cdf0e10cSrcweir 	{
200*cdf0e10cSrcweir         DBG_UNHANDLED_EXCEPTION();
201*cdf0e10cSrcweir 		// not allowed to pass
202*cdf0e10cSrcweir 	}
203*cdf0e10cSrcweir }
204*cdf0e10cSrcweir 
205*cdf0e10cSrcweir //-------------------------------------------------------------------------
206*cdf0e10cSrcweir bool OGenericUnoDialog::impl_ensureDialog_lck()
207*cdf0e10cSrcweir {
208*cdf0e10cSrcweir     if ( m_pDialog )
209*cdf0e10cSrcweir         return true;
210*cdf0e10cSrcweir 
211*cdf0e10cSrcweir     // get the parameters for the dialog from the current settings
212*cdf0e10cSrcweir 
213*cdf0e10cSrcweir 	// the parent window
214*cdf0e10cSrcweir 	Window* pParent = NULL;
215*cdf0e10cSrcweir 	VCLXWindow* pImplementation = VCLXWindow::GetImplementation(m_xParent);
216*cdf0e10cSrcweir 	if (pImplementation)
217*cdf0e10cSrcweir 		pParent = pImplementation->GetWindow();
218*cdf0e10cSrcweir 
219*cdf0e10cSrcweir 	// the title
220*cdf0e10cSrcweir 	String sTitle = m_sTitle;
221*cdf0e10cSrcweir 
222*cdf0e10cSrcweir     Dialog* pDialog = createDialog( pParent );
223*cdf0e10cSrcweir 	OSL_ENSURE( pDialog, "OGenericUnoDialog::impl_ensureDialog_lck: createDialog returned nonsense!" );
224*cdf0e10cSrcweir     if ( !pDialog )
225*cdf0e10cSrcweir         return false;
226*cdf0e10cSrcweir 
227*cdf0e10cSrcweir     // do some initialisations
228*cdf0e10cSrcweir 	if ( !m_bTitleAmbiguous )
229*cdf0e10cSrcweir 		pDialog->SetText( sTitle );
230*cdf0e10cSrcweir 
231*cdf0e10cSrcweir     // be notified when the dialog is killed by somebody else
232*cdf0e10cSrcweir     // #i65958# / 2006-07-07 / frank.schoenheit@sun.com
233*cdf0e10cSrcweir     pDialog->AddEventListener( LINK( this, OGenericUnoDialog, OnDialogDying ) );
234*cdf0e10cSrcweir 
235*cdf0e10cSrcweir     m_pDialog = pDialog;
236*cdf0e10cSrcweir 
237*cdf0e10cSrcweir     return true;
238*cdf0e10cSrcweir }
239*cdf0e10cSrcweir 
240*cdf0e10cSrcweir //-------------------------------------------------------------------------
241*cdf0e10cSrcweir sal_Int16 SAL_CALL OGenericUnoDialog::execute(  ) throw(RuntimeException)
242*cdf0e10cSrcweir {
243*cdf0e10cSrcweir     // both creation and execution of the dialog must be guarded with the SolarMutex, so be generous here
244*cdf0e10cSrcweir 	::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
245*cdf0e10cSrcweir 
246*cdf0e10cSrcweir 	Dialog* pDialogToExecute = NULL;
247*cdf0e10cSrcweir 	// create the dialog, if neccessary
248*cdf0e10cSrcweir 	{
249*cdf0e10cSrcweir 		UnoDialogEntryGuard aGuard( *this );
250*cdf0e10cSrcweir 
251*cdf0e10cSrcweir 		if (m_bExecuting)
252*cdf0e10cSrcweir 			throw RuntimeException(
253*cdf0e10cSrcweir                     ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "already executing the dialog (recursive call)" ) ),
254*cdf0e10cSrcweir                     *this
255*cdf0e10cSrcweir                   );
256*cdf0e10cSrcweir 
257*cdf0e10cSrcweir 		m_bCanceled = sal_False;
258*cdf0e10cSrcweir 		m_bExecuting = sal_True;
259*cdf0e10cSrcweir 
260*cdf0e10cSrcweir         if ( !impl_ensureDialog_lck() )
261*cdf0e10cSrcweir             return 0;
262*cdf0e10cSrcweir 
263*cdf0e10cSrcweir         pDialogToExecute = m_pDialog;
264*cdf0e10cSrcweir 	}
265*cdf0e10cSrcweir 
266*cdf0e10cSrcweir 	// start execution
267*cdf0e10cSrcweir 	sal_Int16 nReturn(0);
268*cdf0e10cSrcweir 	if ( pDialogToExecute )
269*cdf0e10cSrcweir 		nReturn = pDialogToExecute->Execute();
270*cdf0e10cSrcweir 
271*cdf0e10cSrcweir     {
272*cdf0e10cSrcweir 		::osl::MutexGuard aExecutionGuard(m_aExecutionMutex);
273*cdf0e10cSrcweir 		if (m_bCanceled)
274*cdf0e10cSrcweir 			nReturn = RET_CANCEL;
275*cdf0e10cSrcweir 	}
276*cdf0e10cSrcweir 
277*cdf0e10cSrcweir     {
278*cdf0e10cSrcweir 	    ::osl::MutexGuard aGuard(m_aMutex);
279*cdf0e10cSrcweir 
280*cdf0e10cSrcweir 	    // get the settings of the dialog
281*cdf0e10cSrcweir 	    executedDialog( nReturn );
282*cdf0e10cSrcweir 
283*cdf0e10cSrcweir 	    m_bExecuting = sal_False;
284*cdf0e10cSrcweir     }
285*cdf0e10cSrcweir 
286*cdf0e10cSrcweir 	// outta here
287*cdf0e10cSrcweir 	return nReturn;
288*cdf0e10cSrcweir }
289*cdf0e10cSrcweir 
290*cdf0e10cSrcweir #ifdef AWT_DIALOG
291*cdf0e10cSrcweir //-------------------------------------------------------------------------
292*cdf0e10cSrcweir void SAL_CALL OGenericUnoDialog::endExecute(  ) throw(RuntimeException)
293*cdf0e10cSrcweir {
294*cdf0e10cSrcweir     UnoDialogEntryGuard aGuard( *this );
295*cdf0e10cSrcweir 	if (!m_bExecuting)
296*cdf0e10cSrcweir 		throw RuntimeException();
297*cdf0e10cSrcweir 
298*cdf0e10cSrcweir 	{
299*cdf0e10cSrcweir 		::osl::MutexGuard aExecutionGuard(m_aExecutionMutex);
300*cdf0e10cSrcweir 		OSL_ENSURE(m_pDialog, "OGenericUnoDialog::endExecute : executing which dialog ?");
301*cdf0e10cSrcweir 			// m_bExecuting is true but we have no dialog ?
302*cdf0e10cSrcweir 		if (!m_pDialog)
303*cdf0e10cSrcweir 			throw RuntimeException();
304*cdf0e10cSrcweir 
305*cdf0e10cSrcweir 		if (!m_pDialog->IsInExecute())
306*cdf0e10cSrcweir 			// we tighly missed it ... another thread finished the execution of the dialog,
307*cdf0e10cSrcweir 			// but did not manage it to reset m_bExecuting, it currently tries to acquire
308*cdf0e10cSrcweir 			// m_aMutex or m_aExecutionMutex
309*cdf0e10cSrcweir 			// => nothing to do
310*cdf0e10cSrcweir 			return;
311*cdf0e10cSrcweir 
312*cdf0e10cSrcweir 		m_pDialog->EndDialog(RET_CANCEL);
313*cdf0e10cSrcweir 		m_bCanceled = sal_True;
314*cdf0e10cSrcweir 	}
315*cdf0e10cSrcweir }
316*cdf0e10cSrcweir #endif
317*cdf0e10cSrcweir 
318*cdf0e10cSrcweir //-------------------------------------------------------------------------
319*cdf0e10cSrcweir void OGenericUnoDialog::implInitialize(const Any& _rValue)
320*cdf0e10cSrcweir {
321*cdf0e10cSrcweir 	try
322*cdf0e10cSrcweir 	{
323*cdf0e10cSrcweir 	    PropertyValue aProperty;
324*cdf0e10cSrcweir         NamedValue aValue;
325*cdf0e10cSrcweir 	    if ( _rValue >>= aProperty )
326*cdf0e10cSrcweir 	    {
327*cdf0e10cSrcweir             setPropertyValue( aProperty.Name, aProperty.Value );
328*cdf0e10cSrcweir     	}
329*cdf0e10cSrcweir         else if ( _rValue >>= aValue )
330*cdf0e10cSrcweir 	    {
331*cdf0e10cSrcweir             setPropertyValue( aValue.Name, aValue.Value );
332*cdf0e10cSrcweir     	}
333*cdf0e10cSrcweir 	}
334*cdf0e10cSrcweir 	catch(const Exception&)
335*cdf0e10cSrcweir     {
336*cdf0e10cSrcweir         DBG_UNHANDLED_EXCEPTION();
337*cdf0e10cSrcweir     }
338*cdf0e10cSrcweir }
339*cdf0e10cSrcweir 
340*cdf0e10cSrcweir //-------------------------------------------------------------------------
341*cdf0e10cSrcweir void SAL_CALL OGenericUnoDialog::initialize( const Sequence< Any >& aArguments ) throw(Exception, RuntimeException)
342*cdf0e10cSrcweir {
343*cdf0e10cSrcweir     ::osl::MutexGuard aGuard( m_aMutex );
344*cdf0e10cSrcweir     if ( m_bInitialized )
345*cdf0e10cSrcweir         throw AlreadyInitializedException( ::rtl::OUString(), *this );
346*cdf0e10cSrcweir 
347*cdf0e10cSrcweir 	const Any* pArguments = aArguments.getConstArray();
348*cdf0e10cSrcweir 	for (sal_Int32 i=0; i<aArguments.getLength(); ++i, ++pArguments)
349*cdf0e10cSrcweir 		implInitialize(*pArguments);
350*cdf0e10cSrcweir 
351*cdf0e10cSrcweir     m_bInitialized = true;
352*cdf0e10cSrcweir }
353*cdf0e10cSrcweir 
354*cdf0e10cSrcweir //-------------------------------------------------------------------------
355*cdf0e10cSrcweir void OGenericUnoDialog::destroyDialog()
356*cdf0e10cSrcweir {
357*cdf0e10cSrcweir 	delete m_pDialog;
358*cdf0e10cSrcweir 	m_pDialog = NULL;
359*cdf0e10cSrcweir }
360*cdf0e10cSrcweir 
361*cdf0e10cSrcweir //-------------------------------------------------------------------------
362*cdf0e10cSrcweir IMPL_LINK( OGenericUnoDialog, OnDialogDying, VclWindowEvent*, _pEvent )
363*cdf0e10cSrcweir {
364*cdf0e10cSrcweir     OSL_ENSURE( _pEvent->GetWindow() == m_pDialog, "OGenericUnoDialog::OnDialogDying: where does this come from?" );
365*cdf0e10cSrcweir     if ( _pEvent->GetId() == VCLEVENT_OBJECT_DYING )
366*cdf0e10cSrcweir         m_pDialog = NULL;
367*cdf0e10cSrcweir     return 0L;
368*cdf0e10cSrcweir }
369*cdf0e10cSrcweir 
370*cdf0e10cSrcweir //.........................................................................
371*cdf0e10cSrcweir }	// namespace svt
372*cdf0e10cSrcweir //.........................................................................
373*cdf0e10cSrcweir 
374