LCOV - code coverage report
Current view: top level - reportdesign/source/core/api - FixedText.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 140 0.0 %
Date: 2014-04-14 Functions: 0 191 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 "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           0 : uno::Sequence< OUString > lcl_getFixedTextOptionals()
      40             : {
      41           0 :     OUString pProps[] = { OUString(PROPERTY_DATAFIELD),OUString(PROPERTY_MASTERFIELDS),OUString(PROPERTY_DETAILFIELDS) };
      42           0 :     return uno::Sequence< OUString >(pProps,sizeof(pProps)/sizeof(pProps[0]));
      43             : }
      44             : 
      45           0 : OFixedText::OFixedText(uno::Reference< uno::XComponentContext > const & _xContext)
      46             : :FixedTextBase(m_aMutex)
      47             : ,FixedTextPropertySet(_xContext,static_cast< Implements >(IMPLEMENTS_PROPERTY_SET),lcl_getFixedTextOptionals())
      48           0 : ,m_aProps(m_aMutex,static_cast< container::XContainer*>( this ),_xContext)
      49             : {
      50           0 :     m_aProps.aComponent.m_sName  = RPT_RESSTRING(RID_STR_FIXEDTEXT,m_aProps.aComponent.m_xContext->getServiceManager());
      51           0 :     m_aProps.aComponent.m_nBorder = 0; // no border
      52           0 : }
      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           0 : OFixedText::~OFixedText()
      72             : {
      73           0 : }
      74             : 
      75           0 : IMPLEMENT_FORWARD_REFCOUNT( OFixedText, FixedTextBase )
      76             : 
      77           0 : uno::Any SAL_CALL OFixedText::queryInterface( const uno::Type& _rType ) throw (uno::RuntimeException, std::exception)
      78             : {
      79           0 :     uno::Any aReturn = FixedTextBase::queryInterface(_rType);
      80           0 :     if ( !aReturn.hasValue() )
      81           0 :         aReturn = FixedTextPropertySet::queryInterface(_rType);
      82           0 :     if ( !aReturn.hasValue() && OReportControlModel::isInterfaceForbidden(_rType) )
      83           0 :         return aReturn;
      84             : 
      85           0 :     return aReturn.hasValue() ? aReturn : (m_aProps.aComponent.m_xProxy.is() ? m_aProps.aComponent.m_xProxy->queryAggregation(_rType) : aReturn);
      86             : }
      87             : 
      88             : 
      89           0 : void SAL_CALL OFixedText::dispose() throw(uno::RuntimeException, std::exception)
      90             : {
      91           0 :     FixedTextPropertySet::dispose();
      92           0 :     cppu::WeakComponentImplHelperBase::dispose();
      93           0 :     uno::Reference< report::XFixedText> xHoldAlive = this;
      94           0 : }
      95             : 
      96           0 : OUString OFixedText::getImplementationName_Static(  ) throw(uno::RuntimeException)
      97             : {
      98           0 :     return OUString("com.sun.star.comp.report.OFixedText");
      99             : }
     100             : 
     101             : 
     102           0 : OUString SAL_CALL OFixedText::getImplementationName(  ) throw(uno::RuntimeException, std::exception)
     103             : {
     104           0 :     return getImplementationName_Static();
     105             : }
     106             : 
     107           0 : uno::Sequence< OUString > OFixedText::getSupportedServiceNames_Static(  ) throw(uno::RuntimeException)
     108             : {
     109           0 :     uno::Sequence< OUString > aServices(1);
     110           0 :     aServices.getArray()[0] = SERVICE_FIXEDTEXT;
     111             : 
     112           0 :     return aServices;
     113             : }
     114             : 
     115           0 : uno::Reference< uno::XInterface > OFixedText::create(uno::Reference< uno::XComponentContext > const & xContext)
     116             : {
     117           0 :     return *(new OFixedText(xContext));
     118             : }
     119             : 
     120             : 
     121           0 : uno::Sequence< OUString > SAL_CALL OFixedText::getSupportedServiceNames(  ) throw(uno::RuntimeException, std::exception)
     122             : {
     123           0 :     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 ::getCppuType(static_cast< uno::Reference<report::XFormatCondition>*>(NULL));
     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.10