LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/sc/source/ui/unoobj - afmtuno.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 357 393 90.8 %
Date: 2013-07-09 Functions: 48 67 71.6 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include "scitems.hxx"
      21             : #include <editeng/memberids.hrc>
      22             : #include <tools/shl.hxx>
      23             : #include <svl/poolitem.hxx>
      24             : #include <vcl/svapp.hxx>
      25             : #include <svx/unomid.hxx>
      26             : #include "unowids.hxx"
      27             : #include <comphelper/servicehelper.hxx>
      28             : #include <com/sun/star/table/BorderLine.hpp>
      29             : #include <com/sun/star/table/CellVertJustify2.hpp>
      30             : #include <com/sun/star/table/ShadowLocation.hpp>
      31             : #include <com/sun/star/table/TableBorder.hpp>
      32             : #include <com/sun/star/table/ShadowFormat.hpp>
      33             : #include <com/sun/star/table/CellRangeAddress.hpp>
      34             : #include <com/sun/star/table/CellContentType.hpp>
      35             : #include <com/sun/star/table/TableOrientation.hpp>
      36             : #include <com/sun/star/table/CellHoriJustify.hpp>
      37             : #include <com/sun/star/util/SortField.hpp>
      38             : #include <com/sun/star/util/SortFieldType.hpp>
      39             : #include <com/sun/star/table/CellOrientation.hpp>
      40             : #include <com/sun/star/table/CellAddress.hpp>
      41             : #include <com/sun/star/awt/SimpleFontMetric.hpp>
      42             : #include <com/sun/star/awt/FontWeight.hpp>
      43             : #include <com/sun/star/awt/FontSlant.hpp>
      44             : #include <com/sun/star/awt/CharSet.hpp>
      45             : #include <com/sun/star/awt/FontDescriptor.hpp>
      46             : #include <com/sun/star/awt/FontWidth.hpp>
      47             : #include <com/sun/star/awt/XFont.hpp>
      48             : #include <com/sun/star/awt/FontType.hpp>
      49             : #include <com/sun/star/awt/FontUnderline.hpp>
      50             : #include <com/sun/star/awt/FontStrikeout.hpp>
      51             : #include <com/sun/star/awt/FontFamily.hpp>
      52             : #include <com/sun/star/awt/FontPitch.hpp>
      53             : 
      54             : #include "afmtuno.hxx"
      55             : #include "miscuno.hxx"
      56             : #include "autoform.hxx"
      57             : #include "scdll.hxx"
      58             : #include "unonames.hxx"
      59             : #include "cellsuno.hxx"
      60             : 
      61             : using namespace ::com::sun::star;
      62             : 
      63             : //------------------------------------------------------------------------
      64             : 
      65             : //  ein AutoFormat hat immer 16 Eintraege
      66             : #define SC_AF_FIELD_COUNT 16
      67             : 
      68             : //------------------------------------------------------------------------
      69             : 
      70             : //  AutoFormat-Map nur fuer PropertySetInfo, ohne Which-IDs
      71             : 
      72          27 : static const SfxItemPropertyMapEntry* lcl_GetAutoFormatMap()
      73             : {
      74             :     static SfxItemPropertyMapEntry aAutoFormatMap_Impl[] =
      75             :     {
      76           1 :         {MAP_CHAR_LEN(SC_UNONAME_INCBACK),  0,  &::getBooleanCppuType(),    0, 0 },
      77           1 :         {MAP_CHAR_LEN(SC_UNONAME_INCBORD),  0,  &::getBooleanCppuType(),    0, 0 },
      78           1 :         {MAP_CHAR_LEN(SC_UNONAME_INCFONT),  0,  &::getBooleanCppuType(),    0, 0 },
      79           1 :         {MAP_CHAR_LEN(SC_UNONAME_INCJUST),  0,  &::getBooleanCppuType(),    0, 0 },
      80           1 :         {MAP_CHAR_LEN(SC_UNONAME_INCNUM),   0,  &::getBooleanCppuType(),    0, 0 },
      81           1 :         {MAP_CHAR_LEN(SC_UNONAME_INCWIDTH), 0,  &::getBooleanCppuType(),    0, 0 },
      82             :         {0,0,0,0,0,0}
      83          33 :     };
      84          27 :     return aAutoFormatMap_Impl;
      85             : }
      86             : 
      87             : //! Zahlformat (String/Language) ??? (in XNumberFormat nur ReadOnly)
      88             : //! table::TableBorder ??!?
      89             : 
      90           4 : static const SfxItemPropertyMapEntry* lcl_GetAutoFieldMap()
      91             : {
      92             :     static SfxItemPropertyMapEntry aAutoFieldMap_Impl[] =
      93             :     {
      94           1 :         {MAP_CHAR_LEN(SC_UNONAME_CELLBACK), ATTR_BACKGROUND,        &::getCppuType((const sal_Int32*)0),        0, MID_BACK_COLOR },
      95           1 :         {MAP_CHAR_LEN(SC_UNONAME_CCOLOR),   ATTR_FONT_COLOR,        &::getCppuType((const sal_Int32*)0),        0, 0 },
      96           1 :         {MAP_CHAR_LEN(SC_UNONAME_COUTL),    ATTR_FONT_CONTOUR,      &::getBooleanCppuType(),                    0, 0 },
      97           1 :         {MAP_CHAR_LEN(SC_UNONAME_CCROSS),   ATTR_FONT_CROSSEDOUT,   &::getBooleanCppuType(),                    0, MID_CROSSED_OUT },
      98           1 :         {MAP_CHAR_LEN(SC_UNONAME_CFONT),    ATTR_FONT,              &::getCppuType((const sal_Int16*)0),        0, MID_FONT_FAMILY },
      99           1 :         {MAP_CHAR_LEN(SC_UNONAME_CFCHARS),  ATTR_FONT,              &::getCppuType((sal_Int16*)0),              0, MID_FONT_CHAR_SET },
     100           1 :         {MAP_CHAR_LEN(SC_UNO_CJK_CFCHARS),  ATTR_CJK_FONT,          &::getCppuType((sal_Int16*)0),              0, MID_FONT_CHAR_SET },
     101           1 :         {MAP_CHAR_LEN(SC_UNO_CTL_CFCHARS),  ATTR_CTL_FONT,          &::getCppuType((sal_Int16*)0),              0, MID_FONT_CHAR_SET },
     102           1 :         {MAP_CHAR_LEN(SC_UNONAME_CFFAMIL),  ATTR_FONT,              &::getCppuType((sal_Int16*)0),              0, MID_FONT_FAMILY },
     103           1 :         {MAP_CHAR_LEN(SC_UNO_CJK_CFFAMIL),  ATTR_CJK_FONT,          &::getCppuType((sal_Int16*)0),              0, MID_FONT_FAMILY },
     104           1 :         {MAP_CHAR_LEN(SC_UNO_CTL_CFFAMIL),  ATTR_CTL_FONT,          &::getCppuType((sal_Int16*)0),              0, MID_FONT_FAMILY },
     105           1 :         {MAP_CHAR_LEN(SC_UNONAME_CFNAME),   ATTR_FONT,              &::getCppuType((OUString*)0),          0, MID_FONT_FAMILY_NAME },
     106           1 :         {MAP_CHAR_LEN(SC_UNO_CJK_CFNAME),   ATTR_CJK_FONT,          &::getCppuType((OUString*)0),          0, MID_FONT_FAMILY_NAME },
     107           1 :         {MAP_CHAR_LEN(SC_UNO_CTL_CFNAME),   ATTR_CTL_FONT,          &::getCppuType((OUString*)0),          0, MID_FONT_FAMILY_NAME },
     108           1 :         {MAP_CHAR_LEN(SC_UNONAME_CFPITCH),  ATTR_FONT,              &::getCppuType((sal_Int16*)0),              0, MID_FONT_PITCH },
     109           1 :         {MAP_CHAR_LEN(SC_UNO_CJK_CFPITCH),  ATTR_CJK_FONT,          &::getCppuType((sal_Int16*)0),              0, MID_FONT_PITCH },
     110           1 :         {MAP_CHAR_LEN(SC_UNO_CTL_CFPITCH),  ATTR_CTL_FONT,          &::getCppuType((sal_Int16*)0),              0, MID_FONT_PITCH },
     111           1 :         {MAP_CHAR_LEN(SC_UNONAME_CFSTYLE),  ATTR_FONT,              &::getCppuType((OUString*)0),          0, MID_FONT_STYLE_NAME },
     112           1 :         {MAP_CHAR_LEN(SC_UNO_CJK_CFSTYLE),  ATTR_CJK_FONT,          &::getCppuType((OUString*)0),          0, MID_FONT_STYLE_NAME },
     113           1 :         {MAP_CHAR_LEN(SC_UNO_CTL_CFSTYLE),  ATTR_CTL_FONT,          &::getCppuType((OUString*)0),          0, MID_FONT_STYLE_NAME },
     114           1 :         {MAP_CHAR_LEN(SC_UNONAME_CHEIGHT),  ATTR_FONT_HEIGHT,       &::getCppuType((float*)0),                  0, MID_FONTHEIGHT | CONVERT_TWIPS },
     115           1 :         {MAP_CHAR_LEN(SC_UNO_CJK_CHEIGHT),  ATTR_CJK_FONT_HEIGHT,   &::getCppuType((float*)0),                  0, MID_FONTHEIGHT | CONVERT_TWIPS },
     116           1 :         {MAP_CHAR_LEN(SC_UNO_CTL_CHEIGHT),  ATTR_CTL_FONT_HEIGHT,   &::getCppuType((float*)0),                  0, MID_FONTHEIGHT | CONVERT_TWIPS },
     117           1 :         {MAP_CHAR_LEN(SC_UNONAME_COVER),    ATTR_FONT_OVERLINE,     &::getCppuType((const sal_Int16*)0),        0, MID_TL_STYLE },
     118           1 :         {MAP_CHAR_LEN(SC_UNONAME_CPOST),    ATTR_FONT_POSTURE,      &::getCppuType((awt::FontSlant*)0),         0, MID_POSTURE },
     119           1 :         {MAP_CHAR_LEN(SC_UNO_CJK_CPOST),    ATTR_CJK_FONT_POSTURE,  &::getCppuType((awt::FontSlant*)0),         0, MID_POSTURE },
     120           1 :         {MAP_CHAR_LEN(SC_UNO_CTL_CPOST),    ATTR_CTL_FONT_POSTURE,  &::getCppuType((awt::FontSlant*)0),         0, MID_POSTURE },
     121           1 :         {MAP_CHAR_LEN(SC_UNONAME_CSHADD),   ATTR_FONT_SHADOWED,     &::getBooleanCppuType(),                    0, 0 },
     122           1 :         {MAP_CHAR_LEN(SC_UNONAME_TBLBORD),  SC_WID_UNO_TBLBORD,     &::getCppuType((table::TableBorder*)0),     0, 0 | CONVERT_TWIPS },
     123           1 :         {MAP_CHAR_LEN(SC_UNONAME_TBLBORD2),  SC_WID_UNO_TBLBORD2,     &::getCppuType((table::TableBorder2*)0),     0, 0 | CONVERT_TWIPS },
     124           1 :         {MAP_CHAR_LEN(SC_UNONAME_CUNDER),   ATTR_FONT_UNDERLINE,    &::getCppuType((const sal_Int16*)0),        0, MID_TL_STYLE },
     125           1 :         {MAP_CHAR_LEN(SC_UNONAME_CWEIGHT),  ATTR_FONT_WEIGHT,       &::getCppuType((float*)0),                  0, MID_WEIGHT },
     126           1 :         {MAP_CHAR_LEN(SC_UNO_CJK_CWEIGHT),  ATTR_CJK_FONT_WEIGHT,   &::getCppuType((float*)0),                  0, MID_WEIGHT },
     127           1 :         {MAP_CHAR_LEN(SC_UNO_CTL_CWEIGHT),  ATTR_CTL_FONT_WEIGHT,   &::getCppuType((float*)0),                  0, MID_WEIGHT },
     128           1 :         {MAP_CHAR_LEN(SC_UNONAME_CELLHJUS), ATTR_HOR_JUSTIFY,       &::getCppuType((const table::CellHoriJustify*)0),   0, 0 },
     129           1 :         {MAP_CHAR_LEN(SC_UNONAME_CELLHJUS_METHOD), ATTR_HOR_JUSTIFY_METHOD, &::getCppuType((const sal_Int32*)0),   0, 0 },
     130           1 :         {MAP_CHAR_LEN(SC_UNONAME_CELLTRAN), ATTR_BACKGROUND,        &::getBooleanCppuType(),                    0, MID_GRAPHIC_TRANSPARENT },
     131           1 :         {MAP_CHAR_LEN(SC_UNONAME_WRAP),     ATTR_LINEBREAK,         &::getBooleanCppuType(),                    0, 0 },
     132           1 :         {MAP_CHAR_LEN(SC_UNONAME_CELLORI),  ATTR_STACKED,           &::getCppuType((const table::CellOrientation*)0),   0, 0 },
     133           1 :         {MAP_CHAR_LEN(SC_UNONAME_PBMARGIN), ATTR_MARGIN,            &::getCppuType((const sal_Int32*)0),        0, MID_MARGIN_LO_MARGIN | CONVERT_TWIPS },
     134           1 :         {MAP_CHAR_LEN(SC_UNONAME_PLMARGIN), ATTR_MARGIN,            &::getCppuType((const sal_Int32*)0),        0, MID_MARGIN_L_MARGIN  | CONVERT_TWIPS },
     135           1 :         {MAP_CHAR_LEN(SC_UNONAME_PRMARGIN), ATTR_MARGIN,            &::getCppuType((const sal_Int32*)0),        0, MID_MARGIN_R_MARGIN  | CONVERT_TWIPS },
     136           1 :         {MAP_CHAR_LEN(SC_UNONAME_PTMARGIN), ATTR_MARGIN,            &::getCppuType((const sal_Int32*)0),        0, MID_MARGIN_UP_MARGIN | CONVERT_TWIPS },
     137           1 :         {MAP_CHAR_LEN(SC_UNONAME_ROTANG),   ATTR_ROTATE_VALUE,      &::getCppuType((const sal_Int32*)0),        0, 0 },
     138           1 :         {MAP_CHAR_LEN(SC_UNONAME_ROTREF),   ATTR_ROTATE_MODE,       &::getCppuType((const sal_Int32*)0),   0, 0 },
     139           1 :         {MAP_CHAR_LEN(SC_UNONAME_CELLVJUS), ATTR_VER_JUSTIFY,       &::getCppuType((const sal_Int32*)0),   0, 0 },
     140           1 :         {MAP_CHAR_LEN(SC_UNONAME_CELLVJUS_METHOD), ATTR_VER_JUSTIFY_METHOD, &::getCppuType((const sal_Int32*)0),   0, 0 },
     141             :         {0,0,0,0,0,0}
     142          51 :     };
     143           4 :     return aAutoFieldMap_Impl;
     144             : }
     145             : 
     146             : //------------------------------------------------------------------------
     147             : 
     148             : #define SCAUTOFORMATSOBJ_SERVICE    "com.sun.star.sheet.TableAutoFormats"
     149             : 
     150           0 : SC_SIMPLE_SERVICE_INFO( ScAutoFormatFieldObj, "ScAutoFormatFieldObj", "com.sun.star.sheet.TableAutoFormatField" )
     151           1 : SC_SIMPLE_SERVICE_INFO( ScAutoFormatObj, "ScAutoFormatObj", "com.sun.star.sheet.TableAutoFormat" )
     152           0 : SC_SIMPLE_SERVICE_INFO( ScAutoFormatsObj, "ScAutoFormatsObj", SCAUTOFORMATSOBJ_SERVICE )
     153             : 
     154             : //------------------------------------------------------------------------
     155             : 
     156          11 : static bool lcl_FindAutoFormatIndex( const ScAutoFormat& rFormats, const OUString& rName, sal_uInt16& rOutIndex )
     157             : {
     158          11 :     ScAutoFormat::const_iterator itBeg = rFormats.begin(), itEnd = rFormats.end();
     159         161 :     for (ScAutoFormat::const_iterator it = itBeg; it != itEnd; ++it)
     160             :     {
     161         155 :         const ScAutoFormatData* pEntry = it->second;
     162         155 :         const OUString& aEntryName = pEntry->GetName();
     163         155 :         if ( aEntryName.equals(rName) )
     164             :         {
     165           5 :             size_t nPos = std::distance(itBeg, it);
     166           5 :             rOutIndex = nPos;
     167           5 :             return true;
     168             :         }
     169             :     }
     170           6 :     return false;       // is nich
     171             : }
     172             : 
     173             : //------------------------------------------------------------------------
     174             : 
     175           1 : ScAutoFormatsObj::ScAutoFormatsObj()
     176             : {
     177             :     //! Dieses Objekt darf es nur einmal geben, und es muss an den Auto-Format-Daten
     178             :     //! bekannt sein, damit Aenderungen gebroadcasted werden koennen
     179           1 : }
     180             : 
     181           2 : ScAutoFormatsObj::~ScAutoFormatsObj()
     182             : {
     183           2 : }
     184             : 
     185             : // stuff for exService_...
     186             : 
     187           1 : uno::Reference<uno::XInterface> SAL_CALL ScAutoFormatsObj_CreateInstance(
     188             :                         const uno::Reference<lang::XMultiServiceFactory>& )
     189             : {
     190           1 :     SolarMutexGuard aGuard;
     191           1 :     ScDLL::Init();
     192           1 :     static uno::Reference< uno::XInterface > xInst((::cppu::OWeakObject*) new ScAutoFormatsObj);
     193           1 :     return xInst;
     194             : }
     195             : 
     196         129 : OUString ScAutoFormatsObj::getImplementationName_Static()
     197             : {
     198         129 :     return OUString( "stardiv.StarCalc.ScAutoFormatsObj" );
     199             : }
     200             : 
     201           1 : uno::Sequence<OUString> ScAutoFormatsObj::getSupportedServiceNames_Static()
     202             : {
     203           1 :     uno::Sequence<OUString> aRet(1);
     204           1 :     OUString* pArray = aRet.getArray();
     205           1 :     pArray[0] = OUString( SCAUTOFORMATSOBJ_SERVICE );
     206           1 :     return aRet;
     207             : }
     208             : 
     209             : // XTableAutoFormats
     210             : 
     211          26 : ScAutoFormatObj* ScAutoFormatsObj::GetObjectByIndex_Impl(sal_uInt16 nIndex)
     212             : {
     213          26 :     if (nIndex < ScGlobal::GetOrCreateAutoFormat()->size())
     214          24 :         return new ScAutoFormatObj(nIndex);
     215             : 
     216           2 :     return NULL;    // falscher Index
     217             : }
     218             : 
     219           2 : ScAutoFormatObj* ScAutoFormatsObj::GetObjectByName_Impl(const OUString& aName)
     220             : {
     221           2 :     String aString(aName);
     222             :     sal_uInt16 nIndex;
     223           4 :     if (lcl_FindAutoFormatIndex(
     224           4 :             *ScGlobal::GetOrCreateAutoFormat(), aString, nIndex ))
     225           1 :         return GetObjectByIndex_Impl(nIndex);
     226           1 :     return NULL;
     227             : }
     228             : 
     229             : // container::XNameContainer
     230             : 
     231           3 : void SAL_CALL ScAutoFormatsObj::insertByName( const OUString& aName, const uno::Any& aElement )
     232             :                             throw(lang::IllegalArgumentException, container::ElementExistException,
     233             :                                     lang::WrappedTargetException, uno::RuntimeException)
     234             : {
     235           3 :     SolarMutexGuard aGuard;
     236           3 :     sal_Bool bDone = false;
     237             :     //  Reflection muss nicht uno::XInterface sein, kann auch irgendein Interface sein...
     238           6 :     uno::Reference< uno::XInterface > xInterface(aElement, uno::UNO_QUERY);
     239           3 :     if ( xInterface.is() )
     240             :     {
     241           2 :         ScAutoFormatObj* pFormatObj = ScAutoFormatObj::getImplementation( xInterface );
     242           2 :         if ( pFormatObj && !pFormatObj->IsInserted() )  // noch nicht eingefuegt?
     243             :         {
     244           2 :             String aNameStr(aName);
     245           2 :             ScAutoFormat* pFormats = ScGlobal::GetOrCreateAutoFormat();
     246             : 
     247             :             sal_uInt16 nDummy;
     248           2 :             if (!lcl_FindAutoFormatIndex( *pFormats, aNameStr, nDummy ))
     249             :             {
     250           1 :                 ScAutoFormatData* pNew = new ScAutoFormatData();
     251           1 :                 pNew->SetName( aNameStr );
     252             : 
     253           1 :                 if (pFormats->insert(pNew))
     254             :                 {
     255             :                     //! Notify fuer andere Objekte
     256           1 :                     pFormats->Save();   // sofort speichern
     257             : 
     258             :                     sal_uInt16 nNewIndex;
     259           1 :                     if (lcl_FindAutoFormatIndex( *pFormats, aNameStr, nNewIndex ))
     260             :                     {
     261           1 :                         pFormatObj->InitFormat( nNewIndex );    // kann jetzt benutzt werden
     262           1 :                         bDone = sal_True;
     263             :                     }
     264             :                 }
     265             :                 else
     266             :                 {
     267             :                     OSL_FAIL("AutoFormat konnte nicht eingefuegt werden");
     268           0 :                     throw uno::RuntimeException();
     269             :                 }
     270             :             }
     271             :             else
     272             :             {
     273           1 :                 throw container::ElementExistException();
     274           2 :             }
     275             :         }
     276             :     }
     277             : 
     278           2 :     if (!bDone)
     279             :     {
     280             :         //  other errors are handled above
     281           1 :         throw lang::IllegalArgumentException();
     282           3 :     }
     283           1 : }
     284             : 
     285           0 : void SAL_CALL ScAutoFormatsObj::replaceByName( const OUString& aName, const uno::Any& aElement )
     286             :                             throw(lang::IllegalArgumentException, container::NoSuchElementException,
     287             :                                     lang::WrappedTargetException, uno::RuntimeException)
     288             : {
     289           0 :     SolarMutexGuard aGuard;
     290             :     //! zusammenfassen?
     291           0 :     removeByName( aName );
     292           0 :     insertByName( aName, aElement );
     293           0 : }
     294             : 
     295           2 : void SAL_CALL ScAutoFormatsObj::removeByName( const OUString& aName )
     296             :                                 throw(container::NoSuchElementException,
     297             :                                     lang::WrappedTargetException, uno::RuntimeException)
     298             : {
     299           2 :     SolarMutexGuard aGuard;
     300           2 :     ScAutoFormat* pFormats = ScGlobal::GetOrCreateAutoFormat();
     301             : 
     302           2 :     ScAutoFormat::iterator it = pFormats->find(aName);
     303           2 :     if (it != pFormats->end())
     304             :     {
     305           1 :         pFormats->erase(it);
     306             : 
     307             :         //! Notify fuer andere Objekte
     308           1 :         pFormats->Save();   // sofort speichern
     309             :     }
     310             :     else
     311             :     {
     312           1 :         throw container::NoSuchElementException();
     313           2 :     }
     314           1 : }
     315             : 
     316             : // container::XEnumerationAccess
     317             : 
     318           2 : uno::Reference<container::XEnumeration> SAL_CALL ScAutoFormatsObj::createEnumeration()
     319             :                                                     throw(uno::RuntimeException)
     320             : {
     321           2 :     SolarMutexGuard aGuard;
     322           2 :     return new ScIndexEnumeration(this, OUString("com.sun.star.sheet.TableAutoFormatEnumeration"));
     323             : }
     324             : 
     325             : // container::XIndexAccess
     326             : 
     327          22 : sal_Int32 SAL_CALL ScAutoFormatsObj::getCount() throw(uno::RuntimeException)
     328             : {
     329          22 :     SolarMutexGuard aGuard;
     330          22 :     return ScGlobal::GetOrCreateAutoFormat()->size();
     331             : }
     332             : 
     333          25 : uno::Any SAL_CALL ScAutoFormatsObj::getByIndex( sal_Int32 nIndex )
     334             :                             throw(lang::IndexOutOfBoundsException,
     335             :                                     lang::WrappedTargetException, uno::RuntimeException)
     336             : {
     337          25 :     SolarMutexGuard aGuard;
     338          50 :     uno::Reference< container::XNamed >  xFormat(GetObjectByIndex_Impl((sal_uInt16)nIndex));
     339          25 :     if (!xFormat.is())
     340           2 :         throw lang::IndexOutOfBoundsException();
     341          48 :     return uno::makeAny(xFormat);
     342             : }
     343             : 
     344           1 : uno::Type SAL_CALL ScAutoFormatsObj::getElementType() throw(uno::RuntimeException)
     345             : {
     346           1 :     SolarMutexGuard aGuard;
     347           1 :     return ::getCppuType((const uno::Reference< container::XNamed >*)0);    // muss zu getByIndex passen
     348             : }
     349             : 
     350           1 : sal_Bool SAL_CALL ScAutoFormatsObj::hasElements() throw(uno::RuntimeException)
     351             : {
     352           1 :     SolarMutexGuard aGuard;
     353           1 :     return ( getCount() != 0 );
     354             : }
     355             : 
     356             : // container::XNameAccess
     357             : 
     358           2 : uno::Any SAL_CALL ScAutoFormatsObj::getByName( const OUString& aName )
     359             :             throw(container::NoSuchElementException,
     360             :                     lang::WrappedTargetException, uno::RuntimeException)
     361             : {
     362           2 :     SolarMutexGuard aGuard;
     363           4 :     uno::Reference< container::XNamed >  xFormat(GetObjectByName_Impl(aName));
     364           2 :     if (!xFormat.is())
     365           1 :         throw container::NoSuchElementException();
     366           3 :     return uno::makeAny(xFormat);
     367             : }
     368             : 
     369           4 : uno::Sequence<OUString> SAL_CALL ScAutoFormatsObj::getElementNames()
     370             :                                                 throw(uno::RuntimeException)
     371             : {
     372           4 :     SolarMutexGuard aGuard;
     373           4 :     ScAutoFormat* pFormats = ScGlobal::GetOrCreateAutoFormat();
     374           4 :     uno::Sequence<OUString> aSeq(pFormats->size());
     375           4 :     OUString* pAry = aSeq.getArray();
     376           4 :     ScAutoFormat::const_iterator it = pFormats->begin(), itEnd = pFormats->end();
     377          74 :     for (size_t i = 0; it != itEnd; ++it, ++i)
     378             :     {
     379          70 :         pAry[i] = it->second->GetName();
     380             :     }
     381           4 :     return aSeq;
     382             : }
     383             : 
     384           4 : sal_Bool SAL_CALL ScAutoFormatsObj::hasByName( const OUString& aName )
     385             :                                         throw(uno::RuntimeException)
     386             : {
     387           4 :     SolarMutexGuard aGuard;
     388           8 :     String aString(aName);
     389             :     sal_uInt16 nDummy;
     390             :     return lcl_FindAutoFormatIndex(
     391           8 :         *ScGlobal::GetOrCreateAutoFormat(), aString, nDummy );
     392             : }
     393             : 
     394             : //------------------------------------------------------------------------
     395             : 
     396          27 : ScAutoFormatObj::ScAutoFormatObj(sal_uInt16 nIndex) :
     397             :     aPropSet( lcl_GetAutoFormatMap() ),
     398          27 :     nFormatIndex( nIndex )
     399             : {
     400             :     //! Listening !!!
     401          27 : }
     402             : 
     403          81 : ScAutoFormatObj::~ScAutoFormatObj()
     404             : {
     405             :     //  Wenn ein AutoFormat-Objekt losgelassen wird, werden eventuelle Aenderungen
     406             :     //  gespeichert, damit sie z.B. im Writer sichtbar sind
     407             : 
     408          27 :     if (IsInserted())
     409             :     {
     410          25 :         ScAutoFormat* pFormats = ScGlobal::GetAutoFormat();
     411          25 :         if ( pFormats && pFormats->IsSaveLater() )
     412           0 :             pFormats->Save();
     413             : 
     414             :         // Save() setzt SaveLater Flag zurueck
     415             :     }
     416          54 : }
     417             : 
     418           1 : void ScAutoFormatObj::InitFormat( sal_uInt16 nNewIndex )
     419             : {
     420             :     OSL_ENSURE( nFormatIndex == SC_AFMTOBJ_INVALID, "ScAutoFormatObj::InitFormat mehrfach" );
     421           1 :     nFormatIndex = nNewIndex;
     422             :     //! Listening !!!
     423           1 : }
     424             : 
     425             : // XUnoTunnel
     426             : 
     427           2 : sal_Int64 SAL_CALL ScAutoFormatObj::getSomething(
     428             :                 const uno::Sequence<sal_Int8 >& rId ) throw(uno::RuntimeException)
     429             : {
     430           4 :     if ( rId.getLength() == 16 &&
     431           2 :           0 == memcmp( getUnoTunnelId().getConstArray(),
     432           4 :                                     rId.getConstArray(), 16 ) )
     433             :     {
     434           2 :         return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this));
     435             :     }
     436           0 :     return 0;
     437             : }
     438             : 
     439             : namespace
     440             : {
     441             :     class theScAutoFormatObjUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theScAutoFormatObjUnoTunnelId> {};
     442             : }
     443             : 
     444           4 : const uno::Sequence<sal_Int8>& ScAutoFormatObj::getUnoTunnelId()
     445             : {
     446           4 :     return theScAutoFormatObjUnoTunnelId::get().getSeq();
     447             : }
     448             : 
     449           2 : ScAutoFormatObj* ScAutoFormatObj::getImplementation(
     450             :                         const uno::Reference<uno::XInterface> xObj )
     451             : {
     452           2 :     ScAutoFormatObj* pRet = NULL;
     453           2 :     uno::Reference<lang::XUnoTunnel> xUT( xObj, uno::UNO_QUERY );
     454           2 :     if (xUT.is())
     455           2 :         pRet = reinterpret_cast<ScAutoFormatObj*>(sal::static_int_cast<sal_IntPtr>(xUT->getSomething(getUnoTunnelId())));
     456           2 :     return pRet;
     457             : }
     458             : 
     459           0 : void ScAutoFormatObj::Notify( SfxBroadcaster& /* rBC */, const SfxHint& /* rHint */ )
     460             : {
     461             :     //  spaeter...
     462           0 : }
     463             : 
     464             : // XTableAutoFormat
     465             : 
     466           4 : ScAutoFormatFieldObj* ScAutoFormatObj::GetObjectByIndex_Impl(sal_uInt16 nIndex)
     467             : {
     468           4 :     if ( IsInserted() && nIndex < SC_AF_FIELD_COUNT )
     469           4 :         return new ScAutoFormatFieldObj( nFormatIndex, nIndex );
     470             : 
     471           0 :     return NULL;
     472             : }
     473             : 
     474             : // container::XEnumerationAccess
     475             : 
     476           1 : uno::Reference<container::XEnumeration> SAL_CALL ScAutoFormatObj::createEnumeration()
     477             :                                                     throw(uno::RuntimeException)
     478             : {
     479           1 :     SolarMutexGuard aGuard;
     480           1 :     return new ScIndexEnumeration(this, OUString("com.sun.star.sheet.TableAutoFormatEnumeration"));
     481             : }
     482             : 
     483             : // container::XIndexAccess
     484             : 
     485           7 : sal_Int32 SAL_CALL ScAutoFormatObj::getCount() throw(uno::RuntimeException)
     486             : {
     487           7 :     SolarMutexGuard aGuard;
     488           7 :     if (IsInserted())
     489           7 :         return SC_AF_FIELD_COUNT;   // immer 16 Elemente
     490             :     else
     491           0 :         return 0;
     492             : }
     493             : 
     494           5 : uno::Any SAL_CALL ScAutoFormatObj::getByIndex( sal_Int32 nIndex )
     495             :                             throw(lang::IndexOutOfBoundsException,
     496             :                                     lang::WrappedTargetException, uno::RuntimeException)
     497             : {
     498           5 :     SolarMutexGuard aGuard;
     499             : 
     500           5 :     if ( nIndex < 0 || nIndex >= getCount() )
     501           1 :         throw lang::IndexOutOfBoundsException();
     502             : 
     503           4 :     if (IsInserted())
     504           4 :         return uno::makeAny(uno::Reference< beans::XPropertySet >(GetObjectByIndex_Impl((sal_uInt16)nIndex)));
     505           1 :     return uno::Any();
     506             : }
     507             : 
     508           1 : uno::Type SAL_CALL ScAutoFormatObj::getElementType() throw(uno::RuntimeException)
     509             : {
     510           1 :     SolarMutexGuard aGuard;
     511           1 :     return ::getCppuType((const uno::Reference< beans::XPropertySet >*)0);  // muss zu getByIndex passen
     512             : }
     513             : 
     514           1 : sal_Bool SAL_CALL ScAutoFormatObj::hasElements() throw(uno::RuntimeException)
     515             : {
     516           1 :     SolarMutexGuard aGuard;
     517           1 :     return ( getCount() != 0 );
     518             : }
     519             : 
     520             : // container::XNamed
     521             : 
     522           5 : OUString SAL_CALL ScAutoFormatObj::getName() throw(uno::RuntimeException)
     523             : {
     524           5 :     SolarMutexGuard aGuard;
     525           5 :     ScAutoFormat* pFormats = ScGlobal::GetOrCreateAutoFormat();
     526           5 :     if (IsInserted() && nFormatIndex < pFormats->size())
     527           5 :         return pFormats->findByIndex(nFormatIndex)->GetName();
     528             : 
     529           0 :     return OUString();
     530             : }
     531             : 
     532           2 : void SAL_CALL ScAutoFormatObj::setName( const OUString& aNewName )
     533             :                                                 throw(uno::RuntimeException)
     534             : {
     535           2 :     SolarMutexGuard aGuard;
     536           4 :     String aNewString(aNewName);
     537           2 :     ScAutoFormat* pFormats = ScGlobal::GetOrCreateAutoFormat();
     538             : 
     539             :     sal_uInt16 nDummy;
     540           4 :     if (IsInserted() && nFormatIndex < pFormats->size() &&
     541           2 :         !lcl_FindAutoFormatIndex( *pFormats, aNewName, nDummy ))
     542             :     {
     543           2 :         ScAutoFormat::iterator it = pFormats->begin();
     544           2 :         std::advance(it, nFormatIndex);
     545           2 :         ScAutoFormatData* pData = it->second;
     546             :         OSL_ENSURE(pData,"AutoFormat Daten nicht da");
     547             : 
     548           2 :         ScAutoFormatData* pNew = new ScAutoFormatData(*pData);
     549           2 :         pNew->SetName( aNewString );
     550             : 
     551           2 :         pFormats->erase(it);
     552           2 :         if (pFormats->insert(pNew))
     553             :         {
     554           2 :             it = pFormats->find(pNew);
     555           2 :             ScAutoFormat::iterator itBeg = pFormats->begin();
     556           2 :             nFormatIndex = std::distance(itBeg, it);
     557             : 
     558             :             //! Notify fuer andere Objekte
     559           2 :             pFormats->SetSaveLater(true);
     560             :         }
     561             :         else
     562             :         {
     563             :             OSL_FAIL("AutoFormat konnte nicht eingefuegt werden");
     564           0 :             nFormatIndex = 0;       //! alter Index ist ungueltig
     565             :         }
     566             :     }
     567             :     else
     568             :     {
     569             :         //  not inserted or name exists
     570           0 :         throw uno::RuntimeException();
     571           2 :     }
     572           2 : }
     573             : 
     574             : // beans::XPropertySet
     575             : 
     576          13 : uno::Reference<beans::XPropertySetInfo> SAL_CALL ScAutoFormatObj::getPropertySetInfo()
     577             :                                                         throw(uno::RuntimeException)
     578             : {
     579          13 :     SolarMutexGuard aGuard;
     580          13 :     static uno::Reference< beans::XPropertySetInfo > aRef(new SfxItemPropertySetInfo( aPropSet.getPropertyMap() ));
     581          13 :     return aRef;
     582             : }
     583             : 
     584          18 : void SAL_CALL ScAutoFormatObj::setPropertyValue(
     585             :                         const OUString& aPropertyName, const uno::Any& aValue )
     586             :                 throw(beans::UnknownPropertyException, beans::PropertyVetoException,
     587             :                         lang::IllegalArgumentException, lang::WrappedTargetException,
     588             :                         uno::RuntimeException)
     589             : {
     590          18 :     SolarMutexGuard aGuard;
     591          18 :     ScAutoFormat* pFormats = ScGlobal::GetOrCreateAutoFormat();
     592          18 :     if (IsInserted() && nFormatIndex < pFormats->size())
     593             :     {
     594          18 :         ScAutoFormatData* pData = pFormats->findByIndex(nFormatIndex);
     595             :         OSL_ENSURE(pData,"AutoFormat Daten nicht da");
     596             : 
     597          18 :         String aPropString(aPropertyName);
     598          18 :         sal_Bool bBool = sal_Bool();
     599          18 :         if (aPropString.EqualsAscii( SC_UNONAME_INCBACK ) && (aValue >>= bBool))
     600           3 :             pData->SetIncludeBackground( bBool );
     601          15 :         else if (aPropString.EqualsAscii( SC_UNONAME_INCBORD ) && (aValue >>= bBool))
     602           3 :             pData->SetIncludeFrame( bBool );
     603          12 :         else if (aPropString.EqualsAscii( SC_UNONAME_INCFONT ) && (aValue >>= bBool))
     604           3 :             pData->SetIncludeFont( bBool );
     605           9 :         else if (aPropString.EqualsAscii( SC_UNONAME_INCJUST ) && (aValue >>= bBool))
     606           3 :             pData->SetIncludeJustify( bBool );
     607           6 :         else if (aPropString.EqualsAscii( SC_UNONAME_INCNUM ) && (aValue >>= bBool))
     608           3 :             pData->SetIncludeValueFormat( bBool );
     609           3 :         else if (aPropString.EqualsAscii( SC_UNONAME_INCWIDTH ) && (aValue >>= bBool))
     610           3 :             pData->SetIncludeWidthHeight( bBool );
     611             : 
     612             :         // else Fehler
     613             : 
     614             :         //! Notify fuer andere Objekte
     615          18 :         pFormats->SetSaveLater(sal_True);
     616          18 :     }
     617          18 : }
     618             : 
     619          42 : uno::Any SAL_CALL ScAutoFormatObj::getPropertyValue( const OUString& aPropertyName )
     620             :                 throw(beans::UnknownPropertyException, lang::WrappedTargetException,
     621             :                         uno::RuntimeException)
     622             : {
     623          42 :     SolarMutexGuard aGuard;
     624          42 :     uno::Any aAny;
     625             : 
     626          42 :     ScAutoFormat* pFormats = ScGlobal::GetOrCreateAutoFormat();
     627          42 :     if (IsInserted() && nFormatIndex < pFormats->size())
     628             :     {
     629          42 :         ScAutoFormatData* pData = pFormats->findByIndex(nFormatIndex);
     630             :         OSL_ENSURE(pData,"AutoFormat Daten nicht da");
     631             : 
     632             :         sal_Bool bValue;
     633          42 :         sal_Bool bError = false;
     634             : 
     635          42 :         String aPropString(aPropertyName);
     636          42 :         if (aPropString.EqualsAscii( SC_UNONAME_INCBACK ))
     637           7 :             bValue = pData->GetIncludeBackground();
     638          35 :         else if (aPropString.EqualsAscii( SC_UNONAME_INCBORD ))
     639           7 :             bValue = pData->GetIncludeFrame();
     640          28 :         else if (aPropString.EqualsAscii( SC_UNONAME_INCFONT ))
     641           7 :             bValue = pData->GetIncludeFont();
     642          21 :         else if (aPropString.EqualsAscii( SC_UNONAME_INCJUST ))
     643           7 :             bValue = pData->GetIncludeJustify();
     644          14 :         else if (aPropString.EqualsAscii( SC_UNONAME_INCNUM ))
     645           7 :             bValue = pData->GetIncludeValueFormat();
     646           7 :         else if (aPropString.EqualsAscii( SC_UNONAME_INCWIDTH ))
     647           7 :             bValue = pData->GetIncludeWidthHeight();
     648             :         else
     649           0 :             bError = sal_True;      // unbekannte Property
     650             : 
     651          42 :         if (!bError)
     652          42 :             aAny <<= bValue;
     653             :     }
     654             : 
     655          42 :     return aAny;
     656             : }
     657             : 
     658           0 : SC_IMPL_DUMMY_PROPERTY_LISTENER( ScAutoFormatObj )
     659             : 
     660             : //------------------------------------------------------------------------
     661             : 
     662           4 : ScAutoFormatFieldObj::ScAutoFormatFieldObj(sal_uInt16 nFormat, sal_uInt16 nField) :
     663             :     aPropSet( lcl_GetAutoFieldMap() ),
     664             :     nFormatIndex( nFormat ),
     665           4 :     nFieldIndex( nField )
     666             : {
     667             :     //! Listening !!!
     668           4 : }
     669             : 
     670           8 : ScAutoFormatFieldObj::~ScAutoFormatFieldObj()
     671             : {
     672           8 : }
     673             : 
     674           0 : void ScAutoFormatFieldObj::Notify( SfxBroadcaster& /* rBC */, const SfxHint& /* rHint */ )
     675             : {
     676             :     //  spaeter...
     677           0 : }
     678             : 
     679             : // beans::XPropertySet
     680             : 
     681           1 : uno::Reference<beans::XPropertySetInfo> SAL_CALL ScAutoFormatFieldObj::getPropertySetInfo()
     682             :                                                         throw(uno::RuntimeException)
     683             : {
     684           1 :     SolarMutexGuard aGuard;
     685           1 :     static uno::Reference< beans::XPropertySetInfo > aRef(new SfxItemPropertySetInfo( aPropSet.getPropertyMap() ));
     686           1 :     return aRef;
     687             : }
     688             : 
     689          86 : void SAL_CALL ScAutoFormatFieldObj::setPropertyValue(
     690             :                         const OUString& aPropertyName, const uno::Any& aValue )
     691             :                 throw(beans::UnknownPropertyException, beans::PropertyVetoException,
     692             :                         lang::IllegalArgumentException, lang::WrappedTargetException,
     693             :                         uno::RuntimeException)
     694             : {
     695          86 :     SolarMutexGuard aGuard;
     696          86 :     ScAutoFormat* pFormats = ScGlobal::GetOrCreateAutoFormat();
     697             :     const SfxItemPropertySimpleEntry* pEntry =
     698          86 :             aPropSet.getPropertyMap().getByName( aPropertyName );
     699             : 
     700          86 :     if ( pEntry && pEntry->nWID && nFormatIndex < pFormats->size() )
     701             :     {
     702          86 :         ScAutoFormatData* pData = pFormats->findByIndex(nFormatIndex);
     703             : 
     704          86 :         if ( IsScItemWid( pEntry->nWID ) )
     705             :         {
     706          84 :             if( const SfxPoolItem* pItem = pData->GetItem( nFieldIndex, pEntry->nWID ) )
     707             :             {
     708          84 :                 sal_Bool bDone = false;
     709             : 
     710          84 :                 switch( pEntry->nWID )
     711             :                 {
     712             :                     case ATTR_STACKED:
     713             :                     {
     714             :                         table::CellOrientation eOrient;
     715           2 :                         if( aValue >>= eOrient )
     716             :                         {
     717           2 :                             switch( eOrient )
     718             :                             {
     719             :                                 case table::CellOrientation_STANDARD:
     720           0 :                                     pData->PutItem( nFieldIndex, SfxBoolItem( ATTR_STACKED, false ) );
     721           0 :                                 break;
     722             :                                 case table::CellOrientation_TOPBOTTOM:
     723           2 :                                     pData->PutItem( nFieldIndex, SfxBoolItem( ATTR_STACKED, false ) );
     724           2 :                                     pData->PutItem( nFieldIndex, SfxInt32Item( ATTR_ROTATE_VALUE, 27000 ) );
     725           2 :                                 break;
     726             :                                 case table::CellOrientation_BOTTOMTOP:
     727           0 :                                     pData->PutItem( nFieldIndex, SfxBoolItem( ATTR_STACKED, false ) );
     728           0 :                                     pData->PutItem( nFieldIndex, SfxInt32Item( ATTR_ROTATE_VALUE, 9000 ) );
     729           0 :                                 break;
     730             :                                 case table::CellOrientation_STACKED:
     731           0 :                                     pData->PutItem( nFieldIndex, SfxBoolItem( ATTR_STACKED, sal_True ) );
     732           0 :                                 break;
     733             :                                 default:
     734             :                                 {
     735             :                                     // added to avoid warnings
     736             :                                 }
     737             :                             }
     738           2 :                             bDone = sal_True;
     739             :                         }
     740             :                     }
     741           2 :                     break;
     742             :                     default:
     743          82 :                         SfxPoolItem* pNewItem = pItem->Clone();
     744          82 :                         bDone = pNewItem->PutValue( aValue, pEntry->nMemberId );
     745          82 :                         if (bDone)
     746          82 :                             pData->PutItem( nFieldIndex, *pNewItem );
     747          82 :                         delete pNewItem;
     748             :                 }
     749             : 
     750          84 :                 if (bDone)
     751             :                     //! Notify fuer andere Objekte?
     752          84 :                     pFormats->SetSaveLater(sal_True);
     753             :             }
     754             :         }
     755             :         else
     756             :         {
     757           2 :             switch (pEntry->nWID)
     758             :             {
     759             :                 case SC_WID_UNO_TBLBORD:
     760             :                     {
     761           2 :                         table::TableBorder aBorder;
     762           2 :                         if ( aValue >>= aBorder )   // empty = nothing to do
     763             :                         {
     764           2 :                             SvxBoxItem aOuter(ATTR_BORDER);
     765           4 :                             SvxBoxInfoItem aInner(ATTR_BORDER_INNER);
     766           2 :                             ScHelperFunctions::FillBoxItems( aOuter, aInner, aBorder );
     767           2 :                             pData->PutItem( nFieldIndex, aOuter );
     768             : 
     769             :                             //! Notify for other objects?
     770           4 :                             pFormats->SetSaveLater(sal_True);
     771             :                         }
     772             :                     }
     773           2 :                     break;
     774             :                 case SC_WID_UNO_TBLBORD2:
     775             :                     {
     776           0 :                         table::TableBorder2 aBorder2;
     777           0 :                         if ( aValue >>= aBorder2 )   // empty = nothing to do
     778             :                         {
     779           0 :                             SvxBoxItem aOuter(ATTR_BORDER);
     780           0 :                             SvxBoxInfoItem aInner(ATTR_BORDER_INNER);
     781           0 :                             ScHelperFunctions::FillBoxItems( aOuter, aInner, aBorder2 );
     782           0 :                             pData->PutItem( nFieldIndex, aOuter );
     783             : 
     784             :                             //! Notify for other objects?
     785           0 :                             pFormats->SetSaveLater(sal_True);
     786             :                         }
     787             :                     }
     788           0 :                     break;
     789             :             }
     790             :         }
     791          86 :     }
     792          86 : }
     793             : 
     794         217 : uno::Any SAL_CALL ScAutoFormatFieldObj::getPropertyValue( const OUString& aPropertyName )
     795             :                 throw(beans::UnknownPropertyException, lang::WrappedTargetException,
     796             :                         uno::RuntimeException)
     797             : {
     798         217 :     SolarMutexGuard aGuard;
     799         217 :     uno::Any aVal;
     800             : 
     801         217 :     ScAutoFormat* pFormats = ScGlobal::GetOrCreateAutoFormat();
     802             :     const SfxItemPropertySimpleEntry* pEntry =
     803         217 :             aPropSet.getPropertyMap().getByName( aPropertyName );
     804             : 
     805         217 :     if ( pEntry && pEntry->nWID && nFormatIndex < pFormats->size() )
     806             :     {
     807         217 :         const ScAutoFormatData* pData = pFormats->findByIndex(nFormatIndex);
     808             : 
     809         217 :         if ( IsScItemWid( pEntry->nWID ) )
     810             :         {
     811         211 :             if( const SfxPoolItem* pItem = pData->GetItem( nFieldIndex, pEntry->nWID ) )
     812             :             {
     813         209 :                 switch( pEntry->nWID )
     814             :                 {
     815             :                     case ATTR_STACKED:
     816             :                     {
     817           5 :                         const SfxInt32Item* pRotItem = (const SfxInt32Item*)pData->GetItem( nFieldIndex, ATTR_ROTATE_VALUE );
     818           5 :                         sal_Int32 nRot = pRotItem ? pRotItem->GetValue() : 0;
     819           5 :                         sal_Bool bStacked = ((const SfxBoolItem*)pItem)->GetValue();
     820           5 :                         SvxOrientationItem( nRot, bStacked, 0 ).QueryValue( aVal );
     821             :                     }
     822           5 :                     break;
     823             :                     default:
     824         204 :                         pItem->QueryValue( aVal, pEntry->nMemberId );
     825             :                 }
     826             :             }
     827             :         }
     828             :         else
     829             :         {
     830           6 :             switch (pEntry->nWID)
     831             :             {
     832             :                 case SC_WID_UNO_TBLBORD:
     833             :                 case SC_WID_UNO_TBLBORD2:
     834             :                     {
     835           6 :                         const SfxPoolItem* pItem = pData->GetItem(nFieldIndex, ATTR_BORDER);
     836           6 :                         if (pItem)
     837             :                         {
     838           6 :                             SvxBoxItem aOuter(*(static_cast<const SvxBoxItem*>(pItem)));
     839          12 :                             SvxBoxInfoItem aInner(ATTR_BORDER_INNER);
     840             : 
     841           6 :                             if (pEntry->nWID == SC_WID_UNO_TBLBORD2)
     842           1 :                                 ScHelperFunctions::AssignTableBorder2ToAny( aVal, aOuter, aInner);
     843             :                             else
     844          11 :                                 ScHelperFunctions::AssignTableBorderToAny( aVal, aOuter, aInner);
     845             :                         }
     846             :                     }
     847           6 :                     break;
     848             :             }
     849             :         }
     850             :     }
     851             : 
     852         217 :     return aVal;
     853             : }
     854             : 
     855          93 : SC_IMPL_DUMMY_PROPERTY_LISTENER( ScAutoFormatFieldObj )
     856             : 
     857             : //------------------------------------------------------------------------
     858             : 
     859             : 
     860             : 
     861             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10