LCOV - code coverage report
Current view: top level - libreoffice/chart2/source/tools - CharacterProperties.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 154 187 82.4 %
Date: 2012-12-27 Functions: 2 4 50.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             : 
      20             : #include "CharacterProperties.hxx"
      21             : #include "ContainerHelper.hxx"
      22             : #include "macros.hxx"
      23             : 
      24             : #include <com/sun/star/beans/PropertyAttribute.hpp>
      25             : #include <com/sun/star/style/XStyle.hpp>
      26             : #include <com/sun/star/awt/FontSlant.hpp>
      27             : #include <com/sun/star/lang/Locale.hpp>
      28             : 
      29             : #include <com/sun/star/awt/FontFamily.hpp>
      30             : #include <com/sun/star/awt/CharSet.hpp>
      31             : #include <com/sun/star/awt/FontPitch.hpp>
      32             : #include <com/sun/star/awt/FontUnderline.hpp>
      33             : #include <com/sun/star/awt/FontWeight.hpp>
      34             : #include <com/sun/star/style/CaseMap.hpp>
      35             : #include <com/sun/star/text/FontRelief.hpp>
      36             : #include <com/sun/star/text/FontEmphasis.hpp>
      37             : #include <com/sun/star/text/RubyAdjust.hpp>
      38             : #include <com/sun/star/awt/FontStrikeout.hpp>
      39             : #include <com/sun/star/text/WritingMode2.hpp>
      40             : #include <com/sun/star/i18n/ScriptType.hpp>
      41             : 
      42             : #include <comphelper/InlineContainer.hxx>
      43             : 
      44             : 
      45             : // header for struct SvtLinguConfig
      46             : #include <unotools/lingucfg.hxx>
      47             : #include <i18npool/mslangid.hxx>
      48             : #include <i18npool/languagetag.hxx>
      49             : #include <vcl/outdev.hxx>
      50             : 
      51             : using namespace ::com::sun::star;
      52             : 
      53             : using ::com::sun::star::beans::Property;
      54             : 
      55             : using ::rtl::OUString;
      56             : 
      57             : namespace chart
      58             : {
      59             : 
      60           5 : void CharacterProperties::AddPropertiesToVector(
      61             :     ::std::vector< Property > & rOutProperties )
      62             : {
      63             :     // CharacterProperties
      64             :     rOutProperties.push_back(
      65             :         Property( C2U( "CharFontName" ),
      66             :                   PROP_CHAR_FONT_NAME,
      67           5 :                   ::getCppuType( reinterpret_cast< const OUString * >(0)),
      68             :                   beans::PropertyAttribute::BOUND
      69          10 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
      70             :     rOutProperties.push_back(
      71             :         Property( C2U( "CharFontStyleName" ),
      72             :                   PROP_CHAR_FONT_STYLE_NAME,
      73           5 :                   ::getCppuType( reinterpret_cast< const  OUString * >(0)),
      74             :                   beans::PropertyAttribute::BOUND
      75             :                   | beans::PropertyAttribute::MAYBEDEFAULT
      76          10 :                   | beans::PropertyAttribute::MAYBEVOID ));
      77             :     // CharFontFamily (see awt.FontFamily)
      78             :     rOutProperties.push_back(
      79             :         Property( C2U( "CharFontFamily" ),
      80             :                   PROP_CHAR_FONT_FAMILY,
      81           5 :                   ::getCppuType( reinterpret_cast< const  sal_Int16 * >(0)),
      82             :                   beans::PropertyAttribute::BOUND
      83          10 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
      84             :     // CharFontCharSet (see awt.CharSet)
      85             :     rOutProperties.push_back(
      86             :         Property( C2U( "CharFontCharSet" ),
      87             :                   PROP_CHAR_FONT_CHAR_SET,
      88           5 :                   ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
      89             :                   beans::PropertyAttribute::BOUND
      90          10 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
      91             :     // CharFontPitch (see awt.FontPitch)
      92             :     rOutProperties.push_back(
      93             :         Property( C2U( "CharFontPitch" ),
      94             :                   PROP_CHAR_FONT_PITCH,
      95           5 :                   ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
      96             :                   beans::PropertyAttribute::BOUND
      97          10 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
      98             :     // CharColor
      99             :     rOutProperties.push_back(
     100             :         Property( C2U( "CharColor" ),
     101             :                   PROP_CHAR_COLOR,
     102           5 :                   ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
     103             :                   beans::PropertyAttribute::BOUND
     104          10 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
     105             :     // CharEscapement
     106             :     rOutProperties.push_back(
     107             :         Property( C2U( "CharEscapement" ),
     108             :                   PROP_CHAR_ESCAPEMENT,
     109           5 :                   ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
     110             :                   beans::PropertyAttribute::BOUND
     111          10 :                   | beans::PropertyAttribute::MAYBEVOID ));
     112             :     // CharHeight
     113             :     rOutProperties.push_back(
     114             :         Property( C2U( "CharHeight" ),
     115             :                   PROP_CHAR_CHAR_HEIGHT,
     116           5 :                   ::getCppuType( reinterpret_cast< const float * >(0)),
     117             :                   beans::PropertyAttribute::BOUND
     118          10 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
     119             :     // CharUnderline (see awt.FontUnderline)
     120             :     rOutProperties.push_back(
     121             :         Property( C2U( "CharUnderline" ),
     122             :                   PROP_CHAR_UNDERLINE,
     123           5 :                   ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
     124             :                   beans::PropertyAttribute::BOUND
     125          10 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
     126             :     // CharUnderlineColor
     127             :     rOutProperties.push_back(
     128             :         Property( C2U( "CharUnderlineColor" ),
     129             :                   PROP_CHAR_UNDERLINE_COLOR,
     130           5 :                   ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
     131             :                   beans::PropertyAttribute::BOUND
     132             :                   | beans::PropertyAttribute::MAYBEDEFAULT
     133          10 :                   | beans::PropertyAttribute::MAYBEVOID ));
     134             :     // CharUnderlineHasColor
     135             :     rOutProperties.push_back(
     136             :         Property( C2U( "CharUnderlineHasColor" ),
     137             :                   PROP_CHAR_UNDERLINE_HAS_COLOR,
     138           5 :                   ::getBooleanCppuType(),
     139             :                   beans::PropertyAttribute::BOUND
     140          10 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
     141             :     // CharOverline (see awt.FontUnderline)
     142             :     rOutProperties.push_back(
     143             :         Property( C2U( "CharOverline" ),
     144             :                   PROP_CHAR_OVERLINE,
     145           5 :                   ::getCppuType( reinterpret_cast< const sal_Int16* >( 0 ) ),
     146             :                   beans::PropertyAttribute::BOUND
     147          10 :                   | beans::PropertyAttribute::MAYBEDEFAULT ) );
     148             :     // CharOverlineColor
     149             :     rOutProperties.push_back(
     150             :         Property( C2U( "CharOverlineColor" ),
     151             :                   PROP_CHAR_OVERLINE_COLOR,
     152           5 :                   ::getCppuType( reinterpret_cast< const sal_Int32* >( 0 ) ),
     153             :                   beans::PropertyAttribute::BOUND
     154             :                   | beans::PropertyAttribute::MAYBEDEFAULT
     155          10 :                   | beans::PropertyAttribute::MAYBEVOID ) );
     156             :     // CharOverlineHasColor
     157             :     rOutProperties.push_back(
     158             :         Property( C2U( "CharOverlineHasColor" ),
     159             :                   PROP_CHAR_OVERLINE_HAS_COLOR,
     160           5 :                   ::getBooleanCppuType(),
     161             :                   beans::PropertyAttribute::BOUND
     162          10 :                   | beans::PropertyAttribute::MAYBEDEFAULT ) );
     163             :     // CharWeight (see awt.FontWeight)
     164             :     rOutProperties.push_back(
     165             :         Property( C2U( "CharWeight" ),
     166             :                   PROP_CHAR_WEIGHT,
     167           5 :                   ::getCppuType( reinterpret_cast< const float * >(0)),
     168             :                   beans::PropertyAttribute::BOUND
     169          10 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
     170             :     // CharPosture
     171             :     rOutProperties.push_back(
     172             :         Property( C2U( "CharPosture" ),
     173             :                   PROP_CHAR_POSTURE,
     174           5 :                   ::getCppuType( reinterpret_cast< const awt::FontSlant * >(0)),
     175             :                   beans::PropertyAttribute::BOUND
     176          10 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
     177             :     rOutProperties.push_back(
     178             :         Property( C2U( "CharAutoKerning" ),
     179             :                   PROP_CHAR_AUTO_KERNING,
     180           5 :                   ::getBooleanCppuType(),
     181             :                   beans::PropertyAttribute::BOUND
     182             :                   | beans::PropertyAttribute::MAYBEDEFAULT
     183          10 :                   | beans::PropertyAttribute::MAYBEVOID ));
     184             :     rOutProperties.push_back(
     185             :         Property( C2U( "CharKerning" ),
     186             :                   PROP_CHAR_KERNING,
     187           5 :                   ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
     188             :                   beans::PropertyAttribute::BOUND
     189             :                   | beans::PropertyAttribute::MAYBEDEFAULT
     190          10 :                   | beans::PropertyAttribute::MAYBEVOID ));
     191             :     // CharEscapementHeight
     192             :     rOutProperties.push_back(
     193             :         Property( C2U( "CharEscapementHeight" ),
     194             :                   PROP_CHAR_ESCAPEMENT_HEIGHT,
     195           5 :                   ::getCppuType( reinterpret_cast< const sal_Int8 * >(0)),
     196             :                   beans::PropertyAttribute::BOUND
     197          10 :                   | beans::PropertyAttribute::MAYBEVOID ));
     198             :     // CharStrikeout (see awt.FontStrikeout)
     199             :     rOutProperties.push_back(
     200             :         Property( C2U( "CharStrikeout" ),
     201             :                   PROP_CHAR_STRIKE_OUT,
     202           5 :                   ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
     203             :                   beans::PropertyAttribute::BOUND
     204          10 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
     205             :     // CharWordMode
     206             :     rOutProperties.push_back(
     207             :         Property( C2U( "CharWordMode" ),
     208             :                   PROP_CHAR_WORD_MODE,
     209           5 :                   ::getBooleanCppuType(),
     210             :                   beans::PropertyAttribute::BOUND
     211          10 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
     212             :     // CharLocale
     213             :     rOutProperties.push_back(
     214             :         Property( C2U( "CharLocale" ),
     215             :                   PROP_CHAR_LOCALE,
     216           5 :                   ::getCppuType( reinterpret_cast< const lang::Locale * >(0)),
     217             :                   //#i111967# no PropertyChangeEvent is fired on change so far
     218           5 :                   beans::PropertyAttribute::MAYBEDEFAULT ));
     219             :     // CharShadowed
     220             :     rOutProperties.push_back(
     221             :         Property( C2U( "CharShadowed" ),
     222             :                   PROP_CHAR_SHADOWED,
     223           5 :                   ::getBooleanCppuType(),
     224             :                   beans::PropertyAttribute::BOUND
     225          10 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
     226             :     // CharContoured
     227             :     rOutProperties.push_back(
     228             :         Property( C2U( "CharContoured" ),
     229             :                   PROP_CHAR_CONTOURED,
     230           5 :                   ::getBooleanCppuType(),
     231             :                   beans::PropertyAttribute::BOUND
     232          10 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
     233             :     // CharRelief (see text.FontRelief)
     234             :     rOutProperties.push_back(
     235             :         Property( C2U( "CharRelief" ),
     236             :                   PROP_CHAR_RELIEF,
     237           5 :                   ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
     238             :                   beans::PropertyAttribute::BOUND
     239          10 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
     240             : 
     241             :     // CharEmphasize (see text.FontEmphasis)
     242             :     rOutProperties.push_back(
     243             :         Property( C2U( "CharEmphasis" ),
     244             :                   PROP_CHAR_EMPHASIS,
     245           5 :                   ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
     246             :                   beans::PropertyAttribute::BOUND
     247          10 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
     248             :     // CharacterPropertiesAsian
     249             :     // =====
     250             :     // CharFontNameAsian
     251             :     rOutProperties.push_back(
     252             :         Property( C2U( "CharFontNameAsian" ),
     253             :                   PROP_CHAR_ASIAN_FONT_NAME,
     254           5 :                   ::getCppuType( reinterpret_cast< const OUString * >(0)),
     255             :                   beans::PropertyAttribute::BOUND
     256          10 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
     257             :     // CharFontStyleNameAsian
     258             :     rOutProperties.push_back(
     259             :         Property( C2U( "CharFontStyleNameAsian" ),
     260             :                   PROP_CHAR_ASIAN_FONT_STYLE_NAME,
     261           5 :                   ::getCppuType( reinterpret_cast< const OUString * >(0)),
     262             :                   beans::PropertyAttribute::BOUND
     263             :                   | beans::PropertyAttribute::MAYBEDEFAULT
     264          10 :                   | beans::PropertyAttribute::MAYBEVOID ));
     265             :     // CharFontFamilyAsian (see awt.FontFamily)
     266             :     rOutProperties.push_back(
     267             :         Property( C2U( "CharFontFamilyAsian" ),
     268             :                   PROP_CHAR_ASIAN_FONT_FAMILY,
     269           5 :                   ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
     270             :                   beans::PropertyAttribute::BOUND
     271          10 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
     272             :     // CharFontCharSetAsian (see awt.CharSet)
     273             :     rOutProperties.push_back(
     274             :         Property( C2U( "CharFontCharSetAsian" ),
     275             :                   PROP_CHAR_ASIAN_CHAR_SET,
     276           5 :                   ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
     277             :                   beans::PropertyAttribute::BOUND
     278          10 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
     279             :     // CharFontPitchAsian (see awt.FontPitch)
     280             :     rOutProperties.push_back(
     281             :         Property( C2U( "CharFontPitchAsian" ),
     282             :                   PROP_CHAR_ASIAN_FONT_PITCH,
     283           5 :                   ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
     284             :                   beans::PropertyAttribute::BOUND
     285          10 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
     286             :     // CharHeightAsian
     287             :     rOutProperties.push_back(
     288             :         Property( C2U( "CharHeightAsian" ),
     289             :                   PROP_CHAR_ASIAN_CHAR_HEIGHT,
     290           5 :                   ::getCppuType( reinterpret_cast< const float * >(0)),
     291             :                   beans::PropertyAttribute::BOUND
     292          10 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
     293             :     // CharWeightAsian
     294             :     rOutProperties.push_back(
     295             :         Property( C2U( "CharWeightAsian" ),
     296             :                   PROP_CHAR_ASIAN_WEIGHT,
     297           5 :                   ::getCppuType( reinterpret_cast< const float * >(0)),
     298             :                   beans::PropertyAttribute::BOUND
     299          10 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
     300             :     // CharPostureAsian
     301             :     rOutProperties.push_back(
     302             :         Property( C2U( "CharPostureAsian" ),
     303             :                   PROP_CHAR_ASIAN_POSTURE,
     304           5 :                   ::getCppuType( reinterpret_cast< const awt::FontSlant * >(0)),
     305             :                   beans::PropertyAttribute::BOUND
     306          10 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
     307             :     // CharLocaleAsian
     308             :     rOutProperties.push_back(
     309             :         Property( C2U( "CharLocaleAsian" ),
     310             :                   PROP_CHAR_ASIAN_LOCALE,
     311           5 :                   ::getCppuType( reinterpret_cast< const lang::Locale * >(0)),
     312             :                   //#i111967# no PropertyChangeEvent is fired on change so far
     313           5 :                   beans::PropertyAttribute::MAYBEDEFAULT ));
     314             : 
     315             :     // CharacterPropertiesComplex
     316             :     // ===
     317             :     // CharFontNameComplex
     318             :     rOutProperties.push_back(
     319             :         Property( C2U( "CharFontNameComplex" ),
     320             :                   PROP_CHAR_COMPLEX_FONT_NAME,
     321           5 :                   ::getCppuType( reinterpret_cast< const OUString * >(0)),
     322             :                   beans::PropertyAttribute::BOUND
     323          10 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
     324             :     // CharFontStyleNameComplex
     325             :     rOutProperties.push_back(
     326             :         Property( C2U( "CharFontStyleNameComplex" ),
     327             :                   PROP_CHAR_COMPLEX_FONT_STYLE_NAME,
     328           5 :                   ::getCppuType( reinterpret_cast< const OUString * >(0)),
     329             :                   beans::PropertyAttribute::BOUND
     330             :                   | beans::PropertyAttribute::MAYBEDEFAULT
     331          10 :                   | beans::PropertyAttribute::MAYBEVOID ));
     332             :     // CharFontFamilyComplex (see awt.FontFamily)
     333             :     rOutProperties.push_back(
     334             :         Property( C2U( "CharFontFamilyComplex" ),
     335             :                   PROP_CHAR_COMPLEX_FONT_FAMILY,
     336           5 :                   ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
     337             :                   beans::PropertyAttribute::BOUND
     338          10 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
     339             :     // CharFontCharSetComplex (see awt.CharSet)
     340             :     rOutProperties.push_back(
     341             :         Property( C2U( "CharFontCharSetComplex" ),
     342             :                   PROP_CHAR_COMPLEX_CHAR_SET,
     343           5 :                   ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
     344             :                   beans::PropertyAttribute::BOUND
     345          10 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
     346             :     // CharFontPitchComplex (see awt.FontPitch)
     347             :     rOutProperties.push_back(
     348             :         Property( C2U( "CharFontPitchComplex" ),
     349             :                   PROP_CHAR_COMPLEX_FONT_PITCH,
     350           5 :                   ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
     351             :                   beans::PropertyAttribute::BOUND
     352          10 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
     353             :     // CharHeightComplex
     354             :     rOutProperties.push_back(
     355             :         Property( C2U( "CharHeightComplex" ),
     356             :                   PROP_CHAR_COMPLEX_CHAR_HEIGHT,
     357           5 :                   ::getCppuType( reinterpret_cast< const float * >(0)),
     358             :                   beans::PropertyAttribute::BOUND
     359          10 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
     360             :     // CharWeightComplex
     361             :     rOutProperties.push_back(
     362             :         Property( C2U( "CharWeightComplex" ),
     363             :                   PROP_CHAR_COMPLEX_WEIGHT,
     364           5 :                   ::getCppuType( reinterpret_cast< const float * >(0)),
     365             :                   beans::PropertyAttribute::BOUND
     366          10 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
     367             :     // CharPostureComplex
     368             :     rOutProperties.push_back(
     369             :         Property( C2U( "CharPostureComplex" ),
     370             :                   PROP_CHAR_COMPLEX_POSTURE,
     371           5 :                   ::getCppuType( reinterpret_cast< const awt::FontSlant * >(0)),
     372             :                   beans::PropertyAttribute::BOUND
     373          10 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
     374             :     // CharLocaleComplex
     375             :     rOutProperties.push_back(
     376             :         Property( C2U( "CharLocaleComplex" ),
     377             :                   PROP_CHAR_COMPLEX_LOCALE,
     378           5 :                   ::getCppuType( reinterpret_cast< const lang::Locale * >(0)),
     379             :                   //#i111967# no PropertyChangeEvent is fired on change so far
     380           5 :                   beans::PropertyAttribute::MAYBEDEFAULT ));
     381             : 
     382             :     // Writing Mode left to right vs right to left
     383             :     rOutProperties.push_back(
     384             :         Property( C2U( "WritingMode" ),
     385             :                   PROP_WRITING_MODE,
     386           5 :                   ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)), /*com::sun::star::text::WritingMode2*/
     387             :                   beans::PropertyAttribute::BOUND
     388          10 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
     389             : 
     390             :     rOutProperties.push_back(
     391             :         Property( C2U( "ParaIsCharacterDistance" ),
     392             :                   PROP_PARA_IS_CHARACTER_DISTANCE,
     393           5 :                   ::getBooleanCppuType(),
     394             :                   beans::PropertyAttribute::BOUND
     395          10 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
     396           5 : }
     397             : 
     398           4 : void CharacterProperties::AddDefaultsToMap(
     399             :     ::chart::tPropertyValueMap & rOutMap )
     400             : {
     401           4 :     const float fDefaultFontHeight = 13.0;
     402             : 
     403           4 :     SvtLinguConfig aLinguConfig;
     404           4 :     lang::Locale aDefaultLocale;
     405           4 :     aLinguConfig.GetProperty(C2U("DefaultLocale")) >>= aDefaultLocale;
     406           4 :     lang::Locale aDefaultLocale_CJK;
     407           4 :     aLinguConfig.GetProperty(C2U("DefaultLocale_CJK")) >>= aDefaultLocale_CJK;
     408           4 :     lang::Locale aDefaultLocale_CTL;
     409           4 :     aLinguConfig.GetProperty(C2U("DefaultLocale_CTL")) >>= aDefaultLocale_CTL;
     410             : 
     411             :     using namespace ::com::sun::star::i18n::ScriptType;
     412             :     LanguageType nLang;
     413           4 :     nLang = MsLangId::resolveSystemLanguageByScriptType(LanguageTag(aDefaultLocale).getLanguageType( false), LATIN);
     414           4 :     Font aFont = OutputDevice::GetDefaultFont( DEFAULTFONT_LATIN_SPREADSHEET, nLang, DEFAULTFONT_FLAGS_ONLYONE, 0 );
     415           4 :     nLang = MsLangId::resolveSystemLanguageByScriptType(LanguageTag( aDefaultLocale_CJK).getLanguageType( false), ASIAN);
     416           4 :     Font aFontCJK = OutputDevice::GetDefaultFont( DEFAULTFONT_CJK_SPREADSHEET, nLang, DEFAULTFONT_FLAGS_ONLYONE, 0 );
     417           4 :     nLang = MsLangId::resolveSystemLanguageByScriptType(LanguageTag( aDefaultLocale_CTL).getLanguageType( false), COMPLEX);
     418           4 :     Font aFontCTL = OutputDevice::GetDefaultFont( DEFAULTFONT_CTL_SPREADSHEET, nLang, DEFAULTFONT_FLAGS_ONLYONE, 0 );
     419             : 
     420           4 :     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_FONT_NAME, OUString( aFont.GetName() ) );
     421           4 :     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_FONT_STYLE_NAME, OUString(aFont.GetStyleName()) );
     422           4 :     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_FONT_FAMILY, sal_Int16(aFont.GetFamily()) );//awt::FontFamily::SWISS
     423           4 :     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_FONT_CHAR_SET, sal_Int16(aFont.GetCharSet()) );//use awt::CharSet::DONTKNOW instead of SYSTEM to avoid assertion issue 50249
     424           4 :     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_FONT_PITCH, sal_Int16(aFont.GetPitch()) );//awt::FontPitch::VARIABLE
     425           4 :     ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_CHAR_COLOR, -1 ); //automatic color (COL_AUTO)
     426           4 :     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_CHAR_HEIGHT, fDefaultFontHeight );
     427           4 :     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_UNDERLINE, awt::FontUnderline::NONE );
     428           4 :     ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_CHAR_UNDERLINE_COLOR, -1 ); //automatic color (COL_AUTO)
     429           4 :     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_UNDERLINE_HAS_COLOR, false );
     430           4 :     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_OVERLINE, awt::FontUnderline::NONE );
     431           4 :     ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_CHAR_OVERLINE_COLOR, -1 ); //automatic color (COL_AUTO)
     432           4 :     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_OVERLINE_HAS_COLOR, false );
     433           4 :     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_WEIGHT, awt::FontWeight::NORMAL );
     434           4 :     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_POSTURE, awt::FontSlant_NONE );
     435           4 :     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_AUTO_KERNING, true );
     436           4 :     ::chart::PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, PROP_CHAR_KERNING, 0 );
     437           4 :     ::chart::PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, PROP_CHAR_STRIKE_OUT, awt::FontStrikeout::NONE );
     438           4 :     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_WORD_MODE, false );
     439           4 :     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_LOCALE, aDefaultLocale );
     440           4 :     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_SHADOWED, false );
     441           4 :     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_CONTOURED, false );
     442           4 :     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_RELIEF, text::FontRelief::NONE );
     443           4 :     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_EMPHASIS, text::FontEmphasis::NONE );
     444             : 
     445             :     // Asian (com.sun.star.style.CharacterPropertiesAsian)
     446           4 :     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_ASIAN_CHAR_HEIGHT, fDefaultFontHeight );
     447           4 :     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_ASIAN_WEIGHT, awt::FontWeight::NORMAL );
     448           4 :     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_ASIAN_POSTURE, awt::FontSlant_NONE );
     449           4 :     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_ASIAN_LOCALE, aDefaultLocale_CJK );
     450           4 :     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_ASIAN_FONT_NAME, OUString( aFontCJK.GetName() ) );
     451           4 :     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_ASIAN_FONT_STYLE_NAME, OUString(aFontCJK.GetStyleName()) );
     452           4 :     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_ASIAN_FONT_FAMILY, sal_Int16(aFontCJK.GetFamily()) );
     453           4 :     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_ASIAN_CHAR_SET, sal_Int16(aFontCJK.GetCharSet()) );
     454           4 :     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_ASIAN_FONT_PITCH, sal_Int16(aFontCJK.GetPitch()) );
     455             : 
     456             :     // Complex Text Layout (com.sun.star.style.CharacterPropertiesComplex)
     457           4 :     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_COMPLEX_CHAR_HEIGHT, fDefaultFontHeight );
     458           4 :     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_COMPLEX_WEIGHT, awt::FontWeight::NORMAL );
     459           4 :     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_COMPLEX_POSTURE, awt::FontSlant_NONE );
     460           4 :     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_COMPLEX_LOCALE, aDefaultLocale_CTL );
     461           4 :     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_COMPLEX_FONT_NAME, OUString( aFontCTL.GetName() ) );
     462           4 :     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_COMPLEX_FONT_STYLE_NAME, OUString(aFontCTL.GetStyleName()) );
     463           4 :     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_COMPLEX_FONT_FAMILY, sal_Int16(aFontCTL.GetFamily()) );
     464           4 :     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_COMPLEX_CHAR_SET, sal_Int16(aFontCTL.GetCharSet()) );
     465           4 :     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_COMPLEX_FONT_PITCH, sal_Int16(aFontCTL.GetPitch()) );
     466             : 
     467           4 :     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_WRITING_MODE, sal_Int16( com::sun::star::text::WritingMode2::PAGE ) );
     468           4 :     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_PARA_IS_CHARACTER_DISTANCE, sal_True );
     469           4 : }
     470             : 
     471           0 : bool CharacterProperties::IsCharacterPropertyHandle( sal_Int32 nHandle )
     472             : {
     473             :     return ( FAST_PROPERTY_ID_START_CHAR_PROP <= nHandle &&
     474           0 :              nHandle < CharacterProperties::FAST_PROPERTY_ID_END_CHAR_PROP );
     475             : }
     476             : 
     477           0 : awt::FontDescriptor CharacterProperties::createFontDescriptorFromPropertySet(
     478             :     const uno::Reference< beans::XMultiPropertySet > & xMultiPropSet )
     479             : {
     480           0 :     awt::FontDescriptor aResult;
     481             :     // Note: keep this sorted!
     482             :     ::comphelper::MakeVector< OUString > aPropNames
     483           0 :         ( C2U("CharFontCharSet"));                // CharSet
     484             :     aPropNames
     485           0 :         ( C2U("CharFontFamily"))                  // Family
     486           0 :         ( C2U("CharFontName"))                    // Name
     487           0 :         ( C2U("CharFontPitch"))                   // Pitch
     488           0 :         ( C2U("CharFontStyleName"))               // StyleName
     489           0 :         ( C2U("CharHeight"))                      // Height
     490           0 :         ( C2U("CharPosture"))                     // Slant
     491           0 :         ( C2U("CharStrikeout"))                   // Strikeout
     492           0 :         ( C2U("CharUnderline"))                   // Underline
     493           0 :         ( C2U("CharWeight"))                      // Weight
     494           0 :         ( C2U("CharWordMode"))                    // WordLineMode
     495           0 :         ;
     496             : 
     497           0 :     uno::Sequence< OUString > aPropNameSeq( ContainerHelper::ContainerToSequence( aPropNames ));
     498           0 :     uno::Sequence< uno::Any > aValues( xMultiPropSet->getPropertyValues( aPropNameSeq ));
     499             : 
     500           0 :     sal_Int32 i=0;
     501             :     // Note keep this sorted according to the list above (comments are the fieldnames)
     502           0 :     aValues[ i++ ]  >>= aResult.CharSet;
     503           0 :     aValues[ i++ ]  >>= aResult.Family;
     504           0 :     aValues[ i++ ]  >>= aResult.Name;
     505           0 :     aValues[ i++ ]  >>= aResult.Pitch;
     506           0 :     aValues[ i++ ]  >>= aResult.StyleName;
     507           0 :     float fCharHeight = 0;
     508           0 :     aValues[ i++ ]  >>= fCharHeight;
     509           0 :     aResult.Height = static_cast< sal_Int16 >( fCharHeight );
     510           0 :     aValues[ i++ ]  >>= aResult.Slant;
     511           0 :     aValues[ i++ ]  >>= aResult.Strikeout;
     512           0 :     aValues[ i++ ]  >>= aResult.Underline;
     513           0 :     aValues[ i++ ]  >>= aResult.Weight;
     514           0 :     aValues[ i++ ]  >>= aResult.WordLineMode;
     515             :     OSL_ASSERT( i == aValues.getLength());
     516             : 
     517           0 :     return aResult;
     518             : }
     519             : 
     520             : } //  namespace chart
     521             : 
     522             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10