dev/null |binary sal/workben/clipboardwben/testcopy/StdAfx.cpp | 29 sal/workben/clipboardwben/testcopy/StdAfx.h | 33 sal/workben/clipboardwben/testcopy/XTDataObject.cxx | 388 --- sal/workben/clipboardwben/testcopy/XTDataObject.hxx | 108 sal/workben/clipboardwben/testcopy/cbcpytest.cxx | 348 -- sal/workben/clipboardwben/testcopy/cbcpytest.rc | 140 - sal/workben/clipboardwben/testcopy/makefile.mk | 58 sal/workben/clipboardwben/testcopy/resource.h | 34 sal/workben/clipboardwben/testpaste/StdAfx.cpp | 29 sal/workben/clipboardwben/testpaste/StdAfx.h | 33 sal/workben/clipboardwben/testpaste/cbptest.cxx | 404 --- sal/workben/clipboardwben/testpaste/cbptest.rc | 138 - sal/workben/clipboardwben/testpaste/makefile.mk | 58 sal/workben/clipboardwben/testpaste/resource.h | 31 sal/workben/clipboardwben/testviewer/StdAfx.cpp | 29 sal/workben/clipboardwben/testviewer/StdAfx.h | 33 sal/workben/clipboardwben/testviewer/cbvtest.cxx | 326 -- sal/workben/clipboardwben/testviewer/cbvtest.rc | 145 - sal/workben/clipboardwben/testviewer/makefile.mk | 58 sal/workben/clipboardwben/testviewer/resource.h | 53 sal/workben/export.exp | 1 sal/workben/getlocaleinfotest.cxx | 39 sal/workben/makefile.mk | 215 - sal/workben/measure_oustrings.cxx | 262 -- sal/workben/t_cipher.c | 392 --- sal/workben/t_digest.c | 366 -- sal/workben/t_ojp_exe.cxx | 44 sal/workben/t_osl_getVolInfo.cxx | 115 sal/workben/t_osl_joinProcess.cxx | 223 - sal/workben/t_random.c | 54 sal/workben/t_readline.c | 70 sal/workben/test.cxx | 55 sal/workben/testfile.cxx | 2550 -------------------- sal/workben/testpip2.cxx | 79 sal/workben/testpipe.cxx | 150 - sal/workben/testproc.cxx | 55 37 files changed, 7145 deletions(-)
New commits: commit b73abe292eda22c2332ff819a1ca5f66d0ee7d9f Author: Stephan Bergmann <sberg...@redhat.com> Date: Wed Nov 23 21:41:21 2016 +0100 Remove dead sal/workben/ stuff All this is probably dead for ages, yet it repeatedly got modified over the years by clean-up commits, be they driven by cppunit or grep. Change-Id: I69443f5b25f24bb5735e7179c915f27b4742fcb5 diff --git a/sal/workben/clipboardwben/testcopy/StdAfx.cpp b/sal/workben/clipboardwben/testcopy/StdAfx.cpp deleted file mode 100644 index bac4b51..0000000 --- a/sal/workben/clipboardwben/testcopy/StdAfx.cpp +++ /dev/null @@ -1,29 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -// stdafx.cpp : source file which only includes the standard header files -// TestWin32.pch is a pre-compiled header file -// stdafx.obj contains the pre-compiled type information - -#include "stdafx.h" - -// TO DO: Reference all additional header files required by STDAFX.H -// rather than by this file - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sal/workben/clipboardwben/testcopy/StdAfx.h b/sal/workben/clipboardwben/testcopy/StdAfx.h deleted file mode 100644 index 10768f6..0000000 --- a/sal/workben/clipboardwben/testcopy/StdAfx.h +++ /dev/null @@ -1,33 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -// stdafx.h : Include-Datei für Standard-System-Include-Dateien, -// oder projektspezifische Include-Dateien, die häufig benutzt, aber -// in unregelmässigen Abständen geandert werden. - -#if !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_) -#define AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -#define WIN32_LEAN_AND_MEAN // Selten benutzte Teile der Windows-Header nicht einbinden - -// Windows-Header-Dateien: -#include <windows.h> - -// Header-Dateien der C-Laufzeit -#include <stdlib.h> -#include <malloc.h> -#include <memory.h> -#include <tchar.h> - -// Lokale Header-Dateien - -// ZU ERLEDIGEN: Verweisen Sie hier auf zusätzliche Header-Dateien, die Ihr Programm benötigt - -//{{AFX_INSERT_LOCATION}} -// Microsoft Visual C++ fügt zusätzliche Deklarationen unmittelbar vor der vorherigen Zeile ein. - -#endif // !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_) - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sal/workben/clipboardwben/testcopy/TestWin32.ico b/sal/workben/clipboardwben/testcopy/TestWin32.ico deleted file mode 100644 index 255ff3b..0000000 Binary files a/sal/workben/clipboardwben/testcopy/TestWin32.ico and /dev/null differ diff --git a/sal/workben/clipboardwben/testcopy/XTDataObject.cxx b/sal/workben/clipboardwben/testcopy/XTDataObject.cxx deleted file mode 100644 index 9a5ea91..0000000 --- a/sal/workben/clipboardwben/testcopy/XTDataObject.cxx +++ /dev/null @@ -1,388 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include <osl/diagnose.h> - -#include "XTDataObject.hxx" - -#include <windows.h> -#include <ole2.h> - -// OTWrapperDataObject - -CXTDataObject::CXTDataObject( LONG nRefCntInitVal ) : - m_nRefCnt( nRefCntInitVal ) -{ -} - -CXTDataObject::~CXTDataObject( ) -{ -} - -// IUnknown->QueryInterface - -STDMETHODIMP CXTDataObject::QueryInterface( REFIID iid, LPVOID* ppvObject ) -{ - OSL_ASSERT( NULL != ppvObject ); - - if ( NULL == ppvObject ) - return E_INVALIDARG; - - HRESULT hr = E_NOINTERFACE; - - *ppvObject = NULL; - - if ( ( __uuidof( IUnknown ) == iid ) || ( __uuidof( IDataObject ) == iid ) ) - { - *ppvObject = static_cast< IUnknown* >( this ); - ( (LPUNKNOWN)*ppvObject )->AddRef( ); - hr = S_OK; - } - - return hr; -} - -// IUnknown->AddRef - -STDMETHODIMP_(ULONG) CXTDataObject::AddRef( ) -{ - return static_cast< ULONG >( InterlockedIncrement( &m_nRefCnt ) ); -} - -// IUnknown->Release - -STDMETHODIMP_(ULONG) CXTDataObject::Release( ) -{ - // we need a helper variable because it's - // not allowed to access a member variable - // after an object is destroyed - ULONG nRefCnt = static_cast< ULONG >( InterlockedDecrement( &m_nRefCnt ) ); - - if ( 0 == nRefCnt ) - { - delete this; - } - - return nRefCnt; -} - -// IDataObject->GetData -// warning: 'goto' ahead (to easy error handling without using exceptions) - -STDMETHODIMP CXTDataObject::GetData(LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium ) -{ - OSL_ASSERT( ( NULL != pFormatetc ) && - ( !IsBadReadPtr( (LPVOID)pFormatetc, sizeof( FORMATETC ) ) ) ); - OSL_ASSERT( ( NULL != pmedium ) && - ( !IsBadWritePtr( (LPVOID)pmedium, sizeof( STGMEDIUM ) ) ) ); - - if ( ( NULL == pFormatetc ) || ( NULL == pmedium ) ) - return E_INVALIDARG; - - HRESULT hr = E_FAIL; - - if ( CF_TEXT == pFormatetc->cfFormat ) - { - LPSTREAM lpStream; - - hr = CreateStreamOnHGlobal( NULL, FALSE, &lpStream ); - if ( SUCCEEDED( hr ) ) - { - char buff[] = "Hello World, How are you!"; - - hr = lpStream->Write( buff, sizeof( buff ) * sizeof( char ), NULL ); - if ( SUCCEEDED( hr ) ) - { - HGLOBAL hGlob; - - GetHGlobalFromStream( lpStream, &hGlob ); - - pmedium->tymed = TYMED_HGLOBAL; - pmedium->hGlobal = hGlob; - pmedium->pUnkForRelease = NULL; - } - lpStream->Release( ); - hr = S_OK; - } - else - { - pmedium->tymed = TYMED_NULL; - } - } - else if ( CF_UNICODETEXT == pFormatetc->cfFormat ) - { - WCHAR buff[] = L"Hello World, How are you!"; - LPSTREAM lpStream; - - hr = CreateStreamOnHGlobal( NULL, FALSE, &lpStream ); - if ( SUCCEEDED( hr ) ) - { - hr = lpStream->Write( buff, sizeof( buff ) * sizeof( WCHAR ), NULL ); - if ( SUCCEEDED( hr ) ) - { - HGLOBAL hGlob; - - GetHGlobalFromStream( lpStream, &hGlob ); - - pmedium->tymed = TYMED_HGLOBAL; - pmedium->hGlobal = hGlob; - pmedium->pUnkForRelease = NULL; - } - lpStream->Release( ); - hr = S_OK; - } - else - { - pmedium->tymed = TYMED_NULL; - } - } - - return hr; -} - -// IDataObject->EnumFormatEtc - -STDMETHODIMP CXTDataObject::EnumFormatEtc( DWORD dwDirection, IEnumFORMATETC** ppenumFormatetc ) -{ - if ( ( NULL == ppenumFormatetc ) || ( DATADIR_SET == dwDirection ) ) - return E_INVALIDARG; - - *ppenumFormatetc = NULL; - - HRESULT hr = E_FAIL; - - if ( DATADIR_GET == dwDirection ) - { - *ppenumFormatetc = new CEnumFormatEtc( this ); - static_cast< LPUNKNOWN >( *ppenumFormatetc )->AddRef( ); - hr = S_OK; - } - - return hr; -} - -// IDataObject->QueryGetData - -STDMETHODIMP CXTDataObject::QueryGetData( LPFORMATETC pFormatetc ) -{ - return E_NOTIMPL; -} - -// IDataObject->GetDataHere - -STDMETHODIMP CXTDataObject::GetDataHere( LPFORMATETC, LPSTGMEDIUM ) -{ - return E_NOTIMPL; -} - -// IDataObject->GetCanonicalFormatEtc - -STDMETHODIMP CXTDataObject::GetCanonicalFormatEtc( LPFORMATETC, LPFORMATETC ) -{ - return E_NOTIMPL; -} - -// IDataObject->SetData - -STDMETHODIMP CXTDataObject::SetData( LPFORMATETC, LPSTGMEDIUM, BOOL ) -{ - return E_NOTIMPL; -} - -// IDataObject->DAdvise - -STDMETHODIMP CXTDataObject::DAdvise( LPFORMATETC, DWORD, LPADVISESINK, DWORD * ) -{ - return E_NOTIMPL; -} - -// IDataObject->DUnadvise - -STDMETHODIMP CXTDataObject::DUnadvise( DWORD ) -{ - return E_NOTIMPL; -} - -// IDataObject->EnumDAdvise - -STDMETHODIMP CXTDataObject::EnumDAdvise( LPENUMSTATDATA * ) -{ - return E_NOTIMPL; -} - -// for our convenience - -CXTDataObject::operator IDataObject*( ) -{ - return static_cast< IDataObject* >( this ); -} - -// CEnumFormatEtc - -CEnumFormatEtc::CEnumFormatEtc( LPUNKNOWN pUnkDataObj ) : - m_nRefCnt( 0 ), - m_pUnkDataObj( pUnkDataObj ), - m_nCurrentPos( 0 ) -{ - m_cfFormats[0] = CF_UNICODETEXT; - m_cfFormats[1] = CF_TEXT; -} - -CEnumFormatEtc::~CEnumFormatEtc( ) -{ -} - -// IUnknown->QueryInterface - -STDMETHODIMP CEnumFormatEtc::QueryInterface( REFIID iid, LPVOID* ppvObject ) -{ - if ( NULL == ppvObject ) - return E_INVALIDARG; - - HRESULT hr = E_NOINTERFACE; - - *ppvObject = NULL; - - if ( ( __uuidof( IUnknown ) == iid ) || ( __uuidof( IEnumFORMATETC ) == iid ) ) - { - *ppvObject = static_cast< IUnknown* >( this ); - static_cast< LPUNKNOWN >( *ppvObject )->AddRef( ); - hr = S_OK; - } - - return hr; -} - -// IUnknown->AddRef - -STDMETHODIMP_(ULONG) CEnumFormatEtc::AddRef( ) -{ - // keep the dataobject alive - m_pUnkDataObj->AddRef( ); - return InterlockedIncrement( &m_nRefCnt ); -} - -// IUnknown->Release - -STDMETHODIMP_(ULONG) CEnumFormatEtc::Release( ) -{ - // release the outer dataobject - m_pUnkDataObj->Release( ); - - // we need a helper variable because it's - // not allowed to access a member variable - // after an object is destroyed - ULONG nRefCnt = InterlockedDecrement( &m_nRefCnt ); - if ( 0 == nRefCnt ) - delete this; - - return nRefCnt; -} - -// IEnumFORMATETC->Next - -STDMETHODIMP CEnumFormatEtc::Next( ULONG celt, LPFORMATETC rgelt, ULONG* pceltFetched ) -{ - OSL_ASSERT( ( ( celt > 0 ) && ( NULL != rgelt ) ) || - ( ( 0 == celt ) && ( NULL == rgelt ) ) ); - - if ( ( 0 != celt ) && ( NULL == rgelt ) ) - return E_INVALIDARG; - - ULONG ulFetched = 0; - ULONG ulToFetch = celt; - HRESULT hr = S_FALSE; - - while( ( m_nCurrentPos < sizeof( m_cfFormats ) ) && ( ulToFetch > 0 ) ) - { - OSL_ASSERT( !IsBadWritePtr( (LPVOID)rgelt, sizeof( FORMATETC ) ) ); - - rgelt->cfFormat = m_cfFormats[m_nCurrentPos]; - rgelt->ptd = NULL; - rgelt->dwAspect = DVASPECT_CONTENT; - rgelt->lindex = -1; - rgelt->tymed = TYMED_HGLOBAL; - - ++m_nCurrentPos; - ++rgelt; - --ulToFetch; - ++ulFetched; - } - - if ( ulFetched == celt ) - hr = S_OK; - - if ( NULL != pceltFetched ) - { - OSL_ASSERT( !IsBadWritePtr( (LPVOID)pceltFetched, sizeof( ULONG ) ) ); - *pceltFetched = ulFetched; - } - - return hr; -} - -// IEnumFORMATETC->Skip - -STDMETHODIMP CEnumFormatEtc::Skip( ULONG celt ) -{ - HRESULT hr = S_FALSE; - - if ( ( m_nCurrentPos + celt ) < sizeof( m_cfFormats ) ) - { - m_nCurrentPos += celt; - hr = S_OK; - } - - return hr; -} - -// IEnumFORMATETC->Reset - -STDMETHODIMP CEnumFormatEtc::Reset( ) -{ - m_nCurrentPos = 0; - return S_OK; -} - -// IEnumFORMATETC->Clone - -STDMETHODIMP CEnumFormatEtc::Clone( IEnumFORMATETC** ppenum ) -{ - OSL_ASSERT( NULL != ppenum ); - - if ( NULL == ppenum ) - return E_INVALIDARG; - - HRESULT hr = E_FAIL; - - *ppenum = NULL; - - CEnumFormatEtc* pCEnumFEtc = new CEnumFormatEtc( m_pUnkDataObj ); - if ( NULL != pCEnumFEtc ) - { - pCEnumFEtc->m_nCurrentPos = m_nCurrentPos; - *ppenum = static_cast< IEnumFORMATETC* >( pCEnumFEtc ); - static_cast< LPUNKNOWN >( *ppenum )->AddRef( ); - hr = NOERROR; - } - - return hr; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sal/workben/clipboardwben/testcopy/XTDataObject.hxx b/sal/workben/clipboardwben/testcopy/XTDataObject.hxx deleted file mode 100644 index 3b71d78..0000000 --- a/sal/workben/clipboardwben/testcopy/XTDataObject.hxx +++ /dev/null @@ -1,108 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef INCLUDED_SAL_WORKBEN_CLIPBOARDWBEN_TESTCOPY_XTDATAOBJECT_HXX -#define INCLUDED_SAL_WORKBEN_CLIPBOARDWBEN_TESTCOPY_XTDATAOBJECT_HXX - -/* -#include <com/sun/star/datatransfer/XTransferable.hpp> -#include <com/sun/star/datatransfer/clipboard/XClipboardOwner.hpp> -#include "WinClipboard.hxx" -*/ - -#include <windows.h> -#include <ole2.h> -#include <objidl.h> - -class EnumFormatEtc; - -class CXTDataObject : public IDataObject -{ -public: - explicit CXTDataObject(LONG nRefCntInitVal = 0); - ~CXTDataObject( ); - - // ole interface implementation - - //IUnknown - STDMETHODIMP QueryInterface(REFIID iid, LPVOID* ppvObject); - STDMETHODIMP_( ULONG ) AddRef( ); - STDMETHODIMP_( ULONG ) Release( ); - - //IDataObject - 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*( ); - - // notification handler - //void SAL_CALL LostOwnership( ); - - //sal_Int64 SAL_CALL QueryDataSize( ); - - // retrieve the data from the source - // necessary so that - //void SAL_CALL GetAllDataFromSource( ); - -private: - LONG m_nRefCnt; - //CWinClipboard& m_rCWinClipboard; - //const const css::uno::Reference< css::datatransfer::clipboard::XClipboardOwner >& m_rXClipboardOwner; - //const const css::uno::Reference< css::datatransfer::XTransferable >& m_rXTDataSource; - - //friend class CWinClipboard; - friend class CEnumFormatEtc; -}; - -class CEnumFormatEtc : public IEnumFORMATETC -{ -public: - explicit CEnumFormatEtc(LPUNKNOWN pUnkDataObj); - ~CEnumFormatEtc( ); - - // IUnknown - STDMETHODIMP QueryInterface( REFIID iid, LPVOID* ppvObject ); - STDMETHODIMP_( ULONG ) AddRef( ); - STDMETHODIMP_( ULONG ) Release( ); - - //IEnumFORMATETC - STDMETHODIMP Next( ULONG celt, LPFORMATETC rgelt, ULONG* pceltFetched ); - STDMETHODIMP Skip( ULONG celt ); - STDMETHODIMP Reset( ); - STDMETHODIMP Clone( IEnumFORMATETC** ppenum ); - -private: - LONG m_nRefCnt; - LPUNKNOWN m_pUnkDataObj; - ULONG m_nCurrentPos; - CLIPFORMAT m_cfFormats[2]; -}; - -typedef CEnumFormatEtc *PCEnumFormatEtc; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sal/workben/clipboardwben/testcopy/cbcpytest.cxx b/sal/workben/clipboardwben/testcopy/cbcpytest.cxx deleted file mode 100644 index 27f0fe2..0000000 --- a/sal/workben/clipboardwben/testcopy/cbcpytest.cxx +++ /dev/null @@ -1,348 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -// TestWin32.cpp : Defines the entry point for the application. - -#define _WIN32_DCOM -#undef _UNICODE - -#include "stdafx.h" - -#include <windows.h> - -#include <ole2.h> -#include <objidl.h> -#include <objbase.h> -#include <process.h> -#include <olectl.h> -#include <stdlib.h> -#include <malloc.h> -#include <..\..\inc\systools\win32\MtaOleClipb.h> -#include "XTDataObject.hxx" - -#include "resource.h" - -#define MAX_LOADSTRING 100 -#undef USE_MTACB - -#define MSG_FLUSHCLIPBOARD WM_USER + 1 - -// Global variables: -HINSTANCE hInst; // current instance -TCHAR szTitle[MAX_LOADSTRING]; // Text of the title -TCHAR szWindowClass[MAX_LOADSTRING]; // Text of the title -ATOM MyRegisterClass( HINSTANCE hInstance ); -BOOL InitInstance( HINSTANCE, int ); -LRESULT CALLBACK WndProc( HWND, UINT, WPARAM, LPARAM ); -LRESULT CALLBACK About( HWND, UINT, WPARAM, LPARAM ); -void CopyClipboardData(HWND hwndParent); -void FlushClipboard( ); -void PasteData( HWND hWnd ); -void SetLocale(); - -LPSTREAM g_pStm = NULL; -char* pTextBuff = NULL; -DWORD lData = 0; -CXTDataObject* g_xtDo = NULL; -HWND g_hWnd; -HANDLE g_hEvent; -BOOL g_bEnd; - -// a thread function - -unsigned int _stdcall ThreadProc(LPVOID pParam) -{ - while( !g_bEnd ) - { - WaitForSingleObject( g_hEvent, INFINITE ); - SendMessage( g_hWnd, MSG_FLUSHCLIPBOARD, WPARAM(0), LPARAM(0) ); - } - - return 0; -} - -// WinMain - -int APIENTRY WinMain(HINSTANCE hInstance, - HINSTANCE hPrevInstance, - LPSTR lpCmdLine, - int nCmdShow ) -{ - // TODO: Add code here. - MSG msg; - HACCEL hAccelTable; - HRESULT hr = E_FAIL; - - // it's important to initialize ole - // in order to use the clipboard -#ifdef USE_MTACB - hr = CoInitializeEx( NULL, COINIT_MULTITHREADED ); -#else - hr = OleInitialize( NULL ); -#endif - - // Initialize global strings - LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING); - LoadString(hInstance, IDC_TESTWIN32, szWindowClass, MAX_LOADSTRING); - MyRegisterClass(hInstance); - - // Initialization of the applications to carry out: - if( !InitInstance( hInstance, nCmdShow ) ) - { - return FALSE; - } - - hAccelTable = LoadAccelerators(hInstance, (LPCTSTR)IDC_TESTWIN32); - - // Main message loop: - while( GetMessage(&msg, NULL, 0, 0) ) - { - if( !TranslateAccelerator (msg.hwnd, hAccelTable, &msg) ) - { - TranslateMessage( &msg ); - DispatchMessage( &msg ); - } - } - - // uninitializing the ole libraries -#ifdef USE_MTACB - CoUninitialize( ); -#else - OleUninitialize( ); -#endif - - CloseHandle( g_hEvent ); - - return msg.wParam; -} - -// FUNCTION: MyRegisterClass() -// -// PURPOSE: Registers the window class. -// -// COMMENTS: -// This function and its usage are only necessary if this code -// needs to be compatible with Win32 systems prior to 'RegisterClassEx' -// function, which was added to Windows 95. If it important to call -// this function to allow the use of small icons in the correct proportions. - -ATOM MyRegisterClass( HINSTANCE hInstance ) -{ - WNDCLASSEX wcex; - - wcex.cbSize = sizeof(WNDCLASSEX); - - wcex.style = CS_HREDRAW | CS_VREDRAW; - wcex.lpfnWndProc = (WNDPROC)WndProc; - wcex.cbClsExtra = 0; - wcex.cbWndExtra = 0; - wcex.hInstance = hInstance; - wcex.hIcon = LoadIcon(hInstance, (LPCTSTR)IDI_TESTWIN32); - wcex.hCursor = LoadCursor(NULL, IDC_ARROW); - wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); - wcex.lpszMenuName = (LPCTSTR)IDC_TESTWIN32; - wcex.lpszClassName = _T(szWindowClass); - wcex.hIconSm = LoadIcon(wcex.hInstance, (LPCTSTR)IDI_SMALL); - - return RegisterClassEx(&wcex); -} - -// FUNCTION: InitInstance(HANDLE, int) -// -// PURPOSE: Saves instance access number and creates main window -// -// Comments: -// In this function, the instance access number is stored in a global variable -// and the main program window is displayed. - -BOOL InitInstance( HINSTANCE hInstance, int nCmdShow ) -{ - hInst = hInstance; // Store instance access number in our global variable. - - g_hWnd = CreateWindowEx(0, szWindowClass, szTitle, WS_OVERLAPPEDWINDOW, - CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL); - - if( !g_hWnd ) - { - return FALSE; - } - - ShowWindow( g_hWnd, nCmdShow ); - UpdateWindow( g_hWnd ); - - return TRUE; -} - -// FUNCTION: WndProc(HWND, unsigned, WORD, LONG) -// -// PURPOSE: Processes messages for the main window. -// -// WM_COMMAND - Handle application menu -// WM_PAINT - Display main windows -// WM_DESTROY - Output completion message and return - -LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) -{ - int wmId; - PAINTSTRUCT ps; - HDC hdc; - TCHAR szHello[MAX_LOADSTRING]; - - LoadString(hInst, IDS_HELLO, szHello, MAX_LOADSTRING); - - switch( message ) - { - case WM_COMMAND: - wmId = LOWORD(wParam); - // Analyze menu selections: - switch( wmId ) - { - case IDD_COPY: - CopyClipboardData(hWnd); - break; - case IDD_PASTE2: - PasteData(hWnd); - break; - case IDD_LOCALE: - SetLocale(); - break; - case IDM_EXIT: - DestroyWindow( hWnd ); - break; - - default: - return DefWindowProc( hWnd, message, wParam, lParam ); - } - break; - - case WM_PAINT: - hdc = BeginPaint (hWnd, &ps); - // TODO: Add any code for drawing - RECT rt; - GetClientRect( hWnd, &rt ); - - if ( NULL != pTextBuff ) - { - DrawText( hdc, pTextBuff, lData, &rt, DT_CENTER ); - } - else - { - DrawText( hdc, szHello, strlen(szHello), &rt, DT_CENTER ); - } - - EndPaint( hWnd, &ps ); - break; - - case WM_DESTROY: - g_bEnd = TRUE; - SetEvent( g_hEvent ); - FlushClipboard( ); - PostQuitMessage( 0 ); - break; - - default: - return DefWindowProc( hWnd, message, wParam, lParam ); - } - return 0; -} - -// copy data into the clipboard - -void CopyClipboardData( HWND hWnd ) -{ - g_xtDo = new CXTDataObject( 1 ); -#ifdef USE_MTACB - MTASetClipboard( static_cast< IDataObject* >( g_xtDo ) ); -#else - OleSetClipboard( static_cast< IDataObject* >( g_xtDo ) ); -#endif -} - -// flush the content into the clipboard - -void FlushClipboard( ) -{ - if ( NULL != g_xtDo ) - { -#ifdef USE_MTACB - HRESULT hr = MTAIsCurrentClipboard( static_cast< IDataObject* >( g_xtDo ) ); - if ( S_OK == hr ) - MTAFlushClipboard( ); -#else - HRESULT hr = OleIsCurrentClipboard( static_cast< IDataObject* >( g_xtDo ) ); - if ( S_OK == hr ) - OleFlushClipboard( ); -#endif - - static_cast< IDataObject* >( g_xtDo )->Release( ); - } -} - -void PasteData(HWND hWnd) -{ - IDataObject* pDataObj; - - //FlushClipboard( ); - - HRESULT hr = OleGetClipboard( &pDataObj ); - if ( SUCCEEDED( hr ) ) - { - FORMATETC fetc; - STGMEDIUM stgmedium; - - fetc.cfFormat = CF_LOCALE; - fetc.ptd = NULL; - fetc.dwAspect = DVASPECT_CONTENT; - fetc.lindex = -1; - fetc.tymed = TYMED_HGLOBAL; - - hr = pDataObj->GetData( &fetc, &stgmedium ); - if ( SUCCEEDED( hr ) ) - { - LPVOID lpData = GlobalLock( stgmedium.hGlobal ); - - if ( NULL != lpData ) - { - LCID lcid = *( (WORD*)lpData ); - - WORD langID = LANGIDFROMLCID( lcid ); - WORD sublangID = SUBLANGID( langID ); - - TCHAR buff[6]; - int cbWritten = GetLocaleInfo( lcid, LOCALE_IDEFAULTANSICODEPAGE, buff, sizeof( buff ) ); - cbWritten = GetLocaleInfo( lcid, LOCALE_IDEFAULTCODEPAGE, buff, sizeof( buff ) ); - - GlobalUnlock( stgmedium.hGlobal ); - } - else - { - DWORD dwLastError = GetLastError( ); - } - - ReleaseStgMedium( &stgmedium ); - } - } -} - -void SetLocale() -{ - LCID threadLcid = GetThreadLocale(); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sal/workben/clipboardwben/testcopy/cbcpytest.rc b/sal/workben/clipboardwben/testcopy/cbcpytest.rc deleted file mode 100644 index fba2f72..0000000 --- a/sal/workben/clipboardwben/testcopy/cbcpytest.rc +++ /dev/null @@ -1,140 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -//Microsoft Developer Studio generated resource script. - -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS - - -// Generated from the TEXTINCLUDE 2 resource. - -#define APSTUDIO_HIDDEN_SYMBOLS -#include "windows.h" -#undef APSTUDIO_HIDDEN_SYMBOLS -#include "resource.h" - - -#undef APSTUDIO_READONLY_SYMBOLS - - -// German (Germany) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU) -#ifdef _WIN32 -LANGUAGE LANG_GERMAN, SUBLANG_GERMAN -#pragma code_page(1252) -#endif //_WIN32 - - - -// Icon - - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -IDI_TESTWIN32 ICON DISCARDABLE "TestWin32.ICO" -IDI_SMALL ICON DISCARDABLE "SMALL.ICO" - - - -// Menu - - -IDC_TESTWIN32 MENU DISCARDABLE -BEGIN - POPUP "&Datei" - BEGIN - MENUITEM "&Copy", IDD_COPY - MENUITEM "Paste", IDD_PASTE2 - MENUITEM "Set Locale", IDD_LOCALE - MENUITEM SEPARATOR - MENUITEM "&Beenden", IDM_EXIT - END -END - - - - -// Accelerator - - -IDC_TESTWIN32 ACCELERATORS MOVEABLE PURE -BEGIN - "?", IDM_ABOUT, ASCII, ALT - "/", IDM_ABOUT, ASCII, ALT -END - - -#ifdef APSTUDIO_INVOKED - - -// TEXTINCLUDE - - -2 TEXTINCLUDE DISCARDABLE -BEGIN - "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" - "#include ""windows.h""\r\n" - "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" - "#include ""resource.h""\r\n" - "\0" -END - -3 TEXTINCLUDE DISCARDABLE -BEGIN - "\r\n" - "\0" -END - -1 TEXTINCLUDE DISCARDABLE -BEGIN - "resource.h\0" -END - -#endif // APSTUDIO_INVOKED - - - - -// String Table - - -STRINGTABLE DISCARDABLE -BEGIN - IDS_APP_TITLE "TestWin32" - IDS_HELLO "Hallo Welt!" - IDC_TESTWIN32 "TESTWIN32" -END - -#endif // German (Germany) resources - - - - -#ifndef APSTUDIO_INVOKED - - -// Generated from the TEXTINCLUDE 3 resource. - - - - -#endif // not APSTUDIO_INVOKED - diff --git a/sal/workben/clipboardwben/testcopy/makefile.mk b/sal/workben/clipboardwben/testcopy/makefile.mk deleted file mode 100644 index 17e0764..0000000 --- a/sal/workben/clipboardwben/testcopy/makefile.mk +++ /dev/null @@ -1,58 +0,0 @@ -# -# This file is part of the LibreOffice project. -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# This file incorporates work covered by the following license notice: -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed -# with this work for additional information regarding copyright -# ownership. The ASF licenses this file to you under the Apache -# License, Version 2.0 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.apache.org/licenses/LICENSE-2.0 . -# - -PRJ=..$/..$/.. - -PRJNAME=sal -TARGET=cbcpytest -LIBTARGET=NO - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -CFLAGS+= $(LFS_CFLAGS) -CXXFLAGS+= $(LFS_CFLAGS) - -# --- Files -------------------------------------------------------- - -# -# test clipboard paste -# - # --- Resources ---------------------------------------------------- - RCFILES= cbcpytest.rc - - OBJFILES= $(OBJ)$/cbcpytest.obj $(OBJ)$/XTDataObject.obj - - APP1TARGET= $(TARGET) - APP1OBJS= $(OBJFILES) - APP1NOSAL= TRUE - APP1NOSVRES= $(RES)$/$(TARGET).res - - APP1STDLIBS+=$(OLE32LIB) $(USER32LIB) $(KERNEL32LIB) $(SALLIB) - - APP1LIBS=$(LB)$/iole9x.lib \ - $(LB)$/tools32.lib - - APP1DEPN= makefile.mk $(APP1NOSVRES) - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk - - diff --git a/sal/workben/clipboardwben/testcopy/resource.h b/sal/workben/clipboardwben/testcopy/resource.h deleted file mode 100644 index 1c8fac6..0000000 --- a/sal/workben/clipboardwben/testcopy/resource.h +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -//{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. -// Used by cbcpytest.rc - -#define IDC_MYICON 2 -#define IDD_TESTWIN32_DIALOG 102 -#define IDD_ABOUTBOX 103 -#define IDS_APP_TITLE 103 -#define IDM_ABOUT 104 -#define IDM_EXIT 105 -#define IDS_HELLO 106 -#define IDI_TESTWIN32 107 -#define IDI_SMALL 108 -#define IDC_TESTWIN32 109 -#define IDR_MAINFRAME 128 -#define IDD_PASTE 32771 -#define IDD_COPY 32771 -#define IDD_PASTE2 32772 -#define IDD_LOCALE 32773 -#define IDC_STATIC -1 - -// Next default values for new objects - -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 129 -#define _APS_NEXT_COMMAND_VALUE 32774 -#define _APS_NEXT_CONTROL_VALUE 1000 -#define _APS_NEXT_SYMED_VALUE 110 -#endif -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sal/workben/clipboardwben/testcopy/small.ico b/sal/workben/clipboardwben/testcopy/small.ico deleted file mode 100644 index 8f94d9a..0000000 Binary files a/sal/workben/clipboardwben/testcopy/small.ico and /dev/null differ diff --git a/sal/workben/clipboardwben/testpaste/StdAfx.cpp b/sal/workben/clipboardwben/testpaste/StdAfx.cpp deleted file mode 100644 index 6351366..0000000 --- a/sal/workben/clipboardwben/testpaste/StdAfx.cpp +++ /dev/null @@ -1,29 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -// stdafx.cpp : Quelltextdatei, die nur die Standard-Includes einbindet -// TestWin32.pch ist die vorkompilierte Header-Datei -// stdafx.obj enthält die vorkompilierte Typinformation - -#include "stdafx.h" - -// ZU ERLEDIGEN: Verweis auf alle zusätzlichen Header-Dateien, die Sie in STDAFX.H -// und nicht in dieser Datei benötigen - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sal/workben/clipboardwben/testpaste/StdAfx.h b/sal/workben/clipboardwben/testpaste/StdAfx.h deleted file mode 100644 index 9a5dc4d..0000000 --- a/sal/workben/clipboardwben/testpaste/StdAfx.h +++ /dev/null @@ -1,33 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -// stdafx.h : Include-Datei für Standard-System-Include-Dateien, -// oder projektspezifische Include-Dateien, die häufig benutzt, aber -// in unregelmäÃigen Abständen geändert werden. - -#if !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_) -#define AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -#define WIN32_LEAN_AND_MEAN // Selten benutzte Teile der Windows-Header nicht einbinden - -// Windows-Header-Dateien: -#include <windows.h> - -// Header-Dateien der C-Laufzeit -#include <stdlib.h> -#include <malloc.h> -#include <memory.h> -#include <tchar.h> - -// Lokale Header-Dateien - -// ZU ERLEDIGEN: Verweisen Sie hier auf zusätzliche Header-Dateien, die Ihr Programm benötigt - -//{{AFX_INSERT_LOCATION}} -// Microsoft Visual C++ fügt zusätzliche Deklarationen unmittelbar vor der vorherigen Zeile ein. - -#endif // !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_) - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sal/workben/clipboardwben/testpaste/TestWin32.ico b/sal/workben/clipboardwben/testpaste/TestWin32.ico deleted file mode 100644 index 255ff3b..0000000 Binary files a/sal/workben/clipboardwben/testpaste/TestWin32.ico and /dev/null differ diff --git a/sal/workben/clipboardwben/testpaste/cbptest.cxx b/sal/workben/clipboardwben/testpaste/cbptest.cxx deleted file mode 100644 index dfdbad1..0000000 --- a/sal/workben/clipboardwben/testpaste/cbptest.cxx +++ /dev/null @@ -1,404 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -// TestWin32.cpp : Defines the entry point for the application - -#define _WIN32_DCOM - -#include "stdafx.h" - -#include <windows.h> - -#include <ole2.h> -#include <objidl.h> -#include <objbase.h> -#include <process.h> -#include <olectl.h> -#include <stdlib.h> -#include <malloc.h> -#include <..\..\inc\systools\win32\MtaOleClipb.h> - -#include "resource.h" - -#define MAX_LOADSTRING 100 - -// Global variables: -HINSTANCE hInst; // current instance -WCHAR szTitle[MAX_LOADSTRING]; // Text for title -WCHAR szWindowClass[MAX_LOADSTRING]; // Text for title -ATOM MyRegisterClass( HINSTANCE hInstance ); -BOOL InitInstance( HINSTANCE, int ); -LRESULT CALLBACK WndProc( HWND, UINT, WPARAM, LPARAM ); -LRESULT CALLBACK About( HWND, UINT, WPARAM, LPARAM ); -void PasteClipboardData(HWND hwndParent); -void PasteClipboardData2(HWND hwndParent); - -LPSTREAM g_pStm = NULL; -char* pTextBuff = NULL; -DWORD lData = 0; - -// a thread function - -unsigned int _stdcall ThreadProc(LPVOID pParam) -{ - IDataObject* pIDataObj = NULL; - FORMATETC formatETC; - STGMEDIUM stgMedium; - LPVOID pGlobMem; - HWND hwnd; - DWORD sizeGlobBuff; - HRESULT hr; - - hwnd = (HWND)pParam; - - OleInitialize( NULL ); - - hr = OleGetClipboard( &pIDataObj ); - - hr = CoGetInterfaceAndReleaseStream( - g_pStm, - __uuidof(IDataObject), - reinterpret_cast<LPVOID*>(&pIDataObj)); - - formatETC.cfFormat = CF_TEXT; - formatETC.ptd = NULL; - formatETC.dwAspect = DVASPECT_CONTENT; - formatETC.lindex = -1; - formatETC.tymed = TYMED_HGLOBAL; - - hr = pIDataObj->GetData( &formatETC, &stgMedium ); - pGlobMem = GlobalLock( stgMedium.hGlobal ); - if ( NULL != pGlobMem ) - { - if ( NULL != pTextBuff ) - { - free( pTextBuff ); - } - - sizeGlobBuff = GlobalSize( stgMedium.hGlobal ); - pTextBuff = (char*)malloc( sizeGlobBuff + 1 ); - ZeroMemory( pTextBuff, sizeGlobBuff + 1 ); - - memcpy( pTextBuff, pGlobMem, sizeGlobBuff ); - lData = sizeGlobBuff; - - InvalidateRect( hwnd, NULL, TRUE ); - UpdateWindow( hwnd ); - } - - GlobalUnlock( stgMedium.hGlobal ); - - ReleaseStgMedium( &stgMedium ); - - pIDataObj->Release(); - - //CoUninitialize( ); - - OleUninitialize( ); - - return 0; -} - -// WinMain - -int APIENTRY WinMain(HINSTANCE hInstance, - HINSTANCE hPrevInstance, - LPSTR lpCmdLine, - int nCmdShow ) -{ - // TODO: Add code here. - MSG msg; - HACCEL hAccelTable; - HRESULT hr = E_FAIL; - - // it's important to initialize ole - // in order to use the clipboard - //hr = OleInitialize( NULL ); - hr = CoInitializeEx( NULL, COINIT_MULTITHREADED ); - //hr = CoInitializeEx( NULL, COINIT_APARTMENTTHREADED ); - - // Initialize global strings - LoadStringW(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING); - LoadStringW(hInstance, IDC_TESTWIN32, szWindowClass, MAX_LOADSTRING); - MyRegisterClass(hInstance); - - // Initialization of the application to perform: - if( !InitInstance( hInstance, nCmdShow ) ) - { - return FALSE; - } - - hAccelTable = LoadAccelerators(hInstance, (LPCTSTR)IDC_TESTWIN32); - - // Main message loop: - while( GetMessage(&msg, NULL, 0, 0) ) - { - if( !TranslateAccelerator (msg.hwnd, hAccelTable, &msg) ) - { - TranslateMessage( &msg ); - DispatchMessage( &msg ); - } - } - - // uninitializing the ole libraries - //OleUninitialize( ); - CoUninitialize( ); - - return msg.wParam; -} - -// -// FUNCTION: MyRegisterClass() -// -// PURPOSE: Registers the window class -// -// COMMENTS: -// This function and its usage are only necessary if this code -// needs to be compatible with Win32 systems prior to 'RegisterClassEx' -// function, which was added to Windows 95. If it important to call -// this function to allow the use of small icons in the correct proportions. - -ATOM MyRegisterClass( HINSTANCE hInstance ) -{ - WNDCLASSEXW wcex; - - wcex.cbSize = sizeof(WNDCLASSEX); - - wcex.style = CS_HREDRAW | CS_VREDRAW; - wcex.lpfnWndProc = (WNDPROC)WndProc; - wcex.cbClsExtra = 0; - wcex.cbWndExtra = 0; - wcex.hInstance = hInstance; - wcex.hIcon = LoadIcon(hInstance, (LPCTSTR)IDI_TESTWIN32); - wcex.hCursor = LoadCursor(NULL, IDC_ARROW); - wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); - wcex.lpszMenuName = (LPCWSTR)IDC_TESTWIN32; - wcex.lpszClassName = szWindowClass; - wcex.hIconSm = LoadIcon(wcex.hInstance, (LPCTSTR)IDI_SMALL); - - return RegisterClassExW(&wcex); -} - -// -// FUNCTION: InitInstance(HANDLE, int) -// -// PURPOSE: Saves instance handle and creates main window -// -// COMMENTS: -// In this function, the instance access number is stored in a global variable -// and the main program window is displayed. -// -BOOL InitInstance( HINSTANCE hInstance, int nCmdShow ) -{ - HWND hWnd; - - hInst = hInstance; // Store instance access number in our global variable - - hWnd = CreateWindowExW(0, szWindowClass, szTitle, WS_OVERLAPPEDWINDOW, - CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL); - - if( !hWnd ) - { - return FALSE; - } - - ShowWindow( hWnd, nCmdShow ); - UpdateWindow( hWnd ); - - return TRUE; -} - -// -// FUNCTION: WndProc(HWND, unsigned, WORD, LONG) -// -// PURPOSE: Processes messages for the main window. -// -// WM_COMMAND - Handle application menu -// WM_PAINT - Display main windows -// WM_DESTROY - Output completion message and return -// - -LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) -{ - int wmId; - PAINTSTRUCT ps; - HDC hdc; - TCHAR szHello[MAX_LOADSTRING]; - - LoadString(hInst, IDS_HELLO, szHello, MAX_LOADSTRING); - - switch( message ) - { - case WM_COMMAND: - wmId = LOWORD(wParam); - // Analyze menu selections - switch( wmId ) - { - case IDD_PASTE: - //PasteClipboardData(hWnd); - PasteClipboardData2(hWnd); - break; - - case IDM_EXIT: - DestroyWindow( hWnd ); - break; - - default: - return DefWindowProc( hWnd, message, wParam, lParam ); - } - break; - - case WM_PAINT: - hdc = BeginPaint (hWnd, &ps); - // TODO: Add any code for drawing - RECT rt; - GetClientRect( hWnd, &rt ); - - if ( NULL != pTextBuff ) - { - DrawText( hdc, pTextBuff, lData, &rt, DT_CENTER ); - } - else - { - DrawText( hdc, szHello, strlen(szHello), &rt, DT_CENTER ); - } - - EndPaint( hWnd, &ps ); - break; - - case WM_DESTROY: - PostQuitMessage( 0 ); - break; - - default: - return DefWindowProc( hWnd, message, wParam, lParam ); - } - return 0; -} - -void PasteClipboardData2(HWND hwndParent) -{ - IDataObject* pIDataObject; - HRESULT hr; - FORMATETC formatETC; - STGMEDIUM stgMedium; - LPVOID pGlobMem; - HWND hwnd; - DWORD sizeGlobBuff; - - hr = MTAGetClipboard( &pIDataObject ); - if ( SUCCEEDED( hr ) ) - { - formatETC.cfFormat = CF_TEXT; - formatETC.ptd = NULL; - formatETC.dwAspect = DVASPECT_CONTENT; - formatETC.lindex = -1; - formatETC.tymed = TYMED_HGLOBAL; - - hr = pIDataObject->GetData( &formatETC, &stgMedium ); - pGlobMem = GlobalLock( stgMedium.hGlobal ); - if ( NULL != pGlobMem ) - { - if ( NULL != pTextBuff ) - { - free( pTextBuff ); - } - - sizeGlobBuff = GlobalSize( stgMedium.hGlobal ); - pTextBuff = (char*)malloc( sizeGlobBuff + 1 ); - ZeroMemory( pTextBuff, sizeGlobBuff + 1 ); - - memcpy( pTextBuff, pGlobMem, sizeGlobBuff ); - lData = sizeGlobBuff; - - InvalidateRect( hwndParent, NULL, TRUE ); - UpdateWindow( hwndParent ); - } - - GlobalUnlock( stgMedium.hGlobal ); - - ReleaseStgMedium( &stgMedium ); - - pIDataObject->Release(); - } -} - -// clipboard handling - -/* -void PasteClipboardData(HWND hwndParent) -{ - IDataObject* pIDataObj = NULL; - HRESULT hr = E_FAIL; - unsigned int dwId; - - hr = OleGetClipboard( &pIDataObj ); - if ( SUCCEEDED( hr ) ) - { - HRESULT hr = CoMarshalInterThreadInterfaceInStream( - __uuidof(IDataObject), //The IID of interface to be marshaled - pIDataObj, //The interface pointer - &g_pStm //IStream pointer - ); - - HANDLE hThread = (HANDLE)_beginthreadex( - NULL, //Security - 0, //Stack Size - ThreadProc, //Start Address - NULL, //Parmeter - (unsigned int)hwndParent, //Creation Flag - &dwId //Thread Id - ); - - //Wait for the thread to finish execution - //A thread handle is signaled is thread execution - //is complete - for(;;) - { - DWORD dwRet = ::MsgWaitForMultipleObjects( - 1, //Count of objects - &hThread, //pointer to the array of objects - FALSE, //Wait for all objects? - INFINITE, //Wait How Long? - QS_ALLINPUT //Wait for all messages - ); - - //This means that the object is signaled - if ( dwRet != WAIT_OBJECT_0 + 1 ) - break; - - //Remove the messages from the queue - MSG msg; - - while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE) > 0) - { - //Not essential - TranslateMessage(&msg); - //Let the windowproc handle the message - DispatchMessage(&msg); - } - } - - CloseHandle( hThread ); - pIDataObj->Release(); - } -} -*/ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sal/workben/clipboardwben/testpaste/cbptest.rc b/sal/workben/clipboardwben/testpaste/cbptest.rc deleted file mode 100644 index 5b0adb7..0000000 --- a/sal/workben/clipboardwben/testpaste/cbptest.rc +++ /dev/null @@ -1,138 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -//Microsoft Developer Studio generated resource script. - -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS - - -// Generated from the TEXTINCLUDE 2 resource. - -#define APSTUDIO_HIDDEN_SYMBOLS -#include "windows.h" -#undef APSTUDIO_HIDDEN_SYMBOLS -#include "resource.h" - - -#undef APSTUDIO_READONLY_SYMBOLS - - -// German (Germany) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU) -#ifdef _WIN32 -LANGUAGE LANG_GERMAN, SUBLANG_GERMAN -#pragma code_page(1252) -#endif //_WIN32 - - - -// Icon - - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -IDI_TESTWIN32 ICON DISCARDABLE "TestWin32.ICO" -IDI_SMALL ICON DISCARDABLE "SMALL.ICO" - - - -// Menu - - -IDC_TESTWIN32 MENU DISCARDABLE -BEGIN - POPUP "&Datei" - BEGIN - MENUITEM "&Paste", IDD_PASTE - MENUITEM SEPARATOR - MENUITEM "&Beenden", IDM_EXIT - END -END - - - - -// Accelerator - - -IDC_TESTWIN32 ACCELERATORS MOVEABLE PURE -BEGIN - "?", IDM_ABOUT, ASCII, ALT - "/", IDM_ABOUT, ASCII, ALT -END - - -#ifdef APSTUDIO_INVOKED - - -// TEXTINCLUDE - - -2 TEXTINCLUDE DISCARDABLE -BEGIN - "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" - "#include ""windows.h""\r\n" - "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" - "#include ""resource.h""\r\n" - "\0" -END - -3 TEXTINCLUDE DISCARDABLE -BEGIN - "\r\n" - "\0" -END - -1 TEXTINCLUDE DISCARDABLE -BEGIN - "resource.h\0" -END - -#endif // APSTUDIO_INVOKED - - - - -// String Table - - -STRINGTABLE DISCARDABLE -BEGIN - IDS_APP_TITLE "TestWin32" - IDS_HELLO "Hallo Welt!" - IDC_TESTWIN32 "TESTWIN32" -END - -#endif // German (Germany) resources - - - - -#ifndef APSTUDIO_INVOKED - - -// Generated from the TEXTINCLUDE 3 resource. - - - - -#endif // not APSTUDIO_INVOKED - diff --git a/sal/workben/clipboardwben/testpaste/makefile.mk b/sal/workben/clipboardwben/testpaste/makefile.mk deleted file mode 100644 index ca80421..0000000 --- a/sal/workben/clipboardwben/testpaste/makefile.mk +++ /dev/null @@ -1,58 +0,0 @@ -# -# This file is part of the LibreOffice project. -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# This file incorporates work covered by the following license notice: -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed -# with this work for additional information regarding copyright -# ownership. The ASF licenses this file to you under the Apache -# License, Version 2.0 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.apache.org/licenses/LICENSE-2.0 . -# - -PRJ=..$/..$/.. - -PRJNAME=sal -TARGET=cbptest -LIBTARGET=NO - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -CFLAGS+= $(LFS_CFLAGS) -CXXFLAGS+= $(LFS_CFLAGS) - -# --- Files -------------------------------------------------------- - -# -# test clipboard paste -# - # --- Resources ---------------------------------------------------- - RCFILES= cbptest.rc - - OBJFILES= $(OBJ)$/cbptest.obj - - APP1TARGET= $(TARGET) - APP1OBJS= $(OBJFILES) - APP1NOSAL= TRUE - APP1NOSVRES= $(RES)$/$(TARGET).res - - APP1STDLIBS+=$(OLE32LIB) $(USER32LIB) $(KERNEL32LIB) - - APP1LIBS=$(LB)$/ole9x.lib \ - $(LB)$/tools32.lib - - APP1DEPN= makefile.mk $(APP1NOSVRES) - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk - - diff --git a/sal/workben/clipboardwben/testpaste/resource.h b/sal/workben/clipboardwben/testpaste/resource.h deleted file mode 100644 index 8eda4e8..0000000 --- a/sal/workben/clipboardwben/testpaste/resource.h +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -//{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. -// Used by mtacb.rc - -#define IDC_MYICON 2 -#define IDD_TESTWIN32_DIALOG 102 -#define IDD_ABOUTBOX 103 -#define IDS_APP_TITLE 103 -#define IDM_ABOUT 104 -#define IDM_EXIT 105 -#define IDS_HELLO 106 -#define IDI_TESTWIN32 107 -#define IDI_SMALL 108 -#define IDC_TESTWIN32 109 -#define IDR_MAINFRAME 128 -#define IDD_PASTE 32771 -#define IDC_STATIC -1 - -// Next default values for new objects - -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 129 -#define _APS_NEXT_COMMAND_VALUE 32772 -#define _APS_NEXT_CONTROL_VALUE 1000 -#define _APS_NEXT_SYMED_VALUE 110 -#endif -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sal/workben/clipboardwben/testpaste/small.ico b/sal/workben/clipboardwben/testpaste/small.ico deleted file mode 100644 index 8f94d9a..0000000 Binary files a/sal/workben/clipboardwben/testpaste/small.ico and /dev/null differ diff --git a/sal/workben/clipboardwben/testviewer/StdAfx.cpp b/sal/workben/clipboardwben/testviewer/StdAfx.cpp deleted file mode 100644 index 6351366..0000000 --- a/sal/workben/clipboardwben/testviewer/StdAfx.cpp +++ /dev/null @@ -1,29 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -// stdafx.cpp : Quelltextdatei, die nur die Standard-Includes einbindet -// TestWin32.pch ist die vorkompilierte Header-Datei -// stdafx.obj enthält die vorkompilierte Typinformation - -#include "stdafx.h" - -// ZU ERLEDIGEN: Verweis auf alle zusätzlichen Header-Dateien, die Sie in STDAFX.H -// und nicht in dieser Datei benötigen - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sal/workben/clipboardwben/testviewer/StdAfx.h b/sal/workben/clipboardwben/testviewer/StdAfx.h deleted file mode 100644 index 9a5dc4d..0000000 --- a/sal/workben/clipboardwben/testviewer/StdAfx.h +++ /dev/null @@ -1,33 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -// stdafx.h : Include-Datei für Standard-System-Include-Dateien, -// oder projektspezifische Include-Dateien, die häufig benutzt, aber -// in unregelmäÃigen Abständen geändert werden. - -#if !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_) -#define AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -#define WIN32_LEAN_AND_MEAN // Selten benutzte Teile der Windows-Header nicht einbinden - -// Windows-Header-Dateien: -#include <windows.h> - -// Header-Dateien der C-Laufzeit -#include <stdlib.h> -#include <malloc.h> -#include <memory.h> -#include <tchar.h> - -// Lokale Header-Dateien - -// ZU ERLEDIGEN: Verweisen Sie hier auf zusätzliche Header-Dateien, die Ihr Programm benötigt - -//{{AFX_INSERT_LOCATION}} -// Microsoft Visual C++ fügt zusätzliche Deklarationen unmittelbar vor der vorherigen Zeile ein. - -#endif // !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_) - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sal/workben/clipboardwben/testviewer/TestWin32.ico b/sal/workben/clipboardwben/testviewer/TestWin32.ico deleted file mode 100644 index 255ff3b..0000000 Binary files a/sal/workben/clipboardwben/testviewer/TestWin32.ico and /dev/null differ diff --git a/sal/workben/clipboardwben/testviewer/cbvtest.cxx b/sal/workben/clipboardwben/testviewer/cbvtest.cxx deleted file mode 100644 index 8a43de4..0000000 --- a/sal/workben/clipboardwben/testviewer/cbvtest.cxx +++ /dev/null @@ -1,326 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#define _WIN32_DCOM - -#include "stdafx.h" - -#include <windows.h> - -#include <ole2.h> -#include <objidl.h> -#include <objbase.h> -#include <process.h> -#include <olectl.h> -#include <stdlib.h> -#include <malloc.h> -#include <crtdbg.h> -#include <..\..\inc\systools\win32\MtaOleClipb.h> - -#include "resource.h" - -#define MAX_LOADSTRING 100 - -HINSTANCE g_hInst; // current instance -HWND g_hwndMain; -WCHAR szTitle[MAX_LOADSTRING]; // Text for title -WCHAR szWindowClass[MAX_LOADSTRING]; // Text for title -LPSTREAM g_pStm = NULL; -char* pTextBuff = NULL; -DWORD lData = 0; -UINT g_nCBChanges = 0; - -ATOM MyRegisterClass( HINSTANCE hInstance ); -BOOL InitInstance( HINSTANCE, int ); -HMENU GetSubMenuHandle( HWND hwndParent, UINT uiTopLevelIndex ); -BOOL IsClipboardViewer( HWND hwndParent ); -void SwitchMenuState( HWND hwndParent ); -void RegisterClipboardViewer( BOOL bRegister ); -void ShowAvailableClipboardFormats( HWND hWnd, HDC hdc, PAINTSTRUCT ps, RECT rcWnd ); -void ClearClipboardContent( HWND hWnd ); - -void CALLBACK OnClipboardContentChange(); -LRESULT CALLBACK WndProc( HWND, UINT, WPARAM, LPARAM ); -LRESULT CALLBACK About( HWND, UINT, WPARAM, LPARAM ); - -int APIENTRY WinMain(HINSTANCE hInstance, - HINSTANCE hPrevInstance, - LPSTR lpCmdLine, - int nCmdShow ) -{ - // TODO: Add code here. - MSG msg; - HACCEL hAccelTable; - HRESULT hr = E_FAIL; - - // it's important to initialize ole - // in order to use the clipboard - //hr = OleInitialize( NULL ); - hr = CoInitializeEx( NULL, COINIT_MULTITHREADED ); - - g_hInst = hInstance; - - // Initialize global strings - LoadStringW(g_hInst, IDS_APP_TITLE, szTitle, MAX_LOADSTRING); - LoadStringW(g_hInst, IDC_TESTWIN32, szWindowClass, MAX_LOADSTRING); - MyRegisterClass(g_hInst); - - // Initialization of the applications to carry out - if( !InitInstance( g_hInst, nCmdShow ) ) - { - return FALSE; - } - - hAccelTable = LoadAccelerators(hInstance, (LPCTSTR)IDC_TESTWIN32); - - // Main message loop: - while( GetMessage(&msg, NULL, 0, 0) ) - { - if( !TranslateAccelerator (msg.hwnd, hAccelTable, &msg) ) - { - TranslateMessage( &msg ); - DispatchMessage( &msg ); - } - } - - // uninitializing the ole libraries - //OleUninitialize( ); - CoUninitialize( ); - - return msg.wParam; -} - -// -// FUNCTION: MyRegisterClass() -// -// PURPOSE: Registers the window class. -// -// COMMENTS: -// This function and its usage are only necessary if this code -// needs to be compatible with Win32 systems prior to 'RegisterClassEx' -// function, which was added to Windows 95. If it important to call -// this function to allow the use of small icons in the correct proportions. -// -ATOM MyRegisterClass( HINSTANCE hInstance ) -{ - WNDCLASSEXW wcex; - - wcex.cbSize = sizeof(WNDCLASSEX); - - wcex.style = CS_HREDRAW | CS_VREDRAW; - wcex.lpfnWndProc = (WNDPROC)WndProc; - wcex.cbClsExtra = 0; - wcex.cbWndExtra = 0; - wcex.hInstance = hInstance; - wcex.hIcon = LoadIcon(hInstance, (LPCTSTR)IDI_TESTWIN32); - wcex.hCursor = LoadCursor(NULL, IDC_ARROW); - wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); - wcex.lpszMenuName = (LPCWSTR)IDC_TESTWIN32; - wcex.lpszClassName = szWindowClass; - wcex.hIconSm = LoadIcon(wcex.hInstance, (LPCTSTR)IDI_SMALL); - - return RegisterClassExW(&wcex); -} - -// -// FUNKTION: InitInstance(HANDLE, int) -// -// PURPOSE: Saves instance access number and creates main window -// -// Comments: -// In this function, the instance access number is stored in a global variable -// and the main program window is displayed. -// - -BOOL InitInstance( HINSTANCE hInstance, int nCmdShow ) -{ - g_hwndMain = CreateWindowExW(0, szWindowClass, szTitle, WS_OVERLAPPEDWINDOW, - CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL); - - if( !IsWindow( g_hwndMain ) ) - { - return FALSE; - } - - ShowWindow( g_hwndMain, nCmdShow ); - UpdateWindow( g_hwndMain ); - - return TRUE; -} - -// -// FUNKTION: WndProc(HWND, unsigned, WORD, LONG) -// -// FUNCTION: WndProc(HWND, unsigned, WORD, LONG) -// -// PURPOSE: Processes messages for the main window. -// -// WM_COMMAND - Handle application menu -// WM_PAINT - Display main windows -// WM_DESTROY - Output completion message and return -// -LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) -{ - int wmId; - PAINTSTRUCT ps; - HDC hdc; - WCHAR szHello[MAX_LOADSTRING]; - - LoadStringW(g_hInst, IDS_HELLO, szHello, MAX_LOADSTRING); - - switch( message ) - { - case WM_CREATE: - ClearClipboardContent( hWnd ); - break; - - case WM_COMMAND: - wmId = LOWORD(wParam); - // Analyze menu selections: - switch( wmId ) - { - case IDD_CBVIEWER: - SwitchMenuState( hWnd ); - RegisterClipboardViewer( IsClipboardViewer( hWnd ) ); - break; - - case IDM_EXIT: - DestroyWindow( hWnd ); - break; - - default: - return DefWindowProc( hWnd, message, wParam, lParam ); - } - break; - - case WM_PAINT: - hdc = BeginPaint (hWnd, &ps); - // TODO: Add any code for drawing - RECT rt; - GetClientRect( hWnd, &rt ); - - if ( IsClipboardViewer( g_hwndMain ) ) - { - ShowAvailableClipboardFormats( hWnd, hdc, ps, rt ); - } - else - { - WCHAR wcString[MAX_LOADSTRING]; - LoadStringW(g_hInst, IDS_MSG_CBVIEWER_IS_OFF, wcString, MAX_LOADSTRING); - DrawTextW( hdc, wcString, wcslen( wcString ), &rt, DT_CENTER ); - } - - EndPaint( hWnd, &ps ); - break; - - case WM_DESTROY: - PostQuitMessage( 0 ); - break; - - default: - return DefWindowProc( hWnd, message, wParam, lParam ); - } - return 0; -} - -HMENU GetSubMenuHandle( HWND hwndParent, UINT uiTopLevelIndex ) -{ - HMENU hMenuMain = GetMenu( hwndParent ); - _ASSERT( IsMenu( hMenu ) ); - - HMENU hSubMenu = GetSubMenu( hMenuMain, uiTopLevelIndex ); - _ASSERT( IsMenu( hSubMenu ) ); - - return hSubMenu; -} - -BOOL IsClipboardViewer( HWND hwndParent ) -{ - HMENU hSubMenu = GetSubMenuHandle( hwndParent, 0 ); - UINT uiMState = GetMenuState( hSubMenu, 0, MF_BYPOSITION ); - return ( MF_CHECKED == uiMState ); -} - -void SwitchMenuState( HWND hwndParent ) -{ - HMENU hSubMenu = GetSubMenuHandle( hwndParent, 0 ); - WCHAR wcMenuString[MAX_LOADSTRING]; - - if ( IsClipboardViewer( hwndParent ) ) - { - LoadStringW(g_hInst, IDS_CBVIEWER_OFF, wcMenuString, MAX_LOADSTRING); - ModifyMenuW( hSubMenu, 0, MF_BYPOSITION | MF_STRING, IDD_CBVIEWER, wcMenuString ); - CheckMenuItem( hSubMenu, 0, MF_BYPOSITION | MF_UNCHECKED ); - } - else - { - LoadStringW(g_hInst, IDS_CBVIEWER_ON, wcMenuString, MAX_LOADSTRING); - ModifyMenuW( hSubMenu, 0, MF_BYPOSITION | MF_STRING, IDD_CBVIEWER, wcMenuString ); - CheckMenuItem( hSubMenu, 0, MF_BYPOSITION | MF_CHECKED ); - } -} - -void RegisterClipboardViewer( BOOL bRegister ) -{ - if ( bRegister ) - MTARegisterClipboardViewer( OnClipboardContentChange ); - else // unregister - MTARegisterClipboardViewer( NULL ); - - InvalidateRect( g_hwndMain, NULL, TRUE ); - UpdateWindow( g_hwndMain ); -} - -void ShowAvailableClipboardFormats( HWND hWnd, HDC hdc, PAINTSTRUCT ps, RECT rcWnd ) -{ - if ( !OpenClipboard( hWnd ) ) - { - WCHAR szErrMsg[] = { L"Couldn't open the clipboard" }; - DrawTextW( hdc, szErrMsg, wcslen( szErrMsg ), &rcWnd, DT_CENTER ); - return; - } - else - { - WCHAR szCBChangedMsg[100]; - - wsprintfW( szCBChangedMsg, L"Clipboard content changed %d", g_nCBChanges ); - DrawTextW( hdc, szCBChangedMsg, wcslen( szCBChangedMsg ), &rcWnd, DT_CENTER ); - - CloseClipboard( ); - } -} - -void ClearClipboardContent( HWND hWnd ) -{ - if ( OpenClipboard( hWnd ) ) - { - EmptyClipboard( ); - CloseClipboard( ); - } -} - -// clipboard viewer callback function -void CALLBACK OnClipboardContentChange() -{ - ++g_nCBChanges; - InvalidateRect( g_hwndMain, NULL, TRUE ); - UpdateWindow( g_hwndMain ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sal/workben/clipboardwben/testviewer/cbvtest.rc b/sal/workben/clipboardwben/testviewer/cbvtest.rc deleted file mode 100644 index 047cc79..0000000 --- a/sal/workben/clipboardwben/testviewer/cbvtest.rc +++ /dev/null @@ -1,145 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -//Microsoft Developer Studio generated resource script. - -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS - - -// Generated from the TEXTINCLUDE 2 resource. - -#define APSTUDIO_HIDDEN_SYMBOLS -#include "windows.h" -#undef APSTUDIO_HIDDEN_SYMBOLS -#include "resource.h" - - -#undef APSTUDIO_READONLY_SYMBOLS - - -// German (Germany) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU) -#ifdef _WIN32 -LANGUAGE LANG_GERMAN, SUBLANG_GERMAN -#pragma code_page(1252) -#endif //_WIN32 - - - -// Icon - - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -IDI_TESTWIN32 ICON DISCARDABLE "TestWin32.ICO" -IDI_SMALL ICON DISCARDABLE "SMALL.ICO" - - - -// Menu - - -IDC_TESTWIN32 MENU DISCARDABLE -BEGIN - POPUP "&Datei" - BEGIN - MENUITEM "&CB Viewer off", IDD_CBVIEWER - MENUITEM SEPARATOR - MENUITEM "&Beenden", IDM_EXIT - END -END - - - - -// Accelerator - - -IDC_TESTWIN32 ACCELERATORS MOVEABLE PURE -BEGIN - "?", IDM_ABOUT, ASCII, ALT - "/", IDM_ABOUT, ASCII, ALT -END - - -#ifdef APSTUDIO_INVOKED - - -// TEXTINCLUDE - - -2 TEXTINCLUDE DISCARDABLE -BEGIN - "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" - "#include ""windows.h""\r\n" - "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" - "#include ""resource.h""\r\n" - "\0" -END - -3 TEXTINCLUDE DISCARDABLE -BEGIN - "\r\n" - "\0" -END - -1 TEXTINCLUDE DISCARDABLE -BEGIN - "resource.h\0" -END - -#endif // APSTUDIO_INVOKED - - - - -// String Table - - -STRINGTABLE DISCARDABLE -BEGIN - IDS_APP_TITLE "TestWin32" - IDS_HELLO "Hallo Welt!" - IDC_TESTWIN32 "TESTWIN32" - IDS_CBVIEWER_ON "CB Viewer on" - IDS_CBVIEWER_OFF "CB Viewer off" -END - -STRINGTABLE DISCARDABLE -BEGIN - IDS_MSG_CBVIEWER_IS_OFF "Clipboard Viewer inactive!" -END - -#endif // German (Germany) resources - - - - -#ifndef APSTUDIO_INVOKED - - -// Generated from the TEXTINCLUDE 3 resource. - - - - -#endif // not APSTUDIO_INVOKED - diff --git a/sal/workben/clipboardwben/testviewer/makefile.mk b/sal/workben/clipboardwben/testviewer/makefile.mk deleted file mode 100644 index 3bdc58a..0000000 --- a/sal/workben/clipboardwben/testviewer/makefile.mk +++ /dev/null @@ -1,58 +0,0 @@ -# -# This file is part of the LibreOffice project. -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# This file incorporates work covered by the following license notice: -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed -# with this work for additional information regarding copyright -# ownership. The ASF licenses this file to you under the Apache -# License, Version 2.0 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.apache.org/licenses/LICENSE-2.0 . -# - -PRJ=..$/..$/.. - -PRJNAME=sal -TARGET=cbvtest -LIBTARGET=NO - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -CFLAGS+= $(LFS_CFLAGS) -CXXFLAGS+= $(LFS_CFLAGS) - -# --- Files -------------------------------------------------------- - -# -# test clipboard paste -# - # --- Resources ---------------------------------------------------- - RCFILES= cbvtest.rc - - OBJFILES= $(OBJ)$/cbvtest.obj - - APP1TARGET= $(TARGET) - APP1OBJS= $(OBJFILES) - APP1NOSAL= TRUE - APP1NOSVRES= $(RES)$/$(TARGET).res - - APP1STDLIBS+=$(OLE32LIB) $(USER32LIB) $(KERNEL32LIB) - - APP1LIBS=$(LB)$/iole9x.lib \ - $(LB)$/tools32.lib - - APP1DEPN= makefile.mk $(APP1NOSVRES) - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk - - diff --git a/sal/workben/clipboardwben/testviewer/resource.h b/sal/workben/clipboardwben/testviewer/resource.h deleted file mode 100644 index 3bd18ad..0000000 --- a/sal/workben/clipboardwben/testviewer/resource.h +++ /dev/null @@ -1,53 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -//{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. -// Used by cbvtest.rc - -#define IDC_MYICON 2 -#define IDD_TESTWIN32_DIALOG 102 -#define IDD_ABOUTBOX 103 -#define IDS_APP_TITLE 103 -#define IDM_ABOUT 104 -#define IDM_EXIT 105 -#define IDS_HELLO 106 -#define IDI_TESTWIN32 107 -#define IDI_SMALL 108 -#define IDC_TESTWIN32 109 -#define IDS_CBVIEWER_ON 110 -#define IDS_CBVIEWER_OFF 111 -#define IDS_MSG_CBVIEWER_IS_OFF 112 -#define IDR_MAINFRAME 128 -#define IDD_PASTE 32771 -#define IDD_CBVIEWER 32771 -#define IDC_STATIC -1 - -// Next default values for new objects - -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 129 -#define _APS_NEXT_COMMAND_VALUE 32772 -#define _APS_NEXT_CONTROL_VALUE 1000 -#define _APS_NEXT_SYMED_VALUE 110 -#endif -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sal/workben/clipboardwben/testviewer/small.ico b/sal/workben/clipboardwben/testviewer/small.ico deleted file mode 100644 index 8f94d9a..0000000 Binary files a/sal/workben/clipboardwben/testviewer/small.ico and /dev/null differ diff --git a/sal/workben/export.exp b/sal/workben/export.exp deleted file mode 100644 index 8a37bf2..0000000 --- a/sal/workben/export.exp +++ /dev/null @@ -1 +0,0 @@ -registerAllTestFunction \ No newline at end of file diff --git a/sal/workben/getlocaleinfotest.cxx b/sal/workben/getlocaleinfotest.cxx deleted file mode 100644 index b9bd034..0000000 --- a/sal/workben/getlocaleinfotest.cxx +++ /dev/null @@ -1,39 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include <rtl/locale.h> -#include <osl/nlsupport.h> -#include <rtl/ustring.hxx> - -int _cdecl main( int argc, char * argv[] ) -{ - rtl::OUString lang("de"); - rtl::OUString country("DE"); - rtl_TextEncoding rtlTextEnc; - - rtl_Locale* rtlLocale = - rtl_locale_register( lang.getStr( ), country.getStr( ), NULL ); - - if ( rtlLocale ) - rtlTextEnc = osl_getTextEncodingFromLocale( rtlLocale ); - - return 0; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sal/workben/makefile.mk b/sal/workben/makefile.mk deleted file mode 100644 index b7141a7..0000000 --- a/sal/workben/makefile.mk +++ /dev/null @@ -1,215 +0,0 @@ -# -# This file is part of the LibreOffice project. -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# This file incorporates work covered by the following license notice: -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed -# with this work for additional information regarding copyright -# ownership. The ASF licenses this file to you under the Apache -# License, Version 2.0 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.apache.org/licenses/LICENSE-2.0 . -# - -PRJ=.. - -PRJNAME=sal -TARGET=workben -LIBTARGET=NO -TARGETTYPE=CUI -NO_DEFAULT_STL=YES - - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -CFLAGS+=$(LFS_CFLAGS) -CXXFLAGS+=$(LFS_CFLAGS) - -# --- Files -------------------------------------------------------- - -# -# t_readline -# -OBJFILES+=\ - $(OBJ)$/t_readline.obj - -APP1TARGET=t_readline -APP1OBJS=$(OBJ)$/t_readline.obj -APP1STDLIBS=$(SALLIB) -APP1DEPN=$(SLB)$/sal.lib -APP1RPATH=UREBIN - -# -# testfile -# -OBJFILES+=\ - $(OBJ)$/testfile.obj - -APP1TARGET=testfile -APP1OBJS=$(OBJ)$/testfile.obj -APP1STDLIBS=$(SALLIB) -APP1DEPN=$(SLB)$/sal.lib - -# -# testpipe -# -OBJFILES+=\ - $(OBJ)$/testpipe.obj - -APP2TARGET=testpipe -APP2OBJS=$(OBJ)$/testpipe.obj -APP2STDLIBS=$(SALLIB) -APP2DEPN=$(SLB)$/sal.lib - -# -# testpip2 -# -OBJFILES+=\ - $(OBJ)$/testpip2.obj - -APP3TARGET=testpip2 -APP3OBJS=$(OBJ)$/testpip2.obj -APP3STDLIBS=$(SALLIB) -APP3DEPN=$(SLB)$/sal.lib - -# -# testproc -# -OBJFILES+=\ - $(OBJ)$/testproc.obj - -APP4TARGET=testproc -APP4OBJS=$(OBJ)$/testproc.obj -APP4STDLIBS=$(SALLIB) -APP4DEPN=$(SLB)$/sal.lib - -# -# measure_oustrings -# -OBJFILES+=\ - $(OBJ)$/measure_oustrings.obj - -.IF "$(ENABLE_VALGRIND)" == "TRUE" -CFLAGSCXX+=-DHAVE_VALGRIND_HEADERS -.ENDIF - -APP6TARGET=measure_oustrings -APP6OBJS=$(OBJ)$/measure_oustrings.obj -APP6STDLIBS=$(SALLIB) -APP6DEPN=$(SLB)$/sal.lib - -# -# t_random. -# -OBJFILES+=\ - $(OBJ)$/t_random.obj - -APP7TARGET=t_random -APP7OBJS=$(OBJ)$/t_random.obj -APP7STDLIBS=$(SALLIB) -APP7DEPN=$(SLB)$/sal.lib - -# -# t_cipher -# -OBJFILES+=\ - $(OBJ)$/t_cipher.obj - -APP8TARGET=t_cipher -APP8OBJS=$(OBJ)$/t_cipher.obj -APP8STDLIBS=$(SALLIB) -APP8DEPN=$(SLB)$/sal.lib - -# -# t_digest. -# -OBJFILES+=\ - $(OBJ)$/t_digest.obj - -APP9TARGET=t_digest -APP9OBJS=$(OBJ)$/t_digest.obj -APP9STDLIBS=$(SALLIB) -APP9DEPN=$(SLB)$/sal.lib - -# -# getlitest -# -.IF "$(TESTAPP)" == "getlocaleinfotest" -OBJFILES+=\ - $(OBJ)$/getlocaleinfotest.obj - -APP10TARGET=getlitest -APP10OBJS=$(OBJ)$/getlocaleinfotest.obj - -APP10STDLIBS=\ - $(KERNEL32LIB) - -APP10LIBS=\ - $(LB)$/kernel9x.lib\ - $(LB)$/isal.lib - -APP10DEPN=$(LB)$/isal.lib -.ENDIF - -.IF "$(TESTAPP)" == "test_osl_getVolInfo" - -SHL10OBJS=$(SLO)$/t_osl_getVolInfo.obj -SHL10TARGET=togvi - -.IF "$(OS)" == "WNT" -APP10STDLIBS=$(KERNEL32LIB) -SHL10STDLIBS=$(LB)$/isal.lib -SHL10STDLIBS+=$(SOLARLIBDIR)$/cppunit.lib -.ENDIF - -.IF "$(OS)" != "WNT" -SHL10STDLIBS=$(LB)$/libsal.so -SHL10STDLIBS+=$(SOLARLIBDIR)$/libcppunit$(DLLPOSTFIX).a -.ENDIF - -SHL10IMPLIB=i$(SHL1TARGET) -SHL10DEF=$(MISC)$/$(SHL1TARGET).def -DEF10NAME=$(SHL1TARGET) -DEF10EXPORTFILE=export.exp -.ENDIF - -.IF "$(TESTAPP)" == "test_osl_joinProcess" -OBJFILES+=\ - $(OBJ)$/t_ojp_exe.obj -APP10TARGET=ojpx -APP10OBJS=$(OBJ)$/t_ojp_exe.obj - -.IF "$(OS)" != "WNT" -APP10STDLIBS=$(LB)$/libsal.so -.ENDIF - -SHL10OBJS=$(SLO)$/t_osl_joinProcess.obj -SHL10TARGET=tojp - -.IF "$(OS)" == "WNT" -APP10STDLIBS=$(KERNEL32LIB) -SHL10STDLIBS=$(LB)$/isal.lib -SHL10STDLIBS+=$(SOLARLIBDIR)$/cppunit.lib -.ENDIF - -.IF "$(OS)" != "WNT" -SHL10STDLIBS=$(LB)$/libsal.so -SHL10STDLIBS+=$(SOLARLIBDIR)$/libcppunit$(DLLPOSTFIX).a -.ENDIF - -SHL10IMPLIB=i$(SHL1TARGET) -SHL10DEF=$(MISC)$/$(SHL1TARGET).def -DEF10NAME=$(SHL1TARGET) -DEF10EXPORTFILE=export.exp -.ENDIF - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk diff --git a/sal/workben/measure_oustrings.cxx b/sal/workben/measure_oustrings.cxx deleted file mode 100644 index eeca8cc..0000000 --- a/sal/workben/measure_oustrings.cxx +++ /dev/null @@ -1,262 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -#include <sal/main.h> -#include <rtl/ustring.hxx> -#include <osl/time.h> -#include <osl/process.h> - -#include <iostream> -#include <sstream> -#include <fstream> - -#if defined HAVE_VALGRIND_HEADERS -# include <valgrind/callgrind.h> -int COUNT = 1; -#else -# define CALLGRIND_DUMP_STATS_AT -# define CALLGRIND_START_INSTRUMENTATION -# define CALLGRIND_STOP_INSTRUMENTATION -# define CALLGRIND_ZERO_STATS -int COUNT = 10000000; -#endif - -#if defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L -# define HAVE_CXX_Ox 1 -#endif - -#ifdef HAVE_CXX_Ox -# define SAL_DECLARE_UTF16(str) u ## str -#elif __SIZEOF_WCHAR_T__ == 2 -# define SAL_DECLARE_UTF16(str) L ## str -#endif - -#ifdef SAL_DECLARE_UTF16 -# define RTL_CONSTASCII_USTRINGPARAM_WIDE(str) \ - reinterpret_cast<const sal_Unicode*>(SAL_DECLARE_UTF16(str)), (SAL_N_ELEMENTS(str)-1) -#endif - -#define RTL_CONSTASCII_USTRINGPARAM_CLASSIC(str) \ - str, ((sal_Int32)(SAL_N_ELEMENTS(str)-1)), RTL_TEXTENCODING_ASCII_US - -int currenttest = 1; -oslProcessInfo pidinfo; - -class TimerMeasure -{ -private: - const char *m_pMessage; - sal_uInt32 m_nStartTime, m_nEndTime; -public: - explicit TimerMeasure(const char *pMessage) - : m_pMessage(pMessage) - { - m_nStartTime = osl_getGlobalTimer(); - CALLGRIND_START_INSTRUMENTATION - CALLGRIND_ZERO_STATS - } - - ~TimerMeasure() - { - CALLGRIND_STOP_INSTRUMENTATION - CALLGRIND_DUMP_STATS_AT(m_pMessage); - m_nEndTime = osl_getGlobalTimer(); - std::cout << m_pMessage << std::endl; - std::cout << " callgrind Instruction cost is: " << std::flush; - - std::stringstream aFileName; - aFileName << "callgrind.out." << pidinfo.Ident << "." << currenttest; - - std::ifstream myfile(aFileName.str(), std::ios::in); - if (myfile.is_open()) - { - std::stringstream aGetGrindStats; - aGetGrindStats << "callgrind_annotate " << aFileName.str() << - " | grep TOTALS | sed 's/ PROGRAM TOTALS//'"; - system(aGetGrindStats.str().c_str()); - myfile.close(); - } - else - std::cout << "Unavailable" << std::endl; - currenttest++; -#ifndef HAVE_CALLGRIND - std::cout << " Elapsed tools::Time is: " << m_nEndTime - m_nStartTime << "ms" << std::endl; -#endif - } -}; - -#define TIME(msg, test) \ -{\ - { test } /*Run the test one to shake out any firsttime lazy loading stuff*/ \ - TimerMeasure aMeasure(msg);\ - for (int i = 0; i < COUNT; ++i)\ - test\ -} - -SAL_IMPLEMENT_MAIN() -{ - CALLGRIND_STOP_INSTRUMENTATION - CALLGRIND_ZERO_STATS - - pidinfo.Size = sizeof(pidinfo); - osl_getProcessInfo(0, osl_Process_IDENTIFIER, &pidinfo); - -#ifdef HAVE_CALLGRIND - std::cout << "Execute using: valgrind --tool=callgrind ./measure_oustrings" << std::endl; -#else - //get my cpu fan up to speed :-) - for (int i = 0; i < 10000000; ++i) - { - rtl::OUString sFoo(rtl::OUString::createFromAscii("X")); - rtl::OUString sBar(RTL_CONSTASCII_USTRINGPARAM_CLASSIC("X")); - rtl::OUString sBaz(static_cast<sal_Unicode>('X')); - rtl::OUString sNone; - } -#endif - - std::cout << "--Empty Strings Construction--" << std::endl; - - TIME - ( - "rtl::OUString()", - rtl::OUString sFoo; - ) - - TIME - ( - "rtl::OUString::createFromAscii()", - rtl::OUString sFoo(rtl::OUString::createFromAscii("")); - ) - - std::cout << "--Single Chars Construction--" << std::endl; - - TIME - ( - "rtl::OUString(static_cast<sal_Unicode>('X')", - rtl::OUString sBaz(static_cast<sal_Unicode>('X')); - ) - -#ifdef SAL_DECLARE_UTF16 - TIME - ( - "rtl::OUString(RTL_CONSTASCII_USTRINGPARAM_WIDE(\"X\"))", - rtl::OUString sBar(RTL_CONSTASCII_USTRINGPARAM_WIDE("X")); - ) -#endif - - TIME - ( - "rtl::OUString(RTL_CONSTASCII_USTRINGPARAM_CLASSIC(\"X\"))", - rtl::OUString sBar(RTL_CONSTASCII_USTRINGPARAM_CLASSIC("X")); - ) - - TIME - ( - "rtl::OUString::createFromAscii(\"X\")", - rtl::OUString sFoo(rtl::OUString::createFromAscii("X")); - ) - - std::cout << "--MultiChar Strings Construction--" << std::endl; - -#ifdef SAL_DECLARE_UTF16 - TIME - ( - "rtl::OUString(RTL_CONSTASCII_USTRINGPARAM_WIDE(\"XXXXXXXX\"))", - rtl::OUString sBar(RTL_CONSTASCII_USTRINGPARAM_WIDE("XXXXXXXXXXXXXXX")); - ) -#endif - - TIME - ( - "rtl::OUString(RTL_CONSTASCII_USTRINGPARAM_CLASSIC(\"XXXXXXXX\"))", - rtl::OUString sBar(RTL_CONSTASCII_USTRINGPARAM_CLASSIC("XXXXXXXXXXXXXXX")); - ) - - TIME - ( - "rtl::OUString::createFromAscii(\"XXXXXXXX\")", - rtl::OUString sFoo(rtl::OUString::createFromAscii("XXXXXXXXXXXXXXX")); - ) - - std::cout << "--Ascii Unequal Comparison--" << std::endl; - - rtl::OUString sCompare(RTL_CONSTASCII_USTRINGPARAM_CLASSIC("XXXXXXXXXXXXXXX")); - - TIME - ( - "rtl::OUString::equalsAsciiL", - sCompare.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("apple")); - ) - - rtl::OUString sUnequalCompareTo(RTL_CONSTASCII_USTRINGPARAM_CLASSIC("apple")); - - TIME - ( - "operator==(precreated OUString(\"apple\"))", - sCompare == sUnequalCompareTo; - ) - - TIME - ( - "rtl::OUString::equalsAscii", - sCompare.equalsAscii("apple"); - ) - - //(const sal_Char*, sal_Int32) version has different semantics - TIME - ( - "rtl::OUString::compareToAscii (const sal_Char*)", - sCompare.compareToAscii("apple"); - ) - - TIME - ( - "operator==(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM_CLASSIC(\"apple\")))", - sCompare == rtl::OUString(RTL_CONSTASCII_USTRINGPARAM_CLASSIC("apple")); - ) - - std::cout << "--Ascii Equal Comparison--" << std::endl; - - TIME - ( - "rtl::OUString::equalsAsciiL", - sCompare.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("XXXXXXXXXXXXXXX")); - ) - - rtl::OUString sEqualCompareTo(RTL_CONSTASCII_USTRINGPARAM_CLASSIC("XXXXXXXXXXXXXXX")); - - TIME - ( - "operator==(precreated OUString(\"XXXXXXXXXXXXXXX\"))", - sCompare == sEqualCompareTo; - ) - - TIME - ( - "rtl::OUString::equalsAscii", - sCompare.equalsAscii("XXXXXXXXXXXXXXX"); - ) - - //(const sal_Char*, sal_Int32) version has different semantics - TIME - ( - "rtl::OUString::compareToAscii (const sal_Char*)", - sCompare.compareToAscii("XXXXXXXXXXXXXXX"); - ) - - TIME - ( - "operator==(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM_CLASSIC(\"XXXXXXXXXXXXXXX\"))", - sCompare == rtl::OUString(RTL_CONSTASCII_USTRINGPARAM_CLASSIC("XXXXXXXXXXXXXXX")); - ) - - return 0; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sal/workben/t_cipher.c b/sal/workben/t_cipher.c deleted file mode 100644 index dd802e0..0000000 --- a/sal/workben/t_cipher.c +++ /dev/null @@ -1,392 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#include <sal/types.h> -#include <sal/macros.h> -#include <osl/diagnose.h> -#include <rtl/cipher.h> - -#include <stdio.h> -#include <string.h> - -#define NUM_VARIABLE_KEY_TESTS 34 -#define NUM_SET_KEY_TESTS 24 - -/* plaintext bytes -- left halves */ -unsigned long plaintext_l[NUM_VARIABLE_KEY_TESTS + NUM_SET_KEY_TESTS] = { - 0x00000000l, 0xFFFFFFFFl, 0x10000000l, 0x11111111l, 0x11111111l, - 0x01234567l, 0x00000000l, 0x01234567l, 0x01A1D6D0l, 0x5CD54CA8l, - 0x0248D438l, 0x51454B58l, 0x42FD4430l, 0x059B5E08l, 0x0756D8E0l, - 0x762514B8l, 0x3BDD1190l, 0x26955F68l, 0x164D5E40l, 0x6B056E18l, - 0x004BD6EFl, 0x480D3900l, 0x437540C8l, 0x072D43A0l, 0x02FE5577l, - 0x1D9D5C50l, 0x30553228l, 0x01234567l, 0x01234567l, 0x01234567l, - 0xFFFFFFFFl, 0x00000000l, 0x00000000l, 0xFFFFFFFFl, 0xFEDCBA98l, - 0xFEDCBA98l, 0xFEDCBA98l, 0xFEDCBA98l, 0xFEDCBA98l, 0xFEDCBA98l, - 0xFEDCBA98l, 0xFEDCBA98l, 0xFEDCBA98l, 0xFEDCBA98l, 0xFEDCBA98l, - 0xFEDCBA98l, 0xFEDCBA98l, 0xFEDCBA98l, 0xFEDCBA98l, 0xFEDCBA98l, - 0xFEDCBA98l, 0xFEDCBA98l, 0xFEDCBA98l, 0xFEDCBA98l, 0xFEDCBA98l, - 0xFEDCBA98l, 0xFEDCBA98l, 0xFEDCBA98l }; - -/* plaintext bytes -- right halves */ -unsigned long plaintext_r[NUM_VARIABLE_KEY_TESTS + NUM_SET_KEY_TESTS] = { - 0x00000000l, 0xFFFFFFFFl, 0x00000001l, 0x11111111l, 0x11111111l, - 0x89ABCDEFl, 0x00000000l, 0x89ABCDEFl, 0x39776742l, 0x3DEF57DAl, - 0x06F67172l, 0x2DDF440Al, 0x59577FA2l, 0x51CF143Al, 0x774761D2l, - 0x29BF486Al, 0x49372802l, 0x35AF609Al, 0x4F275232l, 0x759F5CCAl, - 0x09176062l, 0x6EE762F2l, 0x698F3CFAl, 0x77075292l, 0x8117F12Al, - 0x18F728C2l, 0x6D6F295Al, 0x89ABCDEFl, 0x89ABCDEFl, 0x89ABCDEFl, - 0xFFFFFFFFl, 0x00000000l, 0x00000000l, 0xFFFFFFFFl, 0x76543210l, - 0x76543210l, 0x76543210l, 0x76543210l, 0x76543210l, 0x76543210l, - 0x76543210l, 0x76543210l, 0x76543210l, 0x76543210l, 0x76543210l, - 0x76543210l, 0x76543210l, 0x76543210l, 0x76543210l, 0x76543210l, - 0x76543210l, 0x76543210l, 0x76543210l, 0x76543210l, 0x76543210l, - 0x76543210l, 0x76543210l, 0x76543210l }; - -/* key bytes for variable key tests */ -unsigned char variable_key[NUM_VARIABLE_KEY_TESTS][8] = { - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, - { 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 }, - { 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF }, - { 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 }, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0xFE, 0xDC, 0xBA, 0x98, 0x76, 0x54, 0x32, 0x10 }, - { 0x7C, 0xA1, 0x10, 0x45, 0x4A, 0x1A, 0x6E, 0x57 }, - { 0x01, 0x31, 0xD9, 0x61, 0x9D, 0xC1, 0x37, 0x6E }, - { 0x07, 0xA1, 0x13, 0x3E, 0x4A, 0x0B, 0x26, 0x86 }, - { 0x38, 0x49, 0x67, 0x4C, 0x26, 0x02, 0x31, 0x9E }, - { 0x04, 0xB9, 0x15, 0xBA, 0x43, 0xFE, 0xB5, 0xB6 }, - { 0x01, 0x13, 0xB9, 0x70, 0xFD, 0x34, 0xF2, 0xCE }, - { 0x01, 0x70, 0xF1, 0x75, 0x46, 0x8F, 0xB5, 0xE6 }, - { 0x43, 0x29, 0x7F, 0xAD, 0x38, 0xE3, 0x73, 0xFE }, - { 0x07, 0xA7, 0x13, 0x70, 0x45, 0xDA, 0x2A, 0x16 }, - { 0x04, 0x68, 0x91, 0x04, 0xC2, 0xFD, 0x3B, 0x2F }, - { 0x37, 0xD0, 0x6B, 0xB5, 0x16, 0xCB, 0x75, 0x46 }, - { 0x1F, 0x08, 0x26, 0x0D, 0x1A, 0xC2, 0x46, 0x5E }, - { 0x58, 0x40, 0x23, 0x64, 0x1A, 0xBA, 0x61, 0x76 }, - { 0x02, 0x58, 0x16, 0x16, 0x46, 0x29, 0xB0, 0x07 }, - { 0x49, 0x79, 0x3E, 0xBC, 0x79, 0xB3, 0x25, 0x8F }, - { 0x4F, 0xB0, 0x5E, 0x15, 0x15, 0xAB, 0x73, 0xA7 }, - { 0x49, 0xE9, 0x5D, 0x6D, 0x4C, 0xA2, 0x29, 0xBF }, - { 0x01, 0x83, 0x10, 0xDC, 0x40, 0x9B, 0x26, 0xD6 }, - { 0x1C, 0x58, 0x7F, 0x1C, 0x13, 0x92, 0x4F, 0xEF }, - { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 }, - { 0x1F, 0x1F, 0x1F, 0x1F, 0x0E, 0x0E, 0x0E, 0x0E }, - { 0xE0, 0xFE, 0xE0, 0xFE, 0xF1, 0xFE, 0xF1, 0xFE }, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, - { 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF }, - { 0xFE, 0xDC, 0xBA, 0x98, 0x76, 0x54, 0x32, 0x10 }}; - -/* key bytes for set key tests */ -unsigned char set_key[24] = { - 0xF0, 0xE1, 0xD2, 0xC3, 0xB4, 0xA5, 0x96, 0x87, - 0x78, 0x69, 0x5A, 0x4B, 0x3C, 0x2D, 0x1E, 0x0F, - 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77 }; - -/* ciphertext bytes -- left halves */ -unsigned long ciphertext_l[NUM_VARIABLE_KEY_TESTS + NUM_SET_KEY_TESTS] = { - 0x4EF99745l, 0x51866FD5l, 0x7D856F9Al, 0x2466DD87l, 0x61F9C380l, - 0x7D0CC630l, 0x4EF99745l, 0x0ACEAB0Fl, 0x59C68245l, 0xB1B8CC0Bl, - 0x1730E577l, 0xA25E7856l, 0x353882B1l, 0x48F4D088l, 0x432193B7l, - 0x13F04154l, 0x2EEDDA93l, 0xD887E039l, 0x5F99D04Fl, 0x4A057A3Bl, - 0x452031C1l, 0x7555AE39l, 0x53C55F9Cl, 0x7A8E7BFAl, 0xCF9C5D7Al, - 0xD1ABB290l, 0x55CB3774l, 0xFA34EC48l, 0xA7907951l, 0xC39E072Dl, - 0x014933E0l, 0xF21E9A77l, 0x24594688l, 0x6B5C5A9Cl, 0xF9AD597Cl, - 0xE91D21C1l, 0xE9C2B70Al, 0xBE1E6394l, 0xB39E4448l, 0x9457AA83l, - 0x8BB77032l, 0xE87A244El, 0x15750E7Al, 0x122BA70Bl, 0x3A833C9Al, - 0x9409DA87l, 0x884F8062l, 0x1F85031Cl, 0x79D9373Al, 0x93142887l, - 0x03429E83l, 0xA4299E27l, 0xAFD5AED1l, 0x10851C0El, 0xE6F51ED7l, - 0x64A6E14Al, 0x80C7D7D4l, 0x05044B62l }; - -/* ciphertext bytes -- right halves */ -unsigned long ciphertext_r[NUM_VARIABLE_KEY_TESTS + NUM_SET_KEY_TESTS] = { - 0x6198DD78l, 0xB85ECB8Al, 0x613063F2l, 0x8B963C9Dl, 0x2281B096l, - 0xAFDA1EC7l, 0x6198DD78l, 0xC6A0A28Dl, 0xEB05282Bl, 0x250F09A0l, - 0x8BEA1DA4l, 0xCF2651EBl, 0x09CE8F1Al, 0x4C379918l, 0x8951FC98l, - 0xD69D1AE5l, 0xFFD39C79l, 0x3C2DA6E3l, 0x5B163969l, 0x24D3977Bl, - 0xE4FADA8El, 0xF59B87BDl, 0xB49FC019l, 0x937E89A3l, 0x4986ADB5l, - 0x658BC778l, 0xD13EF201l, 0x47B268B2l, 0x08EA3CAEl, 0x9FAC631Dl, - 0xCDAFF6E4l, 0xB71C49BCl, 0x5754369Al, 0x5D9E0A5Al, 0x49DB005El, - 0xD961A6D6l, 0x1BC65CF3l, 0x08640F05l, 0x1BDB1E6El, 0xB1928C0Dl, - 0xF960629Dl, 0x2CC85E82l, 0x4F4EC577l, 0x3AB64AE0l, 0xFFC537F6l, - 0xA90F6BF2l, 0x5060B8B4l, 0x19E11968l, 0x714CA34Fl, 0xEE3BE15Cl, - 0x8CE2D14Bl, 0x469FF67Bl, 0xC1BC96A8l, 0x3858DA9Fl, 0x9B9DB21Fl, - 0xFD36B46Fl, 0x5A5479ADl, 0xFA52D080l }; - -static sal_uInt8 cbc_key[16] = -{ - 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, - 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87 -}; -static sal_uInt8 cbc_iv[8] = -{ - 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 -}; - -static sal_Char cbc_data[40] = "7654321 Now is the time for "; - -static sal_uInt8 arcfour_key[6][30] = -{ - { 8, 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, - { 8, 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, - { 8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 4, 0xef, 0x01, 0x23, 0x45 }, - { 8, 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, - { 4, 0xef, 0x01, 0x23, 0x45 } -}; -static sal_uInt8 arcfour_data_len[6] = -{ - 8, 8, 8, 20, 28, 10 -}; -static sal_uInt8 arcfour_data[6][30] = -{ - { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0xff }, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff }, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff }, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xff }, - { 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0, - 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0, - 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0, - 0x12, 0x34, 0x56, 0x78, 0xff }, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xff } -}; - -#if OSL_DEBUG_LEVEL > 0 -static sal_uInt8 ecb_ok[32] = -{ - 0x2A, 0xFD, 0x7D, 0xAA, 0x60, 0x62, 0x6B, 0xA3, - 0x86, 0x16, 0x46, 0x8C, 0xC2, 0x9C, 0xF6, 0xE1, - 0x29, 0x1E, 0x81, 0x7C, 0xC7, 0x40, 0x98, 0x2D, - 0x6F, 0x87, 0xAC, 0x5F, 0x17, 0x1A, 0xAB, 0xEA -}; -static sal_uInt8 cbc_ok[32] = -{ ... etc. - the rest is truncated
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits