1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 <unotools/syslocale.hxx>
27 #include <com/sun/star/form/inspection/FormComponentPropertyHandler.hpp>
28 #include <com/sun/star/container/XNameContainer.hpp>
29 #include <com/sun/star/util/MeasureUnit.hpp>
30 #include <tools/fldunit.hxx>
31 #include <metadata.hxx>
37 using namespace ::com::sun::star
;
39 ReportComponentHandler::ReportComponentHandler(uno::Reference
< uno::XComponentContext
> const & context
)
40 :ReportComponentHandler_Base(m_aMutex
)
45 m_xFormComponentHandler
= form::inspection::FormComponentPropertyHandler::create(m_xContext
);
47 }catch(const uno::Exception
&)
52 OUString SAL_CALL
ReportComponentHandler::getImplementationName( )
54 return getImplementationName_Static();
57 sal_Bool SAL_CALL
ReportComponentHandler::supportsService( const OUString
& ServiceName
)
59 return cppu::supportsService(this, ServiceName
);
62 uno::Sequence
< OUString
> SAL_CALL
ReportComponentHandler::getSupportedServiceNames( )
64 return getSupportedServiceNames_static();
67 OUString
ReportComponentHandler::getImplementationName_Static( )
69 return OUString("com.sun.star.comp.report.ReportComponentHandler");
72 uno::Sequence
< OUString
> ReportComponentHandler::getSupportedServiceNames_static( )
74 uno::Sequence
< OUString
> aSupported
{ "com.sun.star.report.inspection.ReportComponentHandler" };
78 uno::Reference
< uno::XInterface
> ReportComponentHandler::create( const uno::Reference
< uno::XComponentContext
>& _rxContext
)
80 return *(new ReportComponentHandler( _rxContext
));
82 // override WeakComponentImplHelperBase::disposing()
83 // This function is called upon disposing the component,
84 // if your component needs special work when it becomes
85 // disposed, do it here.
86 void SAL_CALL
ReportComponentHandler::disposing()
88 ::comphelper::disposeComponent(m_xFormComponentHandler
);
90 void SAL_CALL
ReportComponentHandler::addEventListener(const uno::Reference
< lang::XEventListener
> & xListener
)
92 m_xFormComponentHandler
->addEventListener(xListener
);
95 void SAL_CALL
ReportComponentHandler::removeEventListener(const uno::Reference
< lang::XEventListener
> & aListener
)
97 m_xFormComponentHandler
->removeEventListener(aListener
);
100 // inspection::XPropertyHandler:
102 /********************************************************************************/
103 void SAL_CALL
ReportComponentHandler::inspect(const uno::Reference
< uno::XInterface
> & Component
)
107 uno::Reference
< container::XNameContainer
> xNameCont(Component
,uno::UNO_QUERY
);
108 const OUString
sFormComponent("FormComponent");
109 if ( xNameCont
->hasByName(sFormComponent
) )
110 xNameCont
->getByName(sFormComponent
) >>= m_xFormComponent
;
111 const OUString
sRowSet("RowSet");
112 if ( xNameCont
->hasByName(sRowSet
) )
114 uno::Reference
<beans::XPropertySet
> xProp(m_xFormComponentHandler
,uno::UNO_QUERY
);
115 xProp
->setPropertyValue(sRowSet
,xNameCont
->getByName(sRowSet
));
118 catch(const uno::Exception
&)
120 throw lang::NullPointerException();
122 if ( m_xFormComponent
.is() )
124 m_xFormComponentHandler
->inspect(m_xFormComponent
);
128 uno::Any SAL_CALL
ReportComponentHandler::getPropertyValue(const OUString
& PropertyName
)
130 return m_xFormComponentHandler
->getPropertyValue(PropertyName
);
133 void SAL_CALL
ReportComponentHandler::setPropertyValue(const OUString
& PropertyName
, const uno::Any
& Value
)
135 m_xFormComponentHandler
->setPropertyValue(PropertyName
, Value
);
138 beans::PropertyState SAL_CALL
ReportComponentHandler::getPropertyState(const OUString
& PropertyName
)
140 return m_xFormComponentHandler
->getPropertyState(PropertyName
);
143 inspection::LineDescriptor SAL_CALL
ReportComponentHandler::describePropertyLine(const OUString
& PropertyName
, const uno::Reference
< inspection::XPropertyControlFactory
> & ControlFactory
)
145 return m_xFormComponentHandler
->describePropertyLine(PropertyName
, ControlFactory
);
148 uno::Any SAL_CALL
ReportComponentHandler::convertToPropertyValue(const OUString
& PropertyName
, const uno::Any
& ControlValue
)
150 return m_xFormComponentHandler
->convertToPropertyValue(PropertyName
, ControlValue
);
153 uno::Any SAL_CALL
ReportComponentHandler::convertToControlValue(const OUString
& PropertyName
, const uno::Any
& PropertyValue
, const uno::Type
& ControlValueType
)
155 return m_xFormComponentHandler
->convertToControlValue(PropertyName
, PropertyValue
, ControlValueType
);
158 void SAL_CALL
ReportComponentHandler::addPropertyChangeListener(const uno::Reference
< beans::XPropertyChangeListener
> & Listener
)
160 m_xFormComponentHandler
->addPropertyChangeListener(Listener
);
163 void SAL_CALL
ReportComponentHandler::removePropertyChangeListener(const uno::Reference
< beans::XPropertyChangeListener
> & _rxListener
)
165 m_xFormComponentHandler
->removePropertyChangeListener(_rxListener
);
168 uno::Sequence
< beans::Property
> SAL_CALL
ReportComponentHandler::getSupportedProperties()
170 ::std::vector
< beans::Property
> aNewProps
;
171 rptui::OPropertyInfoService::getExcludeProperties( aNewProps
, m_xFormComponentHandler
);
173 return uno::Sequence
< beans::Property
>(aNewProps
.data(), aNewProps
.size());
176 uno::Sequence
< OUString
> SAL_CALL
ReportComponentHandler::getSupersededProperties()
178 uno::Sequence
< OUString
> aRet
;
182 uno::Sequence
< OUString
> SAL_CALL
ReportComponentHandler::getActuatingProperties()
184 return m_xFormComponentHandler
->getActuatingProperties();
187 sal_Bool SAL_CALL
ReportComponentHandler::isComposable( const OUString
& _rPropertyName
)
189 return OPropertyInfoService::isComposable( _rPropertyName
, m_xFormComponentHandler
);
192 inspection::InteractiveSelectionResult SAL_CALL
ReportComponentHandler::onInteractivePropertySelection(const OUString
& PropertyName
, sal_Bool Primary
, uno::Any
& out_Data
, const uno::Reference
< inspection::XObjectInspectorUI
> & InspectorUI
)
194 return m_xFormComponentHandler
->onInteractivePropertySelection(PropertyName
, Primary
, out_Data
, InspectorUI
);
197 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
)
199 m_xFormComponentHandler
->actuatingPropertyChanged(ActuatingPropertyName
, NewValue
, OldValue
, InspectorUI
, FirstTimeInit
);
202 sal_Bool SAL_CALL
ReportComponentHandler::suspend(sal_Bool Suspend
)
204 return m_xFormComponentHandler
->suspend(Suspend
);
211 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */