[Libreoffice-commits] core.git: fpicker/source

skswales stuart.swales.croftnuisk at gmail.com
Wed Jun 22 19:52:50 UTC 2016


 fpicker/source/win32/filepicker/FileOpenDlg.cxx          |   29 +++++++-------
 fpicker/source/win32/filepicker/FilePicker.cxx           |    5 +-
 fpicker/source/win32/filepicker/PreviewCtrl.cxx          |   15 +++----
 fpicker/source/win32/filepicker/VistaFilePicker.cxx      |    1 
 fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx  |   30 +++++++--------
 fpicker/source/win32/filepicker/WinFileOpenImpl.cxx      |   10 ++---
 fpicker/source/win32/filepicker/controlaccess.cxx        |   12 ++----
 fpicker/source/win32/filepicker/customcontrolfactory.cxx |   13 +++---
 fpicker/source/win32/filepicker/dialogcustomcontrols.cxx |    2 -
 fpicker/source/win32/filepicker/dibpreview.cxx           |   19 ++++-----
 fpicker/source/win32/filepicker/filepickerstate.cxx      |    4 +-
 fpicker/source/win32/filepicker/helppopupwindow.cxx      |   27 ++++++-------
 fpicker/source/win32/filepicker/previewadapter.cxx       |    1 
 fpicker/source/win32/folderpicker/MtaFop.cxx             |    4 +-
 fpicker/source/win32/misc/WinImplHelper.cxx              |    2 -
 15 files changed, 82 insertions(+), 92 deletions(-)

New commits:
commit 6a17c118f312699ab26147148cd2e7844c41a777
Author: skswales <stuart.swales.croftnuisk at gmail.com>
Date:   Mon Jun 20 18:53:58 2016 +0100

    Work towards tdf#72606 EasyHack _tstring/TCHAR elimination
    
    fpicker module TCHAR elimination and A/W clarity
    
    NB fpicker was already being compiled as UNICODE
    
    Use SendMessageW() as appropriate for clarity
    
    Use SAL_N_ELEMENTS for buffer capacity (number of WCHAR) when retrieving class name
    
    Change-Id: Ie6d0b1df1b9a2fb18f4cdfc51e5d4c3c55c9ca17
    Reviewed-on: https://gerrit.libreoffice.org/26526
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Michael Stahl <mstahl at redhat.com>

diff --git a/fpicker/source/win32/filepicker/FileOpenDlg.cxx b/fpicker/source/win32/filepicker/FileOpenDlg.cxx
index cb57f27..5f5e4a8 100644
--- a/fpicker/source/win32/filepicker/FileOpenDlg.cxx
+++ b/fpicker/source/win32/filepicker/FileOpenDlg.cxx
@@ -17,7 +17,6 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include <tchar.h>
 #include <osl/diagnose.h>
 #include "../misc/WinImplHelper.hxx"
 #include "FileOpenDlg.hxx"
@@ -42,7 +41,7 @@ namespace /* private */
     const sal_Int32 MAX_FILETITLE_BUFF_SIZE = 32000;
     const sal_Int32 MAX_FILTER_BUFF_SIZE    = 4096;
 
-    const LPCTSTR CURRENT_INSTANCE = TEXT("CurrInst");
+    const PCWSTR CURRENT_INSTANCE = L"CurrInst";
 
 
     // find an appropriate parent window
@@ -100,10 +99,10 @@ CFileOpenDialog::CFileOpenDialog(
     // we get a parent window (using a vcl window?)
     m_ofn.hwndOwner = choose_parent_window();
 
-    m_ofn.lpstrFile = reinterpret_cast<LPTSTR>(const_cast<sal_Unicode*>(m_fileNameBuffer.getStr()));
+    m_ofn.lpstrFile = reinterpret_cast<PWSTR>(const_cast<sal_Unicode*>(m_fileNameBuffer.getStr()));
     m_ofn.nMaxFile  = m_fileNameBuffer.getCapacity();
 
-    m_ofn.lpstrFileTitle = reinterpret_cast<LPTSTR>(const_cast<sal_Unicode*>(m_fileTitleBuffer.getStr()));
+    m_ofn.lpstrFileTitle = reinterpret_cast<PWSTR>(const_cast<sal_Unicode*>(m_fileTitleBuffer.getStr()));
     m_ofn.nMaxFileTitle  = m_fileTitleBuffer.getCapacity();
 
     m_ofn.lpfnHook = CFileOpenDialog::ofnHookProc;
@@ -132,7 +131,7 @@ CFileOpenDialog::~CFileOpenDialog()
 void SAL_CALL CFileOpenDialog::setTitle(const OUString& aTitle)
 {
     m_dialogTitle = aTitle;
-    m_ofn.lpstrTitle = reinterpret_cast<LPCTSTR>(m_dialogTitle.getStr());
+    m_ofn.lpstrTitle = reinterpret_cast<PCWSTR>(m_dialogTitle.getStr());
 }
 
 
@@ -144,7 +143,7 @@ void CFileOpenDialog::setFilter(const OUString& aFilter)
     m_filterBuffer.ensureCapacity(aFilter.getLength());
     m_filterBuffer.setLength(0);
     m_filterBuffer.append(aFilter);
-    m_ofn.lpstrFilter = reinterpret_cast<LPCTSTR>(m_filterBuffer.getStr());
+    m_ofn.lpstrFilter = reinterpret_cast<PCWSTR>(m_filterBuffer.getStr());
 }
 
 
@@ -166,14 +165,14 @@ void SAL_CALL CFileOpenDialog::setDefaultName(const OUString& aName)
 {
     m_fileNameBuffer.setLength(0);
     m_fileNameBuffer.append(aName);
-    m_ofn.lpstrFile = reinterpret_cast<LPTSTR>(const_cast<sal_Unicode*>(m_fileNameBuffer.getStr()));
+    m_ofn.lpstrFile = reinterpret_cast<PWSTR>(const_cast<sal_Unicode*>(m_fileNameBuffer.getStr()));
 }
 
 
 void SAL_CALL CFileOpenDialog::setDisplayDirectory(const OUString& aDirectory)
 {
     m_displayDirectory = aDirectory;
-    m_ofn.lpstrInitialDir = reinterpret_cast<LPCTSTR>(m_displayDirectory.getStr());
+    m_ofn.lpstrInitialDir = reinterpret_cast<PCWSTR>(m_displayDirectory.getStr());
 }
 
 
@@ -209,7 +208,7 @@ OUString CFileOpenDialog::getFileExtension()
 void CFileOpenDialog::setDefaultFileExtension(const OUString& aExtension)
 {
     m_defaultExtension = aExtension;
-    m_ofn.lpstrDefExt  = reinterpret_cast<LPCTSTR>(m_defaultExtension.getStr());
+    m_ofn.lpstrDefExt  = reinterpret_cast<PCWSTR>(m_defaultExtension.getStr());
 }
 
 
