bump product version to 5.0.4.1
[LibreOffice.git] / reportdesign / source / ui / inspection / ReportComponentHandler.cxx
blobc7f278f5cc37ba1aed1bd14819ed085a16959c78
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/lang/XInitialization.hpp>
21 #include "uistrings.hrc"
22 #include <comphelper/types.hxx>
23 #include <cppuhelper/supportsservice.hxx>
24 #include <toolkit/helper/vclunohelper.hxx>
25 #include <unotools/syslocale.hxx>
26 #include <com/sun/star/form/inspection/FormComponentPropertyHandler.hpp>
27 #include <com/sun/star/inspection/PropertyControlType.hpp>
28 #include <com/sun/star/report/XReportDefinition.hpp>
29 #include <com/sun/star/report/XSection.hpp>
30 #include <com/sun/star/inspection/XNumericControl.hpp>
31 #include <com/sun/star/container/XNameContainer.hpp>
32 #include <com/sun/star/util/MeasureUnit.hpp>
33 #include <tools/fldunit.hxx>
34 #include "metadata.hxx"
37 namespace rptui
40 using namespace ::com::sun::star;
42 ReportComponentHandler::ReportComponentHandler(uno::Reference< uno::XComponentContext > const & context)
43 :ReportComponentHandler_Base(m_aMutex)
44 ,m_xContext(context)
45 ,m_pInfoService( new OPropertyInfoService() )
47 try
49 m_xFormComponentHandler = form::inspection::FormComponentPropertyHandler::create(m_xContext);
51 }catch(const uno::Exception &)
56 OUString SAL_CALL ReportComponentHandler::getImplementationName( ) throw(uno::RuntimeException, std::exception)
58 return getImplementationName_Static();
61 sal_Bool SAL_CALL ReportComponentHandler::supportsService( const OUString& ServiceName ) throw(uno::RuntimeException, std::exception)
63 return cppu::supportsService(this, ServiceName);
66 uno::Sequence< OUString > SAL_CALL ReportComponentHandler::getSupportedServiceNames( ) throw(uno::RuntimeException, std::exception)
68 return getSupportedServiceNames_static();
71 OUString ReportComponentHandler::getImplementationName_Static( ) throw(uno::RuntimeException)
73 return OUString("com.sun.star.comp.report.ReportComponentHandler");
76 uno::Sequence< OUString > ReportComponentHandler::getSupportedServiceNames_static( ) throw(uno::RuntimeException)
78 uno::Sequence< OUString > aSupported(1);
79 aSupported[0] = "com.sun.star.report.inspection.ReportComponentHandler";
80 return aSupported;
83 uno::Reference< uno::XInterface > SAL_CALL ReportComponentHandler::create( const uno::Reference< uno::XComponentContext >& _rxContext )
85 return *(new ReportComponentHandler( _rxContext ));
87 // override WeakComponentImplHelperBase::disposing()
88 // This function is called upon disposing the component,
89 // if your component needs special work when it becomes
90 // disposed, do it here.
91 void SAL_CALL ReportComponentHandler::disposing()
93 ::comphelper::disposeComponent(m_xFormComponentHandler);
95 void SAL_CALL ReportComponentHandler::addEventListener(const uno::Reference< lang::XEventListener > & xListener) throw (uno::RuntimeException, std::exception)
97 m_xFormComponentHandler->addEventListener(xListener);
100 void SAL_CALL ReportComponentHandler::removeEventListener(const uno::Reference< lang::XEventListener > & aListener) throw (uno::RuntimeException, std::exception)
102 m_xFormComponentHandler->removeEventListener(aListener);
105 // inspection::XPropertyHandler:
107 /********************************************************************************/
108 void SAL_CALL ReportComponentHandler::inspect(const uno::Reference< uno::XInterface > & Component) throw (uno::RuntimeException, lang::NullPointerException, std::exception)
112 uno::Reference< container::XNameContainer > xNameCont(Component,uno::UNO_QUERY);
113 const OUString sFormComponent("FormComponent");
114 if ( xNameCont->hasByName(sFormComponent) )
115 xNameCont->getByName(sFormComponent) >>= m_xFormComponent;
116 const OUString sRowSet("RowSet");
117 if ( xNameCont->hasByName(sRowSet) )
119 uno::Reference<beans::XPropertySet> xProp(m_xFormComponentHandler,uno::UNO_QUERY);
120 xProp->setPropertyValue(sRowSet,xNameCont->getByName(sRowSet));
123 catch(const uno::Exception &)
125 throw lang::NullPointerException();
127 if ( m_xFormComponent.is() )
129 m_xFormComponentHandler->inspect(m_xFormComponent);
133 uno::Any SAL_CALL ReportComponentHandler::getPropertyValue(const OUString & PropertyName) throw (uno::RuntimeException, beans::UnknownPropertyException, std::exception)
135 return m_xFormComponentHandler->getPropertyValue(PropertyName);
138 void SAL_CALL ReportComponentHandler::setPropertyValue(const OUString & PropertyName, const uno::Any & Value) throw (uno::RuntimeException, beans::UnknownPropertyException, std::exception)
140 m_xFormComponentHandler->setPropertyValue(PropertyName, Value);
143 beans::PropertyState SAL_CALL ReportComponentHandler::getPropertyState(const OUString & PropertyName) throw (uno::RuntimeException, beans::UnknownPropertyException, std::exception)
145 return m_xFormComponentHandler->getPropertyState(PropertyName);
148 inspection::LineDescriptor SAL_CALL ReportComponentHandler::describePropertyLine(const OUString & PropertyName, const uno::Reference< inspection::XPropertyControlFactory > & ControlFactory) throw (beans::UnknownPropertyException, lang::NullPointerException,uno::RuntimeException, std::exception)
150 return m_xFormComponentHandler->describePropertyLine(PropertyName, ControlFactory);
153 uno::Any SAL_CALL ReportComponentHandler::convertToPropertyValue(const OUString & PropertyName, const uno::Any & ControlValue) throw (uno::RuntimeException, beans::UnknownPropertyException, std::exception)
155 return m_xFormComponentHandler->convertToPropertyValue(PropertyName, ControlValue);
158 uno::Any SAL_CALL ReportComponentHandler::convertToControlValue(const OUString & PropertyName, const uno::Any & PropertyValue, const uno::Type & ControlValueType) throw (uno::RuntimeException, beans::UnknownPropertyException, std::exception)
160 return m_xFormComponentHandler->convertToControlValue(PropertyName, PropertyValue, ControlValueType);
163 void SAL_CALL ReportComponentHandler::addPropertyChangeListener(const uno::Reference< beans::XPropertyChangeListener > & Listener) throw (uno::RuntimeException, lang::NullPointerException, std::exception)
165 m_xFormComponentHandler->addPropertyChangeListener(Listener);
168 void SAL_CALL ReportComponentHandler::removePropertyChangeListener(const uno::Reference< beans::XPropertyChangeListener > & _rxListener) throw (uno::RuntimeException, std::exception)
170 m_xFormComponentHandler->removePropertyChangeListener(_rxListener);
173 uno::Sequence< beans::Property > SAL_CALL ReportComponentHandler::getSupportedProperties() throw (uno::RuntimeException, std::exception)
175 ::std::vector< beans::Property > aNewProps;
176 rptui::OPropertyInfoService::getExcludeProperties( aNewProps, m_xFormComponentHandler );
178 return uno::Sequence< beans::Property >(aNewProps.data(), aNewProps.size());
181 uno::Sequence< OUString > SAL_CALL ReportComponentHandler::getSupersededProperties() throw (uno::RuntimeException, std::exception)
183 uno::Sequence< OUString > aRet;
184 return aRet;
187 uno::Sequence< OUString > SAL_CALL ReportComponentHandler::getActuatingProperties() throw (uno::RuntimeException, std::exception)
189 return m_xFormComponentHandler->getActuatingProperties();
192 sal_Bool SAL_CALL ReportComponentHandler::isComposable( const OUString& _rPropertyName ) throw (uno::RuntimeException, beans::UnknownPropertyException, std::exception)
194 return OPropertyInfoService::isComposable( _rPropertyName, m_xFormComponentHandler );
197 inspection::InteractiveSelectionResult SAL_CALL ReportComponentHandler::onInteractivePropertySelection(const OUString & PropertyName, sal_Bool Primary, uno::Any & out_Data, const uno::Reference< inspection::XObjectInspectorUI > & InspectorUI) throw (uno::RuntimeException, beans::UnknownPropertyException, lang::NullPointerException, std::exception)
199 return m_xFormComponentHandler->onInteractivePropertySelection(PropertyName, Primary, out_Data, InspectorUI);
202 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) throw (uno::RuntimeException, lang::NullPointerException, std::exception)
204 m_xFormComponentHandler->actuatingPropertyChanged(ActuatingPropertyName, NewValue, OldValue, InspectorUI, FirstTimeInit);
207 sal_Bool SAL_CALL ReportComponentHandler::suspend(sal_Bool Suspend) throw (uno::RuntimeException, std::exception)
209 return m_xFormComponentHandler->suspend(Suspend);
213 } // namespace rptui
216 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */