diff options
author | Mathias Bauer <mba@openoffice.org> | 2002-11-22 17:25:41 +0000 |
---|---|---|
committer | Mathias Bauer <mba@openoffice.org> | 2002-11-22 17:25:41 +0000 |
commit | e558f0dc36b2b3a08dcb94daffd1c6b2bb22d220 (patch) | |
tree | 1f2173a276f02e428e729ae0a2b4370f44097107 /svtools/source/items | |
parent | 990875b0534a0789e7e25331f0b79aa812cc0dcc (diff) |
#94892#: new method to disable parts of an enum slot
Diffstat (limited to 'svtools/source/items')
-rw-r--r-- | svtools/source/items/aeitem.cxx | 31 |
1 files changed, 28 insertions, 3 deletions
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 <tools/string.hxx> +#define _SVSTDARR_USHORTS +#include <svstdarr.hxx> #include <svarray.hxx> #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; i<pDisabledValues->Count(); i++ ) + if ( (*pDisabledValues)[i] == nValue ) + return FALSE; + } + + return TRUE; +} + // ----------------------------------------------------------------------- void SfxAllEnumItem::RemoveValue( USHORT nValue ) |