summaryrefslogtreecommitdiff
path: root/vcl/win
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2017-05-30 16:45:32 +0200
committerMichael Stahl <mstahl@redhat.com>2017-05-30 20:19:21 +0200
commitb411470bb818b6be17d0da982deb74d31b1b3dfc (patch)
treeff0f1f843a377b1469f625157163a288abe6d121 /vcl/win
parent5158c16a9ef23ab610940eb51e2fead13a7b0456 (diff)
vcl: replace dynamic lookups of Windows 7 APIs with static calls
Change-Id: I5d4c4bb98e271e69c45b8e7f989f9b21d287c0bb
Diffstat (limited to 'vcl/win')
-rw-r--r--vcl/win/app/salinst.cxx90
1 files changed, 36 insertions, 54 deletions
diff --git a/vcl/win/app/salinst.cxx b/vcl/win/app/salinst.cxx
index e087b4d1d99b..78147ae67608 100644
--- a/vcl/win/app/salinst.cxx
+++ b/vcl/win/app/salinst.cxx
@@ -913,65 +913,47 @@ void WinSalInstance::AddToRecentDocumentList(const OUString& rFileUrl, const OUS
{
if ( aSalShlData.mbW7 )
{
- typedef HRESULT ( WINAPI *SHCREATEITEMFROMPARSINGNAME )( PCWSTR, IBindCtx*, REFIID, void **ppv );
- SHCREATEITEMFROMPARSINGNAME pSHCreateItemFromParsingName =
- reinterpret_cast<SHCREATEITEMFROMPARSINGNAME>(GetProcAddress(
- GetModuleHandleW (L"shell32.dll"), "SHCreateItemFromParsingName" ));
+ IShellItem* pShellItem = nullptr;
- if( pSHCreateItemFromParsingName )
- {
- IShellItem* pShellItem = nullptr;
-
- HRESULT hr = pSHCreateItemFromParsingName ( SAL_W(system_path.getStr()), nullptr, IID_PPV_ARGS(&pShellItem) );
+ HRESULT hr = SHCreateItemFromParsingName(SAL_W(system_path.getStr()), nullptr, IID_PPV_ARGS(&pShellItem));
- if ( SUCCEEDED(hr) && pShellItem )
+ if ( SUCCEEDED(hr) && pShellItem )
+ {
+ OUString sApplicationName;
+
+ if ( rDocumentService == "com.sun.star.text.TextDocument" ||
+ rDocumentService == "com.sun.star.text.GlobalDocument" ||
+ rDocumentService == "com.sun.star.text.WebDocument" ||
+ rDocumentService == "com.sun.star.xforms.XMLFormDocument" )
+ sApplicationName = "Writer";
+ else if ( rDocumentService == "com.sun.star.sheet.SpreadsheetDocument" ||
+ rDocumentService == "com.sun.star.chart2.ChartDocument" )
+ sApplicationName = "Calc";
+ else if ( rDocumentService == "com.sun.star.presentation.PresentationDocument" )
+ sApplicationName = "Impress";
+ else if ( rDocumentService == "com.sun.star.drawing.DrawingDocument" )
+ sApplicationName = "Draw";
+ else if ( rDocumentService == "com.sun.star.formula.FormulaProperties" )
+ sApplicationName = "Math";
+ else if ( rDocumentService == "com.sun.star.sdb.DatabaseDocument" ||
+ rDocumentService == "com.sun.star.sdb.OfficeDatabaseDocument" ||
+ rDocumentService == "com.sun.star.sdb.RelationDesign" ||
+ rDocumentService == "com.sun.star.sdb.QueryDesign" ||
+ rDocumentService == "com.sun.star.sdb.TableDesign" ||
+ rDocumentService == "com.sun.star.sdb.DataSourceBrowser" )
+ sApplicationName = "Base";
+
+ if ( !sApplicationName.isEmpty() )
{
- OUString sApplicationName;
-
- if ( rDocumentService == "com.sun.star.text.TextDocument" ||
- rDocumentService == "com.sun.star.text.GlobalDocument" ||
- rDocumentService == "com.sun.star.text.WebDocument" ||
- rDocumentService == "com.sun.star.xforms.XMLFormDocument" )
- sApplicationName = "Writer";
- else if ( rDocumentService == "com.sun.star.sheet.SpreadsheetDocument" ||
- rDocumentService == "com.sun.star.chart2.ChartDocument" )
- sApplicationName = "Calc";
- else if ( rDocumentService == "com.sun.star.presentation.PresentationDocument" )
- sApplicationName = "Impress";
- else if ( rDocumentService == "com.sun.star.drawing.DrawingDocument" )
- sApplicationName = "Draw";
- else if ( rDocumentService == "com.sun.star.formula.FormulaProperties" )
- sApplicationName = "Math";
- else if ( rDocumentService == "com.sun.star.sdb.DatabaseDocument" ||
- rDocumentService == "com.sun.star.sdb.OfficeDatabaseDocument" ||
- rDocumentService == "com.sun.star.sdb.RelationDesign" ||
- rDocumentService == "com.sun.star.sdb.QueryDesign" ||
- rDocumentService == "com.sun.star.sdb.TableDesign" ||
- rDocumentService == "com.sun.star.sdb.DataSourceBrowser" )
- sApplicationName = "Base";
-
- if ( !sApplicationName.isEmpty() )
- {
- OUString sApplicationID("TheDocumentFoundation.LibreOffice.");
- sApplicationID += sApplicationName;
-
-#if _WIN32_WINNT < _WIN32_WINNT_WIN7
-// just define Windows 7 only constant locally...
-#define SHARD_APPIDINFO 0x00000004
-#endif
-
- typedef struct {
- IShellItem *psi;
- PCWSTR pszAppID;
- } DummyShardAppIDInfo;
+ OUString sApplicationID("TheDocumentFoundation.LibreOffice.");
+ sApplicationID += sApplicationName;
- DummyShardAppIDInfo info;
- info.psi = pShellItem;
- info.pszAppID = SAL_W(sApplicationID.getStr());
+ SHARDAPPIDINFO info;
+ info.psi = pShellItem;
+ info.pszAppID = SAL_W(sApplicationID.getStr());
- SHAddToRecentDocs ( SHARD_APPIDINFO, &info );
- return;
- }
+ SHAddToRecentDocs ( SHARD_APPIDINFO, &info );
+ return;
}
}
}