@@ -287,7 +286,7 @@ OUString SAL_CALL CFileOpenDialog::getCurrentFilePath() const
 {
     OSL_ASSERT(IsWindow(m_hwndFileOpenDlg));
 
-    LPARAM nLen = SendMessage(
+    LPARAM nLen = SendMessageW(
         m_hwndFileOpenDlg,
         CDM_GETFILEPATH,
         m_helperBuffer.getCapacity(),
@@ -306,7 +305,7 @@ OUString SAL_CALL CFileOpenDialog::getCurrentFolderPath() const
 {
     OSL_ASSERT(IsWindow(m_hwndFileOpenDlg));
 
-    LPARAM nLen = SendMessage(
+    LPARAM nLen = SendMessageW(
         m_hwndFileOpenDlg,
         CDM_GETFOLDERPATH,
         m_helperBuffer.getCapacity(),
@@ -325,7 +324,7 @@ OUString SAL_CALL CFileOpenDialog::getCurrentFileName() const
 {
     OSL_ASSERT(IsWindow(m_hwndFileOpenDlg));
 
-    LPARAM nLen = SendMessage(
+    LPARAM nLen = SendMessageW(
         m_hwndFileOpenDlg,
         CDM_GETSPEC,
         m_helperBuffer.getCapacity(),
@@ -454,7 +453,7 @@ UINT_PTR CALLBACK CFileOpenDialog::ofnHookProc(
                         GWLP_WNDPROC,
                         reinterpret_cast<LONG_PTR>(CFileOpenDialog::BaseDlgProc)));
             // connect the instance handle to the window
-            SetProp(hwndDlg, CURRENT_INSTANCE, pImpl);
+            SetPropW(hwndDlg, CURRENT_INSTANCE, pImpl);
             pImpl->handleInitDialog(hwndDlg, hChildDlg);
         }
         return 0;
@@ -488,7 +487,7 @@ LRESULT CALLBACK CFileOpenDialog::BaseDlgProc(
     if (WM_NCDESTROY == wMessage)
     {
         pImpl = reinterpret_cast<CFileOpenDialog*>(
-            RemoveProp(hWnd,CURRENT_INSTANCE));
+            RemovePropW(hWnd,CURRENT_INSTANCE));
 
         SetWindowLongPtr(hWnd, GWLP_WNDPROC,
             reinterpret_cast<LONG_PTR>(pImpl->m_pfnBaseDlgProc));
@@ -510,7 +509,7 @@ CFileOpenDialog* SAL_CALL CFileOpenDialog::getCurrentInstance(HWND hwnd)
 {
     OSL_ASSERT(IsWindow( hwnd));
     return reinterpret_cast<CFileOpenDialog*>(
-        GetProp(hwnd, CURRENT_INSTANCE));
+        GetPropW(hwnd, CURRENT_INSTANCE));
 }
 
 
diff --git a/fpicker/source/win32/filepicker/FilePicker.cxx b/fpicker/source/win32/filepicker/FilePicker.cxx
index bd6083ff..88c8cdb 100644
--- a/fpicker/source/win32/filepicker/FilePicker.cxx
+++ b/fpicker/source/win32/filepicker/FilePicker.cxx
@@ -17,7 +17,6 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include <tchar.h>
 #include <com/sun/star/lang/DisposedException.hpp>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <cppuhelper/interfacecontainer.h>
@@ -43,7 +42,7 @@ using namespace com::sun::star;
 using namespace ::com::sun::star::ui::dialogs;
 using namespace ::com::sun::star::ui::dialogs::TemplateDescription;
 
-#define FILE_PICKER_DLL_NAME  TEXT("fps.dll")
+#define FILE_PICKER_DLL_NAME  L"fps.dll"
 
 
 // helper functions
@@ -69,7 +68,7 @@ CFilePicker::CFilePicker( const uno::Reference<lang::XMultiServiceFactory>& xSer
     m_xServiceMgr(xServiceMgr),
     m_aAsyncEventNotifier(rBHelper)
 {
-    HINSTANCE hInstance = GetModuleHandle(FILE_PICKER_DLL_NAME);
+    HINSTANCE hInstance = GetModuleHandleW(FILE_PICKER_DLL_NAME);
     SAL_WARN_IF( !hInstance, "fpicker", "The name of the service dll must have changed" );
 
     // create a default FileOpen dialog without any additional ui elements
diff --git a/fpicker/source/win32/filepicker/PreviewCtrl.cxx b/fpicker/source/win32/filepicker/PreviewCtrl.cxx
index 0fbb50c..a8ffc83 100644
--- a/fpicker/source/win32/filepicker/PreviewCtrl.cxx
+++ b/fpicker/source/win32/filepicker/PreviewCtrl.cxx
@@ -17,7 +17,6 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include <tchar.h>
 #include "PreviewCtrl.hxx"
 #include <osl/diagnose.h>
 
@@ -31,7 +30,7 @@
 #include <ocidl.h>
 #include <olectl.h>
 
-#define PREVIEWWND_CLASS_NAME TEXT("PreviewWnd###")
+#define PREVIEWWND_CLASS_NAME L"PreviewWnd###"
 
 #define HIMETRIC_INCH 2540
 
@@ -235,16 +234,16 @@ CFilePreview::CFilePreview(
     //               if the dll is unloaded
     //     Win2000 - the window class must be unregistered manually
     //               if the dll is unloaded
-    m_atomPrevWndClass = RegisterClassEx(&wndClsEx);
+    m_atomPrevWndClass = RegisterClassExW(&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 = CreateWindowEx(
+    m_hwnd = CreateWindowExW(
         WS_EX_CLIENTEDGE,
         PREVIEWWND_CLASS_NAME,
-        TEXT(""),
+        L"",
         dwStyle,
         ulCorner.x,
         ulCorner.y,
@@ -263,8 +262,8 @@ CFilePreview::CFilePreview(
 CFilePreview::~CFilePreview( )
 {
     // unregister preview window class
-    sal_Bool bRet = UnregisterClass(
-        (LPCTSTR)(DWORD_PTR)MAKELONG( m_atomPrevWndClass, 0 ),
+    sal_Bool bRet = UnregisterClassW(
+        (PCWSTR)(DWORD_PTR)MAKELONG( m_atomPrevWndClass, 0 ),
         m_hInstance );
     SAL_WARN_IF( !bRet, "fpicker", "Unregister preview window class failed" );
 }
@@ -469,7 +468,7 @@ sal_Bool CFilePreview::loadFile( const OUString& aFileName )
     sal_uInt32  fszExtra;
     sal_uInt32  fsize;
 
-    hFile = CreateFile(
+    hFile = CreateFileW(
         aFileName.getStr( ),
         GENERIC_READ,
         0,
diff --git a/fpicker/source/win32/filepicker/VistaFilePicker.cxx b/fpicker/source/win32/filepicker/VistaFilePicker.cxx
index 2efdad5..4b2a436 100644
--- a/fpicker/source/win32/filepicker/VistaFilePicker.cxx
+++ b/fpicker/source/win32/filepicker/VistaFilePicker.cxx
@@ -43,7 +43,6 @@
 #include <osl/diagnose.h>
 #include <osl/mutex.hxx>
 #include <osl/file.hxx>
-#include <tchar.h>
 #include <officecfg/Office/Common.hxx>
 
 #ifdef _MSC_VER
diff --git a/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx b/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx
index abb186d..1713870 100644
--- a/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx
+++ b/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx
@@ -66,7 +66,7 @@ bool createFolderItem(OUString const & url, ComPtr<IShellItem> & folder) {
     }
 #if defined __MINGW32__
     HRESULT res = SHCreateItemFromParsingName(
-        reinterpret_cast<LPCTSTR>(path.getStr()), NULL, IID_IShellItem,
+        reinterpret_cast<PCWSTR>(path.getStr()), NULL, IID_IShellItem,
         reinterpret_cast<void **>(&folder));
 #else
     HRESULT res = SHCreateItemFromParsingName(
@@ -137,8 +137,8 @@ OUString lcl_getURLFromShellItem (IShellItem* pItem)
     {
         COMDLG_FILTERSPEC aSpec;
 
-        aSpec.pszName = reinterpret_cast<LPCTSTR>(aFilter.first.getStr()) ;
-        aSpec.pszSpec = reinterpret_cast<LPCTSTR>(aFilter.second.getStr());
+        aSpec.pszName = reinterpret_cast<PCWSTR>(aFilter.first.getStr()) ;
+        aSpec.pszSpec = reinterpret_cast<PCWSTR>(aFilter.second.getStr());
 
         lList.push_back(aSpec);
     }
@@ -514,7 +514,7 @@ static void setLabelToControl(CResourceProvider& rResourceProvider, TFileDialogC
 {
     OUString aLabel = rResourceProvider.getResString(nControlId);
     aLabel = SOfficeToWindowsLabel(aLabel);
-    iCustom->SetControlLabel(nControlId, reinterpret_cast<LPCWSTR>(aLabel.getStr()) );
+    iCustom->SetControlLabel(nControlId, reinterpret_cast<PCWSTR>(aLabel.getStr()) );
 }
 
 
@@ -677,7 +677,7 @@ void VistaFilePickerImpl::impl_sta_SetTitle(const RequestRef& rRequest)
     aLock.clear();
     // <- SYNCHRONIZED
 
-    iDialog->SetTitle(reinterpret_cast<LPCTSTR>(sTitle.getStr()));
+    iDialog->SetTitle(reinterpret_cast<PCWSTR>(sTitle.getStr()));
 }
 
 
@@ -691,7 +691,7 @@ void VistaFilePickerImpl::impl_sta_SetFileName(const RequestRef& rRequest)
     aLock.clear();
     // <- SYNCHRONIZED
 
-    iDialog->SetFileName(reinterpret_cast<LPCTSTR>(sFileName.getStr()));
+    iDialog->SetFileName(reinterpret_cast<PCWSTR>(sFileName.getStr()));
 }
 
 
@@ -764,7 +764,7 @@ void VistaFilePickerImpl::impl_sta_SetDefaultName(const RequestRef& rRequest)
             sFilename = sFilename.copy(0, nSepPos);
     }
 
-    iDialog->SetFileName ( reinterpret_cast<LPCTSTR>(sFilename.getStr()));
+    iDialog->SetFileName ( reinterpret_cast<PCWSTR>(sFilename.getStr()));
     m_sFilename = sFilename;
 }
 
@@ -797,7 +797,7 @@ void VistaFilePickerImpl::impl_sta_setFiltersOnDialog()
 
     if ( bValue )
     {
-        LPCWSTR lpFilterExt = lFilters[0].pszSpec;
+        PCWSTR lpFilterExt = lFilters[0].pszSpec;
 
         lpFilterExt = wcsrchr( lpFilterExt, '.' );
         if ( lpFilterExt )
@@ -934,7 +934,7 @@ void VistaFilePickerImpl::impl_sta_ShowDialogModal(const RequestRef& rRequest)
                         ::std::vector< COMDLG_FILTERSPEC > lFilters = lcl_buildFilterList(m_lFilters);
                         if ( nRealIndex < lFilters.size() )
                         {
-                            LPCWSTR lpFilterExt = lFilters[nRealIndex].pszSpec;
+                            PCWSTR lpFilterExt = lFilters[nRealIndex].pszSpec;
 
                             lpFilterExt = wcsrchr( lpFilterExt, '.' );
                             if ( lpFilterExt )
@@ -948,7 +948,7 @@ void VistaFilePickerImpl::impl_sta_ShowDialogModal(const RequestRef& rRequest)
                 osl_getSystemPathFromFileURL( aFileURL.pData, &aSystemPath.pData );
 
                 WIN32_FIND_DATA aFindFileData;
-                HANDLE  hFind = FindFirstFile( reinterpret_cast<LPCWSTR>(aSystemPath.getStr()), &aFindFileData );
+                HANDLE  hFind = FindFirstFile( reinterpret_cast<PCWSTR>(aSystemPath.getStr()), &aFindFileData );
                 if (hFind != INVALID_HANDLE_VALUE)
                     iDialog->SetFolder(pFolder);
                 else
@@ -1102,7 +1102,7 @@ void VistaFilePickerImpl::impl_sta_SetControlValue(const RequestRef& rRequest)
                             for (::sal_Int32 i=0; i<lItems.getLength(); ++i)
                             {
                                 const OUString& sItem = lItems[i];
-                                hResult = iCustom->AddControlItem(nId, i, reinterpret_cast<LPCTSTR>(sItem.getStr()));
+                                hResult = iCustom->AddControlItem(nId, i, reinterpret_cast<PCWSTR>(sItem.getStr()));
                             }
                         }
                         break;
@@ -1172,7 +1172,7 @@ void VistaFilePickerImpl::impl_sta_SetControlLabel(const RequestRef& rRequest)
     TFileDialogCustomize iCustom = impl_getCustomizeInterface();
     if ( ! iCustom.is())
         return;
-    iCustom->SetControlLabel ( nId, reinterpret_cast<LPCTSTR>(sLabel.getStr()));
+    iCustom->SetControlLabel ( nId, reinterpret_cast<PCWSTR>(sLabel.getStr()));
 }
 
 
@@ -1218,7 +1218,7 @@ void VistaFilePickerImpl::impl_SetDefaultExtension( const OUString& currentFilte
             posOfSemiColon = FilterExt.getLength() - 1;
 
         FilterExt = OUString(pFirstExtStart, posOfSemiColon - posOfPoint);
-        iDialog->SetDefaultExtension ( reinterpret_cast<LPCTSTR>(FilterExt.getStr()) );
+        iDialog->SetDefaultExtension ( reinterpret_cast<PCWSTR>(FilterExt.getStr()) );
    }
 }
 
@@ -1237,10 +1237,10 @@ void VistaFilePickerImpl::onAutoExtensionChanged (bool bChecked)
     aLock.clear();
     // <- SYNCHRONIZED
 
-    LPCWSTR pExt = 0;
+    PCWSTR pExt = 0;
     if ( bChecked )
     {
-        pExt = reinterpret_cast<LPCTSTR>(sExt.getStr());
+        pExt = reinterpret_cast<PCWSTR>(sExt.getStr());
         pExt = wcsrchr( pExt, '.' );
         if ( pExt )
             pExt++;
diff --git a/fpicker/source/win32/filepicker/WinFileOpenImpl.cxx b/fpicker/source/win32/filepicker/WinFileOpenImpl.cxx
index 1c8e432..c226fc4 100644
--- a/fpicker/source/win32/filepicker/WinFileOpenImpl.cxx
+++ b/fpicker/source/win32/filepicker/WinFileOpenImpl.cxx
@@ -721,7 +721,7 @@ void SAL_CALL CWinFileOpenImpl::onInitDone()
     m_CustomControls->Align();
 
     m_CustomControls->SetFont(
-        reinterpret_cast<HFONT>(SendMessage(m_hwndFileOpenDlg, WM_GETFONT, 0, 0)));
+        reinterpret_cast<HFONT>(SendMessageW(m_hwndFileOpenDlg, WM_GETFONT, 0, 0)));
 
     // resume event notification that was
     // defered in onInitDialog
@@ -730,7 +730,7 @@ void SAL_CALL CWinFileOpenImpl::onInitDone()
     //#105996 let vcl know that now a system window is active
     BOOL const ret = PostMessage(
         HWND_BROADCAST,
-        RegisterWindowMessage(TEXT("SYSTEM_WINDOW_ACTIVATED")),
+        RegisterWindowMessageW(L"SYSTEM_WINDOW_ACTIVATED"),
         0,
         0);
     SAL_WARN_IF(0 == ret, "fpicker", "ERROR: PostMessage() failed!");
@@ -885,13 +885,13 @@ void SAL_CALL CWinFileOpenImpl::SetDefaultExtension()
 
                     FilterExt = OUString(pFirstExtStart, posOfSemiColon - posOfPoint);
 
-                    SendMessage(m_hwndFileOpenDlg, CDM_SETDEFEXT, 0, reinterpret_cast<LPARAM>(FilterExt.getStr()));
+                    SendMessageW(m_hwndFileOpenDlg, CDM_SETDEFEXT, 0, reinterpret_cast<LPARAM>(FilterExt.getStr()));
                  }
             }
         }
         else
         {
-            SendMessage(m_hwndFileOpenDlg, CDM_SETDEFEXT, 0, reinterpret_cast<LPARAM>(TEXT("")));
+            SendMessageW(m_hwndFileOpenDlg, CDM_SETDEFEXT, 0, reinterpret_cast<LPARAM>(L""));
         }
     }
 
@@ -914,7 +914,7 @@ void SAL_CALL CWinFileOpenImpl::InitialSetDefaultName()
         HWND hFileNameBox = GetDlgItem(m_hwndFileOpenDlg, cmb13);
         if (!hFileNameBox)
             hFileNameBox = GetDlgItem(m_hwndFileOpenDlg, edt1);
-        SetWindowText(hFileNameBox, reinterpret_cast<LPCTSTR>(m_defaultName.getStr()));
+        SetWindowTextW(hFileNameBox, reinterpret_cast<PCWSTR>(m_defaultName.getStr()));
     }
 
     m_bInitialSelChanged = sal_False;
diff --git a/fpicker/source/win32/filepicker/controlaccess.cxx b/fpicker/source/win32/filepicker/controlaccess.cxx
index 51dbbdd..64ada1c 100644
--- a/fpicker/source/win32/filepicker/controlaccess.cxx
+++ b/fpicker/source/win32/filepicker/controlaccess.cxx
@@ -17,7 +17,6 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include <tchar.h>
 #include <sal/macros.h>
 #include <osl/diagnose.h>
 #include "controlaccess.hxx"
@@ -186,13 +185,12 @@ CTRL_GETVALUE_FUNCTION_T SAL_CALL GetCtrlGetValueFunction( CTRL_CLASS aCtrlClass
 CTRL_CLASS SAL_CALL GetCtrlClass( HWND hwndCtrl )
 {
     CTRL_CLASS aCtrlClass = UNKNOWN;
-    const size_t nClassNameSize = 256;
-    TCHAR aClassName[nClassNameSize];
+    WCHAR aClassName[256];
 
-    int nRet = GetClassName(hwndCtrl,aClassName,nClassNameSize);
+    int nRet = GetClassNameW(hwndCtrl,aClassName,SAL_N_ELEMENTS(aClassName));
     if (nRet)
     {
-        if (0 == _tcsicmp(aClassName,TEXT("button")))
+        if (0 == _wcsicmp(aClassName,L"button"))
         {
             // button means many things so we have
             // to find out what button it is
@@ -202,8 +200,8 @@ CTRL_CLASS SAL_CALL GetCtrlClass( HWND hwndCtrl )
             else if (((lBtnStyle & BS_PUSHBUTTON) == 0) || (lBtnStyle & BS_DEFPUSHBUTTON))
                 aCtrlClass = PUSHBUTTON;
         }
-        else if (0 == _tcsicmp(aClassName,TEXT("listbox")) ||
-                  0 == _tcsicmp(aClassName,TEXT("combobox")))
+        else if (0 == _wcsicmp(aClassName,L"listbox") ||
+                  0 == _wcsicmp(aClassName,L"combobox"))
             aCtrlClass = LISTBOX;
     }
 
diff --git a/fpicker/source/win32/filepicker/customcontrolfactory.cxx b/fpicker/source/win32/filepicker/customcontrolfactory.cxx
index a02252f..ea66e56 100644
--- a/fpicker/source/win32/filepicker/customcontrolfactory.cxx
+++ b/fpicker/source/win32/filepicker/customcontrolfactory.cxx
@@ -18,7 +18,6 @@
  */
 
 
-#include <tchar.h>
 #include "customcontrolfactory.hxx"
 #include "customcontrolcontainer.hxx"
 #include "dialogcustomcontrols.hxx"
@@ -33,13 +32,13 @@ CCustomControl* CCustomControlFactory::CreateCustomControl(HWND aControlHandle,
     // get window class
     // if static text create static text control etc.
 
-    TCHAR aClsName[256];
-    ZeroMemory(aClsName,sizeof(aClsName));
-    if (GetClassName(aControlHandle,aClsName,sizeof(aClsName)) == 0) {
+    WCHAR aClassName[256];
+    ZeroMemory(aClassName,sizeof(aClassName));
+    if (GetClassNameW(aControlHandle,aClassName,SAL_N_ELEMENTS(aClassName)) == 0) {
         OSL_FAIL("Invalid window handle");
     }
 
-    if (0 == _tcsicmp(aClsName,TEXT("button")))
+    if (0 == _wcsicmp(aClassName,L"button"))
     {
         // button means many things so we have
         // to find out what button it is
@@ -54,10 +53,10 @@ CCustomControl* CCustomControlFactory::CreateCustomControl(HWND aControlHandle,
         return new CDummyCustomControl(aControlHandle,aParentHandle);
     }
 
-    if (0 == _tcsicmp(aClsName,TEXT("listbox")) || 0 == _tcsicmp(aClsName,TEXT("combobox")))
+    if (0 == _wcsicmp(aClassName,L"listbox") || 0 == _wcsicmp(aClassName,L"combobox"))
         return new CComboboxCustomControl(aControlHandle,aParentHandle);
 
-    if (0 == _tcsicmp(aClsName,TEXT("static")))
+    if (0 == _wcsicmp(aClassName,L"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 65d7686..7ffdcb9 100644
--- a/fpicker/source/win32/filepicker/dialogcustomcontrols.cxx
+++ b/fpicker/source/win32/filepicker/dialogcustomcontrols.cxx
@@ -30,7 +30,7 @@ CDialogCustomControlBase::CDialogCustomControlBase(HWND aControlHandle, HWND aPa
 
 void SAL_CALL CDialogCustomControlBase::SetFont(HFONT hFont)
 {
-    SendMessage(
+    SendMessageW(
         m_CustomControlHandle,
         WM_SETFONT,
         (WPARAM)hFont,
diff --git a/fpicker/source/win32/filepicker/dibpreview.cxx b/fpicker/source/win32/filepicker/dibpreview.cxx
index 4062929..6a8e6ad 100644
--- a/fpicker/source/win32/filepicker/dibpreview.cxx
+++ b/fpicker/source/win32/filepicker/dibpreview.cxx
@@ -17,7 +17,6 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include <tchar.h>
 #include "dibpreview.hxx"
 #include <osl/diagnose.h>
 
@@ -37,10 +36,10 @@ using ::com::sun::star::lang::IllegalArgumentException;
 
 namespace /* private */
 {
-    const LPCTSTR CURRENT_INSTANCE = TEXT("CurrInst");
+    const PCWSTR CURRENT_INSTANCE = L"CurrInst";
 };
 
-#define PREVIEWWND_CLASS_NAME TEXT("DIBPreviewWnd###")
+#define PREVIEWWND_CLASS_NAME L"DIBPreviewWnd###"
 
 
 // static member initialization
@@ -61,10 +60,10 @@ CDIBPreview::CDIBPreview(HINSTANCE instance,HWND parent,sal_Bool bShowWindow) :
     if (bShowWindow)
         dwStyle |= WS_VISIBLE;
 
-    m_Hwnd = CreateWindowEx(
+    m_Hwnd = CreateWindowExW(
         WS_EX_CLIENTEDGE,
         PREVIEWWND_CLASS_NAME,
-        TEXT(""),
+        L"",
         dwStyle,
         0, 0, 0, 0,
         parent,
@@ -276,7 +275,7 @@ LRESULT CALLBACK CDIBPreview::WndProc(
             OSL_ASSERT(lpcs->lpCreateParams);
 
             // connect the instance handle to the window
-            SetProp(hWnd, CURRENT_INSTANCE, lpcs->lpCreateParams);
+            SetPropW(hWnd, CURRENT_INSTANCE, lpcs->lpCreateParams);
         }
         break;
 
@@ -286,7 +285,7 @@ LRESULT CALLBACK CDIBPreview::WndProc(
         {
             // RemoveProp returns the saved value on success
             if (reinterpret_cast<CDIBPreview*>(
-                    RemoveProp(hWnd, CURRENT_INSTANCE)) == NULL)
+                    RemovePropW(hWnd, CURRENT_INSTANCE)) == NULL)
             {
                 OSL_ASSERT(false);
             }
@@ -296,7 +295,7 @@ LRESULT CALLBACK CDIBPreview::WndProc(
     case WM_PAINT:
     {
         CDIBPreview* pImpl = reinterpret_cast<CDIBPreview*>(
-            GetProp(hWnd, CURRENT_INSTANCE));
+            GetPropW(hWnd, CURRENT_INSTANCE));
 
         OSL_ASSERT(pImpl);
 
@@ -345,7 +344,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 = RegisterClassEx(&wndClsEx);
+        s_ClassAtom = RegisterClassExW(&wndClsEx);
         if (0 == s_ClassAtom)
         {
             SAL_WARN("fpicker", "Could not register preview window class");
@@ -381,7 +380,7 @@ void SAL_CALL CDIBPreview::UnregisterDibPreviewWindowClass()
 
     if (0 == s_RegisterDibPreviewWndCount)
     {
-        UnregisterClass((LPCTSTR)(DWORD_PTR)MAKELONG(s_ClassAtom,0),m_Instance);
+        UnregisterClassW((PCWSTR)(DWORD_PTR)MAKELONG(s_ClassAtom,0),m_Instance);
         s_ClassAtom = 0;
     }
 }
diff --git a/fpicker/source/win32/filepicker/filepickerstate.cxx b/fpicker/source/win32/filepicker/filepickerstate.cxx
index 54863f2..51c4a71 100644
--- a/fpicker/source/win32/filepicker/filepickerstate.cxx
+++ b/fpicker/source/win32/filepicker/filepickerstate.cxx
@@ -420,7 +420,7 @@ void SAL_CALL CExecuteFilePickerState::setLabel( sal_Int16 aControlId, const OUS
 
     // somewhat risky because we don't know if OUString
     // has a terminating '\0'
-    SetWindowText( hwndCtrl, reinterpret_cast<LPCTSTR>(aWinLabel.getStr( )) );
+    SetWindowTextW( hwndCtrl, reinterpret_cast<PCWSTR>(aWinLabel.getStr( )) );
 }
 
 
@@ -434,7 +434,7 @@ OUString SAL_CALL CExecuteFilePickerState::getLabel( sal_Int16 aControlId )
         hwndCtrl = GetListboxLabelItem( aControlId );
 
     sal_Unicode aLabel[MAX_LABEL];
-    int nRet = GetWindowText( hwndCtrl, reinterpret_cast<LPTSTR>(aLabel), MAX_LABEL );
+    int nRet = GetWindowTextW( hwndCtrl, reinterpret_cast<PWSTR>(aLabel), MAX_LABEL );
 
     OUString ctrlLabel;
     if ( nRet )
diff --git a/fpicker/source/win32/filepicker/helppopupwindow.cxx b/fpicker/source/win32/filepicker/helppopupwindow.cxx
index 3eedd93..77e933d 100644
--- a/fpicker/source/win32/filepicker/helppopupwindow.cxx
+++ b/fpicker/source/win32/filepicker/helppopupwindow.cxx
@@ -17,7 +17,6 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include <tchar.h>
 #include "helppopupwindow.hxx"
 #include <osl/diagnose.h>
 
@@ -28,11 +27,11 @@ using osl::Mutex;
 namespace /* private */
 {
 
-    const LPCTSTR CURRENT_INSTANCE = TEXT("CurrInst");
+    const PCWSTR CURRENT_INSTANCE = L"CurrInst";
 
 };
 
-#define HELPPOPUPWND_CLASS_NAME TEXT("hlppopupwnd###")
+#define HELPPOPUPWND_CLASS_NAME L"hlppopupwnd###"
 
 const sal_Int32 MAX_CHARS_PER_LINE = 55;
 
@@ -109,7 +108,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 = CreateWindowEx(
+    m_hwnd = CreateWindowExW(
         0,
         HELPPOPUPWND_CLASS_NAME,
         NULL,
@@ -167,9 +166,9 @@ void SAL_CALL CHelpPopupWindow::calcWindowRect( LPRECT lprect )
     if ( m_HelpText.getLength( ) <= MAX_CHARS_PER_LINE )
         nFormat |= DT_SINGLELINE;
 
-    DrawText(
+    DrawTextW(
       hdc,
-      reinterpret_cast<LPCTSTR>(m_HelpText.getStr( )),
+      reinterpret_cast<PCWSTR>(m_HelpText.getStr( )),
       m_HelpText.getLength( ),
       lprect,
       nFormat );
@@ -334,9 +333,9 @@ void SAL_CALL CHelpPopupWindow::onPaint( HWND hWnd, HDC hdc )
     if ( m_HelpText.getLength( ) <= MAX_CHARS_PER_LINE )
         nFormat |= DT_SINGLELINE;
 
-    DrawText(
+    DrawTextW(
         hdc,
-        (LPWSTR)m_HelpText.getStr( ),
+        (PWSTR)m_HelpText.getStr( ),
         m_HelpText.getLength( ),
         &rect,
         nFormat );
@@ -431,7 +430,7 @@ LRESULT CALLBACK CHelpPopupWindow::WndProc(
                     lpcs->lpCreateParams );
 
                 // connect the instance handle to the window
-                SetProp( hWnd, CURRENT_INSTANCE, pImpl );
+                SetPropW( hWnd, CURRENT_INSTANCE, pImpl );
 
                 pImpl->onCreate( hWnd );
 
@@ -443,7 +442,7 @@ LRESULT CALLBACK CHelpPopupWindow::WndProc(
         case WM_PAINT:
             {
                 CHelpPopupWindow* pImpl = reinterpret_cast< CHelpPopupWindow* >(
-                GetProp( hWnd, CURRENT_INSTANCE ) );
+                GetPropW( hWnd, CURRENT_INSTANCE ) );
 
                 OSL_ASSERT( pImpl );
 
@@ -459,7 +458,7 @@ LRESULT CALLBACK CHelpPopupWindow::WndProc(
             {
                 // RemoveProp returns the saved value on success
                 CHelpPopupWindow* pImpl = reinterpret_cast< CHelpPopupWindow* >(
-                    RemoveProp( hWnd, CURRENT_INSTANCE ) );
+                    RemovePropW( hWnd, CURRENT_INSTANCE ) );
 
                 OSL_ASSERT( pImpl );
 
@@ -507,7 +506,7 @@ 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 = RegisterClassEx( &wndClsEx );
+        s_ClassAtom = RegisterClassExW( &wndClsEx );
         OSL_ASSERT(s_ClassAtom);
     }
 
@@ -539,8 +538,8 @@ void SAL_CALL CHelpPopupWindow::UnregisterWindowClass( )
 
     if ( 0 == s_RegisterWndClassCount )
     {
-        if ( !UnregisterClass(
-                 (LPCTSTR)(DWORD_PTR)MAKELONG( s_ClassAtom, 0 ), m_hInstance ) )
+        if ( !UnregisterClassW(
+                 (PCWSTR)(DWORD_PTR)MAKELONG( s_ClassAtom, 0 ), m_hInstance ) )
         {
             OSL_FAIL( "unregister window class failed" );
         }
diff --git a/fpicker/source/win32/filepicker/previewadapter.cxx b/fpicker/source/win32/filepicker/previewadapter.cxx
index 6cb7bcf..d90047a 100644
--- a/fpicker/source/win32/filepicker/previewadapter.cxx
+++ b/fpicker/source/win32/filepicker/previewadapter.cxx
@@ -18,7 +18,6 @@
  */
 
 
-#include <tchar.h>
 #include "previewadapter.hxx"
 
 #include <com/sun/star/ui/dialogs/FilePreviewImageFormats.hpp>
diff --git a/fpicker/source/win32/folderpicker/MtaFop.cxx b/fpicker/source/win32/folderpicker/MtaFop.cxx
index 3c3622a..4c9b9e3 100644
--- a/fpicker/source/win32/folderpicker/MtaFop.cxx
+++ b/fpicker/source/win32/folderpicker/MtaFop.cxx
@@ -748,8 +748,8 @@ void SAL_CALL CMtaFolderPicker::UnregisterStaRequestWindowClass( )
 
     if ( 0 == s_StaRequestWndRegisterCount )
     {
-        UnregisterClass(
-            (LPCTSTR)(DWORD_PTR)MAKELONG( s_ClassAtom, 0 ), m_hInstance );
+        UnregisterClassA(
+            (PCSTR)(DWORD_PTR)MAKELONG( s_ClassAtom, 0 ), m_hInstance );
 
         s_ClassAtom = 0;
     }
diff --git a/fpicker/source/win32/misc/WinImplHelper.cxx b/fpicker/source/win32/misc/WinImplHelper.cxx
index d4156bc..785e755 100644
--- a/fpicker/source/win32/misc/WinImplHelper.cxx
+++ b/fpicker/source/win32/misc/WinImplHelper.cxx
@@ -184,7 +184,7 @@ void SAL_CALL ListboxDeleteItem( HWND hwnd, const Any& aPosition, const Referenc
     sal_Int32 nPos;
     aPosition >>= nPos;
 
-    LRESULT lRet = SendMessage( hwnd, CB_DELETESTRING, nPos, 0 );
+    LRESULT lRet = SendMessageW( hwnd, CB_DELETESTRING, nPos, 0 );
 
     // if the return value is CB_ERR the given
     // index was not correct


More information about the Libreoffice-commits mailing list