LibreOffice Module extensions (master) 1
unoautopilot.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#pragma once
21
25#include <componentmodule.hxx>
27#include <com/sun/star/beans/XPropertySet.hpp>
28#include <com/sun/star/beans/PropertyValue.hpp>
29#include <utility>
30#include <vcl/svapp.hxx>
31
32namespace dbp
33{
35 template <class TYPE>
36 class OUnoAutoPilot final
37 :public OUnoAutoPilot_Base
38 ,public ::comphelper::OPropertyArrayUsageHelper< OUnoAutoPilot< TYPE > >
39 {
40 public:
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),
46 m_SupportedServices(aSupportedServices)
47 {
48 }
49
50
51 // XTypeProvider
52 virtual css::uno::Sequence<sal_Int8> SAL_CALL getImplementationId( ) override
53 {
54 return css::uno::Sequence<sal_Int8>();
55 }
56
57 // XServiceInfo
58 virtual OUString SAL_CALL getImplementationName() override
59 {
61 }
62
63 virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override
64 {
66 }
67
68 // XPropertySet
69 virtual css::uno::Reference< css::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() override
70 {
71 css::uno::Reference< css::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
72 return xInfo;
73 }
74
75 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override
76 {
77 return *this->getArrayHelper();
78 }
79
80 // OPropertyArrayUsageHelper
81 virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override
82 {
83 css::uno::Sequence< css::beans::Property > aProps;
84 describeProperties(aProps);
85 return new ::cppu::OPropertyArrayHelper(aProps);
86 }
87
88 private:
89 // OGenericUnoDialog overridables
90 virtual std::unique_ptr<weld::DialogController> createDialog(const css::uno::Reference<css::awt::XWindow>& rParent) override
91 {
92 return std::make_unique<TYPE>(Application::GetFrameWeld(rParent), m_xObjectModel, m_aContext);
93 }
94
95 virtual void implInitialize(const css::uno::Any& _rValue) override
96 {
97 css::beans::PropertyValue aArgument;
98 if (_rValue >>= aArgument)
99 if (aArgument.Name == "ObjectModel")
100 {
101 aArgument.Value >>= m_xObjectModel;
102 return;
103 }
104
106 }
107
108 css::uno::Reference< css::beans::XPropertySet > m_xObjectModel;
110 css::uno::Sequence<OUString> m_SupportedServices;
111
112 };
113
114} // namespace dbp
115
116
117/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static weld::Window * GetFrameWeld(const css::uno::Reference< css::awt::XWindow > &rWindow)
OUnoAutoPilot(const css::uno::Reference< css::uno::XComponentContext > &_rxORB, OUString aImplementationName, const css::uno::Sequence< OUString > &aSupportedServices)
virtual ::cppu::IPropertyArrayHelper &SAL_CALL getInfoHelper() override
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual ::cppu::IPropertyArrayHelper * createArrayHelper() const override
css::uno::Sequence< OUString > m_SupportedServices
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
virtual void implInitialize(const css::uno::Any &_rValue) override
virtual std::unique_ptr< weld::DialogController > createDialog(const css::uno::Reference< css::awt::XWindow > &rParent) override
virtual OUString SAL_CALL getImplementationName() override
OUString m_ImplementationName
css::uno::Reference< css::beans::XPropertySet > m_xObjectModel
virtual void implInitialize(const css::uno::Any &_rValue)
css::uno::Reference< css::uno::XComponentContext > m_aContext
OUString aImplementationName
::svt::OGenericUnoDialog OUnoAutoPilot_Base