From e558f0dc36b2b3a08dcb94daffd1c6b2bb22d220 Mon Sep 17 00:00:00 2001 From: Mathias Bauer Date: Fri, 22 Nov 2002 17:25:41 +0000 Subject: #94892#: new method to disable parts of an enum slot --- svtools/source/items/aeitem.cxx | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) (limited to 'svtools/source') diff --git a/svtools/source/items/aeitem.cxx b/svtools/source/items/aeitem.cxx index aebb93af79a8..c64f2fdd2c33 100644 --- a/svtools/source/items/aeitem.cxx +++ b/svtools/source/items/aeitem.cxx @@ -2,9 +2,9 @@ * * $RCSfile: aeitem.cxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 16:59:00 $ + * last change: $Author: mba $ $Date: 2002-11-22 18:25:41 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -63,6 +63,8 @@ #include +#define _SVSTDARR_USHORTS +#include #include #include "aeitem.hxx" @@ -85,7 +87,8 @@ SV_IMPL_PTRARR(SfxAllEnumValueArr, SfxAllEnumValue_Impl*); SfxAllEnumItem::SfxAllEnumItem( USHORT nWhich, USHORT nVal, const XubString &rText ): SfxEnumItem(nWhich, nVal), - pValues( 0 ) + pValues( 0 ), + pDisabledValues( 0 ) { DBG_CTOR(SfxAllEnumItem, 0); InsertValue( nVal, rText ); @@ -149,6 +152,7 @@ SfxAllEnumItem::~SfxAllEnumItem() { DBG_DTOR(SfxAllEnumItem, 0); delete pValues; + delete pDisabledValues; } // ----------------------------------------------------------------------- @@ -272,6 +276,27 @@ void SfxAllEnumItem::InsertValue( USHORT nValue ) pValues->Insert( pTemp, _GetPosByValue(nValue) ); //! doppelte?! } +void SfxAllEnumItem::DisableValue( USHORT nValue ) +{ + DBG_CHKTHIS(SfxAllEnumItem, 0); + if ( !pDisabledValues ) + pDisabledValues = new SvUShorts; + + pDisabledValues->Insert( nValue, pDisabledValues->Count() ); +} + +BOOL SfxAllEnumItem::IsEnabled( USHORT nValue ) +{ + if ( pDisabledValues ) + { + for ( USHORT i=0; iCount(); i++ ) + if ( (*pDisabledValues)[i] == nValue ) + return FALSE; + } + + return TRUE; +} + // ----------------------------------------------------------------------- void SfxAllEnumItem::RemoveValue( USHORT nValue ) -- cgit