summaryrefslogtreecommitdiff
path: root/embeddedobj
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2024-02-25 19:28:24 +0600
committerMike Kaganski <mike.kaganski@collabora.com>2024-02-26 04:18:07 +0100
commit74185b8edf7f046a3372319da86a1d8ca0024c87 (patch)
tree187bf9c2c198813a30bbef235f919937015d25f3 /embeddedobj
parenta9e1fb692167d838a207abfd72ae04f2821b9dc6 (diff)
Link to oledlg, and use OleUIInsertObjectW directly
... instead of manually loading and using OleUIInsertObjectA. Change-Id: I597dd44e13edf8c94d83f434b57142c88e5aca6f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163922 Tested-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'embeddedobj')
-rw-r--r--embeddedobj/Library_emboleobj.mk1
-rw-r--r--embeddedobj/source/msole/xdialogcreator.cxx25
2 files changed, 7 insertions, 19 deletions
diff --git a/embeddedobj/Library_emboleobj.mk b/embeddedobj/Library_emboleobj.mk
index d92f86f2c7d3..661bd655358b 100644
--- a/embeddedobj/Library_emboleobj.mk
+++ b/embeddedobj/Library_emboleobj.mk
@@ -55,6 +55,7 @@ $(eval $(call gb_Library_use_system_win32_libs,emboleobj,\
gdi32 \
ole32 \
oleaut32 \
+ oledlg \
uuid \
))
diff --git a/embeddedobj/source/msole/xdialogcreator.cxx b/embeddedobj/source/msole/xdialogcreator.cxx
index 7e4e99156291..74b267eca22f 100644
--- a/embeddedobj/source/msole/xdialogcreator.cxx
+++ b/embeddedobj/source/msole/xdialogcreator.cxx
@@ -51,6 +51,7 @@
#ifdef _WIN32
#include <oledlg.h>
+#include <o3tl/char16_t2wchar_t.hxx>
#include <vcl/winscheduler.hxx>
namespace {
@@ -140,34 +141,21 @@ embed::InsertedObjectInfo SAL_CALL MSOLEDialogObjectCreator::createInstanceByDia
InitializedOleGuard aGuard;
- OLEUIINSERTOBJECT io = {};
- char szFile[MAX_PATH];
- UINT uTemp;
-
- io.cbStruct = sizeof(io);
+ OLEUIINSERTOBJECTW io{ sizeof(io) };
io.hWndOwner = GetActiveWindow();
+ wchar_t szFile[MAX_PATH];
szFile[0] = 0;
io.lpszFile = szFile;
- io.cchFile = MAX_PATH;
+ io.cchFile = std::size(szFile);
io.dwFlags = IOF_SELECTCREATENEW | IOF_DISABLELINK;
-
- ::osl::Module aOleDlgLib;
- if( !aOleDlgLib.load( "oledlg" ))
- throw uno::RuntimeException();
-
- OleUIInsertObjectA_Type * pInsertFct = reinterpret_cast<OleUIInsertObjectA_Type *>(
- aOleDlgLib.getSymbol( "OleUIInsertObjectA" ));
- if( !pInsertFct )
- throw uno::RuntimeException();
-
// Disable any event loop shortcuts by enabling a real timer.
// This way the native windows dialog won't block our own processing.
WinScheduler::SetForceRealTimer();
- uTemp=pInsertFct(&io);
+ UINT uTemp = OleUIInsertObjectW(&io);
if ( OLEUI_OK != uTemp )
throw ucb::CommandAbortedException();
@@ -196,8 +184,7 @@ embed::InsertedObjectInfo SAL_CALL MSOLEDialogObjectCreator::createInstanceByDia
}
else
{
- OUString aFileName
- = OStringToOUString( std::string_view( szFile ), osl_getThreadTextEncoding() );
+ OUString aFileName(o3tl::toU(szFile));
OUString aFileURL;
if ( osl::FileBase::getFileURLFromSystemPath( aFileName, aFileURL ) != osl::FileBase::E_None )
throw uno::RuntimeException();