Files
libreoffice/chart2/source/controller/itemsetwrapper/CharacterPropertyItemConverter.cxx

518 lines
19 KiB
C++
Raw Normal View History

2003-10-06 08:58:36 +00:00
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2003-10-06 08:58:36 +00:00
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
2003-10-06 08:58:36 +00:00
*
* OpenOffice.org - a multi-platform office productivity suite
2003-10-06 08:58:36 +00:00
*
* This file is part of OpenOffice.org.
2003-10-06 08:58:36 +00:00
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
2003-10-06 08:58:36 +00:00
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
2003-10-06 08:58:36 +00:00
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
2003-10-06 08:58:36 +00:00
*
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_chart2.hxx"
2003-10-06 08:58:36 +00:00
#include "CharacterPropertyItemConverter.hxx"
#include "SchWhichPairs.hxx"
#include "macros.hxx"
#include "ItemPropertyMap.hxx"
#include "RelativeSizeHelper.hxx"
2003-10-06 08:58:36 +00:00
#include <svx/eeitem.hxx>
#include <svx/udlnitem.hxx>
#include <svx/fontitem.hxx>
#include <svx/crsditem.hxx>
#include <svx/postitem.hxx>
#include <svx/wghtitem.hxx>
#include <svx/fhgtitem.hxx>
#include <svl/stritem.hxx>
2003-10-06 08:58:36 +00:00
#include <com/sun/star/beans/XPropertyState.hpp>
#include <com/sun/star/chart2/XFormattedString.hpp>
2003-10-06 08:58:36 +00:00
using namespace ::com::sun::star;
namespace
{
::comphelper::ItemPropertyMapType & lcl_GetCharacterPropertyPropertyMap()
2003-10-06 08:58:36 +00:00
{
static ::comphelper::ItemPropertyMapType aCharacterPropertyMap(
::comphelper::MakeItemPropertyMap
IPM_MAP_ENTRY( EE_CHAR_COLOR, "CharColor", 0 )
IPM_MAP_ENTRY( EE_CHAR_LANGUAGE, "CharLocale", MID_LANG_LOCALE )
IPM_MAP_ENTRY( EE_CHAR_LANGUAGE_CJK, "CharLocaleAsian", MID_LANG_LOCALE )
IPM_MAP_ENTRY( EE_CHAR_LANGUAGE_CTL, "CharLocaleComplex", MID_LANG_LOCALE )
// IPM_MAP_ENTRY( EE_CHAR_FONTHEIGHT, "CharHeight", 0 )
// IPM_MAP_ENTRY( EE_CHAR_ITALIC, "CharPosture", 0 )
// IPM_MAP_ENTRY( EE_CHAR_WEIGHT, "CharWeight", 0 )
IPM_MAP_ENTRY( EE_CHAR_STRIKEOUT, "CharStrikeout", MID_CROSS_OUT )
IPM_MAP_ENTRY( EE_CHAR_WLM, "CharWordMode", 0 )
IPM_MAP_ENTRY( EE_CHAR_SHADOW, "CharShadowed", 0 )
IPM_MAP_ENTRY( EE_CHAR_RELIEF, "CharRelief", 0 )
IPM_MAP_ENTRY( EE_CHAR_OUTLINE, "CharContoured", 0 )
IPM_MAP_ENTRY( EE_CHAR_EMPHASISMARK, "CharEmphasis", 0 )
2008-11-26 15:19:48 +00:00
IPM_MAP_ENTRY( EE_PARA_WRITINGDIR, "WritingMode", 0 )
// IPM_MAP_ENTRY( EE_CHAR_FONTHEIGHT_CJK, "CharHeightAsian", 0 )
// IPM_MAP_ENTRY( EE_CHAR_FONTHEIGHT_CTL, "CharHeightComplex", 0 )
// IPM_MAP_ENTRY( EE_CHAR_WEIGHT_CJK, "CharWeightAsian", 0 )
// IPM_MAP_ENTRY( EE_CHAR_WEIGHT_CTL, "CharWeightComplex", 0 )
// IPM_MAP_ENTRY( EE_CHAR_ITALIC_CJK, "CharPostureAsian", 0 )
// IPM_MAP_ENTRY( EE_CHAR_ITALIC_CTL, "CharPostureComplex", 0 )
CWS-TOOLING: integrate CWS chart37 2009-05-22 09:10:36 +0200 iha r272170 : #i102130# color of pies is not loaded correctly 2009-04-27 17:16:20 +0200 iha r271294 : #i24203# compiler problem 2009-04-27 16:43:21 +0200 iha r271292 : #i101281# missing API documentation for secondary axis title properties 2009-04-27 15:26:05 +0200 hde r271276 : #i100987 2009-04-27 15:24:42 +0200 hde r271273 : #i100987 2009-04-24 15:08:33 +0200 iha r271214 : #i100995# crash with some logarithmic scalings 2009-04-22 18:50:56 +0200 dr r271134 : #i82177# write out deleted point labels 2009-04-22 18:40:48 +0200 iha r271133 : #i101281# missing API documentation for secondary axis title properties 2009-04-22 16:39:42 +0200 dr r271128 : #i82177# extensions for bubble charts 2009-04-22 14:37:00 +0200 dr r271114 : #i82177# import/export data label type and separator 2009-04-22 14:36:24 +0200 dr r271113 : #i82177# import/export data label type and separator 2009-04-21 15:25:26 +0200 dr r271038 : #i82177# import data label type and separator from BIFF8 CHFR records 2009-04-21 14:37:16 +0200 dr r271037 : #i82177# dump BIFF8 chart future records 2009-04-20 17:44:27 +0200 iha r271002 : #i96898# reduce library exports 2009-04-20 13:01:13 +0200 iha r270975 : #i24203# rotate data labels - help ids 2009-04-20 11:40:33 +0200 dr r270969 : #i96600# export of axis scaling/positioning properties 2009-04-16 16:02:31 +0200 dr r270892 : #i69599# keep Y axis left in 3d charts 2009-04-15 18:16:46 +0200 dr r270859 : #i69599# import of axis position settings 2009-04-15 18:16:01 +0200 dr r270858 : #i69599# correct handling of logarithmic crossing axes 2009-04-14 16:27:48 +0200 dr r270794 : #i96599# handle auto axis position on logarithmic axes 2009-04-09 19:59:51 +0200 dr r270722 : #i96599# import axis crossing settings, fix import of logarithmic scaling settings 2009-04-09 18:26:00 +0200 iha r270720 : #i96898# reduce library exports 2009-04-09 15:17:04 +0200 iha r270710 : #i96898# reduce library exports 2009-04-09 10:50:14 +0200 dr r270682 : #i24203# import/export of data label rotation, fixed some other broken stuff too 2009-04-08 16:54:54 +0200 dr r270657 : #i24203# import rotation for data point labels 2009-04-06 18:19:17 +0200 iha r270571 : #i100876# Axis scaling settings dialog wrong after API usage (anys different from double type) 2009-04-06 15:57:05 +0200 iha r270567 : #i100105# #i58585# leftover -> 2009-04-06 15:55:48 +0200 iha r270564 : #i58585# leftover -> 2009-04-02 16:41:07 +0200 iha r270422 : #i99721# remove unused code 2009-04-02 14:29:03 +0200 iha r270407 : #i99721# remove unused code 2009-03-26 10:58:23 +0100 iha r270059 : #i96898# reduce library exports 2009-03-26 10:13:49 +0100 iha r270055 : #i96898# reduce library exports 2009-03-25 09:39:13 +0100 iha r269998 : CWS-TOOLING: rebase CWS chart37 to trunk@269781 (milestone: DEV300:m44) 2009-03-24 17:56:56 +0100 iha r269986 : #i96898# reduce library exports 2009-03-24 16:56:44 +0100 iha r269974 : #i99721# remove unused code 2009-03-24 16:48:48 +0100 iha r269970 : #i89731# remove unused string 2009-03-24 15:44:04 +0100 iha r269961 : remove unused code 2009-03-24 15:22:45 +0100 iha r269959 : remove unused code 2009-03-24 15:17:17 +0100 iha r269957 : remove unused code 2009-03-24 11:14:53 +0100 iha r269923 : #i24203# rotate data labels 2009-03-09 12:10:25 +0100 hde r269076 : #i99300# 2009-03-06 15:56:26 +0100 iha r269011 : #i93953# Source Format for secondary axis without data 2009-02-17 15:59:05 +0100 iha r268177 : avoid warning during build 2009-02-17 15:01:59 +0100 iha r268173 : avoid warning during build 2009-02-13 09:39:03 +0100 ufi r267693 : i96999 2009-02-11 15:12:35 +0100 iha r267604 : removed unused string 2009-02-11 14:00:29 +0100 iha r267600 : #i96999# Corrected wording from 'correlation coefficient' to 'coefficient of determination' 2009-02-11 10:56:45 +0100 iha r267584 : #i89731# typo in resource string 2009-02-11 10:01:29 +0100 iha r267582 : #i89031# compile error on asian windows systems 2009-02-10 16:15:16 +0100 iha r267552 : #i24203# rotate data labels 2009-02-04 18:00:33 +0100 iha r267395 : #i98893# don't export defaults to file 2009-02-04 15:48:15 +0100 iha r267390 : #i92128# asian typography for chart elements 2009-02-04 15:17:41 +0100 iha r267386 : #i92128# asian typography for chart elements 2009-01-30 14:41:10 +0100 iha r267197 : CWS-TOOLING: rebase CWS chart37 to trunk@267171 (milestone: DEV300:m41)
2009-06-04 09:41:18 +00:00
IPM_MAP_ENTRY( EE_PARA_ASIANCJKSPACING, "ParaIsCharacterDistance", 0 )
2003-10-06 08:58:36 +00:00
);
return aCharacterPropertyMap;
}
} // anonymous namespace
// ========================================
namespace chart
{
namespace wrapper
{
CharacterPropertyItemConverter::CharacterPropertyItemConverter(
const uno::Reference< beans::XPropertySet > & rPropertySet,
SfxItemPool& rItemPool ) :
ItemConverter( rPropertySet, rItemPool )
{}
CharacterPropertyItemConverter::CharacterPropertyItemConverter(
const uno::Reference< beans::XPropertySet > & rPropertySet,
SfxItemPool& rItemPool,
::std::auto_ptr< awt::Size > pRefSize,
const ::rtl::OUString & rRefSizePropertyName,
const uno::Reference< beans::XPropertySet > & rRefSizePropSet ) :
ItemConverter( rPropertySet, rItemPool ),
m_pRefSize( pRefSize ),
m_aRefSizePropertyName( rRefSizePropertyName ),
m_xRefSizePropSet( rRefSizePropSet.is() ? rRefSizePropSet : rPropertySet )
2003-10-06 08:58:36 +00:00
{}
CharacterPropertyItemConverter::~CharacterPropertyItemConverter()
{}
const USHORT * CharacterPropertyItemConverter::GetWhichPairs() const
{
return nCharacterPropertyWhichPairs;
}
bool CharacterPropertyItemConverter::GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const
2003-10-06 08:58:36 +00:00
{
::comphelper::ItemPropertyMapType & rMap( lcl_GetCharacterPropertyPropertyMap());
::comphelper::ItemPropertyMapType::const_iterator aIt( rMap.find( nWhichId ));
2003-10-06 08:58:36 +00:00
if( aIt == rMap.end())
return false;
rOutProperty =(*aIt).second;
2003-10-06 08:58:36 +00:00
return true;
}
void CharacterPropertyItemConverter::FillSpecialItem(
USHORT nWhichId, SfxItemSet & rOutItemSet ) const
throw( uno::Exception )
2003-10-06 08:58:36 +00:00
{
switch( nWhichId )
{
case EE_CHAR_FONTINFO:
2003-11-14 09:48:14 +00:00
case EE_CHAR_FONTINFO_CJK:
case EE_CHAR_FONTINFO_CTL:
2003-10-06 08:58:36 +00:00
{
2003-11-14 09:48:14 +00:00
::rtl::OUString aPostfix;
if( nWhichId == EE_CHAR_FONTINFO_CJK )
aPostfix = C2U( "Asian" );
else if( nWhichId == EE_CHAR_FONTINFO_CTL )
aPostfix = C2U( "Complex" );
2003-10-06 08:58:36 +00:00
2003-11-14 09:48:14 +00:00
SvxFontItem aItem( nWhichId );
aItem.PutValue( GetPropertySet()->getPropertyValue( C2U( "CharFontName" ) + aPostfix),
2003-10-06 08:58:36 +00:00
MID_FONT_FAMILY_NAME );
2003-11-14 09:48:14 +00:00
aItem.PutValue( GetPropertySet()->getPropertyValue( C2U( "CharFontFamily" ) + aPostfix),
2003-10-06 08:58:36 +00:00
MID_FONT_FAMILY );
2003-11-14 09:48:14 +00:00
aItem.PutValue( GetPropertySet()->getPropertyValue( C2U( "CharFontStyleName" ) + aPostfix),
2003-10-06 08:58:36 +00:00
MID_FONT_STYLE_NAME );
2003-11-14 09:48:14 +00:00
aItem.PutValue( GetPropertySet()->getPropertyValue( C2U( "CharFontCharSet" ) + aPostfix),
2003-10-06 08:58:36 +00:00
MID_FONT_CHAR_SET );
2003-11-14 09:48:14 +00:00
aItem.PutValue( GetPropertySet()->getPropertyValue( C2U( "CharFontPitch" ) + aPostfix),
2003-10-06 08:58:36 +00:00
MID_FONT_PITCH );
rOutItemSet.Put( aItem );
}
break;
case EE_CHAR_UNDERLINE:
{
SvxUnderlineItem aItem(UNDERLINE_NONE, EE_CHAR_UNDERLINE);
2003-10-06 08:58:36 +00:00
bool bModified = false;
uno::Any aValue( GetPropertySet()->getPropertyValue( C2U( "CharUnderline" )));
if( aValue.hasValue())
{
aItem.PutValue( aValue, MID_TL_STYLE );
2003-10-06 08:58:36 +00:00
bModified = true;
}
aValue = GetPropertySet()->getPropertyValue( C2U( "CharUnderlineHasColor" ));
if( aValue.hasValue() &&
( *reinterpret_cast< const sal_Bool * >( aValue.getValue()) != sal_False ))
{
aItem.PutValue( aValue, MID_TL_HASCOLOR );
2003-10-06 08:58:36 +00:00
bModified = true;
}
aValue = GetPropertySet()->getPropertyValue( C2U( "CharUnderlineColor" ));
if( aValue.hasValue())
{
aItem.PutValue( aValue, MID_TL_COLOR );
2003-10-06 08:58:36 +00:00
bModified = true;
}
if( bModified )
rOutItemSet.Put( aItem );
}
break;
case EE_CHAR_ITALIC:
2003-11-14 09:48:14 +00:00
case EE_CHAR_ITALIC_CJK:
case EE_CHAR_ITALIC_CTL:
2003-10-06 08:58:36 +00:00
{
2003-11-14 09:48:14 +00:00
::rtl::OUString aPostfix;
if( nWhichId == EE_CHAR_ITALIC_CJK )
aPostfix = C2U( "Asian" );
else if( nWhichId == EE_CHAR_ITALIC_CTL )
aPostfix = C2U( "Complex" );
SvxPostureItem aItem( ITALIC_NONE, nWhichId );
2003-10-06 08:58:36 +00:00
2003-11-14 09:48:14 +00:00
uno::Any aValue( GetPropertySet()->getPropertyValue( C2U( "CharPosture" ) + aPostfix));
2003-10-06 08:58:36 +00:00
if( aValue.hasValue())
{
aItem.PutValue( aValue, MID_POSTURE );
rOutItemSet.Put( aItem );
}
}
break;
case EE_CHAR_WEIGHT:
2003-11-14 09:48:14 +00:00
case EE_CHAR_WEIGHT_CJK:
case EE_CHAR_WEIGHT_CTL:
2003-10-06 08:58:36 +00:00
{
2003-11-14 09:48:14 +00:00
::rtl::OUString aPostfix;
if( nWhichId == EE_CHAR_WEIGHT_CJK )
aPostfix = C2U( "Asian" );
else if( nWhichId == EE_CHAR_WEIGHT_CTL )
aPostfix = C2U( "Complex" );
2003-10-06 08:58:36 +00:00
2003-11-14 09:48:14 +00:00
SvxWeightItem aItem( WEIGHT_NORMAL, nWhichId );
uno::Any aValue( GetPropertySet()->getPropertyValue( C2U( "CharWeight" ) + aPostfix));
2003-10-06 08:58:36 +00:00
if( aValue.hasValue())
{
aItem.PutValue( aValue, MID_WEIGHT );
rOutItemSet.Put( aItem );
}
}
break;
case EE_CHAR_FONTHEIGHT:
case EE_CHAR_FONTHEIGHT_CJK:
case EE_CHAR_FONTHEIGHT_CTL:
{
::rtl::OUString aPostfix;
if( nWhichId == EE_CHAR_FONTHEIGHT_CJK )
aPostfix = C2U( "Asian" );
else if( nWhichId == EE_CHAR_FONTHEIGHT_CTL )
aPostfix = C2U( "Complex" );
SvxFontHeightItem aItem( 240, 100, nWhichId );
try
{
uno::Any aValue( GetPropertySet()->getPropertyValue( C2U( "CharHeight" ) + aPostfix ));
float fHeight;
if( aValue >>= fHeight )
{
if( m_pRefSize.get())
{
awt::Size aOldRefSize;
if( GetRefSizePropertySet()->getPropertyValue( m_aRefSizePropertyName ) >>= aOldRefSize )
{
// calculate font height in view
fHeight = static_cast< float >(
RelativeSizeHelper::calculate( fHeight, aOldRefSize, *m_pRefSize ));
aValue <<= fHeight;
}
}
aItem.PutValue( aValue, MID_FONTHEIGHT );
rOutItemSet.Put( aItem );
}
}
catch( uno::Exception & ex )
{
ASSERT_EXCEPTION( ex );
}
}
break;
case SID_CHAR_DLG_PREVIEW_STRING:
{
uno::Reference< chart2::XFormattedString > xFormattedString( GetPropertySet(), uno::UNO_QUERY );
if( xFormattedString.is() )
{
::rtl::OUString aString = xFormattedString->getString();
rOutItemSet.Put( SfxStringItem( nWhichId, aString ) );
}
else
rOutItemSet.Put( SfxStringItem( nWhichId, C2U( "" ) ) );
}
break;
CWS-TOOLING: integrate CWS chart37 2009-05-22 09:10:36 +0200 iha r272170 : #i102130# color of pies is not loaded correctly 2009-04-27 17:16:20 +0200 iha r271294 : #i24203# compiler problem 2009-04-27 16:43:21 +0200 iha r271292 : #i101281# missing API documentation for secondary axis title properties 2009-04-27 15:26:05 +0200 hde r271276 : #i100987 2009-04-27 15:24:42 +0200 hde r271273 : #i100987 2009-04-24 15:08:33 +0200 iha r271214 : #i100995# crash with some logarithmic scalings 2009-04-22 18:50:56 +0200 dr r271134 : #i82177# write out deleted point labels 2009-04-22 18:40:48 +0200 iha r271133 : #i101281# missing API documentation for secondary axis title properties 2009-04-22 16:39:42 +0200 dr r271128 : #i82177# extensions for bubble charts 2009-04-22 14:37:00 +0200 dr r271114 : #i82177# import/export data label type and separator 2009-04-22 14:36:24 +0200 dr r271113 : #i82177# import/export data label type and separator 2009-04-21 15:25:26 +0200 dr r271038 : #i82177# import data label type and separator from BIFF8 CHFR records 2009-04-21 14:37:16 +0200 dr r271037 : #i82177# dump BIFF8 chart future records 2009-04-20 17:44:27 +0200 iha r271002 : #i96898# reduce library exports 2009-04-20 13:01:13 +0200 iha r270975 : #i24203# rotate data labels - help ids 2009-04-20 11:40:33 +0200 dr r270969 : #i96600# export of axis scaling/positioning properties 2009-04-16 16:02:31 +0200 dr r270892 : #i69599# keep Y axis left in 3d charts 2009-04-15 18:16:46 +0200 dr r270859 : #i69599# import of axis position settings 2009-04-15 18:16:01 +0200 dr r270858 : #i69599# correct handling of logarithmic crossing axes 2009-04-14 16:27:48 +0200 dr r270794 : #i96599# handle auto axis position on logarithmic axes 2009-04-09 19:59:51 +0200 dr r270722 : #i96599# import axis crossing settings, fix import of logarithmic scaling settings 2009-04-09 18:26:00 +0200 iha r270720 : #i96898# reduce library exports 2009-04-09 15:17:04 +0200 iha r270710 : #i96898# reduce library exports 2009-04-09 10:50:14 +0200 dr r270682 : #i24203# import/export of data label rotation, fixed some other broken stuff too 2009-04-08 16:54:54 +0200 dr r270657 : #i24203# import rotation for data point labels 2009-04-06 18:19:17 +0200 iha r270571 : #i100876# Axis scaling settings dialog wrong after API usage (anys different from double type) 2009-04-06 15:57:05 +0200 iha r270567 : #i100105# #i58585# leftover -> 2009-04-06 15:55:48 +0200 iha r270564 : #i58585# leftover -> 2009-04-02 16:41:07 +0200 iha r270422 : #i99721# remove unused code 2009-04-02 14:29:03 +0200 iha r270407 : #i99721# remove unused code 2009-03-26 10:58:23 +0100 iha r270059 : #i96898# reduce library exports 2009-03-26 10:13:49 +0100 iha r270055 : #i96898# reduce library exports 2009-03-25 09:39:13 +0100 iha r269998 : CWS-TOOLING: rebase CWS chart37 to trunk@269781 (milestone: DEV300:m44) 2009-03-24 17:56:56 +0100 iha r269986 : #i96898# reduce library exports 2009-03-24 16:56:44 +0100 iha r269974 : #i99721# remove unused code 2009-03-24 16:48:48 +0100 iha r269970 : #i89731# remove unused string 2009-03-24 15:44:04 +0100 iha r269961 : remove unused code 2009-03-24 15:22:45 +0100 iha r269959 : remove unused code 2009-03-24 15:17:17 +0100 iha r269957 : remove unused code 2009-03-24 11:14:53 +0100 iha r269923 : #i24203# rotate data labels 2009-03-09 12:10:25 +0100 hde r269076 : #i99300# 2009-03-06 15:56:26 +0100 iha r269011 : #i93953# Source Format for secondary axis without data 2009-02-17 15:59:05 +0100 iha r268177 : avoid warning during build 2009-02-17 15:01:59 +0100 iha r268173 : avoid warning during build 2009-02-13 09:39:03 +0100 ufi r267693 : i96999 2009-02-11 15:12:35 +0100 iha r267604 : removed unused string 2009-02-11 14:00:29 +0100 iha r267600 : #i96999# Corrected wording from 'correlation coefficient' to 'coefficient of determination' 2009-02-11 10:56:45 +0100 iha r267584 : #i89731# typo in resource string 2009-02-11 10:01:29 +0100 iha r267582 : #i89031# compile error on asian windows systems 2009-02-10 16:15:16 +0100 iha r267552 : #i24203# rotate data labels 2009-02-04 18:00:33 +0100 iha r267395 : #i98893# don't export defaults to file 2009-02-04 15:48:15 +0100 iha r267390 : #i92128# asian typography for chart elements 2009-02-04 15:17:41 +0100 iha r267386 : #i92128# asian typography for chart elements 2009-01-30 14:41:10 +0100 iha r267197 : CWS-TOOLING: rebase CWS chart37 to trunk@267171 (milestone: DEV300:m41)
2009-06-04 09:41:18 +00:00
case EE_PARA_FORBIDDENRULES:
case EE_PARA_HANGINGPUNCTUATION:
rOutItemSet.DisableItem( nWhichId );
break;
2003-10-06 08:58:36 +00:00
}
}
bool CharacterPropertyItemConverter::ApplySpecialItem(
USHORT nWhichId, const SfxItemSet & rItemSet )
throw( uno::Exception )
2003-10-06 08:58:36 +00:00
{
bool bChanged = false;
uno::Any aValue;
switch( nWhichId )
{
case EE_CHAR_FONTINFO:
2003-11-14 09:48:14 +00:00
case EE_CHAR_FONTINFO_CJK:
case EE_CHAR_FONTINFO_CTL:
2003-10-06 08:58:36 +00:00
{
2003-11-14 09:48:14 +00:00
::rtl::OUString aPostfix;
if( nWhichId == EE_CHAR_FONTINFO_CJK )
aPostfix = C2U( "Asian" );
else if( nWhichId == EE_CHAR_FONTINFO_CTL )
aPostfix = C2U( "Complex" );
2003-10-06 08:58:36 +00:00
const SvxFontItem & rItem =
static_cast< const SvxFontItem & >(
2003-10-06 08:58:36 +00:00
rItemSet.Get( nWhichId ));
if( rItem.QueryValue( aValue, MID_FONT_FAMILY_NAME ))
{
2003-11-14 09:48:14 +00:00
if( aValue != GetPropertySet()->getPropertyValue( C2U( "CharFontName" ) + aPostfix ))
2003-10-06 08:58:36 +00:00
{
2003-11-14 09:48:14 +00:00
GetPropertySet()->setPropertyValue( C2U( "CharFontName" ) + aPostfix, aValue );
2003-10-06 08:58:36 +00:00
bChanged = true;
}
}
if( rItem.QueryValue( aValue, MID_FONT_FAMILY ))
{
2003-11-14 09:48:14 +00:00
if( aValue != GetPropertySet()->getPropertyValue( C2U( "CharFontFamily" ) + aPostfix ))
2003-10-06 08:58:36 +00:00
{
2003-11-14 09:48:14 +00:00
GetPropertySet()->setPropertyValue( C2U( "CharFontFamily" ) + aPostfix, aValue );
2003-10-06 08:58:36 +00:00
bChanged = true;
}
}
if( rItem.QueryValue( aValue, MID_FONT_STYLE_NAME ))
{
2003-11-14 09:48:14 +00:00
if( aValue != GetPropertySet()->getPropertyValue( C2U( "CharFontStyleName" ) + aPostfix ))
2003-10-06 08:58:36 +00:00
{
2003-11-14 09:48:14 +00:00
GetPropertySet()->setPropertyValue( C2U( "CharFontStyleName" ) + aPostfix, aValue );
2003-10-06 08:58:36 +00:00
bChanged = true;
}
}
if( rItem.QueryValue( aValue, MID_FONT_CHAR_SET ))
{
2003-11-14 09:48:14 +00:00
if( aValue != GetPropertySet()->getPropertyValue( C2U( "CharFontCharSet" ) + aPostfix ))
2003-10-06 08:58:36 +00:00
{
2003-11-14 09:48:14 +00:00
GetPropertySet()->setPropertyValue( C2U( "CharFontCharSet" ) + aPostfix, aValue );
2003-10-06 08:58:36 +00:00
bChanged = true;
}
}
if( rItem.QueryValue( aValue, MID_FONT_PITCH ))
{
2003-11-14 09:48:14 +00:00
if( aValue != GetPropertySet()->getPropertyValue( C2U( "CharFontPitch" ) + aPostfix ))
2003-10-06 08:58:36 +00:00
{
2003-11-14 09:48:14 +00:00
GetPropertySet()->setPropertyValue( C2U( "CharFontPitch" ) + aPostfix, aValue );
2003-10-06 08:58:36 +00:00
bChanged = true;
}
}
}
break;
case EE_CHAR_UNDERLINE:
{
const SvxUnderlineItem & rItem =
static_cast< const SvxUnderlineItem & >(
2003-10-06 08:58:36 +00:00
rItemSet.Get( nWhichId ));
if( rItem.QueryValue( aValue, MID_TL_STYLE ))
2003-10-06 08:58:36 +00:00
{
if( aValue != GetPropertySet()->getPropertyValue( C2U( "CharUnderline" ) ))
{
GetPropertySet()->setPropertyValue( C2U( "CharUnderline" ), aValue );
bChanged = true;
}
}
if( rItem.QueryValue( aValue, MID_TL_COLOR ))
2003-10-06 08:58:36 +00:00
{
if( aValue != GetPropertySet()->getPropertyValue( C2U( "CharUnderlineColor" ) ))
{
GetPropertySet()->setPropertyValue( C2U( "CharUnderlineColor" ), aValue );
bChanged = true;
}
}
if( rItem.QueryValue( aValue, MID_TL_HASCOLOR ))
2003-10-06 08:58:36 +00:00
{
if( aValue != GetPropertySet()->getPropertyValue( C2U( "CharUnderlineHasColor" ) ))
{
GetPropertySet()->setPropertyValue( C2U( "CharUnderlineHasColor" ), aValue );
bChanged = true;
}
}
}
break;
case EE_CHAR_ITALIC:
2003-11-14 09:48:14 +00:00
case EE_CHAR_ITALIC_CJK:
case EE_CHAR_ITALIC_CTL:
2003-10-06 08:58:36 +00:00
{
2003-11-14 09:48:14 +00:00
::rtl::OUString aPostfix;
if( nWhichId == EE_CHAR_ITALIC_CJK )
aPostfix = C2U( "Asian" );
else if( nWhichId == EE_CHAR_ITALIC_CTL )
aPostfix = C2U( "Complex" );
2003-10-06 08:58:36 +00:00
const SvxPostureItem & rItem =
static_cast< const SvxPostureItem & >(
2003-10-06 08:58:36 +00:00
rItemSet.Get( nWhichId ));
if( rItem.QueryValue( aValue, MID_POSTURE ))
{
2003-11-14 09:48:14 +00:00
if( aValue != GetPropertySet()->getPropertyValue( C2U( "CharPosture" ) + aPostfix))
2003-10-06 08:58:36 +00:00
{
2003-11-14 09:48:14 +00:00
GetPropertySet()->setPropertyValue( C2U( "CharPosture" ) + aPostfix, aValue );
2003-10-06 08:58:36 +00:00
bChanged = true;
}
}
}
break;
case EE_CHAR_WEIGHT:
2003-11-14 09:48:14 +00:00
case EE_CHAR_WEIGHT_CJK:
case EE_CHAR_WEIGHT_CTL:
2003-10-06 08:58:36 +00:00
{
2003-11-14 09:48:14 +00:00
::rtl::OUString aPostfix;
if( nWhichId == EE_CHAR_WEIGHT_CJK )
aPostfix = C2U( "Asian" );
else if( nWhichId == EE_CHAR_WEIGHT_CTL )
aPostfix = C2U( "Complex" );
2003-10-06 08:58:36 +00:00
const SvxWeightItem & rItem =
static_cast< const SvxWeightItem & >(
2003-10-06 08:58:36 +00:00
rItemSet.Get( nWhichId ));
if( rItem.QueryValue( aValue, MID_WEIGHT ))
{
2003-11-14 09:48:14 +00:00
if( aValue != GetPropertySet()->getPropertyValue( C2U( "CharWeight" ) + aPostfix))
2003-10-06 08:58:36 +00:00
{
2003-11-14 09:48:14 +00:00
GetPropertySet()->setPropertyValue( C2U( "CharWeight" ) + aPostfix, aValue );
2003-10-06 08:58:36 +00:00
bChanged = true;
}
}
}
break;
case EE_CHAR_FONTHEIGHT:
case EE_CHAR_FONTHEIGHT_CJK:
case EE_CHAR_FONTHEIGHT_CTL:
{
::rtl::OUString aPostfix;
if( nWhichId == EE_CHAR_FONTHEIGHT_CJK )
aPostfix = C2U( "Asian" );
else if( nWhichId == EE_CHAR_FONTHEIGHT_CTL )
aPostfix = C2U( "Complex" );
const SvxFontHeightItem & rItem =
static_cast< const SvxFontHeightItem & >(
rItemSet.Get( nWhichId ));
try
{
if( rItem.QueryValue( aValue, MID_FONTHEIGHT ) )
{
bool bSetValue = false;
if( aValue != GetPropertySet()->getPropertyValue( C2U( "CharHeight" ) + aPostfix ))
bSetValue = true;
else
{
if( m_pRefSize.get() )
{
awt::Size aNewRefSize = *m_pRefSize;
awt::Size aOldRefSize;
if( GetRefSizePropertySet()->getPropertyValue( m_aRefSizePropertyName ) >>= aOldRefSize )
{
if( aNewRefSize.Width != aOldRefSize.Width
|| aNewRefSize.Height != aOldRefSize.Height )
bSetValue = true;
}
}
}
if( bSetValue )
{
// set new reference size only if there was a reference size before (auto-scaling on)
if( m_pRefSize.get() &&
GetRefSizePropertySet()->getPropertyValue( m_aRefSizePropertyName ).hasValue())
{
GetRefSizePropertySet()->setPropertyValue( m_aRefSizePropertyName,
uno::makeAny( *m_pRefSize ));
}
GetPropertySet()->setPropertyValue( C2U( "CharHeight" ) + aPostfix, aValue );
bChanged = true;
}
}
}
catch( uno::Exception & ex )
{
ASSERT_EXCEPTION( ex );
}
}
break;
2003-10-06 08:58:36 +00:00
}
return bChanged;
}
uno::Reference< beans::XPropertySet >
CharacterPropertyItemConverter::GetRefSizePropertySet() const
{
return m_xRefSizePropSet;
}
2003-10-06 08:58:36 +00:00
} // namespace wrapper
} // namespace chart