LCOV - code coverage report
Current view: top level - libreoffice/reportdesign/source/ui/inspection - ReportComponentHandler.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 80 0.0 %
Date: 2012-12-27 Functions: 0 26 0.0 %
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 <comphelper/sequence.hxx>
      22             : #include "uistrings.hrc"
      23             : #include <comphelper/types.hxx>
      24             : #include <toolkit/helper/vclunohelper.hxx>
      25             : #include <unotools/syslocale.hxx>
      26             : #include <com/sun/star/inspection/PropertyControlType.hpp>
      27             : #include <com/sun/star/report/XReportDefinition.hpp>
      28             : #include <com/sun/star/report/XSection.hpp>
      29             : #include <com/sun/star/inspection/XNumericControl.hpp>
      30             : #include <com/sun/star/container/XNameContainer.hpp>
      31             : #include <com/sun/star/util/MeasureUnit.hpp>
      32             : #include <tools/fldunit.hxx>
      33             : #include "metadata.hxx"
      34             : 
      35             : //........................................................................
      36             : namespace rptui
      37             : {
      38             : //........................................................................
      39             : using namespace ::com::sun::star;
      40             : 
      41           0 : ReportComponentHandler::ReportComponentHandler(uno::Reference< uno::XComponentContext > const & context)
      42             :     :ReportComponentHandler_Base(m_aMutex)
      43             :     ,m_xContext(context)
      44           0 :     ,m_pInfoService( new OPropertyInfoService() )
      45             : {
      46             :     try
      47             :     {
      48           0 :         m_xFormComponentHandler.set(m_xContext->getServiceManager()->createInstanceWithContext(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.form.inspection.FormComponentPropertyHandler")),m_xContext),uno::UNO_QUERY_THROW);
      49             : 
      50           0 :     }catch(const uno::Exception &)
      51             :     {
      52             :     }
      53           0 : }
      54             : 
      55             : //------------------------------------------------------------------------
      56           0 : ::rtl::OUString SAL_CALL ReportComponentHandler::getImplementationName(  ) throw(uno::RuntimeException)
      57             : {
      58           0 :     return getImplementationName_Static();
      59             : }
      60             : 
      61             : //------------------------------------------------------------------------
      62           0 : sal_Bool SAL_CALL ReportComponentHandler::supportsService( const ::rtl::OUString& ServiceName ) throw(uno::RuntimeException)
      63             : {
      64           0 :     return ::comphelper::existsValue(ServiceName,getSupportedServiceNames_static());
      65             : }
      66             : 
      67             : //------------------------------------------------------------------------
      68           0 : uno::Sequence< ::rtl::OUString > SAL_CALL ReportComponentHandler::getSupportedServiceNames(  ) throw(uno::RuntimeException)
      69             : {
      70           0 :     return getSupportedServiceNames_static();
      71             : }
      72             : 
      73             : //------------------------------------------------------------------------
      74           0 : ::rtl::OUString ReportComponentHandler::getImplementationName_Static(  ) throw(uno::RuntimeException)
      75             : {
      76           0 :     return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.report.ReportComponentHandler"));
      77             : }
      78             : 
      79             : //------------------------------------------------------------------------
      80           0 : uno::Sequence< ::rtl::OUString > ReportComponentHandler::getSupportedServiceNames_static(  ) throw(uno::RuntimeException)
      81             : {
      82           0 :     uno::Sequence< ::rtl::OUString > aSupported(1);
      83           0 :     aSupported[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.report.inspection.ReportComponentHandler"));
      84           0 :     return aSupported;
      85             : }
      86             : 
      87             : //------------------------------------------------------------------------
      88           0 : uno::Reference< uno::XInterface > SAL_CALL ReportComponentHandler::create( const uno::Reference< uno::XComponentContext >& _rxContext )
      89             : {
      90           0 :     return *(new ReportComponentHandler( _rxContext ));
      91             : }
      92             : // overload WeakComponentImplHelperBase::disposing()
      93             : // This function is called upon disposing the component,
      94             : // if your component needs special work when it becomes
      95             : // disposed, do it here.
      96           0 : void SAL_CALL ReportComponentHandler::disposing()
      97             : {
      98           0 :     ::comphelper::disposeComponent(m_xFormComponentHandler);
      99           0 : }
     100           0 : void SAL_CALL ReportComponentHandler::addEventListener(const uno::Reference< lang::XEventListener > & xListener) throw (uno::RuntimeException)
     101             : {
     102           0 :     m_xFormComponentHandler->addEventListener(xListener);
     103           0 : }
     104             : 
     105           0 : void SAL_CALL ReportComponentHandler::removeEventListener(const uno::Reference< lang::XEventListener > & aListener) throw (uno::RuntimeException)
     106             : {
     107           0 :     m_xFormComponentHandler->removeEventListener(aListener);
     108           0 : }
     109             : 
     110             : // inspection::XPropertyHandler:
     111             : 
     112             : /********************************************************************************/
     113           0 : void SAL_CALL ReportComponentHandler::inspect(const uno::Reference< uno::XInterface > & Component) throw (uno::RuntimeException, lang::NullPointerException)
     114             : {
     115             :     try
     116             :     {
     117           0 :         uno::Reference< container::XNameContainer > xNameCont(Component,uno::UNO_QUERY);
     118           0 :         const ::rtl::OUString sFormComponent(RTL_CONSTASCII_USTRINGPARAM("FormComponent"));
     119           0 :         if ( xNameCont->hasByName(sFormComponent) )
     120           0 :             xNameCont->getByName(sFormComponent) >>= m_xFormComponent;
     121           0 :         const ::rtl::OUString sRowSet(RTL_CONSTASCII_USTRINGPARAM("RowSet"));
     122           0 :         if ( xNameCont->hasByName(sRowSet) )
     123             :         {
     124           0 :             uno::Reference<beans::XPropertySet> xProp(m_xFormComponentHandler,uno::UNO_QUERY);
     125           0 :             xProp->setPropertyValue(sRowSet,xNameCont->getByName(sRowSet));
     126           0 :         }
     127             :     }
     128           0 :     catch(const uno::Exception &)
     129             :     {
     130           0 :         throw lang::NullPointerException();
     131             :     }
     132           0 :     if ( m_xFormComponent.is() )
     133             :     {
     134           0 :         m_xFormComponentHandler->inspect(m_xFormComponent);
     135             :     }
     136           0 : }
     137             : 
     138           0 : uno::Any SAL_CALL ReportComponentHandler::getPropertyValue(const ::rtl::OUString & PropertyName) throw (uno::RuntimeException, beans::UnknownPropertyException)
     139             : {
     140           0 :     return m_xFormComponentHandler->getPropertyValue(PropertyName);
     141             : }
     142             : 
     143           0 : void SAL_CALL ReportComponentHandler::setPropertyValue(const ::rtl::OUString & PropertyName, const uno::Any & Value) throw (uno::RuntimeException, beans::UnknownPropertyException)
     144             : {
     145           0 :     m_xFormComponentHandler->setPropertyValue(PropertyName, Value);
     146           0 : }
     147             : 
     148           0 : beans::PropertyState SAL_CALL ReportComponentHandler::getPropertyState(const ::rtl::OUString & PropertyName) throw (uno::RuntimeException, beans::UnknownPropertyException)
     149             : {
     150           0 :     return m_xFormComponentHandler->getPropertyState(PropertyName);
     151             : }
     152             : 
     153           0 : inspection::LineDescriptor SAL_CALL ReportComponentHandler::describePropertyLine(const ::rtl::OUString & PropertyName,  const uno::Reference< inspection::XPropertyControlFactory > & ControlFactory) throw (beans::UnknownPropertyException, lang::NullPointerException,uno::RuntimeException)
     154             : {
     155           0 :     return m_xFormComponentHandler->describePropertyLine(PropertyName, ControlFactory);
     156             : }
     157             : 
     158           0 : uno::Any SAL_CALL ReportComponentHandler::convertToPropertyValue(const ::rtl::OUString & PropertyName, const uno::Any & ControlValue) throw (uno::RuntimeException, beans::UnknownPropertyException)
     159             : {
     160           0 :     return m_xFormComponentHandler->convertToPropertyValue(PropertyName, ControlValue);
     161             : }
     162             : 
     163           0 : uno::Any SAL_CALL ReportComponentHandler::convertToControlValue(const ::rtl::OUString & PropertyName, const uno::Any & PropertyValue, const uno::Type & ControlValueType) throw (uno::RuntimeException, beans::UnknownPropertyException)
     164             : {
     165           0 :     return m_xFormComponentHandler->convertToControlValue(PropertyName, PropertyValue, ControlValueType);
     166             : }
     167             : 
     168           0 : void SAL_CALL ReportComponentHandler::addPropertyChangeListener(const uno::Reference< beans::XPropertyChangeListener > & Listener) throw (uno::RuntimeException, lang::NullPointerException)
     169             : {
     170           0 :     m_xFormComponentHandler->addPropertyChangeListener(Listener);
     171           0 : }
     172             : 
     173           0 : void SAL_CALL ReportComponentHandler::removePropertyChangeListener(const uno::Reference< beans::XPropertyChangeListener > & _rxListener) throw (uno::RuntimeException)
     174             : {
     175           0 :     m_xFormComponentHandler->removePropertyChangeListener(_rxListener);
     176           0 : }
     177             : 
     178           0 : uno::Sequence< beans::Property > SAL_CALL ReportComponentHandler::getSupportedProperties() throw (uno::RuntimeException)
     179             : {
     180           0 :     ::std::vector< beans::Property > aNewProps;
     181           0 :     m_pInfoService->getExcludeProperties( aNewProps, m_xFormComponentHandler );
     182             : 
     183           0 :     return aNewProps.empty() ? uno::Sequence< beans::Property > () : uno::Sequence< beans::Property > (&(*aNewProps.begin()),aNewProps.size());
     184             : }
     185             : 
     186           0 : uno::Sequence< ::rtl::OUString > SAL_CALL ReportComponentHandler::getSupersededProperties() throw (uno::RuntimeException)
     187             : {
     188           0 :     uno::Sequence< ::rtl::OUString > aRet;
     189           0 :     return aRet;
     190             : }
     191             : 
     192           0 : uno::Sequence< ::rtl::OUString > SAL_CALL ReportComponentHandler::getActuatingProperties() throw (uno::RuntimeException)
     193             : {
     194           0 :     return m_xFormComponentHandler->getActuatingProperties();
     195             : }
     196             : 
     197           0 : ::sal_Bool SAL_CALL ReportComponentHandler::isComposable( const ::rtl::OUString& _rPropertyName ) throw (uno::RuntimeException, beans::UnknownPropertyException)
     198             : {
     199           0 :     return m_pInfoService->isComposable( _rPropertyName, m_xFormComponentHandler );
     200             : }
     201             : 
     202           0 : inspection::InteractiveSelectionResult SAL_CALL ReportComponentHandler::onInteractivePropertySelection(const ::rtl::OUString & PropertyName, ::sal_Bool Primary, uno::Any & out_Data, const uno::Reference< inspection::XObjectInspectorUI > & InspectorUI) throw (uno::RuntimeException, beans::UnknownPropertyException, lang::NullPointerException)
     203             : {
     204           0 :     return m_xFormComponentHandler->onInteractivePropertySelection(PropertyName, Primary, out_Data, InspectorUI);
     205             : }
     206             : 
     207           0 : void SAL_CALL ReportComponentHandler::actuatingPropertyChanged(const ::rtl::OUString & ActuatingPropertyName, const uno::Any & NewValue, const uno::Any & OldValue, const uno::Reference< inspection::XObjectInspectorUI > & InspectorUI, ::sal_Bool FirstTimeInit) throw (uno::RuntimeException, lang::NullPointerException)
     208             : {
     209           0 :     m_xFormComponentHandler->actuatingPropertyChanged(ActuatingPropertyName, NewValue, OldValue, InspectorUI, FirstTimeInit);
     210           0 : }
     211             : 
     212           0 : ::sal_Bool SAL_CALL ReportComponentHandler::suspend(::sal_Bool Suspend) throw (uno::RuntimeException)
     213             : {
     214           0 :     return m_xFormComponentHandler->suspend(Suspend);
     215             : }
     216             : 
     217             : //........................................................................
     218             : } // namespace rptui
     219             : //........................................................................
     220             : 
     221             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10