LCOV - code coverage report
Current view: top level - svx/source/table - cell.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 209 689 30.3 %
Date: 2012-08-25 Functions: 37 98 37.8 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 235 1086 21.6 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : 
      30                 :            : #include <com/sun/star/drawing/BitmapMode.hpp>
      31                 :            : #include <com/sun/star/style/XStyle.hpp>
      32                 :            : #include <com/sun/star/text/WritingMode.hpp>
      33                 :            : #include <com/sun/star/table/TableBorder.hpp>
      34                 :            : #include <com/sun/star/table/BorderLine2.hpp>
      35                 :            : 
      36                 :            : #include <comphelper/string.hxx>
      37                 :            : 
      38                 :            : #include <cppuhelper/typeprovider.hxx>
      39                 :            : #include <svl/style.hxx>
      40                 :            : #include <svl/itemset.hxx>
      41                 :            : 
      42                 :            : #include <osl/mutex.hxx>
      43                 :            : #include <vcl/svapp.hxx>
      44                 :            : 
      45                 :            : #include "svx/sdr/properties/textproperties.hxx"
      46                 :            : #include "editeng/outlobj.hxx"
      47                 :            : #include "editeng/writingmodeitem.hxx"
      48                 :            : #include "svx/svdotable.hxx"
      49                 :            : #include "svx/svdoutl.hxx"
      50                 :            : #include "svx/unoshtxt.hxx"
      51                 :            : #include "svx/svdmodel.hxx"
      52                 :            : 
      53                 :            : #include "tableundo.hxx"
      54                 :            : #include "cell.hxx"
      55                 :            : #include "svx/unoshprp.hxx"
      56                 :            : #include "svx/unoshape.hxx"
      57                 :            : #include "editeng/editobj.hxx"
      58                 :            : #include "editeng/boxitem.hxx"
      59                 :            : #include "svx/xflbstit.hxx"
      60                 :            : #include "svx/xflbmtit.hxx"
      61                 :            : #include <svx/svdpool.hxx>
      62                 :            : 
      63                 :            : // -----------------------------------------------------------------------------
      64                 :            : 
      65                 :            : using ::editeng::SvxBorderLine;
      66                 :            : using ::rtl::OUString;
      67                 :            : using namespace ::com::sun::star::uno;
      68                 :            : using namespace ::com::sun::star::beans;
      69                 :            : using namespace ::com::sun::star::lang;
      70                 :            : using namespace ::com::sun::star::text;
      71                 :            : using namespace ::com::sun::star::table;
      72                 :            : using namespace ::com::sun::star::drawing;
      73                 :            : using namespace ::com::sun::star::style;
      74                 :            : using namespace ::com::sun::star::container;
      75                 :            : 
      76                 :            : // -----------------------------------------------------------------------------
      77                 :            : 
      78                 :         48 : static const SvxItemPropertySet* ImplGetSvxCellPropertySet()
      79                 :            : {
      80                 :            :     // Propertymap fuer einen Outliner Text
      81                 :            :     static const SfxItemPropertyMapEntry aSvxCellPropertyMap[] =
      82                 :            :     {
      83 [ +  - ][ +  - ]:          3 :         FILL_PROPERTIES
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
      84                 :            : //      { MAP_CHAR_LEN("HasLevels"),                    OWN_ATTR_HASLEVELS,             &::getBooleanCppuType(), ::com::sun::star::beans::PropertyAttribute::READONLY,      0},
      85         [ +  - ]:          3 :         { MAP_CHAR_LEN("Style"),                        OWN_ATTR_STYLE,                 &::com::sun::star::style::XStyle::static_type(),                                    ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0},
      86         [ +  - ]:          3 :         { MAP_CHAR_LEN(UNO_NAME_TEXT_WRITINGMODE),      SDRATTR_TEXTDIRECTION,          &::getCppuType( (::com::sun::star::text::WritingMode*) 0 ),                         0,      0},
      87         [ +  - ]:          3 :         { MAP_CHAR_LEN(UNO_NAME_TEXT_HORZADJUST),       SDRATTR_TEXT_HORZADJUST,        &::getCppuType((const ::com::sun::star::drawing::TextHorizontalAdjust*)0),  0,      0}, \
      88         [ +  - ]:          3 :         { MAP_CHAR_LEN(UNO_NAME_TEXT_LEFTDIST),         SDRATTR_TEXT_LEFTDIST,          &::getCppuType((const sal_Int32*)0),        0,      SFX_METRIC_ITEM}, \
      89         [ +  - ]:          3 :         { MAP_CHAR_LEN(UNO_NAME_TEXT_LOWERDIST),        SDRATTR_TEXT_LOWERDIST,         &::getCppuType((const sal_Int32*)0),        0,      SFX_METRIC_ITEM}, \
      90         [ +  - ]:          3 :         { MAP_CHAR_LEN(UNO_NAME_TEXT_RIGHTDIST),        SDRATTR_TEXT_RIGHTDIST,         &::getCppuType((const sal_Int32*)0),        0,      SFX_METRIC_ITEM}, \
      91         [ +  - ]:          3 :         { MAP_CHAR_LEN(UNO_NAME_TEXT_UPPERDIST),        SDRATTR_TEXT_UPPERDIST,         &::getCppuType((const sal_Int32*)0),        0,      SFX_METRIC_ITEM}, \
      92         [ +  - ]:          3 :         { MAP_CHAR_LEN(UNO_NAME_TEXT_VERTADJUST),       SDRATTR_TEXT_VERTADJUST,        &::getCppuType((const ::com::sun::star::drawing::TextVerticalAdjust*)0),    0,      0},\
      93         [ +  - ]:          3 :         { MAP_CHAR_LEN(UNO_NAME_TEXT_WORDWRAP),         SDRATTR_TEXT_WORDWRAP,          &::getBooleanCppuType(),        0,      0}, \
      94                 :            : 
      95         [ +  - ]:          3 :         { MAP_CHAR_LEN("TableBorder"),                  OWN_ATTR_TABLEBORDER,           &::getCppuType((const TableBorder*)0), 0, 0 }, \
      96         [ +  - ]:          3 :         { MAP_CHAR_LEN("TopBorder"),                    SDRATTR_TABLE_BORDER,           &::getCppuType((const BorderLine*)0), 0, TOP_BORDER }, \
      97         [ +  - ]:          3 :         { MAP_CHAR_LEN("BottomBorder"),                 SDRATTR_TABLE_BORDER,           &::getCppuType((const BorderLine*)0), 0, BOTTOM_BORDER }, \
      98         [ +  - ]:          3 :         { MAP_CHAR_LEN("LeftBorder"),                   SDRATTR_TABLE_BORDER,           &::getCppuType((const BorderLine*)0), 0, LEFT_BORDER }, \
      99         [ +  - ]:          3 :         { MAP_CHAR_LEN("RightBorder"),                  SDRATTR_TABLE_BORDER,           &::getCppuType((const BorderLine*)0), 0, RIGHT_BORDER }, \
     100                 :            : 
     101 [ +  - ][ +  - ]:          3 :         SVX_UNOEDIT_OUTLINER_PROPERTIES,
         [ +  - ][ +  - ]
                 [ +  - ]
     102 [ +  - ][ +  - ]:          3 :         SVX_UNOEDIT_CHAR_PROPERTIES,
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     103 [ +  - ][ +  - ]:          3 :         SVX_UNOEDIT_PARA_PROPERTIES,
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     104                 :            :         {0,0,0,0,0,0}
     105 [ +  + ][ +  - ]:         51 :     };
                 [ #  # ]
     106                 :            : 
     107 [ +  + ][ +  - ]:         48 :     static SvxItemPropertySet aSvxCellPropertySet( aSvxCellPropertyMap, SdrObject::GetGlobalDrawObjectItemPool() );
         [ +  - ][ +  - ]
                 [ #  # ]
     108                 :         48 :     return &aSvxCellPropertySet;
     109                 :            : }
     110                 :            : 
     111                 :            : namespace sdr
     112                 :            : {
     113                 :            :     namespace properties
     114                 :            :     {
     115                 :            :         class CellProperties : public TextProperties
     116                 :            :         {
     117                 :            :         protected:
     118                 :            :             // create a new itemset
     119                 :            :             SfxItemSet& CreateObjectSpecificItemSet(SfxItemPool& rPool);
     120                 :            : 
     121                 :            :         public:
     122                 :            :             // basic constructor
     123                 :            :             CellProperties(SdrObject& rObj, sdr::table::Cell* pCell );
     124                 :            : 
     125                 :            :             // constructor for copying, but using new object
     126                 :            :             CellProperties(const CellProperties& rProps, SdrObject& rObj, sdr::table::Cell* pCell);
     127                 :            : 
     128                 :            :             // destructor
     129                 :            :             ~CellProperties();
     130                 :            : 
     131                 :            :             // Clone() operator, normally just calls the local copy constructor
     132                 :            :             BaseProperties& Clone(SdrObject& rObj) const;
     133                 :            : 
     134                 :            :             void ForceDefaultAttributes();
     135                 :            : 
     136                 :            :             void ItemSetChanged(const SfxItemSet& rSet);
     137                 :            : 
     138                 :            :             void ItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem);
     139                 :            : 
     140                 :            :             void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr);
     141                 :            : 
     142                 :            :             sdr::table::CellRef mxCell;
     143                 :            :         };
     144                 :            : 
     145                 :            :         // create a new itemset
     146                 :         48 :         SfxItemSet& CellProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool)
     147                 :            :         {
     148                 :            :             return *(new SfxItemSet(rPool,
     149                 :            : 
     150                 :            :                 // range from SdrAttrObj
     151                 :            :                 SDRATTR_START, SDRATTR_SHADOW_LAST,
     152                 :            :                 SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST,
     153                 :            :                 SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION,
     154                 :            : 
     155                 :            :                 // range for SdrTableObj
     156                 :            :                 SDRATTR_TABLE_FIRST, SDRATTR_TABLE_LAST,
     157                 :            : 
     158                 :            :                 // range from SdrTextObj
     159                 :            :                 EE_ITEMS_START, EE_ITEMS_END,
     160                 :            : 
     161                 :            :                 // end
     162         [ +  - ]:         48 :                 0, 0));
     163                 :            :         }
     164                 :            : 
     165                 :         48 :         CellProperties::CellProperties(SdrObject& rObj, sdr::table::Cell* pCell)
     166                 :            :         :   TextProperties(rObj)
     167                 :         48 :         ,   mxCell(pCell)
     168                 :            :         {
     169                 :         48 :         }
     170                 :            : 
     171                 :          0 :         CellProperties::CellProperties(const CellProperties& rProps, SdrObject& rObj, sdr::table::Cell* pCell)
     172                 :            :         :   TextProperties(rProps, rObj)
     173                 :          0 :         ,   mxCell( pCell )
     174                 :            :         {
     175                 :          0 :         }
     176                 :            : 
     177                 :         48 :         CellProperties::~CellProperties()
     178                 :            :         {
     179         [ -  + ]:         96 :         }
     180                 :            : 
     181                 :          0 :         BaseProperties& CellProperties::Clone(SdrObject& rObj) const
     182                 :            :         {
     183                 :            :             OSL_FAIL("CellProperties::Clone(), does not work yet!");
     184         [ #  # ]:          0 :             return *(new CellProperties(*this, rObj,0));
     185                 :            :         }
     186                 :            : 
     187                 :         48 :         void CellProperties::ForceDefaultAttributes()
     188                 :            :         {
     189                 :         48 :         }
     190                 :            : 
     191                 :         96 :         void CellProperties::ItemSetChanged(const SfxItemSet& rSet )
     192                 :            :         {
     193                 :         96 :             SdrTextObj& rObj = (SdrTextObj&)GetSdrObject();
     194                 :            : 
     195         [ +  - ]:         96 :             if( mxCell.is() )
     196                 :            :             {
     197                 :         96 :                 OutlinerParaObject* pParaObj = mxCell->GetEditOutlinerParaObject();
     198                 :            : 
     199                 :         96 :                 bool bOwnParaObj = pParaObj != 0;
     200                 :            : 
     201         [ +  - ]:         96 :                 if( pParaObj == 0 )
     202                 :         96 :                     pParaObj = mxCell->GetOutlinerParaObject();
     203                 :            : 
     204         [ +  - ]:         96 :                 if(pParaObj)
     205                 :            :                 {
     206                 :            :                     // handle outliner attributes
     207                 :         96 :                     Outliner* pOutliner = 0;
     208                 :            : 
     209         [ -  + ]:         96 :                     if(mxCell->IsTextEditActive())
     210                 :            :                     {
     211                 :          0 :                         pOutliner = rObj.GetTextEditOutliner();
     212                 :            :                     }
     213                 :            :                     else
     214                 :            :                     {
     215                 :         96 :                         pOutliner = &rObj.ImpGetDrawOutliner();
     216                 :         96 :                         pOutliner->SetText(*pParaObj);
     217                 :            :                     }
     218                 :            : 
     219                 :         96 :                     sal_uInt32 nParaCount(pOutliner->GetParagraphCount());
     220                 :            : 
     221         [ +  + ]:        192 :                     for(sal_uInt16 nPara = 0; nPara < nParaCount; nPara++)
     222                 :            :                     {
     223         [ +  - ]:         96 :                         SfxItemSet aSet(pOutliner->GetParaAttribs(nPara));
     224         [ +  - ]:         96 :                         aSet.Put(rSet);
     225         [ +  - ]:         96 :                         pOutliner->SetParaAttribs(nPara, aSet);
     226         [ +  - ]:         96 :                     }
     227                 :            : 
     228         [ +  - ]:         96 :                     if(!mxCell->IsTextEditActive())
     229                 :            :                     {
     230         [ +  - ]:         96 :                         if(nParaCount)
     231                 :            :                         {
     232                 :            :                             // force ItemSet
     233         [ +  - ]:         96 :                             GetObjectItemSet();
     234                 :            : 
     235         [ +  - ]:         96 :                             SfxItemSet aNewSet(pOutliner->GetParaAttribs(0L));
     236 [ +  - ][ +  - ]:         96 :                             mpItemSet->Put(aNewSet);
     237                 :            :                         }
     238                 :            : 
     239                 :         96 :                         OutlinerParaObject* pTemp = pOutliner->CreateParaObject(0, (sal_uInt16)nParaCount);
     240                 :         96 :                         pOutliner->Clear();
     241                 :            : 
     242                 :         96 :                         mxCell->SetOutlinerParaObject(pTemp);
     243                 :            :                     }
     244                 :            : 
     245         [ -  + ]:         96 :                     if( bOwnParaObj )
     246         [ #  # ]:          0 :                         delete pParaObj;
     247                 :            :                 }
     248                 :            :             }
     249                 :            : 
     250                 :            :             // call parent
     251                 :         96 :             AttributeProperties::ItemSetChanged(rSet);
     252                 :            : 
     253         [ +  - ]:         96 :             if( mxCell.is() )
     254                 :         96 :                 mxCell->notifyModified();
     255                 :         96 :         }
     256                 :            : 
     257                 :         96 :         void CellProperties::ItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem)
     258                 :            :         {
     259 [ +  - ][ -  + ]:         96 :             if(pNewItem && (SDRATTR_TEXTDIRECTION == nWhich))
     260                 :            :             {
     261                 :          0 :                 sal_Bool bVertical(com::sun::star::text::WritingMode_TB_RL == ((SvxWritingModeItem*)pNewItem)->GetValue());
     262                 :            : 
     263                 :          0 :                 sdr::table::SdrTableObj& rObj = (sdr::table::SdrTableObj&)GetSdrObject();
     264         [ #  # ]:          0 :                 if( rObj.IsVerticalWriting() != bVertical )
     265                 :          0 :                     rObj.SetVerticalWriting(bVertical);
     266                 :            :             }
     267                 :            : 
     268                 :            :             // call parent
     269                 :         96 :             AttributeProperties::ItemChange( nWhich, pNewItem );
     270                 :         96 :         }
     271                 :            : 
     272                 :         48 :         void CellProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr)
     273                 :            :         {
     274                 :         48 :             TextProperties::SetStyleSheet( pNewStyleSheet, bDontRemoveHardAttr );
     275                 :         48 :         }
     276                 :            :     } // end of namespace properties
     277                 :            : } // end of namespace sdr
     278                 :            : 
     279                 :            : namespace sdr { namespace table {
     280                 :            : 
     281                 :            : // -----------------------------------------------------------------------------
     282                 :            : // Cell
     283                 :            : // -----------------------------------------------------------------------------
     284                 :            : 
     285                 :         48 : rtl::Reference< Cell > Cell::create( SdrTableObj& rTableObj, OutlinerParaObject* pOutlinerParaObject )
     286                 :            : {
     287                 :         48 :     rtl::Reference< Cell > xCell( new Cell( rTableObj, pOutlinerParaObject ) );
     288         [ +  - ]:         48 :     if( xCell->mxTable.is() )
     289                 :            :     {
     290 [ +  - ][ +  - ]:         48 :         Reference< XEventListener > xListener( xCell.get() );
     291 [ +  - ][ +  - ]:         48 :         xCell->mxTable->addEventListener( xListener );
     292                 :            :     }
     293                 :         48 :     return xCell;
     294                 :            : }
     295                 :            : 
     296                 :            : // -----------------------------------------------------------------------------
     297                 :            : 
     298                 :         48 : Cell::Cell( SdrTableObj& rTableObj, OutlinerParaObject* pOutlinerParaObject ) throw()
     299                 :            : : SdrText( rTableObj, pOutlinerParaObject )
     300         [ +  - ]:         48 : , Cell_Base( ImplGetSvxUnoOutlinerTextCursorSvxPropertySet() )
     301         [ +  - ]:         48 : , mpPropSet( ImplGetSvxCellPropertySet() )
     302         [ +  - ]:         48 : , mpProperties( new sdr::properties::CellProperties( rTableObj, this ) )
     303                 :            : , mnCellContentType( CellContentType_EMPTY )
     304                 :            : , mfValue( 0.0 )
     305                 :            : , mnError( 0 )
     306                 :            : , mbMerged( sal_False )
     307                 :            : , mnRowSpan( 1 )
     308                 :            : , mnColSpan( 1 )
     309 [ +  - ][ +  - ]:        192 : , mxTable( rTableObj.getTable() )
         [ +  - ][ +  - ]
     310                 :            : {
     311 [ +  - ][ +  - ]:         48 :     if( rTableObj.GetModel() )
     312 [ +  - ][ +  - ]:         48 :         SetModel( rTableObj.GetModel() );
     313                 :         48 : }
     314                 :            : 
     315                 :            : // -----------------------------------------------------------------------------
     316                 :            : 
     317                 :         48 : Cell::~Cell() throw()
     318                 :            : {
     319         [ +  - ]:         48 :     dispose();
     320         [ -  + ]:         96 : }
     321                 :            : 
     322                 :            : // -----------------------------------------------------------------------------
     323                 :            : 
     324                 :        144 : void Cell::dispose()
     325                 :            : {
     326         [ -  + ]:        144 :     if( mxTable.is() )
     327                 :            :     {
     328                 :            :         try
     329                 :            :         {
     330         [ #  # ]:          0 :             Reference< XEventListener > xThis( this );
     331 [ #  # ][ #  # ]:          0 :             mxTable->removeEventListener( xThis );
                 [ #  # ]
     332                 :            :         }
     333                 :          0 :         catch( Exception& )
     334                 :            :         {
     335                 :            :             OSL_FAIL("Cell::dispose(), exception caught!");
     336                 :            :         }
     337                 :          0 :         mxTable.clear();
     338                 :            :     }
     339                 :            : 
     340         [ +  + ]:        144 :     if( mpProperties )
     341                 :            :     {
     342         [ +  - ]:         48 :         delete mpProperties;
     343                 :         48 :         mpProperties = 0;
     344                 :            :     }
     345                 :        144 :     SetOutlinerParaObject( 0 );
     346                 :        144 : }
     347                 :            : 
     348                 :            : // -----------------------------------------------------------------------------
     349                 :            : 
     350                 :         48 : void Cell::SetModel(SdrModel* pNewModel)
     351                 :            : {
     352         [ +  - ]:         48 :     SvxTextEditSource* pTextEditSource = dynamic_cast< SvxTextEditSource* >( GetEditSource() );
     353 [ +  - ][ +  - ]:         48 :     if( (GetModel() != pNewModel) || ( pNewModel && !pTextEditSource) )
         [ +  - ][ +  - ]
     354                 :            :     {
     355         [ +  - ]:         48 :         if( mpProperties )
     356                 :            :         {
     357                 :         48 :             SfxItemPool* pItemPool = mpProperties->GetObjectItemSet().GetPool();
     358                 :            : 
     359                 :            :             // test for correct pool in ItemSet; move to new pool if necessary
     360 [ +  - ][ -  + ]:         48 :             if( pNewModel && pItemPool && pItemPool != &pNewModel->GetItemPool())
         [ -  + ][ +  - ]
     361                 :          0 :                 mpProperties->MoveToItemPool(pItemPool, &pNewModel->GetItemPool(), pNewModel);
     362                 :            :         }
     363                 :            : 
     364         [ -  + ]:         48 :         if( pTextEditSource )
     365                 :            :         {
     366                 :          0 :             pTextEditSource->ChangeModel( pNewModel );
     367                 :            :         }
     368                 :            :         else
     369                 :            :         {
     370         [ +  - ]:         48 :             SetEditSource( new SvxTextEditSource( &GetObject(), this, static_cast< XWeak * >( this ) ) );
     371                 :            :         }
     372                 :            : 
     373                 :         48 :         SetStyleSheet( 0, sal_True );
     374                 :         48 :         SdrText::SetModel( pNewModel );
     375                 :         48 :         ForceOutlinerParaObject( OUTLINERMODE_TEXTOBJECT );
     376                 :            :     }
     377                 :         48 : }
     378                 :            : 
     379                 :            : // -----------------------------------------------------------------------------
     380                 :            : 
     381                 :          0 : void Cell::merge( sal_Int32 nColumnSpan, sal_Int32 nRowSpan )
     382                 :            : {
     383 [ #  # ][ #  # ]:          0 :     if( (mnColSpan != nColumnSpan) || (mnRowSpan != nRowSpan) || (mbMerged != sal_False) )
                 [ #  # ]
     384                 :            :     {
     385                 :          0 :         mnColSpan = nColumnSpan;
     386                 :          0 :         mnRowSpan = nRowSpan;
     387                 :          0 :         mbMerged = sal_False;
     388                 :          0 :         notifyModified();
     389                 :            :     }
     390                 :          0 : }
     391                 :            : 
     392                 :            : // -----------------------------------------------------------------------------
     393                 :            : 
     394                 :          0 : void Cell::mergeContent( const CellRef& xSourceCell )
     395                 :            : {
     396         [ #  # ]:          0 :     SdrTableObj& rTableObj = dynamic_cast< SdrTableObj& >( GetObject() );
     397                 :            : 
     398         [ #  # ]:          0 :     if( xSourceCell->hasText() )
     399                 :            :     {
     400                 :          0 :         SdrOutliner& rOutliner=rTableObj.ImpGetDrawOutliner();
     401                 :          0 :         rOutliner.SetUpdateMode(sal_True);
     402                 :            : 
     403         [ #  # ]:          0 :         if( hasText() )
     404                 :            :         {
     405                 :          0 :             rOutliner.SetText(*GetOutlinerParaObject());
     406                 :          0 :             rOutliner.AddText(*xSourceCell->GetOutlinerParaObject());
     407                 :            :         }
     408                 :            :         else
     409                 :            :         {
     410                 :          0 :             rOutliner.SetText(*xSourceCell->GetOutlinerParaObject());
     411                 :            :         }
     412                 :            : 
     413                 :          0 :         SetOutlinerParaObject( rOutliner.CreateParaObject() );
     414                 :          0 :         rOutliner.Clear();
     415                 :          0 :         xSourceCell->SetOutlinerParaObject(rOutliner.CreateParaObject());
     416                 :          0 :         rOutliner.Clear();
     417                 :          0 :         SetStyleSheet( GetStyleSheet(), sal_True );
     418                 :            :     }
     419                 :          0 : }
     420                 :            : 
     421                 :            : // -----------------------------------------------------------------------------
     422                 :            : 
     423                 :          0 : void Cell::cloneFrom( const CellRef& xCell )
     424                 :            : {
     425         [ #  # ]:          0 :     if( xCell.is() )
     426                 :            :     {
     427                 :          0 :         replaceContentAndFormating( xCell );
     428                 :            : 
     429                 :          0 :         mnCellContentType = xCell->mnCellContentType;
     430                 :            : 
     431                 :          0 :         msFormula = xCell->msFormula;
     432                 :          0 :         mfValue = xCell->mfValue;
     433                 :          0 :         mnError = xCell->mnError;
     434                 :            : 
     435                 :          0 :         mbMerged = xCell->mbMerged;
     436                 :          0 :         mnRowSpan = xCell->mnRowSpan;
     437                 :          0 :         mnColSpan = xCell->mnColSpan;
     438                 :            : 
     439                 :            :     }
     440                 :          0 :     notifyModified();
     441                 :          0 : }
     442                 :            : 
     443                 :          0 : void Cell::replaceContentAndFormating( const CellRef& xSourceCell )
     444                 :            : {
     445 [ #  # ][ #  # ]:          0 :     if( xSourceCell.is() && mpProperties )
                 [ #  # ]
     446                 :            :     {
     447                 :          0 :         mpProperties->SetMergedItemSet( xSourceCell->GetObjectItemSet() );
     448         [ #  # ]:          0 :         SetOutlinerParaObject( new OutlinerParaObject(*xSourceCell->GetOutlinerParaObject()) );
     449                 :            : 
     450         [ #  # ]:          0 :         SdrTableObj& rTableObj = dynamic_cast< SdrTableObj& >( GetObject() );
     451         [ #  # ]:          0 :         SdrTableObj& rSourceTableObj = dynamic_cast< SdrTableObj& >( xSourceCell->GetObject() );
     452                 :            : 
     453         [ #  # ]:          0 :         if(rSourceTableObj.GetModel() != rTableObj.GetModel())
     454                 :            :         {
     455                 :          0 :             SetStyleSheet( 0, sal_True );
     456                 :            :         }
     457                 :            :     }
     458                 :          0 : }
     459                 :            : 
     460                 :            : // -----------------------------------------------------------------------------
     461                 :            : 
     462                 :          0 : void Cell::setMerged()
     463                 :            : {
     464         [ #  # ]:          0 :     if( !mbMerged )
     465                 :            :     {
     466                 :          0 :         mbMerged = sal_True;
     467                 :          0 :         notifyModified();
     468                 :            :     }
     469                 :          0 : }
     470                 :            : 
     471                 :            : // -----------------------------------------------------------------------------
     472                 :            : 
     473                 :         96 : void Cell::notifyModified()
     474                 :            : {
     475         [ +  - ]:         96 :     if( mxTable.is() )
     476                 :         96 :         mxTable->setModified( sal_True );
     477                 :         96 : }
     478                 :            : 
     479                 :            : // -----------------------------------------------------------------------------
     480                 :            : // SdrTextShape proxy
     481                 :            : // -----------------------------------------------------------------------------
     482                 :            : 
     483                 :        192 : bool Cell::IsTextEditActive()
     484                 :            : {
     485                 :        192 :     bool isActive = false;
     486         [ +  - ]:        192 :     SdrTableObj& rTableObj = dynamic_cast< SdrTableObj& >( GetObject() );
     487         [ +  + ]:        192 :     if(rTableObj.getActiveCell().get() == this )
     488                 :            :     {
     489                 :         24 :         OutlinerParaObject* pParaObj = rTableObj.GetEditOutlinerParaObject();
     490         [ -  + ]:         24 :         if( pParaObj != 0 )
     491                 :            :         {
     492                 :          0 :             isActive = true;
     493         [ #  # ]:          0 :             delete pParaObj;
     494                 :            :         }
     495                 :            :     }
     496                 :        192 :     return isActive;
     497                 :            : }
     498                 :            : 
     499                 :            : // -----------------------------------------------------------------------------
     500                 :            : 
     501                 :          0 : bool Cell::hasText() const
     502                 :            : {
     503                 :          0 :     OutlinerParaObject* pParaObj = GetOutlinerParaObject();
     504         [ #  # ]:          0 :     if( pParaObj )
     505                 :            :     {
     506                 :          0 :         const EditTextObject& rTextObj = pParaObj->GetTextObject();
     507         [ #  # ]:          0 :         if( rTextObj.GetParagraphCount() >= 1 )
     508                 :            :         {
     509         [ #  # ]:          0 :             if( rTextObj.GetParagraphCount() == 1 )
     510                 :            :             {
     511         [ #  # ]:          0 :                 if( rTextObj.GetText(0).Len() == 0 )
     512                 :          0 :                     return false;
     513                 :            :             }
     514                 :          0 :             return true;
     515                 :            :         }
     516                 :            :     }
     517                 :            : 
     518                 :          0 :     return false;
     519                 :            : }
     520                 :            : 
     521                 :            : // -----------------------------------------------------------------------------
     522                 :            : 
     523                 :         96 : OutlinerParaObject* Cell::GetEditOutlinerParaObject() const
     524                 :            : {
     525         [ +  - ]:         96 :     SdrTableObj& rTableObj = dynamic_cast< SdrTableObj& >( GetObject() );
     526         [ +  + ]:         96 :     if( rTableObj.getActiveCell().get() == this )
     527                 :         12 :         return rTableObj.GetEditOutlinerParaObject();
     528                 :         96 :     return 0;
     529                 :            : }
     530                 :            : 
     531                 :            : // -----------------------------------------------------------------------------
     532                 :            : 
     533                 :         96 : void Cell::SetStyleSheet( SfxStyleSheet* pStyleSheet, sal_Bool bDontRemoveHardAttr )
     534                 :            : {
     535                 :            :     // only allow cell styles for cells
     536 [ +  + ][ -  + ]:         96 :     if( pStyleSheet && pStyleSheet->GetFamily() != SFX_STYLE_FAMILY_FRAME )
                 [ -  + ]
     537                 :         96 :         return;
     538                 :            : 
     539 [ +  - ][ +  + ]:         96 :     if( mpProperties && (mpProperties->GetStyleSheet() != pStyleSheet) )
                 [ +  + ]
     540                 :            :     {
     541                 :         48 :         mpProperties->SetStyleSheet( pStyleSheet, bDontRemoveHardAttr );
     542                 :            :     }
     543                 :            : }
     544                 :            : 
     545                 :            : // -----------------------------------------------------------------------------
     546                 :            : 
     547                 :          0 : const SfxItemSet& Cell::GetObjectItemSet()
     548                 :            : {
     549         [ #  # ]:          0 :     if( mpProperties )
     550                 :            :     {
     551                 :          0 :         return mpProperties->GetObjectItemSet();
     552                 :            :     }
     553                 :            :     else
     554                 :            :     {
     555                 :            :         OSL_FAIL("Cell::GetObjectItemSet(), called without properties!");
     556                 :          0 :         return GetObject().GetObjectItemSet();
     557                 :            :     }
     558                 :            : }
     559                 :            : 
     560                 :          0 : void Cell::SetObjectItem(const SfxPoolItem& rItem)
     561                 :            : {
     562         [ #  # ]:          0 :     if( mpProperties )
     563                 :            :     {
     564                 :          0 :         mpProperties->SetObjectItem( rItem );
     565                 :          0 :         notifyModified();
     566                 :            :     }
     567                 :          0 : }
     568                 :            : 
     569                 :          0 : void Cell::SetMergedItem(const SfxPoolItem& rItem)
     570                 :            : {
     571                 :          0 :     SetObjectItem(rItem);
     572                 :          0 : }
     573                 :            : 
     574                 :        330 : SfxStyleSheet* Cell::GetStyleSheet() const
     575                 :            : {
     576         [ +  + ]:        330 :     if( mpProperties )
     577                 :        186 :         return mpProperties->GetStyleSheet();
     578                 :            :     else
     579                 :        330 :         return 0;
     580                 :            : }
     581                 :            : 
     582                 :            : // -----------------------------------------------------------------------------
     583                 :            : 
     584                 :          0 : const Rectangle& Cell::GetCurrentBoundRect() const
     585                 :            : {
     586                 :          0 :     return maCellRect;
     587                 :            : }
     588                 :            : 
     589                 :            : // -----------------------------------------------------------------------------
     590                 :            : 
     591                 :        432 : void Cell::TakeTextAnchorRect(Rectangle& rAnchorRect) const
     592                 :            : {
     593                 :        432 :     rAnchorRect.nLeft = maCellRect.nLeft + GetTextLeftDistance();
     594                 :        432 :     rAnchorRect.nRight = maCellRect.nRight - GetTextRightDistance();
     595                 :        432 :     rAnchorRect.nTop = maCellRect.nTop + GetTextUpperDistance();
     596                 :        432 :     rAnchorRect.nBottom = maCellRect.nBottom - GetTextLowerDistance();
     597                 :        432 : }
     598                 :            : 
     599                 :            : // -----------------------------------------------------------------------------
     600                 :            : 
     601                 :       3672 : const SfxItemSet& Cell::GetItemSet() const
     602                 :            : {
     603                 :       3672 :     return mpProperties->GetObjectItemSet();
     604                 :            : }
     605                 :            : 
     606                 :            : // -----------------------------------------------------------------------------
     607                 :            : 
     608                 :          0 : void Cell::SetMergedItemSetAndBroadcast(const SfxItemSet& rSet, sal_Bool bClearAllItems)
     609                 :            : {
     610         [ #  # ]:          0 :     if( mpProperties )
     611                 :            :     {
     612                 :          0 :         mpProperties->SetMergedItemSetAndBroadcast(rSet, bClearAllItems);
     613                 :          0 :         notifyModified();
     614                 :            :     }
     615                 :          0 : }
     616                 :            : 
     617                 :            : // -----------------------------------------------------------------------------
     618                 :            : 
     619                 :        432 : sal_Int32 Cell::getMinimumWidth()
     620                 :            : {
     621                 :        432 :     return GetTextLeftDistance() + GetTextRightDistance() + 100;
     622                 :            : }
     623                 :            : 
     624                 :            : // -----------------------------------------------------------------------------
     625                 :            : 
     626                 :        432 : sal_Int32 Cell::getMinimumHeight()
     627                 :            : {
     628         [ -  + ]:        432 :     if( !mpProperties )
     629                 :          0 :         return 0;
     630                 :            : 
     631         [ +  - ]:        432 :     SdrTableObj& rTableObj = dynamic_cast< SdrTableObj& >( GetObject() );
     632                 :        432 :     sal_Int32 nMinimumHeight = 0;
     633                 :            : 
     634         [ +  - ]:        432 :     Rectangle aTextRect;
     635         [ +  - ]:        432 :     TakeTextAnchorRect( aTextRect );
     636         [ +  - ]:        432 :     Size aSize( aTextRect.GetSize() );
     637                 :        432 :     aSize.Height()=0x0FFFFFFF;
     638                 :            : 
     639         [ +  - ]:        432 :     SdrOutliner* pEditOutliner = rTableObj.GetCellTextEditOutliner( *this );
     640         [ -  + ]:        432 :     if(pEditOutliner)
     641                 :            :     {
     642         [ #  # ]:          0 :         pEditOutliner->SetMaxAutoPaperSize(aSize);
     643         [ #  # ]:          0 :         nMinimumHeight = pEditOutliner->GetTextHeight()+1;
     644                 :            :     }
     645                 :            :     else /*if ( hasText() )*/
     646                 :            :     {
     647         [ +  - ]:        432 :         Outliner& rOutliner=rTableObj.ImpGetDrawOutliner();
     648         [ +  - ]:        432 :         rOutliner.SetPaperSize(aSize);
     649         [ +  - ]:        432 :         rOutliner.SetUpdateMode(sal_True);
     650         [ +  - ]:        432 :         ForceOutlinerParaObject( OUTLINERMODE_TEXTOBJECT );
     651                 :            : 
     652 [ +  - ][ +  - ]:        432 :         if( GetOutlinerParaObject() )
     653                 :            :         {
     654 [ +  - ][ +  - ]:        432 :             rOutliner.SetText(*GetOutlinerParaObject());
     655                 :            :         }
     656         [ +  - ]:        432 :         nMinimumHeight=rOutliner.GetTextHeight()+1;
     657         [ +  - ]:        432 :         rOutliner.Clear();
     658                 :            :     }
     659                 :            : 
     660 [ +  - ][ +  - ]:        432 :     nMinimumHeight += GetTextUpperDistance() + GetTextLowerDistance();
     661                 :        432 :     return nMinimumHeight;
     662                 :            : }
     663                 :            : 
     664                 :            : // -----------------------------------------------------------------------------
     665                 :            : 
     666                 :        864 : long Cell::GetTextLeftDistance() const
     667                 :            : {
     668                 :        864 :     return ((SdrTextLeftDistItem&)(GetItemSet().Get(SDRATTR_TEXT_LEFTDIST))).GetValue();
     669                 :            : }
     670                 :            : 
     671                 :            : // -----------------------------------------------------------------------------
     672                 :            : 
     673                 :        864 : long Cell::GetTextRightDistance() const
     674                 :            : {
     675                 :        864 :     return ((SdrTextRightDistItem&)(GetItemSet().Get(SDRATTR_TEXT_RIGHTDIST))).GetValue();
     676                 :            : }
     677                 :            : 
     678                 :            : // -----------------------------------------------------------------------------
     679                 :            : 
     680                 :        864 : long Cell::GetTextUpperDistance() const
     681                 :            : {
     682                 :        864 :     return ((SdrTextUpperDistItem&)(GetItemSet().Get(SDRATTR_TEXT_UPPERDIST))).GetValue();
     683                 :            : }
     684                 :            : 
     685                 :            : // -----------------------------------------------------------------------------
     686                 :            : 
     687                 :        864 : long Cell::GetTextLowerDistance() const
     688                 :            : {
     689                 :        864 :     return ((SdrTextLowerDistItem&)(GetItemSet().Get(SDRATTR_TEXT_LOWERDIST))).GetValue();
     690                 :            : }
     691                 :            : 
     692                 :            : // -----------------------------------------------------------------------------
     693                 :            : 
     694                 :          0 : SdrTextVertAdjust Cell::GetTextVerticalAdjust() const
     695                 :            : {
     696                 :          0 :     return ((SdrTextVertAdjustItem&)(GetItemSet().Get(SDRATTR_TEXT_VERTADJUST))).GetValue();
     697                 :            : }
     698                 :            : 
     699                 :            : // -----------------------------------------------------------------------------
     700                 :            : 
     701                 :          0 : SdrTextHorzAdjust Cell::GetTextHorizontalAdjust() const
     702                 :            : {
     703                 :          0 :     return ((SdrTextHorzAdjustItem&)(GetItemSet().Get(SDRATTR_TEXT_HORZADJUST))).GetValue();
     704                 :            : }
     705                 :            : 
     706                 :            : // -----------------------------------------------------------------------------
     707                 :            : 
     708                 :        792 : void Cell::SetOutlinerParaObject( OutlinerParaObject* pTextObject )
     709                 :            : {
     710                 :        792 :     SdrText::SetOutlinerParaObject( pTextObject );
     711                 :        792 :     maSelection.nStartPara = 0xffff;
     712                 :            : 
     713         [ +  + ]:        792 :     if( pTextObject == 0 )
     714                 :        144 :         ForceOutlinerParaObject( OUTLINERMODE_TEXTOBJECT );
     715                 :        792 : }
     716                 :            : 
     717                 :            : // -----------------------------------------------------------------------------
     718                 :            : 
     719                 :          0 : void Cell::AddUndo()
     720                 :            : {
     721                 :          0 :     SdrObject& rObj = GetObject();
     722 [ #  # ][ #  # ]:          0 :     if( rObj.IsInserted() && GetModel() && GetModel()->IsUndoEnabled() )
         [ #  # ][ #  # ]
     723                 :            :     {
     724                 :          0 :         CellRef xCell( this );
     725 [ #  # ][ #  # ]:          0 :         GetModel()->AddUndo( new CellUndo( &rObj, xCell ) );
         [ #  # ][ #  # ]
                 [ #  # ]
     726                 :            :     }
     727                 :          0 : }
     728                 :            : 
     729                 :            : // -----------------------------------------------------------------------------
     730                 :            : 
     731                 :          0 : sdr::properties::TextProperties* Cell::CloneProperties( sdr::properties::TextProperties* pProperties, SdrObject& rNewObj, Cell& rNewCell )
     732                 :            : {
     733         [ #  # ]:          0 :     if( pProperties )
     734         [ #  # ]:          0 :         return new sdr::properties::CellProperties( *static_cast<sdr::properties::CellProperties*>(pProperties), rNewObj, &rNewCell );
     735                 :            :     else
     736                 :          0 :         return 0;
     737                 :            : }
     738                 :            : 
     739                 :            : // -----------------------------------------------------------------------------
     740                 :            : 
     741                 :          0 : sdr::properties::TextProperties* Cell::CloneProperties( SdrObject& rNewObj, Cell& rNewCell )
     742                 :            : {
     743                 :          0 :     return CloneProperties(mpProperties,rNewObj,rNewCell);
     744                 :            : }
     745                 :            : 
     746                 :            : // -----------------------------------------------------------------------------
     747                 :            : // XServiceInfo
     748                 :            : // -----------------------------------------------------------------------------
     749                 :            : 
     750                 :          0 : OUString SAL_CALL Cell::getImplementationName(  ) throw (RuntimeException)
     751                 :            : {
     752                 :          0 :     return OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svx.table.Cell" ) );
     753                 :            : }
     754                 :            : 
     755                 :            : // -----------------------------------------------------------------------------
     756                 :            : 
     757                 :          0 : sal_Bool SAL_CALL Cell::supportsService( const OUString& ServiceName ) throw (RuntimeException)
     758                 :            : {
     759         [ #  # ]:          0 :     if( ServiceName == "com.sun.star.table.cell" )
     760                 :          0 :         return sal_True;
     761                 :            : 
     762         [ #  # ]:          0 :     if( ServiceName == "com.sun.star.drawing.cell" )
     763                 :          0 :         return sal_True;
     764                 :            : 
     765                 :          0 :     return SvxUnoTextBase::supportsService( ServiceName );
     766                 :            : }
     767                 :            : 
     768                 :            : // -----------------------------------------------------------------------------
     769                 :            : 
     770                 :          0 : Sequence< OUString > SAL_CALL Cell::getSupportedServiceNames(  ) throw (RuntimeException)
     771                 :            : {
     772                 :          0 :     Sequence< OUString > aSeq( SvxUnoTextBase::getSupportedServiceNames() );
     773                 :          0 :     sal_Int32 nIndex = aSeq.getLength();
     774         [ #  # ]:          0 :     aSeq.realloc( nIndex + 2 );
     775 [ #  # ][ #  # ]:          0 :     aSeq[nIndex++] = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.table.cell" ) );
     776 [ #  # ][ #  # ]:          0 :     aSeq[nIndex++] = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.cell" ) );
     777                 :          0 :     return aSeq;
     778                 :            : }
     779                 :            : 
     780                 :            : // -----------------------------------------------------------------------------
     781                 :            : // XLayoutConstrains
     782                 :            : // -----------------------------------------------------------------------------
     783                 :            : 
     784                 :        432 : ::com::sun::star::awt::Size SAL_CALL Cell::getMinimumSize(  ) throw (RuntimeException)
     785                 :            : {
     786         [ +  - ]:        432 :     return ::com::sun::star::awt::Size( getMinimumWidth(),  getMinimumHeight() );
     787                 :            : }
     788                 :            : 
     789                 :            : // -----------------------------------------------------------------------------
     790                 :            : 
     791                 :          0 : ::com::sun::star::awt::Size SAL_CALL Cell::getPreferredSize(  ) throw (RuntimeException)
     792                 :            : {
     793                 :          0 :     return getMinimumSize();
     794                 :            : }
     795                 :            : 
     796                 :            : // -----------------------------------------------------------------------------
     797                 :            : 
     798                 :          0 : ::com::sun::star::awt::Size SAL_CALL Cell::calcAdjustedSize( const ::com::sun::star::awt::Size& aNewSize ) throw (RuntimeException)
     799                 :            : {
     800                 :          0 :     return aNewSize;
     801                 :            : }
     802                 :            : 
     803                 :            : // -----------------------------------------------------------------------------
     804                 :            : // XMergeableCell
     805                 :            : // -----------------------------------------------------------------------------
     806                 :            : 
     807                 :       1020 : sal_Int32 SAL_CALL Cell::getRowSpan() throw (RuntimeException)
     808                 :            : {
     809                 :       1020 :     return mnRowSpan;
     810                 :            : }
     811                 :            : 
     812                 :            : // -----------------------------------------------------------------------------
     813                 :            : 
     814                 :        915 : sal_Int32 SAL_CALL Cell::getColumnSpan() throw (RuntimeException)
     815                 :            : {
     816                 :        915 :     return mnColSpan;
     817                 :            : }
     818                 :            : 
     819                 :            : // -----------------------------------------------------------------------------
     820                 :            : 
     821                 :       1725 : sal_Bool SAL_CALL Cell::isMerged() throw (RuntimeException)
     822                 :            : {
     823                 :       1725 :     return mbMerged;
     824                 :            : }
     825                 :            : 
     826                 :            : // -----------------------------------------------------------------------------
     827                 :            : // XCell
     828                 :            : // -----------------------------------------------------------------------------
     829                 :            : 
     830                 :          0 : OUString SAL_CALL Cell::getFormula(  ) throw (RuntimeException)
     831                 :            : {
     832                 :          0 :     return msFormula;
     833                 :            : }
     834                 :            : 
     835                 :            : // -----------------------------------------------------------------------------
     836                 :            : 
     837                 :          0 : void SAL_CALL Cell::setFormula( const OUString& aFormula ) throw (RuntimeException)
     838                 :            : {
     839         [ #  # ]:          0 :     if( msFormula != aFormula )
     840                 :            :     {
     841                 :          0 :         msFormula = aFormula;
     842                 :            :     }
     843                 :          0 : }
     844                 :            : 
     845                 :            : // -----------------------------------------------------------------------------
     846                 :            : 
     847                 :          0 : double SAL_CALL Cell::getValue(  ) throw (RuntimeException)
     848                 :            : {
     849                 :          0 :     return mfValue;
     850                 :            : }
     851                 :            : 
     852                 :            : // -----------------------------------------------------------------------------
     853                 :            : 
     854                 :          0 : void SAL_CALL Cell::setValue( double nValue ) throw (RuntimeException)
     855                 :            : {
     856         [ #  # ]:          0 :     if( mfValue != nValue )
     857                 :            :     {
     858                 :          0 :         mfValue = nValue;
     859                 :          0 :         mnCellContentType = CellContentType_VALUE;
     860                 :            :     }
     861                 :          0 : }
     862                 :            : 
     863                 :            : // -----------------------------------------------------------------------------
     864                 :            : 
     865                 :          0 : CellContentType SAL_CALL Cell::getType() throw (RuntimeException)
     866                 :            : {
     867                 :          0 :     return mnCellContentType;
     868                 :            : }
     869                 :            : 
     870                 :            : // -----------------------------------------------------------------------------
     871                 :            : 
     872                 :          0 : sal_Int32 SAL_CALL Cell::getError(  ) throw (RuntimeException)
     873                 :            : {
     874                 :          0 :     return mnError;
     875                 :            : }
     876                 :            : 
     877                 :            : // -----------------------------------------------------------------------------
     878                 :            : // XPropertySet
     879                 :            : // -----------------------------------------------------------------------------
     880                 :            : 
     881                 :          0 : Any Cell::GetAnyForItem( SfxItemSet& aSet, const SfxItemPropertySimpleEntry* pMap )
     882                 :            : {
     883                 :          0 :     Any aAny( SvxItemPropertySet_getPropertyValue( *mpPropSet, pMap, aSet ) );
     884                 :            : 
     885         [ #  # ]:          0 :     if( *pMap->pType != aAny.getValueType() )
     886                 :            :     {
     887                 :            :         // since the sfx uint16 item now exports a sal_Int32, we may have to fix this here
     888 [ #  # ][ #  # ]:          0 :         if( ( *pMap->pType == ::getCppuType((const sal_Int16*)0)) && aAny.getValueType() == ::getCppuType((const sal_Int32*)0) )
         [ #  # ][ #  # ]
                 [ #  # ]
     889                 :            :         {
     890                 :          0 :             sal_Int32 nValue = 0;
     891                 :          0 :             aAny >>= nValue;
     892         [ #  # ]:          0 :             aAny <<= (sal_Int16)nValue;
     893                 :            :         }
     894                 :            :         else
     895                 :            :         {
     896                 :            :             OSL_FAIL("GetAnyForItem() Returnvalue has wrong Type!" );
     897                 :            :         }
     898                 :            :     }
     899                 :            : 
     900                 :          0 :     return aAny;
     901                 :            : }
     902                 :            : 
     903                 :         48 : Reference< XPropertySetInfo > SAL_CALL Cell::getPropertySetInfo() throw(RuntimeException)
     904                 :            : {
     905                 :         48 :     return mpPropSet->getPropertySetInfo();
     906                 :            : }
     907                 :            : 
     908                 :            : // -----------------------------------------------------------------------------
     909                 :            : 
     910                 :         48 : void SAL_CALL Cell::setPropertyValue( const OUString& rPropertyName, const Any& rValue ) throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException)
     911                 :            : {
     912         [ +  - ]:         48 :     ::SolarMutexGuard aGuard;
     913                 :            : 
     914 [ +  - ][ -  + ]:         48 :     if( (mpProperties == 0) || (GetModel() == 0) )
                 [ -  + ]
     915         [ #  # ]:          0 :         throw DisposedException();
     916                 :            : 
     917         [ +  - ]:         48 :     const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMapEntry(rPropertyName);
     918         [ +  - ]:         48 :     if( pMap )
     919                 :            :     {
     920         [ -  + ]:         48 :         if( (pMap->nFlags & PropertyAttribute::READONLY ) != 0 )
     921         [ #  # ]:          0 :             throw PropertyVetoException();
     922                 :            : 
     923   [ -  -  +  - ]:         48 :         switch( pMap->nWID )
     924                 :            :         {
     925                 :            :         case OWN_ATTR_STYLE:
     926                 :            :         {
     927                 :          0 :             Reference< XStyle > xStyle;
     928 [ #  # ][ #  # ]:          0 :             if( !( rValue >>= xStyle ) )
     929         [ #  # ]:          0 :                 throw IllegalArgumentException();
     930                 :            : 
     931         [ #  # ]:          0 :             SfxUnoStyleSheet* pStyle = SfxUnoStyleSheet::getUnoStyleSheet(xStyle);
     932         [ #  # ]:          0 :             SetStyleSheet( pStyle, sal_True );
     933                 :          0 :             return;
     934                 :            :         }
     935                 :            :         case OWN_ATTR_TABLEBORDER:
     936                 :            :         {
     937 [ #  # ][ #  # ]:          0 :             if(rValue.getValueType() != ::getCppuType((const TableBorder*)0) )
     938                 :            :                 break;
     939                 :            : 
     940                 :          0 :             const TableBorder* pBorder = (const TableBorder* )rValue.getValue();
     941         [ #  # ]:          0 :             if( pBorder == NULL )
     942                 :            :                 break;
     943                 :            : 
     944         [ #  # ]:          0 :             SvxBoxItem aBox( SDRATTR_TABLE_BORDER );
     945         [ #  # ]:          0 :             SvxBoxInfoItem aBoxInfo( SDRATTR_TABLE_BORDER_INNER );
     946         [ #  # ]:          0 :             SvxBorderLine aLine;
     947                 :            : 
     948         [ #  # ]:          0 :             sal_Bool bSet = SvxBoxItem::LineToSvxLine(pBorder->TopLine, aLine, false);
     949 [ #  # ][ #  # ]:          0 :             aBox.SetLine(bSet ? &aLine : 0, BOX_LINE_TOP);
     950                 :          0 :             aBoxInfo.SetValid(VALID_TOP, pBorder->IsTopLineValid);
     951                 :            : 
     952         [ #  # ]:          0 :             bSet = SvxBoxItem::LineToSvxLine(pBorder->BottomLine, aLine, false);
     953 [ #  # ][ #  # ]:          0 :             aBox.SetLine(bSet ? &aLine : 0, BOX_LINE_BOTTOM);
     954                 :          0 :             aBoxInfo.SetValid(VALID_BOTTOM, pBorder->IsBottomLineValid);
     955                 :            : 
     956         [ #  # ]:          0 :             bSet = SvxBoxItem::LineToSvxLine(pBorder->LeftLine, aLine, false);
     957 [ #  # ][ #  # ]:          0 :             aBox.SetLine(bSet ? &aLine : 0, BOX_LINE_LEFT);
     958                 :          0 :             aBoxInfo.SetValid(VALID_LEFT, pBorder->IsLeftLineValid);
     959                 :            : 
     960         [ #  # ]:          0 :             bSet = SvxBoxItem::LineToSvxLine(pBorder->RightLine, aLine, false);
     961 [ #  # ][ #  # ]:          0 :             aBox.SetLine(bSet ? &aLine : 0, BOX_LINE_RIGHT);
     962                 :          0 :             aBoxInfo.SetValid(VALID_RIGHT, pBorder->IsRightLineValid);
     963                 :            : 
     964         [ #  # ]:          0 :             bSet = SvxBoxItem::LineToSvxLine(pBorder->HorizontalLine, aLine, false);
     965 [ #  # ][ #  # ]:          0 :             aBoxInfo.SetLine(bSet ? &aLine : 0, BOXINFO_LINE_HORI);
     966                 :          0 :             aBoxInfo.SetValid(VALID_HORI, pBorder->IsHorizontalLineValid);
     967                 :            : 
     968         [ #  # ]:          0 :             bSet = SvxBoxItem::LineToSvxLine(pBorder->VerticalLine, aLine, false);
     969 [ #  # ][ #  # ]:          0 :             aBoxInfo.SetLine(bSet ? &aLine : 0, BOXINFO_LINE_VERT);
     970                 :          0 :             aBoxInfo.SetValid(VALID_VERT, pBorder->IsVerticalLineValid);
     971                 :            : 
     972         [ #  # ]:          0 :             aBox.SetDistance(pBorder->Distance, false);
     973                 :          0 :             aBoxInfo.SetValid(VALID_DISTANCE, pBorder->IsDistanceValid);
     974                 :            : 
     975         [ #  # ]:          0 :             mpProperties->SetObjectItem(aBox);
     976         [ #  # ]:          0 :             mpProperties->SetObjectItem(aBoxInfo);
     977 [ #  # ][ #  # ]:          0 :             return;
     978                 :            :         }
     979                 :            :         case OWN_ATTR_FILLBMP_MODE:
     980                 :            :         {
     981                 :            :             BitmapMode eMode;
     982 [ +  - ][ -  + ]:         48 :             if(!(rValue >>= eMode) )
     983                 :            :             {
     984                 :          0 :                 sal_Int32 nMode = 0;
     985         [ #  # ]:          0 :                 if(!(rValue >>= nMode))
     986         [ #  # ]:          0 :                     throw IllegalArgumentException();
     987                 :            : 
     988                 :          0 :                     eMode = (BitmapMode)nMode;
     989                 :            :             }
     990                 :            : 
     991 [ +  - ][ +  - ]:         48 :             mpProperties->SetObjectItem( XFillBmpStretchItem( eMode == BitmapMode_STRETCH ) );
                 [ +  - ]
     992 [ +  - ][ +  - ]:         48 :             mpProperties->SetObjectItem( XFillBmpTileItem( eMode == BitmapMode_REPEAT ) );
                 [ +  - ]
     993                 :            :             return;
     994                 :            :         }
     995                 :            :         default:
     996                 :            :         {
     997         [ #  # ]:          0 :             SfxItemSet aSet( GetModel()->GetItemPool(), pMap->nWID, pMap->nWID);
     998 [ #  # ][ #  # ]:          0 :             aSet.Put(mpProperties->GetItem(pMap->nWID));
     999                 :            : 
    1000                 :          0 :             bool bSpecial = false;
    1001                 :            : 
    1002         [ #  # ]:          0 :             switch( pMap->nWID )
    1003                 :            :             {
    1004                 :            :                 case XATTR_FILLBITMAP:
    1005                 :            :                 case XATTR_FILLGRADIENT:
    1006                 :            :                 case XATTR_FILLHATCH:
    1007                 :            :                 case XATTR_FILLFLOATTRANSPARENCE:
    1008                 :            :                 case XATTR_LINEEND:
    1009                 :            :                 case XATTR_LINESTART:
    1010                 :            :                 case XATTR_LINEDASH:
    1011                 :            :                 {
    1012         [ #  # ]:          0 :                     if( pMap->nMemberId == MID_NAME )
    1013                 :            :                     {
    1014                 :          0 :                         OUString aApiName;
    1015         [ #  # ]:          0 :                         if( rValue >>= aApiName )
    1016                 :            :                         {
    1017 [ #  # ][ #  # ]:          0 :                             if( SvxShape::SetFillAttribute( pMap->nWID, aApiName, aSet, GetModel() ) )
    1018                 :          0 :                                 bSpecial = true;
    1019                 :          0 :                         }
    1020                 :            :                     }
    1021                 :            :                 }
    1022                 :          0 :                 break;
    1023                 :            :             }
    1024                 :            : 
    1025         [ #  # ]:          0 :             if( !bSpecial )
    1026                 :            :             {
    1027                 :            : 
    1028 [ #  # ][ #  # ]:          0 :                 if( !SvxUnoTextRangeBase::SetPropertyValueHelper( aSet, pMap, rValue, aSet ))
    1029                 :            :                 {
    1030 [ #  # ][ #  # ]:          0 :                     if( aSet.GetItemState( pMap->nWID ) != SFX_ITEM_SET )
    1031                 :            :                     {
    1032                 :            :                         // Default aus ItemPool holen
    1033         [ #  # ]:          0 :                         if(GetModel()->GetItemPool().IsWhich(pMap->nWID))
    1034 [ #  # ][ #  # ]:          0 :                             aSet.Put(GetModel()->GetItemPool().GetDefaultItem(pMap->nWID));
    1035                 :            :                     }
    1036                 :            : 
    1037 [ #  # ][ #  # ]:          0 :                     if( aSet.GetItemState( pMap->nWID ) == SFX_ITEM_SET )
    1038                 :            :                     {
    1039         [ #  # ]:          0 :                         SvxItemPropertySet_setPropertyValue( *mpPropSet, pMap, rValue, aSet );
    1040                 :            :                     }
    1041                 :            :                 }
    1042                 :            :             }
    1043                 :            : 
    1044         [ #  # ]:          0 :             GetModel()->SetChanged();
    1045         [ #  # ]:          0 :             mpProperties->SetMergedItemSetAndBroadcast( aSet );
    1046         [ #  # ]:          0 :             return;
    1047                 :            :         }
    1048                 :            :         }
    1049                 :            :     }
    1050 [ #  # ][ +  - ]:         48 :     throw UnknownPropertyException();
    1051                 :            : }
    1052                 :            : 
    1053                 :            : // -----------------------------------------------------------------------------
    1054                 :            : 
    1055                 :          0 : Any SAL_CALL Cell::getPropertyValue( const OUString& PropertyName ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
    1056                 :            : {
    1057         [ #  # ]:          0 :     ::SolarMutexGuard aGuard;
    1058                 :            : 
    1059 [ #  # ][ #  # ]:          0 :     if( (mpProperties == 0) || (GetModel() == 0) )
                 [ #  # ]
    1060         [ #  # ]:          0 :         throw DisposedException();
    1061                 :            : 
    1062         [ #  # ]:          0 :     const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMapEntry(PropertyName);
    1063         [ #  # ]:          0 :     if( pMap )
    1064                 :            :     {
    1065   [ #  #  #  # ]:          0 :         switch( pMap->nWID )
    1066                 :            :         {
    1067                 :            :         case OWN_ATTR_STYLE:
    1068                 :            :         {
    1069 [ #  # ][ #  # ]:          0 :             return Any( Reference< XStyle >( dynamic_cast< SfxUnoStyleSheet* >( GetStyleSheet() ) ) );
         [ #  # ][ #  # ]
                 [ #  # ]
    1070                 :            :         }
    1071                 :            :         case OWN_ATTR_TABLEBORDER:
    1072                 :            :         {
    1073         [ #  # ]:          0 :             const SvxBoxInfoItem& rBoxInfoItem = static_cast<const SvxBoxInfoItem&>(mpProperties->GetItem(SDRATTR_TABLE_BORDER_INNER));
    1074         [ #  # ]:          0 :             const SvxBoxItem& rBox = static_cast<const SvxBoxItem&>(mpProperties->GetItem(SDRATTR_TABLE_BORDER));
    1075                 :            : 
    1076                 :          0 :              TableBorder aTableBorder;
    1077         [ #  # ]:          0 :             aTableBorder.TopLine                = SvxBoxItem::SvxLineToLine(rBox.GetTop(), false);
    1078                 :          0 :             aTableBorder.IsTopLineValid         = rBoxInfoItem.IsValid(VALID_TOP);
    1079         [ #  # ]:          0 :             aTableBorder.BottomLine             = SvxBoxItem::SvxLineToLine(rBox.GetBottom(), false);
    1080                 :          0 :             aTableBorder.IsBottomLineValid      = rBoxInfoItem.IsValid(VALID_BOTTOM);
    1081         [ #  # ]:          0 :             aTableBorder.LeftLine               = SvxBoxItem::SvxLineToLine(rBox.GetLeft(), false);
    1082                 :          0 :             aTableBorder.IsLeftLineValid        = rBoxInfoItem.IsValid(VALID_LEFT);
    1083         [ #  # ]:          0 :             aTableBorder.RightLine              = SvxBoxItem::SvxLineToLine(rBox.GetRight(), false);
    1084                 :          0 :             aTableBorder.IsRightLineValid       = rBoxInfoItem.IsValid(VALID_RIGHT );
    1085         [ #  # ]:          0 :             aTableBorder.HorizontalLine         = SvxBoxItem::SvxLineToLine(rBoxInfoItem.GetHori(), false);
    1086                 :          0 :             aTableBorder.IsHorizontalLineValid  = rBoxInfoItem.IsValid(VALID_HORI);
    1087         [ #  # ]:          0 :             aTableBorder.VerticalLine           = SvxBoxItem::SvxLineToLine(rBoxInfoItem.GetVert(), false);
    1088                 :          0 :             aTableBorder.IsVerticalLineValid    = rBoxInfoItem.IsValid(VALID_VERT);
    1089         [ #  # ]:          0 :             aTableBorder.Distance               = rBox.GetDistance();
    1090                 :          0 :             aTableBorder.IsDistanceValid        = rBoxInfoItem.IsValid(VALID_DISTANCE);
    1091                 :            : 
    1092         [ #  # ]:          0 :             return Any( aTableBorder );
    1093                 :            :         }
    1094                 :            :         case OWN_ATTR_FILLBMP_MODE:
    1095                 :            :         {
    1096         [ #  # ]:          0 :             const XFillBmpStretchItem& rStretchItem = static_cast<const XFillBmpStretchItem&>(mpProperties->GetItem(XATTR_FILLBMP_STRETCH));
    1097         [ #  # ]:          0 :             const XFillBmpTileItem& rTileItem = static_cast<const XFillBmpTileItem&>(mpProperties->GetItem(XATTR_FILLBMP_TILE));
    1098         [ #  # ]:          0 :             if( rTileItem.GetValue() )
    1099                 :            :             {
    1100         [ #  # ]:          0 :                 return Any( BitmapMode_REPEAT );
    1101                 :            :             }
    1102         [ #  # ]:          0 :             else if( rStretchItem.GetValue() )
    1103                 :            :             {
    1104         [ #  # ]:          0 :                 return Any(  BitmapMode_STRETCH );
    1105                 :            :             }
    1106                 :            :             else
    1107                 :            :             {
    1108         [ #  # ]:          0 :                 return Any(  BitmapMode_NO_REPEAT );
    1109                 :            :             }
    1110                 :            :         }
    1111                 :            :         default:
    1112                 :            :         {
    1113         [ #  # ]:          0 :             SfxItemSet aSet( GetModel()->GetItemPool(), pMap->nWID, pMap->nWID);
    1114 [ #  # ][ #  # ]:          0 :             aSet.Put(mpProperties->GetItem(pMap->nWID));
    1115                 :            : 
    1116                 :          0 :             Any aAny;
    1117 [ #  # ][ #  # ]:          0 :             if(!SvxUnoTextRangeBase::GetPropertyValueHelper( aSet, pMap, aAny ))
    1118                 :            :             {
    1119         [ #  # ]:          0 :                 if(!aSet.Count())
    1120                 :            :                 {
    1121                 :            :                     // Default aus ItemPool holen
    1122         [ #  # ]:          0 :                     if(GetModel()->GetItemPool().IsWhich(pMap->nWID))
    1123 [ #  # ][ #  # ]:          0 :                         aSet.Put(GetModel()->GetItemPool().GetDefaultItem(pMap->nWID));
    1124                 :            :                 }
    1125                 :            : 
    1126         [ #  # ]:          0 :                 if( aSet.Count() )
    1127         [ #  # ]:          0 :                     aAny = GetAnyForItem( aSet, pMap );
    1128                 :            :             }
    1129                 :            : 
    1130         [ #  # ]:          0 :             return aAny;
    1131                 :            :         }
    1132                 :            :         }
    1133                 :            :     }
    1134 [ #  # ][ #  # ]:          0 :     throw UnknownPropertyException();
    1135                 :            : }
    1136                 :            : 
    1137                 :            : // -----------------------------------------------------------------------------
    1138                 :            : 
    1139                 :          0 : void SAL_CALL Cell::addPropertyChangeListener( const OUString& /*aPropertyName*/, const Reference< XPropertyChangeListener >& /*xListener*/ ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
    1140                 :            : {
    1141                 :          0 : }
    1142                 :            : 
    1143                 :            : // -----------------------------------------------------------------------------
    1144                 :            : 
    1145                 :          0 : void SAL_CALL Cell::removePropertyChangeListener( const OUString& /*aPropertyName*/, const Reference< XPropertyChangeListener >& /*aListener*/ ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
    1146                 :            : {
    1147                 :          0 : }
    1148                 :            : 
    1149                 :            : // -----------------------------------------------------------------------------
    1150                 :            : 
    1151                 :          0 : void SAL_CALL Cell::addVetoableChangeListener( const OUString& /*PropertyName*/, const Reference< XVetoableChangeListener >& /*aListener*/ ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
    1152                 :            : {
    1153                 :          0 : }
    1154                 :            : 
    1155                 :            : // -----------------------------------------------------------------------------
    1156                 :            : 
    1157                 :          0 : void SAL_CALL Cell::removeVetoableChangeListener( const OUString& /*PropertyName*/, const Reference< XVetoableChangeListener >& /*aListener*/ ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
    1158                 :            : {
    1159                 :          0 : }
    1160                 :            : 
    1161                 :            : // -----------------------------------------------------------------------------
    1162                 :            : // XMultiPropertySet
    1163                 :            : // -----------------------------------------------------------------------------
    1164                 :            : 
    1165                 :         48 : void SAL_CALL Cell::setPropertyValues( const Sequence< OUString >& aPropertyNames, const Sequence< Any >& aValues ) throw (PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException)
    1166                 :            : {
    1167         [ +  - ]:         48 :     ::SolarMutexGuard aSolarGuard;
    1168                 :            : 
    1169 [ +  - ][ -  + ]:         48 :     if( (mpProperties == 0) || (GetModel() == 0) )
                 [ -  + ]
    1170         [ #  # ]:          0 :         throw DisposedException();
              [ #  #  # ]
    1171                 :            : 
    1172                 :         48 :     const sal_Int32 nCount = aPropertyNames.getLength();
    1173                 :            : 
    1174                 :         48 :     const OUString* pNames = aPropertyNames.getConstArray();
    1175                 :         48 :     const Any* pValues = aValues.getConstArray();
    1176                 :            : 
    1177         [ +  + ]:         96 :     for( sal_Int32 nIdx = 0; nIdx < nCount; nIdx++, pNames++, pValues++ )
    1178                 :            :     {
    1179                 :            :         try
    1180                 :            :         {
    1181         [ +  - ]:         48 :             setPropertyValue( *pNames, *pValues );
    1182                 :            :         }
    1183         [ #  # ]:          0 :         catch( UnknownPropertyException& )
    1184                 :            :         {
    1185                 :            :             OSL_FAIL("svx::Cell::setPropertyValues(), unknown property!" );
    1186                 :            :         }
    1187         [ #  # ]:          0 :         catch( Exception& )
    1188                 :            :         {
    1189                 :            :             OSL_FAIL("svx::Cell::setPropertyValues(), Exception caught!" );
    1190                 :            :         }
    1191         [ +  - ]:         48 :     }
    1192                 :         48 : }
    1193                 :            : 
    1194                 :            : // -----------------------------------------------------------------------------
    1195                 :            : 
    1196                 :          0 : Sequence< Any > SAL_CALL Cell::getPropertyValues( const Sequence< OUString >& aPropertyNames ) throw (RuntimeException)
    1197                 :            : {
    1198         [ #  # ]:          0 :     ::SolarMutexGuard aSolarGuard;
    1199                 :            : 
    1200 [ #  # ][ #  # ]:          0 :     if( (mpProperties == 0) || (GetModel() == 0) )
                 [ #  # ]
    1201         [ #  # ]:          0 :         throw DisposedException();
              [ #  #  # ]
    1202                 :            : 
    1203                 :          0 :     const sal_Int32 nCount = aPropertyNames.getLength();
    1204                 :          0 :     const OUString* pNames = aPropertyNames.getConstArray();
    1205                 :            : 
    1206         [ #  # ]:          0 :     Sequence< Any > aRet( nCount );
    1207         [ #  # ]:          0 :     Any* pValue = aRet.getArray();
    1208                 :            : 
    1209         [ #  # ]:          0 :     for( sal_Int32 nIdx = 0; nIdx < nCount; nIdx++, pValue++, pNames++ )
    1210                 :            :     {
    1211                 :            :         try
    1212                 :            :         {
    1213         [ #  # ]:          0 :             *pValue = getPropertyValue( *pNames );
    1214                 :            :         }
    1215         [ #  # ]:          0 :         catch( UnknownPropertyException& )
    1216                 :            :         {
    1217                 :            :             OSL_FAIL("svx::Cell::setPropertyValues(), unknown property!" );
    1218                 :            :         }
    1219         [ #  # ]:          0 :         catch( Exception& )
    1220                 :            :         {
    1221                 :            :             OSL_FAIL( "svx::Cell::getPropertyValues(), Exception caught!" );
    1222                 :            :         }
    1223                 :            :     }
    1224                 :            : 
    1225         [ #  # ]:          0 :     return aRet;
    1226                 :            : }
    1227                 :            : 
    1228                 :            : // -----------------------------------------------------------------------------
    1229                 :            : 
    1230                 :          0 : void SAL_CALL Cell::addPropertiesChangeListener( const Sequence< OUString >& /*aPropertyNames*/, const Reference< XPropertiesChangeListener >& /*xListener*/ ) throw (RuntimeException)
    1231                 :            : {
    1232                 :          0 : }
    1233                 :            : 
    1234                 :            : // -----------------------------------------------------------------------------
    1235                 :            : 
    1236                 :          0 : void SAL_CALL Cell::removePropertiesChangeListener( const Reference< XPropertiesChangeListener >& /*xListener*/ ) throw (RuntimeException)
    1237                 :            : {
    1238                 :          0 : }
    1239                 :            : 
    1240                 :            : // -----------------------------------------------------------------------------
    1241                 :            : 
    1242                 :          0 : void SAL_CALL Cell::firePropertiesChangeEvent( const Sequence< OUString >& /*aPropertyNames*/, const Reference< XPropertiesChangeListener >& /*xListener*/ ) throw (RuntimeException)
    1243                 :            : {
    1244                 :          0 : }
    1245                 :            : 
    1246                 :            : // -----------------------------------------------------------------------------
    1247                 :            : // XPropertyState
    1248                 :            : // -----------------------------------------------------------------------------
    1249                 :            : 
    1250                 :          0 : PropertyState SAL_CALL Cell::getPropertyState( const OUString& PropertyName ) throw(UnknownPropertyException, RuntimeException)
    1251                 :            : {
    1252         [ #  # ]:          0 :     ::SolarMutexGuard aGuard;
    1253                 :            : 
    1254 [ #  # ][ #  # ]:          0 :     if( (mpProperties == 0) || (GetModel() == 0) )
                 [ #  # ]
    1255         [ #  # ]:          0 :         throw DisposedException();
    1256                 :            : 
    1257         [ #  # ]:          0 :     const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMapEntry(PropertyName);
    1258                 :            : 
    1259         [ #  # ]:          0 :     if( pMap )
    1260                 :            :     {
    1261                 :            :         PropertyState eState;
    1262   [ #  #  #  # ]:          0 :         switch( pMap->nWID )
    1263                 :            :         {
    1264                 :            :         case OWN_ATTR_FILLBMP_MODE:
    1265                 :            :         {
    1266         [ #  # ]:          0 :             const SfxItemSet& rSet = mpProperties->GetMergedItemSet();
    1267                 :            : 
    1268         [ #  # ]:          0 :             const bool bStretch = rSet.GetItemState( XATTR_FILLBMP_STRETCH, false ) == SFX_ITEM_SET;
    1269         [ #  # ]:          0 :             const bool bTile = rSet.GetItemState( XATTR_FILLBMP_TILE, false ) == SFX_ITEM_SET;
    1270 [ #  # ][ #  # ]:          0 :             if( bStretch || bTile )
    1271                 :            :             {
    1272                 :          0 :                 eState = PropertyState_DIRECT_VALUE;
    1273                 :            :             }
    1274                 :            :             else
    1275                 :            :             {
    1276                 :          0 :                 eState = PropertyState_DEFAULT_VALUE;
    1277                 :            :             }
    1278                 :            :         }
    1279                 :            :         case OWN_ATTR_STYLE:
    1280                 :            :         {
    1281                 :          0 :             return PropertyState_DIRECT_VALUE;
    1282                 :            :         }
    1283                 :            :         case OWN_ATTR_TABLEBORDER:
    1284                 :            :         {
    1285         [ #  # ]:          0 :             const SfxItemSet& rSet = mpProperties->GetMergedItemSet();
    1286 [ #  # ][ #  # ]:          0 :             if( (rSet.GetItemState( SDRATTR_TABLE_BORDER_INNER, sal_False ) == SFX_ITEM_DEFAULT) && (rSet.GetItemState( SDRATTR_TABLE_BORDER, sal_False ) == SFX_ITEM_DEFAULT) )
         [ #  # ][ #  # ]
                 [ #  # ]
    1287                 :          0 :                 return PropertyState_DEFAULT_VALUE;
    1288                 :            : 
    1289                 :          0 :             return PropertyState_DIRECT_VALUE;
    1290                 :            :         }
    1291                 :            :         default:
    1292                 :            :         {
    1293         [ #  # ]:          0 :             const SfxItemSet& rSet = mpProperties->GetMergedItemSet();
    1294                 :            : 
    1295         [ #  # ]:          0 :             switch( rSet.GetItemState( pMap->nWID, sal_False ) )
              [ #  #  # ]
    1296                 :            :             {
    1297                 :            :             case SFX_ITEM_READONLY:
    1298                 :            :             case SFX_ITEM_SET:
    1299                 :          0 :                 eState = PropertyState_DIRECT_VALUE;
    1300                 :          0 :                 break;
    1301                 :            :             case SFX_ITEM_DEFAULT:
    1302                 :          0 :                 eState = PropertyState_DEFAULT_VALUE;
    1303                 :          0 :                 break;
    1304                 :            :             default:
    1305                 :          0 :                 eState = PropertyState_AMBIGUOUS_VALUE;
    1306                 :          0 :                 break;
    1307                 :            :             }
    1308                 :            : 
    1309                 :            :             // if a item is set, this doesn't mean we want it :)
    1310         [ #  # ]:          0 :             if( ( PropertyState_DIRECT_VALUE == eState ) )
    1311                 :            :             {
    1312      [ #  #  # ]:          0 :                 switch( pMap->nWID )
    1313                 :            :                 {
    1314                 :            :                 // the following items are disabled by changing the
    1315                 :            :                 // fill style or the line style. so there is no need
    1316                 :            :                 // to export items without names which should be empty
    1317                 :            :                 case XATTR_FILLBITMAP:
    1318                 :            :                 case XATTR_FILLGRADIENT:
    1319                 :            :                 case XATTR_FILLHATCH:
    1320                 :            :                 case XATTR_LINEDASH:
    1321                 :            :                     {
    1322         [ #  # ]:          0 :                         NameOrIndex* pItem = (NameOrIndex*)rSet.GetItem((sal_uInt16)pMap->nWID);
    1323 [ #  # ][ #  # ]:          0 :                         if( ( pItem == NULL ) || ( pItem->GetName().Len() == 0) )
         [ #  # ][ #  # ]
                 [ #  # ]
           [ #  #  #  # ]
    1324                 :          0 :                             eState = PropertyState_DEFAULT_VALUE;
    1325                 :            :                     }
    1326                 :          0 :                     break;
    1327                 :            : 
    1328                 :            :                 // #i36115#
    1329                 :            :                 // If e.g. the LineStart is on NONE and thus the string has length 0, it still
    1330                 :            :                 // may be a hard attribute covering the set LineStart of the parent (Style).
    1331                 :            :                 // #i37644#
    1332                 :            :                 // same is for fill float transparency
    1333                 :            :                 case XATTR_LINEEND:
    1334                 :            :                 case XATTR_LINESTART:
    1335                 :            :                 case XATTR_FILLFLOATTRANSPARENCE:
    1336                 :            :                     {
    1337         [ #  # ]:          0 :                         NameOrIndex* pItem = (NameOrIndex*)rSet.GetItem((sal_uInt16)pMap->nWID);
    1338         [ #  # ]:          0 :                         if( pItem == NULL )
    1339                 :          0 :                             eState = PropertyState_DEFAULT_VALUE;
    1340                 :            :                     }
    1341                 :          0 :                     break;
    1342                 :            :                 }
    1343                 :            :             }
    1344                 :            :         }
    1345                 :            :         }
    1346                 :          0 :         return eState;
    1347                 :            :     }
    1348 [ #  # ][ #  # ]:          0 :     throw UnknownPropertyException();
    1349                 :            : }
    1350                 :            : 
    1351                 :            : // -----------------------------------------------------------------------------
    1352                 :            : 
    1353                 :          0 : Sequence< PropertyState > SAL_CALL Cell::getPropertyStates( const Sequence< OUString >& aPropertyName ) throw(UnknownPropertyException, RuntimeException)
    1354                 :            : {
    1355         [ #  # ]:          0 :     ::SolarMutexGuard aGuard;
    1356                 :            : 
    1357 [ #  # ][ #  # ]:          0 :     if( (mpProperties == 0) || (GetModel() == 0) )
                 [ #  # ]
    1358 [ #  # ][ #  # ]:          0 :         throw DisposedException();
    1359                 :            : 
    1360                 :          0 :     const sal_Int32 nCount = aPropertyName.getLength();
    1361                 :            : 
    1362         [ #  # ]:          0 :     Sequence< PropertyState > aRet( nCount );
    1363                 :            : 
    1364                 :          0 :     const OUString* pNames = aPropertyName.getConstArray();
    1365         [ #  # ]:          0 :     PropertyState* pState = aRet.getArray();
    1366                 :            : 
    1367         [ #  # ]:          0 :     for( sal_Int32 nIdx = 0; nIdx < nCount; nIdx++, pNames++, pState++ )
    1368                 :            :     {
    1369                 :            :         try
    1370                 :            :         {
    1371         [ #  # ]:          0 :             *pState = getPropertyState( *pNames );
    1372                 :            :         }
    1373         [ #  # ]:          0 :         catch( Exception& )
    1374                 :            :         {
    1375                 :          0 :             *pState = PropertyState_AMBIGUOUS_VALUE;
    1376                 :            :         }
    1377                 :            :     }
    1378                 :            : 
    1379         [ #  # ]:          0 :     return aRet;
    1380                 :            : }
    1381                 :            : 
    1382                 :            : // -----------------------------------------------------------------------------
    1383                 :            : 
    1384                 :          0 : void SAL_CALL Cell::setPropertyToDefault( const OUString& PropertyName ) throw(UnknownPropertyException, RuntimeException)
    1385                 :            : {
    1386         [ #  # ]:          0 :     ::SolarMutexGuard aGuard;
    1387                 :            : 
    1388 [ #  # ][ #  # ]:          0 :     if( (mpProperties == 0) || (GetModel() == 0) )
                 [ #  # ]
    1389         [ #  # ]:          0 :         throw DisposedException();
    1390                 :            : 
    1391         [ #  # ]:          0 :     const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMapEntry(PropertyName);
    1392         [ #  # ]:          0 :     if( pMap )
    1393                 :            :     {
    1394   [ #  #  #  # ]:          0 :         switch( pMap->nWID )
    1395                 :            :         {
    1396                 :            :         case OWN_ATTR_FILLBMP_MODE:
    1397                 :            :         {
    1398         [ #  # ]:          0 :             mpProperties->ClearObjectItem( XATTR_FILLBMP_STRETCH );
    1399         [ #  # ]:          0 :             mpProperties->ClearObjectItem( XATTR_FILLBMP_TILE );
    1400                 :          0 :             break;
    1401                 :            :         }
    1402                 :            :         case OWN_ATTR_STYLE:
    1403                 :          0 :             break;
    1404                 :            : 
    1405                 :            :         case OWN_ATTR_TABLEBORDER:
    1406                 :            :         {
    1407         [ #  # ]:          0 :             mpProperties->ClearObjectItem( SDRATTR_TABLE_BORDER_INNER );
    1408         [ #  # ]:          0 :             mpProperties->ClearObjectItem( SDRATTR_TABLE_BORDER );
    1409                 :          0 :             break;
    1410                 :            :         }
    1411                 :            : 
    1412                 :            :         default:
    1413                 :            :         {
    1414         [ #  # ]:          0 :             mpProperties->ClearObjectItem( pMap->nWID );
    1415                 :            :         }
    1416                 :            :         }
    1417                 :            : 
    1418         [ #  # ]:          0 :         GetModel()->SetChanged();
    1419                 :          0 :         return;
    1420                 :            :     }
    1421 [ #  # ][ #  # ]:          0 :     throw UnknownPropertyException();
    1422                 :            : }
    1423                 :            : 
    1424                 :            : // -----------------------------------------------------------------------------
    1425                 :            : 
    1426                 :          0 : Any SAL_CALL Cell::getPropertyDefault( const OUString& aPropertyName ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
    1427                 :            : {
    1428         [ #  # ]:          0 :     ::SolarMutexGuard aGuard;
    1429                 :            : 
    1430 [ #  # ][ #  # ]:          0 :     if( (mpProperties == 0) || (GetModel() == 0) )
                 [ #  # ]
    1431         [ #  # ]:          0 :         throw DisposedException();
    1432                 :            : 
    1433         [ #  # ]:          0 :     const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMapEntry(aPropertyName);
    1434         [ #  # ]:          0 :     if( pMap )
    1435                 :            :     {
    1436   [ #  #  #  # ]:          0 :         switch( pMap->nWID )
    1437                 :            :         {
    1438                 :            :         case OWN_ATTR_FILLBMP_MODE:
    1439         [ #  # ]:          0 :             return Any(  BitmapMode_NO_REPEAT );
    1440                 :            : 
    1441                 :            :         case OWN_ATTR_STYLE:
    1442                 :            :         {
    1443                 :          0 :             Reference< XStyle > xStyle;
    1444         [ #  # ]:          0 :             return Any( xStyle );
    1445                 :            :         }
    1446                 :            : 
    1447                 :            :         case OWN_ATTR_TABLEBORDER:
    1448                 :            :         {
    1449                 :          0 :             TableBorder aBorder;
    1450         [ #  # ]:          0 :             return Any( aBorder );
    1451                 :            :         }
    1452                 :            : 
    1453                 :            :         default:
    1454                 :            :         {
    1455         [ #  # ]:          0 :             if(  GetModel()->GetItemPool().IsWhich(pMap->nWID) )
    1456                 :            :             {
    1457         [ #  # ]:          0 :                 SfxItemSet aSet( GetModel()->GetItemPool(), pMap->nWID, pMap->nWID);
    1458 [ #  # ][ #  # ]:          0 :                 aSet.Put(GetModel()->GetItemPool().GetDefaultItem(pMap->nWID));
    1459 [ #  # ][ #  # ]:          0 :                 return GetAnyForItem( aSet, pMap );
    1460                 :            :             }
    1461                 :            :         }
    1462                 :            :         }
    1463                 :            :     }
    1464 [ #  # ][ #  # ]:          0 :     throw UnknownPropertyException();
    1465                 :            : }
    1466                 :            : 
    1467                 :            : // -----------------------------------------------------------------------------
    1468                 :            : // XMultiPropertyStates
    1469                 :            : // -----------------------------------------------------------------------------
    1470                 :            : 
    1471                 :          0 : void SAL_CALL Cell::setAllPropertiesToDefault(  ) throw (RuntimeException)
    1472                 :            : {
    1473         [ #  # ]:          0 :     if( mpProperties )
    1474         [ #  # ]:          0 :         delete mpProperties;
    1475         [ #  # ]:          0 :     mpProperties = new sdr::properties::CellProperties( static_cast< SdrTableObj& >( GetObject() ), this );
    1476                 :            : 
    1477                 :          0 :     SdrOutliner& rOutliner = GetObject().ImpGetDrawOutliner();
    1478                 :            : 
    1479                 :          0 :     OutlinerParaObject* pParaObj = GetOutlinerParaObject();
    1480         [ #  # ]:          0 :     if( pParaObj )
    1481                 :            :     {
    1482                 :          0 :         rOutliner.SetText(*pParaObj);
    1483                 :          0 :         sal_uInt32 nParaCount(rOutliner.GetParagraphCount());
    1484                 :            : 
    1485         [ #  # ]:          0 :         if(nParaCount)
    1486                 :            :         {
    1487                 :          0 :             ESelection aSelection( 0, 0, EE_PARA_ALL, EE_PARA_ALL);
    1488         [ #  # ]:          0 :             rOutliner.RemoveAttribs(aSelection, sal_True, 0);
    1489                 :            : 
    1490         [ #  # ]:          0 :             OutlinerParaObject* pTemp = rOutliner.CreateParaObject(0, (sal_uInt16)nParaCount);
    1491         [ #  # ]:          0 :             rOutliner.Clear();
    1492                 :            : 
    1493         [ #  # ]:          0 :             SetOutlinerParaObject(pTemp);
    1494                 :            :         }
    1495                 :            :     }
    1496                 :          0 : }
    1497                 :            : 
    1498                 :            : // -----------------------------------------------------------------------------
    1499                 :            : 
    1500                 :          0 : void SAL_CALL Cell::setPropertiesToDefault( const Sequence< OUString >& aPropertyNames ) throw (UnknownPropertyException, RuntimeException)
    1501                 :            : {
    1502                 :          0 :     sal_Int32 nCount = aPropertyNames.getLength();
    1503                 :          0 :     const OUString* pName = aPropertyNames.getConstArray();
    1504                 :            : 
    1505         [ #  # ]:          0 :     while(nCount--)
    1506                 :          0 :         setPropertyToDefault( *pName++ );
    1507                 :          0 : }
    1508                 :            : 
    1509                 :            : // -----------------------------------------------------------------------------
    1510                 :            : 
    1511                 :          0 : Sequence< Any > SAL_CALL Cell::getPropertyDefaults( const Sequence< OUString >& aPropertyNames ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException)
    1512                 :            : {
    1513                 :          0 :     sal_Int32 nCount = aPropertyNames.getLength();
    1514                 :          0 :     Sequence< Any > aDefaults( nCount );
    1515         [ #  # ]:          0 :     Any* pDefaults = aDefaults.getArray();
    1516                 :          0 :     const OUString* pName = aPropertyNames.getConstArray();
    1517                 :            : 
    1518         [ #  # ]:          0 :     while(nCount--)
    1519         [ #  # ]:          0 :         *pDefaults++ = getPropertyDefault( *pName++ );
    1520                 :            : 
    1521                 :          0 :     return aDefaults;
    1522                 :            : }
    1523                 :            : 
    1524                 :            : // -----------------------------------------------------------------------------
    1525                 :            : // XFastPropertySet
    1526                 :            : // -----------------------------------------------------------------------------
    1527                 :            : 
    1528                 :          0 : void SAL_CALL Cell::setFastPropertyValue( sal_Int32 nHandle, const Any& aValue ) throw (UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException)
    1529                 :            : {
    1530                 :            :     (void)aValue;
    1531                 :            :     (void)nHandle;
    1532         [ #  # ]:          0 :     throw UnknownPropertyException();
    1533                 :            : }
    1534                 :            : 
    1535                 :            : // -----------------------------------------------------------------------------
    1536                 :            : // TODO: Refactor this method!
    1537                 :          0 : Any SAL_CALL Cell::getFastPropertyValue( sal_Int32 nHandle ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException)
    1538                 :            : {
    1539                 :            :     (void)nHandle;
    1540         [ #  # ]:          0 :     throw UnknownPropertyException();
    1541                 :            : }
    1542                 :            : 
    1543                 :            : // -----------------------------------------------------------------------------
    1544                 :            : // XText
    1545                 :            : // -----------------------------------------------------------------------------
    1546                 :            : 
    1547                 :          0 : void SAL_CALL Cell::insertTextContent( const Reference< XTextRange >& xRange, const Reference< XTextContent >& xContent, sal_Bool bAbsorb ) throw (IllegalArgumentException, RuntimeException)
    1548                 :            : {
    1549                 :          0 :     SvxUnoTextBase::insertTextContent( xRange, xContent, bAbsorb );
    1550                 :          0 :     notifyModified();
    1551                 :          0 : }
    1552                 :            : 
    1553                 :            : // -----------------------------------------------------------------------------
    1554                 :            : 
    1555                 :          0 : void SAL_CALL Cell::removeTextContent( const Reference< XTextContent >& xContent ) throw (NoSuchElementException, RuntimeException)
    1556                 :            : {
    1557                 :          0 :     SvxUnoTextBase::removeTextContent( xContent );
    1558                 :          0 :     notifyModified();
    1559                 :          0 : }
    1560                 :            : 
    1561                 :            : // -----------------------------------------------------------------------------
    1562                 :            : // XSimpleText
    1563                 :            : // -----------------------------------------------------------------------------
    1564                 :            : 
    1565                 :          0 : Reference< XTextCursor > SAL_CALL Cell::createTextCursor(  ) throw (RuntimeException)
    1566                 :            : {
    1567                 :          0 :     return SvxUnoTextBase::createTextCursor();
    1568                 :            : }
    1569                 :            : 
    1570                 :            : // -----------------------------------------------------------------------------
    1571                 :            : 
    1572                 :          0 : Reference< XTextCursor > SAL_CALL Cell::createTextCursorByRange( const Reference< XTextRange >& aTextPosition ) throw (RuntimeException)
    1573                 :            : {
    1574                 :          0 :     return SvxUnoTextBase::createTextCursorByRange( aTextPosition );
    1575                 :            : }
    1576                 :            : 
    1577                 :            : // -----------------------------------------------------------------------------
    1578                 :            : 
    1579                 :          0 : void SAL_CALL Cell::insertString( const Reference< XTextRange >& xRange, const OUString& aString, sal_Bool bAbsorb ) throw (RuntimeException)
    1580                 :            : {
    1581                 :          0 :     SvxUnoTextBase::insertString( xRange, aString, bAbsorb );
    1582                 :          0 :     notifyModified();
    1583                 :          0 : }
    1584                 :            : 
    1585                 :            : // -----------------------------------------------------------------------------
    1586                 :            : 
    1587                 :          0 : void SAL_CALL Cell::insertControlCharacter( const Reference< XTextRange >& xRange, sal_Int16 nControlCharacter, sal_Bool bAbsorb ) throw (IllegalArgumentException, RuntimeException)
    1588                 :            : {
    1589                 :          0 :     SvxUnoTextBase::insertControlCharacter( xRange, nControlCharacter, bAbsorb );
    1590                 :          0 :     notifyModified();
    1591                 :          0 : }
    1592                 :            : 
    1593                 :            : // -----------------------------------------------------------------------------
    1594                 :            : // XTextRange
    1595                 :            : // -----------------------------------------------------------------------------
    1596                 :            : 
    1597                 :          0 : Reference< XText > SAL_CALL Cell::getText(  ) throw (RuntimeException)
    1598                 :            : {
    1599                 :          0 :     return SvxUnoTextBase::getText();
    1600                 :            : }
    1601                 :            : 
    1602                 :            : // -----------------------------------------------------------------------------
    1603                 :            : 
    1604                 :          0 : Reference< XTextRange > SAL_CALL Cell::getStart(  ) throw (RuntimeException)
    1605                 :            : {
    1606                 :          0 :     return SvxUnoTextBase::getStart();
    1607                 :            : }
    1608                 :            : 
    1609                 :            : // -----------------------------------------------------------------------------
    1610                 :            : 
    1611                 :          0 : Reference< XTextRange > SAL_CALL Cell::getEnd(  ) throw (RuntimeException)
    1612                 :            : {
    1613                 :          0 :     return SvxUnoTextBase::getEnd();
    1614                 :            : }
    1615                 :            : 
    1616                 :            : // -----------------------------------------------------------------------------
    1617                 :            : 
    1618                 :          0 : OUString SAL_CALL Cell::getString(  ) throw (RuntimeException)
    1619                 :            : {
    1620                 :          0 :     maSelection.nStartPara = 0xffff;
    1621                 :          0 :     return SvxUnoTextBase::getString();
    1622                 :            : }
    1623                 :            : 
    1624                 :            : // -----------------------------------------------------------------------------
    1625                 :            : 
    1626                 :          0 : void SAL_CALL Cell::setString( const OUString& aString ) throw (RuntimeException)
    1627                 :            : {
    1628                 :          0 :     SvxUnoTextBase::setString( aString );
    1629                 :          0 :     notifyModified();
    1630                 :          0 : }
    1631                 :            : 
    1632                 :            : // XEventListener
    1633                 :         48 : void SAL_CALL Cell::disposing( const EventObject& /*Source*/ ) throw (RuntimeException)
    1634                 :            : {
    1635                 :         48 :     mxTable.clear();
    1636                 :         48 :     dispose();
    1637                 :         48 : }
    1638                 :            : 
    1639                 :          0 : static OUString getCellName( sal_Int32 nCol, sal_Int32 nRow )
    1640                 :            : {
    1641                 :          0 :     rtl::OUStringBuffer aBuf;
    1642                 :            : 
    1643         [ #  # ]:          0 :     if (nCol < 26*26)
    1644                 :            :     {
    1645         [ #  # ]:          0 :         if (nCol < 26)
    1646                 :            :             aBuf.append( static_cast<sal_Unicode>( 'A' +
    1647         [ #  # ]:          0 :                         static_cast<sal_uInt16>(nCol)));
    1648                 :            :         else
    1649                 :            :         {
    1650                 :            :             aBuf.append( static_cast<sal_Unicode>( 'A' +
    1651         [ #  # ]:          0 :                         (static_cast<sal_uInt16>(nCol) / 26) - 1));
    1652                 :            :             aBuf.append( static_cast<sal_Unicode>( 'A' +
    1653         [ #  # ]:          0 :                         (static_cast<sal_uInt16>(nCol) % 26)));
    1654                 :            :         }
    1655                 :            :     }
    1656                 :            :     else
    1657                 :            :     {
    1658         [ #  # ]:          0 :         String aStr;
    1659         [ #  # ]:          0 :         while (nCol >= 26)
    1660                 :            :         {
    1661                 :          0 :             sal_Int32 nC = nCol % 26;
    1662                 :            :             aStr += static_cast<sal_Unicode>( 'A' +
    1663         [ #  # ]:          0 :                     static_cast<sal_uInt16>(nC));
    1664                 :          0 :             nCol = nCol - nC;
    1665                 :          0 :             nCol = nCol / 26 - 1;
    1666                 :            :         }
    1667                 :            :         aStr += static_cast<sal_Unicode>( 'A' +
    1668         [ #  # ]:          0 :                 static_cast<sal_uInt16>(nCol));
    1669 [ #  # ][ #  # ]:          0 :         aBuf.append(comphelper::string::reverseString(aStr));
         [ #  # ][ #  # ]
    1670                 :            :     }
    1671         [ #  # ]:          0 :     aBuf.append( OUString::valueOf(nRow+1) );
    1672         [ #  # ]:          0 :     return aBuf.makeStringAndClear();
    1673                 :            : }
    1674                 :            : 
    1675                 :          0 : OUString Cell::getName()
    1676                 :            : {
    1677                 :            :     // todo: optimize!
    1678                 :          0 :     OUString sName;
    1679         [ #  # ]:          0 :     if( mxTable.is() ) try
    1680                 :            :     {
    1681         [ #  # ]:          0 :         Reference< XCell > xThis( static_cast< XCell* >( this ) );
    1682                 :            : 
    1683 [ #  # ][ #  # ]:          0 :         sal_Int32 nRowCount = mxTable->getRowCount();
    1684 [ #  # ][ #  # ]:          0 :         sal_Int32 nColCount = mxTable->getColumnCount();
    1685         [ #  # ]:          0 :         for( sal_Int32 nRow = 0; nRow < nRowCount; nRow++ )
    1686                 :            :         {
    1687         [ #  # ]:          0 :             for( sal_Int32 nCol = 0; nCol < nColCount; nCol++ )
    1688                 :            :             {
    1689 [ #  # ][ #  # ]:          0 :                 Reference< XCell > xCell( mxTable->getCellByPosition( nCol, nRow ) );
    1690 [ #  # ][ #  # ]:          0 :                 if( xCell == xThis )
    1691                 :            :                 {
    1692         [ #  # ]:          0 :                     return getCellName( nCol, nRow );
    1693                 :            :                 }
    1694         [ #  # ]:          0 :             }
    1695 [ #  # ][ #  # ]:          0 :         }
    1696                 :            :     }
    1697         [ #  # ]:          0 :     catch( Exception& )
    1698                 :            :     {
    1699                 :            :     }
    1700                 :            : 
    1701                 :          0 :     return sName;
    1702                 :            : }
    1703                 :            : 
    1704                 :            : } }
    1705                 :            : 
    1706                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10