1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: unodialogsample.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #include "udlg_module.hxx"
32 #include "roadmapskeleton.hxx"
34 /** === begin UNO includes === **/
35 /** === end UNO includes === **/
37 #include <comphelper/componentcontext.hxx>
38 #include "svtools/genericunodialog.hxx"
40 //........................................................................
43 //........................................................................
45 /** === begin UNO using === **/
46 using ::com::sun::star::uno::Reference
;
47 using ::com::sun::star::uno::XInterface
;
48 using ::com::sun::star::uno::UNO_QUERY
;
49 using ::com::sun::star::uno::UNO_QUERY_THROW
;
50 using ::com::sun::star::uno::UNO_SET_THROW
;
51 using ::com::sun::star::uno::Exception
;
52 using ::com::sun::star::uno::RuntimeException
;
53 using ::com::sun::star::uno::Any
;
54 using ::com::sun::star::uno::makeAny
;
55 using ::com::sun::star::uno::XComponentContext
;
56 using ::com::sun::star::uno::Sequence
;
57 using ::com::sun::star::beans::XPropertySetInfo
;
58 using ::com::sun::star::beans::Property
;
59 /** === end UNO using === **/
61 //====================================================================
63 //====================================================================
64 class UnoDialogSkeleton
;
65 typedef ::svt::OGenericUnoDialog UnoDialogSkeleton_Base
;
66 typedef ::comphelper::OPropertyArrayUsageHelper
< UnoDialogSkeleton
> UnoDialogSkeleton_PBase
;
68 class UnoDialogSkeleton
69 :public UnoDialogSkeleton_Base
70 ,public UnoDialogSkeleton_PBase
74 UnoDialogSkeleton( const Reference
< XComponentContext
>& _rxContext
);
77 virtual Sequence
< sal_Int8
> SAL_CALL
getImplementationId() throw(RuntimeException
);
80 virtual ::rtl::OUString SAL_CALL
getImplementationName() throw(RuntimeException
);
81 virtual Sequence
< ::rtl::OUString
> SAL_CALL
getSupportedServiceNames() throw(RuntimeException
);
84 virtual Reference
< XPropertySetInfo
> SAL_CALL
getPropertySetInfo() throw(RuntimeException
);
85 virtual ::cppu::IPropertyArrayHelper
& SAL_CALL
getInfoHelper();
87 // OPropertyArrayUsageHelper
88 virtual ::cppu::IPropertyArrayHelper
* createArrayHelper( ) const;
90 // helper for factories
91 static Reference
< XInterface
> SAL_CALL
Create( const Reference
< XComponentContext
>& _rxContext
);
92 static ::rtl::OUString SAL_CALL
getImplementationName_static() throw(RuntimeException
);
93 static Sequence
< ::rtl::OUString
> SAL_CALL
getSupportedServiceNames_static() throw(RuntimeException
);
99 virtual Dialog
* createDialog( Window
* _pParent
);
100 virtual void destroyDialog();
103 ::comphelper::ComponentContext m_aContext
;
106 //====================================================================
107 //= UnoDialogSkeleton
108 //====================================================================
109 //--------------------------------------------------------------------
110 UnoDialogSkeleton::UnoDialogSkeleton( const Reference
< XComponentContext
>& _rxContext
)
111 :UnoDialogSkeleton_Base( _rxContext
)
112 ,m_aContext( _rxContext
)
116 //--------------------------------------------------------------------
117 UnoDialogSkeleton::~UnoDialogSkeleton()
119 // we do this here cause the base class' call to destroyDialog won't reach us anymore : we're within an dtor,
120 // so this virtual-method-call the base class does does not work, we're already dead then ...
123 ::osl::MutexGuard
aGuard( m_aMutex
);
129 //--------------------------------------------------------------------
130 Reference
< XInterface
> SAL_CALL
UnoDialogSkeleton::Create( const Reference
< XComponentContext
>& _rxContext
)
132 return *(new UnoDialogSkeleton( _rxContext
) );
135 //--------------------------------------------------------------------
136 Dialog
* UnoDialogSkeleton::createDialog( Window
* _pParent
)
138 return new RoadmapSkeletonDialog( m_aContext
, _pParent
);
141 //--------------------------------------------------------------------
142 void UnoDialogSkeleton::destroyDialog()
144 UnoDialogSkeleton_Base::destroyDialog();
147 //--------------------------------------------------------------------
148 Sequence
< sal_Int8
> SAL_CALL
UnoDialogSkeleton::getImplementationId() throw(RuntimeException
)
150 static ::cppu::OImplementationId
* pId
= NULL
;
153 ::osl::MutexGuard
aGuard( ::osl::Mutex::getGlobalMutex() );
156 static ::cppu::OImplementationId aId
;
160 return pId
->getImplementationId();
163 //--------------------------------------------------------------------
164 ::rtl::OUString SAL_CALL
UnoDialogSkeleton::getImplementationName_static() throw(RuntimeException
)
166 return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svtools.workben.UnoDialogSkeleton" ) );
169 //--------------------------------------------------------------------
170 Sequence
< ::rtl::OUString
> SAL_CALL
UnoDialogSkeleton::getSupportedServiceNames_static() throw(RuntimeException
)
172 Sequence
< ::rtl::OUString
> aServices(1);
173 aServices
[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.example.UnoDialogSample" ) );
177 //--------------------------------------------------------------------
178 ::rtl::OUString SAL_CALL
UnoDialogSkeleton::getImplementationName() throw(RuntimeException
)
180 return getImplementationName_static();
183 //--------------------------------------------------------------------
184 Sequence
< ::rtl::OUString
> SAL_CALL
UnoDialogSkeleton::getSupportedServiceNames() throw(RuntimeException
)
186 return getSupportedServiceNames_static();
189 //--------------------------------------------------------------------
190 Reference
< XPropertySetInfo
> SAL_CALL
UnoDialogSkeleton::getPropertySetInfo() throw(RuntimeException
)
192 return createPropertySetInfo( getInfoHelper() );
195 //--------------------------------------------------------------------
196 ::cppu::IPropertyArrayHelper
& SAL_CALL
UnoDialogSkeleton::getInfoHelper()
198 return *const_cast< UnoDialogSkeleton
* >( this )->getArrayHelper();
201 //--------------------------------------------------------------------
202 ::cppu::IPropertyArrayHelper
* UnoDialogSkeleton::createArrayHelper( ) const
204 Sequence
< Property
> aProps
;
205 describeProperties( aProps
);
206 return new ::cppu::OPropertyArrayHelper( aProps
);
209 //--------------------------------------------------------------------
210 void createRegistryInfo_UnoDialogSkeleton()
212 static OAutoRegistration
< UnoDialogSkeleton
> aAutoRegistration
;
215 //........................................................................
217 //........................................................................