diff options
author | Thomas Lange [tl] <tl@openoffice.org> | 2010-02-26 08:13:29 +0100 |
---|---|---|
committer | Thomas Lange [tl] <tl@openoffice.org> | 2010-02-26 08:13:29 +0100 |
commit | f3f9bbf544328823c6816bcc6e9afecc886c18ab (patch) | |
tree | ef19e016bd5efea85f5e82ea265fd5a9531407c3 /svx/source/items | |
parent | 97d964702b7d8a9814a52b974505603ffba2e6c6 (diff) | |
parent | 4d8175599b8d193aba6eef89ef905c830b87d7e7 (diff) |
cws tl74: merge with DEV300_m72
Diffstat (limited to 'svx/source/items')
37 files changed, 105 insertions, 16775 deletions
diff --git a/svx/source/items/SmartTagItem.cxx b/svx/source/items/SmartTagItem.cxx index 73ea6edca1c6..7089da42860b 100644 --- a/svx/source/items/SmartTagItem.cxx +++ b/svx/source/items/SmartTagItem.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: SmartTagItem.cxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svx/source/items/algitem.cxx b/svx/source/items/algitem.cxx index 447d11f6d6ea..183db0e3a722 100644 --- a/svx/source/items/algitem.cxx +++ b/svx/source/items/algitem.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: algitem.cxx,v $ - * $Revision: 1.14 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -53,7 +50,7 @@ #include <svx/algitem.hxx> #include <svx/dialmgr.hxx> -#include <svx/itemtype.hxx> +#include <editeng/itemtype.hxx> #include <svx/unomid.hxx> using namespace ::rtl; diff --git a/svx/source/items/boxobj.hxx b/svx/source/items/boxobj.hxx deleted file mode 100644 index 4b4b901dbd38..000000000000 --- a/svx/source/items/boxobj.hxx +++ /dev/null @@ -1,100 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: boxobj.hxx,v $ - * $Revision: 1.3.76.1 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_BOXOBJ_HXX -#define _SVX_BOXOBJ_HXX - - -#ifndef _SFX_SHOBJ_HXX //autogen -#include <sfx2/shobj.hxx> -#endif -class SvxBoxItem; -class SvxBoxInfoItem; -class SvxBorderLine; - -//------------------------------------------------------------------------- - -class SvxBoxObject: public SfxShellSubObject - -/* [Beschreibung] - - Diese SbxObject-Subklasse kann das <SvxBoxItem> und <SvxBoxInfoItem> - im SBX-System recorden und wieder abspielen. Hier werden keine - G"ultigkeitspr"ufungen durchgef"uhrt, diese m"ussen in abgeleiteten - Klassen spezifisch implementiert werden; dazu sind virtuelle Methoden - vorhanden. -*/ - -{ -friend class SvxBoxLineObject_Impl; - - SvxBoxItem* pBox; - SvxBoxInfoItem* pBoxInfo; - -#ifdef _SVX_BOXOBJ_CXX -private: - const SvxBorderLine* GetLine_Impl( USHORT nSID ) const; - BOOL SetLine_Impl( USHORT nSID, const SvxBorderLine *pLine ); - void Update_Impl() const; -#endif - -protected: - // Schnittstelle zum SbxObject/SvDispatch/SfxShell..Object - void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); - virtual ULONG SetProperty( USHORT nSID, SbxVariable &rRet ); - virtual ULONG GetProperty( USHORT nSID, SbxVariable &rRet ); - - // bei den folgenden Methoden sind die Items bereits besorgt worden - virtual SbxError GetLineColor( USHORT nSID, Color &rColor ) const; - virtual SbxError GetLineStyle( USHORT nSID, - USHORT &rOutWidth, USHORT &rDist, USHORT &rInWidth ) const; - virtual SbxError GetDistance( USHORT &rDist ) const; - - // nach den folgenden Methoden werden die Items wieder in die Shell gesetzt - virtual SbxError SetLineColor( USHORT nSID, const Color &rColor ); - virtual SbxError SetLineStyle( USHORT nSID, - USHORT nOutWidth, USHORT nDist, USHORT nInWidth ); - virtual SbxError SetDistance( USHORT nDist ); - -public: - TYPEINFO(); - SvxBoxObject( SfxShell *pShell = 0 ); - - ~SvxBoxObject(); - - const SvxBoxItem& GetBoxItem() const { return *pBox; } - const SvxBoxInfoItem& GetBoxInfoItem() const { return *pBoxInfo; } - - virtual String GenerateSource( const String &rLinePrefix, - const SbxObject *pRelativeTo ); -}; - - -#endif - diff --git a/svx/source/items/bulitem.cxx b/svx/source/items/bulitem.cxx deleted file mode 100644 index c798f94b17ed..000000000000 --- a/svx/source/items/bulitem.cxx +++ /dev/null @@ -1,538 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: bulitem.cxx,v $ - * $Revision: 1.12 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svx.hxx" - -// include --------------------------------------------------------------- -#include <tools/stream.hxx> - -#include <vcl/outdev.hxx> - -#define _SVX_BULITEM_CXX - -#include "bulitem.hxx" -#include "svxerr.hxx" - -// #90477# -#include <tools/tenccvt.hxx> - -#define BULITEM_VERSION ((USHORT)2) - -// ----------------------------------------------------------------------- - -TYPEINIT1(SvxBulletItem,SfxPoolItem); - -// ----------------------------------------------------------------------- - -void SvxBulletItem::StoreFont( SvStream& rStream, const Font& rFont ) -{ - USHORT nTemp; - - rStream << rFont.GetColor(); - nTemp = (USHORT)rFont.GetFamily(); rStream << nTemp; - - // #90477# nTemp = (USHORT)GetStoreCharSet( rFont.GetCharSet(), rStream.GetVersion() ); - nTemp = (USHORT)GetSOStoreTextEncoding((rtl_TextEncoding)rFont.GetCharSet(), (sal_uInt16)rStream.GetVersion()); - rStream << nTemp; - - nTemp = (USHORT)rFont.GetPitch(); rStream << nTemp; - nTemp = (USHORT)rFont.GetAlign(); rStream << nTemp; - nTemp = (USHORT)rFont.GetWeight(); rStream << nTemp; - nTemp = (USHORT)rFont.GetUnderline(); rStream << nTemp; - nTemp = (USHORT)rFont.GetStrikeout(); rStream << nTemp; - nTemp = (USHORT)rFont.GetItalic(); rStream << nTemp; - - // UNICODE: rStream << rFont.GetName(); - rStream.WriteByteString(rFont.GetName()); - - rStream << rFont.IsOutline(); - rStream << rFont.IsShadow(); - rStream << rFont.IsTransparent(); -} - -// ----------------------------------------------------------------------- - -Font SvxBulletItem::CreateFont( SvStream& rStream, USHORT nVer ) -{ - Font aFont; - Color aColor; - rStream >> aColor; aFont.SetColor( aColor ); - USHORT nTemp; - rStream >> nTemp; aFont.SetFamily((FontFamily)nTemp); - - // #90477# - rStream >> nTemp; - nTemp = (sal_uInt16)GetSOLoadTextEncoding((rtl_TextEncoding)nTemp, (sal_uInt16)rStream.GetVersion()); - aFont.SetCharSet((rtl_TextEncoding)nTemp); - - rStream >> nTemp; aFont.SetPitch((FontPitch)nTemp); - rStream >> nTemp; aFont.SetAlign((FontAlign)nTemp); - rStream >> nTemp; aFont.SetWeight((FontWeight)nTemp); - rStream >> nTemp; aFont.SetUnderline((FontUnderline)nTemp); - rStream >> nTemp; aFont.SetStrikeout((FontStrikeout)nTemp); - rStream >> nTemp; aFont.SetItalic((FontItalic)nTemp); - - // UNICODE: rStream >> aName; aFont.SetName( aName ); - String aName; - rStream.ReadByteString(aName); - aFont.SetName( aName ); - - if( nVer == 1 ) - { - long nHeight, nWidth; - rStream >> nHeight; rStream >> nWidth; Size aSize( nWidth, nHeight ); - aFont.SetSize( aSize ); - } - - BOOL bTemp; - rStream >> bTemp; aFont.SetOutline( bTemp ); - rStream >> bTemp; aFont.SetShadow( bTemp ); - rStream >> bTemp; aFont.SetTransparent( bTemp ); - return aFont; -} - - -// ----------------------------------------------------------------------- - -SvxBulletItem::SvxBulletItem( USHORT _nWhich ) : SfxPoolItem( _nWhich ) -{ - SetDefaultFont_Impl(); - SetDefaults_Impl(); - nValidMask = 0xFFFF; -} - -// ----------------------------------------------------------------------- - -SvxBulletItem::SvxBulletItem( BYTE nNewStyle, const Font& rFont, USHORT /*nStart*/, USHORT _nWhich ) : SfxPoolItem( _nWhich ) -{ - SetDefaults_Impl(); - nStyle = nNewStyle; - aFont = rFont; - nValidMask = 0xFFFF; -} - -// ----------------------------------------------------------------------- - -SvxBulletItem::SvxBulletItem( const Font& rFont, xub_Unicode cSymb, USHORT _nWhich ) : SfxPoolItem( _nWhich ) -{ - SetDefaults_Impl(); - aFont = rFont; - cSymbol = cSymb; - nStyle = BS_BULLET; - nValidMask = 0xFFFF; -} - -// ----------------------------------------------------------------------- - -SvxBulletItem::SvxBulletItem( const Bitmap& rBmp, USHORT _nWhich ) : SfxPoolItem( _nWhich ) -{ - SetDefaults_Impl(); - - if( !rBmp.IsEmpty() ) - { - pGraphicObject = new GraphicObject( rBmp ); - nStyle = BS_BMP; - } - - nValidMask = 0xFFFF; -} - -// ----------------------------------------------------------------------- - -SvxBulletItem::SvxBulletItem( const GraphicObject& rGraphicObject, USHORT _nWhich ) : SfxPoolItem( _nWhich ) -{ - SetDefaults_Impl(); - - if( ( GRAPHIC_NONE != pGraphicObject->GetType() ) && ( GRAPHIC_DEFAULT != pGraphicObject->GetType() ) ) - { - pGraphicObject = new GraphicObject( rGraphicObject ); - nStyle = BS_BMP; - } - - nValidMask = 0xFFFF; -} - -// ----------------------------------------------------------------------- - -SvxBulletItem::SvxBulletItem( SvStream& rStrm, USHORT _nWhich ) : - SfxPoolItem( _nWhich ), - pGraphicObject( NULL ) -{ - rStrm >> nStyle; - - if( nStyle != BS_BMP ) - aFont = CreateFont( rStrm, BULITEM_VERSION ); - else - { - // Sicheres Laden mit Test auf leere Bitmap - Bitmap aBmp; - const UINT32 nOldPos = rStrm.Tell(); - // #69345# Errorcode beim Bitmap lesen ignorieren, - // siehe Kommentar #67581# in SvxBulletItem::Store() - BOOL bOldError = rStrm.GetError() ? TRUE : FALSE; - rStrm >> aBmp; - if ( !bOldError && rStrm.GetError() ) - { - rStrm.ResetError(); - // #71493# Keine Warnung: Das BulletItem interessiert seit 5.0 im Dateiformat nicht mehr. - // rStrm.SetError(ERRCODE_CLASS_READ | ERRCODE_SVX_BULLETITEM_NOBULLET | ERRCODE_WARNING_MASK); - } - - if( aBmp.IsEmpty() ) - { - rStrm.Seek( nOldPos ); - nStyle = BS_NONE; - } - else - pGraphicObject = new GraphicObject( aBmp ); - } - - rStrm >> nWidth; - rStrm >> nStart; - rStrm >> nJustify; - - char cTmpSymbol; - rStrm >> cTmpSymbol; - cSymbol = ByteString::ConvertToUnicode( cTmpSymbol, aFont.GetCharSet() ); - - rStrm >> nScale; - - // UNICODE: rStrm >> aPrevText; - rStrm.ReadByteString(aPrevText); - - // UNICODE: rStrm >> aFollowText; - rStrm.ReadByteString(aFollowText); - - nValidMask = 0xFFFF; -} - -// ----------------------------------------------------------------------- - -SvxBulletItem::SvxBulletItem( const SvxBulletItem& rItem) : SfxPoolItem( rItem ) -{ - aFont = rItem.aFont; - pGraphicObject = ( rItem.pGraphicObject ? new GraphicObject( *rItem.pGraphicObject ) : NULL ); - aPrevText = rItem.aPrevText; - aFollowText = rItem.aFollowText; - nStart = rItem.nStart; - nStyle = rItem.nStyle; - nWidth = rItem.nWidth; - nScale = rItem.nScale; - cSymbol = rItem.cSymbol; - nJustify = rItem.nJustify; - nValidMask = rItem.nValidMask; -} - -// ----------------------------------------------------------------------- - -SvxBulletItem::~SvxBulletItem() -{ - if( pGraphicObject ) - delete pGraphicObject; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxBulletItem::Clone( SfxItemPool * /*pPool*/ ) const -{ - return new SvxBulletItem( *this ); -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxBulletItem::Create( SvStream& rStrm, USHORT /*nVersion*/ ) const -{ - return new SvxBulletItem( rStrm, Which() ); -} - -// ----------------------------------------------------------------------- - -void SvxBulletItem::SetDefaultFont_Impl() -{ - aFont = OutputDevice::GetDefaultFont( DEFAULTFONT_FIXED, LANGUAGE_SYSTEM, 0 ); - aFont.SetAlign( ALIGN_BOTTOM); - aFont.SetTransparent( TRUE ); -} - -// ----------------------------------------------------------------------- - -void SvxBulletItem::SetDefaults_Impl() -{ - pGraphicObject = NULL; - nWidth = 1200; // 1.2cm - nStart = 1; - nStyle = BS_123; - nJustify = BJ_HLEFT | BJ_VCENTER; - cSymbol = sal_Unicode(' '); - nScale = 75; -} - -// ----------------------------------------------------------------------- - -USHORT SvxBulletItem::GetVersion( USHORT /*nVersion*/ ) const -{ - return BULITEM_VERSION; -} - -// ----------------------------------------------------------------------- - -void SvxBulletItem::CopyValidProperties( const SvxBulletItem& rCopyFrom ) -{ - Font _aFont = GetFont(); - Font aNewFont = rCopyFrom.GetFont(); - if ( rCopyFrom.IsValid( VALID_FONTNAME ) ) - { - _aFont.SetName( aNewFont.GetName() ); - _aFont.SetFamily( aNewFont.GetFamily() ); - _aFont.SetStyleName( aNewFont.GetStyleName() ); - } - if ( rCopyFrom.IsValid( VALID_FONTCOLOR ) ) - _aFont.SetColor( aNewFont.GetColor() ); - if ( rCopyFrom.IsValid( VALID_SYMBOL ) ) - SetSymbol( rCopyFrom.GetSymbol() ); - if ( rCopyFrom.IsValid( VALID_BITMAP ) ) - SetGraphicObject( rCopyFrom.GetGraphicObject() ); - if ( rCopyFrom.IsValid( VALID_SCALE ) ) - SetScale( rCopyFrom.GetScale() ); - if ( rCopyFrom.IsValid( VALID_START ) ) - SetStart( rCopyFrom.GetStart() ); - if ( rCopyFrom.IsValid( VALID_STYLE ) ) - SetStyle( rCopyFrom.GetStyle() ); - if ( rCopyFrom.IsValid( VALID_PREVTEXT ) ) - SetPrevText( rCopyFrom.GetPrevText() ); - if ( rCopyFrom.IsValid( VALID_FOLLOWTEXT ) ) - SetFollowText( rCopyFrom.GetFollowText() ); - - SetFont( _aFont ); -} - - -// ----------------------------------------------------------------------- - -int SvxBulletItem::operator==( const SfxPoolItem& rItem ) const -{ - DBG_ASSERT(rItem.ISA(SvxBulletItem),"operator==Types not matching"); - const SvxBulletItem& rBullet = (const SvxBulletItem&)rItem; - // ValidMask mitvergleichen, da sonst kein Putten in ein AttrSet moeglich, - // wenn sich das Item nur in der ValidMask von einem existierenden unterscheidet. - if( nValidMask != rBullet.nValidMask || - nStyle != rBullet.nStyle || - nScale != rBullet.nScale || - nJustify != rBullet.nJustify || - nWidth != rBullet.nWidth || - nStart != rBullet.nStart || - cSymbol != rBullet.cSymbol || - aPrevText != rBullet.aPrevText || - aFollowText != rBullet.aFollowText ) - return 0; - - if( ( nStyle != BS_BMP ) && ( aFont != rBullet.aFont ) ) - return 0; - - if( nStyle == BS_BMP ) - { - if( ( pGraphicObject && !rBullet.pGraphicObject ) || ( !pGraphicObject && rBullet.pGraphicObject ) ) - return 0; - - if( ( pGraphicObject && rBullet.pGraphicObject ) && - ( ( *pGraphicObject != *rBullet.pGraphicObject ) || - ( pGraphicObject->GetPrefSize() != rBullet.pGraphicObject->GetPrefSize() ) ) ) - { - return 0; - } - } - - return 1; -} - -// ----------------------------------------------------------------------- - -SvStream& SvxBulletItem::Store( SvStream& rStrm, USHORT /*nItemVersion*/ ) const -{ - // Korrektur bei leerer Bitmap - if( ( nStyle == BS_BMP ) && - ( !pGraphicObject || ( GRAPHIC_NONE == pGraphicObject->GetType() ) || ( GRAPHIC_DEFAULT == pGraphicObject->GetType() ) ) ) - { - if( pGraphicObject ) - { - delete( const_cast< SvxBulletItem* >( this )->pGraphicObject ); - const_cast< SvxBulletItem* >( this )->pGraphicObject = NULL; - } - - const_cast< SvxBulletItem* >( this )->nStyle = BS_NONE; - } - - rStrm << nStyle; - - if( nStyle != BS_BMP ) - StoreFont( rStrm, aFont ); - else - { - ULONG _nStart = rStrm.Tell(); - - // Kleine Vorab-Schaetzung der Groesse... - USHORT nFac = ( rStrm.GetCompressMode() != COMPRESSMODE_NONE ) ? 3 : 1; - const Bitmap aBmp( pGraphicObject->GetGraphic().GetBitmap() ); - ULONG nBytes = aBmp.GetSizeBytes(); - if ( nBytes < ULONG(0xFF00*nFac) ) - rStrm << aBmp; - - ULONG nEnd = rStrm.Tell(); - // #67581# Item darf mit Overhead nicht mehr als 64K schreiben, - // sonst platzt der SfxMultiRecord - // Dann lieber auf die Bitmap verzichten, ist nur fuer Outliner - // und auch nur fuer <= 5.0 wichtig. - // Beim Einlesen merkt der Stream-Operator der Bitmap, dass dort keine steht. - // Hiermit funktioniert jetzt der Fall das die grosse Bitmap aus einem anderen - // Fileformat entstanden ist, welches keine 64K belegt, aber wenn eine - // Bitmap > 64K verwendet wird, hat das SvxNumBulletItem beim Laden ein Problem, - // stuerzt aber nicht ab. - - if ( (nEnd-_nStart) > 0xFF00 ) - rStrm.Seek( _nStart ); - } - rStrm << nWidth; - rStrm << nStart; - rStrm << nJustify; - rStrm << (char)ByteString::ConvertFromUnicode( cSymbol, aFont.GetCharSet() ); - rStrm << nScale; - - // UNICODE: rStrm << aPrevText; - rStrm.WriteByteString(aPrevText); - - // UNICODE: rStrm << aFollowText; - rStrm.WriteByteString(aFollowText); - - return rStrm; -} - -//------------------------------------------------------------------------ - -XubString SvxBulletItem::GetFullText() const -{ - XubString aStr( aPrevText ); - aStr += cSymbol; - aStr += aFollowText; - return aStr; -} - -//------------------------------------------------------------------------ - -SfxItemPresentation SvxBulletItem::GetPresentation -( - SfxItemPresentation ePres, - SfxMapUnit /*eCoreUnit*/, - SfxMapUnit /*ePresUnit*/, - XubString& rText, const IntlWrapper * -) const -{ - SfxItemPresentation eRet = SFX_ITEM_PRESENTATION_NONE; - switch ( ePres ) - { - case SFX_ITEM_PRESENTATION_NONE: - rText.Erase(); - eRet = SFX_ITEM_PRESENTATION_NONE; - break; - - case SFX_ITEM_PRESENTATION_NAMELESS: - case SFX_ITEM_PRESENTATION_COMPLETE: - rText = GetFullText(); - eRet = SFX_ITEM_PRESENTATION_COMPLETE; - break; - default: ; //prevent warning - } - return eRet; -} - -//------------------------------------------------------------------------ - -Bitmap SvxBulletItem::GetBitmap() const -{ - if( pGraphicObject ) - return pGraphicObject->GetGraphic().GetBitmap(); - else - { - const Bitmap aDefaultBitmap; - return aDefaultBitmap; - } -} - -//------------------------------------------------------------------------ - -void SvxBulletItem::SetBitmap( const Bitmap& rBmp ) -{ - if( rBmp.IsEmpty() ) - { - if( pGraphicObject ) - { - delete pGraphicObject; - pGraphicObject = NULL; - } - } - else - { - delete pGraphicObject; - pGraphicObject = new GraphicObject( rBmp ); - - } -} - -//------------------------------------------------------------------------ - -const GraphicObject& SvxBulletItem::GetGraphicObject() const -{ - if( pGraphicObject ) - return *pGraphicObject; - else - { - static const GraphicObject aDefaultObject; - return aDefaultObject; - } -} - -//------------------------------------------------------------------------ - -void SvxBulletItem::SetGraphicObject( const GraphicObject& rGraphicObject ) -{ - if( ( GRAPHIC_NONE == rGraphicObject.GetType() ) || ( GRAPHIC_DEFAULT == rGraphicObject.GetType() ) ) - { - if( pGraphicObject ) - { - delete pGraphicObject; - pGraphicObject = NULL; - } - } - else - { - delete pGraphicObject; - pGraphicObject = new GraphicObject( rGraphicObject ); - } -} diff --git a/svx/source/items/charhiddenitem.cxx b/svx/source/items/charhiddenitem.cxx deleted file mode 100644 index 1e7f49afa690..000000000000 --- a/svx/source/items/charhiddenitem.cxx +++ /dev/null @@ -1,85 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: charhiddenitem.cxx,v $ - * $Revision: 1.9 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svx.hxx" - - -#include <charhiddenitem.hxx> -#include <svx/svxitems.hrc> -#include <svx/dialmgr.hxx> - -TYPEINIT1_FACTORY(SvxCharHiddenItem, SfxBoolItem, new SvxCharHiddenItem(sal_False, 0)); - -/*-- 16.12.2003 15:24:25--------------------------------------------------- - - -----------------------------------------------------------------------*/ -SvxCharHiddenItem::SvxCharHiddenItem( const sal_Bool bHidden, const USHORT nId ) : - SfxBoolItem( nId, bHidden ) -{ -} -/*-- 16.12.2003 15:24:25--------------------------------------------------- - - -----------------------------------------------------------------------*/ -SfxPoolItem* SvxCharHiddenItem::Clone( SfxItemPool * ) const -{ - return new SvxCharHiddenItem( *this ); -} -/*-- 16.12.2003 15:24:25--------------------------------------------------- - - -----------------------------------------------------------------------*/ -SfxItemPresentation SvxCharHiddenItem::GetPresentation -( - SfxItemPresentation ePres, - SfxMapUnit /*eCoreUnit*/, - SfxMapUnit /*ePresUnit*/, - XubString& rText, const IntlWrapper * /*pIntl*/ -) const -{ - switch ( ePres ) - { - case SFX_ITEM_PRESENTATION_NONE: - rText.Erase(); - return ePres; - case SFX_ITEM_PRESENTATION_NAMELESS: - case SFX_ITEM_PRESENTATION_COMPLETE: - { - USHORT nId = RID_SVXITEMS_CHARHIDDEN_FALSE; - - if ( GetValue() ) - nId = RID_SVXITEMS_CHARHIDDEN_TRUE; - rText = SVX_RESSTR(nId); - return ePres; - } - default: ; //prevent warning - } - return SFX_ITEM_PRESENTATION_NONE; -} - diff --git a/svx/source/items/chrtitem.cxx b/svx/source/items/chrtitem.cxx index 248c3390708f..8957bd2e3ba0 100644 --- a/svx/source/items/chrtitem.cxx +++ b/svx/source/items/chrtitem.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: chrtitem.cxx,v $ - * $Revision: 1.17 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svx/source/items/clipfmtitem.cxx b/svx/source/items/clipfmtitem.cxx index 59c907b476b2..086cd1cff161 100644 --- a/svx/source/items/clipfmtitem.cxx +++ b/svx/source/items/clipfmtitem.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: clipfmtitem.cxx,v $ - * $Revision: 1.9 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svx/source/items/customshapeitem.cxx b/svx/source/items/customshapeitem.cxx index fd78a2e2986c..c7a401ed4054 100644 --- a/svx/source/items/customshapeitem.cxx +++ b/svx/source/items/customshapeitem.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: customshapeitem.cxx,v $ - * $Revision: 1.10 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svx/source/items/drawitem.cxx b/svx/source/items/drawitem.cxx index 7b84cd8da2d5..27d7dba45c49 100644 --- a/svx/source/items/drawitem.cxx +++ b/svx/source/items/drawitem.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: drawitem.cxx,v $ - * $Revision: 1.11 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svx/source/items/e3ditem.cxx b/svx/source/items/e3ditem.cxx index 60feff51f8a8..846c422ae03a 100644 --- a/svx/source/items/e3ditem.cxx +++ b/svx/source/items/e3ditem.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: e3ditem.cxx,v $ - * $Revision: 1.11 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svx/source/items/flditem.cxx b/svx/source/items/flditem.cxx deleted file mode 100644 index 05cdddcf307a..000000000000 --- a/svx/source/items/flditem.cxx +++ /dev/null @@ -1,1101 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: flditem.cxx,v $ - * $Revision: 1.29 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svx.hxx" -#include <vcl/metaact.hxx> -#include <svl/zforlist.hxx> -#include <tools/urlobj.hxx> - -#define _SVX_FLDITEM_CXX -#include <unotools/localfilehelper.hxx> - -#include <svx/flditem.hxx> - -#include <svx/svdfield.hxx> - -// #90477# -#include <tools/tenccvt.hxx> - -#define FRAME_MARKER (sal_uInt32)0x21981357 -#define CHARSET_MARKER (FRAME_MARKER+1) - -// ----------------------------------------------------------------------- - -TYPEINIT1( SvxFieldItem, SfxPoolItem ); - -SV_IMPL_PERSIST1( SvxFieldData, SvPersistBase ); - -// ----------------------------------------------------------------------- - -SvxFieldData::SvxFieldData() -{ -} - -// ----------------------------------------------------------------------- - -SvxFieldData::~SvxFieldData() -{ -} - -// ----------------------------------------------------------------------- - -SvxFieldData* SvxFieldData::Clone() const -{ - return new SvxFieldData; -} - -// ----------------------------------------------------------------------- - -int SvxFieldData::operator==( const SvxFieldData& rFld ) const -{ - DBG_ASSERT( Type() == rFld.Type(), "==: Verschiedene Typen" ); - (void)rFld; - return TRUE; // Basicklasse immer gleich. -} - -// ----------------------------------------------------------------------- - -void SvxFieldData::Load( SvPersistStream & /*rStm*/ ) -{ -} - -// ----------------------------------------------------------------------- - -void SvxFieldData::Save( SvPersistStream & /*rStm*/ ) -{ -} - - -MetaAction* SvxFieldData::createBeginComment() const -{ - return new MetaCommentAction( "FIELD_SEQ_BEGIN" ); -} - -MetaAction* SvxFieldData::createEndComment() const -{ - return new MetaCommentAction( "FIELD_SEQ_END" ); -} - -// ----------------------------------------------------------------------- - -SvxFieldItem::SvxFieldItem( SvxFieldData* pFld, const USHORT nId ) : - SfxPoolItem( nId ) -{ - pField = pFld; // gehoert direkt dem Item -} - -// ----------------------------------------------------------------------- - -SvxFieldItem::SvxFieldItem( const SvxFieldData& rField, const USHORT nId ) : - SfxPoolItem( nId ) -{ - pField = rField.Clone(); -} - -// ----------------------------------------------------------------------- - -SvxFieldItem::SvxFieldItem( const SvxFieldItem& rItem ) : - SfxPoolItem ( rItem ) -{ - pField = rItem.GetField() ? rItem.GetField()->Clone() : 0; -} - -// ----------------------------------------------------------------------- - -SvxFieldItem::~SvxFieldItem() -{ - delete pField; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxFieldItem::Clone( SfxItemPool* ) const -{ - return new SvxFieldItem(*this); -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxFieldItem::Create( SvStream& rStrm, USHORT ) const -{ - SvxFieldData* pData = 0; - SvPersistStream aPStrm( GetClassManager(), &rStrm ); - aPStrm >> pData; - - if( aPStrm.IsEof() ) - aPStrm.SetError( SVSTREAM_GENERALERROR ); - - if ( aPStrm.GetError() == ERRCODE_IO_NOFACTORY ) - aPStrm.ResetError(); // Eigentlich einen Code, dass nicht alle Attr gelesen wurden... - - return new SvxFieldItem( pData, Which() ); -} - -// ----------------------------------------------------------------------- - -SvStream& SvxFieldItem::Store( SvStream& rStrm, USHORT /*nItemVersion*/ ) const -{ - DBG_ASSERT( pField, "SvxFieldItem::Store: Feld?!" ); - SvPersistStream aPStrm( GetClassManager(), &rStrm ); - // Das ResetError in der obigen Create-Methode gab es in 3.1 noch nicht, - // deshalb duerfen beim 3.x-Export neuere Items nicht gespeichert werden! - if ( ( rStrm.GetVersion() <= SOFFICE_FILEFORMAT_31 ) && pField && - pField->GetClassId() == 50 /* SdrMeasureField */ ) - { - // SvxFieldData reicht nicht, weil auch nicht am ClassMgr angemeldet - SvxURLField aDummyData; - aPStrm << &aDummyData; - } - else - aPStrm << pField; - - return rStrm; -} - -// ----------------------------------------------------------------------- - -int SvxFieldItem::operator==( const SfxPoolItem& rItem ) const -{ - DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal which or type" ); - - const SvxFieldData* pOtherFld = ((const SvxFieldItem&)rItem).GetField(); - if ( !pField && !pOtherFld ) - return TRUE; - - if ( ( !pField && pOtherFld ) || ( pField && !pOtherFld ) ) - return FALSE; - - return ( ( pField->Type() == pOtherFld->Type() ) - && ( *pField == *pOtherFld ) ); -} - -// ================================================================= -// Es folgen die Ableitungen von SvxFieldData... -// ================================================================= - -SV_IMPL_PERSIST1( SvxDateField, SvxFieldData ); - -// ----------------------------------------------------------------------- - -SvxDateField::SvxDateField() -{ - nFixDate = Date().GetDate(); - eType = SVXDATETYPE_VAR; - eFormat = SVXDATEFORMAT_STDSMALL; -} - -// ----------------------------------------------------------------------- - -SvxDateField::SvxDateField( const Date& rDate, SvxDateType eT, SvxDateFormat eF ) -{ - nFixDate = rDate.GetDate(); - eType = eT; - eFormat = eF; -} - -// ----------------------------------------------------------------------- - -SvxFieldData* SvxDateField::Clone() const -{ - return new SvxDateField( *this ); -} - -// ----------------------------------------------------------------------- - -int SvxDateField::operator==( const SvxFieldData& rOther ) const -{ - if ( rOther.Type() != Type() ) - return FALSE; - - const SvxDateField& rOtherFld = (const SvxDateField&) rOther; - return ( ( nFixDate == rOtherFld.nFixDate ) && - ( eType == rOtherFld.eType ) && - ( eFormat == rOtherFld.eFormat ) ); -} - -// ----------------------------------------------------------------------- - -void SvxDateField::Load( SvPersistStream & rStm ) -{ - USHORT nType, nFormat; - - rStm >> nFixDate; - rStm >> nType; - rStm >> nFormat; - - eType = (SvxDateType)nType; - eFormat= (SvxDateFormat)nFormat; -} - -// ----------------------------------------------------------------------- - -void SvxDateField::Save( SvPersistStream & rStm ) -{ - rStm << nFixDate; - rStm << (USHORT)eType; - rStm << (USHORT)eFormat; -} - -// ----------------------------------------------------------------------- - -String SvxDateField::GetFormatted( SvNumberFormatter& rFormatter, LanguageType eLang ) const -{ - Date aDate; // current date - if ( eType == SVXDATETYPE_FIX ) - aDate.SetDate( nFixDate ); - - return GetFormatted( aDate, eFormat, rFormatter, eLang ); -} - -String SvxDateField::GetFormatted( Date& aDate, SvxDateFormat eFormat, SvNumberFormatter& rFormatter, LanguageType eLang ) -{ - if ( eFormat == SVXDATEFORMAT_SYSTEM ) - { - DBG_ERROR( "SVXDATEFORMAT_SYSTEM nicht implementiert!" ); - eFormat = SVXDATEFORMAT_STDSMALL; - } - else if ( eFormat == SVXDATEFORMAT_APPDEFAULT ) - { - DBG_ERROR( "SVXDATEFORMAT_APPDEFAULT: Woher nehmen?" ); - eFormat = SVXDATEFORMAT_STDSMALL; - } - - ULONG nFormatKey; - - switch( eFormat ) - { - case SVXDATEFORMAT_STDSMALL: - // short - nFormatKey = rFormatter.GetFormatIndex( NF_DATE_SYSTEM_SHORT, eLang ); - break; - case SVXDATEFORMAT_STDBIG: - // long - nFormatKey = rFormatter.GetFormatIndex( NF_DATE_SYSTEM_LONG, eLang ); - break; - case SVXDATEFORMAT_A: - // 13.02.96 - nFormatKey = rFormatter.GetFormatIndex( NF_DATE_SYS_DDMMYY, eLang ); - break; - case SVXDATEFORMAT_B: - // 13.02.1996 - nFormatKey = rFormatter.GetFormatIndex( NF_DATE_SYS_DDMMYYYY, eLang ); - break; - case SVXDATEFORMAT_C: - // 13. Feb 1996 - nFormatKey = rFormatter.GetFormatIndex( NF_DATE_SYS_DMMMYYYY, eLang ); - break; - case SVXDATEFORMAT_D: - // 13. Februar 1996 - nFormatKey = rFormatter.GetFormatIndex( NF_DATE_SYS_DMMMMYYYY, eLang ); - break; - case SVXDATEFORMAT_E: - // Die, 13. Februar 1996 - nFormatKey = rFormatter.GetFormatIndex( NF_DATE_SYS_NNDMMMMYYYY, eLang ); - break; - case SVXDATEFORMAT_F: - // Dienstag, 13. Februar 1996 - nFormatKey = rFormatter.GetFormatIndex( NF_DATE_SYS_NNNNDMMMMYYYY, eLang ); - break; - default: - nFormatKey = rFormatter.GetStandardFormat( NUMBERFORMAT_DATE, eLang ); - } - - double fDiffDate = aDate - *(rFormatter.GetNullDate()); - String aStr; - Color* pColor = NULL; - rFormatter.GetOutputString( fDiffDate, nFormatKey, aStr, &pColor ); - return aStr; -} - -MetaAction* SvxDateField::createBeginComment() const -{ - return new MetaCommentAction( "FIELD_SEQ_BEGIN" ); -} - -SV_IMPL_PERSIST1( SvxURLField, SvxFieldData ); - -// ----------------------------------------------------------------------- - -SvxURLField::SvxURLField() -{ - eFormat = SVXURLFORMAT_URL; -} - -// ----------------------------------------------------------------------- - -SvxURLField::SvxURLField( const XubString& rURL, const XubString& rRepres, SvxURLFormat eFmt ) - : aURL( rURL ), aRepresentation( rRepres ) -{ - eFormat = eFmt; -} - -// ----------------------------------------------------------------------- - -SvxFieldData* SvxURLField::Clone() const -{ - return new SvxURLField( *this ); -} - -// ----------------------------------------------------------------------- - -int SvxURLField::operator==( const SvxFieldData& rOther ) const -{ - if ( rOther.Type() != Type() ) - return FALSE; - - const SvxURLField& rOtherFld = (const SvxURLField&) rOther; - return ( ( eFormat == rOtherFld.eFormat ) && - ( aURL == rOtherFld.aURL ) && - ( aRepresentation == rOtherFld.aRepresentation ) && - ( aTargetFrame == rOtherFld.aTargetFrame ) ); -} - -// ----------------------------------------------------------------------- - -void SvxURLField::Load( SvPersistStream & rStm ) -{ - USHORT nFormat; - sal_uInt32 nFrameMarker, nCharSetMarker; - long nUlongSize = (long)sizeof(sal_uInt32); - String aTmpURL; - - rStm >> nFormat; - - // UNICODE: rStm >> aTmpURL; - rStm.ReadByteString(aTmpURL); - - // UNICODE: rStm >> aRepresentation; - // read to a temp string first, read text encoding and - // convert later to stay compatible to fileformat - ByteString aTempString; - rtl_TextEncoding aTempEncoding = RTL_TEXTENCODING_MS_1252; // #101493# Init for old documents - rStm.ReadByteString(aTempString); - - rStm >> nFrameMarker; - if ( nFrameMarker == FRAME_MARKER ) - { - // UNICODE: rStm >> aTargetFrame; - rStm.ReadByteString(aTargetFrame); - - rStm >> nCharSetMarker; - if ( nCharSetMarker == CHARSET_MARKER ) - { - USHORT nCharSet; - rStm >> nCharSet; - - // remember encoding - aTempEncoding = (rtl_TextEncoding)nCharSet; - } - else - rStm.SeekRel( -nUlongSize ); - } - else - rStm.SeekRel( -nUlongSize ); - - // now build representation string due to known encoding - aRepresentation = String(aTempString, aTempEncoding); - - eFormat= (SvxURLFormat)nFormat; - - // Relatives Speichern => Beim laden absolut machen. - DBG_ERROR("No BaseURL!"); - // TODO/MBA: no BaseURL - aURL = INetURLObject::GetAbsURL( String(), aTmpURL ); -} - -// ----------------------------------------------------------------------- - -void SvxURLField::Save( SvPersistStream & rStm ) -{ - // Relatives Speichern der URL - DBG_ERROR("No BaseURL!"); - // TODO/MBA: no BaseURL - String aTmpURL = INetURLObject::GetRelURL( String(), aURL ); - - rStm << (USHORT)eFormat; - - // UNICODE: rStm << aTmpURL; - rStm.WriteByteString(aTmpURL); - - // UNICODE: rStm << aRepresentation; - rStm.WriteByteString(aRepresentation); - - rStm << FRAME_MARKER; - - // UNICODE: rStm << aTargetFrame; - rStm.WriteByteString(aTargetFrame); - - rStm << CHARSET_MARKER; - - // #90477# rStm << (USHORT)GetStoreCharSet(gsl_getSystemTextEncoding(), rStm.GetVersion()); - rStm << (USHORT)GetSOStoreTextEncoding(gsl_getSystemTextEncoding(), (sal_uInt16)rStm.GetVersion()); -} - -MetaAction* SvxURLField::createBeginComment() const -{ - // #i46618# Adding target URL to metafile comment - return new MetaCommentAction( "FIELD_SEQ_BEGIN", - 0, - reinterpret_cast<const BYTE*>(aURL.GetBuffer()), - 2*aURL.Len() ); -} - -// ================================================================= -// Die Felder, die aus Calc ausgebaut wurden: -// ================================================================= - -SV_IMPL_PERSIST1( SvxPageField, SvxFieldData ); - -SvxFieldData* __EXPORT SvxPageField::Clone() const -{ - return new SvxPageField; // leer -} - -int __EXPORT SvxPageField::operator==( const SvxFieldData& rCmp ) const -{ - return ( rCmp.Type() == TYPE(SvxPageField) ); -} - -void __EXPORT SvxPageField::Load( SvPersistStream & /*rStm*/ ) -{ -} - -void __EXPORT SvxPageField::Save( SvPersistStream & /*rStm*/ ) -{ -} - -MetaAction* SvxPageField::createBeginComment() const -{ - return new MetaCommentAction( "FIELD_SEQ_BEGIN;PageField" ); -} - - -SV_IMPL_PERSIST1( SvxPagesField, SvxFieldData ); - -SvxFieldData* __EXPORT SvxPagesField::Clone() const -{ - return new SvxPagesField; // leer -} - -int __EXPORT SvxPagesField::operator==( const SvxFieldData& rCmp ) const -{ - return ( rCmp.Type() == TYPE(SvxPagesField) ); -} - -void __EXPORT SvxPagesField::Load( SvPersistStream & /*rStm*/ ) -{ -} - -void __EXPORT SvxPagesField::Save( SvPersistStream & /*rStm*/ ) -{ -} - -SV_IMPL_PERSIST1( SvxTimeField, SvxFieldData ); - -SvxFieldData* __EXPORT SvxTimeField::Clone() const -{ - return new SvxTimeField; // leer -} - -int __EXPORT SvxTimeField::operator==( const SvxFieldData& rCmp ) const -{ - return ( rCmp.Type() == TYPE(SvxTimeField) ); -} - -void __EXPORT SvxTimeField::Load( SvPersistStream & /*rStm*/ ) -{ -} - -void __EXPORT SvxTimeField::Save( SvPersistStream & /*rStm*/ ) -{ -} - -MetaAction* SvxTimeField::createBeginComment() const -{ - return new MetaCommentAction( "FIELD_SEQ_BEGIN" ); -} - -SV_IMPL_PERSIST1( SvxFileField, SvxFieldData ); - -SvxFieldData* __EXPORT SvxFileField::Clone() const -{ - return new SvxFileField; // leer -} - -int __EXPORT SvxFileField::operator==( const SvxFieldData& rCmp ) const -{ - return ( rCmp.Type() == TYPE(SvxFileField) ); -} - -void __EXPORT SvxFileField::Load( SvPersistStream & /*rStm*/ ) -{ -} - -void __EXPORT SvxFileField::Save( SvPersistStream & /*rStm*/ ) -{ -} - -SV_IMPL_PERSIST1( SvxTableField, SvxFieldData ); - -SvxFieldData* __EXPORT SvxTableField::Clone() const -{ - return new SvxTableField; // leer -} - -int __EXPORT SvxTableField::operator==( const SvxFieldData& rCmp ) const -{ - return ( rCmp.Type() == TYPE(SvxTableField) ); -} - -void __EXPORT SvxTableField::Load( SvPersistStream & /*rStm*/ ) -{ -} - -void __EXPORT SvxTableField::Save( SvPersistStream & /*rStm*/ ) -{ -} - -//---------------------------------------------------------------------------- -// SvxExtTimeField -//---------------------------------------------------------------------------- - -SV_IMPL_PERSIST1( SvxExtTimeField, SvxFieldData ); - -//---------------------------------------------------------------------------- - -SvxExtTimeField::SvxExtTimeField() -{ - nFixTime = Time().GetTime(); - eType = SVXTIMETYPE_VAR; - eFormat = SVXTIMEFORMAT_STANDARD; -} - -//---------------------------------------------------------------------------- - -SvxExtTimeField::SvxExtTimeField( const Time& rTime, SvxTimeType eT, SvxTimeFormat eF ) -{ - nFixTime = rTime.GetTime(); - eType = eT; - eFormat = eF; -} - -//---------------------------------------------------------------------------- - -SvxFieldData* SvxExtTimeField::Clone() const -{ - return new SvxExtTimeField( *this ); -} - -//---------------------------------------------------------------------------- - -int SvxExtTimeField::operator==( const SvxFieldData& rOther ) const -{ - if ( rOther.Type() != Type() ) - return FALSE; - - const SvxExtTimeField& rOtherFld = (const SvxExtTimeField&) rOther; - return ( ( nFixTime == rOtherFld.nFixTime ) && - ( eType == rOtherFld.eType ) && - ( eFormat == rOtherFld.eFormat ) ); -} - -//---------------------------------------------------------------------------- - -void SvxExtTimeField::Load( SvPersistStream & rStm ) -{ - USHORT nType, nFormat; - - rStm >> nFixTime; - rStm >> nType; - rStm >> nFormat; - - eType = (SvxTimeType) nType; - eFormat= (SvxTimeFormat) nFormat; -} - -//---------------------------------------------------------------------------- - -void SvxExtTimeField::Save( SvPersistStream & rStm ) -{ - rStm << nFixTime; - rStm << (USHORT) eType; - rStm << (USHORT) eFormat; -} - -//---------------------------------------------------------------------------- - -String SvxExtTimeField::GetFormatted( SvNumberFormatter& rFormatter, LanguageType eLang ) const -{ - Time aTime; // current time - if ( eType == SVXTIMETYPE_FIX ) - aTime.SetTime( nFixTime ); - return GetFormatted( aTime, eFormat, rFormatter, eLang ); -} - -String SvxExtTimeField::GetFormatted( Time& aTime, SvxTimeFormat eFormat, SvNumberFormatter& rFormatter, LanguageType eLang ) -{ - switch( eFormat ) - { - case SVXTIMEFORMAT_SYSTEM : - DBG_ERROR( "SVXTIMEFORMAT_SYSTEM: not implemented" ); - eFormat = SVXTIMEFORMAT_STANDARD; - break; - case SVXTIMEFORMAT_APPDEFAULT : - DBG_ERROR( "SVXTIMEFORMAT_APPDEFAULT: not implemented" ); - eFormat = SVXTIMEFORMAT_STANDARD; - break; - default: ;//prevent warning - } - - sal_uInt32 nFormatKey; - - switch( eFormat ) - { - case SVXTIMEFORMAT_12_HM: - nFormatKey = rFormatter.GetFormatIndex( NF_TIME_HHMMAMPM, eLang ); - break; - case SVXTIMEFORMAT_12_HMSH: - { // no builtin format available, try to insert or reuse - String aFormatCode( RTL_CONSTASCII_USTRINGPARAM( "HH:MM:SS.00 AM/PM" ) ); - xub_StrLen nCheckPos; - short nType; - /*BOOL bInserted = */rFormatter.PutandConvertEntry( aFormatCode, - nCheckPos, nType, nFormatKey, LANGUAGE_ENGLISH_US, eLang ); - DBG_ASSERT( nCheckPos == 0, "SVXTIMEFORMAT_12_HMSH: could not insert format code" ); - if ( nCheckPos ) - nFormatKey = rFormatter.GetFormatIndex( NF_TIME_HH_MMSS00, eLang ); - } - break; - case SVXTIMEFORMAT_24_HM: - nFormatKey = rFormatter.GetFormatIndex( NF_TIME_HHMM, eLang ); - break; - case SVXTIMEFORMAT_24_HMSH: - nFormatKey = rFormatter.GetFormatIndex( NF_TIME_HH_MMSS00, eLang ); - break; - case SVXTIMEFORMAT_12_HMS: - nFormatKey = rFormatter.GetFormatIndex( NF_TIME_HHMMSSAMPM, eLang ); - break; - case SVXTIMEFORMAT_24_HMS: - nFormatKey = rFormatter.GetFormatIndex( NF_TIME_HHMMSS, eLang ); - break; - case SVXTIMEFORMAT_STANDARD: - default: - nFormatKey = rFormatter.GetStandardFormat( NUMBERFORMAT_TIME, eLang ); - } - - double fFracTime = aTime.GetTimeInDays(); - String aStr; - Color* pColor = NULL; - rFormatter.GetOutputString( fFracTime, nFormatKey, aStr, &pColor ); - return aStr; -} - -MetaAction* SvxExtTimeField::createBeginComment() const -{ - return new MetaCommentAction( "FIELD_SEQ_BEGIN" ); -} - -//---------------------------------------------------------------------------- -// SvxExtFileField -//---------------------------------------------------------------------------- - -SV_IMPL_PERSIST1( SvxExtFileField, SvxFieldData ); - -//---------------------------------------------------------------------------- - -SvxExtFileField::SvxExtFileField() -{ - eType = SVXFILETYPE_VAR; - eFormat = SVXFILEFORMAT_FULLPATH; -} - -//---------------------------------------------------------------------------- - -SvxExtFileField::SvxExtFileField( const XubString& rStr, SvxFileType eT, SvxFileFormat eF ) -{ - aFile = rStr; - eType = eT; - eFormat = eF; -} - -//---------------------------------------------------------------------------- - -SvxFieldData* SvxExtFileField::Clone() const -{ - return new SvxExtFileField( *this ); -} - -//---------------------------------------------------------------------------- - -int SvxExtFileField::operator==( const SvxFieldData& rOther ) const -{ - if ( rOther.Type() != Type() ) - return FALSE; - - const SvxExtFileField& rOtherFld = (const SvxExtFileField&) rOther; - return ( ( aFile == rOtherFld.aFile ) && - ( eType == rOtherFld.eType ) && - ( eFormat == rOtherFld.eFormat ) ); -} - -//---------------------------------------------------------------------------- - -void SvxExtFileField::Load( SvPersistStream & rStm ) -{ - USHORT nType, nFormat; - - // UNICODE: rStm >> aFile; - rStm.ReadByteString(aFile); - - rStm >> nType; - rStm >> nFormat; - - eType = (SvxFileType) nType; - eFormat= (SvxFileFormat) nFormat; -} - -//---------------------------------------------------------------------------- - -void SvxExtFileField::Save( SvPersistStream & rStm ) -{ - // UNICODE: rStm << aFile; - rStm.WriteByteString(aFile); - - rStm << (USHORT) eType; - rStm << (USHORT) eFormat; -} - -//---------------------------------------------------------------------------- - -XubString SvxExtFileField::GetFormatted() const -{ - XubString aString; - - INetURLObject aURLObj( aFile ); - - if( INET_PROT_NOT_VALID == aURLObj.GetProtocol() ) - { - // invalid? try to interpret string as system file name - String aURLStr; - - ::utl::LocalFileHelper::ConvertPhysicalNameToURL( aFile, aURLStr ); - - aURLObj.SetURL( aURLStr ); - } - - // #92009# Be somewhat liberate when trying to - // get formatted content out of the FileField - if( INET_PROT_NOT_VALID == aURLObj.GetProtocol() ) - { - // still not valid? Then output as is - aString = aFile; - } - else if( INET_PROT_FILE == aURLObj.GetProtocol() ) - { - switch( eFormat ) - { - case SVXFILEFORMAT_FULLPATH: - aString = aURLObj.getFSysPath(INetURLObject::FSYS_DETECT); - break; - - case SVXFILEFORMAT_PATH: - aURLObj.removeSegment(INetURLObject::LAST_SEGMENT, false); - // #101742# Leave trailing slash at the pathname - aURLObj.setFinalSlash(); - aString = aURLObj.getFSysPath(INetURLObject::FSYS_DETECT); - break; - - case SVXFILEFORMAT_NAME: - aString = aURLObj.getBase(INetURLObject::LAST_SEGMENT,true,INetURLObject::DECODE_UNAMBIGUOUS); - break; - - case SVXFILEFORMAT_NAME_EXT: - aString = aURLObj.getName(INetURLObject::LAST_SEGMENT,true,INetURLObject::DECODE_UNAMBIGUOUS); - break; - } - } - else - { - switch( eFormat ) - { - case SVXFILEFORMAT_FULLPATH: - aString = aURLObj.GetMainURL( INetURLObject::DECODE_TO_IURI ); - break; - - case SVXFILEFORMAT_PATH: - aURLObj.removeSegment(INetURLObject::LAST_SEGMENT, false); - // #101742# Leave trailing slash at the pathname - aURLObj.setFinalSlash(); - aString = aURLObj.GetMainURL( INetURLObject::DECODE_TO_IURI ); - break; - - case SVXFILEFORMAT_NAME: - aString = aURLObj.getBase(); - break; - - case SVXFILEFORMAT_NAME_EXT: - aString = aURLObj.getName(); - break; - } - } - - return( aString ); -} - -//---------------------------------------------------------------------------- -// SvxAuthorField -//---------------------------------------------------------------------------- - -SV_IMPL_PERSIST1( SvxAuthorField, SvxFieldData ); - -//---------------------------------------------------------------------------- - -SvxAuthorField::SvxAuthorField() -{ - eType = SVXAUTHORTYPE_VAR; - eFormat = SVXAUTHORFORMAT_FULLNAME; -} - -//---------------------------------------------------------------------------- - -SvxAuthorField::SvxAuthorField( const XubString& rFirstName, - const XubString& rLastName, - const XubString& rShortName, - SvxAuthorType eT, SvxAuthorFormat eF ) -{ - aName = rLastName; - aFirstName = rFirstName; - aShortName = rShortName; - eType = eT; - eFormat = eF; -} - -//---------------------------------------------------------------------------- - -SvxFieldData* SvxAuthorField::Clone() const -{ - return new SvxAuthorField( *this ); -} - -//---------------------------------------------------------------------------- - -int SvxAuthorField::operator==( const SvxFieldData& rOther ) const -{ - if ( rOther.Type() != Type() ) - return FALSE; - - const SvxAuthorField& rOtherFld = (const SvxAuthorField&) rOther; - return ( ( aName == rOtherFld.aName ) && - ( aFirstName == rOtherFld.aFirstName ) && - ( aShortName == rOtherFld.aShortName ) && - ( eType == rOtherFld.eType ) && - ( eFormat == rOtherFld.eFormat ) ); -} - -//---------------------------------------------------------------------------- - -void SvxAuthorField::Load( SvPersistStream & rStm ) -{ - USHORT nType, nFormat; - - // UNICODE: rStm >> aName; - rStm.ReadByteString(aName); - - // UNICODE: rStm >> aFirstName; - rStm.ReadByteString(aFirstName); - - // UNICODE: rStm >> aShortName; - rStm.ReadByteString(aShortName); - - rStm >> nType; - rStm >> nFormat; - - eType = (SvxAuthorType) nType; - eFormat= (SvxAuthorFormat) nFormat; -} - -//---------------------------------------------------------------------------- - -void SvxAuthorField::Save( SvPersistStream & rStm ) -{ - // UNICODE: rStm << aName; - rStm.WriteByteString(aName); - - // UNICODE: rStm << aFirstName; - rStm.WriteByteString(aFirstName); - - // UNICODE: rStm << aShortName; - rStm.WriteByteString(aShortName); - - rStm << (USHORT) eType; - rStm << (USHORT) eFormat; -} - -//---------------------------------------------------------------------------- - -XubString SvxAuthorField::GetFormatted() const -{ - XubString aString; - - switch( eFormat ) - { - case SVXAUTHORFORMAT_FULLNAME: - aString = aFirstName; - aString += sal_Unicode(' '); - aString += aName; - break; - - case SVXAUTHORFORMAT_NAME: - aString = aName; - break; - - case SVXAUTHORFORMAT_FIRSTNAME: - aString = aFirstName; - break; - - case SVXAUTHORFORMAT_SHORTNAME: - aString = aShortName; - break; - } - - return( aString ); -} - -static SvClassManager* pClassMgr=0; - -SvClassManager& SvxFieldItem::GetClassManager() -{ - if ( !pClassMgr ) - { - pClassMgr = new SvClassManager; - pClassMgr->SV_CLASS_REGISTER( SvxFieldData ); - pClassMgr->SV_CLASS_REGISTER( SvxURLField ); - pClassMgr->SV_CLASS_REGISTER( SvxDateField ); - pClassMgr->SV_CLASS_REGISTER( SvxPageField ); - pClassMgr->SV_CLASS_REGISTER( SvxTimeField ); - pClassMgr->SV_CLASS_REGISTER( SvxExtTimeField ); - pClassMgr->SV_CLASS_REGISTER( SvxExtFileField ); - pClassMgr->SV_CLASS_REGISTER( SvxAuthorField ); - } - - return *pClassMgr; -} - -/////////////////////////////////////////////////////////////////////// - -SV_IMPL_PERSIST1( SvxHeaderField, SvxFieldData ); - -SvxFieldData* __EXPORT SvxHeaderField::Clone() const -{ - return new SvxHeaderField; // leer -} - -int __EXPORT SvxHeaderField::operator==( const SvxFieldData& rCmp ) const -{ - return ( rCmp.Type() == TYPE(SvxHeaderField) ); -} - -void __EXPORT SvxHeaderField::Load( SvPersistStream & /*rStm*/ ) -{ -} - -void __EXPORT SvxHeaderField::Save( SvPersistStream & /*rStm*/ ) -{ -} - -/////////////////////////////////////////////////////////////////////// - -SV_IMPL_PERSIST1( SvxFooterField, SvxFieldData ); - -SvxFieldData* __EXPORT SvxFooterField::Clone() const -{ - return new SvxFooterField; // leer -} - -int __EXPORT SvxFooterField::operator==( const SvxFieldData& rCmp ) const -{ - return ( rCmp.Type() == TYPE(SvxFooterField) ); -} - -void __EXPORT SvxFooterField::Load( SvPersistStream & /*rStm*/ ) -{ -} - -void __EXPORT SvxFooterField::Save( SvPersistStream & /*rStm*/ ) -{ -} - -/////////////////////////////////////////////////////////////////////// - -SV_IMPL_PERSIST1( SvxDateTimeField, SvxFieldData ); - -SvxFieldData* __EXPORT SvxDateTimeField::Clone() const -{ - return new SvxDateTimeField; // leer -} - -int __EXPORT SvxDateTimeField::operator==( const SvxFieldData& rCmp ) const -{ - return ( rCmp.Type() == TYPE(SvxDateTimeField) ); -} - -void __EXPORT SvxDateTimeField::Load( SvPersistStream & /*rStm*/ ) -{ -} - -void __EXPORT SvxDateTimeField::Save( SvPersistStream & /*rStm*/ ) -{ -} - -String SvxDateTimeField::GetFormatted( Date& rDate, Time& rTime, int eFormat, SvNumberFormatter& rFormatter, LanguageType eLanguage ) -{ - String aRet; - - SvxDateFormat eDateFormat = (SvxDateFormat)(eFormat & 0x0f); - - if(eDateFormat) - { - aRet = SvxDateField::GetFormatted( rDate, eDateFormat, rFormatter, eLanguage ); - } - - SvxTimeFormat eTimeFormat = (SvxTimeFormat)((eFormat >> 4) & 0x0f); - - if(eTimeFormat) - { - if(aRet.Len()) - aRet += sal_Unicode(' '); - - aRet += SvxExtTimeField::GetFormatted( rTime, eTimeFormat, rFormatter, eLanguage ); - } - - return aRet; -} - diff --git a/svx/source/items/frmitems.cxx b/svx/source/items/frmitems.cxx deleted file mode 100644 index 95d27d0341c3..000000000000 --- a/svx/source/items/frmitems.cxx +++ /dev/null @@ -1,4580 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: frmitems.cxx,v $ - * $Revision: 1.53 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svx.hxx" - -// include --------------------------------------------------------------- -#include <com/sun/star/uno/Any.hxx> -#include <com/sun/star/script/XTypeConverter.hpp> - -#include <limits.h> -#include <comphelper/processfactory.hxx> - - -#include <goodies/grfmgr.hxx> -#include <tools/urlobj.hxx> -#ifndef SVX_LIGHT -#ifndef _SFXDOCFILE_HXX //autogen -#include <sfx2/docfile.hxx> -#endif -#include <sfx2/objsh.hxx> -#endif // !SVX_LIGHT -#include <basic/sbx.hxx> -#define GLOBALOVERFLOW3 - -#define _SVX_FRMITEMS_CXX - -#include <svl/memberid.hrc> -#include <svtools/wallitem.hxx> -#include <svl/cntwall.hxx> - -#include <rtl/ustring.hxx> -#include <rtl/ustrbuf.hxx> - -#include <svx/impgrf.hxx> -#include <svx/svxids.hrc> -#include <svx/svxitems.hrc> -#include <svx/dialogs.hrc> - -#include <svx/pbinitem.hxx> -#include <svx/sizeitem.hxx> -#include <svx/lrspitem.hxx> -#include <svx/ulspitem.hxx> -#include "prntitem.hxx" -#include "opaqitem.hxx" -#include "protitem.hxx" -#include <svx/shaditem.hxx> -#include <svx/boxitem.hxx> -#include <svx/brkitem.hxx> -#include <svx/keepitem.hxx> -#include "bolnitem.hxx" -#include <svx/brshitem.hxx> -//CHINA001 #include "backgrnd.hxx" -#include <svx/frmdiritem.hxx> - -#include <svx/itemtype.hxx> -#include <svx/dialmgr.hxx> -#include "svxerr.hxx" -#include <svx/unoprnms.hxx> -#include <com/sun/star/table/BorderLine.hpp> -#include <com/sun/star/table/CellVertJustify.hpp> -#include <com/sun/star/table/ShadowLocation.hpp> -#include <com/sun/star/table/TableBorder.hpp> -#include <com/sun/star/table/ShadowFormat.hpp> -#include <com/sun/star/table/CellRangeAddress.hpp> -#include <com/sun/star/table/CellContentType.hpp> -#include <com/sun/star/table/TableOrientation.hpp> -#include <com/sun/star/table/CellHoriJustify.hpp> -#include <com/sun/star/util/SortField.hpp> -#include <com/sun/star/util/SortFieldType.hpp> -#include <com/sun/star/table/CellOrientation.hpp> -#include <com/sun/star/table/CellAddress.hpp> -#include <com/sun/star/style/PageStyleLayout.hpp> -#include <com/sun/star/style/BreakType.hpp> -#include <com/sun/star/style/GraphicLocation.hpp> -#include <com/sun/star/awt/Rectangle.hpp> -#include <com/sun/star/awt/Selection.hpp> -#include <com/sun/star/awt/Size.hpp> -#include <com/sun/star/text/WritingMode2.hpp> -#include <com/sun/star/frame/status/UpperLowerMarginScale.hpp> - -#include <comphelper/types.hxx> -#include <svx/unomid.hxx> - -using namespace ::rtl; -using namespace ::com::sun::star; - - -// Konvertierung fuer UNO -#define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L)) -#define MM100_TO_TWIP(MM100) ((MM100) >= 0 ? (((MM100)*72L+63L)/127L) : (((MM100)*72L-63L)/127L)) -#define TWIP_TO_MM100_UNSIGNED(TWIP) ((((TWIP)*127L+36L)/72L)) -#define MM100_TO_TWIP_UNSIGNED(MM100) ((((MM100)*72L+63L)/127L)) - -// STATIC DATA ----------------------------------------------------------- - - -inline void SetValueProp( XubString& rStr, const sal_uInt16 nValue, - const sal_uInt16 nProp ) -{ - if( 100 == nProp ) - rStr += String::CreateFromInt32( nValue ); - else - ( rStr += String::CreateFromInt32( nProp )) += sal_Unicode('%'); -} - -inline void SetValueProp( XubString& rStr, const short nValue, - const sal_uInt16 nProp ) -{ - if( 100 == nProp ) - rStr += String::CreateFromInt32( nValue ); - else - ( rStr += String::CreateFromInt32( nProp )) += sal_Unicode('%'); -} - -// ----------------------------------------------------------------------- - -TYPEINIT1_FACTORY(SvxPaperBinItem, SfxByteItem, new SvxPaperBinItem(0)); -TYPEINIT1_FACTORY(SvxSizeItem, SfxPoolItem, new SvxSizeItem(0)); -TYPEINIT1_FACTORY(SvxLRSpaceItem, SfxPoolItem, new SvxLRSpaceItem(0)); -TYPEINIT1_FACTORY(SvxULSpaceItem, SfxPoolItem, new SvxULSpaceItem(0)); -TYPEINIT1_FACTORY(SvxPrintItem, SfxBoolItem, new SvxPrintItem(0)); -TYPEINIT1_FACTORY(SvxOpaqueItem, SfxBoolItem, new SvxOpaqueItem(0)); -TYPEINIT1_FACTORY(SvxProtectItem, SfxPoolItem, new SvxProtectItem(0)); -TYPEINIT1_FACTORY(SvxBrushItem, SfxPoolItem, new SvxBrushItem(0)); -TYPEINIT1_FACTORY(SvxShadowItem, SfxPoolItem, new SvxShadowItem(0)); -TYPEINIT1_FACTORY(SvxBoxItem, SfxPoolItem, new SvxBoxItem(0)); -TYPEINIT1_FACTORY(SvxBoxInfoItem, SfxPoolItem, new SvxBoxInfoItem(0)); -TYPEINIT1_FACTORY(SvxFmtBreakItem, SfxEnumItem, new SvxFmtBreakItem(SVX_BREAK_NONE, 0)); -TYPEINIT1_FACTORY(SvxFmtKeepItem, SfxBoolItem, new SvxFmtKeepItem(sal_False, 0)); -TYPEINIT1_FACTORY(SvxLineItem, SfxPoolItem, new SvxLineItem(0)); -TYPEINIT1_FACTORY(SvxFrameDirectionItem, SfxUInt16Item, new SvxFrameDirectionItem(FRMDIR_HORI_LEFT_TOP, 0)); - - -// class SvxPaperBinItem ------------------------------------------------ - -SfxPoolItem* SvxPaperBinItem::Clone( SfxItemPool* ) const -{ - return new SvxPaperBinItem( *this ); -} - -// ----------------------------------------------------------------------- - -SvStream& SvxPaperBinItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const -{ - rStrm << GetValue(); - return rStrm; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxPaperBinItem::Create( SvStream& rStrm, sal_uInt16 ) const -{ - sal_Int8 nBin; - rStrm >> nBin; - return new SvxPaperBinItem( Which(), nBin ); -} - -// ----------------------------------------------------------------------- - -SfxItemPresentation SvxPaperBinItem::GetPresentation -( - SfxItemPresentation ePres, - SfxMapUnit /*eCoreUnit*/, - SfxMapUnit /*ePresUnit*/, - XubString& rText, const IntlWrapper * -) const -{ -#ifndef SVX_LIGHT - switch ( ePres ) - { - case SFX_ITEM_PRESENTATION_NONE: - rText.Erase(); - return SFX_ITEM_PRESENTATION_NONE; - - case SFX_ITEM_PRESENTATION_NAMELESS: - rText = String::CreateFromInt32( GetValue() ); - return SFX_ITEM_PRESENTATION_NAMELESS; - - case SFX_ITEM_PRESENTATION_COMPLETE: - { - BYTE nValue = GetValue(); - - if ( PAPERBIN_PRINTER_SETTINGS == nValue ) - rText = SVX_RESSTR(RID_SVXSTR_PAPERBIN_SETTINGS); - else - { - rText = SVX_RESSTR(RID_SVXSTR_PAPERBIN); - rText += sal_Unicode(' '); - rText += String::CreateFromInt32( nValue ); - } - return SFX_ITEM_PRESENTATION_COMPLETE; - } - //no break necessary - default: ;//prevent warning - } -#endif // !SVX_LIGHT - return SFX_ITEM_PRESENTATION_NONE; -} - -// class SvxSizeItem ----------------------------------------------------- - -SvxSizeItem::SvxSizeItem( const sal_uInt16 nId, const Size& rSize ) : - - SfxPoolItem( nId ), - - aSize( rSize ) -{ -} - -// ----------------------------------------------------------------------- -sal_Bool SvxSizeItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const -{ - sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); - nMemberId &= ~CONVERT_TWIPS; - - awt::Size aTmp(aSize.Width(), aSize.Height()); - if( bConvert ) - { - aTmp.Height = TWIP_TO_MM100(aTmp.Height); - aTmp.Width = TWIP_TO_MM100(aTmp.Width); - } - - switch( nMemberId ) - { - case MID_SIZE_SIZE: rVal <<= aTmp; break; - case MID_SIZE_WIDTH: rVal <<= aTmp.Width; break; - case MID_SIZE_HEIGHT: rVal <<= aTmp.Height; break; - default: DBG_ERROR("Wrong MemberId!"); return sal_False; - } - - return sal_True; -} -// ----------------------------------------------------------------------- -sal_Bool SvxSizeItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) -{ - sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); - nMemberId &= ~CONVERT_TWIPS; - - switch( nMemberId ) - { - case MID_SIZE_SIZE: - { - awt::Size aTmp; - if( rVal >>= aTmp ) - { - if(bConvert) - { - aTmp.Height = MM100_TO_TWIP(aTmp.Height); - aTmp.Width = MM100_TO_TWIP(aTmp.Width); - } - aSize = Size( aTmp.Width, aTmp.Height ); - } - else - { - return sal_False; - } - } - break; - case MID_SIZE_WIDTH: - { - sal_Int32 nVal = 0; - if(!(rVal >>= nVal )) - return sal_False; - - aSize.Width() = bConvert ? MM100_TO_TWIP(nVal) : nVal; - } - break; - case MID_SIZE_HEIGHT: - { - sal_Int32 nVal = 0; - if(!(rVal >>= nVal)) - return sal_True; - - aSize.Height() = bConvert ? MM100_TO_TWIP(nVal) : nVal; - } - break; - default: DBG_ERROR("Wrong MemberId!"); - return sal_False; - } - return sal_True; -} - -// ----------------------------------------------------------------------- - -SvxSizeItem::SvxSizeItem( const sal_uInt16 nId ) : - - SfxPoolItem( nId ) -{ -} - -// ----------------------------------------------------------------------- - -int SvxSizeItem::operator==( const SfxPoolItem& rAttr ) const -{ - DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" ); - - return ( aSize == ( (SvxSizeItem&)rAttr ).GetSize() ); -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxSizeItem::Clone( SfxItemPool* ) const -{ - return new SvxSizeItem( *this ); -} - -//------------------------------------------------------------------------ - -SfxItemPresentation SvxSizeItem::GetPresentation -( - SfxItemPresentation ePres, - SfxMapUnit eCoreUnit, - SfxMapUnit ePresUnit, - XubString& rText, const IntlWrapper *pIntl -) const -{ -#ifndef SVX_LIGHT - switch ( ePres ) - { - case SFX_ITEM_PRESENTATION_NONE: - rText.Erase(); - return SFX_ITEM_PRESENTATION_NONE; - - case SFX_ITEM_PRESENTATION_NAMELESS: - rText = GetMetricText( aSize.Width(), eCoreUnit, ePresUnit, pIntl ); - rText += cpDelim; - rText += GetMetricText( aSize.Height(), eCoreUnit, ePresUnit, pIntl ); - return SFX_ITEM_PRESENTATION_NAMELESS; - - case SFX_ITEM_PRESENTATION_COMPLETE: - rText = SVX_RESSTR(RID_SVXITEMS_SIZE_WIDTH); - rText += GetMetricText( aSize.Width(), eCoreUnit, ePresUnit, pIntl ); - rText += SVX_RESSTR(GetMetricId(ePresUnit)); - rText += cpDelim; - rText += SVX_RESSTR(RID_SVXITEMS_SIZE_HEIGHT); - rText += GetMetricText( aSize.Height(), eCoreUnit, ePresUnit, pIntl ); - rText += SVX_RESSTR(GetMetricId(ePresUnit)); - return SFX_ITEM_PRESENTATION_COMPLETE; - //no break necessary - default: ;//prevent warning - - } -#endif // !SVX_LIGHT - return SFX_ITEM_PRESENTATION_NONE; -} - -// ----------------------------------------------------------------------- - -SvStream& SvxSizeItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const -{ - rStrm << aSize.Width(); - rStrm << aSize.Height(); - return rStrm; -} - -// ----------------------------------------------------------------------- - -int SvxSizeItem::ScaleMetrics( long nMult, long nDiv ) -{ - aSize.Width() = Scale( aSize.Width(), nMult, nDiv ); - aSize.Height() = Scale( aSize.Height(), nMult, nDiv ); - return 1; -} - -// ----------------------------------------------------------------------- - -int SvxSizeItem::HasMetrics() const -{ - return 1; -} - -// ----------------------------------------------------------------------- - - -SfxPoolItem* SvxSizeItem::Create( SvStream& rStrm, sal_uInt16 ) const -{ - long nWidth, nHeight; - rStrm >> nWidth >> nHeight; - - SvxSizeItem* pAttr = new SvxSizeItem( Which() ); - pAttr->SetSize(Size(nWidth, nHeight)); - - return pAttr; -} - -// class SvxLRSpaceItem -------------------------------------------------- - -SvxLRSpaceItem::SvxLRSpaceItem( const sal_uInt16 nId ) : - - SfxPoolItem( nId ), - - nFirstLineOfst ( 0 ), - nTxtLeft ( 0 ), - nLeftMargin ( 0 ), - nRightMargin ( 0 ), - nPropFirstLineOfst( 100 ), - nPropLeftMargin( 100 ), - nPropRightMargin( 100 ), - bAutoFirst ( 0 ) -{ -} - -// ----------------------------------------------------------------------- - -SvxLRSpaceItem::SvxLRSpaceItem( const long nLeft, const long nRight, - const long nTLeft, const short nOfset, - const sal_uInt16 nId ) : - - SfxPoolItem( nId ), - - nFirstLineOfst ( nOfset ), - nTxtLeft ( nTLeft ), - nLeftMargin ( nLeft ), - nRightMargin ( nRight ), - nPropFirstLineOfst( 100 ), - nPropLeftMargin( 100 ), - nPropRightMargin( 100 ), - bAutoFirst ( 0 ) -{ -} - -// ----------------------------------------------------------------------- -sal_Bool SvxLRSpaceItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const -{ - sal_Bool bRet = sal_True; - sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); - nMemberId &= ~CONVERT_TWIPS; - switch( nMemberId ) - { - // jetzt alles signed - case MID_L_MARGIN: - rVal <<= (sal_Int32)(bConvert ? TWIP_TO_MM100(nLeftMargin) : nLeftMargin); - break; - - case MID_TXT_LMARGIN : - rVal <<= (sal_Int32)(bConvert ? TWIP_TO_MM100(nTxtLeft) : nTxtLeft); - break; - case MID_R_MARGIN: - rVal <<= (sal_Int32)(bConvert ? TWIP_TO_MM100(nRightMargin) : nRightMargin); - break; - case MID_L_REL_MARGIN: - rVal <<= (sal_Int16)nPropLeftMargin; - break; - case MID_R_REL_MARGIN: - rVal <<= (sal_Int16)nPropRightMargin; - break; - - case MID_FIRST_LINE_INDENT: - rVal <<= (sal_Int32)(bConvert ? TWIP_TO_MM100(nFirstLineOfst) : nFirstLineOfst); - break; - - case MID_FIRST_LINE_REL_INDENT: - rVal <<= (sal_Int16)(nPropFirstLineOfst); - break; - - case MID_FIRST_AUTO: - rVal = Bool2Any(IsAutoFirst()); - break; - - default: - bRet = sal_False; - DBG_ERROR("unknown MemberId"); - } - return bRet; -} - -// ----------------------------------------------------------------------- -sal_Bool SvxLRSpaceItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) -{ - sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); - nMemberId &= ~CONVERT_TWIPS; - sal_Int32 nVal = 0; - if( nMemberId != MID_FIRST_AUTO && - nMemberId != MID_L_REL_MARGIN && nMemberId != MID_R_REL_MARGIN) - if(!(rVal >>= nVal)) - return sal_False; - - switch( nMemberId ) - { - case MID_L_MARGIN: - SetLeft((sal_Int32)bConvert ? MM100_TO_TWIP(nVal) : nVal); - break; - - case MID_TXT_LMARGIN : - SetTxtLeft((sal_Int32)bConvert ? MM100_TO_TWIP(nVal) : nVal); - break; - - case MID_R_MARGIN: - SetRight((sal_Int32) bConvert ? MM100_TO_TWIP(nVal) : nVal); - break; - case MID_L_REL_MARGIN: - case MID_R_REL_MARGIN: - { - sal_Int32 nRel = 0; - if((rVal >>= nRel) && nRel >= 0 && nRel < USHRT_MAX) - { - if(MID_L_REL_MARGIN== nMemberId) - nPropLeftMargin = (USHORT)nRel; - else - nPropRightMargin = (USHORT)nRel; - } - else - return FALSE; - } - break; - case MID_FIRST_LINE_INDENT : - SetTxtFirstLineOfst((short)(bConvert ? MM100_TO_TWIP(nVal) : nVal)); - break; - - case MID_FIRST_LINE_REL_INDENT: - SetPropTxtFirstLineOfst ( (USHORT)nVal ); - break; - - case MID_FIRST_AUTO: - SetAutoFirst( Any2Bool(rVal) ); - break; - - default: - DBG_ERROR("unknown MemberId"); - return sal_False; - } - return sal_True; -} - -// ----------------------------------------------------------------------- - -// nLeftMargin und nTxtLeft anpassen. - -void SvxLRSpaceItem::AdjustLeft() -{ - if ( 0 > nFirstLineOfst ) - nLeftMargin = nTxtLeft + nFirstLineOfst; - else - nLeftMargin = nTxtLeft; -} - -// ----------------------------------------------------------------------- - -int SvxLRSpaceItem::operator==( const SfxPoolItem& rAttr ) const -{ - DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" ); - - return ( - nLeftMargin == ((SvxLRSpaceItem&)rAttr).GetLeft() && - nRightMargin == ((SvxLRSpaceItem&)rAttr).GetRight() && - nFirstLineOfst == ((SvxLRSpaceItem&)rAttr).GetTxtFirstLineOfst() && - nPropLeftMargin == ((SvxLRSpaceItem&)rAttr).GetPropLeft() && - nPropRightMargin == ((SvxLRSpaceItem&)rAttr).GetPropRight() && - nPropFirstLineOfst == ((SvxLRSpaceItem&)rAttr).GetPropTxtFirstLineOfst() && - bAutoFirst == ((SvxLRSpaceItem&)rAttr).IsAutoFirst() ); -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxLRSpaceItem::Clone( SfxItemPool* ) const -{ - return new SvxLRSpaceItem( *this ); -} - -//------------------------------------------------------------------------ - -SfxItemPresentation SvxLRSpaceItem::GetPresentation -( - SfxItemPresentation ePres, - SfxMapUnit eCoreUnit, - SfxMapUnit ePresUnit, - XubString& rText, const IntlWrapper* pIntl -) const -{ -#ifndef SVX_LIGHT - switch ( ePres ) - { - case SFX_ITEM_PRESENTATION_NONE: - rText.Erase(); - return SFX_ITEM_PRESENTATION_NONE; - case SFX_ITEM_PRESENTATION_NAMELESS: - { - if ( 100 != nPropLeftMargin ) - ( rText = String::CreateFromInt32( nPropLeftMargin )) += sal_Unicode('%'); - else - rText = GetMetricText( (long)nLeftMargin, - eCoreUnit, ePresUnit, pIntl ); - rText += cpDelim; - if ( 100 != nPropFirstLineOfst ) - ( rText += String::CreateFromInt32( nPropFirstLineOfst )) += sal_Unicode('%'); - else - rText += GetMetricText( (long)nFirstLineOfst, - eCoreUnit, ePresUnit, pIntl ); - rText += cpDelim; - if ( 100 != nRightMargin ) - ( rText += String::CreateFromInt32( nRightMargin )) += sal_Unicode('%'); - else - rText += GetMetricText( (long)nRightMargin, - eCoreUnit, ePresUnit, pIntl ); - return SFX_ITEM_PRESENTATION_NAMELESS; - } - case SFX_ITEM_PRESENTATION_COMPLETE: - { - rText = SVX_RESSTR(RID_SVXITEMS_LRSPACE_LEFT); - if ( 100 != nPropLeftMargin ) - ( rText += String::CreateFromInt32( nPropLeftMargin )) += sal_Unicode('%'); - else - { - rText += GetMetricText( (long)nLeftMargin, - eCoreUnit, ePresUnit, pIntl ); - rText += SVX_RESSTR(GetMetricId(ePresUnit)); - } - rText += cpDelim; - if ( 100 != nPropFirstLineOfst || nFirstLineOfst ) - { - rText += SVX_RESSTR(RID_SVXITEMS_LRSPACE_FLINE); - if ( 100 != nPropFirstLineOfst ) - ( rText += String::CreateFromInt32( nPropFirstLineOfst )) - += sal_Unicode('%'); - else - { - rText += GetMetricText( (long)nFirstLineOfst, - eCoreUnit, ePresUnit, pIntl ); - rText += SVX_RESSTR(GetMetricId(ePresUnit)); - } - rText += cpDelim; - } - rText += SVX_RESSTR(RID_SVXITEMS_LRSPACE_RIGHT); - if ( 100 != nPropRightMargin ) - ( rText += String::CreateFromInt32( nPropRightMargin )) += sal_Unicode('%'); - else - { - rText += GetMetricText( (long)nRightMargin, - eCoreUnit, ePresUnit, pIntl ); - rText += SVX_RESSTR(GetMetricId(ePresUnit)); - } - return SFX_ITEM_PRESENTATION_COMPLETE; - } - default: ;//prevent warning - } -#endif // !SVX_LIGHT - return SFX_ITEM_PRESENTATION_NONE; -} - -// ----------------------------------------------------------------------- - -// MT: BulletFI: Vor 501 wurde im Outliner das Bullet nicht auf der Position des -// FI positioniert, deshalb muss in aelteren Dokumenten der FI auf 0 stehen. - -#define BULLETLR_MARKER 0x599401FE - -SvStream& SvxLRSpaceItem::Store( SvStream& rStrm , sal_uInt16 nItemVersion ) const -{ - short nSaveFI = nFirstLineOfst; - ((SvxLRSpaceItem*)this)->SetTxtFirstLineOfst( 0 ); // nLeftMargin wird mitmanipuliert, siehe Create() - - sal_uInt16 nMargin = 0; - if( nLeftMargin > 0 ) - nMargin = sal_uInt16( nLeftMargin ); - rStrm << nMargin; - rStrm << nPropLeftMargin; - if( nRightMargin > 0 ) - nMargin = sal_uInt16( nRightMargin ); - else - nMargin = 0; - rStrm << nMargin; - rStrm << nPropRightMargin; - rStrm << nFirstLineOfst; - rStrm << nPropFirstLineOfst; - if( nTxtLeft > 0 ) - nMargin = sal_uInt16( nTxtLeft ); - else - nMargin = 0; - rStrm << nMargin; - if( nItemVersion >= LRSPACE_AUTOFIRST_VERSION ) - { - sal_Int8 nAutoFirst = bAutoFirst ? 1 : 0; - if( nItemVersion >= LRSPACE_NEGATIVE_VERSION && - ( nLeftMargin < 0 || nRightMargin < 0 || nTxtLeft < 0 ) ) - nAutoFirst |= 0x80; - rStrm << nAutoFirst; - - // Ab 6.0 keine Magicnumber schreiben... - DBG_ASSERT( rStrm.GetVersion() <= SOFFICE_FILEFORMAT_50, "MT: Fileformat SvxLRSpaceItem aendern!" ); - rStrm << (sal_uInt32) BULLETLR_MARKER; - rStrm << nSaveFI; - - if( 0x80 & nAutoFirst ) - { - rStrm << nLeftMargin; - rStrm << nRightMargin; - } - } - - ((SvxLRSpaceItem*)this)->SetTxtFirstLineOfst( nSaveFI ); - - return rStrm; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxLRSpaceItem::Create( SvStream& rStrm, sal_uInt16 nVersion ) const -{ - sal_uInt16 left, prpleft, right, prpright, prpfirstline, txtleft; - short firstline; - sal_Int8 autofirst = 0; - - if ( nVersion >= LRSPACE_AUTOFIRST_VERSION ) - { - rStrm >> left >> prpleft >> right >> prpright >> firstline >> - prpfirstline >> txtleft >> autofirst; - - sal_uInt32 nPos = rStrm.Tell(); - sal_uInt32 nMarker; - rStrm >> nMarker; - if ( nMarker == BULLETLR_MARKER ) - { - rStrm >> firstline; - if ( firstline < 0 ) - left = left + static_cast<sal_uInt16>(firstline); // s.u.: txtleft = ... - } - else - rStrm.Seek( nPos ); - } - else if ( nVersion == LRSPACE_TXTLEFT_VERSION ) - { - rStrm >> left >> prpleft >> right >> prpright >> firstline >> - prpfirstline >> txtleft; - } - else if ( nVersion == LRSPACE_16_VERSION ) - { - rStrm >> left >> prpleft >> right >> prpright >> firstline >> - prpfirstline; - } - else - { - sal_Int8 nL, nR, nFL; - rStrm >> left >> nL >> right >> nR >> firstline >> nFL; - prpleft = (sal_uInt16)nL; - prpright = (sal_uInt16)nR; - prpfirstline = (sal_uInt16)nFL; - } - - txtleft = firstline >= 0 ? left : left - firstline; - SvxLRSpaceItem* pAttr = new SvxLRSpaceItem( Which() ); - - pAttr->nLeftMargin = left; - pAttr->nPropLeftMargin = prpleft; - pAttr->nRightMargin = right; - pAttr->nPropRightMargin = prpright; - pAttr->nFirstLineOfst = firstline; - pAttr->nPropFirstLineOfst = prpfirstline; - pAttr->nTxtLeft = txtleft; - pAttr->bAutoFirst = autofirst & 0x01; - if( nVersion >= LRSPACE_NEGATIVE_VERSION && ( autofirst & 0x80 ) ) - { - sal_Int32 nMargin; - rStrm >> nMargin; - pAttr->nLeftMargin = nMargin; - pAttr->nTxtLeft = firstline >= 0 ? nMargin : nMargin - firstline; - rStrm >> nMargin; - pAttr->nRightMargin = nMargin; - } - return pAttr; -} - -// ----------------------------------------------------------------------- - -sal_uInt16 SvxLRSpaceItem::GetVersion( sal_uInt16 nFileVersion ) const -{ - return (nFileVersion == SOFFICE_FILEFORMAT_31) - ? LRSPACE_TXTLEFT_VERSION - : LRSPACE_NEGATIVE_VERSION; -} - -// ----------------------------------------------------------------------- - -int SvxLRSpaceItem::ScaleMetrics( long nMult, long nDiv ) -{ - nFirstLineOfst = (short)Scale( nFirstLineOfst, nMult, nDiv ); - nTxtLeft = Scale( nTxtLeft, nMult, nDiv ); - nLeftMargin = Scale( nLeftMargin, nMult, nDiv ); - nRightMargin = Scale( nRightMargin, nMult, nDiv ); - return 1; -} - -// ----------------------------------------------------------------------- - -int SvxLRSpaceItem::HasMetrics() const -{ - return 1; -} - -// class SvxULSpaceItem -------------------------------------------------- - -SvxULSpaceItem::SvxULSpaceItem( const sal_uInt16 nId ) : - - SfxPoolItem( nId ), - - nUpper( 0 ), - nLower( 0 ), - nPropUpper( 100 ), - nPropLower( 100 ) -{ -} - -// ----------------------------------------------------------------------- - -SvxULSpaceItem::SvxULSpaceItem( const sal_uInt16 nUp, const sal_uInt16 nLow, - const sal_uInt16 nId ) : - - SfxPoolItem( nId ), - - nUpper( nUp ), - nLower( nLow ), - nPropUpper( 100 ), - nPropLower( 100 ) -{ -} - -// ----------------------------------------------------------------------- -sal_Bool SvxULSpaceItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const -{ - sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); - nMemberId &= ~CONVERT_TWIPS; - switch( nMemberId ) - { - // jetzt alles signed - case 0: - { - ::com::sun::star::frame::status::UpperLowerMarginScale aUpperLowerMarginScale; - aUpperLowerMarginScale.Upper = (sal_Int32)(bConvert ? TWIP_TO_MM100_UNSIGNED(nUpper) : nUpper); - aUpperLowerMarginScale.Lower = (sal_Int32)(bConvert ? TWIP_TO_MM100_UNSIGNED(nLower) : nPropUpper); - aUpperLowerMarginScale.ScaleUpper = (sal_Int16)nPropUpper; - aUpperLowerMarginScale.ScaleLower = (sal_Int16)nPropLower; - rVal <<= aUpperLowerMarginScale; - break; - } - case MID_UP_MARGIN: rVal <<= (sal_Int32)(bConvert ? TWIP_TO_MM100_UNSIGNED(nUpper) : nUpper); break; - case MID_LO_MARGIN: rVal <<= (sal_Int32)(bConvert ? TWIP_TO_MM100_UNSIGNED(nLower) : nLower); break; - case MID_UP_REL_MARGIN: rVal <<= (sal_Int16) nPropUpper; break; - case MID_LO_REL_MARGIN: rVal <<= (sal_Int16) nPropLower; break; - } - return sal_True; -} - -// ----------------------------------------------------------------------- -sal_Bool SvxULSpaceItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) -{ - sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); - nMemberId &= ~CONVERT_TWIPS; - sal_Int32 nVal = 0; - switch( nMemberId ) - { - case 0: - { - ::com::sun::star::frame::status::UpperLowerMarginScale aUpperLowerMarginScale; - if ( !(rVal >>= aUpperLowerMarginScale )) - return sal_False; - { - SetUpper((sal_uInt16)(bConvert ? MM100_TO_TWIP( aUpperLowerMarginScale.Upper ) : aUpperLowerMarginScale.Upper)); - SetLower((sal_uInt16)(bConvert ? MM100_TO_TWIP( aUpperLowerMarginScale.Lower ) : aUpperLowerMarginScale.Lower)); - if( aUpperLowerMarginScale.ScaleUpper > 1 ) - nPropUpper = aUpperLowerMarginScale.ScaleUpper; - if( aUpperLowerMarginScale.ScaleLower > 1 ) - nPropUpper = aUpperLowerMarginScale.ScaleLower; - } - } - - case MID_UP_MARGIN : - if(!(rVal >>= nVal) || nVal < 0) - return sal_False; - SetUpper((USHORT)(bConvert ? MM100_TO_TWIP(nVal) : nVal)); - break; - case MID_LO_MARGIN : - if(!(rVal >>= nVal) || nVal < 0) - return sal_False; - SetLower((USHORT)(bConvert ? MM100_TO_TWIP(nVal) : nVal)); - break; - case MID_UP_REL_MARGIN: - case MID_LO_REL_MARGIN: - { - sal_Int32 nRel = 0; - if((rVal >>= nRel) && nRel > 1 ) - { - if(MID_UP_REL_MARGIN == nMemberId) - nPropUpper = (USHORT)nRel; - else - nPropLower = (USHORT)nRel; - } - else - return FALSE; - } - break; - - - default: - DBG_ERROR("unknown MemberId"); - return sal_False; - } - return sal_True; -} - -// ----------------------------------------------------------------------- - -int SvxULSpaceItem::operator==( const SfxPoolItem& rAttr ) const -{ - DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" ); - - return ( nUpper == ( (SvxULSpaceItem&)rAttr ).nUpper && - nLower == ( (SvxULSpaceItem&)rAttr ).nLower && - nPropUpper == ( (SvxULSpaceItem&)rAttr ).nPropUpper && - nPropLower == ( (SvxULSpaceItem&)rAttr ).nPropLower ); -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxULSpaceItem::Clone( SfxItemPool* ) const -{ - return new SvxULSpaceItem( *this ); -} - -//------------------------------------------------------------------------ - -SfxItemPresentation SvxULSpaceItem::GetPresentation -( - SfxItemPresentation ePres, - SfxMapUnit eCoreUnit, - SfxMapUnit ePresUnit, - XubString& rText, const IntlWrapper *pIntl -) const -{ -#ifndef SVX_LIGHT - switch ( ePres ) - { - case SFX_ITEM_PRESENTATION_NONE: - rText.Erase(); - return SFX_ITEM_PRESENTATION_NONE; - case SFX_ITEM_PRESENTATION_NAMELESS: - { - if ( 100 != nPropUpper ) - ( rText = String::CreateFromInt32( nPropUpper )) += sal_Unicode('%'); - else - rText = GetMetricText( (long)nUpper, eCoreUnit, ePresUnit, pIntl ); - rText += cpDelim; - if ( 100 != nPropLower ) - ( rText += String::CreateFromInt32( nPropLower )) += sal_Unicode('%'); - else - rText += GetMetricText( (long)nLower, eCoreUnit, ePresUnit, pIntl ); - return SFX_ITEM_PRESENTATION_NAMELESS; - } - case SFX_ITEM_PRESENTATION_COMPLETE: - { - rText = SVX_RESSTR(RID_SVXITEMS_ULSPACE_UPPER); - if ( 100 != nPropUpper ) - ( rText += String::CreateFromInt32( nPropUpper )) += sal_Unicode('%'); - else - { - rText += GetMetricText( (long)nUpper, eCoreUnit, ePresUnit, pIntl ); - rText += SVX_RESSTR(GetMetricId(ePresUnit)); - } - rText += cpDelim; - rText += SVX_RESSTR(RID_SVXITEMS_ULSPACE_LOWER); - if ( 100 != nPropLower ) - ( rText += String::CreateFromInt32( nPropLower )) += sal_Unicode('%'); - else - { - rText += GetMetricText( (long)nLower, eCoreUnit, ePresUnit, pIntl ); - rText += SVX_RESSTR(GetMetricId(ePresUnit)); - } - return SFX_ITEM_PRESENTATION_COMPLETE; - } - default: ;//prevent warning - } -#endif - return SFX_ITEM_PRESENTATION_NONE; -} - -// ----------------------------------------------------------------------- - -SvStream& SvxULSpaceItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const -{ - rStrm << GetUpper() - << GetPropUpper() - << GetLower() - << GetPropLower(); - return rStrm; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxULSpaceItem::Create( SvStream& rStrm, sal_uInt16 nVersion ) const -{ - sal_uInt16 upper, lower, nPL = 0, nPU = 0; - - if ( nVersion == ULSPACE_16_VERSION ) - rStrm >> upper >> nPU >> lower >> nPL; - else - { - sal_Int8 nU, nL; - rStrm >> upper >> nU >> lower >> nL; - nPL = (sal_uInt16)nL; - nPU = (sal_uInt16)nU; - } - - SvxULSpaceItem* pAttr = new SvxULSpaceItem( Which() ); - pAttr->SetUpperValue( upper ); - pAttr->SetLowerValue( lower ); - pAttr->SetPropUpper( nPU ); - pAttr->SetPropLower( nPL ); - return pAttr; -} - -// ----------------------------------------------------------------------- - -sal_uInt16 SvxULSpaceItem::GetVersion( sal_uInt16 /*nFileVersion*/ ) const -{ - return ULSPACE_16_VERSION; -} - -// ----------------------------------------------------------------------- - -int SvxULSpaceItem::ScaleMetrics( long nMult, long nDiv ) -{ - nUpper = (sal_uInt16)Scale( nUpper, nMult, nDiv ); - nLower = (sal_uInt16)Scale( nLower, nMult, nDiv ); - return 1; -} - -// ----------------------------------------------------------------------- - -int SvxULSpaceItem::HasMetrics() const -{ - return 1; -} - - -// class SvxPrintItem ---------------------------------------------------- - -SfxPoolItem* SvxPrintItem::Clone( SfxItemPool* ) const -{ - return new SvxPrintItem( *this ); -} - -// ----------------------------------------------------------------------- - -SvStream& SvxPrintItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const -{ - rStrm << (sal_Int8)GetValue(); - return rStrm; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxPrintItem::Create( SvStream& rStrm, sal_uInt16 ) const -{ - sal_Int8 bIsPrint; - rStrm >> bIsPrint; - return new SvxPrintItem( Which(), sal_Bool( bIsPrint != 0 ) ); -} - -//------------------------------------------------------------------------ - -SfxItemPresentation SvxPrintItem::GetPresentation -( - SfxItemPresentation ePres, - SfxMapUnit /*eCoreUnit*/, - SfxMapUnit /*ePresUnit*/, - XubString& rText, const IntlWrapper * -) const -{ -#ifndef SVX_LIGHT - switch ( ePres ) - { - case SFX_ITEM_PRESENTATION_NONE: - rText.Erase(); - return ePres; - - case SFX_ITEM_PRESENTATION_NAMELESS: - case SFX_ITEM_PRESENTATION_COMPLETE: - { - sal_uInt16 nId = RID_SVXITEMS_PRINT_FALSE; - - if ( GetValue() ) - nId = RID_SVXITEMS_PRINT_TRUE; - rText = SVX_RESSTR(nId); - return ePres; - } - default: ;//prevent warning - } -#endif // !SVX_LIGHT - return SFX_ITEM_PRESENTATION_NONE; -} - -// class SvxOpaqueItem --------------------------------------------------- - -SfxPoolItem* SvxOpaqueItem::Clone( SfxItemPool* ) const -{ - return new SvxOpaqueItem( *this ); -} - -// ----------------------------------------------------------------------- - -SvStream& SvxOpaqueItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const -{ - rStrm << (sal_Int8)GetValue(); - return rStrm; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxOpaqueItem::Create( SvStream& rStrm, sal_uInt16 ) const -{ - sal_Int8 bIsOpaque; - rStrm >> bIsOpaque; - return new SvxOpaqueItem( Which(), sal_Bool( bIsOpaque != 0 ) ); -} - -//------------------------------------------------------------------------ - -SfxItemPresentation SvxOpaqueItem::GetPresentation -( - SfxItemPresentation ePres, - SfxMapUnit /*eCoreUnit*/, - SfxMapUnit /*ePresUnit*/, - XubString& rText, const IntlWrapper * -) const -{ -#ifndef SVX_LIGHT - switch ( ePres ) - { - case SFX_ITEM_PRESENTATION_NONE: - rText.Erase(); - return ePres; - - case SFX_ITEM_PRESENTATION_NAMELESS: - case SFX_ITEM_PRESENTATION_COMPLETE: - { - sal_uInt16 nId = RID_SVXITEMS_OPAQUE_FALSE; - - if ( GetValue() ) - nId = RID_SVXITEMS_OPAQUE_TRUE; - rText = SVX_RESSTR(nId); - return ePres; - } - default: ;//prevent warning - } -#endif // !SVX_LIGHT - return SFX_ITEM_PRESENTATION_NONE; -} - -// class SvxProtectItem -------------------------------------------------- - -int SvxProtectItem::operator==( const SfxPoolItem& rAttr ) const -{ - DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" ); - - return ( bCntnt == ( (SvxProtectItem&)rAttr ).bCntnt && - bSize == ( (SvxProtectItem&)rAttr ).bSize && - bPos == ( (SvxProtectItem&)rAttr ).bPos ); -} - -/*-----------------16.03.98 12:42------------------- ---------------------------------------------------*/ -sal_Bool SvxProtectItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const -{ -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); - nMemberId &= ~CONVERT_TWIPS; - sal_Bool bValue; - switch(nMemberId) - { - case MID_PROTECT_CONTENT : bValue = bCntnt; break; - case MID_PROTECT_SIZE : bValue = bSize; break; - case MID_PROTECT_POSITION: bValue = bPos; break; - default: - DBG_ERROR("falsche MemberId"); - return sal_False; - } - - rVal = Bool2Any( bValue ); - return sal_True; -} -/*-----------------16.03.98 12:42------------------- - ---------------------------------------------------*/ -sal_Bool SvxProtectItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) -{ -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); - nMemberId &= ~CONVERT_TWIPS; - sal_Bool bVal( Any2Bool(rVal) ); - switch(nMemberId) - { - case MID_PROTECT_CONTENT : bCntnt = bVal; break; - case MID_PROTECT_SIZE : bSize = bVal; break; - case MID_PROTECT_POSITION: bPos = bVal; break; - default: - DBG_ERROR("falsche MemberId"); - return sal_False; - } - return sal_True; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxProtectItem::Clone( SfxItemPool* ) const -{ - return new SvxProtectItem( *this ); -} - -//------------------------------------------------------------------------ - -SfxItemPresentation SvxProtectItem::GetPresentation -( - SfxItemPresentation ePres, - SfxMapUnit /*eCoreUnit*/, - SfxMapUnit /*ePresUnit*/, - XubString& rText, const IntlWrapper * -) const -{ -#ifndef SVX_LIGHT - switch ( ePres ) - { - case SFX_ITEM_PRESENTATION_NONE: - rText.Erase(); - return ePres; - - case SFX_ITEM_PRESENTATION_NAMELESS: - case SFX_ITEM_PRESENTATION_COMPLETE: - { - sal_uInt16 nId = RID_SVXITEMS_PROT_CONTENT_FALSE; - - if ( bCntnt ) - nId = RID_SVXITEMS_PROT_CONTENT_TRUE; - rText = SVX_RESSTR(nId); - rText += cpDelim; - nId = RID_SVXITEMS_PROT_SIZE_FALSE; - - if ( bSize ) - nId = RID_SVXITEMS_PROT_SIZE_TRUE; - rText += SVX_RESSTR(nId); - rText += cpDelim; - nId = RID_SVXITEMS_PROT_POS_FALSE; - - if ( bPos ) - nId = RID_SVXITEMS_PROT_POS_TRUE; - rText += SVX_RESSTR(nId); - return ePres; - } - default: ;//prevent warning - } -#endif // !SVX_LIGHT - return SFX_ITEM_PRESENTATION_NONE; -} - -// ----------------------------------------------------------------------- - -SvStream& SvxProtectItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const -{ - sal_Int8 cProt = 0; - if( IsPosProtected() ) cProt |= 0x01; - if( IsSizeProtected() ) cProt |= 0x02; - if( IsCntntProtected() ) cProt |= 0x04; - rStrm << (sal_Int8) cProt; - return rStrm; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxProtectItem::Create( SvStream& rStrm, sal_uInt16 ) const -{ - sal_Int8 cFlags; - rStrm >> cFlags; - SvxProtectItem* pAttr = new SvxProtectItem( Which() ); - pAttr->SetPosProtect( sal_Bool( ( cFlags & 0x01 ) != 0 ) ); - pAttr->SetSizeProtect( sal_Bool( ( cFlags & 0x02 ) != 0 ) ); - pAttr->SetCntntProtect( sal_Bool( ( cFlags & 0x04 ) != 0 ) ); - return pAttr; -} - -// class SvxShadowItem --------------------------------------------------- - -SvxShadowItem::SvxShadowItem( const USHORT nId, - const Color *pColor, const USHORT nW, - const SvxShadowLocation eLoc ) : - SfxEnumItemInterface( nId ), - aShadowColor(COL_GRAY), - nWidth ( nW ), - eLocation ( eLoc ) -{ - if ( pColor ) - aShadowColor = *pColor; -} - -// ----------------------------------------------------------------------- -sal_Bool SvxShadowItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const -{ - sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); - nMemberId &= ~CONVERT_TWIPS; - - table::ShadowFormat aShadow; - table::ShadowLocation eSet = table::ShadowLocation_NONE; - switch( eLocation ) - { - case SVX_SHADOW_TOPLEFT : eSet = table::ShadowLocation_TOP_LEFT ; break; - case SVX_SHADOW_TOPRIGHT : eSet = table::ShadowLocation_TOP_RIGHT ; break; - case SVX_SHADOW_BOTTOMLEFT : eSet = table::ShadowLocation_BOTTOM_LEFT ; break; - case SVX_SHADOW_BOTTOMRIGHT: eSet = table::ShadowLocation_BOTTOM_RIGHT; break; - default: ;//prevent warning - } - aShadow.Location = eSet; - aShadow.ShadowWidth = bConvert ? TWIP_TO_MM100_UNSIGNED(nWidth) : nWidth; - aShadow.IsTransparent = aShadowColor.GetTransparency() > 0; - aShadow.Color = aShadowColor.GetRGBColor(); - - switch ( nMemberId ) - { - case MID_LOCATION: rVal <<= aShadow.Location; break; - case MID_WIDTH: rVal <<= aShadow.ShadowWidth; break; - case MID_TRANSPARENT: rVal <<= aShadow.IsTransparent; break; - case MID_BG_COLOR: rVal <<= aShadow.Color; break; - case 0: rVal <<= aShadow; break; - default: DBG_ERROR("Wrong MemberId!"); return sal_False; - } - - return sal_True; -} -// ----------------------------------------------------------------------- -sal_Bool SvxShadowItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) -{ - sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); - nMemberId &= ~CONVERT_TWIPS; - - table::ShadowFormat aShadow; - uno::Any aAny; - sal_Bool bRet = QueryValue( aAny, bConvert ? CONVERT_TWIPS : 0 ) && ( aAny >>= aShadow ); - switch ( nMemberId ) - { - case MID_LOCATION: - { - bRet = (rVal >>= aShadow.Location); - if ( !bRet ) - { - sal_Int16 nVal = 0; - bRet = (rVal >>= nVal); - aShadow.Location = (table::ShadowLocation) nVal; - } - - break; - } - - case MID_WIDTH: rVal >>= aShadow.ShadowWidth; break; - case MID_TRANSPARENT: rVal >>= aShadow.IsTransparent; break; - case MID_BG_COLOR: rVal >>= aShadow.Color; break; - case 0: rVal >>= aShadow; break; - default: DBG_ERROR("Wrong MemberId!"); return sal_False; - } - - if ( bRet ) - { -// SvxShadowLocation eSet = SVX_SHADOW_NONE; - switch( aShadow.Location ) - { - case table::ShadowLocation_TOP_LEFT : eLocation = SVX_SHADOW_TOPLEFT; break; - case table::ShadowLocation_TOP_RIGHT : eLocation = SVX_SHADOW_TOPRIGHT; break; - case table::ShadowLocation_BOTTOM_LEFT : eLocation = SVX_SHADOW_BOTTOMLEFT ; break; - case table::ShadowLocation_BOTTOM_RIGHT: eLocation = SVX_SHADOW_BOTTOMRIGHT; break; - default: ;//prevent warning - } - - nWidth = bConvert ? MM100_TO_TWIP(aShadow.ShadowWidth) : aShadow.ShadowWidth; - Color aSet(aShadow.Color); - aSet.SetTransparency(aShadow.IsTransparent ? 0xff : 0); - aShadowColor = aSet; - } - - return bRet; -} - -// ----------------------------------------------------------------------- - -int SvxShadowItem::operator==( const SfxPoolItem& rAttr ) const -{ - DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" ); - - return ( ( aShadowColor == ( (SvxShadowItem&)rAttr ).aShadowColor ) && - ( nWidth == ( (SvxShadowItem&)rAttr ).GetWidth() ) && - ( eLocation == ( (SvxShadowItem&)rAttr ).GetLocation() ) ); -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxShadowItem::Clone( SfxItemPool* ) const -{ - return new SvxShadowItem( *this ); -} - -// ----------------------------------------------------------------------- - -sal_uInt16 SvxShadowItem::CalcShadowSpace( sal_uInt16 nShadow ) const -{ - sal_uInt16 nSpace = 0; - - switch ( nShadow ) - { - case SHADOW_TOP: - if ( eLocation == SVX_SHADOW_TOPLEFT || - eLocation == SVX_SHADOW_TOPRIGHT ) - nSpace = nWidth; - break; - - case SHADOW_BOTTOM: - if ( eLocation == SVX_SHADOW_BOTTOMLEFT || - eLocation == SVX_SHADOW_BOTTOMRIGHT ) - nSpace = nWidth; - break; - - case SHADOW_LEFT: - if ( eLocation == SVX_SHADOW_TOPLEFT || - eLocation == SVX_SHADOW_BOTTOMLEFT ) - nSpace = nWidth; - break; - - case SHADOW_RIGHT: - if ( eLocation == SVX_SHADOW_TOPRIGHT || - eLocation == SVX_SHADOW_BOTTOMRIGHT ) - nSpace = nWidth; - break; - - default: - DBG_ERROR( "wrong shadow" ); - } - return nSpace; -} - -//------------------------------------------------------------------------ - -SfxItemPresentation SvxShadowItem::GetPresentation -( - SfxItemPresentation ePres, - SfxMapUnit eCoreUnit, - SfxMapUnit ePresUnit, - XubString& rText, const IntlWrapper *pIntl -) const -{ -#ifndef SVX_LIGHT - switch ( ePres ) - { - case SFX_ITEM_PRESENTATION_NONE: - rText.Erase(); - return ePres; - - case SFX_ITEM_PRESENTATION_NAMELESS: - { - rText = ::GetColorString( aShadowColor ); - rText += cpDelim; - sal_uInt16 nId = RID_SVXITEMS_TRANSPARENT_FALSE; - - if ( aShadowColor.GetTransparency() ) - nId = RID_SVXITEMS_TRANSPARENT_TRUE; - rText += SVX_RESSTR(nId); - rText += cpDelim; - rText += GetMetricText( (long)nWidth, eCoreUnit, ePresUnit, pIntl ); - rText += cpDelim; - rText += SVX_RESSTR(RID_SVXITEMS_SHADOW_BEGIN + eLocation); - return ePres; - } - case SFX_ITEM_PRESENTATION_COMPLETE: - { - rText = SVX_RESSTR(RID_SVXITEMS_SHADOW_COMPLETE); - rText += ::GetColorString( aShadowColor ); - rText += cpDelim; - - sal_uInt16 nId = RID_SVXITEMS_TRANSPARENT_FALSE; - if ( aShadowColor.GetTransparency() ) - nId = RID_SVXITEMS_TRANSPARENT_TRUE; - rText += SVX_RESSTR(nId); - rText += cpDelim; - rText += GetMetricText( (long)nWidth, eCoreUnit, ePresUnit, pIntl ); - rText += SVX_RESSTR(GetMetricId(ePresUnit)); - rText += cpDelim; - rText += SVX_RESSTR(RID_SVXITEMS_SHADOW_BEGIN + eLocation); - return ePres; - } - default: ;//prevent warning - } -#endif - return SFX_ITEM_PRESENTATION_NONE; -} - -// ----------------------------------------------------------------------- - -SvStream& SvxShadowItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const -{ - rStrm << (sal_Int8) GetLocation() - << (sal_uInt16) GetWidth() - << (sal_Bool)(aShadowColor.GetTransparency() > 0) - << GetColor() - << GetColor() - << (sal_Int8)(aShadowColor.GetTransparency() > 0 ? 0 : 1); //BRUSH_NULL : BRUSH_SOLID - return rStrm; -} - -// ----------------------------------------------------------------------- - -int SvxShadowItem::ScaleMetrics( long nMult, long nDiv ) -{ - nWidth = (sal_uInt16)Scale( nWidth, nMult, nDiv ); - return 1; -} - -// ----------------------------------------------------------------------- - -int SvxShadowItem::HasMetrics() const -{ - return 1; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxShadowItem::Create( SvStream& rStrm, sal_uInt16 ) const -{ - sal_Int8 cLoc; - sal_uInt16 _nWidth; - sal_Bool bTrans; - Color aColor; - Color aFillColor; - sal_Int8 nStyle; - rStrm >> cLoc >> _nWidth - >> bTrans >> aColor >> aFillColor >> nStyle; - aColor.SetTransparency(bTrans ? 0xff : 0); - return new SvxShadowItem( Which(), &aColor, _nWidth, (SvxShadowLocation)cLoc ); -} - -// ----------------------------------------------------------------------- - -sal_uInt16 SvxShadowItem::GetValueCount() const -{ - return SVX_SHADOW_END; // SVX_SHADOW_BOTTOMRIGHT + 1 -} - -// ----------------------------------------------------------------------- - -XubString SvxShadowItem::GetValueTextByPos( sal_uInt16 nPos ) const -{ - DBG_ASSERT( nPos < SVX_SHADOW_END, "enum overflow!" ); - return XubString( SVX_RES( RID_SVXITEMS_SHADOW_BEGIN + nPos ) ); -} - -// ----------------------------------------------------------------------- - -sal_uInt16 SvxShadowItem::GetEnumValue() const -{ - return (sal_uInt16)GetLocation(); -} - -// ----------------------------------------------------------------------- - -void SvxShadowItem::SetEnumValue( sal_uInt16 nVal ) -{ - SetLocation( (const SvxShadowLocation)nVal ); -} - -// class SvxBorderLine -------------------------------------------------- - -SvxBorderLine::SvxBorderLine( const Color *pCol, sal_uInt16 nOut, sal_uInt16 nIn, sal_uInt16 nDist ) -: nOutWidth( nOut ) -, nInWidth ( nIn ) -, nDistance( nDist ) -{ - if ( pCol ) - aColor = *pCol; -} - -// ----------------------------------------------------------------------- - -SvxBorderLine::SvxBorderLine( const SvxBorderLine& r ) -{ - *this = r; -} - -// ----------------------------------------------------------------------- - -SvxBorderLine& SvxBorderLine::operator=( const SvxBorderLine& r ) -{ - aColor = r.aColor; - nOutWidth = r.nOutWidth; - nInWidth = r.nInWidth; - nDistance = r.nDistance; - return *this; -} - -// ----------------------------------------------------------------------- - -void SvxBorderLine::ScaleMetrics( long nMult, long nDiv ) -{ - nOutWidth = (sal_uInt16)Scale( nOutWidth, nMult, nDiv ); - nInWidth = (sal_uInt16)Scale( nInWidth, nMult, nDiv ); - nDistance = (sal_uInt16)Scale( nDistance, nMult, nDiv ); -} - -// ----------------------------------------------------------------------- - -sal_Bool SvxBorderLine::operator==( const SvxBorderLine& rCmp ) const -{ - return ( ( aColor == rCmp.GetColor() ) && - ( nInWidth == rCmp.GetInWidth() ) && - ( nOutWidth == rCmp.GetOutWidth() ) && - ( nDistance == rCmp.GetDistance() ) ); -} - -// ----------------------------------------------------------------------- - -XubString SvxBorderLine::GetValueString( SfxMapUnit eSrcUnit, - SfxMapUnit eDestUnit, - const IntlWrapper* pIntl, - sal_Bool bMetricStr) const -{ -#ifndef SVX_LIGHT - sal_uInt16 nResId = 0; - - if ( 0 == nDistance ) - { - // einfach Linie - if ( DEF_LINE_WIDTH_0 == nOutWidth ) - nResId = RID_SINGLE_LINE0; - else if ( DEF_LINE_WIDTH_1 == nOutWidth ) - nResId = RID_SINGLE_LINE1; - else if ( DEF_LINE_WIDTH_2 == nOutWidth ) - nResId = RID_SINGLE_LINE2; - else if ( DEF_LINE_WIDTH_3 == nOutWidth ) - nResId = RID_SINGLE_LINE3; - else if ( DEF_LINE_WIDTH_4 == nOutWidth ) - nResId = RID_SINGLE_LINE4; - } - else if ( DEF_LINE_WIDTH_1 == nDistance ) - { - // doppelte Linie, kleiner Abstand - if ( DEF_LINE_WIDTH_0 == nOutWidth && DEF_LINE_WIDTH_0 == nInWidth ) - nResId = RID_DOUBLE_LINE0; - else if ( DEF_LINE_WIDTH_1 == nOutWidth && - DEF_LINE_WIDTH_1 == nInWidth ) - nResId = RID_DOUBLE_LINE2; - else if ( DEF_LINE_WIDTH_1 == nOutWidth && - DEF_LINE_WIDTH_2 == nInWidth ) - nResId = RID_DOUBLE_LINE8; - } - else if ( DEF_LINE_WIDTH_2 == nDistance ) - { - // doppelte Linie, gro\ser Abstand - if ( DEF_LINE_WIDTH_0 == nOutWidth && DEF_LINE_WIDTH_0 == nInWidth ) - nResId = RID_DOUBLE_LINE1; - else if ( DEF_LINE_WIDTH_2 == nOutWidth && - DEF_LINE_WIDTH_2 == nInWidth ) - nResId = RID_DOUBLE_LINE3; - else if ( DEF_LINE_WIDTH_1 == nOutWidth && - DEF_LINE_WIDTH_0 == nInWidth ) - nResId = RID_DOUBLE_LINE4; - else if ( DEF_LINE_WIDTH_2 == nOutWidth && - DEF_LINE_WIDTH_0 == nInWidth ) - nResId = RID_DOUBLE_LINE5; - else if ( DEF_LINE_WIDTH_3 == nOutWidth && - DEF_LINE_WIDTH_0 == nInWidth ) - nResId = RID_DOUBLE_LINE6; - else if ( DEF_LINE_WIDTH_2 == nOutWidth && - DEF_LINE_WIDTH_1 == nInWidth ) - nResId = RID_DOUBLE_LINE7; - else if ( DEF_LINE_WIDTH_3 == nOutWidth && - DEF_LINE_WIDTH_2 == nInWidth ) - nResId = RID_DOUBLE_LINE9; - else if ( DEF_LINE_WIDTH_2 == nOutWidth && - DEF_LINE_WIDTH_3 == nInWidth ) - nResId = RID_DOUBLE_LINE10; - } - String aStr; - aStr += sal_Unicode('('); - aStr += ::GetColorString( aColor ); - aStr += cpDelim; - - if ( nResId ) - aStr += SVX_RESSTR(nResId); - else - { - String sMetric = SVX_RESSTR(GetMetricId( eDestUnit )); - aStr += GetMetricText( (long)nInWidth, eSrcUnit, eDestUnit, pIntl ); - if ( bMetricStr ) - aStr += sMetric; - aStr += cpDelim; - aStr += GetMetricText( (long)nOutWidth, eSrcUnit, eDestUnit, pIntl ); - if ( bMetricStr ) - aStr += sMetric; - aStr += cpDelim; - aStr += GetMetricText( (long)nDistance, eSrcUnit, eDestUnit, pIntl ); - if ( bMetricStr ) - aStr += sMetric; - } - aStr += sal_Unicode(')'); - return aStr; -#else - return UniString(); -#endif -} - -bool SvxBorderLine::HasPriority( const SvxBorderLine& rOtherLine ) const -{ - const USHORT nThisSize = GetOutWidth() + GetDistance() + GetInWidth(); - const USHORT nOtherSize = rOtherLine.GetOutWidth() + rOtherLine.GetDistance() + rOtherLine.GetInWidth(); - - if (nThisSize > nOtherSize) - { - return true; - } - else if (nThisSize < nOtherSize) - { - return false; - } - else - { - if ( rOtherLine.GetInWidth() && !GetInWidth() ) - { - return true; - } - else if ( GetInWidth() && !rOtherLine.GetInWidth() ) - { - return false; - } - else - { - return false; - } - } -} - -// class SvxBoxItem ------------------------------------------------------ - -SvxBoxItem::SvxBoxItem( const SvxBoxItem& rCpy ) : - - SfxPoolItem ( rCpy ), - nTopDist ( rCpy.nTopDist ), - nBottomDist ( rCpy.nBottomDist ), - nLeftDist ( rCpy.nLeftDist ), - nRightDist ( rCpy.nRightDist ) - -{ - pTop = rCpy.GetTop() ? new SvxBorderLine( *rCpy.GetTop() ) : 0; - pBottom = rCpy.GetBottom() ? new SvxBorderLine( *rCpy.GetBottom() ) : 0; - pLeft = rCpy.GetLeft() ? new SvxBorderLine( *rCpy.GetLeft() ) : 0; - pRight = rCpy.GetRight() ? new SvxBorderLine( *rCpy.GetRight() ) : 0; -} - -// ----------------------------------------------------------------------- - -SvxBoxItem::SvxBoxItem( const sal_uInt16 nId ) : - SfxPoolItem( nId ), - - pTop ( 0 ), - pBottom ( 0 ), - pLeft ( 0 ), - pRight ( 0 ), - nTopDist ( 0 ), - nBottomDist ( 0 ), - nLeftDist ( 0 ), - nRightDist ( 0 ) - -{ -} - -// ----------------------------------------------------------------------- - -SvxBoxItem::~SvxBoxItem() -{ - delete pTop; - delete pBottom; - delete pLeft; - delete pRight; -} - -// ----------------------------------------------------------------------- - -SvxBoxItem& SvxBoxItem::operator=( const SvxBoxItem& rBox ) -{ - nTopDist = rBox.nTopDist; - nBottomDist = rBox.nBottomDist; - nLeftDist = rBox.nLeftDist; - nRightDist = rBox.nRightDist; - SetLine( rBox.GetTop(), BOX_LINE_TOP ); - SetLine( rBox.GetBottom(), BOX_LINE_BOTTOM ); - SetLine( rBox.GetLeft(), BOX_LINE_LEFT ); - SetLine( rBox.GetRight(), BOX_LINE_RIGHT ); - return *this; -} - -// ----------------------------------------------------------------------- - -inline sal_Bool CmpBrdLn( const SvxBorderLine* pBrd1, const SvxBorderLine* pBrd2 ) -{ - sal_Bool bRet; - if( 0 != pBrd1 ? 0 == pBrd2 : 0 != pBrd2 ) - bRet = sal_False; - else - if( !pBrd1 ) - bRet = sal_True; - else - bRet = (*pBrd1 == *pBrd2); - return bRet; -} - -// ----------------------------------------------------------------------- - -int SvxBoxItem::operator==( const SfxPoolItem& rAttr ) const -{ - DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" ); - - return ( - ( nTopDist == ( (SvxBoxItem&)rAttr ).nTopDist ) && - ( nBottomDist == ( (SvxBoxItem&)rAttr ).nBottomDist ) && - ( nLeftDist == ( (SvxBoxItem&)rAttr ).nLeftDist ) && - ( nRightDist == ( (SvxBoxItem&)rAttr ).nRightDist ) && - CmpBrdLn( pTop, ( (SvxBoxItem&)rAttr ).GetTop() ) && - CmpBrdLn( pBottom, ( (SvxBoxItem&)rAttr ).GetBottom() ) && - CmpBrdLn( pLeft, ( (SvxBoxItem&)rAttr ).GetLeft() ) && - CmpBrdLn( pRight, ( (SvxBoxItem&)rAttr ).GetRight() ) ); -} - -// ----------------------------------------------------------------------- -table::BorderLine lcl_SvxLineToLine(const SvxBorderLine* pLine, sal_Bool bConvert) -{ - table::BorderLine aLine; - if(pLine) - { - aLine.Color = pLine->GetColor().GetColor() ; - aLine.InnerLineWidth = sal_uInt16( bConvert ? TWIP_TO_MM100_UNSIGNED(pLine->GetInWidth() ): pLine->GetInWidth() ); - aLine.OuterLineWidth = sal_uInt16( bConvert ? TWIP_TO_MM100_UNSIGNED(pLine->GetOutWidth()): pLine->GetOutWidth() ); - aLine.LineDistance = sal_uInt16( bConvert ? TWIP_TO_MM100_UNSIGNED(pLine->GetDistance()): pLine->GetDistance() ); - } - else - aLine.Color = aLine.InnerLineWidth = aLine.OuterLineWidth = aLine.LineDistance = 0; - return aLine; -} -// ----------------------------------------------------------------------- -sal_Bool SvxBoxItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const -{ - sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); - table::BorderLine aRetLine; - sal_uInt16 nDist = 0; - sal_Bool bDistMember = sal_False; - nMemberId &= ~CONVERT_TWIPS; - sal_Bool bSerialize = sal_False; - switch(nMemberId) - { - case 0: - { - // 4 Borders and 5 distances - uno::Sequence< uno::Any > aSeq( 9 ); - aSeq[0] = uno::makeAny( lcl_SvxLineToLine(GetLeft(), bConvert) ); - aSeq[1] = uno::makeAny( lcl_SvxLineToLine(GetRight(), bConvert) ); - aSeq[2] = uno::makeAny( lcl_SvxLineToLine(GetBottom(), bConvert) ); - aSeq[3] = uno::makeAny( lcl_SvxLineToLine(GetTop(), bConvert) ); - aSeq[4] <<= uno::makeAny( (sal_Int32)(bConvert ? TWIP_TO_MM100_UNSIGNED( GetDistance()) : GetDistance())); - aSeq[5] <<= uno::makeAny( (sal_Int32)(bConvert ? TWIP_TO_MM100_UNSIGNED( nTopDist ) : nTopDist )); - aSeq[6] <<= uno::makeAny( (sal_Int32)(bConvert ? TWIP_TO_MM100_UNSIGNED( nBottomDist ) : nBottomDist )); - aSeq[7] <<= uno::makeAny( (sal_Int32)(bConvert ? TWIP_TO_MM100_UNSIGNED( nLeftDist ) : nLeftDist )); - aSeq[8] <<= uno::makeAny( (sal_Int32)(bConvert ? TWIP_TO_MM100_UNSIGNED( nRightDist ) : nRightDist )); - rVal = uno::makeAny( aSeq ); - return sal_True; - } - case MID_LEFT_BORDER: - bSerialize = sal_True; // intentionally no break! - case LEFT_BORDER: - aRetLine = lcl_SvxLineToLine(GetLeft(), bConvert); - break; - case MID_RIGHT_BORDER: - bSerialize = sal_True; // intentionally no break! - case RIGHT_BORDER: - aRetLine = lcl_SvxLineToLine(GetRight(), bConvert); - break; - case MID_BOTTOM_BORDER: - bSerialize = sal_True; // intentionally no break! - case BOTTOM_BORDER: - aRetLine = lcl_SvxLineToLine(GetBottom(), bConvert); - break; - case MID_TOP_BORDER: - bSerialize = sal_True; // intentionally no break! - case TOP_BORDER: - aRetLine = lcl_SvxLineToLine(GetTop(), bConvert); - break; - case BORDER_DISTANCE: - nDist = GetDistance(); - bDistMember = sal_True; - break; - case TOP_BORDER_DISTANCE: - nDist = nTopDist; - bDistMember = sal_True; - break; - case BOTTOM_BORDER_DISTANCE: - nDist = nBottomDist; - bDistMember = sal_True; - break; - case LEFT_BORDER_DISTANCE: - nDist = nLeftDist; - bDistMember = sal_True; - break; - case RIGHT_BORDER_DISTANCE: - nDist = nRightDist; - bDistMember = sal_True; - break; - } - - if( bDistMember ) - rVal <<= (sal_Int32)(bConvert ? TWIP_TO_MM100_UNSIGNED(nDist) : nDist); - else - { -/* - if ( bSerialize ) - { - ::com::sun::star::uno::Sequence < ::com::sun::star::uno::Any > aSeq(4); - aSeq[0] <<= aRetLine.Color; - aSeq[1] <<= aRetLine.InnerLineWidth; - aSeq[2] <<= aRetLine.OuterLineWidth; - aSeq[3] <<= aRetLine.LineDistance; - rVal <<= aSeq; - } - else -*/ - rVal <<= aRetLine; - } - - return sal_True; -} - -// ----------------------------------------------------------------------- -sal_Bool lcl_LineToSvxLine(const ::com::sun::star::table::BorderLine& rLine, SvxBorderLine& rSvxLine, sal_Bool bConvert) -{ - rSvxLine.SetColor( Color(rLine.Color)); - rSvxLine.SetInWidth( sal_uInt16( bConvert ? MM100_TO_TWIP(rLine.InnerLineWidth) : rLine.InnerLineWidth )); - rSvxLine.SetOutWidth( sal_uInt16( bConvert ? MM100_TO_TWIP(rLine.OuterLineWidth) : rLine.OuterLineWidth )); - rSvxLine.SetDistance( sal_uInt16( bConvert ? MM100_TO_TWIP(rLine.LineDistance ) : rLine.LineDistance )); - sal_Bool bRet = rLine.InnerLineWidth > 0 || rLine.OuterLineWidth > 0; - return bRet; -} - -// ----------------------------------------------------------------------- - -sal_Bool SvxBoxItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) -{ - sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); - sal_uInt16 nLine = BOX_LINE_TOP; - sal_Bool bDistMember = sal_False; - nMemberId &= ~CONVERT_TWIPS; - switch(nMemberId) - { - case 0: - { - uno::Sequence< uno::Any > aSeq; - if (( rVal >>= aSeq ) && ( aSeq.getLength() == 9 )) - { - // 4 Borders and 5 distances - sal_Int32 nDist = 0; - SvxBorderLine aLine; - table::BorderLine aBorderLine; - if ( aSeq[0] >>= aBorderLine ) - { - sal_Bool bSet = lcl_LineToSvxLine(aBorderLine, aLine, bConvert); - SetLine(bSet ? &aLine : 0, BOX_LINE_LEFT ); - } - else - return sal_False; - - if ( aSeq[1] >>= aBorderLine ) - { - sal_Bool bSet = lcl_LineToSvxLine(aBorderLine, aLine, bConvert); - SetLine(bSet ? &aLine : 0, BOX_LINE_RIGHT ); - } - else - return sal_False; - - if ( aSeq[2] >>= aBorderLine ) - { - sal_Bool bSet = lcl_LineToSvxLine(aBorderLine, aLine, bConvert); - SetLine(bSet ? &aLine : 0, BOX_LINE_BOTTOM ); - } - else - return sal_False; - - if ( aSeq[3] >>= aBorderLine ) - { - sal_Bool bSet = lcl_LineToSvxLine(aBorderLine, aLine, bConvert); - SetLine(bSet ? &aLine : 0, BOX_LINE_TOP ); - } - else - return sal_False; - - sal_uInt16 nLines[4] = { BOX_LINE_TOP, BOX_LINE_BOTTOM, BOX_LINE_LEFT, BOX_LINE_RIGHT }; - for ( sal_Int32 n = 4; n < 9; n++ ) - { - if ( aSeq[n] >>= nDist ) - { - if( bConvert ) - nDist = MM100_TO_TWIP(nDist); - if ( n == 4 ) - SetDistance( sal_uInt16( nDist )); - else - SetDistance( sal_uInt16( nDist ), nLines[n-5] ); - } - else - return sal_False; - } - - return sal_True; - } - else - return sal_False; - } - case LEFT_BORDER_DISTANCE: - bDistMember = sal_True; - case LEFT_BORDER: - case MID_LEFT_BORDER: - nLine = BOX_LINE_LEFT; - break; - case RIGHT_BORDER_DISTANCE: - bDistMember = sal_True; - case RIGHT_BORDER: - case MID_RIGHT_BORDER: - nLine = BOX_LINE_RIGHT; - break; - case BOTTOM_BORDER_DISTANCE: - bDistMember = sal_True; - case BOTTOM_BORDER: - case MID_BOTTOM_BORDER: - nLine = BOX_LINE_BOTTOM; - break; - case TOP_BORDER_DISTANCE: - bDistMember = sal_True; - case TOP_BORDER: - case MID_TOP_BORDER: - nLine = BOX_LINE_TOP; - break; - } - - if( bDistMember || nMemberId == BORDER_DISTANCE ) - { - sal_Int32 nDist = 0; - if(!(rVal >>= nDist)) - return sal_False; - - if(nDist >= 0) - { - if( bConvert ) - nDist = MM100_TO_TWIP(nDist); - if( nMemberId == BORDER_DISTANCE ) - SetDistance( sal_uInt16( nDist )); - else - SetDistance( sal_uInt16( nDist ), nLine ); - } - } - else - { - SvxBorderLine aLine; - if( !rVal.hasValue() ) - return sal_False; - - table::BorderLine aBorderLine; - if( rVal >>= aBorderLine ) - { - // usual struct - } - else if (rVal.getValueTypeClass() == uno::TypeClass_SEQUENCE ) - { - // serialization for basic macro recording - uno::Reference < script::XTypeConverter > xConverter - ( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.script.Converter")), - uno::UNO_QUERY ); - uno::Sequence < uno::Any > aSeq; - uno::Any aNew; - try { aNew = xConverter->convertTo( rVal, ::getCppuType((const uno::Sequence < uno::Any >*)0) ); } - catch (uno::Exception&) {} - - aNew >>= aSeq; - if ( aSeq.getLength() == 4 ) - { - sal_Int32 nVal = 0; - if ( aSeq[0] >>= nVal ) - aBorderLine.Color = nVal; - if ( aSeq[1] >>= nVal ) - aBorderLine.InnerLineWidth = (sal_Int16) nVal; - if ( aSeq[2] >>= nVal ) - aBorderLine.OuterLineWidth = (sal_Int16) nVal; - if ( aSeq[3] >>= nVal ) - aBorderLine.LineDistance = (sal_Int16) nVal; - } - else - return sal_False; - } - else - return sal_False; - - sal_Bool bSet = lcl_LineToSvxLine(aBorderLine, aLine, bConvert); - SetLine(bSet ? &aLine : 0, nLine); - } - - return sal_True; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxBoxItem::Clone( SfxItemPool* ) const -{ - return new SvxBoxItem( *this ); -} - -//------------------------------------------------------------------------ - -SfxItemPresentation SvxBoxItem::GetPresentation -( - SfxItemPresentation ePres, - SfxMapUnit eCoreUnit, - SfxMapUnit ePresUnit, - XubString& rText, const IntlWrapper *pIntl -) const -{ -#ifndef SVX_LIGHT - switch ( ePres ) - { - case SFX_ITEM_PRESENTATION_NONE: - rText.Erase(); - return SFX_ITEM_PRESENTATION_NONE; - - case SFX_ITEM_PRESENTATION_NAMELESS: - { - rText.Erase(); - - if ( pTop ) - { - rText = pTop->GetValueString( eCoreUnit, ePresUnit, pIntl ); - rText += cpDelim; - } - if( !(pTop && pBottom && pLeft && pRight && - *pTop == *pBottom && *pTop == *pLeft && *pTop == *pRight) ) - { - if ( pBottom ) - { - rText += pBottom->GetValueString( eCoreUnit, ePresUnit, pIntl ); - rText += cpDelim; - } - if ( pLeft ) - { - rText += pLeft->GetValueString( eCoreUnit, ePresUnit, pIntl ); - rText += cpDelim; - } - if ( pRight ) - { - rText += pRight->GetValueString( eCoreUnit, ePresUnit, pIntl ); - rText += cpDelim; - } - } - rText += GetMetricText( (long)nTopDist, eCoreUnit, ePresUnit, pIntl ); - if( nTopDist != nBottomDist || nTopDist != nLeftDist || - nTopDist != nRightDist ) - { - (((((rText += cpDelim) - += GetMetricText( (long)nBottomDist, eCoreUnit, - ePresUnit, pIntl )) - += cpDelim) - += GetMetricText( (long)nLeftDist, eCoreUnit, ePresUnit, pIntl )) - += cpDelim) - += GetMetricText( (long)nRightDist, eCoreUnit, - ePresUnit, pIntl ); - } - return SFX_ITEM_PRESENTATION_NAMELESS; - } - case SFX_ITEM_PRESENTATION_COMPLETE: - { - if( !(pTop || pBottom || pLeft || pRight) ) - { - rText = SVX_RESSTR(RID_SVXITEMS_BORDER_NONE); - rText += cpDelim; - } - else - { - rText = SVX_RESSTR(RID_SVXITEMS_BORDER_COMPLETE); - if( pTop && pBottom && pLeft && pRight && - *pTop == *pBottom && *pTop == *pLeft && *pTop == *pRight ) - { - rText += pTop->GetValueString( eCoreUnit, ePresUnit, pIntl, sal_True ); - rText += cpDelim; - } - else - { - if ( pTop ) - { - rText += SVX_RESSTR(RID_SVXITEMS_BORDER_TOP); - rText += pTop->GetValueString( eCoreUnit, ePresUnit, pIntl, sal_True ); - rText += cpDelim; - } - if ( pBottom ) - { - rText += SVX_RESSTR(RID_SVXITEMS_BORDER_BOTTOM); - rText += pBottom->GetValueString( eCoreUnit, ePresUnit, pIntl, sal_True ); - rText += cpDelim; - } - if ( pLeft ) - { - rText += SVX_RESSTR(RID_SVXITEMS_BORDER_LEFT); - rText += pLeft->GetValueString( eCoreUnit, ePresUnit, pIntl, sal_True ); - rText += cpDelim; - } - if ( pRight ) - { - rText += SVX_RESSTR(RID_SVXITEMS_BORDER_RIGHT); - rText += pRight->GetValueString( eCoreUnit, ePresUnit, pIntl, sal_True ); - rText += cpDelim; - } - } - } - - rText += SVX_RESSTR(RID_SVXITEMS_BORDER_DISTANCE); - if( nTopDist == nBottomDist && nTopDist == nLeftDist && - nTopDist == nRightDist ) - { - rText += GetMetricText( (long)nTopDist, eCoreUnit, - ePresUnit, pIntl ); - rText += SVX_RESSTR(GetMetricId(ePresUnit)); - } - else - { - (((rText += SVX_RESSTR(RID_SVXITEMS_BORDER_TOP)) - += GetMetricText( (long)nTopDist, eCoreUnit, - ePresUnit, pIntl )) - += SVX_RESSTR(GetMetricId(ePresUnit))) - += cpDelim; - (((rText += SVX_RESSTR(RID_SVXITEMS_BORDER_BOTTOM)) - += GetMetricText( (long)nBottomDist, eCoreUnit, - ePresUnit, pIntl )) - += SVX_RESSTR(GetMetricId(ePresUnit))) - += cpDelim; - (((rText += SVX_RESSTR(RID_SVXITEMS_BORDER_LEFT)) - += GetMetricText( (long)nLeftDist, eCoreUnit, - ePresUnit, pIntl )) - += SVX_RESSTR(GetMetricId(ePresUnit))) - += cpDelim; - ((rText += SVX_RESSTR(RID_SVXITEMS_BORDER_RIGHT)) - += GetMetricText( (long)nRightDist, eCoreUnit, - ePresUnit, pIntl )) - += SVX_RESSTR(GetMetricId(ePresUnit)); - } - return SFX_ITEM_PRESENTATION_COMPLETE; - } - default: ;//prevent warning - } -#endif // !SVX_LIGHT - return SFX_ITEM_PRESENTATION_NONE; -} - -// ----------------------------------------------------------------------- - -SvStream& SvxBoxItem::Store( SvStream& rStrm , sal_uInt16 nItemVersion ) const -{ - rStrm << (sal_uInt16) GetDistance(); - const SvxBorderLine* pLine[ 4 ]; // top, left, right, bottom - pLine[ 0 ] = GetTop(); - pLine[ 1 ] = GetLeft(); - pLine[ 2 ] = GetRight(); - pLine[ 3 ] = GetBottom(); - - for( int i = 0; i < 4; i++ ) - { - const SvxBorderLine* l = pLine[ i ]; - if( l ) - { - rStrm << (sal_Int8) i - << l->GetColor() - << (sal_uInt16) l->GetOutWidth() - << (sal_uInt16) l->GetInWidth() - << (sal_uInt16) l->GetDistance(); - } - } - sal_Int8 cLine = 4; - if( nItemVersion >= BOX_4DISTS_VERSION && - !(nTopDist == nLeftDist && - nTopDist == nRightDist && - nTopDist == nBottomDist) ) - { - cLine |= 0x10; - } - - rStrm << cLine; - - if( nItemVersion >= BOX_4DISTS_VERSION && (cLine & 0x10) != 0 ) - { - rStrm << (sal_uInt16)nTopDist - << (sal_uInt16)nLeftDist - << (sal_uInt16)nRightDist - << (sal_uInt16)nBottomDist; - } - - return rStrm; -} - -// ----------------------------------------------------------------------- - -sal_uInt16 SvxBoxItem::GetVersion( sal_uInt16 nFFVer ) const -{ - DBG_ASSERT( SOFFICE_FILEFORMAT_31==nFFVer || - SOFFICE_FILEFORMAT_40==nFFVer || - SOFFICE_FILEFORMAT_50==nFFVer, - "SvxBoxItem: Gibt es ein neues Fileformat?" ); - return SOFFICE_FILEFORMAT_31==nFFVer || - SOFFICE_FILEFORMAT_40==nFFVer ? 0 : BOX_4DISTS_VERSION; -} - -// ----------------------------------------------------------------------- - -int SvxBoxItem::ScaleMetrics( long nMult, long nDiv ) -{ - if ( pTop ) pTop->ScaleMetrics( nMult, nDiv ); - if ( pBottom ) pBottom->ScaleMetrics( nMult, nDiv ); - if ( pLeft ) pLeft->ScaleMetrics( nMult, nDiv ); - if ( pRight ) pBottom->ScaleMetrics( nMult, nDiv ); - nTopDist = (sal_uInt16)Scale( nTopDist, nMult, nDiv ); - nBottomDist = (sal_uInt16)Scale( nBottomDist, nMult, nDiv ); - nLeftDist = (sal_uInt16)Scale( nLeftDist, nMult, nDiv ); - nRightDist = (sal_uInt16)Scale( nRightDist, nMult, nDiv ); - return 1; -} - -// ----------------------------------------------------------------------- - -int SvxBoxItem::HasMetrics() const -{ - return 1; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxBoxItem::Create( SvStream& rStrm, sal_uInt16 nIVersion ) const -{ - sal_uInt16 nDistance; - rStrm >> nDistance; - SvxBoxItem* pAttr = new SvxBoxItem( Which() ); - - sal_uInt16 aLineMap[4] = { BOX_LINE_TOP, BOX_LINE_LEFT, - BOX_LINE_RIGHT, BOX_LINE_BOTTOM }; - - sal_Int8 cLine; - while( sal_True ) - { - rStrm >> cLine; - - if( cLine > 3 ) - break; - sal_uInt16 nOutline, nInline, _nDistance; - Color aColor; - rStrm >> aColor >> nOutline >> nInline >> _nDistance; - SvxBorderLine aBorder( &aColor, nOutline, nInline, _nDistance ); - - pAttr->SetLine( &aBorder, aLineMap[cLine] ); - } - - if( nIVersion >= BOX_4DISTS_VERSION && (cLine&0x10) != 0 ) - { - for( sal_uInt16 i=0; i < 4; i++ ) - { - sal_uInt16 nDist; - rStrm >> nDist; - pAttr->SetDistance( nDist, aLineMap[i] ); - } - } - else - { - pAttr->SetDistance( nDistance ); - } - - return pAttr; -} - -// ----------------------------------------------------------------------- - -const SvxBorderLine *SvxBoxItem::GetLine( sal_uInt16 nLine ) const -{ - const SvxBorderLine *pRet = 0; - - switch ( nLine ) - { - case BOX_LINE_TOP: - pRet = pTop; - break; - case BOX_LINE_BOTTOM: - pRet = pBottom; - break; - case BOX_LINE_LEFT: - pRet = pLeft; - break; - case BOX_LINE_RIGHT: - pRet = pRight; - break; - default: - DBG_ERROR( "wrong line" ); - break; - } - - return pRet; -} - -// ----------------------------------------------------------------------- - -void SvxBoxItem::SetLine( const SvxBorderLine* pNew, sal_uInt16 nLine ) -{ - SvxBorderLine* pTmp = pNew ? new SvxBorderLine( *pNew ) : 0; - - switch ( nLine ) - { - case BOX_LINE_TOP: - delete pTop; - pTop = pTmp; - break; - case BOX_LINE_BOTTOM: - delete pBottom; - pBottom = pTmp; - break; - case BOX_LINE_LEFT: - delete pLeft; - pLeft = pTmp; - break; - case BOX_LINE_RIGHT: - delete pRight; - pRight = pTmp; - break; - default: - DBG_ERROR( "wrong line" ); - } -} - -// ----------------------------------------------------------------------- - -sal_uInt16 SvxBoxItem::GetDistance() const -{ - // The smallest distance that is not 0 will be returned. - sal_uInt16 nDist = nTopDist; - if( nBottomDist && (!nDist || nBottomDist < nDist) ) - nDist = nBottomDist; - if( nLeftDist && (!nDist || nLeftDist < nDist) ) - nDist = nLeftDist; - if( nRightDist && (!nDist || nRightDist < nDist) ) - nDist = nRightDist; - - return nDist; -} - -// ----------------------------------------------------------------------- - -sal_uInt16 SvxBoxItem::GetDistance( sal_uInt16 nLine ) const -{ - sal_uInt16 nDist = 0; - switch ( nLine ) - { - case BOX_LINE_TOP: - nDist = nTopDist; - break; - case BOX_LINE_BOTTOM: - nDist = nBottomDist; - break; - case BOX_LINE_LEFT: - nDist = nLeftDist; - break; - case BOX_LINE_RIGHT: - nDist = nRightDist; - break; - default: - DBG_ERROR( "wrong line" ); - } - - return nDist; -} - -// ----------------------------------------------------------------------- - -void SvxBoxItem::SetDistance( sal_uInt16 nNew, sal_uInt16 nLine ) -{ - switch ( nLine ) - { - case BOX_LINE_TOP: - nTopDist = nNew; - break; - case BOX_LINE_BOTTOM: - nBottomDist = nNew; - break; - case BOX_LINE_LEFT: - nLeftDist = nNew; - break; - case BOX_LINE_RIGHT: - nRightDist = nNew; - break; - default: - DBG_ERROR( "wrong line" ); - } -} - -// ----------------------------------------------------------------------- - -sal_uInt16 SvxBoxItem::CalcLineSpace( sal_uInt16 nLine, sal_Bool bIgnoreLine ) const -{ - SvxBorderLine* pTmp = 0; - sal_uInt16 nDist = 0; - switch ( nLine ) - { - case BOX_LINE_TOP: - pTmp = pTop; - nDist = nTopDist; - break; - case BOX_LINE_BOTTOM: - pTmp = pBottom; - nDist = nBottomDist; - break; - case BOX_LINE_LEFT: - pTmp = pLeft; - nDist = nLeftDist; - break; - case BOX_LINE_RIGHT: - pTmp = pRight; - nDist = nRightDist; - break; - default: - DBG_ERROR( "wrong line" ); - } - - if( pTmp ) - { - nDist = nDist + (sal_uInt16)(pTmp->GetOutWidth()) + (sal_uInt16)(pTmp->GetInWidth()) + (sal_uInt16)(pTmp->GetDistance()); - } - else if( !bIgnoreLine ) - nDist = 0; - return nDist; -} - -// class SvxBoxInfoItem -------------------------------------------------- - -SvxBoxInfoItem::SvxBoxInfoItem( const sal_uInt16 nId ) : - SfxPoolItem( nId ), - pHori ( 0 ), - pVert ( 0 ), - mbEnableHor( false ), - mbEnableVer( false ), - nDefDist( 0 ) -{ - bDist = bMinDist = sal_False; - ResetFlags(); -} - -// ----------------------------------------------------------------------- - -SvxBoxInfoItem::SvxBoxInfoItem( const SvxBoxInfoItem& rCpy ) : - SfxPoolItem( rCpy ), - mbEnableHor( rCpy.mbEnableHor ), - mbEnableVer( rCpy.mbEnableVer ) -{ - pHori = rCpy.GetHori() ? new SvxBorderLine( *rCpy.GetHori() ) : 0; - pVert = rCpy.GetVert() ? new SvxBorderLine( *rCpy.GetVert() ) : 0; - bDist = rCpy.IsDist(); - bMinDist = rCpy.IsMinDist(); - nValidFlags = rCpy.nValidFlags; - nDefDist = rCpy.GetDefDist(); -} - -// ----------------------------------------------------------------------- - -SvxBoxInfoItem::~SvxBoxInfoItem() -{ - delete pHori; - delete pVert; -} - -// ----------------------------------------------------------------------- - -SvxBoxInfoItem &SvxBoxInfoItem::operator=( const SvxBoxInfoItem& rCpy ) -{ - delete pHori; - delete pVert; - pHori = rCpy.GetHori() ? new SvxBorderLine( *rCpy.GetHori() ) : 0; - pVert = rCpy.GetVert() ? new SvxBorderLine( *rCpy.GetVert() ) : 0; - mbEnableHor = rCpy.mbEnableHor; - mbEnableVer = rCpy.mbEnableVer; - bDist = rCpy.IsDist(); - bMinDist = rCpy.IsMinDist(); - nValidFlags = rCpy.nValidFlags; - nDefDist = rCpy.GetDefDist(); - return *this; -} - -// ----------------------------------------------------------------------- - -int SvxBoxInfoItem::operator==( const SfxPoolItem& rAttr ) const -{ - SvxBoxInfoItem& rBoxInfo = (SvxBoxInfoItem&)rAttr; - - DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" ); - - return ( mbEnableHor == rBoxInfo.mbEnableHor - && mbEnableVer == rBoxInfo.mbEnableVer - && bDist == rBoxInfo.IsDist() - && bMinDist == rBoxInfo.IsMinDist() - && nValidFlags == rBoxInfo.nValidFlags - && nDefDist == rBoxInfo.GetDefDist() - && CmpBrdLn( pHori, rBoxInfo.GetHori() ) - && CmpBrdLn( pVert, rBoxInfo.GetVert() ) - ); -} - -// ----------------------------------------------------------------------- - -void SvxBoxInfoItem::SetLine( const SvxBorderLine* pNew, sal_uInt16 nLine ) -{ - SvxBorderLine* pTmp = pNew ? new SvxBorderLine( *pNew ) : 0; - - if ( BOXINFO_LINE_HORI == nLine ) - { - delete pHori; - pHori = pTmp; - } - else if ( BOXINFO_LINE_VERT == nLine ) - { - delete pVert; - pVert = pTmp; - } - else - { - DBG_ERROR( "wrong line" ); - } -} - - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxBoxInfoItem::Clone( SfxItemPool* ) const -{ - return new SvxBoxInfoItem( *this ); -} - -//------------------------------------------------------------------------ - -SfxItemPresentation SvxBoxInfoItem::GetPresentation -( - SfxItemPresentation /*ePres*/, - SfxMapUnit /*eCoreUnit*/, - SfxMapUnit /*ePresUnit*/, - XubString& rText, const IntlWrapper * -) const -{ -#ifndef SVX_LIGHT -/*!!! - ResMgr* pMgr = DIALOG_MGR(); - if ( pHori ) - { - rText += pHori->GetValueString(); - rText += cpDelim; - } - if ( pVert ) - { - rText += pVert->GetValueString(); - rText += cpDelim; - } - if ( bTable ) - rText += String( ResId( RID_SVXITEMS_BOXINF_TABLE_TRUE, pMgr ) ); - else - rText += String( ResId( RID_SVXITEMS_BOXINF_TABLE_FALSE, pMgr ) ); - rText += cpDelim; - if ( bDist ) - rText += String( ResId( RID_SVXITEMS_BOXINF_DIST_TRUE, pMgr ) ); - else - rText += String( ResId( RID_SVXITEMS_BOXINF_DIST_FALSE, pMgr ) ); - rText += cpDelim; - if ( bMinDist ) - rText += String( ResId( RID_SVXITEMS_BOXINF_MDIST_TRUE, pMgr ) ); - else - rText += String( ResId( RID_SVXITEMS_BOXINF_MDIST_FALSE, pMgr ) ); - rText += cpDelim; - rText += nDefDist; - return SFX_ITEM_PRESENTATION_NAMELESS; -*/ - rText.Erase(); -#endif // !SVX_LIGHT - return SFX_ITEM_PRESENTATION_NONE; -} - -// ----------------------------------------------------------------------- - -SvStream& SvxBoxInfoItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const -{ - sal_Int8 cFlags = 0; - - if ( IsTable() ) - cFlags |= 0x01; - if ( IsDist() ) - cFlags |= 0x02; - if ( IsMinDist() ) - cFlags |= 0x04; - rStrm << (sal_Int8) cFlags - << (sal_uInt16) GetDefDist(); - const SvxBorderLine* pLine[ 2 ]; - pLine[ 0 ] = GetHori(); - pLine[ 1 ] = GetVert(); - - for( int i = 0; i < 2; i++ ) - { - const SvxBorderLine* l = pLine[ i ]; - if( l ) - { - rStrm << (char) i - << l->GetColor() - << (short) l->GetOutWidth() - << (short) l->GetInWidth() - << (short) l->GetDistance(); - } - } - rStrm << (char) 2; - return rStrm; -} - -// ----------------------------------------------------------------------- - -int SvxBoxInfoItem::ScaleMetrics( long nMult, long nDiv ) -{ - if ( pHori ) pHori->ScaleMetrics( nMult, nDiv ); - if ( pVert ) pVert->ScaleMetrics( nMult, nDiv ); - nDefDist = (sal_uInt16)Scale( nDefDist, nMult, nDiv ); - return 1; -} - -// ----------------------------------------------------------------------- - -int SvxBoxInfoItem::HasMetrics() const -{ - return 1; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxBoxInfoItem::Create( SvStream& rStrm, sal_uInt16 ) const -{ - sal_Int8 cFlags; - sal_uInt16 _nDefDist; - rStrm >> cFlags >> _nDefDist; - - SvxBoxInfoItem* pAttr = new SvxBoxInfoItem( Which() ); - - pAttr->SetTable ( ( cFlags & 0x01 ) != 0 ); - pAttr->SetDist ( ( cFlags & 0x02 ) != 0 ); - pAttr->SetMinDist( ( cFlags & 0x04 ) != 0 ); - pAttr->SetDefDist( _nDefDist ); - - while( sal_True ) - { - sal_Int8 cLine; - rStrm >> cLine; - - if( cLine > 1 ) - break; - short nOutline, nInline, nDistance; - Color aColor; - rStrm >> aColor >> nOutline >> nInline >> nDistance; - SvxBorderLine aBorder( &aColor, nOutline, nInline, nDistance ); - - switch( cLine ) - { - case 0: pAttr->SetLine( &aBorder, BOXINFO_LINE_HORI ); break; - case 1: pAttr->SetLine( &aBorder, BOXINFO_LINE_VERT ); break; - } - } - return pAttr; -} - -// ----------------------------------------------------------------------- - -void SvxBoxInfoItem::ResetFlags() -{ - nValidFlags = 0x7F; // alles g"ultig au/ser Disable -} - -sal_Bool SvxBoxInfoItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const -{ - sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); - table::BorderLine aRetLine; - sal_Int16 nVal=0; - sal_Bool bIntMember = sal_False; - nMemberId &= ~CONVERT_TWIPS; - sal_Bool bSerialize = sal_False; - switch(nMemberId) - { - case 0: - { - // 2 BorderLines, flags, valid flags and distance - ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > aSeq( 5 ); - aSeq[0] = ::com::sun::star::uno::makeAny( lcl_SvxLineToLine( pHori, bConvert) ); - aSeq[1] = ::com::sun::star::uno::makeAny( lcl_SvxLineToLine( pVert, bConvert) ); - if ( IsTable() ) - nVal |= 0x01; - if ( IsDist() ) - nVal |= 0x02; - if ( IsMinDist() ) - nVal |= 0x04; - aSeq[2] = ::com::sun::star::uno::makeAny( nVal ); - nVal = nValidFlags; - aSeq[3] = ::com::sun::star::uno::makeAny( nVal ); - aSeq[4] = ::com::sun::star::uno::makeAny( (sal_Int32)(bConvert ? TWIP_TO_MM100_UNSIGNED(GetDefDist()) : GetDefDist()) ); - rVal = ::com::sun::star::uno::makeAny( aSeq ); - return sal_True; - } - - case MID_HORIZONTAL: - bSerialize = sal_True; - aRetLine = lcl_SvxLineToLine( pHori, bConvert); - break; - case MID_VERTICAL: - bSerialize = sal_True; - aRetLine = lcl_SvxLineToLine( pVert, bConvert); - break; - case MID_FLAGS: - bIntMember = sal_True; - if ( IsTable() ) - nVal |= 0x01; - if ( IsDist() ) - nVal |= 0x02; - if ( IsMinDist() ) - nVal |= 0x04; - rVal <<= nVal; - break; - case MID_VALIDFLAGS: - bIntMember = sal_True; - nVal = nValidFlags; - rVal <<= nVal; - break; - case MID_DISTANCE: - bIntMember = sal_True; - rVal <<= (sal_Int32)(bConvert ? TWIP_TO_MM100_UNSIGNED(GetDefDist()) : GetDefDist()); - break; - default: DBG_ERROR("Wrong MemberId!"); return sal_False; - } - - if( !bIntMember ) - { -/* - if ( bSerialize ) - { - ::com::sun::star::uno::Sequence < ::com::sun::star::uno::Any > aSeq(4); - aSeq[0] <<= aRetLine.Color; - aSeq[1] <<= aRetLine.InnerLineWidth; - aSeq[2] <<= aRetLine.OuterLineWidth; - aSeq[3] <<= aRetLine.LineDistance; - rVal <<= aSeq; - } - else - */ - rVal <<= aRetLine; - } - - return sal_True; -} - -// ----------------------------------------------------------------------- - -sal_Bool SvxBoxInfoItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) -{ - sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); -// sal_uInt16 nLine = BOX_LINE_TOP; -// sal_Bool bDistMember = sal_False; - nMemberId &= ~CONVERT_TWIPS; - sal_Bool bRet; - switch(nMemberId) - { - case 0: - { - ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > aSeq; - if (( rVal >>= aSeq ) && ( aSeq.getLength() == 5 )) - { - // 2 BorderLines, flags, valid flags and distance - table::BorderLine aBorderLine; - SvxBorderLine aLine; - sal_Int16 nFlags( 0 ); - sal_Int32 nVal( 0 ); - if ( aSeq[0] >>= aBorderLine ) - { - sal_Bool bSet = lcl_LineToSvxLine(aBorderLine, aLine, bConvert); - if ( bSet ) - SetLine( &aLine, BOXINFO_LINE_HORI ); - } - else - return sal_False; - if ( aSeq[1] >>= aBorderLine ) - { - sal_Bool bSet = lcl_LineToSvxLine(aBorderLine, aLine, bConvert); - if ( bSet ) - SetLine( &aLine, BOXINFO_LINE_VERT ); - } - else - return sal_False; - if ( aSeq[2] >>= nFlags ) - { - SetTable ( ( nFlags & 0x01 ) != 0 ); - SetDist ( ( nFlags & 0x02 ) != 0 ); - SetMinDist( ( nFlags & 0x04 ) != 0 ); - } - else - return sal_False; - if ( aSeq[3] >>= nFlags ) - nValidFlags = (BYTE)nFlags; - else - return sal_False; - if (( aSeq[4] >>= nVal ) && ( nVal >= 0 )) - { - if( bConvert ) - nVal = MM100_TO_TWIP(nVal); - SetDefDist( (USHORT)nVal ); - } - } - return sal_True; - } - - case MID_HORIZONTAL: - case MID_VERTICAL: - { - if( !rVal.hasValue() ) - return sal_False; - - table::BorderLine aBorderLine; - if( rVal >>= aBorderLine ) - { - // usual struct - } - else if (rVal.getValueTypeClass() == uno::TypeClass_SEQUENCE ) - { - // serialization for basic macro recording - uno::Reference < script::XTypeConverter > xConverter - ( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.script.Converter")), - uno::UNO_QUERY ); - uno::Any aNew; - uno::Sequence < uno::Any > aSeq; - try { aNew = xConverter->convertTo( rVal, ::getCppuType((const uno::Sequence < uno::Any >*)0) ); } - catch (uno::Exception&) {} - - if( (aNew >>= aSeq) && aSeq.getLength() == 4 ) - { - sal_Int32 nVal = 0; - if ( aSeq[0] >>= nVal ) - aBorderLine.Color = nVal; - if ( aSeq[1] >>= nVal ) - aBorderLine.InnerLineWidth = (sal_Int16) nVal; - if ( aSeq[2] >>= nVal ) - aBorderLine.OuterLineWidth = (sal_Int16) nVal; - if ( aSeq[3] >>= nVal ) - aBorderLine.LineDistance = (sal_Int16) nVal; - } - else - return sal_False; - } - else if (rVal.getValueType() == ::getCppuType((const ::com::sun::star::uno::Sequence < sal_Int16 >*)0) ) - { - // serialization for basic macro recording - ::com::sun::star::uno::Sequence < sal_Int16 > aSeq; - rVal >>= aSeq; - if ( aSeq.getLength() == 4 ) - { - aBorderLine.Color = aSeq[0]; - aBorderLine.InnerLineWidth = aSeq[1]; - aBorderLine.OuterLineWidth = aSeq[2]; - aBorderLine.LineDistance = aSeq[3]; - } - else - return sal_False; - } - else - return sal_False; - - SvxBorderLine aLine; - sal_Bool bSet = lcl_LineToSvxLine(aBorderLine, aLine, bConvert); - if ( bSet ) - SetLine( &aLine, nMemberId == MID_HORIZONTAL ? BOXINFO_LINE_HORI : BOXINFO_LINE_VERT ); - break; - } - case MID_FLAGS: - { - sal_Int16 nFlags = sal_Int16(); - bRet = (rVal >>= nFlags); - if ( bRet ) - { - SetTable ( ( nFlags & 0x01 ) != 0 ); - SetDist ( ( nFlags & 0x02 ) != 0 ); - SetMinDist( ( nFlags & 0x04 ) != 0 ); - } - - break; - } - case MID_VALIDFLAGS: - { - sal_Int16 nFlags = sal_Int16(); - bRet = (rVal >>= nFlags); - if ( bRet ) - nValidFlags = (BYTE)nFlags; - break; - } - case MID_DISTANCE: - { - sal_Int32 nVal = 0; - bRet = (rVal >>= nVal); - if ( bRet && nVal>=0 ) - { - if( bConvert ) - nVal = MM100_TO_TWIP(nVal); - SetDefDist( (USHORT)nVal ); - } - break; - } - default: DBG_ERROR("Wrong MemberId!"); return sal_False; - } - - return sal_True; -} - -// class SvxFmtBreakItem ------------------------------------------------- - -int SvxFmtBreakItem::operator==( const SfxPoolItem& rAttr ) const -{ - DBG_ASSERT( SfxPoolItem::operator==( rAttr ), "unequal types" ); - - return GetValue() == ( (SvxFmtBreakItem&)rAttr ).GetValue(); -} - -//------------------------------------------------------------------------ - -SfxItemPresentation SvxFmtBreakItem::GetPresentation -( - SfxItemPresentation ePres, - SfxMapUnit /*eCoreUnit*/, - SfxMapUnit /*ePresUnit*/, - XubString& rText, const IntlWrapper * -) const -{ -#ifndef SVX_LIGHT - switch ( ePres ) - { - case SFX_ITEM_PRESENTATION_NONE: - rText.Erase(); - return SFX_ITEM_PRESENTATION_NONE; - - case SFX_ITEM_PRESENTATION_NAMELESS: - case SFX_ITEM_PRESENTATION_COMPLETE: - rText = GetValueTextByPos( GetValue() ); - return ePres; - default: ;//prevent warning - } -#endif // !SVX_LIGHT - return SFX_ITEM_PRESENTATION_NONE; -} - -// ----------------------------------------------------------------------- - -XubString SvxFmtBreakItem::GetValueTextByPos( sal_uInt16 nPos ) const -{ - DBG_ASSERT( nPos < SVX_BREAK_END, "enum overflow!" ); - XubString aStr( SVX_RES( RID_SVXITEMS_BREAK_BEGIN + nPos ) ); - return aStr; -} - -// ----------------------------------------------------------------------- -sal_Bool SvxFmtBreakItem::QueryValue( uno::Any& rVal, BYTE /*nMemberId*/ ) const -{ - style::BreakType eBreak = style::BreakType_NONE; - switch ( (SvxBreak)GetValue() ) - { - case SVX_BREAK_COLUMN_BEFORE: eBreak = style::BreakType_COLUMN_BEFORE; break; - case SVX_BREAK_COLUMN_AFTER: eBreak = style::BreakType_COLUMN_AFTER ; break; - case SVX_BREAK_COLUMN_BOTH: eBreak = style::BreakType_COLUMN_BOTH ; break; - case SVX_BREAK_PAGE_BEFORE: eBreak = style::BreakType_PAGE_BEFORE ; break; - case SVX_BREAK_PAGE_AFTER: eBreak = style::BreakType_PAGE_AFTER ; break; - case SVX_BREAK_PAGE_BOTH: eBreak = style::BreakType_PAGE_BOTH ; break; - default: ;//prevent warning - } - rVal <<= eBreak; - return sal_True; -} -// ----------------------------------------------------------------------- -sal_Bool SvxFmtBreakItem::PutValue( const uno::Any& rVal, BYTE /*nMemberId*/ ) -{ - style::BreakType nBreak; - - if(!(rVal >>= nBreak)) - { - sal_Int32 nValue = 0; - if(!(rVal >>= nValue)) - return sal_False; - - nBreak = (style::BreakType) nValue; - } - - SvxBreak eBreak = SVX_BREAK_NONE; - switch( nBreak ) - { - case style::BreakType_COLUMN_BEFORE: eBreak = SVX_BREAK_COLUMN_BEFORE; break; - case style::BreakType_COLUMN_AFTER: eBreak = SVX_BREAK_COLUMN_AFTER; break; - case style::BreakType_COLUMN_BOTH: eBreak = SVX_BREAK_COLUMN_BOTH; break; - case style::BreakType_PAGE_BEFORE: eBreak = SVX_BREAK_PAGE_BEFORE; break; - case style::BreakType_PAGE_AFTER: eBreak = SVX_BREAK_PAGE_AFTER; break; - case style::BreakType_PAGE_BOTH: eBreak = SVX_BREAK_PAGE_BOTH; break; - default: ;//prevent warning - } - SetValue((sal_uInt16) eBreak); - - return sal_True; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxFmtBreakItem::Clone( SfxItemPool* ) const -{ - return new SvxFmtBreakItem( *this ); -} - -// ----------------------------------------------------------------------- - -SvStream& SvxFmtBreakItem::Store( SvStream& rStrm , sal_uInt16 nItemVersion ) const -{ - rStrm << (sal_Int8)GetValue(); - if( FMTBREAK_NOAUTO > nItemVersion ) - rStrm << (sal_Int8)0x01; - return rStrm; -} - -// ----------------------------------------------------------------------- - -sal_uInt16 SvxFmtBreakItem::GetVersion( sal_uInt16 nFFVer ) const -{ - DBG_ASSERT( SOFFICE_FILEFORMAT_31==nFFVer || - SOFFICE_FILEFORMAT_40==nFFVer || - SOFFICE_FILEFORMAT_50==nFFVer, - "SvxFmtBreakItem: Gibt es ein neues Fileformat?" ); - return SOFFICE_FILEFORMAT_31==nFFVer || - SOFFICE_FILEFORMAT_40==nFFVer ? 0 : FMTBREAK_NOAUTO; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxFmtBreakItem::Create( SvStream& rStrm, sal_uInt16 nVersion ) const -{ - sal_Int8 eBreak, bDummy; - rStrm >> eBreak; - if( FMTBREAK_NOAUTO > nVersion ) - rStrm >> bDummy; - return new SvxFmtBreakItem( (const SvxBreak)eBreak, Which() ); -} - -// ----------------------------------------------------------------------- - -sal_uInt16 SvxFmtBreakItem::GetValueCount() const -{ - return SVX_BREAK_END; // SVX_BREAK_PAGE_BOTH + 1 -} - -// class SvxFmtKeepItem ------------------------------------------------- - -SfxPoolItem* SvxFmtKeepItem::Clone( SfxItemPool* ) const -{ - return new SvxFmtKeepItem( *this ); -} - -// ----------------------------------------------------------------------- - -SvStream& SvxFmtKeepItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const -{ - rStrm << (sal_Int8)GetValue(); - return rStrm; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxFmtKeepItem::Create( SvStream& rStrm, sal_uInt16 ) const -{ - sal_Int8 bIsKeep; - rStrm >> bIsKeep; - return new SvxFmtKeepItem( sal_Bool( bIsKeep != 0 ), Which() ); -} - -//------------------------------------------------------------------------ - -SfxItemPresentation SvxFmtKeepItem::GetPresentation -( - SfxItemPresentation ePres, - SfxMapUnit /*eCoreUnit*/, - SfxMapUnit /*ePresUnit*/, - XubString& rText, const IntlWrapper * - ) const -{ -#ifndef SVX_LIGHT - switch ( ePres ) - { - case SFX_ITEM_PRESENTATION_NONE: - rText.Erase(); - return ePres; - - case SFX_ITEM_PRESENTATION_NAMELESS: - case SFX_ITEM_PRESENTATION_COMPLETE: - { - sal_uInt16 nId = RID_SVXITEMS_FMTKEEP_FALSE; - - if ( GetValue() ) - nId = RID_SVXITEMS_FMTKEEP_TRUE; - rText = SVX_RESSTR(nId); - return ePres; - } - default: ;//prevent warning - } -#endif - return SFX_ITEM_PRESENTATION_NONE; -} - -// class SvxLineItem ------------------------------------------------------ - -SvxLineItem::SvxLineItem( const sal_uInt16 nId ) : - - SfxPoolItem ( nId ), - - pLine( NULL ) -{ -} - -// ----------------------------------------------------------------------- - -SvxLineItem::SvxLineItem( const SvxLineItem& rCpy ) : - - SfxPoolItem ( rCpy ) -{ - pLine = rCpy.GetLine() ? new SvxBorderLine( *rCpy.GetLine() ) : 0; -} - - -// ----------------------------------------------------------------------- - -SvxLineItem::~SvxLineItem() -{ - delete pLine; -} - -// ----------------------------------------------------------------------- - -SvxLineItem& SvxLineItem::operator=( const SvxLineItem& rLine ) -{ - SetLine( rLine.GetLine() ); - - return *this; -} - -// ----------------------------------------------------------------------- - -int SvxLineItem::operator==( const SfxPoolItem& rAttr ) const -{ - DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" ); - - return CmpBrdLn( pLine, ((SvxLineItem&)rAttr).GetLine() ); -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxLineItem::Clone( SfxItemPool* ) const -{ - return new SvxLineItem( *this ); -} - -sal_Bool SvxLineItem::QueryValue( uno::Any& rVal, BYTE nMemId ) const -{ - sal_Bool bConvert = 0!=(nMemId&CONVERT_TWIPS); - nMemId &= ~CONVERT_TWIPS; - if ( nMemId == 0 ) - { - rVal <<= uno::makeAny( lcl_SvxLineToLine(pLine, bConvert) ); - return sal_True; - } - else if ( pLine ) - { - switch ( nMemId ) - { - case MID_FG_COLOR: rVal <<= sal_Int32(pLine->GetColor().GetColor()); break; - case MID_OUTER_WIDTH: rVal <<= sal_Int32(pLine->GetOutWidth()); break; - case MID_INNER_WIDTH: rVal <<= sal_Int32(pLine->GetInWidth( )); break; - case MID_DISTANCE: rVal <<= sal_Int32(pLine->GetDistance()); break; - default: - DBG_ERROR( "Wrong MemberId" ); - return sal_False; - } - } - - return TRUE; -} - -// ----------------------------------------------------------------------- - -sal_Bool SvxLineItem::PutValue( const uno::Any& rVal, BYTE nMemId ) -{ - sal_Bool bConvert = 0!=(nMemId&CONVERT_TWIPS); - nMemId &= ~CONVERT_TWIPS; - sal_Int32 nVal = 0; - if ( nMemId == 0 ) - { - table::BorderLine aLine; - if ( rVal >>= aLine ) - { - if ( !pLine ) - pLine = new SvxBorderLine; - if( !lcl_LineToSvxLine(aLine, *pLine, bConvert) ) - DELETEZ( pLine ); - return sal_True; - } - return sal_False; - } - else if ( rVal >>= nVal ) - { - if ( !pLine ) - pLine = new SvxBorderLine; - - switch ( nMemId ) - { - case MID_FG_COLOR: pLine->SetColor( Color(nVal) ); break; - case MID_OUTER_WIDTH: pLine->SetOutWidth((USHORT)nVal); break; - case MID_INNER_WIDTH: pLine->SetInWidth((USHORT)nVal); break; - case MID_DISTANCE: pLine->SetDistance((USHORT)nVal); break; - default: - DBG_ERROR( "Wrong MemberId" ); - return sal_False; - } - - return sal_True; - } - - return sal_False; -} - -//------------------------------------------------------------------------ - -SfxItemPresentation SvxLineItem::GetPresentation -( - SfxItemPresentation ePres, - SfxMapUnit eCoreUnit, - SfxMapUnit ePresUnit, - XubString& rText, const IntlWrapper *pIntl -) const -{ -#ifndef SVX_LIGHT - rText.Erase(); - - switch ( ePres ) - { - case SFX_ITEM_PRESENTATION_NONE: - return SFX_ITEM_PRESENTATION_NONE; - case SFX_ITEM_PRESENTATION_NAMELESS: - case SFX_ITEM_PRESENTATION_COMPLETE: - { - if ( pLine ) - rText = pLine->GetValueString( eCoreUnit, ePresUnit, pIntl, - (SFX_ITEM_PRESENTATION_COMPLETE == ePres) ); - return ePres; - } - default: ;//prevent warning - } -#endif - return SFX_ITEM_PRESENTATION_NONE; -} - -// ----------------------------------------------------------------------- - -SvStream& SvxLineItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const -{ - if( pLine ) - { - rStrm << pLine->GetColor() - << (short)pLine->GetOutWidth() - << (short)pLine->GetInWidth() - << (short)pLine->GetDistance(); - } - else - rStrm << Color() << (short)0 << (short)0 << (short)0; - return rStrm; -} - -// ----------------------------------------------------------------------- - -int SvxLineItem::ScaleMetrics( long nMult, long nDiv ) -{ - if ( pLine ) pLine->ScaleMetrics( nMult, nDiv ); - return 1; -} - -// ----------------------------------------------------------------------- - -int SvxLineItem::HasMetrics() const -{ - return 1; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxLineItem::Create( SvStream& rStrm, sal_uInt16 ) const -{ - SvxLineItem* _pLine = new SvxLineItem( Which() ); - short nOutline, nInline, nDistance; - Color aColor; - - rStrm >> aColor >> nOutline >> nInline >> nDistance; - if( nOutline ) - { - SvxBorderLine aLine( &aColor, nOutline, nInline, nDistance ); - _pLine->SetLine( &aLine ); - } - return _pLine; -} - -// ----------------------------------------------------------------------- - -void SvxLineItem::SetLine( const SvxBorderLine* pNew ) -{ - delete pLine; - pLine = pNew ? new SvxBorderLine( *pNew ) : 0; -} - -#ifdef _MSC_VER -#pragma optimize ( "", off ) -#endif - -// class SvxBrushItem ---------------------------------------------------- - -#define LOAD_GRAPHIC ((sal_uInt16)0x0001) -#define LOAD_LINK ((sal_uInt16)0x0002) -#define LOAD_FILTER ((sal_uInt16)0x0004) - -// class SvxBrushItem_Impl ----------------------------------------------- - -class SvxBrushItem_Impl -{ -public: - GraphicObject* pGraphicObject; - sal_Int8 nGraphicTransparency; //contains a percentage value which is - //copied to the GraphicObject when necessary -#ifndef SVX_LIGHT - SfxMediumRef xMedium; -#endif - Link aDoneLink; - - SvxBrushItem_Impl( GraphicObject* p ) : pGraphicObject( p ), nGraphicTransparency(0) {} -}; -/* -// class SvxBrushItemLink_Impl ------------------------------------------- - -class SvxBrushItemLink_Impl : public SfxBrushItemLink -{ - virtual Graphic GetGraphic( const String& rLink, const String& rFilter ); - virtual CreateSvxBrushTabPage GetBackgroundTabpageCreateFunc(); - virtual GetSvxBrushTabPageRanges GetBackgroundTabpageRanges(); -}; - -// ----------------------------------------------------------------------- - -Graphic SvxBrushItemLink_Impl::GetGraphic( const String& rLink, const String& rFilter) -{ - Graphic aResult; - SvxBrushItem aItem( rLink, rFilter, GPOS_TILED ); - const Graphic* pGraph = aItem.GetGraphic(); - if( pGraph ) - aResult = *pGraph; - return aResult; -} - -// ----------------------------------------------------------------------- - -CreateSvxBrushTabPage SvxBrushItemLink_Impl::GetBackgroundTabpageCreateFunc() -{ -#ifndef SVX_LIGHT - return (CreateSvxBrushTabPage)SvxBackgroundTabPage::Create; -#else - return CreateSvxBrushTabPage(); -#endif -} - -// ----------------------------------------------------------------------- - -GetSvxBrushTabPageRanges SvxBrushItemLink_Impl::GetBackgroundTabpageRanges() -{ -#ifndef SVX_LIGHT - return (GetSvxBrushTabPageRanges)SvxBackgroundTabPage::GetRanges; -#else - return GetSvxBrushTabPageRanges(); -#endif -} - -// ----------------------------------------------------------------------- - -void SvxBrushItem::InitSfxLink() -{ - SfxBrushItemLink::Set( new SvxBrushItemLink_Impl ); -} -*/ -// ----------------------------------------------------------------------- - -void SvxBrushItem::SetDoneLink( const Link& rLink ) -{ - pImpl->aDoneLink = rLink; -} - -// ----------------------------------------------------------------------- - -SvxBrushItem::SvxBrushItem( sal_uInt16 _nWhich ) : - - SfxPoolItem( _nWhich ), - - aColor ( COL_TRANSPARENT ), - pImpl ( new SvxBrushItem_Impl( 0 ) ), - pStrLink ( NULL ), - pStrFilter ( NULL ), - eGraphicPos ( GPOS_NONE ), - bLoadAgain ( sal_True ) - -{ -} - -// ----------------------------------------------------------------------- - -SvxBrushItem::SvxBrushItem( const Color& rColor, sal_uInt16 _nWhich) : - - SfxPoolItem( _nWhich ), - - aColor ( rColor ), - pImpl ( new SvxBrushItem_Impl( 0 ) ), - pStrLink ( NULL ), - pStrFilter ( NULL ), - eGraphicPos ( GPOS_NONE ), - bLoadAgain ( sal_True ) - -{ -} - -// ----------------------------------------------------------------------- - -SvxBrushItem::SvxBrushItem( const Graphic& rGraphic, SvxGraphicPosition ePos, - sal_uInt16 _nWhich ) : - - SfxPoolItem( _nWhich ), - - aColor ( COL_TRANSPARENT ), - pImpl ( new SvxBrushItem_Impl( new GraphicObject( rGraphic ) ) ), - pStrLink ( NULL ), - pStrFilter ( NULL ), - eGraphicPos ( ( GPOS_NONE != ePos ) ? ePos : GPOS_MM ), - bLoadAgain ( sal_True ) - -{ - DBG_ASSERT( GPOS_NONE != ePos, "SvxBrushItem-Ctor with GPOS_NONE == ePos" ); -} - -// ----------------------------------------------------------------------- - -SvxBrushItem::SvxBrushItem( const GraphicObject& rGraphicObj, - SvxGraphicPosition ePos, sal_uInt16 _nWhich ) : - - SfxPoolItem( _nWhich ), - - aColor ( COL_TRANSPARENT ), - pImpl ( new SvxBrushItem_Impl( new GraphicObject( rGraphicObj ) ) ), - pStrLink ( NULL ), - pStrFilter ( NULL ), - eGraphicPos ( ( GPOS_NONE != ePos ) ? ePos : GPOS_MM ), - bLoadAgain ( sal_True ) - -{ - DBG_ASSERT( GPOS_NONE != ePos, "SvxBrushItem-Ctor with GPOS_NONE == ePos" ); -} - -// ----------------------------------------------------------------------- - -SvxBrushItem::SvxBrushItem( - const String& rLink, const String& rFilter, - SvxGraphicPosition ePos, sal_uInt16 _nWhich ) : - - SfxPoolItem( _nWhich ), - - aColor ( COL_TRANSPARENT ), - pImpl ( new SvxBrushItem_Impl( NULL ) ), - pStrLink ( new String( rLink ) ), - pStrFilter ( new String( rFilter ) ), - eGraphicPos ( ( GPOS_NONE != ePos ) ? ePos : GPOS_MM ), - bLoadAgain ( sal_True ) - -{ - DBG_ASSERT( GPOS_NONE != ePos, "SvxBrushItem-Ctor with GPOS_NONE == ePos" ); -} - -// ----------------------------------------------------------------------- - -SvxBrushItem::SvxBrushItem( SvStream& rStream, sal_uInt16 nVersion, - sal_uInt16 _nWhich ) : - - SfxPoolItem( _nWhich ), - - aColor ( COL_TRANSPARENT ), - pImpl ( new SvxBrushItem_Impl( NULL ) ), - pStrLink ( NULL ), - pStrFilter ( NULL ), - eGraphicPos ( GPOS_NONE ) - -{ - sal_Bool bTrans; - Color aTempColor; - Color aTempFillColor; - sal_Int8 nStyle; - - rStream >> bTrans; - rStream >> aTempColor; - rStream >> aTempFillColor; - rStream >> nStyle; - - switch ( nStyle ) - { - case 8://BRUSH_25: - { - sal_uInt32 nRed = aTempColor.GetRed(); - sal_uInt32 nGreen = aTempColor.GetGreen(); - sal_uInt32 nBlue = aTempColor.GetBlue(); - nRed += (sal_uInt32)(aTempFillColor.GetRed())*2; - nGreen += (sal_uInt32)(aTempFillColor.GetGreen())*2; - nBlue += (sal_uInt32)(aTempFillColor.GetBlue())*2; - aColor = Color( (sal_Int8)(nRed/3), (sal_Int8)(nGreen/3), (sal_Int8)(nBlue/3) ); - } - break; - - case 9://BRUSH_50: - { - sal_uInt32 nRed = aTempColor.GetRed(); - sal_uInt32 nGreen = aTempColor.GetGreen(); - sal_uInt32 nBlue = aTempColor.GetBlue(); - nRed += (sal_uInt32)(aTempFillColor.GetRed()); - nGreen += (sal_uInt32)(aTempFillColor.GetGreen()); - nBlue += (sal_uInt32)(aTempFillColor.GetBlue()); - aColor = Color( (sal_Int8)(nRed/2), (sal_Int8)(nGreen/2), (sal_Int8)(nBlue/2) ); - } - break; - - case 10://BRUSH_75: - { - sal_uInt32 nRed = aTempColor.GetRed()*2; - sal_uInt32 nGreen = aTempColor.GetGreen()*2; - sal_uInt32 nBlue = aTempColor.GetBlue()*2; - nRed += (sal_uInt32)(aTempFillColor.GetRed()); - nGreen += (sal_uInt32)(aTempFillColor.GetGreen()); - nBlue += (sal_uInt32)(aTempFillColor.GetBlue()); - aColor = Color( (sal_Int8)(nRed/3), (sal_Int8)(nGreen/3), (sal_Int8)(nBlue/3) ); - } - break; - - case 0://BRUSH_NULL: - aColor = Color( COL_TRANSPARENT ); - break; - - default: - aColor = aTempColor; - } - - if ( nVersion >= BRUSH_GRAPHIC_VERSION ) - { - sal_uInt16 nDoLoad = 0; - sal_Int8 nPos; - - rStream >> nDoLoad; - - if ( nDoLoad & LOAD_GRAPHIC ) - { - Graphic aGraphic; - - rStream >> aGraphic; - pImpl->pGraphicObject = new GraphicObject( aGraphic ); - - if( SVSTREAM_FILEFORMAT_ERROR == rStream.GetError() ) - { - rStream.ResetError(); - rStream.SetError( ERRCODE_SVX_GRAPHIC_WRONG_FILEFORMAT| - ERRCODE_WARNING_MASK ); - } - } - - if ( nDoLoad & LOAD_LINK ) - { - String aRel; - // UNICODE: rStream >> aRel; - rStream.ReadByteString(aRel); - - // TODO/MBA: how can we get a BaseURL here?! - DBG_ERROR("No BaseURL!"); - String aAbs = INetURLObject::GetAbsURL( String(), aRel ); - DBG_ASSERT( aAbs.Len(), "Invalid URL!" ); - pStrLink = new String( aAbs ); - } - - if ( nDoLoad & LOAD_FILTER ) - { - pStrFilter = new String; - // UNICODE: rStream >> *pStrFilter; - rStream.ReadByteString(*pStrFilter); - } - - rStream >> nPos; - - eGraphicPos = (SvxGraphicPosition)nPos; - } -} - -// ----------------------------------------------------------------------- - -SvxBrushItem::SvxBrushItem( const SvxBrushItem& rItem ) : - - SfxPoolItem( rItem.Which() ), - - pImpl ( new SvxBrushItem_Impl( NULL ) ), - pStrLink ( NULL ), - pStrFilter ( NULL ), - eGraphicPos ( GPOS_NONE ), - bLoadAgain ( sal_True ) - -{ - *this = rItem; -} - -// ----------------------------------------------------------------------- - -SvxBrushItem::~SvxBrushItem() -{ -#ifndef SVX_LIGHT - if( pImpl->xMedium.Is() ) - pImpl->xMedium->SetDoneLink( Link() ); -#endif - delete pImpl->pGraphicObject; - delete pImpl; - delete pStrLink; - delete pStrFilter; -} - -// ----------------------------------------------------------------------- - -sal_uInt16 SvxBrushItem::GetVersion( sal_uInt16 /*nFileVersion*/ ) const -{ - return BRUSH_GRAPHIC_VERSION; -} - -// ----------------------------------------------------------------------- -inline sal_Int8 lcl_PercentToTransparency(long nPercent) -{ - //0xff must not be returned! - return sal_Int8(nPercent ? (50 + 0xfe * nPercent) / 100 : 0); -} -inline sal_Int8 lcl_TransparencyToPercent(sal_Int32 nTrans) -{ - return (sal_Int8)((nTrans * 100 + 127) / 254); -} - -sal_Bool SvxBrushItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const -{ -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); - nMemberId &= ~CONVERT_TWIPS; - switch( nMemberId) - { - case MID_BACK_COLOR: - rVal <<= (sal_Int32)( aColor.GetColor() ); - break; - case MID_BACK_COLOR_R_G_B: - rVal <<= (sal_Int32)( aColor.GetRGBColor() ); - break; - case MID_BACK_COLOR_TRANSPARENCY: - rVal <<= lcl_TransparencyToPercent(aColor.GetTransparency()); - break; - case MID_GRAPHIC_POSITION: - rVal <<= (style::GraphicLocation)(sal_Int16)eGraphicPos; - break; - - case MID_GRAPHIC: - DBG_ERRORFILE( "not implemented" ); - break; - - case MID_GRAPHIC_TRANSPARENT: - rVal = Bool2Any( aColor.GetTransparency() == 0xff ); - break; - - case MID_GRAPHIC_URL: - { - OUString sLink; - if ( pStrLink ) - sLink = *pStrLink; - else if( pImpl->pGraphicObject ) - { - OUString sPrefix(RTL_CONSTASCII_USTRINGPARAM(UNO_NAME_GRAPHOBJ_URLPREFIX)); - String sId( pImpl->pGraphicObject->GetUniqueID(), - RTL_TEXTENCODING_ASCII_US ); - sLink = sPrefix; - sLink += OUString(sId); - } - rVal <<= sLink; - } - break; - - case MID_GRAPHIC_FILTER: - { - OUString sFilter; - if ( pStrFilter ) - sFilter = *pStrFilter; - rVal <<= sFilter; - } - break; - case MID_GRAPHIC_TRANSPARENCY : - rVal <<= pImpl->nGraphicTransparency; - break; - } - - return sal_True; -} - -// ----------------------------------------------------------------------- - -sal_Bool SvxBrushItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) -{ -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); - nMemberId &= ~CONVERT_TWIPS; - switch( nMemberId) - { - case MID_BACK_COLOR: - case MID_BACK_COLOR_R_G_B: - { - sal_Int32 nCol = 0; - if ( !( rVal >>= nCol ) ) - return sal_False; - if(MID_BACK_COLOR_R_G_B == nMemberId) - { - nCol = COLORDATA_RGB( nCol ); - nCol += aColor.GetColor() & 0xff000000; - } - aColor = Color( nCol ); - } - break; - case MID_BACK_COLOR_TRANSPARENCY: - { - sal_Int32 nTrans = 0; - if ( !( rVal >>= nTrans ) || nTrans < 0 || nTrans > 100 ) - return sal_False; - aColor.SetTransparency(lcl_PercentToTransparency(nTrans)); - } - break; - - case MID_GRAPHIC_POSITION: - { - style::GraphicLocation eLocation; - if ( !( rVal>>=eLocation ) ) - { - sal_Int32 nValue = 0; - if ( !( rVal >>= nValue ) ) - return sal_False; - eLocation = (style::GraphicLocation)nValue; - } - SetGraphicPos( (SvxGraphicPosition)(sal_uInt16)eLocation ); - } - break; - - case MID_GRAPHIC: - DBG_ERRORFILE( "not implemented" ); - break; - - case MID_GRAPHIC_TRANSPARENT: - aColor.SetTransparency( Any2Bool( rVal ) ? 0xff : 0 ); - break; - - case MID_GRAPHIC_URL: - { - if ( rVal.getValueType() == ::getCppuType( (OUString*)0 ) ) - { - OUString sLink; - rVal >>= sLink; - if( 0 == sLink.compareToAscii( UNO_NAME_GRAPHOBJ_URLPKGPREFIX, - sizeof(UNO_NAME_GRAPHOBJ_URLPKGPREFIX)-1 ) ) - { - DBG_ERROR( "package urls aren't implemented" ); - } - else if( 0 == sLink.compareToAscii( UNO_NAME_GRAPHOBJ_URLPREFIX, - sizeof(UNO_NAME_GRAPHOBJ_URLPREFIX)-1 ) ) - { - DELETEZ( pStrLink ); - String sTmp( sLink ); - ByteString sId( sTmp.Copy( - sizeof(UNO_NAME_GRAPHOBJ_URLPREFIX)-1), - RTL_TEXTENCODING_ASCII_US ); - GraphicObject *pOldGrfObj = pImpl->pGraphicObject; - pImpl->pGraphicObject = new GraphicObject( sId ); - ApplyGraphicTransparency_Impl(); - delete pOldGrfObj; - } - else - { - SetGraphicLink(sLink); - } - if ( sLink.getLength() && eGraphicPos == GPOS_NONE ) - eGraphicPos = GPOS_MM; - else if( !sLink.getLength() ) - eGraphicPos = GPOS_NONE; - } - } - break; - - case MID_GRAPHIC_FILTER: - { - if( rVal.getValueType() == ::getCppuType( (OUString*)0 ) ) - { - OUString sLink; - rVal >>= sLink; - SetGraphicFilter( sLink ); - } - } - break; - case MID_GRAPHIC_TRANSPARENCY : - { - sal_Int32 nTmp = 0; - rVal >>= nTmp; - if(nTmp >= 0 && nTmp <= 100) - { - pImpl->nGraphicTransparency = sal_Int8(nTmp); - if(pImpl->pGraphicObject) - ApplyGraphicTransparency_Impl(); - } - } - break; - } - - return sal_True; -} - -// ----------------------------------------------------------------------- - -SfxItemPresentation SvxBrushItem::GetPresentation -( - SfxItemPresentation ePres, - SfxMapUnit /*eCoreUnit*/, - SfxMapUnit /*ePresUnit*/, - XubString& rText, const IntlWrapper * - ) const -{ -#ifndef SVX_LIGHT - switch ( ePres ) - { - case SFX_ITEM_PRESENTATION_NONE: - rText.Erase(); - return ePres; - - case SFX_ITEM_PRESENTATION_NAMELESS: - case SFX_ITEM_PRESENTATION_COMPLETE: - { - if ( GPOS_NONE == eGraphicPos ) - { - rText = ::GetColorString( aColor ); - rText += cpDelim; - sal_uInt16 nId = RID_SVXITEMS_TRANSPARENT_FALSE; - - if ( aColor.GetTransparency() ) - nId = RID_SVXITEMS_TRANSPARENT_TRUE; - rText += SVX_RESSTR(nId); - } - else - { - rText = SVX_RESSTR(RID_SVXITEMS_GRAPHIC); - } - - return ePres; - } - default: ;//prevent warning - } -#endif // !SVX_LIGHT - return SFX_ITEM_PRESENTATION_NONE; -} - -// ----------------------------------------------------------------------- - -SvxBrushItem& SvxBrushItem::operator=( const SvxBrushItem& rItem ) -{ - aColor = rItem.aColor; - eGraphicPos = rItem.eGraphicPos; - - DELETEZ( pImpl->pGraphicObject ); - DELETEZ( pStrLink ); - DELETEZ( pStrFilter ); - - if ( GPOS_NONE != eGraphicPos ) - { - if ( rItem.pStrLink ) - pStrLink = new String( *rItem.pStrLink ); - if ( rItem.pStrFilter ) - pStrFilter = new String( *rItem.pStrFilter ); - if ( rItem.pImpl->pGraphicObject ) - { - pImpl->pGraphicObject = new GraphicObject( *rItem.pImpl->pGraphicObject ); - } - } - pImpl->nGraphicTransparency = rItem.pImpl->nGraphicTransparency; - return *this; -} - -// ----------------------------------------------------------------------- - -int SvxBrushItem::operator==( const SfxPoolItem& rAttr ) const -{ - DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" ); - - SvxBrushItem& rCmp = (SvxBrushItem&)rAttr; - sal_Bool bEqual = ( aColor == rCmp.aColor && eGraphicPos == rCmp.eGraphicPos && - pImpl->nGraphicTransparency == rCmp.pImpl->nGraphicTransparency); - - if ( bEqual ) - { - if ( GPOS_NONE != eGraphicPos ) - { - if ( !rCmp.pStrLink ) - bEqual = !pStrLink; - else - bEqual = pStrLink && ( *pStrLink == *rCmp.pStrLink ); - - if ( bEqual ) - { - if ( !rCmp.pStrFilter ) - bEqual = !pStrFilter; - else - bEqual = pStrFilter && ( *pStrFilter == *rCmp.pStrFilter ); - } - - if ( bEqual && !rCmp.pStrLink ) - { - if ( !rCmp.pImpl->pGraphicObject ) - bEqual = !pImpl->pGraphicObject; - else - bEqual = pImpl->pGraphicObject && - ( *pImpl->pGraphicObject == *rCmp.pImpl->pGraphicObject ); - } - } - } - - return bEqual; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxBrushItem::Clone( SfxItemPool* ) const -{ - return new SvxBrushItem( *this ); -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxBrushItem::Create( SvStream& rStream, sal_uInt16 nVersion ) const -{ - return new SvxBrushItem( rStream, nVersion, Which() ); -} - -// ----------------------------------------------------------------------- - -SvStream& SvxBrushItem::Store( SvStream& rStream , sal_uInt16 /*nItemVersion*/ ) const -{ - rStream << (sal_Bool)sal_False; - rStream << aColor; - rStream << aColor; - rStream << (sal_Int8)(aColor.GetTransparency() > 0 ? 0 : 1); //BRUSH_NULL : BRUSH_SOLID - - sal_uInt16 nDoLoad = 0; - - if ( pImpl->pGraphicObject && !pStrLink ) - nDoLoad |= LOAD_GRAPHIC; - if ( pStrLink ) - nDoLoad |= LOAD_LINK; - if ( pStrFilter ) - nDoLoad |= LOAD_FILTER; - rStream << nDoLoad; - - if ( pImpl->pGraphicObject && !pStrLink ) - rStream << pImpl->pGraphicObject->GetGraphic(); - if ( pStrLink ) - { - DBG_ERROR("No BaseURL!"); - // TODO/MBA: how to get a BaseURL?! - String aRel = INetURLObject::GetRelURL( String(), *pStrLink ); - // UNICODE: rStream << aRel; - rStream.WriteByteString(aRel); - } - if ( pStrFilter ) - { - // UNICODE: rStream << *pStrFilter; - rStream.WriteByteString(*pStrFilter); - } - rStream << (sal_Int8)eGraphicPos; - return rStream; -} - -// ----------------------------------------------------------------------- -// const wegcasten, da const als logisches const zu verstehen ist -// wenn GetGraphic() gerufen wird, soll sich das Item darum kuemmern, -// eine gelinkte Grafik zu holen. - -GraphicFilter* GetGrfFilter(); - -IMPL_STATIC_LINK( SvxBrushItem, DoneHdl_Impl, void*, EMPTYARG ) -{ -#ifndef SVX_LIGHT - pThis->pImpl->pGraphicObject = new GraphicObject; - SvStream* pStream = pThis->pImpl->xMedium->GetInStream(); - if( pStream && !pStream->GetError() ) - { - Graphic aGraphic; - int nRes; - pStream->Seek( STREAM_SEEK_TO_BEGIN ); - nRes = GetGrfFilter()-> - ImportGraphic( aGraphic, *pThis->pStrLink, *pStream, - GRFILTER_FORMAT_DONTKNOW, NULL, GRFILTER_I_FLAGS_DONT_SET_LOGSIZE_FOR_JPEG ); - - if( nRes != GRFILTER_OK ) - { - DELETEZ( pThis->pImpl->pGraphicObject ); - pThis->bLoadAgain = sal_False; - } - else - { - pThis->pImpl->pGraphicObject->SetGraphic( aGraphic ); - pThis->ApplyGraphicTransparency_Impl(); - } - } - else - { - DELETEZ( pThis->pImpl->pGraphicObject ); - pThis->bLoadAgain = sal_False; - } - - pThis->pImpl->xMedium.Clear(); - pThis->pImpl->aDoneLink.Call( pThis ); -#endif - return 0; -} - -// ----------------------------------------------------------------------- - -void SvxBrushItem::PurgeGraphic() const -{ -#ifndef SVX_LIGHT - PurgeMedium(); - DELETEZ( pImpl->pGraphicObject ); - ((SvxBrushItem*)this)->bLoadAgain = sal_True; -#endif -} - -// ----------------------------------------------------------------------- - -void SvxBrushItem::PurgeMedium() const -{ -#ifndef SVX_LIGHT - pImpl->xMedium.Clear(); -#endif -} - -// ----------------------------------------------------------------------- - -const GraphicObject* SvxBrushItem::GetGraphicObject( SfxObjectShell* pSh ) const -{ -#ifndef SVX_LIGHT - if ( bLoadAgain && pStrLink && !pImpl->pGraphicObject && !pImpl->xMedium.Is() ) - // wenn Grafik schon geladen, als Cache benutzen - { - //JP 29.6.2001: only with "valid" names - empty names now allowed - if( pStrLink->Len() ) - { - pImpl->xMedium = new SfxMedium( - *pStrLink, STREAM_STD_READ, sal_False ); - - if( pImpl->xMedium->IsRemote() ) - { - if( pSh ) - { - pSh->RegisterTransfer( *pImpl->xMedium ); - } - else - { - DBG_WARNING( "SvxBrushItem::GetGraphic ohne DocShell" ); - } - } - - SfxMediumRef xRef( pImpl->xMedium ); - // Ref halten wg. synchr. DoneCallback - if( pImpl->aDoneLink.IsSet() ) - { - // Auf besonderen Wunsch des Writers wird der synchrone und der - // asynchrone Fall was die Benachrichtigung angeht unterschiedlich - // behandelt. Der Callback erfolgt nur bei asynchronem Eintreffen - // der Daten - - Link aTmp = pImpl->aDoneLink; - pImpl->aDoneLink = Link(); - pImpl->xMedium->DownLoad( - STATIC_LINK( this, SvxBrushItem, DoneHdl_Impl ) ); - pImpl->aDoneLink = aTmp; - } - else - { - pImpl->xMedium->DownLoad( ); - DoneHdl_Impl( (SvxBrushItem*)this, 0 ); - } - } - } -#endif - return pImpl->pGraphicObject; -} - -// ----------------------------------------------------------------------- - -const Graphic* SvxBrushItem::GetGraphic( SfxObjectShell* pSh ) const -{ - const GraphicObject* pGrafObj = GetGraphicObject( pSh ); - return( pGrafObj ? &( pGrafObj->GetGraphic() ) : NULL ); -} - -// ----------------------------------------------------------------------- - -void SvxBrushItem::SetGraphicPos( SvxGraphicPosition eNew ) -{ - eGraphicPos = eNew; - - if ( GPOS_NONE == eGraphicPos ) - { - DELETEZ( pImpl->pGraphicObject ); - DELETEZ( pStrLink ); - DELETEZ( pStrFilter ); - } - else - { - if ( !pImpl->pGraphicObject && !pStrLink ) - { - pImpl->pGraphicObject = new GraphicObject; // dummy anlegen - } - } -} - -// ----------------------------------------------------------------------- - -void SvxBrushItem::SetGraphic( const Graphic& rNew ) -{ - if ( !pStrLink ) - { - if ( pImpl->pGraphicObject ) - pImpl->pGraphicObject->SetGraphic( rNew ); - else - pImpl->pGraphicObject = new GraphicObject( rNew ); - - ApplyGraphicTransparency_Impl(); - - if ( GPOS_NONE == eGraphicPos ) - eGraphicPos = GPOS_MM; // None waere Brush, also Default: Mitte - } - else - { - DBG_ERROR( "SetGraphic() on linked graphic! :-/" ); - } -} - -// ----------------------------------------------------------------------- - -void SvxBrushItem::SetGraphicObject( const GraphicObject& rNewObj ) -{ - if ( !pStrLink ) - { - if ( pImpl->pGraphicObject ) - *pImpl->pGraphicObject = rNewObj; - else - pImpl->pGraphicObject = new GraphicObject( rNewObj ); - - ApplyGraphicTransparency_Impl(); - - if ( GPOS_NONE == eGraphicPos ) - eGraphicPos = GPOS_MM; // None waere Brush, also Default: Mitte - } - else - { - DBG_ERROR( "SetGraphic() on linked graphic! :-/" ); - } -} - -// ----------------------------------------------------------------------- - -void SvxBrushItem::SetGraphicLink( const String& rNew ) -{ - if ( !rNew.Len() ) - DELETEZ( pStrLink ); - else - { - if ( pStrLink ) - *pStrLink = rNew; - else - pStrLink = new String( rNew ); - - DELETEZ( pImpl->pGraphicObject ); - } -} - -// ----------------------------------------------------------------------- - -void SvxBrushItem::SetGraphicFilter( const String& rNew ) -{ - if ( !rNew.Len() ) - DELETEZ( pStrFilter ); - else - { - if ( pStrFilter ) - *pStrFilter = rNew; - else - pStrFilter = new String( rNew ); - } -} - -//static -SvxGraphicPosition SvxBrushItem::WallpaperStyle2GraphicPos( WallpaperStyle eStyle ) -{ - SvxGraphicPosition eResult; - // der Switch ist nicht der schnellste, dafuer aber am sichersten - switch( eStyle ) - { - case WALLPAPER_NULL: eResult = GPOS_NONE; break; - case WALLPAPER_TILE: eResult = GPOS_TILED; break; - case WALLPAPER_CENTER: eResult = GPOS_MM; break; - case WALLPAPER_SCALE: eResult = GPOS_AREA; break; - case WALLPAPER_TOPLEFT: eResult = GPOS_LT; break; - case WALLPAPER_TOP: eResult = GPOS_MT; break; - case WALLPAPER_TOPRIGHT: eResult = GPOS_RT; break; - case WALLPAPER_LEFT: eResult = GPOS_LM; break; - case WALLPAPER_RIGHT: eResult = GPOS_RM; break; - case WALLPAPER_BOTTOMLEFT: eResult = GPOS_LB; break; - case WALLPAPER_BOTTOM: eResult = GPOS_MB; break; - case WALLPAPER_BOTTOMRIGHT: eResult = GPOS_RB; break; - default: eResult = GPOS_NONE; - } - return eResult; -}; - -//static -WallpaperStyle SvxBrushItem::GraphicPos2WallpaperStyle( SvxGraphicPosition ePos ) -{ - WallpaperStyle eResult; - switch( ePos ) - { - case GPOS_NONE: eResult = WALLPAPER_NULL; break; - case GPOS_TILED: eResult = WALLPAPER_TILE; break; - case GPOS_MM: eResult = WALLPAPER_CENTER; break; - case GPOS_AREA: eResult = WALLPAPER_SCALE; break; - case GPOS_LT: eResult = WALLPAPER_TOPLEFT; break; - case GPOS_MT: eResult = WALLPAPER_TOP; break; - case GPOS_RT: eResult = WALLPAPER_TOPRIGHT; break; - case GPOS_LM: eResult = WALLPAPER_LEFT; break; - case GPOS_RM: eResult = WALLPAPER_RIGHT; break; - case GPOS_LB: eResult = WALLPAPER_BOTTOMLEFT; break; - case GPOS_MB: eResult = WALLPAPER_BOTTOM; break; - case GPOS_RB: eResult = WALLPAPER_BOTTOMRIGHT; break; - default: eResult = WALLPAPER_NULL; - } - return eResult; -} - - -SvxBrushItem::SvxBrushItem( const CntWallpaperItem& rItem, sal_uInt16 _nWhich ) : - SfxPoolItem( _nWhich ), - pImpl( new SvxBrushItem_Impl( 0 ) ), - pStrLink(0), - pStrFilter(0), - bLoadAgain( sal_True ) -{ - aColor = rItem.GetColor(); - - if( rItem.GetBitmapURL().Len() ) - { - pStrLink = new String( rItem.GetBitmapURL() ); - SetGraphicPos( WallpaperStyle2GraphicPos((WallpaperStyle)rItem.GetStyle() ) ); - } -} - -CntWallpaperItem* SvxBrushItem::CreateCntWallpaperItem() const -{ - CntWallpaperItem* pItem = new CntWallpaperItem( 0 ); - pItem->SetColor( aColor.GetColor() ); - pItem->SetStyle( (USHORT)GraphicPos2WallpaperStyle( GetGraphicPos() ) ); - sal_Bool bLink = (pStrLink != 0); - if( bLink ) - { - String aURL = *pStrLink; - pItem->SetBitmapURL( aURL ); - } - if( pImpl->pGraphicObject ) - { - DBG_ERRORFILE( "Don't know what to do with a graphic" ); - } -// pItem->SetGraphic( *pImpl->pGraphic, bLink ); - - return pItem; -} - -#ifdef _MSC_VER -#pragma optimize ( "", on ) -#endif -/* -----------------------------16.08.2002 09:18------------------------------ - - ---------------------------------------------------------------------------*/ -void SvxBrushItem::ApplyGraphicTransparency_Impl() -{ - DBG_ASSERT(pImpl->pGraphicObject, "no GraphicObject available" ); - if(pImpl->pGraphicObject) - { - GraphicAttr aAttr(pImpl->pGraphicObject->GetAttr()); - aAttr.SetTransparency(lcl_PercentToTransparency( - pImpl->nGraphicTransparency)); - pImpl->pGraphicObject->SetAttr(aAttr); - } -} -// class SvxFrameDirectionItem ---------------------------------------------- - -SvxFrameDirectionItem::SvxFrameDirectionItem( USHORT _nWhich ) - : SfxUInt16Item( _nWhich, (UINT16)FRMDIR_HORI_LEFT_TOP ) -{ -} - -SvxFrameDirectionItem::SvxFrameDirectionItem( SvxFrameDirection nValue , - USHORT _nWhich ) - : SfxUInt16Item( _nWhich, (UINT16)nValue ) -{ -} - -SvxFrameDirectionItem::~SvxFrameDirectionItem() -{ -} - -int SvxFrameDirectionItem::operator==( const SfxPoolItem& rCmp ) const -{ - DBG_ASSERT( SfxPoolItem::operator==(rCmp), "unequal types" ); - - return GetValue() == ((SvxFrameDirectionItem&)rCmp).GetValue(); -} - -SfxPoolItem* SvxFrameDirectionItem::Clone( SfxItemPool * ) const -{ - return new SvxFrameDirectionItem( *this ); -} - -SfxPoolItem* SvxFrameDirectionItem::Create( SvStream & rStrm, USHORT /*nVer*/ ) const -{ - sal_uInt16 nValue; - rStrm >> nValue; - return new SvxFrameDirectionItem( (SvxFrameDirection)nValue, Which() ); -} - -SvStream& SvxFrameDirectionItem::Store( SvStream & rStrm, USHORT /*nIVer*/ ) const -{ - sal_uInt16 nValue = GetValue(); - rStrm << nValue; - return rStrm; -} - -USHORT SvxFrameDirectionItem::GetVersion( USHORT nFVer ) const -{ - return SOFFICE_FILEFORMAT_50 > nFVer ? USHRT_MAX : 0; -} - -SfxItemPresentation SvxFrameDirectionItem::GetPresentation( - SfxItemPresentation ePres, - SfxMapUnit /*eCoreUnit*/, - SfxMapUnit /*ePresUnit*/, - XubString& rText, const IntlWrapper *) const -{ - SfxItemPresentation eRet = ePres; - switch( ePres ) - { - case SFX_ITEM_PRESENTATION_NONE: - rText.Erase(); - break; - - case SFX_ITEM_PRESENTATION_NAMELESS: - case SFX_ITEM_PRESENTATION_COMPLETE: - rText = SVX_RESSTR( RID_SVXITEMS_FRMDIR_BEGIN + GetValue() ); - break; - - default: - eRet = SFX_ITEM_PRESENTATION_NONE; - } - return eRet; -} - -sal_Bool SvxFrameDirectionItem::PutValue( const com::sun::star::uno::Any& rVal, - BYTE ) -{ - sal_Int16 nVal = sal_Int16(); - sal_Bool bRet = ( rVal >>= nVal ); - if( bRet ) - { - // translate WritingDirection2 constants into SvxFrameDirection - switch( nVal ) - { - case text::WritingMode2::LR_TB: - SetValue( FRMDIR_HORI_LEFT_TOP ); - break; - case text::WritingMode2::RL_TB: - SetValue( FRMDIR_HORI_RIGHT_TOP ); - break; - case text::WritingMode2::TB_RL: - SetValue( FRMDIR_VERT_TOP_RIGHT ); - break; - case text::WritingMode2::TB_LR: - SetValue( FRMDIR_VERT_TOP_LEFT ); - break; - case text::WritingMode2::PAGE: - SetValue( FRMDIR_ENVIRONMENT ); - break; - default: - bRet = sal_False; - break; - } - } - - return bRet; -} - -sal_Bool SvxFrameDirectionItem::QueryValue( com::sun::star::uno::Any& rVal, - BYTE ) const -{ - // translate SvxFrameDirection into WritingDirection2 - sal_Int16 nVal; - sal_Bool bRet = sal_True; - switch( GetValue() ) - { - case FRMDIR_HORI_LEFT_TOP: - nVal = text::WritingMode2::LR_TB; - break; - case FRMDIR_HORI_RIGHT_TOP: - nVal = text::WritingMode2::RL_TB; - break; - case FRMDIR_VERT_TOP_RIGHT: - nVal = text::WritingMode2::TB_RL; - break; - case FRMDIR_VERT_TOP_LEFT: - nVal = text::WritingMode2::TB_LR; - break; - case FRMDIR_ENVIRONMENT: - nVal = text::WritingMode2::PAGE; - break; - default: - DBG_ERROR("Unknown SvxFrameDirection value!"); - bRet = sal_False; - break; - } - - // return value + error state - if( bRet ) - { - rVal <<= nVal; - } - return bRet; -} - diff --git a/svx/source/items/grfitem.cxx b/svx/source/items/grfitem.cxx index e16a4883693d..ce28ee300cbb 100644 --- a/svx/source/items/grfitem.cxx +++ b/svx/source/items/grfitem.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: grfitem.cxx,v $ - * $Revision: 1.12 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -34,7 +31,7 @@ #include <tools/stream.hxx> #include <svx/grfcrop.hxx> -#include <svx/itemtype.hxx> +#include <editeng/itemtype.hxx> #include <com/sun/star/text/GraphicCrop.hpp> using namespace ::com::sun::star; diff --git a/svx/source/items/hlnkitem.cxx b/svx/source/items/hlnkitem.cxx index 2fd9d073c08c..a67a87021d31 100644 --- a/svx/source/items/hlnkitem.cxx +++ b/svx/source/items/hlnkitem.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: hlnkitem.cxx,v $ - * $Revision: 1.12 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svx/source/items/itemtype.cxx b/svx/source/items/itemtype.cxx deleted file mode 100644 index 4c1ac9b85eec..000000000000 --- a/svx/source/items/itemtype.cxx +++ /dev/null @@ -1,258 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: itemtype.cxx,v $ - * $Revision: 1.10 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svx.hxx" - -// include --------------------------------------------------------------- -#include <tools/list.hxx> -#include <vcl/outdev.hxx> -#include <sfx2/objsh.hxx> - -#include <svx/svxids.hrc> - - -#include <unotools/intlwrapper.hxx> -#include <unotools/localedatawrapper.hxx> -#include <svx/xtable.hxx> -#include "drawitem.hxx" -#include <svx/itemtype.hxx> - -// ----------------------------------------------------------------------- - -XubString GetMetricText( long nVal, SfxMapUnit eSrcUnit, SfxMapUnit eDestUnit, const IntlWrapper* pIntl ) -{ - sal_Bool bNeg = sal_False; - long nRet = 0; - XubString sRet; - - if ( nVal < 0 ) - { - bNeg = sal_True; - nVal *= -1; - } - - switch ( eDestUnit ) - { - case SFX_MAPUNIT_100TH_MM: - case SFX_MAPUNIT_10TH_MM: - case SFX_MAPUNIT_MM: - case SFX_MAPUNIT_CM: - { - nRet = (long)OutputDevice::LogicToLogic( - nVal, (MapUnit)eSrcUnit, (MapUnit)SFX_MAPUNIT_100TH_MM ); - - switch ( eDestUnit ) - { - case SFX_MAPUNIT_100TH_MM: nRet *= 1000; break; - case SFX_MAPUNIT_10TH_MM: nRet *= 100; break; - case SFX_MAPUNIT_MM: nRet *= 10; break; - default: ;//prevent warning - } - break; - } - - case SFX_MAPUNIT_1000TH_INCH: - case SFX_MAPUNIT_100TH_INCH: - case SFX_MAPUNIT_10TH_INCH: - case SFX_MAPUNIT_INCH: - { - nRet = (long)OutputDevice::LogicToLogic( - nVal, (MapUnit)eSrcUnit, (MapUnit)SFX_MAPUNIT_1000TH_INCH ); - - switch ( eDestUnit ) - { - case SFX_MAPUNIT_1000TH_INCH: nRet *= 1000; break; - case SFX_MAPUNIT_100TH_INCH: nRet *= 100; break; - case SFX_MAPUNIT_10TH_INCH: nRet *= 10; break; - default: ;//prevent warning - } - break; - } - - case SFX_MAPUNIT_POINT: - case SFX_MAPUNIT_TWIP: - case SFX_MAPUNIT_PIXEL: - return String::CreateFromInt32( (long)OutputDevice::LogicToLogic( - nVal, (MapUnit)eSrcUnit, (MapUnit)eDestUnit )); - - default: - DBG_ERROR( "not supported mapunit" ); - return sRet; - } - - if ( SFX_MAPUNIT_CM == eDestUnit || SFX_MAPUNIT_INCH == eDestUnit ) - { - long nMod = nRet % 10; - - if ( nMod > 4 ) - nRet += 10 - nMod; - else if ( nMod > 0 ) - nRet -= nMod; - } - - if ( bNeg ) - sRet += sal_Unicode('-'); - - long nDiff = 1000; - for( int nDigits = 4; nDigits; --nDigits, nDiff /= 10 ) - { - if ( nRet < nDiff ) - sRet += sal_Unicode('0'); - else - sRet += String::CreateFromInt32( nRet / nDiff ); - nRet %= nDiff; - if( 4 == nDigits ) - { -// DBG_ASSERT(pIntl, "no IntlWrapper* set") - if(pIntl) - sRet += pIntl->getLocaleData()->getNumDecimalSep(); - else - sRet += ','; - if( !nRet ) - { - sRet += sal_Unicode('0'); - break; - } - } - else if( !nRet ) - break; - } - return sRet; -} - -// ----------------------------------------------------------------------- - -XubString GetSvxString( sal_uInt16 nId ) -{ - return SVX_RESSTR( nId ); -} - -#ifndef SVX_LIGHT - -// ----------------------------------------------------------------------- - -XubString GetColorString( const Color& rCol ) -{ - const SfxPoolItem* pItem = NULL; - XColorTable* pCol = NULL; - SfxObjectShell* pSh = SfxObjectShell::Current(); - - if ( pSh ) - { - pItem = pSh->GetItem( SID_COLOR_TABLE ); - if( pItem ) - pCol = static_cast<const SvxColorTableItem*>(pItem )->GetColorTable(); - } - - XubString sStr; - - FASTBOOL bFound = sal_False; - ColorData nColData = - RGB_COLORDATA( rCol.GetRed(), rCol.GetGreen(), rCol.GetBlue() ); - sal_uInt16 nColor = 0, nColCount = 16; - - static ColorData aColAry[] = { - COL_BLACK, COL_BLUE, COL_GREEN, COL_CYAN, - COL_RED, COL_MAGENTA, COL_BROWN, COL_GRAY, - COL_LIGHTGRAY, COL_LIGHTBLUE, COL_LIGHTGREEN, COL_LIGHTCYAN, - COL_LIGHTRED, COL_LIGHTMAGENTA, COL_YELLOW, COL_WHITE }; - - while ( !bFound && nColor < nColCount ) - { - if ( aColAry[nColor] == nColData ) - bFound = sal_True; - else - nColor++; - } - - if ( nColor < nColCount ) - sStr = SVX_RESSTR( RID_SVXITEMS_COLOR_BEGIN + nColor + 1 ); - - if ( !sStr.Len() ) - { - sStr.AppendAscii(RTL_CONSTASCII_STRINGPARAM( "RGB" )); - sStr += sal_Unicode('('); - sStr += String::CreateFromInt32( rCol.GetRed() ); - sStr += cpDelim; - sStr += String::CreateFromInt32( rCol.GetGreen() ); - sStr += cpDelim; - sStr += String::CreateFromInt32( rCol.GetBlue() ); - sStr += sal_Unicode(')'); - } - return sStr; -} - -#endif - -// ----------------------------------------------------------------------- - -sal_uInt16 GetMetricId( SfxMapUnit eUnit ) -{ - sal_uInt16 nId = RID_SVXITEMS_METRIC_MM; - - switch ( eUnit ) - { - case SFX_MAPUNIT_100TH_MM: - case SFX_MAPUNIT_10TH_MM: - case SFX_MAPUNIT_MM: - nId = RID_SVXITEMS_METRIC_MM; - break; - - case SFX_MAPUNIT_CM: - nId = RID_SVXITEMS_METRIC_CM; - break; - - case SFX_MAPUNIT_1000TH_INCH: - case SFX_MAPUNIT_100TH_INCH: - case SFX_MAPUNIT_10TH_INCH: - case SFX_MAPUNIT_INCH: - nId = RID_SVXITEMS_METRIC_INCH; - break; - - case SFX_MAPUNIT_POINT: - nId = RID_SVXITEMS_METRIC_POINT; - break; - - case SFX_MAPUNIT_TWIP: - nId = RID_SVXITEMS_METRIC_TWIP; - break; - - case SFX_MAPUNIT_PIXEL: - nId = RID_SVXITEMS_METRIC_PIXEL; - break; - - default: - DBG_ERROR( "not supported mapunit" ); - } - return nId; -} - - diff --git a/svx/source/items/makefile.mk b/svx/source/items/makefile.mk index d99f1705f5b4..188e6171bd26 100644 --- a/svx/source/items/makefile.mk +++ b/svx/source/items/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.19 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify @@ -50,29 +46,16 @@ LIBTARGET=NO SRS1NAME=svxitems SRC1FILES = \ svxerr.src \ - page.src \ svxitems.src LIB1TARGET= $(SLB)$/$(TARGET)-core.lib LIB1OBJFILES= \ - $(SLO)$/writingmodeitem.obj \ - $(SLO)$/frmitems.obj \ - $(SLO)$/paraitem.obj \ - $(SLO)$/textitem.obj \ - $(SLO)$/flditem.obj \ - $(SLO)$/svxfont.obj \ - $(SLO)$/paperinf.obj \ $(SLO)$/drawitem.obj \ - $(SLO)$/itemtype.obj \ $(SLO)$/chrtitem.obj \ - $(SLO)$/bulitem.obj \ $(SLO)$/e3ditem.obj \ - $(SLO)$/numitem.obj \ $(SLO)$/grfitem.obj \ $(SLO)$/clipfmtitem.obj \ - $(SLO)$/xmlcnitm.obj \ - $(SLO)$/customshapeitem.obj \ - $(SLO)$/charhiddenitem.obj + $(SLO)$/customshapeitem.obj LIB2TARGET= $(SLB)$/$(TARGET).lib LIB2OBJFILES= \ @@ -80,7 +63,7 @@ LIB2OBJFILES= \ $(SLO)$/postattr.obj \ $(SLO)$/hlnkitem.obj \ $(SLO)$/pageitem.obj \ - $(SLO)$/viewlayoutitem.obj \ + $(SLO)$/viewlayoutitem.obj \ $(SLO)$/algitem.obj \ $(SLO)$/rotmodit.obj \ $(SLO)$/numinf.obj \ @@ -94,11 +77,6 @@ LIB2OBJFILES= \ SLOFILES = $(LIB1OBJFILES) $(LIB2OBJFILES) EXCEPTIONSFILES= \ - $(SLO)$/paraitem.obj \ - $(SLO)$/frmitems.obj \ - $(SLO)$/numitem.obj\ - $(SLO)$/xmlcnitm.obj\ - $(SLO)$/flditem.obj \ $(SLO)$/customshapeitem.obj .INCLUDE : target.mk diff --git a/svx/source/items/numfmtsh.cxx b/svx/source/items/numfmtsh.cxx index cb26266abb01..7f4505e37866 100644 --- a/svx/source/items/numfmtsh.cxx +++ b/svx/source/items/numfmtsh.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: numfmtsh.cxx,v $ - * $Revision: 1.20.128.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svx/source/items/numinf.cxx b/svx/source/items/numinf.cxx index 6cda7c42b001..b57bad8f2707 100644 --- a/svx/source/items/numinf.cxx +++ b/svx/source/items/numinf.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: numinf.cxx,v $ - * $Revision: 1.9 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svx/source/items/numitem.cxx b/svx/source/items/numitem.cxx deleted file mode 100644 index 384ead550c9e..000000000000 --- a/svx/source/items/numitem.cxx +++ /dev/null @@ -1,1279 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: numitem.cxx,v $ - * $Revision: 1.30 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svx.hxx" - -#include <svx/numitem.hxx> - -#include <com/sun/star/text/HoriOrientation.hpp> -#include <com/sun/star/text/VertOrientation.hpp> -#include <com/sun/star/text/RelOrientation.hpp> -#include <svx/brshitem.hxx> -#include <vcl/font.hxx> -#ifndef _SVX_SVXIDS_HRC -#include <svx/svxids.hrc> -#endif -#ifndef _SVX_NUMDEF_HXX -#include <svx/numdef.hxx> -#endif -#include <vcl/graph.hxx> -#include <vcl/window.hxx> -#include <vcl/svapp.hxx> -#include <unolingu.hxx> -#include <com/sun/star/text/XNumberingFormatter.hpp> -#include <com/sun/star/text/XDefaultNumberingProvider.hpp> -#include <com/sun/star/style/NumberingType.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/beans/PropertyValue.hpp> -#include <comphelper/processfactory.hxx> - -#include "unonrule.hxx" - -#define MM100_TO_TWIP(MM100) ((MM100*72L+63L)/127L) - -#define DEF_WRITER_LSPACE 500 //Standardeinrueckung -#define DEF_DRAW_LSPACE 800 //Standardeinrueckung - -#define NUMITEM_VERSION_01 0x01 -#define NUMITEM_VERSION_02 0x02 -#define NUMITEM_VERSION_03 0x03 -#define NUMITEM_VERSION_04 0x04 - -using namespace ::com::sun::star; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::text; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::style; - -sal_Int32 SvxNumberType::nRefCount = 0; -com::sun::star::uno::Reference<com::sun::star::text::XNumberingFormatter> SvxNumberType::xFormatter = 0; -void lcl_getFormatter(com::sun::star::uno::Reference<com::sun::star::text::XNumberingFormatter>& _xFormatter) -{ - if(!_xFormatter.is()) - { - try - { - Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); - Reference < XInterface > xI = xMSF->createInstance( - ::rtl::OUString::createFromAscii( "com.sun.star.text.DefaultNumberingProvider" ) ); - Reference<XDefaultNumberingProvider> xRet(xI, UNO_QUERY); - DBG_ASSERT(xRet.is(), "service missing: \"com.sun.star.text.DefaultNumberingProvider\""); - _xFormatter = Reference<XNumberingFormatter> (xRet, UNO_QUERY); - } - catch(Exception& ) - { - } - } -} -/* -----------------------------22.02.01 14:24-------------------------------- - - ---------------------------------------------------------------------------*/ -SvxNumberType::SvxNumberType(sal_Int16 nType) : - nNumType(nType), - bShowSymbol(sal_True) -{ - nRefCount++; -} -/* -----------------------------22.02.01 14:31-------------------------------- - - ---------------------------------------------------------------------------*/ -SvxNumberType::SvxNumberType(const SvxNumberType& rType) : - nNumType(rType.nNumType), - bShowSymbol(rType.bShowSymbol) -{ - nRefCount++; -} -/* -----------------------------22.02.01 14:24-------------------------------- - - ---------------------------------------------------------------------------*/ -SvxNumberType::~SvxNumberType() -{ - if(!--nRefCount) - xFormatter = 0; -} -/* -----------------------------22.02.01 11:09-------------------------------- - - ---------------------------------------------------------------------------*/ -String SvxNumberType::GetNumStr( ULONG nNo ) const -{ - LanguageType eLang = Application::GetSettings().GetLanguage(); - Locale aLocale = SvxCreateLocale(eLang); - return GetNumStr( nNo, aLocale ); -} -/* -----------------28.10.98 15:56------------------- - * - * --------------------------------------------------*/ -String SvxNumberType::GetNumStr( ULONG nNo, const Locale& rLocale ) const -{ - lcl_getFormatter(xFormatter); - String aTmpStr; - if(!xFormatter.is()) - return aTmpStr; - - if(bShowSymbol) - { - switch(nNumType) - { - case NumberingType::CHAR_SPECIAL: - case NumberingType::BITMAP: - break; - default: - { - //#95525# '0' allowed for ARABIC numberings - if(NumberingType::ARABIC == nNumType && 0 == nNo ) - aTmpStr = '0'; - else - { - Sequence< PropertyValue > aProperties(2); - PropertyValue* pValues = aProperties.getArray(); - pValues[0].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NumberingType")); - pValues[0].Value <<= nNumType; - pValues[1].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Value")); - pValues[1].Value <<= (sal_Int32)nNo; - - try - { - aTmpStr = xFormatter->makeNumberingString( aProperties, rLocale ); - } - catch(Exception&) - { - } - } - } - } - } - return aTmpStr; -} -/* -----------------27.10.98 10:33------------------- - * - * --------------------------------------------------*/ -// --> OD 2008-01-09 #newlistlevelattrs# -SvxNumberFormat::SvxNumberFormat( sal_Int16 eType, - SvxNumPositionAndSpaceMode ePositionAndSpaceMode ) -// <-- - : SvxNumberType(eType), - eNumAdjust(SVX_ADJUST_LEFT), - nInclUpperLevels(0), - nStart(1), - cBullet(SVX_DEF_BULLET), - nBulletRelSize(100), - nBulletColor(COL_BLACK), - // --> OD 2008-01-09 #newlistlevelattrs# - mePositionAndSpaceMode( ePositionAndSpaceMode ), - // <-- - nFirstLineOffset(0), - nAbsLSpace(0), - nLSpace(0), - nCharTextDistance(0), - // --> OD 2008-01-09 #newlistlevelattrs# - meLabelFollowedBy( LISTTAB ), - mnListtabPos( 0 ), - mnFirstLineIndent( 0 ), - mnIndentAt( 0 ), - // <-- - pGraphicBrush(0), - eVertOrient(text::VertOrientation::NONE), - pBulletFont(0) -{ -} -/* -----------------27.10.98 10:56------------------- - * - * --------------------------------------------------*/ -SvxNumberFormat::SvxNumberFormat(const SvxNumberFormat& rFormat) : - SvxNumberType(rFormat), - // --> OD 2008-01-09 #newlistlevelattrs# - mePositionAndSpaceMode( rFormat.mePositionAndSpaceMode ), - // <-- - pGraphicBrush(0), - pBulletFont(0) -{ - *this = rFormat; -} -/* -----------------27.10.98 10:56------------------- - * - * --------------------------------------------------*/ -SvxNumberFormat::~SvxNumberFormat() -{ - delete pGraphicBrush; - delete pBulletFont; -} -/* -----------------08.12.98 11:14------------------- - * - * --------------------------------------------------*/ -SvxNumberFormat::SvxNumberFormat(SvStream &rStream) -: mePositionAndSpaceMode( LABEL_WIDTH_AND_POSITION ), - meLabelFollowedBy( LISTTAB ), - mnListtabPos( 0 ), - mnFirstLineIndent( 0 ), - mnIndentAt( 0 ) -{ - - USHORT nVersion; - rStream >> nVersion; - - USHORT nUSHORT; - rStream >> nUSHORT; - SetNumberingType((sal_Int16)nUSHORT); - rStream >> nUSHORT; - eNumAdjust = (SvxAdjust)nUSHORT; - rStream >> nUSHORT; - nInclUpperLevels = (BYTE)nUSHORT; - rStream >> nUSHORT; - nStart = nUSHORT; - rStream >> nUSHORT; - cBullet = nUSHORT; - - short nShort; - rStream >> nShort; - nFirstLineOffset = nShort; - rStream >> nShort; - nAbsLSpace = nShort; - rStream >> nShort; - nLSpace = nShort; - - rStream >> nShort; - nCharTextDistance = nShort; - rtl_TextEncoding eEnc = gsl_getSystemTextEncoding(); - rStream.ReadByteString(sPrefix, eEnc); - rStream.ReadByteString(sSuffix, eEnc); - rStream.ReadByteString(sCharStyleName, eEnc); - rStream >> nUSHORT; - if(nUSHORT) - { - SvxBrushItem aHelper(0); - pGraphicBrush = (SvxBrushItem*) aHelper.Create( rStream, BRUSH_GRAPHIC_VERSION ); - } - else - pGraphicBrush = 0; - - rStream >> nUSHORT; - eVertOrient = (sal_Int16)nUSHORT; - - rStream >> nUSHORT; - if(nUSHORT) - { - pBulletFont = new Font; - rStream >> *pBulletFont; - if(!pBulletFont->GetCharSet()) - pBulletFont->SetCharSet(rStream.GetStreamCharSet()); - } - else - pBulletFont = 0; - rStream >> aGraphicSize; - - rStream >> nBulletColor; - rStream >> nUSHORT; - nBulletRelSize = nUSHORT; - rStream >> nUSHORT; - SetShowSymbol((BOOL)nUSHORT); - - if( nVersion < NUMITEM_VERSION_03 ) - cBullet = ByteString::ConvertToUnicode( (sal_Char)cBullet, - (pBulletFont&&pBulletFont->GetCharSet()) ? pBulletFont->GetCharSet() - : RTL_TEXTENCODING_SYMBOL ); - if(pBulletFont) - { - BOOL bConvertBulletFont = rStream.GetVersion() <= SOFFICE_FILEFORMAT_50; - if(bConvertBulletFont) - { - - FontToSubsFontConverter pConverter = - CreateFontToSubsFontConverter(pBulletFont->GetName(), - FONTTOSUBSFONT_IMPORT|FONTTOSUBSFONT_ONLYOLDSOSYMBOLFONTS); - if(pConverter) - { - cBullet = ConvertFontToSubsFontChar(pConverter, cBullet); - String sFontName = GetFontToSubsFontName(pConverter); - pBulletFont->SetName(sFontName); - DestroyFontToSubsFontConverter(pConverter); - } - } - } - - if( NUMITEM_VERSION_04 <= nVersion ) - { - rStream >> nUSHORT; - mePositionAndSpaceMode = (SvxNumPositionAndSpaceMode) nUSHORT; - rStream >> nUSHORT; - meLabelFollowedBy = ( SvxNumLabelFollowedBy ) nUSHORT; - long nLong; - rStream >> nLong; - mnListtabPos = nLong; - rStream >> nLong; - mnFirstLineIndent = nLong; - rStream >> nLong; - mnIndentAt = nLong; - } -} -/* -----------------08.12.98 11:14------------------- - * - * --------------------------------------------------*/ -SvStream& SvxNumberFormat::Store(SvStream &rStream, FontToSubsFontConverter pConverter) -{ - if(pConverter && pBulletFont) - { - cBullet = ConvertFontToSubsFontChar(pConverter, cBullet); - String sFontName = GetFontToSubsFontName(pConverter); - pBulletFont->SetName(sFontName); - } - - rStream << (USHORT)NUMITEM_VERSION_04; - - rStream << (USHORT)GetNumberingType(); - rStream << (USHORT)eNumAdjust; - rStream << (USHORT)nInclUpperLevels; - rStream << nStart; - rStream << (USHORT)cBullet; - - rStream << nFirstLineOffset; - rStream << nAbsLSpace; - rStream << nLSpace; - - rStream << nCharTextDistance; - rtl_TextEncoding eEnc = gsl_getSystemTextEncoding(); - rStream.WriteByteString(sPrefix, eEnc); - rStream.WriteByteString(sSuffix, eEnc); - rStream.WriteByteString(sCharStyleName, eEnc); - if(pGraphicBrush) - { - rStream << (USHORT)1; - - // #75113# in SD or SI force bullet itself to be stored, - // for that purpose throw away link when link and graphic - // are present, so Brush save is forced - if(pGraphicBrush->GetGraphicLink() && pGraphicBrush->GetGraphic()) - { - String aEmpty; - pGraphicBrush->SetGraphicLink(aEmpty); - } - - pGraphicBrush->Store(rStream, BRUSH_GRAPHIC_VERSION); - } - else - rStream << (USHORT)0; - - rStream << (USHORT)eVertOrient; - if(pBulletFont) - { - rStream << (USHORT)1; - rStream << *pBulletFont; - } - else - rStream << (USHORT)0; - rStream << aGraphicSize; - - Color nTempColor = nBulletColor; - if(COL_AUTO == nBulletColor.GetColor()) - nTempColor = COL_BLACK; - rStream << nTempColor; - rStream << nBulletRelSize; - rStream << (USHORT)IsShowSymbol(); - - rStream << ( USHORT ) mePositionAndSpaceMode; - rStream << ( USHORT ) meLabelFollowedBy; - rStream << ( long ) mnListtabPos; - rStream << ( long ) mnFirstLineIndent; - rStream << ( long ) mnIndentAt; - - return rStream; -} - -/* -----------------------------23.02.01 11:10-------------------------------- - - ---------------------------------------------------------------------------*/ -SvxNumberFormat& SvxNumberFormat::operator=( const SvxNumberFormat& rFormat ) -{ - SetNumberingType(rFormat.GetNumberingType()); - eNumAdjust = rFormat.eNumAdjust ; - nInclUpperLevels = rFormat.nInclUpperLevels ; - nStart = rFormat.nStart ; - cBullet = rFormat.cBullet ; - // --> OD 2008-01-09 #newlistlevelattrs# - mePositionAndSpaceMode = rFormat.mePositionAndSpaceMode; - // <-- - nFirstLineOffset = rFormat.nFirstLineOffset; - nAbsLSpace = rFormat.nAbsLSpace ; - nLSpace = rFormat.nLSpace ; - nCharTextDistance = rFormat.nCharTextDistance ; - // --> OD 2008-01-09 #newlistlevelattrs# - meLabelFollowedBy = rFormat.meLabelFollowedBy; - mnListtabPos = rFormat.mnListtabPos; - mnFirstLineIndent = rFormat.mnFirstLineIndent; - mnIndentAt = rFormat.mnIndentAt; - // <-- - eVertOrient = rFormat.eVertOrient ; - sPrefix = rFormat.sPrefix ; - sSuffix = rFormat.sSuffix ; - aGraphicSize = rFormat.aGraphicSize ; - nBulletColor = rFormat.nBulletColor ; - nBulletRelSize = rFormat.nBulletRelSize; - SetShowSymbol(rFormat.IsShowSymbol()); - sCharStyleName = rFormat.sCharStyleName; - DELETEZ(pGraphicBrush); - if(rFormat.pGraphicBrush) - { - pGraphicBrush = new SvxBrushItem(*rFormat.pGraphicBrush); - pGraphicBrush->SetDoneLink( STATIC_LINK( this, SvxNumberFormat, GraphicArrived) ); - } - DELETEZ(pBulletFont); - if(rFormat.pBulletFont) - pBulletFont = new Font(*rFormat.pBulletFont); - return *this; -} -/* -----------------27.10.98 10:56------------------- - * - * --------------------------------------------------*/ -BOOL SvxNumberFormat::operator==( const SvxNumberFormat& rFormat) const -{ - if( GetNumberingType() != rFormat.GetNumberingType() || - eNumAdjust != rFormat.eNumAdjust || - nInclUpperLevels != rFormat.nInclUpperLevels || - nStart != rFormat.nStart || - cBullet != rFormat.cBullet || - // --> OD 2008-01-09 #newlistlevelattrs# - mePositionAndSpaceMode != rFormat.mePositionAndSpaceMode || - // <-- - nFirstLineOffset != rFormat.nFirstLineOffset || - nAbsLSpace != rFormat.nAbsLSpace || - nLSpace != rFormat.nLSpace || - nCharTextDistance != rFormat.nCharTextDistance || - // --> OD 2008-01-09 #newlistlevelattrs# - meLabelFollowedBy != rFormat.meLabelFollowedBy || - mnListtabPos != rFormat.mnListtabPos || - mnFirstLineIndent != rFormat.mnFirstLineIndent || - mnIndentAt != rFormat.mnIndentAt || - // <-- - eVertOrient != rFormat.eVertOrient || - sPrefix != rFormat.sPrefix || - sSuffix != rFormat.sSuffix || - aGraphicSize != rFormat.aGraphicSize || - nBulletColor != rFormat.nBulletColor || - nBulletRelSize != rFormat.nBulletRelSize || - IsShowSymbol() != rFormat.IsShowSymbol() || - sCharStyleName != rFormat.sCharStyleName - ) - return FALSE; - if ( - (pGraphicBrush && !rFormat.pGraphicBrush) || - (!pGraphicBrush && rFormat.pGraphicBrush) || - (pGraphicBrush && *pGraphicBrush != *rFormat.pGraphicBrush) - ) - { - return FALSE; - } - if ( - (pBulletFont && !rFormat.pBulletFont) || - (!pBulletFont && rFormat.pBulletFont) || - (pBulletFont && *pBulletFont != *rFormat.pBulletFont) - ) - { - return FALSE; - } - return TRUE; -} -/* -----------------28.10.98 09:53------------------- - * - * --------------------------------------------------*/ -void SvxNumberFormat::SetGraphicBrush( const SvxBrushItem* pBrushItem, - const Size* pSize, const sal_Int16* pOrient) -{ - if(!pBrushItem) - { - delete pGraphicBrush; - pGraphicBrush = 0; - } - else if ( !pGraphicBrush || (pGraphicBrush && !(*pBrushItem == *pGraphicBrush)) ) - { - delete pGraphicBrush; - pGraphicBrush = (SvxBrushItem*)pBrushItem->Clone(); - pGraphicBrush->SetDoneLink( STATIC_LINK( this, SvxNumberFormat, GraphicArrived) ); - } - - if(pOrient) - eVertOrient = *pOrient; - else - eVertOrient = text::VertOrientation::NONE; - if(pSize) - aGraphicSize = *pSize; - else - aGraphicSize.Width() = aGraphicSize.Height() = 0; -} -/* -----------------28.10.98 09:59------------------- - * - * --------------------------------------------------*/ -void SvxNumberFormat::SetGraphic( const String& rName ) -{ - const String* pName; - if( pGraphicBrush && - 0 != (pName = pGraphicBrush->GetGraphicLink()) - && *pName == rName ) - return ; - - delete pGraphicBrush; - String sTmp; - pGraphicBrush = new SvxBrushItem( rName, sTmp, GPOS_AREA, 0 ); - pGraphicBrush->SetDoneLink( STATIC_LINK( this, SvxNumberFormat, GraphicArrived) ); - if( eVertOrient == text::VertOrientation::NONE ) - eVertOrient = text::VertOrientation::TOP; - - aGraphicSize.Width() = aGraphicSize.Height() = 0; -} -/* -----------------------------22.02.01 15:55-------------------------------- - - ---------------------------------------------------------------------------*/ -void SvxNumberFormat::SetVertOrient(sal_Int16 eSet) -{ - eVertOrient = eSet; -} -/* -----------------------------22.02.01 15:55-------------------------------- - - ---------------------------------------------------------------------------*/ -sal_Int16 SvxNumberFormat::GetVertOrient() const -{ - return eVertOrient; -} -/* -----------------28.10.98 09:59------------------- - * - * --------------------------------------------------*/ -void SvxNumberFormat::SetBulletFont(const Font* pFont) -{ - delete pBulletFont; - pBulletFont = pFont ? new Font(*pFont): 0; -} - -// --> OD 2008-01-09 #newlistlevelattrs# -SvxNumberFormat::SvxNumPositionAndSpaceMode SvxNumberFormat::GetPositionAndSpaceMode() const -{ - return mePositionAndSpaceMode; -} -void SvxNumberFormat::SetPositionAndSpaceMode( SvxNumPositionAndSpaceMode ePositionAndSpaceMode ) -{ - mePositionAndSpaceMode = ePositionAndSpaceMode; -} - -short SvxNumberFormat::GetLSpace() const -{ -//#if OSL_DEBUG_LEVEL > 1 -// DBG_ASSERT( mePositionAndSpaceMode == LABEL_WIDTH_AND_POSITION, -// "<SvxNumberFormat::GetLSpace()> - misusage: position-and-space-mode does not equal LABEL_WIDTH_AND_POSITION"); -//#endif - return mePositionAndSpaceMode == LABEL_WIDTH_AND_POSITION ? nLSpace : 0; -} -short SvxNumberFormat::GetAbsLSpace() const -{ -//#if OSL_DEBUG_LEVEL > 1 -// DBG_ASSERT( mePositionAndSpaceMode == LABEL_WIDTH_AND_POSITION, -// "<SvxNumberFormat::GetAbsLSpace()> - misusage: position-and-space-mode does not equal LABEL_WIDTH_AND_POSITION"); -//#endif - return mePositionAndSpaceMode == LABEL_WIDTH_AND_POSITION - ? nAbsLSpace - : static_cast<short>( GetFirstLineIndent() + GetIndentAt() ); -} -short SvxNumberFormat::GetFirstLineOffset() const -{ -//#if OSL_DEBUG_LEVEL > 1 -// DBG_ASSERT( mePositionAndSpaceMode == LABEL_WIDTH_AND_POSITION, -// "<SvxNumberFormat::GetFirstLineOffset()> - misusage: position-and-space-mode does not equal LABEL_WIDTH_AND_POSITION"); -//#endif - return mePositionAndSpaceMode == LABEL_WIDTH_AND_POSITION - ? nFirstLineOffset - : static_cast<short>( GetFirstLineIndent() ); -} -short SvxNumberFormat::GetCharTextDistance() const -{ -//#if OSL_DEBUG_LEVEL > 1 -// DBG_ASSERT( mePositionAndSpaceMode == LABEL_WIDTH_AND_POSITION, -// "<SvxNumberFormat::GetCharTextDistance()> - misusage: position-and-space-mode does not equal LABEL_WIDTH_AND_POSITION"); -//#endif - return mePositionAndSpaceMode == LABEL_WIDTH_AND_POSITION ? nCharTextDistance : 0; -} - -void SvxNumberFormat::SetLabelFollowedBy( const SvxNumLabelFollowedBy eLabelFollowedBy ) -{ - meLabelFollowedBy = eLabelFollowedBy; -} -SvxNumberFormat::SvxNumLabelFollowedBy SvxNumberFormat::GetLabelFollowedBy() const -{ - return meLabelFollowedBy; -} -void SvxNumberFormat::SetListtabPos( const long nListtabPos ) -{ - mnListtabPos = nListtabPos; -} -long SvxNumberFormat::GetListtabPos() const -{ - return mnListtabPos; -} -void SvxNumberFormat::SetFirstLineIndent( const long nFirstLineIndent ) -{ - mnFirstLineIndent = nFirstLineIndent; -} -long SvxNumberFormat::GetFirstLineIndent() const -{ - return mnFirstLineIndent; -} -void SvxNumberFormat::SetIndentAt( const long nIndentAt ) -{ - mnIndentAt = nIndentAt; -} -long SvxNumberFormat::GetIndentAt() const -{ - return mnIndentAt; -} -// <-- - -/* -----------------28.10.98 10:03------------------- - * - * --------------------------------------------------*/ -IMPL_STATIC_LINK( SvxNumberFormat, GraphicArrived, void *, EMPTYARG ) -{ - // ggfs. die GrfSize setzen: - if( !pThis->aGraphicSize.Width() || !pThis->aGraphicSize.Height() ) - { - const Graphic* pGrf = pThis->pGraphicBrush->GetGraphic(); - if( pGrf ) - pThis->aGraphicSize = SvxNumberFormat::GetGraphicSizeMM100( pGrf ); - } - pThis->NotifyGraphicArrived(); - return 0; -} -/* -----------------------------02.07.01 15:36-------------------------------- - - ---------------------------------------------------------------------------*/ -void SvxNumberFormat::NotifyGraphicArrived() -{ -} - -/* -----------------28.10.98 10:38------------------- - * - * --------------------------------------------------*/ -Size SvxNumberFormat::GetGraphicSizeMM100(const Graphic* pGraphic) -{ - const MapMode aMapMM100( MAP_100TH_MM ); - const Size& rSize = pGraphic->GetPrefSize(); - Size aRetSize; - if ( pGraphic->GetPrefMapMode().GetMapUnit() == MAP_PIXEL ) - { - OutputDevice* pOutDev = Application::GetDefaultDevice(); - MapMode aOldMap( pOutDev->GetMapMode() ); - pOutDev->SetMapMode( aMapMM100 ); - aRetSize = pOutDev->PixelToLogic( rSize ); - pOutDev->SetMapMode( aOldMap ); - } - else - aRetSize = OutputDevice::LogicToLogic( rSize, pGraphic->GetPrefMapMode(), aMapMM100 ); - return aRetSize; -} -/* -----------------28.10.98 15:57------------------- - * - * --------------------------------------------------*/ -String SvxNumberFormat::CreateRomanString( ULONG nNo, BOOL bUpper ) -{ - nNo %= 4000; // mehr kann nicht dargestellt werden -// i, ii, iii, iv, v, vi, vii, vii, viii, ix -// (Dummy),1000,500,100,50,10,5,1 - const char *cRomanArr = bUpper - ? "MDCLXVI--" // +2 Dummy-Eintraege !! - : "mdclxvi--"; // +2 Dummy-Eintraege !! - - String sRet; - USHORT nMask = 1000; - while( nMask ) - { - BYTE nZahl = BYTE(nNo / nMask); - BYTE nDiff = 1; - nNo %= nMask; - - if( 5 < nZahl ) - { - if( nZahl < 9 ) - sRet += sal_Unicode(*(cRomanArr-1)); - ++nDiff; - nZahl -= 5; - } - switch( nZahl ) - { - case 3: { sRet += sal_Unicode(*cRomanArr); } - case 2: { sRet += sal_Unicode(*cRomanArr); } - case 1: { sRet += sal_Unicode(*cRomanArr); } - break; - - case 4: { - sRet += sal_Unicode(*cRomanArr); - sRet += sal_Unicode(*(cRomanArr-nDiff)); - } - break; - case 5: { sRet += sal_Unicode(*(cRomanArr-nDiff)); } - break; - } - - nMask /= 10; // zur naechsten Dekade - cRomanArr += 2; - } - return sRet; -} -#ifdef OLD_NUMBER_FORMATTING -void SvxNumberFormat::GetCharStr( ULONG nNo, String& rStr ) const -{ - DBG_ASSERT( nNo, "0 ist eine ungueltige Nummer !!" ); - - const ULONG coDiff = 'Z' - 'A' +1; - char cAdd = (SVX_NUM_CHARS_UPPER_LETTER == eNumType ? 'A' : 'a') - 1; - ULONG nCalc; - - do { - nCalc = nNo % coDiff; - if( !nCalc ) - nCalc = coDiff; - rStr.Insert( sal_Unicode(cAdd + nCalc ), 0 ); - nNo -= nCalc; - if( nNo ) - nNo /= coDiff; - } while( nNo ); -} - -void SvxNumberFormat::GetCharStrN( ULONG nNo, String& rStr ) const -{ - DBG_ASSERT( nNo, "0 ist eine ungueltige Nummer !!" ); - - const ULONG coDiff = 'Z' - 'A' +1; - char cChar = (char)(--nNo % coDiff); - if( SVX_NUM_CHARS_UPPER_LETTER_N == eNumType ) - cChar += 'A'; - else - cChar += 'a'; - - rStr.Fill( (USHORT)(nNo / coDiff) + 1, sal_Unicode(cChar) ); -} -#endif //OLD_NUMBER_FORMATTING -/* -----------------------------22.02.01 13:31-------------------------------- - - ---------------------------------------------------------------------------*/ -const String& SvxNumberFormat::GetCharFmtName()const -{ - return sCharStyleName; -} -/* -----------------27.10.98 10:38------------------- - * - * --------------------------------------------------*/ -sal_Int32 SvxNumRule::nRefCount = 0; -static SvxNumberFormat* pStdNumFmt = 0; -static SvxNumberFormat* pStdOutlineNumFmt = 0; -// --> OD 2008-02-11 #newlistlevelattrs# -SvxNumRule::SvxNumRule( ULONG nFeatures, - USHORT nLevels, - BOOL bCont, - SvxNumRuleType eType, - SvxNumberFormat::SvxNumPositionAndSpaceMode - eDefaultNumberFormatPositionAndSpaceMode ) - : nLevelCount(nLevels), - nFeatureFlags(nFeatures), - eNumberingType(eType), - bContinuousNumbering(bCont) -{ - ++nRefCount; - LanguageType eLang = Application::GetSettings().GetLanguage(); - aLocale = SvxCreateLocale(eLang); - for(USHORT i = 0; i < SVX_MAX_NUM; i++) - { - if(i < nLevels) - { - aFmts[i] = new SvxNumberFormat(SVX_NUM_CHARS_UPPER_LETTER); - //daran wird zwischen writer und draw unterschieden - if(nFeatures & NUM_CONTINUOUS) - { - // --> OD 2008-02-11 #newlistlevelattrs# - if ( eDefaultNumberFormatPositionAndSpaceMode == - SvxNumberFormat::LABEL_WIDTH_AND_POSITION ) - { - aFmts[i]->SetLSpace( MM100_TO_TWIP(DEF_WRITER_LSPACE) ); - aFmts[i]->SetAbsLSpace( MM100_TO_TWIP(DEF_WRITER_LSPACE * (i+1)) ); - aFmts[i]->SetFirstLineOffset(MM100_TO_TWIP(-DEF_WRITER_LSPACE)); - } - else if ( eDefaultNumberFormatPositionAndSpaceMode == - SvxNumberFormat::LABEL_ALIGNMENT ) - { - // first line indent of general numbering in inch: -0,25 inch - const long cFirstLineIndent = -1440/4; - // indent values of general numbering in inch: - // 0,5 0,75 1,0 1,25 1,5 - // 1,75 2,0 2,25 2,5 2,75 - const long cIndentAt = 1440/4; - aFmts[i]->SetPositionAndSpaceMode( SvxNumberFormat::LABEL_ALIGNMENT ); - aFmts[i]->SetLabelFollowedBy( SvxNumberFormat::LISTTAB ); - aFmts[i]->SetListtabPos( cIndentAt * (i+2) ); - aFmts[i]->SetFirstLineIndent( cFirstLineIndent ); - aFmts[i]->SetIndentAt( cIndentAt * (i+2) ); - } - // <-- - } - else - { - aFmts[i]->SetLSpace( DEF_DRAW_LSPACE ); - aFmts[i]->SetAbsLSpace( DEF_DRAW_LSPACE * (i) ); - } - } - else - aFmts[i] = 0; - aFmtsSet[i] = FALSE; - } -} -/* -----------------27.10.98 10:41------------------- - * - * --------------------------------------------------*/ -SvxNumRule::SvxNumRule(const SvxNumRule& rCopy) -{ - ++nRefCount; - aLocale = rCopy.aLocale; - nLevelCount = rCopy.nLevelCount ; - nFeatureFlags = rCopy.nFeatureFlags ; - bContinuousNumbering = rCopy.bContinuousNumbering; - eNumberingType = rCopy.eNumberingType; - memset( aFmts, 0, sizeof( aFmts )); - for(USHORT i = 0; i < SVX_MAX_NUM; i++) - { - if(rCopy.aFmts[i]) - aFmts[i] = new SvxNumberFormat(*rCopy.aFmts[i]); - else - aFmts[i] = 0; - aFmtsSet[i] = rCopy.aFmtsSet[i]; - } -} -/* -----------------08.12.98 11:07------------------- - * - * --------------------------------------------------*/ -SvxNumRule::SvxNumRule(SvStream &rStream) -{ - ++nRefCount; - LanguageType eLang = Application::GetSettings().GetLanguage(); - aLocale = SvxCreateLocale(eLang); - USHORT nVersion; - USHORT nTemp; - rStream >> nVersion; - rStream >> nLevelCount; - rStream >> nTemp; - nFeatureFlags = nTemp; - rStream >> nTemp; - bContinuousNumbering = (BOOL)nTemp; - rStream >> nTemp; - eNumberingType = (SvxNumRuleType)nTemp; - memset( aFmts, 0, sizeof( aFmts )); - - for(USHORT i = 0; i < SVX_MAX_NUM; i++) - { - USHORT nSet; - rStream >> nSet; - if(nSet) - aFmts[i] = new SvxNumberFormat(rStream); - else - aFmts[i] = 0; - aFmtsSet[i] = aFmts[i] ? TRUE : FALSE; - } - if(NUMITEM_VERSION_02 <= nVersion) - { - USHORT nShort; - rStream >> nShort; - nFeatureFlags = nShort; - } -} - -/* -----------------08.12.98 11:07------------------- - * - * --------------------------------------------------*/ -SvStream& SvxNumRule::Store(SvStream &rStream) -{ - rStream<<(USHORT)NUMITEM_VERSION_03; - rStream<<nLevelCount; - //first save of nFeatureFlags for old versions - rStream<<(USHORT)nFeatureFlags; - rStream<<(USHORT)bContinuousNumbering; - rStream<<(USHORT)eNumberingType; - - FontToSubsFontConverter pConverter = 0; - BOOL bConvertBulletFont = rStream.GetVersion() <= SOFFICE_FILEFORMAT_50; - for(USHORT i = 0; i < SVX_MAX_NUM; i++) - { - if(aFmts[i]) - { - rStream << USHORT(1); - if(bConvertBulletFont && aFmts[i]->GetBulletFont()) - { - if(!pConverter) - pConverter = - CreateFontToSubsFontConverter(aFmts[i]->GetBulletFont()->GetName(), - FONTTOSUBSFONT_EXPORT|FONTTOSUBSFONT_ONLYOLDSOSYMBOLFONTS); - } - aFmts[i]->Store(rStream, pConverter); - } - else - rStream << USHORT(0); - } - //second save of nFeatureFlags for new versions - rStream<<(USHORT)nFeatureFlags; - if(pConverter) - DestroyFontToSubsFontConverter(pConverter); - - return rStream; -} - -/* -----------------27.10.98 10:41------------------- - * - * --------------------------------------------------*/ -SvxNumRule::~SvxNumRule() -{ - for(USHORT i = 0; i < SVX_MAX_NUM; i++) - delete aFmts[i]; - if(!--nRefCount) - { - DELETEZ(pStdNumFmt); - DELETEZ(pStdOutlineNumFmt); - } -} -/* -----------------29.10.98 16:07------------------- - * - * --------------------------------------------------*/ -SvxNumRule& SvxNumRule::operator=( const SvxNumRule& rCopy ) -{ - nLevelCount = rCopy.nLevelCount; - nFeatureFlags = rCopy.nFeatureFlags; - bContinuousNumbering = rCopy.bContinuousNumbering; - eNumberingType = rCopy.eNumberingType; - for(USHORT i = 0; i < SVX_MAX_NUM; i++) - { - delete aFmts[i]; - if(rCopy.aFmts[i]) - aFmts[i] = new SvxNumberFormat(*rCopy.aFmts[i]); - else - aFmts[i] = 0; - aFmtsSet[i] = rCopy.aFmtsSet[i]; - } - return *this; -} -/* -----------------27.10.98 10:41------------------- - * - * --------------------------------------------------*/ -int SvxNumRule::operator==( const SvxNumRule& rCopy) const -{ - if(nLevelCount != rCopy.nLevelCount || - nFeatureFlags != rCopy.nFeatureFlags || - bContinuousNumbering != rCopy.bContinuousNumbering || - eNumberingType != rCopy.eNumberingType) - return FALSE; - for(USHORT i = 0; i < nLevelCount; i++) - { - if ( - (aFmtsSet[i] != rCopy.aFmtsSet[i]) || - (!aFmts[i] && rCopy.aFmts[i]) || - (aFmts[i] && !rCopy.aFmts[i]) || - (aFmts[i] && *aFmts[i] != *rCopy.aFmts[i]) - ) - { - return FALSE; - } - } - return TRUE; -} -/* -----------------27.10.98 10:41------------------- - * - * --------------------------------------------------*/ -const SvxNumberFormat* SvxNumRule::Get(USHORT nLevel)const -{ - DBG_ASSERT(nLevel < SVX_MAX_NUM, "falsches Level" ); - if( nLevel < SVX_MAX_NUM ) - return aFmtsSet[nLevel] ? aFmts[nLevel] : 0; - else - return 0; -} -/* -----------------02.11.98 09:10------------------- - * - * --------------------------------------------------*/ -const SvxNumberFormat& SvxNumRule::GetLevel(USHORT nLevel)const -{ - if(!pStdNumFmt) - { - pStdNumFmt = new SvxNumberFormat(SVX_NUM_ARABIC); - pStdOutlineNumFmt = new SvxNumberFormat(SVX_NUM_NUMBER_NONE); - } - - DBG_ASSERT(nLevel < SVX_MAX_NUM, "falsches Level" ); - - return ( ( nLevel < SVX_MAX_NUM ) && aFmts[nLevel] ) ? - *aFmts[nLevel] : eNumberingType == SVX_RULETYPE_NUMBERING ? - *pStdNumFmt : *pStdOutlineNumFmt; -} - -/* -----------------29.10.98 09:08------------------- - * - * --------------------------------------------------*/ -void SvxNumRule::SetLevel( USHORT i, const SvxNumberFormat& rNumFmt, BOOL bIsValid ) -{ - DBG_ASSERT(i < SVX_MAX_NUM, "falsches Level" ); - - if( (i < SVX_MAX_NUM) && (!aFmtsSet[i] || !(rNumFmt == *Get( i ))) ) - { - delete aFmts[ i ]; - aFmts[ i ] = new SvxNumberFormat( rNumFmt ); - aFmtsSet[i] = bIsValid; -// bInvalidRuleFlag = TRUE; - } -} -/* -----------------30.10.98 12:44------------------- - * - * --------------------------------------------------*/ -void SvxNumRule::SetLevel(USHORT nLevel, const SvxNumberFormat* pFmt) -{ - DBG_ASSERT(nLevel < SVX_MAX_NUM, "falsches Level" ); - - if( nLevel < SVX_MAX_NUM ) - { - aFmtsSet[nLevel] = 0 != pFmt; - if(pFmt) - SetLevel(nLevel, *pFmt); - else - { - delete aFmts[nLevel]; - aFmts[nLevel] = 0; - } - } -} -/* -----------------28.10.98 15:38------------------- - * - * --------------------------------------------------*/ -String SvxNumRule::MakeNumString( const SvxNodeNum& rNum, BOOL bInclStrings ) const -{ - String aStr; - if( SVX_NO_NUM > rNum.GetLevel() && !( SVX_NO_NUMLEVEL & rNum.GetLevel() ) ) - { - const SvxNumberFormat& rMyNFmt = GetLevel( rNum.GetLevel() ); - if( SVX_NUM_NUMBER_NONE != rMyNFmt.GetNumberingType() ) - { - BYTE i = rNum.GetLevel(); - - if( !IsContinuousNumbering() && - 1 < rMyNFmt.GetIncludeUpperLevels() ) // nur der eigene Level ? - { - BYTE n = rMyNFmt.GetIncludeUpperLevels(); - if( 1 < n ) - { - if( i+1 >= n ) - i -= n - 1; - else - i = 0; - } - } - - for( ; i <= rNum.GetLevel(); ++i ) - { - const SvxNumberFormat& rNFmt = GetLevel( i ); - if( SVX_NUM_NUMBER_NONE == rNFmt.GetNumberingType() ) - { - // Soll aus 1.1.1 --> 2. NoNum --> 1..1 oder 1.1 ?? - // if( i != rNum.nMyLevel ) - // aStr += aDotStr; - continue; - } - - sal_Bool bDot = sal_True; - if( rNum.GetLevelVal()[ i ] ) - { - if(SVX_NUM_BITMAP != rNFmt.GetNumberingType()) - aStr += rNFmt.GetNumStr( rNum.GetLevelVal()[ i ], aLocale ); - else - bDot = sal_False; - } - else - aStr += sal_Unicode('0'); // alle 0-Level sind eine 0 - if( i != rNum.GetLevel() && bDot) - aStr += sal_Unicode('.'); - } - } - - if( bInclStrings ) - { - aStr.Insert( rMyNFmt.GetPrefix(), 0 ); - aStr += rMyNFmt.GetSuffix(); - } - } - return aStr; -} -/* -----------------18.08.99 10:18------------------- - Description: changes linked to embedded bitmaps - --------------------------------------------------*/ -BOOL SvxNumRule::UnLinkGraphics() -{ - BOOL bRet = FALSE; - for(USHORT i = 0; i < GetLevelCount(); i++) - { - SvxNumberFormat aFmt(GetLevel(i)); - const SvxBrushItem* pBrush = aFmt.GetBrush(); - const String* pLinkStr; - const Graphic* pGraphic; - if(SVX_NUM_BITMAP == aFmt.GetNumberingType()) - { - if(pBrush && - 0 != (pLinkStr = pBrush->GetGraphicLink()) && - pLinkStr->Len() && - 0 !=(pGraphic = pBrush->GetGraphic())) - { - SvxBrushItem aTempItem(*pBrush); - aTempItem.SetGraphicLink( String()); - aTempItem.SetGraphic(*pGraphic); - sal_Int16 eOrient = aFmt.GetVertOrient(); - aFmt.SetGraphicBrush( &aTempItem, &aFmt.GetGraphicSize(), &eOrient ); - bRet = TRUE; - } - } - else if((SVX_NUM_BITMAP|LINK_TOKEN) == aFmt.GetNumberingType()) - aFmt.SetNumberingType(SVX_NUM_BITMAP); - SetLevel(i, aFmt); - } - return bRet; -} - -/* -----------------27.10.98 10:41------------------- - * - * --------------------------------------------------*/ -SvxNumBulletItem::SvxNumBulletItem(SvxNumRule& rRule) : - SfxPoolItem(SID_ATTR_NUMBERING_RULE), - pNumRule(new SvxNumRule(rRule)) -{ -} - -/*-----------------23.11.98 10:36------------------- - MT: Das sind ja sehr sinnige Kommentare... ---------------------------------------------------*/ -SvxNumBulletItem::SvxNumBulletItem(SvxNumRule& rRule, USHORT _nWhich ) : - SfxPoolItem(_nWhich), - pNumRule(new SvxNumRule(rRule)) -{ -} - -SfxPoolItem* SvxNumBulletItem::Create(SvStream &s, USHORT n) const -{ - return SfxPoolItem::Create(s, n ); -} - -/* -----------------27.10.98 10:41------------------- - * - * --------------------------------------------------*/ -SvxNumBulletItem::SvxNumBulletItem(const SvxNumBulletItem& rCopy) : - SfxPoolItem(rCopy.Which()) -{ - pNumRule = new SvxNumRule(*rCopy.pNumRule); -} -/* -----------------27.10.98 10:41------------------- - * - * --------------------------------------------------*/ -SvxNumBulletItem::~SvxNumBulletItem() -{ - delete pNumRule; -} - -/* -----------------27.10.98 10:41------------------- - * - * --------------------------------------------------*/ -int SvxNumBulletItem::operator==( const SfxPoolItem& rCopy) const -{ - return *pNumRule == *((SvxNumBulletItem&)rCopy).pNumRule; -} -/* -----------------27.10.98 10:41------------------- - * - * --------------------------------------------------*/ -SfxPoolItem* SvxNumBulletItem::Clone( SfxItemPool * ) const -{ - return new SvxNumBulletItem(*this); -} -/* -----------------08.12.98 10:43------------------- - * - * --------------------------------------------------*/ -USHORT SvxNumBulletItem::GetVersion( USHORT /*nFileVersion*/ ) const -{ - return NUMITEM_VERSION_03; -} -/* -----------------08.12.98 10:43------------------- - * - * --------------------------------------------------*/ -SvStream& SvxNumBulletItem::Store(SvStream &rStream, USHORT /*nItemVersion*/ )const -{ - pNumRule->Store(rStream); - return rStream; -} - -/* -----------------08.12.98 10:43------------------- - * - * --------------------------------------------------*/ - -sal_Bool SvxNumBulletItem::QueryValue( com::sun::star::uno::Any& rVal, BYTE /*nMemberId*/ ) const -{ - rVal <<= SvxCreateNumRule( pNumRule ); - return sal_True; -} - -sal_Bool SvxNumBulletItem::PutValue( const com::sun::star::uno::Any& rVal, BYTE /*nMemberId*/ ) -{ - uno::Reference< container::XIndexReplace > xRule; - if( rVal >>= xRule ) - { - try - { - SvxNumRule* pNewRule = new SvxNumRule( SvxGetNumRule( xRule ) ); - if( pNewRule->GetLevelCount() != pNumRule->GetLevelCount() || - pNewRule->GetNumRuleType() != pNumRule->GetNumRuleType() ) - { - SvxNumRule* pConverted = SvxConvertNumRule( pNewRule, pNumRule->GetLevelCount(), pNumRule->GetNumRuleType() ); - delete pNewRule; - pNewRule = pConverted; - } - delete pNumRule; - pNumRule = pNewRule; - return sal_True; - } - catch(lang::IllegalArgumentException&) - { - } - } - return sal_False; -} - -/* -----------------08.12.98 10:43------------------- - * - * --------------------------------------------------*/ -SvxNumRule* SvxConvertNumRule( const SvxNumRule* pRule, USHORT nLevels, SvxNumRuleType eType ) -{ - const USHORT nSrcLevels = pRule->GetLevelCount(); - SvxNumRule* pNewRule = new SvxNumRule( pRule->GetFeatureFlags(), nLevels, pRule->IsContinuousNumbering(), eType ); - - for( USHORT nLevel = 0; (nLevel < nLevels) && (nLevel < nSrcLevels); nLevel++ ) - pNewRule->SetLevel( nLevel, pRule->GetLevel( nLevel ) ); - - return pNewRule; -} diff --git a/svx/source/items/ofaitem.cxx b/svx/source/items/ofaitem.cxx index fcb9909e07ea..4a3680cbe58b 100644 --- a/svx/source/items/ofaitem.cxx +++ b/svx/source/items/ofaitem.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ofaitem.cxx,v $ - * $Revision: 1.9 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svx/source/items/page.src b/svx/source/items/page.src deleted file mode 100644 index 85cfd79e8cda..000000000000 --- a/svx/source/items/page.src +++ /dev/null @@ -1,258 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: page.src,v $ - * $Revision: 1.71 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - // include --------------------------------------------------------------- - -#include <svx/dialogs.hrc> - -String RID_SVXSTR_PAPER_A0 -{ - Text = "A0" ; -}; -String RID_SVXSTR_PAPER_A1 -{ - Text = "A1" ; -}; -String RID_SVXSTR_PAPER_A2 -{ - Text = "A2" ; -}; -String RID_SVXSTR_PAPER_A3 -{ - Text = "A3" ; -}; -String RID_SVXSTR_PAPER_A4 -{ - Text = "A4" ; -}; -String RID_SVXSTR_PAPER_A5 -{ - Text = "A5" ; -}; -String RID_SVXSTR_PAPER_B4_ISO -{ - Text = "B4 (ISO)" ; -}; -String RID_SVXSTR_PAPER_B5_ISO -{ - Text = "B5 (ISO)" ; -}; -String RID_SVXSTR_PAPER_LETTER -{ - Text = "Letter" ; -}; -String RID_SVXSTR_PAPER_LEGAL -{ - Text = "Legal" ; -}; -String RID_SVXSTR_PAPER_TABLOID -{ - Text = "Tabloid" ; -}; -String RID_SVXSTR_PAPER_USER -{ - Text [ en-US ] = "User Defined" ; -}; -String RID_SVXSTR_PAPER_B6_ISO -{ - Text = "B6 (ISO)" ; -}; -String RID_SVXSTR_PAPER_C4 -{ - Text = "C4 Envelope" ; -}; -String RID_SVXSTR_PAPER_C5 -{ - Text = "C5 Envelope" ; -}; -String RID_SVXSTR_PAPER_C6 -{ - Text = "C6 Envelope" ; -}; -String RID_SVXSTR_PAPER_C65 -{ - Text = "C6/5 Envelope" ; -}; -String RID_SVXSTR_PAPER_DL -{ - Text = "DL Envelope" ; -}; -String RID_SVXSTR_PAPER_DIA -{ - Text = "Dia Slide" ; -}; -String RID_SVXSTR_PAPER_SCREEN -{ - Text [ en-US ] = "Screen" ; -}; -String RID_SVXSTR_PAPER_C -{ - Text = "C" ; -}; -String RID_SVXSTR_PAPER_D -{ - Text = "D" ; -}; -String RID_SVXSTR_PAPER_E -{ - Text = "E" ; -}; -String RID_SVXSTR_PAPER_EXECUTIVE -{ - Text = "Executive" ; -}; -String RID_SVXSTR_PAPER_LEGAL2 -{ - Text = "Long Bond" ; -}; -String RID_SVXSTR_PAPER_MONARCH -{ - Text = "#8 (Monarch) Envelope" ; -}; -String RID_SVXSTR_PAPER_COM675 -{ - Text = "#6 3/4 (Personal) Envelope" ; -}; -String RID_SVXSTR_PAPER_COM9 -{ - Text = "#9 Envelope" ; -}; -String RID_SVXSTR_PAPER_COM10 -{ - Text = "#10 Envelope" ; -}; -String RID_SVXSTR_PAPER_COM11 -{ - Text = "#11 Envelope" ; -}; -String RID_SVXSTR_PAPER_COM12 -{ - Text = "#12 Envelope" ; -}; -String RID_SVXSTR_PAPER_KAI16 -{ - Text = "16 Kai" ; -}; -String RID_SVXSTR_PAPER_KAI32 -{ - Text = "32 Kai" ; -}; -String RID_SVXSTR_PAPER_KAI32BIG -{ - Text = "Big 32 Kai" ; -}; -String RID_SVXSTR_PAPER_B4_JIS -{ - Text = "B4 (JIS)" ; -}; -String RID_SVXSTR_PAPER_B5_JIS -{ - Text = "B5 (JIS)" ; -}; -String RID_SVXSTR_PAPER_B6_JIS -{ - Text = "B6 (JIS)" ; -}; -String RID_SVXSTR_PAPERBIN -{ - Text [ en-US ] = "Paper tray" ; -}; -String RID_SVXSTR_PAPERBIN_SETTINGS -{ - Text [ en-US ] = "[From printer settings]" ; -}; - // ********************************************************************** EOF - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/svx/source/items/pageitem.cxx b/svx/source/items/pageitem.cxx index 54eaf9b5898e..49aa566f867d 100644 --- a/svx/source/items/pageitem.cxx +++ b/svx/source/items/pageitem.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: pageitem.cxx,v $ - * $Revision: 1.11 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -36,11 +33,13 @@ #include <svx/pageitem.hxx> -#include <svx/itemtype.hxx> +#include <editeng/itemtype.hxx> #include <svx/unomid.hxx> #include <com/sun/star/style/PageStyleLayout.hpp> #include <com/sun/star/style/BreakType.hpp> #include <svl/itemset.hxx> +#include <svx/svxitems.hrc> +#include <svx/dialmgr.hxx> using namespace ::rtl; using namespace ::com::sun::star; diff --git a/svx/source/items/paperinf.cxx b/svx/source/items/paperinf.cxx deleted file mode 100644 index 161d7af1aba9..000000000000 --- a/svx/source/items/paperinf.cxx +++ /dev/null @@ -1,191 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: paperinf.cxx,v $ - * $Revision: 1.12 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svx.hxx" - -// include --------------------------------------------------------------- - -#include <limits.h> -#include <tools/shl.hxx> -#include <tools/debug.hxx> -#include <vcl/svapp.hxx> - -#ifndef _SVX_DIALOGS_HRC -#include <svx/dialogs.hrc> -#endif -#include <svx/paperinf.hxx> -#include <svx/dialmgr.hxx> - -/*-------------------------------------------------------------------- - Beschreibung: Ist der Printer gueltig - --------------------------------------------------------------------*/ - -inline BOOL IsValidPrinter( const Printer* pPtr ) -{ - return pPtr->GetName().Len() ? TRUE : FALSE; -} - -//------------------------------------------------------------------------ - -Size SvxPaperInfo::GetPaperSize( Paper ePaper, MapUnit eUnit ) -{ - PaperInfo aInfo(ePaper); - Size aRet(aInfo.getWidth(), aInfo.getHeight()); // in 100thMM - return eUnit == MAP_100TH_MM ? aRet : OutputDevice::LogicToLogic(aRet, MAP_100TH_MM, eUnit); -} - -/*------------------------------------------------------------------------ - Beschreibung: Papiergroesse der Druckers liefern, aligned auf - die eigenen Groessen. - Falls kein Printer im System eingestellt ist, - wird DIN A4 Portrait als Defaultpapiergroesse geliefert. -------------------------------------------------------------------------*/ - -//Is this method may be confused about the units it returns ? -//Always returns TWIPS for known paper sizes or on failure. -//But in the case of PAPER_USER paper and with a Printer with a mapmode set -//will return in those printer units ? -Size SvxPaperInfo::GetPaperSize( const Printer* pPrinter ) -{ - if ( !IsValidPrinter(pPrinter) ) - return GetPaperSize( PAPER_A4 ); - const Paper ePaper = pPrinter->GetPaper(); - - if ( ePaper == PAPER_USER ) - { - // Orientation nicht beruecksichtigen, da durch SV bereits - // die richtigen Masze eingestellt worden sind. - Size aPaperSize = pPrinter->GetPaperSize(); - const Size aInvalidSize; - - if ( aPaperSize == aInvalidSize ) - return GetPaperSize(PAPER_A4); - MapMode aMap1 = pPrinter->GetMapMode(); - MapMode aMap2; - - if ( aMap1 == aMap2 ) - aPaperSize = - pPrinter->PixelToLogic( aPaperSize, MapMode( MAP_TWIP ) ); - return aPaperSize; - } - - const Orientation eOrient = pPrinter->GetOrientation(); - Size aSize( GetPaperSize( ePaper ) ); - // bei Landscape die Seiten tauschen, ist bei SV schon geschehen - if ( eOrient == ORIENTATION_LANDSCAPE ) - Swap( aSize ); - return aSize; -} - -// ----------------------------------------------------------------------- - -Paper SvxPaperInfo::GetSvxPaper( const Size &rSize, MapUnit eUnit, bool bSloppy ) -{ - Size aSize(eUnit == MAP_100TH_MM ? rSize : OutputDevice::LogicToLogic(rSize, eUnit, MAP_100TH_MM)); - PaperInfo aInfo(aSize.Width(), aSize.Height()); - if (bSloppy) - aInfo.doSloppyFit(); - return aInfo.getPaper(); -} - -// ----------------------------------------------------------------------- - -long SvxPaperInfo::GetSloppyPaperDimension( long nSize, MapUnit eUnit ) -{ - nSize = eUnit == MAP_100TH_MM ? nSize : OutputDevice::LogicToLogic(nSize, eUnit, MAP_100TH_MM); - nSize = PaperInfo::sloppyFitPageDimension(nSize); - return eUnit == MAP_100TH_MM ? nSize : OutputDevice::LogicToLogic(nSize, MAP_100TH_MM, eUnit); -} - -// ----------------------------------------------------------------------- - -Size SvxPaperInfo::GetDefaultPaperSize( MapUnit eUnit ) -{ - PaperInfo aInfo(PaperInfo::getSystemDefaultPaper()); - Size aRet(aInfo.getWidth(), aInfo.getHeight()); - return eUnit == MAP_100TH_MM ? aRet : OutputDevice::LogicToLogic(aRet, MAP_100TH_MM, eUnit); -} - -/*------------------------------------------------------------------------ - Beschreibung: String Repr"asentation f"ur die SV-Defines f"ur - Papiergroessen. -------------------------------------------------------------------------*/ - -String SvxPaperInfo::GetName( Paper ePaper ) -{ - USHORT nResId = 0; - - switch ( ePaper ) - { - case PAPER_A0: nResId = RID_SVXSTR_PAPER_A0; break; - case PAPER_A1: nResId = RID_SVXSTR_PAPER_A1; break; - case PAPER_A2: nResId = RID_SVXSTR_PAPER_A2; break; - case PAPER_A3: nResId = RID_SVXSTR_PAPER_A3; break; - case PAPER_A4: nResId = RID_SVXSTR_PAPER_A4; break; - case PAPER_A5: nResId = RID_SVXSTR_PAPER_A5; break; - case PAPER_B4_ISO: nResId = RID_SVXSTR_PAPER_B4_ISO; break; - case PAPER_B5_ISO: nResId = RID_SVXSTR_PAPER_B5_ISO; break; - case PAPER_LETTER: nResId = RID_SVXSTR_PAPER_LETTER; break; - case PAPER_LEGAL: nResId = RID_SVXSTR_PAPER_LEGAL; break; - case PAPER_TABLOID: nResId = RID_SVXSTR_PAPER_TABLOID; break; - case PAPER_USER: nResId = RID_SVXSTR_PAPER_USER; break; - case PAPER_B6_ISO: nResId = RID_SVXSTR_PAPER_B6_ISO; break; - case PAPER_ENV_C4: nResId = RID_SVXSTR_PAPER_C4; break; - case PAPER_ENV_C5: nResId = RID_SVXSTR_PAPER_C5; break; - case PAPER_ENV_C6: nResId = RID_SVXSTR_PAPER_C6; break; - case PAPER_ENV_C65: nResId = RID_SVXSTR_PAPER_C65; break; - case PAPER_ENV_DL: nResId = RID_SVXSTR_PAPER_DL; break; - case PAPER_SLIDE_DIA: nResId = RID_SVXSTR_PAPER_DIA; break; - case PAPER_SCREEN: nResId = RID_SVXSTR_PAPER_SCREEN; break; - case PAPER_C: nResId = RID_SVXSTR_PAPER_C; break; - case PAPER_D: nResId = RID_SVXSTR_PAPER_D; break; - case PAPER_E: nResId = RID_SVXSTR_PAPER_E; break; - case PAPER_EXECUTIVE: nResId = RID_SVXSTR_PAPER_EXECUTIVE;break; - case PAPER_FANFOLD_LEGAL_DE: nResId = RID_SVXSTR_PAPER_LEGAL2; break; - case PAPER_ENV_MONARCH: nResId = RID_SVXSTR_PAPER_MONARCH; break; - case PAPER_ENV_PERSONAL: nResId = RID_SVXSTR_PAPER_COM675; break; - case PAPER_ENV_9: nResId = RID_SVXSTR_PAPER_COM9; break; - case PAPER_ENV_10: nResId = RID_SVXSTR_PAPER_COM10; break; - case PAPER_ENV_11: nResId = RID_SVXSTR_PAPER_COM11; break; - case PAPER_ENV_12: nResId = RID_SVXSTR_PAPER_COM12; break; - case PAPER_KAI16: nResId = RID_SVXSTR_PAPER_KAI16; break; - case PAPER_KAI32: nResId = RID_SVXSTR_PAPER_KAI32; break; - case PAPER_KAI32BIG: nResId = RID_SVXSTR_PAPER_KAI32BIG; break; - case PAPER_B4_JIS: nResId = RID_SVXSTR_PAPER_B4_JIS; break; - case PAPER_B5_JIS: nResId = RID_SVXSTR_PAPER_B5_JIS; break; - case PAPER_B6_JIS: nResId = RID_SVXSTR_PAPER_B6_JIS; break; - default: DBG_ERRORFILE( "unknown papersize" ); - } - - return ( nResId > 0 ) ? String( SVX_RES( nResId ) ) : String(); -} - - diff --git a/svx/source/items/paraitem.cxx b/svx/source/items/paraitem.cxx deleted file mode 100644 index bcdc7f451352..000000000000 --- a/svx/source/items/paraitem.cxx +++ /dev/null @@ -1,1768 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: paraitem.cxx,v $ - * $Revision: 1.40 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svx.hxx" - -// include --------------------------------------------------------------- -#include <com/sun/star/style/TabStop.hpp> -#include <com/sun/star/style/LineSpacing.hpp> -#include <com/sun/star/style/LineSpacingMode.hpp> -#include <com/sun/star/uno/Sequence.hxx> -#ifndef _UNOTOOLS_PROCESSFACTORY_HXX -#include <comphelper/processfactory.hxx> -#endif -#include <unotools/syslocale.hxx> - -#include <comphelper/types.hxx> - -using namespace ::rtl; -using namespace ::com::sun::star; - -#include <tools/rtti.hxx> -#include <basic/sbx.hxx> -#define GLOBALOVERFLOW3 - -#define _SVX_PARAITEM_CXX -#include <svl/itempool.hxx> - -#include <svl/memberid.hrc> -#include <svx/svxitems.hrc> - -#include <svx/lspcitem.hxx> -#include <svx/adjitem.hxx> -#include <svx/orphitem.hxx> -#include <svx/widwitem.hxx> -#include <svx/tstpitem.hxx> -#include <svx/pmdlitem.hxx> -#include <svx/spltitem.hxx> -#include <svx/hyznitem.hxx> -#include <svx/scriptspaceitem.hxx> -#include <svx/hngpnctitem.hxx> -#include <svx/forbiddenruleitem.hxx> -#include <svx/paravertalignitem.hxx> -#include "pgrditem.hxx" - - -#include <rtl/ustring.hxx> - -#include <svx/unomid.hxx> - -#include <svx/itemtype.hxx> -#include <svx/dialmgr.hxx> -#include <svx/paperinf.hxx> -#include <vcl/svapp.hxx> - -#include <algorithm> - -using namespace ::rtl; -using namespace ::com::sun::star; - -// Konvertierung fuer UNO -#define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L)) -#define TWIP_TO_MM100_UNSIGNED(TWIP) ((((TWIP)*127L+36L)/72L)) -#define MM100_TO_TWIP(MM100) ((MM100) >= 0 ? (((MM100)*72L+63L)/127L) : (((MM100)*72L-63L)/127L)) -#define MM100_TO_TWIP_UNSIGNED(MM100) ((((MM100)*72L+63L)/127L)) - - -// STATIC DATA ----------------------------------------------------------- - - -// ----------------------------------------------------------------------- - - -TYPEINIT1_FACTORY(SvxLineSpacingItem, SfxPoolItem , new SvxLineSpacingItem(LINE_SPACE_DEFAULT_HEIGHT, 0)); -TYPEINIT1_FACTORY(SvxAdjustItem, SfxPoolItem, new SvxAdjustItem(SVX_ADJUST_LEFT, 0)); -TYPEINIT1_FACTORY(SvxWidowsItem, SfxByteItem, new SvxWidowsItem(0, 0)); -TYPEINIT1_FACTORY(SvxOrphansItem, SfxByteItem, new SvxOrphansItem(0, 0)); -TYPEINIT1_FACTORY(SvxHyphenZoneItem, SfxPoolItem, new SvxHyphenZoneItem(sal_False, 0)); -TYPEINIT1_FACTORY(SvxTabStopItem, SfxPoolItem, new SvxTabStopItem(0)); -TYPEINIT1_FACTORY(SvxFmtSplitItem, SfxBoolItem, new SvxFmtSplitItem(sal_False, 0)); -TYPEINIT1_FACTORY(SvxPageModelItem, SfxStringItem, new SvxPageModelItem(0)); -TYPEINIT1_FACTORY(SvxScriptSpaceItem, SfxBoolItem, new SvxScriptSpaceItem(sal_False, 0)); -TYPEINIT1_FACTORY(SvxHangingPunctuationItem, SfxBoolItem, new SvxHangingPunctuationItem(sal_False, 0)); -TYPEINIT1_FACTORY(SvxForbiddenRuleItem, SfxBoolItem, new SvxForbiddenRuleItem(sal_False, 0)); -TYPEINIT1_FACTORY(SvxParaVertAlignItem, SfxUInt16Item, new SvxParaVertAlignItem(0, 0)); -TYPEINIT1_FACTORY(SvxParaGridItem, SfxBoolItem, new SvxParaGridItem(sal_True, 0)); - -SV_IMPL_VARARR_SORT( SvxTabStopArr, SvxTabStop ) - -// ----------------------------------------------------------------------- - -SvxLineSpacingItem::SvxLineSpacingItem( sal_uInt16 nHeight, const sal_uInt16 nId ) - : SfxEnumItemInterface( nId ) -{ - nPropLineSpace = 100; - nInterLineSpace = 0; - nLineHeight = nHeight; - eLineSpace = SVX_LINE_SPACE_AUTO; - eInterLineSpace = SVX_INTER_LINE_SPACE_OFF; -} - -// ----------------------------------------------------------------------- - -int SvxLineSpacingItem::operator==( const SfxPoolItem& rAttr ) const -{ - DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" ); - - const SvxLineSpacingItem& rLineSpace = (const SvxLineSpacingItem&)rAttr; - return ( - // Gleiche Linespacing Rule? - (eLineSpace == rLineSpace.eLineSpace) - // Bei maximalem und minimalem Linespacing muss das Mass - // uebereinstimmen. - && (eLineSpace == SVX_LINE_SPACE_AUTO || - nLineHeight == rLineSpace.nLineHeight) - // Gleiche Interlinespacing Rule? - && ( eInterLineSpace == rLineSpace.eInterLineSpace ) - // Entweder proportional oder draufaddieren eingestellt. - && (( eInterLineSpace == SVX_INTER_LINE_SPACE_OFF) - || (eInterLineSpace == SVX_INTER_LINE_SPACE_PROP - && nPropLineSpace == rLineSpace.nPropLineSpace) - || (eInterLineSpace == SVX_INTER_LINE_SPACE_FIX - && (nInterLineSpace == rLineSpace.nInterLineSpace)))) ? - 1 : 0; -} - -/*-----------------18.03.98 16:32------------------- - os: wer weiss noch, wieso das LineSpacingItem so - kompliziert ist? Fuer UNO koennen wir das nicht - gebrauchen. Da gibt es nur zwei Werte: - - ein sal_uInt16 fuer den Modus - - ein sal_uInt32 fuer alle Werte (Abstand, Hoehe, rel. Angaben) - ---------------------------------------------------*/ -sal_Bool SvxLineSpacingItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const -{ - sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); - nMemberId &= ~CONVERT_TWIPS; - - style::LineSpacing aLSp; - switch( eLineSpace ) - { - case SVX_LINE_SPACE_AUTO: - if(eInterLineSpace == SVX_INTER_LINE_SPACE_FIX) - { - aLSp.Mode = style::LineSpacingMode::LEADING; - aLSp.Height = ( bConvert ? (short)TWIP_TO_MM100(nInterLineSpace) : nInterLineSpace); - } - else if(eInterLineSpace == SVX_INTER_LINE_SPACE_OFF) - { - aLSp.Mode = style::LineSpacingMode::PROP; - aLSp.Height = 100; - } - else - { - aLSp.Mode = style::LineSpacingMode::PROP; - aLSp.Height = nPropLineSpace; - } - break; - case SVX_LINE_SPACE_FIX : - case SVX_LINE_SPACE_MIN : - aLSp.Mode = eLineSpace == SVX_LINE_SPACE_FIX ? style::LineSpacingMode::FIX : style::LineSpacingMode::MINIMUM; - aLSp.Height = ( bConvert ? (short)TWIP_TO_MM100_UNSIGNED(nLineHeight) : nLineHeight ); - break; - default: - ;//prevent warning about SVX_LINE_SPACE_END - } - - switch ( nMemberId ) - { - case 0 : rVal <<= aLSp; break; - case MID_LINESPACE : rVal <<= aLSp.Mode; break; - case MID_HEIGHT : rVal <<= aLSp.Height; break; - default: DBG_ERROR("Wrong MemberId!"); break; - } - - return sal_True; -} -/*-----------------18.03.98 16:32------------------- - ---------------------------------------------------*/ -sal_Bool SvxLineSpacingItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) -{ - sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); - nMemberId &= ~CONVERT_TWIPS; - - // fill with current data - style::LineSpacing aLSp; - uno::Any aAny; - sal_Bool bRet = QueryValue( aAny, bConvert ? CONVERT_TWIPS : 0 ) && ( aAny >>= aLSp ); - - // get new data - switch ( nMemberId ) - { - case 0 : bRet = (rVal >>= aLSp); break; - case MID_LINESPACE : bRet = (rVal >>= aLSp.Mode); break; - case MID_HEIGHT : bRet = (rVal >>= aLSp.Height); break; - default: DBG_ERROR("Wrong MemberId!"); break; - } - - if( bRet ) - { - nLineHeight = aLSp.Height; - switch( aLSp.Mode ) - { - case style::LineSpacingMode::LEADING: - { - eInterLineSpace = SVX_INTER_LINE_SPACE_FIX; - eLineSpace = SVX_LINE_SPACE_AUTO; - nInterLineSpace = aLSp.Height; - if(bConvert) - nInterLineSpace = (short)MM100_TO_TWIP(nInterLineSpace); - - } - break; - case style::LineSpacingMode::PROP: - { - eLineSpace = SVX_LINE_SPACE_AUTO; - nPropLineSpace = (sal_Int8)std::min(aLSp.Height, (short)0xFF); - if(100 == aLSp.Height) - eInterLineSpace = SVX_INTER_LINE_SPACE_OFF; - else - eInterLineSpace = SVX_INTER_LINE_SPACE_PROP; - } - break; - case style::LineSpacingMode::FIX: - case style::LineSpacingMode::MINIMUM: - { - eInterLineSpace = SVX_INTER_LINE_SPACE_OFF; - eLineSpace = aLSp.Mode == style::LineSpacingMode::FIX ? SVX_LINE_SPACE_FIX : SVX_LINE_SPACE_MIN; - nLineHeight = aLSp.Height; - if(bConvert) - nLineHeight = (USHORT)MM100_TO_TWIP_UNSIGNED(nLineHeight); - } - break; - } - } - - return bRet; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxLineSpacingItem::Clone( SfxItemPool * ) const -{ - return new SvxLineSpacingItem( *this ); -} - -//------------------------------------------------------------------------ - -SfxItemPresentation SvxLineSpacingItem::GetPresentation -( - SfxItemPresentation /*ePres*/, - SfxMapUnit /*eCoreUnit*/, - SfxMapUnit /*ePresUnit*/, - XubString& rText, const IntlWrapper * -) const -{ -#ifdef DBG_UTIL - rText.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "SvxLineSpacingItem" )); -#else - rText.Erase(); -#endif - return SFX_ITEM_PRESENTATION_NONE; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxLineSpacingItem::Create(SvStream& rStrm, sal_uInt16) const -{ - sal_Int8 nPropSpace; - short nInterSpace; - sal_uInt16 nHeight; - sal_Int8 nRule, nInterRule; - - rStrm >> nPropSpace - >> nInterSpace - >> nHeight - >> nRule - >> nInterRule; - - SvxLineSpacingItem* pAttr = new SvxLineSpacingItem( nHeight, Which() ); - pAttr->SetInterLineSpace( nInterSpace ); - pAttr->SetPropLineSpace( nPropSpace ); - pAttr->GetLineSpaceRule() = (SvxLineSpace)nRule; - pAttr->GetInterLineSpaceRule() = (SvxInterLineSpace)nInterRule; - return pAttr; -} - -// ----------------------------------------------------------------------- - -SvStream& SvxLineSpacingItem::Store( SvStream& rStrm, sal_uInt16 /*nItemVersion*/ ) const -{ - rStrm << (sal_Int8) GetPropLineSpace() - << (short) GetInterLineSpace() - << (sal_uInt16) GetLineHeight() - << (sal_Int8) GetLineSpaceRule() - << (sal_Int8) GetInterLineSpaceRule(); - return rStrm; -} - -// ----------------------------------------------------------------------- - -sal_uInt16 SvxLineSpacingItem::GetValueCount() const -{ - return SVX_LINESPACE_END; // SVX_LINESPACE_TWO_LINES + 1 -} - -// ----------------------------------------------------------------------- - -XubString SvxLineSpacingItem::GetValueTextByPos( sal_uInt16 nPos ) const -{ - //! Strings demnaechst aus Resource laden - XubString aText; - switch ( nPos ) - { - case SVX_LINESPACE_USER : aText.AppendAscii( "Benutzer" ); break; - case SVX_LINESPACE_ONE_LINE : aText.AppendAscii( "Einzeilig" ); break; - case SVX_LINESPACE_ONE_POINT_FIVE_LINES : aText.AppendAscii( "1,5zeilig" ); break; - case SVX_LINESPACE_TWO_LINES : aText.AppendAscii( "Zweizeilig" ); break; - } - return aText; -} - -// ----------------------------------------------------------------------- - -sal_uInt16 SvxLineSpacingItem::GetEnumValue() const -{ - sal_uInt16 nVal; - switch ( nPropLineSpace ) - { - case 100: nVal = SVX_LINESPACE_ONE_LINE; break; - case 150: nVal = SVX_LINESPACE_ONE_POINT_FIVE_LINES; break; - case 200: nVal = SVX_LINESPACE_TWO_LINES; break; - default: nVal = SVX_LINESPACE_USER; break; - } - return nVal; -} - -// ----------------------------------------------------------------------- - -void SvxLineSpacingItem::SetEnumValue( sal_uInt16 nVal ) -{ - switch ( nVal ) - { - case SVX_LINESPACE_ONE_LINE: nPropLineSpace = 100; break; - case SVX_LINESPACE_ONE_POINT_FIVE_LINES: nPropLineSpace = 150; break; - case SVX_LINESPACE_TWO_LINES: nPropLineSpace = 200; break; - } -} - -// class SvxAdjustItem --------------------------------------------------- - -SvxAdjustItem::SvxAdjustItem(const SvxAdjust eAdjst, const sal_uInt16 nId ) - : SfxEnumItemInterface( nId ), - bOneBlock( sal_False ), bLastCenter( sal_False ), bLastBlock( sal_False ) -{ - SetAdjust( eAdjst ); -} - -// ----------------------------------------------------------------------- - -int SvxAdjustItem::operator==( const SfxPoolItem& rAttr ) const -{ - DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" ); - - return( ( GetAdjust() == ((SvxAdjustItem&)rAttr).GetAdjust() && - bOneBlock == ((SvxAdjustItem&)rAttr).bOneBlock && - bLastCenter == ((SvxAdjustItem&)rAttr).bLastCenter && - bLastBlock == ((SvxAdjustItem&)rAttr).bLastBlock ) - ? 1 : 0 ); -} - -/*-----------------18.03.98 16:15------------------- - ---------------------------------------------------*/ -sal_Bool SvxAdjustItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const -{ -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); - nMemberId &= ~CONVERT_TWIPS; - switch( nMemberId ) - { - case MID_PARA_ADJUST : rVal <<= (sal_Int16)GetAdjust(); break; - case MID_LAST_LINE_ADJUST : rVal <<= (sal_Int16)GetLastBlock(); break; - case MID_EXPAND_SINGLE : - { - sal_Bool bValue = bOneBlock; - rVal.setValue( &bValue, ::getCppuBooleanType() ); - break; - } - default: ;//prevent warning - } - return sal_True; -} -/*-----------------18.03.98 16:15------------------- - ---------------------------------------------------*/ - -sal_Bool SvxAdjustItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) -{ -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); - nMemberId &= ~CONVERT_TWIPS; - switch( nMemberId ) - { - case MID_PARA_ADJUST : - case MID_LAST_LINE_ADJUST : - { - sal_Int32 eVal = - 1; - try - { - eVal = ::comphelper::getEnumAsINT32(rVal); - } - catch(...) {} - if(eVal >= 0 && eVal <= 4) - { - if(MID_LAST_LINE_ADJUST == nMemberId && - eVal != SVX_ADJUST_LEFT && - eVal != SVX_ADJUST_BLOCK && - eVal != SVX_ADJUST_CENTER) - return FALSE; - if(eVal < (sal_uInt16)SVX_ADJUST_END) - nMemberId == MID_PARA_ADJUST ? - SetAdjust((SvxAdjust)eVal) : - SetLastBlock((SvxAdjust)eVal); - } - } - break; - case MID_EXPAND_SINGLE : - bOneBlock = Any2Bool(rVal); - break; - } - return sal_True; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxAdjustItem::Clone( SfxItemPool * ) const -{ - return new SvxAdjustItem( *this ); -} - -//------------------------------------------------------------------------ - -SfxItemPresentation SvxAdjustItem::GetPresentation -( - SfxItemPresentation ePres, - SfxMapUnit /*eCoreUnit*/, - SfxMapUnit /*ePresUnit*/, - XubString& rText, const IntlWrapper * -) const -{ - switch ( ePres ) - { - case SFX_ITEM_PRESENTATION_NONE: - rText.Erase(); - return SFX_ITEM_PRESENTATION_NONE; - case SFX_ITEM_PRESENTATION_NAMELESS: - case SFX_ITEM_PRESENTATION_COMPLETE: - rText = GetValueTextByPos( (sal_uInt16)GetAdjust() ); - return ePres; - default: ;//prevent warning - } - return SFX_ITEM_PRESENTATION_NONE; -} - -// ----------------------------------------------------------------------- - -sal_uInt16 SvxAdjustItem::GetValueCount() const -{ - return SVX_ADJUST_END; // SVX_ADJUST_BLOCKLINE + 1 -} - -// ----------------------------------------------------------------------- - -XubString SvxAdjustItem::GetValueTextByPos( sal_uInt16 nPos ) const -{ - DBG_ASSERT( nPos <= (sal_uInt16)SVX_ADJUST_BLOCKLINE, "enum overflow!" ); - return SVX_RESSTR(RID_SVXITEMS_ADJUST_BEGIN + nPos); -} - -// ----------------------------------------------------------------------- - -sal_uInt16 SvxAdjustItem::GetEnumValue() const -{ - return (sal_uInt16)GetAdjust(); -} - -// ----------------------------------------------------------------------- - -void SvxAdjustItem::SetEnumValue( sal_uInt16 nVal ) -{ - SetAdjust( (const SvxAdjust)nVal ); -} - -// ----------------------------------------------------------------------- - -sal_uInt16 SvxAdjustItem::GetVersion( sal_uInt16 nFileVersion ) const -{ - return (nFileVersion == SOFFICE_FILEFORMAT_31) - ? 0 : ADJUST_LASTBLOCK_VERSION; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxAdjustItem::Create(SvStream& rStrm, sal_uInt16 nVersion) const -{ - char eAdjustment; - rStrm >> eAdjustment; - SvxAdjustItem *pRet = new SvxAdjustItem( (SvxAdjust)eAdjustment, Which() ); - if( nVersion >= ADJUST_LASTBLOCK_VERSION ) - { - sal_Int8 nFlags; - rStrm >> nFlags; - pRet->bOneBlock = 0 != (nFlags & 0x0001); - pRet->bLastCenter = 0 != (nFlags & 0x0002); - pRet->bLastBlock = 0 != (nFlags & 0x0004); - } - return pRet; -} - -// ----------------------------------------------------------------------- - -SvStream& SvxAdjustItem::Store( SvStream& rStrm, sal_uInt16 nItemVersion ) const -{ - rStrm << (char)GetAdjust(); - if ( nItemVersion >= ADJUST_LASTBLOCK_VERSION ) - { - sal_Int8 nFlags = 0; - if ( bOneBlock ) - nFlags |= 0x0001; - if ( bLastCenter ) - nFlags |= 0x0002; - if ( bLastBlock ) - nFlags |= 0x0004; - rStrm << (sal_Int8) nFlags; - } - return rStrm; -} - -// class SvxWidowsItem --------------------------------------------------- - -SvxWidowsItem::SvxWidowsItem(const BYTE nL, const USHORT nId ) : - SfxByteItem( nId, nL ) -{ -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxWidowsItem::Clone( SfxItemPool * ) const -{ - return new SvxWidowsItem( *this ); -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxWidowsItem::Create(SvStream& rStrm, sal_uInt16) const -{ - sal_Int8 nLines; - rStrm >> nLines; - return new SvxWidowsItem( nLines, Which() ); -} - -// ----------------------------------------------------------------------- - -SvStream& SvxWidowsItem::Store( SvStream& rStrm, sal_uInt16 /*nItemVersion*/ ) const -{ - rStrm << (sal_Int8)GetValue(); - return rStrm; -} - -//------------------------------------------------------------------------ - -SfxItemPresentation SvxWidowsItem::GetPresentation -( - SfxItemPresentation ePres, - SfxMapUnit /*eCoreUnit*/, - SfxMapUnit /*ePresUnit*/, - XubString& rText, const IntlWrapper * -) const -{ - switch ( ePres ) - { - case SFX_ITEM_PRESENTATION_NONE: - { - rText.Erase(); - break; - } - - case SFX_ITEM_PRESENTATION_NAMELESS: - { - rText = SVX_RESSTR(RID_SVXITEMS_LINES); - break; - } - - case SFX_ITEM_PRESENTATION_COMPLETE: - { - rText = SVX_RESSTR(RID_SVXITEMS_WIDOWS_COMPLETE); - rText += ' '; - rText += SVX_RESSTR(RID_SVXITEMS_LINES); - } - - default: - { - DBG_ERRORFILE( "SvxWidowsItem::GetPresentation(): unknown SfxItemPresentation" ); - } - } - - rText.SearchAndReplace( String::CreateFromAscii( "%1" ), String::CreateFromInt32( GetValue() ) ); - return ePres; -} - -// class SvxOrphansItem -------------------------------------------------- - -SvxOrphansItem::SvxOrphansItem(const BYTE nL, const USHORT nId ) : - SfxByteItem( nId, nL ) -{ -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxOrphansItem::Clone( SfxItemPool * ) const -{ - return new SvxOrphansItem( *this ); -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxOrphansItem::Create(SvStream& rStrm, sal_uInt16) const -{ - sal_Int8 nLines; - rStrm >> nLines; - return new SvxOrphansItem( nLines, Which() ); -} - -// ----------------------------------------------------------------------- - -SvStream& SvxOrphansItem::Store( SvStream& rStrm, sal_uInt16 /*nItemVersion*/ ) const -{ - rStrm << (sal_Int8) GetValue(); - return rStrm; -} - -//------------------------------------------------------------------------ - -SfxItemPresentation SvxOrphansItem::GetPresentation -( - SfxItemPresentation ePres, - SfxMapUnit /*eCoreUnit*/, - SfxMapUnit /*ePresUnit*/, - XubString& rText, const IntlWrapper * -) const -{ - switch ( ePres ) - { - case SFX_ITEM_PRESENTATION_NONE: - { - rText.Erase(); - break; - } - - case SFX_ITEM_PRESENTATION_NAMELESS: - { - rText = SVX_RESSTR(RID_SVXITEMS_LINES); - break; - } - - case SFX_ITEM_PRESENTATION_COMPLETE: - { - rText = SVX_RESSTR(RID_SVXITEMS_ORPHANS_COMPLETE); - rText += ' '; - rText += SVX_RESSTR(RID_SVXITEMS_LINES); - } - - default: - { - DBG_ERRORFILE( "SvxOrphansItem::GetPresentation(): unknown SfxItemPresentation" ); - } - } - - rText.SearchAndReplace( String::CreateFromAscii( "%1" ), String::CreateFromInt32( GetValue() ) ); - return ePres; -} - -// class SvxHyphenZoneItem ----------------------------------------------- - -SvxHyphenZoneItem::SvxHyphenZoneItem( const sal_Bool bHyph, const sal_uInt16 nId ) : - SfxPoolItem( nId ) -{ - bHyphen = bHyph; - bPageEnd = sal_True; - nMinLead = nMinTrail = 0; - nMaxHyphens = 255; -} - -// ----------------------------------------------------------------------- -sal_Bool SvxHyphenZoneItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const -{ -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); - nMemberId &= ~CONVERT_TWIPS; - switch(nMemberId) - { - case MID_IS_HYPHEN: - rVal = Bool2Any(bHyphen); - break; - case MID_HYPHEN_MIN_LEAD: - rVal <<= (sal_Int16)nMinLead; - break; - case MID_HYPHEN_MIN_TRAIL: - rVal <<= (sal_Int16)nMinTrail; - break; - case MID_HYPHEN_MAX_HYPHENS: - rVal <<= (sal_Int16)nMaxHyphens; - break; - } - return sal_True; -} -// ----------------------------------------------------------------------- -sal_Bool SvxHyphenZoneItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) -{ -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); - nMemberId &= ~CONVERT_TWIPS; - sal_Int16 nNewVal = 0; - - if( nMemberId != MID_IS_HYPHEN ) - if(!(rVal >>= nNewVal)) - return sal_False; - - switch(nMemberId) - { - case MID_IS_HYPHEN: - bHyphen = Any2Bool(rVal); - break; - case MID_HYPHEN_MIN_LEAD: - nMinLead = (BYTE)nNewVal; - break; - case MID_HYPHEN_MIN_TRAIL: - nMinTrail = (BYTE)nNewVal; - break; - case MID_HYPHEN_MAX_HYPHENS: - nMaxHyphens = (BYTE)nNewVal; - break; - } - return sal_True; -} - -// ----------------------------------------------------------------------- - -int SvxHyphenZoneItem::operator==( const SfxPoolItem& rAttr ) const -{ - DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" ); - - return ( (((SvxHyphenZoneItem&)rAttr).bHyphen == bHyphen) - && (((SvxHyphenZoneItem&)rAttr).bPageEnd == bPageEnd) - && (((SvxHyphenZoneItem&)rAttr).nMinLead == nMinLead) - && (((SvxHyphenZoneItem&)rAttr).nMinTrail == nMinTrail) - && (((SvxHyphenZoneItem&)rAttr).nMaxHyphens == nMaxHyphens) ); -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxHyphenZoneItem::Clone( SfxItemPool * ) const -{ - return new SvxHyphenZoneItem( *this ); -} - -//------------------------------------------------------------------------ - -SfxItemPresentation SvxHyphenZoneItem::GetPresentation -( - SfxItemPresentation ePres, - SfxMapUnit /*eCoreUnit*/, - SfxMapUnit /*ePresUnit*/, - XubString& rText, const IntlWrapper * -) const -{ - switch ( ePres ) - { - case SFX_ITEM_PRESENTATION_NONE: - rText.Erase(); - return SFX_ITEM_PRESENTATION_NONE; - case SFX_ITEM_PRESENTATION_NAMELESS: - { - sal_uInt16 nId = RID_SVXITEMS_HYPHEN_FALSE; - - if ( bHyphen ) - nId = RID_SVXITEMS_HYPHEN_TRUE; - rText = SVX_RESSTR(nId); - rText += cpDelim; - nId = RID_SVXITEMS_PAGE_END_FALSE; - - if ( bPageEnd ) - nId = RID_SVXITEMS_PAGE_END_TRUE; - rText += SVX_RESSTR(nId); - rText += cpDelim; - rText += String::CreateFromInt32( nMinLead ); - rText += cpDelim; - rText += String::CreateFromInt32( nMinTrail ); - rText += cpDelim; - rText += String::CreateFromInt32( nMaxHyphens ); - return SFX_ITEM_PRESENTATION_COMPLETE; - } - case SFX_ITEM_PRESENTATION_COMPLETE: - { - sal_uInt16 nId = RID_SVXITEMS_HYPHEN_FALSE; - - if ( bHyphen ) - nId = RID_SVXITEMS_HYPHEN_TRUE; - rText = SVX_RESSTR(nId); - rText += cpDelim; - nId = RID_SVXITEMS_PAGE_END_FALSE; - - if ( bPageEnd ) - nId = RID_SVXITEMS_PAGE_END_TRUE; - rText += SVX_RESSTR(nId); - rText += cpDelim; - rText += String::CreateFromInt32(nMinLead); - rText += SVX_RESSTR(RID_SVXITEMS_HYPHEN_MINLEAD); - rText += cpDelim; - rText += String::CreateFromInt32(nMinTrail); - rText += SVX_RESSTR(RID_SVXITEMS_HYPHEN_MINTRAIL); - rText += cpDelim; - rText += String::CreateFromInt32(nMaxHyphens); - rText += SVX_RESSTR(RID_SVXITEMS_HYPHEN_MAX); - return SFX_ITEM_PRESENTATION_COMPLETE; - } - default: ;//prevent warning - } - return SFX_ITEM_PRESENTATION_NONE; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxHyphenZoneItem::Create(SvStream& rStrm, sal_uInt16) const -{ - sal_Int8 _bHyphen, _bHyphenPageEnd; - sal_Int8 _nMinLead, _nMinTrail, _nMaxHyphens; - rStrm >> _bHyphen >> _bHyphenPageEnd >> _nMinLead >> _nMinTrail >> _nMaxHyphens; - SvxHyphenZoneItem* pAttr = new SvxHyphenZoneItem( sal_False, Which() ); - pAttr->SetHyphen( sal_Bool( _bHyphen != 0 ) ); - pAttr->SetPageEnd( sal_Bool( _bHyphenPageEnd != 0 ) ); - pAttr->GetMinLead() = _nMinLead; - pAttr->GetMinTrail() = _nMinTrail; - pAttr->GetMaxHyphens() = _nMaxHyphens; - return pAttr; -} - -// ----------------------------------------------------------------------- - -SvStream& SvxHyphenZoneItem::Store( SvStream& rStrm, sal_uInt16 /*nItemVersion*/ ) const -{ - rStrm << (sal_Int8) IsHyphen() - << (sal_Int8) IsPageEnd() - << (sal_Int8) GetMinLead() - << (sal_Int8) GetMinTrail() - << (sal_Int8) GetMaxHyphens(); - return rStrm; -} - -// class SvxTabStop ------------------------------------------------------ - -SvxTabStop::SvxTabStop() -{ - nTabPos = 0; - eAdjustment = SVX_TAB_ADJUST_LEFT; - m_cDecimal = cDfltDecimalChar; - cFill = cDfltFillChar; -} - -// ----------------------------------------------------------------------- - -SvxTabStop::SvxTabStop( const long nPos, const SvxTabAdjust eAdjst, - const sal_Unicode cDec, const sal_Unicode cFil ) -{ - nTabPos = nPos; - eAdjustment = eAdjst; - m_cDecimal = cDec; - cFill = cFil; -} -// ----------------------------------------------------------------------------- -void SvxTabStop::fillDecimal() const -{ - if ( cDfltDecimalChar == m_cDecimal ) - m_cDecimal = SvtSysLocale().GetLocaleData().getNumDecimalSep().GetChar(0); -} -// ----------------------------------------------------------------------- - -XubString SvxTabStop::GetValueString() const -{ - XubString aStr; - - aStr += sal_Unicode( '(' ); - aStr += UniString::CreateFromInt32(nTabPos); - aStr += cpDelim; - aStr += XubString( ResId( RID_SVXITEMS_TAB_ADJUST_BEGIN + (sal_uInt16)eAdjustment, DIALOG_MGR() ) ); - - aStr += cpDelim; - aStr += sal_Unicode('['); - aStr += XubString( ResId( RID_SVXITEMS_TAB_DECIMAL_CHAR, DIALOG_MGR() ) ); - aStr += GetDecimal(); - aStr += sal_Unicode(']'); - aStr += cpDelim; - aStr += cpDelim; - aStr += sal_Unicode('['); - aStr += XubString( ResId( RID_SVXITEMS_TAB_FILL_CHAR, DIALOG_MGR() ) ); - aStr += cFill; - aStr += sal_Unicode(']'); - aStr += sal_Unicode(')'); - - return aStr; -} - -// class SvxTabStopItem -------------------------------------------------- - -SvxTabStopItem::SvxTabStopItem( sal_uInt16 _nWhich ) : - SfxPoolItem( _nWhich ), - SvxTabStopArr( sal_Int8(SVX_TAB_DEFCOUNT) ) -{ - const sal_uInt16 nTabs = SVX_TAB_DEFCOUNT, nDist = SVX_TAB_DEFDIST; - const SvxTabAdjust eAdjst= SVX_TAB_ADJUST_DEFAULT; - - for (sal_uInt16 i = 0; i < nTabs; ++i) - { - SvxTabStop aTab( (i + 1) * nDist, eAdjst ); - SvxTabStopArr::Insert( aTab ); - } -} - -// ----------------------------------------------------------------------- - -SvxTabStopItem::SvxTabStopItem( const sal_uInt16 nTabs, - const sal_uInt16 nDist, - const SvxTabAdjust eAdjst, - sal_uInt16 _nWhich ) : - SfxPoolItem( _nWhich ), - SvxTabStopArr( sal_Int8(nTabs) ) -{ - for ( sal_uInt16 i = 0; i < nTabs; ++i ) - { - SvxTabStop aTab( (i + 1) * nDist, eAdjst ); - SvxTabStopArr::Insert( aTab ); - } -} - -// ----------------------------------------------------------------------- - -SvxTabStopItem::SvxTabStopItem( const SvxTabStopItem& rTSI ) : - SfxPoolItem( rTSI.Which() ), - SvxTabStopArr( (sal_Int8)rTSI.Count() ) -{ - SvxTabStopArr::Insert( &rTSI ); -} - -// ----------------------------------------------------------------------- - -sal_uInt16 SvxTabStopItem::GetPos( const SvxTabStop& rTab ) const -{ - sal_uInt16 nFound; - return Seek_Entry( rTab, &nFound ) ? nFound : SVX_TAB_NOTFOUND; -} - -// ----------------------------------------------------------------------- - -sal_uInt16 SvxTabStopItem::GetPos( const long nPos ) const -{ - sal_uInt16 nFound; - return Seek_Entry( SvxTabStop( nPos ), &nFound ) ? nFound : SVX_TAB_NOTFOUND; -} - -// ----------------------------------------------------------------------- - -SvxTabStopItem& SvxTabStopItem::operator=( const SvxTabStopItem& rTSI ) -{ - Remove( 0, Count() ); - SvxTabStopArr::Insert( &rTSI ); - return *this; -} - - -/* - enum ::com::sun::star::style::TabAlign -{ - TABALIGN_LEFT, - TABALIGN_CENTER, - TABALIGN_RIGHT, - TABALIGN_DECIMAL -}; - -struct ::com::sun::star::style::TabStop -{ - long Position; - ::com::sun::star::style::TabAlign ::com::sun::star::drawing::Alignment; - unsigned short DecimalChar; - unsigned short FillChar; -}; -typedef sequence ::com::sun::star::style::TabStop> TabSTopSequence; - - */ -/*-----------------19.03.98 08:50------------------- - ---------------------------------------------------*/ - -sal_Bool SvxTabStopItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const -{ - sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); - nMemberId &= ~CONVERT_TWIPS; - switch ( nMemberId ) - { - case MID_TABSTOPS: - { - sal_uInt16 nCount = Count(); - uno::Sequence< style::TabStop> aSeq(nCount); - style::TabStop* pArr = aSeq.getArray(); - for(sal_uInt16 i = 0; i < nCount; i++) - { - const SvxTabStop& rTab = *(GetStart() + i); - pArr[i].Position = bConvert ? TWIP_TO_MM100(rTab.GetTabPos()) : rTab.GetTabPos(); - switch(rTab.GetAdjustment()) - { - case SVX_TAB_ADJUST_LEFT : pArr[i].Alignment = style::TabAlign_LEFT; break; - case SVX_TAB_ADJUST_RIGHT : pArr[i].Alignment = style::TabAlign_RIGHT; break; - case SVX_TAB_ADJUST_DECIMAL: pArr[i].Alignment = style::TabAlign_DECIMAL; break; - case SVX_TAB_ADJUST_CENTER : pArr[i].Alignment = style::TabAlign_CENTER; break; - default: //SVX_TAB_ADJUST_DEFAULT - pArr[i].Alignment = style::TabAlign_DEFAULT; - - } - pArr[i].DecimalChar = rTab.GetDecimal(); - pArr[i].FillChar = rTab.GetFill(); - } - rVal <<= aSeq; - break; - } - case MID_STD_TAB: - { - const SvxTabStop &rTab = *(GetStart()); - rVal <<= static_cast<sal_Int32>(bConvert ? TWIP_TO_MM100(rTab.GetTabPos()) : rTab.GetTabPos()); - break; - } - } - return sal_True; -} -/*-----------------19.03.98 08:50------------------- - ---------------------------------------------------*/ - -sal_Bool SvxTabStopItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) -{ - sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); - nMemberId &= ~CONVERT_TWIPS; - switch ( nMemberId ) - { - case MID_TABSTOPS: - { - uno::Sequence< style::TabStop> aSeq; - if(!(rVal >>= aSeq)) - { - uno::Sequence < uno::Sequence < uno::Any > > aAnySeq; - if (!(rVal >>= aAnySeq)) - return sal_False; - sal_Int32 nLength = aAnySeq.getLength(); - aSeq.realloc( nLength ); - for ( sal_Int32 n=0; n<nLength; n++ ) - { - uno::Sequence < uno::Any >& rAnySeq = aAnySeq[n]; - if ( rAnySeq.getLength() == 4 ) - { - if (!(rAnySeq[0] >>= aSeq[n].Position)) return sal_False; - if (!(rAnySeq[1] >>= aSeq[n].Alignment)) - { - sal_Int32 nVal = 0; - if (rAnySeq[1] >>= nVal) - aSeq[n].Alignment = (com::sun::star::style::TabAlign) nVal; - else - return sal_False; - } - if (!(rAnySeq[2] >>= aSeq[n].DecimalChar)) - { - ::rtl::OUString aVal; - if ( (rAnySeq[2] >>= aVal) && aVal.getLength() == 1 ) - aSeq[n].DecimalChar = aVal.toChar(); - else - return sal_False; - } - if (!(rAnySeq[3] >>= aSeq[n].FillChar)) - { - ::rtl::OUString aVal; - if ( (rAnySeq[3] >>= aVal) && aVal.getLength() == 1 ) - aSeq[n].FillChar = aVal.toChar(); - else - return sal_False; - } - } - else - return sal_False; - } - } - - SvxTabStopArr::Remove( 0, Count() ); - const style::TabStop* pArr = aSeq.getConstArray(); - const sal_uInt16 nCount = (sal_uInt16)aSeq.getLength(); - for(sal_uInt16 i = 0; i < nCount ; i++) - { - SvxTabAdjust eAdjust = SVX_TAB_ADJUST_DEFAULT; - switch(pArr[i].Alignment) - { - case style::TabAlign_LEFT : eAdjust = SVX_TAB_ADJUST_LEFT; break; - case style::TabAlign_CENTER : eAdjust = SVX_TAB_ADJUST_CENTER; break; - case style::TabAlign_RIGHT : eAdjust = SVX_TAB_ADJUST_RIGHT; break; - case style::TabAlign_DECIMAL: eAdjust = SVX_TAB_ADJUST_DECIMAL; break; - default: ;//prevent warning - } - sal_Unicode cFill = pArr[i].FillChar; - sal_Unicode cDecimal = pArr[i].DecimalChar; - SvxTabStop aTab( bConvert ? MM100_TO_TWIP(pArr[i].Position) : pArr[i].Position, - eAdjust, - cDecimal, - cFill ); - Insert(aTab); - } - break; - } - case MID_STD_TAB: - { - sal_Int32 nNewPos = 0; - if (!(rVal >>= nNewPos) ) - return sal_False; - const SvxTabStop& rTab = *(GetStart()); - SvxTabStop aNewTab ( bConvert ? MM100_TO_TWIP ( nNewPos ) : nNewPos, - rTab.GetAdjustment(), rTab.GetDecimal(), rTab.GetFill() ); - Remove ( 0 ); - Insert( aNewTab ); - break; - } - } - return sal_True; -} -// ----------------------------------------------------------------------- - -int SvxTabStopItem::operator==( const SfxPoolItem& rAttr ) const -{ - DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" ); - - const SvxTabStopItem& rTSI = (SvxTabStopItem&)rAttr; - - if ( Count() != rTSI.Count() ) - return 0; - - for ( sal_uInt16 i = 0; i < Count(); ++i ) - if( !(*this)[i].IsEqual( rTSI[i] ) ) - return 0; - return 1; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxTabStopItem::Clone( SfxItemPool * ) const -{ - return new SvxTabStopItem( *this ); -} - -//------------------------------------------------------------------------ - -SfxItemPresentation SvxTabStopItem::GetPresentation -( - SfxItemPresentation ePres, - SfxMapUnit eCoreUnit, - SfxMapUnit ePresUnit, - XubString& rText, const IntlWrapper *pIntl -) const -{ - rText.Erase(); - - if ( ePres > SFX_ITEM_PRESENTATION_NONE ) - { -#ifndef SVX_LIGHT - sal_Bool bComma = sal_False; - - for ( sal_uInt16 i = 0; i < Count(); ++i ) - { - if ( SVX_TAB_ADJUST_DEFAULT != ((*this)[i]).GetAdjustment() ) - { - if ( bComma ) - rText += sal_Unicode(','); - rText += GetMetricText( - (long)((*this)[i]).GetTabPos(), eCoreUnit, ePresUnit, pIntl ); - if ( SFX_ITEM_PRESENTATION_COMPLETE == ePres ) - rText += SVX_RESSTR(GetMetricId(ePresUnit)); - bComma = sal_True; - } - } -#endif - } - return ePres; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxTabStopItem::Create( SvStream& rStrm, sal_uInt16 ) const -{ - sal_Int8 nTabs; - rStrm >> nTabs; - SvxTabStopItem* pAttr = - new SvxTabStopItem( 0, 0, SVX_TAB_ADJUST_DEFAULT, Which() ); - - for ( sal_Int8 i = 0; i < nTabs; i++ ) - { - long nPos; - sal_Int8 eAdjust; - unsigned char cDecimal, cFill; - rStrm >> nPos >> eAdjust >> cDecimal >> cFill; - if( !i || SVX_TAB_ADJUST_DEFAULT != eAdjust ) - pAttr->Insert( SvxTabStop - ( nPos, (SvxTabAdjust)eAdjust, sal_Unicode(cDecimal), sal_Unicode(cFill) ) ); - } - return pAttr; -} - -// ----------------------------------------------------------------------- - -SvStream& SvxTabStopItem::Store( SvStream& rStrm, sal_uInt16 /*nItemVersion*/ ) const -{ - //MA 05. Sep. 96: Default-Tabs werden nur noch fuer das default-Attr - //expandiert. Fuer vollstaendige Rueckwaertskompatibilitaet (<=304) - //muessten alle Tabs expandiert werden, dass blaeht aber das File u.U. - //enorm auf. - //Alles nur SWG! - - const SfxItemPool *pPool = SfxItemPool::GetStoringPool(); - const FASTBOOL bStoreDefTabs = pPool - && pPool->GetName().EqualsAscii("SWG") - && ::IsDefaultItem( this ); - - const short nTabs = Count(); - sal_uInt16 nCount = 0, nDefDist = 0; - long nNew = 0; - - if( bStoreDefTabs ) - { - const SvxTabStopItem& rDefTab = (const SvxTabStopItem &) - pPool->GetDefaultItem( pPool->GetWhich( SID_ATTR_TABSTOP, sal_False ) ); - nDefDist = sal_uInt16( rDefTab.GetStart()->GetTabPos() ); - const long nPos = nTabs > 0 ? (*this)[nTabs-1].GetTabPos() : 0; - nCount = (sal_uInt16)(nPos / nDefDist); - nNew = (nCount + 1) * nDefDist; - - if( nNew <= nPos + 50 ) - nNew += nDefDist; - - long lA3Width = SvxPaperInfo::GetPaperSize(PAPER_A3).Width(); - nCount = (sal_uInt16)(nNew < lA3Width ? ( lA3Width - nNew ) / nDefDist + 1 : 0); - } - - rStrm << (sal_Int8) ( nTabs + nCount ); - for ( short i = 0; i < nTabs; i++ ) - { - const SvxTabStop& rTab = (*this)[ i ]; - rStrm << (long) rTab.GetTabPos() - << (sal_Int8) rTab.GetAdjustment() - << (unsigned char) rTab.GetDecimal() - << (unsigned char) rTab.GetFill(); - } - - if ( bStoreDefTabs ) - for( ; nCount; --nCount ) - { - SvxTabStop aSwTabStop(nNew, SVX_TAB_ADJUST_DEFAULT); - rStrm << (long) aSwTabStop.GetTabPos() - << (sal_Int8) aSwTabStop.GetAdjustment() - << (unsigned char) aSwTabStop.GetDecimal() - << (unsigned char) aSwTabStop.GetFill(); - nNew += nDefDist; - } - - return rStrm; -} - -// ----------------------------------------------------------------------- -sal_Bool SvxTabStopItem::Insert( const SvxTabStop& rTab ) -{ - sal_uInt16 nTabPos = GetPos(rTab); - if(SVX_TAB_NOTFOUND != nTabPos ) - Remove(nTabPos); - return SvxTabStopArr::Insert( rTab ); -} -// ----------------------------------------------------------------------- -void SvxTabStopItem::Insert( const SvxTabStopItem* pTabs, sal_uInt16 nStart, - sal_uInt16 nEnd ) -{ - for( sal_uInt16 i = nStart; i < nEnd && i < pTabs->Count(); i++ ) - { - const SvxTabStop& rTab = (*pTabs)[i]; - sal_uInt16 nTabPos = GetPos(rTab); - if(SVX_TAB_NOTFOUND != nTabPos) - Remove(nTabPos); - } - SvxTabStopArr::Insert( pTabs, nStart, nEnd ); -} - - - -// class SvxFmtSplitItem ------------------------------------------------- -SvxFmtSplitItem::~SvxFmtSplitItem() -{ -} -// ----------------------------------------------------------------------- -SfxPoolItem* SvxFmtSplitItem::Clone( SfxItemPool * ) const -{ - return new SvxFmtSplitItem( *this ); -} - -// ----------------------------------------------------------------------- - -SvStream& SvxFmtSplitItem::Store( SvStream& rStrm, sal_uInt16 /*nItemVersion*/ ) const -{ - rStrm << (sal_Int8)GetValue(); - return rStrm; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxFmtSplitItem::Create( SvStream& rStrm, sal_uInt16 ) const -{ - sal_Int8 bIsSplit; - rStrm >> bIsSplit; - return new SvxFmtSplitItem( sal_Bool( bIsSplit != 0 ), Which() ); -} - -//------------------------------------------------------------------------ - -SfxItemPresentation SvxFmtSplitItem::GetPresentation -( - SfxItemPresentation ePres, - SfxMapUnit /*eCoreUnit*/, - SfxMapUnit /*ePresUnit*/, - XubString& rText, const IntlWrapper * -) const -{ - switch ( ePres ) - { - case SFX_ITEM_PRESENTATION_NONE: - rText.Erase(); - return SFX_ITEM_PRESENTATION_NONE; - case SFX_ITEM_PRESENTATION_NAMELESS: - case SFX_ITEM_PRESENTATION_COMPLETE: - { - sal_uInt16 nId = RID_SVXITEMS_FMTSPLIT_FALSE; - - if ( GetValue() ) - nId = RID_SVXITEMS_FMTSPLIT_TRUE; - rText = SVX_RESSTR(nId); - return ePres; - } - default: ;//prevent warning - } - return SFX_ITEM_PRESENTATION_NONE; -} - -// -------------------------------------------------------------------- - -SfxPoolItem* SvxPageModelItem::Clone( SfxItemPool* ) const -{ - return new SvxPageModelItem( *this ); -} - -//------------------------------------------------------------------------ - -sal_Bool SvxPageModelItem::QueryValue( com::sun::star::uno::Any& rVal, BYTE nMemberId ) const -{ -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); - nMemberId &= ~CONVERT_TWIPS; - - switch ( nMemberId ) - { - case MID_AUTO: rVal <<= (sal_Bool) bAuto; break; - case MID_NAME: rVal <<= ::rtl::OUString( GetValue() ); break; - default: DBG_ERROR("Wrong MemberId!"); return sal_False; - } - - return sal_True; -} - -sal_Bool SvxPageModelItem::PutValue( const com::sun::star::uno::Any& rVal, BYTE nMemberId ) -{ -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); - nMemberId &= ~CONVERT_TWIPS; - sal_Bool bRet; - ::rtl::OUString aStr; - switch ( nMemberId ) - { - case MID_AUTO: bRet = ( rVal >>= bAuto ); break; - case MID_NAME: bRet = ( rVal >>= aStr ); if ( bRet ) SetValue(aStr); break; - default: DBG_ERROR("Wrong MemberId!"); return sal_False; - } - - return bRet; -} - -SfxItemPresentation SvxPageModelItem::GetPresentation -( - SfxItemPresentation ePres, - SfxMapUnit /*eCoreUnit*/, - SfxMapUnit /*ePresUnit*/, - XubString& rText, const IntlWrapper * -) const -{ - rText.Erase(); - FASTBOOL bSet = ( GetValue().Len() > 0 ); - - switch ( ePres ) - { - case SFX_ITEM_PRESENTATION_NONE: - return SFX_ITEM_PRESENTATION_NONE; - - case SFX_ITEM_PRESENTATION_NAMELESS: - if ( bSet ) - rText = GetValue(); - return SFX_ITEM_PRESENTATION_NAMELESS; - - case SFX_ITEM_PRESENTATION_COMPLETE: - if ( bSet ) - { - rText = SVX_RESSTR(RID_SVXITEMS_PAGEMODEL_COMPLETE); - rText += GetValue(); - } - return SFX_ITEM_PRESENTATION_COMPLETE; - default: ;//prevent warning - } - return SFX_ITEM_PRESENTATION_NONE; -} - -//------------------------------------------------------------------------ - -SvxScriptSpaceItem::SvxScriptSpaceItem( sal_Bool bOn, const sal_uInt16 nId ) - : SfxBoolItem( nId, bOn ) -{ -} - -SfxPoolItem* SvxScriptSpaceItem::Clone( SfxItemPool * ) const -{ - return new SvxScriptSpaceItem( GetValue(), Which() ); -} - -SfxPoolItem* SvxScriptSpaceItem::Create(SvStream & rStrm, USHORT) const -{ - sal_Bool bFlag; - rStrm >> bFlag; - return new SvxScriptSpaceItem( bFlag, Which() ); -} - -USHORT SvxScriptSpaceItem::GetVersion( USHORT nFFVer ) const -{ - DBG_ASSERT( SOFFICE_FILEFORMAT_31==nFFVer || - SOFFICE_FILEFORMAT_40==nFFVer || - SOFFICE_FILEFORMAT_50==nFFVer, - "SvxTwoLinesItem: Gibt es ein neues Fileformat?" ); - - return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0; -} - -SfxItemPresentation SvxScriptSpaceItem::GetPresentation( - SfxItemPresentation ePres, - SfxMapUnit /*eCoreMetric*/, SfxMapUnit /*ePresMetric*/, - String &rText, const IntlWrapper* /*pIntl*/ ) const -{ - switch( ePres ) - { - case SFX_ITEM_PRESENTATION_NONE: - rText.Erase(); - break; - case SFX_ITEM_PRESENTATION_NAMELESS: - case SFX_ITEM_PRESENTATION_COMPLETE: - { - rText = SVX_RESSTR( !GetValue() - ? RID_SVXITEMS_SCRPTSPC_OFF - : RID_SVXITEMS_SCRPTSPC_ON ); - return ePres; - } - default: ;//prevent warning - } - return SFX_ITEM_PRESENTATION_NONE; -} - -//------------------------------------------------------------------------ - -SvxHangingPunctuationItem::SvxHangingPunctuationItem( - sal_Bool bOn, const sal_uInt16 nId ) - : SfxBoolItem( nId, bOn ) -{ -} - -SfxPoolItem* SvxHangingPunctuationItem::Clone( SfxItemPool * ) const -{ - return new SvxHangingPunctuationItem( GetValue(), Which() ); -} - -SfxPoolItem* SvxHangingPunctuationItem::Create(SvStream & rStrm, USHORT) const -{ - sal_Bool nValue; - rStrm >> nValue; - return new SvxHangingPunctuationItem( nValue, Which() ); -} - -USHORT SvxHangingPunctuationItem::GetVersion( USHORT nFFVer ) const -{ - DBG_ASSERT( SOFFICE_FILEFORMAT_31==nFFVer || - SOFFICE_FILEFORMAT_40==nFFVer || - SOFFICE_FILEFORMAT_50==nFFVer, - "SvxHangingPunctuationItem: Gibt es ein neues Fileformat?" ); - - return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0; -} - -SfxItemPresentation SvxHangingPunctuationItem::GetPresentation( - SfxItemPresentation ePres, - SfxMapUnit /*eCoreMetric*/, SfxMapUnit /*ePresMetric*/, - String &rText, const IntlWrapper* /*pIntl*/ ) const -{ - switch( ePres ) - { - case SFX_ITEM_PRESENTATION_NONE: - rText.Erase(); - break; - case SFX_ITEM_PRESENTATION_NAMELESS: - case SFX_ITEM_PRESENTATION_COMPLETE: - { - rText = SVX_RESSTR( !GetValue() - ? RID_SVXITEMS_HNGPNCT_OFF - : RID_SVXITEMS_HNGPNCT_ON ); - return ePres; - } - default: ;//prevent warning - break; - } - return SFX_ITEM_PRESENTATION_NONE; -} -//------------------------------------------------------------------------ - -SvxForbiddenRuleItem::SvxForbiddenRuleItem( - sal_Bool bOn, const sal_uInt16 nId ) - : SfxBoolItem( nId, bOn ) -{ -} -/* -----------------------------29.11.00 11:23-------------------------------- - - ---------------------------------------------------------------------------*/ -SfxPoolItem* SvxForbiddenRuleItem::Clone( SfxItemPool * ) const -{ - return new SvxForbiddenRuleItem( GetValue(), Which() ); -} -/* -----------------------------29.11.00 11:23-------------------------------- - - ---------------------------------------------------------------------------*/ -SfxPoolItem* SvxForbiddenRuleItem::Create(SvStream & rStrm, USHORT) const -{ - sal_Bool nValue; - rStrm >> nValue; - return new SvxForbiddenRuleItem( nValue, Which() ); -} -/* -----------------------------29.11.00 11:23-------------------------------- - - ---------------------------------------------------------------------------*/ -USHORT SvxForbiddenRuleItem::GetVersion( USHORT nFFVer ) const -{ - DBG_ASSERT( SOFFICE_FILEFORMAT_31==nFFVer || - SOFFICE_FILEFORMAT_40==nFFVer || - SOFFICE_FILEFORMAT_50==nFFVer, - "SvxForbiddenRuleItem: Gibt es ein neues Fileformat?" ); - - return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0; -} -/* -----------------------------29.11.00 11:23-------------------------------- - - ---------------------------------------------------------------------------*/ -SfxItemPresentation SvxForbiddenRuleItem::GetPresentation( - SfxItemPresentation ePres, - SfxMapUnit /*eCoreMetric*/, SfxMapUnit /*ePresMetric*/, - String &rText, const IntlWrapper* /*pIntl*/ ) const -{ - switch( ePres ) - { - case SFX_ITEM_PRESENTATION_NONE: - rText.Erase(); - break; - case SFX_ITEM_PRESENTATION_NAMELESS: - case SFX_ITEM_PRESENTATION_COMPLETE: - { - rText = SVX_RESSTR( !GetValue() - ? RID_SVXITEMS_FORBIDDEN_RULE_OFF - : RID_SVXITEMS_FORBIDDEN_RULE_ON ); - return ePres; - } - default: ;//prevent warning - break; - } - return SFX_ITEM_PRESENTATION_NONE; -} - -/************************************************************************* -|* class SvxParaVertAlignItem -*************************************************************************/ - -SvxParaVertAlignItem::SvxParaVertAlignItem( sal_uInt16 nValue, - const sal_uInt16 nW ) - : SfxUInt16Item( nW, nValue ) -{ -} - -SfxPoolItem* SvxParaVertAlignItem::Clone( SfxItemPool* ) const -{ - return new SvxParaVertAlignItem( GetValue(), Which() ); -} - -SfxPoolItem* SvxParaVertAlignItem::Create( SvStream& rStrm, USHORT ) const -{ - sal_uInt16 nVal; - rStrm >> nVal; - return new SvxParaVertAlignItem( nVal, Which() ); -} - -SvStream& SvxParaVertAlignItem::Store( SvStream & rStrm, USHORT ) const -{ - rStrm << GetValue(); - return rStrm; -} - -USHORT SvxParaVertAlignItem::GetVersion( USHORT nFFVer ) const -{ - return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0; -} - -SfxItemPresentation SvxParaVertAlignItem::GetPresentation( - SfxItemPresentation ePres, - SfxMapUnit /*eCoreMetric*/, SfxMapUnit /*ePresMetric*/, - String &rText, const IntlWrapper* ) const -{ - switch( ePres ) - { - case SFX_ITEM_PRESENTATION_NONE: - rText.Erase(); - break; - case SFX_ITEM_PRESENTATION_NAMELESS: - case SFX_ITEM_PRESENTATION_COMPLETE: - { - USHORT nTmp; - switch( GetValue() ) - { - case AUTOMATIC: nTmp = RID_SVXITEMS_PARAVERTALIGN_AUTO; break; - case TOP: nTmp = RID_SVXITEMS_PARAVERTALIGN_TOP; break; - case CENTER: nTmp = RID_SVXITEMS_PARAVERTALIGN_CENTER; break; - case BOTTOM: nTmp = RID_SVXITEMS_PARAVERTALIGN_BOTTOM; break; - default: nTmp = RID_SVXITEMS_PARAVERTALIGN_BASELINE; break; - } - rText = SVX_RESSTR( nTmp ); - return ePres; - } - default: ;//prevent warning - break; - } - return SFX_ITEM_PRESENTATION_NONE; -} - -sal_Bool SvxParaVertAlignItem::QueryValue( com::sun::star::uno::Any& rVal, - BYTE /*nMemberId*/ ) const -{ - rVal <<= (sal_Int16)GetValue(); - return sal_True; -} - -sal_Bool SvxParaVertAlignItem::PutValue( const com::sun::star::uno::Any& rVal, - BYTE /*nMemberId*/ ) -{ - sal_Int16 nVal = sal_Int16(); - if((rVal >>= nVal) && nVal >=0 && nVal <= BOTTOM ) - { - SetValue( (USHORT)nVal ); - return sal_True; - } - else - return sal_False; -} - -int SvxParaVertAlignItem::operator==( const SfxPoolItem& rItem ) const -{ - DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" ); - return SfxUInt16Item::operator==( rItem ); -} - - -SvxParaGridItem::SvxParaGridItem( sal_Bool bOn, const sal_uInt16 nId ) - : SfxBoolItem( nId, bOn ) -{ -} - -SfxPoolItem* SvxParaGridItem::Clone( SfxItemPool * ) const -{ - return new SvxParaGridItem( GetValue(), Which() ); -} - -SfxPoolItem* SvxParaGridItem::Create(SvStream & rStrm, USHORT) const -{ - sal_Bool bFlag; - rStrm >> bFlag; - return new SvxParaGridItem( bFlag, Which() ); -} - -USHORT SvxParaGridItem::GetVersion( USHORT nFFVer ) const -{ - DBG_ASSERT( SOFFICE_FILEFORMAT_31==nFFVer || - SOFFICE_FILEFORMAT_40==nFFVer || - SOFFICE_FILEFORMAT_50==nFFVer, - "SvxParaGridItem: Gibt es ein neues Fileformat?" ); - - return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0; -} - -SfxItemPresentation SvxParaGridItem::GetPresentation( - SfxItemPresentation ePres, - SfxMapUnit /*eCoreMetric*/, SfxMapUnit /*ePresMetric*/, - String &rText, const IntlWrapper* /*pIntl*/ ) const -{ - switch( ePres ) - { - case SFX_ITEM_PRESENTATION_NONE: - rText.Erase(); - break; - case SFX_ITEM_PRESENTATION_NAMELESS: - case SFX_ITEM_PRESENTATION_COMPLETE: - { - rText = GetValue() ? - SVX_RESSTR( RID_SVXITEMS_PARASNAPTOGRID_ON ) : - SVX_RESSTR( RID_SVXITEMS_PARASNAPTOGRID_OFF ); - - return ePres; - } - default: ;//prevent warning - break; - } - return SFX_ITEM_PRESENTATION_NONE; -} - - diff --git a/svx/source/items/postattr.cxx b/svx/source/items/postattr.cxx index 658e915e4320..5b03bbd6be2d 100644 --- a/svx/source/items/postattr.cxx +++ b/svx/source/items/postattr.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: postattr.cxx,v $ - * $Revision: 1.8 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -35,7 +32,9 @@ #define _SVX_POSTATTR_CXX #include "postattr.hxx" -#include <svx/itemtype.hxx> +#include <editeng/itemtype.hxx> +#include <svx/svxitems.hrc> +#include <svx/dialmgr.hxx> // ----------------------------------------------------------------------- diff --git a/svx/source/items/rotmodit.cxx b/svx/source/items/rotmodit.cxx index 127edfb54f31..10a0adf3f0c9 100644 --- a/svx/source/items/rotmodit.cxx +++ b/svx/source/items/rotmodit.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: rotmodit.cxx,v $ - * $Revision: 1.10 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svx/source/items/svxempty.cxx b/svx/source/items/svxempty.cxx index e9fe5e0dc496..6d5d07184898 100644 --- a/svx/source/items/svxempty.cxx +++ b/svx/source/items/svxempty.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: svxempty.cxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svx/source/items/svxerr.cxx b/svx/source/items/svxerr.cxx index cb8ab2657403..317514601aa5 100644 --- a/svx/source/items/svxerr.cxx +++ b/svx/source/items/svxerr.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: svxerr.cxx,v $ - * $Revision: 1.8 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svx/source/items/svxerr.src b/svx/source/items/svxerr.src index 82ccac920e60..382027a12b51 100644 --- a/svx/source/items/svxerr.src +++ b/svx/source/items/svxerr.src @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: svxerr.src,v $ - * $Revision: 1.55 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -31,6 +28,8 @@ #define __RSC #include "svxerr.hxx" #include <svx/dialogs.hrc> +#include <editeng/editerr.hxx> + // pragma ---------------------------------------------------------------- // Error-Context --------------------------------------------------------- diff --git a/svx/source/items/svxfont.cxx b/svx/source/items/svxfont.cxx deleted file mode 100644 index 1ce7190393a7..000000000000 --- a/svx/source/items/svxfont.cxx +++ /dev/null @@ -1,864 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: svxfont.cxx,v $ - * $Revision: 1.15.216.1 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svx.hxx" - -// include ---------------------------------------------------------------- - -#ifndef _OUTDEV_HXX //autogen -#include <vcl/outdev.hxx> -#endif -#ifndef _PRINT_HXX //autogen -#include <vcl/print.hxx> -#endif -#include <tools/poly.hxx> -#include <unotools/charclass.hxx> -#include <unolingu.hxx> -#include <com/sun/star/i18n/KCharacterType.hpp> - -#define _SVX_SVXFONT_CXX - -#include <svx/svxfont.hxx> -#include <svx/escpitem.hxx> - -// Minimum: Prozentwert fuers kernen -#define MINKERNPERCENT 5 - -// prop. Groesse der Kleinbuchstaben bei Kapitaelchen -#define KAPITAELCHENPROP 66 - -#ifndef REDUCEDSVXFONT - const sal_Unicode CH_BLANK = sal_Unicode(' '); // ' ' Leerzeichen - static sal_Char __READONLY_DATA sDoubleSpace[] = " "; -#endif - -/************************************************************************* - * class SvxFont - *************************************************************************/ - -SvxFont::SvxFont() -{ - nKern = nEsc = 0; - nPropr = 100; - eCaseMap = SVX_CASEMAP_NOT_MAPPED; - eLang = LANGUAGE_SYSTEM; -} - -SvxFont::SvxFont( const Font &rFont ) - : Font( rFont ) -{ - nKern = nEsc = 0; - nPropr = 100; - eCaseMap = SVX_CASEMAP_NOT_MAPPED; - eLang = LANGUAGE_SYSTEM; -} - -/************************************************************************* - * class SvxFont: Copy-Ctor - *************************************************************************/ - -SvxFont::SvxFont( const SvxFont &rFont ) - : Font( rFont ) -{ - nKern = rFont.GetFixKerning(); - nEsc = rFont.GetEscapement(); - nPropr = rFont.GetPropr(); - eCaseMap = rFont.GetCaseMap(); - eLang = rFont.GetLanguage(); -} - -/************************************************************************* - * static SvxFont::DrawArrow - *************************************************************************/ - -void SvxFont::DrawArrow( OutputDevice &rOut, const Rectangle& rRect, - const Size& rSize, const Color& rCol, BOOL bLeft ) -{ - long nLeft = ( rRect.Left() + rRect.Right() - rSize.Width() )/ 2; - long nRight = nLeft + rSize.Width(); - long nMid = ( rRect.Top() + rRect.Bottom() ) / 2; - long nTop = nMid - rSize.Height() / 2; - long nBottom = nTop + rSize.Height(); - if( nLeft < rRect.Left() ) - { - nLeft = rRect.Left(); - nRight = rRect.Right(); - } - if( nTop < rRect.Top() ) - { - nTop = rRect.Top(); - nBottom = rRect.Bottom(); - } - Polygon aPoly; - Point aTmp( bLeft ? nLeft : nRight, nMid ); - Point aNxt( bLeft ? nRight : nLeft, nTop ); - aPoly.Insert( 0, aTmp ); - aPoly.Insert( 0, aNxt ); - aNxt.Y() = nBottom; - aPoly.Insert( 0, aNxt ); - aPoly.Insert( 0, aTmp ); - Color aOldLineColor = rOut.GetLineColor(); - Color aOldFillColor = rOut.GetFillColor(); - rOut.SetFillColor( rCol ); - rOut.SetLineColor( Color( COL_BLACK ) ); - rOut.DrawPolygon( aPoly ); - rOut.DrawLine( aTmp, aNxt ); - rOut.SetLineColor( aOldLineColor ); - rOut.SetFillColor( aOldFillColor ); -} - -/************************************************************************* - * SvxFont::CalcCaseMap - *************************************************************************/ - -XubString SvxFont::CalcCaseMap( const XubString &rTxt ) const -{ - if( !IsCaseMap() || !rTxt.Len() ) return rTxt; - XubString aTxt( rTxt ); - // Ich muss mir noch die Sprache besorgen - const LanguageType eLng = LANGUAGE_DONTKNOW == eLang - ? LANGUAGE_SYSTEM : eLang; - - CharClass aCharClass( SvxCreateLocale( eLng ) ); - - switch( eCaseMap ) - { - case SVX_CASEMAP_KAPITAELCHEN: - case SVX_CASEMAP_VERSALIEN: - { - aCharClass.toUpper( aTxt ); - break; - } - - case SVX_CASEMAP_GEMEINE: - { - aCharClass.toLower( aTxt ); - break; - } - case SVX_CASEMAP_TITEL: - { - // Jeder Wortbeginn wird gross geschrieben, - // der Rest des Wortes wird unbesehen uebernommen. - // Bug: wenn das Attribut mitten im Wort beginnt. - BOOL bBlank = TRUE; - - for( USHORT i = 0; i < aTxt.Len(); ++i ) - { - if( sal_Unicode(' ') == aTxt.GetChar(i) || sal_Unicode('\t') == aTxt.GetChar(i) ) - bBlank = TRUE; - else - { - if( bBlank ) - { - String aTemp( aTxt.GetChar( i ) ); - aCharClass.toUpper( aTemp ); - aTxt.Replace( i, 1, aTemp ); - } - bBlank = FALSE; - } - } - break; - } - default: - { - DBG_ASSERT(!this, "SvxFont::CaseMapTxt: unknown casemap"); - break; - } - } - return aTxt; -} - -/************************************************************************* - * Hier beginnen die Methoden, die im Writer nicht benutzt werden koennen, - * deshalb kann man diesen Bereich durch setzen von REDUCEDSVXFONT ausklammern. - *************************************************************************/ -#ifndef REDUCEDSVXFONT - -/************************************************************************* - * class SvxDoCapitals - * die virtuelle Methode Do wird von SvxFont::DoOnCapitals abwechselnd mit - * den "Gross-" und "Kleinbuchstaben"-Teilen aufgerufen. - * Die Ableitungen von SvxDoCapitals erfuellen diese Methode mit Leben. - *************************************************************************/ - -class SvxDoCapitals -{ -protected: - OutputDevice *pOut; - const XubString &rTxt; - const xub_StrLen nIdx; - const xub_StrLen nLen; - -public: - SvxDoCapitals( OutputDevice *_pOut, const XubString &_rTxt, - const xub_StrLen _nIdx, const xub_StrLen _nLen ) - : pOut(_pOut), rTxt(_rTxt), nIdx(_nIdx), nLen(_nLen) - { } - - virtual void DoSpace( const BOOL bDraw ); - virtual void SetSpace(); - virtual void Do( const XubString &rTxt, - const xub_StrLen nIdx, const xub_StrLen nLen, - const BOOL bUpper ) = 0; - - inline OutputDevice *GetOut() { return pOut; } - inline const XubString &GetTxt() const { return rTxt; } - xub_StrLen GetIdx() const { return nIdx; } - xub_StrLen GetLen() const { return nLen; } -}; - -void SvxDoCapitals::DoSpace( const BOOL /*bDraw*/ ) { } - -void SvxDoCapitals::SetSpace() { } - -void SvxDoCapitals::Do( const XubString &/*_rTxt*/, const xub_StrLen /*_nIdx*/, - const xub_StrLen /*_nLen*/, const BOOL /*bUpper*/ ) { } - -/************************************************************************* - * SvxFont::DoOnCapitals() const - * zerlegt den String in Gross- und Kleinbuchstaben und ruft jeweils die - * Methode SvxDoCapitals::Do( ) auf. - *************************************************************************/ - -void SvxFont::DoOnCapitals(SvxDoCapitals &rDo, const xub_StrLen nPartLen) const -{ - const XubString &rTxt = rDo.GetTxt(); - const xub_StrLen nIdx = rDo.GetIdx(); - const xub_StrLen nLen = STRING_LEN == nPartLen ? rDo.GetLen() : nPartLen; - - const XubString aTxt( CalcCaseMap( rTxt ) ); - const USHORT nTxtLen = Min( rTxt.Len(), nLen ); - USHORT nPos = 0; - USHORT nOldPos = nPos; - - // #108210# - // Test if string length differ between original and CaseMapped - sal_Bool bCaseMapLengthDiffers(aTxt.Len() != rTxt.Len()); - - const LanguageType eLng = LANGUAGE_DONTKNOW == eLang - ? LANGUAGE_SYSTEM : eLang; - - CharClass aCharClass( SvxCreateLocale( eLng ) ); - String aCharString; - - while( nPos < nTxtLen ) - { - // Erst kommen die Upper-Chars dran - - // 4251: Es gibt Zeichen, die Upper _und_ Lower sind (z.B. das Blank). - // Solche Zweideutigkeiten fuehren ins Chaos, deswegen werden diese - // Zeichen der Menge Lower zugeordnet ! - - while( nPos < nTxtLen ) - { - aCharString = rTxt.GetChar( nPos + nIdx ); - sal_Int32 nCharacterType = aCharClass.getCharacterType( aCharString, 0 ); - if ( nCharacterType & ::com::sun::star::i18n::KCharacterType::LOWER ) - break; - if ( ! ( nCharacterType & ::com::sun::star::i18n::KCharacterType::UPPER ) ) - break; - ++nPos; - } - if( nOldPos != nPos ) - { - if(bCaseMapLengthDiffers) - { - // #108210# - // If strings differ work preparing the necessary snippet to address that - // potential difference - const XubString aSnippet(rTxt, nIdx + nOldPos, nPos-nOldPos); - XubString aNewText = CalcCaseMap(aSnippet); - - rDo.Do( aNewText, 0, aNewText.Len(), TRUE ); - } - else - { - rDo.Do( aTxt, nIdx + nOldPos, nPos-nOldPos, TRUE ); - } - - nOldPos = nPos; - } - // Nun werden die Lower-Chars verarbeitet (ohne Blanks) - while( nPos < nTxtLen ) - { - sal_uInt32 nCharacterType = aCharClass.getCharacterType( aCharString, 0 ); - if ( ( nCharacterType & ::com::sun::star::i18n::KCharacterType::UPPER ) ) - break; - if ( CH_BLANK == aCharString ) - break; - if( ++nPos < nTxtLen ) - aCharString = rTxt.GetChar( nPos + nIdx ); - } - if( nOldPos != nPos ) - { - if(bCaseMapLengthDiffers) - { - // #108210# - // If strings differ work preparing the necessary snippet to address that - // potential difference - const XubString aSnippet(rTxt, nIdx + nOldPos, nPos - nOldPos); - XubString aNewText = CalcCaseMap(aSnippet); - - rDo.Do( aNewText, 0, aNewText.Len(), FALSE ); - } - else - { - rDo.Do( aTxt, nIdx + nOldPos, nPos-nOldPos, FALSE ); - } - - nOldPos = nPos; - } - // Nun werden die Blanks verarbeitet - while( nPos < nTxtLen && CH_BLANK == aCharString && ++nPos < nTxtLen ) - aCharString = rTxt.GetChar( nPos + nIdx ); - - if( nOldPos != nPos ) - { - rDo.DoSpace( FALSE ); - - if(bCaseMapLengthDiffers) - { - // #108210# - // If strings differ work preparing the necessary snippet to address that - // potential difference - const XubString aSnippet(rTxt, nIdx + nOldPos, nPos - nOldPos); - XubString aNewText = CalcCaseMap(aSnippet); - - rDo.Do( aNewText, 0, aNewText.Len(), FALSE ); - } - else - { - rDo.Do( aTxt, nIdx + nOldPos, nPos - nOldPos, FALSE ); - } - - nOldPos = nPos; - rDo.SetSpace(); - } - } - rDo.DoSpace( TRUE ); -} - -/************************************************************************** - * SvxFont::SetPhysFont() - *************************************************************************/ - -void SvxFont::SetPhysFont( OutputDevice *pOut ) const -{ - const Font& rCurrentFont = pOut->GetFont(); - if ( nPropr == 100 ) - { - if ( !rCurrentFont.IsSameInstance( *this ) ) - pOut->SetFont( *this ); - } - else - { - Font aNewFont( *this ); - Size aSize( aNewFont.GetSize() ); - aNewFont.SetSize( Size( aSize.Width() * nPropr / 100L, - aSize.Height() * nPropr / 100L ) ); - if ( !rCurrentFont.IsSameInstance( aNewFont ) ) - pOut->SetFont( aNewFont ); - } -} - -/************************************************************************* - * SvxFont::ChgPhysFont() - *************************************************************************/ - -Font SvxFont::ChgPhysFont( OutputDevice *pOut ) const -{ - Font aOldFont( pOut->GetFont() ); - SetPhysFont( pOut ); - return aOldFont; -} - -/************************************************************************* - * SvxFont::GetPhysTxtSize() - *************************************************************************/ - -Size SvxFont::GetPhysTxtSize( const OutputDevice *pOut, const XubString &rTxt, - const xub_StrLen nIdx, const xub_StrLen nLen ) const -{ - if ( !IsCaseMap() && !IsKern() ) - return Size( pOut->GetTextWidth( rTxt, nIdx, nLen ), - pOut->GetTextHeight() ); - - Size aTxtSize; - aTxtSize.setHeight( pOut->GetTextHeight() ); - if ( !IsCaseMap() ) - aTxtSize.setWidth( pOut->GetTextWidth( rTxt, nIdx, nLen ) ); - else - { - // #108210# - const XubString aNewText = CalcCaseMap(rTxt); - sal_Bool bCaseMapLengthDiffers(aNewText.Len() != rTxt.Len()); - sal_Int32 nWidth(0L); - - if(bCaseMapLengthDiffers) - { - // If strings differ work preparing the necessary snippet to address that - // potential difference - const XubString aSnippet(rTxt, nIdx, nLen); - XubString _aNewText = CalcCaseMap(aSnippet); - nWidth = pOut->GetTextWidth( _aNewText, 0, _aNewText.Len() ); - } - else - { - nWidth = pOut->GetTextWidth( aNewText, nIdx, nLen ); - } - - aTxtSize.setWidth(nWidth); - } - - if( IsKern() && ( nLen > 1 ) ) - aTxtSize.Width() += ( ( nLen-1 ) * long( nKern ) ); - - return aTxtSize; -} - -Size SvxFont::GetPhysTxtSize( const OutputDevice *pOut, const XubString &rTxt ) -{ - if ( !IsCaseMap() && !IsKern() ) - return Size( pOut->GetTextWidth( rTxt ), pOut->GetTextHeight() ); - - Size aTxtSize; - aTxtSize.setHeight( pOut->GetTextHeight() ); - if ( !IsCaseMap() ) - aTxtSize.setWidth( pOut->GetTextWidth( rTxt ) ); - else - aTxtSize.setWidth( pOut->GetTextWidth( CalcCaseMap( rTxt ) ) ); - - if( IsKern() && ( rTxt.Len() > 1 ) ) - aTxtSize.Width() += ( ( rTxt.Len()-1 ) * long( nKern ) ); - - return aTxtSize; -} - -Size SvxFont::QuickGetTextSize( const OutputDevice *pOut, const XubString &rTxt, - const USHORT nIdx, const USHORT nLen, sal_Int32* pDXArray ) const -{ - if ( !IsCaseMap() && !IsKern() ) - return Size( pOut->GetTextArray( rTxt, pDXArray, nIdx, nLen ), - pOut->GetTextHeight() ); - - Size aTxtSize; - aTxtSize.setHeight( pOut->GetTextHeight() ); - if ( !IsCaseMap() ) - aTxtSize.setWidth( pOut->GetTextArray( rTxt, pDXArray, nIdx, nLen ) ); - else - aTxtSize.setWidth( pOut->GetTextArray( CalcCaseMap( rTxt ), - pDXArray, nIdx, nLen ) ); - - if( IsKern() && ( nLen > 1 ) ) - { - aTxtSize.Width() += ( ( nLen-1 ) * long( nKern ) ); - - if ( pDXArray ) - { - for ( xub_StrLen i = 0; i < nLen; i++ ) - pDXArray[i] += ( (i+1) * long( nKern ) ); - // Der letzte ist um ein nKern zu gross: - pDXArray[nLen-1] -= nKern; - } - } - return aTxtSize; -} - -/************************************************************************* - * SvxFont::GetTxtSize() - *************************************************************************/ - -Size SvxFont::GetTxtSize( const OutputDevice *pOut, const XubString &rTxt, - const xub_StrLen nIdx, const xub_StrLen nLen ) -{ - xub_StrLen nTmp = nLen; - if ( nTmp == STRING_LEN ) // schon initialisiert? - nTmp = rTxt.Len(); - Font aOldFont( ChgPhysFont((OutputDevice *)pOut) ); - Size aTxtSize; - if( IsCapital() && rTxt.Len() ) - { - aTxtSize = GetCapitalSize( pOut, rTxt, nIdx, nTmp ); - } - else aTxtSize = GetPhysTxtSize(pOut,rTxt,nIdx,nTmp); - ((OutputDevice *)pOut)->SetFont( aOldFont ); - return aTxtSize; -} - -/************************************************************************* - * SvxFont::DrawText() - *************************************************************************/ - -void SvxFont::DrawText( OutputDevice *pOut, - const Point &rPos, const XubString &rTxt, - const xub_StrLen nIdx, const xub_StrLen nLen ) const -{ - if( !nLen || !rTxt.Len() ) return; - xub_StrLen nTmp = nLen; - if ( nTmp == STRING_LEN ) // schon initialisiert? - nTmp = rTxt.Len(); - Point aPos( rPos ); - if ( nEsc ) - { - Size aSize = (this->GetSize()); - aPos.Y() -= ((nEsc*long(aSize.Height()))/ 100L); - } - Font aOldFont( ChgPhysFont( pOut ) ); - - if ( IsCapital() ) - DrawCapital( pOut, aPos, rTxt, nIdx, nTmp ); - else - { - Size aSize = GetPhysTxtSize( pOut, rTxt, nIdx, nTmp ); - - if ( !IsCaseMap() ) - pOut->DrawStretchText( aPos, aSize.Width(), rTxt, nIdx, nTmp ); - else - pOut->DrawStretchText( aPos, aSize.Width(), CalcCaseMap( rTxt ), - nIdx, nTmp ); - } - pOut->SetFont(aOldFont); -} - -void SvxFont::QuickDrawText( OutputDevice *pOut, - const Point &rPos, const XubString &rTxt, - const xub_StrLen nIdx, const xub_StrLen nLen, const sal_Int32* pDXArray ) const -{ - // Font muss ins OutputDevice selektiert sein... - if ( !IsCaseMap() && !IsCapital() && !IsKern() && !IsEsc() ) - { - pOut->DrawTextArray( rPos, rTxt, pDXArray, nIdx, nLen ); - return; - } - - Point aPos( rPos ); - - if ( nEsc ) - { - long nDiff = GetSize().Height(); - nDiff *= nEsc; - nDiff /= 100; - - if ( !IsVertical() ) - aPos.Y() -= nDiff; - else - aPos.X() += nDiff; - } - - if( IsCapital() ) - { - DBG_ASSERT( !pDXArray, "DrawCapital nicht fuer TextArray!" ); - DrawCapital( pOut, aPos, rTxt, nIdx, nLen ); - } - else - { - if ( IsKern() && !pDXArray ) - { - Size aSize = GetPhysTxtSize( pOut, rTxt, nIdx, nLen ); - - if ( !IsCaseMap() ) - pOut->DrawStretchText( aPos, aSize.Width(), rTxt, nIdx, nLen ); - else - pOut->DrawStretchText( aPos, aSize.Width(), CalcCaseMap( rTxt ), nIdx, nLen ); - } - else - { - if ( !IsCaseMap() ) - pOut->DrawTextArray( aPos, rTxt, pDXArray, nIdx, nLen ); - else - pOut->DrawTextArray( aPos, CalcCaseMap( rTxt ), pDXArray, nIdx, nLen ); - } - } -} - -// ----------------------------------------------------------------------- - -void SvxFont::DrawPrev( OutputDevice *pOut, Printer* pPrinter, - const Point &rPos, const XubString &rTxt, - const xub_StrLen nIdx, const xub_StrLen nLen ) const -{ - if ( !nLen || !rTxt.Len() ) - return; - xub_StrLen nTmp = nLen; - - if ( nTmp == STRING_LEN ) // schon initialisiert? - nTmp = rTxt.Len(); - Point aPos( rPos ); - - if ( nEsc ) - { - short nTmpEsc; - if( DFLT_ESC_AUTO_SUPER == nEsc ) - nTmpEsc = 33; - else if( DFLT_ESC_AUTO_SUB == nEsc ) - nTmpEsc = -20; - else - nTmpEsc = nEsc; - Size aSize = ( this->GetSize() ); - aPos.Y() -= ( ( nTmpEsc * long( aSize.Height() ) ) / 100L ); - } - Font aOldFont( ChgPhysFont( pOut ) ); - Font aOldPrnFont( ChgPhysFont( pPrinter ) ); - - if ( IsCapital() ) - DrawCapital( pOut, aPos, rTxt, nIdx, nTmp ); - else - { - Size aSize = GetPhysTxtSize( pPrinter, rTxt, nIdx, nTmp ); - - if ( !IsCaseMap() ) - pOut->DrawStretchText( aPos, aSize.Width(), rTxt, nIdx, nTmp ); - else - { - // #108210# - const XubString aNewText = CalcCaseMap(rTxt); - sal_Bool bCaseMapLengthDiffers(aNewText.Len() != rTxt.Len()); - - if(bCaseMapLengthDiffers) - { - // If strings differ work preparing the necessary snippet to address that - // potential difference - const XubString aSnippet(rTxt, nIdx, nTmp); - XubString _aNewText = CalcCaseMap(aSnippet); - - pOut->DrawStretchText( aPos, aSize.Width(), _aNewText, 0, _aNewText.Len() ); - } - else - { - pOut->DrawStretchText( aPos, aSize.Width(), CalcCaseMap( rTxt ), nIdx, nTmp ); - } - } - } - pOut->SetFont(aOldFont); - pPrinter->SetFont( aOldPrnFont ); -} - -// ----------------------------------------------------------------------- - -SvxFont& SvxFont::operator=( const Font& rFont ) -{ - Font::operator=( rFont ); - return *this; -} - -SvxFont& SvxFont::operator=( const SvxFont& rFont ) -{ - Font::operator=( rFont ); - eLang = rFont.eLang; - eCaseMap = rFont.eCaseMap; - nEsc = rFont.nEsc; - nPropr = rFont.nPropr; - nKern = rFont.nKern; - return *this; -} - - -/************************************************************************* - * class SvxDoGetCapitalSize - * wird von SvxFont::GetCapitalSize() zur Berechnung der TxtSize bei - * eingestellten Kapitaelchen benutzt. - *************************************************************************/ - -class SvxDoGetCapitalSize : public SvxDoCapitals -{ -protected: - SvxFont* pFont; - Size aTxtSize; - short nKern; -public: - SvxDoGetCapitalSize( SvxFont *_pFnt, const OutputDevice *_pOut, - const XubString &_rTxt, const xub_StrLen _nIdx, - const xub_StrLen _nLen, const short _nKrn ) - : SvxDoCapitals( (OutputDevice*)_pOut, _rTxt, _nIdx, _nLen ), - pFont( _pFnt ), - nKern( _nKrn ) - { } - - virtual void Do( const XubString &rTxt, const xub_StrLen nIdx, - const xub_StrLen nLen, const BOOL bUpper ); - - inline const Size &GetSize() const { return aTxtSize; }; -}; - -void SvxDoGetCapitalSize::Do( const XubString &_rTxt, const xub_StrLen _nIdx, - const xub_StrLen _nLen, const BOOL bUpper ) -{ - Size aPartSize; - if ( !bUpper ) - { - BYTE nProp = pFont->GetPropr(); - pFont->SetProprRel( KAPITAELCHENPROP ); - pFont->SetPhysFont( pOut ); - aPartSize.setWidth( pOut->GetTextWidth( _rTxt, _nIdx, _nLen ) ); - aPartSize.setHeight( pOut->GetTextHeight() ); - aTxtSize.Height() = aPartSize.Height(); - pFont->SetPropr( nProp ); - pFont->SetPhysFont( pOut ); - } - else - { - aPartSize.setWidth( pOut->GetTextWidth( _rTxt, _nIdx, _nLen ) ); - aPartSize.setHeight( pOut->GetTextHeight() ); - } - aTxtSize.Width() += aPartSize.Width(); - aTxtSize.Width() += ( _nLen * long( nKern ) ); -} - -/************************************************************************* - * SvxFont::GetCapitalSize() - * berechnet TxtSize, wenn Kapitaelchen eingestellt sind. - *************************************************************************/ - -Size SvxFont::GetCapitalSize( const OutputDevice *pOut, const XubString &rTxt, - const xub_StrLen nIdx, const xub_StrLen nLen) const -{ - // Start: - SvxDoGetCapitalSize aDo( (SvxFont *)this, pOut, rTxt, nIdx, nLen, nKern ); - DoOnCapitals( aDo ); - Size aTxtSize( aDo.GetSize() ); - - // End: - if( !aTxtSize.Height() ) - { - aTxtSize.setWidth( 0 ); - aTxtSize.setHeight( pOut->GetTextHeight() ); - } - return aTxtSize; -} - -/************************************************************************* - * class SvxDoDrawCapital - * wird von SvxFont::DrawCapital zur Ausgabe von Kapitaelchen benutzt. - *************************************************************************/ - -class SvxDoDrawCapital : public SvxDoCapitals -{ -protected: - SvxFont *pFont; - Point aPos; - Point aSpacePos; - short nKern; -public: - SvxDoDrawCapital( SvxFont *pFnt, OutputDevice *_pOut, const XubString &_rTxt, - const xub_StrLen _nIdx, const xub_StrLen _nLen, - const Point &rPos, const short nKrn ) - : SvxDoCapitals( _pOut, _rTxt, _nIdx, _nLen ), - pFont( pFnt ), - aPos( rPos ), - aSpacePos( rPos ), - nKern( nKrn ) - { } - virtual void DoSpace( const BOOL bDraw ); - virtual void SetSpace(); - virtual void Do( const XubString &rTxt, const xub_StrLen nIdx, - const xub_StrLen nLen, const BOOL bUpper ); -}; - -void SvxDoDrawCapital::DoSpace( const BOOL bDraw ) -{ - if ( bDraw || pFont->IsWordLineMode() ) - { - USHORT nDiff = (USHORT)(aPos.X() - aSpacePos.X()); - if ( nDiff ) - { - BOOL bWordWise = pFont->IsWordLineMode(); - BOOL bTrans = pFont->IsTransparent(); - pFont->SetWordLineMode( FALSE ); - pFont->SetTransparent( TRUE ); - pFont->SetPhysFont( pOut ); - pOut->DrawStretchText( aSpacePos, nDiff, XubString( sDoubleSpace, - RTL_TEXTENCODING_MS_1252 ), 0, 2 ); - pFont->SetWordLineMode( bWordWise ); - pFont->SetTransparent( bTrans ); - pFont->SetPhysFont( pOut ); - } - } -} - -void SvxDoDrawCapital::SetSpace() -{ - if ( pFont->IsWordLineMode() ) - aSpacePos.X() = aPos.X(); -} - -void SvxDoDrawCapital::Do( const XubString &_rTxt, const xub_StrLen _nIdx, - const xub_StrLen _nLen, const BOOL bUpper) -{ - BYTE nProp = 0; - Size aPartSize; - - // Einstellen der gewuenschten Fonts - FontUnderline eUnder = pFont->GetUnderline(); - FontStrikeout eStrike = pFont->GetStrikeout(); - pFont->SetUnderline( UNDERLINE_NONE ); - pFont->SetStrikeout( STRIKEOUT_NONE ); - if ( !bUpper ) - { - nProp = pFont->GetPropr(); - pFont->SetProprRel( KAPITAELCHENPROP ); - } - pFont->SetPhysFont( pOut ); - - aPartSize.setWidth( pOut->GetTextWidth( _rTxt, _nIdx, _nLen ) ); - aPartSize.setHeight( pOut->GetTextHeight() ); - long nWidth = aPartSize.Width(); - if ( nKern ) - { - aPos.X() += (nKern/2); - if ( _nLen ) nWidth += (_nLen*long(nKern)); - } - pOut->DrawStretchText(aPos,nWidth-nKern,_rTxt,_nIdx,_nLen); - - // Font restaurieren - pFont->SetUnderline( eUnder ); - pFont->SetStrikeout( eStrike ); - if ( !bUpper ) - pFont->SetPropr( nProp ); - pFont->SetPhysFont( pOut ); - - aPos.X() += nWidth-(nKern/2); -} - -/************************************************************************* - * SvxFont::DrawCapital() gibt Kapitaelchen aus. - *************************************************************************/ - -void SvxFont::DrawCapital( OutputDevice *pOut, - const Point &rPos, const XubString &rTxt, - const xub_StrLen nIdx, const xub_StrLen nLen ) const -{ - SvxDoDrawCapital aDo( (SvxFont *)this,pOut,rTxt,nIdx,nLen,rPos,nKern ); - DoOnCapitals( aDo ); -} - -#endif // !REDUCEDSVXFONT - - diff --git a/svx/source/items/svxitems.src b/svx/source/items/svxitems.src index d5188bdde22f..5faaf1cb31f0 100644 --- a/svx/source/items/svxitems.src +++ b/svx/source/items/svxitems.src @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: svxitems.src,v $ - * $Revision: 1.83.212.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -28,19 +25,78 @@ * ************************************************************************/ // include ------------------------------------------------------------------ + #include <svx/svxitems.hrc> - // pragma ------------------------------------------------------------------- +#include <svx/svxids.hrc> +#include <editeng/editids.hrc> - // Value-Strings ------------------------------------------------------------ -String RID_SVXITEMS_TRUE -{ - Text [ en-US ] = "True" ; +StringArray RID_ATTR_NAMES +{ + ItemList = + { + < "Scale" ; SID_ATTR_ZOOM ; > ; + < "Brush" ; SID_ATTR_BRUSH ; > ; + < "Tab stops" ; SID_ATTR_TABSTOP ; > ; + < "Character" ; SID_ATTR_CHAR ; > ; + < "Font" ; SID_ATTR_CHAR_FONT ; > ; + < "Font posture" ; SID_ATTR_CHAR_POSTURE ; > ; + < "Font weight" ; SID_ATTR_CHAR_WEIGHT ; > ; + < "Shadowed" ; SID_ATTR_CHAR_SHADOWED ; > ; + < "Individual words" ; SID_ATTR_CHAR_WORDLINEMODE ; > ; + < "Outline" ; SID_ATTR_CHAR_CONTOUR ; > ; + < "Strikethrough" ; SID_ATTR_CHAR_STRIKEOUT ; > ; + < "Underline" ; SID_ATTR_CHAR_UNDERLINE ; > ; + < "Font size" ; SID_ATTR_CHAR_FONTHEIGHT ; > ; + < "Rel. Font size" ; SID_ATTR_CHAR_PROPSIZE ; > ; + < "Font color" ; SID_ATTR_CHAR_COLOR ; > ; + < "Kerning" ; SID_ATTR_CHAR_KERNING ; > ; + < "Effects" ; SID_ATTR_CHAR_CASEMAP ; > ; + < "Language"; SID_ATTR_CHAR_LANGUAGE ; > ; + < "Position" ; SID_ATTR_CHAR_ESCAPEMENT ; > ; + < "Blinking" ; SID_ATTR_CHAR_AUTOKERN ; > ; + < "Character set color" ; SID_ATTR_CHAR_CHARSETCOLOR ; > ; + < "Overline" ; SID_ATTR_CHAR_OVERLINE ; > ; + < "Paragraph" ; SID_ATTR_PARA ; > ; + < "Alignment" ; SID_ATTR_PARA_ADJUST ; > ; + < "Line spacing" ; SID_ATTR_PARA_LINESPACE ; > ; + < "Page Break" ; SID_ATTR_PARA_PAGEBREAK ; > ; + < "Hyphenation" ; SID_ATTR_PARA_HYPHENZONE ; > ; + < "Do not split paragraph"; SID_ATTR_PARA_SPLIT ; > ; + < "Orphans" ; SID_ATTR_PARA_ORPHANS ; > ; + < "Widows" ; SID_ATTR_PARA_WIDOWS ; > ; + < "Spacing" ; SID_ATTR_PARA_ULSPACE ; > ; + < "Indent" ; SID_ATTR_PARA_LRSPACE ; > ; + < "Indent" ; SID_ATTR_LRSPACE ; > ; + < "Spacing" ; SID_ATTR_ULSPACE ; > ; + < "Page" ; SID_ATTR_PAGE ; > ; + < "Page Style" ; SID_ATTR_PARA_MODEL ; > ; + < "Keep with next paragraph"; SID_ATTR_PARA_KEEP ; > ; + < "Blinking" ; SID_ATTR_FLASH ; > ; + < "Register-true" ; SID_ATTR_PARA_REGISTER ; > ; + < "Character background" ; SID_ATTR_BRUSH_CHAR ; > ; + < "Asian font" ; SID_ATTR_CHAR_CJK_FONT ; > ; + < "Size of Asian font" ; SID_ATTR_CHAR_CJK_FONTHEIGHT ; > ; + < "Language of Asian font"; SID_ATTR_CHAR_CJK_LANGUAGE ; > ; + < "Posture of Asian font" ; SID_ATTR_CHAR_CJK_POSTURE ; > ; + < "Weight of Asian font" ; SID_ATTR_CHAR_CJK_WEIGHT ; > ; + < "CTL" ; SID_ATTR_CHAR_CTL_FONT ; > ; + < "Size of complex scripts" ; SID_ATTR_CHAR_CTL_FONTHEIGHT ; > ; + < "Language of complex scripts";SID_ATTR_CHAR_CTL_LANGUAGE ; > ; + < "Posture of complex scripts"; SID_ATTR_CHAR_CTL_POSTURE ; > ; + < "Weight of complex scripts"; SID_ATTR_CHAR_CTL_WEIGHT ; > ; + < "Double-lined" ; SID_ATTR_CHAR_TWO_LINES ; > ; + < "Emphasis mark" ; SID_ATTR_CHAR_EMPHASISMARK ; > ; + < "Text spacing" ; SID_ATTR_PARA_SCRIPTSPACE ; > ; + < "Hanging punctuation" ; SID_ATTR_PARA_HANGPUNCTUATION ; > ; + < "Forbidden characters" ; SID_ATTR_PARA_FORBIDDEN_RULES ; > ; + < "Rotation" ; SID_ATTR_CHAR_ROTATED ; > ; + < "Scale" ; SID_ATTR_CHAR_SCALEWIDTH ; > ; + < "Relief" ; SID_ATTR_CHAR_RELIEF ; > ; + < "Vertical text alignment" ; SID_PARA_VERTALIGN ; > ; + }; }; -String RID_SVXITEMS_FALSE -{ - Text [ en-US ] = "False" ; -}; - // Extras ------------------------------------------------------------------- + + String RID_SVXITEMS_EXTRAS_CHARCOLOR { Text [ en-US ] = "Font color" ; @@ -110,56 +166,6 @@ String RID_SVXITEMS_SEARCHAPP_BASE { Text = "StarBase" ; }; - // enum SvxBreak ------------------------------------------------------------ -String RID_SVXITEMS_BREAK_NONE -{ - Text [ en-US ] = "No break" ; -}; -String RID_SVXITEMS_BREAK_COLUMN_BEFORE -{ - Text [ en-US ] = "Break before new column" ; -}; -String RID_SVXITEMS_BREAK_COLUMN_AFTER -{ - Text [ en-US ] = "Break after new column" ; -}; -String RID_SVXITEMS_BREAK_COLUMN_BOTH -{ - Text [ en-US ] = "Break before and after new column" ; -}; -String RID_SVXITEMS_BREAK_PAGE_BEFORE -{ - Text [ en-US ] = "Break before new page" ; -}; -String RID_SVXITEMS_BREAK_PAGE_AFTER -{ - Text [ en-US ] = "Break after new page" ; -}; -String RID_SVXITEMS_BREAK_PAGE_BOTH -{ - Text [ en-US ] = "Break before and after new page" ; -}; - // enum SvxShadowLocation --------------------------------------------------- -String RID_SVXITEMS_SHADOW_NONE -{ - Text [ en-US ] = "No Shadow" ; -}; -String RID_SVXITEMS_SHADOW_TOPLEFT -{ - Text [ en-US ] = "Shadow top left" ; -}; -String RID_SVXITEMS_SHADOW_TOPRIGHT -{ - Text [ en-US ] = "Shadow top right" ; -}; -String RID_SVXITEMS_SHADOW_BOTTOMLEFT -{ - Text [ en-US ] = "Shadow bottom left" ; -}; -String RID_SVXITEMS_SHADOW_BOTTOMRIGHT -{ - Text [ en-US ] = "Shadow bottom right" ; -}; // enum BrushStyle ---------------------------------------------------------- String RID_SVXITEMS_BRUSHSTYLE_NULL { @@ -209,917 +215,7 @@ String RID_SVXITEMS_BRUSHSTYLE_BITMAP { Text [ en-US ] = "Image" ; }; - // enum ColorName ----------------------------------------------------------- -String RID_SVXITEMS_COLOR -{ - Text [ en-US ] = "Color " ; -}; -String RID_SVXITEMS_COLOR_BLACK -{ - Text [ en-US ] = "Black" ; -}; -String RID_SVXITEMS_COLOR_BLUE -{ - Text [ en-US ] = "Blue" ; -}; -String RID_SVXITEMS_COLOR_GREEN -{ - Text [ en-US ] = "Green" ; -}; -String RID_SVXITEMS_COLOR_CYAN -{ - Text [ en-US ] = "Cyan" ; -}; -String RID_SVXITEMS_COLOR_RED -{ - Text [ en-US ] = "Red" ; -}; -String RID_SVXITEMS_COLOR_MAGENTA -{ - Text [ en-US ] = "Magenta" ; -}; -String RID_SVXITEMS_COLOR_BROWN -{ - Text [ en-US ] = "Brown" ; -}; -String RID_SVXITEMS_COLOR_GRAY -{ - Text [ en-US ] = "Gray" ; -}; -String RID_SVXITEMS_COLOR_LIGHTGRAY -{ - Text [ en-US ] = "Light Gray" ; -}; -String RID_SVXITEMS_COLOR_LIGHTBLUE -{ - Text [ en-US ] = "Light Blue" ; -}; -String RID_SVXITEMS_COLOR_LIGHTGREEN -{ - Text [ en-US ] = "Light Green" ; -}; -String RID_SVXITEMS_COLOR_LIGHTCYAN -{ - Text [ en-US ] = "Light Cyan" ; -}; -String RID_SVXITEMS_COLOR_LIGHTRED -{ - Text [ en-US ] = "Light Red" ; -}; -String RID_SVXITEMS_COLOR_LIGHTMAGENTA -{ - Text [ en-US ] = "Light Magenta" ; -}; -String RID_SVXITEMS_COLOR_YELLOW -{ - Text [ en-US ] = "Yellow" ; -}; -String RID_SVXITEMS_COLOR_WHITE -{ - Text [ en-US ] = "White" ; -}; -String RID_SVXITEMS_COLOR_MENUBAR -{ - Text = "?" ; -}; -String RID_SVXITEMS_COLOR_MENUBARTEXT -{ - Text = "?" ; -}; -String RID_SVXITEMS_COLOR_POPUPMENU -{ - Text = "?" ; -}; -String RID_SVXITEMS_COLOR_POPUPMENUTEXT -{ - Text = "?" ; -}; -String RID_SVXITEMS_COLOR_WINDOWTEXT -{ - Text = "?" ; -}; -String RID_SVXITEMS_COLOR_WINDOWWORKSPACE -{ - Text = "?" ; -}; -String RID_SVXITEMS_COLOR_HIGHLIGHT -{ - Text = "?" ; -}; -String RID_SVXITEMS_COLOR_HIGHLIGHTTEXT -{ - Text = "?" ; -}; -String RID_SVXITEMS_COLOR_3DTEXT -{ - Text = "?" ; -}; -String RID_SVXITEMS_COLOR_3DFACE -{ - Text = "?" ; -}; -String RID_SVXITEMS_COLOR_3DLIGHT -{ - Text = "?" ; -}; -String RID_SVXITEMS_COLOR_3DSHADOW -{ - Text = "?" ; -}; -String RID_SVXITEMS_COLOR_SCROLLBAR -{ - Text = "?" ; -}; -String RID_SVXITEMS_COLOR_FIELD -{ - Text = "?" ; -}; -String RID_SVXITEMS_COLOR_FIELDTEXT -{ - Text = "?" ; -}; - // enum FontItalic ------------------------------------------------------- -String RID_SVXITEMS_ITALIC_NONE -{ - Text [ en-US ] = "Not Italic" ; -}; -String RID_SVXITEMS_ITALIC_OBLIQUE -{ - Text [ en-US ] = "Oblique italic" ; -}; -String RID_SVXITEMS_ITALIC_NORMAL -{ - Text [ en-US ] = "Italic" ; -}; - // enum FontWeight ------------------------------------------------------- -String RID_SVXITEMS_WEIGHT_DONTKNOW -{ - Text = "?" ; -}; -String RID_SVXITEMS_WEIGHT_THIN -{ - Text [ en-US ] = "thin" ; -}; -String RID_SVXITEMS_WEIGHT_ULTRALIGHT -{ - Text [ en-US ] = "ultra thin" ; -}; -String RID_SVXITEMS_WEIGHT_LIGHT -{ - Text [ en-US ] = "light" ; -}; -String RID_SVXITEMS_WEIGHT_SEMILIGHT -{ - Text [ en-US ] = "semi light" ; -}; -String RID_SVXITEMS_WEIGHT_NORMAL -{ - Text [ en-US ] = "normal" ; -}; -String RID_SVXITEMS_WEIGHT_MEDIUM -{ - Text [ en-US ] = "medium" ; -}; -String RID_SVXITEMS_WEIGHT_SEMIBOLD -{ - Text [ en-US ] = "semi bold" ; -}; -String RID_SVXITEMS_WEIGHT_BOLD -{ - Text [ en-US ] = "bold" ; -}; -String RID_SVXITEMS_WEIGHT_ULTRABOLD -{ - Text [ en-US ] = "ultra bold" ; -}; -String RID_SVXITEMS_WEIGHT_BLACK -{ - Text [ en-US ] = "black" ; -}; - // enum FontUnderline - used for underline ------------------------------ -String RID_SVXITEMS_UL_NONE -{ - Text [ en-US ] = "No underline" ; -}; -String RID_SVXITEMS_UL_SINGLE -{ - Text [ en-US ] = "Single underline" ; -}; -String RID_SVXITEMS_UL_DOUBLE -{ - Text [ en-US ] = "Double underline" ; -}; -String RID_SVXITEMS_UL_DOTTED -{ - Text [ en-US ] = "Dotted underline" ; -}; -String RID_SVXITEMS_UL_DONTKNOW -{ - Text [ en-US ] = "Underline"; -}; -String RID_SVXITEMS_UL_DASH -{ - Text [ en-US ] = "Underline (dashes)"; -}; -String RID_SVXITEMS_UL_LONGDASH -{ - Text [ en-US ] = "Underline (long dashes)"; -}; -String RID_SVXITEMS_UL_DASHDOT -{ - Text [ en-US ] = "Underline (dot dash)"; -}; -String RID_SVXITEMS_UL_DASHDOTDOT -{ - Text [ en-US ] = "Underline (dot dot dash)"; -}; -String RID_SVXITEMS_UL_SMALLWAVE -{ - Text [ en-US ] = "Underline (small wave)"; -}; -String RID_SVXITEMS_UL_WAVE -{ - Text [ en-US ] = "Underline (Wave)"; -}; -String RID_SVXITEMS_UL_DOUBLEWAVE -{ - Text [ en-US ] = "Underline (Double wave)"; -}; -String RID_SVXITEMS_UL_BOLD -{ - Text [ en-US ] = "Underlined (Bold)"; -}; -String RID_SVXITEMS_UL_BOLDDOTTED -{ - Text [ en-US ] = "Dotted underline (Bold)"; -}; -String RID_SVXITEMS_UL_BOLDDASH -{ - Text [ en-US ] = "Underline (Dash bold)"; -}; -String RID_SVXITEMS_UL_BOLDLONGDASH -{ - Text [ en-US ] = "Underline (long dash, bold)"; -}; -String RID_SVXITEMS_UL_BOLDDASHDOT -{ - Text [ en-US ] = "Underline (dot dash, bold)"; -}; -String RID_SVXITEMS_UL_BOLDDASHDOTDOT -{ - Text [ en-US ] = "Underline (dot dot dash, bold)"; -}; -String RID_SVXITEMS_UL_BOLDWAVE -{ - Text [ en-US ] = "Underline (wave, bold)"; -}; - // enum FontUnderline - used for overline ------------------------------- -String RID_SVXITEMS_OL_NONE -{ - Text [ en-US ] = "No overline" ; -}; -String RID_SVXITEMS_OL_SINGLE -{ - Text [ en-US ] = "Single overline" ; -}; -String RID_SVXITEMS_OL_DOUBLE -{ - Text [ en-US ] = "Double overline" ; -}; -String RID_SVXITEMS_OL_DOTTED -{ - Text [ en-US ] = "Dotted overline" ; -}; -String RID_SVXITEMS_OL_DONTKNOW -{ - Text [ en-US ] = "Overline"; -}; -String RID_SVXITEMS_OL_DASH -{ - Text [ en-US ] = "Overline (dashes)"; -}; -String RID_SVXITEMS_OL_LONGDASH -{ - Text [ en-US ] = "Overline (long dashes)"; -}; -String RID_SVXITEMS_OL_DASHDOT -{ - Text [ en-US ] = "Overline (dot dash)"; -}; -String RID_SVXITEMS_OL_DASHDOTDOT -{ - Text [ en-US ] = "Overline (dot dot dash)"; -}; -String RID_SVXITEMS_OL_SMALLWAVE -{ - Text [ en-US ] = "Overline (small wave)"; -}; -String RID_SVXITEMS_OL_WAVE -{ - Text [ en-US ] = "Overline (Wave)"; -}; -String RID_SVXITEMS_OL_DOUBLEWAVE -{ - Text [ en-US ] = "Overline (Double wave)"; -}; -String RID_SVXITEMS_OL_BOLD -{ - Text [ en-US ] = "Overlined (Bold)"; -}; -String RID_SVXITEMS_OL_BOLDDOTTED -{ - Text [ en-US ] = "Dotted overline (Bold)"; -}; -String RID_SVXITEMS_OL_BOLDDASH -{ - Text [ en-US ] = "Overline (Dash bold)"; -}; -String RID_SVXITEMS_OL_BOLDLONGDASH -{ - Text [ en-US ] = "Overline (long dash, bold)"; -}; -String RID_SVXITEMS_OL_BOLDDASHDOT -{ - Text [ en-US ] = "Overline (dot dash, bold)"; -}; -String RID_SVXITEMS_OL_BOLDDASHDOTDOT -{ - Text [ en-US ] = "Overline (dot dot dash, bold)"; -}; -String RID_SVXITEMS_OL_BOLDWAVE -{ - Text [ en-US ] = "Overline (wave, bold)"; -}; - // enum FontStrikeout ---------------------------------------------------- -String RID_SVXITEMS_STRIKEOUT_NONE -{ - Text [ en-US ] = "No strikethrough" ; -}; -String RID_SVXITEMS_STRIKEOUT_SINGLE -{ - Text [ en-US ] = "Single strikethrough" ; -}; -String RID_SVXITEMS_STRIKEOUT_DOUBLE -{ - Text [ en-US ] = "Double strikethrough" ; -}; -String RID_SVXITEMS_STRIKEOUT_BOLD -{ - Text [ en-US ] = "Bold strikethrough"; -}; -String RID_SVXITEMS_STRIKEOUT_SLASH -{ - Text [ en-US ] = "Strike through with slash"; -}; -String RID_SVXITEMS_STRIKEOUT_X -{ - Text [ en-US ] = "Strike through with Xes"; -}; - // enum CASEMAP ---------------------------------------------------------- -String RID_SVXITEMS_CASEMAP_NONE -{ - Text [ en-US ] = "None" ; -}; -String RID_SVXITEMS_CASEMAP_VERSALIEN -{ - Text [ en-US ] = "Caps" ; -}; -String RID_SVXITEMS_CASEMAP_GEMEINE -{ - Text [ en-US ] = "Lowercase" ; -}; -String RID_SVXITEMS_CASEMAP_TITEL -{ - Text [ en-US ] = "Title" ; -}; -String RID_SVXITEMS_CASEMAP_KAPITAELCHEN -{ - Text [ en-US ] = "Small caps" ; -}; - // enum ESCAPEMENT ------------------------------------------------------- -String RID_SVXITEMS_ESCAPEMENT_OFF -{ - Text [ en-US ] = "Normal position" ; -}; -String RID_SVXITEMS_ESCAPEMENT_SUPER -{ - Text [ en-US ] = "Superscript " ; -}; -String RID_SVXITEMS_ESCAPEMENT_SUB -{ - Text [ en-US ] = "Subscript " ; -}; -String RID_SVXITEMS_ESCAPEMENT_AUTO -{ - Text [ en-US ] = "automatic" ; -}; - // enum SvxAdjust ----------------------------------------------------------- -String RID_SVXITEMS_ADJUST_LEFT -{ - Text [ en-US ] = "Align left" ; -}; -String RID_SVXITEMS_ADJUST_RIGHT -{ - Text [ en-US ] = "Align right" ; -}; -String RID_SVXITEMS_ADJUST_BLOCK -{ - Text [ en-US ] = "Justify" ; -}; -String RID_SVXITEMS_ADJUST_CENTER -{ - Text [ en-US ] = "Centered" ; -}; -String RID_SVXITEMS_ADJUST_BLOCKLINE -{ - Text [ en-US ] = "Justify" ; -}; - // enum SvxTabAdjust -------------------------------------------------------- -String RID_SVXITEMS_TAB_DECIMAL_CHAR -{ - Text [ en-US ] = "Decimal Symbol:" ; -}; -String RID_SVXITEMS_TAB_FILL_CHAR -{ - Text [ en-US ] = "Fill character:" ; -}; -String RID_SVXITEMS_TAB_ADJUST_LEFT -{ - Text [ en-US ] = "Left" ; -}; -String RID_SVXITEMS_TAB_ADJUST_RIGHT -{ - Text [ en-US ] = "Right" ; -}; -String RID_SVXITEMS_TAB_ADJUST_DECIMAL -{ - Text [ en-US ] = "Decimal" ; -}; -String RID_SVXITEMS_TAB_ADJUST_CENTER -{ - Text [ en-US ] = "Centered" ; -}; -String RID_SVXITEMS_TAB_ADJUST_DEFAULT -{ - Text [ en-US ] = "Default" ; -}; - // Typ-Namen der SlotIds ---------------------------------------------------- -String RID_ATTR_ZOOM -{ - Text [ en-US ] = "Scale" ; -}; -String RID_ATTR_BRUSH -{ - Text [ en-US ] = "Brush" ; -}; -String RID_ATTR_TABSTOP -{ - Text [ en-US ] = "Tab stops" ; -}; -String RID_ATTR_TABSTOP_DEFAULTS -{ - Text = "?" ; -}; -String RID_ATTR_TABSTOP_POS -{ - Text = "?" ; -}; -String RID_ATTR_TABSTOP_OFFSET -{ - Text = "?" ; -}; -String RID_ATTR_CHAR -{ - Text [ en-US ] = "Character" ; -}; -String RID_ATTR_CHAR_FONT -{ - Text [ en-US ] = "Font" ; -}; -String RID_ATTR_CHAR_POSTURE -{ - Text [ en-US ] = "Font posture" ; -}; -String RID_ATTR_CHAR_WEIGHT -{ - Text [ en-US ] = "Font weight" ; -}; -String RID_ATTR_CHAR_SHADOWED -{ - Text [ en-US ] = "Shadowed" ; -}; -String RID_ATTR_CHAR_WORDLINEMODE -{ - Text [ en-US ] = "Individual words" ; -}; -String RID_ATTR_CHAR_CONTOUR -{ - Text [ en-US ] = "Outline" ; -}; -String RID_ATTR_CHAR_STRIKEOUT -{ - Text [ en-US ] = "Strikethrough" ; -}; -String RID_ATTR_CHAR_UNDERLINE -{ - Text [ en-US ] = "Underline" ; -}; -String RID_ATTR_CHAR_FONTHEIGHT -{ - Text [ en-US ] = "Font size" ; -}; -String RID_ATTR_CHAR_PROPSIZE -{ - Text [ en-US ] = "Rel. Font Size" ; -}; -String RID_ATTR_CHAR_COLOR -{ - Text [ en-US ] = "Font color" ; -}; -String RID_ATTR_CHAR_KERNING -{ - Text [ en-US ] = "Kerning" ; -}; -String RID_ATTR_CHAR_CASEMAP -{ - Text [ en-US ] = "Effects" ; -}; -String RID_ATTR_CHAR_LANGUAGE -{ - Text [ en-US ] = "Language" ; -}; -String RID_ATTR_CHAR_ESCAPEMENT -{ - Text [ en-US ] = "Position" ; -}; -String RID_ATTR_CHAR_FONTLIST -{ - Text = "?" ; -}; -String RID_ATTR_CHAR_BLINK -{ - Text [ en-US ] = "Blinking" ; -}; -String RID_ATTR_CHAR_CHARSETCOLOR -{ - Text [ en-US ] = "Character set color"; -}; -String RID_ATTR_CHAR_OVERLINE -{ - Text [ en-US ] = "Overline" ; -}; -String RID_ATTR_BORDER_INNER -{ - Text = "?" ; -}; -String RID_ATTR_BORDER_OUTER -{ - Text = "?" ; -}; -String RID_ATTR_BORDER_SHADOW -{ - Text = "?" ; -}; -String RID_ATTR_PARA -{ - Text [ en-US ] = "Paragraph" ; -}; -String RID_ATTR_PARA_ADJUST -{ - Text [ en-US ] = "Alignment" ; -}; -String RID_ATTR_PARA_ADJUST_LEFT -{ - Text = "?" ; -}; -String RID_ATTR_PARA_ADJUST_RIGHT -{ - Text = "?" ; -}; -String RID_ATTR_PARA_ADJUST_CENTER -{ - Text = "?" ; -}; -String RID_ATTR_PARA_ADJUST_BLOCK -{ - Text = "?" ; -}; -String RID_ATTR_PARA_ADJUST_BLOCKLINE -{ - Text = "?" ; -}; -String RID_ATTR_PARA_LINESPACE -{ - Text [ en-US ] = "Line spacing" ; -}; -String RID_ATTR_PARA_LINESPACE_10 -{ - Text = "?" ; -}; -String RID_ATTR_PARA_LINESPACE_15 -{ - Text = "?" ; -}; -String RID_ATTR_PARA_LINESPACE_20 -{ - Text = "?" ; -}; -String RID_ATTR_PARA_PAGEBREAK -{ - Text [ en-US ] = "Page Break" ; -}; -String RID_ATTR_PARA_HYPHENZONE -{ - Text [ en-US ] = "Hyphenation" ; -}; -String RID_ATTR_PARA_SPLIT -{ - Text [ en-US ] = "Do not split paragraph" ; -}; -String RID_ATTR_PARA_WIDOWS -{ - Text [ en-US ] = "Orphans" ; -}; -String RID_ATTR_PARA_ORPHANS -{ - Text [ en-US ] = "Widows" ; -}; -String RID_ATTR_PARA_ULSPACE -{ - Text [ en-US ] = "Spacing" ; -}; -String RID_ATTR_PARA_LRSPACE -{ - Text [ en-US ] = "Indent" ; -}; -String RID_ATTR_POSTIT_AUTHOR -{ - Text = "?" ; -}; -String RID_ATTR_POSTIT_DATE -{ - Text = "?" ; -}; -String RID_ATTR_POSTIT_TEXT -{ - Text = "?" ; -}; -String RID_ATTR_SEARCH -{ - Text = "?" ; -}; -String RID_ATTR_LRSPACE -{ - Text [ en-US ] = "Indent" ; -}; -String RID_ATTR_ULSPACE -{ - Text [ en-US ] = "Spacing" ; -}; -String RID_ATTR_PAGE -{ - Text [ en-US ] = "Page" ; -}; -String RID_ATTR_PAGE_SIZE -{ - Text = "?" ; -}; -String RID_ATTR_PAGE_MAXSIZE -{ - Text = "?" ; -}; -String RID_ATTR_PAGE_PAPERTRAY -{ - Text = "?" ; -}; -String RID_ATTR_PAGE_PAPERBIN -{ - Text = "?" ; -}; -String RID_ATTR_PAGE_APP -{ - Text = "?" ; -}; -String RID_ATTR_PAGE_EXT1 -{ - Text = "?" ; -}; -String RID_ATTR_PAGE_EXT2 -{ - Text = "?" ; -}; -String RID_ATTR_PAGE_HEADERSET -{ - Text = "?" ; -}; -String RID_ATTR_PAGE_FOOTERSET -{ - Text = "?" ; -}; -String RID_ATTR_PAGE_ON -{ - Text = "?" ; -}; -String RID_ATTR_PAGE_DYNAMIC -{ - Text = "?" ; -}; -String RID_ATTR_PAGE_SHARED -{ - Text = "?" ; -}; -String RID_ATTR_PAGE_BSP -{ - Text = "?" ; -}; -String RID_ATTR_CHAR_MAPTYPE -{ - Text = "?" ; -}; -String RID_ATTR_PARA_MODEL -{ - Text [ en-US ] = "Page Style" ; -}; -String RID_ATTR_PARA_KEEP -{ - Text [ en-US ] = "Keep with next paragraph" ; -}; -String RID_ATTR_FLASH -{ - Text [ en-US ] = "Blinking" ; -}; -String RID_ATTR_PARA_REGISTER -{ - Text [ en-US ] = "Register-true" ; -}; -String RID_ATTR_BRUSH_CHAR -{ - Text [ en-US ] = "Character background"; -}; -String RID_ATTR_CHAR_CJK_FONT -{ - Text [ en-US ] = "Asian font" ; -}; -String RID_ATTR_CHAR_CJK_FONTHEIGHT -{ - Text [ en-US ] = "Size of Asian font" ; -}; -String RID_ATTR_CHAR_CJK_LANGUAGE -{ - Text [ en-US ] = "Language of Asian fonts" ; -}; -String RID_ATTR_CHAR_CJK_POSTURE -{ - Text [ en-US ] = "Posture of Asian fonts" ; -}; -String RID_ATTR_CHAR_CJK_WEIGHT -{ - Text [ en-US ] = "Weight of Asian fonts" ; -}; -String RID_ATTR_CHAR_CTL_FONT -{ - Text [ en-US ] = "CTL" ; -}; -String RID_ATTR_CHAR_CTL_FONTHEIGHT -{ - Text [ en-US ] = "Size of complex scripts" ; -}; -String RID_ATTR_CHAR_CTL_LANGUAGE -{ - Text [ en-US ] = "Language of complex scripts" ; -}; -String RID_ATTR_CHAR_CTL_POSTURE -{ - Text [ en-US ] = "Posture of complex scripts" ; -}; -String RID_ATTR_CHAR_CTL_WEIGHT -{ - Text [ en-US ] = "Weight of complex scripts" ; -}; -String RID_ATTR_CHAR_TWO_LINES -{ - Text [ en-US ] = "Double-lined" ; -}; -String RID_ATTR_CHAR_EMPHASISMARK -{ - Text [ en-US ] = "Emphasis mark" ; -}; -String RID_ATTR_PARA_SCRIPTSPACE -{ - Text [ en-US ] = "Text spacing"; -}; -String RID_ATTR_PARA_HANGPUNCTUATION -{ - Text [ en-US ] = "Hanging punctuation"; -}; -String RID_ATTR_PARA_FORBIDDEN_RULES -{ - Text [ en-US ] = "Forbidden characters"; -}; -String RID_ATTR_CHAR_ROTATED -{ - Text [ en-US ] = "Rotation" ; -}; -String RID_ATTR_CHAR_SCALEWIDTH -{ - Text [ en-US ] = "Scale" ; -}; -String RID_ATTR_CHAR_RELIEF -{ - Text [ en-US ] = "Relief"; -}; -String RID_PARA_VERTALIGN -{ - Text [ en-US ] = "Vertical text alignment"; -}; -String RID_SINGLE_LINE0 -{ - Text [ en-US ] = "Single, fine lines" ; -}; -String RID_SINGLE_LINE1 -{ - Text [ en-US ] = "Single, thin" ; -}; -String RID_SINGLE_LINE2 -{ - Text [ en-US ] = "Single, thick" ; -}; -String RID_SINGLE_LINE3 -{ - Text [ en-US ] = "Single, very thick" ; -}; -String RID_SINGLE_LINE4 -{ - Text [ en-US ] = "Single, bold" ; -}; -String RID_DOUBLE_LINE0 -{ - Text [ en-US ] = "Double, fine lines, spacing: small" ; -}; -String RID_DOUBLE_LINE1 -{ - Text [ en-US ] = "Double, fine line, spacing: large" ; -}; -String RID_DOUBLE_LINE2 -{ - Text [ en-US ] = "Double, thin, spacing: small" ; -}; -String RID_DOUBLE_LINE3 -{ - Text [ en-US ] = "Double, thick, spacing: large" ; -}; -String RID_DOUBLE_LINE4 -{ - Text [ en-US ] = "Double, inside: fine lines, outside: thin, spacing: large" ; -}; -String RID_DOUBLE_LINE5 -{ - Text [ en-US ] = "Double, inside: fine lines, outside: thick, spacing: large" ; -}; -String RID_DOUBLE_LINE6 -{ - Text [ en-US ] = "Double, inside: fine lines, outside: very thick, spacing: large" ; -}; -String RID_DOUBLE_LINE7 -{ - Text [ en-US ] = "Double, inside: thin, outside: thick, spacing: large" ; -}; -String RID_DOUBLE_LINE8 -{ - Text [ en-US ] = "Double, inside: thick, outside: thin, spacing: small" ; -}; -String RID_DOUBLE_LINE9 -{ - Text [ en-US ] = "Double, inside: thick, outside: very thick, spacing: large" ; -}; -String RID_DOUBLE_LINE10 -{ - Text [ en-US ] = "Double, inside: very thick, outside: thick, Spacing: large" ; -}; -String RID_SVXITEMS_METRIC_MM -{ - Text = "mm" ; -}; -String RID_SVXITEMS_METRIC_CM -{ - Text = "cm" ; -}; -String RID_SVXITEMS_METRIC_INCH -{ - Text = "inch" ; -}; -String RID_SVXITEMS_METRIC_POINT -{ - Text = "pt" ; -}; -String RID_SVXITEMS_METRIC_TWIP -{ - Text = "twip" ; -}; -String RID_SVXITEMS_METRIC_PIXEL -{ - Text = "pixel" ; -}; + String RID_SVXITEMS_HORJUST_STANDARD { Text [ en-US ] = "Horizontal alignment default" ; @@ -1177,126 +273,6 @@ String RID_SVXITEMS_ORI_STACKED Text [ en-US ] = "Stacked" ; }; // GetValueText von BoolItems -String RID_SVXITEMS_SHADOWED_TRUE -{ - Text [ en-US ] = "Shadowed" ; -}; -String RID_SVXITEMS_SHADOWED_FALSE -{ - Text [ en-US ] = "Not Shadowed" ; -}; -String RID_SVXITEMS_BLINK_TRUE -{ - Text [ en-US ] = "Blinking" ; -}; -String RID_SVXITEMS_BLINK_FALSE -{ - Text [ en-US ] = "Not Blinking" ; -}; -String RID_SVXITEMS_AUTOKERN_TRUE -{ - Text [ en-US ] = "Pair Kerning" ; -}; -String RID_SVXITEMS_AUTOKERN_FALSE -{ - Text [ en-US ] = "No pair kerning" ; -}; -String RID_SVXITEMS_WORDLINE_TRUE -{ - Text [ en-US ] = "Individual words" ; -}; -String RID_SVXITEMS_WORDLINE_FALSE -{ - Text [ en-US ] = "Not Words Only" ; -}; -String RID_SVXITEMS_CONTOUR_TRUE -{ - Text [ en-US ] = "Outline" ; -}; -String RID_SVXITEMS_CONTOUR_FALSE -{ - Text [ en-US ] = "No Outline" ; -}; -String RID_SVXITEMS_NOLINEBREAK_TRUE -{ - Text = "?" ; -}; -String RID_SVXITEMS_NOLINEBREAK_FALSE -{ - Text = "?" ; -}; -String RID_SVXITEMS_NOHYPHEN_TRUE -{ - Text = "?" ; -}; -String RID_SVXITEMS_NOHYPHEN_FALSE -{ - Text = "?" ; -}; -String RID_SVXITEMS_PRINT_TRUE -{ - Text [ en-US ] = "Print" ; -}; -String RID_SVXITEMS_PRINT_FALSE -{ - Text [ en-US ] = "Don't print" ; -}; -String RID_SVXITEMS_OPAQUE_TRUE -{ - Text [ en-US ] = "Opaque" ; -}; -String RID_SVXITEMS_OPAQUE_FALSE -{ - Text [ en-US ] = "Not Opaque" ; -}; -String RID_SVXITEMS_FMTKEEP_TRUE -{ - Text [ en-US ] = "Keep with next paragraph" ; -}; -String RID_SVXITEMS_FMTKEEP_FALSE -{ - Text [ en-US ] = "Don't Keep Paragraphs Together" ; -}; -String RID_SVXITEMS_FMTSPLIT_TRUE -{ - Text [ en-US ] = "Split paragraph" ; -}; -String RID_SVXITEMS_FMTSPLIT_FALSE -{ - Text [ en-US ] = "Don't split paragraph" ; -}; -String RID_SVXITEMS_PROT_CONTENT_TRUE -{ - Text [ en-US ] = "Contents protected" ; -}; -String RID_SVXITEMS_PROT_CONTENT_FALSE -{ - Text [ en-US ] = "Contents not protected" ; -}; -String RID_SVXITEMS_PROT_SIZE_TRUE -{ - Text [ en-US ] = "Size protected" ; -}; -String RID_SVXITEMS_PROT_SIZE_FALSE -{ - Text [ en-US ] = "Size not protected" ; -}; -String RID_SVXITEMS_PROT_POS_TRUE -{ - Text [ en-US ] = "Position protected" ; -}; -String RID_SVXITEMS_PROT_POS_FALSE -{ - Text [ en-US ] = "Position not protected" ; -}; -String RID_SVXITEMS_TRANSPARENT_TRUE -{ - Text [ en-US ] = "Transparent" ; -}; -String RID_SVXITEMS_TRANSPARENT_FALSE -{ - Text [ en-US ] = "Not Transparent" ; -}; String RID_SVXITEMS_BOXINF_TABLE_TRUE { Text [ en-US ] = "Table" ; @@ -1321,22 +297,6 @@ String RID_SVXITEMS_BOXINF_MDIST_FALSE { Text [ en-US ] = "Allowed to fall short of spacing interval" ; }; -String RID_SVXITEMS_HYPHEN_TRUE -{ - Text [ en-US ] = "Hyphenation" ; -}; -String RID_SVXITEMS_HYPHEN_FALSE -{ - Text [ en-US ] = "No hyphenation" ; -}; -String RID_SVXITEMS_PAGE_END_TRUE -{ - Text [ en-US ] = "Page End" ; -}; -String RID_SVXITEMS_PAGE_END_FALSE -{ - Text [ en-US ] = "No Page End" ; -}; String RID_SVXITEMS_MARGIN_LEFT { Text [ en-US ] = "Left margin: " ; @@ -1353,66 +313,6 @@ String RID_SVXITEMS_MARGIN_BOTTOM { Text [ en-US ] = "Bottom margin: " ; }; -String RID_SVXITEMS_SIZE_WIDTH -{ - Text [ en-US ] = "Width: " ; -}; -String RID_SVXITEMS_SIZE_HEIGHT -{ - Text [ en-US ] = "Height: " ; -}; -String RID_SVXITEMS_LRSPACE_LEFT -{ - Text [ en-US ] = "Indent left " ; -}; -String RID_SVXITEMS_LRSPACE_FLINE -{ - Text [ en-US ] = "First Line " ; -}; -String RID_SVXITEMS_LRSPACE_RIGHT -{ - Text [ en-US ] = "Indent right " ; -}; -String RID_SVXITEMS_SHADOW_COMPLETE -{ - Text [ en-US ] = "Shadow: " ; -}; -String RID_SVXITEMS_BORDER_COMPLETE -{ - Text [ en-US ] = "Borders " ; -}; -String RID_SVXITEMS_BORDER_NONE -{ - Text [ en-US ] = "No border"; -}; -String RID_SVXITEMS_BORDER_TOP -{ - Text [ en-US ] = "top " ; -}; -String RID_SVXITEMS_BORDER_BOTTOM -{ - Text [ en-US ] = "bottom " ; -}; -String RID_SVXITEMS_BORDER_LEFT -{ - Text [ en-US ] = "left " ; -}; -String RID_SVXITEMS_BORDER_RIGHT -{ - Text [ en-US ] = "right " ; -}; -String RID_SVXITEMS_BORDER_DISTANCE -{ - Text [ en-US ] = "Spacing " ; -}; -String RID_SVXITEMS_ULSPACE_UPPER -{ - Text [ en-US ] = "From top " ; -}; -String RID_SVXITEMS_ULSPACE_LOWER -{ - Text [ en-US ] = "From bottom " ; -}; String RID_SVXITEMS_PAGE_COMPLETE { Text [ en-US ] = "Page Description: " ; @@ -1465,47 +365,6 @@ String RID_SVXITEMS_PAGE_USAGE_MIRROR { Text [ en-US ] = "Mirrored" ; }; -String RID_SVXITEMS_LINES -{ - Text [ en-US ] = "%1 Lines" ; - Text [ x-comment ] = "pb: %1 == will be replaced by the number of lines"; -}; -String RID_SVXITEMS_WIDOWS_COMPLETE -{ - Text [ en-US ] = "Widow control" ; -}; -String RID_SVXITEMS_ORPHANS_COMPLETE -{ - Text [ en-US ] = "Orphan control" ; -}; -String RID_SVXITEMS_HYPHEN_MINLEAD -{ - Text [ en-US ] = "Characters at end of line" ; -}; -String RID_SVXITEMS_HYPHEN_MINTRAIL -{ - Text [ en-US ] = "Characters at beginning of line" ; -}; -String RID_SVXITEMS_HYPHEN_MAX -{ - Text [ en-US ] = "Hyphens" ; -}; -String RID_SVXITEMS_PAGEMODEL_COMPLETE -{ - Text [ en-US ] = "Page Style: " ; -}; -String RID_SVXITEMS_KERNING_COMPLETE -{ - Text [ en-US ] = "Kerning " ; -}; -String RID_SVXITEMS_KERNING_EXPANDED -{ - Text [ en-US ] = "locked " ; -}; -String RID_SVXITEMS_KERNING_CONDENSED -{ - Text [ en-US ] = "Condensed " ; -}; String RID_SVXITEMS_AUTHOR_COMPLETE { Text [ en-US ] = "Author: " ; @@ -1526,176 +385,9 @@ String RID_SVXITEMS_PATTERN_COLOR { Text [ en-US ] = "Pattern color: " ; }; -String RID_SVXITEMS_GRAPHIC -{ - Text [ en-US ] = "Graphic" ; -}; - String RID_SVXITEMS_BRUSH_CHAR { Text [ en-US ] = "Character background"; }; - - -String RID_SVXITEMS_EMPHASIS_NONE_STYLE -{ - Text [ en-US ] = "none"; -}; -String RID_SVXITEMS_EMPHASIS_DOT_STYLE -{ - Text [ en-US ] = "Dots "; -}; -String RID_SVXITEMS_EMPHASIS_CIRCLE_STYLE -{ - Text [ en-US ] = "Circle "; -}; -String RID_SVXITEMS_EMPHASIS_DISC_STYLE -{ -// ??? disc == filled ring - Text [ en-US ] = "Filled circle "; -}; -String RID_SVXITEMS_EMPHASIS_ACCENT_STYLE -{ - Text [ en-US ] = "Accent "; -}; - -String RID_SVXITEMS_EMPHASIS_ABOVE_POS -{ - Text [ en-US ] = "Above"; -}; -String RID_SVXITEMS_EMPHASIS_BELOW_POS -{ - Text [ en-US ] = "Below"; -}; - -String RID_SVXITEMS_TWOLINES_OFF -{ - Text [ en-US ] = "Double-lined off"; -}; -String RID_SVXITEMS_TWOLINES -{ - Text [ en-US ] = "Double-lined"; -}; - -String RID_SVXITEMS_SCRPTSPC_OFF -{ - Text [ en-US ] = "No automatic character spacing"; -}; -String RID_SVXITEMS_SCRPTSPC_ON -{ - Text [ en-US ] = "No automatic character spacing"; -}; - -String RID_SVXITEMS_HNGPNCT_OFF -{ - Text [ en-US ] = "No hanging punctuation at line end"; -}; -String RID_SVXITEMS_HNGPNCT_ON -{ - Text [ en-US ] = "Hanging punctuation at line end"; -}; -String RID_SVXITEMS_FORBIDDEN_RULE_OFF -{ - Text [ en-US ] = "Apply list of forbidden characters to beginning and end of lines"; -}; - -String RID_SVXITEMS_FORBIDDEN_RULE_ON -{ - Text [ en-US ] = "Don't apply list of forbidden characters to beginning and end of lines"; -}; - - -String RID_SVXITEMS_CHARROTATE_OFF -{ - Text [ en-US ] = "No rotated characters"; -}; -String RID_SVXITEMS_CHARROTATE -{ - Text [ en-US ] = "Character rotated by $(ARG1)°"; -}; -String RID_SVXITEMS_CHARROTATE_FITLINE -{ - Text [ en-US ] = "Fit to line"; -}; -String RID_SVXITEMS_CHARSCALE -{ - Text [ en-US ] = "Characters scaled $(ARG1)%"; -}; -String RID_SVXITEMS_CHARSCALE_OFF -{ - Text [ en-US ] = "No scaled characters"; -}; - -String RID_SVXITEMS_RELIEF_NONE -{ - Text [ en-US ] = "No relief"; -}; -String RID_SVXITEMS_RELIEF_EMBOSSED -{ - Text [ en-US ] = "Relief"; -}; -String RID_SVXITEMS_RELIEF_ENGRAVED -{ - Text [ en-US ] = "Engraved"; -}; -String RID_SVXITEMS_PARAVERTALIGN_AUTO -{ - Text [ en-US ] = "Automatic text alignment"; -}; -String RID_SVXITEMS_PARAVERTALIGN_BASELINE -{ - Text [ en-US ] = "Text aligned to base line"; -}; -String RID_SVXITEMS_PARAVERTALIGN_TOP -{ - Text [ en-US ] = "Text aligned top"; -}; -String RID_SVXITEMS_PARAVERTALIGN_CENTER -{ - Text [ en-US ] = "Text aligned middle"; -}; -String RID_SVXITEMS_PARAVERTALIGN_BOTTOM -{ - Text [ en-US ] = "Text aligned bottom"; -}; - -String RID_SVXITEMS_FRMDIR_HORI_LEFT_TOP -{ - Text [ en-US ] = "Text direction left-to-right (horizontal)"; -}; -String RID_SVXITEMS_FRMDIR_HORI_RIGHT_TOP -{ - Text [ en-US ] = "Text direction right-to-left (horizontal)"; -}; -String RID_SVXITEMS_FRMDIR_VERT_TOP_RIGHT -{ - Text [ en-US ] = "Text direction right-to-left (vertical)"; -}; -String RID_SVXITEMS_FRMDIR_VERT_TOP_LEFT -{ - Text [ en-US ] = "Text direction left-to-right (vertical)"; -}; -String RID_SVXITEMS_FRMDIR_ENVIRONMENT -{ - Text [ en-US ] = "Use superordinate object text direction setting"; -}; - -String RID_SVXITEMS_PARASNAPTOGRID_ON -{ - Text[ en-US ] = "Paragraph snaps to text grid (if active)"; -}; - -String RID_SVXITEMS_PARASNAPTOGRID_OFF -{ - Text[ en-US ] = "Paragraph does not snap to text grid"; -}; -String RID_SVXITEMS_CHARHIDDEN_FALSE -{ - Text [ en-US ] = "Not hidden"; -}; -String RID_SVXITEMS_CHARHIDDEN_TRUE -{ - Text [ en-US ] = "Hidden"; -}; // ********************************************************************** EOF diff --git a/svx/source/items/textitem.cxx b/svx/source/items/textitem.cxx deleted file mode 100644 index d891dc29b10c..000000000000 --- a/svx/source/items/textitem.cxx +++ /dev/null @@ -1,3849 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: textitem.cxx,v $ - * $Revision: 1.74.86.1 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svx.hxx" - -// include --------------------------------------------------------------- -#include <com/sun/star/style/CaseMap.hpp> -#include <com/sun/star/awt/FontDescriptor.hpp> -#include <com/sun/star/frame/status/FontHeight.hpp> -#include <vcl/bitmapex.hxx> -#include <tools/stream.hxx> -#include <toolkit/unohlp.hxx> -#include <math.h> -#include <rtl/math.hxx> - -#include <svx/eeitem.hxx> - -#include <basic/sbx.hxx> -#define GLOBALOVERFLOW3 - - -#include <svl/memberid.hrc> -#include <svx/svxids.hrc> -#include <svx/svxitems.hrc> -#include <vcl/vclenum.hxx> -#include <tools/bigint.hxx> -#include <tools/tenccvt.hxx> - -#include <rtl/ustring.hxx> -#include <i18npool/mslangid.hxx> -#include <svl/itemset.hxx> - -#include <svtools/langtab.hxx> -#include <svl/itempool.hxx> -#include <svtools/ctrltool.hxx> -#include <vcl/settings.hxx> -#include <vcl/svapp.hxx> -#include <com/sun/star/style/CaseMap.hpp> -#include <com/sun/star/awt/SimpleFontMetric.hpp> -#include <com/sun/star/awt/FontWeight.hpp> -#include <com/sun/star/awt/FontSlant.hpp> -#include <com/sun/star/awt/CharSet.hpp> -#include <com/sun/star/awt/FontDescriptor.hpp> -#include <com/sun/star/awt/FontWidth.hpp> -#include <com/sun/star/awt/XFont.hpp> -#include <com/sun/star/awt/FontType.hpp> -#include <com/sun/star/awt/FontUnderline.hpp> -#include <com/sun/star/awt/FontStrikeout.hpp> -#include <com/sun/star/awt/FontFamily.hpp> -#include <com/sun/star/awt/FontPitch.hpp> -#include <com/sun/star/lang/Locale.hpp> -#include <com/sun/star/text/FontEmphasis.hpp> -#include <com/sun/star/i18n/ScriptType.hpp> -#include <svx/unomid.hxx> - - -#include "flstitem.hxx" -#include "fontitem.hxx" -#include <svx/postitem.hxx> -#include <svx/wghtitem.hxx> -#include <svx/fhgtitem.hxx> -#include "fwdtitem.hxx" -#include <svx/udlnitem.hxx> -#include <svx/crsditem.hxx> -#include <svx/shdditem.hxx> -#include <svx/akrnitem.hxx> -#include <svx/wrlmitem.hxx> -#include <svx/cntritem.hxx> -#include <svx/prszitem.hxx> -#include <svx/colritem.hxx> -#include <svx/cscoitem.hxx> -#include <svx/kernitem.hxx> -#include <svx/cmapitem.hxx> -#include <svx/escpitem.hxx> -#include <svx/langitem.hxx> -#include "nlbkitem.hxx" -#include <svx/nhypitem.hxx> -#include <svx/lcolitem.hxx> -#include <svx/blnkitem.hxx> -#include <svx/emphitem.hxx> -#include <svx/twolinesitem.hxx> -#include <svx/scripttypeitem.hxx> -#include <svx/charrotateitem.hxx> -#include <svx/charscaleitem.hxx> -#include <svx/charreliefitem.hxx> -#include <svx/itemtype.hxx> -#include <svx/dialmgr.hxx> -#include "dlgutil.hxx" - -// #90477# -#include <tools/tenccvt.hxx> - -#define STORE_UNICODE_MAGIC_MARKER 0xFE331188 - -using namespace ::rtl; -using namespace ::com::sun::star; -using namespace ::com::sun::star::text; - -// Konvertierung fuer UNO -#define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L)) -#define MM100_TO_TWIP(MM100) ((MM100) >= 0 ? (((MM100)*72L+63L)/127L) : (((MM100)*72L-63L)/127L)) -#define TWIP_TO_MM100_UNSIGNED(TWIP) ((((TWIP)*127L+36L)/72L)) -#define MM100_TO_TWIP_UNSIGNED(MM100) ((((MM100)*72L+63L)/127L)) - -BOOL SvxFontItem::bEnableStoreUnicodeNames = FALSE; - -// STATIC DATA ----------------------------------------------------------- - -// ----------------------------------------------------------------------- - -TYPEINIT1(SvxFontListItem, SfxPoolItem); -TYPEINIT1_FACTORY(SvxFontItem, SfxPoolItem, new SvxFontItem(0)); -TYPEINIT1_FACTORY(SvxPostureItem, SfxEnumItem, new SvxPostureItem(ITALIC_NONE, 0)); -TYPEINIT1_FACTORY(SvxWeightItem, SfxEnumItem, new SvxWeightItem(WEIGHT_NORMAL, 0)); -TYPEINIT1_FACTORY(SvxFontHeightItem, SfxPoolItem, new SvxFontHeightItem(240, 100, 0)); -TYPEINIT1_FACTORY(SvxFontWidthItem, SfxPoolItem, new SvxFontWidthItem(0, 100, 0)); -TYPEINIT1_FACTORY(SvxTextLineItem, SfxEnumItem, new SvxTextLineItem(UNDERLINE_NONE, 0)); -TYPEINIT1_FACTORY(SvxUnderlineItem, SfxEnumItem, new SvxUnderlineItem(UNDERLINE_NONE, 0)); -TYPEINIT1_FACTORY(SvxOverlineItem, SfxEnumItem, new SvxOverlineItem(UNDERLINE_NONE, 0)); -TYPEINIT1_FACTORY(SvxCrossedOutItem, SfxEnumItem, new SvxCrossedOutItem(STRIKEOUT_NONE, 0)); -TYPEINIT1_FACTORY(SvxShadowedItem, SfxBoolItem, new SvxShadowedItem(sal_False, 0)); -TYPEINIT1_FACTORY(SvxAutoKernItem, SfxBoolItem, new SvxAutoKernItem(sal_False, 0)); -TYPEINIT1_FACTORY(SvxWordLineModeItem, SfxBoolItem, new SvxWordLineModeItem(sal_False, 0)); -TYPEINIT1_FACTORY(SvxContourItem, SfxBoolItem, new SvxContourItem(sal_False, 0)); -TYPEINIT1_FACTORY(SvxPropSizeItem, SfxUInt16Item, new SvxPropSizeItem(100, 0)); -TYPEINIT1_FACTORY(SvxColorItem, SfxPoolItem, new SvxColorItem(0)); -TYPEINIT1_FACTORY(SvxCharSetColorItem, SvxColorItem, new SvxCharSetColorItem(0)); -TYPEINIT1_FACTORY(SvxKerningItem, SfxInt16Item, new SvxKerningItem(0, 0)); -TYPEINIT1_FACTORY(SvxCaseMapItem, SfxEnumItem, new SvxCaseMapItem(SVX_CASEMAP_NOT_MAPPED, 0)); -TYPEINIT1_FACTORY(SvxEscapementItem, SfxPoolItem, new SvxEscapementItem(0)); -TYPEINIT1_FACTORY(SvxLanguageItem, SfxEnumItem, new SvxLanguageItem(LANGUAGE_GERMAN, 0)); -TYPEINIT1_FACTORY(SvxNoLinebreakItem, SfxBoolItem, new SvxNoLinebreakItem(sal_True, 0)); -TYPEINIT1_FACTORY(SvxNoHyphenItem, SfxBoolItem, new SvxNoHyphenItem(sal_True, 0)); -TYPEINIT1_FACTORY(SvxLineColorItem, SvxColorItem, new SvxLineColorItem(0)); -TYPEINIT1_FACTORY(SvxBlinkItem, SfxBoolItem, new SvxBlinkItem(sal_False, 0)); -TYPEINIT1_FACTORY(SvxEmphasisMarkItem, SfxUInt16Item, new SvxEmphasisMarkItem(EMPHASISMARK_NONE, 0)); -TYPEINIT1_FACTORY(SvxTwoLinesItem, SfxPoolItem, new SvxTwoLinesItem(sal_True, 0, 0, 0)); -TYPEINIT1_FACTORY(SvxScriptTypeItem, SfxUInt16Item, new SvxScriptTypeItem); -TYPEINIT1_FACTORY(SvxCharRotateItem, SfxUInt16Item, new SvxCharRotateItem(0, sal_False, 0)); -TYPEINIT1_FACTORY(SvxCharScaleWidthItem, SfxUInt16Item, new SvxCharScaleWidthItem(100, 0)); -TYPEINIT1_FACTORY(SvxCharReliefItem, SfxEnumItem, new SvxCharReliefItem(RELIEF_NONE, 0)); - - -TYPEINIT1(SvxScriptSetItem, SfxSetItem ); - - -// class SvxFontListItem ------------------------------------------------- - -SvxFontListItem::SvxFontListItem( const FontList* pFontLst, - const USHORT nId ) : - SfxPoolItem( nId ), - pFontList( pFontLst ) -{ - if ( pFontList ) - { - sal_Int32 nCount = pFontList->GetFontNameCount(); - aFontNameSeq.realloc( nCount ); - - for ( USHORT i = 0; i < nCount; i++ ) - aFontNameSeq[i] = pFontList->GetFontName(i).GetName(); - } -} - -// ----------------------------------------------------------------------- - -SvxFontListItem::SvxFontListItem( const SvxFontListItem& rItem ) : - - SfxPoolItem( rItem ), - pFontList( rItem.GetFontList() ), - aFontNameSeq( rItem.aFontNameSeq ) -{ -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxFontListItem::Clone( SfxItemPool* ) const -{ - return new SvxFontListItem( *this ); -} - -// ----------------------------------------------------------------------- - -int SvxFontListItem::operator==( const SfxPoolItem& rAttr ) const -{ - DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" ); - - return( pFontList == ((SvxFontListItem&)rAttr).pFontList ); -} - -sal_Bool SvxFontListItem::QueryValue( com::sun::star::uno::Any& rVal, BYTE /*nMemberId*/ ) const -{ - rVal <<= aFontNameSeq; - return sal_True; -} - -//------------------------------------------------------------------------ - -SfxItemPresentation SvxFontListItem::GetPresentation -( - SfxItemPresentation /*ePres*/, - SfxMapUnit /*eCoreUnit*/, - SfxMapUnit /*ePresUnit*/, - XubString& rText, const IntlWrapper * /*pIntl*/ -) const -{ - rText.Erase(); - return SFX_ITEM_PRESENTATION_NONE; -} - -// class SvxFontItem ----------------------------------------------------- - -SvxFontItem::SvxFontItem( const USHORT nId ) : - SfxPoolItem( nId ) -{ - eFamily = FAMILY_SWISS; - ePitch = PITCH_VARIABLE; - eTextEncoding = RTL_TEXTENCODING_DONTKNOW; -} - -// ----------------------------------------------------------------------- - -SvxFontItem::SvxFontItem( const FontFamily eFam, const XubString& aName, - const XubString& aStName, const FontPitch eFontPitch, - const rtl_TextEncoding eFontTextEncoding, const USHORT nId ) : - - SfxPoolItem( nId ), - - aFamilyName(aName), - aStyleName(aStName) -{ - eFamily = eFam; - ePitch = eFontPitch; - eTextEncoding = eFontTextEncoding; -} - -// ----------------------------------------------------------------------- - -sal_Bool SvxFontItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const -{ -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); - nMemberId &= ~CONVERT_TWIPS; - switch(nMemberId) - { - case 0: - { - com::sun::star::awt::FontDescriptor aFontDescriptor; - aFontDescriptor.Name = aFamilyName.GetBuffer(); - aFontDescriptor.StyleName = aStyleName.GetBuffer(); - aFontDescriptor.Family = (sal_Int16)(eFamily); - aFontDescriptor.CharSet = (sal_Int16)(eTextEncoding); - aFontDescriptor.Pitch = (sal_Int16)(ePitch); - rVal <<= aFontDescriptor; - } - break; - case MID_FONT_FAMILY_NAME : - rVal <<= OUString(aFamilyName.GetBuffer()); - break; - case MID_FONT_STYLE_NAME: - rVal <<= OUString(aStyleName.GetBuffer()); - break; - case MID_FONT_FAMILY : rVal <<= (sal_Int16)(eFamily); break; - case MID_FONT_CHAR_SET : rVal <<= (sal_Int16)(eTextEncoding); break; - case MID_FONT_PITCH : rVal <<= (sal_Int16)(ePitch); break; - } - return sal_True; -} -// ----------------------------------------------------------------------- -sal_Bool SvxFontItem::PutValue( const uno::Any& rVal, BYTE nMemberId) -{ -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); - nMemberId &= ~CONVERT_TWIPS; - switch(nMemberId) - { - case 0: - { - com::sun::star::awt::FontDescriptor aFontDescriptor; - if ( !( rVal >>= aFontDescriptor )) - return sal_False; - - aFamilyName = aFontDescriptor.Name; - aStyleName = aFontDescriptor.StyleName; - eFamily = (FontFamily)aFontDescriptor.Family; - eTextEncoding = (rtl_TextEncoding)aFontDescriptor.CharSet; - ePitch = (FontPitch)aFontDescriptor.Pitch; - } - break; - case MID_FONT_FAMILY_NAME : - { - OUString aStr; - if(!(rVal >>= aStr)) - return sal_False; - aFamilyName = aStr.getStr(); - } - break; - case MID_FONT_STYLE_NAME: - { - OUString aStr; - if(!(rVal >>= aStr)) - return sal_False; - aStyleName = aStr.getStr(); - } - break; - case MID_FONT_FAMILY : - { - sal_Int16 nFamily = sal_Int16(); - if(!(rVal >>= nFamily)) - return sal_False; - eFamily = (FontFamily)nFamily; - } - break; - case MID_FONT_CHAR_SET : - { - sal_Int16 nSet = sal_Int16(); - if(!(rVal >>= nSet)) - return sal_False; - eTextEncoding = (rtl_TextEncoding)nSet; - } - break; - case MID_FONT_PITCH : - { - sal_Int16 nPitch = sal_Int16(); - if(!(rVal >>= nPitch)) - return sal_False; - ePitch = (FontPitch)nPitch; - } - break; - } - return sal_True; -} - -// ----------------------------------------------------------------------- - -int SvxFontItem::operator==( const SfxPoolItem& rAttr ) const -{ - DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" ); - - const SvxFontItem& rItem = (const SvxFontItem&)rAttr; - - int bRet = ( eFamily == rItem.eFamily && - aFamilyName == rItem.aFamilyName && - aStyleName == rItem.aStyleName ); - - if ( bRet ) - { - if ( ePitch != rItem.ePitch || eTextEncoding != rItem.eTextEncoding ) - { - bRet = sal_False; - DBG_WARNING( "FontItem::operator==(): nur Pitch oder rtl_TextEncoding unterschiedlich" ); - } - } - return bRet; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxFontItem::Clone( SfxItemPool * ) const -{ - return new SvxFontItem( *this ); -} - -// ----------------------------------------------------------------------- - -SvStream& SvxFontItem::Store( SvStream& rStrm , USHORT /*nItemVersion*/ ) const -{ - BOOL bToBats = - GetFamilyName().EqualsAscii( "StarSymbol", 0, sizeof("StarSymbol")-1 ) || - GetFamilyName().EqualsAscii( "OpenSymbol", 0, sizeof("OpenSymbol")-1 ); - - // #90477# rStrm << (BYTE) GetFamily() - // << (BYTE) GetPitch() - // << (BYTE)(bToBats ? RTL_TEXTENCODING_SYMBOL : GetStoreCharSet( GetCharSet(), (USHORT)rStrm.GetVersion() ) ); - rStrm << (BYTE) GetFamily() << (BYTE) GetPitch() - << (BYTE)(bToBats ? RTL_TEXTENCODING_SYMBOL : GetSOStoreTextEncoding(GetCharSet(), (sal_uInt16)rStrm.GetVersion())); - - String aStoreFamilyName( GetFamilyName() ); - if( bToBats ) - aStoreFamilyName = String( "StarBats", sizeof("StarBats")-1, RTL_TEXTENCODING_ASCII_US ); - rStrm.WriteByteString(aStoreFamilyName); - rStrm.WriteByteString(GetStyleName()); - - // #96441# Kach for EditEngine, only set while creating clipboard stream. - if ( bEnableStoreUnicodeNames ) - { - sal_uInt32 nMagic = STORE_UNICODE_MAGIC_MARKER; - rStrm << nMagic; - rStrm.WriteByteString( aStoreFamilyName, RTL_TEXTENCODING_UNICODE ); - rStrm.WriteByteString( GetStyleName(), RTL_TEXTENCODING_UNICODE ); - } - - return rStrm; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxFontItem::Create(SvStream& rStrm, USHORT) const -{ - BYTE _eFamily, eFontPitch, eFontTextEncoding; - String aName, aStyle; - rStrm >> _eFamily; - rStrm >> eFontPitch; - rStrm >> eFontTextEncoding; - - // UNICODE: rStrm >> aName; - rStrm.ReadByteString(aName); - - // UNICODE: rStrm >> aStyle; - rStrm.ReadByteString(aStyle); - - // Task 91008/90471: set the "correct" textencoding - eFontTextEncoding = (BYTE)GetSOLoadTextEncoding( eFontTextEncoding, (USHORT)rStrm.GetVersion() ); - - // irgendwann wandelte sich der StarBats vom ANSI- zum SYMBOL-Font - if ( RTL_TEXTENCODING_SYMBOL != eFontTextEncoding && aName.EqualsAscii("StarBats") ) - eFontTextEncoding = RTL_TEXTENCODING_SYMBOL; - - // Check if we have stored unicode - sal_Size nStreamPos = rStrm.Tell(); - sal_uInt32 nMagic = STORE_UNICODE_MAGIC_MARKER; - rStrm >> nMagic; - if ( nMagic == STORE_UNICODE_MAGIC_MARKER ) - { - rStrm.ReadByteString( aName, RTL_TEXTENCODING_UNICODE ); - rStrm.ReadByteString( aStyle, RTL_TEXTENCODING_UNICODE ); - } - else - { - rStrm.Seek( nStreamPos ); - } - - - - return new SvxFontItem( (FontFamily)_eFamily, aName, aStyle, - (FontPitch)eFontPitch, (rtl_TextEncoding)eFontTextEncoding, Which() ); -} - -//------------------------------------------------------------------------ - -SfxItemPresentation SvxFontItem::GetPresentation -( - SfxItemPresentation ePres, - SfxMapUnit /*eCoreUnit*/, - SfxMapUnit /*ePresUnit*/, - XubString& rText, const IntlWrapper * /*pIntl*/ -) const -{ - switch ( ePres ) - { - case SFX_ITEM_PRESENTATION_NONE: - rText.Erase(); - return ePres; - case SFX_ITEM_PRESENTATION_NAMELESS: - case SFX_ITEM_PRESENTATION_COMPLETE: - rText = aFamilyName; - return ePres; - default: ; //prevent warning - } - return SFX_ITEM_PRESENTATION_NONE; -} - -//------------------------------------------------------------------------ - -void SvxFontItem::EnableStoreUnicodeNames( BOOL bEnable ) -{ - bEnableStoreUnicodeNames = bEnable; -} - -// class SvxPostureItem -------------------------------------------------- - -SvxPostureItem::SvxPostureItem( const FontItalic ePosture, const USHORT nId ) : - SfxEnumItem( nId, (USHORT)ePosture ) -{ -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxPostureItem::Clone( SfxItemPool * ) const -{ - return new SvxPostureItem( *this ); -} - -// ----------------------------------------------------------------------- - -USHORT SvxPostureItem::GetValueCount() const -{ - return ITALIC_NORMAL + 1; // auch ITALIC_NONE geh"ort dazu -} - -// ----------------------------------------------------------------------- - -SvStream& SvxPostureItem::Store( SvStream& rStrm , USHORT /*nItemVersion*/ ) const -{ - rStrm << (BYTE)GetValue(); - return rStrm; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxPostureItem::Create(SvStream& rStrm, USHORT) const -{ - BYTE nPosture; - rStrm >> nPosture; - return new SvxPostureItem( (const FontItalic)nPosture, Which() ); -} - -//------------------------------------------------------------------------ - -SfxItemPresentation SvxPostureItem::GetPresentation -( - SfxItemPresentation ePres, - SfxMapUnit /*eCoreUnit*/, - SfxMapUnit /*ePresUnit*/, - XubString& rText, const IntlWrapper * /*pIntl*/ -) const -{ - switch ( ePres ) - { - case SFX_ITEM_PRESENTATION_NONE: - rText.Erase(); - return ePres; - case SFX_ITEM_PRESENTATION_NAMELESS: - case SFX_ITEM_PRESENTATION_COMPLETE: - rText = GetValueTextByPos( GetValue() ); - return ePres; - default: ;//prevent warning - } - return SFX_ITEM_PRESENTATION_NONE; -} - -// ----------------------------------------------------------------------- - -XubString SvxPostureItem::GetValueTextByPos( USHORT nPos ) const -{ - DBG_ASSERT( nPos <= (USHORT)ITALIC_NORMAL, "enum overflow!" ); - - XubString sTxt; - FontItalic eItalic = (FontItalic)nPos; - USHORT nId = 0; - - switch ( eItalic ) - { - case ITALIC_NONE: nId = RID_SVXITEMS_ITALIC_NONE; break; - case ITALIC_OBLIQUE: nId = RID_SVXITEMS_ITALIC_OBLIQUE; break; - case ITALIC_NORMAL: nId = RID_SVXITEMS_ITALIC_NORMAL; break; - default: ;//prevent warning - } - - if ( nId ) - sTxt = SVX_RESSTR( nId ); - return sTxt; -} - - -/*-----------------13.03.98 14:28------------------- - ---------------------------------------------------*/ -sal_Bool SvxPostureItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const -{ -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); - nMemberId &= ~CONVERT_TWIPS; - switch( nMemberId ) - { - case MID_ITALIC: - rVal = Bool2Any(GetBoolValue()); - break; - case MID_POSTURE: - rVal <<= (awt::FontSlant)GetValue(); // Werte von awt::FontSlant und FontItalic sind gleich - break; - } - return sal_True; -} -/*-----------------13.03.98 14:28------------------- - ---------------------------------------------------*/ -sal_Bool SvxPostureItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) -{ -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); - nMemberId &= ~CONVERT_TWIPS; - switch( nMemberId ) - { - case MID_ITALIC: - SetBoolValue(Any2Bool(rVal)); - break; - case MID_POSTURE: - { - awt::FontSlant eSlant; - if(!(rVal >>= eSlant)) - { - sal_Int32 nValue = 0; - if(!(rVal >>= nValue)) - return sal_False; - - eSlant = (awt::FontSlant)nValue; - } - SetValue((USHORT)eSlant); - } - } - return sal_True; -} -// ----------------------------------------------------------------------- - -int SvxPostureItem::HasBoolValue() const -{ - return sal_True; -} - -// ----------------------------------------------------------------------- - -sal_Bool SvxPostureItem::GetBoolValue() const -{ - return ( (FontItalic)GetValue() >= ITALIC_OBLIQUE ); -} - -// ----------------------------------------------------------------------- - -void SvxPostureItem::SetBoolValue( sal_Bool bVal ) -{ - SetValue( (USHORT)(bVal ? ITALIC_NORMAL : ITALIC_NONE) ); -} - -// class SvxWeightItem --------------------------------------------------- - -SvxWeightItem::SvxWeightItem( const FontWeight eWght, const USHORT nId ) : - SfxEnumItem( nId, (USHORT)eWght ) -{ -} - - - -// ----------------------------------------------------------------------- - -int SvxWeightItem::HasBoolValue() const -{ - return sal_True; -} - -// ----------------------------------------------------------------------- - -sal_Bool SvxWeightItem::GetBoolValue() const -{ - return (FontWeight)GetValue() >= WEIGHT_BOLD; -} - -// ----------------------------------------------------------------------- - -void SvxWeightItem::SetBoolValue( sal_Bool bVal ) -{ - SetValue( (USHORT)(bVal ? WEIGHT_BOLD : WEIGHT_NORMAL) ); -} - -// ----------------------------------------------------------------------- - -USHORT SvxWeightItem::GetValueCount() const -{ - return WEIGHT_BLACK; // WEIGHT_DONTKNOW geh"ort nicht dazu -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxWeightItem::Clone( SfxItemPool * ) const -{ - return new SvxWeightItem( *this ); -} - -// ----------------------------------------------------------------------- - -SvStream& SvxWeightItem::Store( SvStream& rStrm , USHORT /*nItemVersion*/ ) const -{ - rStrm << (BYTE)GetValue(); - return rStrm; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxWeightItem::Create(SvStream& rStrm, USHORT) const -{ - BYTE nWeight; - rStrm >> nWeight; - return new SvxWeightItem( (FontWeight)nWeight, Which() ); -} - -//------------------------------------------------------------------------ - -SfxItemPresentation SvxWeightItem::GetPresentation -( - SfxItemPresentation ePres, - SfxMapUnit /*eCoreUnit*/, - SfxMapUnit /*ePresUnit*/, - XubString& rText, const IntlWrapper * /*pIntl*/ -) const -{ - switch ( ePres ) - { - case SFX_ITEM_PRESENTATION_NONE: - rText.Erase(); - return ePres; - case SFX_ITEM_PRESENTATION_NAMELESS: - case SFX_ITEM_PRESENTATION_COMPLETE: - rText = GetValueTextByPos( GetValue() ); - return ePres; - default: ;//prevent warning - } - return SFX_ITEM_PRESENTATION_NONE; -} - -// ----------------------------------------------------------------------- - -XubString SvxWeightItem::GetValueTextByPos( USHORT nPos ) const -{ - DBG_ASSERT( nPos <= (USHORT)WEIGHT_BLACK, "enum overflow!" ); - return SVX_RESSTR( RID_SVXITEMS_WEIGHT_BEGIN + nPos ); -} - -/*-----------------13.03.98 14:18------------------- - ---------------------------------------------------*/ -sal_Bool SvxWeightItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const -{ -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); - nMemberId &= ~CONVERT_TWIPS; - switch( nMemberId ) - { - case MID_BOLD : - rVal = Bool2Any(GetBoolValue()); - break; - case MID_WEIGHT: - { - rVal <<= (float)( VCLUnoHelper::ConvertFontWeight( (FontWeight)GetValue() ) ); - } - break; - } - return sal_True; -} -/*-----------------13.03.98 14:18------------------- - ---------------------------------------------------*/ -sal_Bool SvxWeightItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) -{ -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); - nMemberId &= ~CONVERT_TWIPS; - switch( nMemberId ) - { - case MID_BOLD : - SetBoolValue(Any2Bool(rVal)); - break; - case MID_WEIGHT: - { - double fValue = 0; - if(!(rVal >>= fValue)) - { - sal_Int32 nValue = 0; - if(!(rVal >>= nValue)) - return sal_False; - fValue = (float)nValue; - } - SetValue( (USHORT)VCLUnoHelper::ConvertFontWeight((float)fValue) ); - } - break; - } - return sal_True; -} - -// class SvxFontHeightItem ----------------------------------------------- - -SvxFontHeightItem::SvxFontHeightItem( const ULONG nSz, - const USHORT nPrp, - const USHORT nId ) : - SfxPoolItem( nId ) -{ - SetHeight( nSz,nPrp ); // mit den Prozenten rechnen -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxFontHeightItem::Clone( SfxItemPool * ) const -{ - return new SvxFontHeightItem( *this ); -} - -// ----------------------------------------------------------------------- - -SvStream& SvxFontHeightItem::Store( SvStream& rStrm , USHORT nItemVersion ) const -{ - rStrm << (USHORT)GetHeight(); - - if( FONTHEIGHT_UNIT_VERSION <= nItemVersion ) - rStrm << GetProp() << (USHORT)GetPropUnit(); - else - { - // JP 30.06.98: beim Export in alte Versionen geht die relative - // Angabe verloren, wenn es keine Prozentuale ist - USHORT _nProp = GetProp(); - if( SFX_MAPUNIT_RELATIVE != GetPropUnit() ) - _nProp = 100; - rStrm << _nProp; - } - return rStrm; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxFontHeightItem::Create( SvStream& rStrm, - USHORT nVersion ) const -{ - USHORT nsize, nprop = 0, nPropUnit = SFX_MAPUNIT_RELATIVE; - - rStrm >> nsize; - - if( FONTHEIGHT_16_VERSION <= nVersion ) - rStrm >> nprop; - else - { - BYTE nP; - rStrm >> nP; - nprop = (USHORT)nP; - } - - if( FONTHEIGHT_UNIT_VERSION <= nVersion ) - rStrm >> nPropUnit; - - SvxFontHeightItem* pItem = new SvxFontHeightItem( nsize, 100, Which() ); - pItem->SetProp( nprop, (SfxMapUnit)nPropUnit ); - return pItem; -} - -// ----------------------------------------------------------------------- - -int SvxFontHeightItem::operator==( const SfxPoolItem& rItem ) const -{ - DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" ); - return GetHeight() == ((SvxFontHeightItem&)rItem).GetHeight() && - GetProp() == ((SvxFontHeightItem&)rItem).GetProp() && - GetPropUnit() == ((SvxFontHeightItem&)rItem).GetPropUnit(); -} - -/*-----------------13.03.98 14:53------------------- - ---------------------------------------------------*/ -sal_Bool SvxFontHeightItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const -{ - // In StarOne sind im uno::Any immer 1/100mm. Ueber die MemberId wird - // gesteuert, ob der Wert im Item 1/100mm oder Twips sind. - - sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); - nMemberId &= ~CONVERT_TWIPS; - switch( nMemberId ) - { - case 0: - { - ::com::sun::star::frame::status::FontHeight aFontHeight; - - // Point (also Twips) sind gefragt, - // also umrechnen, wenn CONVERT_TWIPS nicht gesetzt ist - if( bConvert ) - { - long nTwips = bConvert ? nHeight : MM100_TO_TWIP_UNSIGNED(nHeight); - aFontHeight.Height = (float)( nTwips / 20.0 ); - } - else - { - double fPoints = MM100_TO_TWIP_UNSIGNED(nHeight) / 20.0; - float fRoundPoints = - static_cast<float>(::rtl::math::round(fPoints, 1)); - aFontHeight.Height = fRoundPoints; - } - - aFontHeight.Prop = (sal_Int16)(SFX_MAPUNIT_RELATIVE == ePropUnit ? nProp : 100); - - float fRet = (float)(short)nProp; - switch( ePropUnit ) - { - case SFX_MAPUNIT_RELATIVE: - fRet = 0.; - break; - case SFX_MAPUNIT_100TH_MM: - fRet = MM100_TO_TWIP(fRet); - fRet /= 20.; - break; - case SFX_MAPUNIT_POINT: - - break; - case SFX_MAPUNIT_TWIP: - fRet /= 20.; - break; - default: ;//prevent warning - } - aFontHeight.Diff = fRet; - rVal <<= aFontHeight; - } - break; - case MID_FONTHEIGHT: - { - // Point (also Twips) sind gefragt, - // also umrechnen, wenn CONVERT_TWIPS nicht gesetzt ist - if( bConvert ) - { - long nTwips = bConvert ? nHeight : MM100_TO_TWIP_UNSIGNED(nHeight); - rVal <<= (float)( nTwips / 20.0 ); - } - else - { - double fPoints = MM100_TO_TWIP_UNSIGNED(nHeight) / 20.0; - float fRoundPoints = - static_cast<float>(::rtl::math::round(fPoints, 1)); - rVal <<= fRoundPoints; - } - } - break; - case MID_FONTHEIGHT_PROP: - rVal <<= (sal_Int16)(SFX_MAPUNIT_RELATIVE == ePropUnit ? nProp : 100); - break; - case MID_FONTHEIGHT_DIFF: - { - float fRet = (float)(short)nProp; - switch( ePropUnit ) - { - case SFX_MAPUNIT_RELATIVE: - fRet = 0.; - break; - case SFX_MAPUNIT_100TH_MM: - fRet = MM100_TO_TWIP(fRet); - fRet /= 20.; - break; - case SFX_MAPUNIT_POINT: - - break; - case SFX_MAPUNIT_TWIP: - fRet /= 20.; - break; - default: ;//prevent warning - } - rVal <<= fRet; - } - break; - } - return sal_True; -} -/* -----------------01.07.98 13:43------------------- - * Relative Abweichung aus der Hoehe herausrechnen - * --------------------------------------------------*/ -sal_uInt32 lcl_GetRealHeight_Impl(sal_uInt32 nHeight, sal_uInt16 nProp, SfxMapUnit eProp, sal_Bool bCoreInTwip) -{ - sal_uInt32 nRet = nHeight; - short nDiff = 0; - switch( eProp ) - { - case SFX_MAPUNIT_RELATIVE: - nRet *= 100; - nRet /= nProp; - break; - case SFX_MAPUNIT_POINT: - { - short nTemp = (short)nProp; - nDiff = nTemp * 20; - if(!bCoreInTwip) - nDiff = (short)TWIP_TO_MM100((long)(nDiff)); - } - break; - case SFX_MAPUNIT_100TH_MM: - //dann ist die Core doch wohl auch in 1/100 mm - nDiff = (short)nProp; - break; - case SFX_MAPUNIT_TWIP: - // hier doch sicher TWIP - nDiff = ((short)nProp); - break; - default: ;//prevent warning - } - nRet -= nDiff; - - return nRet; -} - -/*-----------------13.03.98 14:53------------------- - ---------------------------------------------------*/ -sal_Bool SvxFontHeightItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) -{ - sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); - nMemberId &= ~CONVERT_TWIPS; - switch( nMemberId ) - { - case 0: - { - ::com::sun::star::frame::status::FontHeight aFontHeight; - if ( rVal >>= aFontHeight ) - { - // Height - ePropUnit = SFX_MAPUNIT_RELATIVE; - nProp = 100; - double fPoint = aFontHeight.Height; - if( fPoint < 0. || fPoint > 10000. ) - return sal_False; - - nHeight = (long)( fPoint * 20.0 + 0.5 ); // Twips - if (!bConvert) - nHeight = TWIP_TO_MM100_UNSIGNED(nHeight); // umrechnen, wenn das Item 1/100mm enthaelt - - nProp = aFontHeight.Prop; - } - else - return sal_False; - } - break; - case MID_FONTHEIGHT: - { - ePropUnit = SFX_MAPUNIT_RELATIVE; - nProp = 100; - double fPoint = 0; - if(!(rVal >>= fPoint)) - { - sal_Int32 nValue = 0; - if(!(rVal >>= nValue)) - return sal_False; - fPoint = (float)nValue; - } - if(fPoint < 0. || fPoint > 10000.) - return sal_False; - - nHeight = (long)( fPoint * 20.0 + 0.5 ); // Twips - if (!bConvert) - nHeight = TWIP_TO_MM100_UNSIGNED(nHeight); // umrechnen, wenn das Item 1/100mm enthaelt - } - break; - case MID_FONTHEIGHT_PROP: - { - sal_Int16 nNew = sal_Int16(); - if(!(rVal >>= nNew)) - return sal_True; - - nHeight = lcl_GetRealHeight_Impl(nHeight, nProp, ePropUnit, bConvert); - - nHeight *= nNew; - nHeight /= 100; - nProp = nNew; - ePropUnit = SFX_MAPUNIT_RELATIVE; - } - break; - case MID_FONTHEIGHT_DIFF: - { - nHeight = lcl_GetRealHeight_Impl(nHeight, nProp, ePropUnit, bConvert); - float fValue = 0; - if(!(rVal >>= fValue)) - { - sal_Int32 nValue = 0; - if(!(rVal >>= nValue)) - return sal_False; - fValue = (float)nValue; - } - sal_Int16 nCoreDiffValue = (sal_Int16)(fValue * 20.); - nHeight += bConvert ? nCoreDiffValue : TWIP_TO_MM100(nCoreDiffValue); - nProp = (sal_uInt16)((sal_Int16)fValue); - ePropUnit = SFX_MAPUNIT_POINT; - } - break; - } - return sal_True; -} - -//------------------------------------------------------------------------ - -SfxItemPresentation SvxFontHeightItem::GetPresentation -( - SfxItemPresentation ePres, - SfxMapUnit eCoreUnit, - SfxMapUnit /*ePresUnit*/, - XubString& rText, const IntlWrapper *pIntl -) const -{ -#ifndef SVX_LIGHT - switch ( ePres ) - { - case SFX_ITEM_PRESENTATION_NONE: - rText.Erase(); - return ePres; - case SFX_ITEM_PRESENTATION_NAMELESS: - case SFX_ITEM_PRESENTATION_COMPLETE: - { - if( SFX_MAPUNIT_RELATIVE != ePropUnit ) - { - ( rText = String::CreateFromInt32( (short)nProp ) ) += - SVX_RESSTR( GetMetricId( ePropUnit ) ); - if( 0 <= (short)nProp ) - rText.Insert( sal_Unicode('+'), 0 ); - } - else if( 100 == nProp ) - { - rText = GetMetricText( (long)nHeight, - eCoreUnit, SFX_MAPUNIT_POINT, pIntl ); - rText += SVX_RESSTR(GetMetricId(SFX_MAPUNIT_POINT)); - } - else - ( rText = String::CreateFromInt32( nProp )) += sal_Unicode('%'); - return ePres; - } - default: ; //prevent warning - } -#endif - return SFX_ITEM_PRESENTATION_NONE; -} - -// ----------------------------------------------------------------------- - -USHORT SvxFontHeightItem::GetVersion(USHORT nFileVersion) const -{ - return (nFileVersion <= SOFFICE_FILEFORMAT_40) - ? FONTHEIGHT_16_VERSION - : FONTHEIGHT_UNIT_VERSION; -} - -// ----------------------------------------------------------------------- - -int SvxFontHeightItem::ScaleMetrics( long nMult, long nDiv ) -{ - nHeight = (sal_uInt32)Scale( nHeight, nMult, nDiv ); - return 1; -} - -// ----------------------------------------------------------------------- - -int SvxFontHeightItem::HasMetrics() const -{ - return 1; -} - -void SvxFontHeightItem::SetHeight( sal_uInt32 nNewHeight, const USHORT nNewProp, - SfxMapUnit eUnit ) -{ - DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" ); - -#ifndef SVX_LIGHT - if( SFX_MAPUNIT_RELATIVE != eUnit ) - nHeight = nNewHeight + ::ItemToControl( (short)nNewProp, eUnit, - SFX_FUNIT_TWIP ); - else -#endif // !SVX_LIGHT - if( 100 != nNewProp ) - nHeight = sal_uInt32(( nNewHeight * nNewProp ) / 100 ); - else - nHeight = nNewHeight; - - nProp = nNewProp; - ePropUnit = eUnit; -} - -void SvxFontHeightItem::SetHeight( sal_uInt32 nNewHeight, USHORT nNewProp, - SfxMapUnit eMetric, SfxMapUnit eCoreMetric ) -{ - DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" ); - -#ifndef SVX_LIGHT - if( SFX_MAPUNIT_RELATIVE != eMetric ) - nHeight = nNewHeight + - ::ControlToItem( ::ItemToControl((short)nNewProp, eMetric, - SFX_FUNIT_TWIP ), SFX_FUNIT_TWIP, - eCoreMetric ); - else -#endif // !SVX_LIGHT - if( 100 != nNewProp ) - nHeight = sal_uInt32(( nNewHeight * nNewProp ) / 100 ); - else - nHeight = nNewHeight; - - nProp = nNewProp; - ePropUnit = eMetric; -} - -// class SvxFontWidthItem ----------------------------------------------- - -SvxFontWidthItem::SvxFontWidthItem( const USHORT nSz, const USHORT nPrp, const USHORT nId ) : - SfxPoolItem( nId ) -{ - nWidth = nSz; - nProp = nPrp; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxFontWidthItem::Clone( SfxItemPool * ) const -{ - return new SvxFontWidthItem( *this ); -} - -// ----------------------------------------------------------------------- - -SvStream& SvxFontWidthItem::Store( SvStream& rStrm , USHORT /*nItemVersion*/ ) const -{ - rStrm << GetWidth() << GetProp(); - return rStrm; -} - -// ----------------------------------------------------------------------- - -int SvxFontWidthItem::ScaleMetrics( long nMult, long nDiv ) -{ - nWidth = (USHORT)Scale( nWidth, nMult, nDiv ); - return 1; -} - -// ----------------------------------------------------------------------- - -int SvxFontWidthItem::HasMetrics() const -{ - return 1; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxFontWidthItem::Create( SvStream& rStrm, - USHORT /*nVersion*/ ) const -{ - USHORT nS; - USHORT nP; - - rStrm >> nS; - rStrm >> nP; - SvxFontWidthItem* pItem = new SvxFontWidthItem( 0, nP, Which() ); - pItem->SetWidthValue( nS ); - return pItem; -} - -// ----------------------------------------------------------------------- - -int SvxFontWidthItem::operator==( const SfxPoolItem& rItem ) const -{ - DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" ); - return GetWidth() == ((SvxFontWidthItem&)rItem).GetWidth() && - GetProp() == ((SvxFontWidthItem&)rItem).GetProp(); -} - -/*-----------------13.03.98 16:03------------------- - ---------------------------------------------------*/ -sal_Bool SvxFontWidthItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const -{ -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); - nMemberId &= ~CONVERT_TWIPS; - switch(nMemberId) - { - case MID_FONTWIDTH: - rVal <<= (sal_Int16)(nWidth); - break; - case MID_FONTWIDTH_PROP: - rVal <<= (sal_Int16)(nProp); - break; - } - return sal_True; -} -/*-----------------13.03.98 16:03------------------- - ---------------------------------------------------*/ -sal_Bool SvxFontWidthItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) -{ -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); - nMemberId &= ~CONVERT_TWIPS; - sal_Int16 nVal = sal_Int16(); - if(!(rVal >>= nVal)) - return sal_False; - - switch(nMemberId) - { - case MID_FONTWIDTH: - nProp = nVal; - break; - case MID_FONTWIDTH_PROP: - nWidth = nVal; - break; - } - return sal_True; -} - -//------------------------------------------------------------------------ - -SfxItemPresentation SvxFontWidthItem::GetPresentation -( - SfxItemPresentation ePres, - SfxMapUnit eCoreUnit, - SfxMapUnit /*ePresUnit*/, - XubString& rText, const IntlWrapper *pIntl -) const -{ -#ifndef SVX_LIGHT - switch ( ePres ) - { - case SFX_ITEM_PRESENTATION_NONE: - rText.Erase(); - return ePres; - case SFX_ITEM_PRESENTATION_NAMELESS: - case SFX_ITEM_PRESENTATION_COMPLETE: - { - if ( 100 == nProp ) - { - rText = GetMetricText( (long)nWidth, - eCoreUnit, SFX_MAPUNIT_POINT, pIntl ); - rText += SVX_RESSTR(GetMetricId(SFX_MAPUNIT_POINT)); - } - else - ( rText = String::CreateFromInt32( nProp )) += sal_Unicode('%'); - return ePres; - } - default: ; //prevent warning - } -#endif - return SFX_ITEM_PRESENTATION_NONE; -} - -// class SvxTextLineItem ------------------------------------------------ - -SvxTextLineItem::SvxTextLineItem( const FontUnderline eSt, const USHORT nId ) - : SfxEnumItem( nId, (USHORT)eSt ), mColor( COL_TRANSPARENT ) -{ -} - -// ----------------------------------------------------------------------- - -int SvxTextLineItem::HasBoolValue() const -{ - return sal_True; -} - -// ----------------------------------------------------------------------- - -sal_Bool SvxTextLineItem::GetBoolValue() const -{ - return (FontUnderline)GetValue() != UNDERLINE_NONE; -} - -// ----------------------------------------------------------------------- - -void SvxTextLineItem::SetBoolValue( sal_Bool bVal ) -{ - SetValue( (USHORT)(bVal ? UNDERLINE_SINGLE : UNDERLINE_NONE) ); -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxTextLineItem::Clone( SfxItemPool * ) const -{ - SvxTextLineItem* pNew = new SvxTextLineItem( *this ); - pNew->SetColor( GetColor() ); - return pNew; -} - -// ----------------------------------------------------------------------- - -USHORT SvxTextLineItem::GetValueCount() const -{ - return UNDERLINE_DOTTED + 1; // auch UNDERLINE_NONE geh"ort dazu -} - -// ----------------------------------------------------------------------- - -SvStream& SvxTextLineItem::Store( SvStream& rStrm , USHORT /*nItemVersion*/ ) const -{ - rStrm << (BYTE)GetValue(); - return rStrm; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxTextLineItem::Create(SvStream& rStrm, USHORT) const -{ - BYTE nState; - rStrm >> nState; - return new SvxTextLineItem( (FontUnderline)nState, Which() ); -} - -//------------------------------------------------------------------------ - -SfxItemPresentation SvxTextLineItem::GetPresentation -( - SfxItemPresentation ePres, - SfxMapUnit /*eCoreUnit*/, - SfxMapUnit /*ePresUnit*/, - XubString& rText, const IntlWrapper * /*pIntl*/ -) const -{ -#ifndef SVX_LIGHT - switch ( ePres ) - { - case SFX_ITEM_PRESENTATION_NONE: - rText.Erase(); - return ePres; - case SFX_ITEM_PRESENTATION_NAMELESS: - case SFX_ITEM_PRESENTATION_COMPLETE: - rText = GetValueTextByPos( GetValue() ); - if( !mColor.GetTransparency() ) - ( rText += cpDelim ) += ::GetColorString( mColor ); - return ePres; - default: ; //prevent warning - } -#endif - return SFX_ITEM_PRESENTATION_NONE; -} - -// ----------------------------------------------------------------------- - -XubString SvxTextLineItem::GetValueTextByPos( USHORT /*nPos*/ ) const -{ - DBG_ERROR("SvxTextLineItem::GetValueTextByPos: Pure virtual method"); - return XubString(); -} - -/*-----------------13.03.98 16:25------------------- - ---------------------------------------------------*/ -sal_Bool SvxTextLineItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const -{ -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); - nMemberId &= ~CONVERT_TWIPS; - switch(nMemberId) - { - case MID_TEXTLINED: - rVal = Bool2Any(GetBoolValue()); - break; - case MID_TL_STYLE: - rVal <<= (sal_Int16)(GetValue()); - break; - case MID_TL_COLOR: - rVal <<= (sal_Int32)( mColor.GetColor() ); - break; - case MID_TL_HASCOLOR: - rVal = Bool2Any( !mColor.GetTransparency() ); - break; - } - return sal_True; - -} -/*-----------------13.03.98 16:28------------------- - ---------------------------------------------------*/ -sal_Bool SvxTextLineItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) -{ -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); - nMemberId &= ~CONVERT_TWIPS; - sal_Bool bRet = sal_True; - switch(nMemberId) - { - case MID_TEXTLINED: - SetBoolValue(Any2Bool(rVal)); - break; - case MID_TL_STYLE: - { - sal_Int32 nValue = 0; - if(!(rVal >>= nValue)) - bRet = sal_False; - else - SetValue((sal_Int16)nValue); - } - break; - case MID_TL_COLOR: - { - sal_Int32 nCol = 0; - if( !( rVal >>= nCol ) ) - bRet = sal_False; - else - { - // Keep transparence, because it contains the information - // whether the font color or the stored color should be used - sal_uInt8 nTrans = mColor.GetTransparency(); - mColor = Color( nCol ); - mColor.SetTransparency( nTrans ); - } - } - break; - case MID_TL_HASCOLOR: - mColor.SetTransparency( Any2Bool( rVal ) ? 0 : 0xff ); - break; - } - return bRet; -} - -int SvxTextLineItem::operator==( const SfxPoolItem& rItem ) const -{ - DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" ); - return SfxEnumItem::operator==( rItem ) && - GetColor() == ((SvxTextLineItem&)rItem).GetColor(); -} - -// class SvxUnderlineItem ------------------------------------------------ - -SvxUnderlineItem::SvxUnderlineItem( const FontUnderline eSt, const USHORT nId ) - : SvxTextLineItem( eSt, nId ) -{ -} - -//------------------------------------------------------------------------ - -SfxPoolItem* SvxUnderlineItem::Clone( SfxItemPool * ) const -{ - SvxUnderlineItem* pNew = new SvxUnderlineItem( *this ); - pNew->SetColor( GetColor() ); - return pNew; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxUnderlineItem::Create(SvStream& rStrm, USHORT) const -{ - BYTE nState; - rStrm >> nState; - return new SvxUnderlineItem( (FontUnderline)nState, Which() ); -} - -// ----------------------------------------------------------------------- - -XubString SvxUnderlineItem::GetValueTextByPos( USHORT nPos ) const -{ - DBG_ASSERT( nPos <= (USHORT)UNDERLINE_BOLDWAVE, "enum overflow!" ); - return SVX_RESSTR( RID_SVXITEMS_UL_BEGIN + nPos ); -} - -// class SvxOverlineItem ------------------------------------------------ - -SvxOverlineItem::SvxOverlineItem( const FontUnderline eSt, const USHORT nId ) - : SvxTextLineItem( eSt, nId ) -{ -} - -//------------------------------------------------------------------------ - -SfxPoolItem* SvxOverlineItem::Clone( SfxItemPool * ) const -{ - SvxOverlineItem* pNew = new SvxOverlineItem( *this ); - pNew->SetColor( GetColor() ); - return pNew; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxOverlineItem::Create(SvStream& rStrm, USHORT) const -{ - BYTE nState; - rStrm >> nState; - return new SvxOverlineItem( (FontUnderline)nState, Which() ); -} - -// ----------------------------------------------------------------------- - -XubString SvxOverlineItem::GetValueTextByPos( USHORT nPos ) const -{ - DBG_ASSERT( nPos <= (USHORT)UNDERLINE_BOLDWAVE, "enum overflow!" ); - return SVX_RESSTR( RID_SVXITEMS_OL_BEGIN + nPos ); -} - -// class SvxCrossedOutItem ----------------------------------------------- - -SvxCrossedOutItem::SvxCrossedOutItem( const FontStrikeout eSt, const USHORT nId ) - : SfxEnumItem( nId, (USHORT)eSt ) -{ -} - -// ----------------------------------------------------------------------- - -int SvxCrossedOutItem::HasBoolValue() const -{ - return sal_True; -} - -// ----------------------------------------------------------------------- - -sal_Bool SvxCrossedOutItem::GetBoolValue() const -{ - return (FontStrikeout)GetValue() != STRIKEOUT_NONE; -} - -// ----------------------------------------------------------------------- - -void SvxCrossedOutItem::SetBoolValue( sal_Bool bVal ) -{ - SetValue( (USHORT)(bVal ? STRIKEOUT_SINGLE : STRIKEOUT_NONE) ); -} - -// ----------------------------------------------------------------------- - -USHORT SvxCrossedOutItem::GetValueCount() const -{ - return STRIKEOUT_DOUBLE + 1; // auch STRIKEOUT_NONE geh"ort dazu -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxCrossedOutItem::Clone( SfxItemPool * ) const -{ - return new SvxCrossedOutItem( *this ); -} - -// ----------------------------------------------------------------------- - -SvStream& SvxCrossedOutItem::Store( SvStream& rStrm , USHORT /*nItemVersion*/ ) const -{ - rStrm << (BYTE)GetValue(); - return rStrm; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxCrossedOutItem::Create(SvStream& rStrm, USHORT) const -{ - BYTE eCross; - rStrm >> eCross; - return new SvxCrossedOutItem( (FontStrikeout)eCross, Which() ); -} - -//------------------------------------------------------------------------ - -SfxItemPresentation SvxCrossedOutItem::GetPresentation -( - SfxItemPresentation ePres, - SfxMapUnit /*eCoreUnit*/, - SfxMapUnit /*ePresUnit*/, - XubString& rText, const IntlWrapper * /*pIntl*/ -) const -{ - switch ( ePres ) - { - case SFX_ITEM_PRESENTATION_NONE: - rText.Erase(); - return ePres; - case SFX_ITEM_PRESENTATION_NAMELESS: - case SFX_ITEM_PRESENTATION_COMPLETE: - rText = GetValueTextByPos( GetValue() ); - return ePres; - default: ;//prevent warning - } - return SFX_ITEM_PRESENTATION_NONE; -} - -// ----------------------------------------------------------------------- - -XubString SvxCrossedOutItem::GetValueTextByPos( USHORT nPos ) const -{ - DBG_ASSERT( nPos <= (USHORT)STRIKEOUT_X, "enum overflow!" ); - return SVX_RESSTR( RID_SVXITEMS_STRIKEOUT_BEGIN + nPos ); -} - -/*-----------------13.03.98 16:28------------------- - ---------------------------------------------------*/ -sal_Bool SvxCrossedOutItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const -{ -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); - nMemberId &= ~CONVERT_TWIPS; - switch(nMemberId) - { - case MID_CROSSED_OUT: - rVal = Bool2Any(GetBoolValue()); - break; - case MID_CROSS_OUT: - rVal <<= (sal_Int16)(GetValue()); - break; - } - return sal_True; -} -/*-----------------13.03.98 16:29------------------- - ---------------------------------------------------*/ -sal_Bool SvxCrossedOutItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) -{ -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); - nMemberId &= ~CONVERT_TWIPS; - switch(nMemberId) - { - case MID_CROSSED_OUT: - SetBoolValue(Any2Bool(rVal)); - break; - case MID_CROSS_OUT: - { - sal_Int32 nValue = 0; - if(!(rVal >>= nValue)) - return sal_False; - SetValue((sal_Int16)nValue); - } - break; - } - return sal_True; -} -// class SvxShadowedItem ------------------------------------------------- - -SvxShadowedItem::SvxShadowedItem( const sal_Bool bShadowed, const USHORT nId ) : - SfxBoolItem( nId, bShadowed ) -{ -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxShadowedItem::Clone( SfxItemPool * ) const -{ - return new SvxShadowedItem( *this ); -} - -// ----------------------------------------------------------------------- - -SvStream& SvxShadowedItem::Store( SvStream& rStrm , USHORT /*nItemVersion*/ ) const -{ - rStrm << (BYTE) GetValue(); - return rStrm; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxShadowedItem::Create(SvStream& rStrm, USHORT) const -{ - BYTE nState; - rStrm >> nState; - return new SvxShadowedItem( nState, Which() ); -} - -//------------------------------------------------------------------------ - -SfxItemPresentation SvxShadowedItem::GetPresentation -( - SfxItemPresentation ePres, - SfxMapUnit /*eCoreUnit*/, - SfxMapUnit /*ePresUnit*/, - XubString& rText, const IntlWrapper * /*pIntl*/ -) const -{ - switch ( ePres ) - { - case SFX_ITEM_PRESENTATION_NONE: - rText.Erase(); - return ePres; - case SFX_ITEM_PRESENTATION_NAMELESS: - case SFX_ITEM_PRESENTATION_COMPLETE: - { - USHORT nId = RID_SVXITEMS_SHADOWED_FALSE; - - if ( GetValue() ) - nId = RID_SVXITEMS_SHADOWED_TRUE; - rText = SVX_RESSTR(nId); - return ePres; - } - default: ; //prevent warning - } - return SFX_ITEM_PRESENTATION_NONE; -} - -// class SvxAutoKernItem ------------------------------------------------- - -SvxAutoKernItem::SvxAutoKernItem( const sal_Bool bAutoKern, const USHORT nId ) : - SfxBoolItem( nId, bAutoKern ) -{ -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxAutoKernItem::Clone( SfxItemPool * ) const -{ - return new SvxAutoKernItem( *this ); -} - -// ----------------------------------------------------------------------- - -SvStream& SvxAutoKernItem::Store( SvStream& rStrm , USHORT /*nItemVersion*/ ) const -{ - rStrm << (BYTE) GetValue(); - return rStrm; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxAutoKernItem::Create(SvStream& rStrm, USHORT) const -{ - BYTE nState; - rStrm >> nState; - return new SvxAutoKernItem( nState, Which() ); -} - -//------------------------------------------------------------------------ - -SfxItemPresentation SvxAutoKernItem::GetPresentation -( - SfxItemPresentation ePres, - SfxMapUnit /*eCoreUnit*/, - SfxMapUnit /*ePresUnit*/, - XubString& rText, const IntlWrapper * /*pIntl*/ -) const -{ - switch ( ePres ) - { - case SFX_ITEM_PRESENTATION_NONE: - rText.Erase(); - return ePres; - case SFX_ITEM_PRESENTATION_NAMELESS: - case SFX_ITEM_PRESENTATION_COMPLETE: - { - USHORT nId = RID_SVXITEMS_AUTOKERN_FALSE; - - if ( GetValue() ) - nId = RID_SVXITEMS_AUTOKERN_TRUE; - rText = SVX_RESSTR(nId); - return ePres; - } - default: ; //prevent warning - } - return SFX_ITEM_PRESENTATION_NONE; -} - -// class SvxWordLineModeItem --------------------------------------------- - -SvxWordLineModeItem::SvxWordLineModeItem( const sal_Bool bWordLineMode, - const USHORT nId ) : - SfxBoolItem( nId, bWordLineMode ) -{ -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxWordLineModeItem::Clone( SfxItemPool * ) const -{ - return new SvxWordLineModeItem( *this ); -} - -// ----------------------------------------------------------------------- - -SvStream& SvxWordLineModeItem::Store( SvStream& rStrm , USHORT /*nItemVersion*/ ) const -{ - rStrm << (sal_Bool) GetValue(); - return rStrm; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxWordLineModeItem::Create(SvStream& rStrm, USHORT) const -{ - sal_Bool bValue; - rStrm >> bValue; - return new SvxWordLineModeItem( bValue, Which() ); -} - -//------------------------------------------------------------------------ - -SfxItemPresentation SvxWordLineModeItem::GetPresentation -( - SfxItemPresentation ePres, - SfxMapUnit /*eCoreUnit*/, - SfxMapUnit /*ePresUnit*/, - XubString& rText, const IntlWrapper * /*pIntl*/ -) const -{ - switch ( ePres ) - { - case SFX_ITEM_PRESENTATION_NONE: - rText.Erase(); - return ePres; - case SFX_ITEM_PRESENTATION_NAMELESS: - case SFX_ITEM_PRESENTATION_COMPLETE: - { - USHORT nId = RID_SVXITEMS_WORDLINE_FALSE; - - if ( GetValue() ) - nId = RID_SVXITEMS_WORDLINE_TRUE; - rText = SVX_RESSTR(nId); - return ePres; - } - default: ; //prevent warning - } - return SFX_ITEM_PRESENTATION_NONE; -} - -// class SvxContourItem -------------------------------------------------- - -SvxContourItem::SvxContourItem( const sal_Bool bContoured, const USHORT nId ) : - SfxBoolItem( nId, bContoured ) -{ -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxContourItem::Clone( SfxItemPool * ) const -{ - return new SvxContourItem( *this ); -} - -// ----------------------------------------------------------------------- - -SvStream& SvxContourItem::Store( SvStream& rStrm , USHORT /*nItemVersion*/ ) const -{ - rStrm << (sal_Bool) GetValue(); - return rStrm; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxContourItem::Create(SvStream& rStrm, USHORT) const -{ - sal_Bool bValue; - rStrm >> bValue; - return new SvxContourItem( bValue, Which() ); -} - -//------------------------------------------------------------------------ - -SfxItemPresentation SvxContourItem::GetPresentation -( - SfxItemPresentation ePres, - SfxMapUnit /*eCoreUnit*/, - SfxMapUnit /*ePresUnit*/, - XubString& rText, const IntlWrapper * /*pIntl*/ -) const -{ - switch ( ePres ) - { - case SFX_ITEM_PRESENTATION_NONE: - rText.Erase(); - return ePres; - case SFX_ITEM_PRESENTATION_NAMELESS: - case SFX_ITEM_PRESENTATION_COMPLETE: - { - USHORT nId = RID_SVXITEMS_CONTOUR_FALSE; - - if ( GetValue() ) - nId = RID_SVXITEMS_CONTOUR_TRUE; - rText = SVX_RESSTR(nId); - return ePres; - } - default: ; //prevent warning - } - return SFX_ITEM_PRESENTATION_NONE; -} - -// class SvxPropSizeItem ------------------------------------------------- - -SvxPropSizeItem::SvxPropSizeItem( const USHORT nPercent, const USHORT nId ) : - SfxUInt16Item( nId, nPercent ) -{ -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxPropSizeItem::Clone( SfxItemPool * ) const -{ - return new SvxPropSizeItem( *this ); -} - -// ----------------------------------------------------------------------- - -SvStream& SvxPropSizeItem::Store( SvStream& rStrm , USHORT /*nItemVersion*/ ) const -{ - rStrm << (USHORT) GetValue(); - return rStrm; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxPropSizeItem::Create(SvStream& rStrm, USHORT) const -{ - USHORT nSize; - rStrm >> nSize; - return new SvxPropSizeItem( nSize, Which() ); -} - -//------------------------------------------------------------------------ - -SfxItemPresentation SvxPropSizeItem::GetPresentation -( - SfxItemPresentation /*ePres*/, - SfxMapUnit /*eCoreUnit*/, - SfxMapUnit /*ePresUnit*/, - XubString& rText, const IntlWrapper * /*pIntl*/ -) const -{ - rText.Erase(); - return SFX_ITEM_PRESENTATION_NONE; -} - -// class SvxColorItem ---------------------------------------------------- - -SvxColorItem::SvxColorItem( const USHORT nId ) : - SfxPoolItem( nId ), - mColor( COL_BLACK ) -{ -} - -// ----------------------------------------------------------------------- - -SvxColorItem::SvxColorItem( const Color& rCol, const USHORT nId ) : - SfxPoolItem( nId ), - mColor( rCol ) -{ -} - -// ----------------------------------------------------------------------- - -SvxColorItem::SvxColorItem( SvStream &rStrm, const USHORT nId ) : - SfxPoolItem( nId ) -{ - Color aColor; - rStrm >> aColor; - mColor = aColor; -} - -// ----------------------------------------------------------------------- - -SvxColorItem::SvxColorItem( const SvxColorItem &rCopy ) : - SfxPoolItem( rCopy ), - mColor( rCopy.mColor ) -{ -} - -// ----------------------------------------------------------------------- - -SvxColorItem::~SvxColorItem() -{ -} - -// ----------------------------------------------------------------------- -USHORT SvxColorItem::GetVersion( USHORT nFFVer ) const -{ - DBG_ASSERT( SOFFICE_FILEFORMAT_31==nFFVer || - SOFFICE_FILEFORMAT_40==nFFVer || - SOFFICE_FILEFORMAT_50==nFFVer, - "SvxColorItem: Gibt es ein neues Fileformat?" ); - return SOFFICE_FILEFORMAT_50 >= nFFVer ? VERSION_USEAUTOCOLOR : 0; -} - -// ----------------------------------------------------------------------- - -int SvxColorItem::operator==( const SfxPoolItem& rAttr ) const -{ - DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" ); - - return mColor == ( (const SvxColorItem&)rAttr ).mColor; -} - -// ----------------------------------------------------------------------- - -sal_Bool SvxColorItem::QueryValue( uno::Any& rVal, BYTE /*nMemberId*/ ) const -{ - rVal <<= (sal_Int32)(mColor.GetColor()); - return sal_True; -} - -// ----------------------------------------------------------------------- - -sal_Bool SvxColorItem::PutValue( const uno::Any& rVal, BYTE /*nMemberId*/ ) -{ - sal_Int32 nColor = 0; - if(!(rVal >>= nColor)) - return sal_False; - - mColor.SetColor( nColor ); - return sal_True; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxColorItem::Clone( SfxItemPool * ) const -{ - return new SvxColorItem( *this ); -} - -// ----------------------------------------------------------------------- - -SvStream& SvxColorItem::Store( SvStream& rStrm , USHORT nItemVersion ) const -{ - if( VERSION_USEAUTOCOLOR == nItemVersion && - COL_AUTO == mColor.GetColor() ) - rStrm << Color( COL_BLACK ); - else - rStrm << mColor; - return rStrm; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxColorItem::Create(SvStream& rStrm, USHORT /*nVer*/ ) const -{ - return new SvxColorItem( rStrm, Which() ); -} - -//------------------------------------------------------------------------ - -SfxItemPresentation SvxColorItem::GetPresentation -( - SfxItemPresentation ePres, - SfxMapUnit /*eCoreUnit*/, - SfxMapUnit /*ePresUnit*/, - XubString& rText, const IntlWrapper * /*pIntl*/ -) const -{ -#ifndef SVX_LIGHT - switch ( ePres ) - { - case SFX_ITEM_PRESENTATION_NONE: - rText.Erase(); - return ePres; - case SFX_ITEM_PRESENTATION_NAMELESS: - case SFX_ITEM_PRESENTATION_COMPLETE: - rText = ::GetColorString( mColor ); - return ePres; - default: ; //prevent warning - } -#endif - return SFX_ITEM_PRESENTATION_NONE; -} - -// ----------------------------------------------------------------------- - -void SvxColorItem::SetValue( const Color& rNewCol ) -{ - mColor = rNewCol; -} - -// class SvxCharSetColorItem --------------------------------------------- - -SvxCharSetColorItem::SvxCharSetColorItem( const USHORT nId ) : - SvxColorItem( nId ), - - eFrom( RTL_TEXTENCODING_DONTKNOW ) -{ -} - -// ----------------------------------------------------------------------- - -SvxCharSetColorItem::SvxCharSetColorItem( const Color& rCol, - const rtl_TextEncoding _eFrom, - const USHORT nId ) : - SvxColorItem( rCol, nId ), - - eFrom( _eFrom ) -{ -} - - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxCharSetColorItem::Clone( SfxItemPool * ) const -{ - return new SvxCharSetColorItem( *this ); -} - -// ----------------------------------------------------------------------- - -SvStream& SvxCharSetColorItem::Store( SvStream& rStrm , USHORT /*nItemVersion*/ ) const -{ - // #90477# rStrm << (BYTE) GetStoreCharSet( GetCharSet(), (USHORT)rStrm.GetVersion() ) - // << GetValue(); - rStrm << (BYTE)GetSOStoreTextEncoding(GetCharSet(), (sal_uInt16)rStrm.GetVersion()) - << GetValue(); - return rStrm; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxCharSetColorItem::Create(SvStream& rStrm, USHORT) const -{ - BYTE cSet; - Color aColor; - rStrm >> cSet >> aColor; - return new SvxCharSetColorItem( aColor, (rtl_TextEncoding)cSet, Which() ); -} - -//------------------------------------------------------------------------ - -SfxItemPresentation SvxCharSetColorItem::GetPresentation -( - SfxItemPresentation /*ePres*/, - SfxMapUnit /*eCoreUnit*/, - SfxMapUnit /*ePresUnit*/, - XubString& rText, const IntlWrapper * /*pIntl*/ -) const -{ - rText.Erase(); - return SFX_ITEM_PRESENTATION_NONE; -} - -// class SvxKerningItem -------------------------------------------------- - -SvxKerningItem::SvxKerningItem( const short nKern, const USHORT nId ) : - SfxInt16Item( nId, nKern ) -{ -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxKerningItem::Clone( SfxItemPool * ) const -{ - return new SvxKerningItem( *this ); -} - -// ----------------------------------------------------------------------- - -SvStream& SvxKerningItem::Store( SvStream& rStrm , USHORT /*nItemVersion*/ ) const -{ - rStrm << (short) GetValue(); - return rStrm; -} - -// ----------------------------------------------------------------------- - -int SvxKerningItem::ScaleMetrics( long nMult, long nDiv ) -{ - SetValue( (sal_Int16)Scale( GetValue(), nMult, nDiv ) ); - return 1; -} - -// ----------------------------------------------------------------------- - -int SvxKerningItem::HasMetrics() const -{ - return 1; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxKerningItem::Create(SvStream& rStrm, USHORT) const -{ - short nValue; - rStrm >> nValue; - return new SvxKerningItem( nValue, Which() ); -} - -//------------------------------------------------------------------------ - -SfxItemPresentation SvxKerningItem::GetPresentation -( - SfxItemPresentation ePres, - SfxMapUnit eCoreUnit, - SfxMapUnit /*ePresUnit*/, - XubString& rText, const IntlWrapper *pIntl -) const -{ -#ifndef SVX_LIGHT - switch ( ePres ) - { - case SFX_ITEM_PRESENTATION_NONE: - rText.Erase(); - return ePres; - case SFX_ITEM_PRESENTATION_NAMELESS: - rText = GetMetricText( (long)GetValue(), eCoreUnit, SFX_MAPUNIT_POINT, pIntl ); - rText += SVX_RESSTR(GetMetricId(SFX_MAPUNIT_POINT)); - return ePres; - case SFX_ITEM_PRESENTATION_COMPLETE: - { - rText = SVX_RESSTR(RID_SVXITEMS_KERNING_COMPLETE); - USHORT nId = 0; - - if ( GetValue() > 0 ) - nId = RID_SVXITEMS_KERNING_EXPANDED; - else if ( GetValue() < 0 ) - nId = RID_SVXITEMS_KERNING_CONDENSED; - - if ( nId ) - rText += SVX_RESSTR(nId); - rText += GetMetricText( (long)GetValue(), eCoreUnit, SFX_MAPUNIT_POINT, pIntl ); - rText += SVX_RESSTR(GetMetricId(SFX_MAPUNIT_POINT)); - return ePres; - } - default: ; //prevent warning - } -#endif - return SFX_ITEM_PRESENTATION_NONE; -} -/* -----------------------------19.02.01 12:21-------------------------------- - - ---------------------------------------------------------------------------*/ -sal_Bool SvxKerningItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const -{ - sal_Int16 nVal = GetValue(); - if(nMemberId & CONVERT_TWIPS) - nVal = (sal_Int16)TWIP_TO_MM100(nVal); - rVal <<= nVal; - return sal_True; -} -// ----------------------------------------------------------------------- -sal_Bool SvxKerningItem::PutValue( const uno::Any& rVal, BYTE nMemberId) -{ - sal_Int16 nVal = sal_Int16(); - if(!(rVal >>= nVal)) - return sal_False; - if(nMemberId & CONVERT_TWIPS) - nVal = (sal_Int16)MM100_TO_TWIP(nVal); - SetValue(nVal); - return sal_True; -} - -// class SvxCaseMapItem -------------------------------------------------- - -SvxCaseMapItem::SvxCaseMapItem( const SvxCaseMap eMap, const USHORT nId ) : - SfxEnumItem( nId, (USHORT)eMap ) -{ -} - -// ----------------------------------------------------------------------- - -USHORT SvxCaseMapItem::GetValueCount() const -{ - return SVX_CASEMAP_END; // SVX_CASEMAP_KAPITAELCHEN + 1 -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxCaseMapItem::Clone( SfxItemPool * ) const -{ - return new SvxCaseMapItem( *this ); -} - -// ----------------------------------------------------------------------- - -SvStream& SvxCaseMapItem::Store( SvStream& rStrm , USHORT /*nItemVersion*/ ) const -{ - rStrm << (BYTE) GetValue(); - return rStrm; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxCaseMapItem::Create(SvStream& rStrm, USHORT) const -{ - BYTE cMap; - rStrm >> cMap; - return new SvxCaseMapItem( (const SvxCaseMap)cMap, Which() ); -} - -//------------------------------------------------------------------------ - -SfxItemPresentation SvxCaseMapItem::GetPresentation -( - SfxItemPresentation ePres, - SfxMapUnit /*eCoreUnit*/, - SfxMapUnit /*ePresUnit*/, - XubString& rText, const IntlWrapper * /*pIntl*/ -) const -{ - switch ( ePres ) - { - case SFX_ITEM_PRESENTATION_NONE: - rText.Erase(); - return ePres; - case SFX_ITEM_PRESENTATION_NAMELESS: - case SFX_ITEM_PRESENTATION_COMPLETE: - rText = GetValueTextByPos( GetValue() ); - return ePres; - default: ; //prevent warning - } - return SFX_ITEM_PRESENTATION_NONE; -} - -// ----------------------------------------------------------------------- - -XubString SvxCaseMapItem::GetValueTextByPos( USHORT nPos ) const -{ - DBG_ASSERT( nPos < (USHORT)SVX_CASEMAP_END, "enum overflow!" ); - return SVX_RESSTR( RID_SVXITEMS_CASEMAP_BEGIN + nPos ); -} - -/*-----------------13.03.98 16:29------------------- - ---------------------------------------------------*/ -sal_Bool SvxCaseMapItem::QueryValue( uno::Any& rVal, BYTE /*nMemberId*/ ) const -{ - sal_Int16 nRet = style::CaseMap::NONE; - switch( GetValue() ) - { -// case SVX_CASEMAP_NOT_MAPPED : nRet = style::CaseMap::NONE ; break; - case SVX_CASEMAP_VERSALIEN : nRet = style::CaseMap::UPPERCASE; break; - case SVX_CASEMAP_GEMEINE : nRet = style::CaseMap::LOWERCASE; break; - case SVX_CASEMAP_TITEL : nRet = style::CaseMap::TITLE ; break; - case SVX_CASEMAP_KAPITAELCHEN: nRet = style::CaseMap::SMALLCAPS; break; - } - rVal <<= (sal_Int16)(nRet); - return sal_True; -} -/*-----------------13.03.98 16:29------------------- - ---------------------------------------------------*/ -sal_Bool SvxCaseMapItem::PutValue( const uno::Any& rVal, BYTE /*nMemberId*/ ) -{ - sal_uInt16 nVal = sal_uInt16(); - if(!(rVal >>= nVal)) - return sal_False; - - switch( nVal ) - { - case style::CaseMap::NONE : nVal = SVX_CASEMAP_NOT_MAPPED ; break; - case style::CaseMap::UPPERCASE: nVal = SVX_CASEMAP_VERSALIEN ; break; - case style::CaseMap::LOWERCASE: nVal = SVX_CASEMAP_GEMEINE ; break; - case style::CaseMap::TITLE : nVal = SVX_CASEMAP_TITEL ; break; - case style::CaseMap::SMALLCAPS: nVal = SVX_CASEMAP_KAPITAELCHEN; break; - } - SetValue(nVal); - return sal_True; -} - -// class SvxEscapementItem ----------------------------------------------- - -SvxEscapementItem::SvxEscapementItem( const USHORT nId ) : - SfxEnumItemInterface( nId ), - - nEsc ( 0 ), - nProp ( 100 ) -{ -} - -// ----------------------------------------------------------------------- - -SvxEscapementItem::SvxEscapementItem( const SvxEscapement eEscape, - const USHORT nId ) : - SfxEnumItemInterface( nId ), - nProp( 100 ) -{ - SetEscapement( eEscape ); - if( nEsc ) - nProp = 58; -} - -// ----------------------------------------------------------------------- - -SvxEscapementItem::SvxEscapementItem( const short _nEsc, - const BYTE _nProp, - const USHORT nId ) : - SfxEnumItemInterface( nId ), - nEsc ( _nEsc ), - nProp ( _nProp ) -{ -} - -// ----------------------------------------------------------------------- - -int SvxEscapementItem::operator==( const SfxPoolItem& rAttr ) const -{ - DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" ); - - return( nEsc == ((SvxEscapementItem&)rAttr).nEsc && - nProp == ((SvxEscapementItem&)rAttr).nProp ); -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxEscapementItem::Clone( SfxItemPool * ) const -{ - return new SvxEscapementItem( *this ); -} - -// ----------------------------------------------------------------------- - -SvStream& SvxEscapementItem::Store( SvStream& rStrm , USHORT /*nItemVersion*/ ) const -{ - short _nEsc = GetEsc(); - if( SOFFICE_FILEFORMAT_31 == rStrm.GetVersion() ) - { - if( DFLT_ESC_AUTO_SUPER == _nEsc ) - _nEsc = DFLT_ESC_SUPER; - else if( DFLT_ESC_AUTO_SUB == _nEsc ) - _nEsc = DFLT_ESC_SUB; - } - rStrm << (BYTE) GetProp() - << (short) _nEsc; - return rStrm; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxEscapementItem::Create(SvStream& rStrm, USHORT) const -{ - BYTE _nProp; - short _nEsc; - rStrm >> _nProp >> _nEsc; - return new SvxEscapementItem( _nEsc, _nProp, Which() ); -} - -// ----------------------------------------------------------------------- - -USHORT SvxEscapementItem::GetValueCount() const -{ - return SVX_ESCAPEMENT_END; // SVX_ESCAPEMENT_SUBSCRIPT + 1 -} - -//------------------------------------------------------------------------ - -SfxItemPresentation SvxEscapementItem::GetPresentation -( - SfxItemPresentation ePres, - SfxMapUnit /*eCoreUnit*/, - SfxMapUnit /*ePresUnit*/, - XubString& rText, const IntlWrapper * /*pIntl*/ -) const -{ - switch ( ePres ) - { - case SFX_ITEM_PRESENTATION_NONE: - rText.Erase(); - return ePres; - case SFX_ITEM_PRESENTATION_NAMELESS: - case SFX_ITEM_PRESENTATION_COMPLETE: - { - rText = GetValueTextByPos( GetEnumValue() ); - - if ( nEsc != 0 ) - { - if( DFLT_ESC_AUTO_SUPER == nEsc || DFLT_ESC_AUTO_SUB == nEsc ) - rText += String( SVX_RESSTR(RID_SVXITEMS_ESCAPEMENT_AUTO) ); - else - ( rText += String::CreateFromInt32( nEsc )) += sal_Unicode('%'); - } - return ePres; - } - default: ; //prevent warning - } - return SFX_ITEM_PRESENTATION_NONE; -} - -// ----------------------------------------------------------------------- - -XubString SvxEscapementItem::GetValueTextByPos( USHORT nPos ) const -{ - DBG_ASSERT( nPos < (USHORT)SVX_ESCAPEMENT_END, "enum overflow!" ); - return SVX_RESSTR(RID_SVXITEMS_ESCAPEMENT_BEGIN + nPos); -} - -// ----------------------------------------------------------------------- - -USHORT SvxEscapementItem::GetEnumValue() const -{ - if ( nEsc < 0 ) - return SVX_ESCAPEMENT_SUBSCRIPT; - else if ( nEsc > 0 ) - return SVX_ESCAPEMENT_SUPERSCRIPT; - return SVX_ESCAPEMENT_OFF; -} - -// ----------------------------------------------------------------------- - -void SvxEscapementItem::SetEnumValue( USHORT nVal ) -{ - SetEscapement( (const SvxEscapement)nVal ); -} - -/*-----------------13.03.98 17:05------------------- - ---------------------------------------------------*/ -sal_Bool SvxEscapementItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const -{ -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); - nMemberId &= ~CONVERT_TWIPS; - switch(nMemberId) - { - case MID_ESC: - rVal <<= (sal_Int16)(nEsc); - break; - case MID_ESC_HEIGHT: - rVal <<= (sal_Int8)(nProp); - break; - case MID_AUTO_ESC: - rVal = Bool2Any(DFLT_ESC_AUTO_SUB == nEsc || DFLT_ESC_AUTO_SUPER == nEsc); - break; - } - return sal_True; -} -/*-----------------13.03.98 17:05------------------- - ---------------------------------------------------*/ -sal_Bool SvxEscapementItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) -{ -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); - nMemberId &= ~CONVERT_TWIPS; - switch(nMemberId) - { - case MID_ESC: - { - sal_Int16 nVal = sal_Int16(); - if( (rVal >>= nVal) && (Abs(nVal) <= 101)) - nEsc = nVal; - else - return sal_False; - } - break; - case MID_ESC_HEIGHT: - { - sal_Int8 nVal = sal_Int8(); - if( (rVal >>= nVal) && (nVal <= 100)) - nProp = nVal; - else - return sal_False; - } - break; - case MID_AUTO_ESC: - { - BOOL bVal = Any2Bool(rVal); - if(bVal) - { - if(nEsc < 0) - nEsc = DFLT_ESC_AUTO_SUB; - else - nEsc = DFLT_ESC_AUTO_SUPER; - } - else - if(DFLT_ESC_AUTO_SUPER == nEsc ) - --nEsc; - else if(DFLT_ESC_AUTO_SUB == nEsc) - ++nEsc; - } - break; - } - return sal_True; -} - -// class SvxLanguageItem ------------------------------------------------- - -SvxLanguageItem::SvxLanguageItem( const LanguageType eLang, const USHORT nId ) - : SfxEnumItem( nId , eLang ) -{ -} - -// ----------------------------------------------------------------------- - -USHORT SvxLanguageItem::GetValueCount() const -{ - // #i50205# got rid of class International - DBG_ERRORFILE("SvxLanguageItem::GetValueCount: supposed to return a count of what?"); - // FIXME: previously returned LANGUAGE_COUNT from tools/intn.hxx which was wrong anyway. - // Could be SvtLanguageTable::GetEntryCount() (all locales with resource string)? - // Could be LocaleDataWrapper::getInstalledLanguageTypes() (all locales with locale data)? - return 0; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxLanguageItem::Clone( SfxItemPool * ) const -{ - return new SvxLanguageItem( *this ); -} - -// ----------------------------------------------------------------------- - -SvStream& SvxLanguageItem::Store( SvStream& rStrm , USHORT /*nItemVersion*/ ) const -{ - rStrm << (USHORT) GetValue(); - return rStrm; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxLanguageItem::Create(SvStream& rStrm, USHORT) const -{ - USHORT nValue; - rStrm >> nValue; - return new SvxLanguageItem( (LanguageType)nValue, Which() ); -} - -//------------------------------------------------------------------------ - -SfxItemPresentation SvxLanguageItem::GetPresentation -( - SfxItemPresentation ePres, - SfxMapUnit /*eCoreUnit*/, - SfxMapUnit /*ePresUnit*/, - XubString& rText, const IntlWrapper * /*pIntl*/ -) const -{ -#ifndef SVX_LIGHT - switch ( ePres ) - { - case SFX_ITEM_PRESENTATION_NONE: - rText.Erase(); - return ePres; - case SFX_ITEM_PRESENTATION_NAMELESS: - case SFX_ITEM_PRESENTATION_COMPLETE: - { - SvtLanguageTable aLangTable; - rText = aLangTable.GetString( (LanguageType)GetValue() ); - return ePres; - } - default: ; //prevent warning - } -#endif // !SVX_LIGHT - return SFX_ITEM_PRESENTATION_NONE; -} - -/*-----------------14.03.98 14:13------------------- - ---------------------------------------------------*/ -sal_Bool SvxLanguageItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const -{ -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); - nMemberId &= ~CONVERT_TWIPS; - switch(nMemberId) - { - case MID_LANG_INT: // for basic conversions! - rVal <<= (sal_Int16)(GetValue()); - break; - case MID_LANG_LOCALE: - lang::Locale aRet( MsLangId::convertLanguageToLocale( GetValue(), false)); - rVal <<= aRet; - break; - } - return sal_True; -} -/*-----------------14.03.98 14:13------------------- - ---------------------------------------------------*/ -sal_Bool SvxLanguageItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) -{ -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); - nMemberId &= ~CONVERT_TWIPS; - switch(nMemberId) - { - case MID_LANG_INT: // for basic conversions! - { - sal_Int32 nValue = 0; - if(!(rVal >>= nValue)) - return sal_False; - - SetValue((sal_Int16)nValue); - } - break; - case MID_LANG_LOCALE: - { - lang::Locale aLocale; - if(!(rVal >>= aLocale)) - return sal_False; - - if (aLocale.Language.getLength() || aLocale.Country.getLength()) - SetValue(MsLangId::convertLocaleToLanguage( aLocale )); - else - SetValue(LANGUAGE_NONE); - } - break; - } - return sal_True; -} - -// class SvxNoLinebreakItem ---------------------------------------------- -SvxNoLinebreakItem::SvxNoLinebreakItem( const sal_Bool bBreak, const USHORT nId ) : - SfxBoolItem( nId, bBreak ) -{ -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxNoLinebreakItem::Clone( SfxItemPool* ) const -{ - return new SvxNoLinebreakItem( *this ); -} - -// ----------------------------------------------------------------------- - -SvStream& SvxNoLinebreakItem::Store( SvStream& rStrm , USHORT /*nItemVersion*/ ) const -{ - rStrm << (sal_Bool)GetValue(); - return rStrm; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxNoLinebreakItem::Create(SvStream& rStrm, USHORT) const -{ - sal_Bool bValue; - rStrm >> bValue; - return new SvxNoLinebreakItem( bValue, Which() ); -} - -//------------------------------------------------------------------------ - -SfxItemPresentation SvxNoLinebreakItem::GetPresentation -( - SfxItemPresentation /*ePres*/, - SfxMapUnit /*eCoreUnit*/, - SfxMapUnit /*ePresUnit*/, - XubString& rText, const IntlWrapper * /*pIntl*/ -) const -{ - rText.Erase(); - return SFX_ITEM_PRESENTATION_NONE; -} - -// class SvxNoHyphenItem ------------------------------------------------- - -SvxNoHyphenItem::SvxNoHyphenItem( const sal_Bool bHyphen, const USHORT nId ) : - SfxBoolItem( nId , bHyphen ) -{ -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxNoHyphenItem::Clone( SfxItemPool* ) const -{ - return new SvxNoHyphenItem( *this ); -} - -// ----------------------------------------------------------------------- - -SvStream& SvxNoHyphenItem::Store( SvStream& rStrm , USHORT /*nItemVersion*/ ) const -{ - rStrm << (sal_Bool) GetValue(); - return rStrm; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxNoHyphenItem::Create( SvStream& rStrm, USHORT ) const -{ - sal_Bool bValue; - rStrm >> bValue; - return new SvxNoHyphenItem( bValue, Which() ); -} - -//------------------------------------------------------------------------ - -SfxItemPresentation SvxNoHyphenItem::GetPresentation -( - SfxItemPresentation /*ePres*/, - SfxMapUnit /*eCoreUnit*/, - SfxMapUnit /*ePresUnit*/, - XubString& rText, const IntlWrapper * /*pIntl*/ -) const -{ - rText.Erase(); - return SFX_ITEM_PRESENTATION_NONE; -} - -/* - * Dummy-Item fuer ToolBox-Controls: - * - */ - -// ----------------------------------------------------------------------- -// class SvxLineColorItem (== SvxColorItem) -// ----------------------------------------------------------------------- - -SvxLineColorItem::SvxLineColorItem( const USHORT nId ) : - SvxColorItem( nId ) -{ -} - -// ----------------------------------------------------------------------- - -SvxLineColorItem::SvxLineColorItem( const Color& rCol, const USHORT nId ) : - SvxColorItem( rCol, nId ) -{ -} - -// ----------------------------------------------------------------------- - -SvxLineColorItem::SvxLineColorItem( SvStream &rStrm, const USHORT nId ) : - SvxColorItem( rStrm, nId ) -{ -} - -// ----------------------------------------------------------------------- - -SvxLineColorItem::SvxLineColorItem( const SvxLineColorItem &rCopy ) : - SvxColorItem( rCopy ) -{ -} - -// ----------------------------------------------------------------------- - -SvxLineColorItem::~SvxLineColorItem() -{ -} - -//------------------------------------------------------------------------ - -SfxItemPresentation SvxLineColorItem::GetPresentation -( - SfxItemPresentation ePres, - SfxMapUnit eCoreUnit, - SfxMapUnit ePresUnit, - XubString& rText, - const IntlWrapper * pIntlWrapper -) const -{ - return SvxColorItem::GetPresentation( ePres, eCoreUnit, ePresUnit, - rText, pIntlWrapper ); -} - -// class SvxBlinkItem ------------------------------------------------- - - -SvxBlinkItem::SvxBlinkItem( const sal_Bool bBlink, const USHORT nId ) : - SfxBoolItem( nId, bBlink ) -{ -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxBlinkItem::Clone( SfxItemPool * ) const -{ - return new SvxBlinkItem( *this ); -} - -// ----------------------------------------------------------------------- - -SvStream& SvxBlinkItem::Store( SvStream& rStrm , USHORT /*nItemVersion*/ ) const -{ - rStrm << (BYTE) GetValue(); - return rStrm; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxBlinkItem::Create(SvStream& rStrm, USHORT) const -{ - BYTE nState; - rStrm >> nState; - return new SvxBlinkItem( nState, Which() ); -} - -// ----------------------------------------------------------------------- - -SfxItemPresentation SvxBlinkItem::GetPresentation -( - SfxItemPresentation ePres, - SfxMapUnit /*eCoreUnit*/, - SfxMapUnit /*ePresUnit*/, - XubString& rText, const IntlWrapper * /*pIntl*/ -) const -{ - switch ( ePres ) - { - case SFX_ITEM_PRESENTATION_NONE: - rText.Erase(); - return ePres; - case SFX_ITEM_PRESENTATION_NAMELESS: - case SFX_ITEM_PRESENTATION_COMPLETE: - { - USHORT nId = RID_SVXITEMS_BLINK_FALSE; - - if ( GetValue() ) - nId = RID_SVXITEMS_BLINK_TRUE; - rText = SVX_RESSTR(nId); - return ePres; - } - default: ; //prevent warning - } - return SFX_ITEM_PRESENTATION_NONE; -} - -// class SvxEmphaisMarkItem --------------------------------------------------- - -SvxEmphasisMarkItem::SvxEmphasisMarkItem( const FontEmphasisMark nValue, - const USHORT nId ) - : SfxUInt16Item( nId, nValue ) -{ -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxEmphasisMarkItem::Clone( SfxItemPool * ) const -{ - return new SvxEmphasisMarkItem( *this ); -} - -// ----------------------------------------------------------------------- - -SvStream& SvxEmphasisMarkItem::Store( SvStream& rStrm, - USHORT /*nItemVersion*/ ) const -{ - rStrm << (sal_uInt16)GetValue(); - return rStrm; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxEmphasisMarkItem::Create( SvStream& rStrm, USHORT ) const -{ - sal_uInt16 nValue; - rStrm >> nValue; - return new SvxEmphasisMarkItem( (FontEmphasisMark)nValue, Which() ); -} - -//------------------------------------------------------------------------ - -SfxItemPresentation SvxEmphasisMarkItem::GetPresentation -( - SfxItemPresentation ePres, - SfxMapUnit /*eCoreUnit*/, - SfxMapUnit /*ePresUnit*/, - XubString& rText, - const IntlWrapper * /*pIntl*/ -) const -{ - switch ( ePres ) - { - case SFX_ITEM_PRESENTATION_NONE: - rText.Erase(); - return ePres; - case SFX_ITEM_PRESENTATION_NAMELESS: - case SFX_ITEM_PRESENTATION_COMPLETE: - { - sal_uInt16 nVal = GetValue(); - rText = SVX_RESSTR( RID_SVXITEMS_EMPHASIS_BEGIN_STYLE + - ( EMPHASISMARK_STYLE & nVal )); - USHORT nId = ( EMPHASISMARK_POS_ABOVE & nVal ) - ? RID_SVXITEMS_EMPHASIS_ABOVE_POS - : ( EMPHASISMARK_POS_BELOW & nVal ) - ? RID_SVXITEMS_EMPHASIS_BELOW_POS - : 0; - if( nId ) - rText += SVX_RESSTR( nId ); - return ePres; - } - default: ; //prevent warning - } - return SFX_ITEM_PRESENTATION_NONE; -} - -// ----------------------------------------------------------------------- - -sal_Bool SvxEmphasisMarkItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const -{ -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); - nMemberId &= ~CONVERT_TWIPS; - switch( nMemberId ) - { - case MID_EMPHASIS: - { - sal_Int16 nValue = GetValue(); - sal_Int16 nRet = 0; - switch(nValue & EMPHASISMARK_STYLE) - { - case EMPHASISMARK_NONE : nRet = FontEmphasis::NONE; break; - case EMPHASISMARK_DOT : nRet = FontEmphasis::DOT_ABOVE; break; - case EMPHASISMARK_CIRCLE : nRet = FontEmphasis::CIRCLE_ABOVE; break; - case EMPHASISMARK_DISC : nRet = FontEmphasis::DISK_ABOVE; break; - case EMPHASISMARK_ACCENT : nRet = FontEmphasis::ACCENT_ABOVE; break; - } - if(nRet && nValue & EMPHASISMARK_POS_BELOW) - nRet += 10; - rVal <<= nRet; - } - break; - } - return sal_True; -} - -sal_Bool SvxEmphasisMarkItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) -{ -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); - nMemberId &= ~CONVERT_TWIPS; - sal_Bool bRet = sal_True; - switch( nMemberId ) - { - case MID_EMPHASIS: - { - sal_Int32 nValue = -1; - rVal >>= nValue; - switch(nValue) - { - case FontEmphasis::NONE : nValue = EMPHASISMARK_NONE; break; - case FontEmphasis::DOT_ABOVE : nValue = EMPHASISMARK_DOT|EMPHASISMARK_POS_ABOVE; break; - case FontEmphasis::CIRCLE_ABOVE: nValue = EMPHASISMARK_CIRCLE|EMPHASISMARK_POS_ABOVE; break; - case FontEmphasis::DISK_ABOVE : nValue = EMPHASISMARK_DISC|EMPHASISMARK_POS_ABOVE; break; - case FontEmphasis::ACCENT_ABOVE: nValue = EMPHASISMARK_ACCENT|EMPHASISMARK_POS_ABOVE; break; - case FontEmphasis::DOT_BELOW : nValue = EMPHASISMARK_DOT|EMPHASISMARK_POS_BELOW; break; - case FontEmphasis::CIRCLE_BELOW: nValue = EMPHASISMARK_CIRCLE|EMPHASISMARK_POS_BELOW; break; - case FontEmphasis::DISK_BELOW : nValue = EMPHASISMARK_DISC|EMPHASISMARK_POS_BELOW; break; - case FontEmphasis::ACCENT_BELOW: nValue = EMPHASISMARK_ACCENT|EMPHASISMARK_POS_BELOW; break; - default: return sal_False; - } - SetValue( (sal_Int16)nValue ); - } - break; - } - return bRet; -} - -USHORT SvxEmphasisMarkItem::GetVersion( USHORT nFFVer ) const -{ - DBG_ASSERT( SOFFICE_FILEFORMAT_31==nFFVer || - SOFFICE_FILEFORMAT_40==nFFVer || - SOFFICE_FILEFORMAT_50==nFFVer, - "SvxEmphasisMarkItem: Gibt es ein neues Fileformat?" ); - - return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0; -} - - -/************************************************************************* -|* class SvxTwoLinesItem -*************************************************************************/ - -SvxTwoLinesItem::SvxTwoLinesItem( sal_Bool bFlag, sal_Unicode nStartBracket, - sal_Unicode nEndBracket, sal_uInt16 nW ) - : SfxPoolItem( nW ), - cStartBracket( nStartBracket ), cEndBracket( nEndBracket ), bOn( bFlag ) -{ -} - -SvxTwoLinesItem::SvxTwoLinesItem( const SvxTwoLinesItem& rAttr ) - : SfxPoolItem( rAttr.Which() ), - cStartBracket( rAttr.cStartBracket ), - cEndBracket( rAttr.cEndBracket ), - bOn( rAttr.bOn ) -{ -} - -SvxTwoLinesItem::~SvxTwoLinesItem() -{ -} - -int SvxTwoLinesItem::operator==( const SfxPoolItem& rAttr ) const -{ - DBG_ASSERT( SfxPoolItem::operator==( rAttr ), "not equal attribute types" ); - return bOn == ((SvxTwoLinesItem&)rAttr).bOn && - cStartBracket == ((SvxTwoLinesItem&)rAttr).cStartBracket && - cEndBracket == ((SvxTwoLinesItem&)rAttr).cEndBracket; -} - -SfxPoolItem* SvxTwoLinesItem::Clone( SfxItemPool* ) const -{ - return new SvxTwoLinesItem( *this ); -} - -sal_Bool SvxTwoLinesItem::QueryValue( com::sun::star::uno::Any& rVal, - BYTE nMemberId ) const -{ -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); - nMemberId &= ~CONVERT_TWIPS; - sal_Bool bRet = sal_True; - switch( nMemberId ) - { - case MID_TWOLINES: - rVal = Bool2Any( bOn ); - break; - case MID_START_BRACKET: - { - OUString s; - if( cStartBracket ) - s = OUString( cStartBracket ); - rVal <<= s; - } - break; - case MID_END_BRACKET: - { - OUString s; - if( cEndBracket ) - s = OUString( cEndBracket ); - rVal <<= s; - } - break; - default: - bRet = sal_False; - break; - } - return bRet; -} - -sal_Bool SvxTwoLinesItem::PutValue( const com::sun::star::uno::Any& rVal, - BYTE nMemberId ) -{ -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); - nMemberId &= ~CONVERT_TWIPS; - sal_Bool bRet = sal_False; - OUString s; - switch( nMemberId ) - { - case MID_TWOLINES: - bOn = Any2Bool( rVal ); - bRet = sal_True; - break; - case MID_START_BRACKET: - if( rVal >>= s ) - { - cStartBracket = s.getLength() ? s[ 0 ] : 0; - bRet = sal_True; - } - break; - case MID_END_BRACKET: - if( rVal >>= s ) - { - cEndBracket = s.getLength() ? s[ 0 ] : 0; - bRet = sal_True; - } - break; - } - return bRet; -} - -SfxItemPresentation SvxTwoLinesItem::GetPresentation( SfxItemPresentation ePres, - SfxMapUnit /*eCoreMetric*/, SfxMapUnit /*ePresMetric*/, - String &rText, const IntlWrapper* /*pIntl*/ ) const -{ - switch( ePres ) - { - case SFX_ITEM_PRESENTATION_NONE: - rText.Erase(); - break; - case SFX_ITEM_PRESENTATION_NAMELESS: - case SFX_ITEM_PRESENTATION_COMPLETE: - { - if( !GetValue() ) - rText = SVX_RESSTR( RID_SVXITEMS_TWOLINES_OFF ); - else - { - rText = SVX_RESSTR( RID_SVXITEMS_TWOLINES ); - if( GetStartBracket() ) - rText.Insert( GetStartBracket(), 0 ); - if( GetEndBracket() ) - rText += GetEndBracket(); - } - return ePres; - } - default: ; //prevent warning - } - return SFX_ITEM_PRESENTATION_NONE; -} - - -SfxPoolItem* SvxTwoLinesItem::Create( SvStream & rStrm, USHORT /*nVer*/) const -{ - sal_Bool _bOn; - sal_Unicode cStart, cEnd; - rStrm >> _bOn >> cStart >> cEnd; - return new SvxTwoLinesItem( _bOn, cStart, cEnd, Which() ); -} - -SvStream& SvxTwoLinesItem::Store(SvStream & rStrm, USHORT /*nIVer*/) const -{ - rStrm << GetValue() << GetStartBracket() << GetEndBracket(); - return rStrm; -} - -USHORT SvxTwoLinesItem::GetVersion( USHORT nFFVer ) const -{ - DBG_ASSERT( SOFFICE_FILEFORMAT_31==nFFVer || - SOFFICE_FILEFORMAT_40==nFFVer || - SOFFICE_FILEFORMAT_50==nFFVer, - "SvxTwoLinesItem: Gibt es ein neues Fileformat?" ); - - return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0; -} - - -/************************************************************************* -|* class SvxCharRotateItem -*************************************************************************/ - -SvxCharRotateItem::SvxCharRotateItem( sal_uInt16 nValue, - sal_Bool bFitIntoLine, - const sal_uInt16 nW ) - : SfxUInt16Item( nW, nValue ), bFitToLine( bFitIntoLine ) -{ -} - -SfxPoolItem* SvxCharRotateItem::Clone( SfxItemPool* ) const -{ - return new SvxCharRotateItem( GetValue(), IsFitToLine(), Which() ); -} - -SfxPoolItem* SvxCharRotateItem::Create( SvStream& rStrm, USHORT ) const -{ - sal_uInt16 nVal; - sal_Bool b; - rStrm >> nVal >> b; - return new SvxCharRotateItem( nVal, b, Which() ); -} - -SvStream& SvxCharRotateItem::Store( SvStream & rStrm, USHORT ) const -{ - sal_Bool bFlag = IsFitToLine(); - rStrm << GetValue() << bFlag; - return rStrm; -} - -USHORT SvxCharRotateItem::GetVersion( USHORT nFFVer ) const -{ - return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0; -} - -SfxItemPresentation SvxCharRotateItem::GetPresentation( - SfxItemPresentation ePres, - SfxMapUnit /*eCoreMetric*/, SfxMapUnit /*ePresMetric*/, - String &rText, const IntlWrapper* ) const -{ - switch( ePres ) - { - case SFX_ITEM_PRESENTATION_NONE: - rText.Erase(); - break; - case SFX_ITEM_PRESENTATION_NAMELESS: - case SFX_ITEM_PRESENTATION_COMPLETE: - { - if( !GetValue() ) - rText = SVX_RESSTR( RID_SVXITEMS_CHARROTATE_OFF ); - else - { - rText = SVX_RESSTR( RID_SVXITEMS_CHARROTATE ); - rText.SearchAndReplaceAscii( "$(ARG1)", - String::CreateFromInt32( GetValue() / 10 )); - if( IsFitToLine() ) - rText += SVX_RESSTR( RID_SVXITEMS_CHARROTATE_FITLINE ); - } - return ePres; - } - default: ; //prevent warning - } - return SFX_ITEM_PRESENTATION_NONE; -} - -sal_Bool SvxCharRotateItem::QueryValue( com::sun::star::uno::Any& rVal, - BYTE nMemberId ) const -{ -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); - nMemberId &= ~CONVERT_TWIPS; - sal_Bool bRet = sal_True; - switch( nMemberId ) - { - case MID_ROTATE: - rVal <<= (sal_Int16)GetValue(); - break; - case MID_FITTOLINE: - rVal = Bool2Any( IsFitToLine() ); - break; - default: - bRet = sal_False; - break; - } - return bRet; -} - -sal_Bool SvxCharRotateItem::PutValue( const com::sun::star::uno::Any& rVal, - BYTE nMemberId ) -{ -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); - nMemberId &= ~CONVERT_TWIPS; - sal_Bool bRet = sal_True; - switch( nMemberId ) - { - case MID_ROTATE: - { - sal_Int16 nVal = 0; - if((rVal >>= nVal) && (0 == nVal || 900 == nVal || 2700 == nVal)) - SetValue( (USHORT)nVal ); - else - bRet = sal_False; - break; - } - - case MID_FITTOLINE: - SetFitToLine( Any2Bool( rVal ) ); - break; - default: - bRet = sal_False; - } - return bRet; -} - -int SvxCharRotateItem::operator==( const SfxPoolItem& rItem ) const -{ - DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" ); - return SfxUInt16Item::operator==( rItem ) && - IsFitToLine() == ((const SvxCharRotateItem&)rItem).IsFitToLine(); -} - - -/************************************************************************* -|* class SvxCharScaleItem -*************************************************************************/ - -SvxCharScaleWidthItem::SvxCharScaleWidthItem( sal_uInt16 nValue, - const sal_uInt16 nW ) - : SfxUInt16Item( nW, nValue ) -{ -} - -SfxPoolItem* SvxCharScaleWidthItem::Clone( SfxItemPool* ) const -{ - return new SvxCharScaleWidthItem( GetValue(), Which() ); -} - -SfxPoolItem* SvxCharScaleWidthItem::Create( SvStream& rStrm, USHORT ) const -{ - sal_uInt16 nVal; - rStrm >> nVal; - SvxCharScaleWidthItem* pItem = new SvxCharScaleWidthItem( nVal, Which() ); - - if ( Which() == EE_CHAR_FONTWIDTH ) - { - // #87271#: Was a SvxFontWidthItem in 5.2 - // USHORT nFixWidth, USHORT nPropWidth. - // nFixWidth has never been used... - rStrm >> nVal; - USHORT nTest; - rStrm >> nTest; - if ( nTest == 0x1234 ) - pItem->SetValue( nVal ); - else - rStrm.SeekRel( -2*(long)sizeof(sal_uInt16) ); - } - - return pItem; -} - -SvStream& SvxCharScaleWidthItem::Store( SvStream& rStream, USHORT nVer ) const -{ - SvStream& rRet = SfxUInt16Item::Store( rStream, nVer ); - if ( Which() == EE_CHAR_FONTWIDTH ) - { - // see comment in Create().... - rRet.SeekRel( -1*(long)sizeof(USHORT) ); - rRet << (USHORT)0; - rRet << GetValue(); - // Really ugly, but not a problem for reading the doc in 5.2 - rRet << (USHORT)0x1234; - } - return rRet; -} - - -USHORT SvxCharScaleWidthItem::GetVersion( USHORT nFFVer ) const -{ - return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0; -} - -SfxItemPresentation SvxCharScaleWidthItem::GetPresentation( - SfxItemPresentation ePres, - SfxMapUnit /*eCoreMetric*/, SfxMapUnit /*ePresMetric*/, - String &rText, const IntlWrapper* ) const -{ - switch( ePres ) - { - case SFX_ITEM_PRESENTATION_NONE: - rText.Erase(); - break; - case SFX_ITEM_PRESENTATION_NAMELESS: - case SFX_ITEM_PRESENTATION_COMPLETE: - { - if( !GetValue() ) - rText = SVX_RESSTR( RID_SVXITEMS_CHARSCALE_OFF ); - else - { - rText = SVX_RESSTR( RID_SVXITEMS_CHARSCALE ); - rText.SearchAndReplaceAscii( "$(ARG1)", - String::CreateFromInt32( GetValue() )); - } - return ePres; - } - default: ; //prevent warning - } - return SFX_ITEM_PRESENTATION_NONE; -} - -sal_Bool SvxCharScaleWidthItem::PutValue( const uno::Any& rVal, BYTE /*nMemberId*/ ) -{ - // SfxUInt16Item::QueryValue returns sal_Int32 in Any now... (srx642w) - // where we still want this to be a sal_Int16 - sal_Int16 nValue = sal_Int16(); - if (rVal >>= nValue) - { - SetValue( (UINT16) nValue ); - return TRUE; - } - - DBG_ERROR( "SvxCharScaleWidthItem::PutValue - Wrong type!" ); - return FALSE; -} - -sal_Bool SvxCharScaleWidthItem::QueryValue( uno::Any& rVal, BYTE /*nMemberId*/ ) const -{ - // SfxUInt16Item::QueryValue returns sal_Int32 in Any now... (srx642w) - // where we still want this to be a sal_Int16 - rVal <<= (sal_Int16)GetValue(); - return TRUE; -} - -/************************************************************************* -|* class SvxCharReliefItem -*************************************************************************/ - -SvxCharReliefItem::SvxCharReliefItem( FontRelief eValue, - const sal_uInt16 nId ) - : SfxEnumItem( nId, (USHORT)eValue ) -{ -} - -SfxPoolItem* SvxCharReliefItem::Clone( SfxItemPool * ) const -{ - return new SvxCharReliefItem( *this ); -} - -SfxPoolItem* SvxCharReliefItem::Create(SvStream & rStrm, USHORT) const -{ - sal_uInt16 nVal; - rStrm >> nVal; - return new SvxCharReliefItem( (FontRelief)nVal, Which() ); -} - -SvStream& SvxCharReliefItem::Store(SvStream & rStrm, USHORT /*nIVer*/) const -{ - sal_uInt16 nVal = GetValue(); - rStrm << nVal; - return rStrm; -} - -USHORT SvxCharReliefItem::GetVersion( USHORT nFFVer ) const -{ - return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0; -} - -String SvxCharReliefItem::GetValueTextByPos( USHORT nPos ) const -{ - DBG_ASSERT( RID_SVXITEMS_RELIEF_ENGRAVED - RID_SVXITEMS_RELIEF_NONE, - "enum overflow" ); - return String( SVX_RES( RID_SVXITEMS_RELIEF_BEGIN + nPos )); -} - -USHORT SvxCharReliefItem::GetValueCount() const -{ - return RID_SVXITEMS_RELIEF_ENGRAVED - RID_SVXITEMS_RELIEF_NONE; -} - -SfxItemPresentation SvxCharReliefItem::GetPresentation -( - SfxItemPresentation ePres, - SfxMapUnit /*eCoreUnit*/, - SfxMapUnit /*ePresUnit*/, - XubString& rText, const IntlWrapper * /*pIntl*/ -) const -{ - SfxItemPresentation eRet = ePres; - switch( ePres ) - { - case SFX_ITEM_PRESENTATION_NONE: - rText.Erase(); - break; - - case SFX_ITEM_PRESENTATION_NAMELESS: - case SFX_ITEM_PRESENTATION_COMPLETE: - rText = GetValueTextByPos( GetValue() ); - break; - - default: - eRet = SFX_ITEM_PRESENTATION_NONE; - } - return eRet; -} - -sal_Bool SvxCharReliefItem::PutValue( const com::sun::star::uno::Any& rVal, - BYTE nMemberId ) -{ -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); - nMemberId &= ~CONVERT_TWIPS; - sal_Bool bRet = sal_True; - switch( nMemberId ) - { - case MID_RELIEF: - { - sal_Int16 nVal = -1; - rVal >>= nVal; - if(nVal >= 0 && nVal <= RELIEF_ENGRAVED) - SetValue( (USHORT)nVal ); - else - bRet = sal_False; - } - break; - default: - bRet = sal_False; - break; - } - return bRet; -} - -sal_Bool SvxCharReliefItem::QueryValue( com::sun::star::uno::Any& rVal, - BYTE nMemberId ) const -{ -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); - nMemberId &= ~CONVERT_TWIPS; - sal_Bool bRet = sal_True; - switch( nMemberId ) - { - case MID_RELIEF: - rVal <<= (sal_Int16)GetValue(); - break; - default: - bRet = sal_False; - break; - } - return bRet; -} - -/************************************************************************* -|* class SvxScriptTypeItemItem -*************************************************************************/ - -SvxScriptTypeItem::SvxScriptTypeItem( sal_uInt16 nType ) - : SfxUInt16Item( SID_ATTR_CHAR_SCRIPTTYPE, nType ) -{ -} -SfxPoolItem* SvxScriptTypeItem::Clone( SfxItemPool * ) const -{ - return new SvxScriptTypeItem( GetValue() ); -} - -/************************************************************************* -|* class SvxScriptSetItem -*************************************************************************/ - -SvxScriptSetItem::SvxScriptSetItem( USHORT nSlotId, SfxItemPool& rPool ) - : SfxSetItem( nSlotId, new SfxItemSet( rPool, - SID_ATTR_CHAR_FONT, SID_ATTR_CHAR_FONT )) -{ - USHORT nLatin, nAsian, nComplex; - GetWhichIds( nLatin, nAsian, nComplex ); - - USHORT aIds[ 9 ] = { 0 }; - aIds[ 0 ] = aIds[ 1 ] = nLatin; - aIds[ 2 ] = aIds[ 3 ] = nAsian; - aIds[ 4 ] = aIds[ 5 ] = nComplex; - aIds[ 6 ] = aIds[ 7 ] = SID_ATTR_CHAR_SCRIPTTYPE; - aIds[ 8 ] = 0; - - GetItemSet().SetRanges( aIds ); -} - -SfxPoolItem* SvxScriptSetItem::Clone( SfxItemPool * ) const -{ - SvxScriptSetItem* p = new SvxScriptSetItem( Which(), *GetItemSet().GetPool() ); - p->GetItemSet().Put( GetItemSet(), FALSE ); - return p; -} - -SfxPoolItem* SvxScriptSetItem::Create( SvStream &, USHORT ) const -{ - return 0; -} - -const SfxPoolItem* SvxScriptSetItem::GetItemOfScriptSet( - const SfxItemSet& rSet, USHORT nId ) -{ - const SfxPoolItem* pI; - SfxItemState eSt = rSet.GetItemState( nId, FALSE, &pI ); - if( SFX_ITEM_SET != eSt ) - pI = SFX_ITEM_DEFAULT == eSt ? &rSet.Get( nId ) : 0; - return pI; -} - -const SfxPoolItem* SvxScriptSetItem::GetItemOfScript( USHORT nSlotId, const SfxItemSet& rSet, USHORT nScript ) -{ - USHORT nLatin, nAsian, nComplex; - GetWhichIds( nSlotId, rSet, nLatin, nAsian, nComplex ); - - const SfxPoolItem *pRet, *pAsn, *pCmplx; - switch( nScript ) - { - default: //no one valid -> match to latin - // case SCRIPTTYPE_LATIN: - pRet = GetItemOfScriptSet( rSet, nLatin ); - break; - case SCRIPTTYPE_ASIAN: - pRet = GetItemOfScriptSet( rSet, nAsian ); - break; - case SCRIPTTYPE_COMPLEX: - pRet = GetItemOfScriptSet( rSet, nComplex ); - break; - - case SCRIPTTYPE_LATIN|SCRIPTTYPE_ASIAN: - if( 0 == (pRet = GetItemOfScriptSet( rSet, nLatin )) || - 0 == (pAsn = GetItemOfScriptSet( rSet, nAsian )) || - *pRet != *pAsn ) - pRet = 0; - break; - - case SCRIPTTYPE_LATIN|SCRIPTTYPE_COMPLEX: - if( 0 == (pRet = GetItemOfScriptSet( rSet, nLatin )) || - 0 == (pCmplx = GetItemOfScriptSet( rSet, nComplex )) || - *pRet != *pCmplx ) - pRet = 0; - break; - - case SCRIPTTYPE_ASIAN|SCRIPTTYPE_COMPLEX: - if( 0 == (pRet = GetItemOfScriptSet( rSet, nAsian )) || - 0 == (pCmplx = GetItemOfScriptSet( rSet, nComplex )) || - *pRet != *pCmplx ) - pRet = 0; - break; - - case SCRIPTTYPE_LATIN|SCRIPTTYPE_ASIAN|SCRIPTTYPE_COMPLEX: - if( 0 == (pRet = GetItemOfScriptSet( rSet, nLatin )) || - 0 == (pAsn = GetItemOfScriptSet( rSet, nAsian )) || - 0 == (pCmplx = GetItemOfScriptSet( rSet, nComplex )) || - *pRet != *pAsn || *pRet != *pCmplx ) - pRet = 0; - break; - } - return pRet; -} - -const SfxPoolItem* SvxScriptSetItem::GetItemOfScript( USHORT nScript ) const -{ - return GetItemOfScript( Which(), GetItemSet(), nScript ); -} - -void SvxScriptSetItem::PutItemForScriptType( USHORT nScriptType, - const SfxPoolItem& rItem ) -{ - USHORT nLatin, nAsian, nComplex; - GetWhichIds( nLatin, nAsian, nComplex ); - - SfxPoolItem* pCpy = rItem.Clone(); - if( SCRIPTTYPE_LATIN & nScriptType ) - { - pCpy->SetWhich( nLatin ); - GetItemSet().Put( *pCpy ); - } - if( SCRIPTTYPE_ASIAN & nScriptType ) - { - pCpy->SetWhich( nAsian ); - GetItemSet().Put( *pCpy ); - } - if( SCRIPTTYPE_COMPLEX & nScriptType ) - { - pCpy->SetWhich( nComplex ); - GetItemSet().Put( *pCpy ); - } - delete pCpy; -} - -void SvxScriptSetItem::GetWhichIds( USHORT nSlotId, const SfxItemSet& rSet, USHORT& rLatin, USHORT& rAsian, USHORT& rComplex ) -{ - const SfxItemPool& rPool = *rSet.GetPool(); - GetSlotIds( nSlotId, rLatin, rAsian, rComplex ); - rLatin = rPool.GetWhich( rLatin ); - rAsian = rPool.GetWhich( rAsian ); - rComplex = rPool.GetWhich( rComplex ); -} - -void SvxScriptSetItem::GetWhichIds( USHORT& rLatin, USHORT& rAsian, - USHORT& rComplex ) const -{ - GetWhichIds( Which(), GetItemSet(), rLatin, rAsian, rComplex ); -} - -void SvxScriptSetItem::GetSlotIds( USHORT nSlotId, USHORT& rLatin, - USHORT& rAsian, USHORT& rComplex ) -{ - switch( nSlotId ) - { - default: - DBG_ASSERT( FALSE, "wrong SlotId for class SvxScriptSetItem" ); - // no break - default to font - Id Range !! - - case SID_ATTR_CHAR_FONT: - rLatin = SID_ATTR_CHAR_FONT; - rAsian = SID_ATTR_CHAR_CJK_FONT; - rComplex = SID_ATTR_CHAR_CTL_FONT; - break; - case SID_ATTR_CHAR_FONTHEIGHT: - rLatin = SID_ATTR_CHAR_FONTHEIGHT; - rAsian = SID_ATTR_CHAR_CJK_FONTHEIGHT; - rComplex = SID_ATTR_CHAR_CTL_FONTHEIGHT; - break; - case SID_ATTR_CHAR_WEIGHT: - rLatin = SID_ATTR_CHAR_WEIGHT; - rAsian = SID_ATTR_CHAR_CJK_WEIGHT; - rComplex = SID_ATTR_CHAR_CTL_WEIGHT; - break; - case SID_ATTR_CHAR_POSTURE: - rLatin = SID_ATTR_CHAR_POSTURE; - rAsian = SID_ATTR_CHAR_CJK_POSTURE; - rComplex = SID_ATTR_CHAR_CTL_POSTURE; - break; - case SID_ATTR_CHAR_LANGUAGE: - rLatin = SID_ATTR_CHAR_LANGUAGE; - rAsian = SID_ATTR_CHAR_CJK_LANGUAGE; - rComplex = SID_ATTR_CHAR_CTL_LANGUAGE; - break; - } -} - -void GetDefaultFonts( SvxFontItem& rLatin, SvxFontItem& rAsian, SvxFontItem& rComplex ) -{ - const USHORT nItemCnt = 3; - - static struct - { - USHORT nFontType; - USHORT nLanguage; - } - aOutTypeArr[ nItemCnt ] = - { - { DEFAULTFONT_LATIN_TEXT, LANGUAGE_ENGLISH_US }, - { DEFAULTFONT_CJK_TEXT, LANGUAGE_ENGLISH_US }, - { DEFAULTFONT_CTL_TEXT, LANGUAGE_ARABIC_SAUDI_ARABIA } - }; - - SvxFontItem* aItemArr[ nItemCnt ] = { &rLatin, &rAsian, &rComplex }; - - for ( USHORT n = 0; n < nItemCnt; ++n ) - { - Font aFont( OutputDevice::GetDefaultFont( aOutTypeArr[ n ].nFontType, - aOutTypeArr[ n ].nLanguage, - DEFAULTFONT_FLAGS_ONLYONE, 0 ) ); - SvxFontItem* pItem = aItemArr[ n ]; - pItem->GetFamily() = aFont.GetFamily(); - pItem->GetFamilyName() = aFont.GetName(); - pItem->GetStyleName().Erase(); - pItem->GetPitch() = aFont.GetPitch(); - pItem->GetCharSet() = aFont.GetCharSet(); - } -} - - -USHORT GetI18NScriptTypeOfLanguage( USHORT nLang ) -{ - return GetI18NScriptType( SvtLanguageOptions::GetScriptTypeOfLanguage( nLang ) ); -} - -USHORT GetItemScriptType( short nI18NType ) -{ - switch ( nI18NType ) - { - case i18n::ScriptType::LATIN: return SCRIPTTYPE_LATIN; - case i18n::ScriptType::ASIAN: return SCRIPTTYPE_ASIAN; - case i18n::ScriptType::COMPLEX: return SCRIPTTYPE_COMPLEX; - } - return 0; -} - -short GetI18NScriptType( USHORT nItemType ) -{ - switch ( nItemType ) - { - case SCRIPTTYPE_LATIN: return i18n::ScriptType::LATIN; - case SCRIPTTYPE_ASIAN: return i18n::ScriptType::ASIAN; - case SCRIPTTYPE_COMPLEX: return i18n::ScriptType::COMPLEX; - } - return 0; -} diff --git a/svx/source/items/viewlayoutitem.cxx b/svx/source/items/viewlayoutitem.cxx index bb6064f51aa2..47775bb7a2ce 100644 --- a/svx/source/items/viewlayoutitem.cxx +++ b/svx/source/items/viewlayoutitem.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: viewlayoutitem.cxx,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svx/source/items/writingmodeitem.cxx b/svx/source/items/writingmodeitem.cxx deleted file mode 100644 index 75294f3b6274..000000000000 --- a/svx/source/items/writingmodeitem.cxx +++ /dev/null @@ -1,159 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: writingmodeitem.cxx,v $ - * $Revision: 1.8 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svx.hxx" - -// include --------------------------------------------------------------- - - -#include <svx/writingmodeitem.hxx> -#include <svx/dialmgr.hxx> - -#ifndef _SVXITEMS_HRC -#include <svx/svxitems.hrc> -#endif - -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::text; - -// class SvxWritingModeItem ------------------------------------------------- - -TYPEINIT1_FACTORY(SvxWritingModeItem, SfxUInt16Item, new SvxWritingModeItem(com::sun::star::text::WritingMode_LR_TB, 0)); - -SvxWritingModeItem::SvxWritingModeItem( WritingMode eValue, USHORT _nWhich ) - : SfxUInt16Item( _nWhich, (sal_uInt16)eValue ) -{ -} - -SvxWritingModeItem::~SvxWritingModeItem() -{ -} - -int SvxWritingModeItem::operator==( const SfxPoolItem& rCmp ) const -{ - DBG_ASSERT( SfxPoolItem::operator==(rCmp), "unequal types" ); - - return GetValue() == ((SvxWritingModeItem&)rCmp).GetValue(); -} - -SfxPoolItem* SvxWritingModeItem::Clone( SfxItemPool * ) const -{ - return new SvxWritingModeItem( *this ); -} - -SfxPoolItem* SvxWritingModeItem::Create( SvStream & , USHORT ) const -{ - DBG_ERROR("SvxWritingModeItem should not be streamed!"); - return NULL; -} - -SvStream& SvxWritingModeItem::Store( SvStream & rStrm, USHORT ) const -{ - DBG_ERROR("SvxWritingModeItem should not be streamed!"); - return rStrm; -} - -USHORT SvxWritingModeItem::GetVersion( USHORT /*nFVer*/ ) const -{ - return USHRT_MAX; -} - -SfxItemPresentation SvxWritingModeItem::GetPresentation( SfxItemPresentation ePres, - SfxMapUnit /*eCoreMetric*/, - SfxMapUnit /*ePresMetric*/, - String &rText, - const IntlWrapper * ) const -{ - SfxItemPresentation eRet = ePres; - switch( ePres ) - { - case SFX_ITEM_PRESENTATION_NONE: - rText.Erase(); - break; - - case SFX_ITEM_PRESENTATION_NAMELESS: - case SFX_ITEM_PRESENTATION_COMPLETE: - rText = SVX_RESSTR( RID_SVXITEMS_FRMDIR_BEGIN + GetValue() ); - break; - - default: - eRet = SFX_ITEM_PRESENTATION_NONE; - } - return eRet; -} - -sal_Bool SvxWritingModeItem::PutValue( const com::sun::star::uno::Any& rVal, BYTE ) -{ - sal_Int32 nVal = 0; - sal_Bool bRet = ( rVal >>= nVal ); - - if( !bRet ) - { - WritingMode eMode; - bRet = rVal >>= eMode; - - if( bRet ) - { - nVal = (sal_Int32)eMode; - } - } - - if( bRet ) - { - switch( nVal ) - { - case WritingMode_LR_TB: - case WritingMode_RL_TB: - case WritingMode_TB_RL: - SetValue( (sal_uInt16)nVal ); - bRet = true; - break; - default: - bRet = false; - break; - } - } - - return bRet; -} - -sal_Bool SvxWritingModeItem::QueryValue( com::sun::star::uno::Any& rVal, - BYTE ) const -{ - rVal <<= (WritingMode)GetValue(); - return true; -} - -SvxWritingModeItem& SvxWritingModeItem::operator=( const SvxWritingModeItem& rItem ) -{ - SetValue( rItem.GetValue() ); - return *this; -} diff --git a/svx/source/items/xmlcnitm.cxx b/svx/source/items/xmlcnitm.cxx deleted file mode 100644 index b7e626095171..000000000000 --- a/svx/source/items/xmlcnitm.cxx +++ /dev/null @@ -1,253 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: xmlcnitm.cxx,v $ - * $Revision: 1.10 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svx.hxx" -#include <com/sun/star/xml/AttributeData.hpp> -#include <com/sun/star/lang/XUnoTunnel.hpp> -#include <xmloff/xmlcnimp.hxx> -#ifndef _XMLOFF_XMLCNITM_HXX -#include <xmloff/unoatrcn.hxx> -#endif -#include "xmlcnitm.hxx" - -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::xml; - -// ------------------------------------------------------------------------ - -TYPEINIT1(SvXMLAttrContainerItem, SfxPoolItem); - -SvXMLAttrContainerItem::SvXMLAttrContainerItem( USHORT _nWhich ) : - SfxPoolItem( _nWhich ) -{ - pImpl = new SvXMLAttrContainerData; -} - -SvXMLAttrContainerItem::SvXMLAttrContainerItem( - const SvXMLAttrContainerItem& rItem ) : - SfxPoolItem( rItem ) -{ - pImpl = new SvXMLAttrContainerData( *rItem.pImpl ); -} - -SvXMLAttrContainerItem::~SvXMLAttrContainerItem() -{ - delete pImpl; -} - -int SvXMLAttrContainerItem::operator==( const SfxPoolItem& rItem ) const -{ - DBG_ASSERT( rItem.ISA(SvXMLAttrContainerItem), - "SvXMLAttrContainerItem::operator ==(): Bad type"); - return *pImpl == *((const SvXMLAttrContainerItem&)rItem).pImpl; -} - -int SvXMLAttrContainerItem::Compare( const SfxPoolItem &/*rWith*/ ) const -{ - DBG_ASSERT( !this, "not yet implemented" ); - - return 0; -} - -SfxItemPresentation SvXMLAttrContainerItem::GetPresentation( - SfxItemPresentation /*ePresentation*/, - SfxMapUnit /*eCoreMetric*/, - SfxMapUnit /*ePresentationMetric*/, - XubString &/*rText*/, - const IntlWrapper * /*pIntlWrapper*/ ) const -{ - return SFX_ITEM_PRESENTATION_NONE; -} - -USHORT SvXMLAttrContainerItem::GetVersion( USHORT /*nFileFormatVersion*/ ) const -{ - // This item should never be stored - return USHRT_MAX; -} - -BOOL SvXMLAttrContainerItem::QueryValue( com::sun::star::uno::Any& rVal, BYTE /*nMemberId*/ ) const -{ - Reference<XNameContainer> xContainer = - new SvUnoAttributeContainer( new SvXMLAttrContainerData( *pImpl ) ); - - rVal.setValue( &xContainer, ::getCppuType((Reference<XNameContainer>*)0) ); - return TRUE; -} -BOOL SvXMLAttrContainerItem::PutValue( const com::sun::star::uno::Any& rVal, BYTE /*nMemberId*/ ) -{ - Reference<XInterface> xRef; - SvUnoAttributeContainer* pContainer = NULL; - - if( rVal.getValue() != NULL && rVal.getValueType().getTypeClass() == TypeClass_INTERFACE ) - { - xRef = *(Reference<XInterface>*)rVal.getValue(); - Reference<XUnoTunnel> xTunnel(xRef, UNO_QUERY); - if( xTunnel.is() ) - pContainer = (SvUnoAttributeContainer*)(ULONG)xTunnel->getSomething(SvUnoAttributeContainer::getUnoTunnelId()); - } - - if( pContainer ) - { - delete pImpl; - pImpl = new SvXMLAttrContainerData( * pContainer->GetContainerImpl() ); - } - else - { - SvXMLAttrContainerData* pNewImpl = new SvXMLAttrContainerData; - - try - { - Reference<XNameContainer> xContainer( xRef, UNO_QUERY ); - if( !xContainer.is() ) - return FALSE; - - const Sequence< ::rtl::OUString > aNameSequence( xContainer->getElementNames() ); - const ::rtl::OUString* pNames = aNameSequence.getConstArray(); - const INT32 nCount = aNameSequence.getLength(); - Any aAny; - AttributeData* pData; - INT32 nAttr; - - for( nAttr = 0; nAttr < nCount; nAttr++ ) - { - const ::rtl::OUString aName( *pNames++ ); - - aAny = xContainer->getByName( aName ); - if( aAny.getValue() == NULL || aAny.getValueType() != ::getCppuType((AttributeData*)0) ) - return FALSE; - - pData = (AttributeData*)aAny.getValue(); - sal_Int32 pos = aName.indexOf( sal_Unicode(':') ); - if( pos != -1 ) - { - const ::rtl::OUString aPrefix( aName.copy( 0, pos )); - const ::rtl::OUString aLName( aName.copy( pos+1 )); - - if( pData->Namespace.getLength() == 0 ) - { - if( !pNewImpl->AddAttr( aPrefix, aLName, pData->Value ) ) - break; - } - else - { - if( !pNewImpl->AddAttr( aPrefix, pData->Namespace, aLName, pData->Value ) ) - break; - } - } - else - { - if( !pNewImpl->AddAttr( aName, pData->Value ) ) - break; - } - } - - if( nAttr == nCount ) - { - delete pImpl; - pImpl = pNewImpl; - } - else - { - delete pNewImpl; - return FALSE; - } - } - catch(...) - { - delete pNewImpl; - return FALSE; - } - } - return TRUE; -} - - -BOOL SvXMLAttrContainerItem::AddAttr( const ::rtl::OUString& rLName, - const ::rtl::OUString& rValue ) -{ - return pImpl->AddAttr( rLName, rValue ); -} - -BOOL SvXMLAttrContainerItem::AddAttr( const ::rtl::OUString& rPrefix, - const ::rtl::OUString& rNamespace, const ::rtl::OUString& rLName, - const ::rtl::OUString& rValue ) -{ - return pImpl->AddAttr( rPrefix, rNamespace, rLName, rValue ); -} - -USHORT SvXMLAttrContainerItem::GetAttrCount() const -{ - return (USHORT)pImpl->GetAttrCount(); -} - -::rtl::OUString SvXMLAttrContainerItem::GetAttrNamespace( USHORT i ) const -{ - return pImpl->GetAttrNamespace( i ); -} - -::rtl::OUString SvXMLAttrContainerItem::GetAttrPrefix( USHORT i ) const -{ - return pImpl->GetAttrPrefix( i ); -} - -const ::rtl::OUString& SvXMLAttrContainerItem::GetAttrLName( USHORT i ) const -{ - return pImpl->GetAttrLName( i ); -} - -const ::rtl::OUString& SvXMLAttrContainerItem::GetAttrValue( USHORT i ) const -{ - return pImpl->GetAttrValue( i ); -} - - -USHORT SvXMLAttrContainerItem::GetFirstNamespaceIndex() const -{ - return pImpl->GetFirstNamespaceIndex(); -} - -USHORT SvXMLAttrContainerItem::GetNextNamespaceIndex( USHORT nIdx ) const -{ - return pImpl->GetNextNamespaceIndex( nIdx ); -} - -const ::rtl::OUString& SvXMLAttrContainerItem::GetNamespace( USHORT i ) const -{ - return pImpl->GetNamespace( i ); -} - -const ::rtl::OUString& SvXMLAttrContainerItem::GetPrefix( USHORT i ) const -{ - return pImpl->GetPrefix( i ); -} - diff --git a/svx/source/items/zoomitem.cxx b/svx/source/items/zoomitem.cxx index a966bd219795..bc5438d23686 100644 --- a/svx/source/items/zoomitem.cxx +++ b/svx/source/items/zoomitem.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: zoomitem.cxx,v $ - * $Revision: 1.13 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/svx/source/items/zoomslideritem.cxx b/svx/source/items/zoomslideritem.cxx index 75f4248e4191..555e0ad07f94 100644 --- a/svx/source/items/zoomslideritem.cxx +++ b/svx/source/items/zoomslideritem.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: zoomslideritem.cxx,v $ - * $Revision: 1.3.138.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify |