summaryrefslogtreecommitdiff
path: root/svx/source/xoutdev
diff options
context:
space:
mode:
authorArmin Le Grand <alg@apache.org>2012-05-10 09:29:55 +0000
committerArmin Le Grand <alg@apache.org>2012-05-10 09:29:55 +0000
commita54418afa6af7ea8c820f768ed1b90dd08669bc1 (patch)
treee37beb7581ef6c4b00046091001e85dcfa0873aa /svx/source/xoutdev
parent4d03efdfea6100cb0ffaf2120ffeb3616491879d (diff)
#119125# Completely changed XFillBitmapItem to work wit GraphicObject, removed XOBitmap class, adapted all usages (also the pretty old 8x8 pixel editor). All Bitmap fill styles will now accept transparent bitmaps as fillings in all variations (tiled, etc.). LoadSave is no problem, ODF defines graphic as content for fill. Backward means that OOs before this change will use a white background ofr fill with transparent, same as the fallback all the time when using a transparent fill. This is also a preparation to e.g. offer SVG or Metafiles as fill style.
Notes
Notes: merged as: c97aec0d2276901c20634abe53867f739f420f50
Diffstat (limited to 'svx/source/xoutdev')
-rw-r--r--svx/source/xoutdev/xattr.cxx8
-rw-r--r--svx/source/xoutdev/xattrbmp.cxx748
-rw-r--r--svx/source/xoutdev/xpool.cxx4
-rw-r--r--svx/source/xoutdev/xtabbtmp.cxx39
4 files changed, 191 insertions, 608 deletions
diff --git a/svx/source/xoutdev/xattr.cxx b/svx/source/xoutdev/xattr.cxx
index a7a9f1ad0894..2c58aad9b34f 100644
--- a/svx/source/xoutdev/xattr.cxx
+++ b/svx/source/xoutdev/xattr.cxx
@@ -291,9 +291,13 @@ String NameOrIndex::CheckNamedItem( const NameOrIndex* pCheckItem, const sal_uIn
switch( nWhich )
{
case XATTR_FILLBITMAP:
- bFound = (((XFillBitmapItem*)pCheckItem)->GetBitmapValue().GetGraphicObject().GetUniqueID() ==
- ((XBitmapEntry*)pEntry)->GetXBitmap().GetGraphicObject().GetUniqueID());
+ {
+ const GraphicObject& rGraphicObjectA(((XFillBitmapItem*)pCheckItem)->GetGraphicObject());
+ const GraphicObject& rGraphicObjectB(((XBitmapEntry*)pEntry)->GetGraphicObject());
+
+ bFound = (rGraphicObjectA == rGraphicObjectB);
break;
+ }
case XATTR_LINEDASH:
bFound = (((XLineDashItem*)pCheckItem)->GetDashValue() == ((XDashEntry*)pEntry) ->GetDash());
break;
diff --git a/svx/source/xoutdev/xattrbmp.cxx b/svx/source/xoutdev/xattrbmp.cxx
index c40542d398f9..52e81ed731a0 100644
--- a/svx/source/xoutdev/xattrbmp.cxx
+++ b/svx/source/xoutdev/xattrbmp.cxx
@@ -19,10 +19,9 @@
*
*************************************************************/
-
-
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svx.hxx"
+
#include <com/sun/star/awt/XBitmap.hpp>
#include <com/sun/star/graphic/XGraphic.hpp>
#include <tools/stream.hxx>
@@ -32,671 +31,266 @@
#include <toolkit/unohlp.hxx>
#include <svl/style.hxx>
#include <editeng/memberids.hrc>
-
#include <svx/dialogs.hrc>
#include "svx/xattr.hxx"
#include <svx/xtable.hxx>
#include <svx/xdef.hxx>
#include <svx/unomid.hxx>
#include <editeng/unoprnms.hxx>
-
-#include "svx/unoapi.hxx"
+#include <svx/unoapi.hxx>
#include <svx/svdmodel.hxx>
#include <com/sun/star/beans/PropertyValue.hpp>
-
-#define GLOBALOVERFLOW
+#include <vcl/salbtype.hxx>
+#include <vcl/bmpacc.hxx>
using namespace ::com::sun::star;
-// ---------------
-// class XOBitmap
-// ---------------
-
-/*************************************************************************
-|*
-|* XOBitmap::XOBitmap()
-|*
-|* Beschreibung
-|* Ersterstellung 27.07.95
-|* Letzte Aenderung 27.07.95
-|*
-*************************************************************************/
-
-XOBitmap::XOBitmap() :
- eType ( XBITMAP_NONE ),
- eStyle ( XBITMAP_STRETCH ),
- pPixelArray ( NULL ),
- bGraphicDirty ( sal_False )
-{
-}
+// -----------------------
+// class XFillBitmapItem
+// -----------------------
+TYPEINIT1_AUTOFACTORY(XFillBitmapItem, NameOrIndex);
-/*************************************************************************
-|*
-|* XOBitmap::XOBitmap( Bitmap aBitmap, XBitmapStyle eStyle = XBITMAP_TILE )
-|*
-|* Beschreibung
-|* Ersterstellung 26.07.95
-|* Letzte Aenderung 26.07.95
-|*
-*************************************************************************/
-
-XOBitmap::XOBitmap( const Bitmap& rBmp, XBitmapStyle eInStyle ) :
- eType ( XBITMAP_IMPORT ),
- eStyle ( eInStyle ),
- aGraphicObject ( rBmp ),
- pPixelArray ( NULL ),
- bGraphicDirty ( sal_False )
-{
-}
+//////////////////////////////////////////////////////////////////////////////
-/*************************************************************************
-|*
-|* XOBitmap::XOBitmap( Bitmap aBitmap, XBitmapStyle eStyle = XBITMAP_TILE )
-|*
-|* Beschreibung
-|* Ersterstellung 26.07.95
-|* Letzte Aenderung 26.07.95
-|*
-*************************************************************************/
-
-XOBitmap::XOBitmap( const GraphicObject& rGraphicObject, XBitmapStyle eInStyle ) :
- eType ( XBITMAP_IMPORT ),
- eStyle ( eInStyle ),
- aGraphicObject ( rGraphicObject ),
- pPixelArray ( NULL ),
- bGraphicDirty ( sal_False )
+XFillBitmapItem::XFillBitmapItem(long nIndex, const GraphicObject& rGraphicObject)
+: NameOrIndex(XATTR_FILLBITMAP, nIndex),
+ maGraphicObject(rGraphicObject)
{
}
-/*************************************************************************
-|*
-|* XOBitmap::XOBitmap( sal_uInt16* pArray, const Color& aPixelColor,
-|* const Color& aBckgrColor, const Size& rSize = Size( 8, 8 ),
-|* XBitmapStyle eStyle = XBITMAP_TILE )
-|*
-|* Beschreibung
-|* Ersterstellung 26.07.95
-|* Letzte Aenderung 26.07.95
-|*
-*************************************************************************/
-
-XOBitmap::XOBitmap( const sal_uInt16* pArray, const Color& rPixelColor,
- const Color& rBckgrColor, const Size& rSize,
- XBitmapStyle eInStyle ) :
- eStyle ( eInStyle ),
- pPixelArray ( NULL ),
- aArraySize ( rSize ),
- aPixelColor ( rPixelColor ),
- aBckgrColor ( rBckgrColor ),
- bGraphicDirty ( sal_True )
+//////////////////////////////////////////////////////////////////////////////
+XFillBitmapItem::XFillBitmapItem(const XubString& rName, const GraphicObject& rGraphicObject)
+: NameOrIndex(XATTR_FILLBITMAP, rName),
+ maGraphicObject(rGraphicObject)
{
- if( aArraySize.Width() == 8 && aArraySize.Height() == 8 )
- {
- eType = XBITMAP_8X8;
- pPixelArray = new sal_uInt16[ 64 ];
-
- for( sal_uInt16 i = 0; i < 64; i++ )
- *( pPixelArray + i ) = *( pArray + i );
- }
- else
- {
- DBG_ASSERT( 0, "Nicht unterstuetzte Bitmapgroesse" );
- }
}
-/*************************************************************************
-|*
-|* XOBitmap::XOBitmap( const XOBitmap& rXBmp )
-|*
-|* Beschreibung
-|* Ersterstellung 27.07.95
-|* Letzte Aenderung 27.07.95
-|*
-*************************************************************************/
-
-XOBitmap::XOBitmap( const XOBitmap& rXBmp ) :
- pPixelArray ( NULL )
-{
- eType = rXBmp.eType;
- eStyle = rXBmp.eStyle;
- aGraphicObject = rXBmp.aGraphicObject;
- aArraySize = rXBmp.aArraySize;
- aPixelColor = rXBmp.aPixelColor;
- aBckgrColor = rXBmp.aBckgrColor;
- bGraphicDirty = rXBmp.bGraphicDirty;
-
- if( rXBmp.pPixelArray )
- {
- if( eType == XBITMAP_8X8 )
- {
- pPixelArray = new sal_uInt16[ 64 ];
+//////////////////////////////////////////////////////////////////////////////
- for( sal_uInt16 i = 0; i < 64; i++ )
- *( pPixelArray + i ) = *( rXBmp.pPixelArray + i );
- }
- }
-}
-
-/*************************************************************************
-|*
-|* XOBitmap::XOBitmap( Bitmap aBitmap, XBitmapStyle eStyle = XBITMAP_TILE )
-|*
-|* Beschreibung
-|* Ersterstellung 26.07.95
-|* Letzte Aenderung 26.07.95
-|*
-*************************************************************************/
-
-XOBitmap::~XOBitmap()
+XFillBitmapItem::XFillBitmapItem(const XFillBitmapItem& rItem)
+: NameOrIndex(rItem),
+ maGraphicObject(rItem.maGraphicObject)
{
- if( pPixelArray )
- delete []pPixelArray;
}
-/*************************************************************************
-|*
-|* XOBitmap& XOBitmap::operator=( const XOBitmap& rXBmp )
-|*
-|* Beschreibung
-|* Ersterstellung 27.07.95
-|* Letzte Aenderung 27.07.95
-|*
-*************************************************************************/
-
-XOBitmap& XOBitmap::operator=( const XOBitmap& rXBmp )
+//////////////////////////////////////////////////////////////////////////////
+
+Bitmap createHistorical8x8FromArray(const sal_uInt16* pArray, Color aColorPix, Color aColorBack)
{
- eType = rXBmp.eType;
- eStyle = rXBmp.eStyle;
- aGraphicObject = rXBmp.aGraphicObject;
- aArraySize = rXBmp.aArraySize;
- aPixelColor = rXBmp.aPixelColor;
- aBckgrColor = rXBmp.aBckgrColor;
- bGraphicDirty = rXBmp.bGraphicDirty;
-
- if( rXBmp.pPixelArray )
- {
- if( eType == XBITMAP_8X8 )
- {
- pPixelArray = new sal_uInt16[ 64 ];
+ BitmapPalette aPalette(2);
- for( sal_uInt16 i = 0; i < 64; i++ )
- *( pPixelArray + i ) = *( rXBmp.pPixelArray + i );
- }
- }
- return( *this );
-}
+ aPalette[0] = BitmapColor(aColorBack);
+ aPalette[1] = BitmapColor(aColorPix);
-/*************************************************************************
-|*
-|* int XOBitmap::operator==( const XOBitmap& rXOBitmap ) const
-|*
-|* Beschreibung
-|* Ersterstellung 26.07.95
-|* Letzte Aenderung 26.07.95
-|*
-*************************************************************************/
-
-int XOBitmap::operator==( const XOBitmap& rXOBitmap ) const
-{
- if( eType != rXOBitmap.eType ||
- eStyle != rXOBitmap.eStyle ||
- aGraphicObject != rXOBitmap.aGraphicObject ||
- aArraySize != rXOBitmap.aArraySize ||
- aPixelColor != rXOBitmap.aPixelColor ||
- aBckgrColor != rXOBitmap.aBckgrColor ||
- bGraphicDirty != rXOBitmap.bGraphicDirty )
- {
- return( sal_False );
- }
+ Bitmap aBitmap(Size(8, 8), 1, &aPalette);
+ BitmapWriteAccess* pContent = aBitmap.AcquireWriteAccess();
- if( pPixelArray && rXOBitmap.pPixelArray )
+ if(pContent)
{
- sal_uInt16 nCount = (sal_uInt16) ( aArraySize.Width() * aArraySize.Height() );
- for( sal_uInt16 i = 0; i < nCount; i++ )
+ for(sal_uInt16 a(0); a < 8; a++)
{
- if( *( pPixelArray + i ) != *( rXOBitmap.pPixelArray + i ) )
- return( sal_False );
+ for(sal_uInt16 b(0); b < 8; b++)
+ {
+ if(pArray[(a * 8) + b])
+ {
+ pContent->SetPixel(b, a, sal_uInt8(1));
+ }
+ else
+ {
+ pContent->SetPixel(b, a, sal_uInt8(0));
+ }
+ }
}
- }
- return( sal_True );
-}
-
-/*************************************************************************
-|*
-|* void SetPixelArray( const sal_uInt16* pArray )
-|*
-|* Beschreibung
-|* Ersterstellung 27.07.95
-|* Letzte Aenderung 27.07.95
-|*
-*************************************************************************/
-
-void XOBitmap::SetPixelArray( const sal_uInt16* pArray )
-{
- if( eType == XBITMAP_8X8 )
- {
- if( pPixelArray )
- delete []pPixelArray;
-
- pPixelArray = new sal_uInt16[ 64 ];
- for( sal_uInt16 i = 0; i < 64; i++ )
- *( pPixelArray + i ) = *( pArray + i );
-
- bGraphicDirty = sal_True;
+ aBitmap.ReleaseAccess(pContent);
}
- else
- {
- DBG_ASSERT( 0, "Nicht unterstuetzter Bitmaptyp" );
- }
-}
-/*************************************************************************
-|*
-|* Bitmap XOBitmap::GetBitmap()
-|*
-|* Beschreibung
-|* Ersterstellung 26.07.95
-|* Letzte Aenderung 26.07.95
-|*
-*************************************************************************/
-
-Bitmap XOBitmap::GetBitmap() const
-{
- return GetGraphicObject().GetGraphic().GetBitmap();
+ return aBitmap;
}
-/*************************************************************************
-|*
-|* Bitmap XOBitmap::GetGraphicObject()
-|*
-|* Beschreibung
-|* Ersterstellung
-|* Letzte Aenderung
-|*
-*************************************************************************/
-
-const GraphicObject& XOBitmap::GetGraphicObject() const
-{
- if( bGraphicDirty )
- ( (XOBitmap*) this )->Array2Bitmap();
-
- return aGraphicObject;
-}
+//////////////////////////////////////////////////////////////////////////////
-/*************************************************************************
-|*
-|* void XOBitmap::Bitmap2Array()
-|*
-|* Beschreibung Umwandlung der Bitmap in Array, Hinter- u.
-|* Vordergrundfarbe
-|* Ersterstellung 27.07.95
-|* Letzte Aenderung 27.07.95
-|*
-*************************************************************************/
-
-void XOBitmap::Bitmap2Array()
+bool SVX_DLLPUBLIC isHistorical8x8(const BitmapEx& rBitmapEx, BitmapColor& o_rBack, BitmapColor& o_rFront)
{
- VirtualDevice aVD;
- sal_Bool bPixelColor = sal_False;
- const Bitmap aBitmap( GetBitmap() );
- const sal_uInt16 nLines = 8; // von Type abhaengig
-
- if( !pPixelArray )
- pPixelArray = new sal_uInt16[ nLines * nLines ];
-
- aVD.SetOutputSizePixel( aBitmap.GetSizePixel() );
- aVD.DrawBitmap( Point(), aBitmap );
- aPixelColor = aBckgrColor = aVD.GetPixel( Point() );
-
- // Aufbau des Arrays und Ermittlung der Vorder-, bzw.
- // Hintergrundfarbe
- for( sal_uInt16 i = 0; i < nLines; i++ )
+ if(!rBitmapEx.IsTransparent())
{
- for( sal_uInt16 j = 0; j < nLines; j++ )
+ Bitmap aBitmap(rBitmapEx.GetBitmap());
+
+ if(8 == aBitmap.GetSizePixel().Width() && 8 == aBitmap.GetSizePixel().Height())
{
- if ( aVD.GetPixel( Point( j, i ) ) == aBckgrColor )
- *( pPixelArray + j + i * nLines ) = 0;
- else
+ if(2 == aBitmap.GetColorCount())
{
- *( pPixelArray + j + i * nLines ) = 1;
- if( !bPixelColor )
- {
- aPixelColor = aVD.GetPixel( Point( j, i ) );
- bPixelColor = sal_True;
- }
- }
- }
- }
-}
-
-/*************************************************************************
-|*
-|* void XOBitmap::Array2Bitmap()
-|*
-|* Beschreibung Umwandlung des Arrays, Hinter- u.
-|* Vordergrundfarbe in eine Bitmap
-|* Ersterstellung 27.07.95
-|* Letzte Aenderung 27.07.95
-|*
-*************************************************************************/
-
-void XOBitmap::Array2Bitmap()
-{
- VirtualDevice aVD;
- sal_uInt16 nLines = 8; // von Type abhaengig
+ BitmapReadAccess* pRead = aBitmap.AcquireReadAccess();
- if( !pPixelArray )
- return;
+ if(pRead)
+ {
+ if(pRead->HasPalette() && 2 == pRead->GetPaletteEntryCount())
+ {
+ const BitmapPalette& rPalette = pRead->GetPalette();
- aVD.SetOutputSizePixel( Size( nLines, nLines ) );
+ o_rBack = rPalette[1];
+ o_rFront = rPalette[0];
- // Aufbau der Bitmap
- for( sal_uInt16 i = 0; i < nLines; i++ )
- {
- for( sal_uInt16 j = 0; j < nLines; j++ )
- {
- if( *( pPixelArray + j + i * nLines ) == 0 )
- aVD.DrawPixel( Point( j, i ), aBckgrColor );
- else
- aVD.DrawPixel( Point( j, i ), aPixelColor );
+ return true;
+ }
+ }
+ }
}
}
- aGraphicObject = GraphicObject( aVD.GetBitmap( Point(), Size( nLines, nLines ) ) );
- bGraphicDirty = sal_False;
+ return false;
}
-// -----------------------
-// class XFillBitmapItem
-// -----------------------
-TYPEINIT1_AUTOFACTORY(XFillBitmapItem, NameOrIndex);
-
-/*************************************************************************
-|*
-|* XFillBitmapItem::XFillBitmapItem(long nIndex,
-|* const Bitmap& rTheBitmap)
-|*
-|* Beschreibung
-|* Ersterstellung 17.11.94
-|* Letzte Aenderung 17.11.94
-|*
-*************************************************************************/
-
-XFillBitmapItem::XFillBitmapItem(long nIndex,
- const XOBitmap& rTheBitmap) :
- NameOrIndex( XATTR_FILLBITMAP, nIndex ),
- aXOBitmap( rTheBitmap )
-{
-}
+//////////////////////////////////////////////////////////////////////////////
-/*************************************************************************
-|*
-|* XFillBitmapItem::XFillBitmapItem(const XubString& rName,
-|* const Bitmap& rTheBitmap)
-|*
-|* Beschreibung
-|* Ersterstellung 17.11.94
-|* Letzte Aenderung 17.11.94
-|*
-*************************************************************************/
-
-XFillBitmapItem::XFillBitmapItem(const XubString& rName,
- const XOBitmap& rTheBitmap) :
- NameOrIndex( XATTR_FILLBITMAP, rName ),
- aXOBitmap( rTheBitmap )
+XFillBitmapItem::XFillBitmapItem(SvStream& rIn, sal_uInt16 nVer)
+: NameOrIndex(XATTR_FILLBITMAP, rIn)
{
-}
-
-/*************************************************************************
-|*
-|* XFillBitmapItem::XFillBitmapItem(const XFillBitmapItem& rItem)
-|*
-|* Beschreibung
-|* Ersterstellung 17.11.94
-|* Letzte Aenderung 17.11.94
-|*
-*************************************************************************/
-
-XFillBitmapItem::XFillBitmapItem(const XFillBitmapItem& rItem) :
- NameOrIndex( rItem ),
- aXOBitmap( rItem.aXOBitmap )
-{
-}
-
-/*************************************************************************
-|*
-|* XFillBitmapItem::XFillBitmapItem(SvStream& rIn)
-|*
-|* Beschreibung
-|* Ersterstellung 17.11.94
-|* Letzte Aenderung 26.07.94
-|*
-*************************************************************************/
-
-XFillBitmapItem::XFillBitmapItem( SvStream& rIn, sal_uInt16 nVer ) :
- NameOrIndex( XATTR_FILLBITMAP, rIn )
-{
- if( nVer == 0 )
+ if (!IsIndex())
{
- if (!IsIndex())
+ if(0 == nVer)
{
// Behandlung der alten Bitmaps
Bitmap aBmp;
rIn >> aBmp;
-
- aXOBitmap.SetBitmap( aBmp );
- aXOBitmap.SetBitmapStyle( XBITMAP_TILE );
-
- if( aBmp.GetSizePixel().Width() == 8 &&
- aBmp.GetSizePixel().Height() == 8 )
- {
- aXOBitmap.SetBitmapType( XBITMAP_8X8 );
- aXOBitmap.Bitmap2Array();
- }
- else
- aXOBitmap.SetBitmapType( XBITMAP_IMPORT );
+ maGraphicObject = Graphic(aBmp);
}
- }
- else if( nVer == 1 )
- {
- if (!IsIndex())
+ else if(1 == nVer)
{
+ enum XBitmapType
+ {
+ XBITMAP_IMPORT,
+ XBITMAP_8X8
+ };
+
sal_Int16 iTmp;
- rIn >> iTmp;
- aXOBitmap.SetBitmapStyle( (XBitmapStyle) iTmp );
- rIn >> iTmp;
- aXOBitmap.SetBitmapType( (XBitmapType) iTmp );
- if( aXOBitmap.GetBitmapType() == XBITMAP_IMPORT )
+ rIn >> iTmp; // former XBitmapStyle
+ rIn >> iTmp; // former XBitmapType
+
+ if(XBITMAP_IMPORT == iTmp)
{
Bitmap aBmp;
+
rIn >> aBmp;
- aXOBitmap.SetBitmap( aBmp );
+ maGraphicObject = Graphic(aBmp);
}
- else if( aXOBitmap.GetBitmapType() == XBITMAP_8X8 )
+ else if(XBITMAP_8X8 == iTmp)
{
- sal_uInt16* pArray = new sal_uInt16[ 64 ];
- Color aColor;
+ sal_uInt16 aArray[64];
+
+ for(sal_uInt16 i(0); i < 64; i++)
+ {
+ rIn >> aArray[i];
+ }
+
+ Color aColorPix;
+ Color aColorBack;
- for( sal_uInt16 i = 0; i < 64; i++ )
- rIn >> *( pArray + i );
- aXOBitmap.SetPixelArray( pArray );
+ rIn >> aColorPix;
+ rIn >> aColorBack;
- rIn >> aColor;
- aXOBitmap.SetPixelColor( aColor );
- rIn >> aColor;
- aXOBitmap.SetBackgroundColor( aColor );
+ const Bitmap aBitmap(createHistorical8x8FromArray(aArray, aColorPix, aColorBack));
- delete []pArray;
+ maGraphicObject = Graphic(aBitmap);
}
}
- }
+ else if(2 == nVer)
+ {
+ BitmapEx aBmpEx;
- // #81908# force bitmap to exist
- aXOBitmap.GetBitmap();
+ rIn >> aBmpEx;
+ maGraphicObject = Graphic(aBmpEx);
+ }
+ }
}
-//*************************************************************************
+//////////////////////////////////////////////////////////////////////////////
-XFillBitmapItem::XFillBitmapItem( SfxItemPool* /*pPool*/, const XOBitmap& rTheBitmap )
-: NameOrIndex( XATTR_FILLBITMAP, -1 ),
- aXOBitmap( rTheBitmap )
+XFillBitmapItem::XFillBitmapItem(SfxItemPool* /*pPool*/, const GraphicObject& rGraphicObject)
+: NameOrIndex( XATTR_FILLBITMAP, -1),
+ maGraphicObject(rGraphicObject)
{
}
-//*************************************************************************
+//////////////////////////////////////////////////////////////////////////////
-XFillBitmapItem::XFillBitmapItem( SfxItemPool* /*pPool*/)
-: NameOrIndex(XATTR_FILLBITMAP, -1 )
+XFillBitmapItem::XFillBitmapItem(SfxItemPool* /*pPool*/)
+: NameOrIndex(XATTR_FILLBITMAP, -1),
+ maGraphicObject()
{
}
-/*************************************************************************
-|*
-|* XFillBitmapItem::Clone(SfxItemPool* pPool) const
-|*
-|* Beschreibung
-|* Ersterstellung 17.11.94
-|* Letzte Aenderung 17.11.94
-|*
-*************************************************************************/
+//////////////////////////////////////////////////////////////////////////////
SfxPoolItem* XFillBitmapItem::Clone(SfxItemPool* /*pPool*/) const
{
return new XFillBitmapItem(*this);
}
-/*************************************************************************
-|*
-|* int XFillBitmapItem::operator==(const SfxPoolItem& rItem) const
-|*
-|* Beschreibung
-|* Ersterstellung 17.11.94
-|* Letzte Aenderung 26.07.95
-|*
-*************************************************************************/
+//////////////////////////////////////////////////////////////////////////////
int XFillBitmapItem::operator==(const SfxPoolItem& rItem) const
{
- return ( NameOrIndex::operator==(rItem) &&
- aXOBitmap == ((const XFillBitmapItem&) rItem).aXOBitmap );
+ return (NameOrIndex::operator==(rItem)
+ && maGraphicObject == ((const XFillBitmapItem&)rItem).maGraphicObject);
}
-/*************************************************************************
-|*
-|* SfxPoolItem* XFillBitmapItem::Create(SvStream& rIn, sal_uInt16 nVer) const
-|*
-|* Beschreibung
-|* Ersterstellung 17.11.94
-|* Letzte Aenderung 17.11.94
-|*
-*************************************************************************/
+//////////////////////////////////////////////////////////////////////////////
SfxPoolItem* XFillBitmapItem::Create(SvStream& rIn, sal_uInt16 nVer) const
{
return new XFillBitmapItem( rIn, nVer );
}
-/*************************************************************************
-|*
-|* SfxPoolItem* XFillBitmapItem::Store(SvStream& rOut) const
-|*
-|* Beschreibung
-|* Ersterstellung 17.11.94
-|* Letzte Aenderung 26.07.94
-|*
-*************************************************************************/
+//////////////////////////////////////////////////////////////////////////////
SvStream& XFillBitmapItem::Store( SvStream& rOut, sal_uInt16 nItemVersion ) const
{
- NameOrIndex::Store( rOut, nItemVersion );
+ NameOrIndex::Store(rOut, nItemVersion);
- if (!IsIndex())
+ if(!IsIndex())
{
- rOut << (sal_Int16) aXOBitmap.GetBitmapStyle();
- if( !aXOBitmap.GetBitmap() )
- rOut << (sal_Int16) XBITMAP_NONE;
- else
- {
- rOut << (sal_Int16) aXOBitmap.GetBitmapType();
- if( aXOBitmap.GetBitmapType() == XBITMAP_IMPORT )
- {
- const sal_uInt16 nOldComprMode = rOut.GetCompressMode();
- sal_uInt16 nNewComprMode = nOldComprMode;
-
- if( rOut.GetVersion() >= SOFFICE_FILEFORMAT_50 )
- nNewComprMode |= COMPRESSMODE_ZBITMAP;
- else
- nNewComprMode &= ~COMPRESSMODE_ZBITMAP;
-
- rOut.SetCompressMode( nNewComprMode );
- rOut << aXOBitmap.GetBitmap();
- rOut.SetCompressMode( nOldComprMode );
- }
- else if( aXOBitmap.GetBitmapType() == XBITMAP_8X8 )
- {
- sal_uInt16* pArray = aXOBitmap.GetPixelArray();
- for( sal_uInt16 i = 0; i < 64; i++ )
- rOut << (sal_uInt16) *( pArray + i );
-
- rOut << aXOBitmap.GetPixelColor();
- rOut << aXOBitmap.GetBackgroundColor();
- }
- }
+ rOut << maGraphicObject.GetGraphic().GetBitmapEx();
}
return rOut;
}
-/*************************************************************************
-|*
-|* const Bitmap& XFillBitmapItem::GetValue(const XBitmapTable* pTable) const
-|*
-|* Beschreibung
-|* Ersterstellung 15.11.94
-|* Letzte Aenderung 26.07.94
-|*
-*************************************************************************/
-
-const XOBitmap& XFillBitmapItem::GetBitmapValue(const XBitmapTable* pTable) const // GetValue -> GetBitmapValue
+//////////////////////////////////////////////////////////////////////////////
+
+const GraphicObject& XFillBitmapItem::GetGraphicObject() const
{
- if (!IsIndex())
- return aXOBitmap;
- else
- return pTable->GetBitmap(GetIndex())->GetXBitmap();
+ return maGraphicObject;
}
+//////////////////////////////////////////////////////////////////////////////
-/*************************************************************************
-|*
-|* sal_uInt16 XFillBitmapItem::GetVersion() const
-|*
-|* Beschreibung
-|* Ersterstellung 26.07.95
-|* Letzte Aenderung 26.07.95
-|*
-*************************************************************************/
+void XFillBitmapItem::SetGraphicObject(const GraphicObject& rGraphicObject)
+{
+ maGraphicObject = rGraphicObject;
+}
-sal_uInt16 XFillBitmapItem::GetVersion( sal_uInt16 /*nFileFormatVersion*/) const
+//////////////////////////////////////////////////////////////////////////////
+
+sal_uInt16 XFillBitmapItem::GetVersion(sal_uInt16 /*nFileFormatVersion*/) const
{
- // 2. Version
- return( 1 );
+ // version three
+ return(2);
}
-//------------------------------------------------------------------------
+//////////////////////////////////////////////////////////////////////////////
-SfxItemPresentation XFillBitmapItem::GetPresentation
-(
+SfxItemPresentation XFillBitmapItem::GetPresentation(
SfxItemPresentation ePres,
- SfxMapUnit /*eCoreUnit*/,
- SfxMapUnit /*ePresUnit*/,
- XubString& rText, const IntlWrapper *
-) const
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ XubString& rText,
+ const IntlWrapper*) const
{
- switch ( ePres )
+ switch (ePres)
{
case SFX_ITEM_PRESENTATION_NONE:
rText.Erase();
@@ -710,11 +304,10 @@ SfxItemPresentation XFillBitmapItem::GetPresentation
}
}
-//------------------------------------------------------------------------
+//////////////////////////////////////////////////////////////////////////////
-sal_Bool XFillBitmapItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const
+sal_Bool XFillBitmapItem::QueryValue(::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId) const
{
-// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
nMemberId &= ~CONVERT_TWIPS;
// needed for MID_NAME
@@ -737,18 +330,13 @@ sal_Bool XFillBitmapItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt
if( nMemberId == MID_GRAFURL ||
nMemberId == 0 )
{
- XOBitmap aLocalXOBitmap( GetBitmapValue() );
aURL = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(UNO_NAME_GRAPHOBJ_URLPREFIX));
- aURL += ::rtl::OUString::createFromAscii( aLocalXOBitmap.GetGraphicObject().GetUniqueID().GetBuffer() );
+ aURL += ::rtl::OUString::createFromAscii(GetGraphicObject().GetUniqueID().GetBuffer() );
}
if( nMemberId == MID_BITMAP ||
nMemberId == 0 )
{
- XOBitmap aLocalXOBitmap( GetBitmapValue() );
- Bitmap aBmp( aLocalXOBitmap.GetBitmap() );
- BitmapEx aBmpEx( aBmp );
-
- xBmp.set( VCLUnoHelper::CreateBitmap( aBmpEx ) );
+ xBmp.set(VCLUnoHelper::CreateBitmap(GetGraphicObject().GetGraphic().GetBitmapEx()));
}
if( nMemberId == MID_NAME )
@@ -776,11 +364,10 @@ sal_Bool XFillBitmapItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt
return sal_True;
}
-//------------------------------------------------------------------------
+//////////////////////////////////////////////////////////////////////////////
sal_Bool XFillBitmapItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId )
{
-// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
nMemberId &= ~CONVERT_TWIPS;
::rtl::OUString aName;
@@ -826,47 +413,35 @@ sal_Bool XFillBitmapItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_
}
if( bSetURL )
{
- GraphicObject aGrafObj( GraphicObject::CreateGraphicObjectFromURL( aURL ) );
- XOBitmap aBMP( aGrafObj );
- SetBitmapValue( aBMP );
+ maGraphicObject = GraphicObject::CreateGraphicObjectFromURL(aURL);
}
if( bSetBitmap )
{
- Bitmap aInput;
- if ( xBmp.is() )
+ if(xBmp.is())
{
- BitmapEx aInputEx( VCLUnoHelper::GetBitmap( xBmp ) );
- aInput = aInputEx.GetBitmap();
+ maGraphicObject = Graphic(VCLUnoHelper::GetBitmap(xBmp));
}
- else if ( xGraphic.is() )
+ else if(xGraphic.is())
{
- Graphic aGraphic( xGraphic );
- aInput = aGraphic.GetBitmap();
- }
-
- // note: aXOBitmap is the member bitmap
- aXOBitmap.SetBitmap( aInput );
- aXOBitmap.SetBitmapType(XBITMAP_IMPORT);
-
- if(aInput.GetSizePixel().Width() == 8
- && aInput.GetSizePixel().Height() == 8
- && aInput.GetColorCount() == 2)
- {
- aXOBitmap.Bitmap2Array();
- aXOBitmap.SetBitmapType(XBITMAP_8X8);
- aXOBitmap.SetPixelSize(aInput.GetSizePixel());
+ maGraphicObject = Graphic(xGraphic);
}
}
return (bSetName || bSetURL || bSetBitmap);
}
+//////////////////////////////////////////////////////////////////////////////
+
sal_Bool XFillBitmapItem::CompareValueFunc( const NameOrIndex* p1, const NameOrIndex* p2 )
{
- return ((XFillBitmapItem*)p1)->GetBitmapValue().GetGraphicObject().GetUniqueID() ==
- ((XFillBitmapItem*)p2)->GetBitmapValue().GetGraphicObject().GetUniqueID();
+ const GraphicObject& aGraphicObjectA(((XFillBitmapItem*)p1)->GetGraphicObject());
+ const GraphicObject& aGraphicObjectB(((XFillBitmapItem*)p2)->GetGraphicObject());
+
+ return aGraphicObjectA == aGraphicObjectB;
}
+//////////////////////////////////////////////////////////////////////////////
+
XFillBitmapItem* XFillBitmapItem::checkForUniqueItem( SdrModel* pModel ) const
{
if( pModel )
@@ -882,9 +457,12 @@ XFillBitmapItem* XFillBitmapItem::checkForUniqueItem( SdrModel* pModel ) const
// if the given name is not valid, replace it!
if( aUniqueName != GetName() )
{
- return new XFillBitmapItem( aUniqueName, aXOBitmap );
+ return new XFillBitmapItem(aUniqueName, maGraphicObject);
}
}
return (XFillBitmapItem*)this;
}
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/xoutdev/xpool.cxx b/svx/source/xoutdev/xpool.cxx
index f1c8ac9f1ed5..470bc977728b 100644
--- a/svx/source/xoutdev/xpool.cxx
+++ b/svx/source/xoutdev/xpool.cxx
@@ -46,7 +46,7 @@ XOutdevItemPool::XOutdevItemPool(
{
// prepare some defaults
const XubString aNullStr;
- const Bitmap aNullBmp;
+ const Graphic aNullGraphic;
const basegfx::B2DPolyPolygon aNullPol;
const Color aNullLineCol(RGB_Color(COL_BLACK));
const Color aNullFillCol(RGB_COLORDATA( 153, 204, 255 ));
@@ -92,7 +92,7 @@ XOutdevItemPool::XOutdevItemPool(
mppLocalPoolDefaults[XATTR_FILLCOLOR -XATTR_START] = new XFillColorItem (aNullStr,aNullFillCol);
mppLocalPoolDefaults[XATTR_FILLGRADIENT -XATTR_START] = new XFillGradientItem(this,aNullGrad);
mppLocalPoolDefaults[XATTR_FILLHATCH -XATTR_START] = new XFillHatchItem (this,aNullHatch);
- mppLocalPoolDefaults[XATTR_FILLBITMAP -XATTR_START] = new XFillBitmapItem (this,aNullBmp);
+ mppLocalPoolDefaults[XATTR_FILLBITMAP -XATTR_START] = new XFillBitmapItem (this, aNullGraphic);
mppLocalPoolDefaults[XATTR_FILLTRANSPARENCE -XATTR_START] = new XFillTransparenceItem;
mppLocalPoolDefaults[XATTR_GRADIENTSTEPCOUNT -XATTR_START] = new XGradientStepCountItem;
mppLocalPoolDefaults[XATTR_FILLBMP_TILE -XATTR_START] = new XFillBmpTileItem;
diff --git a/svx/source/xoutdev/xtabbtmp.cxx b/svx/source/xoutdev/xtabbtmp.cxx
index b91f9310ade9..4b7993b9c5c7 100644
--- a/svx/source/xoutdev/xtabbtmp.cxx
+++ b/svx/source/xoutdev/xtabbtmp.cxx
@@ -24,17 +24,11 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svx.hxx"
-#ifndef SVX_LIGHT
-
#include <com/sun/star/container/XNameContainer.hpp>
#include "svx/XPropertyTable.hxx"
#include <unotools/ucbstreamhelper.hxx>
-
-#include "xmlxtexp.hxx"
-#include "xmlxtimp.hxx"
-
-#endif
-
+#include <xmlxtexp.hxx>
+#include <xmlxtimp.hxx>
#include <tools/urlobj.hxx>
#include <vcl/virdev.hxx>
#include <svl/itemset.hxx>
@@ -43,6 +37,7 @@
#include <svx/dialmgr.hxx>
#include <svx/xtable.hxx>
#include <svx/xpool.hxx>
+#include <svx/xbtmpit.hxx>
#define GLOBALOVERFLOW
@@ -234,7 +229,6 @@ sal_Bool XBitmapList::Save()
sal_Bool XBitmapList::Create()
{
- // Array der Bitmap
//-----------------------
// 00 01 02 03 04 05 06 07
// 08 09 10 11 12 13 14 15
@@ -244,31 +238,38 @@ sal_Bool XBitmapList::Create()
// 40 41 42 43 44 45 46 47
// 48 49 50 51 52 53 54 55
// 56 57 58 59 60 61 62 63
+ String aStr(SVX_RES(RID_SVXSTR_BITMAP));
+ sal_uInt16 aArray[64];
+ Bitmap aBitmap;
+ const xub_StrLen nLen(aStr.Len() - 1);
- String aStr( SVX_RES( RID_SVXSTR_BITMAP ) );
- Color aColWhite( RGB_Color( COL_WHITE ) );
- xub_StrLen nLen;
- sal_uInt16 aArray[64];
+ memset(aArray, 0, sizeof(aArray));
- memset( aArray, 0, sizeof( aArray ) );
+ // white/white bitmap
aStr.AppendAscii(" 1");
- nLen = aStr.Len() - 1;
- Insert( new XBitmapEntry( XOBitmap( aArray, aColWhite, aColWhite ), aStr ) );
+ aBitmap = createHistorical8x8FromArray(aArray, RGB_Color(COL_WHITE), RGB_Color(COL_WHITE));
+ Insert(new XBitmapEntry(Graphic(aBitmap), aStr));
+ // black/white bitmap
aArray[ 0] = 1; aArray[ 9] = 1; aArray[18] = 1; aArray[27] = 1;
aArray[36] = 1; aArray[45] = 1; aArray[54] = 1; aArray[63] = 1;
aStr.SetChar(nLen, sal_Unicode('2'));
- Insert( new XBitmapEntry( XOBitmap( aArray, RGB_Color( COL_BLACK ), aColWhite ), aStr ) );
+ aBitmap = createHistorical8x8FromArray(aArray, RGB_Color(COL_BLACK), RGB_Color(COL_WHITE));
+ Insert(new XBitmapEntry(Graphic(aBitmap), aStr));
+ // lightred/white bitmap
aArray[ 7] = 1; aArray[14] = 1; aArray[21] = 1; aArray[28] = 1;
aArray[35] = 1; aArray[42] = 1; aArray[49] = 1; aArray[56] = 1;
aStr.SetChar(nLen, sal_Unicode('3'));
- Insert( new XBitmapEntry( XOBitmap( aArray, RGB_Color( COL_LIGHTRED ), aColWhite ), aStr ) );
+ aBitmap = createHistorical8x8FromArray(aArray, RGB_Color(COL_LIGHTRED), RGB_Color(COL_WHITE));
+ Insert(new XBitmapEntry(Graphic(aBitmap), aStr));
+ // lightblue/white bitmap
aArray[24] = 1; aArray[25] = 1; aArray[26] = 1;
aArray[29] = 1; aArray[30] = 1; aArray[31] = 1;
aStr.SetChar(nLen, sal_Unicode('4'));
- Insert( new XBitmapEntry( XOBitmap( aArray, RGB_Color( COL_LIGHTBLUE ), aColWhite ), aStr ) );
+ aBitmap = createHistorical8x8FromArray(aArray, RGB_Color(COL_LIGHTBLUE), RGB_Color(COL_WHITE));
+ Insert(new XBitmapEntry(Graphic(aBitmap), aStr));
return( sal_True );
}