LibreOffice Module reportdesign (master) 1
ReportComponentHandler.cxx
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 */
20#include <com/sun/star/beans/XPropertySet.hpp>
21#include <com/sun/star/lang/NullPointerException.hpp>
22#include <comphelper/types.hxx>
24#include <com/sun/star/form/inspection/FormComponentPropertyHandler.hpp>
25#include <com/sun/star/container/XNameContainer.hpp>
26#include <metadata.hxx>
27#include <utility>
28
29
30namespace rptui
31{
32
33using namespace ::com::sun::star;
34
35ReportComponentHandler::ReportComponentHandler(uno::Reference< uno::XComponentContext > context)
37 ,m_xContext(std::move(context))
38{
39 try
40 {
41 m_xFormComponentHandler = form::inspection::FormComponentPropertyHandler::create(m_xContext);
42
43 }catch(const uno::Exception &)
44 {
45 }
46}
47
48OUString SAL_CALL ReportComponentHandler::getImplementationName( )
49{
50 return "com.sun.star.comp.report.ReportComponentHandler";
51}
52
53sal_Bool SAL_CALL ReportComponentHandler::supportsService( const OUString& ServiceName )
54{
56}
57
58uno::Sequence< OUString > SAL_CALL ReportComponentHandler::getSupportedServiceNames( )
59{
60 return { "com.sun.star.report.inspection.ReportComponentHandler" };
61}
62
63// override WeakComponentImplHelperBase::disposing()
64// This function is called upon disposing the component,
65// if your component needs special work when it becomes
66// disposed, do it here.
67void SAL_CALL ReportComponentHandler::disposing()
68{
69 ::comphelper::disposeComponent(m_xFormComponentHandler);
70}
71void SAL_CALL ReportComponentHandler::addEventListener(const uno::Reference< lang::XEventListener > & xListener)
72{
73 m_xFormComponentHandler->addEventListener(xListener);
74}
75
76void SAL_CALL ReportComponentHandler::removeEventListener(const uno::Reference< lang::XEventListener > & aListener)
77{
78 m_xFormComponentHandler->removeEventListener(aListener);
79}
80
81// inspection::XPropertyHandler:
82
83/********************************************************************************/
84void SAL_CALL ReportComponentHandler::inspect(const uno::Reference< uno::XInterface > & Component)
85{
86 try
87 {
88 uno::Reference< container::XNameContainer > xNameCont(Component,uno::UNO_QUERY);
89 static constexpr OUStringLiteral sFormComponent(u"FormComponent");
90 if ( xNameCont->hasByName(sFormComponent) )
91 xNameCont->getByName(sFormComponent) >>= m_xFormComponent;
92 static constexpr OUStringLiteral sRowSet(u"RowSet");
93 if ( xNameCont->hasByName(sRowSet) )
94 {
95 uno::Reference<beans::XPropertySet> xProp(m_xFormComponentHandler,uno::UNO_QUERY);
96 xProp->setPropertyValue(sRowSet,xNameCont->getByName(sRowSet));
97 }
98 }
99 catch(const uno::Exception &)
100 {
101 throw lang::NullPointerException();
102 }
103 if ( m_xFormComponent.is() )
104 {
105 m_xFormComponentHandler->inspect(m_xFormComponent);
106 }
107}
108
109uno::Any SAL_CALL ReportComponentHandler::getPropertyValue(const OUString & PropertyName)
110{
111 return m_xFormComponentHandler->getPropertyValue(PropertyName);
112}
113
114void SAL_CALL ReportComponentHandler::setPropertyValue(const OUString & PropertyName, const uno::Any & Value)
115{
116 m_xFormComponentHandler->setPropertyValue(PropertyName, Value);
117}
118
119beans::PropertyState SAL_CALL ReportComponentHandler::getPropertyState(const OUString & PropertyName)
120{
121 return m_xFormComponentHandler->getPropertyState(PropertyName);
122}
123
124inspection::LineDescriptor SAL_CALL ReportComponentHandler::describePropertyLine(const OUString & PropertyName, const uno::Reference< inspection::XPropertyControlFactory > & ControlFactory)
125{
126 return m_xFormComponentHandler->describePropertyLine(PropertyName, ControlFactory);
127}
128
129uno::Any SAL_CALL ReportComponentHandler::convertToPropertyValue(const OUString & PropertyName, const uno::Any & ControlValue)
130{
131 return m_xFormComponentHandler->convertToPropertyValue(PropertyName, ControlValue);
132}
133
134uno::Any SAL_CALL ReportComponentHandler::convertToControlValue(const OUString & PropertyName, const uno::Any & PropertyValue, const uno::Type & ControlValueType)
135{
136 return m_xFormComponentHandler->convertToControlValue(PropertyName, PropertyValue, ControlValueType);
137}
138
139void SAL_CALL ReportComponentHandler::addPropertyChangeListener(const uno::Reference< beans::XPropertyChangeListener > & Listener)
140{
141 m_xFormComponentHandler->addPropertyChangeListener(Listener);
142}
143
144void SAL_CALL ReportComponentHandler::removePropertyChangeListener(const uno::Reference< beans::XPropertyChangeListener > & _rxListener)
145{
146 m_xFormComponentHandler->removePropertyChangeListener(_rxListener);
147}
148
149uno::Sequence< beans::Property > SAL_CALL ReportComponentHandler::getSupportedProperties()
150{
151 ::std::vector< beans::Property > aNewProps;
152 rptui::OPropertyInfoService::getExcludeProperties( aNewProps, m_xFormComponentHandler );
153
154 return uno::Sequence< beans::Property >(aNewProps.data(), aNewProps.size());
155}
156
157uno::Sequence< OUString > SAL_CALL ReportComponentHandler::getSupersededProperties()
158{
159 uno::Sequence< OUString > aRet;
160 return aRet;
161}
162
163uno::Sequence< OUString > SAL_CALL ReportComponentHandler::getActuatingProperties()
164{
165 return m_xFormComponentHandler->getActuatingProperties();
166}
167
168sal_Bool SAL_CALL ReportComponentHandler::isComposable( const OUString& _rPropertyName )
169{
170 return OPropertyInfoService::isComposable( _rPropertyName, m_xFormComponentHandler );
171}
172
173inspection::InteractiveSelectionResult SAL_CALL ReportComponentHandler::onInteractivePropertySelection(const OUString & PropertyName, sal_Bool Primary, uno::Any & out_Data, const uno::Reference< inspection::XObjectInspectorUI > & InspectorUI)
174{
175 return m_xFormComponentHandler->onInteractivePropertySelection(PropertyName, Primary, out_Data, InspectorUI);
176}
177
178void SAL_CALL ReportComponentHandler::actuatingPropertyChanged(const OUString & ActuatingPropertyName, const uno::Any & NewValue, const uno::Any & OldValue, const uno::Reference< inspection::XObjectInspectorUI > & InspectorUI, sal_Bool FirstTimeInit)
179{
180 m_xFormComponentHandler->actuatingPropertyChanged(ActuatingPropertyName, NewValue, OldValue, InspectorUI, FirstTimeInit);
181}
182
183sal_Bool SAL_CALL ReportComponentHandler::suspend(sal_Bool Suspend)
184{
185 return m_xFormComponentHandler->suspend(Suspend);
186}
187
188
189} // namespace rptui
190
191
192extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
194 css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&)
195{
196 return cppu::acquire(new rptui::ReportComponentHandler(context));
197}
198
199
200/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Reference< XComponentContext > m_xContext
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * reportdesign_ReportComponentHandler_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
static void getExcludeProperties(::std::vector< css::beans::Property > &_rExcludeProperties, const css::uno::Reference< css::inspection::XPropertyHandler > &_xFormComponentHandler)
Definition: metadata.cxx:219
ReportComponentHandler(css::uno::Reference< css::uno::XComponentContext > context)
float u
std::mutex m_aMutex
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
Value
::cppu::WeakComponentImplHelper< css::inspection::XPropertyHandler, css::lang::XServiceInfo > ReportComponentHandler_Base
::std::pair< MetaAction *, int > Component
unsigned char sal_Bool