summaryrefslogtreecommitdiff
path: root/dtrans/source/win32/workbench/test_wincb.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'dtrans/source/win32/workbench/test_wincb.cxx')
-rw-r--r--dtrans/source/win32/workbench/test_wincb.cxx92
1 files changed, 46 insertions, 46 deletions
diff --git a/dtrans/source/win32/workbench/test_wincb.cxx b/dtrans/source/win32/workbench/test_wincb.cxx
index 65118eed7fbd..f548c03fd1ca 100644
--- a/dtrans/source/win32/workbench/test_wincb.cxx
+++ b/dtrans/source/win32/workbench/test_wincb.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -31,14 +31,14 @@
//_________________________________________________________________________________________________________________________
-// interface includes
+// interface includes
//_________________________________________________________________________________________________________________________
#include "..\misc\ImplHelper.hxx"
//_________________________________________________________________________________________________________________________
-// other includes
+// other includes
//_________________________________________________________________________________________________________________________
#include <cppuhelper/servicefactory.hxx>
#include <com/sun/star/datatransfer/XTransferable.hpp>
@@ -80,27 +80,27 @@
#define EVT_NONAME ""
//------------------------------------------------------------
-// namesapces
+// namesapces
//------------------------------------------------------------
-using namespace ::rtl;
+using namespace ::rtl;
using namespace ::std;
using namespace ::cppu;
using namespace ::com::sun::star::datatransfer;
using namespace ::com::sun::star::datatransfer::clipboard;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::io;
-using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::lang;
//------------------------------------------------------------
-// globales
+// globales
//------------------------------------------------------------
Reference< XTransferable > rXTransfRead;
-HANDLE g_hEvtThreadWakeup;
+HANDLE g_hEvtThreadWakeup;
//------------------------------------------------------------
-//
+//
//------------------------------------------------------------
class CClipboardListener : public WeakImplHelper1 < XClipboardListener >
@@ -111,7 +111,7 @@ public:
//-------------------------------------------------
// XClipboardListener
//-------------------------------------------------
-
+
virtual void SAL_CALL disposing( const EventObject& Source ) throw(RuntimeException);
virtual void SAL_CALL changedContents( const ClipboardEvent& event ) throw( RuntimeException );
};
@@ -131,39 +131,39 @@ void SAL_CALL CClipboardListener::changedContents( const ClipboardEvent& event )
}
//------------------------------------------------------------
-//
+//
//------------------------------------------------------------
class CTransferable : public WeakImplHelper2< XClipboardOwner, XTransferable >
{
-public:
+public:
CTransferable( );
-
+
//-------------------------------------------------
// XTransferable
//-------------------------------------------------
- virtual Any SAL_CALL getTransferData( const DataFlavor& aFlavor )
+ virtual Any SAL_CALL getTransferData( const DataFlavor& aFlavor )
throw(UnsupportedFlavorException, IOException, RuntimeException);
virtual Sequence< DataFlavor > SAL_CALL getTransferDataFlavors( ) 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 >& xTrans )
+ virtual void SAL_CALL lostOwnership( const Reference< XClipboard >& xClipboard, const Reference< XTransferable >& xTrans )
throw(RuntimeException);
-
+
private:
Sequence< DataFlavor > m_FlavorList;
OUString m_Data;
};
//----------------------------------------------------------------
-// ctor
+// ctor
//----------------------------------------------------------------
CTransferable::CTransferable( ) :
@@ -171,10 +171,10 @@ CTransferable::CTransferable( ) :
m_Data( OUString::createFromAscii( "Ich habe mir ein neues Fahrrad gekauft!" ) )
{
DataFlavor df;
-
+
//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 );
@@ -182,12 +182,12 @@ CTransferable::CTransferable( ) :
}
//----------------------------------------------------------------
-// getTransferData
+// getTransferData
//----------------------------------------------------------------
-Any SAL_CALL CTransferable::getTransferData( const DataFlavor& aFlavor )
+Any SAL_CALL CTransferable::getTransferData( const DataFlavor& aFlavor )
throw(UnsupportedFlavorException, IOException, RuntimeException)
-{
+{
Any anyData;
/*
@@ -196,9 +196,9 @@ Any SAL_CALL CTransferable::getTransferData( const DataFlavor& aFlavor )
*/
if ( aFlavor.MimeType.equalsIgnoreCase( m_FlavorList[0].MimeType ) )
{
- OString text(
- m_Data.getStr( ),
- m_Data.getLength( ),
+ OString text(
+ m_Data.getStr( ),
+ m_Data.getLength( ),
RTL_TEXTENCODING_ASCII_US );
Sequence< sal_Int8 > textStream( text.getLength( ) + 1 );
@@ -206,7 +206,7 @@ Any SAL_CALL CTransferable::getTransferData( const DataFlavor& aFlavor )
rtl_copyMemory( textStream.getArray( ), text.getStr( ), textStream.getLength( ) );
anyData = makeAny( textStream );
- }
+ }
else
throw UnsupportedFlavorException( );
@@ -214,54 +214,54 @@ Any SAL_CALL CTransferable::getTransferData( const DataFlavor& aFlavor )
}
//----------------------------------------------------------------
-// getTransferDataFlavors
+// getTransferDataFlavors
//----------------------------------------------------------------
-Sequence< DataFlavor > SAL_CALL CTransferable::getTransferDataFlavors( )
+Sequence< DataFlavor > SAL_CALL CTransferable::getTransferDataFlavors( )
throw(RuntimeException)
{
return m_FlavorList;
}
//----------------------------------------------------------------
-// isDataFlavorSupported
+// isDataFlavorSupported
//----------------------------------------------------------------
-sal_Bool SAL_CALL CTransferable::isDataFlavorSupported( const DataFlavor& aFlavor )
+sal_Bool SAL_CALL CTransferable::isDataFlavorSupported( const DataFlavor& aFlavor )
throw(RuntimeException)
{
sal_Int32 nLength = m_FlavorList.getLength( );
-
+
for ( sal_Int32 i = 0; i < nLength; ++i )
- if ( m_FlavorList[i].MimeType == aFlavor.MimeType )
- return sal_True;
+ if ( m_FlavorList[i].MimeType == aFlavor.MimeType )
+ return sal_True;
return sal_False;
}
//----------------------------------------------------------------
-// lostOwnership
+// lostOwnership
//----------------------------------------------------------------
-void SAL_CALL CTransferable::lostOwnership(
- const Reference< XClipboard >& xClipboard, const Reference< XTransferable >& xTrans )
+void SAL_CALL CTransferable::lostOwnership(
+ const Reference< XClipboard >& xClipboard, const Reference< XTransferable >& xTrans )
throw(RuntimeException)
{
//MessageBox( NULL, TEXT("No longer clipboard owner"), TEXT("Info"), MB_OK | MB_ICONINFORMATION );
}
//----------------------------------------------------------------
-// main
+// main
//----------------------------------------------------------------
int SAL_CALL main( int nArgc, char* Argv[] )
{
- // create a multi-threaded apartment; we can test only
+ // 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 );
+ HRESULT hr = CoInitialize( NULL );
char buff[6];
@@ -290,7 +290,7 @@ int SAL_CALL main( int nArgc, char* Argv[] )
Reference< XTransferable > rXTransf( static_cast< XTransferable* >( new CTransferable ) );
- Reference< XClipboard >
+ Reference< XClipboard >
xClipboard( g_xFactory->createInstance( OUString( WINCLIPBOARD_SERVICE_NAME ) ), UNO_QUERY );
if ( !xClipboard.is( ) )
{
@@ -300,7 +300,7 @@ int SAL_CALL main( int nArgc, char* Argv[] )
Reference< XClipboardNotifier > xClipNotifier( xClipboard, UNO_QUERY );
Reference< XClipboardListener > rXClipListener( static_cast< XClipboardListener* >( new CClipboardListener() ) );
- xClipNotifier->addClipboardListener( rXClipListener );
+ xClipNotifier->addClipboardListener( rXClipListener );
MessageBox( NULL, TEXT("Go"), TEXT("INFO"), MB_OK|MB_ICONINFORMATION);
@@ -316,7 +316,7 @@ int SAL_CALL main( int nArgc, char* Argv[] )
*/
MessageBox( NULL, TEXT("Stop"), TEXT("INFO"), MB_OK|MB_ICONINFORMATION);
-
+
// flush the clipboard content
Reference< XFlushableClipboard > rXFlushableClip( xClipboard, UNO_QUERY );
rXFlushableClip->flushClipboard( );
@@ -325,7 +325,7 @@ int SAL_CALL main( int nArgc, char* Argv[] )
xClipNotifier->removeClipboardListener( rXClipListener );
rXClipListener = Reference< XClipboardListener >( );
xClipNotifier = Reference< XClipboardNotifier >( );
-
+
//--------------------------------------------------
// shutdown the service manager
//--------------------------------------------------
@@ -335,7 +335,7 @@ int SAL_CALL main( int nArgc, char* Argv[] )
if ( !xComponent.is() )
OSL_ENSURE(sal_False, "Error shuting down");
-
+
// Dispose and clear factory
xComponent->dispose();
xComponent = Reference< XComponent >( );
@@ -345,7 +345,7 @@ int SAL_CALL main( int nArgc, char* Argv[] )
CoUninitialize( );
- return 0;
+ return 0;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */