Files
libreoffice/svx/source/xoutdev/xattrbmp.cxx

510 lines
14 KiB
C++
Raw Normal View History

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
re-base on ALv2 code. Includes: Patch contributed by Christian Lippka impress212: #i113063# patch: dubios self assign in svx/source/dialog/framelink.cxx http://svn.apache.org/viewvc?view=revision&revision=1167619 Patches contributed by Mathias Bauer gnumake4 work variously http://svn.apache.org/viewvc?view=revision&revision=1394707 http://svn.apache.org/viewvc?view=revision&revision=1394326 cws mba34issues01: #i117712#: fix several resource errors introduced by IAccessible2 implementation http://svn.apache.org/viewvc?view=revision&revision=1172343 cws mba34issues01: #i117719#: use correct resource ID http://svn.apache.org/viewvc?view=revision&revision=1172351 Patch contributed by Andre Fischer Do not add targets for junit tests when junit is disabled. http://svn.apache.org/viewvc?view=revision&revision=1241508 Patches contributed by Armin Le-Grand #118804# corrected GraphicExporter behaviour on shortcut when pixel graphic is requested http://svn.apache.org/viewvc?view=revision&revision=1240195 fix for #118525#: Using primitives for chart sub-geometry visualisation http://svn.apache.org/viewvc?view=revision&revision=1226879 #118485# - Styles for OLEs are not saved. http://svn.apache.org/viewvc?view=revision&revision=1182166 #118524: apply patch, followup fixes to 118485 http://svn.apache.org/viewvc?view=revision&revision=1186077 13f79535-47bb-0310-9956-ffa450edef68 Patch contributed by Regina Henschel linecap: Reintegrating finished LineCap feature http://svn.apache.org/viewvc?view=revision&revision=1232507 Patch contributed by Wang Lei (leiw) #i118760# split the first table cell vertically, then undo&redo, the Presentation app will crash http://svn.apache.org/viewvc?view=revision&revision=1301361 cleanup globlmn hacks, undo dependent fixmes.
2012-11-21 22:06:52 +00:00
/*
* 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 .
*/
2000-09-18 16:07:07 +00:00
#include <com/sun/star/awt/XBitmap.hpp>
#include <com/sun/star/graphic/XGraphic.hpp>
2000-09-18 16:07:07 +00:00
#include <tools/stream.hxx>
#include <vcl/window.hxx>
#include <vcl/virdev.hxx>
#include <vcl/bitmapex.hxx>
#include <toolkit/helper/vclunohelper.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/svdmodel.hxx>
#include <svx/xbitmap.hxx>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <vcl/salbtype.hxx>
#include <vcl/bitmapaccess.hxx>
Resolves: #i121504# Support for alpha channel in clipboard for all systems (cherry picked from commit ef3931ff410117e1237b3bef7bc090e8b83b9519) Conflicts: automation/source/server/statemnt.cxx basic/source/runtime/methods.cxx canvas/source/vcl/devicehelper.cxx canvas/source/vcl/spritedevicehelper.cxx drawinglayer/source/processor2d/vclhelperbufferdevice.cxx drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx drawinglayer/source/tools/converters.cxx dtrans/source/win32/dtobj/FmtFilter.cxx editeng/source/items/bulitem.cxx extensions/source/scanner/sanedlg.cxx external/gcc3_specific/makefile.mk filter/source/graphicfilter/eos2met/eos2met.cxx filter/source/graphicfilter/ios2met/ios2met.cxx filter/source/msfilter/msdffimp.cxx fpicker/source/office/iodlg.cxx framework/source/fwe/classes/addonsoptions.cxx framework/source/fwe/helper/actiontriggerhelper.cxx sc/source/filter/excel/xiescher.cxx sc/source/ui/docshell/docsh.cxx sc/source/ui/inc/viewfunc.hxx sd/source/ui/app/sdxfer.cxx sd/source/ui/unoidl/unopage.cxx sd/source/ui/view/sdview3.cxx sfx2/source/appl/fileobj.cxx sfx2/source/appl/linkmgr2.cxx sfx2/source/dialog/filedlghelper.cxx sfx2/source/dialog/intro.cxx sfx2/source/doc/docinf.cxx sot/inc/sot/formats.hxx sot/source/base/formats.cxx svtools/bmpmaker/bmpcore.cxx svtools/bmpmaker/bmpsum.cxx svtools/inc/svtools/transfer.hxx svtools/source/filter/filter.cxx svtools/source/filter/wmf/emfwr.cxx svtools/source/filter/wmf/enhwmf.cxx svtools/source/filter/wmf/winwmf.cxx svtools/source/filter/wmf/wmfwr.cxx svtools/source/graphic/graphic.cxx svtools/source/graphic/provider.cxx svtools/source/misc/transfer.cxx svx/inc/svx/xoutbmp.hxx svx/source/sdr/overlay/overlaymanagerbuffered.cxx svx/source/xoutdev/_xoutbmp.cxx sw/source/core/view/viewsh.cxx sw/source/filter/ww1/w1filter.cxx sw/source/filter/ww8/ww8par.hxx sw/source/ui/dochdl/swdtflvr.cxx toolkit/source/awt/vclxbitmap.cxx toolkit/source/helper/vclunohelper.cxx vcl/Library_vcl.mk vcl/Package_inc.mk vcl/aqua/source/dtrans/DataFlavorMapping.cxx vcl/aqua/source/dtrans/OSXTransferable.cxx vcl/aqua/source/dtrans/PictToBmpFlt.cxx vcl/aqua/source/dtrans/PictToBmpFlt.hxx vcl/inc/vcl/alpha.hxx vcl/inc/vcl/bitmap.hxx vcl/inc/vcl/bitmapex.hxx vcl/inc/vcl/pngwrite.hxx vcl/inc/vcl/salbtype.hxx vcl/inc/vcl/wall.hxx vcl/source/gdi/animate.cxx vcl/source/gdi/bitmap2.cxx vcl/source/gdi/bitmapex.cxx vcl/source/gdi/bmpconv.cxx vcl/source/gdi/cvtsvm.cxx vcl/source/gdi/impgraph.cxx vcl/source/gdi/impimagetree.cxx vcl/source/gdi/metaact.cxx vcl/source/gdi/wall.cxx Change-Id: I79938bc412c048c3d4e64f430f216e73bec16167
2013-01-10 16:28:40 +00:00
#include <vcl/dibtools.hxx>
#include <libxml/xmlwriter.h>
using namespace ::com::sun::star;
XOBitmap::XOBitmap( const Bitmap& rBmp ) :
xGraphicObject (new GraphicObject(rBmp)),
bGraphicDirty ( false )
{
}
XOBitmap::~XOBitmap()
{
}
Bitmap XOBitmap::GetBitmap() const
{
return GetGraphicObject().GetGraphic().GetBitmap();
}
const GraphicObject& XOBitmap::GetGraphicObject() const
{
if( bGraphicDirty )
const_cast<XOBitmap*>(this)->Array2Bitmap();
return *xGraphicObject;
}
void XOBitmap::Bitmap2Array()
{
ScopedVclPtrInstance< VirtualDevice > pVDev;
bool bPixelColor = false;
const Bitmap aBitmap( GetBitmap() );
const sal_Int32 nLines = 8; // type dependent
if( !pPixelArray )
pPixelArray.reset( new sal_uInt16[ nLines * nLines ] );
pVDev->SetOutputSizePixel( aBitmap.GetSizePixel() );
pVDev->DrawBitmap( Point(), aBitmap );
aPixelColor = aBckgrColor = pVDev->GetPixel( Point() );
// create array and determine foreground and background color
for (sal_Int32 i = 0; i < nLines; ++i)
{
for (sal_Int32 j = 0; j < nLines; ++j)
{
if ( pVDev->GetPixel( Point( j, i ) ) == aBckgrColor )
pPixelArray[ j + i * nLines ] = 0;
else
{
pPixelArray[ j + i * nLines ] = 1;
if( !bPixelColor )
{
aPixelColor = pVDev->GetPixel( Point( j, i ) );
bPixelColor = true;
}
}
}
}
}
/// convert array, fore- and background color into a bitmap
void XOBitmap::Array2Bitmap()
{
if (!pPixelArray)
return;
ScopedVclPtrInstance< VirtualDevice > pVDev;
const sal_Int32 nLines = 8; // type dependent
pVDev->SetOutputSizePixel( Size( nLines, nLines ) );
// create bitmap
for (sal_Int32 i = 0; i < nLines; ++i)
{
for (sal_Int32 j = 0; j < nLines; ++j)
{
if( pPixelArray[ j + i * nLines ] == 0 )
pVDev->DrawPixel( Point( j, i ), aBckgrColor );
else
pVDev->DrawPixel( Point( j, i ), aPixelColor );
}
}
xGraphicObject.reset(new GraphicObject(pVDev->GetBitmap(Point(), Size(nLines, nLines))));
bGraphicDirty = false;
}
SfxPoolItem* XFillBitmapItem::CreateDefault() { return new XFillBitmapItem; }
2000-09-18 16:07:07 +00:00
XFillBitmapItem::XFillBitmapItem(const OUString& rName, const GraphicObject& rGraphicObject)
: NameOrIndex(XATTR_FILLBITMAP, rName),
maGraphicObject(rGraphicObject)
2000-09-18 16:07:07 +00:00
{
}
XFillBitmapItem::XFillBitmapItem(const XFillBitmapItem& rItem)
: NameOrIndex(rItem),
maGraphicObject(rItem.maGraphicObject)
2000-09-18 16:07:07 +00:00
{
}
Bitmap createHistorical8x8FromArray(const sal_uInt16* pArray, Color aColorPix, Color aColorBack)
2000-09-18 16:07:07 +00:00
{
BitmapPalette aPalette(2);
2000-09-18 16:07:07 +00:00
aPalette[0] = BitmapColor(aColorBack);
aPalette[1] = BitmapColor(aColorPix);
2000-09-18 16:07:07 +00:00
Bitmap aBitmap(Size(8, 8), 1, &aPalette);
Bitmap::ScopedWriteAccess pContent(aBitmap);
2000-09-18 16:07:07 +00:00
if(pContent)
2000-09-18 16:07:07 +00:00
{
for(sal_uInt16 a(0); a < 8; a++)
2000-09-18 16:07:07 +00:00
{
for(sal_uInt16 b(0); b < 8; b++)
{
if(pArray[(a * 8) + b])
{
pContent->SetPixelIndex(a, b, 1);
}
else
{
pContent->SetPixelIndex(a, b, 0);
}
}
2000-09-18 16:07:07 +00:00
}
pContent.reset();
2000-09-18 16:07:07 +00:00
}
return aBitmap;
2000-09-18 16:07:07 +00:00
}
bool isHistorical8x8(const BitmapEx& rBitmapEx, BitmapColor& o_rBack, BitmapColor& o_rFront)
2000-09-18 16:07:07 +00:00
{
bool bRet(false);
if(!rBitmapEx.IsTransparent())
2000-09-18 16:07:07 +00:00
{
Bitmap aBitmap(rBitmapEx.GetBitmap());
2000-09-18 16:07:07 +00:00
if(8 == aBitmap.GetSizePixel().Width() && 8 == aBitmap.GetSizePixel().Height())
2000-09-18 16:07:07 +00:00
{
if(2 == aBitmap.GetColorCount())
2000-09-18 16:07:07 +00:00
{
BitmapReadAccess* pRead = aBitmap.AcquireReadAccess();
2000-09-18 16:07:07 +00:00
if(pRead)
{
if(pRead->HasPalette() && 2 == pRead->GetPaletteEntryCount())
{
const BitmapPalette& rPalette = pRead->GetPalette();
2000-09-18 16:07:07 +00:00
// #i123564# background and foreground were exchanged; of course
// rPalette[0] is the background color
o_rFront = rPalette[1];
o_rBack = rPalette[0];
2000-09-18 16:07:07 +00:00
bRet = true;
}
Bitmap::ReleaseAccess(pRead);
}
}
2000-09-18 16:07:07 +00:00
}
}
return bRet;
2000-09-18 16:07:07 +00:00
}
GraphicObject XFillBitmapItem::makeGraphicObject(SvStream& rIn, sal_uInt16 nVer) const
2000-09-18 16:07:07 +00:00
{
if (!IsIndex())
2000-09-18 16:07:07 +00:00
{
if(0 == nVer)
2000-09-18 16:07:07 +00:00
{
// work with the old bitmap
2000-09-18 16:07:07 +00:00
Bitmap aBmp;
Resolves: #i121504# Support for alpha channel in clipboard for all systems (cherry picked from commit ef3931ff410117e1237b3bef7bc090e8b83b9519) Conflicts: automation/source/server/statemnt.cxx basic/source/runtime/methods.cxx canvas/source/vcl/devicehelper.cxx canvas/source/vcl/spritedevicehelper.cxx drawinglayer/source/processor2d/vclhelperbufferdevice.cxx drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx drawinglayer/source/tools/converters.cxx dtrans/source/win32/dtobj/FmtFilter.cxx editeng/source/items/bulitem.cxx extensions/source/scanner/sanedlg.cxx external/gcc3_specific/makefile.mk filter/source/graphicfilter/eos2met/eos2met.cxx filter/source/graphicfilter/ios2met/ios2met.cxx filter/source/msfilter/msdffimp.cxx fpicker/source/office/iodlg.cxx framework/source/fwe/classes/addonsoptions.cxx framework/source/fwe/helper/actiontriggerhelper.cxx sc/source/filter/excel/xiescher.cxx sc/source/ui/docshell/docsh.cxx sc/source/ui/inc/viewfunc.hxx sd/source/ui/app/sdxfer.cxx sd/source/ui/unoidl/unopage.cxx sd/source/ui/view/sdview3.cxx sfx2/source/appl/fileobj.cxx sfx2/source/appl/linkmgr2.cxx sfx2/source/dialog/filedlghelper.cxx sfx2/source/dialog/intro.cxx sfx2/source/doc/docinf.cxx sot/inc/sot/formats.hxx sot/source/base/formats.cxx svtools/bmpmaker/bmpcore.cxx svtools/bmpmaker/bmpsum.cxx svtools/inc/svtools/transfer.hxx svtools/source/filter/filter.cxx svtools/source/filter/wmf/emfwr.cxx svtools/source/filter/wmf/enhwmf.cxx svtools/source/filter/wmf/winwmf.cxx svtools/source/filter/wmf/wmfwr.cxx svtools/source/graphic/graphic.cxx svtools/source/graphic/provider.cxx svtools/source/misc/transfer.cxx svx/inc/svx/xoutbmp.hxx svx/source/sdr/overlay/overlaymanagerbuffered.cxx svx/source/xoutdev/_xoutbmp.cxx sw/source/core/view/viewsh.cxx sw/source/filter/ww1/w1filter.cxx sw/source/filter/ww8/ww8par.hxx sw/source/ui/dochdl/swdtflvr.cxx toolkit/source/awt/vclxbitmap.cxx toolkit/source/helper/vclunohelper.cxx vcl/Library_vcl.mk vcl/Package_inc.mk vcl/aqua/source/dtrans/DataFlavorMapping.cxx vcl/aqua/source/dtrans/OSXTransferable.cxx vcl/aqua/source/dtrans/PictToBmpFlt.cxx vcl/aqua/source/dtrans/PictToBmpFlt.hxx vcl/inc/vcl/alpha.hxx vcl/inc/vcl/bitmap.hxx vcl/inc/vcl/bitmapex.hxx vcl/inc/vcl/pngwrite.hxx vcl/inc/vcl/salbtype.hxx vcl/inc/vcl/wall.hxx vcl/source/gdi/animate.cxx vcl/source/gdi/bitmap2.cxx vcl/source/gdi/bitmapex.cxx vcl/source/gdi/bmpconv.cxx vcl/source/gdi/cvtsvm.cxx vcl/source/gdi/impgraph.cxx vcl/source/gdi/impimagetree.cxx vcl/source/gdi/metaact.cxx vcl/source/gdi/wall.cxx Change-Id: I79938bc412c048c3d4e64f430f216e73bec16167
2013-01-10 16:28:40 +00:00
ReadDIB(aBmp, rIn, true);
return Graphic(aBmp);
2000-09-18 16:07:07 +00:00
}
else if(1 == nVer)
2000-09-18 16:07:07 +00:00
{
sal_Int16 iTmp;
2000-09-18 16:07:07 +00:00
rIn.ReadInt16( iTmp ); // former XBitmapStyle
rIn.ReadInt16( iTmp ); // XBitmapType
if(XBitmapType::Import == (XBitmapType)iTmp)
2000-09-18 16:07:07 +00:00
{
Bitmap aBmp;
Resolves: #i121504# Support for alpha channel in clipboard for all systems (cherry picked from commit ef3931ff410117e1237b3bef7bc090e8b83b9519) Conflicts: automation/source/server/statemnt.cxx basic/source/runtime/methods.cxx canvas/source/vcl/devicehelper.cxx canvas/source/vcl/spritedevicehelper.cxx drawinglayer/source/processor2d/vclhelperbufferdevice.cxx drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx drawinglayer/source/tools/converters.cxx dtrans/source/win32/dtobj/FmtFilter.cxx editeng/source/items/bulitem.cxx extensions/source/scanner/sanedlg.cxx external/gcc3_specific/makefile.mk filter/source/graphicfilter/eos2met/eos2met.cxx filter/source/graphicfilter/ios2met/ios2met.cxx filter/source/msfilter/msdffimp.cxx fpicker/source/office/iodlg.cxx framework/source/fwe/classes/addonsoptions.cxx framework/source/fwe/helper/actiontriggerhelper.cxx sc/source/filter/excel/xiescher.cxx sc/source/ui/docshell/docsh.cxx sc/source/ui/inc/viewfunc.hxx sd/source/ui/app/sdxfer.cxx sd/source/ui/unoidl/unopage.cxx sd/source/ui/view/sdview3.cxx sfx2/source/appl/fileobj.cxx sfx2/source/appl/linkmgr2.cxx sfx2/source/dialog/filedlghelper.cxx sfx2/source/dialog/intro.cxx sfx2/source/doc/docinf.cxx sot/inc/sot/formats.hxx sot/source/base/formats.cxx svtools/bmpmaker/bmpcore.cxx svtools/bmpmaker/bmpsum.cxx svtools/inc/svtools/transfer.hxx svtools/source/filter/filter.cxx svtools/source/filter/wmf/emfwr.cxx svtools/source/filter/wmf/enhwmf.cxx svtools/source/filter/wmf/winwmf.cxx svtools/source/filter/wmf/wmfwr.cxx svtools/source/graphic/graphic.cxx svtools/source/graphic/provider.cxx svtools/source/misc/transfer.cxx svx/inc/svx/xoutbmp.hxx svx/source/sdr/overlay/overlaymanagerbuffered.cxx svx/source/xoutdev/_xoutbmp.cxx sw/source/core/view/viewsh.cxx sw/source/filter/ww1/w1filter.cxx sw/source/filter/ww8/ww8par.hxx sw/source/ui/dochdl/swdtflvr.cxx toolkit/source/awt/vclxbitmap.cxx toolkit/source/helper/vclunohelper.cxx vcl/Library_vcl.mk vcl/Package_inc.mk vcl/aqua/source/dtrans/DataFlavorMapping.cxx vcl/aqua/source/dtrans/OSXTransferable.cxx vcl/aqua/source/dtrans/PictToBmpFlt.cxx vcl/aqua/source/dtrans/PictToBmpFlt.hxx vcl/inc/vcl/alpha.hxx vcl/inc/vcl/bitmap.hxx vcl/inc/vcl/bitmapex.hxx vcl/inc/vcl/pngwrite.hxx vcl/inc/vcl/salbtype.hxx vcl/inc/vcl/wall.hxx vcl/source/gdi/animate.cxx vcl/source/gdi/bitmap2.cxx vcl/source/gdi/bitmapex.cxx vcl/source/gdi/bmpconv.cxx vcl/source/gdi/cvtsvm.cxx vcl/source/gdi/impgraph.cxx vcl/source/gdi/impimagetree.cxx vcl/source/gdi/metaact.cxx vcl/source/gdi/wall.cxx Change-Id: I79938bc412c048c3d4e64f430f216e73bec16167
2013-01-10 16:28:40 +00:00
ReadDIB(aBmp, rIn, true);
return Graphic(aBmp);
2000-09-18 16:07:07 +00:00
}
else if(XBitmapType::N8x8 == (XBitmapType)iTmp)
2000-09-18 16:07:07 +00:00
{
sal_uInt16 aArray[64];
for(sal_uInt16 & i : aArray)
{
rIn.ReadUInt16( i );
}
Color aColorPix;
Color aColorBack;
2000-09-18 16:07:07 +00:00
ReadColor( rIn, aColorPix );
ReadColor( rIn, aColorBack );
2000-09-18 16:07:07 +00:00
const Bitmap aBitmap(createHistorical8x8FromArray(aArray, aColorPix, aColorBack));
2000-09-18 16:07:07 +00:00
return Graphic(aBitmap);
2000-09-18 16:07:07 +00:00
}
}
else if(2 == nVer)
{
BitmapEx aBmpEx;
2000-12-14 15:18:59 +00:00
Resolves: #i121504# Support for alpha channel in clipboard for all systems (cherry picked from commit ef3931ff410117e1237b3bef7bc090e8b83b9519) Conflicts: automation/source/server/statemnt.cxx basic/source/runtime/methods.cxx canvas/source/vcl/devicehelper.cxx canvas/source/vcl/spritedevicehelper.cxx drawinglayer/source/processor2d/vclhelperbufferdevice.cxx drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx drawinglayer/source/tools/converters.cxx dtrans/source/win32/dtobj/FmtFilter.cxx editeng/source/items/bulitem.cxx extensions/source/scanner/sanedlg.cxx external/gcc3_specific/makefile.mk filter/source/graphicfilter/eos2met/eos2met.cxx filter/source/graphicfilter/ios2met/ios2met.cxx filter/source/msfilter/msdffimp.cxx fpicker/source/office/iodlg.cxx framework/source/fwe/classes/addonsoptions.cxx framework/source/fwe/helper/actiontriggerhelper.cxx sc/source/filter/excel/xiescher.cxx sc/source/ui/docshell/docsh.cxx sc/source/ui/inc/viewfunc.hxx sd/source/ui/app/sdxfer.cxx sd/source/ui/unoidl/unopage.cxx sd/source/ui/view/sdview3.cxx sfx2/source/appl/fileobj.cxx sfx2/source/appl/linkmgr2.cxx sfx2/source/dialog/filedlghelper.cxx sfx2/source/dialog/intro.cxx sfx2/source/doc/docinf.cxx sot/inc/sot/formats.hxx sot/source/base/formats.cxx svtools/bmpmaker/bmpcore.cxx svtools/bmpmaker/bmpsum.cxx svtools/inc/svtools/transfer.hxx svtools/source/filter/filter.cxx svtools/source/filter/wmf/emfwr.cxx svtools/source/filter/wmf/enhwmf.cxx svtools/source/filter/wmf/winwmf.cxx svtools/source/filter/wmf/wmfwr.cxx svtools/source/graphic/graphic.cxx svtools/source/graphic/provider.cxx svtools/source/misc/transfer.cxx svx/inc/svx/xoutbmp.hxx svx/source/sdr/overlay/overlaymanagerbuffered.cxx svx/source/xoutdev/_xoutbmp.cxx sw/source/core/view/viewsh.cxx sw/source/filter/ww1/w1filter.cxx sw/source/filter/ww8/ww8par.hxx sw/source/ui/dochdl/swdtflvr.cxx toolkit/source/awt/vclxbitmap.cxx toolkit/source/helper/vclunohelper.cxx vcl/Library_vcl.mk vcl/Package_inc.mk vcl/aqua/source/dtrans/DataFlavorMapping.cxx vcl/aqua/source/dtrans/OSXTransferable.cxx vcl/aqua/source/dtrans/PictToBmpFlt.cxx vcl/aqua/source/dtrans/PictToBmpFlt.hxx vcl/inc/vcl/alpha.hxx vcl/inc/vcl/bitmap.hxx vcl/inc/vcl/bitmapex.hxx vcl/inc/vcl/pngwrite.hxx vcl/inc/vcl/salbtype.hxx vcl/inc/vcl/wall.hxx vcl/source/gdi/animate.cxx vcl/source/gdi/bitmap2.cxx vcl/source/gdi/bitmapex.cxx vcl/source/gdi/bmpconv.cxx vcl/source/gdi/cvtsvm.cxx vcl/source/gdi/impgraph.cxx vcl/source/gdi/impimagetree.cxx vcl/source/gdi/metaact.cxx vcl/source/gdi/wall.cxx Change-Id: I79938bc412c048c3d4e64f430f216e73bec16167
2013-01-10 16:28:40 +00:00
ReadDIBBitmapEx(aBmpEx, rIn);
return Graphic(aBmpEx);
}
}
return GraphicObject();
}
XFillBitmapItem::XFillBitmapItem(SvStream& rIn, sal_uInt16 nVer)
: NameOrIndex(XATTR_FILLBITMAP, rIn)
, maGraphicObject(makeGraphicObject(rIn, nVer))
{
2000-09-18 16:07:07 +00:00
}
XFillBitmapItem::XFillBitmapItem(const GraphicObject& rGraphicObject)
: NameOrIndex(XATTR_FILLBITMAP, -1)
, maGraphicObject(rGraphicObject)
2000-10-12 10:54:52 +00:00
{
}
SfxPoolItem* XFillBitmapItem::Clone(SfxItemPool* /*pPool*/) const
2000-09-18 16:07:07 +00:00
{
return new XFillBitmapItem(*this);
}
bool XFillBitmapItem::operator==(const SfxPoolItem& rItem) const
2000-09-18 16:07:07 +00:00
{
return (NameOrIndex::operator==(rItem)
&& maGraphicObject == static_cast<const XFillBitmapItem&>(rItem).maGraphicObject);
2000-09-18 16:07:07 +00:00
}
SfxPoolItem* XFillBitmapItem::Create(SvStream& rIn, sal_uInt16 nVer) const
2000-09-18 16:07:07 +00:00
{
return new XFillBitmapItem( rIn, nVer );
}
SvStream& XFillBitmapItem::Store( SvStream& rOut, sal_uInt16 nItemVersion ) const
2000-09-18 16:07:07 +00:00
{
NameOrIndex::Store(rOut, nItemVersion);
2000-09-18 16:07:07 +00:00
if(!IsIndex())
2000-09-18 16:07:07 +00:00
{
Resolves: #i121504# Support for alpha channel in clipboard for all systems (cherry picked from commit ef3931ff410117e1237b3bef7bc090e8b83b9519) Conflicts: automation/source/server/statemnt.cxx basic/source/runtime/methods.cxx canvas/source/vcl/devicehelper.cxx canvas/source/vcl/spritedevicehelper.cxx drawinglayer/source/processor2d/vclhelperbufferdevice.cxx drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx drawinglayer/source/tools/converters.cxx dtrans/source/win32/dtobj/FmtFilter.cxx editeng/source/items/bulitem.cxx extensions/source/scanner/sanedlg.cxx external/gcc3_specific/makefile.mk filter/source/graphicfilter/eos2met/eos2met.cxx filter/source/graphicfilter/ios2met/ios2met.cxx filter/source/msfilter/msdffimp.cxx fpicker/source/office/iodlg.cxx framework/source/fwe/classes/addonsoptions.cxx framework/source/fwe/helper/actiontriggerhelper.cxx sc/source/filter/excel/xiescher.cxx sc/source/ui/docshell/docsh.cxx sc/source/ui/inc/viewfunc.hxx sd/source/ui/app/sdxfer.cxx sd/source/ui/unoidl/unopage.cxx sd/source/ui/view/sdview3.cxx sfx2/source/appl/fileobj.cxx sfx2/source/appl/linkmgr2.cxx sfx2/source/dialog/filedlghelper.cxx sfx2/source/dialog/intro.cxx sfx2/source/doc/docinf.cxx sot/inc/sot/formats.hxx sot/source/base/formats.cxx svtools/bmpmaker/bmpcore.cxx svtools/bmpmaker/bmpsum.cxx svtools/inc/svtools/transfer.hxx svtools/source/filter/filter.cxx svtools/source/filter/wmf/emfwr.cxx svtools/source/filter/wmf/enhwmf.cxx svtools/source/filter/wmf/winwmf.cxx svtools/source/filter/wmf/wmfwr.cxx svtools/source/graphic/graphic.cxx svtools/source/graphic/provider.cxx svtools/source/misc/transfer.cxx svx/inc/svx/xoutbmp.hxx svx/source/sdr/overlay/overlaymanagerbuffered.cxx svx/source/xoutdev/_xoutbmp.cxx sw/source/core/view/viewsh.cxx sw/source/filter/ww1/w1filter.cxx sw/source/filter/ww8/ww8par.hxx sw/source/ui/dochdl/swdtflvr.cxx toolkit/source/awt/vclxbitmap.cxx toolkit/source/helper/vclunohelper.cxx vcl/Library_vcl.mk vcl/Package_inc.mk vcl/aqua/source/dtrans/DataFlavorMapping.cxx vcl/aqua/source/dtrans/OSXTransferable.cxx vcl/aqua/source/dtrans/PictToBmpFlt.cxx vcl/aqua/source/dtrans/PictToBmpFlt.hxx vcl/inc/vcl/alpha.hxx vcl/inc/vcl/bitmap.hxx vcl/inc/vcl/bitmapex.hxx vcl/inc/vcl/pngwrite.hxx vcl/inc/vcl/salbtype.hxx vcl/inc/vcl/wall.hxx vcl/source/gdi/animate.cxx vcl/source/gdi/bitmap2.cxx vcl/source/gdi/bitmapex.cxx vcl/source/gdi/bmpconv.cxx vcl/source/gdi/cvtsvm.cxx vcl/source/gdi/impgraph.cxx vcl/source/gdi/impimagetree.cxx vcl/source/gdi/metaact.cxx vcl/source/gdi/wall.cxx Change-Id: I79938bc412c048c3d4e64f430f216e73bec16167
2013-01-10 16:28:40 +00:00
WriteDIBBitmapEx(maGraphicObject.GetGraphic().GetBitmapEx(), rOut);
2000-09-18 16:07:07 +00:00
}
return rOut;
}
bool XFillBitmapItem::isPattern() const
{
BitmapColor aBack, aFront;
return isHistorical8x8(GetGraphicObject().GetGraphic().GetBitmap(), aBack, aFront);
}
sal_uInt16 XFillBitmapItem::GetVersion(sal_uInt16 /*nFileFormatVersion*/) const
2000-09-18 16:07:07 +00:00
{
return 2;
2000-09-18 16:07:07 +00:00
}
bool XFillBitmapItem::GetPresentation(
SfxItemPresentation /*ePres*/,
MapUnit /*eCoreUnit*/,
MapUnit /*ePresUnit*/,
OUString& rText,
const IntlWrapper*) const
2000-09-18 16:07:07 +00:00
{
rText += GetName();
return true;
2000-09-18 16:07:07 +00:00
}
bool XFillBitmapItem::QueryValue(css::uno::Any& rVal, sal_uInt8 nMemberId) const
2000-09-18 16:07:07 +00:00
{
2002-05-22 11:05:15 +00:00
nMemberId &= ~CONVERT_TWIPS;
// needed for MID_NAME
OUString aApiName;
// needed for complete item (MID 0)
OUString aInternalName;
OUString aURL;
css::uno::Reference< css::awt::XBitmap > xBmp;
2000-09-18 16:07:07 +00:00
if( nMemberId == MID_NAME )
{
aApiName = SvxUnogetApiNameForItem(Which(), GetName());
2000-09-18 16:07:07 +00:00
}
else if( nMemberId == 0 )
2000-09-18 16:07:07 +00:00
{
aInternalName = GetName();
2000-09-18 16:07:07 +00:00
}
if( nMemberId == MID_GRAFURL ||
nMemberId == 0 )
{
aURL = UNO_NAME_GRAPHOBJ_URLPREFIX;
aURL += OStringToOUString(
GetGraphicObject().GetUniqueID(),
2011-09-22 09:02:16 +01:00
RTL_TEXTENCODING_ASCII_US);
}
if( nMemberId == MID_BITMAP ||
nMemberId == 0 )
2000-09-18 16:07:07 +00:00
{
xBmp.set(VCLUnoHelper::CreateBitmap(GetGraphicObject().GetGraphic().GetBitmapEx()));
}
2000-09-18 16:07:07 +00:00
if( nMemberId == MID_NAME )
rVal <<= aApiName;
else if( nMemberId == MID_GRAFURL )
rVal <<= aURL;
else if( nMemberId == MID_BITMAP )
2000-09-18 16:07:07 +00:00
rVal <<= xBmp;
else
{
// member-id 0 => complete item (e.g. for toolbars)
DBG_ASSERT( nMemberId == 0, "invalid member-id" );
uno::Sequence< beans::PropertyValue > aPropSeq( 3 );
aPropSeq[0].Name = "Name";
aPropSeq[0].Value <<= aInternalName;
aPropSeq[1].Name = "FillBitmapURL";
aPropSeq[1].Value <<= aURL;
aPropSeq[2].Name = "Bitmap";
aPropSeq[2].Value <<= xBmp;
rVal <<= aPropSeq;
2000-09-18 16:07:07 +00:00
}
2010-10-04 15:23:49 +01:00
return true;
2000-09-18 16:07:07 +00:00
}
bool XFillBitmapItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId )
2000-09-18 16:07:07 +00:00
{
2002-05-22 11:05:15 +00:00
nMemberId &= ~CONVERT_TWIPS;
OUString aName;
OUString aURL;
css::uno::Reference< css::awt::XBitmap > xBmp;
css::uno::Reference< css::graphic::XGraphic > xGraphic;
bool bSetName = false;
bool bSetURL = false;
bool bSetBitmap = false;
2000-09-18 16:07:07 +00:00
if( nMemberId == MID_NAME )
bSetName = (rVal >>= aName);
else if( nMemberId == MID_GRAFURL )
bSetURL = (rVal >>= aURL);
else if( nMemberId == MID_BITMAP )
{
bSetBitmap = (rVal >>= xBmp);
if ( !bSetBitmap )
bSetBitmap = (rVal >>= xGraphic );
}
else
2000-09-18 16:07:07 +00:00
{
DBG_ASSERT( nMemberId == 0, "invalid member-id" );
uno::Sequence< beans::PropertyValue > aPropSeq;
if( rVal >>= aPropSeq )
2000-09-18 16:07:07 +00:00
{
for ( sal_Int32 n = 0; n < aPropSeq.getLength(); n++ )
{
if ( aPropSeq[n].Name == "Name" )
bSetName = (aPropSeq[n].Value >>= aName);
else if ( aPropSeq[n].Name == "FillBitmapURL" )
bSetURL = (aPropSeq[n].Value >>= aURL);
else if ( aPropSeq[n].Name == "Bitmap" )
bSetBitmap = (aPropSeq[n].Value >>= xBmp);
}
2000-09-18 16:07:07 +00:00
}
}
if( bSetName )
2000-09-18 16:07:07 +00:00
{
SetName( aName );
2000-09-18 16:07:07 +00:00
}
if( bSetURL )
2000-09-18 16:07:07 +00:00
{
GraphicObject aGraphicObject = GraphicObject::CreateGraphicObjectFromURL(aURL);
if( aGraphicObject.GetType() != GraphicType::NONE )
maGraphicObject = aGraphicObject;
Resolves: #i121194# Better support for graphic fill styles... which are not bitmaps (svg, metafiles, ..) (cherry picked from commit 7a652a2b2ab5e0d37e32185c8c5fac3af482bb76) Conflicts: drawinglayer/Library_drawinglayer.mk drawinglayer/Package_inc.mk drawinglayer/inc/drawinglayer/attribute/fillgraphicattribute.hxx drawinglayer/inc/drawinglayer/attribute/sdrfillattribute.hxx drawinglayer/inc/drawinglayer/attribute/sdrfillgraphicattribute.hxx drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx drawinglayer/inc/drawinglayer/primitive2d/fillgraphicprimitive2d.hxx drawinglayer/inc/drawinglayer/primitive2d/polypolygonprimitive2d.hxx drawinglayer/inc/drawinglayer/primitive3d/textureprimitive3d.hxx drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx drawinglayer/inc/drawinglayer/texture/texture.hxx drawinglayer/inc/drawinglayer/texture/texture3d.hxx drawinglayer/source/attribute/fillbitmapattribute.cxx drawinglayer/source/attribute/sdrfillattribute.cxx drawinglayer/source/attribute/sdrfillgraphicattribute.cxx drawinglayer/source/primitive2d/fillbitmapprimitive2d.cxx drawinglayer/source/primitive2d/graphicprimitive2d.cxx drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx drawinglayer/source/processor2d/canvasprocessor.cxx svx/inc/svx/sdr/primitive2d/sdrattributecreator.hxx svx/source/sdr/contact/objectcontacttools.cxx vcl/inc/vcl/graph.hxx unused file _vclmetafileprocessor2d.cxx deleted, was added by error (cherry picked from commit ed0d53f8283cd3ce579a90b599118884d0db6119) Conflicts: drawinglayer/source/processor2d/_vclmetafileprocessor2d.cxx Corrected canvasProcessor usage (cherry picked from commit 7903c33f31c457eb6ff506958c4233f2a5d39bcf) Conflicts: svx/source/sdr/contact/objectcontacttools.cxx Change-Id: I80008050b98dafc92fde043524843c13a75fe22c d2fa667d7c127b4d735334e56093d1d4553b0a5b e20c60c7d6472da1295a162d9a629be998861f62
2012-10-16 08:44:02 +00:00
// #121194# Prefer GraphicObject over bitmap object if both are provided
if(bSetBitmap && GraphicType::NONE != maGraphicObject.GetType())
Resolves: #i121194# Better support for graphic fill styles... which are not bitmaps (svg, metafiles, ..) (cherry picked from commit 7a652a2b2ab5e0d37e32185c8c5fac3af482bb76) Conflicts: drawinglayer/Library_drawinglayer.mk drawinglayer/Package_inc.mk drawinglayer/inc/drawinglayer/attribute/fillgraphicattribute.hxx drawinglayer/inc/drawinglayer/attribute/sdrfillattribute.hxx drawinglayer/inc/drawinglayer/attribute/sdrfillgraphicattribute.hxx drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx drawinglayer/inc/drawinglayer/primitive2d/fillgraphicprimitive2d.hxx drawinglayer/inc/drawinglayer/primitive2d/polypolygonprimitive2d.hxx drawinglayer/inc/drawinglayer/primitive3d/textureprimitive3d.hxx drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx drawinglayer/inc/drawinglayer/texture/texture.hxx drawinglayer/inc/drawinglayer/texture/texture3d.hxx drawinglayer/source/attribute/fillbitmapattribute.cxx drawinglayer/source/attribute/sdrfillattribute.cxx drawinglayer/source/attribute/sdrfillgraphicattribute.cxx drawinglayer/source/primitive2d/fillbitmapprimitive2d.cxx drawinglayer/source/primitive2d/graphicprimitive2d.cxx drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx drawinglayer/source/processor2d/canvasprocessor.cxx svx/inc/svx/sdr/primitive2d/sdrattributecreator.hxx svx/source/sdr/contact/objectcontacttools.cxx vcl/inc/vcl/graph.hxx unused file _vclmetafileprocessor2d.cxx deleted, was added by error (cherry picked from commit ed0d53f8283cd3ce579a90b599118884d0db6119) Conflicts: drawinglayer/source/processor2d/_vclmetafileprocessor2d.cxx Corrected canvasProcessor usage (cherry picked from commit 7903c33f31c457eb6ff506958c4233f2a5d39bcf) Conflicts: svx/source/sdr/contact/objectcontacttools.cxx Change-Id: I80008050b98dafc92fde043524843c13a75fe22c d2fa667d7c127b4d735334e56093d1d4553b0a5b e20c60c7d6472da1295a162d9a629be998861f62
2012-10-16 08:44:02 +00:00
{
bSetBitmap = false;
}
}
if( bSetBitmap )
{
if(xBmp.is())
{
maGraphicObject.SetGraphic(VCLUnoHelper::GetBitmap(xBmp));
}
else if(xGraphic.is())
{
maGraphicObject.SetGraphic(xGraphic);
2000-09-18 16:07:07 +00:00
}
}
return (bSetName || bSetURL || bSetBitmap);
2000-09-18 16:07:07 +00:00
}
bool XFillBitmapItem::CompareValueFunc( const NameOrIndex* p1, const NameOrIndex* p2 )
{
const GraphicObject& aGraphicObjectA(static_cast<const XFillBitmapItem*>(p1)->GetGraphicObject());
const GraphicObject& aGraphicObjectB(static_cast<const XFillBitmapItem*>(p2)->GetGraphicObject());
return aGraphicObjectA == aGraphicObjectB;
}
2000-09-18 16:07:07 +00:00
XFillBitmapItem* XFillBitmapItem::checkForUniqueItem( SdrModel* pModel ) const
{
if( pModel )
{
XPropertyListType aListType = XPropertyListType::Bitmap;
if(isPattern())
aListType = XPropertyListType::Pattern;
const OUString aUniqueName = NameOrIndex::CheckNamedItem(
this, XATTR_FILLBITMAP, &pModel->GetItemPool(),
pModel->GetStyleSheetPool() ? &pModel->GetStyleSheetPool()->GetPool() : nullptr,
XFillBitmapItem::CompareValueFunc, RID_SVXSTR_BMP21,
pModel->GetPropertyList( aListType ) );
// if the given name is not valid, replace it!
if( aUniqueName != GetName() )
{
return new XFillBitmapItem(aUniqueName, maGraphicObject);
}
}
2000-09-18 16:07:07 +00:00
return nullptr;
}
void XFillBitmapItem::dumpAsXml(xmlTextWriterPtr pWriter) const
{
xmlTextWriterStartElement(pWriter, BAD_CAST("XFillBitmapItem"));
xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr()));
NameOrIndex::dumpAsXml(pWriter);
xmlTextWriterEndElement(pWriter);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */