Files
libreoffice/svtools/source/misc/transfer.cxx

2352 lines
71 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: Jurgen Schmidt remove onlineregistration with dependencies http://svn.apache.org/viewvc?view=revision&revision=1240245 imported patch package_eventlistener.patch http://svn.apache.org/viewvc?view=revision&revision=1172103 Patch contributed by Pedro Giffuni Accept Google Chrome OS fonts as equivalent to MS fonts. http://svn.apache.org/viewvc?view=revision&revision=1233155 http://svn.apache.org/viewvc?view=revision&revision=1233408 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 Mathias Bauer (and others) gnumake4 work variously http://svn.apache.org/viewvc?view=revision&revision=1394707 http://svn.apache.org/viewvc?view=revision&revision=1394326 cws mba34issues01: #i114600#: remove forbidden characters from list of unencoded characters http://svn.apache.org/viewvc?view=revision&revision=1172370 Patches contributed by Oliver Rainer-Wittman some clean up in JPEGReader due to memory constraints http://svn.apache.org/viewvc?view=revision&revision=1299729 119114 - method <UpdateDialog::addSpecificError(..)> - create entry with correct type http://svn.apache.org/viewvc?view=revision&revision=1305265 Patches contributed by Ariel Constenla-Haile i118707 - make toolbar control's popup window grab focus http://svn.apache.org/viewvc?view=revision&revision=1225846 Patches contributed by Herbert Duerr #i118662# remove usage of BerkeleyDB in desktop module http://svn.apache.org/viewvc?view=revision&revision=1213171 minor cleanups in dp_persmap.* http://svn.apache.org/viewvc?view=revision&revision=1215064 flush early to prevent problem with extension manager not cleaning up its objects http://svn.apache.org/viewvc?view=revision&revision=1228147 i118726 do not flush *pmap file while reading it http://svn.apache.org/viewvc?view=revision&revision=1230614 #i119048# migrate BDB extension entries using a simple heuristic http://svn.apache.org/viewvc?view=revision&revision=1300972 #i119048# handle edge cases when importing BDB hash files http://svn.apache.org/viewvc?view=revision&revision=1301428 #i119113# fix of-by-one when importing BDB files http://svn.apache.org/viewvc?view=revision&revision=1305420 restore our encryption settings, icon themes, and dictionaries. removed wrapper hacks, kill obsolete bundled extension blob / pre-registration handling, remove duplicated quickstart code. remove OS/2 conditionals.
2012-11-15 17:28:16 +00:00
/*
* This file is part of the LibreOffice project.
2001-01-19 17:23:13 +00:00
*
re-base on ALv2 code. Includes: Patch contributed by: Jurgen Schmidt remove onlineregistration with dependencies http://svn.apache.org/viewvc?view=revision&revision=1240245 imported patch package_eventlistener.patch http://svn.apache.org/viewvc?view=revision&revision=1172103 Patch contributed by Pedro Giffuni Accept Google Chrome OS fonts as equivalent to MS fonts. http://svn.apache.org/viewvc?view=revision&revision=1233155 http://svn.apache.org/viewvc?view=revision&revision=1233408 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 Mathias Bauer (and others) gnumake4 work variously http://svn.apache.org/viewvc?view=revision&revision=1394707 http://svn.apache.org/viewvc?view=revision&revision=1394326 cws mba34issues01: #i114600#: remove forbidden characters from list of unencoded characters http://svn.apache.org/viewvc?view=revision&revision=1172370 Patches contributed by Oliver Rainer-Wittman some clean up in JPEGReader due to memory constraints http://svn.apache.org/viewvc?view=revision&revision=1299729 119114 - method <UpdateDialog::addSpecificError(..)> - create entry with correct type http://svn.apache.org/viewvc?view=revision&revision=1305265 Patches contributed by Ariel Constenla-Haile i118707 - make toolbar control's popup window grab focus http://svn.apache.org/viewvc?view=revision&revision=1225846 Patches contributed by Herbert Duerr #i118662# remove usage of BerkeleyDB in desktop module http://svn.apache.org/viewvc?view=revision&revision=1213171 minor cleanups in dp_persmap.* http://svn.apache.org/viewvc?view=revision&revision=1215064 flush early to prevent problem with extension manager not cleaning up its objects http://svn.apache.org/viewvc?view=revision&revision=1228147 i118726 do not flush *pmap file while reading it http://svn.apache.org/viewvc?view=revision&revision=1230614 #i119048# migrate BDB extension entries using a simple heuristic http://svn.apache.org/viewvc?view=revision&revision=1300972 #i119048# handle edge cases when importing BDB hash files http://svn.apache.org/viewvc?view=revision&revision=1301428 #i119113# fix of-by-one when importing BDB files http://svn.apache.org/viewvc?view=revision&revision=1305420 restore our encryption settings, icon themes, and dictionaries. removed wrapper hacks, kill obsolete bundled extension blob / pre-registration handling, remove duplicated quickstart code. remove OS/2 conditionals.
2012-11-15 17:28:16 +00:00
* 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/.
2001-01-19 17:23:13 +00:00
*
re-base on ALv2 code. Includes: Patch contributed by: Jurgen Schmidt remove onlineregistration with dependencies http://svn.apache.org/viewvc?view=revision&revision=1240245 imported patch package_eventlistener.patch http://svn.apache.org/viewvc?view=revision&revision=1172103 Patch contributed by Pedro Giffuni Accept Google Chrome OS fonts as equivalent to MS fonts. http://svn.apache.org/viewvc?view=revision&revision=1233155 http://svn.apache.org/viewvc?view=revision&revision=1233408 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 Mathias Bauer (and others) gnumake4 work variously http://svn.apache.org/viewvc?view=revision&revision=1394707 http://svn.apache.org/viewvc?view=revision&revision=1394326 cws mba34issues01: #i114600#: remove forbidden characters from list of unencoded characters http://svn.apache.org/viewvc?view=revision&revision=1172370 Patches contributed by Oliver Rainer-Wittman some clean up in JPEGReader due to memory constraints http://svn.apache.org/viewvc?view=revision&revision=1299729 119114 - method <UpdateDialog::addSpecificError(..)> - create entry with correct type http://svn.apache.org/viewvc?view=revision&revision=1305265 Patches contributed by Ariel Constenla-Haile i118707 - make toolbar control's popup window grab focus http://svn.apache.org/viewvc?view=revision&revision=1225846 Patches contributed by Herbert Duerr #i118662# remove usage of BerkeleyDB in desktop module http://svn.apache.org/viewvc?view=revision&revision=1213171 minor cleanups in dp_persmap.* http://svn.apache.org/viewvc?view=revision&revision=1215064 flush early to prevent problem with extension manager not cleaning up its objects http://svn.apache.org/viewvc?view=revision&revision=1228147 i118726 do not flush *pmap file while reading it http://svn.apache.org/viewvc?view=revision&revision=1230614 #i119048# migrate BDB extension entries using a simple heuristic http://svn.apache.org/viewvc?view=revision&revision=1300972 #i119048# handle edge cases when importing BDB hash files http://svn.apache.org/viewvc?view=revision&revision=1301428 #i119113# fix of-by-one when importing BDB files http://svn.apache.org/viewvc?view=revision&revision=1305420 restore our encryption settings, icon themes, and dictionaries. removed wrapper hacks, kill obsolete bundled extension blob / pre-registration handling, remove duplicated quickstart code. remove OS/2 conditionals.
2012-11-15 17:28:16 +00:00
* This file incorporates work covered by the following license notice:
2001-01-19 17:23:13 +00:00
*
re-base on ALv2 code. Includes: Patch contributed by: Jurgen Schmidt remove onlineregistration with dependencies http://svn.apache.org/viewvc?view=revision&revision=1240245 imported patch package_eventlistener.patch http://svn.apache.org/viewvc?view=revision&revision=1172103 Patch contributed by Pedro Giffuni Accept Google Chrome OS fonts as equivalent to MS fonts. http://svn.apache.org/viewvc?view=revision&revision=1233155 http://svn.apache.org/viewvc?view=revision&revision=1233408 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 Mathias Bauer (and others) gnumake4 work variously http://svn.apache.org/viewvc?view=revision&revision=1394707 http://svn.apache.org/viewvc?view=revision&revision=1394326 cws mba34issues01: #i114600#: remove forbidden characters from list of unencoded characters http://svn.apache.org/viewvc?view=revision&revision=1172370 Patches contributed by Oliver Rainer-Wittman some clean up in JPEGReader due to memory constraints http://svn.apache.org/viewvc?view=revision&revision=1299729 119114 - method <UpdateDialog::addSpecificError(..)> - create entry with correct type http://svn.apache.org/viewvc?view=revision&revision=1305265 Patches contributed by Ariel Constenla-Haile i118707 - make toolbar control's popup window grab focus http://svn.apache.org/viewvc?view=revision&revision=1225846 Patches contributed by Herbert Duerr #i118662# remove usage of BerkeleyDB in desktop module http://svn.apache.org/viewvc?view=revision&revision=1213171 minor cleanups in dp_persmap.* http://svn.apache.org/viewvc?view=revision&revision=1215064 flush early to prevent problem with extension manager not cleaning up its objects http://svn.apache.org/viewvc?view=revision&revision=1228147 i118726 do not flush *pmap file while reading it http://svn.apache.org/viewvc?view=revision&revision=1230614 #i119048# migrate BDB extension entries using a simple heuristic http://svn.apache.org/viewvc?view=revision&revision=1300972 #i119048# handle edge cases when importing BDB hash files http://svn.apache.org/viewvc?view=revision&revision=1301428 #i119113# fix of-by-one when importing BDB files http://svn.apache.org/viewvc?view=revision&revision=1305420 restore our encryption settings, icon themes, and dictionaries. removed wrapper hacks, kill obsolete bundled extension blob / pre-registration handling, remove duplicated quickstart code. remove OS/2 conditionals.
2012-11-15 17:28:16 +00:00
* 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 .
*/
2001-01-19 17:23:13 +00:00
#ifdef WNT
#include <prewin.h>
#include <postwin.h>
2001-01-19 17:23:13 +00:00
#include <shlobj.h>
#endif
#include <osl/mutex.hxx>
#include <rtl/uri.hxx>
2001-01-19 17:23:13 +00:00
#include <tools/debug.hxx>
#include <tools/urlobj.hxx>
#include <unotools/ucbstreamhelper.hxx>
2001-01-19 17:23:13 +00:00
#include <sot/exchange.hxx>
#include <sot/storage.hxx>
#include <vcl/bitmap.hxx>
#include <vcl/gdimtf.hxx>
#include <vcl/graph.hxx>
2001-03-16 16:47:03 +00:00
#include <vcl/cvtgrf.hxx>
2001-01-19 17:23:13 +00:00
#include <vcl/svapp.hxx>
2001-02-26 11:58:36 +00:00
#include <vcl/window.hxx>
2001-01-19 17:23:13 +00:00
#include <comphelper/processfactory.hxx>
2011-06-01 10:02:08 +01:00
#include <comphelper/servicehelper.hxx>
#include <sot/filelist.hxx>
#include <cppuhelper/implbase1.hxx>
2001-01-19 17:23:13 +00:00
#include <comphelper/seqstream.hxx>
#include <com/sun/star/datatransfer/clipboard/XClipboardNotifier.hpp>
2001-03-07 11:32:20 +00:00
#include <com/sun/star/datatransfer/clipboard/XFlushableClipboard.hpp>
#include <com/sun/star/datatransfer/MimeContentTypeFactory.hpp>
2001-09-25 09:12:13 +00:00
#include <com/sun/star/datatransfer/XMimeContentType.hpp>
#include <com/sun/star/datatransfer/XTransferable2.hpp>
#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
#include <svl/urlbmk.hxx>
#include <svtools/inetimg.hxx>
#include <vcl/wmf.hxx>
#include <svtools/imap.hxx>
#include <svtools/transfer.hxx>
#include <rtl/strbuf.hxx>
#include <cstdio>
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 <vcl/pngread.hxx>
#include <vcl/pngwrite.hxx>
#include <boost/scoped_ptr.hpp>
2001-01-19 17:23:13 +00:00
// - Namespaces -
2001-01-19 17:23:13 +00:00
using namespace ::com::sun::star::uno;
2001-02-26 11:58:36 +00:00
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::frame;
2001-01-19 17:23:13 +00:00
using namespace ::com::sun::star::io;
using namespace ::com::sun::star::datatransfer;
using namespace ::com::sun::star::datatransfer::clipboard;
2001-02-26 11:58:36 +00:00
using namespace ::com::sun::star::datatransfer::dnd;
2001-01-19 17:23:13 +00:00
2001-01-19 17:23:13 +00:00
// - TransferableObjectDescriptor -
2001-01-19 17:23:13 +00:00
#define TOD_SIG1 0x01234567
#define TOD_SIG2 0x89abcdef
SvStream& WriteTransferableObjectDescriptor( SvStream& rOStm, const TransferableObjectDescriptor& rObjDesc )
2001-01-19 17:23:13 +00:00
{
const sal_uInt32 nFirstPos = rOStm.Tell(), nViewAspect = rObjDesc.mnViewAspect;
const sal_uInt32 nSig1 = TOD_SIG1, nSig2 = TOD_SIG2;
2001-01-19 17:23:13 +00:00
rOStm.SeekRel( 4 );
WriteSvGlobalName( rOStm, rObjDesc.maClassName );
rOStm.WriteUInt32( nViewAspect );
rOStm.WriteInt32( rObjDesc.maSize.Width() );
rOStm.WriteInt32( rObjDesc.maSize.Height() );
rOStm.WriteInt32( rObjDesc.maDragStartPos.X() );
rOStm.WriteInt32( rObjDesc.maDragStartPos.Y() );
rOStm.WriteUniOrByteString( rObjDesc.maTypeName, osl_getThreadTextEncoding() );
rOStm.WriteUniOrByteString( rObjDesc.maDisplayName, osl_getThreadTextEncoding() );
rOStm.WriteUInt32( nSig1 ).WriteUInt32( nSig2 );
2001-01-19 17:23:13 +00:00
const sal_uInt32 nLastPos = rOStm.Tell();
rOStm.Seek( nFirstPos );
rOStm.WriteUInt32( nLastPos - nFirstPos );
2001-01-19 17:23:13 +00:00
rOStm.Seek( nLastPos );
return rOStm;
}
// the reading of the parameter is done using the special service ::com::sun::star::datatransfer::MimeContentType,
// a similar approach should be implemented for creation of the mimetype string;
// for now the set of acceptable characters has to be hardcoded, in future it should be part of the service that creates the mimetype
static OUString ImplGetParameterString( const TransferableObjectDescriptor& rObjDesc )
{
const OUString aChar( "\"" );
const OUString aClassName( rObjDesc.maClassName.GetHexName() );
OUString aParams;
if( !aClassName.isEmpty() )
{
aParams += OUString( ";classname=\"" );
aParams += aClassName;
aParams += aChar;
}
if( !rObjDesc.maTypeName.isEmpty() )
{
aParams += OUString( ";typename=\"" );
aParams += rObjDesc.maTypeName;
aParams += aChar;
}
if( !rObjDesc.maDisplayName.isEmpty() )
{
// the display name might contain unacceptable characters, encode all of them
// this seems to be the only parameter currently that might contain such characters
sal_Bool pToAccept[128];
for ( sal_Int32 nBInd = 0; nBInd < 128; nBInd++ )
pToAccept[nBInd] = sal_False;
const char aQuotedParamChars[] =
re-base on ALv2 code. Includes: Patch contributed by: Jurgen Schmidt remove onlineregistration with dependencies http://svn.apache.org/viewvc?view=revision&revision=1240245 imported patch package_eventlistener.patch http://svn.apache.org/viewvc?view=revision&revision=1172103 Patch contributed by Pedro Giffuni Accept Google Chrome OS fonts as equivalent to MS fonts. http://svn.apache.org/viewvc?view=revision&revision=1233155 http://svn.apache.org/viewvc?view=revision&revision=1233408 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 Mathias Bauer (and others) gnumake4 work variously http://svn.apache.org/viewvc?view=revision&revision=1394707 http://svn.apache.org/viewvc?view=revision&revision=1394326 cws mba34issues01: #i114600#: remove forbidden characters from list of unencoded characters http://svn.apache.org/viewvc?view=revision&revision=1172370 Patches contributed by Oliver Rainer-Wittman some clean up in JPEGReader due to memory constraints http://svn.apache.org/viewvc?view=revision&revision=1299729 119114 - method <UpdateDialog::addSpecificError(..)> - create entry with correct type http://svn.apache.org/viewvc?view=revision&revision=1305265 Patches contributed by Ariel Constenla-Haile i118707 - make toolbar control's popup window grab focus http://svn.apache.org/viewvc?view=revision&revision=1225846 Patches contributed by Herbert Duerr #i118662# remove usage of BerkeleyDB in desktop module http://svn.apache.org/viewvc?view=revision&revision=1213171 minor cleanups in dp_persmap.* http://svn.apache.org/viewvc?view=revision&revision=1215064 flush early to prevent problem with extension manager not cleaning up its objects http://svn.apache.org/viewvc?view=revision&revision=1228147 i118726 do not flush *pmap file while reading it http://svn.apache.org/viewvc?view=revision&revision=1230614 #i119048# migrate BDB extension entries using a simple heuristic http://svn.apache.org/viewvc?view=revision&revision=1300972 #i119048# handle edge cases when importing BDB hash files http://svn.apache.org/viewvc?view=revision&revision=1301428 #i119113# fix of-by-one when importing BDB files http://svn.apache.org/viewvc?view=revision&revision=1305420 restore our encryption settings, icon themes, and dictionaries. removed wrapper hacks, kill obsolete bundled extension blob / pre-registration handling, remove duplicated quickstart code. remove OS/2 conditionals.
2012-11-15 17:28:16 +00:00
"()<>@,;:/[]?=!#$&'*+-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ^_`abcdefghijklmnopqrstuvwxyz{|}~. ";
for ( sal_Int32 nInd = 0; nInd < RTL_CONSTASCII_LENGTH(aQuotedParamChars); ++nInd )
{
sal_Unicode nChar = aQuotedParamChars[nInd];
2010-03-24 09:22:50 +01:00
if ( nChar < 128 )
pToAccept[nChar] = sal_True;
}
aParams += OUString( ";displayname=\"" );
aParams += ::rtl::Uri::encode( rObjDesc.maDisplayName, pToAccept, rtl_UriEncodeIgnoreEscapes, RTL_TEXTENCODING_UTF8 );
aParams += aChar;
}
aParams += OUString( ";viewaspect=\"" );
aParams += OUString::number( rObjDesc.mnViewAspect );
aParams += aChar;
aParams += OUString( ";width=\"" );
aParams += OUString::number( rObjDesc.maSize.Width() );
aParams += aChar;
aParams += OUString( ";height=\"" );
aParams += OUString::number( rObjDesc.maSize.Height() );
aParams += aChar;
aParams += OUString( ";posx=\"" );
aParams += OUString::number( rObjDesc.maDragStartPos.X() );
aParams += aChar;
aParams += OUString( ";posy=\"" );
aParams += OUString::number( rObjDesc.maDragStartPos.X() );
aParams += aChar;
return aParams;
}
static void ImplSetParameterString( TransferableObjectDescriptor& rObjDesc, const DataFlavorEx& rFlavorEx )
{
Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
try
{
Reference< XMimeContentTypeFactory > xMimeFact = MimeContentTypeFactory::create( xContext );
Reference< XMimeContentType > xMimeType( xMimeFact->createMimeContentType( rFlavorEx.MimeType ) );
if( xMimeType.is() )
{
const OUString aClassNameString( "classname" );
const OUString aTypeNameString( "typename" );
const OUString aDisplayNameString( "displayname" );
const OUString aViewAspectString( "viewaspect" );
const OUString aWidthString( "width" );
const OUString aHeightString( "height" );
const OUString aPosXString( "posx" );
const OUString aPosYString( "posy" );
if( xMimeType->hasParameter( aClassNameString ) )
{
rObjDesc.maClassName.MakeId( xMimeType->getParameterValue( aClassNameString ) );
}
if( xMimeType->hasParameter( aTypeNameString ) )
{
rObjDesc.maTypeName = xMimeType->getParameterValue( aTypeNameString );
}
if( xMimeType->hasParameter( aDisplayNameString ) )
{
// the display name might contain unacceptable characters, in this case they should be encoded
// this seems to be the only parameter currently that might contain such characters
rObjDesc.maDisplayName = ::rtl::Uri::decode( xMimeType->getParameterValue( aDisplayNameString ), rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 );
}
if( xMimeType->hasParameter( aViewAspectString ) )
{
rObjDesc.mnViewAspect = static_cast< sal_uInt16 >( xMimeType->getParameterValue( aViewAspectString ).toInt32() );
}
if( xMimeType->hasParameter( aWidthString ) )
{
rObjDesc.maSize.Width() = xMimeType->getParameterValue( aWidthString ).toInt32();
}
if( xMimeType->hasParameter( aHeightString ) )
{
rObjDesc.maSize.Height() = xMimeType->getParameterValue( aHeightString ).toInt32();
}
if( xMimeType->hasParameter( aPosXString ) )
{
rObjDesc.maDragStartPos.X() = xMimeType->getParameterValue( aPosXString ).toInt32();
}
if( xMimeType->hasParameter( aPosYString ) )
{
rObjDesc.maDragStartPos.Y() = xMimeType->getParameterValue( aPosYString ).toInt32();
}
}
}
catch( const ::com::sun::star::uno::Exception& )
{
}
}
// - TransferableHelper::TerminateListener -
TransferableHelper::TerminateListener::TerminateListener( TransferableHelper& rTransferableHelper ) :
mrParent( rTransferableHelper )
{
}
TransferableHelper::TerminateListener::~TerminateListener()
{
}
void SAL_CALL TransferableHelper::TerminateListener::disposing( const EventObject& ) throw( RuntimeException, std::exception )
{
}
void SAL_CALL TransferableHelper::TerminateListener::queryTermination( const EventObject& ) throw( TerminationVetoException, RuntimeException, std::exception )
{
}
void SAL_CALL TransferableHelper::TerminateListener::notifyTermination( const EventObject& ) throw( RuntimeException, std::exception )
{
mrParent.ImplFlush();
}
2001-01-19 17:23:13 +00:00
// - TransferableHelper -
2001-01-19 17:23:13 +00:00
TransferableHelper::TransferableHelper() :
mpFormats( new DataFlavorExVector ),
mpObjDesc( NULL )
2001-01-19 17:23:13 +00:00
{
}
2001-01-19 17:23:13 +00:00
TransferableHelper::~TransferableHelper()
{
delete mpObjDesc;
delete mpFormats;
2001-01-19 17:23:13 +00:00
}
Any SAL_CALL TransferableHelper::getTransferData( const DataFlavor& rFlavor )
throw (UnsupportedFlavorException, IOException, RuntimeException, std::exception)
{
return getTransferData2(rFlavor, OUString());
}
2001-01-19 17:23:13 +00:00
Any SAL_CALL TransferableHelper::getTransferData2( const DataFlavor& rFlavor, const OUString& rDestDoc )
throw (UnsupportedFlavorException, IOException, RuntimeException, std::exception)
2001-01-19 17:23:13 +00:00
{
if( !maAny.hasValue() || mpFormats->empty() || ( maLastFormat != rFlavor.MimeType ) )
{
const SolarMutexGuard aGuard;
maLastFormat = rFlavor.MimeType;
maAny = Any();
2001-01-19 17:23:13 +00:00
try
{
2001-10-18 10:53:11 +00:00
DataFlavor aSubstFlavor;
bool bDone = false;
2001-10-18 10:53:11 +00:00
// add formats if not already done
if( mpFormats->empty() )
AddSupportedFormats();
2001-01-19 17:23:13 +00:00
// check alien formats first and try to get a substitution format
if( SotExchange::GetFormatDataFlavor( SotClipboardFormatId::STRING, aSubstFlavor ) &&
2001-10-18 10:53:11 +00:00
TransferableDataHelper::IsEqual( aSubstFlavor, rFlavor ) )
{
GetData(aSubstFlavor, rDestDoc);
2001-10-18 10:53:11 +00:00
bDone = maAny.hasValue();
}
else if(SotExchange::GetFormatDataFlavor(SotClipboardFormatId::BMP, aSubstFlavor )
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
&& TransferableDataHelper::IsEqual( aSubstFlavor, rFlavor )
&& SotExchange::GetFormatDataFlavor(SotClipboardFormatId::BITMAP, aSubstFlavor))
{
GetData(aSubstFlavor, rDestDoc);
bDone = true;
}
else if( SotExchange::GetFormatDataFlavor( SotClipboardFormatId::EMF, aSubstFlavor ) &&
2002-07-20 09:38:02 +00:00
TransferableDataHelper::IsEqual( aSubstFlavor, rFlavor ) &&
SotExchange::GetFormatDataFlavor( SotClipboardFormatId::GDIMETAFILE, aSubstFlavor ) )
2002-07-20 09:38:02 +00:00
{
GetData(aSubstFlavor, rDestDoc);
2002-07-20 09:38:02 +00:00
if( maAny.hasValue() )
{
Sequence< sal_Int8 > aSeq;
if( maAny >>= aSeq )
{
boost::scoped_ptr<SvMemoryStream> pSrcStm(new SvMemoryStream( aSeq.getArray(), aSeq.getLength(), StreamMode::WRITE | StreamMode::TRUNC ));
2002-07-20 09:38:02 +00:00
GDIMetaFile aMtf;
ReadGDIMetaFile( *pSrcStm, aMtf );
pSrcStm.reset();
2002-07-20 09:38:02 +00:00
Graphic aGraphic( aMtf );
SvMemoryStream aDstStm( 65535, 65535 );
if( GraphicConverter::Export( aDstStm, aGraphic, ConvertDataFormat::EMF ) == ERRCODE_NONE )
2002-07-20 09:38:02 +00:00
{
maAny <<= ( aSeq = Sequence< sal_Int8 >( static_cast< const sal_Int8* >( aDstStm.GetData() ),
2002-07-20 09:38:02 +00:00
aDstStm.Seek( STREAM_SEEK_TO_END ) ) );
bDone = true;
2002-07-20 09:38:02 +00:00
}
}
}
}
else if( SotExchange::GetFormatDataFlavor( SotClipboardFormatId::WMF, aSubstFlavor ) &&
2001-10-18 10:53:11 +00:00
TransferableDataHelper::IsEqual( aSubstFlavor, rFlavor ) &&
SotExchange::GetFormatDataFlavor( SotClipboardFormatId::GDIMETAFILE, aSubstFlavor ) )
2001-10-18 10:53:11 +00:00
{
GetData(aSubstFlavor, rDestDoc);
2001-09-25 09:12:13 +00:00
2001-10-18 10:53:11 +00:00
if( maAny.hasValue() )
2001-09-25 09:12:13 +00:00
{
2001-10-18 10:53:11 +00:00
Sequence< sal_Int8 > aSeq;
2001-09-25 09:12:13 +00:00
2001-10-18 10:53:11 +00:00
if( maAny >>= aSeq )
2001-09-25 09:12:13 +00:00
{
boost::scoped_ptr<SvMemoryStream> pSrcStm(new SvMemoryStream( aSeq.getArray(), aSeq.getLength(), StreamMode::WRITE | StreamMode::TRUNC ));
2001-10-18 10:53:11 +00:00
GDIMetaFile aMtf;
2001-09-25 09:12:13 +00:00
ReadGDIMetaFile( *pSrcStm, aMtf );
pSrcStm.reset();
2001-09-25 09:12:13 +00:00
2001-10-18 10:53:11 +00:00
SvMemoryStream aDstStm( 65535, 65535 );
2001-09-25 09:12:13 +00:00
// taking wmf without file header
if ( ConvertGDIMetaFileToWMF( aMtf, aDstStm, NULL, false ) )
2001-10-18 10:53:11 +00:00
{
maAny <<= ( aSeq = Sequence< sal_Int8 >( static_cast< const sal_Int8* >( aDstStm.GetData() ),
2001-10-18 10:53:11 +00:00
aDstStm.Seek( STREAM_SEEK_TO_END ) ) );
bDone = true;
2001-09-25 09:12:13 +00:00
}
}
}
}
2001-03-16 16:47:03 +00:00
2001-10-18 10:53:11 +00:00
// reset Any if substitute doesn't work
if( !bDone && maAny.hasValue() )
maAny = Any();
2001-09-25 09:12:13 +00:00
// if any is not yet filled, use standard format
if( !maAny.hasValue() )
GetData(rFlavor, rDestDoc);
#ifdef DEBUG
if( maAny.hasValue() && ::com::sun::star::uno::TypeClass_STRING != maAny.getValueType().getTypeClass() )
fprintf( stderr, "TransferableHelper delivers sequence of data [ %s ]\n", OUStringToOString(rFlavor.MimeType, RTL_TEXTENCODING_ASCII_US).getStr() );
#endif
}
catch( const ::com::sun::star::uno::Exception& )
{
}
2001-03-05 11:44:24 +00:00
if( !maAny.hasValue() )
throw UnsupportedFlavorException();
}
2001-01-19 17:23:13 +00:00
return maAny;
}
2001-01-19 17:23:13 +00:00
Sequence< DataFlavor > SAL_CALL TransferableHelper::getTransferDataFlavors() throw( RuntimeException, std::exception )
2001-01-19 17:23:13 +00:00
{
const SolarMutexGuard aGuard;
try
{
if( mpFormats->empty() )
AddSupportedFormats();
}
catch( const ::com::sun::star::uno::Exception& )
{
}
2001-01-19 17:23:13 +00:00
Sequence< DataFlavor > aRet( mpFormats->size() );
DataFlavorExVector::iterator aIter( mpFormats->begin() ), aEnd( mpFormats->end() );
sal_uInt32 nCurPos = 0;
2001-01-19 17:23:13 +00:00
2001-10-18 10:53:11 +00:00
while( aIter != aEnd )
{
2001-10-18 10:53:11 +00:00
aRet[ nCurPos++ ] = *aIter++;
}
2001-01-19 17:23:13 +00:00
return aRet;
}
2001-01-19 17:23:13 +00:00
sal_Bool SAL_CALL TransferableHelper::isDataFlavorSupported( const DataFlavor& rFlavor ) throw( RuntimeException, std::exception )
2001-01-19 17:23:13 +00:00
{
const SolarMutexGuard aGuard;
bool bRet = false;
2001-01-19 17:23:13 +00:00
try
{
if( mpFormats->empty() )
AddSupportedFormats();
}
catch( const ::com::sun::star::uno::Exception& )
{
}
2001-01-19 17:23:13 +00:00
for (DataFlavorExVector::const_iterator aIter( mpFormats->begin() ), aEnd( mpFormats->end() ); aIter != aEnd ; ++aIter)
2001-01-19 17:23:13 +00:00
{
2001-10-18 10:53:11 +00:00
if( TransferableDataHelper::IsEqual( *aIter, rFlavor ) )
2001-01-19 17:23:13 +00:00
{
bRet = true;
break;
2001-10-18 10:53:11 +00:00
}
2001-01-19 17:23:13 +00:00
}
return bRet;
}
2001-01-19 17:23:13 +00:00
void SAL_CALL TransferableHelper::lostOwnership( const Reference< XClipboard >&, const Reference< XTransferable >& ) throw( RuntimeException, std::exception )
2001-01-19 17:23:13 +00:00
{
const SolarMutexGuard aGuard;
try
{
if( mxTerminateListener.is() )
{
Reference< XDesktop2 > xDesktop = Desktop::create( ::comphelper::getProcessComponentContext() );
xDesktop->removeTerminateListener( mxTerminateListener );
mxTerminateListener.clear();
}
ObjectReleased();
}
catch( const ::com::sun::star::uno::Exception& )
{
}
2001-01-19 17:23:13 +00:00
}
2001-01-19 17:23:13 +00:00
void SAL_CALL TransferableHelper::disposing( const EventObject& ) throw( RuntimeException, std::exception )
2001-02-26 11:58:36 +00:00
{
}
2001-02-26 11:58:36 +00:00
void SAL_CALL TransferableHelper::dragDropEnd( const DragSourceDropEvent& rDSDE ) throw( RuntimeException, std::exception )
2001-02-26 11:58:36 +00:00
{
const SolarMutexGuard aGuard;
try
{
2001-08-14 08:32:25 +00:00
DragFinished( rDSDE.DropSuccess ? ( rDSDE.DropAction & ~DNDConstants::ACTION_DEFAULT ) : DNDConstants::ACTION_NONE );
ObjectReleased();
}
catch( const ::com::sun::star::uno::Exception& )
{
}
2001-02-26 11:58:36 +00:00
}
2001-02-26 11:58:36 +00:00
void SAL_CALL TransferableHelper::dragEnter( const DragSourceDragEvent& ) throw( RuntimeException, std::exception )
2001-02-26 11:58:36 +00:00
{
}
2001-02-26 11:58:36 +00:00
void SAL_CALL TransferableHelper::dragExit( const DragSourceEvent& ) throw( RuntimeException, std::exception )
2001-02-26 11:58:36 +00:00
{
}
2001-02-26 11:58:36 +00:00
void SAL_CALL TransferableHelper::dragOver( const DragSourceDragEvent& ) throw( RuntimeException, std::exception )
2001-02-26 11:58:36 +00:00
{
}
2001-02-26 11:58:36 +00:00
void SAL_CALL TransferableHelper::dropActionChanged( const DragSourceDragEvent& ) throw( RuntimeException, std::exception )
2001-02-26 11:58:36 +00:00
{
}
2001-02-26 11:58:36 +00:00
sal_Int64 SAL_CALL TransferableHelper::getSomething( const Sequence< sal_Int8 >& rId ) throw( RuntimeException, std::exception )
2001-10-18 10:53:11 +00:00
{
sal_Int64 nRet;
if( ( rId.getLength() == 16 ) &&
( 0 == memcmp( getUnoTunnelId().getConstArray(), rId.getConstArray(), 16 ) ) )
2001-10-18 10:53:11 +00:00
{
nRet = sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this));
2001-10-18 10:53:11 +00:00
}
else
nRet = 0;
return nRet;
}
2001-10-18 10:53:11 +00:00
void TransferableHelper::ImplFlush()
{
if( mxClipboard.is() )
{
Reference< XFlushableClipboard > xFlushableClipboard( mxClipboard, UNO_QUERY );
SolarMutexReleaser aReleaser;
try
{
if( xFlushableClipboard.is() )
xFlushableClipboard->flushClipboard();
}
catch( const ::com::sun::star::uno::Exception& )
{
2011-03-01 19:08:19 +01:00
OSL_FAIL( "Could not flush clipboard" );
}
}
}
void TransferableHelper::AddFormat( SotClipboardFormatId nFormat )
2001-01-19 17:23:13 +00:00
{
2001-10-18 10:53:11 +00:00
DataFlavor aFlavor;
2001-03-16 16:47:03 +00:00
2001-10-18 10:53:11 +00:00
if( SotExchange::GetFormatDataFlavor( nFormat, aFlavor ) )
AddFormat( aFlavor );
2001-01-19 17:23:13 +00:00
}
2001-01-19 17:23:13 +00:00
void TransferableHelper::AddFormat( const DataFlavor& rFlavor )
{
bool bAdd = true;
2001-10-18 12:23:27 +00:00
for (DataFlavorExVector::iterator aIter( mpFormats->begin() ), aEnd( mpFormats->end() ); aIter != aEnd ; ++aIter)
2001-10-18 12:23:27 +00:00
{
if( TransferableDataHelper::IsEqual( *aIter, rFlavor ) )
{
// update MimeType for SotClipboardFormatId::OBJECTDESCRIPTOR in every case
if( ( SotClipboardFormatId::OBJECTDESCRIPTOR == aIter->mnSotId ) && mpObjDesc )
{
DataFlavor aObjDescFlavor;
SotExchange::GetFormatDataFlavor( SotClipboardFormatId::OBJECTDESCRIPTOR, aObjDescFlavor );
aIter->MimeType = aObjDescFlavor.MimeType;
aIter->MimeType += ::ImplGetParameterString( *mpObjDesc );
#ifdef DEBUG
fprintf( stderr, "TransferableHelper exchanged objectdescriptor [ %s ]\n",
OUStringToOString(aIter->MimeType, RTL_TEXTENCODING_ASCII_US).getStr() );
#endif
}
bAdd = false;
break;
2001-10-18 12:23:27 +00:00
}
}
if( bAdd )
2001-01-19 17:23:13 +00:00
{
DataFlavorEx aFlavorEx;
DataFlavor aObjDescFlavor;
2001-01-19 17:23:13 +00:00
aFlavorEx.MimeType = rFlavor.MimeType;
aFlavorEx.HumanPresentableName = rFlavor.HumanPresentableName;
aFlavorEx.DataType = rFlavor.DataType;
aFlavorEx.mnSotId = SotExchange::RegisterFormat( rFlavor );
if( ( SotClipboardFormatId::OBJECTDESCRIPTOR == aFlavorEx.mnSotId ) && mpObjDesc )
aFlavorEx.MimeType += ::ImplGetParameterString( *mpObjDesc );
mpFormats->push_back( aFlavorEx );
2001-03-16 16:47:03 +00:00
if( SotClipboardFormatId::BITMAP == aFlavorEx.mnSotId )
{
AddFormat( SotClipboardFormatId::PNG );
AddFormat( SotClipboardFormatId::BMP );
}
else if( SotClipboardFormatId::GDIMETAFILE == aFlavorEx.mnSotId )
2002-07-20 09:38:02 +00:00
{
AddFormat( SotClipboardFormatId::EMF );
AddFormat( SotClipboardFormatId::WMF );
2002-07-20 09:38:02 +00:00
}
2001-01-19 17:23:13 +00:00
}
}
2001-01-19 17:23:13 +00:00
void TransferableHelper::RemoveFormat( SotClipboardFormatId nFormat )
2001-01-19 17:23:13 +00:00
{
2001-10-18 10:53:11 +00:00
DataFlavor aFlavor;
2001-01-19 17:23:13 +00:00
2001-10-18 10:53:11 +00:00
if( SotExchange::GetFormatDataFlavor( nFormat, aFlavor ) )
RemoveFormat( aFlavor );
2001-01-19 17:23:13 +00:00
}
2001-01-19 17:23:13 +00:00
void TransferableHelper::RemoveFormat( const DataFlavor& rFlavor )
{
DataFlavorExVector::iterator aIter( mpFormats->begin() );
2001-01-19 17:23:13 +00:00
while (aIter != mpFormats->end())
2001-01-19 17:23:13 +00:00
{
2001-10-18 10:53:11 +00:00
if( TransferableDataHelper::IsEqual( *aIter, rFlavor ) )
aIter = mpFormats->erase( aIter );
2001-01-19 17:23:13 +00:00
else
++aIter;
2001-01-19 17:23:13 +00:00
}
}
2001-01-19 17:23:13 +00:00
bool TransferableHelper::HasFormat( SotClipboardFormatId nFormat )
2001-01-19 17:23:13 +00:00
{
bool bRet = false;
2001-01-19 17:23:13 +00:00
for (DataFlavorExVector::const_iterator aIter( mpFormats->begin() ), aEnd( mpFormats->end() ); aIter != aEnd ; ++aIter)
2001-01-19 17:23:13 +00:00
{
if( nFormat == (*aIter).mnSotId )
2001-01-19 17:23:13 +00:00
{
bRet = true;
break;
2001-01-19 17:23:13 +00:00
}
}
return bRet;
}
2001-01-19 17:23:13 +00:00
void TransferableHelper::ClearFormats()
{
mpFormats->clear();
maAny.clear();
2001-01-19 17:23:13 +00:00
}
2001-01-19 17:23:13 +00:00
bool TransferableHelper::SetAny( const Any& rAny, const DataFlavor& )
2001-01-19 17:23:13 +00:00
{
maAny = rAny;
return( maAny.hasValue() );
}
2001-01-19 17:23:13 +00:00
bool TransferableHelper::SetString( const OUString& rString, const DataFlavor& rFlavor )
2001-01-19 17:23:13 +00:00
{
2001-03-12 11:56:37 +00:00
DataFlavor aFileFlavor;
if( !rString.isEmpty() &&
SotExchange::GetFormatDataFlavor( SotClipboardFormatId::SIMPLE_FILE, aFileFlavor ) &&
2001-03-12 11:56:37 +00:00
TransferableDataHelper::IsEqual( aFileFlavor, rFlavor ) )
{
const OString aByteStr(OUStringToOString(rString, osl_getThreadTextEncoding()));
2011-11-09 22:36:22 +00:00
Sequence< sal_Int8 > aSeq( aByteStr.getLength() + 1 );
2001-03-12 11:56:37 +00:00
memcpy( aSeq.getArray(), aByteStr.getStr(), aByteStr.getLength() );
2011-11-09 22:36:22 +00:00
aSeq[ aByteStr.getLength() ] = 0;
2001-03-12 11:56:37 +00:00
maAny <<= aSeq;
}
else
maAny <<= rString;
2001-01-19 17:23:13 +00:00
return( maAny.hasValue() );
}
2001-01-19 17:23:13 +00:00
bool TransferableHelper::SetBitmapEx( const BitmapEx& rBitmapEx, const DataFlavor& rFlavor )
2001-01-19 17:23:13 +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
if( !rBitmapEx.IsEmpty() )
2001-01-19 17:23:13 +00:00
{
SvMemoryStream aMemStm( 65535, 65535 );
if(rFlavor.MimeType.equalsIgnoreAsciiCase("image/png"))
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
{
// write a PNG
vcl::PNGWriter aPNGWriter(rBitmapEx);
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
aPNGWriter.Write(aMemStm);
}
else
{
const Bitmap aBitmap(rBitmapEx.GetBitmap());
// #i124085# take out DIBV5 for writing to the clipboard
//if(rBitmapEx.IsTransparent())
//{
// const Bitmap aMask(rBitmapEx.GetAlpha().GetBitmap());
// // explicitely use Bitmap::Write with bCompressed = sal_False and bFileHeader = sal_True
// WriteDIBV5(aBitmap, aMask, aMemStm);
//}
//else
//{
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
// explicitely use Bitmap::Write with bCompressed = sal_False and bFileHeader = sal_True
WriteDIB(aBitmap, aMemStm, false, true);
//}
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
}
maAny <<= Sequence< sal_Int8 >( static_cast< const sal_Int8* >( aMemStm.GetData() ), aMemStm.Seek( STREAM_SEEK_TO_END ) );
2001-01-19 17:23:13 +00:00
}
return( maAny.hasValue() );
}
2001-01-19 17:23:13 +00:00
bool TransferableHelper::SetGDIMetaFile( const GDIMetaFile& rMtf, const DataFlavor& )
2001-01-19 17:23:13 +00:00
{
if( rMtf.GetActionSize() )
2001-01-19 17:23:13 +00:00
{
SvMemoryStream aMemStm( 65535, 65535 );
( (GDIMetaFile&) rMtf ).Write( aMemStm );
maAny <<= Sequence< sal_Int8 >( static_cast< const sal_Int8* >( aMemStm.GetData() ), aMemStm.Seek( STREAM_SEEK_TO_END ) );
2001-01-19 17:23:13 +00:00
}
return( maAny.hasValue() );
2001-01-19 17:23:13 +00:00
}
2001-01-19 17:23:13 +00:00
bool TransferableHelper::SetGraphic( const Graphic& rGraphic, const DataFlavor& )
2001-01-19 17:23:13 +00:00
{
if( rGraphic.GetType() != GRAPHIC_NONE )
{
SvMemoryStream aMemStm( 65535, 65535 );
2001-02-06 15:07:54 +00:00
aMemStm.SetVersion( SOFFICE_FILEFORMAT_50 );
aMemStm.SetCompressMode( SvStreamCompressFlags::NATIVE );
WriteGraphic( aMemStm, rGraphic );
maAny <<= Sequence< sal_Int8 >( static_cast< const sal_Int8* >( aMemStm.GetData() ), aMemStm.Seek( STREAM_SEEK_TO_END ) );
2001-01-19 17:23:13 +00:00
}
return( maAny.hasValue() );
2001-01-19 17:23:13 +00:00
}
2001-01-19 17:23:13 +00:00
bool TransferableHelper::SetImageMap( const ImageMap& rIMap, const ::com::sun::star::datatransfer::DataFlavor& )
2001-01-19 17:23:13 +00:00
{
SvMemoryStream aMemStm( 8192, 8192 );
2001-01-19 17:23:13 +00:00
2001-02-06 15:07:54 +00:00
aMemStm.SetVersion( SOFFICE_FILEFORMAT_50 );
rIMap.Write( aMemStm, OUString() );
maAny <<= Sequence< sal_Int8 >( static_cast< const sal_Int8* >( aMemStm.GetData() ), aMemStm.Seek( STREAM_SEEK_TO_END ) );
2001-01-19 17:23:13 +00:00
return( maAny.hasValue() );
2001-01-19 17:23:13 +00:00
}
2001-01-19 17:23:13 +00:00
bool TransferableHelper::SetTransferableObjectDescriptor( const TransferableObjectDescriptor& rDesc,
const ::com::sun::star::datatransfer::DataFlavor& )
2001-01-19 17:23:13 +00:00
{
PrepareOLE( rDesc );
2001-01-19 17:23:13 +00:00
SvMemoryStream aMemStm( 1024, 1024 );
WriteTransferableObjectDescriptor( aMemStm, rDesc );
maAny <<= Sequence< sal_Int8 >( static_cast< const sal_Int8* >( aMemStm.GetData() ), aMemStm.Tell() );
2001-01-19 17:23:13 +00:00
return( maAny.hasValue() );
2001-10-18 10:53:11 +00:00
}
2001-01-19 17:23:13 +00:00
2001-01-19 17:23:13 +00:00
bool TransferableHelper::SetINetBookmark( const INetBookmark& rBmk,
2001-01-19 17:23:13 +00:00
const ::com::sun::star::datatransfer::DataFlavor& rFlavor )
{
rtl_TextEncoding eSysCSet = osl_getThreadTextEncoding();
2001-01-19 17:23:13 +00:00
switch( SotExchange::GetFormat( rFlavor ) )
{
case SotClipboardFormatId::SOLK:
2001-01-19 17:23:13 +00:00
{
OString sURL(OUStringToOString(rBmk.GetURL(), eSysCSet));
OString sDesc(OUStringToOString(rBmk.GetDescription(), eSysCSet));
OStringBuffer sOut;
sOut.append(sURL.getLength());
sOut.append('@').append(sURL);
sOut.append(sDesc.getLength());
sOut.append('@').append(sDesc);
Sequence< sal_Int8 > aSeq(sOut.getLength());
memcpy(aSeq.getArray(), sOut.getStr(), sOut.getLength());
maAny <<= aSeq;
2001-01-19 17:23:13 +00:00
}
break;
case SotClipboardFormatId::STRING:
maAny <<= OUString( rBmk.GetURL() );
break;
case SotClipboardFormatId::UNIFORMRESOURCELOCATOR:
2001-01-19 17:23:13 +00:00
{
OString sURL(OUStringToOString(rBmk.GetURL(), eSysCSet));
2011-11-09 22:36:22 +00:00
Sequence< sal_Int8 > aSeq( sURL.getLength() );
memcpy( aSeq.getArray(), sURL.getStr(), sURL.getLength() );
maAny <<= aSeq;
2001-01-19 17:23:13 +00:00
}
break;
case SotClipboardFormatId::NETSCAPE_BOOKMARK:
2001-01-19 17:23:13 +00:00
{
Sequence< sal_Int8 > aSeq( 2048 );
memset( aSeq.getArray(), 0, 2048 );
strcpy( reinterpret_cast< char* >( aSeq.getArray() ), OUStringToOString(rBmk.GetURL(), eSysCSet).getStr() );
strcpy( reinterpret_cast< char* >( aSeq.getArray() ) + 1024, OUStringToOString(rBmk.GetDescription(), eSysCSet).getStr() );
2001-01-19 17:23:13 +00:00
maAny <<= aSeq;
}
break;
#ifdef WNT
case SotClipboardFormatId::FILEGRPDESCRIPTOR:
2001-01-19 17:23:13 +00:00
{
Sequence< sal_Int8 > aSeq( sizeof( FILEGROUPDESCRIPTOR ) );
FILEGROUPDESCRIPTOR* pFDesc = (FILEGROUPDESCRIPTOR*) aSeq.getArray();
FILEDESCRIPTOR& rFDesc1 = pFDesc->fgd[ 0 ];
pFDesc->cItems = 1;
memset( &rFDesc1, 0, sizeof( FILEDESCRIPTOR ) );
rFDesc1.dwFlags = FD_LINKUI;
OStringBuffer aStr(OUStringToOString(
rBmk.GetDescription(), eSysCSet));
for( sal_uInt16 nChar = 0; nChar < aStr.getLength(); ++nChar )
if( strchr( "\\/:*?\"<>|", aStr[nChar] ) )
aStr.remove(nChar--, 1);
aStr.insert(0, "Shortcut to ");
aStr.append(".URL");
strcpy( rFDesc1.cFileName, aStr.getStr() );
2001-01-19 17:23:13 +00:00
maAny <<= aSeq;
}
break;
case SotClipboardFormatId::FILECONTENT:
2001-01-19 17:23:13 +00:00
{
OUString aStr( "[InternetShortcut]\x0aURL=" );
maAny <<= ( aStr += rBmk.GetURL() );
2001-01-19 17:23:13 +00:00
}
break;
#endif
default:
break;
}
return( maAny.hasValue() );
}
2001-01-19 17:23:13 +00:00
bool TransferableHelper::SetINetImage( const INetImage& rINtImg,
const ::com::sun::star::datatransfer::DataFlavor& rFlavor )
2001-01-30 12:23:14 +00:00
{
SvMemoryStream aMemStm( 1024, 1024 );
2001-01-30 12:23:14 +00:00
2001-02-06 15:07:54 +00:00
aMemStm.SetVersion( SOFFICE_FILEFORMAT_50 );
rINtImg.Write( aMemStm, SotExchange::GetFormat( rFlavor ) );
maAny <<= Sequence< sal_Int8 >( static_cast< const sal_Int8* >( aMemStm.GetData() ), aMemStm.Seek( STREAM_SEEK_TO_END ) );
return( maAny.hasValue() );
}
bool TransferableHelper::SetObject( void* pUserObject, SotClipboardFormatId nUserObjectId, const DataFlavor& rFlavor )
2001-01-19 17:23:13 +00:00
{
tools::SvRef<SotStorageStream> xStm( new SotStorageStream( OUString() ) );
2001-01-19 17:23:13 +00:00
2001-02-06 15:07:54 +00:00
xStm->SetVersion( SOFFICE_FILEFORMAT_50 );
2001-01-19 17:23:13 +00:00
if( pUserObject && WriteObject( xStm, pUserObject, nUserObjectId, rFlavor ) )
{
const sal_uInt32 nLen = xStm->Seek( STREAM_SEEK_TO_END );
Sequence< sal_Int8 > aSeq( nLen );
xStm->Seek( STREAM_SEEK_TO_BEGIN );
xStm->Read( aSeq.getArray(), nLen );
if( nLen && ( SotExchange::GetFormat( rFlavor ) == SotClipboardFormatId::STRING ) )
2001-10-18 10:53:11 +00:00
{
//JP 24.7.2001: as I know was this only for the writer application and this
// writes now UTF16 format into the stream
//JP 6.8.2001: and now it writes UTF8 because then exist no problem with
// little / big endians! - Bug 88121
maAny <<= OUString( reinterpret_cast< const sal_Char* >( aSeq.getConstArray() ), nLen - 1, RTL_TEXTENCODING_UTF8 );
2001-10-18 10:53:11 +00:00
}
else
maAny <<= aSeq;
2001-01-19 17:23:13 +00:00
}
return( maAny.hasValue() );
2001-01-19 17:23:13 +00:00
}
2001-01-19 17:23:13 +00:00
bool TransferableHelper::WriteObject( tools::SvRef<SotStorageStream>&, void*, SotClipboardFormatId, const DataFlavor& )
2001-01-19 17:23:13 +00:00
{
2011-03-01 19:08:19 +01:00
OSL_FAIL( "TransferableHelper::WriteObject( ... ) not implemented" );
return false;
2001-01-19 17:23:13 +00:00
}
2001-01-19 17:23:13 +00:00
void TransferableHelper::DragFinished( sal_Int8 )
2001-02-26 11:58:36 +00:00
{
}
2001-02-26 11:58:36 +00:00
2001-01-19 17:23:13 +00:00
void TransferableHelper::ObjectReleased()
{
}
2001-01-19 17:23:13 +00:00
void TransferableHelper::PrepareOLE( const TransferableObjectDescriptor& rObjDesc )
{
delete mpObjDesc;
mpObjDesc = new TransferableObjectDescriptor( rObjDesc );
if( HasFormat( SotClipboardFormatId::OBJECTDESCRIPTOR ) )
AddFormat( SotClipboardFormatId::OBJECTDESCRIPTOR );
}
void TransferableHelper::CopyToClipboard( vcl::Window *pWindow ) const
2001-01-19 17:23:13 +00:00
{
2001-10-18 10:53:11 +00:00
DBG_ASSERT( pWindow, "Window pointer is NULL" );
Reference< XClipboard > xClipboard;
if( pWindow )
xClipboard = pWindow->GetClipboard();
2001-05-25 10:36:44 +00:00
if( xClipboard.is() )
mxClipboard = xClipboard;
2001-02-26 11:58:36 +00:00
if( mxClipboard.is() && !mxTerminateListener.is() )
2001-02-26 11:58:36 +00:00
{
SolarMutexReleaser aReleaser;
2001-02-26 11:58:36 +00:00
try
{
2001-10-18 10:53:11 +00:00
TransferableHelper* pThis = const_cast< TransferableHelper* >( this );
Reference< XDesktop2 > xDesktop = Desktop::create( ::comphelper::getProcessComponentContext() );
xDesktop->addTerminateListener( pThis->mxTerminateListener = new TerminateListener( *pThis ) );
2001-10-18 10:53:11 +00:00
mxClipboard->setContents( pThis, pThis );
2001-02-26 11:58:36 +00:00
}
2001-03-05 11:44:24 +00:00
catch( const ::com::sun::star::uno::Exception& )
2001-02-26 11:58:36 +00:00
{
}
2001-03-05 11:44:24 +00:00
}
}
2001-03-05 11:44:24 +00:00
void TransferableHelper::CopyToSelection( vcl::Window *pWindow ) const
{
DBG_ASSERT( pWindow, "Window pointer is NULL" );
2001-10-18 10:53:11 +00:00
Reference< XClipboard > xSelection;
if( pWindow )
xSelection = pWindow->GetPrimarySelection();
if( xSelection.is() && !mxTerminateListener.is() )
{
SolarMutexReleaser aReleaser;
try
{
2001-10-18 10:53:11 +00:00
TransferableHelper* pThis = const_cast< TransferableHelper* >( this );
Reference< XDesktop2 > xDesktop = Desktop::create( ::comphelper::getProcessComponentContext() );
xDesktop->addTerminateListener( pThis->mxTerminateListener = new TerminateListener( *pThis ) );
2001-10-18 10:53:11 +00:00
xSelection->setContents( pThis, pThis );
}
catch( const ::com::sun::star::uno::Exception& )
{
}
}
}
void TransferableHelper::StartDrag( vcl::Window* pWindow, sal_Int8 nDnDSourceActions,
2001-02-26 11:58:36 +00:00
sal_Int32 nDnDPointer, sal_Int32 nDnDImage )
2001-02-26 11:58:36 +00:00
{
2001-03-05 11:44:24 +00:00
DBG_ASSERT( pWindow, "Window pointer is NULL" );
Reference< XDragSource > xDragSource( pWindow->GetDragSource() );
2001-02-26 11:58:36 +00:00
if( xDragSource.is() )
2001-01-19 17:23:13 +00:00
{
/*
* #96792# release mouse before actually starting DnD.
* This is necessary for the X11 DnD implementation to work.
*/
if( pWindow->IsMouseCaptured() )
pWindow->ReleaseMouse();
const Point aPt( pWindow->GetPointerPosPixel() );
// On Mac OS X we are forced to execute 'startDrag' synchronously
// contrary to the XDragSource interface specification because
// we can receive drag events from the system only in the main
// thread
#if !defined(MACOSX)
SolarMutexReleaser aReleaser;
#endif
2001-02-26 11:58:36 +00:00
try
{
DragGestureEvent aEvt;
aEvt.DragAction = DNDConstants::ACTION_COPY;
aEvt.DragOriginX = aPt.X();
aEvt.DragOriginY = aPt.Y();
aEvt.DragSource = xDragSource;
2001-02-26 11:58:36 +00:00
xDragSource->startDrag( aEvt, nDnDSourceActions, nDnDPointer, nDnDImage, this, this );
}
2001-03-05 11:44:24 +00:00
catch( const ::com::sun::star::uno::Exception& )
2001-02-26 11:58:36 +00:00
{
}
2001-01-19 17:23:13 +00:00
}
}
2001-01-19 17:23:13 +00:00
void TransferableHelper::ClearSelection( vcl::Window *pWindow )
2001-01-19 17:23:13 +00:00
{
DBG_ASSERT( pWindow, "Window pointer is NULL" );
Reference< XClipboard > xSelection( pWindow->GetPrimarySelection() );
2001-01-19 17:23:13 +00:00
if( xSelection.is() )
xSelection->setContents( NULL, NULL );
}
2001-01-19 17:23:13 +00:00
Reference< XClipboard> TransferableHelper::GetSystemClipboard()
{
vcl::Window *pFocusWindow = Application::GetFocusWindow();
2001-01-19 17:23:13 +00:00
if( pFocusWindow )
return pFocusWindow->GetClipboard();
return Reference< XClipboard > ();
2001-01-19 17:23:13 +00:00
}
2011-06-01 10:02:08 +01:00
namespace
{
class theTransferableHelperUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theTransferableHelperUnoTunnelId > {};
}
2001-10-18 10:53:11 +00:00
const Sequence< sal_Int8 >& TransferableHelper::getUnoTunnelId()
{
2011-06-01 10:02:08 +01:00
return theTransferableHelperUnoTunnelId::get().getSeq();
}
// - TransferableClipboardNotifier -
class TransferableClipboardNotifier : public ::cppu::WeakImplHelper1< XClipboardListener >
{
2001-10-18 10:53:11 +00:00
private:
::osl::Mutex& mrMutex;
Reference< XClipboardNotifier > mxNotifier;
TransferableDataHelper* mpListener;
protected:
// XClipboardListener
virtual void SAL_CALL changedContents( const clipboard::ClipboardEvent& event ) throw (RuntimeException, std::exception) SAL_OVERRIDE;
2001-10-18 10:53:11 +00:00
// XEventListener
virtual void SAL_CALL disposing( const EventObject& Source ) throw (RuntimeException, std::exception) SAL_OVERRIDE;
2001-10-18 10:53:11 +00:00
public:
TransferableClipboardNotifier( const Reference< XClipboard >& _rxClipboard, TransferableDataHelper& _rListener, ::osl::Mutex& _rMutex );
/// determines whether we're currently listening
inline bool isListening() const { return !isDisposed(); }
2001-10-18 10:53:11 +00:00
/// determines whether the instance is disposed
inline bool isDisposed() const { return mpListener == NULL; }
/// makes the instance non-functional
void dispose();
};
TransferableClipboardNotifier::TransferableClipboardNotifier( const Reference< XClipboard >& _rxClipboard, TransferableDataHelper& _rListener, ::osl::Mutex& _rMutex )
:mrMutex( _rMutex )
,mxNotifier( _rxClipboard, UNO_QUERY )
,mpListener( &_rListener )
{
osl_atomic_increment( &m_refCount );
{
if ( mxNotifier.is() )
mxNotifier->addClipboardListener( this );
else
// born dead
mpListener = NULL;
}
osl_atomic_decrement( &m_refCount );
}
void SAL_CALL TransferableClipboardNotifier::changedContents( const clipboard::ClipboardEvent& event ) throw (RuntimeException, std::exception)
{
SolarMutexGuard aSolarGuard;
// the SolarMutex here is necessary, since
// - we cannot call mpListener without our own mutex locked
// - Rebind respectively InitFormats (called by Rebind) will
// try to lock the SolarMutex, too
::osl::MutexGuard aGuard( mrMutex );
2001-10-18 10:53:11 +00:00
if( mpListener )
mpListener->Rebind( event.Contents );
}
void SAL_CALL TransferableClipboardNotifier::disposing( const EventObject& ) throw (RuntimeException, std::exception)
{
// clipboard is being disposed. Hmm. Okay, become disfunctional myself.
dispose();
}
void TransferableClipboardNotifier::dispose()
{
::osl::MutexGuard aGuard( mrMutex );
Reference< XClipboardListener > xKeepMeAlive( this );
if ( mxNotifier.is() )
mxNotifier->removeClipboardListener( this );
mxNotifier.clear();
mpListener = NULL;
}
// - TransferableDataHelper_Impl -
struct TransferableDataHelper_Impl
{
::osl::Mutex maMutex;
TransferableClipboardNotifier* mpClipboardListener;
TransferableDataHelper_Impl()
:mpClipboardListener( NULL )
{
}
};
2001-01-19 17:23:13 +00:00
// - TransferableDataHelper -
2001-01-19 17:23:13 +00:00
TransferableDataHelper::TransferableDataHelper() :
mpFormats( new DataFlavorExVector ),
mpObjDesc( new TransferableObjectDescriptor ),
mpImpl( new TransferableDataHelper_Impl )
2001-01-19 17:23:13 +00:00
{
}
2001-01-19 17:23:13 +00:00
TransferableDataHelper::TransferableDataHelper( const Reference< ::com::sun::star::datatransfer::XTransferable >& rxTransferable ) :
mxTransfer( rxTransferable ),
mpFormats( new DataFlavorExVector ),
mpObjDesc( new TransferableObjectDescriptor ),
mpImpl( new TransferableDataHelper_Impl )
2001-01-19 17:23:13 +00:00
{
InitFormats();
2001-01-19 17:23:13 +00:00
}
2001-01-19 17:23:13 +00:00
TransferableDataHelper::TransferableDataHelper( const TransferableDataHelper& rDataHelper ) :
mxTransfer( rDataHelper.mxTransfer ),
mxClipboard( rDataHelper.mxClipboard ),
mpFormats( new DataFlavorExVector( *rDataHelper.mpFormats ) ),
mpObjDesc( new TransferableObjectDescriptor( *rDataHelper.mpObjDesc ) ),
mpImpl( new TransferableDataHelper_Impl )
2001-01-19 17:23:13 +00:00
{
}
2001-01-19 17:23:13 +00:00
TransferableDataHelper& TransferableDataHelper::operator=( const TransferableDataHelper& rDataHelper )
{
if ( this != &rDataHelper )
{
::osl::MutexGuard aGuard( mpImpl->maMutex );
bool bWasClipboardListening = ( NULL != mpImpl->mpClipboardListener );
if ( bWasClipboardListening )
StopClipboardListening();
mxTransfer = rDataHelper.mxTransfer;
delete mpFormats, mpFormats = new DataFlavorExVector( *rDataHelper.mpFormats );
delete mpObjDesc, mpObjDesc = new TransferableObjectDescriptor( *rDataHelper.mpObjDesc );
mxClipboard = rDataHelper.mxClipboard;
if ( bWasClipboardListening )
StartClipboardListening();
}
2001-01-19 17:23:13 +00:00
return *this;
}
2001-01-19 17:23:13 +00:00
TransferableDataHelper::~TransferableDataHelper()
{
StopClipboardListening( );
{
::osl::MutexGuard aGuard( mpImpl->maMutex );
delete mpFormats, mpFormats = NULL;
delete mpObjDesc, mpObjDesc = NULL;
}
delete mpImpl;
2001-01-19 17:23:13 +00:00
}
2001-01-19 17:23:13 +00:00
2001-10-18 10:53:11 +00:00
void TransferableDataHelper::FillDataFlavorExVector( const Sequence< DataFlavor >& rDataFlavorSeq,
DataFlavorExVector& rDataFlavorExVector )
2001-01-19 17:23:13 +00:00
{
try
{
Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
Reference< XMimeContentTypeFactory > xMimeFact = MimeContentTypeFactory::create( xContext );
2001-10-18 10:53:11 +00:00
DataFlavorEx aFlavorEx;
const OUString aCharsetStr( "charset" );
2001-09-25 09:12:13 +00:00
2001-10-18 10:53:11 +00:00
for( sal_Int32 i = 0; i < rDataFlavorSeq.getLength(); i++ )
{
const DataFlavor& rFlavor = rDataFlavorSeq[ i ];
Reference< XMimeContentType > xMimeType;
2001-09-25 09:12:13 +00:00
2001-10-18 10:53:11 +00:00
try
{
if( !rFlavor.MimeType.isEmpty() )
2001-10-18 10:53:11 +00:00
xMimeType = xMimeFact->createMimeContentType( rFlavor.MimeType );
}
catch( const ::com::sun::star::uno::Exception& )
{
2001-10-18 10:53:11 +00:00
}
2001-10-18 10:53:11 +00:00
aFlavorEx.MimeType = rFlavor.MimeType;
aFlavorEx.HumanPresentableName = rFlavor.HumanPresentableName;
aFlavorEx.DataType = rFlavor.DataType;
aFlavorEx.mnSotId = SotExchange::RegisterFormat( rFlavor );
2001-10-18 10:53:11 +00:00
rDataFlavorExVector.push_back( aFlavorEx );
2001-03-16 16:47:03 +00:00
2001-10-18 10:53:11 +00:00
// add additional formats for special mime types
if(SotClipboardFormatId::BMP == aFlavorEx.mnSotId || SotClipboardFormatId::PNG == aFlavorEx.mnSotId)
{
if( SotExchange::GetFormatDataFlavor( SotClipboardFormatId::BITMAP, aFlavorEx ) )
{
aFlavorEx.mnSotId = SotClipboardFormatId::BITMAP;
rDataFlavorExVector.push_back( aFlavorEx );
}
}
else if( SotClipboardFormatId::WMF == aFlavorEx.mnSotId || SotClipboardFormatId::EMF == aFlavorEx.mnSotId )
2001-10-18 10:53:11 +00:00
{
if( SotExchange::GetFormatDataFlavor( SotClipboardFormatId::GDIMETAFILE, aFlavorEx ) )
2001-09-25 09:12:13 +00:00
{
aFlavorEx.mnSotId = SotClipboardFormatId::GDIMETAFILE;
2001-10-18 10:53:11 +00:00
rDataFlavorExVector.push_back( aFlavorEx );
2001-09-25 09:12:13 +00:00
}
2001-10-18 10:53:11 +00:00
}
else if ( SotClipboardFormatId::HTML_SIMPLE == aFlavorEx.mnSotId )
{
// #104735# HTML_SIMPLE may also be inserted without comments
aFlavorEx.mnSotId = SotClipboardFormatId::HTML_NO_COMMENT;
rDataFlavorExVector.push_back( aFlavorEx );
}
else if( xMimeType.is() && xMimeType->getFullMediaType().equalsIgnoreAsciiCase( "text/plain" ) )
2001-10-18 10:53:11 +00:00
{
// add, if it is a UTF-8 byte buffer
if( xMimeType->hasParameter( aCharsetStr ) )
{
if( xMimeType->getParameterValue( aCharsetStr ).equalsIgnoreAsciiCase( "unicode" ) ||
xMimeType->getParameterValue( aCharsetStr ).equalsIgnoreAsciiCase( "utf-16" ) )
{
rDataFlavorExVector[ rDataFlavorExVector.size() - 1 ].mnSotId = SotClipboardFormatId::STRING;
}
}
}
else if( xMimeType.is() && xMimeType->getFullMediaType().equalsIgnoreAsciiCase( "text/rtf" ) )
2001-10-18 10:53:11 +00:00
{
rDataFlavorExVector[ rDataFlavorExVector.size() - 1 ].mnSotId = SotClipboardFormatId::RTF;
2001-10-18 10:53:11 +00:00
}
else if( xMimeType.is() && xMimeType->getFullMediaType().equalsIgnoreAsciiCase( "text/html" ) )
2001-10-18 10:53:11 +00:00
{
rDataFlavorExVector[ rDataFlavorExVector.size() - 1 ].mnSotId = SotClipboardFormatId::HTML;
2001-10-18 10:53:11 +00:00
}
else if( xMimeType.is() && xMimeType->getFullMediaType().equalsIgnoreAsciiCase( "text/uri-list" ) )
{
rDataFlavorExVector[ rDataFlavorExVector.size() - 1 ].mnSotId = SotClipboardFormatId::FILE_LIST;
}
else if( xMimeType.is() && xMimeType->getFullMediaType().equalsIgnoreAsciiCase( "application/x-openoffice-objectdescriptor-xml" ) )
{
rDataFlavorExVector[ rDataFlavorExVector.size() - 1 ].mnSotId = SotClipboardFormatId::OBJECTDESCRIPTOR;
}
}
2001-01-19 17:23:13 +00:00
}
2001-03-05 11:44:24 +00:00
catch( const ::com::sun::star::uno::Exception& )
2001-01-19 17:23:13 +00:00
{
}
}
2001-01-19 17:23:13 +00:00
2001-10-18 10:53:11 +00:00
void TransferableDataHelper::InitFormats()
{
SolarMutexGuard aSolarGuard;
::osl::MutexGuard aGuard( mpImpl->maMutex );
2001-10-18 10:53:11 +00:00
mpFormats->clear();
delete mpObjDesc, mpObjDesc = new TransferableObjectDescriptor;
2001-10-18 10:53:11 +00:00
if( mxTransfer.is() )
{
2001-10-18 10:53:11 +00:00
TransferableDataHelper::FillDataFlavorExVector( mxTransfer->getTransferDataFlavors(), *mpFormats );
for (DataFlavorExVector::const_iterator aIter( mpFormats->begin() ), aEnd( mpFormats->end() ); aIter != aEnd ; ++aIter)
{
if( SotClipboardFormatId::OBJECTDESCRIPTOR == aIter->mnSotId )
{
ImplSetParameterString( *mpObjDesc, *aIter );
break;
}
}
}
2001-10-18 10:53:11 +00:00
}
2001-10-18 10:53:11 +00:00
bool TransferableDataHelper::HasFormat( SotClipboardFormatId nFormat ) const
2001-01-19 17:23:13 +00:00
{
::osl::MutexGuard aGuard( mpImpl->maMutex );
DataFlavorExVector::iterator aIter( mpFormats->begin() ), aEnd( mpFormats->end() );
bool bRet = false;
2001-01-19 17:23:13 +00:00
while( aIter != aEnd )
{
if( nFormat == (*aIter++).mnSotId )
{
aIter = aEnd;
bRet = true;
}
}
return bRet;
2001-01-19 17:23:13 +00:00
}
2001-01-19 17:23:13 +00:00
bool TransferableDataHelper::HasFormat( const DataFlavor& rFlavor ) const
2001-01-19 17:23:13 +00:00
{
::osl::MutexGuard aGuard( mpImpl->maMutex );
DataFlavorExVector::iterator aIter( mpFormats->begin() ), aEnd( mpFormats->end() );
bool bRet = false;
while( aIter != aEnd )
{
if( TransferableDataHelper::IsEqual( rFlavor, *aIter++ ) )
{
aIter = aEnd;
bRet = true;
}
}
return bRet;
}
sal_uInt32 TransferableDataHelper::GetFormatCount() const
{
::osl::MutexGuard aGuard( mpImpl->maMutex );
return mpFormats->size();
}
SotClipboardFormatId TransferableDataHelper::GetFormat( sal_uInt32 nFormat ) const
{
::osl::MutexGuard aGuard( mpImpl->maMutex );
DBG_ASSERT( nFormat < mpFormats->size(), "TransferableDataHelper::GetFormat: invalid format index" );
return( ( nFormat < mpFormats->size() ) ? (*mpFormats)[ nFormat ].mnSotId : SotClipboardFormatId::NONE );
}
DataFlavor TransferableDataHelper::GetFormatDataFlavor( sal_uInt32 nFormat ) const
{
::osl::MutexGuard aGuard( mpImpl->maMutex );
DBG_ASSERT( nFormat < mpFormats->size(), "TransferableDataHelper::GetFormat: invalid format index" );
2001-10-18 10:53:11 +00:00
DataFlavor aRet;
if( nFormat < mpFormats->size() )
2001-10-18 10:53:11 +00:00
aRet = (*mpFormats)[ nFormat ];
return aRet;
}
Reference< XTransferable > TransferableDataHelper::GetXTransferable() const
{
Reference< XTransferable > xRet;
if( mxTransfer.is() )
{
try
{
xRet = mxTransfer;
// do a dummy call to check, if this interface is valid (nasty)
xRet->getTransferDataFlavors();
}
catch( const ::com::sun::star::uno::Exception& )
{
xRet.clear();
}
}
return xRet;
}
Any TransferableDataHelper::GetAny( SotClipboardFormatId nFormat, const OUString& rDestDoc ) const
2002-05-16 14:21:00 +00:00
{
Any aReturn;
DataFlavor aFlavor;
if ( SotExchange::GetFormatDataFlavor( nFormat, aFlavor ) )
aReturn = GetAny(aFlavor, rDestDoc);
2002-05-16 14:21:00 +00:00
return aReturn;
}
2002-05-16 14:21:00 +00:00
Any TransferableDataHelper::GetAny( const DataFlavor& rFlavor, const OUString& rDestDoc ) const
{
::osl::MutexGuard aGuard( mpImpl->maMutex );
Any aRet;
try
{
if( mxTransfer.is() )
{
const SotClipboardFormatId nRequestFormat = SotExchange::GetFormat( rFlavor );
Reference<css::datatransfer::XTransferable2> xTransfer2(mxTransfer, UNO_QUERY);
if( nRequestFormat != SotClipboardFormatId::NONE )
{
// try to get alien format first
for (DataFlavorExVector::const_iterator aIter( mpFormats->begin() ), aEnd( mpFormats->end() ); aIter != aEnd ; ++aIter)
{
2001-10-18 10:53:11 +00:00
if( ( nRequestFormat == (*aIter).mnSotId ) && !rFlavor.MimeType.equalsIgnoreAsciiCase( (*aIter).MimeType ) )
{
if (xTransfer2.is())
aRet = xTransfer2->getTransferData2(*aIter, rDestDoc);
else
aRet = mxTransfer->getTransferData(*aIter);
}
if( aRet.hasValue() )
break;
}
}
if( !aRet.hasValue() )
{
if (xTransfer2.is())
aRet = xTransfer2->getTransferData2(rFlavor, rDestDoc);
else
aRet = mxTransfer->getTransferData(rFlavor);
}
}
}
catch( const ::com::sun::star::uno::Exception& )
{
}
return aRet;
2001-01-19 17:23:13 +00:00
}
2001-01-19 17:23:13 +00:00
bool TransferableDataHelper::GetString( SotClipboardFormatId nFormat, OUString& rStr )
{
DataFlavor aFlavor;
return( SotExchange::GetFormatDataFlavor( nFormat, aFlavor ) && GetString( aFlavor, rStr ) );
}
bool TransferableDataHelper::GetString( const DataFlavor& rFlavor, OUString& rStr )
{
Any aAny = GetAny(rFlavor, OUString());
bool bRet = false;
2001-10-18 10:53:11 +00:00
if( aAny.hasValue() )
{
OUString aOUString;
2001-10-18 10:53:11 +00:00
Sequence< sal_Int8 > aSeq;
2001-10-18 10:53:11 +00:00
if( aAny >>= aOUString )
{
rStr = aOUString;
bRet = true;
2001-09-25 09:12:13 +00:00
}
2001-10-18 10:53:11 +00:00
else if( aAny >>= aSeq )
2001-09-25 09:12:13 +00:00
{
2001-10-18 10:53:11 +00:00
const sal_Char* pChars = reinterpret_cast< const sal_Char* >( aSeq.getConstArray() );
sal_Int32 nLen = aSeq.getLength();
2001-09-25 09:12:13 +00:00
2001-10-18 10:53:11 +00:00
//JP 10.10.2001: 92930 - don't copy the last zero characterinto the string.
//DVO 2002-05-27: strip _all_ trailing zeros
while( nLen && ( 0 == *( pChars + nLen - 1 ) ) )
2001-10-18 10:53:11 +00:00
--nLen;
2001-09-25 09:12:13 +00:00
rStr = OUString( pChars, nLen, osl_getThreadTextEncoding() );
bRet = true;
2001-09-25 09:12:13 +00:00
}
}
2001-01-19 17:23:13 +00:00
return bRet;
}
2001-01-19 17:23:13 +00:00
bool TransferableDataHelper::GetBitmapEx( SotClipboardFormatId nFormat, BitmapEx& rBmpEx )
2001-01-19 17:23:13 +00:00
{
if(SotClipboardFormatId::BITMAP == nFormat)
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
{
// try to get PNG first
DataFlavor aFlavor;
if(SotExchange::GetFormatDataFlavor(SotClipboardFormatId::PNG, aFlavor))
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
{
if(GetBitmapEx(aFlavor, rBmpEx))
{
return true;
}
}
}
2001-01-19 17:23:13 +00:00
DataFlavor aFlavor;
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
return( SotExchange::GetFormatDataFlavor( nFormat, aFlavor ) && GetBitmapEx( aFlavor, rBmpEx ) );
2001-01-19 17:23:13 +00:00
}
2001-01-19 17:23:13 +00:00
bool TransferableDataHelper::GetBitmapEx( const DataFlavor& rFlavor, BitmapEx& rBmpEx )
2001-01-19 17:23:13 +00:00
{
tools::SvRef<SotStorageStream> xStm;
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
DataFlavor aSubstFlavor;
bool bRet(GetSotStorageStream(rFlavor, xStm));
bool bSuppressPNG(false); // #122982# If PNG stream not accessed, but BMP one, suppress trying to load PNG
2001-01-19 17:23:13 +00:00
if(!bRet && HasFormat(SotClipboardFormatId::PNG) && SotExchange::GetFormatDataFlavor(SotClipboardFormatId::PNG, aSubstFlavor))
2001-01-19 17:23:13 +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
// when no direct success, try if PNG is available
bRet = GetSotStorageStream(aSubstFlavor, xStm);
}
if(!bRet && HasFormat(SotClipboardFormatId::BMP) && SotExchange::GetFormatDataFlavor(SotClipboardFormatId::BMP, aSubstFlavor))
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
{
// when no direct success, try if BMP is available
bRet = GetSotStorageStream(aSubstFlavor, xStm);
bSuppressPNG = bRet;
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
}
if(bRet)
{
if(!bSuppressPNG && rFlavor.MimeType.equalsIgnoreAsciiCase("image/png"))
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
{
// it's a PNG, import to BitmapEx
vcl::PNGReader aPNGReader(*xStm);
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
rBmpEx = aPNGReader.Read();
}
if(rBmpEx.IsEmpty())
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
{
Bitmap aBitmap;
Bitmap aMask;
// explicitely use Bitmap::Read with bFileHeader = sal_True
// #i124085# keep DIBV5 for read from clipboard, but should not happen
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
ReadDIBV5(aBitmap, aMask, *xStm);
if(aMask.IsEmpty())
{
rBmpEx = aBitmap;
}
else
{
rBmpEx = BitmapEx(aBitmap, aMask);
}
}
bRet = (ERRCODE_NONE == xStm->GetError() && !rBmpEx.IsEmpty());
/* SJ: #110748# At the moment we are having problems with DDB inserted as DIB. The
problem is, that some graphics are inserted much too big because the nXPelsPerMeter
and nYPelsPerMeter of the bitmap fileheader isn't including the correct value.
Due to this reason the following code assumes that bitmaps with a logical size
greater than 50 cm aren't having the correct mapmode set.
The following code should be removed if DDBs and DIBs are supported via clipboard
properly.
*/
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
if(bRet)
{
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
const MapMode aMapMode(rBmpEx.GetPrefMapMode());
if(MAP_PIXEL != aMapMode.GetMapUnit())
{
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
const Size aSize(OutputDevice::LogicToLogic(rBmpEx.GetPrefSize(), aMapMode, MAP_100TH_MM));
// #i122388# This wrongly corrects in the given case; changing from 5000 100th mm to
// the described 50 cm (which is 50000 100th mm)
if((aSize.Width() > 50000) || (aSize.Height() > 50000))
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
{
rBmpEx.SetPrefMapMode(MAP_PIXEL);
// #i122388# also adapt size by applying the mew MapMode
const Size aNewSize(OutputDevice::LogicToLogic(aSize, MAP_100TH_MM, MAP_PIXEL));
rBmpEx.SetPrefSize(aNewSize);
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
}
}
}
2001-01-19 17:23:13 +00:00
}
return bRet;
}
2001-01-19 17:23:13 +00:00
bool TransferableDataHelper::GetGDIMetaFile(SotClipboardFormatId nFormat, GDIMetaFile& rMtf, size_t nMaxActions)
2001-01-19 17:23:13 +00:00
{
DataFlavor aFlavor;
return SotExchange::GetFormatDataFlavor(nFormat, aFlavor) &&
GetGDIMetaFile(aFlavor, rMtf) &&
(nMaxActions == 0 || rMtf.GetActionSize() < nMaxActions);
2001-01-19 17:23:13 +00:00
}
2001-01-19 17:23:13 +00:00
bool TransferableDataHelper::GetGDIMetaFile( const DataFlavor& rFlavor, GDIMetaFile& rMtf )
2001-01-19 17:23:13 +00:00
{
tools::SvRef<SotStorageStream> xStm;
2002-07-20 09:38:02 +00:00
DataFlavor aSubstFlavor;
bool bRet = false;
2001-01-19 17:23:13 +00:00
2002-07-20 09:38:02 +00:00
if( GetSotStorageStream( rFlavor, xStm ) )
2001-01-19 17:23:13 +00:00
{
ReadGDIMetaFile( *xStm, rMtf );
2001-01-19 17:23:13 +00:00
bRet = ( xStm->GetError() == ERRCODE_NONE );
}
2002-07-20 09:38:02 +00:00
if( !bRet &&
HasFormat( SotClipboardFormatId::EMF ) &&
SotExchange::GetFormatDataFlavor( SotClipboardFormatId::EMF, aSubstFlavor ) &&
2002-07-20 09:38:02 +00:00
GetSotStorageStream( aSubstFlavor, xStm ) )
2001-03-16 16:47:03 +00:00
{
2002-07-20 09:38:02 +00:00
Graphic aGraphic;
2001-03-16 16:47:03 +00:00
2002-07-20 09:38:02 +00:00
if( GraphicConverter::Import( *xStm, aGraphic ) == ERRCODE_NONE )
2001-03-16 16:47:03 +00:00
{
2002-07-20 09:38:02 +00:00
rMtf = aGraphic.GetGDIMetaFile();
bRet = true;
2002-07-20 09:38:02 +00:00
}
}
2001-03-16 16:47:03 +00:00
2002-07-20 09:38:02 +00:00
if( !bRet &&
HasFormat( SotClipboardFormatId::WMF ) &&
SotExchange::GetFormatDataFlavor( SotClipboardFormatId::WMF, aSubstFlavor ) &&
2002-07-20 09:38:02 +00:00
GetSotStorageStream( aSubstFlavor, xStm ) )
{
Graphic aGraphic;
if( GraphicConverter::Import( *xStm, aGraphic ) == ERRCODE_NONE )
{
rMtf = aGraphic.GetGDIMetaFile();
bRet = true;
2001-03-16 16:47:03 +00:00
}
}
2001-01-19 17:23:13 +00:00
return bRet;
}
2001-01-19 17:23:13 +00:00
bool TransferableDataHelper::GetGraphic( SotClipboardFormatId nFormat, Graphic& rGraphic )
2001-01-19 17:23:13 +00:00
{
if(SotClipboardFormatId::BITMAP == nFormat)
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
{
// try to get PNG first
DataFlavor aFlavor;
if(SotExchange::GetFormatDataFlavor(SotClipboardFormatId::PNG, aFlavor))
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
{
if(GetGraphic(aFlavor, rGraphic))
{
return true;
}
}
}
2001-01-19 17:23:13 +00:00
DataFlavor aFlavor;
return( SotExchange::GetFormatDataFlavor( nFormat, aFlavor ) && GetGraphic( aFlavor, rGraphic ) );
}
2001-01-19 17:23:13 +00:00
bool TransferableDataHelper::GetGraphic( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, Graphic& rGraphic )
2001-01-19 17:23:13 +00:00
{
2001-03-16 16:47:03 +00:00
DataFlavor aFlavor;
bool bRet = false;
2001-01-19 17:23:13 +00:00
if(SotExchange::GetFormatDataFlavor(SotClipboardFormatId::PNG, aFlavor) &&
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
TransferableDataHelper::IsEqual(aFlavor, rFlavor))
{
// try to get PNG first
BitmapEx aBmpEx;
if( ( bRet = GetBitmapEx( aFlavor, aBmpEx ) ) )
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
rGraphic = aBmpEx;
}
else if(SotExchange::GetFormatDataFlavor( SotClipboardFormatId::BITMAP, aFlavor ) &&
2001-03-16 16:47:03 +00:00
TransferableDataHelper::IsEqual( aFlavor, rFlavor ) )
2001-01-19 17:23:13 +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
BitmapEx aBmpEx;
2001-03-16 16:47:03 +00:00
if( ( bRet = GetBitmapEx( aFlavor, aBmpEx ) ) )
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
rGraphic = aBmpEx;
2001-03-16 16:47:03 +00:00
}
else if( SotExchange::GetFormatDataFlavor( SotClipboardFormatId::GDIMETAFILE, aFlavor ) &&
2001-03-16 16:47:03 +00:00
TransferableDataHelper::IsEqual( aFlavor, rFlavor ) )
{
GDIMetaFile aMtf;
if( ( bRet = GetGDIMetaFile( aFlavor, aMtf ) ) )
rGraphic = aMtf;
2001-03-16 16:47:03 +00:00
}
else
{
tools::SvRef<SotStorageStream> xStm;
2001-02-26 11:58:36 +00:00
2001-03-16 16:47:03 +00:00
if( GetSotStorageStream( rFlavor, xStm ) )
{
ReadGraphic( *xStm, rGraphic );
2001-03-16 16:47:03 +00:00
bRet = ( xStm->GetError() == ERRCODE_NONE );
}
2001-01-19 17:23:13 +00:00
}
return bRet;
}
2001-01-19 17:23:13 +00:00
bool TransferableDataHelper::GetImageMap( SotClipboardFormatId nFormat, ImageMap& rIMap )
2001-01-19 17:23:13 +00:00
{
DataFlavor aFlavor;
return( SotExchange::GetFormatDataFlavor( nFormat, aFlavor ) && GetImageMap( aFlavor, rIMap ) );
}
2001-01-19 17:23:13 +00:00
bool TransferableDataHelper::GetImageMap( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, ImageMap& rIMap )
2001-01-19 17:23:13 +00:00
{
tools::SvRef<SotStorageStream> xStm;
bool bRet = GetSotStorageStream( rFlavor, xStm );
2001-01-19 17:23:13 +00:00
if( bRet )
{
rIMap.Read( *xStm, OUString() );
2001-01-19 17:23:13 +00:00
bRet = ( xStm->GetError() == ERRCODE_NONE );
}
return bRet;
}
2001-01-19 17:23:13 +00:00
bool TransferableDataHelper::GetTransferableObjectDescriptor( SotClipboardFormatId nFormat, TransferableObjectDescriptor& rDesc )
2001-01-19 17:23:13 +00:00
{
DataFlavor aFlavor;
return( SotExchange::GetFormatDataFlavor( nFormat, aFlavor ) && GetTransferableObjectDescriptor( aFlavor, rDesc ) );
}
2001-01-19 17:23:13 +00:00
bool TransferableDataHelper::GetTransferableObjectDescriptor( const ::com::sun::star::datatransfer::DataFlavor&, TransferableObjectDescriptor& rDesc )
2001-01-19 17:23:13 +00:00
{
rDesc = *mpObjDesc;
return true;
2001-01-19 17:23:13 +00:00
}
2001-01-19 17:23:13 +00:00
bool TransferableDataHelper::GetINetBookmark( SotClipboardFormatId nFormat, INetBookmark& rBmk )
2001-01-19 17:23:13 +00:00
{
DataFlavor aFlavor;
return( SotExchange::GetFormatDataFlavor( nFormat, aFlavor ) && GetINetBookmark( aFlavor, rBmk ) );
}
2001-01-19 17:23:13 +00:00
bool TransferableDataHelper::GetINetBookmark( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, INetBookmark& rBmk )
2001-01-19 17:23:13 +00:00
{
bool bRet = false;
if( HasFormat( rFlavor ))
{
const SotClipboardFormatId nFormat = SotExchange::GetFormat( rFlavor );
2001-01-19 17:23:13 +00:00
switch( nFormat )
{
case( SotClipboardFormatId::SOLK ):
case( SotClipboardFormatId::UNIFORMRESOURCELOCATOR ):
2001-01-19 17:23:13 +00:00
{
OUString aString;
2001-01-19 17:23:13 +00:00
if( GetString( rFlavor, aString ) )
{
if( SotClipboardFormatId::UNIFORMRESOURCELOCATOR == nFormat )
2001-01-19 17:23:13 +00:00
{
rBmk = INetBookmark( aString, aString );
bRet = true;
2001-01-19 17:23:13 +00:00
}
else
{
OUString aURL, aDesc;
sal_Int32 nStart = aString.indexOf( '@' ), nLen = aString.toInt32();
2001-01-19 17:23:13 +00:00
if( !nLen && aString[ 0 ] != '0' )
2001-01-19 17:23:13 +00:00
{
DBG_WARNING( "SOLK: 1. len=0" );
2001-01-19 17:23:13 +00:00
}
if( nStart == -1 || nLen > aString.getLength() - nStart - 3 )
2001-01-19 17:23:13 +00:00
{
DBG_WARNING( "SOLK: 1. illegal start or wrong len" );
2001-01-19 17:23:13 +00:00
}
aURL = aString.copy( nStart + 1, nLen );
2001-01-19 17:23:13 +00:00
aString = aString.replaceAt( 0, nStart + 1 + nLen, "" );
nStart = aString.indexOf( '@' );
nLen = aString.toInt32();
2001-01-19 17:23:13 +00:00
if( !nLen && aString[ 0 ] != '0' )
2001-01-19 17:23:13 +00:00
{
DBG_WARNING( "SOLK: 2. len=0" );
2001-01-19 17:23:13 +00:00
}
if( nStart == -1 || nLen > aString.getLength() - nStart - 1 )
2001-01-19 17:23:13 +00:00
{
DBG_WARNING( "SOLK: 2. illegal start or wrong len" );
2001-01-19 17:23:13 +00:00
}
aDesc = aString.copy( nStart+1, nLen );
2001-01-19 17:23:13 +00:00
rBmk = INetBookmark( aURL, aDesc );
bRet = true;
2001-01-19 17:23:13 +00:00
}
}
}
break;
case( SotClipboardFormatId::NETSCAPE_BOOKMARK ):
2001-01-19 17:23:13 +00:00
{
Sequence<sal_Int8> aSeq = GetSequence(rFlavor, OUString());
2001-01-19 17:23:13 +00:00
if (2048 == aSeq.getLength())
2001-01-19 17:23:13 +00:00
{
const sal_Char* p1 = reinterpret_cast< const sal_Char* >( aSeq.getConstArray() );
const sal_Char* p2 = reinterpret_cast< const sal_Char* >( aSeq.getConstArray() ) + 1024;
rBmk = INetBookmark( OUString( p1, strlen(p1), osl_getThreadTextEncoding() ),
OUString( p2, strlen(p2), osl_getThreadTextEncoding() ) );
bRet = true;
2001-01-19 17:23:13 +00:00
}
}
break;
#ifdef WNT
case SotClipboardFormatId::FILEGRPDESCRIPTOR:
2001-01-19 17:23:13 +00:00
{
Sequence<sal_Int8> aSeq = GetSequence(rFlavor, OUString());
if (aSeq.getLength())
{
FILEGROUPDESCRIPTOR* pFDesc = (FILEGROUPDESCRIPTOR*) aSeq.getConstArray();
if( pFDesc->cItems )
{
OString aDesc( pFDesc->fgd[ 0 ].cFileName );
rtl_TextEncoding eTextEncoding = osl_getThreadTextEncoding();
if( ( aDesc.getLength() > 4 ) && aDesc.copy(aDesc.getLength() - 4).equalsIgnoreAsciiCase(".URL") )
{
boost::scoped_ptr<SvStream> pStream(::utl::UcbStreamHelper::CreateStream( INetURLObject( OStringToOUString(aDesc, eTextEncoding) ).GetMainURL( INetURLObject::NO_DECODE ),
STREAM_STD_READ ));
if( !pStream || pStream->GetError() )
{
DataFlavor aFileContentFlavor;
aSeq.realloc( 0 );
pStream.reset();
if (SotExchange::GetFormatDataFlavor(SotClipboardFormatId::FILECONTENT, aFileContentFlavor))
{
aSeq = GetSequence(aFileContentFlavor, OUString());
if (aSeq.getLength())
pStream.reset(new SvMemoryStream( (sal_Char*) aSeq.getConstArray(), aSeq.getLength(), STREAM_STD_READ ));
}
}
if( pStream )
{
OString aLine;
bool bSttFnd = false;
while( pStream->ReadLine( aLine ) )
{
if (aLine.equalsIgnoreAsciiCase("[InternetShortcut]"))
bSttFnd = true;
else if (bSttFnd && aLine.copy(0, 4).equalsIgnoreAsciiCase("URL="))
{
rBmk = INetBookmark( OStringToOUString(aLine.copy(4), eTextEncoding),
OStringToOUString(aDesc.copy(0, aDesc.getLength() - 4), eTextEncoding) );
bRet = true;
break;
}
}
}
}
}
}
2001-01-19 17:23:13 +00:00
}
break;
#endif
default: break;
2001-01-19 17:23:13 +00:00
}
}
2001-01-19 17:23:13 +00:00
return bRet;
}
2001-01-19 17:23:13 +00:00
bool TransferableDataHelper::GetINetImage( SotClipboardFormatId nFormat,
INetImage& rINtImg )
{
DataFlavor aFlavor;
return( SotExchange::GetFormatDataFlavor( nFormat, aFlavor ) && GetINetImage( aFlavor, rINtImg ) );
}
bool TransferableDataHelper::GetINetImage(
const ::com::sun::star::datatransfer::DataFlavor& rFlavor,
INetImage& rINtImg )
{
tools::SvRef<SotStorageStream> xStm;
bool bRet = GetSotStorageStream( rFlavor, xStm );
if( bRet )
bRet = rINtImg.Read( *xStm, SotExchange::GetFormat( rFlavor ) );
return bRet;
}
bool TransferableDataHelper::GetFileList( SotClipboardFormatId nFormat,
FileList& rFileList )
{
DataFlavor aFlavor;
return( SotExchange::GetFormatDataFlavor( nFormat, aFlavor ) && GetFileList( aFlavor, rFileList ) );
}
bool TransferableDataHelper::GetFileList(
const ::com::sun::star::datatransfer::DataFlavor&,
FileList& rFileList )
{
tools::SvRef<SotStorageStream> xStm;
bool bRet = false;
for( sal_uInt32 i = 0, nFormatCount = GetFormatCount(); ( i < nFormatCount ) && !bRet; ++i )
{
if( SotClipboardFormatId::FILE_LIST == GetFormat( i ) )
{
const DataFlavor aFlavor( GetFormatDataFlavor( i ) );
if( GetSotStorageStream( aFlavor, xStm ) )
{
if( aFlavor.MimeType.indexOf( "text/uri-list" ) > -1 )
{
OString aDiskString;
2011-11-09 22:36:22 +00:00
while( xStm->ReadLine( aDiskString ) )
if( !aDiskString.isEmpty() && aDiskString[0] != '#' )
rFileList.AppendFile( OStringToOUString(aDiskString, RTL_TEXTENCODING_UTF8) );
bRet = true;
}
else
bRet = ( ( ReadFileList( *xStm, rFileList ) ).GetError() == ERRCODE_NONE );
}
}
}
return bRet;
}
Sequence<sal_Int8> TransferableDataHelper::GetSequence( SotClipboardFormatId nFormat, const OUString& rDestDoc )
2001-01-19 17:23:13 +00:00
{
DataFlavor aFlavor;
if (!SotExchange::GetFormatDataFlavor(nFormat, aFlavor))
return Sequence<sal_Int8>();
return GetSequence(aFlavor, rDestDoc);
}
2001-01-19 17:23:13 +00:00
Sequence<sal_Int8> TransferableDataHelper::GetSequence( const DataFlavor& rFlavor, const OUString& rDestDoc )
2001-01-19 17:23:13 +00:00
{
#ifdef DEBUG
fprintf( stderr, "TransferableDataHelper requests sequence of data\n" );
#endif
const Any aAny = GetAny(rFlavor, rDestDoc);
Sequence<sal_Int8> aSeq;
if (aAny.hasValue())
aAny >>= aSeq;
return aSeq;
2001-01-19 17:23:13 +00:00
}
2001-01-19 17:23:13 +00:00
bool TransferableDataHelper::GetSotStorageStream( SotClipboardFormatId nFormat, tools::SvRef<SotStorageStream>& rxStream )
2001-01-19 17:23:13 +00:00
{
DataFlavor aFlavor;
return( SotExchange::GetFormatDataFlavor( nFormat, aFlavor ) && GetSotStorageStream( aFlavor, rxStream ) );
}
2001-01-19 17:23:13 +00:00
bool TransferableDataHelper::GetSotStorageStream( const DataFlavor& rFlavor, tools::SvRef<SotStorageStream>& rxStream )
2001-01-19 17:23:13 +00:00
{
Sequence<sal_Int8> aSeq = GetSequence(rFlavor, OUString());
2001-01-19 17:23:13 +00:00
if (aSeq.getLength())
2001-01-19 17:23:13 +00:00
{
rxStream = new SotStorageStream( "" );
2001-01-19 17:23:13 +00:00
rxStream->Write( aSeq.getConstArray(), aSeq.getLength() );
rxStream->Seek( 0 );
}
return aSeq.getLength();
2001-01-19 17:23:13 +00:00
}
Reference<XInputStream> TransferableDataHelper::GetInputStream( SotClipboardFormatId nFormat, const OUString& rDestDoc )
{
DataFlavor aFlavor;
if (!SotExchange::GetFormatDataFlavor(nFormat, aFlavor))
return Reference<XInputStream>();
return GetInputStream(aFlavor, rDestDoc);
}
Reference<XInputStream> TransferableDataHelper::GetInputStream( const DataFlavor& rFlavor, const OUString& rDestDoc )
{
Sequence<sal_Int8> aSeq = GetSequence(rFlavor, rDestDoc);
if (!aSeq.getLength())
return Reference<XInputStream>();
Reference<XInputStream> xStream(new comphelper::SequenceInputStream(aSeq));
return xStream;
}
void TransferableDataHelper::Rebind( const Reference< XTransferable >& _rxNewContent )
{
mxTransfer = _rxNewContent;
InitFormats();
}
bool TransferableDataHelper::StartClipboardListening( )
{
::osl::MutexGuard aGuard( mpImpl->maMutex );
StopClipboardListening( );
2001-10-18 10:53:11 +00:00
mpImpl->mpClipboardListener = new TransferableClipboardNotifier( mxClipboard, *this, mpImpl->maMutex );
mpImpl->mpClipboardListener->acquire();
2001-10-18 10:53:11 +00:00
return mpImpl->mpClipboardListener->isListening();
}
void TransferableDataHelper::StopClipboardListening( )
{
::osl::MutexGuard aGuard( mpImpl->maMutex );
2001-10-18 10:53:11 +00:00
if ( mpImpl->mpClipboardListener )
{
mpImpl->mpClipboardListener->dispose();
mpImpl->mpClipboardListener->release();
mpImpl->mpClipboardListener = NULL;
}
}
2001-01-19 17:23:13 +00:00
TransferableDataHelper TransferableDataHelper::CreateFromSystemClipboard( vcl::Window * pWindow )
{
2001-10-18 10:53:11 +00:00
DBG_ASSERT( pWindow, "Window pointer is NULL" );
Reference< XClipboard > xClipboard;
2011-05-10 16:14:25 +01:00
TransferableDataHelper aRet;
if( pWindow )
xClipboard = pWindow->GetClipboard();
2001-05-25 10:36:44 +00:00
if( xClipboard.is() )
2011-05-10 16:14:25 +01:00
{
try
{
Reference< XTransferable > xTransferable( xClipboard->getContents() );
if( xTransferable.is() )
{
aRet = TransferableDataHelper( xTransferable );
2011-05-10 16:14:25 +01:00
// also copy the clipboard
aRet.mxClipboard = xClipboard;
}
2011-05-10 16:14:25 +01:00
}
catch( const ::com::sun::star::uno::Exception& )
{
2011-05-10 16:14:25 +01:00
}
}
2011-08-10 14:13:03 +01:00
return aRet;
}
TransferableDataHelper TransferableDataHelper::CreateFromSelection( vcl::Window* pWindow )
{
DBG_ASSERT( pWindow, "Window pointer is NULL" );
Reference< XClipboard > xSelection;
TransferableDataHelper aRet;
2001-10-18 10:53:11 +00:00
if( pWindow )
xSelection = pWindow->GetPrimarySelection();
2001-10-18 10:53:11 +00:00
if( xSelection.is() )
{
SolarMutexReleaser aReleaser;
try
{
Reference< XTransferable > xTransferable( xSelection->getContents() );
if( xTransferable.is() )
{
aRet = TransferableDataHelper( xTransferable );
aRet.mxClipboard = xSelection;
}
}
catch( const ::com::sun::star::uno::Exception& )
{
}
}
return aRet;
}
bool TransferableDataHelper::IsEqual( const ::com::sun::star::datatransfer::DataFlavor& rInternalFlavor,
const ::com::sun::star::datatransfer::DataFlavor& rRequestFlavor,
bool )
2001-02-26 11:58:36 +00:00
{
Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
bool bRet = false;
2001-10-18 10:53:11 +00:00
try
{
Reference< XMimeContentTypeFactory > xMimeFact = MimeContentTypeFactory::create( xContext );
Reference< XMimeContentType > xRequestType1( xMimeFact->createMimeContentType( rInternalFlavor.MimeType ) );
Reference< XMimeContentType > xRequestType2( xMimeFact->createMimeContentType( rRequestFlavor.MimeType ) );
if( xRequestType1.is() && xRequestType2.is() )
{
if( xRequestType1->getFullMediaType().equalsIgnoreAsciiCase( xRequestType2->getFullMediaType() ) )
2001-10-18 10:53:11 +00:00
{
if( xRequestType1->getFullMediaType().equalsIgnoreAsciiCase( "text/plain" ) )
2001-10-18 10:53:11 +00:00
{
// special handling for text/plain media types
const OUString aCharsetString( "charset" );
if( !xRequestType2->hasParameter( aCharsetString ) ||
xRequestType2->getParameterValue( aCharsetString ).equalsIgnoreAsciiCase( "utf-16" ) ||
xRequestType2->getParameterValue( aCharsetString ).equalsIgnoreAsciiCase( "unicode" ) )
2001-10-18 10:53:11 +00:00
{
bRet = true;
2001-10-18 10:53:11 +00:00
}
}
else if( xRequestType1->getFullMediaType().equalsIgnoreAsciiCase( "application/x-openoffice" ) )
{
// special handling for application/x-openoffice media types
const OUString aFormatString( "windows_formatname" );
if( xRequestType1->hasParameter( aFormatString ) &&
xRequestType2->hasParameter( aFormatString ) &&
xRequestType1->getParameterValue( aFormatString ).equalsIgnoreAsciiCase( xRequestType2->getParameterValue( aFormatString ) ) )
{
bRet = true;
}
2001-10-18 10:53:11 +00:00
}
else
bRet = true;
2001-10-18 10:53:11 +00:00
}
}
}
2001-10-18 10:53:11 +00:00
catch( const ::com::sun::star::uno::Exception& )
{
2001-10-18 10:53:11 +00:00
bRet = rInternalFlavor.MimeType.equalsIgnoreAsciiCase( rRequestFlavor.MimeType );
}
2001-10-18 10:53:11 +00:00
return bRet;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */