summaryrefslogtreecommitdiff
path: root/dtrans
diff options
context:
space:
mode:
Diffstat (limited to 'dtrans')
-rw-r--r--dtrans/source/X11/X11_selection.cxx544
-rw-r--r--dtrans/source/X11/X11_selection.hxx27
-rw-r--r--dtrans/source/X11/bmp.cxx764
-rw-r--r--dtrans/source/X11/bmp.hxx142
-rw-r--r--dtrans/source/X11/dtransX11.xml2
-rw-r--r--dtrans/source/X11/makefile.mk7
-rw-r--r--dtrans/source/aqua/dtransaqua.xml103
-rw-r--r--dtrans/source/cnttype/mcnttype.hxx8
-rw-r--r--dtrans/source/win32/clipb/APNDataObject.hxx127
-rw-r--r--dtrans/source/win32/clipb/makefile.mk6
-rw-r--r--dtrans/source/win32/dnd/makefile.mk6
-rw-r--r--dtrans/source/win32/dtobj/DOTransferable.cxx10
-rw-r--r--dtrans/source/win32/dtobj/DTransHelper.cxx6
-rw-r--r--dtrans/source/win32/dtobj/TxtCnvtHlp.cxx16
-rw-r--r--dtrans/source/win32/dtobj/makefile.mk6
-rw-r--r--dtrans/source/win32/ftransl/ftransl.cxx436
-rw-r--r--dtrans/source/win32/ftransl/ftransl.hxx59
-rw-r--r--dtrans/source/win32/workbench/test_wincb.cxx342
-rw-r--r--dtrans/source/win32/workbench/testmarshal.cxx349
-rw-r--r--dtrans/test/win32/dnd/atlwindow.cxx82
-rw-r--r--dtrans/test/win32/dnd/atlwindow.hxx31
-rw-r--r--dtrans/test/win32/dnd/makefile.mk6
-rw-r--r--dtrans/test/win32/dnd/targetlistener.cxx27
23 files changed, 2198 insertions, 908 deletions
diff --git a/dtrans/source/X11/X11_selection.cxx b/dtrans/source/X11/X11_selection.cxx
index 2ffe69031cc5..732fda68bc2a 100644
--- a/dtrans/source/X11/X11_selection.cxx
+++ b/dtrans/source/X11/X11_selection.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: X11_selection.cxx,v $
*
- * $Revision: 1.58 $
+ * $Revision: 1.59 $
*
- * last change: $Author: pl $ $Date: 2002-12-10 14:48:18 $
+ * last change: $Author: hr $ $Date: 2003-03-25 14:05:28 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -62,11 +62,13 @@
#include <unistd.h>
#include <stdio.h>
#include <string.h>
+#include <sys/time.h>
#include <X11/Xatom.h>
#include <X11/keysym.h>
#include <X11/Xlib.h>
+#include <X11/X.h>
#include <X11/Xutil.h>
-#ifdef LINUX
+#if defined(LINUX) || defined(NETBSD) || defined (FREEBSD)
#include <sys/poll.h>
#else
#include <poll.h>
@@ -79,6 +81,7 @@
#include <X11_clipboard.hxx>
#include <X11_transferable.hxx>
#include <X11_dndcontext.hxx>
+#include <bmp.hxx>
// pointer bitmaps
#include <copydata_curs.h>
@@ -178,10 +181,14 @@ static NativeTypeEntry aNativeConversionTab[] =
{ 0, "text/plain;charset=ksc5601.1992-0", "KSC5601.1992-0", 8 },
// eastern european encodings
{ 0, "text/plain;charset=koi8-r", "KOI8-R", 8 },
+ { 0, "text/plain;charset=koi8-u", "KOI8-U", 8 },
// String (== iso8859-1)
{ XA_STRING, "text/plain;charset=iso8859-1", "STRING", 8 },
// special for compound text
- { 0, "text/plain;charset=compound_text", "COMPOUND_TEXT", 8 }
+ { 0, "text/plain;charset=compound_text", "COMPOUND_TEXT", 8 },
+
+ // PIXMAP
+ { XA_PIXMAP, "image/bmp", "PIXMAP", 32 }
};
rtl_TextEncoding x11::getTextPlainEncoding( const OUString& rMimeType )
@@ -365,6 +372,12 @@ void SelectionManager::initialize( const Sequence< Any >& arguments ) throw (::c
m_xDisplayConnection->addEventHandler( Any(), this, ~0 );
}
+ if( !m_xBitmapConverter.is() )
+ {
+ if( arguments.getLength() > 2 )
+ arguments.getConstArray()[2] >>= m_xBitmapConverter;
+ }
+
if( ! m_pDisplay )
{
OUString aUDisplay;
@@ -392,6 +405,7 @@ void SelectionManager::initialize( const Sequence< Any >& arguments ) throw (::c
m_nTEXTAtom = getAtom( OUString::createFromAscii( "TEXT" ) );
m_nINCRAtom = getAtom( OUString::createFromAscii( "INCR" ) );
m_nCOMPOUNDAtom = getAtom( OUString::createFromAscii( "COMPOUND_TEXT" ) );
+ m_nMULTIPLEAtom = getAtom( OUString::createFromAscii( "MULTIPLE" ) );
m_nUTF16Atom = getAtom( OUString::createFromAscii( "ISO10646-1" ) );
// m_nUTF16Atom = getAtom( OUString::createFromAscii( "text/plain;charset=ISO-10646-UCS-2" ) );
@@ -757,12 +771,24 @@ bool SelectionManager::requestOwnership( Atom selection )
bSuccess ? "acquired" : "failed to acquire",
OUStringToOString( getString( selection ), RTL_TEXTENCODING_ISO_8859_1 ).getStr() );
#endif
- m_aSelections[ selection ]->m_bOwner = bSuccess;
+ Selection* pSel = m_aSelections[ selection ];
+ pSel->m_bOwner = bSuccess;
+ delete pSel->m_pPixmap;
+ pSel->m_pPixmap = NULL;
}
#ifdef DEBUG
else
fprintf( stderr, "no adaptor for selection %s\n",
OUStringToOString( getString( selection ), RTL_TEXTENCODING_ISO_8859_1 ).getStr() );
+
+ if( pAdaptor->getTransferable().is() )
+ {
+ Sequence< DataFlavor > aTypes = pAdaptor->getTransferable()->getTransferDataFlavors();
+ for( int i = 0; i < aTypes.getLength(); i++ )
+ {
+ fprintf( stderr, " %s\n", OUStringToOString( aTypes.getConstArray()[i].MimeType, RTL_TEXTENCODING_ISO_8859_1 ).getStr() );
+ }
+ }
#endif
}
return bSuccess;
@@ -790,6 +816,19 @@ void SelectionManager::convertTypeToNative( const OUString& rType, Atom selectio
rConversions.push_front( pTab[i].nAtom );
else
rConversions.push_back( pTab[i].nAtom );
+ if( pTab[i].nFormat == XA_PIXMAP )
+ {
+ if( bPushFront )
+ {
+ rConversions.push_front( XA_VISUALID );
+ rConversions.push_front( XA_COLORMAP );
+ }
+ else
+ {
+ rConversions.push_back( XA_VISUALID );
+ rConversions.push_back( XA_COLORMAP );
+ }
+ }
}
}
if( ! rFormat )
@@ -827,6 +866,8 @@ void SelectionManager::getNativeTypeList( const Sequence< DataFlavor >& rTypes,
}
convertTypeToNative( OUString::createFromAscii( "text/plain;charset=utf-8" ), targetselection, nFormat, rOutTypeList, true );
}
+ if( targetselection != m_nXdndSelection )
+ rOutTypeList.push_back( m_nMULTIPLEAtom );
}
// ------------------------------------------------------------------------
@@ -887,9 +928,16 @@ bool SelectionManager::getPasteData( Atom selection, Atom type, Sequence< sal_In
return false;
}
+ // ICCCM recommends to destroy property before convert request unless
+ // parameters are transported; we do only in case of MULTIPLE,
+ // so destroy property unless target is MULTIPLE
+ if( type != m_nMULTIPLEAtom )
+ XDeleteProperty( m_pDisplay, m_aWindow, selection );
+
XConvertSelection( m_pDisplay, selection, type, selection, m_aWindow, selection == m_nXdndSelection ? m_nDropTime : CurrentTime );
- it->second->m_eState = Selection::WaitingForResponse;
- it->second->m_aData = Sequence< sal_Int8 >();
+ it->second->m_eState = Selection::WaitingForResponse;
+ it->second->m_aRequestedType = type;
+ it->second->m_aData = Sequence< sal_Int8 >();
it->second->m_aDataArrived.reset();
// really start the request; if we don't flush the
// queue the request won't leave it because there are no more
@@ -1038,6 +1086,96 @@ bool SelectionManager::getPasteData( Atom selection, const ::rtl::OUString& rTyp
}
}
}
+ else if( rType.equalsAsciiL( "image/bmp", 9 ) )
+ {
+ Pixmap aPixmap = None;
+ Colormap aColormap = None;
+
+ // prepare property for MULTIPLE request
+ Sequence< sal_Int8 > aData;
+ Atom pTypes[4] = { XA_PIXMAP, XA_PIXMAP,
+ XA_COLORMAP, XA_COLORMAP };
+ {
+ MutexGuard aGuard(m_aMutex);
+
+ XChangeProperty( m_pDisplay,
+ m_aWindow,
+ selection,
+ XA_ATOM,
+ 32,
+ PropModeReplace,
+ (unsigned char*)pTypes,
+ 4 );
+ }
+
+ // try MULTIPLE request
+ if( getPasteData( selection, m_nMULTIPLEAtom, aData ) )
+ {
+ Atom* pReturnedTypes = (Atom*)aData.getArray();
+ if( pReturnedTypes[0] == XA_PIXMAP && pReturnedTypes[1] == XA_PIXMAP )
+ {
+ MutexGuard aGuard(m_aMutex);
+
+ Atom type = None;
+ int format = 0;
+ unsigned long nItems = 0;
+ unsigned long nBytes = 0;
+ unsigned char* pReturn = NULL;
+ XGetWindowProperty( m_pDisplay, m_aWindow, XA_PIXMAP, 0, 1, True, XA_PIXMAP, &type, &format, &nItems, &nBytes, &pReturn );
+ if( pReturn )
+ {
+ if( type == XA_PIXMAP )
+ aPixmap = *(Pixmap*)pReturn;
+ XFree( pReturn );
+ pReturn = NULL;
+ if( pReturnedTypes[2] == XA_COLORMAP && pReturnedTypes[3] == XA_COLORMAP )
+ {
+ XGetWindowProperty( m_pDisplay, m_aWindow, XA_COLORMAP, 0, 1, True, XA_COLORMAP, &type, &format, &nItems, &nBytes, &pReturn );
+ if( pReturn )
+ {
+ if( type == XA_COLORMAP )
+ aColormap = *(Colormap*)pReturn;
+ XFree( pReturn );
+ }
+ }
+ }
+#ifdef DEBUG
+ else
+ {
+ fprintf( stderr, "could not get PIXMAP property: type=%s, format=%d, items=%d, bytes=%d, ret=0x%p\n", OUStringToOString( getString( type ), RTL_TEXTENCODING_ISO_8859_1 ).getStr(), format, nItems, nBytes, pReturn );
+ }
+#endif
+ }
+ }
+
+ if( aPixmap == None )
+ {
+ // perhaps two normal requests will work
+ if( getPasteData( selection, XA_PIXMAP, aData ) )
+ {
+ aPixmap = *(Pixmap*)aData.getArray();
+ if( aColormap == None && getPasteData( selection, XA_COLORMAP, aData ) )
+ aColormap = *(Colormap*)aData.getArray();
+ }
+ }
+
+ // convert data if possible
+ if( aPixmap != None )
+ {
+ MutexGuard aGuard(m_aMutex);
+
+ sal_Int32 nOutSize = 0;
+ sal_uInt8* pBytes = X11_getBmpFromPixmap( m_pDisplay, aPixmap, aColormap, nOutSize );
+ if( pBytes && nOutSize )
+ {
+ rData = Sequence< sal_Int8 >( nOutSize );
+ memcpy( rData.getArray(), pBytes, nOutSize );
+ X11_freeBmp( pBytes );
+ bSuccess = true;
+ }
+ }
+ }
+
if( ! bSuccess )
{
::std::list< Atom > aTypes;
@@ -1261,6 +1399,153 @@ bool SelectionManager::getPasteDataTypes( Atom selection, Sequence< DataFlavor >
// ------------------------------------------------------------------------
+PixmapHolder* SelectionManager::getPixmapHolder( Atom selection )
+{
+ std::hash_map< Atom, Selection* >::const_iterator it = m_aSelections.find( selection );
+ if( it == m_aSelections.end() )
+ return NULL;
+ if( ! it->second->m_pPixmap )
+ it->second->m_pPixmap = new PixmapHolder( m_pDisplay );
+ return it->second->m_pPixmap;
+}
+
+bool SelectionManager::sendData( SelectionAdaptor* pAdaptor,
+ Window requestor,
+ Atom target,
+ Atom property,
+ Atom selection )
+{
+ ResettableMutexGuard aGuard( m_aMutex );
+
+ // handle targets related to image/bmp
+ if( target == XA_COLORMAP || target == XA_PIXMAP || target == XA_BITMAP || target == XA_VISUALID )
+ {
+ PixmapHolder* pPixmap = getPixmapHolder( selection );
+ if( ! pPixmap ) return false;
+ XID nValue = None;
+
+ // handle colormap request
+ if( target == XA_COLORMAP )
+ nValue = (XID)pPixmap->getColormap();
+ else if( target == XA_VISUALID )
+ nValue = (XID)pPixmap->getVisualID();
+ else if( target == XA_PIXMAP || target == XA_BITMAP )
+ {
+ nValue = (XID)pPixmap->getPixmap();
+ if( nValue == None )
+ {
+ // first conversion
+ Sequence< sal_Int8 > aData;
+ int nFormat;
+ aGuard.clear();
+ bool bConverted = convertData( pAdaptor->getTransferable(), target, selection, nFormat, aData );
+ aGuard.reset();
+ if( bConverted )
+ {
+ // conversion succeeded, so aData contains image/bmp now
+ if( pPixmap->needsConversion( (const sal_uInt8*)aData.getConstArray() )
+ && m_xBitmapConverter.is() )
+ {
+#ifdef DEBUG
+ fprintf( stderr, "trying bitmap conversion\n" );
+#endif
+ Reference<XBitmap> xBM( new BmpTransporter( aData ) );
+ Sequence<Any> aArgs(2), aOutArgs;
+ Sequence<sal_Int16> aOutIndex;
+ aArgs.getArray()[0] = makeAny( xBM );
+ aArgs.getArray()[1] = makeAny( (sal_uInt16)pPixmap->getDepth() );
+ try
+ {
+ aGuard.clear();
+ Any aResult =
+ m_xBitmapConverter->invoke( OUString::createFromAscii( "convert-bitmap-depth" ),
+ aArgs, aOutIndex, aOutArgs );
+ aGuard.reset();
+ if( aResult >>= xBM )
+ aData = xBM->getDIB();
+ }
+ catch(...)
+ {
+#ifdef DEBUG
+ fprintf( stderr, "exception in bitmap converter\n" );
+#endif
+ }
+ }
+ nValue = (XID)pPixmap->setBitmapData( (const sal_uInt8*)aData.getConstArray() );
+ }
+ if( nValue == None )
+ return false;
+ }
+ if( target == XA_BITMAP )
+ nValue = (XID)pPixmap->getBitmap();
+ }
+
+ XChangeProperty( m_pDisplay,
+ requestor,
+ property,
+ target,
+ 32,
+ PropModeReplace,
+ (const unsigned char*)&nValue,
+ 1);
+ return true;
+ }
+
+ /*
+ * special target TEXT allows us to transfer
+ * the data in an encoding of our choice
+ * COMPOUND_TEXT will work with most applications
+ */
+ if( target == m_nTEXTAtom )
+ target = m_nCOMPOUNDAtom;
+
+ Sequence< sal_Int8 > aData;
+ int nFormat;
+ aGuard.clear();
+ bool bConverted = convertData( pAdaptor->getTransferable(), target, selection, nFormat, aData );
+ aGuard.reset();
+ if( bConverted )
+ {
+ // conversion succeeded
+ if( aData.getLength() > INCR_MIN_SIZE )
+ {
+#ifdef DEBUG
+ fprintf( stderr, "using INCR protocol\n" );
+#endif
+ // use incr protocol
+ int nBufferPos = 0;
+ int nMinSize = INCR_MIN_SIZE;
+ XChangeProperty( m_pDisplay, requestor, property,
+ m_nINCRAtom, 32, PropModeReplace, (unsigned char*)&nMinSize, 1 );
+ XSelectInput( m_pDisplay, requestor, PropertyChangeMask );
+ IncrementalTransfer aTransfer( aData,
+ requestor,
+ property,
+ target,
+ nFormat
+ );
+ m_aIncrementals[ requestor ].push_back( aTransfer );
+ }
+ else
+ XChangeProperty( m_pDisplay,
+ requestor,
+ property,
+ target,
+ nFormat,
+ PropModeReplace,
+ (const unsigned char*)aData.getConstArray(),
+ aData.getLength()/(nFormat/8) );
+ }
+#ifdef DEBUG
+ else
+ fprintf( stderr, "convertData failed for type: %s \n",
+ OUStringToOString( convertTypeFromNative( target, selection, nFormat ), RTL_TEXTENCODING_ISO_8859_1 ).getStr() );
+#endif
+ return bConverted;
+}
+
+// ------------------------------------------------------------------------
+
void SelectionManager::handleSelectionRequest( XSelectionRequestEvent& rRequest )
{
ResettableMutexGuard aGuard( m_aMutex );
@@ -1317,58 +1602,110 @@ void SelectionManager::handleSelectionRequest( XSelectionRequestEvent& rRequest
}
else
{
- /*
- * special target TEXT allows us to transfer
- * the data in an encoding of our choice
- * COMPOUND_TEXT will work with most applications
- */
- if( rRequest.target == m_nTEXTAtom )
- rRequest.target = m_nCOMPOUNDAtom;
-
- Sequence< sal_Int8 > aData;
- int nFormat;
- aGuard.clear();
- bool bConverted = convertData( pAdaptor->getTransferable(), rRequest.target, rRequest.selection, nFormat, aData );
- aGuard.reset();
- if( bConverted )
+ bool bEventSuccess = false;
+ if( rRequest.target == m_nMULTIPLEAtom )
{
- // conversion succeeded
- aNotify.xselection.target = rRequest.target;
- aNotify.xselection.property = rRequest.property;
- if( aData.getLength() > INCR_MIN_SIZE )
+ // get all targets
+ Atom nType = None;
+ int nFormat = 0;
+ unsigned long nItems = 0, nBytes = 0;
+ unsigned char* pData = NULL;
+
+ // get number of atoms
+ XGetWindowProperty( m_pDisplay,
+ rRequest.requestor,
+ rRequest.property,
+ 0, 0,
+ False,
+ AnyPropertyType,
+ &nType, &nFormat,
+ &nItems, &nBytes,
+ &pData );
+ if( nFormat == 32 && nBytes/4 )
{
+ if( pData ) // ?? should not happen
+ {
+ XFree( pData );
+ pData = NULL;
+ }
+ XGetWindowProperty( m_pDisplay,
+ rRequest.requestor,
+ rRequest.property,
+ 0, nBytes/4,
+ False,
+ nType,
+ &nType, &nFormat,
+ &nItems, &nBytes,
+ &pData );
+ if( pData && nItems )
+ {
+#ifdef DEBUG
+ fprintf( stderr, "found %d atoms in MULTIPLE request\n", nItems );
+#endif
+ bEventSuccess = true;
+ bool bResetAtoms = false;
+ Atom* pAtoms = (Atom*)pData;
+ aGuard.clear();
+ for( int i = 0; i < nItems; i += 2 )
+ {
+#ifdef DEBUG
+ fprintf( stderr, " %s => %s: ",
+ OUStringToOString( getString( pAtoms[i] ), RTL_TEXTENCODING_ISO_8859_1 ).getStr(),
+ OUStringToOString( getString( pAtoms[i+1] ), RTL_TEXTENCODING_ISO_8859_1 ).getStr() );
+#endif
+ bool bSuccess = sendData( pAdaptor, rRequest.requestor, pAtoms[i], pAtoms[i+1], rRequest.selection );
#ifdef DEBUG
- fprintf( stderr, "using INCR protocol\n" );
-#endif
- // use incr protocol
- int nBufferPos = 0;
- int nMinSize = INCR_MIN_SIZE;
- XChangeProperty( m_pDisplay, rRequest.requestor, rRequest.property,
- m_nINCRAtom, 32, PropModeReplace, (unsigned char*)&nMinSize, 1 );
- XSelectInput( m_pDisplay, rRequest.requestor, PropertyChangeMask );
- IncrementalTransfer aTransfer( aData,
- rRequest.requestor,
- rRequest.property,
- rRequest.target,
- nFormat
- );
- m_aIncrementals[ rRequest.requestor ].push_back( aTransfer );
+ fprintf( stderr, "%s\n", bSuccess ? "succeeded" : "failed" );
+#endif
+ if( ! bSuccess )
+ {
+ pAtoms[i] = None;
+ bResetAtoms = true;
+ }
+ }
+ aGuard.reset();
+ if( bResetAtoms )
+ XChangeProperty( m_pDisplay,
+ rRequest.requestor,
+ rRequest.property,
+ XA_ATOM,
+ 32,
+ PropModeReplace,
+ pData,
+ nBytes/4 );
+ }
+ if( pData )
+ XFree( pData );
}
+#ifdef DEBUG
else
- XChangeProperty( m_pDisplay,
- rRequest.requestor,
- rRequest.property,
- rRequest.target,
- nFormat,
- PropModeReplace,
- (const unsigned char*)aData.getConstArray(),
- aData.getLength()/(nFormat/8) );
+ {
+ fprintf( stderr, "could not get type list from \"%s\" of type \"%s\" on requestor 0x%x, requestor has properties:",
+ OUStringToOString( getString( rRequest.property ), RTL_TEXTENCODING_ISO_8859_1 ).getStr(),
+ OUStringToOString( getString( nType ), RTL_TEXTENCODING_ISO_8859_1 ).getStr(),
+ rRequest.requestor );
+ int nProps = 0;
+ Atom* pProps = XListProperties( m_pDisplay, rRequest.requestor, &nProps );
+ if( pProps )
+ {
+ for( int i = 0; i < nProps; i++ )
+ fprintf( stderr, " \"%s\"", OUStringToOString( getString( pProps[i]), RTL_TEXTENCODING_ISO_8859_1 ).getStr() );
+ XFree( pProps );
+ }
+ }
+#endif
}
-#ifdef DEBUG
else
- fprintf( stderr, "convertData failed for type: %s \n",
- OUStringToOString( convertTypeFromNative( rRequest.target, rRequest.selection, nFormat ), RTL_TEXTENCODING_ISO_8859_1 ).getStr() );
-#endif
+ {
+ aGuard.clear();
+ bEventSuccess = sendData( pAdaptor, rRequest.requestor, rRequest.target, rRequest.property, rRequest.selection );
+ aGuard.reset();
+ }
+ if( bEventSuccess )
+ {
+ aNotify.xselection.target = rRequest.target;
+ aNotify.xselection.property = rRequest.property;
+ }
}
}
XSendEvent( m_pDisplay, rRequest.requestor, False, 0, &aNotify );
@@ -1420,6 +1757,12 @@ void SelectionManager::handleReceivePropertyNotify( XPropertyEvent& rNotify )
)
)
{
+ // MULTIPLE requests are only complete after selection notify
+ if( it->second->m_aRequestedType == m_nMULTIPLEAtom &&
+ ( it->second->m_eState == Selection::WaitingForResponse ||
+ it->second->m_eState == Selection::WaitingForData ) )
+ return;
+
Atom nType = None;
int nFormat = 0;
unsigned long nItems = 0, nBytes = 0;
@@ -1533,25 +1876,20 @@ void SelectionManager::handleSendPropertyNotify( XPropertyEvent& rNotify )
bool bDone = false;
if( inc_it->m_aProperty == rNotify.atom )
{
- if( rNotify.state != PropertyDelete )
+ int nBytes = inc_it->m_aData.getLength() - inc_it->m_nBufferPos;
+ nBytes = nBytes > INCR_MIN_SIZE ? INCR_MIN_SIZE : nBytes;
+ XChangeProperty(
+ m_pDisplay,
+ inc_it->m_aRequestor,
+ inc_it->m_aProperty,
+ inc_it->m_aTarget,
+ inc_it->m_nFormat,
+ PropModeReplace,
+ (const unsigned char*)inc_it->m_aData.getConstArray()+inc_it->m_nBufferPos,
+ nBytes/(inc_it->m_nFormat/8) );
+ inc_it->m_nBufferPos += nBytes;
+ if( nBytes == 0 )
bDone = true;
- else
- {
- int nBytes = inc_it->m_aData.getLength() - inc_it->m_nBufferPos;
- nBytes = nBytes > INCR_MIN_SIZE ? INCR_MIN_SIZE : nBytes;
- XChangeProperty(
- m_pDisplay,
- inc_it->m_aRequestor,
- inc_it->m_aProperty,
- inc_it->m_aTarget,
- inc_it->m_nFormat,
- PropModeReplace,
- (const unsigned char*)inc_it->m_aData.getConstArray()+inc_it->m_nBufferPos,
- nBytes/(inc_it->m_nFormat/8) );
- inc_it->m_nBufferPos += nBytes;
- if( nBytes == 0 )
- bDone = true;
- }
}
else if( nCurrentTime - inc_it->m_nTransferStartTime > INCR_TIMEOUT )
bDone = true;
@@ -1595,10 +1933,47 @@ void SelectionManager::handleSelectionNotify( XSelectionEvent& rNotify )
( it->second->m_eState == Selection::WaitingForResponse ) ||
( it->second->m_eState == Selection::WaitingForData ) )
{
+ if( it->second->m_aRequestedType == m_nMULTIPLEAtom )
+ {
+ Atom nType = None;
+ int nFormat = 0;
+ unsigned long nItems = 0, nBytes = 0;
+ unsigned char* pData = NULL;
+
+ // get type and length
+ XGetWindowProperty( m_pDisplay,
+ rNotify.requestor,
+ rNotify.property,
+ 0, 256,
+ False,
+ AnyPropertyType,
+ &nType, &nFormat,
+ &nItems, &nBytes,
+ &pData );
+ if( nBytes ) // HUGE request !!!
+ {
+ if( pData )
+ XFree( pData );
+ XGetWindowProperty( m_pDisplay,
+ rNotify.requestor,
+ rNotify.property,
+ 0, 256+(nBytes+3)/4,
+ False,
+ AnyPropertyType,
+ &nType, &nFormat,
+ &nItems, &nBytes,
+ &pData );
+ }
+ it->second->m_eState = Selection::Inactive;
+ it->second->m_aData = Sequence< sal_Int8 >((sal_Int8*)pData, nFormat/8 * nItems );
+ it->second->m_aDataArrived.set();
+ if( pData )
+ XFree( pData );
+ }
// WaitingForData can actually happen; some
// applications (e.g. cmdtool on Solaris) first send
// a success and then cancel it. Weird !
- if( rNotify.property == None )
+ else if( rNotify.property == None )
{
// conversion failed, stop transfer
it->second->m_eState = Selection::Inactive;
@@ -1945,6 +2320,9 @@ void SelectionManager::sendDropPosition( bool bForce, Time eventTime )
{
ClearableMutexGuard aGuard(m_aMutex);
+ if( m_bDropSent )
+ return;
+
::std::hash_map< Window, DropTargetEntry >::const_iterator it =
m_aDropTargets.find( m_aDropWindow );
if( it != m_aDropTargets.end() )
@@ -3073,11 +3451,6 @@ void SelectionManager::dispatchEvent( int millisec )
}
}
}
- else
- {
- MutexGuard aGuard(m_aMutex);
- XFlush( m_pDisplay );
- }
}
// ------------------------------------------------------------------------
@@ -3091,18 +3464,21 @@ void SelectionManager::run( void* pThis )
SelectionManager* This = (SelectionManager*)pThis;
- time_t nLast = time( NULL );
- osl_yieldThread();
+ timeval aLast;
+ gettimeofday( &aLast, 0 );
+
while( osl_scheduleThread(This->m_aThread) )
{
- osl_yieldThread();
- This->dispatchEvent( 200 );
- time_t nNow = time( NULL );
- if( nNow - nLast > 0 )
+ This->dispatchEvent( 1000 );
+
+ timeval aNow;
+ gettimeofday( &aNow, 0 );
+
+ if( (aNow.tv_sec - aLast.tv_sec) > 0 )
{
ClearableMutexGuard aGuard(This->m_aMutex);
::std::list< SelectionAdaptor* > aChangeList;
- nLast = nNow;
+
for( ::std::hash_map< Atom, Selection* >::iterator it = This->m_aSelections.begin(); it != This->m_aSelections.end(); ++it )
{
if( it->first != This->m_nXdndSelection && ! it->second->m_bOwner )
@@ -3121,6 +3497,7 @@ void SelectionManager::run( void* pThis )
aChangeList.front()->fireContentsChanged();
aChangeList.pop_front();
}
+ aLast = aNow;
}
}
#ifdef DEBUG
@@ -3163,6 +3540,7 @@ void SelectionManager::deregisterHandler( Atom selection )
m_aSelections.find( selection );
if( it != m_aSelections.end() )
{
+ delete it->second->m_pPixmap;
delete it->second;
m_aSelections.erase( it );
}
diff --git a/dtrans/source/X11/X11_selection.hxx b/dtrans/source/X11/X11_selection.hxx
index cade8a91497a..a840ea99154b 100644
--- a/dtrans/source/X11/X11_selection.hxx
+++ b/dtrans/source/X11/X11_selection.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: X11_selection.hxx,v $
*
- * $Revision: 1.21 $
+ * $Revision: 1.22 $
*
- * last change: $Author: pl $ $Date: 2002-11-22 16:13:03 $
+ * last change: $Author: hr $ $Date: 2003-03-25 14:05:28 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -90,6 +90,10 @@
#include <com/sun/star/lang/XServiceInfo.hpp>
#endif
+#ifndef _COM_SUN_STAR_SCRIPT_XINVOCATION_HPP_
+#include <com/sun/star/script/XInvocation.hpp>
+#endif
+
#ifndef _OSL_THREAD_H_
#include <osl/thread.h>
#endif
@@ -115,6 +119,8 @@ using namespace ::com::sun::star::uno;
namespace x11 {
+ class PixmapHolder; // in bmp.hxx
+
// ------------------------------------------------------------------------
rtl_TextEncoding getTextPlainEncoding( const ::rtl::OUString& rMimeType );
@@ -251,27 +257,31 @@ namespace x11 {
SelectionAdaptor* m_pAdaptor;
Atom m_aAtom;
::osl::Condition m_aDataArrived;
- Sequence< sal_Int8 >
- m_aData;
+ Sequence< sal_Int8 > m_aData;
Sequence< ::com::sun::star::datatransfer::DataFlavor >
- m_aTypes;
+ m_aTypes;
Sequence< Atom > m_aNativeTypes;
// this is used for caching
// m_aTypes is invalid after 2 seconds
// m_aNativeTypes contains the corresponding original atom
+ Atom m_aRequestedType;
+ // m_aRequestedType is only valid while WaitingForResponse and WaitingFotData
int m_nLastTimestamp;
bool m_bHaveUTF16;
bool m_bHaveCompound;
bool m_bOwner;
Window m_aLastOwner;
+ PixmapHolder* m_pPixmap;
Selection() : m_eState( Inactive ),
m_pAdaptor( NULL ),
m_aAtom( None ),
+ m_aRequestedType( None ),
m_nLastTimestamp( 0 ),
m_bHaveUTF16( false ),
m_bOwner( false ),
- m_aLastOwner( None )
+ m_aLastOwner( None ),
+ m_pPixmap( NULL )
{}
};
@@ -305,6 +315,8 @@ namespace x11 {
Window m_aWindow;
Reference< ::com::sun::star::awt::XDisplayConnection >
m_xDisplayConnection;
+ Reference< com::sun::star::script::XInvocation >
+ m_xBitmapConverter;
// members used for Xdnd
@@ -379,6 +391,7 @@ namespace x11 {
Atom m_nTEXTAtom;
Atom m_nINCRAtom;
Atom m_nCOMPOUNDAtom;
+ Atom m_nMULTIPLEAtom;
Atom m_nUTF16Atom;
Atom m_nXdndAware;
Atom m_nXdndEnter;
@@ -418,6 +431,7 @@ namespace x11 {
~SelectionManager();
SelectionAdaptor* getAdaptor( Atom selection );
+ PixmapHolder* getPixmapHolder( Atom selection );
// handle various events
void handleSelectionRequest( XSelectionRequestEvent& rRequest );
@@ -443,6 +457,7 @@ namespace x11 {
Atom nSelection,
int & rFormat,
Sequence< sal_Int8 >& rData );
+ bool sendData( SelectionAdaptor* pAdaptor, Window requestor, Atom target, Atom property, Atom selection );
// thread dispatch loop
static void run( void* );
diff --git a/dtrans/source/X11/bmp.cxx b/dtrans/source/X11/bmp.cxx
new file mode 100644
index 000000000000..8d2f2fcbb62a
--- /dev/null
+++ b/dtrans/source/X11/bmp.cxx
@@ -0,0 +1,764 @@
+/*************************************************************************
+ *
+ * $RCSfile: bmp.cxx,v $
+ *
+ * $Revision: 1.2 $
+ *
+ * last change: $Author: hr $ $Date: 2003-03-25 14:05:29 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (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.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <unistd.h>
+#include <cstdio>
+#include <cstring>
+
+#include <bmp.hxx>
+
+#include <X11_selection.hxx>
+
+using namespace x11;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::script;
+using namespace com::sun::star::awt;
+using namespace rtl;
+
+/*
+ * helper functions
+ */
+
+inline void writeLE( sal_uInt16 nNumber, sal_uInt8* pBuffer )
+{
+ pBuffer[ 0 ] = (nNumber & 0xff);
+ pBuffer[ 1 ] = ((nNumber>>8)&0xff);
+}
+
+inline void writeLE( sal_uInt32 nNumber, sal_uInt8* pBuffer )
+{
+ pBuffer[ 0 ] = (nNumber & 0xff);
+ pBuffer[ 1 ] = ((nNumber>>8)&0xff);
+ pBuffer[ 2 ] = ((nNumber>>16)&0xff);
+ pBuffer[ 3 ] = ((nNumber>>24)&0xff);
+}
+
+inline sal_uInt16 readLE16( const sal_uInt8* pBuffer )
+{
+ return (((sal_uInt16)pBuffer[1]) << 8 ) | pBuffer[0];
+}
+
+inline sal_uInt16 readLE32( const sal_uInt8* pBuffer )
+{
+ return
+ (((sal_uInt32)pBuffer[3]) << 24 ) |
+ (((sal_uInt32)pBuffer[2]) << 16 ) |
+ (((sal_uInt32)pBuffer[1]) << 8 ) |
+ pBuffer[0];
+}
+
+
+/*
+ * BmpTransporter
+ */
+
+BmpTransporter::BmpTransporter( const Sequence<sal_Int8>& rBmp ) :
+ m_aBM( rBmp )
+{
+ const sal_uInt8* pData = (const sal_uInt8*)rBmp.getConstArray();
+
+ if( pData[0] == 'B' || pData[1] == 'M' )
+ {
+ pData = pData+14;
+ m_aSize.Width = readLE32( pData+4 );
+ m_aSize.Height = readLE32( pData+8 );
+ }
+ else
+ m_aSize.Width = m_aSize.Height = 0;
+}
+
+BmpTransporter::~BmpTransporter()
+{
+}
+
+com::sun::star::awt::Size SAL_CALL BmpTransporter::getSize() throw()
+{
+ return m_aSize;
+}
+
+Sequence< sal_Int8 > SAL_CALL BmpTransporter::getDIB() throw()
+{
+ return m_aBM;
+}
+
+Sequence< sal_Int8 > SAL_CALL BmpTransporter::getMaskDIB() throw()
+{
+ return Sequence< sal_Int8 >();
+}
+
+/*
+ * scanline helpers
+ */
+
+inline void X11_writeScanlinePixel( unsigned long nColor, sal_uInt8* pScanline, int depth, int x )
+{
+ switch( depth )
+ {
+ case 1:
+ pScanline[ x/8 ] &= ~(1 << (x&7));
+ pScanline[ x/8 ] |= ((nColor & 1) << (x&7));
+ break;
+ case 4:
+ pScanline[ x/2 ] &= ((x&1) ? 0x0f : 0xf0);
+ pScanline[ x/2 ] |= ((x&1) ? (nColor & 0x0f) : ((nColor & 0x0f) << 4));
+ break;
+ default:
+ case 8:
+ pScanline[ x ] = (nColor & 0xff);
+ break;
+ }
+}
+
+static sal_uInt8* X11_getPaletteBmpFromImage(
+ Display* pDisplay,
+ XImage* pImage,
+ Colormap aColormap,
+ sal_Int32& rOutSize
+ )
+{
+ sal_uInt32 nColors = 0;
+
+ rOutSize = 0;
+
+ sal_uInt8* pBuffer = 0;
+ sal_uInt32 nHeaderSize, nScanlineSize;
+ sal_uInt16 nBitCount;
+ // determine header and scanline size
+ switch( pImage->depth )
+ {
+ case 1:
+ nHeaderSize = 64;
+ nScanlineSize = (pImage->width+31)/32;
+ nBitCount = 1;
+ break;
+ case 4:
+ nHeaderSize = 72;
+ nScanlineSize = (pImage->width+1)/2;
+ nBitCount = 4;
+ break;
+ default:
+ case 8:
+ nHeaderSize = 1084;
+ nScanlineSize = pImage->width;
+ nBitCount = 8;
+ break;
+ }
+ // adjust scan lines to begin on %4 boundaries
+ if( nScanlineSize & 3 )
+ {
+ nScanlineSize &= 0xfffffffc;
+ nScanlineSize += 4;
+ }
+
+ // allocate buffer to hold header and scanlines, initialize to zero
+ rOutSize = nHeaderSize + nScanlineSize*pImage->height;
+ pBuffer = (sal_uInt8*)rtl_allocateZeroMemory( rOutSize );
+ for( int y = 0; y < pImage->height; y++ )
+ {
+ sal_uInt8* pScanline = pBuffer + nHeaderSize + (pImage->height-1-y)*nScanlineSize;
+ for( int x = 0; x < pImage->width; x++ )
+ {
+ unsigned long nPixel = XGetPixel( pImage, x, y );
+ if( nPixel >= nColors )
+ nColors = nPixel+1;
+ X11_writeScanlinePixel( nPixel, pScanline, pImage->depth, x );
+ }
+ }
+
+ // fill in header fields
+ pBuffer[ 0 ] = 'B';
+ pBuffer[ 1 ] = 'M';
+
+ writeLE( nHeaderSize, pBuffer+10 );
+ writeLE( (sal_uInt32)40, pBuffer+14 );
+ writeLE( (sal_uInt32)pImage->width, pBuffer+18 );
+ writeLE( (sal_uInt32)pImage->height, pBuffer+22 );
+ writeLE( (sal_uInt16)1, pBuffer+26 );
+ writeLE( nBitCount, pBuffer+28 );
+ writeLE( (sal_uInt32)(DisplayWidth(pDisplay,DefaultScreen(pDisplay))*1000/DisplayWidthMM(pDisplay,DefaultScreen(pDisplay))), pBuffer+38);
+ writeLE( (sal_uInt32)(DisplayHeight(pDisplay,DefaultScreen(pDisplay))*1000/DisplayHeightMM(pDisplay,DefaultScreen(pDisplay))), pBuffer+42);
+ writeLE( nColors, pBuffer+46 );
+ writeLE( nColors, pBuffer+50 );
+
+ XColor aColors[256];
+ if( nColors > (1<<nBitCount) ) // paranoia
+ nColors = (1 << nBitCount);
+ for( unsigned long nPixel = 0; nPixel < nColors; nPixel++ )
+ {
+ aColors[nPixel].flags = DoRed | DoGreen | DoBlue;
+ aColors[nPixel].pixel = nPixel;
+ }
+ XQueryColors( pDisplay, aColormap, aColors, nColors );
+ for( sal_uInt32 i = 0; i < nColors; i++ )
+ {
+ pBuffer[ 54 + i*4 ] = (sal_uInt8)(aColors[i].blue >> 8);
+ pBuffer[ 55 + i*4 ] = (sal_uInt8)(aColors[i].green >> 8);
+ pBuffer[ 56 + i*4 ] = (sal_uInt8)(aColors[i].red >> 8);
+ }
+
+ // done
+
+ return pBuffer;
+}
+
+inline unsigned long doRightShift( unsigned long nValue, int nShift )
+{
+ return (nShift > 0) ? (nValue >> nShift) : (nValue << (-nShift));
+}
+
+inline unsigned long doLeftShift( unsigned long nValue, int nShift )
+{
+ return (nShift > 0) ? (nValue << nShift) : (nValue >> (-nShift));
+}
+
+static void getShift( unsigned long nMask, int& rShift, int& rSigBits, int& rShift2 )
+{
+ unsigned long nUseMask = nMask;
+ rShift = 0;
+ while( nMask & 0xffffff00 )
+ {
+ rShift++;
+ nMask >>= 1;
+ }
+ if( rShift == 0 )
+ while( ! (nMask & 0x00000080) )
+ {
+ rShift--;
+ nMask <<= 1;
+ }
+
+ int nRotate = sizeof(unsigned long)*8 - rShift;
+ rSigBits = 0;
+ nMask = doRightShift( nUseMask, rShift) ;
+ while( nRotate-- )
+ {
+ if( nMask & 1 )
+ rSigBits++;
+ nMask >>= 1;
+ }
+
+ rShift2 = 0;
+ if( rSigBits < 8 )
+ rShift2 = 8-rSigBits;
+}
+
+static sal_uInt8* X11_getTCBmpFromImage(
+ Display* pDisplay,
+ XImage* pImage,
+ sal_Int32& rOutSize,
+ int nScreenNo
+ )
+{
+ // get masks from visual info (guesswork)
+ XVisualInfo aVInfo;
+ if( ! XMatchVisualInfo( pDisplay, nScreenNo, pImage->depth, TrueColor, &aVInfo ) )
+ return NULL;
+
+ rOutSize = 0;
+
+ sal_uInt8* pBuffer = 0;
+ sal_uInt32 nHeaderSize = 60;
+ sal_uInt32 nScanlineSize = pImage->width*3;
+
+ // adjust scan lines to begin on %4 boundaries
+ if( nScanlineSize & 3 )
+ {
+ nScanlineSize &= 0xfffffffc;
+ nScanlineSize += 4;
+ }
+ int nRedShift, nRedSig, nRedShift2 = 0;
+ getShift( aVInfo.red_mask, nRedShift, nRedSig, nRedShift2 );
+ int nGreenShift, nGreenSig, nGreenShift2 = 0;
+ getShift( aVInfo.green_mask, nGreenShift, nGreenSig, nGreenShift2 );
+ int nBlueShift, nBlueSig, nBlueShift2 = 0;
+ getShift( aVInfo.blue_mask, nBlueShift, nBlueSig, nBlueShift2 );
+
+ // allocate buffer to hold header and scanlines, initialize to zero
+ rOutSize = nHeaderSize + nScanlineSize*pImage->height;
+ pBuffer = (sal_uInt8*)rtl_allocateZeroMemory( rOutSize );
+ for( int y = 0; y < pImage->height; y++ )
+ {
+ sal_uInt8* pScanline = pBuffer + nHeaderSize + (pImage->height-1-y)*nScanlineSize;
+ for( int x = 0; x < pImage->width; x++ )
+ {
+ unsigned long nPixel = XGetPixel( pImage, x, y );
+
+ sal_uInt8 nValue = (sal_uInt8)doRightShift( nPixel&aVInfo.blue_mask, nBlueShift);
+ if( nBlueShift2 )
+ nValue |= (nValue >> nBlueShift2 );
+ *pScanline++ = nValue;
+
+ nValue = (sal_uInt8)doRightShift( nPixel&aVInfo.green_mask, nGreenShift);
+ if( nGreenShift2 )
+ nValue |= (nValue >> nGreenShift2 );
+ *pScanline++ = nValue;
+
+ nValue = (sal_uInt8)doRightShift( nPixel&aVInfo.red_mask, nRedShift);
+ if( nRedShift2 )
+ nValue |= (nValue >> nRedShift2 );
+ *pScanline++ = nValue;
+ }
+ }
+
+ // fill in header fields
+ pBuffer[ 0 ] = 'B';
+ pBuffer[ 1 ] = 'M';
+
+ writeLE( nHeaderSize, pBuffer+10 );
+ writeLE( (sal_uInt32)40, pBuffer+14 );
+ writeLE( (sal_uInt32)pImage->width, pBuffer+18 );
+ writeLE( (sal_uInt32)pImage->height, pBuffer+22 );
+ writeLE( (sal_uInt16)1, pBuffer+26 );
+ writeLE( (sal_uInt16)24, pBuffer+28 );
+ writeLE( (sal_uInt32)(DisplayWidth(pDisplay,DefaultScreen(pDisplay))*1000/DisplayWidthMM(pDisplay,DefaultScreen(pDisplay))), pBuffer+38);
+ writeLE( (sal_uInt32)(DisplayHeight(pDisplay,DefaultScreen(pDisplay))*1000/DisplayHeightMM(pDisplay,DefaultScreen(pDisplay))), pBuffer+42);
+
+ // done
+
+ return pBuffer;
+}
+
+sal_uInt8* x11::X11_getBmpFromPixmap(
+ Display* pDisplay,
+ Drawable aDrawable,
+ Colormap aColormap,
+ sal_Int32& rOutSize
+ )
+{
+ // get geometry of drawable
+ Window aRoot;
+ int x,y;
+ unsigned int w, h, bw, d;
+ XGetGeometry( pDisplay, aDrawable, &aRoot, &x, &y, &w, &h, &bw, &d );
+
+ // find which screen we are on
+ int nScreenNo = ScreenCount( pDisplay );
+ while( nScreenNo-- )
+ {
+ if( RootWindow( pDisplay, nScreenNo ) == aRoot )
+ break;
+ }
+ if( nScreenNo < 0 )
+ return NULL;
+
+ if( aColormap == None )
+ aColormap = DefaultColormap( pDisplay, nScreenNo );
+
+ // get the image
+ XImage* pImage = XGetImage( pDisplay, aDrawable, 0, 0, w, h, AllPlanes, ZPixmap );
+ if( ! pImage )
+ return NULL;
+
+ sal_uInt8* pBmp = d <= 8 ?
+ X11_getPaletteBmpFromImage( pDisplay, pImage, aColormap, rOutSize ) :
+ X11_getTCBmpFromImage( pDisplay, pImage, rOutSize, nScreenNo );
+ XDestroyImage( pImage );
+
+ return pBmp;
+}
+
+void x11::X11_freeBmp( sal_uInt8* pBmp )
+{
+ rtl_freeMemory( pBmp );
+}
+
+/*
+ * PixmapHolder
+ */
+
+PixmapHolder::PixmapHolder( Display* pDisplay ) :
+ m_pDisplay( pDisplay ),
+ m_aColormap( None ),
+ m_aPixmap( None )
+{
+ /* try to get a 24 bit true color visual, if that fails,
+ * revert to default visual
+ */
+ if( ! XMatchVisualInfo( m_pDisplay, DefaultScreen( m_pDisplay ), 24, TrueColor, &m_aInfo ) )
+ {
+#ifdef DEBUG
+ fprintf( stderr, "PixmapHolder reverting to default visual\n" );
+#endif
+ Visual* pVisual = DefaultVisual( m_pDisplay, DefaultScreen( m_pDisplay ) );
+ m_aInfo.screen = DefaultScreen( m_pDisplay );
+ m_aInfo.visual = pVisual;
+ m_aInfo.visualid = pVisual->visualid;
+ m_aInfo.c_class = pVisual->c_class;
+ m_aInfo.red_mask = pVisual->red_mask;
+ m_aInfo.green_mask = pVisual->green_mask;
+ m_aInfo.blue_mask = pVisual->blue_mask;
+ m_aInfo.depth = DefaultDepth( m_pDisplay, m_aInfo.screen );
+ }
+ m_aColormap = DefaultColormap( m_pDisplay, m_aInfo.screen );
+#ifdef DEBUG
+ static const char* pClasses[] =
+ { "StaticGray", "GrayScale", "StaticColor", "PseudoColor", "TrueColor", "DirectColor" };
+ fprintf( stderr, "PixmapHolder visual: id = 0x%x, class = %s (%d), depth=%d; color map = 0x%x\n",
+ m_aInfo.visualid,
+ (m_aInfo.c_class >= 0 && m_aInfo.c_class < sizeof(pClasses)/sizeof(pClasses[0])) ? pClasses[m_aInfo.c_class] : "<unknown>",
+ m_aInfo.c_class,
+ m_aInfo.depth,
+ m_aColormap );
+#endif
+ if( m_aInfo.c_class == TrueColor )
+ {
+ int nRedSig, nGreenSig, nBlueSig;
+ m_nRedShift = m_nRedShift2 = 0;
+ getShift( m_aInfo.red_mask, m_nRedShift, nRedSig, m_nRedShift2 );
+ m_nGreenShift = m_nGreenShift2 = 0;
+ getShift( m_aInfo.green_mask, m_nGreenShift, nGreenSig, m_nGreenShift2 );
+ m_nBlueShift = m_nBlueShift2 = 0;
+ getShift( m_aInfo.blue_mask, m_nBlueShift, nBlueSig, m_nBlueShift2 );
+
+ m_nBlueShift2Mask = m_nBlueShift2 ? ~((unsigned long)((1<<m_nBlueShift2)-1)) : ~0L;
+ m_nGreenShift2Mask = m_nGreenShift2 ? ~((unsigned long)((1<<m_nGreenShift2)-1)) : ~0L;
+ m_nRedShift2Mask = m_nRedShift2 ? ~((unsigned long)((1<<m_nRedShift2)-1)) : ~0L;
+ }
+}
+
+PixmapHolder::~PixmapHolder()
+{
+ if( m_aPixmap != None )
+ XFreePixmap( m_pDisplay, m_aPixmap );
+ if( m_aBitmap != None )
+ XFreePixmap( m_pDisplay, m_aBitmap );
+}
+
+unsigned long PixmapHolder::getTCPixel( sal_uInt8 r, sal_uInt8 g, sal_uInt8 b ) const
+{
+ unsigned long nPixel = 0;
+ unsigned long nValue = (unsigned long)b;
+ nValue &= m_nBlueShift2Mask;
+ nPixel |= doLeftShift( nValue, m_nBlueShift );
+
+ nValue = (unsigned long)g;
+ nValue &= m_nGreenShift2Mask;
+ nPixel |= doLeftShift( nValue, m_nGreenShift );
+
+ nValue = (unsigned long)r;
+ nValue &= m_nRedShift2Mask;
+ nPixel |= doLeftShift( nValue, m_nRedShift );
+
+ return nPixel;
+}
+
+void PixmapHolder::setBitmapDataPalette( const sal_uInt8* pData, XImage* pImage )
+{
+ // setup palette
+ XColor aPalette[256];
+
+ sal_uInt32 nColors = readLE32( pData+32 );
+ sal_uInt32 nWidth = readLE32( pData+4 );
+ sal_uInt32 nHeight = readLE32( pData+8 );
+ sal_uInt16 nDepth = readLE16( pData+14 );
+
+ for( sal_uInt16 i = 0 ; i < nColors; i++ )
+ {
+ if( m_aInfo.c_class != TrueColor )
+ {
+ aPalette[i].red = ((unsigned short)pData[42 + i*4]) << 8 | ((unsigned short)pData[42 + i*4]);
+ aPalette[i].green = ((unsigned short)pData[41 + i*4]) << 8 | ((unsigned short)pData[41 + i*4]);
+ aPalette[i].blue = ((unsigned short)pData[40 + i*4]) << 8 | ((unsigned short)pData[40 + i*4]);
+ XAllocColor( m_pDisplay, m_aColormap, aPalette+i );
+ }
+ else
+ aPalette[i].pixel = getTCPixel( pData[42+i*4], pData[41+i*4], pData[40+i*4] );
+ }
+ const sal_uInt8* pBMData = pData + readLE32( pData ) + 4*nColors;
+
+ sal_uInt32 nScanlineSize = 0;
+ switch( nDepth )
+ {
+ case 1:
+ nScanlineSize = (nWidth+31)/32;
+ break;
+ case 4:
+ nScanlineSize = (nWidth+1)/2;
+ break;
+ case 8:
+ nScanlineSize = nWidth;
+ break;
+ }
+ // adjust scan lines to begin on %4 boundaries
+ if( nScanlineSize & 3 )
+ {
+ nScanlineSize &= 0xfffffffc;
+ nScanlineSize += 4;
+ }
+
+ // allocate buffer to hold header and scanlines, initialize to zero
+ for( int y = 0; y < nHeight; y++ )
+ {
+ const sal_uInt8* pScanline = pBMData + (nHeight-1-y)*nScanlineSize;
+ for( int x = 0; x < nWidth; x++ )
+ {
+ int nCol = 0;
+ switch( nDepth )
+ {
+ case 1: nCol = (pScanline[ x/8 ] & (0x80 >> (x&7))) != 0 ? 0 : 1; break;
+ case 4:
+ if( x & 1 )
+ nCol = (int)(pScanline[ x/2 ] >> 4);
+ else
+ nCol = (int)(pScanline[ x/2 ] & 0x0f);
+ break;
+ case 8: nCol = (int)pScanline[x];
+ }
+ XPutPixel( pImage, x, y, aPalette[nCol].pixel );
+ }
+ }
+}
+
+void PixmapHolder::setBitmapDataTCDither( const sal_uInt8* pData, XImage* pImage )
+{
+ XColor aPalette[216];
+
+ int nNonAllocs = 0;
+
+ for( int r = 0; r < 6; r++ )
+ {
+ for( int g = 0; g < 6; g++ )
+ {
+ for( int b = 0; b < 6; b++ )
+ {
+ int i = r*36+g*6+b;
+ aPalette[i].red = r == 5 ? 0xffff : r*10922;
+ aPalette[i].green = g == 5 ? 0xffff : g*10922;
+ aPalette[i].blue = b == 5 ? 0xffff : b*10922;
+ aPalette[i].pixel = 0;
+ if( ! XAllocColor( m_pDisplay, m_aColormap, aPalette+i ) )
+ nNonAllocs++;
+ }
+ }
+ }
+
+ if( nNonAllocs )
+ {
+ XColor aRealPalette[256];
+ int nColors = 1 << m_aInfo.depth;
+ int i;
+ for( i = 0; i < nColors; i++ )
+ aRealPalette[i].pixel = (unsigned long)i;
+ XQueryColors( m_pDisplay, m_aColormap, aRealPalette, nColors );
+ for( i = 0; i < nColors; i++ )
+ {
+ sal_uInt8 nIndex =
+ 36*(sal_uInt8)(aRealPalette[i].red/10923) +
+ 6*(sal_uInt8)(aRealPalette[i].green/10923) +
+ (sal_uInt8)(aRealPalette[i].blue/10923);
+ if( aPalette[nIndex].pixel == 0 )
+ aPalette[nIndex] = aRealPalette[i];
+ }
+ }
+
+ sal_uInt32 nWidth = readLE32( pData+4 );
+ sal_uInt32 nHeight = readLE32( pData+8 );
+
+ const sal_uInt8* pBMData = pData + readLE32( pData );
+ sal_uInt32 nScanlineSize = nWidth*3;
+ // adjust scan lines to begin on %4 boundaries
+ if( nScanlineSize & 3 )
+ {
+ nScanlineSize &= 0xfffffffc;
+ nScanlineSize += 4;
+ }
+
+ for( int y = 0; y < (int)nHeight; y++ )
+ {
+ const sal_uInt8* pScanline = pBMData + (nHeight-1-(sal_uInt32)y)*nScanlineSize;
+ for( int x = 0; x < (int)nWidth; x++ )
+ {
+ sal_uInt8 b = pScanline[3*x];
+ sal_uInt8 g = pScanline[3*x+1];
+ sal_uInt8 r = pScanline[3*x+2];
+ sal_uInt8 i = 36*(r/43) + 6*(g/43) + (b/43);
+
+ XPutPixel( pImage, x, y, aPalette[ i ].pixel );
+ }
+ }
+}
+
+void PixmapHolder::setBitmapDataTC( const sal_uInt8* pData, XImage* pImage )
+{
+ sal_uInt32 nWidth = readLE32( pData+4 );
+ sal_uInt32 nHeight = readLE32( pData+8 );
+
+ const sal_uInt8* pBMData = pData + readLE32( pData );
+ sal_uInt32 nScanlineSize = nWidth*3;
+ // adjust scan lines to begin on %4 boundaries
+ if( nScanlineSize & 3 )
+ {
+ nScanlineSize &= 0xfffffffc;
+ nScanlineSize += 4;
+ }
+
+ for( int y = 0; y < (int)nHeight; y++ )
+ {
+ const sal_uInt8* pScanline = pBMData + (nHeight-1-(sal_uInt32)y)*nScanlineSize;
+ for( int x = 0; x < (int)nWidth; x++ )
+ {
+ unsigned long nPixel = getTCPixel( pScanline[3*x+2], pScanline[3*x+1], pScanline[3*x] );
+ XPutPixel( pImage, x, y, nPixel );
+ }
+ }
+}
+
+bool PixmapHolder::needsConversion( const sal_uInt8* pData )
+{
+ if( pData[0] != 'B' || pData[1] != 'M' )
+ return true;
+
+ pData = pData+14;
+ sal_uInt32 nDepth = readLE32( pData+14 );
+ if( nDepth == 24 )
+ {
+ if( m_aInfo.c_class != TrueColor )
+ return true;
+ }
+ else if( nDepth != (sal_uInt32)m_aInfo.depth )
+ {
+ if( m_aInfo.c_class != TrueColor )
+ return true;
+ }
+
+ return false;
+}
+
+Pixmap PixmapHolder::setBitmapData( const sal_uInt8* pData )
+{
+ if( pData[0] != 'B' || pData[1] != 'M' )
+ return None;
+
+ pData = pData+14;
+
+ // reject compressed data
+ if( readLE32( pData + 16 ) != 0 )
+ return None;
+
+ sal_uInt32 nWidth = readLE32( pData+4 );
+ sal_uInt32 nHeight = readLE32( pData+8 );
+
+ m_aPixmap = XCreatePixmap( m_pDisplay,
+ RootWindow( m_pDisplay, m_aInfo.screen ),
+ nWidth, nHeight, m_aInfo.depth );
+
+ if( m_aPixmap != None )
+ {
+ XImage aImage;
+ aImage.width = (int)nWidth;
+ aImage.height = (int)nHeight;
+ aImage.xoffset = 0;
+ aImage.format = ZPixmap;
+ aImage.data = NULL;
+ aImage.byte_order = ImageByteOrder( m_pDisplay );
+ aImage.bitmap_unit = BitmapUnit( m_pDisplay );
+ aImage.bitmap_bit_order = BitmapBitOrder( m_pDisplay );
+ aImage.bitmap_pad = BitmapPad( m_pDisplay );
+ aImage.depth = m_aInfo.depth;
+ aImage.red_mask = m_aInfo.red_mask;
+ aImage.green_mask = m_aInfo.green_mask;
+ aImage.blue_mask = m_aInfo.blue_mask;
+ aImage.bytes_per_line = 0; // filled in by XInitImage
+ if( m_aInfo.depth <= 8 )
+ aImage.bits_per_pixel = m_aInfo.depth;
+ else
+ aImage.bits_per_pixel = 8*((m_aInfo.depth+7)/8);
+ aImage.obdata = NULL;
+
+ XInitImage( &aImage );
+ aImage.data = (char*)rtl_allocateMemory( nHeight*aImage.bytes_per_line );
+
+ if( readLE32( pData+14 ) == 24 )
+ {
+ if( m_aInfo.c_class == TrueColor )
+ setBitmapDataTC( pData, &aImage );
+ else
+ setBitmapDataTCDither( pData, &aImage );
+ }
+ else
+ setBitmapDataPalette( pData, &aImage );
+
+ // put the image
+ XPutImage( m_pDisplay,
+ m_aPixmap,
+ DefaultGC( m_pDisplay, m_aInfo.screen ),
+ &aImage,
+ 0, 0,
+ 0, 0,
+ nWidth, nHeight );
+
+ // clean up
+ rtl_freeMemory( aImage.data );
+
+ // prepare bitmap (mask)
+ m_aBitmap = XCreatePixmap( m_pDisplay,
+ RootWindow( m_pDisplay, m_aInfo.screen ),
+ nWidth, nHeight, 1 );
+ XGCValues aVal;
+ aVal.function = GXcopy;
+ aVal.foreground = 0xffffffff;
+ GC aGC = XCreateGC( m_pDisplay, m_aBitmap, GCFunction | GCForeground, &aVal );
+ XFillRectangle( m_pDisplay, m_aBitmap, aGC, 0, 0, nWidth, nHeight );
+ XFreeGC( m_pDisplay, aGC );
+ }
+
+ return m_aPixmap;
+}
diff --git a/dtrans/source/X11/bmp.hxx b/dtrans/source/X11/bmp.hxx
new file mode 100644
index 000000000000..13ccdb3b3c20
--- /dev/null
+++ b/dtrans/source/X11/bmp.hxx
@@ -0,0 +1,142 @@
+/*************************************************************************
+ *
+ * $RCSfile: bmp.hxx,v $
+ *
+ * $Revision: 1.2 $
+ *
+ * last change: $Author: hr $ $Date: 2003-03-25 14:05:29 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (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.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRUNTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRUNTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc..
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _DTRANS_BMP_HXX_
+#define _DTRANS_BMP_HXX_
+
+#include <X11/Xatom.h>
+#include <X11/keysym.h>
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+
+#include <sal/types.h>
+
+#ifndef _COM_SUN_STAR_AWT_XBITMAP_HPP_
+#include <com/sun/star/awt/XBitmap.hpp>
+#endif
+#ifndef _CPPUHELPER_COMPBASE1_HXX_
+#include <cppuhelper/compbase1.hxx>
+#endif
+
+
+
+namespace x11 {
+
+// helper methods
+sal_uInt8* X11_getBmpFromPixmap( Display* pDisplay,
+ Drawable aDrawable,
+ Colormap aColormap,
+ sal_Int32& rOutSize );
+
+void X11_freeBmp( sal_uInt8* pBmp );
+
+class PixmapHolder
+{
+ Display* m_pDisplay;
+ Colormap m_aColormap;
+ Pixmap m_aPixmap;
+ Pixmap m_aBitmap;
+ XVisualInfo m_aInfo;
+
+ int m_nRedShift, m_nRedShift2;
+ int m_nGreenShift, m_nGreenShift2;
+ int m_nBlueShift, m_nBlueShift2;
+ unsigned long m_nBlueShift2Mask, m_nRedShift2Mask, m_nGreenShift2Mask;
+
+ // these expect data pointers to bitmapinfo header
+ void setBitmapDataTC( const sal_uInt8* pData, XImage* pImage );
+ void setBitmapDataTCDither( const sal_uInt8* pData, XImage* pImage );
+ void setBitmapDataPalette( const sal_uInt8* pData, XImage* pImage );
+
+ unsigned long getTCPixel( sal_uInt8 r, sal_uInt8 g, sal_uInt8 b ) const;
+public:
+ PixmapHolder( Display* pDisplay );
+ ~PixmapHolder();
+
+ // accepts bitmap file (including bitmap file header)
+ Pixmap setBitmapData( const sal_uInt8* pData );
+ bool needsConversion( const sal_uInt8* pData );
+
+ Colormap getColormap() const { return m_aColormap; }
+ Pixmap getPixmap() const { return m_aPixmap; }
+ Pixmap getBitmap() const { return m_aBitmap; }
+ VisualID getVisualID() const { return m_aInfo.visualid; }
+ int getClass() const { return m_aInfo.c_class; }
+ int getDepth() const { return m_aInfo.depth; }
+};
+
+class BmpTransporter :
+ public cppu::WeakImplHelper1< com::sun::star::awt::XBitmap >
+{
+ com::sun::star::uno::Sequence<sal_Int8> m_aBM;
+ com::sun::star::awt::Size m_aSize;
+public:
+ BmpTransporter( const com::sun::star::uno::Sequence<sal_Int8>& rBmp );
+ virtual ~BmpTransporter();
+
+ virtual com::sun::star::awt::Size SAL_CALL getSize() throw();
+ virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getDIB() throw();
+ virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getMaskDIB() throw();
+};
+
+}
+
+#endif
diff --git a/dtrans/source/X11/dtransX11.xml b/dtrans/source/X11/dtransX11.xml
index bcfeacfb64f9..77994d5287b5 100644
--- a/dtrans/source/X11/dtransX11.xml
+++ b/dtrans/source/X11/dtransX11.xml
@@ -27,8 +27,6 @@
<type> com.sun.star.datatransfer.dnd.DNDConstants </type>
<type> com.sun.star.datatransfer.dnd.XDragSource </type>
<type> com.sun.star.datatransfer.dnd.XDragSourceContext </type>
- <type> com.sun.star.awt.MouseButton </type>
- <type> com.sun.star.awt.MouseEvent </type>
<type> com.sun.star.awt.XDisplayConnection </type>
<type> com.sun.star.lang.DisposedException </type>
<type> com.sun.star.lang.IllegalArgumentException </type>
diff --git a/dtrans/source/X11/makefile.mk b/dtrans/source/X11/makefile.mk
index 1c3e41b2d411..5d41319b4ea0 100644
--- a/dtrans/source/X11/makefile.mk
+++ b/dtrans/source/X11/makefile.mk
@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.5 $
+# $Revision: 1.6 $
#
-# last change: $Author: pl $ $Date: 2001-12-11 17:48:36 $
+# last change: $Author: hr $ $Date: 2003-03-25 14:05:30 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
@@ -95,7 +95,8 @@ SLOFILES=\
$(SLO)$/X11_clipboard.obj \
$(SLO)$/X11_selection.obj \
$(SLO)$/X11_droptarget.obj \
- $(SLO)$/X11_service.obj
+ $(SLO)$/X11_service.obj \
+ $(SLO)$/bmp.obj
SHL1TARGET= $(TARGET)$(UPD)$(DLLPOSTFIX)
diff --git a/dtrans/source/aqua/dtransaqua.xml b/dtrans/source/aqua/dtransaqua.xml
index 6da3bda336ec..5156b6bf8a91 100644
--- a/dtrans/source/aqua/dtransaqua.xml
+++ b/dtrans/source/aqua/dtransaqua.xml
@@ -1,50 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE module-description PUBLIC "-//StarOffice//DTD ComponentDescription 1.0//EN" "module-description.dtd">
-<module-description xmlns:xlink="http://www.w3.org/1999/xlink">
- <module-name> dtransaqua </module-name>
- <component-description>
- <author> Tino Rachui </author>
- <name> com.sun.star.comp.datatransfer.aqua </name>
- <description>
- The Aqua implementation of the datatransfer service.
-</description>
- <loader-name> com.sun.star.loader.SharedLibrary </loader-name>
- <language> c++ </language>
- <status value="beta"/>
- <supported-service> com.sun.star.datatransfer.clipboard.SystemClipboard </supported-service>
- <supported-service> com.sun.star.datatransfer.dnd.AquaDragSource </supported-service>
- <supported-service> com.sun.star.datatransfer.dnd.AquaDropTarget </supported-service>
- <service-dependency> ... </service-dependency>
- <type> com.sun.star.datatransfer.clipboard.XClipboardEx </type>
- <type> com.sun.star.datatransfer.XTransferable </type>
- <type> com.sun.star.datatransfer.clipboard.RenderingCapabilities </type>
- <type> com.sun.star.datatransfer.clipboard.XClipboardOwner </type>
- <type> com.sun.star.datatransfer.clipboard.XClipboardListener </type>
- <type> com.sun.star.datatransfer.clipboard.XClipboardNotifier </type>
- <type> com.sun.star.datatransfer.dnd.XDropTargetDropContext </type>
- <type> com.sun.star.datatransfer.dnd.XDropTargetDragContext </type>
- <type> com.sun.star.datatransfer.dnd.XDropTarget </type>
- <type> com.sun.star.datatransfer.dnd.DNDConstants </type>
- <type> com.sun.star.datatransfer.dnd.XDragSource </type>
- <type> com.sun.star.datatransfer.dnd.XDragSourceContext </type>
- <type> com.sun.star.awt.XDisplayConnection </type>
- <type> com.sun.star.lang.DisposedException </type>
- <type> com.sun.star.lang.IllegalArgumentException </type>
- <type> com.sun.star.lang.XComponent </type>
- <type> com.sun.star.lang.XMultiServiceFactory </type>
- <type> com.sun.star.lang.XSingleServiceFactory </type>
- <type> com.sun.star.lang.XServiceInfo </type>
- <type> com.sun.star.lang.XTypeProvider </type>
- <type> com.sun.star.uno.TypeClass </type>
- <type> com.sun.star.uno.XWeak </type>
- <type> com.sun.star.uno.XAggregation </type>
- <type> com.sun.star.registry.XRegistryKey </type>
- <type> com.sun.star.container.XSet </type>
- </component-description>
- <project-build-dependency> cppuhelper </project-build-dependency>
- <project-build-dependency> cppu </project-build-dependency>
- <project-build-dependency> sal </project-build-dependency>
- <runtime-module-dependency> cppuhelper </runtime-module-dependency>
- <runtime-module-dependency> cppu2 </runtime-module-dependency>
- <runtime-module-dependency> sal2 </runtime-module-dependency>
-</module-description>
+<!DOCTYPE COMPONENTDESCRIPTION PUBLIC "-//StarOffice//DTD ComponentDescription 1.0//EN" "componentdescription.dtd">
+
+<COMPONENTDESCRIPTION
+ xmlns:xlink="http://www.w3.org/1999/xlink/Namespace" >
+
+<Author> Tino Rachui </Author>
+
+<Name> com.sun.star.comp.datatransfer.clipboard </Name>
+
+<Description>
+ The win32 implementation of the datatransfer service.
+</Description>
+
+<ModuleName> sysdtrans </ModuleName>
+
+<LoaderName> com.sun.star.loader.SharedLibrary </LoaderName>
+
+<Language> c++ </Language>
+
+<Status StatusValue="experimental"/>
+
+<SupportedService> com.sun.star.datatransfer.clipboard.SystemClipboard </SupportedService>
+
+<ServiceDependency> ... </ServiceDependency>
+
+<ProjectBuildDependency> cppuhelper </ProjectBuildDependency>
+<ProjectBuildDependency> cppu </ProjectBuildDependency>
+<ProjectBuildDependency> sal </ProjectBuildDependency>
+
+<RuntimeModuleDependency> cppuhelper </RuntimeModuleDependency>
+<RuntimeModuleDependency> cppu2 </RuntimeModuleDependency>
+<RuntimeModuleDependency> sal2 </RuntimeModuleDependency>
+
+<Type> com.sun.star.datatransfer.clipboard.XClipboardEx </Type>
+<Type> com.sun.star.datatransfer.XTransferable </Type>
+<Type> com.sun.star.datatransfer.XTransferableEx </Type>
+<Type> com.sun.star.datatransfer.clipboard.XClipboardOwner</Type>
+<Type> com.sun.star.datatransfer.clipboard.XClipboardListener</Type>
+<Type> com.sun.star.datatransfer.clipboard.XClipboardNotifier</Type>
+<Type> com.sun.star.datatransfer.XTransferDataAccess </Type>
+<Type> com.sun.star.lang.XComponent </Type>
+<Type> com.sun.star.lang.XMultiServiceFactory </Type>
+<Type> com.sun.star.lang.XSingleServiceFactory </Type>
+<Type> com.sun.star.lang.XServiceInfo </Type>
+<Type> com.sun.star.lang.XTypeProvider </Type>
+<Type> com.sun.star.lang.IllegalArgumentException </Type>
+<Type> com.sun.star.uno.TypeClass </Type>
+<Type> com.sun.star.uno.XWeak </Type>
+<Type> com.sun.star.uno.XAggregation </Type>
+<Type> com.sun.star.registry.XRegistryKey </Type>
+<Type> com.sun.star.container.XSet </Type>
+
+</COMPONENTDESCRIPTION>
+
diff --git a/dtrans/source/cnttype/mcnttype.hxx b/dtrans/source/cnttype/mcnttype.hxx
index f0a893415cc8..95edd7e6c0b2 100644
--- a/dtrans/source/cnttype/mcnttype.hxx
+++ b/dtrans/source/cnttype/mcnttype.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: mcnttype.hxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: mh $ $Date: 2001-08-23 09:07:21 $
+ * last change: $Author: hr $ $Date: 2003-03-25 14:05:33 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -67,8 +67,8 @@
// includes
//------------------------------------------------------------------------
-#ifndef _CPPUHELPER_IMPLBASE1_HXX_
-#include <cppuhelper/implbase1.hxx>
+#ifndef _CPPUHELPER_COMPBASE1_HXX_
+#include <cppuhelper/compbase1.hxx>
#endif
#ifndef _RTL_USTRING_
diff --git a/dtrans/source/win32/clipb/APNDataObject.hxx b/dtrans/source/win32/clipb/APNDataObject.hxx
new file mode 100644
index 000000000000..7bee367a59cc
--- /dev/null
+++ b/dtrans/source/win32/clipb/APNDataObject.hxx
@@ -0,0 +1,127 @@
+/*************************************************************************
+ *
+ * $RCSfile: APNDataObject.hxx,v $
+ *
+ * $Revision: 1.3 $
+ *
+ * last change: $Author: hr $ $Date: 2003-03-25 14:05:33 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (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.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#ifndef _APNDATAOBJECT_HXX_
+#define _APNDATAOBJECT_HXX_
+
+//------------------------------------------------------------------------
+// includes
+//------------------------------------------------------------------------
+
+#include <comdef.h>
+
+//------------------------------------------------------------------------
+// deklarations
+//------------------------------------------------------------------------
+
+/*
+ an APartment Neutral dataobject wrapper; this wrapper of a IDataObject
+ pointer can be used from any apartment without RPC_E_WRONG_THREAD
+ which normally occurs if an apartment tries to use an interface
+ pointer of another apartment; we use containment to hold the original
+ DataObject
+*/
+class CAPNDataObject : public IDataObject
+{
+public:
+ CAPNDataObject( IDataObjectPtr rIDataObject );
+ ~CAPNDataObject( );
+
+ //-----------------------------------------------------------------
+ //IUnknown interface methods
+ //-----------------------------------------------------------------
+
+ STDMETHODIMP QueryInterface(REFIID iid, LPVOID* ppvObject);
+ STDMETHODIMP_( ULONG ) AddRef( );
+ STDMETHODIMP_( ULONG ) Release( );
+
+ //-----------------------------------------------------------------
+ // IDataObject interface methods
+ //-----------------------------------------------------------------
+
+ STDMETHODIMP GetData( LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium );
+ STDMETHODIMP GetDataHere( LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium );
+ STDMETHODIMP QueryGetData( LPFORMATETC pFormatetc );
+ STDMETHODIMP GetCanonicalFormatEtc( LPFORMATETC pFormatectIn, LPFORMATETC pFormatetcOut );
+ STDMETHODIMP SetData( LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium, BOOL fRelease );
+ STDMETHODIMP EnumFormatEtc( DWORD dwDirection, IEnumFORMATETC** ppenumFormatetc );
+ STDMETHODIMP DAdvise( LPFORMATETC pFormatetc, DWORD advf, LPADVISESINK pAdvSink, DWORD* pdwConnection );
+ STDMETHODIMP DUnadvise( DWORD dwConnection );
+ STDMETHODIMP EnumDAdvise( LPENUMSTATDATA* ppenumAdvise );
+
+ operator IDataObject*( );
+
+private:
+ HRESULT MarshalIDataObjectIntoCurrentApartment( IDataObject** ppIDataObj );
+
+private:
+ IDataObjectPtr m_rIDataObjectOrg;
+ HGLOBAL m_hGlobal;
+ LONG m_nRefCnt;
+
+// prevent copy and assignment
+private:
+ CAPNDataObject( const CAPNDataObject& theOther );
+ CAPNDataObject& operator=( const CAPNDataObject& theOther );
+};
+
+#endif \ No newline at end of file
diff --git a/dtrans/source/win32/clipb/makefile.mk b/dtrans/source/win32/clipb/makefile.mk
index 66e23d8929db..096b803a0d2f 100644
--- a/dtrans/source/win32/clipb/makefile.mk
+++ b/dtrans/source/win32/clipb/makefile.mk
@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.4 $
+# $Revision: 1.5 $
#
-# last change: $Author: jbu $ $Date: 2002-10-01 07:33:38 $
+# last change: $Author: hr $ $Date: 2003-03-25 14:05:34 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
@@ -82,7 +82,7 @@ stoponerror=tr
.INCLUDE : ..$/..$/cppumaker.mk
-CFLAGS+=/GR -DUNICODE -D_UNICODE
+CFLAGS+=-GR -DUNICODE -D_UNICODE
SLOFILES=$(SLO)$/WinClipboard.obj \
$(SLO)$/WinClipbImpl.obj \
diff --git a/dtrans/source/win32/dnd/makefile.mk b/dtrans/source/win32/dnd/makefile.mk
index b0f0e8602398..3be905c595b4 100644
--- a/dtrans/source/win32/dnd/makefile.mk
+++ b/dtrans/source/win32/dnd/makefile.mk
@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.9 $
+# $Revision: 1.10 $
#
-# last change: $Author: jbu $ $Date: 2002-10-01 07:33:39 $
+# last change: $Author: hr $ $Date: 2003-03-25 14:05:35 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
@@ -82,7 +82,7 @@ stoponerror=tr
.INCLUDE : ..$/..$/cppumaker.mk
-#CFLAGS+=/GR -DUNICODE -D_UNICODE
+#CFLAGS+=-GR -DUNICODE -D_UNICODE
#DBG_CONSOLE_OUT: when IDropTarget or IDropSource are called we write to a console
#DBG_CLIPBOARD_DATA: To provide DoDragDrop with an data object we call OleGetClipboard
diff --git a/dtrans/source/win32/dtobj/DOTransferable.cxx b/dtrans/source/win32/dtobj/DOTransferable.cxx
index a262895ef3e2..f712db05b714 100644
--- a/dtrans/source/win32/dtobj/DOTransferable.cxx
+++ b/dtrans/source/win32/dtobj/DOTransferable.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: DOTransferable.cxx,v $
*
- * $Revision: 1.16 $
+ * $Revision: 1.17 $
*
- * last change: $Author: ka $ $Date: 2002-07-20 10:35:05 $
+ * last change: $Author: hr $ $Date: 2003-03-25 14:05:36 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -455,15 +455,15 @@ OUString SAL_CALL CDOTransferable::synthesizeUnicodeText( )
// convert the text
sal_Int32 lStr = MultiByteToWideCharEx(
cpForTxtCnvt,
- reinterpret_cast< char* >( aTextSequence.getArray( ) ),
- aTextSequence.getLength(),
+ reinterpret_cast<char*>( aTextSequence.getArray( ) ),
+ -1,
stgTransferHelper,
sal_False);
CRawHGlobalPtr ptrHGlob(stgTransferHelper);
sal_Unicode* pWChar = reinterpret_cast<sal_Unicode*>(ptrHGlob.GetMemPtr());
- return OUString(pWChar, lStr);
+ return OUString(pWChar);
}
//------------------------------------------------------------------------
diff --git a/dtrans/source/win32/dtobj/DTransHelper.cxx b/dtrans/source/win32/dtobj/DTransHelper.cxx
index a48a1f3f02f2..832883b2ccd6 100644
--- a/dtrans/source/win32/dtobj/DTransHelper.cxx
+++ b/dtrans/source/win32/dtobj/DTransHelper.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: DTransHelper.cxx,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: tra $ $Date: 2001-11-05 09:38:17 $
+ * last change: $Author: hr $ $Date: 2003-03-25 14:05:36 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -253,7 +253,7 @@ sal_uInt32 SAL_CALL CStgTransferHelper::memSize( CLIPFORMAT cf ) const
sal_Char* pText = static_cast< sal_Char* >( GlobalLock( hGlob ) );
if ( pText )
{
- dwSize = strlen( pText );// + 1; // strlen + trailing '\0'
+ dwSize = strlen(pText) + 1; // strlen + trailing '\0'
GlobalUnlock( hGlob );
}
}
diff --git a/dtrans/source/win32/dtobj/TxtCnvtHlp.cxx b/dtrans/source/win32/dtobj/TxtCnvtHlp.cxx
index 697158947494..7a123c3525a7 100644
--- a/dtrans/source/win32/dtobj/TxtCnvtHlp.cxx
+++ b/dtrans/source/win32/dtobj/TxtCnvtHlp.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: TxtCnvtHlp.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: tra $ $Date: 2001-03-20 09:26:01 $
+ * last change: $Author: hr $ $Date: 2003-03-25 14:05:37 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -86,9 +86,9 @@ using namespace ::com::sun::star::uno;
// assuming a '\0' terminated string if no length specified
//------------------------------------------------------------------
-int CalcBuffSizeForTextConversion( LPCSTR lpMultiByteString, int nLen = -1 )
+int CalcBuffSizeForTextConversion( UINT code_page, LPCSTR lpMultiByteString, int nLen = -1 )
{
- return ( MultiByteToWideChar( CP_ACP,
+ return ( MultiByteToWideChar( code_page,
0,
lpMultiByteString,
nLen,
@@ -100,9 +100,9 @@ int CalcBuffSizeForTextConversion( LPCSTR lpMultiByteString, int nLen = -1 )
// assuming a '\0' terminated string if no length specified
//------------------------------------------------------------------
-int CalcBuffSizeForTextConversion( LPCWSTR lpWideCharString, int nLen = -1 )
+int CalcBuffSizeForTextConversion( UINT code_page, LPCWSTR lpWideCharString, int nLen = -1 )
{
- return WideCharToMultiByte( CP_ACP,
+ return WideCharToMultiByte( code_page,
0,
lpWideCharString,
nLen,
@@ -128,7 +128,7 @@ int MultiByteToWideCharEx( UINT cp_src,
OSL_ASSERT( NULL != lpMultiByteString );
// calculate the required buff size
- int reqSize = CalcBuffSizeForTextConversion( lpMultiByteString, lenStr );
+ int reqSize = CalcBuffSizeForTextConversion( cp_src, lpMultiByteString, lenStr );
if ( bEnsureTrailingZero )
reqSize += sizeof( sal_Unicode );
@@ -164,7 +164,7 @@ int WideCharToMultiByteEx( UINT cp_dest,
OSL_ASSERT( NULL != lpWideCharString );
// calculate the required buff size
- int reqSize = CalcBuffSizeForTextConversion( lpWideCharString, lenStr );
+ int reqSize = CalcBuffSizeForTextConversion( cp_dest, lpWideCharString, lenStr );
if ( bEnsureTrailingZero )
reqSize += sizeof( sal_Int8 );
diff --git a/dtrans/source/win32/dtobj/makefile.mk b/dtrans/source/win32/dtobj/makefile.mk
index 84e6dd0c58c4..abca0a5bd45c 100644
--- a/dtrans/source/win32/dtobj/makefile.mk
+++ b/dtrans/source/win32/dtobj/makefile.mk
@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.8 $
+# $Revision: 1.9 $
#
-# last change: $Author: jl $ $Date: 2001-08-07 11:13:32 $
+# last change: $Author: hr $ $Date: 2003-03-25 14:05:37 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
@@ -75,7 +75,7 @@ LIBTARGET=NO
.INCLUDE : ..$/..$/cppumaker.mk
-#CFLAGS+=/GR -DUNICODE -D_UNICODE
+#CFLAGS+=-GR -DUNICODE -D_UNICODE
UNOTYPES= \
com.sun.star.datatransfer.XSystemTransferable
diff --git a/dtrans/source/win32/ftransl/ftransl.cxx b/dtrans/source/win32/ftransl/ftransl.cxx
index c05d866ac032..dbd24f999ee5 100644
--- a/dtrans/source/win32/ftransl/ftransl.cxx
+++ b/dtrans/source/win32/ftransl/ftransl.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ftransl.cxx,v $
*
- * $Revision: 1.12 $
+ * $Revision: 1.13 $
*
- * last change: $Author: ka $ $Date: 2002-11-21 12:06:56 $
+ * last change: $Author: hr $ $Date: 2003-03-25 14:05:38 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -94,10 +94,11 @@
#define OUSTR( str ) OUString::createFromAscii( #str )
#define OUSTR_( str ) OUString::createFromAscii( str )
#define EMPTY_OUSTR OUString::createFromAscii( "" )
-#define _PARAM_WINFORMATNAME "windows_formatname"
+//#define PRIVATE_OO OUString::createFromAscii( "application/x-openoffice;" "windows_formatname=" )
-#define PRIVATE_OO OUString::createFromAscii( "application/x-openoffice;" _PARAM_WINFORMATNAME "=" )
-#define PARAM_WINFORMATNAME OUString::createFromAscii( _PARAM_WINFORMATNAME )
+const rtl::OUString Windows_FormatName = rtl::OUString::createFromAscii("windows_formatname");
+const com::sun::star::uno::Type CppuType_ByteSequence = ::getCppuType((const com::sun::star::uno::Sequence<sal_Int8>*)0);
+const com::sun::star::uno::Type CppuType_String = ::getCppuType((const ::rtl::OUString*)0);
//------------------------------------------------------------------------
// namespace directives
@@ -171,9 +172,9 @@ Any SAL_CALL CDataFormatTranslator::getSystemDataTypeFromDataFlavor( const DataF
}
else
{
- if ( refXMimeCntType->hasParameter( PARAM_WINFORMATNAME ) )
+ if (refXMimeCntType->hasParameter(Windows_FormatName))
{
- OUString winfmtname = refXMimeCntType->getParameterValue( PARAM_WINFORMATNAME );
+ OUString winfmtname = refXMimeCntType->getParameterValue(Windows_FormatName);
aAny <<= winfmtname;
setStandardFormatIdForNativeFormatName( winfmtname, aAny );
@@ -275,130 +276,245 @@ Sequence< OUString > SAL_CALL CDataFormatTranslator::getSupportedServiceNames( )
// CF_INVALID
// -------------------------------------------------
-void SAL_CALL CDataFormatTranslator::initTranslationTable( )
+void SAL_CALL CDataFormatTranslator::initTranslationTable()
{
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(DIF), CF_DIF ) );//SOT_FORMATSTR_ID_DIF
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(Bitmap), CF_DIB ) );// SOT_FORMAT_BITMAP
- m_TranslTable.push_back( mkPublicFormatEntry( OUSTR(text/plain;charset=utf-16), EMPTY_OUSTR, CF_UNICODETEXT, OUSTR(Unicode-Text), CPPUTYPE_OUSTR) );
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(Locale), CF_LOCALE ) );
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(Image WMF), CF_METAFILEPICT ) );// SOT_FORMAT_WMF
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(Image EMF), CF_ENHMETAFILE ) );// SOT_FORMAT_EMF
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(FileList), CF_HDROP ) );// SOT_FORMAT_FILE_LIST
-
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(GDIMetaFile) ) );// SOT_FORMAT_GDIMETAFILE
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(Private) ) );// SOT_FORMAT_PRIVATE
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(FileName) ) );// SOT_FORMAT_FILE
-
- m_TranslTable.push_back( mkPublicFormatEntry( OUSTR(text/richtext), OUSTR(Rich Text Format) ) );// SOT_FORMAT_RTF
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(Drawing Format) ) ); // SOT_FORMATSTR_ID_DRAWING
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(SVXB (StarView Bitmap/Animation)) ) );// SOT_FORMATSTR_ID_SVXB
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(SVIM (StarView ImageMap)) ) );// SOT_FORMATSTR_ID_SVIM
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(XFA (XOutDev FillAttr)) ) ); // SOT_FORMATSTR_ID_XFA
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(EditEngineFormat) ) ); // SOT_FORMATSTR_ID_EDITENGINE
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(StatusInfo vom SvxInternalLink) ) ); // SOT_FORMATSTR_ID_INTERNALLINK_STATE
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(SOLK (StarOffice Link)) ) ); // SOT_FORMATSTR_ID_SOLK
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(Netscape Bookmark) ) );// SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(SV_LBOX_DD_FORMAT) ) );// SOT_FORMATSTR_ID_TREELISTBOX
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(Native) ) );// SOT_FORMATSTR_ID_NATIVE
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(OwnerLink) ) ); // SOT_FORMATSTR_ID_OWNERLINK
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(StarServerFormat) ) );// SOT_FORMATSTR_ID_STARSERVER
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(StarObjectFormat) ) );// SOT_FORMATSTR_ID_STAROBJECT
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(Applet Object) ) );// SOT_FORMATSTR_ID_APPLETOBJECT
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(PlugIn Object) ) );// SOT_FORMATSTR_ID_PLUGIN_OBJECT
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(StarWriter 3.0) ) );// SOT_FORMATSTR_ID_STARWRITER_30
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(StarWriter 4.0) ) );//SOT_FORMATSTR_ID_STARWRITER_40
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(StarWriter 5.0) ) );//SOT_FORMATSTR_ID_STARWRITER_50
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(StarWriter/Web 4.0) ) );//SOT_FORMATSTR_ID_STARWRITERWEB_40
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(StarWriter/Web 5.0) ) );//SOT_FORMATSTR_ID_STARWRITERWEB_50
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(StarWriter/Global 4.0) ) );//SOT_FORMATSTR_ID_STARWRITERGLOB_40
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(StarWriter/Global 5.0) ) );// SOT_FORMATSTR_ID_STARWRITERGLOB_50
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(StarDrawDocument) ) );//SOT_FORMATSTR_ID_STARDRAW
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(StarDrawDocument 4.0) ) );//SOT_FORMATSTR_ID_STARDRAW_40
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(StarImpress 5.0) ) );//SOT_FORMATSTR_ID_STARIMPRESS_50
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(StarDraw 5.0) ) );// SOT_FORMATSTR_ID_STARDRAW_50
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(StarCalcDocument) ) );//SOT_FORMATSTR_ID_STARCALC
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(StarCalc 4.0) ) );//SOT_FORMATSTR_ID_STARCALC_40
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(StarCalc 5.0) ) );// SOT_FORMATSTR_ID_STARCALC_50
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(StarChartDocument) ) );// SOT_FORMATSTR_ID_STARCHART
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(StarChartDocument) ) ); // SOT_FORMATSTR_ID_STARCHART_40
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(StarChart 5.0) ) );// SOT_FORMATSTR_ID_STARCHART_50
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(StarImageDocument) ) );//SOT_FORMATSTR_ID_STARIMAGE
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(StarImageDocument 4.0) ) );//SOT_FORMATSTR_ID_STARIMAGE_40
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(StarImage 5.0) ) ); //SOT_FORMATSTR_ID_STARIMAGE_50
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(StarMath) ) );//SOT_FORMATSTR_ID_STARMATH
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(StarMathDocument 4.0) ) );//SOT_FORMATSTR_ID_STARMATH_40
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(StarMath 5.0) ) );//SOT_FORMATSTR_ID_STARMATH_50
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(StarObjectPaintDocument) ) ); //SOT_FORMATSTR_ID_STAROBJECT_PAINTDOC
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(FilledArea) ) );//SOT_FORMATSTR_ID_FILLED_AREA
- m_TranslTable.push_back( mkPublicFormatEntry( OUSTR(text/html), OUSTR(HTML (HyperText Markup Language)) ) );//SOT_FORMATSTR_ID_HTML
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(HTML Format) ) );//SOT_FORMATSTR_ID_HTML_SIMPLE
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(FORMAT_CHAOS) ) );//SOT_FORMATSTR_ID_CHAOS
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(CNT_MSGATTACHFILE_FORMAT) ) );//SOT_FORMATSTR_ID_CNT_MSGATTACHFILE
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(Biff5) ) ); //SOT_FORMATSTR_ID_BIFF_5
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(Biff 5) ) ); //SOT_FORMATSTR_ID_BIFF__5
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(Biff8) ) ); //SOT_FORMATSTR_ID_BIFF_8
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(Sylk) ) ); //SOT_FORMATSTR_ID_SYLK
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(SYLK) ) ); //SOT_FORMATSTR_ID_SYLK_BIGCAPS
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(Link) ) );//SOT_FORMATSTR_ID_LINK
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(StarDraw TabBar) ) ); //SOT_FORMATSTR_ID_STARDRAW_TABBAR
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(SONLK (StarOffice Navi Link)) ) );//SOT_FORMATSTR_ID_SONLK
- m_TranslTable.push_back( mkPublicFormatEntry( OUSTR(application/msword), OUSTR(MSWordDoc) ) ); //SOT_FORMATSTR_ID_MSWORD_DOC
- //m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(MSWordDoc) ) ); //SOT_FORMATSTR_ID_MSWORD_DOC
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(StarFrameSetDocument) ) );//SOT_FORMATSTR_ID_STAR_FRAMESET_DOC
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(OfficeDocument) ) );//SOT_FORMATSTR_ID_OFFICE_DOC
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(NotesDocInfo) ) ); //SOT_FORMATSTR_ID_NOTES_DOCINFO
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(NoteshNote) ) );//SOT_FORMATSTR_ID_NOTES_HNOTE
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(Native) ) ); //SOT_FORMATSTR_ID_NOTES_NATIVE
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(SfxDocument) ) );//SOT_FORMATSTR_ID_SFX_DOC
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(EVDF (Explorer View Dummy Format)) ) );//SOT_FORMATSTR_ID_EVDF
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(ESDF (Explorer Search Dummy Format) ) ) );//SOT_FORMATSTR_ID_ESDF
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(IDF (Iconview Dummy Format)) ) );//SOT_FORMATSTR_ID_IDF
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(EFTP (Explorer Ftp File) ) ) ); //SOT_FORMATSTR_ID_EFTP
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(EFD (Explorer Ftp Dir) ) ) ); //SOT_FORMATSTR_ID_EFD
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(SvxFormFieldExch) ) );//SOT_FORMATSTR_ID_SVX_FORMFIELDEXCH
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(ExtendedTabBar) ) );//SOT_FORMATSTR_ID_EXTENDED_TABBAR
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(SBA-DATAFORMAT) ) );//SOT_FORMATSTR_ID_SBA_DATAEXCHANGE
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(SBA-FIELDFORMAT) ) ); //SOT_FORMATSTR_ID_SBA_FIELDDATAEXCHANGE
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(SBA-PRIVATEURLFORMAT) ) );//SOT_FORMATSTR_ID_SBA_PRIVATE_URL
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(Tabed) ) ); //SOT_FORMATSTR_ID_SBA_TABED
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(Tabid) ) ); //SOT_FORMATSTR_ID_SBA_TABID
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(SBA-JOINFORMAT) ) );//SOT_FORMATSTR_ID_SBA_JOIN
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(Star Object Descriptor (XML)) ) );//SOT_FORMATSTR_ID_OBJECTDESCRIPTOR
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(Star Link Source Descriptor (XML)) ) );//SOT_FORMATSTR_ID_LINKSRCDESCRIPTOR
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(Star Embed Source (XML)) ) );//SOT_FORMATSTR_ID_EMBED_SOURCE
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(Star Link Source (XML)) ) );//SOT_FORMATSTR_ID_LINK_SOURCE
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(Star Embedded Object (XML)) ) );//SOT_FORMATSTR_ID_EMBEDDED_OBJ
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR_(CFSTR_FILECONTENTS) ) ); //SOT_FORMATSTR_ID_FILECONTENT
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR_(CFSTR_FILEDESCRIPTOR) ) );//SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR_(CFSTR_FILENAME) ) ); //SOT_FORMATSTR_ID_FILENAME
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(SD-OLE) ) );//SOT_FORMATSTR_ID_SD_OLE
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(Embedded Object) ) ); //SOT_FORMATSTR_ID_EMBEDDED_OBJ_OLE
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(Embed Source) ) );//SOT_FORMATSTR_ID_EMBED_SOURCE_OLE
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(Object Descriptor) ) ); //SOT_FORMATSTR_ID_OBJECTDESCRIPTOR_OLE
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(Link Source Descriptor) ) );//SOT_FORMATSTR_ID_LINKSRCDESCRIPTOR_OLE
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(Link Source) ) ); //SOT_FORMATSTR_ID_LINK_SOURCE_OLE
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(SBA-CTRLFORMAT) ) );//SOT_FORMATSTR_ID_SBA_CTRLDATAEXCHANGE
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(OutPlace Object) ) ); //SOT_FORMATSTR_ID_OUTPLACE_OBJ
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(CntOwnClipboard) ) );//SOT_FORMATSTR_ID_CNT_OWN_CLIP
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(SO-INet-Image) ) );//SOT_FORMATSTR_ID_INET_IMAGE
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(Netscape Image Format) ) );//SOT_FORMATSTR_ID_NETSCAPE_IMAGE
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(SBA_FORMEXCHANGE) ) ); //SOT_FORMATSTR_ID_SBA_FORMEXCHANGE
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(SBA_REPORTEXCHANGE) ) );//SOT_FORMATSTR_ID_SBA_REPORTEXCHANGE
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(UniformResourceLocator) ) );//SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(StarChartDocument 5.0) ) );//SOT_FORMATSTR_ID_STARCHARTDOCUMENT_50
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(Graphic Object) ) ); //SOT_FORMATSTR_ID_GRAPHOBJ
- m_TranslTable.push_back( mkPublicFormatEntry( OUSTR(application/vnd.sun.xml.writer), OUSTR(Writer 6.0) ) );//SOT_FORMATSTR_ID_STARWRITER_60
- m_TranslTable.push_back( mkPublicFormatEntry( OUSTR(application/vnd.sun.xml.writer.web), OUSTR(Writer/Web 6.0) ) );//SOT_FORMATSTR_ID_STARWRITERWEB_60
- m_TranslTable.push_back( mkPublicFormatEntry( OUSTR(application/vnd.sun.xml.writer.global), OUSTR(Writer/Global 6.0) ) );//SOT_FORMATSTR_ID_STARWRITERGLOB_60
- m_TranslTable.push_back( mkPublicFormatEntry( OUSTR(application/vnd.sun.xml.draw), OUSTR(Draw 6.0) ) );//SOT_FORMATSTR_ID_STARWDRAW_60
- m_TranslTable.push_back( mkPublicFormatEntry( OUSTR(application/vnd.sun.xml.impress), OUSTR(Impress 6.0) ) );//SOT_FORMATSTR_ID_STARIMPRESS_60
- m_TranslTable.push_back( mkPublicFormatEntry( OUSTR(application/vnd.sun.xml.calc), OUSTR(Calc 6.0) ) );//SOT_FORMATSTR_ID_STARCALC_60
- m_TranslTable.push_back( mkPublicFormatEntry( OUSTR(application/vnd.sun.xml.chart), OUSTR(Chart 6.0) ) );//SOT_FORMATSTR_ID_STARCHART_60
- m_TranslTable.push_back( mkPublicFormatEntry( OUSTR(application/vnd.sun.xml.math), OUSTR(Math 6.0) ) );//SOT_FORMATSTR_ID_STARMATH_60
- m_TranslTable.push_back( mkPublicFormatEntry( OUSTR(application/vnd.sun.xml.dialog), OUSTR(Dialog 6.0) ) );//SOT_FORMATSTR_ID_DIALOG_60
- m_TranslTable.push_back( mkPublicFormatEntry( OUSTR(image/bmp), OUSTR(Windows Bitmap) ) );//SOT_FORMATSTR_ID_BMP
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(SO_DUMMYFORMAT_3) ) );//SOT_FORMATSTR_ID_DUMMY3
- m_TranslTable.push_back( mkPrivateFormatEntry( OUSTR(SO_DUMMYFORMAT_4) ) );//SOT_FORMATSTR_ID_DUMMY4
+ //SOT_FORMATSTR_ID_DIF
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-dif;windows_formatname=\"DIF\"", "DIF", "DIF", CF_DIF));
+ // SOT_FORMAT_BITMAP
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-bitmap;windows_formatname=\"Bitmap\"", "Bitmap", "Bitmap", CF_DIB));
+ // SOT_FORMAT_STRING
+ m_TranslTable.push_back(FormatEntry("text/plain;charset=utf-16", "Unicode-Text", "", CF_UNICODETEXT, CppuType_String));
+ // Format Locale - for internal use
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-locale;windows_formatname=\"Locale\"", "Locale", "Locale", CF_LOCALE));
+ // SOT_FORMAT_WMF
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-wmf;windows_formatname=\"Image WMF\"", "Windows MetaFile", "Image WMF", CF_METAFILEPICT));
+ // SOT_FORMAT_EMF
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-emf;windows_formatname=\"Image EMF\"", "Windows Enhanced MetaFile", "Image EMF", CF_ENHMETAFILE));
+ // SOT_FORMAT_FILE_LIST
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-filelist;windows_formatname=\"FileList\"", "FileList", "FileList", CF_HDROP));
+ //SOT_FORMATSTR_ID_SYLK
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-sylk;windows_formatname=\"Sylk\"", "Sylk", "Sylk", CF_SYLK ) );
+ // SOT_FORMAT_GDIMETAFILE
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-gdimetafile;windows_formatname=\"GDIMetaFile\"", "GDIMetaFile"));
+ // SOT_FORMAT_PRIVATE
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-private;windows_formatname=\"Private\"", "Private"));
+ // SOT_FORMAT_FILE
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-file;windows_formatname=\"FileName\"", "FileName"));
+ // SOT_FORMAT_RTF
+ m_TranslTable.push_back(FormatEntry("text/richtext", "Rich Text Format"));
+ // SOT_FORMATSTR_ID_DRAWING
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-drawing;windows_formatname=\"Drawing Format\"", "Drawing Format"));
+ // SOT_FORMATSTR_ID_SVXB
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-svbx;windows_formatname=\"SVXB (StarView Bitmap/Animation)\"", "SVXB (StarView Bitmap/Animation)"));
+ // SOT_FORMATSTR_ID_SVIM
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-svim;windows_formatname=\"SVIM (StarView ImageMap)\"", "SVIM (StarView ImageMap)"));
+ // SOT_FORMATSTR_ID_XFA
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-xfa;windows_formatname=\"XFA (XOutDev FillAttr)\"", "XFA (XOutDev FillAttr)"));
+ // SOT_FORMATSTR_ID_EDITENGINE
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-editengine;windows_formatname=\"EditEngineFormat\"", "EditEngineFormat"));
+ // SOT_FORMATSTR_ID_INTERNALLINK_STATE
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-internallink-state;windows_formatname=\"StatusInfo vom SvxInternalLink\"", "StatusInfo vom SvxInternalLink"));
+ // SOT_FORMATSTR_ID_SOLK
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-solk;windows_formatname=\"SOLK (StarOffice Link)\"", "SOLK (StarOffice Link)"));
+ // SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-netscape-bookmark;windows_formatname=\"Netscape Bookmark\"", "Netscape Bookmark"));
+ // SOT_FORMATSTR_ID_TREELISTBOX
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-treelistbox;windows_formatname=\"SV_LBOX_DD_FORMAT\"", "SV_LBOX_DD_FORMAT"));
+ // SOT_FORMATSTR_ID_NATIVE
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-native;windows_formatname=\"Native\"", "Native"));
+ // SOT_FORMATSTR_ID_OWNERLINK
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-ownerlink;windows_formatname=\"OwnerLink\"", "OwnerLink"));
+ // SOT_FORMATSTR_ID_STARSERVER
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-starserver;windows_formatname=\"StarServerFormat\"", "StarServerFormat"));
+ // SOT_FORMATSTR_ID_STAROBJECT
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-starobject;windows_formatname=\"StarObjectFormat\"", "StarObjectFormat"));
+ // SOT_FORMATSTR_ID_APPLETOBJECT
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-appletobject;windows_formatname=\"Applet Object\"", "Applet Object"));
+ // SOT_FORMATSTR_ID_PLUGIN_OBJECT
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-plugin-object;windows_formatname=\"PlugIn Object\"", "PlugIn Object"));
+ // SOT_FORMATSTR_ID_STARWRITER_30
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-starwriter-30;windows_formatname=\"StarWriter 3.0\"", "StarWriter 3.0"));
+ //SOT_FORMATSTR_ID_STARWRITER_40
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-starwriter-40;windows_formatname=\"StarWriter 4.0\"", "StarWriter 4.0"));
+ //SOT_FORMATSTR_ID_STARWRITER_50
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-starwriter-50;windows_formatname=\"StarWriter 5.0\"", "StarWriter 5.0"));
+ //SOT_FORMATSTR_ID_STARWRITERWEB_40
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-starwriterweb-40;windows_formatname=\"StarWriter/Web 4.0\"", "StarWriter/Web 4.0"));
+ //SOT_FORMATSTR_ID_STARWRITERWEB_50
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-starwriterweb-50;windows_formatname=\"StarWriter/Web 5.0\"", "StarWriter/Web 5.0"));
+ //SOT_FORMATSTR_ID_STARWRITERGLOB_40
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-starwriterglob-40;windows_formatname=\"StarWriter/Global 4.0\"", "StarWriter/Global 4.0"));
+ // SOT_FORMATSTR_ID_STARWRITERGLOB_50
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-starwriterglob-50;windows_formatname=\"StarWriter/Global 5.0\"", "StarWriter/Global 5.0"));
+ //SOT_FORMATSTR_ID_STARDRAW
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-stardraw;windows_formatname=\"StarDrawDocument\"", "StarDrawDocument"));
+ //SOT_FORMATSTR_ID_STARDRAW_40
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-stardraw-40;windows_formatname=\"StarDrawDocument 4.0\"", "StarDrawDocument 4.0"));
+ //SOT_FORMATSTR_ID_STARIMPRESS_50
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-starimpress-50;windows_formatname=\"StarImpress 5.0\"", "StarImpress 5.0"));
+ // SOT_FORMATSTR_ID_STARDRAW_50
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-stardraw-50;windows_formatname=\"StarDraw 5.0\"", "StarDraw 5.0"));
+ //SOT_FORMATSTR_ID_STARCALC
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-starcalc;windows_formatname=\"StarCalcDocument\"", "StarCalcDocument"));
+ //SOT_FORMATSTR_ID_STARCALC_40
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-starcalc-40;windows_formatname=\"StarCalc 4.0\"", "StarCalc 4.0"));
+ // SOT_FORMATSTR_ID_STARCALC_50
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-starcalc-50;windows_formatname=\"StarCalc 5.0\"", "StarCalc 5.0"));
+ // SOT_FORMATSTR_ID_STARCHART
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-starchart;windows_formatname=\"StarChartDocument\"", "StarChartDocument"));
+ // SOT_FORMATSTR_ID_STARCHART_40
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-starchart-40;windows_formatname=\"StarChartDocument 4.0\"", "StarChartDocument 4.0"));
+ // SOT_FORMATSTR_ID_STARCHART_50
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-starchart-50;windows_formatname=\"StarChart 5.0\"", "StarChart 5.0"));
+ //SOT_FORMATSTR_ID_STARIMAGE
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-starimage;windows_formatname=\"StarImageDocument\"", "StarImageDocument"));
+ //SOT_FORMATSTR_ID_STARIMAGE_40
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-starimage-40;windows_formatname=\"StarImageDocument 4.0\"", "StarImageDocument 4.0"));
+ //SOT_FORMATSTR_ID_STARIMAGE_50
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-starimage-50;windows_formatname=\"StarImage 5.0\"", "StarImage 5.0"));
+ //SOT_FORMATSTR_ID_STARMATH
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-starmath;windows_formatname=\"StarMath\"", "StarMath"));
+ //SOT_FORMATSTR_ID_STARMATH_40
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-starmath-40;windows_formatname=\"StarMathDocument 4.0\"", "StarMathDocument 4.0"));
+ //SOT_FORMATSTR_ID_STARMATH_50
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-starmath-50;windows_formatname=\"StarMath 5.0\"", "StarMath 5.0"));
+ //SOT_FORMATSTR_ID_STAROBJECT_PAINTDOC
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-starobject-paintdoc;windows_formatname=\"StarObjectPaintDocument\"", "StarObjectPaintDocument"));
+ //SOT_FORMATSTR_ID_FILLED_AREA
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-filled-area;windows_formatname=\"FilledArea\"", "FilledArea"));
+ //SOT_FORMATSTR_ID_HTML
+ m_TranslTable.push_back(FormatEntry("text/html", "HTML (HyperText Markup Language)"));
+ //SOT_FORMATSTR_ID_HTML_SIMPLE
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-html-simple;windows_formatname=\"HTML Format\"", "HTML Format"));
+ //SOT_FORMATSTR_ID_CHAOS
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-chaos;windows_formatname=\"FORMAT_CHAOS\"", "FORMAT_CHAOS"));
+ //SOT_FORMATSTR_ID_CNT_MSGATTACHFILE
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-msgattachfile;windows_formatname=\"CNT_MSGATTACHFILE_FORMAT\"", "CNT_MSGATTACHFILE_FORMAT"));
+ //SOT_FORMATSTR_ID_BIFF_5
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-biff5;windows_formatname=\"Biff5\"", "Biff5"));
+ //SOT_FORMATSTR_ID_BIFF__5
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-biff-5;windows_formatname=\"Biff 5\"", "Biff 5"));
+ //SOT_FORMATSTR_ID_BIFF_8
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-biff-8;windows_formatname=\"Biff8\"", "Biff8"));
+ //SOT_FORMATSTR_ID_SYLK_BIGCAPS
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-sylk-bigcaps;windows_formatname=\"SYLK\"", "SYLK"));
+ //SOT_FORMATSTR_ID_LINK
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-link;windows_formatname=\"Link\"", "Link"));
+ //SOT_FORMATSTR_ID_STARDRAW_TABBAR
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-stardraw-tabbar;windows_formatname=\"StarDraw TabBar\"", "StarDraw TabBar"));
+ //SOT_FORMATSTR_ID_SONLK
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-sonlk;windows_formatname=\"SONLK (StarOffice Navi Link)\"", "SONLK (StarOffice Navi Link)"));
+ //SOT_FORMATSTR_ID_MSWORD_DOC
+ m_TranslTable.push_back(FormatEntry("application/msword", "MSWordDoc"));
+ //SOT_FORMATSTR_ID_STAR_FRAMESET_DOC
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-star-frameset-doc;windows_formatname=\"StarFrameSetDocument\"", "StarFrameSetDocument"));
+ //SOT_FORMATSTR_ID_OFFICE_DOC
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-office-doc;windows_formatname=\"OfficeDocument\"", "OfficeDocument"));
+ //SOT_FORMATSTR_ID_NOTES_DOCINFO
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-notes-docinfo;windows_formatname=\"NotesDocInfo\"", "NotesDocInfo"));
+ //SOT_FORMATSTR_ID_NOTES_HNOTE
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-notes-hnote;windows_formatname=\"NoteshNote\"", "NoteshNote"));
+ //SOT_FORMATSTR_ID_NOTES_NATIVE
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-notes-native;windows_formatname=\"Native\"", "Native"));
+ //SOT_FORMATSTR_ID_SFX_DOC
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-sfx-doc;windows_formatname=\"SfxDocument\"", "SfxDocument"));
+ //SOT_FORMATSTR_ID_EVDF
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-evdf;windows_formatname=\"EVDF (Explorer View Dummy Format)\"", "EVDF (Explorer View Dummy Format)"));
+ //SOT_FORMATSTR_ID_ESDF
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-esdf;windows_formatname=\"ESDF (Explorer Search Dummy Format)\"", "ESDF (Explorer Search Dummy Format)"));
+ //SOT_FORMATSTR_ID_IDF
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-idf;windows_formatname=\"IDF (Iconview Dummy Format)\"", "IDF (Iconview Dummy Format)"));
+ //SOT_FORMATSTR_ID_EFTP
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-eftp;windows_formatname=\"EFTP (Explorer Ftp File)\"", "EFTP (Explorer Ftp File)"));
+ //SOT_FORMATSTR_ID_EFD
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-efd;windows_formatname=\"EFD (Explorer Ftp Dir)\"", "EFD (Explorer Ftp Dir)"));
+ //SOT_FORMATSTR_ID_SVX_FORMFIELDEXCH
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-svx-formfieldexch;windows_formatname=\"SvxFormFieldExch\"", "SvxFormFieldExch"));
+ //SOT_FORMATSTR_ID_EXTENDED_TABBAR
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-extended-tabbar;windows_formatname=\"ExtendedTabBar\"", "ExtendedTabBar"));
+ //SOT_FORMATSTR_ID_SBA_DATAEXCHANGE
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-sba-dataexchange;windows_formatname=\"SBA-DATAFORMAT\"", "SBA-DATAFORMAT"));
+ //SOT_FORMATSTR_ID_SBA_FIELDDATAEXCHANGE
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-sba-fielddataexchange;windows_formatname=\"SBA-FIELDFORMAT\"", "SBA-FIELDFORMAT"));
+ //SOT_FORMATSTR_ID_SBA_PRIVATE_URL
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-sba-private-url;windows_formatname=\"SBA-PRIVATEURLFORMAT\"", "SBA-PRIVATEURLFORMAT"));
+ //SOT_FORMATSTR_ID_SBA_TABED
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-sba-tabed;windows_formatname=\"Tabed\"", "Tabed"));
+ //SOT_FORMATSTR_ID_SBA_TABID
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-sba-tabid;windows_formatname=\"Tabid\"", "Tabid"));
+ //SOT_FORMATSTR_ID_SBA_JOIN
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-sba-join;windows_formatname=\"SBA-JOINFORMAT\"", "SBA-JOINFORMAT"));
+ //SOT_FORMATSTR_ID_OBJECTDESCRIPTOR
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-objectdescriptor-xml;windows_formatname=\"Star Object Descriptor (XML)\"", "Star Object Descriptor (XML)"));
+ //SOT_FORMATSTR_ID_LINKSRCDESCRIPTOR
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-linksrcdescriptor-xml;windows_formatname=\"Star Link Source Descriptor (XML)\"", "Star Link Source Descriptor (XML)"));
+ //SOT_FORMATSTR_ID_EMBED_SOURCE
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-embed-source-xml;windows_formatname=\"Star Embed Source (XML)\"", "Star Embed Source (XML)"));
+ //SOT_FORMATSTR_ID_LINK_SOURCE
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-link-source-xml;windows_formatname=\"Star Link Source (XML)\"", "Star Link Source (XML)"));
+ //SOT_FORMATSTR_ID_EMBEDDED_OBJ
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-embedded-obj-xml;windows_formatname=\"Star Embedded Object (XML)\"", "Star Embedded Object (XML)"));
+ //SOT_FORMATSTR_ID_FILECONTENT
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-filecontent;windows_formatname=\"" CFSTR_FILECONTENTS "\"", CFSTR_FILECONTENTS));
+ //SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-filegrpdescriptor;windows_formatname=\"" CFSTR_FILEDESCRIPTOR "\"", CFSTR_FILEDESCRIPTOR));
+ //SOT_FORMATSTR_ID_FILENAME
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-filename;windows_formatname=\"" CFSTR_FILENAME "\"", CFSTR_FILENAME));
+ //SOT_FORMATSTR_ID_SD_OLE
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-sd-ole;windows_formatname=\"SD-OLE\"", "SD-OLE"));
+ //SOT_FORMATSTR_ID_EMBEDDED_OBJ_OLE
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-embedded-obj-ole;windows_formatname=\"Embedded Object\"", "Embedded Object"));
+ //SOT_FORMATSTR_ID_EMBED_SOURCE_OLE
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-embed-source-ole;windows_formatname=\"Embed Source\"", "Embed Source"));
+ //SOT_FORMATSTR_ID_OBJECTDESCRIPTOR_OLE
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-objectdescriptor-ole;windows_formatname=\"Object Descriptor\"", "Object Descriptor"));
+ //SOT_FORMATSTR_ID_LINKSRCDESCRIPTOR_OLE
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-linkdescriptor-ole;windows_formatname=\"Link Source Descriptor\"", "Link Source Descriptor"));
+ //SOT_FORMATSTR_ID_LINK_SOURCE_OLE
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-link-source-ole;windows_formatname=\"Link Source\"", "Link Source"));
+ //SOT_FORMATSTR_ID_SBA_CTRLDATAEXCHANGE
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-sba-ctrldataexchange;windows_formatname=\"SBA-CTRLFORMAT\"", "SBA-CTRLFORMAT"));
+ //SOT_FORMATSTR_ID_OUTPLACE_OBJ
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-outplace-obj;windows_formatname=\"OutPlace Object\"", "OutPlace Object"));
+ //SOT_FORMATSTR_ID_CNT_OWN_CLIP
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-cnt-own-clip;windows_formatname=\"CntOwnClipboard\"", "CntOwnClipboard"));
+ //SOT_FORMATSTR_ID_INET_IMAGE
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-inet-image;windows_formatname=\"SO-INet-Image\"", "SO-INet-Image"));
+ //SOT_FORMATSTR_ID_NETSCAPE_IMAGE
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-netscape-image;windows_formatname=\"Netscape Image Format\"", "Netscape Image Format"));
+ //SOT_FORMATSTR_ID_SBA_FORMEXCHANGE
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-sba-formexchange;windows_formatname=\"SBA_FORMEXCHANGE\"", "SBA_FORMEXCHANGE")); //SOT_FORMATSTR_ID_SBA_REPORTEXCHANGE
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-sba-reportexchange;windows_formatname=\"SBA_REPORTEXCHANGE\"", "SBA_REPORTEXCHANGE"));
+ //SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-uniformresourcelocator;windows_formatname=\"UniformResourceLocator\"", "UniformResourceLocator"));
+ //SOT_FORMATSTR_ID_STARCHARTDOCUMENT_50
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-starchartdocument-50;windows_formatname=\"StarChartDocument 5.0\"", "StarChartDocument 5.0"));
+ //SOT_FORMATSTR_ID_GRAPHOBJ
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-graphobj;windows_formatname=\"Graphic Object\"", "Graphic Object"));
+ //SOT_FORMATSTR_ID_STARWRITER_60
+ m_TranslTable.push_back(FormatEntry("application/vnd.sun.xml.writer", "Writer 6.0"));
+ //SOT_FORMATSTR_ID_STARWRITERWEB_60
+ m_TranslTable.push_back(FormatEntry("application/vnd.sun.xml.writer.web", "Writer/Web 6.0"));
+ //SOT_FORMATSTR_ID_STARWRITERGLOB_60
+ m_TranslTable.push_back(FormatEntry("application/vnd.sun.xml.writer.global", "Writer/Global 6.0"));
+ //SOT_FORMATSTR_ID_STARWDRAW_60
+ m_TranslTable.push_back(FormatEntry("application/vnd.sun.xml.draw", "Draw 6.0"));
+ //SOT_FORMATSTR_ID_STARIMPRESS_60
+ m_TranslTable.push_back(FormatEntry("application/vnd.sun.xml.impress", "Impress 6.0"));
+ //SOT_FORMATSTR_ID_STARCALC_60
+ m_TranslTable.push_back(FormatEntry("application/vnd.sun.xml.calc", "Calc 6.0"));
+ //SOT_FORMATSTR_ID_STARCHART_60
+ m_TranslTable.push_back(FormatEntry("application/vnd.sun.xml.chart", "Chart 6.0"));
+ //SOT_FORMATSTR_ID_STARMATH_60
+ m_TranslTable.push_back(FormatEntry("application/vnd.sun.xml.math", "Math 6.0"));
+ //SOT_FORMATSTR_ID_DIALOG_60
+ m_TranslTable.push_back(FormatEntry("application/vnd.sun.xml.dialog", "Dialog 6.0"));
+ //SOT_FORMATSTR_ID_BMP
+ m_TranslTable.push_back(FormatEntry("image/bmp", "Windows Bitmap"));
+ //SOT_FORMATSTR_ID_DUMMY3
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-dummy3;windows_formatname=\"SO_DUMMYFORMAT_3\"", "SO_DUMMYFORMAT_3"));
+ //SOT_FORMATSTR_ID_DUMMY4
+ m_TranslTable.push_back(FormatEntry("application/x-openoffice-dummy4;windows_formatname=\"SO_DUMMYFORMAT_4\"", "SO_DUMMYFORMAT_4"));
}
// -------------------------------------------------
@@ -514,74 +630,20 @@ void SAL_CALL CDataFormatTranslator::findStdFormatIdOrNativeFormatNameForFullMed
//
// -------------------------------------------------
-inline
-sal_Bool CDataFormatTranslator::isTextPlainMediaType( const OUString& fullMediaType ) const
+inline sal_Bool CDataFormatTranslator::isTextPlainMediaType( const OUString& fullMediaType ) const
{
- return ( fullMediaType.equalsIgnoreAsciiCase( OUSTR( text/plain ) ) );
+ return (fullMediaType.equalsIgnoreAsciiCase(OUSTR(text/plain)));
}
// -------------------------------------------------
//
// -------------------------------------------------
-DataFlavor SAL_CALL CDataFormatTranslator::mkDataFlv( const OUString& cnttype, const OUString& hpname, Type dtype )
+DataFlavor SAL_CALL CDataFormatTranslator::mkDataFlv(const OUString& cnttype, const OUString& hpname, Type dtype)
{
DataFlavor dflv;
-
dflv.MimeType = cnttype;
dflv.HumanPresentableName = hpname;
dflv.DataType = dtype;
-
return dflv;
}
-
-// -------------------------------------------------
-//
-// -------------------------------------------------
-
-FormatEntry CDataFormatTranslator::mkFormatEntry( const DataFlavor& aDataFlavor, const OUString& aNativeFormatName, sal_Int32 aStandardFormatId )
-{
- FormatEntry fmtDescr;
-
- fmtDescr.aDataFlavor = aDataFlavor;
- fmtDescr.aNativeFormatName = aNativeFormatName;
- fmtDescr.aStandardFormatId = aStandardFormatId;
-
- return fmtDescr;
-}
-
-// -------------------------------------------------
-//
-// -------------------------------------------------
-
-FormatEntry CDataFormatTranslator::mkPrivateFormatEntry( const OUString& aNativeFormatName, CLIPFORMAT aClipformat, const OUString& aHpName, Type aCppuType )
-{
- DataFlavor aDFlv;
- OUString quotedFName = OUString::createFromAscii( "\"" ) + aNativeFormatName + OUString::createFromAscii( "\"" );
-
- if ( aHpName.getLength( ) )
- aDFlv = mkDataFlv( PRIVATE_OO + quotedFName, aHpName, aCppuType );
- else
- aDFlv = mkDataFlv( PRIVATE_OO + quotedFName, aNativeFormatName, aCppuType );
-
- FormatEntry fmtentry = mkFormatEntry( aDFlv, aNativeFormatName, aClipformat );
-
- return fmtentry;
-}
-
-// -------------------------------------------------
-//
-// -------------------------------------------------
-
-FormatEntry CDataFormatTranslator::mkPublicFormatEntry( const OUString& aContentType, const OUString& aNativeFormatName, CLIPFORMAT aClipformat, const OUString& aHpName, Type aCppuType )
-{
- DataFlavor aDFlv;
- OUString quotedFName = OUString::createFromAscii( "\"" ) + aNativeFormatName + OUString::createFromAscii( "\"" );
-
- if ( aHpName.getLength( ) )
- aDFlv = mkDataFlv( aContentType, aHpName, aCppuType );
- else
- aDFlv = mkDataFlv( aContentType, quotedFName, aCppuType );
-
- return mkFormatEntry( aDFlv, aNativeFormatName, aClipformat );
-}
diff --git a/dtrans/source/win32/ftransl/ftransl.hxx b/dtrans/source/win32/ftransl/ftransl.hxx
index 2f0f92defee0..aef310ff6645 100644
--- a/dtrans/source/win32/ftransl/ftransl.hxx
+++ b/dtrans/source/win32/ftransl/ftransl.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ftransl.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: tra $ $Date: 2001-02-27 07:38:03 $
+ * last change: $Author: hr $ $Date: 2003-03-25 14:05:38 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -99,16 +99,52 @@
#include <windows.h>
//------------------------------------------------------------------------
-// deklarations
+// declarations
//------------------------------------------------------------------------
struct FormatEntry
{
+ FormatEntry(){};
+
+#if (defined(_MSC_VER) && (_MSC_VER < 1300))
+ FormatEntry(
+ const char* mime_content_type,
+ const char* human_presentable_name,
+ const char* native_format_name = NULL,
+ CLIPFORMAT std_clipboard_format_id = CF_INVALID,
+ com::sun::star::uno::Type const & cppu_type = getCppuType((const com::sun::star::uno::Sequence<sal_Int8> *) 0 )
+ )
+#else
+ FormatEntry(
+ const char* mime_content_type,
+ const char* human_presentable_name,
+ const char* native_format_name = NULL,
+ CLIPFORMAT std_clipboard_format_id = CF_INVALID,
+ ::com::sun::star::uno::Type const & cppu_type = ::getCppuType((const ::com::sun::star::uno::Sequence<sal_Int8> *) 0 )
+ )
+#endif
+ {
+ aDataFlavor.MimeType = rtl::OUString::createFromAscii(mime_content_type);
+ aDataFlavor.HumanPresentableName = rtl::OUString::createFromAscii(human_presentable_name);
+ aDataFlavor.DataType = cppu_type;
+
+ if (native_format_name)
+ aNativeFormatName = rtl::OUString::createFromAscii(native_format_name);
+ else
+ aNativeFormatName = rtl::OUString::createFromAscii(human_presentable_name);
+
+ aStandardFormatId = std_clipboard_format_id;
+ }
+
com::sun::star::datatransfer::DataFlavor aDataFlavor;
rtl::OUString aNativeFormatName;
sal_Int32 aStandardFormatId;
};
+//------------------------------------------------
+// CDataFormatTranslator
+//------------------------------------------------
+
class CDataFormatTranslator : public
cppu::WeakImplHelper2< com::sun::star::datatransfer::XDataFormatTranslator, \
com::sun::star::lang::XServiceInfo >
@@ -151,24 +187,9 @@ private:
const com::sun::star::uno::Reference< com::sun::star::datatransfer::XMimeContentTypeFactory >& aRefXMimeFactory,
const rtl::OUString& aFullMediaType, com::sun::star::uno::Any& aAny ) const;
- com::sun::star::datatransfer::DataFlavor SAL_CALL mkDataFlv( const rtl::OUString& cnttype, const rtl::OUString& hpname, ::com::sun::star::uno::Type dtype );
-
sal_Bool isTextPlainMediaType( const rtl::OUString& fullMediaType ) const;
- FormatEntry SAL_CALL mkFormatEntry( const com::sun::star::datatransfer::DataFlavor& aDataFlavor,
- const rtl::OUString& aNativeFormatName,
- sal_Int32 aStandardFormatId );
-
- FormatEntry mkPrivateFormatEntry( const rtl::OUString& aNativeFormatName,
- CLIPFORMAT aClipformat = CF_INVALID,
- const rtl::OUString& aHpName = rtl::OUString::createFromAscii( "" ),
- com::sun::star::uno::Type aCppuType = ::getCppuType( (const com::sun::star::uno::Sequence< sal_Int8 >*) 0 ));
-
- FormatEntry mkPublicFormatEntry( const rtl::OUString& aContentType,
- const rtl::OUString& aNativeFormatName = rtl::OUString::createFromAscii( "" ),
- CLIPFORMAT aClipformat = CF_INVALID,
- const rtl::OUString& aHpName = rtl::OUString::createFromAscii( "" ),
- com::sun::star::uno::Type aCppuType = ::getCppuType( (const com::sun::star::uno::Sequence< sal_Int8 >*) 0 ));
+ com::sun::star::datatransfer::DataFlavor SAL_CALL mkDataFlv( const rtl::OUString& cnttype, const rtl::OUString& hpname, ::com::sun::star::uno::Type dtype );
private:
std::vector< FormatEntry > m_TranslTable;
diff --git a/dtrans/source/win32/workbench/test_wincb.cxx b/dtrans/source/win32/workbench/test_wincb.cxx
index 3db4b5760c79..33139f3b537d 100644
--- a/dtrans/source/win32/workbench/test_wincb.cxx
+++ b/dtrans/source/win32/workbench/test_wincb.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: test_wincb.cxx,v $
*
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: tra $ $Date: 2001-09-28 12:28:09 $
+ * last change: $Author: hr $ $Date: 2003-03-25 14:05:40 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -59,12 +59,18 @@
*
************************************************************************/
-//----------------------------------
+
+//_________________________________________________________________________________________________________________________
// interface includes
-//----------------------------------
+//_________________________________________________________________________________________________________________________
+
#include "..\misc\ImplHelper.hxx"
+//_________________________________________________________________________________________________________________________
+// other includes
+//_________________________________________________________________________________________________________________________
+
#ifndef _CPPUHELPER_SERVICEFACTORY_HXX_
#include <cppuhelper/servicefactory.hxx>
#endif
@@ -121,6 +127,18 @@
#include <process.h>
+//-------------------------------------------------------------
+// my defines
+//-------------------------------------------------------------
+
+#define TEST_CLIPBOARD
+#define RDB_SYSPATH "d:\\projects\\src623\\dtrans\\wntmsci7\\bin\\applicat.rdb"
+#define WINCLIPBOARD_SERVICE_NAME L"com.sun.star.datatransfer.clipboard.SystemClipboard"
+#define WRITE_CB
+#define EVT_MANUAL_RESET TRUE
+#define EVT_INIT_NONSIGNALED FALSE
+#define EVT_NONAME ""
+
//------------------------------------------------------------
// namesapces
//------------------------------------------------------------
@@ -134,38 +152,12 @@ using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::io;
using namespace ::com::sun::star::lang;
-//-------------------------------------------------------------
-// my defines
-//-------------------------------------------------------------
-
-#define TEST_CLIPBOARD
-#define WRITE_CB
-
-const char RDB_SYSPATH[] = "d:\\projects\\src638\\dtrans\\wntmsci7\\bin\\applicat.rdb";
-const OUString WINCLIPBOARD_SERVICE_NAME = OUString::createFromAscii( "com.sun.star.datatransfer.clipboard.SystemClipboard" );
-
-const bool EVT_MANUAL_RESET = true;
-const bool EVT_AUTO_RESET = false;
-const bool EVT_INIT_NONSIGNALED = false;
-const bool EVT_INIT_SIGNALED = true;
-const sal_Int32 MAX_LOOP = 1;//000;
-
-char EVT_NONAME[] = "";
-
-enum APARTMENT_MODEL
-{
- STA = 0,
- MTA
-};
-
//------------------------------------------------------------
// globales
//------------------------------------------------------------
-Reference< XTransferable > g_xTransferable;
-HANDLE g_HandleArray[2];
-HANDLE g_hEvtThreadWakeup;
-Reference< XClipboard > g_xClipboard;
+Reference< XTransferable > rXTransfRead;
+HANDLE g_hEvtThreadWakeup;
//------------------------------------------------------------
//
@@ -174,24 +166,30 @@ Reference< XClipboard > g_xClipboard;
class CClipboardListener : public WeakImplHelper1 < XClipboardListener >
{
public:
- virtual void SAL_CALL disposing( const EventObject& Source )
- throw(RuntimeException)
- {
- }
+ ~CClipboardListener( );
//-------------------------------------------------
// XClipboardListener
//-------------------------------------------------
- virtual void SAL_CALL changedContents( const ClipboardEvent& event )
- throw( RuntimeException )
- {
- //OSL_ENSURE( sal_False, "clipboard content changed" );
- g_xTransferable = event.Contents;
- SetEvent( g_hEvtThreadWakeup );
- }
+ virtual void SAL_CALL disposing( const EventObject& Source ) throw(RuntimeException);
+ virtual void SAL_CALL changedContents( const ClipboardEvent& event ) throw( RuntimeException );
};
+CClipboardListener::~CClipboardListener( )
+{
+}
+
+void SAL_CALL CClipboardListener::disposing( const EventObject& Source ) throw(RuntimeException)
+{
+
+}
+
+void SAL_CALL CClipboardListener::changedContents( const ClipboardEvent& event ) throw( RuntimeException )
+{
+ //MessageBox( NULL, TEXT("Clipboard content changed"), TEXT("Info"), MB_OK | MB_ICONINFORMATION );
+}
+
//------------------------------------------------------------
//
//------------------------------------------------------------
@@ -208,18 +206,15 @@ public:
virtual Any SAL_CALL getTransferData( const DataFlavor& aFlavor )
throw(UnsupportedFlavorException, IOException, RuntimeException);
- virtual Sequence< DataFlavor > SAL_CALL getTransferDataFlavors( )
- throw(RuntimeException);
+ virtual Sequence< DataFlavor > SAL_CALL getTransferDataFlavors( ) throw(RuntimeException);
- virtual sal_Bool SAL_CALL isDataFlavorSupported( const DataFlavor& aFlavor )
- throw(RuntimeException);
+ virtual sal_Bool SAL_CALL isDataFlavorSupported( const DataFlavor& aFlavor ) throw(RuntimeException);
//-------------------------------------------------
// XClipboardOwner
//-------------------------------------------------
- virtual void SAL_CALL lostOwnership(
- const Reference< XClipboard >& xClipboard, const Reference< XTransferable >& xTransferable )
+ virtual void SAL_CALL lostOwnership( const Reference< XClipboard >& xClipboard, const Reference< XTransferable >& xTrans )
throw(RuntimeException);
private:
@@ -237,8 +232,11 @@ CTransferable::CTransferable( ) :
{
DataFlavor df;
- df.MimeType = L"text/plain;charset=utf-16";
- df.DataType = getCppuType( ( OUString* )0 );
+ //df.MimeType = L"text/plain;charset=utf-16";
+ //df.DataType = getCppuType( ( OUString* )0 );
+
+ df.MimeType = L"text/plain;charset=Windows1252";
+ df.DataType = getCppuType( (Sequence< sal_Int8 >*)0 );
m_FlavorList[0] = df;
}
@@ -252,8 +250,23 @@ Any SAL_CALL CTransferable::getTransferData( const DataFlavor& aFlavor )
{
Any anyData;
+ /*
if ( aFlavor.MimeType == m_FlavorList[0].MimeType )
- anyData <<= m_Data;
+ anyData = makeAny( m_Data );
+ */
+ if ( aFlavor.MimeType.equalsIgnoreCase( m_FlavorList[0].MimeType ) )
+ {
+ OString text(
+ m_Data.getStr( ),
+ m_Data.getLength( ),
+ RTL_TEXTENCODING_ASCII_US );
+
+ Sequence< sal_Int8 > textStream( text.getLength( ) + 1 );
+
+ rtl_copyMemory( textStream.getArray( ), text.getStr( ), textStream.getLength( ) );
+
+ anyData = makeAny( textStream );
+ }
else
throw UnsupportedFlavorException( );
@@ -291,108 +304,10 @@ sal_Bool SAL_CALL CTransferable::isDataFlavorSupported( const DataFlavor& aFlavo
//----------------------------------------------------------------
void SAL_CALL CTransferable::lostOwnership(
- const Reference< XClipboard >& xClipboard, const Reference< XTransferable >& xTransferable )
+ const Reference< XClipboard >& xClipboard, const Reference< XTransferable >& xTrans )
throw(RuntimeException)
{
- OSL_ENSURE( sal_False, "lostOwnership" );
-}
-
-//------------------------------------------------------------
-//
-//------------------------------------------------------------
-
-void SetupCOMApartment( APARTMENT_MODEL apm )
-{
- // setup another apartment
- HRESULT hr;
-
- switch ( apm )
- {
- case STA:
- hr = CoInitializeEx( NULL, COINIT_APARTMENTTHREADED );
- OSL_ENSURE( SUCCEEDED( hr ), "CoInitialize Sta failed" );
- break;
-
- case MTA:
- hr = CoInitializeEx( NULL, COINIT_MULTITHREADED );
- OSL_ENSURE( SUCCEEDED( hr ), "CoInitialize Mta failed" );
- break;
-
- default:
- CoUninitialize( );
- OSL_ENSURE( false, "invalid apartment model" );
- }
-}
-
-//------------------------------------------------------------
-//
-//------------------------------------------------------------
-
-unsigned int _stdcall ThreadProc(LPVOID pParam)
-{
- APARTMENT_MODEL* apm = reinterpret_cast< APARTMENT_MODEL* >( pParam );
-
- SetupCOMApartment( *apm );
-
- sal_Int32 n = MAX_LOOP;
-
- for ( sal_Int32 i = 0; i < n; i++ )
- {
- WaitForSingleObject( g_hEvtThreadWakeup, INFINITE );
-
- try
- {
- if ( g_xTransferable.is( ) )
- {
- Sequence< DataFlavor > aFlavorList = g_xTransferable->getTransferDataFlavors( );
- sal_Int32 nFlavors = aFlavorList.getLength( );
-
- OSL_ENSURE( nFlavors > 0, "clipboard empty" );
-
- for ( sal_Int32 i = 0; i < nFlavors; i++ )
- {
- DataFlavor aFlavor = aFlavorList[i];
- Any aAny = g_xTransferable->getTransferData( aFlavor );
- OSL_ENSURE( aAny.hasValue( ), "empty clipboard" );
- }
- }
- }
- catch( UnsupportedFlavorException& )
- {
- OSL_ENSURE( sal_False, "unsupported flavor exception" );
- }
- catch( ... )
- {
- OSL_ENSURE( sal_False, "exception caught" );
- }
-
- if ( i < ( n - 1 ) )
- SetEvent( g_HandleArray[0] );
- }
-
- if ( (STA == *apm) || (MTA == *apm) )
- CoUninitialize( );
-
- return 0;
-}
-
-//----------------------------------------------------------------
-//
-//----------------------------------------------------------------
-
-void GetFileName( )
-{
- OPENFILENAME ofn;
- TCHAR aFileNameBuffer[MAX_PATH];
-
- ZeroMemory( &ofn, sizeof( ofn ) );
-
- ofn.lStructSize = sizeof( ofn );
- ofn.lpstrFile = aFileNameBuffer;
- ofn.nMaxFile = MAX_PATH;
- ofn.Flags = OFN_EXPLORER;
-
- GetOpenFileName( &ofn );
+ //MessageBox( NULL, TEXT("No longer clipboard owner"), TEXT("Info"), MB_OK | MB_ICONINFORMATION );
}
//----------------------------------------------------------------
@@ -401,93 +316,75 @@ void GetFileName( )
int SAL_CALL main( int nArgc, char* Argv[] )
{
- if ( nArgc < 4 )
- {
- printf( "Use 0|1 [sta, mta] 0|1 [sta,mta] 0|1 [release XTransferable before|after CoUninitialize]\n" );
- Sleep( 3000 );
- return 0;
- }
-
- // read parameter
- APARTMENT_MODEL apm = (APARTMENT_MODEL)atoi( Argv[1] );
- SetupCOMApartment( apm );
-
- g_hEvtThreadWakeup = CreateEventA(
- 0, EVT_AUTO_RESET, EVT_INIT_NONSIGNALED, EVT_NONAME );
-
- OSL_ENSURE( g_hEvtThreadWakeup, "can't create thread wakeup event" );
-
- g_HandleArray[0] = CreateEventA(
- 0, EVT_AUTO_RESET, EVT_INIT_SIGNALED, EVT_NONAME );
+ // create a multi-threaded apartment; we can test only
+ // with a multithreaded apartment because for a single
+ // threaded apartment we need a message loop to deliver
+ // messages to our XTDataObject
+ //HRESULT hr = CoInitializeEx( NULL, COINIT_MULTITHREADED );
+ HRESULT hr = CoInitialize( NULL );
- OSL_ENSURE( g_HandleArray[0], "can't create clipboard thread ready event" );
+ char buff[6];
- apm = (APARTMENT_MODEL)atoi( Argv[2] );
+ LCID lcid = MAKELCID( MAKELANGID( LANG_GERMAN, SUBLANG_GERMAN ), SORT_DEFAULT );
- unsigned uThreadId;
- g_HandleArray[1] = (HANDLE)_beginthreadex( NULL, 0, ThreadProc, &apm, 0, &uThreadId );
- OSL_ENSURE( g_HandleArray[1], "cannot create thread" );
+ BOOL bValid = IsValidLocale( lcid, LCID_SUPPORTED );
+ GetLocaleInfoA( lcid, LOCALE_IDEFAULTANSICODEPAGE, buff, sizeof( buff ) );
//-------------------------------------------------
// get the global service-manager
//-------------------------------------------------
- OUString rdbName = OUString::createFromAscii( RDB_SYSPATH );
+
+ OUString rdbName = OUString( RTL_CONSTASCII_USTRINGPARAM( RDB_SYSPATH ) );
Reference< XMultiServiceFactory > g_xFactory( createRegistryServiceFactory( rdbName ) );
- OSL_ENSURE( g_xFactory.is( ), "can't create RegistryServiceFactory");
+
+ // Print a message if an error occured.
+ if ( !g_xFactory.is( ) )
+ {
+ OSL_ENSURE(sal_False, "Can't create RegistryServiceFactory");
+ return(-1);
+ }
//-------------------------------------------------
// try to get an Interface to a XFilePicker Service
//-------------------------------------------------
- g_xClipboard = Reference< XClipboard >( g_xFactory->createInstance( OUString( WINCLIPBOARD_SERVICE_NAME ) ), UNO_QUERY );
- OSL_ENSURE( g_xClipboard.is( ), "error creating clipboard service" );
+ Reference< XTransferable > rXTransf( static_cast< XTransferable* >( new CTransferable ) );
+
+ Reference< XClipboard >
+ xClipboard( g_xFactory->createInstance( OUString( WINCLIPBOARD_SERVICE_NAME ) ), UNO_QUERY );
+ if ( !xClipboard.is( ) )
+ {
+ OSL_ENSURE( sal_False, "Error creating Clipboard Service" );
+ return(-1);
+ }
+
+ Reference< XClipboardNotifier > xClipNotifier( xClipboard, UNO_QUERY );
+ Reference< XClipboardListener > rXClipListener( static_cast< XClipboardListener* >( new CClipboardListener() ) );
+ xClipNotifier->addClipboardListener( rXClipListener );
- Reference< XTransferable > rXTransf( static_cast< XTransferable* >( new CTransferable( ) ) );
+ MessageBox( NULL, TEXT("Go"), TEXT("INFO"), MB_OK|MB_ICONINFORMATION);
- Reference< XClipboardNotifier > xClipboardNotifier( g_xClipboard, UNO_QUERY );
- Reference< XClipboardListener > rXClipListener( static_cast< XClipboardListener* >( new CClipboardListener( ) ), UNO_QUERY );
- OSL_ENSURE( rXClipListener.is( ), "can't create clipboard listener" );
+ // set new clipboard content
+ xClipboard->setContents( rXTransf, Reference< XClipboardOwner >( rXTransf, UNO_QUERY ) );
- xClipboardNotifier->addClipboardListener( rXClipListener );
+ /*
+ MessageBox( NULL, TEXT("Clear content"), TEXT("INFO"), MB_OK|MB_ICONINFORMATION);
- sal_Bool bContinue = sal_True;
+ Reference< XClipboardOwner > rXClipOwner;
+ Reference< XTransferable > rXEmptyTransf;
+ xClipboard->setContents( rXEmptyTransf, rXClipOwner );
+ */
- while ( bContinue )
- {
- DWORD dwResult = WaitForMultipleObjects(
- 2, g_HandleArray, false, INFINITE );
-
- switch( dwResult )
- {
- case WAIT_OBJECT_0:
- GetFileName( );
- /*
- g_xTransferable = g_xClipboard->getContents( );
- SetEvent( g_hEvtThreadWakeup );
- */
- break;
-
- case WAIT_OBJECT_0 + 1:
- // when Argv[3] is true we release the transferable
- // here before CoUninitialize else we can see what
- // happens when the transferable will be destroyed
- // after CoUninitialize
- if ( (bool)atoi( Argv[3] ) )
- g_xTransferable = Reference< XTransferable >( );
-
- // close the thread handle and end the loop
- CloseHandle( g_HandleArray[1] );
- bContinue = sal_False;
- break;
-
- default:
- OSL_ENSURE( sal_False, "invalid option" );
- }
- }
+ MessageBox( NULL, TEXT("Stop"), TEXT("INFO"), MB_OK|MB_ICONINFORMATION);
+
+ // flush the clipboard content
+ Reference< XFlushableClipboard > rXFlushableClip( xClipboard, UNO_QUERY );
+ rXFlushableClip->flushClipboard( );
+ rXFlushableClip = Reference< XFlushableClipboard >( );
- xClipboardNotifier->removeClipboardListener( rXClipListener );
+ xClipNotifier->removeClipboardListener( rXClipListener );
rXClipListener = Reference< XClipboardListener >( );
- xClipboardNotifier = Reference< XClipboardNotifier >( );
+ xClipNotifier = Reference< XClipboardNotifier >( );
//--------------------------------------------------
// shutdown the service manager
@@ -495,7 +392,9 @@ int SAL_CALL main( int nArgc, char* Argv[] )
// Cast factory to XComponent
Reference< XComponent > xComponent( g_xFactory, UNO_QUERY );
- OSL_ENSURE( xComponent.is( ), "Error shuting down" );
+
+ if ( !xComponent.is() )
+ OSL_ENSURE(sal_False, "Error shuting down");
// Dispose and clear factory
xComponent->dispose();
@@ -504,8 +403,7 @@ int SAL_CALL main( int nArgc, char* Argv[] )
g_xFactory.clear();
g_xFactory = Reference< XMultiServiceFactory >();
- if ( (STA == apm) || (MTA == apm) )
- CoUninitialize( );
+ CoUninitialize( );
return 0;
}
diff --git a/dtrans/source/win32/workbench/testmarshal.cxx b/dtrans/source/win32/workbench/testmarshal.cxx
index c4b79bc3651e..f700e6e75168 100644
--- a/dtrans/source/win32/workbench/testmarshal.cxx
+++ b/dtrans/source/win32/workbench/testmarshal.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: testmarshal.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: tra $ $Date: 2001-07-26 11:20:56 $
+ * last change: $Author: hr $ $Date: 2003-03-25 14:05:40 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -59,22 +59,14 @@
*
************************************************************************/
-/*
- Marshalling raw: we use CoMarshalInterface and CoUnmarshalInterface
- directly
- Marshalling non-raw: wee use CoMarshalInterThreadInterfaceInStream and
- CoGetInteraface and ReleaseStream
+//_________________________________________________________________________________________________________________________
+// interface includes
+//_________________________________________________________________________________________________________________________
- We test the following cases:
-
- Marshalling Target Thread Apartment
- -------------------------------------------
- Raw Sta
- Raw Mta
- Non-Raw Sta
- Non-Raw Mta
-*/
+//_________________________________________________________________________________________________________________________
+// other includes
+//_________________________________________________________________________________________________________________________
#ifndef _RTL_USTRING_
#include <rtl/ustring>
@@ -92,19 +84,21 @@
#include <windows.h>
#include <objbase.h>
+#include <memory>
+
#include <process.h>
-#include <comdef.h>
+#include "XTDo.hxx"
//-------------------------------------------------------------
// my defines
//-------------------------------------------------------------
-const bool EVT_MANUAL_RESET = true;
-const bool EVT_AUTO_RESET = false;
-const bool EVT_INIT_NONSIGNALED = false;
-const bool EVT_INIT_SIGNALED = true;
-const char EVT_NONAME[] = "";
-const int MAX_LOOP = 1000;
+#define WRITE_CB
+#define EVT_MANUAL_RESET TRUE
+#define EVT_INIT_NONSIGNALED FALSE
+#define EVT_NONAME ""
+#define WAIT_MSGLOOP
+#define RAW_MARSHALING
//------------------------------------------------------------
// namesapces
@@ -117,128 +111,58 @@ using namespace ::std;
// globales
//------------------------------------------------------------
-HANDLE g_HandleArray[2];
-HANDLE& g_hEvtMarshalClipDataObj = g_HandleArray[0];
-HANDLE& g_hThread = g_HandleArray[1];
-HANDLE g_hEvtThreadWakeup;
-BOOL g_bRawMarshalling = false;
-HGLOBAL g_hGlob = NULL;
-IStreamPtr g_pStm;
-
-
-enum APARTMENT_MODEL
-{
- STA = 0,
- MTA,
- OLE
-};
-
-//------------------------------------------------------------
-//
-//------------------------------------------------------------
-
-void SetupApartment( APARTMENT_MODEL apm )
-{
- // setup another apartment
- HRESULT hr;
-
- switch ( apm )
- {
- case STA:
- hr = CoInitializeEx( NULL, COINIT_APARTMENTTHREADED );
- OSL_ENSURE( SUCCEEDED( hr ), "CoInitialize STA failed" );
- break;
-
- case MTA:
- hr = CoInitializeEx( NULL, COINIT_MULTITHREADED );
- OSL_ENSURE( SUCCEEDED( hr ), "CoInitialize MTA failed" );
- break;
-
- case OLE:
- hr = OleInitialize( NULL );
- OSL_ENSURE( SUCCEEDED( hr ), "OleInitialize failed" );
- break;
-
- default:
- OSL_ENSURE( false, "invalid apartment model" );
- }
-}
-
-//------------------------------------------------------------
-//
-//------------------------------------------------------------
+HANDLE g_hEvtThreadWakeup;
-void ShutdownApartment( APARTMENT_MODEL apm )
-{
- switch ( apm )
- {
- case STA:
- case MTA:
- CoUninitialize( );
- break;
- case OLE:
- OleUninitialize( );
- break;
- }
-}
+#ifdef RAW_MARSHALING
+ HGLOBAL g_hGlob;
+#else
+ IStream* g_pStm;
+#endif
//################################################################
// a thread in another apartment to test apartment transparency
unsigned int _stdcall ThreadProc(LPVOID pParam)
{
- APARTMENT_MODEL* apm = reinterpret_cast< APARTMENT_MODEL* >( pParam );
+ // setup another apartment
+ HRESULT hr = OleInitialize( NULL );
+
+ WaitForSingleObject( g_hEvtThreadWakeup, INFINITE );
- SetupApartment( *apm );
+ IDataObject* pIDo;
- for ( int i = 0; i < MAX_LOOP; i++ )
+#ifdef RAW_MARSHALING
+
+ IStream* pStm = NULL;
+ hr = CreateStreamOnHGlobal( g_hGlob, FALSE, &pStm );
+ if ( SUCCEEDED( hr ) )
{
- WaitForSingleObject( g_hEvtThreadWakeup, INFINITE );
+ hr = CoUnmarshalInterface(
+ pStm,
+ __uuidof( IDataObject ),
+ (void**)&pIDo );
- try
- {
- HRESULT hr;
- IDataObjectPtr pIDo;
+ hr = pStm->Release( );
+ }
- if ( g_bRawMarshalling )
- {
- IStreamPtr pStm = NULL;
- hr = CreateStreamOnHGlobal( g_hGlob, FALSE, &pStm );
- OSL_ENSURE( SUCCEEDED( hr ), "CreateStreamOnHGlobal failed" );
-
- hr = CoUnmarshalInterface(
- pStm, __uuidof( IDataObject ), (void**)&pIDo );
- OSL_ENSURE( SUCCEEDED( hr ), "CoUnmarshalInterface failed" );
- }
- else
- {
- IStream* pIStm = g_pStm.Detach( );
+#else
- hr = CoGetInterfaceAndReleaseStream(
- pIStm, __uuidof( IDataObject ), (void**)&pIDo );
+ hr = CoGetInterfaceAndReleaseStream(
+ g_pStm,
+ __uuidof( IDataObject ),
+ (void**)&pIDo
+ );
- OSL_ENSURE( SUCCEEDED( hr ), "CoGetInterfaceAndReleaseStream failed" );
- }
+#endif
- // only to call some interface functions
- IEnumFORMATETCPtr pIEnumFetc;
- hr = pIDo->EnumFormatEtc( DATADIR_GET, &pIEnumFetc );
- OSL_ENSURE( SUCCEEDED( hr ), "EnumFormatEtc failed" );
+ IEnumFORMATETC* pIEEtc;
+ hr = pIDo->EnumFormatEtc( DATADIR_GET, &pIEEtc );
- // release the object before calling
- // CoUninitialize
- pIDo.Detach( );
- }
- catch( _com_error& ex )
- {
- HRESULT hr = ex.Error( );
- OSL_ENSURE( false, "com exception caught" );
- }
+ hr = OleIsCurrentClipboard( pIDo );
- SetEvent( g_HandleArray[0] );
- } // end for
+ hr = OleFlushClipboard( );
- ShutdownApartment( *apm );
+ OleUninitialize( );
return 0;
}
@@ -246,127 +170,108 @@ unsigned int _stdcall ThreadProc(LPVOID pParam)
//################################################################
//----------------------------------------------------------------
-//
-//----------------------------------------------------------------
-
-void MarshalClipboardDataObject( IDataObjectPtr pIDo )
-{
- HRESULT hr;
-
- if ( g_bRawMarshalling )
- {
- IStreamPtr pStm = NULL;
-
- hr = CreateStreamOnHGlobal( 0, false, &pStm );
- OSL_ENSURE( SUCCEEDED( hr ), "CreateStreamOnHGlobal failed" );
-
- hr = CoMarshalInterface(
- pStm,
- __uuidof( IDataObject ),
- pIDo,
- MSHCTX_INPROC,
- 0,
- MSHLFLAGS_NORMAL );
-
- OSL_ENSURE( SUCCEEDED( hr ), "CoMarshalInterface failed" );
-
- hr = GetHGlobalFromStream( pStm, &g_hGlob );
-
- OSL_ENSURE( SUCCEEDED( hr ), "GetHGlobalFromStream failed" );
- }
- else
- {
- hr = CoMarshalInterThreadInterfaceInStream(
- __uuidof( IDataObject ),
- pIDo,
- &g_pStm );
-
- OSL_ENSURE( SUCCEEDED( hr ), "CoMarshalInterThreadInterfaceInStream failed" );
- }
-}
-
-//----------------------------------------------------------------
// main
//----------------------------------------------------------------
int SAL_CALL main( int nArgc, char* Argv[] )
{
- if ( nArgc < 4 )
- {
- printf( "Use 0|1|2 [sta,mta,ole] 0|1|2 [sta,mta,ole] 0|1 [raw, non-raw]\n" );
- return 0;
- }
+ HRESULT hr = OleInitialize( NULL );
- SetupApartment( (APARTMENT_MODEL)atoi( Argv[1] ) );
+ g_hEvtThreadWakeup = CreateEvent( 0,
+ EVT_MANUAL_RESET,
+ EVT_INIT_NONSIGNALED,
+ EVT_NONAME );
- // read parameter
+ unsigned uThreadId;
+ HANDLE hThread;
- APARTMENT_MODEL apm = (APARTMENT_MODEL)atoi( Argv[2] );
- g_bRawMarshalling = (bool)atoi( Argv[3] );
+ // create a thread in another apartment
+ hThread = (void*)_beginthreadex( NULL, 0, ThreadProc, NULL, 0, &uThreadId );
- g_hEvtThreadWakeup = CreateEventA(
- 0, EVT_AUTO_RESET, EVT_INIT_NONSIGNALED, EVT_NONAME );
+ IDataObject* pIDo = new CXTDataObject( );
- OSL_ENSURE( g_hEvtThreadWakeup, "CreateEvent failed" );
+ hr = OleSetClipboard( pIDo );
+ hr = E_FAIL;
- g_HandleArray[0] = CreateEventA(
- 0, EVT_AUTO_RESET, EVT_INIT_SIGNALED, EVT_NONAME );
+ hr = OleIsCurrentClipboard( pIDo );
- OSL_ENSURE( g_hEvtMarshalClipDataObj, "CreateEvent failed" );
+ //hr = OleGetClipboard( &pIDo );
+ if ( SUCCEEDED( hr ) )
+ {
+#ifdef RAW_MARSHALING
- unsigned uThreadId;
+ IStream* pStm = NULL;
- // create a thread in another apartment
- g_HandleArray[1] = (HANDLE)_beginthreadex(
- NULL, 0, ThreadProc, &apm, 0, &uThreadId );
+ hr = CreateStreamOnHGlobal( 0, FALSE, &pStm );
+ if ( SUCCEEDED( hr ) )
+ {
+ hr = CoMarshalInterface(
+ pStm,
+ __uuidof( IDataObject ),
+ pIDo,
+ MSHCTX_INPROC,
+ 0,
+ MSHLFLAGS_NORMAL );
+ if ( SUCCEEDED( hr ) )
+ hr = GetHGlobalFromStream( pStm, &g_hGlob );
- OSL_ENSURE( g_hThread, "create thread failed" );
+ hr = pStm->Release( );
+ }
- bool bContinue = true;
- HRESULT hr;
+#else
- while( bContinue )
- {
- IDataObjectPtr pIDo;
+ hr = CoMarshalInterThreadInterfaceInStream(
+ __uuidof( IDataObject ),
+ pIDo,
+ &g_pStm );
- DWORD dwResult = MsgWaitForMultipleObjects(
- 2, g_HandleArray, false, INFINITE, QS_ALLEVENTS );
+#endif
- switch( dwResult )
+ if ( SUCCEEDED( hr ) )
{
- case WAIT_OBJECT_0:
- pIDo.Detach( );
- hr = OleGetClipboard( &pIDo );
- OSL_ENSURE( SUCCEEDED( hr ), "OleGetClipboard failed" );
-
- MarshalClipboardDataObject( pIDo );
+ // wakeup the thread and waiting util it ends
+ SetEvent( g_hEvtThreadWakeup );
- // wakeup the thread
- SetEvent( g_hEvtThreadWakeup );
- break;
+#ifdef WAIT_MSGLOOP
- case WAIT_OBJECT_0 + 1:
- bContinue = false;
- break;
+ BOOL bContinue = TRUE;
- case WAIT_OBJECT_0 + 2:
+ while( bContinue )
{
- // sta threads need to have a message loop
- // else the deadlock
- MSG msg;
- while( PeekMessageA( &msg, NULL, 0, 0, PM_REMOVE ) )
- DispatchMessageA(&msg);
- }
- break;
- }
- } // while
+ DWORD dwResult = WaitForMultipleObjects(
+ 1,
+ &hThread,
+ TRUE,
+ 0 );
+
+ if ( WAIT_OBJECT_0 == dwResult )
+ {
+ bContinue = FALSE;
+ }
+ else
+ {
+ MSG msg;
+ while( PeekMessage(
+ &msg,
+ NULL,
+ 0,
+ 0,
+ PM_REMOVE ) )
+ {
+ TranslateMessage(&msg);
+ DispatchMessage(&msg);
+ }
+ }
+ } // while
+
+#endif
+
+ } // if
+ } // if
- // cleanup
- CloseHandle( g_hEvtThreadWakeup );
- CloseHandle( g_hEvtMarshalClipDataObj );
- CloseHandle( g_hThread );
+ OleFlushClipboard( );
- ShutdownApartment( (APARTMENT_MODEL)atoi( Argv[1] ) );
+ OleUninitialize( );
return 0;
}
diff --git a/dtrans/test/win32/dnd/atlwindow.cxx b/dtrans/test/win32/dnd/atlwindow.cxx
index c24c87d56019..a87d780d2d27 100644
--- a/dtrans/test/win32/dnd/atlwindow.cxx
+++ b/dtrans/test/win32/dnd/atlwindow.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: atlwindow.cxx,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: jl $ $Date: 2001-07-19 11:14:24 $
+ * last change: $Author: hr $ $Date: 2003-03-25 14:05:41 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -72,7 +72,6 @@
#include "targetlistener.hxx"
#include "sourcelistener.hxx"
//#include "transferable.hxx"
-#include "dataobject.hxx"
#include <map>
#include <winbase.h>
@@ -147,8 +146,7 @@ LRESULT AWindow::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandle
// create the DragSource
- OUString sServiceSource( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.datatransfer.dnd.OleDragSource"));
- Reference< XInterface> xint= MultiServiceFactory->createInstance(sServiceSource);
+ Reference< XInterface> xint= MultiServiceFactory->createInstance(OUString(L"com.sun.star.datatransfer.dnd.OleDragSource"));
m_xDragSource= Reference<XDragSource>( xint, UNO_QUERY);
Reference<XInitialization> xInit( xint, UNO_QUERY);
@@ -157,33 +155,18 @@ LRESULT AWindow::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandle
xInit->initialize( Sequence<Any>( ar, 2) );
//create the DropTarget
- // the initialization func of the drop target can be called from an STA or
- // MTA
Reference< XInterface> xintTarget= MultiServiceFactory->createInstance(OUString(L"com.sun.star.datatransfer.dnd.OleDropTarget"));
m_xDropTarget= Reference<XDropTarget>( xintTarget, UNO_QUERY);
Reference<XInitialization> xInitTarget( xintTarget, UNO_QUERY);
- // call Initialize from the mta thread
- if( m_bInitInMTA)
- {
- InitializationData* pData= (InitializationData*) CoTaskMemAlloc(sizeof( InitializationData));
- ZeroMemory( pData, sizeof( InitializationData));
- pData->xInit= xInitTarget;
- pData->hWnd= m_hWnd;
+ Any any;
+ any <<= (sal_uInt32)m_hWnd;
+ xInitTarget->initialize( Sequence<Any>( &any, 1) );
- PostThreadMessage( m_idMTAThread, WM_SOURCE_INIT,(WPARAM) pData, 0);
- }
- else
- {
- // call initialize from the current thread
- Any any;
- any <<= (sal_uInt32)m_hWnd;
- xInitTarget->initialize( Sequence<Any>( &any, 1) );
- }
m_xDropTarget->addDropTargetListener( static_cast<XDropTargetListener*>
( new DropTargetListener( m_hwndEdit)) );
-// // make this window a drop target
+// // make this window tho a drop target
m_xDropTarget->setActive(sal_True);
return 0;
@@ -210,36 +193,51 @@ LRESULT AWindow::OnTimer(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled
HRESULT hr;
USES_CONVERSION;
KillTimer( 1);
- // only if the dragsource exists and it is our own timer
- if(m_xDragSource.is() && (UINT) wParam == 1)
+ if(m_xDragSource.is())
{
//Get the Text out of the Edit window
int length= (int)::SendMessageA( m_hwndEdit, WM_GETTEXTLENGTH, 0, 0);
char * pBuffer= new char[length + 1];
ZeroMemory( pBuffer, length + 1);
- ::SendMessageA( m_hwndEdit, WM_GETTEXT, length+1, (LPARAM) pBuffer);
-
- IDataObject* pData= (IDataObject*)new DataObject(pBuffer);
- pData->AddRef();
+ ::SendMessageA( m_hwndEdit, WM_GETTEXT, length, (LPARAM) pBuffer);
+ IDataObject* pData= NULL;
+ HRESULT hr= CreateDataCache( NULL, CLSID_NULL, __uuidof(IDataObject),(void**) &pData);
if( pData)
{
-// CDTransObjFactory fac;
-// Reference<XTransferable> xTrans= fac.createTransferableFromDataObj(
-// MultiServiceFactory, pData);
+ FORMATETC format={ CF_TEXT, NULL, DVASPECT_CONTENT, -1, };
+
+ HGLOBAL mem= GlobalAlloc(GHND, length + 1 );
+ void* pMem= GlobalLock( mem);
+ memcpy( pMem, pBuffer, length+1);
+ GlobalUnlock( mem);
- Reference<XTransferable> xTrans= m_aDataConverter.createTransferableFromDataObj(
- MultiServiceFactory, pData);
+ STGMEDIUM medium;
+ medium.tymed= TYMED_HGLOBAL;
+ medium.hGlobal= mem;
+ medium.pUnkForRelease= NULL;
+
+ pData->SetData( &format, &medium, TRUE); // releases HGLOBAL eventually
+
+ Reference<XTransferable> xTrans= m_aDataConverter.createTransferableFromDataObj(
+ MultiServiceFactory, pData);
// call XDragSource::executeDrag from an MTA
if( m_isMTA )
{
- StartDragData* pData= (StartDragData*) CoTaskMemAlloc(sizeof( StartDragData));
- ZeroMemory( pData, sizeof( StartDragData));
- pData->source= m_xDragSource;
- pData->transferable= xTrans;
- PostThreadMessage( m_idMTAThread, WM_SOURCE_STARTDRAG,(WPARAM) pData, 0);
+ DWORD mtaThreadId;
+ ThreadData data;
+ data.source= m_xDragSource;
+ data.transferable= xTrans;
+
+ data.evtThreadReady= CreateEvent( NULL, FALSE, FALSE, NULL);
+
+ HANDLE hThread= CreateThread( NULL, 0, MTAFunc, &data, 0, &mtaThreadId);
+ // We must wait until the thread copied the ThreadData structure
+ WaitForSingleObject( data.evtThreadReady, INFINITE);
+ CloseHandle( data.evtThreadReady);
+
}
else
@@ -252,8 +250,6 @@ LRESULT AWindow::OnTimer(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled
Reference<XDragSourceListener>( static_cast<XDragSourceListener*>(new DragSourceListener() ) ) );
}
}
- if( pData)
- pData->Release();
delete[] pBuffer;
}
@@ -294,4 +290,4 @@ LRESULT APIENTRY EditSubclassProc( HWND hwnd, UINT uMsg,WPARAM wParam, LPARAM lP
return CallWindowProc( wpOrigEditProc, hwnd, uMsg,
wParam, lParam);
}
-
+ \ No newline at end of file
diff --git a/dtrans/test/win32/dnd/atlwindow.hxx b/dtrans/test/win32/dnd/atlwindow.hxx
index 2d664510b236..ac5132483e65 100644
--- a/dtrans/test/win32/dnd/atlwindow.hxx
+++ b/dtrans/test/win32/dnd/atlwindow.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: atlwindow.hxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: jl $ $Date: 2001-07-19 11:14:24 $
+ * last change: $Author: hr $ $Date: 2003-03-25 14:05:41 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -64,7 +64,6 @@
extern CComModule _Module;
#include<atlcom.h>
#include<atlctl.h>
-#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/datatransfer/dnd/XDropTarget.hpp>
#include <com/sun/star/datatransfer/dnd/XDragSource.hpp>
#include <com/sun/star/datatransfer/XTransferable.hpp>
@@ -75,21 +74,12 @@ extern CComModule _Module;
using namespace com::sun::star::uno;
using namespace com::sun::star::datatransfer::dnd;
using namespace com::sun::star::datatransfer;
-using namespace com::sun::star::lang;
-#define WM_SOURCE_INIT WM_APP+100
-#define WM_SOURCE_STARTDRAG WM_APP+101
-
-struct StartDragData
+struct ThreadData
{
Reference<XDragSource> source;
Reference<XTransferable> transferable;
-};
-
-struct InitializationData
-{
- Reference<XInitialization> xInit;
- HWND hWnd;
+ HANDLE evtThreadReady;
};
class AWindow: public CWindowImpl<AWindow, CWindow,
@@ -99,21 +89,18 @@ class AWindow: public CWindowImpl<AWindow, CWindow,
Reference<XDropTarget> m_xDropTarget;
Reference<XDragSource> m_xDragSource;
BOOL m_isMTA;
- BOOL m_bInitInMTA;
+
HWND m_hwndEdit;
- // Id of the MTA thread to which we post messages.
- DWORD m_idMTAThread;
+
CDTransObjFactory m_aDataConverter;
public:
- AWindow(LPCTSTR strName, DWORD idMTAThread): m_idMTAThread( idMTAThread)
+ AWindow(LPCTSTR strName)
{
RECT rcPos= {0,0,200,200};
Create(0, rcPos, strName);
}
- AWindow(LPCTSTR strName, DWORD idMTAThread, RECT pos, BOOL mta=FALSE,
- BOOL initInMTA=FALSE):
- m_isMTA( mta), m_idMTAThread( idMTAThread), m_bInitInMTA( initInMTA)
+ AWindow(LPCTSTR strName, RECT pos, BOOL mta=FALSE): m_isMTA( mta)
{
Create(0, pos, strName);
}
@@ -144,4 +131,4 @@ public:
};
-#endif
+#endif \ No newline at end of file
diff --git a/dtrans/test/win32/dnd/makefile.mk b/dtrans/test/win32/dnd/makefile.mk
index 537f834549f6..d8603b9b2443 100644
--- a/dtrans/test/win32/dnd/makefile.mk
+++ b/dtrans/test/win32/dnd/makefile.mk
@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.9 $
+# $Revision: 1.10 $
#
-# last change: $Author: jbu $ $Date: 2002-10-01 07:33:40 $
+# last change: $Author: hr $ $Date: 2003-03-25 14:05:43 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
@@ -80,7 +80,7 @@ BOOTSTRAP_SERVICE=FALSE
# --- Files ---
-# CFLAGS+=/GR -DUNICODE -D_UNICODE
+# CFLAGS+=-GR -DUNICODE -D_UNICODE
CFLAGS+= -D_WIN32_DCOM
.IF "$(BOOTSTRAP_SERVICE)" == "TRUE"
diff --git a/dtrans/test/win32/dnd/targetlistener.cxx b/dtrans/test/win32/dnd/targetlistener.cxx
index 2f6d51657635..8a1e4d2b101d 100644
--- a/dtrans/test/win32/dnd/targetlistener.cxx
+++ b/dtrans/test/win32/dnd/targetlistener.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: targetlistener.cxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: jl $ $Date: 2001-08-14 14:11:25 $
+ * last change: $Author: hr $ $Date: 2003-03-25 14:05:43 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -87,9 +87,9 @@ void SAL_CALL DropTargetListener::disposing( const EventObject& Source )
void SAL_CALL DropTargetListener::drop( const DropTargetDropEvent& e )
throw(RuntimeException)
{
- e.Context->dropComplete( sal_True);
- e.Context->acceptDrop( ACTION_COPY);
-// e.Context->rejectDrop();
+// e.Context->dropComplete( sal_True);
+// e.Context->acceptDrop( ACTION_COPY);
+ e.Context->rejectDrop();
// if the Transferable contains text, then we send it to the edit window
// Sequence<DataFlavor> flavors= e.Transferable->getTransferDataFlavors();
@@ -108,13 +108,9 @@ void SAL_CALL DropTargetListener::drop( const DropTargetDropEvent& e )
void SAL_CALL DropTargetListener::dragEnter( const DropTargetDragEnterEvent& dtde )
throw(RuntimeException)
{
- if( (dtde.SourceActions & dtde.DropAction) )
- {
- dtde.Context->acceptDrag( dtde.DropAction);
- }
//If one drags something that is not moveable
-// if( !(dtde.SourceActions & dtde.DropAction) )
-// dtde.Context->acceptDrag( ACTION_COPY);
+ if( !(dtde.SourceActions & dtde.DropAction) )
+ dtde.Context->acceptDrag( ACTION_COPY);
// dtde.Context->rejectDrag( );
@@ -128,13 +124,8 @@ void SAL_CALL DropTargetListener::dragExit( const DropTargetEvent& dte )
void SAL_CALL DropTargetListener::dragOver( const DropTargetDragEvent& dtde )
throw(RuntimeException)
{
- if( (dtde.SourceActions & dtde.DropAction) )
- {
- dtde.Context->acceptDrag( dtde.DropAction);
- }
-
-// if( (dtde.SourceActions & dtde.DropAction) )
-// dtde.Context->acceptDrag( ACTION_COPY);
+ if( !(dtde.SourceActions & dtde.DropAction) )
+ dtde.Context->acceptDrag( ACTION_COPY);
}
void SAL_CALL DropTargetListener::dropActionChanged( const DropTargetDragEvent& dtde )