LCOV - code coverage report
Current view: top level - reportdesign/source/core/api - FixedText.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 33 140 23.6 %
Date: 2015-06-13 12:38:46 Functions: 13 191 6.8 %
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 "FixedText.hxx"
      20             : #include <com/sun/star/beans/PropertyAttribute.hpp>
      21             : #include "corestrings.hrc"
      22             : #include <com/sun/star/beans/XPropertyState.hpp>
      23             : #include "core_resource.hrc"
      24             : #include "core_resource.hxx"
      25             : #include "Tools.hxx"
      26             : #include <tools/color.hxx>
      27             : #include <tools/debug.hxx>
      28             : #include <comphelper/property.hxx>
      29             : #include <cppuhelper/supportsservice.hxx>
      30             : #include "FormatCondition.hxx"
      31             : #include <com/sun/star/text/ParagraphVertAlign.hpp>
      32             : #include "ReportHelperImpl.hxx"
      33             : 
      34             : namespace reportdesign
      35             : {
      36             : 
      37             :     using namespace com::sun::star;
      38             :     using namespace comphelper;
      39           1 : uno::Sequence< OUString > lcl_getFixedTextOptionals()
      40             : {
      41           4 :     OUString pProps[] = { OUString(PROPERTY_DATAFIELD),OUString(PROPERTY_MASTERFIELDS),OUString(PROPERTY_DETAILFIELDS) };
      42           4 :     return uno::Sequence< OUString >(pProps,sizeof(pProps)/sizeof(pProps[0]));
      43             : }
      44             : 
      45           1 : OFixedText::OFixedText(uno::Reference< uno::XComponentContext > const & _xContext)
      46             : :FixedTextBase(m_aMutex)
      47             : ,FixedTextPropertySet(_xContext,static_cast< Implements >(IMPLEMENTS_PROPERTY_SET),lcl_getFixedTextOptionals())
      48           1 : ,m_aProps(m_aMutex,static_cast< container::XContainer*>( this ),_xContext)
      49             : {
      50           1 :     m_aProps.aComponent.m_sName  = RPT_RESSTRING(RID_STR_FIXEDTEXT,m_aProps.aComponent.m_xContext->getServiceManager());
      51           1 :     m_aProps.aComponent.m_nBorder = 0; // no border
      52           1 : }
      53             : 
      54           0 : OFixedText::OFixedText(uno::Reference< uno::XComponentContext > const & _xContext
      55             :                        ,const uno::Reference< lang::XMultiServiceFactory>& _xFactory
      56             :                        ,uno::Reference< drawing::XShape >& _xShape)
      57             : :FixedTextBase(m_aMutex)
      58             : ,FixedTextPropertySet(_xContext,static_cast< Implements >(IMPLEMENTS_PROPERTY_SET),lcl_getFixedTextOptionals())
      59           0 : ,m_aProps(m_aMutex,static_cast< container::XContainer*>( this ),_xContext)
      60             : {
      61           0 :     m_aProps.aComponent.m_sName  = RPT_RESSTRING(RID_STR_FIXEDTEXT,m_aProps.aComponent.m_xContext->getServiceManager());
      62           0 :     m_aProps.aComponent.m_nBorder = 0; // no border
      63           0 :     m_aProps.aComponent.m_xFactory = _xFactory;
      64           0 :     osl_atomic_increment( &m_refCount );
      65             :     {
      66           0 :         m_aProps.aComponent.setShape(_xShape,this,m_refCount);
      67             :     }
      68           0 :     osl_atomic_decrement( &m_refCount );
      69           0 : }
      70             : 
      71           2 : OFixedText::~OFixedText()
      72             : {
      73           2 : }
      74             : 
      75          30 : IMPLEMENT_FORWARD_REFCOUNT( OFixedText, FixedTextBase )
      76             : 
      77           2 : uno::Any SAL_CALL OFixedText::queryInterface( const uno::Type& _rType ) throw (uno::RuntimeException, std::exception)
      78             : {
      79           2 :     uno::Any aReturn = FixedTextBase::queryInterface(_rType);
      80           2 :     if ( !aReturn.hasValue() )
      81           0 :         aReturn = FixedTextPropertySet::queryInterface(_rType);
      82           2 :     if ( !aReturn.hasValue() && OReportControlModel::isInterfaceForbidden(_rType) )
      83           0 :         return aReturn;
      84             : 
      85           2 :     return aReturn.hasValue() ? aReturn : (m_aProps.aComponent.m_xProxy.is() ? m_aProps.aComponent.m_xProxy->queryAggregation(_rType) : aReturn);
      86             : }
      87             : 
      88             : 
      89           1 : void SAL_CALL OFixedText::dispose() throw(uno::RuntimeException, std::exception)
      90             : {
      91           1 :     FixedTextPropertySet::dispose();
      92           1 :     cppu::WeakComponentImplHelperBase::dispose();
      93           1 :     uno::Reference< report::XFixedText> xHoldAlive = this;
      94           1 : }
      95             : 
      96           9 : OUString OFixedText::getImplementationName_Static(  ) throw(uno::RuntimeException)
      97             : {
      98           9 :     return OUString("com.sun.star.comp.report.OFixedText");
      99             : }
     100             : 
     101             : 
     102           1 : OUString SAL_CALL OFixedText::getImplementationName(  ) throw(uno::RuntimeException, std::exception)
     103             : {
     104           1 :     return getImplementationName_Static();
     105             : }
     106             : 
     107           2 : uno::Sequence< OUString > OFixedText::getSupportedServiceNames_Static(  ) throw(uno::RuntimeException)
     108             : {
     109           2 :     uno::Sequence< OUString > aServices(1);
     110           2 :     aServices.getArray()[0] = SERVICE_FIXEDTEXT;
     111             : 
     112           2 :     return aServices;
     113             : }
     114             : 
     115           1 : uno::Reference< uno::XInterface > OFixedText::create(uno::Reference< uno::XComponentContext > const & xContext)
     116             : {
     117           1 :     return *(new OFixedText(xContext));
     118             : }
     119             : 
     120             : 
     121           1 : uno::Sequence< OUString > SAL_CALL OFixedText::getSupportedServiceNames(  ) throw(uno::RuntimeException, std::exception)
     122             : {
     123           1 :     return getSupportedServiceNames_Static();
     124             : }
     125             : 
     126           0 : sal_Bool SAL_CALL OFixedText::supportsService(const OUString& ServiceName) throw( uno::RuntimeException, std::exception )
     127             : {
     128           0 :     return cppu::supportsService(this, ServiceName);
     129             : }
     130             : 
     131             : // XReportComponent
     132           0 : REPORTCOMPONENT_IMPL(OFixedText,m_aProps.aComponent)
     133           0 : REPORTCOMPONENT_IMPL2(OFixedText,m_aProps.aComponent)
     134           0 : REPORTCOMPONENT_NOMASTERDETAIL(OFixedText)
     135           0 : REPORTCONTROLFORMAT_IMPL(OFixedText,m_aProps.aFormatProperties)
     136             : 
     137           0 : uno::Reference< beans::XPropertySetInfo > SAL_CALL OFixedText::getPropertySetInfo(  ) throw(uno::RuntimeException, std::exception)
     138             : {
     139           0 :     return FixedTextPropertySet::getPropertySetInfo();
     140             : }
     141             : 
     142           0 : void SAL_CALL OFixedText::setPropertyValue( const OUString& aPropertyName, const uno::Any& aValue ) throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
     143             : {
     144           0 :     FixedTextPropertySet::setPropertyValue( aPropertyName, aValue );
     145           0 : }
     146             : 
     147           0 : uno::Any SAL_CALL OFixedText::getPropertyValue( const OUString& PropertyName ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
     148             : {
     149           0 :     return FixedTextPropertySet::getPropertyValue( PropertyName);
     150             : }
     151             : 
     152           0 : void SAL_CALL OFixedText::addPropertyChangeListener( const OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& xListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
     153             : {
     154           0 :     FixedTextPropertySet::addPropertyChangeListener( aPropertyName, xListener );
     155           0 : }
     156             : 
     157           0 : void SAL_CALL OFixedText::removePropertyChangeListener( const OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
     158             : {
     159           0 :     FixedTextPropertySet::removePropertyChangeListener( aPropertyName, aListener );
     160           0 : }
     161             : 
     162           0 : void SAL_CALL OFixedText::addVetoableChangeListener( const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
     163             : {
     164           0 :     FixedTextPropertySet::addVetoableChangeListener( PropertyName, aListener );
     165           0 : }
     166             : 
     167           0 : void SAL_CALL OFixedText::removeVetoableChangeListener( const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
     168             : {
     169           0 :     FixedTextPropertySet::removeVetoableChangeListener( PropertyName, aListener );
     170           0 : }
     171             : 
     172             : // XReportControlModel
     173           0 : OUString SAL_CALL OFixedText::getDataField() throw ( beans::UnknownPropertyException, uno::RuntimeException, std::exception)
     174             : {
     175           0 :     throw beans::UnknownPropertyException();
     176             : }
     177             : 
     178           0 : void SAL_CALL OFixedText::setDataField( const OUString& /*_datafield*/ ) throw (lang::IllegalArgumentException, beans::UnknownPropertyException, uno::RuntimeException, std::exception)
     179             : {
     180           0 :     throw beans::UnknownPropertyException();
     181             : }
     182             : 
     183             : 
     184             : 
     185           0 : sal_Bool SAL_CALL OFixedText::getPrintWhenGroupChange() throw (beans::UnknownPropertyException, uno::RuntimeException, std::exception)
     186             : {
     187           0 :     ::osl::MutexGuard aGuard(m_aMutex);
     188           0 :     return m_aProps.bPrintWhenGroupChange;
     189             : }
     190             : 
     191           0 : void SAL_CALL OFixedText::setPrintWhenGroupChange( sal_Bool _printwhengroupchange ) throw (beans::UnknownPropertyException, uno::RuntimeException, std::exception)
     192             : {
     193           0 :     set(PROPERTY_PRINTWHENGROUPCHANGE,_printwhengroupchange,m_aProps.bPrintWhenGroupChange);
     194           0 : }
     195             : 
     196           0 : OUString SAL_CALL OFixedText::getConditionalPrintExpression() throw (beans::UnknownPropertyException, uno::RuntimeException, std::exception)
     197             : {
     198           0 :     ::osl::MutexGuard aGuard(m_aMutex);
     199           0 :     return m_aProps.aConditionalPrintExpression;
     200             : }
     201             : 
     202           0 : void SAL_CALL OFixedText::setConditionalPrintExpression( const OUString& _conditionalprintexpression ) throw (beans::UnknownPropertyException, uno::RuntimeException, std::exception)
     203             : {
     204           0 :     set(PROPERTY_CONDITIONALPRINTEXPRESSION,_conditionalprintexpression,m_aProps.aConditionalPrintExpression);
     205           0 : }
     206             : 
     207             : 
     208             : // XCloneable
     209           0 : uno::Reference< util::XCloneable > SAL_CALL OFixedText::createClone(  ) throw (uno::RuntimeException, std::exception)
     210             : {
     211           0 :     uno::Reference< report::XReportComponent> xSource = this;
     212           0 :     uno::Reference< report::XFixedText> xSet(cloneObject(xSource,m_aProps.aComponent.m_xFactory,SERVICE_FIXEDTEXT),uno::UNO_QUERY_THROW);
     213           0 :     return xSet.get();
     214             : }
     215             : 
     216             : 
     217             : // XFixedText
     218           0 : OUString SAL_CALL OFixedText::getLabel() throw (uno::RuntimeException, std::exception)
     219             : {
     220           0 :     ::osl::MutexGuard aGuard(m_aMutex);
     221           0 :     return m_sLabel;
     222             : }
     223             : 
     224           0 : void SAL_CALL OFixedText::setLabel( const OUString& _label ) throw (uno::RuntimeException, std::exception)
     225             : {
     226           0 :     set(PROPERTY_LABEL,_label,m_sLabel);
     227           0 : }
     228             : 
     229             : // XChild
     230           0 : uno::Reference< uno::XInterface > SAL_CALL OFixedText::getParent(  ) throw (uno::RuntimeException, std::exception)
     231             : {
     232           0 :     return OShapeHelper::getParent(this);
     233             : }
     234             : 
     235           0 : void SAL_CALL OFixedText::setParent( const uno::Reference< uno::XInterface >& Parent ) throw (lang::NoSupportException, uno::RuntimeException, std::exception)
     236             : {
     237           0 :     OShapeHelper::setParent(Parent,this);
     238           0 : }
     239             : 
     240           0 : uno::Reference< report::XFormatCondition > SAL_CALL OFixedText::createFormatCondition(  ) throw (uno::Exception, uno::RuntimeException, std::exception)
     241             : {
     242           0 :     return new OFormatCondition(m_aProps.aComponent.m_xContext);
     243             : }
     244             : 
     245             : // XContainer
     246           0 : void SAL_CALL OFixedText::addContainerListener( const uno::Reference< container::XContainerListener >& xListener ) throw (uno::RuntimeException, std::exception)
     247             : {
     248           0 :     m_aProps.addContainerListener(xListener);
     249           0 : }
     250             : 
     251           0 : void SAL_CALL OFixedText::removeContainerListener( const uno::Reference< container::XContainerListener >& xListener ) throw (uno::RuntimeException, std::exception)
     252             : {
     253           0 :     m_aProps.removeContainerListener(xListener);
     254           0 : }
     255             : 
     256             : // XElementAccess
     257           0 : uno::Type SAL_CALL OFixedText::getElementType(  ) throw (uno::RuntimeException, std::exception)
     258             : {
     259           0 :     return cppu::UnoType<report::XFormatCondition>::get();
     260             : }
     261             : 
     262           0 : sal_Bool SAL_CALL OFixedText::hasElements(  ) throw (uno::RuntimeException, std::exception)
     263             : {
     264           0 :     return m_aProps.hasElements();
     265             : }
     266             : 
     267             : // XIndexContainer
     268           0 : void SAL_CALL OFixedText::insertByIndex( ::sal_Int32 Index, const uno::Any& Element ) throw (lang::IllegalArgumentException, lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
     269             : {
     270           0 :     m_aProps.insertByIndex(Index,Element);
     271           0 : }
     272             : 
     273           0 : void SAL_CALL OFixedText::removeByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
     274             : {
     275           0 :     m_aProps.removeByIndex(Index);
     276           0 : }
     277             : 
     278             : // XIndexReplace
     279           0 : void SAL_CALL OFixedText::replaceByIndex( ::sal_Int32 Index, const uno::Any& Element ) throw (lang::IllegalArgumentException, lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
     280             : {
     281           0 :     m_aProps.replaceByIndex(Index,Element);
     282           0 : }
     283             : 
     284             : // XIndexAccess
     285           0 : ::sal_Int32 SAL_CALL OFixedText::getCount(  ) throw (uno::RuntimeException, std::exception)
     286             : {
     287           0 :     return m_aProps.getCount();
     288             : }
     289             : 
     290           0 : uno::Any SAL_CALL OFixedText::getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
     291             : {
     292           0 :     return m_aProps.getByIndex( Index );
     293             : }
     294             : 
     295             : // XShape
     296           0 : awt::Point SAL_CALL OFixedText::getPosition(  ) throw (uno::RuntimeException, std::exception)
     297             : {
     298           0 :     return OShapeHelper::getPosition(this);
     299             : }
     300             : 
     301           0 : void SAL_CALL OFixedText::setPosition( const awt::Point& aPosition ) throw (uno::RuntimeException, std::exception)
     302             : {
     303           0 :     OShapeHelper::setPosition(aPosition,this);
     304           0 : }
     305             : 
     306           0 : awt::Size SAL_CALL OFixedText::getSize(  ) throw (uno::RuntimeException, std::exception)
     307             : {
     308           0 :     return OShapeHelper::getSize(this);
     309             : }
     310             : 
     311           0 : void SAL_CALL OFixedText::setSize( const awt::Size& aSize ) throw (beans::PropertyVetoException, uno::RuntimeException, std::exception)
     312             : {
     313           0 :     OShapeHelper::setSize(aSize,this);
     314           0 : }
     315             : 
     316             : 
     317             : // XShapeDescriptor
     318           0 : OUString SAL_CALL OFixedText::getShapeType(  ) throw (uno::RuntimeException, std::exception)
     319             : {
     320           0 :     ::osl::MutexGuard aGuard(m_aMutex);
     321           0 :     if ( m_aProps.aComponent.m_xShape.is() )
     322           0 :         return m_aProps.aComponent.m_xShape->getShapeType();
     323           0 :     return OUString("com.sun.star.drawing.ControlShape");
     324             : }
     325             : 
     326             : 
     327             : 
     328             : } // namespace reportdesign
     329             : 
     330             : 
     331             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11