1*f6e50924SAndrew Rist /************************************************************** 2*f6e50924SAndrew Rist * 3*f6e50924SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*f6e50924SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*f6e50924SAndrew Rist * distributed with this work for additional information 6*f6e50924SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*f6e50924SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*f6e50924SAndrew Rist * "License"); you may not use this file except in compliance 9*f6e50924SAndrew Rist * with the License. You may obtain a copy of the License at 10*f6e50924SAndrew Rist * 11*f6e50924SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*f6e50924SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*f6e50924SAndrew Rist * software distributed under the License is distributed on an 15*f6e50924SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*f6e50924SAndrew Rist * KIND, either express or implied. See the License for the 17*f6e50924SAndrew Rist * specific language governing permissions and limitations 18*f6e50924SAndrew Rist * under the License. 19*f6e50924SAndrew Rist * 20*f6e50924SAndrew Rist *************************************************************/ 21*f6e50924SAndrew Rist 22*f6e50924SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_svx.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <svx/xtable.hxx> 28cdf0e10cSrcweir #include <svx/xpool.hxx> 29cdf0e10cSrcweir 30cdf0e10cSrcweir #define GLOBALOVERFLOW 31cdf0e10cSrcweir 32cdf0e10cSrcweir // Vergleichsstrings 33cdf0e10cSrcweir sal_Unicode __FAR_DATA pszStandard[] = { 's', 't', 'a', 'n', 'd', 'a', 'r', 'd', 0 }; 34cdf0e10cSrcweir 35cdf0e10cSrcweir // Konvertiert in echte RGB-Farben, damit in den Listboxen 36cdf0e10cSrcweir // endlich mal richtig selektiert werden kann. 37cdf0e10cSrcweir Color RGB_Color( ColorData nColorName ) 38cdf0e10cSrcweir { 39cdf0e10cSrcweir Color aColor( nColorName ); 40cdf0e10cSrcweir Color aRGBColor( aColor.GetRed(), aColor.GetGreen(), aColor.GetBlue() ); 41cdf0e10cSrcweir return aRGBColor; 42cdf0e10cSrcweir } 43cdf0e10cSrcweir 44cdf0e10cSrcweir // --------------------- 45cdf0e10cSrcweir // class XPropertyTable 46cdf0e10cSrcweir // --------------------- 47cdf0e10cSrcweir 48cdf0e10cSrcweir /************************************************************************* 49cdf0e10cSrcweir |* 50cdf0e10cSrcweir |* XPropertyTable::XPropertyTable() 51cdf0e10cSrcweir |* 52cdf0e10cSrcweir *************************************************************************/ 53cdf0e10cSrcweir 54cdf0e10cSrcweir XPropertyTable::XPropertyTable( const String& rPath, 55cdf0e10cSrcweir XOutdevItemPool* pInPool, 56cdf0e10cSrcweir sal_uInt16 nInitSize, sal_uInt16 nReSize ) : 57cdf0e10cSrcweir aName ( pszStandard, 8 ), 58cdf0e10cSrcweir aPath ( rPath ), 59cdf0e10cSrcweir pXPool ( pInPool ), 60cdf0e10cSrcweir aTable ( nInitSize, nReSize ), 61cdf0e10cSrcweir pBmpTable ( NULL ), 62cdf0e10cSrcweir bTableDirty ( sal_True ), 63cdf0e10cSrcweir bBitmapsDirty ( sal_True ), 64cdf0e10cSrcweir bOwnPool ( sal_False ) 65cdf0e10cSrcweir { 66cdf0e10cSrcweir if( !pXPool ) 67cdf0e10cSrcweir { 68cdf0e10cSrcweir bOwnPool = sal_True; 69cdf0e10cSrcweir pXPool = new XOutdevItemPool; 70cdf0e10cSrcweir DBG_ASSERT( pXPool, "XOutPool konnte nicht erzeugt werden!" ); 71cdf0e10cSrcweir } 72cdf0e10cSrcweir } 73cdf0e10cSrcweir 74cdf0e10cSrcweir /************************************************************************* 75cdf0e10cSrcweir |* 76cdf0e10cSrcweir |* XPropertyTable::XPropertyTable( SvStraem& ) 77cdf0e10cSrcweir |* 78cdf0e10cSrcweir *************************************************************************/ 79cdf0e10cSrcweir 80cdf0e10cSrcweir XPropertyTable::XPropertyTable( SvStream& /*rIn*/) : 81cdf0e10cSrcweir pBmpTable ( NULL ) 82cdf0e10cSrcweir { 83cdf0e10cSrcweir } 84cdf0e10cSrcweir 85cdf0e10cSrcweir /************************************************************************* 86cdf0e10cSrcweir |* 87cdf0e10cSrcweir |* XPropertyTable::~XPropertyTable() 88cdf0e10cSrcweir |* 89cdf0e10cSrcweir *************************************************************************/ 90cdf0e10cSrcweir 91cdf0e10cSrcweir XPropertyTable::~XPropertyTable() 92cdf0e10cSrcweir { 93cdf0e10cSrcweir XPropertyEntry* pEntry = (XPropertyEntry*)aTable.First(); 94cdf0e10cSrcweir Bitmap* pBitmap = NULL; 95cdf0e10cSrcweir for (sal_uIntPtr nIndex = 0; nIndex < aTable.Count(); nIndex++) 96cdf0e10cSrcweir { 97cdf0e10cSrcweir delete pEntry; 98cdf0e10cSrcweir pEntry = (XPropertyEntry*)aTable.Next(); 99cdf0e10cSrcweir } 100cdf0e10cSrcweir // Hier wird die Bitmaptabelle geloescht 101cdf0e10cSrcweir if( pBmpTable ) 102cdf0e10cSrcweir { 103cdf0e10cSrcweir pBitmap = (Bitmap*) pBmpTable->First(); 104cdf0e10cSrcweir 105cdf0e10cSrcweir for( sal_uIntPtr nIndex = 0; nIndex < pBmpTable->Count(); nIndex++ ) 106cdf0e10cSrcweir { 107cdf0e10cSrcweir delete pBitmap; 108cdf0e10cSrcweir pBitmap = (Bitmap*) pBmpTable->Next(); 109cdf0e10cSrcweir } 110cdf0e10cSrcweir delete pBmpTable; 111cdf0e10cSrcweir pBmpTable = NULL; 112cdf0e10cSrcweir } 113cdf0e10cSrcweir // Eigener Pool wird geloescht 114cdf0e10cSrcweir if( bOwnPool && pXPool ) 115cdf0e10cSrcweir { 116cdf0e10cSrcweir SfxItemPool::Free(pXPool); 117cdf0e10cSrcweir } 118cdf0e10cSrcweir } 119cdf0e10cSrcweir 120cdf0e10cSrcweir /************************************************************************* 121cdf0e10cSrcweir |* 122cdf0e10cSrcweir |* XPropertyTable::Clear() 123cdf0e10cSrcweir |* 124cdf0e10cSrcweir *************************************************************************/ 125cdf0e10cSrcweir 126cdf0e10cSrcweir void XPropertyTable::Clear() 127cdf0e10cSrcweir { 128cdf0e10cSrcweir aTable.Clear(); 129cdf0e10cSrcweir if( pBmpTable ) 130cdf0e10cSrcweir pBmpTable->Clear(); 131cdf0e10cSrcweir } 132cdf0e10cSrcweir 133cdf0e10cSrcweir /************************************************************************/ 134cdf0e10cSrcweir 135cdf0e10cSrcweir long XPropertyTable::Count() const 136cdf0e10cSrcweir { 137cdf0e10cSrcweir if( bTableDirty ) 138cdf0e10cSrcweir { 139cdf0e10cSrcweir // ( (XPropertyTable*) this )->bTableDirty = sal_False; <- im Load() 140cdf0e10cSrcweir if( !( (XPropertyTable*) this )->Load() ) 141cdf0e10cSrcweir ( (XPropertyTable*) this )->Create(); 142cdf0e10cSrcweir } 143cdf0e10cSrcweir return( aTable.Count() ); 144cdf0e10cSrcweir } 145cdf0e10cSrcweir 146cdf0e10cSrcweir /************************************************************************* 147cdf0e10cSrcweir |* 148cdf0e10cSrcweir |* XPropertyEntry* XPropertyTable::Get() 149cdf0e10cSrcweir |* 150cdf0e10cSrcweir *************************************************************************/ 151cdf0e10cSrcweir 152cdf0e10cSrcweir XPropertyEntry* XPropertyTable::Get( long nIndex, sal_uInt16 /*nDummy*/) const 153cdf0e10cSrcweir { 154cdf0e10cSrcweir if( bTableDirty ) 155cdf0e10cSrcweir { 156cdf0e10cSrcweir // ( (XPropertyTable*) this )->bTableDirty = sal_False; <- im Load() 157cdf0e10cSrcweir if( !( (XPropertyTable*) this )->Load() ) 158cdf0e10cSrcweir ( (XPropertyTable*) this )->Create(); 159cdf0e10cSrcweir } 160cdf0e10cSrcweir return (XPropertyEntry*) aTable.GetObject( (sal_uIntPtr) nIndex ); 161cdf0e10cSrcweir } 162cdf0e10cSrcweir 163cdf0e10cSrcweir /************************************************************************* 164cdf0e10cSrcweir |* 165cdf0e10cSrcweir |* long XPropertyTable::Get(const String& rName) 166cdf0e10cSrcweir |* 167cdf0e10cSrcweir *************************************************************************/ 168cdf0e10cSrcweir 169cdf0e10cSrcweir long XPropertyTable::Get(const XubString& rName) 170cdf0e10cSrcweir { 171cdf0e10cSrcweir if( bTableDirty ) 172cdf0e10cSrcweir { 173cdf0e10cSrcweir // bTableDirty = sal_False; 174cdf0e10cSrcweir if( !Load() ) 175cdf0e10cSrcweir Create(); 176cdf0e10cSrcweir } 177cdf0e10cSrcweir long nPos = 0; 178cdf0e10cSrcweir XPropertyEntry* pEntry = (XPropertyEntry*)aTable.First(); 179cdf0e10cSrcweir while (pEntry && pEntry->GetName() != rName) 180cdf0e10cSrcweir { 181cdf0e10cSrcweir nPos++; 182cdf0e10cSrcweir pEntry = (XPropertyEntry*)aTable.Next(); 183cdf0e10cSrcweir } 184cdf0e10cSrcweir if (!pEntry) nPos = -1; 185cdf0e10cSrcweir return nPos; 186cdf0e10cSrcweir } 187cdf0e10cSrcweir 188cdf0e10cSrcweir /************************************************************************* 189cdf0e10cSrcweir |* 190cdf0e10cSrcweir |* Bitmap* XPropertyTable::GetBitmap() 191cdf0e10cSrcweir |* 192cdf0e10cSrcweir *************************************************************************/ 193cdf0e10cSrcweir 194cdf0e10cSrcweir Bitmap* XPropertyTable::GetBitmap( long nIndex ) const 195cdf0e10cSrcweir { 196cdf0e10cSrcweir if( pBmpTable ) 197cdf0e10cSrcweir { 198cdf0e10cSrcweir if( bBitmapsDirty ) 199cdf0e10cSrcweir { 200cdf0e10cSrcweir ( (XPropertyTable*) this )->bBitmapsDirty = sal_False; 201cdf0e10cSrcweir ( (XPropertyTable*) this )->CreateBitmapsForUI(); 202cdf0e10cSrcweir } 203cdf0e10cSrcweir 204cdf0e10cSrcweir if( pBmpTable->Count() >= (sal_uIntPtr) nIndex ) 205cdf0e10cSrcweir return (Bitmap*) pBmpTable->GetObject( (sal_uIntPtr) nIndex ); 206cdf0e10cSrcweir } 207cdf0e10cSrcweir return( NULL ); 208cdf0e10cSrcweir } 209cdf0e10cSrcweir 210cdf0e10cSrcweir /************************************************************************* 211cdf0e10cSrcweir |* 212cdf0e10cSrcweir |* void XPropertyTable::Insert() 213cdf0e10cSrcweir |* 214cdf0e10cSrcweir *************************************************************************/ 215cdf0e10cSrcweir 216cdf0e10cSrcweir sal_Bool XPropertyTable::Insert( long nIndex, XPropertyEntry* pEntry ) 217cdf0e10cSrcweir { 218cdf0e10cSrcweir sal_Bool bReturn = aTable.Insert( (sal_uIntPtr) nIndex, pEntry ); 219cdf0e10cSrcweir 220cdf0e10cSrcweir if( pBmpTable && !bBitmapsDirty ) 221cdf0e10cSrcweir { 222cdf0e10cSrcweir Bitmap* pBmp = CreateBitmapForUI( (sal_uIntPtr) nIndex ); 223cdf0e10cSrcweir pBmpTable->Insert( (sal_uIntPtr) nIndex, pBmp ); 224cdf0e10cSrcweir } 225cdf0e10cSrcweir return bReturn; 226cdf0e10cSrcweir } 227cdf0e10cSrcweir 228cdf0e10cSrcweir /************************************************************************* 229cdf0e10cSrcweir |* 230cdf0e10cSrcweir |* void XPropertyTable::Replace() 231cdf0e10cSrcweir |* 232cdf0e10cSrcweir *************************************************************************/ 233cdf0e10cSrcweir 234cdf0e10cSrcweir XPropertyEntry* XPropertyTable::Replace( long nIndex, XPropertyEntry* pEntry ) 235cdf0e10cSrcweir { 236cdf0e10cSrcweir XPropertyEntry* pOldEntry = (XPropertyEntry*) aTable.Replace( (sal_uIntPtr) nIndex, pEntry ); 237cdf0e10cSrcweir 238cdf0e10cSrcweir if( pBmpTable && !bBitmapsDirty ) 239cdf0e10cSrcweir { 240cdf0e10cSrcweir Bitmap* pBmp = CreateBitmapForUI( (sal_uIntPtr) nIndex ); 241cdf0e10cSrcweir Bitmap* pOldBmp = (Bitmap*) pBmpTable->Replace( (sal_uIntPtr) nIndex, pBmp ); 242cdf0e10cSrcweir if( pOldBmp ) 243cdf0e10cSrcweir delete pOldBmp; 244cdf0e10cSrcweir } 245cdf0e10cSrcweir return pOldEntry; 246cdf0e10cSrcweir } 247cdf0e10cSrcweir 248cdf0e10cSrcweir /************************************************************************* 249cdf0e10cSrcweir |* 250cdf0e10cSrcweir |* void XPropertyTable::Remove() 251cdf0e10cSrcweir |* 252cdf0e10cSrcweir *************************************************************************/ 253cdf0e10cSrcweir 254cdf0e10cSrcweir XPropertyEntry* XPropertyTable::Remove( long nIndex, sal_uInt16 /*nDummy*/) 255cdf0e10cSrcweir { 256cdf0e10cSrcweir if( pBmpTable && !bBitmapsDirty ) 257cdf0e10cSrcweir { 258cdf0e10cSrcweir Bitmap* pOldBmp = (Bitmap*) pBmpTable->Remove( (sal_uIntPtr) nIndex ); 259cdf0e10cSrcweir if( pOldBmp ) 260cdf0e10cSrcweir delete pOldBmp; 261cdf0e10cSrcweir } 262cdf0e10cSrcweir return (XPropertyEntry*) aTable.Remove((sal_uIntPtr)nIndex); 263cdf0e10cSrcweir } 264cdf0e10cSrcweir 265cdf0e10cSrcweir /************************************************************************/ 266cdf0e10cSrcweir 267cdf0e10cSrcweir void XPropertyTable::SetName( const String& rString ) 268cdf0e10cSrcweir { 269cdf0e10cSrcweir if(rString.Len()) 270cdf0e10cSrcweir { 271cdf0e10cSrcweir aName = rString; 272cdf0e10cSrcweir } 273cdf0e10cSrcweir } 274cdf0e10cSrcweir 275cdf0e10cSrcweir // -------------------- 276cdf0e10cSrcweir // class XPropertyList 277cdf0e10cSrcweir // -------------------- 278cdf0e10cSrcweir 279cdf0e10cSrcweir 280cdf0e10cSrcweir /************************************************************************* 281cdf0e10cSrcweir |* 282cdf0e10cSrcweir |* XPropertyList::XPropertyList() 283cdf0e10cSrcweir |* 284cdf0e10cSrcweir *************************************************************************/ 285cdf0e10cSrcweir 286cdf0e10cSrcweir XPropertyList::XPropertyList( const String& rPath, 287cdf0e10cSrcweir XOutdevItemPool* pInPool, 288cdf0e10cSrcweir sal_uInt16 nInitSize, sal_uInt16 nReSize ) : 289cdf0e10cSrcweir aName ( pszStandard, 8 ), 290cdf0e10cSrcweir aPath ( rPath ), 291cdf0e10cSrcweir pXPool ( pInPool ), 292cdf0e10cSrcweir aList ( nInitSize, nReSize ), 293cdf0e10cSrcweir pBmpList ( NULL ), 294cdf0e10cSrcweir bListDirty ( sal_True ), 295cdf0e10cSrcweir bBitmapsDirty ( sal_True ), 296cdf0e10cSrcweir bOwnPool ( sal_False ) 297cdf0e10cSrcweir { 298cdf0e10cSrcweir if( !pXPool ) 299cdf0e10cSrcweir { 300cdf0e10cSrcweir bOwnPool = sal_True; 301cdf0e10cSrcweir pXPool = new XOutdevItemPool; 302cdf0e10cSrcweir DBG_ASSERT( pXPool, "XOutPool konnte nicht erzeugt werden!" ); 303cdf0e10cSrcweir } 304cdf0e10cSrcweir } 305cdf0e10cSrcweir 306cdf0e10cSrcweir /************************************************************************* 307cdf0e10cSrcweir |* 308cdf0e10cSrcweir |* XPropertyList::XPropertyList( SvStraem& ) 309cdf0e10cSrcweir |* 310cdf0e10cSrcweir *************************************************************************/ 311cdf0e10cSrcweir 312cdf0e10cSrcweir XPropertyList::XPropertyList( SvStream& /*rIn*/) : 313cdf0e10cSrcweir pBmpList ( NULL ) 314cdf0e10cSrcweir { 315cdf0e10cSrcweir } 316cdf0e10cSrcweir 317cdf0e10cSrcweir /************************************************************************* 318cdf0e10cSrcweir |* 319cdf0e10cSrcweir |* XPropertyList::~XPropertyList() 320cdf0e10cSrcweir |* 321cdf0e10cSrcweir *************************************************************************/ 322cdf0e10cSrcweir 323cdf0e10cSrcweir XPropertyList::~XPropertyList() 324cdf0e10cSrcweir { 325cdf0e10cSrcweir XPropertyEntry* pEntry = (XPropertyEntry*)aList.First(); 326cdf0e10cSrcweir Bitmap* pBitmap = NULL; 327cdf0e10cSrcweir for( sal_uIntPtr nIndex = 0; nIndex < aList.Count(); nIndex++ ) 328cdf0e10cSrcweir { 329cdf0e10cSrcweir delete pEntry; 330cdf0e10cSrcweir pEntry = (XPropertyEntry*)aList.Next(); 331cdf0e10cSrcweir } 332cdf0e10cSrcweir 333cdf0e10cSrcweir if( pBmpList ) 334cdf0e10cSrcweir { 335cdf0e10cSrcweir pBitmap = (Bitmap*) pBmpList->First(); 336cdf0e10cSrcweir 337cdf0e10cSrcweir for( sal_uIntPtr nIndex = 0; nIndex < pBmpList->Count(); nIndex++ ) 338cdf0e10cSrcweir { 339cdf0e10cSrcweir delete pBitmap; 340cdf0e10cSrcweir pBitmap = (Bitmap*) pBmpList->Next(); 341cdf0e10cSrcweir } 342cdf0e10cSrcweir delete pBmpList; 343cdf0e10cSrcweir pBmpList = NULL; 344cdf0e10cSrcweir } 345cdf0e10cSrcweir 346cdf0e10cSrcweir if( bOwnPool && pXPool ) 347cdf0e10cSrcweir { 348cdf0e10cSrcweir SfxItemPool::Free(pXPool); 349cdf0e10cSrcweir } 350cdf0e10cSrcweir } 351cdf0e10cSrcweir 352cdf0e10cSrcweir /************************************************************************* 353cdf0e10cSrcweir |* 354cdf0e10cSrcweir |* XPropertyList::Clear() 355cdf0e10cSrcweir |* 356cdf0e10cSrcweir *************************************************************************/ 357cdf0e10cSrcweir 358cdf0e10cSrcweir void XPropertyList::Clear() 359cdf0e10cSrcweir { 360cdf0e10cSrcweir aList.Clear(); 361cdf0e10cSrcweir if( pBmpList ) 362cdf0e10cSrcweir pBmpList->Clear(); 363cdf0e10cSrcweir } 364cdf0e10cSrcweir 365cdf0e10cSrcweir /************************************************************************/ 366cdf0e10cSrcweir 367cdf0e10cSrcweir long XPropertyList::Count() const 368cdf0e10cSrcweir { 369cdf0e10cSrcweir if( bListDirty ) 370cdf0e10cSrcweir { 371cdf0e10cSrcweir // ( (XPropertyList*) this )->bListDirty = sal_False; <- im Load() 372cdf0e10cSrcweir if( !( (XPropertyList*) this )->Load() ) 373cdf0e10cSrcweir ( (XPropertyList*) this )->Create(); 374cdf0e10cSrcweir } 375cdf0e10cSrcweir return( aList.Count() ); 376cdf0e10cSrcweir } 377cdf0e10cSrcweir 378cdf0e10cSrcweir /************************************************************************* 379cdf0e10cSrcweir |* 380cdf0e10cSrcweir |* XPropertyEntry* XPropertyList::Get() 381cdf0e10cSrcweir |* 382cdf0e10cSrcweir *************************************************************************/ 383cdf0e10cSrcweir 384cdf0e10cSrcweir XPropertyEntry* XPropertyList::Get( long nIndex, sal_uInt16 /*nDummy*/) const 385cdf0e10cSrcweir { 386cdf0e10cSrcweir if( bListDirty ) 387cdf0e10cSrcweir { 388cdf0e10cSrcweir // ( (XPropertyList*) this )->bListDirty = sal_False; <- im Load() 389cdf0e10cSrcweir if( !( (XPropertyList*) this )->Load() ) 390cdf0e10cSrcweir ( (XPropertyList*) this )->Create(); 391cdf0e10cSrcweir } 392cdf0e10cSrcweir return (XPropertyEntry*) aList.GetObject( (sal_uIntPtr) nIndex ); 393cdf0e10cSrcweir } 394cdf0e10cSrcweir 395cdf0e10cSrcweir /************************************************************************* 396cdf0e10cSrcweir |* 397cdf0e10cSrcweir |* XPropertyList::Get() 398cdf0e10cSrcweir |* 399cdf0e10cSrcweir *************************************************************************/ 400cdf0e10cSrcweir 401cdf0e10cSrcweir long XPropertyList::Get(const XubString& rName) 402cdf0e10cSrcweir { 403cdf0e10cSrcweir if( bListDirty ) 404cdf0e10cSrcweir { 405cdf0e10cSrcweir //bListDirty = sal_False; 406cdf0e10cSrcweir if( !Load() ) 407cdf0e10cSrcweir Create(); 408cdf0e10cSrcweir } 409cdf0e10cSrcweir long nPos = 0; 410cdf0e10cSrcweir XPropertyEntry* pEntry = (XPropertyEntry*)aList.First(); 411cdf0e10cSrcweir while (pEntry && pEntry->GetName() != rName) 412cdf0e10cSrcweir { 413cdf0e10cSrcweir nPos++; 414cdf0e10cSrcweir pEntry = (XPropertyEntry*)aList.Next(); 415cdf0e10cSrcweir } 416cdf0e10cSrcweir if (!pEntry) nPos = -1; 417cdf0e10cSrcweir return nPos; 418cdf0e10cSrcweir } 419cdf0e10cSrcweir 420cdf0e10cSrcweir /************************************************************************* 421cdf0e10cSrcweir |* 422cdf0e10cSrcweir |* Bitmap* XPropertyList::GetBitmap() 423cdf0e10cSrcweir |* 424cdf0e10cSrcweir *************************************************************************/ 425cdf0e10cSrcweir 426cdf0e10cSrcweir Bitmap* XPropertyList::GetBitmap( long nIndex ) const 427cdf0e10cSrcweir { 428cdf0e10cSrcweir if( pBmpList ) 429cdf0e10cSrcweir { 430cdf0e10cSrcweir if( bBitmapsDirty ) 431cdf0e10cSrcweir { 432cdf0e10cSrcweir ( (XPropertyList*) this )->bBitmapsDirty = sal_False; 433cdf0e10cSrcweir ( (XPropertyList*) this )->CreateBitmapsForUI(); 434cdf0e10cSrcweir } 435cdf0e10cSrcweir if( pBmpList->Count() >= (sal_uIntPtr) nIndex ) 436cdf0e10cSrcweir return (Bitmap*) pBmpList->GetObject( (sal_uIntPtr) nIndex ); 437cdf0e10cSrcweir } 438cdf0e10cSrcweir return( NULL ); 439cdf0e10cSrcweir } 440cdf0e10cSrcweir 441cdf0e10cSrcweir /************************************************************************* 442cdf0e10cSrcweir |* 443cdf0e10cSrcweir |* void XPropertyList::Insert() 444cdf0e10cSrcweir |* 445cdf0e10cSrcweir *************************************************************************/ 446cdf0e10cSrcweir 447cdf0e10cSrcweir void XPropertyList::Insert( XPropertyEntry* pEntry, long nIndex ) 448cdf0e10cSrcweir { 449cdf0e10cSrcweir aList.Insert( pEntry, (sal_uIntPtr) nIndex ); 450cdf0e10cSrcweir 451cdf0e10cSrcweir if( pBmpList && !bBitmapsDirty ) 452cdf0e10cSrcweir { 453cdf0e10cSrcweir Bitmap* pBmp = CreateBitmapForUI( 454cdf0e10cSrcweir (sal_uIntPtr) nIndex < aList.Count() ? nIndex : aList.Count() - 1 ); 455cdf0e10cSrcweir pBmpList->Insert( pBmp, (sal_uIntPtr) nIndex ); 456cdf0e10cSrcweir } 457cdf0e10cSrcweir } 458cdf0e10cSrcweir 459cdf0e10cSrcweir /************************************************************************* 460cdf0e10cSrcweir |* 461cdf0e10cSrcweir |* void XPropertyList::Replace() 462cdf0e10cSrcweir |* 463cdf0e10cSrcweir *************************************************************************/ 464cdf0e10cSrcweir 465cdf0e10cSrcweir XPropertyEntry* XPropertyList::Replace( XPropertyEntry* pEntry, long nIndex ) 466cdf0e10cSrcweir { 467cdf0e10cSrcweir XPropertyEntry* pOldEntry = (XPropertyEntry*) aList.Replace( pEntry, (sal_uIntPtr) nIndex ); 468cdf0e10cSrcweir 469cdf0e10cSrcweir if( pBmpList && !bBitmapsDirty ) 470cdf0e10cSrcweir { 471cdf0e10cSrcweir Bitmap* pBmp = CreateBitmapForUI( (sal_uIntPtr) nIndex ); 472cdf0e10cSrcweir Bitmap* pOldBmp = (Bitmap*) pBmpList->Replace( pBmp, (sal_uIntPtr) nIndex ); 473cdf0e10cSrcweir if( pOldBmp ) 474cdf0e10cSrcweir delete pOldBmp; 475cdf0e10cSrcweir } 476cdf0e10cSrcweir return pOldEntry; 477cdf0e10cSrcweir } 478cdf0e10cSrcweir 479cdf0e10cSrcweir /************************************************************************* 480cdf0e10cSrcweir |* 481cdf0e10cSrcweir |* void XPropertyList::Remove() 482cdf0e10cSrcweir |* 483cdf0e10cSrcweir *************************************************************************/ 484cdf0e10cSrcweir 485cdf0e10cSrcweir XPropertyEntry* XPropertyList::Remove( long nIndex, sal_uInt16 /*nDummy*/) 486cdf0e10cSrcweir { 487cdf0e10cSrcweir if( pBmpList && !bBitmapsDirty ) 488cdf0e10cSrcweir { 489cdf0e10cSrcweir Bitmap* pOldBmp = (Bitmap*) pBmpList->Remove( (sal_uIntPtr) nIndex ); 490cdf0e10cSrcweir if( pOldBmp ) 491cdf0e10cSrcweir delete pOldBmp; 492cdf0e10cSrcweir } 493cdf0e10cSrcweir return (XPropertyEntry*) aList.Remove( (sal_uIntPtr) nIndex ); 494cdf0e10cSrcweir } 495cdf0e10cSrcweir 496cdf0e10cSrcweir /************************************************************************/ 497cdf0e10cSrcweir 498cdf0e10cSrcweir void XPropertyList::SetName( const String& rString ) 499cdf0e10cSrcweir { 500cdf0e10cSrcweir if(rString.Len()) 501cdf0e10cSrcweir { 502cdf0e10cSrcweir aName = rString; 503cdf0e10cSrcweir } 504cdf0e10cSrcweir } 505cdf0e10cSrcweir 506cdf0e10cSrcweir 507cdf0e10cSrcweir 508