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