Bump version to 6.0-36
[LibreOffice.git] / reportdesign / source / ui / inspection / ReportComponentHandler.cxx
bloba929f4c286c859949c5487d1359227bfd4251aae
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
19 #include <ReportComponentHandler.hxx>
20 #include <com/sun/star/beans/XPropertySet.hpp>
21 #include <com/sun/star/lang/NullPointerException.hpp>
22 #include <com/sun/star/lang/XInitialization.hpp>
23 #include <strings.hxx>
24 #include <comphelper/types.hxx>
25 #include <cppuhelper/supportsservice.hxx>
26 #include <toolkit/helper/vclunohelper.hxx>
27 #include <unotools/syslocale.hxx>
28 #include <com/sun/star/form/inspection/FormComponentPropertyHandler.hpp>
29 #include <com/sun/star/container/XNameContainer.hpp>
30 #include <com/sun/star/util/MeasureUnit.hpp>
31 #include <tools/fldunit.hxx>
32 #include <metadata.hxx>
35 namespace rptui
38 using namespace ::com::sun::star;
40 ReportComponentHandler::ReportComponentHandler(uno::Reference< uno::XComponentContext > const & context)
41 :ReportComponentHandler_Base(m_aMutex)
42 ,m_xContext(context)
44 try
46 m_xFormComponentHandler = form::inspection::FormComponentPropertyHandler::create(m_xContext);
48 }catch(const uno::Exception &)
53 OUString SAL_CALL ReportComponentHandler::getImplementationName( )
55 return getImplementationName_Static();
58 sal_Bool SAL_CALL ReportComponentHandler::supportsService( const OUString& ServiceName )
60 return cppu::supportsService(this, ServiceName);
63 uno::Sequence< OUString > SAL_CALL ReportComponentHandler::getSupportedServiceNames( )
65 return getSupportedServiceNames_static();
68 OUString ReportComponentHandler::getImplementationName_Static( )
70 return OUString("com.sun.star.comp.report.ReportComponentHandler");
73 uno::Sequence< OUString > ReportComponentHandler::getSupportedServiceNames_static( )
75 uno::Sequence< OUString > aSupported { "com.sun.star.report.inspection.ReportComponentHandler" };
76 return aSupported;
79 uno::Reference< uno::XInterface > SAL_CALL ReportComponentHandler::create( const uno::Reference< uno::XComponentContext >& _rxContext )
81 return *(new ReportComponentHandler( _rxContext ));
83 // override WeakComponentImplHelperBase::disposing()
84 // This function is called upon disposing the component,
85 // if your component needs special work when it becomes
86 // disposed, do it here.
87 void SAL_CALL ReportComponentHandler::disposing()
89 ::comphelper::disposeComponent(m_xFormComponentHandler);
91 void SAL_CALL ReportComponentHandler::addEventListener(const uno::Reference< lang::XEventListener > & xListener)
93 m_xFormComponentHandler->addEventListener(xListener);
96 void SAL_CALL ReportComponentHandler::removeEventListener(const uno::Reference< lang::XEventListener > & aListener)
98 m_xFormComponentHandler->removeEventListener(aListener);
101 // inspection::XPropertyHandler:
103 /********************************************************************************/
104 void SAL_CALL ReportComponentHandler::inspect(const uno::Reference< uno::XInterface > & Component)
108 uno::Reference< container::XNameContainer > xNameCont(Component,uno::UNO_QUERY);
109 const OUString sFormComponent("FormComponent");
110 if ( xNameCont->hasByName(sFormComponent) )
111 xNameCont->getByName(sFormComponent) >>= m_xFormComponent;
112 const OUString sRowSet("RowSet");
113 if ( xNameCont->hasByName(sRowSet) )
115 uno::Reference<beans::XPropertySet> xProp(m_xFormComponentHandler,uno::UNO_QUERY);
116 xProp->setPropertyValue(sRowSet,xNameCont->getByName(sRowSet));
119 catch(const uno::Exception &)
121 throw lang::NullPointerException();
123 if ( m_xFormComponent.is() )
125 m_xFormComponentHandler->inspect(m_xFormComponent);
129 uno::Any SAL_CALL ReportComponentHandler::getPropertyValue(const OUString & PropertyName)
131 return m_xFormComponentHandler->getPropertyValue(PropertyName);
134 void SAL_CALL ReportComponentHandler::setPropertyValue(const OUString & PropertyName, const uno::Any & Value)
136 m_xFormComponentHandler->setPropertyValue(PropertyName, Value);
139 beans::PropertyState SAL_CALL ReportComponentHandler::getPropertyState(const OUString & PropertyName)
141 return m_xFormComponentHandler->getPropertyState(PropertyName);
144 inspection::LineDescriptor SAL_CALL ReportComponentHandler::describePropertyLine(const OUString & PropertyName, const uno::Reference< inspection::XPropertyControlFactory > & ControlFactory)
146 return m_xFormComponentHandler->describePropertyLine(PropertyName, ControlFactory);
149 uno::Any SAL_CALL ReportComponentHandler::convertToPropertyValue(const OUString & PropertyName, const uno::Any & ControlValue)
151 return m_xFormComponentHandler->convertToPropertyValue(PropertyName, ControlValue);
154 uno::Any SAL_CALL ReportComponentHandler::convertToControlValue(const OUString & PropertyName, const uno::Any & PropertyValue, const uno::Type & ControlValueType)
156 return m_xFormComponentHandler->convertToControlValue(PropertyName, PropertyValue, ControlValueType);
159 void SAL_CALL ReportComponentHandler::addPropertyChangeListener(const uno::Reference< beans::XPropertyChangeListener > & Listener)
161 m_xFormComponentHandler->addPropertyChangeListener(Listener);
164 void SAL_CALL ReportComponentHandler::removePropertyChangeListener(const uno::Reference< beans::XPropertyChangeListener > & _rxListener)
166 m_xFormComponentHandler->removePropertyChangeListener(_rxListener);
169 uno::Sequence< beans::Property > SAL_CALL ReportComponentHandler::getSupportedProperties()
171 ::std::vector< beans::Property > aNewProps;
172 rptui::OPropertyInfoService::getExcludeProperties( aNewProps, m_xFormComponentHandler );
174 return uno::Sequence< beans::Property >(aNewProps.data(), aNewProps.size());
177 uno::Sequence< OUString > SAL_CALL ReportComponentHandler::getSupersededProperties()
179 uno::Sequence< OUString > aRet;
180 return aRet;
183 uno::Sequence< OUString > SAL_CALL ReportComponentHandler::getActuatingProperties()
185 return m_xFormComponentHandler->getActuatingProperties();
188 sal_Bool SAL_CALL ReportComponentHandler::isComposable( const OUString& _rPropertyName )
190 return OPropertyInfoService::isComposable( _rPropertyName, m_xFormComponentHandler );
193 inspection::InteractiveSelectionResult SAL_CALL ReportComponentHandler::onInteractivePropertySelection(const OUString & PropertyName, sal_Bool Primary, uno::Any & out_Data, const uno::Reference< inspection::XObjectInspectorUI > & InspectorUI)
195 return m_xFormComponentHandler->onInteractivePropertySelection(PropertyName, Primary, out_Data, InspectorUI);
198 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)
200 m_xFormComponentHandler->actuatingPropertyChanged(ActuatingPropertyName, NewValue, OldValue, InspectorUI, FirstTimeInit);
203 sal_Bool SAL_CALL ReportComponentHandler::suspend(sal_Bool Suspend)
205 return m_xFormComponentHandler->suspend(Suspend);
209 } // namespace rptui
212 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */