xref: /AOO41X/main/chart2/source/controller/dialogs/dlg_CreationWizard_UNO.cxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
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_chart2.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include "dlg_CreationWizard_UNO.hxx"
32*cdf0e10cSrcweir #include "dlg_CreationWizard.hxx"
33*cdf0e10cSrcweir #include "macros.hxx"
34*cdf0e10cSrcweir #include "servicenames.hxx"
35*cdf0e10cSrcweir #include "ContainerHelper.hxx"
36*cdf0e10cSrcweir #include "TimerTriggeredControllerLock.hxx"
37*cdf0e10cSrcweir #include <osl/mutex.hxx>
38*cdf0e10cSrcweir #include <vos/mutex.hxx>
39*cdf0e10cSrcweir // header for class Application
40*cdf0e10cSrcweir #include <vcl/svapp.hxx>
41*cdf0e10cSrcweir #include <toolkit/awt/vclxwindow.hxx>
42*cdf0e10cSrcweir // header for define RET_CANCEL
43*cdf0e10cSrcweir #include <vcl/msgbox.hxx>
44*cdf0e10cSrcweir // header for class OImplementationId
45*cdf0e10cSrcweir #include <cppuhelper/typeprovider.hxx>
46*cdf0e10cSrcweir #include <com/sun/star/awt/Point.hpp>
47*cdf0e10cSrcweir #include <com/sun/star/awt/Size.hpp>
48*cdf0e10cSrcweir #include <com/sun/star/beans/PropertyValue.hpp>
49*cdf0e10cSrcweir #include <com/sun/star/frame/XDesktop.hpp>
50*cdf0e10cSrcweir 
51*cdf0e10cSrcweir //.............................................................................
52*cdf0e10cSrcweir namespace chart
53*cdf0e10cSrcweir {
54*cdf0e10cSrcweir //.............................................................................
55*cdf0e10cSrcweir using namespace ::com::sun::star;
56*cdf0e10cSrcweir 
57*cdf0e10cSrcweir CreationWizardUnoDlg::CreationWizardUnoDlg( const uno::Reference< uno::XComponentContext >& xContext )
58*cdf0e10cSrcweir                     : OComponentHelper( m_aMutex )
59*cdf0e10cSrcweir                     , m_xChartModel( 0 )
60*cdf0e10cSrcweir                     , m_xCC( xContext )
61*cdf0e10cSrcweir                     , m_xParentWindow( 0 )
62*cdf0e10cSrcweir                     , m_pDialog( 0 )
63*cdf0e10cSrcweir                     , m_bUnlockControllersOnExecute(false)
64*cdf0e10cSrcweir {
65*cdf0e10cSrcweir     uno::Reference< frame::XDesktop > xDesktop(
66*cdf0e10cSrcweir         m_xCC->getServiceManager()->createInstanceWithContext(
67*cdf0e10cSrcweir             C2U( "com.sun.star.frame.Desktop" ), m_xCC ), uno::UNO_QUERY );
68*cdf0e10cSrcweir 	if( xDesktop.is() )
69*cdf0e10cSrcweir 	{
70*cdf0e10cSrcweir         uno::Reference< frame::XTerminateListener > xListener( this );
71*cdf0e10cSrcweir 		xDesktop->addTerminateListener( xListener );
72*cdf0e10cSrcweir 	}
73*cdf0e10cSrcweir }
74*cdf0e10cSrcweir CreationWizardUnoDlg::~CreationWizardUnoDlg()
75*cdf0e10cSrcweir {
76*cdf0e10cSrcweir     ::vos::OGuard aSolarGuard( Application::GetSolarMutex());
77*cdf0e10cSrcweir 	if( m_pDialog )
78*cdf0e10cSrcweir 	{
79*cdf0e10cSrcweir 		delete m_pDialog;
80*cdf0e10cSrcweir 		m_pDialog = 0;
81*cdf0e10cSrcweir 	}
82*cdf0e10cSrcweir }
83*cdf0e10cSrcweir //-------------------------------------------------------------------------
84*cdf0e10cSrcweir // lang::XServiceInfo
85*cdf0e10cSrcweir APPHELPER_XSERVICEINFO_IMPL(CreationWizardUnoDlg,CHART_WIZARD_DIALOG_SERVICE_IMPLEMENTATION_NAME)
86*cdf0e10cSrcweir 
87*cdf0e10cSrcweir     uno::Sequence< rtl::OUString > CreationWizardUnoDlg
88*cdf0e10cSrcweir ::getSupportedServiceNames_Static()
89*cdf0e10cSrcweir {
90*cdf0e10cSrcweir 	uno::Sequence< rtl::OUString > aSNS( 1 );
91*cdf0e10cSrcweir 	aSNS.getArray()[ 0 ] = CHART_WIZARD_DIALOG_SERVICE_NAME;
92*cdf0e10cSrcweir 	return aSNS;
93*cdf0e10cSrcweir }
94*cdf0e10cSrcweir 
95*cdf0e10cSrcweir //-------------------------------------------------------------------------
96*cdf0e10cSrcweir // XInterface
97*cdf0e10cSrcweir uno::Any SAL_CALL CreationWizardUnoDlg::queryInterface( const uno::Type& aType ) throw (uno::RuntimeException)
98*cdf0e10cSrcweir {
99*cdf0e10cSrcweir 	return OComponentHelper::queryInterface( aType );
100*cdf0e10cSrcweir }
101*cdf0e10cSrcweir void SAL_CALL CreationWizardUnoDlg::acquire() throw ()
102*cdf0e10cSrcweir {
103*cdf0e10cSrcweir     OComponentHelper::acquire();
104*cdf0e10cSrcweir }
105*cdf0e10cSrcweir void SAL_CALL CreationWizardUnoDlg::release() throw ()
106*cdf0e10cSrcweir {
107*cdf0e10cSrcweir     OComponentHelper::release();
108*cdf0e10cSrcweir }
109*cdf0e10cSrcweir uno::Any SAL_CALL CreationWizardUnoDlg::queryAggregation( uno::Type const & rType ) throw (uno::RuntimeException)
110*cdf0e10cSrcweir {
111*cdf0e10cSrcweir     if (rType == ::getCppuType( (uno::Reference< ui::dialogs::XExecutableDialog > const *)0 ))
112*cdf0e10cSrcweir     {
113*cdf0e10cSrcweir         void * p = static_cast< ui::dialogs::XExecutableDialog * >( this );
114*cdf0e10cSrcweir         return uno::Any( &p, rType );
115*cdf0e10cSrcweir     }
116*cdf0e10cSrcweir     else if (rType == ::getCppuType( (uno::Reference< lang::XServiceInfo > const *)0 ))
117*cdf0e10cSrcweir     {
118*cdf0e10cSrcweir         void * p = static_cast< lang::XTypeProvider * >( this );
119*cdf0e10cSrcweir         return uno::Any( &p, rType );
120*cdf0e10cSrcweir     }
121*cdf0e10cSrcweir     else if (rType == ::getCppuType( (uno::Reference< lang::XInitialization > const *)0 ))
122*cdf0e10cSrcweir     {
123*cdf0e10cSrcweir         void * p = static_cast< lang::XInitialization * >( this );
124*cdf0e10cSrcweir         return uno::Any( &p, rType );
125*cdf0e10cSrcweir     }
126*cdf0e10cSrcweir 	else if (rType == ::getCppuType( (uno::Reference< frame::XTerminateListener > const *)0 ))
127*cdf0e10cSrcweir 	{
128*cdf0e10cSrcweir         void * p = static_cast< frame::XTerminateListener * >( this );
129*cdf0e10cSrcweir         return uno::Any( &p, rType );
130*cdf0e10cSrcweir 	}
131*cdf0e10cSrcweir     else if (rType == ::getCppuType( (uno::Reference< beans::XPropertySet > const *)0 ))
132*cdf0e10cSrcweir 	{
133*cdf0e10cSrcweir         void * p = static_cast< beans::XPropertySet * >( this );
134*cdf0e10cSrcweir         return uno::Any( &p, rType );
135*cdf0e10cSrcweir 	}
136*cdf0e10cSrcweir     return OComponentHelper::queryAggregation( rType );
137*cdf0e10cSrcweir }
138*cdf0e10cSrcweir 
139*cdf0e10cSrcweir //-------------------------------------------------------------------------
140*cdf0e10cSrcweir #define LCL_CPPUTYPE(t) (::getCppuType( reinterpret_cast< const uno::Reference<t> *>(0)))
141*cdf0e10cSrcweir 
142*cdf0e10cSrcweir uno::Sequence< uno::Type > CreationWizardUnoDlg::getTypes() throw(uno::RuntimeException)
143*cdf0e10cSrcweir {
144*cdf0e10cSrcweir     static uno::Sequence< uno::Type > aTypeList;
145*cdf0e10cSrcweir 
146*cdf0e10cSrcweir     // /--
147*cdf0e10cSrcweir     ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
148*cdf0e10cSrcweir 	if( !aTypeList.getLength() )
149*cdf0e10cSrcweir 	{
150*cdf0e10cSrcweir         ::std::vector< uno::Type > aTypes;
151*cdf0e10cSrcweir         aTypes.push_back( LCL_CPPUTYPE( lang::XComponent ));
152*cdf0e10cSrcweir         aTypes.push_back( LCL_CPPUTYPE( lang::XTypeProvider ));
153*cdf0e10cSrcweir         aTypes.push_back( LCL_CPPUTYPE( uno::XAggregation ));
154*cdf0e10cSrcweir         aTypes.push_back( LCL_CPPUTYPE( uno::XWeak ));
155*cdf0e10cSrcweir         aTypes.push_back( LCL_CPPUTYPE( lang::XServiceInfo ));
156*cdf0e10cSrcweir         aTypes.push_back( LCL_CPPUTYPE( lang::XInitialization ));
157*cdf0e10cSrcweir         aTypes.push_back( LCL_CPPUTYPE( frame::XTerminateListener ));
158*cdf0e10cSrcweir         aTypes.push_back( LCL_CPPUTYPE( ui::dialogs::XExecutableDialog ));
159*cdf0e10cSrcweir         aTypes.push_back( LCL_CPPUTYPE( beans::XPropertySet ));
160*cdf0e10cSrcweir 		aTypeList = ::chart::ContainerHelper::ContainerToSequence( aTypes );
161*cdf0e10cSrcweir 	}
162*cdf0e10cSrcweir 
163*cdf0e10cSrcweir 	return aTypeList;
164*cdf0e10cSrcweir     // \--
165*cdf0e10cSrcweir }
166*cdf0e10cSrcweir uno::Sequence< sal_Int8 > SAL_CALL CreationWizardUnoDlg::getImplementationId( void ) throw( uno::RuntimeException )
167*cdf0e10cSrcweir {
168*cdf0e10cSrcweir     static uno::Sequence< sal_Int8 > aId;
169*cdf0e10cSrcweir 	if( aId.getLength() == 0 )
170*cdf0e10cSrcweir 	{
171*cdf0e10cSrcweir 		aId.realloc( 16 );
172*cdf0e10cSrcweir 		rtl_createUuid( (sal_uInt8 *)aId.getArray(), 0, sal_True );
173*cdf0e10cSrcweir 	}
174*cdf0e10cSrcweir 	return aId;
175*cdf0e10cSrcweir }
176*cdf0e10cSrcweir 
177*cdf0e10cSrcweir //-------------------------------------------------------------------------
178*cdf0e10cSrcweir 
179*cdf0e10cSrcweir // XTerminateListener
180*cdf0e10cSrcweir void SAL_CALL CreationWizardUnoDlg::queryTermination( const lang::EventObject& /*Event*/ ) throw( frame::TerminationVetoException, uno::RuntimeException)
181*cdf0e10cSrcweir {
182*cdf0e10cSrcweir 	::vos::OGuard aSolarGuard( Application::GetSolarMutex());
183*cdf0e10cSrcweir 
184*cdf0e10cSrcweir 	// we will never give a veto here
185*cdf0e10cSrcweir 	if( m_pDialog && !m_pDialog->isClosable() )
186*cdf0e10cSrcweir 	{
187*cdf0e10cSrcweir 		m_pDialog->ToTop();
188*cdf0e10cSrcweir 		throw frame::TerminationVetoException();
189*cdf0e10cSrcweir 	}
190*cdf0e10cSrcweir }
191*cdf0e10cSrcweir 
192*cdf0e10cSrcweir //-------------------------------------------------------------------------
193*cdf0e10cSrcweir 
194*cdf0e10cSrcweir void SAL_CALL CreationWizardUnoDlg::notifyTermination( const lang::EventObject& /*Event*/ ) throw (uno::RuntimeException)
195*cdf0e10cSrcweir {
196*cdf0e10cSrcweir 	// we are going down, so dispose us!
197*cdf0e10cSrcweir 	dispose();
198*cdf0e10cSrcweir }
199*cdf0e10cSrcweir 
200*cdf0e10cSrcweir void SAL_CALL CreationWizardUnoDlg::disposing( const lang::EventObject& /*Source*/ ) throw (uno::RuntimeException)
201*cdf0e10cSrcweir {
202*cdf0e10cSrcweir     //Listener should deregister himself and relaese all references to the closing object.
203*cdf0e10cSrcweir }
204*cdf0e10cSrcweir 
205*cdf0e10cSrcweir //-------------------------------------------------------------------------
206*cdf0e10cSrcweir void SAL_CALL CreationWizardUnoDlg::setTitle( const ::rtl::OUString& /*rTitle*/ ) throw(uno::RuntimeException)
207*cdf0e10cSrcweir {
208*cdf0e10cSrcweir }
209*cdf0e10cSrcweir //-------------------------------------------------------------------------
210*cdf0e10cSrcweir void CreationWizardUnoDlg::createDialogOnDemand()
211*cdf0e10cSrcweir {
212*cdf0e10cSrcweir     ::vos::OGuard aSolarGuard( Application::GetSolarMutex());
213*cdf0e10cSrcweir 	if( !m_pDialog )
214*cdf0e10cSrcweir 	{
215*cdf0e10cSrcweir 		Window* pParent = NULL;
216*cdf0e10cSrcweir         if( !m_xParentWindow.is() && m_xChartModel.is() )
217*cdf0e10cSrcweir         {
218*cdf0e10cSrcweir             uno::Reference< frame::XController > xController(
219*cdf0e10cSrcweir                 m_xChartModel->getCurrentController() );
220*cdf0e10cSrcweir             if( xController.is() )
221*cdf0e10cSrcweir             {
222*cdf0e10cSrcweir                 uno::Reference< frame::XFrame > xFrame(
223*cdf0e10cSrcweir                     xController->getFrame() );
224*cdf0e10cSrcweir                 if(xFrame.is())
225*cdf0e10cSrcweir                     m_xParentWindow = xFrame->getContainerWindow();
226*cdf0e10cSrcweir             }
227*cdf0e10cSrcweir         }
228*cdf0e10cSrcweir 		if( m_xParentWindow.is() )
229*cdf0e10cSrcweir 		{
230*cdf0e10cSrcweir 			VCLXWindow* pImplementation = VCLXWindow::GetImplementation(m_xParentWindow);
231*cdf0e10cSrcweir 			if (pImplementation)
232*cdf0e10cSrcweir 				pParent = pImplementation->GetWindow();
233*cdf0e10cSrcweir 		}
234*cdf0e10cSrcweir         uno::Reference< XComponent > xComp( this );
235*cdf0e10cSrcweir         if( m_xChartModel.is() )
236*cdf0e10cSrcweir         {
237*cdf0e10cSrcweir 		    m_pDialog = new CreationWizard( pParent, m_xChartModel, m_xCC );
238*cdf0e10cSrcweir             m_pDialog->AddEventListener( LINK( this, CreationWizardUnoDlg, DialogEventHdl ) );
239*cdf0e10cSrcweir         }
240*cdf0e10cSrcweir 	}
241*cdf0e10cSrcweir }
242*cdf0e10cSrcweir //-------------------------------------------------------------------------
243*cdf0e10cSrcweir IMPL_LINK( CreationWizardUnoDlg, DialogEventHdl, VclWindowEvent*, pEvent )
244*cdf0e10cSrcweir {
245*cdf0e10cSrcweir     if(pEvent && (pEvent->GetId() == VCLEVENT_OBJECT_DYING) )
246*cdf0e10cSrcweir         m_pDialog = 0;//avoid duplicate destruction of m_pDialog
247*cdf0e10cSrcweir     return 0;
248*cdf0e10cSrcweir }
249*cdf0e10cSrcweir 
250*cdf0e10cSrcweir //-------------------------------------------------------------------------
251*cdf0e10cSrcweir sal_Int16 SAL_CALL CreationWizardUnoDlg::execute(  ) throw(uno::RuntimeException)
252*cdf0e10cSrcweir {
253*cdf0e10cSrcweir     sal_Int16 nRet = RET_CANCEL;
254*cdf0e10cSrcweir     {
255*cdf0e10cSrcweir         ::vos::OGuard aSolarGuard( Application::GetSolarMutex());
256*cdf0e10cSrcweir         createDialogOnDemand();
257*cdf0e10cSrcweir         if( !m_pDialog )
258*cdf0e10cSrcweir             return nRet;
259*cdf0e10cSrcweir         TimerTriggeredControllerLock aTimerTriggeredControllerLock( m_xChartModel );
260*cdf0e10cSrcweir         if( m_bUnlockControllersOnExecute && m_xChartModel.is() )
261*cdf0e10cSrcweir             m_xChartModel->unlockControllers();
262*cdf0e10cSrcweir         nRet = m_pDialog->Execute();
263*cdf0e10cSrcweir     }
264*cdf0e10cSrcweir     return nRet;
265*cdf0e10cSrcweir }
266*cdf0e10cSrcweir 
267*cdf0e10cSrcweir //-------------------------------------------------------------------------
268*cdf0e10cSrcweir void SAL_CALL CreationWizardUnoDlg::initialize( const uno::Sequence< uno::Any >& aArguments ) throw(uno::Exception, uno::RuntimeException)
269*cdf0e10cSrcweir {
270*cdf0e10cSrcweir 	const uno::Any* pArguments = aArguments.getConstArray();
271*cdf0e10cSrcweir 	for(sal_Int32 i=0; i<aArguments.getLength(); ++i, ++pArguments)
272*cdf0e10cSrcweir 	{
273*cdf0e10cSrcweir         beans::PropertyValue aProperty;
274*cdf0e10cSrcweir 		if(*pArguments >>= aProperty)
275*cdf0e10cSrcweir 		{
276*cdf0e10cSrcweir 			if( aProperty.Name.compareToAscii( RTL_CONSTASCII_STRINGPARAM( "ParentWindow" ) ) == 0 )
277*cdf0e10cSrcweir 			{
278*cdf0e10cSrcweir 				aProperty.Value >>= m_xParentWindow;
279*cdf0e10cSrcweir 			}
280*cdf0e10cSrcweir             else if( aProperty.Name.compareToAscii( RTL_CONSTASCII_STRINGPARAM( "ChartModel" ) ) == 0 )
281*cdf0e10cSrcweir 			{
282*cdf0e10cSrcweir 				aProperty.Value >>= m_xChartModel;
283*cdf0e10cSrcweir 			}
284*cdf0e10cSrcweir 		}
285*cdf0e10cSrcweir 	}
286*cdf0e10cSrcweir }
287*cdf0e10cSrcweir 
288*cdf0e10cSrcweir //-------------------------------------------------------------------------
289*cdf0e10cSrcweir // ____ OComponentHelper ____
290*cdf0e10cSrcweir /// Called in dispose method after the listeners were notified.
291*cdf0e10cSrcweir void SAL_CALL CreationWizardUnoDlg::disposing()
292*cdf0e10cSrcweir {
293*cdf0e10cSrcweir     m_xChartModel.clear();
294*cdf0e10cSrcweir     m_xParentWindow.clear();
295*cdf0e10cSrcweir 
296*cdf0e10cSrcweir     // /--
297*cdf0e10cSrcweir     ::vos::OGuard aSolarGuard( Application::GetSolarMutex());
298*cdf0e10cSrcweir     if( m_pDialog )
299*cdf0e10cSrcweir     {
300*cdf0e10cSrcweir         delete m_pDialog;
301*cdf0e10cSrcweir         m_pDialog = 0;
302*cdf0e10cSrcweir     }
303*cdf0e10cSrcweir 
304*cdf0e10cSrcweir     try
305*cdf0e10cSrcweir     {
306*cdf0e10cSrcweir         uno::Reference< frame::XDesktop > xDesktop(
307*cdf0e10cSrcweir             m_xCC->getServiceManager()->createInstanceWithContext(
308*cdf0e10cSrcweir                 C2U( "com.sun.star.frame.Desktop" ), m_xCC ), uno::UNO_QUERY );
309*cdf0e10cSrcweir         if( xDesktop.is() )
310*cdf0e10cSrcweir         {
311*cdf0e10cSrcweir             uno::Reference< frame::XTerminateListener > xListener( this );
312*cdf0e10cSrcweir             xDesktop->removeTerminateListener( xListener );
313*cdf0e10cSrcweir         }
314*cdf0e10cSrcweir     }
315*cdf0e10cSrcweir     catch( const uno::Exception & ex )
316*cdf0e10cSrcweir     {
317*cdf0e10cSrcweir         ASSERT_EXCEPTION( ex );
318*cdf0e10cSrcweir     }
319*cdf0e10cSrcweir     // \--
320*cdf0e10cSrcweir }
321*cdf0e10cSrcweir 
322*cdf0e10cSrcweir //XPropertySet
323*cdf0e10cSrcweir uno::Reference< beans::XPropertySetInfo > SAL_CALL CreationWizardUnoDlg::getPropertySetInfo()
324*cdf0e10cSrcweir     throw (uno::RuntimeException)
325*cdf0e10cSrcweir {
326*cdf0e10cSrcweir     OSL_ENSURE(false,"not implemented");
327*cdf0e10cSrcweir     return 0;
328*cdf0e10cSrcweir }
329*cdf0e10cSrcweir 
330*cdf0e10cSrcweir void SAL_CALL CreationWizardUnoDlg::setPropertyValue( const ::rtl::OUString& rPropertyName
331*cdf0e10cSrcweir                                                      , const uno::Any& rValue )
332*cdf0e10cSrcweir     throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException
333*cdf0e10cSrcweir           , lang::WrappedTargetException, uno::RuntimeException)
334*cdf0e10cSrcweir {
335*cdf0e10cSrcweir     if( rPropertyName.equals(C2U("Position")) )
336*cdf0e10cSrcweir     {
337*cdf0e10cSrcweir         awt::Point aPos;
338*cdf0e10cSrcweir         if( ! (rValue >>= aPos) )
339*cdf0e10cSrcweir             throw lang::IllegalArgumentException( C2U("Property 'Position' requires value of type awt::Point"), 0, 0 );
340*cdf0e10cSrcweir 
341*cdf0e10cSrcweir         //set left upper outer corner relative to screen
342*cdf0e10cSrcweir         //pixels, screen position
343*cdf0e10cSrcweir         ::vos::OGuard aSolarGuard( Application::GetSolarMutex());
344*cdf0e10cSrcweir         createDialogOnDemand();
345*cdf0e10cSrcweir         if( m_pDialog )
346*cdf0e10cSrcweir         {
347*cdf0e10cSrcweir             m_pDialog->SetPosPixel( Point(0,0) );
348*cdf0e10cSrcweir             Rectangle aRect( m_pDialog->GetWindowExtentsRelative( 0 ) );
349*cdf0e10cSrcweir 
350*cdf0e10cSrcweir             Point aNewOuterPos = Point( aPos.X - aRect.Left(), aPos.Y - aRect.Top() );
351*cdf0e10cSrcweir             m_pDialog->SetPosPixel( aNewOuterPos );
352*cdf0e10cSrcweir         }
353*cdf0e10cSrcweir     }
354*cdf0e10cSrcweir     else if( rPropertyName.equals(C2U("Size")) )
355*cdf0e10cSrcweir     {
356*cdf0e10cSrcweir         //read only property, do nothing
357*cdf0e10cSrcweir     }
358*cdf0e10cSrcweir     else if( rPropertyName.equals(C2U("UnlockControllersOnExecute")) )
359*cdf0e10cSrcweir     {
360*cdf0e10cSrcweir         if( ! (rValue >>= m_bUnlockControllersOnExecute) )
361*cdf0e10cSrcweir             throw lang::IllegalArgumentException( C2U("Property 'UnlockControllers' requires value of type boolean"), 0, 0 );
362*cdf0e10cSrcweir     }
363*cdf0e10cSrcweir     else
364*cdf0e10cSrcweir         throw beans::UnknownPropertyException( C2U("unknown property was tried to set to chart wizard"), 0 );
365*cdf0e10cSrcweir }
366*cdf0e10cSrcweir 
367*cdf0e10cSrcweir uno::Any SAL_CALL CreationWizardUnoDlg::getPropertyValue( const ::rtl::OUString& rPropertyName )
368*cdf0e10cSrcweir     throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
369*cdf0e10cSrcweir {
370*cdf0e10cSrcweir     uno::Any aRet;
371*cdf0e10cSrcweir     if( rPropertyName.equals(C2U("Position")) )
372*cdf0e10cSrcweir     {
373*cdf0e10cSrcweir         //get left upper outer corner relative to screen
374*cdf0e10cSrcweir         //pixels, screen position
375*cdf0e10cSrcweir         ::vos::OGuard aSolarGuard( Application::GetSolarMutex());
376*cdf0e10cSrcweir         createDialogOnDemand();
377*cdf0e10cSrcweir         if( m_pDialog )
378*cdf0e10cSrcweir         {
379*cdf0e10cSrcweir             Rectangle aRect( m_pDialog->GetWindowExtentsRelative( 0 ) );
380*cdf0e10cSrcweir             awt::Point aPoint(aRect.Left(),aRect.Top());
381*cdf0e10cSrcweir             aRet = uno::makeAny( aPoint );
382*cdf0e10cSrcweir         }
383*cdf0e10cSrcweir     }
384*cdf0e10cSrcweir     else if( rPropertyName.equals(C2U("Size")) )
385*cdf0e10cSrcweir     {
386*cdf0e10cSrcweir         //get outer size inclusive decoration
387*cdf0e10cSrcweir         //pixels, screen position
388*cdf0e10cSrcweir         ::vos::OGuard aSolarGuard( Application::GetSolarMutex());
389*cdf0e10cSrcweir         createDialogOnDemand();
390*cdf0e10cSrcweir         if( m_pDialog )
391*cdf0e10cSrcweir         {
392*cdf0e10cSrcweir             Rectangle aRect( m_pDialog->GetWindowExtentsRelative( 0 ) );
393*cdf0e10cSrcweir             awt::Size aSize(aRect.GetWidth(),aRect.GetHeight());
394*cdf0e10cSrcweir             aRet = uno::makeAny( aSize );
395*cdf0e10cSrcweir         }
396*cdf0e10cSrcweir     }
397*cdf0e10cSrcweir     else if( rPropertyName.equals(C2U("UnlockControllersOnExecute")) )
398*cdf0e10cSrcweir     {
399*cdf0e10cSrcweir         aRet = uno::makeAny( m_bUnlockControllersOnExecute );
400*cdf0e10cSrcweir     }
401*cdf0e10cSrcweir     else
402*cdf0e10cSrcweir         throw beans::UnknownPropertyException( C2U("unknown property was tried to get from chart wizard"), 0 );
403*cdf0e10cSrcweir     return aRet;
404*cdf0e10cSrcweir }
405*cdf0e10cSrcweir 
406*cdf0e10cSrcweir void SAL_CALL CreationWizardUnoDlg::addPropertyChangeListener(
407*cdf0e10cSrcweir         const ::rtl::OUString& /* aPropertyName */, const uno::Reference< beans::XPropertyChangeListener >& /* xListener */ )
408*cdf0e10cSrcweir         throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
409*cdf0e10cSrcweir {
410*cdf0e10cSrcweir     OSL_ENSURE(false,"not implemented");
411*cdf0e10cSrcweir }
412*cdf0e10cSrcweir void SAL_CALL CreationWizardUnoDlg::removePropertyChangeListener(
413*cdf0e10cSrcweir     const ::rtl::OUString& /* aPropertyName */, const uno::Reference< beans::XPropertyChangeListener >& /* aListener */ )
414*cdf0e10cSrcweir     throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
415*cdf0e10cSrcweir {
416*cdf0e10cSrcweir     OSL_ENSURE(false,"not implemented");
417*cdf0e10cSrcweir }
418*cdf0e10cSrcweir 
419*cdf0e10cSrcweir void SAL_CALL CreationWizardUnoDlg::addVetoableChangeListener( const ::rtl::OUString& /* PropertyName */, const uno::Reference< beans::XVetoableChangeListener >& /* aListener */ )
420*cdf0e10cSrcweir     throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
421*cdf0e10cSrcweir {
422*cdf0e10cSrcweir     OSL_ENSURE(false,"not implemented");
423*cdf0e10cSrcweir }
424*cdf0e10cSrcweir 
425*cdf0e10cSrcweir void SAL_CALL CreationWizardUnoDlg::removeVetoableChangeListener( const ::rtl::OUString& /* PropertyName */, const uno::Reference< beans::XVetoableChangeListener >& /* aListener */ )
426*cdf0e10cSrcweir     throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
427*cdf0e10cSrcweir {
428*cdf0e10cSrcweir     OSL_ENSURE(false,"not implemented");
429*cdf0e10cSrcweir }
430*cdf0e10cSrcweir 
431*cdf0e10cSrcweir //.............................................................................
432*cdf0e10cSrcweir } //namespace chart
433*cdf0e10cSrcweir //.............................................................................
434