diff options
author | Armin Le Grand <alg@apache.org> | 2012-05-10 09:29:55 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-03-15 15:24:52 +0000 |
commit | c97aec0d2276901c20634abe53867f739f420f50 (patch) | |
tree | db775ba307edfffaa990a5d01361ae5c53c43f28 /svx/source | |
parent | d2cccde341af33b72378f3e7b0e8dd9ff1cd5e65 (diff) |
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
Diffstat (limited to 'svx/source')
-rw-r--r-- | svx/source/customshapes/EnhancedCustomShape2d.cxx | 7 | ||||
-rw-r--r-- | svx/source/customshapes/EnhancedCustomShape3d.cxx | 20 | ||||
-rw-r--r-- | svx/source/dialog/dlgctrl.cxx | 225 | ||||
-rw-r--r-- | svx/source/sdr/primitive2d/sdrattributecreator.cxx | 30 | ||||
-rw-r--r-- | svx/source/svdraw/svdetc.cxx | 5 | ||||
-rw-r--r-- | svx/source/svdraw/svdfmtf.cxx | 2 | ||||
-rw-r--r-- | svx/source/svdraw/svdoashp.cxx | 33 | ||||
-rw-r--r-- | svx/source/svdraw/svdograf.cxx | 6 | ||||
-rw-r--r-- | svx/source/svdraw/svdoole2.cxx | 2 | ||||
-rw-r--r-- | svx/source/tbxctrls/fillctrl.cxx | 9 | ||||
-rw-r--r-- | svx/source/unodraw/XPropertyTable.cxx | 12 | ||||
-rw-r--r-- | svx/source/unodraw/unobtabl.cxx | 3 | ||||
-rw-r--r-- | svx/source/unodraw/unoshape.cxx | 2 | ||||
-rw-r--r-- | svx/source/xoutdev/xattr.cxx | 8 | ||||
-rw-r--r-- | svx/source/xoutdev/xattrbmp.cxx | 634 | ||||
-rw-r--r-- | svx/source/xoutdev/xpool.cxx | 4 | ||||
-rw-r--r-- | svx/source/xoutdev/xtabbtmp.cxx | 29 |
17 files changed, 367 insertions, 664 deletions
diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx b/svx/source/customshapes/EnhancedCustomShape2d.cxx index e83a1838eb92..41c963b22beb 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 f1dc1d1d68ce..e6885a39166b 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 cbb2a1f86fa8..e35724641dee 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 3fd7b44fc8ca..273db74e60c7 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 5d184ebdb81e..9fd5624086ec 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 1d9b94840f31..93c2f32ded3d 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 380a0db6f194..078108167e69 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 91775be362f4..abf9f860a51e 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 98bd1ec64116..d3b409025d61 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)); - pClone->SetMergedItem(XFillBitmapItem(String(), GetEmtyOLEReplacementBitmap())); + pClone->SetMergedItem(XFillBitmapItem(String(), Graphic(GetEmtyOLEReplacementBitmap()))); pClone->SetMergedItem(XFillBmpTileItem(false)); pClone->SetMergedItem(XFillBmpStretchItem(false)); diff --git a/svx/source/tbxctrls/fillctrl.cxx b/svx/source/tbxctrls/fillctrl.cxx index 9403c103fe16..877958250369 100644 --- a/svx/source/tbxctrls/fillctrl.cxx +++ b/svx/source/tbxctrls/fillctrl.cxx @@ -413,7 +413,7 @@ void SvxFillToolBoxControl::Update( const SfxPoolItem* pState ) aTmpStr += aString; aTmpStr += TMP_STR_END; - XBitmapEntry* pEntry = new XBitmapEntry( pBitmapItem->GetBitmapValue(), aTmpStr ); + XBitmapEntry* pEntry = new XBitmapEntry(pBitmapItem->GetGraphicObject(), aTmpStr); XBitmapListRef xBitmapList = XPropertyList::CreatePropertyList(XBITMAP_LIST, rtl::OUString("TmpList"))->AsBitmapList(); @@ -766,14 +766,13 @@ IMPL_LINK( FillControl, SelectFillAttrHdl, ListBox *, pBox ) if ( nPos < aItem.GetBitmapList()->Count() ) // kein temp. Eintrag ? { - XOBitmap aXOBitmap = aItem.GetBitmapList()->GetBitmap( nPos )->GetXBitmap(); - XFillBitmapItem aXFillBitmapItem( pLbFillAttr->GetSelectEntry(), aXOBitmap ); + const XBitmapEntry* pXBitmapEntry = aItem.GetBitmapList()->GetBitmap(nPos); + const XFillBitmapItem aXFillBitmapItem(pLbFillAttr->GetSelectEntry(), pXBitmapEntry->GetGraphicObject()); aArgs[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FillBitmap" )); aXFillBitmapItem.QueryValue( a ); aArgs[0].Value = a; - ((SvxFillToolBoxControl*)GetData())->Dispatch( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FillBitmap" )), - aArgs ); + ((SvxFillToolBoxControl*)GetData())->Dispatch(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:FillBitmap")), aArgs); } } } diff --git a/svx/source/unodraw/XPropertyTable.cxx b/svx/source/unodraw/XPropertyTable.cxx index d64271462faf..c6b9063930b4 100644 --- a/svx/source/unodraw/XPropertyTable.cxx +++ b/svx/source/unodraw/XPropertyTable.cxx @@ -669,9 +669,8 @@ uno::Reference< uno::XInterface > SAL_CALL SvxUnoXBitmapTable_createInstance( XP uno::Any SvxUnoXBitmapTable::getAny( const XPropertyEntry* pEntry ) const throw() { OUString aURL( RTL_CONSTASCII_USTRINGPARAM(UNO_NAME_GRAPHOBJ_URLPREFIX)); - aURL += OStringToOUString( - ((XBitmapEntry*)pEntry)->GetXBitmap().GetGraphicObject().GetUniqueID(), - RTL_TEXTENCODING_ASCII_US); + const GraphicObject& rGraphicObject(((XBitmapEntry*)pEntry)->GetGraphicObject()); + aURL += OStringToOUString(rGraphicObject.GetUniqueID(), RTL_TEXTENCODING_ASCII_US); uno::Any aAny; aAny <<= aURL; @@ -684,11 +683,10 @@ XPropertyEntry* SvxUnoXBitmapTable::getEntry( const OUString& rName, const uno:: if(!(rAny >>= aURL)) return NULL; - GraphicObject aGrafObj( GraphicObject::CreateGraphicObjectFromURL( aURL ) ); - XOBitmap aBMP( aGrafObj ); + const GraphicObject aGrafObj(GraphicObject::CreateGraphicObjectFromURL(aURL)); + const String aName(rName); - const String aName( rName ); - return new XBitmapEntry( aBMP, aName ); + return new XBitmapEntry(aGrafObj, aName); } // XElementAccess diff --git a/svx/source/unodraw/unobtabl.cxx b/svx/source/unodraw/unobtabl.cxx index 7051d1bc5331..bc8e7dff52ff 100644 --- a/svx/source/unodraw/unobtabl.cxx +++ b/svx/source/unodraw/unobtabl.cxx @@ -69,7 +69,8 @@ bool SvxUnoBitmapTable::isValid( const NameOrIndex* pItem ) const const XFillBitmapItem* pBitmapItem = dynamic_cast< const XFillBitmapItem* >( pItem ); if( pBitmapItem ) { - const GraphicObject& rGraphic = pBitmapItem->GetBitmapValue().GetGraphicObject(); + const Graphic& rGraphic = pBitmapItem->GetGraphicObject().GetGraphic(); + return rGraphic.GetSizeBytes() > 0; } } diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx index 23b9046c4fc3..1193242b98bf 100644 --- a/svx/source/unodraw/unoshape.cxx +++ b/svx/source/unodraw/unoshape.cxx @@ -1506,7 +1506,7 @@ sal_Bool SAL_CALL SvxShape::SetFillAttribute( sal_Int32 nWID, const ::rtl::OUStr XFillBitmapItem aBmpItem; aBmpItem.SetWhich( XATTR_FILLBITMAP ); aBmpItem.SetName( rName ); - aBmpItem.SetBitmapValue( pEntry->GetXBitmap() ); + aBmpItem.SetGraphicObject(pEntry->GetGraphicObject()); rSet.Put( aBmpItem ); break; } diff --git a/svx/source/xoutdev/xattr.cxx b/svx/source/xoutdev/xattr.cxx index 26bc642aaaca..9a607cb01884 100644 --- a/svx/source/xoutdev/xattr.cxx +++ b/svx/source/xoutdev/xattr.cxx @@ -241,9 +241,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 ad524bbe7b37..27a3dd238365 100644 --- a/svx/source/xoutdev/xattrbmp.cxx +++ b/svx/source/xoutdev/xattrbmp.cxx @@ -26,567 +26,250 @@ #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> +#include <vcl/salbtype.hxx> +#include <vcl/bmpacc.hxx> using namespace ::com::sun::star; -// --------------- -// class XOBitmap -// --------------- - -/************************************************************************* -|* -|* XOBitmap::XOBitmap() -|* -*************************************************************************/ - -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 ) -|* -*************************************************************************/ - -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 ) -|* -*************************************************************************/ - -XOBitmap::XOBitmap( const GraphicObject& rGraphicObject, XBitmapStyle eInStyle ) : - eType ( XBITMAP_IMPORT ), - eStyle ( eInStyle ), - aGraphicObject ( rGraphicObject ), - pPixelArray ( NULL ), - bGraphicDirty ( sal_False ) +XFillBitmapItem::XFillBitmapItem(const XubString& rName, const GraphicObject& rGraphicObject) +: NameOrIndex(XATTR_FILLBITMAP, rName), + maGraphicObject(rGraphicObject) { } -/************************************************************************* -|* -|* XOBitmap::XOBitmap( sal_uInt16* pArray, const Color& aPixelColor, -|* const Color& aBckgrColor, const Size& rSize = Size( 8, 8 ), -|* XBitmapStyle eStyle = XBITMAP_TILE ) -|* -*************************************************************************/ - -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 XFillBitmapItem& rItem) +: NameOrIndex(rItem), + maGraphicObject(rItem.maGraphicObject) { - 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 ) -|* -*************************************************************************/ +////////////////////////////////////////////////////////////////////////////// -XOBitmap::XOBitmap( const XOBitmap& rXBmp ) : - pPixelArray ( NULL ) +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 ); - } - } -} + aPalette[0] = BitmapColor(aColorBack); + aPalette[1] = BitmapColor(aColorPix); -/************************************************************************* -|* -|* XOBitmap::XOBitmap( Bitmap aBitmap, XBitmapStyle eStyle = XBITMAP_TILE ) -|* -*************************************************************************/ + Bitmap aBitmap(Size(8, 8), 1, &aPalette); + BitmapWriteAccess* pContent = aBitmap.AcquireWriteAccess(); -XOBitmap::~XOBitmap() -{ - if( pPixelArray ) - delete []pPixelArray; -} - -/************************************************************************* -|* -|* XOBitmap& XOBitmap::operator=( const XOBitmap& rXBmp ) -|* -*************************************************************************/ - -XOBitmap& XOBitmap::operator=( const XOBitmap& rXBmp ) -{ - 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(pContent) { - if( eType == XBITMAP_8X8 ) + for(sal_uInt16 a(0); a < 8; a++) { - pPixelArray = new sal_uInt16[ 64 ]; - - for( sal_uInt16 i = 0; i < 64; i++ ) - *( pPixelArray + i ) = *( rXBmp.pPixelArray + i ); + 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( *this ); -} - -/************************************************************************* -|* -|* int XOBitmap::operator==( const XOBitmap& rXOBitmap ) const -|* -*************************************************************************/ -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 ); + aBitmap.ReleaseAccess(pContent); } - 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 ); + return aBitmap; } -/************************************************************************* -|* -|* void SetPixelArray( const sal_uInt16* pArray ) -|* -*************************************************************************/ +////////////////////////////////////////////////////////////////////////////// -void XOBitmap::SetPixelArray( const sal_uInt16* pArray ) +bool SVX_DLLPUBLIC isHistorical8x8(const BitmapEx& rBitmapEx, BitmapColor& o_rBack, BitmapColor& o_rFront) { - if( eType == XBITMAP_8X8 ) + if(!rBitmapEx.IsTransparent()) { - if( pPixelArray ) - delete []pPixelArray; - - pPixelArray = new sal_uInt16[ 64 ]; - - for( sal_uInt16 i = 0; i < 64; i++ ) - *( pPixelArray + i ) = *( pArray + i ); - - bGraphicDirty = sal_True; - } - else - { - DBG_ASSERT( 0, "Nicht unterstuetzter Bitmaptyp" ); - } -} + Bitmap aBitmap(rBitmapEx.GetBitmap()); -/************************************************************************* -|* -|* 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(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 -|* -*************************************************************************/ + BitmapReadAccess* pRead = aBitmap.AcquireReadAccess(); -void XOBitmap::Array2Bitmap() -{ - VirtualDevice aVD; - sal_uInt16 nLines = 8; // von Type abhaengig - - 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; -} - -// ----------------------- -// class XFillBitmapItem -// ----------------------- -TYPEINIT1_AUTOFACTORY(XFillBitmapItem, NameOrIndex); - -/************************************************************************* -|* -|* XFillBitmapItem::XFillBitmapItem(const XubString& rName, -|* const Bitmap& rTheBitmap) -|* -*************************************************************************/ - -XFillBitmapItem::XFillBitmapItem(const XubString& rName, - const XOBitmap& rTheBitmap) : - NameOrIndex( XATTR_FILLBITMAP, rName ), - aXOBitmap( rTheBitmap ) -{ + return false; } -/************************************************************************* -|* -|* XFillBitmapItem::XFillBitmapItem(const XFillBitmapItem& rItem) -|* -*************************************************************************/ +////////////////////////////////////////////////////////////////////////////// -XFillBitmapItem::XFillBitmapItem(const XFillBitmapItem& rItem) : - NameOrIndex( rItem ), - aXOBitmap( rItem.aXOBitmap ) +XFillBitmapItem::XFillBitmapItem(SvStream& rIn, sal_uInt16 nVer) +: NameOrIndex(XATTR_FILLBITMAP, rIn) { -} - -/************************************************************************* -|* -|* XFillBitmapItem::XFillBitmapItem(SvStream& rIn) -|* -*************************************************************************/ - -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::Clone(SfxItemPool* pPool) const -|* -*************************************************************************/ +////////////////////////////////////////////////////////////////////////////// SfxPoolItem* XFillBitmapItem::Clone(SfxItemPool* /*pPool*/) const { return new XFillBitmapItem(*this); } -/************************************************************************* -|* -|* int XFillBitmapItem::operator==(const SfxPoolItem& rItem) const -|* -*************************************************************************/ +////////////////////////////////////////////////////////////////////////////// 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 -|* -*************************************************************************/ +////////////////////////////////////////////////////////////////////////////// SfxPoolItem* XFillBitmapItem::Create(SvStream& rIn, sal_uInt16 nVer) const { return new XFillBitmapItem( rIn, nVer ); } -/************************************************************************* -|* -|* SfxPoolItem* XFillBitmapItem::Store(SvStream& rOut) const -|* -*************************************************************************/ +////////////////////////////////////////////////////////////////////////////// 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 -|* -*************************************************************************/ +////////////////////////////////////////////////////////////////////////////// -const XOBitmap& XFillBitmapItem::GetBitmapValue( -// const XBitmapTable* pTable -) const // GetValue -> GetBitmapValue +const GraphicObject& XFillBitmapItem::GetGraphicObject() const { -// Note: we never pass pTable to this method which means that it's NULL. Thus, this code would -// fail if the Item was a list. I'm guessing that it can't be an Index or the caller makes sure -// it's not an Index before calling. Either way, I'm just going to return the Bitmap to keep it -// from failing. This could use some more research. (Joe P. 2011-08-24) -// if (!IsIndex()) -// return aXOBitmap; -// else -// return pTable->GetBitmap(GetIndex())->GetXBitmap(); - return aXOBitmap; + return maGraphicObject; } +////////////////////////////////////////////////////////////////////////////// + +void XFillBitmapItem::SetGraphicObject(const GraphicObject& rGraphicObject) +{ + maGraphicObject = rGraphicObject; +} -/************************************************************************* -|* -|* sal_uInt16 XFillBitmapItem::GetVersion() const -|* -*************************************************************************/ +////////////////////////////////////////////////////////////////////////////// -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*/, - OUString& rText, const IntlWrapper * -) const + SfxMapUnit /*eCoreUnit*/, + SfxMapUnit /*ePresUnit*/, + OUString& rText, + const IntlWrapper*) const { - switch ( ePres ) + switch (ePres) { case SFX_ITEM_PRESENTATION_NONE: rText = OUString(); @@ -600,11 +283,10 @@ SfxItemPresentation XFillBitmapItem::GetPresentation } } -//------------------------------------------------------------------------ +////////////////////////////////////////////////////////////////////////////// -bool XFillBitmapItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const +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 @@ -627,21 +309,16 @@ bool XFillBitmapItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 nM if( nMemberId == MID_GRAFURL || nMemberId == 0 ) { - XOBitmap aLocalXOBitmap( GetBitmapValue() ); aURL = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( UNO_NAME_GRAPHOBJ_URLPREFIX)); aURL += ::rtl::OStringToOUString( - aLocalXOBitmap.GetGraphicObject().GetUniqueID(), + GetGraphicObject().GetUniqueID(), RTL_TEXTENCODING_ASCII_US); } 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 ) @@ -669,11 +346,10 @@ bool XFillBitmapItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 nM return true; } -//------------------------------------------------------------------------ +////////////////////////////////////////////////////////////////////////////// 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; @@ -719,47 +395,35 @@ bool XFillBitmapItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt } if( bSetURL ) { - GraphicObject aGrafObj( GraphicObject::CreateGraphicObjectFromURL( aURL ) ); - XOBitmap aBMP( aGrafObj ); - SetBitmapValue( aBMP ); + maGraphicObject = GraphicObject::CreateGraphicObjectFromURL(aURL); } if( bSetBitmap ) { - Bitmap aInput; - if ( xBmp.is() ) - { - BitmapEx aInputEx( VCLUnoHelper::GetBitmap( xBmp ) ); - aInput = aInputEx.GetBitmap(); - } - else if ( xGraphic.is() ) + if(xBmp.is()) { - Graphic aGraphic( xGraphic ); - aInput = aGraphic.GetBitmap(); + maGraphicObject = Graphic(VCLUnoHelper::GetBitmap(xBmp)); } - - // 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) + else if(xGraphic.is()) { - 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 ) @@ -772,7 +436,9 @@ 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; diff --git a/svx/source/xoutdev/xpool.cxx b/svx/source/xoutdev/xpool.cxx index 9b577b186bfd..5a04d3c38c3c 100644 --- a/svx/source/xoutdev/xpool.cxx +++ b/svx/source/xoutdev/xpool.cxx @@ -39,7 +39,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 )); @@ -85,7 +85,7 @@ XOutdevItemPool::XOutdevItemPool( mppLocalPoolDefaults[XATTR_FILLCOLOR -XATTR_START] = new XFillColorItem (aNullStr,aNullFillCol); mppLocalPoolDefaults[XATTR_FILLGRADIENT -XATTR_START] = new XFillGradientItem(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 891f793eb8d5..a3657018472d 100644 --- a/svx/source/xoutdev/xtabbtmp.cxx +++ b/svx/source/xoutdev/xtabbtmp.cxx @@ -27,6 +27,7 @@ #include <svx/dialmgr.hxx> #include <svx/xtable.hxx> #include <svx/xpool.hxx> +#include <svx/xbtmpit.hxx> using namespace com::sun::star; @@ -48,7 +49,6 @@ uno::Reference< container::XNameContainer > XBitmapList::createInstance() sal_Bool XBitmapList::Create() { - // Array der Bitmap //----------------------- // 00 01 02 03 04 05 06 07 // 08 09 10 11 12 13 14 15 @@ -58,31 +58,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; } |