diff options
author | Jens-Heiner Rechtien <hr@openoffice.org> | 2003-03-25 17:05:07 +0000 |
---|---|---|
committer | Jens-Heiner Rechtien <hr@openoffice.org> | 2003-03-25 17:05:07 +0000 |
commit | 27973e334a0fdbc8712bdcb1c693b26717923a1e (patch) | |
tree | 919c5ea9bec9bba050b3a4e661fe25d47e07556d /fpicker | |
parent | 6d2505eb901c07159107c97ec66830bbec840121 (diff) |
MWS_SRX644: migrate branch mws_srx644 -> HEAD
Diffstat (limited to 'fpicker')
25 files changed, 394 insertions, 387 deletions
diff --git a/fpicker/source/win32/filepicker/FileOpenDlg.cxx b/fpicker/source/win32/filepicker/FileOpenDlg.cxx index 91c693fb7113..6f197d7e7d6f 100644 --- a/fpicker/source/win32/filepicker/FileOpenDlg.cxx +++ b/fpicker/source/win32/filepicker/FileOpenDlg.cxx @@ -2,9 +2,9 @@ * * $RCSfile: FileOpenDlg.cxx,v $ * - * $Revision: 1.10 $ + * $Revision: 1.11 $ * - * last change: $Author: hro $ $Date: 2002-08-14 15:51:11 $ + * last change: $Author: hr $ $Date: 2003-03-25 18:04:56 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -63,6 +63,8 @@ // includes //------------------------------------------------------------------------ +#include <tchar.h> + #ifndef _OSL_DIAGNOSE_H_ #include <osl/diagnose.h> #endif @@ -95,7 +97,27 @@ namespace /* private */ const size_t MAX_FILETITLE_BUFF_SIZE = 32000; const size_t MAX_FILTER_BUFF_SIZE = 4096; - const char* CURRENT_INSTANCE = "CurrInst"; + const LPTSTR CURRENT_INSTANCE = TEXT("CurrInst"); + + //------------------------------------------ + // find an appropriate parent window + //------------------------------------------ + + inline bool is_current_process_window(HWND hwnd) + { + DWORD pid; + GetWindowThreadProcessId(hwnd, &pid); + return (pid == GetCurrentProcessId()); + } + + HWND choose_parent_window() + { + HWND hwnd_parent = GetForegroundWindow(); + if (!is_current_process_window(hwnd_parent)) + hwnd_parent = GetDesktopWindow(); + + return hwnd_parent; + } }; //------------------------------------------------------------------------ @@ -117,7 +139,7 @@ CFileOpenDialog::CFileOpenDialog( m_pfnBaseDlgProc(0) { // initialize the OPENFILENAME struct - if (IsWindows2000Platform()) + if (IsWindows2000Platform() || IsWindowsME()) { ZeroMemory(&m_ofn, sizeof(m_ofn)); m_ofn.lStructSize = sizeof(m_ofn); @@ -126,8 +148,8 @@ CFileOpenDialog::CFileOpenDialog( { // the size of the OPENFILENAME structure is different // under windows < win2000 - ZeroMemory( &m_ofn, _OPENFILENAME_SIZE_VERSION_400W ); - m_ofn.lStructSize = _OPENFILENAME_SIZE_VERSION_400W; + ZeroMemory(&m_ofn, _OPENFILENAME_SIZE_VERSION_400); + m_ofn.lStructSize = _OPENFILENAME_SIZE_VERSION_400; } // 0x02000000 for #97681, sfx will make the entry into @@ -144,7 +166,7 @@ CFileOpenDialog::CFileOpenDialog( // it is a little hack but how else could // we get a parent window (using a vcl window?) - m_ofn.hwndOwner = GetForegroundWindow( ); + m_ofn.hwndOwner = choose_parent_window(); m_ofn.lpstrFile = const_cast<sal_Unicode*>(m_fileNameBuffer.getStr()); m_ofn.nMaxFile = m_fileNameBuffer.getCapacity(); @@ -159,9 +181,9 @@ CFileOpenDialog::CFileOpenDialog( { OSL_ASSERT(hInstance); - m_ofn.Flags |= OFN_ENABLETEMPLATE; - m_ofn.lpTemplateName = MAKEINTRESOURCEW(dwTemplateId); - m_ofn.hInstance = hInstance; + m_ofn.Flags |= OFN_ENABLETEMPLATE; + m_ofn.lpTemplateName = MAKEINTRESOURCE(dwTemplateId); + m_ofn.hInstance = hInstance; } // set a pointer to myself as ofn parameter @@ -326,10 +348,10 @@ sal_Int16 SAL_CALL CFileOpenDialog::doModal() if (m_bFileOpenDialog) bRet = m_GetFileNameWrapper.getOpenFileName( - reinterpret_cast<LPOPENFILENAMEW>(&m_ofn)); + reinterpret_cast<LPOPENFILENAME>(&m_ofn)); else bRet = m_GetFileNameWrapper.getSaveFileName( - reinterpret_cast<LPOPENFILENAMEW>(&m_ofn)); + reinterpret_cast<LPOPENFILENAME>(&m_ofn)); nRC = 1; @@ -386,7 +408,7 @@ rtl::OUString SAL_CALL CFileOpenDialog::getCurrentFilePath() const { OSL_ASSERT(IsWindow(m_hwndFileOpenDlg)); - LPARAM nLen = SendMessageW( + LPARAM nLen = SendMessage( m_hwndFileOpenDlg, CDM_GETFILEPATH, m_helperBuffer.getCapacity(), @@ -394,10 +416,9 @@ rtl::OUString SAL_CALL CFileOpenDialog::getCurrentFilePath() const if (nLen > 0) { - m_helperBuffer.setLength(nLen - 1); + m_helperBuffer.setLength((nLen * sizeof(sal_Unicode)) - 1); return rtl::OUString(m_helperBuffer); } - return rtl::OUString(); } @@ -409,7 +430,7 @@ rtl::OUString SAL_CALL CFileOpenDialog::getCurrentFolderPath() const { OSL_ASSERT(IsWindow(m_hwndFileOpenDlg)); - LPARAM nLen = SendMessageW( + LPARAM nLen = SendMessage( m_hwndFileOpenDlg, CDM_GETFOLDERPATH, m_helperBuffer.getCapacity(), @@ -417,10 +438,9 @@ rtl::OUString SAL_CALL CFileOpenDialog::getCurrentFolderPath() const if (nLen > 0) { - m_helperBuffer.setLength(nLen - 1); + m_helperBuffer.setLength((nLen * sizeof(sal_Unicode)) - 1); return rtl::OUString(m_helperBuffer); } - return rtl::OUString(); } @@ -432,33 +452,17 @@ rtl::OUString SAL_CALL CFileOpenDialog::getCurrentFileName() const { OSL_ASSERT(IsWindow(m_hwndFileOpenDlg)); - // this is an ugly hack because beause - // CDM_GETSPEC and BFFM_SETSTATUSTEXT - // message id are equal and we have only - // one SendMessageW wrapper for Win95 - int MsgId = CDM_GETSPEC; - - OSVERSIONINFO OSVerInfo; - - OSVerInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - GetVersionEx( &OSVerInfo ); - - // if windows 95/98 - if (VER_PLATFORM_WIN32_WINDOWS == OSVerInfo.dwPlatformId) - MsgId = CDM_GETSPEC + 100; - - LPARAM nLen = SendMessageW( + LPARAM nLen = SendMessage( m_hwndFileOpenDlg, - MsgId, + CDM_GETSPEC, m_helperBuffer.getCapacity(), reinterpret_cast<LPARAM>(m_helperBuffer.getStr())); if (nLen > 0) { - m_helperBuffer.setLength(nLen - 1); + m_helperBuffer.setLength((nLen * sizeof(sal_Unicode)) - 1); return rtl::OUString(m_helperBuffer); } - return rtl::OUString(); } @@ -543,7 +547,7 @@ sal_uInt32 SAL_CALL CFileOpenDialog::onCtrlCommand( // //------------------------------------------------------------------------ -sal_uInt32 SAL_CALL CFileOpenDialog::onWMNotify(HWND hwndChild, LPOFNOTIFYW lpOfNotify) +sal_uInt32 SAL_CALL CFileOpenDialog::onWMNotify( HWND hwndChild, LPOFNOTIFY lpOfNotify ) { switch(lpOfNotify->hdr.code) { @@ -601,27 +605,26 @@ void SAL_CALL CFileOpenDialog::handleInitDialog(HWND hwndDlg, HWND hwndChild) unsigned int CALLBACK CFileOpenDialog::ofnHookProc( HWND hChildDlg, unsigned int uiMsg, WPARAM wParam, LPARAM lParam) { - HWND hwndDlg = GetParent( hChildDlg ); + HWND hwndDlg = GetParent(hChildDlg); CFileOpenDialog* pImpl = NULL; switch( uiMsg ) { case WM_INITDIALOG: { - _OPENFILENAMEW* lpofn = reinterpret_cast<_OPENFILENAMEW*>(lParam); + _LPOPENFILENAME lpofn = reinterpret_cast<_LPOPENFILENAME>(lParam); pImpl = reinterpret_cast<CFileOpenDialog*>(lpofn->lCustData); OSL_ASSERT(pImpl); // subclass the base dialog for WM_NCDESTROY processing pImpl->m_pfnBaseDlgProc = - reinterpret_cast< DLGPROC >( - SetWindowLong( hwndDlg, - DWL_DLGPROC, - reinterpret_cast<DWORD>(CFileOpenDialog::BaseDlgProc))); - + reinterpret_cast<WNDPROC>( + SetWindowLong( + hwndDlg, + GWL_WNDPROC, + reinterpret_cast<LONG>(CFileOpenDialog::BaseDlgProc))); // connect the instance handle to the window - SetPropA(hwndDlg, CURRENT_INSTANCE, pImpl); - + SetProp(hwndDlg, CURRENT_INSTANCE, pImpl); pImpl->handleInitDialog(hwndDlg, hChildDlg); } return 0; @@ -630,7 +633,7 @@ unsigned int CALLBACK CFileOpenDialog::ofnHookProc( { pImpl = getCurrentInstance(hwndDlg); return pImpl->onWMNotify( - hChildDlg, reinterpret_cast<LPOFNOTIFYW>(lParam)); + hChildDlg, reinterpret_cast<LPOFNOTIFY>(lParam)); } case WM_COMMAND: @@ -650,18 +653,18 @@ unsigned int CALLBACK CFileOpenDialog::ofnHookProc( // //------------------------------------------------------------------------ -unsigned int CALLBACK CFileOpenDialog::BaseDlgProc( - HWND hWnd, WORD wMessage, WPARAM wParam, LPARAM lParam) +LRESULT CALLBACK CFileOpenDialog::BaseDlgProc( + HWND hWnd, UINT wMessage, WPARAM wParam, LPARAM lParam) { CFileOpenDialog* pImpl = 0; if (WM_NCDESTROY == wMessage) { pImpl = reinterpret_cast<CFileOpenDialog*>( - RemovePropA(hWnd,CURRENT_INSTANCE)); + RemoveProp(hWnd,CURRENT_INSTANCE)); - SetWindowLong(hWnd, DWL_DLGPROC, - reinterpret_cast<DWORD>(pImpl->m_pfnBaseDlgProc)); + SetWindowLong(hWnd, GWL_WNDPROC, + reinterpret_cast<LONG>(pImpl->m_pfnBaseDlgProc)); } else { @@ -670,7 +673,7 @@ unsigned int CALLBACK CFileOpenDialog::BaseDlgProc( OSL_ASSERT(pImpl); - return CallWindowProcA( + return CallWindowProc( reinterpret_cast<WNDPROC>(pImpl->m_pfnBaseDlgProc), hWnd,wMessage,wParam,lParam); } @@ -681,10 +684,9 @@ unsigned int CALLBACK CFileOpenDialog::BaseDlgProc( CFileOpenDialog* SAL_CALL CFileOpenDialog::getCurrentInstance(HWND hwnd) { - OSL_ASSERT(IsWindow(hwnd)); - + OSL_ASSERT(IsWindow( hwnd)); return reinterpret_cast<CFileOpenDialog*>( - GetPropA(hwnd, CURRENT_INSTANCE)); + GetProp(hwnd, CURRENT_INSTANCE)); } //------------------------------------------------------------------------ diff --git a/fpicker/source/win32/filepicker/FileOpenDlg.hxx b/fpicker/source/win32/filepicker/FileOpenDlg.hxx index e2e3f3521713..8fc2ff1f1099 100644 --- a/fpicker/source/win32/filepicker/FileOpenDlg.hxx +++ b/fpicker/source/win32/filepicker/FileOpenDlg.hxx @@ -2,9 +2,9 @@ * * $RCSfile: FileOpenDlg.hxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: tra $ $Date: 2002-03-28 08:57:33 $ + * last change: $Author: hr $ $Date: 2003-03-25 18:04:56 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -88,11 +88,41 @@ // into our build environment if have stolen the definition // for the new OPENFILENAME structure from the new headers -#if (_WIN32_WINNT >= 0x0500) +#ifndef _CDSIZEOF_STRUCT +#define _CDSIZEOF_STRUCT(structname, member) (((int)((LPBYTE)(&((structname*)0)->member) - ((LPBYTE)((structname*)0)))) + sizeof(((structname*)0)->member)) +#endif -#ifndef CDSIZEOF_STRUCT -#define CDSIZEOF_STRUCT(structname, member) (((int)((LPBYTE)(&((structname*)0)->member) - ((LPBYTE)((structname*)0)))) + sizeof(((structname*)0)->member)) +typedef struct _tagOFNA { + DWORD lStructSize; + HWND hwndOwner; + HINSTANCE hInstance; + LPCSTR lpstrFilter; + LPSTR lpstrCustomFilter; + DWORD nMaxCustFilter; + DWORD nFilterIndex; + LPSTR lpstrFile; + DWORD nMaxFile; + LPSTR lpstrFileTitle; + DWORD nMaxFileTitle; + LPCSTR lpstrInitialDir; + LPCSTR lpstrTitle; + DWORD Flags; + WORD nFileOffset; + WORD nFileExtension; + LPCSTR lpstrDefExt; + LPARAM lCustData; + LPOFNHOOKPROC lpfnHook; + LPCSTR lpTemplateName; +#ifdef _MAC + LPEDITMENU lpEditInfo; + LPCSTR lpstrPrompt; #endif +#if (_WIN32_WINNT >= 0x0500) + void * pvReserved; + DWORD dwReserved; + DWORD FlagsEx; +#endif // (_WIN32_WINNT >= 0x0500) +} _OPENFILENAMEA, *_LPOPENFILENAMEA; typedef struct _tagOFNW { DWORD lStructSize; @@ -122,8 +152,22 @@ typedef struct _tagOFNW { #endif // (_WIN32_WINNT >= 0x0500) } _OPENFILENAMEW, *_LPOPENFILENAMEW; -#define _OPENFILENAME_SIZE_VERSION_400W CDSIZEOF_STRUCT(OPENFILENAMEW,lpTemplateName) +#ifdef UNICODE +typedef _OPENFILENAMEW _OPENFILENAME; +typedef _LPOPENFILENAMEW _LPOPENFILENAME; +#else +typedef _OPENFILENAMEA _OPENFILENAME; +typedef _LPOPENFILENAMEA _LPOPENFILENAME; +#endif // UNICODE +#if (_WIN32_WINNT >= 0x0500) +#define _OPENFILENAME_SIZE_VERSION_400A _CDSIZEOF_STRUCT(_OPENFILENAMEA,lpTemplateName) +#define _OPENFILENAME_SIZE_VERSION_400W _CDSIZEOF_STRUCT(_OPENFILENAMEW,lpTemplateName) +#ifdef UNICODE +#define _OPENFILENAME_SIZE_VERSION_400 _OPENFILENAME_SIZE_VERSION_400W +#else +#define _OPENFILENAME_SIZE_VERSION_400 _OPENFILENAME_SIZE_VERSION_400A +#endif // !UNICODE #endif // (_WIN32_WINNT >= 0x0500) @@ -275,7 +319,7 @@ protected: HWND m_hwndFileOpenDlg; HWND m_hwndFileOpenDlgChild; - _OPENFILENAMEW m_ofn; + _OPENFILENAME m_ofn; // we connect the instance with the dialog window using // SetProp, with this function we can reconnect from @@ -298,7 +342,7 @@ private: CGetFileNameWrapper m_GetFileNameWrapper; - DLGPROC m_pfnBaseDlgProc; + WNDPROC m_pfnBaseDlgProc; // callback function static unsigned int CALLBACK ofnHookProc( @@ -312,8 +356,8 @@ private: // to clean up the window property we are // using to connect the window with a class // instance in WM_NCDESTROY - static unsigned int CALLBACK BaseDlgProc( - HWND hWnd, WORD wMessage, WPARAM wParam, LPARAM lParam ); + static LRESULT CALLBACK BaseDlgProc( + HWND hWnd, UINT wMessage, WPARAM wParam, LPARAM lParam ); private: // avoid copy and assignment diff --git a/fpicker/source/win32/filepicker/FilePicker.cxx b/fpicker/source/win32/filepicker/FilePicker.cxx index c52e96dcacee..397634a7ac67 100644 --- a/fpicker/source/win32/filepicker/FilePicker.cxx +++ b/fpicker/source/win32/filepicker/FilePicker.cxx @@ -2,9 +2,9 @@ * * $RCSfile: FilePicker.cxx,v $ * - * $Revision: 1.18 $ + * $Revision: 1.19 $ * - * last change: $Author: tra $ $Date: 2002-11-26 09:21:59 $ + * last change: $Author: hr $ $Date: 2003-03-25 18:04:56 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -63,6 +63,8 @@ // includes //------------------------------------------------------------------------ +#include <tchar.h> + #ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_ #include <com/sun/star/lang/DisposedException.hpp> #endif @@ -107,7 +109,7 @@ using namespace ::com::sun::star::ui::dialogs::TemplateDescription; // defines //------------------------------------------------------------------------ -#define FILE_PICKER_DLL_NAME "fps.dll" +#define FILE_PICKER_DLL_NAME TEXT("fps.dll") //------------------------------------------------------------------------ // helper functions @@ -146,7 +148,7 @@ CFilePicker::CFilePicker( const uno::Reference<lang::XMultiServiceFactory>& xSer m_xServiceMgr(xServiceMgr), m_aAsyncEventNotifier(rBHelper) { - HINSTANCE hInstance = GetModuleHandleA( FILE_PICKER_DLL_NAME ); + HINSTANCE hInstance = GetModuleHandle(FILE_PICKER_DLL_NAME); OSL_POSTCOND( hInstance, "The name of the service dll must have changed" ); // create a default FileOpen dialog without any additional ui elements @@ -738,7 +740,7 @@ void SAL_CALL CFilePicker::initialize(const uno::Sequence<uno::Any>& aArguments) 1 ); } - HINSTANCE hInstance = GetModuleHandleA( FILE_PICKER_DLL_NAME ); + HINSTANCE hInstance = GetModuleHandle( FILE_PICKER_DLL_NAME ); OSL_POSTCOND( hInstance, "The name of the service dll must have changed" ); // create a new impl-class here based on the diff --git a/fpicker/source/win32/filepicker/PreviewCtrl.cxx b/fpicker/source/win32/filepicker/PreviewCtrl.cxx index b9709cb63413..cbcffb3d7daa 100644 --- a/fpicker/source/win32/filepicker/PreviewCtrl.cxx +++ b/fpicker/source/win32/filepicker/PreviewCtrl.cxx @@ -2,9 +2,9 @@ * * $RCSfile: PreviewCtrl.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: hro $ $Date: 2002-08-14 15:52:39 $ + * last change: $Author: hr $ $Date: 2003-03-25 18:04:57 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -63,6 +63,8 @@ // includes //------------------------------------------------------------------------ +#include <tchar.h> + #ifndef _PREVIEWCTRL_HXX_ #include "PreviewCtrl.hxx" #endif @@ -79,7 +81,7 @@ // defines //------------------------------------------------------------------------ -#define PREVIEWWND_CLASS_NAME L"PreviewWnd###" +#define PREVIEWWND_CLASS_NAME TEXT("PreviewWnd###") #define HIMETRIC_INCH 2540 @@ -281,10 +283,10 @@ CFilePreview::CFilePreview( m_bEnabled( bEnabled ) { // register the preview window class - WNDCLASSEXW wndClsEx; - ZeroMemory( &wndClsEx, sizeof( WNDCLASSEXW ) ); + WNDCLASSEX wndClsEx; + ZeroMemory(&wndClsEx, sizeof(wndClsEx)); - wndClsEx.cbSize = sizeof( WNDCLASSEXW ); + wndClsEx.cbSize = sizeof(wndClsEx); wndClsEx.style = CS_HREDRAW | CS_VREDRAW; wndClsEx.lpfnWndProc = CFilePreview::WndProc; wndClsEx.hInstance = m_hInstance; @@ -296,16 +298,16 @@ CFilePreview::CFilePreview( // if the dll is unloaded // Win2000 - the window class must be unregistered manually // if the dll is unloaded - m_atomPrevWndClass = RegisterClassExW( &wndClsEx ); + m_atomPrevWndClass = RegisterClassEx(&wndClsEx); if ( !m_atomPrevWndClass ) throw CPreviewException( ); // create the preview window in invisible state sal_uInt32 dwStyle = bShow ? (WS_CHILD | WS_VISIBLE) : WS_CHILD; - m_hwnd = CreateWindowExW( + m_hwnd = CreateWindowEx( WS_EX_CLIENTEDGE, PREVIEWWND_CLASS_NAME, - L"", + TEXT(""), dwStyle, ulCorner.x, ulCorner.y, @@ -316,7 +318,7 @@ CFilePreview::CFilePreview( // be used as child window identifier m_hInstance, 0 ); - if ( !IsWindow( m_hwnd ) ) + if (!IsWindow(m_hwnd)) throw CPreviewException( ); } @@ -544,7 +546,7 @@ sal_Bool CFilePreview::loadFile( const rtl::OUString& aFileName ) sal_uInt32 fszExtra; sal_uInt32 fsize; - hFile = CreateFileW( + hFile = CreateFile( aFileName.getStr( ), GENERIC_READ, 0, diff --git a/fpicker/source/win32/filepicker/WinFileOpenImpl.cxx b/fpicker/source/win32/filepicker/WinFileOpenImpl.cxx index 27c1a3699c43..46b9150869c1 100644 --- a/fpicker/source/win32/filepicker/WinFileOpenImpl.cxx +++ b/fpicker/source/win32/filepicker/WinFileOpenImpl.cxx @@ -2,9 +2,9 @@ * * $RCSfile: WinFileOpenImpl.cxx,v $ * - * $Revision: 1.19 $ + * $Revision: 1.20 $ * - * last change: $Author: tra $ $Date: 2002-11-26 09:30:53 $ + * last change: $Author: hr $ $Date: 2003-03-25 18:04:57 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -186,7 +186,7 @@ CWinFileOpenImpl::CWinFileOpenImpl( sal_uInt32 dwTemplateId, HINSTANCE hInstance) : CFileOpenDialog(bFileOpenDialog, dwFlags, dwTemplateId, hInstance), - m_filterContainer( new CFilterContainer()), + m_filterContainer(new CFilterContainer()), m_Preview(new CPreviewAdapter(hInstance)), m_CustomControlFactory(new CCustomControlFactory()), m_CustomControls(m_CustomControlFactory->CreateCustomControlContainer()), @@ -531,7 +531,7 @@ void SAL_CALL CWinFileOpenImpl::cancel() { // simulate a mouse click to the // cancel button - PostMessageA( + PostMessage( m_hwndFileOpenDlg, WM_COMMAND, MAKEWPARAM(IDCANCEL,BN_CLICKED), @@ -571,8 +571,8 @@ inline sal_Bool SAL_CALL CWinFileOpenImpl::IsCustomControlHelpRequested(LPHELPIN // if one instance dies //----------------------------------------------------------------------------------------- -unsigned int CALLBACK CWinFileOpenImpl::SubClassFunc( - HWND hWnd, WORD wMessage, WPARAM wParam, LPARAM lParam) +LRESULT CALLBACK CWinFileOpenImpl::SubClassFunc( + HWND hWnd, UINT wMessage, WPARAM wParam, LPARAM lParam) { unsigned int lResult = 0; @@ -587,14 +587,14 @@ unsigned int CALLBACK CWinFileOpenImpl::SubClassFunc( if (pImpl->IsCustomControlHelpRequested(lphi)) pImpl->onCustomControlHelpRequest(lphi); else - lResult = CallWindowProcA( + lResult = CallWindowProc( reinterpret_cast<WNDPROC>(pImpl->m_pfnOldDlgProc), hWnd,wMessage,wParam,lParam); } break; case WM_SIZE: - lResult = CallWindowProcA( + lResult = CallWindowProc( reinterpret_cast<WNDPROC>(pImpl->m_pfnOldDlgProc), hWnd,wMessage,wParam,lParam); @@ -602,7 +602,7 @@ unsigned int CALLBACK CWinFileOpenImpl::SubClassFunc( break; case WM_WINDOWPOSCHANGED: - lResult = CallWindowProcA( + lResult = CallWindowProc( reinterpret_cast<WNDPROC>(pImpl->m_pfnOldDlgProc), hWnd,wMessage,wParam,lParam); @@ -610,7 +610,7 @@ unsigned int CALLBACK CWinFileOpenImpl::SubClassFunc( break; case WM_SHOWWINDOW: - lResult = CallWindowProcA( + lResult = CallWindowProc( reinterpret_cast<WNDPROC>(pImpl->m_pfnOldDlgProc), hWnd,wMessage,wParam,lParam); @@ -619,17 +619,16 @@ unsigned int CALLBACK CWinFileOpenImpl::SubClassFunc( case WM_NCDESTROY: // restore the old window proc - SetWindowLong(hWnd, DWL_DLGPROC, - reinterpret_cast<DWORD>(pImpl->m_pfnOldDlgProc)); + SetWindowLong(hWnd, GWL_WNDPROC, + reinterpret_cast<LONG>(pImpl->m_pfnOldDlgProc)); - lResult = CallWindowProcA( + lResult = CallWindowProc( reinterpret_cast<WNDPROC>(pImpl->m_pfnOldDlgProc), hWnd,wMessage,wParam,lParam); break; default: - // !!! we use CallWindowProcA - lResult = CallWindowProcA( + lResult = CallWindowProc( reinterpret_cast<WNDPROC>(pImpl->m_pfnOldDlgProc), hWnd,wMessage,wParam,lParam); break; @@ -797,12 +796,19 @@ void SAL_CALL CWinFileOpenImpl::onInitDone() m_CustomControls->Align(); m_CustomControls->SetFont( - reinterpret_cast<HFONT>(SendMessageA(m_hwndFileOpenDlg, WM_GETFONT, 0, 0))); + reinterpret_cast<HFONT>(SendMessage(m_hwndFileOpenDlg, WM_GETFONT, 0, 0))); // resume event notification that was // defered in onInitDialog m_FilePicker->resumeEventNotification(); + //#105996 let vcl know that now a system window is active + PostMessage( + HWND_BROADCAST, + RegisterWindowMessage(TEXT("SYSTEM_WINDOW_ACTIVATED")), + 0, + 0); + // call the parent function to center the // dialog to it's parent CFileOpenDialog::onInitDone(); @@ -913,9 +919,9 @@ void SAL_CALL CWinFileOpenImpl::onInitDialog(HWND hwndDlg, HWND hwndChild) { // subclass the dialog window m_pfnOldDlgProc = - reinterpret_cast<DLGPROC>( - SetWindowLong( hwndDlg, DWL_DLGPROC, - reinterpret_cast<DWORD>(SubClassFunc))); + reinterpret_cast<WNDPROC>( + SetWindowLong( hwndDlg, GWL_WNDPROC, + reinterpret_cast<LONG>(SubClassFunc))); } //----------------------------------------------------------------------------------------- @@ -952,66 +958,44 @@ void CWinFileOpenImpl::postModal(sal_Int16 nDialogResult) void SAL_CALL CWinFileOpenImpl::SetDefaultExtension() { - // !!! HACK !!! - - OSVERSIONINFOA OSVerInfo; - - OSVerInfo.dwOSVersionInfoSize = sizeof( OSVERSIONINFOA ); - GetVersionExA( &OSVerInfo ); + HWND hwndChkSaveWithExt = GetDlgItem(m_hwndFileOpenDlgChild, 100); - // if windows 95/98 - sal_Bool bIsWin9x = ( VER_PLATFORM_WIN32_WINDOWS == OSVerInfo.dwPlatformId ); - - HWND hwndChkSaveWithExt = GetDlgItem( m_hwndFileOpenDlgChild, 100 ); - - if ( hwndChkSaveWithExt ) + if (hwndChkSaveWithExt) { - uno::Any aAny = CheckboxGetState( hwndChkSaveWithExt ); - sal_Bool bChecked = *reinterpret_cast< const sal_Bool* >( aAny.getValue( ) ); + uno::Any aAny = CheckboxGetState(hwndChkSaveWithExt); + sal_Bool bChecked = *reinterpret_cast<const sal_Bool*>(aAny.getValue()); - if ( bChecked ) + if (bChecked) { - sal_uInt32 nIndex = getSelectedFilterIndex( ); + sal_uInt32 nIndex = getSelectedFilterIndex(); rtl::OUString currentFilter; - if ( nIndex > 0 ) + if (nIndex > 0) { // filter index of the base class starts with 1 - sal_Bool bRet = m_filterContainer->getFilter( nIndex - 1, currentFilter ); + sal_Bool bRet = m_filterContainer->getFilter(nIndex - 1, currentFilter); - if ( currentFilter.getLength( ) ) + if (currentFilter.getLength()) { rtl::OUString FilterExt; - m_filterContainer->getFilter( currentFilter, FilterExt ); - - sal_Int32 posOfPoint = FilterExt.indexOf( L'.' ); - const sal_Unicode* pFirstExtStart = FilterExt.getStr( ) + posOfPoint + 1; + m_filterContainer->getFilter(currentFilter, FilterExt); - sal_Int32 posOfSemiColon = FilterExt.indexOf( L';' ) - 1; - if ( posOfSemiColon < 0 ) - posOfSemiColon = FilterExt.getLength( ) - 1; + sal_Int32 posOfPoint = FilterExt.indexOf(L'.'); + const sal_Unicode* pFirstExtStart = FilterExt.getStr() + posOfPoint + 1; - FilterExt = rtl::OUString( pFirstExtStart, posOfSemiColon - posOfPoint ); + sal_Int32 posOfSemiColon = FilterExt.indexOf(L';') - 1; + if (posOfSemiColon < 0) + posOfSemiColon = FilterExt.getLength() - 1; - if ( bIsWin9x ) - { - rtl::OString tmp = rtl::OUStringToOString( FilterExt, osl_getThreadTextEncoding( ) ); + FilterExt = rtl::OUString(pFirstExtStart, posOfSemiColon - posOfPoint); - SendMessageA( m_hwndFileOpenDlg, CDM_SETDEFEXT, 0, (LPARAM)( tmp.getStr( ) ) ); - } - else - { - SendMessageW( m_hwndFileOpenDlg, CDM_SETDEFEXT, 0, (LPARAM)( FilterExt.getStr( ) ) ); - } - } + SendMessage(m_hwndFileOpenDlg, CDM_SETDEFEXT, 0, reinterpret_cast<LPARAM>(FilterExt.getStr())); + } } } else { - if ( bIsWin9x ) - SendMessageA( m_hwndFileOpenDlg, CDM_SETDEFEXT, 0, (LPARAM)"" ); - else - SendMessageW( m_hwndFileOpenDlg, CDM_SETDEFEXT, 0, (LPARAM)L""); + SendMessage(m_hwndFileOpenDlg, CDM_SETDEFEXT, 0, reinterpret_cast<LPARAM>(TEXT(""))); } } @@ -1039,7 +1023,7 @@ void SAL_CALL CWinFileOpenImpl::InitialSetDefaultName() edt1Id = cmb13; HWND hwndEdt1 = GetDlgItem(m_hwndFileOpenDlg, edt1Id); - SetWindowTextW(hwndEdt1, m_defaultName.getStr()); + SetWindowText(hwndEdt1, m_defaultName.getStr()); } m_bInitialSelChanged = sal_False; diff --git a/fpicker/source/win32/filepicker/WinFileOpenImpl.hxx b/fpicker/source/win32/filepicker/WinFileOpenImpl.hxx index ce186eadfb9e..beb7f6d6bf17 100644 --- a/fpicker/source/win32/filepicker/WinFileOpenImpl.hxx +++ b/fpicker/source/win32/filepicker/WinFileOpenImpl.hxx @@ -2,9 +2,9 @@ * * $RCSfile: WinFileOpenImpl.hxx,v $ * - * $Revision: 1.10 $ + * $Revision: 1.11 $ * - * last change: $Author: tra $ $Date: 2002-03-28 08:57:33 $ + * last change: $Author: hr $ $Date: 2003-03-25 18:04:57 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -263,12 +263,12 @@ private: void SAL_CALL InitCustomControlContainer(HWND hCustomControl); // save the control state - void SAL_CALL CacheControlState( HWND hWnd ); + void SAL_CALL CacheControlState(HWND hWnd); - void SAL_CALL SetDefaultExtension( ); - void SAL_CALL InitialSetDefaultName( ); + void SAL_CALL SetDefaultExtension(); + void SAL_CALL InitialSetDefaultName(); - static unsigned int CALLBACK SubClassFunc( HWND hWnd, WORD wMessage, WPARAM wParam, LPARAM lParam ); + static LRESULT CALLBACK SubClassFunc(HWND hWnd, UINT wMessage, WPARAM wParam, LPARAM lParam); static BOOL CALLBACK EnumChildWndProc( HWND hWnd, LPARAM lParam ); @@ -278,7 +278,7 @@ private: std::auto_ptr<CCustomControlFactory> m_CustomControlFactory; std::auto_ptr<CCustomControl> m_CustomControls; CFilePicker* m_FilePicker; - DLGPROC m_pfnOldDlgProc; + WNDPROC m_pfnOldDlgProc; rtl::OUString m_defaultName; sal_Bool m_bInitialSelChanged; CHelpPopupWindow m_HelpPopupWindow; diff --git a/fpicker/source/win32/filepicker/controlaccess.cxx b/fpicker/source/win32/filepicker/controlaccess.cxx index b170c57b31fb..e4ba07ad02d2 100644 --- a/fpicker/source/win32/filepicker/controlaccess.cxx +++ b/fpicker/source/win32/filepicker/controlaccess.cxx @@ -2,9 +2,9 @@ * * $RCSfile: controlaccess.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: tra $ $Date: 2002-10-30 14:48:34 $ + * last change: $Author: hr $ $Date: 2003-03-25 18:04:58 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -63,6 +63,8 @@ // includes //------------------------------------------------------------------------ +#include <tchar.h> + #ifndef _OSL_DIAGNOSE_H_ #include <osl/diagnose.h> #endif @@ -261,12 +263,12 @@ CTRL_GETVALUE_FUNCTION_T SAL_CALL GetCtrlGetValueFunction( CTRL_CLASS aCtrlClass CTRL_CLASS SAL_CALL GetCtrlClass( HWND hwndCtrl ) { CTRL_CLASS aCtrlClass = UNKNOWN; - char aClassName[256]; + TCHAR aClassName[256]; - int nRet = GetClassNameA(hwndCtrl,aClassName,sizeof(aClassName)); + int nRet = GetClassName(hwndCtrl,aClassName,sizeof(aClassName)); if (nRet) { - if (0 == _stricmp(aClassName,"button")) + if (0 == _tcsicmp(aClassName,TEXT("button"))) { // button means many things so we have // to find out what button it is @@ -276,8 +278,8 @@ CTRL_CLASS SAL_CALL GetCtrlClass( HWND hwndCtrl ) else if (((lBtnStyle & BS_PUSHBUTTON) == 0) || (lBtnStyle & BS_DEFPUSHBUTTON)) aCtrlClass = PUSHBUTTON; } - else if (0 == _stricmp(aClassName,"listbox") || - 0 == _stricmp(aClassName,"combobox")) + else if (0 == _tcsicmp(aClassName,TEXT("listbox")) || + 0 == _tcsicmp(aClassName,TEXT("combobox"))) aCtrlClass = LISTBOX; } diff --git a/fpicker/source/win32/filepicker/customcontrolfactory.cxx b/fpicker/source/win32/filepicker/customcontrolfactory.cxx index 0c0387fe7ac8..8a5ecbbb41c6 100644 --- a/fpicker/source/win32/filepicker/customcontrolfactory.cxx +++ b/fpicker/source/win32/filepicker/customcontrolfactory.cxx @@ -2,9 +2,9 @@ * * $RCSfile: customcontrolfactory.cxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: tra $ $Date: 2002-03-21 07:07:40 $ + * last change: $Author: hr $ $Date: 2003-03-25 18:04:58 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -59,6 +59,8 @@ * ************************************************************************/ +#include <tchar.h> + #ifndef _CUSTOMCONTROLFACTORY_HXX_ #include "customcontrolfactory.hxx" #endif @@ -87,17 +89,17 @@ CCustomControl* CCustomControlFactory::CreateCustomControl(HWND aControlHandle, // get window class // if static text create static text control etc. - char aClsName[256]; + TCHAR aClsName[256]; ZeroMemory(aClsName,sizeof(aClsName)); - int nRet = GetClassNameA(aControlHandle,aClsName,sizeof(aClsName)); + int nRet = GetClassName(aControlHandle,aClsName,sizeof(aClsName)); - OSL_ASSERT(nRet,"Invalid window handle"); + OSL_ENSURE(nRet,"Invalid window handle"); - if (0 == _stricmp(aClsName,"button")) + if (0 == _tcsicmp(aClsName,TEXT("button"))) { // button means many things so we have // to find out what button it is - LONG lBtnStyle = GetWindowLongA(aControlHandle,GWL_STYLE); + LONG lBtnStyle = GetWindowLong(aControlHandle,GWL_STYLE); if (lBtnStyle & BS_CHECKBOX) return new CCheckboxCustomControl(aControlHandle,aParentHandle); @@ -108,10 +110,10 @@ CCustomControl* CCustomControlFactory::CreateCustomControl(HWND aControlHandle, return new CDummyCustomControl(aControlHandle,aParentHandle); } - if (0 == _stricmp(aClsName,"listbox") || 0 == _stricmp(aClsName,"combobox")) + if (0 == _tcsicmp(aClsName,TEXT("listbox")) || 0 == _tcsicmp(aClsName,TEXT("combobox"))) return new CComboboxCustomControl(aControlHandle,aParentHandle); - if (0 == _stricmp(aClsName,"static")) + if (0 == _tcsicmp(aClsName,TEXT("static"))) return new CStaticCustomControl(aControlHandle,aParentHandle); return new CDummyCustomControl(aControlHandle,aParentHandle); diff --git a/fpicker/source/win32/filepicker/dialogcustomcontrols.cxx b/fpicker/source/win32/filepicker/dialogcustomcontrols.cxx index c4aa116207e1..9b211180e2b4 100644 --- a/fpicker/source/win32/filepicker/dialogcustomcontrols.cxx +++ b/fpicker/source/win32/filepicker/dialogcustomcontrols.cxx @@ -2,9 +2,9 @@ * * $RCSfile: dialogcustomcontrols.cxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: tra $ $Date: 2002-03-21 07:07:52 $ + * last change: $Author: hr $ $Date: 2003-03-25 18:04:58 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -83,7 +83,7 @@ CDialogCustomControlBase::CDialogCustomControlBase(HWND aControlHandle, HWND aPa void SAL_CALL CDialogCustomControlBase::SetFont(HFONT hFont) { - SendMessageA( + SendMessage( m_CustomControlHandle, WM_SETFONT, (WPARAM)hFont, diff --git a/fpicker/source/win32/filepicker/dibpreview.cxx b/fpicker/source/win32/filepicker/dibpreview.cxx index 78c1fa5895b6..e118dfb79f5d 100644 --- a/fpicker/source/win32/filepicker/dibpreview.cxx +++ b/fpicker/source/win32/filepicker/dibpreview.cxx @@ -2,9 +2,9 @@ * * $RCSfile: dibpreview.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: hro $ $Date: 2002-08-15 08:41:39 $ + * last change: $Author: hr $ $Date: 2003-03-25 18:04:58 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -63,6 +63,8 @@ // includes //------------------------------------------------------------------------ +#include <tchar.h> + #ifndef _DIBPREVIEW_HXX_ #include "dibpreview.hxx" #endif @@ -98,14 +100,14 @@ using rtl::OUString; namespace /* private */ { - const char* CURRENT_INSTANCE = "CurrInst"; + const LPTSTR CURRENT_INSTANCE = TEXT("CurrInst"); }; //------------------------------------------------------------------------ // defines //------------------------------------------------------------------------ -#define PREVIEWWND_CLASS_NAME L"DIBPreviewWnd###" +#define PREVIEWWND_CLASS_NAME TEXT("DIBPreviewWnd###") // means 3 pixel left and 3 pixel right #define HORZ_BODER_SPACE 6 @@ -135,8 +137,10 @@ CDIBPreview::CDIBPreview(HINSTANCE instance,HWND parent,sal_Bool bShowWindow) : if (bShowWindow) dwStyle |= WS_VISIBLE; - m_Hwnd = CreateWindowExW( - WS_EX_CLIENTEDGE, PREVIEWWND_CLASS_NAME, L"", + m_Hwnd = CreateWindowEx( + WS_EX_CLIENTEDGE, + PREVIEWWND_CLASS_NAME, + TEXT(""), dwStyle, 0, 0, 0, 0, parent, @@ -387,7 +391,7 @@ LRESULT CALLBACK CDIBPreview::WndProc( OSL_ASSERT(lpcs->lpCreateParams); // connect the instance handle to the window - SetPropA(hWnd,CURRENT_INSTANCE,lpcs->lpCreateParams); + SetProp(hWnd, CURRENT_INSTANCE, lpcs->lpCreateParams); } break; @@ -397,7 +401,7 @@ LRESULT CALLBACK CDIBPreview::WndProc( { // RemoveProp returns the saved value on success CDIBPreview* pImpl = reinterpret_cast<CDIBPreview*>( - RemovePropA(hWnd,CURRENT_INSTANCE)); + RemoveProp(hWnd, CURRENT_INSTANCE)); OSL_ASSERT(pImpl); } @@ -406,7 +410,7 @@ LRESULT CALLBACK CDIBPreview::WndProc( case WM_PAINT: { CDIBPreview* pImpl = reinterpret_cast<CDIBPreview*>( - GetPropA(hWnd,CURRENT_INSTANCE)); + GetProp(hWnd, CURRENT_INSTANCE)); OSL_ASSERT(pImpl); @@ -426,7 +430,7 @@ LRESULT CALLBACK CDIBPreview::WndProc( break; default: - return DefWindowProcA( hWnd, uMsg, wParam, lParam ); + return DefWindowProc(hWnd, uMsg, wParam, lParam); } return lResult; @@ -443,10 +447,10 @@ ATOM SAL_CALL CDIBPreview::RegisterDibPreviewWindowClass() if (0 == s_ClassAtom) { // register the preview window class - WNDCLASSEXW wndClsEx; - ZeroMemory(&wndClsEx, sizeof(WNDCLASSEXW)); + WNDCLASSEX wndClsEx; + ZeroMemory(&wndClsEx, sizeof(wndClsEx)); - wndClsEx.cbSize = sizeof(WNDCLASSEXW); + wndClsEx.cbSize = sizeof(wndClsEx); wndClsEx.style = CS_HREDRAW | CS_VREDRAW; wndClsEx.lpfnWndProc = CDIBPreview::WndProc; wndClsEx.hInstance = m_Instance; @@ -458,7 +462,7 @@ ATOM SAL_CALL CDIBPreview::RegisterDibPreviewWindowClass() // if the dll is unloaded // Win2000 - the window class must be unregistered manually // if the dll is unloaded - s_ClassAtom = RegisterClassExW(&wndClsEx); + s_ClassAtom = RegisterClassEx(&wndClsEx); OSL_POSTCOND(s_ClassAtom,"Could not register preview window class"); diff --git a/fpicker/source/win32/filepicker/filepickerstate.cxx b/fpicker/source/win32/filepicker/filepickerstate.cxx index a5934479d7eb..f855490d3d7d 100644 --- a/fpicker/source/win32/filepicker/filepickerstate.cxx +++ b/fpicker/source/win32/filepicker/filepickerstate.cxx @@ -2,9 +2,9 @@ * * $RCSfile: filepickerstate.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: tra $ $Date: 2002-07-29 11:53:17 $ + * last change: $Author: hr $ $Date: 2003-03-25 18:04:59 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -532,7 +532,7 @@ void SAL_CALL CExecuteFilePickerState::setLabel( sal_Int16 aControlId, const OUS // somewhat risky because we don't know if OUString // has a terminating '\0' - SetWindowTextW( hwndCtrl, aWinLabel.getStr( ) ); + SetWindowText( hwndCtrl, aWinLabel.getStr( ) ); } //--------------------------------------------- @@ -549,7 +549,7 @@ OUString SAL_CALL CExecuteFilePickerState::getLabel( sal_Int16 aControlId ) hwndCtrl = GetListboxLabelItem( aControlId ); sal_Unicode aLabel[MAX_LABEL]; - int nRet = GetWindowTextW( hwndCtrl, aLabel, MAX_LABEL ); + int nRet = GetWindowText( hwndCtrl, aLabel, MAX_LABEL ); OUString ctrlLabel; if ( nRet ) diff --git a/fpicker/source/win32/filepicker/fps.xml b/fpicker/source/win32/filepicker/fps.xml index 49b66a523f05..93530780956b 100644 --- a/fpicker/source/win32/filepicker/fps.xml +++ b/fpicker/source/win32/filepicker/fps.xml @@ -29,18 +29,13 @@ <type> com.sun.star.ui.dialogs.ListboxControlActions </type> <type> com.sun.star.ui.dialogs.TemplateDescription </type> <type> com.sun.star.ui.dialogs.FilePreviewImageFormats </type> - <type> com.sun.star.ui.dialogs.ControlActions </type> <type> com.sun.star.util.XCancellable </type> - <type> com.sun.star.lang.XSingleComponentFactory </type> + <type> com.sun.star.lang.XComponent </type> <type> com.sun.star.lang.XMultiServiceFactory </type> <type> com.sun.star.lang.XSingleServiceFactory </type> <type> com.sun.star.lang.XServiceInfo </type> <type> com.sun.star.lang.XTypeProvider </type> <type> com.sun.star.lang.IllegalArgumentException </type> - <type> com.sun.star.lang.XComponent </type> - <type> com.sun.star.lang.XInitialization </type> - <type> com.sun.star.lang.DisposedException </type> - <type> com.sun.star.uno.XComponentContext </type> <type> com.sun.star.uno.TypeClass </type> <type> com.sun.star.uno.XWeak </type> <type> com.sun.star.uno.XAggregation </type> diff --git a/fpicker/source/win32/filepicker/getfilenamewrapper.cxx b/fpicker/source/win32/filepicker/getfilenamewrapper.cxx index f0f209b2d41d..ab4ab3f5f2de 100644 --- a/fpicker/source/win32/filepicker/getfilenamewrapper.cxx +++ b/fpicker/source/win32/filepicker/getfilenamewrapper.cxx @@ -2,9 +2,9 @@ * * $RCSfile: getfilenamewrapper.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: hro $ $Date: 2002-08-15 08:44:17 $ + * last change: $Author: hr $ $Date: 2003-03-25 18:04:59 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -84,7 +84,7 @@ namespace /* private */ struct GetFileNameParam { - GetFileNameParam(bool bOpen, LPOPENFILENAMEW lpofn) : + GetFileNameParam(bool bOpen, LPOPENFILENAME lpofn) : m_bOpen(bOpen), m_lpofn(lpofn), m_bRet(false), @@ -92,7 +92,7 @@ namespace /* private */ {} bool m_bOpen; - LPOPENFILENAMEW m_lpofn; + LPOPENFILENAME m_lpofn; bool m_bRet; int m_ExtErr; }; @@ -107,9 +107,9 @@ namespace /* private */ reinterpret_cast<GetFileNameParam*>(pParam); if (lpgfnp->m_bOpen) - lpgfnp->m_bRet = GetOpenFileNameW(lpgfnp->m_lpofn); + lpgfnp->m_bRet = GetOpenFileName(lpgfnp->m_lpofn); else - lpgfnp->m_bRet = GetSaveFileNameW(lpgfnp->m_lpofn); + lpgfnp->m_bRet = GetSaveFileName(lpgfnp->m_lpofn); lpgfnp->m_ExtErr = CommDlgExtendedError(); @@ -121,7 +121,7 @@ namespace /* private */ // a separat thread //----------------------------------------------- - bool ThreadExecGetFileName(LPOPENFILENAMEW lpofn, bool bOpen, /*out*/ int& ExtErr) + bool ThreadExecGetFileName(LPOPENFILENAME lpofn, bool bOpen, /*out*/ int& ExtErr) { GetFileNameParam gfnp(bOpen,lpofn); unsigned id; @@ -174,7 +174,7 @@ CGetFileNameWrapper::CGetFileNameWrapper() : // //----------------------------------------------- -bool CGetFileNameWrapper::getOpenFileName(LPOPENFILENAMEW lpofn) +bool CGetFileNameWrapper::getOpenFileName(LPOPENFILENAME lpofn) { OSL_PRECOND(lpofn,"invalid parameter"); @@ -187,7 +187,7 @@ bool CGetFileNameWrapper::getOpenFileName(LPOPENFILENAMEW lpofn) } else { - bRet = GetOpenFileNameW(lpofn); + bRet = GetOpenFileName(lpofn); m_ExtendedDialogError = CommDlgExtendedError(); } @@ -198,7 +198,7 @@ bool CGetFileNameWrapper::getOpenFileName(LPOPENFILENAMEW lpofn) // //----------------------------------------------- -bool CGetFileNameWrapper::getSaveFileName(LPOPENFILENAMEW lpofn) +bool CGetFileNameWrapper::getSaveFileName(LPOPENFILENAME lpofn) { OSL_PRECOND(lpofn,"invalid parameter"); @@ -211,7 +211,7 @@ bool CGetFileNameWrapper::getSaveFileName(LPOPENFILENAMEW lpofn) } else { - bRet = GetSaveFileNameW(lpofn); + bRet = GetSaveFileName(lpofn); m_ExtendedDialogError = CommDlgExtendedError(); } diff --git a/fpicker/source/win32/filepicker/getfilenamewrapper.hxx b/fpicker/source/win32/filepicker/getfilenamewrapper.hxx index ab7d97c13319..e20bee0cdd2c 100644 --- a/fpicker/source/win32/filepicker/getfilenamewrapper.hxx +++ b/fpicker/source/win32/filepicker/getfilenamewrapper.hxx @@ -2,9 +2,9 @@ * * $RCSfile: getfilenamewrapper.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: hro $ $Date: 2002-08-15 08:44:17 $ + * last change: $Author: hr $ $Date: 2003-03-25 18:04:59 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -85,8 +85,8 @@ class CGetFileNameWrapper public: CGetFileNameWrapper(); - bool getOpenFileName(LPOPENFILENAMEW lpofn); - bool getSaveFileName(LPOPENFILENAMEW lpofn); + bool getOpenFileName(LPOPENFILENAME lpofn); + bool getSaveFileName(LPOPENFILENAME lpofn); int commDlgExtendedError(); private: diff --git a/fpicker/source/win32/filepicker/helppopupwindow.cxx b/fpicker/source/win32/filepicker/helppopupwindow.cxx index 3d0fa3559239..f7b2779386ca 100644 --- a/fpicker/source/win32/filepicker/helppopupwindow.cxx +++ b/fpicker/source/win32/filepicker/helppopupwindow.cxx @@ -2,9 +2,9 @@ * * $RCSfile: helppopupwindow.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: tra $ $Date: 2001-09-05 13:32:17 $ + * last change: $Author: hr $ $Date: 2003-03-25 18:05:00 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -63,6 +63,8 @@ // includes //------------------------------------------------------------------------ +#include <tchar.h> + #ifndef _HELPPOPUPWINDOW_HXX_ #include "helppopupwindow.hxx" #endif @@ -85,7 +87,7 @@ using osl::Mutex; namespace /* private */ { - const char* CURRENT_INSTANCE = "CurrInst"; + const LPTSTR CURRENT_INSTANCE = TEXT("CurrInst"); }; @@ -93,7 +95,7 @@ namespace /* private */ // defines //------------------------------------------------------------------------ -#define HELPPOPUPWND_CLASS_NAME L"hlppopupwnd###" +#define HELPPOPUPWND_CLASS_NAME TEXT("hlppopupwnd###") const sal_Int32 MAX_CHARS_PER_LINE = 55; @@ -185,7 +187,7 @@ void SAL_CALL CHelpPopupWindow::show( sal_Int32 x, sal_Int32 y ) // window, then we calculate the upper left corner // and the dimensions and resize the window - m_hwnd = CreateWindowExW( + m_hwnd = CreateWindowEx( NULL, HELPPOPUPWND_CLASS_NAME, NULL, @@ -246,7 +248,7 @@ void SAL_CALL CHelpPopupWindow::calcWindowRect( LPRECT lprect ) if ( m_HelpText.getLength( ) <= MAX_CHARS_PER_LINE ) nFormat |= DT_SINGLELINE; - int nRet = DrawTextW( + int nRet = DrawText( hdc, m_HelpText.getStr( ), m_HelpText.getLength( ), @@ -422,7 +424,7 @@ void SAL_CALL CHelpPopupWindow::onPaint( HWND hWnd, HDC hdc ) if ( m_HelpText.getLength( ) <= MAX_CHARS_PER_LINE ) nFormat |= DT_SINGLELINE; - DrawTextW( + DrawText( hdc, (LPWSTR)m_HelpText.getStr( ), m_HelpText.getLength( ), @@ -528,7 +530,7 @@ LRESULT CALLBACK CHelpPopupWindow::WndProc( lpcs->lpCreateParams ); // connect the instance handle to the window - SetPropA( hWnd, CURRENT_INSTANCE, pImpl ); + SetProp( hWnd, CURRENT_INSTANCE, pImpl ); pImpl->onCreate( hWnd ); @@ -540,7 +542,7 @@ LRESULT CALLBACK CHelpPopupWindow::WndProc( case WM_PAINT: { CHelpPopupWindow* pImpl = reinterpret_cast< CHelpPopupWindow* >( - GetPropA( hWnd, CURRENT_INSTANCE ) ); + GetProp( hWnd, CURRENT_INSTANCE ) ); OSL_ASSERT( pImpl ); @@ -556,7 +558,7 @@ LRESULT CALLBACK CHelpPopupWindow::WndProc( { // RemoveProp returns the saved value on success CHelpPopupWindow* pImpl = reinterpret_cast< CHelpPopupWindow* >( - RemovePropA( hWnd, CURRENT_INSTANCE ) ); + RemoveProp( hWnd, CURRENT_INSTANCE ) ); OSL_ASSERT( pImpl ); @@ -574,7 +576,7 @@ LRESULT CALLBACK CHelpPopupWindow::WndProc( break; default: - return DefWindowProcA(hWnd, uMsg, wParam, lParam); + return DefWindowProc(hWnd, uMsg, wParam, lParam); } return lResult; @@ -591,11 +593,11 @@ ATOM SAL_CALL CHelpPopupWindow::RegisterWindowClass( ) if ( 0 == s_ClassAtom ) { // register the window class - WNDCLASSEXW wndClsEx; + WNDCLASSEX wndClsEx; - ZeroMemory( &wndClsEx, sizeof( WNDCLASSEXW ) ); + ZeroMemory(&wndClsEx, sizeof(wndClsEx)); - wndClsEx.cbSize = sizeof( WNDCLASSEXW ); + wndClsEx.cbSize = sizeof(wndClsEx); wndClsEx.lpfnWndProc = CHelpPopupWindow::WndProc; wndClsEx.hInstance = m_hInstance; wndClsEx.hCursor = LoadCursor(NULL, IDC_ARROW); @@ -607,14 +609,14 @@ ATOM SAL_CALL CHelpPopupWindow::RegisterWindowClass( ) // if the dll is unloaded // Win2000 - the window class must be unregistered manually // if the dll is unloaded - s_ClassAtom = RegisterClassExW( &wndClsEx ); - OSL_ASSERT( s_ClassAtom ); + s_ClassAtom = RegisterClassEx( &wndClsEx ); + OSL_ASSERT(s_ClassAtom); } // increment the register class counter // so that we keep track of the number // of class registrations - if ( 0 != s_ClassAtom ) + if (0 != s_ClassAtom) s_RegisterWndClassCount++; return s_ClassAtom; diff --git a/fpicker/source/win32/filepicker/makefile.mk b/fpicker/source/win32/filepicker/makefile.mk index 88f39fcad1c0..bc4b7ddf4e10 100644 --- a/fpicker/source/win32/filepicker/makefile.mk +++ b/fpicker/source/win32/filepicker/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.8 $ +# $Revision: 1.9 $ # -# last change: $Author: jbu $ $Date: 2002-10-01 08:53:46 $ +# last change: $Author: hr $ $Date: 2003-03-25 18:05:00 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -77,7 +77,7 @@ COMPRDB=$(SOLARBINDIR)$/types.rdb .INCLUDE : ..$/..$/cppumaker.mk -CFLAGS+=-GX -GR -D_WIN32_WINNT=0x0500 +CFLAGS+=-GX -GR -D_WIN32_WINNT=0x0500 -D_UNICODE -DUNICODE # --- Resources ---------------------------------------------------- diff --git a/fpicker/source/win32/filepicker/previewadapter.cxx b/fpicker/source/win32/filepicker/previewadapter.cxx index e25f41775aa7..d08cdc5ae230 100644 --- a/fpicker/source/win32/filepicker/previewadapter.cxx +++ b/fpicker/source/win32/filepicker/previewadapter.cxx @@ -2,9 +2,9 @@ * * $RCSfile: previewadapter.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: tra $ $Date: 2002-03-28 08:57:33 $ + * last change: $Author: hr $ $Date: 2003-03-25 18:05:01 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -59,6 +59,8 @@ * ************************************************************************/ +#include <tchar.h> + #ifndef _PREVIEWADAPTER_HXX_ #include "previewadapter.hxx" #endif @@ -118,11 +120,11 @@ public: // parent notification handler //------------------------------------- - virtual void SAL_CALL notifyParentShow(bool bShow); + virtual void SAL_CALL notifyParentShow(sal_Bool bShow); virtual void SAL_CALL notifyParentSizeChanged(); - virtual void SAL_CALL notifyParentWindowPosChanged(bool bIsVisible); + virtual void SAL_CALL notifyParentWindowPosChanged(sal_Bool bIsVisible); protected: virtual void SAL_CALL calcRightMargin(); @@ -280,7 +282,7 @@ void SAL_CALL CPreviewAdapterImpl::calcRightMargin() // //----------------------------------------- -void SAL_CALL CPreviewAdapterImpl::notifyParentShow(bool bShow) +void SAL_CALL CPreviewAdapterImpl::notifyParentShow(sal_Bool bShow) { } @@ -297,7 +299,7 @@ void SAL_CALL CPreviewAdapterImpl::notifyParentSizeChanged() // //----------------------------------------- -void SAL_CALL CPreviewAdapterImpl::notifyParentWindowPosChanged(bool bIsVisible) +void SAL_CALL CPreviewAdapterImpl::notifyParentWindowPosChanged(sal_Bool bIsVisible) { } @@ -345,7 +347,7 @@ void SAL_CALL CPreviewAdapterImpl::rearrangeLayout() // to the WM_SHOWWINDOW message, somehow the WS_VISIBLE // style bit of the FileOpen dialog must be set after that // message - LONG lStyle = GetWindowLongA(prvwnd,GWL_STYLE); + LONG lStyle = GetWindowLong(prvwnd,GWL_STYLE); BOOL bIsVisible = (BOOL)(lStyle & WS_VISIBLE); int cx = 0; @@ -453,7 +455,7 @@ class CWin98PreviewAdapterImpl : public CPreviewAdapterImpl public: CWin98PreviewAdapterImpl(HINSTANCE instance); - virtual void SAL_CALL notifyParentWindowPosChanged(bool bIsVisible); + virtual void SAL_CALL notifyParentWindowPosChanged(sal_Bool bIsVisible); protected: virtual void SAL_CALL rearrangeLayout(); @@ -486,7 +488,7 @@ CWin98PreviewAdapterImpl::CWin98PreviewAdapterImpl(HINSTANCE instance) : // //-------------------------------------------- -void SAL_CALL CWin98PreviewAdapterImpl::notifyParentWindowPosChanged(bool bIsVisible) +void SAL_CALL CWin98PreviewAdapterImpl::notifyParentWindowPosChanged(sal_Bool bIsVisible) { try { @@ -555,7 +557,7 @@ void SAL_CALL CWin98PreviewAdapterImpl::rearrangeLayout() if (isValidToolbarDimension()) { HWND hwndTlb = FindWindowEx( - m_FileDialog,NULL,"ToolbarWindow32",NULL); + m_FileDialog,NULL,TEXT("ToolbarWindow32"),NULL); SetWindowPos(hwndTlb, HWND_TOP, @@ -593,7 +595,7 @@ class CWin95NTPreviewAdapterImpl : public CPreviewAdapterImpl public: CWin95NTPreviewAdapterImpl(HINSTANCE instance); - virtual void SAL_CALL notifyParentShow(bool bShow); + virtual void SAL_CALL notifyParentShow(sal_Bool bShow); }; //-------------------------------------------- @@ -609,7 +611,7 @@ CWin95NTPreviewAdapterImpl::CWin95NTPreviewAdapterImpl(HINSTANCE instance) : // //-------------------------------------------- -void SAL_CALL CWin95NTPreviewAdapterImpl::notifyParentShow(bool bShow) +void SAL_CALL CWin95NTPreviewAdapterImpl::notifyParentShow(sal_Bool bShow) { try { @@ -727,7 +729,7 @@ void SAL_CALL CPreviewAdapter::setParent(HWND parent) // //------------------------------- -void SAL_CALL CPreviewAdapter::notifyParentShow(bool bShow) +void SAL_CALL CPreviewAdapter::notifyParentShow(sal_Bool bShow) { m_pImpl->notifyParentShow(bShow); } @@ -745,7 +747,7 @@ void SAL_CALL CPreviewAdapter::notifyParentSizeChanged() // //------------------------------- -void SAL_CALL CPreviewAdapter::notifyParentWindowPosChanged(bool bIsVisible) +void SAL_CALL CPreviewAdapter::notifyParentWindowPosChanged(sal_Bool bIsVisible) { m_pImpl->notifyParentWindowPosChanged(bIsVisible); } diff --git a/fpicker/source/win32/filepicker/previewadapter.hxx b/fpicker/source/win32/filepicker/previewadapter.hxx index bb21e5ba9f4a..dbb479f2fcd0 100644 --- a/fpicker/source/win32/filepicker/previewadapter.hxx +++ b/fpicker/source/win32/filepicker/previewadapter.hxx @@ -2,9 +2,9 @@ * * $RCSfile: previewadapter.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: tra $ $Date: 2002-03-28 08:57:33 $ + * last change: $Author: hr $ $Date: 2003-03-25 18:05:01 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -128,11 +128,11 @@ public: // notification from parent //-------------------------------------- - void SAL_CALL notifyParentShow(bool bShow); + void SAL_CALL notifyParentShow(sal_Bool bShow); void SAL_CALL notifyParentSizeChanged(); - void SAL_CALL notifyParentWindowPosChanged(bool bIsVisible); + void SAL_CALL notifyParentWindowPosChanged(sal_Bool bIsVisible); private: // hide implementation details using the diff --git a/fpicker/source/win32/filepicker/workbench/Test_fps.cxx b/fpicker/source/win32/filepicker/workbench/Test_fps.cxx index 930cfcc4a67d..45e07bd616f3 100644 --- a/fpicker/source/win32/filepicker/workbench/Test_fps.cxx +++ b/fpicker/source/win32/filepicker/workbench/Test_fps.cxx @@ -2,9 +2,9 @@ * * $RCSfile: Test_fps.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: tra $ $Date: 2002-11-26 10:00:09 $ + * last change: $Author: hr $ $Date: 2003-03-25 18:05:05 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -173,7 +173,7 @@ using namespace std ; void TestFilterManager( Reference< XFilePicker > xFilePicker ); -#define RDB_SYSPATH "D:\\Projects\\SRX644\\fpicker\\wntmsci9\\bin\\applicat.rdb" +#define RDB_SYSPATH "D:\\Projects\\gsl\\sysui\\wntmsci7\\bin\\applicat.rdb" //_________________________________________________________________________________________________________________________ // global variables @@ -294,56 +294,7 @@ void SAL_CALL FilePickerListener::directoryChanged( const ::com::sun::star::ui:: OUString SAL_CALL FilePickerListener::helpRequested( const ::com::sun::star::ui::dialogs::FilePickerEvent& aEvent ) throw(::com::sun::star::uno::RuntimeException) { - OUString aHelpText; - - switch ( aEvent.ElementId ) - { - case CHECKBOX_AUTOEXTENSION: - aHelpText = OUString( L"Automatische Dateinamenserweiterung" ); - break; - - case CHECKBOX_PASSWORD: - aHelpText = OUString( L"Password" ); - break; - - case CHECKBOX_FILTEROPTIONS: - aHelpText = OUString( L"Filteroptionen" ); - break; - - case CHECKBOX_READONLY: - aHelpText = OUString( L"Nur lesbar" ); - break; - - case CHECKBOX_LINK: - aHelpText = OUString( L"Link" ); - break; - - case CHECKBOX_PREVIEW: - aHelpText = OUString( L"Vorschau" ); - break; - - case PUSHBUTTON_PLAY: - aHelpText = OUString( L"Abspielen" ); - break; - - case LISTBOX_VERSION: - aHelpText = OUString( L"Dokumentenversion" ); - break; - - case LISTBOX_TEMPLATE: - aHelpText = OUString( L"Vorlage" ); - break; - - case LISTBOX_IMAGE_TEMPLATE: - aHelpText = OUString( L"Bildvorlage" ); - break; - - case CHECKBOX_SELECTION: - aHelpText = OUString( L"Selektion" ); - break; - } - - return aHelpText; + return OUString( ); } void SAL_CALL FilePickerListener::controlStateChanged( const ::com::sun::star::ui::dialogs::FilePickerEvent& aEvent ) @@ -414,7 +365,7 @@ int SAL_CALL main(int nArgc, char* Argv[], char* Env[] ) //------------------------------------------------- Sequence< Any > arguments(1); - arguments[0] = makeAny( FILEOPEN_SIMPLE ); + //arguments[0] = makeAny( FILEOPEN_SIMPLE ); //arguments[0] = makeAny( FILESAVE_SIMPLE ); //arguments[0] = makeAny( FILESAVE_AUTOEXTENSION_PASSWORD ); //arguments[0] = makeAny( FILESAVE_AUTOEXTENSION_PASSWORD_FILTEROPTIONS ); @@ -422,14 +373,12 @@ int SAL_CALL main(int nArgc, char* Argv[], char* Env[] ) //arguments[0] = makeAny( FILESAVE_AUTOEXTENSION_TEMPLATE ); //arguments[0] = makeAny( FILEOPEN_LINK_PREVIEW_IMAGE_TEMPLATE ); //arguments[0] = makeAny( FILEOPEN_PLAY ); - //arguments[0] = makeAny( FILEOPEN_READONLY_VERSION ); - //arguments[0] = makeAny( FILESAVE_AUTOEXTENSION ); - + arguments[0] = makeAny( FILEOPEN_READONLY_VERSION ); Reference< XFilePicker > xFilePicker = Reference< XFilePicker >( g_xFactory->createInstanceWithArguments( OUString::createFromAscii( FILE_PICKER_SERVICE_NAME ), arguments ), UNO_QUERY ); -/* + // install a FilePicker notifier Reference< XFilePickerListener > xFPListener( static_cast< XFilePickerListener* >( new FilePickerListener()), UNO_QUERY ); @@ -455,10 +404,9 @@ int SAL_CALL main(int nArgc, char* Argv[], char* Env[] ) xFilterMgr->appendFilter( L"SDW", L"*.sdw;*.sdc;*.sdi" ); xFilterMgr->appendFilter( L"SXW", L"*.sxw;*.sxi" ); } -*/ + Reference< XFilePickerControlAccess > xFPControlAccess( xFilePicker, UNO_QUERY ); - /* Any aAny; sal_Bool bChkState = sal_False; @@ -470,13 +418,9 @@ int SAL_CALL main(int nArgc, char* Argv[], char* Env[] ) xFPControlAccess->setValue( LISTBOX_VERSION, ADD_ITEM, aAny ); xFPControlAccess->setValue( LISTBOX_VERSION, ADD_ITEM, aAny ); xFPControlAccess->setValue( LISTBOX_VERSION, ADD_ITEM, aAny ); -*/ - - xFPControlAccess->setLabel( 6, OUString::createFromAscii( "Welt" ) ); // filter label - xFPControlAccess->setLabel( 7, OUString::createFromAscii( "Hallo" ) ); // file name label xFilePicker->execute( ); -/* + sal_Bool bCheckState; aAny = xFPControlAccess->getValue( CHECKBOX_AUTOEXTENSION, 0 ); if ( aAny.hasValue( ) ) @@ -500,7 +444,7 @@ int SAL_CALL main(int nArgc, char* Argv[], char* Env[] ) if ( xFPNotifier.is( ) ) xFPNotifier->removeFilePickerListener( xFPListener ); -*/ + //-------------------------------------------------- // shutdown //-------------------------------------------------- diff --git a/fpicker/source/win32/filepicker/workbench/makefile.mk b/fpicker/source/win32/filepicker/workbench/makefile.mk index 1830d159d2f5..aa5348bf01a0 100644 --- a/fpicker/source/win32/filepicker/workbench/makefile.mk +++ b/fpicker/source/win32/filepicker/workbench/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.1 $ +# $Revision: 1.2 $ # -# last change: $Author: tra $ $Date: 2001-06-28 11:14:36 $ +# last change: $Author: hr $ $Date: 2003-03-25 18:05:05 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -73,7 +73,7 @@ TARGETTYPE=CUI .INCLUDE : ..$/..$/..$/cppumaker.mk -CFLAGS+=/GR /GX +CFLAGS+=-GR -GX # --- Files -------------------------------------------------------- diff --git a/fpicker/source/win32/folderpicker/MtaFop.cxx b/fpicker/source/win32/folderpicker/MtaFop.cxx index 412f5ccc5c9b..540d451960c6 100644 --- a/fpicker/source/win32/folderpicker/MtaFop.cxx +++ b/fpicker/source/win32/folderpicker/MtaFop.cxx @@ -2,9 +2,9 @@ * * $RCSfile: MtaFop.cxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: hro $ $Date: 2002-08-14 15:45:01 $ + * last change: $Author: hr $ $Date: 2003-03-25 18:05:05 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -133,6 +133,23 @@ namespace OSL_ASSERT( aRequestContext && aRequestContext->hEvent ); CloseHandle( aRequestContext->hEvent ); } + + //------------------------------- + // Determine if current thread is + // an MTA or STA thread + //------------------------------- + bool IsMTA() + { + HRESULT hr = CoInitialize(NULL); + + if (RPC_E_CHANGED_MODE == hr) + return true; + + if(SUCCEEDED(hr)) + CoUninitialize(); + + return false; + } } //---------------------------------------------------------------- @@ -276,70 +293,80 @@ CMtaFolderPicker::~CMtaFolderPicker( ) sal_Bool CMtaFolderPicker::browseForFolder( ) { - OSL_ASSERT( m_hEvtThrdReady ); + sal_Bool bRet = sal_False; - if ( WaitForSingleObject( m_hEvtThrdReady, MAX_WAITTIME ) != WAIT_OBJECT_0 ) + if (IsMTA()) { - OSL_ENSURE( sal_False, "sta thread not ready" ); - return sal_False; - } - RequestContext aReqCtx; + OSL_ASSERT( m_hEvtThrdReady ); - if ( !InitializeRequestContext( &aReqCtx ) ) - { - OSL_ASSERT( sal_False ); - return sal_False; - } + if ( WaitForSingleObject( m_hEvtThrdReady, MAX_WAITTIME ) != WAIT_OBJECT_0 ) + { + OSL_ENSURE( sal_False, "sta thread not ready" ); + return sal_False; + } - // marshall request into the sta thread - PostMessageA( - m_hwndStaRequestWnd, - MSG_BROWSEFORFOLDER, - 0, - reinterpret_cast< LPARAM >( &aReqCtx ) ); + RequestContext aReqCtx; - // waiting for the event to be signaled or - // window messages so that we don't block - // our parent window + if ( !InitializeRequestContext( &aReqCtx ) ) + { + OSL_ASSERT( sal_False ); + return sal_False; + } - sal_Bool bContinue = sal_True; + // marshall request into the sta thread + PostMessageA( + m_hwndStaRequestWnd, + MSG_BROWSEFORFOLDER, + 0, + reinterpret_cast< LPARAM >( &aReqCtx ) ); - while ( bContinue ) - { - DWORD dwResult = MsgWaitForMultipleObjects( - 1, &aReqCtx.hEvent, FALSE, INFINITE, QS_ALLEVENTS ); + // waiting for the event to be signaled or + // window messages so that we don't block + // our parent window - switch ( dwResult ) + sal_Bool bContinue = sal_True; + + while ( bContinue ) { - // the request context event is signaled - case WAIT_OBJECT_0: - bContinue = sal_False; - break; + DWORD dwResult = MsgWaitForMultipleObjects( + 1, &aReqCtx.hEvent, FALSE, INFINITE, QS_ALLEVENTS ); - // a window message has arrived - case WAIT_OBJECT_0 + 1: + switch ( dwResult ) { - // dispatching all messages but we expect to - // receive only paint or timer messages that's - // why we don't need to call TranslateMessage or - // TranslateAccelerator, because keybord or - // mouse messages are for the FolderPicker which - // is in the foreground and should not arrive here - MSG msg; - while ( PeekMessageA( &msg, NULL, 0, 0, PM_REMOVE ) ) - DispatchMessageA(&msg); + // the request context event is signaled + case WAIT_OBJECT_0: + bContinue = sal_False; + break; + + // a window message has arrived + case WAIT_OBJECT_0 + 1: + { + // dispatching all messages but we expect to + // receive only paint or timer messages that's + // why we don't need to call TranslateMessage or + // TranslateAccelerator, because keybord or + // mouse messages are for the FolderPicker which + // is in the foreground and should not arrive here + MSG msg; + while ( PeekMessageA( &msg, NULL, 0, 0, PM_REMOVE ) ) + DispatchMessageA(&msg); + } + break; + + // should not happen + default: + OSL_ASSERT( sal_False ); } - break; - - // should not happen - default: - OSL_ASSERT( sal_False ); } - } - sal_Bool bRet = aReqCtx.bRet; - DeinitializeRequestContext( &aReqCtx ); + /*sal_Bool*/ bRet = aReqCtx.bRet; + DeinitializeRequestContext( &aReqCtx ); + } + else + { + bRet = onBrowseForFolder(); + } return bRet; } diff --git a/fpicker/source/win32/folderpicker/makefile.mk b/fpicker/source/win32/folderpicker/makefile.mk index eeb7c2ca9cb9..aad626402449 100644 --- a/fpicker/source/win32/folderpicker/makefile.mk +++ b/fpicker/source/win32/folderpicker/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.2 $ +# $Revision: 1.3 $ # -# last change: $Author: jbu $ $Date: 2002-10-01 08:54:35 $ +# last change: $Author: hr $ $Date: 2003-03-25 18:05:06 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -77,7 +77,7 @@ COMPRDB=$(SOLARBINDIR)$/types.rdb .INCLUDE : ..$/..$/cppumaker.mk # enable rtti -CFLAGS+=/GR +CFLAGS+=-GR SLOFILES=$(SLO)$/fopentry.obj\ $(SLO)$/folderpicker.obj\ diff --git a/fpicker/source/win32/folderpicker/workbench/makefile.mk b/fpicker/source/win32/folderpicker/workbench/makefile.mk index f1a362c9ed10..0d1ab69284fc 100644 --- a/fpicker/source/win32/folderpicker/workbench/makefile.mk +++ b/fpicker/source/win32/folderpicker/workbench/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.1 $ +# $Revision: 1.2 $ # -# last change: $Author: tra $ $Date: 2001-06-28 11:16:52 $ +# last change: $Author: hr $ $Date: 2003-03-25 18:05:06 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -75,7 +75,7 @@ TARGETTYPE= CUI .INCLUDE : ..$/..$/..$/cppumaker.mk -CFLAGS+=/GR /GX +CFLAGS+=-GR -GX # --- Files -------------------------------------------------------- diff --git a/fpicker/source/win32/misc/WinImplHelper.cxx b/fpicker/source/win32/misc/WinImplHelper.cxx index 54db5d78bfcf..c7f2999fa159 100644 --- a/fpicker/source/win32/misc/WinImplHelper.cxx +++ b/fpicker/source/win32/misc/WinImplHelper.cxx @@ -2,9 +2,9 @@ * * $RCSfile: WinImplHelper.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: hro $ $Date: 2002-08-14 15:38:20 $ + * last change: $Author: hr $ $Date: 2003-03-25 18:05:07 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -118,16 +118,11 @@ const sal_Unicode AMPERSAND_SIGN = L'&'; bool SAL_CALL IsWindowsVersion(unsigned int PlatformId, unsigned int MajorVersion, int MinorVersion = -1) { - OSVERSIONINFOEXA osvi; - osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA); + OSVERSIONINFO osvi; + osvi.dwOSVersionInfoSize = sizeof(osvi); - if(!GetVersionExA((OSVERSIONINFOA*)&osvi)) - { - // if OSVERSIONINFOEX doesn't work - osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOA); - if(!GetVersionEx((OSVERSIONINFOA*)&osvi)) - return false; - } + if(!GetVersionEx(&osvi)) + return false; bool bRet = (PlatformId == osvi.dwPlatformId) && (MajorVersion == osvi.dwMajorVersion); diff --git a/fpicker/source/win32/misc/makefile.mk b/fpicker/source/win32/misc/makefile.mk index 2e4c9a5efba8..a49e5dc07eb3 100644 --- a/fpicker/source/win32/misc/makefile.mk +++ b/fpicker/source/win32/misc/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.2 $ +# $Revision: 1.3 $ # -# last change: $Author: hjs $ $Date: 2002-06-12 10:09:15 $ +# last change: $Author: hr $ $Date: 2003-03-25 18:05:07 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -71,7 +71,7 @@ LIBTARGET=NO .INCLUDE : ..$/..$/cppumaker.mk -CFLAGS+=-GX +CFLAGS+=-GX -DUNICODE -D_UNICODE # --- Files ------------------------------------- |