LCOV - code coverage report
Current view: top level - libreoffice/sc/source/ui/vba - vbafont.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 238 0.0 %
Date: 2012-12-27 Functions: 0 30 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : #include <com/sun/star/beans/XProperty.hpp>
      20             : #include <com/sun/star/awt/FontWeight.hpp>
      21             : #include <com/sun/star/awt/FontUnderline.hpp>
      22             : #include <com/sun/star/awt/FontStrikeout.hpp>
      23             : #include <com/sun/star/awt/FontSlant.hpp>
      24             : #include <com/sun/star/text/XSimpleText.hpp>
      25             : #include <com/sun/star/table/XCellRange.hpp>
      26             : #include <com/sun/star/table/XCell.hpp>
      27             : #include <com/sun/star/table/XColumnRowRange.hpp>
      28             : #include <ooo/vba/excel/XlColorIndex.hpp>
      29             : #include <ooo/vba/excel/XlUnderlineStyle.hpp>
      30             : #include <svl/itemset.hxx>
      31             : #include "excelvbahelper.hxx"
      32             : #include "vbafont.hxx"
      33             : #include "scitems.hxx"
      34             : #include "cellsuno.hxx"
      35             : 
      36             : using namespace ::ooo::vba;
      37             : using namespace ::com::sun::star;
      38             : 
      39           0 : ScVbaFont::ScVbaFont(
      40             :         const uno::Reference< XHelperInterface >& xParent,
      41             :         const uno::Reference< uno::XComponentContext >& xContext,
      42             :         const ScVbaPalette& dPalette,
      43             :         const uno::Reference< beans::XPropertySet >& xPropertySet,
      44             :         ScCellRangeObj* pRangeObj, bool bFormControl ) throw ( uno::RuntimeException ) :
      45             :     ScVbaFont_BASE( xParent, xContext, dPalette.getPalette(), xPropertySet, bFormControl ),
      46             :     mPalette( dPalette ),
      47           0 :     mpRangeObj( pRangeObj )
      48             : {
      49           0 : }
      50             : 
      51             : SfxItemSet*
      52           0 : ScVbaFont::GetDataSet()
      53             : {
      54           0 :     return mpRangeObj ? excel::ScVbaCellRangeAccess::GetDataSet( mpRangeObj ) : 0;
      55             : }
      56             : 
      57           0 : ScVbaFont::~ScVbaFont()
      58             : {
      59           0 : }
      60             : 
      61             : 
      62           0 : static uno::Reference< beans::XPropertySet > lcl_TextProperties( uno::Reference< table::XCell >& xIf ) throw ( uno::RuntimeException )
      63             : {
      64           0 :     uno::Reference< text::XTextRange > xTxtRange( xIf, uno::UNO_QUERY_THROW );
      65           0 :     uno::Reference< text::XSimpleText > xTxt( xTxtRange->getText(), uno::UNO_QUERY_THROW ) ;
      66           0 :     uno::Reference< beans::XPropertySet > xProps( xTxt->createTextCursor(), uno::UNO_QUERY_THROW );
      67           0 :     return xProps;
      68             : }
      69             : void SAL_CALL
      70           0 : ScVbaFont::setSuperscript( const uno::Any& aValue ) throw ( uno::RuntimeException )
      71             : {
      72             :     // #FIXEME create some sort of generic get/set code where
      73             :     // you can pass a functor
      74             :     // get/set - Super/sub script code is exactly the same
      75             :     // except for the call applied at each cell position
      76           0 :         uno::Reference< table::XCell> xCell( mxFont, uno::UNO_QUERY );
      77           0 :         uno::Reference< table::XCellRange > xCellRange( mxFont, uno::UNO_QUERY );
      78           0 :     if ( !xCell.is() )
      79             :     {
      80           0 :         uno::Reference< table::XColumnRowRange > xColumnRowRange(xCellRange, uno::UNO_QUERY_THROW );
      81           0 :         sal_Int32 nCols = xColumnRowRange->getColumns()->getCount();
      82           0 :         sal_Int32 nRows = xColumnRowRange->getRows()->getCount();
      83           0 :         for ( sal_Int32 col = 0; col < nCols; ++col )
      84             :         {
      85           0 :             for ( sal_Int32 row = 0; row < nRows; ++row )
      86             :             {
      87           0 :                 uno::Reference< beans::XPropertySet > xProps( xCellRange->getCellByPosition( col, row ) , uno::UNO_QUERY_THROW );
      88           0 :                 ScVbaFont aFont( getParent(), mxContext, mPalette, xProps );
      89           0 :                 aFont.setSuperscript( aValue );
      90           0 :             }
      91             :         }
      92           0 :         return;
      93             : 
      94             :     }
      95           0 :         xCell.set( xCellRange->getCellByPosition( 0,0 ) );
      96             : 
      97           0 :     uno::Reference< beans::XPropertySet > xProps = lcl_TextProperties( xCell );
      98           0 :     sal_Bool bValue = false;
      99           0 :     aValue >>= bValue;
     100           0 :     sal_Int16 nValue = NORMAL;
     101           0 :     sal_Int8 nValue2 = NORMALHEIGHT;
     102             : 
     103           0 :         if( bValue )
     104             :     {
     105           0 :         nValue = SUPERSCRIPT;
     106           0 :             nValue2 = SUPERSCRIPTHEIGHT;
     107             :     }
     108           0 :     xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharEscapement" ) ), ( uno::Any )nValue );
     109           0 :      xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharEscapementHeight" ) ), ( uno::Any )nValue2 );
     110             : }
     111             : 
     112             : uno::Any SAL_CALL
     113           0 : ScVbaFont::getSuperscript() throw ( uno::RuntimeException )
     114             : {
     115           0 :         uno::Reference< table::XCell> xCell( mxFont, uno::UNO_QUERY );
     116           0 :         uno::Reference< table::XCellRange > xCellRange( mxFont, uno::UNO_QUERY );
     117           0 :     if ( !xCell.is() )
     118             :     {
     119           0 :         uno::Reference< table::XColumnRowRange > xColumnRowRange(xCellRange, uno::UNO_QUERY_THROW );
     120           0 :         sal_Int32 nCols = xColumnRowRange->getColumns()->getCount();
     121           0 :         sal_Int32 nRows = xColumnRowRange->getRows()->getCount();
     122           0 :         uno::Any aRes;
     123           0 :         for ( sal_Int32 col = 0; col < nCols; ++col )
     124             :         {
     125           0 :             for ( sal_Int32 row = 0; row < nRows; ++row )
     126             :             {
     127           0 :                 uno::Reference< beans::XPropertySet > xProps( xCellRange->getCellByPosition( col, row ), uno::UNO_QUERY_THROW );
     128           0 :                 ScVbaFont aFont( getParent(), mxContext, mPalette, xProps );
     129           0 :                 if ( !col && !row )
     130           0 :                     aRes = aFont.getSuperscript();
     131           0 :                 else if ( aRes != aFont.getSuperscript() )
     132           0 :                     return aNULL();
     133           0 :             }
     134             :         }
     135           0 :         return aRes;
     136             : 
     137             :     }
     138           0 :         xCell.set( xCellRange->getCellByPosition( 0,0 ) );
     139           0 :     uno::Reference< beans::XPropertySet > xProps = lcl_TextProperties( xCell );
     140           0 :     short nValue = 0;
     141           0 :     xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharEscapement" ) ) ) >>= nValue;
     142           0 :     return uno::makeAny( ( nValue == SUPERSCRIPT ) );
     143             : }
     144             : 
     145             : void SAL_CALL
     146           0 : ScVbaFont::setSubscript( const uno::Any& aValue ) throw ( uno::RuntimeException )
     147             : {
     148           0 :         uno::Reference< table::XCell> xCell( mxFont, uno::UNO_QUERY );
     149           0 :         uno::Reference< table::XCellRange > xCellRange( mxFont, uno::UNO_QUERY );
     150           0 :     if ( !xCell.is() )
     151             :     {
     152           0 :         uno::Reference< table::XColumnRowRange > xColumnRowRange(xCellRange, uno::UNO_QUERY_THROW );
     153           0 :         sal_Int32 nCols = xColumnRowRange->getColumns()->getCount();
     154           0 :         sal_Int32 nRows = xColumnRowRange->getRows()->getCount();
     155           0 :         for ( sal_Int32 col = 0; col < nCols; ++col )
     156             :         {
     157           0 :             for ( sal_Int32 row = 0; row < nRows; ++row )
     158             :             {
     159           0 :                 uno::Reference< beans::XPropertySet > xProps( xCellRange->getCellByPosition( col, row ) , uno::UNO_QUERY_THROW );
     160           0 :                 ScVbaFont aFont( getParent(), mxContext, mPalette, xProps );
     161           0 :                 aFont.setSubscript( aValue );
     162           0 :             }
     163             :         }
     164           0 :         return;
     165             : 
     166             :     }
     167           0 :         xCell.set( xCellRange->getCellByPosition( 0,0 ) );
     168           0 :     uno::Reference< beans::XPropertySet > xProps = lcl_TextProperties( xCell );
     169             : 
     170           0 :     sal_Bool bValue = false;
     171           0 :     aValue >>= bValue;
     172           0 :     sal_Int16 nValue = NORMAL;
     173           0 :     sal_Int8 nValue2 = NORMALHEIGHT;
     174             : 
     175           0 :         if( bValue )
     176             :     {
     177           0 :         nValue= SUBSCRIPT;
     178           0 :             nValue2 = SUBSCRIPTHEIGHT;
     179             :     }
     180             : 
     181           0 :      xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharEscapementHeight" ) ), ( uno::Any )nValue2 );
     182           0 :     xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharEscapement" ) ), ( uno::Any )nValue );
     183             : 
     184             : }
     185             : 
     186             : uno::Any SAL_CALL
     187           0 : ScVbaFont::getSubscript() throw ( uno::RuntimeException )
     188             : {
     189           0 :         uno::Reference< table::XCell> xCell( mxFont, uno::UNO_QUERY );
     190           0 :         uno::Reference< table::XCellRange > xCellRange( mxFont, uno::UNO_QUERY );
     191           0 :     if ( !xCell.is() )
     192             :     {
     193           0 :         uno::Reference< table::XColumnRowRange > xColumnRowRange(xCellRange, uno::UNO_QUERY_THROW );
     194           0 :         sal_Int32 nCols = xColumnRowRange->getColumns()->getCount();
     195           0 :         sal_Int32 nRows = xColumnRowRange->getRows()->getCount();
     196           0 :         uno::Any aRes;
     197           0 :         for ( sal_Int32 col = 0; col < nCols; ++col )
     198             :         {
     199           0 :             for ( sal_Int32 row = 0; row < nRows; ++row )
     200             :             {
     201           0 :                 uno::Reference< beans::XPropertySet > xProps( xCellRange->getCellByPosition( col, row ), uno::UNO_QUERY_THROW );
     202           0 :                 ScVbaFont aFont( getParent(), mxContext, mPalette, xProps );
     203           0 :                 if ( !col && !row )
     204           0 :                     aRes = aFont.getSubscript();
     205           0 :                 else if ( aRes != aFont.getSubscript() )
     206           0 :                     return aNULL();
     207           0 :             }
     208             :         }
     209           0 :         return aRes;
     210             : 
     211             :     }
     212           0 :         xCell.set( xCellRange->getCellByPosition( 0,0 ) );
     213           0 :     uno::Reference< beans::XPropertySet > xProps = lcl_TextProperties( xCell );
     214             : 
     215           0 :     short nValue = NORMAL;
     216           0 :     xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharEscapement" ) ) ) >>= nValue;
     217           0 :     return uno::makeAny( ( nValue == SUBSCRIPT ) );
     218             : }
     219             : 
     220             : uno::Any SAL_CALL
     221           0 : ScVbaFont::getSize() throw ( uno::RuntimeException )
     222             : {
     223           0 :     if ( GetDataSet() )
     224           0 :         if (  GetDataSet()->GetItemState( ATTR_FONT_HEIGHT, sal_True, NULL) == SFX_ITEM_DONTCARE )
     225           0 :             return aNULL();
     226           0 :         return ScVbaFont_BASE::getSize();
     227             : }
     228             : 
     229             : void SAL_CALL
     230           0 : ScVbaFont::setColorIndex( const uno::Any& _colorindex ) throw( uno::RuntimeException )
     231             : {
     232           0 :     sal_Int32 nIndex = 0;
     233           0 :     _colorindex >>= nIndex;
     234             :     // #FIXME  xlColorIndexAutomatic & xlColorIndexNone are not really
     235             :     // handled properly here
     236             : 
     237           0 :     if ( !nIndex || ( nIndex == excel::XlColorIndex::xlColorIndexAutomatic ) )
     238             :         {
     239           0 :         nIndex = 1;  // check defualt ( assume black )
     240           0 :                 ScVbaFont_BASE::setColorIndex( uno::makeAny( nIndex ) );
     241             :         }
     242             :         else
     243           0 :             ScVbaFont_BASE::setColorIndex( _colorindex );
     244           0 : }
     245             : 
     246             : 
     247             : uno::Any SAL_CALL
     248           0 : ScVbaFont::getColorIndex() throw ( uno::RuntimeException )
     249             : {
     250           0 :     if ( GetDataSet() )
     251           0 :         if (  GetDataSet()->GetItemState( ATTR_FONT_COLOR, sal_True, NULL) == SFX_ITEM_DONTCARE )
     252           0 :             return aNULL();
     253           0 :     return ScVbaFont_BASE::getColorIndex();
     254             : }
     255             : 
     256             : //////////////////////////////////////////////////////////////////////////////////////////
     257             : void  SAL_CALL
     258           0 : ScVbaFont::setStandardFontSize( const uno::Any& /*aValue*/ ) throw( uno::RuntimeException )
     259             : {
     260             : //XXX #TODO# #FIXME#
     261             :     //mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharSize" ) ), ( uno::Any )fValue );
     262             :     throw uno::RuntimeException(
     263           0 :         rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("setStandardFontSize not supported") ), uno::Reference< uno::XInterface >() );
     264             : }
     265             : 
     266             : 
     267             : uno::Any SAL_CALL
     268           0 : ScVbaFont::getStandardFontSize() throw ( uno::RuntimeException )
     269             : {
     270             : //XXX #TODO# #FIXME#
     271             :     throw uno::RuntimeException(
     272           0 :         rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("getStandardFontSize not supported") ), uno::Reference< uno::XInterface >() );
     273             :     // return uno::Any();
     274             : }
     275             : 
     276             : 
     277             : void  SAL_CALL
     278           0 : ScVbaFont::setStandardFont( const uno::Any& /*aValue*/ ) throw( uno::RuntimeException )
     279             : {
     280             : //XXX #TODO# #FIXME#
     281             :     throw uno::RuntimeException(
     282           0 :         rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("setStandardFont not supported") ), uno::Reference< uno::XInterface >() );
     283             : }
     284             : 
     285             : 
     286             : uno::Any SAL_CALL
     287           0 : ScVbaFont::getStandardFont() throw ( uno::RuntimeException )
     288             : {
     289             : //XXX #TODO# #FIXME#
     290             :     throw uno::RuntimeException(
     291           0 :         rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("getStandardFont not supported") ), uno::Reference< uno::XInterface >() );
     292             :     // return uno::Any();
     293             : }
     294             : 
     295             : void SAL_CALL
     296           0 : ScVbaFont::setFontStyle( const uno::Any& aValue ) throw( uno::RuntimeException )
     297             : {
     298           0 :     sal_Bool bBold = false;
     299           0 :     sal_Bool bItalic = false;
     300             : 
     301           0 :     rtl::OUString aStyles;
     302           0 :     aValue >>= aStyles;
     303             : 
     304           0 :     std::vector< rtl::OUString > aTokens;
     305           0 :     sal_Int32 nIndex = 0;
     306           0 :     do
     307             :     {
     308           0 :         rtl::OUString aToken = aStyles.getToken( 0, ' ', nIndex );
     309           0 :         aTokens.push_back( aToken );
     310             :     }while( nIndex >= 0 );
     311             : 
     312           0 :     std::vector< rtl::OUString >::iterator it;
     313           0 :     for( it = aTokens.begin(); it != aTokens.end(); ++it )
     314             :     {
     315           0 :         if( (*it).equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("Bold")) )
     316           0 :             bBold = sal_True;
     317             : 
     318           0 :         if( (*it).equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("Italic")) )
     319           0 :             bItalic = sal_True;
     320             :     }
     321             : 
     322           0 :     setBold( uno::makeAny( bBold ) );
     323           0 :     setItalic( uno::makeAny( bItalic ) );
     324           0 : }
     325             : 
     326             : 
     327             : uno::Any SAL_CALL
     328           0 : ScVbaFont::getFontStyle() throw ( uno::RuntimeException )
     329             : {
     330           0 :     rtl::OUStringBuffer aStyles;
     331           0 :     sal_Bool bValue = false;
     332           0 :     getBold() >>= bValue;
     333           0 :     if( bValue )
     334           0 :         aStyles.appendAscii("Bold");
     335             : 
     336           0 :     getItalic() >>= bValue;
     337           0 :     if( bValue )
     338             :     {
     339           0 :         if( aStyles.getLength() )
     340           0 :             aStyles.appendAscii(" ");
     341           0 :         aStyles.appendAscii("Italic");
     342             :     }
     343           0 :     return uno::makeAny( aStyles.makeStringAndClear() );
     344             : }
     345             : 
     346             : uno::Any SAL_CALL
     347           0 : ScVbaFont::getBold() throw ( uno::RuntimeException )
     348             : {
     349           0 :     if ( GetDataSet() )
     350           0 :         if (  GetDataSet()->GetItemState( ATTR_FONT_WEIGHT, sal_True, NULL) == SFX_ITEM_DONTCARE )
     351           0 :             return aNULL();
     352           0 :     return ScVbaFont_BASE::getBold();
     353             : }
     354             : 
     355             : void SAL_CALL
     356           0 : ScVbaFont::setUnderline( const uno::Any& aValue ) throw ( uno::RuntimeException )
     357             : {
     358             :     // default
     359           0 :     sal_Int32 nValue = excel::XlUnderlineStyle::xlUnderlineStyleNone;
     360           0 :     aValue >>= nValue;
     361           0 :     switch ( nValue )
     362             :     {
     363             : // NOTE:: #TODO #FIMXE
     364             : // xlUnderlineStyleDoubleAccounting & xlUnderlineStyleSingleAccounting
     365             : // don't seem to be supported in Openoffice.
     366             : // The import filter converts them to single or double underlines as appropriate
     367             : // So, here at the moment we are similarly silently converting
     368             : // xlUnderlineStyleSingleAccounting to xlUnderlineStyleSingle.
     369             : 
     370             :         case excel::XlUnderlineStyle::xlUnderlineStyleNone:
     371           0 :             nValue = awt::FontUnderline::NONE;
     372           0 :             break;
     373             :         case excel::XlUnderlineStyle::xlUnderlineStyleSingle:
     374             :         case excel::XlUnderlineStyle::xlUnderlineStyleSingleAccounting:
     375           0 :             nValue = awt::FontUnderline::SINGLE;
     376           0 :             break;
     377             :         case excel::XlUnderlineStyle::xlUnderlineStyleDouble:
     378             :         case excel::XlUnderlineStyle::xlUnderlineStyleDoubleAccounting:
     379           0 :             nValue = awt::FontUnderline::DOUBLE;
     380           0 :             break;
     381             :         default:
     382           0 :             throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Unknown value for Underline")), uno::Reference< uno::XInterface >() );
     383             :     }
     384             : 
     385           0 :     mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharUnderline" ) ), ( uno::Any )nValue );
     386             : 
     387           0 : }
     388             : 
     389             : uno::Any SAL_CALL
     390           0 : ScVbaFont::getUnderline() throw ( uno::RuntimeException )
     391             : {
     392           0 :     if ( GetDataSet() )
     393           0 :         if (  GetDataSet()->GetItemState( ATTR_FONT_UNDERLINE, sal_True, NULL) == SFX_ITEM_DONTCARE )
     394           0 :             return aNULL();
     395             : 
     396           0 :     sal_Int32 nValue = awt::FontUnderline::NONE;
     397           0 :     mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharUnderline" ) ) ) >>= nValue;
     398           0 :     switch ( nValue )
     399             :     {
     400             :         case  awt::FontUnderline::DOUBLE:
     401           0 :             nValue = excel::XlUnderlineStyle::xlUnderlineStyleDouble;
     402           0 :             break;
     403             :         case  awt::FontUnderline::SINGLE:
     404           0 :             nValue = excel::XlUnderlineStyle::xlUnderlineStyleSingle;
     405           0 :             break;
     406             :         case  awt::FontUnderline::NONE:
     407           0 :             nValue = excel::XlUnderlineStyle::xlUnderlineStyleNone;
     408           0 :             break;
     409             :         default:
     410           0 :             throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Unknown value retrieved for Underline") ), uno::Reference< uno::XInterface >() );
     411             : 
     412             :     }
     413           0 :     return uno::makeAny( nValue );
     414             : }
     415             : 
     416             : uno::Any SAL_CALL
     417           0 : ScVbaFont::getStrikethrough() throw ( uno::RuntimeException )
     418             : {
     419           0 :     if ( GetDataSet() )
     420           0 :         if (  GetDataSet()->GetItemState( ATTR_FONT_CROSSEDOUT, sal_True, NULL) == SFX_ITEM_DONTCARE )
     421           0 :             return aNULL();
     422           0 :     return ScVbaFont_BASE::getStrikethrough();
     423             : }
     424             : 
     425             : uno::Any SAL_CALL
     426           0 : ScVbaFont::getShadow() throw (uno::RuntimeException)
     427             : {
     428           0 :     if ( GetDataSet() )
     429           0 :         if (  GetDataSet()->GetItemState( ATTR_FONT_SHADOWED, sal_True, NULL) == SFX_ITEM_DONTCARE )
     430           0 :             return aNULL();
     431           0 :     return ScVbaFont_BASE::getShadow();
     432             : }
     433             : 
     434             : uno::Any SAL_CALL
     435           0 : ScVbaFont::getItalic() throw ( uno::RuntimeException )
     436             : {
     437           0 :     if ( GetDataSet() )
     438           0 :         if (  GetDataSet()->GetItemState( ATTR_FONT_POSTURE, sal_True, NULL) == SFX_ITEM_DONTCARE )
     439           0 :             return aNULL();
     440             : 
     441           0 :     return ScVbaFont_BASE::getItalic();
     442             : }
     443             : 
     444             : uno::Any SAL_CALL
     445           0 : ScVbaFont::getName() throw ( uno::RuntimeException )
     446             : {
     447           0 :     if ( GetDataSet() )
     448           0 :         if (  GetDataSet()->GetItemState( ATTR_FONT, sal_True, NULL) == SFX_ITEM_DONTCARE )
     449           0 :             return aNULL();
     450           0 :     return ScVbaFont_BASE::getName();
     451             : }
     452             : uno::Any
     453           0 : ScVbaFont::getColor() throw (uno::RuntimeException)
     454             : {
     455             :     // #TODO #FIXME - behave like getXXX above ( wrt. GetDataSet )
     456           0 :     uno::Any aAny;
     457           0 :     aAny = OORGBToXLRGB( mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharColor" ) ) ) );
     458           0 :     return aAny;
     459             : }
     460             : 
     461             : void  SAL_CALL
     462           0 : ScVbaFont::setOutlineFont( const uno::Any& aValue ) throw ( uno::RuntimeException )
     463             : {
     464           0 :     mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharContoured" ) ), aValue );
     465           0 : }
     466             : 
     467             : uno::Any SAL_CALL
     468           0 : ScVbaFont::getOutlineFont() throw (uno::RuntimeException)
     469             : {
     470           0 :     if ( GetDataSet() )
     471           0 :         if (  GetDataSet()->GetItemState( ATTR_FONT_CONTOUR, sal_True, NULL) == SFX_ITEM_DONTCARE )
     472           0 :             return aNULL();
     473           0 :     return mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharContoured" ) ) );
     474             : }
     475             : 
     476             : rtl::OUString
     477           0 : ScVbaFont::getServiceImplName()
     478             : {
     479           0 :     return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ScVbaFont"));
     480             : }
     481             : 
     482             : uno::Sequence< rtl::OUString >
     483           0 : ScVbaFont::getServiceNames()
     484             : {
     485           0 :     static uno::Sequence< rtl::OUString > aServiceNames;
     486           0 :     if ( aServiceNames.getLength() == 0 )
     487             :     {
     488           0 :         aServiceNames.realloc( 1 );
     489           0 :         aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Font" ) );
     490             :     }
     491           0 :     return aServiceNames;
     492             : }
     493             : 
     494             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10