1*5900e8ecSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*5900e8ecSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*5900e8ecSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*5900e8ecSAndrew Rist  * distributed with this work for additional information
6*5900e8ecSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*5900e8ecSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*5900e8ecSAndrew Rist  * "License"); you may not use this file except in compliance
9*5900e8ecSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*5900e8ecSAndrew Rist  *
11*5900e8ecSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*5900e8ecSAndrew Rist  *
13*5900e8ecSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*5900e8ecSAndrew Rist  * software distributed under the License is distributed on an
15*5900e8ecSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*5900e8ecSAndrew Rist  * KIND, either express or implied.  See the License for the
17*5900e8ecSAndrew Rist  * specific language governing permissions and limitations
18*5900e8ecSAndrew Rist  * under the License.
19*5900e8ecSAndrew Rist  *
20*5900e8ecSAndrew Rist  *************************************************************/
21*5900e8ecSAndrew Rist 
22*5900e8ecSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #include "udlg_module.hxx"
25cdf0e10cSrcweir #include "roadmapskeleton.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir /** === begin UNO includes === **/
28cdf0e10cSrcweir /** === end UNO includes === **/
29cdf0e10cSrcweir 
30cdf0e10cSrcweir #include <comphelper/componentcontext.hxx>
31cdf0e10cSrcweir #include "svtools/genericunodialog.hxx"
32cdf0e10cSrcweir 
33cdf0e10cSrcweir //........................................................................
34cdf0e10cSrcweir namespace udlg
35cdf0e10cSrcweir {
36cdf0e10cSrcweir //........................................................................
37cdf0e10cSrcweir 
38cdf0e10cSrcweir 	/** === begin UNO using === **/
39cdf0e10cSrcweir 	using ::com::sun::star::uno::Reference;
40cdf0e10cSrcweir 	using ::com::sun::star::uno::XInterface;
41cdf0e10cSrcweir 	using ::com::sun::star::uno::UNO_QUERY;
42cdf0e10cSrcweir 	using ::com::sun::star::uno::UNO_QUERY_THROW;
43cdf0e10cSrcweir 	using ::com::sun::star::uno::UNO_SET_THROW;
44cdf0e10cSrcweir 	using ::com::sun::star::uno::Exception;
45cdf0e10cSrcweir 	using ::com::sun::star::uno::RuntimeException;
46cdf0e10cSrcweir 	using ::com::sun::star::uno::Any;
47cdf0e10cSrcweir 	using ::com::sun::star::uno::makeAny;
48cdf0e10cSrcweir     using ::com::sun::star::uno::XComponentContext;
49cdf0e10cSrcweir     using ::com::sun::star::uno::Sequence;
50cdf0e10cSrcweir     using ::com::sun::star::beans::XPropertySetInfo;
51cdf0e10cSrcweir     using ::com::sun::star::beans::Property;
52cdf0e10cSrcweir 	/** === end UNO using === **/
53cdf0e10cSrcweir 
54cdf0e10cSrcweir 	//====================================================================
55cdf0e10cSrcweir 	//= UnoDialogSkeleton
56cdf0e10cSrcweir 	//====================================================================
57cdf0e10cSrcweir     class UnoDialogSkeleton;
58cdf0e10cSrcweir     typedef ::svt::OGenericUnoDialog                                                UnoDialogSkeleton_Base;
59cdf0e10cSrcweir     typedef ::comphelper::OPropertyArrayUsageHelper< UnoDialogSkeleton >  UnoDialogSkeleton_PBase;
60cdf0e10cSrcweir 
61cdf0e10cSrcweir     class UnoDialogSkeleton
62cdf0e10cSrcweir                 :public UnoDialogSkeleton_Base
63cdf0e10cSrcweir                 ,public UnoDialogSkeleton_PBase
64cdf0e10cSrcweir                 ,public UdlgClient
65cdf0e10cSrcweir     {
66cdf0e10cSrcweir     public:
67cdf0e10cSrcweir         UnoDialogSkeleton( const Reference< XComponentContext >& _rxContext );
68cdf0e10cSrcweir 
69cdf0e10cSrcweir         // XTypeProvider
70cdf0e10cSrcweir 		virtual Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(RuntimeException);
71cdf0e10cSrcweir 
72cdf0e10cSrcweir 		// XServiceInfo
73cdf0e10cSrcweir 		virtual ::rtl::OUString SAL_CALL getImplementationName() throw(RuntimeException);
74cdf0e10cSrcweir         virtual Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(RuntimeException);
75cdf0e10cSrcweir 
76cdf0e10cSrcweir 	    // XPropertySet
77cdf0e10cSrcweir 	    virtual Reference< XPropertySetInfo >  SAL_CALL getPropertySetInfo() throw(RuntimeException);
78cdf0e10cSrcweir 	    virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
79cdf0e10cSrcweir 
80cdf0e10cSrcweir 	    // OPropertyArrayUsageHelper
81cdf0e10cSrcweir 	    virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
82cdf0e10cSrcweir 
83cdf0e10cSrcweir         // helper for factories
84cdf0e10cSrcweir         static Reference< XInterface > SAL_CALL Create( const Reference< XComponentContext >& _rxContext );
85cdf0e10cSrcweir 		static ::rtl::OUString SAL_CALL getImplementationName_static() throw(RuntimeException);
86cdf0e10cSrcweir         static Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames_static() throw(RuntimeException);
87cdf0e10cSrcweir 
88cdf0e10cSrcweir     protected:
89cdf0e10cSrcweir         ~UnoDialogSkeleton();
90cdf0e10cSrcweir 
91cdf0e10cSrcweir     protected:
92cdf0e10cSrcweir 		virtual Dialog*	createDialog( Window* _pParent );
93cdf0e10cSrcweir 	    virtual void destroyDialog();
94cdf0e10cSrcweir 
95cdf0e10cSrcweir     private:
96cdf0e10cSrcweir         ::comphelper::ComponentContext  m_aContext;
97cdf0e10cSrcweir     };
98cdf0e10cSrcweir 
99cdf0e10cSrcweir 	//====================================================================
100cdf0e10cSrcweir 	//= UnoDialogSkeleton
101cdf0e10cSrcweir 	//====================================================================
102cdf0e10cSrcweir 	//--------------------------------------------------------------------
UnoDialogSkeleton(const Reference<XComponentContext> & _rxContext)103cdf0e10cSrcweir     UnoDialogSkeleton::UnoDialogSkeleton( const Reference< XComponentContext >& _rxContext )
104cdf0e10cSrcweir         :UnoDialogSkeleton_Base( _rxContext )
105cdf0e10cSrcweir         ,m_aContext( _rxContext )
106cdf0e10cSrcweir     {
107cdf0e10cSrcweir     }
108cdf0e10cSrcweir 
109cdf0e10cSrcweir     //--------------------------------------------------------------------
~UnoDialogSkeleton()110cdf0e10cSrcweir     UnoDialogSkeleton::~UnoDialogSkeleton()
111cdf0e10cSrcweir     {
112cdf0e10cSrcweir         // we do this here cause the base class' call to destroyDialog won't reach us anymore : we're within an dtor,
113cdf0e10cSrcweir         // so this virtual-method-call the base class does does not work, we're already dead then ...
114cdf0e10cSrcweir         if ( m_pDialog )
115cdf0e10cSrcweir         {
116cdf0e10cSrcweir             ::osl::MutexGuard aGuard( m_aMutex );
117cdf0e10cSrcweir             if ( m_pDialog )
118cdf0e10cSrcweir                 destroyDialog();
119cdf0e10cSrcweir         }
120cdf0e10cSrcweir     }
121cdf0e10cSrcweir 
122cdf0e10cSrcweir     //--------------------------------------------------------------------
Create(const Reference<XComponentContext> & _rxContext)123cdf0e10cSrcweir     Reference< XInterface > SAL_CALL UnoDialogSkeleton::Create( const Reference< XComponentContext >& _rxContext )
124cdf0e10cSrcweir     {
125cdf0e10cSrcweir         return *(new UnoDialogSkeleton( _rxContext ) );
126cdf0e10cSrcweir     }
127cdf0e10cSrcweir 
128cdf0e10cSrcweir     //--------------------------------------------------------------------
createDialog(Window * _pParent)129cdf0e10cSrcweir 	Dialog*	UnoDialogSkeleton::createDialog( Window* _pParent )
130cdf0e10cSrcweir     {
131cdf0e10cSrcweir         return new RoadmapSkeletonDialog( m_aContext, _pParent );
132cdf0e10cSrcweir     }
133cdf0e10cSrcweir 
134cdf0e10cSrcweir     //--------------------------------------------------------------------
destroyDialog()135cdf0e10cSrcweir     void UnoDialogSkeleton::destroyDialog()
136cdf0e10cSrcweir     {
137cdf0e10cSrcweir 	    UnoDialogSkeleton_Base::destroyDialog();
138cdf0e10cSrcweir     }
139cdf0e10cSrcweir 
140cdf0e10cSrcweir     //--------------------------------------------------------------------
getImplementationId()141cdf0e10cSrcweir     Sequence< sal_Int8 > SAL_CALL UnoDialogSkeleton::getImplementationId() throw(RuntimeException)
142cdf0e10cSrcweir     {
143cdf0e10cSrcweir         static ::cppu::OImplementationId* pId = NULL;
144cdf0e10cSrcweir         if ( !pId )
145cdf0e10cSrcweir         {
146cdf0e10cSrcweir             ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
147cdf0e10cSrcweir             if ( !pId )
148cdf0e10cSrcweir             {
149cdf0e10cSrcweir                 static ::cppu::OImplementationId aId;
150cdf0e10cSrcweir                 pId = &aId;
151cdf0e10cSrcweir             }
152cdf0e10cSrcweir         }
153cdf0e10cSrcweir         return pId->getImplementationId();
154cdf0e10cSrcweir     }
155cdf0e10cSrcweir 
156cdf0e10cSrcweir     //--------------------------------------------------------------------
getImplementationName_static()157cdf0e10cSrcweir     ::rtl::OUString SAL_CALL UnoDialogSkeleton::getImplementationName_static() throw(RuntimeException)
158cdf0e10cSrcweir     {
159cdf0e10cSrcweir         return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svtools.workben.UnoDialogSkeleton" ) );
160cdf0e10cSrcweir     }
161cdf0e10cSrcweir 
162cdf0e10cSrcweir     //--------------------------------------------------------------------
getSupportedServiceNames_static()163cdf0e10cSrcweir     Sequence< ::rtl::OUString > SAL_CALL UnoDialogSkeleton::getSupportedServiceNames_static() throw(RuntimeException)
164cdf0e10cSrcweir     {
165cdf0e10cSrcweir         Sequence< ::rtl::OUString > aServices(1);
166cdf0e10cSrcweir         aServices[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.example.UnoDialogSample" ) );
167cdf0e10cSrcweir         return aServices;
168cdf0e10cSrcweir     }
169cdf0e10cSrcweir 
170cdf0e10cSrcweir     //--------------------------------------------------------------------
getImplementationName()171cdf0e10cSrcweir     ::rtl::OUString SAL_CALL UnoDialogSkeleton::getImplementationName() throw(RuntimeException)
172cdf0e10cSrcweir     {
173cdf0e10cSrcweir         return getImplementationName_static();
174cdf0e10cSrcweir     }
175cdf0e10cSrcweir 
176cdf0e10cSrcweir     //--------------------------------------------------------------------
getSupportedServiceNames()177cdf0e10cSrcweir     Sequence< ::rtl::OUString > SAL_CALL UnoDialogSkeleton::getSupportedServiceNames() throw(RuntimeException)
178cdf0e10cSrcweir     {
179cdf0e10cSrcweir         return getSupportedServiceNames_static();
180cdf0e10cSrcweir     }
181cdf0e10cSrcweir 
182cdf0e10cSrcweir     //--------------------------------------------------------------------
getPropertySetInfo()183cdf0e10cSrcweir 	Reference< XPropertySetInfo > SAL_CALL UnoDialogSkeleton::getPropertySetInfo() throw(RuntimeException)
184cdf0e10cSrcweir     {
185cdf0e10cSrcweir 	    return createPropertySetInfo( getInfoHelper() );
186cdf0e10cSrcweir     }
187cdf0e10cSrcweir 
188cdf0e10cSrcweir     //--------------------------------------------------------------------
getInfoHelper()189cdf0e10cSrcweir 	::cppu::IPropertyArrayHelper& SAL_CALL UnoDialogSkeleton::getInfoHelper()
190cdf0e10cSrcweir     {
191cdf0e10cSrcweir     	return *const_cast< UnoDialogSkeleton* >( this )->getArrayHelper();
192cdf0e10cSrcweir     }
193cdf0e10cSrcweir 
194cdf0e10cSrcweir     //--------------------------------------------------------------------
createArrayHelper() const195cdf0e10cSrcweir 	::cppu::IPropertyArrayHelper* UnoDialogSkeleton::createArrayHelper( ) const
196cdf0e10cSrcweir     {
197cdf0e10cSrcweir 	    Sequence< Property > aProps;
198cdf0e10cSrcweir 	    describeProperties( aProps );
199cdf0e10cSrcweir 	    return new ::cppu::OPropertyArrayHelper( aProps );
200cdf0e10cSrcweir     }
201cdf0e10cSrcweir 
202cdf0e10cSrcweir     //--------------------------------------------------------------------
createRegistryInfo_UnoDialogSkeleton()203cdf0e10cSrcweir     void createRegistryInfo_UnoDialogSkeleton()
204cdf0e10cSrcweir     {
205cdf0e10cSrcweir         static OAutoRegistration< UnoDialogSkeleton > aAutoRegistration;
206cdf0e10cSrcweir     }
207cdf0e10cSrcweir 
208cdf0e10cSrcweir //........................................................................
209cdf0e10cSrcweir } // namespace udlg
210cdf0e10cSrcweir //........................................................................
211