LCOV - code coverage report
Current view: top level - svx/source/table - cell.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 1 2 50.0 %
Date: 2014-11-03 Functions: 1 2 50.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             : 
      20             : #ifndef INCLUDED_SVX_SOURCE_TABLE_CELL_HXX
      21             : #define INCLUDED_SVX_SOURCE_TABLE_CELL_HXX
      22             : 
      23             : #include <com/sun/star/table/XMergeableCell.hpp>
      24             : #include <com/sun/star/awt/XLayoutConstrains.hpp>
      25             : #include <com/sun/star/beans/XMultiPropertyStates.hpp>
      26             : #include <com/sun/star/lang/XEventListener.hpp>
      27             : 
      28             : #include <rtl/ref.hxx>
      29             : #include <svl/style.hxx>
      30             : #include "svx/sdtaitm.hxx"
      31             : #include "tablemodel.hxx"
      32             : #include "editeng/unotext.hxx"
      33             : #include "svx/svdtext.hxx"
      34             : 
      35             : 
      36             : 
      37             : class SfxItemSet;
      38             : class OutlinerParaObject;
      39             : class SdrObject;
      40             : 
      41             : namespace sdr { namespace properties {
      42             :     class TextProperties;
      43             : } }
      44             : 
      45             : 
      46             : 
      47             : namespace sdr { namespace table {
      48             : 
      49             : 
      50             : 
      51             : class SVX_DLLPUBLIC Cell :  public SdrText,
      52             :                 public SvxUnoTextBase,
      53             :                 public ::com::sun::star::table::XMergeableCell,
      54             :                 public ::com::sun::star::awt::XLayoutConstrains,
      55             :                 public ::com::sun::star::lang::XEventListener,
      56             :                 public ::cppu::OWeakObject
      57             : {
      58             :     friend class CellUndo;
      59             : 
      60             : public:
      61             :     SVX_DLLPRIVATE static rtl::Reference< Cell > create( SdrTableObj& rTableObj, OutlinerParaObject* pOutlinerParaObject );
      62             : 
      63             :     // private
      64             :     SVX_DLLPRIVATE void dispose();
      65             : 
      66             :     // SdrTextShape proxy
      67             :     bool IsTextEditActive();
      68             :     SVX_DLLPRIVATE bool hasText() const;
      69             : 
      70             :     SVX_DLLPRIVATE void cloneFrom( const CellRef& rCell );
      71             : 
      72       10288 :     SVX_DLLPRIVATE void setCellRect( ::Rectangle& rCellRect ) { maCellRect = rCellRect; }
      73             :     SVX_DLLPRIVATE const ::Rectangle& getCellRect() const { return maCellRect; }
      74           0 :     SVX_DLLPRIVATE ::Rectangle& getCellRect() { return maCellRect; }
      75             : 
      76             :     OutlinerParaObject* GetEditOutlinerParaObject() const;
      77             :     SVX_DLLPRIVATE void SetStyleSheet( SfxStyleSheet* pStyleSheet, bool bDontRemoveHardAttr );
      78             :     SVX_DLLPRIVATE virtual SfxStyleSheet* GetStyleSheet() const SAL_OVERRIDE;
      79             :     SVX_DLLPRIVATE virtual const Rectangle& GetCurrentBoundRect() const;
      80             :     SVX_DLLPRIVATE virtual void TakeTextAnchorRect(Rectangle& rAnchorRect) const;
      81             : 
      82             :     SVX_DLLPRIVATE virtual const SfxItemSet& GetItemSet() const SAL_OVERRIDE;
      83             :     SVX_DLLPRIVATE void SetMergedItemSetAndBroadcast(const SfxItemSet& rSet, bool bClearAllItems);
      84             :     void SetMergedItem(const SfxPoolItem& rItem);
      85             : 
      86             :     SVX_DLLPRIVATE sal_Int32 getMinimumWidth();
      87             :     SVX_DLLPRIVATE sal_Int32 getMinimumHeight();
      88             : 
      89             :     SVX_DLLPRIVATE long GetTextLeftDistance() const;
      90             :     SVX_DLLPRIVATE long GetTextRightDistance() const;
      91             :     SVX_DLLPRIVATE long GetTextUpperDistance() const;
      92             :     SVX_DLLPRIVATE long GetTextLowerDistance() const;
      93             : 
      94             :     SVX_DLLPRIVATE SdrTextVertAdjust GetTextVerticalAdjust() const;
      95             :     SdrTextHorzAdjust GetTextHorizontalAdjust() const;
      96             : 
      97             :     SVX_DLLPRIVATE virtual void SetModel(SdrModel* pNewModel) SAL_OVERRIDE;
      98             : 
      99             :     SVX_DLLPRIVATE void merge( sal_Int32 nColumnSpan, sal_Int32 nRowSpan );
     100             :     SVX_DLLPRIVATE void mergeContent( const CellRef& xSourceCell );
     101             :     SVX_DLLPRIVATE void replaceContentAndFormating( const CellRef& xSourceCell );
     102             : 
     103             :     SVX_DLLPRIVATE void setMerged();
     104             : 
     105             :     SVX_DLLPRIVATE void copyFormatFrom( const CellRef& xSourceCell );
     106             : 
     107             :     // XInterface
     108             :     SVX_DLLPRIVATE virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& Type ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     109             :     SVX_DLLPRIVATE virtual void SAL_CALL acquire() throw () SAL_OVERRIDE;
     110             :     SVX_DLLPRIVATE virtual void SAL_CALL release() throw () SAL_OVERRIDE;
     111             : 
     112             :     // XTypeProvider
     113             :     SVX_DLLPRIVATE virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     114             :     SVX_DLLPRIVATE virtual ::com::sun::star::uno::Sequence< ::sal_Int8 > SAL_CALL getImplementationId(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     115             : 
     116             :     // XLayoutConstrains
     117             :     SVX_DLLPRIVATE virtual ::com::sun::star::awt::Size SAL_CALL getMinimumSize()
     118             :         throw (::com::sun::star::uno::RuntimeException,
     119             :                std::exception) SAL_OVERRIDE;
     120             :     SVX_DLLPRIVATE virtual ::com::sun::star::awt::Size SAL_CALL getPreferredSize()
     121             :         throw (::com::sun::star::uno::RuntimeException,
     122             :                std::exception) SAL_OVERRIDE;
     123             :     SVX_DLLPRIVATE virtual ::com::sun::star::awt::Size SAL_CALL calcAdjustedSize( const ::com::sun::star::awt::Size& aNewSize ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     124             : 
     125             :     // XMergeableCell
     126             :     SVX_DLLPRIVATE virtual ::sal_Int32 SAL_CALL getRowSpan() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     127             :     SVX_DLLPRIVATE virtual ::sal_Int32 SAL_CALL getColumnSpan() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     128             :     SVX_DLLPRIVATE virtual sal_Bool SAL_CALL isMerged() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     129             : 
     130             :     // XCell
     131             :     SVX_DLLPRIVATE virtual OUString SAL_CALL getFormula() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     132             :     SVX_DLLPRIVATE virtual void SAL_CALL setFormula( const OUString& aFormula ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     133             :     SVX_DLLPRIVATE virtual double SAL_CALL getValue() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     134             :     SVX_DLLPRIVATE virtual void SAL_CALL setValue( double nValue ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     135             :     SVX_DLLPRIVATE virtual ::com::sun::star::table::CellContentType SAL_CALL getType() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     136             :     SVX_DLLPRIVATE virtual sal_Int32 SAL_CALL getError() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     137             : 
     138             :     // ::com::sun::star::beans::XPropertySet
     139             :     SVX_DLLPRIVATE virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     140             :     SVX_DLLPRIVATE virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     141             :     SVX_DLLPRIVATE virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     142             :     SVX_DLLPRIVATE virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     143             :     SVX_DLLPRIVATE virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     144             :     SVX_DLLPRIVATE virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     145             :     SVX_DLLPRIVATE virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     146             : 
     147             :     // XMultiPropertySet
     148             :     SVX_DLLPRIVATE virtual void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues ) throw (::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     149             :     SVX_DLLPRIVATE virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyValues( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     150             :     SVX_DLLPRIVATE virtual void SAL_CALL addPropertiesChangeListener( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     151             :     SVX_DLLPRIVATE virtual void SAL_CALL removePropertiesChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     152             :     SVX_DLLPRIVATE virtual void SAL_CALL firePropertiesChangeEvent( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     153             : 
     154             :     // ::com::sun::star::beans::XPropertyState
     155             :     SVX_DLLPRIVATE virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     156             :     SVX_DLLPRIVATE virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL getPropertyStates( const ::com::sun::star::uno::Sequence< OUString >& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     157             :     SVX_DLLPRIVATE virtual void SAL_CALL setPropertyToDefault( const OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     158             :     SVX_DLLPRIVATE virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const OUString& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     159             : 
     160             :     // XMultiPropertyStates
     161             :     SVX_DLLPRIVATE virtual void SAL_CALL setAllPropertiesToDefault()
     162             :         throw (::com::sun::star::uno::RuntimeException,
     163             :                std::exception) SAL_OVERRIDE;
     164             :     SVX_DLLPRIVATE virtual void SAL_CALL setPropertiesToDefault( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     165             :     SVX_DLLPRIVATE virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyDefaults( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     166             : 
     167             :     // XText
     168             :     SVX_DLLPRIVATE virtual void SAL_CALL insertTextContent( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xRange, const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent >& xContent, sal_Bool bAbsorb ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     169             :     SVX_DLLPRIVATE virtual void SAL_CALL removeTextContent( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent >& xContent ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     170             : 
     171             :     // XSimpleText
     172             :     SVX_DLLPRIVATE virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > SAL_CALL createTextCursor(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     173             :     SVX_DLLPRIVATE virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > SAL_CALL createTextCursorByRange( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& aTextPosition ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     174             :     SVX_DLLPRIVATE virtual void SAL_CALL insertString( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xRange, const OUString& aString, sal_Bool bAbsorb ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     175             :     SVX_DLLPRIVATE virtual void SAL_CALL insertControlCharacter( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xRange, ::sal_Int16 nControlCharacter, sal_Bool bAbsorb ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     176             : 
     177             :     // XTextRange
     178             :     SVX_DLLPRIVATE virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > SAL_CALL getText(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     179             :     SVX_DLLPRIVATE virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getStart(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     180             :     SVX_DLLPRIVATE virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getEnd(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     181             :     SVX_DLLPRIVATE virtual OUString SAL_CALL getString(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     182             :     SVX_DLLPRIVATE virtual void SAL_CALL setString( const OUString& aString ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     183             : 
     184             :     // XEventListener
     185             :     SVX_DLLPRIVATE virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     186             : 
     187             :     SVX_DLLPRIVATE virtual void SetOutlinerParaObject( OutlinerParaObject* pTextObject ) SAL_OVERRIDE;
     188             : 
     189             :     SVX_DLLPRIVATE void AddUndo();
     190             : 
     191             :     using SvxUnoTextRangeBase::setPropertyValue;
     192             :     using SvxUnoTextRangeBase::getPropertyValue;
     193             : 
     194             :     SVX_DLLPRIVATE sdr::properties::TextProperties* CloneProperties( SdrObject& rNewObj, Cell& rNewCell );
     195             : 
     196             :     SVX_DLLPRIVATE static sdr::properties::TextProperties* CloneProperties( sdr::properties::TextProperties* pProperties, SdrObject& rNewObj, Cell& rNewCell );
     197             : 
     198             :     SVX_DLLPRIVATE void notifyModified();
     199             : 
     200             : protected:
     201             :     SVX_DLLPRIVATE virtual const SfxItemSet& GetObjectItemSet() SAL_OVERRIDE;
     202             :     SVX_DLLPRIVATE virtual void SetObjectItem(const SfxPoolItem& rItem) SAL_OVERRIDE;
     203             : 
     204             :     SVX_DLLPRIVATE ::com::sun::star::uno::Any GetAnyForItem( SfxItemSet& aSet, const SfxItemPropertySimpleEntry* pMap );
     205             : 
     206             : private:
     207             :     SVX_DLLPRIVATE Cell( SdrTableObj& rTableObj, OutlinerParaObject* pOutlinerParaObject ) throw(css::uno::RuntimeException);
     208             :     SVX_DLLPRIVATE virtual ~Cell() throw();
     209             : 
     210             :     const SvxItemPropertySet* mpPropSet;
     211             : 
     212             :     sdr::properties::TextProperties*    mpProperties;
     213             : 
     214             :     ::com::sun::star::table::CellContentType mnCellContentType;
     215             : 
     216             :     OUString msFormula;
     217             :     double          mfValue;
     218             :     ::sal_Int32     mnError;
     219             :     bool      mbMerged;
     220             :     ::sal_Int32     mnRowSpan;
     221             :     ::sal_Int32     mnColSpan;
     222             : 
     223             :     Rectangle maCellRect;
     224             : 
     225             :     ::com::sun::star::uno::Reference< ::com::sun::star::table::XTable > mxTable;
     226             : };
     227             : 
     228             : 
     229             : 
     230             : } }
     231             : 
     232             : #endif
     233             : 
     234             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10