LCOV - code coverage report
Current view: top level - reportdesign/source/ui/inspection - ReportComponentHandler.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 19 80 23.8 %
Date: 2015-06-13 12:38:46 Functions: 7 26 26.9 %
Legend: Lines: hit not hit

          Line data    Source code
       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             :  */
      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"
      35             : 
      36             : 
      37             : namespace rptui
      38             : {
      39             : 
      40             : using namespace ::com::sun::star;
      41             : 
      42           1 : ReportComponentHandler::ReportComponentHandler(uno::Reference< uno::XComponentContext > const & context)
      43             :     :ReportComponentHandler_Base(m_aMutex)
      44             :     ,m_xContext(context)
      45           1 :     ,m_pInfoService( new OPropertyInfoService() )
      46             : {
      47             :     try
      48             :     {
      49           1 :         m_xFormComponentHandler = form::inspection::FormComponentPropertyHandler::create(m_xContext);
      50             : 
      51           0 :     }catch(const uno::Exception &)
      52             :     {
      53             :     }
      54           1 : }
      55             : 
      56           1 : OUString SAL_CALL ReportComponentHandler::getImplementationName(  ) throw(uno::RuntimeException, std::exception)
      57             : {
      58           1 :     return getImplementationName_Static();
      59             : }
      60             : 
      61           0 : sal_Bool SAL_CALL ReportComponentHandler::supportsService( const OUString& ServiceName ) throw(uno::RuntimeException, std::exception)
      62             : {
      63           0 :     return cppu::supportsService(this, ServiceName);
      64             : }
      65             : 
      66           1 : uno::Sequence< OUString > SAL_CALL ReportComponentHandler::getSupportedServiceNames(  ) throw(uno::RuntimeException, std::exception)
      67             : {
      68           1 :     return getSupportedServiceNames_static();
      69             : }
      70             : 
      71           5 : OUString ReportComponentHandler::getImplementationName_Static(  ) throw(uno::RuntimeException)
      72             : {
      73           5 :     return OUString("com.sun.star.comp.report.ReportComponentHandler");
      74             : }
      75             : 
      76           2 : uno::Sequence< OUString > ReportComponentHandler::getSupportedServiceNames_static(  ) throw(uno::RuntimeException)
      77             : {
      78           2 :     uno::Sequence< OUString > aSupported(1);
      79           2 :     aSupported[0] = "com.sun.star.report.inspection.ReportComponentHandler";
      80           2 :     return aSupported;
      81             : }
      82             : 
      83           1 : uno::Reference< uno::XInterface > SAL_CALL ReportComponentHandler::create( const uno::Reference< uno::XComponentContext >& _rxContext )
      84             : {
      85           1 :     return *(new ReportComponentHandler( _rxContext ));
      86             : }
      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           1 : void SAL_CALL ReportComponentHandler::disposing()
      92             : {
      93           1 :     ::comphelper::disposeComponent(m_xFormComponentHandler);
      94           1 : }
      95           0 : void SAL_CALL ReportComponentHandler::addEventListener(const uno::Reference< lang::XEventListener > & xListener) throw (uno::RuntimeException, std::exception)
      96             : {
      97           0 :     m_xFormComponentHandler->addEventListener(xListener);
      98           0 : }
      99             : 
     100           0 : void SAL_CALL ReportComponentHandler::removeEventListener(const uno::Reference< lang::XEventListener > & aListener) throw (uno::RuntimeException, std::exception)
     101             : {
     102           0 :     m_xFormComponentHandler->removeEventListener(aListener);
     103           0 : }
     104             : 
     105             : // inspection::XPropertyHandler:
     106             : 
     107             : /********************************************************************************/
     108           0 : void SAL_CALL ReportComponentHandler::inspect(const uno::Reference< uno::XInterface > & Component) throw (uno::RuntimeException, lang::NullPointerException, std::exception)
     109             : {
     110             :     try
     111             :     {
     112           0 :         uno::Reference< container::XNameContainer > xNameCont(Component,uno::UNO_QUERY);
     113           0 :         const OUString sFormComponent("FormComponent");
     114           0 :         if ( xNameCont->hasByName(sFormComponent) )
     115           0 :             xNameCont->getByName(sFormComponent) >>= m_xFormComponent;
     116           0 :         const OUString sRowSet("RowSet");
     117           0 :         if ( xNameCont->hasByName(sRowSet) )
     118             :         {
     119           0 :             uno::Reference<beans::XPropertySet> xProp(m_xFormComponentHandler,uno::UNO_QUERY);
     120           0 :             xProp->setPropertyValue(sRowSet,xNameCont->getByName(sRowSet));
     121           0 :         }
     122             :     }
     123           0 :     catch(const uno::Exception &)
     124             :     {
     125           0 :         throw lang::NullPointerException();
     126             :     }
     127           0 :     if ( m_xFormComponent.is() )
     128             :     {
     129           0 :         m_xFormComponentHandler->inspect(m_xFormComponent);
     130             :     }
     131           0 : }
     132             : 
     133           0 : uno::Any SAL_CALL ReportComponentHandler::getPropertyValue(const OUString & PropertyName) throw (uno::RuntimeException, beans::UnknownPropertyException, std::exception)
     134             : {
     135           0 :     return m_xFormComponentHandler->getPropertyValue(PropertyName);
     136             : }
     137             : 
     138           0 : void SAL_CALL ReportComponentHandler::setPropertyValue(const OUString & PropertyName, const uno::Any & Value) throw (uno::RuntimeException, beans::UnknownPropertyException, std::exception)
     139             : {
     140           0 :     m_xFormComponentHandler->setPropertyValue(PropertyName, Value);
     141           0 : }
     142             : 
     143           0 : beans::PropertyState SAL_CALL ReportComponentHandler::getPropertyState(const OUString & PropertyName) throw (uno::RuntimeException, beans::UnknownPropertyException, std::exception)
     144             : {
     145           0 :     return m_xFormComponentHandler->getPropertyState(PropertyName);
     146             : }
     147             : 
     148           0 : inspection::LineDescriptor SAL_CALL ReportComponentHandler::describePropertyLine(const OUString & PropertyName,  const uno::Reference< inspection::XPropertyControlFactory > & ControlFactory) throw (beans::UnknownPropertyException, lang::NullPointerException,uno::RuntimeException, std::exception)
     149             : {
     150           0 :     return m_xFormComponentHandler->describePropertyLine(PropertyName, ControlFactory);
     151             : }
     152             : 
     153           0 : uno::Any SAL_CALL ReportComponentHandler::convertToPropertyValue(const OUString & PropertyName, const uno::Any & ControlValue) throw (uno::RuntimeException, beans::UnknownPropertyException, std::exception)
     154             : {
     155           0 :     return m_xFormComponentHandler->convertToPropertyValue(PropertyName, ControlValue);
     156             : }
     157             : 
     158           0 : uno::Any SAL_CALL ReportComponentHandler::convertToControlValue(const OUString & PropertyName, const uno::Any & PropertyValue, const uno::Type & ControlValueType) throw (uno::RuntimeException, beans::UnknownPropertyException, std::exception)
     159             : {
     160           0 :     return m_xFormComponentHandler->convertToControlValue(PropertyName, PropertyValue, ControlValueType);
     161             : }
     162             : 
     163           0 : void SAL_CALL ReportComponentHandler::addPropertyChangeListener(const uno::Reference< beans::XPropertyChangeListener > & Listener) throw (uno::RuntimeException, lang::NullPointerException, std::exception)
     164             : {
     165           0 :     m_xFormComponentHandler->addPropertyChangeListener(Listener);
     166           0 : }
     167             : 
     168           0 : void SAL_CALL ReportComponentHandler::removePropertyChangeListener(const uno::Reference< beans::XPropertyChangeListener > & _rxListener) throw (uno::RuntimeException, std::exception)
     169             : {
     170           0 :     m_xFormComponentHandler->removePropertyChangeListener(_rxListener);
     171           0 : }
     172             : 
     173           0 : uno::Sequence< beans::Property > SAL_CALL ReportComponentHandler::getSupportedProperties() throw (uno::RuntimeException, std::exception)
     174             : {
     175           0 :     ::std::vector< beans::Property > aNewProps;
     176           0 :     rptui::OPropertyInfoService::getExcludeProperties( aNewProps, m_xFormComponentHandler );
     177             : 
     178           0 :     return uno::Sequence< beans::Property >(aNewProps.data(), aNewProps.size());
     179             : }
     180             : 
     181           0 : uno::Sequence< OUString > SAL_CALL ReportComponentHandler::getSupersededProperties() throw (uno::RuntimeException, std::exception)
     182             : {
     183           0 :     uno::Sequence< OUString > aRet;
     184           0 :     return aRet;
     185             : }
     186             : 
     187           0 : uno::Sequence< OUString > SAL_CALL ReportComponentHandler::getActuatingProperties() throw (uno::RuntimeException, std::exception)
     188             : {
     189           0 :     return m_xFormComponentHandler->getActuatingProperties();
     190             : }
     191             : 
     192           0 : sal_Bool SAL_CALL ReportComponentHandler::isComposable( const OUString& _rPropertyName ) throw (uno::RuntimeException, beans::UnknownPropertyException, std::exception)
     193             : {
     194           0 :     return OPropertyInfoService::isComposable( _rPropertyName, m_xFormComponentHandler );
     195             : }
     196             : 
     197           0 : 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)
     198             : {
     199           0 :     return m_xFormComponentHandler->onInteractivePropertySelection(PropertyName, Primary, out_Data, InspectorUI);
     200             : }
     201             : 
     202           0 : 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)
     203             : {
     204           0 :     m_xFormComponentHandler->actuatingPropertyChanged(ActuatingPropertyName, NewValue, OldValue, InspectorUI, FirstTimeInit);
     205           0 : }
     206             : 
     207           0 : sal_Bool SAL_CALL ReportComponentHandler::suspend(sal_Bool Suspend) throw (uno::RuntimeException, std::exception)
     208             : {
     209           0 :     return m_xFormComponentHandler->suspend(Suspend);
     210             : }
     211             : 
     212             : 
     213             : } // namespace rptui
     214             : 
     215             : 
     216             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11