1190118d0SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3190118d0SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4190118d0SAndrew Rist * or more contributor license agreements. See the NOTICE file 5190118d0SAndrew Rist * distributed with this work for additional information 6190118d0SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7190118d0SAndrew Rist * to you under the Apache License, Version 2.0 (the 8190118d0SAndrew Rist * "License"); you may not use this file except in compliance 9190118d0SAndrew Rist * with the License. You may obtain a copy of the License at 10190118d0SAndrew Rist * 11190118d0SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12190118d0SAndrew Rist * 13190118d0SAndrew Rist * Unless required by applicable law or agreed to in writing, 14190118d0SAndrew Rist * software distributed under the License is distributed on an 15190118d0SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16190118d0SAndrew Rist * KIND, either express or implied. See the License for the 17190118d0SAndrew Rist * specific language governing permissions and limitations 18190118d0SAndrew Rist * under the License. 19190118d0SAndrew Rist * 20190118d0SAndrew Rist *************************************************************/ 21190118d0SAndrew Rist 22190118d0SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_editeng.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir // include --------------------------------------------------------------- 28cdf0e10cSrcweir #include <com/sun/star/style/CaseMap.hpp> 29cdf0e10cSrcweir #include <com/sun/star/awt/FontDescriptor.hpp> 30cdf0e10cSrcweir #include <com/sun/star/frame/status/FontHeight.hpp> 31cdf0e10cSrcweir #include <vcl/bitmapex.hxx> 32cdf0e10cSrcweir #include <tools/stream.hxx> 33cdf0e10cSrcweir #include <toolkit/unohlp.hxx> 34cdf0e10cSrcweir #include <math.h> 35cdf0e10cSrcweir #include <rtl/math.hxx> 36cdf0e10cSrcweir #include <unotools/fontdefs.hxx> 37cdf0e10cSrcweir #include <vcl/outdev.hxx> 38cdf0e10cSrcweir #include <editeng/eeitem.hxx> 39cdf0e10cSrcweir #include <svtools/unitconv.hxx> 40cdf0e10cSrcweir 41cdf0e10cSrcweir #define GLOBALOVERFLOW3 42cdf0e10cSrcweir 43cdf0e10cSrcweir #include <svl/memberid.hrc> 44cdf0e10cSrcweir #include <editeng/editids.hrc> 45cdf0e10cSrcweir #include <editeng/editrids.hrc> 46cdf0e10cSrcweir #include <vcl/vclenum.hxx> 47cdf0e10cSrcweir #include <tools/bigint.hxx> 48cdf0e10cSrcweir #include <tools/tenccvt.hxx> 49cdf0e10cSrcweir 50cdf0e10cSrcweir #include <rtl/ustring.hxx> 51cdf0e10cSrcweir #include <i18npool/mslangid.hxx> 52cdf0e10cSrcweir #include <svl/itemset.hxx> 53cdf0e10cSrcweir 54cdf0e10cSrcweir #include <svtools/langtab.hxx> 55cdf0e10cSrcweir #include <svl/itempool.hxx> 56cdf0e10cSrcweir #include <svtools/ctrltool.hxx> 57cdf0e10cSrcweir #include <vcl/settings.hxx> 58cdf0e10cSrcweir #include <vcl/svapp.hxx> 59cdf0e10cSrcweir #include <com/sun/star/style/CaseMap.hpp> 60cdf0e10cSrcweir #include <com/sun/star/awt/SimpleFontMetric.hpp> 61cdf0e10cSrcweir #include <com/sun/star/awt/FontWeight.hpp> 62cdf0e10cSrcweir #include <com/sun/star/awt/FontSlant.hpp> 63cdf0e10cSrcweir #include <com/sun/star/awt/CharSet.hpp> 64cdf0e10cSrcweir #include <com/sun/star/awt/FontDescriptor.hpp> 65cdf0e10cSrcweir #include <com/sun/star/awt/FontWidth.hpp> 66cdf0e10cSrcweir #include <com/sun/star/awt/XFont.hpp> 67cdf0e10cSrcweir #include <com/sun/star/awt/FontType.hpp> 68cdf0e10cSrcweir #include <com/sun/star/awt/FontUnderline.hpp> 69cdf0e10cSrcweir #include <com/sun/star/awt/FontStrikeout.hpp> 70cdf0e10cSrcweir #include <com/sun/star/awt/FontFamily.hpp> 71cdf0e10cSrcweir #include <com/sun/star/awt/FontPitch.hpp> 72cdf0e10cSrcweir #include <com/sun/star/lang/Locale.hpp> 73cdf0e10cSrcweir #include <com/sun/star/text/FontEmphasis.hpp> 74cdf0e10cSrcweir #include <com/sun/star/i18n/ScriptType.hpp> 75cdf0e10cSrcweir #include <editeng/memberids.hrc> 76cdf0e10cSrcweir #include <editeng/flstitem.hxx> 77cdf0e10cSrcweir #include <editeng/fontitem.hxx> 78cdf0e10cSrcweir #include <editeng/postitem.hxx> 79cdf0e10cSrcweir #include <editeng/wghtitem.hxx> 80cdf0e10cSrcweir #include <editeng/fhgtitem.hxx> 81cdf0e10cSrcweir #include <editeng/fwdtitem.hxx> 82cdf0e10cSrcweir #include <editeng/udlnitem.hxx> 83cdf0e10cSrcweir #include <editeng/crsditem.hxx> 84cdf0e10cSrcweir #include <editeng/shdditem.hxx> 85cdf0e10cSrcweir #include <editeng/akrnitem.hxx> 86cdf0e10cSrcweir #include <editeng/wrlmitem.hxx> 87cdf0e10cSrcweir #include <editeng/cntritem.hxx> 88cdf0e10cSrcweir #include <editeng/prszitem.hxx> 89cdf0e10cSrcweir #include <editeng/colritem.hxx> 90cdf0e10cSrcweir #include <editeng/cscoitem.hxx> 91cdf0e10cSrcweir #include <editeng/kernitem.hxx> 92cdf0e10cSrcweir #include <editeng/cmapitem.hxx> 93cdf0e10cSrcweir #include <editeng/escpitem.hxx> 94cdf0e10cSrcweir #include <editeng/langitem.hxx> 95cdf0e10cSrcweir #include <editeng/nlbkitem.hxx> 96cdf0e10cSrcweir #include <editeng/nhypitem.hxx> 97cdf0e10cSrcweir #include <editeng/lcolitem.hxx> 98cdf0e10cSrcweir #include <editeng/blnkitem.hxx> 99cdf0e10cSrcweir #include <editeng/emphitem.hxx> 100cdf0e10cSrcweir #include <editeng/twolinesitem.hxx> 101cdf0e10cSrcweir #include <editeng/scripttypeitem.hxx> 102cdf0e10cSrcweir #include <editeng/charrotateitem.hxx> 103cdf0e10cSrcweir #include <editeng/charscaleitem.hxx> 104cdf0e10cSrcweir #include <editeng/charreliefitem.hxx> 105cdf0e10cSrcweir #include <editeng/itemtype.hxx> 106cdf0e10cSrcweir #include <editeng/eerdll.hxx> 107cdf0e10cSrcweir 108cdf0e10cSrcweir // #90477# 109cdf0e10cSrcweir #include <tools/tenccvt.hxx> 110cdf0e10cSrcweir 111cdf0e10cSrcweir #define STORE_UNICODE_MAGIC_MARKER 0xFE331188 112cdf0e10cSrcweir 113cdf0e10cSrcweir using namespace ::rtl; 114cdf0e10cSrcweir using namespace ::com::sun::star; 115cdf0e10cSrcweir using namespace ::com::sun::star::text; 116cdf0e10cSrcweir 117cdf0e10cSrcweir // Konvertierung fuer UNO 118cdf0e10cSrcweir #define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L)) 119cdf0e10cSrcweir #define MM100_TO_TWIP(MM100) ((MM100) >= 0 ? (((MM100)*72L+63L)/127L) : (((MM100)*72L-63L)/127L)) 120cdf0e10cSrcweir #define TWIP_TO_MM100_UNSIGNED(TWIP) ((((TWIP)*127L+36L)/72L)) 121cdf0e10cSrcweir #define MM100_TO_TWIP_UNSIGNED(MM100) ((((MM100)*72L+63L)/127L)) 122cdf0e10cSrcweir 123cdf0e10cSrcweir sal_Bool SvxFontItem::bEnableStoreUnicodeNames = sal_False; 124cdf0e10cSrcweir 125cdf0e10cSrcweir // STATIC DATA ----------------------------------------------------------- 126cdf0e10cSrcweir 127cdf0e10cSrcweir // ----------------------------------------------------------------------- 128cdf0e10cSrcweir 129cdf0e10cSrcweir TYPEINIT1(SvxFontListItem, SfxPoolItem); 130cdf0e10cSrcweir TYPEINIT1_FACTORY(SvxFontItem, SfxPoolItem, new SvxFontItem(0)); 131cdf0e10cSrcweir TYPEINIT1_FACTORY(SvxPostureItem, SfxEnumItem, new SvxPostureItem(ITALIC_NONE, 0)); 132cdf0e10cSrcweir TYPEINIT1_FACTORY(SvxWeightItem, SfxEnumItem, new SvxWeightItem(WEIGHT_NORMAL, 0)); 133cdf0e10cSrcweir TYPEINIT1_FACTORY(SvxFontHeightItem, SfxPoolItem, new SvxFontHeightItem(240, 100, 0)); 134cdf0e10cSrcweir TYPEINIT1_FACTORY(SvxFontWidthItem, SfxPoolItem, new SvxFontWidthItem(0, 100, 0)); 135cdf0e10cSrcweir TYPEINIT1_FACTORY(SvxTextLineItem, SfxEnumItem, new SvxTextLineItem(UNDERLINE_NONE, 0)); 136cdf0e10cSrcweir TYPEINIT1_FACTORY(SvxUnderlineItem, SfxEnumItem, new SvxUnderlineItem(UNDERLINE_NONE, 0)); 137cdf0e10cSrcweir TYPEINIT1_FACTORY(SvxOverlineItem, SfxEnumItem, new SvxOverlineItem(UNDERLINE_NONE, 0)); 138cdf0e10cSrcweir TYPEINIT1_FACTORY(SvxCrossedOutItem, SfxEnumItem, new SvxCrossedOutItem(STRIKEOUT_NONE, 0)); 139cdf0e10cSrcweir TYPEINIT1_FACTORY(SvxShadowedItem, SfxBoolItem, new SvxShadowedItem(sal_False, 0)); 140cdf0e10cSrcweir TYPEINIT1_FACTORY(SvxAutoKernItem, SfxBoolItem, new SvxAutoKernItem(sal_False, 0)); 141cdf0e10cSrcweir TYPEINIT1_FACTORY(SvxWordLineModeItem, SfxBoolItem, new SvxWordLineModeItem(sal_False, 0)); 142cdf0e10cSrcweir TYPEINIT1_FACTORY(SvxContourItem, SfxBoolItem, new SvxContourItem(sal_False, 0)); 143cdf0e10cSrcweir TYPEINIT1_FACTORY(SvxPropSizeItem, SfxUInt16Item, new SvxPropSizeItem(100, 0)); 144cdf0e10cSrcweir TYPEINIT1_FACTORY(SvxColorItem, SfxPoolItem, new SvxColorItem(0)); 145cdf0e10cSrcweir TYPEINIT1_FACTORY(SvxCharSetColorItem, SvxColorItem, new SvxCharSetColorItem(0)); 146cdf0e10cSrcweir TYPEINIT1_FACTORY(SvxKerningItem, SfxInt16Item, new SvxKerningItem(0, 0)); 147cdf0e10cSrcweir TYPEINIT1_FACTORY(SvxCaseMapItem, SfxEnumItem, new SvxCaseMapItem(SVX_CASEMAP_NOT_MAPPED, 0)); 148cdf0e10cSrcweir TYPEINIT1_FACTORY(SvxEscapementItem, SfxPoolItem, new SvxEscapementItem(0)); 149cdf0e10cSrcweir TYPEINIT1_FACTORY(SvxLanguageItem, SfxEnumItem, new SvxLanguageItem(LANGUAGE_GERMAN, 0)); 150cdf0e10cSrcweir TYPEINIT1_FACTORY(SvxNoLinebreakItem, SfxBoolItem, new SvxNoLinebreakItem(sal_True, 0)); 151cdf0e10cSrcweir TYPEINIT1_FACTORY(SvxNoHyphenItem, SfxBoolItem, new SvxNoHyphenItem(sal_True, 0)); 152cdf0e10cSrcweir TYPEINIT1_FACTORY(SvxLineColorItem, SvxColorItem, new SvxLineColorItem(0)); 153cdf0e10cSrcweir TYPEINIT1_FACTORY(SvxBlinkItem, SfxBoolItem, new SvxBlinkItem(sal_False, 0)); 154cdf0e10cSrcweir TYPEINIT1_FACTORY(SvxEmphasisMarkItem, SfxUInt16Item, new SvxEmphasisMarkItem(EMPHASISMARK_NONE, 0)); 155cdf0e10cSrcweir TYPEINIT1_FACTORY(SvxTwoLinesItem, SfxPoolItem, new SvxTwoLinesItem(sal_True, 0, 0, 0)); 156cdf0e10cSrcweir TYPEINIT1_FACTORY(SvxScriptTypeItem, SfxUInt16Item, new SvxScriptTypeItem); 157cdf0e10cSrcweir TYPEINIT1_FACTORY(SvxCharRotateItem, SfxUInt16Item, new SvxCharRotateItem(0, sal_False, 0)); 158cdf0e10cSrcweir TYPEINIT1_FACTORY(SvxCharScaleWidthItem, SfxUInt16Item, new SvxCharScaleWidthItem(100, 0)); 159cdf0e10cSrcweir TYPEINIT1_FACTORY(SvxCharReliefItem, SfxEnumItem, new SvxCharReliefItem(RELIEF_NONE, 0)); 160cdf0e10cSrcweir 161cdf0e10cSrcweir 162cdf0e10cSrcweir TYPEINIT1(SvxScriptSetItem, SfxSetItem ); 163cdf0e10cSrcweir 164cdf0e10cSrcweir 165cdf0e10cSrcweir // class SvxFontListItem ------------------------------------------------- 166cdf0e10cSrcweir 167cdf0e10cSrcweir SvxFontListItem::SvxFontListItem( const FontList* pFontLst, 168cdf0e10cSrcweir const sal_uInt16 nId ) : 169cdf0e10cSrcweir SfxPoolItem( nId ), 170cdf0e10cSrcweir pFontList( pFontLst ) 171cdf0e10cSrcweir { 172cdf0e10cSrcweir if ( pFontList ) 173cdf0e10cSrcweir { 174cdf0e10cSrcweir sal_Int32 nCount = pFontList->GetFontNameCount(); 175cdf0e10cSrcweir aFontNameSeq.realloc( nCount ); 176cdf0e10cSrcweir 177cdf0e10cSrcweir for ( sal_uInt16 i = 0; i < nCount; i++ ) 178cdf0e10cSrcweir aFontNameSeq[i] = pFontList->GetFontName(i).GetName(); 179cdf0e10cSrcweir } 180cdf0e10cSrcweir } 181cdf0e10cSrcweir 182cdf0e10cSrcweir // ----------------------------------------------------------------------- 183cdf0e10cSrcweir 184cdf0e10cSrcweir SvxFontListItem::SvxFontListItem( const SvxFontListItem& rItem ) : 185cdf0e10cSrcweir 186cdf0e10cSrcweir SfxPoolItem( rItem ), 187cdf0e10cSrcweir pFontList( rItem.GetFontList() ), 188cdf0e10cSrcweir aFontNameSeq( rItem.aFontNameSeq ) 189cdf0e10cSrcweir { 190cdf0e10cSrcweir } 191cdf0e10cSrcweir 192cdf0e10cSrcweir // ----------------------------------------------------------------------- 193cdf0e10cSrcweir 194cdf0e10cSrcweir SfxPoolItem* SvxFontListItem::Clone( SfxItemPool* ) const 195cdf0e10cSrcweir { 196cdf0e10cSrcweir return new SvxFontListItem( *this ); 197cdf0e10cSrcweir } 198cdf0e10cSrcweir 199cdf0e10cSrcweir // ----------------------------------------------------------------------- 200cdf0e10cSrcweir 201cdf0e10cSrcweir int SvxFontListItem::operator==( const SfxPoolItem& rAttr ) const 202cdf0e10cSrcweir { 203cdf0e10cSrcweir DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" ); 204cdf0e10cSrcweir 205cdf0e10cSrcweir return( pFontList == ((SvxFontListItem&)rAttr).pFontList ); 206cdf0e10cSrcweir } 207cdf0e10cSrcweir 208cdf0e10cSrcweir sal_Bool SvxFontListItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const 209cdf0e10cSrcweir { 210cdf0e10cSrcweir rVal <<= aFontNameSeq; 211cdf0e10cSrcweir return sal_True; 212cdf0e10cSrcweir } 213cdf0e10cSrcweir 214cdf0e10cSrcweir //------------------------------------------------------------------------ 215cdf0e10cSrcweir 216cdf0e10cSrcweir SfxItemPresentation SvxFontListItem::GetPresentation 217cdf0e10cSrcweir ( 218cdf0e10cSrcweir SfxItemPresentation /*ePres*/, 219cdf0e10cSrcweir SfxMapUnit /*eCoreUnit*/, 220cdf0e10cSrcweir SfxMapUnit /*ePresUnit*/, 221cdf0e10cSrcweir XubString& rText, const IntlWrapper * /*pIntl*/ 222cdf0e10cSrcweir ) const 223cdf0e10cSrcweir { 224cdf0e10cSrcweir rText.Erase(); 225cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_NONE; 226cdf0e10cSrcweir } 227cdf0e10cSrcweir 228cdf0e10cSrcweir // class SvxFontItem ----------------------------------------------------- 229cdf0e10cSrcweir 230cdf0e10cSrcweir SvxFontItem::SvxFontItem( const sal_uInt16 nId ) : 231cdf0e10cSrcweir SfxPoolItem( nId ) 232cdf0e10cSrcweir { 233cdf0e10cSrcweir eFamily = FAMILY_SWISS; 234cdf0e10cSrcweir ePitch = PITCH_VARIABLE; 235cdf0e10cSrcweir eTextEncoding = RTL_TEXTENCODING_DONTKNOW; 236cdf0e10cSrcweir } 237cdf0e10cSrcweir 238cdf0e10cSrcweir // ----------------------------------------------------------------------- 239cdf0e10cSrcweir 240cdf0e10cSrcweir SvxFontItem::SvxFontItem( const FontFamily eFam, const XubString& aName, 241cdf0e10cSrcweir const XubString& aStName, const FontPitch eFontPitch, 242cdf0e10cSrcweir const rtl_TextEncoding eFontTextEncoding, const sal_uInt16 nId ) : 243cdf0e10cSrcweir 244cdf0e10cSrcweir SfxPoolItem( nId ), 245cdf0e10cSrcweir 246cdf0e10cSrcweir aFamilyName(aName), 247cdf0e10cSrcweir aStyleName(aStName) 248cdf0e10cSrcweir { 249cdf0e10cSrcweir eFamily = eFam; 250cdf0e10cSrcweir ePitch = eFontPitch; 251cdf0e10cSrcweir eTextEncoding = eFontTextEncoding; 252cdf0e10cSrcweir } 253cdf0e10cSrcweir 254cdf0e10cSrcweir // ----------------------------------------------------------------------- 255cdf0e10cSrcweir SvxFontItem& SvxFontItem::operator=(const SvxFontItem& rFont) 256cdf0e10cSrcweir { 257cdf0e10cSrcweir aFamilyName = rFont.GetFamilyName(); 258cdf0e10cSrcweir aStyleName = rFont.GetStyleName(); 259cdf0e10cSrcweir eFamily = rFont.GetFamily(); 260cdf0e10cSrcweir ePitch = rFont.GetPitch(); 261cdf0e10cSrcweir eTextEncoding = rFont.GetCharSet(); 262cdf0e10cSrcweir return *this; 263cdf0e10cSrcweir } 264cdf0e10cSrcweir // ----------------------------------------------------------------------- 265cdf0e10cSrcweir 266cdf0e10cSrcweir sal_Bool SvxFontItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const 267cdf0e10cSrcweir { 268cdf0e10cSrcweir // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); 269cdf0e10cSrcweir nMemberId &= ~CONVERT_TWIPS; 270cdf0e10cSrcweir switch(nMemberId) 271cdf0e10cSrcweir { 272cdf0e10cSrcweir case 0: 273cdf0e10cSrcweir { 274cdf0e10cSrcweir com::sun::star::awt::FontDescriptor aFontDescriptor; 275cdf0e10cSrcweir aFontDescriptor.Name = aFamilyName.GetBuffer(); 276cdf0e10cSrcweir aFontDescriptor.StyleName = aStyleName.GetBuffer(); 277cdf0e10cSrcweir aFontDescriptor.Family = (sal_Int16)(eFamily); 278cdf0e10cSrcweir aFontDescriptor.CharSet = (sal_Int16)(eTextEncoding); 279cdf0e10cSrcweir aFontDescriptor.Pitch = (sal_Int16)(ePitch); 280cdf0e10cSrcweir rVal <<= aFontDescriptor; 281cdf0e10cSrcweir } 282cdf0e10cSrcweir break; 283cdf0e10cSrcweir case MID_FONT_FAMILY_NAME : 284cdf0e10cSrcweir rVal <<= OUString(aFamilyName.GetBuffer()); 285cdf0e10cSrcweir break; 286cdf0e10cSrcweir case MID_FONT_STYLE_NAME: 287cdf0e10cSrcweir rVal <<= OUString(aStyleName.GetBuffer()); 288cdf0e10cSrcweir break; 289cdf0e10cSrcweir case MID_FONT_FAMILY : rVal <<= (sal_Int16)(eFamily); break; 290cdf0e10cSrcweir case MID_FONT_CHAR_SET : rVal <<= (sal_Int16)(eTextEncoding); break; 291cdf0e10cSrcweir case MID_FONT_PITCH : rVal <<= (sal_Int16)(ePitch); break; 292cdf0e10cSrcweir } 293cdf0e10cSrcweir return sal_True; 294cdf0e10cSrcweir } 295cdf0e10cSrcweir // ----------------------------------------------------------------------- 296cdf0e10cSrcweir sal_Bool SvxFontItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId) 297cdf0e10cSrcweir { 298cdf0e10cSrcweir // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); 299cdf0e10cSrcweir nMemberId &= ~CONVERT_TWIPS; 300cdf0e10cSrcweir switch(nMemberId) 301cdf0e10cSrcweir { 302cdf0e10cSrcweir case 0: 303cdf0e10cSrcweir { 304cdf0e10cSrcweir com::sun::star::awt::FontDescriptor aFontDescriptor; 305cdf0e10cSrcweir if ( !( rVal >>= aFontDescriptor )) 306cdf0e10cSrcweir return sal_False; 307cdf0e10cSrcweir 308cdf0e10cSrcweir aFamilyName = aFontDescriptor.Name; 309cdf0e10cSrcweir aStyleName = aFontDescriptor.StyleName; 310cdf0e10cSrcweir eFamily = (FontFamily)aFontDescriptor.Family; 311cdf0e10cSrcweir eTextEncoding = (rtl_TextEncoding)aFontDescriptor.CharSet; 312cdf0e10cSrcweir ePitch = (FontPitch)aFontDescriptor.Pitch; 313cdf0e10cSrcweir } 314cdf0e10cSrcweir break; 315cdf0e10cSrcweir case MID_FONT_FAMILY_NAME : 316cdf0e10cSrcweir { 317cdf0e10cSrcweir OUString aStr; 318cdf0e10cSrcweir if(!(rVal >>= aStr)) 319cdf0e10cSrcweir return sal_False; 320cdf0e10cSrcweir aFamilyName = aStr.getStr(); 321cdf0e10cSrcweir } 322cdf0e10cSrcweir break; 323cdf0e10cSrcweir case MID_FONT_STYLE_NAME: 324cdf0e10cSrcweir { 325cdf0e10cSrcweir OUString aStr; 326cdf0e10cSrcweir if(!(rVal >>= aStr)) 327cdf0e10cSrcweir return sal_False; 328cdf0e10cSrcweir aStyleName = aStr.getStr(); 329cdf0e10cSrcweir } 330cdf0e10cSrcweir break; 331cdf0e10cSrcweir case MID_FONT_FAMILY : 332cdf0e10cSrcweir { 333cdf0e10cSrcweir sal_Int16 nFamily = sal_Int16(); 334cdf0e10cSrcweir if(!(rVal >>= nFamily)) 335cdf0e10cSrcweir return sal_False; 336cdf0e10cSrcweir eFamily = (FontFamily)nFamily; 337cdf0e10cSrcweir } 338cdf0e10cSrcweir break; 339cdf0e10cSrcweir case MID_FONT_CHAR_SET : 340cdf0e10cSrcweir { 341cdf0e10cSrcweir sal_Int16 nSet = sal_Int16(); 342cdf0e10cSrcweir if(!(rVal >>= nSet)) 343cdf0e10cSrcweir return sal_False; 344cdf0e10cSrcweir eTextEncoding = (rtl_TextEncoding)nSet; 345cdf0e10cSrcweir } 346cdf0e10cSrcweir break; 347cdf0e10cSrcweir case MID_FONT_PITCH : 348cdf0e10cSrcweir { 349cdf0e10cSrcweir sal_Int16 nPitch = sal_Int16(); 350cdf0e10cSrcweir if(!(rVal >>= nPitch)) 351cdf0e10cSrcweir return sal_False; 352cdf0e10cSrcweir ePitch = (FontPitch)nPitch; 353cdf0e10cSrcweir } 354cdf0e10cSrcweir break; 355cdf0e10cSrcweir } 356cdf0e10cSrcweir return sal_True; 357cdf0e10cSrcweir } 358cdf0e10cSrcweir 359cdf0e10cSrcweir // ----------------------------------------------------------------------- 360cdf0e10cSrcweir 361cdf0e10cSrcweir int SvxFontItem::operator==( const SfxPoolItem& rAttr ) const 362cdf0e10cSrcweir { 363cdf0e10cSrcweir DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" ); 364cdf0e10cSrcweir 365cdf0e10cSrcweir const SvxFontItem& rItem = (const SvxFontItem&)rAttr; 366cdf0e10cSrcweir 367cdf0e10cSrcweir int bRet = ( eFamily == rItem.eFamily && 368cdf0e10cSrcweir aFamilyName == rItem.aFamilyName && 369cdf0e10cSrcweir aStyleName == rItem.aStyleName ); 370cdf0e10cSrcweir 371cdf0e10cSrcweir if ( bRet ) 372cdf0e10cSrcweir { 373cdf0e10cSrcweir if ( ePitch != rItem.ePitch || eTextEncoding != rItem.eTextEncoding ) 374cdf0e10cSrcweir { 375cdf0e10cSrcweir bRet = sal_False; 376cdf0e10cSrcweir DBG_WARNING( "FontItem::operator==(): nur Pitch oder rtl_TextEncoding unterschiedlich" ); 377cdf0e10cSrcweir } 378cdf0e10cSrcweir } 379cdf0e10cSrcweir return bRet; 380cdf0e10cSrcweir } 381cdf0e10cSrcweir 382cdf0e10cSrcweir // ----------------------------------------------------------------------- 383cdf0e10cSrcweir 384cdf0e10cSrcweir SfxPoolItem* SvxFontItem::Clone( SfxItemPool * ) const 385cdf0e10cSrcweir { 386cdf0e10cSrcweir return new SvxFontItem( *this ); 387cdf0e10cSrcweir } 388cdf0e10cSrcweir 389cdf0e10cSrcweir // ----------------------------------------------------------------------- 390cdf0e10cSrcweir 391cdf0e10cSrcweir SvStream& SvxFontItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const 392cdf0e10cSrcweir { 393cdf0e10cSrcweir sal_Bool bToBats = 394cdf0e10cSrcweir GetFamilyName().EqualsAscii( "StarSymbol", 0, sizeof("StarSymbol")-1 ) || 395cdf0e10cSrcweir GetFamilyName().EqualsAscii( "OpenSymbol", 0, sizeof("OpenSymbol")-1 ); 396cdf0e10cSrcweir 397cdf0e10cSrcweir // #90477# rStrm << (sal_uInt8) GetFamily() 398cdf0e10cSrcweir // << (sal_uInt8) GetPitch() 399cdf0e10cSrcweir // << (sal_uInt8)(bToBats ? RTL_TEXTENCODING_SYMBOL : GetStoreCharSet( GetCharSet(), (sal_uInt16)rStrm.GetVersion() ) ); 400cdf0e10cSrcweir rStrm << (sal_uInt8) GetFamily() << (sal_uInt8) GetPitch() 401cdf0e10cSrcweir << (sal_uInt8)(bToBats ? RTL_TEXTENCODING_SYMBOL : GetSOStoreTextEncoding(GetCharSet(), (sal_uInt16)rStrm.GetVersion())); 402cdf0e10cSrcweir 403cdf0e10cSrcweir String aStoreFamilyName( GetFamilyName() ); 404cdf0e10cSrcweir if( bToBats ) 405cdf0e10cSrcweir aStoreFamilyName = String( "StarBats", sizeof("StarBats")-1, RTL_TEXTENCODING_ASCII_US ); 406cdf0e10cSrcweir rStrm.WriteByteString(aStoreFamilyName); 407cdf0e10cSrcweir rStrm.WriteByteString(GetStyleName()); 408cdf0e10cSrcweir 409cdf0e10cSrcweir // #96441# Kach for EditEngine, only set while creating clipboard stream. 410cdf0e10cSrcweir if ( bEnableStoreUnicodeNames ) 411cdf0e10cSrcweir { 412cdf0e10cSrcweir sal_uInt32 nMagic = STORE_UNICODE_MAGIC_MARKER; 413cdf0e10cSrcweir rStrm << nMagic; 414cdf0e10cSrcweir rStrm.WriteByteString( aStoreFamilyName, RTL_TEXTENCODING_UNICODE ); 415cdf0e10cSrcweir rStrm.WriteByteString( GetStyleName(), RTL_TEXTENCODING_UNICODE ); 416cdf0e10cSrcweir } 417cdf0e10cSrcweir 418cdf0e10cSrcweir return rStrm; 419cdf0e10cSrcweir } 420cdf0e10cSrcweir 421cdf0e10cSrcweir // ----------------------------------------------------------------------- 422cdf0e10cSrcweir 423cdf0e10cSrcweir SfxPoolItem* SvxFontItem::Create(SvStream& rStrm, sal_uInt16) const 424cdf0e10cSrcweir { 425cdf0e10cSrcweir sal_uInt8 _eFamily, eFontPitch, eFontTextEncoding; 426cdf0e10cSrcweir String aName, aStyle; 427cdf0e10cSrcweir rStrm >> _eFamily; 428cdf0e10cSrcweir rStrm >> eFontPitch; 429cdf0e10cSrcweir rStrm >> eFontTextEncoding; 430cdf0e10cSrcweir 431cdf0e10cSrcweir // UNICODE: rStrm >> aName; 432cdf0e10cSrcweir rStrm.ReadByteString(aName); 433cdf0e10cSrcweir 434cdf0e10cSrcweir // UNICODE: rStrm >> aStyle; 435cdf0e10cSrcweir rStrm.ReadByteString(aStyle); 436cdf0e10cSrcweir 437cdf0e10cSrcweir // Task 91008/90471: set the "correct" textencoding 438cdf0e10cSrcweir eFontTextEncoding = (sal_uInt8)GetSOLoadTextEncoding( eFontTextEncoding, (sal_uInt16)rStrm.GetVersion() ); 439cdf0e10cSrcweir 440cdf0e10cSrcweir // irgendwann wandelte sich der StarBats vom ANSI- zum SYMBOL-Font 441cdf0e10cSrcweir if ( RTL_TEXTENCODING_SYMBOL != eFontTextEncoding && aName.EqualsAscii("StarBats") ) 442cdf0e10cSrcweir eFontTextEncoding = RTL_TEXTENCODING_SYMBOL; 443cdf0e10cSrcweir 444cdf0e10cSrcweir // Check if we have stored unicode 445cdf0e10cSrcweir sal_Size nStreamPos = rStrm.Tell(); 446cdf0e10cSrcweir sal_uInt32 nMagic = STORE_UNICODE_MAGIC_MARKER; 447cdf0e10cSrcweir rStrm >> nMagic; 448cdf0e10cSrcweir if ( nMagic == STORE_UNICODE_MAGIC_MARKER ) 449cdf0e10cSrcweir { 450cdf0e10cSrcweir rStrm.ReadByteString( aName, RTL_TEXTENCODING_UNICODE ); 451cdf0e10cSrcweir rStrm.ReadByteString( aStyle, RTL_TEXTENCODING_UNICODE ); 452cdf0e10cSrcweir } 453cdf0e10cSrcweir else 454cdf0e10cSrcweir { 455cdf0e10cSrcweir rStrm.Seek( nStreamPos ); 456cdf0e10cSrcweir } 457cdf0e10cSrcweir 458cdf0e10cSrcweir 459cdf0e10cSrcweir 460cdf0e10cSrcweir return new SvxFontItem( (FontFamily)_eFamily, aName, aStyle, 461cdf0e10cSrcweir (FontPitch)eFontPitch, (rtl_TextEncoding)eFontTextEncoding, Which() ); 462cdf0e10cSrcweir } 463cdf0e10cSrcweir 464cdf0e10cSrcweir //------------------------------------------------------------------------ 465cdf0e10cSrcweir 466cdf0e10cSrcweir SfxItemPresentation SvxFontItem::GetPresentation 467cdf0e10cSrcweir ( 468cdf0e10cSrcweir SfxItemPresentation ePres, 469cdf0e10cSrcweir SfxMapUnit /*eCoreUnit*/, 470cdf0e10cSrcweir SfxMapUnit /*ePresUnit*/, 471cdf0e10cSrcweir XubString& rText, const IntlWrapper * /*pIntl*/ 472cdf0e10cSrcweir ) const 473cdf0e10cSrcweir { 474cdf0e10cSrcweir switch ( ePres ) 475cdf0e10cSrcweir { 476cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NONE: 477cdf0e10cSrcweir rText.Erase(); 478cdf0e10cSrcweir return ePres; 479cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NAMELESS: 480cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_COMPLETE: 481cdf0e10cSrcweir rText = aFamilyName; 482cdf0e10cSrcweir return ePres; 483cdf0e10cSrcweir default: ; //prevent warning 484cdf0e10cSrcweir } 485cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_NONE; 486cdf0e10cSrcweir } 487cdf0e10cSrcweir 488cdf0e10cSrcweir //------------------------------------------------------------------------ 489cdf0e10cSrcweir 490cdf0e10cSrcweir void SvxFontItem::EnableStoreUnicodeNames( sal_Bool bEnable ) 491cdf0e10cSrcweir { 492cdf0e10cSrcweir bEnableStoreUnicodeNames = bEnable; 493cdf0e10cSrcweir } 494cdf0e10cSrcweir 495cdf0e10cSrcweir // class SvxPostureItem -------------------------------------------------- 496cdf0e10cSrcweir 497cdf0e10cSrcweir SvxPostureItem::SvxPostureItem( const FontItalic ePosture, const sal_uInt16 nId ) : 498cdf0e10cSrcweir SfxEnumItem( nId, (sal_uInt16)ePosture ) 499cdf0e10cSrcweir { 500cdf0e10cSrcweir } 501cdf0e10cSrcweir 502cdf0e10cSrcweir // ----------------------------------------------------------------------- 503cdf0e10cSrcweir 504cdf0e10cSrcweir SfxPoolItem* SvxPostureItem::Clone( SfxItemPool * ) const 505cdf0e10cSrcweir { 506cdf0e10cSrcweir return new SvxPostureItem( *this ); 507cdf0e10cSrcweir } 508cdf0e10cSrcweir 509cdf0e10cSrcweir // ----------------------------------------------------------------------- 510cdf0e10cSrcweir 511cdf0e10cSrcweir sal_uInt16 SvxPostureItem::GetValueCount() const 512cdf0e10cSrcweir { 513cdf0e10cSrcweir return ITALIC_NORMAL + 1; // auch ITALIC_NONE geh"ort dazu 514cdf0e10cSrcweir } 515cdf0e10cSrcweir 516cdf0e10cSrcweir // ----------------------------------------------------------------------- 517cdf0e10cSrcweir 518cdf0e10cSrcweir SvStream& SvxPostureItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const 519cdf0e10cSrcweir { 520cdf0e10cSrcweir rStrm << (sal_uInt8)GetValue(); 521cdf0e10cSrcweir return rStrm; 522cdf0e10cSrcweir } 523cdf0e10cSrcweir 524cdf0e10cSrcweir // ----------------------------------------------------------------------- 525cdf0e10cSrcweir 526cdf0e10cSrcweir SfxPoolItem* SvxPostureItem::Create(SvStream& rStrm, sal_uInt16) const 527cdf0e10cSrcweir { 528cdf0e10cSrcweir sal_uInt8 nPosture; 529cdf0e10cSrcweir rStrm >> nPosture; 530cdf0e10cSrcweir return new SvxPostureItem( (const FontItalic)nPosture, Which() ); 531cdf0e10cSrcweir } 532cdf0e10cSrcweir 533cdf0e10cSrcweir //------------------------------------------------------------------------ 534cdf0e10cSrcweir 535cdf0e10cSrcweir SfxItemPresentation SvxPostureItem::GetPresentation 536cdf0e10cSrcweir ( 537cdf0e10cSrcweir SfxItemPresentation ePres, 538cdf0e10cSrcweir SfxMapUnit /*eCoreUnit*/, 539cdf0e10cSrcweir SfxMapUnit /*ePresUnit*/, 540cdf0e10cSrcweir XubString& rText, const IntlWrapper * /*pIntl*/ 541cdf0e10cSrcweir ) const 542cdf0e10cSrcweir { 543cdf0e10cSrcweir switch ( ePres ) 544cdf0e10cSrcweir { 545cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NONE: 546cdf0e10cSrcweir rText.Erase(); 547cdf0e10cSrcweir return ePres; 548cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NAMELESS: 549cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_COMPLETE: 550cdf0e10cSrcweir rText = GetValueTextByPos( GetValue() ); 551cdf0e10cSrcweir return ePres; 552cdf0e10cSrcweir default: ;//prevent warning 553cdf0e10cSrcweir } 554cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_NONE; 555cdf0e10cSrcweir } 556cdf0e10cSrcweir 557cdf0e10cSrcweir // ----------------------------------------------------------------------- 558cdf0e10cSrcweir 559cdf0e10cSrcweir XubString SvxPostureItem::GetValueTextByPos( sal_uInt16 nPos ) const 560cdf0e10cSrcweir { 561cdf0e10cSrcweir DBG_ASSERT( nPos <= (sal_uInt16)ITALIC_NORMAL, "enum overflow!" ); 562cdf0e10cSrcweir 563cdf0e10cSrcweir XubString sTxt; 564cdf0e10cSrcweir FontItalic eItalic = (FontItalic)nPos; 565cdf0e10cSrcweir sal_uInt16 nId = 0; 566cdf0e10cSrcweir 567cdf0e10cSrcweir switch ( eItalic ) 568cdf0e10cSrcweir { 569cdf0e10cSrcweir case ITALIC_NONE: nId = RID_SVXITEMS_ITALIC_NONE; break; 570cdf0e10cSrcweir case ITALIC_OBLIQUE: nId = RID_SVXITEMS_ITALIC_OBLIQUE; break; 571cdf0e10cSrcweir case ITALIC_NORMAL: nId = RID_SVXITEMS_ITALIC_NORMAL; break; 572cdf0e10cSrcweir default: ;//prevent warning 573cdf0e10cSrcweir } 574cdf0e10cSrcweir 575cdf0e10cSrcweir if ( nId ) 576cdf0e10cSrcweir sTxt = EditResId( nId ); 577cdf0e10cSrcweir return sTxt; 578cdf0e10cSrcweir } 579cdf0e10cSrcweir 580cdf0e10cSrcweir 581cdf0e10cSrcweir /*-----------------13.03.98 14:28------------------- 582cdf0e10cSrcweir 583cdf0e10cSrcweir --------------------------------------------------*/ 584cdf0e10cSrcweir sal_Bool SvxPostureItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const 585cdf0e10cSrcweir { 586cdf0e10cSrcweir // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); 587cdf0e10cSrcweir nMemberId &= ~CONVERT_TWIPS; 588cdf0e10cSrcweir switch( nMemberId ) 589cdf0e10cSrcweir { 590cdf0e10cSrcweir case MID_ITALIC: 591cdf0e10cSrcweir rVal = Bool2Any(GetBoolValue()); 592cdf0e10cSrcweir break; 593cdf0e10cSrcweir case MID_POSTURE: 594cdf0e10cSrcweir rVal <<= (awt::FontSlant)GetValue(); // Werte von awt::FontSlant und FontItalic sind gleich 595cdf0e10cSrcweir break; 596cdf0e10cSrcweir } 597cdf0e10cSrcweir return sal_True; 598cdf0e10cSrcweir } 599cdf0e10cSrcweir /*-----------------13.03.98 14:28------------------- 600cdf0e10cSrcweir 601cdf0e10cSrcweir --------------------------------------------------*/ 602cdf0e10cSrcweir sal_Bool SvxPostureItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) 603cdf0e10cSrcweir { 604cdf0e10cSrcweir // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); 605cdf0e10cSrcweir nMemberId &= ~CONVERT_TWIPS; 606cdf0e10cSrcweir switch( nMemberId ) 607cdf0e10cSrcweir { 608cdf0e10cSrcweir case MID_ITALIC: 609cdf0e10cSrcweir SetBoolValue(Any2Bool(rVal)); 610cdf0e10cSrcweir break; 611cdf0e10cSrcweir case MID_POSTURE: 612cdf0e10cSrcweir { 613cdf0e10cSrcweir awt::FontSlant eSlant; 614cdf0e10cSrcweir if(!(rVal >>= eSlant)) 615cdf0e10cSrcweir { 616cdf0e10cSrcweir sal_Int32 nValue = 0; 617cdf0e10cSrcweir if(!(rVal >>= nValue)) 618cdf0e10cSrcweir return sal_False; 619cdf0e10cSrcweir 620cdf0e10cSrcweir eSlant = (awt::FontSlant)nValue; 621cdf0e10cSrcweir } 622cdf0e10cSrcweir SetValue((sal_uInt16)eSlant); 623cdf0e10cSrcweir } 624cdf0e10cSrcweir } 625cdf0e10cSrcweir return sal_True; 626cdf0e10cSrcweir } 627cdf0e10cSrcweir // ----------------------------------------------------------------------- 628cdf0e10cSrcweir 629cdf0e10cSrcweir int SvxPostureItem::HasBoolValue() const 630cdf0e10cSrcweir { 631cdf0e10cSrcweir return sal_True; 632cdf0e10cSrcweir } 633cdf0e10cSrcweir 634cdf0e10cSrcweir // ----------------------------------------------------------------------- 635cdf0e10cSrcweir 636cdf0e10cSrcweir sal_Bool SvxPostureItem::GetBoolValue() const 637cdf0e10cSrcweir { 638cdf0e10cSrcweir return ( (FontItalic)GetValue() >= ITALIC_OBLIQUE ); 639cdf0e10cSrcweir } 640cdf0e10cSrcweir 641cdf0e10cSrcweir // ----------------------------------------------------------------------- 642cdf0e10cSrcweir 643cdf0e10cSrcweir void SvxPostureItem::SetBoolValue( sal_Bool bVal ) 644cdf0e10cSrcweir { 645cdf0e10cSrcweir SetValue( (sal_uInt16)(bVal ? ITALIC_NORMAL : ITALIC_NONE) ); 646cdf0e10cSrcweir } 647cdf0e10cSrcweir 648cdf0e10cSrcweir // class SvxWeightItem --------------------------------------------------- 649cdf0e10cSrcweir 650cdf0e10cSrcweir SvxWeightItem::SvxWeightItem( const FontWeight eWght, const sal_uInt16 nId ) : 651cdf0e10cSrcweir SfxEnumItem( nId, (sal_uInt16)eWght ) 652cdf0e10cSrcweir { 653cdf0e10cSrcweir } 654cdf0e10cSrcweir 655cdf0e10cSrcweir 656cdf0e10cSrcweir 657cdf0e10cSrcweir // ----------------------------------------------------------------------- 658cdf0e10cSrcweir 659cdf0e10cSrcweir int SvxWeightItem::HasBoolValue() const 660cdf0e10cSrcweir { 661cdf0e10cSrcweir return sal_True; 662cdf0e10cSrcweir } 663cdf0e10cSrcweir 664cdf0e10cSrcweir // ----------------------------------------------------------------------- 665cdf0e10cSrcweir 666cdf0e10cSrcweir sal_Bool SvxWeightItem::GetBoolValue() const 667cdf0e10cSrcweir { 668cdf0e10cSrcweir return (FontWeight)GetValue() >= WEIGHT_BOLD; 669cdf0e10cSrcweir } 670cdf0e10cSrcweir 671cdf0e10cSrcweir // ----------------------------------------------------------------------- 672cdf0e10cSrcweir 673cdf0e10cSrcweir void SvxWeightItem::SetBoolValue( sal_Bool bVal ) 674cdf0e10cSrcweir { 675cdf0e10cSrcweir SetValue( (sal_uInt16)(bVal ? WEIGHT_BOLD : WEIGHT_NORMAL) ); 676cdf0e10cSrcweir } 677cdf0e10cSrcweir 678cdf0e10cSrcweir // ----------------------------------------------------------------------- 679cdf0e10cSrcweir 680cdf0e10cSrcweir sal_uInt16 SvxWeightItem::GetValueCount() const 681cdf0e10cSrcweir { 682cdf0e10cSrcweir return WEIGHT_BLACK; // WEIGHT_DONTKNOW geh"ort nicht dazu 683cdf0e10cSrcweir } 684cdf0e10cSrcweir 685cdf0e10cSrcweir // ----------------------------------------------------------------------- 686cdf0e10cSrcweir 687cdf0e10cSrcweir SfxPoolItem* SvxWeightItem::Clone( SfxItemPool * ) const 688cdf0e10cSrcweir { 689cdf0e10cSrcweir return new SvxWeightItem( *this ); 690cdf0e10cSrcweir } 691cdf0e10cSrcweir 692cdf0e10cSrcweir // ----------------------------------------------------------------------- 693cdf0e10cSrcweir 694cdf0e10cSrcweir SvStream& SvxWeightItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const 695cdf0e10cSrcweir { 696cdf0e10cSrcweir rStrm << (sal_uInt8)GetValue(); 697cdf0e10cSrcweir return rStrm; 698cdf0e10cSrcweir } 699cdf0e10cSrcweir 700cdf0e10cSrcweir // ----------------------------------------------------------------------- 701cdf0e10cSrcweir 702cdf0e10cSrcweir SfxPoolItem* SvxWeightItem::Create(SvStream& rStrm, sal_uInt16) const 703cdf0e10cSrcweir { 704cdf0e10cSrcweir sal_uInt8 nWeight; 705cdf0e10cSrcweir rStrm >> nWeight; 706cdf0e10cSrcweir return new SvxWeightItem( (FontWeight)nWeight, Which() ); 707cdf0e10cSrcweir } 708cdf0e10cSrcweir 709cdf0e10cSrcweir //------------------------------------------------------------------------ 710cdf0e10cSrcweir 711cdf0e10cSrcweir SfxItemPresentation SvxWeightItem::GetPresentation 712cdf0e10cSrcweir ( 713cdf0e10cSrcweir SfxItemPresentation ePres, 714cdf0e10cSrcweir SfxMapUnit /*eCoreUnit*/, 715cdf0e10cSrcweir SfxMapUnit /*ePresUnit*/, 716cdf0e10cSrcweir XubString& rText, const IntlWrapper * /*pIntl*/ 717cdf0e10cSrcweir ) const 718cdf0e10cSrcweir { 719cdf0e10cSrcweir switch ( ePres ) 720cdf0e10cSrcweir { 721cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NONE: 722cdf0e10cSrcweir rText.Erase(); 723cdf0e10cSrcweir return ePres; 724cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NAMELESS: 725cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_COMPLETE: 726cdf0e10cSrcweir rText = GetValueTextByPos( GetValue() ); 727cdf0e10cSrcweir return ePres; 728cdf0e10cSrcweir default: ;//prevent warning 729cdf0e10cSrcweir } 730cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_NONE; 731cdf0e10cSrcweir } 732cdf0e10cSrcweir 733cdf0e10cSrcweir // ----------------------------------------------------------------------- 734cdf0e10cSrcweir 735cdf0e10cSrcweir XubString SvxWeightItem::GetValueTextByPos( sal_uInt16 nPos ) const 736cdf0e10cSrcweir { 737cdf0e10cSrcweir DBG_ASSERT( nPos <= (sal_uInt16)WEIGHT_BLACK, "enum overflow!" ); 738cdf0e10cSrcweir return EE_RESSTR( RID_SVXITEMS_WEIGHT_BEGIN + nPos ); 739cdf0e10cSrcweir } 740cdf0e10cSrcweir 741cdf0e10cSrcweir /*-----------------13.03.98 14:18------------------- 742cdf0e10cSrcweir 743cdf0e10cSrcweir --------------------------------------------------*/ 744cdf0e10cSrcweir sal_Bool SvxWeightItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const 745cdf0e10cSrcweir { 746cdf0e10cSrcweir // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); 747cdf0e10cSrcweir nMemberId &= ~CONVERT_TWIPS; 748cdf0e10cSrcweir switch( nMemberId ) 749cdf0e10cSrcweir { 750cdf0e10cSrcweir case MID_BOLD : 751cdf0e10cSrcweir rVal = Bool2Any(GetBoolValue()); 752cdf0e10cSrcweir break; 753cdf0e10cSrcweir case MID_WEIGHT: 754cdf0e10cSrcweir { 755cdf0e10cSrcweir rVal <<= (float)( VCLUnoHelper::ConvertFontWeight( (FontWeight)GetValue() ) ); 756cdf0e10cSrcweir } 757cdf0e10cSrcweir break; 758cdf0e10cSrcweir } 759cdf0e10cSrcweir return sal_True; 760cdf0e10cSrcweir } 761cdf0e10cSrcweir /*-----------------13.03.98 14:18------------------- 762cdf0e10cSrcweir 763cdf0e10cSrcweir --------------------------------------------------*/ 764cdf0e10cSrcweir sal_Bool SvxWeightItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) 765cdf0e10cSrcweir { 766cdf0e10cSrcweir // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); 767cdf0e10cSrcweir nMemberId &= ~CONVERT_TWIPS; 768cdf0e10cSrcweir switch( nMemberId ) 769cdf0e10cSrcweir { 770cdf0e10cSrcweir case MID_BOLD : 771cdf0e10cSrcweir SetBoolValue(Any2Bool(rVal)); 772cdf0e10cSrcweir break; 773cdf0e10cSrcweir case MID_WEIGHT: 774cdf0e10cSrcweir { 775cdf0e10cSrcweir double fValue = 0; 776cdf0e10cSrcweir if(!(rVal >>= fValue)) 777cdf0e10cSrcweir { 778cdf0e10cSrcweir sal_Int32 nValue = 0; 779cdf0e10cSrcweir if(!(rVal >>= nValue)) 780cdf0e10cSrcweir return sal_False; 781cdf0e10cSrcweir fValue = (float)nValue; 782cdf0e10cSrcweir } 783cdf0e10cSrcweir SetValue( (sal_uInt16)VCLUnoHelper::ConvertFontWeight((float)fValue) ); 784cdf0e10cSrcweir } 785cdf0e10cSrcweir break; 786cdf0e10cSrcweir } 787cdf0e10cSrcweir return sal_True; 788cdf0e10cSrcweir } 789cdf0e10cSrcweir 790cdf0e10cSrcweir // class SvxFontHeightItem ----------------------------------------------- 791cdf0e10cSrcweir 792cdf0e10cSrcweir SvxFontHeightItem::SvxFontHeightItem( const sal_uLong nSz, 793cdf0e10cSrcweir const sal_uInt16 nPrp, 794cdf0e10cSrcweir const sal_uInt16 nId ) : 795cdf0e10cSrcweir SfxPoolItem( nId ) 796cdf0e10cSrcweir { 797cdf0e10cSrcweir SetHeight( nSz,nPrp ); // mit den Prozenten rechnen 798cdf0e10cSrcweir } 799cdf0e10cSrcweir 800cdf0e10cSrcweir // ----------------------------------------------------------------------- 801cdf0e10cSrcweir 802cdf0e10cSrcweir SfxPoolItem* SvxFontHeightItem::Clone( SfxItemPool * ) const 803cdf0e10cSrcweir { 804cdf0e10cSrcweir return new SvxFontHeightItem( *this ); 805cdf0e10cSrcweir } 806cdf0e10cSrcweir 807cdf0e10cSrcweir // ----------------------------------------------------------------------- 808cdf0e10cSrcweir 809cdf0e10cSrcweir SvStream& SvxFontHeightItem::Store( SvStream& rStrm , sal_uInt16 nItemVersion ) const 810cdf0e10cSrcweir { 811cdf0e10cSrcweir rStrm << (sal_uInt16)GetHeight(); 812cdf0e10cSrcweir 813cdf0e10cSrcweir if( FONTHEIGHT_UNIT_VERSION <= nItemVersion ) 814cdf0e10cSrcweir rStrm << GetProp() << (sal_uInt16)GetPropUnit(); 815cdf0e10cSrcweir else 816cdf0e10cSrcweir { 817cdf0e10cSrcweir // JP 30.06.98: beim Export in alte Versionen geht die relative 818cdf0e10cSrcweir // Angabe verloren, wenn es keine Prozentuale ist 819cdf0e10cSrcweir sal_uInt16 _nProp = GetProp(); 820cdf0e10cSrcweir if( SFX_MAPUNIT_RELATIVE != GetPropUnit() ) 821cdf0e10cSrcweir _nProp = 100; 822cdf0e10cSrcweir rStrm << _nProp; 823cdf0e10cSrcweir } 824cdf0e10cSrcweir return rStrm; 825cdf0e10cSrcweir } 826cdf0e10cSrcweir 827cdf0e10cSrcweir // ----------------------------------------------------------------------- 828cdf0e10cSrcweir 829cdf0e10cSrcweir SfxPoolItem* SvxFontHeightItem::Create( SvStream& rStrm, 830cdf0e10cSrcweir sal_uInt16 nVersion ) const 831cdf0e10cSrcweir { 832cdf0e10cSrcweir sal_uInt16 nsize, nprop = 0, nPropUnit = SFX_MAPUNIT_RELATIVE; 833cdf0e10cSrcweir 834cdf0e10cSrcweir rStrm >> nsize; 835cdf0e10cSrcweir 836cdf0e10cSrcweir if( FONTHEIGHT_16_VERSION <= nVersion ) 837cdf0e10cSrcweir rStrm >> nprop; 838cdf0e10cSrcweir else 839cdf0e10cSrcweir { 840cdf0e10cSrcweir sal_uInt8 nP; 841cdf0e10cSrcweir rStrm >> nP; 842cdf0e10cSrcweir nprop = (sal_uInt16)nP; 843cdf0e10cSrcweir } 844cdf0e10cSrcweir 845cdf0e10cSrcweir if( FONTHEIGHT_UNIT_VERSION <= nVersion ) 846cdf0e10cSrcweir rStrm >> nPropUnit; 847cdf0e10cSrcweir 848cdf0e10cSrcweir SvxFontHeightItem* pItem = new SvxFontHeightItem( nsize, 100, Which() ); 849cdf0e10cSrcweir pItem->SetProp( nprop, (SfxMapUnit)nPropUnit ); 850cdf0e10cSrcweir return pItem; 851cdf0e10cSrcweir } 852cdf0e10cSrcweir 853cdf0e10cSrcweir // ----------------------------------------------------------------------- 854cdf0e10cSrcweir 855cdf0e10cSrcweir int SvxFontHeightItem::operator==( const SfxPoolItem& rItem ) const 856cdf0e10cSrcweir { 857cdf0e10cSrcweir DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" ); 858cdf0e10cSrcweir return GetHeight() == ((SvxFontHeightItem&)rItem).GetHeight() && 859cdf0e10cSrcweir GetProp() == ((SvxFontHeightItem&)rItem).GetProp() && 860cdf0e10cSrcweir GetPropUnit() == ((SvxFontHeightItem&)rItem).GetPropUnit(); 861cdf0e10cSrcweir } 862cdf0e10cSrcweir 863cdf0e10cSrcweir /*-----------------13.03.98 14:53------------------- 864cdf0e10cSrcweir 865cdf0e10cSrcweir --------------------------------------------------*/ 866cdf0e10cSrcweir sal_Bool SvxFontHeightItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const 867cdf0e10cSrcweir { 868cdf0e10cSrcweir // In StarOne sind im uno::Any immer 1/100mm. Ueber die MemberId wird 869cdf0e10cSrcweir // gesteuert, ob der Wert im Item 1/100mm oder Twips sind. 870cdf0e10cSrcweir 871cdf0e10cSrcweir sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); 872cdf0e10cSrcweir nMemberId &= ~CONVERT_TWIPS; 873cdf0e10cSrcweir switch( nMemberId ) 874cdf0e10cSrcweir { 875cdf0e10cSrcweir case 0: 876cdf0e10cSrcweir { 877cdf0e10cSrcweir ::com::sun::star::frame::status::FontHeight aFontHeight; 878cdf0e10cSrcweir 879cdf0e10cSrcweir // Point (also Twips) sind gefragt, 880cdf0e10cSrcweir // also umrechnen, wenn CONVERT_TWIPS nicht gesetzt ist 881cdf0e10cSrcweir if( bConvert ) 882cdf0e10cSrcweir { 883cdf0e10cSrcweir long nTwips = bConvert ? nHeight : MM100_TO_TWIP_UNSIGNED(nHeight); 884cdf0e10cSrcweir aFontHeight.Height = (float)( nTwips / 20.0 ); 885cdf0e10cSrcweir } 886cdf0e10cSrcweir else 887cdf0e10cSrcweir { 888cdf0e10cSrcweir double fPoints = MM100_TO_TWIP_UNSIGNED(nHeight) / 20.0; 889cdf0e10cSrcweir float fRoundPoints = 890cdf0e10cSrcweir static_cast<float>(::rtl::math::round(fPoints, 1)); 891cdf0e10cSrcweir aFontHeight.Height = fRoundPoints; 892cdf0e10cSrcweir } 893cdf0e10cSrcweir 894cdf0e10cSrcweir aFontHeight.Prop = (sal_Int16)(SFX_MAPUNIT_RELATIVE == ePropUnit ? nProp : 100); 895cdf0e10cSrcweir 896cdf0e10cSrcweir float fRet = (float)(short)nProp; 897cdf0e10cSrcweir switch( ePropUnit ) 898cdf0e10cSrcweir { 899cdf0e10cSrcweir case SFX_MAPUNIT_RELATIVE: 900cdf0e10cSrcweir fRet = 0.; 901cdf0e10cSrcweir break; 902cdf0e10cSrcweir case SFX_MAPUNIT_100TH_MM: 903cdf0e10cSrcweir fRet = MM100_TO_TWIP(fRet); 904cdf0e10cSrcweir fRet /= 20.; 905cdf0e10cSrcweir break; 906cdf0e10cSrcweir case SFX_MAPUNIT_POINT: 907cdf0e10cSrcweir 908cdf0e10cSrcweir break; 909cdf0e10cSrcweir case SFX_MAPUNIT_TWIP: 910cdf0e10cSrcweir fRet /= 20.; 911cdf0e10cSrcweir break; 912cdf0e10cSrcweir default: ;//prevent warning 913cdf0e10cSrcweir } 914cdf0e10cSrcweir aFontHeight.Diff = fRet; 915cdf0e10cSrcweir rVal <<= aFontHeight; 916cdf0e10cSrcweir } 917cdf0e10cSrcweir break; 918cdf0e10cSrcweir case MID_FONTHEIGHT: 919cdf0e10cSrcweir { 920cdf0e10cSrcweir // Point (also Twips) sind gefragt, 921cdf0e10cSrcweir // also umrechnen, wenn CONVERT_TWIPS nicht gesetzt ist 922cdf0e10cSrcweir if( bConvert ) 923cdf0e10cSrcweir { 924cdf0e10cSrcweir long nTwips = bConvert ? nHeight : MM100_TO_TWIP_UNSIGNED(nHeight); 925cdf0e10cSrcweir rVal <<= (float)( nTwips / 20.0 ); 926cdf0e10cSrcweir } 927cdf0e10cSrcweir else 928cdf0e10cSrcweir { 929cdf0e10cSrcweir double fPoints = MM100_TO_TWIP_UNSIGNED(nHeight) / 20.0; 930cdf0e10cSrcweir float fRoundPoints = 931cdf0e10cSrcweir static_cast<float>(::rtl::math::round(fPoints, 1)); 932cdf0e10cSrcweir rVal <<= fRoundPoints; 933cdf0e10cSrcweir } 934cdf0e10cSrcweir } 935cdf0e10cSrcweir break; 936cdf0e10cSrcweir case MID_FONTHEIGHT_PROP: 937cdf0e10cSrcweir rVal <<= (sal_Int16)(SFX_MAPUNIT_RELATIVE == ePropUnit ? nProp : 100); 938cdf0e10cSrcweir break; 939cdf0e10cSrcweir case MID_FONTHEIGHT_DIFF: 940cdf0e10cSrcweir { 941cdf0e10cSrcweir float fRet = (float)(short)nProp; 942cdf0e10cSrcweir switch( ePropUnit ) 943cdf0e10cSrcweir { 944cdf0e10cSrcweir case SFX_MAPUNIT_RELATIVE: 945cdf0e10cSrcweir fRet = 0.; 946cdf0e10cSrcweir break; 947cdf0e10cSrcweir case SFX_MAPUNIT_100TH_MM: 948cdf0e10cSrcweir fRet = MM100_TO_TWIP(fRet); 949cdf0e10cSrcweir fRet /= 20.; 950cdf0e10cSrcweir break; 951cdf0e10cSrcweir case SFX_MAPUNIT_POINT: 952cdf0e10cSrcweir 953cdf0e10cSrcweir break; 954cdf0e10cSrcweir case SFX_MAPUNIT_TWIP: 955cdf0e10cSrcweir fRet /= 20.; 956cdf0e10cSrcweir break; 957cdf0e10cSrcweir default: ;//prevent warning 958cdf0e10cSrcweir } 959cdf0e10cSrcweir rVal <<= fRet; 960cdf0e10cSrcweir } 961cdf0e10cSrcweir break; 962cdf0e10cSrcweir } 963cdf0e10cSrcweir return sal_True; 964cdf0e10cSrcweir } 965cdf0e10cSrcweir /* -----------------01.07.98 13:43------------------- 966cdf0e10cSrcweir * Relative Abweichung aus der Hoehe herausrechnen 967cdf0e10cSrcweir * --------------------------------------------------*/ 968cdf0e10cSrcweir sal_uInt32 lcl_GetRealHeight_Impl(sal_uInt32 nHeight, sal_uInt16 nProp, SfxMapUnit eProp, sal_Bool bCoreInTwip) 969cdf0e10cSrcweir { 970cdf0e10cSrcweir sal_uInt32 nRet = nHeight; 971cdf0e10cSrcweir short nDiff = 0; 972cdf0e10cSrcweir switch( eProp ) 973cdf0e10cSrcweir { 974cdf0e10cSrcweir case SFX_MAPUNIT_RELATIVE: 975cdf0e10cSrcweir nRet *= 100; 976cdf0e10cSrcweir nRet /= nProp; 977cdf0e10cSrcweir break; 978cdf0e10cSrcweir case SFX_MAPUNIT_POINT: 979cdf0e10cSrcweir { 980cdf0e10cSrcweir short nTemp = (short)nProp; 981cdf0e10cSrcweir nDiff = nTemp * 20; 982cdf0e10cSrcweir if(!bCoreInTwip) 983cdf0e10cSrcweir nDiff = (short)TWIP_TO_MM100((long)(nDiff)); 984cdf0e10cSrcweir } 985cdf0e10cSrcweir break; 986cdf0e10cSrcweir case SFX_MAPUNIT_100TH_MM: 987cdf0e10cSrcweir //dann ist die Core doch wohl auch in 1/100 mm 988cdf0e10cSrcweir nDiff = (short)nProp; 989cdf0e10cSrcweir break; 990cdf0e10cSrcweir case SFX_MAPUNIT_TWIP: 991cdf0e10cSrcweir // hier doch sicher TWIP 992cdf0e10cSrcweir nDiff = ((short)nProp); 993cdf0e10cSrcweir break; 994cdf0e10cSrcweir default: ;//prevent warning 995cdf0e10cSrcweir } 996cdf0e10cSrcweir nRet -= nDiff; 997cdf0e10cSrcweir 998cdf0e10cSrcweir return nRet; 999cdf0e10cSrcweir } 1000cdf0e10cSrcweir 1001cdf0e10cSrcweir /*-----------------13.03.98 14:53------------------- 1002cdf0e10cSrcweir 1003cdf0e10cSrcweir --------------------------------------------------*/ 1004cdf0e10cSrcweir sal_Bool SvxFontHeightItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) 1005cdf0e10cSrcweir { 1006cdf0e10cSrcweir sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); 1007cdf0e10cSrcweir nMemberId &= ~CONVERT_TWIPS; 1008cdf0e10cSrcweir switch( nMemberId ) 1009cdf0e10cSrcweir { 1010cdf0e10cSrcweir case 0: 1011cdf0e10cSrcweir { 1012cdf0e10cSrcweir ::com::sun::star::frame::status::FontHeight aFontHeight; 1013cdf0e10cSrcweir if ( rVal >>= aFontHeight ) 1014cdf0e10cSrcweir { 1015cdf0e10cSrcweir // Height 1016cdf0e10cSrcweir ePropUnit = SFX_MAPUNIT_RELATIVE; 1017cdf0e10cSrcweir nProp = 100; 1018cdf0e10cSrcweir double fPoint = aFontHeight.Height; 1019cdf0e10cSrcweir if( fPoint < 0. || fPoint > 10000. ) 1020cdf0e10cSrcweir return sal_False; 1021cdf0e10cSrcweir 1022cdf0e10cSrcweir nHeight = (long)( fPoint * 20.0 + 0.5 ); // Twips 1023cdf0e10cSrcweir if (!bConvert) 1024cdf0e10cSrcweir nHeight = TWIP_TO_MM100_UNSIGNED(nHeight); // umrechnen, wenn das Item 1/100mm enthaelt 1025cdf0e10cSrcweir 1026cdf0e10cSrcweir nProp = aFontHeight.Prop; 1027cdf0e10cSrcweir } 1028cdf0e10cSrcweir else 1029cdf0e10cSrcweir return sal_False; 1030cdf0e10cSrcweir } 1031cdf0e10cSrcweir break; 1032cdf0e10cSrcweir case MID_FONTHEIGHT: 1033cdf0e10cSrcweir { 1034cdf0e10cSrcweir ePropUnit = SFX_MAPUNIT_RELATIVE; 1035cdf0e10cSrcweir nProp = 100; 1036cdf0e10cSrcweir double fPoint = 0; 1037cdf0e10cSrcweir if(!(rVal >>= fPoint)) 1038cdf0e10cSrcweir { 1039cdf0e10cSrcweir sal_Int32 nValue = 0; 1040cdf0e10cSrcweir if(!(rVal >>= nValue)) 1041cdf0e10cSrcweir return sal_False; 1042cdf0e10cSrcweir fPoint = (float)nValue; 1043cdf0e10cSrcweir } 1044cdf0e10cSrcweir if(fPoint < 0. || fPoint > 10000.) 1045cdf0e10cSrcweir return sal_False; 1046cdf0e10cSrcweir 1047cdf0e10cSrcweir nHeight = (long)( fPoint * 20.0 + 0.5 ); // Twips 1048cdf0e10cSrcweir if (!bConvert) 1049cdf0e10cSrcweir nHeight = TWIP_TO_MM100_UNSIGNED(nHeight); // umrechnen, wenn das Item 1/100mm enthaelt 1050cdf0e10cSrcweir } 1051cdf0e10cSrcweir break; 1052cdf0e10cSrcweir case MID_FONTHEIGHT_PROP: 1053cdf0e10cSrcweir { 1054cdf0e10cSrcweir sal_Int16 nNew = sal_Int16(); 1055cdf0e10cSrcweir if(!(rVal >>= nNew)) 1056cdf0e10cSrcweir return sal_True; 1057cdf0e10cSrcweir 1058cdf0e10cSrcweir nHeight = lcl_GetRealHeight_Impl(nHeight, nProp, ePropUnit, bConvert); 1059cdf0e10cSrcweir 1060cdf0e10cSrcweir nHeight *= nNew; 1061cdf0e10cSrcweir nHeight /= 100; 1062cdf0e10cSrcweir nProp = nNew; 1063cdf0e10cSrcweir ePropUnit = SFX_MAPUNIT_RELATIVE; 1064cdf0e10cSrcweir } 1065cdf0e10cSrcweir break; 1066cdf0e10cSrcweir case MID_FONTHEIGHT_DIFF: 1067cdf0e10cSrcweir { 1068cdf0e10cSrcweir nHeight = lcl_GetRealHeight_Impl(nHeight, nProp, ePropUnit, bConvert); 1069cdf0e10cSrcweir float fValue = 0; 1070cdf0e10cSrcweir if(!(rVal >>= fValue)) 1071cdf0e10cSrcweir { 1072cdf0e10cSrcweir sal_Int32 nValue = 0; 1073cdf0e10cSrcweir if(!(rVal >>= nValue)) 1074cdf0e10cSrcweir return sal_False; 1075cdf0e10cSrcweir fValue = (float)nValue; 1076cdf0e10cSrcweir } 1077cdf0e10cSrcweir sal_Int16 nCoreDiffValue = (sal_Int16)(fValue * 20.); 1078cdf0e10cSrcweir nHeight += bConvert ? nCoreDiffValue : TWIP_TO_MM100(nCoreDiffValue); 1079cdf0e10cSrcweir nProp = (sal_uInt16)((sal_Int16)fValue); 1080cdf0e10cSrcweir ePropUnit = SFX_MAPUNIT_POINT; 1081cdf0e10cSrcweir } 1082cdf0e10cSrcweir break; 1083cdf0e10cSrcweir } 1084cdf0e10cSrcweir return sal_True; 1085cdf0e10cSrcweir } 1086cdf0e10cSrcweir 1087cdf0e10cSrcweir //------------------------------------------------------------------------ 1088cdf0e10cSrcweir 1089cdf0e10cSrcweir SfxItemPresentation SvxFontHeightItem::GetPresentation 1090cdf0e10cSrcweir ( 1091cdf0e10cSrcweir SfxItemPresentation ePres, 1092cdf0e10cSrcweir SfxMapUnit eCoreUnit, 1093cdf0e10cSrcweir SfxMapUnit /*ePresUnit*/, 1094cdf0e10cSrcweir XubString& rText, const IntlWrapper *pIntl 1095cdf0e10cSrcweir ) const 1096cdf0e10cSrcweir { 1097cdf0e10cSrcweir #ifndef SVX_LIGHT 1098cdf0e10cSrcweir switch ( ePres ) 1099cdf0e10cSrcweir { 1100cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NONE: 1101cdf0e10cSrcweir rText.Erase(); 1102cdf0e10cSrcweir return ePres; 1103cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NAMELESS: 1104cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_COMPLETE: 1105cdf0e10cSrcweir { 1106cdf0e10cSrcweir if( SFX_MAPUNIT_RELATIVE != ePropUnit ) 1107cdf0e10cSrcweir { 1108cdf0e10cSrcweir ( rText = String::CreateFromInt32( (short)nProp ) ) += 1109cdf0e10cSrcweir EE_RESSTR( GetMetricId( ePropUnit ) ); 1110cdf0e10cSrcweir if( 0 <= (short)nProp ) 1111cdf0e10cSrcweir rText.Insert( sal_Unicode('+'), 0 ); 1112cdf0e10cSrcweir } 1113cdf0e10cSrcweir else if( 100 == nProp ) 1114cdf0e10cSrcweir { 1115cdf0e10cSrcweir rText = GetMetricText( (long)nHeight, 1116cdf0e10cSrcweir eCoreUnit, SFX_MAPUNIT_POINT, pIntl ); 1117cdf0e10cSrcweir rText += EE_RESSTR(GetMetricId(SFX_MAPUNIT_POINT)); 1118cdf0e10cSrcweir } 1119cdf0e10cSrcweir else 1120cdf0e10cSrcweir ( rText = String::CreateFromInt32( nProp )) += sal_Unicode('%'); 1121cdf0e10cSrcweir return ePres; 1122cdf0e10cSrcweir } 1123cdf0e10cSrcweir default: ; //prevent warning 1124cdf0e10cSrcweir } 1125cdf0e10cSrcweir #endif 1126cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_NONE; 1127cdf0e10cSrcweir } 1128cdf0e10cSrcweir 1129cdf0e10cSrcweir // ----------------------------------------------------------------------- 1130cdf0e10cSrcweir 1131cdf0e10cSrcweir sal_uInt16 SvxFontHeightItem::GetVersion(sal_uInt16 nFileVersion) const 1132cdf0e10cSrcweir { 1133cdf0e10cSrcweir return (nFileVersion <= SOFFICE_FILEFORMAT_40) 1134cdf0e10cSrcweir ? FONTHEIGHT_16_VERSION 1135cdf0e10cSrcweir : FONTHEIGHT_UNIT_VERSION; 1136cdf0e10cSrcweir } 1137cdf0e10cSrcweir 1138cdf0e10cSrcweir // ----------------------------------------------------------------------- 1139cdf0e10cSrcweir 1140cdf0e10cSrcweir int SvxFontHeightItem::ScaleMetrics( long nMult, long nDiv ) 1141cdf0e10cSrcweir { 1142cdf0e10cSrcweir nHeight = (sal_uInt32)Scale( nHeight, nMult, nDiv ); 1143cdf0e10cSrcweir return 1; 1144cdf0e10cSrcweir } 1145cdf0e10cSrcweir 1146cdf0e10cSrcweir // ----------------------------------------------------------------------- 1147cdf0e10cSrcweir 1148cdf0e10cSrcweir int SvxFontHeightItem::HasMetrics() const 1149cdf0e10cSrcweir { 1150cdf0e10cSrcweir return 1; 1151cdf0e10cSrcweir } 1152cdf0e10cSrcweir 1153cdf0e10cSrcweir void SvxFontHeightItem::SetHeight( sal_uInt32 nNewHeight, const sal_uInt16 nNewProp, 1154cdf0e10cSrcweir SfxMapUnit eUnit ) 1155cdf0e10cSrcweir { 1156cdf0e10cSrcweir DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" ); 1157cdf0e10cSrcweir 1158cdf0e10cSrcweir #ifndef SVX_LIGHT 1159cdf0e10cSrcweir if( SFX_MAPUNIT_RELATIVE != eUnit ) 1160cdf0e10cSrcweir nHeight = nNewHeight + ::ItemToControl( (short)nNewProp, eUnit, 1161cdf0e10cSrcweir SFX_FUNIT_TWIP ); 1162cdf0e10cSrcweir else 1163cdf0e10cSrcweir #endif // !SVX_LIGHT 1164cdf0e10cSrcweir if( 100 != nNewProp ) 1165cdf0e10cSrcweir nHeight = sal_uInt32(( nNewHeight * nNewProp ) / 100 ); 1166cdf0e10cSrcweir else 1167cdf0e10cSrcweir nHeight = nNewHeight; 1168cdf0e10cSrcweir 1169cdf0e10cSrcweir nProp = nNewProp; 1170cdf0e10cSrcweir ePropUnit = eUnit; 1171cdf0e10cSrcweir } 1172cdf0e10cSrcweir 1173cdf0e10cSrcweir void SvxFontHeightItem::SetHeight( sal_uInt32 nNewHeight, sal_uInt16 nNewProp, 1174cdf0e10cSrcweir SfxMapUnit eMetric, SfxMapUnit eCoreMetric ) 1175cdf0e10cSrcweir { 1176cdf0e10cSrcweir DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" ); 1177cdf0e10cSrcweir 1178cdf0e10cSrcweir #ifndef SVX_LIGHT 1179cdf0e10cSrcweir if( SFX_MAPUNIT_RELATIVE != eMetric ) 1180cdf0e10cSrcweir nHeight = nNewHeight + 1181cdf0e10cSrcweir ::ControlToItem( ::ItemToControl((short)nNewProp, eMetric, 1182cdf0e10cSrcweir SFX_FUNIT_TWIP ), SFX_FUNIT_TWIP, 1183cdf0e10cSrcweir eCoreMetric ); 1184cdf0e10cSrcweir else 1185cdf0e10cSrcweir #endif // !SVX_LIGHT 1186cdf0e10cSrcweir if( 100 != nNewProp ) 1187cdf0e10cSrcweir nHeight = sal_uInt32(( nNewHeight * nNewProp ) / 100 ); 1188cdf0e10cSrcweir else 1189cdf0e10cSrcweir nHeight = nNewHeight; 1190cdf0e10cSrcweir 1191cdf0e10cSrcweir nProp = nNewProp; 1192cdf0e10cSrcweir ePropUnit = eMetric; 1193cdf0e10cSrcweir } 1194cdf0e10cSrcweir 1195cdf0e10cSrcweir // class SvxFontWidthItem ----------------------------------------------- 1196cdf0e10cSrcweir 1197cdf0e10cSrcweir SvxFontWidthItem::SvxFontWidthItem( const sal_uInt16 nSz, const sal_uInt16 nPrp, const sal_uInt16 nId ) : 1198cdf0e10cSrcweir SfxPoolItem( nId ) 1199cdf0e10cSrcweir { 1200cdf0e10cSrcweir nWidth = nSz; 1201cdf0e10cSrcweir nProp = nPrp; 1202cdf0e10cSrcweir } 1203cdf0e10cSrcweir 1204cdf0e10cSrcweir // ----------------------------------------------------------------------- 1205cdf0e10cSrcweir 1206cdf0e10cSrcweir SfxPoolItem* SvxFontWidthItem::Clone( SfxItemPool * ) const 1207cdf0e10cSrcweir { 1208cdf0e10cSrcweir return new SvxFontWidthItem( *this ); 1209cdf0e10cSrcweir } 1210cdf0e10cSrcweir 1211cdf0e10cSrcweir // ----------------------------------------------------------------------- 1212cdf0e10cSrcweir 1213cdf0e10cSrcweir SvStream& SvxFontWidthItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const 1214cdf0e10cSrcweir { 1215cdf0e10cSrcweir rStrm << GetWidth() << GetProp(); 1216cdf0e10cSrcweir return rStrm; 1217cdf0e10cSrcweir } 1218cdf0e10cSrcweir 1219cdf0e10cSrcweir // ----------------------------------------------------------------------- 1220cdf0e10cSrcweir 1221cdf0e10cSrcweir int SvxFontWidthItem::ScaleMetrics( long nMult, long nDiv ) 1222cdf0e10cSrcweir { 1223cdf0e10cSrcweir nWidth = (sal_uInt16)Scale( nWidth, nMult, nDiv ); 1224cdf0e10cSrcweir return 1; 1225cdf0e10cSrcweir } 1226cdf0e10cSrcweir 1227cdf0e10cSrcweir // ----------------------------------------------------------------------- 1228cdf0e10cSrcweir 1229cdf0e10cSrcweir int SvxFontWidthItem::HasMetrics() const 1230cdf0e10cSrcweir { 1231cdf0e10cSrcweir return 1; 1232cdf0e10cSrcweir } 1233cdf0e10cSrcweir 1234cdf0e10cSrcweir // ----------------------------------------------------------------------- 1235cdf0e10cSrcweir 1236cdf0e10cSrcweir SfxPoolItem* SvxFontWidthItem::Create( SvStream& rStrm, 1237cdf0e10cSrcweir sal_uInt16 /*nVersion*/ ) const 1238cdf0e10cSrcweir { 1239cdf0e10cSrcweir sal_uInt16 nS; 1240cdf0e10cSrcweir sal_uInt16 nP; 1241cdf0e10cSrcweir 1242cdf0e10cSrcweir rStrm >> nS; 1243cdf0e10cSrcweir rStrm >> nP; 1244cdf0e10cSrcweir SvxFontWidthItem* pItem = new SvxFontWidthItem( 0, nP, Which() ); 1245cdf0e10cSrcweir pItem->SetWidthValue( nS ); 1246cdf0e10cSrcweir return pItem; 1247cdf0e10cSrcweir } 1248cdf0e10cSrcweir 1249cdf0e10cSrcweir // ----------------------------------------------------------------------- 1250cdf0e10cSrcweir 1251cdf0e10cSrcweir int SvxFontWidthItem::operator==( const SfxPoolItem& rItem ) const 1252cdf0e10cSrcweir { 1253cdf0e10cSrcweir DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" ); 1254cdf0e10cSrcweir return GetWidth() == ((SvxFontWidthItem&)rItem).GetWidth() && 1255cdf0e10cSrcweir GetProp() == ((SvxFontWidthItem&)rItem).GetProp(); 1256cdf0e10cSrcweir } 1257cdf0e10cSrcweir 1258cdf0e10cSrcweir /*-----------------13.03.98 16:03------------------- 1259cdf0e10cSrcweir 1260cdf0e10cSrcweir --------------------------------------------------*/ 1261cdf0e10cSrcweir sal_Bool SvxFontWidthItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const 1262cdf0e10cSrcweir { 1263cdf0e10cSrcweir // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); 1264cdf0e10cSrcweir nMemberId &= ~CONVERT_TWIPS; 1265cdf0e10cSrcweir switch(nMemberId) 1266cdf0e10cSrcweir { 1267cdf0e10cSrcweir case MID_FONTWIDTH: 1268cdf0e10cSrcweir rVal <<= (sal_Int16)(nWidth); 1269cdf0e10cSrcweir break; 1270cdf0e10cSrcweir case MID_FONTWIDTH_PROP: 1271cdf0e10cSrcweir rVal <<= (sal_Int16)(nProp); 1272cdf0e10cSrcweir break; 1273cdf0e10cSrcweir } 1274cdf0e10cSrcweir return sal_True; 1275cdf0e10cSrcweir } 1276cdf0e10cSrcweir /*-----------------13.03.98 16:03------------------- 1277cdf0e10cSrcweir 1278cdf0e10cSrcweir --------------------------------------------------*/ 1279cdf0e10cSrcweir sal_Bool SvxFontWidthItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) 1280cdf0e10cSrcweir { 1281cdf0e10cSrcweir // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); 1282cdf0e10cSrcweir nMemberId &= ~CONVERT_TWIPS; 1283cdf0e10cSrcweir sal_Int16 nVal = sal_Int16(); 1284cdf0e10cSrcweir if(!(rVal >>= nVal)) 1285cdf0e10cSrcweir return sal_False; 1286cdf0e10cSrcweir 1287cdf0e10cSrcweir switch(nMemberId) 1288cdf0e10cSrcweir { 1289cdf0e10cSrcweir case MID_FONTWIDTH: 1290cdf0e10cSrcweir nProp = nVal; 1291cdf0e10cSrcweir break; 1292cdf0e10cSrcweir case MID_FONTWIDTH_PROP: 1293cdf0e10cSrcweir nWidth = nVal; 1294cdf0e10cSrcweir break; 1295cdf0e10cSrcweir } 1296cdf0e10cSrcweir return sal_True; 1297cdf0e10cSrcweir } 1298cdf0e10cSrcweir 1299cdf0e10cSrcweir //------------------------------------------------------------------------ 1300cdf0e10cSrcweir 1301cdf0e10cSrcweir SfxItemPresentation SvxFontWidthItem::GetPresentation 1302cdf0e10cSrcweir ( 1303cdf0e10cSrcweir SfxItemPresentation ePres, 1304cdf0e10cSrcweir SfxMapUnit eCoreUnit, 1305cdf0e10cSrcweir SfxMapUnit /*ePresUnit*/, 1306cdf0e10cSrcweir XubString& rText, const IntlWrapper *pIntl 1307cdf0e10cSrcweir ) const 1308cdf0e10cSrcweir { 1309cdf0e10cSrcweir #ifndef SVX_LIGHT 1310cdf0e10cSrcweir switch ( ePres ) 1311cdf0e10cSrcweir { 1312cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NONE: 1313cdf0e10cSrcweir rText.Erase(); 1314cdf0e10cSrcweir return ePres; 1315cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NAMELESS: 1316cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_COMPLETE: 1317cdf0e10cSrcweir { 1318cdf0e10cSrcweir if ( 100 == nProp ) 1319cdf0e10cSrcweir { 1320cdf0e10cSrcweir rText = GetMetricText( (long)nWidth, 1321cdf0e10cSrcweir eCoreUnit, SFX_MAPUNIT_POINT, pIntl ); 1322cdf0e10cSrcweir rText += EE_RESSTR(GetMetricId(SFX_MAPUNIT_POINT)); 1323cdf0e10cSrcweir } 1324cdf0e10cSrcweir else 1325cdf0e10cSrcweir ( rText = String::CreateFromInt32( nProp )) += sal_Unicode('%'); 1326cdf0e10cSrcweir return ePres; 1327cdf0e10cSrcweir } 1328cdf0e10cSrcweir default: ; //prevent warning 1329cdf0e10cSrcweir } 1330cdf0e10cSrcweir #endif 1331cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_NONE; 1332cdf0e10cSrcweir } 1333cdf0e10cSrcweir 1334cdf0e10cSrcweir // class SvxTextLineItem ------------------------------------------------ 1335cdf0e10cSrcweir 1336cdf0e10cSrcweir SvxTextLineItem::SvxTextLineItem( const FontUnderline eSt, const sal_uInt16 nId ) 1337cdf0e10cSrcweir : SfxEnumItem( nId, (sal_uInt16)eSt ), mColor( COL_TRANSPARENT ) 1338cdf0e10cSrcweir { 1339cdf0e10cSrcweir } 1340cdf0e10cSrcweir 1341cdf0e10cSrcweir // ----------------------------------------------------------------------- 1342cdf0e10cSrcweir 1343cdf0e10cSrcweir int SvxTextLineItem::HasBoolValue() const 1344cdf0e10cSrcweir { 1345cdf0e10cSrcweir return sal_True; 1346cdf0e10cSrcweir } 1347cdf0e10cSrcweir 1348cdf0e10cSrcweir // ----------------------------------------------------------------------- 1349cdf0e10cSrcweir 1350cdf0e10cSrcweir sal_Bool SvxTextLineItem::GetBoolValue() const 1351cdf0e10cSrcweir { 1352cdf0e10cSrcweir return (FontUnderline)GetValue() != UNDERLINE_NONE; 1353cdf0e10cSrcweir } 1354cdf0e10cSrcweir 1355cdf0e10cSrcweir // ----------------------------------------------------------------------- 1356cdf0e10cSrcweir 1357cdf0e10cSrcweir void SvxTextLineItem::SetBoolValue( sal_Bool bVal ) 1358cdf0e10cSrcweir { 1359cdf0e10cSrcweir SetValue( (sal_uInt16)(bVal ? UNDERLINE_SINGLE : UNDERLINE_NONE) ); 1360cdf0e10cSrcweir } 1361cdf0e10cSrcweir 1362cdf0e10cSrcweir // ----------------------------------------------------------------------- 1363cdf0e10cSrcweir 1364cdf0e10cSrcweir SfxPoolItem* SvxTextLineItem::Clone( SfxItemPool * ) const 1365cdf0e10cSrcweir { 1366cdf0e10cSrcweir SvxTextLineItem* pNew = new SvxTextLineItem( *this ); 1367cdf0e10cSrcweir pNew->SetColor( GetColor() ); 1368cdf0e10cSrcweir return pNew; 1369cdf0e10cSrcweir } 1370cdf0e10cSrcweir 1371cdf0e10cSrcweir // ----------------------------------------------------------------------- 1372cdf0e10cSrcweir 1373cdf0e10cSrcweir sal_uInt16 SvxTextLineItem::GetValueCount() const 1374cdf0e10cSrcweir { 1375cdf0e10cSrcweir return UNDERLINE_DOTTED + 1; // auch UNDERLINE_NONE geh"ort dazu 1376cdf0e10cSrcweir } 1377cdf0e10cSrcweir 1378cdf0e10cSrcweir // ----------------------------------------------------------------------- 1379cdf0e10cSrcweir 1380cdf0e10cSrcweir SvStream& SvxTextLineItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const 1381cdf0e10cSrcweir { 1382cdf0e10cSrcweir rStrm << (sal_uInt8)GetValue(); 1383cdf0e10cSrcweir return rStrm; 1384cdf0e10cSrcweir } 1385cdf0e10cSrcweir 1386cdf0e10cSrcweir // ----------------------------------------------------------------------- 1387cdf0e10cSrcweir 1388cdf0e10cSrcweir SfxPoolItem* SvxTextLineItem::Create(SvStream& rStrm, sal_uInt16) const 1389cdf0e10cSrcweir { 1390cdf0e10cSrcweir sal_uInt8 nState; 1391cdf0e10cSrcweir rStrm >> nState; 1392cdf0e10cSrcweir return new SvxTextLineItem( (FontUnderline)nState, Which() ); 1393cdf0e10cSrcweir } 1394cdf0e10cSrcweir 1395cdf0e10cSrcweir //------------------------------------------------------------------------ 1396cdf0e10cSrcweir 1397cdf0e10cSrcweir SfxItemPresentation SvxTextLineItem::GetPresentation 1398cdf0e10cSrcweir ( 1399cdf0e10cSrcweir SfxItemPresentation ePres, 1400cdf0e10cSrcweir SfxMapUnit /*eCoreUnit*/, 1401cdf0e10cSrcweir SfxMapUnit /*ePresUnit*/, 1402cdf0e10cSrcweir XubString& rText, const IntlWrapper * /*pIntl*/ 1403cdf0e10cSrcweir ) const 1404cdf0e10cSrcweir { 1405cdf0e10cSrcweir #ifndef SVX_LIGHT 1406cdf0e10cSrcweir switch ( ePres ) 1407cdf0e10cSrcweir { 1408cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NONE: 1409cdf0e10cSrcweir rText.Erase(); 1410cdf0e10cSrcweir return ePres; 1411cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NAMELESS: 1412cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_COMPLETE: 1413cdf0e10cSrcweir rText = GetValueTextByPos( GetValue() ); 1414cdf0e10cSrcweir if( !mColor.GetTransparency() ) 1415cdf0e10cSrcweir ( rText += cpDelim ) += ::GetColorString( mColor ); 1416cdf0e10cSrcweir return ePres; 1417cdf0e10cSrcweir default: ; //prevent warning 1418cdf0e10cSrcweir } 1419cdf0e10cSrcweir #endif 1420cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_NONE; 1421cdf0e10cSrcweir } 1422cdf0e10cSrcweir 1423cdf0e10cSrcweir // ----------------------------------------------------------------------- 1424cdf0e10cSrcweir 1425cdf0e10cSrcweir XubString SvxTextLineItem::GetValueTextByPos( sal_uInt16 /*nPos*/ ) const 1426cdf0e10cSrcweir { 1427cdf0e10cSrcweir DBG_ERROR("SvxTextLineItem::GetValueTextByPos: Pure virtual method"); 1428cdf0e10cSrcweir return XubString(); 1429cdf0e10cSrcweir } 1430cdf0e10cSrcweir 1431cdf0e10cSrcweir /*-----------------13.03.98 16:25------------------- 1432cdf0e10cSrcweir 1433cdf0e10cSrcweir --------------------------------------------------*/ 1434cdf0e10cSrcweir sal_Bool SvxTextLineItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const 1435cdf0e10cSrcweir { 1436cdf0e10cSrcweir // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); 1437cdf0e10cSrcweir nMemberId &= ~CONVERT_TWIPS; 1438cdf0e10cSrcweir switch(nMemberId) 1439cdf0e10cSrcweir { 1440cdf0e10cSrcweir case MID_TEXTLINED: 1441cdf0e10cSrcweir rVal = Bool2Any(GetBoolValue()); 1442cdf0e10cSrcweir break; 1443cdf0e10cSrcweir case MID_TL_STYLE: 1444cdf0e10cSrcweir rVal <<= (sal_Int16)(GetValue()); 1445cdf0e10cSrcweir break; 1446cdf0e10cSrcweir case MID_TL_COLOR: 1447cdf0e10cSrcweir rVal <<= (sal_Int32)( mColor.GetColor() ); 1448cdf0e10cSrcweir break; 1449cdf0e10cSrcweir case MID_TL_HASCOLOR: 1450cdf0e10cSrcweir rVal = Bool2Any( !mColor.GetTransparency() ); 1451cdf0e10cSrcweir break; 1452cdf0e10cSrcweir } 1453cdf0e10cSrcweir return sal_True; 1454cdf0e10cSrcweir 1455cdf0e10cSrcweir } 1456cdf0e10cSrcweir /*-----------------13.03.98 16:28------------------- 1457cdf0e10cSrcweir 1458cdf0e10cSrcweir --------------------------------------------------*/ 1459cdf0e10cSrcweir sal_Bool SvxTextLineItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) 1460cdf0e10cSrcweir { 1461cdf0e10cSrcweir // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); 1462cdf0e10cSrcweir nMemberId &= ~CONVERT_TWIPS; 1463cdf0e10cSrcweir sal_Bool bRet = sal_True; 1464cdf0e10cSrcweir switch(nMemberId) 1465cdf0e10cSrcweir { 1466cdf0e10cSrcweir case MID_TEXTLINED: 1467cdf0e10cSrcweir SetBoolValue(Any2Bool(rVal)); 1468cdf0e10cSrcweir break; 1469cdf0e10cSrcweir case MID_TL_STYLE: 1470cdf0e10cSrcweir { 1471cdf0e10cSrcweir sal_Int32 nValue = 0; 1472cdf0e10cSrcweir if(!(rVal >>= nValue)) 1473cdf0e10cSrcweir bRet = sal_False; 1474cdf0e10cSrcweir else 1475cdf0e10cSrcweir SetValue((sal_Int16)nValue); 1476cdf0e10cSrcweir } 1477cdf0e10cSrcweir break; 1478cdf0e10cSrcweir case MID_TL_COLOR: 1479cdf0e10cSrcweir { 1480cdf0e10cSrcweir sal_Int32 nCol = 0; 1481cdf0e10cSrcweir if( !( rVal >>= nCol ) ) 1482cdf0e10cSrcweir bRet = sal_False; 1483cdf0e10cSrcweir else 1484cdf0e10cSrcweir { 1485cdf0e10cSrcweir // Keep transparence, because it contains the information 1486cdf0e10cSrcweir // whether the font color or the stored color should be used 1487cdf0e10cSrcweir sal_uInt8 nTrans = mColor.GetTransparency(); 1488cdf0e10cSrcweir mColor = Color( nCol ); 1489cdf0e10cSrcweir mColor.SetTransparency( nTrans ); 1490cdf0e10cSrcweir } 1491cdf0e10cSrcweir } 1492cdf0e10cSrcweir break; 1493cdf0e10cSrcweir case MID_TL_HASCOLOR: 1494cdf0e10cSrcweir mColor.SetTransparency( Any2Bool( rVal ) ? 0 : 0xff ); 1495cdf0e10cSrcweir break; 1496cdf0e10cSrcweir } 1497cdf0e10cSrcweir return bRet; 1498cdf0e10cSrcweir } 1499cdf0e10cSrcweir 1500cdf0e10cSrcweir int SvxTextLineItem::operator==( const SfxPoolItem& rItem ) const 1501cdf0e10cSrcweir { 1502cdf0e10cSrcweir DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" ); 1503cdf0e10cSrcweir return SfxEnumItem::operator==( rItem ) && 1504cdf0e10cSrcweir GetColor() == ((SvxTextLineItem&)rItem).GetColor(); 1505cdf0e10cSrcweir } 1506cdf0e10cSrcweir 1507cdf0e10cSrcweir // class SvxUnderlineItem ------------------------------------------------ 1508cdf0e10cSrcweir 1509cdf0e10cSrcweir SvxUnderlineItem::SvxUnderlineItem( const FontUnderline eSt, const sal_uInt16 nId ) 1510cdf0e10cSrcweir : SvxTextLineItem( eSt, nId ) 1511cdf0e10cSrcweir { 1512cdf0e10cSrcweir } 1513cdf0e10cSrcweir 1514cdf0e10cSrcweir //------------------------------------------------------------------------ 1515cdf0e10cSrcweir 1516cdf0e10cSrcweir SfxPoolItem* SvxUnderlineItem::Clone( SfxItemPool * ) const 1517cdf0e10cSrcweir { 1518cdf0e10cSrcweir SvxUnderlineItem* pNew = new SvxUnderlineItem( *this ); 1519cdf0e10cSrcweir pNew->SetColor( GetColor() ); 1520cdf0e10cSrcweir return pNew; 1521cdf0e10cSrcweir } 1522cdf0e10cSrcweir 1523cdf0e10cSrcweir // ----------------------------------------------------------------------- 1524cdf0e10cSrcweir 1525cdf0e10cSrcweir SfxPoolItem* SvxUnderlineItem::Create(SvStream& rStrm, sal_uInt16) const 1526cdf0e10cSrcweir { 1527cdf0e10cSrcweir sal_uInt8 nState; 1528cdf0e10cSrcweir rStrm >> nState; 1529cdf0e10cSrcweir return new SvxUnderlineItem( (FontUnderline)nState, Which() ); 1530cdf0e10cSrcweir } 1531cdf0e10cSrcweir 1532cdf0e10cSrcweir // ----------------------------------------------------------------------- 1533cdf0e10cSrcweir 1534cdf0e10cSrcweir XubString SvxUnderlineItem::GetValueTextByPos( sal_uInt16 nPos ) const 1535cdf0e10cSrcweir { 1536cdf0e10cSrcweir DBG_ASSERT( nPos <= (sal_uInt16)UNDERLINE_BOLDWAVE, "enum overflow!" ); 1537cdf0e10cSrcweir return EE_RESSTR( RID_SVXITEMS_UL_BEGIN + nPos ); 1538cdf0e10cSrcweir } 1539cdf0e10cSrcweir 1540cdf0e10cSrcweir // class SvxOverlineItem ------------------------------------------------ 1541cdf0e10cSrcweir 1542cdf0e10cSrcweir SvxOverlineItem::SvxOverlineItem( const FontUnderline eSt, const sal_uInt16 nId ) 1543cdf0e10cSrcweir : SvxTextLineItem( eSt, nId ) 1544cdf0e10cSrcweir { 1545cdf0e10cSrcweir } 1546cdf0e10cSrcweir 1547cdf0e10cSrcweir //------------------------------------------------------------------------ 1548cdf0e10cSrcweir 1549cdf0e10cSrcweir SfxPoolItem* SvxOverlineItem::Clone( SfxItemPool * ) const 1550cdf0e10cSrcweir { 1551cdf0e10cSrcweir SvxOverlineItem* pNew = new SvxOverlineItem( *this ); 1552cdf0e10cSrcweir pNew->SetColor( GetColor() ); 1553cdf0e10cSrcweir return pNew; 1554cdf0e10cSrcweir } 1555cdf0e10cSrcweir 1556cdf0e10cSrcweir // ----------------------------------------------------------------------- 1557cdf0e10cSrcweir 1558cdf0e10cSrcweir SfxPoolItem* SvxOverlineItem::Create(SvStream& rStrm, sal_uInt16) const 1559cdf0e10cSrcweir { 1560cdf0e10cSrcweir sal_uInt8 nState; 1561cdf0e10cSrcweir rStrm >> nState; 1562cdf0e10cSrcweir return new SvxOverlineItem( (FontUnderline)nState, Which() ); 1563cdf0e10cSrcweir } 1564cdf0e10cSrcweir 1565cdf0e10cSrcweir // ----------------------------------------------------------------------- 1566cdf0e10cSrcweir 1567cdf0e10cSrcweir XubString SvxOverlineItem::GetValueTextByPos( sal_uInt16 nPos ) const 1568cdf0e10cSrcweir { 1569cdf0e10cSrcweir DBG_ASSERT( nPos <= (sal_uInt16)UNDERLINE_BOLDWAVE, "enum overflow!" ); 1570cdf0e10cSrcweir return EE_RESSTR( RID_SVXITEMS_OL_BEGIN + nPos ); 1571cdf0e10cSrcweir } 1572cdf0e10cSrcweir 1573cdf0e10cSrcweir // class SvxCrossedOutItem ----------------------------------------------- 1574cdf0e10cSrcweir 1575cdf0e10cSrcweir SvxCrossedOutItem::SvxCrossedOutItem( const FontStrikeout eSt, const sal_uInt16 nId ) 1576cdf0e10cSrcweir : SfxEnumItem( nId, (sal_uInt16)eSt ) 1577cdf0e10cSrcweir { 1578cdf0e10cSrcweir } 1579cdf0e10cSrcweir 1580cdf0e10cSrcweir // ----------------------------------------------------------------------- 1581cdf0e10cSrcweir 1582cdf0e10cSrcweir int SvxCrossedOutItem::HasBoolValue() const 1583cdf0e10cSrcweir { 1584cdf0e10cSrcweir return sal_True; 1585cdf0e10cSrcweir } 1586cdf0e10cSrcweir 1587cdf0e10cSrcweir // ----------------------------------------------------------------------- 1588cdf0e10cSrcweir 1589cdf0e10cSrcweir sal_Bool SvxCrossedOutItem::GetBoolValue() const 1590cdf0e10cSrcweir { 1591cdf0e10cSrcweir return (FontStrikeout)GetValue() != STRIKEOUT_NONE; 1592cdf0e10cSrcweir } 1593cdf0e10cSrcweir 1594cdf0e10cSrcweir // ----------------------------------------------------------------------- 1595cdf0e10cSrcweir 1596cdf0e10cSrcweir void SvxCrossedOutItem::SetBoolValue( sal_Bool bVal ) 1597cdf0e10cSrcweir { 1598cdf0e10cSrcweir SetValue( (sal_uInt16)(bVal ? STRIKEOUT_SINGLE : STRIKEOUT_NONE) ); 1599cdf0e10cSrcweir } 1600cdf0e10cSrcweir 1601cdf0e10cSrcweir // ----------------------------------------------------------------------- 1602cdf0e10cSrcweir 1603cdf0e10cSrcweir sal_uInt16 SvxCrossedOutItem::GetValueCount() const 1604cdf0e10cSrcweir { 1605cdf0e10cSrcweir return STRIKEOUT_DOUBLE + 1; // auch STRIKEOUT_NONE geh"ort dazu 1606cdf0e10cSrcweir } 1607cdf0e10cSrcweir 1608cdf0e10cSrcweir // ----------------------------------------------------------------------- 1609cdf0e10cSrcweir 1610cdf0e10cSrcweir SfxPoolItem* SvxCrossedOutItem::Clone( SfxItemPool * ) const 1611cdf0e10cSrcweir { 1612cdf0e10cSrcweir return new SvxCrossedOutItem( *this ); 1613cdf0e10cSrcweir } 1614cdf0e10cSrcweir 1615cdf0e10cSrcweir // ----------------------------------------------------------------------- 1616cdf0e10cSrcweir 1617cdf0e10cSrcweir SvStream& SvxCrossedOutItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const 1618cdf0e10cSrcweir { 1619cdf0e10cSrcweir rStrm << (sal_uInt8)GetValue(); 1620cdf0e10cSrcweir return rStrm; 1621cdf0e10cSrcweir } 1622cdf0e10cSrcweir 1623cdf0e10cSrcweir // ----------------------------------------------------------------------- 1624cdf0e10cSrcweir 1625cdf0e10cSrcweir SfxPoolItem* SvxCrossedOutItem::Create(SvStream& rStrm, sal_uInt16) const 1626cdf0e10cSrcweir { 1627cdf0e10cSrcweir sal_uInt8 eCross; 1628cdf0e10cSrcweir rStrm >> eCross; 1629cdf0e10cSrcweir return new SvxCrossedOutItem( (FontStrikeout)eCross, Which() ); 1630cdf0e10cSrcweir } 1631cdf0e10cSrcweir 1632cdf0e10cSrcweir //------------------------------------------------------------------------ 1633cdf0e10cSrcweir 1634cdf0e10cSrcweir SfxItemPresentation SvxCrossedOutItem::GetPresentation 1635cdf0e10cSrcweir ( 1636cdf0e10cSrcweir SfxItemPresentation ePres, 1637cdf0e10cSrcweir SfxMapUnit /*eCoreUnit*/, 1638cdf0e10cSrcweir SfxMapUnit /*ePresUnit*/, 1639cdf0e10cSrcweir XubString& rText, const IntlWrapper * /*pIntl*/ 1640cdf0e10cSrcweir ) const 1641cdf0e10cSrcweir { 1642cdf0e10cSrcweir switch ( ePres ) 1643cdf0e10cSrcweir { 1644cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NONE: 1645cdf0e10cSrcweir rText.Erase(); 1646cdf0e10cSrcweir return ePres; 1647cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NAMELESS: 1648cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_COMPLETE: 1649cdf0e10cSrcweir rText = GetValueTextByPos( GetValue() ); 1650cdf0e10cSrcweir return ePres; 1651cdf0e10cSrcweir default: ;//prevent warning 1652cdf0e10cSrcweir } 1653cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_NONE; 1654cdf0e10cSrcweir } 1655cdf0e10cSrcweir 1656cdf0e10cSrcweir // ----------------------------------------------------------------------- 1657cdf0e10cSrcweir 1658cdf0e10cSrcweir XubString SvxCrossedOutItem::GetValueTextByPos( sal_uInt16 nPos ) const 1659cdf0e10cSrcweir { 1660cdf0e10cSrcweir DBG_ASSERT( nPos <= (sal_uInt16)STRIKEOUT_X, "enum overflow!" ); 1661cdf0e10cSrcweir return EE_RESSTR( RID_SVXITEMS_STRIKEOUT_BEGIN + nPos ); 1662cdf0e10cSrcweir } 1663cdf0e10cSrcweir 1664cdf0e10cSrcweir /*-----------------13.03.98 16:28------------------- 1665cdf0e10cSrcweir 1666cdf0e10cSrcweir --------------------------------------------------*/ 1667cdf0e10cSrcweir sal_Bool SvxCrossedOutItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const 1668cdf0e10cSrcweir { 1669cdf0e10cSrcweir // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); 1670cdf0e10cSrcweir nMemberId &= ~CONVERT_TWIPS; 1671cdf0e10cSrcweir switch(nMemberId) 1672cdf0e10cSrcweir { 1673cdf0e10cSrcweir case MID_CROSSED_OUT: 1674cdf0e10cSrcweir rVal = Bool2Any(GetBoolValue()); 1675cdf0e10cSrcweir break; 1676cdf0e10cSrcweir case MID_CROSS_OUT: 1677cdf0e10cSrcweir rVal <<= (sal_Int16)(GetValue()); 1678cdf0e10cSrcweir break; 1679cdf0e10cSrcweir } 1680cdf0e10cSrcweir return sal_True; 1681cdf0e10cSrcweir } 1682cdf0e10cSrcweir /*-----------------13.03.98 16:29------------------- 1683cdf0e10cSrcweir 1684cdf0e10cSrcweir --------------------------------------------------*/ 1685cdf0e10cSrcweir sal_Bool SvxCrossedOutItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) 1686cdf0e10cSrcweir { 1687cdf0e10cSrcweir // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); 1688cdf0e10cSrcweir nMemberId &= ~CONVERT_TWIPS; 1689cdf0e10cSrcweir switch(nMemberId) 1690cdf0e10cSrcweir { 1691cdf0e10cSrcweir case MID_CROSSED_OUT: 1692cdf0e10cSrcweir SetBoolValue(Any2Bool(rVal)); 1693cdf0e10cSrcweir break; 1694cdf0e10cSrcweir case MID_CROSS_OUT: 1695cdf0e10cSrcweir { 1696cdf0e10cSrcweir sal_Int32 nValue = 0; 1697cdf0e10cSrcweir if(!(rVal >>= nValue)) 1698cdf0e10cSrcweir return sal_False; 1699cdf0e10cSrcweir SetValue((sal_Int16)nValue); 1700cdf0e10cSrcweir } 1701cdf0e10cSrcweir break; 1702cdf0e10cSrcweir } 1703cdf0e10cSrcweir return sal_True; 1704cdf0e10cSrcweir } 1705cdf0e10cSrcweir // class SvxShadowedItem ------------------------------------------------- 1706cdf0e10cSrcweir 1707cdf0e10cSrcweir SvxShadowedItem::SvxShadowedItem( const sal_Bool bShadowed, const sal_uInt16 nId ) : 1708cdf0e10cSrcweir SfxBoolItem( nId, bShadowed ) 1709cdf0e10cSrcweir { 1710cdf0e10cSrcweir } 1711cdf0e10cSrcweir 1712cdf0e10cSrcweir // ----------------------------------------------------------------------- 1713cdf0e10cSrcweir 1714cdf0e10cSrcweir SfxPoolItem* SvxShadowedItem::Clone( SfxItemPool * ) const 1715cdf0e10cSrcweir { 1716cdf0e10cSrcweir return new SvxShadowedItem( *this ); 1717cdf0e10cSrcweir } 1718cdf0e10cSrcweir 1719cdf0e10cSrcweir // ----------------------------------------------------------------------- 1720cdf0e10cSrcweir 1721cdf0e10cSrcweir SvStream& SvxShadowedItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const 1722cdf0e10cSrcweir { 1723cdf0e10cSrcweir rStrm << (sal_uInt8) GetValue(); 1724cdf0e10cSrcweir return rStrm; 1725cdf0e10cSrcweir } 1726cdf0e10cSrcweir 1727cdf0e10cSrcweir // ----------------------------------------------------------------------- 1728cdf0e10cSrcweir 1729cdf0e10cSrcweir SfxPoolItem* SvxShadowedItem::Create(SvStream& rStrm, sal_uInt16) const 1730cdf0e10cSrcweir { 1731cdf0e10cSrcweir sal_uInt8 nState; 1732cdf0e10cSrcweir rStrm >> nState; 1733cdf0e10cSrcweir return new SvxShadowedItem( nState, Which() ); 1734cdf0e10cSrcweir } 1735cdf0e10cSrcweir 1736cdf0e10cSrcweir //------------------------------------------------------------------------ 1737cdf0e10cSrcweir 1738cdf0e10cSrcweir SfxItemPresentation SvxShadowedItem::GetPresentation 1739cdf0e10cSrcweir ( 1740cdf0e10cSrcweir SfxItemPresentation ePres, 1741cdf0e10cSrcweir SfxMapUnit /*eCoreUnit*/, 1742cdf0e10cSrcweir SfxMapUnit /*ePresUnit*/, 1743cdf0e10cSrcweir XubString& rText, const IntlWrapper * /*pIntl*/ 1744cdf0e10cSrcweir ) const 1745cdf0e10cSrcweir { 1746cdf0e10cSrcweir switch ( ePres ) 1747cdf0e10cSrcweir { 1748cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NONE: 1749cdf0e10cSrcweir rText.Erase(); 1750cdf0e10cSrcweir return ePres; 1751cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NAMELESS: 1752cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_COMPLETE: 1753cdf0e10cSrcweir { 1754cdf0e10cSrcweir sal_uInt16 nId = RID_SVXITEMS_SHADOWED_FALSE; 1755cdf0e10cSrcweir 1756cdf0e10cSrcweir if ( GetValue() ) 1757cdf0e10cSrcweir nId = RID_SVXITEMS_SHADOWED_TRUE; 1758cdf0e10cSrcweir rText = EE_RESSTR(nId); 1759cdf0e10cSrcweir return ePres; 1760cdf0e10cSrcweir } 1761cdf0e10cSrcweir default: ; //prevent warning 1762cdf0e10cSrcweir } 1763cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_NONE; 1764cdf0e10cSrcweir } 1765cdf0e10cSrcweir 1766cdf0e10cSrcweir // class SvxAutoKernItem ------------------------------------------------- 1767cdf0e10cSrcweir 1768cdf0e10cSrcweir SvxAutoKernItem::SvxAutoKernItem( const sal_Bool bAutoKern, const sal_uInt16 nId ) : 1769cdf0e10cSrcweir SfxBoolItem( nId, bAutoKern ) 1770cdf0e10cSrcweir { 1771cdf0e10cSrcweir } 1772cdf0e10cSrcweir 1773cdf0e10cSrcweir // ----------------------------------------------------------------------- 1774cdf0e10cSrcweir 1775cdf0e10cSrcweir SfxPoolItem* SvxAutoKernItem::Clone( SfxItemPool * ) const 1776cdf0e10cSrcweir { 1777cdf0e10cSrcweir return new SvxAutoKernItem( *this ); 1778cdf0e10cSrcweir } 1779cdf0e10cSrcweir 1780cdf0e10cSrcweir // ----------------------------------------------------------------------- 1781cdf0e10cSrcweir 1782cdf0e10cSrcweir SvStream& SvxAutoKernItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const 1783cdf0e10cSrcweir { 1784cdf0e10cSrcweir rStrm << (sal_uInt8) GetValue(); 1785cdf0e10cSrcweir return rStrm; 1786cdf0e10cSrcweir } 1787cdf0e10cSrcweir 1788cdf0e10cSrcweir // ----------------------------------------------------------------------- 1789cdf0e10cSrcweir 1790cdf0e10cSrcweir SfxPoolItem* SvxAutoKernItem::Create(SvStream& rStrm, sal_uInt16) const 1791cdf0e10cSrcweir { 1792cdf0e10cSrcweir sal_uInt8 nState; 1793cdf0e10cSrcweir rStrm >> nState; 1794cdf0e10cSrcweir return new SvxAutoKernItem( nState, Which() ); 1795cdf0e10cSrcweir } 1796cdf0e10cSrcweir 1797cdf0e10cSrcweir //------------------------------------------------------------------------ 1798cdf0e10cSrcweir 1799cdf0e10cSrcweir SfxItemPresentation SvxAutoKernItem::GetPresentation 1800cdf0e10cSrcweir ( 1801cdf0e10cSrcweir SfxItemPresentation ePres, 1802cdf0e10cSrcweir SfxMapUnit /*eCoreUnit*/, 1803cdf0e10cSrcweir SfxMapUnit /*ePresUnit*/, 1804cdf0e10cSrcweir XubString& rText, const IntlWrapper * /*pIntl*/ 1805cdf0e10cSrcweir ) const 1806cdf0e10cSrcweir { 1807cdf0e10cSrcweir switch ( ePres ) 1808cdf0e10cSrcweir { 1809cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NONE: 1810cdf0e10cSrcweir rText.Erase(); 1811cdf0e10cSrcweir return ePres; 1812cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NAMELESS: 1813cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_COMPLETE: 1814cdf0e10cSrcweir { 1815cdf0e10cSrcweir sal_uInt16 nId = RID_SVXITEMS_AUTOKERN_FALSE; 1816cdf0e10cSrcweir 1817cdf0e10cSrcweir if ( GetValue() ) 1818cdf0e10cSrcweir nId = RID_SVXITEMS_AUTOKERN_TRUE; 1819cdf0e10cSrcweir rText = EE_RESSTR(nId); 1820cdf0e10cSrcweir return ePres; 1821cdf0e10cSrcweir } 1822cdf0e10cSrcweir default: ; //prevent warning 1823cdf0e10cSrcweir } 1824cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_NONE; 1825cdf0e10cSrcweir } 1826cdf0e10cSrcweir 1827cdf0e10cSrcweir // class SvxWordLineModeItem --------------------------------------------- 1828cdf0e10cSrcweir 1829cdf0e10cSrcweir SvxWordLineModeItem::SvxWordLineModeItem( const sal_Bool bWordLineMode, 1830cdf0e10cSrcweir const sal_uInt16 nId ) : 1831cdf0e10cSrcweir SfxBoolItem( nId, bWordLineMode ) 1832cdf0e10cSrcweir { 1833cdf0e10cSrcweir } 1834cdf0e10cSrcweir 1835cdf0e10cSrcweir // ----------------------------------------------------------------------- 1836cdf0e10cSrcweir 1837cdf0e10cSrcweir SfxPoolItem* SvxWordLineModeItem::Clone( SfxItemPool * ) const 1838cdf0e10cSrcweir { 1839cdf0e10cSrcweir return new SvxWordLineModeItem( *this ); 1840cdf0e10cSrcweir } 1841cdf0e10cSrcweir 1842cdf0e10cSrcweir // ----------------------------------------------------------------------- 1843cdf0e10cSrcweir 1844cdf0e10cSrcweir SvStream& SvxWordLineModeItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const 1845cdf0e10cSrcweir { 1846cdf0e10cSrcweir rStrm << (sal_Bool) GetValue(); 1847cdf0e10cSrcweir return rStrm; 1848cdf0e10cSrcweir } 1849cdf0e10cSrcweir 1850cdf0e10cSrcweir // ----------------------------------------------------------------------- 1851cdf0e10cSrcweir 1852cdf0e10cSrcweir SfxPoolItem* SvxWordLineModeItem::Create(SvStream& rStrm, sal_uInt16) const 1853cdf0e10cSrcweir { 1854cdf0e10cSrcweir sal_Bool bValue; 1855cdf0e10cSrcweir rStrm >> bValue; 1856cdf0e10cSrcweir return new SvxWordLineModeItem( bValue, Which() ); 1857cdf0e10cSrcweir } 1858cdf0e10cSrcweir 1859cdf0e10cSrcweir //------------------------------------------------------------------------ 1860cdf0e10cSrcweir 1861cdf0e10cSrcweir SfxItemPresentation SvxWordLineModeItem::GetPresentation 1862cdf0e10cSrcweir ( 1863cdf0e10cSrcweir SfxItemPresentation ePres, 1864cdf0e10cSrcweir SfxMapUnit /*eCoreUnit*/, 1865cdf0e10cSrcweir SfxMapUnit /*ePresUnit*/, 1866cdf0e10cSrcweir XubString& rText, const IntlWrapper * /*pIntl*/ 1867cdf0e10cSrcweir ) const 1868cdf0e10cSrcweir { 1869cdf0e10cSrcweir switch ( ePres ) 1870cdf0e10cSrcweir { 1871cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NONE: 1872cdf0e10cSrcweir rText.Erase(); 1873cdf0e10cSrcweir return ePres; 1874cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NAMELESS: 1875cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_COMPLETE: 1876cdf0e10cSrcweir { 1877cdf0e10cSrcweir sal_uInt16 nId = RID_SVXITEMS_WORDLINE_FALSE; 1878cdf0e10cSrcweir 1879cdf0e10cSrcweir if ( GetValue() ) 1880cdf0e10cSrcweir nId = RID_SVXITEMS_WORDLINE_TRUE; 1881cdf0e10cSrcweir rText = EE_RESSTR(nId); 1882cdf0e10cSrcweir return ePres; 1883cdf0e10cSrcweir } 1884cdf0e10cSrcweir default: ; //prevent warning 1885cdf0e10cSrcweir } 1886cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_NONE; 1887cdf0e10cSrcweir } 1888cdf0e10cSrcweir 1889cdf0e10cSrcweir // class SvxContourItem -------------------------------------------------- 1890cdf0e10cSrcweir 1891cdf0e10cSrcweir SvxContourItem::SvxContourItem( const sal_Bool bContoured, const sal_uInt16 nId ) : 1892cdf0e10cSrcweir SfxBoolItem( nId, bContoured ) 1893cdf0e10cSrcweir { 1894cdf0e10cSrcweir } 1895cdf0e10cSrcweir 1896cdf0e10cSrcweir // ----------------------------------------------------------------------- 1897cdf0e10cSrcweir 1898cdf0e10cSrcweir SfxPoolItem* SvxContourItem::Clone( SfxItemPool * ) const 1899cdf0e10cSrcweir { 1900cdf0e10cSrcweir return new SvxContourItem( *this ); 1901cdf0e10cSrcweir } 1902cdf0e10cSrcweir 1903cdf0e10cSrcweir // ----------------------------------------------------------------------- 1904cdf0e10cSrcweir 1905cdf0e10cSrcweir SvStream& SvxContourItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const 1906cdf0e10cSrcweir { 1907cdf0e10cSrcweir rStrm << (sal_Bool) GetValue(); 1908cdf0e10cSrcweir return rStrm; 1909cdf0e10cSrcweir } 1910cdf0e10cSrcweir 1911cdf0e10cSrcweir // ----------------------------------------------------------------------- 1912cdf0e10cSrcweir 1913cdf0e10cSrcweir SfxPoolItem* SvxContourItem::Create(SvStream& rStrm, sal_uInt16) const 1914cdf0e10cSrcweir { 1915cdf0e10cSrcweir sal_Bool bValue; 1916cdf0e10cSrcweir rStrm >> bValue; 1917cdf0e10cSrcweir return new SvxContourItem( bValue, Which() ); 1918cdf0e10cSrcweir } 1919cdf0e10cSrcweir 1920cdf0e10cSrcweir //------------------------------------------------------------------------ 1921cdf0e10cSrcweir 1922cdf0e10cSrcweir SfxItemPresentation SvxContourItem::GetPresentation 1923cdf0e10cSrcweir ( 1924cdf0e10cSrcweir SfxItemPresentation ePres, 1925cdf0e10cSrcweir SfxMapUnit /*eCoreUnit*/, 1926cdf0e10cSrcweir SfxMapUnit /*ePresUnit*/, 1927cdf0e10cSrcweir XubString& rText, const IntlWrapper * /*pIntl*/ 1928cdf0e10cSrcweir ) const 1929cdf0e10cSrcweir { 1930cdf0e10cSrcweir switch ( ePres ) 1931cdf0e10cSrcweir { 1932cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NONE: 1933cdf0e10cSrcweir rText.Erase(); 1934cdf0e10cSrcweir return ePres; 1935cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NAMELESS: 1936cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_COMPLETE: 1937cdf0e10cSrcweir { 1938cdf0e10cSrcweir sal_uInt16 nId = RID_SVXITEMS_CONTOUR_FALSE; 1939cdf0e10cSrcweir 1940cdf0e10cSrcweir if ( GetValue() ) 1941cdf0e10cSrcweir nId = RID_SVXITEMS_CONTOUR_TRUE; 1942cdf0e10cSrcweir rText = EE_RESSTR(nId); 1943cdf0e10cSrcweir return ePres; 1944cdf0e10cSrcweir } 1945cdf0e10cSrcweir default: ; //prevent warning 1946cdf0e10cSrcweir } 1947cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_NONE; 1948cdf0e10cSrcweir } 1949cdf0e10cSrcweir 1950cdf0e10cSrcweir // class SvxPropSizeItem ------------------------------------------------- 1951cdf0e10cSrcweir 1952cdf0e10cSrcweir SvxPropSizeItem::SvxPropSizeItem( const sal_uInt16 nPercent, const sal_uInt16 nId ) : 1953cdf0e10cSrcweir SfxUInt16Item( nId, nPercent ) 1954cdf0e10cSrcweir { 1955cdf0e10cSrcweir } 1956cdf0e10cSrcweir 1957cdf0e10cSrcweir // ----------------------------------------------------------------------- 1958cdf0e10cSrcweir 1959cdf0e10cSrcweir SfxPoolItem* SvxPropSizeItem::Clone( SfxItemPool * ) const 1960cdf0e10cSrcweir { 1961cdf0e10cSrcweir return new SvxPropSizeItem( *this ); 1962cdf0e10cSrcweir } 1963cdf0e10cSrcweir 1964cdf0e10cSrcweir // ----------------------------------------------------------------------- 1965cdf0e10cSrcweir 1966cdf0e10cSrcweir SvStream& SvxPropSizeItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const 1967cdf0e10cSrcweir { 1968cdf0e10cSrcweir rStrm << (sal_uInt16) GetValue(); 1969cdf0e10cSrcweir return rStrm; 1970cdf0e10cSrcweir } 1971cdf0e10cSrcweir 1972cdf0e10cSrcweir // ----------------------------------------------------------------------- 1973cdf0e10cSrcweir 1974cdf0e10cSrcweir SfxPoolItem* SvxPropSizeItem::Create(SvStream& rStrm, sal_uInt16) const 1975cdf0e10cSrcweir { 1976cdf0e10cSrcweir sal_uInt16 nSize; 1977cdf0e10cSrcweir rStrm >> nSize; 1978cdf0e10cSrcweir return new SvxPropSizeItem( nSize, Which() ); 1979cdf0e10cSrcweir } 1980cdf0e10cSrcweir 1981cdf0e10cSrcweir //------------------------------------------------------------------------ 1982cdf0e10cSrcweir 1983cdf0e10cSrcweir SfxItemPresentation SvxPropSizeItem::GetPresentation 1984cdf0e10cSrcweir ( 1985cdf0e10cSrcweir SfxItemPresentation /*ePres*/, 1986cdf0e10cSrcweir SfxMapUnit /*eCoreUnit*/, 1987cdf0e10cSrcweir SfxMapUnit /*ePresUnit*/, 1988cdf0e10cSrcweir XubString& rText, const IntlWrapper * /*pIntl*/ 1989cdf0e10cSrcweir ) const 1990cdf0e10cSrcweir { 1991cdf0e10cSrcweir rText.Erase(); 1992cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_NONE; 1993cdf0e10cSrcweir } 1994cdf0e10cSrcweir 1995cdf0e10cSrcweir // class SvxColorItem ---------------------------------------------------- 1996cdf0e10cSrcweir 1997cdf0e10cSrcweir SvxColorItem::SvxColorItem( const sal_uInt16 nId ) : 1998cdf0e10cSrcweir SfxPoolItem( nId ), 1999cdf0e10cSrcweir mColor( COL_BLACK ) 2000cdf0e10cSrcweir { 2001cdf0e10cSrcweir } 2002cdf0e10cSrcweir 2003cdf0e10cSrcweir // ----------------------------------------------------------------------- 2004cdf0e10cSrcweir 2005cdf0e10cSrcweir SvxColorItem::SvxColorItem( const Color& rCol, const sal_uInt16 nId ) : 2006cdf0e10cSrcweir SfxPoolItem( nId ), 2007cdf0e10cSrcweir mColor( rCol ) 2008cdf0e10cSrcweir { 2009cdf0e10cSrcweir } 2010cdf0e10cSrcweir 2011cdf0e10cSrcweir // ----------------------------------------------------------------------- 2012cdf0e10cSrcweir 2013cdf0e10cSrcweir SvxColorItem::SvxColorItem( SvStream &rStrm, const sal_uInt16 nId ) : 2014cdf0e10cSrcweir SfxPoolItem( nId ) 2015cdf0e10cSrcweir { 2016cdf0e10cSrcweir Color aColor; 2017cdf0e10cSrcweir rStrm >> aColor; 2018cdf0e10cSrcweir mColor = aColor; 2019cdf0e10cSrcweir } 2020cdf0e10cSrcweir 2021cdf0e10cSrcweir // ----------------------------------------------------------------------- 2022cdf0e10cSrcweir 2023cdf0e10cSrcweir SvxColorItem::SvxColorItem( const SvxColorItem &rCopy ) : 2024cdf0e10cSrcweir SfxPoolItem( rCopy ), 2025cdf0e10cSrcweir mColor( rCopy.mColor ) 2026cdf0e10cSrcweir { 2027cdf0e10cSrcweir } 2028cdf0e10cSrcweir 2029cdf0e10cSrcweir // ----------------------------------------------------------------------- 2030cdf0e10cSrcweir 2031cdf0e10cSrcweir SvxColorItem::~SvxColorItem() 2032cdf0e10cSrcweir { 2033cdf0e10cSrcweir } 2034cdf0e10cSrcweir 2035cdf0e10cSrcweir // ----------------------------------------------------------------------- 2036cdf0e10cSrcweir sal_uInt16 SvxColorItem::GetVersion( sal_uInt16 nFFVer ) const 2037cdf0e10cSrcweir { 2038cdf0e10cSrcweir DBG_ASSERT( SOFFICE_FILEFORMAT_31==nFFVer || 2039cdf0e10cSrcweir SOFFICE_FILEFORMAT_40==nFFVer || 2040cdf0e10cSrcweir SOFFICE_FILEFORMAT_50==nFFVer, 2041cdf0e10cSrcweir "SvxColorItem: Gibt es ein neues Fileformat?" ); 2042cdf0e10cSrcweir return SOFFICE_FILEFORMAT_50 >= nFFVer ? VERSION_USEAUTOCOLOR : 0; 2043cdf0e10cSrcweir } 2044cdf0e10cSrcweir 2045cdf0e10cSrcweir // ----------------------------------------------------------------------- 2046cdf0e10cSrcweir 2047cdf0e10cSrcweir int SvxColorItem::operator==( const SfxPoolItem& rAttr ) const 2048cdf0e10cSrcweir { 2049cdf0e10cSrcweir DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" ); 2050cdf0e10cSrcweir 2051cdf0e10cSrcweir return mColor == ( (const SvxColorItem&)rAttr ).mColor; 2052cdf0e10cSrcweir } 2053cdf0e10cSrcweir 2054cdf0e10cSrcweir // ----------------------------------------------------------------------- 2055cdf0e10cSrcweir 2056cdf0e10cSrcweir sal_Bool SvxColorItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const 2057cdf0e10cSrcweir { 2058cdf0e10cSrcweir rVal <<= (sal_Int32)(mColor.GetColor()); 2059cdf0e10cSrcweir return sal_True; 2060cdf0e10cSrcweir } 2061cdf0e10cSrcweir 2062cdf0e10cSrcweir // ----------------------------------------------------------------------- 2063cdf0e10cSrcweir 2064cdf0e10cSrcweir sal_Bool SvxColorItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) 2065cdf0e10cSrcweir { 2066cdf0e10cSrcweir sal_Int32 nColor = 0; 2067cdf0e10cSrcweir if(!(rVal >>= nColor)) 2068cdf0e10cSrcweir return sal_False; 2069cdf0e10cSrcweir 2070cdf0e10cSrcweir mColor.SetColor( nColor ); 2071cdf0e10cSrcweir return sal_True; 2072cdf0e10cSrcweir } 2073cdf0e10cSrcweir 2074cdf0e10cSrcweir // ----------------------------------------------------------------------- 2075cdf0e10cSrcweir 2076cdf0e10cSrcweir SfxPoolItem* SvxColorItem::Clone( SfxItemPool * ) const 2077cdf0e10cSrcweir { 2078cdf0e10cSrcweir return new SvxColorItem( *this ); 2079cdf0e10cSrcweir } 2080cdf0e10cSrcweir 2081cdf0e10cSrcweir // ----------------------------------------------------------------------- 2082cdf0e10cSrcweir 2083cdf0e10cSrcweir SvStream& SvxColorItem::Store( SvStream& rStrm , sal_uInt16 nItemVersion ) const 2084cdf0e10cSrcweir { 2085cdf0e10cSrcweir if( VERSION_USEAUTOCOLOR == nItemVersion && 2086cdf0e10cSrcweir COL_AUTO == mColor.GetColor() ) 2087cdf0e10cSrcweir rStrm << Color( COL_BLACK ); 2088cdf0e10cSrcweir else 2089cdf0e10cSrcweir rStrm << mColor; 2090cdf0e10cSrcweir return rStrm; 2091cdf0e10cSrcweir } 2092cdf0e10cSrcweir 2093cdf0e10cSrcweir // ----------------------------------------------------------------------- 2094cdf0e10cSrcweir 2095cdf0e10cSrcweir SfxPoolItem* SvxColorItem::Create(SvStream& rStrm, sal_uInt16 /*nVer*/ ) const 2096cdf0e10cSrcweir { 2097cdf0e10cSrcweir return new SvxColorItem( rStrm, Which() ); 2098cdf0e10cSrcweir } 2099cdf0e10cSrcweir 2100cdf0e10cSrcweir //------------------------------------------------------------------------ 2101cdf0e10cSrcweir 2102cdf0e10cSrcweir SfxItemPresentation SvxColorItem::GetPresentation 2103cdf0e10cSrcweir ( 2104cdf0e10cSrcweir SfxItemPresentation ePres, 2105cdf0e10cSrcweir SfxMapUnit /*eCoreUnit*/, 2106cdf0e10cSrcweir SfxMapUnit /*ePresUnit*/, 2107cdf0e10cSrcweir XubString& rText, const IntlWrapper * /*pIntl*/ 2108cdf0e10cSrcweir ) const 2109cdf0e10cSrcweir { 2110cdf0e10cSrcweir #ifndef SVX_LIGHT 2111cdf0e10cSrcweir switch ( ePres ) 2112cdf0e10cSrcweir { 2113cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NONE: 2114cdf0e10cSrcweir rText.Erase(); 2115cdf0e10cSrcweir return ePres; 2116cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NAMELESS: 2117cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_COMPLETE: 2118cdf0e10cSrcweir rText = ::GetColorString( mColor ); 2119cdf0e10cSrcweir return ePres; 2120cdf0e10cSrcweir default: ; //prevent warning 2121cdf0e10cSrcweir } 2122cdf0e10cSrcweir #endif 2123cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_NONE; 2124cdf0e10cSrcweir } 2125cdf0e10cSrcweir 2126cdf0e10cSrcweir // ----------------------------------------------------------------------- 2127cdf0e10cSrcweir 2128cdf0e10cSrcweir void SvxColorItem::SetValue( const Color& rNewCol ) 2129cdf0e10cSrcweir { 2130cdf0e10cSrcweir mColor = rNewCol; 2131cdf0e10cSrcweir } 2132cdf0e10cSrcweir 2133cdf0e10cSrcweir // class SvxCharSetColorItem --------------------------------------------- 2134cdf0e10cSrcweir 2135cdf0e10cSrcweir SvxCharSetColorItem::SvxCharSetColorItem( const sal_uInt16 nId ) : 2136cdf0e10cSrcweir SvxColorItem( nId ), 2137cdf0e10cSrcweir 2138cdf0e10cSrcweir eFrom( RTL_TEXTENCODING_DONTKNOW ) 2139cdf0e10cSrcweir { 2140cdf0e10cSrcweir } 2141cdf0e10cSrcweir 2142cdf0e10cSrcweir // ----------------------------------------------------------------------- 2143cdf0e10cSrcweir 2144cdf0e10cSrcweir SvxCharSetColorItem::SvxCharSetColorItem( const Color& rCol, 2145cdf0e10cSrcweir const rtl_TextEncoding _eFrom, 2146cdf0e10cSrcweir const sal_uInt16 nId ) : 2147cdf0e10cSrcweir SvxColorItem( rCol, nId ), 2148cdf0e10cSrcweir 2149cdf0e10cSrcweir eFrom( _eFrom ) 2150cdf0e10cSrcweir { 2151cdf0e10cSrcweir } 2152cdf0e10cSrcweir 2153cdf0e10cSrcweir 2154cdf0e10cSrcweir // ----------------------------------------------------------------------- 2155cdf0e10cSrcweir 2156cdf0e10cSrcweir SfxPoolItem* SvxCharSetColorItem::Clone( SfxItemPool * ) const 2157cdf0e10cSrcweir { 2158cdf0e10cSrcweir return new SvxCharSetColorItem( *this ); 2159cdf0e10cSrcweir } 2160cdf0e10cSrcweir 2161cdf0e10cSrcweir // ----------------------------------------------------------------------- 2162cdf0e10cSrcweir 2163cdf0e10cSrcweir SvStream& SvxCharSetColorItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const 2164cdf0e10cSrcweir { 2165cdf0e10cSrcweir // #90477# rStrm << (sal_uInt8) GetStoreCharSet( GetCharSet(), (sal_uInt16)rStrm.GetVersion() ) 2166cdf0e10cSrcweir // << GetValue(); 2167cdf0e10cSrcweir rStrm << (sal_uInt8)GetSOStoreTextEncoding(GetCharSet(), (sal_uInt16)rStrm.GetVersion()) 2168cdf0e10cSrcweir << GetValue(); 2169cdf0e10cSrcweir return rStrm; 2170cdf0e10cSrcweir } 2171cdf0e10cSrcweir 2172cdf0e10cSrcweir // ----------------------------------------------------------------------- 2173cdf0e10cSrcweir 2174cdf0e10cSrcweir SfxPoolItem* SvxCharSetColorItem::Create(SvStream& rStrm, sal_uInt16) const 2175cdf0e10cSrcweir { 2176cdf0e10cSrcweir sal_uInt8 cSet; 2177cdf0e10cSrcweir Color aColor; 2178cdf0e10cSrcweir rStrm >> cSet >> aColor; 2179cdf0e10cSrcweir return new SvxCharSetColorItem( aColor, (rtl_TextEncoding)cSet, Which() ); 2180cdf0e10cSrcweir } 2181cdf0e10cSrcweir 2182cdf0e10cSrcweir //------------------------------------------------------------------------ 2183cdf0e10cSrcweir 2184cdf0e10cSrcweir SfxItemPresentation SvxCharSetColorItem::GetPresentation 2185cdf0e10cSrcweir ( 2186cdf0e10cSrcweir SfxItemPresentation /*ePres*/, 2187cdf0e10cSrcweir SfxMapUnit /*eCoreUnit*/, 2188cdf0e10cSrcweir SfxMapUnit /*ePresUnit*/, 2189cdf0e10cSrcweir XubString& rText, const IntlWrapper * /*pIntl*/ 2190cdf0e10cSrcweir ) const 2191cdf0e10cSrcweir { 2192cdf0e10cSrcweir rText.Erase(); 2193cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_NONE; 2194cdf0e10cSrcweir } 2195cdf0e10cSrcweir 2196cdf0e10cSrcweir // class SvxKerningItem -------------------------------------------------- 2197cdf0e10cSrcweir 2198cdf0e10cSrcweir SvxKerningItem::SvxKerningItem( const short nKern, const sal_uInt16 nId ) : 2199cdf0e10cSrcweir SfxInt16Item( nId, nKern ) 2200cdf0e10cSrcweir { 2201cdf0e10cSrcweir } 2202cdf0e10cSrcweir 2203cdf0e10cSrcweir // ----------------------------------------------------------------------- 2204cdf0e10cSrcweir 2205cdf0e10cSrcweir SfxPoolItem* SvxKerningItem::Clone( SfxItemPool * ) const 2206cdf0e10cSrcweir { 2207cdf0e10cSrcweir return new SvxKerningItem( *this ); 2208cdf0e10cSrcweir } 2209cdf0e10cSrcweir 2210cdf0e10cSrcweir // ----------------------------------------------------------------------- 2211cdf0e10cSrcweir 2212cdf0e10cSrcweir SvStream& SvxKerningItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const 2213cdf0e10cSrcweir { 2214cdf0e10cSrcweir rStrm << (short) GetValue(); 2215cdf0e10cSrcweir return rStrm; 2216cdf0e10cSrcweir } 2217cdf0e10cSrcweir 2218cdf0e10cSrcweir // ----------------------------------------------------------------------- 2219cdf0e10cSrcweir 2220cdf0e10cSrcweir int SvxKerningItem::ScaleMetrics( long nMult, long nDiv ) 2221cdf0e10cSrcweir { 2222cdf0e10cSrcweir SetValue( (sal_Int16)Scale( GetValue(), nMult, nDiv ) ); 2223cdf0e10cSrcweir return 1; 2224cdf0e10cSrcweir } 2225cdf0e10cSrcweir 2226cdf0e10cSrcweir // ----------------------------------------------------------------------- 2227cdf0e10cSrcweir 2228cdf0e10cSrcweir int SvxKerningItem::HasMetrics() const 2229cdf0e10cSrcweir { 2230cdf0e10cSrcweir return 1; 2231cdf0e10cSrcweir } 2232cdf0e10cSrcweir 2233cdf0e10cSrcweir // ----------------------------------------------------------------------- 2234cdf0e10cSrcweir 2235cdf0e10cSrcweir SfxPoolItem* SvxKerningItem::Create(SvStream& rStrm, sal_uInt16) const 2236cdf0e10cSrcweir { 2237cdf0e10cSrcweir short nValue; 2238cdf0e10cSrcweir rStrm >> nValue; 2239cdf0e10cSrcweir return new SvxKerningItem( nValue, Which() ); 2240cdf0e10cSrcweir } 2241cdf0e10cSrcweir 2242cdf0e10cSrcweir //------------------------------------------------------------------------ 2243cdf0e10cSrcweir 2244cdf0e10cSrcweir SfxItemPresentation SvxKerningItem::GetPresentation 2245cdf0e10cSrcweir ( 2246cdf0e10cSrcweir SfxItemPresentation ePres, 2247cdf0e10cSrcweir SfxMapUnit eCoreUnit, 2248cdf0e10cSrcweir SfxMapUnit /*ePresUnit*/, 2249cdf0e10cSrcweir XubString& rText, const IntlWrapper *pIntl 2250cdf0e10cSrcweir ) const 2251cdf0e10cSrcweir { 2252cdf0e10cSrcweir #ifndef SVX_LIGHT 2253cdf0e10cSrcweir switch ( ePres ) 2254cdf0e10cSrcweir { 2255cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NONE: 2256cdf0e10cSrcweir rText.Erase(); 2257cdf0e10cSrcweir return ePres; 2258cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NAMELESS: 2259cdf0e10cSrcweir rText = GetMetricText( (long)GetValue(), eCoreUnit, SFX_MAPUNIT_POINT, pIntl ); 2260cdf0e10cSrcweir rText += EE_RESSTR(GetMetricId(SFX_MAPUNIT_POINT)); 2261cdf0e10cSrcweir return ePres; 2262cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_COMPLETE: 2263cdf0e10cSrcweir { 2264cdf0e10cSrcweir rText = EE_RESSTR(RID_SVXITEMS_KERNING_COMPLETE); 2265cdf0e10cSrcweir sal_uInt16 nId = 0; 2266cdf0e10cSrcweir 2267cdf0e10cSrcweir if ( GetValue() > 0 ) 2268cdf0e10cSrcweir nId = RID_SVXITEMS_KERNING_EXPANDED; 2269cdf0e10cSrcweir else if ( GetValue() < 0 ) 2270cdf0e10cSrcweir nId = RID_SVXITEMS_KERNING_CONDENSED; 2271cdf0e10cSrcweir 2272cdf0e10cSrcweir if ( nId ) 2273cdf0e10cSrcweir rText += EE_RESSTR(nId); 2274cdf0e10cSrcweir rText += GetMetricText( (long)GetValue(), eCoreUnit, SFX_MAPUNIT_POINT, pIntl ); 2275cdf0e10cSrcweir rText += EE_RESSTR(GetMetricId(SFX_MAPUNIT_POINT)); 2276cdf0e10cSrcweir return ePres; 2277cdf0e10cSrcweir } 2278cdf0e10cSrcweir default: ; //prevent warning 2279cdf0e10cSrcweir } 2280cdf0e10cSrcweir #endif 2281cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_NONE; 2282cdf0e10cSrcweir } 2283cdf0e10cSrcweir /* -----------------------------19.02.01 12:21-------------------------------- 2284cdf0e10cSrcweir 2285cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 2286cdf0e10cSrcweir sal_Bool SvxKerningItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const 2287cdf0e10cSrcweir { 2288cdf0e10cSrcweir sal_Int16 nVal = GetValue(); 2289cdf0e10cSrcweir if(nMemberId & CONVERT_TWIPS) 2290cdf0e10cSrcweir nVal = (sal_Int16)TWIP_TO_MM100(nVal); 2291cdf0e10cSrcweir rVal <<= nVal; 2292cdf0e10cSrcweir return sal_True; 2293cdf0e10cSrcweir } 2294cdf0e10cSrcweir // ----------------------------------------------------------------------- 2295cdf0e10cSrcweir sal_Bool SvxKerningItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId) 2296cdf0e10cSrcweir { 2297cdf0e10cSrcweir sal_Int16 nVal = sal_Int16(); 2298cdf0e10cSrcweir if(!(rVal >>= nVal)) 2299cdf0e10cSrcweir return sal_False; 2300cdf0e10cSrcweir if(nMemberId & CONVERT_TWIPS) 2301cdf0e10cSrcweir nVal = (sal_Int16)MM100_TO_TWIP(nVal); 2302cdf0e10cSrcweir SetValue(nVal); 2303cdf0e10cSrcweir return sal_True; 2304cdf0e10cSrcweir } 2305cdf0e10cSrcweir 2306cdf0e10cSrcweir // class SvxCaseMapItem -------------------------------------------------- 2307cdf0e10cSrcweir 2308cdf0e10cSrcweir SvxCaseMapItem::SvxCaseMapItem( const SvxCaseMap eMap, const sal_uInt16 nId ) : 2309cdf0e10cSrcweir SfxEnumItem( nId, (sal_uInt16)eMap ) 2310cdf0e10cSrcweir { 2311cdf0e10cSrcweir } 2312cdf0e10cSrcweir 2313cdf0e10cSrcweir // ----------------------------------------------------------------------- 2314cdf0e10cSrcweir 2315cdf0e10cSrcweir sal_uInt16 SvxCaseMapItem::GetValueCount() const 2316cdf0e10cSrcweir { 2317cdf0e10cSrcweir return SVX_CASEMAP_END; // SVX_CASEMAP_KAPITAELCHEN + 1 2318cdf0e10cSrcweir } 2319cdf0e10cSrcweir 2320cdf0e10cSrcweir // ----------------------------------------------------------------------- 2321cdf0e10cSrcweir 2322cdf0e10cSrcweir SfxPoolItem* SvxCaseMapItem::Clone( SfxItemPool * ) const 2323cdf0e10cSrcweir { 2324cdf0e10cSrcweir return new SvxCaseMapItem( *this ); 2325cdf0e10cSrcweir } 2326cdf0e10cSrcweir 2327cdf0e10cSrcweir // ----------------------------------------------------------------------- 2328cdf0e10cSrcweir 2329cdf0e10cSrcweir SvStream& SvxCaseMapItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const 2330cdf0e10cSrcweir { 2331cdf0e10cSrcweir rStrm << (sal_uInt8) GetValue(); 2332cdf0e10cSrcweir return rStrm; 2333cdf0e10cSrcweir } 2334cdf0e10cSrcweir 2335cdf0e10cSrcweir // ----------------------------------------------------------------------- 2336cdf0e10cSrcweir 2337cdf0e10cSrcweir SfxPoolItem* SvxCaseMapItem::Create(SvStream& rStrm, sal_uInt16) const 2338cdf0e10cSrcweir { 2339cdf0e10cSrcweir sal_uInt8 cMap; 2340cdf0e10cSrcweir rStrm >> cMap; 2341cdf0e10cSrcweir return new SvxCaseMapItem( (const SvxCaseMap)cMap, Which() ); 2342cdf0e10cSrcweir } 2343cdf0e10cSrcweir 2344cdf0e10cSrcweir //------------------------------------------------------------------------ 2345cdf0e10cSrcweir 2346cdf0e10cSrcweir SfxItemPresentation SvxCaseMapItem::GetPresentation 2347cdf0e10cSrcweir ( 2348cdf0e10cSrcweir SfxItemPresentation ePres, 2349cdf0e10cSrcweir SfxMapUnit /*eCoreUnit*/, 2350cdf0e10cSrcweir SfxMapUnit /*ePresUnit*/, 2351cdf0e10cSrcweir XubString& rText, const IntlWrapper * /*pIntl*/ 2352cdf0e10cSrcweir ) const 2353cdf0e10cSrcweir { 2354cdf0e10cSrcweir switch ( ePres ) 2355cdf0e10cSrcweir { 2356cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NONE: 2357cdf0e10cSrcweir rText.Erase(); 2358cdf0e10cSrcweir return ePres; 2359cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NAMELESS: 2360cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_COMPLETE: 2361cdf0e10cSrcweir rText = GetValueTextByPos( GetValue() ); 2362cdf0e10cSrcweir return ePres; 2363cdf0e10cSrcweir default: ; //prevent warning 2364cdf0e10cSrcweir } 2365cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_NONE; 2366cdf0e10cSrcweir } 2367cdf0e10cSrcweir 2368cdf0e10cSrcweir // ----------------------------------------------------------------------- 2369cdf0e10cSrcweir 2370cdf0e10cSrcweir XubString SvxCaseMapItem::GetValueTextByPos( sal_uInt16 nPos ) const 2371cdf0e10cSrcweir { 2372cdf0e10cSrcweir DBG_ASSERT( nPos < (sal_uInt16)SVX_CASEMAP_END, "enum overflow!" ); 2373cdf0e10cSrcweir return EE_RESSTR( RID_SVXITEMS_CASEMAP_BEGIN + nPos ); 2374cdf0e10cSrcweir } 2375cdf0e10cSrcweir 2376cdf0e10cSrcweir /*-----------------13.03.98 16:29------------------- 2377cdf0e10cSrcweir 2378cdf0e10cSrcweir --------------------------------------------------*/ 2379cdf0e10cSrcweir sal_Bool SvxCaseMapItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const 2380cdf0e10cSrcweir { 2381cdf0e10cSrcweir sal_Int16 nRet = style::CaseMap::NONE; 2382cdf0e10cSrcweir switch( GetValue() ) 2383cdf0e10cSrcweir { 2384cdf0e10cSrcweir // case SVX_CASEMAP_NOT_MAPPED : nRet = style::CaseMap::NONE ; break; 2385cdf0e10cSrcweir case SVX_CASEMAP_VERSALIEN : nRet = style::CaseMap::UPPERCASE; break; 2386cdf0e10cSrcweir case SVX_CASEMAP_GEMEINE : nRet = style::CaseMap::LOWERCASE; break; 2387cdf0e10cSrcweir case SVX_CASEMAP_TITEL : nRet = style::CaseMap::TITLE ; break; 2388cdf0e10cSrcweir case SVX_CASEMAP_KAPITAELCHEN: nRet = style::CaseMap::SMALLCAPS; break; 2389cdf0e10cSrcweir } 2390cdf0e10cSrcweir rVal <<= (sal_Int16)(nRet); 2391cdf0e10cSrcweir return sal_True; 2392cdf0e10cSrcweir } 2393cdf0e10cSrcweir /*-----------------13.03.98 16:29------------------- 2394cdf0e10cSrcweir 2395cdf0e10cSrcweir --------------------------------------------------*/ 2396cdf0e10cSrcweir sal_Bool SvxCaseMapItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) 2397cdf0e10cSrcweir { 2398cdf0e10cSrcweir sal_uInt16 nVal = sal_uInt16(); 2399cdf0e10cSrcweir if(!(rVal >>= nVal)) 2400cdf0e10cSrcweir return sal_False; 2401cdf0e10cSrcweir 2402cdf0e10cSrcweir switch( nVal ) 2403cdf0e10cSrcweir { 2404cdf0e10cSrcweir case style::CaseMap::NONE : nVal = SVX_CASEMAP_NOT_MAPPED ; break; 2405cdf0e10cSrcweir case style::CaseMap::UPPERCASE: nVal = SVX_CASEMAP_VERSALIEN ; break; 2406cdf0e10cSrcweir case style::CaseMap::LOWERCASE: nVal = SVX_CASEMAP_GEMEINE ; break; 2407cdf0e10cSrcweir case style::CaseMap::TITLE : nVal = SVX_CASEMAP_TITEL ; break; 2408cdf0e10cSrcweir case style::CaseMap::SMALLCAPS: nVal = SVX_CASEMAP_KAPITAELCHEN; break; 2409cdf0e10cSrcweir } 2410cdf0e10cSrcweir SetValue(nVal); 2411cdf0e10cSrcweir return sal_True; 2412cdf0e10cSrcweir } 2413cdf0e10cSrcweir 2414cdf0e10cSrcweir // class SvxEscapementItem ----------------------------------------------- 2415cdf0e10cSrcweir 2416cdf0e10cSrcweir SvxEscapementItem::SvxEscapementItem( const sal_uInt16 nId ) : 2417cdf0e10cSrcweir SfxEnumItemInterface( nId ), 2418cdf0e10cSrcweir 2419cdf0e10cSrcweir nEsc ( 0 ), 2420cdf0e10cSrcweir nProp ( 100 ) 2421cdf0e10cSrcweir { 2422cdf0e10cSrcweir } 2423cdf0e10cSrcweir 2424cdf0e10cSrcweir // ----------------------------------------------------------------------- 2425cdf0e10cSrcweir 2426cdf0e10cSrcweir SvxEscapementItem::SvxEscapementItem( const SvxEscapement eEscape, 2427cdf0e10cSrcweir const sal_uInt16 nId ) : 2428cdf0e10cSrcweir SfxEnumItemInterface( nId ), 2429cdf0e10cSrcweir nProp( 100 ) 2430cdf0e10cSrcweir { 2431cdf0e10cSrcweir SetEscapement( eEscape ); 2432cdf0e10cSrcweir if( nEsc ) 2433cdf0e10cSrcweir nProp = 58; 2434cdf0e10cSrcweir } 2435cdf0e10cSrcweir 2436cdf0e10cSrcweir // ----------------------------------------------------------------------- 2437cdf0e10cSrcweir 2438cdf0e10cSrcweir SvxEscapementItem::SvxEscapementItem( const short _nEsc, 2439cdf0e10cSrcweir const sal_uInt8 _nProp, 2440cdf0e10cSrcweir const sal_uInt16 nId ) : 2441cdf0e10cSrcweir SfxEnumItemInterface( nId ), 2442cdf0e10cSrcweir nEsc ( _nEsc ), 2443cdf0e10cSrcweir nProp ( _nProp ) 2444cdf0e10cSrcweir { 2445cdf0e10cSrcweir } 2446cdf0e10cSrcweir 2447cdf0e10cSrcweir // ----------------------------------------------------------------------- 2448cdf0e10cSrcweir 2449cdf0e10cSrcweir int SvxEscapementItem::operator==( const SfxPoolItem& rAttr ) const 2450cdf0e10cSrcweir { 2451cdf0e10cSrcweir DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" ); 2452cdf0e10cSrcweir 2453cdf0e10cSrcweir return( nEsc == ((SvxEscapementItem&)rAttr).nEsc && 2454cdf0e10cSrcweir nProp == ((SvxEscapementItem&)rAttr).nProp ); 2455cdf0e10cSrcweir } 2456cdf0e10cSrcweir 2457cdf0e10cSrcweir // ----------------------------------------------------------------------- 2458cdf0e10cSrcweir 2459cdf0e10cSrcweir SfxPoolItem* SvxEscapementItem::Clone( SfxItemPool * ) const 2460cdf0e10cSrcweir { 2461cdf0e10cSrcweir return new SvxEscapementItem( *this ); 2462cdf0e10cSrcweir } 2463cdf0e10cSrcweir 2464cdf0e10cSrcweir // ----------------------------------------------------------------------- 2465cdf0e10cSrcweir 2466cdf0e10cSrcweir SvStream& SvxEscapementItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const 2467cdf0e10cSrcweir { 2468cdf0e10cSrcweir short _nEsc = GetEsc(); 2469cdf0e10cSrcweir if( SOFFICE_FILEFORMAT_31 == rStrm.GetVersion() ) 2470cdf0e10cSrcweir { 2471cdf0e10cSrcweir if( DFLT_ESC_AUTO_SUPER == _nEsc ) 2472cdf0e10cSrcweir _nEsc = DFLT_ESC_SUPER; 2473cdf0e10cSrcweir else if( DFLT_ESC_AUTO_SUB == _nEsc ) 2474cdf0e10cSrcweir _nEsc = DFLT_ESC_SUB; 2475cdf0e10cSrcweir } 2476cdf0e10cSrcweir rStrm << (sal_uInt8) GetProp() 2477cdf0e10cSrcweir << (short) _nEsc; 2478cdf0e10cSrcweir return rStrm; 2479cdf0e10cSrcweir } 2480cdf0e10cSrcweir 2481cdf0e10cSrcweir // ----------------------------------------------------------------------- 2482cdf0e10cSrcweir 2483cdf0e10cSrcweir SfxPoolItem* SvxEscapementItem::Create(SvStream& rStrm, sal_uInt16) const 2484cdf0e10cSrcweir { 2485cdf0e10cSrcweir sal_uInt8 _nProp; 2486cdf0e10cSrcweir short _nEsc; 2487cdf0e10cSrcweir rStrm >> _nProp >> _nEsc; 2488cdf0e10cSrcweir return new SvxEscapementItem( _nEsc, _nProp, Which() ); 2489cdf0e10cSrcweir } 2490cdf0e10cSrcweir 2491cdf0e10cSrcweir // ----------------------------------------------------------------------- 2492cdf0e10cSrcweir 2493cdf0e10cSrcweir sal_uInt16 SvxEscapementItem::GetValueCount() const 2494cdf0e10cSrcweir { 2495cdf0e10cSrcweir return SVX_ESCAPEMENT_END; // SVX_ESCAPEMENT_SUBSCRIPT + 1 2496cdf0e10cSrcweir } 2497cdf0e10cSrcweir 2498cdf0e10cSrcweir //------------------------------------------------------------------------ 2499cdf0e10cSrcweir 2500cdf0e10cSrcweir SfxItemPresentation SvxEscapementItem::GetPresentation 2501cdf0e10cSrcweir ( 2502cdf0e10cSrcweir SfxItemPresentation ePres, 2503cdf0e10cSrcweir SfxMapUnit /*eCoreUnit*/, 2504cdf0e10cSrcweir SfxMapUnit /*ePresUnit*/, 2505cdf0e10cSrcweir XubString& rText, const IntlWrapper * /*pIntl*/ 2506cdf0e10cSrcweir ) const 2507cdf0e10cSrcweir { 2508cdf0e10cSrcweir switch ( ePres ) 2509cdf0e10cSrcweir { 2510cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NONE: 2511cdf0e10cSrcweir rText.Erase(); 2512cdf0e10cSrcweir return ePres; 2513cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NAMELESS: 2514cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_COMPLETE: 2515cdf0e10cSrcweir { 2516cdf0e10cSrcweir rText = GetValueTextByPos( GetEnumValue() ); 2517cdf0e10cSrcweir 2518cdf0e10cSrcweir if ( nEsc != 0 ) 2519cdf0e10cSrcweir { 2520cdf0e10cSrcweir if( DFLT_ESC_AUTO_SUPER == nEsc || DFLT_ESC_AUTO_SUB == nEsc ) 2521cdf0e10cSrcweir rText += String( EE_RESSTR(RID_SVXITEMS_ESCAPEMENT_AUTO) ); 2522cdf0e10cSrcweir else 2523cdf0e10cSrcweir ( rText += String::CreateFromInt32( nEsc )) += sal_Unicode('%'); 2524cdf0e10cSrcweir } 2525cdf0e10cSrcweir return ePres; 2526cdf0e10cSrcweir } 2527cdf0e10cSrcweir default: ; //prevent warning 2528cdf0e10cSrcweir } 2529cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_NONE; 2530cdf0e10cSrcweir } 2531cdf0e10cSrcweir 2532cdf0e10cSrcweir // ----------------------------------------------------------------------- 2533cdf0e10cSrcweir 2534cdf0e10cSrcweir XubString SvxEscapementItem::GetValueTextByPos( sal_uInt16 nPos ) const 2535cdf0e10cSrcweir { 2536cdf0e10cSrcweir DBG_ASSERT( nPos < (sal_uInt16)SVX_ESCAPEMENT_END, "enum overflow!" ); 2537cdf0e10cSrcweir return EE_RESSTR(RID_SVXITEMS_ESCAPEMENT_BEGIN + nPos); 2538cdf0e10cSrcweir } 2539cdf0e10cSrcweir 2540cdf0e10cSrcweir // ----------------------------------------------------------------------- 2541cdf0e10cSrcweir 2542cdf0e10cSrcweir sal_uInt16 SvxEscapementItem::GetEnumValue() const 2543cdf0e10cSrcweir { 2544cdf0e10cSrcweir if ( nEsc < 0 ) 2545cdf0e10cSrcweir return SVX_ESCAPEMENT_SUBSCRIPT; 2546cdf0e10cSrcweir else if ( nEsc > 0 ) 2547cdf0e10cSrcweir return SVX_ESCAPEMENT_SUPERSCRIPT; 2548cdf0e10cSrcweir return SVX_ESCAPEMENT_OFF; 2549cdf0e10cSrcweir } 2550cdf0e10cSrcweir 2551cdf0e10cSrcweir // ----------------------------------------------------------------------- 2552cdf0e10cSrcweir 2553cdf0e10cSrcweir void SvxEscapementItem::SetEnumValue( sal_uInt16 nVal ) 2554cdf0e10cSrcweir { 2555cdf0e10cSrcweir SetEscapement( (const SvxEscapement)nVal ); 2556cdf0e10cSrcweir } 2557cdf0e10cSrcweir 2558cdf0e10cSrcweir /*-----------------13.03.98 17:05------------------- 2559cdf0e10cSrcweir 2560cdf0e10cSrcweir --------------------------------------------------*/ 2561cdf0e10cSrcweir sal_Bool SvxEscapementItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const 2562cdf0e10cSrcweir { 2563cdf0e10cSrcweir // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); 2564cdf0e10cSrcweir nMemberId &= ~CONVERT_TWIPS; 2565cdf0e10cSrcweir switch(nMemberId) 2566cdf0e10cSrcweir { 2567cdf0e10cSrcweir case MID_ESC: 2568cdf0e10cSrcweir rVal <<= (sal_Int16)(nEsc); 2569cdf0e10cSrcweir break; 2570cdf0e10cSrcweir case MID_ESC_HEIGHT: 2571cdf0e10cSrcweir rVal <<= (sal_Int8)(nProp); 2572cdf0e10cSrcweir break; 2573cdf0e10cSrcweir case MID_AUTO_ESC: 2574cdf0e10cSrcweir rVal = Bool2Any(DFLT_ESC_AUTO_SUB == nEsc || DFLT_ESC_AUTO_SUPER == nEsc); 2575cdf0e10cSrcweir break; 2576cdf0e10cSrcweir } 2577cdf0e10cSrcweir return sal_True; 2578cdf0e10cSrcweir } 2579cdf0e10cSrcweir /*-----------------13.03.98 17:05------------------- 2580cdf0e10cSrcweir 2581cdf0e10cSrcweir --------------------------------------------------*/ 2582cdf0e10cSrcweir sal_Bool SvxEscapementItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) 2583cdf0e10cSrcweir { 2584cdf0e10cSrcweir // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); 2585cdf0e10cSrcweir nMemberId &= ~CONVERT_TWIPS; 2586cdf0e10cSrcweir switch(nMemberId) 2587cdf0e10cSrcweir { 2588cdf0e10cSrcweir case MID_ESC: 2589cdf0e10cSrcweir { 2590cdf0e10cSrcweir sal_Int16 nVal = sal_Int16(); 2591cdf0e10cSrcweir if( (rVal >>= nVal) && (Abs(nVal) <= 101)) 2592cdf0e10cSrcweir nEsc = nVal; 2593cdf0e10cSrcweir else 2594cdf0e10cSrcweir return sal_False; 2595cdf0e10cSrcweir } 2596cdf0e10cSrcweir break; 2597cdf0e10cSrcweir case MID_ESC_HEIGHT: 2598cdf0e10cSrcweir { 2599cdf0e10cSrcweir sal_Int8 nVal = sal_Int8(); 2600cdf0e10cSrcweir if( (rVal >>= nVal) && (nVal <= 100)) 2601cdf0e10cSrcweir nProp = nVal; 2602cdf0e10cSrcweir else 2603cdf0e10cSrcweir return sal_False; 2604cdf0e10cSrcweir } 2605cdf0e10cSrcweir break; 2606cdf0e10cSrcweir case MID_AUTO_ESC: 2607cdf0e10cSrcweir { 2608cdf0e10cSrcweir sal_Bool bVal = Any2Bool(rVal); 2609cdf0e10cSrcweir if(bVal) 2610cdf0e10cSrcweir { 2611cdf0e10cSrcweir if(nEsc < 0) 2612cdf0e10cSrcweir nEsc = DFLT_ESC_AUTO_SUB; 2613cdf0e10cSrcweir else 2614cdf0e10cSrcweir nEsc = DFLT_ESC_AUTO_SUPER; 2615cdf0e10cSrcweir } 2616cdf0e10cSrcweir else 2617cdf0e10cSrcweir if(DFLT_ESC_AUTO_SUPER == nEsc ) 2618cdf0e10cSrcweir --nEsc; 2619cdf0e10cSrcweir else if(DFLT_ESC_AUTO_SUB == nEsc) 2620cdf0e10cSrcweir ++nEsc; 2621cdf0e10cSrcweir } 2622cdf0e10cSrcweir break; 2623cdf0e10cSrcweir } 2624cdf0e10cSrcweir return sal_True; 2625cdf0e10cSrcweir } 2626cdf0e10cSrcweir 2627cdf0e10cSrcweir // class SvxLanguageItem ------------------------------------------------- 2628cdf0e10cSrcweir 2629cdf0e10cSrcweir SvxLanguageItem::SvxLanguageItem( const LanguageType eLang, const sal_uInt16 nId ) 2630cdf0e10cSrcweir : SfxEnumItem( nId , eLang ) 2631cdf0e10cSrcweir { 2632cdf0e10cSrcweir } 2633cdf0e10cSrcweir 2634cdf0e10cSrcweir // ----------------------------------------------------------------------- 2635cdf0e10cSrcweir 2636cdf0e10cSrcweir sal_uInt16 SvxLanguageItem::GetValueCount() const 2637cdf0e10cSrcweir { 2638cdf0e10cSrcweir // #i50205# got rid of class International 2639cdf0e10cSrcweir DBG_ERRORFILE("SvxLanguageItem::GetValueCount: supposed to return a count of what?"); 2640cdf0e10cSrcweir // FIXME: previously returned LANGUAGE_COUNT from tools/intn.hxx which was wrong anyway. 2641cdf0e10cSrcweir // Could be SvtLanguageTable::GetEntryCount() (all locales with resource string)? 2642cdf0e10cSrcweir // Could be LocaleDataWrapper::getInstalledLanguageTypes() (all locales with locale data)? 2643cdf0e10cSrcweir return 0; 2644cdf0e10cSrcweir } 2645cdf0e10cSrcweir 2646cdf0e10cSrcweir // ----------------------------------------------------------------------- 2647cdf0e10cSrcweir 2648cdf0e10cSrcweir SfxPoolItem* SvxLanguageItem::Clone( SfxItemPool * ) const 2649cdf0e10cSrcweir { 2650cdf0e10cSrcweir return new SvxLanguageItem( *this ); 2651cdf0e10cSrcweir } 2652cdf0e10cSrcweir 2653cdf0e10cSrcweir // ----------------------------------------------------------------------- 2654cdf0e10cSrcweir 2655cdf0e10cSrcweir SvStream& SvxLanguageItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const 2656cdf0e10cSrcweir { 2657cdf0e10cSrcweir rStrm << (sal_uInt16) GetValue(); 2658cdf0e10cSrcweir return rStrm; 2659cdf0e10cSrcweir } 2660cdf0e10cSrcweir 2661cdf0e10cSrcweir // ----------------------------------------------------------------------- 2662cdf0e10cSrcweir 2663cdf0e10cSrcweir SfxPoolItem* SvxLanguageItem::Create(SvStream& rStrm, sal_uInt16) const 2664cdf0e10cSrcweir { 2665cdf0e10cSrcweir sal_uInt16 nValue; 2666cdf0e10cSrcweir rStrm >> nValue; 2667cdf0e10cSrcweir return new SvxLanguageItem( (LanguageType)nValue, Which() ); 2668cdf0e10cSrcweir } 2669cdf0e10cSrcweir 2670cdf0e10cSrcweir //------------------------------------------------------------------------ 2671cdf0e10cSrcweir 2672cdf0e10cSrcweir SfxItemPresentation SvxLanguageItem::GetPresentation 2673cdf0e10cSrcweir ( 2674cdf0e10cSrcweir SfxItemPresentation ePres, 2675cdf0e10cSrcweir SfxMapUnit /*eCoreUnit*/, 2676cdf0e10cSrcweir SfxMapUnit /*ePresUnit*/, 2677cdf0e10cSrcweir XubString& rText, const IntlWrapper * /*pIntl*/ 2678cdf0e10cSrcweir ) const 2679cdf0e10cSrcweir { 2680cdf0e10cSrcweir #ifndef SVX_LIGHT 2681cdf0e10cSrcweir switch ( ePres ) 2682cdf0e10cSrcweir { 2683cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NONE: 2684cdf0e10cSrcweir rText.Erase(); 2685cdf0e10cSrcweir return ePres; 2686cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NAMELESS: 2687cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_COMPLETE: 2688cdf0e10cSrcweir { 2689cdf0e10cSrcweir SvtLanguageTable aLangTable; 2690cdf0e10cSrcweir rText = aLangTable.GetString( (LanguageType)GetValue() ); 2691cdf0e10cSrcweir return ePres; 2692cdf0e10cSrcweir } 2693cdf0e10cSrcweir default: ; //prevent warning 2694cdf0e10cSrcweir } 2695cdf0e10cSrcweir #endif // !SVX_LIGHT 2696cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_NONE; 2697cdf0e10cSrcweir } 2698cdf0e10cSrcweir 2699cdf0e10cSrcweir /*-----------------14.03.98 14:13------------------- 2700cdf0e10cSrcweir 2701cdf0e10cSrcweir --------------------------------------------------*/ 2702cdf0e10cSrcweir sal_Bool SvxLanguageItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const 2703cdf0e10cSrcweir { 2704cdf0e10cSrcweir // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); 2705cdf0e10cSrcweir nMemberId &= ~CONVERT_TWIPS; 2706cdf0e10cSrcweir switch(nMemberId) 2707cdf0e10cSrcweir { 2708cdf0e10cSrcweir case MID_LANG_INT: // for basic conversions! 2709cdf0e10cSrcweir rVal <<= (sal_Int16)(GetValue()); 2710cdf0e10cSrcweir break; 2711cdf0e10cSrcweir case MID_LANG_LOCALE: 2712cdf0e10cSrcweir lang::Locale aRet( MsLangId::convertLanguageToLocale( GetValue(), false)); 2713cdf0e10cSrcweir rVal <<= aRet; 2714cdf0e10cSrcweir break; 2715cdf0e10cSrcweir } 2716cdf0e10cSrcweir return sal_True; 2717cdf0e10cSrcweir } 2718cdf0e10cSrcweir /*-----------------14.03.98 14:13------------------- 2719cdf0e10cSrcweir 2720cdf0e10cSrcweir --------------------------------------------------*/ 2721cdf0e10cSrcweir sal_Bool SvxLanguageItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) 2722cdf0e10cSrcweir { 2723cdf0e10cSrcweir // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); 2724cdf0e10cSrcweir nMemberId &= ~CONVERT_TWIPS; 2725cdf0e10cSrcweir switch(nMemberId) 2726cdf0e10cSrcweir { 2727cdf0e10cSrcweir case MID_LANG_INT: // for basic conversions! 2728cdf0e10cSrcweir { 2729cdf0e10cSrcweir sal_Int32 nValue = 0; 2730cdf0e10cSrcweir if(!(rVal >>= nValue)) 2731cdf0e10cSrcweir return sal_False; 2732cdf0e10cSrcweir 2733cdf0e10cSrcweir SetValue((sal_Int16)nValue); 2734cdf0e10cSrcweir } 2735cdf0e10cSrcweir break; 2736cdf0e10cSrcweir case MID_LANG_LOCALE: 2737cdf0e10cSrcweir { 2738cdf0e10cSrcweir lang::Locale aLocale; 2739cdf0e10cSrcweir if(!(rVal >>= aLocale)) 2740cdf0e10cSrcweir return sal_False; 2741cdf0e10cSrcweir 2742cdf0e10cSrcweir if (aLocale.Language.getLength() || aLocale.Country.getLength()) 2743cdf0e10cSrcweir SetValue(MsLangId::convertLocaleToLanguage( aLocale )); 2744cdf0e10cSrcweir else 2745cdf0e10cSrcweir SetValue(LANGUAGE_NONE); 2746cdf0e10cSrcweir } 2747cdf0e10cSrcweir break; 2748cdf0e10cSrcweir } 2749cdf0e10cSrcweir return sal_True; 2750cdf0e10cSrcweir } 2751cdf0e10cSrcweir 2752cdf0e10cSrcweir // class SvxNoLinebreakItem ---------------------------------------------- 2753cdf0e10cSrcweir SvxNoLinebreakItem::SvxNoLinebreakItem( const sal_Bool bBreak, const sal_uInt16 nId ) : 2754cdf0e10cSrcweir SfxBoolItem( nId, bBreak ) 2755cdf0e10cSrcweir { 2756cdf0e10cSrcweir } 2757cdf0e10cSrcweir 2758cdf0e10cSrcweir // ----------------------------------------------------------------------- 2759cdf0e10cSrcweir 2760cdf0e10cSrcweir SfxPoolItem* SvxNoLinebreakItem::Clone( SfxItemPool* ) const 2761cdf0e10cSrcweir { 2762cdf0e10cSrcweir return new SvxNoLinebreakItem( *this ); 2763cdf0e10cSrcweir } 2764cdf0e10cSrcweir 2765cdf0e10cSrcweir // ----------------------------------------------------------------------- 2766cdf0e10cSrcweir 2767cdf0e10cSrcweir SvStream& SvxNoLinebreakItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const 2768cdf0e10cSrcweir { 2769cdf0e10cSrcweir rStrm << (sal_Bool)GetValue(); 2770cdf0e10cSrcweir return rStrm; 2771cdf0e10cSrcweir } 2772cdf0e10cSrcweir 2773cdf0e10cSrcweir // ----------------------------------------------------------------------- 2774cdf0e10cSrcweir 2775cdf0e10cSrcweir SfxPoolItem* SvxNoLinebreakItem::Create(SvStream& rStrm, sal_uInt16) const 2776cdf0e10cSrcweir { 2777cdf0e10cSrcweir sal_Bool bValue; 2778cdf0e10cSrcweir rStrm >> bValue; 2779cdf0e10cSrcweir return new SvxNoLinebreakItem( bValue, Which() ); 2780cdf0e10cSrcweir } 2781cdf0e10cSrcweir 2782cdf0e10cSrcweir //------------------------------------------------------------------------ 2783cdf0e10cSrcweir 2784cdf0e10cSrcweir SfxItemPresentation SvxNoLinebreakItem::GetPresentation 2785cdf0e10cSrcweir ( 2786cdf0e10cSrcweir SfxItemPresentation /*ePres*/, 2787cdf0e10cSrcweir SfxMapUnit /*eCoreUnit*/, 2788cdf0e10cSrcweir SfxMapUnit /*ePresUnit*/, 2789cdf0e10cSrcweir XubString& rText, const IntlWrapper * /*pIntl*/ 2790cdf0e10cSrcweir ) const 2791cdf0e10cSrcweir { 2792cdf0e10cSrcweir rText.Erase(); 2793cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_NONE; 2794cdf0e10cSrcweir } 2795cdf0e10cSrcweir 2796cdf0e10cSrcweir // class SvxNoHyphenItem ------------------------------------------------- 2797cdf0e10cSrcweir 2798cdf0e10cSrcweir SvxNoHyphenItem::SvxNoHyphenItem( const sal_Bool bHyphen, const sal_uInt16 nId ) : 2799cdf0e10cSrcweir SfxBoolItem( nId , bHyphen ) 2800cdf0e10cSrcweir { 2801cdf0e10cSrcweir } 2802cdf0e10cSrcweir 2803cdf0e10cSrcweir // ----------------------------------------------------------------------- 2804cdf0e10cSrcweir 2805cdf0e10cSrcweir SfxPoolItem* SvxNoHyphenItem::Clone( SfxItemPool* ) const 2806cdf0e10cSrcweir { 2807cdf0e10cSrcweir return new SvxNoHyphenItem( *this ); 2808cdf0e10cSrcweir } 2809cdf0e10cSrcweir 2810cdf0e10cSrcweir // ----------------------------------------------------------------------- 2811cdf0e10cSrcweir 2812cdf0e10cSrcweir SvStream& SvxNoHyphenItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const 2813cdf0e10cSrcweir { 2814cdf0e10cSrcweir rStrm << (sal_Bool) GetValue(); 2815cdf0e10cSrcweir return rStrm; 2816cdf0e10cSrcweir } 2817cdf0e10cSrcweir 2818cdf0e10cSrcweir // ----------------------------------------------------------------------- 2819cdf0e10cSrcweir 2820cdf0e10cSrcweir SfxPoolItem* SvxNoHyphenItem::Create( SvStream& rStrm, sal_uInt16 ) const 2821cdf0e10cSrcweir { 2822cdf0e10cSrcweir sal_Bool bValue; 2823cdf0e10cSrcweir rStrm >> bValue; 2824cdf0e10cSrcweir return new SvxNoHyphenItem( bValue, Which() ); 2825cdf0e10cSrcweir } 2826cdf0e10cSrcweir 2827cdf0e10cSrcweir //------------------------------------------------------------------------ 2828cdf0e10cSrcweir 2829cdf0e10cSrcweir SfxItemPresentation SvxNoHyphenItem::GetPresentation 2830cdf0e10cSrcweir ( 2831cdf0e10cSrcweir SfxItemPresentation /*ePres*/, 2832cdf0e10cSrcweir SfxMapUnit /*eCoreUnit*/, 2833cdf0e10cSrcweir SfxMapUnit /*ePresUnit*/, 2834cdf0e10cSrcweir XubString& rText, const IntlWrapper * /*pIntl*/ 2835cdf0e10cSrcweir ) const 2836cdf0e10cSrcweir { 2837cdf0e10cSrcweir rText.Erase(); 2838cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_NONE; 2839cdf0e10cSrcweir } 2840cdf0e10cSrcweir 2841cdf0e10cSrcweir /* 2842cdf0e10cSrcweir * Dummy-Item fuer ToolBox-Controls: 2843cdf0e10cSrcweir * 2844cdf0e10cSrcweir */ 2845cdf0e10cSrcweir 2846cdf0e10cSrcweir // ----------------------------------------------------------------------- 2847cdf0e10cSrcweir // class SvxLineColorItem (== SvxColorItem) 2848cdf0e10cSrcweir // ----------------------------------------------------------------------- 2849cdf0e10cSrcweir 2850cdf0e10cSrcweir SvxLineColorItem::SvxLineColorItem( const sal_uInt16 nId ) : 2851cdf0e10cSrcweir SvxColorItem( nId ) 2852cdf0e10cSrcweir { 2853cdf0e10cSrcweir } 2854cdf0e10cSrcweir 2855cdf0e10cSrcweir // ----------------------------------------------------------------------- 2856cdf0e10cSrcweir 2857cdf0e10cSrcweir SvxLineColorItem::SvxLineColorItem( const Color& rCol, const sal_uInt16 nId ) : 2858cdf0e10cSrcweir SvxColorItem( rCol, nId ) 2859cdf0e10cSrcweir { 2860cdf0e10cSrcweir } 2861cdf0e10cSrcweir 2862cdf0e10cSrcweir // ----------------------------------------------------------------------- 2863cdf0e10cSrcweir 2864cdf0e10cSrcweir SvxLineColorItem::SvxLineColorItem( SvStream &rStrm, const sal_uInt16 nId ) : 2865cdf0e10cSrcweir SvxColorItem( rStrm, nId ) 2866cdf0e10cSrcweir { 2867cdf0e10cSrcweir } 2868cdf0e10cSrcweir 2869cdf0e10cSrcweir // ----------------------------------------------------------------------- 2870cdf0e10cSrcweir 2871cdf0e10cSrcweir SvxLineColorItem::SvxLineColorItem( const SvxLineColorItem &rCopy ) : 2872cdf0e10cSrcweir SvxColorItem( rCopy ) 2873cdf0e10cSrcweir { 2874cdf0e10cSrcweir } 2875cdf0e10cSrcweir 2876cdf0e10cSrcweir // ----------------------------------------------------------------------- 2877cdf0e10cSrcweir 2878cdf0e10cSrcweir SvxLineColorItem::~SvxLineColorItem() 2879cdf0e10cSrcweir { 2880cdf0e10cSrcweir } 2881cdf0e10cSrcweir 2882cdf0e10cSrcweir //------------------------------------------------------------------------ 2883cdf0e10cSrcweir 2884cdf0e10cSrcweir SfxItemPresentation SvxLineColorItem::GetPresentation 2885cdf0e10cSrcweir ( 2886cdf0e10cSrcweir SfxItemPresentation ePres, 2887cdf0e10cSrcweir SfxMapUnit eCoreUnit, 2888cdf0e10cSrcweir SfxMapUnit ePresUnit, 2889cdf0e10cSrcweir XubString& rText, 2890cdf0e10cSrcweir const IntlWrapper * pIntlWrapper 2891cdf0e10cSrcweir ) const 2892cdf0e10cSrcweir { 2893cdf0e10cSrcweir return SvxColorItem::GetPresentation( ePres, eCoreUnit, ePresUnit, 2894cdf0e10cSrcweir rText, pIntlWrapper ); 2895cdf0e10cSrcweir } 2896cdf0e10cSrcweir 2897cdf0e10cSrcweir // class SvxBlinkItem ------------------------------------------------- 2898cdf0e10cSrcweir 2899cdf0e10cSrcweir 2900cdf0e10cSrcweir SvxBlinkItem::SvxBlinkItem( const sal_Bool bBlink, const sal_uInt16 nId ) : 2901cdf0e10cSrcweir SfxBoolItem( nId, bBlink ) 2902cdf0e10cSrcweir { 2903cdf0e10cSrcweir } 2904cdf0e10cSrcweir 2905cdf0e10cSrcweir // ----------------------------------------------------------------------- 2906cdf0e10cSrcweir 2907cdf0e10cSrcweir SfxPoolItem* SvxBlinkItem::Clone( SfxItemPool * ) const 2908cdf0e10cSrcweir { 2909cdf0e10cSrcweir return new SvxBlinkItem( *this ); 2910cdf0e10cSrcweir } 2911cdf0e10cSrcweir 2912cdf0e10cSrcweir // ----------------------------------------------------------------------- 2913cdf0e10cSrcweir 2914cdf0e10cSrcweir SvStream& SvxBlinkItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const 2915cdf0e10cSrcweir { 2916cdf0e10cSrcweir rStrm << (sal_uInt8) GetValue(); 2917cdf0e10cSrcweir return rStrm; 2918cdf0e10cSrcweir } 2919cdf0e10cSrcweir 2920cdf0e10cSrcweir // ----------------------------------------------------------------------- 2921cdf0e10cSrcweir 2922cdf0e10cSrcweir SfxPoolItem* SvxBlinkItem::Create(SvStream& rStrm, sal_uInt16) const 2923cdf0e10cSrcweir { 2924cdf0e10cSrcweir sal_uInt8 nState; 2925cdf0e10cSrcweir rStrm >> nState; 2926cdf0e10cSrcweir return new SvxBlinkItem( nState, Which() ); 2927cdf0e10cSrcweir } 2928cdf0e10cSrcweir 2929cdf0e10cSrcweir // ----------------------------------------------------------------------- 2930cdf0e10cSrcweir 2931cdf0e10cSrcweir SfxItemPresentation SvxBlinkItem::GetPresentation 2932cdf0e10cSrcweir ( 2933cdf0e10cSrcweir SfxItemPresentation ePres, 2934cdf0e10cSrcweir SfxMapUnit /*eCoreUnit*/, 2935cdf0e10cSrcweir SfxMapUnit /*ePresUnit*/, 2936cdf0e10cSrcweir XubString& rText, const IntlWrapper * /*pIntl*/ 2937cdf0e10cSrcweir ) const 2938cdf0e10cSrcweir { 2939cdf0e10cSrcweir switch ( ePres ) 2940cdf0e10cSrcweir { 2941cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NONE: 2942cdf0e10cSrcweir rText.Erase(); 2943cdf0e10cSrcweir return ePres; 2944cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NAMELESS: 2945cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_COMPLETE: 2946cdf0e10cSrcweir { 2947cdf0e10cSrcweir sal_uInt16 nId = RID_SVXITEMS_BLINK_FALSE; 2948cdf0e10cSrcweir 2949cdf0e10cSrcweir if ( GetValue() ) 2950cdf0e10cSrcweir nId = RID_SVXITEMS_BLINK_TRUE; 2951cdf0e10cSrcweir rText = EE_RESSTR(nId); 2952cdf0e10cSrcweir return ePres; 2953cdf0e10cSrcweir } 2954cdf0e10cSrcweir default: ; //prevent warning 2955cdf0e10cSrcweir } 2956cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_NONE; 2957cdf0e10cSrcweir } 2958cdf0e10cSrcweir 2959cdf0e10cSrcweir // class SvxEmphaisMarkItem --------------------------------------------------- 2960cdf0e10cSrcweir 2961cdf0e10cSrcweir SvxEmphasisMarkItem::SvxEmphasisMarkItem( const FontEmphasisMark nValue, 2962cdf0e10cSrcweir const sal_uInt16 nId ) 2963cdf0e10cSrcweir : SfxUInt16Item( nId, nValue ) 2964cdf0e10cSrcweir { 2965cdf0e10cSrcweir } 2966cdf0e10cSrcweir 2967cdf0e10cSrcweir // ----------------------------------------------------------------------- 2968cdf0e10cSrcweir 2969cdf0e10cSrcweir SfxPoolItem* SvxEmphasisMarkItem::Clone( SfxItemPool * ) const 2970cdf0e10cSrcweir { 2971cdf0e10cSrcweir return new SvxEmphasisMarkItem( *this ); 2972cdf0e10cSrcweir } 2973cdf0e10cSrcweir 2974cdf0e10cSrcweir // ----------------------------------------------------------------------- 2975cdf0e10cSrcweir 2976cdf0e10cSrcweir SvStream& SvxEmphasisMarkItem::Store( SvStream& rStrm, 2977cdf0e10cSrcweir sal_uInt16 /*nItemVersion*/ ) const 2978cdf0e10cSrcweir { 2979cdf0e10cSrcweir rStrm << (sal_uInt16)GetValue(); 2980cdf0e10cSrcweir return rStrm; 2981cdf0e10cSrcweir } 2982cdf0e10cSrcweir 2983cdf0e10cSrcweir // ----------------------------------------------------------------------- 2984cdf0e10cSrcweir 2985cdf0e10cSrcweir SfxPoolItem* SvxEmphasisMarkItem::Create( SvStream& rStrm, sal_uInt16 ) const 2986cdf0e10cSrcweir { 2987cdf0e10cSrcweir sal_uInt16 nValue; 2988cdf0e10cSrcweir rStrm >> nValue; 2989cdf0e10cSrcweir return new SvxEmphasisMarkItem( (FontEmphasisMark)nValue, Which() ); 2990cdf0e10cSrcweir } 2991cdf0e10cSrcweir 2992cdf0e10cSrcweir //------------------------------------------------------------------------ 2993cdf0e10cSrcweir 2994cdf0e10cSrcweir SfxItemPresentation SvxEmphasisMarkItem::GetPresentation 2995cdf0e10cSrcweir ( 2996cdf0e10cSrcweir SfxItemPresentation ePres, 2997cdf0e10cSrcweir SfxMapUnit /*eCoreUnit*/, 2998cdf0e10cSrcweir SfxMapUnit /*ePresUnit*/, 2999cdf0e10cSrcweir XubString& rText, 3000cdf0e10cSrcweir const IntlWrapper * /*pIntl*/ 3001cdf0e10cSrcweir ) const 3002cdf0e10cSrcweir { 3003cdf0e10cSrcweir switch ( ePres ) 3004cdf0e10cSrcweir { 3005cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NONE: 3006cdf0e10cSrcweir rText.Erase(); 3007cdf0e10cSrcweir return ePres; 3008cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NAMELESS: 3009cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_COMPLETE: 3010cdf0e10cSrcweir { 3011cdf0e10cSrcweir sal_uInt16 nVal = GetValue(); 3012cdf0e10cSrcweir rText = EE_RESSTR( RID_SVXITEMS_EMPHASIS_BEGIN_STYLE + 3013cdf0e10cSrcweir ( EMPHASISMARK_STYLE & nVal )); 3014cdf0e10cSrcweir sal_uInt16 nId = ( EMPHASISMARK_POS_ABOVE & nVal ) 3015cdf0e10cSrcweir ? RID_SVXITEMS_EMPHASIS_ABOVE_POS 3016cdf0e10cSrcweir : ( EMPHASISMARK_POS_BELOW & nVal ) 3017cdf0e10cSrcweir ? RID_SVXITEMS_EMPHASIS_BELOW_POS 3018cdf0e10cSrcweir : 0; 3019cdf0e10cSrcweir if( nId ) 3020cdf0e10cSrcweir rText += EE_RESSTR( nId ); 3021cdf0e10cSrcweir return ePres; 3022cdf0e10cSrcweir } 3023cdf0e10cSrcweir default: ; //prevent warning 3024cdf0e10cSrcweir } 3025cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_NONE; 3026cdf0e10cSrcweir } 3027cdf0e10cSrcweir 3028cdf0e10cSrcweir // ----------------------------------------------------------------------- 3029cdf0e10cSrcweir 3030cdf0e10cSrcweir sal_Bool SvxEmphasisMarkItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const 3031cdf0e10cSrcweir { 3032cdf0e10cSrcweir // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); 3033cdf0e10cSrcweir nMemberId &= ~CONVERT_TWIPS; 3034cdf0e10cSrcweir switch( nMemberId ) 3035cdf0e10cSrcweir { 3036cdf0e10cSrcweir case MID_EMPHASIS: 3037cdf0e10cSrcweir { 3038cdf0e10cSrcweir sal_Int16 nValue = GetValue(); 3039cdf0e10cSrcweir sal_Int16 nRet = 0; 3040cdf0e10cSrcweir switch(nValue & EMPHASISMARK_STYLE) 3041cdf0e10cSrcweir { 3042cdf0e10cSrcweir case EMPHASISMARK_NONE : nRet = FontEmphasis::NONE; break; 3043cdf0e10cSrcweir case EMPHASISMARK_DOT : nRet = FontEmphasis::DOT_ABOVE; break; 3044cdf0e10cSrcweir case EMPHASISMARK_CIRCLE : nRet = FontEmphasis::CIRCLE_ABOVE; break; 3045cdf0e10cSrcweir case EMPHASISMARK_DISC : nRet = FontEmphasis::DISK_ABOVE; break; 3046cdf0e10cSrcweir case EMPHASISMARK_ACCENT : nRet = FontEmphasis::ACCENT_ABOVE; break; 3047cdf0e10cSrcweir } 3048cdf0e10cSrcweir if(nRet && nValue & EMPHASISMARK_POS_BELOW) 3049cdf0e10cSrcweir nRet += 10; 3050cdf0e10cSrcweir rVal <<= nRet; 3051cdf0e10cSrcweir } 3052cdf0e10cSrcweir break; 3053cdf0e10cSrcweir } 3054cdf0e10cSrcweir return sal_True; 3055cdf0e10cSrcweir } 3056cdf0e10cSrcweir 3057cdf0e10cSrcweir sal_Bool SvxEmphasisMarkItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) 3058cdf0e10cSrcweir { 3059cdf0e10cSrcweir // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); 3060cdf0e10cSrcweir nMemberId &= ~CONVERT_TWIPS; 3061cdf0e10cSrcweir sal_Bool bRet = sal_True; 3062cdf0e10cSrcweir switch( nMemberId ) 3063cdf0e10cSrcweir { 3064cdf0e10cSrcweir case MID_EMPHASIS: 3065cdf0e10cSrcweir { 3066cdf0e10cSrcweir sal_Int32 nValue = -1; 3067cdf0e10cSrcweir rVal >>= nValue; 3068cdf0e10cSrcweir switch(nValue) 3069cdf0e10cSrcweir { 3070cdf0e10cSrcweir case FontEmphasis::NONE : nValue = EMPHASISMARK_NONE; break; 3071cdf0e10cSrcweir case FontEmphasis::DOT_ABOVE : nValue = EMPHASISMARK_DOT|EMPHASISMARK_POS_ABOVE; break; 3072cdf0e10cSrcweir case FontEmphasis::CIRCLE_ABOVE: nValue = EMPHASISMARK_CIRCLE|EMPHASISMARK_POS_ABOVE; break; 3073cdf0e10cSrcweir case FontEmphasis::DISK_ABOVE : nValue = EMPHASISMARK_DISC|EMPHASISMARK_POS_ABOVE; break; 3074cdf0e10cSrcweir case FontEmphasis::ACCENT_ABOVE: nValue = EMPHASISMARK_ACCENT|EMPHASISMARK_POS_ABOVE; break; 3075cdf0e10cSrcweir case FontEmphasis::DOT_BELOW : nValue = EMPHASISMARK_DOT|EMPHASISMARK_POS_BELOW; break; 3076cdf0e10cSrcweir case FontEmphasis::CIRCLE_BELOW: nValue = EMPHASISMARK_CIRCLE|EMPHASISMARK_POS_BELOW; break; 3077cdf0e10cSrcweir case FontEmphasis::DISK_BELOW : nValue = EMPHASISMARK_DISC|EMPHASISMARK_POS_BELOW; break; 3078cdf0e10cSrcweir case FontEmphasis::ACCENT_BELOW: nValue = EMPHASISMARK_ACCENT|EMPHASISMARK_POS_BELOW; break; 3079cdf0e10cSrcweir default: return sal_False; 3080cdf0e10cSrcweir } 3081cdf0e10cSrcweir SetValue( (sal_Int16)nValue ); 3082cdf0e10cSrcweir } 3083cdf0e10cSrcweir break; 3084cdf0e10cSrcweir } 3085cdf0e10cSrcweir return bRet; 3086cdf0e10cSrcweir } 3087cdf0e10cSrcweir 3088cdf0e10cSrcweir sal_uInt16 SvxEmphasisMarkItem::GetVersion( sal_uInt16 nFFVer ) const 3089cdf0e10cSrcweir { 3090cdf0e10cSrcweir DBG_ASSERT( SOFFICE_FILEFORMAT_31==nFFVer || 3091cdf0e10cSrcweir SOFFICE_FILEFORMAT_40==nFFVer || 3092cdf0e10cSrcweir SOFFICE_FILEFORMAT_50==nFFVer, 3093cdf0e10cSrcweir "SvxEmphasisMarkItem: Gibt es ein neues Fileformat?" ); 3094cdf0e10cSrcweir 3095cdf0e10cSrcweir return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0; 3096cdf0e10cSrcweir } 3097cdf0e10cSrcweir 3098cdf0e10cSrcweir 3099cdf0e10cSrcweir /************************************************************************* 3100cdf0e10cSrcweir |* class SvxTwoLinesItem 3101cdf0e10cSrcweir *************************************************************************/ 3102cdf0e10cSrcweir 3103cdf0e10cSrcweir SvxTwoLinesItem::SvxTwoLinesItem( sal_Bool bFlag, sal_Unicode nStartBracket, 3104cdf0e10cSrcweir sal_Unicode nEndBracket, sal_uInt16 nW ) 3105cdf0e10cSrcweir : SfxPoolItem( nW ), 3106cdf0e10cSrcweir cStartBracket( nStartBracket ), cEndBracket( nEndBracket ), bOn( bFlag ) 3107cdf0e10cSrcweir { 3108cdf0e10cSrcweir } 3109cdf0e10cSrcweir 3110cdf0e10cSrcweir SvxTwoLinesItem::SvxTwoLinesItem( const SvxTwoLinesItem& rAttr ) 3111cdf0e10cSrcweir : SfxPoolItem( rAttr.Which() ), 3112cdf0e10cSrcweir cStartBracket( rAttr.cStartBracket ), 3113cdf0e10cSrcweir cEndBracket( rAttr.cEndBracket ), 3114cdf0e10cSrcweir bOn( rAttr.bOn ) 3115cdf0e10cSrcweir { 3116cdf0e10cSrcweir } 3117cdf0e10cSrcweir 3118cdf0e10cSrcweir SvxTwoLinesItem::~SvxTwoLinesItem() 3119cdf0e10cSrcweir { 3120cdf0e10cSrcweir } 3121cdf0e10cSrcweir 3122cdf0e10cSrcweir int SvxTwoLinesItem::operator==( const SfxPoolItem& rAttr ) const 3123cdf0e10cSrcweir { 3124cdf0e10cSrcweir DBG_ASSERT( SfxPoolItem::operator==( rAttr ), "not equal attribute types" ); 3125cdf0e10cSrcweir return bOn == ((SvxTwoLinesItem&)rAttr).bOn && 3126cdf0e10cSrcweir cStartBracket == ((SvxTwoLinesItem&)rAttr).cStartBracket && 3127cdf0e10cSrcweir cEndBracket == ((SvxTwoLinesItem&)rAttr).cEndBracket; 3128cdf0e10cSrcweir } 3129cdf0e10cSrcweir 3130cdf0e10cSrcweir SfxPoolItem* SvxTwoLinesItem::Clone( SfxItemPool* ) const 3131cdf0e10cSrcweir { 3132cdf0e10cSrcweir return new SvxTwoLinesItem( *this ); 3133cdf0e10cSrcweir } 3134cdf0e10cSrcweir 3135cdf0e10cSrcweir sal_Bool SvxTwoLinesItem::QueryValue( com::sun::star::uno::Any& rVal, 3136cdf0e10cSrcweir sal_uInt8 nMemberId ) const 3137cdf0e10cSrcweir { 3138cdf0e10cSrcweir // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); 3139cdf0e10cSrcweir nMemberId &= ~CONVERT_TWIPS; 3140cdf0e10cSrcweir sal_Bool bRet = sal_True; 3141cdf0e10cSrcweir switch( nMemberId ) 3142cdf0e10cSrcweir { 3143cdf0e10cSrcweir case MID_TWOLINES: 3144cdf0e10cSrcweir rVal = Bool2Any( bOn ); 3145cdf0e10cSrcweir break; 3146cdf0e10cSrcweir case MID_START_BRACKET: 3147cdf0e10cSrcweir { 3148cdf0e10cSrcweir OUString s; 3149cdf0e10cSrcweir if( cStartBracket ) 3150cdf0e10cSrcweir s = OUString( cStartBracket ); 3151cdf0e10cSrcweir rVal <<= s; 3152cdf0e10cSrcweir } 3153cdf0e10cSrcweir break; 3154cdf0e10cSrcweir case MID_END_BRACKET: 3155cdf0e10cSrcweir { 3156cdf0e10cSrcweir OUString s; 3157cdf0e10cSrcweir if( cEndBracket ) 3158cdf0e10cSrcweir s = OUString( cEndBracket ); 3159cdf0e10cSrcweir rVal <<= s; 3160cdf0e10cSrcweir } 3161cdf0e10cSrcweir break; 3162cdf0e10cSrcweir default: 3163cdf0e10cSrcweir bRet = sal_False; 3164cdf0e10cSrcweir break; 3165cdf0e10cSrcweir } 3166cdf0e10cSrcweir return bRet; 3167cdf0e10cSrcweir } 3168cdf0e10cSrcweir 3169cdf0e10cSrcweir sal_Bool SvxTwoLinesItem::PutValue( const com::sun::star::uno::Any& rVal, 3170cdf0e10cSrcweir sal_uInt8 nMemberId ) 3171cdf0e10cSrcweir { 3172cdf0e10cSrcweir // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); 3173cdf0e10cSrcweir nMemberId &= ~CONVERT_TWIPS; 3174cdf0e10cSrcweir sal_Bool bRet = sal_False; 3175cdf0e10cSrcweir OUString s; 3176cdf0e10cSrcweir switch( nMemberId ) 3177cdf0e10cSrcweir { 3178cdf0e10cSrcweir case MID_TWOLINES: 3179cdf0e10cSrcweir bOn = Any2Bool( rVal ); 3180cdf0e10cSrcweir bRet = sal_True; 3181cdf0e10cSrcweir break; 3182cdf0e10cSrcweir case MID_START_BRACKET: 3183cdf0e10cSrcweir if( rVal >>= s ) 3184cdf0e10cSrcweir { 3185cdf0e10cSrcweir cStartBracket = s.getLength() ? s[ 0 ] : 0; 3186cdf0e10cSrcweir bRet = sal_True; 3187cdf0e10cSrcweir } 3188cdf0e10cSrcweir break; 3189cdf0e10cSrcweir case MID_END_BRACKET: 3190cdf0e10cSrcweir if( rVal >>= s ) 3191cdf0e10cSrcweir { 3192cdf0e10cSrcweir cEndBracket = s.getLength() ? s[ 0 ] : 0; 3193cdf0e10cSrcweir bRet = sal_True; 3194cdf0e10cSrcweir } 3195cdf0e10cSrcweir break; 3196cdf0e10cSrcweir } 3197cdf0e10cSrcweir return bRet; 3198cdf0e10cSrcweir } 3199cdf0e10cSrcweir 3200cdf0e10cSrcweir SfxItemPresentation SvxTwoLinesItem::GetPresentation( SfxItemPresentation ePres, 3201cdf0e10cSrcweir SfxMapUnit /*eCoreMetric*/, SfxMapUnit /*ePresMetric*/, 3202cdf0e10cSrcweir String &rText, const IntlWrapper* /*pIntl*/ ) const 3203cdf0e10cSrcweir { 3204cdf0e10cSrcweir switch( ePres ) 3205cdf0e10cSrcweir { 3206cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NONE: 3207cdf0e10cSrcweir rText.Erase(); 3208cdf0e10cSrcweir break; 3209cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NAMELESS: 3210cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_COMPLETE: 3211cdf0e10cSrcweir { 3212cdf0e10cSrcweir if( !GetValue() ) 3213cdf0e10cSrcweir rText = EE_RESSTR( RID_SVXITEMS_TWOLINES_OFF ); 3214cdf0e10cSrcweir else 3215cdf0e10cSrcweir { 3216cdf0e10cSrcweir rText = EE_RESSTR( RID_SVXITEMS_TWOLINES ); 3217cdf0e10cSrcweir if( GetStartBracket() ) 3218cdf0e10cSrcweir rText.Insert( GetStartBracket(), 0 ); 3219cdf0e10cSrcweir if( GetEndBracket() ) 3220cdf0e10cSrcweir rText += GetEndBracket(); 3221cdf0e10cSrcweir } 3222cdf0e10cSrcweir return ePres; 3223cdf0e10cSrcweir } 3224cdf0e10cSrcweir default: ; //prevent warning 3225cdf0e10cSrcweir } 3226cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_NONE; 3227cdf0e10cSrcweir } 3228cdf0e10cSrcweir 3229cdf0e10cSrcweir 3230cdf0e10cSrcweir SfxPoolItem* SvxTwoLinesItem::Create( SvStream & rStrm, sal_uInt16 /*nVer*/) const 3231cdf0e10cSrcweir { 3232cdf0e10cSrcweir sal_Bool _bOn; 3233cdf0e10cSrcweir sal_Unicode cStart, cEnd; 3234cdf0e10cSrcweir rStrm >> _bOn >> cStart >> cEnd; 3235cdf0e10cSrcweir return new SvxTwoLinesItem( _bOn, cStart, cEnd, Which() ); 3236cdf0e10cSrcweir } 3237cdf0e10cSrcweir 3238cdf0e10cSrcweir SvStream& SvxTwoLinesItem::Store(SvStream & rStrm, sal_uInt16 /*nIVer*/) const 3239cdf0e10cSrcweir { 3240cdf0e10cSrcweir rStrm << GetValue() << GetStartBracket() << GetEndBracket(); 3241cdf0e10cSrcweir return rStrm; 3242cdf0e10cSrcweir } 3243cdf0e10cSrcweir 3244cdf0e10cSrcweir sal_uInt16 SvxTwoLinesItem::GetVersion( sal_uInt16 nFFVer ) const 3245cdf0e10cSrcweir { 3246cdf0e10cSrcweir DBG_ASSERT( SOFFICE_FILEFORMAT_31==nFFVer || 3247cdf0e10cSrcweir SOFFICE_FILEFORMAT_40==nFFVer || 3248cdf0e10cSrcweir SOFFICE_FILEFORMAT_50==nFFVer, 3249cdf0e10cSrcweir "SvxTwoLinesItem: Gibt es ein neues Fileformat?" ); 3250cdf0e10cSrcweir 3251cdf0e10cSrcweir return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0; 3252cdf0e10cSrcweir } 3253cdf0e10cSrcweir 3254cdf0e10cSrcweir 3255cdf0e10cSrcweir /************************************************************************* 3256cdf0e10cSrcweir |* class SvxCharRotateItem 3257cdf0e10cSrcweir *************************************************************************/ 3258cdf0e10cSrcweir 3259cdf0e10cSrcweir SvxCharRotateItem::SvxCharRotateItem( sal_uInt16 nValue, 3260cdf0e10cSrcweir sal_Bool bFitIntoLine, 3261cdf0e10cSrcweir const sal_uInt16 nW ) 3262cdf0e10cSrcweir : SfxUInt16Item( nW, nValue ), bFitToLine( bFitIntoLine ) 3263cdf0e10cSrcweir { 3264cdf0e10cSrcweir } 3265cdf0e10cSrcweir 3266cdf0e10cSrcweir SfxPoolItem* SvxCharRotateItem::Clone( SfxItemPool* ) const 3267cdf0e10cSrcweir { 3268cdf0e10cSrcweir return new SvxCharRotateItem( GetValue(), IsFitToLine(), Which() ); 3269cdf0e10cSrcweir } 3270cdf0e10cSrcweir 3271cdf0e10cSrcweir SfxPoolItem* SvxCharRotateItem::Create( SvStream& rStrm, sal_uInt16 ) const 3272cdf0e10cSrcweir { 3273cdf0e10cSrcweir sal_uInt16 nVal; 3274cdf0e10cSrcweir sal_Bool b; 3275cdf0e10cSrcweir rStrm >> nVal >> b; 3276cdf0e10cSrcweir return new SvxCharRotateItem( nVal, b, Which() ); 3277cdf0e10cSrcweir } 3278cdf0e10cSrcweir 3279cdf0e10cSrcweir SvStream& SvxCharRotateItem::Store( SvStream & rStrm, sal_uInt16 ) const 3280cdf0e10cSrcweir { 3281cdf0e10cSrcweir sal_Bool bFlag = IsFitToLine(); 3282cdf0e10cSrcweir rStrm << GetValue() << bFlag; 3283cdf0e10cSrcweir return rStrm; 3284cdf0e10cSrcweir } 3285cdf0e10cSrcweir 3286cdf0e10cSrcweir sal_uInt16 SvxCharRotateItem::GetVersion( sal_uInt16 nFFVer ) const 3287cdf0e10cSrcweir { 3288cdf0e10cSrcweir return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0; 3289cdf0e10cSrcweir } 3290cdf0e10cSrcweir 3291cdf0e10cSrcweir SfxItemPresentation SvxCharRotateItem::GetPresentation( 3292cdf0e10cSrcweir SfxItemPresentation ePres, 3293cdf0e10cSrcweir SfxMapUnit /*eCoreMetric*/, SfxMapUnit /*ePresMetric*/, 3294cdf0e10cSrcweir String &rText, const IntlWrapper* ) const 3295cdf0e10cSrcweir { 3296cdf0e10cSrcweir switch( ePres ) 3297cdf0e10cSrcweir { 3298cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NONE: 3299cdf0e10cSrcweir rText.Erase(); 3300cdf0e10cSrcweir break; 3301cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NAMELESS: 3302cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_COMPLETE: 3303cdf0e10cSrcweir { 3304cdf0e10cSrcweir if( !GetValue() ) 3305cdf0e10cSrcweir rText = EE_RESSTR( RID_SVXITEMS_CHARROTATE_OFF ); 3306cdf0e10cSrcweir else 3307cdf0e10cSrcweir { 3308cdf0e10cSrcweir rText = EE_RESSTR( RID_SVXITEMS_CHARROTATE ); 3309cdf0e10cSrcweir rText.SearchAndReplaceAscii( "$(ARG1)", 3310cdf0e10cSrcweir String::CreateFromInt32( GetValue() / 10 )); 3311cdf0e10cSrcweir if( IsFitToLine() ) 3312cdf0e10cSrcweir rText += EE_RESSTR( RID_SVXITEMS_CHARROTATE_FITLINE ); 3313cdf0e10cSrcweir } 3314cdf0e10cSrcweir return ePres; 3315cdf0e10cSrcweir } 3316cdf0e10cSrcweir default: ; //prevent warning 3317cdf0e10cSrcweir } 3318cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_NONE; 3319cdf0e10cSrcweir } 3320cdf0e10cSrcweir 3321cdf0e10cSrcweir sal_Bool SvxCharRotateItem::QueryValue( com::sun::star::uno::Any& rVal, 3322cdf0e10cSrcweir sal_uInt8 nMemberId ) const 3323cdf0e10cSrcweir { 3324cdf0e10cSrcweir // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); 3325cdf0e10cSrcweir nMemberId &= ~CONVERT_TWIPS; 3326cdf0e10cSrcweir sal_Bool bRet = sal_True; 3327cdf0e10cSrcweir switch( nMemberId ) 3328cdf0e10cSrcweir { 3329cdf0e10cSrcweir case MID_ROTATE: 3330cdf0e10cSrcweir rVal <<= (sal_Int16)GetValue(); 3331cdf0e10cSrcweir break; 3332cdf0e10cSrcweir case MID_FITTOLINE: 3333cdf0e10cSrcweir rVal = Bool2Any( IsFitToLine() ); 3334cdf0e10cSrcweir break; 3335cdf0e10cSrcweir default: 3336cdf0e10cSrcweir bRet = sal_False; 3337cdf0e10cSrcweir break; 3338cdf0e10cSrcweir } 3339cdf0e10cSrcweir return bRet; 3340cdf0e10cSrcweir } 3341cdf0e10cSrcweir 3342cdf0e10cSrcweir sal_Bool SvxCharRotateItem::PutValue( const com::sun::star::uno::Any& rVal, 3343cdf0e10cSrcweir sal_uInt8 nMemberId ) 3344cdf0e10cSrcweir { 3345cdf0e10cSrcweir // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); 3346cdf0e10cSrcweir nMemberId &= ~CONVERT_TWIPS; 3347cdf0e10cSrcweir sal_Bool bRet = sal_True; 3348cdf0e10cSrcweir switch( nMemberId ) 3349cdf0e10cSrcweir { 3350cdf0e10cSrcweir case MID_ROTATE: 3351cdf0e10cSrcweir { 3352cdf0e10cSrcweir sal_Int16 nVal = 0; 3353cdf0e10cSrcweir if((rVal >>= nVal) && (0 == nVal || 900 == nVal || 2700 == nVal)) 3354cdf0e10cSrcweir SetValue( (sal_uInt16)nVal ); 3355cdf0e10cSrcweir else 3356cdf0e10cSrcweir bRet = sal_False; 3357cdf0e10cSrcweir break; 3358cdf0e10cSrcweir } 3359cdf0e10cSrcweir 3360cdf0e10cSrcweir case MID_FITTOLINE: 3361cdf0e10cSrcweir SetFitToLine( Any2Bool( rVal ) ); 3362cdf0e10cSrcweir break; 3363cdf0e10cSrcweir default: 3364cdf0e10cSrcweir bRet = sal_False; 3365cdf0e10cSrcweir } 3366cdf0e10cSrcweir return bRet; 3367cdf0e10cSrcweir } 3368cdf0e10cSrcweir 3369cdf0e10cSrcweir int SvxCharRotateItem::operator==( const SfxPoolItem& rItem ) const 3370cdf0e10cSrcweir { 3371cdf0e10cSrcweir DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" ); 3372cdf0e10cSrcweir return SfxUInt16Item::operator==( rItem ) && 3373cdf0e10cSrcweir IsFitToLine() == ((const SvxCharRotateItem&)rItem).IsFitToLine(); 3374cdf0e10cSrcweir } 3375cdf0e10cSrcweir 3376cdf0e10cSrcweir 3377cdf0e10cSrcweir /************************************************************************* 3378cdf0e10cSrcweir |* class SvxCharScaleItem 3379cdf0e10cSrcweir *************************************************************************/ 3380cdf0e10cSrcweir 3381cdf0e10cSrcweir SvxCharScaleWidthItem::SvxCharScaleWidthItem( sal_uInt16 nValue, 3382cdf0e10cSrcweir const sal_uInt16 nW ) 3383cdf0e10cSrcweir : SfxUInt16Item( nW, nValue ) 3384cdf0e10cSrcweir { 3385cdf0e10cSrcweir } 3386cdf0e10cSrcweir 3387cdf0e10cSrcweir SfxPoolItem* SvxCharScaleWidthItem::Clone( SfxItemPool* ) const 3388cdf0e10cSrcweir { 3389cdf0e10cSrcweir return new SvxCharScaleWidthItem( GetValue(), Which() ); 3390cdf0e10cSrcweir } 3391cdf0e10cSrcweir 3392cdf0e10cSrcweir SfxPoolItem* SvxCharScaleWidthItem::Create( SvStream& rStrm, sal_uInt16 ) const 3393cdf0e10cSrcweir { 3394cdf0e10cSrcweir sal_uInt16 nVal; 3395cdf0e10cSrcweir rStrm >> nVal; 3396cdf0e10cSrcweir SvxCharScaleWidthItem* pItem = new SvxCharScaleWidthItem( nVal, Which() ); 3397cdf0e10cSrcweir 3398cdf0e10cSrcweir if ( Which() == EE_CHAR_FONTWIDTH ) 3399cdf0e10cSrcweir { 3400cdf0e10cSrcweir // #87271#: Was a SvxFontWidthItem in 5.2 3401cdf0e10cSrcweir // sal_uInt16 nFixWidth, sal_uInt16 nPropWidth. 3402cdf0e10cSrcweir // nFixWidth has never been used... 3403cdf0e10cSrcweir rStrm >> nVal; 3404cdf0e10cSrcweir sal_uInt16 nTest; 3405cdf0e10cSrcweir rStrm >> nTest; 3406cdf0e10cSrcweir if ( nTest == 0x1234 ) 3407cdf0e10cSrcweir pItem->SetValue( nVal ); 3408cdf0e10cSrcweir else 3409cdf0e10cSrcweir rStrm.SeekRel( -2*(long)sizeof(sal_uInt16) ); 3410cdf0e10cSrcweir } 3411cdf0e10cSrcweir 3412cdf0e10cSrcweir return pItem; 3413cdf0e10cSrcweir } 3414cdf0e10cSrcweir 3415cdf0e10cSrcweir SvStream& SvxCharScaleWidthItem::Store( SvStream& rStream, sal_uInt16 nVer ) const 3416cdf0e10cSrcweir { 3417cdf0e10cSrcweir SvStream& rRet = SfxUInt16Item::Store( rStream, nVer ); 3418cdf0e10cSrcweir if ( Which() == EE_CHAR_FONTWIDTH ) 3419cdf0e10cSrcweir { 3420cdf0e10cSrcweir // see comment in Create().... 3421cdf0e10cSrcweir rRet.SeekRel( -1*(long)sizeof(sal_uInt16) ); 3422cdf0e10cSrcweir rRet << (sal_uInt16)0; 3423cdf0e10cSrcweir rRet << GetValue(); 3424cdf0e10cSrcweir // Really ugly, but not a problem for reading the doc in 5.2 3425cdf0e10cSrcweir rRet << (sal_uInt16)0x1234; 3426cdf0e10cSrcweir } 3427cdf0e10cSrcweir return rRet; 3428cdf0e10cSrcweir } 3429cdf0e10cSrcweir 3430cdf0e10cSrcweir 3431cdf0e10cSrcweir sal_uInt16 SvxCharScaleWidthItem::GetVersion( sal_uInt16 nFFVer ) const 3432cdf0e10cSrcweir { 3433cdf0e10cSrcweir return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0; 3434cdf0e10cSrcweir } 3435cdf0e10cSrcweir 3436cdf0e10cSrcweir SfxItemPresentation SvxCharScaleWidthItem::GetPresentation( 3437cdf0e10cSrcweir SfxItemPresentation ePres, 3438cdf0e10cSrcweir SfxMapUnit /*eCoreMetric*/, SfxMapUnit /*ePresMetric*/, 3439cdf0e10cSrcweir String &rText, const IntlWrapper* ) const 3440cdf0e10cSrcweir { 3441cdf0e10cSrcweir switch( ePres ) 3442cdf0e10cSrcweir { 3443cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NONE: 3444cdf0e10cSrcweir rText.Erase(); 3445cdf0e10cSrcweir break; 3446cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NAMELESS: 3447cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_COMPLETE: 3448cdf0e10cSrcweir { 3449cdf0e10cSrcweir if( !GetValue() ) 3450cdf0e10cSrcweir rText = EE_RESSTR( RID_SVXITEMS_CHARSCALE_OFF ); 3451cdf0e10cSrcweir else 3452cdf0e10cSrcweir { 3453cdf0e10cSrcweir rText = EE_RESSTR( RID_SVXITEMS_CHARSCALE ); 3454cdf0e10cSrcweir rText.SearchAndReplaceAscii( "$(ARG1)", 3455cdf0e10cSrcweir String::CreateFromInt32( GetValue() )); 3456cdf0e10cSrcweir } 3457cdf0e10cSrcweir return ePres; 3458cdf0e10cSrcweir } 3459cdf0e10cSrcweir default: ; //prevent warning 3460cdf0e10cSrcweir } 3461cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_NONE; 3462cdf0e10cSrcweir } 3463cdf0e10cSrcweir 3464cdf0e10cSrcweir sal_Bool SvxCharScaleWidthItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) 3465cdf0e10cSrcweir { 3466cdf0e10cSrcweir // SfxUInt16Item::QueryValue returns sal_Int32 in Any now... (srx642w) 3467cdf0e10cSrcweir // where we still want this to be a sal_Int16 3468cdf0e10cSrcweir sal_Int16 nValue = sal_Int16(); 3469cdf0e10cSrcweir if (rVal >>= nValue) 3470cdf0e10cSrcweir { 3471cdf0e10cSrcweir SetValue( (sal_uInt16) nValue ); 3472cdf0e10cSrcweir return sal_True; 3473cdf0e10cSrcweir } 3474cdf0e10cSrcweir 3475cdf0e10cSrcweir DBG_ERROR( "SvxCharScaleWidthItem::PutValue - Wrong type!" ); 3476cdf0e10cSrcweir return sal_False; 3477cdf0e10cSrcweir } 3478cdf0e10cSrcweir 3479cdf0e10cSrcweir sal_Bool SvxCharScaleWidthItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const 3480cdf0e10cSrcweir { 3481cdf0e10cSrcweir // SfxUInt16Item::QueryValue returns sal_Int32 in Any now... (srx642w) 3482cdf0e10cSrcweir // where we still want this to be a sal_Int16 3483cdf0e10cSrcweir rVal <<= (sal_Int16)GetValue(); 3484cdf0e10cSrcweir return sal_True; 3485cdf0e10cSrcweir } 3486cdf0e10cSrcweir 3487cdf0e10cSrcweir /************************************************************************* 3488cdf0e10cSrcweir |* class SvxCharReliefItem 3489cdf0e10cSrcweir *************************************************************************/ 3490cdf0e10cSrcweir 3491cdf0e10cSrcweir SvxCharReliefItem::SvxCharReliefItem( FontRelief eValue, 3492cdf0e10cSrcweir const sal_uInt16 nId ) 3493cdf0e10cSrcweir : SfxEnumItem( nId, (sal_uInt16)eValue ) 3494cdf0e10cSrcweir { 3495cdf0e10cSrcweir } 3496cdf0e10cSrcweir 3497cdf0e10cSrcweir SfxPoolItem* SvxCharReliefItem::Clone( SfxItemPool * ) const 3498cdf0e10cSrcweir { 3499cdf0e10cSrcweir return new SvxCharReliefItem( *this ); 3500cdf0e10cSrcweir } 3501cdf0e10cSrcweir 3502cdf0e10cSrcweir SfxPoolItem* SvxCharReliefItem::Create(SvStream & rStrm, sal_uInt16) const 3503cdf0e10cSrcweir { 3504cdf0e10cSrcweir sal_uInt16 nVal; 3505cdf0e10cSrcweir rStrm >> nVal; 3506cdf0e10cSrcweir return new SvxCharReliefItem( (FontRelief)nVal, Which() ); 3507cdf0e10cSrcweir } 3508cdf0e10cSrcweir 3509cdf0e10cSrcweir SvStream& SvxCharReliefItem::Store(SvStream & rStrm, sal_uInt16 /*nIVer*/) const 3510cdf0e10cSrcweir { 3511cdf0e10cSrcweir sal_uInt16 nVal = GetValue(); 3512cdf0e10cSrcweir rStrm << nVal; 3513cdf0e10cSrcweir return rStrm; 3514cdf0e10cSrcweir } 3515cdf0e10cSrcweir 3516cdf0e10cSrcweir sal_uInt16 SvxCharReliefItem::GetVersion( sal_uInt16 nFFVer ) const 3517cdf0e10cSrcweir { 3518cdf0e10cSrcweir return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0; 3519cdf0e10cSrcweir } 3520cdf0e10cSrcweir 3521cdf0e10cSrcweir String SvxCharReliefItem::GetValueTextByPos( sal_uInt16 nPos ) const 3522cdf0e10cSrcweir { 3523cdf0e10cSrcweir DBG_ASSERT( RID_SVXITEMS_RELIEF_ENGRAVED - RID_SVXITEMS_RELIEF_NONE, 3524cdf0e10cSrcweir "enum overflow" ); 3525cdf0e10cSrcweir return String( EditResId( RID_SVXITEMS_RELIEF_BEGIN + nPos )); 3526cdf0e10cSrcweir } 3527cdf0e10cSrcweir 3528cdf0e10cSrcweir sal_uInt16 SvxCharReliefItem::GetValueCount() const 3529cdf0e10cSrcweir { 3530cdf0e10cSrcweir return RID_SVXITEMS_RELIEF_ENGRAVED - RID_SVXITEMS_RELIEF_NONE; 3531cdf0e10cSrcweir } 3532cdf0e10cSrcweir 3533cdf0e10cSrcweir SfxItemPresentation SvxCharReliefItem::GetPresentation 3534cdf0e10cSrcweir ( 3535cdf0e10cSrcweir SfxItemPresentation ePres, 3536cdf0e10cSrcweir SfxMapUnit /*eCoreUnit*/, 3537cdf0e10cSrcweir SfxMapUnit /*ePresUnit*/, 3538cdf0e10cSrcweir XubString& rText, const IntlWrapper * /*pIntl*/ 3539cdf0e10cSrcweir ) const 3540cdf0e10cSrcweir { 3541cdf0e10cSrcweir SfxItemPresentation eRet = ePres; 3542cdf0e10cSrcweir switch( ePres ) 3543cdf0e10cSrcweir { 3544cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NONE: 3545cdf0e10cSrcweir rText.Erase(); 3546cdf0e10cSrcweir break; 3547cdf0e10cSrcweir 3548cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NAMELESS: 3549cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_COMPLETE: 3550cdf0e10cSrcweir rText = GetValueTextByPos( GetValue() ); 3551cdf0e10cSrcweir break; 3552cdf0e10cSrcweir 3553cdf0e10cSrcweir default: 3554cdf0e10cSrcweir eRet = SFX_ITEM_PRESENTATION_NONE; 3555cdf0e10cSrcweir } 3556cdf0e10cSrcweir return eRet; 3557cdf0e10cSrcweir } 3558cdf0e10cSrcweir 3559cdf0e10cSrcweir sal_Bool SvxCharReliefItem::PutValue( const com::sun::star::uno::Any& rVal, 3560cdf0e10cSrcweir sal_uInt8 nMemberId ) 3561cdf0e10cSrcweir { 3562cdf0e10cSrcweir // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); 3563cdf0e10cSrcweir nMemberId &= ~CONVERT_TWIPS; 3564cdf0e10cSrcweir sal_Bool bRet = sal_True; 3565cdf0e10cSrcweir switch( nMemberId ) 3566cdf0e10cSrcweir { 3567cdf0e10cSrcweir case MID_RELIEF: 3568cdf0e10cSrcweir { 3569cdf0e10cSrcweir sal_Int16 nVal = -1; 3570cdf0e10cSrcweir rVal >>= nVal; 3571cdf0e10cSrcweir if(nVal >= 0 && nVal <= RELIEF_ENGRAVED) 3572cdf0e10cSrcweir SetValue( (sal_uInt16)nVal ); 3573cdf0e10cSrcweir else 3574cdf0e10cSrcweir bRet = sal_False; 3575cdf0e10cSrcweir } 3576cdf0e10cSrcweir break; 3577cdf0e10cSrcweir default: 3578cdf0e10cSrcweir bRet = sal_False; 3579cdf0e10cSrcweir break; 3580cdf0e10cSrcweir } 3581cdf0e10cSrcweir return bRet; 3582cdf0e10cSrcweir } 3583cdf0e10cSrcweir 3584cdf0e10cSrcweir sal_Bool SvxCharReliefItem::QueryValue( com::sun::star::uno::Any& rVal, 3585cdf0e10cSrcweir sal_uInt8 nMemberId ) const 3586cdf0e10cSrcweir { 3587cdf0e10cSrcweir // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); 3588cdf0e10cSrcweir nMemberId &= ~CONVERT_TWIPS; 3589cdf0e10cSrcweir sal_Bool bRet = sal_True; 3590cdf0e10cSrcweir switch( nMemberId ) 3591cdf0e10cSrcweir { 3592cdf0e10cSrcweir case MID_RELIEF: 3593cdf0e10cSrcweir rVal <<= (sal_Int16)GetValue(); 3594cdf0e10cSrcweir break; 3595cdf0e10cSrcweir default: 3596cdf0e10cSrcweir bRet = sal_False; 3597cdf0e10cSrcweir break; 3598cdf0e10cSrcweir } 3599cdf0e10cSrcweir return bRet; 3600cdf0e10cSrcweir } 3601cdf0e10cSrcweir 3602cdf0e10cSrcweir /************************************************************************* 3603cdf0e10cSrcweir |* class SvxScriptTypeItemItem 3604cdf0e10cSrcweir *************************************************************************/ 3605cdf0e10cSrcweir 3606cdf0e10cSrcweir SvxScriptTypeItem::SvxScriptTypeItem( sal_uInt16 nType ) 3607cdf0e10cSrcweir : SfxUInt16Item( SID_ATTR_CHAR_SCRIPTTYPE, nType ) 3608cdf0e10cSrcweir { 3609cdf0e10cSrcweir } 3610cdf0e10cSrcweir SfxPoolItem* SvxScriptTypeItem::Clone( SfxItemPool * ) const 3611cdf0e10cSrcweir { 3612cdf0e10cSrcweir return new SvxScriptTypeItem( GetValue() ); 3613cdf0e10cSrcweir } 3614cdf0e10cSrcweir 3615cdf0e10cSrcweir /************************************************************************* 3616cdf0e10cSrcweir |* class SvxScriptSetItem 3617cdf0e10cSrcweir *************************************************************************/ 3618cdf0e10cSrcweir 3619cdf0e10cSrcweir SvxScriptSetItem::SvxScriptSetItem( sal_uInt16 nSlotId, SfxItemPool& rPool ) 3620cdf0e10cSrcweir : SfxSetItem( nSlotId, new SfxItemSet( rPool, 3621cdf0e10cSrcweir SID_ATTR_CHAR_FONT, SID_ATTR_CHAR_FONT )) 3622cdf0e10cSrcweir { 3623cdf0e10cSrcweir sal_uInt16 nLatin, nAsian, nComplex; 3624cdf0e10cSrcweir GetWhichIds( nLatin, nAsian, nComplex ); 3625cdf0e10cSrcweir 3626cdf0e10cSrcweir sal_uInt16 aIds[ 9 ] = { 0 }; 3627cdf0e10cSrcweir aIds[ 0 ] = aIds[ 1 ] = nLatin; 3628cdf0e10cSrcweir aIds[ 2 ] = aIds[ 3 ] = nAsian; 3629cdf0e10cSrcweir aIds[ 4 ] = aIds[ 5 ] = nComplex; 3630cdf0e10cSrcweir aIds[ 6 ] = aIds[ 7 ] = SID_ATTR_CHAR_SCRIPTTYPE; 3631cdf0e10cSrcweir aIds[ 8 ] = 0; 3632cdf0e10cSrcweir 3633cdf0e10cSrcweir GetItemSet().SetRanges( aIds ); 3634cdf0e10cSrcweir } 3635cdf0e10cSrcweir 3636cdf0e10cSrcweir SfxPoolItem* SvxScriptSetItem::Clone( SfxItemPool * ) const 3637cdf0e10cSrcweir { 3638cdf0e10cSrcweir SvxScriptSetItem* p = new SvxScriptSetItem( Which(), *GetItemSet().GetPool() ); 3639cdf0e10cSrcweir p->GetItemSet().Put( GetItemSet(), sal_False ); 3640cdf0e10cSrcweir return p; 3641cdf0e10cSrcweir } 3642cdf0e10cSrcweir 3643cdf0e10cSrcweir SfxPoolItem* SvxScriptSetItem::Create( SvStream &, sal_uInt16 ) const 3644cdf0e10cSrcweir { 3645cdf0e10cSrcweir return 0; 3646cdf0e10cSrcweir } 3647cdf0e10cSrcweir 3648cdf0e10cSrcweir const SfxPoolItem* SvxScriptSetItem::GetItemOfScriptSet( 3649cdf0e10cSrcweir const SfxItemSet& rSet, sal_uInt16 nId ) 3650cdf0e10cSrcweir { 3651cdf0e10cSrcweir const SfxPoolItem* pI; 3652cdf0e10cSrcweir SfxItemState eSt = rSet.GetItemState( nId, sal_False, &pI ); 3653cdf0e10cSrcweir if( SFX_ITEM_SET != eSt ) 3654cdf0e10cSrcweir pI = SFX_ITEM_DEFAULT == eSt ? &rSet.Get( nId ) : 0; 3655cdf0e10cSrcweir return pI; 3656cdf0e10cSrcweir } 3657cdf0e10cSrcweir 3658cdf0e10cSrcweir const SfxPoolItem* SvxScriptSetItem::GetItemOfScript( sal_uInt16 nSlotId, const SfxItemSet& rSet, sal_uInt16 nScript ) 3659cdf0e10cSrcweir { 3660cdf0e10cSrcweir sal_uInt16 nLatin, nAsian, nComplex; 3661cdf0e10cSrcweir GetWhichIds( nSlotId, rSet, nLatin, nAsian, nComplex ); 3662cdf0e10cSrcweir 3663cdf0e10cSrcweir const SfxPoolItem *pRet, *pAsn, *pCmplx; 3664cdf0e10cSrcweir switch( nScript ) 3665cdf0e10cSrcweir { 3666cdf0e10cSrcweir default: //no one valid -> match to latin 3667cdf0e10cSrcweir // case SCRIPTTYPE_LATIN: 3668cdf0e10cSrcweir pRet = GetItemOfScriptSet( rSet, nLatin ); 3669cdf0e10cSrcweir break; 3670cdf0e10cSrcweir case SCRIPTTYPE_ASIAN: 3671cdf0e10cSrcweir pRet = GetItemOfScriptSet( rSet, nAsian ); 3672cdf0e10cSrcweir break; 3673cdf0e10cSrcweir case SCRIPTTYPE_COMPLEX: 3674cdf0e10cSrcweir pRet = GetItemOfScriptSet( rSet, nComplex ); 3675cdf0e10cSrcweir break; 3676cdf0e10cSrcweir 3677cdf0e10cSrcweir case SCRIPTTYPE_LATIN|SCRIPTTYPE_ASIAN: 3678cdf0e10cSrcweir if( 0 == (pRet = GetItemOfScriptSet( rSet, nLatin )) || 3679cdf0e10cSrcweir 0 == (pAsn = GetItemOfScriptSet( rSet, nAsian )) || 3680cdf0e10cSrcweir *pRet != *pAsn ) 3681cdf0e10cSrcweir pRet = 0; 3682cdf0e10cSrcweir break; 3683cdf0e10cSrcweir 3684cdf0e10cSrcweir case SCRIPTTYPE_LATIN|SCRIPTTYPE_COMPLEX: 3685cdf0e10cSrcweir if( 0 == (pRet = GetItemOfScriptSet( rSet, nLatin )) || 3686cdf0e10cSrcweir 0 == (pCmplx = GetItemOfScriptSet( rSet, nComplex )) || 3687cdf0e10cSrcweir *pRet != *pCmplx ) 3688cdf0e10cSrcweir pRet = 0; 3689cdf0e10cSrcweir break; 3690cdf0e10cSrcweir 3691cdf0e10cSrcweir case SCRIPTTYPE_ASIAN|SCRIPTTYPE_COMPLEX: 3692cdf0e10cSrcweir if( 0 == (pRet = GetItemOfScriptSet( rSet, nAsian )) || 3693cdf0e10cSrcweir 0 == (pCmplx = GetItemOfScriptSet( rSet, nComplex )) || 3694cdf0e10cSrcweir *pRet != *pCmplx ) 3695cdf0e10cSrcweir pRet = 0; 3696cdf0e10cSrcweir break; 3697cdf0e10cSrcweir 3698cdf0e10cSrcweir case SCRIPTTYPE_LATIN|SCRIPTTYPE_ASIAN|SCRIPTTYPE_COMPLEX: 3699cdf0e10cSrcweir if( 0 == (pRet = GetItemOfScriptSet( rSet, nLatin )) || 3700cdf0e10cSrcweir 0 == (pAsn = GetItemOfScriptSet( rSet, nAsian )) || 3701cdf0e10cSrcweir 0 == (pCmplx = GetItemOfScriptSet( rSet, nComplex )) || 3702cdf0e10cSrcweir *pRet != *pAsn || *pRet != *pCmplx ) 3703cdf0e10cSrcweir pRet = 0; 3704cdf0e10cSrcweir break; 3705cdf0e10cSrcweir } 3706cdf0e10cSrcweir return pRet; 3707cdf0e10cSrcweir } 3708cdf0e10cSrcweir 3709cdf0e10cSrcweir const SfxPoolItem* SvxScriptSetItem::GetItemOfScript( sal_uInt16 nScript ) const 3710cdf0e10cSrcweir { 3711cdf0e10cSrcweir return GetItemOfScript( Which(), GetItemSet(), nScript ); 3712cdf0e10cSrcweir } 3713cdf0e10cSrcweir 3714cdf0e10cSrcweir void SvxScriptSetItem::PutItemForScriptType( sal_uInt16 nScriptType, 3715cdf0e10cSrcweir const SfxPoolItem& rItem ) 3716cdf0e10cSrcweir { 3717cdf0e10cSrcweir sal_uInt16 nLatin, nAsian, nComplex; 3718cdf0e10cSrcweir GetWhichIds( nLatin, nAsian, nComplex ); 3719cdf0e10cSrcweir 3720cdf0e10cSrcweir SfxPoolItem* pCpy = rItem.Clone(); 3721cdf0e10cSrcweir if( SCRIPTTYPE_LATIN & nScriptType ) 3722cdf0e10cSrcweir { 3723cdf0e10cSrcweir pCpy->SetWhich( nLatin ); 3724cdf0e10cSrcweir GetItemSet().Put( *pCpy ); 3725cdf0e10cSrcweir } 3726cdf0e10cSrcweir if( SCRIPTTYPE_ASIAN & nScriptType ) 3727cdf0e10cSrcweir { 3728cdf0e10cSrcweir pCpy->SetWhich( nAsian ); 3729cdf0e10cSrcweir GetItemSet().Put( *pCpy ); 3730cdf0e10cSrcweir } 3731cdf0e10cSrcweir if( SCRIPTTYPE_COMPLEX & nScriptType ) 3732cdf0e10cSrcweir { 3733cdf0e10cSrcweir pCpy->SetWhich( nComplex ); 3734cdf0e10cSrcweir GetItemSet().Put( *pCpy ); 3735cdf0e10cSrcweir } 3736cdf0e10cSrcweir delete pCpy; 3737cdf0e10cSrcweir } 3738cdf0e10cSrcweir 3739cdf0e10cSrcweir void SvxScriptSetItem::GetWhichIds( sal_uInt16 nSlotId, const SfxItemSet& rSet, sal_uInt16& rLatin, sal_uInt16& rAsian, sal_uInt16& rComplex ) 3740cdf0e10cSrcweir { 3741cdf0e10cSrcweir const SfxItemPool& rPool = *rSet.GetPool(); 3742cdf0e10cSrcweir GetSlotIds( nSlotId, rLatin, rAsian, rComplex ); 3743cdf0e10cSrcweir rLatin = rPool.GetWhich( rLatin ); 3744cdf0e10cSrcweir rAsian = rPool.GetWhich( rAsian ); 3745cdf0e10cSrcweir rComplex = rPool.GetWhich( rComplex ); 3746cdf0e10cSrcweir } 3747cdf0e10cSrcweir 3748cdf0e10cSrcweir void SvxScriptSetItem::GetWhichIds( sal_uInt16& rLatin, sal_uInt16& rAsian, 3749cdf0e10cSrcweir sal_uInt16& rComplex ) const 3750cdf0e10cSrcweir { 3751cdf0e10cSrcweir GetWhichIds( Which(), GetItemSet(), rLatin, rAsian, rComplex ); 3752cdf0e10cSrcweir } 3753cdf0e10cSrcweir 3754cdf0e10cSrcweir void SvxScriptSetItem::GetSlotIds( sal_uInt16 nSlotId, sal_uInt16& rLatin, 3755cdf0e10cSrcweir sal_uInt16& rAsian, sal_uInt16& rComplex ) 3756cdf0e10cSrcweir { 3757cdf0e10cSrcweir switch( nSlotId ) 3758cdf0e10cSrcweir { 3759cdf0e10cSrcweir default: 3760cdf0e10cSrcweir DBG_ASSERT( sal_False, "wrong SlotId for class SvxScriptSetItem" ); 3761cdf0e10cSrcweir // no break - default to font - Id Range !! 3762cdf0e10cSrcweir 3763cdf0e10cSrcweir case SID_ATTR_CHAR_FONT: 3764cdf0e10cSrcweir rLatin = SID_ATTR_CHAR_FONT; 3765cdf0e10cSrcweir rAsian = SID_ATTR_CHAR_CJK_FONT; 3766cdf0e10cSrcweir rComplex = SID_ATTR_CHAR_CTL_FONT; 3767cdf0e10cSrcweir break; 3768cdf0e10cSrcweir case SID_ATTR_CHAR_FONTHEIGHT: 3769cdf0e10cSrcweir rLatin = SID_ATTR_CHAR_FONTHEIGHT; 3770cdf0e10cSrcweir rAsian = SID_ATTR_CHAR_CJK_FONTHEIGHT; 3771cdf0e10cSrcweir rComplex = SID_ATTR_CHAR_CTL_FONTHEIGHT; 3772cdf0e10cSrcweir break; 3773cdf0e10cSrcweir case SID_ATTR_CHAR_WEIGHT: 3774cdf0e10cSrcweir rLatin = SID_ATTR_CHAR_WEIGHT; 3775cdf0e10cSrcweir rAsian = SID_ATTR_CHAR_CJK_WEIGHT; 3776cdf0e10cSrcweir rComplex = SID_ATTR_CHAR_CTL_WEIGHT; 3777cdf0e10cSrcweir break; 3778cdf0e10cSrcweir case SID_ATTR_CHAR_POSTURE: 3779cdf0e10cSrcweir rLatin = SID_ATTR_CHAR_POSTURE; 3780cdf0e10cSrcweir rAsian = SID_ATTR_CHAR_CJK_POSTURE; 3781cdf0e10cSrcweir rComplex = SID_ATTR_CHAR_CTL_POSTURE; 3782cdf0e10cSrcweir break; 3783cdf0e10cSrcweir case SID_ATTR_CHAR_LANGUAGE: 3784cdf0e10cSrcweir rLatin = SID_ATTR_CHAR_LANGUAGE; 3785cdf0e10cSrcweir rAsian = SID_ATTR_CHAR_CJK_LANGUAGE; 3786cdf0e10cSrcweir rComplex = SID_ATTR_CHAR_CTL_LANGUAGE; 3787cdf0e10cSrcweir break; 3788*eb72824aSAndre Fischer case SID_ATTR_CHAR_SHADOWED: 3789*eb72824aSAndre Fischer rLatin = SID_ATTR_CHAR_SHADOWED; 3790*eb72824aSAndre Fischer rAsian = SID_ATTR_CHAR_SHADOWED; 3791*eb72824aSAndre Fischer rComplex = SID_ATTR_CHAR_SHADOWED; 3792*eb72824aSAndre Fischer break; 3793*eb72824aSAndre Fischer case SID_ATTR_CHAR_STRIKEOUT: 3794*eb72824aSAndre Fischer rLatin = SID_ATTR_CHAR_STRIKEOUT; 3795*eb72824aSAndre Fischer rAsian = SID_ATTR_CHAR_STRIKEOUT; 3796*eb72824aSAndre Fischer rComplex = SID_ATTR_CHAR_STRIKEOUT; 3797*eb72824aSAndre Fischer break; 3798cdf0e10cSrcweir } 3799cdf0e10cSrcweir } 3800cdf0e10cSrcweir 3801cdf0e10cSrcweir void GetDefaultFonts( SvxFontItem& rLatin, SvxFontItem& rAsian, SvxFontItem& rComplex ) 3802cdf0e10cSrcweir { 3803cdf0e10cSrcweir const sal_uInt16 nItemCnt = 3; 3804cdf0e10cSrcweir 3805cdf0e10cSrcweir static struct 3806cdf0e10cSrcweir { 3807cdf0e10cSrcweir sal_uInt16 nFontType; 3808cdf0e10cSrcweir sal_uInt16 nLanguage; 3809cdf0e10cSrcweir } 3810cdf0e10cSrcweir aOutTypeArr[ nItemCnt ] = 3811cdf0e10cSrcweir { 3812cdf0e10cSrcweir { DEFAULTFONT_LATIN_TEXT, LANGUAGE_ENGLISH_US }, 3813cdf0e10cSrcweir { DEFAULTFONT_CJK_TEXT, LANGUAGE_ENGLISH_US }, 3814cdf0e10cSrcweir { DEFAULTFONT_CTL_TEXT, LANGUAGE_ARABIC_SAUDI_ARABIA } 3815cdf0e10cSrcweir }; 3816cdf0e10cSrcweir 3817cdf0e10cSrcweir SvxFontItem* aItemArr[ nItemCnt ] = { &rLatin, &rAsian, &rComplex }; 3818cdf0e10cSrcweir 3819cdf0e10cSrcweir for ( sal_uInt16 n = 0; n < nItemCnt; ++n ) 3820cdf0e10cSrcweir { 3821cdf0e10cSrcweir Font aFont( OutputDevice::GetDefaultFont( aOutTypeArr[ n ].nFontType, 3822cdf0e10cSrcweir aOutTypeArr[ n ].nLanguage, 3823cdf0e10cSrcweir DEFAULTFONT_FLAGS_ONLYONE, 0 ) ); 3824cdf0e10cSrcweir SvxFontItem* pItem = aItemArr[ n ]; 3825cdf0e10cSrcweir pItem->SetFamily( aFont.GetFamily() ); 3826cdf0e10cSrcweir pItem->SetFamilyName( aFont.GetName() ); 3827cdf0e10cSrcweir pItem->SetStyleName( String() ); 3828cdf0e10cSrcweir pItem->SetPitch( aFont.GetPitch()); 3829cdf0e10cSrcweir pItem->SetCharSet(aFont.GetCharSet()); 3830cdf0e10cSrcweir } 3831cdf0e10cSrcweir } 3832cdf0e10cSrcweir 3833cdf0e10cSrcweir 3834cdf0e10cSrcweir sal_uInt16 GetI18NScriptTypeOfLanguage( sal_uInt16 nLang ) 3835cdf0e10cSrcweir { 3836cdf0e10cSrcweir return GetI18NScriptType( SvtLanguageOptions::GetScriptTypeOfLanguage( nLang ) ); 3837cdf0e10cSrcweir } 3838cdf0e10cSrcweir 3839cdf0e10cSrcweir sal_uInt16 GetItemScriptType( short nI18NType ) 3840cdf0e10cSrcweir { 3841cdf0e10cSrcweir switch ( nI18NType ) 3842cdf0e10cSrcweir { 3843cdf0e10cSrcweir case i18n::ScriptType::LATIN: return SCRIPTTYPE_LATIN; 3844cdf0e10cSrcweir case i18n::ScriptType::ASIAN: return SCRIPTTYPE_ASIAN; 3845cdf0e10cSrcweir case i18n::ScriptType::COMPLEX: return SCRIPTTYPE_COMPLEX; 3846cdf0e10cSrcweir } 3847cdf0e10cSrcweir return 0; 3848cdf0e10cSrcweir } 3849cdf0e10cSrcweir 3850cdf0e10cSrcweir short GetI18NScriptType( sal_uInt16 nItemType ) 3851cdf0e10cSrcweir { 3852cdf0e10cSrcweir switch ( nItemType ) 3853cdf0e10cSrcweir { 3854cdf0e10cSrcweir case SCRIPTTYPE_LATIN: return i18n::ScriptType::LATIN; 3855cdf0e10cSrcweir case SCRIPTTYPE_ASIAN: return i18n::ScriptType::ASIAN; 3856cdf0e10cSrcweir case SCRIPTTYPE_COMPLEX: return i18n::ScriptType::COMPLEX; 3857cdf0e10cSrcweir } 3858cdf0e10cSrcweir return 0; 3859cdf0e10cSrcweir } 3860