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 <toolkit/helper/vclunohelper.hxx>
25 #include <comphelper/processfactory.hxx>
26 #include <comphelper/proparrhlp.hxx>
27 #include <componentmodule.hxx>
28 #include <cppuhelper/typeprovider.hxx>
29 #include <com/sun/star/beans/XPropertySet.hpp>
30 #include <com/sun/star/beans/PropertyValue.hpp>
35 typedef ::svt::OGenericUnoDialog OUnoAutoPilot_Base
;
36 template <class TYPE
, class SERVICEINFO
>
37 class OUnoAutoPilot final
38 :public OUnoAutoPilot_Base
39 ,public ::comphelper::OPropertyArrayUsageHelper
< OUnoAutoPilot
< TYPE
, SERVICEINFO
> >
41 explicit OUnoAutoPilot(const css::uno::Reference
< css::uno::XComponentContext
>& _rxORB
)
42 : OUnoAutoPilot_Base(_rxORB
)
47 css::uno::Reference
< css::beans::XPropertySet
> m_xObjectModel
;
51 virtual css::uno::Sequence
<sal_Int8
> SAL_CALL
getImplementationId( ) override
53 return css::uno::Sequence
<sal_Int8
>();
57 virtual OUString SAL_CALL
getImplementationName() override
59 return getImplementationName_Static();
62 virtual css::uno::Sequence
<OUString
> SAL_CALL
getSupportedServiceNames() override
64 return getSupportedServiceNames_Static();
67 // XServiceInfo - static methods
68 /// @throws css::uno::RuntimeException
69 static css::uno::Sequence
< OUString
> getSupportedServiceNames_Static()
71 return SERVICEINFO::getServiceNames();
74 /// @throws css::uno::RuntimeException
75 static OUString
getImplementationName_Static()
77 return SERVICEINFO::getImplementationName();
80 static css::uno::Reference
< css::uno::XInterface
>
81 SAL_CALL
Create(const css::uno::Reference
< css::lang::XMultiServiceFactory
>& _rxFactory
)
83 return *(new OUnoAutoPilot
<TYPE
, SERVICEINFO
>( comphelper::getComponentContext(_rxFactory
) ));
87 virtual css::uno::Reference
< css::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo() override
89 css::uno::Reference
< css::beans::XPropertySetInfo
> xInfo( createPropertySetInfo( getInfoHelper() ) );
93 virtual ::cppu::IPropertyArrayHelper
& SAL_CALL
getInfoHelper() override
95 return *this->getArrayHelper();
98 // OPropertyArrayUsageHelper
99 virtual ::cppu::IPropertyArrayHelper
* createArrayHelper( ) const override
101 css::uno::Sequence
< css::beans::Property
> aProps
;
102 describeProperties(aProps
);
103 return new ::cppu::OPropertyArrayHelper(aProps
);
107 // OGenericUnoDialog overridables
108 virtual svt::OGenericUnoDialog::Dialog
createDialog(const css::uno::Reference
<css::awt::XWindow
>& rParent
) override
110 return svt::OGenericUnoDialog::Dialog(VclPtr
<TYPE
>::Create(VCLUnoHelper::GetWindow(rParent
), m_xObjectModel
, m_aContext
));
113 virtual void implInitialize(const css::uno::Any
& _rValue
) override
115 css::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: */