LCOV - code coverage report
Current view: top level - sc/source/ui/unoobj - cellsuno.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 4051 5374 75.4 %
Date: 2012-08-25 Functions: 357 466 76.6 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 4005 9500 42.2 %

           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 "scitems.hxx"
      31                 :            : #include <editeng/eeitem.hxx>
      32                 :            : #include <svx/svdpool.hxx>
      33                 :            : 
      34                 :            : #include <svx/algitem.hxx>
      35                 :            : #include <editeng/boxitem.hxx>
      36                 :            : #include <editeng/brshitem.hxx>
      37                 :            : #include <editeng/editeng.hxx>
      38                 :            : #include <editeng/flditem.hxx>
      39                 :            : #include <editeng/justifyitem.hxx>
      40                 :            : #include <svx/fmdpage.hxx>
      41                 :            : #include <editeng/langitem.hxx>
      42                 :            : #include <sfx2/linkmgr.hxx>
      43                 :            : #include <svl/srchitem.hxx>
      44                 :            : #include <svx/unomid.hxx>
      45                 :            : #include <editeng/unoprnms.hxx>
      46                 :            : #include <editeng/unotext.hxx>
      47                 :            : #include <svx/svdpage.hxx>
      48                 :            : #include <sfx2/bindings.hxx>
      49                 :            : #include <svl/zforlist.hxx>
      50                 :            : #include <svl/zformat.hxx>
      51                 :            : #include <comphelper/servicehelper.hxx>
      52                 :            : #include <float.h>              // DBL_MIN
      53                 :            : 
      54                 :            : #include <com/sun/star/awt/XBitmap.hpp>
      55                 :            : #include <com/sun/star/util/CellProtection.hpp>
      56                 :            : #include <com/sun/star/table/CellHoriJustify.hpp>
      57                 :            : #include <com/sun/star/table/CellOrientation.hpp>
      58                 :            : #include <com/sun/star/table/CellVertJustify2.hpp>
      59                 :            : #include <com/sun/star/table/ShadowFormat.hpp>
      60                 :            : #include <com/sun/star/table/TableBorder.hpp>
      61                 :            : #include <com/sun/star/table/BorderLineStyle.hpp>
      62                 :            : #include <com/sun/star/sheet/CellFlags.hpp>
      63                 :            : #include <com/sun/star/sheet/FormulaResult.hpp>
      64                 :            : #include <com/sun/star/beans/PropertyAttribute.hpp>
      65                 :            : #include <com/sun/star/lang/Locale.hpp>
      66                 :            : #include <com/sun/star/beans/TolerantPropertySetResultType.hpp>
      67                 :            : #include <com/sun/star/beans/SetPropertyTolerantFailed.hpp>
      68                 :            : #include <com/sun/star/text/WritingMode2.hpp>
      69                 :            : #include <com/sun/star/text/textfield/Type.hpp>
      70                 :            : 
      71                 :            : #include "autoform.hxx"
      72                 :            : #include "cellmergeoption.hxx"
      73                 :            : #include "cellsuno.hxx"
      74                 :            : #include "cursuno.hxx"
      75                 :            : #include "textuno.hxx"
      76                 :            : #include "editsrc.hxx"
      77                 :            : #include "notesuno.hxx"
      78                 :            : #include "fielduno.hxx"
      79                 :            : #include "docuno.hxx"       // ScTableColumnsObj etc
      80                 :            : #include "datauno.hxx"
      81                 :            : #include "dapiuno.hxx"
      82                 :            : #include "chartuno.hxx"
      83                 :            : #include "fmtuno.hxx"
      84                 :            : #include "miscuno.hxx"
      85                 :            : #include "convuno.hxx"
      86                 :            : #include "srchuno.hxx"
      87                 :            : #include "nameuno.hxx"
      88                 :            : #include "targuno.hxx"
      89                 :            : #include "tokenuno.hxx"
      90                 :            : #include "eventuno.hxx"
      91                 :            : #include "docsh.hxx"
      92                 :            : #include "markdata.hxx"
      93                 :            : #include "patattr.hxx"
      94                 :            : #include "docpool.hxx"
      95                 :            : #include "docfunc.hxx"
      96                 :            : #include "dbdocfun.hxx"
      97                 :            : #include "olinefun.hxx"
      98                 :            : #include "hints.hxx"
      99                 :            : #include "cell.hxx"
     100                 :            : #include "column.hxx"
     101                 :            : #include "undocell.hxx"
     102                 :            : #include "undotab.hxx"
     103                 :            : #include "undoblk.hxx"      // fuer lcl_ApplyBorder - nach docfunc verschieben!
     104                 :            : #include "stlsheet.hxx"
     105                 :            : #include "dbdata.hxx"
     106                 :            : #include "attrib.hxx"
     107                 :            : #include "chartarr.hxx"
     108                 :            : #include "chartlis.hxx"
     109                 :            : #include "drwlayer.hxx"
     110                 :            : #include "printfun.hxx"
     111                 :            : #include "prnsave.hxx"
     112                 :            : #include "tablink.hxx"
     113                 :            : #include "dociter.hxx"
     114                 :            : #include "rangeutl.hxx"
     115                 :            : #include "conditio.hxx"
     116                 :            : #include "validat.hxx"
     117                 :            : #include "sc.hrc"
     118                 :            : #include "brdcst.hxx"
     119                 :            : #include "cellform.hxx"
     120                 :            : #include "globstr.hrc"
     121                 :            : #include "unonames.hxx"
     122                 :            : #include "styleuno.hxx"
     123                 :            : #include "rangeseq.hxx"
     124                 :            : #include "unowids.hxx"
     125                 :            : #include "paramisc.hxx"
     126                 :            : #include "queryentry.hxx"
     127                 :            : #include "formula/errorcodes.hxx"
     128                 :            : #include "unoreflist.hxx"
     129                 :            : #include "formula/grammar.hxx"
     130                 :            : #include "editeng/escpitem.hxx"
     131                 :            : 
     132                 :            : #include <list>
     133                 :            : 
     134                 :            : using namespace com::sun::star;
     135                 :            : 
     136                 :            : //------------------------------------------------------------------------
     137                 :            : 
     138                 :         35 : class ScNamedEntry
     139                 :            : {
     140                 :            :     String  aName;
     141                 :            :     ScRange aRange;
     142                 :            : 
     143                 :            : public:
     144                 :         35 :             ScNamedEntry(const String& rN, const ScRange& rR) :
     145                 :         35 :                 aName(rN), aRange(rR) {}
     146                 :            : 
     147                 :        144 :     const String&   GetName() const     { return aName; }
     148                 :         79 :     const ScRange&  GetRange() const    { return aRange; }
     149                 :            : };
     150                 :            : 
     151                 :            : //------------------------------------------------------------------------
     152                 :            : 
     153                 :            : //  The names in the maps must be sorted according to strcmp!
     154                 :            : //! Instead of Which-ID 0 use special IDs and do not compare via names!
     155                 :            : 
     156                 :            : //  Left/Right/Top/BottomBorder are mapped directly to the core items,
     157                 :            : //  not collected/applied to the borders of a range -> ATTR_BORDER can be used directly
     158                 :            : 
     159                 :      13653 : const SfxItemPropertySet* lcl_GetCellsPropertySet()
     160                 :            : {
     161                 :            :     static SfxItemPropertyMapEntry aCellsPropertyMap_Impl[] =
     162                 :            :     {
     163         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_ABSNAME),  SC_WID_UNO_ABSNAME, &getCppuType((rtl::OUString*)0),        0 | beans::PropertyAttribute::READONLY, 0 },
     164         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_ASIANVERT),ATTR_VERTICAL_ASIAN,&getBooleanCppuType(),                  0, 0 },
     165         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_BOTTBORDER),ATTR_BORDER,       &::getCppuType((const table::BorderLine*)0), 0, BOTTOM_BORDER | CONVERT_TWIPS },
     166         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_BOTTBORDER2),ATTR_BORDER,      &::getCppuType((const table::BorderLine2*)0), 0, BOTTOM_BORDER | CONVERT_TWIPS },
     167         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CELLBACK), ATTR_BACKGROUND,    &getCppuType((sal_Int32*)0),            0, MID_BACK_COLOR },
     168         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CELLPRO),  ATTR_PROTECTION,    &getCppuType((util::CellProtection*)0), 0, 0 },
     169         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CELLSTYL), SC_WID_UNO_CELLSTYL,&getCppuType((rtl::OUString*)0),        0, 0 },
     170         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CCOLOR),   ATTR_FONT_COLOR,    &getCppuType((sal_Int32*)0),            0, 0 },
     171         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_COUTL),    ATTR_FONT_CONTOUR,  &getBooleanCppuType(),                  0, 0 },
     172         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CCROSS),   ATTR_FONT_CROSSEDOUT,&getBooleanCppuType(),                 0, MID_CROSSED_OUT },
     173         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CEMPHAS),  ATTR_FONT_EMPHASISMARK,&getCppuType((sal_Int16*)0),         0, MID_EMPHASIS },
     174         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CFONT),    ATTR_FONT,          &getCppuType((sal_Int16*)0),            0, MID_FONT_FAMILY },
     175         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CFCHARS),  ATTR_FONT,          &getCppuType((sal_Int16*)0),            0, MID_FONT_CHAR_SET },
     176         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_CJK_CFCHARS),  ATTR_CJK_FONT,      &getCppuType((sal_Int16*)0),            0, MID_FONT_CHAR_SET },
     177         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_CTL_CFCHARS),  ATTR_CTL_FONT,      &getCppuType((sal_Int16*)0),            0, MID_FONT_CHAR_SET },
     178         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CFFAMIL),  ATTR_FONT,          &getCppuType((sal_Int16*)0),            0, MID_FONT_FAMILY },
     179         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_CJK_CFFAMIL),  ATTR_CJK_FONT,      &getCppuType((sal_Int16*)0),            0, MID_FONT_FAMILY },
     180         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_CTL_CFFAMIL),  ATTR_CTL_FONT,      &getCppuType((sal_Int16*)0),            0, MID_FONT_FAMILY },
     181         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CFNAME),   ATTR_FONT,          &getCppuType((rtl::OUString*)0),        0, MID_FONT_FAMILY_NAME },
     182         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_CJK_CFNAME),   ATTR_CJK_FONT,      &getCppuType((rtl::OUString*)0),        0, MID_FONT_FAMILY_NAME },
     183         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_CTL_CFNAME),   ATTR_CTL_FONT,      &getCppuType((rtl::OUString*)0),        0, MID_FONT_FAMILY_NAME },
     184         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CFPITCH),  ATTR_FONT,          &getCppuType((sal_Int16*)0),            0, MID_FONT_PITCH },
     185         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_CJK_CFPITCH),  ATTR_CJK_FONT,      &getCppuType((sal_Int16*)0),            0, MID_FONT_PITCH },
     186         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_CTL_CFPITCH),  ATTR_CTL_FONT,      &getCppuType((sal_Int16*)0),            0, MID_FONT_PITCH },
     187         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CFSTYLE),  ATTR_FONT,          &getCppuType((rtl::OUString*)0),        0, MID_FONT_STYLE_NAME },
     188         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_CJK_CFSTYLE),  ATTR_CJK_FONT,      &getCppuType((rtl::OUString*)0),        0, MID_FONT_STYLE_NAME },
     189         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_CTL_CFSTYLE),  ATTR_CTL_FONT,      &getCppuType((rtl::OUString*)0),        0, MID_FONT_STYLE_NAME },
     190         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CHEIGHT),  ATTR_FONT_HEIGHT,   &getCppuType((float*)0),                0, MID_FONTHEIGHT | CONVERT_TWIPS },
     191         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_CJK_CHEIGHT),  ATTR_CJK_FONT_HEIGHT,&getCppuType((float*)0),               0, MID_FONTHEIGHT | CONVERT_TWIPS },
     192         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_CTL_CHEIGHT),  ATTR_CTL_FONT_HEIGHT,&getCppuType((float*)0),               0, MID_FONTHEIGHT | CONVERT_TWIPS },
     193         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CLOCAL),   ATTR_FONT_LANGUAGE, &getCppuType((lang::Locale*)0),         0, MID_LANG_LOCALE },
     194         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_CJK_CLOCAL),   ATTR_CJK_FONT_LANGUAGE,&getCppuType((lang::Locale*)0),          0, MID_LANG_LOCALE },
     195         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_CTL_CLOCAL),   ATTR_CTL_FONT_LANGUAGE,&getCppuType((lang::Locale*)0),          0, MID_LANG_LOCALE },
     196         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_COVER),    ATTR_FONT_OVERLINE, &getCppuType((sal_Int16*)0),            0, MID_TL_STYLE },
     197         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_COVRLCOL), ATTR_FONT_OVERLINE, &getCppuType((sal_Int32*)0),            0, MID_TL_COLOR },
     198         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_COVRLHAS), ATTR_FONT_OVERLINE, &getBooleanCppuType(),                  0, MID_TL_HASCOLOR },
     199         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CPOST),    ATTR_FONT_POSTURE,  &getCppuType((awt::FontSlant*)0),       0, MID_POSTURE },
     200         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_CJK_CPOST),    ATTR_CJK_FONT_POSTURE,&getCppuType((awt::FontSlant*)0),     0, MID_POSTURE },
     201         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_CTL_CPOST),    ATTR_CTL_FONT_POSTURE,&getCppuType((awt::FontSlant*)0),     0, MID_POSTURE },
     202         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CRELIEF),  ATTR_FONT_RELIEF,   &getCppuType((sal_Int16*)0),            0, MID_RELIEF },
     203         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CSHADD),   ATTR_FONT_SHADOWED, &getBooleanCppuType(),                  0, 0 },
     204         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CSTRIKE),  ATTR_FONT_CROSSEDOUT,&getCppuType((sal_Int16*)0),           0, MID_CROSS_OUT },
     205         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CUNDER),   ATTR_FONT_UNDERLINE,&getCppuType((sal_Int16*)0),            0, MID_TL_STYLE },
     206         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CUNDLCOL), ATTR_FONT_UNDERLINE,&getCppuType((sal_Int32*)0),            0, MID_TL_COLOR },
     207         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CUNDLHAS), ATTR_FONT_UNDERLINE,&getBooleanCppuType(),                  0, MID_TL_HASCOLOR },
     208         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CWEIGHT),  ATTR_FONT_WEIGHT,   &getCppuType((float*)0),                0, MID_WEIGHT },
     209         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_CJK_CWEIGHT),  ATTR_CJK_FONT_WEIGHT,&getCppuType((float*)0),               0, MID_WEIGHT },
     210         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_CTL_CWEIGHT),  ATTR_CTL_FONT_WEIGHT,&getCppuType((float*)0),               0, MID_WEIGHT },
     211         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CWORDMOD), ATTR_FONT_WORDLINE, &getBooleanCppuType(),                  0, 0 },
     212         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CHCOLHDR), SC_WID_UNO_CHCOLHDR,&getBooleanCppuType(),                  0, 0 },
     213         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CHROWHDR), SC_WID_UNO_CHROWHDR,&getBooleanCppuType(),                  0, 0 },
     214         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CONDFMT),  SC_WID_UNO_CONDFMT, &getCppuType((uno::Reference<sheet::XSheetConditionalEntries>*)0), 0, 0 },
     215         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CONDLOC),  SC_WID_UNO_CONDLOC, &getCppuType((uno::Reference<sheet::XSheetConditionalEntries>*)0), 0, 0 },
     216         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CONDXML),  SC_WID_UNO_CONDXML, &getCppuType((uno::Reference<sheet::XSheetConditionalEntries>*)0), 0, 0 },
     217         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_BLTR), ATTR_BORDER_BLTR, &::getCppuType((const table::BorderLine*)0), 0, 0 | CONVERT_TWIPS },
     218         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_BLTR2), ATTR_BORDER_BLTR, &::getCppuType((const table::BorderLine2*)0), 0, 0 | CONVERT_TWIPS },
     219         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_TLBR), ATTR_BORDER_TLBR, &::getCppuType((const table::BorderLine*)0), 0, 0 | CONVERT_TWIPS },
     220         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_TLBR2), ATTR_BORDER_TLBR, &::getCppuType((const table::BorderLine2*)0), 0, 0 | CONVERT_TWIPS },
     221         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CELLHJUS), ATTR_HOR_JUSTIFY,   &getCppuType((table::CellHoriJustify*)0), 0, MID_HORJUST_HORJUST },
     222         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CELLHJUS_METHOD), ATTR_HOR_JUSTIFY_METHOD, &::getCppuType((const sal_Int32*)0),   0, 0 },
     223         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CELLTRAN), ATTR_BACKGROUND,    &getBooleanCppuType(),                  0, MID_GRAPHIC_TRANSPARENT },
     224         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_WRAP),     ATTR_LINEBREAK,     &getBooleanCppuType(),                  0, 0 },
     225         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_LEFTBORDER),ATTR_BORDER,       &::getCppuType((const table::BorderLine*)0), 0, LEFT_BORDER | CONVERT_TWIPS },
     226         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_LEFTBORDER2),ATTR_BORDER,      &::getCppuType((const table::BorderLine2*)0), 0, LEFT_BORDER | CONVERT_TWIPS },
     227         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_NUMFMT),   ATTR_VALUE_FORMAT,  &getCppuType((sal_Int32*)0),            0, 0 },
     228         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_NUMRULES), SC_WID_UNO_NUMRULES,&getCppuType((const uno::Reference<container::XIndexReplace>*)0), 0, 0 },
     229         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CELLORI),  ATTR_STACKED,       &getCppuType((table::CellOrientation*)0), 0, 0 },
     230         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_PADJUST),  ATTR_HOR_JUSTIFY,   &::getCppuType((const sal_Int16*)0),    0, MID_HORJUST_ADJUST },
     231         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_PBMARGIN), ATTR_MARGIN,        &getCppuType((sal_Int32*)0),            0, MID_MARGIN_LO_MARGIN | CONVERT_TWIPS },
     232         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_PINDENT),  ATTR_INDENT,        &getCppuType((sal_Int16*)0),            0, 0 }, //! CONVERT_TWIPS
     233         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_PISCHDIST),ATTR_SCRIPTSPACE,   &getBooleanCppuType(),                  0, 0 },
     234         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_PISFORBID),ATTR_FORBIDDEN_RULES,&getBooleanCppuType(),                 0, 0 },
     235         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_PISHANG),  ATTR_HANGPUNCTUATION,&getBooleanCppuType(),                 0, 0 },
     236         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_PISHYPHEN),ATTR_HYPHENATE,     &getBooleanCppuType(),                  0, 0 },
     237         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_PLASTADJ), ATTR_HOR_JUSTIFY,   &::getCppuType((const sal_Int16*)0),    0, MID_HORJUST_ADJUST },
     238         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_PLMARGIN), ATTR_MARGIN,        &getCppuType((sal_Int32*)0),            0, MID_MARGIN_L_MARGIN  | CONVERT_TWIPS },
     239         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_PRMARGIN), ATTR_MARGIN,        &getCppuType((sal_Int32*)0),            0, MID_MARGIN_R_MARGIN  | CONVERT_TWIPS },
     240         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_PTMARGIN), ATTR_MARGIN,        &getCppuType((sal_Int32*)0),            0, MID_MARGIN_UP_MARGIN | CONVERT_TWIPS },
     241         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_RIGHTBORDER),ATTR_BORDER,      &::getCppuType((const table::BorderLine*)0), 0, RIGHT_BORDER | CONVERT_TWIPS },
     242         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_RIGHTBORDER2),ATTR_BORDER,     &::getCppuType((const table::BorderLine2*)0), 0, RIGHT_BORDER | CONVERT_TWIPS },
     243         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_ROTANG),   ATTR_ROTATE_VALUE,  &getCppuType((sal_Int32*)0),            0, 0 },
     244         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_ROTREF),   ATTR_ROTATE_MODE,   &getCppuType((sal_Int32*)0), 0, 0 },
     245         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_SHADOW),   ATTR_SHADOW,        &getCppuType((table::ShadowFormat*)0),  0, 0 | CONVERT_TWIPS },
     246         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_SHRINK_TO_FIT), ATTR_SHRINKTOFIT, &getBooleanCppuType(),               0, 0 },
     247         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_TBLBORD),  SC_WID_UNO_TBLBORD, &getCppuType((table::TableBorder*)0),   0, 0 | CONVERT_TWIPS },
     248         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_TBLBORD2),  SC_WID_UNO_TBLBORD2, &getCppuType((table::TableBorder2*)0),   0, 0 | CONVERT_TWIPS },
     249         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_TOPBORDER),ATTR_BORDER,        &::getCppuType((const table::BorderLine*)0), 0, TOP_BORDER | CONVERT_TWIPS },
     250         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_TOPBORDER2),ATTR_BORDER,       &::getCppuType((const table::BorderLine2*)0), 0, TOP_BORDER | CONVERT_TWIPS },
     251         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_USERDEF),  ATTR_USERDEF,       &getCppuType((uno::Reference<container::XNameContainer>*)0), 0, 0 },
     252         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_VALIDAT),  SC_WID_UNO_VALIDAT, &getCppuType((uno::Reference<beans::XPropertySet>*)0), 0, 0 },
     253         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_VALILOC),  SC_WID_UNO_VALILOC, &getCppuType((uno::Reference<beans::XPropertySet>*)0), 0, 0 },
     254         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_VALIXML),  SC_WID_UNO_VALIXML, &getCppuType((uno::Reference<beans::XPropertySet>*)0), 0, 0 },
     255         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CELLVJUS), ATTR_VER_JUSTIFY,   &getCppuType((sal_Int32*)0), 0, 0 },
     256         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CELLVJUS_METHOD), ATTR_VER_JUSTIFY_METHOD, &::getCppuType((const sal_Int32*)0),   0, 0 },
     257         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_WRITING),  ATTR_WRITINGDIR,    &getCppuType((sal_Int16*)0),            0, 0 },
     258                 :            :         {0,0,0,0,0,0}
     259 [ +  + ][ +  - ]:      13695 :     };
                 [ #  # ]
     260 [ +  + ][ +  - ]:      13653 :     static SfxItemPropertySet aCellsPropertySet( aCellsPropertyMap_Impl );
         [ +  - ][ #  # ]
     261                 :      13653 :     return &aCellsPropertySet;
     262                 :            : }
     263                 :            : 
     264                 :            : //  CellRange enthaelt alle Eintraege von Cells, zusaetzlich eigene Eintraege
     265                 :            : //  mit Which-ID 0 (werden nur fuer getPropertySetInfo benoetigt).
     266                 :            : 
     267                 :      10777 : const SfxItemPropertySet* lcl_GetRangePropertySet()
     268                 :            : {
     269                 :            :     static SfxItemPropertyMapEntry aRangePropertyMap_Impl[] =
     270                 :            :     {
     271         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_ABSNAME),  SC_WID_UNO_ABSNAME, &getCppuType((rtl::OUString*)0),        0 | beans::PropertyAttribute::READONLY, 0 },
     272         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_ASIANVERT),ATTR_VERTICAL_ASIAN,&getBooleanCppuType(),                  0, 0 },
     273         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_BOTTBORDER),ATTR_BORDER,       &::getCppuType((const table::BorderLine*)0), 0, BOTTOM_BORDER | CONVERT_TWIPS },
     274         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_BOTTBORDER2),ATTR_BORDER,      &::getCppuType((const table::BorderLine2*)0), 0, BOTTOM_BORDER | CONVERT_TWIPS },
     275         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CELLBACK), ATTR_BACKGROUND,    &getCppuType((sal_Int32*)0),            0, MID_BACK_COLOR },
     276         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CELLPRO),  ATTR_PROTECTION,    &getCppuType((util::CellProtection*)0), 0, 0 },
     277         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CELLSTYL), SC_WID_UNO_CELLSTYL,&getCppuType((rtl::OUString*)0),        0, 0 },
     278         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CCOLOR),   ATTR_FONT_COLOR,    &getCppuType((sal_Int32*)0),            0, 0 },
     279         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_COUTL),    ATTR_FONT_CONTOUR,  &getBooleanCppuType(),                  0, 0 },
     280         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CCROSS),   ATTR_FONT_CROSSEDOUT,&getBooleanCppuType(),                 0, MID_CROSSED_OUT },
     281         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CEMPHAS),  ATTR_FONT_EMPHASISMARK,&getCppuType((sal_Int16*)0),         0, MID_EMPHASIS },
     282         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CFONT),    ATTR_FONT,          &getCppuType((sal_Int16*)0),            0, MID_FONT_FAMILY },
     283         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CFCHARS),  ATTR_FONT,          &getCppuType((sal_Int16*)0),            0, MID_FONT_CHAR_SET },
     284         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_CJK_CFCHARS),  ATTR_CJK_FONT,      &getCppuType((sal_Int16*)0),            0, MID_FONT_CHAR_SET },
     285         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_CTL_CFCHARS),  ATTR_CTL_FONT,      &getCppuType((sal_Int16*)0),            0, MID_FONT_CHAR_SET },
     286         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CFFAMIL),  ATTR_FONT,          &getCppuType((sal_Int16*)0),            0, MID_FONT_FAMILY },
     287         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_CJK_CFFAMIL),  ATTR_CJK_FONT,      &getCppuType((sal_Int16*)0),            0, MID_FONT_FAMILY },
     288         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_CTL_CFFAMIL),  ATTR_CTL_FONT,      &getCppuType((sal_Int16*)0),            0, MID_FONT_FAMILY },
     289         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CFNAME),   ATTR_FONT,          &getCppuType((rtl::OUString*)0),        0, MID_FONT_FAMILY_NAME },
     290         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_CJK_CFNAME),   ATTR_CJK_FONT,      &getCppuType((rtl::OUString*)0),        0, MID_FONT_FAMILY_NAME },
     291         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_CTL_CFNAME),   ATTR_CTL_FONT,      &getCppuType((rtl::OUString*)0),        0, MID_FONT_FAMILY_NAME },
     292         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CFPITCH),  ATTR_FONT,          &getCppuType((sal_Int16*)0),            0, MID_FONT_PITCH },
     293         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_CJK_CFPITCH),  ATTR_CJK_FONT,      &getCppuType((sal_Int16*)0),            0, MID_FONT_PITCH },
     294         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_CTL_CFPITCH),  ATTR_CTL_FONT,      &getCppuType((sal_Int16*)0),            0, MID_FONT_PITCH },
     295         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CFSTYLE),  ATTR_FONT,          &getCppuType((rtl::OUString*)0),        0, MID_FONT_STYLE_NAME },
     296         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_CJK_CFSTYLE),  ATTR_CJK_FONT,      &getCppuType((rtl::OUString*)0),        0, MID_FONT_STYLE_NAME },
     297         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_CTL_CFSTYLE),  ATTR_CTL_FONT,      &getCppuType((rtl::OUString*)0),        0, MID_FONT_STYLE_NAME },
     298         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CHEIGHT),  ATTR_FONT_HEIGHT,   &getCppuType((float*)0),                0, MID_FONTHEIGHT | CONVERT_TWIPS },
     299         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_CJK_CHEIGHT),  ATTR_CJK_FONT_HEIGHT,&getCppuType((float*)0),               0, MID_FONTHEIGHT | CONVERT_TWIPS },
     300         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_CTL_CHEIGHT),  ATTR_CTL_FONT_HEIGHT,&getCppuType((float*)0),               0, MID_FONTHEIGHT | CONVERT_TWIPS },
     301         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CLOCAL),   ATTR_FONT_LANGUAGE, &getCppuType((lang::Locale*)0),         0, MID_LANG_LOCALE },
     302         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_CJK_CLOCAL),   ATTR_CJK_FONT_LANGUAGE,&getCppuType((lang::Locale*)0),          0, MID_LANG_LOCALE },
     303         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_CTL_CLOCAL),   ATTR_CTL_FONT_LANGUAGE,&getCppuType((lang::Locale*)0),          0, MID_LANG_LOCALE },
     304         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_COVER),    ATTR_FONT_OVERLINE, &getCppuType((sal_Int16*)0),            0, MID_TL_STYLE },
     305         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_COVRLCOL), ATTR_FONT_OVERLINE, &getCppuType((sal_Int32*)0),            0, MID_TL_COLOR },
     306         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_COVRLHAS), ATTR_FONT_OVERLINE, &getBooleanCppuType(),                  0, MID_TL_HASCOLOR },
     307         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CPOST),    ATTR_FONT_POSTURE,  &getCppuType((awt::FontSlant*)0),       0, MID_POSTURE },
     308         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_CJK_CPOST),    ATTR_CJK_FONT_POSTURE,&getCppuType((awt::FontSlant*)0),     0, MID_POSTURE },
     309         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_CTL_CPOST),    ATTR_CTL_FONT_POSTURE,&getCppuType((awt::FontSlant*)0),     0, MID_POSTURE },
     310         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CRELIEF),  ATTR_FONT_RELIEF,   &getCppuType((sal_Int16*)0),            0, MID_RELIEF },
     311         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CSHADD),   ATTR_FONT_SHADOWED, &getBooleanCppuType(),                  0, 0 },
     312         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CSTRIKE),  ATTR_FONT_CROSSEDOUT,&getCppuType((sal_Int16*)0),           0, MID_CROSS_OUT },
     313         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CUNDER),   ATTR_FONT_UNDERLINE,&getCppuType((sal_Int16*)0),            0, MID_TL_STYLE },
     314         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CUNDLCOL), ATTR_FONT_UNDERLINE,&getCppuType((sal_Int32*)0),            0, MID_TL_COLOR },
     315         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CUNDLHAS), ATTR_FONT_UNDERLINE,&getBooleanCppuType(),                  0, MID_TL_HASCOLOR },
     316         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CWEIGHT),  ATTR_FONT_WEIGHT,   &getCppuType((float*)0),                0, MID_WEIGHT },
     317         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_CJK_CWEIGHT),  ATTR_CJK_FONT_WEIGHT,&getCppuType((float*)0),               0, MID_WEIGHT },
     318         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_CTL_CWEIGHT),  ATTR_CTL_FONT_WEIGHT,&getCppuType((float*)0),               0, MID_WEIGHT },
     319         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CWORDMOD), ATTR_FONT_WORDLINE, &getBooleanCppuType(),                  0, 0 },
     320         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CHCOLHDR), SC_WID_UNO_CHCOLHDR,&getBooleanCppuType(),                  0, 0 },
     321         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CHROWHDR), SC_WID_UNO_CHROWHDR,&getBooleanCppuType(),                  0, 0 },
     322         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CONDFMT),  SC_WID_UNO_CONDFMT, &getCppuType((uno::Reference<sheet::XSheetConditionalEntries>*)0), 0, 0 },
     323         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CONDLOC),  SC_WID_UNO_CONDLOC, &getCppuType((uno::Reference<sheet::XSheetConditionalEntries>*)0), 0, 0 },
     324         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CONDXML),  SC_WID_UNO_CONDXML, &getCppuType((uno::Reference<sheet::XSheetConditionalEntries>*)0), 0, 0 },
     325         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_BLTR), ATTR_BORDER_BLTR, &::getCppuType((const table::BorderLine*)0), 0, 0 | CONVERT_TWIPS },
     326         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_BLTR2), ATTR_BORDER_BLTR, &::getCppuType((const table::BorderLine2*)0), 0, 0 | CONVERT_TWIPS },
     327         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_TLBR), ATTR_BORDER_TLBR, &::getCppuType((const table::BorderLine*)0), 0, 0 | CONVERT_TWIPS },
     328         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_TLBR2), ATTR_BORDER_TLBR, &::getCppuType((const table::BorderLine2*)0), 0, 0 | CONVERT_TWIPS },
     329         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CELLHJUS), ATTR_HOR_JUSTIFY,   &getCppuType((table::CellHoriJustify*)0),   0, MID_HORJUST_HORJUST },
     330         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CELLHJUS_METHOD), ATTR_HOR_JUSTIFY_METHOD, &::getCppuType((const sal_Int32*)0),   0, 0 },
     331         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CELLTRAN), ATTR_BACKGROUND,    &getBooleanCppuType(),                  0, MID_GRAPHIC_TRANSPARENT },
     332         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_WRAP),     ATTR_LINEBREAK,     &getBooleanCppuType(),                  0, 0 },
     333         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_LEFTBORDER),ATTR_BORDER,       &::getCppuType((const table::BorderLine*)0), 0, LEFT_BORDER | CONVERT_TWIPS },
     334         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_LEFTBORDER2),ATTR_BORDER,      &::getCppuType((const table::BorderLine2*)0), 0, LEFT_BORDER | CONVERT_TWIPS },
     335         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_NUMFMT),   ATTR_VALUE_FORMAT,  &getCppuType((sal_Int32*)0),            0, 0 },
     336         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_NUMRULES), SC_WID_UNO_NUMRULES,&getCppuType((const uno::Reference<container::XIndexReplace>*)0), 0, 0 },
     337         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CELLORI),  ATTR_STACKED,       &getCppuType((table::CellOrientation*)0), 0, 0 },
     338         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_PADJUST),  ATTR_HOR_JUSTIFY,   &::getCppuType((const sal_Int16*)0),    0, MID_HORJUST_ADJUST },
     339         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_PBMARGIN), ATTR_MARGIN,        &getCppuType((sal_Int32*)0),            0, MID_MARGIN_LO_MARGIN | CONVERT_TWIPS },
     340         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_PINDENT),  ATTR_INDENT,        &getCppuType((sal_Int16*)0),            0, 0 }, //! CONVERT_TWIPS
     341         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_PISCHDIST),ATTR_SCRIPTSPACE,   &getBooleanCppuType(),                  0, 0 },
     342         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_PISFORBID),ATTR_FORBIDDEN_RULES,&getBooleanCppuType(),                 0, 0 },
     343         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_PISHANG),  ATTR_HANGPUNCTUATION,&getBooleanCppuType(),                 0, 0 },
     344         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_PISHYPHEN),ATTR_HYPHENATE,     &getBooleanCppuType(),                  0, 0 },
     345         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_PLASTADJ), ATTR_HOR_JUSTIFY,   &::getCppuType((const sal_Int16*)0),    0, MID_HORJUST_ADJUST },
     346         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_PLMARGIN), ATTR_MARGIN,        &getCppuType((sal_Int32*)0),            0, MID_MARGIN_L_MARGIN  | CONVERT_TWIPS },
     347         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_PRMARGIN), ATTR_MARGIN,        &getCppuType((sal_Int32*)0),            0, MID_MARGIN_R_MARGIN  | CONVERT_TWIPS },
     348         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_PTMARGIN), ATTR_MARGIN,        &getCppuType((sal_Int32*)0),            0, MID_MARGIN_UP_MARGIN | CONVERT_TWIPS },
     349         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_POS),      SC_WID_UNO_POS,     &getCppuType((awt::Point*)0),           0 | beans::PropertyAttribute::READONLY, 0 },
     350         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_RIGHTBORDER),ATTR_BORDER,      &::getCppuType((const table::BorderLine*)0), 0, RIGHT_BORDER | CONVERT_TWIPS },
     351         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_RIGHTBORDER2),ATTR_BORDER,     &::getCppuType((const table::BorderLine2*)0), 0, RIGHT_BORDER | CONVERT_TWIPS },
     352         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_ROTANG),   ATTR_ROTATE_VALUE,  &getCppuType((sal_Int32*)0),            0, 0 },
     353         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_ROTREF),   ATTR_ROTATE_MODE,   &getCppuType((sal_Int32*)0), 0, 0 },
     354         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_SHADOW),   ATTR_SHADOW,        &getCppuType((table::ShadowFormat*)0),  0, 0 | CONVERT_TWIPS },
     355         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_SHRINK_TO_FIT), ATTR_SHRINKTOFIT, &getBooleanCppuType(),               0, 0 },
     356         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_SIZE),     SC_WID_UNO_SIZE,    &getCppuType((awt::Size*)0),            0 | beans::PropertyAttribute::READONLY, 0 },
     357         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_TBLBORD),  SC_WID_UNO_TBLBORD, &getCppuType((table::TableBorder*)0),   0, 0 | CONVERT_TWIPS },
     358         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_TBLBORD2),  SC_WID_UNO_TBLBORD2, &getCppuType((table::TableBorder2*)0),   0, 0 | CONVERT_TWIPS },
     359         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_TOPBORDER),ATTR_BORDER,        &::getCppuType((const table::BorderLine*)0), 0, TOP_BORDER | CONVERT_TWIPS },
     360         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_TOPBORDER2),ATTR_BORDER,       &::getCppuType((const table::BorderLine2*)0), 0, TOP_BORDER | CONVERT_TWIPS },
     361         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_USERDEF),  ATTR_USERDEF,       &getCppuType((uno::Reference<container::XNameContainer>*)0), 0, 0 },
     362         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_VALIDAT),  SC_WID_UNO_VALIDAT, &getCppuType((uno::Reference<beans::XPropertySet>*)0), 0, 0 },
     363         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_VALILOC),  SC_WID_UNO_VALILOC, &getCppuType((uno::Reference<beans::XPropertySet>*)0), 0, 0 },
     364         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_VALIXML),  SC_WID_UNO_VALIXML, &getCppuType((uno::Reference<beans::XPropertySet>*)0), 0, 0 },
     365         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CELLVJUS), ATTR_VER_JUSTIFY,   &getCppuType((sal_Int32*)0), 0, 0 },
     366         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CELLVJUS_METHOD), ATTR_VER_JUSTIFY_METHOD, &::getCppuType((const sal_Int32*)0),   0, 0 },
     367         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_WRITING),  ATTR_WRITINGDIR,    &getCppuType((sal_Int16*)0),            0, 0 },
     368                 :            :         {0,0,0,0,0,0}
     369 [ +  + ][ +  - ]:      10819 :     };
                 [ #  # ]
     370 [ +  + ][ +  - ]:      10777 :     static SfxItemPropertySet aRangePropertySet( aRangePropertyMap_Impl );
         [ +  - ][ #  # ]
     371                 :      10777 :     return &aRangePropertySet;
     372                 :            : }
     373                 :            : 
     374                 :            : //  Cell enthaelt alle Eintraege von CellRange, zusaetzlich eigene Eintraege
     375                 :            : //  mit Which-ID 0 (werden nur fuer getPropertySetInfo benoetigt).
     376                 :            : 
     377                 :       3142 : const SfxItemPropertySet* lcl_GetCellPropertySet()
     378                 :            : {
     379                 :            :     static SfxItemPropertyMapEntry aCellPropertyMap_Impl[] =
     380                 :            :     {
     381         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_ABSNAME),  SC_WID_UNO_ABSNAME, &getCppuType((rtl::OUString*)0),        0 | beans::PropertyAttribute::READONLY, 0 },
     382         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_ASIANVERT),ATTR_VERTICAL_ASIAN,&getBooleanCppuType(),                  0, 0 },
     383         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_BOTTBORDER),ATTR_BORDER,       &::getCppuType((const table::BorderLine*)0), 0, BOTTOM_BORDER | CONVERT_TWIPS },
     384         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_BOTTBORDER2),ATTR_BORDER,      &::getCppuType((const table::BorderLine2*)0), 0, BOTTOM_BORDER | CONVERT_TWIPS },
     385         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_CELLBACK), ATTR_BACKGROUND,    &getCppuType((sal_Int32*)0),            0, MID_BACK_COLOR },
     386         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_CELLPRO),  ATTR_PROTECTION,    &getCppuType((util::CellProtection*)0), 0, 0 },
     387         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_CELLSTYL), SC_WID_UNO_CELLSTYL,&getCppuType((rtl::OUString*)0),        0, 0 },
     388         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_CCOLOR),   ATTR_FONT_COLOR,    &getCppuType((sal_Int32*)0),            0, 0 },
     389         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_COUTL),    ATTR_FONT_CONTOUR,  &getBooleanCppuType(),                  0, 0 },
     390         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_CCROSS),   ATTR_FONT_CROSSEDOUT,&getBooleanCppuType(),                 0, MID_CROSSED_OUT },
     391         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_CEMPHAS),  ATTR_FONT_EMPHASISMARK,&getCppuType((sal_Int16*)0),         0, MID_EMPHASIS },
     392         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_CFONT),    ATTR_FONT,          &getCppuType((sal_Int16*)0),            0, MID_FONT_FAMILY },
     393         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_CFCHARS),  ATTR_FONT,          &getCppuType((sal_Int16*)0),            0, MID_FONT_CHAR_SET },
     394         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNO_CJK_CFCHARS),  ATTR_CJK_FONT,      &getCppuType((sal_Int16*)0),            0, MID_FONT_CHAR_SET },
     395         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNO_CTL_CFCHARS),  ATTR_CTL_FONT,      &getCppuType((sal_Int16*)0),            0, MID_FONT_CHAR_SET },
     396         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_CFFAMIL),  ATTR_FONT,          &getCppuType((sal_Int16*)0),            0, MID_FONT_FAMILY },
     397         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNO_CJK_CFFAMIL),  ATTR_CJK_FONT,      &getCppuType((sal_Int16*)0),            0, MID_FONT_FAMILY },
     398         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNO_CTL_CFFAMIL),  ATTR_CTL_FONT,      &getCppuType((sal_Int16*)0),            0, MID_FONT_FAMILY },
     399         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_CFNAME),   ATTR_FONT,          &getCppuType((rtl::OUString*)0),        0, MID_FONT_FAMILY_NAME },
     400         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNO_CJK_CFNAME),   ATTR_CJK_FONT,      &getCppuType((rtl::OUString*)0),        0, MID_FONT_FAMILY_NAME },
     401         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNO_CTL_CFNAME),   ATTR_CTL_FONT,      &getCppuType((rtl::OUString*)0),        0, MID_FONT_FAMILY_NAME },
     402         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_CFPITCH),  ATTR_FONT,          &getCppuType((sal_Int16*)0),            0, MID_FONT_PITCH },
     403         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNO_CJK_CFPITCH),  ATTR_CJK_FONT,      &getCppuType((sal_Int16*)0),            0, MID_FONT_PITCH },
     404         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNO_CTL_CFPITCH),  ATTR_CTL_FONT,      &getCppuType((sal_Int16*)0),            0, MID_FONT_PITCH },
     405         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_CFSTYLE),  ATTR_FONT,          &getCppuType((rtl::OUString*)0),        0, MID_FONT_STYLE_NAME },
     406         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNO_CJK_CFSTYLE),  ATTR_CJK_FONT,      &getCppuType((rtl::OUString*)0),        0, MID_FONT_STYLE_NAME },
     407         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNO_CTL_CFSTYLE),  ATTR_CTL_FONT,      &getCppuType((rtl::OUString*)0),        0, MID_FONT_STYLE_NAME },
     408         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_CHEIGHT),  ATTR_FONT_HEIGHT,   &getCppuType((float*)0),                0, MID_FONTHEIGHT | CONVERT_TWIPS },
     409         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNO_CJK_CHEIGHT),  ATTR_CJK_FONT_HEIGHT,&getCppuType((float*)0),               0, MID_FONTHEIGHT | CONVERT_TWIPS },
     410         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNO_CTL_CHEIGHT),  ATTR_CTL_FONT_HEIGHT,&getCppuType((float*)0),               0, MID_FONTHEIGHT | CONVERT_TWIPS },
     411         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_CLOCAL),   ATTR_FONT_LANGUAGE, &getCppuType((lang::Locale*)0),         0, MID_LANG_LOCALE },
     412         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNO_CJK_CLOCAL),   ATTR_CJK_FONT_LANGUAGE,&getCppuType((lang::Locale*)0),          0, MID_LANG_LOCALE },
     413         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNO_CTL_CLOCAL),   ATTR_CTL_FONT_LANGUAGE,&getCppuType((lang::Locale*)0),          0, MID_LANG_LOCALE },
     414         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_COVER),    ATTR_FONT_OVERLINE, &getCppuType((sal_Int16*)0),            0, MID_TL_STYLE },
     415         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_COVRLCOL), ATTR_FONT_OVERLINE, &getCppuType((sal_Int32*)0),            0, MID_TL_COLOR },
     416         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_COVRLHAS), ATTR_FONT_OVERLINE, &getBooleanCppuType(),                  0, MID_TL_HASCOLOR },
     417         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_CPOST),    ATTR_FONT_POSTURE,  &getCppuType((awt::FontSlant*)0),       0, MID_POSTURE },
     418         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNO_CJK_CPOST),    ATTR_CJK_FONT_POSTURE,&getCppuType((awt::FontSlant*)0),     0, MID_POSTURE },
     419         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNO_CTL_CPOST),    ATTR_CTL_FONT_POSTURE,&getCppuType((awt::FontSlant*)0),     0, MID_POSTURE },
     420         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_CRELIEF),  ATTR_FONT_RELIEF,   &getCppuType((sal_Int16*)0),            0, MID_RELIEF },
     421         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_CSHADD),   ATTR_FONT_SHADOWED, &getBooleanCppuType(),                  0, 0 },
     422         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_CSTRIKE),  ATTR_FONT_CROSSEDOUT,&getCppuType((sal_Int16*)0),           0, MID_CROSS_OUT },
     423         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_CUNDER),   ATTR_FONT_UNDERLINE,&getCppuType((sal_Int16*)0),            0, MID_TL_STYLE },
     424         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_CUNDLCOL), ATTR_FONT_UNDERLINE,&getCppuType((sal_Int32*)0),            0, MID_TL_COLOR },
     425         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_CUNDLHAS), ATTR_FONT_UNDERLINE,&getBooleanCppuType(),                  0, MID_TL_HASCOLOR },
     426         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_CWEIGHT),  ATTR_FONT_WEIGHT,   &getCppuType((float*)0),                0, MID_WEIGHT },
     427         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNO_CJK_CWEIGHT),  ATTR_CJK_FONT_WEIGHT,&getCppuType((float*)0),               0, MID_WEIGHT },
     428         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNO_CTL_CWEIGHT),  ATTR_CTL_FONT_WEIGHT,&getCppuType((float*)0),               0, MID_WEIGHT },
     429         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_CWORDMOD), ATTR_FONT_WORDLINE, &getBooleanCppuType(),                  0, 0 },
     430         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_CHCOLHDR), SC_WID_UNO_CHCOLHDR,&getBooleanCppuType(),                  0, 0 },
     431         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_CHROWHDR), SC_WID_UNO_CHROWHDR,&getBooleanCppuType(),                  0, 0 },
     432         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_CONDFMT),  SC_WID_UNO_CONDFMT, &getCppuType((uno::Reference<sheet::XSheetConditionalEntries>*)0), 0, 0 },
     433         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_CONDLOC),  SC_WID_UNO_CONDLOC, &getCppuType((uno::Reference<sheet::XSheetConditionalEntries>*)0), 0, 0 },
     434         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_CONDXML),  SC_WID_UNO_CONDXML, &getCppuType((uno::Reference<sheet::XSheetConditionalEntries>*)0), 0, 0 },
     435         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_BLTR), ATTR_BORDER_BLTR, &::getCppuType((const table::BorderLine*)0), 0, 0 | CONVERT_TWIPS },
     436         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_BLTR2), ATTR_BORDER_BLTR, &::getCppuType((const table::BorderLine2*)0), 0, 0 | CONVERT_TWIPS },
     437         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_TLBR), ATTR_BORDER_TLBR, &::getCppuType((const table::BorderLine*)0), 0, 0 | CONVERT_TWIPS },
     438         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_TLBR2), ATTR_BORDER_TLBR, &::getCppuType((const table::BorderLine2*)0), 0, 0 | CONVERT_TWIPS },
     439         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_FORMLOC),  SC_WID_UNO_FORMLOC, &getCppuType((rtl::OUString*)0),        0, 0 },
     440         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_FORMRT),   SC_WID_UNO_FORMRT,  &getCppuType((table::CellContentType*)0), 0 | beans::PropertyAttribute::READONLY, 0 },
     441         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_CELLHJUS), ATTR_HOR_JUSTIFY,   &getCppuType((table::CellHoriJustify*)0), 0, MID_HORJUST_HORJUST },
     442         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_CELLHJUS_METHOD), ATTR_HOR_JUSTIFY_METHOD, &::getCppuType((const sal_Int32*)0),   0, 0 },
     443         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_CELLTRAN), ATTR_BACKGROUND,    &getBooleanCppuType(),                  0, MID_GRAPHIC_TRANSPARENT },
     444         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_WRAP),     ATTR_LINEBREAK,     &getBooleanCppuType(),                  0, 0 },
     445         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_LEFTBORDER),ATTR_BORDER,       &::getCppuType((const table::BorderLine*)0), 0, LEFT_BORDER | CONVERT_TWIPS },
     446         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_LEFTBORDER2),ATTR_BORDER,      &::getCppuType((const table::BorderLine2*)0), 0, LEFT_BORDER | CONVERT_TWIPS },
     447         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_NUMFMT),   ATTR_VALUE_FORMAT,  &getCppuType((sal_Int32*)0),            0, 0 },
     448         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_NUMRULES), SC_WID_UNO_NUMRULES,&getCppuType((const uno::Reference<container::XIndexReplace>*)0), 0, 0 },
     449         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_CELLORI),  ATTR_STACKED,       &getCppuType((table::CellOrientation*)0), 0, 0 },
     450         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_PADJUST),  ATTR_HOR_JUSTIFY,   &::getCppuType((const sal_Int16*)0),    0, MID_HORJUST_ADJUST },
     451         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_PBMARGIN), ATTR_MARGIN,        &getCppuType((sal_Int32*)0),            0, MID_MARGIN_LO_MARGIN | CONVERT_TWIPS },
     452         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_PINDENT),  ATTR_INDENT,        &getCppuType((sal_Int16*)0),            0, 0 }, //! CONVERT_TWIPS
     453         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_PISCHDIST),ATTR_SCRIPTSPACE,   &getBooleanCppuType(),                  0, 0 },
     454         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_PISFORBID),ATTR_FORBIDDEN_RULES,&getBooleanCppuType(),                 0, 0 },
     455         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_PISHANG),  ATTR_HANGPUNCTUATION,&getBooleanCppuType(),                 0, 0 },
     456         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_PISHYPHEN),ATTR_HYPHENATE,     &getBooleanCppuType(),                  0, 0 },
     457         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_PLASTADJ), ATTR_HOR_JUSTIFY,   &::getCppuType((const sal_Int16*)0),    0, MID_HORJUST_ADJUST },
     458         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_PLMARGIN), ATTR_MARGIN,        &getCppuType((sal_Int32*)0),            0, MID_MARGIN_L_MARGIN  | CONVERT_TWIPS },
     459         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_PRMARGIN), ATTR_MARGIN,        &getCppuType((sal_Int32*)0),            0, MID_MARGIN_R_MARGIN  | CONVERT_TWIPS },
     460         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_PTMARGIN), ATTR_MARGIN,        &getCppuType((sal_Int32*)0),            0, MID_MARGIN_UP_MARGIN | CONVERT_TWIPS },
     461         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_POS),      SC_WID_UNO_POS,     &getCppuType((awt::Point*)0),           0 | beans::PropertyAttribute::READONLY, 0 },
     462         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_RIGHTBORDER),ATTR_BORDER,      &::getCppuType((const table::BorderLine*)0), 0, RIGHT_BORDER | CONVERT_TWIPS },
     463         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_RIGHTBORDER2),ATTR_BORDER,     &::getCppuType((const table::BorderLine2*)0), 0, RIGHT_BORDER | CONVERT_TWIPS },
     464         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_ROTANG),   ATTR_ROTATE_VALUE,  &getCppuType((sal_Int32*)0),            0, 0 },
     465         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_ROTREF),   ATTR_ROTATE_MODE,   &getCppuType((sal_Int32*)0), 0, 0 },
     466         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_SHADOW),   ATTR_SHADOW,        &getCppuType((table::ShadowFormat*)0),  0, 0 | CONVERT_TWIPS },
     467         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_SHRINK_TO_FIT), ATTR_SHRINKTOFIT, &getBooleanCppuType(),               0, 0 },
     468         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_SIZE),     SC_WID_UNO_SIZE,    &getCppuType((awt::Size*)0),            0 | beans::PropertyAttribute::READONLY, 0 },
     469         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_TBLBORD),  SC_WID_UNO_TBLBORD, &getCppuType((table::TableBorder*)0),   0, 0 | CONVERT_TWIPS },
     470         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_TBLBORD2),  SC_WID_UNO_TBLBORD2, &getCppuType((table::TableBorder2*)0),   0, 0 | CONVERT_TWIPS },
     471         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_TOPBORDER),ATTR_BORDER,        &::getCppuType((const table::BorderLine*)0), 0, TOP_BORDER | CONVERT_TWIPS },
     472         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_TOPBORDER2),ATTR_BORDER,       &::getCppuType((const table::BorderLine2*)0), 0, TOP_BORDER | CONVERT_TWIPS },
     473         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_USERDEF),  ATTR_USERDEF,       &getCppuType((uno::Reference<container::XNameContainer>*)0), 0, 0 },
     474         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_VALIDAT),  SC_WID_UNO_VALIDAT, &getCppuType((uno::Reference<beans::XPropertySet>*)0), 0, 0 },
     475         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_VALILOC),  SC_WID_UNO_VALILOC, &getCppuType((uno::Reference<beans::XPropertySet>*)0), 0, 0 },
     476         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_VALIXML),  SC_WID_UNO_VALIXML, &getCppuType((uno::Reference<beans::XPropertySet>*)0), 0, 0 },
     477         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_CELLVJUS), ATTR_VER_JUSTIFY,   &getCppuType((sal_Int32*)0), 0, 0 },
     478         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_CELLVJUS_METHOD), ATTR_VER_JUSTIFY_METHOD, &::getCppuType((const sal_Int32*)0),   0, 0 },
     479         [ +  - ]:         36 :         {MAP_CHAR_LEN(SC_UNONAME_WRITING),  ATTR_WRITINGDIR,    &getCppuType((sal_Int16*)0),            0, 0 },
     480         [ +  - ]:         36 :         {MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_ESCAPEMENT),   EE_CHAR_ESCAPEMENT, &getCppuType((sal_Int32*)0),            0, 0 },
     481                 :            :         {0,0,0,0,0,0}
     482 [ +  + ][ +  - ]:       3178 :     };
                 [ #  # ]
     483 [ +  + ][ +  - ]:       3142 :     static SfxItemPropertySet aCellPropertySet( aCellPropertyMap_Impl );
         [ +  - ][ #  # ]
     484                 :       3142 :     return &aCellPropertySet;
     485                 :            : }
     486                 :            : 
     487                 :            : //  Column und Row enthalten alle Eintraege von CellRange, zusaetzlich eigene Eintraege
     488                 :            : //  mit Which-ID 0 (werden nur fuer getPropertySetInfo benoetigt).
     489                 :            : 
     490                 :       1036 : const SfxItemPropertySet* lcl_GetColumnPropertySet()
     491                 :            : {
     492                 :            :     static SfxItemPropertyMapEntry aColumnPropertyMap_Impl[] =
     493                 :            :     {
     494         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_ABSNAME),  SC_WID_UNO_ABSNAME, &getCppuType((rtl::OUString*)0),        0 | beans::PropertyAttribute::READONLY, 0 },
     495         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_ASIANVERT),ATTR_VERTICAL_ASIAN,&getBooleanCppuType(),                  0, 0 },
     496         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_BOTTBORDER),ATTR_BORDER,       &::getCppuType((const table::BorderLine*)0), 0, BOTTOM_BORDER | CONVERT_TWIPS },
     497         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_BOTTBORDER2),ATTR_BORDER,      &::getCppuType((const table::BorderLine2*)0), 0, BOTTOM_BORDER | CONVERT_TWIPS },
     498         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_CELLBACK), ATTR_BACKGROUND,    &getCppuType((sal_Int32*)0),            0, MID_BACK_COLOR },
     499         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_CELLPRO),  ATTR_PROTECTION,    &getCppuType((util::CellProtection*)0), 0, 0 },
     500         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_CELLSTYL), SC_WID_UNO_CELLSTYL,&getCppuType((rtl::OUString*)0),        0, 0 },
     501         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_CCOLOR),   ATTR_FONT_COLOR,    &getCppuType((sal_Int32*)0),            0, 0 },
     502         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_COUTL),    ATTR_FONT_CONTOUR,  &getBooleanCppuType(),                  0, 0 },
     503         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_CCROSS),   ATTR_FONT_CROSSEDOUT,&getBooleanCppuType(),                 0, MID_CROSSED_OUT },
     504         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_CEMPHAS),  ATTR_FONT_EMPHASISMARK,&getCppuType((sal_Int16*)0),         0, MID_EMPHASIS },
     505         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_CFONT),    ATTR_FONT,          &getCppuType((sal_Int16*)0),            0, MID_FONT_FAMILY },
     506         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_CFCHARS),  ATTR_FONT,          &getCppuType((sal_Int16*)0),            0, MID_FONT_CHAR_SET },
     507         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNO_CJK_CFCHARS),  ATTR_CJK_FONT,      &getCppuType((sal_Int16*)0),            0, MID_FONT_CHAR_SET },
     508         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNO_CTL_CFCHARS),  ATTR_CTL_FONT,      &getCppuType((sal_Int16*)0),            0, MID_FONT_CHAR_SET },
     509         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_CFFAMIL),  ATTR_FONT,          &getCppuType((sal_Int16*)0),            0, MID_FONT_FAMILY },
     510         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNO_CJK_CFFAMIL),  ATTR_CJK_FONT,      &getCppuType((sal_Int16*)0),            0, MID_FONT_FAMILY },
     511         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNO_CTL_CFFAMIL),  ATTR_CTL_FONT,      &getCppuType((sal_Int16*)0),            0, MID_FONT_FAMILY },
     512         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_CFNAME),   ATTR_FONT,          &getCppuType((rtl::OUString*)0),        0, MID_FONT_FAMILY_NAME },
     513         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNO_CJK_CFNAME),   ATTR_CJK_FONT,      &getCppuType((rtl::OUString*)0),        0, MID_FONT_FAMILY_NAME },
     514         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNO_CTL_CFNAME),   ATTR_CTL_FONT,      &getCppuType((rtl::OUString*)0),        0, MID_FONT_FAMILY_NAME },
     515         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_CFPITCH),  ATTR_FONT,          &getCppuType((sal_Int16*)0),            0, MID_FONT_PITCH },
     516         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNO_CJK_CFPITCH),  ATTR_CJK_FONT,      &getCppuType((sal_Int16*)0),            0, MID_FONT_PITCH },
     517         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNO_CTL_CFPITCH),  ATTR_CTL_FONT,      &getCppuType((sal_Int16*)0),            0, MID_FONT_PITCH },
     518         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_CFSTYLE),  ATTR_FONT,          &getCppuType((rtl::OUString*)0),        0, MID_FONT_STYLE_NAME },
     519         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNO_CJK_CFSTYLE),  ATTR_CJK_FONT,      &getCppuType((rtl::OUString*)0),        0, MID_FONT_STYLE_NAME },
     520         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNO_CTL_CFSTYLE),  ATTR_CTL_FONT,      &getCppuType((rtl::OUString*)0),        0, MID_FONT_STYLE_NAME },
     521         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_CHEIGHT),  ATTR_FONT_HEIGHT,   &getCppuType((float*)0),                0, MID_FONTHEIGHT | CONVERT_TWIPS },
     522         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNO_CJK_CHEIGHT),  ATTR_CJK_FONT_HEIGHT,&getCppuType((float*)0),               0, MID_FONTHEIGHT | CONVERT_TWIPS },
     523         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNO_CTL_CHEIGHT),  ATTR_CTL_FONT_HEIGHT,&getCppuType((float*)0),               0, MID_FONTHEIGHT | CONVERT_TWIPS },
     524         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_CLOCAL),   ATTR_FONT_LANGUAGE, &getCppuType((lang::Locale*)0),         0, MID_LANG_LOCALE },
     525         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNO_CJK_CLOCAL),   ATTR_CJK_FONT_LANGUAGE,&getCppuType((lang::Locale*)0),          0, MID_LANG_LOCALE },
     526         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNO_CTL_CLOCAL),   ATTR_CTL_FONT_LANGUAGE,&getCppuType((lang::Locale*)0),          0, MID_LANG_LOCALE },
     527         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_COVER),    ATTR_FONT_OVERLINE, &getCppuType((sal_Int16*)0),            0, MID_TL_STYLE },
     528         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_COVRLCOL), ATTR_FONT_OVERLINE, &getCppuType((sal_Int32*)0),            0, MID_TL_COLOR },
     529         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_COVRLHAS), ATTR_FONT_OVERLINE, &getBooleanCppuType(),                  0, MID_TL_HASCOLOR },
     530         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_CPOST),    ATTR_FONT_POSTURE,  &getCppuType((awt::FontSlant*)0),       0, MID_POSTURE },
     531         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNO_CJK_CPOST),    ATTR_CJK_FONT_POSTURE,&getCppuType((awt::FontSlant*)0),     0, MID_POSTURE },
     532         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNO_CTL_CPOST),    ATTR_CTL_FONT_POSTURE,&getCppuType((awt::FontSlant*)0),     0, MID_POSTURE },
     533         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_CRELIEF),  ATTR_FONT_RELIEF,   &getCppuType((sal_Int16*)0),            0, MID_RELIEF },
     534         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_CSHADD),   ATTR_FONT_SHADOWED, &getBooleanCppuType(),                  0, 0 },
     535         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_CSTRIKE),  ATTR_FONT_CROSSEDOUT,&getCppuType((sal_Int16*)0),           0, MID_CROSS_OUT },
     536         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_CUNDER),   ATTR_FONT_UNDERLINE,&getCppuType((sal_Int16*)0),            0, MID_TL_STYLE },
     537         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_CUNDLCOL), ATTR_FONT_UNDERLINE,&getCppuType((sal_Int32*)0),            0, MID_TL_COLOR },
     538         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_CUNDLHAS), ATTR_FONT_UNDERLINE,&getBooleanCppuType(),                  0, MID_TL_HASCOLOR },
     539         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_CWEIGHT),  ATTR_FONT_WEIGHT,   &getCppuType((float*)0),                0, MID_WEIGHT },
     540         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNO_CJK_CWEIGHT),  ATTR_CJK_FONT_WEIGHT,&getCppuType((float*)0),               0, MID_WEIGHT },
     541         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNO_CTL_CWEIGHT),  ATTR_CTL_FONT_WEIGHT,&getCppuType((float*)0),               0, MID_WEIGHT },
     542         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_CWORDMOD), ATTR_FONT_WORDLINE, &getBooleanCppuType(),                  0, 0 },
     543         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_CHCOLHDR), SC_WID_UNO_CHCOLHDR,&getBooleanCppuType(),                  0, 0 },
     544         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_CHROWHDR), SC_WID_UNO_CHROWHDR,&getBooleanCppuType(),                  0, 0 },
     545         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_CONDFMT),  SC_WID_UNO_CONDFMT, &getCppuType((uno::Reference<sheet::XSheetConditionalEntries>*)0), 0, 0 },
     546         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_CONDLOC),  SC_WID_UNO_CONDLOC, &getCppuType((uno::Reference<sheet::XSheetConditionalEntries>*)0), 0, 0 },
     547         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_CONDXML),  SC_WID_UNO_CONDXML, &getCppuType((uno::Reference<sheet::XSheetConditionalEntries>*)0), 0, 0 },
     548         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_BLTR), ATTR_BORDER_BLTR, &::getCppuType((const table::BorderLine*)0), 0, 0 | CONVERT_TWIPS },
     549         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_BLTR2), ATTR_BORDER_BLTR, &::getCppuType((const table::BorderLine2*)0), 0, 0 | CONVERT_TWIPS },
     550         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_TLBR), ATTR_BORDER_TLBR, &::getCppuType((const table::BorderLine*)0), 0, 0 | CONVERT_TWIPS },
     551         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_TLBR2), ATTR_BORDER_TLBR, &::getCppuType((const table::BorderLine2*)0), 0, 0 | CONVERT_TWIPS },
     552         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_CELLHJUS), ATTR_HOR_JUSTIFY,   &getCppuType((table::CellHoriJustify*)0), 0, MID_HORJUST_HORJUST },
     553         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_CELLHJUS_METHOD), ATTR_HOR_JUSTIFY_METHOD, &::getCppuType((const sal_Int32*)0),   0, 0 },
     554         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_CELLTRAN), ATTR_BACKGROUND,    &getBooleanCppuType(),                  0, MID_GRAPHIC_TRANSPARENT },
     555         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_MANPAGE),  SC_WID_UNO_MANPAGE, &getBooleanCppuType(),                  0, 0 },
     556         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_NEWPAGE),  SC_WID_UNO_NEWPAGE, &getBooleanCppuType(),                  0, 0 },
     557         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_WRAP),     ATTR_LINEBREAK,     &getBooleanCppuType(),                  0, 0 },
     558         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_CELLVIS),  SC_WID_UNO_CELLVIS, &getBooleanCppuType(),                  0, 0 },
     559         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_LEFTBORDER),ATTR_BORDER,       &::getCppuType((const table::BorderLine*)0), 0, LEFT_BORDER | CONVERT_TWIPS },
     560         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_LEFTBORDER2),ATTR_BORDER,      &::getCppuType((const table::BorderLine2*)0), 0, LEFT_BORDER | CONVERT_TWIPS },
     561         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_NUMFMT),   ATTR_VALUE_FORMAT,  &getCppuType((sal_Int32*)0),            0, 0 },
     562         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_NUMRULES), SC_WID_UNO_NUMRULES,&getCppuType((const uno::Reference<container::XIndexReplace>*)0), 0, 0 },
     563         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_OWIDTH),   SC_WID_UNO_OWIDTH,  &getBooleanCppuType(),                  0, 0 },
     564         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_CELLORI),  ATTR_STACKED,       &getCppuType((table::CellOrientation*)0), 0, 0 },
     565         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_PADJUST),  ATTR_HOR_JUSTIFY,   &::getCppuType((const sal_Int16*)0),    0, MID_HORJUST_ADJUST },
     566         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_PBMARGIN), ATTR_MARGIN,        &getCppuType((sal_Int32*)0),            0, MID_MARGIN_LO_MARGIN | CONVERT_TWIPS },
     567         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_PINDENT),  ATTR_INDENT,        &getCppuType((sal_Int16*)0),            0, 0 }, //! CONVERT_TWIPS
     568         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_PISCHDIST),ATTR_SCRIPTSPACE,   &getBooleanCppuType(),                  0, 0 },
     569         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_PISFORBID),ATTR_FORBIDDEN_RULES,&getBooleanCppuType(),                 0, 0 },
     570         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_PISHANG),  ATTR_HANGPUNCTUATION,&getBooleanCppuType(),                 0, 0 },
     571         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_PISHYPHEN),ATTR_HYPHENATE,     &getBooleanCppuType(),                  0, 0 },
     572         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_PLASTADJ), ATTR_HOR_JUSTIFY,   &::getCppuType((const sal_Int16*)0),    0, MID_HORJUST_ADJUST },
     573         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_PLMARGIN), ATTR_MARGIN,        &getCppuType((sal_Int32*)0),            0, MID_MARGIN_L_MARGIN  | CONVERT_TWIPS },
     574         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_PRMARGIN), ATTR_MARGIN,        &getCppuType((sal_Int32*)0),            0, MID_MARGIN_R_MARGIN  | CONVERT_TWIPS },
     575         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_PTMARGIN), ATTR_MARGIN,        &getCppuType((sal_Int32*)0),            0, MID_MARGIN_UP_MARGIN | CONVERT_TWIPS },
     576         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_POS),      SC_WID_UNO_POS,     &getCppuType((awt::Point*)0),           0 | beans::PropertyAttribute::READONLY, 0 },
     577         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_RIGHTBORDER),ATTR_BORDER,      &::getCppuType((const table::BorderLine*)0), 0, RIGHT_BORDER | CONVERT_TWIPS },
     578         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_RIGHTBORDER2),ATTR_BORDER,      &::getCppuType((const table::BorderLine2*)0), 0, RIGHT_BORDER | CONVERT_TWIPS },
     579         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_ROTANG),   ATTR_ROTATE_VALUE,  &getCppuType((sal_Int32*)0),            0, 0 },
     580         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_ROTREF),   ATTR_ROTATE_MODE,   &getCppuType((sal_Int32*)0), 0, 0 },
     581         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_SHADOW),   ATTR_SHADOW,        &getCppuType((table::ShadowFormat*)0),  0, 0 | CONVERT_TWIPS },
     582         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_SHRINK_TO_FIT), ATTR_SHRINKTOFIT, &getBooleanCppuType(),               0, 0 },
     583         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_SIZE),     SC_WID_UNO_SIZE,    &getCppuType((awt::Size*)0),            0 | beans::PropertyAttribute::READONLY, 0 },
     584         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_TBLBORD),  SC_WID_UNO_TBLBORD, &getCppuType((table::TableBorder*)0),   0, 0 | CONVERT_TWIPS },
     585         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_TBLBORD2),  SC_WID_UNO_TBLBORD2, &getCppuType((table::TableBorder2*)0),   0, 0 | CONVERT_TWIPS },
     586         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_TOPBORDER),ATTR_BORDER,        &::getCppuType((const table::BorderLine*)0), 0, TOP_BORDER | CONVERT_TWIPS },
     587         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_TOPBORDER2),ATTR_BORDER,       &::getCppuType((const table::BorderLine2*)0), 0, TOP_BORDER | CONVERT_TWIPS },
     588         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_USERDEF),  ATTR_USERDEF,       &getCppuType((uno::Reference<container::XNameContainer>*)0), 0, 0 },
     589         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_VALIDAT),  SC_WID_UNO_VALIDAT, &getCppuType((uno::Reference<beans::XPropertySet>*)0), 0, 0 },
     590         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_VALILOC),  SC_WID_UNO_VALILOC, &getCppuType((uno::Reference<beans::XPropertySet>*)0), 0, 0 },
     591         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_VALIXML),  SC_WID_UNO_VALIXML, &getCppuType((uno::Reference<beans::XPropertySet>*)0), 0, 0 },
     592         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_CELLVJUS), ATTR_VER_JUSTIFY,   &getCppuType((sal_Int32*)0), 0, 0 },
     593         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_CELLVJUS_METHOD), ATTR_VER_JUSTIFY_METHOD, &::getCppuType((const sal_Int32*)0),   0, 0 },
     594         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_CELLWID),  SC_WID_UNO_CELLWID, &getCppuType((sal_Int32*)0),            0, 0 },
     595         [ +  - ]:          4 :         {MAP_CHAR_LEN(SC_UNONAME_WRITING),  ATTR_WRITINGDIR,    &getCppuType((sal_Int16*)0),            0, 0 },
     596                 :            :         {0,0,0,0,0,0}
     597 [ +  + ][ +  - ]:       1040 :     };
                 [ #  # ]
     598 [ +  + ][ +  - ]:       1036 :     static SfxItemPropertySet aColumnPropertySet( aColumnPropertyMap_Impl );
         [ +  - ][ #  # ]
     599                 :       1036 :     return &aColumnPropertySet;
     600                 :            : }
     601                 :            : 
     602                 :         27 : const SfxItemPropertySet* lcl_GetRowPropertySet()
     603                 :            : {
     604                 :            :     static SfxItemPropertyMapEntry aRowPropertyMap_Impl[] =
     605                 :            :     {
     606         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_ABSNAME),  SC_WID_UNO_ABSNAME, &getCppuType((rtl::OUString*)0),        0 | beans::PropertyAttribute::READONLY, 0 },
     607         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_ASIANVERT),ATTR_VERTICAL_ASIAN,&getBooleanCppuType(),                  0, 0 },
     608         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_BOTTBORDER),ATTR_BORDER,       &::getCppuType((const table::BorderLine*)0), 0, BOTTOM_BORDER | CONVERT_TWIPS },
     609         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_BOTTBORDER2),ATTR_BORDER,      &::getCppuType((const table::BorderLine2*)0), 0, BOTTOM_BORDER | CONVERT_TWIPS },
     610         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_CELLBACK), ATTR_BACKGROUND,    &getCppuType((sal_Int32*)0),            0, MID_BACK_COLOR },
     611         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_CELLPRO),  ATTR_PROTECTION,    &getCppuType((util::CellProtection*)0), 0, 0 },
     612         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_CELLSTYL), SC_WID_UNO_CELLSTYL,&getCppuType((rtl::OUString*)0),        0, 0 },
     613         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_CCOLOR),   ATTR_FONT_COLOR,    &getCppuType((sal_Int32*)0),            0, 0 },
     614         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_COUTL),    ATTR_FONT_CONTOUR,  &getBooleanCppuType(),                  0, 0 },
     615         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_CCROSS),   ATTR_FONT_CROSSEDOUT,&getBooleanCppuType(),                 0, MID_CROSSED_OUT },
     616         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_CEMPHAS),  ATTR_FONT_EMPHASISMARK,&getCppuType((sal_Int16*)0),         0, MID_EMPHASIS },
     617         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_CFONT),    ATTR_FONT,          &getCppuType((sal_Int16*)0),            0, MID_FONT_FAMILY },
     618         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_CFCHARS),  ATTR_FONT,          &getCppuType((sal_Int16*)0),            0, MID_FONT_CHAR_SET },
     619         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNO_CJK_CFCHARS),  ATTR_CJK_FONT,      &getCppuType((sal_Int16*)0),            0, MID_FONT_CHAR_SET },
     620         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNO_CTL_CFCHARS),  ATTR_CTL_FONT,      &getCppuType((sal_Int16*)0),            0, MID_FONT_CHAR_SET },
     621         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_CFFAMIL),  ATTR_FONT,          &getCppuType((sal_Int16*)0),            0, MID_FONT_FAMILY },
     622         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNO_CJK_CFFAMIL),  ATTR_CJK_FONT,      &getCppuType((sal_Int16*)0),            0, MID_FONT_FAMILY },
     623         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNO_CTL_CFFAMIL),  ATTR_CTL_FONT,      &getCppuType((sal_Int16*)0),            0, MID_FONT_FAMILY },
     624         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_CFNAME),   ATTR_FONT,          &getCppuType((rtl::OUString*)0),        0, MID_FONT_FAMILY_NAME },
     625         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNO_CJK_CFNAME),   ATTR_CJK_FONT,      &getCppuType((rtl::OUString*)0),        0, MID_FONT_FAMILY_NAME },
     626         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNO_CTL_CFNAME),   ATTR_CTL_FONT,      &getCppuType((rtl::OUString*)0),        0, MID_FONT_FAMILY_NAME },
     627         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_CFPITCH),  ATTR_FONT,          &getCppuType((sal_Int16*)0),            0, MID_FONT_PITCH },
     628         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNO_CJK_CFPITCH),  ATTR_CJK_FONT,      &getCppuType((sal_Int16*)0),            0, MID_FONT_PITCH },
     629         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNO_CTL_CFPITCH),  ATTR_CTL_FONT,      &getCppuType((sal_Int16*)0),            0, MID_FONT_PITCH },
     630         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_CFSTYLE),  ATTR_FONT,          &getCppuType((rtl::OUString*)0),        0, MID_FONT_STYLE_NAME },
     631         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNO_CJK_CFSTYLE),  ATTR_CJK_FONT,      &getCppuType((rtl::OUString*)0),        0, MID_FONT_STYLE_NAME },
     632         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNO_CTL_CFSTYLE),  ATTR_CTL_FONT,      &getCppuType((rtl::OUString*)0),        0, MID_FONT_STYLE_NAME },
     633         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_CHEIGHT),  ATTR_FONT_HEIGHT,   &getCppuType((float*)0),                0, MID_FONTHEIGHT | CONVERT_TWIPS },
     634         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNO_CJK_CHEIGHT),  ATTR_CJK_FONT_HEIGHT,&getCppuType((float*)0),               0, MID_FONTHEIGHT | CONVERT_TWIPS },
     635         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNO_CTL_CHEIGHT),  ATTR_CTL_FONT_HEIGHT,&getCppuType((float*)0),               0, MID_FONTHEIGHT | CONVERT_TWIPS },
     636         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_CLOCAL),   ATTR_FONT_LANGUAGE, &getCppuType((lang::Locale*)0),         0, MID_LANG_LOCALE },
     637         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNO_CJK_CLOCAL),   ATTR_CJK_FONT_LANGUAGE,&getCppuType((lang::Locale*)0),          0, MID_LANG_LOCALE },
     638         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNO_CTL_CLOCAL),   ATTR_CTL_FONT_LANGUAGE,&getCppuType((lang::Locale*)0),          0, MID_LANG_LOCALE },
     639         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_COVER),    ATTR_FONT_OVERLINE, &getCppuType((sal_Int16*)0),            0, MID_TL_STYLE },
     640         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_COVRLCOL), ATTR_FONT_OVERLINE, &getCppuType((sal_Int32*)0),            0, MID_TL_COLOR },
     641         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_COVRLHAS), ATTR_FONT_OVERLINE, &getBooleanCppuType(),                  0, MID_TL_HASCOLOR },
     642         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_CPOST),    ATTR_FONT_POSTURE,  &getCppuType((awt::FontSlant*)0),       0, MID_POSTURE },
     643         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNO_CJK_CPOST),    ATTR_CJK_FONT_POSTURE,&getCppuType((awt::FontSlant*)0),     0, MID_POSTURE },
     644         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNO_CTL_CPOST),    ATTR_CTL_FONT_POSTURE,&getCppuType((awt::FontSlant*)0),     0, MID_POSTURE },
     645         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_CRELIEF),  ATTR_FONT_RELIEF,   &getCppuType((sal_Int16*)0),            0, MID_RELIEF },
     646         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_CSHADD),   ATTR_FONT_SHADOWED, &getBooleanCppuType(),                  0, 0 },
     647         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_CSTRIKE),  ATTR_FONT_CROSSEDOUT,&getCppuType((sal_Int16*)0),           0, MID_CROSS_OUT },
     648         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_CUNDER),   ATTR_FONT_UNDERLINE,&getCppuType((sal_Int16*)0),            0, MID_TL_STYLE },
     649         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_CUNDLCOL), ATTR_FONT_UNDERLINE,&getCppuType((sal_Int32*)0),            0, MID_TL_COLOR },
     650         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_CUNDLHAS), ATTR_FONT_UNDERLINE,&getBooleanCppuType(),                  0, MID_TL_HASCOLOR },
     651         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_CWEIGHT),  ATTR_FONT_WEIGHT,   &getCppuType((float*)0),                0, MID_WEIGHT },
     652         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNO_CJK_CWEIGHT),  ATTR_CJK_FONT_WEIGHT,&getCppuType((float*)0),               0, MID_WEIGHT },
     653         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNO_CTL_CWEIGHT),  ATTR_CTL_FONT_WEIGHT,&getCppuType((float*)0),               0, MID_WEIGHT },
     654         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_CWORDMOD), ATTR_FONT_WORDLINE, &getBooleanCppuType(),                  0, 0 },
     655         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_CHCOLHDR), SC_WID_UNO_CHCOLHDR,&getBooleanCppuType(),                  0, 0 },
     656         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_CHROWHDR), SC_WID_UNO_CHROWHDR,&getBooleanCppuType(),                  0, 0 },
     657         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_CONDFMT),  SC_WID_UNO_CONDFMT, &getCppuType((uno::Reference<sheet::XSheetConditionalEntries>*)0), 0, 0 },
     658         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_CONDLOC),  SC_WID_UNO_CONDLOC, &getCppuType((uno::Reference<sheet::XSheetConditionalEntries>*)0), 0, 0 },
     659         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_CONDXML),  SC_WID_UNO_CONDXML, &getCppuType((uno::Reference<sheet::XSheetConditionalEntries>*)0), 0, 0 },
     660         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_BLTR), ATTR_BORDER_BLTR, &::getCppuType((const table::BorderLine*)0), 0, 0 | CONVERT_TWIPS },
     661         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_BLTR2), ATTR_BORDER_BLTR, &::getCppuType((const table::BorderLine2*)0), 0, 0 | CONVERT_TWIPS },
     662         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_TLBR), ATTR_BORDER_TLBR, &::getCppuType((const table::BorderLine*)0), 0, 0 | CONVERT_TWIPS },
     663         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_TLBR2), ATTR_BORDER_TLBR, &::getCppuType((const table::BorderLine2*)0), 0, 0 | CONVERT_TWIPS },
     664         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_CELLHGT),  SC_WID_UNO_CELLHGT, &getCppuType((sal_Int32*)0),            0, 0 },
     665         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_CELLHJUS), ATTR_HOR_JUSTIFY,   &getCppuType((table::CellHoriJustify*)0), 0, MID_HORJUST_HORJUST },
     666         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_CELLHJUS_METHOD), ATTR_HOR_JUSTIFY_METHOD, &::getCppuType((const sal_Int32*)0),   0, 0 },
     667         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_CELLTRAN), ATTR_BACKGROUND,    &getBooleanCppuType(),                  0, MID_GRAPHIC_TRANSPARENT },
     668         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_CELLFILT), SC_WID_UNO_CELLFILT,&getBooleanCppuType(),                  0, 0 },
     669         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_MANPAGE),  SC_WID_UNO_MANPAGE, &getBooleanCppuType(),                  0, 0 },
     670         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_NEWPAGE),  SC_WID_UNO_NEWPAGE, &getBooleanCppuType(),                  0, 0 },
     671         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_WRAP),     ATTR_LINEBREAK,     &getBooleanCppuType(),                  0, 0 },
     672         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_CELLVIS),  SC_WID_UNO_CELLVIS, &getBooleanCppuType(),                  0, 0 },
     673         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_LEFTBORDER),ATTR_BORDER,       &::getCppuType((const table::BorderLine*)0), 0, LEFT_BORDER | CONVERT_TWIPS },
     674         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_LEFTBORDER2),ATTR_BORDER,      &::getCppuType((const table::BorderLine2*)0), 0, LEFT_BORDER | CONVERT_TWIPS },
     675         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_NUMFMT),   ATTR_VALUE_FORMAT,  &getCppuType((sal_Int32*)0),            0, 0 },
     676         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_NUMRULES), SC_WID_UNO_NUMRULES,&getCppuType((const uno::Reference<container::XIndexReplace>*)0), 0, 0 },
     677         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_OHEIGHT),  SC_WID_UNO_OHEIGHT, &getBooleanCppuType(),                  0, 0 },
     678         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_CELLORI),  ATTR_STACKED,       &getCppuType((table::CellOrientation*)0), 0, 0 },
     679         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_PADJUST),  ATTR_HOR_JUSTIFY,   &::getCppuType((const sal_Int16*)0),    0, MID_HORJUST_ADJUST },
     680         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_PBMARGIN), ATTR_MARGIN,        &getCppuType((sal_Int32*)0),            0, MID_MARGIN_LO_MARGIN | CONVERT_TWIPS },
     681         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_PINDENT),  ATTR_INDENT,        &getCppuType((sal_Int16*)0),            0, 0 }, //! CONVERT_TWIPS
     682         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_PISCHDIST),ATTR_SCRIPTSPACE,   &getBooleanCppuType(),                  0, 0 },
     683         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_PISFORBID),ATTR_FORBIDDEN_RULES,&getBooleanCppuType(),                 0, 0 },
     684         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_PISHANG),  ATTR_HANGPUNCTUATION,&getBooleanCppuType(),                 0, 0 },
     685         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_PISHYPHEN),ATTR_HYPHENATE,     &getBooleanCppuType(),                  0, 0 },
     686         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_PLASTADJ), ATTR_HOR_JUSTIFY,   &::getCppuType((const sal_Int16*)0),    0, MID_HORJUST_ADJUST },
     687         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_PLMARGIN), ATTR_MARGIN,        &getCppuType((sal_Int32*)0),            0, MID_MARGIN_L_MARGIN  | CONVERT_TWIPS },
     688         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_PRMARGIN), ATTR_MARGIN,        &getCppuType((sal_Int32*)0),            0, MID_MARGIN_R_MARGIN  | CONVERT_TWIPS },
     689         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_PTMARGIN), ATTR_MARGIN,        &getCppuType((sal_Int32*)0),            0, MID_MARGIN_UP_MARGIN | CONVERT_TWIPS },
     690         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_POS),      SC_WID_UNO_POS,     &getCppuType((awt::Point*)0),           0 | beans::PropertyAttribute::READONLY, 0 },
     691         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_RIGHTBORDER),ATTR_BORDER,      &::getCppuType((const table::BorderLine*)0), 0, RIGHT_BORDER | CONVERT_TWIPS },
     692         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_RIGHTBORDER2),ATTR_BORDER,     &::getCppuType((const table::BorderLine2*)0), 0, RIGHT_BORDER | CONVERT_TWIPS },
     693         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_ROTANG),   ATTR_ROTATE_VALUE,  &getCppuType((sal_Int32*)0),            0, 0 },
     694         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_ROTREF),   ATTR_ROTATE_MODE,   &getCppuType((sal_Int32*)0), 0, 0 },
     695         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_SHADOW),   ATTR_SHADOW,        &getCppuType((table::ShadowFormat*)0),  0, 0 | CONVERT_TWIPS },
     696         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_SHRINK_TO_FIT), ATTR_SHRINKTOFIT, &getBooleanCppuType(),               0, 0 },
     697         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_SIZE),     SC_WID_UNO_SIZE,    &getCppuType((awt::Size*)0),            0 | beans::PropertyAttribute::READONLY, 0 },
     698         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_TBLBORD),  SC_WID_UNO_TBLBORD, &getCppuType((table::TableBorder*)0),   0, 0 | CONVERT_TWIPS },
     699         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_TBLBORD2),  SC_WID_UNO_TBLBORD2, &getCppuType((table::TableBorder2*)0),   0, 0 | CONVERT_TWIPS },
     700         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_TOPBORDER),ATTR_BORDER,        &::getCppuType((const table::BorderLine*)0), 0, TOP_BORDER | CONVERT_TWIPS },
     701         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_TOPBORDER2),ATTR_BORDER,       &::getCppuType((const table::BorderLine2*)0), 0, TOP_BORDER | CONVERT_TWIPS },
     702         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_USERDEF),  ATTR_USERDEF,       &getCppuType((uno::Reference<container::XNameContainer>*)0), 0, 0 },
     703         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_VALIDAT),  SC_WID_UNO_VALIDAT, &getCppuType((uno::Reference<beans::XPropertySet>*)0), 0, 0 },
     704         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_VALILOC),  SC_WID_UNO_VALILOC, &getCppuType((uno::Reference<beans::XPropertySet>*)0), 0, 0 },
     705         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_VALIXML),  SC_WID_UNO_VALIXML, &getCppuType((uno::Reference<beans::XPropertySet>*)0), 0, 0 },
     706         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_CELLVJUS), ATTR_VER_JUSTIFY,   &getCppuType((sal_Int32*)0), 0, 0 },
     707         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_CELLVJUS_METHOD), ATTR_VER_JUSTIFY_METHOD, &::getCppuType((const sal_Int32*)0),   0, 0 },
     708         [ +  - ]:          5 :         {MAP_CHAR_LEN(SC_UNONAME_WRITING),  ATTR_WRITINGDIR,    &getCppuType((sal_Int16*)0),            0, 0 },
     709                 :            :         {0,0,0,0,0,0}
     710 [ +  + ][ +  - ]:         32 :     };
                 [ #  # ]
     711 [ +  + ][ +  - ]:         27 :     static SfxItemPropertySet aRowPropertySet( aRowPropertyMap_Impl );
         [ +  - ][ #  # ]
     712                 :         27 :     return &aRowPropertySet;
     713                 :            : }
     714                 :            : 
     715                 :        997 : const SfxItemPropertySet* lcl_GetSheetPropertySet()
     716                 :            : {
     717                 :            :     static SfxItemPropertyMapEntry aSheetPropertyMap_Impl[] =
     718                 :            :     {
     719         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_ABSNAME),  SC_WID_UNO_ABSNAME, &getCppuType((rtl::OUString*)0),        0 | beans::PropertyAttribute::READONLY, 0 },
     720         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_ASIANVERT),ATTR_VERTICAL_ASIAN,&getBooleanCppuType(),                  0, 0 },
     721         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_AUTOPRINT),SC_WID_UNO_AUTOPRINT,&getBooleanCppuType(),                 0, 0 },
     722         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_BORDCOL),  SC_WID_UNO_BORDCOL, &getCppuType((sal_Int32*)0),            0, 0 },
     723         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_BOTTBORDER),ATTR_BORDER,       &::getCppuType((const table::BorderLine*)0), 0, BOTTOM_BORDER | CONVERT_TWIPS },
     724         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_BOTTBORDER2),ATTR_BORDER,      &::getCppuType((const table::BorderLine2*)0), 0, BOTTOM_BORDER | CONVERT_TWIPS },
     725         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CELLBACK), ATTR_BACKGROUND,    &getCppuType((sal_Int32*)0),            0, MID_BACK_COLOR },
     726         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CELLPRO),  ATTR_PROTECTION,    &getCppuType((util::CellProtection*)0), 0, 0 },
     727         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CELLSTYL), SC_WID_UNO_CELLSTYL,&getCppuType((rtl::OUString*)0),        0, 0 },
     728         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CCOLOR),   ATTR_FONT_COLOR,    &getCppuType((sal_Int32*)0),            0, 0 },
     729         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_COUTL),    ATTR_FONT_CONTOUR,  &getBooleanCppuType(),                  0, 0 },
     730         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CCROSS),   ATTR_FONT_CROSSEDOUT,&getBooleanCppuType(),                 0, MID_CROSSED_OUT },
     731         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CEMPHAS),  ATTR_FONT_EMPHASISMARK,&getCppuType((sal_Int16*)0),         0, MID_EMPHASIS },
     732         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CFONT),    ATTR_FONT,          &getCppuType((sal_Int16*)0),            0, MID_FONT_FAMILY },
     733         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CFCHARS),  ATTR_FONT,          &getCppuType((sal_Int16*)0),            0, MID_FONT_CHAR_SET },
     734         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_CJK_CFCHARS),  ATTR_CJK_FONT,      &getCppuType((sal_Int16*)0),            0, MID_FONT_CHAR_SET },
     735         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_CTL_CFCHARS),  ATTR_CTL_FONT,      &getCppuType((sal_Int16*)0),            0, MID_FONT_CHAR_SET },
     736         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CFFAMIL),  ATTR_FONT,          &getCppuType((sal_Int16*)0),            0, MID_FONT_FAMILY },
     737         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_CJK_CFFAMIL),  ATTR_CJK_FONT,      &getCppuType((sal_Int16*)0),            0, MID_FONT_FAMILY },
     738         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_CTL_CFFAMIL),  ATTR_CTL_FONT,      &getCppuType((sal_Int16*)0),            0, MID_FONT_FAMILY },
     739         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CFNAME),   ATTR_FONT,          &getCppuType((rtl::OUString*)0),        0, MID_FONT_FAMILY_NAME },
     740         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_CJK_CFNAME),   ATTR_CJK_FONT,      &getCppuType((rtl::OUString*)0),        0, MID_FONT_FAMILY_NAME },
     741         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_CTL_CFNAME),   ATTR_CTL_FONT,      &getCppuType((rtl::OUString*)0),        0, MID_FONT_FAMILY_NAME },
     742         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CFPITCH),  ATTR_FONT,          &getCppuType((sal_Int16*)0),            0, MID_FONT_PITCH },
     743         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_CJK_CFPITCH),  ATTR_CJK_FONT,      &getCppuType((sal_Int16*)0),            0, MID_FONT_PITCH },
     744         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_CTL_CFPITCH),  ATTR_CTL_FONT,      &getCppuType((sal_Int16*)0),            0, MID_FONT_PITCH },
     745         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CFSTYLE),  ATTR_FONT,          &getCppuType((rtl::OUString*)0),        0, MID_FONT_STYLE_NAME },
     746         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_CJK_CFSTYLE),  ATTR_CJK_FONT,      &getCppuType((rtl::OUString*)0),        0, MID_FONT_STYLE_NAME },
     747         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_CTL_CFSTYLE),  ATTR_CTL_FONT,      &getCppuType((rtl::OUString*)0),        0, MID_FONT_STYLE_NAME },
     748         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CHEIGHT),  ATTR_FONT_HEIGHT,   &getCppuType((float*)0),                0, MID_FONTHEIGHT | CONVERT_TWIPS },
     749         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_CJK_CHEIGHT),  ATTR_CJK_FONT_HEIGHT,&getCppuType((float*)0),               0, MID_FONTHEIGHT | CONVERT_TWIPS },
     750         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_CTL_CHEIGHT),  ATTR_CTL_FONT_HEIGHT,&getCppuType((float*)0),               0, MID_FONTHEIGHT | CONVERT_TWIPS },
     751         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CLOCAL),   ATTR_FONT_LANGUAGE, &getCppuType((lang::Locale*)0),         0, MID_LANG_LOCALE },
     752         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_CJK_CLOCAL),   ATTR_CJK_FONT_LANGUAGE,&getCppuType((lang::Locale*)0),          0, MID_LANG_LOCALE },
     753         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_CTL_CLOCAL),   ATTR_CTL_FONT_LANGUAGE,&getCppuType((lang::Locale*)0),          0, MID_LANG_LOCALE },
     754         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_COVER),    ATTR_FONT_OVERLINE, &getCppuType((sal_Int16*)0),            0, MID_TL_STYLE },
     755         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_COVRLCOL), ATTR_FONT_OVERLINE, &getCppuType((sal_Int32*)0),            0, MID_TL_COLOR },
     756         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_COVRLHAS), ATTR_FONT_OVERLINE, &getBooleanCppuType(),                  0, MID_TL_HASCOLOR },
     757         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CPOST),    ATTR_FONT_POSTURE,  &getCppuType((awt::FontSlant*)0),       0, MID_POSTURE },
     758         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_CJK_CPOST),    ATTR_CJK_FONT_POSTURE,&getCppuType((awt::FontSlant*)0),     0, MID_POSTURE },
     759         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_CTL_CPOST),    ATTR_CTL_FONT_POSTURE,&getCppuType((awt::FontSlant*)0),     0, MID_POSTURE },
     760         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CRELIEF),  ATTR_FONT_RELIEF,   &getCppuType((sal_Int16*)0),            0, MID_RELIEF },
     761         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CSHADD),   ATTR_FONT_SHADOWED, &getBooleanCppuType(),                  0, 0 },
     762         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CSTRIKE),  ATTR_FONT_CROSSEDOUT,&getCppuType((sal_Int16*)0),           0, MID_CROSS_OUT },
     763         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CUNDER),   ATTR_FONT_UNDERLINE,&getCppuType((sal_Int16*)0),            0, MID_TL_STYLE },
     764         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CUNDLCOL), ATTR_FONT_UNDERLINE,&getCppuType((sal_Int32*)0),            0, MID_TL_COLOR },
     765         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CUNDLHAS), ATTR_FONT_UNDERLINE,&getBooleanCppuType(),                  0, MID_TL_HASCOLOR },
     766         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CWEIGHT),  ATTR_FONT_WEIGHT,   &getCppuType((float*)0),                0, MID_WEIGHT },
     767         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_CJK_CWEIGHT),  ATTR_CJK_FONT_WEIGHT,&getCppuType((float*)0),               0, MID_WEIGHT },
     768         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_CTL_CWEIGHT),  ATTR_CTL_FONT_WEIGHT,&getCppuType((float*)0),               0, MID_WEIGHT },
     769         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CWORDMOD), ATTR_FONT_WORDLINE, &getBooleanCppuType(),                  0, 0 },
     770         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CHCOLHDR), SC_WID_UNO_CHCOLHDR,&getBooleanCppuType(),                  0, 0 },
     771         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CHROWHDR), SC_WID_UNO_CHROWHDR,&getBooleanCppuType(),                  0, 0 },
     772         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CONDFMT),  SC_WID_UNO_CONDFMT, &getCppuType((uno::Reference<sheet::XSheetConditionalEntries>*)0), 0, 0 },
     773         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CONDLOC),  SC_WID_UNO_CONDLOC, &getCppuType((uno::Reference<sheet::XSheetConditionalEntries>*)0), 0, 0 },
     774         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CONDXML),  SC_WID_UNO_CONDXML, &getCppuType((uno::Reference<sheet::XSheetConditionalEntries>*)0), 0, 0 },
     775         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_COPYBACK), SC_WID_UNO_COPYBACK,&getBooleanCppuType(),                  0, 0 },
     776         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_COPYFORM), SC_WID_UNO_COPYFORM,&getBooleanCppuType(),                  0, 0 },
     777         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_COPYSTYL), SC_WID_UNO_COPYSTYL,&getBooleanCppuType(),                  0, 0 },
     778         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_BLTR), ATTR_BORDER_BLTR, &::getCppuType((const table::BorderLine*)0), 0, 0 | CONVERT_TWIPS },
     779         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_BLTR2), ATTR_BORDER_BLTR, &::getCppuType((const table::BorderLine2*)0), 0, 0 | CONVERT_TWIPS },
     780         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_TLBR), ATTR_BORDER_TLBR, &::getCppuType((const table::BorderLine*)0), 0, 0 | CONVERT_TWIPS },
     781         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_TLBR2), ATTR_BORDER_TLBR, &::getCppuType((const table::BorderLine2*)0), 0, 0 | CONVERT_TWIPS },
     782         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CELLHJUS), ATTR_HOR_JUSTIFY,   &getCppuType((table::CellHoriJustify*)0), 0, MID_HORJUST_HORJUST },
     783         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CELLHJUS_METHOD), ATTR_HOR_JUSTIFY_METHOD, &::getCppuType((const sal_Int32*)0),   0, 0 },
     784         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_ISACTIVE), SC_WID_UNO_ISACTIVE,&getBooleanCppuType(),                  0, 0 },
     785         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CELLTRAN), ATTR_BACKGROUND,    &getBooleanCppuType(),                  0, MID_GRAPHIC_TRANSPARENT },
     786         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_WRAP),     ATTR_LINEBREAK,     &getBooleanCppuType(),                  0, 0 },
     787         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CELLVIS),  SC_WID_UNO_CELLVIS, &getBooleanCppuType(),                  0, 0 },
     788         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_LEFTBORDER),ATTR_BORDER,       &::getCppuType((const table::BorderLine*)0), 0, LEFT_BORDER | CONVERT_TWIPS },
     789         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_LEFTBORDER2),ATTR_BORDER,      &::getCppuType((const table::BorderLine2*)0), 0, LEFT_BORDER | CONVERT_TWIPS },
     790         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_LINKDISPBIT),  SC_WID_UNO_LINKDISPBIT,&getCppuType((uno::Reference<awt::XBitmap>*)0), 0 | beans::PropertyAttribute::READONLY, 0 },
     791         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_LINKDISPNAME), SC_WID_UNO_LINKDISPNAME,&getCppuType((rtl::OUString*)0),    0 | beans::PropertyAttribute::READONLY, 0 },
     792         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_NUMFMT),   ATTR_VALUE_FORMAT,  &getCppuType((sal_Int32*)0),            0, 0 },
     793         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_NUMRULES), SC_WID_UNO_NUMRULES,&getCppuType((const uno::Reference<container::XIndexReplace>*)0), 0, 0 },
     794         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CELLORI),  ATTR_STACKED,       &getCppuType((table::CellOrientation*)0), 0, 0 },
     795         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_PAGESTL),  SC_WID_UNO_PAGESTL, &getCppuType((rtl::OUString*)0),        0, 0 },
     796         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_PADJUST),  ATTR_HOR_JUSTIFY,   &::getCppuType((const sal_Int16*)0),    0, MID_HORJUST_ADJUST },
     797         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_PBMARGIN), ATTR_MARGIN,        &getCppuType((sal_Int32*)0),            0, MID_MARGIN_LO_MARGIN | CONVERT_TWIPS },
     798         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_PINDENT),  ATTR_INDENT,        &getCppuType((sal_Int16*)0),            0, 0 }, //! CONVERT_TWIPS
     799         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_PISCHDIST),ATTR_SCRIPTSPACE,   &getBooleanCppuType(),                  0, 0 },
     800         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_PISFORBID),ATTR_FORBIDDEN_RULES,&getBooleanCppuType(),                 0, 0 },
     801         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_PISHANG),  ATTR_HANGPUNCTUATION,&getBooleanCppuType(),                 0, 0 },
     802         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_PISHYPHEN),ATTR_HYPHENATE,     &getBooleanCppuType(),                  0, 0 },
     803         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_PLASTADJ), ATTR_HOR_JUSTIFY,   &::getCppuType((const sal_Int16*)0),    0, MID_HORJUST_ADJUST },
     804         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_PLMARGIN), ATTR_MARGIN,        &getCppuType((sal_Int32*)0),            0, MID_MARGIN_L_MARGIN  | CONVERT_TWIPS },
     805         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_PRMARGIN), ATTR_MARGIN,        &getCppuType((sal_Int32*)0),            0, MID_MARGIN_R_MARGIN  | CONVERT_TWIPS },
     806         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_PTMARGIN), ATTR_MARGIN,        &getCppuType((sal_Int32*)0),            0, MID_MARGIN_UP_MARGIN | CONVERT_TWIPS },
     807         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_POS),      SC_WID_UNO_POS,     &getCppuType((awt::Point*)0),           0 | beans::PropertyAttribute::READONLY, 0 },
     808         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_PRINTBORD),SC_WID_UNO_PRINTBORD,&getBooleanCppuType(),                 0, 0 },
     809         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_PROTECT),  SC_WID_UNO_PROTECT, &getBooleanCppuType(),                  0, 0 },
     810         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_RIGHTBORDER),ATTR_BORDER,      &::getCppuType((const table::BorderLine*)0), 0, RIGHT_BORDER | CONVERT_TWIPS },
     811         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_RIGHTBORDER2),ATTR_BORDER,     &::getCppuType((const table::BorderLine2*)0), 0, RIGHT_BORDER | CONVERT_TWIPS },
     812         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_ROTANG),   ATTR_ROTATE_VALUE,  &getCppuType((sal_Int32*)0),            0, 0 },
     813         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_ROTREF),   ATTR_ROTATE_MODE,   &getCppuType((sal_Int32*)0), 0, 0 },
     814         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_SHADOW),   ATTR_SHADOW,        &getCppuType((table::ShadowFormat*)0),  0, 0 | CONVERT_TWIPS },
     815         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_SHOWBORD), SC_WID_UNO_SHOWBORD,&getBooleanCppuType(),                  0, 0 },
     816         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_SHRINK_TO_FIT), ATTR_SHRINKTOFIT, &getBooleanCppuType(),               0, 0 },
     817         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_SIZE),     SC_WID_UNO_SIZE,    &getCppuType((awt::Size*)0),            0 | beans::PropertyAttribute::READONLY, 0 },
     818         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_TBLBORD),  SC_WID_UNO_TBLBORD, &getCppuType((table::TableBorder*)0),   0, 0 | CONVERT_TWIPS },
     819         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_TBLBORD2),  SC_WID_UNO_TBLBORD2, &getCppuType((table::TableBorder2*)0),   0, 0 | CONVERT_TWIPS },
     820         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_TABLAYOUT),SC_WID_UNO_TABLAYOUT,&getCppuType((sal_Int16*)0),           0, 0 },
     821         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_TOPBORDER),ATTR_BORDER,        &::getCppuType((const table::BorderLine*)0), 0, TOP_BORDER | CONVERT_TWIPS },
     822         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_TOPBORDER2),ATTR_BORDER,       &::getCppuType((const table::BorderLine2*)0), 0, TOP_BORDER | CONVERT_TWIPS },
     823         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_USERDEF),  ATTR_USERDEF,       &getCppuType((uno::Reference<container::XNameContainer>*)0), 0, 0 },
     824         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_VALIDAT),  SC_WID_UNO_VALIDAT, &getCppuType((uno::Reference<beans::XPropertySet>*)0), 0, 0 },
     825         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_VALILOC),  SC_WID_UNO_VALILOC, &getCppuType((uno::Reference<beans::XPropertySet>*)0), 0, 0 },
     826         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_VALIXML),  SC_WID_UNO_VALIXML, &getCppuType((uno::Reference<beans::XPropertySet>*)0), 0, 0 },
     827         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CELLVJUS), ATTR_VER_JUSTIFY,   &getCppuType((sal_Int32*)0), 0, 0 },
     828         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_CELLVJUS_METHOD), ATTR_VER_JUSTIFY_METHOD, &::getCppuType((const sal_Int32*)0),   0, 0 },
     829         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_WRITING),  ATTR_WRITINGDIR,    &getCppuType((sal_Int16*)0),            0, 0 },
     830         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNONAME_TABCOLOR), SC_WID_UNO_TABCOLOR, &getCppuType((sal_Int32*)0), 0, 0 },
     831         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_CODENAME),        SC_WID_UNO_CODENAME, &getCppuType(static_cast< const rtl::OUString * >(0)),    0, 0},
     832         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_NAMEDRANGES), SC_WID_UNO_NAMES, &getCppuType((uno::Reference<sheet::XNamedRanges>*)0), 0, 0 },
     833                 :            :         {0,0,0,0,0,0}
     834 [ +  + ][ +  - ]:       1039 :     };
                 [ #  # ]
     835 [ +  + ][ +  - ]:        997 :     static SfxItemPropertySet aSheetPropertySet( aSheetPropertyMap_Impl );
         [ +  - ][ #  # ]
     836                 :        997 :     return &aSheetPropertySet;
     837                 :            : }
     838                 :            : 
     839                 :          6 : const SfxItemPropertyMapEntry* lcl_GetEditPropertyMap()
     840                 :            : {
     841                 :            :     static SfxItemPropertyMapEntry aEditPropertyMap_Impl[] =
     842                 :            :     {
     843 [ +  - ][ +  - ]:          6 :         SVX_UNOEDIT_CHAR_PROPERTIES,
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     844         [ +  - ]:          6 :         SVX_UNOEDIT_FONT_PROPERTIES,
     845 [ +  - ][ +  - ]:          6 :         SVX_UNOEDIT_PARA_PROPERTIES,
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     846 [ +  - ][ +  - ]:          6 :         SVX_UNOEDIT_NUMBERING_PROPERTIE,    // for completeness of service ParagraphProperties
     847         [ +  - ]:          6 :         {MAP_CHAR_LEN(SC_UNONAME_TEXTUSER), EE_CHAR_XMLATTRIBS, &getCppuType((const uno::Reference< container::XNameContainer >*)0), 0, 0},
     848         [ +  - ]:          6 :         {MAP_CHAR_LEN(SC_UNONAME_USERDEF),  EE_PARA_XMLATTRIBS, &getCppuType((const uno::Reference< container::XNameContainer >*)0), 0, 0},
     849                 :            :         {0,0,0,0,0,0}
     850 [ +  - ][ +  - ]:         12 :     };
                 [ #  # ]
     851                 :          6 :     return aEditPropertyMap_Impl;
     852                 :            : }
     853                 :         18 : const SvxItemPropertySet* lcl_GetEditPropertySet()
     854                 :            : {
     855 [ +  + ][ +  - ]:         18 :     static SvxItemPropertySet aEditPropertySet( lcl_GetEditPropertyMap(), SdrObject::GetGlobalDrawObjectItemPool() );
         [ +  - ][ +  - ]
         [ +  - ][ #  # ]
     856                 :         18 :     return &aEditPropertySet;
     857                 :            : }
     858                 :            : 
     859                 :            : //------------------------------------------------------------------------
     860                 :            : 
     861                 :            : using sc::HMMToTwips;
     862                 :            : using sc::TwipsToHMM;
     863                 :            : 
     864                 :            : //------------------------------------------------------------------------
     865                 :            : 
     866                 :            : #define SCCHARPROPERTIES_SERVICE    "com.sun.star.style.CharacterProperties"
     867                 :            : #define SCPARAPROPERTIES_SERVICE    "com.sun.star.style.ParagraphProperties"
     868                 :            : #define SCCELLPROPERTIES_SERVICE    "com.sun.star.table.CellProperties"
     869                 :            : #define SCCELLRANGE_SERVICE         "com.sun.star.table.CellRange"
     870                 :            : #define SCCELL_SERVICE              "com.sun.star.table.Cell"
     871                 :            : #define SCSHEETCELLRANGES_SERVICE   "com.sun.star.sheet.SheetCellRanges"
     872                 :            : #define SCSHEETCELLRANGE_SERVICE    "com.sun.star.sheet.SheetCellRange"
     873                 :            : #define SCSPREADSHEET_SERVICE       "com.sun.star.sheet.Spreadsheet"
     874                 :            : #define SCSHEETCELL_SERVICE         "com.sun.star.sheet.SheetCell"
     875                 :            : 
     876         [ #  # ]:          0 : SC_SIMPLE_SERVICE_INFO( ScCellFormatsEnumeration, "ScCellFormatsEnumeration", "com.sun.star.sheet.CellFormatRangesEnumeration" )
     877         [ #  # ]:          0 : SC_SIMPLE_SERVICE_INFO( ScCellFormatsObj, "ScCellFormatsObj", "com.sun.star.sheet.CellFormatRanges" )
     878         [ #  # ]:          1 : SC_SIMPLE_SERVICE_INFO( ScUniqueCellFormatsEnumeration, "ScUniqueCellFormatsEnumeration", "com.sun.star.sheet.UniqueCellFormatRangesEnumeration" )
     879         [ #  # ]:          1 : SC_SIMPLE_SERVICE_INFO( ScUniqueCellFormatsObj, "ScUniqueCellFormatsObj", "com.sun.star.sheet.UniqueCellFormatRanges" )
     880         [ #  # ]:          0 : SC_SIMPLE_SERVICE_INFO( ScCellRangesBase, "ScCellRangesBase", "stardiv.unknown" )
     881         [ #  # ]:          0 : SC_SIMPLE_SERVICE_INFO( ScCellsEnumeration, "ScCellsEnumeration", "com.sun.star.sheet.CellsEnumeration" )
     882         [ #  # ]:          0 : SC_SIMPLE_SERVICE_INFO( ScCellsObj, "ScCellsObj", "com.sun.star.sheet.Cells" )
     883         [ #  # ]:          0 : SC_SIMPLE_SERVICE_INFO( ScTableColumnObj, "ScTableColumnObj", "com.sun.star.table.TableColumn" )
     884         [ #  # ]:          0 : SC_SIMPLE_SERVICE_INFO( ScTableRowObj, "ScTableRowObj", "com.sun.star.table.TableRow" )
     885                 :            : 
     886                 :            : //------------------------------------------------------------------------
     887                 :            : 
     888                 :            : //! ScLinkListener in anderes File verschieben !!!
     889                 :            : 
     890                 :       4773 : ScLinkListener::~ScLinkListener()
     891                 :            : {
     892         [ -  + ]:       9546 : }
     893                 :            : 
     894                 :        190 : void ScLinkListener::Notify( SvtBroadcaster&, const SfxHint& rHint )
     895                 :            : {
     896                 :        190 :     aLink.Call( (SfxHint*)&rHint );
     897                 :        190 : }
     898                 :            : 
     899                 :            : //------------------------------------------------------------------------
     900                 :            : 
     901                 :          2 : void lcl_CopyProperties( beans::XPropertySet& rDest, beans::XPropertySet& rSource )
     902                 :            : {
     903         [ +  - ]:          2 :     uno::Reference<beans::XPropertySetInfo> xInfo(rSource.getPropertySetInfo());
     904         [ +  - ]:          2 :     if (xInfo.is())
     905                 :            :     {
     906 [ +  - ][ +  - ]:          2 :         uno::Sequence<beans::Property> aSeq(xInfo->getProperties());
     907                 :          2 :         const beans::Property* pAry = aSeq.getConstArray();
     908                 :          2 :         sal_uLong nCount = aSeq.getLength();
     909         [ +  + ]:         20 :         for (sal_uLong i=0; i<nCount; i++)
     910                 :            :         {
     911                 :         18 :             rtl::OUString aName(pAry[i].Name);
     912 [ +  - ][ +  - ]:         18 :             rDest.setPropertyValue( aName, rSource.getPropertyValue( aName ) );
     913         [ +  - ]:         20 :         }
     914                 :          2 :     }
     915                 :          2 : }
     916                 :            : 
     917                 :         62 : SCTAB lcl_FirstTab( const ScRangeList& rRanges )
     918                 :            : {
     919                 :            :     OSL_ENSURE(rRanges.size() >= 1, "was fuer Ranges ?!?!");
     920                 :         62 :     const ScRange* pFirst = rRanges[ 0 ];
     921         [ +  - ]:         62 :     if (pFirst)
     922                 :         62 :         return pFirst->aStart.Tab();
     923                 :            : 
     924                 :         62 :     return 0;   // soll nicht sein
     925                 :            : }
     926                 :            : 
     927                 :         64 : sal_Bool lcl_WholeSheet( const ScRangeList& rRanges )
     928                 :            : {
     929         [ +  + ]:         64 :     if ( rRanges.size() == 1 )
     930                 :            :     {
     931                 :         57 :         const ScRange* pRange = rRanges[0];
     932 [ +  + ][ +  +  :        105 :         if ( pRange && pRange->aStart.Col() == 0 && pRange->aEnd.Col() == MAXCOL &&
             +  -  +  - ]
         [ +  + ][ +  - ]
     933                 :         48 :                        pRange->aStart.Row() == 0 && pRange->aEnd.Row() == MAXROW )
     934                 :         24 :             return sal_True;
     935                 :            :     }
     936                 :         64 :     return false;
     937                 :            : }
     938                 :            : 
     939                 :            : //------------------------------------------------------------------------
     940                 :            : 
     941                 :         10 : ScSubTotalFunc lcl_SummaryToSubTotal( sheet::GeneralFunction eSummary )
     942                 :            : {
     943                 :            :     ScSubTotalFunc eSubTotal;
     944   [ +  +  -  -  :         10 :     switch (eSummary)
          -  -  -  -  -  
                -  -  - ]
     945                 :            :     {
     946                 :            :         case sheet::GeneralFunction_SUM:
     947                 :          3 :             eSubTotal = SUBTOTAL_FUNC_SUM;
     948                 :          3 :             break;
     949                 :            :         case sheet::GeneralFunction_COUNT:
     950                 :          7 :             eSubTotal = SUBTOTAL_FUNC_CNT2;
     951                 :          7 :             break;
     952                 :            :         case sheet::GeneralFunction_AVERAGE:
     953                 :          0 :             eSubTotal = SUBTOTAL_FUNC_AVE;
     954                 :          0 :             break;
     955                 :            :         case sheet::GeneralFunction_MAX:
     956                 :          0 :             eSubTotal = SUBTOTAL_FUNC_MAX;
     957                 :          0 :             break;
     958                 :            :         case sheet::GeneralFunction_MIN:
     959                 :          0 :             eSubTotal = SUBTOTAL_FUNC_MIN;
     960                 :          0 :             break;
     961                 :            :         case sheet::GeneralFunction_PRODUCT:
     962                 :          0 :             eSubTotal = SUBTOTAL_FUNC_PROD;
     963                 :          0 :             break;
     964                 :            :         case sheet::GeneralFunction_COUNTNUMS:
     965                 :          0 :             eSubTotal = SUBTOTAL_FUNC_CNT;
     966                 :          0 :             break;
     967                 :            :         case sheet::GeneralFunction_STDEV:
     968                 :          0 :             eSubTotal = SUBTOTAL_FUNC_STD;
     969                 :          0 :             break;
     970                 :            :         case sheet::GeneralFunction_STDEVP:
     971                 :          0 :             eSubTotal = SUBTOTAL_FUNC_STDP;
     972                 :          0 :             break;
     973                 :            :         case sheet::GeneralFunction_VAR:
     974                 :          0 :             eSubTotal = SUBTOTAL_FUNC_VAR;
     975                 :          0 :             break;
     976                 :            :         case sheet::GeneralFunction_VARP:
     977                 :          0 :             eSubTotal = SUBTOTAL_FUNC_VARP;
     978                 :          0 :             break;
     979                 :            : 
     980                 :            :         case sheet::GeneralFunction_NONE:
     981                 :            :         case sheet::GeneralFunction_AUTO:
     982                 :            :         default:
     983                 :          0 :             eSubTotal = SUBTOTAL_FUNC_NONE;
     984                 :          0 :             break;
     985                 :            :     }
     986                 :         10 :     return eSubTotal;
     987                 :            : }
     988                 :            : 
     989                 :            : //------------------------------------------------------------------------
     990                 :            : 
     991                 :            : namespace {
     992                 :            : template<typename BorderLineType>
     993                 :         54 : const ::editeng::SvxBorderLine* lcl_getBorderLine(
     994                 :            :         ::editeng::SvxBorderLine& rLine, const BorderLineType& rStruct )
     995                 :            : {
     996                 :            :     // Convert from 1/100mm to Twips.
     997 [ #  # ][ +  - ]:         54 :     if (!SvxBoxItem::LineToSvxLine( rStruct, rLine, true))
     998                 :         54 :         return NULL;
     999                 :            : 
    1000 [ #  # ][ #  # ]:          0 :     if ( rLine.GetOutWidth() || rLine.GetInWidth() || rLine.GetDistance() )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    1001                 :          0 :         return &rLine;
    1002                 :            :     else
    1003                 :         54 :         return NULL;
    1004                 :            : }
    1005                 :            : }
    1006                 :            : 
    1007                 :         54 : const ::editeng::SvxBorderLine* ScHelperFunctions::GetBorderLine(
    1008                 :            :         ::editeng::SvxBorderLine& rLine, const table::BorderLine& rStruct )
    1009                 :            : {
    1010                 :         54 :     return lcl_getBorderLine( rLine, rStruct);
    1011                 :            : }
    1012                 :            : 
    1013                 :          0 : const ::editeng::SvxBorderLine* ScHelperFunctions::GetBorderLine(
    1014                 :            :         ::editeng::SvxBorderLine& rLine, const table::BorderLine2& rStruct )
    1015                 :            : {
    1016                 :          0 :     return lcl_getBorderLine( rLine, rStruct);
    1017                 :            : }
    1018                 :            : 
    1019                 :            : 
    1020                 :            : namespace {
    1021                 :            : template<typename TableBorderType>
    1022                 :          9 : void lcl_fillBoxItems( SvxBoxItem& rOuter, SvxBoxInfoItem& rInner, const TableBorderType& rBorder )
    1023                 :            : {
    1024 [ #  # ][ +  - ]:          9 :     ::editeng::SvxBorderLine aLine;
    1025                 :          9 :     rOuter.SetDistance( (sal_uInt16)HMMToTwips( rBorder.Distance ) );
    1026   [ #  #  +  - ]:          9 :     rOuter.SetLine( ScHelperFunctions::GetBorderLine( aLine, rBorder.TopLine ),         BOX_LINE_TOP );
         [ +  - ][ #  # ]
    1027 [ #  # ][ #  # ]:          9 :     rOuter.SetLine( ScHelperFunctions::GetBorderLine( aLine, rBorder.BottomLine ),      BOX_LINE_BOTTOM );
         [ +  - ][ +  - ]
    1028 [ #  # ][ #  # ]:          9 :     rOuter.SetLine( ScHelperFunctions::GetBorderLine( aLine, rBorder.LeftLine ),        BOX_LINE_LEFT );
         [ +  - ][ +  - ]
    1029 [ #  # ][ #  # ]:          9 :     rOuter.SetLine( ScHelperFunctions::GetBorderLine( aLine, rBorder.RightLine ),       BOX_LINE_RIGHT );
         [ +  - ][ +  - ]
    1030 [ #  # ][ #  # ]:          9 :     rInner.SetLine( ScHelperFunctions::GetBorderLine( aLine, rBorder.HorizontalLine ),  BOXINFO_LINE_HORI );
         [ +  - ][ +  - ]
    1031 [ #  # ][ #  # ]:          9 :     rInner.SetLine( ScHelperFunctions::GetBorderLine( aLine, rBorder.VerticalLine ),    BOXINFO_LINE_VERT );
         [ +  - ][ +  - ]
    1032                 :          9 :     rInner.SetValid( VALID_TOP,      rBorder.IsTopLineValid );
    1033                 :          9 :     rInner.SetValid( VALID_BOTTOM,   rBorder.IsBottomLineValid );
    1034                 :          9 :     rInner.SetValid( VALID_LEFT,     rBorder.IsLeftLineValid );
    1035                 :          9 :     rInner.SetValid( VALID_RIGHT,    rBorder.IsRightLineValid );
    1036                 :          9 :     rInner.SetValid( VALID_HORI,     rBorder.IsHorizontalLineValid );
    1037                 :          9 :     rInner.SetValid( VALID_VERT,     rBorder.IsVerticalLineValid );
    1038                 :          9 :     rInner.SetValid( VALID_DISTANCE, rBorder.IsDistanceValid );
    1039                 :          9 :     rInner.SetTable( sal_True );
    1040                 :          9 : }
    1041                 :            : }
    1042                 :            : 
    1043                 :          9 : void ScHelperFunctions::FillBoxItems( SvxBoxItem& rOuter, SvxBoxInfoItem& rInner, const table::TableBorder& rBorder )
    1044                 :            : {
    1045                 :          9 :     lcl_fillBoxItems( rOuter, rInner, rBorder);
    1046                 :          9 : }
    1047                 :            : 
    1048                 :          0 : void ScHelperFunctions::FillBoxItems( SvxBoxItem& rOuter, SvxBoxInfoItem& rInner, const table::TableBorder2& rBorder )
    1049                 :            : {
    1050                 :          0 :     lcl_fillBoxItems( rOuter, rInner, rBorder);
    1051                 :          0 : }
    1052                 :            : 
    1053                 :            : 
    1054                 :        204 : void ScHelperFunctions::FillBorderLine( table::BorderLine& rStruct, const ::editeng::SvxBorderLine* pLine )
    1055                 :            : {
    1056                 :            :     // Convert from Twips to 1/100mm.
    1057         [ +  - ]:        204 :     table::BorderLine2 aStruct( SvxBoxItem::SvxLineToLine( pLine, true));
    1058                 :        204 :     rStruct = aStruct;
    1059                 :        204 : }
    1060                 :            : 
    1061                 :        132 : void ScHelperFunctions::FillBorderLine( table::BorderLine2& rStruct, const ::editeng::SvxBorderLine* pLine )
    1062                 :            : {
    1063                 :        132 :     rStruct = SvxBoxItem::SvxLineToLine( pLine, true);
    1064                 :        132 : }
    1065                 :            : 
    1066                 :            : 
    1067                 :            : namespace {
    1068                 :            : template<typename TableBorderItem>
    1069                 :         56 : void lcl_fillTableBorder( TableBorderItem& rBorder, const SvxBoxItem& rOuter, const SvxBoxInfoItem& rInner,
    1070                 :            :         bool bInvalidateHorVerDist )
    1071                 :            : {
    1072                 :         56 :     ScHelperFunctions::FillBorderLine( rBorder.TopLine,         rOuter.GetTop() );
    1073                 :         56 :     ScHelperFunctions::FillBorderLine( rBorder.BottomLine,      rOuter.GetBottom() );
    1074                 :         56 :     ScHelperFunctions::FillBorderLine( rBorder.LeftLine,        rOuter.GetLeft() );
    1075                 :         56 :     ScHelperFunctions::FillBorderLine( rBorder.RightLine,       rOuter.GetRight() );
    1076                 :         56 :     ScHelperFunctions::FillBorderLine( rBorder.HorizontalLine,  rInner.GetHori() );
    1077                 :         56 :     ScHelperFunctions::FillBorderLine( rBorder.VerticalLine,    rInner.GetVert() );
    1078                 :            : 
    1079                 :         56 :     rBorder.Distance                = rOuter.GetDistance();
    1080                 :         56 :     rBorder.IsTopLineValid          = rInner.IsValid(VALID_TOP);
    1081                 :         56 :     rBorder.IsBottomLineValid       = rInner.IsValid(VALID_BOTTOM);
    1082                 :         56 :     rBorder.IsLeftLineValid         = rInner.IsValid(VALID_LEFT);
    1083                 :         56 :     rBorder.IsRightLineValid        = rInner.IsValid(VALID_RIGHT);
    1084 [ +  - ][ +  - ]:         56 :     rBorder.IsHorizontalLineValid   = !bInvalidateHorVerDist && rInner.IsValid(VALID_HORI);
         [ +  - ][ +  - ]
    1085 [ +  - ][ +  - ]:         56 :     rBorder.IsVerticalLineValid     = !bInvalidateHorVerDist && rInner.IsValid(VALID_VERT);
         [ +  - ][ +  - ]
    1086 [ +  - ][ +  - ]:         56 :     rBorder.IsDistanceValid         = !bInvalidateHorVerDist && rInner.IsValid(VALID_DISTANCE);
         [ +  - ][ +  - ]
    1087                 :         56 : }
    1088                 :            : }
    1089                 :            : 
    1090                 :         34 : void ScHelperFunctions::AssignTableBorderToAny( uno::Any& rAny,
    1091                 :            :         const SvxBoxItem& rOuter, const SvxBoxInfoItem& rInner, bool bInvalidateHorVerDist )
    1092                 :            : {
    1093                 :         34 :     table::TableBorder aBorder;
    1094         [ +  - ]:         34 :     lcl_fillTableBorder( aBorder, rOuter, rInner, bInvalidateHorVerDist);
    1095         [ +  - ]:         34 :     rAny <<= aBorder;
    1096                 :         34 : }
    1097                 :            : 
    1098                 :         22 : void ScHelperFunctions::AssignTableBorder2ToAny( uno::Any& rAny,
    1099                 :            :         const SvxBoxItem& rOuter, const SvxBoxInfoItem& rInner, bool bInvalidateHorVerDist )
    1100                 :            : {
    1101                 :         22 :     table::TableBorder2 aBorder;
    1102         [ +  - ]:         22 :     lcl_fillTableBorder( aBorder, rOuter, rInner, bInvalidateHorVerDist);
    1103         [ +  - ]:         22 :     rAny <<= aBorder;
    1104                 :         22 : }
    1105                 :            : 
    1106                 :            : //------------------------------------------------------------------------
    1107                 :            : 
    1108                 :            : //! lcl_ApplyBorder nach docfunc verschieben!
    1109                 :            : 
    1110                 :          7 : void ScHelperFunctions::ApplyBorder( ScDocShell* pDocShell, const ScRangeList& rRanges,
    1111                 :            :                         const SvxBoxItem& rOuter, const SvxBoxInfoItem& rInner )
    1112                 :            : {
    1113                 :          7 :     ScDocument* pDoc = pDocShell->GetDocument();
    1114                 :          7 :     sal_Bool bUndo(pDoc->IsUndoEnabled());
    1115                 :          7 :     ScDocument* pUndoDoc = NULL;
    1116         [ +  - ]:          7 :     if (bUndo)
    1117         [ +  - ]:          7 :         pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
    1118                 :          7 :     size_t nCount = rRanges.size();
    1119         [ +  + ]:         14 :     for (size_t i = 0; i < nCount; ++i)
    1120                 :            :     {
    1121         [ +  - ]:          7 :         ScRange aRange( *rRanges[ i ] );
    1122                 :          7 :         SCTAB nTab = aRange.aStart.Tab();
    1123                 :            : 
    1124         [ +  - ]:          7 :         if (bUndo)
    1125                 :            :         {
    1126         [ +  - ]:          7 :             if ( i==0 )
    1127         [ +  - ]:          7 :                 pUndoDoc->InitUndo( pDoc, nTab, nTab );
    1128                 :            :             else
    1129         [ #  # ]:          0 :                 pUndoDoc->AddUndoTab( nTab, nTab );
    1130         [ +  - ]:          7 :             pDoc->CopyToDocument( aRange, IDF_ATTRIB, false, pUndoDoc );
    1131                 :            :         }
    1132                 :            : 
    1133         [ +  - ]:          7 :         ScMarkData aMark;
    1134         [ +  - ]:          7 :         aMark.SetMarkArea( aRange );
    1135         [ +  - ]:          7 :         aMark.SelectTable( nTab, sal_True );
    1136                 :            : 
    1137         [ +  - ]:          7 :         pDoc->ApplySelectionFrame( aMark, &rOuter, &rInner );
    1138                 :            :         // RowHeight bei Umrandung alleine nicht noetig
    1139         [ +  - ]:          7 :     }
    1140                 :            : 
    1141         [ +  - ]:          7 :     if (bUndo)
    1142                 :            :     {
    1143                 :          7 :         pDocShell->GetUndoManager()->AddUndoAction(
    1144         [ +  - ]:          7 :                 new ScUndoBorder( pDocShell, rRanges, pUndoDoc, rOuter, rInner ) );
    1145                 :            :     }
    1146                 :            : 
    1147         [ +  + ]:         14 :     for (size_t i = 0; i < nCount; ++i )
    1148         [ +  - ]:          7 :         pDocShell->PostPaint( *rRanges[ i ], PAINT_GRID, SC_PF_LINES | SC_PF_TESTMERGE );
    1149                 :            : 
    1150                 :          7 :     pDocShell->SetDocumentModified();
    1151                 :          7 : }
    1152                 :            : 
    1153                 :            : //! move lcl_PutDataArray to docfunc?
    1154                 :            : //! merge loop with ScFunctionAccess::callFunction
    1155                 :            : 
    1156                 :         12 : sal_Bool lcl_PutDataArray( ScDocShell& rDocShell, const ScRange& rRange,
    1157                 :            :                         const uno::Sequence< uno::Sequence<uno::Any> >& aData )
    1158                 :            : {
    1159                 :         12 :     ScDocument* pDoc = rDocShell.GetDocument();
    1160                 :         12 :     SCTAB nTab = rRange.aStart.Tab();
    1161                 :         12 :     SCCOL nStartCol = rRange.aStart.Col();
    1162                 :         12 :     SCROW nStartRow = rRange.aStart.Row();
    1163                 :         12 :     SCCOL nEndCol = rRange.aEnd.Col();
    1164                 :         12 :     SCROW nEndRow = rRange.aEnd.Row();
    1165                 :         12 :     sal_Bool bUndo(pDoc->IsUndoEnabled());
    1166                 :            : 
    1167         [ -  + ]:         12 :     if ( !pDoc->IsBlockEditable( nTab, nStartCol,nStartRow, nEndCol,nEndRow ) )
    1168                 :            :     {
    1169                 :            :         //! error message
    1170                 :          0 :         return false;
    1171                 :            :     }
    1172                 :            : 
    1173                 :         12 :     long nCols = 0;
    1174                 :         12 :     long nRows = aData.getLength();
    1175                 :         12 :     const uno::Sequence<uno::Any>* pArray = aData.getConstArray();
    1176         [ +  - ]:         12 :     if ( nRows )
    1177                 :         12 :         nCols = pArray[0].getLength();
    1178                 :            : 
    1179 [ +  - ][ -  + ]:         12 :     if ( nCols != nEndCol-nStartCol+1 || nRows != nEndRow-nStartRow+1 )
    1180                 :            :     {
    1181                 :            :         //! error message?
    1182                 :          0 :         return false;
    1183                 :            :     }
    1184                 :            : 
    1185                 :         12 :     ScDocument* pUndoDoc = NULL;
    1186         [ +  - ]:         12 :     if ( bUndo )
    1187                 :            :     {
    1188         [ +  - ]:         12 :         pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
    1189                 :         12 :         pUndoDoc->InitUndo( pDoc, nTab, nTab );
    1190                 :         12 :         pDoc->CopyToDocument( rRange, IDF_CONTENTS|IDF_NOCAPTIONS, false, pUndoDoc );
    1191                 :            :     }
    1192                 :            : 
    1193                 :         12 :     pDoc->DeleteAreaTab( nStartCol, nStartRow, nEndCol, nEndRow, nTab, IDF_CONTENTS );
    1194                 :            : 
    1195                 :            :     /*  #164410# Use double allocation, which will speed up import filters
    1196                 :            :         using XCellRangeData::setDataArray() significantly. */
    1197                 :         12 :     bool bDoubleAlloc = ScColumn::bDoubleAlloc;
    1198                 :         12 :     ScColumn::bDoubleAlloc = true;
    1199                 :            : 
    1200                 :         12 :     sal_Bool bError = false;
    1201                 :         12 :     SCROW nDocRow = nStartRow;
    1202         [ +  + ]:        436 :     for (long nRow=0; nRow<nRows; nRow++)
    1203                 :            :     {
    1204                 :        424 :         const uno::Sequence<uno::Any>& rColSeq = pArray[nRow];
    1205         [ +  - ]:        424 :         if ( rColSeq.getLength() == nCols )
    1206                 :            :         {
    1207                 :        424 :             SCCOL nDocCol = nStartCol;
    1208                 :        424 :             const uno::Any* pColArr = rColSeq.getConstArray();
    1209         [ +  + ]:      20520 :             for (long nCol=0; nCol<nCols; nCol++)
    1210                 :            :             {
    1211                 :      20096 :                 const uno::Any& rElement = pColArr[nCol];
    1212                 :      20096 :                 uno::TypeClass eElemClass = rElement.getValueTypeClass();
    1213         [ -  + ]:      20096 :                 if ( eElemClass == uno::TypeClass_VOID )
    1214                 :            :                 {
    1215                 :            :                     // void = "no value"
    1216                 :          0 :                     pDoc->SetError( nDocCol, nDocRow, nTab, NOTAVAILABLE );
    1217                 :            :                 }
    1218 [ +  - ][ +  - ]:      20096 :                 else if ( eElemClass == uno::TypeClass_BYTE ||
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  + ]
    1219                 :            :                             eElemClass == uno::TypeClass_SHORT ||
    1220                 :            :                             eElemClass == uno::TypeClass_UNSIGNED_SHORT ||
    1221                 :            :                             eElemClass == uno::TypeClass_LONG ||
    1222                 :            :                             eElemClass == uno::TypeClass_UNSIGNED_LONG ||
    1223                 :            :                             eElemClass == uno::TypeClass_FLOAT ||
    1224                 :            :                             eElemClass == uno::TypeClass_DOUBLE )
    1225                 :            :                 {
    1226                 :            :                     //  accept integer types because Basic passes a floating point
    1227                 :            :                     //  variable as byte, short or long if it's an integer number.
    1228                 :      20064 :                     double fVal(0.0);
    1229                 :      20064 :                     rElement >>= fVal;
    1230         [ +  - ]:      20064 :                     pDoc->SetValue( nDocCol, nDocRow, nTab, fVal );
    1231                 :            :                 }
    1232         [ +  - ]:         32 :                 else if ( eElemClass == uno::TypeClass_STRING )
    1233                 :            :                 {
    1234                 :         32 :                     rtl::OUString aUStr;
    1235                 :         32 :                     rElement >>= aUStr;
    1236         [ +  + ]:         32 :                     if ( !aUStr.isEmpty() )
    1237 [ +  - ][ +  - ]:         32 :                         pDoc->PutCell( nDocCol, nDocRow, nTab, new ScStringCell( aUStr ) );
                 [ +  - ]
    1238                 :            :                 }
    1239                 :            :                 else
    1240                 :          0 :                     bError = sal_True;      // invalid type
    1241                 :            : 
    1242                 :      20096 :                 ++nDocCol;
    1243                 :            :             }
    1244                 :            :         }
    1245                 :            :         else
    1246                 :          0 :             bError = sal_True;                          // wrong size
    1247                 :            : 
    1248                 :        424 :         ++nDocRow;
    1249                 :            :     }
    1250                 :         12 :     ScColumn::bDoubleAlloc = bDoubleAlloc;
    1251                 :            : 
    1252                 :         12 :     sal_Bool bHeight = rDocShell.AdjustRowHeight( nStartRow, nEndRow, nTab );
    1253                 :            : 
    1254         [ +  - ]:         12 :     if ( pUndoDoc )
    1255                 :            :     {
    1256         [ +  - ]:         12 :         ScMarkData aDestMark;
    1257         [ +  - ]:         12 :         aDestMark.SelectOneTable( nTab );
    1258         [ +  - ]:         12 :         rDocShell.GetUndoManager()->AddUndoAction(
    1259                 :            :             new ScUndoPaste(
    1260                 :            :                 &rDocShell, ScRange(nStartCol, nStartRow, nTab, nEndCol, nEndRow, nTab),
    1261 [ +  - ][ +  - ]:         12 :                 aDestMark, pUndoDoc, NULL, IDF_CONTENTS, NULL, false));
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
    1262                 :            :     }
    1263                 :            : 
    1264         [ +  + ]:         12 :     if (!bHeight)
    1265         [ +  - ]:          5 :         rDocShell.PostPaint( rRange, PAINT_GRID );      // AdjustRowHeight may have painted already
    1266                 :            : 
    1267                 :         12 :     rDocShell.SetDocumentModified();
    1268                 :            : 
    1269                 :         12 :     return !bError;
    1270                 :            : }
    1271                 :            : 
    1272                 :          4 : sal_Bool lcl_PutFormulaArray( ScDocShell& rDocShell, const ScRange& rRange,
    1273                 :            :         const uno::Sequence< uno::Sequence<rtl::OUString> >& aData,
    1274                 :            :         const ::rtl::OUString& rFormulaNmsp, const formula::FormulaGrammar::Grammar eGrammar )
    1275                 :            : {
    1276                 :          4 :     ScDocument* pDoc = rDocShell.GetDocument();
    1277                 :          4 :     SCTAB nTab = rRange.aStart.Tab();
    1278                 :          4 :     SCCOL nStartCol = rRange.aStart.Col();
    1279                 :          4 :     SCROW nStartRow = rRange.aStart.Row();
    1280                 :          4 :     SCCOL nEndCol = rRange.aEnd.Col();
    1281                 :          4 :     SCROW nEndRow = rRange.aEnd.Row();
    1282                 :          4 :     sal_Bool bUndo(pDoc->IsUndoEnabled());
    1283                 :            : 
    1284         [ -  + ]:          4 :     if ( !pDoc->IsBlockEditable( nTab, nStartCol,nStartRow, nEndCol,nEndRow ) )
    1285                 :            :     {
    1286                 :            :         //! error message
    1287                 :          0 :         return false;
    1288                 :            :     }
    1289                 :            : 
    1290                 :          4 :     long nCols = 0;
    1291                 :          4 :     long nRows = aData.getLength();
    1292                 :          4 :     const uno::Sequence<rtl::OUString>* pArray = aData.getConstArray();
    1293         [ +  - ]:          4 :     if ( nRows )
    1294                 :          4 :         nCols = pArray[0].getLength();
    1295                 :            : 
    1296 [ +  - ][ -  + ]:          4 :     if ( nCols != nEndCol-nStartCol+1 || nRows != nEndRow-nStartRow+1 )
    1297                 :            :     {
    1298                 :            :         //! error message?
    1299                 :          0 :         return false;
    1300                 :            :     }
    1301                 :            : 
    1302                 :          4 :     ScDocument* pUndoDoc = NULL;
    1303         [ +  - ]:          4 :     if ( bUndo )
    1304                 :            :     {
    1305         [ +  - ]:          4 :         pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
    1306                 :          4 :         pUndoDoc->InitUndo( pDoc, nTab, nTab );
    1307                 :          4 :         pDoc->CopyToDocument( rRange, IDF_CONTENTS, false, pUndoDoc );
    1308                 :            :     }
    1309                 :            : 
    1310                 :          4 :     pDoc->DeleteAreaTab( nStartCol, nStartRow, nEndCol, nEndRow, nTab, IDF_CONTENTS );
    1311                 :            : 
    1312                 :          4 :     sal_Bool bError = false;
    1313                 :          4 :     SCROW nDocRow = nStartRow;
    1314         [ +  + ]:         22 :     for (long nRow=0; nRow<nRows; nRow++)
    1315                 :            :     {
    1316                 :         18 :         const uno::Sequence<rtl::OUString>& rColSeq = pArray[nRow];
    1317         [ +  - ]:         18 :         if ( rColSeq.getLength() == nCols )
    1318                 :            :         {
    1319                 :         18 :             SCCOL nDocCol = nStartCol;
    1320                 :         18 :             const rtl::OUString* pColArr = rColSeq.getConstArray();
    1321         [ +  + ]:         90 :             for (long nCol=0; nCol<nCols; nCol++)
    1322                 :            :             {
    1323         [ +  - ]:         72 :                 String aText(pColArr[nCol]);
    1324                 :         72 :                 ScAddress aPos( nDocCol, nDocRow, nTab );
    1325                 :         72 :                 ScBaseCell* pNewCell = rDocShell.GetDocFunc().InterpretEnglishString(
    1326 [ +  - ][ +  - ]:         72 :                                                 aPos, aText, rFormulaNmsp, eGrammar );
                 [ +  - ]
    1327         [ +  - ]:         72 :                 pDoc->PutCell( aPos, pNewCell );
    1328                 :            : 
    1329                 :         72 :                 ++nDocCol;
    1330         [ +  - ]:         72 :             }
    1331                 :            :         }
    1332                 :            :         else
    1333                 :          0 :             bError = sal_True;                          // wrong size
    1334                 :            : 
    1335                 :         18 :         ++nDocRow;
    1336                 :            :     }
    1337                 :            : 
    1338                 :          4 :     sal_Bool bHeight = rDocShell.AdjustRowHeight( nStartRow, nEndRow, nTab );
    1339                 :            : 
    1340         [ +  - ]:          4 :     if ( pUndoDoc )
    1341                 :            :     {
    1342         [ +  - ]:          4 :         ScMarkData aDestMark;
    1343         [ +  - ]:          4 :         aDestMark.SelectOneTable( nTab );
    1344         [ +  - ]:          4 :         rDocShell.GetUndoManager()->AddUndoAction(
    1345                 :            :             new ScUndoPaste( &rDocShell,
    1346                 :            :                 ScRange(nStartCol, nStartRow, nTab, nEndCol, nEndRow, nTab), aDestMark,
    1347 [ +  - ][ +  - ]:          4 :                 pUndoDoc, NULL, IDF_CONTENTS, NULL, false));
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
    1348                 :            :     }
    1349                 :            : 
    1350         [ +  + ]:          4 :     if (!bHeight)
    1351         [ +  - ]:          2 :         rDocShell.PostPaint( rRange, PAINT_GRID );      // AdjustRowHeight may have painted already
    1352                 :            : 
    1353                 :          4 :     rDocShell.SetDocumentModified();
    1354                 :            : 
    1355                 :          4 :     return !bError;
    1356                 :            : }
    1357                 :            : 
    1358                 :            : //  used in ScCellRangeObj::getFormulaArray and ScCellObj::GetInputString_Impl
    1359                 :        206 : String lcl_GetInputString( ScDocument* pDoc, const ScAddress& rPosition, sal_Bool bEnglish )
    1360                 :            : {
    1361                 :        206 :     rtl::OUString aVal;
    1362         [ +  - ]:        206 :     if ( pDoc )
    1363                 :            :     {
    1364         [ +  - ]:        206 :         ScBaseCell* pCell = pDoc->GetCell( rPosition );
    1365 [ +  + ][ +  - ]:        206 :         if ( pCell && pCell->GetCellType() != CELLTYPE_NOTE )
                 [ +  + ]
    1366                 :            :         {
    1367                 :         73 :             CellType eType = pCell->GetCellType();
    1368         [ +  + ]:         73 :             if ( eType == CELLTYPE_FORMULA )
    1369                 :            :             {
    1370         [ +  - ]:         12 :                 ScFormulaCell* pForm = (ScFormulaCell*)pCell;
    1371         [ +  - ]:         12 :                 pForm->GetFormula( aVal,formula::FormulaGrammar::mapAPItoGrammar( bEnglish, false));
    1372                 :            :             }
    1373                 :            :             else
    1374                 :            :             {
    1375                 :            :                 SvNumberFormatter* pFormatter = bEnglish ? ScGlobal::GetEnglishFormatter() :
    1376 [ +  + ][ +  - ]:         61 :                                                             pDoc->GetFormatTable();
                 [ +  - ]
    1377                 :            :                 // Since the English formatter was constructed with
    1378                 :            :                 // LANGUAGE_ENGLISH_US the "General" format has index key 0,
    1379                 :            :                 // we don't have to query.
    1380                 :            :                 sal_uInt32 nNumFmt = bEnglish ?
    1381                 :            :                         0 :
    1382 [ +  + ][ +  - ]:         61 :                         pDoc->GetNumberFormat( rPosition );
    1383                 :            : 
    1384         [ +  + ]:         61 :                 if ( eType == CELLTYPE_EDIT )
    1385                 :            :                 {
    1386                 :            :                     //  GetString an der EditCell macht Leerzeichen aus Umbruechen,
    1387                 :            :                     //  hier werden die Umbrueche aber gebraucht
    1388                 :          9 :                     const EditTextObject* pData = ((ScEditCell*)pCell)->GetData();
    1389         [ +  - ]:          9 :                     if (pData)
    1390                 :            :                     {
    1391         [ +  - ]:          9 :                         EditEngine& rEngine = pDoc->GetEditEngine();
    1392         [ +  - ]:          9 :                         rEngine.SetText( *pData );
    1393 [ +  - ][ +  - ]:          9 :                         aVal = rEngine.GetText( LINEEND_LF );
                 [ +  - ]
    1394                 :            :                     }
    1395                 :            :                 }
    1396                 :            :                 else
    1397         [ +  - ]:         52 :                     ScCellFormat::GetInputString( pCell, nNumFmt, aVal, *pFormatter );
    1398                 :            : 
    1399                 :            :                 //  ggf. ein ' davorhaengen wie in ScTabViewShell::UpdateInputHandler
    1400 [ +  + ][ +  + ]:         61 :                 if ( eType == CELLTYPE_STRING || eType == CELLTYPE_EDIT )
    1401                 :            :                 {
    1402                 :            :                     double fDummy;
    1403         [ +  - ]:         33 :                     String aTempString = aVal;
    1404         [ +  - ]:         33 :                     sal_Bool bIsNumberFormat(pFormatter->IsNumberFormat(aTempString, nNumFmt, fDummy));
    1405         [ -  + ]:         33 :                     if ( bIsNumberFormat )
    1406         [ #  # ]:          0 :                         aTempString.Insert('\'',0);
    1407 [ +  - ][ -  + ]:         33 :                     else if ( aTempString.Len() && aTempString.GetChar(0) == '\'' )
                 [ -  + ]
    1408                 :            :                     {
    1409                 :            :                         //  if the string starts with a "'", add another one because setFormula
    1410                 :            :                         //  strips one (like text input, except for "text" number formats)
    1411 [ #  # ][ #  # ]:          0 :                         if ( bEnglish || ( pFormatter->GetType(nNumFmt) != NUMBERFORMAT_TEXT ) )
         [ #  # ][ #  # ]
    1412         [ #  # ]:          0 :                             aTempString.Insert('\'',0);
    1413                 :            :                     }
    1414 [ +  - ][ +  - ]:         61 :                     aVal = aTempString;
    1415                 :            :                 }
    1416                 :            :             }
    1417                 :            :         }
    1418                 :            :     }
    1419         [ +  - ]:        206 :     return aVal;
    1420                 :            : }
    1421                 :            : 
    1422                 :            : //------------------------------------------------------------------------
    1423                 :            : 
    1424                 :      10777 : ScCellRangesBase::ScCellRangesBase(ScDocShell* pDocSh, const ScRange& rR) :
    1425         [ +  - ]:      10777 :     pPropSet(lcl_GetCellsPropertySet()),
    1426                 :            :     pDocShell( pDocSh ),
    1427                 :            :     pValueListener( NULL ),
    1428                 :            :     pCurrentFlat( NULL ),
    1429                 :            :     pCurrentDeep( NULL ),
    1430                 :            :     pCurrentDataSet( NULL ),
    1431                 :            :     pNoDfltCurrentDataSet( NULL ),
    1432                 :            :     pMarkData( NULL ),
    1433                 :            :     nObjectId( 0 ),
    1434                 :            :     bChartColAsHdr( false ),
    1435                 :            :     bChartRowAsHdr( false ),
    1436                 :            :     bCursorOnly( false ),
    1437                 :            :     bGotDataChangedHint( false ),
    1438 [ +  - ][ +  - ]:      21554 :     aValueListeners( 0 )
                 [ +  - ]
    1439                 :            : {
    1440                 :      10777 :     ScRange aCellRange(rR);
    1441         [ +  - ]:      10777 :     aCellRange.Justify();
    1442         [ +  - ]:      10777 :     aRanges.Append( aCellRange );
    1443                 :            : 
    1444         [ +  + ]:      10777 :     if (pDocShell)  // Null if created with createInstance
    1445                 :            :     {
    1446                 :      10776 :         ScDocument* pDoc = pDocShell->GetDocument();
    1447         [ +  - ]:      10776 :         pDoc->AddUnoObject(*this);
    1448         [ +  - ]:      10776 :         nObjectId = pDoc->GetNewUnoId();
    1449                 :            :     }
    1450                 :      10777 : }
    1451                 :            : 
    1452                 :        819 : ScCellRangesBase::ScCellRangesBase(ScDocShell* pDocSh, const ScRangeList& rR) :
    1453         [ +  - ]:        819 :     pPropSet(lcl_GetCellsPropertySet()),
    1454                 :            :     pDocShell( pDocSh ),
    1455                 :            :     pValueListener( NULL ),
    1456                 :            :     pCurrentFlat( NULL ),
    1457                 :            :     pCurrentDeep( NULL ),
    1458                 :            :     pCurrentDataSet( NULL ),
    1459                 :            :     pNoDfltCurrentDataSet( NULL ),
    1460                 :            :     pMarkData( NULL ),
    1461                 :            :     aRanges( rR ),
    1462                 :            :     nObjectId( 0 ),
    1463                 :            :     bChartColAsHdr( false ),
    1464                 :            :     bChartRowAsHdr( false ),
    1465                 :            :     bCursorOnly( false ),
    1466                 :            :     bGotDataChangedHint( false ),
    1467 [ +  - ][ +  - ]:       1638 :     aValueListeners( 0 )
                 [ +  - ]
    1468                 :            : {
    1469         [ +  - ]:        819 :     if (pDocShell)  // Null if created with createInstance
    1470                 :            :     {
    1471                 :        819 :         ScDocument* pDoc = pDocShell->GetDocument();
    1472         [ +  - ]:        819 :         pDoc->AddUnoObject(*this);
    1473         [ +  - ]:        819 :         nObjectId = pDoc->GetNewUnoId();
    1474                 :            :     }
    1475                 :        819 : }
    1476                 :            : 
    1477 [ +  - ][ +  - ]:      11568 : ScCellRangesBase::~ScCellRangesBase()
         [ +  - ][ +  - ]
    1478                 :            : {
    1479                 :            :     //  call RemoveUnoObject first, so no notification can happen
    1480                 :            :     //  during ForgetCurrentAttrs
    1481                 :            : 
    1482         [ +  + ]:      11568 :     if (pDocShell)
    1483         [ +  - ]:       7282 :         pDocShell->GetDocument()->RemoveUnoObject(*this);
    1484                 :            : 
    1485         [ +  - ]:      11568 :     ForgetCurrentAttrs();
    1486         [ +  - ]:      11568 :     ForgetMarkData();
    1487                 :            : 
    1488 [ +  + ][ +  - ]:      11568 :     delete pValueListener;
    1489                 :            : 
    1490                 :            :     //! XChartDataChangeEventListener abmelden ??
    1491                 :            :     //! (ChartCollection haelt dann auch dieses Objekt fest!)
    1492         [ -  + ]:      11568 : }
    1493                 :            : 
    1494                 :     144330 : void ScCellRangesBase::ForgetCurrentAttrs()
    1495                 :            : {
    1496         [ +  + ]:     144330 :     delete pCurrentFlat;
    1497         [ +  + ]:     144330 :     delete pCurrentDeep;
    1498         [ +  + ]:     144330 :     delete pCurrentDataSet;
    1499         [ +  + ]:     144330 :     delete pNoDfltCurrentDataSet;
    1500                 :     144330 :     pCurrentFlat = NULL;
    1501                 :     144330 :     pCurrentDeep = NULL;
    1502                 :     144330 :     pCurrentDataSet = NULL;
    1503                 :     144330 :     pNoDfltCurrentDataSet = NULL;
    1504                 :            : 
    1505                 :            :     // #i62483# pMarkData can remain unchanged, is deleted only if the range changes (RefChanged)
    1506                 :     144330 : }
    1507                 :            : 
    1508                 :      15893 : void ScCellRangesBase::ForgetMarkData()
    1509                 :            : {
    1510         [ +  + ]:      15893 :     delete pMarkData;
    1511                 :      15893 :     pMarkData = NULL;
    1512                 :      15893 : }
    1513                 :            : 
    1514                 :       2284 : const ScPatternAttr* ScCellRangesBase::GetCurrentAttrsFlat()
    1515                 :            : {
    1516                 :            :     //  get and cache direct cell attributes for this object's range
    1517                 :            : 
    1518 [ +  + ][ +  - ]:       2284 :     if ( !pCurrentFlat && pDocShell )
    1519                 :            :     {
    1520                 :         10 :         ScDocument* pDoc = pDocShell->GetDocument();
    1521                 :         10 :         pCurrentFlat = pDoc->CreateSelectionPattern( *GetMarkData(), false );
    1522                 :            :     }
    1523                 :       2284 :     return pCurrentFlat;
    1524                 :            : }
    1525                 :            : 
    1526                 :       1744 : const ScPatternAttr* ScCellRangesBase::GetCurrentAttrsDeep()
    1527                 :            : {
    1528                 :            :     //  get and cache cell attributes (incl. styles) for this object's range
    1529                 :            : 
    1530 [ +  + ][ +  - ]:       1744 :     if ( !pCurrentDeep && pDocShell )
    1531                 :            :     {
    1532                 :       1113 :         ScDocument* pDoc = pDocShell->GetDocument();
    1533                 :       1113 :         pCurrentDeep = pDoc->CreateSelectionPattern( *GetMarkData(), sal_True );
    1534                 :            :     }
    1535                 :       1744 :     return pCurrentDeep;
    1536                 :            : }
    1537                 :            : 
    1538                 :       2824 : SfxItemSet* ScCellRangesBase::GetCurrentDataSet(bool bNoDflt)
    1539                 :            : {
    1540         [ +  + ]:       2824 :     if(!pCurrentDataSet)
    1541                 :            :     {
    1542                 :        669 :         const ScPatternAttr* pPattern = GetCurrentAttrsDeep();
    1543         [ +  - ]:        669 :         if ( pPattern )
    1544                 :            :         {
    1545                 :            :             //  Dontcare durch Default ersetzen, damit man immer eine Reflection hat
    1546         [ +  - ]:        669 :             pCurrentDataSet = new SfxItemSet( pPattern->GetItemSet() );
    1547         [ +  - ]:        669 :             pNoDfltCurrentDataSet = new SfxItemSet( pPattern->GetItemSet() );
    1548                 :        669 :             pCurrentDataSet->ClearInvalidItems();
    1549                 :            :         }
    1550                 :            :     }
    1551         [ -  + ]:       2824 :     return bNoDflt ? pNoDfltCurrentDataSet : pCurrentDataSet;
    1552                 :            : }
    1553                 :            : 
    1554                 :       3033 : const ScMarkData* ScCellRangesBase::GetMarkData()
    1555                 :            : {
    1556         [ +  + ]:       3033 :     if (!pMarkData)
    1557                 :            :     {
    1558         [ +  - ]:        856 :         pMarkData = new ScMarkData();
    1559                 :        856 :         pMarkData->MarkFromRangeList( aRanges, false );
    1560                 :            :     }
    1561                 :       3033 :     return pMarkData;
    1562                 :            : }
    1563                 :            : 
    1564                 :     134159 : void ScCellRangesBase::Notify( SfxBroadcaster&, const SfxHint& rHint )
    1565                 :            : {
    1566         [ +  + ]:     134159 :     if ( rHint.ISA( ScUpdateRefHint ) )
    1567                 :            :     {
    1568                 :       2979 :         const ScUpdateRefHint& rRef = (const ScUpdateRefHint&)rHint;
    1569                 :            : 
    1570                 :       2979 :         ScDocument* pDoc = pDocShell->GetDocument();
    1571                 :       2979 :         ScRangeList* pUndoRanges = NULL;
    1572         [ +  + ]:       2979 :         if ( pDoc->HasUnoRefUndo() )
    1573         [ +  - ]:       1666 :             pUndoRanges = new ScRangeList( aRanges );
    1574                 :            : 
    1575         [ +  + ]:       5958 :         if ( aRanges.UpdateReference( rRef.GetMode(), pDoc, rRef.GetRange(),
    1576                 :       5958 :                                     rRef.GetDx(), rRef.GetDy(), rRef.GetDz() ) )
    1577                 :            :         {
    1578                 :            :             // i#90076; the object "this" was destroyed after calling ScTableSheetObj::getImplementation
    1579                 :            :             // this hack make sure that the object lives a bit longer
    1580         [ +  - ]:       2659 :             uno::Reference<uno::XInterface> xInterface((cppu::OWeakObject*)this, uno::UNO_QUERY);
    1581 [ +  - ][ +  - ]:      10636 :             if (  rRef.GetMode() == URM_INSDEL
         [ +  + ][ +  + ]
    1582         [ +  - ]:       2659 :                && aRanges.size() == 1
    1583 [ +  - ][ +  - ]:       5318 :                && ScTableSheetObj::getImplementation( xInterface )
                 [ #  # ]
    1584                 :            :                )
    1585                 :            :             {
    1586                 :            :                 // #101755#; the range size of a sheet does not change
    1587         [ +  - ]:        330 :                 ScRange* pR = aRanges.front();
    1588         [ +  - ]:        330 :                 if (pR)
    1589                 :            :                 {
    1590                 :        330 :                     pR->aStart.SetCol(0);
    1591                 :        330 :                     pR->aStart.SetRow(0);
    1592                 :        330 :                     pR->aEnd.SetCol(MAXCOL);
    1593                 :        330 :                     pR->aEnd.SetRow(MAXROW);
    1594                 :            :                 }
    1595                 :            :             }
    1596         [ +  - ]:       2659 :             RefChanged();
    1597                 :            : 
    1598                 :            :             // any change of the range address is broadcast to value (modify) listeners
    1599         [ -  + ]:       2659 :             if ( !aValueListeners.empty() )
    1600                 :          0 :                 bGotDataChangedHint = sal_True;
    1601                 :            : 
    1602         [ +  + ]:       2659 :             if ( pUndoRanges )
    1603         [ +  - ]:       2659 :                 pDoc->AddUnoRefChange( nObjectId, *pUndoRanges );
    1604                 :            :         }
    1605                 :            : 
    1606         [ +  + ]:       2979 :         delete pUndoRanges;
    1607                 :            :     }
    1608         [ +  + ]:     131180 :     else if ( rHint.ISA( SfxSimpleHint ) )
    1609                 :            :     {
    1610                 :     128788 :         sal_uLong nId = ((const SfxSimpleHint&)rHint).GetId();
    1611         [ +  + ]:     128788 :         if ( nId == SFX_HINT_DYING )
    1612                 :            :         {
    1613                 :       4313 :             ForgetCurrentAttrs();
    1614                 :       4313 :             pDocShell = NULL;           // invalid
    1615                 :            : 
    1616         [ +  + ]:       4313 :             if ( !aValueListeners.empty() )
    1617                 :            :             {
    1618                 :            :                 //  dispose listeners
    1619                 :            : 
    1620         [ +  - ]:         12 :                 lang::EventObject aEvent;
    1621         [ +  - ]:         12 :                 aEvent.Source.set(static_cast<cppu::OWeakObject*>(this));
    1622         [ +  + ]:         24 :                 for ( sal_uInt16 n=0; n<aValueListeners.size(); n++ )
    1623 [ +  - ][ +  - ]:         12 :                     aValueListeners[n]->disposing( aEvent );
                 [ +  - ]
    1624                 :            : 
    1625 [ +  - ][ +  - ]:         12 :                 aValueListeners.clear();
    1626                 :            : 
    1627                 :            :                 //  The listeners can't have the last ref to this, as it's still held
    1628                 :            :                 //  by the DocShell.
    1629                 :            :             }
    1630                 :            :         }
    1631         [ +  + ]:     124475 :         else if ( nId == SFX_HINT_DATACHANGED )
    1632                 :            :         {
    1633                 :            :             // document content changed -> forget cached attributes
    1634                 :     124124 :             ForgetCurrentAttrs();
    1635                 :            : 
    1636 [ #  # ][ -  + ]:     124124 :             if ( bGotDataChangedHint && pDocShell )
    1637                 :            :             {
    1638                 :            :                 //  This object was notified of content changes, so one call
    1639                 :            :                 //  for each listener is generated now.
    1640                 :            :                 //  The calls can't be executed directly because the document's
    1641                 :            :                 //  UNO broadcaster list must not be modified.
    1642                 :            :                 //  Instead, add to the document's list of listener calls,
    1643                 :            :                 //  which will be executed directly after the broadcast of
    1644                 :            :                 //  SFX_HINT_DATACHANGED.
    1645                 :            : 
    1646         [ #  # ]:          0 :                 lang::EventObject aEvent;
    1647         [ #  # ]:          0 :                 aEvent.Source.set((cppu::OWeakObject*)this);
    1648                 :            : 
    1649                 :            :                 // the EventObject holds a Ref to this object until after the listener calls
    1650                 :            : 
    1651                 :          0 :                 ScDocument* pDoc = pDocShell->GetDocument();
    1652         [ #  # ]:          0 :                 for ( sal_uInt16 n=0; n<aValueListeners.size(); n++ )
    1653 [ #  # ][ #  # ]:          0 :                     pDoc->AddUnoListenerCall( aValueListeners[n], aEvent );
    1654                 :            : 
    1655         [ #  # ]:          0 :                 bGotDataChangedHint = false;
    1656                 :            :             }
    1657                 :            :         }
    1658         [ +  - ]:        351 :         else if ( nId == SC_HINT_CALCALL )
    1659                 :            :         {
    1660                 :            :             // broadcast from DoHardRecalc - set bGotDataChangedHint
    1661                 :            :             // (SFX_HINT_DATACHANGED follows separately)
    1662                 :            : 
    1663         [ -  + ]:        351 :             if ( !aValueListeners.empty() )
    1664                 :          0 :                 bGotDataChangedHint = sal_True;
    1665                 :            :         }
    1666                 :            :     }
    1667         [ -  + ]:       2392 :     else if ( rHint.ISA( ScUnoRefUndoHint ) )
    1668                 :            :     {
    1669                 :          0 :         const ScUnoRefUndoHint& rUndoHint = static_cast<const ScUnoRefUndoHint&>(rHint);
    1670         [ #  # ]:          0 :         if ( rUndoHint.GetObjectId() == nObjectId )
    1671                 :            :         {
    1672                 :            :             // restore ranges from hint
    1673                 :            : 
    1674                 :          0 :             aRanges = rUndoHint.GetRanges();
    1675                 :            : 
    1676                 :          0 :             RefChanged();
    1677         [ #  # ]:          0 :             if ( !aValueListeners.empty() )
    1678                 :          0 :                 bGotDataChangedHint = sal_True;     // need to broadcast the undo, too
    1679                 :            :         }
    1680                 :            :     }
    1681                 :     134159 : }
    1682                 :            : 
    1683                 :       4325 : void ScCellRangesBase::RefChanged()
    1684                 :            : {
    1685                 :            :     //! adjust XChartDataChangeEventListener
    1686                 :            : 
    1687 [ -  + ][ #  # ]:       4325 :     if ( pValueListener && !aValueListeners.empty() )
                 [ -  + ]
    1688                 :            :     {
    1689                 :          0 :         pValueListener->EndListeningAll();
    1690                 :            : 
    1691                 :          0 :         ScDocument* pDoc = pDocShell->GetDocument();
    1692         [ #  # ]:          0 :         for ( size_t i = 0, nCount = aRanges.size(); i < nCount; ++i )
    1693                 :          0 :             pDoc->StartListeningArea( *aRanges[ i ], pValueListener );
    1694                 :            :     }
    1695                 :            : 
    1696                 :       4325 :     ForgetCurrentAttrs();
    1697                 :       4325 :     ForgetMarkData();
    1698                 :       4325 : }
    1699                 :            : 
    1700                 :          0 : ScDocument* ScCellRangesBase::GetDocument() const
    1701                 :            : {
    1702         [ #  # ]:          0 :     if (pDocShell)
    1703                 :          0 :         return pDocShell->GetDocument();
    1704                 :            :     else
    1705                 :          0 :         return NULL;
    1706                 :            : }
    1707                 :            : 
    1708                 :          0 : void ScCellRangesBase::InitInsertRange(ScDocShell* pDocSh, const ScRange& rR)
    1709                 :            : {
    1710 [ #  # ][ #  # ]:          0 :     if ( !pDocShell && pDocSh )
    1711                 :            :     {
    1712                 :          0 :         pDocShell = pDocSh;
    1713                 :            : 
    1714                 :          0 :         ScRange aCellRange(rR);
    1715         [ #  # ]:          0 :         aCellRange.Justify();
    1716         [ #  # ]:          0 :         aRanges.RemoveAll();
    1717         [ #  # ]:          0 :         aRanges.Append( aCellRange );
    1718                 :            : 
    1719         [ #  # ]:          0 :         pDocShell->GetDocument()->AddUnoObject(*this);
    1720                 :            : 
    1721         [ #  # ]:          0 :         RefChanged();   // Range im Range-Objekt anpassen
    1722                 :            :     }
    1723                 :          0 : }
    1724                 :            : 
    1725                 :       1569 : void ScCellRangesBase::AddRange(const ScRange& rRange, const sal_Bool bMergeRanges)
    1726                 :            : {
    1727         [ -  + ]:       1569 :     if (bMergeRanges)
    1728                 :          0 :         aRanges.Join(rRange);
    1729                 :            :     else
    1730                 :       1569 :         aRanges.Append(rRange);
    1731                 :       1569 :     RefChanged();
    1732                 :       1569 : }
    1733                 :            : 
    1734                 :         51 : void ScCellRangesBase::SetNewRange(const ScRange& rNew)
    1735                 :            : {
    1736                 :         51 :     ScRange aCellRange(rNew);
    1737         [ +  - ]:         51 :     aCellRange.Justify();
    1738                 :            : 
    1739         [ +  - ]:         51 :     aRanges.RemoveAll();
    1740         [ +  - ]:         51 :     aRanges.Append( aCellRange );
    1741         [ +  - ]:         51 :     RefChanged();
    1742                 :         51 : }
    1743                 :            : 
    1744                 :         46 : void ScCellRangesBase::SetNewRanges(const ScRangeList& rNew)
    1745                 :            : {
    1746                 :         46 :     aRanges = rNew;
    1747                 :         46 :     RefChanged();
    1748                 :         46 : }
    1749                 :            : 
    1750                 :         19 : void ScCellRangesBase::SetCursorOnly( sal_Bool bSet )
    1751                 :            : {
    1752                 :            :     //  set for a selection object that is created from the cursor position
    1753                 :            :     //  without anything selected (may contain several sheets)
    1754                 :            : 
    1755                 :         19 :     bCursorOnly = bSet;
    1756                 :         19 : }
    1757                 :            : 
    1758                 :      14015 : uno::Any SAL_CALL ScCellRangesBase::queryInterface( const uno::Type& rType )
    1759                 :            :                                                 throw(uno::RuntimeException)
    1760                 :            : {
    1761 [ +  + ][ +  - ]:      14015 :     SC_QUERYINTERFACE( beans::XPropertySet )
    1762 [ +  + ][ +  - ]:      12198 :     SC_QUERYINTERFACE( beans::XMultiPropertySet )
    1763 [ +  + ][ +  - ]:      11706 :     SC_QUERYINTERFACE( beans::XTolerantMultiPropertySet )
    1764 [ +  + ][ +  - ]:      11119 :     SC_QUERYINTERFACE( beans::XPropertyState )
    1765 [ +  + ][ +  - ]:      11116 :     SC_QUERYINTERFACE( sheet::XSheetOperation )
    1766 [ +  + ][ +  - ]:      11106 :     SC_QUERYINTERFACE( chart::XChartDataArray )
    1767 [ +  + ][ +  - ]:      11101 :     SC_QUERYINTERFACE( chart::XChartData )
    1768 [ +  + ][ +  - ]:      11099 :     SC_QUERYINTERFACE( util::XIndent )
    1769 [ +  + ][ +  - ]:      11095 :     SC_QUERYINTERFACE( sheet::XCellRangesQuery )
    1770 [ +  + ][ +  - ]:      11072 :     SC_QUERYINTERFACE( sheet::XFormulaQuery )
    1771 [ +  + ][ +  - ]:      11068 :     SC_QUERYINTERFACE( util::XReplaceable )
    1772 [ +  + ][ +  - ]:      11057 :     SC_QUERYINTERFACE( util::XSearchable )
    1773 [ +  + ][ +  - ]:      11043 :     SC_QUERYINTERFACE( util::XModifyBroadcaster )
    1774 [ +  + ][ +  - ]:      11028 :     SC_QUERYINTERFACE( lang::XServiceInfo )
    1775 [ +  + ][ +  - ]:      10802 :     SC_QUERYINTERFACE( lang::XUnoTunnel )
    1776 [ +  + ][ +  - ]:       7431 :     SC_QUERYINTERFACE( lang::XTypeProvider )
    1777                 :            : 
    1778                 :      14015 :     return OWeakObject::queryInterface( rType );
    1779                 :            : }
    1780                 :            : 
    1781                 :      74964 : void SAL_CALL ScCellRangesBase::acquire() throw()
    1782                 :            : {
    1783                 :      74964 :     OWeakObject::acquire();
    1784                 :      74964 : }
    1785                 :            : 
    1786                 :      74936 : void SAL_CALL ScCellRangesBase::release() throw()
    1787                 :            : {
    1788                 :      74936 :     OWeakObject::release();
    1789                 :      74936 : }
    1790                 :            : 
    1791                 :          4 : uno::Sequence<uno::Type> SAL_CALL ScCellRangesBase::getTypes() throw(uno::RuntimeException)
    1792                 :            : {
    1793 [ +  - ][ +  - ]:          4 :     static uno::Sequence<uno::Type> aTypes;
         [ +  - ][ #  # ]
    1794         [ +  - ]:          4 :     if ( aTypes.getLength() == 0 )
    1795                 :            :     {
    1796                 :          4 :         aTypes.realloc(13);
    1797                 :          4 :         uno::Type* pPtr = aTypes.getArray();
    1798                 :          4 :         pPtr[0] = getCppuType((const uno::Reference<beans::XPropertySet>*)0);
    1799                 :          4 :         pPtr[1] = getCppuType((const uno::Reference<beans::XMultiPropertySet>*)0);
    1800                 :          4 :         pPtr[2] = getCppuType((const uno::Reference<beans::XPropertyState>*)0);
    1801                 :          4 :         pPtr[3] = getCppuType((const uno::Reference<sheet::XSheetOperation>*)0);
    1802                 :          4 :         pPtr[4] = getCppuType((const uno::Reference<chart::XChartDataArray>*)0);
    1803                 :          4 :         pPtr[5] = getCppuType((const uno::Reference<util::XIndent>*)0);
    1804                 :          4 :         pPtr[6] = getCppuType((const uno::Reference<sheet::XCellRangesQuery>*)0);
    1805                 :          4 :         pPtr[7] = getCppuType((const uno::Reference<sheet::XFormulaQuery>*)0);
    1806                 :          4 :         pPtr[8] = getCppuType((const uno::Reference<util::XReplaceable>*)0);
    1807                 :          4 :         pPtr[9] = getCppuType((const uno::Reference<util::XModifyBroadcaster>*)0);
    1808                 :          4 :         pPtr[10]= getCppuType((const uno::Reference<lang::XServiceInfo>*)0);
    1809                 :          4 :         pPtr[11]= getCppuType((const uno::Reference<lang::XUnoTunnel>*)0);
    1810                 :          4 :         pPtr[12]= getCppuType((const uno::Reference<lang::XTypeProvider>*)0);
    1811                 :            :     }
    1812                 :          4 :     return aTypes;
    1813                 :            : }
    1814                 :            : 
    1815                 :            : namespace
    1816                 :            : {
    1817                 :            :     class theScCellRangesBaseImplementationId : public rtl::Static< UnoTunnelIdInit, theScCellRangesBaseImplementationId > {};
    1818                 :            : }
    1819                 :            : 
    1820                 :          0 : uno::Sequence<sal_Int8> SAL_CALL ScCellRangesBase::getImplementationId()
    1821                 :            :                                                     throw(uno::RuntimeException)
    1822                 :            : {
    1823                 :          0 :     return theScCellRangesBaseImplementationId::get().getSeq();
    1824                 :            : }
    1825                 :            : 
    1826                 :            : // ---
    1827                 :            : 
    1828                 :         11 : void ScCellRangesBase::PaintRanges_Impl( sal_uInt16 nPart )
    1829                 :            : {
    1830         [ +  + ]:         37 :     for (size_t i = 0, nCount = aRanges.size(); i < nCount; ++i)
    1831         [ +  - ]:         26 :         pDocShell->PostPaint( *aRanges[ i ], nPart );
    1832                 :         11 : }
    1833                 :            : 
    1834                 :            : // XSheetOperation
    1835                 :            : 
    1836                 :         10 : double SAL_CALL ScCellRangesBase::computeFunction( sheet::GeneralFunction nFunction )
    1837                 :            :                                                 throw(uno::Exception, uno::RuntimeException)
    1838                 :            : {
    1839         [ +  - ]:         10 :     SolarMutexGuard aGuard;
    1840 [ +  - ][ +  - ]:         10 :     ScMarkData aMark(*GetMarkData());
    1841         [ +  - ]:         10 :     aMark.MarkToSimple();
    1842         [ +  + ]:         10 :     if (!aMark.IsMarked())
    1843                 :          6 :         aMark.SetMarkNegative(sal_True);    // um Dummy Position angeben zu koennen
    1844                 :            : 
    1845                 :         10 :     ScAddress aDummy;                   // wenn nicht Marked, ignoriert wegen Negative
    1846                 :            :     double fVal;
    1847                 :         10 :     ScSubTotalFunc eFunc = lcl_SummaryToSubTotal( nFunction );
    1848                 :         10 :     ScDocument* pDoc = pDocShell->GetDocument();
    1849 [ -  + ][ +  - ]:         10 :     if ( !pDoc->GetSelectionFunction( eFunc, aDummy, aMark, fVal ) )
    1850                 :            :     {
    1851         [ #  # ]:          0 :         throw uno::RuntimeException();      //! own exception?
    1852                 :            :     }
    1853                 :            : 
    1854 [ +  - ][ +  - ]:         10 :     return fVal;
    1855                 :            : }
    1856                 :            : 
    1857                 :          6 : void SAL_CALL ScCellRangesBase::clearContents( sal_Int32 nContentFlags ) throw(uno::RuntimeException)
    1858                 :            : {
    1859         [ +  - ]:          6 :     SolarMutexGuard aGuard;
    1860 [ +  - ][ +  - ]:          6 :     if ( !aRanges.empty() )
    1861                 :            :     {
    1862                 :            :         // only for clearContents: EDITATTR is only used if no contents are deleted
    1863                 :          6 :         sal_uInt16 nDelFlags = static_cast< sal_uInt16 >( nContentFlags & IDF_ALL );
    1864 [ +  + ][ -  + ]:          6 :         if ( ( nContentFlags & IDF_EDITATTR ) && ( nContentFlags & IDF_CONTENTS ) == 0 )
    1865                 :          0 :             nDelFlags |= IDF_EDITATTR;
    1866                 :            : 
    1867 [ +  - ][ +  - ]:          6 :         pDocShell->GetDocFunc().DeleteContents( *GetMarkData(), nDelFlags, sal_True, sal_True );
    1868         [ +  - ]:          6 :     }
    1869                 :            :     // sonst ist nichts zu tun
    1870                 :          6 : }
    1871                 :            : 
    1872                 :            : // XPropertyState
    1873                 :            : 
    1874                 :       1026 : const SfxItemPropertyMap& ScCellRangesBase::GetItemPropertyMap()
    1875                 :            : {
    1876                 :       1026 :     return pPropSet->getPropertyMap();
    1877                 :            : }
    1878                 :            : 
    1879                 :       2506 : void lcl_GetPropertyWhich( const SfxItemPropertySimpleEntry* pEntry,
    1880                 :            :                                                 sal_uInt16& rItemWhich )
    1881                 :            : {
    1882                 :            :     //  Which-ID des betroffenen Items, auch wenn das Item die Property
    1883                 :            :     //  nicht alleine behandeln kann
    1884         [ +  - ]:       2506 :     if ( pEntry )
    1885                 :            :     {
    1886         [ +  + ]:       2506 :         if ( IsScItemWid( pEntry->nWID ) )
    1887                 :       2100 :             rItemWhich = pEntry->nWID;
    1888                 :            :         else
    1889   [ +  +  +  + ]:        406 :             switch ( pEntry->nWID )
    1890                 :            :             {
    1891                 :            :                 case SC_WID_UNO_TBLBORD:
    1892                 :            :                 case SC_WID_UNO_TBLBORD2:
    1893                 :         44 :                     rItemWhich = ATTR_BORDER;
    1894                 :         44 :                     break;
    1895                 :            :                 case SC_WID_UNO_CONDFMT:
    1896                 :            :                 case SC_WID_UNO_CONDLOC:
    1897                 :            :                 case SC_WID_UNO_CONDXML:
    1898                 :         70 :                     rItemWhich = ATTR_CONDITIONAL;
    1899                 :         70 :                     break;
    1900                 :            :                 case SC_WID_UNO_VALIDAT:
    1901                 :            :                 case SC_WID_UNO_VALILOC:
    1902                 :            :                 case SC_WID_UNO_VALIXML:
    1903                 :         70 :                     rItemWhich = ATTR_VALIDDATA;
    1904                 :       2506 :                     break;
    1905                 :            :             }
    1906                 :            :     }
    1907                 :            : 
    1908                 :       2506 : }
    1909                 :            : 
    1910                 :       2506 : beans::PropertyState ScCellRangesBase::GetOnePropertyState( sal_uInt16 nItemWhich, const SfxItemPropertySimpleEntry* pEntry )
    1911                 :            : {
    1912                 :       2506 :     beans::PropertyState eRet = beans::PropertyState_DIRECT_VALUE;
    1913         [ +  + ]:       2506 :     if ( nItemWhich )                   // item wid (from map or special case)
    1914                 :            :     {
    1915                 :            :         //  For items that contain several properties (like background),
    1916                 :            :         //  "ambiguous" is returned too often here
    1917                 :            : 
    1918                 :            :         //  for PropertyState, don't look at styles
    1919                 :       2284 :         const ScPatternAttr* pPattern = GetCurrentAttrsFlat();
    1920         [ +  - ]:       2284 :         if ( pPattern )
    1921                 :            :         {
    1922                 :       2284 :             SfxItemState eState = pPattern->GetItemSet().GetItemState( nItemWhich, false );
    1923                 :            : 
    1924 [ +  + ][ +  + ]:       2284 :             if ( nItemWhich == ATTR_VALUE_FORMAT && eState == SFX_ITEM_DEFAULT )
    1925                 :         13 :                 eState = pPattern->GetItemSet().GetItemState( ATTR_LANGUAGE_FORMAT, false );
    1926                 :            : 
    1927         [ +  + ]:       2284 :             if ( eState == SFX_ITEM_SET )
    1928                 :       1169 :                 eRet = beans::PropertyState_DIRECT_VALUE;
    1929         [ +  - ]:       1115 :             else if ( eState == SFX_ITEM_DEFAULT )
    1930                 :       1115 :                 eRet = beans::PropertyState_DEFAULT_VALUE;
    1931         [ #  # ]:          0 :             else if ( eState == SFX_ITEM_DONTCARE )
    1932                 :          0 :                 eRet = beans::PropertyState_AMBIGUOUS_VALUE;
    1933                 :            :             else
    1934                 :            :             {
    1935                 :            :                 OSL_FAIL("unbekannter ItemState");
    1936                 :            :             }
    1937                 :            :         }
    1938                 :            :     }
    1939         [ +  - ]:        222 :     else if ( pEntry )
    1940                 :            :     {
    1941 [ +  + ][ +  + ]:        222 :         if ( pEntry->nWID == SC_WID_UNO_CHCOLHDR || pEntry->nWID == SC_WID_UNO_CHROWHDR || pEntry->nWID == SC_WID_UNO_ABSNAME )
                 [ +  + ]
    1942                 :         66 :             eRet = beans::PropertyState_DIRECT_VALUE;
    1943         [ +  + ]:        156 :         else if ( pEntry->nWID == SC_WID_UNO_CELLSTYL )
    1944                 :            :         {
    1945                 :            :             //  a style is always set, there's no default state
    1946                 :         26 :             const ScStyleSheet* pStyle = pDocShell->GetDocument()->GetSelectionStyle(*GetMarkData());
    1947         [ +  - ]:         26 :             if (pStyle)
    1948                 :         26 :                 eRet = beans::PropertyState_DIRECT_VALUE;
    1949                 :            :             else
    1950                 :          0 :                 eRet = beans::PropertyState_AMBIGUOUS_VALUE;
    1951                 :            :         }
    1952         [ +  + ]:        130 :         else if ( pEntry->nWID == SC_WID_UNO_NUMRULES )
    1953                 :        222 :             eRet = beans::PropertyState_DEFAULT_VALUE;      // numbering rules are always default
    1954                 :            :     }
    1955                 :       2506 :     return eRet;
    1956                 :            : }
    1957                 :            : 
    1958                 :        294 : beans::PropertyState SAL_CALL ScCellRangesBase::getPropertyState( const rtl::OUString& aPropertyName )
    1959                 :            :                                 throw(beans::UnknownPropertyException, uno::RuntimeException)
    1960                 :            : {
    1961         [ +  - ]:        294 :     SolarMutexGuard aGuard;
    1962 [ +  - ][ -  + ]:        294 :     if ( aRanges.empty() )
    1963         [ #  # ]:          0 :         throw uno::RuntimeException();
    1964                 :            : 
    1965         [ +  - ]:        294 :     const SfxItemPropertyMap& rMap = GetItemPropertyMap();     // from derived class
    1966                 :        294 :     sal_uInt16 nItemWhich = 0;
    1967         [ +  - ]:        294 :     const SfxItemPropertySimpleEntry* pEntry  = rMap.getByName( aPropertyName );
    1968                 :        294 :     lcl_GetPropertyWhich( pEntry, nItemWhich );
    1969 [ +  - ][ +  - ]:        294 :     return GetOnePropertyState( nItemWhich, pEntry );
    1970                 :            : }
    1971                 :            : 
    1972                 :          0 : uno::Sequence<beans::PropertyState> SAL_CALL ScCellRangesBase::getPropertyStates(
    1973                 :            :                                 const uno::Sequence<rtl::OUString>& aPropertyNames )
    1974                 :            :                             throw(beans::UnknownPropertyException, uno::RuntimeException)
    1975                 :            : {
    1976         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    1977                 :            : 
    1978         [ #  # ]:          0 :     const SfxItemPropertyMap& rPropertyMap = GetItemPropertyMap();     // from derived class
    1979                 :            : 
    1980         [ #  # ]:          0 :     uno::Sequence<beans::PropertyState> aRet(aPropertyNames.getLength());
    1981         [ #  # ]:          0 :     beans::PropertyState* pStates = aRet.getArray();
    1982         [ #  # ]:          0 :     for(sal_Int32 i = 0; i < aPropertyNames.getLength(); i++)
    1983                 :            :     {
    1984                 :          0 :         sal_uInt16 nItemWhich = 0;
    1985         [ #  # ]:          0 :         const SfxItemPropertySimpleEntry* pEntry  = rPropertyMap.getByName( aPropertyNames[i] );
    1986                 :          0 :         lcl_GetPropertyWhich( pEntry, nItemWhich );
    1987         [ #  # ]:          0 :         pStates[i] = GetOnePropertyState(nItemWhich, pEntry);
    1988                 :            :     }
    1989         [ #  # ]:          0 :     return aRet;
    1990                 :            : }
    1991                 :            : 
    1992                 :          0 : void SAL_CALL ScCellRangesBase::setPropertyToDefault( const rtl::OUString& aPropertyName )
    1993                 :            :                             throw(beans::UnknownPropertyException, uno::RuntimeException)
    1994                 :            : {
    1995         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    1996         [ #  # ]:          0 :     if ( pDocShell )
    1997                 :            :     {
    1998         [ #  # ]:          0 :         const SfxItemPropertyMap& rPropertyMap = GetItemPropertyMap();     // from derived class
    1999                 :          0 :         sal_uInt16 nItemWhich = 0;
    2000         [ #  # ]:          0 :         const SfxItemPropertySimpleEntry* pEntry  = rPropertyMap.getByName( aPropertyName );
    2001                 :          0 :         lcl_GetPropertyWhich( pEntry, nItemWhich );
    2002         [ #  # ]:          0 :         if ( nItemWhich )               // item wid (from map or special case)
    2003                 :            :         {
    2004 [ #  # ][ #  # ]:          0 :             if ( !aRanges.empty() )     // leer = nichts zu tun
    2005                 :            :             {
    2006                 :            :                 //! Bei Items, die mehrere Properties enthalten (z.B. Hintergrund)
    2007                 :            :                 //! wird hier zuviel zurueckgesetzt
    2008                 :            :                 //! for ATTR_ROTATE_VALUE, also reset ATTR_ORIENTATION?
    2009                 :            : 
    2010                 :            :                 sal_uInt16 aWIDs[3];
    2011                 :          0 :                 aWIDs[0] = nItemWhich;
    2012         [ #  # ]:          0 :                 if ( nItemWhich == ATTR_VALUE_FORMAT )
    2013                 :            :                 {
    2014                 :          0 :                     aWIDs[1] = ATTR_LANGUAGE_FORMAT; // language for number formats
    2015                 :          0 :                     aWIDs[2] = 0;
    2016                 :            :                 }
    2017                 :            :                 else
    2018                 :          0 :                     aWIDs[1] = 0;
    2019 [ #  # ][ #  # ]:          0 :                 pDocShell->GetDocFunc().ClearItems( *GetMarkData(), aWIDs, sal_True );
    2020                 :            :             }
    2021                 :            :         }
    2022         [ #  # ]:          0 :         else if ( pEntry )
    2023                 :            :         {
    2024         [ #  # ]:          0 :             if ( pEntry->nWID == SC_WID_UNO_CHCOLHDR )
    2025                 :          0 :                 bChartColAsHdr = false;
    2026         [ #  # ]:          0 :             else if ( pEntry->nWID == SC_WID_UNO_CHROWHDR )
    2027                 :          0 :                 bChartRowAsHdr = false;
    2028         [ #  # ]:          0 :             else if ( pEntry->nWID == SC_WID_UNO_CELLSTYL )
    2029                 :            :             {
    2030 [ #  # ][ #  # ]:          0 :                 String aStyleName( ScGlobal::GetRscString( STR_STYLENAME_STANDARD ) );
    2031 [ #  # ][ #  # ]:          0 :                 pDocShell->GetDocFunc().ApplyStyle( *GetMarkData(), aStyleName, sal_True, sal_True );
                 [ #  # ]
    2032                 :            :             }
    2033                 :            :         }
    2034         [ #  # ]:          0 :     }
    2035                 :          0 : }
    2036                 :            : 
    2037                 :          0 : uno::Any SAL_CALL ScCellRangesBase::getPropertyDefault( const rtl::OUString& aPropertyName )
    2038                 :            :                                 throw(beans::UnknownPropertyException, lang::WrappedTargetException,
    2039                 :            :                                         uno::RuntimeException)
    2040                 :            : {
    2041                 :            :     //! mit getPropertyValue zusammenfassen
    2042                 :            : 
    2043         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    2044                 :          0 :     uno::Any aAny;
    2045                 :            : 
    2046         [ #  # ]:          0 :     if ( pDocShell )
    2047                 :            :     {
    2048                 :          0 :         ScDocument* pDoc = pDocShell->GetDocument();
    2049         [ #  # ]:          0 :         const SfxItemPropertyMap& rPropertyMap = GetItemPropertyMap();     // from derived class
    2050         [ #  # ]:          0 :         const SfxItemPropertySimpleEntry* pEntry = rPropertyMap.getByName( aPropertyName );
    2051         [ #  # ]:          0 :         if ( pEntry )
    2052                 :            :         {
    2053         [ #  # ]:          0 :             if ( IsScItemWid( pEntry->nWID ) )
    2054                 :            :             {
    2055         [ #  # ]:          0 :                 const ScPatternAttr* pPattern = pDoc->GetDefPattern();
    2056         [ #  # ]:          0 :                 if ( pPattern )
    2057                 :            :                 {
    2058                 :          0 :                     const SfxItemSet& rSet = pPattern->GetItemSet();
    2059                 :            : 
    2060      [ #  #  # ]:          0 :                     switch ( pEntry->nWID )     // fuer Item-Spezial-Behandlungen
    2061                 :            :                     {
    2062                 :            :                         case ATTR_VALUE_FORMAT:
    2063                 :            :                             //  default has no language set
    2064 [ #  # ][ #  # ]:          0 :                             aAny <<= (sal_Int32)( ((const SfxUInt32Item&)rSet.Get(pEntry->nWID)).GetValue() );
    2065                 :          0 :                             break;
    2066                 :            :                         case ATTR_INDENT:
    2067                 :            :                             aAny <<= (sal_Int16)( TwipsToHMM(((const SfxUInt16Item&)
    2068 [ #  # ][ #  # ]:          0 :                                             rSet.Get(pEntry->nWID)).GetValue()) );
    2069                 :          0 :                             break;
    2070                 :            :                         default:
    2071         [ #  # ]:          0 :                             pPropSet->getPropertyValue(aPropertyName, rSet, aAny);
    2072                 :            :                     }
    2073                 :            :                 }
    2074                 :            :             }
    2075                 :            :             else
    2076   [ #  #  #  #  :          0 :                 switch ( pEntry->nWID )
                #  #  # ]
    2077                 :            :                 {
    2078                 :            :                     case SC_WID_UNO_CHCOLHDR:
    2079                 :            :                     case SC_WID_UNO_CHROWHDR:
    2080         [ #  # ]:          0 :                         ScUnoHelpFunctions::SetBoolInAny( aAny, false );
    2081                 :          0 :                         break;
    2082                 :            :                     case SC_WID_UNO_CELLSTYL:
    2083                 :            :                         aAny <<= rtl::OUString( ScStyleNameConversion::DisplayToProgrammaticName(
    2084 [ #  # ][ #  # ]:          0 :                                     ScGlobal::GetRscString(STR_STYLENAME_STANDARD), SFX_STYLE_FAMILY_PARA ) );
         [ #  # ][ #  # ]
                 [ #  # ]
    2085                 :          0 :                         break;
    2086                 :            :                     case SC_WID_UNO_TBLBORD:
    2087                 :            :                     case SC_WID_UNO_TBLBORD2:
    2088                 :            :                         {
    2089         [ #  # ]:          0 :                             const ScPatternAttr* pPattern = pDoc->GetDefPattern();
    2090         [ #  # ]:          0 :                             if ( pPattern )
    2091                 :            :                             {
    2092         [ #  # ]:          0 :                                 if (pEntry->nWID == SC_WID_UNO_TBLBORD2)
    2093                 :            :                                     ScHelperFunctions::AssignTableBorder2ToAny( aAny,
    2094         [ #  # ]:          0 :                                             (const SvxBoxItem&)pPattern->GetItem(ATTR_BORDER),
    2095 [ #  # ][ #  # ]:          0 :                                             (const SvxBoxInfoItem&)pPattern->GetItem(ATTR_BORDER_INNER) );
    2096                 :            :                                 else
    2097                 :            :                                     ScHelperFunctions::AssignTableBorderToAny( aAny,
    2098         [ #  # ]:          0 :                                             (const SvxBoxItem&)pPattern->GetItem(ATTR_BORDER),
    2099 [ #  # ][ #  # ]:          0 :                                             (const SvxBoxInfoItem&)pPattern->GetItem(ATTR_BORDER_INNER) );
    2100                 :            :                             }
    2101                 :            :                         }
    2102                 :          0 :                         break;
    2103                 :            :                     case SC_WID_UNO_CONDFMT:
    2104                 :            :                     case SC_WID_UNO_CONDLOC:
    2105                 :            :                     case SC_WID_UNO_CONDXML:
    2106                 :            :                         {
    2107                 :          0 :                             sal_Bool bEnglish = ( pEntry->nWID != SC_WID_UNO_CONDLOC );
    2108                 :          0 :                             sal_Bool bXML = ( pEntry->nWID == SC_WID_UNO_CONDXML );
    2109                 :            :                             formula::FormulaGrammar::Grammar eGrammar = (bXML ?
    2110                 :            :                                     pDoc->GetStorageGrammar() :
    2111         [ #  # ]:          0 :                                    formula::FormulaGrammar::mapAPItoGrammar( bEnglish, bXML));
    2112                 :            : 
    2113                 :            :                             aAny <<= uno::Reference<sheet::XSheetConditionalEntries>(
    2114 [ #  # ][ #  # ]:          0 :                                     new ScTableConditionalFormat( pDoc, 0, aRanges[0]->aStart.Tab(), eGrammar ));
         [ #  # ][ #  # ]
                 [ #  # ]
    2115                 :            :                         }
    2116                 :          0 :                         break;
    2117                 :            :                     case SC_WID_UNO_VALIDAT:
    2118                 :            :                     case SC_WID_UNO_VALILOC:
    2119                 :            :                     case SC_WID_UNO_VALIXML:
    2120                 :            :                         {
    2121                 :          0 :                             sal_Bool bEnglish = ( pEntry->nWID != SC_WID_UNO_VALILOC );
    2122                 :          0 :                             sal_Bool bXML = ( pEntry->nWID == SC_WID_UNO_VALIXML );
    2123                 :            :                             formula::FormulaGrammar::Grammar eGrammar = (bXML ?
    2124                 :            :                                     pDoc->GetStorageGrammar() :
    2125         [ #  # ]:          0 :                                    formula::FormulaGrammar::mapAPItoGrammar( bEnglish, bXML));
    2126                 :            : 
    2127                 :            :                             aAny <<= uno::Reference<beans::XPropertySet>(
    2128 [ #  # ][ #  # ]:          0 :                                     new ScTableValidationObj( pDoc, 0, eGrammar ));
         [ #  # ][ #  # ]
    2129                 :            :                         }
    2130                 :          0 :                         break;
    2131                 :            :                     case SC_WID_UNO_NUMRULES:
    2132                 :            :                         {
    2133 [ #  # ][ #  # ]:          0 :                             aAny <<= uno::Reference<container::XIndexReplace>(ScStyleObj::CreateEmptyNumberingRules());
    2134                 :            :                         }
    2135                 :          0 :                         break;
    2136                 :            :                 }
    2137                 :            :         }
    2138                 :            :     }
    2139                 :            : 
    2140         [ #  # ]:          0 :     return aAny;
    2141                 :            : }
    2142                 :            : 
    2143                 :            : // XPropertySet
    2144                 :            : 
    2145                 :        159 : uno::Reference<beans::XPropertySetInfo> SAL_CALL ScCellRangesBase::getPropertySetInfo()
    2146                 :            :                                                         throw(uno::RuntimeException)
    2147                 :            : {
    2148         [ +  - ]:        159 :     SolarMutexGuard aGuard;
    2149                 :            :     static uno::Reference<beans::XPropertySetInfo> aRef(
    2150 [ +  + ][ +  - ]:        159 :         new SfxItemPropertySetInfo( pPropSet->getPropertyMap() ));
         [ +  - ][ +  - ]
         [ +  - ][ #  # ]
    2151         [ +  - ]:        159 :     return aRef;
    2152                 :            : }
    2153                 :            : 
    2154                 :       2178 : void lcl_SetCellProperty( const SfxItemPropertySimpleEntry& rEntry, const uno::Any& rValue,
    2155                 :            :                             ScPatternAttr& rPattern, ScDocument* pDoc,
    2156                 :            :                             sal_uInt16& rFirstItemId, sal_uInt16& rSecondItemId )
    2157                 :            : {
    2158                 :       2178 :     rFirstItemId = rEntry.nWID;
    2159                 :       2178 :     rSecondItemId = 0;
    2160                 :            : 
    2161                 :       2178 :     SfxItemSet& rSet = rPattern.GetItemSet();
    2162   [ +  +  +  +  :       2178 :     switch ( rEntry.nWID )
                      + ]
    2163                 :            :     {
    2164                 :            :         case ATTR_VALUE_FORMAT:
    2165                 :            :             {
    2166                 :            :                 // language for number formats
    2167         [ +  - ]:         91 :                 SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
    2168         [ +  - ]:         91 :                 sal_uLong nOldFormat = ((const SfxUInt32Item&)rSet.Get( ATTR_VALUE_FORMAT )).GetValue();
    2169         [ +  - ]:         91 :                 LanguageType eOldLang = ((const SvxLanguageItem&)rSet.Get( ATTR_LANGUAGE_FORMAT )).GetLanguage();
    2170         [ +  - ]:         91 :                 nOldFormat = pFormatter->GetFormatForLanguageIfBuiltIn( nOldFormat, eOldLang );
    2171                 :            : 
    2172                 :         91 :                 sal_Int32 nIntVal = 0;
    2173         [ +  - ]:         91 :                 if ( rValue >>= nIntVal )
    2174                 :            :                 {
    2175                 :         91 :                     sal_uLong nNewFormat = (sal_uLong)nIntVal;
    2176 [ +  - ][ +  - ]:         91 :                     rSet.Put( SfxUInt32Item( ATTR_VALUE_FORMAT, nNewFormat ) );
                 [ +  - ]
    2177                 :            : 
    2178         [ +  - ]:         91 :                     const SvNumberformat* pNewEntry = pFormatter->GetEntry( nNewFormat );
    2179                 :            :                     LanguageType eNewLang =
    2180         [ +  + ]:         91 :                         pNewEntry ? pNewEntry->GetLanguage() : LANGUAGE_DONTKNOW;
    2181 [ +  + ][ +  + ]:         91 :                     if ( eNewLang != eOldLang && eNewLang != LANGUAGE_DONTKNOW )
    2182                 :            :                     {
    2183 [ +  - ][ +  - ]:         18 :                         rSet.Put( SvxLanguageItem( eNewLang, ATTR_LANGUAGE_FORMAT ) );
                 [ +  - ]
    2184                 :            : 
    2185                 :            :                         // if only language is changed,
    2186                 :            :                         // don't touch number format attribute
    2187                 :         18 :                         sal_uLong nNewMod = nNewFormat % SV_COUNTRY_LANGUAGE_OFFSET;
    2188 [ -  + ][ #  # ]:         18 :                         if ( nNewMod == ( nOldFormat % SV_COUNTRY_LANGUAGE_OFFSET ) &&
    2189                 :            :                              nNewMod <= SV_MAX_ANZ_STANDARD_FORMATE )
    2190                 :            :                         {
    2191                 :          0 :                             rFirstItemId = 0;       // don't use ATTR_VALUE_FORMAT value
    2192                 :            :                         }
    2193                 :            : 
    2194                 :         18 :                         rSecondItemId = ATTR_LANGUAGE_FORMAT;
    2195                 :            :                     }
    2196                 :            :                 }
    2197                 :            :                 else
    2198         [ #  # ]:          0 :                     throw lang::IllegalArgumentException();
    2199                 :            :             }
    2200                 :         91 :             break;
    2201                 :            :         case ATTR_INDENT:
    2202                 :            :             {
    2203                 :         16 :                 sal_Int16 nIntVal = 0;
    2204         [ +  - ]:         16 :                 if ( rValue >>= nIntVal )
    2205 [ +  - ][ +  - ]:         16 :                     rSet.Put( SfxUInt16Item( rEntry.nWID, (sal_uInt16)HMMToTwips(nIntVal) ) );
                 [ +  - ]
    2206                 :            :                 else
    2207         [ #  # ]:          0 :                     throw lang::IllegalArgumentException();
    2208                 :            :             }
    2209                 :         16 :             break;
    2210                 :            :         case ATTR_ROTATE_VALUE:
    2211                 :            :             {
    2212                 :          7 :                 sal_Int32 nRotVal = 0;
    2213         [ +  - ]:          7 :                 if ( rValue >>= nRotVal )
    2214                 :            :                 {
    2215                 :            :                     //  stored value is always between 0 and 360 deg.
    2216                 :          7 :                     nRotVal %= 36000;
    2217         [ -  + ]:          7 :                     if ( nRotVal < 0 )
    2218                 :          0 :                         nRotVal += 36000;
    2219                 :            : 
    2220 [ +  - ][ +  - ]:          7 :                     rSet.Put( SfxInt32Item( ATTR_ROTATE_VALUE, nRotVal ) );
                 [ +  - ]
    2221                 :            :                 }
    2222                 :            :                 else
    2223         [ #  # ]:          0 :                     throw lang::IllegalArgumentException();
    2224                 :            :             }
    2225                 :          7 :             break;
    2226                 :            :         case ATTR_STACKED:
    2227                 :            :             {
    2228                 :            :                 table::CellOrientation eOrient;
    2229 [ +  - ][ +  - ]:          7 :                 if( rValue >>= eOrient )
    2230                 :            :                 {
    2231   [ -  +  -  -  :          7 :                     switch( eOrient )
                      - ]
    2232                 :            :                     {
    2233                 :            :                         case table::CellOrientation_STANDARD:
    2234 [ #  # ][ #  # ]:          0 :                             rSet.Put( SfxBoolItem( ATTR_STACKED, false ) );
                 [ #  # ]
    2235                 :          0 :                         break;
    2236                 :            :                         case table::CellOrientation_TOPBOTTOM:
    2237 [ +  - ][ +  - ]:          7 :                             rSet.Put( SfxBoolItem( ATTR_STACKED, false ) );
                 [ +  - ]
    2238 [ +  - ][ +  - ]:          7 :                             rSet.Put( SfxInt32Item( ATTR_ROTATE_VALUE, 27000 ) );
                 [ +  - ]
    2239                 :          7 :                             rSecondItemId = ATTR_ROTATE_VALUE;
    2240                 :          7 :                         break;
    2241                 :            :                         case table::CellOrientation_BOTTOMTOP:
    2242 [ #  # ][ #  # ]:          0 :                             rSet.Put( SfxBoolItem( ATTR_STACKED, false ) );
                 [ #  # ]
    2243 [ #  # ][ #  # ]:          0 :                             rSet.Put( SfxInt32Item( ATTR_ROTATE_VALUE, 9000 ) );
                 [ #  # ]
    2244                 :          0 :                             rSecondItemId = ATTR_ROTATE_VALUE;
    2245                 :          0 :                         break;
    2246                 :            :                         case table::CellOrientation_STACKED:
    2247 [ #  # ][ #  # ]:          0 :                             rSet.Put( SfxBoolItem( ATTR_STACKED, sal_True ) );
                 [ #  # ]
    2248                 :          7 :                         break;
    2249                 :            :                         default:
    2250                 :            :                         {
    2251                 :            :                             // added to avoid warnings
    2252                 :            :                         }
    2253                 :            :                     }
    2254                 :            :                 }
    2255                 :            :             }
    2256                 :          7 :             break;
    2257                 :            :         default:
    2258                 :            :             {
    2259                 :       2057 :                 lcl_GetCellsPropertySet()->setPropertyValue(rEntry, rValue, rSet);
    2260                 :            :             }
    2261                 :            :     }
    2262                 :       2173 : }
    2263                 :            : 
    2264                 :       1182 : void SAL_CALL ScCellRangesBase::setPropertyValue(
    2265                 :            :                         const rtl::OUString& aPropertyName, const uno::Any& aValue )
    2266                 :            :                 throw(beans::UnknownPropertyException, beans::PropertyVetoException,
    2267                 :            :                         lang::IllegalArgumentException, lang::WrappedTargetException,
    2268                 :            :                         uno::RuntimeException)
    2269                 :            : {
    2270         [ +  - ]:       1182 :     SolarMutexGuard aGuard;
    2271                 :            : 
    2272 [ +  - ][ +  - ]:       1182 :     if ( !pDocShell || aRanges.empty() )
         [ -  + ][ -  + ]
    2273         [ #  # ]:          0 :         throw uno::RuntimeException();
    2274                 :            : 
    2275         [ +  - ]:       1182 :     const SfxItemPropertyMap& rPropertyMap = GetItemPropertyMap();     // from derived class
    2276         [ +  - ]:       1182 :     const SfxItemPropertySimpleEntry* pEntry = rPropertyMap.getByName( aPropertyName );
    2277         [ -  + ]:       1182 :     if ( !pEntry )
    2278         [ #  # ]:          0 :         throw beans::UnknownPropertyException();
    2279                 :            : 
    2280 [ +  + ][ +  - ]:       1182 :     SetOnePropertyValue( pEntry, aValue );
    2281                 :       1180 : }
    2282                 :            : 
    2283                 :       1389 : void ScCellRangesBase::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry, const uno::Any& aValue )
    2284                 :            :                                 throw(lang::IllegalArgumentException, uno::RuntimeException)
    2285                 :            : {
    2286         [ +  - ]:       1389 :     if ( pEntry )
    2287                 :            :     {
    2288         [ +  + ]:       1389 :         if ( IsScItemWid( pEntry->nWID ) )
    2289                 :            :         {
    2290         [ +  - ]:        484 :             if ( !aRanges.empty() )     // leer = nichts zu tun
    2291                 :            :             {
    2292                 :        484 :                 ScDocument* pDoc = pDocShell->GetDocument();
    2293                 :            : 
    2294                 :            :                 //  Fuer Teile von zusammengesetzten Items mit mehreren Properties (z.B. Hintergrund)
    2295                 :            :                 //  muss vorher das alte Item aus dem Dokument geholt werden
    2296                 :            :                 //! Das kann hier aber nicht erkannt werden
    2297                 :            :                 //! -> eigenes Flag im PropertyMap-Eintrag, oder was ???
    2298                 :            :                 //! Item direkt von einzelner Position im Bereich holen?
    2299                 :            :                 //  ClearInvalidItems, damit auf jeden Fall ein Item vom richtigen Typ da ist
    2300                 :            : 
    2301 [ +  - ][ +  - ]:        484 :                 ScPatternAttr aPattern( *GetCurrentAttrsDeep() );
    2302                 :        484 :                 SfxItemSet& rSet = aPattern.GetItemSet();
    2303         [ +  - ]:        484 :                 rSet.ClearInvalidItems();
    2304                 :            : 
    2305                 :            :                 sal_uInt16 nFirstItem, nSecondItem;
    2306         [ +  + ]:        484 :                 lcl_SetCellProperty( *pEntry, aValue, aPattern, pDoc, nFirstItem, nSecondItem );
    2307                 :            : 
    2308         [ +  + ]:      27474 :                 for (sal_uInt16 nWhich = ATTR_PATTERN_START; nWhich <= ATTR_PATTERN_END; nWhich++)
    2309 [ +  + ][ +  + ]:      26992 :                     if ( nWhich != nFirstItem && nWhich != nSecondItem )
    2310         [ +  - ]:      26494 :                         rSet.ClearItem(nWhich);
    2311                 :            : 
    2312 [ +  - ][ +  - ]:        484 :                 pDocShell->GetDocFunc().ApplyAttributes( *GetMarkData(), aPattern, sal_True, sal_True );
                 [ +  - ]
    2313                 :            :             }
    2314                 :            :         }
    2315                 :            :         else        // implemented here
    2316   [ +  +  +  +  :        905 :             switch ( pEntry->nWID )
             +  +  +  +  
                      + ]
    2317                 :            :             {
    2318                 :            :                 case EE_CHAR_ESCAPEMENT:    // Specifically for xlsx import
    2319                 :            :                     {
    2320                 :          1 :                         sal_Int32 nValue(0);
    2321                 :          1 :                         aValue >>= nValue;
    2322         [ -  + ]:          1 :                         if( nValue )
    2323                 :            :                         {
    2324         [ #  # ]:          0 :                             size_t n = aRanges.size();
    2325         [ #  # ]:          0 :                             for( size_t i = 0; i < n; i++ )
    2326                 :            :                             {
    2327         [ #  # ]:          0 :                                 ScRange aRange( *aRanges[ i ] );
    2328                 :            :                                 /* TODO: Iterate through the range */
    2329                 :          0 :                                 ScAddress  aAddr = aRange.aStart;
    2330                 :          0 :                                 ScDocument *pDoc = pDocShell->GetDocument();
    2331         [ #  # ]:          0 :                                 ScBaseCell *pCell = pDoc->GetCell( aAddr );
    2332 [ #  # ][ #  # ]:          0 :                                 String aStr( pCell->GetStringData() );
    2333 [ #  # ][ #  # ]:          0 :                                 EditEngine aEngine( pDoc->GetEnginePool() );
    2334                 :            :                                 /* EE_CHAR_ESCAPEMENT seems to be set on the cell _only_ when
    2335                 :            :                                  * there are no other attribs for the cell.
    2336                 :            :                                  * So, it is safe to overwrite the complete attribute set.
    2337                 :            :                                  * If there is a need - getting CellType and processing
    2338                 :            :                                  * the attributes could be considered.
    2339                 :            :                                  */
    2340 [ #  # ][ #  # ]:          0 :                                 SfxItemSet aAttr = aEngine.GetEmptyItemSet();
    2341         [ #  # ]:          0 :                                 aEngine.SetText( aStr );
    2342         [ #  # ]:          0 :                                 if( nValue < 0 )    // Subscript
    2343 [ #  # ][ #  # ]:          0 :                                     aAttr.Put( SvxEscapementItem( SVX_ESCAPEMENT_SUBSCRIPT, EE_CHAR_ESCAPEMENT ) );
                 [ #  # ]
    2344                 :            :                                 else                // Superscript
    2345 [ #  # ][ #  # ]:          0 :                                     aAttr.Put( SvxEscapementItem( SVX_ESCAPEMENT_SUPERSCRIPT, EE_CHAR_ESCAPEMENT ) );
                 [ #  # ]
    2346         [ #  # ]:          0 :                                 aEngine.QuickSetAttribs( aAttr, ESelection( 0, 0, 0, aStr.Len()));
    2347 [ #  # ][ #  # ]:          0 :                                 pDoc->PutCell( (aRanges[ 0 ])->aStart, new ScEditCell( aEngine.CreateTextObject(), pDoc, NULL ) );
         [ #  # ][ #  # ]
                 [ #  # ]
    2348 [ #  # ][ #  # ]:          0 :                             }
                 [ #  # ]
    2349                 :            :                         }
    2350                 :            :                     }
    2351                 :          1 :                     break;
    2352                 :            :                 case SC_WID_UNO_CHCOLHDR:
    2353                 :            :                     // chart header flags are set for this object, not stored with document
    2354                 :          9 :                     bChartColAsHdr = ScUnoHelpFunctions::GetBoolFromAny( aValue );
    2355                 :          9 :                     break;
    2356                 :            :                 case SC_WID_UNO_CHROWHDR:
    2357                 :          9 :                     bChartRowAsHdr = ScUnoHelpFunctions::GetBoolFromAny( aValue );
    2358                 :          9 :                     break;
    2359                 :            :                 case SC_WID_UNO_CELLSTYL:
    2360                 :            :                     {
    2361                 :        813 :                         rtl::OUString aStrVal;
    2362                 :        813 :                         aValue >>= aStrVal;
    2363                 :            :                         String aString(ScStyleNameConversion::ProgrammaticToDisplayName(
    2364 [ +  - ][ +  - ]:        813 :                                                             aStrVal, SFX_STYLE_FAMILY_PARA ));
                 [ +  - ]
    2365 [ +  - ][ +  - ]:        813 :                         pDocShell->GetDocFunc().ApplyStyle( *GetMarkData(), aString, sal_True, sal_True );
                 [ +  - ]
    2366                 :            :                     }
    2367                 :        813 :                     break;
    2368                 :            :                 case SC_WID_UNO_TBLBORD:
    2369                 :            :                     {
    2370                 :          7 :                         table::TableBorder aBorder;
    2371 [ +  - ][ +  - ]:          7 :                         if ( !aRanges.empty() && ( aValue >>= aBorder ) )   // empty = nothing to do
         [ +  - ][ +  - ]
                 [ +  - ]
    2372                 :            :                         {
    2373         [ +  - ]:          7 :                             SvxBoxItem aOuter(ATTR_BORDER);
    2374         [ +  - ]:          7 :                             SvxBoxInfoItem aInner(ATTR_BORDER_INNER);
    2375         [ +  - ]:          7 :                             ScHelperFunctions::FillBoxItems( aOuter, aInner, aBorder );
    2376                 :            : 
    2377 [ +  - ][ +  - ]:          7 :                             ScHelperFunctions::ApplyBorder( pDocShell, aRanges, aOuter, aInner );   //! docfunc
                 [ +  - ]
    2378                 :            :                         }
    2379                 :            :                     }
    2380                 :          7 :                     break;
    2381                 :            :                 case SC_WID_UNO_TBLBORD2:
    2382                 :            :                     {
    2383                 :          3 :                         table::TableBorder2 aBorder2;
    2384 [ +  - ][ +  - ]:          3 :                         if ( !aRanges.empty() && ( aValue >>= aBorder2 ) )   // empty = nothing to do
         [ -  + ][ -  + ]
                 [ +  - ]
    2385                 :            :                         {
    2386         [ #  # ]:          0 :                             SvxBoxItem aOuter(ATTR_BORDER);
    2387         [ #  # ]:          0 :                             SvxBoxInfoItem aInner(ATTR_BORDER_INNER);
    2388         [ #  # ]:          0 :                             ScHelperFunctions::FillBoxItems( aOuter, aInner, aBorder2 );
    2389                 :            : 
    2390 [ #  # ][ #  # ]:          0 :                             ScHelperFunctions::ApplyBorder( pDocShell, aRanges, aOuter, aInner );   //! docfunc
                 [ #  # ]
    2391                 :            :                         }
    2392                 :            :                     }
    2393                 :          3 :                     break;
    2394                 :            :                 case SC_WID_UNO_CONDFMT:
    2395                 :            :                 case SC_WID_UNO_CONDLOC:
    2396                 :            :                 case SC_WID_UNO_CONDXML:
    2397                 :            :                     {
    2398         [ +  - ]:         37 :                         uno::Reference<sheet::XSheetConditionalEntries> xInterface(aValue, uno::UNO_QUERY);
    2399 [ +  - ][ +  - ]:         37 :                         if ( !aRanges.empty() && xInterface.is() )  // leer = nichts zu tun
         [ +  + ][ +  + ]
    2400                 :            :                         {
    2401                 :            :                             ScTableConditionalFormat* pFormat =
    2402         [ +  - ]:         29 :                                     ScTableConditionalFormat::getImplementation( xInterface );
    2403         [ +  - ]:         29 :                             if (pFormat)
    2404                 :            :                             {
    2405                 :         29 :                                 ScDocument* pDoc = pDocShell->GetDocument();
    2406                 :         29 :                                 sal_Bool bEnglish = ( pEntry->nWID != SC_WID_UNO_CONDLOC );
    2407                 :         29 :                                 sal_Bool bXML = ( pEntry->nWID == SC_WID_UNO_CONDXML );
    2408                 :            :                                 formula::FormulaGrammar::Grammar eGrammar = (bXML ?
    2409                 :            :                                        formula::FormulaGrammar::GRAM_UNSPECIFIED :
    2410         [ +  + ]:         29 :                                        formula::FormulaGrammar::mapAPItoGrammar( bEnglish, bXML));
    2411                 :            : 
    2412 [ +  - ][ +  - ]:         29 :                                 ScConditionalFormat* pNew = new ScConditionalFormat( 0, pDoc );    // Index wird beim Einfuegen gesetzt
    2413         [ +  - ]:         29 :                                 pFormat->FillFormat( *pNew, pDoc, eGrammar );
    2414         [ +  - ]:         29 :                                 pNew->AddRange( aRanges );
    2415 [ +  - ][ +  - ]:         29 :                                 sal_uLong nIndex = pDoc->AddCondFormat( pNew, aRanges.front()->aStart.Tab() );
    2416                 :            : 
    2417 [ +  - ][ +  - ]:         29 :                                 ScPatternAttr aPattern( pDoc->GetPool() );
    2418 [ +  - ][ +  - ]:         29 :                                 aPattern.GetItemSet().Put( SfxUInt32Item( ATTR_CONDITIONAL, nIndex ) );
                 [ +  - ]
    2419 [ +  - ][ +  - ]:         29 :                                 pDocShell->GetDocFunc().ApplyAttributes( *GetMarkData(), aPattern, sal_True, sal_True );
                 [ +  - ]
    2420                 :            :                             }
    2421                 :         37 :                         }
    2422                 :            :                     }
    2423                 :         37 :                     break;
    2424                 :            :                 case SC_WID_UNO_VALIDAT:
    2425                 :            :                 case SC_WID_UNO_VALILOC:
    2426                 :            :                 case SC_WID_UNO_VALIXML:
    2427                 :            :                     {
    2428         [ +  - ]:         17 :                         uno::Reference<beans::XPropertySet> xInterface(aValue, uno::UNO_QUERY);
    2429 [ +  - ][ +  - ]:         17 :                         if ( !aRanges.empty() && xInterface.is() )  // leer = nichts zu tun
         [ +  + ][ +  + ]
    2430                 :            :                         {
    2431                 :            :                             ScTableValidationObj* pValidObj =
    2432         [ +  - ]:          9 :                                     ScTableValidationObj::getImplementation( xInterface );
    2433         [ +  - ]:          9 :                             if (pValidObj)
    2434                 :            :                             {
    2435                 :          9 :                                 ScDocument* pDoc = pDocShell->GetDocument();
    2436                 :          9 :                                 sal_Bool bEnglish = ( pEntry->nWID != SC_WID_UNO_VALILOC );
    2437                 :          9 :                                 sal_Bool bXML = ( pEntry->nWID == SC_WID_UNO_VALIXML );
    2438                 :            :                                 formula::FormulaGrammar::Grammar eGrammar = (bXML ?
    2439                 :            :                                        formula::FormulaGrammar::GRAM_UNSPECIFIED :
    2440         [ +  + ]:          9 :                                        formula::FormulaGrammar::mapAPItoGrammar( bEnglish, bXML));
    2441                 :            : 
    2442                 :            :                                 ScValidationData* pNewData =
    2443         [ +  - ]:          9 :                                         pValidObj->CreateValidationData( pDoc, eGrammar );
    2444         [ +  - ]:          9 :                                 sal_uLong nIndex = pDoc->AddValidationEntry( *pNewData );
    2445 [ +  - ][ +  - ]:          9 :                                 delete pNewData;
    2446                 :            : 
    2447 [ +  - ][ +  - ]:          9 :                                 ScPatternAttr aPattern( pDoc->GetPool() );
    2448 [ +  - ][ +  - ]:          9 :                                 aPattern.GetItemSet().Put( SfxUInt32Item( ATTR_VALIDDATA, nIndex ) );
                 [ +  - ]
    2449 [ +  - ][ +  - ]:          9 :                                 pDocShell->GetDocFunc().ApplyAttributes( *GetMarkData(), aPattern, sal_True, sal_True );
                 [ +  - ]
    2450                 :            :                             }
    2451                 :         17 :                         }
    2452                 :            :                     }
    2453                 :       1387 :                     break;
    2454                 :            :                 // SC_WID_UNO_NUMRULES is ignored...
    2455                 :            :             }
    2456                 :            :     }
    2457                 :       1387 : }
    2458                 :            : 
    2459                 :       2025 : uno::Any SAL_CALL ScCellRangesBase::getPropertyValue( const rtl::OUString& aPropertyName )
    2460                 :            :                 throw(beans::UnknownPropertyException, lang::WrappedTargetException,
    2461                 :            :                         uno::RuntimeException)
    2462                 :            : {
    2463         [ +  - ]:       2025 :     SolarMutexGuard aGuard;
    2464                 :            : 
    2465 [ +  - ][ +  - ]:       2025 :     if ( !pDocShell || aRanges.empty() )
         [ -  + ][ -  + ]
    2466         [ #  # ]:          0 :         throw uno::RuntimeException();
    2467                 :            : 
    2468         [ +  - ]:       2025 :     const SfxItemPropertyMap& rPropertyMap = GetItemPropertyMap();     // from derived class
    2469         [ +  - ]:       2025 :     const SfxItemPropertySimpleEntry* pEntry = rPropertyMap.getByName( aPropertyName );
    2470         [ +  + ]:       2025 :     if ( !pEntry )
    2471         [ +  - ]:          6 :         throw beans::UnknownPropertyException();
    2472                 :            : 
    2473                 :       2019 :     uno::Any aAny;
    2474         [ +  - ]:       2019 :     GetOnePropertyValue( pEntry, aAny );
    2475         [ +  - ]:       2025 :     return aAny;
    2476                 :            : }
    2477                 :            : 
    2478                 :       3199 : void ScCellRangesBase::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry,
    2479                 :            :                                                 uno::Any& rAny )
    2480                 :            :                                                 throw(uno::RuntimeException)
    2481                 :            : {
    2482         [ +  - ]:       3199 :     if ( pEntry )
    2483                 :            :     {
    2484         [ +  + ]:       3199 :         if ( IsScItemWid( pEntry->nWID ) )
    2485                 :            :         {
    2486                 :       2824 :             SfxItemSet* pDataSet = GetCurrentDataSet();
    2487         [ +  - ]:       2824 :             if ( pDataSet )
    2488                 :            :             {
    2489   [ +  +  +  + ]:       2824 :                 switch ( pEntry->nWID )     // fuer Item-Spezial-Behandlungen
    2490                 :            :                 {
    2491                 :            :                     case ATTR_VALUE_FORMAT:
    2492                 :            :                         {
    2493                 :        205 :                             ScDocument* pDoc = pDocShell->GetDocument();
    2494                 :            : 
    2495                 :            :                             sal_uLong nOldFormat = ((const SfxUInt32Item&)
    2496                 :        205 :                                     pDataSet->Get( ATTR_VALUE_FORMAT )).GetValue();
    2497                 :            :                             LanguageType eOldLang = ((const SvxLanguageItem&)
    2498                 :        205 :                                     pDataSet->Get( ATTR_LANGUAGE_FORMAT )).GetLanguage();
    2499                 :            :                             nOldFormat = pDoc->GetFormatTable()->
    2500                 :        205 :                                     GetFormatForLanguageIfBuiltIn( nOldFormat, eOldLang );
    2501         [ +  - ]:        205 :                             rAny <<= (sal_Int32)( nOldFormat );
    2502                 :            :                         }
    2503                 :        205 :                         break;
    2504                 :            :                     case ATTR_INDENT:
    2505                 :            :                         rAny <<= (sal_Int16)( TwipsToHMM(((const SfxUInt16Item&)
    2506         [ +  - ]:         46 :                                         pDataSet->Get(pEntry->nWID)).GetValue()) );
    2507                 :         46 :                         break;
    2508                 :            :                     case ATTR_STACKED:
    2509                 :            :                         {
    2510                 :         29 :                             sal_Int32 nRot = ((const SfxInt32Item&)pDataSet->Get(ATTR_ROTATE_VALUE)).GetValue();
    2511                 :         29 :                             sal_Bool bStacked = ((const SfxBoolItem&)pDataSet->Get(pEntry->nWID)).GetValue();
    2512         [ +  - ]:         29 :                             SvxOrientationItem( nRot, bStacked, 0 ).QueryValue( rAny );
    2513                 :            :                         }
    2514                 :         29 :                         break;
    2515                 :            :                     default:
    2516                 :       2824 :                         pPropSet->getPropertyValue(*pEntry, *pDataSet, rAny);
    2517                 :            :                 }
    2518                 :            :             }
    2519                 :            :         }
    2520                 :            :         else        // implemented here
    2521   [ +  +  +  +  :        375 :             switch ( pEntry->nWID )
             +  +  +  +  
                      + ]
    2522                 :            :             {
    2523                 :            :                 case SC_WID_UNO_CHCOLHDR:
    2524                 :         34 :                     ScUnoHelpFunctions::SetBoolInAny( rAny, bChartColAsHdr );
    2525                 :         34 :                     break;
    2526                 :            :                 case SC_WID_UNO_CHROWHDR:
    2527                 :         34 :                     ScUnoHelpFunctions::SetBoolInAny( rAny, bChartRowAsHdr );
    2528                 :         34 :                     break;
    2529                 :            :                 case SC_WID_UNO_CELLSTYL:
    2530                 :            :                     {
    2531         [ +  - ]:         34 :                         String aStyleName;
    2532 [ +  - ][ +  - ]:         34 :                         const ScStyleSheet* pStyle = pDocShell->GetDocument()->GetSelectionStyle(*GetMarkData());
    2533         [ +  - ]:         34 :                         if (pStyle)
    2534 [ +  - ][ +  - ]:         34 :                             aStyleName = pStyle->GetName();
    2535                 :            :                         rAny <<= rtl::OUString( ScStyleNameConversion::DisplayToProgrammaticName(
    2536 [ +  - ][ +  - ]:         34 :                                                                 aStyleName, SFX_STYLE_FAMILY_PARA ) );
         [ +  - ][ +  - ]
                 [ +  - ]
    2537                 :            :                     }
    2538                 :         34 :                     break;
    2539                 :            :                 case SC_WID_UNO_TBLBORD:
    2540                 :            :                 case SC_WID_UNO_TBLBORD2:
    2541                 :            :                     {
    2542                 :            :                         //! loop throgh all ranges
    2543         [ +  - ]:         50 :                         if ( !aRanges.empty() )
    2544                 :            :                         {
    2545         [ +  - ]:         50 :                             const ScRange* pFirst = aRanges[ 0 ];
    2546         [ +  - ]:         50 :                             SvxBoxItem aOuter(ATTR_BORDER);
    2547         [ +  - ]:         50 :                             SvxBoxInfoItem aInner(ATTR_BORDER_INNER);
    2548                 :            : 
    2549                 :         50 :                             ScDocument* pDoc = pDocShell->GetDocument();
    2550         [ +  - ]:         50 :                             ScMarkData aMark;
    2551         [ +  - ]:         50 :                             aMark.SetMarkArea( *pFirst );
    2552         [ +  - ]:         50 :                             aMark.SelectTable( pFirst->aStart.Tab(), sal_True );
    2553         [ +  - ]:         50 :                             pDoc->GetSelectionFrame( aMark, aOuter, aInner );
    2554                 :            : 
    2555         [ +  + ]:         50 :                             if (pEntry->nWID == SC_WID_UNO_TBLBORD2)
    2556         [ +  - ]:         21 :                                 ScHelperFunctions::AssignTableBorder2ToAny( rAny, aOuter, aInner);
    2557                 :            :                             else
    2558 [ +  - ][ +  - ]:         50 :                                 ScHelperFunctions::AssignTableBorderToAny( rAny, aOuter, aInner);
         [ +  - ][ +  - ]
    2559                 :            :                         }
    2560                 :            :                     }
    2561                 :         50 :                     break;
    2562                 :            :                 case SC_WID_UNO_CONDFMT:
    2563                 :            :                 case SC_WID_UNO_CONDLOC:
    2564                 :            :                 case SC_WID_UNO_CONDXML:
    2565                 :            :                     {
    2566                 :         92 :                         const ScPatternAttr* pPattern = GetCurrentAttrsDeep();
    2567         [ +  - ]:         92 :                         if ( pPattern )
    2568                 :            :                         {
    2569                 :         92 :                             ScDocument* pDoc = pDocShell->GetDocument();
    2570                 :         92 :                             sal_Bool bEnglish = ( pEntry->nWID != SC_WID_UNO_CONDLOC );
    2571                 :         92 :                             sal_Bool bXML = ( pEntry->nWID == SC_WID_UNO_CONDXML );
    2572                 :            :                             formula::FormulaGrammar::Grammar eGrammar = (bXML ?
    2573                 :            :                                     pDoc->GetStorageGrammar() :
    2574         [ +  + ]:         92 :                                    formula::FormulaGrammar::mapAPItoGrammar( bEnglish, bXML));
    2575                 :            :                             sal_uLong nIndex = ((const SfxUInt32Item&)
    2576                 :         92 :                                     pPattern->GetItem(ATTR_CONDITIONAL)).GetValue();
    2577                 :            :                             rAny <<= uno::Reference<sheet::XSheetConditionalEntries>(
    2578 [ +  - ][ +  - ]:         92 :                                     new ScTableConditionalFormat( pDoc, nIndex, aRanges.front()->aStart.Tab(), eGrammar ));
                 [ +  - ]
    2579                 :            :                         }
    2580                 :            :                     }
    2581                 :         92 :                     break;
    2582                 :            :                 case SC_WID_UNO_VALIDAT:
    2583                 :            :                 case SC_WID_UNO_VALILOC:
    2584                 :            :                 case SC_WID_UNO_VALIXML:
    2585                 :            :                     {
    2586                 :         80 :                         const ScPatternAttr* pPattern = GetCurrentAttrsDeep();
    2587         [ +  - ]:         80 :                         if ( pPattern )
    2588                 :            :                         {
    2589                 :         80 :                             ScDocument* pDoc = pDocShell->GetDocument();
    2590                 :         80 :                             sal_Bool bEnglish = ( pEntry->nWID != SC_WID_UNO_VALILOC );
    2591                 :         80 :                             sal_Bool bXML = ( pEntry->nWID == SC_WID_UNO_VALIXML );
    2592                 :            :                             formula::FormulaGrammar::Grammar eGrammar = (bXML ?
    2593                 :            :                                     pDoc->GetStorageGrammar() :
    2594         [ +  + ]:         80 :                                    formula::FormulaGrammar::mapAPItoGrammar( bEnglish, bXML));
    2595                 :            :                             sal_uLong nIndex = ((const SfxUInt32Item&)
    2596                 :         80 :                                     pPattern->GetItem(ATTR_VALIDDATA)).GetValue();
    2597                 :            :                             rAny <<= uno::Reference<beans::XPropertySet>(
    2598 [ +  - ][ +  - ]:         80 :                                     new ScTableValidationObj( pDoc, nIndex, eGrammar ));
                 [ +  - ]
    2599                 :            :                         }
    2600                 :            :                     }
    2601                 :         80 :                     break;
    2602                 :            :                 case SC_WID_UNO_NUMRULES:
    2603                 :            :                     {
    2604                 :            :                         // always return empty numbering rules object
    2605         [ +  - ]:         21 :                         rAny <<= uno::Reference<container::XIndexReplace>(ScStyleObj::CreateEmptyNumberingRules());
    2606                 :            :                     }
    2607                 :         21 :                     break;
    2608                 :            :                 case SC_WID_UNO_ABSNAME:
    2609                 :            :                     {
    2610         [ +  - ]:         22 :                         String sRet;
    2611         [ +  - ]:         22 :                         aRanges.Format(sRet, SCR_ABS_3D, pDocShell->GetDocument());
    2612 [ +  - ][ +  - ]:       3199 :                         rAny <<= rtl::OUString(sRet);
                 [ +  - ]
    2613                 :            :                     }
    2614                 :            :             }
    2615                 :            :     }
    2616                 :       3199 : }
    2617                 :            : 
    2618                 :          0 : void SAL_CALL ScCellRangesBase::addPropertyChangeListener( const rtl::OUString& /* aPropertyName */,
    2619                 :            :                             const uno::Reference<beans::XPropertyChangeListener>& /* aListener */)
    2620                 :            :                             throw(beans::UnknownPropertyException,
    2621                 :            :                                     lang::WrappedTargetException, uno::RuntimeException)
    2622                 :            : {
    2623         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    2624 [ #  # ][ #  # ]:          0 :     if ( aRanges.empty() )
    2625         [ #  # ]:          0 :         throw uno::RuntimeException();
    2626                 :            : 
    2627         [ #  # ]:          0 :     OSL_FAIL("not implemented");
    2628                 :          0 : }
    2629                 :            : 
    2630                 :          0 : void SAL_CALL ScCellRangesBase::removePropertyChangeListener( const rtl::OUString& /* aPropertyName */,
    2631                 :            :                             const uno::Reference<beans::XPropertyChangeListener>& /* aListener */)
    2632                 :            :                             throw(beans::UnknownPropertyException,
    2633                 :            :                                     lang::WrappedTargetException, uno::RuntimeException)
    2634                 :            : {
    2635         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    2636 [ #  # ][ #  # ]:          0 :     if ( aRanges.empty() )
    2637         [ #  # ]:          0 :         throw uno::RuntimeException();
    2638                 :            : 
    2639         [ #  # ]:          0 :     OSL_FAIL("not implemented");
    2640                 :          0 : }
    2641                 :            : 
    2642                 :          0 : void SAL_CALL ScCellRangesBase::addVetoableChangeListener( const rtl::OUString&,
    2643                 :            :                             const uno::Reference<beans::XVetoableChangeListener>&)
    2644                 :            :                             throw(beans::UnknownPropertyException,
    2645                 :            :                                 lang::WrappedTargetException, uno::RuntimeException)
    2646                 :            : {
    2647                 :            :     OSL_FAIL("not implemented");
    2648                 :          0 : }
    2649                 :            : 
    2650                 :          0 : void SAL_CALL ScCellRangesBase::removeVetoableChangeListener( const rtl::OUString&,
    2651                 :            :                             const uno::Reference<beans::XVetoableChangeListener>&)
    2652                 :            :                             throw(beans::UnknownPropertyException,
    2653                 :            :                                 lang::WrappedTargetException, uno::RuntimeException)
    2654                 :            : {
    2655                 :            :     OSL_FAIL("not implemented");
    2656                 :          0 : }
    2657                 :            : 
    2658                 :            : // XMultiPropertySet
    2659                 :            : 
    2660                 :         96 : void SAL_CALL ScCellRangesBase::setPropertyValues( const uno::Sequence< rtl::OUString >& aPropertyNames,
    2661                 :            :                                     const uno::Sequence< uno::Any >& aValues )
    2662                 :            :                                 throw (beans::PropertyVetoException,
    2663                 :            :                                     lang::IllegalArgumentException,
    2664                 :            :                                     lang::WrappedTargetException,
    2665                 :            :                                     uno::RuntimeException)
    2666                 :            : {
    2667         [ +  - ]:         96 :     SolarMutexGuard aGuard;
    2668                 :            : 
    2669                 :         96 :     sal_Int32 nCount(aPropertyNames.getLength());
    2670                 :         96 :     sal_Int32 nValues(aValues.getLength());
    2671         [ -  + ]:         96 :     if (nCount != nValues)
    2672 [ #  # ][ #  # ]:          0 :         throw lang::IllegalArgumentException();
    2673                 :            : 
    2674 [ +  - ][ +  - ]:         96 :     if ( pDocShell && nCount )
    2675                 :            :     {
    2676         [ +  - ]:         96 :         const SfxItemPropertyMap& rPropertyMap = GetItemPropertyMap();      // from derived class
    2677                 :         96 :         const rtl::OUString* pNames = aPropertyNames.getConstArray();
    2678                 :         96 :         const uno::Any* pValues = aValues.getConstArray();
    2679                 :            : 
    2680         [ +  - ]:         96 :         const SfxItemPropertySimpleEntry** pEntryArray = new const SfxItemPropertySimpleEntry*[nCount];
    2681                 :            : 
    2682                 :            :         sal_Int32 i;
    2683         [ +  + ]:        303 :         for(i = 0; i < nCount; i++)
    2684                 :            :         {
    2685                 :            :             // first loop: find all properties in map, but handle only CellStyle
    2686                 :            :             // (CellStyle must be set before any other cell properties)
    2687                 :            : 
    2688         [ +  - ]:        207 :             const SfxItemPropertySimpleEntry* pEntry = rPropertyMap.getByName( pNames[i] );
    2689                 :        207 :             pEntryArray[i] = pEntry;
    2690         [ +  - ]:        207 :             if (pEntry)
    2691                 :            :             {
    2692         [ +  + ]:        207 :                 if ( pEntry->nWID == SC_WID_UNO_CELLSTYL )
    2693                 :            :                 {
    2694                 :            :                     try
    2695                 :            :                     {
    2696         [ +  - ]:         96 :                         SetOnePropertyValue( pEntry, pValues[i] );
    2697                 :            :                     }
    2698         [ #  # ]:          0 :                     catch ( lang::IllegalArgumentException& )
    2699                 :            :                     {
    2700                 :            :                         OSL_FAIL("exception when setting cell style");     // not supposed to happen
    2701                 :            :                     }
    2702                 :            :                 }
    2703                 :            :             }
    2704                 :            :         }
    2705                 :            : 
    2706                 :         96 :         ScDocument* pDoc = pDocShell->GetDocument();
    2707                 :         96 :         ScPatternAttr* pOldPattern = NULL;
    2708                 :         96 :         ScPatternAttr* pNewPattern = NULL;
    2709                 :            : 
    2710         [ +  + ]:        303 :         for(i = 0; i < nCount; i++)
    2711                 :            :         {
    2712                 :            :             // second loop: handle other properties
    2713                 :            : 
    2714                 :        207 :             const SfxItemPropertySimpleEntry* pEntry = pEntryArray[i];
    2715         [ +  - ]:        207 :             if ( pEntry )
    2716                 :            :             {
    2717         [ +  + ]:        207 :                 if ( IsScItemWid( pEntry->nWID ) )  // can be handled by SfxItemPropertySet
    2718                 :            :                 {
    2719         [ +  + ]:        102 :                     if ( !pOldPattern )
    2720                 :            :                     {
    2721 [ +  - ][ +  - ]:         90 :                         pOldPattern = new ScPatternAttr( *GetCurrentAttrsDeep() );
                 [ +  - ]
    2722         [ +  - ]:         90 :                         pOldPattern->GetItemSet().ClearInvalidItems();
    2723 [ +  - ][ +  - ]:         90 :                         pNewPattern = new ScPatternAttr( pDoc->GetPool() );
                 [ +  - ]
    2724                 :            :                     }
    2725                 :            : 
    2726                 :            :                     //  collect items in pNewPattern, apply with one call after the loop
    2727                 :            : 
    2728                 :            :                     sal_uInt16 nFirstItem, nSecondItem;
    2729         [ +  - ]:        102 :                     lcl_SetCellProperty( *pEntry, pValues[i], *pOldPattern, pDoc, nFirstItem, nSecondItem );
    2730                 :            : 
    2731                 :            :                     //  put only affected items into new set
    2732         [ +  - ]:        102 :                     if ( nFirstItem )
    2733 [ +  - ][ +  - ]:        102 :                         pNewPattern->GetItemSet().Put( pOldPattern->GetItemSet().Get( nFirstItem ) );
    2734         [ -  + ]:        102 :                     if ( nSecondItem )
    2735 [ #  # ][ #  # ]:        102 :                         pNewPattern->GetItemSet().Put( pOldPattern->GetItemSet().Get( nSecondItem ) );
    2736                 :            :                 }
    2737         [ +  + ]:        105 :                 else if ( pEntry->nWID != SC_WID_UNO_CELLSTYL )   // CellStyle is handled above
    2738                 :            :                 {
    2739                 :            :                     //  call virtual method to set a single property
    2740         [ +  - ]:          9 :                     SetOnePropertyValue( pEntry, pValues[i] );
    2741                 :            :                 }
    2742                 :            :             }
    2743                 :            :         }
    2744                 :            : 
    2745 [ +  + ][ +  - ]:         96 :         if ( pNewPattern && !aRanges.empty() )
         [ +  - ][ +  + ]
    2746 [ +  - ][ +  - ]:         90 :             pDocShell->GetDocFunc().ApplyAttributes( *GetMarkData(), *pNewPattern, sal_True, sal_True );
    2747                 :            : 
    2748 [ +  + ][ +  - ]:         96 :         delete pNewPattern;
    2749 [ +  + ][ +  - ]:         96 :         delete pOldPattern;
    2750         [ +  - ]:         96 :         delete[] pEntryArray;
    2751         [ +  - ]:         96 :     }
    2752                 :         96 : }
    2753                 :            : 
    2754                 :          0 : uno::Sequence<uno::Any> SAL_CALL ScCellRangesBase::getPropertyValues(
    2755                 :            :                                 const uno::Sequence< rtl::OUString >& aPropertyNames )
    2756                 :            :                                     throw (uno::RuntimeException)
    2757                 :            : {
    2758         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    2759                 :            : 
    2760         [ #  # ]:          0 :     const SfxItemPropertyMap& rPropertyMap = GetItemPropertyMap();     // from derived class
    2761                 :            : 
    2762         [ #  # ]:          0 :     uno::Sequence<uno::Any> aRet(aPropertyNames.getLength());
    2763         [ #  # ]:          0 :     uno::Any* pProperties = aRet.getArray();
    2764         [ #  # ]:          0 :     for(sal_Int32 i = 0; i < aPropertyNames.getLength(); i++)
    2765                 :            :     {
    2766         [ #  # ]:          0 :         const SfxItemPropertySimpleEntry* pEntry = rPropertyMap.getByName( aPropertyNames[i] );
    2767         [ #  # ]:          0 :         GetOnePropertyValue( pEntry, pProperties[i] );
    2768                 :            :     }
    2769         [ #  # ]:          0 :     return aRet;
    2770                 :            : }
    2771                 :            : 
    2772                 :          0 : void SAL_CALL ScCellRangesBase::addPropertiesChangeListener( const uno::Sequence< rtl::OUString >& /* aPropertyNames */,
    2773                 :            :                                     const uno::Reference< beans::XPropertiesChangeListener >& /* xListener */ )
    2774                 :            :                                 throw (uno::RuntimeException)
    2775                 :            : {
    2776                 :            :     OSL_FAIL("not implemented");
    2777                 :          0 : }
    2778                 :            : 
    2779                 :          0 : void SAL_CALL ScCellRangesBase::removePropertiesChangeListener( const uno::Reference< beans::XPropertiesChangeListener >& /* xListener */ )
    2780                 :            :                                 throw (uno::RuntimeException)
    2781                 :            : {
    2782                 :            :     OSL_FAIL("not implemented");
    2783                 :          0 : }
    2784                 :            : 
    2785                 :          0 : void SAL_CALL ScCellRangesBase::firePropertiesChangeEvent( const uno::Sequence< rtl::OUString >& /* aPropertyNames */,
    2786                 :            :                                     const uno::Reference< beans::XPropertiesChangeListener >& /* xListener */ )
    2787                 :            :                                 throw (uno::RuntimeException)
    2788                 :            : {
    2789                 :            :     OSL_FAIL("not implemented");
    2790                 :          0 : }
    2791                 :            : 
    2792                 :         12 : IMPL_LINK( ScCellRangesBase, ValueListenerHdl, SfxHint*, pHint )
    2793                 :            : {
    2794 [ +  - ][ +  - ]:         24 :     if ( pDocShell && pHint && pHint->ISA( SfxSimpleHint ) &&
           [ +  -  +  - ]
                 [ +  - ]
    2795                 :         12 :             ((const SfxSimpleHint*)pHint)->GetId() & (SC_HINT_DATACHANGED | SC_HINT_DYING) )
    2796                 :            :     {
    2797                 :            :         //  This may be called several times for a single change, if several formulas
    2798                 :            :         //  in the range are notified. So only a flag is set that is checked when
    2799                 :            :         //  SFX_HINT_DATACHANGED is received.
    2800                 :            : 
    2801                 :         12 :         bGotDataChangedHint = sal_True;
    2802                 :            :     }
    2803                 :         12 :     return 0;
    2804                 :            : }
    2805                 :            : 
    2806                 :            : // XTolerantMultiPropertySet
    2807                 :        571 : uno::Sequence< beans::SetPropertyTolerantFailed > SAL_CALL ScCellRangesBase::setPropertyValuesTolerant( const uno::Sequence< ::rtl::OUString >& aPropertyNames,
    2808                 :            :                                     const uno::Sequence< uno::Any >& aValues )
    2809                 :            :                                     throw (lang::IllegalArgumentException, uno::RuntimeException)
    2810                 :            : {
    2811         [ +  - ]:        571 :     SolarMutexGuard aGuard;
    2812                 :            : 
    2813                 :        571 :     sal_Int32 nCount(aPropertyNames.getLength());
    2814                 :        571 :     sal_Int32 nValues(aValues.getLength());
    2815         [ -  + ]:        571 :     if (nCount != nValues)
    2816 [ #  # ][ #  # ]:          0 :         throw lang::IllegalArgumentException();
    2817                 :            : 
    2818 [ +  - ][ +  - ]:        571 :     if ( pDocShell && nCount )
    2819                 :            :     {
    2820         [ +  - ]:        571 :         uno::Sequence < beans::SetPropertyTolerantFailed > aReturns(nCount);
    2821         [ +  - ]:        571 :         beans::SetPropertyTolerantFailed* pReturns = aReturns.getArray();
    2822                 :            : 
    2823         [ +  - ]:        571 :         const SfxItemPropertyMap& rPropertyMap = GetItemPropertyMap();     // from derived class
    2824                 :        571 :         const rtl::OUString* pNames = aPropertyNames.getConstArray();
    2825                 :        571 :         const uno::Any* pValues = aValues.getConstArray();
    2826                 :            : 
    2827         [ +  - ]:        571 :         const SfxItemPropertySimpleEntry** pMapArray = new const SfxItemPropertySimpleEntry*[nCount];
    2828                 :            : 
    2829                 :            :         sal_Int32 i;
    2830         [ +  + ]:       3293 :         for(i = 0; i < nCount; i++)
    2831                 :            :         {
    2832                 :            :             // first loop: find all properties in map, but handle only CellStyle
    2833                 :            :             // (CellStyle must be set before any other cell properties)
    2834                 :            : 
    2835         [ +  - ]:       2722 :             const SfxItemPropertySimpleEntry* pEntry = rPropertyMap.getByName( pNames[i] );
    2836                 :       2722 :             pMapArray[i] = pEntry;
    2837         [ +  + ]:       2722 :             if (pEntry)
    2838                 :            :             {
    2839         [ +  + ]:       2650 :                 if ( pEntry->nWID == SC_WID_UNO_CELLSTYL )
    2840                 :            :                 {
    2841                 :            :                     try
    2842                 :            :                     {
    2843         [ +  - ]:        347 :                         SetOnePropertyValue( pEntry, pValues[i] );
    2844                 :            :                     }
    2845         [ #  # ]:          0 :                     catch ( lang::IllegalArgumentException& )
    2846                 :            :                     {
    2847                 :            :                         OSL_FAIL("exception when setting cell style");     // not supposed to happen
    2848                 :            :                     }
    2849                 :            :                 }
    2850                 :            :             }
    2851                 :            :         }
    2852                 :            : 
    2853                 :        571 :         ScDocument* pDoc = pDocShell->GetDocument();
    2854                 :        571 :         ScPatternAttr* pOldPattern = NULL;
    2855                 :        571 :         ScPatternAttr* pNewPattern = NULL;
    2856                 :            : 
    2857                 :        571 :         sal_Int32 nFailed(0);
    2858         [ +  + ]:       3293 :         for(i = 0; i < nCount; i++)
    2859                 :            :         {
    2860                 :            :             // second loop: handle other properties
    2861                 :            : 
    2862                 :       2722 :             const SfxItemPropertySimpleEntry* pEntry = pMapArray[i];
    2863 [ +  + ][ +  + ]:       2722 :             if ( pEntry && ((pEntry->nFlags & beans::PropertyAttribute::READONLY) == 0))
    2864                 :            :             {
    2865         [ +  + ]:       2640 :                 if ( IsScItemWid( pEntry->nWID ) )  // can be handled by SfxItemPropertySet
    2866                 :            :                 {
    2867         [ +  + ]:       1592 :                     if ( !pOldPattern )
    2868                 :            :                     {
    2869 [ +  - ][ +  - ]:        329 :                         pOldPattern = new ScPatternAttr( *GetCurrentAttrsDeep() );
                 [ +  - ]
    2870         [ +  - ]:        329 :                         pOldPattern->GetItemSet().ClearInvalidItems();
    2871 [ +  - ][ +  - ]:        332 :                         pNewPattern = new ScPatternAttr( pDoc->GetPool() );
         [ +  - ][ -  + ]
    2872                 :            :                     }
    2873                 :            : 
    2874                 :            :                     //  collect items in pNewPattern, apply with one call after the loop
    2875                 :            : 
    2876                 :            :                     sal_uInt16 nFirstItem, nSecondItem;
    2877                 :            :                     try
    2878                 :            :                     {
    2879         [ +  + ]:       1592 :                         lcl_SetCellProperty( *pEntry, pValues[i], *pOldPattern, pDoc, nFirstItem, nSecondItem );
    2880                 :            : 
    2881                 :            :                         //  put only affected items into new set
    2882         [ +  - ]:       1589 :                         if ( nFirstItem )
    2883 [ +  - ][ +  - ]:       1589 :                             pNewPattern->GetItemSet().Put( pOldPattern->GetItemSet().Get( nFirstItem ) );
    2884         [ +  + ]:       1589 :                         if ( nSecondItem )
    2885 [ +  - ][ +  - ]:       1592 :                             pNewPattern->GetItemSet().Put( pOldPattern->GetItemSet().Get( nSecondItem ) );
    2886                 :            :                     }
    2887   [ +  -  #  # ]:          6 :                     catch ( lang::IllegalArgumentException& )
    2888                 :            :                     {
    2889                 :          3 :                         pReturns[nFailed].Name = pNames[i];
    2890                 :          3 :                         pReturns[nFailed++].Result = beans::TolerantPropertySetResultType::ILLEGAL_ARGUMENT;
    2891                 :            :                     }
    2892                 :            :                 }
    2893         [ +  + ]:       1048 :                 else if ( pEntry->nWID != SC_WID_UNO_CELLSTYL )   // CellStyle is handled above
    2894                 :            :                 {
    2895                 :            :                     //  call virtual method to set a single property
    2896                 :            :                     try
    2897                 :            :                     {
    2898         [ +  - ]:        701 :                         SetOnePropertyValue( pEntry, pValues[i] );
    2899                 :            :                     }
    2900         [ #  # ]:          0 :                     catch ( lang::IllegalArgumentException& )
    2901                 :            :                     {
    2902                 :          0 :                         pReturns[nFailed].Name = pNames[i];
    2903                 :          0 :                         pReturns[nFailed++].Result = beans::TolerantPropertySetResultType::ILLEGAL_ARGUMENT;
    2904                 :            :                     }
    2905                 :       2640 :                 }
    2906                 :            :             }
    2907                 :            :             else
    2908                 :            :             {
    2909                 :         82 :                 pReturns[nFailed].Name = pNames[i];
    2910         [ +  + ]:         82 :                 if (pEntry)
    2911                 :         10 :                     pReturns[nFailed++].Result = beans::TolerantPropertySetResultType::PROPERTY_VETO;
    2912                 :            :                 else
    2913                 :         72 :                     pReturns[nFailed++].Result = beans::TolerantPropertySetResultType::UNKNOWN_PROPERTY;
    2914                 :            :             }
    2915                 :            :         }
    2916                 :            : 
    2917 [ +  + ][ +  - ]:        571 :         if ( pNewPattern && !aRanges.empty() )
         [ +  - ][ +  + ]
    2918 [ +  - ][ +  - ]:        329 :             pDocShell->GetDocFunc().ApplyAttributes( *GetMarkData(), *pNewPattern, sal_True, sal_True );
    2919                 :            : 
    2920 [ +  + ][ +  - ]:        571 :         delete pNewPattern;
    2921 [ +  + ][ +  - ]:        571 :         delete pOldPattern;
    2922         [ +  - ]:        571 :         delete[] pMapArray;
    2923                 :            : 
    2924         [ +  - ]:        571 :         aReturns.realloc(nFailed);
    2925                 :            : 
    2926 [ +  - ][ +  - ]:        571 :         return aReturns;
    2927                 :            :     }
    2928 [ #  # ][ +  - ]:        571 :     return uno::Sequence < beans::SetPropertyTolerantFailed >();
    2929                 :            : }
    2930                 :            : 
    2931                 :         16 : uno::Sequence< beans::GetPropertyTolerantResult > SAL_CALL ScCellRangesBase::getPropertyValuesTolerant( const uno::Sequence< ::rtl::OUString >& aPropertyNames )
    2932                 :            :                                     throw (uno::RuntimeException)
    2933                 :            : {
    2934         [ +  - ]:         16 :     SolarMutexGuard aGuard;
    2935                 :            : 
    2936                 :         16 :     sal_Int32 nCount(aPropertyNames.getLength());
    2937         [ +  - ]:         16 :     uno::Sequence < beans::GetPropertyTolerantResult > aReturns(nCount);
    2938         [ +  - ]:         16 :     beans::GetPropertyTolerantResult* pReturns = aReturns.getArray();
    2939                 :            : 
    2940         [ +  - ]:         16 :     const SfxItemPropertyMap& rPropertyMap = GetItemPropertyMap();     // from derived class
    2941                 :            : 
    2942         [ +  + ]:       1586 :     for(sal_Int32 i = 0; i < nCount; i++)
    2943                 :            :     {
    2944         [ +  - ]:       1570 :         const SfxItemPropertySimpleEntry* pEntry = rPropertyMap.getByName( aPropertyNames[i] );
    2945         [ -  + ]:       1570 :         if (!pEntry)
    2946                 :            :         {
    2947                 :          0 :             pReturns[i].Result = beans::TolerantPropertySetResultType::UNKNOWN_PROPERTY;
    2948                 :            :         }
    2949                 :            :         else
    2950                 :            :         {
    2951                 :       1570 :             sal_uInt16 nItemWhich = 0;
    2952                 :       1570 :             lcl_GetPropertyWhich( pEntry, nItemWhich );
    2953         [ +  - ]:       1570 :             pReturns[i].State = GetOnePropertyState( nItemWhich, pEntry );
    2954         [ +  - ]:       1570 :             GetOnePropertyValue( pEntry, pReturns[i].Value );
    2955                 :       1570 :             pReturns[i].Result = beans::TolerantPropertySetResultType::SUCCESS;
    2956                 :            :         }
    2957                 :            :     }
    2958         [ +  - ]:         16 :     return aReturns;
    2959                 :            : }
    2960                 :            : 
    2961                 :         19 : uno::Sequence< beans::GetDirectPropertyTolerantResult > SAL_CALL ScCellRangesBase::getDirectPropertyValuesTolerant( const uno::Sequence< ::rtl::OUString >& aPropertyNames )
    2962                 :            :                                     throw (uno::RuntimeException)
    2963                 :            : {
    2964         [ +  - ]:         19 :     SolarMutexGuard aGuard;
    2965                 :            : 
    2966                 :         19 :     sal_Int32 nCount(aPropertyNames.getLength());
    2967         [ +  - ]:         19 :     uno::Sequence < beans::GetDirectPropertyTolerantResult > aReturns(nCount);
    2968         [ +  - ]:         19 :     beans::GetDirectPropertyTolerantResult* pReturns = aReturns.getArray();
    2969                 :            : 
    2970         [ +  - ]:         19 :     const SfxItemPropertyMap& rPropertyMap = GetItemPropertyMap();     // from derived class
    2971                 :            : 
    2972                 :         19 :     sal_Int32 j = 0;
    2973         [ +  + ]:        661 :     for(sal_Int32 i = 0; i < nCount; i++)
    2974                 :            :     {
    2975         [ +  - ]:        642 :         const SfxItemPropertySimpleEntry* pEntry = rPropertyMap.getByName( aPropertyNames[i] );
    2976         [ -  + ]:        642 :         if (!pEntry)
    2977                 :            :         {
    2978                 :          0 :             pReturns[i].Result = beans::TolerantPropertySetResultType::UNKNOWN_PROPERTY;
    2979                 :            :         }
    2980                 :            :         else
    2981                 :            :         {
    2982                 :        642 :             sal_uInt16 nItemWhich = 0;
    2983                 :        642 :             lcl_GetPropertyWhich( pEntry, nItemWhich );
    2984         [ +  - ]:        642 :             pReturns[j].State = GetOnePropertyState( nItemWhich, pEntry );
    2985         [ +  + ]:        642 :             if (pReturns[j].State == beans::PropertyState_DIRECT_VALUE)
    2986                 :            :             {
    2987         [ +  - ]:         69 :                 GetOnePropertyValue( pEntry, pReturns[j].Value );
    2988                 :         69 :                 pReturns[j].Result = beans::TolerantPropertySetResultType::SUCCESS;
    2989                 :         69 :                 pReturns[j].Name = aPropertyNames[i];
    2990                 :        642 :                 ++j;
    2991                 :            :             }
    2992                 :            :         }
    2993                 :            :     }
    2994         [ +  + ]:         19 :     if (j < nCount)
    2995         [ +  - ]:          7 :         aReturns.realloc(j);
    2996         [ +  - ]:         19 :     return aReturns;
    2997                 :            : }
    2998                 :            : 
    2999                 :            : // XIndent
    3000                 :            : 
    3001                 :          4 : void SAL_CALL ScCellRangesBase::decrementIndent() throw(::com::sun::star::uno::RuntimeException)
    3002                 :            : {
    3003         [ +  - ]:          4 :     SolarMutexGuard aGuard;
    3004 [ +  - ][ +  - ]:          4 :     if ( pDocShell && !aRanges.empty() )        // leer = nichts zu tun
         [ +  - ][ +  - ]
    3005                 :            :     {
    3006                 :            :         //#97041#; put only MultiMarked ScMarkData in ChangeIndent
    3007 [ +  - ][ +  - ]:          4 :         ScMarkData aMarkData(*GetMarkData());
    3008         [ +  - ]:          4 :         aMarkData.MarkToMulti();
    3009 [ +  - ][ +  - ]:          4 :         pDocShell->GetDocFunc().ChangeIndent( aMarkData, false, sal_True );
    3010         [ +  - ]:          4 :     }
    3011                 :          4 : }
    3012                 :            : 
    3013                 :          4 : void SAL_CALL ScCellRangesBase::incrementIndent() throw(::com::sun::star::uno::RuntimeException)
    3014                 :            : {
    3015         [ +  - ]:          4 :     SolarMutexGuard aGuard;
    3016 [ +  - ][ +  - ]:          4 :     if ( pDocShell && !aRanges.empty() )        // leer = nichts zu tun
         [ +  - ][ +  - ]
    3017                 :            :     {
    3018                 :            :         //#97041#; put only MultiMarked ScMarkData in ChangeIndent
    3019 [ +  - ][ +  - ]:          4 :         ScMarkData aMarkData(*GetMarkData());
    3020         [ +  - ]:          4 :         aMarkData.MarkToMulti();
    3021 [ +  - ][ +  - ]:          4 :         pDocShell->GetDocFunc().ChangeIndent( aMarkData, sal_True, sal_True );
    3022         [ +  - ]:          4 :     }
    3023                 :          4 : }
    3024                 :            : 
    3025                 :            : // XChartData
    3026                 :            : 
    3027                 :         26 : ScMemChart* ScCellRangesBase::CreateMemChart_Impl() const
    3028                 :            : {
    3029 [ +  - ][ +  - ]:         26 :     if ( pDocShell && !aRanges.empty() )
                 [ +  - ]
    3030                 :            :     {
    3031                 :         26 :         ScRangeListRef xChartRanges;
    3032 [ +  + ][ +  - ]:         26 :         if ( aRanges.size() == 1 )
    3033                 :            :         {
    3034                 :            :             //  ganze Tabelle sinnvoll begrenzen (auf belegten Datenbereich)
    3035                 :            :             //  (nur hier, Listener werden auf den ganzen Bereich angemeldet)
    3036                 :            :             //! direkt testen, ob es ein ScTableSheetObj ist?
    3037                 :            : 
    3038         [ +  - ]:         16 :             const ScRange* pRange = aRanges[0];
    3039 [ +  - ][ -  +  :         16 :             if ( pRange->aStart.Col() == 0 && pRange->aEnd.Col() == MAXCOL &&
             #  #  #  # ]
                 [ -  + ]
    3040                 :          0 :                  pRange->aStart.Row() == 0 && pRange->aEnd.Row() == MAXROW )
    3041                 :            :             {
    3042                 :          0 :                 SCTAB nTab = pRange->aStart.Tab();
    3043                 :            : 
    3044                 :            :                 SCCOL nStartX;
    3045                 :            :                 SCROW nStartY; // Anfang holen
    3046 [ #  # ][ #  # ]:          0 :                 if (!pDocShell->GetDocument()->GetDataStart( nTab, nStartX, nStartY ))
    3047                 :            :                 {
    3048                 :          0 :                     nStartX = 0;
    3049                 :          0 :                     nStartY = 0;
    3050                 :            :                 }
    3051                 :            : 
    3052                 :            :                 SCCOL nEndX;
    3053                 :            :                 SCROW nEndY; // Ende holen
    3054 [ #  # ][ #  # ]:          0 :                 if (!pDocShell->GetDocument()->GetTableArea( nTab, nEndX, nEndY ))
    3055                 :            :                 {
    3056                 :          0 :                     nEndX = 0;
    3057                 :          0 :                     nEndY = 0;
    3058                 :            :                 }
    3059                 :            : 
    3060 [ #  # ][ #  # ]:          0 :                 xChartRanges = new ScRangeList;
                 [ #  # ]
    3061         [ #  # ]:          0 :                 xChartRanges->Append( ScRange( nStartX, nStartY, nTab, nEndX, nEndY, nTab ) );
    3062                 :            :             }
    3063                 :            :         }
    3064         [ +  - ]:         26 :         if (!xChartRanges.Is())         //  sonst Ranges direkt uebernehmen
    3065 [ +  - ][ +  - ]:         26 :             xChartRanges = new ScRangeList(aRanges);
                 [ +  - ]
    3066 [ +  - ][ +  - ]:         26 :         ScChartArray aArr( pDocShell->GetDocument(), xChartRanges, String() );
         [ +  - ][ +  - ]
    3067                 :            : 
    3068                 :            :         // RowAsHdr = ColHeaders und umgekehrt
    3069                 :         26 :         aArr.SetHeaders( bChartRowAsHdr, bChartColAsHdr );
    3070                 :            : 
    3071 [ +  - ][ +  - ]:         26 :         return aArr.CreateMemChart();
                 [ +  - ]
    3072                 :            :     }
    3073                 :         26 :     return NULL;
    3074                 :            : }
    3075                 :            : 
    3076                 :         10 : uno::Sequence< uno::Sequence<double> > SAL_CALL ScCellRangesBase::getData()
    3077                 :            :                                                 throw(uno::RuntimeException)
    3078                 :            : {
    3079         [ +  - ]:         10 :     SolarMutexGuard aGuard;
    3080         [ +  - ]:         10 :     ScMemChart* pMemChart = CreateMemChart_Impl();
    3081         [ +  - ]:         10 :     if ( pMemChart )
    3082                 :            :     {
    3083                 :         10 :         sal_Int32 nColCount = pMemChart->GetColCount();
    3084                 :         10 :         sal_Int32 nRowCount = static_cast<sal_Int32>(pMemChart->GetRowCount());
    3085                 :            : 
    3086         [ +  - ]:         10 :         uno::Sequence< uno::Sequence<double> > aRowSeq( nRowCount );
    3087         [ +  - ]:         10 :         uno::Sequence<double>* pRowAry = aRowSeq.getArray();
    3088         [ +  + ]:         80 :         for (sal_Int32 nRow = 0; nRow < nRowCount; nRow++)
    3089                 :            :         {
    3090         [ +  - ]:         70 :             uno::Sequence<double> aColSeq( nColCount );
    3091         [ +  - ]:         70 :             double* pColAry = aColSeq.getArray();
    3092         [ +  + ]:        228 :             for (sal_Int32 nCol = 0; nCol < nColCount; nCol++)
    3093                 :        158 :                 pColAry[nCol] = pMemChart->GetData( static_cast<short>(nCol), static_cast<short>(nRow) );
    3094                 :            : 
    3095         [ +  - ]:         70 :             pRowAry[nRow] = aColSeq;
    3096         [ +  - ]:         70 :         }
    3097                 :            : 
    3098 [ +  - ][ +  - ]:         10 :         delete pMemChart;
    3099 [ +  - ][ +  - ]:         10 :         return aRowSeq;
    3100                 :            :     }
    3101                 :            : 
    3102 [ #  # ][ +  - ]:         10 :     return uno::Sequence< uno::Sequence<double> >(0);
    3103                 :            : }
    3104                 :            : 
    3105                 :         11 : ScRangeListRef ScCellRangesBase::GetLimitedChartRanges_Impl( long nDataColumns, long nDataRows ) const
    3106                 :            : {
    3107         [ +  + ]:         11 :     if ( aRanges.size() == 1 )
    3108                 :            :     {
    3109                 :          6 :         const ScRange* pRange = aRanges[0];
    3110   [ -  +  #  #  :          6 :         if ( pRange->aStart.Col() == 0 && pRange->aEnd.Col() == MAXCOL &&
           #  # ][ -  + ]
                 [ +  - ]
    3111                 :          0 :              pRange->aStart.Row() == 0 && pRange->aEnd.Row() == MAXROW )
    3112                 :            :         {
    3113                 :            :             //  if aRanges is a complete sheet, limit to given size
    3114                 :            : 
    3115                 :          0 :             SCTAB nTab = pRange->aStart.Tab();
    3116                 :            : 
    3117         [ #  # ]:          0 :             long nEndColumn = nDataColumns - 1 + ( bChartColAsHdr ? 1 : 0 );
    3118         [ #  # ]:          0 :             if ( nEndColumn < 0 )
    3119                 :          0 :                 nEndColumn = 0;
    3120         [ #  # ]:          0 :             if ( nEndColumn > MAXCOL )
    3121                 :          0 :                 nEndColumn = MAXCOL;
    3122                 :            : 
    3123         [ #  # ]:          0 :             long nEndRow = nDataRows - 1 + ( bChartRowAsHdr ? 1 : 0 );
    3124         [ #  # ]:          0 :             if ( nEndRow < 0 )
    3125                 :          0 :                 nEndRow = 0;
    3126         [ #  # ]:          0 :             if ( nEndRow > MAXROW )
    3127                 :          0 :                 nEndRow = MAXROW;
    3128                 :            : 
    3129 [ #  # ][ #  # ]:          0 :             ScRangeListRef xChartRanges = new ScRangeList;
    3130         [ #  # ]:          0 :             xChartRanges->Append( ScRange( 0, 0, nTab, (SCCOL)nEndColumn, (SCROW)nEndRow, nTab ) );
    3131         [ #  # ]:          0 :             return xChartRanges;
    3132                 :            :         }
    3133                 :            :     }
    3134                 :            : 
    3135         [ +  - ]:         11 :     return new ScRangeList(aRanges);        // as-is
    3136                 :            : }
    3137                 :            : 
    3138                 :          7 : void SAL_CALL ScCellRangesBase::setData( const uno::Sequence< uno::Sequence<double> >& aData )
    3139                 :            :                                                 throw(uno::RuntimeException)
    3140                 :            : {
    3141         [ +  - ]:          7 :     SolarMutexGuard aGuard;
    3142                 :          7 :     sal_Bool bDone = false;
    3143                 :          7 :     long nRowCount = aData.getLength();
    3144         [ +  - ]:          7 :     long nColCount = nRowCount ? aData[0].getLength() : 0;
    3145         [ +  - ]:          7 :     ScRangeListRef xChartRanges = GetLimitedChartRanges_Impl( nColCount, nRowCount );
    3146 [ +  - ][ +  - ]:          7 :     if ( pDocShell && xChartRanges.Is() )
                 [ +  - ]
    3147                 :            :     {
    3148                 :          7 :         ScDocument* pDoc = pDocShell->GetDocument();
    3149 [ +  - ][ +  - ]:          7 :         ScChartArray aArr( pDoc, xChartRanges, String() );
         [ +  - ][ +  - ]
    3150                 :          7 :         aArr.SetHeaders( bChartRowAsHdr, bChartColAsHdr );      // RowAsHdr = ColHeaders
    3151         [ +  - ]:          7 :         const ScChartPositionMap* pPosMap = aArr.GetPositionMap();
    3152         [ +  - ]:          7 :         if (pPosMap)
    3153                 :            :         {
    3154   [ +  -  +  - ]:         14 :             if ( pPosMap->GetColCount() == static_cast<SCCOL>(nColCount) &&
                 [ +  - ]
    3155                 :          7 :                  pPosMap->GetRowCount() == static_cast<SCROW>(nRowCount) )
    3156                 :            :             {
    3157         [ +  + ]:         58 :                 for (long nRow=0; nRow<nRowCount; nRow++)
    3158                 :            :                 {
    3159                 :         51 :                     const uno::Sequence<double>& rRowSeq = aData[nRow];
    3160                 :         51 :                     const double* pArray = rRowSeq.getConstArray();
    3161                 :         51 :                     nColCount = rRowSeq.getLength();
    3162         [ +  + ]:        170 :                     for (long nCol=0; nCol<nColCount; nCol++)
    3163                 :            :                     {
    3164                 :            :                         const ScAddress* pPos = pPosMap->GetPosition(
    3165                 :        119 :                                 sal::static_int_cast<SCCOL>(nCol),
    3166                 :        238 :                                 sal::static_int_cast<SCROW>(nRow) );
    3167         [ +  - ]:        119 :                         if (pPos)
    3168                 :            :                         {
    3169                 :        119 :                             double fVal = pArray[nCol];
    3170         [ +  + ]:        119 :                             if ( fVal == DBL_MIN )
    3171         [ +  - ]:         66 :                                 pDoc->PutCell( *pPos, NULL );       // empty cell
    3172                 :            :                             else
    3173         [ +  - ]:         53 :                                 pDoc->SetValue( pPos->Col(), pPos->Row(), pPos->Tab(), pArray[nCol] );
    3174                 :            :                         }
    3175                 :            :                     }
    3176                 :            :                 }
    3177                 :            : 
    3178                 :            :                 //! undo
    3179         [ +  - ]:          7 :                 PaintRanges_Impl( PAINT_GRID );
    3180         [ +  - ]:          7 :                 pDocShell->SetDocumentModified();
    3181         [ +  - ]:          7 :                 ForceChartListener_Impl();          // call listeners for this object synchronously
    3182                 :          7 :                 bDone = sal_True;
    3183                 :            :             }
    3184         [ +  - ]:          7 :         }
    3185                 :            :     }
    3186                 :            : 
    3187         [ -  + ]:          7 :     if (!bDone)
    3188 [ #  # ][ +  - ]:          7 :         throw uno::RuntimeException();
                 [ +  - ]
    3189                 :          7 : }
    3190                 :            : 
    3191                 :          8 : uno::Sequence<rtl::OUString> SAL_CALL ScCellRangesBase::getRowDescriptions()
    3192                 :            :                                                 throw(uno::RuntimeException)
    3193                 :            : {
    3194         [ +  - ]:          8 :     SolarMutexGuard aGuard;
    3195         [ +  - ]:          8 :     ScMemChart* pMemChart = CreateMemChart_Impl();
    3196         [ +  - ]:          8 :     if ( pMemChart )
    3197                 :            :     {
    3198                 :          8 :         sal_Int32 nRowCount = static_cast<sal_Int32>(pMemChart->GetRowCount());
    3199         [ +  - ]:          8 :         uno::Sequence<rtl::OUString> aSeq( nRowCount );
    3200         [ +  - ]:          8 :         rtl::OUString* pAry = aSeq.getArray();
    3201         [ +  + ]:         61 :         for (sal_Int32 nRow = 0; nRow < nRowCount; nRow++)
    3202                 :         53 :             pAry[nRow] = pMemChart->GetRowText(static_cast<short>(nRow));
    3203                 :            : 
    3204 [ +  - ][ +  - ]:          8 :         delete pMemChart;
    3205 [ +  - ][ +  - ]:          8 :         return aSeq;
    3206                 :            :     }
    3207 [ #  # ][ +  - ]:          8 :     return uno::Sequence<rtl::OUString>(0);
    3208                 :            : }
    3209                 :            : 
    3210                 :          2 : void SAL_CALL ScCellRangesBase::setRowDescriptions(
    3211                 :            :                         const uno::Sequence<rtl::OUString>& aRowDescriptions )
    3212                 :            :                                                 throw(uno::RuntimeException)
    3213                 :            : {
    3214         [ +  - ]:          2 :     SolarMutexGuard aGuard;
    3215                 :          2 :     sal_Bool bDone = false;
    3216         [ +  - ]:          2 :     if ( bChartColAsHdr )
    3217                 :            :     {
    3218                 :          2 :         long nRowCount = aRowDescriptions.getLength();
    3219         [ +  - ]:          2 :         ScRangeListRef xChartRanges = GetLimitedChartRanges_Impl( 1, nRowCount );
    3220 [ +  - ][ +  - ]:          2 :         if ( pDocShell && xChartRanges.Is() )
                 [ +  - ]
    3221                 :            :         {
    3222                 :          2 :             ScDocument* pDoc = pDocShell->GetDocument();
    3223 [ +  - ][ +  - ]:          2 :             ScChartArray aArr( pDoc, xChartRanges, String() );
         [ +  - ][ +  - ]
    3224                 :          2 :             aArr.SetHeaders( bChartRowAsHdr, bChartColAsHdr );      // RowAsHdr = ColHeaders
    3225         [ +  - ]:          2 :             const ScChartPositionMap* pPosMap = aArr.GetPositionMap();
    3226         [ +  - ]:          2 :             if (pPosMap)
    3227                 :            :             {
    3228         [ +  - ]:          2 :                 if ( pPosMap->GetRowCount() == static_cast<SCROW>(nRowCount) )
    3229                 :            :                 {
    3230                 :          2 :                     const rtl::OUString* pArray = aRowDescriptions.getConstArray();
    3231         [ +  + ]:         17 :                     for (long nRow=0; nRow<nRowCount; nRow++)
    3232                 :            :                     {
    3233                 :            :                         const ScAddress* pPos = pPosMap->GetRowHeaderPosition(
    3234                 :         15 :                                 static_cast<SCSIZE>(nRow) );
    3235         [ +  - ]:         15 :                         if (pPos)
    3236                 :            :                         {
    3237         [ +  - ]:         15 :                             String aStr = pArray[nRow];
    3238         [ +  - ]:         15 :                             if ( aStr.Len() )
    3239 [ +  - ][ +  - ]:         15 :                                 pDoc->PutCell( *pPos, new ScStringCell( aStr ) );
         [ +  - ][ +  - ]
    3240                 :            :                             else
    3241 [ #  # ][ +  - ]:         15 :                                 pDoc->PutCell( *pPos, NULL );       // empty cell
    3242                 :            :                         }
    3243                 :            :                     }
    3244                 :            : 
    3245                 :            :                     //! undo
    3246         [ +  - ]:          2 :                     PaintRanges_Impl( PAINT_GRID );
    3247         [ +  - ]:          2 :                     pDocShell->SetDocumentModified();
    3248         [ +  - ]:          2 :                     ForceChartListener_Impl();          // call listeners for this object synchronously
    3249                 :          2 :                     bDone = sal_True;
    3250                 :            :                 }
    3251         [ +  - ]:          2 :             }
    3252         [ +  - ]:          2 :         }
    3253                 :            :     }
    3254                 :            : 
    3255         [ -  + ]:          2 :     if (!bDone)
    3256 [ #  # ][ +  - ]:          2 :         throw uno::RuntimeException();
    3257                 :          2 : }
    3258                 :            : 
    3259                 :          8 : uno::Sequence<rtl::OUString> SAL_CALL ScCellRangesBase::getColumnDescriptions()
    3260                 :            :                                                 throw(uno::RuntimeException)
    3261                 :            : {
    3262         [ +  - ]:          8 :     SolarMutexGuard aGuard;
    3263         [ +  - ]:          8 :     ScMemChart* pMemChart = CreateMemChart_Impl();
    3264         [ +  - ]:          8 :     if ( pMemChart )
    3265                 :            :     {
    3266                 :          8 :         sal_Int32 nColCount = pMemChart->GetColCount();
    3267         [ +  - ]:          8 :         uno::Sequence<rtl::OUString> aSeq( nColCount );
    3268         [ +  - ]:          8 :         rtl::OUString* pAry = aSeq.getArray();
    3269         [ +  + ]:         28 :         for (sal_Int32 nCol = 0; nCol < nColCount; nCol++)
    3270                 :         20 :             pAry[nCol] = pMemChart->GetColText(static_cast<short>(nCol));
    3271                 :            : 
    3272 [ +  - ][ +  - ]:          8 :         delete pMemChart;
    3273 [ +  - ][ +  - ]:          8 :         return aSeq;
    3274                 :            :     }
    3275 [ #  # ][ +  - ]:          8 :     return uno::Sequence<rtl::OUString>(0);
    3276                 :            : }
    3277                 :            : 
    3278                 :          2 : void SAL_CALL ScCellRangesBase::setColumnDescriptions(
    3279                 :            :                         const uno::Sequence<rtl::OUString>& aColumnDescriptions )
    3280                 :            :                                                 throw(uno::RuntimeException)
    3281                 :            : {
    3282         [ +  - ]:          2 :     SolarMutexGuard aGuard;
    3283                 :          2 :     sal_Bool bDone = false;
    3284         [ +  - ]:          2 :     if ( bChartRowAsHdr )
    3285                 :            :     {
    3286                 :          2 :         long nColCount = aColumnDescriptions.getLength();
    3287         [ +  - ]:          2 :         ScRangeListRef xChartRanges = GetLimitedChartRanges_Impl( nColCount, 1 );
    3288 [ +  - ][ +  - ]:          2 :         if ( pDocShell && xChartRanges.Is() )
                 [ +  - ]
    3289                 :            :         {
    3290                 :          2 :             ScDocument* pDoc = pDocShell->GetDocument();
    3291 [ +  - ][ +  - ]:          2 :             ScChartArray aArr( pDoc, xChartRanges, String() );
         [ +  - ][ +  - ]
    3292                 :          2 :             aArr.SetHeaders( bChartRowAsHdr, bChartColAsHdr );      // RowAsHdr = ColHeaders
    3293         [ +  - ]:          2 :             const ScChartPositionMap* pPosMap = aArr.GetPositionMap();
    3294         [ +  - ]:          2 :             if (pPosMap)
    3295                 :            :             {
    3296         [ +  - ]:          2 :                 if ( pPosMap->GetColCount() == static_cast<SCCOL>(nColCount) )
    3297                 :            :                 {
    3298                 :          2 :                     const rtl::OUString* pArray = aColumnDescriptions.getConstArray();
    3299         [ +  + ]:          6 :                     for (long nCol=0; nCol<nColCount; nCol++)
    3300                 :            :                     {
    3301                 :            :                         const ScAddress* pPos = pPosMap->GetColHeaderPosition(
    3302                 :          4 :                             sal::static_int_cast<SCCOL>(nCol) );
    3303         [ +  - ]:          4 :                         if (pPos)
    3304                 :            :                         {
    3305         [ +  - ]:          4 :                             String aStr(pArray[nCol]);
    3306         [ +  - ]:          4 :                             if ( aStr.Len() )
    3307 [ +  - ][ +  - ]:          4 :                                 pDoc->PutCell( *pPos, new ScStringCell( aStr ) );
         [ +  - ][ +  - ]
    3308                 :            :                             else
    3309 [ #  # ][ +  - ]:          4 :                                 pDoc->PutCell( *pPos, NULL );       // empty cell
    3310                 :            :                         }
    3311                 :            :                     }
    3312                 :            : 
    3313                 :            :                     //! undo
    3314         [ +  - ]:          2 :                     PaintRanges_Impl( PAINT_GRID );
    3315         [ +  - ]:          2 :                     pDocShell->SetDocumentModified();
    3316         [ +  - ]:          2 :                     ForceChartListener_Impl();          // call listeners for this object synchronously
    3317                 :          2 :                     bDone = sal_True;
    3318                 :            :                 }
    3319         [ +  - ]:          2 :             }
    3320         [ +  - ]:          2 :         }
    3321                 :            :     }
    3322                 :            : 
    3323         [ -  + ]:          2 :     if (!bDone)
    3324 [ #  # ][ +  - ]:          2 :         throw uno::RuntimeException();
    3325                 :          2 : }
    3326                 :            : 
    3327                 :         11 : void ScCellRangesBase::ForceChartListener_Impl()
    3328                 :            : {
    3329                 :            :     //  call Update immediately so the caller to setData etc. can
    3330                 :            :     //  regognize the listener call
    3331                 :            : 
    3332         [ +  - ]:         11 :     if (!pDocShell)
    3333                 :            :         return;
    3334                 :            : 
    3335         [ +  - ]:         11 :     ScChartListenerCollection* pColl = pDocShell->GetDocument()->GetChartListenerCollection();
    3336         [ +  - ]:         11 :     if (!pColl)
    3337                 :            :         return;
    3338                 :            : 
    3339         [ +  - ]:         11 :     ScChartListenerCollection::ListenersType& rListeners = pColl->getListeners();
    3340 [ +  - ][ +  - ]:         11 :     ScChartListenerCollection::ListenersType::iterator it = rListeners.begin(), itEnd = rListeners.end();
    3341 [ +  - ][ +  - ]:         17 :     for (; it != itEnd; ++it)
                 [ +  + ]
    3342                 :            :     {
    3343         [ +  - ]:          6 :         ScChartListener* p = it->second;
    3344                 :            :         OSL_ASSERT(p);
    3345 [ +  - ][ +  - ]:          6 :         if (p->GetUnoSource() == static_cast<chart::XChartData*>(this) && p->IsDirty())
         [ +  - ][ +  - ]
           [ +  -  #  # ]
                 [ +  - ]
    3346         [ +  - ]:          6 :             p->Update();
    3347                 :            :     }
    3348                 :            : }
    3349                 :            : 
    3350                 :          4 : void SAL_CALL ScCellRangesBase::addChartDataChangeEventListener( const uno::Reference<
    3351                 :            :                                     chart::XChartDataChangeEventListener >& aListener )
    3352                 :            :                                 throw(uno::RuntimeException)
    3353                 :            : {
    3354         [ +  - ]:          4 :     SolarMutexGuard aGuard;
    3355 [ +  - ][ +  - ]:          4 :     if ( pDocShell && !aRanges.empty() )
         [ +  - ][ +  - ]
    3356                 :            :     {
    3357                 :            :         //! auf doppelte testen?
    3358                 :            : 
    3359                 :          4 :         ScDocument* pDoc = pDocShell->GetDocument();
    3360 [ +  - ][ +  - ]:          4 :         ScRangeListRef aRangesRef( new ScRangeList(aRanges) );
    3361         [ +  - ]:          4 :         ScChartListenerCollection* pColl = pDoc->GetChartListenerCollection();
    3362 [ +  - ][ +  - ]:          4 :         rtl::OUString aName = pColl->getUniqueName(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("__Uno")));
    3363         [ -  + ]:          4 :         if (aName.isEmpty())
    3364                 :            :             // failed to create unique name.
    3365                 :          4 :             return;
    3366                 :            : 
    3367 [ +  - ][ +  - ]:          4 :         ScChartListener* pListener = new ScChartListener( aName, pDoc, aRangesRef );
    3368 [ +  - ][ +  - ]:          4 :         pListener->SetUno( aListener, this );
    3369         [ +  - ]:          4 :         pColl->insert( pListener );
    3370 [ +  - ][ -  + ]:          4 :         pListener->StartListeningTo();
         [ +  - ][ +  - ]
    3371 [ +  - ][ +  - ]:          4 :     }
    3372                 :            : }
    3373                 :            : 
    3374                 :          4 : void SAL_CALL ScCellRangesBase::removeChartDataChangeEventListener( const uno::Reference<
    3375                 :            :                                     chart::XChartDataChangeEventListener >& aListener )
    3376                 :            :                                 throw(uno::RuntimeException)
    3377                 :            : {
    3378         [ +  - ]:          4 :     SolarMutexGuard aGuard;
    3379 [ +  - ][ +  - ]:          4 :     if ( pDocShell && !aRanges.empty() )
         [ +  - ][ +  - ]
    3380                 :            :     {
    3381                 :          4 :         ScDocument* pDoc = pDocShell->GetDocument();
    3382         [ +  - ]:          4 :         ScChartListenerCollection* pColl = pDoc->GetChartListenerCollection();
    3383 [ +  - ][ +  - ]:          4 :         pColl->FreeUno( aListener, this );
    3384         [ +  - ]:          4 :     }
    3385                 :          4 : }
    3386                 :            : 
    3387                 :          2 : double SAL_CALL ScCellRangesBase::getNotANumber() throw(::com::sun::star::uno::RuntimeException)
    3388                 :            : {
    3389                 :            :     //  im ScChartArray wird DBL_MIN verwendet, weil das Chart es so will
    3390                 :          2 :     return DBL_MIN;
    3391                 :            : }
    3392                 :            : 
    3393                 :          4 : sal_Bool SAL_CALL ScCellRangesBase::isNotANumber( double nNumber ) throw(uno::RuntimeException)
    3394                 :            : {
    3395                 :            :     //  im ScChartArray wird DBL_MIN verwendet, weil das Chart es so will
    3396                 :          4 :     return (nNumber == DBL_MIN);
    3397                 :            : }
    3398                 :            : 
    3399                 :            : // XModifyBroadcaster
    3400                 :            : 
    3401                 :         15 : void SAL_CALL ScCellRangesBase::addModifyListener( const uno::Reference<util::XModifyListener>& aListener )
    3402                 :            :                                 throw(uno::RuntimeException)
    3403                 :            : {
    3404         [ +  - ]:         15 :     SolarMutexGuard aGuard;
    3405 [ +  - ][ -  + ]:         15 :     if ( aRanges.empty() )
    3406         [ #  # ]:          0 :         throw uno::RuntimeException();
    3407                 :            : 
    3408                 :            :     uno::Reference<util::XModifyListener> *pObj =
    3409                 :         15 :             new uno::Reference<util::XModifyListener>( aListener );
    3410         [ +  - ]:         15 :     aValueListeners.push_back( pObj );
    3411                 :            : 
    3412         [ +  - ]:         15 :     if ( aValueListeners.size() == 1 )
    3413                 :            :     {
    3414         [ +  - ]:         15 :         if (!pValueListener)
    3415 [ +  - ][ +  - ]:         15 :             pValueListener = new ScLinkListener( LINK( this, ScCellRangesBase, ValueListenerHdl ) );
                 [ +  - ]
    3416                 :            : 
    3417                 :         15 :         ScDocument* pDoc = pDocShell->GetDocument();
    3418 [ +  + ][ +  - ]:         30 :         for ( size_t i = 0, nCount = aRanges.size(); i < nCount; i++)
    3419 [ +  - ][ +  - ]:         15 :             pDoc->StartListeningArea( *aRanges[ i ], pValueListener );
    3420                 :            : 
    3421                 :         15 :         acquire();  // don't lose this object (one ref for all listeners)
    3422         [ +  - ]:         15 :     }
    3423                 :         15 : }
    3424                 :            : 
    3425                 :          3 : void SAL_CALL ScCellRangesBase::removeModifyListener( const uno::Reference<util::XModifyListener>& aListener )
    3426                 :            :                                 throw(uno::RuntimeException)
    3427                 :            : {
    3428                 :            : 
    3429         [ +  - ]:          3 :     SolarMutexGuard aGuard;
    3430 [ +  - ][ -  + ]:          3 :     if ( aRanges.empty() )
    3431         [ #  # ]:          0 :         throw uno::RuntimeException();
    3432                 :            : 
    3433                 :          3 :     acquire();      // in case the listeners have the last ref - released below
    3434                 :            : 
    3435                 :          3 :     sal_uInt16 nCount = aValueListeners.size();
    3436         [ +  - ]:          3 :     for ( sal_uInt16 n=nCount; n--; )
    3437                 :            :     {
    3438         [ +  - ]:          3 :         uno::Reference<util::XModifyListener>& rObj = aValueListeners[n];
    3439 [ +  - ][ +  - ]:          3 :         if ( rObj == aListener )
    3440                 :            :         {
    3441 [ +  - ][ +  - ]:          3 :             aValueListeners.erase( aValueListeners.begin() + n );
                 [ +  - ]
    3442                 :            : 
    3443         [ +  - ]:          3 :             if ( aValueListeners.empty() )
    3444                 :            :             {
    3445         [ +  - ]:          3 :                 if (pValueListener)
    3446         [ +  - ]:          3 :                     pValueListener->EndListeningAll();
    3447                 :            : 
    3448                 :          3 :                 release();      // release the ref for the listeners
    3449                 :            :             }
    3450                 :            : 
    3451                 :          3 :             break;
    3452                 :            :         }
    3453                 :            :     }
    3454                 :            : 
    3455         [ +  - ]:          3 :     release();      // might delete this object
    3456                 :          3 : }
    3457                 :            : 
    3458                 :            : // XCellRangesQuery
    3459                 :            : 
    3460                 :          5 : uno::Reference<sheet::XSheetCellRanges> SAL_CALL ScCellRangesBase::queryVisibleCells()
    3461                 :            :                                     throw(uno::RuntimeException)
    3462                 :            : {
    3463         [ +  - ]:          5 :     SolarMutexGuard aGuard;
    3464         [ +  - ]:          5 :     if (pDocShell)
    3465                 :            :     {
    3466                 :            :         //! fuer alle Tabellen getrennt, wenn Markierungen pro Tabelle getrennt sind!
    3467         [ +  - ]:          5 :         SCTAB nTab = lcl_FirstTab(aRanges);
    3468                 :            : 
    3469 [ +  - ][ +  - ]:          5 :         ScMarkData aMarkData(*GetMarkData());
    3470                 :            : 
    3471                 :          5 :         ScDocument* pDoc = pDocShell->GetDocument();
    3472                 :          5 :         SCCOL nCol = 0, nLastCol;
    3473         [ +  + ]:         10 :         while (nCol <= MAXCOL)
    3474                 :            :         {
    3475 [ +  - ][ -  + ]:          5 :             if (pDoc->ColHidden(nCol, nTab, NULL, &nLastCol))
    3476                 :            :                 // hidden columns.  Unselect them.
    3477         [ #  # ]:          0 :                 aMarkData.SetMultiMarkArea(ScRange(nCol, 0, nTab, nLastCol, MAXROW, nTab), false);
    3478                 :            : 
    3479                 :          5 :             nCol = nLastCol + 1;
    3480                 :            :         }
    3481                 :            : 
    3482                 :          5 :         SCROW nRow = 0, nLastRow;
    3483         [ +  + ]:         11 :         while (nRow <= MAXROW)
    3484                 :            :         {
    3485 [ +  - ][ +  + ]:          6 :             if (pDoc->RowHidden(nRow, nTab, NULL, &nLastRow))
    3486                 :            :                 // These rows are hidden.  Unselect them.
    3487         [ +  - ]:          1 :                 aMarkData.SetMultiMarkArea(ScRange(0, nRow, nTab, MAXCOL, nLastRow, nTab), false);
    3488                 :            : 
    3489                 :          6 :             nRow = nLastRow + 1;
    3490                 :            :         }
    3491                 :            : 
    3492         [ +  - ]:          5 :         ScRangeList aNewRanges;
    3493         [ +  - ]:          5 :         aMarkData.FillRangeListWithMarks( &aNewRanges, false );
    3494 [ +  - ][ +  - ]:          5 :         return new ScCellRangesObj( pDocShell, aNewRanges );
         [ +  - ][ +  - ]
                 [ +  - ]
    3495                 :            :     }
    3496                 :            : 
    3497 [ #  # ][ +  - ]:          5 :     return NULL;
    3498                 :            : }
    3499                 :            : 
    3500                 :          5 : uno::Reference<sheet::XSheetCellRanges> SAL_CALL ScCellRangesBase::queryEmptyCells()
    3501                 :            :                                     throw(uno::RuntimeException)
    3502                 :            : {
    3503         [ +  - ]:          5 :     SolarMutexGuard aGuard;
    3504         [ +  - ]:          5 :     if (pDocShell)
    3505                 :            :     {
    3506                 :          5 :         ScDocument* pDoc = pDocShell->GetDocument();
    3507                 :            : 
    3508 [ +  - ][ +  - ]:          5 :         ScMarkData aMarkData(*GetMarkData());
    3509                 :            : 
    3510                 :            :         //  belegte Zellen wegmarkieren
    3511 [ +  - ][ +  + ]:         13 :         for (size_t i = 0, nCount = aRanges.size(); i < nCount; ++i)
    3512                 :            :         {
    3513         [ +  - ]:          8 :             ScRange aRange = *aRanges[ i ];
    3514                 :            : 
    3515         [ +  - ]:          8 :             ScCellIterator aIter( pDoc, aRange );
    3516         [ +  - ]:          8 :             ScBaseCell* pCell = aIter.GetFirst();
    3517         [ +  + ]:         42 :             while (pCell)
    3518                 :            :             {
    3519                 :            :                 //  Notizen zaehlen als nicht-leer
    3520 [ +  - ][ +  - ]:         34 :                 if ( !pCell->IsBlank() )
    3521                 :            :                     aMarkData.SetMultiMarkArea(
    3522                 :         68 :                             ScRange( aIter.GetCol(), aIter.GetRow(), aIter.GetTab() ),
    3523         [ +  - ]:         68 :                             false );
    3524                 :            : 
    3525         [ +  - ]:         34 :                 pCell = aIter.GetNext();
    3526                 :            :             }
    3527                 :            :         }
    3528                 :            : 
    3529         [ +  - ]:          5 :         ScRangeList aNewRanges;
    3530                 :            :         //  IsMultiMarked reicht hier nicht (wird beim deselektieren nicht zurueckgesetzt)
    3531 [ +  - ][ +  + ]:          5 :         if (aMarkData.HasAnyMultiMarks())
    3532         [ +  - ]:          2 :             aMarkData.FillRangeListWithMarks( &aNewRanges, false );
    3533                 :            : 
    3534 [ +  - ][ +  - ]:          5 :         return new ScCellRangesObj( pDocShell, aNewRanges );    // aNewRanges kann leer sein
         [ +  - ][ +  - ]
                 [ +  - ]
    3535                 :            :     }
    3536                 :            : 
    3537 [ #  # ][ +  - ]:          5 :     return NULL;
    3538                 :            : }
    3539                 :            : 
    3540                 :          7 : uno::Reference<sheet::XSheetCellRanges> SAL_CALL ScCellRangesBase::queryContentCells(
    3541                 :            :                                                     sal_Int16 nContentFlags )
    3542                 :            :                                     throw(uno::RuntimeException)
    3543                 :            : {
    3544         [ +  - ]:          7 :     SolarMutexGuard aGuard;
    3545         [ +  - ]:          7 :     if (pDocShell)
    3546                 :            :     {
    3547                 :          7 :         ScDocument* pDoc = pDocShell->GetDocument();
    3548                 :            : 
    3549         [ +  - ]:          7 :         ScMarkData aMarkData;
    3550                 :            : 
    3551                 :            :         //  passende Zellen selektieren
    3552 [ +  - ][ +  + ]:         17 :         for ( size_t i = 0, nCount = aRanges.size(); i < nCount; ++i )
    3553                 :            :         {
    3554         [ +  - ]:         10 :             ScRange aRange = *aRanges[ i ];
    3555                 :            : 
    3556         [ +  - ]:         10 :             ScCellIterator aIter( pDoc, aRange );
    3557         [ +  - ]:         10 :             ScBaseCell* pCell = aIter.GetFirst();
    3558         [ +  + ]:         42 :             while (pCell)
    3559                 :            :             {
    3560                 :         32 :                 sal_Bool bAdd = false;
    3561   [ +  -  +  +  :         32 :                 switch ( pCell->GetCellType() )
                      - ]
    3562                 :            :                 {
    3563                 :            :                     case CELLTYPE_STRING:
    3564         [ -  + ]:         20 :                         if ( nContentFlags & sheet::CellFlags::STRING )
    3565                 :          0 :                             bAdd = sal_True;
    3566                 :         20 :                         break;
    3567                 :            :                     case CELLTYPE_EDIT:
    3568 [ #  # ][ #  # ]:          0 :                         if ( (nContentFlags & sheet::CellFlags::STRING) || (nContentFlags & sheet::CellFlags::FORMATTED) )
    3569                 :          0 :                             bAdd = sal_True;
    3570                 :          0 :                         break;
    3571                 :            :                     case CELLTYPE_FORMULA:
    3572         [ -  + ]:          4 :                         if ( nContentFlags & sheet::CellFlags::FORMULA )
    3573                 :          0 :                             bAdd = sal_True;
    3574                 :          4 :                         break;
    3575                 :            :                     case CELLTYPE_VALUE:
    3576         [ -  + ]:          8 :                         if ( (nContentFlags & (sheet::CellFlags::VALUE|sheet::CellFlags::DATETIME))
    3577                 :            :                                 == (sheet::CellFlags::VALUE|sheet::CellFlags::DATETIME) )
    3578                 :          0 :                             bAdd = sal_True;
    3579                 :            :                         else
    3580                 :            :                         {
    3581                 :            :                             //  Date/Time Erkennung
    3582                 :            : 
    3583                 :            :                             sal_uLong nIndex = (sal_uLong)((SfxUInt32Item*)pDoc->GetAttr(
    3584                 :         16 :                                         aIter.GetCol(), aIter.GetRow(), aIter.GetTab(),
    3585         [ +  - ]:         16 :                                         ATTR_VALUE_FORMAT ))->GetValue();
    3586 [ +  - ][ +  - ]:          8 :                             short nTyp = pDoc->GetFormatTable()->GetType(nIndex);
    3587 [ +  - ][ +  - ]:          8 :                             if ((nTyp == NUMBERFORMAT_DATE) || (nTyp == NUMBERFORMAT_TIME) ||
                 [ -  + ]
    3588                 :            :                                     (nTyp == NUMBERFORMAT_DATETIME))
    3589                 :            :                             {
    3590         [ #  # ]:          0 :                                 if ( nContentFlags & sheet::CellFlags::DATETIME )
    3591                 :          0 :                                     bAdd = sal_True;
    3592                 :            :                             }
    3593                 :            :                             else
    3594                 :            :                             {
    3595         [ +  - ]:          8 :                                 if ( nContentFlags & sheet::CellFlags::VALUE )
    3596                 :          8 :                                     bAdd = sal_True;
    3597                 :            :                             }
    3598                 :            :                         }
    3599                 :          8 :                         break;
    3600                 :            :                     default:
    3601                 :            :                         {
    3602                 :            :                             // added to avoid warnings
    3603                 :            :                         }
    3604                 :            :                 }
    3605                 :            : 
    3606         [ +  + ]:         32 :                 if (bAdd)
    3607                 :            :                     aMarkData.SetMultiMarkArea(
    3608                 :         16 :                             ScRange( aIter.GetCol(), aIter.GetRow(), aIter.GetTab() ),
    3609         [ +  - ]:         16 :                             sal_True );
    3610                 :            : 
    3611         [ +  - ]:         32 :                 pCell = aIter.GetNext();
    3612                 :            :             }
    3613                 :            : 
    3614                 :            :         }
    3615                 :            : 
    3616         [ +  - ]:          7 :         ScRangeList aNewRanges;
    3617         [ +  + ]:          7 :         if (aMarkData.IsMultiMarked())
    3618         [ +  - ]:          3 :             aMarkData.FillRangeListWithMarks( &aNewRanges, false );
    3619                 :            : 
    3620 [ +  - ][ +  - ]:          7 :         return new ScCellRangesObj( pDocShell, aNewRanges );    // aNewRanges kann leer sein
         [ +  - ][ +  - ]
                 [ +  - ]
    3621                 :            :     }
    3622                 :            : 
    3623 [ #  # ][ +  - ]:          7 :     return NULL;
    3624                 :            : }
    3625                 :            : 
    3626                 :          1 : uno::Reference<sheet::XSheetCellRanges> SAL_CALL ScCellRangesBase::queryFormulaCells(
    3627                 :            :                                                     sal_Int32 nResultFlags )
    3628                 :            :                                     throw(uno::RuntimeException)
    3629                 :            : {
    3630         [ +  - ]:          1 :     SolarMutexGuard aGuard;
    3631         [ +  - ]:          1 :     if (pDocShell)
    3632                 :            :     {
    3633                 :          1 :         ScDocument* pDoc = pDocShell->GetDocument();
    3634                 :            : 
    3635         [ +  - ]:          1 :         ScMarkData aMarkData;
    3636                 :            : 
    3637                 :            :         //  passende Zellen selektieren
    3638 [ +  - ][ +  + ]:          5 :         for ( size_t i = 0, nCount = aRanges.size(); i < nCount; ++i )
    3639                 :            :         {
    3640         [ +  - ]:          4 :             ScRange aRange = *aRanges[ i ];
    3641                 :            : 
    3642         [ +  - ]:          4 :             ScCellIterator aIter( pDoc, aRange );
    3643         [ +  - ]:          4 :             ScBaseCell* pCell = aIter.GetFirst();
    3644         [ +  + ]:         28 :             while (pCell)
    3645                 :            :             {
    3646         [ -  + ]:         24 :                 if (pCell->GetCellType() == CELLTYPE_FORMULA)
    3647                 :            :                 {
    3648         [ #  # ]:          0 :                     ScFormulaCell* pFCell = (ScFormulaCell*)pCell;
    3649                 :          0 :                     sal_Bool bAdd = false;
    3650 [ #  # ][ #  # ]:          0 :                     if (pFCell->GetErrCode())
    3651                 :            :                     {
    3652         [ #  # ]:          0 :                         if ( nResultFlags & sheet::FormulaResult::ERROR )
    3653                 :          0 :                             bAdd = sal_True;
    3654                 :            :                     }
    3655 [ #  # ][ #  # ]:          0 :                     else if (pFCell->IsValue())
    3656                 :            :                     {
    3657         [ #  # ]:          0 :                         if ( nResultFlags & sheet::FormulaResult::VALUE )
    3658                 :          0 :                             bAdd = sal_True;
    3659                 :            :                     }
    3660                 :            :                     else    // String
    3661                 :            :                     {
    3662         [ #  # ]:          0 :                         if ( nResultFlags & sheet::FormulaResult::STRING )
    3663                 :          0 :                             bAdd = sal_True;
    3664                 :            :                     }
    3665                 :            : 
    3666         [ #  # ]:          0 :                     if (bAdd)
    3667                 :            :                         aMarkData.SetMultiMarkArea(
    3668                 :          0 :                                 ScRange( aIter.GetCol(), aIter.GetRow(), aIter.GetTab() ),
    3669         [ #  # ]:          0 :                                 sal_True );
    3670                 :            :                 }
    3671                 :            : 
    3672         [ +  - ]:         24 :                 pCell = aIter.GetNext();
    3673                 :            :             }
    3674                 :            :         }
    3675                 :            : 
    3676         [ +  - ]:          1 :         ScRangeList aNewRanges;
    3677         [ -  + ]:          1 :         if (aMarkData.IsMultiMarked())
    3678         [ #  # ]:          0 :             aMarkData.FillRangeListWithMarks( &aNewRanges, false );
    3679                 :            : 
    3680 [ +  - ][ +  - ]:          1 :         return new ScCellRangesObj( pDocShell, aNewRanges );    // aNewRanges kann leer sein
         [ +  - ][ +  - ]
                 [ +  - ]
    3681                 :            :     }
    3682                 :            : 
    3683 [ #  # ][ +  - ]:          1 :     return NULL;
    3684                 :            : }
    3685                 :            : 
    3686                 :         14 : uno::Reference<sheet::XSheetCellRanges> ScCellRangesBase::QueryDifferences_Impl(
    3687                 :            :                         const table::CellAddress& aCompare, sal_Bool bColumnDiff)
    3688                 :            : {
    3689         [ +  - ]:         14 :     if (pDocShell)
    3690                 :            :     {
    3691         [ +  - ]:         14 :         size_t nRangeCount = aRanges.size();
    3692                 :            :         size_t i;
    3693                 :         14 :         ScDocument* pDoc = pDocShell->GetDocument();
    3694         [ +  - ]:         14 :         ScMarkData aMarkData;
    3695                 :            : 
    3696         [ +  + ]:         14 :         SCCOLROW nCmpPos = bColumnDiff ? (SCCOLROW)aCompare.Row : (SCCOLROW)aCompare.Column;
    3697                 :            : 
    3698                 :            :         //  zuerst alles selektieren, wo ueberhaupt etwas in der Vergleichsspalte steht
    3699                 :            :         //  (fuer gleiche Zellen wird die Selektion im zweiten Schritt aufgehoben)
    3700                 :            : 
    3701         [ +  - ]:         14 :         SCTAB nTab = lcl_FirstTab(aRanges); //! fuer alle Tabellen, wenn Markierungen pro Tabelle!
    3702                 :         14 :         ScRange aCmpRange, aCellRange;
    3703         [ +  + ]:         14 :         if (bColumnDiff)
    3704                 :          7 :             aCmpRange = ScRange( 0,nCmpPos,nTab, MAXCOL,nCmpPos,nTab );
    3705                 :            :         else
    3706                 :          7 :             aCmpRange = ScRange( static_cast<SCCOL>(nCmpPos),0,nTab, static_cast<SCCOL>(nCmpPos),MAXROW,nTab );
    3707         [ +  - ]:         14 :         ScCellIterator aCmpIter( pDoc, aCmpRange );
    3708         [ +  - ]:         14 :         ScBaseCell* pCmpCell = aCmpIter.GetFirst();
    3709         [ +  + ]:         60 :         while (pCmpCell)
    3710                 :            :         {
    3711         [ +  - ]:         46 :             if (pCmpCell->GetCellType() != CELLTYPE_NOTE)
    3712                 :            :             {
    3713         [ +  + ]:         46 :                 SCCOLROW nCellPos = bColumnDiff ? static_cast<SCCOLROW>(aCmpIter.GetCol()) : static_cast<SCCOLROW>(aCmpIter.GetRow());
    3714         [ +  + ]:         46 :                 if (bColumnDiff)
    3715                 :            :                     aCellRange = ScRange( static_cast<SCCOL>(nCellPos),0,nTab,
    3716                 :         22 :                             static_cast<SCCOL>(nCellPos),MAXROW,nTab );
    3717                 :            :                 else
    3718                 :         24 :                     aCellRange = ScRange( 0,nCellPos,nTab, MAXCOL,nCellPos,nTab );
    3719                 :            : 
    3720         [ +  + ]:        152 :                 for (i=0; i<nRangeCount; i++)
    3721                 :            :                 {
    3722         [ +  - ]:        106 :                     ScRange aRange( *aRanges[ i ] );
    3723 [ +  + ][ +  - ]:        106 :                     if ( aRange.Intersects( aCellRange ) )
    3724                 :            :                     {
    3725         [ +  + ]:         38 :                         if (bColumnDiff)
    3726                 :            :                         {
    3727                 :         16 :                             aRange.aStart.SetCol(static_cast<SCCOL>(nCellPos));
    3728                 :         16 :                             aRange.aEnd.SetCol(static_cast<SCCOL>(nCellPos));
    3729                 :            :                         }
    3730                 :            :                         else
    3731                 :            :                         {
    3732                 :         22 :                             aRange.aStart.SetRow(nCellPos);
    3733                 :         22 :                             aRange.aEnd.SetRow(nCellPos);
    3734                 :            :                         }
    3735         [ +  - ]:         38 :                         aMarkData.SetMultiMarkArea( aRange );
    3736                 :            :                     }
    3737                 :            :                 }
    3738                 :            :             }
    3739         [ +  - ]:         46 :             pCmpCell = aCmpIter.GetNext();
    3740                 :            :         }
    3741                 :            : 
    3742                 :            :         //  alle nichtleeren Zellen mit der Vergleichsspalte vergleichen und entsprechend
    3743                 :            :         //  selektieren oder aufheben
    3744                 :            : 
    3745                 :         14 :         ScAddress aCmpAddr;
    3746         [ +  + ]:         34 :         for (i=0; i<nRangeCount; i++)
    3747                 :            :         {
    3748         [ +  - ]:         20 :             ScRange aRange( *aRanges[ i ] );
    3749                 :            : 
    3750         [ +  - ]:         20 :             ScCellIterator aIter( pDoc, aRange );
    3751         [ +  - ]:         20 :             ScBaseCell* pCell = aIter.GetFirst();
    3752         [ +  + ]:         88 :             while (pCell)
    3753                 :            :             {
    3754         [ +  + ]:         68 :                 if (bColumnDiff)
    3755                 :         34 :                     aCmpAddr = ScAddress( aIter.GetCol(), nCmpPos, aIter.GetTab() );
    3756                 :            :                 else
    3757                 :         34 :                     aCmpAddr = ScAddress( static_cast<SCCOL>(nCmpPos), aIter.GetRow(), aIter.GetTab() );
    3758         [ +  - ]:         68 :                 const ScBaseCell* pOtherCell = pDoc->GetCell( aCmpAddr );
    3759                 :            : 
    3760                 :         68 :                 ScRange aOneRange( aIter.GetCol(), aIter.GetRow(), aIter.GetTab() );
    3761 [ +  + ][ +  - ]:         68 :                 if ( !ScBaseCell::CellEqual( pCell, pOtherCell ) )
    3762         [ +  - ]:         18 :                     aMarkData.SetMultiMarkArea( aOneRange );
    3763                 :            :                 else
    3764         [ +  - ]:         50 :                     aMarkData.SetMultiMarkArea( aOneRange, false );     // deselect
    3765                 :            : 
    3766         [ +  - ]:         68 :                 pCell = aIter.GetNext();
    3767                 :            :             }
    3768                 :            :         }
    3769                 :            : 
    3770         [ +  - ]:         14 :         ScRangeList aNewRanges;
    3771         [ +  - ]:         14 :         if (aMarkData.IsMultiMarked())
    3772         [ +  - ]:         14 :             aMarkData.FillRangeListWithMarks( &aNewRanges, false );
    3773                 :            : 
    3774 [ +  - ][ +  - ]:         14 :         return new ScCellRangesObj( pDocShell, aNewRanges );    // aNewRanges kann leer sein
         [ +  - ][ +  - ]
                 [ +  - ]
    3775                 :            :     }
    3776                 :         14 :     return NULL;
    3777                 :            : }
    3778                 :            : 
    3779                 :          7 : uno::Reference<sheet::XSheetCellRanges > SAL_CALL ScCellRangesBase::queryColumnDifferences(
    3780                 :            :                             const table::CellAddress& aCompare ) throw(uno::RuntimeException)
    3781                 :            : {
    3782         [ +  - ]:          7 :     SolarMutexGuard aGuard;
    3783 [ +  - ][ +  - ]:          7 :     return QueryDifferences_Impl( aCompare, true );
    3784                 :            : }
    3785                 :            : 
    3786                 :          7 : uno::Reference<sheet::XSheetCellRanges> SAL_CALL ScCellRangesBase::queryRowDifferences(
    3787                 :            :                             const table::CellAddress& aCompare ) throw(uno::RuntimeException)
    3788                 :            : {
    3789         [ +  - ]:          7 :     SolarMutexGuard aGuard;
    3790 [ +  - ][ +  - ]:          7 :     return QueryDifferences_Impl( aCompare, false );
    3791                 :            : }
    3792                 :            : 
    3793                 :          3 : uno::Reference<sheet::XSheetCellRanges> SAL_CALL ScCellRangesBase::queryIntersection(
    3794                 :            :                             const table::CellRangeAddress& aRange ) throw(uno::RuntimeException)
    3795                 :            : {
    3796         [ +  - ]:          3 :     SolarMutexGuard aGuard;
    3797                 :            :     ScRange aMask( (SCCOL)aRange.StartColumn, (SCROW)aRange.StartRow, aRange.Sheet,
    3798                 :          3 :                    (SCCOL)aRange.EndColumn,   (SCROW)aRange.EndRow,   aRange.Sheet );
    3799                 :            : 
    3800         [ +  - ]:          3 :     ScRangeList aNew;
    3801 [ +  - ][ +  + ]:          9 :     for ( size_t i = 0, nCount = aRanges.size(); i < nCount; ++i )
    3802                 :            :     {
    3803         [ +  - ]:          6 :         ScRange aTemp( *aRanges[ i ] );
    3804 [ +  + ][ +  - ]:          6 :         if ( aTemp.Intersects( aMask ) )
    3805                 :          4 :             aNew.Join( ScRange( Max( aTemp.aStart.Col(), aMask.aStart.Col() ),
    3806                 :            :                                 Max( aTemp.aStart.Row(), aMask.aStart.Row() ),
    3807                 :          4 :                                 Max( aTemp.aStart.Tab(), aMask.aStart.Tab() ),
    3808                 :          4 :                                 Min( aTemp.aEnd.Col(), aMask.aEnd.Col() ),
    3809                 :            :                                 Min( aTemp.aEnd.Row(), aMask.aEnd.Row() ),
    3810         [ +  - ]:         12 :                                 Min( aTemp.aEnd.Tab(), aMask.aEnd.Tab() ) ) );
    3811                 :            :     }
    3812                 :            : 
    3813 [ +  - ][ +  - ]:          3 :     return new ScCellRangesObj( pDocShell, aNew );  // kann leer sein
         [ +  - ][ +  - ]
                 [ +  - ]
    3814                 :            : }
    3815                 :            : 
    3816                 :            : // XFormulaQuery
    3817                 :            : 
    3818                 :          4 : uno::Reference<sheet::XSheetCellRanges> SAL_CALL ScCellRangesBase::queryPrecedents(
    3819                 :            :                                 sal_Bool bRecursive ) throw(uno::RuntimeException)
    3820                 :            : {
    3821         [ +  - ]:          4 :     SolarMutexGuard aGuard;
    3822         [ +  - ]:          4 :     if ( pDocShell )
    3823                 :            :     {
    3824                 :          4 :         ScDocument* pDoc = pDocShell->GetDocument();
    3825                 :            : 
    3826         [ +  - ]:          4 :         ScRangeList aNewRanges(aRanges);
    3827                 :            :         sal_Bool bFound;
    3828 [ -  + ][ #  # ]:          4 :         do
                 [ -  + ]
    3829                 :            :         {
    3830                 :          4 :             bFound = false;
    3831                 :            : 
    3832                 :            :             //  aMarkData uses aNewRanges, not aRanges, so GetMarkData can't be used
    3833         [ +  - ]:          4 :             ScMarkData aMarkData;
    3834         [ +  - ]:          4 :             aMarkData.MarkFromRangeList( aNewRanges, false );
    3835         [ +  - ]:          4 :             aMarkData.MarkToMulti();        // needed for IsAllMarked
    3836                 :            : 
    3837 [ +  - ][ +  + ]:         11 :             for (size_t nR = 0, nCount = aNewRanges.size(); nR<nCount; ++nR)
    3838                 :            :             {
    3839         [ +  - ]:          7 :                 ScRange aRange( *aNewRanges[ nR] );
    3840         [ +  - ]:          7 :                 ScCellIterator aIter( pDoc, aRange );
    3841         [ +  - ]:          7 :                 ScBaseCell* pCell = aIter.GetFirst();
    3842         [ +  + ]:         45 :                 while (pCell)
    3843                 :            :                 {
    3844         [ +  + ]:         38 :                     if ( pCell->GetCellType() == CELLTYPE_FORMULA )
    3845                 :            :                     {
    3846         [ +  - ]:          3 :                         ScFormulaCell* pFCell = (ScFormulaCell*) pCell;
    3847                 :            : 
    3848         [ +  - ]:          3 :                         ScDetectiveRefIter aRefIter( pFCell );
    3849                 :          3 :                         ScRange aRefRange;
    3850 [ +  - ][ +  + ]:          6 :                         while ( aRefIter.GetNextRef( aRefRange) )
    3851                 :            :                         {
    3852 [ -  + ][ #  # ]:          3 :                             if ( bRecursive && !bFound && !aMarkData.IsAllMarked( aRefRange ) )
         [ #  # ][ #  # ]
                 [ -  + ]
    3853                 :          0 :                                 bFound = sal_True;
    3854         [ +  - ]:          3 :                             aMarkData.SetMultiMarkArea( aRefRange, sal_True );
    3855                 :            :                         }
    3856                 :            :                     }
    3857         [ +  - ]:         38 :                     pCell = aIter.GetNext();
    3858                 :            :                 }
    3859                 :            :             }
    3860                 :            : 
    3861 [ +  - ][ +  - ]:          4 :             aMarkData.FillRangeListWithMarks( &aNewRanges, sal_True );
    3862                 :            :         }
    3863                 :            :         while ( bRecursive && bFound );
    3864                 :            : 
    3865 [ +  - ][ +  - ]:          4 :         return new ScCellRangesObj( pDocShell, aNewRanges );
         [ +  - ][ +  - ]
    3866                 :            :     }
    3867                 :            : 
    3868 [ #  # ][ +  - ]:          4 :     return NULL;
    3869                 :            : }
    3870                 :            : 
    3871                 :          4 : uno::Reference<sheet::XSheetCellRanges> SAL_CALL ScCellRangesBase::queryDependents(
    3872                 :            :                                 sal_Bool bRecursive ) throw(uno::RuntimeException)
    3873                 :            : {
    3874         [ +  - ]:          4 :     SolarMutexGuard aGuard;
    3875         [ +  - ]:          4 :     if ( pDocShell )
    3876                 :            :     {
    3877                 :          4 :         ScDocument* pDoc = pDocShell->GetDocument();
    3878                 :            : 
    3879         [ +  - ]:          4 :         ScRangeList aNewRanges(aRanges);
    3880                 :            :         sal_Bool bFound;
    3881 [ -  + ][ #  # ]:          4 :         do
                 [ -  + ]
    3882                 :            :         {
    3883                 :          4 :             bFound = false;
    3884                 :            : 
    3885                 :            :             //  aMarkData uses aNewRanges, not aRanges, so GetMarkData can't be used
    3886         [ +  - ]:          4 :             ScMarkData aMarkData;
    3887         [ +  - ]:          4 :             aMarkData.MarkFromRangeList( aNewRanges, false );
    3888         [ +  - ]:          4 :             aMarkData.MarkToMulti();        // needed for IsAllMarked
    3889                 :            : 
    3890         [ +  - ]:          4 :             SCTAB nTab = lcl_FirstTab(aNewRanges);              //! alle Tabellen
    3891                 :            : 
    3892         [ +  - ]:          4 :             ScCellIterator aCellIter( pDoc, 0,0, nTab, MAXCOL,MAXROW, nTab );
    3893         [ +  - ]:          4 :             ScBaseCell* pCell = aCellIter.GetFirst();
    3894         [ +  + ]:        124 :             while (pCell)
    3895                 :            :             {
    3896         [ +  + ]:        120 :                 if (pCell->GetCellType() == CELLTYPE_FORMULA)
    3897                 :            :                 {
    3898                 :          4 :                     sal_Bool bMark = false;
    3899 [ +  - ][ +  - ]:          4 :                     ScDetectiveRefIter aIter( (ScFormulaCell*) pCell );
    3900                 :          4 :                     ScRange aRefRange;
    3901 [ +  - ][ +  + ]:          8 :                     while ( aIter.GetNextRef( aRefRange) )
    3902                 :            :                     {
    3903         [ +  - ]:          4 :                         size_t nRangesCount = aNewRanges.size();
    3904         [ +  + ]:         11 :                         for (size_t nR = 0; nR < nRangesCount; ++nR)
    3905                 :            :                         {
    3906         [ +  - ]:          7 :                             ScRange aRange( *aNewRanges[ nR ] );
    3907 [ +  + ][ +  - ]:          7 :                             if (aRange.Intersects(aRefRange))
    3908                 :          3 :                                 bMark = sal_True;                   // von Teil des Ranges abhaengig
    3909                 :            :                         }
    3910                 :            :                     }
    3911         [ +  + ]:          4 :                     if (bMark)
    3912                 :            :                     {
    3913                 :          3 :                         ScRange aCellRange( aCellIter.GetCol(),
    3914                 :            :                                             aCellIter.GetRow(),
    3915                 :          6 :                                             aCellIter.GetTab() );
    3916 [ #  # ][ #  # ]:          3 :                         if ( bRecursive && !bFound && !aMarkData.IsAllMarked( aCellRange ) )
         [ #  # ][ -  + ]
                 [ -  + ]
    3917                 :          0 :                             bFound = sal_True;
    3918         [ +  - ]:          4 :                         aMarkData.SetMultiMarkArea( aCellRange, sal_True );
    3919                 :            :                     }
    3920                 :            :                 }
    3921         [ +  - ]:        120 :                 pCell = aCellIter.GetNext();
    3922                 :            :             }
    3923                 :            : 
    3924 [ +  - ][ +  - ]:          4 :             aMarkData.FillRangeListWithMarks( &aNewRanges, sal_True );
    3925                 :            :         }
    3926                 :            :         while ( bRecursive && bFound );
    3927                 :            : 
    3928 [ +  - ][ +  - ]:          4 :         return new ScCellRangesObj( pDocShell, aNewRanges );
         [ +  - ][ +  - ]
    3929                 :            :     }
    3930                 :            : 
    3931 [ #  # ][ +  - ]:          4 :     return NULL;
    3932                 :            : }
    3933                 :            : 
    3934                 :            : // XSearchable
    3935                 :            : 
    3936                 :         21 : uno::Reference<util::XSearchDescriptor> SAL_CALL ScCellRangesBase::createSearchDescriptor()
    3937                 :            :                                                             throw(uno::RuntimeException)
    3938                 :            : {
    3939         [ +  - ]:         21 :     SolarMutexGuard aGuard;
    3940 [ +  - ][ +  - ]:         21 :     return new ScCellSearchObj;
         [ +  - ][ +  - ]
    3941                 :            : }
    3942                 :            : 
    3943                 :          7 : uno::Reference<container::XIndexAccess> SAL_CALL ScCellRangesBase::findAll(
    3944                 :            :                         const uno::Reference<util::XSearchDescriptor>& xDesc )
    3945                 :            :                                                     throw(uno::RuntimeException)
    3946                 :            : {
    3947         [ +  - ]:          7 :     SolarMutexGuard aGuard;
    3948                 :            :     //  Wenn nichts gefunden wird, soll Null zurueckgegeben werden (?)
    3949                 :          7 :     uno::Reference<container::XIndexAccess> xRet;
    3950 [ +  - ][ +  - ]:          7 :     if ( pDocShell && xDesc.is() )
                 [ +  - ]
    3951                 :            :     {
    3952         [ +  - ]:          7 :         ScCellSearchObj* pSearch = ScCellSearchObj::getImplementation( xDesc );
    3953         [ +  - ]:          7 :         if (pSearch)
    3954                 :            :         {
    3955                 :          7 :             SvxSearchItem* pSearchItem = pSearch->GetSearchItem();
    3956         [ +  - ]:          7 :             if (pSearchItem)
    3957                 :            :             {
    3958                 :          7 :                 ScDocument* pDoc = pDocShell->GetDocument();
    3959                 :          7 :                 pSearchItem->SetCommand( SVX_SEARCHCMD_FIND_ALL );
    3960                 :            :                 //  immer nur innerhalb dieses Objekts
    3961 [ +  - ][ +  - ]:          7 :                 pSearchItem->SetSelection( !lcl_WholeSheet(aRanges) );
    3962                 :            : 
    3963 [ +  - ][ +  - ]:          7 :                 ScMarkData aMark(*GetMarkData());
    3964                 :            : 
    3965                 :          7 :                 rtl::OUString aDummyUndo;
    3966         [ +  - ]:          7 :                 ScRangeList aMatchedRanges;
    3967                 :          7 :                 SCCOL nCol = 0;
    3968                 :          7 :                 SCROW nRow = 0;
    3969                 :          7 :                 SCTAB nTab = 0;
    3970                 :            :                 bool bFound = pDoc->SearchAndReplace(
    3971         [ +  - ]:          7 :                     *pSearchItem, nCol, nRow, nTab, aMark, aMatchedRanges, aDummyUndo, NULL);
    3972         [ +  - ]:          7 :                 if (bFound)
    3973                 :            :                 {
    3974                 :            :                     //  bei findAll immer CellRanges, egal wieviel gefunden wurde
    3975 [ +  - ][ +  - ]:          7 :                     xRet.set(new ScCellRangesObj( pDocShell, aMatchedRanges ));
                 [ +  - ]
    3976 [ +  - ][ +  - ]:          7 :                 }
    3977                 :            :             }
    3978                 :            :         }
    3979                 :            :     }
    3980         [ +  - ]:          7 :     return xRet;
    3981                 :            : }
    3982                 :            : 
    3983                 :         43 : uno::Reference<uno::XInterface> ScCellRangesBase::Find_Impl(
    3984                 :            :                                     const uno::Reference<util::XSearchDescriptor>& xDesc,
    3985                 :            :                                     const ScAddress* pLastPos )
    3986                 :            : {
    3987                 :         43 :     uno::Reference<uno::XInterface> xRet;
    3988 [ +  - ][ +  - ]:         43 :     if ( pDocShell && xDesc.is() )
                 [ +  - ]
    3989                 :            :     {
    3990         [ +  - ]:         43 :         ScCellSearchObj* pSearch = ScCellSearchObj::getImplementation( xDesc );
    3991         [ +  - ]:         43 :         if (pSearch)
    3992                 :            :         {
    3993                 :         43 :             SvxSearchItem* pSearchItem = pSearch->GetSearchItem();
    3994         [ +  - ]:         43 :             if (pSearchItem)
    3995                 :            :             {
    3996                 :         43 :                 ScDocument* pDoc = pDocShell->GetDocument();
    3997                 :         43 :                 pSearchItem->SetCommand( SVX_SEARCHCMD_FIND );
    3998                 :            :                 //  immer nur innerhalb dieses Objekts
    3999 [ +  - ][ +  - ]:         43 :                 pSearchItem->SetSelection( !lcl_WholeSheet(aRanges) );
    4000                 :            : 
    4001 [ +  - ][ +  - ]:         43 :                 ScMarkData aMark(*GetMarkData());
    4002                 :            : 
    4003                 :            :                 SCCOL nCol;
    4004                 :            :                 SCROW nRow;
    4005                 :            :                 SCTAB nTab;
    4006         [ +  + ]:         43 :                 if (pLastPos)
    4007                 :          4 :                     pLastPos->GetVars( nCol, nRow, nTab );
    4008                 :            :                 else
    4009                 :            :                 {
    4010         [ +  - ]:         39 :                     nTab = lcl_FirstTab(aRanges);   //! mehrere Tabellen?
    4011         [ +  - ]:         39 :                     ScDocument::GetSearchAndReplaceStart( *pSearchItem, nCol, nRow );
    4012                 :            :                 }
    4013                 :            : 
    4014                 :         43 :                 rtl::OUString aDummyUndo;
    4015         [ +  - ]:         43 :                 ScRangeList aMatchedRanges;
    4016                 :            :                 bool bFound = pDoc->SearchAndReplace(
    4017         [ +  - ]:         43 :                     *pSearchItem, nCol, nRow, nTab, aMark, aMatchedRanges, aDummyUndo, NULL);
    4018         [ +  + ]:         43 :                 if (bFound)
    4019                 :            :                 {
    4020                 :         28 :                     ScAddress aFoundPos( nCol, nRow, nTab );
    4021 [ +  - ][ +  - ]:         28 :                     xRet.set((cppu::OWeakObject*) new ScCellObj( pDocShell, aFoundPos ));
                 [ +  - ]
    4022 [ +  - ][ +  - ]:         43 :                 }
    4023                 :            :             }
    4024                 :            :         }
    4025                 :            :     }
    4026                 :         43 :     return xRet;
    4027                 :            : }
    4028                 :            : 
    4029                 :         39 : uno::Reference<uno::XInterface> SAL_CALL ScCellRangesBase::findFirst(
    4030                 :            :                         const uno::Reference<util::XSearchDescriptor>& xDesc )
    4031                 :            :                                                 throw(uno::RuntimeException)
    4032                 :            : {
    4033         [ +  - ]:         39 :     SolarMutexGuard aGuard;
    4034 [ +  - ][ +  - ]:         39 :     return Find_Impl( xDesc, NULL );
    4035                 :            : }
    4036                 :            : 
    4037                 :          4 : uno::Reference<uno::XInterface> SAL_CALL ScCellRangesBase::findNext(
    4038                 :            :                         const uno::Reference<uno::XInterface>& xStartAt,
    4039                 :            :                         const uno::Reference<util::XSearchDescriptor >& xDesc )
    4040                 :            :                                                 throw(uno::RuntimeException)
    4041                 :            : {
    4042         [ +  - ]:          4 :     SolarMutexGuard aGuard;
    4043         [ +  - ]:          4 :     if ( xStartAt.is() )
    4044                 :            :     {
    4045         [ +  - ]:          4 :         ScCellRangesBase* pRangesImp = ScCellRangesBase::getImplementation( xStartAt );
    4046 [ +  - ][ +  - ]:          4 :         if ( pRangesImp && pRangesImp->GetDocShell() == pDocShell )
                 [ +  - ]
    4047                 :            :         {
    4048                 :          4 :             const ScRangeList& rStartRanges = pRangesImp->GetRangeList();
    4049 [ +  - ][ +  - ]:          4 :             if ( rStartRanges.size() == 1 )
    4050                 :            :             {
    4051         [ +  - ]:          4 :                 ScAddress aStartPos = rStartRanges[ 0 ]->aStart;
    4052         [ +  - ]:          4 :                 return Find_Impl( xDesc, &aStartPos );
    4053                 :            :             }
    4054                 :            :         }
    4055                 :            :     }
    4056 [ #  # ][ +  - ]:          4 :     return NULL;
    4057                 :            : }
    4058                 :            : 
    4059                 :            : // XReplaceable
    4060                 :            : 
    4061                 :         11 : uno::Reference<util::XReplaceDescriptor> SAL_CALL ScCellRangesBase::createReplaceDescriptor()
    4062                 :            :                                                 throw(uno::RuntimeException)
    4063                 :            : {
    4064         [ +  - ]:         11 :     SolarMutexGuard aGuard;
    4065 [ +  - ][ +  - ]:         11 :     return new ScCellSearchObj;
         [ +  - ][ +  - ]
    4066                 :            : }
    4067                 :            : 
    4068                 :         14 : sal_Int32 SAL_CALL ScCellRangesBase::replaceAll( const uno::Reference<util::XSearchDescriptor>& xDesc )
    4069                 :            :                                                 throw(uno::RuntimeException)
    4070                 :            : {
    4071         [ +  - ]:         14 :     SolarMutexGuard aGuard;
    4072                 :         14 :     sal_Int32 nReplaced = 0;
    4073 [ +  - ][ +  - ]:         14 :     if ( pDocShell && xDesc.is() )
                 [ +  - ]
    4074                 :            :     {
    4075         [ +  - ]:         14 :         ScCellSearchObj* pSearch = ScCellSearchObj::getImplementation( xDesc );
    4076         [ +  - ]:         14 :         if (pSearch)
    4077                 :            :         {
    4078                 :         14 :             SvxSearchItem* pSearchItem = pSearch->GetSearchItem();
    4079         [ +  - ]:         14 :             if (pSearchItem)
    4080                 :            :             {
    4081                 :         14 :                 ScDocument* pDoc = pDocShell->GetDocument();
    4082                 :         14 :                 sal_Bool bUndo(pDoc->IsUndoEnabled());
    4083                 :         14 :                 pSearchItem->SetCommand( SVX_SEARCHCMD_REPLACE_ALL );
    4084                 :            :                 //  immer nur innerhalb dieses Objekts
    4085 [ +  - ][ +  - ]:         14 :                 pSearchItem->SetSelection( !lcl_WholeSheet(aRanges) );
    4086                 :            : 
    4087 [ +  - ][ +  - ]:         14 :                 ScMarkData aMark(*GetMarkData());
    4088                 :            : 
    4089         [ +  - ]:         14 :                 SCTAB nTabCount = pDoc->GetTableCount();
    4090         [ +  - ]:         14 :                 bool bProtected = !pDocShell->IsEditable();
    4091 [ +  - ][ +  - ]:         14 :                 ScMarkData::iterator itr = aMark.begin(), itrEnd = aMark.end();
    4092 [ +  - ][ +  - ]:         28 :                 for (; itr != itrEnd && *itr < nTabCount; ++itr)
         [ +  + ][ +  - ]
         [ +  - ][ +  + ]
    4093 [ +  - ][ +  - ]:         14 :                     if ( pDoc->IsTabProtected(*itr) )
                 [ -  + ]
    4094                 :          0 :                         bProtected = true;
    4095         [ +  - ]:         14 :                 if (bProtected)
    4096                 :            :                 {
    4097                 :            :                     //! Exception, oder was?
    4098                 :            :                 }
    4099                 :            :                 else
    4100                 :            :                 {
    4101         [ +  - ]:         14 :                     SCTAB nTab = aMark.GetFirstSelected();      // bei SearchAndReplace nicht benutzt
    4102                 :         14 :                     SCCOL nCol = 0;
    4103                 :         14 :                     SCROW nRow = 0;
    4104                 :            : 
    4105                 :         14 :                     rtl::OUString aUndoStr;
    4106                 :         14 :                     ScDocument* pUndoDoc = NULL;
    4107         [ +  - ]:         14 :                     if (bUndo)
    4108                 :            :                     {
    4109 [ +  - ][ +  - ]:         14 :                         pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
    4110         [ +  - ]:         14 :                         pUndoDoc->InitUndo( pDoc, nTab, nTab );
    4111                 :            :                     }
    4112         [ +  - ]:         14 :                     itr = aMark.begin();
    4113 [ +  - ][ +  - ]:         28 :                     for (; itr != itrEnd && *itr < nTabCount; ++itr)
         [ +  + ][ +  - ]
         [ +  - ][ +  + ]
    4114 [ +  - ][ -  + ]:         14 :                         if ( *itr != nTab && bUndo)
         [ #  # ][ -  + ]
    4115 [ #  # ][ #  # ]:          0 :                             pUndoDoc->AddUndoTab( *itr, *itr );
                 [ #  # ]
    4116                 :         14 :                     ScMarkData* pUndoMark = NULL;
    4117         [ +  - ]:         14 :                     if (bUndo)
    4118 [ +  - ][ +  - ]:         14 :                         pUndoMark = new ScMarkData(aMark);
    4119                 :            : 
    4120                 :         14 :                     bool bFound = false;
    4121         [ +  - ]:         14 :                     if (bUndo)
    4122                 :            :                     {
    4123         [ +  - ]:         14 :                         ScRangeList aMatchedRanges;
    4124                 :            :                         bFound = pDoc->SearchAndReplace(
    4125 [ +  - ][ +  - ]:         14 :                             *pSearchItem, nCol, nRow, nTab, aMark, aMatchedRanges, aUndoStr, pUndoDoc );
    4126                 :            :                     }
    4127         [ +  - ]:         14 :                     if (bFound)
    4128                 :            :                     {
    4129         [ +  - ]:         14 :                         nReplaced = pUndoDoc->GetCellCount();
    4130                 :            : 
    4131         [ +  - ]:         14 :                         pDocShell->GetUndoManager()->AddUndoAction(
    4132                 :            :                             new ScUndoReplace( pDocShell, *pUndoMark, nCol, nRow, nTab,
    4133 [ +  - ][ +  - ]:         14 :                                                         aUndoStr, pUndoDoc, pSearchItem ) );
         [ +  - ][ +  - ]
                 [ +  - ]
    4134                 :            : 
    4135         [ +  - ]:         14 :                         pDocShell->PostPaintGridAll();
    4136         [ +  - ]:         14 :                         pDocShell->SetDocumentModified();
    4137                 :            :                     }
    4138                 :            :                     else
    4139                 :            :                     {
    4140 [ #  # ][ #  # ]:          0 :                         delete pUndoDoc;
    4141 [ #  # ][ #  # ]:          0 :                         delete pUndoMark;
    4142                 :            :                         // nReplaced bleibt 0
    4143                 :         14 :                     }
    4144         [ +  - ]:         14 :                 }
    4145                 :            :             }
    4146                 :            :         }
    4147                 :            :     }
    4148         [ +  - ]:         14 :     return nReplaced;
    4149                 :            : }
    4150                 :            : 
    4151                 :            : // XUnoTunnel
    4152                 :            : 
    4153                 :       3041 : sal_Int64 SAL_CALL ScCellRangesBase::getSomething(
    4154                 :            :                 const uno::Sequence<sal_Int8 >& rId ) throw(uno::RuntimeException)
    4155                 :            : {
    4156   [ +  -  +  + ]:       6082 :     if ( rId.getLength() == 16 &&
                 [ +  + ]
    4157                 :       3041 :           0 == memcmp( getUnoTunnelId().getConstArray(),
    4158                 :       3041 :                                     rId.getConstArray(), 16 ) )
    4159                 :            :     {
    4160                 :        681 :         return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this));
    4161                 :            :     }
    4162                 :       3041 :     return 0;
    4163                 :            : }
    4164                 :            : 
    4165                 :            : namespace
    4166                 :            : {
    4167                 :            :     class theScCellRangesBaseUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theScCellRangesBaseUnoTunnelId> {};
    4168                 :            : }
    4169                 :            : 
    4170                 :       3722 : const uno::Sequence<sal_Int8>& ScCellRangesBase::getUnoTunnelId()
    4171                 :            : {
    4172                 :       3722 :     return theScCellRangesBaseUnoTunnelId::get().getSeq();
    4173                 :            : }
    4174                 :            : 
    4175                 :        681 : ScCellRangesBase* ScCellRangesBase::getImplementation( const uno::Reference<uno::XInterface> xObj )
    4176                 :            : {
    4177                 :        681 :     ScCellRangesBase* pRet = NULL;
    4178         [ +  - ]:        681 :     uno::Reference<lang::XUnoTunnel> xUT( xObj, uno::UNO_QUERY );
    4179         [ +  - ]:        681 :     if (xUT.is())
    4180 [ +  - ][ +  - ]:        681 :         pRet = reinterpret_cast<ScCellRangesBase*>(sal::static_int_cast<sal_IntPtr>(xUT->getSomething(getUnoTunnelId())));
                 [ +  - ]
    4181                 :        681 :     return pRet;
    4182                 :            : }
    4183                 :            : 
    4184                 :            : //------------------------------------------------------------------------
    4185                 :            : 
    4186                 :            : typedef boost::ptr_vector<ScNamedEntry> ScNamedEntryArr_Impl;
    4187                 :            : 
    4188                 :       1638 : struct ScCellRangesObj::Impl
    4189                 :            : {
    4190                 :            :     ScNamedEntryArr_Impl m_aNamedEntries;
    4191                 :            : };
    4192                 :            : 
    4193                 :        819 : ScCellRangesObj::ScCellRangesObj(ScDocShell* pDocSh, const ScRangeList& rR)
    4194                 :            :     : ScCellRangesBase(pDocSh, rR)
    4195 [ +  - ][ +  - ]:        819 :     , m_pImpl(new Impl)
    4196                 :            : {
    4197                 :        819 : }
    4198                 :            : 
    4199         [ +  - ]:        819 : ScCellRangesObj::~ScCellRangesObj()
    4200                 :            : {
    4201         [ -  + ]:       1638 : }
    4202                 :            : 
    4203                 :       1615 : void ScCellRangesObj::RefChanged()
    4204                 :            : {
    4205                 :       1615 :     ScCellRangesBase::RefChanged();
    4206                 :            : 
    4207                 :            :     //  nix weiter...
    4208                 :       1615 : }
    4209                 :            : 
    4210                 :       1919 : uno::Any SAL_CALL ScCellRangesObj::queryInterface( const uno::Type& rType )
    4211                 :            :                                                 throw(uno::RuntimeException)
    4212                 :            : {
    4213 [ +  + ][ +  - ]:       1919 :     SC_QUERYINTERFACE( sheet::XSheetCellRangeContainer )
    4214 [ +  + ][ +  - ]:       1173 :     SC_QUERYINTERFACE( sheet::XSheetCellRanges )
    4215 [ +  + ][ +  - ]:       1164 :     SC_QUERYINTERFACE( container::XIndexAccess )
    4216 [ -  + ][ #  # ]:       1161 :     SC_QUERY_MULTIPLE( container::XElementAccess, container::XIndexAccess )
                 [ #  # ]
    4217 [ +  + ][ +  - ]:       1161 :     SC_QUERYINTERFACE( container::XEnumerationAccess )
    4218 [ +  + ][ +  - ]:       1157 :     SC_QUERYINTERFACE( container::XNameContainer )
    4219 [ -  + ][ #  # ]:       1149 :     SC_QUERYINTERFACE( container::XNameReplace )
    4220 [ +  + ][ +  - ]:       1149 :     SC_QUERYINTERFACE( container::XNameAccess )
    4221                 :            : 
    4222                 :       1919 :     return ScCellRangesBase::queryInterface( rType );
    4223                 :            : }
    4224                 :            : 
    4225                 :       6649 : void SAL_CALL ScCellRangesObj::acquire() throw()
    4226                 :            : {
    4227                 :       6649 :     ScCellRangesBase::acquire();
    4228                 :       6649 : }
    4229                 :            : 
    4230                 :       6649 : void SAL_CALL ScCellRangesObj::release() throw()
    4231                 :            : {
    4232                 :       6649 :     ScCellRangesBase::release();
    4233                 :       6649 : }
    4234                 :            : 
    4235                 :          0 : uno::Sequence<uno::Type> SAL_CALL ScCellRangesObj::getTypes() throw(uno::RuntimeException)
    4236                 :            : {
    4237 [ #  # ][ #  # ]:          0 :     static uno::Sequence<uno::Type> aTypes;
         [ #  # ][ #  # ]
    4238         [ #  # ]:          0 :     if ( aTypes.getLength() == 0 )
    4239                 :            :     {
    4240         [ #  # ]:          0 :         uno::Sequence<uno::Type> aParentTypes(ScCellRangesBase::getTypes());
    4241                 :          0 :         long nParentLen = aParentTypes.getLength();
    4242                 :          0 :         const uno::Type* pParentPtr = aParentTypes.getConstArray();
    4243                 :            : 
    4244         [ #  # ]:          0 :         aTypes.realloc( nParentLen + 3 );
    4245         [ #  # ]:          0 :         uno::Type* pPtr = aTypes.getArray();
    4246         [ #  # ]:          0 :         pPtr[nParentLen + 0] = getCppuType((const uno::Reference<sheet::XSheetCellRangeContainer>*)0);
    4247         [ #  # ]:          0 :         pPtr[nParentLen + 1] = getCppuType((const uno::Reference<container::XNameContainer>*)0);
    4248         [ #  # ]:          0 :         pPtr[nParentLen + 2] = getCppuType((const uno::Reference<container::XEnumerationAccess>*)0);
    4249                 :            : 
    4250         [ #  # ]:          0 :         for (long i=0; i<nParentLen; i++)
    4251         [ #  # ]:          0 :             pPtr[i] = pParentPtr[i];                // parent types first
    4252                 :            :     }
    4253                 :          0 :     return aTypes;
    4254                 :            : }
    4255                 :            : 
    4256                 :            : namespace
    4257                 :            : {
    4258                 :            :     class theScCellRangesObjImplementationId : public rtl::Static< UnoTunnelIdInit, theScCellRangesObjImplementationId > {};
    4259                 :            : }
    4260                 :            : 
    4261                 :          0 : uno::Sequence<sal_Int8> SAL_CALL ScCellRangesObj::getImplementationId()
    4262                 :            :                                                     throw(uno::RuntimeException)
    4263                 :            : {
    4264                 :          0 :     return theScCellRangesObjImplementationId::get().getSeq();
    4265                 :            : }
    4266                 :            : 
    4267                 :            : // XCellRanges
    4268                 :            : 
    4269                 :         17 : ScCellRangeObj* ScCellRangesObj::GetObjectByIndex_Impl(sal_Int32 nIndex) const
    4270                 :            : {
    4271                 :         17 :     ScDocShell* pDocSh = GetDocShell();
    4272                 :         17 :     const ScRangeList& rRanges = GetRangeList();
    4273 [ +  - ][ +  + ]:         17 :     if ( pDocSh && nIndex >= 0 && nIndex < sal::static_int_cast<sal_Int32>(rRanges.size()) )
         [ +  + ][ +  - ]
    4274                 :            :     {
    4275         [ +  - ]:         15 :         ScRange aRange( *rRanges[ nIndex ] );
    4276         [ +  + ]:         15 :         if ( aRange.aStart == aRange.aEnd )
    4277         [ +  - ]:          6 :             return new ScCellObj( pDocSh, aRange.aStart );
    4278                 :            :         else
    4279         [ +  - ]:         15 :             return new ScCellRangeObj( pDocSh, aRange );
    4280                 :            :     }
    4281                 :            : 
    4282                 :         17 :     return NULL;        // keine DocShell oder falscher Index
    4283                 :            : }
    4284                 :            : 
    4285                 :        364 : uno::Sequence<table::CellRangeAddress> SAL_CALL ScCellRangesObj::getRangeAddresses()
    4286                 :            :                                                     throw(uno::RuntimeException)
    4287                 :            : {
    4288         [ +  - ]:        364 :     SolarMutexGuard aGuard;
    4289                 :        364 :     ScDocShell* pDocSh = GetDocShell();
    4290                 :        364 :     const ScRangeList& rRanges = GetRangeList();
    4291         [ +  - ]:        364 :     size_t nCount = rRanges.size();
    4292 [ +  - ][ +  + ]:        364 :     if ( pDocSh && nCount )
    4293                 :            :     {
    4294                 :        361 :         table::CellRangeAddress aRangeAddress;
    4295         [ +  - ]:        361 :         uno::Sequence<table::CellRangeAddress> aSeq(nCount);
    4296         [ +  - ]:        361 :         table::CellRangeAddress* pAry = aSeq.getArray();
    4297         [ +  + ]:        790 :         for ( size_t i=0; i < nCount; i++)
    4298                 :            :         {
    4299         [ +  - ]:        429 :             ScUnoConversion::FillApiRange( aRangeAddress, *rRanges[ i ] );
    4300                 :        429 :             pAry[i] = aRangeAddress;
    4301                 :            :         }
    4302 [ +  - ][ +  - ]:        361 :         return aSeq;
    4303                 :            :     }
    4304                 :            : 
    4305 [ +  - ][ +  - ]:        364 :     return uno::Sequence<table::CellRangeAddress>(0);   // leer ist moeglich
    4306                 :            : }
    4307                 :            : 
    4308                 :          8 : uno::Reference<container::XEnumerationAccess> SAL_CALL ScCellRangesObj::getCells()
    4309                 :            :                                                     throw(uno::RuntimeException)
    4310                 :            : {
    4311         [ +  - ]:          8 :     SolarMutexGuard aGuard;
    4312                 :            : 
    4313                 :            :     //  getCells with empty range list is possible (no exception),
    4314                 :            :     //  the resulting enumeration just has no elements
    4315                 :            :     //  (same behaviour as a valid range with no cells)
    4316                 :            :     //  This is handled in ScCellsEnumeration ctor.
    4317                 :            : 
    4318                 :          8 :     const ScRangeList& rRanges = GetRangeList();
    4319                 :          8 :     ScDocShell* pDocSh = GetDocShell();
    4320         [ +  - ]:          8 :     if (pDocSh)
    4321 [ +  - ][ +  - ]:          8 :         return new ScCellsObj( pDocSh, rRanges );
                 [ +  - ]
    4322 [ #  # ][ +  - ]:          8 :     return NULL;
    4323                 :            : }
    4324                 :            : 
    4325                 :         30 : rtl::OUString SAL_CALL ScCellRangesObj::getRangeAddressesAsString()
    4326                 :            :                                                 throw(uno::RuntimeException)
    4327                 :            : {
    4328         [ +  - ]:         30 :     SolarMutexGuard aGuard;
    4329         [ +  - ]:         30 :     String aString;
    4330                 :         30 :     ScDocShell* pDocSh = GetDocShell();
    4331                 :         30 :     const ScRangeList& rRanges = GetRangeList();
    4332         [ +  - ]:         30 :     if (pDocSh)
    4333         [ +  - ]:         30 :         rRanges.Format( aString, SCA_VALID | SCA_TAB_3D, pDocSh->GetDocument() );
    4334 [ +  - ][ +  - ]:         30 :     return aString;
                 [ +  - ]
    4335                 :            : }
    4336                 :            : 
    4337                 :            : // XSheetCellRangeContainer
    4338                 :            : 
    4339                 :       1560 : void SAL_CALL ScCellRangesObj::addRangeAddress( const table::CellRangeAddress& rRange,
    4340                 :            :                                     sal_Bool bMergeRanges )
    4341                 :            :                                     throw(::com::sun::star::uno::RuntimeException)
    4342                 :            : {
    4343         [ +  - ]:       1560 :     SolarMutexGuard aGuard;
    4344                 :            :     ScRange aRange(static_cast<SCCOL>(rRange.StartColumn),
    4345                 :            :             static_cast<SCROW>(rRange.StartRow),
    4346                 :            :             static_cast<SCTAB>(rRange.Sheet),
    4347                 :            :             static_cast<SCCOL>(rRange.EndColumn),
    4348                 :            :             static_cast<SCROW>(rRange.EndRow),
    4349                 :       1560 :             static_cast<SCTAB>(rRange.Sheet));
    4350 [ +  - ][ +  - ]:       1560 :     AddRange(aRange, bMergeRanges);
    4351                 :       1560 : }
    4352                 :            : 
    4353                 :          8 : void lcl_RemoveNamedEntry( ScNamedEntryArr_Impl& rNamedEntries, const ScRange& rRange )
    4354                 :            : {
    4355                 :          8 :     sal_uInt16 nCount = rNamedEntries.size();
    4356         [ +  + ]:         18 :     for ( sal_uInt16 n=nCount; n--; )
    4357         [ +  + ]:         10 :         if ( rNamedEntries[n].GetRange() == rRange )
    4358                 :          4 :             rNamedEntries.erase( rNamedEntries.begin() + n );
    4359                 :          8 : }
    4360                 :            : 
    4361                 :          8 : void SAL_CALL ScCellRangesObj::removeRangeAddress( const table::CellRangeAddress& rRange )
    4362                 :            :                                 throw(::com::sun::star::container::NoSuchElementException,
    4363                 :            :                                     ::com::sun::star::uno::RuntimeException)
    4364                 :            : {
    4365         [ +  - ]:          8 :     SolarMutexGuard aGuard;
    4366                 :          8 :     const ScRangeList& rRanges = GetRangeList();
    4367                 :            : 
    4368         [ +  - ]:          8 :     ScRangeList aSheetRanges;
    4369         [ +  - ]:          8 :     ScRangeList aNotSheetRanges;
    4370 [ +  - ][ +  + ]:         25 :     for (size_t i = 0; i < rRanges.size(); ++i)
    4371                 :            :     {
    4372 [ +  - ][ +  + ]:         17 :         if (rRanges[ i]->aStart.Tab() == rRange.Sheet)
    4373                 :            :         {
    4374 [ +  - ][ +  - ]:         14 :             aSheetRanges.Append( *rRanges[ i ] );
    4375                 :            :         }
    4376                 :            :         else
    4377                 :            :         {
    4378 [ +  - ][ +  - ]:          3 :             aNotSheetRanges.Append( *rRanges[ i ] );
    4379                 :            :         }
    4380                 :            :     }
    4381         [ +  - ]:          8 :     ScMarkData aMarkData;
    4382         [ +  - ]:          8 :     aMarkData.MarkFromRangeList( aSheetRanges, false );
    4383                 :            :     ScRange aRange(static_cast<SCCOL>(rRange.StartColumn),
    4384                 :            :                 static_cast<SCROW>(rRange.StartRow),
    4385                 :            :                 static_cast<SCTAB>(rRange.Sheet),
    4386                 :            :                 static_cast<SCCOL>(rRange.EndColumn),
    4387                 :            :                 static_cast<SCROW>(rRange.EndRow),
    4388                 :          8 :                 static_cast<SCTAB>(rRange.Sheet));
    4389 [ +  - ][ +  - ]:          8 :     if (aMarkData.GetTableSelect( aRange.aStart.Tab() ))
    4390                 :            :     {
    4391         [ +  - ]:          8 :         aMarkData.MarkToMulti();
    4392 [ +  - ][ +  - ]:          8 :         if (aMarkData.IsAllMarked( aRange ) )
    4393                 :            :         {
    4394         [ +  - ]:          8 :             aMarkData.SetMultiMarkArea( aRange, false );
    4395         [ +  - ]:          8 :             lcl_RemoveNamedEntry(m_pImpl->m_aNamedEntries, aRange);
    4396                 :            :         }
    4397                 :            :         else
    4398         [ #  # ]:          0 :             throw container::NoSuchElementException();
    4399                 :            :     }
    4400         [ +  - ]:          8 :     SetNewRanges(aNotSheetRanges);
    4401         [ +  - ]:          8 :     ScRangeList aNew;
    4402         [ +  - ]:          8 :     aMarkData.FillRangeListWithMarks( &aNew, false );
    4403 [ +  - ][ +  + ]:         14 :     for ( size_t j = 0; j < aNew.size(); ++j)
    4404                 :            :     {
    4405 [ +  - ][ +  - ]:          6 :         AddRange(*aNew[ j ], false);
    4406 [ +  - ][ +  - ]:          8 :     }
         [ +  - ][ +  - ]
                 [ +  - ]
    4407                 :          8 : }
    4408                 :            : 
    4409                 :          1 : void SAL_CALL ScCellRangesObj::addRangeAddresses( const uno::Sequence<table::CellRangeAddress >& rRanges,
    4410                 :            :                                     sal_Bool bMergeRanges )
    4411                 :            :                                     throw(::com::sun::star::uno::RuntimeException)
    4412                 :            : {
    4413         [ +  - ]:          1 :     SolarMutexGuard aGuard;
    4414                 :          1 :     sal_Int32 nCount(rRanges.getLength());
    4415         [ +  - ]:          1 :     if (nCount)
    4416                 :            :     {
    4417                 :          1 :         const table::CellRangeAddress* pRanges = rRanges.getConstArray();
    4418         [ +  + ]:          4 :         for (sal_Int32 i = 0; i < rRanges.getLength(); i++, pRanges++)
    4419                 :            :         {
    4420                 :            :             ScRange aRange(static_cast<SCCOL>(pRanges->StartColumn),
    4421                 :            :                     static_cast<SCROW>(pRanges->StartRow),
    4422                 :            :                     static_cast<SCTAB>(pRanges->Sheet),
    4423                 :            :                     static_cast<SCCOL>(pRanges->EndColumn),
    4424                 :            :                     static_cast<SCROW>(pRanges->EndRow),
    4425                 :          3 :                     static_cast<SCTAB>(pRanges->Sheet));
    4426         [ +  - ]:          3 :             AddRange(aRange, bMergeRanges);
    4427                 :            :         }
    4428         [ +  - ]:          1 :     }
    4429                 :          1 : }
    4430                 :            : 
    4431                 :          4 : void SAL_CALL ScCellRangesObj::removeRangeAddresses( const uno::Sequence<table::CellRangeAddress >& rRangeSeq )
    4432                 :            :                                 throw(::com::sun::star::container::NoSuchElementException,
    4433                 :            :                                     ::com::sun::star::uno::RuntimeException)
    4434                 :            : {
    4435                 :            :     // use sometimes a better/faster implementation
    4436                 :          4 :     sal_uInt32 nCount(rRangeSeq.getLength());
    4437         [ +  + ]:          4 :     if (nCount)
    4438                 :            :     {
    4439                 :          2 :         const table::CellRangeAddress* pRanges = rRangeSeq.getConstArray();
    4440         [ +  + ]:          9 :         for (sal_uInt32 i=0; i < nCount; ++i, ++pRanges)
    4441                 :            :         {
    4442                 :          7 :             removeRangeAddress(*pRanges);
    4443                 :            :         }
    4444                 :            :     }
    4445                 :          4 : }
    4446                 :            : 
    4447                 :            : // XNameContainer
    4448                 :            : 
    4449                 :          4 : void lcl_RemoveNamedEntry( ScNamedEntryArr_Impl& rNamedEntries, const String& rName )
    4450                 :            : {
    4451                 :          4 :     sal_uInt16 nCount = rNamedEntries.size();
    4452         [ +  + ]:         21 :     for ( sal_uInt16 n=nCount; n--; )
    4453         [ +  + ]:         17 :         if ( rNamedEntries[n].GetName() == rName )
    4454                 :          3 :             rNamedEntries.erase( rNamedEntries.begin() + n );
    4455                 :          4 : }
    4456                 :            : 
    4457                 :         37 : void SAL_CALL ScCellRangesObj::insertByName( const rtl::OUString& aName, const uno::Any& aElement )
    4458                 :            :                             throw(lang::IllegalArgumentException, container::ElementExistException,
    4459                 :            :                                     lang::WrappedTargetException, uno::RuntimeException)
    4460                 :            : {
    4461         [ +  - ]:         37 :     SolarMutexGuard aGuard;
    4462                 :         37 :     ScDocShell* pDocSh = GetDocShell();
    4463                 :         37 :     sal_Bool bDone = false;
    4464                 :            : 
    4465                 :            :     //! Type of aElement can be some specific interface instead of XInterface
    4466                 :            : 
    4467         [ +  - ]:         37 :     uno::Reference<uno::XInterface> xInterface(aElement, uno::UNO_QUERY);
    4468 [ +  - ][ +  + ]:         37 :     if ( pDocSh && xInterface.is() )
                 [ +  + ]
    4469                 :            :     {
    4470         [ +  - ]:         36 :         ScCellRangesBase* pRangesImp = ScCellRangesBase::getImplementation( xInterface );
    4471 [ +  - ][ +  - ]:         36 :         if ( pRangesImp && pRangesImp->GetDocShell() == pDocSh )
                 [ +  - ]
    4472                 :            :         {
    4473                 :            :             //  if explicit name is given and already existing, throw exception
    4474                 :            : 
    4475         [ +  - ]:         36 :             String aNamStr(aName);
    4476         [ +  - ]:         36 :             if ( aNamStr.Len() )
    4477                 :            :             {
    4478                 :         36 :                 size_t nNamedCount = m_pImpl->m_aNamedEntries.size();
    4479         [ +  + ]:         98 :                 for (size_t n = 0; n < nNamedCount; n++)
    4480                 :            :                 {
    4481 [ +  - ][ +  - ]:         63 :                     if (m_pImpl->m_aNamedEntries[n].GetName() == aNamStr)
                 [ +  + ]
    4482         [ +  - ]:          1 :                         throw container::ElementExistException();
    4483                 :            :                 }
    4484                 :            :             }
    4485                 :            : 
    4486         [ +  - ]:         35 :             ScRangeList aNew(GetRangeList());
    4487                 :         35 :             const ScRangeList& rAddRanges = pRangesImp->GetRangeList();
    4488         [ +  - ]:         35 :             size_t nAddCount = rAddRanges.size();
    4489         [ +  + ]:         70 :             for ( size_t i = 0; i < nAddCount; i++ )
    4490 [ +  - ][ +  - ]:         35 :                 aNew.Join( *rAddRanges[ i ] );
    4491         [ +  - ]:         35 :             SetNewRanges(aNew);
    4492                 :         35 :             bDone = sal_True;
    4493                 :            : 
    4494 [ +  - ][ +  - ]:         35 :             if ( !aName.isEmpty() && nAddCount == 1 )
                 [ +  - ]
    4495                 :            :             {
    4496                 :            :                 //  if a name is given, also insert into list of named entries
    4497                 :            :                 //  (only possible for a single range)
    4498                 :            :                 //  name is not in m_pImpl->m_aNamedEntries (tested above)
    4499                 :            : 
    4500 [ +  - ][ +  - ]:         35 :                 ScNamedEntry* pEntry = new ScNamedEntry( aNamStr, *rAddRanges[ 0 ] );
                 [ +  - ]
    4501         [ +  - ]:         35 :                 m_pImpl->m_aNamedEntries.push_back(pEntry);
    4502 [ +  - ][ +  - ]:         36 :             }
    4503                 :            :         }
    4504                 :            :     }
    4505                 :            : 
    4506         [ +  + ]:         36 :     if (!bDone)
    4507                 :            :     {
    4508                 :            :         //  invalid element - double names are handled above
    4509         [ +  - ]:          1 :         throw lang::IllegalArgumentException();
    4510         [ +  - ]:         37 :     }
    4511                 :         35 : }
    4512                 :            : 
    4513                 :         13 : sal_Bool lcl_FindRangeByName( const ScRangeList& rRanges, ScDocShell* pDocSh,
    4514                 :            :                             const String& rName, size_t& rIndex )
    4515                 :            : {
    4516         [ +  - ]:         13 :     if (pDocSh)
    4517                 :            :     {
    4518         [ +  - ]:         13 :         String aRangeStr;
    4519                 :         13 :         ScDocument* pDoc = pDocSh->GetDocument();
    4520 [ +  + ][ +  - ]:         67 :         for ( size_t i = 0, nCount = rRanges.size(); i < nCount; i++ )
    4521                 :            :         {
    4522 [ +  - ][ +  - ]:         54 :             rRanges[ i ]->Format( aRangeStr, SCA_VALID | SCA_TAB_3D, pDoc );
    4523 [ +  - ][ -  + ]:         54 :             if ( aRangeStr == rName )
    4524                 :            :             {
    4525                 :          0 :                 rIndex = i;
    4526                 :          0 :                 return sal_True;
    4527                 :            :             }
    4528 [ +  - ][ +  - ]:         13 :         }
    4529                 :            :     }
    4530                 :         13 :     return false;   // nicht gefunden
    4531                 :            : }
    4532                 :            : 
    4533                 :          9 : sal_Bool lcl_FindRangeOrEntry( const ScNamedEntryArr_Impl& rNamedEntries,
    4534                 :            :                             const ScRangeList& rRanges, ScDocShell* pDocSh,
    4535                 :            :                             const String& rName, ScRange& rFound )
    4536                 :            : {
    4537                 :            :     //  exact range in list?
    4538                 :            : 
    4539                 :          9 :     size_t nIndex = 0;
    4540 [ +  - ][ -  + ]:          9 :     if ( lcl_FindRangeByName( rRanges, pDocSh, rName, nIndex ) )
    4541                 :            :     {
    4542         [ #  # ]:          0 :         rFound = *rRanges[ nIndex ];
    4543                 :          0 :         return true;
    4544                 :            :     }
    4545                 :            : 
    4546                 :            :     //  range contained in selection? (sheet must be specified)
    4547                 :            : 
    4548                 :          9 :     ScRange aCellRange;
    4549         [ +  - ]:          9 :     sal_uInt16 nParse = aCellRange.ParseAny( rName, pDocSh->GetDocument() );
    4550         [ -  + ]:          9 :     if ( ( nParse & ( SCA_VALID | SCA_TAB_3D ) ) == ( SCA_VALID | SCA_TAB_3D ) )
    4551                 :            :     {
    4552         [ #  # ]:          0 :         ScMarkData aMarkData;
    4553         [ #  # ]:          0 :         aMarkData.MarkFromRangeList( rRanges, false );
    4554         [ #  # ]:          0 :         aMarkData.MarkToMulti();        // needed for IsAllMarked
    4555 [ #  # ][ #  # ]:          0 :         if ( aMarkData.IsAllMarked( aCellRange ) )
    4556                 :            :         {
    4557                 :          0 :             rFound = aCellRange;
    4558                 :          0 :             return sal_True;
    4559 [ #  # ][ #  # ]:          0 :         }
    4560                 :            :     }
    4561                 :            : 
    4562                 :            :     //  named entry in this object?
    4563                 :            : 
    4564         [ +  - ]:          9 :     if ( !rNamedEntries.empty() )
    4565                 :            :     {
    4566         [ +  + ]:         31 :         for ( sal_uInt16 n=0; n<rNamedEntries.size(); n++ )
    4567 [ +  - ][ +  - ]:         28 :             if ( rNamedEntries[n].GetName() == rName )
                 [ +  + ]
    4568                 :            :             {
    4569                 :            :                 //  test if named entry is contained in rRanges
    4570                 :            : 
    4571         [ +  - ]:          6 :                 const ScRange& rComp = rNamedEntries[n].GetRange();
    4572         [ +  - ]:          6 :                 ScMarkData aMarkData;
    4573         [ +  - ]:          6 :                 aMarkData.MarkFromRangeList( rRanges, false );
    4574         [ +  - ]:          6 :                 aMarkData.MarkToMulti();        // needed for IsAllMarked
    4575 [ +  - ][ +  - ]:          6 :                 if ( aMarkData.IsAllMarked( rComp ) )
    4576                 :            :                 {
    4577                 :          6 :                     rFound = rComp;
    4578                 :          6 :                     return sal_True;
    4579 [ +  - ][ -  + ]:          6 :                 }
    4580                 :            :             }
    4581                 :            :     }
    4582                 :            : 
    4583                 :          9 :     return false;       // not found
    4584                 :            : }
    4585                 :            : 
    4586                 :          4 : void SAL_CALL ScCellRangesObj::removeByName( const rtl::OUString& aName )
    4587                 :            :                                 throw(container::NoSuchElementException,
    4588                 :            :                                     lang::WrappedTargetException, uno::RuntimeException)
    4589                 :            : {
    4590         [ +  - ]:          4 :     SolarMutexGuard aGuard;
    4591                 :          4 :     sal_Bool bDone = false;
    4592         [ +  - ]:          4 :     String aNameStr(aName);
    4593                 :          4 :     ScDocShell* pDocSh = GetDocShell();
    4594                 :          4 :     const ScRangeList& rRanges = GetRangeList();
    4595                 :          4 :     size_t nIndex = 0;
    4596 [ -  + ][ +  - ]:          4 :     if ( lcl_FindRangeByName( rRanges, pDocSh, aNameStr, nIndex ) )
    4597                 :            :     {
    4598                 :            :         //  einzelnen Range weglassen
    4599         [ #  # ]:          0 :         ScRangeList aNew;
    4600 [ #  # ][ #  # ]:          0 :         for ( size_t i = 0, nCount = rRanges.size(); i < nCount; i++ )
    4601         [ #  # ]:          0 :             if (i != nIndex)
    4602 [ #  # ][ #  # ]:          0 :                 aNew.Append( *rRanges[ i ] );
    4603         [ #  # ]:          0 :         SetNewRanges(aNew);
    4604         [ #  # ]:          0 :         bDone = sal_True;
    4605                 :            :     }
    4606         [ +  - ]:          4 :     else if (pDocSh)
    4607                 :            :     {
    4608                 :            :         //  deselect any ranges (parsed or named entry)
    4609         [ +  - ]:          4 :         ScRangeList aDiff;
    4610         [ +  - ]:          4 :         sal_Bool bValid = ( aDiff.Parse( aNameStr, pDocSh->GetDocument() ) & SCA_VALID ) != 0;
    4611 [ +  - ][ +  - ]:          4 :         if (!bValid && !m_pImpl->m_aNamedEntries.empty())
                 [ +  - ]
    4612                 :            :         {
    4613                 :          4 :             sal_uInt16 nCount = m_pImpl->m_aNamedEntries.size();
    4614 [ +  + ][ +  + ]:         18 :             for (sal_uInt16 n=0; n<nCount && !bValid; n++)
                 [ +  + ]
    4615 [ +  - ][ +  - ]:         14 :                 if (m_pImpl->m_aNamedEntries[n].GetName() == aNameStr)
                 [ +  + ]
    4616                 :            :                 {
    4617         [ +  - ]:          3 :                     aDiff.RemoveAll();
    4618 [ +  - ][ +  - ]:          3 :                     aDiff.Append(m_pImpl->m_aNamedEntries[n].GetRange());
    4619                 :          3 :                     bValid = sal_True;
    4620                 :            :                 }
    4621                 :            :         }
    4622         [ +  + ]:          4 :         if ( bValid )
    4623                 :            :         {
    4624         [ +  - ]:          3 :             ScMarkData aMarkData;
    4625         [ +  - ]:          3 :             aMarkData.MarkFromRangeList( rRanges, false );
    4626                 :            : 
    4627 [ +  - ][ +  + ]:          6 :             for ( size_t i = 0, nDiffCount = aDiff.size(); i < nDiffCount; i++ )
    4628                 :            :             {
    4629         [ +  - ]:          3 :                 ScRange* pDiffRange = aDiff[ i ];
    4630 [ +  - ][ +  - ]:          3 :                 if (aMarkData.GetTableSelect( pDiffRange->aStart.Tab() ))
    4631         [ +  - ]:          3 :                     aMarkData.SetMultiMarkArea( *pDiffRange, false );
    4632                 :            :             }
    4633                 :            : 
    4634         [ +  - ]:          3 :             ScRangeList aNew;
    4635         [ +  - ]:          3 :             aMarkData.FillRangeListWithMarks( &aNew, false );
    4636         [ +  - ]:          3 :             SetNewRanges(aNew);
    4637                 :            : 
    4638 [ +  - ][ +  - ]:          3 :             bDone = sal_True;       //! error if range was not selected before?
    4639         [ +  - ]:          4 :         }
    4640                 :            :     }
    4641                 :            : 
    4642         [ +  - ]:          4 :     if (!m_pImpl->m_aNamedEntries.empty())
    4643         [ +  - ]:          4 :         lcl_RemoveNamedEntry(m_pImpl->m_aNamedEntries, aNameStr);
    4644                 :            : 
    4645         [ +  + ]:          4 :     if (!bDone)
    4646 [ +  - ][ +  - ]:          4 :         throw container::NoSuchElementException();      // not found
                 [ +  - ]
    4647                 :          3 : }
    4648                 :            : 
    4649                 :            : // XNameReplace
    4650                 :            : 
    4651                 :          2 : void SAL_CALL ScCellRangesObj::replaceByName( const rtl::OUString& aName, const uno::Any& aElement )
    4652                 :            :                             throw(lang::IllegalArgumentException, container::NoSuchElementException,
    4653                 :            :                                     lang::WrappedTargetException, uno::RuntimeException)
    4654                 :            : {
    4655         [ +  - ]:          2 :     SolarMutexGuard aGuard;
    4656                 :            :     //! zusammenfassen?
    4657         [ +  - ]:          2 :     removeByName( aName );
    4658 [ +  - ][ +  - ]:          2 :     insertByName( aName, aElement );
    4659                 :          2 : }
    4660                 :            : 
    4661                 :            : // XNameAccess
    4662                 :            : 
    4663                 :          5 : uno::Any SAL_CALL ScCellRangesObj::getByName( const rtl::OUString& aName )
    4664                 :            :             throw(container::NoSuchElementException,
    4665                 :            :                     lang::WrappedTargetException, uno::RuntimeException)
    4666                 :            : {
    4667         [ +  - ]:          5 :     SolarMutexGuard aGuard;
    4668                 :          5 :     uno::Any aRet;
    4669                 :            : 
    4670         [ +  - ]:          5 :     String aNameStr(aName);
    4671                 :          5 :     ScDocShell* pDocSh = GetDocShell();
    4672                 :          5 :     const ScRangeList& rRanges = GetRangeList();
    4673                 :          5 :     ScRange aRange;
    4674         [ +  + ]:         10 :     if (lcl_FindRangeOrEntry(m_pImpl->m_aNamedEntries, rRanges,
    4675         [ +  - ]:          5 :                 pDocSh, aNameStr, aRange))
    4676                 :            :     {
    4677                 :          4 :         uno::Reference<table::XCellRange> xRange;
    4678         [ -  + ]:          4 :         if ( aRange.aStart == aRange.aEnd )
    4679 [ #  # ][ #  # ]:          0 :             xRange.set(new ScCellObj( pDocSh, aRange.aStart ));
                 [ #  # ]
    4680                 :            :         else
    4681 [ +  - ][ +  - ]:          4 :             xRange.set(new ScCellRangeObj( pDocSh, aRange ));
                 [ +  - ]
    4682         [ +  - ]:          4 :         aRet <<= xRange;
    4683                 :            :     }
    4684                 :            :     else
    4685         [ +  - ]:          1 :         throw container::NoSuchElementException();
    4686 [ +  - ][ +  - ]:          5 :     return aRet;
    4687                 :            : }
    4688                 :            : 
    4689                 :         22 : sal_Bool lcl_FindEntryName( const ScNamedEntryArr_Impl& rNamedEntries,
    4690                 :            :                         const ScRange& rRange, String& rName )
    4691                 :            : {
    4692                 :         22 :     sal_uInt16 nCount = rNamedEntries.size();
    4693         [ +  - ]:         60 :     for (sal_uInt16 i=0; i<nCount; i++)
    4694         [ +  + ]:         60 :         if (rNamedEntries[i].GetRange() == rRange)
    4695                 :            :         {
    4696                 :         22 :             rName = rNamedEntries[i].GetName();
    4697                 :         22 :             return sal_True;
    4698                 :            :         }
    4699                 :         22 :     return false;
    4700                 :            : }
    4701                 :            : 
    4702                 :          5 : uno::Sequence<rtl::OUString> SAL_CALL ScCellRangesObj::getElementNames()
    4703                 :            :                                                 throw(uno::RuntimeException)
    4704                 :            : {
    4705         [ +  - ]:          5 :     SolarMutexGuard aGuard;
    4706                 :            : 
    4707                 :          5 :     ScDocShell* pDocSh = GetDocShell();
    4708                 :          5 :     const ScRangeList& rRanges = GetRangeList();
    4709         [ +  - ]:          5 :     if (pDocSh)
    4710                 :            :     {
    4711         [ +  - ]:          5 :         String aRangeStr;
    4712                 :          5 :         ScDocument* pDoc = pDocSh->GetDocument();
    4713         [ +  - ]:          5 :         size_t nCount = rRanges.size();
    4714                 :            : 
    4715         [ +  - ]:          5 :         uno::Sequence<rtl::OUString> aSeq(nCount);
    4716         [ +  - ]:          5 :         rtl::OUString* pAry = aSeq.getArray();
    4717         [ +  + ]:         27 :         for (size_t i=0; i < nCount; i++)
    4718                 :            :         {
    4719                 :            :             //  use given name if for exactly this range, otherwise just format
    4720         [ +  - ]:         22 :             ScRange aRange = *rRanges[ i ];
    4721 [ -  + ][ -  + ]:         44 :             if (m_pImpl->m_aNamedEntries.empty() ||
                 [ +  - ]
    4722         [ +  - ]:         22 :                 !lcl_FindEntryName(m_pImpl->m_aNamedEntries, aRange, aRangeStr))
    4723                 :            :             {
    4724         [ #  # ]:          0 :                 aRange.Format( aRangeStr, SCA_VALID | SCA_TAB_3D, pDoc );
    4725                 :            :             }
    4726         [ +  - ]:         22 :             pAry[i] = aRangeStr;
    4727                 :            :         }
    4728 [ +  - ][ +  - ]:          5 :         return aSeq;
                 [ +  - ]
    4729                 :            :     }
    4730 [ #  # ][ +  - ]:          5 :     return uno::Sequence<rtl::OUString>(0);
    4731                 :            : }
    4732                 :            : 
    4733                 :          4 : sal_Bool SAL_CALL ScCellRangesObj::hasByName( const rtl::OUString& aName )
    4734                 :            :                                         throw(uno::RuntimeException)
    4735                 :            : {
    4736         [ +  - ]:          4 :     SolarMutexGuard aGuard;
    4737         [ +  - ]:          4 :     String aNameStr(aName);
    4738                 :          4 :     ScDocShell* pDocSh = GetDocShell();
    4739                 :          4 :     const ScRangeList& rRanges = GetRangeList();
    4740                 :          4 :     ScRange aRange;
    4741                 :          4 :     return lcl_FindRangeOrEntry(m_pImpl->m_aNamedEntries, rRanges, pDocSh,
    4742 [ +  - ][ +  - ]:          4 :                 aNameStr, aRange);
                 [ +  - ]
    4743                 :            : }
    4744                 :            : 
    4745                 :            : // XEnumerationAccess
    4746                 :            : 
    4747                 :          4 : uno::Reference<container::XEnumeration> SAL_CALL ScCellRangesObj::createEnumeration()
    4748                 :            :                                                     throw(uno::RuntimeException)
    4749                 :            : {
    4750         [ +  - ]:          4 :     SolarMutexGuard aGuard;
    4751 [ +  - ][ +  - ]:          4 :     return new ScIndexEnumeration(this, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sheet.SheetCellRangesEnumeration")));
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
    4752                 :            : }
    4753                 :            : 
    4754                 :            : // XIndexAccess
    4755                 :            : 
    4756                 :         38 : sal_Int32 SAL_CALL ScCellRangesObj::getCount() throw(uno::RuntimeException)
    4757                 :            : {
    4758         [ +  - ]:         38 :     SolarMutexGuard aGuard;
    4759                 :         38 :     const ScRangeList& rRanges = GetRangeList();
    4760 [ +  - ][ +  - ]:         38 :     return rRanges.size();
    4761                 :            : }
    4762                 :            : 
    4763                 :         17 : uno::Any SAL_CALL ScCellRangesObj::getByIndex( sal_Int32 nIndex )
    4764                 :            :                             throw(lang::IndexOutOfBoundsException,
    4765                 :            :                                     lang::WrappedTargetException, uno::RuntimeException)
    4766                 :            : {
    4767         [ +  - ]:         17 :     SolarMutexGuard aGuard;
    4768 [ +  - ][ +  + ]:         17 :     uno::Reference<table::XCellRange> xRange(GetObjectByIndex_Impl(nIndex));
                 [ +  - ]
    4769         [ +  + ]:         17 :     if (xRange.is())
    4770         [ +  - ]:         30 :         return uno::makeAny(xRange);
    4771                 :            :     else
    4772 [ +  - ][ +  - ]:         17 :         throw lang::IndexOutOfBoundsException();
    4773                 :            : }
    4774                 :            : 
    4775                 :          1 : uno::Type SAL_CALL ScCellRangesObj::getElementType() throw(uno::RuntimeException)
    4776                 :            : {
    4777         [ +  - ]:          1 :     SolarMutexGuard aGuard;
    4778 [ +  - ][ +  - ]:          1 :     return getCppuType((uno::Reference<table::XCellRange>*)0);
    4779                 :            : }
    4780                 :            : 
    4781                 :          1 : sal_Bool SAL_CALL ScCellRangesObj::hasElements() throw(uno::RuntimeException)
    4782                 :            : {
    4783         [ +  - ]:          1 :     SolarMutexGuard aGuard;
    4784                 :          1 :     const ScRangeList& rRanges = GetRangeList();
    4785 [ +  - ][ +  - ]:          1 :     return !rRanges.empty();
    4786                 :            : }
    4787                 :            : 
    4788                 :            : // XServiceInfo
    4789                 :            : 
    4790                 :          0 : rtl::OUString SAL_CALL ScCellRangesObj::getImplementationName() throw(uno::RuntimeException)
    4791                 :            : {
    4792                 :          0 :     return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ScCellRangesObj" ));
    4793                 :            : }
    4794                 :            : 
    4795                 :          4 : sal_Bool SAL_CALL ScCellRangesObj::supportsService( const rtl::OUString& rServiceName )
    4796                 :            :                                                     throw(uno::RuntimeException)
    4797                 :            : {
    4798         [ +  - ]:          4 :     String aServiceStr(rServiceName);
    4799         [ +  - ]:          4 :     return aServiceStr.EqualsAscii( SCSHEETCELLRANGES_SERVICE ) ||
    4800         [ +  - ]:          3 :            aServiceStr.EqualsAscii( SCCELLPROPERTIES_SERVICE ) ||
    4801         [ +  - ]:          3 :            aServiceStr.EqualsAscii( SCCHARPROPERTIES_SERVICE ) ||
    4802 [ +  + ][ +  - ]:         10 :            aServiceStr.EqualsAscii( SCPARAPROPERTIES_SERVICE );
         [ +  + ][ +  - ]
         [ -  + ][ +  - ]
    4803                 :            : }
    4804                 :            : 
    4805                 :          0 : uno::Sequence<rtl::OUString> SAL_CALL ScCellRangesObj::getSupportedServiceNames()
    4806                 :            :                                                     throw(uno::RuntimeException)
    4807                 :            : {
    4808                 :          0 :     uno::Sequence<rtl::OUString> aRet(4);
    4809         [ #  # ]:          0 :     rtl::OUString* pArray = aRet.getArray();
    4810         [ #  # ]:          0 :     pArray[0] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( SCSHEETCELLRANGES_SERVICE ));
    4811         [ #  # ]:          0 :     pArray[1] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( SCCELLPROPERTIES_SERVICE ));
    4812         [ #  # ]:          0 :     pArray[2] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( SCCHARPROPERTIES_SERVICE ));
    4813         [ #  # ]:          0 :     pArray[3] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( SCPARAPROPERTIES_SERVICE ));
    4814                 :          0 :     return aRet;
    4815                 :            : }
    4816                 :            : 
    4817                 :            : //------------------------------------------------------------------------
    4818                 :            : 
    4819                 :          0 : uno::Reference<table::XCellRange> ScCellRangeObj::CreateRangeFromDoc( ScDocument* pDoc, const ScRange& rR )
    4820                 :            : {
    4821                 :          0 :     SfxObjectShell* pObjSh = pDoc->GetDocumentShell();
    4822 [ #  # ][ #  # ]:          0 :     if ( pObjSh && pObjSh->ISA(ScDocShell) )
                 [ #  # ]
    4823 [ #  # ][ #  # ]:          0 :         return new ScCellRangeObj( (ScDocShell*) pObjSh, rR );
    4824                 :          0 :     return NULL;
    4825                 :            : }
    4826                 :            : 
    4827                 :            : //------------------------------------------------------------------------
    4828                 :            : 
    4829                 :      10777 : ScCellRangeObj::ScCellRangeObj(ScDocShell* pDocSh, const ScRange& rR) :
    4830                 :            :     ScCellRangesBase( pDocSh, rR ),
    4831         [ +  - ]:      10777 :     pRangePropSet( lcl_GetRangePropertySet() ),
    4832                 :      21554 :     aRange( rR )
    4833                 :            : {
    4834         [ +  - ]:      10777 :     aRange.Justify();       // Anfang / Ende richtig
    4835                 :      10777 : }
    4836                 :            : 
    4837                 :      10749 : ScCellRangeObj::~ScCellRangeObj()
    4838                 :            : {
    4839         [ -  + ]:      16282 : }
    4840                 :            : 
    4841                 :       2710 : void ScCellRangeObj::RefChanged()
    4842                 :            : {
    4843                 :       2710 :     ScCellRangesBase::RefChanged();
    4844                 :            : 
    4845                 :       2710 :     const ScRangeList& rRanges = GetRangeList();
    4846                 :            :     OSL_ENSURE(rRanges.size() == 1, "was fuer Ranges ?!?!");
    4847         [ +  - ]:       2710 :     if ( !rRanges.empty() )
    4848                 :            :     {
    4849                 :       2710 :         const ScRange* pFirst = rRanges[0];
    4850                 :       2710 :         aRange = ScRange(*pFirst);
    4851                 :       2710 :         aRange.Justify();
    4852                 :            :     }
    4853                 :       2710 : }
    4854                 :            : 
    4855                 :      19272 : uno::Any SAL_CALL ScCellRangeObj::queryInterface( const uno::Type& rType )
    4856                 :            :                                                 throw(uno::RuntimeException)
    4857                 :            : {
    4858 [ +  + ][ +  - ]:      19272 :     SC_QUERYINTERFACE( sheet::XCellRangeAddressable )
    4859 [ +  + ][ +  - ]:      18867 :     SC_QUERYINTERFACE( table::XCellRange )
    4860 [ +  + ][ +  - ]:      18191 :     SC_QUERYINTERFACE( sheet::XSheetCellRange )
    4861 [ +  + ][ +  - ]:      17972 :     SC_QUERYINTERFACE( sheet::XArrayFormulaRange )
    4862 [ -  + ][ #  # ]:      17969 :     SC_QUERYINTERFACE( sheet::XArrayFormulaTokens )
    4863 [ +  + ][ +  - ]:      17969 :     SC_QUERYINTERFACE( sheet::XCellRangeData )
    4864 [ +  + ][ +  - ]:      17942 :     SC_QUERYINTERFACE( sheet::XCellRangeFormula )
    4865 [ +  + ][ +  - ]:      17940 :     SC_QUERYINTERFACE( sheet::XMultipleOperation )
    4866 [ +  + ][ +  - ]:      17938 :     SC_QUERYINTERFACE( util::XMergeable )
    4867 [ +  + ][ +  - ]:      17935 :     SC_QUERYINTERFACE( sheet::XCellSeries )
    4868 [ -  + ][ #  # ]:      17933 :     SC_QUERYINTERFACE( table::XAutoFormattable )
    4869 [ +  + ][ +  - ]:      17933 :     SC_QUERYINTERFACE( util::XSortable )
    4870 [ +  + ][ +  - ]:      17931 :     SC_QUERYINTERFACE( sheet::XSheetFilterableEx )
    4871 [ +  + ][ +  - ]:      17929 :     SC_QUERYINTERFACE( sheet::XSheetFilterable )
    4872 [ +  + ][ +  - ]:      17926 :     SC_QUERYINTERFACE( sheet::XSubTotalCalculatable )
    4873 [ +  + ][ +  - ]:      17919 :     SC_QUERYINTERFACE( table::XColumnRowRange )
    4874 [ +  + ][ +  - ]:      12884 :     SC_QUERYINTERFACE( util::XImportable )
    4875 [ +  + ][ +  - ]:      12880 :     SC_QUERYINTERFACE( sheet::XCellFormatRangesSupplier )
    4876 [ +  + ][ +  - ]:      12876 :     SC_QUERYINTERFACE( sheet::XUniqueCellFormatRangesSupplier )
    4877                 :            : 
    4878                 :      19272 :     return ScCellRangesBase::queryInterface( rType );
    4879                 :            : }
    4880                 :            : 
    4881                 :      68315 : void SAL_CALL ScCellRangeObj::acquire() throw()
    4882                 :            : {
    4883                 :      68315 :     ScCellRangesBase::acquire();
    4884                 :      68315 : }
    4885                 :            : 
    4886                 :      68287 : void SAL_CALL ScCellRangeObj::release() throw()
    4887                 :            : {
    4888                 :      68287 :     ScCellRangesBase::release();
    4889                 :      68287 : }
    4890                 :            : 
    4891                 :          8 : uno::Sequence<uno::Type> SAL_CALL ScCellRangeObj::getTypes() throw(uno::RuntimeException)
    4892                 :            : {
    4893 [ +  + ][ +  - ]:          8 :     static uno::Sequence<uno::Type> aTypes;
         [ +  - ][ #  # ]
    4894         [ +  + ]:          8 :     if ( aTypes.getLength() == 0 )
    4895                 :            :     {
    4896         [ +  - ]:          4 :         uno::Sequence<uno::Type> aParentTypes(ScCellRangesBase::getTypes());
    4897                 :          4 :         long nParentLen = aParentTypes.getLength();
    4898                 :          4 :         const uno::Type* pParentPtr = aParentTypes.getConstArray();
    4899                 :            : 
    4900         [ +  - ]:          4 :         aTypes.realloc( nParentLen + 17 );
    4901         [ +  - ]:          4 :         uno::Type* pPtr = aTypes.getArray();
    4902         [ +  - ]:          4 :         pPtr[nParentLen + 0] = getCppuType((const uno::Reference<sheet::XCellRangeAddressable>*)0);
    4903         [ +  - ]:          4 :         pPtr[nParentLen + 1] = getCppuType((const uno::Reference<sheet::XSheetCellRange>*)0);
    4904         [ +  - ]:          4 :         pPtr[nParentLen + 2] = getCppuType((const uno::Reference<sheet::XArrayFormulaRange>*)0);
    4905         [ +  - ]:          4 :         pPtr[nParentLen + 3] = getCppuType((const uno::Reference<sheet::XArrayFormulaTokens>*)0);
    4906         [ +  - ]:          4 :         pPtr[nParentLen + 4] = getCppuType((const uno::Reference<sheet::XCellRangeData>*)0);
    4907         [ +  - ]:          4 :         pPtr[nParentLen + 5] = getCppuType((const uno::Reference<sheet::XCellRangeFormula>*)0);
    4908         [ +  - ]:          4 :         pPtr[nParentLen + 6] = getCppuType((const uno::Reference<sheet::XMultipleOperation>*)0);
    4909         [ +  - ]:          4 :         pPtr[nParentLen + 7] = getCppuType((const uno::Reference<util::XMergeable>*)0);
    4910         [ +  - ]:          4 :         pPtr[nParentLen + 8] = getCppuType((const uno::Reference<sheet::XCellSeries>*)0);
    4911         [ +  - ]:          4 :         pPtr[nParentLen + 9] = getCppuType((const uno::Reference<table::XAutoFormattable>*)0);
    4912         [ +  - ]:          4 :         pPtr[nParentLen +10] = getCppuType((const uno::Reference<util::XSortable>*)0);
    4913         [ +  - ]:          4 :         pPtr[nParentLen +11] = getCppuType((const uno::Reference<sheet::XSheetFilterableEx>*)0);
    4914         [ +  - ]:          4 :         pPtr[nParentLen +12] = getCppuType((const uno::Reference<sheet::XSubTotalCalculatable>*)0);
    4915         [ +  - ]:          4 :         pPtr[nParentLen +13] = getCppuType((const uno::Reference<table::XColumnRowRange>*)0);
    4916         [ +  - ]:          4 :         pPtr[nParentLen +14] = getCppuType((const uno::Reference<util::XImportable>*)0);
    4917         [ +  - ]:          4 :         pPtr[nParentLen +15] = getCppuType((const uno::Reference<sheet::XCellFormatRangesSupplier>*)0);
    4918         [ +  - ]:          4 :         pPtr[nParentLen +16] = getCppuType((const uno::Reference<sheet::XUniqueCellFormatRangesSupplier>*)0);
    4919                 :            : 
    4920         [ +  + ]:         56 :         for (long i=0; i<nParentLen; i++)
    4921         [ +  - ]:         56 :             pPtr[i] = pParentPtr[i];                // parent types first
    4922                 :            :     }
    4923                 :          8 :     return aTypes;
    4924                 :            : }
    4925                 :            : 
    4926                 :            : namespace
    4927                 :            : {
    4928                 :            :     class theScCellRangeObjImplementationId : public rtl::Static< UnoTunnelIdInit, theScCellRangeObjImplementationId > {};
    4929                 :            : }
    4930                 :            : 
    4931                 :          2 : uno::Sequence<sal_Int8> SAL_CALL ScCellRangeObj::getImplementationId()
    4932                 :            :                                                     throw(uno::RuntimeException)
    4933                 :            : {
    4934                 :          2 :     return theScCellRangeObjImplementationId::get().getSeq();
    4935                 :            : }
    4936                 :            : 
    4937                 :            : // XCellRange
    4938                 :            : 
    4939                 :            : //  ColumnCount / RowCount sind weggefallen
    4940                 :            : //! werden im Writer fuer Tabellen noch gebraucht ???
    4941                 :            : 
    4942                 :       3076 : uno::Reference<table::XCell> ScCellRangeObj::GetCellByPosition_Impl(
    4943                 :            :                                         sal_Int32 nColumn, sal_Int32 nRow )
    4944                 :            :                                 throw(lang::IndexOutOfBoundsException, uno::RuntimeException)
    4945                 :            : {
    4946                 :       3076 :     ScDocShell* pDocSh = GetDocShell();
    4947         [ -  + ]:       3076 :     if (!pDocSh)
    4948         [ #  # ]:          0 :         throw uno::RuntimeException();
    4949                 :            : 
    4950 [ +  + ][ +  - ]:       3076 :     if ( nColumn >= 0 && nRow >= 0 )
    4951                 :            :     {
    4952                 :       3074 :         sal_Int32 nPosX = aRange.aStart.Col() + nColumn;
    4953                 :       3074 :         sal_Int32 nPosY = aRange.aStart.Row() + nRow;
    4954                 :            : 
    4955 [ +  - ][ +  - ]:       3074 :         if ( nPosX <= aRange.aEnd.Col() && nPosY <= aRange.aEnd.Row() )
                 [ +  - ]
    4956                 :            :         {
    4957                 :       3074 :             ScAddress aNew( (SCCOL)nPosX, (SCROW)nPosY, aRange.aStart.Tab() );
    4958 [ +  - ][ +  - ]:       3074 :             return new ScCellObj( pDocSh, aNew );
                 [ +  - ]
    4959                 :            :         }
    4960                 :            :     }
    4961                 :            : 
    4962         [ +  - ]:          2 :     throw lang::IndexOutOfBoundsException();
    4963                 :            : }
    4964                 :            : 
    4965                 :        101 : uno::Reference<table::XCell> SAL_CALL ScCellRangeObj::getCellByPosition(
    4966                 :            :                                         sal_Int32 nColumn, sal_Int32 nRow )
    4967                 :            :                                 throw(lang::IndexOutOfBoundsException, uno::RuntimeException)
    4968                 :            : {
    4969         [ +  - ]:        101 :     SolarMutexGuard aGuard;
    4970                 :            : 
    4971 [ +  + ][ +  - ]:        101 :     return GetCellByPosition_Impl(nColumn, nRow);
    4972                 :            : }
    4973                 :            : 
    4974                 :       5300 : uno::Reference<table::XCellRange> SAL_CALL ScCellRangeObj::getCellRangeByPosition(
    4975                 :            :                 sal_Int32 nLeft, sal_Int32 nTop, sal_Int32 nRight, sal_Int32 nBottom )
    4976                 :            :                                     throw(lang::IndexOutOfBoundsException, uno::RuntimeException)
    4977                 :            : {
    4978         [ +  - ]:       5300 :     SolarMutexGuard aGuard;
    4979                 :            : 
    4980                 :       5300 :     ScDocShell* pDocSh = GetDocShell();
    4981         [ -  + ]:       5300 :     if (!pDocSh)
    4982         [ #  # ]:          0 :         throw uno::RuntimeException();
    4983                 :            : 
    4984 [ +  + ][ +  - ]:       5300 :     if ( nLeft >= 0 && nTop >= 0 && nRight >= 0 && nBottom >= 0 )
         [ +  - ][ +  - ]
    4985                 :            :     {
    4986                 :       5298 :         sal_Int32 nStartX = aRange.aStart.Col() + nLeft;
    4987                 :       5298 :         sal_Int32 nStartY = aRange.aStart.Row() + nTop;
    4988                 :       5298 :         sal_Int32 nEndX = aRange.aStart.Col() + nRight;
    4989                 :       5298 :         sal_Int32 nEndY = aRange.aStart.Row() + nBottom;
    4990                 :            : 
    4991         [ +  - ]:      10596 :         if ( nStartX <= nEndX && nEndX <= aRange.aEnd.Col() &&
           [ +  -  +  - ]
         [ +  - ][ +  - ]
    4992                 :       5298 :              nStartY <= nEndY && nEndY <= aRange.aEnd.Row() )
    4993                 :            :         {
    4994                 :       5298 :             ScRange aNew( (SCCOL)nStartX, (SCROW)nStartY, aRange.aStart.Tab(),
    4995                 :      10596 :                           (SCCOL)nEndX, (SCROW)nEndY, aRange.aEnd.Tab() );
    4996 [ +  - ][ +  - ]:      10596 :             return new ScCellRangeObj( pDocSh, aNew );
                 [ +  - ]
    4997                 :            :         }
    4998                 :            :     }
    4999                 :            : 
    5000 [ +  - ][ +  - ]:       5300 :     throw lang::IndexOutOfBoundsException();
    5001                 :            : }
    5002                 :            : 
    5003                 :         79 : uno::Reference<table::XCellRange> SAL_CALL ScCellRangeObj::getCellRangeByName(
    5004                 :            :                         const rtl::OUString& aName ) throw(uno::RuntimeException)
    5005                 :            : {
    5006                 :         79 :     return getCellRangeByName( aName, ScAddress::detailsOOOa1 );
    5007                 :            : }
    5008                 :            : 
    5009                 :         79 : uno::Reference<table::XCellRange>  ScCellRangeObj::getCellRangeByName(
    5010                 :            :                         const rtl::OUString& aName, const ScAddress::Details& rDetails  ) throw(uno::RuntimeException)
    5011                 :            : {
    5012                 :            :     //  name refers to the whole document (with the range's table as default),
    5013                 :            :     //  valid only if the range is within this range
    5014                 :            : 
    5015         [ +  - ]:         79 :     SolarMutexGuard aGuard;
    5016                 :         79 :     ScDocShell* pDocSh = GetDocShell();
    5017         [ +  - ]:         79 :     if ( pDocSh )
    5018                 :            :     {
    5019                 :         79 :         ScDocument* pDoc = pDocSh->GetDocument();
    5020                 :         79 :         SCTAB nTab = aRange.aStart.Tab();
    5021                 :            : 
    5022                 :         79 :         ScRange aCellRange;
    5023                 :         79 :         sal_Bool bFound = false;
    5024         [ +  - ]:         79 :         String aString(aName);
    5025         [ +  - ]:         79 :         sal_uInt16 nParse = aCellRange.ParseAny( aString, pDoc, rDetails );
    5026         [ +  - ]:         79 :         if ( nParse & SCA_VALID )
    5027                 :            :         {
    5028         [ +  - ]:         79 :             if ( !(nParse & SCA_TAB_3D) )   // keine Tabelle angegeben -> auf dieser Tabelle
    5029                 :            :             {
    5030                 :         79 :                 aCellRange.aStart.SetTab(nTab);
    5031                 :         79 :                 aCellRange.aEnd.SetTab(nTab);
    5032                 :            :             }
    5033                 :         79 :             bFound = sal_True;
    5034                 :            :         }
    5035                 :            :         else
    5036                 :            :         {
    5037                 :          0 :             ScRangeUtil aRangeUtil;
    5038 [ #  # ][ #  # ]:          0 :             if ( aRangeUtil.MakeRangeFromName( aString, pDoc, nTab, aCellRange, RUTL_NAMES ) ||
         [ #  # ][ #  # ]
    5039         [ #  # ]:          0 :                  aRangeUtil.MakeRangeFromName( aString, pDoc, nTab, aCellRange, RUTL_DBASE ) )
    5040                 :          0 :                 bFound = sal_True;
    5041                 :            :         }
    5042                 :            : 
    5043         [ +  - ]:         79 :         if (bFound)         // valid only if within this object's range
    5044                 :            :         {
    5045         [ -  + ]:         79 :             if (!aRange.In(aCellRange))
    5046                 :          0 :                 bFound = false;
    5047                 :            :         }
    5048                 :            : 
    5049         [ +  - ]:         79 :         if (bFound)
    5050                 :            :         {
    5051         [ +  + ]:         79 :             if ( aCellRange.aStart == aCellRange.aEnd )
    5052 [ +  - ][ +  - ]:          6 :                 return new ScCellObj( pDocSh, aCellRange.aStart );
                 [ +  - ]
    5053                 :            :             else
    5054 [ +  - ][ +  - ]:         73 :                 return new ScCellRangeObj( pDocSh, aCellRange );
                 [ +  - ]
    5055 [ +  - ][ -  + ]:         79 :         }
    5056                 :            :     }
    5057                 :            : 
    5058 [ +  - ][ #  # ]:         79 :     throw uno::RuntimeException();
    5059                 :            : }
    5060                 :            : 
    5061                 :            : // XColumnRowRange
    5062                 :            : 
    5063                 :        446 : uno::Reference<table::XTableColumns> SAL_CALL ScCellRangeObj::getColumns() throw(uno::RuntimeException)
    5064                 :            : {
    5065         [ +  - ]:        446 :     SolarMutexGuard aGuard;
    5066                 :        446 :     ScDocShell* pDocSh = GetDocShell();
    5067         [ +  - ]:        446 :     if (pDocSh)
    5068                 :        446 :         return new ScTableColumnsObj( pDocSh, aRange.aStart.Tab(),
    5069 [ +  - ][ +  - ]:        446 :                                         aRange.aStart.Col(), aRange.aEnd.Col() );
                 [ +  - ]
    5070                 :            : 
    5071                 :            :     OSL_FAIL("Dokument ungueltig");
    5072 [ #  # ][ +  - ]:        446 :     return NULL;
    5073                 :            : }
    5074                 :            : 
    5075                 :       4616 : uno::Reference<table::XTableRows> SAL_CALL ScCellRangeObj::getRows() throw(uno::RuntimeException)
    5076                 :            : {
    5077         [ +  - ]:       4616 :     SolarMutexGuard aGuard;
    5078                 :       4616 :     ScDocShell* pDocSh = GetDocShell();
    5079         [ +  - ]:       4616 :     if (pDocSh)
    5080                 :       4616 :         return new ScTableRowsObj( pDocSh, aRange.aStart.Tab(),
    5081 [ +  - ][ +  - ]:       4616 :                                     aRange.aStart.Row(), aRange.aEnd.Row() );
                 [ +  - ]
    5082                 :            : 
    5083                 :            :     OSL_FAIL("Dokument ungueltig");
    5084 [ #  # ][ +  - ]:       4616 :     return NULL;
    5085                 :            : }
    5086                 :            : 
    5087                 :            : // XAddressableCellRange
    5088                 :            : 
    5089                 :        512 : table::CellRangeAddress SAL_CALL ScCellRangeObj::getRangeAddress() throw(uno::RuntimeException)
    5090                 :            : {
    5091         [ +  - ]:        512 :     SolarMutexGuard aGuard;
    5092                 :        512 :     table::CellRangeAddress aRet;
    5093                 :        512 :     ScUnoConversion::FillApiRange( aRet, aRange );
    5094         [ +  - ]:        512 :     return aRet;
    5095                 :            : }
    5096                 :            : 
    5097                 :            : // XSheetCellRange
    5098                 :            : 
    5099                 :         68 : uno::Reference<sheet::XSpreadsheet> SAL_CALL ScCellRangeObj::getSpreadsheet()
    5100                 :            :                                                 throw(uno::RuntimeException)
    5101                 :            : {
    5102         [ +  - ]:         68 :     SolarMutexGuard aGuard;
    5103                 :         68 :     ScDocShell* pDocSh = GetDocShell();
    5104         [ +  - ]:         68 :     if (pDocSh)
    5105 [ +  - ][ +  - ]:         68 :         return new ScTableSheetObj( pDocSh, aRange.aStart.Tab() );
                 [ +  - ]
    5106                 :            : 
    5107                 :            :     OSL_FAIL("Dokument ungueltig");
    5108 [ #  # ][ +  - ]:         68 :     return NULL;
    5109                 :            : }
    5110                 :            : 
    5111                 :            : // XArrayFormulaRange
    5112                 :            : 
    5113                 :          2 : rtl::OUString SAL_CALL ScCellRangeObj::getArrayFormula() throw(uno::RuntimeException)
    5114                 :            : {
    5115         [ +  - ]:          2 :     SolarMutexGuard aGuard;
    5116                 :            : 
    5117                 :            :     //  Matrix-Formel, wenn eindeutig Teil einer Matrix,
    5118                 :            :     //  also wenn Anfang und Ende des Blocks zur selben Matrix gehoeren.
    5119                 :            :     //  Sonst Leerstring.
    5120                 :            : 
    5121                 :          2 :     rtl::OUString aFormula;
    5122                 :          2 :     ScDocShell* pDocSh = GetDocShell();
    5123         [ +  - ]:          2 :     if (pDocSh)
    5124                 :            :     {
    5125                 :          2 :         ScDocument* pDoc = pDocSh->GetDocument();
    5126         [ +  - ]:          2 :         const ScBaseCell* pCell1 = pDoc->GetCell( aRange.aStart );
    5127         [ +  - ]:          2 :         const ScBaseCell* pCell2 = pDoc->GetCell( aRange.aEnd );
    5128 [ +  - ][ +  - ]:          4 :         if ( pCell1 && pCell2 && pCell1->GetCellType() == CELLTYPE_FORMULA &&
           [ +  -  +  - ]
                 [ +  - ]
    5129                 :          2 :                                  pCell2->GetCellType() == CELLTYPE_FORMULA )
    5130                 :            :         {
    5131         [ +  - ]:          2 :             const ScFormulaCell* pFCell1 = (const ScFormulaCell*)pCell1;
    5132         [ +  - ]:          2 :             const ScFormulaCell* pFCell2 = (const ScFormulaCell*)pCell2;
    5133                 :          2 :             ScAddress aStart1;
    5134                 :          2 :             ScAddress aStart2;
    5135 [ +  - ][ +  - ]:          2 :             if ( pFCell1->GetMatrixOrigin( aStart1 ) && pFCell2->GetMatrixOrigin( aStart2 ) )
         [ +  - ][ +  - ]
                 [ +  - ]
    5136                 :            :             {
    5137         [ +  - ]:          2 :                 if ( aStart1 == aStart2 )               // beides dieselbe Matrix
    5138         [ +  - ]:          2 :                     pFCell1->GetFormula( aFormula );    // egal, von welcher Zelle
    5139                 :            :             }
    5140                 :            :         }
    5141                 :            :     }
    5142         [ +  - ]:          2 :     return aFormula;
    5143                 :            : }
    5144                 :            : 
    5145                 :          4 : void ScCellRangeObj::SetArrayFormula_Impl( const rtl::OUString& rFormula,
    5146                 :            :         const rtl::OUString& rFormulaNmsp, const formula::FormulaGrammar::Grammar eGrammar ) throw(uno::RuntimeException)
    5147                 :            : {
    5148                 :          4 :     ScDocShell* pDocSh = GetDocShell();
    5149         [ +  - ]:          4 :     if (pDocSh)
    5150                 :            :     {
    5151         [ +  + ]:          4 :         if ( !rFormula.isEmpty() )
    5152                 :            :         {
    5153 [ +  - ][ -  + ]:          3 :             if ( ScTableSheetObj::getImplementation( (cppu::OWeakObject*)this ) )
    5154                 :            :             {
    5155                 :            :                 //  don't set array formula for sheet object
    5156         [ #  # ]:          0 :                 throw uno::RuntimeException();
    5157                 :            :             }
    5158                 :            : 
    5159 [ +  - ][ +  - ]:          3 :             pDocSh->GetDocFunc().EnterMatrix( aRange, NULL, NULL, rFormula, sal_True, sal_True, rFormulaNmsp, eGrammar );
                 [ +  - ]
    5160                 :            :         }
    5161                 :            :         else
    5162                 :            :         {
    5163                 :            :             //  empty string -> erase array formula
    5164         [ +  - ]:          1 :             ScMarkData aMark;
    5165         [ +  - ]:          1 :             aMark.SetMarkArea( aRange );
    5166         [ +  - ]:          1 :             aMark.SelectTable( aRange.aStart.Tab(), sal_True );
    5167 [ +  - ][ +  - ]:          1 :             pDocSh->GetDocFunc().DeleteContents( aMark, IDF_CONTENTS, sal_True, sal_True );
    5168                 :            :         }
    5169                 :            :     }
    5170                 :          4 : }
    5171                 :            : 
    5172                 :          4 : void SAL_CALL ScCellRangeObj::setArrayFormula( const rtl::OUString& aFormula )
    5173                 :            :                                                 throw(uno::RuntimeException)
    5174                 :            : {
    5175         [ +  - ]:          4 :     SolarMutexGuard aGuard;
    5176                 :            :     // GRAM_PODF_A1 for API compatibility.
    5177 [ +  - ][ +  - ]:          4 :     SetArrayFormula_Impl( aFormula, ::rtl::OUString(), formula::FormulaGrammar::GRAM_PODF_A1);
    5178                 :          4 : }
    5179                 :            : 
    5180                 :          0 : void ScCellRangeObj::SetArrayFormulaWithGrammar( const rtl::OUString& rFormula,
    5181                 :            :         const rtl::OUString& rFormulaNmsp, const formula::FormulaGrammar::Grammar eGrammar ) throw(uno::RuntimeException)
    5182                 :            : {
    5183         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    5184 [ #  # ][ #  # ]:          0 :     SetArrayFormula_Impl( rFormula, rFormulaNmsp, eGrammar);
    5185                 :          0 : }
    5186                 :            : 
    5187                 :            : // XArrayFormulaTokens
    5188                 :            : 
    5189                 :          0 : uno::Sequence<sheet::FormulaToken> SAL_CALL ScCellRangeObj::getArrayTokens() throw(uno::RuntimeException)
    5190                 :            : {
    5191         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    5192                 :            : 
    5193                 :            :     // same cell logic as in getArrayFormula
    5194                 :            : 
    5195         [ #  # ]:          0 :     uno::Sequence<sheet::FormulaToken> aSequence;
    5196                 :          0 :     ScDocShell* pDocSh = GetDocShell();
    5197         [ #  # ]:          0 :     if ( pDocSh )
    5198                 :            :     {
    5199                 :          0 :         ScDocument* pDoc = pDocSh->GetDocument();
    5200         [ #  # ]:          0 :         const ScBaseCell* pCell1 = pDoc->GetCell( aRange.aStart );
    5201         [ #  # ]:          0 :         const ScBaseCell* pCell2 = pDoc->GetCell( aRange.aEnd );
    5202 [ #  # ][ #  # ]:          0 :         if ( pCell1 && pCell2 && pCell1->GetCellType() == CELLTYPE_FORMULA &&
           [ #  #  #  # ]
                 [ #  # ]
    5203                 :          0 :                                  pCell2->GetCellType() == CELLTYPE_FORMULA )
    5204                 :            :         {
    5205         [ #  # ]:          0 :             const ScFormulaCell* pFCell1 = (const ScFormulaCell*)pCell1;
    5206         [ #  # ]:          0 :             const ScFormulaCell* pFCell2 = (const ScFormulaCell*)pCell2;
    5207                 :          0 :             ScAddress aStart1;
    5208                 :          0 :             ScAddress aStart2;
    5209 [ #  # ][ #  # ]:          0 :             if ( pFCell1->GetMatrixOrigin( aStart1 ) && pFCell2->GetMatrixOrigin( aStart2 ) )
         [ #  # ][ #  # ]
                 [ #  # ]
    5210                 :            :             {
    5211         [ #  # ]:          0 :                 if ( aStart1 == aStart2 )
    5212                 :            :                 {
    5213                 :          0 :                     ScTokenArray* pTokenArray = pFCell1->GetCode();
    5214         [ #  # ]:          0 :                     if ( pTokenArray )
    5215         [ #  # ]:          0 :                         (void)ScTokenConversion::ConvertToTokenSequence( *pDoc, aSequence, *pTokenArray );
    5216                 :            :                 }
    5217                 :            :             }
    5218                 :            :         }
    5219                 :            :     }
    5220         [ #  # ]:          0 :     return aSequence;
    5221                 :            : }
    5222                 :            : 
    5223                 :          0 : void SAL_CALL ScCellRangeObj::setArrayTokens( const uno::Sequence<sheet::FormulaToken>& rTokens ) throw(uno::RuntimeException)
    5224                 :            : {
    5225         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    5226                 :          0 :     ScDocShell* pDocSh = GetDocShell();
    5227         [ #  # ]:          0 :     if ( pDocSh )
    5228                 :            :     {
    5229         [ #  # ]:          0 :         if ( rTokens.getLength() )
    5230                 :            :         {
    5231 [ #  # ][ #  # ]:          0 :             if ( ScTableSheetObj::getImplementation( (cppu::OWeakObject*)this ) )
                 [ #  # ]
    5232                 :            :             {
    5233         [ #  # ]:          0 :                 throw uno::RuntimeException();
    5234                 :            :             }
    5235                 :            : 
    5236                 :          0 :             ScDocument* pDoc = pDocSh->GetDocument();
    5237         [ #  # ]:          0 :             ScTokenArray aTokenArray;
    5238         [ #  # ]:          0 :             (void)ScTokenConversion::ConvertToTokenArray( *pDoc, aTokenArray, rTokens );
    5239                 :            : 
    5240                 :            :             // Actually GRAM_PODF_A1 is a don't-care here because of the token
    5241                 :            :             // array being set, it fits with other API compatibility grammars
    5242                 :            :             // though.
    5243 [ #  # ][ #  # ]:          0 :             pDocSh->GetDocFunc().EnterMatrix( aRange, NULL, &aTokenArray, EMPTY_STRING, sal_True, sal_True, EMPTY_STRING, formula::FormulaGrammar::GRAM_PODF_A1 );
         [ #  # ][ #  # ]
    5244                 :            :         }
    5245                 :            :         else
    5246                 :            :         {
    5247                 :            :             //  empty sequence -> erase array formula
    5248         [ #  # ]:          0 :             ScMarkData aMark;
    5249         [ #  # ]:          0 :             aMark.SetMarkArea( aRange );
    5250         [ #  # ]:          0 :             aMark.SelectTable( aRange.aStart.Tab(), sal_True );
    5251 [ #  # ][ #  # ]:          0 :             pDocSh->GetDocFunc().DeleteContents( aMark, IDF_CONTENTS, sal_True, sal_True );
    5252                 :            :         }
    5253         [ #  # ]:          0 :     }
    5254                 :          0 : }
    5255                 :            : 
    5256                 :            : // XCellRangeData
    5257                 :            : 
    5258                 :         20 : uno::Sequence< uno::Sequence<uno::Any> > SAL_CALL ScCellRangeObj::getDataArray()
    5259                 :            :                                     throw(uno::RuntimeException)
    5260                 :            : {
    5261         [ +  - ]:         20 :     SolarMutexGuard aGuard;
    5262                 :            : 
    5263 [ +  - ][ +  - ]:         20 :     if ( ScTableSheetObj::getImplementation( (cppu::OWeakObject*)this ) )
                 [ -  + ]
    5264                 :            :     {
    5265                 :            :         //  don't create a data array for the sheet
    5266         [ #  # ]:          0 :         throw uno::RuntimeException();
    5267                 :            :     }
    5268                 :            : 
    5269                 :         20 :     ScDocShell* pDocSh = GetDocShell();
    5270         [ +  - ]:         20 :     if (pDocSh)
    5271                 :            :     {
    5272                 :         20 :         uno::Any aAny;
    5273                 :            :         // bAllowNV = TRUE: errors as void
    5274 [ +  - ][ +  - ]:         20 :         if ( ScRangeToSequence::FillMixedArray( aAny, pDocSh->GetDocument(), aRange, sal_True ) )
    5275                 :            :         {
    5276         [ +  - ]:         20 :             uno::Sequence< uno::Sequence<uno::Any> > aSeq;
    5277 [ +  - ][ +  - ]:         20 :             if ( aAny >>= aSeq )
    5278 [ +  - ][ +  - ]:         40 :                 return aSeq;            // success
                 [ -  + ]
    5279         [ -  + ]:         20 :         }
    5280                 :            :     }
    5281                 :            : 
    5282 [ +  - ][ #  # ]:         20 :     throw uno::RuntimeException();      // no other exceptions specified
    5283                 :            : }
    5284                 :            : 
    5285                 :         12 : void SAL_CALL ScCellRangeObj::setDataArray(
    5286                 :            :                         const uno::Sequence< uno::Sequence<uno::Any> >& aArray )
    5287                 :            :                                     throw(uno::RuntimeException)
    5288                 :            : {
    5289         [ +  - ]:         12 :     SolarMutexGuard aGuard;
    5290                 :            : 
    5291                 :         12 :     sal_Bool bDone = false;
    5292                 :         12 :     ScDocShell* pDocSh = GetDocShell();
    5293         [ +  - ]:         12 :     if (pDocSh)
    5294                 :            :     {
    5295                 :            :         //! move lcl_PutDataArray to docfunc?
    5296         [ +  - ]:         12 :         bDone = lcl_PutDataArray( *pDocSh, aRange, aArray );
    5297                 :            :     }
    5298                 :            : 
    5299         [ -  + ]:         12 :     if (!bDone)
    5300 [ #  # ][ +  - ]:         12 :         throw uno::RuntimeException();      // no other exceptions specified
    5301                 :         12 : }
    5302                 :            : 
    5303                 :            : // XCellRangeFormula
    5304                 :            : 
    5305                 :          8 : uno::Sequence< uno::Sequence<rtl::OUString> > SAL_CALL ScCellRangeObj::getFormulaArray()
    5306                 :            :                                     throw(uno::RuntimeException)
    5307                 :            : {
    5308         [ +  - ]:          8 :     SolarMutexGuard aGuard;
    5309                 :            : 
    5310 [ +  - ][ +  - ]:          8 :     if ( ScTableSheetObj::getImplementation( (cppu::OWeakObject*)this ) )
                 [ -  + ]
    5311                 :            :     {
    5312                 :            :         //  don't create a data array for the sheet
    5313         [ #  # ]:          0 :         throw uno::RuntimeException();
    5314                 :            :     }
    5315                 :            : 
    5316                 :          8 :     ScDocShell* pDocSh = GetDocShell();
    5317         [ +  - ]:          8 :     if (pDocSh)
    5318                 :            :     {
    5319                 :          8 :         SCCOL nStartCol = aRange.aStart.Col();
    5320                 :          8 :         SCROW nStartRow = aRange.aStart.Row();
    5321                 :          8 :         SCCOL nEndCol = aRange.aEnd.Col();
    5322                 :          8 :         SCROW nEndRow = aRange.aEnd.Row();
    5323                 :          8 :         SCCOL nColCount = nEndCol + 1 - nStartCol;
    5324                 :          8 :         SCROW nRowCount = nEndRow + 1 - nStartRow;
    5325                 :          8 :         SCTAB nTab = aRange.aStart.Tab();
    5326                 :            : 
    5327         [ +  - ]:          8 :         uno::Sequence< uno::Sequence<rtl::OUString> > aRowSeq( nRowCount );
    5328         [ +  - ]:          8 :         uno::Sequence<rtl::OUString>* pRowAry = aRowSeq.getArray();
    5329         [ +  + ]:         44 :         for (SCROW nRowIndex = 0; nRowIndex < nRowCount; nRowIndex++)
    5330                 :            :         {
    5331         [ +  - ]:         36 :             uno::Sequence<rtl::OUString> aColSeq( nColCount );
    5332         [ +  - ]:         36 :             rtl::OUString* pColAry = aColSeq.getArray();
    5333         [ +  + ]:        180 :             for (SCCOL nColIndex = 0; nColIndex < nColCount; nColIndex++)
    5334                 :            :                 pColAry[nColIndex] = lcl_GetInputString( pDocSh->GetDocument(),
    5335 [ +  - ][ +  - ]:        144 :                                     ScAddress( nStartCol+nColIndex, nStartRow+nRowIndex, nTab ), sal_True );
                 [ +  - ]
    5336                 :            : 
    5337         [ +  - ]:         36 :             pRowAry[nRowIndex] = aColSeq;
    5338         [ +  - ]:         36 :         }
    5339                 :            : 
    5340 [ +  - ][ +  - ]:         16 :         return aRowSeq;
    5341                 :            :     }
    5342                 :            : 
    5343 [ +  - ][ #  # ]:          8 :     throw uno::RuntimeException();      // no other exceptions specified
    5344                 :            : }
    5345                 :            : 
    5346                 :          4 : void SAL_CALL ScCellRangeObj::setFormulaArray(
    5347                 :            :                         const uno::Sequence< uno::Sequence<rtl::OUString> >& aArray )
    5348                 :            :                                     throw(uno::RuntimeException)
    5349                 :            : {
    5350         [ +  - ]:          4 :     SolarMutexGuard aGuard;
    5351                 :            : 
    5352                 :          4 :     sal_Bool bDone = false;
    5353                 :          4 :     ScDocShell* pDocSh = GetDocShell();
    5354         [ +  - ]:          4 :     if (pDocSh)
    5355                 :            :     {
    5356         [ +  - ]:          4 :         ScExternalRefManager::ApiGuard aExtRefGuard(pDocSh->GetDocument());
    5357                 :            : 
    5358                 :            :         // GRAM_PODF_A1 for API compatibility.
    5359 [ +  - ][ +  - ]:          4 :         bDone = lcl_PutFormulaArray( *pDocSh, aRange, aArray, EMPTY_STRING, formula::FormulaGrammar::GRAM_PODF_A1 );
         [ +  - ][ +  - ]
    5360                 :            :     }
    5361                 :            : 
    5362         [ -  + ]:          4 :     if (!bDone)
    5363 [ #  # ][ +  - ]:          4 :         throw uno::RuntimeException();      // no other exceptions specified
    5364                 :          4 : }
    5365                 :            : 
    5366                 :            : // XMultipleOperation
    5367                 :            : 
    5368                 :          6 : void SAL_CALL ScCellRangeObj::setTableOperation( const table::CellRangeAddress& aFormulaRange,
    5369                 :            :                                         sheet::TableOperationMode nMode,
    5370                 :            :                                         const table::CellAddress& aColumnCell,
    5371                 :            :                                         const table::CellAddress& aRowCell )
    5372                 :            :                                     throw(uno::RuntimeException)
    5373                 :            : {
    5374         [ +  - ]:          6 :     SolarMutexGuard aGuard;
    5375                 :          6 :     ScDocShell* pDocSh = GetDocShell();
    5376         [ +  - ]:          6 :     if (pDocSh)
    5377                 :            :     {
    5378                 :          6 :         sal_Bool bError = false;
    5379                 :          6 :         ScTabOpParam aParam;
    5380                 :            :         aParam.aRefFormulaCell = ScRefAddress( (SCCOL)aFormulaRange.StartColumn,
    5381                 :            :                                               (SCROW)aFormulaRange.StartRow, aFormulaRange.Sheet,
    5382                 :          6 :                                               false, false, false );
    5383                 :            :         aParam.aRefFormulaEnd  = ScRefAddress( (SCCOL)aFormulaRange.EndColumn,
    5384                 :            :                                               (SCROW)aFormulaRange.EndRow, aFormulaRange.Sheet,
    5385                 :          6 :                                               false, false, false );
    5386                 :            :         aParam.aRefRowCell     = ScRefAddress( (SCCOL)aRowCell.Column,
    5387                 :            :                                               (SCROW)aRowCell.Row, aRowCell.Sheet,
    5388                 :          6 :                                               false, false, false );
    5389                 :            :         aParam.aRefColCell     = ScRefAddress( (SCCOL)aColumnCell.Column,
    5390                 :            :                                               (SCROW)aColumnCell.Row, aColumnCell.Sheet,
    5391                 :          6 :                                               false, false, false );
    5392   [ +  +  +  - ]:          6 :         switch (nMode)
    5393                 :            :         {
    5394                 :            :             case sheet::TableOperationMode_COLUMN:
    5395                 :          2 :                 aParam.nMode = 0;
    5396                 :          2 :                 break;
    5397                 :            :             case sheet::TableOperationMode_ROW:
    5398                 :          2 :                 aParam.nMode = 1;
    5399                 :          2 :                 break;
    5400                 :            :             case sheet::TableOperationMode_BOTH:
    5401                 :          2 :                 aParam.nMode = 2;
    5402                 :          2 :                 break;
    5403                 :            :             default:
    5404                 :          0 :                 bError = sal_True;
    5405                 :            :         }
    5406                 :            : 
    5407         [ +  - ]:          6 :         if (!bError)
    5408         [ +  - ]:          6 :             pDocSh->GetDocFunc().TabOp( aRange, NULL, aParam, sal_True, sal_True );
    5409         [ +  - ]:          6 :     }
    5410                 :          6 : }
    5411                 :            : 
    5412                 :            : // XMergeable
    5413                 :            : 
    5414                 :          6 : void SAL_CALL ScCellRangeObj::merge( sal_Bool bMerge ) throw(uno::RuntimeException)
    5415                 :            : {
    5416         [ +  - ]:          6 :     SolarMutexGuard aGuard;
    5417                 :          6 :     ScDocShell* pDocSh = GetDocShell();
    5418         [ +  - ]:          6 :     if ( pDocSh )
    5419                 :            :     {
    5420                 :            :         ScCellMergeOption aMergeOption(
    5421                 :          6 :             aRange.aStart.Col(), aRange.aStart.Row(),
    5422         [ +  - ]:         12 :             aRange.aEnd.Col(), aRange.aEnd.Row(), false);
    5423         [ +  - ]:          6 :         aMergeOption.maTabs.insert(aRange.aStart.Tab());
    5424         [ +  + ]:          6 :         if ( bMerge )
    5425         [ +  - ]:          3 :             pDocSh->GetDocFunc().MergeCells( aMergeOption, false, true, true );
    5426                 :            :         else
    5427         [ +  - ]:          6 :             pDocSh->GetDocFunc().UnmergeCells( aMergeOption, true );
    5428                 :            : 
    5429                 :            :         //! Fehler abfangen?
    5430         [ +  - ]:          6 :     }
    5431                 :          6 : }
    5432                 :            : 
    5433                 :          8 : sal_Bool SAL_CALL ScCellRangeObj::getIsMerged() throw(uno::RuntimeException)
    5434                 :            : {
    5435         [ +  - ]:          8 :     SolarMutexGuard aGuard;
    5436                 :          8 :     ScDocShell* pDocSh = GetDocShell();
    5437 [ +  - ][ +  + ]:          8 :     return pDocSh && pDocSh->GetDocument()->HasAttrib( aRange, HASATTR_MERGED );
         [ +  - ][ +  - ]
    5438                 :            : }
    5439                 :            : 
    5440                 :            : // XCellSeries
    5441                 :            : 
    5442                 :          8 : void SAL_CALL ScCellRangeObj::fillSeries( sheet::FillDirection nFillDirection,
    5443                 :            :                         sheet::FillMode nFillMode, sheet::FillDateMode nFillDateMode,
    5444                 :            :                         double fStep, double fEndValue ) throw(uno::RuntimeException)
    5445                 :            : {
    5446         [ +  - ]:          8 :     SolarMutexGuard aGuard;
    5447                 :          8 :     ScDocShell* pDocSh = GetDocShell();
    5448         [ +  - ]:          8 :     if ( pDocSh )
    5449                 :            :     {
    5450                 :          8 :         sal_Bool bError = false;
    5451                 :            : 
    5452                 :          8 :         FillDir eDir = FILL_TO_BOTTOM;
    5453   [ +  +  -  -  :          8 :         switch (nFillDirection)
                      - ]
    5454                 :            :         {
    5455                 :            :             case sheet::FillDirection_TO_BOTTOM:
    5456                 :          4 :                 eDir = FILL_TO_BOTTOM;
    5457                 :          4 :                 break;
    5458                 :            :             case sheet::FillDirection_TO_RIGHT:
    5459                 :          4 :                 eDir = FILL_TO_RIGHT;
    5460                 :          4 :                 break;
    5461                 :            :             case sheet::FillDirection_TO_TOP:
    5462                 :          0 :                 eDir = FILL_TO_TOP;
    5463                 :          0 :                 break;
    5464                 :            :             case sheet::FillDirection_TO_LEFT:
    5465                 :          0 :                 eDir = FILL_TO_LEFT;
    5466                 :          0 :                 break;
    5467                 :            :             default:
    5468                 :          0 :                 bError = sal_True;
    5469                 :            :         }
    5470                 :            : 
    5471                 :          8 :         FillCmd eCmd = FILL_SIMPLE;
    5472   [ -  +  +  -  :          8 :         switch ( nFillMode )
                   -  - ]
    5473                 :            :         {
    5474                 :            :             case sheet::FillMode_SIMPLE:
    5475                 :          0 :                 eCmd = FILL_SIMPLE;
    5476                 :          0 :                 break;
    5477                 :            :             case sheet::FillMode_LINEAR:
    5478                 :          4 :                 eCmd = FILL_LINEAR;
    5479                 :          4 :                 break;
    5480                 :            :             case sheet::FillMode_GROWTH:
    5481                 :          4 :                 eCmd = FILL_GROWTH;
    5482                 :          4 :                 break;
    5483                 :            :             case sheet::FillMode_DATE:
    5484                 :          0 :                 eCmd = FILL_DATE;
    5485                 :          0 :                 break;
    5486                 :            :             case sheet::FillMode_AUTO:
    5487                 :          0 :                 eCmd = FILL_AUTO;
    5488                 :          0 :                 break;
    5489                 :            :             default:
    5490                 :          0 :                 bError = sal_True;
    5491                 :            :         }
    5492                 :            : 
    5493                 :          8 :         FillDateCmd eDateCmd = FILL_DAY;
    5494   [ +  -  -  -  :          8 :         switch ( nFillDateMode )
                      - ]
    5495                 :            :         {
    5496                 :            :             case sheet::FillDateMode_FILL_DATE_DAY:
    5497                 :          8 :                 eDateCmd = FILL_DAY;
    5498                 :          8 :                 break;
    5499                 :            :             case sheet::FillDateMode_FILL_DATE_WEEKDAY:
    5500                 :          0 :                 eDateCmd = FILL_WEEKDAY;
    5501                 :          0 :                 break;
    5502                 :            :             case sheet::FillDateMode_FILL_DATE_MONTH:
    5503                 :          0 :                 eDateCmd = FILL_MONTH;
    5504                 :          0 :                 break;
    5505                 :            :             case sheet::FillDateMode_FILL_DATE_YEAR:
    5506                 :          0 :                 eDateCmd = FILL_YEAR;
    5507                 :          0 :                 break;
    5508                 :            :             default:
    5509                 :          0 :                 bError = sal_True;
    5510                 :            :         }
    5511                 :            : 
    5512         [ +  - ]:          8 :         if (!bError)
    5513                 :          8 :             pDocSh->GetDocFunc().FillSeries( aRange, NULL, eDir, eCmd, eDateCmd,
    5514         [ +  - ]:          8 :                                                 MAXDOUBLE, fStep, fEndValue, sal_True, sal_True );
    5515         [ +  - ]:          8 :     }
    5516                 :          8 : }
    5517                 :            : 
    5518                 :          4 : void SAL_CALL ScCellRangeObj::fillAuto( sheet::FillDirection nFillDirection,
    5519                 :            :                                 sal_Int32 nSourceCount ) throw(uno::RuntimeException)
    5520                 :            : {
    5521         [ +  - ]:          4 :     SolarMutexGuard aGuard;
    5522                 :          4 :     ScDocShell* pDocSh = GetDocShell();
    5523 [ +  - ][ +  - ]:          4 :     if ( pDocSh && nSourceCount )
    5524                 :            :     {
    5525                 :          4 :         ScRange aSourceRange(aRange);
    5526                 :          4 :         SCsCOLROW nCount = 0;                   // "Dest-Count"
    5527                 :          4 :         FillDir eDir = FILL_TO_BOTTOM;
    5528                 :          4 :         sal_Bool bError = false;
    5529   [ +  +  -  -  :          4 :         switch (nFillDirection)
                      - ]
    5530                 :            :         {
    5531                 :            :             case sheet::FillDirection_TO_BOTTOM:
    5532                 :          2 :                 aSourceRange.aEnd.SetRow( static_cast<SCROW>( aSourceRange.aStart.Row() + nSourceCount - 1 ) );
    5533                 :          2 :                 nCount = aRange.aEnd.Row() - aSourceRange.aEnd.Row();
    5534                 :          2 :                 eDir = FILL_TO_BOTTOM;
    5535                 :          2 :                 break;
    5536                 :            :             case sheet::FillDirection_TO_RIGHT:
    5537                 :          2 :                 aSourceRange.aEnd.SetCol( static_cast<SCCOL>( aSourceRange.aStart.Col() + nSourceCount - 1 ) );
    5538                 :          2 :                 nCount = aRange.aEnd.Col() - aSourceRange.aEnd.Col();
    5539                 :          2 :                 eDir = FILL_TO_RIGHT;
    5540                 :          2 :                 break;
    5541                 :            :             case sheet::FillDirection_TO_TOP:
    5542                 :          0 :                 aSourceRange.aStart.SetRow( static_cast<SCROW>( aSourceRange.aEnd.Row() - nSourceCount + 1 ) );
    5543                 :          0 :                 nCount = aSourceRange.aStart.Row() - aRange.aStart.Row();
    5544                 :          0 :                 eDir = FILL_TO_TOP;
    5545                 :          0 :                 break;
    5546                 :            :             case sheet::FillDirection_TO_LEFT:
    5547                 :          0 :                 aSourceRange.aStart.SetCol( static_cast<SCCOL>( aSourceRange.aEnd.Col() - nSourceCount + 1 ) );
    5548                 :          0 :                 nCount = aSourceRange.aStart.Col() - aRange.aStart.Col();
    5549                 :          0 :                 eDir = FILL_TO_LEFT;
    5550                 :          0 :                 break;
    5551                 :            :             default:
    5552                 :          0 :                 bError = sal_True;
    5553                 :            :         }
    5554 [ +  - ][ -  + ]:          4 :         if (nCount < 0 || nCount > MAXROW)      // overflow
    5555                 :          0 :             bError = sal_True;
    5556                 :            : 
    5557         [ +  - ]:          4 :         if (!bError)
    5558         [ +  - ]:          4 :             pDocSh->GetDocFunc().FillAuto( aSourceRange, NULL, eDir, nCount, sal_True, sal_True );
    5559         [ +  - ]:          4 :     }
    5560                 :          4 : }
    5561                 :            : 
    5562                 :            : // XAutoFormattable
    5563                 :            : 
    5564                 :          0 : void SAL_CALL ScCellRangeObj::autoFormat( const rtl::OUString& aName )
    5565                 :            :                     throw(lang::IllegalArgumentException, uno::RuntimeException)
    5566                 :            : {
    5567         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    5568                 :          0 :     ScDocShell* pDocSh = GetDocShell();
    5569         [ #  # ]:          0 :     if ( pDocSh )
    5570                 :            :     {
    5571         [ #  # ]:          0 :         ScAutoFormat* pAutoFormat = ScGlobal::GetOrCreateAutoFormat();
    5572 [ #  # ][ #  # ]:          0 :         ScAutoFormat::const_iterator it = pAutoFormat->find(aName);
    5573 [ #  # ][ #  # ]:          0 :         if (it != pAutoFormat->end())
                 [ #  # ]
    5574                 :            :         {
    5575 [ #  # ][ #  # ]:          0 :             ScAutoFormat::const_iterator itBeg = pAutoFormat->begin();
    5576         [ #  # ]:          0 :             size_t nIndex = std::distance(itBeg, it);
    5577         [ #  # ]:          0 :             pDocSh->GetDocFunc().AutoFormat(aRange, NULL, nIndex, true, true);
    5578                 :            :         }
    5579                 :            :         else
    5580         [ #  # ]:          0 :             throw lang::IllegalArgumentException();
    5581         [ #  # ]:          0 :     }
    5582                 :          0 : }
    5583                 :            : 
    5584                 :            : // XSortable
    5585                 :            : 
    5586                 :          2 : uno::Sequence<beans::PropertyValue> SAL_CALL ScCellRangeObj::createSortDescriptor()
    5587                 :            :                                                 throw(uno::RuntimeException)
    5588                 :            : {
    5589         [ +  - ]:          2 :     SolarMutexGuard aGuard;
    5590         [ +  - ]:          2 :     ScSortParam aParam;
    5591                 :          2 :     ScDocShell* pDocSh = GetDocShell();
    5592         [ +  - ]:          2 :     if ( pDocSh )
    5593                 :            :     {
    5594                 :            :         // DB-Bereich anlegen erst beim Ausfuehren, per API immer genau den Bereich
    5595         [ +  - ]:          2 :         ScDBData* pData = pDocSh->GetDBData( aRange, SC_DB_OLD, SC_DBSEL_FORCE_MARK );
    5596         [ -  + ]:          2 :         if (pData)
    5597                 :            :         {
    5598         [ #  # ]:          0 :             pData->GetSortParam(aParam);
    5599                 :            : 
    5600                 :            :             //  im SortDescriptor sind die Fields innerhalb des Bereichs gezaehlt
    5601                 :          0 :             ScRange aDBRange;
    5602         [ #  # ]:          0 :             pData->GetArea(aDBRange);
    5603                 :            :             SCCOLROW nFieldStart = aParam.bByRow ?
    5604                 :          0 :                 static_cast<SCCOLROW>(aDBRange.aStart.Col()) :
    5605         [ #  # ]:          0 :                 static_cast<SCCOLROW>(aDBRange.aStart.Row());
    5606         [ #  # ]:          0 :             for (sal_uInt16 i=0; i<aParam.GetSortKeyCount(); i++)
    5607 [ #  # ][ #  # ]:          0 :                 if ( aParam.maKeyState[i].bDoSort && aParam.maKeyState[i].nField >= nFieldStart )
                 [ #  # ]
    5608                 :          0 :                     aParam.maKeyState[i].nField -= nFieldStart;
    5609                 :            :         }
    5610                 :            :     }
    5611                 :            : 
    5612 [ +  - ][ +  - ]:          2 :     uno::Sequence<beans::PropertyValue> aSeq( ScSortDescriptor::GetPropertyCount() );
    5613         [ +  - ]:          2 :     ScSortDescriptor::FillProperties( aSeq, aParam );
    5614 [ +  - ][ +  - ]:          2 :     return aSeq;
    5615                 :            : }
    5616                 :            : 
    5617                 :          8 : void SAL_CALL ScCellRangeObj::sort( const uno::Sequence<beans::PropertyValue>& aDescriptor )
    5618                 :            :                                                 throw(uno::RuntimeException)
    5619                 :            : {
    5620         [ +  - ]:          8 :     SolarMutexGuard aGuard;
    5621                 :          8 :     ScDocShell* pDocSh = GetDocShell();
    5622         [ +  - ]:          8 :     if (pDocSh)
    5623                 :            :     {
    5624                 :            :         sal_uInt16 i;
    5625         [ +  - ]:          8 :         ScSortParam aParam;
    5626         [ +  - ]:          8 :         ScDBData* pData = pDocSh->GetDBData( aRange, SC_DB_MAKE, SC_DBSEL_FORCE_MARK ); // ggf. Bereich anlegen
    5627         [ +  - ]:          8 :         if (pData)
    5628                 :            :         {
    5629                 :            :             //  alten Einstellungen holen, falls nicht alles neu gesetzt wird
    5630         [ +  - ]:          8 :             pData->GetSortParam(aParam);
    5631                 :            :             SCCOLROW nOldStart = aParam.bByRow ?
    5632                 :          8 :                 static_cast<SCCOLROW>(aRange.aStart.Col()) :
    5633         [ +  - ]:         16 :                 static_cast<SCCOLROW>(aRange.aStart.Row());
    5634         [ +  + ]:         32 :             for (i=0; i<aParam.GetSortKeyCount(); i++)
    5635 [ +  + ][ +  - ]:         24 :                 if ( aParam.maKeyState[i].bDoSort && aParam.maKeyState[i].nField >= nOldStart )
                 [ +  + ]
    5636                 :          6 :                     aParam.maKeyState[i].nField -= nOldStart;
    5637                 :            :         }
    5638                 :            : 
    5639         [ +  - ]:          8 :         ScSortDescriptor::FillSortParam( aParam, aDescriptor );
    5640                 :            : 
    5641                 :            :         //  im SortDescriptor sind die Fields innerhalb des Bereichs gezaehlt
    5642                 :            :         //  ByRow kann bei FillSortParam umgesetzt worden sein
    5643                 :            :         SCCOLROW nFieldStart = aParam.bByRow ?
    5644                 :          8 :             static_cast<SCCOLROW>(aRange.aStart.Col()) :
    5645         [ +  - ]:         16 :             static_cast<SCCOLROW>(aRange.aStart.Row());
    5646         [ +  + ]:         32 :         for (i=0; i<aParam.GetSortKeyCount(); i++)
    5647                 :         24 :             aParam.maKeyState[i].nField += nFieldStart;
    5648                 :            : 
    5649                 :          8 :         SCTAB nTab = aRange.aStart.Tab();
    5650                 :          8 :         aParam.nCol1 = aRange.aStart.Col();
    5651                 :          8 :         aParam.nRow1 = aRange.aStart.Row();
    5652                 :          8 :         aParam.nCol2 = aRange.aEnd.Col();
    5653                 :          8 :         aParam.nRow2 = aRange.aEnd.Row();
    5654                 :            : 
    5655         [ +  - ]:          8 :         pDocSh->GetDBData( aRange, SC_DB_MAKE, SC_DBSEL_FORCE_MARK );       // ggf. Bereich anlegen
    5656                 :            : 
    5657                 :          8 :         ScDBDocFunc aFunc(*pDocSh); // Bereich muss angelegt sein
    5658 [ +  - ][ +  - ]:          8 :         aFunc.Sort( nTab, aParam, sal_True, sal_True, sal_True );
    5659         [ +  - ]:          8 :     }
    5660                 :          8 : }
    5661                 :            : 
    5662                 :            : // XFilterable
    5663                 :            : 
    5664                 :          3 : uno::Reference<sheet::XSheetFilterDescriptor> SAL_CALL ScCellRangeObj::createFilterDescriptor(
    5665                 :            :                                 sal_Bool bEmpty ) throw(uno::RuntimeException)
    5666                 :            : {
    5667         [ +  - ]:          3 :     SolarMutexGuard aGuard;
    5668                 :          3 :     ScDocShell* pDocSh = GetDocShell();
    5669         [ +  - ]:          3 :     ScFilterDescriptor* pNew = new ScFilterDescriptor(pDocSh);
    5670 [ -  + ][ #  # ]:          3 :     if ( !bEmpty && pDocSh )
    5671                 :            :     {
    5672                 :            :         // DB-Bereich anlegen erst beim Ausfuehren, per API immer genau den Bereich
    5673         [ #  # ]:          0 :         ScDBData* pData = pDocSh->GetDBData( aRange, SC_DB_OLD, SC_DBSEL_FORCE_MARK );
    5674         [ #  # ]:          0 :         if (pData)
    5675                 :            :         {
    5676         [ #  # ]:          0 :             ScQueryParam aParam;
    5677         [ #  # ]:          0 :             pData->GetQueryParam(aParam);
    5678                 :            :             //  im FilterDescriptor sind die Fields innerhalb des Bereichs gezaehlt
    5679                 :          0 :             ScRange aDBRange;
    5680         [ #  # ]:          0 :             pData->GetArea(aDBRange);
    5681                 :            :             SCCOLROW nFieldStart = aParam.bByRow ?
    5682                 :          0 :                 static_cast<SCCOLROW>(aDBRange.aStart.Col()) :
    5683         [ #  # ]:          0 :                 static_cast<SCCOLROW>(aDBRange.aStart.Row());
    5684         [ #  # ]:          0 :             SCSIZE nCount = aParam.GetEntryCount();
    5685         [ #  # ]:          0 :             for (SCSIZE i=0; i<nCount; i++)
    5686                 :            :             {
    5687         [ #  # ]:          0 :                 ScQueryEntry& rEntry = aParam.GetEntry(i);
    5688 [ #  # ][ #  # ]:          0 :                 if (rEntry.bDoQuery && rEntry.nField >= nFieldStart)
    5689                 :          0 :                     rEntry.nField -= nFieldStart;
    5690                 :            :             }
    5691 [ #  # ][ #  # ]:          0 :             pNew->SetParam(aParam);
    5692                 :            :         }
    5693                 :            :     }
    5694 [ +  - ][ +  - ]:          3 :     return pNew;
                 [ +  - ]
    5695                 :            : }
    5696                 :            : 
    5697                 :          2 : void SAL_CALL ScCellRangeObj::filter( const uno::Reference<sheet::XSheetFilterDescriptor>& xDescriptor )
    5698                 :            :                                                 throw(uno::RuntimeException)
    5699                 :            : {
    5700         [ +  - ]:          2 :     SolarMutexGuard aGuard;
    5701                 :            : 
    5702                 :            :     //  das koennte theoretisch ein fremdes Objekt sein, also nur das
    5703                 :            :     //  oeffentliche XSheetFilterDescriptor Interface benutzen, um
    5704                 :            :     //  die Daten in ein ScFilterDescriptor Objekt zu kopieren:
    5705                 :            :     //! wenn es schon ein ScFilterDescriptor ist, direkt per getImplementation?
    5706                 :            : 
    5707                 :          2 :     ScDocShell* pDocSh = GetDocShell();
    5708         [ +  - ]:          2 :     ScFilterDescriptor aImpl(pDocSh);
    5709         [ +  - ]:          2 :     uno::Reference< sheet::XSheetFilterDescriptor2 > xDescriptor2( xDescriptor, uno::UNO_QUERY );
    5710         [ +  - ]:          2 :     if ( xDescriptor2.is() )
    5711                 :            :     {
    5712 [ +  - ][ +  - ]:          2 :         aImpl.setFilterFields2( xDescriptor2->getFilterFields2() );
         [ +  - ][ +  - ]
    5713                 :            :     }
    5714                 :            :     else
    5715                 :            :     {
    5716 [ #  # ][ #  # ]:          0 :         aImpl.setFilterFields( xDescriptor->getFilterFields() );
         [ #  # ][ #  # ]
    5717                 :            :     }
    5718                 :            :     //  Rest sind jetzt Properties...
    5719                 :            : 
    5720         [ +  - ]:          2 :     uno::Reference<beans::XPropertySet> xPropSet( xDescriptor, uno::UNO_QUERY );
    5721         [ +  - ]:          2 :     if (xPropSet.is())
    5722 [ +  - ][ +  - ]:          2 :         lcl_CopyProperties( aImpl, *(beans::XPropertySet*)xPropSet.get() );
    5723                 :            : 
    5724                 :            :     //
    5725                 :            :     //  ausfuehren...
    5726                 :            :     //
    5727                 :            : 
    5728         [ +  - ]:          2 :     if (pDocSh)
    5729                 :            :     {
    5730         [ +  - ]:          2 :         ScQueryParam aParam = aImpl.GetParam();
    5731                 :            :         //  im FilterDescriptor sind die Fields innerhalb des Bereichs gezaehlt
    5732                 :            :         SCCOLROW nFieldStart = aParam.bByRow ?
    5733                 :          2 :             static_cast<SCCOLROW>(aRange.aStart.Col()) :
    5734         [ +  - ]:          4 :             static_cast<SCCOLROW>(aRange.aStart.Row());
    5735         [ +  - ]:          2 :         SCSIZE nCount = aParam.GetEntryCount();
    5736         [ +  + ]:         18 :         for (SCSIZE i=0; i<nCount; i++)
    5737                 :            :         {
    5738         [ +  - ]:         16 :             ScQueryEntry& rEntry = aParam.GetEntry(i);
    5739         [ +  + ]:         16 :             if (rEntry.bDoQuery)
    5740                 :            :             {
    5741                 :          4 :                 rEntry.nField += nFieldStart;
    5742                 :            :                 //  Im Dialog wird immer der String angezeigt -> muss zum Wert passen
    5743         [ +  - ]:          4 :                 ScQueryEntry::QueryItemsType& rItems = rEntry.GetQueryItems();
    5744         [ +  - ]:          4 :                 rItems.resize(1);
    5745         [ +  - ]:          4 :                 ScQueryEntry::Item& rItem = rItems.front();
    5746         [ +  + ]:          4 :                 if (rItem.meType != ScQueryEntry::ByString)
    5747                 :            :                 {
    5748                 :            :                     pDocSh->GetDocument()->GetFormatTable()->
    5749 [ +  - ][ +  - ]:          2 :                         GetInputLineString(rItem.mfVal, 0, rItem.maString);
    5750                 :            :                 }
    5751                 :            :             }
    5752                 :            :         }
    5753                 :            : 
    5754                 :          2 :         SCTAB nTab = aRange.aStart.Tab();
    5755                 :          2 :         aParam.nCol1 = aRange.aStart.Col();
    5756                 :          2 :         aParam.nRow1 = aRange.aStart.Row();
    5757                 :          2 :         aParam.nCol2 = aRange.aEnd.Col();
    5758                 :          2 :         aParam.nRow2 = aRange.aEnd.Row();
    5759                 :            : 
    5760         [ +  - ]:          2 :         pDocSh->GetDBData( aRange, SC_DB_MAKE, SC_DBSEL_FORCE_MARK );   // ggf. Bereich anlegen
    5761                 :            : 
    5762                 :            :         //! keep source range in filter descriptor
    5763                 :            :         //! if created by createFilterDescriptorByObject ???
    5764                 :            : 
    5765                 :          2 :         ScDBDocFunc aFunc(*pDocSh);
    5766 [ +  - ][ +  - ]:          2 :         aFunc.Query( nTab, aParam, NULL, sal_True, sal_True );  // Bereich muss angelegt sein
    5767 [ +  - ][ +  - ]:          2 :     }
    5768                 :          2 : }
    5769                 :            : 
    5770                 :            : //! get/setAutoFilter als Properties!!!
    5771                 :            : 
    5772                 :            : // XAdvancedFilterSource
    5773                 :            : 
    5774                 :          2 : uno::Reference<sheet::XSheetFilterDescriptor> SAL_CALL ScCellRangeObj::createFilterDescriptorByObject(
    5775                 :            :                         const uno::Reference<sheet::XSheetFilterable>& xObject )
    5776                 :            :                                                 throw(uno::RuntimeException)
    5777                 :            : {
    5778         [ +  - ]:          2 :     SolarMutexGuard aGuard;
    5779                 :            : 
    5780                 :            :     //  this ist hier nicht der Bereich, der gefiltert wird, sondern der
    5781                 :            :     //  Bereich mit der Abfrage...
    5782                 :            : 
    5783         [ +  - ]:          2 :     uno::Reference<sheet::XCellRangeAddressable> xAddr( xObject, uno::UNO_QUERY );
    5784                 :            : 
    5785                 :          2 :     ScDocShell* pDocSh = GetDocShell();
    5786 [ +  - ][ +  - ]:          2 :     if ( pDocSh && xAddr.is() )
                 [ +  - ]
    5787                 :            :     {
    5788                 :            :         //! Test, ob xObject im selben Dokument ist
    5789                 :            : 
    5790         [ +  - ]:          2 :         ScFilterDescriptor* pNew = new ScFilterDescriptor(pDocSh);  //! stattdessen vom Objekt?
    5791                 :            : 
    5792         [ +  - ]:          2 :         ScQueryParam aParam = pNew->GetParam();
    5793                 :          2 :         aParam.bHasHeader = sal_True;
    5794                 :            : 
    5795 [ +  - ][ +  - ]:          2 :         table::CellRangeAddress aDataAddress(xAddr->getRangeAddress());
    5796                 :          2 :         aParam.nCol1 = (SCCOL)aDataAddress.StartColumn;
    5797                 :          2 :         aParam.nRow1 = (SCROW)aDataAddress.StartRow;
    5798                 :          2 :         aParam.nCol2 = (SCCOL)aDataAddress.EndColumn;
    5799                 :          2 :         aParam.nRow2 = (SCROW)aDataAddress.EndRow;
    5800                 :          2 :         aParam.nTab  = aDataAddress.Sheet;
    5801                 :            : 
    5802                 :          2 :         ScDocument* pDoc = pDocSh->GetDocument();
    5803                 :            :         sal_Bool bOk = pDoc->CreateQueryParam(
    5804                 :          2 :                             aRange.aStart.Col(), aRange.aStart.Row(),
    5805                 :          2 :                             aRange.aEnd.Col(), aRange.aEnd.Row(),
    5806         [ +  - ]:          6 :                             aRange.aStart.Tab(), aParam );
    5807         [ +  - ]:          2 :         if ( bOk )
    5808                 :            :         {
    5809                 :            :             //  im FilterDescriptor sind die Fields innerhalb des Bereichs gezaehlt
    5810                 :            :             SCCOLROW nFieldStart = aParam.bByRow ?
    5811                 :            :                 static_cast<SCCOLROW>(aDataAddress.StartColumn) :
    5812         [ +  - ]:          2 :                 static_cast<SCCOLROW>(aDataAddress.StartRow);
    5813         [ +  - ]:          2 :             SCSIZE nCount = aParam.GetEntryCount();
    5814         [ +  + ]:         18 :             for (SCSIZE i=0; i<nCount; i++)
    5815                 :            :             {
    5816         [ +  - ]:         16 :                 ScQueryEntry& rEntry = aParam.GetEntry(i);
    5817 [ +  + ][ +  - ]:         16 :                 if (rEntry.bDoQuery && rEntry.nField >= nFieldStart)
    5818                 :          4 :                     rEntry.nField -= nFieldStart;
    5819                 :            :             }
    5820                 :            : 
    5821         [ +  - ]:          2 :             pNew->SetParam( aParam );
    5822 [ +  - ][ +  - ]:          2 :             return pNew;
    5823                 :            :         }
    5824                 :            :         else
    5825                 :            :         {
    5826 [ #  # ][ #  # ]:          0 :             delete pNew;
    5827         [ #  # ]:          0 :             return NULL;        // ungueltig -> null
    5828         [ +  - ]:          2 :         }
    5829                 :            :     }
    5830                 :            : 
    5831                 :            :     OSL_FAIL("kein Dokument oder kein Bereich");
    5832 [ #  # ][ +  - ]:          2 :     return NULL;
    5833                 :            : }
    5834                 :            : 
    5835                 :            : // XSubTotalSource
    5836                 :            : 
    5837                 :          7 : uno::Reference<sheet::XSubTotalDescriptor> SAL_CALL ScCellRangeObj::createSubTotalDescriptor(
    5838                 :            :                                 sal_Bool bEmpty ) throw(uno::RuntimeException)
    5839                 :            : {
    5840         [ +  - ]:          7 :     SolarMutexGuard aGuard;
    5841         [ +  - ]:          7 :     ScSubTotalDescriptor* pNew = new ScSubTotalDescriptor;
    5842                 :          7 :     ScDocShell* pDocSh = GetDocShell();
    5843 [ #  # ][ -  + ]:          7 :     if ( !bEmpty && pDocSh )
    5844                 :            :     {
    5845                 :            :         // DB-Bereich anlegen erst beim Ausfuehren, per API immer genau den Bereich
    5846         [ #  # ]:          0 :         ScDBData* pData = pDocSh->GetDBData( aRange, SC_DB_OLD, SC_DBSEL_FORCE_MARK );
    5847         [ #  # ]:          0 :         if (pData)
    5848                 :            :         {
    5849         [ #  # ]:          0 :             ScSubTotalParam aParam;
    5850         [ #  # ]:          0 :             pData->GetSubTotalParam(aParam);
    5851                 :            :             //  im SubTotalDescriptor sind die Fields innerhalb des Bereichs gezaehlt
    5852                 :          0 :             ScRange aDBRange;
    5853         [ #  # ]:          0 :             pData->GetArea(aDBRange);
    5854                 :          0 :             SCCOL nFieldStart = aDBRange.aStart.Col();
    5855         [ #  # ]:          0 :             for (sal_uInt16 i=0; i<MAXSUBTOTAL; i++)
    5856                 :            :             {
    5857         [ #  # ]:          0 :                 if ( aParam.bGroupActive[i] )
    5858                 :            :                 {
    5859         [ #  # ]:          0 :                     if ( aParam.nField[i] >= nFieldStart )
    5860                 :          0 :                         aParam.nField[i] = sal::static_int_cast<SCCOL>( aParam.nField[i] - nFieldStart );
    5861         [ #  # ]:          0 :                     for (SCCOL j=0; j<aParam.nSubTotals[i]; j++)
    5862         [ #  # ]:          0 :                         if ( aParam.pSubTotals[i][j] >= nFieldStart )
    5863                 :          0 :                             aParam.pSubTotals[i][j] = sal::static_int_cast<SCCOL>( aParam.pSubTotals[i][j] - nFieldStart );
    5864                 :            :                 }
    5865                 :            :             }
    5866         [ #  # ]:          0 :             pNew->SetParam(aParam);
    5867                 :            :         }
    5868                 :            :     }
    5869 [ +  - ][ +  - ]:          7 :     return pNew;
                 [ +  - ]
    5870                 :            : }
    5871                 :            : 
    5872                 :          2 : void SAL_CALL ScCellRangeObj::applySubTotals(
    5873                 :            :                 const uno::Reference<sheet::XSubTotalDescriptor>& xDescriptor,
    5874                 :            :                 sal_Bool bReplace ) throw(uno::RuntimeException)
    5875                 :            : {
    5876         [ +  - ]:          2 :     SolarMutexGuard aGuard;
    5877                 :            : 
    5878         [ -  + ]:          4 :     if (!xDescriptor.is()) return;
    5879                 :            : 
    5880                 :          2 :     ScDocShell* pDocSh = GetDocShell();
    5881                 :            :     ScSubTotalDescriptorBase* pImp =
    5882         [ +  - ]:          2 :         ScSubTotalDescriptorBase::getImplementation( xDescriptor );
    5883                 :            : 
    5884 [ +  - ][ +  - ]:          2 :     if (pDocSh && pImp)
    5885                 :            :     {
    5886         [ +  - ]:          2 :         ScSubTotalParam aParam;
    5887         [ +  - ]:          2 :         pImp->GetData(aParam);      // virtuelle Methode der Basisklasse
    5888                 :            : 
    5889                 :            :         //  im SubTotalDescriptor sind die Fields innerhalb des Bereichs gezaehlt
    5890                 :          2 :         SCCOL nFieldStart = aRange.aStart.Col();
    5891         [ +  + ]:          8 :         for (sal_uInt16 i=0; i<MAXSUBTOTAL; i++)
    5892                 :            :         {
    5893         [ +  + ]:          6 :             if ( aParam.bGroupActive[i] )
    5894                 :            :             {
    5895                 :          2 :                 aParam.nField[i] = sal::static_int_cast<SCCOL>( aParam.nField[i] + nFieldStart );
    5896         [ +  + ]:          4 :                 for (SCCOL j=0; j<aParam.nSubTotals[i]; j++)
    5897                 :          2 :                     aParam.pSubTotals[i][j] = sal::static_int_cast<SCCOL>( aParam.pSubTotals[i][j] + nFieldStart );
    5898                 :            :             }
    5899                 :            :         }
    5900                 :            : 
    5901                 :          2 :         aParam.bReplace = bReplace;
    5902                 :            : 
    5903                 :          2 :         SCTAB nTab = aRange.aStart.Tab();
    5904                 :          2 :         aParam.nCol1 = aRange.aStart.Col();
    5905                 :          2 :         aParam.nRow1 = aRange.aStart.Row();
    5906                 :          2 :         aParam.nCol2 = aRange.aEnd.Col();
    5907                 :          2 :         aParam.nRow2 = aRange.aEnd.Row();
    5908                 :            : 
    5909         [ +  - ]:          2 :         pDocSh->GetDBData( aRange, SC_DB_MAKE, SC_DBSEL_FORCE_MARK );   // ggf. Bereich anlegen
    5910                 :            : 
    5911                 :          2 :         ScDBDocFunc aFunc(*pDocSh);
    5912         [ +  - ]:          2 :         aFunc.DoSubTotals( nTab, aParam, NULL, sal_True, sal_True );    // Bereich muss angelegt sein
    5913 [ +  - ][ +  - ]:          2 :     }
    5914                 :            : }
    5915                 :            : 
    5916                 :          2 : void SAL_CALL ScCellRangeObj::removeSubTotals() throw(uno::RuntimeException)
    5917                 :            : {
    5918         [ +  - ]:          2 :     SolarMutexGuard aGuard;
    5919                 :            : 
    5920                 :          2 :     ScDocShell* pDocSh = GetDocShell();
    5921         [ +  - ]:          2 :     if (pDocSh)
    5922                 :            :     {
    5923         [ +  - ]:          2 :         ScSubTotalParam aParam;
    5924         [ +  - ]:          2 :         ScDBData* pData = pDocSh->GetDBData( aRange, SC_DB_OLD, SC_DBSEL_FORCE_MARK );
    5925         [ -  + ]:          2 :         if (pData)
    5926         [ #  # ]:          0 :             pData->GetSubTotalParam(aParam);    // auch bei Remove die Feld-Eintraege behalten
    5927                 :            : 
    5928                 :          2 :         aParam.bRemoveOnly = sal_True;
    5929                 :            : 
    5930                 :          2 :         SCTAB nTab = aRange.aStart.Tab();
    5931                 :          2 :         aParam.nCol1 = aRange.aStart.Col();
    5932                 :          2 :         aParam.nRow1 = aRange.aStart.Row();
    5933                 :          2 :         aParam.nCol2 = aRange.aEnd.Col();
    5934                 :          2 :         aParam.nRow2 = aRange.aEnd.Row();
    5935                 :            : 
    5936         [ +  - ]:          2 :         pDocSh->GetDBData( aRange, SC_DB_MAKE, SC_DBSEL_FORCE_MARK );   // ggf. Bereich anlegen
    5937                 :            : 
    5938                 :          2 :         ScDBDocFunc aFunc(*pDocSh);
    5939         [ +  - ]:          2 :         aFunc.DoSubTotals( nTab, aParam, NULL, sal_True, sal_True );    // Bereich muss angelegt sein
    5940         [ +  - ]:          2 :     }
    5941                 :          2 : }
    5942                 :            : 
    5943                 :          6 : uno::Sequence<beans::PropertyValue> SAL_CALL ScCellRangeObj::createImportDescriptor( sal_Bool bEmpty )
    5944                 :            :                                                 throw(uno::RuntimeException)
    5945                 :            : {
    5946         [ +  - ]:          6 :     SolarMutexGuard aGuard;
    5947         [ +  - ]:          6 :     ScImportParam aParam;
    5948                 :          6 :     ScDocShell* pDocSh = GetDocShell();
    5949 [ +  - ][ +  + ]:          6 :     if ( !bEmpty && pDocSh )
    5950                 :            :     {
    5951                 :            :         // DB-Bereich anlegen erst beim Ausfuehren, per API immer genau den Bereich
    5952         [ +  - ]:          4 :         ScDBData* pData = pDocSh->GetDBData( aRange, SC_DB_OLD, SC_DBSEL_FORCE_MARK );
    5953         [ -  + ]:          4 :         if (pData)
    5954         [ #  # ]:          0 :             pData->GetImportParam(aParam);
    5955                 :            :     }
    5956                 :            : 
    5957 [ +  - ][ +  - ]:          6 :     uno::Sequence<beans::PropertyValue> aSeq( ScImportDescriptor::GetPropertyCount() );
    5958         [ +  - ]:          6 :     ScImportDescriptor::FillProperties( aSeq, aParam );
    5959 [ +  - ][ +  - ]:          6 :     return aSeq;
    5960                 :            : }
    5961                 :            : 
    5962                 :          6 : void SAL_CALL ScCellRangeObj::doImport( const uno::Sequence<beans::PropertyValue>& aDescriptor )
    5963                 :            :                                             throw(uno::RuntimeException)
    5964                 :            : {
    5965         [ +  - ]:          6 :     SolarMutexGuard aGuard;
    5966                 :          6 :     ScDocShell* pDocSh = GetDocShell();
    5967         [ +  - ]:          6 :     if (pDocSh)
    5968                 :            :     {
    5969         [ +  - ]:          6 :         ScImportParam aParam;
    5970         [ +  - ]:          6 :         ScImportDescriptor::FillImportParam( aParam, aDescriptor );
    5971                 :            : 
    5972                 :          6 :         SCTAB nTab = aRange.aStart.Tab();
    5973                 :          6 :         aParam.nCol1 = aRange.aStart.Col();
    5974                 :          6 :         aParam.nRow1 = aRange.aStart.Row();
    5975                 :          6 :         aParam.nCol2 = aRange.aEnd.Col();
    5976                 :          6 :         aParam.nRow2 = aRange.aEnd.Row();
    5977                 :            : 
    5978                 :            :         //! TODO: could we get passed a valid result set by any means?
    5979                 :            : 
    5980         [ +  - ]:          6 :         pDocSh->GetDBData( aRange, SC_DB_MAKE, SC_DBSEL_FORCE_MARK );       // ggf. Bereich anlegen
    5981                 :            : 
    5982                 :          6 :         ScDBDocFunc aFunc(*pDocSh);                         // Bereich muss angelegt sein
    5983 [ +  - ][ +  - ]:          6 :         aFunc.DoImport( nTab, aParam, NULL, true );         //! Api-Flag as parameter
    5984         [ +  - ]:          6 :     }
    5985                 :          6 : }
    5986                 :            : 
    5987                 :            : // XCellFormatRangesSupplier
    5988                 :            : 
    5989                 :          4 : uno::Reference<container::XIndexAccess> SAL_CALL ScCellRangeObj::getCellFormatRanges()
    5990                 :            :                                                 throw(uno::RuntimeException)
    5991                 :            : {
    5992         [ +  - ]:          4 :     SolarMutexGuard aGuard;
    5993                 :          4 :     ScDocShell* pDocSh = GetDocShell();
    5994         [ +  - ]:          4 :     if ( pDocSh )
    5995 [ +  - ][ +  - ]:          4 :         return new ScCellFormatsObj( pDocSh, aRange );
                 [ +  - ]
    5996 [ #  # ][ +  - ]:          4 :     return NULL;
    5997                 :            : }
    5998                 :            : 
    5999                 :            : // XUniqueCellFormatRangesSupplier
    6000                 :            : 
    6001                 :          8 : uno::Reference<container::XIndexAccess> SAL_CALL ScCellRangeObj::getUniqueCellFormatRanges()
    6002                 :            :                                                 throw(uno::RuntimeException)
    6003                 :            : {
    6004         [ +  - ]:          8 :     SolarMutexGuard aGuard;
    6005                 :          8 :     ScDocShell* pDocSh = GetDocShell();
    6006         [ +  - ]:          8 :     if ( pDocSh )
    6007 [ +  - ][ +  - ]:          8 :         return new ScUniqueCellFormatsObj( pDocSh, aRange );
                 [ +  - ]
    6008 [ #  # ][ +  - ]:          8 :     return NULL;
    6009                 :            : }
    6010                 :            : 
    6011                 :            : // XPropertySet erweitert fuer Range-Properties
    6012                 :            : 
    6013                 :        405 : uno::Reference<beans::XPropertySetInfo> SAL_CALL ScCellRangeObj::getPropertySetInfo()
    6014                 :            :                                                         throw(uno::RuntimeException)
    6015                 :            : {
    6016         [ +  - ]:        405 :     SolarMutexGuard aGuard;
    6017                 :            :     static uno::Reference<beans::XPropertySetInfo> aRef(
    6018 [ +  + ][ +  - ]:        405 :         new SfxItemPropertySetInfo( pRangePropSet->getPropertyMap() ));
         [ +  - ][ +  - ]
         [ +  - ][ #  # ]
    6019         [ +  - ]:        405 :     return aRef;
    6020                 :            : }
    6021                 :            : 
    6022                 :        624 : void ScCellRangeObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry, const uno::Any& aValue )
    6023                 :            :                                 throw(lang::IllegalArgumentException, uno::RuntimeException)
    6024                 :            : {
    6025                 :            :     //  Range has only Position and Size in addition to ScCellRangesBase, both are ReadOnly
    6026                 :            :     //  -> nothing to do here
    6027                 :            : 
    6028                 :        624 :     ScCellRangesBase::SetOnePropertyValue( pEntry, aValue );
    6029                 :        622 : }
    6030                 :            : 
    6031                 :       3125 : void ScCellRangeObj::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry,
    6032                 :            :                                             uno::Any& rAny )
    6033                 :            :                                                 throw(uno::RuntimeException)
    6034                 :            : {
    6035         [ +  - ]:       3125 :     if ( pEntry )
    6036                 :            :     {
    6037         [ +  + ]:       3125 :         if ( pEntry->nWID == SC_WID_UNO_POS )
    6038                 :            :         {
    6039                 :         91 :             ScDocShell* pDocSh = GetDocShell();
    6040         [ +  - ]:         91 :             if (pDocSh)
    6041                 :            :             {
    6042                 :            :                 //  GetMMRect converts using HMM_PER_TWIPS, like the DrawingLayer
    6043                 :            :                 Rectangle aMMRect(pDocSh->GetDocument()->GetMMRect(
    6044                 :         91 :                                         aRange.aStart.Col(), aRange.aStart.Row(),
    6045         [ +  - ]:        182 :                                         aRange.aEnd.Col(), aRange.aEnd.Row(), aRange.aStart.Tab() ));
    6046                 :         91 :                 awt::Point aPos( aMMRect.Left(), aMMRect.Top() );
    6047         [ +  - ]:         91 :                 rAny <<= aPos;
    6048                 :            :             }
    6049                 :            :         }
    6050         [ +  + ]:       3034 :         else if ( pEntry->nWID == SC_WID_UNO_SIZE )
    6051                 :            :         {
    6052                 :        112 :             ScDocShell* pDocSh = GetDocShell();
    6053         [ +  - ]:        112 :             if (pDocSh)
    6054                 :            :             {
    6055                 :            :                 //  GetMMRect converts using HMM_PER_TWIPS, like the DrawingLayer
    6056                 :            :                 Rectangle aMMRect = pDocSh->GetDocument()->GetMMRect(
    6057                 :        112 :                                         aRange.aStart.Col(), aRange.aStart.Row(),
    6058         [ +  - ]:        224 :                                         aRange.aEnd.Col(), aRange.aEnd.Row(), aRange.aStart.Tab() );
    6059         [ +  - ]:        112 :                 Size aSize(aMMRect.GetSize());
    6060                 :        112 :                 awt::Size aAwtSize( aSize.Width(), aSize.Height() );
    6061         [ +  - ]:        112 :                 rAny <<= aAwtSize;
    6062                 :            :             }
    6063                 :            :         }
    6064                 :            :         else
    6065                 :       2922 :             ScCellRangesBase::GetOnePropertyValue( pEntry, rAny );
    6066                 :            : 
    6067                 :            :     }
    6068                 :       3125 : }
    6069                 :            : 
    6070                 :       2036 : const SfxItemPropertyMap& ScCellRangeObj::GetItemPropertyMap()
    6071                 :            : {
    6072                 :       2036 :     return pRangePropSet->getPropertyMap();
    6073                 :            : }
    6074                 :            : 
    6075                 :            : // XServiceInfo
    6076                 :            : 
    6077                 :          0 : rtl::OUString SAL_CALL ScCellRangeObj::getImplementationName() throw(uno::RuntimeException)
    6078                 :            : {
    6079                 :          0 :     return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ScCellRangeObj" ));
    6080                 :            : }
    6081                 :            : 
    6082                 :          8 : sal_Bool SAL_CALL ScCellRangeObj::supportsService( const rtl::OUString& rServiceName )
    6083                 :            :                                                     throw(uno::RuntimeException)
    6084                 :            : {
    6085         [ +  - ]:          8 :     String aServiceStr( rServiceName );
    6086         [ +  - ]:          8 :     return aServiceStr.EqualsAscii( SCSHEETCELLRANGE_SERVICE ) ||
    6087         [ +  - ]:          6 :            aServiceStr.EqualsAscii( SCCELLRANGE_SERVICE ) ||
    6088         [ +  - ]:          6 :            aServiceStr.EqualsAscii( SCCELLPROPERTIES_SERVICE ) ||
    6089         [ +  - ]:          6 :            aServiceStr.EqualsAscii( SCCHARPROPERTIES_SERVICE ) ||
    6090 [ +  + ][ +  - ]:         26 :            aServiceStr.EqualsAscii( SCPARAPROPERTIES_SERVICE );
         [ +  - ][ +  + ]
         [ +  - ][ -  + ]
                 [ +  - ]
    6091                 :            : }
    6092                 :            : 
    6093                 :          0 : uno::Sequence<rtl::OUString> SAL_CALL ScCellRangeObj::getSupportedServiceNames()
    6094                 :            :                                                     throw(uno::RuntimeException)
    6095                 :            : {
    6096                 :          0 :     uno::Sequence<rtl::OUString> aRet(5);
    6097         [ #  # ]:          0 :     rtl::OUString* pArray = aRet.getArray();
    6098         [ #  # ]:          0 :     pArray[0] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( SCSHEETCELLRANGE_SERVICE ));
    6099         [ #  # ]:          0 :     pArray[1] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( SCCELLRANGE_SERVICE ));
    6100         [ #  # ]:          0 :     pArray[2] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( SCCELLPROPERTIES_SERVICE ));
    6101         [ #  # ]:          0 :     pArray[3] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( SCCHARPROPERTIES_SERVICE ));
    6102         [ #  # ]:          0 :     pArray[4] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( SCPARAPROPERTIES_SERVICE ));
    6103                 :          0 :     return aRet;
    6104                 :            : }
    6105                 :            : 
    6106                 :            : //------------------------------------------------------------------------
    6107                 :            : 
    6108                 :         18 : const SvxItemPropertySet* ScCellObj::GetEditPropertySet()
    6109                 :            : {
    6110                 :         18 :     return lcl_GetEditPropertySet();
    6111                 :            : }
    6112                 :            : 
    6113                 :          0 : const SfxItemPropertyMap& ScCellObj::GetCellPropertyMap()
    6114                 :            : {
    6115                 :          0 :     return lcl_GetCellPropertySet()->getPropertyMap();
    6116                 :            : }
    6117                 :            : 
    6118                 :       3142 : ScCellObj::ScCellObj(ScDocShell* pDocSh, const ScAddress& rP) :
    6119                 :            :     ScCellRangeObj( pDocSh, ScRange(rP,rP) ),
    6120         [ +  - ]:       3142 :     pCellPropSet( lcl_GetCellPropertySet() ),
    6121                 :            :     aCellPos( rP ),
    6122         [ +  - ]:       6284 :     nActionLockCount( 0 )
    6123                 :            : {
    6124                 :            :     //  pUnoText is allocated on demand (GetUnoText)
    6125                 :            :     //  can't be aggregated because getString/setString is handled here
    6126                 :       3142 : }
    6127                 :            : 
    6128                 :         61 : SvxUnoText& ScCellObj::GetUnoText()
    6129                 :            : {
    6130         [ +  + ]:         61 :     if (!mxUnoText.is())
    6131                 :            :     {
    6132 [ +  - ][ +  - ]:         18 :         mxUnoText.set(new ScCellTextObj(GetDocShell(), aCellPos));
    6133         [ +  + ]:         18 :         if (nActionLockCount)
    6134                 :            :         {
    6135                 :            :             ScCellEditSource* pEditSource =
    6136                 :          6 :                 static_cast<ScCellEditSource*> (mxUnoText->GetEditSource());
    6137         [ +  - ]:          6 :             if (pEditSource)
    6138                 :          6 :                 pEditSource->SetDoUpdateData(false);
    6139                 :            :         }
    6140                 :            :     }
    6141                 :         61 :     return *mxUnoText;
    6142                 :            : }
    6143                 :            : 
    6144                 :       3126 : ScCellObj::~ScCellObj()
    6145                 :            : {
    6146         [ -  + ]:       6252 : }
    6147                 :            : 
    6148                 :       1543 : void ScCellObj::RefChanged()
    6149                 :            : {
    6150                 :       1543 :     ScCellRangeObj::RefChanged();
    6151                 :            : 
    6152                 :       1543 :     const ScRangeList& rRanges = GetRangeList();
    6153                 :            :     OSL_ENSURE(rRanges.size() == 1, "was fuer Ranges ?!?!");
    6154         [ +  - ]:       1543 :     if ( !rRanges.empty() )
    6155                 :            :     {
    6156                 :       1543 :         const ScRange* pFirst = rRanges[ 0 ];
    6157                 :       1543 :         aCellPos = pFirst->aStart;
    6158                 :            :     }
    6159                 :       1543 : }
    6160                 :            : 
    6161                 :       6595 : uno::Any SAL_CALL ScCellObj::queryInterface( const uno::Type& rType ) throw(uno::RuntimeException)
    6162                 :            : {
    6163 [ +  + ][ +  - ]:       6595 :     SC_QUERYINTERFACE( table::XCell )
    6164 [ -  + ][ #  # ]:       6587 :     SC_QUERYINTERFACE( table::XCell2 )
    6165 [ -  + ][ #  # ]:       6587 :     SC_QUERYINTERFACE( sheet::XFormulaTokens )
    6166 [ +  + ][ +  - ]:       6587 :     SC_QUERYINTERFACE( sheet::XCellAddressable )
    6167 [ +  + ][ +  - ]:       6418 :     SC_QUERYINTERFACE( text::XText )
    6168 [ +  + ][ +  - ]:       6401 :     SC_QUERYINTERFACE( text::XSimpleText )
    6169 [ +  + ][ +  - ]:       6310 :     SC_QUERYINTERFACE( text::XTextRange )
    6170 [ +  + ][ +  - ]:       6244 :     SC_QUERYINTERFACE( container::XEnumerationAccess )
    6171 [ +  + ][ +  - ]:       6241 :     SC_QUERYINTERFACE( container::XElementAccess )
    6172 [ +  + ][ +  - ]:       6238 :     SC_QUERYINTERFACE( sheet::XSheetAnnotationAnchor )
    6173 [ +  + ][ +  - ]:       6230 :     SC_QUERYINTERFACE( text::XTextFieldsSupplier )
    6174 [ +  + ][ +  - ]:       6227 :     SC_QUERYINTERFACE( document::XActionLockable )
    6175                 :            : 
    6176                 :       6595 :     return ScCellRangeObj::queryInterface( rType );
    6177                 :            : }
    6178                 :            : 
    6179                 :      19648 : void SAL_CALL ScCellObj::acquire() throw()
    6180                 :            : {
    6181                 :      19648 :     ScCellRangeObj::acquire();
    6182                 :      19648 : }
    6183                 :            : 
    6184                 :      19632 : void SAL_CALL ScCellObj::release() throw()
    6185                 :            : {
    6186                 :      19632 :     ScCellRangeObj::release();
    6187                 :      19632 : }
    6188                 :            : 
    6189                 :          2 : uno::Sequence<uno::Type> SAL_CALL ScCellObj::getTypes() throw(uno::RuntimeException)
    6190                 :            : {
    6191 [ +  - ][ +  - ]:          2 :     static uno::Sequence<uno::Type> aTypes;
         [ +  - ][ #  # ]
    6192         [ +  - ]:          2 :     if ( aTypes.getLength() == 0 )
    6193                 :            :     {
    6194         [ +  - ]:          2 :         uno::Sequence<uno::Type> aParentTypes(ScCellRangeObj::getTypes());
    6195                 :          2 :         long nParentLen = aParentTypes.getLength();
    6196                 :          2 :         const uno::Type* pParentPtr = aParentTypes.getConstArray();
    6197                 :            : 
    6198         [ +  - ]:          2 :         aTypes.realloc( nParentLen + 9 );
    6199         [ +  - ]:          2 :         uno::Type* pPtr = aTypes.getArray();
    6200         [ +  - ]:          2 :         pPtr[nParentLen + 0] = getCppuType((const uno::Reference<table::XCell>*)0);
    6201         [ +  - ]:          2 :         pPtr[nParentLen + 1] = getCppuType((const uno::Reference<sheet::XCellAddressable>*)0);
    6202         [ +  - ]:          2 :         pPtr[nParentLen + 2] = getCppuType((const uno::Reference<text::XText>*)0);
    6203         [ +  - ]:          2 :         pPtr[nParentLen + 3] = getCppuType((const uno::Reference<container::XEnumerationAccess>*)0);
    6204         [ +  - ]:          2 :         pPtr[nParentLen + 4] = getCppuType((const uno::Reference<sheet::XSheetAnnotationAnchor>*)0);
    6205         [ +  - ]:          2 :         pPtr[nParentLen + 5] = getCppuType((const uno::Reference<text::XTextFieldsSupplier>*)0);
    6206         [ +  - ]:          2 :         pPtr[nParentLen + 6] = getCppuType((const uno::Reference<document::XActionLockable>*)0);
    6207         [ +  - ]:          2 :         pPtr[nParentLen + 7] = getCppuType((const uno::Reference<sheet::XFormulaTokens>*)0);
    6208         [ +  - ]:          2 :         pPtr[nParentLen + 8] = getCppuType((const uno::Reference<table::XCell2>*)0);
    6209                 :            : 
    6210         [ +  + ]:         62 :         for (long i=0; i<nParentLen; i++)
    6211         [ +  - ]:         62 :             pPtr[i] = pParentPtr[i];                // parent types first
    6212                 :            :     }
    6213                 :          2 :     return aTypes;
    6214                 :            : }
    6215                 :            : 
    6216                 :            : namespace
    6217                 :            : {
    6218                 :            :     class theScCellObjImplementationId : public rtl::Static< UnoTunnelIdInit, theScCellObjImplementationId > {};
    6219                 :            : }
    6220                 :            : 
    6221                 :          2 : uno::Sequence<sal_Int8> SAL_CALL ScCellObj::getImplementationId() throw(uno::RuntimeException)
    6222                 :            : {
    6223                 :          2 :     return theScCellObjImplementationId::get().getSeq();
    6224                 :            : }
    6225                 :            : 
    6226                 :            : //  Hilfsfunktionen
    6227                 :            : 
    6228                 :         62 : String ScCellObj::GetInputString_Impl(sal_Bool bEnglish) const      // fuer getFormula / FormulaLocal
    6229                 :            : {
    6230         [ +  - ]:         62 :     if (GetDocShell())
    6231                 :         62 :         return lcl_GetInputString( GetDocShell()->GetDocument(), aCellPos, bEnglish );
    6232                 :         62 :     return String();
    6233                 :            : }
    6234                 :            : 
    6235                 :        139 : String ScCellObj::GetOutputString_Impl(ScDocument* pDoc, const ScAddress& aCellPos)
    6236                 :            : {
    6237                 :        139 :     rtl::OUString aVal;
    6238         [ +  - ]:        139 :     if ( pDoc )
    6239                 :            :     {
    6240         [ +  - ]:        139 :         ScBaseCell* pCell = pDoc->GetCell( aCellPos );
    6241 [ +  + ][ +  - ]:        139 :         if ( pCell && pCell->GetCellType() != CELLTYPE_NOTE )
                 [ +  + ]
    6242                 :            :         {
    6243         [ +  + ]:        105 :             if ( pCell->GetCellType() == CELLTYPE_EDIT )
    6244                 :            :             {
    6245                 :            :                 //  GetString an der EditCell macht Leerzeichen aus Umbruechen,
    6246                 :            :                 //  hier werden die Umbrueche aber gebraucht
    6247                 :          1 :                 const EditTextObject* pData = ((ScEditCell*)pCell)->GetData();
    6248         [ +  - ]:          1 :                 if (pData)
    6249                 :            :                 {
    6250         [ +  - ]:          1 :                     EditEngine& rEngine = pDoc->GetEditEngine();
    6251         [ +  - ]:          1 :                     rEngine.SetText( *pData );
    6252 [ +  - ][ +  - ]:          1 :                     aVal = rEngine.GetText( LINEEND_LF );
                 [ +  - ]
    6253                 :            :                 }
    6254                 :            :                 //  Edit-Zellen auch nicht per NumberFormatter formatieren
    6255                 :            :                 //  (passend zur Ausgabe)
    6256                 :            :             }
    6257                 :            :             else
    6258                 :            :             {
    6259                 :            :                 //  wie in GetString am Dokument (column)
    6260                 :            :                 Color* pColor;
    6261         [ +  - ]:        104 :                 sal_uLong nNumFmt = pDoc->GetNumberFormat( aCellPos );
    6262 [ +  - ][ +  - ]:        104 :                 ScCellFormat::GetString( pCell, nNumFmt, aVal, &pColor, *pDoc->GetFormatTable() );
    6263                 :            :             }
    6264                 :            :         }
    6265                 :            :     }
    6266         [ +  - ]:        139 :     return aVal;
    6267                 :            : }
    6268                 :            : 
    6269                 :        139 : String ScCellObj::GetOutputString_Impl() const
    6270                 :            : {
    6271                 :        139 :     ScDocShell* pDocSh = GetDocShell();
    6272                 :        139 :     String aVal;
    6273         [ +  - ]:        139 :     if ( pDocSh )
    6274 [ +  - ][ +  - ]:        139 :         aVal = GetOutputString_Impl(pDocSh->GetDocument(), aCellPos);
                 [ +  - ]
    6275                 :        139 :     return aVal;
    6276                 :            : }
    6277                 :            : 
    6278                 :        971 : void ScCellObj::SetString_Impl(const String& rString, sal_Bool bInterpret, sal_Bool bEnglish)
    6279                 :            : {
    6280                 :        971 :     ScDocShell* pDocSh = GetDocShell();
    6281         [ +  - ]:        971 :     if ( pDocSh )
    6282                 :            :     {
    6283                 :            :         // GRAM_PODF_A1 for API compatibility.
    6284                 :        971 :         (void)pDocSh->GetDocFunc().SetCellText( aCellPos, rString, bInterpret, bEnglish,
    6285                 :        971 :                                                    sal_True, EMPTY_STRING, formula::FormulaGrammar::GRAM_PODF_A1 );
    6286                 :            :     }
    6287                 :        971 : }
    6288                 :            : 
    6289                 :        107 : double ScCellObj::GetValue_Impl() const
    6290                 :            : {
    6291                 :        107 :     ScDocShell* pDocSh = GetDocShell();
    6292         [ +  - ]:        107 :     if ( pDocSh )
    6293                 :        107 :         return pDocSh->GetDocument()->GetValue( aCellPos );
    6294                 :            : 
    6295                 :        107 :     return 0.0;
    6296                 :            : }
    6297                 :            : 
    6298                 :       1509 : void ScCellObj::SetValue_Impl(double fValue)
    6299                 :            : {
    6300                 :       1509 :     ScDocShell* pDocSh = GetDocShell();
    6301         [ +  - ]:       1509 :     if ( pDocSh )
    6302         [ +  - ]:       1509 :         (void)pDocSh->GetDocFunc().PutCell( aCellPos, new ScValueCell(fValue), sal_True );
    6303                 :       1509 : }
    6304                 :            : 
    6305                 :            : // only for XML import
    6306                 :            : 
    6307                 :          2 : void ScCellObj::InputEnglishString( const ::rtl::OUString& rText )
    6308                 :            : {
    6309                 :            :     // This is like a mixture of setFormula and property FormulaLocal:
    6310                 :            :     // The cell's number format is checked for "text", a new cell format may be set,
    6311                 :            :     // but all parsing is in English.
    6312                 :            : 
    6313                 :          2 :     ScDocShell* pDocSh = GetDocShell();
    6314         [ +  - ]:          2 :     if ( pDocSh )
    6315                 :            :     {
    6316         [ +  - ]:          2 :         String aString(rText);
    6317                 :          2 :         ScDocument* pDoc = pDocSh->GetDocument();
    6318         [ +  - ]:          2 :         SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
    6319         [ +  - ]:          2 :         sal_uInt32 nOldFormat = pDoc->GetNumberFormat( aCellPos );
    6320 [ +  - ][ -  + ]:          2 :         if ( pFormatter->GetType( nOldFormat ) == NUMBERFORMAT_TEXT )
    6321                 :            :         {
    6322         [ #  # ]:          0 :             SetString_Impl(aString, false, false);      // text cell
    6323                 :            :         }
    6324                 :            :         else
    6325                 :            :         {
    6326                 :          2 :             ScDocFunc &rFunc = pDocSh->GetDocFunc();
    6327                 :          2 :             short nFormatType = 0;
    6328                 :            :             ScBaseCell* pNewCell = rFunc.InterpretEnglishString( aCellPos, aString,
    6329 [ +  - ][ +  - ]:          2 :                                     EMPTY_STRING, formula::FormulaGrammar::GRAM_PODF_A1, &nFormatType );
    6330         [ +  - ]:          2 :             if (pNewCell)
    6331                 :            :             {
    6332 [ +  - ][ -  + ]:          2 :                 if ( ( nOldFormat % SV_COUNTRY_LANGUAGE_OFFSET ) == 0 && nFormatType != 0 )
    6333                 :            :                 {
    6334                 :            :                     // apply a format for the recognized type and the old format's language
    6335         [ #  # ]:          0 :                     sal_uInt32 nNewFormat = ScGlobal::GetStandardFormat( *pFormatter, nOldFormat, nFormatType );
    6336         [ #  # ]:          0 :                     if ( nNewFormat != nOldFormat )
    6337                 :            :                     {
    6338 [ #  # ][ #  # ]:          0 :                         ScPatternAttr aPattern( pDoc->GetPool() );
    6339 [ #  # ][ #  # ]:          0 :                         aPattern.GetItemSet().Put( SfxUInt32Item( ATTR_VALUE_FORMAT, nNewFormat ) );
                 [ #  # ]
    6340                 :            :                         // ATTR_LANGUAGE_FORMAT remains unchanged
    6341 [ #  # ][ #  # ]:          0 :                         rFunc.ApplyAttributes( *GetMarkData(), aPattern, sal_True, sal_True );
                 [ #  # ]
    6342                 :            :                     }
    6343                 :            :                 }
    6344                 :            :                 // put the cell into the document
    6345                 :            :                 // (after applying the format, so possible formula recalculation already uses the new format)
    6346         [ +  - ]:          2 :                 (void)rFunc.PutCell( aCellPos, pNewCell, sal_True );
    6347                 :            :             }
    6348                 :            :             else
    6349         [ #  # ]:          2 :                 SetString_Impl(aString, false, false);      // no cell from InterpretEnglishString, probably empty string
    6350         [ +  - ]:          2 :         }
    6351                 :            :     }
    6352                 :          2 : }
    6353                 :            : 
    6354                 :            : //  XText
    6355                 :            : 
    6356                 :         20 : uno::Reference<text::XTextCursor> SAL_CALL ScCellObj::createTextCursor()
    6357                 :            :                                                     throw(uno::RuntimeException)
    6358                 :            : {
    6359         [ +  - ]:         20 :     SolarMutexGuard aGuard;
    6360 [ +  - ][ +  - ]:         20 :     return new ScCellTextCursor( *this );
         [ +  - ][ +  - ]
    6361                 :            : }
    6362                 :            : 
    6363                 :          7 : uno::Reference<text::XTextCursor> SAL_CALL ScCellObj::createTextCursorByRange(
    6364                 :            :                                     const uno::Reference<text::XTextRange>& aTextPosition )
    6365                 :            :                                                     throw(uno::RuntimeException)
    6366                 :            : {
    6367         [ +  - ]:          7 :     SolarMutexGuard aGuard;
    6368         [ +  - ]:          7 :     SvxUnoTextCursor* pCursor = new ScCellTextCursor( *this );
    6369 [ +  - ][ +  - ]:          7 :     uno::Reference<text::XTextCursor> xCursor(pCursor);
    6370                 :            : 
    6371         [ +  - ]:          7 :     SvxUnoTextRangeBase* pRange = SvxUnoTextRangeBase::getImplementation( aTextPosition );
    6372         [ +  - ]:          7 :     if(pRange)
    6373                 :          7 :         pCursor->SetSelection( pRange->GetSelection() );
    6374                 :            :     else
    6375                 :            :     {
    6376         [ #  # ]:          0 :         ScCellTextCursor* pOther = ScCellTextCursor::getImplementation( aTextPosition );
    6377         [ #  # ]:          0 :         if(pOther)
    6378                 :          0 :             pCursor->SetSelection( pOther->GetSelection() );
    6379                 :            :         else
    6380         [ #  # ]:          0 :             throw uno::RuntimeException();
    6381                 :            :     }
    6382                 :            : 
    6383         [ +  - ]:          7 :     return xCursor;
    6384                 :            : }
    6385                 :            : 
    6386                 :        139 : rtl::OUString SAL_CALL ScCellObj::getString() throw(uno::RuntimeException)
    6387                 :            : {
    6388         [ +  - ]:        139 :     SolarMutexGuard aGuard;
    6389 [ +  - ][ +  - ]:        139 :     return GetOutputString_Impl();
         [ +  - ][ +  - ]
    6390                 :            : }
    6391                 :            : 
    6392                 :         34 : void SAL_CALL ScCellObj::setString( const rtl::OUString& aText ) throw(uno::RuntimeException)
    6393                 :            : {
    6394         [ +  - ]:         34 :     SolarMutexGuard aGuard;
    6395         [ +  - ]:         34 :     String aString(aText);
    6396         [ +  - ]:         34 :     SetString_Impl(aString, false, false);  // immer Text
    6397                 :            : 
    6398                 :            :     // don't create pUnoText here if not there
    6399         [ +  + ]:         34 :     if (mxUnoText.is())
    6400 [ +  - ][ +  - ]:         34 :         mxUnoText->SetSelection(ESelection( 0,0, 0,aString.Len() ));
    6401                 :         34 : }
    6402                 :            : 
    6403                 :         17 : void SAL_CALL ScCellObj::insertString( const uno::Reference<text::XTextRange>& xRange,
    6404                 :            :                                         const rtl::OUString& aString, sal_Bool bAbsorb )
    6405                 :            :                                     throw(uno::RuntimeException)
    6406                 :            : {
    6407                 :            :     // special handling for ScCellTextCursor is no longer needed,
    6408                 :            :     // SvxUnoText::insertString checks for SvxUnoTextRangeBase instead of SvxUnoTextRange
    6409                 :            : 
    6410         [ +  - ]:         17 :     SolarMutexGuard aGuard;
    6411 [ +  - ][ +  - ]:         17 :     GetUnoText().insertString(xRange, aString, bAbsorb);
                 [ +  - ]
    6412                 :         17 : }
    6413                 :            : 
    6414                 :         11 : void SAL_CALL ScCellObj::insertControlCharacter( const uno::Reference<text::XTextRange>& xRange,
    6415                 :            :                                                 sal_Int16 nControlCharacter, sal_Bool bAbsorb )
    6416                 :            :                                     throw(lang::IllegalArgumentException, uno::RuntimeException)
    6417                 :            : {
    6418         [ +  - ]:         11 :     SolarMutexGuard aGuard;
    6419 [ +  - ][ +  - ]:         11 :     GetUnoText().insertControlCharacter(xRange, nControlCharacter, bAbsorb);
                 [ +  - ]
    6420                 :         11 : }
    6421                 :            : 
    6422                 :          9 : void SAL_CALL ScCellObj::insertTextContent( const uno::Reference<text::XTextRange >& xRange,
    6423                 :            :                                                 const uno::Reference<text::XTextContent >& xContent,
    6424                 :            :                                                 sal_Bool bAbsorb )
    6425                 :            :                                     throw(lang::IllegalArgumentException, uno::RuntimeException)
    6426                 :            : {
    6427         [ +  - ]:          9 :     SolarMutexGuard aGuard;
    6428                 :          9 :     ScDocShell* pDocSh = GetDocShell();
    6429 [ +  + ][ +  + ]:          9 :     if ( pDocSh && xContent.is() )
                 [ +  - ]
    6430                 :            :     {
    6431         [ +  - ]:          8 :         ScEditFieldObj* pCellField = ScEditFieldObj::getImplementation(xContent);
    6432         [ +  - ]:          8 :         SvxUnoTextRangeBase* pTextRange = ScCellTextCursor::getImplementation( xRange );
    6433                 :            : 
    6434 [ +  - ][ +  - ]:          8 :         if ( pCellField && !pCellField->IsInserted() && pTextRange )
         [ +  - ][ +  - ]
                 [ +  - ]
    6435                 :            :         {
    6436                 :          8 :             SvxEditSource* pEditSource = pTextRange->GetEditSource();
    6437                 :          8 :             ESelection aSelection(pTextRange->GetSelection());
    6438                 :            : 
    6439         [ +  + ]:          8 :             if (!bAbsorb)
    6440                 :            :             {
    6441                 :            :                 //  nicht ersetzen -> hinten anhaengen
    6442                 :          3 :                 aSelection.Adjust();
    6443                 :          3 :                 aSelection.nStartPara = aSelection.nEndPara;
    6444                 :          3 :                 aSelection.nStartPos  = aSelection.nEndPos;
    6445                 :            :             }
    6446                 :            : 
    6447 [ +  - ][ -  + ]:          8 :             if (pCellField->GetFieldType() == text::textfield::Type::TABLE)
    6448 [ #  # ][ #  # ]:          0 :                 pCellField->setPropertyValue(SC_UNONAME_TABLEPOS, uno::makeAny<sal_Int32>(aCellPos.Tab()));
    6449                 :            : 
    6450         [ +  - ]:          8 :             SvxFieldItem aItem = pCellField->CreateFieldItem();
    6451         [ +  - ]:          8 :             SvxTextForwarder* pForwarder = pEditSource->GetTextForwarder();
    6452         [ +  - ]:          8 :             pForwarder->QuickInsertField( aItem, aSelection );
    6453         [ +  - ]:          8 :             pEditSource->UpdateData();
    6454                 :            : 
    6455                 :            :             //  neue Selektion: ein Zeichen
    6456                 :          8 :             aSelection.Adjust();
    6457                 :          8 :             aSelection.nEndPara = aSelection.nStartPara;
    6458                 :          8 :             aSelection.nEndPos = aSelection.nStartPos + 1;
    6459         [ +  - ]:          8 :             uno::Reference<text::XTextRange> xParent(this);
    6460                 :            :             pCellField->InitDoc(
    6461 [ +  - ][ +  - ]:          8 :                 xParent, new ScCellEditSource(pDocSh, aCellPos), aSelection);
                 [ +  - ]
    6462                 :            : 
    6463                 :            :             //  for bAbsorb=FALSE, the new selection must be behind the inserted content
    6464                 :            :             //  (the xml filter relies on this)
    6465         [ +  + ]:          8 :             if (!bAbsorb)
    6466                 :          3 :                 aSelection.nStartPos = aSelection.nEndPos;
    6467                 :            : 
    6468                 :          8 :             pTextRange->SetSelection( aSelection );
    6469                 :            : 
    6470         [ +  - ]:         16 :             return;
    6471                 :            :         }
    6472                 :            :     }
    6473 [ +  - ][ -  + ]:          9 :     GetUnoText().insertTextContent(xRange, xContent, bAbsorb);
         [ +  - ][ -  + ]
    6474                 :            : }
    6475                 :            : 
    6476                 :          1 : void SAL_CALL ScCellObj::removeTextContent( const uno::Reference<text::XTextContent>& xContent )
    6477                 :            :                                 throw(container::NoSuchElementException, uno::RuntimeException)
    6478                 :            : {
    6479         [ +  - ]:          1 :     SolarMutexGuard aGuard;
    6480         [ +  - ]:          1 :     if ( xContent.is() )
    6481                 :            :     {
    6482         [ +  - ]:          1 :         ScEditFieldObj* pCellField = ScEditFieldObj::getImplementation(xContent);
    6483 [ +  - ][ +  - ]:          1 :         if ( pCellField && pCellField->IsInserted() )
         [ +  - ][ +  - ]
    6484                 :            :         {
    6485                 :            :             //! Testen, ob das Feld in dieser Zelle ist
    6486         [ +  - ]:          1 :             pCellField->DeleteField();
    6487                 :          1 :             return;
    6488                 :            :         }
    6489                 :            :     }
    6490 [ #  # ][ #  # ]:          1 :     GetUnoText().removeTextContent(xContent);
         [ +  - ][ -  + ]
    6491                 :            : }
    6492                 :            : 
    6493                 :          4 : uno::Reference<text::XText> SAL_CALL ScCellObj::getText() throw(uno::RuntimeException)
    6494                 :            : {
    6495         [ +  - ]:          4 :     SolarMutexGuard aGuard;
    6496 [ +  - ][ +  - ]:          4 :     return this;
    6497                 :            : }
    6498                 :            : 
    6499                 :          1 : uno::Reference<text::XTextRange> SAL_CALL ScCellObj::getStart() throw(uno::RuntimeException)
    6500                 :            : {
    6501         [ +  - ]:          1 :     SolarMutexGuard aGuard;
    6502 [ +  - ][ +  - ]:          1 :     return GetUnoText().getStart();
                 [ +  - ]
    6503                 :            : }
    6504                 :            : 
    6505                 :          1 : uno::Reference<text::XTextRange> SAL_CALL ScCellObj::getEnd() throw(uno::RuntimeException)
    6506                 :            : {
    6507         [ +  - ]:          1 :     SolarMutexGuard aGuard;
    6508 [ +  - ][ +  - ]:          1 :     return GetUnoText().getEnd();
                 [ +  - ]
    6509                 :            : }
    6510                 :            : 
    6511                 :          1 : uno::Reference<container::XEnumeration> SAL_CALL ScCellObj::createEnumeration()
    6512                 :            :                                                     throw(uno::RuntimeException)
    6513                 :            : {
    6514         [ +  - ]:          1 :     SolarMutexGuard aGuard;
    6515 [ +  - ][ +  - ]:          1 :     return GetUnoText().createEnumeration();
                 [ +  - ]
    6516                 :            : }
    6517                 :            : 
    6518                 :          1 : uno::Type SAL_CALL ScCellObj::getElementType() throw(uno::RuntimeException)
    6519                 :            : {
    6520         [ +  - ]:          1 :     SolarMutexGuard aGuard;
    6521 [ +  - ][ +  - ]:          1 :     return GetUnoText().getElementType();
                 [ +  - ]
    6522                 :            : }
    6523                 :            : 
    6524                 :          1 : sal_Bool SAL_CALL ScCellObj::hasElements() throw(uno::RuntimeException)
    6525                 :            : {
    6526         [ +  - ]:          1 :     SolarMutexGuard aGuard;
    6527 [ +  - ][ +  - ]:          1 :     return GetUnoText().hasElements();
                 [ +  - ]
    6528                 :            : }
    6529                 :            : 
    6530                 :            : //  XCell
    6531                 :            : 
    6532                 :         52 : rtl::OUString SAL_CALL ScCellObj::getFormula() throw(uno::RuntimeException)
    6533                 :            : {
    6534         [ +  - ]:         52 :     SolarMutexGuard aGuard;
    6535                 :            :     //  TRUE = englisch
    6536 [ +  - ][ +  - ]:         52 :     return GetInputString_Impl(true);
         [ +  - ][ +  - ]
    6537                 :            : }
    6538                 :            : 
    6539                 :        935 : void SAL_CALL ScCellObj::setFormula( const rtl::OUString& aFormula ) throw(uno::RuntimeException)
    6540                 :            : {
    6541         [ +  - ]:        935 :     SolarMutexGuard aGuard;
    6542         [ +  - ]:        935 :     String aString(aFormula);
    6543 [ +  - ][ +  - ]:        935 :     SetString_Impl(aString, sal_True, sal_True);    // englisch interpretieren
                 [ +  - ]
    6544                 :        935 : }
    6545                 :            : 
    6546                 :        107 : double SAL_CALL ScCellObj::getValue() throw(uno::RuntimeException)
    6547                 :            : {
    6548         [ +  - ]:        107 :     SolarMutexGuard aGuard;
    6549 [ +  - ][ +  - ]:        107 :     return GetValue_Impl();
    6550                 :            : }
    6551                 :            : 
    6552                 :       1509 : void SAL_CALL ScCellObj::setValue( double nValue ) throw(uno::RuntimeException)
    6553                 :            : {
    6554         [ +  - ]:       1509 :     SolarMutexGuard aGuard;
    6555 [ +  - ][ +  - ]:       1509 :     SetValue_Impl(nValue);
    6556                 :       1509 : }
    6557                 :            : 
    6558                 :          0 : void SAL_CALL ScCellObj::setFormulaString( const rtl::OUString& aFormula) throw(uno::RuntimeException)
    6559                 :            : {
    6560         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    6561                 :          0 :     ScDocShell *pDocSh = GetDocShell();
    6562         [ #  # ]:          0 :     if( pDocSh )
    6563                 :            :     {
    6564 [ #  # ][ #  # ]:          0 :         ScFormulaCell* pCell = new ScFormulaCell( pDocSh->GetDocument(), aCellPos );
    6565         [ #  # ]:          0 :         pCell->SetHybridFormula( aFormula, formula::FormulaGrammar::GRAM_NATIVE );
    6566 [ #  # ][ #  # ]:          0 :         pDocSh->GetDocFunc().PutCell( aCellPos, pCell, sal_True );
    6567         [ #  # ]:          0 :     }
    6568                 :          0 : }
    6569                 :          0 : void SAL_CALL ScCellObj::setFormulaResult( double nValue ) throw(uno::RuntimeException)
    6570                 :            : {
    6571         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    6572                 :          0 :     ScDocShell* pDocSh = GetDocShell();
    6573 [ #  # ][ #  # ]:          0 :     if ( pDocSh && pDocSh->GetDocument()->GetCellType( aCellPos ) == CELLTYPE_FORMULA )
         [ #  # ][ #  # ]
    6574                 :            :     {
    6575 [ #  # ][ #  # ]:          0 :         ScFormulaCell* pCell = (ScFormulaCell *)pDocSh->GetDocument()->GetCell( aCellPos );
    6576         [ #  # ]:          0 :         pCell->SetHybridDouble( nValue );
    6577                 :          0 :         pCell->ResetDirty();
    6578         [ #  # ]:          0 :         pCell->ResetChanged();
    6579         [ #  # ]:          0 :     }
    6580                 :          0 : }
    6581                 :            : 
    6582                 :         17 : table::CellContentType SAL_CALL ScCellObj::getType() throw(uno::RuntimeException)
    6583                 :            : {
    6584         [ +  - ]:         17 :     SolarMutexGuard aGuard;
    6585                 :         17 :     table::CellContentType eRet = table::CellContentType_EMPTY;
    6586                 :         17 :     ScDocShell* pDocSh = GetDocShell();
    6587         [ +  - ]:         17 :     if (pDocSh)
    6588                 :            :     {
    6589         [ +  - ]:         17 :         CellType eCalcType = pDocSh->GetDocument()->GetCellType( aCellPos );
    6590   [ +  +  -  - ]:         17 :         switch (eCalcType)
    6591                 :            :         {
    6592                 :            :             case CELLTYPE_VALUE:
    6593                 :          7 :                 eRet = table::CellContentType_VALUE;
    6594                 :          7 :                 break;
    6595                 :            :             case CELLTYPE_STRING:
    6596                 :            :             case CELLTYPE_EDIT:
    6597                 :         10 :                 eRet = table::CellContentType_TEXT;
    6598                 :         10 :                 break;
    6599                 :            :             case CELLTYPE_FORMULA:
    6600                 :          0 :                 eRet = table::CellContentType_FORMULA;
    6601                 :          0 :                 break;
    6602                 :            :             default:
    6603                 :         17 :                 eRet = table::CellContentType_EMPTY;
    6604                 :            :         }
    6605                 :            :     }
    6606                 :            :     else
    6607                 :            :     {
    6608                 :            :         OSL_FAIL("keine DocShell");     //! Exception oder so?
    6609                 :            :     }
    6610                 :            : 
    6611         [ +  - ]:         17 :     return eRet;
    6612                 :            : }
    6613                 :            : 
    6614                 :         10 : table::CellContentType ScCellObj::GetResultType_Impl()
    6615                 :            : {
    6616                 :         10 :     ScDocShell* pDocSh = GetDocShell();
    6617         [ +  - ]:         10 :     if ( pDocSh )
    6618                 :            :     {
    6619                 :         10 :         ScBaseCell* pCell = pDocSh->GetDocument()->GetCell(aCellPos);
    6620 [ -  + ][ -  + ]:         10 :         if ( pCell && pCell->GetCellType() == CELLTYPE_FORMULA )
                 [ +  - ]
    6621                 :            :         {
    6622         [ #  # ]:          0 :             sal_Bool bValue = ((ScFormulaCell*)pCell)->IsValue();
    6623         [ #  # ]:          0 :             return bValue ? table::CellContentType_VALUE : table::CellContentType_TEXT;
    6624                 :            :         }
    6625                 :            :     }
    6626                 :         10 :     return getType();   // wenn keine Formel
    6627                 :            : }
    6628                 :            : 
    6629                 :          2 : sal_Int32 SAL_CALL ScCellObj::getError() throw(uno::RuntimeException)
    6630                 :            : {
    6631         [ +  - ]:          2 :     SolarMutexGuard aGuard;
    6632                 :          2 :     sal_uInt16 nError = 0;
    6633                 :          2 :     ScDocShell* pDocSh = GetDocShell();
    6634         [ +  - ]:          2 :     if (pDocSh)
    6635                 :            :     {
    6636         [ +  - ]:          2 :         ScBaseCell* pCell = pDocSh->GetDocument()->GetCell( aCellPos );
    6637 [ +  - ][ +  + ]:          2 :         if ( pCell && pCell->GetCellType() == CELLTYPE_FORMULA )
                 [ +  + ]
    6638 [ +  - ][ +  - ]:          1 :             nError = ((ScFormulaCell*)pCell)->GetErrCode();
    6639                 :            :         // sonst bleibt's bei 0
    6640                 :            :     }
    6641                 :            :     else
    6642                 :            :     {
    6643                 :            :         OSL_FAIL("keine DocShell");     //! Exception oder so?
    6644                 :            :     }
    6645                 :            : 
    6646         [ +  - ]:          2 :     return nError;
    6647                 :            : }
    6648                 :            : 
    6649                 :            : // XFormulaTokens
    6650                 :            : 
    6651                 :          0 : uno::Sequence<sheet::FormulaToken> SAL_CALL ScCellObj::getTokens() throw(uno::RuntimeException)
    6652                 :            : {
    6653         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    6654         [ #  # ]:          0 :     uno::Sequence<sheet::FormulaToken> aSequence;
    6655                 :          0 :     ScDocShell* pDocSh = GetDocShell();
    6656         [ #  # ]:          0 :     if ( pDocSh )
    6657                 :            :     {
    6658                 :          0 :         ScDocument* pDoc = pDocSh->GetDocument();
    6659         [ #  # ]:          0 :         ScBaseCell* pCell = pDoc->GetCell( aCellPos );
    6660 [ #  # ][ #  # ]:          0 :         if ( pCell && pCell->GetCellType() == CELLTYPE_FORMULA )
                 [ #  # ]
    6661                 :            :         {
    6662         [ #  # ]:          0 :             ScTokenArray* pTokenArray = static_cast<ScFormulaCell*>(pCell)->GetCode();
    6663         [ #  # ]:          0 :             if ( pTokenArray )
    6664         [ #  # ]:          0 :                 (void)ScTokenConversion::ConvertToTokenSequence( *pDoc, aSequence, *pTokenArray );
    6665                 :            :         }
    6666                 :            :     }
    6667         [ #  # ]:          0 :     return aSequence;
    6668                 :            : }
    6669                 :            : 
    6670                 :          0 : void SAL_CALL ScCellObj::setTokens( const uno::Sequence<sheet::FormulaToken>& rTokens ) throw(uno::RuntimeException)
    6671                 :            : {
    6672         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    6673                 :          0 :     ScDocShell* pDocSh = GetDocShell();
    6674         [ #  # ]:          0 :     if ( pDocSh )
    6675                 :            :     {
    6676                 :          0 :         ScDocument* pDoc = pDocSh->GetDocument();
    6677         [ #  # ]:          0 :         ScTokenArray aTokenArray;
    6678         [ #  # ]:          0 :         (void)ScTokenConversion::ConvertToTokenArray( *pDoc, aTokenArray, rTokens );
    6679                 :            : 
    6680 [ #  # ][ #  # ]:          0 :         ScBaseCell* pNewCell = new ScFormulaCell( pDoc, aCellPos, &aTokenArray );
                 [ #  # ]
    6681 [ #  # ][ #  # ]:          0 :         (void)pDocSh->GetDocFunc().PutCell( aCellPos, pNewCell, sal_True );
    6682         [ #  # ]:          0 :     }
    6683                 :          0 : }
    6684                 :            : 
    6685                 :            : // XCellAddressable
    6686                 :            : 
    6687                 :        165 : table::CellAddress SAL_CALL ScCellObj::getCellAddress() throw(uno::RuntimeException)
    6688                 :            : {
    6689         [ +  - ]:        165 :     SolarMutexGuard aGuard;
    6690                 :        165 :     table::CellAddress aAdr;
    6691                 :        165 :     aAdr.Sheet  = aCellPos.Tab();
    6692                 :        165 :     aAdr.Column = aCellPos.Col();
    6693                 :        165 :     aAdr.Row    = aCellPos.Row();
    6694         [ +  - ]:        165 :     return aAdr;
    6695                 :            : }
    6696                 :            : 
    6697                 :            : // XSheetAnnotationAnchor
    6698                 :            : 
    6699                 :          8 : uno::Reference<sheet::XSheetAnnotation> SAL_CALL ScCellObj::getAnnotation()
    6700                 :            :                                                 throw(uno::RuntimeException)
    6701                 :            : {
    6702         [ +  - ]:          8 :     SolarMutexGuard aGuard;
    6703                 :          8 :     ScDocShell* pDocSh = GetDocShell();
    6704         [ +  - ]:          8 :     if ( pDocSh )
    6705 [ +  - ][ +  - ]:          8 :         return new ScAnnotationObj( pDocSh, aCellPos );
                 [ +  - ]
    6706                 :            : 
    6707                 :            :     OSL_FAIL("getAnnotation ohne DocShell");
    6708 [ #  # ][ +  - ]:          8 :     return NULL;
    6709                 :            : }
    6710                 :            : 
    6711                 :            : // XFieldTypesSupplier
    6712                 :            : 
    6713                 :          4 : uno::Reference<container::XEnumerationAccess> SAL_CALL ScCellObj::getTextFields()
    6714                 :            :                                                 throw(uno::RuntimeException)
    6715                 :            : {
    6716         [ +  - ]:          4 :     SolarMutexGuard aGuard;
    6717                 :          4 :     ScDocShell* pDocSh = GetDocShell();
    6718         [ +  - ]:          4 :     if ( pDocSh )
    6719                 :            :     {
    6720         [ +  - ]:          4 :         uno::Reference<text::XTextRange> xContent(this);
    6721 [ +  - ][ +  - ]:          4 :         return new ScCellFieldsObj(xContent, pDocSh, aCellPos);
                 [ +  - ]
    6722                 :            :     }
    6723                 :            : 
    6724 [ #  # ][ +  - ]:          4 :     return NULL;
    6725                 :            : }
    6726                 :            : 
    6727                 :          0 : uno::Reference<container::XNameAccess> SAL_CALL ScCellObj::getTextFieldMasters()
    6728                 :            :                                                 throw(uno::RuntimeException)
    6729                 :            : {
    6730                 :            :     //  sowas gibts nicht im Calc (?)
    6731                 :          0 :     return NULL;
    6732                 :            : }
    6733                 :            : 
    6734                 :            : // XPropertySet erweitert fuer Zell-Properties
    6735                 :            : 
    6736                 :        102 : uno::Reference<beans::XPropertySetInfo> SAL_CALL ScCellObj::getPropertySetInfo()
    6737                 :            :                                                         throw(uno::RuntimeException)
    6738                 :            : {
    6739         [ +  - ]:        102 :     SolarMutexGuard aGuard;
    6740                 :            :     static uno::Reference<beans::XPropertySetInfo> aRef(
    6741 [ +  + ][ +  - ]:        102 :         new SfxItemPropertySetInfo( pCellPropSet->getPropertyMap() ));
         [ +  - ][ +  - ]
         [ +  - ][ #  # ]
    6742         [ +  - ]:        102 :     return aRef;
    6743                 :            : }
    6744                 :            : 
    6745                 :         45 : void ScCellObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry, const uno::Any& aValue )
    6746                 :            :                                 throw(lang::IllegalArgumentException, uno::RuntimeException)
    6747                 :            : {
    6748         [ +  - ]:         45 :     if ( pEntry )
    6749                 :            :     {
    6750         [ +  + ]:         45 :         if ( pEntry->nWID == SC_WID_UNO_FORMLOC )
    6751                 :            :         {
    6752                 :          2 :             rtl::OUString aStrVal;
    6753                 :          2 :             aValue >>= aStrVal;
    6754         [ +  - ]:          2 :             String aString(aStrVal);
    6755 [ +  - ][ +  - ]:          2 :             SetString_Impl(aString, sal_True, false);   // lokal interpretieren
    6756                 :            :         }
    6757         [ +  + ]:         43 :         else if ( pEntry->nWID == SC_WID_UNO_FORMRT )
    6758                 :            :         {
    6759                 :            :             //  Read-Only
    6760                 :            :             //! Exception oder so...
    6761                 :            :         }
    6762                 :            :         else
    6763                 :         42 :             ScCellRangeObj::SetOnePropertyValue( pEntry, aValue );
    6764                 :            :     }
    6765                 :         45 : }
    6766                 :            : 
    6767                 :        830 : void ScCellObj::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry,
    6768                 :            :                                         uno::Any& rAny )
    6769                 :            :                                             throw(uno::RuntimeException)
    6770                 :            : {
    6771         [ +  - ]:        830 :     if ( pEntry )
    6772                 :            :     {
    6773         [ +  + ]:        830 :         if ( pEntry->nWID == SC_WID_UNO_FORMLOC )
    6774                 :            :         {
    6775                 :            :             // sal_False = lokal
    6776 [ +  - ][ +  - ]:         10 :             rAny <<= rtl::OUString( GetInputString_Impl(false) );
    6777                 :            :         }
    6778         [ +  + ]:        820 :         else if ( pEntry->nWID == SC_WID_UNO_FORMRT )
    6779                 :            :         {
    6780         [ +  - ]:         10 :             table::CellContentType eType = GetResultType_Impl();
    6781         [ +  - ]:         10 :             rAny <<= eType;
    6782                 :            :         }
    6783                 :            :         else
    6784                 :        810 :             ScCellRangeObj::GetOnePropertyValue(pEntry, rAny);
    6785                 :            :     }
    6786                 :        830 : }
    6787                 :            : 
    6788                 :        356 : const SfxItemPropertyMap& ScCellObj::GetItemPropertyMap()
    6789                 :            : {
    6790                 :        356 :     return pCellPropSet->getPropertyMap();
    6791                 :            : }
    6792                 :            : 
    6793                 :            : // XServiceInfo
    6794                 :            : 
    6795                 :          0 : rtl::OUString SAL_CALL ScCellObj::getImplementationName() throw(uno::RuntimeException)
    6796                 :            : {
    6797                 :          0 :     return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ScCellObj" ));
    6798                 :            : }
    6799                 :            : 
    6800                 :          4 : sal_Bool SAL_CALL ScCellObj::supportsService( const rtl::OUString& rServiceName )
    6801                 :            :                                                     throw(uno::RuntimeException)
    6802                 :            : {
    6803                 :            :     //  CellRange/SheetCellRange are not in SheetCell service description,
    6804                 :            :     //  but ScCellObj is used instead of ScCellRangeObj in CellRanges collections,
    6805                 :            :     //  so it must support them
    6806                 :            : 
    6807         [ +  - ]:          4 :     String aServiceStr(rServiceName);
    6808         [ +  - ]:          4 :     return aServiceStr.EqualsAscii( SCSHEETCELL_SERVICE ) ||
    6809         [ +  - ]:          3 :            aServiceStr.EqualsAscii( SCCELL_SERVICE ) ||
    6810         [ +  - ]:          3 :            aServiceStr.EqualsAscii( SCCELLPROPERTIES_SERVICE ) ||
    6811         [ +  - ]:          3 :            aServiceStr.EqualsAscii( SCCHARPROPERTIES_SERVICE ) ||
    6812         [ +  - ]:          3 :            aServiceStr.EqualsAscii( SCPARAPROPERTIES_SERVICE ) ||
    6813         [ +  - ]:          3 :            aServiceStr.EqualsAscii( SCSHEETCELLRANGE_SERVICE ) ||
    6814 [ +  + ][ +  - ]:         19 :            aServiceStr.EqualsAscii( SCCELLRANGE_SERVICE );
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ -  + ]
                 [ +  - ]
    6815                 :            : }
    6816                 :            : 
    6817                 :          0 : uno::Sequence<rtl::OUString> SAL_CALL ScCellObj::getSupportedServiceNames()
    6818                 :            :                                                     throw(uno::RuntimeException)
    6819                 :            : {
    6820                 :          0 :     uno::Sequence<rtl::OUString> aRet(7);
    6821         [ #  # ]:          0 :     rtl::OUString* pArray = aRet.getArray();
    6822         [ #  # ]:          0 :     pArray[0] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( SCSHEETCELL_SERVICE ));
    6823         [ #  # ]:          0 :     pArray[1] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( SCCELL_SERVICE ));
    6824         [ #  # ]:          0 :     pArray[2] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( SCCELLPROPERTIES_SERVICE ));
    6825         [ #  # ]:          0 :     pArray[3] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( SCCHARPROPERTIES_SERVICE ));
    6826         [ #  # ]:          0 :     pArray[4] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( SCPARAPROPERTIES_SERVICE ));
    6827         [ #  # ]:          0 :     pArray[5] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( SCSHEETCELLRANGE_SERVICE ));
    6828         [ #  # ]:          0 :     pArray[6] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( SCCELLRANGE_SERVICE ));
    6829                 :          0 :     return aRet;
    6830                 :            : }
    6831                 :            : 
    6832                 :            : // XActionLockable
    6833                 :            : 
    6834                 :          3 : sal_Bool SAL_CALL ScCellObj::isActionLocked() throw(uno::RuntimeException)
    6835                 :            : {
    6836         [ +  - ]:          3 :     SolarMutexGuard aGuard;
    6837         [ +  - ]:          3 :     return nActionLockCount != 0;
    6838                 :            : }
    6839                 :            : 
    6840                 :          8 : void SAL_CALL ScCellObj::addActionLock() throw(uno::RuntimeException)
    6841                 :            : {
    6842         [ +  - ]:          8 :     SolarMutexGuard aGuard;
    6843         [ +  - ]:          8 :     if (!nActionLockCount)
    6844                 :            :     {
    6845         [ -  + ]:          8 :         if (mxUnoText.is())
    6846                 :            :         {
    6847                 :            :             ScCellEditSource* pEditSource =
    6848                 :          0 :                 static_cast<ScCellEditSource*> (mxUnoText->GetEditSource());
    6849         [ #  # ]:          0 :             if (pEditSource)
    6850         [ #  # ]:          0 :                 pEditSource->SetDoUpdateData(false);
    6851                 :            :         }
    6852                 :            :     }
    6853         [ +  - ]:          8 :     nActionLockCount++;
    6854                 :          8 : }
    6855                 :            : 
    6856                 :          1 : void SAL_CALL ScCellObj::removeActionLock() throw(uno::RuntimeException)
    6857                 :            : {
    6858         [ +  - ]:          1 :     SolarMutexGuard aGuard;
    6859         [ +  - ]:          1 :     if (nActionLockCount > 0)
    6860                 :            :     {
    6861                 :          1 :         nActionLockCount--;
    6862         [ +  - ]:          1 :         if (!nActionLockCount)
    6863                 :            :         {
    6864         [ -  + ]:          1 :             if (mxUnoText.is())
    6865                 :            :             {
    6866                 :            :                 ScCellEditSource* pEditSource =
    6867                 :          0 :                     static_cast<ScCellEditSource*> (mxUnoText->GetEditSource());
    6868         [ #  # ]:          0 :                 if (pEditSource)
    6869                 :            :                 {
    6870         [ #  # ]:          0 :                     pEditSource->SetDoUpdateData(sal_True);
    6871 [ #  # ][ #  # ]:          0 :                     if (pEditSource->IsDirty())
    6872         [ #  # ]:          0 :                         pEditSource->UpdateData();
    6873                 :            :                 }
    6874                 :            :             }
    6875                 :            :         }
    6876         [ +  - ]:          1 :     }
    6877                 :          1 : }
    6878                 :            : 
    6879                 :          1 : void SAL_CALL ScCellObj::setActionLocks( sal_Int16 nLock ) throw(uno::RuntimeException)
    6880                 :            : {
    6881         [ +  - ]:          1 :     SolarMutexGuard aGuard;
    6882         [ -  + ]:          1 :     if (mxUnoText.is())
    6883                 :            :     {
    6884                 :            :         ScCellEditSource* pEditSource =
    6885                 :          0 :             static_cast<ScCellEditSource*> (mxUnoText->GetEditSource());
    6886         [ #  # ]:          0 :         if (pEditSource)
    6887                 :            :         {
    6888         [ #  # ]:          0 :             pEditSource->SetDoUpdateData(nLock == 0);
    6889 [ #  # ][ #  # ]:          0 :             if ((nActionLockCount > 0) && (nLock == 0) && pEditSource->IsDirty())
         [ #  # ][ #  # ]
                 [ #  # ]
    6890         [ #  # ]:          0 :                 pEditSource->UpdateData();
    6891                 :            :         }
    6892                 :            :     }
    6893         [ +  - ]:          1 :     nActionLockCount = nLock;
    6894                 :          1 : }
    6895                 :            : 
    6896                 :          1 : sal_Int16 SAL_CALL ScCellObj::resetActionLocks() throw(uno::RuntimeException)
    6897                 :            : {
    6898         [ +  - ]:          1 :     SolarMutexGuard aGuard;
    6899                 :          1 :     sal_uInt16 nRet(nActionLockCount);
    6900         [ -  + ]:          1 :     if (mxUnoText.is())
    6901                 :            :     {
    6902                 :            :         ScCellEditSource* pEditSource =
    6903                 :          0 :             static_cast<ScCellEditSource*> (mxUnoText->GetEditSource());
    6904         [ #  # ]:          0 :         if (pEditSource)
    6905                 :            :         {
    6906         [ #  # ]:          0 :             pEditSource->SetDoUpdateData(sal_True);
    6907 [ #  # ][ #  # ]:          0 :             if (pEditSource->IsDirty())
    6908         [ #  # ]:          0 :                 pEditSource->UpdateData();
    6909                 :            :         }
    6910                 :            :     }
    6911                 :          1 :     nActionLockCount = 0;
    6912         [ +  - ]:          1 :     return nRet;
    6913                 :            : }
    6914                 :            : 
    6915                 :            : //------------------------------------------------------------------------
    6916                 :            : 
    6917                 :        997 : ScTableSheetObj::ScTableSheetObj( ScDocShell* pDocSh, SCTAB nTab ) :
    6918                 :            :     ScCellRangeObj( pDocSh, ScRange(0,0,nTab, MAXCOL,MAXROW,nTab) ),
    6919 [ +  - ][ +  - ]:        997 :     pSheetPropSet(lcl_GetSheetPropertySet())
    6920                 :            : {
    6921                 :        997 : }
    6922                 :            : 
    6923                 :        985 : ScTableSheetObj::~ScTableSheetObj()
    6924                 :            : {
    6925         [ -  + ]:       1970 : }
    6926                 :            : 
    6927                 :          0 : void ScTableSheetObj::InitInsertSheet(ScDocShell* pDocSh, SCTAB nTab)
    6928                 :            : {
    6929         [ #  # ]:          0 :     InitInsertRange( pDocSh, ScRange(0,0,nTab, MAXCOL,MAXROW,nTab) );
    6930                 :          0 : }
    6931                 :            : 
    6932                 :       4344 : uno::Any SAL_CALL ScTableSheetObj::queryInterface( const uno::Type& rType ) throw(uno::RuntimeException)
    6933                 :            : {
    6934 [ +  + ][ +  - ]:       4344 :     SC_QUERYINTERFACE( sheet::XSpreadsheet )
    6935 [ +  + ][ +  - ]:       3772 :     SC_QUERYINTERFACE( container::XNamed )
    6936 [ -  + ][ #  # ]:       3665 :     SC_QUERYINTERFACE( sheet::XSheetPageBreak )
    6937 [ -  + ][ #  # ]:       3665 :     SC_QUERYINTERFACE( sheet::XCellRangeMovement )
    6938 [ +  + ][ +  - ]:       3665 :     SC_QUERYINTERFACE( table::XTableChartsSupplier )
    6939 [ +  + ][ +  - ]:       3656 :     SC_QUERYINTERFACE( sheet::XDataPilotTablesSupplier )
    6940 [ +  + ][ +  - ]:       3595 :     SC_QUERYINTERFACE( sheet::XScenariosSupplier )
    6941 [ +  + ][ +  - ]:       3594 :     SC_QUERYINTERFACE( sheet::XSheetAnnotationsSupplier )
    6942 [ +  + ][ +  - ]:       3585 :     SC_QUERYINTERFACE( drawing::XDrawPageSupplier )
    6943 [ +  + ][ +  - ]:       3476 :     SC_QUERYINTERFACE( sheet::XPrintAreas )
    6944 [ +  + ][ +  - ]:       3468 :     SC_QUERYINTERFACE( sheet::XSheetAuditing )
    6945 [ -  + ][ #  # ]:       3467 :     SC_QUERYINTERFACE( sheet::XSheetOutline )
    6946 [ +  + ][ +  - ]:       3467 :     SC_QUERYINTERFACE( util::XProtectable )
    6947 [ -  + ][ #  # ]:       3463 :     SC_QUERYINTERFACE( sheet::XScenario )
    6948 [ -  + ][ #  # ]:       3463 :     SC_QUERYINTERFACE( sheet::XScenarioEnhanced )
    6949 [ +  + ][ +  - ]:       3463 :     SC_QUERYINTERFACE( sheet::XSheetLinkable )
    6950 [ -  + ][ #  # ]:       3457 :     SC_QUERYINTERFACE( sheet::XExternalSheetName )
    6951 [ -  + ][ #  # ]:       3457 :     SC_QUERYINTERFACE( document::XEventsSupplier )
    6952                 :            : 
    6953                 :       4344 :     return ScCellRangeObj::queryInterface( rType );
    6954                 :            : }
    6955                 :            : 
    6956                 :      17587 : void SAL_CALL ScTableSheetObj::acquire() throw()
    6957                 :            : {
    6958                 :      17587 :     ScCellRangeObj::acquire();
    6959                 :      17587 : }
    6960                 :            : 
    6961                 :      17575 : void SAL_CALL ScTableSheetObj::release() throw()
    6962                 :            : {
    6963                 :      17575 :     ScCellRangeObj::release();
    6964                 :      17575 : }
    6965                 :            : 
    6966                 :          4 : uno::Sequence<uno::Type> SAL_CALL ScTableSheetObj::getTypes() throw(uno::RuntimeException)
    6967                 :            : {
    6968 [ +  - ][ +  - ]:          4 :     static uno::Sequence<uno::Type> aTypes;
         [ +  - ][ #  # ]
    6969         [ +  - ]:          4 :     if ( aTypes.getLength() == 0 )
    6970                 :            :     {
    6971         [ +  - ]:          4 :         uno::Sequence<uno::Type> aParentTypes = ScCellRangeObj::getTypes();
    6972                 :          4 :         long nParentLen = aParentTypes.getLength();
    6973                 :          4 :         const uno::Type* pParentPtr = aParentTypes.getConstArray();
    6974                 :            : 
    6975         [ +  - ]:          4 :         aTypes.realloc( nParentLen + 18 );
    6976         [ +  - ]:          4 :         uno::Type* pPtr = aTypes.getArray();
    6977         [ +  - ]:          4 :         pPtr[nParentLen + 0] = getCppuType((const uno::Reference<sheet::XSpreadsheet>*)0);
    6978         [ +  - ]:          4 :         pPtr[nParentLen + 1] = getCppuType((const uno::Reference<container::XNamed>*)0);
    6979         [ +  - ]:          4 :         pPtr[nParentLen + 2] = getCppuType((const uno::Reference<sheet::XSheetPageBreak>*)0);
    6980         [ +  - ]:          4 :         pPtr[nParentLen + 3] = getCppuType((const uno::Reference<sheet::XCellRangeMovement>*)0);
    6981         [ +  - ]:          4 :         pPtr[nParentLen + 4] = getCppuType((const uno::Reference<table::XTableChartsSupplier>*)0);
    6982         [ +  - ]:          4 :         pPtr[nParentLen + 5] = getCppuType((const uno::Reference<sheet::XDataPilotTablesSupplier>*)0);
    6983         [ +  - ]:          4 :         pPtr[nParentLen + 6] = getCppuType((const uno::Reference<sheet::XScenariosSupplier>*)0);
    6984         [ +  - ]:          4 :         pPtr[nParentLen + 7] = getCppuType((const uno::Reference<sheet::XSheetAnnotationsSupplier>*)0);
    6985         [ +  - ]:          4 :         pPtr[nParentLen + 8] = getCppuType((const uno::Reference<drawing::XDrawPageSupplier>*)0);
    6986         [ +  - ]:          4 :         pPtr[nParentLen + 9] = getCppuType((const uno::Reference<sheet::XPrintAreas>*)0);
    6987         [ +  - ]:          4 :         pPtr[nParentLen +10] = getCppuType((const uno::Reference<sheet::XSheetAuditing>*)0);
    6988         [ +  - ]:          4 :         pPtr[nParentLen +11] = getCppuType((const uno::Reference<sheet::XSheetOutline>*)0);
    6989         [ +  - ]:          4 :         pPtr[nParentLen +12] = getCppuType((const uno::Reference<util::XProtectable>*)0);
    6990         [ +  - ]:          4 :         pPtr[nParentLen +13] = getCppuType((const uno::Reference<sheet::XScenario>*)0);
    6991         [ +  - ]:          4 :         pPtr[nParentLen +14] = getCppuType((const uno::Reference<sheet::XScenarioEnhanced>*)0);
    6992         [ +  - ]:          4 :         pPtr[nParentLen +15] = getCppuType((const uno::Reference<sheet::XSheetLinkable>*)0);
    6993         [ +  - ]:          4 :         pPtr[nParentLen +16] = getCppuType((const uno::Reference<sheet::XExternalSheetName>*)0);
    6994         [ +  - ]:          4 :         pPtr[nParentLen +17] = getCppuType((const uno::Reference<document::XEventsSupplier>*)0);
    6995                 :            : 
    6996         [ +  + ]:        124 :         for (long i=0; i<nParentLen; i++)
    6997         [ +  - ]:        124 :             pPtr[i] = pParentPtr[i];                // parent types first
    6998                 :            :     }
    6999                 :          4 :     return aTypes;
    7000                 :            : }
    7001                 :            : 
    7002                 :            : namespace
    7003                 :            : {
    7004                 :            :     class theScTableSheetObjImplementationId : public rtl::Static< UnoTunnelIdInit, theScTableSheetObjImplementationId > {};
    7005                 :            : }
    7006                 :            : 
    7007                 :          4 : uno::Sequence<sal_Int8> SAL_CALL ScTableSheetObj::getImplementationId() throw(uno::RuntimeException)
    7008                 :            : {
    7009                 :          4 :     return theScTableSheetObjImplementationId::get().getSeq();
    7010                 :            : }
    7011                 :            : 
    7012                 :            : //  Hilfsfunktionen
    7013                 :            : 
    7014                 :       1759 : SCTAB ScTableSheetObj::GetTab_Impl() const
    7015                 :            : {
    7016                 :       1759 :     const ScRangeList& rRanges = GetRangeList();
    7017                 :            :     OSL_ENSURE(rRanges.size() == 1, "was fuer Ranges ?!?!");
    7018         [ +  - ]:       1759 :     if ( !rRanges.empty() )
    7019                 :            :     {
    7020                 :       1759 :         const ScRange* pFirst = rRanges[ 0 ];
    7021                 :       1759 :         return pFirst->aStart.Tab();
    7022                 :            :     }
    7023                 :       1759 :     return 0;   // soll nicht sein
    7024                 :            : }
    7025                 :            : 
    7026                 :            : // former XSheet
    7027                 :            : 
    7028                 :          9 : uno::Reference<table::XTableCharts> SAL_CALL ScTableSheetObj::getCharts() throw(uno::RuntimeException)
    7029                 :            : {
    7030         [ +  - ]:          9 :     SolarMutexGuard aGuard;
    7031                 :          9 :     ScDocShell* pDocSh = GetDocShell();
    7032         [ +  - ]:          9 :     if ( pDocSh )
    7033 [ +  - ][ +  - ]:          9 :         return new ScChartsObj( pDocSh, GetTab_Impl() );
         [ +  - ][ +  - ]
    7034                 :            : 
    7035                 :            :     OSL_FAIL("kein Dokument");
    7036 [ #  # ][ +  - ]:          9 :     return NULL;
    7037                 :            : }
    7038                 :            : 
    7039                 :         68 : uno::Reference<sheet::XDataPilotTables> SAL_CALL ScTableSheetObj::getDataPilotTables()
    7040                 :            :                                                 throw(uno::RuntimeException)
    7041                 :            : {
    7042         [ +  - ]:         68 :     SolarMutexGuard aGuard;
    7043                 :         68 :     ScDocShell* pDocSh = GetDocShell();
    7044         [ +  - ]:         68 :     if ( pDocSh )
    7045 [ +  - ][ +  - ]:         68 :         return new ScDataPilotTablesObj( pDocSh, GetTab_Impl() );
         [ +  - ][ +  - ]
    7046                 :            : 
    7047                 :            :     OSL_FAIL("kein Dokument");
    7048 [ #  # ][ +  - ]:         68 :     return NULL;
    7049                 :            : }
    7050                 :            : 
    7051                 :          2 : uno::Reference<sheet::XScenarios> SAL_CALL ScTableSheetObj::getScenarios() throw(uno::RuntimeException)
    7052                 :            : {
    7053         [ +  - ]:          2 :     SolarMutexGuard aGuard;
    7054                 :          2 :     ScDocShell* pDocSh = GetDocShell();
    7055                 :            : 
    7056         [ +  - ]:          2 :     if ( pDocSh )
    7057 [ +  - ][ +  - ]:          2 :         return new ScScenariosObj( pDocSh, GetTab_Impl() );
         [ +  - ][ +  - ]
    7058                 :            : 
    7059                 :            :     OSL_FAIL("kein Dokument");
    7060 [ #  # ][ +  - ]:          2 :     return NULL;
    7061                 :            : }
    7062                 :            : 
    7063                 :          9 : uno::Reference<sheet::XSheetAnnotations> SAL_CALL ScTableSheetObj::getAnnotations()
    7064                 :            :                                                 throw(uno::RuntimeException)
    7065                 :            : {
    7066         [ +  - ]:          9 :     SolarMutexGuard aGuard;
    7067                 :          9 :     ScDocShell* pDocSh = GetDocShell();
    7068                 :            : 
    7069         [ +  - ]:          9 :     if ( pDocSh )
    7070 [ +  - ][ +  - ]:          9 :         return new ScAnnotationsObj( pDocSh, GetTab_Impl() );
         [ +  - ][ +  - ]
    7071                 :            : 
    7072                 :            :     OSL_FAIL("kein Dokument");
    7073 [ #  # ][ +  - ]:          9 :     return NULL;
    7074                 :            : }
    7075                 :            : 
    7076                 :         77 : uno::Reference<table::XCellRange> SAL_CALL ScTableSheetObj::getCellRangeByName(
    7077                 :            :                         const rtl::OUString& rRange ) throw(uno::RuntimeException)
    7078                 :            : {
    7079         [ +  - ]:         77 :     SolarMutexGuard aGuard;
    7080 [ +  - ][ +  - ]:         77 :     return ScCellRangeObj::getCellRangeByName( rRange );
    7081                 :            : }
    7082                 :            : 
    7083                 :          8 : uno::Reference<sheet::XSheetCellCursor> SAL_CALL ScTableSheetObj::createCursor()
    7084                 :            :                                                 throw(uno::RuntimeException)
    7085                 :            : {
    7086         [ +  - ]:          8 :     SolarMutexGuard aGuard;
    7087                 :          8 :     ScDocShell* pDocSh = GetDocShell();
    7088         [ +  - ]:          8 :     if ( pDocSh )
    7089                 :            :     {
    7090                 :            :         //! einzelne Zelle oder ganze Tabelle???????
    7091         [ +  - ]:          8 :         SCTAB nTab = GetTab_Impl();
    7092 [ +  - ][ +  - ]:          8 :         return new ScCellCursorObj( pDocSh, ScRange( 0,0,nTab, MAXCOL,MAXROW,nTab ) );
                 [ +  - ]
    7093                 :            :     }
    7094 [ #  # ][ +  - ]:          8 :     return NULL;
    7095                 :            : }
    7096                 :            : 
    7097                 :         34 : uno::Reference<sheet::XSheetCellCursor> SAL_CALL ScTableSheetObj::createCursorByRange(
    7098                 :            :                         const uno::Reference<sheet::XSheetCellRange>& xCellRange )
    7099                 :            :                                                 throw(uno::RuntimeException)
    7100                 :            : {
    7101         [ +  - ]:         34 :     SolarMutexGuard aGuard;
    7102                 :         34 :     ScDocShell* pDocSh = GetDocShell();
    7103 [ +  - ][ +  - ]:         34 :     if ( pDocSh && xCellRange.is() )
                 [ +  - ]
    7104                 :            :     {
    7105         [ +  - ]:         34 :         ScCellRangesBase* pRangesImp = ScCellRangesBase::getImplementation( xCellRange );
    7106         [ +  - ]:         34 :         if (pRangesImp)
    7107                 :            :         {
    7108                 :         34 :             const ScRangeList& rRanges = pRangesImp->GetRangeList();
    7109                 :            :             OSL_ENSURE( rRanges.size() == 1, "Range? Ranges?" );
    7110 [ +  - ][ +  - ]:         34 :             return new ScCellCursorObj( pDocSh, *rRanges[ 0 ] );
         [ +  - ][ +  - ]
    7111                 :            :         }
    7112                 :            :     }
    7113 [ #  # ][ +  - ]:         34 :     return NULL;
    7114                 :            : }
    7115                 :            : 
    7116                 :            : // XSheetCellRange
    7117                 :            : 
    7118                 :        118 : uno::Reference<sheet::XSpreadsheet> SAL_CALL ScTableSheetObj::getSpreadsheet()
    7119                 :            :                                                 throw(uno::RuntimeException)
    7120                 :            : {
    7121         [ +  - ]:        118 :     SolarMutexGuard aGuard;
    7122 [ +  - ][ +  - ]:        118 :     return this;        //!???
    7123                 :            : }
    7124                 :            : 
    7125                 :            : // XCellRange
    7126                 :            : 
    7127                 :       2975 : uno::Reference<table::XCell> SAL_CALL ScTableSheetObj::getCellByPosition(
    7128                 :            :                                         sal_Int32 nColumn, sal_Int32 nRow )
    7129                 :            :                                 throw(lang::IndexOutOfBoundsException, uno::RuntimeException)
    7130                 :            : {
    7131         [ +  - ]:       2975 :     SolarMutexGuard aGuard;
    7132 [ +  - ][ +  - ]:       2975 :     return ScCellRangeObj::GetCellByPosition_Impl(nColumn, nRow);
    7133                 :            : }
    7134                 :            : 
    7135                 :       5295 : uno::Reference<table::XCellRange> SAL_CALL ScTableSheetObj::getCellRangeByPosition(
    7136                 :            :                 sal_Int32 nLeft, sal_Int32 nTop, sal_Int32 nRight, sal_Int32 nBottom )
    7137                 :            :                                 throw(lang::IndexOutOfBoundsException, uno::RuntimeException)
    7138                 :            : {
    7139         [ +  - ]:       5295 :     SolarMutexGuard aGuard;
    7140 [ +  - ][ +  - ]:       5295 :     return ScCellRangeObj::getCellRangeByPosition(nLeft,nTop,nRight,nBottom);
    7141                 :            : }
    7142                 :            : 
    7143                 :          0 : uno::Sequence<sheet::TablePageBreakData> SAL_CALL ScTableSheetObj::getColumnPageBreaks()
    7144                 :            :                                                 throw(uno::RuntimeException)
    7145                 :            : {
    7146         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    7147                 :          0 :     ScDocShell* pDocSh = GetDocShell();
    7148         [ #  # ]:          0 :     if ( pDocSh )
    7149                 :            :     {
    7150                 :          0 :         ScDocument* pDoc = pDocSh->GetDocument();
    7151         [ #  # ]:          0 :         SCTAB nTab = GetTab_Impl();
    7152                 :            : 
    7153         [ #  # ]:          0 :         Size aSize(pDoc->GetPageSize( nTab ));
    7154 [ #  # ][ #  # ]:          0 :         if (aSize.Width() && aSize.Height())        // effektive Groesse schon gesetzt?
                 [ #  # ]
    7155         [ #  # ]:          0 :             pDoc->UpdatePageBreaks( nTab );
    7156                 :            :         else
    7157                 :            :         {
    7158                 :            :             //  Umbrueche updaten wie in ScDocShell::PageStyleModified:
    7159 [ #  # ][ #  # ]:          0 :             ScPrintFunc aPrintFunc( pDocSh, pDocSh->GetPrinter(), nTab );
    7160 [ #  # ][ #  # ]:          0 :             aPrintFunc.UpdatePages();
    7161                 :            :         }
    7162                 :            : 
    7163                 :          0 :         SCCOL nCount = 0;
    7164                 :            :         SCCOL nCol;
    7165         [ #  # ]:          0 :         for (nCol=0; nCol<=MAXCOL; nCol++)
    7166 [ #  # ][ #  # ]:          0 :             if (pDoc->HasColBreak(nCol, nTab))
    7167                 :          0 :                 ++nCount;
    7168                 :            : 
    7169                 :          0 :         sheet::TablePageBreakData aData;
    7170         [ #  # ]:          0 :         uno::Sequence<sheet::TablePageBreakData> aSeq(nCount);
    7171         [ #  # ]:          0 :         sheet::TablePageBreakData* pAry = aSeq.getArray();
    7172                 :          0 :         sal_uInt16 nPos = 0;
    7173         [ #  # ]:          0 :         for (nCol=0; nCol<=MAXCOL; nCol++)
    7174                 :            :         {
    7175         [ #  # ]:          0 :             ScBreakType nBreak = pDoc->HasColBreak(nCol, nTab);
    7176         [ #  # ]:          0 :             if (nBreak)
    7177                 :            :             {
    7178                 :          0 :                 aData.Position    = nCol;
    7179                 :          0 :                 aData.ManualBreak = (nBreak & BREAK_MANUAL);
    7180                 :          0 :                 pAry[nPos] = aData;
    7181                 :          0 :                 ++nPos;
    7182                 :            :             }
    7183                 :            :         }
    7184 [ #  # ][ #  # ]:          0 :         return aSeq;
    7185                 :            :     }
    7186 [ #  # ][ #  # ]:          0 :     return uno::Sequence<sheet::TablePageBreakData>(0);
    7187                 :            : }
    7188                 :            : 
    7189                 :          0 : uno::Sequence<sheet::TablePageBreakData> SAL_CALL ScTableSheetObj::getRowPageBreaks()
    7190                 :            :                                                 throw(uno::RuntimeException)
    7191                 :            : {
    7192         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    7193                 :          0 :     ScDocShell* pDocSh = GetDocShell();
    7194         [ #  # ]:          0 :     if ( pDocSh )
    7195                 :            :     {
    7196                 :          0 :         ScDocument* pDoc = pDocSh->GetDocument();
    7197         [ #  # ]:          0 :         SCTAB nTab = GetTab_Impl();
    7198                 :            : 
    7199         [ #  # ]:          0 :         Size aSize(pDoc->GetPageSize( nTab ));
    7200 [ #  # ][ #  # ]:          0 :         if (aSize.Width() && aSize.Height())        // effektive Groesse schon gesetzt?
                 [ #  # ]
    7201         [ #  # ]:          0 :             pDoc->UpdatePageBreaks( nTab );
    7202                 :            :         else
    7203                 :            :         {
    7204                 :            :             //  Umbrueche updaten wie in ScDocShell::PageStyleModified:
    7205 [ #  # ][ #  # ]:          0 :             ScPrintFunc aPrintFunc( pDocSh, pDocSh->GetPrinter(), nTab );
    7206 [ #  # ][ #  # ]:          0 :             aPrintFunc.UpdatePages();
    7207                 :            :         }
    7208         [ #  # ]:          0 :         return pDoc->GetRowBreakData(nTab);
    7209                 :            :     }
    7210 [ #  # ][ #  # ]:          0 :     return uno::Sequence<sheet::TablePageBreakData>(0);
    7211                 :            : }
    7212                 :            : 
    7213                 :          0 : void SAL_CALL ScTableSheetObj::removeAllManualPageBreaks() throw(uno::RuntimeException)
    7214                 :            : {
    7215         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    7216                 :          0 :     ScDocShell* pDocSh = GetDocShell();
    7217         [ #  # ]:          0 :     if ( pDocSh )
    7218                 :            :     {
    7219                 :            :         //! docfunc Funktion, auch fuer ScViewFunc::RemoveManualBreaks
    7220                 :            : 
    7221                 :          0 :         ScDocument* pDoc = pDocSh->GetDocument();
    7222                 :          0 :         sal_Bool bUndo (pDoc->IsUndoEnabled());
    7223         [ #  # ]:          0 :         SCTAB nTab = GetTab_Impl();
    7224                 :            : 
    7225         [ #  # ]:          0 :         if (bUndo)
    7226                 :            :         {
    7227 [ #  # ][ #  # ]:          0 :             ScDocument* pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
    7228         [ #  # ]:          0 :             pUndoDoc->InitUndo( pDoc, nTab, nTab, sal_True, sal_True );
    7229         [ #  # ]:          0 :             pDoc->CopyToDocument( 0,0,nTab, MAXCOL,MAXROW,nTab, IDF_NONE, false, pUndoDoc );
    7230         [ #  # ]:          0 :             pDocSh->GetUndoManager()->AddUndoAction(
    7231 [ #  # ][ #  # ]:          0 :                                     new ScUndoRemoveBreaks( pDocSh, nTab, pUndoDoc ) );
                 [ #  # ]
    7232                 :            :         }
    7233                 :            : 
    7234         [ #  # ]:          0 :         pDoc->RemoveManualBreaks(nTab);
    7235         [ #  # ]:          0 :         pDoc->UpdatePageBreaks(nTab);
    7236                 :            : 
    7237                 :            :         //? UpdatePageBreakData( sal_True );
    7238         [ #  # ]:          0 :         pDocSh->SetDocumentModified();
    7239 [ #  # ][ #  # ]:          0 :         pDocSh->PostPaint(ScRange(0, 0, nTab, MAXCOL, MAXROW, nTab), PAINT_GRID);
                 [ #  # ]
    7240         [ #  # ]:          0 :     }
    7241                 :          0 : }
    7242                 :            : 
    7243                 :            : // XNamed
    7244                 :            : 
    7245                 :        105 : rtl::OUString SAL_CALL ScTableSheetObj::getName() throw(uno::RuntimeException)
    7246                 :            : {
    7247         [ +  - ]:        105 :     SolarMutexGuard aGuard;
    7248                 :        105 :     rtl::OUString aName;
    7249                 :        105 :     ScDocShell* pDocSh = GetDocShell();
    7250         [ +  - ]:        105 :     if ( pDocSh )
    7251 [ +  - ][ +  - ]:        105 :         pDocSh->GetDocument()->GetName( GetTab_Impl(), aName );
    7252         [ +  - ]:        105 :     return aName;
    7253                 :            : }
    7254                 :            : 
    7255                 :          2 : void SAL_CALL ScTableSheetObj::setName( const rtl::OUString& aNewName )
    7256                 :            :                                                 throw(uno::RuntimeException)
    7257                 :            : {
    7258         [ +  - ]:          2 :     SolarMutexGuard aGuard;
    7259                 :          2 :     ScDocShell* pDocSh = GetDocShell();
    7260         [ +  - ]:          2 :     if ( pDocSh )
    7261                 :            :     {
    7262         [ +  - ]:          2 :         String aString(aNewName);
    7263 [ +  - ][ +  - ]:          2 :         pDocSh->GetDocFunc().RenameTable( GetTab_Impl(), aString, sal_True, sal_True );
                 [ +  - ]
    7264         [ +  - ]:          2 :     }
    7265                 :          2 : }
    7266                 :            : 
    7267                 :            : // XDrawPageSupplier
    7268                 :            : 
    7269                 :        109 : uno::Reference<drawing::XDrawPage> SAL_CALL ScTableSheetObj::getDrawPage()
    7270                 :            :                                                 throw(uno::RuntimeException)
    7271                 :            : {
    7272         [ +  - ]:        109 :     SolarMutexGuard aGuard;
    7273                 :        109 :     ScDocShell* pDocSh = GetDocShell();
    7274         [ +  - ]:        109 :     if ( pDocSh )
    7275                 :            :     {
    7276         [ +  - ]:        109 :         ScDrawLayer* pDrawLayer = pDocSh->MakeDrawLayer();
    7277                 :            :         OSL_ENSURE(pDrawLayer,"kann Draw-Layer nicht anlegen");
    7278                 :            : 
    7279         [ +  - ]:        109 :         SCTAB nTab = GetTab_Impl();
    7280         [ +  - ]:        109 :         SdrPage* pPage = pDrawLayer->GetPage(static_cast<sal_uInt16>(nTab));
    7281                 :            :         OSL_ENSURE(pPage,"Draw-Page nicht gefunden");
    7282         [ +  - ]:        109 :         if (pPage)
    7283 [ +  - ][ +  - ]:        109 :             return uno::Reference<drawing::XDrawPage> (pPage->getUnoPage(), uno::UNO_QUERY);
    7284                 :            : 
    7285                 :            :         //  Das DrawPage-Objekt meldet sich als Listener am SdrModel an
    7286                 :            :         //  und sollte von dort alle Aktionen mitbekommen
    7287                 :            :     }
    7288 [ #  # ][ +  - ]:        109 :     return NULL;
    7289                 :            : }
    7290                 :            : 
    7291                 :            : // XCellMovement
    7292                 :            : 
    7293                 :          0 : void SAL_CALL ScTableSheetObj::insertCells( const table::CellRangeAddress& rRangeAddress,
    7294                 :            :                                 sheet::CellInsertMode nMode ) throw(uno::RuntimeException)
    7295                 :            : {
    7296         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    7297                 :          0 :     ScDocShell* pDocSh = GetDocShell();
    7298         [ #  # ]:          0 :     if ( pDocSh )
    7299                 :            :     {
    7300                 :          0 :         sal_Bool bDo = sal_True;
    7301                 :          0 :         InsCellCmd eCmd = INS_NONE;
    7302   [ #  #  #  #  :          0 :         switch (nMode)
                   #  # ]
    7303                 :            :         {
    7304                 :          0 :             case sheet::CellInsertMode_NONE:    bDo = false;            break;
    7305                 :          0 :             case sheet::CellInsertMode_DOWN:    eCmd = INS_CELLSDOWN;   break;
    7306                 :          0 :             case sheet::CellInsertMode_RIGHT:   eCmd = INS_CELLSRIGHT;  break;
    7307                 :          0 :             case sheet::CellInsertMode_ROWS:    eCmd = INS_INSROWS;     break;
    7308                 :          0 :             case sheet::CellInsertMode_COLUMNS: eCmd = INS_INSCOLS;     break;
    7309                 :            :             default:
    7310                 :            :                 OSL_FAIL("insertCells: falscher Mode");
    7311                 :          0 :                 bDo = false;
    7312                 :            :         }
    7313                 :            : 
    7314         [ #  # ]:          0 :         if (bDo)
    7315                 :            :         {
    7316                 :            :             OSL_ENSURE( rRangeAddress.Sheet == GetTab_Impl(), "falsche Tabelle in CellRangeAddress" );
    7317                 :          0 :             ScRange aScRange;
    7318                 :          0 :             ScUnoConversion::FillScRange( aScRange, rRangeAddress );
    7319         [ #  # ]:          0 :             pDocSh->GetDocFunc().InsertCells( aScRange, NULL, eCmd, sal_True, sal_True );
    7320                 :            :         }
    7321         [ #  # ]:          0 :     }
    7322                 :          0 : }
    7323                 :            : 
    7324                 :          0 : void SAL_CALL ScTableSheetObj::removeRange( const table::CellRangeAddress& rRangeAddress,
    7325                 :            :                                 sheet::CellDeleteMode nMode ) throw(uno::RuntimeException)
    7326                 :            : {
    7327         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    7328                 :          0 :     ScDocShell* pDocSh = GetDocShell();
    7329         [ #  # ]:          0 :     if ( pDocSh )
    7330                 :            :     {
    7331                 :          0 :         sal_Bool bDo = sal_True;
    7332                 :          0 :         DelCellCmd eCmd = DEL_NONE;
    7333   [ #  #  #  #  :          0 :         switch (nMode)
                   #  # ]
    7334                 :            :         {
    7335                 :          0 :             case sheet::CellDeleteMode_NONE:     bDo = false;           break;
    7336                 :          0 :             case sheet::CellDeleteMode_UP:       eCmd = DEL_CELLSUP;    break;
    7337                 :          0 :             case sheet::CellDeleteMode_LEFT:     eCmd = DEL_CELLSLEFT;  break;
    7338                 :          0 :             case sheet::CellDeleteMode_ROWS:     eCmd = DEL_DELROWS;    break;
    7339                 :          0 :             case sheet::CellDeleteMode_COLUMNS:  eCmd = DEL_DELCOLS;    break;
    7340                 :            :             default:
    7341                 :            :                 OSL_FAIL("deleteCells: falscher Mode");
    7342                 :          0 :                 bDo = false;
    7343                 :            :         }
    7344                 :            : 
    7345         [ #  # ]:          0 :         if (bDo)
    7346                 :            :         {
    7347                 :            :             OSL_ENSURE( rRangeAddress.Sheet == GetTab_Impl(), "falsche Tabelle in CellRangeAddress" );
    7348                 :          0 :             ScRange aScRange;
    7349                 :          0 :             ScUnoConversion::FillScRange( aScRange, rRangeAddress );
    7350         [ #  # ]:          0 :             pDocSh->GetDocFunc().DeleteCells( aScRange, NULL, eCmd, sal_True, sal_True );
    7351                 :            :         }
    7352         [ #  # ]:          0 :     }
    7353                 :          0 : }
    7354                 :            : 
    7355                 :          0 : void SAL_CALL ScTableSheetObj::moveRange( const table::CellAddress& aDestination,
    7356                 :            :                                         const table::CellRangeAddress& aSource )
    7357                 :            :                                         throw(uno::RuntimeException)
    7358                 :            : {
    7359         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    7360                 :          0 :     ScDocShell* pDocSh = GetDocShell();
    7361         [ #  # ]:          0 :     if ( pDocSh )
    7362                 :            :     {
    7363                 :            :         OSL_ENSURE( aSource.Sheet == GetTab_Impl(), "falsche Tabelle in CellRangeAddress" );
    7364                 :          0 :         ScRange aSourceRange;
    7365                 :          0 :         ScUnoConversion::FillScRange( aSourceRange, aSource );
    7366                 :          0 :         ScAddress aDestPos( (SCCOL)aDestination.Column, (SCROW)aDestination.Row, aDestination.Sheet );
    7367         [ #  # ]:          0 :         pDocSh->GetDocFunc().MoveBlock( aSourceRange, aDestPos, sal_True, sal_True, sal_True, sal_True );
    7368         [ #  # ]:          0 :     }
    7369                 :          0 : }
    7370                 :            : 
    7371                 :          0 : void SAL_CALL ScTableSheetObj::copyRange( const table::CellAddress& aDestination,
    7372                 :            :                                         const table::CellRangeAddress& aSource )
    7373                 :            :                                         throw(uno::RuntimeException)
    7374                 :            : {
    7375         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    7376                 :          0 :     ScDocShell* pDocSh = GetDocShell();
    7377         [ #  # ]:          0 :     if ( pDocSh )
    7378                 :            :     {
    7379                 :            :         OSL_ENSURE( aSource.Sheet == GetTab_Impl(), "falsche Tabelle in CellRangeAddress" );
    7380                 :          0 :         ScRange aSourceRange;
    7381                 :          0 :         ScUnoConversion::FillScRange( aSourceRange, aSource );
    7382                 :          0 :         ScAddress aDestPos( (SCCOL)aDestination.Column, (SCROW)aDestination.Row, aDestination.Sheet );
    7383         [ #  # ]:          0 :         pDocSh->GetDocFunc().MoveBlock( aSourceRange, aDestPos, false, sal_True, sal_True, sal_True );
    7384         [ #  # ]:          0 :     }
    7385                 :          0 : }
    7386                 :            : 
    7387                 :            : // XPrintAreas
    7388                 :            : 
    7389                 :          4 : void ScTableSheetObj::PrintAreaUndo_Impl( ScPrintRangeSaver* pOldRanges )
    7390                 :            : {
    7391                 :            :     //  Umbrueche und Undo
    7392                 :            : 
    7393                 :          4 :     ScDocShell* pDocSh = GetDocShell();
    7394         [ +  - ]:          4 :     if ( pDocSh )
    7395                 :            :     {
    7396                 :          4 :         ScDocument* pDoc = pDocSh->GetDocument();
    7397                 :          4 :         sal_Bool bUndo(pDoc->IsUndoEnabled());
    7398                 :          4 :         SCTAB nTab = GetTab_Impl();
    7399                 :            : 
    7400                 :          4 :         ScPrintRangeSaver* pNewRanges = pDoc->CreatePrintRangeSaver();
    7401         [ +  - ]:          4 :         if (bUndo)
    7402                 :            :         {
    7403                 :          4 :             pDocSh->GetUndoManager()->AddUndoAction(
    7404         [ +  - ]:          4 :                         new ScUndoPrintRange( pDocSh, nTab, pOldRanges, pNewRanges ) );
    7405                 :            :         }
    7406                 :            : 
    7407         [ +  - ]:          4 :         ScPrintFunc( pDocSh, pDocSh->GetPrinter(), nTab ).UpdatePages();
    7408                 :            : 
    7409                 :          4 :         SfxBindings* pBindings = pDocSh->GetViewBindings();
    7410         [ +  - ]:          4 :         if (pBindings)
    7411                 :          4 :             pBindings->Invalidate( SID_DELETE_PRINTAREA );
    7412                 :            : 
    7413                 :          4 :         pDocSh->SetDocumentModified();
    7414                 :            :     }
    7415                 :            :     else
    7416         [ #  # ]:          0 :         delete pOldRanges;
    7417                 :          4 : }
    7418                 :            : 
    7419                 :          4 : uno::Sequence<table::CellRangeAddress> SAL_CALL ScTableSheetObj::getPrintAreas()
    7420                 :            :                                                 throw(uno::RuntimeException)
    7421                 :            : {
    7422         [ +  - ]:          4 :     SolarMutexGuard aGuard;
    7423                 :          4 :     ScDocShell* pDocSh = GetDocShell();
    7424         [ +  - ]:          4 :     if ( pDocSh )
    7425                 :            :     {
    7426                 :          4 :         ScDocument* pDoc = pDocSh->GetDocument();
    7427         [ +  - ]:          4 :         SCTAB nTab = GetTab_Impl();
    7428         [ +  - ]:          4 :         sal_uInt16 nCount = pDoc->GetPrintRangeCount( nTab );
    7429                 :            : 
    7430                 :          4 :         table::CellRangeAddress aRangeAddress;
    7431         [ +  - ]:          4 :         uno::Sequence<table::CellRangeAddress> aSeq(nCount);
    7432         [ +  - ]:          4 :         table::CellRangeAddress* pAry = aSeq.getArray();
    7433         [ -  + ]:          4 :         for (sal_uInt16 i=0; i<nCount; i++)
    7434                 :            :         {
    7435         [ #  # ]:          0 :             const ScRange* pRange = pDoc->GetPrintRange( nTab, i );
    7436                 :            :             OSL_ENSURE(pRange,"wo ist der Druckbereich");
    7437         [ #  # ]:          0 :             if (pRange)
    7438                 :            :             {
    7439                 :          0 :                 ScUnoConversion::FillApiRange( aRangeAddress, *pRange );
    7440                 :          0 :                 aRangeAddress.Sheet = nTab; // core does not care about sheet index
    7441                 :          0 :                 pAry[i] = aRangeAddress;
    7442                 :            :             }
    7443                 :            :         }
    7444 [ +  - ][ +  - ]:          4 :         return aSeq;
    7445                 :            :     }
    7446 [ #  # ][ +  - ]:          4 :     return uno::Sequence<table::CellRangeAddress>();
    7447                 :            : }
    7448                 :            : 
    7449                 :          0 : void SAL_CALL ScTableSheetObj::setPrintAreas(
    7450                 :            :                     const uno::Sequence<table::CellRangeAddress>& aPrintAreas )
    7451                 :            :                                                 throw(uno::RuntimeException)
    7452                 :            : {
    7453         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    7454                 :          0 :     ScDocShell* pDocSh = GetDocShell();
    7455         [ #  # ]:          0 :     if ( pDocSh )
    7456                 :            :     {
    7457                 :          0 :         ScDocument* pDoc = pDocSh->GetDocument();
    7458         [ #  # ]:          0 :         SCTAB nTab = GetTab_Impl();
    7459                 :            : 
    7460         [ #  # ]:          0 :         ScPrintRangeSaver* pOldRanges = pDoc->CreatePrintRangeSaver();
    7461                 :            : 
    7462                 :          0 :         sal_uInt16 nCount = (sal_uInt16) aPrintAreas.getLength();
    7463         [ #  # ]:          0 :         pDoc->ClearPrintRanges( nTab );
    7464         [ #  # ]:          0 :         if (nCount)
    7465                 :            :         {
    7466                 :          0 :             ScRange aPrintRange;
    7467                 :          0 :             const table::CellRangeAddress* pAry = aPrintAreas.getConstArray();
    7468         [ #  # ]:          0 :             for (sal_uInt16 i=0; i<nCount; i++)
    7469                 :            :             {
    7470                 :          0 :                 ScUnoConversion::FillScRange( aPrintRange, pAry[i] );
    7471         [ #  # ]:          0 :                 pDoc->AddPrintRange( nTab, aPrintRange );
    7472                 :            :             }
    7473                 :            :         }
    7474                 :            : 
    7475         [ #  # ]:          0 :         PrintAreaUndo_Impl( pOldRanges );   // Undo, Umbrueche, Modified etc.
    7476         [ #  # ]:          0 :     }
    7477                 :          0 : }
    7478                 :            : 
    7479                 :          6 : sal_Bool SAL_CALL ScTableSheetObj::getPrintTitleColumns() throw(uno::RuntimeException)
    7480                 :            : {
    7481         [ +  - ]:          6 :     SolarMutexGuard aGuard;
    7482                 :          6 :     ScDocShell* pDocSh = GetDocShell();
    7483         [ +  - ]:          6 :     if ( pDocSh )
    7484                 :            :     {
    7485                 :          6 :         ScDocument* pDoc = pDocSh->GetDocument();
    7486         [ +  - ]:          6 :         SCTAB nTab = GetTab_Impl();
    7487         [ +  - ]:          6 :         return ( pDoc->GetRepeatColRange(nTab) != NULL );
    7488                 :            :     }
    7489         [ +  - ]:          6 :     return false;
    7490                 :            : }
    7491                 :            : 
    7492                 :          2 : void SAL_CALL ScTableSheetObj::setPrintTitleColumns( sal_Bool bPrintTitleColumns )
    7493                 :            :                                                     throw(uno::RuntimeException)
    7494                 :            : {
    7495         [ +  - ]:          2 :     SolarMutexGuard aGuard;
    7496                 :          2 :     ScDocShell* pDocSh = GetDocShell();
    7497         [ +  - ]:          2 :     if ( pDocSh )
    7498                 :            :     {
    7499                 :          2 :         ScDocument* pDoc = pDocSh->GetDocument();
    7500         [ +  - ]:          2 :         SCTAB nTab = GetTab_Impl();
    7501                 :            : 
    7502         [ +  - ]:          2 :         ScPrintRangeSaver* pOldRanges = pDoc->CreatePrintRangeSaver();
    7503                 :            : 
    7504         [ +  - ]:          2 :         if ( bPrintTitleColumns )
    7505                 :            :         {
    7506 [ +  - ][ +  - ]:          2 :             if ( !pDoc->GetRepeatColRange( nTab ) )         // keinen bestehenden Bereich veraendern
    7507                 :            :             {
    7508                 :          2 :                 ScRange aNew( 0, 0, nTab, 0, 0, nTab );     // Default
    7509         [ +  - ]:          2 :                 pDoc->SetRepeatColRange( nTab, &aNew );     // einschalten
    7510                 :            :             }
    7511                 :            :         }
    7512                 :            :         else
    7513         [ #  # ]:          0 :             pDoc->SetRepeatColRange( nTab, NULL );          // abschalten
    7514                 :            : 
    7515         [ +  - ]:          2 :         PrintAreaUndo_Impl( pOldRanges );   // Undo, Umbrueche, Modified etc.
    7516                 :            : 
    7517                 :            :         //! zuletzt gesetzten Bereich beim Abschalten merken und beim Einschalten wiederherstellen ???
    7518         [ +  - ]:          2 :     }
    7519                 :          2 : }
    7520                 :            : 
    7521                 :          4 : table::CellRangeAddress SAL_CALL ScTableSheetObj::getTitleColumns() throw(uno::RuntimeException)
    7522                 :            : {
    7523         [ +  - ]:          4 :     SolarMutexGuard aGuard;
    7524                 :          4 :     table::CellRangeAddress aRet;
    7525                 :          4 :     ScDocShell* pDocSh = GetDocShell();
    7526         [ +  - ]:          4 :     if ( pDocSh )
    7527                 :            :     {
    7528                 :          4 :         ScDocument* pDoc = pDocSh->GetDocument();
    7529         [ +  - ]:          4 :         SCTAB nTab = GetTab_Impl();
    7530         [ +  - ]:          4 :         const ScRange* pRange = pDoc->GetRepeatColRange(nTab);
    7531         [ -  + ]:          4 :         if (pRange)
    7532                 :            :         {
    7533                 :          0 :             ScUnoConversion::FillApiRange( aRet, *pRange );
    7534                 :          0 :             aRet.Sheet = nTab; // core does not care about sheet index
    7535                 :            :         }
    7536                 :            :     }
    7537         [ +  - ]:          4 :     return aRet;
    7538                 :            : }
    7539                 :            : 
    7540                 :          0 : void SAL_CALL ScTableSheetObj::setTitleColumns( const table::CellRangeAddress& aTitleColumns )
    7541                 :            :                                                     throw(uno::RuntimeException)
    7542                 :            : {
    7543         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    7544                 :          0 :     ScDocShell* pDocSh = GetDocShell();
    7545         [ #  # ]:          0 :     if ( pDocSh )
    7546                 :            :     {
    7547                 :          0 :         ScDocument* pDoc = pDocSh->GetDocument();
    7548         [ #  # ]:          0 :         SCTAB nTab = GetTab_Impl();
    7549                 :            : 
    7550         [ #  # ]:          0 :         ScPrintRangeSaver* pOldRanges = pDoc->CreatePrintRangeSaver();
    7551                 :            : 
    7552                 :          0 :         ScRange aNew;
    7553                 :          0 :         ScUnoConversion::FillScRange( aNew, aTitleColumns );
    7554         [ #  # ]:          0 :         pDoc->SetRepeatColRange( nTab, &aNew );     // immer auch einschalten
    7555                 :            : 
    7556         [ #  # ]:          0 :         PrintAreaUndo_Impl( pOldRanges );           // Undo, Umbrueche, Modified etc.
    7557         [ #  # ]:          0 :     }
    7558                 :          0 : }
    7559                 :            : 
    7560                 :          6 : sal_Bool SAL_CALL ScTableSheetObj::getPrintTitleRows() throw(uno::RuntimeException)
    7561                 :            : {
    7562         [ +  - ]:          6 :     SolarMutexGuard aGuard;
    7563                 :          6 :     ScDocShell* pDocSh = GetDocShell();
    7564         [ +  - ]:          6 :     if ( pDocSh )
    7565                 :            :     {
    7566                 :          6 :         ScDocument* pDoc = pDocSh->GetDocument();
    7567         [ +  - ]:          6 :         SCTAB nTab = GetTab_Impl();
    7568         [ +  - ]:          6 :         return ( pDoc->GetRepeatRowRange(nTab) != NULL );
    7569                 :            :     }
    7570         [ +  - ]:          6 :     return false;
    7571                 :            : }
    7572                 :            : 
    7573                 :          2 : void SAL_CALL ScTableSheetObj::setPrintTitleRows( sal_Bool bPrintTitleRows )
    7574                 :            :                                                 throw(uno::RuntimeException)
    7575                 :            : {
    7576         [ +  - ]:          2 :     SolarMutexGuard aGuard;
    7577                 :          2 :     ScDocShell* pDocSh = GetDocShell();
    7578         [ +  - ]:          2 :     if ( pDocSh )
    7579                 :            :     {
    7580                 :          2 :         ScDocument* pDoc = pDocSh->GetDocument();
    7581         [ +  - ]:          2 :         SCTAB nTab = GetTab_Impl();
    7582                 :            : 
    7583         [ +  - ]:          2 :         ScPrintRangeSaver* pOldRanges = pDoc->CreatePrintRangeSaver();
    7584                 :            : 
    7585         [ +  - ]:          2 :         if ( bPrintTitleRows )
    7586                 :            :         {
    7587 [ +  - ][ +  - ]:          2 :             if ( !pDoc->GetRepeatRowRange( nTab ) )         // keinen bestehenden Bereich veraendern
    7588                 :            :             {
    7589                 :          2 :                 ScRange aNew( 0, 0, nTab, 0, 0, nTab );     // Default
    7590         [ +  - ]:          2 :                 pDoc->SetRepeatRowRange( nTab, &aNew );     // einschalten
    7591                 :            :             }
    7592                 :            :         }
    7593                 :            :         else
    7594         [ #  # ]:          0 :             pDoc->SetRepeatRowRange( nTab, NULL );          // abschalten
    7595                 :            : 
    7596         [ +  - ]:          2 :         PrintAreaUndo_Impl( pOldRanges );   // Undo, Umbrueche, Modified etc.
    7597                 :            : 
    7598                 :            :         //! zuletzt gesetzten Bereich beim Abschalten merken und beim Einschalten wiederherstellen ???
    7599         [ +  - ]:          2 :     }
    7600                 :          2 : }
    7601                 :            : 
    7602                 :          4 : table::CellRangeAddress SAL_CALL ScTableSheetObj::getTitleRows() throw(uno::RuntimeException)
    7603                 :            : {
    7604         [ +  - ]:          4 :     SolarMutexGuard aGuard;
    7605                 :          4 :     table::CellRangeAddress aRet;
    7606                 :          4 :     ScDocShell* pDocSh = GetDocShell();
    7607         [ +  - ]:          4 :     if ( pDocSh )
    7608                 :            :     {
    7609                 :          4 :         ScDocument* pDoc = pDocSh->GetDocument();
    7610         [ +  - ]:          4 :         SCTAB nTab = GetTab_Impl();
    7611         [ +  - ]:          4 :         const ScRange* pRange = pDoc->GetRepeatRowRange(nTab);
    7612         [ -  + ]:          4 :         if (pRange)
    7613                 :            :         {
    7614                 :          0 :             ScUnoConversion::FillApiRange( aRet, *pRange );
    7615                 :          0 :             aRet.Sheet = nTab; // core does not care about sheet index
    7616                 :            :         }
    7617                 :            :     }
    7618         [ +  - ]:          4 :     return aRet;
    7619                 :            : }
    7620                 :            : 
    7621                 :          0 : void SAL_CALL ScTableSheetObj::setTitleRows( const table::CellRangeAddress& aTitleRows )
    7622                 :            :                                                     throw(uno::RuntimeException)
    7623                 :            : {
    7624         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    7625                 :          0 :     ScDocShell* pDocSh = GetDocShell();
    7626         [ #  # ]:          0 :     if ( pDocSh )
    7627                 :            :     {
    7628                 :          0 :         ScDocument* pDoc = pDocSh->GetDocument();
    7629         [ #  # ]:          0 :         SCTAB nTab = GetTab_Impl();
    7630                 :            : 
    7631         [ #  # ]:          0 :         ScPrintRangeSaver* pOldRanges = pDoc->CreatePrintRangeSaver();
    7632                 :            : 
    7633                 :          0 :         ScRange aNew;
    7634                 :          0 :         ScUnoConversion::FillScRange( aNew, aTitleRows );
    7635         [ #  # ]:          0 :         pDoc->SetRepeatRowRange( nTab, &aNew );     // immer auch einschalten
    7636                 :            : 
    7637         [ #  # ]:          0 :         PrintAreaUndo_Impl( pOldRanges );           // Undo, Umbrueche, Modified etc.
    7638         [ #  # ]:          0 :     }
    7639                 :          0 : }
    7640                 :            : 
    7641                 :            : // XSheetLinkable
    7642                 :            : 
    7643                 :          4 : sheet::SheetLinkMode SAL_CALL ScTableSheetObj::getLinkMode() throw(uno::RuntimeException)
    7644                 :            : {
    7645         [ +  - ]:          4 :     SolarMutexGuard aGuard;
    7646                 :          4 :     sheet::SheetLinkMode eRet = sheet::SheetLinkMode_NONE;
    7647                 :          4 :     ScDocShell* pDocSh = GetDocShell();
    7648         [ +  - ]:          4 :     if ( pDocSh )
    7649                 :            :     {
    7650 [ +  - ][ +  - ]:          4 :         sal_uInt8 nMode = pDocSh->GetDocument()->GetLinkMode( GetTab_Impl() );
    7651         [ -  + ]:          4 :         if ( nMode == SC_LINK_NORMAL )
    7652                 :          0 :             eRet = sheet::SheetLinkMode_NORMAL;
    7653         [ -  + ]:          4 :         else if ( nMode == SC_LINK_VALUE )
    7654                 :          0 :             eRet = sheet::SheetLinkMode_VALUE;
    7655                 :            :     }
    7656         [ +  - ]:          4 :     return eRet;
    7657                 :            : }
    7658                 :            : 
    7659                 :          0 : void SAL_CALL ScTableSheetObj::setLinkMode( sheet::SheetLinkMode nLinkMode )
    7660                 :            :                                                 throw(uno::RuntimeException)
    7661                 :            : {
    7662         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    7663                 :            : 
    7664                 :            :     //! Filter und Options aus altem Link suchen
    7665                 :            : 
    7666         [ #  # ]:          0 :     rtl::OUString aUrl(getLinkUrl());
    7667         [ #  # ]:          0 :     rtl::OUString aSheet(getLinkSheetName());
    7668                 :            : 
    7669                 :          0 :     rtl::OUString aEmpty;
    7670 [ #  # ][ #  # ]:          0 :     link( aUrl, aSheet, aEmpty, aEmpty, nLinkMode );
    7671                 :          0 : }
    7672                 :            : 
    7673                 :          0 : rtl::OUString SAL_CALL ScTableSheetObj::getLinkUrl() throw(uno::RuntimeException)
    7674                 :            : {
    7675         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    7676         [ #  # ]:          0 :     String aFile;
    7677                 :          0 :     ScDocShell* pDocSh = GetDocShell();
    7678         [ #  # ]:          0 :     if ( pDocSh )
    7679 [ #  # ][ #  # ]:          0 :         aFile = pDocSh->GetDocument()->GetLinkDoc( GetTab_Impl() );
                 [ #  # ]
    7680 [ #  # ][ #  # ]:          0 :     return aFile;
                 [ #  # ]
    7681                 :            : }
    7682                 :            : 
    7683                 :          0 : void SAL_CALL ScTableSheetObj::setLinkUrl( const rtl::OUString& aLinkUrl )
    7684                 :            :                                                 throw(uno::RuntimeException)
    7685                 :            : {
    7686         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    7687                 :            : 
    7688                 :            :     //! Filter und Options aus altem Link suchen
    7689                 :            : 
    7690         [ #  # ]:          0 :     sheet::SheetLinkMode eMode = getLinkMode();
    7691         [ #  # ]:          0 :     rtl::OUString aSheet(getLinkSheetName());
    7692                 :            : 
    7693                 :          0 :     rtl::OUString aEmpty;
    7694 [ #  # ][ #  # ]:          0 :     link( aLinkUrl, aSheet, aEmpty, aEmpty, eMode );
    7695                 :          0 : }
    7696                 :            : 
    7697                 :          0 : rtl::OUString SAL_CALL ScTableSheetObj::getLinkSheetName() throw(uno::RuntimeException)
    7698                 :            : {
    7699         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    7700         [ #  # ]:          0 :     String aSheet;
    7701                 :          0 :     ScDocShell* pDocSh = GetDocShell();
    7702         [ #  # ]:          0 :     if ( pDocSh )
    7703 [ #  # ][ #  # ]:          0 :         aSheet = pDocSh->GetDocument()->GetLinkTab( GetTab_Impl() );
                 [ #  # ]
    7704 [ #  # ][ #  # ]:          0 :     return aSheet;
                 [ #  # ]
    7705                 :            : }
    7706                 :            : 
    7707                 :          0 : void SAL_CALL ScTableSheetObj::setLinkSheetName( const rtl::OUString& aLinkSheetName )
    7708                 :            :                                                 throw(uno::RuntimeException)
    7709                 :            : {
    7710         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    7711                 :            : 
    7712                 :            :     //! Filter und Options aus altem Link suchen
    7713                 :            : 
    7714         [ #  # ]:          0 :     sheet::SheetLinkMode eMode = getLinkMode();
    7715         [ #  # ]:          0 :     rtl::OUString aUrl(getLinkUrl());
    7716                 :            : 
    7717                 :          0 :     rtl::OUString aEmpty;
    7718 [ #  # ][ #  # ]:          0 :     link( aUrl, aLinkSheetName, aEmpty, aEmpty, eMode );
    7719                 :          0 : }
    7720                 :            : 
    7721                 :          2 : void SAL_CALL ScTableSheetObj::link( const rtl::OUString& aUrl, const rtl::OUString& aSheetName,
    7722                 :            :                         const rtl::OUString& aFilterName, const rtl::OUString& aFilterOptions,
    7723                 :            :                         sheet::SheetLinkMode nMode ) throw(uno::RuntimeException)
    7724                 :            : {
    7725         [ +  - ]:          2 :     SolarMutexGuard aGuard;
    7726                 :          2 :     ScDocShell* pDocSh = GetDocShell();
    7727         [ +  - ]:          2 :     if ( pDocSh )
    7728                 :            :     {
    7729                 :          2 :         ScDocument* pDoc = pDocSh->GetDocument();
    7730         [ +  - ]:          2 :         SCTAB nTab = GetTab_Impl();
    7731                 :            : 
    7732                 :          2 :         rtl::OUString aFileString = aUrl;
    7733                 :          2 :         rtl::OUString aFilterString = aFilterName;
    7734                 :          2 :         rtl::OUString aOptString = aFilterOptions;
    7735                 :          2 :         rtl::OUString aSheetString = aSheetName;
    7736                 :            : 
    7737 [ +  - ][ +  - ]:          2 :         aFileString = ScGlobal::GetAbsDocName( aFileString, pDocSh );
         [ +  - ][ +  - ]
                 [ +  - ]
    7738         [ +  - ]:          2 :         if (aFilterString.isEmpty())
    7739         [ +  - ]:          2 :             ScDocumentLoader::GetFilterName( aFileString, aFilterString, aOptString, true, false );
    7740                 :            : 
    7741                 :            :         //  remove application prefix from filter name here, so the filter options
    7742                 :            :         //  aren't reset when the filter name is changed in ScTableLink::DataChanged
    7743         [ +  - ]:          2 :         ScDocumentLoader::RemoveAppPrefix( aFilterString );
    7744                 :            : 
    7745                 :          2 :         sal_uInt8 nLinkMode = SC_LINK_NONE;
    7746         [ -  + ]:          2 :         if ( nMode == sheet::SheetLinkMode_NORMAL )
    7747                 :          0 :             nLinkMode = SC_LINK_NORMAL;
    7748         [ +  - ]:          2 :         else if ( nMode == sheet::SheetLinkMode_VALUE )
    7749                 :          2 :             nLinkMode = SC_LINK_VALUE;
    7750                 :            : 
    7751                 :          2 :         sal_uLong nRefresh = 0;
    7752         [ +  - ]:          2 :         pDoc->SetLink( nTab, nLinkMode, aFileString, aFilterString, aOptString, aSheetString, nRefresh );
    7753                 :            : 
    7754         [ +  - ]:          2 :         pDocSh->UpdateLinks();                  // ggf. Link eintragen oder loeschen
    7755         [ +  - ]:          2 :         SfxBindings* pBindings = pDocSh->GetViewBindings();
    7756         [ +  - ]:          2 :         if (pBindings)
    7757         [ +  - ]:          2 :             pBindings->Invalidate(SID_LINKS);
    7758                 :            : 
    7759                 :            :         //! Undo fuer Link-Daten an der Table
    7760                 :            : 
    7761 [ +  - ][ +  - ]:          2 :         if ( nLinkMode != SC_LINK_NONE && pDoc->IsExecuteLinkEnabled() )        // Link updaten
                 [ +  - ]
    7762                 :            :         {
    7763                 :            :             //  Update immer, auch wenn der Link schon da war
    7764                 :            :             //! Update nur fuer die betroffene Tabelle???
    7765                 :            : 
    7766         [ +  - ]:          2 :             sfx2::LinkManager* pLinkManager = pDoc->GetLinkManager();
    7767                 :          2 :             sal_uInt16 nCount = pLinkManager->GetLinks().size();
    7768         [ +  + ]:          4 :             for ( sal_uInt16 i=0; i<nCount; i++ )
    7769                 :            :             {
    7770                 :          2 :                 ::sfx2::SvBaseLink* pBase = *pLinkManager->GetLinks()[i];
    7771 [ +  - ][ +  - ]:          2 :                 if (pBase->ISA(ScTableLink))
                 [ +  - ]
    7772                 :            :                 {
    7773                 :          2 :                     ScTableLink* pTabLink = (ScTableLink*)pBase;
    7774         [ +  - ]:          2 :                     if ( aFileString.equals(pTabLink->GetFileName()) )
    7775         [ +  - ]:          2 :                         pTabLink->Update();                         // inkl. Paint&Undo
    7776                 :            : 
    7777                 :            :                     //! Der Dateiname sollte nur einmal vorkommen (?)
    7778                 :            :                 }
    7779                 :            :             }
    7780                 :          2 :         }
    7781                 :            : 
    7782                 :            :         //! Notify fuer ScSheetLinkObj Objekte!!!
    7783         [ +  - ]:          2 :     }
    7784                 :          2 : }
    7785                 :            : 
    7786                 :            : // XSheetAuditing
    7787                 :            : 
    7788                 :          0 : sal_Bool SAL_CALL ScTableSheetObj::hideDependents( const table::CellAddress& aPosition )
    7789                 :            :                                                 throw(uno::RuntimeException)
    7790                 :            : {
    7791         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    7792                 :          0 :     ScDocShell* pDocSh = GetDocShell();
    7793         [ #  # ]:          0 :     if ( pDocSh )
    7794                 :            :     {
    7795         [ #  # ]:          0 :         SCTAB nTab = GetTab_Impl();
    7796                 :            :         OSL_ENSURE( aPosition.Sheet == nTab, "falsche Tabelle in CellAddress" );
    7797                 :          0 :         ScAddress aPos( (SCCOL)aPosition.Column, (SCROW)aPosition.Row, nTab );
    7798         [ #  # ]:          0 :         return pDocSh->GetDocFunc().DetectiveDelSucc( aPos );
    7799                 :            :     }
    7800         [ #  # ]:          0 :     return false;
    7801                 :            : }
    7802                 :            : 
    7803                 :          0 : sal_Bool SAL_CALL ScTableSheetObj::hidePrecedents( const table::CellAddress& aPosition )
    7804                 :            :                                             throw(uno::RuntimeException)
    7805                 :            : {
    7806         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    7807                 :          0 :     ScDocShell* pDocSh = GetDocShell();
    7808         [ #  # ]:          0 :     if ( pDocSh )
    7809                 :            :     {
    7810         [ #  # ]:          0 :         SCTAB nTab = GetTab_Impl();
    7811                 :            :         OSL_ENSURE( aPosition.Sheet == nTab, "falsche Tabelle in CellAddress" );
    7812                 :          0 :         ScAddress aPos( (SCCOL)aPosition.Column, (SCROW)aPosition.Row, nTab );
    7813         [ #  # ]:          0 :         return pDocSh->GetDocFunc().DetectiveDelPred( aPos );
    7814                 :            :     }
    7815         [ #  # ]:          0 :     return false;
    7816                 :            : }
    7817                 :            : 
    7818                 :          0 : sal_Bool SAL_CALL ScTableSheetObj::showDependents( const table::CellAddress& aPosition )
    7819                 :            :                                             throw(uno::RuntimeException)
    7820                 :            : {
    7821         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    7822                 :          0 :     ScDocShell* pDocSh = GetDocShell();
    7823         [ #  # ]:          0 :     if ( pDocSh )
    7824                 :            :     {
    7825         [ #  # ]:          0 :         SCTAB nTab = GetTab_Impl();
    7826                 :            :         OSL_ENSURE( aPosition.Sheet == nTab, "falsche Tabelle in CellAddress" );
    7827                 :          0 :         ScAddress aPos( (SCCOL)aPosition.Column, (SCROW)aPosition.Row, nTab );
    7828         [ #  # ]:          0 :         return pDocSh->GetDocFunc().DetectiveAddSucc( aPos );
    7829                 :            :     }
    7830         [ #  # ]:          0 :     return false;
    7831                 :            : }
    7832                 :            : 
    7833                 :          1 : sal_Bool SAL_CALL ScTableSheetObj::showPrecedents( const table::CellAddress& aPosition )
    7834                 :            :                                             throw(uno::RuntimeException)
    7835                 :            : {
    7836         [ +  - ]:          1 :     SolarMutexGuard aGuard;
    7837                 :          1 :     ScDocShell* pDocSh = GetDocShell();
    7838         [ +  - ]:          1 :     if ( pDocSh )
    7839                 :            :     {
    7840         [ +  - ]:          1 :         SCTAB nTab = GetTab_Impl();
    7841                 :            :         OSL_ENSURE( aPosition.Sheet == nTab, "falsche Tabelle in CellAddress" );
    7842                 :          1 :         ScAddress aPos( (SCCOL)aPosition.Column, (SCROW)aPosition.Row, nTab );
    7843         [ +  - ]:          1 :         return pDocSh->GetDocFunc().DetectiveAddPred( aPos );
    7844                 :            :     }
    7845         [ +  - ]:          1 :     return false;
    7846                 :            : }
    7847                 :            : 
    7848                 :          0 : sal_Bool SAL_CALL ScTableSheetObj::showErrors( const table::CellAddress& aPosition )
    7849                 :            :                                             throw(uno::RuntimeException)
    7850                 :            : {
    7851         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    7852                 :          0 :     ScDocShell* pDocSh = GetDocShell();
    7853         [ #  # ]:          0 :     if ( pDocSh )
    7854                 :            :     {
    7855         [ #  # ]:          0 :         SCTAB nTab = GetTab_Impl();
    7856                 :            :         OSL_ENSURE( aPosition.Sheet == nTab, "falsche Tabelle in CellAddress" );
    7857                 :          0 :         ScAddress aPos( (SCCOL)aPosition.Column, (SCROW)aPosition.Row, nTab );
    7858         [ #  # ]:          0 :         return pDocSh->GetDocFunc().DetectiveAddError( aPos );
    7859                 :            :     }
    7860         [ #  # ]:          0 :     return false;
    7861                 :            : }
    7862                 :            : 
    7863                 :          0 : sal_Bool SAL_CALL ScTableSheetObj::showInvalid() throw(uno::RuntimeException)
    7864                 :            : {
    7865         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    7866                 :          0 :     ScDocShell* pDocSh = GetDocShell();
    7867         [ #  # ]:          0 :     if ( pDocSh )
    7868 [ #  # ][ #  # ]:          0 :         return pDocSh->GetDocFunc().DetectiveMarkInvalid( GetTab_Impl() );
    7869         [ #  # ]:          0 :     return false;
    7870                 :            : }
    7871                 :            : 
    7872                 :          0 : void SAL_CALL ScTableSheetObj::clearArrows() throw(uno::RuntimeException)
    7873                 :            : {
    7874         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    7875                 :          0 :     ScDocShell* pDocSh = GetDocShell();
    7876         [ #  # ]:          0 :     if ( pDocSh )
    7877 [ #  # ][ #  # ]:          0 :         pDocSh->GetDocFunc().DetectiveDelAll( GetTab_Impl() );
                 [ #  # ]
    7878                 :          0 : }
    7879                 :            : 
    7880                 :            : // XSheetOutline
    7881                 :            : 
    7882                 :          0 : void SAL_CALL ScTableSheetObj::group( const table::CellRangeAddress& rGroupRange,
    7883                 :            :                                         table::TableOrientation nOrientation )
    7884                 :            :                                     throw(uno::RuntimeException)
    7885                 :            : {
    7886         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    7887                 :          0 :     ScDocShell* pDocSh = GetDocShell();
    7888         [ #  # ]:          0 :     if ( pDocSh )
    7889                 :            :     {
    7890                 :          0 :         sal_Bool bColumns = ( nOrientation == table::TableOrientation_COLUMNS );
    7891                 :          0 :         ScRange aGroupRange;
    7892                 :          0 :         ScUnoConversion::FillScRange( aGroupRange, rGroupRange );
    7893                 :          0 :         ScOutlineDocFunc aFunc(*pDocSh);
    7894         [ #  # ]:          0 :         aFunc.MakeOutline( aGroupRange, bColumns, sal_True, sal_True );
    7895         [ #  # ]:          0 :     }
    7896                 :          0 : }
    7897                 :            : 
    7898                 :          0 : void SAL_CALL ScTableSheetObj::ungroup( const table::CellRangeAddress& rGroupRange,
    7899                 :            :                                         table::TableOrientation nOrientation )
    7900                 :            :                                     throw(uno::RuntimeException)
    7901                 :            : {
    7902         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    7903                 :          0 :     ScDocShell* pDocSh = GetDocShell();
    7904         [ #  # ]:          0 :     if ( pDocSh )
    7905                 :            :     {
    7906                 :          0 :         sal_Bool bColumns = ( nOrientation == table::TableOrientation_COLUMNS );
    7907                 :          0 :         ScRange aGroupRange;
    7908                 :          0 :         ScUnoConversion::FillScRange( aGroupRange, rGroupRange );
    7909                 :          0 :         ScOutlineDocFunc aFunc(*pDocSh);
    7910         [ #  # ]:          0 :         aFunc.RemoveOutline( aGroupRange, bColumns, sal_True, sal_True );
    7911         [ #  # ]:          0 :     }
    7912                 :          0 : }
    7913                 :            : 
    7914                 :          0 : void SAL_CALL ScTableSheetObj::autoOutline( const table::CellRangeAddress& rCellRange )
    7915                 :            :                                     throw(uno::RuntimeException)
    7916                 :            : {
    7917         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    7918                 :          0 :     ScDocShell* pDocSh = GetDocShell();
    7919         [ #  # ]:          0 :     if ( pDocSh )
    7920                 :            :     {
    7921                 :          0 :         ScRange aFormulaRange;
    7922                 :          0 :         ScUnoConversion::FillScRange( aFormulaRange, rCellRange );
    7923                 :          0 :         ScOutlineDocFunc aFunc(*pDocSh);
    7924         [ #  # ]:          0 :         aFunc.AutoOutline( aFormulaRange, sal_True, sal_True );
    7925         [ #  # ]:          0 :     }
    7926                 :          0 : }
    7927                 :            : 
    7928                 :          0 : void SAL_CALL ScTableSheetObj::clearOutline() throw(uno::RuntimeException)
    7929                 :            : {
    7930         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    7931                 :          0 :     ScDocShell* pDocSh = GetDocShell();
    7932         [ #  # ]:          0 :     if ( pDocSh )
    7933                 :            :     {
    7934         [ #  # ]:          0 :         SCTAB nTab = GetTab_Impl();
    7935                 :          0 :         ScOutlineDocFunc aFunc(*pDocSh);
    7936         [ #  # ]:          0 :         aFunc.RemoveAllOutlines( nTab, sal_True, sal_True );
    7937         [ #  # ]:          0 :     }
    7938                 :          0 : }
    7939                 :            : 
    7940                 :          0 : void SAL_CALL ScTableSheetObj::hideDetail( const table::CellRangeAddress& rCellRange )
    7941                 :            :                                             throw(uno::RuntimeException)
    7942                 :            : {
    7943         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    7944                 :          0 :     ScDocShell* pDocSh = GetDocShell();
    7945         [ #  # ]:          0 :     if ( pDocSh )
    7946                 :            :     {
    7947                 :          0 :         ScRange aMarkRange;
    7948                 :          0 :         ScUnoConversion::FillScRange( aMarkRange, rCellRange );
    7949                 :          0 :         ScOutlineDocFunc aFunc(*pDocSh);
    7950         [ #  # ]:          0 :         aFunc.HideMarkedOutlines( aMarkRange, sal_True, sal_True );
    7951         [ #  # ]:          0 :     }
    7952                 :          0 : }
    7953                 :            : 
    7954                 :          0 : void SAL_CALL ScTableSheetObj::showDetail( const table::CellRangeAddress& rCellRange )
    7955                 :            :                                             throw(uno::RuntimeException)
    7956                 :            : {
    7957         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    7958                 :          0 :     ScDocShell* pDocSh = GetDocShell();
    7959         [ #  # ]:          0 :     if ( pDocSh )
    7960                 :            :     {
    7961                 :          0 :         ScRange aMarkRange;
    7962                 :          0 :         ScUnoConversion::FillScRange( aMarkRange, rCellRange );
    7963                 :          0 :         ScOutlineDocFunc aFunc(*pDocSh);
    7964         [ #  # ]:          0 :         aFunc.ShowMarkedOutlines( aMarkRange, sal_True );
    7965         [ #  # ]:          0 :     }
    7966                 :          0 : }
    7967                 :            : 
    7968                 :          0 : void SAL_CALL ScTableSheetObj::showLevel( sal_Int16 nLevel, table::TableOrientation nOrientation )
    7969                 :            :                                             throw(uno::RuntimeException)
    7970                 :            : {
    7971         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    7972                 :          0 :     ScDocShell* pDocSh = GetDocShell();
    7973         [ #  # ]:          0 :     if ( pDocSh )
    7974                 :            :     {
    7975                 :          0 :         sal_Bool bColumns = ( nOrientation == table::TableOrientation_COLUMNS );
    7976         [ #  # ]:          0 :         SCTAB nTab = GetTab_Impl();
    7977                 :          0 :         ScOutlineDocFunc aFunc(*pDocSh);
    7978         [ #  # ]:          0 :         aFunc.SelectLevel( nTab, bColumns, nLevel, sal_True, sal_True, sal_True );
    7979         [ #  # ]:          0 :     }
    7980                 :          0 : }
    7981                 :            : 
    7982                 :            : // XProtectable
    7983                 :            : 
    7984                 :          0 : void SAL_CALL ScTableSheetObj::protect( const rtl::OUString& aPassword )
    7985                 :            :                                             throw(uno::RuntimeException)
    7986                 :            : {
    7987         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    7988                 :          0 :     ScDocShell* pDocSh = GetDocShell();
    7989                 :            :     // #i108245# if already protected, don't change anything
    7990 [ #  # ][ #  # ]:          0 :     if ( pDocSh && !pDocSh->GetDocument()->IsTabProtected( GetTab_Impl() ) )
         [ #  # ][ #  # ]
                 [ #  # ]
    7991                 :            :     {
    7992         [ #  # ]:          0 :         String aString(aPassword);
    7993 [ #  # ][ #  # ]:          0 :         pDocSh->GetDocFunc().Protect( GetTab_Impl(), aString, sal_True );
                 [ #  # ]
    7994         [ #  # ]:          0 :     }
    7995                 :          0 : }
    7996                 :            : 
    7997                 :          0 : void SAL_CALL ScTableSheetObj::unprotect( const rtl::OUString& aPassword )
    7998                 :            :                             throw(lang::IllegalArgumentException, uno::RuntimeException)
    7999                 :            : {
    8000         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    8001                 :          0 :     ScDocShell* pDocSh = GetDocShell();
    8002         [ #  # ]:          0 :     if ( pDocSh )
    8003                 :            :     {
    8004         [ #  # ]:          0 :         String aString(aPassword);
    8005 [ #  # ][ #  # ]:          0 :         sal_Bool bDone = pDocSh->GetDocFunc().Unprotect( GetTab_Impl(), aString, sal_True );
    8006         [ #  # ]:          0 :         if (!bDone)
    8007 [ #  # ][ #  # ]:          0 :             throw lang::IllegalArgumentException();
    8008         [ #  # ]:          0 :     }
    8009                 :          0 : }
    8010                 :            : 
    8011                 :          4 : sal_Bool SAL_CALL ScTableSheetObj::isProtected() throw(uno::RuntimeException)
    8012                 :            : {
    8013         [ +  - ]:          4 :     SolarMutexGuard aGuard;
    8014                 :          4 :     ScDocShell* pDocSh = GetDocShell();
    8015         [ +  - ]:          4 :     if ( pDocSh )
    8016 [ +  - ][ +  - ]:          4 :         return pDocSh->GetDocument()->IsTabProtected( GetTab_Impl() );
    8017                 :            : 
    8018                 :            :     OSL_FAIL("keine DocShell");     //! Exception oder so?
    8019         [ +  - ]:          4 :     return false;
    8020                 :            : }
    8021                 :            : 
    8022                 :            : // XScenario
    8023                 :            : 
    8024                 :          0 : sal_Bool SAL_CALL ScTableSheetObj::getIsScenario() throw(uno::RuntimeException)
    8025                 :            : {
    8026         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    8027                 :          0 :     ScDocShell* pDocSh = GetDocShell();
    8028         [ #  # ]:          0 :     if ( pDocSh )
    8029 [ #  # ][ #  # ]:          0 :         return pDocSh->GetDocument()->IsScenario( GetTab_Impl() );
    8030                 :            : 
    8031         [ #  # ]:          0 :     return false;
    8032                 :            : }
    8033                 :            : 
    8034                 :          0 : rtl::OUString SAL_CALL ScTableSheetObj::getScenarioComment() throw(uno::RuntimeException)
    8035                 :            : {
    8036         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    8037                 :          0 :     ScDocShell* pDocSh = GetDocShell();
    8038         [ #  # ]:          0 :     if ( pDocSh )
    8039                 :            :     {
    8040                 :          0 :         rtl::OUString aComment;
    8041                 :          0 :         Color  aColor;
    8042                 :            :         sal_uInt16 nFlags;
    8043 [ #  # ][ #  # ]:          0 :         pDocSh->GetDocument()->GetScenarioData( GetTab_Impl(), aComment, aColor, nFlags );
    8044                 :          0 :         return aComment;
    8045                 :            :     }
    8046         [ #  # ]:          0 :     return rtl::OUString();
    8047                 :            : }
    8048                 :            : 
    8049                 :          0 : void SAL_CALL ScTableSheetObj::setScenarioComment( const rtl::OUString& aScenarioComment )
    8050                 :            :                                                 throw(uno::RuntimeException)
    8051                 :            : {
    8052         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    8053                 :          0 :     ScDocShell* pDocSh = GetDocShell();
    8054         [ #  # ]:          0 :     if ( pDocSh )
    8055                 :            :     {
    8056                 :          0 :         ScDocument* pDoc = pDocSh->GetDocument();
    8057         [ #  # ]:          0 :         SCTAB nTab = GetTab_Impl();
    8058                 :            : 
    8059                 :          0 :         rtl::OUString aName;
    8060                 :          0 :         rtl::OUString aComment;
    8061                 :          0 :         Color  aColor;
    8062                 :            :         sal_uInt16 nFlags;
    8063         [ #  # ]:          0 :         pDoc->GetName( nTab, aName );
    8064         [ #  # ]:          0 :         pDoc->GetScenarioData( nTab, aComment, aColor, nFlags );
    8065                 :            : 
    8066 [ #  # ][ #  # ]:          0 :         aComment = String( aScenarioComment );
                 [ #  # ]
    8067                 :            : 
    8068 [ #  # ][ #  # ]:          0 :         pDocSh->ModifyScenario( nTab, aName, aComment, aColor, nFlags );
         [ #  # ][ #  # ]
                 [ #  # ]
    8069         [ #  # ]:          0 :     }
    8070                 :          0 : }
    8071                 :            : 
    8072                 :          0 : void SAL_CALL ScTableSheetObj::addRanges( const uno::Sequence<table::CellRangeAddress>& rScenRanges )
    8073                 :            :                                                 throw(uno::RuntimeException)
    8074                 :            : {
    8075         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    8076                 :          0 :     ScDocShell* pDocSh = GetDocShell();
    8077         [ #  # ]:          0 :     if ( pDocSh )
    8078                 :            :     {
    8079                 :          0 :         ScDocument* pDoc = pDocSh->GetDocument();
    8080         [ #  # ]:          0 :         SCTAB nTab = GetTab_Impl();
    8081                 :            : 
    8082 [ #  # ][ #  # ]:          0 :         if (pDoc->IsScenario(nTab))
    8083                 :            :         {
    8084         [ #  # ]:          0 :             ScMarkData aMarkData;
    8085         [ #  # ]:          0 :             aMarkData.SelectTable( nTab, sal_True );
    8086                 :            : 
    8087                 :          0 :             sal_uInt16 nRangeCount = (sal_uInt16)rScenRanges.getLength();
    8088         [ #  # ]:          0 :             if (nRangeCount)
    8089                 :            :             {
    8090                 :          0 :                 const table::CellRangeAddress* pAry = rScenRanges.getConstArray();
    8091         [ #  # ]:          0 :                 for (sal_uInt16 i=0; i<nRangeCount; i++)
    8092                 :            :                 {
    8093                 :            :                     OSL_ENSURE( pAry[i].Sheet == nTab, "addRanges mit falscher Tab" );
    8094                 :          0 :                     ScRange aOneRange( (SCCOL)pAry[i].StartColumn, (SCROW)pAry[i].StartRow, nTab,
    8095                 :          0 :                                        (SCCOL)pAry[i].EndColumn,   (SCROW)pAry[i].EndRow,   nTab );
    8096                 :            : 
    8097         [ #  # ]:          0 :                     aMarkData.SetMultiMarkArea( aOneRange );
    8098                 :            :                 }
    8099                 :            :             }
    8100                 :            : 
    8101                 :            :             //  Szenario-Ranges sind durch Attribut gekennzeichnet
    8102 [ #  # ][ #  # ]:          0 :             ScPatternAttr aPattern( pDoc->GetPool() );
    8103 [ #  # ][ #  # ]:          0 :             aPattern.GetItemSet().Put( ScMergeFlagAttr( SC_MF_SCENARIO ) );
                 [ #  # ]
    8104 [ #  # ][ #  # ]:          0 :             aPattern.GetItemSet().Put( ScProtectionAttr( sal_True ) );
                 [ #  # ]
    8105 [ #  # ][ #  # ]:          0 :             pDocSh->GetDocFunc().ApplyAttributes( aMarkData, aPattern, sal_True, sal_True );
                 [ #  # ]
    8106                 :            :         }
    8107         [ #  # ]:          0 :     }
    8108                 :          0 : }
    8109                 :            : 
    8110                 :          0 : void SAL_CALL ScTableSheetObj::apply() throw(uno::RuntimeException)
    8111                 :            : {
    8112         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    8113                 :          0 :     ScDocShell* pDocSh = GetDocShell();
    8114         [ #  # ]:          0 :     if ( pDocSh )
    8115                 :            :     {
    8116                 :          0 :         ScDocument* pDoc = pDocSh->GetDocument();
    8117         [ #  # ]:          0 :         SCTAB nTab = GetTab_Impl();
    8118                 :          0 :         rtl::OUString aName;
    8119         [ #  # ]:          0 :         pDoc->GetName( nTab, aName );       // Name dieses Szenarios
    8120                 :            : 
    8121                 :          0 :         SCTAB nDestTab = nTab;
    8122 [ #  # ][ #  # ]:          0 :         while ( nDestTab > 0 && pDoc->IsScenario(nDestTab) )
         [ #  # ][ #  # ]
    8123                 :          0 :             --nDestTab;
    8124                 :            : 
    8125 [ #  # ][ #  # ]:          0 :         if ( !pDoc->IsScenario(nDestTab) )
    8126 [ #  # ][ #  # ]:          0 :             pDocSh->UseScenario( nDestTab, aName );
                 [ #  # ]
    8127                 :            : 
    8128                 :            :         //! sonst Fehler oder so
    8129         [ #  # ]:          0 :     }
    8130                 :          0 : }
    8131                 :            : 
    8132                 :            : // XScenarioEnhanced
    8133                 :            : 
    8134                 :          0 : uno::Sequence< table::CellRangeAddress > SAL_CALL ScTableSheetObj::getRanges(  )
    8135                 :            :                                     throw(uno::RuntimeException)
    8136                 :            : {
    8137         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    8138                 :          0 :     ScDocShell* pDocSh = GetDocShell();
    8139         [ #  # ]:          0 :     if ( pDocSh )
    8140                 :            :     {
    8141                 :          0 :         ScDocument* pDoc = pDocSh->GetDocument();
    8142         [ #  # ]:          0 :         SCTAB nTab = GetTab_Impl();
    8143         [ #  # ]:          0 :         const ScRangeList* pRangeList = pDoc->GetScenarioRanges(nTab);
    8144         [ #  # ]:          0 :         if (pRangeList)
    8145                 :            :         {
    8146         [ #  # ]:          0 :             size_t nCount = pRangeList->size();
    8147         [ #  # ]:          0 :             uno::Sequence< table::CellRangeAddress > aRetRanges( nCount );
    8148         [ #  # ]:          0 :             table::CellRangeAddress* pAry = aRetRanges.getArray();
    8149         [ #  # ]:          0 :             for( size_t nIndex = 0; nIndex < nCount; nIndex++ )
    8150                 :            :             {
    8151         [ #  # ]:          0 :                 const ScRange* pRange = (*pRangeList)[nIndex];
    8152                 :          0 :                 pAry->StartColumn = pRange->aStart.Col();
    8153                 :          0 :                 pAry->StartRow = pRange->aStart.Row();
    8154                 :          0 :                 pAry->EndColumn = pRange->aEnd.Col();
    8155                 :          0 :                 pAry->EndRow = pRange->aEnd.Row();
    8156                 :          0 :                 pAry->Sheet = pRange->aStart.Tab();
    8157                 :          0 :                 ++pAry;
    8158                 :            :             }
    8159 [ #  # ][ #  # ]:          0 :             return aRetRanges;
    8160                 :            :         }
    8161                 :            :     }
    8162 [ #  # ][ #  # ]:          0 :     return uno::Sequence< table::CellRangeAddress > ();
    8163                 :            : }
    8164                 :            : 
    8165                 :            : // XExternalSheetName
    8166                 :            : 
    8167                 :          0 : void ScTableSheetObj::setExternalName( const ::rtl::OUString& aUrl, const ::rtl::OUString& aSheetName )
    8168                 :            :     throw (container::ElementExistException, uno::RuntimeException)
    8169                 :            : {
    8170         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    8171                 :          0 :     ScDocShell* pDocSh = GetDocShell();
    8172         [ #  # ]:          0 :     if ( pDocSh )
    8173                 :            :     {
    8174                 :          0 :         ScDocument* pDoc = pDocSh->GetDocument();
    8175         [ #  # ]:          0 :         if ( pDoc )
    8176                 :            :         {
    8177         [ #  # ]:          0 :             const SCTAB nTab = GetTab_Impl();
    8178 [ #  # ][ #  # ]:          0 :             const String aAbsDocName( ScGlobal::GetAbsDocName( aUrl, pDocSh ) );
                 [ #  # ]
    8179 [ #  # ][ #  # ]:          0 :             const String aDocTabName( ScGlobal::GetDocTabName( aAbsDocName, aSheetName ) );
                 [ #  # ]
    8180 [ #  # ][ #  # ]:          0 :             if ( !pDoc->RenameTab( nTab, aDocTabName, false /*bUpdateRef*/, sal_True /*bExternalDocument*/ ) )
                 [ #  # ]
    8181                 :            :             {
    8182 [ #  # ][ #  # ]:          0 :                 throw container::ElementExistException( ::rtl::OUString(), *this );
    8183 [ #  # ][ #  # ]:          0 :             }
    8184                 :            :         }
    8185         [ #  # ]:          0 :     }
    8186                 :          0 : }
    8187                 :            : 
    8188                 :            : // XEventsSupplier
    8189                 :            : 
    8190                 :          0 : uno::Reference<container::XNameReplace> SAL_CALL ScTableSheetObj::getEvents() throw (uno::RuntimeException)
    8191                 :            : {
    8192         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    8193                 :          0 :     ScDocShell* pDocSh = GetDocShell();
    8194         [ #  # ]:          0 :     if ( pDocSh )
    8195 [ #  # ][ #  # ]:          0 :         return new ScSheetEventsObj( pDocSh, GetTab_Impl() );
         [ #  # ][ #  # ]
    8196                 :            : 
    8197 [ #  # ][ #  # ]:          0 :     return NULL;
    8198                 :            : }
    8199                 :            : 
    8200                 :            : // XPropertySet erweitert fuer Sheet-Properties
    8201                 :            : 
    8202                 :        288 : uno::Reference<beans::XPropertySetInfo> SAL_CALL ScTableSheetObj::getPropertySetInfo()
    8203                 :            :                                                         throw(uno::RuntimeException)
    8204                 :            : {
    8205         [ +  - ]:        288 :     SolarMutexGuard aGuard;
    8206                 :            :     static uno::Reference<beans::XPropertySetInfo> aRef(
    8207 [ +  + ][ +  - ]:        288 :         new SfxItemPropertySetInfo( pSheetPropSet->getPropertyMap() ));
         [ +  - ][ +  - ]
         [ +  - ][ #  # ]
    8208         [ +  - ]:        288 :     return aRef;
    8209                 :            : }
    8210                 :            : 
    8211                 :        999 : void ScTableSheetObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry, const uno::Any& aValue )
    8212                 :            :                                 throw(lang::IllegalArgumentException, uno::RuntimeException)
    8213                 :            : {
    8214         [ +  - ]:        999 :     if ( pEntry )
    8215                 :            :     {
    8216         [ -  + ]:        999 :         if ( IsScItemWid( pEntry->nWID ) )
    8217                 :            :         {
    8218                 :            :             //  for Item WIDs, call ScCellRangesBase directly
    8219                 :          0 :             ScCellRangesBase::SetOnePropertyValue(pEntry, aValue);
    8220                 :          0 :             return;
    8221                 :            :         }
    8222                 :            : 
    8223                 :            :         //  own properties
    8224                 :            : 
    8225                 :        999 :         ScDocShell* pDocSh = GetDocShell();
    8226         [ -  + ]:        999 :         if (!pDocSh)
    8227                 :          0 :             return;                                                 //! Exception oder so?
    8228                 :        999 :         ScDocument* pDoc = pDocSh->GetDocument();
    8229                 :        999 :         SCTAB nTab = GetTab_Impl();
    8230                 :        999 :         ScDocFunc &rFunc = pDocSh->GetDocFunc();
    8231                 :            : 
    8232         [ +  + ]:        999 :         if ( pEntry->nWID == SC_WID_UNO_PAGESTL )
    8233                 :            :         {
    8234                 :        288 :             rtl::OUString aStrVal;
    8235                 :        288 :             aValue >>= aStrVal;
    8236                 :            :             rtl::OUString aNewStr(ScStyleNameConversion::ProgrammaticToDisplayName(
    8237 [ +  - ][ +  - ]:        288 :                                                 aStrVal, SFX_STYLE_FAMILY_PAGE ));
         [ +  - ][ +  - ]
                 [ +  - ]
    8238                 :            : 
    8239                 :            :             //! Undo? (auch bei SID_STYLE_APPLY an der View)
    8240                 :            : 
    8241 [ +  - ][ +  + ]:        288 :             if ( pDoc->GetPageStyle( nTab ) != aNewStr )
    8242                 :            :             {
    8243         [ +  - ]:         70 :                 pDoc->SetPageStyle( nTab, aNewStr );
    8244         [ +  + ]:         70 :                 if (!pDoc->IsImportingXML())
    8245                 :            :                 {
    8246 [ +  - ][ +  - ]:         64 :                     ScPrintFunc( pDocSh, pDocSh->GetPrinter(), nTab ).UpdatePages();
         [ +  - ][ +  - ]
    8247                 :            : 
    8248         [ +  - ]:         64 :                     SfxBindings* pBindings = pDocSh->GetViewBindings();
    8249         [ +  + ]:         64 :                     if (pBindings)
    8250                 :            :                     {
    8251         [ +  - ]:          4 :                         pBindings->Invalidate( SID_STYLE_FAMILY4 );
    8252         [ +  - ]:          4 :                         pBindings->Invalidate( SID_STATUS_PAGESTYLE );
    8253         [ +  - ]:          4 :                         pBindings->Invalidate( FID_RESET_PRINTZOOM );
    8254         [ +  - ]:          4 :                         pBindings->Invalidate( SID_ATTR_PARA_LEFT_TO_RIGHT );
    8255         [ +  - ]:          4 :                         pBindings->Invalidate( SID_ATTR_PARA_RIGHT_TO_LEFT );
    8256                 :            :                     }
    8257                 :            :                 }
    8258         [ +  - ]:         70 :                 pDocSh->SetDocumentModified();
    8259                 :        288 :             }
    8260                 :            :         }
    8261         [ +  + ]:        711 :         else if ( pEntry->nWID == SC_WID_UNO_CELLVIS )
    8262                 :            :         {
    8263                 :        312 :             sal_Bool bVis = ScUnoHelpFunctions::GetBoolFromAny( aValue );
    8264                 :        312 :             rFunc.SetTableVisible( nTab, bVis, sal_True );
    8265                 :            :         }
    8266         [ -  + ]:        399 :         else if ( pEntry->nWID == SC_WID_UNO_ISACTIVE )
    8267                 :            :         {
    8268         [ #  # ]:          0 :             if (pDoc->IsScenario(nTab))
    8269                 :          0 :                 pDoc->SetActiveScenario( nTab, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
    8270                 :            :         }
    8271         [ -  + ]:        399 :         else if ( pEntry->nWID == SC_WID_UNO_BORDCOL )
    8272                 :            :         {
    8273         [ #  # ]:          0 :             if (pDoc->IsScenario(nTab))
    8274                 :            :             {
    8275                 :          0 :                 sal_Int32 nNewColor = 0;
    8276         [ #  # ]:          0 :                 if (aValue >>= nNewColor)
    8277                 :            :                 {
    8278                 :          0 :                     rtl::OUString aName;
    8279                 :          0 :                     rtl::OUString aComment;
    8280                 :          0 :                     Color  aColor;
    8281                 :            :                     sal_uInt16 nFlags;
    8282         [ #  # ]:          0 :                     pDoc->GetName( nTab, aName );
    8283         [ #  # ]:          0 :                     pDoc->GetScenarioData( nTab, aComment, aColor, nFlags );
    8284                 :            : 
    8285                 :          0 :                     aColor = Color(static_cast<sal_uInt32>(nNewColor));
    8286                 :            : 
    8287 [ #  # ][ #  # ]:          0 :                     pDocSh->ModifyScenario( nTab, aName, aComment, aColor, nFlags );
         [ #  # ][ #  # ]
                 [ #  # ]
    8288                 :            :                 }
    8289                 :            :             }
    8290                 :            :         }
    8291         [ -  + ]:        399 :         else if ( pEntry->nWID == SC_WID_UNO_PROTECT )
    8292                 :            :         {
    8293         [ #  # ]:          0 :             if (pDoc->IsScenario(nTab))
    8294                 :            :             {
    8295                 :          0 :                 rtl::OUString aName;
    8296                 :          0 :                 rtl::OUString aComment;
    8297                 :          0 :                 Color  aColor;
    8298                 :            :                 sal_uInt16 nFlags;
    8299         [ #  # ]:          0 :                 pDoc->GetName( nTab, aName );
    8300         [ #  # ]:          0 :                 pDoc->GetScenarioData( nTab, aComment, aColor, nFlags );
    8301                 :          0 :                 sal_Bool bModify(false);
    8302                 :            : 
    8303 [ #  # ][ #  # ]:          0 :                 if (ScUnoHelpFunctions::GetBoolFromAny( aValue ))
    8304                 :            :                 {
    8305         [ #  # ]:          0 :                     if (!(nFlags & SC_SCENARIO_PROTECT))
    8306                 :            :                     {
    8307                 :          0 :                         nFlags |= SC_SCENARIO_PROTECT;
    8308                 :          0 :                         bModify = sal_True;
    8309                 :            :                     }
    8310                 :            :                 }
    8311                 :            :                 else
    8312                 :            :                 {
    8313         [ #  # ]:          0 :                     if (nFlags & SC_SCENARIO_PROTECT)
    8314                 :            :                     {
    8315                 :          0 :                         nFlags -= SC_SCENARIO_PROTECT;
    8316                 :          0 :                         bModify = sal_True;
    8317                 :            :                     }
    8318                 :            :                 }
    8319                 :            : 
    8320         [ #  # ]:          0 :                 if (bModify)
    8321 [ #  # ][ #  # ]:          0 :                     pDocSh->ModifyScenario( nTab, aName, aComment, aColor, nFlags );
         [ #  # ][ #  # ]
                 [ #  # ]
    8322                 :            :             }
    8323                 :            :         }
    8324         [ -  + ]:        399 :         else if ( pEntry->nWID == SC_WID_UNO_SHOWBORD )
    8325                 :            :         {
    8326         [ #  # ]:          0 :             if (pDoc->IsScenario(nTab))
    8327                 :            :             {
    8328                 :          0 :                 rtl::OUString aName;
    8329                 :          0 :                 rtl::OUString aComment;
    8330                 :          0 :                 Color  aColor;
    8331                 :            :                 sal_uInt16 nFlags;
    8332         [ #  # ]:          0 :                 pDoc->GetName( nTab, aName );
    8333         [ #  # ]:          0 :                 pDoc->GetScenarioData( nTab, aComment, aColor, nFlags );
    8334                 :          0 :                 sal_Bool bModify(false);
    8335                 :            : 
    8336 [ #  # ][ #  # ]:          0 :                 if (ScUnoHelpFunctions::GetBoolFromAny( aValue ))
    8337                 :            :                 {
    8338         [ #  # ]:          0 :                     if (!(nFlags & SC_SCENARIO_SHOWFRAME))
    8339                 :            :                     {
    8340                 :          0 :                         nFlags |= SC_SCENARIO_SHOWFRAME;
    8341                 :          0 :                         bModify = sal_True;
    8342                 :            :                     }
    8343                 :            :                 }
    8344                 :            :                 else
    8345                 :            :                 {
    8346         [ #  # ]:          0 :                     if (nFlags & SC_SCENARIO_SHOWFRAME)
    8347                 :            :                     {
    8348                 :          0 :                         nFlags -= SC_SCENARIO_SHOWFRAME;
    8349                 :          0 :                         bModify = sal_True;
    8350                 :            :                     }
    8351                 :            :                 }
    8352                 :            : 
    8353         [ #  # ]:          0 :                 if (bModify)
    8354 [ #  # ][ #  # ]:          0 :                     pDocSh->ModifyScenario( nTab, aName, aComment, aColor, nFlags );
         [ #  # ][ #  # ]
                 [ #  # ]
    8355                 :            :             }
    8356                 :            :         }
    8357         [ -  + ]:        399 :         else if ( pEntry->nWID == SC_WID_UNO_PRINTBORD )
    8358                 :            :         {
    8359         [ #  # ]:          0 :             if (pDoc->IsScenario(nTab))
    8360                 :            :             {
    8361                 :          0 :                 rtl::OUString aName;
    8362                 :          0 :                 rtl::OUString aComment;
    8363                 :          0 :                 Color  aColor;
    8364                 :            :                 sal_uInt16 nFlags;
    8365         [ #  # ]:          0 :                 pDoc->GetName( nTab, aName );
    8366         [ #  # ]:          0 :                 pDoc->GetScenarioData( nTab, aComment, aColor, nFlags );
    8367                 :          0 :                 sal_Bool bModify(false);
    8368                 :            : 
    8369 [ #  # ][ #  # ]:          0 :                 if (ScUnoHelpFunctions::GetBoolFromAny( aValue ))
    8370                 :            :                 {
    8371         [ #  # ]:          0 :                     if (!(nFlags & SC_SCENARIO_PRINTFRAME))
    8372                 :            :                     {
    8373                 :          0 :                         nFlags |= SC_SCENARIO_PRINTFRAME;
    8374                 :          0 :                         bModify = sal_True;
    8375                 :            :                     }
    8376                 :            :                 }
    8377                 :            :                 else
    8378                 :            :                 {
    8379         [ #  # ]:          0 :                     if (nFlags & SC_SCENARIO_PRINTFRAME)
    8380                 :            :                     {
    8381                 :          0 :                         nFlags -= SC_SCENARIO_PRINTFRAME;
    8382                 :          0 :                         bModify = sal_True;
    8383                 :            :                     }
    8384                 :            :                 }
    8385                 :            : 
    8386         [ #  # ]:          0 :                 if (bModify)
    8387 [ #  # ][ #  # ]:          0 :                     pDocSh->ModifyScenario( nTab, aName, aComment, aColor, nFlags );
         [ #  # ][ #  # ]
                 [ #  # ]
    8388                 :            :             }
    8389                 :            :         }
    8390         [ -  + ]:        399 :         else if ( pEntry->nWID == SC_WID_UNO_COPYBACK )
    8391                 :            :         {
    8392         [ #  # ]:          0 :             if (pDoc->IsScenario(nTab))
    8393                 :            :             {
    8394                 :          0 :                 rtl::OUString aName;
    8395                 :          0 :                 rtl::OUString aComment;
    8396                 :          0 :                 Color  aColor;
    8397                 :            :                 sal_uInt16 nFlags;
    8398         [ #  # ]:          0 :                 pDoc->GetName( nTab, aName );
    8399         [ #  # ]:          0 :                 pDoc->GetScenarioData( nTab, aComment, aColor, nFlags );
    8400                 :          0 :                 sal_Bool bModify(false);
    8401                 :            : 
    8402 [ #  # ][ #  # ]:          0 :                 if (ScUnoHelpFunctions::GetBoolFromAny( aValue ))
    8403                 :            :                 {
    8404         [ #  # ]:          0 :                     if (!(nFlags & SC_SCENARIO_TWOWAY))
    8405                 :            :                     {
    8406                 :          0 :                         nFlags |= SC_SCENARIO_TWOWAY;
    8407                 :          0 :                         bModify = sal_True;
    8408                 :            :                     }
    8409                 :            :                 }
    8410                 :            :                 else
    8411                 :            :                 {
    8412         [ #  # ]:          0 :                     if (nFlags & SC_SCENARIO_TWOWAY)
    8413                 :            :                     {
    8414                 :          0 :                         nFlags -= SC_SCENARIO_TWOWAY;
    8415                 :          0 :                         bModify = sal_True;
    8416                 :            :                     }
    8417                 :            :                 }
    8418                 :            : 
    8419         [ #  # ]:          0 :                 if (bModify)
    8420 [ #  # ][ #  # ]:          0 :                     pDocSh->ModifyScenario( nTab, aName, aComment, aColor, nFlags );
         [ #  # ][ #  # ]
                 [ #  # ]
    8421                 :            :             }
    8422                 :            :         }
    8423         [ -  + ]:        399 :         else if ( pEntry->nWID == SC_WID_UNO_COPYSTYL )
    8424                 :            :         {
    8425         [ #  # ]:          0 :             if (pDoc->IsScenario(nTab))
    8426                 :            :             {
    8427                 :          0 :                 rtl::OUString aName;
    8428                 :          0 :                 rtl::OUString aComment;
    8429                 :          0 :                 Color  aColor;
    8430                 :            :                 sal_uInt16 nFlags;
    8431         [ #  # ]:          0 :                 pDoc->GetName( nTab, aName );
    8432         [ #  # ]:          0 :                 pDoc->GetScenarioData( nTab, aComment, aColor, nFlags );
    8433                 :          0 :                 sal_Bool bModify(false);
    8434                 :            : 
    8435 [ #  # ][ #  # ]:          0 :                 if (ScUnoHelpFunctions::GetBoolFromAny( aValue ))
    8436                 :            :                 {
    8437         [ #  # ]:          0 :                     if (!(nFlags & SC_SCENARIO_ATTRIB))
    8438                 :            :                     {
    8439                 :          0 :                         nFlags |= SC_SCENARIO_ATTRIB;
    8440                 :          0 :                         bModify = sal_True;
    8441                 :            :                     }
    8442                 :            :                 }
    8443                 :            :                 else
    8444                 :            :                 {
    8445         [ #  # ]:          0 :                     if (nFlags & SC_SCENARIO_ATTRIB)
    8446                 :            :                     {
    8447                 :          0 :                         nFlags -= SC_SCENARIO_ATTRIB;
    8448                 :          0 :                         bModify = sal_True;
    8449                 :            :                     }
    8450                 :            :                 }
    8451                 :            : 
    8452         [ #  # ]:          0 :                 if (bModify)
    8453 [ #  # ][ #  # ]:          0 :                     pDocSh->ModifyScenario( nTab, aName, aComment, aColor, nFlags );
         [ #  # ][ #  # ]
                 [ #  # ]
    8454                 :            :             }
    8455                 :            :         }
    8456         [ -  + ]:        399 :         else if ( pEntry->nWID == SC_WID_UNO_COPYFORM )
    8457                 :            :         {
    8458         [ #  # ]:          0 :             if (pDoc->IsScenario(nTab))
    8459                 :            :             {
    8460                 :          0 :                 rtl::OUString aName;
    8461                 :          0 :                 rtl::OUString aComment;
    8462                 :          0 :                 Color  aColor;
    8463                 :            :                 sal_uInt16 nFlags;
    8464         [ #  # ]:          0 :                 pDoc->GetName( nTab, aName );
    8465         [ #  # ]:          0 :                 pDoc->GetScenarioData( nTab, aComment, aColor, nFlags );
    8466                 :          0 :                 sal_Bool bModify(false);
    8467                 :            : 
    8468 [ #  # ][ #  # ]:          0 :                 if (ScUnoHelpFunctions::GetBoolFromAny( aValue ))
    8469                 :            :                 {
    8470         [ #  # ]:          0 :                     if (nFlags & SC_SCENARIO_VALUE)
    8471                 :            :                     {
    8472                 :          0 :                         nFlags -= SC_SCENARIO_VALUE;
    8473                 :          0 :                         bModify = sal_True;
    8474                 :            :                     }
    8475                 :            :                 }
    8476                 :            :                 else
    8477                 :            :                 {
    8478         [ #  # ]:          0 :                     if (!(nFlags & SC_SCENARIO_VALUE))
    8479                 :            :                     {
    8480                 :          0 :                         nFlags |= SC_SCENARIO_VALUE;
    8481                 :          0 :                         bModify = sal_True;
    8482                 :            :                     }
    8483                 :            :                 }
    8484                 :            : 
    8485         [ #  # ]:          0 :                 if (bModify)
    8486 [ #  # ][ #  # ]:          0 :                     pDocSh->ModifyScenario( nTab, aName, aComment, aColor, nFlags );
         [ #  # ][ #  # ]
                 [ #  # ]
    8487                 :            :             }
    8488                 :            :         }
    8489         [ +  + ]:        399 :         else if ( pEntry->nWID == SC_WID_UNO_TABLAYOUT )
    8490                 :            :         {
    8491                 :        217 :             sal_Int16 nValue = 0;
    8492         [ +  - ]:        217 :             if (aValue >>= nValue)
    8493                 :            :             {
    8494         [ +  + ]:        217 :                 if (nValue == com::sun::star::text::WritingMode2::RL_TB)
    8495         [ +  - ]:          4 :                     rFunc.SetLayoutRTL(nTab, sal_True, sal_True);
    8496                 :            :                 else
    8497         [ +  - ]:        217 :                     rFunc.SetLayoutRTL(nTab, false, sal_True);
    8498                 :            :             }
    8499                 :            :         }
    8500         [ -  + ]:        182 :         else if ( pEntry->nWID == SC_WID_UNO_AUTOPRINT )
    8501                 :            :         {
    8502                 :          0 :             sal_Bool bAutoPrint = ScUnoHelpFunctions::GetBoolFromAny( aValue );
    8503         [ #  # ]:          0 :             if (bAutoPrint)
    8504                 :          0 :                 pDoc->SetPrintEntireSheet( nTab ); // clears all print ranges
    8505                 :            :             else
    8506                 :            :             {
    8507         [ #  # ]:          0 :                 if (pDoc->IsPrintEntireSheet( nTab ))
    8508                 :          0 :                     pDoc->ClearPrintRanges( nTab ); // if this flag is true, there are no PrintRanges, so Clear clears only the flag.
    8509                 :            :             }
    8510                 :            :         }
    8511         [ +  + ]:        182 :         else if ( pEntry->nWID == SC_WID_UNO_TABCOLOR )
    8512                 :            :         {
    8513                 :         60 :             sal_Int32 nColor = COL_AUTO;
    8514         [ +  - ]:         60 :             if (aValue >>= nColor)
    8515                 :            :             {
    8516                 :         60 :                 const Color aColor(static_cast<ColorData>(nColor));
    8517 [ -  + ][ +  - ]:         60 :                 if (aColor != pDoc->GetTabBgColor(nTab))
    8518                 :            :                 {
    8519         [ #  # ]:         60 :                     rFunc.SetTabBgColor(nTab, aColor, true, true);
    8520                 :            :                 }
    8521                 :            :             }
    8522                 :            :         }
    8523         [ +  + ]:        122 :         else if ( pEntry->nWID == SC_WID_UNO_CODENAME )
    8524                 :            :         {
    8525                 :         60 :             rtl::OUString aCodeName;
    8526 [ +  - ][ +  - ]:         60 :             if ( pDocSh && ( aValue >>= aCodeName ) )
                 [ +  - ]
    8527                 :            :             {
    8528 [ +  - ][ +  - ]:         60 :                 pDocSh->GetDocument()->SetCodeName( GetTab_Impl(), aCodeName );
    8529                 :         60 :             }
    8530                 :            :         }
    8531                 :            :         else
    8532                 :        999 :             ScCellRangeObj::SetOnePropertyValue(pEntry, aValue);        // base class, no Item WID
    8533                 :            :     }
    8534                 :            : }
    8535                 :            : 
    8536                 :        199 : void ScTableSheetObj::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry,
    8537                 :            :                                             uno::Any& rAny )
    8538                 :            :                                                 throw(uno::RuntimeException)
    8539                 :            : {
    8540         [ +  - ]:        199 :     if ( pEntry )
    8541                 :            :     {
    8542                 :        199 :         ScDocShell* pDocSh = GetDocShell();
    8543         [ -  + ]:        199 :         if (!pDocSh)
    8544         [ #  # ]:          0 :             throw uno::RuntimeException();
    8545                 :        199 :         ScDocument* pDoc = pDocSh->GetDocument();
    8546                 :        199 :         SCTAB nTab = GetTab_Impl();
    8547                 :            : 
    8548         [ -  + ]:        199 :         if ( pEntry->nWID == SC_WID_UNO_NAMES )
    8549                 :            :         {
    8550 [ #  # ][ #  # ]:          0 :             rAny <<= uno::Reference<sheet::XNamedRanges>(new ScLocalNamedRangesObj(pDocSh, this));
         [ #  # ][ #  # ]
    8551                 :            :         }
    8552         [ +  + ]:        199 :         else if ( pEntry->nWID == SC_WID_UNO_PAGESTL )
    8553                 :            :         {
    8554                 :            :             rAny <<= rtl::OUString( ScStyleNameConversion::DisplayToProgrammaticName(
    8555 [ +  - ][ +  - ]:         12 :                                 pDoc->GetPageStyle( nTab ), SFX_STYLE_FAMILY_PAGE ) );
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
    8556                 :            :         }
    8557         [ +  + ]:        187 :         else if ( pEntry->nWID == SC_WID_UNO_CELLVIS )
    8558                 :            :         {
    8559                 :         12 :             sal_Bool bVis = pDoc->IsVisible( nTab );
    8560                 :         12 :             ScUnoHelpFunctions::SetBoolInAny( rAny, bVis );
    8561                 :            :         }
    8562         [ +  - ]:        175 :         else if ( pEntry->nWID == SC_WID_UNO_LINKDISPBIT )
    8563                 :            :         {
    8564                 :            :             //  no target bitmaps for individual entries (would be all equal)
    8565                 :            :             // ScLinkTargetTypeObj::SetLinkTargetBitmap( aAny, SC_LINKTARGETTYPE_SHEET );
    8566                 :            :         }
    8567         [ -  + ]:        175 :         else if ( pEntry->nWID == SC_WID_UNO_LINKDISPNAME )
    8568                 :            :         {
    8569                 :            :             //  LinkDisplayName for hyperlink dialog
    8570         [ #  # ]:          0 :             rAny <<= getName();     // sheet name
    8571                 :            :         }
    8572         [ -  + ]:        175 :         else if ( pEntry->nWID == SC_WID_UNO_ISACTIVE )
    8573                 :            :         {
    8574         [ #  # ]:          0 :             if (pDoc->IsScenario(nTab))
    8575                 :          0 :                 ScUnoHelpFunctions::SetBoolInAny( rAny, pDoc->IsActiveScenario( nTab ));
    8576                 :            :         }
    8577         [ -  + ]:        175 :         else if ( pEntry->nWID == SC_WID_UNO_BORDCOL )
    8578                 :            :         {
    8579         [ #  # ]:          0 :             if (pDoc->IsScenario(nTab))
    8580                 :            :             {
    8581                 :          0 :                 rtl::OUString aComment;
    8582                 :          0 :                 Color  aColor;
    8583                 :            :                 sal_uInt16 nFlags;
    8584         [ #  # ]:          0 :                 pDoc->GetScenarioData( nTab, aComment, aColor, nFlags );
    8585                 :            : 
    8586         [ #  # ]:          0 :                 rAny <<= static_cast<sal_Int32>(aColor.GetColor());
    8587                 :            :             }
    8588                 :            :         }
    8589         [ -  + ]:        175 :         else if ( pEntry->nWID == SC_WID_UNO_PROTECT )
    8590                 :            :         {
    8591         [ #  # ]:          0 :             if (pDoc->IsScenario(nTab))
    8592                 :            :             {
    8593                 :          0 :                 rtl::OUString aComment;
    8594                 :          0 :                 Color  aColor;
    8595                 :            :                 sal_uInt16 nFlags;
    8596         [ #  # ]:          0 :                 pDoc->GetScenarioData( nTab, aComment, aColor, nFlags );
    8597                 :            : 
    8598         [ #  # ]:          0 :                 ScUnoHelpFunctions::SetBoolInAny( rAny, (nFlags & SC_SCENARIO_PROTECT) != 0 );
    8599                 :            :             }
    8600                 :            :         }
    8601         [ -  + ]:        175 :         else if ( pEntry->nWID == SC_WID_UNO_SHOWBORD )
    8602                 :            :         {
    8603         [ #  # ]:          0 :             if (pDoc->IsScenario(nTab))
    8604                 :            :             {
    8605                 :          0 :                 rtl::OUString aComment;
    8606                 :          0 :                 Color  aColor;
    8607                 :            :                 sal_uInt16 nFlags;
    8608         [ #  # ]:          0 :                 pDoc->GetScenarioData( nTab, aComment, aColor, nFlags );
    8609                 :            : 
    8610         [ #  # ]:          0 :                 ScUnoHelpFunctions::SetBoolInAny( rAny, (nFlags & SC_SCENARIO_SHOWFRAME) != 0 );
    8611                 :            :             }
    8612                 :            :         }
    8613         [ -  + ]:        175 :         else if ( pEntry->nWID == SC_WID_UNO_PRINTBORD )
    8614                 :            :         {
    8615         [ #  # ]:          0 :             if (pDoc->IsScenario(nTab))
    8616                 :            :             {
    8617                 :          0 :                 rtl::OUString aComment;
    8618                 :          0 :                 Color  aColor;
    8619                 :            :                 sal_uInt16 nFlags;
    8620         [ #  # ]:          0 :                 pDoc->GetScenarioData( nTab, aComment, aColor, nFlags );
    8621                 :            : 
    8622         [ #  # ]:          0 :                 ScUnoHelpFunctions::SetBoolInAny( rAny, (nFlags & SC_SCENARIO_PRINTFRAME) != 0 );
    8623                 :            :             }
    8624                 :            :         }
    8625         [ -  + ]:        175 :         else if ( pEntry->nWID == SC_WID_UNO_COPYBACK )
    8626                 :            :         {
    8627         [ #  # ]:          0 :             if (pDoc->IsScenario(nTab))
    8628                 :            :             {
    8629                 :          0 :                 rtl::OUString aComment;
    8630                 :          0 :                 Color  aColor;
    8631                 :            :                 sal_uInt16 nFlags;
    8632         [ #  # ]:          0 :                 pDoc->GetScenarioData( nTab, aComment, aColor, nFlags );
    8633                 :            : 
    8634         [ #  # ]:          0 :                 ScUnoHelpFunctions::SetBoolInAny( rAny, (nFlags & SC_SCENARIO_TWOWAY) != 0 );
    8635                 :            :             }
    8636                 :            :         }
    8637         [ -  + ]:        175 :         else if ( pEntry->nWID == SC_WID_UNO_COPYSTYL )
    8638                 :            :         {
    8639         [ #  # ]:          0 :             if (pDoc->IsScenario(nTab))
    8640                 :            :             {
    8641                 :          0 :                 rtl::OUString aComment;
    8642                 :          0 :                 Color  aColor;
    8643                 :            :                 sal_uInt16 nFlags;
    8644         [ #  # ]:          0 :                 pDoc->GetScenarioData( nTab, aComment, aColor, nFlags );
    8645                 :            : 
    8646         [ #  # ]:          0 :                 ScUnoHelpFunctions::SetBoolInAny( rAny, (nFlags & SC_SCENARIO_ATTRIB) != 0 );
    8647                 :            :             }
    8648                 :            :         }
    8649         [ -  + ]:        175 :         else if ( pEntry->nWID == SC_WID_UNO_COPYFORM )
    8650                 :            :         {
    8651         [ #  # ]:          0 :             if (pDoc->IsScenario(nTab))
    8652                 :            :             {
    8653                 :          0 :                 rtl::OUString aComment;
    8654                 :          0 :                 Color  aColor;
    8655                 :            :                 sal_uInt16 nFlags;
    8656         [ #  # ]:          0 :                 pDoc->GetScenarioData( nTab, aComment, aColor, nFlags );
    8657                 :            : 
    8658         [ #  # ]:          0 :                 ScUnoHelpFunctions::SetBoolInAny( rAny, !(nFlags & SC_SCENARIO_VALUE));
    8659                 :            :             }
    8660                 :            :         }
    8661         [ +  + ]:        175 :         else if ( pEntry->nWID == SC_WID_UNO_TABLAYOUT )
    8662                 :            :         {
    8663         [ +  + ]:         20 :             if (pDoc->IsLayoutRTL(nTab))
    8664         [ +  - ]:          8 :                 rAny <<= sal_Int16(com::sun::star::text::WritingMode2::RL_TB);
    8665                 :            :             else
    8666         [ +  - ]:         12 :                 rAny <<= sal_Int16(com::sun::star::text::WritingMode2::LR_TB);
    8667                 :            :         }
    8668         [ -  + ]:        155 :         else if ( pEntry->nWID == SC_WID_UNO_AUTOPRINT )
    8669                 :            :         {
    8670                 :          0 :             sal_Bool bAutoPrint = pDoc->IsPrintEntireSheet( nTab );
    8671                 :          0 :             ScUnoHelpFunctions::SetBoolInAny( rAny, bAutoPrint );
    8672                 :            :         }
    8673         [ +  + ]:        155 :         else if ( pEntry->nWID == SC_WID_UNO_TABCOLOR )
    8674                 :            :         {
    8675         [ +  - ]:          4 :             rAny <<= sal_Int32(pDoc->GetTabBgColor(nTab).GetColor());
    8676                 :            :         }
    8677         [ +  + ]:        151 :         else if ( pEntry->nWID == SC_WID_UNO_CODENAME )
    8678                 :            :         {
    8679                 :        146 :             rtl::OUString aCodeName;
    8680         [ +  - ]:        146 :             if ( pDocSh )
    8681 [ +  - ][ +  - ]:        146 :                 pDocSh->GetDocument()->GetCodeName( GetTab_Impl(), aCodeName );
    8682         [ +  - ]:        146 :             rAny <<= rtl::OUString( aCodeName );
    8683                 :            :         }
    8684                 :            :         else
    8685                 :          5 :             ScCellRangeObj::GetOnePropertyValue(pEntry, rAny);
    8686                 :            :     }
    8687                 :        199 : }
    8688                 :            : 
    8689                 :        753 : const SfxItemPropertyMap& ScTableSheetObj::GetItemPropertyMap()
    8690                 :            : {
    8691                 :        753 :     return pSheetPropSet->getPropertyMap();
    8692                 :            : }
    8693                 :            : 
    8694                 :            : // XServiceInfo
    8695                 :            : 
    8696                 :          0 : rtl::OUString SAL_CALL ScTableSheetObj::getImplementationName() throw(uno::RuntimeException)
    8697                 :            : {
    8698                 :          0 :     return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ScTableSheetObj" ));
    8699                 :            : }
    8700                 :            : 
    8701                 :          0 : sal_Bool SAL_CALL ScTableSheetObj::supportsService( const rtl::OUString& rServiceName )
    8702                 :            :                                                     throw(uno::RuntimeException)
    8703                 :            : {
    8704         [ #  # ]:          0 :     String aServiceStr( rServiceName );
    8705         [ #  # ]:          0 :     return aServiceStr.EqualsAscii( SCSPREADSHEET_SERVICE ) ||
    8706         [ #  # ]:          0 :            aServiceStr.EqualsAscii( SCSHEETCELLRANGE_SERVICE ) ||
    8707         [ #  # ]:          0 :            aServiceStr.EqualsAscii( SCCELLRANGE_SERVICE ) ||
    8708         [ #  # ]:          0 :            aServiceStr.EqualsAscii( SCCELLPROPERTIES_SERVICE ) ||
    8709         [ #  # ]:          0 :            aServiceStr.EqualsAscii( SCCHARPROPERTIES_SERVICE ) ||
    8710         [ #  # ]:          0 :            aServiceStr.EqualsAscii( SCPARAPROPERTIES_SERVICE ) ||
    8711 [ #  # ][ #  # ]:          0 :            aServiceStr.EqualsAscii( SCLINKTARGET_SERVICE );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
    8712                 :            : }
    8713                 :            : 
    8714                 :          0 : uno::Sequence<rtl::OUString> SAL_CALL ScTableSheetObj::getSupportedServiceNames()
    8715                 :            :                                                     throw(uno::RuntimeException)
    8716                 :            : {
    8717                 :          0 :     uno::Sequence<rtl::OUString> aRet(7);
    8718         [ #  # ]:          0 :     rtl::OUString* pArray = aRet.getArray();
    8719         [ #  # ]:          0 :     pArray[0] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( SCSPREADSHEET_SERVICE ));
    8720         [ #  # ]:          0 :     pArray[1] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( SCSHEETCELLRANGE_SERVICE ));
    8721         [ #  # ]:          0 :     pArray[2] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( SCCELLRANGE_SERVICE ));
    8722         [ #  # ]:          0 :     pArray[3] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( SCCELLPROPERTIES_SERVICE ));
    8723         [ #  # ]:          0 :     pArray[4] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( SCCHARPROPERTIES_SERVICE ));
    8724         [ #  # ]:          0 :     pArray[5] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( SCPARAPROPERTIES_SERVICE ));
    8725         [ #  # ]:          0 :     pArray[6] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( SCLINKTARGET_SERVICE ));
    8726                 :          0 :     return aRet;
    8727                 :            : }
    8728                 :            : 
    8729                 :            : // XUnoTunnel
    8730                 :            : 
    8731                 :        610 : sal_Int64 SAL_CALL ScTableSheetObj::getSomething(
    8732                 :            :                 const uno::Sequence<sal_Int8 >& rId ) throw(uno::RuntimeException)
    8733                 :            : {
    8734   [ +  -  +  + ]:       1220 :     if ( rId.getLength() == 16 &&
                 [ +  + ]
    8735                 :        610 :           0 == memcmp( getUnoTunnelId().getConstArray(),
    8736                 :        610 :                                     rId.getConstArray(), 16 ) )
    8737                 :            :     {
    8738                 :        330 :         return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this));
    8739                 :            :     }
    8740                 :            : 
    8741                 :        610 :     return ScCellRangeObj::getSomething( rId );
    8742                 :            : }
    8743                 :            : 
    8744                 :            : namespace
    8745                 :            : {
    8746                 :            :     class theScTableSheetObjUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theScTableSheetObjUnoTunnelId> {};
    8747                 :            : }
    8748                 :            : 
    8749                 :       3300 : const uno::Sequence<sal_Int8>& ScTableSheetObj::getUnoTunnelId()
    8750                 :            : {
    8751                 :       3300 :     return theScTableSheetObjUnoTunnelId::get().getSeq();
    8752                 :            : }
    8753                 :            : 
    8754                 :       2690 : ScTableSheetObj* ScTableSheetObj::getImplementation( const uno::Reference<uno::XInterface> xObj )
    8755                 :            : {
    8756                 :       2690 :     ScTableSheetObj* pRet = NULL;
    8757         [ +  - ]:       2690 :     uno::Reference<lang::XUnoTunnel> xUT( xObj, uno::UNO_QUERY );
    8758         [ +  - ]:       2690 :     if (xUT.is())
    8759 [ +  - ][ +  - ]:       2690 :         pRet = reinterpret_cast<ScTableSheetObj*>(sal::static_int_cast<sal_IntPtr>(xUT->getSomething(getUnoTunnelId())));
                 [ +  - ]
    8760                 :       2690 :     return pRet;
    8761                 :            : }
    8762                 :            : 
    8763                 :            : //------------------------------------------------------------------------
    8764                 :            : 
    8765                 :       1036 : ScTableColumnObj::ScTableColumnObj( ScDocShell* pDocSh, SCCOL nCol, SCTAB nTab ) :
    8766                 :            :     ScCellRangeObj( pDocSh, ScRange(nCol,0,nTab, nCol,MAXROW,nTab) ),
    8767 [ +  - ][ +  - ]:       1036 :     pColPropSet(lcl_GetColumnPropertySet())
    8768                 :            : {
    8769                 :       1036 : }
    8770                 :            : 
    8771                 :       1036 : ScTableColumnObj::~ScTableColumnObj()
    8772                 :            : {
    8773         [ -  + ]:       2072 : }
    8774                 :            : 
    8775                 :       1068 : uno::Any SAL_CALL ScTableColumnObj::queryInterface( const uno::Type& rType ) throw(uno::RuntimeException)
    8776                 :            : {
    8777 [ -  + ][ #  # ]:       1068 :     SC_QUERYINTERFACE( container::XNamed )
    8778                 :            : 
    8779                 :       1068 :     return ScCellRangeObj::queryInterface( rType );
    8780                 :            : }
    8781                 :            : 
    8782                 :       6280 : void SAL_CALL ScTableColumnObj::acquire() throw()
    8783                 :            : {
    8784                 :       6280 :     ScCellRangeObj::acquire();
    8785                 :       6280 : }
    8786                 :            : 
    8787                 :       6280 : void SAL_CALL ScTableColumnObj::release() throw()
    8788                 :            : {
    8789                 :       6280 :     ScCellRangeObj::release();
    8790                 :       6280 : }
    8791                 :            : 
    8792                 :          0 : uno::Sequence<uno::Type> SAL_CALL ScTableColumnObj::getTypes() throw(uno::RuntimeException)
    8793                 :            : {
    8794 [ #  # ][ #  # ]:          0 :     static uno::Sequence<uno::Type> aTypes;
         [ #  # ][ #  # ]
    8795         [ #  # ]:          0 :     if ( aTypes.getLength() == 0 )
    8796                 :            :     {
    8797         [ #  # ]:          0 :         uno::Sequence<uno::Type> aParentTypes(ScCellRangeObj::getTypes());
    8798                 :          0 :         long nParentLen = aParentTypes.getLength();
    8799                 :          0 :         const uno::Type* pParentPtr = aParentTypes.getConstArray();
    8800                 :            : 
    8801         [ #  # ]:          0 :         aTypes.realloc( nParentLen + 1 );
    8802         [ #  # ]:          0 :         uno::Type* pPtr = aTypes.getArray();
    8803         [ #  # ]:          0 :         pPtr[nParentLen + 0] = getCppuType((const uno::Reference<container::XNamed>*)0);
    8804                 :            : 
    8805         [ #  # ]:          0 :         for (long i=0; i<nParentLen; i++)
    8806         [ #  # ]:          0 :             pPtr[i] = pParentPtr[i];                // parent types first
    8807                 :            :     }
    8808                 :          0 :     return aTypes;
    8809                 :            : }
    8810                 :            : 
    8811                 :            : namespace
    8812                 :            : {
    8813                 :            :     class theScTableColumnObjImplementationId : public rtl::Static< UnoTunnelIdInit, theScTableColumnObjImplementationId > {};
    8814                 :            : }
    8815                 :            : 
    8816                 :          0 : uno::Sequence<sal_Int8> SAL_CALL ScTableColumnObj::getImplementationId() throw(uno::RuntimeException)
    8817                 :            : {
    8818                 :          0 :     return theScTableColumnObjImplementationId::get().getSeq();
    8819                 :            : }
    8820                 :            : 
    8821                 :            : // XNamed
    8822                 :            : 
    8823                 :          0 : rtl::OUString SAL_CALL ScTableColumnObj::getName() throw(uno::RuntimeException)
    8824                 :            : {
    8825         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    8826                 :            : 
    8827                 :          0 :     const ScRange& rRange = GetRange();
    8828                 :            :     OSL_ENSURE(rRange.aStart.Col() == rRange.aEnd.Col(), "too many columns");
    8829                 :          0 :     SCCOL nCol = rRange.aStart.Col();
    8830                 :            : 
    8831 [ #  # ][ #  # ]:          0 :     return ScColToAlpha( nCol );        // from global.hxx
         [ #  # ][ #  # ]
    8832                 :            : }
    8833                 :            : 
    8834                 :          0 : void SAL_CALL ScTableColumnObj::setName( const rtl::OUString& /* aNewName */ )
    8835                 :            :                                                 throw(uno::RuntimeException)
    8836                 :            : {
    8837         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    8838         [ #  # ]:          0 :     throw uno::RuntimeException();      // read-only
    8839                 :            : }
    8840                 :            : 
    8841                 :            : // XPropertySet erweitert fuer Spalten-Properties
    8842                 :            : 
    8843                 :          4 : uno::Reference<beans::XPropertySetInfo> SAL_CALL ScTableColumnObj::getPropertySetInfo()
    8844                 :            :                                                         throw(uno::RuntimeException)
    8845                 :            : {
    8846         [ +  - ]:          4 :     SolarMutexGuard aGuard;
    8847                 :            :     static uno::Reference<beans::XPropertySetInfo> aRef(
    8848 [ +  + ][ +  - ]:          4 :         new SfxItemPropertySetInfo( pColPropSet->getPropertyMap() ));
         [ +  - ][ +  - ]
         [ +  - ][ #  # ]
    8849         [ +  - ]:          4 :     return aRef;
    8850                 :            : }
    8851                 :            : 
    8852                 :          4 : void ScTableColumnObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry, const uno::Any& aValue )
    8853                 :            :                                 throw(lang::IllegalArgumentException, uno::RuntimeException)
    8854                 :            : {
    8855         [ +  - ]:          4 :     if ( pEntry )
    8856                 :            :     {
    8857         [ -  + ]:          4 :         if ( IsScItemWid( pEntry->nWID ) )
    8858                 :            :         {
    8859                 :            :             //  for Item WIDs, call ScCellRangesBase directly
    8860         [ #  # ]:          0 :             ScCellRangesBase::SetOnePropertyValue(pEntry, aValue);
    8861                 :            :             return;
    8862                 :            :         }
    8863                 :            : 
    8864                 :            :         //  own properties
    8865                 :            : 
    8866                 :          4 :         ScDocShell* pDocSh = GetDocShell();
    8867         [ +  - ]:          4 :         if (!pDocSh)
    8868                 :            :             return;                                                 //! Exception oder so?
    8869                 :          4 :         const ScRange& rRange = GetRange();
    8870                 :            :         OSL_ENSURE(rRange.aStart.Col() == rRange.aEnd.Col(), "zuviele Spalten");
    8871                 :          4 :         SCCOL nCol = rRange.aStart.Col();
    8872                 :          4 :         SCTAB nTab = rRange.aStart.Tab();
    8873                 :          4 :         ScDocFunc &rFunc = pDocSh->GetDocFunc();
    8874                 :            : 
    8875                 :            :         SCCOLROW nColArr[2];
    8876                 :          4 :         nColArr[0] = nColArr[1] = nCol;
    8877                 :            : 
    8878         [ -  + ]:          4 :         if ( pEntry->nWID == SC_WID_UNO_CELLWID )
    8879                 :            :         {
    8880                 :          0 :             sal_Int32 nNewWidth = 0;
    8881         [ #  # ]:          0 :             if ( aValue >>= nNewWidth )
    8882                 :            :             {
    8883                 :            :                 //  property is 1/100mm, column width is twips
    8884                 :          0 :                 nNewWidth = HMMToTwips(nNewWidth);
    8885                 :            :                 rFunc.SetWidthOrHeight( sal_True, 1, nColArr, nTab, SC_SIZE_ORIGINAL,
    8886         [ #  # ]:          0 :                                         (sal_uInt16)nNewWidth, sal_True, sal_True );
    8887                 :            :             }
    8888                 :            :         }
    8889         [ -  + ]:          4 :         else if ( pEntry->nWID == SC_WID_UNO_CELLVIS )
    8890                 :            :         {
    8891         [ #  # ]:          0 :             sal_Bool bVis = ScUnoHelpFunctions::GetBoolFromAny( aValue );
    8892         [ #  # ]:          0 :             ScSizeMode eMode = bVis ? SC_SIZE_SHOW : SC_SIZE_DIRECT;
    8893         [ #  # ]:          0 :             rFunc.SetWidthOrHeight( sal_True, 1, nColArr, nTab, eMode, 0, sal_True, sal_True );
    8894                 :            :             //  SC_SIZE_DIRECT mit Groesse 0 blendet aus
    8895                 :            :         }
    8896         [ +  - ]:          4 :         else if ( pEntry->nWID == SC_WID_UNO_OWIDTH )
    8897                 :            :         {
    8898         [ +  - ]:          4 :             sal_Bool bOpt = ScUnoHelpFunctions::GetBoolFromAny( aValue );
    8899         [ +  - ]:          4 :             if (bOpt)
    8900                 :            :                 rFunc.SetWidthOrHeight( sal_True, 1, nColArr, nTab,
    8901         [ +  - ]:          4 :                                         SC_SIZE_OPTIMAL, STD_EXTRA_WIDTH, sal_True, sal_True );
    8902                 :            :             // sal_False bei Spalten momentan ohne Auswirkung
    8903                 :            :         }
    8904 [ #  # ][ #  # ]:          0 :         else if ( pEntry->nWID == SC_WID_UNO_NEWPAGE || pEntry->nWID == SC_WID_UNO_MANPAGE )
    8905                 :            :         {
    8906         [ #  # ]:          0 :             sal_Bool bSet = ScUnoHelpFunctions::GetBoolFromAny( aValue );
    8907         [ #  # ]:          0 :             if (bSet)
    8908         [ #  # ]:          0 :                 rFunc.InsertPageBreak( sal_True, rRange.aStart, sal_True, sal_True, sal_True );
    8909                 :            :             else
    8910         [ #  # ]:          0 :                 rFunc.RemovePageBreak( sal_True, rRange.aStart, sal_True, sal_True, sal_True );
    8911                 :            :         }
    8912                 :            :         else
    8913         [ #  # ]:          4 :             ScCellRangeObj::SetOnePropertyValue(pEntry, aValue);        // base class, no Item WID
    8914                 :            :     }
    8915                 :            : }
    8916                 :            : 
    8917                 :         12 : void ScTableColumnObj::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry,
    8918                 :            :                                             uno::Any& rAny )
    8919                 :            :                                                 throw(uno::RuntimeException)
    8920                 :            : {
    8921         [ +  - ]:         12 :     if ( pEntry )
    8922                 :            :     {
    8923                 :         12 :         ScDocShell* pDocSh = GetDocShell();
    8924         [ -  + ]:         12 :         if (!pDocSh)
    8925         [ #  # ]:          0 :             throw uno::RuntimeException();
    8926                 :            : 
    8927                 :         12 :         ScDocument* pDoc = pDocSh->GetDocument();
    8928                 :         12 :         const ScRange& rRange = GetRange();
    8929                 :            :         OSL_ENSURE(rRange.aStart.Col() == rRange.aEnd.Col(), "zuviele Spalten");
    8930                 :         12 :         SCCOL nCol = rRange.aStart.Col();
    8931                 :         12 :         SCTAB nTab = rRange.aStart.Tab();
    8932                 :            : 
    8933         [ +  + ]:         12 :         if ( pEntry->nWID == SC_WID_UNO_CELLWID )
    8934                 :            :         {
    8935                 :            :             // for hidden column, return original height
    8936                 :          4 :             sal_uInt16 nWidth = pDoc->GetOriginalWidth( nCol, nTab );
    8937                 :            :             //  property is 1/100mm, column width is twips
    8938                 :          4 :             nWidth = (sal_uInt16) TwipsToHMM(nWidth);
    8939         [ +  - ]:          4 :             rAny <<= (sal_Int32)( nWidth );
    8940                 :            :         }
    8941         [ +  + ]:          8 :         else if ( pEntry->nWID == SC_WID_UNO_CELLVIS )
    8942                 :            :         {
    8943                 :          4 :             bool bHidden = pDoc->ColHidden(nCol, nTab);
    8944                 :          4 :             ScUnoHelpFunctions::SetBoolInAny( rAny, !bHidden );
    8945                 :            :         }
    8946         [ -  + ]:          4 :         else if ( pEntry->nWID == SC_WID_UNO_OWIDTH )
    8947                 :            :         {
    8948                 :            :             //! momentan immer gesetzt ??!?!
    8949                 :          0 :             sal_Bool bOpt = !(pDoc->GetColFlags( nCol, nTab ) & CR_MANUALSIZE);
    8950                 :          0 :             ScUnoHelpFunctions::SetBoolInAny( rAny, bOpt );
    8951                 :            :         }
    8952         [ -  + ]:          4 :         else if ( pEntry->nWID == SC_WID_UNO_NEWPAGE )
    8953                 :            :         {
    8954                 :          0 :             ScBreakType nBreak = pDoc->HasColBreak(nCol, nTab);
    8955                 :          0 :             ScUnoHelpFunctions::SetBoolInAny( rAny, nBreak );
    8956                 :            :         }
    8957         [ +  - ]:          4 :         else if ( pEntry->nWID == SC_WID_UNO_MANPAGE )
    8958                 :            :         {
    8959                 :          4 :             ScBreakType nBreak = pDoc->HasColBreak(nCol, nTab);
    8960                 :          4 :             ScUnoHelpFunctions::SetBoolInAny(rAny, (nBreak & BREAK_MANUAL));
    8961                 :            :         }
    8962                 :            :         else
    8963                 :          0 :             ScCellRangeObj::GetOnePropertyValue(pEntry, rAny);
    8964                 :            :     }
    8965                 :         12 : }
    8966                 :            : 
    8967                 :          8 : const SfxItemPropertyMap& ScTableColumnObj::GetItemPropertyMap()
    8968                 :            : {
    8969                 :          8 :     return pColPropSet->getPropertyMap();
    8970                 :            : }
    8971                 :            : 
    8972                 :            : //------------------------------------------------------------------------
    8973                 :            : 
    8974                 :         27 : ScTableRowObj::ScTableRowObj(ScDocShell* pDocSh, SCROW nRow, SCTAB nTab) :
    8975                 :            :     ScCellRangeObj( pDocSh, ScRange(0,nRow,nTab, MAXCOL,nRow,nTab) ),
    8976 [ +  - ][ +  - ]:         27 :     pRowPropSet(lcl_GetRowPropertySet())
    8977                 :            : {
    8978                 :         27 : }
    8979                 :            : 
    8980                 :         27 : ScTableRowObj::~ScTableRowObj()
    8981                 :            : {
    8982         [ -  + ]:         54 : }
    8983                 :            : 
    8984                 :            : // XPropertySet erweitert fuer Zeilen-Properties
    8985                 :            : 
    8986                 :          4 : uno::Reference<beans::XPropertySetInfo> SAL_CALL ScTableRowObj::getPropertySetInfo()
    8987                 :            :                                                         throw(uno::RuntimeException)
    8988                 :            : {
    8989         [ +  - ]:          4 :     SolarMutexGuard aGuard;
    8990                 :            :     static uno::Reference<beans::XPropertySetInfo> aRef(
    8991 [ +  + ][ +  - ]:          4 :         new SfxItemPropertySetInfo( pRowPropSet->getPropertyMap() ));
         [ +  - ][ +  - ]
         [ +  - ][ #  # ]
    8992         [ +  - ]:          4 :     return aRef;
    8993                 :            : }
    8994                 :            : 
    8995                 :          2 : void ScTableRowObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry, const uno::Any& aValue )
    8996                 :            :                                 throw(lang::IllegalArgumentException, uno::RuntimeException)
    8997                 :            : {
    8998         [ +  - ]:          2 :     if ( pEntry )
    8999                 :            :     {
    9000         [ -  + ]:          2 :         if ( IsScItemWid( pEntry->nWID ) )
    9001                 :            :         {
    9002                 :            :             //  for Item WIDs, call ScCellRangesBase directly
    9003         [ #  # ]:          0 :             ScCellRangesBase::SetOnePropertyValue(pEntry, aValue);
    9004                 :            :             return;
    9005                 :            :         }
    9006                 :            : 
    9007                 :            :         //  own properties
    9008                 :            : 
    9009                 :          2 :         ScDocShell* pDocSh = GetDocShell();
    9010         [ +  - ]:          2 :         if (!pDocSh)
    9011                 :            :             return;                                                 //! Exception oder so?
    9012                 :          2 :         ScDocument* pDoc = pDocSh->GetDocument();
    9013                 :          2 :         const ScRange& rRange = GetRange();
    9014                 :            :         OSL_ENSURE(rRange.aStart.Row() == rRange.aEnd.Row(), "zuviele Zeilen");
    9015                 :          2 :         SCROW nRow = rRange.aStart.Row();
    9016                 :          2 :         SCTAB nTab = rRange.aStart.Tab();
    9017                 :          2 :         ScDocFunc &rFunc = pDocSh->GetDocFunc();
    9018                 :            : 
    9019                 :            :         SCCOLROW nRowArr[2];
    9020                 :          2 :         nRowArr[0] = nRowArr[1] = nRow;
    9021                 :            : 
    9022         [ -  + ]:          2 :         if ( pEntry->nWID == SC_WID_UNO_CELLHGT )
    9023                 :            :         {
    9024                 :          0 :             sal_Int32 nNewHeight = 0;
    9025         [ #  # ]:          0 :             if ( aValue >>= nNewHeight )
    9026                 :            :             {
    9027                 :            :                 //  property is 1/100mm, row height is twips
    9028                 :          0 :                 nNewHeight = HMMToTwips(nNewHeight);
    9029                 :            :                 rFunc.SetWidthOrHeight( false, 1, nRowArr, nTab, SC_SIZE_ORIGINAL,
    9030         [ #  # ]:          0 :                                         (sal_uInt16)nNewHeight, sal_True, sal_True );
    9031                 :            :             }
    9032                 :            :         }
    9033         [ +  - ]:          2 :         else if ( pEntry->nWID == SC_WID_UNO_CELLVIS )
    9034                 :            :         {
    9035         [ +  - ]:          2 :             sal_Bool bVis = ScUnoHelpFunctions::GetBoolFromAny( aValue );
    9036         [ +  + ]:          2 :             ScSizeMode eMode = bVis ? SC_SIZE_SHOW : SC_SIZE_DIRECT;
    9037         [ +  - ]:          2 :             rFunc.SetWidthOrHeight( false, 1, nRowArr, nTab, eMode, 0, sal_True, sal_True );
    9038                 :            :             //  SC_SIZE_DIRECT mit Groesse 0 blendet aus
    9039                 :            :         }
    9040         [ #  # ]:          0 :         else if ( pEntry->nWID == SC_WID_UNO_CELLFILT )
    9041                 :            :         {
    9042         [ #  # ]:          0 :             sal_Bool bFil = ScUnoHelpFunctions::GetBoolFromAny( aValue );
    9043                 :            :             //  SC_SIZE_DIRECT mit Groesse 0 blendet aus
    9044         [ #  # ]:          0 :             pDoc->SetRowFiltered(nRow, nRow, nTab, bFil);
    9045                 :            :         }
    9046         [ #  # ]:          0 :         else if ( pEntry->nWID == SC_WID_UNO_OHEIGHT )
    9047                 :            :         {
    9048         [ #  # ]:          0 :             sal_Bool bOpt = ScUnoHelpFunctions::GetBoolFromAny( aValue );
    9049         [ #  # ]:          0 :             if (bOpt)
    9050         [ #  # ]:          0 :                 rFunc.SetWidthOrHeight( false, 1, nRowArr, nTab, SC_SIZE_OPTIMAL, 0, sal_True, sal_True );
    9051                 :            :             else
    9052                 :            :             {
    9053                 :            :                 //  set current height again manually
    9054         [ #  # ]:          0 :                 sal_uInt16 nHeight = pDoc->GetOriginalHeight( nRow, nTab );
    9055         [ #  # ]:          0 :                 rFunc.SetWidthOrHeight( false, 1, nRowArr, nTab, SC_SIZE_ORIGINAL, nHeight, sal_True, sal_True );
    9056                 :            :             }
    9057                 :            :         }
    9058 [ #  # ][ #  # ]:          0 :         else if ( pEntry->nWID == SC_WID_UNO_NEWPAGE || pEntry->nWID == SC_WID_UNO_MANPAGE )
    9059                 :            :         {
    9060         [ #  # ]:          0 :             sal_Bool bSet = ScUnoHelpFunctions::GetBoolFromAny( aValue );
    9061         [ #  # ]:          0 :             if (bSet)
    9062         [ #  # ]:          0 :                 rFunc.InsertPageBreak( false, rRange.aStart, sal_True, sal_True, sal_True );
    9063                 :            :             else
    9064         [ #  # ]:          0 :                 rFunc.RemovePageBreak( false, rRange.aStart, sal_True, sal_True, sal_True );
    9065                 :            :         }
    9066                 :            :         else
    9067         [ #  # ]:          2 :             ScCellRangeObj::SetOnePropertyValue(pEntry, aValue);        // base class, no Item WID
    9068                 :            :     }
    9069                 :            : }
    9070                 :            : 
    9071                 :         30 : void ScTableRowObj::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry,
    9072                 :            :                                         uno::Any& rAny )
    9073                 :            :                                                 throw(uno::RuntimeException)
    9074                 :            : {
    9075         [ +  - ]:         30 :     if ( pEntry )
    9076                 :            :     {
    9077                 :         30 :         ScDocShell* pDocSh = GetDocShell();
    9078         [ -  + ]:         30 :         if (!pDocSh)
    9079         [ #  # ]:          0 :             throw uno::RuntimeException();
    9080                 :         30 :         ScDocument* pDoc = pDocSh->GetDocument();
    9081                 :         30 :         const ScRange& rRange = GetRange();
    9082                 :            :         OSL_ENSURE(rRange.aStart.Row() == rRange.aEnd.Row(), "zuviele Zeilen");
    9083                 :         30 :         SCROW nRow = rRange.aStart.Row();
    9084                 :         30 :         SCTAB nTab = rRange.aStart.Tab();
    9085                 :            : 
    9086         [ +  + ]:         30 :         if ( pEntry->nWID == SC_WID_UNO_CELLHGT )
    9087                 :            :         {
    9088                 :            :             // for hidden row, return original height
    9089                 :          4 :             sal_uInt16 nHeight = pDoc->GetOriginalHeight( nRow, nTab );
    9090                 :            :             //  property is 1/100mm, row height is twips
    9091                 :          4 :             nHeight = (sal_uInt16) TwipsToHMM(nHeight);
    9092         [ +  - ]:          4 :             rAny <<= (sal_Int32)( nHeight );
    9093                 :            :         }
    9094         [ +  + ]:         26 :         else if ( pEntry->nWID == SC_WID_UNO_CELLVIS )
    9095                 :            :         {
    9096                 :         18 :             bool bHidden = pDoc->RowHidden(nRow, nTab);
    9097                 :         18 :             ScUnoHelpFunctions::SetBoolInAny( rAny, !bHidden );
    9098                 :            :         }
    9099         [ -  + ]:          8 :         else if ( pEntry->nWID == SC_WID_UNO_CELLFILT )
    9100                 :            :         {
    9101                 :          0 :             bool bVis = pDoc->RowFiltered(nRow, nTab);
    9102                 :          0 :             ScUnoHelpFunctions::SetBoolInAny( rAny, bVis );
    9103                 :            :         }
    9104         [ +  + ]:          8 :         else if ( pEntry->nWID == SC_WID_UNO_OHEIGHT )
    9105                 :            :         {
    9106                 :          4 :             sal_Bool bOpt = !(pDoc->GetRowFlags( nRow, nTab ) & CR_MANUALSIZE);
    9107                 :          4 :             ScUnoHelpFunctions::SetBoolInAny( rAny, bOpt );
    9108                 :            :         }
    9109         [ -  + ]:          4 :         else if ( pEntry->nWID == SC_WID_UNO_NEWPAGE )
    9110                 :            :         {
    9111                 :          0 :             ScBreakType nBreak = pDoc->HasRowBreak(nRow, nTab);
    9112                 :          0 :             ScUnoHelpFunctions::SetBoolInAny( rAny, nBreak );
    9113                 :            :         }
    9114         [ +  - ]:          4 :         else if ( pEntry->nWID == SC_WID_UNO_MANPAGE )
    9115                 :            :         {
    9116                 :          4 :             ScBreakType nBreak = (pDoc->HasRowBreak(nRow, nTab) & BREAK_MANUAL);
    9117                 :          4 :             ScUnoHelpFunctions::SetBoolInAny( rAny, nBreak );
    9118                 :            :         }
    9119                 :            :         else
    9120                 :          0 :             ScCellRangeObj::GetOnePropertyValue(pEntry, rAny);
    9121                 :            :     }
    9122                 :         30 : }
    9123                 :            : 
    9124                 :         24 : const SfxItemPropertyMap& ScTableRowObj::GetItemPropertyMap()
    9125                 :            : {
    9126                 :         24 :     return pRowPropSet->getPropertyMap();
    9127                 :            : }
    9128                 :            : 
    9129                 :            : //------------------------------------------------------------------------
    9130                 :            : 
    9131                 :          8 : ScCellsObj::ScCellsObj(ScDocShell* pDocSh, const ScRangeList& rR) :
    9132                 :            :     pDocShell( pDocSh ),
    9133 [ +  - ][ +  - ]:          8 :     aRanges( rR )
    9134                 :            : {
    9135         [ +  - ]:          8 :     pDocShell->GetDocument()->AddUnoObject(*this);
    9136                 :          8 : }
    9137                 :            : 
    9138 [ +  - ][ +  - ]:          8 : ScCellsObj::~ScCellsObj()
    9139                 :            : {
    9140         [ +  + ]:          8 :     if (pDocShell)
    9141         [ +  - ]:          4 :         pDocShell->GetDocument()->RemoveUnoObject(*this);
    9142         [ -  + ]:         16 : }
    9143                 :            : 
    9144                 :          8 : void ScCellsObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
    9145                 :            : {
    9146         [ -  + ]:          8 :     if ( rHint.ISA( ScUpdateRefHint ) )
    9147                 :            :     {
    9148                 :          0 :         const ScUpdateRefHint& rRef = (const ScUpdateRefHint&)rHint;
    9149                 :          0 :         aRanges.UpdateReference( rRef.GetMode(), pDocShell->GetDocument(), rRef.GetRange(),
    9150                 :          0 :                                         rRef.GetDx(), rRef.GetDy(), rRef.GetDz() );
    9151                 :            :     }
    9152   [ +  -  +  + ]:         16 :     else if ( rHint.ISA( SfxSimpleHint ) &&
                 [ +  + ]
    9153                 :          8 :             ((const SfxSimpleHint&)rHint).GetId() == SFX_HINT_DYING )
    9154                 :            :     {
    9155                 :          4 :         pDocShell = NULL;       // ungueltig geworden
    9156                 :            :     }
    9157                 :          8 : }
    9158                 :            : 
    9159                 :            : // XEnumerationAccess
    9160                 :            : 
    9161                 :          7 : uno::Reference<container::XEnumeration> SAL_CALL ScCellsObj::createEnumeration()
    9162                 :            :                                                     throw(uno::RuntimeException)
    9163                 :            : {
    9164         [ +  - ]:          7 :     SolarMutexGuard aGuard;
    9165         [ +  - ]:          7 :     if (pDocShell)
    9166 [ +  - ][ +  - ]:          7 :         return new ScCellsEnumeration( pDocShell, aRanges );
                 [ +  - ]
    9167 [ #  # ][ +  - ]:          7 :     return NULL;
    9168                 :            : }
    9169                 :            : 
    9170                 :          1 : uno::Type SAL_CALL ScCellsObj::getElementType() throw(uno::RuntimeException)
    9171                 :            : {
    9172         [ +  - ]:          1 :     SolarMutexGuard aGuard;
    9173 [ +  - ][ +  - ]:          1 :     return getCppuType((uno::Reference<table::XCell>*)0);
    9174                 :            : }
    9175                 :            : 
    9176                 :          1 : sal_Bool SAL_CALL ScCellsObj::hasElements() throw(uno::RuntimeException)
    9177                 :            : {
    9178         [ +  - ]:          1 :     SolarMutexGuard aGuard;
    9179                 :          1 :     sal_Bool bHas = false;
    9180         [ +  - ]:          1 :     if ( pDocShell )
    9181                 :            :     {
    9182                 :            :         //! schneller selber testen?
    9183                 :            : 
    9184 [ +  - ][ +  - ]:          1 :         uno::Reference<container::XEnumeration> xEnum(new ScCellsEnumeration( pDocShell, aRanges ));
                 [ +  - ]
    9185 [ +  - ][ +  - ]:          1 :         bHas = xEnum->hasMoreElements();
    9186                 :            :     }
    9187         [ +  - ]:          1 :     return bHas;
    9188                 :            : }
    9189                 :            : 
    9190                 :            : //------------------------------------------------------------------------
    9191                 :            : 
    9192                 :          8 : ScCellsEnumeration::ScCellsEnumeration(ScDocShell* pDocSh, const ScRangeList& rR) :
    9193                 :            :     pDocShell( pDocSh ),
    9194                 :            :     aRanges( rR ),
    9195                 :            :     pMark( NULL ),
    9196 [ +  - ][ +  - ]:          8 :     bAtEnd( false )
    9197                 :            : {
    9198                 :          8 :     ScDocument* pDoc = pDocShell->GetDocument();
    9199         [ +  - ]:          8 :     pDoc->AddUnoObject(*this);
    9200                 :            : 
    9201 [ +  - ][ +  + ]:          8 :     if ( aRanges.empty() )
    9202                 :          4 :         bAtEnd = true;
    9203                 :            :     else
    9204                 :            :     {
    9205                 :          4 :         SCTAB nTab = 0;
    9206         [ +  - ]:          4 :         const ScRange* pFirst = aRanges[ 0 ];
    9207         [ +  - ]:          4 :         if (pFirst)
    9208                 :          4 :             nTab = pFirst->aStart.Tab();
    9209                 :          4 :         aPos = ScAddress(0,0,nTab);
    9210         [ +  - ]:          4 :         CheckPos_Impl();                    // aPos auf erste passende Zelle setzen
    9211                 :            :     }
    9212                 :          8 : }
    9213                 :            : 
    9214                 :          4 : void ScCellsEnumeration::CheckPos_Impl()
    9215                 :            : {
    9216         [ +  - ]:          4 :     if (pDocShell)
    9217                 :            :     {
    9218                 :          4 :         sal_Bool bFound = false;
    9219                 :          4 :         ScDocument* pDoc = pDocShell->GetDocument();
    9220                 :          4 :         ScBaseCell* pCell = pDoc->GetCell(aPos);
    9221 [ +  - ][ +  - ]:          4 :         if ( pCell && pCell->GetCellType() != CELLTYPE_NOTE )
                 [ +  - ]
    9222                 :            :         {
    9223         [ +  - ]:          4 :             if (!pMark)
    9224                 :            :             {
    9225         [ +  - ]:          4 :                 pMark = new ScMarkData;
    9226                 :          4 :                 pMark->MarkFromRangeList( aRanges, false );
    9227                 :          4 :                 pMark->MarkToMulti();   // needed for GetNextMarkedCell
    9228                 :            :             }
    9229                 :          4 :             bFound = pMark->IsCellMarked( aPos.Col(), aPos.Row() );
    9230                 :            :         }
    9231         [ +  + ]:          4 :         if (!bFound)
    9232                 :          1 :             Advance_Impl();
    9233                 :            :     }
    9234                 :          4 : }
    9235                 :            : 
    9236 [ +  - ][ +  - ]:          8 : ScCellsEnumeration::~ScCellsEnumeration()
    9237                 :            : {
    9238         [ +  + ]:          8 :     if (pDocShell)
    9239         [ +  - ]:          5 :         pDocShell->GetDocument()->RemoveUnoObject(*this);
    9240 [ +  + ][ +  - ]:          8 :     delete pMark;
    9241         [ -  + ]:         16 : }
    9242                 :            : 
    9243                 :          4 : void ScCellsEnumeration::Advance_Impl()
    9244                 :            : {
    9245                 :            :     OSL_ENSURE(!bAtEnd,"zuviel Advance_Impl");
    9246         [ -  + ]:          4 :     if (!pMark)
    9247                 :            :     {
    9248 [ #  # ][ #  # ]:          0 :         pMark = new ScMarkData;
    9249         [ #  # ]:          0 :         pMark->MarkFromRangeList( aRanges, false );
    9250         [ #  # ]:          0 :         pMark->MarkToMulti();   // needed for GetNextMarkedCell
    9251                 :            :     }
    9252                 :            : 
    9253                 :          4 :     SCCOL nCol = aPos.Col();
    9254                 :          4 :     SCROW nRow = aPos.Row();
    9255                 :          4 :     SCTAB nTab = aPos.Tab();
    9256         [ +  - ]:          4 :     sal_Bool bFound = pDocShell->GetDocument()->GetNextMarkedCell( nCol, nRow, nTab, *pMark );
    9257         [ +  + ]:          4 :     if (bFound)
    9258                 :          3 :         aPos.Set( nCol, nRow, nTab );
    9259                 :            :     else
    9260                 :          1 :         bAtEnd = sal_True;      // kommt nix mehr
    9261                 :          4 : }
    9262                 :            : 
    9263                 :          7 : void ScCellsEnumeration::Notify( SfxBroadcaster&, const SfxHint& rHint )
    9264                 :            : {
    9265         [ -  + ]:          7 :     if ( rHint.ISA( ScUpdateRefHint ) )
    9266                 :            :     {
    9267         [ #  # ]:          0 :         if (pDocShell)
    9268                 :            :         {
    9269                 :          0 :             const ScUpdateRefHint& rRef = (const ScUpdateRefHint&)rHint;
    9270                 :          0 :             aRanges.UpdateReference( rRef.GetMode(), pDocShell->GetDocument(), rRef.GetRange(),
    9271                 :          0 :                                             rRef.GetDx(), rRef.GetDy(), rRef.GetDz() );
    9272                 :            : 
    9273         [ #  # ]:          0 :             delete pMark;       // aus verschobenen Bereichen neu erzeugen
    9274                 :          0 :             pMark = NULL;
    9275                 :            : 
    9276         [ #  # ]:          0 :             if (!bAtEnd)        // aPos anpassen
    9277                 :            :             {
    9278         [ #  # ]:          0 :                 ScRangeList aNew;
    9279         [ #  # ]:          0 :                 aNew.Append(ScRange(aPos));
    9280                 :          0 :                 aNew.UpdateReference( rRef.GetMode(), pDocShell->GetDocument(), rRef.GetRange(),
    9281         [ #  # ]:          0 :                                         rRef.GetDx(), rRef.GetDy(), rRef.GetDz() );
    9282 [ #  # ][ #  # ]:          0 :                 if (aNew.size()==1)
    9283                 :            :                 {
    9284         [ #  # ]:          0 :                     aPos = aNew[ 0 ]->aStart;
    9285         [ #  # ]:          0 :                     CheckPos_Impl();
    9286         [ #  # ]:          0 :                 }
    9287                 :            :             }
    9288                 :            :         }
    9289                 :            :     }
    9290   [ +  -  +  + ]:         14 :     else if ( rHint.ISA( SfxSimpleHint ) &&
                 [ +  + ]
    9291                 :          7 :             ((const SfxSimpleHint&)rHint).GetId() == SFX_HINT_DYING )
    9292                 :            :     {
    9293                 :          3 :         pDocShell = NULL;       // ungueltig geworden
    9294                 :            :     }
    9295                 :          7 : }
    9296                 :            : 
    9297                 :            : // XEnumeration
    9298                 :            : 
    9299                 :         10 : sal_Bool SAL_CALL ScCellsEnumeration::hasMoreElements() throw(uno::RuntimeException)
    9300                 :            : {
    9301         [ +  - ]:         10 :     SolarMutexGuard aGuard;
    9302         [ +  - ]:         10 :     return !bAtEnd;
    9303                 :            : }
    9304                 :            : 
    9305                 :          4 : uno::Any SAL_CALL ScCellsEnumeration::nextElement() throw(container::NoSuchElementException,
    9306                 :            :                                         lang::WrappedTargetException, uno::RuntimeException)
    9307                 :            : {
    9308         [ +  - ]:          4 :     SolarMutexGuard aGuard;
    9309 [ +  - ][ +  + ]:          4 :     if (pDocShell && !bAtEnd)
    9310                 :            :     {
    9311                 :            :         // Interface-Typ muss zu ScCellsObj::getElementType passen
    9312                 :            : 
    9313                 :          3 :         ScAddress aTempPos(aPos);
    9314         [ +  - ]:          3 :         Advance_Impl();
    9315 [ +  - ][ +  - ]:          6 :         return uno::makeAny(uno::Reference<table::XCell>(new ScCellObj( pDocShell, aTempPos )));
         [ +  - ][ +  - ]
    9316                 :            :     }
    9317                 :            : 
    9318 [ +  - ][ +  - ]:          4 :     throw container::NoSuchElementException();      // no more elements
    9319                 :            : }
    9320                 :            : 
    9321                 :            : //------------------------------------------------------------------------
    9322                 :            : 
    9323                 :          4 : ScCellFormatsObj::ScCellFormatsObj(ScDocShell* pDocSh, const ScRange& rRange) :
    9324                 :            :     pDocShell( pDocSh ),
    9325         [ +  - ]:          4 :     aTotalRange( rRange )
    9326                 :            : {
    9327                 :          4 :     ScDocument* pDoc = pDocShell->GetDocument();
    9328         [ +  - ]:          4 :     pDoc->AddUnoObject(*this);
    9329                 :            : 
    9330                 :            :     OSL_ENSURE( aTotalRange.aStart.Tab() == aTotalRange.aEnd.Tab(), "unterschiedliche Tabellen" );
    9331                 :          4 : }
    9332                 :            : 
    9333         [ +  - ]:          4 : ScCellFormatsObj::~ScCellFormatsObj()
    9334                 :            : {
    9335         [ -  + ]:          4 :     if (pDocShell)
    9336         [ #  # ]:          0 :         pDocShell->GetDocument()->RemoveUnoObject(*this);
    9337         [ -  + ]:          8 : }
    9338                 :            : 
    9339                 :         20 : void ScCellFormatsObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
    9340                 :            : {
    9341         [ +  - ]:         20 :     if ( rHint.ISA( ScUpdateRefHint ) )
    9342                 :            :     {
    9343                 :            :         //! aTotalRange...
    9344                 :            :     }
    9345   [ +  +  +  + ]:         36 :     else if ( rHint.ISA( SfxSimpleHint ) &&
                 [ +  + ]
    9346                 :         16 :             ((const SfxSimpleHint&)rHint).GetId() == SFX_HINT_DYING )
    9347                 :            :     {
    9348                 :          4 :         pDocShell = NULL;       // ungueltig geworden
    9349                 :            :     }
    9350                 :         20 : }
    9351                 :            : 
    9352                 :          6 : ScCellRangeObj* ScCellFormatsObj::GetObjectByIndex_Impl(long nIndex) const
    9353                 :            : {
    9354                 :            :     //! direkt auf die AttrArrays zugreifen !!!!
    9355                 :            : 
    9356                 :          6 :     ScCellRangeObj* pRet = NULL;
    9357         [ +  - ]:          6 :     if (pDocShell)
    9358                 :            :     {
    9359                 :          6 :         ScDocument* pDoc = pDocShell->GetDocument();
    9360                 :          6 :         long nPos = 0;
    9361                 :          6 :         ScAttrRectIterator aIter( pDoc, aTotalRange.aStart.Tab(),
    9362                 :          6 :                                     aTotalRange.aStart.Col(), aTotalRange.aStart.Row(),
    9363         [ +  - ]:         12 :                                     aTotalRange.aEnd.Col(), aTotalRange.aEnd.Row() );
    9364                 :            :         SCCOL nCol1, nCol2;
    9365                 :            :         SCROW nRow1, nRow2;
    9366 [ +  - ][ +  + ]:         12 :         while ( aIter.GetNext( nCol1, nCol2, nRow1, nRow2 ) )
    9367                 :            :         {
    9368         [ +  + ]:          6 :             if ( nPos == nIndex )
    9369                 :            :             {
    9370                 :          5 :                 SCTAB nTab = aTotalRange.aStart.Tab();
    9371                 :          5 :                 ScRange aNext( nCol1, nRow1, nTab, nCol2, nRow2, nTab );
    9372                 :            : 
    9373         [ -  + ]:          5 :                 if ( aNext.aStart == aNext.aEnd )
    9374         [ #  # ]:          0 :                     pRet = new ScCellObj( pDocShell, aNext.aStart );
    9375                 :            :                 else
    9376         [ +  - ]:          5 :                     pRet = new ScCellRangeObj( pDocShell, aNext );
    9377                 :            :             }
    9378                 :          6 :             ++nPos;
    9379         [ +  - ]:          6 :         }
    9380                 :            :     }
    9381                 :          6 :     return pRet;
    9382                 :            : }
    9383                 :            : 
    9384                 :            : // XIndexAccess
    9385                 :            : 
    9386                 :          4 : sal_Int32 SAL_CALL ScCellFormatsObj::getCount() throw(uno::RuntimeException)
    9387                 :            : {
    9388         [ +  - ]:          4 :     SolarMutexGuard aGuard;
    9389                 :            : 
    9390                 :            :     //! direkt auf die AttrArrays zugreifen !!!!
    9391                 :            : 
    9392                 :          4 :     long nCount = 0;
    9393         [ +  - ]:          4 :     if (pDocShell)
    9394                 :            :     {
    9395                 :          4 :         ScDocument* pDoc = pDocShell->GetDocument();
    9396                 :          4 :         ScAttrRectIterator aIter( pDoc, aTotalRange.aStart.Tab(),
    9397                 :          4 :                                     aTotalRange.aStart.Col(), aTotalRange.aStart.Row(),
    9398         [ +  - ]:          8 :                                     aTotalRange.aEnd.Col(), aTotalRange.aEnd.Row() );
    9399                 :            :         SCCOL nCol1, nCol2;
    9400                 :            :         SCROW nRow1, nRow2;
    9401 [ +  - ][ +  + ]:          8 :         while ( aIter.GetNext( nCol1, nCol2, nRow1, nRow2 ) )
    9402         [ +  - ]:          8 :             ++nCount;
    9403                 :            :     }
    9404         [ +  - ]:          4 :     return nCount;
    9405                 :            : }
    9406                 :            : 
    9407                 :          6 : uno::Any SAL_CALL ScCellFormatsObj::getByIndex( sal_Int32 nIndex )
    9408                 :            :                             throw(lang::IndexOutOfBoundsException,
    9409                 :            :                                     lang::WrappedTargetException, uno::RuntimeException)
    9410                 :            : {
    9411         [ +  - ]:          6 :     SolarMutexGuard aGuard;
    9412                 :            : 
    9413 [ +  - ][ +  + ]:          6 :     uno::Reference<table::XCellRange> xRange(GetObjectByIndex_Impl(nIndex));
                 [ +  - ]
    9414         [ +  + ]:          6 :     if (xRange.is())
    9415         [ +  - ]:         10 :         return uno::makeAny(xRange);
    9416                 :            :     else
    9417 [ +  - ][ +  - ]:          6 :         throw lang::IndexOutOfBoundsException();
    9418                 :            : }
    9419                 :            : 
    9420                 :          1 : uno::Type SAL_CALL ScCellFormatsObj::getElementType() throw(uno::RuntimeException)
    9421                 :            : {
    9422         [ +  - ]:          1 :     SolarMutexGuard aGuard;
    9423 [ +  - ][ +  - ]:          1 :     return getCppuType((uno::Reference<table::XCellRange>*)0);
    9424                 :            : }
    9425                 :            : 
    9426                 :          1 : sal_Bool SAL_CALL ScCellFormatsObj::hasElements() throw(uno::RuntimeException)
    9427                 :            : {
    9428         [ +  - ]:          1 :     SolarMutexGuard aGuard;
    9429 [ +  - ][ +  - ]:          1 :     return ( getCount() != 0 );     //! immer groesser 0 ??
    9430                 :            : }
    9431                 :            : 
    9432                 :            : // XEnumerationAccess
    9433                 :            : 
    9434                 :          2 : uno::Reference<container::XEnumeration> SAL_CALL ScCellFormatsObj::createEnumeration()
    9435                 :            :                                                     throw(uno::RuntimeException)
    9436                 :            : {
    9437         [ +  - ]:          2 :     SolarMutexGuard aGuard;
    9438         [ +  - ]:          2 :     if (pDocShell)
    9439 [ +  - ][ +  - ]:          2 :         return new ScCellFormatsEnumeration( pDocShell, aTotalRange );
                 [ +  - ]
    9440 [ #  # ][ +  - ]:          2 :     return NULL;
    9441                 :            : }
    9442                 :            : 
    9443                 :            : //------------------------------------------------------------------------
    9444                 :            : 
    9445                 :          2 : ScCellFormatsEnumeration::ScCellFormatsEnumeration(ScDocShell* pDocSh, const ScRange& rRange) :
    9446                 :            :     pDocShell( pDocSh ),
    9447                 :          2 :     nTab( rRange.aStart.Tab() ),
    9448                 :            :     pIter( NULL ),
    9449                 :            :     bAtEnd( false ),
    9450         [ +  - ]:          4 :     bDirty( false )
    9451                 :            : {
    9452                 :          2 :     ScDocument* pDoc = pDocShell->GetDocument();
    9453         [ +  - ]:          2 :     pDoc->AddUnoObject(*this);
    9454                 :            : 
    9455                 :            :     OSL_ENSURE( rRange.aStart.Tab() == rRange.aEnd.Tab(),
    9456                 :            :                 "CellFormatsEnumeration: unterschiedliche Tabellen" );
    9457                 :            : 
    9458                 :            :     pIter = new ScAttrRectIterator( pDoc, nTab,
    9459                 :          2 :                                     rRange.aStart.Col(), rRange.aStart.Row(),
    9460 [ +  - ][ +  - ]:          2 :                                     rRange.aEnd.Col(), rRange.aEnd.Row() );
    9461         [ +  - ]:          2 :     Advance_Impl();
    9462                 :          2 : }
    9463                 :            : 
    9464         [ +  - ]:          2 : ScCellFormatsEnumeration::~ScCellFormatsEnumeration()
    9465                 :            : {
    9466         [ -  + ]:          2 :     if (pDocShell)
    9467         [ #  # ]:          0 :         pDocShell->GetDocument()->RemoveUnoObject(*this);
    9468 [ -  + ][ #  # ]:          2 :     delete pIter;
    9469         [ -  + ]:          4 : }
    9470                 :            : 
    9471                 :          3 : void ScCellFormatsEnumeration::Advance_Impl()
    9472                 :            : {
    9473                 :            :     OSL_ENSURE(!bAtEnd,"zuviel Advance_Impl");
    9474                 :            : 
    9475         [ +  - ]:          3 :     if ( pIter )
    9476                 :            :     {
    9477         [ -  + ]:          3 :         if ( bDirty )
    9478                 :            :         {
    9479         [ #  # ]:          0 :             pIter->DataChanged();   // AttrArray-Index neu suchen
    9480                 :          0 :             bDirty = false;
    9481                 :            :         }
    9482                 :            : 
    9483                 :            :         SCCOL nCol1, nCol2;
    9484                 :            :         SCROW nRow1, nRow2;
    9485 [ +  - ][ +  + ]:          3 :         if ( pIter->GetNext( nCol1, nCol2, nRow1, nRow2 ) )
    9486                 :          2 :             aNext = ScRange( nCol1, nRow1, nTab, nCol2, nRow2, nTab );
    9487                 :            :         else
    9488                 :          3 :             bAtEnd = sal_True;      // kommt nix mehr
    9489                 :            :     }
    9490                 :            :     else
    9491                 :          0 :         bAtEnd = sal_True;          // Dok weggekommen oder so
    9492                 :          3 : }
    9493                 :            : 
    9494                 :          1 : ScCellRangeObj* ScCellFormatsEnumeration::NextObject_Impl()
    9495                 :            : {
    9496                 :          1 :     ScCellRangeObj* pRet = NULL;
    9497 [ +  - ][ +  - ]:          1 :     if (pDocShell && !bAtEnd)
    9498                 :            :     {
    9499         [ -  + ]:          1 :         if ( aNext.aStart == aNext.aEnd )
    9500         [ #  # ]:          0 :             pRet = new ScCellObj( pDocShell, aNext.aStart );
    9501                 :            :         else
    9502         [ +  - ]:          1 :             pRet = new ScCellRangeObj( pDocShell, aNext );
    9503                 :          1 :         Advance_Impl();
    9504                 :            :     }
    9505                 :          1 :     return pRet;
    9506                 :            : }
    9507                 :            : 
    9508                 :          2 : void ScCellFormatsEnumeration::Notify( SfxBroadcaster&, const SfxHint& rHint )
    9509                 :            : {
    9510         [ +  - ]:          2 :     if ( rHint.ISA( ScUpdateRefHint ) )
    9511                 :            :     {
    9512                 :            :         //! und nun ???
    9513                 :            :     }
    9514         [ +  - ]:          2 :     else if ( rHint.ISA( SfxSimpleHint ) )
    9515                 :            :     {
    9516                 :          2 :         sal_uLong nId = ((const SfxSimpleHint&)rHint).GetId();
    9517         [ +  - ]:          2 :         if ( nId == SFX_HINT_DYING )
    9518                 :            :         {
    9519                 :          2 :             pDocShell = NULL;                       // ungueltig geworden
    9520         [ +  - ]:          2 :             delete pIter;
    9521                 :          2 :             pIter = NULL;
    9522                 :            :         }
    9523         [ #  # ]:          0 :         else if ( nId == SFX_HINT_DATACHANGED )
    9524                 :            :         {
    9525                 :          0 :             bDirty = sal_True;          // AttrArray-Index evtl. ungueltig geworden
    9526                 :            :         }
    9527                 :            :     }
    9528                 :          2 : }
    9529                 :            : 
    9530                 :            : // XEnumeration
    9531                 :            : 
    9532                 :          2 : sal_Bool SAL_CALL ScCellFormatsEnumeration::hasMoreElements() throw(uno::RuntimeException)
    9533                 :            : {
    9534         [ +  - ]:          2 :     SolarMutexGuard aGuard;
    9535         [ +  - ]:          2 :     return !bAtEnd;
    9536                 :            : }
    9537                 :            : 
    9538                 :          2 : uno::Any SAL_CALL ScCellFormatsEnumeration::nextElement() throw(container::NoSuchElementException,
    9539                 :            :                                         lang::WrappedTargetException, uno::RuntimeException)
    9540                 :            : {
    9541         [ +  - ]:          2 :     SolarMutexGuard aGuard;
    9542                 :            : 
    9543 [ +  + ][ -  + ]:          2 :     if ( bAtEnd || !pDocShell )
    9544         [ +  - ]:          1 :         throw container::NoSuchElementException();      // no more elements
    9545                 :            : 
    9546                 :            :     // Interface-Typ muss zu ScCellFormatsObj::getElementType passen
    9547                 :            : 
    9548 [ +  - ][ +  - ]:          2 :     return uno::makeAny(uno::Reference<table::XCellRange> (NextObject_Impl()));
         [ +  - ][ +  - ]
                 [ +  - ]
    9549                 :            : }
    9550                 :            : 
    9551                 :            : //------------------------------------------------------------------------
    9552                 :            : 
    9553                 :          8 : ScUniqueCellFormatsObj::ScUniqueCellFormatsObj(ScDocShell* pDocSh, const ScRange& rRange) :
    9554                 :            :     pDocShell( pDocSh ),
    9555                 :            :     aTotalRange( rRange ),
    9556 [ +  - ][ +  - ]:          8 :     aRangeLists()
    9557                 :            : {
    9558         [ +  - ]:          8 :     pDocShell->GetDocument()->AddUnoObject(*this);
    9559                 :            : 
    9560                 :            :     OSL_ENSURE( aTotalRange.aStart.Tab() == aTotalRange.aEnd.Tab(), "unterschiedliche Tabellen" );
    9561                 :            : 
    9562         [ +  - ]:          8 :     GetObjects_Impl();
    9563                 :          8 : }
    9564                 :            : 
    9565         [ +  - ]:          8 : ScUniqueCellFormatsObj::~ScUniqueCellFormatsObj()
    9566                 :            : {
    9567         [ +  + ]:          8 :     if (pDocShell)
    9568         [ +  - ]:          4 :         pDocShell->GetDocument()->RemoveUnoObject(*this);
    9569         [ -  + ]:         16 : }
    9570                 :            : 
    9571                 :          4 : void ScUniqueCellFormatsObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
    9572                 :            : {
    9573         [ +  - ]:          4 :     if ( rHint.ISA( ScUpdateRefHint ) )
    9574                 :            :     {
    9575                 :            :         //! aTotalRange...
    9576                 :            :     }
    9577         [ +  - ]:          4 :     else if ( rHint.ISA( SfxSimpleHint ) )
    9578                 :            :     {
    9579                 :          4 :         sal_uLong nId = ((const SfxSimpleHint&)rHint).GetId();
    9580         [ +  - ]:          4 :         if ( nId == SFX_HINT_DYING )
    9581                 :          4 :             pDocShell = NULL;                       // ungueltig geworden
    9582                 :            :     }
    9583                 :          4 : }
    9584                 :            : 
    9585                 :            : //
    9586                 :            : //  Fill the list of formats from the document
    9587                 :            : //
    9588                 :            : 
    9589                 :            : // hash code to access the range lists by ScPatternAttr pointer
    9590                 :            : struct ScPatternHashCode
    9591                 :            : {
    9592                 :         30 :     size_t operator()( const ScPatternAttr* pPattern ) const
    9593                 :            :     {
    9594                 :         30 :         return reinterpret_cast<size_t>(pPattern);
    9595                 :            :     }
    9596                 :            : };
    9597                 :            : 
    9598                 :            : // Hash map to find a range by its start row
    9599                 :            : typedef ::boost::unordered_map< SCROW, ScRange > ScRowRangeHashMap;
    9600                 :            : 
    9601                 :            : typedef ::std::vector<ScRange> ScRangeVector;
    9602                 :            : 
    9603                 :            : // Hash map entry.
    9604                 :            : // The Join method depends on the column-wise order of ScAttrRectIterator
    9605                 :            : class ScUniqueFormatsEntry
    9606                 :            : {
    9607                 :            :     enum EntryState { STATE_EMPTY, STATE_SINGLE, STATE_COMPLEX };
    9608                 :            : 
    9609                 :            :     EntryState          eState;
    9610                 :            :     ScRange             aSingleRange;
    9611                 :            :     ScRowRangeHashMap   aJoinedRanges;      // "active" ranges to be merged
    9612                 :            :     ScRangeVector       aCompletedRanges;   // ranges that will no longer be touched
    9613                 :            :     ScRangeListRef      aReturnRanges;      // result as ScRangeList for further use
    9614                 :            : 
    9615                 :            : public:
    9616 [ +  - ][ +  - ]:         14 :                         ScUniqueFormatsEntry() : eState( STATE_EMPTY ) {}
    9617                 :            :                         ScUniqueFormatsEntry( const ScUniqueFormatsEntry& r ) :
    9618                 :            :                             eState( r.eState ),
    9619                 :            :                             aSingleRange( r.aSingleRange ),
    9620                 :            :                             aJoinedRanges( r.aJoinedRanges ),
    9621                 :            :                             aCompletedRanges( r.aCompletedRanges ),
    9622                 :            :                             aReturnRanges( r.aReturnRanges ) {}
    9623         [ +  - ]:         14 :                         ~ScUniqueFormatsEntry() {}
    9624                 :            : 
    9625                 :            :     void                Join( const ScRange& rNewRange );
    9626                 :            :     const ScRangeList&  GetRanges();
    9627                 :         14 :     void                Clear() { aReturnRanges.Clear(); }  // aJoinedRanges and aCompletedRanges are cleared in GetRanges
    9628                 :            : };
    9629                 :            : 
    9630                 :         30 : void ScUniqueFormatsEntry::Join( const ScRange& rNewRange )
    9631                 :            : {
    9632                 :            :     // Special-case handling for single range
    9633                 :            : 
    9634         [ +  + ]:         30 :     if ( eState == STATE_EMPTY )
    9635                 :            :     {
    9636                 :         14 :         aSingleRange = rNewRange;
    9637                 :         14 :         eState = STATE_SINGLE;
    9638                 :            :         return;
    9639                 :            :     }
    9640         [ +  + ]:         16 :     if ( eState == STATE_SINGLE )
    9641                 :            :     {
    9642   [ +  +  +  -  :         24 :         if ( aSingleRange.aStart.Row() == rNewRange.aStart.Row() &&
           +  - ][ +  + ]
    9643                 :          6 :              aSingleRange.aEnd.Row() == rNewRange.aEnd.Row() &&
    9644                 :          6 :              aSingleRange.aEnd.Col() + 1 == rNewRange.aStart.Col() )
    9645                 :            :         {
    9646                 :          6 :             aSingleRange.aEnd.SetCol( rNewRange.aEnd.Col() );
    9647                 :            :             return;     // still a single range
    9648                 :            :         }
    9649                 :            : 
    9650                 :          6 :         SCROW nSingleRow = aSingleRange.aStart.Row();
    9651         [ +  - ]:          6 :         aJoinedRanges.insert( ScRowRangeHashMap::value_type( nSingleRow, aSingleRange ) );
    9652                 :          6 :         eState = STATE_COMPLEX;
    9653                 :            :         // continue normally
    9654                 :            :     }
    9655                 :            : 
    9656                 :            :     // This is called in the order of ScAttrRectIterator results.
    9657                 :            :     // rNewRange can only be joined with an existing entry if it's the same rows, starting in the next column.
    9658                 :            :     // If the old entry for the start row extends to a different end row, or ends in a different column, it
    9659                 :            :     // can be moved to aCompletedRanges because it can't be joined with following iterator results.
    9660                 :            :     // Everything happens within one sheet, so Tab can be ignored.
    9661                 :            : 
    9662                 :         10 :     SCROW nStartRow = rNewRange.aStart.Row();
    9663         [ +  - ]:         10 :     ScRowRangeHashMap::iterator aIter( aJoinedRanges.find( nStartRow ) );       // find the active entry for the start row
    9664 [ +  - ][ +  + ]:         10 :     if ( aIter != aJoinedRanges.end() )
    9665                 :            :     {
    9666         [ +  - ]:          4 :         ScRange& rOldRange = aIter->second;
    9667   [ -  +  #  # ]:          4 :         if ( rOldRange.aEnd.Row() == rNewRange.aEnd.Row() &&
                 [ -  + ]
    9668                 :          0 :              rOldRange.aEnd.Col() + 1 == rNewRange.aStart.Col() )
    9669                 :            :         {
    9670                 :            :             // extend existing range
    9671                 :          0 :             rOldRange.aEnd.SetCol( rNewRange.aEnd.Col() );
    9672                 :            :         }
    9673                 :            :         else
    9674                 :            :         {
    9675                 :            :             // move old range to aCompletedRanges, keep rNewRange for joining
    9676         [ +  - ]:          4 :             aCompletedRanges.push_back( rOldRange );
    9677                 :          4 :             rOldRange = rNewRange;  // replace in hash map
    9678                 :            :         }
    9679                 :            :     }
    9680                 :            :     else
    9681                 :            :     {
    9682                 :            :         // keep rNewRange for joining
    9683 [ +  - ][ +  - ]:         30 :         aJoinedRanges.insert( ScRowRangeHashMap::value_type( nStartRow, rNewRange ) );
    9684                 :            :     }
    9685                 :            : }
    9686                 :            : 
    9687                 :         14 : const ScRangeList& ScUniqueFormatsEntry::GetRanges()
    9688                 :            : {
    9689         [ +  + ]:         14 :     if ( eState == STATE_SINGLE )
    9690                 :            :     {
    9691 [ +  - ][ +  - ]:          8 :         aReturnRanges = new ScRangeList;
                 [ +  - ]
    9692         [ +  - ]:          8 :         aReturnRanges->Append( aSingleRange );
    9693                 :          8 :         return *aReturnRanges;
    9694                 :            :     }
    9695                 :            : 
    9696                 :            :     // move remaining entries from aJoinedRanges to aCompletedRanges
    9697                 :            : 
    9698         [ +  - ]:          6 :     ScRowRangeHashMap::const_iterator aJoinedEnd = aJoinedRanges.end();
    9699 [ +  + ][ +  - ]:         18 :     for ( ScRowRangeHashMap::const_iterator aJoinedIter = aJoinedRanges.begin(); aJoinedIter != aJoinedEnd; ++aJoinedIter )
    9700 [ +  - ][ +  - ]:         12 :         aCompletedRanges.push_back( aJoinedIter->second );
    9701         [ +  - ]:          6 :     aJoinedRanges.clear();
    9702                 :            : 
    9703                 :            :     // sort all ranges for a predictable API result
    9704                 :            : 
    9705         [ +  - ]:          6 :     std::sort( aCompletedRanges.begin(), aCompletedRanges.end() );
    9706                 :            : 
    9707                 :            :     // fill and return ScRangeList
    9708                 :            : 
    9709 [ +  - ][ +  - ]:          6 :     aReturnRanges = new ScRangeList;
                 [ +  - ]
    9710         [ +  - ]:          6 :     ScRangeVector::const_iterator aCompEnd( aCompletedRanges.end() );
    9711 [ +  - ][ +  - ]:         22 :     for ( ScRangeVector::const_iterator aCompIter( aCompletedRanges.begin() ); aCompIter != aCompEnd; ++aCompIter )
                 [ +  + ]
    9712         [ +  - ]:         16 :         aReturnRanges->Append( *aCompIter );
    9713                 :          6 :     aCompletedRanges.clear();
    9714                 :            : 
    9715                 :         14 :     return *aReturnRanges;
    9716                 :            : }
    9717                 :            : 
    9718                 :            : typedef ::boost::unordered_map< const ScPatternAttr*, ScUniqueFormatsEntry, ScPatternHashCode > ScUniqueFormatsHashMap;
    9719                 :            : 
    9720                 :            : // function object to sort the range lists by start of first range
    9721                 :            : struct ScUniqueFormatsOrder
    9722                 :            : {
    9723                 :          6 :     bool operator()( const ScRangeList& rList1, const ScRangeList& rList2 ) const
    9724                 :            :     {
    9725                 :            :         // all range lists have at least one entry
    9726                 :            :         OSL_ENSURE( rList1.size() > 0 && rList2.size() > 0, "ScUniqueFormatsOrder: empty list" );
    9727                 :            : 
    9728                 :            :         // compare start positions using ScAddress comparison operator
    9729                 :          6 :         return ( rList1[ 0 ]->aStart < rList2[ 0 ]->aStart );
    9730                 :            :     }
    9731                 :            : };
    9732                 :            : 
    9733                 :          8 : void ScUniqueCellFormatsObj::GetObjects_Impl()
    9734                 :            : {
    9735         [ +  - ]:          8 :     if (pDocShell)
    9736                 :            :     {
    9737                 :          8 :         ScDocument* pDoc = pDocShell->GetDocument();
    9738                 :          8 :         SCTAB nTab = aTotalRange.aStart.Tab();
    9739                 :            :         ScAttrRectIterator aIter( pDoc, nTab,
    9740                 :          8 :                                     aTotalRange.aStart.Col(), aTotalRange.aStart.Row(),
    9741         [ +  - ]:         16 :                                     aTotalRange.aEnd.Col(), aTotalRange.aEnd.Row() );
    9742                 :            :         SCCOL nCol1, nCol2;
    9743                 :            :         SCROW nRow1, nRow2;
    9744                 :            : 
    9745                 :            :         // Collect the ranges for each format in a hash map, to avoid nested loops
    9746                 :            : 
    9747         [ +  - ]:          8 :         ScUniqueFormatsHashMap aHashMap;
    9748 [ +  - ][ +  + ]:         38 :         while (aIter.GetNext( nCol1, nCol2, nRow1, nRow2 ) )
    9749                 :            :         {
    9750                 :         30 :             ScRange aRange( nCol1, nRow1, nTab, nCol2, nRow2, nTab );
    9751         [ +  - ]:         30 :             const ScPatternAttr* pPattern = pDoc->GetPattern(nCol1, nRow1, nTab);
    9752 [ +  - ][ +  - ]:         30 :             aHashMap[pPattern].Join( aRange );
    9753                 :            :         }
    9754                 :            : 
    9755                 :            :         // Fill the vector aRangeLists with the range lists from the hash map
    9756                 :            : 
    9757         [ +  - ]:          8 :         aRangeLists.reserve( aHashMap.size() );
    9758         [ +  - ]:          8 :         ScUniqueFormatsHashMap::iterator aMapIter( aHashMap.begin() );
    9759         [ +  - ]:          8 :         ScUniqueFormatsHashMap::iterator aMapEnd( aHashMap.end() );
    9760         [ +  + ]:         22 :         while ( aMapIter != aMapEnd )
    9761                 :            :         {
    9762         [ +  - ]:         14 :             ScUniqueFormatsEntry& rEntry = aMapIter->second;
    9763         [ +  - ]:         14 :             const ScRangeList& rRanges = rEntry.GetRanges();
    9764         [ +  - ]:         14 :             aRangeLists.push_back( rRanges );       // copy ScRangeList
    9765         [ +  - ]:         14 :             rEntry.Clear();                         // free memory, don't hold both copies of all ranges
    9766                 :         14 :             ++aMapIter;
    9767                 :            :         }
    9768                 :            : 
    9769                 :            :         // Sort the vector by first range's start position, to avoid random shuffling
    9770                 :            :         // due to using the ScPatterAttr pointers
    9771                 :            : 
    9772                 :            :         ScUniqueFormatsOrder aComp;
    9773 [ +  - ][ +  - ]:          8 :         ::std::sort( aRangeLists.begin(), aRangeLists.end(), aComp );
                 [ +  - ]
    9774                 :            :     }
    9775                 :          8 : }
    9776                 :            : 
    9777                 :            : // XIndexAccess
    9778                 :            : 
    9779                 :          7 : sal_Int32 SAL_CALL ScUniqueCellFormatsObj::getCount() throw(uno::RuntimeException)
    9780                 :            : {
    9781         [ +  - ]:          7 :     SolarMutexGuard aGuard;
    9782                 :            : 
    9783         [ +  - ]:          7 :     return aRangeLists.size();
    9784                 :            : }
    9785                 :            : 
    9786                 :         10 : uno::Any SAL_CALL ScUniqueCellFormatsObj::getByIndex( sal_Int32 nIndex )
    9787                 :            :                             throw(lang::IndexOutOfBoundsException,
    9788                 :            :                                     lang::WrappedTargetException, uno::RuntimeException)
    9789                 :            : {
    9790         [ +  - ]:         10 :     SolarMutexGuard aGuard;
    9791                 :            : 
    9792         [ +  + ]:         10 :     if(static_cast<sal_uInt32>(nIndex) < aRangeLists.size())
    9793 [ +  - ][ +  - ]:         18 :         return uno::makeAny(uno::Reference<sheet::XSheetCellRangeContainer>(new ScCellRangesObj(pDocShell, aRangeLists[nIndex])));
         [ +  - ][ +  - ]
                 [ +  - ]
    9794                 :            :     else
    9795 [ +  - ][ +  - ]:         10 :         throw lang::IndexOutOfBoundsException();
    9796                 :            : }
    9797                 :            : 
    9798                 :          1 : uno::Type SAL_CALL ScUniqueCellFormatsObj::getElementType() throw(uno::RuntimeException)
    9799                 :            : {
    9800         [ +  - ]:          1 :     SolarMutexGuard aGuard;
    9801 [ +  - ][ +  - ]:          1 :     return getCppuType((uno::Reference<sheet::XSheetCellRangeContainer>*)0);
    9802                 :            : }
    9803                 :            : 
    9804                 :          1 : sal_Bool SAL_CALL ScUniqueCellFormatsObj::hasElements() throw(uno::RuntimeException)
    9805                 :            : {
    9806         [ +  - ]:          1 :     SolarMutexGuard aGuard;
    9807         [ +  - ]:          1 :     return ( aRangeLists.size() != 0 );
    9808                 :            : }
    9809                 :            : 
    9810                 :            : // XEnumerationAccess
    9811                 :            : 
    9812                 :          2 : uno::Reference<container::XEnumeration> SAL_CALL ScUniqueCellFormatsObj::createEnumeration()
    9813                 :            :                                                     throw(uno::RuntimeException)
    9814                 :            : {
    9815         [ +  - ]:          2 :     SolarMutexGuard aGuard;
    9816         [ +  - ]:          2 :     if (pDocShell)
    9817 [ +  - ][ +  - ]:          2 :         return new ScUniqueCellFormatsEnumeration( pDocShell, aRangeLists );
                 [ +  - ]
    9818 [ #  # ][ +  - ]:          2 :     return NULL;
    9819                 :            : }
    9820                 :            : 
    9821                 :            : //------------------------------------------------------------------------
    9822                 :            : 
    9823                 :          2 : ScUniqueCellFormatsEnumeration::ScUniqueCellFormatsEnumeration(ScDocShell* pDocSh, const ScMyRangeLists& rRangeLists) :
    9824                 :            :     aRangeLists(rRangeLists),
    9825                 :            :     pDocShell( pDocSh ),
    9826 [ +  - ][ +  - ]:          2 :     nCurrentPosition(0)
    9827                 :            : {
    9828         [ +  - ]:          2 :     pDocShell->GetDocument()->AddUnoObject(*this);
    9829                 :          2 : }
    9830                 :            : 
    9831         [ +  - ]:          2 : ScUniqueCellFormatsEnumeration::~ScUniqueCellFormatsEnumeration()
    9832                 :            : {
    9833         [ -  + ]:          2 :     if (pDocShell)
    9834         [ #  # ]:          0 :         pDocShell->GetDocument()->RemoveUnoObject(*this);
    9835         [ -  + ]:          4 : }
    9836                 :            : 
    9837                 :          2 : void ScUniqueCellFormatsEnumeration::Notify( SfxBroadcaster&, const SfxHint& rHint )
    9838                 :            : {
    9839         [ +  - ]:          2 :     if ( rHint.ISA( ScUpdateRefHint ) )
    9840                 :            :     {
    9841                 :            :         //! und nun ???
    9842                 :            :     }
    9843         [ +  - ]:          2 :     else if ( rHint.ISA( SfxSimpleHint ) )
    9844                 :            :     {
    9845                 :          2 :         sal_uLong nId = ((const SfxSimpleHint&)rHint).GetId();
    9846         [ +  - ]:          2 :         if ( nId == SFX_HINT_DYING )
    9847                 :          2 :             pDocShell = NULL;                       // ungueltig geworden
    9848                 :            :     }
    9849                 :          2 : }
    9850                 :            : 
    9851                 :            : // XEnumeration
    9852                 :            : 
    9853                 :         10 : sal_Bool SAL_CALL ScUniqueCellFormatsEnumeration::hasMoreElements() throw(uno::RuntimeException)
    9854                 :            : {
    9855         [ +  - ]:         10 :     SolarMutexGuard aGuard;
    9856         [ +  - ]:         10 :     return static_cast<sal_uInt32>(nCurrentPosition) < aRangeLists.size();
    9857                 :            : }
    9858                 :            : 
    9859                 :          5 : uno::Any SAL_CALL ScUniqueCellFormatsEnumeration::nextElement() throw(container::NoSuchElementException,
    9860                 :            :                                         lang::WrappedTargetException, uno::RuntimeException)
    9861                 :            : {
    9862         [ +  - ]:          5 :     SolarMutexGuard aGuard;
    9863                 :            : 
    9864 [ +  - ][ +  + ]:          5 :     if ( !hasMoreElements() || !pDocShell )
         [ -  + ][ +  + ]
    9865         [ +  - ]:          1 :         throw container::NoSuchElementException();      // no more elements
    9866                 :            : 
    9867                 :            :     // Interface-Typ muss zu ScCellFormatsObj::getElementType passen
    9868                 :            : 
    9869 [ +  - ][ +  - ]:          5 :     return uno::makeAny(uno::Reference<sheet::XSheetCellRangeContainer>(new ScCellRangesObj(pDocShell, aRangeLists[nCurrentPosition++])));
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
    9870                 :            : }
    9871                 :            : 
    9872                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10