1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_EXTENSIONS_SOURCE_DBPILOTS_UNOAUTOPILOT_HXX
21 #define INCLUDED_EXTENSIONS_SOURCE_DBPILOTS_UNOAUTOPILOT_HXX
23 #include <svtools/genericunodialog.hxx>
24 #include <comphelper/processfactory.hxx>
25 #include <comphelper/proparrhlp.hxx>
26 #include "componentmodule.hxx"
27 #include <cppuhelper/typeprovider.hxx>
28 #include <com/sun/star/beans/XPropertySet.hpp>
29 #include <com/sun/star/beans/PropertyValue.hpp>
34 typedef ::svt::OGenericUnoDialog OUnoAutoPilot_Base
;
35 template <class TYPE
, class SERVICEINFO
>
37 :public OUnoAutoPilot_Base
38 ,public ::comphelper::OPropertyArrayUsageHelper
< OUnoAutoPilot
< TYPE
, SERVICEINFO
> >
39 ,public OModuleResourceClient
41 OUnoAutoPilot(const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
>& _rxORB
)
42 : OUnoAutoPilot_Base(_rxORB
)
48 ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>
53 virtual ::com::sun::star::uno::Sequence
<sal_Int8
> SAL_CALL
getImplementationId( ) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
55 return css::uno::Sequence
<sal_Int8
>();
59 virtual OUString SAL_CALL
getImplementationName() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
61 return getImplementationName_Static();
64 virtual ::comphelper::StringSequence SAL_CALL
getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
66 return getSupportedServiceNames_Static();
69 // XServiceInfo - static methods
70 static ::com::sun::star::uno::Sequence
< OUString
> getSupportedServiceNames_Static() throw( ::com::sun::star::uno::RuntimeException
)
72 return SERVICEINFO::getServiceNames();
75 static OUString
getImplementationName_Static() throw( ::com::sun::star::uno::RuntimeException
)
77 return SERVICEINFO::getImplementationName();
80 static ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
>
81 SAL_CALL
Create(const ::com::sun::star::uno::Reference
< com::sun::star::lang::XMultiServiceFactory
>& _rxFactory
)
83 return *(new OUnoAutoPilot
<TYPE
, SERVICEINFO
>( comphelper::getComponentContext(_rxFactory
) ));
87 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
89 ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
> xInfo( createPropertySetInfo( getInfoHelper() ) );
93 virtual ::cppu::IPropertyArrayHelper
& SAL_CALL
getInfoHelper() SAL_OVERRIDE
95 return *const_cast<OUnoAutoPilot
*>(this)->getArrayHelper();
98 // OPropertyArrayUsageHelper
99 virtual ::cppu::IPropertyArrayHelper
* createArrayHelper( ) const SAL_OVERRIDE
101 ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::Property
> aProps
;
102 describeProperties(aProps
);
103 return new ::cppu::OPropertyArrayHelper(aProps
);
107 // OGenericUnoDialog overridables
108 virtual VclPtr
<Dialog
> createDialog(vcl::Window
* _pParent
) SAL_OVERRIDE
110 return VclPtr
<TYPE
>::Create(_pParent
, m_xObjectModel
, m_aContext
);
113 virtual void implInitialize(const com::sun::star::uno::Any
& _rValue
) SAL_OVERRIDE
115 ::com::sun::star::beans::PropertyValue aArgument
;
116 if (_rValue
>>= aArgument
)
117 if (aArgument
.Name
== "ObjectModel")
119 aArgument
.Value
>>= m_xObjectModel
;
123 OUnoAutoPilot_Base::implInitialize(_rValue
);
130 #endif // INCLUDED_EXTENSIONS_SOURCE_DBPILOTS_UNOAUTOPILOT_HXX
132 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */