diff options
author | Michael Stahl <mstahl@redhat.com> | 2017-05-29 15:05:58 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2017-05-29 15:46:20 +0200 |
commit | 1493eef1379a457c636959f423286612849e3691 (patch) | |
tree | ef2a739ae9991bd1f7a29c5daf7b35cb67cc3151 /fpicker | |
parent | 99643e0d69ad2cd87a1c1e9602edf3a7fe7bd9cf (diff) |
fpicker: remove some Win32 helper code that is now unused
Change-Id: I5414df94487fc9918ca28b694d6f94eeeac20b70
Diffstat (limited to 'fpicker')
-rw-r--r-- | fpicker/source/win32/misc/WinImplHelper.cxx | 230 | ||||
-rw-r--r-- | fpicker/source/win32/misc/WinImplHelper.hxx | 40 |
2 files changed, 0 insertions, 270 deletions
diff --git a/fpicker/source/win32/misc/WinImplHelper.cxx b/fpicker/source/win32/misc/WinImplHelper.cxx index 105045e4e467..d31dd622a8df 100644 --- a/fpicker/source/win32/misc/WinImplHelper.cxx +++ b/fpicker/source/win32/misc/WinImplHelper.cxx @@ -77,236 +77,6 @@ bool SAL_CALL IsWindowsVistaOrNewer() #endif } -void SAL_CALL ListboxAddString( HWND hwnd, const OUString& aString ) -{ - LRESULT rc = SendMessageW( - hwnd, CB_ADDSTRING, 0, reinterpret_cast< LPARAM >(aString.getStr( )) ); - (void) rc; // avoid warning - OSL_ASSERT( (CB_ERR != rc) && (CB_ERRSPACE != rc) ); -} - -OUString SAL_CALL ListboxGetString( HWND hwnd, sal_Int32 aPosition ) -{ - OSL_ASSERT( IsWindow( hwnd ) ); - - OUString aString; - - LRESULT lItem = - SendMessageW( hwnd, CB_GETLBTEXTLEN, aPosition, 0 ); - - if ( (CB_ERR != lItem) && (lItem > 0) ) - { - // message returns the len of a combobox item - // without trailing '\0' that's why += 1 - lItem++; - - std::vector<sal_Unicode> vec(lItem); - - LRESULT lRet = - SendMessageW( - hwnd, CB_GETLBTEXT, aPosition, - reinterpret_cast<LPARAM>(&vec[0])); - - OSL_ASSERT( lRet != CB_ERR ); - - if ( CB_ERR != lRet ) - aString = OUString(&vec[0], lRet); - } - - return aString; -} - -void SAL_CALL ListboxAddItem( HWND hwnd, const Any& aItem, const Reference< XInterface >& rXInterface, sal_Int16 aArgPos ) -{ - OSL_ASSERT( IsWindow( hwnd ) ); - - if ( !aItem.hasValue( ) || - aItem.getValueType( ) != cppu::UnoType<OUString>::get() ) - throw IllegalArgumentException( - "invalid value type or any has no value", - rXInterface, - aArgPos ); - - OUString cbItem; - aItem >>= cbItem; - - ListboxAddString( hwnd, cbItem ); -} - -void SAL_CALL ListboxAddItems( HWND hwnd, const Any& aItemList, const Reference< XInterface >& rXInterface, sal_Int16 aArgPos ) -{ - OSL_ASSERT( IsWindow( hwnd ) ); - - if ( !aItemList.hasValue( ) || - aItemList.getValueType( ) != cppu::UnoType<Sequence<OUString>>::get() ) - throw IllegalArgumentException( - "invalid value type or any has no value", - rXInterface, - aArgPos ); - - Sequence< OUString > aStringList; - aItemList >>= aStringList; - - sal_Int32 nItemCount = aStringList.getLength( ); - for( sal_Int32 i = 0; i < nItemCount; i++ ) - { - ListboxAddString( hwnd, aStringList[i] ); - } -} - -void SAL_CALL ListboxDeleteItem( HWND hwnd, const Any& aPosition, const Reference< XInterface >& rXInterface, sal_Int16 aArgPos ) -{ - OSL_ASSERT( IsWindow( hwnd ) ); - - if ( !aPosition.hasValue( ) || - ( (aPosition.getValueType( ) != cppu::UnoType<sal_Int32>::get()) && - (aPosition.getValueType( ) != cppu::UnoType<sal_Int16>::get()) && - (aPosition.getValueType( ) != cppu::UnoType<sal_Int8>::get()) ) ) - throw IllegalArgumentException( - "invalid value type or any has no value", - rXInterface, - aArgPos ); - - sal_Int32 nPos; - aPosition >>= nPos; - - LRESULT lRet = SendMessageW( hwnd, CB_DELETESTRING, nPos, 0 ); - - // if the return value is CB_ERR the given - // index was not correct - if ( CB_ERR == lRet ) - throw IllegalArgumentException( - "invalid item position", - rXInterface, - aArgPos ); -} - -void SAL_CALL ListboxDeleteItems( HWND hwnd, const Any&, const Reference< XInterface >&, sal_Int16 ) -{ - OSL_ASSERT( IsWindow( hwnd ) ); - - LRESULT lRet = 0; - - do - { - // the return value on success is the number - // of remaining elements in the listbox - lRet = SendMessageW( hwnd, CB_DELETESTRING, 0, 0 ); - } - while ( (lRet != CB_ERR) && (lRet > 0) ); -} - -void SAL_CALL ListboxSetSelectedItem( HWND hwnd, const Any& aPosition, const Reference< XInterface >& rXInterface, sal_Int16 aArgPos ) -{ - OSL_ASSERT( IsWindow( hwnd ) ); - - if ( !aPosition.hasValue( ) || - ( (aPosition.getValueType( ) != cppu::UnoType<sal_Int32>::get()) && - (aPosition.getValueType( ) != cppu::UnoType<sal_Int16>::get()) && - (aPosition.getValueType( ) != cppu::UnoType<sal_Int8>::get()) ) ) - throw IllegalArgumentException( - "invalid value type or any has no value", - rXInterface, - aArgPos ); - - sal_Int32 nPos; - aPosition >>= nPos; - - if ( nPos < -1 ) - throw IllegalArgumentException( - "invalid index", - rXInterface, - aArgPos ); - - LRESULT lRet = SendMessageW( hwnd, CB_SETCURSEL, nPos, 0 ); - - if ( (CB_ERR == lRet) && (-1 != nPos) ) - throw IllegalArgumentException( - "invalid index", - rXInterface, - aArgPos ); -} - -Any SAL_CALL ListboxGetItems( HWND hwnd ) -{ - OSL_ASSERT( IsWindow( hwnd ) ); - - LRESULT nItemCount = SendMessageW( hwnd, CB_GETCOUNT, 0, 0 ); - - Sequence< OUString > aItemList; - - if ( CB_ERR != nItemCount ) - { - aItemList.realloc( nItemCount ); - - for ( LRESULT i = 0; i < nItemCount; i++ ) - { - aItemList[i] = ListboxGetString( hwnd, i ); - } - } - - return Any(aItemList); -} - -Any SAL_CALL ListboxGetSelectedItem( HWND hwnd ) -{ - OSL_ASSERT( IsWindow( hwnd ) ); - - LRESULT idxItem = SendMessageW( hwnd, CB_GETCURSEL, 0, 0 ); - - return Any( ListboxGetString( hwnd, idxItem ) ); -} - -Any SAL_CALL ListboxGetSelectedItemIndex( HWND hwnd ) -{ - OSL_ASSERT( IsWindow( hwnd ) ); - - LRESULT idxItem = SendMessageW( hwnd, CB_GETCURSEL, 0, 0 ); - - return Any( static_cast< sal_Int32 >( idxItem ) ); -} - -Any SAL_CALL CheckboxGetState( HWND hwnd ) -{ - OSL_ASSERT( IsWindow( hwnd ) ); - - LRESULT lChkState = SendMessageW( hwnd, BM_GETCHECK, 0, 0 ); - bool bChkState = (lChkState == BST_CHECKED); - return Any(bChkState); -} - -void SAL_CALL CheckboxSetState( - HWND hwnd, const css::uno::Any& aState, const Reference< XInterface >& rXInterface, sal_Int16 aArgPos ) -{ - OSL_ASSERT( IsWindow( hwnd ) ); - - if ( !aState.hasValue( ) || - aState.getValueType( ) != cppu::UnoType<sal_Bool>::get()) - throw IllegalArgumentException( - "invalid value type or any has no value", - rXInterface, - aArgPos ); - - bool bCheckState = *static_cast< const sal_Bool* >( aState.getValue( ) ); - WPARAM wParam = bCheckState ? BST_CHECKED : BST_UNCHECKED; - SendMessageW( hwnd, BM_SETCHECK, wParam, 0 ); -} - -sal_uInt32 SAL_CALL wcslenex( const sal_Unicode* pStr ) -{ - if ( !pStr ) - return 0; - - const sal_Unicode* pTemp = pStr; - sal_uInt32 strLen = 0; - while( *pTemp || *(pTemp + 1) ) - { - pTemp++; - strLen++; - } - - return strLen; -} void Replace( const OUString& aLabel, sal_Unicode OldChar, sal_Unicode NewChar, OUStringBuffer& aBuffer ) { diff --git a/fpicker/source/win32/misc/WinImplHelper.hxx b/fpicker/source/win32/misc/WinImplHelper.hxx index 369e127bd48a..2e78cdaed136 100644 --- a/fpicker/source/win32/misc/WinImplHelper.hxx +++ b/fpicker/source/win32/misc/WinImplHelper.hxx @@ -36,46 +36,6 @@ bool SAL_CALL IsWindowsVistaOrNewer(); -// set actions -/// @throws css::lang::IllegalArgumentException -void SAL_CALL ListboxAddItem( - HWND hwnd, const css::uno::Any& aItem, const css::uno::Reference< css::uno::XInterface >& rXInterface, sal_Int16 aArgPos ); - -/// @throws css::lang::IllegalArgumentException -void SAL_CALL ListboxAddItems( - HWND hwnd, const css::uno::Any& aItemList, const css::uno::Reference< css::uno::XInterface >& rXInterface, sal_Int16 aArgPos ); - -/// @throws css::lang::IllegalArgumentException -void SAL_CALL ListboxDeleteItem( - HWND hwnd, const css::uno::Any& aPosition, const css::uno::Reference< css::uno::XInterface >& rXInterface, sal_Int16 aArgPos ); - -/// @throws css::lang::IllegalArgumentException -void SAL_CALL ListboxDeleteItems( - HWND hwnd, const css::uno::Any& aUnused, const css::uno::Reference< css::uno::XInterface >& rXInterface, sal_Int16 aArgPos ); - -/// @throws css::lang::IllegalArgumentException -void SAL_CALL ListboxSetSelectedItem( - HWND hwnd, const css::uno::Any& aPosition, const css::uno::Reference< css::uno::XInterface >& rXInterface, sal_Int16 aArgPos ); - -// get actions -css::uno::Any SAL_CALL ListboxGetItems( HWND hwnd ); -css::uno::Any SAL_CALL ListboxGetSelectedItem( HWND hwnd ); -css::uno::Any SAL_CALL ListboxGetSelectedItemIndex( HWND hwnd ); - -// checkbox helper functions -css::uno::Any SAL_CALL CheckboxGetState( HWND hwnd ); - -/// @throws css::lang::IllegalArgumentException -void SAL_CALL CheckboxSetState( - HWND hwnd, const css::uno::Any& aState, const css::uno::Reference< css::uno::XInterface >& rXInterface, sal_Int16 aArgPos ); - -// calculates the length of '\0' separated and '\0\0' -// ending strings used in some Win32 functions -// e.g. Filter\0*.txt\0\0 -// the returned length excludes the last '\0' -sal_uInt32 SAL_CALL wcslenex( const sal_Unicode* pStr ); - - // converts a soffice label to a windows label // the following rules for character replacements // will be done: |