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 { 1108*ae2dc0faSTsutomu Uchino rText = String::CreateFromInt32( (short)nProp ); 1109*ae2dc0faSTsutomu Uchino rText += sal_Unicode(' '); 1110*ae2dc0faSTsutomu Uchino rText += EE_RESSTR( GetMetricId( ePropUnit ) ); 1111cdf0e10cSrcweir if( 0 <= (short)nProp ) 1112cdf0e10cSrcweir rText.Insert( sal_Unicode('+'), 0 ); 1113cdf0e10cSrcweir } 1114cdf0e10cSrcweir else if( 100 == nProp ) 1115cdf0e10cSrcweir { 1116cdf0e10cSrcweir rText = GetMetricText( (long)nHeight, 1117cdf0e10cSrcweir eCoreUnit, SFX_MAPUNIT_POINT, pIntl ); 1118*ae2dc0faSTsutomu Uchino rText += sal_Unicode(' '); 1119cdf0e10cSrcweir rText += EE_RESSTR(GetMetricId(SFX_MAPUNIT_POINT)); 1120cdf0e10cSrcweir } 1121cdf0e10cSrcweir else 1122cdf0e10cSrcweir ( rText = String::CreateFromInt32( nProp )) += sal_Unicode('%'); 1123cdf0e10cSrcweir return ePres; 1124cdf0e10cSrcweir } 1125cdf0e10cSrcweir default: ; //prevent warning 1126cdf0e10cSrcweir } 1127cdf0e10cSrcweir #endif 1128cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_NONE; 1129cdf0e10cSrcweir } 1130cdf0e10cSrcweir 1131cdf0e10cSrcweir // ----------------------------------------------------------------------- 1132cdf0e10cSrcweir 1133cdf0e10cSrcweir sal_uInt16 SvxFontHeightItem::GetVersion(sal_uInt16 nFileVersion) const 1134cdf0e10cSrcweir { 1135cdf0e10cSrcweir return (nFileVersion <= SOFFICE_FILEFORMAT_40) 1136cdf0e10cSrcweir ? FONTHEIGHT_16_VERSION 1137cdf0e10cSrcweir : FONTHEIGHT_UNIT_VERSION; 1138cdf0e10cSrcweir } 1139cdf0e10cSrcweir 1140cdf0e10cSrcweir // ----------------------------------------------------------------------- 1141cdf0e10cSrcweir 1142cdf0e10cSrcweir int SvxFontHeightItem::ScaleMetrics( long nMult, long nDiv ) 1143cdf0e10cSrcweir { 1144cdf0e10cSrcweir nHeight = (sal_uInt32)Scale( nHeight, nMult, nDiv ); 1145cdf0e10cSrcweir return 1; 1146cdf0e10cSrcweir } 1147cdf0e10cSrcweir 1148cdf0e10cSrcweir // ----------------------------------------------------------------------- 1149cdf0e10cSrcweir 1150cdf0e10cSrcweir int SvxFontHeightItem::HasMetrics() const 1151cdf0e10cSrcweir { 1152cdf0e10cSrcweir return 1; 1153cdf0e10cSrcweir } 1154cdf0e10cSrcweir 1155cdf0e10cSrcweir void SvxFontHeightItem::SetHeight( sal_uInt32 nNewHeight, const sal_uInt16 nNewProp, 1156cdf0e10cSrcweir SfxMapUnit eUnit ) 1157cdf0e10cSrcweir { 1158cdf0e10cSrcweir DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" ); 1159cdf0e10cSrcweir 1160cdf0e10cSrcweir #ifndef SVX_LIGHT 1161cdf0e10cSrcweir if( SFX_MAPUNIT_RELATIVE != eUnit ) 1162cdf0e10cSrcweir nHeight = nNewHeight + ::ItemToControl( (short)nNewProp, eUnit, 1163cdf0e10cSrcweir SFX_FUNIT_TWIP ); 1164cdf0e10cSrcweir else 1165cdf0e10cSrcweir #endif // !SVX_LIGHT 1166cdf0e10cSrcweir if( 100 != nNewProp ) 1167cdf0e10cSrcweir nHeight = sal_uInt32(( nNewHeight * nNewProp ) / 100 ); 1168cdf0e10cSrcweir else 1169cdf0e10cSrcweir nHeight = nNewHeight; 1170cdf0e10cSrcweir 1171cdf0e10cSrcweir nProp = nNewProp; 1172cdf0e10cSrcweir ePropUnit = eUnit; 1173cdf0e10cSrcweir } 1174cdf0e10cSrcweir 1175cdf0e10cSrcweir void SvxFontHeightItem::SetHeight( sal_uInt32 nNewHeight, sal_uInt16 nNewProp, 1176cdf0e10cSrcweir SfxMapUnit eMetric, SfxMapUnit eCoreMetric ) 1177cdf0e10cSrcweir { 1178cdf0e10cSrcweir DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" ); 1179cdf0e10cSrcweir 1180cdf0e10cSrcweir #ifndef SVX_LIGHT 1181cdf0e10cSrcweir if( SFX_MAPUNIT_RELATIVE != eMetric ) 1182cdf0e10cSrcweir nHeight = nNewHeight + 1183cdf0e10cSrcweir ::ControlToItem( ::ItemToControl((short)nNewProp, eMetric, 1184cdf0e10cSrcweir SFX_FUNIT_TWIP ), SFX_FUNIT_TWIP, 1185cdf0e10cSrcweir eCoreMetric ); 1186cdf0e10cSrcweir else 1187cdf0e10cSrcweir #endif // !SVX_LIGHT 1188cdf0e10cSrcweir if( 100 != nNewProp ) 1189cdf0e10cSrcweir nHeight = sal_uInt32(( nNewHeight * nNewProp ) / 100 ); 1190cdf0e10cSrcweir else 1191cdf0e10cSrcweir nHeight = nNewHeight; 1192cdf0e10cSrcweir 1193cdf0e10cSrcweir nProp = nNewProp; 1194cdf0e10cSrcweir ePropUnit = eMetric; 1195cdf0e10cSrcweir } 1196cdf0e10cSrcweir 1197cdf0e10cSrcweir // class SvxFontWidthItem ----------------------------------------------- 1198cdf0e10cSrcweir 1199cdf0e10cSrcweir SvxFontWidthItem::SvxFontWidthItem( const sal_uInt16 nSz, const sal_uInt16 nPrp, const sal_uInt16 nId ) : 1200cdf0e10cSrcweir SfxPoolItem( nId ) 1201cdf0e10cSrcweir { 1202cdf0e10cSrcweir nWidth = nSz; 1203cdf0e10cSrcweir nProp = nPrp; 1204cdf0e10cSrcweir } 1205cdf0e10cSrcweir 1206cdf0e10cSrcweir // ----------------------------------------------------------------------- 1207cdf0e10cSrcweir 1208cdf0e10cSrcweir SfxPoolItem* SvxFontWidthItem::Clone( SfxItemPool * ) const 1209cdf0e10cSrcweir { 1210cdf0e10cSrcweir return new SvxFontWidthItem( *this ); 1211cdf0e10cSrcweir } 1212cdf0e10cSrcweir 1213cdf0e10cSrcweir // ----------------------------------------------------------------------- 1214cdf0e10cSrcweir 1215cdf0e10cSrcweir SvStream& SvxFontWidthItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const 1216cdf0e10cSrcweir { 1217cdf0e10cSrcweir rStrm << GetWidth() << GetProp(); 1218cdf0e10cSrcweir return rStrm; 1219cdf0e10cSrcweir } 1220cdf0e10cSrcweir 1221cdf0e10cSrcweir // ----------------------------------------------------------------------- 1222cdf0e10cSrcweir 1223cdf0e10cSrcweir int SvxFontWidthItem::ScaleMetrics( long nMult, long nDiv ) 1224cdf0e10cSrcweir { 1225cdf0e10cSrcweir nWidth = (sal_uInt16)Scale( nWidth, nMult, nDiv ); 1226cdf0e10cSrcweir return 1; 1227cdf0e10cSrcweir } 1228cdf0e10cSrcweir 1229cdf0e10cSrcweir // ----------------------------------------------------------------------- 1230cdf0e10cSrcweir 1231cdf0e10cSrcweir int SvxFontWidthItem::HasMetrics() const 1232cdf0e10cSrcweir { 1233cdf0e10cSrcweir return 1; 1234cdf0e10cSrcweir } 1235cdf0e10cSrcweir 1236cdf0e10cSrcweir // ----------------------------------------------------------------------- 1237cdf0e10cSrcweir 1238cdf0e10cSrcweir SfxPoolItem* SvxFontWidthItem::Create( SvStream& rStrm, 1239cdf0e10cSrcweir sal_uInt16 /*nVersion*/ ) const 1240cdf0e10cSrcweir { 1241cdf0e10cSrcweir sal_uInt16 nS; 1242cdf0e10cSrcweir sal_uInt16 nP; 1243cdf0e10cSrcweir 1244cdf0e10cSrcweir rStrm >> nS; 1245cdf0e10cSrcweir rStrm >> nP; 1246cdf0e10cSrcweir SvxFontWidthItem* pItem = new SvxFontWidthItem( 0, nP, Which() ); 1247cdf0e10cSrcweir pItem->SetWidthValue( nS ); 1248cdf0e10cSrcweir return pItem; 1249cdf0e10cSrcweir } 1250cdf0e10cSrcweir 1251cdf0e10cSrcweir // ----------------------------------------------------------------------- 1252cdf0e10cSrcweir 1253cdf0e10cSrcweir int SvxFontWidthItem::operator==( const SfxPoolItem& rItem ) const 1254cdf0e10cSrcweir { 1255cdf0e10cSrcweir DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" ); 1256cdf0e10cSrcweir return GetWidth() == ((SvxFontWidthItem&)rItem).GetWidth() && 1257cdf0e10cSrcweir GetProp() == ((SvxFontWidthItem&)rItem).GetProp(); 1258cdf0e10cSrcweir } 1259cdf0e10cSrcweir 1260cdf0e10cSrcweir /*-----------------13.03.98 16:03------------------- 1261cdf0e10cSrcweir 1262cdf0e10cSrcweir --------------------------------------------------*/ 1263cdf0e10cSrcweir sal_Bool SvxFontWidthItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const 1264cdf0e10cSrcweir { 1265cdf0e10cSrcweir // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); 1266cdf0e10cSrcweir nMemberId &= ~CONVERT_TWIPS; 1267cdf0e10cSrcweir switch(nMemberId) 1268cdf0e10cSrcweir { 1269cdf0e10cSrcweir case MID_FONTWIDTH: 1270cdf0e10cSrcweir rVal <<= (sal_Int16)(nWidth); 1271cdf0e10cSrcweir break; 1272cdf0e10cSrcweir case MID_FONTWIDTH_PROP: 1273cdf0e10cSrcweir rVal <<= (sal_Int16)(nProp); 1274cdf0e10cSrcweir break; 1275cdf0e10cSrcweir } 1276cdf0e10cSrcweir return sal_True; 1277cdf0e10cSrcweir } 1278cdf0e10cSrcweir /*-----------------13.03.98 16:03------------------- 1279cdf0e10cSrcweir 1280cdf0e10cSrcweir --------------------------------------------------*/ 1281cdf0e10cSrcweir sal_Bool SvxFontWidthItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) 1282cdf0e10cSrcweir { 1283cdf0e10cSrcweir // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); 1284cdf0e10cSrcweir nMemberId &= ~CONVERT_TWIPS; 1285cdf0e10cSrcweir sal_Int16 nVal = sal_Int16(); 1286cdf0e10cSrcweir if(!(rVal >>= nVal)) 1287cdf0e10cSrcweir return sal_False; 1288cdf0e10cSrcweir 1289cdf0e10cSrcweir switch(nMemberId) 1290cdf0e10cSrcweir { 1291cdf0e10cSrcweir case MID_FONTWIDTH: 1292cdf0e10cSrcweir nProp = nVal; 1293cdf0e10cSrcweir break; 1294cdf0e10cSrcweir case MID_FONTWIDTH_PROP: 1295cdf0e10cSrcweir nWidth = nVal; 1296cdf0e10cSrcweir break; 1297cdf0e10cSrcweir } 1298cdf0e10cSrcweir return sal_True; 1299cdf0e10cSrcweir } 1300cdf0e10cSrcweir 1301cdf0e10cSrcweir //------------------------------------------------------------------------ 1302cdf0e10cSrcweir 1303cdf0e10cSrcweir SfxItemPresentation SvxFontWidthItem::GetPresentation 1304cdf0e10cSrcweir ( 1305cdf0e10cSrcweir SfxItemPresentation ePres, 1306cdf0e10cSrcweir SfxMapUnit eCoreUnit, 1307cdf0e10cSrcweir SfxMapUnit /*ePresUnit*/, 1308cdf0e10cSrcweir XubString& rText, const IntlWrapper *pIntl 1309cdf0e10cSrcweir ) const 1310cdf0e10cSrcweir { 1311cdf0e10cSrcweir #ifndef SVX_LIGHT 1312cdf0e10cSrcweir switch ( ePres ) 1313cdf0e10cSrcweir { 1314cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NONE: 1315cdf0e10cSrcweir rText.Erase(); 1316cdf0e10cSrcweir return ePres; 1317cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NAMELESS: 1318cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_COMPLETE: 1319cdf0e10cSrcweir { 1320cdf0e10cSrcweir if ( 100 == nProp ) 1321cdf0e10cSrcweir { 1322cdf0e10cSrcweir rText = GetMetricText( (long)nWidth, 1323cdf0e10cSrcweir eCoreUnit, SFX_MAPUNIT_POINT, pIntl ); 1324*ae2dc0faSTsutomu Uchino rText += sal_Unicode(' '); 1325cdf0e10cSrcweir rText += EE_RESSTR(GetMetricId(SFX_MAPUNIT_POINT)); 1326cdf0e10cSrcweir } 1327cdf0e10cSrcweir else 1328cdf0e10cSrcweir ( rText = String::CreateFromInt32( nProp )) += sal_Unicode('%'); 1329cdf0e10cSrcweir return ePres; 1330cdf0e10cSrcweir } 1331cdf0e10cSrcweir default: ; //prevent warning 1332cdf0e10cSrcweir } 1333cdf0e10cSrcweir #endif 1334cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_NONE; 1335cdf0e10cSrcweir } 1336cdf0e10cSrcweir 1337cdf0e10cSrcweir // class SvxTextLineItem ------------------------------------------------ 1338cdf0e10cSrcweir 1339cdf0e10cSrcweir SvxTextLineItem::SvxTextLineItem( const FontUnderline eSt, const sal_uInt16 nId ) 1340cdf0e10cSrcweir : SfxEnumItem( nId, (sal_uInt16)eSt ), mColor( COL_TRANSPARENT ) 1341cdf0e10cSrcweir { 1342cdf0e10cSrcweir } 1343cdf0e10cSrcweir 1344cdf0e10cSrcweir // ----------------------------------------------------------------------- 1345cdf0e10cSrcweir 1346cdf0e10cSrcweir int SvxTextLineItem::HasBoolValue() const 1347cdf0e10cSrcweir { 1348cdf0e10cSrcweir return sal_True; 1349cdf0e10cSrcweir } 1350cdf0e10cSrcweir 1351cdf0e10cSrcweir // ----------------------------------------------------------------------- 1352cdf0e10cSrcweir 1353cdf0e10cSrcweir sal_Bool SvxTextLineItem::GetBoolValue() const 1354cdf0e10cSrcweir { 1355cdf0e10cSrcweir return (FontUnderline)GetValue() != UNDERLINE_NONE; 1356cdf0e10cSrcweir } 1357cdf0e10cSrcweir 1358cdf0e10cSrcweir // ----------------------------------------------------------------------- 1359cdf0e10cSrcweir 1360cdf0e10cSrcweir void SvxTextLineItem::SetBoolValue( sal_Bool bVal ) 1361cdf0e10cSrcweir { 1362cdf0e10cSrcweir SetValue( (sal_uInt16)(bVal ? UNDERLINE_SINGLE : UNDERLINE_NONE) ); 1363cdf0e10cSrcweir } 1364cdf0e10cSrcweir 1365cdf0e10cSrcweir // ----------------------------------------------------------------------- 1366cdf0e10cSrcweir 1367cdf0e10cSrcweir SfxPoolItem* SvxTextLineItem::Clone( SfxItemPool * ) const 1368cdf0e10cSrcweir { 1369cdf0e10cSrcweir SvxTextLineItem* pNew = new SvxTextLineItem( *this ); 1370cdf0e10cSrcweir pNew->SetColor( GetColor() ); 1371cdf0e10cSrcweir return pNew; 1372cdf0e10cSrcweir } 1373cdf0e10cSrcweir 1374cdf0e10cSrcweir // ----------------------------------------------------------------------- 1375cdf0e10cSrcweir 1376cdf0e10cSrcweir sal_uInt16 SvxTextLineItem::GetValueCount() const 1377cdf0e10cSrcweir { 1378cdf0e10cSrcweir return UNDERLINE_DOTTED + 1; // auch UNDERLINE_NONE geh"ort dazu 1379cdf0e10cSrcweir } 1380cdf0e10cSrcweir 1381cdf0e10cSrcweir // ----------------------------------------------------------------------- 1382cdf0e10cSrcweir 1383cdf0e10cSrcweir SvStream& SvxTextLineItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const 1384cdf0e10cSrcweir { 1385cdf0e10cSrcweir rStrm << (sal_uInt8)GetValue(); 1386cdf0e10cSrcweir return rStrm; 1387cdf0e10cSrcweir } 1388cdf0e10cSrcweir 1389cdf0e10cSrcweir // ----------------------------------------------------------------------- 1390cdf0e10cSrcweir 1391cdf0e10cSrcweir SfxPoolItem* SvxTextLineItem::Create(SvStream& rStrm, sal_uInt16) const 1392cdf0e10cSrcweir { 1393cdf0e10cSrcweir sal_uInt8 nState; 1394cdf0e10cSrcweir rStrm >> nState; 1395cdf0e10cSrcweir return new SvxTextLineItem( (FontUnderline)nState, Which() ); 1396cdf0e10cSrcweir } 1397cdf0e10cSrcweir 1398cdf0e10cSrcweir //------------------------------------------------------------------------ 1399cdf0e10cSrcweir 1400cdf0e10cSrcweir SfxItemPresentation SvxTextLineItem::GetPresentation 1401cdf0e10cSrcweir ( 1402cdf0e10cSrcweir SfxItemPresentation ePres, 1403cdf0e10cSrcweir SfxMapUnit /*eCoreUnit*/, 1404cdf0e10cSrcweir SfxMapUnit /*ePresUnit*/, 1405cdf0e10cSrcweir XubString& rText, const IntlWrapper * /*pIntl*/ 1406cdf0e10cSrcweir ) const 1407cdf0e10cSrcweir { 1408cdf0e10cSrcweir #ifndef SVX_LIGHT 1409cdf0e10cSrcweir switch ( ePres ) 1410cdf0e10cSrcweir { 1411cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NONE: 1412cdf0e10cSrcweir rText.Erase(); 1413cdf0e10cSrcweir return ePres; 1414cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NAMELESS: 1415cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_COMPLETE: 1416cdf0e10cSrcweir rText = GetValueTextByPos( GetValue() ); 1417cdf0e10cSrcweir if( !mColor.GetTransparency() ) 1418cdf0e10cSrcweir ( rText += cpDelim ) += ::GetColorString( mColor ); 1419cdf0e10cSrcweir return ePres; 1420cdf0e10cSrcweir default: ; //prevent warning 1421cdf0e10cSrcweir } 1422cdf0e10cSrcweir #endif 1423cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_NONE; 1424cdf0e10cSrcweir } 1425cdf0e10cSrcweir 1426cdf0e10cSrcweir // ----------------------------------------------------------------------- 1427cdf0e10cSrcweir 1428cdf0e10cSrcweir XubString SvxTextLineItem::GetValueTextByPos( sal_uInt16 /*nPos*/ ) const 1429cdf0e10cSrcweir { 1430cdf0e10cSrcweir DBG_ERROR("SvxTextLineItem::GetValueTextByPos: Pure virtual method"); 1431cdf0e10cSrcweir return XubString(); 1432cdf0e10cSrcweir } 1433cdf0e10cSrcweir 1434cdf0e10cSrcweir /*-----------------13.03.98 16:25------------------- 1435cdf0e10cSrcweir 1436cdf0e10cSrcweir --------------------------------------------------*/ 1437cdf0e10cSrcweir sal_Bool SvxTextLineItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const 1438cdf0e10cSrcweir { 1439cdf0e10cSrcweir // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); 1440cdf0e10cSrcweir nMemberId &= ~CONVERT_TWIPS; 1441cdf0e10cSrcweir switch(nMemberId) 1442cdf0e10cSrcweir { 1443cdf0e10cSrcweir case MID_TEXTLINED: 1444cdf0e10cSrcweir rVal = Bool2Any(GetBoolValue()); 1445cdf0e10cSrcweir break; 1446cdf0e10cSrcweir case MID_TL_STYLE: 1447cdf0e10cSrcweir rVal <<= (sal_Int16)(GetValue()); 1448cdf0e10cSrcweir break; 1449cdf0e10cSrcweir case MID_TL_COLOR: 1450cdf0e10cSrcweir rVal <<= (sal_Int32)( mColor.GetColor() ); 1451cdf0e10cSrcweir break; 1452cdf0e10cSrcweir case MID_TL_HASCOLOR: 1453cdf0e10cSrcweir rVal = Bool2Any( !mColor.GetTransparency() ); 1454cdf0e10cSrcweir break; 1455cdf0e10cSrcweir } 1456cdf0e10cSrcweir return sal_True; 1457cdf0e10cSrcweir 1458cdf0e10cSrcweir } 1459cdf0e10cSrcweir /*-----------------13.03.98 16:28------------------- 1460cdf0e10cSrcweir 1461cdf0e10cSrcweir --------------------------------------------------*/ 1462cdf0e10cSrcweir sal_Bool SvxTextLineItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) 1463cdf0e10cSrcweir { 1464cdf0e10cSrcweir // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); 1465cdf0e10cSrcweir nMemberId &= ~CONVERT_TWIPS; 1466cdf0e10cSrcweir sal_Bool bRet = sal_True; 1467cdf0e10cSrcweir switch(nMemberId) 1468cdf0e10cSrcweir { 1469cdf0e10cSrcweir case MID_TEXTLINED: 1470cdf0e10cSrcweir SetBoolValue(Any2Bool(rVal)); 1471cdf0e10cSrcweir break; 1472cdf0e10cSrcweir case MID_TL_STYLE: 1473cdf0e10cSrcweir { 1474cdf0e10cSrcweir sal_Int32 nValue = 0; 1475cdf0e10cSrcweir if(!(rVal >>= nValue)) 1476cdf0e10cSrcweir bRet = sal_False; 1477cdf0e10cSrcweir else 1478cdf0e10cSrcweir SetValue((sal_Int16)nValue); 1479cdf0e10cSrcweir } 1480cdf0e10cSrcweir break; 1481cdf0e10cSrcweir case MID_TL_COLOR: 1482cdf0e10cSrcweir { 1483cdf0e10cSrcweir sal_Int32 nCol = 0; 1484cdf0e10cSrcweir if( !( rVal >>= nCol ) ) 1485cdf0e10cSrcweir bRet = sal_False; 1486cdf0e10cSrcweir else 1487cdf0e10cSrcweir { 1488cdf0e10cSrcweir // Keep transparence, because it contains the information 1489cdf0e10cSrcweir // whether the font color or the stored color should be used 1490cdf0e10cSrcweir sal_uInt8 nTrans = mColor.GetTransparency(); 1491cdf0e10cSrcweir mColor = Color( nCol ); 1492cdf0e10cSrcweir mColor.SetTransparency( nTrans ); 1493cdf0e10cSrcweir } 1494cdf0e10cSrcweir } 1495cdf0e10cSrcweir break; 1496cdf0e10cSrcweir case MID_TL_HASCOLOR: 1497cdf0e10cSrcweir mColor.SetTransparency( Any2Bool( rVal ) ? 0 : 0xff ); 1498cdf0e10cSrcweir break; 1499cdf0e10cSrcweir } 1500cdf0e10cSrcweir return bRet; 1501cdf0e10cSrcweir } 1502cdf0e10cSrcweir 1503cdf0e10cSrcweir int SvxTextLineItem::operator==( const SfxPoolItem& rItem ) const 1504cdf0e10cSrcweir { 1505cdf0e10cSrcweir DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" ); 1506cdf0e10cSrcweir return SfxEnumItem::operator==( rItem ) && 1507cdf0e10cSrcweir GetColor() == ((SvxTextLineItem&)rItem).GetColor(); 1508cdf0e10cSrcweir } 1509cdf0e10cSrcweir 1510cdf0e10cSrcweir // class SvxUnderlineItem ------------------------------------------------ 1511cdf0e10cSrcweir 1512cdf0e10cSrcweir SvxUnderlineItem::SvxUnderlineItem( const FontUnderline eSt, const sal_uInt16 nId ) 1513cdf0e10cSrcweir : SvxTextLineItem( eSt, nId ) 1514cdf0e10cSrcweir { 1515cdf0e10cSrcweir } 1516cdf0e10cSrcweir 1517cdf0e10cSrcweir //------------------------------------------------------------------------ 1518cdf0e10cSrcweir 1519cdf0e10cSrcweir SfxPoolItem* SvxUnderlineItem::Clone( SfxItemPool * ) const 1520cdf0e10cSrcweir { 1521cdf0e10cSrcweir SvxUnderlineItem* pNew = new SvxUnderlineItem( *this ); 1522cdf0e10cSrcweir pNew->SetColor( GetColor() ); 1523cdf0e10cSrcweir return pNew; 1524cdf0e10cSrcweir } 1525cdf0e10cSrcweir 1526cdf0e10cSrcweir // ----------------------------------------------------------------------- 1527cdf0e10cSrcweir 1528cdf0e10cSrcweir SfxPoolItem* SvxUnderlineItem::Create(SvStream& rStrm, sal_uInt16) const 1529cdf0e10cSrcweir { 1530cdf0e10cSrcweir sal_uInt8 nState; 1531cdf0e10cSrcweir rStrm >> nState; 1532cdf0e10cSrcweir return new SvxUnderlineItem( (FontUnderline)nState, Which() ); 1533cdf0e10cSrcweir } 1534cdf0e10cSrcweir 1535cdf0e10cSrcweir // ----------------------------------------------------------------------- 1536cdf0e10cSrcweir 1537cdf0e10cSrcweir XubString SvxUnderlineItem::GetValueTextByPos( sal_uInt16 nPos ) const 1538cdf0e10cSrcweir { 1539cdf0e10cSrcweir DBG_ASSERT( nPos <= (sal_uInt16)UNDERLINE_BOLDWAVE, "enum overflow!" ); 1540cdf0e10cSrcweir return EE_RESSTR( RID_SVXITEMS_UL_BEGIN + nPos ); 1541cdf0e10cSrcweir } 1542cdf0e10cSrcweir 1543cdf0e10cSrcweir // class SvxOverlineItem ------------------------------------------------ 1544cdf0e10cSrcweir 1545cdf0e10cSrcweir SvxOverlineItem::SvxOverlineItem( const FontUnderline eSt, const sal_uInt16 nId ) 1546cdf0e10cSrcweir : SvxTextLineItem( eSt, nId ) 1547cdf0e10cSrcweir { 1548cdf0e10cSrcweir } 1549cdf0e10cSrcweir 1550cdf0e10cSrcweir //------------------------------------------------------------------------ 1551cdf0e10cSrcweir 1552cdf0e10cSrcweir SfxPoolItem* SvxOverlineItem::Clone( SfxItemPool * ) const 1553cdf0e10cSrcweir { 1554cdf0e10cSrcweir SvxOverlineItem* pNew = new SvxOverlineItem( *this ); 1555cdf0e10cSrcweir pNew->SetColor( GetColor() ); 1556cdf0e10cSrcweir return pNew; 1557cdf0e10cSrcweir } 1558cdf0e10cSrcweir 1559cdf0e10cSrcweir // ----------------------------------------------------------------------- 1560cdf0e10cSrcweir 1561cdf0e10cSrcweir SfxPoolItem* SvxOverlineItem::Create(SvStream& rStrm, sal_uInt16) const 1562cdf0e10cSrcweir { 1563cdf0e10cSrcweir sal_uInt8 nState; 1564cdf0e10cSrcweir rStrm >> nState; 1565cdf0e10cSrcweir return new SvxOverlineItem( (FontUnderline)nState, Which() ); 1566cdf0e10cSrcweir } 1567cdf0e10cSrcweir 1568cdf0e10cSrcweir // ----------------------------------------------------------------------- 1569cdf0e10cSrcweir 1570cdf0e10cSrcweir XubString SvxOverlineItem::GetValueTextByPos( sal_uInt16 nPos ) const 1571cdf0e10cSrcweir { 1572cdf0e10cSrcweir DBG_ASSERT( nPos <= (sal_uInt16)UNDERLINE_BOLDWAVE, "enum overflow!" ); 1573cdf0e10cSrcweir return EE_RESSTR( RID_SVXITEMS_OL_BEGIN + nPos ); 1574cdf0e10cSrcweir } 1575cdf0e10cSrcweir 1576cdf0e10cSrcweir // class SvxCrossedOutItem ----------------------------------------------- 1577cdf0e10cSrcweir 1578cdf0e10cSrcweir SvxCrossedOutItem::SvxCrossedOutItem( const FontStrikeout eSt, const sal_uInt16 nId ) 1579cdf0e10cSrcweir : SfxEnumItem( nId, (sal_uInt16)eSt ) 1580cdf0e10cSrcweir { 1581cdf0e10cSrcweir } 1582cdf0e10cSrcweir 1583cdf0e10cSrcweir // ----------------------------------------------------------------------- 1584cdf0e10cSrcweir 1585cdf0e10cSrcweir int SvxCrossedOutItem::HasBoolValue() const 1586cdf0e10cSrcweir { 1587cdf0e10cSrcweir return sal_True; 1588cdf0e10cSrcweir } 1589cdf0e10cSrcweir 1590cdf0e10cSrcweir // ----------------------------------------------------------------------- 1591cdf0e10cSrcweir 1592cdf0e10cSrcweir sal_Bool SvxCrossedOutItem::GetBoolValue() const 1593cdf0e10cSrcweir { 1594cdf0e10cSrcweir return (FontStrikeout)GetValue() != STRIKEOUT_NONE; 1595cdf0e10cSrcweir } 1596cdf0e10cSrcweir 1597cdf0e10cSrcweir // ----------------------------------------------------------------------- 1598cdf0e10cSrcweir 1599cdf0e10cSrcweir void SvxCrossedOutItem::SetBoolValue( sal_Bool bVal ) 1600cdf0e10cSrcweir { 1601cdf0e10cSrcweir SetValue( (sal_uInt16)(bVal ? STRIKEOUT_SINGLE : STRIKEOUT_NONE) ); 1602cdf0e10cSrcweir } 1603cdf0e10cSrcweir 1604cdf0e10cSrcweir // ----------------------------------------------------------------------- 1605cdf0e10cSrcweir 1606cdf0e10cSrcweir sal_uInt16 SvxCrossedOutItem::GetValueCount() const 1607cdf0e10cSrcweir { 1608cdf0e10cSrcweir return STRIKEOUT_DOUBLE + 1; // auch STRIKEOUT_NONE geh"ort dazu 1609cdf0e10cSrcweir } 1610cdf0e10cSrcweir 1611cdf0e10cSrcweir // ----------------------------------------------------------------------- 1612cdf0e10cSrcweir 1613cdf0e10cSrcweir SfxPoolItem* SvxCrossedOutItem::Clone( SfxItemPool * ) const 1614cdf0e10cSrcweir { 1615cdf0e10cSrcweir return new SvxCrossedOutItem( *this ); 1616cdf0e10cSrcweir } 1617cdf0e10cSrcweir 1618cdf0e10cSrcweir // ----------------------------------------------------------------------- 1619cdf0e10cSrcweir 1620cdf0e10cSrcweir SvStream& SvxCrossedOutItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const 1621cdf0e10cSrcweir { 1622cdf0e10cSrcweir rStrm << (sal_uInt8)GetValue(); 1623cdf0e10cSrcweir return rStrm; 1624cdf0e10cSrcweir } 1625cdf0e10cSrcweir 1626cdf0e10cSrcweir // ----------------------------------------------------------------------- 1627cdf0e10cSrcweir 1628cdf0e10cSrcweir SfxPoolItem* SvxCrossedOutItem::Create(SvStream& rStrm, sal_uInt16) const 1629cdf0e10cSrcweir { 1630cdf0e10cSrcweir sal_uInt8 eCross; 1631cdf0e10cSrcweir rStrm >> eCross; 1632cdf0e10cSrcweir return new SvxCrossedOutItem( (FontStrikeout)eCross, Which() ); 1633cdf0e10cSrcweir } 1634cdf0e10cSrcweir 1635cdf0e10cSrcweir //------------------------------------------------------------------------ 1636cdf0e10cSrcweir 1637cdf0e10cSrcweir SfxItemPresentation SvxCrossedOutItem::GetPresentation 1638cdf0e10cSrcweir ( 1639cdf0e10cSrcweir SfxItemPresentation ePres, 1640cdf0e10cSrcweir SfxMapUnit /*eCoreUnit*/, 1641cdf0e10cSrcweir SfxMapUnit /*ePresUnit*/, 1642cdf0e10cSrcweir XubString& rText, const IntlWrapper * /*pIntl*/ 1643cdf0e10cSrcweir ) const 1644cdf0e10cSrcweir { 1645cdf0e10cSrcweir switch ( ePres ) 1646cdf0e10cSrcweir { 1647cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NONE: 1648cdf0e10cSrcweir rText.Erase(); 1649cdf0e10cSrcweir return ePres; 1650cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NAMELESS: 1651cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_COMPLETE: 1652cdf0e10cSrcweir rText = GetValueTextByPos( GetValue() ); 1653cdf0e10cSrcweir return ePres; 1654cdf0e10cSrcweir default: ;//prevent warning 1655cdf0e10cSrcweir } 1656cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_NONE; 1657cdf0e10cSrcweir } 1658cdf0e10cSrcweir 1659cdf0e10cSrcweir // ----------------------------------------------------------------------- 1660cdf0e10cSrcweir 1661cdf0e10cSrcweir XubString SvxCrossedOutItem::GetValueTextByPos( sal_uInt16 nPos ) const 1662cdf0e10cSrcweir { 1663cdf0e10cSrcweir DBG_ASSERT( nPos <= (sal_uInt16)STRIKEOUT_X, "enum overflow!" ); 1664cdf0e10cSrcweir return EE_RESSTR( RID_SVXITEMS_STRIKEOUT_BEGIN + nPos ); 1665cdf0e10cSrcweir } 1666cdf0e10cSrcweir 1667cdf0e10cSrcweir /*-----------------13.03.98 16:28------------------- 1668cdf0e10cSrcweir 1669cdf0e10cSrcweir --------------------------------------------------*/ 1670cdf0e10cSrcweir sal_Bool SvxCrossedOutItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const 1671cdf0e10cSrcweir { 1672cdf0e10cSrcweir // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); 1673cdf0e10cSrcweir nMemberId &= ~CONVERT_TWIPS; 1674cdf0e10cSrcweir switch(nMemberId) 1675cdf0e10cSrcweir { 1676cdf0e10cSrcweir case MID_CROSSED_OUT: 1677cdf0e10cSrcweir rVal = Bool2Any(GetBoolValue()); 1678cdf0e10cSrcweir break; 1679cdf0e10cSrcweir case MID_CROSS_OUT: 1680cdf0e10cSrcweir rVal <<= (sal_Int16)(GetValue()); 1681cdf0e10cSrcweir break; 1682cdf0e10cSrcweir } 1683cdf0e10cSrcweir return sal_True; 1684cdf0e10cSrcweir } 1685cdf0e10cSrcweir /*-----------------13.03.98 16:29------------------- 1686cdf0e10cSrcweir 1687cdf0e10cSrcweir --------------------------------------------------*/ 1688cdf0e10cSrcweir sal_Bool SvxCrossedOutItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) 1689cdf0e10cSrcweir { 1690cdf0e10cSrcweir // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); 1691cdf0e10cSrcweir nMemberId &= ~CONVERT_TWIPS; 1692cdf0e10cSrcweir switch(nMemberId) 1693cdf0e10cSrcweir { 1694cdf0e10cSrcweir case MID_CROSSED_OUT: 1695cdf0e10cSrcweir SetBoolValue(Any2Bool(rVal)); 1696cdf0e10cSrcweir break; 1697cdf0e10cSrcweir case MID_CROSS_OUT: 1698cdf0e10cSrcweir { 1699cdf0e10cSrcweir sal_Int32 nValue = 0; 1700cdf0e10cSrcweir if(!(rVal >>= nValue)) 1701cdf0e10cSrcweir return sal_False; 1702cdf0e10cSrcweir SetValue((sal_Int16)nValue); 1703cdf0e10cSrcweir } 1704cdf0e10cSrcweir break; 1705cdf0e10cSrcweir } 1706cdf0e10cSrcweir return sal_True; 1707cdf0e10cSrcweir } 1708cdf0e10cSrcweir // class SvxShadowedItem ------------------------------------------------- 1709cdf0e10cSrcweir 1710cdf0e10cSrcweir SvxShadowedItem::SvxShadowedItem( const sal_Bool bShadowed, const sal_uInt16 nId ) : 1711cdf0e10cSrcweir SfxBoolItem( nId, bShadowed ) 1712cdf0e10cSrcweir { 1713cdf0e10cSrcweir } 1714cdf0e10cSrcweir 1715cdf0e10cSrcweir // ----------------------------------------------------------------------- 1716cdf0e10cSrcweir 1717cdf0e10cSrcweir SfxPoolItem* SvxShadowedItem::Clone( SfxItemPool * ) const 1718cdf0e10cSrcweir { 1719cdf0e10cSrcweir return new SvxShadowedItem( *this ); 1720cdf0e10cSrcweir } 1721cdf0e10cSrcweir 1722cdf0e10cSrcweir // ----------------------------------------------------------------------- 1723cdf0e10cSrcweir 1724cdf0e10cSrcweir SvStream& SvxShadowedItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const 1725cdf0e10cSrcweir { 1726cdf0e10cSrcweir rStrm << (sal_uInt8) GetValue(); 1727cdf0e10cSrcweir return rStrm; 1728cdf0e10cSrcweir } 1729cdf0e10cSrcweir 1730cdf0e10cSrcweir // ----------------------------------------------------------------------- 1731cdf0e10cSrcweir 1732cdf0e10cSrcweir SfxPoolItem* SvxShadowedItem::Create(SvStream& rStrm, sal_uInt16) const 1733cdf0e10cSrcweir { 1734cdf0e10cSrcweir sal_uInt8 nState; 1735cdf0e10cSrcweir rStrm >> nState; 1736cdf0e10cSrcweir return new SvxShadowedItem( nState, Which() ); 1737cdf0e10cSrcweir } 1738cdf0e10cSrcweir 1739cdf0e10cSrcweir //------------------------------------------------------------------------ 1740cdf0e10cSrcweir 1741cdf0e10cSrcweir SfxItemPresentation SvxShadowedItem::GetPresentation 1742cdf0e10cSrcweir ( 1743cdf0e10cSrcweir SfxItemPresentation ePres, 1744cdf0e10cSrcweir SfxMapUnit /*eCoreUnit*/, 1745cdf0e10cSrcweir SfxMapUnit /*ePresUnit*/, 1746cdf0e10cSrcweir XubString& rText, const IntlWrapper * /*pIntl*/ 1747cdf0e10cSrcweir ) const 1748cdf0e10cSrcweir { 1749cdf0e10cSrcweir switch ( ePres ) 1750cdf0e10cSrcweir { 1751cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NONE: 1752cdf0e10cSrcweir rText.Erase(); 1753cdf0e10cSrcweir return ePres; 1754cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NAMELESS: 1755cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_COMPLETE: 1756cdf0e10cSrcweir { 1757cdf0e10cSrcweir sal_uInt16 nId = RID_SVXITEMS_SHADOWED_FALSE; 1758cdf0e10cSrcweir 1759cdf0e10cSrcweir if ( GetValue() ) 1760cdf0e10cSrcweir nId = RID_SVXITEMS_SHADOWED_TRUE; 1761cdf0e10cSrcweir rText = EE_RESSTR(nId); 1762cdf0e10cSrcweir return ePres; 1763cdf0e10cSrcweir } 1764cdf0e10cSrcweir default: ; //prevent warning 1765cdf0e10cSrcweir } 1766cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_NONE; 1767cdf0e10cSrcweir } 1768cdf0e10cSrcweir 1769cdf0e10cSrcweir // class SvxAutoKernItem ------------------------------------------------- 1770cdf0e10cSrcweir 1771cdf0e10cSrcweir SvxAutoKernItem::SvxAutoKernItem( const sal_Bool bAutoKern, const sal_uInt16 nId ) : 1772cdf0e10cSrcweir SfxBoolItem( nId, bAutoKern ) 1773cdf0e10cSrcweir { 1774cdf0e10cSrcweir } 1775cdf0e10cSrcweir 1776cdf0e10cSrcweir // ----------------------------------------------------------------------- 1777cdf0e10cSrcweir 1778cdf0e10cSrcweir SfxPoolItem* SvxAutoKernItem::Clone( SfxItemPool * ) const 1779cdf0e10cSrcweir { 1780cdf0e10cSrcweir return new SvxAutoKernItem( *this ); 1781cdf0e10cSrcweir } 1782cdf0e10cSrcweir 1783cdf0e10cSrcweir // ----------------------------------------------------------------------- 1784cdf0e10cSrcweir 1785cdf0e10cSrcweir SvStream& SvxAutoKernItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const 1786cdf0e10cSrcweir { 1787cdf0e10cSrcweir rStrm << (sal_uInt8) GetValue(); 1788cdf0e10cSrcweir return rStrm; 1789cdf0e10cSrcweir } 1790cdf0e10cSrcweir 1791cdf0e10cSrcweir // ----------------------------------------------------------------------- 1792cdf0e10cSrcweir 1793cdf0e10cSrcweir SfxPoolItem* SvxAutoKernItem::Create(SvStream& rStrm, sal_uInt16) const 1794cdf0e10cSrcweir { 1795cdf0e10cSrcweir sal_uInt8 nState; 1796cdf0e10cSrcweir rStrm >> nState; 1797cdf0e10cSrcweir return new SvxAutoKernItem( nState, Which() ); 1798cdf0e10cSrcweir } 1799cdf0e10cSrcweir 1800cdf0e10cSrcweir //------------------------------------------------------------------------ 1801cdf0e10cSrcweir 1802cdf0e10cSrcweir SfxItemPresentation SvxAutoKernItem::GetPresentation 1803cdf0e10cSrcweir ( 1804cdf0e10cSrcweir SfxItemPresentation ePres, 1805cdf0e10cSrcweir SfxMapUnit /*eCoreUnit*/, 1806cdf0e10cSrcweir SfxMapUnit /*ePresUnit*/, 1807cdf0e10cSrcweir XubString& rText, const IntlWrapper * /*pIntl*/ 1808cdf0e10cSrcweir ) const 1809cdf0e10cSrcweir { 1810cdf0e10cSrcweir switch ( ePres ) 1811cdf0e10cSrcweir { 1812cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NONE: 1813cdf0e10cSrcweir rText.Erase(); 1814cdf0e10cSrcweir return ePres; 1815cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NAMELESS: 1816cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_COMPLETE: 1817cdf0e10cSrcweir { 1818cdf0e10cSrcweir sal_uInt16 nId = RID_SVXITEMS_AUTOKERN_FALSE; 1819cdf0e10cSrcweir 1820cdf0e10cSrcweir if ( GetValue() ) 1821cdf0e10cSrcweir nId = RID_SVXITEMS_AUTOKERN_TRUE; 1822cdf0e10cSrcweir rText = EE_RESSTR(nId); 1823cdf0e10cSrcweir return ePres; 1824cdf0e10cSrcweir } 1825cdf0e10cSrcweir default: ; //prevent warning 1826cdf0e10cSrcweir } 1827cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_NONE; 1828cdf0e10cSrcweir } 1829cdf0e10cSrcweir 1830cdf0e10cSrcweir // class SvxWordLineModeItem --------------------------------------------- 1831cdf0e10cSrcweir 1832cdf0e10cSrcweir SvxWordLineModeItem::SvxWordLineModeItem( const sal_Bool bWordLineMode, 1833cdf0e10cSrcweir const sal_uInt16 nId ) : 1834cdf0e10cSrcweir SfxBoolItem( nId, bWordLineMode ) 1835cdf0e10cSrcweir { 1836cdf0e10cSrcweir } 1837cdf0e10cSrcweir 1838cdf0e10cSrcweir // ----------------------------------------------------------------------- 1839cdf0e10cSrcweir 1840cdf0e10cSrcweir SfxPoolItem* SvxWordLineModeItem::Clone( SfxItemPool * ) const 1841cdf0e10cSrcweir { 1842cdf0e10cSrcweir return new SvxWordLineModeItem( *this ); 1843cdf0e10cSrcweir } 1844cdf0e10cSrcweir 1845cdf0e10cSrcweir // ----------------------------------------------------------------------- 1846cdf0e10cSrcweir 1847cdf0e10cSrcweir SvStream& SvxWordLineModeItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const 1848cdf0e10cSrcweir { 1849cdf0e10cSrcweir rStrm << (sal_Bool) GetValue(); 1850cdf0e10cSrcweir return rStrm; 1851cdf0e10cSrcweir } 1852cdf0e10cSrcweir 1853cdf0e10cSrcweir // ----------------------------------------------------------------------- 1854cdf0e10cSrcweir 1855cdf0e10cSrcweir SfxPoolItem* SvxWordLineModeItem::Create(SvStream& rStrm, sal_uInt16) const 1856cdf0e10cSrcweir { 1857cdf0e10cSrcweir sal_Bool bValue; 1858cdf0e10cSrcweir rStrm >> bValue; 1859cdf0e10cSrcweir return new SvxWordLineModeItem( bValue, Which() ); 1860cdf0e10cSrcweir } 1861cdf0e10cSrcweir 1862cdf0e10cSrcweir //------------------------------------------------------------------------ 1863cdf0e10cSrcweir 1864cdf0e10cSrcweir SfxItemPresentation SvxWordLineModeItem::GetPresentation 1865cdf0e10cSrcweir ( 1866cdf0e10cSrcweir SfxItemPresentation ePres, 1867cdf0e10cSrcweir SfxMapUnit /*eCoreUnit*/, 1868cdf0e10cSrcweir SfxMapUnit /*ePresUnit*/, 1869cdf0e10cSrcweir XubString& rText, const IntlWrapper * /*pIntl*/ 1870cdf0e10cSrcweir ) const 1871cdf0e10cSrcweir { 1872cdf0e10cSrcweir switch ( ePres ) 1873cdf0e10cSrcweir { 1874cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NONE: 1875cdf0e10cSrcweir rText.Erase(); 1876cdf0e10cSrcweir return ePres; 1877cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NAMELESS: 1878cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_COMPLETE: 1879cdf0e10cSrcweir { 1880cdf0e10cSrcweir sal_uInt16 nId = RID_SVXITEMS_WORDLINE_FALSE; 1881cdf0e10cSrcweir 1882cdf0e10cSrcweir if ( GetValue() ) 1883cdf0e10cSrcweir nId = RID_SVXITEMS_WORDLINE_TRUE; 1884cdf0e10cSrcweir rText = EE_RESSTR(nId); 1885cdf0e10cSrcweir return ePres; 1886cdf0e10cSrcweir } 1887cdf0e10cSrcweir default: ; //prevent warning 1888cdf0e10cSrcweir } 1889cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_NONE; 1890cdf0e10cSrcweir } 1891cdf0e10cSrcweir 1892cdf0e10cSrcweir // class SvxContourItem -------------------------------------------------- 1893cdf0e10cSrcweir 1894cdf0e10cSrcweir SvxContourItem::SvxContourItem( const sal_Bool bContoured, const sal_uInt16 nId ) : 1895cdf0e10cSrcweir SfxBoolItem( nId, bContoured ) 1896cdf0e10cSrcweir { 1897cdf0e10cSrcweir } 1898cdf0e10cSrcweir 1899cdf0e10cSrcweir // ----------------------------------------------------------------------- 1900cdf0e10cSrcweir 1901cdf0e10cSrcweir SfxPoolItem* SvxContourItem::Clone( SfxItemPool * ) const 1902cdf0e10cSrcweir { 1903cdf0e10cSrcweir return new SvxContourItem( *this ); 1904cdf0e10cSrcweir } 1905cdf0e10cSrcweir 1906cdf0e10cSrcweir // ----------------------------------------------------------------------- 1907cdf0e10cSrcweir 1908cdf0e10cSrcweir SvStream& SvxContourItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const 1909cdf0e10cSrcweir { 1910cdf0e10cSrcweir rStrm << (sal_Bool) GetValue(); 1911cdf0e10cSrcweir return rStrm; 1912cdf0e10cSrcweir } 1913cdf0e10cSrcweir 1914cdf0e10cSrcweir // ----------------------------------------------------------------------- 1915cdf0e10cSrcweir 1916cdf0e10cSrcweir SfxPoolItem* SvxContourItem::Create(SvStream& rStrm, sal_uInt16) const 1917cdf0e10cSrcweir { 1918cdf0e10cSrcweir sal_Bool bValue; 1919cdf0e10cSrcweir rStrm >> bValue; 1920cdf0e10cSrcweir return new SvxContourItem( bValue, Which() ); 1921cdf0e10cSrcweir } 1922cdf0e10cSrcweir 1923cdf0e10cSrcweir //------------------------------------------------------------------------ 1924cdf0e10cSrcweir 1925cdf0e10cSrcweir SfxItemPresentation SvxContourItem::GetPresentation 1926cdf0e10cSrcweir ( 1927cdf0e10cSrcweir SfxItemPresentation ePres, 1928cdf0e10cSrcweir SfxMapUnit /*eCoreUnit*/, 1929cdf0e10cSrcweir SfxMapUnit /*ePresUnit*/, 1930cdf0e10cSrcweir XubString& rText, const IntlWrapper * /*pIntl*/ 1931cdf0e10cSrcweir ) const 1932cdf0e10cSrcweir { 1933cdf0e10cSrcweir switch ( ePres ) 1934cdf0e10cSrcweir { 1935cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NONE: 1936cdf0e10cSrcweir rText.Erase(); 1937cdf0e10cSrcweir return ePres; 1938cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NAMELESS: 1939cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_COMPLETE: 1940cdf0e10cSrcweir { 1941cdf0e10cSrcweir sal_uInt16 nId = RID_SVXITEMS_CONTOUR_FALSE; 1942cdf0e10cSrcweir 1943cdf0e10cSrcweir if ( GetValue() ) 1944cdf0e10cSrcweir nId = RID_SVXITEMS_CONTOUR_TRUE; 1945cdf0e10cSrcweir rText = EE_RESSTR(nId); 1946cdf0e10cSrcweir return ePres; 1947cdf0e10cSrcweir } 1948cdf0e10cSrcweir default: ; //prevent warning 1949cdf0e10cSrcweir } 1950cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_NONE; 1951cdf0e10cSrcweir } 1952cdf0e10cSrcweir 1953cdf0e10cSrcweir // class SvxPropSizeItem ------------------------------------------------- 1954cdf0e10cSrcweir 1955cdf0e10cSrcweir SvxPropSizeItem::SvxPropSizeItem( const sal_uInt16 nPercent, const sal_uInt16 nId ) : 1956cdf0e10cSrcweir SfxUInt16Item( nId, nPercent ) 1957cdf0e10cSrcweir { 1958cdf0e10cSrcweir } 1959cdf0e10cSrcweir 1960cdf0e10cSrcweir // ----------------------------------------------------------------------- 1961cdf0e10cSrcweir 1962cdf0e10cSrcweir SfxPoolItem* SvxPropSizeItem::Clone( SfxItemPool * ) const 1963cdf0e10cSrcweir { 1964cdf0e10cSrcweir return new SvxPropSizeItem( *this ); 1965cdf0e10cSrcweir } 1966cdf0e10cSrcweir 1967cdf0e10cSrcweir // ----------------------------------------------------------------------- 1968cdf0e10cSrcweir 1969cdf0e10cSrcweir SvStream& SvxPropSizeItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const 1970cdf0e10cSrcweir { 1971cdf0e10cSrcweir rStrm << (sal_uInt16) GetValue(); 1972cdf0e10cSrcweir return rStrm; 1973cdf0e10cSrcweir } 1974cdf0e10cSrcweir 1975cdf0e10cSrcweir // ----------------------------------------------------------------------- 1976cdf0e10cSrcweir 1977cdf0e10cSrcweir SfxPoolItem* SvxPropSizeItem::Create(SvStream& rStrm, sal_uInt16) const 1978cdf0e10cSrcweir { 1979cdf0e10cSrcweir sal_uInt16 nSize; 1980cdf0e10cSrcweir rStrm >> nSize; 1981cdf0e10cSrcweir return new SvxPropSizeItem( nSize, Which() ); 1982cdf0e10cSrcweir } 1983cdf0e10cSrcweir 1984cdf0e10cSrcweir //------------------------------------------------------------------------ 1985cdf0e10cSrcweir 1986cdf0e10cSrcweir SfxItemPresentation SvxPropSizeItem::GetPresentation 1987cdf0e10cSrcweir ( 1988cdf0e10cSrcweir SfxItemPresentation /*ePres*/, 1989cdf0e10cSrcweir SfxMapUnit /*eCoreUnit*/, 1990cdf0e10cSrcweir SfxMapUnit /*ePresUnit*/, 1991cdf0e10cSrcweir XubString& rText, const IntlWrapper * /*pIntl*/ 1992cdf0e10cSrcweir ) const 1993cdf0e10cSrcweir { 1994cdf0e10cSrcweir rText.Erase(); 1995cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_NONE; 1996cdf0e10cSrcweir } 1997cdf0e10cSrcweir 1998cdf0e10cSrcweir // class SvxColorItem ---------------------------------------------------- 1999cdf0e10cSrcweir 2000cdf0e10cSrcweir SvxColorItem::SvxColorItem( const sal_uInt16 nId ) : 2001cdf0e10cSrcweir SfxPoolItem( nId ), 2002cdf0e10cSrcweir mColor( COL_BLACK ) 2003cdf0e10cSrcweir { 2004cdf0e10cSrcweir } 2005cdf0e10cSrcweir 2006cdf0e10cSrcweir // ----------------------------------------------------------------------- 2007cdf0e10cSrcweir 2008cdf0e10cSrcweir SvxColorItem::SvxColorItem( const Color& rCol, const sal_uInt16 nId ) : 2009cdf0e10cSrcweir SfxPoolItem( nId ), 2010cdf0e10cSrcweir mColor( rCol ) 2011cdf0e10cSrcweir { 2012cdf0e10cSrcweir } 2013cdf0e10cSrcweir 2014cdf0e10cSrcweir // ----------------------------------------------------------------------- 2015cdf0e10cSrcweir 2016cdf0e10cSrcweir SvxColorItem::SvxColorItem( SvStream &rStrm, const sal_uInt16 nId ) : 2017cdf0e10cSrcweir SfxPoolItem( nId ) 2018cdf0e10cSrcweir { 2019cdf0e10cSrcweir Color aColor; 2020cdf0e10cSrcweir rStrm >> aColor; 2021cdf0e10cSrcweir mColor = aColor; 2022cdf0e10cSrcweir } 2023cdf0e10cSrcweir 2024cdf0e10cSrcweir // ----------------------------------------------------------------------- 2025cdf0e10cSrcweir 2026cdf0e10cSrcweir SvxColorItem::SvxColorItem( const SvxColorItem &rCopy ) : 2027cdf0e10cSrcweir SfxPoolItem( rCopy ), 2028cdf0e10cSrcweir mColor( rCopy.mColor ) 2029cdf0e10cSrcweir { 2030cdf0e10cSrcweir } 2031cdf0e10cSrcweir 2032cdf0e10cSrcweir // ----------------------------------------------------------------------- 2033cdf0e10cSrcweir 2034cdf0e10cSrcweir SvxColorItem::~SvxColorItem() 2035cdf0e10cSrcweir { 2036cdf0e10cSrcweir } 2037cdf0e10cSrcweir 2038cdf0e10cSrcweir // ----------------------------------------------------------------------- 2039cdf0e10cSrcweir sal_uInt16 SvxColorItem::GetVersion( sal_uInt16 nFFVer ) const 2040cdf0e10cSrcweir { 2041cdf0e10cSrcweir DBG_ASSERT( SOFFICE_FILEFORMAT_31==nFFVer || 2042cdf0e10cSrcweir SOFFICE_FILEFORMAT_40==nFFVer || 2043cdf0e10cSrcweir SOFFICE_FILEFORMAT_50==nFFVer, 2044cdf0e10cSrcweir "SvxColorItem: Gibt es ein neues Fileformat?" ); 2045cdf0e10cSrcweir return SOFFICE_FILEFORMAT_50 >= nFFVer ? VERSION_USEAUTOCOLOR : 0; 2046cdf0e10cSrcweir } 2047cdf0e10cSrcweir 2048cdf0e10cSrcweir // ----------------------------------------------------------------------- 2049cdf0e10cSrcweir 2050cdf0e10cSrcweir int SvxColorItem::operator==( const SfxPoolItem& rAttr ) const 2051cdf0e10cSrcweir { 2052cdf0e10cSrcweir DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" ); 2053cdf0e10cSrcweir 2054cdf0e10cSrcweir return mColor == ( (const SvxColorItem&)rAttr ).mColor; 2055cdf0e10cSrcweir } 2056cdf0e10cSrcweir 2057cdf0e10cSrcweir // ----------------------------------------------------------------------- 2058cdf0e10cSrcweir 2059cdf0e10cSrcweir sal_Bool SvxColorItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const 2060cdf0e10cSrcweir { 2061cdf0e10cSrcweir rVal <<= (sal_Int32)(mColor.GetColor()); 2062cdf0e10cSrcweir return sal_True; 2063cdf0e10cSrcweir } 2064cdf0e10cSrcweir 2065cdf0e10cSrcweir // ----------------------------------------------------------------------- 2066cdf0e10cSrcweir 2067cdf0e10cSrcweir sal_Bool SvxColorItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) 2068cdf0e10cSrcweir { 2069cdf0e10cSrcweir sal_Int32 nColor = 0; 2070cdf0e10cSrcweir if(!(rVal >>= nColor)) 2071cdf0e10cSrcweir return sal_False; 2072cdf0e10cSrcweir 2073cdf0e10cSrcweir mColor.SetColor( nColor ); 2074cdf0e10cSrcweir return sal_True; 2075cdf0e10cSrcweir } 2076cdf0e10cSrcweir 2077cdf0e10cSrcweir // ----------------------------------------------------------------------- 2078cdf0e10cSrcweir 2079cdf0e10cSrcweir SfxPoolItem* SvxColorItem::Clone( SfxItemPool * ) const 2080cdf0e10cSrcweir { 2081cdf0e10cSrcweir return new SvxColorItem( *this ); 2082cdf0e10cSrcweir } 2083cdf0e10cSrcweir 2084cdf0e10cSrcweir // ----------------------------------------------------------------------- 2085cdf0e10cSrcweir 2086cdf0e10cSrcweir SvStream& SvxColorItem::Store( SvStream& rStrm , sal_uInt16 nItemVersion ) const 2087cdf0e10cSrcweir { 2088cdf0e10cSrcweir if( VERSION_USEAUTOCOLOR == nItemVersion && 2089cdf0e10cSrcweir COL_AUTO == mColor.GetColor() ) 2090cdf0e10cSrcweir rStrm << Color( COL_BLACK ); 2091cdf0e10cSrcweir else 2092cdf0e10cSrcweir rStrm << mColor; 2093cdf0e10cSrcweir return rStrm; 2094cdf0e10cSrcweir } 2095cdf0e10cSrcweir 2096cdf0e10cSrcweir // ----------------------------------------------------------------------- 2097cdf0e10cSrcweir 2098cdf0e10cSrcweir SfxPoolItem* SvxColorItem::Create(SvStream& rStrm, sal_uInt16 /*nVer*/ ) const 2099cdf0e10cSrcweir { 2100cdf0e10cSrcweir return new SvxColorItem( rStrm, Which() ); 2101cdf0e10cSrcweir } 2102cdf0e10cSrcweir 2103cdf0e10cSrcweir //------------------------------------------------------------------------ 2104cdf0e10cSrcweir 2105cdf0e10cSrcweir SfxItemPresentation SvxColorItem::GetPresentation 2106cdf0e10cSrcweir ( 2107cdf0e10cSrcweir SfxItemPresentation ePres, 2108cdf0e10cSrcweir SfxMapUnit /*eCoreUnit*/, 2109cdf0e10cSrcweir SfxMapUnit /*ePresUnit*/, 2110cdf0e10cSrcweir XubString& rText, const IntlWrapper * /*pIntl*/ 2111cdf0e10cSrcweir ) const 2112cdf0e10cSrcweir { 2113cdf0e10cSrcweir #ifndef SVX_LIGHT 2114cdf0e10cSrcweir switch ( ePres ) 2115cdf0e10cSrcweir { 2116cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NONE: 2117cdf0e10cSrcweir rText.Erase(); 2118cdf0e10cSrcweir return ePres; 2119cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NAMELESS: 2120cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_COMPLETE: 2121cdf0e10cSrcweir rText = ::GetColorString( mColor ); 2122cdf0e10cSrcweir return ePres; 2123cdf0e10cSrcweir default: ; //prevent warning 2124cdf0e10cSrcweir } 2125cdf0e10cSrcweir #endif 2126cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_NONE; 2127cdf0e10cSrcweir } 2128cdf0e10cSrcweir 2129cdf0e10cSrcweir // ----------------------------------------------------------------------- 2130cdf0e10cSrcweir 2131cdf0e10cSrcweir void SvxColorItem::SetValue( const Color& rNewCol ) 2132cdf0e10cSrcweir { 2133cdf0e10cSrcweir mColor = rNewCol; 2134cdf0e10cSrcweir } 2135cdf0e10cSrcweir 2136cdf0e10cSrcweir // class SvxCharSetColorItem --------------------------------------------- 2137cdf0e10cSrcweir 2138cdf0e10cSrcweir SvxCharSetColorItem::SvxCharSetColorItem( const sal_uInt16 nId ) : 2139cdf0e10cSrcweir SvxColorItem( nId ), 2140cdf0e10cSrcweir 2141cdf0e10cSrcweir eFrom( RTL_TEXTENCODING_DONTKNOW ) 2142cdf0e10cSrcweir { 2143cdf0e10cSrcweir } 2144cdf0e10cSrcweir 2145cdf0e10cSrcweir // ----------------------------------------------------------------------- 2146cdf0e10cSrcweir 2147cdf0e10cSrcweir SvxCharSetColorItem::SvxCharSetColorItem( const Color& rCol, 2148cdf0e10cSrcweir const rtl_TextEncoding _eFrom, 2149cdf0e10cSrcweir const sal_uInt16 nId ) : 2150cdf0e10cSrcweir SvxColorItem( rCol, nId ), 2151cdf0e10cSrcweir 2152cdf0e10cSrcweir eFrom( _eFrom ) 2153cdf0e10cSrcweir { 2154cdf0e10cSrcweir } 2155cdf0e10cSrcweir 2156cdf0e10cSrcweir 2157cdf0e10cSrcweir // ----------------------------------------------------------------------- 2158cdf0e10cSrcweir 2159cdf0e10cSrcweir SfxPoolItem* SvxCharSetColorItem::Clone( SfxItemPool * ) const 2160cdf0e10cSrcweir { 2161cdf0e10cSrcweir return new SvxCharSetColorItem( *this ); 2162cdf0e10cSrcweir } 2163cdf0e10cSrcweir 2164cdf0e10cSrcweir // ----------------------------------------------------------------------- 2165cdf0e10cSrcweir 2166cdf0e10cSrcweir SvStream& SvxCharSetColorItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const 2167cdf0e10cSrcweir { 2168cdf0e10cSrcweir // #90477# rStrm << (sal_uInt8) GetStoreCharSet( GetCharSet(), (sal_uInt16)rStrm.GetVersion() ) 2169cdf0e10cSrcweir // << GetValue(); 2170cdf0e10cSrcweir rStrm << (sal_uInt8)GetSOStoreTextEncoding(GetCharSet(), (sal_uInt16)rStrm.GetVersion()) 2171cdf0e10cSrcweir << GetValue(); 2172cdf0e10cSrcweir return rStrm; 2173cdf0e10cSrcweir } 2174cdf0e10cSrcweir 2175cdf0e10cSrcweir // ----------------------------------------------------------------------- 2176cdf0e10cSrcweir 2177cdf0e10cSrcweir SfxPoolItem* SvxCharSetColorItem::Create(SvStream& rStrm, sal_uInt16) const 2178cdf0e10cSrcweir { 2179cdf0e10cSrcweir sal_uInt8 cSet; 2180cdf0e10cSrcweir Color aColor; 2181cdf0e10cSrcweir rStrm >> cSet >> aColor; 2182cdf0e10cSrcweir return new SvxCharSetColorItem( aColor, (rtl_TextEncoding)cSet, Which() ); 2183cdf0e10cSrcweir } 2184cdf0e10cSrcweir 2185cdf0e10cSrcweir //------------------------------------------------------------------------ 2186cdf0e10cSrcweir 2187cdf0e10cSrcweir SfxItemPresentation SvxCharSetColorItem::GetPresentation 2188cdf0e10cSrcweir ( 2189cdf0e10cSrcweir SfxItemPresentation /*ePres*/, 2190cdf0e10cSrcweir SfxMapUnit /*eCoreUnit*/, 2191cdf0e10cSrcweir SfxMapUnit /*ePresUnit*/, 2192cdf0e10cSrcweir XubString& rText, const IntlWrapper * /*pIntl*/ 2193cdf0e10cSrcweir ) const 2194cdf0e10cSrcweir { 2195cdf0e10cSrcweir rText.Erase(); 2196cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_NONE; 2197cdf0e10cSrcweir } 2198cdf0e10cSrcweir 2199cdf0e10cSrcweir // class SvxKerningItem -------------------------------------------------- 2200cdf0e10cSrcweir 2201cdf0e10cSrcweir SvxKerningItem::SvxKerningItem( const short nKern, const sal_uInt16 nId ) : 2202cdf0e10cSrcweir SfxInt16Item( nId, nKern ) 2203cdf0e10cSrcweir { 2204cdf0e10cSrcweir } 2205cdf0e10cSrcweir 2206cdf0e10cSrcweir // ----------------------------------------------------------------------- 2207cdf0e10cSrcweir 2208cdf0e10cSrcweir SfxPoolItem* SvxKerningItem::Clone( SfxItemPool * ) const 2209cdf0e10cSrcweir { 2210cdf0e10cSrcweir return new SvxKerningItem( *this ); 2211cdf0e10cSrcweir } 2212cdf0e10cSrcweir 2213cdf0e10cSrcweir // ----------------------------------------------------------------------- 2214cdf0e10cSrcweir 2215cdf0e10cSrcweir SvStream& SvxKerningItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const 2216cdf0e10cSrcweir { 2217cdf0e10cSrcweir rStrm << (short) GetValue(); 2218cdf0e10cSrcweir return rStrm; 2219cdf0e10cSrcweir } 2220cdf0e10cSrcweir 2221cdf0e10cSrcweir // ----------------------------------------------------------------------- 2222cdf0e10cSrcweir 2223cdf0e10cSrcweir int SvxKerningItem::ScaleMetrics( long nMult, long nDiv ) 2224cdf0e10cSrcweir { 2225cdf0e10cSrcweir SetValue( (sal_Int16)Scale( GetValue(), nMult, nDiv ) ); 2226cdf0e10cSrcweir return 1; 2227cdf0e10cSrcweir } 2228cdf0e10cSrcweir 2229cdf0e10cSrcweir // ----------------------------------------------------------------------- 2230cdf0e10cSrcweir 2231cdf0e10cSrcweir int SvxKerningItem::HasMetrics() const 2232cdf0e10cSrcweir { 2233cdf0e10cSrcweir return 1; 2234cdf0e10cSrcweir } 2235cdf0e10cSrcweir 2236cdf0e10cSrcweir // ----------------------------------------------------------------------- 2237cdf0e10cSrcweir 2238cdf0e10cSrcweir SfxPoolItem* SvxKerningItem::Create(SvStream& rStrm, sal_uInt16) const 2239cdf0e10cSrcweir { 2240cdf0e10cSrcweir short nValue; 2241cdf0e10cSrcweir rStrm >> nValue; 2242cdf0e10cSrcweir return new SvxKerningItem( nValue, Which() ); 2243cdf0e10cSrcweir } 2244cdf0e10cSrcweir 2245cdf0e10cSrcweir //------------------------------------------------------------------------ 2246cdf0e10cSrcweir 2247cdf0e10cSrcweir SfxItemPresentation SvxKerningItem::GetPresentation 2248cdf0e10cSrcweir ( 2249cdf0e10cSrcweir SfxItemPresentation ePres, 2250cdf0e10cSrcweir SfxMapUnit eCoreUnit, 2251cdf0e10cSrcweir SfxMapUnit /*ePresUnit*/, 2252cdf0e10cSrcweir XubString& rText, const IntlWrapper *pIntl 2253cdf0e10cSrcweir ) const 2254cdf0e10cSrcweir { 2255cdf0e10cSrcweir #ifndef SVX_LIGHT 2256cdf0e10cSrcweir switch ( ePres ) 2257cdf0e10cSrcweir { 2258cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NONE: 2259cdf0e10cSrcweir rText.Erase(); 2260cdf0e10cSrcweir return ePres; 2261cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NAMELESS: 2262cdf0e10cSrcweir rText = GetMetricText( (long)GetValue(), eCoreUnit, SFX_MAPUNIT_POINT, pIntl ); 2263*ae2dc0faSTsutomu Uchino rText += sal_Unicode(' '); 2264cdf0e10cSrcweir rText += EE_RESSTR(GetMetricId(SFX_MAPUNIT_POINT)); 2265cdf0e10cSrcweir return ePres; 2266cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_COMPLETE: 2267cdf0e10cSrcweir { 2268cdf0e10cSrcweir rText = EE_RESSTR(RID_SVXITEMS_KERNING_COMPLETE); 2269cdf0e10cSrcweir sal_uInt16 nId = 0; 2270cdf0e10cSrcweir 2271cdf0e10cSrcweir if ( GetValue() > 0 ) 2272cdf0e10cSrcweir nId = RID_SVXITEMS_KERNING_EXPANDED; 2273cdf0e10cSrcweir else if ( GetValue() < 0 ) 2274cdf0e10cSrcweir nId = RID_SVXITEMS_KERNING_CONDENSED; 2275cdf0e10cSrcweir 2276cdf0e10cSrcweir if ( nId ) 2277cdf0e10cSrcweir rText += EE_RESSTR(nId); 2278cdf0e10cSrcweir rText += GetMetricText( (long)GetValue(), eCoreUnit, SFX_MAPUNIT_POINT, pIntl ); 2279*ae2dc0faSTsutomu Uchino rText += sal_Unicode(' '); 2280cdf0e10cSrcweir rText += EE_RESSTR(GetMetricId(SFX_MAPUNIT_POINT)); 2281cdf0e10cSrcweir return ePres; 2282cdf0e10cSrcweir } 2283cdf0e10cSrcweir default: ; //prevent warning 2284cdf0e10cSrcweir } 2285cdf0e10cSrcweir #endif 2286cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_NONE; 2287cdf0e10cSrcweir } 2288cdf0e10cSrcweir /* -----------------------------19.02.01 12:21-------------------------------- 2289cdf0e10cSrcweir 2290cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 2291cdf0e10cSrcweir sal_Bool SvxKerningItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const 2292cdf0e10cSrcweir { 2293cdf0e10cSrcweir sal_Int16 nVal = GetValue(); 2294cdf0e10cSrcweir if(nMemberId & CONVERT_TWIPS) 2295cdf0e10cSrcweir nVal = (sal_Int16)TWIP_TO_MM100(nVal); 2296cdf0e10cSrcweir rVal <<= nVal; 2297cdf0e10cSrcweir return sal_True; 2298cdf0e10cSrcweir } 2299cdf0e10cSrcweir // ----------------------------------------------------------------------- 2300cdf0e10cSrcweir sal_Bool SvxKerningItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId) 2301cdf0e10cSrcweir { 2302cdf0e10cSrcweir sal_Int16 nVal = sal_Int16(); 2303cdf0e10cSrcweir if(!(rVal >>= nVal)) 2304cdf0e10cSrcweir return sal_False; 2305cdf0e10cSrcweir if(nMemberId & CONVERT_TWIPS) 2306cdf0e10cSrcweir nVal = (sal_Int16)MM100_TO_TWIP(nVal); 2307cdf0e10cSrcweir SetValue(nVal); 2308cdf0e10cSrcweir return sal_True; 2309cdf0e10cSrcweir } 2310cdf0e10cSrcweir 2311cdf0e10cSrcweir // class SvxCaseMapItem -------------------------------------------------- 2312cdf0e10cSrcweir 2313cdf0e10cSrcweir SvxCaseMapItem::SvxCaseMapItem( const SvxCaseMap eMap, const sal_uInt16 nId ) : 2314cdf0e10cSrcweir SfxEnumItem( nId, (sal_uInt16)eMap ) 2315cdf0e10cSrcweir { 2316cdf0e10cSrcweir } 2317cdf0e10cSrcweir 2318cdf0e10cSrcweir // ----------------------------------------------------------------------- 2319cdf0e10cSrcweir 2320cdf0e10cSrcweir sal_uInt16 SvxCaseMapItem::GetValueCount() const 2321cdf0e10cSrcweir { 2322cdf0e10cSrcweir return SVX_CASEMAP_END; // SVX_CASEMAP_KAPITAELCHEN + 1 2323cdf0e10cSrcweir } 2324cdf0e10cSrcweir 2325cdf0e10cSrcweir // ----------------------------------------------------------------------- 2326cdf0e10cSrcweir 2327cdf0e10cSrcweir SfxPoolItem* SvxCaseMapItem::Clone( SfxItemPool * ) const 2328cdf0e10cSrcweir { 2329cdf0e10cSrcweir return new SvxCaseMapItem( *this ); 2330cdf0e10cSrcweir } 2331cdf0e10cSrcweir 2332cdf0e10cSrcweir // ----------------------------------------------------------------------- 2333cdf0e10cSrcweir 2334cdf0e10cSrcweir SvStream& SvxCaseMapItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const 2335cdf0e10cSrcweir { 2336cdf0e10cSrcweir rStrm << (sal_uInt8) GetValue(); 2337cdf0e10cSrcweir return rStrm; 2338cdf0e10cSrcweir } 2339cdf0e10cSrcweir 2340cdf0e10cSrcweir // ----------------------------------------------------------------------- 2341cdf0e10cSrcweir 2342cdf0e10cSrcweir SfxPoolItem* SvxCaseMapItem::Create(SvStream& rStrm, sal_uInt16) const 2343cdf0e10cSrcweir { 2344cdf0e10cSrcweir sal_uInt8 cMap; 2345cdf0e10cSrcweir rStrm >> cMap; 2346cdf0e10cSrcweir return new SvxCaseMapItem( (const SvxCaseMap)cMap, Which() ); 2347cdf0e10cSrcweir } 2348cdf0e10cSrcweir 2349cdf0e10cSrcweir //------------------------------------------------------------------------ 2350cdf0e10cSrcweir 2351cdf0e10cSrcweir SfxItemPresentation SvxCaseMapItem::GetPresentation 2352cdf0e10cSrcweir ( 2353cdf0e10cSrcweir SfxItemPresentation ePres, 2354cdf0e10cSrcweir SfxMapUnit /*eCoreUnit*/, 2355cdf0e10cSrcweir SfxMapUnit /*ePresUnit*/, 2356cdf0e10cSrcweir XubString& rText, const IntlWrapper * /*pIntl*/ 2357cdf0e10cSrcweir ) const 2358cdf0e10cSrcweir { 2359cdf0e10cSrcweir switch ( ePres ) 2360cdf0e10cSrcweir { 2361cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NONE: 2362cdf0e10cSrcweir rText.Erase(); 2363cdf0e10cSrcweir return ePres; 2364cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NAMELESS: 2365cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_COMPLETE: 2366cdf0e10cSrcweir rText = GetValueTextByPos( GetValue() ); 2367cdf0e10cSrcweir return ePres; 2368cdf0e10cSrcweir default: ; //prevent warning 2369cdf0e10cSrcweir } 2370cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_NONE; 2371cdf0e10cSrcweir } 2372cdf0e10cSrcweir 2373cdf0e10cSrcweir // ----------------------------------------------------------------------- 2374cdf0e10cSrcweir 2375cdf0e10cSrcweir XubString SvxCaseMapItem::GetValueTextByPos( sal_uInt16 nPos ) const 2376cdf0e10cSrcweir { 2377cdf0e10cSrcweir DBG_ASSERT( nPos < (sal_uInt16)SVX_CASEMAP_END, "enum overflow!" ); 2378cdf0e10cSrcweir return EE_RESSTR( RID_SVXITEMS_CASEMAP_BEGIN + nPos ); 2379cdf0e10cSrcweir } 2380cdf0e10cSrcweir 2381cdf0e10cSrcweir /*-----------------13.03.98 16:29------------------- 2382cdf0e10cSrcweir 2383cdf0e10cSrcweir --------------------------------------------------*/ 2384cdf0e10cSrcweir sal_Bool SvxCaseMapItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const 2385cdf0e10cSrcweir { 2386cdf0e10cSrcweir sal_Int16 nRet = style::CaseMap::NONE; 2387cdf0e10cSrcweir switch( GetValue() ) 2388cdf0e10cSrcweir { 2389cdf0e10cSrcweir // case SVX_CASEMAP_NOT_MAPPED : nRet = style::CaseMap::NONE ; break; 2390cdf0e10cSrcweir case SVX_CASEMAP_VERSALIEN : nRet = style::CaseMap::UPPERCASE; break; 2391cdf0e10cSrcweir case SVX_CASEMAP_GEMEINE : nRet = style::CaseMap::LOWERCASE; break; 2392cdf0e10cSrcweir case SVX_CASEMAP_TITEL : nRet = style::CaseMap::TITLE ; break; 2393cdf0e10cSrcweir case SVX_CASEMAP_KAPITAELCHEN: nRet = style::CaseMap::SMALLCAPS; break; 2394cdf0e10cSrcweir } 2395cdf0e10cSrcweir rVal <<= (sal_Int16)(nRet); 2396cdf0e10cSrcweir return sal_True; 2397cdf0e10cSrcweir } 2398cdf0e10cSrcweir /*-----------------13.03.98 16:29------------------- 2399cdf0e10cSrcweir 2400cdf0e10cSrcweir --------------------------------------------------*/ 2401cdf0e10cSrcweir sal_Bool SvxCaseMapItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) 2402cdf0e10cSrcweir { 2403cdf0e10cSrcweir sal_uInt16 nVal = sal_uInt16(); 2404cdf0e10cSrcweir if(!(rVal >>= nVal)) 2405cdf0e10cSrcweir return sal_False; 2406cdf0e10cSrcweir 2407cdf0e10cSrcweir switch( nVal ) 2408cdf0e10cSrcweir { 2409cdf0e10cSrcweir case style::CaseMap::NONE : nVal = SVX_CASEMAP_NOT_MAPPED ; break; 2410cdf0e10cSrcweir case style::CaseMap::UPPERCASE: nVal = SVX_CASEMAP_VERSALIEN ; break; 2411cdf0e10cSrcweir case style::CaseMap::LOWERCASE: nVal = SVX_CASEMAP_GEMEINE ; break; 2412cdf0e10cSrcweir case style::CaseMap::TITLE : nVal = SVX_CASEMAP_TITEL ; break; 2413cdf0e10cSrcweir case style::CaseMap::SMALLCAPS: nVal = SVX_CASEMAP_KAPITAELCHEN; break; 2414cdf0e10cSrcweir } 2415cdf0e10cSrcweir SetValue(nVal); 2416cdf0e10cSrcweir return sal_True; 2417cdf0e10cSrcweir } 2418cdf0e10cSrcweir 2419cdf0e10cSrcweir // class SvxEscapementItem ----------------------------------------------- 2420cdf0e10cSrcweir 2421cdf0e10cSrcweir SvxEscapementItem::SvxEscapementItem( const sal_uInt16 nId ) : 2422cdf0e10cSrcweir SfxEnumItemInterface( nId ), 2423cdf0e10cSrcweir 2424cdf0e10cSrcweir nEsc ( 0 ), 2425cdf0e10cSrcweir nProp ( 100 ) 2426cdf0e10cSrcweir { 2427cdf0e10cSrcweir } 2428cdf0e10cSrcweir 2429cdf0e10cSrcweir // ----------------------------------------------------------------------- 2430cdf0e10cSrcweir 2431cdf0e10cSrcweir SvxEscapementItem::SvxEscapementItem( const SvxEscapement eEscape, 2432cdf0e10cSrcweir const sal_uInt16 nId ) : 2433cdf0e10cSrcweir SfxEnumItemInterface( nId ), 2434cdf0e10cSrcweir nProp( 100 ) 2435cdf0e10cSrcweir { 2436cdf0e10cSrcweir SetEscapement( eEscape ); 2437cdf0e10cSrcweir if( nEsc ) 2438cdf0e10cSrcweir nProp = 58; 2439cdf0e10cSrcweir } 2440cdf0e10cSrcweir 2441cdf0e10cSrcweir // ----------------------------------------------------------------------- 2442cdf0e10cSrcweir 2443cdf0e10cSrcweir SvxEscapementItem::SvxEscapementItem( const short _nEsc, 2444cdf0e10cSrcweir const sal_uInt8 _nProp, 2445cdf0e10cSrcweir const sal_uInt16 nId ) : 2446cdf0e10cSrcweir SfxEnumItemInterface( nId ), 2447cdf0e10cSrcweir nEsc ( _nEsc ), 2448cdf0e10cSrcweir nProp ( _nProp ) 2449cdf0e10cSrcweir { 2450cdf0e10cSrcweir } 2451cdf0e10cSrcweir 2452cdf0e10cSrcweir // ----------------------------------------------------------------------- 2453cdf0e10cSrcweir 2454cdf0e10cSrcweir int SvxEscapementItem::operator==( const SfxPoolItem& rAttr ) const 2455cdf0e10cSrcweir { 2456cdf0e10cSrcweir DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" ); 2457cdf0e10cSrcweir 2458cdf0e10cSrcweir return( nEsc == ((SvxEscapementItem&)rAttr).nEsc && 2459cdf0e10cSrcweir nProp == ((SvxEscapementItem&)rAttr).nProp ); 2460cdf0e10cSrcweir } 2461cdf0e10cSrcweir 2462cdf0e10cSrcweir // ----------------------------------------------------------------------- 2463cdf0e10cSrcweir 2464cdf0e10cSrcweir SfxPoolItem* SvxEscapementItem::Clone( SfxItemPool * ) const 2465cdf0e10cSrcweir { 2466cdf0e10cSrcweir return new SvxEscapementItem( *this ); 2467cdf0e10cSrcweir } 2468cdf0e10cSrcweir 2469cdf0e10cSrcweir // ----------------------------------------------------------------------- 2470cdf0e10cSrcweir 2471cdf0e10cSrcweir SvStream& SvxEscapementItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const 2472cdf0e10cSrcweir { 2473cdf0e10cSrcweir short _nEsc = GetEsc(); 2474cdf0e10cSrcweir if( SOFFICE_FILEFORMAT_31 == rStrm.GetVersion() ) 2475cdf0e10cSrcweir { 2476cdf0e10cSrcweir if( DFLT_ESC_AUTO_SUPER == _nEsc ) 2477cdf0e10cSrcweir _nEsc = DFLT_ESC_SUPER; 2478cdf0e10cSrcweir else if( DFLT_ESC_AUTO_SUB == _nEsc ) 2479cdf0e10cSrcweir _nEsc = DFLT_ESC_SUB; 2480cdf0e10cSrcweir } 2481cdf0e10cSrcweir rStrm << (sal_uInt8) GetProp() 2482cdf0e10cSrcweir << (short) _nEsc; 2483cdf0e10cSrcweir return rStrm; 2484cdf0e10cSrcweir } 2485cdf0e10cSrcweir 2486cdf0e10cSrcweir // ----------------------------------------------------------------------- 2487cdf0e10cSrcweir 2488cdf0e10cSrcweir SfxPoolItem* SvxEscapementItem::Create(SvStream& rStrm, sal_uInt16) const 2489cdf0e10cSrcweir { 2490cdf0e10cSrcweir sal_uInt8 _nProp; 2491cdf0e10cSrcweir short _nEsc; 2492cdf0e10cSrcweir rStrm >> _nProp >> _nEsc; 2493cdf0e10cSrcweir return new SvxEscapementItem( _nEsc, _nProp, Which() ); 2494cdf0e10cSrcweir } 2495cdf0e10cSrcweir 2496cdf0e10cSrcweir // ----------------------------------------------------------------------- 2497cdf0e10cSrcweir 2498cdf0e10cSrcweir sal_uInt16 SvxEscapementItem::GetValueCount() const 2499cdf0e10cSrcweir { 2500cdf0e10cSrcweir return SVX_ESCAPEMENT_END; // SVX_ESCAPEMENT_SUBSCRIPT + 1 2501cdf0e10cSrcweir } 2502cdf0e10cSrcweir 2503cdf0e10cSrcweir //------------------------------------------------------------------------ 2504cdf0e10cSrcweir 2505cdf0e10cSrcweir SfxItemPresentation SvxEscapementItem::GetPresentation 2506cdf0e10cSrcweir ( 2507cdf0e10cSrcweir SfxItemPresentation ePres, 2508cdf0e10cSrcweir SfxMapUnit /*eCoreUnit*/, 2509cdf0e10cSrcweir SfxMapUnit /*ePresUnit*/, 2510cdf0e10cSrcweir XubString& rText, const IntlWrapper * /*pIntl*/ 2511cdf0e10cSrcweir ) const 2512cdf0e10cSrcweir { 2513cdf0e10cSrcweir switch ( ePres ) 2514cdf0e10cSrcweir { 2515cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NONE: 2516cdf0e10cSrcweir rText.Erase(); 2517cdf0e10cSrcweir return ePres; 2518cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NAMELESS: 2519cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_COMPLETE: 2520cdf0e10cSrcweir { 2521cdf0e10cSrcweir rText = GetValueTextByPos( GetEnumValue() ); 2522cdf0e10cSrcweir 2523cdf0e10cSrcweir if ( nEsc != 0 ) 2524cdf0e10cSrcweir { 2525cdf0e10cSrcweir if( DFLT_ESC_AUTO_SUPER == nEsc || DFLT_ESC_AUTO_SUB == nEsc ) 2526cdf0e10cSrcweir rText += String( EE_RESSTR(RID_SVXITEMS_ESCAPEMENT_AUTO) ); 2527cdf0e10cSrcweir else 2528cdf0e10cSrcweir ( rText += String::CreateFromInt32( nEsc )) += sal_Unicode('%'); 2529cdf0e10cSrcweir } 2530cdf0e10cSrcweir return ePres; 2531cdf0e10cSrcweir } 2532cdf0e10cSrcweir default: ; //prevent warning 2533cdf0e10cSrcweir } 2534cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_NONE; 2535cdf0e10cSrcweir } 2536cdf0e10cSrcweir 2537cdf0e10cSrcweir // ----------------------------------------------------------------------- 2538cdf0e10cSrcweir 2539cdf0e10cSrcweir XubString SvxEscapementItem::GetValueTextByPos( sal_uInt16 nPos ) const 2540cdf0e10cSrcweir { 2541cdf0e10cSrcweir DBG_ASSERT( nPos < (sal_uInt16)SVX_ESCAPEMENT_END, "enum overflow!" ); 2542cdf0e10cSrcweir return EE_RESSTR(RID_SVXITEMS_ESCAPEMENT_BEGIN + nPos); 2543cdf0e10cSrcweir } 2544cdf0e10cSrcweir 2545cdf0e10cSrcweir // ----------------------------------------------------------------------- 2546cdf0e10cSrcweir 2547cdf0e10cSrcweir sal_uInt16 SvxEscapementItem::GetEnumValue() const 2548cdf0e10cSrcweir { 2549cdf0e10cSrcweir if ( nEsc < 0 ) 2550cdf0e10cSrcweir return SVX_ESCAPEMENT_SUBSCRIPT; 2551cdf0e10cSrcweir else if ( nEsc > 0 ) 2552cdf0e10cSrcweir return SVX_ESCAPEMENT_SUPERSCRIPT; 2553cdf0e10cSrcweir return SVX_ESCAPEMENT_OFF; 2554cdf0e10cSrcweir } 2555cdf0e10cSrcweir 2556cdf0e10cSrcweir // ----------------------------------------------------------------------- 2557cdf0e10cSrcweir 2558cdf0e10cSrcweir void SvxEscapementItem::SetEnumValue( sal_uInt16 nVal ) 2559cdf0e10cSrcweir { 2560cdf0e10cSrcweir SetEscapement( (const SvxEscapement)nVal ); 2561cdf0e10cSrcweir } 2562cdf0e10cSrcweir 2563cdf0e10cSrcweir /*-----------------13.03.98 17:05------------------- 2564cdf0e10cSrcweir 2565cdf0e10cSrcweir --------------------------------------------------*/ 2566cdf0e10cSrcweir sal_Bool SvxEscapementItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const 2567cdf0e10cSrcweir { 2568cdf0e10cSrcweir // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); 2569cdf0e10cSrcweir nMemberId &= ~CONVERT_TWIPS; 2570cdf0e10cSrcweir switch(nMemberId) 2571cdf0e10cSrcweir { 2572cdf0e10cSrcweir case MID_ESC: 2573cdf0e10cSrcweir rVal <<= (sal_Int16)(nEsc); 2574cdf0e10cSrcweir break; 2575cdf0e10cSrcweir case MID_ESC_HEIGHT: 2576cdf0e10cSrcweir rVal <<= (sal_Int8)(nProp); 2577cdf0e10cSrcweir break; 2578cdf0e10cSrcweir case MID_AUTO_ESC: 2579cdf0e10cSrcweir rVal = Bool2Any(DFLT_ESC_AUTO_SUB == nEsc || DFLT_ESC_AUTO_SUPER == nEsc); 2580cdf0e10cSrcweir break; 2581cdf0e10cSrcweir } 2582cdf0e10cSrcweir return sal_True; 2583cdf0e10cSrcweir } 2584cdf0e10cSrcweir /*-----------------13.03.98 17:05------------------- 2585cdf0e10cSrcweir 2586cdf0e10cSrcweir --------------------------------------------------*/ 2587cdf0e10cSrcweir sal_Bool SvxEscapementItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) 2588cdf0e10cSrcweir { 2589cdf0e10cSrcweir // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); 2590cdf0e10cSrcweir nMemberId &= ~CONVERT_TWIPS; 2591cdf0e10cSrcweir switch(nMemberId) 2592cdf0e10cSrcweir { 2593cdf0e10cSrcweir case MID_ESC: 2594cdf0e10cSrcweir { 2595cdf0e10cSrcweir sal_Int16 nVal = sal_Int16(); 2596cdf0e10cSrcweir if( (rVal >>= nVal) && (Abs(nVal) <= 101)) 2597cdf0e10cSrcweir nEsc = nVal; 2598cdf0e10cSrcweir else 2599cdf0e10cSrcweir return sal_False; 2600cdf0e10cSrcweir } 2601cdf0e10cSrcweir break; 2602cdf0e10cSrcweir case MID_ESC_HEIGHT: 2603cdf0e10cSrcweir { 2604cdf0e10cSrcweir sal_Int8 nVal = sal_Int8(); 2605cdf0e10cSrcweir if( (rVal >>= nVal) && (nVal <= 100)) 2606cdf0e10cSrcweir nProp = nVal; 2607cdf0e10cSrcweir else 2608cdf0e10cSrcweir return sal_False; 2609cdf0e10cSrcweir } 2610cdf0e10cSrcweir break; 2611cdf0e10cSrcweir case MID_AUTO_ESC: 2612cdf0e10cSrcweir { 2613cdf0e10cSrcweir sal_Bool bVal = Any2Bool(rVal); 2614cdf0e10cSrcweir if(bVal) 2615cdf0e10cSrcweir { 2616cdf0e10cSrcweir if(nEsc < 0) 2617cdf0e10cSrcweir nEsc = DFLT_ESC_AUTO_SUB; 2618cdf0e10cSrcweir else 2619cdf0e10cSrcweir nEsc = DFLT_ESC_AUTO_SUPER; 2620cdf0e10cSrcweir } 2621cdf0e10cSrcweir else 2622cdf0e10cSrcweir if(DFLT_ESC_AUTO_SUPER == nEsc ) 2623cdf0e10cSrcweir --nEsc; 2624cdf0e10cSrcweir else if(DFLT_ESC_AUTO_SUB == nEsc) 2625cdf0e10cSrcweir ++nEsc; 2626cdf0e10cSrcweir } 2627cdf0e10cSrcweir break; 2628cdf0e10cSrcweir } 2629cdf0e10cSrcweir return sal_True; 2630cdf0e10cSrcweir } 2631cdf0e10cSrcweir 2632cdf0e10cSrcweir // class SvxLanguageItem ------------------------------------------------- 2633cdf0e10cSrcweir 2634cdf0e10cSrcweir SvxLanguageItem::SvxLanguageItem( const LanguageType eLang, const sal_uInt16 nId ) 2635cdf0e10cSrcweir : SfxEnumItem( nId , eLang ) 2636cdf0e10cSrcweir { 2637cdf0e10cSrcweir } 2638cdf0e10cSrcweir 2639cdf0e10cSrcweir // ----------------------------------------------------------------------- 2640cdf0e10cSrcweir 2641cdf0e10cSrcweir sal_uInt16 SvxLanguageItem::GetValueCount() const 2642cdf0e10cSrcweir { 2643cdf0e10cSrcweir // #i50205# got rid of class International 2644cdf0e10cSrcweir DBG_ERRORFILE("SvxLanguageItem::GetValueCount: supposed to return a count of what?"); 2645cdf0e10cSrcweir // FIXME: previously returned LANGUAGE_COUNT from tools/intn.hxx which was wrong anyway. 2646cdf0e10cSrcweir // Could be SvtLanguageTable::GetEntryCount() (all locales with resource string)? 2647cdf0e10cSrcweir // Could be LocaleDataWrapper::getInstalledLanguageTypes() (all locales with locale data)? 2648cdf0e10cSrcweir return 0; 2649cdf0e10cSrcweir } 2650cdf0e10cSrcweir 2651cdf0e10cSrcweir // ----------------------------------------------------------------------- 2652cdf0e10cSrcweir 2653cdf0e10cSrcweir SfxPoolItem* SvxLanguageItem::Clone( SfxItemPool * ) const 2654cdf0e10cSrcweir { 2655cdf0e10cSrcweir return new SvxLanguageItem( *this ); 2656cdf0e10cSrcweir } 2657cdf0e10cSrcweir 2658cdf0e10cSrcweir // ----------------------------------------------------------------------- 2659cdf0e10cSrcweir 2660cdf0e10cSrcweir SvStream& SvxLanguageItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const 2661cdf0e10cSrcweir { 2662cdf0e10cSrcweir rStrm << (sal_uInt16) GetValue(); 2663cdf0e10cSrcweir return rStrm; 2664cdf0e10cSrcweir } 2665cdf0e10cSrcweir 2666cdf0e10cSrcweir // ----------------------------------------------------------------------- 2667cdf0e10cSrcweir 2668cdf0e10cSrcweir SfxPoolItem* SvxLanguageItem::Create(SvStream& rStrm, sal_uInt16) const 2669cdf0e10cSrcweir { 2670cdf0e10cSrcweir sal_uInt16 nValue; 2671cdf0e10cSrcweir rStrm >> nValue; 2672cdf0e10cSrcweir return new SvxLanguageItem( (LanguageType)nValue, Which() ); 2673cdf0e10cSrcweir } 2674cdf0e10cSrcweir 2675cdf0e10cSrcweir //------------------------------------------------------------------------ 2676cdf0e10cSrcweir 2677cdf0e10cSrcweir SfxItemPresentation SvxLanguageItem::GetPresentation 2678cdf0e10cSrcweir ( 2679cdf0e10cSrcweir SfxItemPresentation ePres, 2680cdf0e10cSrcweir SfxMapUnit /*eCoreUnit*/, 2681cdf0e10cSrcweir SfxMapUnit /*ePresUnit*/, 2682cdf0e10cSrcweir XubString& rText, const IntlWrapper * /*pIntl*/ 2683cdf0e10cSrcweir ) const 2684cdf0e10cSrcweir { 2685cdf0e10cSrcweir #ifndef SVX_LIGHT 2686cdf0e10cSrcweir switch ( ePres ) 2687cdf0e10cSrcweir { 2688cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NONE: 2689cdf0e10cSrcweir rText.Erase(); 2690cdf0e10cSrcweir return ePres; 2691cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NAMELESS: 2692cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_COMPLETE: 2693cdf0e10cSrcweir { 2694cdf0e10cSrcweir SvtLanguageTable aLangTable; 2695cdf0e10cSrcweir rText = aLangTable.GetString( (LanguageType)GetValue() ); 2696cdf0e10cSrcweir return ePres; 2697cdf0e10cSrcweir } 2698cdf0e10cSrcweir default: ; //prevent warning 2699cdf0e10cSrcweir } 2700cdf0e10cSrcweir #endif // !SVX_LIGHT 2701cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_NONE; 2702cdf0e10cSrcweir } 2703cdf0e10cSrcweir 2704cdf0e10cSrcweir /*-----------------14.03.98 14:13------------------- 2705cdf0e10cSrcweir 2706cdf0e10cSrcweir --------------------------------------------------*/ 2707cdf0e10cSrcweir sal_Bool SvxLanguageItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const 2708cdf0e10cSrcweir { 2709cdf0e10cSrcweir // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); 2710cdf0e10cSrcweir nMemberId &= ~CONVERT_TWIPS; 2711cdf0e10cSrcweir switch(nMemberId) 2712cdf0e10cSrcweir { 2713cdf0e10cSrcweir case MID_LANG_INT: // for basic conversions! 2714cdf0e10cSrcweir rVal <<= (sal_Int16)(GetValue()); 2715cdf0e10cSrcweir break; 2716cdf0e10cSrcweir case MID_LANG_LOCALE: 2717cdf0e10cSrcweir lang::Locale aRet( MsLangId::convertLanguageToLocale( GetValue(), false)); 2718cdf0e10cSrcweir rVal <<= aRet; 2719cdf0e10cSrcweir break; 2720cdf0e10cSrcweir } 2721cdf0e10cSrcweir return sal_True; 2722cdf0e10cSrcweir } 2723cdf0e10cSrcweir /*-----------------14.03.98 14:13------------------- 2724cdf0e10cSrcweir 2725cdf0e10cSrcweir --------------------------------------------------*/ 2726cdf0e10cSrcweir sal_Bool SvxLanguageItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) 2727cdf0e10cSrcweir { 2728cdf0e10cSrcweir // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); 2729cdf0e10cSrcweir nMemberId &= ~CONVERT_TWIPS; 2730cdf0e10cSrcweir switch(nMemberId) 2731cdf0e10cSrcweir { 2732cdf0e10cSrcweir case MID_LANG_INT: // for basic conversions! 2733cdf0e10cSrcweir { 2734cdf0e10cSrcweir sal_Int32 nValue = 0; 2735cdf0e10cSrcweir if(!(rVal >>= nValue)) 2736cdf0e10cSrcweir return sal_False; 2737cdf0e10cSrcweir 2738cdf0e10cSrcweir SetValue((sal_Int16)nValue); 2739cdf0e10cSrcweir } 2740cdf0e10cSrcweir break; 2741cdf0e10cSrcweir case MID_LANG_LOCALE: 2742cdf0e10cSrcweir { 2743cdf0e10cSrcweir lang::Locale aLocale; 2744cdf0e10cSrcweir if(!(rVal >>= aLocale)) 2745cdf0e10cSrcweir return sal_False; 2746cdf0e10cSrcweir 2747cdf0e10cSrcweir if (aLocale.Language.getLength() || aLocale.Country.getLength()) 2748cdf0e10cSrcweir SetValue(MsLangId::convertLocaleToLanguage( aLocale )); 2749cdf0e10cSrcweir else 2750cdf0e10cSrcweir SetValue(LANGUAGE_NONE); 2751cdf0e10cSrcweir } 2752cdf0e10cSrcweir break; 2753cdf0e10cSrcweir } 2754cdf0e10cSrcweir return sal_True; 2755cdf0e10cSrcweir } 2756cdf0e10cSrcweir 2757cdf0e10cSrcweir // class SvxNoLinebreakItem ---------------------------------------------- 2758cdf0e10cSrcweir SvxNoLinebreakItem::SvxNoLinebreakItem( const sal_Bool bBreak, const sal_uInt16 nId ) : 2759cdf0e10cSrcweir SfxBoolItem( nId, bBreak ) 2760cdf0e10cSrcweir { 2761cdf0e10cSrcweir } 2762cdf0e10cSrcweir 2763cdf0e10cSrcweir // ----------------------------------------------------------------------- 2764cdf0e10cSrcweir 2765cdf0e10cSrcweir SfxPoolItem* SvxNoLinebreakItem::Clone( SfxItemPool* ) const 2766cdf0e10cSrcweir { 2767cdf0e10cSrcweir return new SvxNoLinebreakItem( *this ); 2768cdf0e10cSrcweir } 2769cdf0e10cSrcweir 2770cdf0e10cSrcweir // ----------------------------------------------------------------------- 2771cdf0e10cSrcweir 2772cdf0e10cSrcweir SvStream& SvxNoLinebreakItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const 2773cdf0e10cSrcweir { 2774cdf0e10cSrcweir rStrm << (sal_Bool)GetValue(); 2775cdf0e10cSrcweir return rStrm; 2776cdf0e10cSrcweir } 2777cdf0e10cSrcweir 2778cdf0e10cSrcweir // ----------------------------------------------------------------------- 2779cdf0e10cSrcweir 2780cdf0e10cSrcweir SfxPoolItem* SvxNoLinebreakItem::Create(SvStream& rStrm, sal_uInt16) const 2781cdf0e10cSrcweir { 2782cdf0e10cSrcweir sal_Bool bValue; 2783cdf0e10cSrcweir rStrm >> bValue; 2784cdf0e10cSrcweir return new SvxNoLinebreakItem( bValue, Which() ); 2785cdf0e10cSrcweir } 2786cdf0e10cSrcweir 2787cdf0e10cSrcweir //------------------------------------------------------------------------ 2788cdf0e10cSrcweir 2789cdf0e10cSrcweir SfxItemPresentation SvxNoLinebreakItem::GetPresentation 2790cdf0e10cSrcweir ( 2791cdf0e10cSrcweir SfxItemPresentation /*ePres*/, 2792cdf0e10cSrcweir SfxMapUnit /*eCoreUnit*/, 2793cdf0e10cSrcweir SfxMapUnit /*ePresUnit*/, 2794cdf0e10cSrcweir XubString& rText, const IntlWrapper * /*pIntl*/ 2795cdf0e10cSrcweir ) const 2796cdf0e10cSrcweir { 2797cdf0e10cSrcweir rText.Erase(); 2798cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_NONE; 2799cdf0e10cSrcweir } 2800cdf0e10cSrcweir 2801cdf0e10cSrcweir // class SvxNoHyphenItem ------------------------------------------------- 2802cdf0e10cSrcweir 2803cdf0e10cSrcweir SvxNoHyphenItem::SvxNoHyphenItem( const sal_Bool bHyphen, const sal_uInt16 nId ) : 2804cdf0e10cSrcweir SfxBoolItem( nId , bHyphen ) 2805cdf0e10cSrcweir { 2806cdf0e10cSrcweir } 2807cdf0e10cSrcweir 2808cdf0e10cSrcweir // ----------------------------------------------------------------------- 2809cdf0e10cSrcweir 2810cdf0e10cSrcweir SfxPoolItem* SvxNoHyphenItem::Clone( SfxItemPool* ) const 2811cdf0e10cSrcweir { 2812cdf0e10cSrcweir return new SvxNoHyphenItem( *this ); 2813cdf0e10cSrcweir } 2814cdf0e10cSrcweir 2815cdf0e10cSrcweir // ----------------------------------------------------------------------- 2816cdf0e10cSrcweir 2817cdf0e10cSrcweir SvStream& SvxNoHyphenItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const 2818cdf0e10cSrcweir { 2819cdf0e10cSrcweir rStrm << (sal_Bool) GetValue(); 2820cdf0e10cSrcweir return rStrm; 2821cdf0e10cSrcweir } 2822cdf0e10cSrcweir 2823cdf0e10cSrcweir // ----------------------------------------------------------------------- 2824cdf0e10cSrcweir 2825cdf0e10cSrcweir SfxPoolItem* SvxNoHyphenItem::Create( SvStream& rStrm, sal_uInt16 ) const 2826cdf0e10cSrcweir { 2827cdf0e10cSrcweir sal_Bool bValue; 2828cdf0e10cSrcweir rStrm >> bValue; 2829cdf0e10cSrcweir return new SvxNoHyphenItem( bValue, Which() ); 2830cdf0e10cSrcweir } 2831cdf0e10cSrcweir 2832cdf0e10cSrcweir //------------------------------------------------------------------------ 2833cdf0e10cSrcweir 2834cdf0e10cSrcweir SfxItemPresentation SvxNoHyphenItem::GetPresentation 2835cdf0e10cSrcweir ( 2836cdf0e10cSrcweir SfxItemPresentation /*ePres*/, 2837cdf0e10cSrcweir SfxMapUnit /*eCoreUnit*/, 2838cdf0e10cSrcweir SfxMapUnit /*ePresUnit*/, 2839cdf0e10cSrcweir XubString& rText, const IntlWrapper * /*pIntl*/ 2840cdf0e10cSrcweir ) const 2841cdf0e10cSrcweir { 2842cdf0e10cSrcweir rText.Erase(); 2843cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_NONE; 2844cdf0e10cSrcweir } 2845cdf0e10cSrcweir 2846cdf0e10cSrcweir /* 2847cdf0e10cSrcweir * Dummy-Item fuer ToolBox-Controls: 2848cdf0e10cSrcweir * 2849cdf0e10cSrcweir */ 2850cdf0e10cSrcweir 2851cdf0e10cSrcweir // ----------------------------------------------------------------------- 2852cdf0e10cSrcweir // class SvxLineColorItem (== SvxColorItem) 2853cdf0e10cSrcweir // ----------------------------------------------------------------------- 2854cdf0e10cSrcweir 2855cdf0e10cSrcweir SvxLineColorItem::SvxLineColorItem( const sal_uInt16 nId ) : 2856cdf0e10cSrcweir SvxColorItem( nId ) 2857cdf0e10cSrcweir { 2858cdf0e10cSrcweir } 2859cdf0e10cSrcweir 2860cdf0e10cSrcweir // ----------------------------------------------------------------------- 2861cdf0e10cSrcweir 2862cdf0e10cSrcweir SvxLineColorItem::SvxLineColorItem( const Color& rCol, const sal_uInt16 nId ) : 2863cdf0e10cSrcweir SvxColorItem( rCol, nId ) 2864cdf0e10cSrcweir { 2865cdf0e10cSrcweir } 2866cdf0e10cSrcweir 2867cdf0e10cSrcweir // ----------------------------------------------------------------------- 2868cdf0e10cSrcweir 2869cdf0e10cSrcweir SvxLineColorItem::SvxLineColorItem( SvStream &rStrm, const sal_uInt16 nId ) : 2870cdf0e10cSrcweir SvxColorItem( rStrm, nId ) 2871cdf0e10cSrcweir { 2872cdf0e10cSrcweir } 2873cdf0e10cSrcweir 2874cdf0e10cSrcweir // ----------------------------------------------------------------------- 2875cdf0e10cSrcweir 2876cdf0e10cSrcweir SvxLineColorItem::SvxLineColorItem( const SvxLineColorItem &rCopy ) : 2877cdf0e10cSrcweir SvxColorItem( rCopy ) 2878cdf0e10cSrcweir { 2879cdf0e10cSrcweir } 2880cdf0e10cSrcweir 2881cdf0e10cSrcweir // ----------------------------------------------------------------------- 2882cdf0e10cSrcweir 2883cdf0e10cSrcweir SvxLineColorItem::~SvxLineColorItem() 2884cdf0e10cSrcweir { 2885cdf0e10cSrcweir } 2886cdf0e10cSrcweir 2887cdf0e10cSrcweir //------------------------------------------------------------------------ 2888cdf0e10cSrcweir 2889cdf0e10cSrcweir SfxItemPresentation SvxLineColorItem::GetPresentation 2890cdf0e10cSrcweir ( 2891cdf0e10cSrcweir SfxItemPresentation ePres, 2892cdf0e10cSrcweir SfxMapUnit eCoreUnit, 2893cdf0e10cSrcweir SfxMapUnit ePresUnit, 2894cdf0e10cSrcweir XubString& rText, 2895cdf0e10cSrcweir const IntlWrapper * pIntlWrapper 2896cdf0e10cSrcweir ) const 2897cdf0e10cSrcweir { 2898cdf0e10cSrcweir return SvxColorItem::GetPresentation( ePres, eCoreUnit, ePresUnit, 2899cdf0e10cSrcweir rText, pIntlWrapper ); 2900cdf0e10cSrcweir } 2901cdf0e10cSrcweir 2902cdf0e10cSrcweir // class SvxBlinkItem ------------------------------------------------- 2903cdf0e10cSrcweir 2904cdf0e10cSrcweir 2905cdf0e10cSrcweir SvxBlinkItem::SvxBlinkItem( const sal_Bool bBlink, const sal_uInt16 nId ) : 2906cdf0e10cSrcweir SfxBoolItem( nId, bBlink ) 2907cdf0e10cSrcweir { 2908cdf0e10cSrcweir } 2909cdf0e10cSrcweir 2910cdf0e10cSrcweir // ----------------------------------------------------------------------- 2911cdf0e10cSrcweir 2912cdf0e10cSrcweir SfxPoolItem* SvxBlinkItem::Clone( SfxItemPool * ) const 2913cdf0e10cSrcweir { 2914cdf0e10cSrcweir return new SvxBlinkItem( *this ); 2915cdf0e10cSrcweir } 2916cdf0e10cSrcweir 2917cdf0e10cSrcweir // ----------------------------------------------------------------------- 2918cdf0e10cSrcweir 2919cdf0e10cSrcweir SvStream& SvxBlinkItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const 2920cdf0e10cSrcweir { 2921cdf0e10cSrcweir rStrm << (sal_uInt8) GetValue(); 2922cdf0e10cSrcweir return rStrm; 2923cdf0e10cSrcweir } 2924cdf0e10cSrcweir 2925cdf0e10cSrcweir // ----------------------------------------------------------------------- 2926cdf0e10cSrcweir 2927cdf0e10cSrcweir SfxPoolItem* SvxBlinkItem::Create(SvStream& rStrm, sal_uInt16) const 2928cdf0e10cSrcweir { 2929cdf0e10cSrcweir sal_uInt8 nState; 2930cdf0e10cSrcweir rStrm >> nState; 2931cdf0e10cSrcweir return new SvxBlinkItem( nState, Which() ); 2932cdf0e10cSrcweir } 2933cdf0e10cSrcweir 2934cdf0e10cSrcweir // ----------------------------------------------------------------------- 2935cdf0e10cSrcweir 2936cdf0e10cSrcweir SfxItemPresentation SvxBlinkItem::GetPresentation 2937cdf0e10cSrcweir ( 2938cdf0e10cSrcweir SfxItemPresentation ePres, 2939cdf0e10cSrcweir SfxMapUnit /*eCoreUnit*/, 2940cdf0e10cSrcweir SfxMapUnit /*ePresUnit*/, 2941cdf0e10cSrcweir XubString& rText, const IntlWrapper * /*pIntl*/ 2942cdf0e10cSrcweir ) const 2943cdf0e10cSrcweir { 2944cdf0e10cSrcweir switch ( ePres ) 2945cdf0e10cSrcweir { 2946cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NONE: 2947cdf0e10cSrcweir rText.Erase(); 2948cdf0e10cSrcweir return ePres; 2949cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NAMELESS: 2950cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_COMPLETE: 2951cdf0e10cSrcweir { 2952cdf0e10cSrcweir sal_uInt16 nId = RID_SVXITEMS_BLINK_FALSE; 2953cdf0e10cSrcweir 2954cdf0e10cSrcweir if ( GetValue() ) 2955cdf0e10cSrcweir nId = RID_SVXITEMS_BLINK_TRUE; 2956cdf0e10cSrcweir rText = EE_RESSTR(nId); 2957cdf0e10cSrcweir return ePres; 2958cdf0e10cSrcweir } 2959cdf0e10cSrcweir default: ; //prevent warning 2960cdf0e10cSrcweir } 2961cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_NONE; 2962cdf0e10cSrcweir } 2963cdf0e10cSrcweir 2964cdf0e10cSrcweir // class SvxEmphaisMarkItem --------------------------------------------------- 2965cdf0e10cSrcweir 2966cdf0e10cSrcweir SvxEmphasisMarkItem::SvxEmphasisMarkItem( const FontEmphasisMark nValue, 2967cdf0e10cSrcweir const sal_uInt16 nId ) 2968cdf0e10cSrcweir : SfxUInt16Item( nId, nValue ) 2969cdf0e10cSrcweir { 2970cdf0e10cSrcweir } 2971cdf0e10cSrcweir 2972cdf0e10cSrcweir // ----------------------------------------------------------------------- 2973cdf0e10cSrcweir 2974cdf0e10cSrcweir SfxPoolItem* SvxEmphasisMarkItem::Clone( SfxItemPool * ) const 2975cdf0e10cSrcweir { 2976cdf0e10cSrcweir return new SvxEmphasisMarkItem( *this ); 2977cdf0e10cSrcweir } 2978cdf0e10cSrcweir 2979cdf0e10cSrcweir // ----------------------------------------------------------------------- 2980cdf0e10cSrcweir 2981cdf0e10cSrcweir SvStream& SvxEmphasisMarkItem::Store( SvStream& rStrm, 2982cdf0e10cSrcweir sal_uInt16 /*nItemVersion*/ ) const 2983cdf0e10cSrcweir { 2984cdf0e10cSrcweir rStrm << (sal_uInt16)GetValue(); 2985cdf0e10cSrcweir return rStrm; 2986cdf0e10cSrcweir } 2987cdf0e10cSrcweir 2988cdf0e10cSrcweir // ----------------------------------------------------------------------- 2989cdf0e10cSrcweir 2990cdf0e10cSrcweir SfxPoolItem* SvxEmphasisMarkItem::Create( SvStream& rStrm, sal_uInt16 ) const 2991cdf0e10cSrcweir { 2992cdf0e10cSrcweir sal_uInt16 nValue; 2993cdf0e10cSrcweir rStrm >> nValue; 2994cdf0e10cSrcweir return new SvxEmphasisMarkItem( (FontEmphasisMark)nValue, Which() ); 2995cdf0e10cSrcweir } 2996cdf0e10cSrcweir 2997cdf0e10cSrcweir //------------------------------------------------------------------------ 2998cdf0e10cSrcweir 2999cdf0e10cSrcweir SfxItemPresentation SvxEmphasisMarkItem::GetPresentation 3000cdf0e10cSrcweir ( 3001cdf0e10cSrcweir SfxItemPresentation ePres, 3002cdf0e10cSrcweir SfxMapUnit /*eCoreUnit*/, 3003cdf0e10cSrcweir SfxMapUnit /*ePresUnit*/, 3004cdf0e10cSrcweir XubString& rText, 3005cdf0e10cSrcweir const IntlWrapper * /*pIntl*/ 3006cdf0e10cSrcweir ) const 3007cdf0e10cSrcweir { 3008cdf0e10cSrcweir switch ( ePres ) 3009cdf0e10cSrcweir { 3010cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NONE: 3011cdf0e10cSrcweir rText.Erase(); 3012cdf0e10cSrcweir return ePres; 3013cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NAMELESS: 3014cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_COMPLETE: 3015cdf0e10cSrcweir { 3016cdf0e10cSrcweir sal_uInt16 nVal = GetValue(); 3017cdf0e10cSrcweir rText = EE_RESSTR( RID_SVXITEMS_EMPHASIS_BEGIN_STYLE + 3018cdf0e10cSrcweir ( EMPHASISMARK_STYLE & nVal )); 3019cdf0e10cSrcweir sal_uInt16 nId = ( EMPHASISMARK_POS_ABOVE & nVal ) 3020cdf0e10cSrcweir ? RID_SVXITEMS_EMPHASIS_ABOVE_POS 3021cdf0e10cSrcweir : ( EMPHASISMARK_POS_BELOW & nVal ) 3022cdf0e10cSrcweir ? RID_SVXITEMS_EMPHASIS_BELOW_POS 3023cdf0e10cSrcweir : 0; 3024cdf0e10cSrcweir if( nId ) 3025cdf0e10cSrcweir rText += EE_RESSTR( nId ); 3026cdf0e10cSrcweir return ePres; 3027cdf0e10cSrcweir } 3028cdf0e10cSrcweir default: ; //prevent warning 3029cdf0e10cSrcweir } 3030cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_NONE; 3031cdf0e10cSrcweir } 3032cdf0e10cSrcweir 3033cdf0e10cSrcweir // ----------------------------------------------------------------------- 3034cdf0e10cSrcweir 3035cdf0e10cSrcweir sal_Bool SvxEmphasisMarkItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const 3036cdf0e10cSrcweir { 3037cdf0e10cSrcweir // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); 3038cdf0e10cSrcweir nMemberId &= ~CONVERT_TWIPS; 3039cdf0e10cSrcweir switch( nMemberId ) 3040cdf0e10cSrcweir { 3041cdf0e10cSrcweir case MID_EMPHASIS: 3042cdf0e10cSrcweir { 3043cdf0e10cSrcweir sal_Int16 nValue = GetValue(); 3044cdf0e10cSrcweir sal_Int16 nRet = 0; 3045cdf0e10cSrcweir switch(nValue & EMPHASISMARK_STYLE) 3046cdf0e10cSrcweir { 3047cdf0e10cSrcweir case EMPHASISMARK_NONE : nRet = FontEmphasis::NONE; break; 3048cdf0e10cSrcweir case EMPHASISMARK_DOT : nRet = FontEmphasis::DOT_ABOVE; break; 3049cdf0e10cSrcweir case EMPHASISMARK_CIRCLE : nRet = FontEmphasis::CIRCLE_ABOVE; break; 3050cdf0e10cSrcweir case EMPHASISMARK_DISC : nRet = FontEmphasis::DISK_ABOVE; break; 3051cdf0e10cSrcweir case EMPHASISMARK_ACCENT : nRet = FontEmphasis::ACCENT_ABOVE; break; 3052cdf0e10cSrcweir } 3053cdf0e10cSrcweir if(nRet && nValue & EMPHASISMARK_POS_BELOW) 3054cdf0e10cSrcweir nRet += 10; 3055cdf0e10cSrcweir rVal <<= nRet; 3056cdf0e10cSrcweir } 3057cdf0e10cSrcweir break; 3058cdf0e10cSrcweir } 3059cdf0e10cSrcweir return sal_True; 3060cdf0e10cSrcweir } 3061cdf0e10cSrcweir 3062cdf0e10cSrcweir sal_Bool SvxEmphasisMarkItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) 3063cdf0e10cSrcweir { 3064cdf0e10cSrcweir // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); 3065cdf0e10cSrcweir nMemberId &= ~CONVERT_TWIPS; 3066cdf0e10cSrcweir sal_Bool bRet = sal_True; 3067cdf0e10cSrcweir switch( nMemberId ) 3068cdf0e10cSrcweir { 3069cdf0e10cSrcweir case MID_EMPHASIS: 3070cdf0e10cSrcweir { 3071cdf0e10cSrcweir sal_Int32 nValue = -1; 3072cdf0e10cSrcweir rVal >>= nValue; 3073cdf0e10cSrcweir switch(nValue) 3074cdf0e10cSrcweir { 3075cdf0e10cSrcweir case FontEmphasis::NONE : nValue = EMPHASISMARK_NONE; break; 3076cdf0e10cSrcweir case FontEmphasis::DOT_ABOVE : nValue = EMPHASISMARK_DOT|EMPHASISMARK_POS_ABOVE; break; 3077cdf0e10cSrcweir case FontEmphasis::CIRCLE_ABOVE: nValue = EMPHASISMARK_CIRCLE|EMPHASISMARK_POS_ABOVE; break; 3078cdf0e10cSrcweir case FontEmphasis::DISK_ABOVE : nValue = EMPHASISMARK_DISC|EMPHASISMARK_POS_ABOVE; break; 3079cdf0e10cSrcweir case FontEmphasis::ACCENT_ABOVE: nValue = EMPHASISMARK_ACCENT|EMPHASISMARK_POS_ABOVE; break; 3080cdf0e10cSrcweir case FontEmphasis::DOT_BELOW : nValue = EMPHASISMARK_DOT|EMPHASISMARK_POS_BELOW; break; 3081cdf0e10cSrcweir case FontEmphasis::CIRCLE_BELOW: nValue = EMPHASISMARK_CIRCLE|EMPHASISMARK_POS_BELOW; break; 3082cdf0e10cSrcweir case FontEmphasis::DISK_BELOW : nValue = EMPHASISMARK_DISC|EMPHASISMARK_POS_BELOW; break; 3083cdf0e10cSrcweir case FontEmphasis::ACCENT_BELOW: nValue = EMPHASISMARK_ACCENT|EMPHASISMARK_POS_BELOW; break; 3084cdf0e10cSrcweir default: return sal_False; 3085cdf0e10cSrcweir } 3086cdf0e10cSrcweir SetValue( (sal_Int16)nValue ); 3087cdf0e10cSrcweir } 3088cdf0e10cSrcweir break; 3089cdf0e10cSrcweir } 3090cdf0e10cSrcweir return bRet; 3091cdf0e10cSrcweir } 3092cdf0e10cSrcweir 3093cdf0e10cSrcweir sal_uInt16 SvxEmphasisMarkItem::GetVersion( sal_uInt16 nFFVer ) const 3094cdf0e10cSrcweir { 3095cdf0e10cSrcweir DBG_ASSERT( SOFFICE_FILEFORMAT_31==nFFVer || 3096cdf0e10cSrcweir SOFFICE_FILEFORMAT_40==nFFVer || 3097cdf0e10cSrcweir SOFFICE_FILEFORMAT_50==nFFVer, 3098cdf0e10cSrcweir "SvxEmphasisMarkItem: Gibt es ein neues Fileformat?" ); 3099cdf0e10cSrcweir 3100cdf0e10cSrcweir return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0; 3101cdf0e10cSrcweir } 3102cdf0e10cSrcweir 3103cdf0e10cSrcweir 3104cdf0e10cSrcweir /************************************************************************* 3105cdf0e10cSrcweir |* class SvxTwoLinesItem 3106cdf0e10cSrcweir *************************************************************************/ 3107cdf0e10cSrcweir 3108cdf0e10cSrcweir SvxTwoLinesItem::SvxTwoLinesItem( sal_Bool bFlag, sal_Unicode nStartBracket, 3109cdf0e10cSrcweir sal_Unicode nEndBracket, sal_uInt16 nW ) 3110cdf0e10cSrcweir : SfxPoolItem( nW ), 3111cdf0e10cSrcweir cStartBracket( nStartBracket ), cEndBracket( nEndBracket ), bOn( bFlag ) 3112cdf0e10cSrcweir { 3113cdf0e10cSrcweir } 3114cdf0e10cSrcweir 3115cdf0e10cSrcweir SvxTwoLinesItem::SvxTwoLinesItem( const SvxTwoLinesItem& rAttr ) 3116cdf0e10cSrcweir : SfxPoolItem( rAttr.Which() ), 3117cdf0e10cSrcweir cStartBracket( rAttr.cStartBracket ), 3118cdf0e10cSrcweir cEndBracket( rAttr.cEndBracket ), 3119cdf0e10cSrcweir bOn( rAttr.bOn ) 3120cdf0e10cSrcweir { 3121cdf0e10cSrcweir } 3122cdf0e10cSrcweir 3123cdf0e10cSrcweir SvxTwoLinesItem::~SvxTwoLinesItem() 3124cdf0e10cSrcweir { 3125cdf0e10cSrcweir } 3126cdf0e10cSrcweir 3127cdf0e10cSrcweir int SvxTwoLinesItem::operator==( const SfxPoolItem& rAttr ) const 3128cdf0e10cSrcweir { 3129cdf0e10cSrcweir DBG_ASSERT( SfxPoolItem::operator==( rAttr ), "not equal attribute types" ); 3130cdf0e10cSrcweir return bOn == ((SvxTwoLinesItem&)rAttr).bOn && 3131cdf0e10cSrcweir cStartBracket == ((SvxTwoLinesItem&)rAttr).cStartBracket && 3132cdf0e10cSrcweir cEndBracket == ((SvxTwoLinesItem&)rAttr).cEndBracket; 3133cdf0e10cSrcweir } 3134cdf0e10cSrcweir 3135cdf0e10cSrcweir SfxPoolItem* SvxTwoLinesItem::Clone( SfxItemPool* ) const 3136cdf0e10cSrcweir { 3137cdf0e10cSrcweir return new SvxTwoLinesItem( *this ); 3138cdf0e10cSrcweir } 3139cdf0e10cSrcweir 3140cdf0e10cSrcweir sal_Bool SvxTwoLinesItem::QueryValue( com::sun::star::uno::Any& rVal, 3141cdf0e10cSrcweir sal_uInt8 nMemberId ) const 3142cdf0e10cSrcweir { 3143cdf0e10cSrcweir // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); 3144cdf0e10cSrcweir nMemberId &= ~CONVERT_TWIPS; 3145cdf0e10cSrcweir sal_Bool bRet = sal_True; 3146cdf0e10cSrcweir switch( nMemberId ) 3147cdf0e10cSrcweir { 3148cdf0e10cSrcweir case MID_TWOLINES: 3149cdf0e10cSrcweir rVal = Bool2Any( bOn ); 3150cdf0e10cSrcweir break; 3151cdf0e10cSrcweir case MID_START_BRACKET: 3152cdf0e10cSrcweir { 3153cdf0e10cSrcweir OUString s; 3154cdf0e10cSrcweir if( cStartBracket ) 3155cdf0e10cSrcweir s = OUString( cStartBracket ); 3156cdf0e10cSrcweir rVal <<= s; 3157cdf0e10cSrcweir } 3158cdf0e10cSrcweir break; 3159cdf0e10cSrcweir case MID_END_BRACKET: 3160cdf0e10cSrcweir { 3161cdf0e10cSrcweir OUString s; 3162cdf0e10cSrcweir if( cEndBracket ) 3163cdf0e10cSrcweir s = OUString( cEndBracket ); 3164cdf0e10cSrcweir rVal <<= s; 3165cdf0e10cSrcweir } 3166cdf0e10cSrcweir break; 3167cdf0e10cSrcweir default: 3168cdf0e10cSrcweir bRet = sal_False; 3169cdf0e10cSrcweir break; 3170cdf0e10cSrcweir } 3171cdf0e10cSrcweir return bRet; 3172cdf0e10cSrcweir } 3173cdf0e10cSrcweir 3174cdf0e10cSrcweir sal_Bool SvxTwoLinesItem::PutValue( const com::sun::star::uno::Any& rVal, 3175cdf0e10cSrcweir sal_uInt8 nMemberId ) 3176cdf0e10cSrcweir { 3177cdf0e10cSrcweir // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); 3178cdf0e10cSrcweir nMemberId &= ~CONVERT_TWIPS; 3179cdf0e10cSrcweir sal_Bool bRet = sal_False; 3180cdf0e10cSrcweir OUString s; 3181cdf0e10cSrcweir switch( nMemberId ) 3182cdf0e10cSrcweir { 3183cdf0e10cSrcweir case MID_TWOLINES: 3184cdf0e10cSrcweir bOn = Any2Bool( rVal ); 3185cdf0e10cSrcweir bRet = sal_True; 3186cdf0e10cSrcweir break; 3187cdf0e10cSrcweir case MID_START_BRACKET: 3188cdf0e10cSrcweir if( rVal >>= s ) 3189cdf0e10cSrcweir { 3190cdf0e10cSrcweir cStartBracket = s.getLength() ? s[ 0 ] : 0; 3191cdf0e10cSrcweir bRet = sal_True; 3192cdf0e10cSrcweir } 3193cdf0e10cSrcweir break; 3194cdf0e10cSrcweir case MID_END_BRACKET: 3195cdf0e10cSrcweir if( rVal >>= s ) 3196cdf0e10cSrcweir { 3197cdf0e10cSrcweir cEndBracket = s.getLength() ? s[ 0 ] : 0; 3198cdf0e10cSrcweir bRet = sal_True; 3199cdf0e10cSrcweir } 3200cdf0e10cSrcweir break; 3201cdf0e10cSrcweir } 3202cdf0e10cSrcweir return bRet; 3203cdf0e10cSrcweir } 3204cdf0e10cSrcweir 3205cdf0e10cSrcweir SfxItemPresentation SvxTwoLinesItem::GetPresentation( SfxItemPresentation ePres, 3206cdf0e10cSrcweir SfxMapUnit /*eCoreMetric*/, SfxMapUnit /*ePresMetric*/, 3207cdf0e10cSrcweir String &rText, const IntlWrapper* /*pIntl*/ ) const 3208cdf0e10cSrcweir { 3209cdf0e10cSrcweir switch( ePres ) 3210cdf0e10cSrcweir { 3211cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NONE: 3212cdf0e10cSrcweir rText.Erase(); 3213cdf0e10cSrcweir break; 3214cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NAMELESS: 3215cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_COMPLETE: 3216cdf0e10cSrcweir { 3217cdf0e10cSrcweir if( !GetValue() ) 3218cdf0e10cSrcweir rText = EE_RESSTR( RID_SVXITEMS_TWOLINES_OFF ); 3219cdf0e10cSrcweir else 3220cdf0e10cSrcweir { 3221cdf0e10cSrcweir rText = EE_RESSTR( RID_SVXITEMS_TWOLINES ); 3222cdf0e10cSrcweir if( GetStartBracket() ) 3223cdf0e10cSrcweir rText.Insert( GetStartBracket(), 0 ); 3224cdf0e10cSrcweir if( GetEndBracket() ) 3225cdf0e10cSrcweir rText += GetEndBracket(); 3226cdf0e10cSrcweir } 3227cdf0e10cSrcweir return ePres; 3228cdf0e10cSrcweir } 3229cdf0e10cSrcweir default: ; //prevent warning 3230cdf0e10cSrcweir } 3231cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_NONE; 3232cdf0e10cSrcweir } 3233cdf0e10cSrcweir 3234cdf0e10cSrcweir 3235cdf0e10cSrcweir SfxPoolItem* SvxTwoLinesItem::Create( SvStream & rStrm, sal_uInt16 /*nVer*/) const 3236cdf0e10cSrcweir { 3237cdf0e10cSrcweir sal_Bool _bOn; 3238cdf0e10cSrcweir sal_Unicode cStart, cEnd; 3239cdf0e10cSrcweir rStrm >> _bOn >> cStart >> cEnd; 3240cdf0e10cSrcweir return new SvxTwoLinesItem( _bOn, cStart, cEnd, Which() ); 3241cdf0e10cSrcweir } 3242cdf0e10cSrcweir 3243cdf0e10cSrcweir SvStream& SvxTwoLinesItem::Store(SvStream & rStrm, sal_uInt16 /*nIVer*/) const 3244cdf0e10cSrcweir { 3245cdf0e10cSrcweir rStrm << GetValue() << GetStartBracket() << GetEndBracket(); 3246cdf0e10cSrcweir return rStrm; 3247cdf0e10cSrcweir } 3248cdf0e10cSrcweir 3249cdf0e10cSrcweir sal_uInt16 SvxTwoLinesItem::GetVersion( sal_uInt16 nFFVer ) const 3250cdf0e10cSrcweir { 3251cdf0e10cSrcweir DBG_ASSERT( SOFFICE_FILEFORMAT_31==nFFVer || 3252cdf0e10cSrcweir SOFFICE_FILEFORMAT_40==nFFVer || 3253cdf0e10cSrcweir SOFFICE_FILEFORMAT_50==nFFVer, 3254cdf0e10cSrcweir "SvxTwoLinesItem: Gibt es ein neues Fileformat?" ); 3255cdf0e10cSrcweir 3256cdf0e10cSrcweir return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0; 3257cdf0e10cSrcweir } 3258cdf0e10cSrcweir 3259cdf0e10cSrcweir 3260cdf0e10cSrcweir /************************************************************************* 3261cdf0e10cSrcweir |* class SvxCharRotateItem 3262cdf0e10cSrcweir *************************************************************************/ 3263cdf0e10cSrcweir 3264cdf0e10cSrcweir SvxCharRotateItem::SvxCharRotateItem( sal_uInt16 nValue, 3265cdf0e10cSrcweir sal_Bool bFitIntoLine, 3266cdf0e10cSrcweir const sal_uInt16 nW ) 3267cdf0e10cSrcweir : SfxUInt16Item( nW, nValue ), bFitToLine( bFitIntoLine ) 3268cdf0e10cSrcweir { 3269cdf0e10cSrcweir } 3270cdf0e10cSrcweir 3271cdf0e10cSrcweir SfxPoolItem* SvxCharRotateItem::Clone( SfxItemPool* ) const 3272cdf0e10cSrcweir { 3273cdf0e10cSrcweir return new SvxCharRotateItem( GetValue(), IsFitToLine(), Which() ); 3274cdf0e10cSrcweir } 3275cdf0e10cSrcweir 3276cdf0e10cSrcweir SfxPoolItem* SvxCharRotateItem::Create( SvStream& rStrm, sal_uInt16 ) const 3277cdf0e10cSrcweir { 3278cdf0e10cSrcweir sal_uInt16 nVal; 3279cdf0e10cSrcweir sal_Bool b; 3280cdf0e10cSrcweir rStrm >> nVal >> b; 3281cdf0e10cSrcweir return new SvxCharRotateItem( nVal, b, Which() ); 3282cdf0e10cSrcweir } 3283cdf0e10cSrcweir 3284cdf0e10cSrcweir SvStream& SvxCharRotateItem::Store( SvStream & rStrm, sal_uInt16 ) const 3285cdf0e10cSrcweir { 3286cdf0e10cSrcweir sal_Bool bFlag = IsFitToLine(); 3287cdf0e10cSrcweir rStrm << GetValue() << bFlag; 3288cdf0e10cSrcweir return rStrm; 3289cdf0e10cSrcweir } 3290cdf0e10cSrcweir 3291cdf0e10cSrcweir sal_uInt16 SvxCharRotateItem::GetVersion( sal_uInt16 nFFVer ) const 3292cdf0e10cSrcweir { 3293cdf0e10cSrcweir return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0; 3294cdf0e10cSrcweir } 3295cdf0e10cSrcweir 3296cdf0e10cSrcweir SfxItemPresentation SvxCharRotateItem::GetPresentation( 3297cdf0e10cSrcweir SfxItemPresentation ePres, 3298cdf0e10cSrcweir SfxMapUnit /*eCoreMetric*/, SfxMapUnit /*ePresMetric*/, 3299cdf0e10cSrcweir String &rText, const IntlWrapper* ) const 3300cdf0e10cSrcweir { 3301cdf0e10cSrcweir switch( ePres ) 3302cdf0e10cSrcweir { 3303cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NONE: 3304cdf0e10cSrcweir rText.Erase(); 3305cdf0e10cSrcweir break; 3306cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NAMELESS: 3307cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_COMPLETE: 3308cdf0e10cSrcweir { 3309cdf0e10cSrcweir if( !GetValue() ) 3310cdf0e10cSrcweir rText = EE_RESSTR( RID_SVXITEMS_CHARROTATE_OFF ); 3311cdf0e10cSrcweir else 3312cdf0e10cSrcweir { 3313cdf0e10cSrcweir rText = EE_RESSTR( RID_SVXITEMS_CHARROTATE ); 3314cdf0e10cSrcweir rText.SearchAndReplaceAscii( "$(ARG1)", 3315cdf0e10cSrcweir String::CreateFromInt32( GetValue() / 10 )); 3316cdf0e10cSrcweir if( IsFitToLine() ) 3317cdf0e10cSrcweir rText += EE_RESSTR( RID_SVXITEMS_CHARROTATE_FITLINE ); 3318cdf0e10cSrcweir } 3319cdf0e10cSrcweir return ePres; 3320cdf0e10cSrcweir } 3321cdf0e10cSrcweir default: ; //prevent warning 3322cdf0e10cSrcweir } 3323cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_NONE; 3324cdf0e10cSrcweir } 3325cdf0e10cSrcweir 3326cdf0e10cSrcweir sal_Bool SvxCharRotateItem::QueryValue( com::sun::star::uno::Any& rVal, 3327cdf0e10cSrcweir sal_uInt8 nMemberId ) const 3328cdf0e10cSrcweir { 3329cdf0e10cSrcweir // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); 3330cdf0e10cSrcweir nMemberId &= ~CONVERT_TWIPS; 3331cdf0e10cSrcweir sal_Bool bRet = sal_True; 3332cdf0e10cSrcweir switch( nMemberId ) 3333cdf0e10cSrcweir { 3334cdf0e10cSrcweir case MID_ROTATE: 3335cdf0e10cSrcweir rVal <<= (sal_Int16)GetValue(); 3336cdf0e10cSrcweir break; 3337cdf0e10cSrcweir case MID_FITTOLINE: 3338cdf0e10cSrcweir rVal = Bool2Any( IsFitToLine() ); 3339cdf0e10cSrcweir break; 3340cdf0e10cSrcweir default: 3341cdf0e10cSrcweir bRet = sal_False; 3342cdf0e10cSrcweir break; 3343cdf0e10cSrcweir } 3344cdf0e10cSrcweir return bRet; 3345cdf0e10cSrcweir } 3346cdf0e10cSrcweir 3347cdf0e10cSrcweir sal_Bool SvxCharRotateItem::PutValue( const com::sun::star::uno::Any& rVal, 3348cdf0e10cSrcweir sal_uInt8 nMemberId ) 3349cdf0e10cSrcweir { 3350cdf0e10cSrcweir // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); 3351cdf0e10cSrcweir nMemberId &= ~CONVERT_TWIPS; 3352cdf0e10cSrcweir sal_Bool bRet = sal_True; 3353cdf0e10cSrcweir switch( nMemberId ) 3354cdf0e10cSrcweir { 3355cdf0e10cSrcweir case MID_ROTATE: 3356cdf0e10cSrcweir { 3357cdf0e10cSrcweir sal_Int16 nVal = 0; 3358cdf0e10cSrcweir if((rVal >>= nVal) && (0 == nVal || 900 == nVal || 2700 == nVal)) 3359cdf0e10cSrcweir SetValue( (sal_uInt16)nVal ); 3360cdf0e10cSrcweir else 3361cdf0e10cSrcweir bRet = sal_False; 3362cdf0e10cSrcweir break; 3363cdf0e10cSrcweir } 3364cdf0e10cSrcweir 3365cdf0e10cSrcweir case MID_FITTOLINE: 3366cdf0e10cSrcweir SetFitToLine( Any2Bool( rVal ) ); 3367cdf0e10cSrcweir break; 3368cdf0e10cSrcweir default: 3369cdf0e10cSrcweir bRet = sal_False; 3370cdf0e10cSrcweir } 3371cdf0e10cSrcweir return bRet; 3372cdf0e10cSrcweir } 3373cdf0e10cSrcweir 3374cdf0e10cSrcweir int SvxCharRotateItem::operator==( const SfxPoolItem& rItem ) const 3375cdf0e10cSrcweir { 3376cdf0e10cSrcweir DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" ); 3377cdf0e10cSrcweir return SfxUInt16Item::operator==( rItem ) && 3378cdf0e10cSrcweir IsFitToLine() == ((const SvxCharRotateItem&)rItem).IsFitToLine(); 3379cdf0e10cSrcweir } 3380cdf0e10cSrcweir 3381cdf0e10cSrcweir 3382cdf0e10cSrcweir /************************************************************************* 3383cdf0e10cSrcweir |* class SvxCharScaleItem 3384cdf0e10cSrcweir *************************************************************************/ 3385cdf0e10cSrcweir 3386cdf0e10cSrcweir SvxCharScaleWidthItem::SvxCharScaleWidthItem( sal_uInt16 nValue, 3387cdf0e10cSrcweir const sal_uInt16 nW ) 3388cdf0e10cSrcweir : SfxUInt16Item( nW, nValue ) 3389cdf0e10cSrcweir { 3390cdf0e10cSrcweir } 3391cdf0e10cSrcweir 3392cdf0e10cSrcweir SfxPoolItem* SvxCharScaleWidthItem::Clone( SfxItemPool* ) const 3393cdf0e10cSrcweir { 3394cdf0e10cSrcweir return new SvxCharScaleWidthItem( GetValue(), Which() ); 3395cdf0e10cSrcweir } 3396cdf0e10cSrcweir 3397cdf0e10cSrcweir SfxPoolItem* SvxCharScaleWidthItem::Create( SvStream& rStrm, sal_uInt16 ) const 3398cdf0e10cSrcweir { 3399cdf0e10cSrcweir sal_uInt16 nVal; 3400cdf0e10cSrcweir rStrm >> nVal; 3401cdf0e10cSrcweir SvxCharScaleWidthItem* pItem = new SvxCharScaleWidthItem( nVal, Which() ); 3402cdf0e10cSrcweir 3403cdf0e10cSrcweir if ( Which() == EE_CHAR_FONTWIDTH ) 3404cdf0e10cSrcweir { 3405cdf0e10cSrcweir // #87271#: Was a SvxFontWidthItem in 5.2 3406cdf0e10cSrcweir // sal_uInt16 nFixWidth, sal_uInt16 nPropWidth. 3407cdf0e10cSrcweir // nFixWidth has never been used... 3408cdf0e10cSrcweir rStrm >> nVal; 3409cdf0e10cSrcweir sal_uInt16 nTest; 3410cdf0e10cSrcweir rStrm >> nTest; 3411cdf0e10cSrcweir if ( nTest == 0x1234 ) 3412cdf0e10cSrcweir pItem->SetValue( nVal ); 3413cdf0e10cSrcweir else 3414cdf0e10cSrcweir rStrm.SeekRel( -2*(long)sizeof(sal_uInt16) ); 3415cdf0e10cSrcweir } 3416cdf0e10cSrcweir 3417cdf0e10cSrcweir return pItem; 3418cdf0e10cSrcweir } 3419cdf0e10cSrcweir 3420cdf0e10cSrcweir SvStream& SvxCharScaleWidthItem::Store( SvStream& rStream, sal_uInt16 nVer ) const 3421cdf0e10cSrcweir { 3422cdf0e10cSrcweir SvStream& rRet = SfxUInt16Item::Store( rStream, nVer ); 3423cdf0e10cSrcweir if ( Which() == EE_CHAR_FONTWIDTH ) 3424cdf0e10cSrcweir { 3425cdf0e10cSrcweir // see comment in Create().... 3426cdf0e10cSrcweir rRet.SeekRel( -1*(long)sizeof(sal_uInt16) ); 3427cdf0e10cSrcweir rRet << (sal_uInt16)0; 3428cdf0e10cSrcweir rRet << GetValue(); 3429cdf0e10cSrcweir // Really ugly, but not a problem for reading the doc in 5.2 3430cdf0e10cSrcweir rRet << (sal_uInt16)0x1234; 3431cdf0e10cSrcweir } 3432cdf0e10cSrcweir return rRet; 3433cdf0e10cSrcweir } 3434cdf0e10cSrcweir 3435cdf0e10cSrcweir 3436cdf0e10cSrcweir sal_uInt16 SvxCharScaleWidthItem::GetVersion( sal_uInt16 nFFVer ) const 3437cdf0e10cSrcweir { 3438cdf0e10cSrcweir return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0; 3439cdf0e10cSrcweir } 3440cdf0e10cSrcweir 3441cdf0e10cSrcweir SfxItemPresentation SvxCharScaleWidthItem::GetPresentation( 3442cdf0e10cSrcweir SfxItemPresentation ePres, 3443cdf0e10cSrcweir SfxMapUnit /*eCoreMetric*/, SfxMapUnit /*ePresMetric*/, 3444cdf0e10cSrcweir String &rText, const IntlWrapper* ) const 3445cdf0e10cSrcweir { 3446cdf0e10cSrcweir switch( ePres ) 3447cdf0e10cSrcweir { 3448cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NONE: 3449cdf0e10cSrcweir rText.Erase(); 3450cdf0e10cSrcweir break; 3451cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NAMELESS: 3452cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_COMPLETE: 3453cdf0e10cSrcweir { 3454cdf0e10cSrcweir if( !GetValue() ) 3455cdf0e10cSrcweir rText = EE_RESSTR( RID_SVXITEMS_CHARSCALE_OFF ); 3456cdf0e10cSrcweir else 3457cdf0e10cSrcweir { 3458cdf0e10cSrcweir rText = EE_RESSTR( RID_SVXITEMS_CHARSCALE ); 3459cdf0e10cSrcweir rText.SearchAndReplaceAscii( "$(ARG1)", 3460cdf0e10cSrcweir String::CreateFromInt32( GetValue() )); 3461cdf0e10cSrcweir } 3462cdf0e10cSrcweir return ePres; 3463cdf0e10cSrcweir } 3464cdf0e10cSrcweir default: ; //prevent warning 3465cdf0e10cSrcweir } 3466cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_NONE; 3467cdf0e10cSrcweir } 3468cdf0e10cSrcweir 3469cdf0e10cSrcweir sal_Bool SvxCharScaleWidthItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) 3470cdf0e10cSrcweir { 3471cdf0e10cSrcweir // SfxUInt16Item::QueryValue returns sal_Int32 in Any now... (srx642w) 3472cdf0e10cSrcweir // where we still want this to be a sal_Int16 3473cdf0e10cSrcweir sal_Int16 nValue = sal_Int16(); 3474cdf0e10cSrcweir if (rVal >>= nValue) 3475cdf0e10cSrcweir { 3476cdf0e10cSrcweir SetValue( (sal_uInt16) nValue ); 3477cdf0e10cSrcweir return sal_True; 3478cdf0e10cSrcweir } 3479cdf0e10cSrcweir 3480cdf0e10cSrcweir DBG_ERROR( "SvxCharScaleWidthItem::PutValue - Wrong type!" ); 3481cdf0e10cSrcweir return sal_False; 3482cdf0e10cSrcweir } 3483cdf0e10cSrcweir 3484cdf0e10cSrcweir sal_Bool SvxCharScaleWidthItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const 3485cdf0e10cSrcweir { 3486cdf0e10cSrcweir // SfxUInt16Item::QueryValue returns sal_Int32 in Any now... (srx642w) 3487cdf0e10cSrcweir // where we still want this to be a sal_Int16 3488cdf0e10cSrcweir rVal <<= (sal_Int16)GetValue(); 3489cdf0e10cSrcweir return sal_True; 3490cdf0e10cSrcweir } 3491cdf0e10cSrcweir 3492cdf0e10cSrcweir /************************************************************************* 3493cdf0e10cSrcweir |* class SvxCharReliefItem 3494cdf0e10cSrcweir *************************************************************************/ 3495cdf0e10cSrcweir 3496cdf0e10cSrcweir SvxCharReliefItem::SvxCharReliefItem( FontRelief eValue, 3497cdf0e10cSrcweir const sal_uInt16 nId ) 3498cdf0e10cSrcweir : SfxEnumItem( nId, (sal_uInt16)eValue ) 3499cdf0e10cSrcweir { 3500cdf0e10cSrcweir } 3501cdf0e10cSrcweir 3502cdf0e10cSrcweir SfxPoolItem* SvxCharReliefItem::Clone( SfxItemPool * ) const 3503cdf0e10cSrcweir { 3504cdf0e10cSrcweir return new SvxCharReliefItem( *this ); 3505cdf0e10cSrcweir } 3506cdf0e10cSrcweir 3507cdf0e10cSrcweir SfxPoolItem* SvxCharReliefItem::Create(SvStream & rStrm, sal_uInt16) const 3508cdf0e10cSrcweir { 3509cdf0e10cSrcweir sal_uInt16 nVal; 3510cdf0e10cSrcweir rStrm >> nVal; 3511cdf0e10cSrcweir return new SvxCharReliefItem( (FontRelief)nVal, Which() ); 3512cdf0e10cSrcweir } 3513cdf0e10cSrcweir 3514cdf0e10cSrcweir SvStream& SvxCharReliefItem::Store(SvStream & rStrm, sal_uInt16 /*nIVer*/) const 3515cdf0e10cSrcweir { 3516cdf0e10cSrcweir sal_uInt16 nVal = GetValue(); 3517cdf0e10cSrcweir rStrm << nVal; 3518cdf0e10cSrcweir return rStrm; 3519cdf0e10cSrcweir } 3520cdf0e10cSrcweir 3521cdf0e10cSrcweir sal_uInt16 SvxCharReliefItem::GetVersion( sal_uInt16 nFFVer ) const 3522cdf0e10cSrcweir { 3523cdf0e10cSrcweir return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0; 3524cdf0e10cSrcweir } 3525cdf0e10cSrcweir 3526cdf0e10cSrcweir String SvxCharReliefItem::GetValueTextByPos( sal_uInt16 nPos ) const 3527cdf0e10cSrcweir { 3528cdf0e10cSrcweir DBG_ASSERT( RID_SVXITEMS_RELIEF_ENGRAVED - RID_SVXITEMS_RELIEF_NONE, 3529cdf0e10cSrcweir "enum overflow" ); 3530cdf0e10cSrcweir return String( EditResId( RID_SVXITEMS_RELIEF_BEGIN + nPos )); 3531cdf0e10cSrcweir } 3532cdf0e10cSrcweir 3533cdf0e10cSrcweir sal_uInt16 SvxCharReliefItem::GetValueCount() const 3534cdf0e10cSrcweir { 3535cdf0e10cSrcweir return RID_SVXITEMS_RELIEF_ENGRAVED - RID_SVXITEMS_RELIEF_NONE; 3536cdf0e10cSrcweir } 3537cdf0e10cSrcweir 3538cdf0e10cSrcweir SfxItemPresentation SvxCharReliefItem::GetPresentation 3539cdf0e10cSrcweir ( 3540cdf0e10cSrcweir SfxItemPresentation ePres, 3541cdf0e10cSrcweir SfxMapUnit /*eCoreUnit*/, 3542cdf0e10cSrcweir SfxMapUnit /*ePresUnit*/, 3543cdf0e10cSrcweir XubString& rText, const IntlWrapper * /*pIntl*/ 3544cdf0e10cSrcweir ) const 3545cdf0e10cSrcweir { 3546cdf0e10cSrcweir SfxItemPresentation eRet = ePres; 3547cdf0e10cSrcweir switch( ePres ) 3548cdf0e10cSrcweir { 3549cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NONE: 3550cdf0e10cSrcweir rText.Erase(); 3551cdf0e10cSrcweir break; 3552cdf0e10cSrcweir 3553cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NAMELESS: 3554cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_COMPLETE: 3555cdf0e10cSrcweir rText = GetValueTextByPos( GetValue() ); 3556cdf0e10cSrcweir break; 3557cdf0e10cSrcweir 3558cdf0e10cSrcweir default: 3559cdf0e10cSrcweir eRet = SFX_ITEM_PRESENTATION_NONE; 3560cdf0e10cSrcweir } 3561cdf0e10cSrcweir return eRet; 3562cdf0e10cSrcweir } 3563cdf0e10cSrcweir 3564cdf0e10cSrcweir sal_Bool SvxCharReliefItem::PutValue( const com::sun::star::uno::Any& rVal, 3565cdf0e10cSrcweir sal_uInt8 nMemberId ) 3566cdf0e10cSrcweir { 3567cdf0e10cSrcweir // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); 3568cdf0e10cSrcweir nMemberId &= ~CONVERT_TWIPS; 3569cdf0e10cSrcweir sal_Bool bRet = sal_True; 3570cdf0e10cSrcweir switch( nMemberId ) 3571cdf0e10cSrcweir { 3572cdf0e10cSrcweir case MID_RELIEF: 3573cdf0e10cSrcweir { 3574cdf0e10cSrcweir sal_Int16 nVal = -1; 3575cdf0e10cSrcweir rVal >>= nVal; 3576cdf0e10cSrcweir if(nVal >= 0 && nVal <= RELIEF_ENGRAVED) 3577cdf0e10cSrcweir SetValue( (sal_uInt16)nVal ); 3578cdf0e10cSrcweir else 3579cdf0e10cSrcweir bRet = sal_False; 3580cdf0e10cSrcweir } 3581cdf0e10cSrcweir break; 3582cdf0e10cSrcweir default: 3583cdf0e10cSrcweir bRet = sal_False; 3584cdf0e10cSrcweir break; 3585cdf0e10cSrcweir } 3586cdf0e10cSrcweir return bRet; 3587cdf0e10cSrcweir } 3588cdf0e10cSrcweir 3589cdf0e10cSrcweir sal_Bool SvxCharReliefItem::QueryValue( com::sun::star::uno::Any& rVal, 3590cdf0e10cSrcweir sal_uInt8 nMemberId ) const 3591cdf0e10cSrcweir { 3592cdf0e10cSrcweir // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); 3593cdf0e10cSrcweir nMemberId &= ~CONVERT_TWIPS; 3594cdf0e10cSrcweir sal_Bool bRet = sal_True; 3595cdf0e10cSrcweir switch( nMemberId ) 3596cdf0e10cSrcweir { 3597cdf0e10cSrcweir case MID_RELIEF: 3598cdf0e10cSrcweir rVal <<= (sal_Int16)GetValue(); 3599cdf0e10cSrcweir break; 3600cdf0e10cSrcweir default: 3601cdf0e10cSrcweir bRet = sal_False; 3602cdf0e10cSrcweir break; 3603cdf0e10cSrcweir } 3604cdf0e10cSrcweir return bRet; 3605cdf0e10cSrcweir } 3606cdf0e10cSrcweir 3607cdf0e10cSrcweir /************************************************************************* 3608cdf0e10cSrcweir |* class SvxScriptTypeItemItem 3609cdf0e10cSrcweir *************************************************************************/ 3610cdf0e10cSrcweir 3611cdf0e10cSrcweir SvxScriptTypeItem::SvxScriptTypeItem( sal_uInt16 nType ) 3612cdf0e10cSrcweir : SfxUInt16Item( SID_ATTR_CHAR_SCRIPTTYPE, nType ) 3613cdf0e10cSrcweir { 3614cdf0e10cSrcweir } 3615cdf0e10cSrcweir SfxPoolItem* SvxScriptTypeItem::Clone( SfxItemPool * ) const 3616cdf0e10cSrcweir { 3617cdf0e10cSrcweir return new SvxScriptTypeItem( GetValue() ); 3618cdf0e10cSrcweir } 3619cdf0e10cSrcweir 3620cdf0e10cSrcweir /************************************************************************* 3621cdf0e10cSrcweir |* class SvxScriptSetItem 3622cdf0e10cSrcweir *************************************************************************/ 3623cdf0e10cSrcweir 3624cdf0e10cSrcweir SvxScriptSetItem::SvxScriptSetItem( sal_uInt16 nSlotId, SfxItemPool& rPool ) 3625cdf0e10cSrcweir : SfxSetItem( nSlotId, new SfxItemSet( rPool, 3626cdf0e10cSrcweir SID_ATTR_CHAR_FONT, SID_ATTR_CHAR_FONT )) 3627cdf0e10cSrcweir { 3628cdf0e10cSrcweir sal_uInt16 nLatin, nAsian, nComplex; 3629cdf0e10cSrcweir GetWhichIds( nLatin, nAsian, nComplex ); 3630cdf0e10cSrcweir 3631cdf0e10cSrcweir sal_uInt16 aIds[ 9 ] = { 0 }; 3632cdf0e10cSrcweir aIds[ 0 ] = aIds[ 1 ] = nLatin; 3633cdf0e10cSrcweir aIds[ 2 ] = aIds[ 3 ] = nAsian; 3634cdf0e10cSrcweir aIds[ 4 ] = aIds[ 5 ] = nComplex; 3635cdf0e10cSrcweir aIds[ 6 ] = aIds[ 7 ] = SID_ATTR_CHAR_SCRIPTTYPE; 3636cdf0e10cSrcweir aIds[ 8 ] = 0; 3637cdf0e10cSrcweir 3638cdf0e10cSrcweir GetItemSet().SetRanges( aIds ); 3639cdf0e10cSrcweir } 3640cdf0e10cSrcweir 3641cdf0e10cSrcweir SfxPoolItem* SvxScriptSetItem::Clone( SfxItemPool * ) const 3642cdf0e10cSrcweir { 3643cdf0e10cSrcweir SvxScriptSetItem* p = new SvxScriptSetItem( Which(), *GetItemSet().GetPool() ); 3644cdf0e10cSrcweir p->GetItemSet().Put( GetItemSet(), sal_False ); 3645cdf0e10cSrcweir return p; 3646cdf0e10cSrcweir } 3647cdf0e10cSrcweir 3648cdf0e10cSrcweir SfxPoolItem* SvxScriptSetItem::Create( SvStream &, sal_uInt16 ) const 3649cdf0e10cSrcweir { 3650cdf0e10cSrcweir return 0; 3651cdf0e10cSrcweir } 3652cdf0e10cSrcweir 3653cdf0e10cSrcweir const SfxPoolItem* SvxScriptSetItem::GetItemOfScriptSet( 3654cdf0e10cSrcweir const SfxItemSet& rSet, sal_uInt16 nId ) 3655cdf0e10cSrcweir { 3656cdf0e10cSrcweir const SfxPoolItem* pI; 3657cdf0e10cSrcweir SfxItemState eSt = rSet.GetItemState( nId, sal_False, &pI ); 3658cdf0e10cSrcweir if( SFX_ITEM_SET != eSt ) 3659cdf0e10cSrcweir pI = SFX_ITEM_DEFAULT == eSt ? &rSet.Get( nId ) : 0; 3660cdf0e10cSrcweir return pI; 3661cdf0e10cSrcweir } 3662cdf0e10cSrcweir 3663cdf0e10cSrcweir const SfxPoolItem* SvxScriptSetItem::GetItemOfScript( sal_uInt16 nSlotId, const SfxItemSet& rSet, sal_uInt16 nScript ) 3664cdf0e10cSrcweir { 3665cdf0e10cSrcweir sal_uInt16 nLatin, nAsian, nComplex; 3666cdf0e10cSrcweir GetWhichIds( nSlotId, rSet, nLatin, nAsian, nComplex ); 3667cdf0e10cSrcweir 3668cdf0e10cSrcweir const SfxPoolItem *pRet, *pAsn, *pCmplx; 3669cdf0e10cSrcweir switch( nScript ) 3670cdf0e10cSrcweir { 3671cdf0e10cSrcweir default: //no one valid -> match to latin 3672cdf0e10cSrcweir // case SCRIPTTYPE_LATIN: 3673cdf0e10cSrcweir pRet = GetItemOfScriptSet( rSet, nLatin ); 3674cdf0e10cSrcweir break; 3675cdf0e10cSrcweir case SCRIPTTYPE_ASIAN: 3676cdf0e10cSrcweir pRet = GetItemOfScriptSet( rSet, nAsian ); 3677cdf0e10cSrcweir break; 3678cdf0e10cSrcweir case SCRIPTTYPE_COMPLEX: 3679cdf0e10cSrcweir pRet = GetItemOfScriptSet( rSet, nComplex ); 3680cdf0e10cSrcweir break; 3681cdf0e10cSrcweir 3682cdf0e10cSrcweir case SCRIPTTYPE_LATIN|SCRIPTTYPE_ASIAN: 3683cdf0e10cSrcweir if( 0 == (pRet = GetItemOfScriptSet( rSet, nLatin )) || 3684cdf0e10cSrcweir 0 == (pAsn = GetItemOfScriptSet( rSet, nAsian )) || 3685cdf0e10cSrcweir *pRet != *pAsn ) 3686cdf0e10cSrcweir pRet = 0; 3687cdf0e10cSrcweir break; 3688cdf0e10cSrcweir 3689cdf0e10cSrcweir case SCRIPTTYPE_LATIN|SCRIPTTYPE_COMPLEX: 3690cdf0e10cSrcweir if( 0 == (pRet = GetItemOfScriptSet( rSet, nLatin )) || 3691cdf0e10cSrcweir 0 == (pCmplx = GetItemOfScriptSet( rSet, nComplex )) || 3692cdf0e10cSrcweir *pRet != *pCmplx ) 3693cdf0e10cSrcweir pRet = 0; 3694cdf0e10cSrcweir break; 3695cdf0e10cSrcweir 3696cdf0e10cSrcweir case SCRIPTTYPE_ASIAN|SCRIPTTYPE_COMPLEX: 3697cdf0e10cSrcweir if( 0 == (pRet = GetItemOfScriptSet( rSet, nAsian )) || 3698cdf0e10cSrcweir 0 == (pCmplx = GetItemOfScriptSet( rSet, nComplex )) || 3699cdf0e10cSrcweir *pRet != *pCmplx ) 3700cdf0e10cSrcweir pRet = 0; 3701cdf0e10cSrcweir break; 3702cdf0e10cSrcweir 3703cdf0e10cSrcweir case SCRIPTTYPE_LATIN|SCRIPTTYPE_ASIAN|SCRIPTTYPE_COMPLEX: 3704cdf0e10cSrcweir if( 0 == (pRet = GetItemOfScriptSet( rSet, nLatin )) || 3705cdf0e10cSrcweir 0 == (pAsn = GetItemOfScriptSet( rSet, nAsian )) || 3706cdf0e10cSrcweir 0 == (pCmplx = GetItemOfScriptSet( rSet, nComplex )) || 3707cdf0e10cSrcweir *pRet != *pAsn || *pRet != *pCmplx ) 3708cdf0e10cSrcweir pRet = 0; 3709cdf0e10cSrcweir break; 3710cdf0e10cSrcweir } 3711cdf0e10cSrcweir return pRet; 3712cdf0e10cSrcweir } 3713cdf0e10cSrcweir 3714cdf0e10cSrcweir const SfxPoolItem* SvxScriptSetItem::GetItemOfScript( sal_uInt16 nScript ) const 3715cdf0e10cSrcweir { 3716cdf0e10cSrcweir return GetItemOfScript( Which(), GetItemSet(), nScript ); 3717cdf0e10cSrcweir } 3718cdf0e10cSrcweir 3719cdf0e10cSrcweir void SvxScriptSetItem::PutItemForScriptType( sal_uInt16 nScriptType, 3720cdf0e10cSrcweir const SfxPoolItem& rItem ) 3721cdf0e10cSrcweir { 3722cdf0e10cSrcweir sal_uInt16 nLatin, nAsian, nComplex; 3723cdf0e10cSrcweir GetWhichIds( nLatin, nAsian, nComplex ); 3724cdf0e10cSrcweir 3725cdf0e10cSrcweir SfxPoolItem* pCpy = rItem.Clone(); 3726cdf0e10cSrcweir if( SCRIPTTYPE_LATIN & nScriptType ) 3727cdf0e10cSrcweir { 3728cdf0e10cSrcweir pCpy->SetWhich( nLatin ); 3729cdf0e10cSrcweir GetItemSet().Put( *pCpy ); 3730cdf0e10cSrcweir } 3731cdf0e10cSrcweir if( SCRIPTTYPE_ASIAN & nScriptType ) 3732cdf0e10cSrcweir { 3733cdf0e10cSrcweir pCpy->SetWhich( nAsian ); 3734cdf0e10cSrcweir GetItemSet().Put( *pCpy ); 3735cdf0e10cSrcweir } 3736cdf0e10cSrcweir if( SCRIPTTYPE_COMPLEX & nScriptType ) 3737cdf0e10cSrcweir { 3738cdf0e10cSrcweir pCpy->SetWhich( nComplex ); 3739cdf0e10cSrcweir GetItemSet().Put( *pCpy ); 3740cdf0e10cSrcweir } 3741cdf0e10cSrcweir delete pCpy; 3742cdf0e10cSrcweir } 3743cdf0e10cSrcweir 3744cdf0e10cSrcweir void SvxScriptSetItem::GetWhichIds( sal_uInt16 nSlotId, const SfxItemSet& rSet, sal_uInt16& rLatin, sal_uInt16& rAsian, sal_uInt16& rComplex ) 3745cdf0e10cSrcweir { 3746cdf0e10cSrcweir const SfxItemPool& rPool = *rSet.GetPool(); 3747cdf0e10cSrcweir GetSlotIds( nSlotId, rLatin, rAsian, rComplex ); 3748cdf0e10cSrcweir rLatin = rPool.GetWhich( rLatin ); 3749cdf0e10cSrcweir rAsian = rPool.GetWhich( rAsian ); 3750cdf0e10cSrcweir rComplex = rPool.GetWhich( rComplex ); 3751cdf0e10cSrcweir } 3752cdf0e10cSrcweir 3753cdf0e10cSrcweir void SvxScriptSetItem::GetWhichIds( sal_uInt16& rLatin, sal_uInt16& rAsian, 3754cdf0e10cSrcweir sal_uInt16& rComplex ) const 3755cdf0e10cSrcweir { 3756cdf0e10cSrcweir GetWhichIds( Which(), GetItemSet(), rLatin, rAsian, rComplex ); 3757cdf0e10cSrcweir } 3758cdf0e10cSrcweir 3759cdf0e10cSrcweir void SvxScriptSetItem::GetSlotIds( sal_uInt16 nSlotId, sal_uInt16& rLatin, 3760cdf0e10cSrcweir sal_uInt16& rAsian, sal_uInt16& rComplex ) 3761cdf0e10cSrcweir { 3762cdf0e10cSrcweir switch( nSlotId ) 3763cdf0e10cSrcweir { 3764cdf0e10cSrcweir default: 3765cdf0e10cSrcweir DBG_ASSERT( sal_False, "wrong SlotId for class SvxScriptSetItem" ); 3766cdf0e10cSrcweir // no break - default to font - Id Range !! 3767cdf0e10cSrcweir 3768cdf0e10cSrcweir case SID_ATTR_CHAR_FONT: 3769cdf0e10cSrcweir rLatin = SID_ATTR_CHAR_FONT; 3770cdf0e10cSrcweir rAsian = SID_ATTR_CHAR_CJK_FONT; 3771cdf0e10cSrcweir rComplex = SID_ATTR_CHAR_CTL_FONT; 3772cdf0e10cSrcweir break; 3773cdf0e10cSrcweir case SID_ATTR_CHAR_FONTHEIGHT: 3774cdf0e10cSrcweir rLatin = SID_ATTR_CHAR_FONTHEIGHT; 3775cdf0e10cSrcweir rAsian = SID_ATTR_CHAR_CJK_FONTHEIGHT; 3776cdf0e10cSrcweir rComplex = SID_ATTR_CHAR_CTL_FONTHEIGHT; 3777cdf0e10cSrcweir break; 3778cdf0e10cSrcweir case SID_ATTR_CHAR_WEIGHT: 3779cdf0e10cSrcweir rLatin = SID_ATTR_CHAR_WEIGHT; 3780cdf0e10cSrcweir rAsian = SID_ATTR_CHAR_CJK_WEIGHT; 3781cdf0e10cSrcweir rComplex = SID_ATTR_CHAR_CTL_WEIGHT; 3782cdf0e10cSrcweir break; 3783cdf0e10cSrcweir case SID_ATTR_CHAR_POSTURE: 3784cdf0e10cSrcweir rLatin = SID_ATTR_CHAR_POSTURE; 3785cdf0e10cSrcweir rAsian = SID_ATTR_CHAR_CJK_POSTURE; 3786cdf0e10cSrcweir rComplex = SID_ATTR_CHAR_CTL_POSTURE; 3787cdf0e10cSrcweir break; 3788cdf0e10cSrcweir case SID_ATTR_CHAR_LANGUAGE: 3789cdf0e10cSrcweir rLatin = SID_ATTR_CHAR_LANGUAGE; 3790cdf0e10cSrcweir rAsian = SID_ATTR_CHAR_CJK_LANGUAGE; 3791cdf0e10cSrcweir rComplex = SID_ATTR_CHAR_CTL_LANGUAGE; 3792cdf0e10cSrcweir break; 3793eb72824aSAndre Fischer case SID_ATTR_CHAR_SHADOWED: 3794eb72824aSAndre Fischer rLatin = SID_ATTR_CHAR_SHADOWED; 3795eb72824aSAndre Fischer rAsian = SID_ATTR_CHAR_SHADOWED; 3796eb72824aSAndre Fischer rComplex = SID_ATTR_CHAR_SHADOWED; 3797eb72824aSAndre Fischer break; 3798eb72824aSAndre Fischer case SID_ATTR_CHAR_STRIKEOUT: 3799eb72824aSAndre Fischer rLatin = SID_ATTR_CHAR_STRIKEOUT; 3800eb72824aSAndre Fischer rAsian = SID_ATTR_CHAR_STRIKEOUT; 3801eb72824aSAndre Fischer rComplex = SID_ATTR_CHAR_STRIKEOUT; 3802eb72824aSAndre Fischer break; 3803cdf0e10cSrcweir } 3804cdf0e10cSrcweir } 3805cdf0e10cSrcweir 3806cdf0e10cSrcweir void GetDefaultFonts( SvxFontItem& rLatin, SvxFontItem& rAsian, SvxFontItem& rComplex ) 3807cdf0e10cSrcweir { 3808cdf0e10cSrcweir const sal_uInt16 nItemCnt = 3; 3809cdf0e10cSrcweir 3810cdf0e10cSrcweir static struct 3811cdf0e10cSrcweir { 3812cdf0e10cSrcweir sal_uInt16 nFontType; 3813cdf0e10cSrcweir sal_uInt16 nLanguage; 3814cdf0e10cSrcweir } 3815cdf0e10cSrcweir aOutTypeArr[ nItemCnt ] = 3816cdf0e10cSrcweir { 3817cdf0e10cSrcweir { DEFAULTFONT_LATIN_TEXT, LANGUAGE_ENGLISH_US }, 3818cdf0e10cSrcweir { DEFAULTFONT_CJK_TEXT, LANGUAGE_ENGLISH_US }, 3819cdf0e10cSrcweir { DEFAULTFONT_CTL_TEXT, LANGUAGE_ARABIC_SAUDI_ARABIA } 3820cdf0e10cSrcweir }; 3821cdf0e10cSrcweir 3822cdf0e10cSrcweir SvxFontItem* aItemArr[ nItemCnt ] = { &rLatin, &rAsian, &rComplex }; 3823cdf0e10cSrcweir 3824cdf0e10cSrcweir for ( sal_uInt16 n = 0; n < nItemCnt; ++n ) 3825cdf0e10cSrcweir { 3826cdf0e10cSrcweir Font aFont( OutputDevice::GetDefaultFont( aOutTypeArr[ n ].nFontType, 3827cdf0e10cSrcweir aOutTypeArr[ n ].nLanguage, 3828cdf0e10cSrcweir DEFAULTFONT_FLAGS_ONLYONE, 0 ) ); 3829cdf0e10cSrcweir SvxFontItem* pItem = aItemArr[ n ]; 3830cdf0e10cSrcweir pItem->SetFamily( aFont.GetFamily() ); 3831cdf0e10cSrcweir pItem->SetFamilyName( aFont.GetName() ); 3832cdf0e10cSrcweir pItem->SetStyleName( String() ); 3833cdf0e10cSrcweir pItem->SetPitch( aFont.GetPitch()); 3834cdf0e10cSrcweir pItem->SetCharSet(aFont.GetCharSet()); 3835cdf0e10cSrcweir } 3836cdf0e10cSrcweir } 3837cdf0e10cSrcweir 3838cdf0e10cSrcweir 3839cdf0e10cSrcweir sal_uInt16 GetI18NScriptTypeOfLanguage( sal_uInt16 nLang ) 3840cdf0e10cSrcweir { 3841cdf0e10cSrcweir return GetI18NScriptType( SvtLanguageOptions::GetScriptTypeOfLanguage( nLang ) ); 3842cdf0e10cSrcweir } 3843cdf0e10cSrcweir 3844cdf0e10cSrcweir sal_uInt16 GetItemScriptType( short nI18NType ) 3845cdf0e10cSrcweir { 3846cdf0e10cSrcweir switch ( nI18NType ) 3847cdf0e10cSrcweir { 3848cdf0e10cSrcweir case i18n::ScriptType::LATIN: return SCRIPTTYPE_LATIN; 3849cdf0e10cSrcweir case i18n::ScriptType::ASIAN: return SCRIPTTYPE_ASIAN; 3850cdf0e10cSrcweir case i18n::ScriptType::COMPLEX: return SCRIPTTYPE_COMPLEX; 3851cdf0e10cSrcweir } 3852cdf0e10cSrcweir return 0; 3853cdf0e10cSrcweir } 3854cdf0e10cSrcweir 3855cdf0e10cSrcweir short GetI18NScriptType( sal_uInt16 nItemType ) 3856cdf0e10cSrcweir { 3857cdf0e10cSrcweir switch ( nItemType ) 3858cdf0e10cSrcweir { 3859cdf0e10cSrcweir case SCRIPTTYPE_LATIN: return i18n::ScriptType::LATIN; 3860cdf0e10cSrcweir case SCRIPTTYPE_ASIAN: return i18n::ScriptType::ASIAN; 3861cdf0e10cSrcweir case SCRIPTTYPE_COMPLEX: return i18n::ScriptType::COMPLEX; 3862cdf0e10cSrcweir } 3863cdf0e10cSrcweir return 0; 3864cdf0e10cSrcweir } 3865