[Libreoffice-commits] core.git: 2 commits - cui/source drawinglayer/inc drawinglayer/source filter/source lotuswordpro/source sc/source sd/source svx/inc svx/source sw/source
Caolán McNamara
caolanm at redhat.com
Fri Mar 15 08:25:12 PDT 2013
cui/source/tabpages/backgrnd.cxx | 2
cui/source/tabpages/tparea.cxx | 16
cui/source/tabpages/tpbitmap.cxx | 237 +----
cui/source/tabpages/tpline.cxx | 1
drawinglayer/inc/drawinglayer/attribute/sdrfillbitmapattribute.hxx | 6
drawinglayer/source/attribute/sdrfillbitmapattribute.cxx | 54 -
filter/source/msfilter/msdffimp.cxx | 51 -
filter/source/msfilter/svdfppt.cxx | 10
lotuswordpro/source/filter/lwpbackgroundstuff.cxx | 3
sc/source/filter/excel/xiescher.cxx | 11
sc/source/ui/view/viewfun7.cxx | 6
sd/source/core/drawdoc4.cxx | 2
sd/source/ui/func/fupage.cxx | 2
sd/source/ui/view/sdview4.cxx | 3
svx/inc/svx/dlgctrl.hxx | 26
svx/inc/svx/xbitmap.hxx | 35
svx/inc/svx/xbtmpit.hxx | 27
svx/inc/svx/xenum.hxx | 4
svx/inc/svx/xfillit.hxx | 1
svx/inc/svx/xtable.hxx | 29
svx/source/customshapes/EnhancedCustomShape2d.cxx | 7
svx/source/customshapes/EnhancedCustomShape3d.cxx | 20
svx/source/dialog/dlgctrl.cxx | 225 ++--
svx/source/sdr/primitive2d/sdrattributecreator.cxx | 30
svx/source/svdraw/svdetc.cxx | 5
svx/source/svdraw/svdfmtf.cxx | 2
svx/source/svdraw/svdoashp.cxx | 33
svx/source/svdraw/svdograf.cxx | 6
svx/source/svdraw/svdoole2.cxx | 2
svx/source/tbxctrls/fillctrl.cxx | 9
svx/source/unodraw/XPropertyTable.cxx | 12
svx/source/unodraw/unobtabl.cxx | 3
svx/source/unodraw/unoshape.cxx | 2
svx/source/xoutdev/xattr.cxx | 8
svx/source/xoutdev/xattrbmp.cxx | 462 +++-------
svx/source/xoutdev/xpool.cxx | 4
svx/source/xoutdev/xtabbtmp.cxx | 29
sw/source/core/frmedt/fecopy.cxx | 10
sw/source/filter/ww8/ww8graf.cxx | 23
39 files changed, 618 insertions(+), 800 deletions(-)
New commits:
commit 188042ad5230e912f3149cc7ea1bb836e084069a
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Mar 15 14:35:20 2013 +0000
restore enough of XOBitmap to do fore/back color setting on escher patterns
i.e. restore the logic of setting the colors of imported escher patterns like
we always did in the past. Stripping that out seems risky in the absence of
definite test-cases.
Change-Id: I16bbb451b053fd04a5154602f8f38ed799e21286
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index 71b6914..86fabbd 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -131,6 +131,7 @@
#include <com/sun/star/beans/PropertyValues.hpp>
#include <com/sun/star/drawing/ProjectionMode.hpp>
#include "svx/EnhancedCustomShape2d.hxx"
+#include <svx/xbitmap.hxx>
#include <rtl/strbuf.hxx>
#include <rtl/ustring.hxx>
#include <boost/scoped_array.hpp>
@@ -1371,13 +1372,36 @@ void DffPropertyReader::ApplyFillAttributes( SvStream& rIn, SfxItemSet& rSet, co
{
if ( eMSO_FillType == mso_fillPattern )
{
- Color aCol1( COL_WHITE ), aCol2( COL_WHITE );
+ Bitmap aBmp( aGraf.GetBitmap() );
+ if( aBmp.GetSizePixel().Width() == 8 && aBmp.GetSizePixel().Height() == 8 && aBmp.GetColorCount() == 2)
+ {
+ Color aCol1( COL_WHITE ), aCol2( COL_WHITE );
+
+ if ( IsProperty( DFF_Prop_fillColor ) )
+ aCol1 = rManager.MSO_CLR_ToColor( GetPropertyValue( DFF_Prop_fillColor ), DFF_Prop_fillColor );
+
+ if ( IsProperty( DFF_Prop_fillBackColor ) )
+ aCol2 = rManager.MSO_CLR_ToColor( GetPropertyValue( DFF_Prop_fillBackColor ), DFF_Prop_fillBackColor );
- if ( IsProperty( DFF_Prop_fillColor ) )
- aCol1 = rManager.MSO_CLR_ToColor( GetPropertyValue( DFF_Prop_fillColor ), DFF_Prop_fillColor );
+ XOBitmap aXOBitmap( aBmp );
+ aXOBitmap.Bitmap2Array();
+ aXOBitmap.SetBitmapType( XBITMAP_8X8 );
+ aXOBitmap.SetPixelSize( aBmp.GetSizePixel() );
+
+ if( aXOBitmap.GetBackgroundColor() == COL_BLACK )
+ {
+ aXOBitmap.SetPixelColor( aCol1 );
+ aXOBitmap.SetBackgroundColor( aCol2 );
+ }
+ else
+ {
+ aXOBitmap.SetPixelColor( aCol2 );
+ aXOBitmap.SetBackgroundColor( aCol1 );
+ }
- if ( IsProperty( DFF_Prop_fillBackColor ) )
- aCol2 = rManager.MSO_CLR_ToColor( GetPropertyValue( DFF_Prop_fillBackColor ), DFF_Prop_fillBackColor );
+ aXOBitmap.Array2Bitmap();
+ aGraf = Graphic( aXOBitmap.GetBitmap() );
+ }
rSet.Put(XFillBitmapItem(OUString(), aGraf));
}
diff --git a/lotuswordpro/source/filter/lwpbackgroundstuff.cxx b/lotuswordpro/source/filter/lwpbackgroundstuff.cxx
index 0c8deba..46bd2ed 100644
--- a/lotuswordpro/source/filter/lwpbackgroundstuff.cxx
+++ b/lotuswordpro/source/filter/lwpbackgroundstuff.cxx
@@ -65,6 +65,7 @@
#include "tools/stream.hxx"
#include "vcl/bmpacc.hxx"
+#include "svx/xbitmap.hxx"
void LwpBackgroundStuff::Read(LwpObjectStream* pStrm)
@@ -128,9 +129,37 @@ XFBGImage* LwpBackgroundStuff::GetFillPattern()
pPttnArray = NULL;
}
- // transfer image data from Bitmap->SvStream->BYTE-Array
+ // create XOBitmap object from bitmap object
+ XOBitmap aXOBitmap( aBmp );
+ aXOBitmap.Bitmap2Array();
+ aXOBitmap.SetBitmapType( XBITMAP_8X8 );
+
+ // set back/fore-ground colors
+ if (m_aFillColor.IsValidColor() && m_aPatternColor.IsValidColor())
+ {
+ Color aBackColor(static_cast<sal_uInt8>(m_aFillColor.GetRed()),
+ static_cast<sal_uInt8>(m_aFillColor.GetGreen()),
+ static_cast<sal_uInt8>(m_aFillColor.GetBlue()));
+ Color aForeColor(static_cast<sal_uInt8>(m_aPatternColor.GetRed()),
+ static_cast<sal_uInt8>(m_aPatternColor.GetGreen()),
+ static_cast<sal_uInt8>(m_aPatternColor.GetBlue()));
+
+ if( aXOBitmap.GetBackgroundColor() == COL_BLACK )
+ {
+ aXOBitmap.SetPixelColor( aBackColor );
+ aXOBitmap.SetBackgroundColor( aForeColor );
+ }
+ else
+ {
+ aXOBitmap.SetPixelColor( aForeColor );
+ aXOBitmap.SetBackgroundColor( aBackColor );
+ }
+ }
+
+ // transfer image data from XOBitmap->SvStream->BYTE-Array
SvMemoryStream aPicMemStream;
- aBmp.Write(aPicMemStream);
+ aXOBitmap.Array2Bitmap();
+ aXOBitmap.GetBitmap().Write(aPicMemStream);
sal_uInt32 nSize = aPicMemStream.GetEndOfData();
sal_uInt8* pImageBuff = new sal_uInt8 [nSize];
memcpy(pImageBuff, aPicMemStream.GetData(), nSize);
diff --git a/sc/source/filter/excel/xiescher.cxx b/sc/source/filter/excel/xiescher.cxx
index b51f7b2..2562873 100644
--- a/sc/source/filter/excel/xiescher.cxx
+++ b/sc/source/filter/excel/xiescher.cxx
@@ -78,6 +78,7 @@
#include <svx/xlinjoit.hxx>
#include <svx/xlntrit.hxx>
#include <svx/xbtmpit.hxx>
+#include <svx/xbitmap.hxx>
#include "document.hxx"
#include "drwlayer.hxx"
@@ -671,6 +672,17 @@ void XclImpDrawObjBase::ConvertFillStyle( SdrObject& rSdrObj, const XclObjFillDa
aMemStrm.Seek( STREAM_SEEK_TO_BEGIN );
Bitmap aBitmap;
aBitmap.Read( aMemStrm, sal_False );
+
+ XOBitmap aXOBitmap( aBitmap );
+ aXOBitmap.Bitmap2Array();
+ aXOBitmap.SetBitmapType( XBITMAP_8X8 );
+ if( aXOBitmap.GetBackgroundColor().GetColor() == COL_BLACK )
+ ::std::swap( aPattColor, aBackColor );
+ aXOBitmap.SetPixelColor( aPattColor );
+ aXOBitmap.SetBackgroundColor( aBackColor );
+ aXOBitmap.Array2Bitmap();
+ aBitmap = aXOBitmap.GetBitmap();
+
rSdrObj.SetMergedItem(XFillStyleItem(XFILL_BITMAP));
rSdrObj.SetMergedItem(XFillBitmapItem(EMPTY_STRING, Graphic(aBitmap)));
}
diff --git a/svx/Package_inc.mk b/svx/Package_inc.mk
index 048c5d1..e1deeab 100644
--- a/svx/Package_inc.mk
+++ b/svx/Package_inc.mk
@@ -471,6 +471,7 @@ $(eval $(call gb_Package_add_file,svx_inc,inc/svx/sxmsitm.hxx,svx/sxmsitm.hxx))
$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdtaditm.hxx,svx/sdtaditm.hxx))
$(eval $(call gb_Package_add_file,svx_inc,inc/svx/svdotext.hxx,svx/svdotext.hxx))
$(eval $(call gb_Package_add_file,svx_inc,inc/svx/chrtitem.hxx,svx/chrtitem.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/xbitmap.hxx,svx/xbitmap.hxx))
$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sxallitm.hxx,svx/sxallitm.hxx))
$(eval $(call gb_Package_add_file,svx_inc,inc/svx/dlgutil.hxx,svx/dlgutil.hxx))
$(eval $(call gb_Package_add_file,svx_inc,inc/svx/unopage.hxx,svx/unopage.hxx))
diff --git a/svx/inc/svx/xbitmap.hxx b/svx/inc/svx/xbitmap.hxx
new file mode 100644
index 0000000..959ceaf
--- /dev/null
+++ b/svx/inc/svx/xbitmap.hxx
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVX_XBITMAP_HXX
+#define _SVX_XBITMAP_HXX
+
+#include <tools/color.hxx>
+#include <vcl/bitmap.hxx>
+#include <svtools/grfmgr.hxx>
+#include <svx/xenum.hxx>
+#include "svx/svxdllapi.h"
+
+class SVX_DLLPUBLIC XOBitmap
+{
+private:
+ XBitmapType eType;
+ GraphicObject aGraphicObject;
+ sal_uInt16* pPixelArray;
+ Size aArraySize;
+ Color aPixelColor;
+ Color aBckgrColor;
+ sal_Bool bGraphicDirty;
+
+ const GraphicObject& GetGraphicObject() const;
+
+public:
+ XOBitmap( const Bitmap& rBitmap );
+ XOBitmap( const XOBitmap& rXBmp );
+ ~XOBitmap();
+
+ XOBitmap& operator=( const XOBitmap& rXOBitmap );
+ int operator==( const XOBitmap& rXOBitmap ) const;
+
+ void Bitmap2Array();
+ void Array2Bitmap();
+
+ void SetBitmapType( XBitmapType eNewType ) { eType = eNewType; }
+ void SetPixelColor( const Color& rColor ) { aPixelColor = rColor; bGraphicDirty = sal_True; }
+ void SetPixelSize( const Size& rSize ) { aArraySize = rSize; bGraphicDirty = sal_True; }
+ void SetBackgroundColor( const Color& rColor ) { aBckgrColor = rColor; bGraphicDirty = sal_True; }
+
+ XBitmapType GetBitmapType() const { return eType; }
+ Bitmap GetBitmap() const;
+ Color GetPixelColor() const { return aPixelColor; }
+ Color GetBackgroundColor() const { return aBckgrColor; }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/inc/svx/xenum.hxx b/svx/inc/svx/xenum.hxx
index 1f48327..df0b629 100644
--- a/svx/inc/svx/xenum.hxx
+++ b/svx/inc/svx/xenum.hxx
@@ -45,6 +45,7 @@ enum XFormTextStdForm { XFTFORM_NONE = 0, XFTFORM_TOPCIRC, XFTFORM_BOTCIRC,
XFTFORM_BOTARC, XFTFORM_LFTARC, XFTFORM_RGTARC,
XFTFORM_BUTTON1, XFTFORM_BUTTON2,
XFTFORM_BUTTON3, XFTFORM_BUTTON4};
+enum XBitmapType { XBITMAP_IMPORT, XBITMAP_8X8 };
#endif // _XENUM_HXX
diff --git a/svx/source/xoutdev/xattrbmp.cxx b/svx/source/xoutdev/xattrbmp.cxx
index 27a3dd2..1256f43 100644
--- a/svx/source/xoutdev/xattrbmp.cxx
+++ b/svx/source/xoutdev/xattrbmp.cxx
@@ -34,12 +34,228 @@
#include <editeng/unoprnms.hxx>
#include <svx/unoapi.hxx>
#include <svx/svdmodel.hxx>
+#include <svx/xbitmap.hxx>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <vcl/salbtype.hxx>
#include <vcl/bmpacc.hxx>
using namespace ::com::sun::star;
+/*************************************************************************
+|*
+|* XOBitmap::XOBitmap( Bitmap aBitmap )
+|*
+*************************************************************************/
+
+XOBitmap::XOBitmap( const Bitmap& rBmp ) :
+ eType ( XBITMAP_IMPORT ),
+ aGraphicObject ( rBmp ),
+ pPixelArray ( NULL ),
+ bGraphicDirty ( sal_False )
+{
+}
+
+/*************************************************************************
+|*
+|* XOBitmap::XOBitmap( const XOBitmap& rXBmp )
+|*
+*************************************************************************/
+
+XOBitmap::XOBitmap( const XOBitmap& rXBmp ) :
+ pPixelArray ( NULL )
+{
+ eType = rXBmp.eType;
+ 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 )
+|*
+*************************************************************************/
+
+XOBitmap::~XOBitmap()
+{
+ delete [] pPixelArray;
+}
+
+/*************************************************************************
+|*
+|* XOBitmap& XOBitmap::operator=( const XOBitmap& rXBmp )
+|*
+*************************************************************************/
+
+XOBitmap& XOBitmap::operator=( const XOBitmap& rXBmp )
+{
+ eType = rXBmp.eType;
+ 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 );
+ }
+ }
+ return( *this );
+}
+
+/*************************************************************************
+|*
+|* int XOBitmap::operator==( const XOBitmap& rXOBitmap ) const
+|*
+*************************************************************************/
+
+int XOBitmap::operator==( const XOBitmap& rXOBitmap ) const
+{
+ if( eType != rXOBitmap.eType ||
+ aGraphicObject != rXOBitmap.aGraphicObject ||
+ aArraySize != rXOBitmap.aArraySize ||
+ aPixelColor != rXOBitmap.aPixelColor ||
+ aBckgrColor != rXOBitmap.aBckgrColor ||
+ bGraphicDirty != rXOBitmap.bGraphicDirty )
+ {
+ return( sal_False );
+ }
+
+ if( pPixelArray && rXOBitmap.pPixelArray )
+ {
+ sal_uInt16 nCount = (sal_uInt16) ( aArraySize.Width() * aArraySize.Height() );
+ for( sal_uInt16 i = 0; i < nCount; i++ )
+ {
+ if( *( pPixelArray + i ) != *( rXOBitmap.pPixelArray + i ) )
+ return( sal_False );
+ }
+ }
+ return( sal_True );
+}
+
+/*************************************************************************
+|*
+|* Bitmap XOBitmap::GetBitmap()
+|*
+*************************************************************************/
+
+Bitmap XOBitmap::GetBitmap() const
+{
+ return GetGraphicObject().GetGraphic().GetBitmap();
+}
+
+/*************************************************************************
+|*
+|* Bitmap XOBitmap::GetGraphicObject()
+|*
+*************************************************************************/
+
+const GraphicObject& XOBitmap::GetGraphicObject() const
+{
+ if( bGraphicDirty )
+ ( (XOBitmap*) this )->Array2Bitmap();
+
+ return aGraphicObject;
+}
+
+/*************************************************************************
+|*
+|* void XOBitmap::Bitmap2Array()
+|*
+|* Beschreibung Umwandlung der Bitmap in Array, Hinter- u.
+|* Vordergrundfarbe
+|*
+*************************************************************************/
+
+void XOBitmap::Bitmap2Array()
+{
+ 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++ )
+ {
+ for( sal_uInt16 j = 0; j < nLines; j++ )
+ {
+ if ( aVD.GetPixel( Point( j, i ) ) == aBckgrColor )
+ *( pPixelArray + j + i * nLines ) = 0;
+ else
+ {
+ *( 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
+|*
+*************************************************************************/
+
+void XOBitmap::Array2Bitmap()
+{
+ VirtualDevice aVD;
+ sal_uInt16 nLines = 8; // von Type abhaengig
+
+ if( !pPixelArray )
+ return;
+
+ aVD.SetOutputSizePixel( Size( nLines, nLines ) );
+
+ // 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 );
+ }
+ }
+
+ aGraphicObject = GraphicObject( aVD.GetBitmap( Point(), Size( nLines, nLines ) ) );
+ bGraphicDirty = sal_False;
+}
+
// -----------------------
// class XFillBitmapItem
// -----------------------
@@ -146,12 +362,6 @@ XFillBitmapItem::XFillBitmapItem(SvStream& rIn, sal_uInt16 nVer)
}
else if(1 == nVer)
{
- enum XBitmapType
- {
- XBITMAP_IMPORT,
- XBITMAP_8X8
- };
-
sal_Int16 iTmp;
rIn >> iTmp; // former XBitmapStyle
commit c97aec0d2276901c20634abe53867f739f420f50
Author: Armin Le Grand <alg at apache.org>
Date: Thu May 10 09:29:55 2012 +0000
Related: #i119125# change XFillBitmapItem to work with GraphicObject
Completely changed XFillBitmapItem to work with 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 of 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.
Conflicts:
cui/source/tabpages/backgrnd.cxx
cui/source/tabpages/tparea.cxx
cui/source/tabpages/tpbitmap.cxx
filter/source/msfilter/msdffimp.cxx
filter/source/msfilter/svdfppt.cxx
sc/source/filter/excel/xiescher.cxx
sd/source/ui/func/fupage.cxx
svx/inc/svx/dlgctrl.hxx
svx/inc/svx/xbitmap.hxx
svx/inc/svx/xbtmpit.hxx
svx/inc/svx/xtable.hxx
svx/source/customshapes/EnhancedCustomShape2d.cxx
svx/source/dialog/dlgctrl.cxx
svx/source/svdraw/svdograf.cxx
svx/source/tbxctrls/fillctrl.cxx
svx/source/unodraw/XPropertyTable.cxx
svx/source/xoutdev/xattrbmp.cxx
svx/source/xoutdev/xtabbtmp.cxx
Change-Id: Id838bfbacc863695d078fb3cf379d1c0cd951680
diff --git a/cui/source/tabpages/backgrnd.cxx b/cui/source/tabpages/backgrnd.cxx
index d84cf85..930073f 100644
--- a/cui/source/tabpages/backgrnd.cxx
+++ b/cui/source/tabpages/backgrnd.cxx
@@ -53,6 +53,8 @@
#include <svx/xflgrit.hxx>
#include <svl/intitem.hxx>
#include <sfx2/request.hxx>
+#include <svtools/grfmgr.hxx>
+
using namespace ::com::sun::star;
// static ----------------------------------------------------------------
diff --git a/cui/source/tabpages/tparea.cxx b/cui/source/tabpages/tparea.cxx
index 952d612..c6716c1 100644
--- a/cui/source/tabpages/tparea.cxx
+++ b/cui/source/tabpages/tparea.cxx
@@ -1142,9 +1142,9 @@ sal_Bool SvxAreaTabPage::FillItemSet( SfxItemSet& rAttrs )
if( nPos != LISTBOX_ENTRY_NOTFOUND &&
nPos != aLbBitmap.GetSavedValue() )
{
- XOBitmap aXOBitmap = pBitmapList->GetBitmap( nPos )->GetXBitmap();
- String aString = aLbBitmap.GetSelectEntry();
- XFillBitmapItem aFillBitmapItem( aString, aXOBitmap );
+ const XBitmapEntry* pXBitmapEntry = pBitmapList->GetBitmap(nPos);
+ const String aString(aLbBitmap.GetSelectEntry());
+ const XFillBitmapItem aFillBitmapItem(aString, pXBitmapEntry->GetGraphicObject());
pOld = GetOldItem( rAttrs, XATTR_FILLBITMAP );
if ( !pOld || !( *(const XFillBitmapItem*)pOld == aFillBitmapItem ) )
{
@@ -2225,15 +2225,15 @@ IMPL_LINK_NOARG(SvxAreaTabPage, ModifyBitmapHdl_Impl)
if( _nPos != LISTBOX_ENTRY_NOTFOUND )
{
// fill ItemSet and pass it on to aCtlXRectPreview
- XBitmapEntry* pEntry = pBitmapList->GetBitmap( _nPos );
+ const XBitmapEntry* pEntry = pBitmapList->GetBitmap(_nPos);
- rXFSet.Put( XFillStyleItem( XFILL_BITMAP ) );
- rXFSet.Put( XFillBitmapItem( String(), pEntry->GetXBitmap() ) );
+ rXFSet.Put(XFillStyleItem(XFILL_BITMAP));
+ rXFSet.Put(XFillBitmapItem(String(), pEntry->GetGraphicObject()));
}
else if( SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLBITMAP ), sal_True, &pPoolItem ) )
{
- rXFSet.Put( XFillStyleItem( XFILL_BITMAP ) );
- rXFSet.Put( XFillBitmapItem( String(), ( ( const XFillBitmapItem* ) pPoolItem )->GetBitmapValue() ) );
+ rXFSet.Put(XFillStyleItem(XFILL_BITMAP));
+ rXFSet.Put(XFillBitmapItem(String(), ((const XFillBitmapItem*)pPoolItem)->GetGraphicObject()));
}
else
rXFSet.Put( XFillStyleItem( XFILL_NONE ) );
diff --git a/cui/source/tabpages/tpbitmap.cxx b/cui/source/tabpages/tpbitmap.cxx
index 6a4b74b..3ed60c3 100644
--- a/cui/source/tabpages/tpbitmap.cxx
+++ b/cui/source/tabpages/tpbitmap.cxx
@@ -89,7 +89,7 @@ SvxBitmapTabPage::SvxBitmapTabPage
pXPool ( (XOutdevItemPool*) rInAttrs.GetPool() ),
aXFStyleItem ( XFILL_BITMAP ),
- aXBitmapItem ( String(), XOBitmap() ),
+ aXBitmapItem ( String(), Graphic() ),
aXFillAttr ( pXPool ),
rXFSet ( aXFillAttr.GetItemSet() )
{
@@ -237,32 +237,26 @@ sal_Bool SvxBitmapTabPage::FillItemSet( SfxItemSet& _rOutAttrs )
{
if( *pDlgType == 0 && *pbAreaTP == sal_False ) // area dialog
{
- if( *pPageType == PT_BITMAP )
+ if(PT_BITMAP == *pPageType)
{
- // CheckChanges_Impl(); <-- duplicate inquiry?
-
- XOBitmap aXOBitmap;
- String aString;
+ _rOutAttrs.Put(XFillStyleItem(XFILL_BITMAP));
sal_uInt16 nPos = aLbBitmaps.GetSelectEntryPos();
- if( nPos != LISTBOX_ENTRY_NOTFOUND )
+ if(LISTBOX_ENTRY_NOTFOUND != nPos)
{
- aXOBitmap = pBitmapList->GetBitmap( nPos )->GetXBitmap();
- aString = aLbBitmaps.GetSelectEntry();
+ const XBitmapEntry* pXBitmapEntry = pBitmapList->GetBitmap(nPos);
+ const String aString(aLbBitmaps.GetSelectEntry());
+ _rOutAttrs.Put(XFillBitmapItem(aString, pXBitmapEntry->GetGraphicObject()));
}
else
{
- aXOBitmap = aBitmapCtl.GetXBitmap();
-
- // #85339# if it's an array, force conversion to bitmap before using it.
- if(aXOBitmap.GetBitmapType() == XBITMAP_8X8)
- aXOBitmap.GetBitmap();
+ const BitmapEx aBitmapEx(aBitmapCtl.GetBitmapEx());
+ _rOutAttrs.Put(XFillBitmapItem(String(), Graphic(aBitmapEx)));
}
- _rOutAttrs.Put( XFillStyleItem( XFILL_BITMAP ) );
- _rOutAttrs.Put( XFillBitmapItem( aString, aXOBitmap ) );
}
}
+
return sal_True;
}
@@ -278,7 +272,7 @@ void SvxBitmapTabPage::Reset( const SfxItemSet& )
aBitmapCtl.SetBmpArray( aCtlPixel.GetBitmapPixelPtr() );
// get bitmap and display it
- XFillBitmapItem aBmpItem( (const String &) String(), aBitmapCtl.GetXBitmap() );
+ const XFillBitmapItem aBmpItem(OUString(), Graphic(aBitmapCtl.GetBitmapEx()));
rXFSet.Put( aBmpItem );
aCtlPreview.SetAttributes( aXFillAttr.GetItemSet() );
aCtlPreview.Invalidate();
@@ -313,145 +307,49 @@ SfxTabPage* SvxBitmapTabPage::Create( Window* pWindow,
IMPL_LINK_NOARG(SvxBitmapTabPage, ChangeBitmapHdl_Impl)
{
- XOBitmap* pXOBitmap = NULL;
- int nPos = aLbBitmaps.GetSelectEntryPos();
+ GraphicObject* pGraphicObject = 0;
+ int nPos(aLbBitmaps.GetSelectEntryPos());
- if( nPos != LISTBOX_ENTRY_NOTFOUND )
- pXOBitmap = new XOBitmap( ( (XBitmapEntry*) pBitmapList->GetBitmap( nPos ) )->GetXBitmap() );
+ if(LISTBOX_ENTRY_NOTFOUND != nPos)
+ {
+ pGraphicObject = new GraphicObject(pBitmapList->GetBitmap(nPos)->GetGraphicObject());
+ }
else
{
- const SfxPoolItem* pPoolItem = NULL;
- if( SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLSTYLE ), sal_True, &pPoolItem ) )
+ const SfxPoolItem* pPoolItem = 0;
+
+ if(SFX_ITEM_SET == rOutAttrs.GetItemState(GetWhich(XATTR_FILLSTYLE), true, &pPoolItem))
{
- XFillStyle eXFS = (XFillStyle) ( ( const XFillStyleItem* ) pPoolItem )->GetValue();
- if( ( XFILL_BITMAP == eXFS ) &&
- ( SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLBITMAP ), sal_True, &pPoolItem ) ) )
+ const XFillStyle eXFS((XFillStyle)((const XFillStyleItem*)pPoolItem)->GetValue());
+
+ if((XFILL_BITMAP == eXFS) && (SFX_ITEM_SET == rOutAttrs.GetItemState(GetWhich(XATTR_FILLBITMAP), true, &pPoolItem)))
{
- pXOBitmap = new XOBitmap( ( ( const XFillBitmapItem* ) pPoolItem )->GetBitmapValue() );
+ pGraphicObject = new GraphicObject(((const XFillBitmapItem*)pPoolItem)->GetGraphicObject());
}
}
- if( !pXOBitmap )
+
+ if(!pGraphicObject)
{
- aLbBitmaps.SelectEntryPos( 0 );
+ aLbBitmaps.SelectEntryPos(0);
nPos = aLbBitmaps.GetSelectEntryPos();
- if( nPos != LISTBOX_ENTRY_NOTFOUND )
- pXOBitmap = new XOBitmap( ( (XBitmapEntry*) pBitmapList->GetBitmap( nPos ) )->GetXBitmap() );
- }
- }
- if( pXOBitmap )
- {
- // #85339# try to convert bitmapped item to array item.
- if(pXOBitmap->GetBitmapType() == XBITMAP_IMPORT)
- {
- Bitmap aBitmap(pXOBitmap->GetBitmap());
- Size aSizePixel(aBitmap.GetSizePixel());
- if(8 == aSizePixel.Width() && 8 == aSizePixel.Height())
+ if(LISTBOX_ENTRY_NOTFOUND != nPos)
{
- sal_uInt16* pPixelArray = new sal_uInt16[64];
- sal_uInt32 nCol1(0xffffffff); // background
- sal_uInt32 nCol2(0xffffffff); // pixel
- BitmapReadAccess* pAccess = aBitmap.AcquireReadAccess();
- sal_Bool bValid(sal_True);
-
- if(pAccess)
- {
- for(sal_uInt32 a(0); bValid && a < 64; a++)
- {
- const BitmapColor aBmCol = pAccess->GetColor(a>>3, a%8);
- Color aRgbCol(aBmCol.GetRed(), aBmCol.GetGreen(), aBmCol.GetBlue());
- sal_uInt32 nColVal = aRgbCol.GetRGBColor();
-
- // test with nCol1
- if(nCol1 != nColVal)
- {
- if(0xffffffff == nCol1)
- {
- // nCol1 is used first time
- nCol1 = nColVal;
- pPixelArray[a] = 0;
- }
- else
- {
- // test with nCol2
- if(nCol2 != nColVal)
- {
- if(0xffffffff == nCol2)
- {
- // nCol2 used first time
- nCol2 = nColVal;
- pPixelArray[a] = 1;
- }
- else
- {
- // Third color detected
- bValid = sal_False;
- }
- }
- else
- {
- // color is pixel color
- pPixelArray[a] = 1;
- }
- }
- }
- else
- {
- // color is background color
- pPixelArray[a] = 0;
- }
- }
-
- // release ReadAccess
- aBitmap.ReleaseAccess(pAccess);
- }
- else
- {
- // no access -> no success
- bValid = sal_False;
- }
-
- if(bValid)
- {
- Color aCol1(nCol1);
- Color aCol2(nCol2);
-
- // no pixel color found? Use opposite od background color.
- if(0xffffffff == nCol2)
- {
- aCol2 = Color(
- 0xff - aCol1.GetRed(),
- 0xff - aCol1.GetGreen(),
- 0xff - aCol1.GetBlue());
- }
-
- // transformation did work, create a new Item
- delete pXOBitmap;
- pXOBitmap = new XOBitmap(pPixelArray, aCol2, aCol1);
- }
-
- // cleanup
- delete[] pPixelArray;
+ pGraphicObject = new GraphicObject(pBitmapList->GetBitmap(nPos)->GetGraphicObject());
}
}
+ }
+
+ if(pGraphicObject)
+ {
+ BitmapColor aBack;
+ BitmapColor aFront;
+ bool bIs8x8(isHistorical8x8(pGraphicObject->GetGraphic().GetBitmap(), aBack, aFront));
aLbColor.SetNoSelection();
aLbBackgroundColor.SetNoSelection();
- if( pXOBitmap->GetBitmapType() == XBITMAP_IMPORT )
- {
- aCtlPixel.Reset();
- aCtlPixel.SetPaintable( sal_False );
- aCtlPixel.Disable();
- aFtPixelEdit.Disable();
- aFtColor.Disable();
- aLbColor.Disable();
- aFtBackgroundColor.Disable();
- aLbBackgroundColor.Disable();
- aBtnModify.Disable();
- aBtnAdd.Disable();
- }
- else if( pXOBitmap->GetBitmapType() == XBITMAP_8X8 )
+ if(bIs8x8)
{
aCtlPixel.SetPaintable( sal_True );
aCtlPixel.Enable();
@@ -464,10 +362,10 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ChangeBitmapHdl_Impl)
aBtnAdd.Enable();
// setting the pixel control
- aCtlPixel.SetXBitmap( *pXOBitmap );
+ aCtlPixel.SetXBitmap(pGraphicObject->GetGraphic().GetBitmapEx());
- Color aPixelColor = pXOBitmap->GetPixelColor();
- Color aBackColor = pXOBitmap->GetBackgroundColor();
+ Color aPixelColor = aFront;
+ Color aBackColor = aBack;
aBitmapCtl.SetPixelColor( aPixelColor );
aBitmapCtl.SetBackgroundColor( aBackColor );
@@ -493,19 +391,34 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ChangeBitmapHdl_Impl)
aLbBackgroundColor.SelectEntry( aBackColor );
}
}
+ else
+ {
+ aCtlPixel.Reset();
+ aCtlPixel.SetPaintable( sal_False );
+ aCtlPixel.Disable();
+ aFtPixelEdit.Disable();
+ aFtColor.Disable();
+ aLbColor.Disable();
+ aFtBackgroundColor.Disable();
+ aLbBackgroundColor.Disable();
+ aBtnModify.Disable();
+ aBtnAdd.Disable();
+ }
+
aCtlPixel.Invalidate();
// display bitmap
- XFillBitmapItem aXBmpItem( (const String &) String(), *pXOBitmap );
+ const XFillBitmapItem aXBmpItem(String(), *pGraphicObject);
rXFSet.Put( aXBmpItem );
aCtlPreview.SetAttributes( aXFillAttr.GetItemSet() );
aCtlPreview.Invalidate();
bBmpChanged = sal_False;
- delete pXOBitmap;
+ delete pGraphicObject;
}
- return 0L;
+
+ return 0;
}
// -----------------------------------------------------------------------
@@ -624,21 +537,17 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ClickAddHdl_Impl)
XBitmapEntry* pEntry = 0;
if( aCtlPixel.IsEnabled() )
{
- XOBitmap aXOBitmap = aBitmapCtl.GetXBitmap();
+ const BitmapEx aBitmapEx(aBitmapCtl.GetBitmapEx());
- // #85339# if it's an array, force conversion to bitmap before using it.
- if(aXOBitmap.GetBitmapType() == XBITMAP_8X8)
- aXOBitmap.GetBitmap();
-
- pEntry = new XBitmapEntry( aXOBitmap, aName );
+ pEntry = new XBitmapEntry(Graphic(aBitmapEx), aName);
}
else // it must be a not existing imported bitmap
{
- const SfxPoolItem* pPoolItem = NULL;
- if( SFX_ITEM_SET == rOutAttrs.GetItemState( XATTR_FILLBITMAP, sal_True, &pPoolItem ) )
+ const SfxPoolItem* pPoolItem = 0;
+
+ if(SFX_ITEM_SET == rOutAttrs.GetItemState(XATTR_FILLBITMAP, true, &pPoolItem))
{
- XOBitmap aXOBitmap( ( ( const XFillBitmapItem* ) pPoolItem )->GetBitmapValue() );
- pEntry = new XBitmapEntry( aXOBitmap, aName );
+ pEntry = new XBitmapEntry(dynamic_cast< const XFillBitmapItem* >(pPoolItem)->GetGraphicObject(), aName);
}
}
@@ -746,9 +655,7 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ClickImportHdl_Impl)
if( !nError )
{
- Bitmap aBmp( aGraphic.GetBitmap() );
- XBitmapEntry* pEntry =
- new XBitmapEntry( XOBitmap( aBmp ), aName );
+ XBitmapEntry* pEntry = new XBitmapEntry( aGraphic, aName );
pBitmapList->Insert( pEntry );
aLbBitmaps.Append( pEntry );
@@ -819,13 +726,9 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ClickModifyHdl_Impl)
pEntry->SetName( aName );
- XOBitmap aXOBitmap = aBitmapCtl.GetXBitmap();
-
- // #85339# if it's an array, force conversion to bitmap before using it.
- if(aXOBitmap.GetBitmapType() == XBITMAP_8X8)
- aXOBitmap.GetBitmap();
+ const BitmapEx aBitmapEx(aBitmapCtl.GetBitmapEx());
- pEntry->SetXBitmap( aXOBitmap );
+ pEntry->SetGraphicObject(Graphic(aBitmapEx));
aLbBitmaps.Modify( pEntry, nPos );
aLbBitmaps.SelectEntryPos( nPos );
@@ -1043,7 +946,7 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ChangePixelColorHdl_Impl)
aBitmapCtl.SetPixelColor( aLbColor.GetSelectEntryColor() );
// get bitmap and display it
- rXFSet.Put( XFillBitmapItem( String(), aBitmapCtl.GetXBitmap() ) );
+ rXFSet.Put(XFillBitmapItem(String(), Graphic(aBitmapCtl.GetBitmapEx())));
aCtlPreview.SetAttributes( aXFillAttr.GetItemSet() );
aCtlPreview.Invalidate();
@@ -1062,7 +965,7 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ChangeBackgrndColorHdl_Impl)
aBitmapCtl.SetBackgroundColor( aLbBackgroundColor.GetSelectEntryColor() );
// get bitmap and display it
- rXFSet.Put( XFillBitmapItem( String(), aBitmapCtl.GetXBitmap() ) );
+ rXFSet.Put(XFillBitmapItem(String(), Graphic(aBitmapCtl.GetBitmapEx())));
aCtlPreview.SetAttributes( aXFillAttr.GetItemSet() );
aCtlPreview.Invalidate();
@@ -1080,7 +983,7 @@ void SvxBitmapTabPage::PointChanged( Window* pWindow, RECT_POINT )
aBitmapCtl.SetBmpArray( aCtlPixel.GetBitmapPixelPtr() );
// get bitmap and display it
- rXFSet.Put( XFillBitmapItem( String(), aBitmapCtl.GetXBitmap() ) );
+ rXFSet.Put(XFillBitmapItem(String(), Graphic(aBitmapCtl.GetBitmapEx())));
aCtlPreview.SetAttributes( aXFillAttr.GetItemSet() );
aCtlPreview.Invalidate();
diff --git a/cui/source/tabpages/tpline.cxx b/cui/source/tabpages/tpline.cxx
index 77a9a00..3036474 100644
--- a/cui/source/tabpages/tpline.cxx
+++ b/cui/source/tabpages/tpline.cxx
@@ -48,7 +48,6 @@
#include <sfx2/objsh.hxx>
#include <editeng/brushitem.hxx>
#include <svx/gallery.hxx>
-#include <svx/xbitmap.hxx>
#include <unotools/localfilehelper.hxx>
#include "paragrph.hrc"
#include "sfx2/opengrf.hxx"
diff --git a/drawinglayer/inc/drawinglayer/attribute/sdrfillbitmapattribute.hxx b/drawinglayer/inc/drawinglayer/attribute/sdrfillbitmapattribute.hxx
index 3f04c86..602455e 100644
--- a/drawinglayer/inc/drawinglayer/attribute/sdrfillbitmapattribute.hxx
+++ b/drawinglayer/inc/drawinglayer/attribute/sdrfillbitmapattribute.hxx
@@ -25,7 +25,7 @@
//////////////////////////////////////////////////////////////////////////////
// predefines
-class Bitmap;
+class BitmapEx;
namespace basegfx {
class B2DRange;
@@ -51,7 +51,7 @@ namespace drawinglayer
public:
/// constructors/assignmentoperator/destructor
SdrFillBitmapAttribute(
- const Bitmap& rBitmap,
+ const BitmapEx& rBitmapEx,
const basegfx::B2DVector& rSize,
const basegfx::B2DVector& rOffset,
const basegfx::B2DVector& rOffsetPosition,
@@ -71,7 +71,7 @@ namespace drawinglayer
bool operator==(const SdrFillBitmapAttribute& rCandidate) const;
// data read access
- const Bitmap& getBitmap() const;
+ const BitmapEx& getBitmapEx() const;
const basegfx::B2DVector& getSize() const;
const basegfx::B2DVector& getOffset() const;
const basegfx::B2DVector& getOffsetPosition() const;
diff --git a/drawinglayer/source/attribute/sdrfillbitmapattribute.cxx b/drawinglayer/source/attribute/sdrfillbitmapattribute.cxx
index 6007778..5d86525 100644
--- a/drawinglayer/source/attribute/sdrfillbitmapattribute.cxx
+++ b/drawinglayer/source/attribute/sdrfillbitmapattribute.cxx
@@ -34,7 +34,7 @@ namespace drawinglayer
sal_uInt32 mnRefCount;
// data definitions
- Bitmap maBitmap;
+ BitmapEx maBitmapEx;
basegfx::B2DVector maSize;
basegfx::B2DVector maOffset;
basegfx::B2DVector maOffsetPosition;
@@ -46,7 +46,7 @@ namespace drawinglayer
unsigned mbLogSize : 1;
ImpSdrFillBitmapAttribute(
- const Bitmap& rBitmap,
+ const BitmapEx& rBitmapEx,
const basegfx::B2DVector& rSize,
const basegfx::B2DVector& rOffset,
const basegfx::B2DVector& rOffsetPosition,
@@ -55,7 +55,7 @@ namespace drawinglayer
bool bStretch,
bool bLogSize)
: mnRefCount(0),
- maBitmap(rBitmap),
+ maBitmapEx(rBitmapEx),
maSize(rSize),
maOffset(rOffset),
maOffsetPosition(rOffsetPosition),
@@ -67,7 +67,7 @@ namespace drawinglayer
}
// data read access
- const Bitmap& getBitmap() const { return maBitmap; }
+ const BitmapEx& getBitmapEx() const { return maBitmapEx; }
const basegfx::B2DVector& getSize() const { return maSize; }
const basegfx::B2DVector& getOffset() const { return maOffset; }
const basegfx::B2DVector& getOffsetPosition() const { return maOffsetPosition; }
@@ -78,7 +78,7 @@ namespace drawinglayer
bool operator==(const ImpSdrFillBitmapAttribute& rCandidate) const
{
- return (getBitmap() == rCandidate.getBitmap()
+ return (getBitmapEx() == rCandidate.getBitmapEx()
&& getSize() == rCandidate.getSize()
&& getOffset() == rCandidate.getOffset()
&& getOffsetPosition() == rCandidate.getOffsetPosition()
@@ -95,7 +95,7 @@ namespace drawinglayer
if(!pDefault)
{
pDefault = new ImpSdrFillBitmapAttribute(
- Bitmap(),
+ BitmapEx(),
basegfx::B2DVector(),
basegfx::B2DVector(),
basegfx::B2DVector(),
@@ -113,7 +113,7 @@ namespace drawinglayer
};
SdrFillBitmapAttribute::SdrFillBitmapAttribute(
- const Bitmap& rBitmap,
+ const BitmapEx& rBitmapEx,
const basegfx::B2DVector& rSize,
const basegfx::B2DVector& rOffset,
const basegfx::B2DVector& rOffsetPosition,
@@ -121,8 +121,16 @@ namespace drawinglayer
bool bTiling,
bool bStretch,
bool bLogSize)
- : mpSdrFillBitmapAttribute(new ImpSdrFillBitmapAttribute(
- rBitmap, rSize, rOffset, rOffsetPosition, rRectPoint, bTiling, bStretch, bLogSize))
+ : mpSdrFillBitmapAttribute(
+ new ImpSdrFillBitmapAttribute(
+ rBitmapEx,
+ rSize,
+ rOffset,
+ rOffsetPosition,
+ rRectPoint,
+ bTiling,
+ bStretch,
+ bLogSize))
{
}
@@ -190,9 +198,9 @@ namespace drawinglayer
return (*rCandidate.mpSdrFillBitmapAttribute == *mpSdrFillBitmapAttribute);
}
- const Bitmap& SdrFillBitmapAttribute::getBitmap() const
+ const BitmapEx& SdrFillBitmapAttribute::getBitmapEx() const
{
- return mpSdrFillBitmapAttribute->getBitmap();
+ return mpSdrFillBitmapAttribute->getBitmapEx();
}
const basegfx::B2DVector& SdrFillBitmapAttribute::getSize() const
@@ -228,8 +236,8 @@ namespace drawinglayer
FillBitmapAttribute SdrFillBitmapAttribute::getFillBitmapAttribute(const basegfx::B2DRange& rRange) const
{
// get logical size of bitmap (before expanding eventually)
- Bitmap aBitmap(getBitmap());
- const basegfx::B2DVector aLogicalSize(aBitmap.GetPrefSize().getWidth(), aBitmap.GetPrefSize().getHeight());
+ BitmapEx aBitmapEx(getBitmapEx());
+ const basegfx::B2DVector aLogicalSize(aBitmapEx.GetPrefSize().getWidth(), aBitmapEx.GetPrefSize().getHeight());
// get hor/ver shiftings and apply them eventually to the bitmap, but only
// when tiling is on
@@ -240,45 +248,45 @@ namespace drawinglayer
{
if(0.0 != getOffset().getX() || 0.0 != getOffset().getY())
{
- const sal_uInt32 nWidth(aBitmap.GetSizePixel().getWidth());
- const sal_uInt32 nHeight(aBitmap.GetSizePixel().getHeight());
+ const sal_uInt32 nWidth(aBitmapEx.GetSizePixel().getWidth());
+ const sal_uInt32 nHeight(aBitmapEx.GetSizePixel().getHeight());
if(0.0 != getOffset().getX())
{
bExpandHeight = true;
const sal_uInt32 nOffset(basegfx::fround(((double)nWidth * getOffset().getX()) / 100.0));
- aBitmap.Expand(0L, nHeight);
+ aBitmapEx.Expand(0L, nHeight);
const Size aSizeA(nOffset, nHeight);
const Rectangle aDstA(Point(0L, nHeight), aSizeA);
const Rectangle aSrcA(Point(nWidth - nOffset, 0L), aSizeA);
- aBitmap.CopyPixel(aDstA, aSrcA);
+ aBitmapEx.CopyPixel(aDstA, aSrcA);
const Size aSizeB(nWidth - nOffset, nHeight);
const Rectangle aDstB(Point(nOffset, nHeight), aSizeB);
const Rectangle aSrcB(Point(0L, 0L), aSizeB);
- aBitmap.CopyPixel(aDstB, aSrcB);
+ aBitmapEx.CopyPixel(aDstB, aSrcB);
}
else
{
bExpandWidth = true;
const sal_uInt32 nOffset(basegfx::fround(((double)nHeight * getOffset().getY()) / 100.0));
- aBitmap.Expand(nWidth, 0L);
+ aBitmapEx.Expand(nWidth, 0L);
const Size aSize(nWidth, nHeight);
const Rectangle aDst(Point(nWidth, 0L), aSize);
const Rectangle aSrc(Point(0L, 0L), aSize);
- aBitmap.CopyPixel(aDst, aSrc);
+ aBitmapEx.CopyPixel(aDst, aSrc);
const Size aSizeA(nWidth, nOffset);
const Rectangle aDstA(Point(0L, 0L), aSizeA);
const Rectangle aSrcA(Point(nWidth, nHeight - nOffset), aSizeA);
- aBitmap.CopyPixel(aDstA, aSrcA);
+ aBitmapEx.CopyPixel(aDstA, aSrcA);
const Size aSizeB(nWidth, nHeight - nOffset);
const Rectangle aDstB(Point(0L, nOffset), aSizeB);
const Rectangle aSrcB(Point(nWidth, 0L), aSizeB);
- aBitmap.CopyPixel(aDstB, aSrcB);
+ aBitmapEx.CopyPixel(aDstB, aSrcB);
}
}
}
@@ -379,7 +387,7 @@ namespace drawinglayer
aBitmapSize.setY(aBitmapSize.getY() / fRangeHeight);
}
- return FillBitmapAttribute(BitmapEx(aBitmap), aBitmapTopLeft, aBitmapSize, getTiling());
+ return FillBitmapAttribute(aBitmapEx, aBitmapTopLeft, aBitmapSize, getTiling());
}
} // end of namespace attribute
} // end of namespace drawinglayer
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index 3cb83e9..71b6914 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -1234,9 +1234,8 @@ void ApplyRectangularGradientAsBitmap( const SvxMSDffManager& rManager, SvStream
}
}
- XOBitmap aXBmp( aBitmap, XBITMAP_STRETCH );
- rSet.Put( XFillBmpTileItem( sal_False ) );
- rSet.Put( XFillBitmapItem( OUString(), aXBmp ) );
+ rSet.Put(XFillBmpTileItem(false));
+ rSet.Put(XFillBitmapItem(OUString(), Graphic(aBitmap)));
}
}
}
@@ -1370,54 +1369,30 @@ void DffPropertyReader::ApplyFillAttributes( SvStream& rIn, SfxItemSet& rSet, co
bOK = SeekToContent( DFF_Prop_fillBlip, rIn ) && rManager.GetBLIPDirect( rIn, aGraf, NULL );
if ( bOK )
{
- Bitmap aBmp( aGraf.GetBitmap() );
-
if ( eMSO_FillType == mso_fillPattern )
{
Color aCol1( COL_WHITE ), aCol2( COL_WHITE );
+
if ( IsProperty( DFF_Prop_fillColor ) )
aCol1 = rManager.MSO_CLR_ToColor( GetPropertyValue( DFF_Prop_fillColor ), DFF_Prop_fillColor );
+
if ( IsProperty( DFF_Prop_fillBackColor ) )
aCol2 = rManager.MSO_CLR_ToColor( GetPropertyValue( DFF_Prop_fillBackColor ), DFF_Prop_fillBackColor );
- XOBitmap aXOBitmap;
- aXOBitmap.SetBitmap( aBmp );
- aXOBitmap.SetBitmapType( XBITMAP_IMPORT );
-
- if( aBmp.GetSizePixel().Width() == 8 && aBmp.GetSizePixel().Height() == 8 && aBmp.GetColorCount() == 2)
- {
- aXOBitmap.Bitmap2Array();
- aXOBitmap.SetBitmapType( XBITMAP_8X8 );
- aXOBitmap.SetPixelSize( aBmp.GetSizePixel() );
-
- if( aXOBitmap.GetBackgroundColor() == COL_BLACK )
- {
- aXOBitmap.SetPixelColor( aCol1 );
- aXOBitmap.SetBackgroundColor( aCol2 );
- }
- else
- {
- aXOBitmap.SetPixelColor( aCol2 );
- aXOBitmap.SetBackgroundColor( aCol1 );
- }
- aXOBitmap.Array2Bitmap();
- }
- rSet.Put( XFillBitmapItem( OUString(), aXOBitmap ) );
+ rSet.Put(XFillBitmapItem(OUString(), aGraf));
}
else if ( eMSO_FillType == mso_fillTexture )
{
- XOBitmap aXBmp( aBmp, XBITMAP_STRETCH );
- rSet.Put( XFillBmpTileItem( sal_True ) );
- rSet.Put( XFillBitmapItem( OUString(), aXBmp ) );
- rSet.Put( XFillBmpSizeXItem( GetPropertyValue( DFF_Prop_fillWidth, 0 ) / 360 ) );
- rSet.Put( XFillBmpSizeYItem( GetPropertyValue( DFF_Prop_fillHeight, 0 ) / 360 ) );
- rSet.Put( XFillBmpSizeLogItem( sal_True ) );
+ rSet.Put(XFillBmpTileItem(true));
+ rSet.Put(XFillBitmapItem(OUString(), aGraf));
+ rSet.Put(XFillBmpSizeXItem(GetPropertyValue(DFF_Prop_fillWidth, 0) / 360));
+ rSet.Put(XFillBmpSizeYItem(GetPropertyValue(DFF_Prop_fillHeight, 0) / 360));
+ rSet.Put(XFillBmpSizeLogItem(true));
}
else
{
- XOBitmap aXBmp( aBmp, XBITMAP_STRETCH );
- rSet.Put( XFillBitmapItem( OUString(), aXBmp ) );
- rSet.Put( XFillBmpTileItem( sal_False ) );
+ rSet.Put(XFillBitmapItem(OUString(), aGraf));
+ rSet.Put(XFillBmpTileItem(false));
}
}
}
diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx
index 113d912..44a0b521 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -7315,15 +7315,13 @@ void ApplyCellAttributes( const SdrObject* pObj, Reference< XCell >& xCell )
{
eFS = com::sun::star::drawing::FillStyle_BITMAP;
- XFillBitmapItem aXFillBitmapItem((const XFillBitmapItem&)pObj->GetMergedItem( XATTR_FILLBITMAP ));
- XOBitmap aLocalXOBitmap( aXFillBitmapItem.GetBitmapValue() );
+ const XFillBitmapItem aXFillBitmapItem((const XFillBitmapItem&)pObj->GetMergedItem( XATTR_FILLBITMAP ));
rtl::OUString aURL( RTL_CONSTASCII_USTRINGPARAM(UNO_NAME_GRAPHOBJ_URLPREFIX));
- aURL += rtl::OStringToOUString(
- aLocalXOBitmap.GetGraphicObject().GetUniqueID(),
+ aURL += OStringToOUString(
+ aXFillBitmapItem.GetGraphicObject().GetUniqueID(),
RTL_TEXTENCODING_ASCII_US);
- static const rtl::OUString sFillBitmapURL( String( RTL_CONSTASCII_USTRINGPARAM( "FillBitmapURL" ) ) );
- xPropSet->setPropertyValue( sFillBitmapURL, Any( aURL ) );
+ xPropSet->setPropertyValue( OUString("FillBitmapURL"), Any( aURL ) );
}
break;
case XFILL_NONE :
diff --git a/lotuswordpro/source/filter/lwpbackgroundstuff.cxx b/lotuswordpro/source/filter/lwpbackgroundstuff.cxx
index a38d419..0c8deba 100644
--- a/lotuswordpro/source/filter/lwpbackgroundstuff.cxx
+++ b/lotuswordpro/source/filter/lwpbackgroundstuff.cxx
@@ -65,7 +65,6 @@
#include "tools/stream.hxx"
#include "vcl/bmpacc.hxx"
-#include "svx/xbitmap.hxx"
void LwpBackgroundStuff::Read(LwpObjectStream* pStrm)
@@ -129,38 +128,9 @@ XFBGImage* LwpBackgroundStuff::GetFillPattern()
pPttnArray = NULL;
}
- // create XOBitmap object from bitmap object
- XOBitmap aXOBitmap;
- aXOBitmap.SetBitmap( aBmp );
- aXOBitmap.Bitmap2Array();
- aXOBitmap.SetBitmapType( XBITMAP_8X8 );
-
- // set back/fore-ground colors
- if (m_aFillColor.IsValidColor() && m_aPatternColor.IsValidColor())
- {
- Color aBackColor(static_cast<sal_uInt8>(m_aFillColor.GetRed()),
- static_cast<sal_uInt8>(m_aFillColor.GetGreen()),
- static_cast<sal_uInt8>(m_aFillColor.GetBlue()));
- Color aForeColor(static_cast<sal_uInt8>(m_aPatternColor.GetRed()),
- static_cast<sal_uInt8>(m_aPatternColor.GetGreen()),
- static_cast<sal_uInt8>(m_aPatternColor.GetBlue()));
-
- if( aXOBitmap.GetBackgroundColor() == COL_BLACK )
- {
- aXOBitmap.SetPixelColor( aBackColor );
- aXOBitmap.SetBackgroundColor( aForeColor );
- }
- else
- {
- aXOBitmap.SetPixelColor( aForeColor );
- aXOBitmap.SetBackgroundColor( aBackColor );
- }
- }
-
- // transfer image data from XOBitmap->SvStream->BYTE-Array
+ // transfer image data from Bitmap->SvStream->BYTE-Array
SvMemoryStream aPicMemStream;
- aXOBitmap.Array2Bitmap();
- aXOBitmap.GetBitmap().Write(aPicMemStream);
+ aBmp.Write(aPicMemStream);
sal_uInt32 nSize = aPicMemStream.GetEndOfData();
sal_uInt8* pImageBuff = new sal_uInt8 [nSize];
memcpy(pImageBuff, aPicMemStream.GetData(), nSize);
diff --git a/sc/source/filter/excel/xiescher.cxx b/sc/source/filter/excel/xiescher.cxx
index b4a1316..b51f7b2 100644
--- a/sc/source/filter/excel/xiescher.cxx
+++ b/sc/source/filter/excel/xiescher.cxx
@@ -670,16 +670,9 @@ void XclImpDrawObjBase::ConvertFillStyle( SdrObject& rSdrObj, const XclObjFillDa
aMemStrm << sal_uInt32( pnPattern[ nIdx ] ); // 32-bit little-endian
aMemStrm.Seek( STREAM_SEEK_TO_BEGIN );
Bitmap aBitmap;
- aBitmap.Read( aMemStrm, false );
- XOBitmap aXOBitmap( aBitmap );
- aXOBitmap.Bitmap2Array();
- aXOBitmap.SetBitmapType( XBITMAP_8X8 );
- if( aXOBitmap.GetBackgroundColor().GetColor() == COL_BLACK )
- ::std::swap( aPattColor, aBackColor );
- aXOBitmap.SetPixelColor( aPattColor );
- aXOBitmap.SetBackgroundColor( aBackColor );
- rSdrObj.SetMergedItem( XFillStyleItem( XFILL_BITMAP ) );
- rSdrObj.SetMergedItem( XFillBitmapItem( EMPTY_STRING, aXOBitmap ) );
+ aBitmap.Read( aMemStrm, sal_False );
+ rSdrObj.SetMergedItem(XFillStyleItem(XFILL_BITMAP));
+ rSdrObj.SetMergedItem(XFillBitmapItem(EMPTY_STRING, Graphic(aBitmap)));
}
}
}
diff --git a/sc/source/ui/view/viewfun7.cxx b/sc/source/ui/view/viewfun7.cxx
index e858789..a93edc6 100644
--- a/sc/source/ui/view/viewfun7.cxx
+++ b/sc/source/ui/view/viewfun7.cxx
@@ -26,7 +26,6 @@
#include <svx/svdpage.hxx>
#include <svx/svdpagv.hxx>
#include <svx/svdundo.hxx>
-#include <svx/xbitmap.hxx>
#include <svx/xbtmpit.hxx>
#include <svx/xoutbmp.hxx>
#include <sfx2/objsh.hxx>
@@ -452,15 +451,12 @@ sal_Bool ScViewFunc::ApplyGraphicToObject( SdrObject* pPickObj, const Graphic& r
/******************************************************************
* Object gets filled with the graphic
******************************************************************/
- //pScDrawView->BegUndo(ScGlobal::GetRscString(STR_UNDO_DRAGDROP));
pScDrawView->AddUndo(new SdrUndoAttrObj(*pPickObj));
- //pScDrawView->EndUndo();
- XOBitmap aXOBitmap( rGraphic.GetBitmap() );
SfxItemSet aSet( pScDrawView->GetModel()->GetItemPool(),
XATTR_FILLSTYLE, XATTR_FILLBITMAP );
aSet.Put(XFillStyleItem(XFILL_BITMAP));
- aSet.Put(XFillBitmapItem(String(), aXOBitmap));
+ aSet.Put(XFillBitmapItem(String(), rGraphic));
pPickObj->SetMergedItemSetAndBroadcast(aSet);
diff --git a/sd/source/core/drawdoc4.cxx b/sd/source/core/drawdoc4.cxx
index 35b0de6..0a7dc02 100644
--- a/sd/source/core/drawdoc4.cxx
+++ b/sd/source/core/drawdoc4.cxx
@@ -169,7 +169,7 @@ void SdDrawDocument::CreateLayoutTemplates()
Color aNullColor( COL_WHITE );
Bitmap aNullBmp( aNullSize, 8 );
aNullBmp.Erase( aNullColor );
- rISet.Put(XFillBitmapItem(pPool,aNullBmp));
+ rISet.Put(XFillBitmapItem(pPool, Graphic(aNullBmp)));
// Shadow attributes (Drawing Engine)
rISet.Put(SdrShadowItem(sal_False));
diff --git a/sd/source/ui/func/fupage.cxx b/sd/source/ui/func/fupage.cxx
index 31a1e88..ae49182 100644
--- a/sd/source/ui/func/fupage.cxx
+++ b/sd/source/ui/func/fupage.cxx
@@ -294,7 +294,7 @@ const SfxItemSet* FuPage::ExecuteDialog( Window* pParent )
// MigrateItemSet makes sure the XFillBitmapItem will have a unique name
SfxItemSet aMigrateSet( mpDoc->GetPool(), XATTR_FILLBITMAP, XATTR_FILLBITMAP );
- aMigrateSet.Put( XFillBitmapItem( rtl::OUString("background") , XOBitmap(aGraphic) ) );
+ aMigrateSet.Put(XFillBitmapItem(OUString("background"), aGraphic));
mpDoc->MigrateItemSet( &aMigrateSet, pTempSet.get(), NULL );
pTempSet->Put( XFillBmpStretchItem( sal_True ));
diff --git a/sd/source/ui/view/sdview4.cxx b/sd/source/ui/view/sdview4.cxx
index b54b56c..f9fdabb 100644
--- a/sd/source/ui/view/sdview4.cxx
+++ b/sd/source/ui/view/sdview4.cxx
@@ -155,10 +155,9 @@ SdrGrafObj* View::InsertGraphic( const Graphic& rGraphic, sal_Int8& rAction,
EndUndo();
}
- XOBitmap aXOBitmap( rGraphic.GetBitmap() );
SfxItemSet aSet(mpDocSh->GetPool(), XATTR_FILLSTYLE, XATTR_FILLBITMAP);
aSet.Put(XFillStyleItem(XFILL_BITMAP));
- aSet.Put(XFillBitmapItem(&mpDocSh->GetPool(), aXOBitmap));
+ aSet.Put(XFillBitmapItem(&mpDocSh->GetPool(), rGraphic));
pPickObj->SetMergedItemSetAndBroadcast(aSet);
}
}
diff --git a/svx/Package_inc.mk b/svx/Package_inc.mk
index e1deeab..048c5d1 100644
--- a/svx/Package_inc.mk
+++ b/svx/Package_inc.mk
@@ -471,7 +471,6 @@ $(eval $(call gb_Package_add_file,svx_inc,inc/svx/sxmsitm.hxx,svx/sxmsitm.hxx))
$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdtaditm.hxx,svx/sdtaditm.hxx))
$(eval $(call gb_Package_add_file,svx_inc,inc/svx/svdotext.hxx,svx/svdotext.hxx))
$(eval $(call gb_Package_add_file,svx_inc,inc/svx/chrtitem.hxx,svx/chrtitem.hxx))
-$(eval $(call gb_Package_add_file,svx_inc,inc/svx/xbitmap.hxx,svx/xbitmap.hxx))
$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sxallitm.hxx,svx/sxallitm.hxx))
$(eval $(call gb_Package_add_file,svx_inc,inc/svx/dlgutil.hxx,svx/dlgutil.hxx))
$(eval $(call gb_Package_add_file,svx_inc,inc/svx/unopage.hxx,svx/unopage.hxx))
diff --git a/svx/inc/svx/dlgctrl.hxx b/svx/inc/svx/dlgctrl.hxx
index 7aecada..7297bd5 100644
--- a/svx/inc/svx/dlgctrl.hxx
+++ b/svx/inc/svx/dlgctrl.hxx
@@ -146,7 +146,7 @@ public:
SvxBitmapCtl( Window* pParent, const Size& rSize );
~SvxBitmapCtl();
- XOBitmap GetXBitmap();
+ BitmapEx GetBitmapEx();
void SetBmpArray( const sal_uInt16* pPixel ) { pBmpArray = pPixel; }
void SetLines( sal_uInt16 nLns ) { nLines = nLns; }
@@ -182,7 +182,7 @@ public:
virtual void Paint( const Rectangle& rRect );
virtual void MouseButtonDown( const MouseEvent& rMEvt );
- void SetXBitmap( const XOBitmap& rXOBitmap );
+ void SetXBitmap( const BitmapEx& rBitmapEx );
void SetPixelColor( const Color& rCol ) { aPixelColor = rCol; }
void SetBackgroundColor( const Color& rCol ) { aBackgroundColor = rCol; }
@@ -253,20 +253,20 @@ public:
class SVX_DLLPUBLIC BitmapLB : public ListBox
{
public:
- BitmapLB( Window* pParent, ResId Id, sal_Bool bUserDraw = sal_True );
+ BitmapLB(Window* pParent, ResId Id, bool bUserDraw = true);
- virtual void Fill( const XBitmapListRef &pList );
- virtual void UserDraw( const UserDrawEvent& rUDEvt );
+ virtual void Fill(const XBitmapListRef &pList);
+ virtual void UserDraw(const UserDrawEvent& rUDEvt);
- void Append( XBitmapEntry* pEntry, Bitmap* pBmp = NULL );
- void Modify( XBitmapEntry* pEntry, sal_uInt16 nPos, Bitmap* pBmp = NULL );
+ void Append(XBitmapEntry* pEntry, BitmapEx* pBmpEx = NULL);
+ void Modify(XBitmapEntry* pEntry, sal_uInt16 nPos, BitmapEx* pBmpEx = NULL);
private:
- VirtualDevice aVD;
- Bitmap aBitmap;
+ VirtualDevice maVD;
+ BitmapEx maBitmapEx;
XBitmapListRef mpList;
- sal_Bool mbUserDraw;
+ bool mbUserDraw;
SVX_DLLPRIVATE void SetVirtualDevice();
};
@@ -276,13 +276,13 @@ private:
class FillAttrLB : public ColorListBox
{
private:
- VirtualDevice aVD;
- Bitmap aBitmap;
+ VirtualDevice maVD;
+ BitmapEx maBitmapEx;
void SetVirtualDevice();
public:
- FillAttrLB( Window* pParent, WinBits aWB );
+ FillAttrLB( Window* pParent, WinBits aWB );
virtual void Fill( const XColorListRef &pList );
virtual void Fill( const XHatchListRef &pList );
diff --git a/svx/inc/svx/xbitmap.hxx b/svx/inc/svx/xbitmap.hxx
deleted file mode 100644
index cc0741d..0000000
--- a/svx/inc/svx/xbitmap.hxx
+++ /dev/null
@@ -1,81 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef _SVX_XBITMAP_HXX
-#define _SVX_XBITMAP_HXX
-
-#include <tools/color.hxx>
-#include <vcl/bitmap.hxx>
-#include <svtools/grfmgr.hxx>
-#include <svx/xenum.hxx>
-#include "svx/svxdllapi.h"
-
-//---------------
-// class XOBitmap
-//---------------
-
-class SVX_DLLPUBLIC XOBitmap
-{
-protected:
- XBitmapType eType;
- XBitmapStyle eStyle;
- GraphicObject aGraphicObject;
- sal_uInt16* pPixelArray;
- Size aArraySize;
- Color aPixelColor;
- Color aBckgrColor;
- sal_Bool bGraphicDirty;
-
-public:
- XOBitmap();
- XOBitmap( const GraphicObject& rGraphicObject, XBitmapStyle eStyle = XBITMAP_TILE );
- XOBitmap( const Bitmap& rBitmap, XBitmapStyle eStyle = XBITMAP_TILE );
- XOBitmap( const sal_uInt16* pArray, const Color& aPixelColor,
- const Color& aBckgrColor, const Size& rSize = Size( 8, 8 ),
- XBitmapStyle eStyle = XBITMAP_TILE );
- XOBitmap( const XOBitmap& rXBmp );
- ~XOBitmap();
-
- XOBitmap& operator=( const XOBitmap& rXOBitmap );
- int operator==( const XOBitmap& rXOBitmap ) const;
-
- void Bitmap2Array();
- void Array2Bitmap();
-
- void SetGraphicObject( const GraphicObject& rObj ) { aGraphicObject = rObj; bGraphicDirty = sal_False; }
- void SetBitmap( const Bitmap& rBmp ) { aGraphicObject = GraphicObject( Graphic( rBmp ) ); bGraphicDirty = sal_False; }
- void SetBitmapType( XBitmapType eNewType ) { eType = eNewType; }
- void SetBitmapStyle( XBitmapStyle eNewStyle ) { eStyle = eNewStyle; }
- void SetPixelArray( const sal_uInt16* pArray );
- void SetPixelSize( const Size& rSize ) { aArraySize = rSize; bGraphicDirty = sal_True; }
- void SetPixelColor( const Color& rColor ) { aPixelColor = rColor; bGraphicDirty = sal_True; }
- void SetBackgroundColor( const Color& rColor ) { aBckgrColor = rColor; bGraphicDirty = sal_True; }
-
- XBitmapType GetBitmapType() const { return eType; }
- XBitmapStyle GetBitmapStyle() const { return eStyle; }
- const GraphicObject& GetGraphicObject() const;
- Bitmap GetBitmap() const;
- sal_uInt16* GetPixelArray() const { return pPixelArray; }
- Color GetPixelColor() const { return aPixelColor; }
- Color GetBackgroundColor() const { return aBckgrColor; }
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/inc/svx/xbtmpit.hxx b/svx/inc/svx/xbtmpit.hxx
index 6b8cab6..d30e2fd 100644
--- a/svx/inc/svx/xbtmpit.hxx
+++ b/svx/inc/svx/xbtmpit.hxx
@@ -20,25 +20,32 @@
#ifndef _SVX_XBTMPIT_HXX
#define _SVX_XBTMPIT_HXX
-#include "svx/svxdllapi.h"
-
-#include <svx/xbitmap.hxx>
+#include <svx/svxdllapi.h>
#include <svx/xit.hxx>
+#include <svtools/grfmgr.hxx>
class SdrModel;
+class BitmapColor;
+
+//////////////////////////////////////////////////////////////////////////////
+// helper to construct historical 8x8 bitmaps with two colors
-//----------------------
+Bitmap SVX_DLLPUBLIC createHistorical8x8FromArray(const sal_uInt16* pArray, Color aColorPix, Color aColorBack);
+bool SVX_DLLPUBLIC isHistorical8x8(const BitmapEx& rBitmapEx, BitmapColor& o_rBack, BitmapColor& o_rFront);
+
+//////////////////////////////////////////////////////////////////////////////
// class XFillBitmapItem
-//----------------------
+
class SVX_DLLPUBLIC XFillBitmapItem : public NameOrIndex
{
- XOBitmap aXOBitmap;
+private:
+ GraphicObject maGraphicObject;
public:
TYPEINFO();
XFillBitmapItem() : NameOrIndex(XATTR_FILLBITMAP, -1 ) {}
- XFillBitmapItem( const String& rName, const XOBitmap& rTheBitmap );
- XFillBitmapItem( SfxItemPool* pPool, const XOBitmap& rTheBitmap );
+ XFillBitmapItem(const String& rName, const GraphicObject& rGraphicObject);
+ XFillBitmapItem(SfxItemPool* pPool, const GraphicObject& rGraphicObject);
XFillBitmapItem( const XFillBitmapItem& rItem );
XFillBitmapItem( SvStream& rIn, sal_uInt16 nVer = 0 );
@@ -56,8 +63,8 @@ public:
SfxMapUnit ePresMetric,
OUString &rText, const IntlWrapper * = 0 ) const;
- const XOBitmap& GetBitmapValue() const; // GetValue -> GetBitmapValue
- void SetBitmapValue( const XOBitmap& rNew ) { aXOBitmap = rNew; Detach(); } // SetValue -> SetBitmapValue
+ const GraphicObject& GetGraphicObject() const;
+ void SetGraphicObject(const GraphicObject& rGraphicObject);
static sal_Bool CompareValueFunc( const NameOrIndex* p1, const NameOrIndex* p2 );
XFillBitmapItem* checkForUniqueItem( SdrModel* pModel ) const;
diff --git a/svx/inc/svx/xenum.hxx b/svx/inc/svx/xenum.hxx
index 8e14e58..1f48327 100644
--- a/svx/inc/svx/xenum.hxx
+++ b/svx/inc/svx/xenum.hxx
@@ -45,9 +45,6 @@ enum XFormTextStdForm { XFTFORM_NONE = 0, XFTFORM_TOPCIRC, XFTFORM_BOTCIRC,
XFTFORM_BOTARC, XFTFORM_LFTARC, XFTFORM_RGTARC,
XFTFORM_BUTTON1, XFTFORM_BUTTON2,
XFTFORM_BUTTON3, XFTFORM_BUTTON4};
-enum XBitmapStyle { XBITMAP_TILE, XBITMAP_STRETCH };
-enum XBitmapType { XBITMAP_IMPORT, XBITMAP_8X8, XBITMAP_NONE,
- XBITMAP_16X16 };
#endif // _XENUM_HXX
diff --git a/svx/inc/svx/xfillit.hxx b/svx/inc/svx/xfillit.hxx
index 056647a..b0270a9 100644
--- a/svx/inc/svx/xfillit.hxx
+++ b/svx/inc/svx/xfillit.hxx
@@ -31,7 +31,6 @@
#include <svx/xsflclit.hxx>
#include <svx/xflgrit.hxx>
#include <svx/xflhtit.hxx>
-#include <svx/xbitmap.hxx>
#include <svx/xbtmpit.hxx>
#include <svx/xflftrit.hxx>
diff --git a/svx/inc/svx/xtable.hxx b/svx/inc/svx/xtable.hxx
index af184fc..7ccf526 100644
--- a/svx/inc/svx/xtable.hxx
+++ b/svx/inc/svx/xtable.hxx
@@ -24,7 +24,6 @@
#include <svx/xdash.hxx>
#include <svx/xhatch.hxx>
#include <svx/xgrad.hxx>
-#include <svx/xbitmap.hxx>
#include <svx/xflasit.hxx>
#include <svx/xlnasit.hxx>
@@ -38,6 +37,7 @@
#include <com/sun/star/embed/XStorage.hpp>
#include <basegfx/polygon/b2dpolypolygon.hxx>
#include <com/sun/star/container/XNameContainer.hpp>
+#include <svtools/grfmgr.hxx>
class Color;
class Bitmap;
@@ -170,14 +170,31 @@ public:
class XBitmapEntry : public XPropertyEntry
{
- XOBitmap aXOBitmap;
+private:
+ GraphicObject maGraphicObject;
public:
- XBitmapEntry( const XOBitmap& rXOBitmap, const String& rName ):
- XPropertyEntry( rName ), aXOBitmap( rXOBitmap ) {}
+ XBitmapEntry(const GraphicObject& rGraphicObject, const String& rName)
+ : XPropertyEntry(rName),
+ maGraphicObject(rGraphicObject)
+ {
+ }
+
+ XBitmapEntry(const XBitmapEntry& rOther)
+ : XPropertyEntry(rOther),
+ maGraphicObject(rOther.maGraphicObject)
+ {
+ }
+
+ const GraphicObject& GetGraphicObject() const
+ {
+ return maGraphicObject;
+ }
- void SetXBitmap(const XOBitmap& rXOBitmap) { aXOBitmap = rXOBitmap; }
- XOBitmap& GetXBitmap() { return aXOBitmap; }
+ void SetGraphicObject(const GraphicObject& rGraphicObject)
+ {
+ maGraphicObject = rGraphicObject;
+ }
};
// --------------------
diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx b/svx/source/customshapes/EnhancedCustomShape2d.cxx
index e83a183..41c963b 100644
--- a/svx/source/customshapes/EnhancedCustomShape2d.cxx
+++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx
@@ -43,7 +43,6 @@
#include <svx/xflhtit.hxx>
#include <svx/xbtmpit.hxx>
#include <svx/xgrad.hxx>
-#include <svx/xbitmap.hxx>
#include <svx/xhatch.hxx>
#include <com/sun/star/awt/Size.hpp>
#include <com/sun/star/drawing/EnhancedCustomShapeParameterType.hpp>
@@ -2108,15 +2107,17 @@ void EnhancedCustomShape2d::AdaptObjColor(SdrPathObj& rObj, const SfxItemSet& rC
}
case XFILL_BITMAP:
{
- Bitmap aBitmap(((const XFillBitmapItem&)rObj.GetMergedItem(XATTR_FILLBITMAP)).GetBitmapValue().GetBitmap());
if ( nColorCount || rObj.GetBrightness() != 1.0 )
{
+ Bitmap aBitmap(((const XFillBitmapItem&)rObj.GetMergedItem(XATTR_FILLBITMAP)).GetGraphicObject().GetGraphic().GetBitmapEx().GetBitmap());
+
aBitmap.Adjust(
static_cast< short > ( GetLuminanceChange(
std::min(nColorIndex, nColorCount-1))));
+
+ rObj.SetMergedItem(XFillBitmapItem(String(), Graphic(aBitmap)));
}
- rObj.SetMergedItem( XFillBitmapItem( String(), aBitmap ) );
break;
}
}
diff --git a/svx/source/customshapes/EnhancedCustomShape3d.cxx b/svx/source/customshapes/EnhancedCustomShape3d.cxx
index f1dc1d1..e6885a3 100644
--- a/svx/source/customshapes/EnhancedCustomShape3d.cxx
+++ b/svx/source/customshapes/EnhancedCustomShape3d.cxx
@@ -405,13 +405,12 @@ SdrObject* EnhancedCustomShape3d::Create3DObject( const SdrObject* pShape2d, con
aPlaceholderObjectList.push_back( p3DObj );
else if ( bUseTwoFillStyles )
{
- Bitmap aFillBmp;
+ BitmapEx aFillBmp;
sal_Bool bFillBmpTile = ((XFillBmpTileItem&)p3DObj->GetMergedItem( XATTR_FILLBMP_TILE )).GetValue();
if ( bFillBmpTile )
{
- const XFillBitmapItem& rBmpItm = (XFillBitmapItem&)p3DObj->GetMergedItem( XATTR_FILLBITMAP );
- const XOBitmap& rXOBmp = rBmpItm.GetBitmapValue();
- aFillBmp = rXOBmp.GetBitmap();
+ const XFillBitmapItem& rBmpItm = (XFillBitmapItem&)p3DObj->GetMergedItem(XATTR_FILLBITMAP);
+ aFillBmp = rBmpItm.GetGraphicObject().GetGraphic().GetBitmapEx();
Size aLogicalSize = aFillBmp.GetPrefSize();
if ( aFillBmp.GetPrefMapMode() == MAP_PIXEL )
aLogicalSize = Application::GetDefaultDevice()->PixelToLogic( aLogicalSize, MAP_100TH_MM );
@@ -421,15 +420,14 @@ SdrObject* EnhancedCustomShape3d::Create3DObject( const SdrObject* pShape2d, con
aLogicalSize.Height() *= 5;
aFillBmp.SetPrefSize( aLogicalSize );
aFillBmp.SetPrefMapMode( MAP_100TH_MM );
- p3DObj->SetMergedItem( XFillBitmapItem( String(), aFillBmp ) );
+ p3DObj->SetMergedItem(XFillBitmapItem(String(), Graphic(aFillBmp)));
}
else
{
if ( aSnapRect != aBoundRect )
{
- const XFillBitmapItem& rBmpItm = (XFillBitmapItem&)p3DObj->GetMergedItem( XATTR_FILLBITMAP );
- const XOBitmap& rXOBmp = rBmpItm.GetBitmapValue();
- aFillBmp = rXOBmp.GetBitmap();
+ const XFillBitmapItem& rBmpItm = (XFillBitmapItem&)p3DObj->GetMergedItem(XATTR_FILLBITMAP);
+ aFillBmp = rBmpItm.GetGraphicObject().GetGraphic().GetBitmapEx();
Size aBmpSize( aFillBmp.GetSizePixel() );
double fXScale = (double)aBoundRect.GetWidth() / (double)aSnapRect.GetWidth();
double fYScale = (double)aBoundRect.GetHeight() / (double)aSnapRect.GetHeight();
@@ -440,7 +438,7 @@ SdrObject* EnhancedCustomShape3d::Create3DObject( const SdrObject* pShape2d, con
(sal_Int32)( aBmpSize.Height() * fYScale ) );
Rectangle aCropRect( aPt, aSize );
aFillBmp.Crop( aCropRect );
- p3DObj->SetMergedItem( XFillBitmapItem( String(), aFillBmp ) );
+ p3DObj->SetMergedItem(XFillBitmapItem(String(), Graphic(aFillBmp)));
}
}
pScene->Insert3DObj( p3DObj );
@@ -462,7 +460,9 @@ SdrObject* EnhancedCustomShape3d::Create3DObject( const SdrObject* pShape2d, con
p3DObj->NbcSetTransform( aFrontTransform );
if ( ( eFillStyle == XFILL_BITMAP ) && !aFillBmp.IsEmpty() )
- p3DObj->SetMergedItem( XFillBitmapItem( String(), aFillBmp ) );
+ {
+ p3DObj->SetMergedItem(XFillBitmapItem(String(), Graphic(aFillBmp)));
+ }
}
else if ( eFillStyle == XFILL_NONE )
{
diff --git a/svx/source/dialog/dlgctrl.cxx b/svx/source/dialog/dlgctrl.cxx
index cbb2a1f..e357246 100644
--- a/svx/source/dialog/dlgctrl.cxx
+++ b/svx/source/dialog/dlgctrl.cxx
@@ -23,9 +23,8 @@
#include <svx/xtable.hxx>
#include <svx/xpool.hxx>
-
#include <svx/dialogs.hrc>
-#include "accessibility.hrc"
+#include <accessibility.hrc>
#include <svx/dlgctrl.hxx>
#include <svx/dialmgr.hxx>
#include <tools/poly.hxx>
@@ -33,18 +32,18 @@
#include <vcl/gradient.hxx>
#include <vcl/hatch.hxx>
#include <svtools/colorcfg.hxx>
-
-#include "svxrectctaccessiblecontext.hxx"
+#include <svxrectctaccessiblecontext.hxx>
#include <com/sun/star/lang/XUnoTunnel.hpp>
#include <basegfx/point/b2dpoint.hxx>
#include <basegfx/polygon/b2dpolygon.hxx>
#include <svx/svdorect.hxx>
-
#include <svx/svdmodel.hxx>
#include <svx/svdopath.hxx>
#include <svx/sdr/contact/objectcontactofobjlistpainter.hxx>
#include <svx/sdr/contact/displayinfo.hxx>
-#include "linectrl.hrc"
+#include <linectrl.hrc>
+#include <vcl/bmpacc.hxx>
+#include <svx/xbtmpit.hxx>
#define OUTPUT_DRAWMODE_COLOR (DRAWMODE_DEFAULT)
#define OUTPUT_DRAWMODE_CONTRAST (DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT)
@@ -847,17 +846,34 @@ void SvxPixelCtl::Paint( const Rectangle& )
}
}
-void SvxPixelCtl::SetXBitmap( const XOBitmap& rXBmp )
+void SvxPixelCtl::SetXBitmap( const BitmapEx& rBitmapEx )
{
- if( rXBmp.GetBitmapType() == XBITMAP_8X8 )
+ BitmapColor aBack;
+ BitmapColor aFront;
+
+ if(isHistorical8x8(rBitmapEx, aBack, aFront))
{
- aPixelColor = rXBmp.GetPixelColor();
- aBackgroundColor = rXBmp.GetBackgroundColor();
+ Bitmap aBitmap(rBitmapEx.GetBitmap());
+ BitmapReadAccess* pRead = aBitmap.AcquireReadAccess();
+
+ aBackgroundColor = aBack;
+ aPixelColor = aFront;
+
+ for(sal_uInt16 i(0); i < nSquares; i++)
+ {
+ const BitmapColor aColor(pRead->GetColor(i/8, i%8));
- sal_uInt16* pArray = rXBmp.GetPixelArray();
+ if(aColor == aBack)
+ {
+ *( pPixel + i ) = 0;
+ }
+ else
+ {
+ *( pPixel + i ) = 1;
+ }
+ }
- for( sal_uInt16 i = 0; i < nSquares; i++ )
- *( pPixel + i ) = *( pArray + i );
+ aBitmap.ReleaseAccess(pRead);
}
}
@@ -883,11 +899,11 @@ SvxBitmapCtl::~SvxBitmapCtl()
// BitmapCtl: Returns the Bitmap
-XOBitmap SvxBitmapCtl::GetXBitmap()
+BitmapEx SvxBitmapCtl::GetBitmapEx()
{
- XOBitmap aXOBitmap( pBmpArray, aPixelColor, aBackgroundColor );
+ const Bitmap aRetval(createHistorical8x8FromArray(pBmpArray, aPixelColor, aBackgroundColor));
- return( aXOBitmap );
+ return BitmapEx(aRetval);
}
extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeColorLB(Window *pParent, VclBuilder::stringmap &)
@@ -1236,34 +1252,35 @@ void FillAttrLB::Fill( const XGradientListRef &pList )
// BitmapLB Constructor
-BitmapLB::BitmapLB( Window* pParent, ResId Id, sal_Bool bUserDraw /*= sal_True*/ )
-: ListBox( pParent, Id ),
- mpList( NULL ),
- mbUserDraw( bUserDraw )
+BitmapLB::BitmapLB(Window* pParent, ResId Id, bool bUserDraw /*= false*/ )
+: ListBox(pParent, Id),
+ maVD(),
+ maBitmapEx(),
+ mpList(NULL),
+ mbUserDraw(bUserDraw)
{
- aVD.SetOutputSizePixel( Size( 32, 16 ) );
- EnableUserDraw( mbUserDraw );
+ maVD.SetOutputSizePixel(Size(32, 16));
+ EnableUserDraw(mbUserDraw);
}
/************************************************************************/
void BitmapLB::SetVirtualDevice()
{
- if( aBitmap.GetSizePixel().Width() > 8 ||
- aBitmap.GetSizePixel().Height() > 8 )
+ if(maBitmapEx.GetSizePixel().Width() > 8 || maBitmapEx.GetSizePixel().Height() > 8)
{
- aVD.DrawBitmap( Point( 0, 0 ), Size( 32, 16 ), aBitmap );
+ maVD.DrawBitmapEx(Point(0, 0), Size(32, 16), maBitmapEx);
}
else
{
- aVD.DrawBitmap( Point( 0, 0 ), aBitmap );
- aVD.DrawBitmap( Point( 8, 0 ), aBitmap );
- aVD.DrawBitmap( Point( 16, 0 ), aBitmap );
- aVD.DrawBitmap( Point( 24, 0 ), aBitmap );
- aVD.DrawBitmap( Point( 0, 8 ), aBitmap );
- aVD.DrawBitmap( Point( 8, 8 ), aBitmap );
- aVD.DrawBitmap( Point( 16, 8 ), aBitmap );
- aVD.DrawBitmap( Point( 24, 8 ), aBitmap );
+ maVD.DrawBitmapEx(Point(0, 0), maBitmapEx);
+ maVD.DrawBitmapEx(Point(8, 0), maBitmapEx);
+ maVD.DrawBitmapEx(Point(16, 0), maBitmapEx);
+ maVD.DrawBitmapEx(Point(24, 0), maBitmapEx);
+ maVD.DrawBitmapEx(Point(0, 8), maBitmapEx);
+ maVD.DrawBitmapEx(Point(8, 8), maBitmapEx);
+ maVD.DrawBitmapEx(Point(16, 8), maBitmapEx);
+ maVD.DrawBitmapEx(Point(24, 8), maBitmapEx);
}
}
@@ -1273,135 +1290,133 @@ void BitmapLB::Fill( const XBitmapListRef &pList )
{
mpList = pList;
XBitmapEntry* pEntry;
- long nCount = pList->Count();
+ const long nCount(pList->Count());
- SetUpdateMode( sal_False );
+ SetUpdateMode(false);
- if( mbUserDraw )
+ if(mbUserDraw)
{
- for( long i = 0; i < nCount; i++ )
- InsertEntry( pList->GetBitmap( i )->GetName() );
+ for(long i(0); i < nCount; i++)
+ {
+ InsertEntry(pList->GetBitmap(i)->GetName());
+ }
}
else
{
- for( long i = 0; i < nCount; i++ )
+ for(long i(0); i < nCount; i++)
{
- pEntry = pList->GetBitmap( i );
- aBitmap = pEntry->GetXBitmap().GetBitmap();
-
+ pEntry = pList->GetBitmap(i);
+ maBitmapEx = pEntry->GetGraphicObject().GetGraphic().GetBitmapEx();
SetVirtualDevice();
-
- InsertEntry( pEntry->GetName(), aVD.GetBitmap( Point( 0, 2 ), Size( 32, 12 ) ) );
+ InsertEntry(pEntry->GetName(), maVD.GetBitmap(Point(0, 2), Size(32, 12)));
}
}
- SetUpdateMode( sal_True );
+ SetUpdateMode(true);
}
-void BitmapLB::UserDraw( const UserDrawEvent& rUDEvt )
+void BitmapLB::UserDraw(const UserDrawEvent& rUDEvt)
{
- if( mpList != NULL )
+ if (mpList != NULL)
{
// Draw bitmap
const Rectangle& rDrawRect = rUDEvt.GetRect();
- Rectangle aRect( rDrawRect.Left()+1, rDrawRect.Top()+1, rDrawRect.Left()+33, rDrawRect.Bottom()-1 );
+ const Rectangle aRect(rDrawRect.Left() + 1, rDrawRect.Top() + 1, rDrawRect.Left() + 33, rDrawRect.Bottom() - 1);
+ const sal_Int32 nId(rUDEvt.GetItemId());
- sal_Int32 nId = rUDEvt.GetItemId();
- if( nId >= 0 && nId <= mpList->Count() )
+ if(nId >= 0 && nId <= mpList->Count())
{
- Rectangle aClipRect( rDrawRect.Left()+1, rDrawRect.Top()+1, rDrawRect.Right()-1, rDrawRect.Bottom()-1 );
-
+ const Rectangle aClipRect(rDrawRect.Left() + 1, rDrawRect.Top() + 1, rDrawRect.Right() - 1, rDrawRect.Bottom() - 1);
OutputDevice* pDevice = rUDEvt.GetDevice();
- pDevice->SetClipRegion( Region( aClipRect ) );
-
- aBitmap = mpList->GetBitmap( nId )->GetXBitmap().GetBitmap();
-
+ pDevice->SetClipRegion(Region(aClipRect));
+ maBitmapEx = mpList->GetBitmap(nId)->GetGraphicObject().GetGraphic().GetBitmapEx();
long nPosBaseX = aRect.Left();
long nPosBaseY = aRect.Top();
- if( aBitmap.GetSizePixel().Width() > 8 ||
- aBitmap.GetSizePixel().Height() > 8 )
+ if(maBitmapEx.GetSizePixel().Width() > 8 || maBitmapEx.GetSizePixel().Height() > 8)
{
- pDevice->DrawBitmap( Point( nPosBaseX, nPosBaseY ), Size( 32, 16 ), aBitmap );
+ pDevice->DrawBitmapEx(Point(nPosBaseX, nPosBaseY), Size(32, 16), maBitmapEx);
}
else
{
- pDevice->DrawBitmap( Point( nPosBaseX+ 0, nPosBaseY+0 ), aBitmap );
- pDevice->DrawBitmap( Point( nPosBaseX+ 8, nPosBaseY+0 ), aBitmap );
- pDevice->DrawBitmap( Point( nPosBaseX+16, nPosBaseY+0 ), aBitmap );
- pDevice->DrawBitmap( Point( nPosBaseX+24, nPosBaseY+0 ), aBitmap );
- pDevice->DrawBitmap( Point( nPosBaseX+ 0, nPosBaseY+8 ), aBitmap );
- pDevice->DrawBitmap( Point( nPosBaseX+ 8, nPosBaseY+8 ), aBitmap );
- pDevice->DrawBitmap( Point( nPosBaseX+16, nPosBaseY+8 ), aBitmap );
- pDevice->DrawBitmap( Point( nPosBaseX+24, nPosBaseY+8 ), aBitmap );
+ pDevice->DrawBitmapEx(Point(nPosBaseX+ 0, nPosBaseY+0 ), maBitmapEx);
+ pDevice->DrawBitmapEx(Point(nPosBaseX+ 8, nPosBaseY+0 ), maBitmapEx);
+ pDevice->DrawBitmapEx(Point(nPosBaseX+16, nPosBaseY+0 ), maBitmapEx);
+ pDevice->DrawBitmapEx(Point(nPosBaseX+24, nPosBaseY+0 ), maBitmapEx);
+ pDevice->DrawBitmapEx(Point(nPosBaseX+ 0, nPosBaseY+8 ), maBitmapEx);
+ pDevice->DrawBitmapEx(Point(nPosBaseX+ 8, nPosBaseY+8 ), maBitmapEx);
+ pDevice->DrawBitmapEx(Point(nPosBaseX+16, nPosBaseY+8 ), maBitmapEx);
+ pDevice->DrawBitmapEx(Point(nPosBaseX+24, nPosBaseY+8 ), maBitmapEx);
}
pDevice->SetClipRegion();
// Draw name
- pDevice->DrawText( Point( aRect.Right()+7, aRect.Top()-1 ), mpList->GetBitmap( nId )->GetName() );
+ pDevice->DrawText(Point(aRect.Right() + 7, aRect.Top() - 1), mpList->GetBitmap(nId)->GetName());
}
}
}
/************************************************************************/
-void BitmapLB::Append( XBitmapEntry* pEntry, Bitmap* pBmp )
+void BitmapLB::Append(XBitmapEntry* pEntry, BitmapEx* pBmpEx)
{
- if( pBmp )
+ if(pBmpEx)
{
- aBitmap = pEntry->GetXBitmap().GetBitmap();
+ maBitmapEx = pEntry->GetGraphicObject().GetGraphic().GetBitmapEx();
SetVirtualDevice();
- InsertEntry( pEntry->GetName(), aVD.GetBitmap( Point( 0, 2 ), Size( 32, 12 ) ) );
+ InsertEntry(pEntry->GetName(), maVD.GetBitmap(Point(0, 2), Size(32, 12)));
}
else
- InsertEntry( pEntry->GetName() );
+ {
+ InsertEntry(pEntry->GetName());
+ }
}
/************************************************************************/
-void BitmapLB::Modify( XBitmapEntry* pEntry, sal_uInt16 nPos, Bitmap* pBmp )
+void BitmapLB::Modify(XBitmapEntry* pEntry, sal_uInt16 nPos, BitmapEx* pBmpEx)
{
- RemoveEntry( nPos );
+ RemoveEntry(nPos);
- if( pBmp )
+ if(pBmpEx)
{
- aBitmap = pEntry->GetXBitmap().GetBitmap();
+ maBitmapEx = pEntry->GetGraphicObject().GetGraphic().GetBitmapEx();
SetVirtualDevice();
-
- InsertEntry( pEntry->GetName(), aVD.GetBitmap( Point( 0, 2 ), Size( 32, 12 ) ), nPos );
+ InsertEntry(pEntry->GetName(), maVD.GetBitmap(Point(0, 2), Size(32, 12)), nPos);
}
else
- InsertEntry( pEntry->GetName() );
+ {
+ InsertEntry(pEntry->GetName());
+ }
}
-// FillAttrLB Constructor
-
-FillAttrLB::FillAttrLB( Window* pParent, WinBits aWB ) :
- ColorListBox( pParent, aWB )
+FillAttrLB::FillAttrLB(Window* pParent, WinBits aWB)
+: ColorListBox(pParent, aWB)
{
- aVD.SetOutputSizePixel( Size( 32, 16 ) );
+ maVD.SetOutputSizePixel(Size(32, 16));
}
/************************************************************************/
void FillAttrLB::SetVirtualDevice()
{
- if( aBitmap.GetSizePixel().Width() > 8 ||
- aBitmap.GetSizePixel().Height() > 8 )
+ maVD.Erase();
+
+ if(maBitmapEx.GetSizePixel().Width() > 8 || maBitmapEx.GetSizePixel().Height() > 8)
{
- aVD.DrawBitmap( Point( 0, 0 ), Size( 32, 16 ), aBitmap );
+ maVD.DrawBitmapEx(Point(0, 0), Size(32, 16), maBitmapEx);
}
else
{
- aVD.DrawBitmap( Point( 0, 0 ), aBitmap );
- aVD.DrawBitmap( Point( 8, 0 ), aBitmap );
- aVD.DrawBitmap( Point( 16, 0 ), aBitmap );
- aVD.DrawBitmap( Point( 24, 0 ), aBitmap );
- aVD.DrawBitmap( Point( 0, 8 ), aBitmap );
- aVD.DrawBitmap( Point( 8, 8 ), aBitmap );
- aVD.DrawBitmap( Point( 16, 8 ), aBitmap );
- aVD.DrawBitmap( Point( 24, 8 ), aBitmap );
+ maVD.DrawBitmapEx(Point(0, 0), maBitmapEx);
+ maVD.DrawBitmapEx(Point(8, 0), maBitmapEx);
+ maVD.DrawBitmapEx(Point(16, 0), maBitmapEx);
+ maVD.DrawBitmapEx(Point(24, 0), maBitmapEx);
+ maVD.DrawBitmapEx(Point(0, 8), maBitmapEx);
+ maVD.DrawBitmapEx(Point(8, 8), maBitmapEx);
+ maVD.DrawBitmapEx(Point(16, 8), maBitmapEx);
+ maVD.DrawBitmapEx(Point(24, 8), maBitmapEx);
}
}
@@ -1409,23 +1424,21 @@ void FillAttrLB::SetVirtualDevice()
void FillAttrLB::Fill( const XBitmapListRef &pList )
{
- long nCount = pList->Count();
+ const long nCount(pList->Count());
XBitmapEntry* pEntry;
- ListBox::SetUpdateMode( sal_False );
- for( long i = 0; i < nCount; i++ )
+ ListBox::SetUpdateMode(false);
+
+ for(long i(0); i < nCount; i++)
{
pEntry = pList->GetBitmap( i );
- aBitmap = pEntry->GetXBitmap().GetBitmap();
-
+ maBitmapEx = pEntry->GetGraphicObject().GetGraphic().GetBitmapEx();
SetVirtualDevice();
-
- ListBox::InsertEntry( pEntry->GetName(), aVD.GetBitmap( Point( 0, 2 ), Size( 32, 12 ) ) );
+ ListBox::InsertEntry(pEntry->GetName(), maVD.GetBitmap(Point(0, 2), Size(32, 12)));
}
- ListBox::SetUpdateMode( sal_True );
-}
-// Fills the listbox (provisional) with strings
+ ListBox::SetUpdateMode(true);
+}
void FillTypeLB::Fill()
{
diff --git a/svx/source/sdr/primitive2d/sdrattributecreator.cxx b/svx/source/sdr/primitive2d/sdrattributecreator.cxx
index 3fd7b44..273db74 100644
--- a/svx/source/sdr/primitive2d/sdrattributecreator.cxx
+++ b/svx/source/sdr/primitive2d/sdrattributecreator.cxx
@@ -586,42 +586,42 @@ namespace drawinglayer
attribute::SdrFillBitmapAttribute createNewSdrFillBitmapAttribute(const SfxItemSet& rSet)
{
- Bitmap aBitmap((((const XFillBitmapItem&)(rSet.Get(XATTR_FILLBITMAP))).GetBitmapValue()).GetBitmap());
+ BitmapEx aBitmapEx(((const XFillBitmapItem&)(rSet.Get(XATTR_FILLBITMAP))).GetGraphicObject().GetGraphic().GetBitmapEx());
// make sure it's not empty, use default instead
- if(aBitmap.IsEmpty())
+ if(aBitmapEx.IsEmpty())
{
// #i118485# Add PrefMapMode and PrefSize to avoid mini-tiling and
// expensive primitive processing in this case. Use 10x10 cm
- aBitmap = Bitmap(Size(4,4), 8);
- aBitmap.SetPrefMapMode(MapMode(MAP_100TH_MM));
- aBitmap.SetPrefSize(Size(10000.0, 10000.0));
+ aBitmapEx = Bitmap(Size(4,4), 8);
+ aBitmapEx.SetPrefMapMode(MapMode(MAP_100TH_MM));
+ aBitmapEx.SetPrefSize(Size(10000.0, 10000.0));
}
// if there is no logical size, create a size from pixel size and set MapMode accordingly
- if(0L == aBitmap.GetPrefSize().Width() || 0L == aBitmap.GetPrefSize().Height())
+ if(0L == aBitmapEx.GetPrefSize().Width() || 0L == aBitmapEx.GetPrefSize().Height())
{
- aBitmap.SetPrefSize(aBitmap.GetSizePixel());
- aBitmap.SetPrefMapMode(MAP_PIXEL);
+ aBitmapEx.SetPrefSize(aBitmapEx.GetSizePixel());
+ aBitmapEx.SetPrefMapMode(MAP_PIXEL);
}
// convert size and MapMode to destination logical size and MapMode. The created
// bitmap must have a valid logical size (PrefSize)
const MapUnit aDestinationMapUnit((MapUnit)rSet.GetPool()->GetMetric(0));
- if(aBitmap.GetPrefMapMode() != aDestinationMapUnit)
+ if(aBitmapEx.GetPrefMapMode() != aDestinationMapUnit)
{
// #i100360# for MAP_PIXEL, LogicToLogic will not work properly,
// so fallback to Application::GetDefaultDevice()
- if(MAP_PIXEL == aBitmap.GetPrefMapMode().GetMapUnit())
+ if(MAP_PIXEL == aBitmapEx.GetPrefMapMode().GetMapUnit())
{
- aBitmap.SetPrefSize(Application::GetDefaultDevice()->PixelToLogic(
- aBitmap.GetPrefSize(), aDestinationMapUnit));
+ aBitmapEx.SetPrefSize(Application::GetDefaultDevice()->PixelToLogic(
+ aBitmapEx.GetPrefSize(), aDestinationMapUnit));
}
else
{
- aBitmap.SetPrefSize(OutputDevice::LogicToLogic(
- aBitmap.GetPrefSize(), aBitmap.GetPrefMapMode(), aDestinationMapUnit));
+ aBitmapEx.SetPrefSize(OutputDevice::LogicToLogic(
+ aBitmapEx.GetPrefSize(), aBitmapEx.GetPrefMapMode(), aDestinationMapUnit));
}
}
@@ -637,7 +637,7 @@ namespace drawinglayer
(double)((const SfxUInt16Item&) (rSet.Get(XATTR_FILLBMP_POSOFFSETY))).GetValue());
return attribute::SdrFillBitmapAttribute(
- aBitmap,
+ aBitmapEx,
aSize,
aOffset,
aOffsetPosition,
diff --git a/svx/source/svdraw/svdetc.cxx b/svx/source/svdraw/svdetc.cxx
index 5d184eb..9fd5624 100644
--- a/svx/source/svdraw/svdetc.cxx
+++ b/svx/source/svdraw/svdetc.cxx
@@ -321,11 +321,10 @@ bool GetDraftFillColor(const SfxItemSet& rSet, Color& rCol)
}
case XFILL_BITMAP:
{
- const Bitmap& rBitmap = ((XFillBitmapItem&)rSet.Get(XATTR_FILLBITMAP)).GetBitmapValue().GetBitmap();
- const Size aSize(rBitmap.GetSizePixel());
+ Bitmap aBitmap(((XFillBitmapItem&)rSet.Get(XATTR_FILLBITMAP)).GetGraphicObject().GetGraphic().GetBitmapEx().GetBitmap());
+ const Size aSize(aBitmap.GetSizePixel());
const sal_uInt32 nWidth = aSize.Width();
const sal_uInt32 nHeight = aSize.Height();
- Bitmap aBitmap(rBitmap);
BitmapReadAccess* pAccess = aBitmap.AcquireReadAccess();
if(pAccess && nWidth > 0 && nHeight > 0)
diff --git a/svx/source/svdraw/svdfmtf.cxx b/svx/source/svdraw/svdfmtf.cxx
index 1d9b948..93c2f32 100644
--- a/svx/source/svdraw/svdfmtf.cxx
+++ b/svx/source/svdraw/svdfmtf.cxx
@@ -442,7 +442,7 @@ void ImpSdrGDIMetaFileImport::InsertObj(SdrObject* pObj, sal_Bool bScale)
Size(ceil(aPixel.getWidth()), ceil(aPixel.getHeight())));
pObj->SetMergedItem(XFillStyleItem(XFILL_BITMAP));
- pObj->SetMergedItem(XFillBitmapItem(String(), aClippedBitmap.GetBitmap()));
+ pObj->SetMergedItem(XFillBitmapItem(String(), Graphic(aClippedBitmap)));
}
}
}
diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx
index 380a0db..0781081 100644
--- a/svx/source/svdraw/svdoashp.cxx
+++ b/svx/source/svdraw/svdoashp.cxx
@@ -343,15 +343,17 @@ SdrObject* ImpCreateShadowObjectClone(const SdrObject& rOriginal, const SfxItemS
// bitmap and transparency like shadow
if(bBitmapFillUsed)
{
- XOBitmap aFillBitmap(((XFillBitmapItem&)(rOriginalSet.Get(XATTR_FILLBITMAP))).GetBitmapValue());
- Bitmap aSourceBitmap(aFillBitmap.GetBitmap());
- BitmapReadAccess* pReadAccess = aSourceBitmap.AcquireReadAccess();
+ GraphicObject aGraphicObject(((XFillBitmapItem&)(rOriginalSet.Get(XATTR_FILLBITMAP))).GetGraphicObject());
+ const BitmapEx aBitmapEx(aGraphicObject.GetGraphic().GetBitmapEx());
+ Bitmap aBitmap(aBitmapEx.GetBitmap());
- if(!aSourceBitmap.IsEmpty())
+ if(!aBitmap.IsEmpty())
{
+ BitmapReadAccess* pReadAccess = aBitmap.AcquireReadAccess();
+
if(pReadAccess)
{
- Bitmap aDestBitmap(aSourceBitmap.GetSizePixel(), 24L);
+ Bitmap aDestBitmap(aBitmap.GetSizePixel(), 24L);
BitmapWriteAccess* pWriteAccess = aDestBitmap.AcquireWriteAccess();
if(pWriteAccess)
@@ -370,14 +372,29 @@ SdrObject* ImpCreateShadowObjectClone(const SdrObject& rOriginal, const SfxItemS
}
aDestBitmap.ReleaseAccess(pWriteAccess);
- aFillBitmap.SetBitmap(aDestBitmap);
}
- aSourceBitmap.ReleaseAccess(pReadAccess);
+ aBitmap.ReleaseAccess(pReadAccess);
+
+ if(aBitmapEx.IsTransparent())
+ {
+ if(aBitmapEx.IsAlpha())
+ {
+ aGraphicObject.SetGraphic(Graphic(BitmapEx(aDestBitmap, aBitmapEx.GetAlpha())));
+ }
+ else
+ {
+ aGraphicObject.SetGraphic(Graphic(BitmapEx(aDestBitmap, aBitmapEx.GetMask())));
+ }
+ }
+ else
+ {
+ aGraphicObject.SetGraphic(Graphic(aDestBitmap));
+ }
}
}
- aTempSet.Put(XFillBitmapItem(aTempSet.GetPool(), aFillBitmap));
+ aTempSet.Put(XFillBitmapItem(aTempSet.GetPool(), aGraphicObject));
aTempSet.Put(XFillTransparenceItem(nShadowTransparence));
}
diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx
index 91775be..abf9f86 100644
--- a/svx/source/svdraw/svdograf.cxx
+++ b/svx/source/svdraw/svdograf.cxx
@@ -47,7 +47,6 @@
#include <svx/svdview.hxx>
#include <svx/svdograf.hxx>
#include <svx/svdogrp.hxx>
-#include <svx/xbitmap.hxx>
#include <svx/xbtmpit.hxx>
#include <svx/xflbmtit.hxx>
#include <svx/svdundo.hxx>
@@ -1216,9 +1215,8 @@ SdrObject* SdrGrafObj::DoConvertToPolyObj(sal_Bool bBezier, bool bAddText ) cons
SfxItemSet aSet(GetObjectItemSet());
aSet.Put(XFillStyleItem(XFILL_BITMAP));
- Bitmap aBitmap( GetTransformedGraphic().GetBitmap() );
- XOBitmap aXBmp(aBitmap, XBITMAP_STRETCH);
- aSet.Put(XFillBitmapItem(String(), aXBmp));
+ const BitmapEx aBitmapEx(GetTransformedGraphic().GetBitmapEx());
+ aSet.Put(XFillBitmapItem(OUString(), Graphic(aBitmapEx)));
aSet.Put(XFillBmpTileItem(false));
pRetval->SetMergedItemSet(aSet);
diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx
index 98bd1ec..d3b4090 100644
--- a/svx/source/svdraw/svdoole2.cxx
+++ b/svx/source/svdraw/svdoole2.cxx
@@ -1338,7 +1338,7 @@ SdrObject* SdrOle2Obj::createSdrGrafObjReplacement(bool bAddText, bool /* bUseHC
// bitmap fill
pClone->SetMergedItem(XFillStyleItem(XFILL_BITMAP));
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list