1*f6e50924SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 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 10cdf0e10cSrcweir * 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. 19cdf0e10cSrcweir * 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 #include <com/sun/star/awt/XBitmap.hpp> 27cdf0e10cSrcweir #include <com/sun/star/graphic/XGraphic.hpp> 28cdf0e10cSrcweir #include <tools/stream.hxx> 29cdf0e10cSrcweir #include <vcl/window.hxx> 30cdf0e10cSrcweir #include <vcl/virdev.hxx> 31cdf0e10cSrcweir #include <vcl/bitmapex.hxx> 32cdf0e10cSrcweir #include <toolkit/unohlp.hxx> 33cdf0e10cSrcweir #include <svl/style.hxx> 34cdf0e10cSrcweir #include <editeng/memberids.hrc> 35cdf0e10cSrcweir 36cdf0e10cSrcweir #include <svx/dialogs.hrc> 37cdf0e10cSrcweir #include "svx/xattr.hxx" 38cdf0e10cSrcweir #include <svx/xtable.hxx> 39cdf0e10cSrcweir #include <svx/xdef.hxx> 40cdf0e10cSrcweir #include <svx/unomid.hxx> 41cdf0e10cSrcweir #include <editeng/unoprnms.hxx> 42cdf0e10cSrcweir 43cdf0e10cSrcweir #include "svx/unoapi.hxx" 44cdf0e10cSrcweir #include <svx/svdmodel.hxx> 45cdf0e10cSrcweir #include <com/sun/star/beans/PropertyValue.hpp> 46cdf0e10cSrcweir 47cdf0e10cSrcweir #define GLOBALOVERFLOW 48cdf0e10cSrcweir 49cdf0e10cSrcweir using namespace ::com::sun::star; 50cdf0e10cSrcweir 51cdf0e10cSrcweir // --------------- 52cdf0e10cSrcweir // class XOBitmap 53cdf0e10cSrcweir // --------------- 54cdf0e10cSrcweir 55cdf0e10cSrcweir /************************************************************************* 56cdf0e10cSrcweir |* 57cdf0e10cSrcweir |* XOBitmap::XOBitmap() 58cdf0e10cSrcweir |* 59cdf0e10cSrcweir |* Beschreibung 60cdf0e10cSrcweir |* Ersterstellung 27.07.95 61cdf0e10cSrcweir |* Letzte Aenderung 27.07.95 62cdf0e10cSrcweir |* 63cdf0e10cSrcweir *************************************************************************/ 64cdf0e10cSrcweir 65cdf0e10cSrcweir XOBitmap::XOBitmap() : 66cdf0e10cSrcweir eType ( XBITMAP_NONE ), 67cdf0e10cSrcweir eStyle ( XBITMAP_STRETCH ), 68cdf0e10cSrcweir pPixelArray ( NULL ), 69cdf0e10cSrcweir bGraphicDirty ( sal_False ) 70cdf0e10cSrcweir { 71cdf0e10cSrcweir } 72cdf0e10cSrcweir 73cdf0e10cSrcweir /************************************************************************* 74cdf0e10cSrcweir |* 75cdf0e10cSrcweir |* XOBitmap::XOBitmap( Bitmap aBitmap, XBitmapStyle eStyle = XBITMAP_TILE ) 76cdf0e10cSrcweir |* 77cdf0e10cSrcweir |* Beschreibung 78cdf0e10cSrcweir |* Ersterstellung 26.07.95 79cdf0e10cSrcweir |* Letzte Aenderung 26.07.95 80cdf0e10cSrcweir |* 81cdf0e10cSrcweir *************************************************************************/ 82cdf0e10cSrcweir 83cdf0e10cSrcweir XOBitmap::XOBitmap( const Bitmap& rBmp, XBitmapStyle eInStyle ) : 84cdf0e10cSrcweir eType ( XBITMAP_IMPORT ), 85cdf0e10cSrcweir eStyle ( eInStyle ), 86cdf0e10cSrcweir aGraphicObject ( rBmp ), 87cdf0e10cSrcweir pPixelArray ( NULL ), 88cdf0e10cSrcweir bGraphicDirty ( sal_False ) 89cdf0e10cSrcweir { 90cdf0e10cSrcweir } 91cdf0e10cSrcweir 92cdf0e10cSrcweir /************************************************************************* 93cdf0e10cSrcweir |* 94cdf0e10cSrcweir |* XOBitmap::XOBitmap( Bitmap aBitmap, XBitmapStyle eStyle = XBITMAP_TILE ) 95cdf0e10cSrcweir |* 96cdf0e10cSrcweir |* Beschreibung 97cdf0e10cSrcweir |* Ersterstellung 26.07.95 98cdf0e10cSrcweir |* Letzte Aenderung 26.07.95 99cdf0e10cSrcweir |* 100cdf0e10cSrcweir *************************************************************************/ 101cdf0e10cSrcweir 102cdf0e10cSrcweir XOBitmap::XOBitmap( const GraphicObject& rGraphicObject, XBitmapStyle eInStyle ) : 103cdf0e10cSrcweir eType ( XBITMAP_IMPORT ), 104cdf0e10cSrcweir eStyle ( eInStyle ), 105cdf0e10cSrcweir aGraphicObject ( rGraphicObject ), 106cdf0e10cSrcweir pPixelArray ( NULL ), 107cdf0e10cSrcweir bGraphicDirty ( sal_False ) 108cdf0e10cSrcweir { 109cdf0e10cSrcweir } 110cdf0e10cSrcweir 111cdf0e10cSrcweir /************************************************************************* 112cdf0e10cSrcweir |* 113cdf0e10cSrcweir |* XOBitmap::XOBitmap( sal_uInt16* pArray, const Color& aPixelColor, 114cdf0e10cSrcweir |* const Color& aBckgrColor, const Size& rSize = Size( 8, 8 ), 115cdf0e10cSrcweir |* XBitmapStyle eStyle = XBITMAP_TILE ) 116cdf0e10cSrcweir |* 117cdf0e10cSrcweir |* Beschreibung 118cdf0e10cSrcweir |* Ersterstellung 26.07.95 119cdf0e10cSrcweir |* Letzte Aenderung 26.07.95 120cdf0e10cSrcweir |* 121cdf0e10cSrcweir *************************************************************************/ 122cdf0e10cSrcweir 123cdf0e10cSrcweir XOBitmap::XOBitmap( const sal_uInt16* pArray, const Color& rPixelColor, 124cdf0e10cSrcweir const Color& rBckgrColor, const Size& rSize, 125cdf0e10cSrcweir XBitmapStyle eInStyle ) : 126cdf0e10cSrcweir eStyle ( eInStyle ), 127cdf0e10cSrcweir pPixelArray ( NULL ), 128cdf0e10cSrcweir aArraySize ( rSize ), 129cdf0e10cSrcweir aPixelColor ( rPixelColor ), 130cdf0e10cSrcweir aBckgrColor ( rBckgrColor ), 131cdf0e10cSrcweir bGraphicDirty ( sal_True ) 132cdf0e10cSrcweir 133cdf0e10cSrcweir { 134cdf0e10cSrcweir if( aArraySize.Width() == 8 && aArraySize.Height() == 8 ) 135cdf0e10cSrcweir { 136cdf0e10cSrcweir eType = XBITMAP_8X8; 137cdf0e10cSrcweir pPixelArray = new sal_uInt16[ 64 ]; 138cdf0e10cSrcweir 139cdf0e10cSrcweir for( sal_uInt16 i = 0; i < 64; i++ ) 140cdf0e10cSrcweir *( pPixelArray + i ) = *( pArray + i ); 141cdf0e10cSrcweir } 142cdf0e10cSrcweir else 143cdf0e10cSrcweir { 144cdf0e10cSrcweir DBG_ASSERT( 0, "Nicht unterstuetzte Bitmapgroesse" ); 145cdf0e10cSrcweir } 146cdf0e10cSrcweir } 147cdf0e10cSrcweir 148cdf0e10cSrcweir /************************************************************************* 149cdf0e10cSrcweir |* 150cdf0e10cSrcweir |* XOBitmap::XOBitmap( const XOBitmap& rXBmp ) 151cdf0e10cSrcweir |* 152cdf0e10cSrcweir |* Beschreibung 153cdf0e10cSrcweir |* Ersterstellung 27.07.95 154cdf0e10cSrcweir |* Letzte Aenderung 27.07.95 155cdf0e10cSrcweir |* 156cdf0e10cSrcweir *************************************************************************/ 157cdf0e10cSrcweir 158cdf0e10cSrcweir XOBitmap::XOBitmap( const XOBitmap& rXBmp ) : 159cdf0e10cSrcweir pPixelArray ( NULL ) 160cdf0e10cSrcweir { 161cdf0e10cSrcweir eType = rXBmp.eType; 162cdf0e10cSrcweir eStyle = rXBmp.eStyle; 163cdf0e10cSrcweir aGraphicObject = rXBmp.aGraphicObject; 164cdf0e10cSrcweir aArraySize = rXBmp.aArraySize; 165cdf0e10cSrcweir aPixelColor = rXBmp.aPixelColor; 166cdf0e10cSrcweir aBckgrColor = rXBmp.aBckgrColor; 167cdf0e10cSrcweir bGraphicDirty = rXBmp.bGraphicDirty; 168cdf0e10cSrcweir 169cdf0e10cSrcweir if( rXBmp.pPixelArray ) 170cdf0e10cSrcweir { 171cdf0e10cSrcweir if( eType == XBITMAP_8X8 ) 172cdf0e10cSrcweir { 173cdf0e10cSrcweir pPixelArray = new sal_uInt16[ 64 ]; 174cdf0e10cSrcweir 175cdf0e10cSrcweir for( sal_uInt16 i = 0; i < 64; i++ ) 176cdf0e10cSrcweir *( pPixelArray + i ) = *( rXBmp.pPixelArray + i ); 177cdf0e10cSrcweir } 178cdf0e10cSrcweir } 179cdf0e10cSrcweir } 180cdf0e10cSrcweir 181cdf0e10cSrcweir /************************************************************************* 182cdf0e10cSrcweir |* 183cdf0e10cSrcweir |* XOBitmap::XOBitmap( Bitmap aBitmap, XBitmapStyle eStyle = XBITMAP_TILE ) 184cdf0e10cSrcweir |* 185cdf0e10cSrcweir |* Beschreibung 186cdf0e10cSrcweir |* Ersterstellung 26.07.95 187cdf0e10cSrcweir |* Letzte Aenderung 26.07.95 188cdf0e10cSrcweir |* 189cdf0e10cSrcweir *************************************************************************/ 190cdf0e10cSrcweir 191cdf0e10cSrcweir XOBitmap::~XOBitmap() 192cdf0e10cSrcweir { 193cdf0e10cSrcweir if( pPixelArray ) 194cdf0e10cSrcweir delete []pPixelArray; 195cdf0e10cSrcweir } 196cdf0e10cSrcweir 197cdf0e10cSrcweir /************************************************************************* 198cdf0e10cSrcweir |* 199cdf0e10cSrcweir |* XOBitmap& XOBitmap::operator=( const XOBitmap& rXBmp ) 200cdf0e10cSrcweir |* 201cdf0e10cSrcweir |* Beschreibung 202cdf0e10cSrcweir |* Ersterstellung 27.07.95 203cdf0e10cSrcweir |* Letzte Aenderung 27.07.95 204cdf0e10cSrcweir |* 205cdf0e10cSrcweir *************************************************************************/ 206cdf0e10cSrcweir 207cdf0e10cSrcweir XOBitmap& XOBitmap::operator=( const XOBitmap& rXBmp ) 208cdf0e10cSrcweir { 209cdf0e10cSrcweir eType = rXBmp.eType; 210cdf0e10cSrcweir eStyle = rXBmp.eStyle; 211cdf0e10cSrcweir aGraphicObject = rXBmp.aGraphicObject; 212cdf0e10cSrcweir aArraySize = rXBmp.aArraySize; 213cdf0e10cSrcweir aPixelColor = rXBmp.aPixelColor; 214cdf0e10cSrcweir aBckgrColor = rXBmp.aBckgrColor; 215cdf0e10cSrcweir bGraphicDirty = rXBmp.bGraphicDirty; 216cdf0e10cSrcweir 217cdf0e10cSrcweir if( rXBmp.pPixelArray ) 218cdf0e10cSrcweir { 219cdf0e10cSrcweir if( eType == XBITMAP_8X8 ) 220cdf0e10cSrcweir { 221cdf0e10cSrcweir pPixelArray = new sal_uInt16[ 64 ]; 222cdf0e10cSrcweir 223cdf0e10cSrcweir for( sal_uInt16 i = 0; i < 64; i++ ) 224cdf0e10cSrcweir *( pPixelArray + i ) = *( rXBmp.pPixelArray + i ); 225cdf0e10cSrcweir } 226cdf0e10cSrcweir } 227cdf0e10cSrcweir return( *this ); 228cdf0e10cSrcweir } 229cdf0e10cSrcweir 230cdf0e10cSrcweir /************************************************************************* 231cdf0e10cSrcweir |* 232cdf0e10cSrcweir |* int XOBitmap::operator==( const XOBitmap& rXOBitmap ) const 233cdf0e10cSrcweir |* 234cdf0e10cSrcweir |* Beschreibung 235cdf0e10cSrcweir |* Ersterstellung 26.07.95 236cdf0e10cSrcweir |* Letzte Aenderung 26.07.95 237cdf0e10cSrcweir |* 238cdf0e10cSrcweir *************************************************************************/ 239cdf0e10cSrcweir 240cdf0e10cSrcweir int XOBitmap::operator==( const XOBitmap& rXOBitmap ) const 241cdf0e10cSrcweir { 242cdf0e10cSrcweir if( eType != rXOBitmap.eType || 243cdf0e10cSrcweir eStyle != rXOBitmap.eStyle || 244cdf0e10cSrcweir aGraphicObject != rXOBitmap.aGraphicObject || 245cdf0e10cSrcweir aArraySize != rXOBitmap.aArraySize || 246cdf0e10cSrcweir aPixelColor != rXOBitmap.aPixelColor || 247cdf0e10cSrcweir aBckgrColor != rXOBitmap.aBckgrColor || 248cdf0e10cSrcweir bGraphicDirty != rXOBitmap.bGraphicDirty ) 249cdf0e10cSrcweir { 250cdf0e10cSrcweir return( sal_False ); 251cdf0e10cSrcweir } 252cdf0e10cSrcweir 253cdf0e10cSrcweir if( pPixelArray && rXOBitmap.pPixelArray ) 254cdf0e10cSrcweir { 255cdf0e10cSrcweir sal_uInt16 nCount = (sal_uInt16) ( aArraySize.Width() * aArraySize.Height() ); 256cdf0e10cSrcweir for( sal_uInt16 i = 0; i < nCount; i++ ) 257cdf0e10cSrcweir { 258cdf0e10cSrcweir if( *( pPixelArray + i ) != *( rXOBitmap.pPixelArray + i ) ) 259cdf0e10cSrcweir return( sal_False ); 260cdf0e10cSrcweir } 261cdf0e10cSrcweir } 262cdf0e10cSrcweir return( sal_True ); 263cdf0e10cSrcweir } 264cdf0e10cSrcweir 265cdf0e10cSrcweir /************************************************************************* 266cdf0e10cSrcweir |* 267cdf0e10cSrcweir |* void SetPixelArray( const sal_uInt16* pArray ) 268cdf0e10cSrcweir |* 269cdf0e10cSrcweir |* Beschreibung 270cdf0e10cSrcweir |* Ersterstellung 27.07.95 271cdf0e10cSrcweir |* Letzte Aenderung 27.07.95 272cdf0e10cSrcweir |* 273cdf0e10cSrcweir *************************************************************************/ 274cdf0e10cSrcweir 275cdf0e10cSrcweir void XOBitmap::SetPixelArray( const sal_uInt16* pArray ) 276cdf0e10cSrcweir { 277cdf0e10cSrcweir if( eType == XBITMAP_8X8 ) 278cdf0e10cSrcweir { 279cdf0e10cSrcweir if( pPixelArray ) 280cdf0e10cSrcweir delete []pPixelArray; 281cdf0e10cSrcweir 282cdf0e10cSrcweir pPixelArray = new sal_uInt16[ 64 ]; 283cdf0e10cSrcweir 284cdf0e10cSrcweir for( sal_uInt16 i = 0; i < 64; i++ ) 285cdf0e10cSrcweir *( pPixelArray + i ) = *( pArray + i ); 286cdf0e10cSrcweir 287cdf0e10cSrcweir bGraphicDirty = sal_True; 288cdf0e10cSrcweir } 289cdf0e10cSrcweir else 290cdf0e10cSrcweir { 291cdf0e10cSrcweir DBG_ASSERT( 0, "Nicht unterstuetzter Bitmaptyp" ); 292cdf0e10cSrcweir } 293cdf0e10cSrcweir } 294cdf0e10cSrcweir 295cdf0e10cSrcweir /************************************************************************* 296cdf0e10cSrcweir |* 297cdf0e10cSrcweir |* Bitmap XOBitmap::GetBitmap() 298cdf0e10cSrcweir |* 299cdf0e10cSrcweir |* Beschreibung 300cdf0e10cSrcweir |* Ersterstellung 26.07.95 301cdf0e10cSrcweir |* Letzte Aenderung 26.07.95 302cdf0e10cSrcweir |* 303cdf0e10cSrcweir *************************************************************************/ 304cdf0e10cSrcweir 305cdf0e10cSrcweir Bitmap XOBitmap::GetBitmap() const 306cdf0e10cSrcweir { 307cdf0e10cSrcweir return GetGraphicObject().GetGraphic().GetBitmap(); 308cdf0e10cSrcweir } 309cdf0e10cSrcweir 310cdf0e10cSrcweir /************************************************************************* 311cdf0e10cSrcweir |* 312cdf0e10cSrcweir |* Bitmap XOBitmap::GetGraphicObject() 313cdf0e10cSrcweir |* 314cdf0e10cSrcweir |* Beschreibung 315cdf0e10cSrcweir |* Ersterstellung 316cdf0e10cSrcweir |* Letzte Aenderung 317cdf0e10cSrcweir |* 318cdf0e10cSrcweir *************************************************************************/ 319cdf0e10cSrcweir 320cdf0e10cSrcweir const GraphicObject& XOBitmap::GetGraphicObject() const 321cdf0e10cSrcweir { 322cdf0e10cSrcweir if( bGraphicDirty ) 323cdf0e10cSrcweir ( (XOBitmap*) this )->Array2Bitmap(); 324cdf0e10cSrcweir 325cdf0e10cSrcweir return aGraphicObject; 326cdf0e10cSrcweir } 327cdf0e10cSrcweir 328cdf0e10cSrcweir /************************************************************************* 329cdf0e10cSrcweir |* 330cdf0e10cSrcweir |* void XOBitmap::Bitmap2Array() 331cdf0e10cSrcweir |* 332cdf0e10cSrcweir |* Beschreibung Umwandlung der Bitmap in Array, Hinter- u. 333cdf0e10cSrcweir |* Vordergrundfarbe 334cdf0e10cSrcweir |* Ersterstellung 27.07.95 335cdf0e10cSrcweir |* Letzte Aenderung 27.07.95 336cdf0e10cSrcweir |* 337cdf0e10cSrcweir *************************************************************************/ 338cdf0e10cSrcweir 339cdf0e10cSrcweir void XOBitmap::Bitmap2Array() 340cdf0e10cSrcweir { 341cdf0e10cSrcweir VirtualDevice aVD; 342cdf0e10cSrcweir sal_Bool bPixelColor = sal_False; 343cdf0e10cSrcweir const Bitmap aBitmap( GetBitmap() ); 344cdf0e10cSrcweir const sal_uInt16 nLines = 8; // von Type abhaengig 345cdf0e10cSrcweir 346cdf0e10cSrcweir if( !pPixelArray ) 347cdf0e10cSrcweir pPixelArray = new sal_uInt16[ nLines * nLines ]; 348cdf0e10cSrcweir 349cdf0e10cSrcweir aVD.SetOutputSizePixel( aBitmap.GetSizePixel() ); 350cdf0e10cSrcweir aVD.DrawBitmap( Point(), aBitmap ); 351cdf0e10cSrcweir aPixelColor = aBckgrColor = aVD.GetPixel( Point() ); 352cdf0e10cSrcweir 353cdf0e10cSrcweir // Aufbau des Arrays und Ermittlung der Vorder-, bzw. 354cdf0e10cSrcweir // Hintergrundfarbe 355cdf0e10cSrcweir for( sal_uInt16 i = 0; i < nLines; i++ ) 356cdf0e10cSrcweir { 357cdf0e10cSrcweir for( sal_uInt16 j = 0; j < nLines; j++ ) 358cdf0e10cSrcweir { 359cdf0e10cSrcweir if ( aVD.GetPixel( Point( j, i ) ) == aBckgrColor ) 360cdf0e10cSrcweir *( pPixelArray + j + i * nLines ) = 0; 361cdf0e10cSrcweir else 362cdf0e10cSrcweir { 363cdf0e10cSrcweir *( pPixelArray + j + i * nLines ) = 1; 364cdf0e10cSrcweir if( !bPixelColor ) 365cdf0e10cSrcweir { 366cdf0e10cSrcweir aPixelColor = aVD.GetPixel( Point( j, i ) ); 367cdf0e10cSrcweir bPixelColor = sal_True; 368cdf0e10cSrcweir } 369cdf0e10cSrcweir } 370cdf0e10cSrcweir } 371cdf0e10cSrcweir } 372cdf0e10cSrcweir } 373cdf0e10cSrcweir 374cdf0e10cSrcweir /************************************************************************* 375cdf0e10cSrcweir |* 376cdf0e10cSrcweir |* void XOBitmap::Array2Bitmap() 377cdf0e10cSrcweir |* 378cdf0e10cSrcweir |* Beschreibung Umwandlung des Arrays, Hinter- u. 379cdf0e10cSrcweir |* Vordergrundfarbe in eine Bitmap 380cdf0e10cSrcweir |* Ersterstellung 27.07.95 381cdf0e10cSrcweir |* Letzte Aenderung 27.07.95 382cdf0e10cSrcweir |* 383cdf0e10cSrcweir *************************************************************************/ 384cdf0e10cSrcweir 385cdf0e10cSrcweir void XOBitmap::Array2Bitmap() 386cdf0e10cSrcweir { 387cdf0e10cSrcweir VirtualDevice aVD; 388cdf0e10cSrcweir sal_uInt16 nLines = 8; // von Type abhaengig 389cdf0e10cSrcweir 390cdf0e10cSrcweir if( !pPixelArray ) 391cdf0e10cSrcweir return; 392cdf0e10cSrcweir 393cdf0e10cSrcweir aVD.SetOutputSizePixel( Size( nLines, nLines ) ); 394cdf0e10cSrcweir 395cdf0e10cSrcweir // Aufbau der Bitmap 396cdf0e10cSrcweir for( sal_uInt16 i = 0; i < nLines; i++ ) 397cdf0e10cSrcweir { 398cdf0e10cSrcweir for( sal_uInt16 j = 0; j < nLines; j++ ) 399cdf0e10cSrcweir { 400cdf0e10cSrcweir if( *( pPixelArray + j + i * nLines ) == 0 ) 401cdf0e10cSrcweir aVD.DrawPixel( Point( j, i ), aBckgrColor ); 402cdf0e10cSrcweir else 403cdf0e10cSrcweir aVD.DrawPixel( Point( j, i ), aPixelColor ); 404cdf0e10cSrcweir } 405cdf0e10cSrcweir } 406cdf0e10cSrcweir 407cdf0e10cSrcweir aGraphicObject = GraphicObject( aVD.GetBitmap( Point(), Size( nLines, nLines ) ) ); 408cdf0e10cSrcweir bGraphicDirty = sal_False; 409cdf0e10cSrcweir } 410cdf0e10cSrcweir 411cdf0e10cSrcweir // ----------------------- 412cdf0e10cSrcweir // class XFillBitmapItem 413cdf0e10cSrcweir // ----------------------- 414cdf0e10cSrcweir TYPEINIT1_AUTOFACTORY(XFillBitmapItem, NameOrIndex); 415cdf0e10cSrcweir 416cdf0e10cSrcweir /************************************************************************* 417cdf0e10cSrcweir |* 418cdf0e10cSrcweir |* XFillBitmapItem::XFillBitmapItem(long nIndex, 419cdf0e10cSrcweir |* const Bitmap& rTheBitmap) 420cdf0e10cSrcweir |* 421cdf0e10cSrcweir |* Beschreibung 422cdf0e10cSrcweir |* Ersterstellung 17.11.94 423cdf0e10cSrcweir |* Letzte Aenderung 17.11.94 424cdf0e10cSrcweir |* 425cdf0e10cSrcweir *************************************************************************/ 426cdf0e10cSrcweir 427cdf0e10cSrcweir XFillBitmapItem::XFillBitmapItem(long nIndex, 428cdf0e10cSrcweir const XOBitmap& rTheBitmap) : 429cdf0e10cSrcweir NameOrIndex( XATTR_FILLBITMAP, nIndex ), 430cdf0e10cSrcweir aXOBitmap( rTheBitmap ) 431cdf0e10cSrcweir { 432cdf0e10cSrcweir } 433cdf0e10cSrcweir 434cdf0e10cSrcweir /************************************************************************* 435cdf0e10cSrcweir |* 436cdf0e10cSrcweir |* XFillBitmapItem::XFillBitmapItem(const XubString& rName, 437cdf0e10cSrcweir |* const Bitmap& rTheBitmap) 438cdf0e10cSrcweir |* 439cdf0e10cSrcweir |* Beschreibung 440cdf0e10cSrcweir |* Ersterstellung 17.11.94 441cdf0e10cSrcweir |* Letzte Aenderung 17.11.94 442cdf0e10cSrcweir |* 443cdf0e10cSrcweir *************************************************************************/ 444cdf0e10cSrcweir 445cdf0e10cSrcweir XFillBitmapItem::XFillBitmapItem(const XubString& rName, 446cdf0e10cSrcweir const XOBitmap& rTheBitmap) : 447cdf0e10cSrcweir NameOrIndex( XATTR_FILLBITMAP, rName ), 448cdf0e10cSrcweir aXOBitmap( rTheBitmap ) 449cdf0e10cSrcweir { 450cdf0e10cSrcweir } 451cdf0e10cSrcweir 452cdf0e10cSrcweir /************************************************************************* 453cdf0e10cSrcweir |* 454cdf0e10cSrcweir |* XFillBitmapItem::XFillBitmapItem(const XFillBitmapItem& rItem) 455cdf0e10cSrcweir |* 456cdf0e10cSrcweir |* Beschreibung 457cdf0e10cSrcweir |* Ersterstellung 17.11.94 458cdf0e10cSrcweir |* Letzte Aenderung 17.11.94 459cdf0e10cSrcweir |* 460cdf0e10cSrcweir *************************************************************************/ 461cdf0e10cSrcweir 462cdf0e10cSrcweir XFillBitmapItem::XFillBitmapItem(const XFillBitmapItem& rItem) : 463cdf0e10cSrcweir NameOrIndex( rItem ), 464cdf0e10cSrcweir aXOBitmap( rItem.aXOBitmap ) 465cdf0e10cSrcweir { 466cdf0e10cSrcweir } 467cdf0e10cSrcweir 468cdf0e10cSrcweir /************************************************************************* 469cdf0e10cSrcweir |* 470cdf0e10cSrcweir |* XFillBitmapItem::XFillBitmapItem(SvStream& rIn) 471cdf0e10cSrcweir |* 472cdf0e10cSrcweir |* Beschreibung 473cdf0e10cSrcweir |* Ersterstellung 17.11.94 474cdf0e10cSrcweir |* Letzte Aenderung 26.07.94 475cdf0e10cSrcweir |* 476cdf0e10cSrcweir *************************************************************************/ 477cdf0e10cSrcweir 478cdf0e10cSrcweir XFillBitmapItem::XFillBitmapItem( SvStream& rIn, sal_uInt16 nVer ) : 479cdf0e10cSrcweir NameOrIndex( XATTR_FILLBITMAP, rIn ) 480cdf0e10cSrcweir { 481cdf0e10cSrcweir if( nVer == 0 ) 482cdf0e10cSrcweir { 483cdf0e10cSrcweir if (!IsIndex()) 484cdf0e10cSrcweir { 485cdf0e10cSrcweir // Behandlung der alten Bitmaps 486cdf0e10cSrcweir Bitmap aBmp; 487cdf0e10cSrcweir 488cdf0e10cSrcweir rIn >> aBmp; 489cdf0e10cSrcweir 490cdf0e10cSrcweir aXOBitmap.SetBitmap( aBmp ); 491cdf0e10cSrcweir aXOBitmap.SetBitmapStyle( XBITMAP_TILE ); 492cdf0e10cSrcweir 493cdf0e10cSrcweir if( aBmp.GetSizePixel().Width() == 8 && 494cdf0e10cSrcweir aBmp.GetSizePixel().Height() == 8 ) 495cdf0e10cSrcweir { 496cdf0e10cSrcweir aXOBitmap.SetBitmapType( XBITMAP_8X8 ); 497cdf0e10cSrcweir aXOBitmap.Bitmap2Array(); 498cdf0e10cSrcweir } 499cdf0e10cSrcweir else 500cdf0e10cSrcweir aXOBitmap.SetBitmapType( XBITMAP_IMPORT ); 501cdf0e10cSrcweir } 502cdf0e10cSrcweir } 503cdf0e10cSrcweir else if( nVer == 1 ) 504cdf0e10cSrcweir { 505cdf0e10cSrcweir if (!IsIndex()) 506cdf0e10cSrcweir { 507cdf0e10cSrcweir sal_Int16 iTmp; 508cdf0e10cSrcweir rIn >> iTmp; 509cdf0e10cSrcweir aXOBitmap.SetBitmapStyle( (XBitmapStyle) iTmp ); 510cdf0e10cSrcweir rIn >> iTmp; 511cdf0e10cSrcweir aXOBitmap.SetBitmapType( (XBitmapType) iTmp ); 512cdf0e10cSrcweir 513cdf0e10cSrcweir if( aXOBitmap.GetBitmapType() == XBITMAP_IMPORT ) 514cdf0e10cSrcweir { 515cdf0e10cSrcweir Bitmap aBmp; 516cdf0e10cSrcweir rIn >> aBmp; 517cdf0e10cSrcweir aXOBitmap.SetBitmap( aBmp ); 518cdf0e10cSrcweir } 519cdf0e10cSrcweir else if( aXOBitmap.GetBitmapType() == XBITMAP_8X8 ) 520cdf0e10cSrcweir { 521cdf0e10cSrcweir sal_uInt16* pArray = new sal_uInt16[ 64 ]; 522cdf0e10cSrcweir Color aColor; 523cdf0e10cSrcweir 524cdf0e10cSrcweir for( sal_uInt16 i = 0; i < 64; i++ ) 525cdf0e10cSrcweir rIn >> *( pArray + i ); 526cdf0e10cSrcweir aXOBitmap.SetPixelArray( pArray ); 527cdf0e10cSrcweir 528cdf0e10cSrcweir rIn >> aColor; 529cdf0e10cSrcweir aXOBitmap.SetPixelColor( aColor ); 530cdf0e10cSrcweir rIn >> aColor; 531cdf0e10cSrcweir aXOBitmap.SetBackgroundColor( aColor ); 532cdf0e10cSrcweir 533cdf0e10cSrcweir delete []pArray; 534cdf0e10cSrcweir } 535cdf0e10cSrcweir } 536cdf0e10cSrcweir } 537cdf0e10cSrcweir 538cdf0e10cSrcweir // #81908# force bitmap to exist 539cdf0e10cSrcweir aXOBitmap.GetBitmap(); 540cdf0e10cSrcweir } 541cdf0e10cSrcweir 542cdf0e10cSrcweir //************************************************************************* 543cdf0e10cSrcweir 544cdf0e10cSrcweir XFillBitmapItem::XFillBitmapItem( SfxItemPool* /*pPool*/, const XOBitmap& rTheBitmap ) 545cdf0e10cSrcweir : NameOrIndex( XATTR_FILLBITMAP, -1 ), 546cdf0e10cSrcweir aXOBitmap( rTheBitmap ) 547cdf0e10cSrcweir { 548cdf0e10cSrcweir } 549cdf0e10cSrcweir 550cdf0e10cSrcweir //************************************************************************* 551cdf0e10cSrcweir 552cdf0e10cSrcweir XFillBitmapItem::XFillBitmapItem( SfxItemPool* /*pPool*/) 553cdf0e10cSrcweir : NameOrIndex(XATTR_FILLBITMAP, -1 ) 554cdf0e10cSrcweir { 555cdf0e10cSrcweir } 556cdf0e10cSrcweir 557cdf0e10cSrcweir /************************************************************************* 558cdf0e10cSrcweir |* 559cdf0e10cSrcweir |* XFillBitmapItem::Clone(SfxItemPool* pPool) const 560cdf0e10cSrcweir |* 561cdf0e10cSrcweir |* Beschreibung 562cdf0e10cSrcweir |* Ersterstellung 17.11.94 563cdf0e10cSrcweir |* Letzte Aenderung 17.11.94 564cdf0e10cSrcweir |* 565cdf0e10cSrcweir *************************************************************************/ 566cdf0e10cSrcweir 567cdf0e10cSrcweir SfxPoolItem* XFillBitmapItem::Clone(SfxItemPool* /*pPool*/) const 568cdf0e10cSrcweir { 569cdf0e10cSrcweir return new XFillBitmapItem(*this); 570cdf0e10cSrcweir } 571cdf0e10cSrcweir 572cdf0e10cSrcweir /************************************************************************* 573cdf0e10cSrcweir |* 574cdf0e10cSrcweir |* int XFillBitmapItem::operator==(const SfxPoolItem& rItem) const 575cdf0e10cSrcweir |* 576cdf0e10cSrcweir |* Beschreibung 577cdf0e10cSrcweir |* Ersterstellung 17.11.94 578cdf0e10cSrcweir |* Letzte Aenderung 26.07.95 579cdf0e10cSrcweir |* 580cdf0e10cSrcweir *************************************************************************/ 581cdf0e10cSrcweir 582cdf0e10cSrcweir int XFillBitmapItem::operator==(const SfxPoolItem& rItem) const 583cdf0e10cSrcweir { 584cdf0e10cSrcweir return ( NameOrIndex::operator==(rItem) && 585cdf0e10cSrcweir aXOBitmap == ((const XFillBitmapItem&) rItem).aXOBitmap ); 586cdf0e10cSrcweir } 587cdf0e10cSrcweir 588cdf0e10cSrcweir /************************************************************************* 589cdf0e10cSrcweir |* 590cdf0e10cSrcweir |* SfxPoolItem* XFillBitmapItem::Create(SvStream& rIn, sal_uInt16 nVer) const 591cdf0e10cSrcweir |* 592cdf0e10cSrcweir |* Beschreibung 593cdf0e10cSrcweir |* Ersterstellung 17.11.94 594cdf0e10cSrcweir |* Letzte Aenderung 17.11.94 595cdf0e10cSrcweir |* 596cdf0e10cSrcweir *************************************************************************/ 597cdf0e10cSrcweir 598cdf0e10cSrcweir SfxPoolItem* XFillBitmapItem::Create(SvStream& rIn, sal_uInt16 nVer) const 599cdf0e10cSrcweir { 600cdf0e10cSrcweir return new XFillBitmapItem( rIn, nVer ); 601cdf0e10cSrcweir } 602cdf0e10cSrcweir 603cdf0e10cSrcweir /************************************************************************* 604cdf0e10cSrcweir |* 605cdf0e10cSrcweir |* SfxPoolItem* XFillBitmapItem::Store(SvStream& rOut) const 606cdf0e10cSrcweir |* 607cdf0e10cSrcweir |* Beschreibung 608cdf0e10cSrcweir |* Ersterstellung 17.11.94 609cdf0e10cSrcweir |* Letzte Aenderung 26.07.94 610cdf0e10cSrcweir |* 611cdf0e10cSrcweir *************************************************************************/ 612cdf0e10cSrcweir 613cdf0e10cSrcweir SvStream& XFillBitmapItem::Store( SvStream& rOut, sal_uInt16 nItemVersion ) const 614cdf0e10cSrcweir { 615cdf0e10cSrcweir NameOrIndex::Store( rOut, nItemVersion ); 616cdf0e10cSrcweir 617cdf0e10cSrcweir if (!IsIndex()) 618cdf0e10cSrcweir { 619cdf0e10cSrcweir rOut << (sal_Int16) aXOBitmap.GetBitmapStyle(); 620cdf0e10cSrcweir if( !aXOBitmap.GetBitmap() ) 621cdf0e10cSrcweir rOut << (sal_Int16) XBITMAP_NONE; 622cdf0e10cSrcweir else 623cdf0e10cSrcweir { 624cdf0e10cSrcweir rOut << (sal_Int16) aXOBitmap.GetBitmapType(); 625cdf0e10cSrcweir if( aXOBitmap.GetBitmapType() == XBITMAP_IMPORT ) 626cdf0e10cSrcweir { 627cdf0e10cSrcweir const sal_uInt16 nOldComprMode = rOut.GetCompressMode(); 628cdf0e10cSrcweir sal_uInt16 nNewComprMode = nOldComprMode; 629cdf0e10cSrcweir 630cdf0e10cSrcweir if( rOut.GetVersion() >= SOFFICE_FILEFORMAT_50 ) 631cdf0e10cSrcweir nNewComprMode |= COMPRESSMODE_ZBITMAP; 632cdf0e10cSrcweir else 633cdf0e10cSrcweir nNewComprMode &= ~COMPRESSMODE_ZBITMAP; 634cdf0e10cSrcweir 635cdf0e10cSrcweir rOut.SetCompressMode( nNewComprMode ); 636cdf0e10cSrcweir rOut << aXOBitmap.GetBitmap(); 637cdf0e10cSrcweir rOut.SetCompressMode( nOldComprMode ); 638cdf0e10cSrcweir } 639cdf0e10cSrcweir else if( aXOBitmap.GetBitmapType() == XBITMAP_8X8 ) 640cdf0e10cSrcweir { 641cdf0e10cSrcweir sal_uInt16* pArray = aXOBitmap.GetPixelArray(); 642cdf0e10cSrcweir for( sal_uInt16 i = 0; i < 64; i++ ) 643cdf0e10cSrcweir rOut << (sal_uInt16) *( pArray + i ); 644cdf0e10cSrcweir 645cdf0e10cSrcweir rOut << aXOBitmap.GetPixelColor(); 646cdf0e10cSrcweir rOut << aXOBitmap.GetBackgroundColor(); 647cdf0e10cSrcweir } 648cdf0e10cSrcweir } 649cdf0e10cSrcweir } 650cdf0e10cSrcweir 651cdf0e10cSrcweir return rOut; 652cdf0e10cSrcweir } 653cdf0e10cSrcweir 654cdf0e10cSrcweir /************************************************************************* 655cdf0e10cSrcweir |* 656cdf0e10cSrcweir |* const Bitmap& XFillBitmapItem::GetValue(const XBitmapTable* pTable) const 657cdf0e10cSrcweir |* 658cdf0e10cSrcweir |* Beschreibung 659cdf0e10cSrcweir |* Ersterstellung 15.11.94 660cdf0e10cSrcweir |* Letzte Aenderung 26.07.94 661cdf0e10cSrcweir |* 662cdf0e10cSrcweir *************************************************************************/ 663cdf0e10cSrcweir 664cdf0e10cSrcweir const XOBitmap& XFillBitmapItem::GetBitmapValue(const XBitmapTable* pTable) const // GetValue -> GetBitmapValue 665cdf0e10cSrcweir { 666cdf0e10cSrcweir if (!IsIndex()) 667cdf0e10cSrcweir return aXOBitmap; 668cdf0e10cSrcweir else 669cdf0e10cSrcweir return pTable->GetBitmap(GetIndex())->GetXBitmap(); 670cdf0e10cSrcweir } 671cdf0e10cSrcweir 672cdf0e10cSrcweir 673cdf0e10cSrcweir /************************************************************************* 674cdf0e10cSrcweir |* 675cdf0e10cSrcweir |* sal_uInt16 XFillBitmapItem::GetVersion() const 676cdf0e10cSrcweir |* 677cdf0e10cSrcweir |* Beschreibung 678cdf0e10cSrcweir |* Ersterstellung 26.07.95 679cdf0e10cSrcweir |* Letzte Aenderung 26.07.95 680cdf0e10cSrcweir |* 681cdf0e10cSrcweir *************************************************************************/ 682cdf0e10cSrcweir 683cdf0e10cSrcweir sal_uInt16 XFillBitmapItem::GetVersion( sal_uInt16 /*nFileFormatVersion*/) const 684cdf0e10cSrcweir { 685cdf0e10cSrcweir // 2. Version 686cdf0e10cSrcweir return( 1 ); 687cdf0e10cSrcweir } 688cdf0e10cSrcweir 689cdf0e10cSrcweir //------------------------------------------------------------------------ 690cdf0e10cSrcweir 691cdf0e10cSrcweir SfxItemPresentation XFillBitmapItem::GetPresentation 692cdf0e10cSrcweir ( 693cdf0e10cSrcweir SfxItemPresentation ePres, 694cdf0e10cSrcweir SfxMapUnit /*eCoreUnit*/, 695cdf0e10cSrcweir SfxMapUnit /*ePresUnit*/, 696cdf0e10cSrcweir XubString& rText, const IntlWrapper * 697cdf0e10cSrcweir ) const 698cdf0e10cSrcweir { 699cdf0e10cSrcweir switch ( ePres ) 700cdf0e10cSrcweir { 701cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NONE: 702cdf0e10cSrcweir rText.Erase(); 703cdf0e10cSrcweir return ePres; 704cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NAMELESS: 705cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_COMPLETE: 706cdf0e10cSrcweir rText += GetName(); 707cdf0e10cSrcweir return ePres; 708cdf0e10cSrcweir default: 709cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_NONE; 710cdf0e10cSrcweir } 711cdf0e10cSrcweir } 712cdf0e10cSrcweir 713cdf0e10cSrcweir //------------------------------------------------------------------------ 714cdf0e10cSrcweir 715cdf0e10cSrcweir sal_Bool XFillBitmapItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const 716cdf0e10cSrcweir { 717cdf0e10cSrcweir // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); 718cdf0e10cSrcweir nMemberId &= ~CONVERT_TWIPS; 719cdf0e10cSrcweir 720cdf0e10cSrcweir // needed for MID_NAME 721cdf0e10cSrcweir ::rtl::OUString aApiName; 722cdf0e10cSrcweir // needed for complete item (MID 0) 723cdf0e10cSrcweir ::rtl::OUString aInternalName; 724cdf0e10cSrcweir 725cdf0e10cSrcweir ::rtl::OUString aURL; 726cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap > xBmp; 727cdf0e10cSrcweir 728cdf0e10cSrcweir if( nMemberId == MID_NAME ) 729cdf0e10cSrcweir { 730cdf0e10cSrcweir SvxUnogetApiNameForItem( Which(), GetName(), aApiName ); 731cdf0e10cSrcweir } 732cdf0e10cSrcweir else if( nMemberId == 0 ) 733cdf0e10cSrcweir { 734cdf0e10cSrcweir aInternalName = GetName(); 735cdf0e10cSrcweir } 736cdf0e10cSrcweir 737cdf0e10cSrcweir if( nMemberId == MID_GRAFURL || 738cdf0e10cSrcweir nMemberId == 0 ) 739cdf0e10cSrcweir { 740cdf0e10cSrcweir XOBitmap aLocalXOBitmap( GetBitmapValue() ); 741cdf0e10cSrcweir aURL = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(UNO_NAME_GRAPHOBJ_URLPREFIX)); 742cdf0e10cSrcweir aURL += ::rtl::OUString::createFromAscii( aLocalXOBitmap.GetGraphicObject().GetUniqueID().GetBuffer() ); 743cdf0e10cSrcweir } 744cdf0e10cSrcweir if( nMemberId == MID_BITMAP || 745cdf0e10cSrcweir nMemberId == 0 ) 746cdf0e10cSrcweir { 747cdf0e10cSrcweir XOBitmap aLocalXOBitmap( GetBitmapValue() ); 748cdf0e10cSrcweir Bitmap aBmp( aLocalXOBitmap.GetBitmap() ); 749cdf0e10cSrcweir BitmapEx aBmpEx( aBmp ); 750cdf0e10cSrcweir 751cdf0e10cSrcweir xBmp.set( VCLUnoHelper::CreateBitmap( aBmpEx ) ); 752cdf0e10cSrcweir } 753cdf0e10cSrcweir 754cdf0e10cSrcweir if( nMemberId == MID_NAME ) 755cdf0e10cSrcweir rVal <<= aApiName; 756cdf0e10cSrcweir else if( nMemberId == MID_GRAFURL ) 757cdf0e10cSrcweir rVal <<= aURL; 758cdf0e10cSrcweir else if( nMemberId == MID_BITMAP ) 759cdf0e10cSrcweir rVal <<= xBmp; 760cdf0e10cSrcweir else 761cdf0e10cSrcweir { 762cdf0e10cSrcweir // member-id 0 => complete item (e.g. for toolbars) 763cdf0e10cSrcweir DBG_ASSERT( nMemberId == 0, "invalid member-id" ); 764cdf0e10cSrcweir uno::Sequence< beans::PropertyValue > aPropSeq( 3 ); 765cdf0e10cSrcweir 766cdf0e10cSrcweir aPropSeq[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Name" )); 767cdf0e10cSrcweir aPropSeq[0].Value = uno::makeAny( aInternalName ); 768cdf0e10cSrcweir aPropSeq[1].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FillBitmapURL" )); 769cdf0e10cSrcweir aPropSeq[1].Value = uno::makeAny( aURL ); 770cdf0e10cSrcweir aPropSeq[2].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Bitmap" )); 771cdf0e10cSrcweir aPropSeq[2].Value = uno::makeAny( xBmp ); 772cdf0e10cSrcweir 773cdf0e10cSrcweir rVal <<= aPropSeq; 774cdf0e10cSrcweir } 775cdf0e10cSrcweir 776cdf0e10cSrcweir return sal_True; 777cdf0e10cSrcweir } 778cdf0e10cSrcweir 779cdf0e10cSrcweir //------------------------------------------------------------------------ 780cdf0e10cSrcweir 781cdf0e10cSrcweir sal_Bool XFillBitmapItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) 782cdf0e10cSrcweir { 783cdf0e10cSrcweir // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); 784cdf0e10cSrcweir nMemberId &= ~CONVERT_TWIPS; 785cdf0e10cSrcweir 786cdf0e10cSrcweir ::rtl::OUString aName; 787cdf0e10cSrcweir ::rtl::OUString aURL; 788cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap > xBmp; 789cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > xGraphic; 790cdf0e10cSrcweir 791cdf0e10cSrcweir bool bSetName = false; 792cdf0e10cSrcweir bool bSetURL = false; 793cdf0e10cSrcweir bool bSetBitmap = false; 794cdf0e10cSrcweir 795cdf0e10cSrcweir if( nMemberId == MID_NAME ) 796cdf0e10cSrcweir bSetName = (rVal >>= aName); 797cdf0e10cSrcweir else if( nMemberId == MID_GRAFURL ) 798cdf0e10cSrcweir bSetURL = (rVal >>= aURL); 799cdf0e10cSrcweir else if( nMemberId == MID_BITMAP ) 800cdf0e10cSrcweir { 801cdf0e10cSrcweir bSetBitmap = (rVal >>= xBmp); 802cdf0e10cSrcweir if ( !bSetBitmap ) 803cdf0e10cSrcweir bSetBitmap = (rVal >>= xGraphic ); 804cdf0e10cSrcweir } 805cdf0e10cSrcweir else 806cdf0e10cSrcweir { 807cdf0e10cSrcweir DBG_ASSERT( nMemberId == 0, "invalid member-id" ); 808cdf0e10cSrcweir uno::Sequence< beans::PropertyValue > aPropSeq; 809cdf0e10cSrcweir if( rVal >>= aPropSeq ) 810cdf0e10cSrcweir { 811cdf0e10cSrcweir for ( sal_Int32 n = 0; n < aPropSeq.getLength(); n++ ) 812cdf0e10cSrcweir { 813cdf0e10cSrcweir if( aPropSeq[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Name" ))) 814cdf0e10cSrcweir bSetName = (aPropSeq[n].Value >>= aName); 815cdf0e10cSrcweir else if( aPropSeq[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "FillBitmapURL" ))) 816cdf0e10cSrcweir bSetURL = (aPropSeq[n].Value >>= aURL); 817cdf0e10cSrcweir else if( aPropSeq[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Bitmap" ))) 818cdf0e10cSrcweir bSetBitmap = (aPropSeq[n].Value >>= xBmp); 819cdf0e10cSrcweir } 820cdf0e10cSrcweir } 821cdf0e10cSrcweir } 822cdf0e10cSrcweir 823cdf0e10cSrcweir if( bSetName ) 824cdf0e10cSrcweir { 825cdf0e10cSrcweir SetName( aName ); 826cdf0e10cSrcweir } 827cdf0e10cSrcweir if( bSetURL ) 828cdf0e10cSrcweir { 829cdf0e10cSrcweir GraphicObject aGrafObj( GraphicObject::CreateGraphicObjectFromURL( aURL ) ); 830cdf0e10cSrcweir XOBitmap aBMP( aGrafObj ); 831cdf0e10cSrcweir SetBitmapValue( aBMP ); 832cdf0e10cSrcweir } 833cdf0e10cSrcweir if( bSetBitmap ) 834cdf0e10cSrcweir { 835cdf0e10cSrcweir Bitmap aInput; 836cdf0e10cSrcweir if ( xBmp.is() ) 837cdf0e10cSrcweir { 838cdf0e10cSrcweir BitmapEx aInputEx( VCLUnoHelper::GetBitmap( xBmp ) ); 839cdf0e10cSrcweir aInput = aInputEx.GetBitmap(); 840cdf0e10cSrcweir } 841cdf0e10cSrcweir else if ( xGraphic.is() ) 842cdf0e10cSrcweir { 843cdf0e10cSrcweir Graphic aGraphic( xGraphic ); 844cdf0e10cSrcweir aInput = aGraphic.GetBitmap(); 845cdf0e10cSrcweir } 846cdf0e10cSrcweir 847cdf0e10cSrcweir // note: aXOBitmap is the member bitmap 848cdf0e10cSrcweir aXOBitmap.SetBitmap( aInput ); 849cdf0e10cSrcweir aXOBitmap.SetBitmapType(XBITMAP_IMPORT); 850cdf0e10cSrcweir 851cdf0e10cSrcweir if(aInput.GetSizePixel().Width() == 8 852cdf0e10cSrcweir && aInput.GetSizePixel().Height() == 8 853cdf0e10cSrcweir && aInput.GetColorCount() == 2) 854cdf0e10cSrcweir { 855cdf0e10cSrcweir aXOBitmap.Bitmap2Array(); 856cdf0e10cSrcweir aXOBitmap.SetBitmapType(XBITMAP_8X8); 857cdf0e10cSrcweir aXOBitmap.SetPixelSize(aInput.GetSizePixel()); 858cdf0e10cSrcweir } 859cdf0e10cSrcweir } 860cdf0e10cSrcweir 861cdf0e10cSrcweir return (bSetName || bSetURL || bSetBitmap); 862cdf0e10cSrcweir } 863cdf0e10cSrcweir 864cdf0e10cSrcweir sal_Bool XFillBitmapItem::CompareValueFunc( const NameOrIndex* p1, const NameOrIndex* p2 ) 865cdf0e10cSrcweir { 866cdf0e10cSrcweir return ((XFillBitmapItem*)p1)->GetBitmapValue().GetGraphicObject().GetUniqueID() == 867cdf0e10cSrcweir ((XFillBitmapItem*)p2)->GetBitmapValue().GetGraphicObject().GetUniqueID(); 868cdf0e10cSrcweir } 869cdf0e10cSrcweir 870cdf0e10cSrcweir XFillBitmapItem* XFillBitmapItem::checkForUniqueItem( SdrModel* pModel ) const 871cdf0e10cSrcweir { 872cdf0e10cSrcweir if( pModel ) 873cdf0e10cSrcweir { 874cdf0e10cSrcweir const String aUniqueName = NameOrIndex::CheckNamedItem( this, 875cdf0e10cSrcweir XATTR_FILLBITMAP, 876cdf0e10cSrcweir &pModel->GetItemPool(), 877cdf0e10cSrcweir pModel->GetStyleSheetPool() ? &pModel->GetStyleSheetPool()->GetPool() : NULL, 878cdf0e10cSrcweir XFillBitmapItem::CompareValueFunc, 879cdf0e10cSrcweir RID_SVXSTR_BMP21, 880cdf0e10cSrcweir pModel->GetBitmapList() ); 881cdf0e10cSrcweir 882cdf0e10cSrcweir // if the given name is not valid, replace it! 883cdf0e10cSrcweir if( aUniqueName != GetName() ) 884cdf0e10cSrcweir { 885cdf0e10cSrcweir return new XFillBitmapItem( aUniqueName, aXOBitmap ); 886cdf0e10cSrcweir } 887cdf0e10cSrcweir } 888cdf0e10cSrcweir 889cdf0e10cSrcweir return (XFillBitmapItem*)this; 890cdf0e10cSrcweir } 891