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 .
22 #include <svtools/genericunodialog.hxx>
23 #include <comphelper/processfactory.hxx>
24 #include <comphelper/proparrhlp.hxx>
25 #include <componentmodule.hxx>
26 #include <cppuhelper/typeprovider.hxx>
27 #include <com/sun/star/beans/XPropertySet.hpp>
28 #include <com/sun/star/beans/PropertyValue.hpp>
30 #include <vcl/svapp.hxx>
34 typedef ::svt::OGenericUnoDialog OUnoAutoPilot_Base
;
36 class OUnoAutoPilot final
37 :public OUnoAutoPilot_Base
38 ,public ::comphelper::OPropertyArrayUsageHelper
< OUnoAutoPilot
< TYPE
> >
41 explicit OUnoAutoPilot(const css::uno::Reference
< css::uno::XComponentContext
>& _rxORB
,
42 OUString aImplementationName
,
43 const css::uno::Sequence
<OUString
>& aSupportedServices
)
44 : OUnoAutoPilot_Base(_rxORB
),
45 m_ImplementationName(std::move(aImplementationName
)),
46 m_SupportedServices(aSupportedServices
)
52 virtual css::uno::Sequence
<sal_Int8
> SAL_CALL
getImplementationId( ) override
54 return css::uno::Sequence
<sal_Int8
>();
58 virtual OUString SAL_CALL
getImplementationName() override
60 return m_ImplementationName
;
63 virtual css::uno::Sequence
<OUString
> SAL_CALL
getSupportedServiceNames() override
65 return m_SupportedServices
;
69 virtual css::uno::Reference
< css::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo() override
71 css::uno::Reference
< css::beans::XPropertySetInfo
> xInfo( createPropertySetInfo( getInfoHelper() ) );
75 virtual ::cppu::IPropertyArrayHelper
& SAL_CALL
getInfoHelper() override
77 return *this->getArrayHelper();
80 // OPropertyArrayUsageHelper
81 virtual ::cppu::IPropertyArrayHelper
* createArrayHelper( ) const override
83 css::uno::Sequence
< css::beans::Property
> aProps
;
84 describeProperties(aProps
);
85 return new ::cppu::OPropertyArrayHelper(aProps
);
89 // OGenericUnoDialog overridables
90 virtual std::unique_ptr
<weld::DialogController
> createDialog(const css::uno::Reference
<css::awt::XWindow
>& rParent
) override
92 return std::make_unique
<TYPE
>(Application::GetFrameWeld(rParent
), m_xObjectModel
, m_aContext
);
95 virtual void implInitialize(const css::uno::Any
& _rValue
) override
97 css::beans::PropertyValue aArgument
;
98 if (_rValue
>>= aArgument
)
99 if (aArgument
.Name
== "ObjectModel")
101 aArgument
.Value
>>= m_xObjectModel
;
105 OUnoAutoPilot_Base::implInitialize(_rValue
);
108 css::uno::Reference
< css::beans::XPropertySet
> m_xObjectModel
;
109 OUString m_ImplementationName
;
110 css::uno::Sequence
<OUString
> m_SupportedServices
;
117 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */