summaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2017-09-28 12:40:42 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2017-09-29 14:55:11 +0200
commit0dd2e602e5c1b46e82abc6051677aeaab1d265b8 (patch)
tree7f7a1cbc9cb87c38c732d4691129bf81dc1d04ff /shell
parent8b12c98ec7ec0b5ba20c28890ee63803fb9518d5 (diff)
Drop check for Windows versions we don't support
Since we dropped support of Vista and below in master toward 6.0, those checks are needless. Removing the code that only worked in older versions, and streamlining the resulting code. Also, use kernel32.dll version for Windows version, instead of deprecated GetVersionEx, and inconvenient VersionHelpers. Since both GetVersion(Ex) and VersionHelpers (based on VerifyVersionInfo) are subject to manifest-based behavior since Windows 8.1, this move will hopefully result in more reliable OS version detection. Change-Id: I3edd8fc1843e64b6a65bd3a126be6a085511f13c Reviewed-on: https://gerrit.libreoffice.org/42905 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'shell')
-rw-r--r--shell/inc/utilities.hxx6
-rw-r--r--shell/source/win32/shlxthandler/propsheets/listviewbuilder.cxx84
-rw-r--r--shell/source/win32/shlxthandler/propsheets/listviewbuilder.hxx23
-rw-r--r--shell/source/win32/shlxthandler/propsheets/propsheets.cxx37
-rw-r--r--shell/source/win32/shlxthandler/thumbviewer/thumbviewer.cxx28
-rw-r--r--shell/source/win32/shlxthandler/util/utilities.cxx26
6 files changed, 14 insertions, 190 deletions
diff --git a/shell/inc/utilities.hxx b/shell/inc/utilities.hxx
index eb6c289d5023..22f785d3ce62 100644
--- a/shell/inc/utilities.hxx
+++ b/shell/inc/utilities.hxx
@@ -64,12 +64,6 @@ std::wstring UTF8ToWString(const std::string& String);
std::wstring GetResString(int ResId);
-/** Returns whether we are running
- on Windows XP or not
-*/
-bool is_windows_xp_or_above();
-
-
/** helper function to judge if the string is only has spaces.
@returns
<TRUE>if the provided string contains only but at least one space
diff --git a/shell/source/win32/shlxthandler/propsheets/listviewbuilder.cxx b/shell/source/win32/shlxthandler/propsheets/listviewbuilder.cxx
index 8d659582c642..bc3561db7710 100644
--- a/shell/source/win32/shlxthandler/propsheets/listviewbuilder.cxx
+++ b/shell/source/win32/shlxthandler/propsheets/listviewbuilder.cxx
@@ -50,10 +50,7 @@
list_view_builder_ptr create_list_view_builder(
HWND hwnd_lv, const std::wstring& col1, const std::wstring& col2)
{
- if (is_windows_xp_or_above())
- return list_view_builder_ptr(new winxp_list_view_builder(hwnd_lv, col1, col2));
- else
- return list_view_builder_ptr(new list_view_builder(hwnd_lv, col1, col2));
+ return list_view_builder_ptr(new list_view_builder(hwnd_lv, col1, col2));
}
@@ -64,7 +61,9 @@ list_view_builder::list_view_builder(
row_index_(-1),
hwnd_list_view_(hwnd_list_view),
column1_title_(column1_title),
- column2_title_(column2_title)
+ column2_title_(column2_title),
+ group_count_(-1),
+ row_count_(0)
{
}
@@ -121,73 +120,11 @@ void list_view_builder::setup_list_view()
header = GetResString(IDS_PROPERTY_VALUE);
lvc.pszText = const_cast<wchar_t*>(header.c_str());
ListView_InsertColumnW(hwnd_list_view_, 1, &lvc);
+ ListView_EnableGroupView(hwnd_list_view_, TRUE);
}
-void list_view_builder::insert_group(const std::wstring& /*title*/)
-{
- insert_item(L"", L"", false);
-}
-
-
-void list_view_builder::insert_item(const std::wstring& title, const std::wstring& value, bool is_editable)
-{
- LVITEMW lvi;
-
- lvi.iItem = ++row_index_;
- lvi.iSubItem = 0;
- lvi.mask = LVIF_TEXT;
- lvi.state = 0;
- lvi.cchTextMax = static_cast<int>(title.size() + 1);
- lvi.stateMask = 0;
- lvi.pszText = const_cast<wchar_t*>(title.c_str());
-
- if (title.length() > 0)
- {
- lvi.mask |= LVIF_IMAGE;
-
- if (is_editable)
- lvi.iImage = 4;
- else
- lvi.iImage = 3;
- }
-
- ListView_InsertItemW(hwnd_list_view_, &lvi);
-
- lvi.mask = LVIF_TEXT;
- lvi.iSubItem = 1;
- lvi.pszText = const_cast<wchar_t*>(value.c_str());
-
- ListView_SetItemW(hwnd_list_view_, &lvi);
-}
-
-
-HWND list_view_builder::get_list_view() const
-{
- return hwnd_list_view_;
-}
-
-
-winxp_list_view_builder::winxp_list_view_builder(
- HWND hwnd_list_view,
- const std::wstring& column1_title,
- const std::wstring& column2_title) :
- list_view_builder(hwnd_list_view, column1_title, column2_title),
- group_count_(-1),
- row_count_(0)
-{
-}
-
-
-void winxp_list_view_builder::setup_list_view()
-{
- list_view_builder::setup_list_view();
-
- ListView_EnableGroupView(get_list_view(), TRUE);
-}
-
-
-void winxp_list_view_builder::insert_group(const std::wstring& name)
+void list_view_builder::insert_group(const std::wstring& name)
{
LVGROUP lvg;
@@ -205,8 +142,7 @@ void winxp_list_view_builder::insert_group(const std::wstring& name)
}
-void winxp_list_view_builder::insert_item(
- const std::wstring& title, const std::wstring& value, bool is_editable)
+void list_view_builder::insert_item(const std::wstring& title, const std::wstring& value, bool is_editable)
{
LVITEMW lvi;
@@ -239,4 +175,10 @@ void winxp_list_view_builder::insert_item(
row_count_++;
}
+
+HWND list_view_builder::get_list_view() const
+{
+ return hwnd_list_view_;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/shell/source/win32/shlxthandler/propsheets/listviewbuilder.hxx b/shell/source/win32/shlxthandler/propsheets/listviewbuilder.hxx
index 1555c1fec3ed..7c8b86104bb8 100644
--- a/shell/source/win32/shlxthandler/propsheets/listviewbuilder.hxx
+++ b/shell/source/win32/shlxthandler/propsheets/listviewbuilder.hxx
@@ -62,32 +62,11 @@ protected:
virtual void insert_item(const std::wstring& title, const std::wstring& value, bool is_editable);
HWND get_list_view() const;
- int get_current_row() const;
-
- int row_index_;
-
private:
+ int row_index_;
HWND hwnd_list_view_;
std::wstring column1_title_;
std::wstring column2_title_;
-
- friend list_view_builder_ptr create_list_view_builder(HWND hwnd_lv, const std::wstring& col1, const std::wstring& col2);
-};
-
-
-class winxp_list_view_builder : public list_view_builder
-{
-protected:
- winxp_list_view_builder(
- HWND hwnd_list_view,
- const std::wstring& column1_title,
- const std::wstring& column2_title);
-
- virtual void setup_list_view() override;
- virtual void insert_group(const std::wstring& name) override;
- virtual void insert_item(const std::wstring& title, const std::wstring& value, bool is_editable) override;
-
-private:
int group_count_;
int row_count_;
diff --git a/shell/source/win32/shlxthandler/propsheets/propsheets.cxx b/shell/source/win32/shlxthandler/propsheets/propsheets.cxx
index 4c9fff083d14..99933f6169f1 100644
--- a/shell/source/win32/shlxthandler/propsheets/propsheets.cxx
+++ b/shell/source/win32/shlxthandler/propsheets/propsheets.cxx
@@ -29,9 +29,6 @@
#pragma warning(push, 1)
#endif
#include <shellapi.h>
-#ifdef _WIN32_WINNT_WINBLUE
-#include <VersionHelpers.h>
-#endif
#if defined _MSC_VER
#pragma warning(pop)
#endif
@@ -170,19 +167,6 @@ HRESULT STDMETHODCALLTYPE CPropertySheet::Initialize(
HRESULT STDMETHODCALLTYPE CPropertySheet::AddPages(LPFNADDPROPSHEETPAGE lpfnAddPage, LPARAM lParam)
{
-// the Win32 SDK 8.1 deprecates GetVersionEx()
-#ifdef _WIN32_WINNT_WINBLUE
- bool bIsVistaOrLater = IsWindowsVistaOrGreater();
-#else
- // Get OS version (we don't need the summary page on Windows Vista or later)
- OSVERSIONINFOW sInfoOS;
-
- ZeroMemory( &sInfoOS, sizeof(sInfoOS) );
- sInfoOS.dwOSVersionInfoSize = sizeof( sInfoOS );
- GetVersionExW( &sInfoOS );
- bool bIsVistaOrLater = (sInfoOS.dwMajorVersion >= 6);
-#endif
-
std::wstring proppage_header;
PROPSHEETPAGE psp;
@@ -197,27 +181,6 @@ HRESULT STDMETHODCALLTYPE CPropertySheet::AddPages(LPFNADDPROPSHEETPAGE lpfnAddP
HPROPSHEETPAGE hPage = nullptr;
- if ( !bIsVistaOrLater )
- {
- proppage_header = GetResString(IDS_PROPPAGE_SUMMARY_TITLE);
-
- psp.pszTemplate = MAKEINTRESOURCE(IDD_PROPPAGE_SUMMARY);
- psp.pszTitle = proppage_header.c_str();
- psp.pfnDlgProc = reinterpret_cast<DLGPROC>(CPropertySheet::PropPageSummaryProc);
-
- hPage = CreatePropertySheetPage(&psp);
-
- // keep this instance alive, will be released when the
- // page is about to be destroyed in the callback function
- if (hPage)
- {
- if (lpfnAddPage(hPage, lParam))
- AddRef();
- else
- DestroyPropertySheetPage(hPage);
- }
- }
-
// add the statistics property page
proppage_header = GetResString(IDS_PROPPAGE_STATISTICS_TITLE);
diff --git a/shell/source/win32/shlxthandler/thumbviewer/thumbviewer.cxx b/shell/source/win32/shlxthandler/thumbviewer/thumbviewer.cxx
index 360f89cacab0..56d58e919aea 100644
--- a/shell/source/win32/shlxthandler/thumbviewer/thumbviewer.cxx
+++ b/shell/source/win32/shlxthandler/thumbviewer/thumbviewer.cxx
@@ -40,9 +40,6 @@
#pragma warning(push, 1)
#endif
#include <shellapi.h>
-#ifdef _WIN32_WINNT_WINBLUE
-#include <VersionHelpers.h>
-#endif
#if defined _MSC_VER
#pragma warning(pop)
#endif
@@ -67,28 +64,6 @@ namespace internal
return zipfile->HasContent("META-INF/documentsignatures.xml");
}
- bool IsWindowsXP()
- {
-// the Win32 SDK 8.1 deprecates GetVersionEx()
-#ifdef _WIN32_WINNT_WINBLUE
- return IsWindowsXPOrGreater();
-#else
- OSVERSIONINFOW osvi;
- ZeroMemory(&osvi, sizeof(osvi));
- osvi.dwOSVersionInfoSize = sizeof(osvi);
- GetVersionExW(&osvi);
-
- return ((osvi.dwPlatformId == VER_PLATFORM_WIN32_NT) &&
- ((osvi.dwMajorVersion >= 5) && (osvi.dwMinorVersion >= 1)));
-#endif
- }
-
- /* Calculate where to position the signet image.
- On Windows ME we need to shift the signet a
- little bit to the left because Windows ME
- puts an overlay icon to the lower right
- corner of a thumbnail image so that our signet
- we be hidden. */
Gdiplus::Point CalcSignetPosition(
const Gdiplus::Rect& canvas, const Gdiplus::Rect& thumbnail_border, const Gdiplus::Rect& signet)
{
@@ -108,9 +83,6 @@ namespace internal
y = thumbnail_border.GetBottom() - signet.GetBottom() + min(signet.GetBottom() / 2, voffset);
}
- if (!IsWindowsXP())
- x -= 15;
-
return Gdiplus::Point(x,y);
}
}
diff --git a/shell/source/win32/shlxthandler/util/utilities.cxx b/shell/source/win32/shlxthandler/util/utilities.cxx
index 9468b33a71c4..29395b6d36e0 100644
--- a/shell/source/win32/shlxthandler/util/utilities.cxx
+++ b/shell/source/win32/shlxthandler/util/utilities.cxx
@@ -24,10 +24,6 @@
#include "config.hxx"
#include "utilities.hxx"
-#ifdef _WIN32_WINNT_WINBLUE
-#include <VersionHelpers.h>
-#endif
-
// constants
@@ -94,28 +90,6 @@ std::wstring GetResString(int ResId)
}
-bool is_windows_xp_or_above()
-{
-// the Win32 SDK 8.1 deprecates GetVersionEx()
-#ifdef _WIN32_WINNT_WINBLUE
- return IsWindowsXPOrGreater();
-#else
- OSVERSIONINFOW osvi;
- ZeroMemory(&osvi, sizeof(osvi));
- osvi.dwOSVersionInfoSize = sizeof(osvi);
- GetVersionExW(&osvi);
-
- // LLA: check for windows xp or above (Vista)
- if (osvi.dwMajorVersion > 5 ||
- (5 == osvi.dwMajorVersion && osvi.dwMinorVersion >= 1))
- {
- return true;
- }
- return false;
-#endif
-}
-
-
/** helper function to judge if the string is only has spaces.
@returns
<TRUE>if the provided string contains only but at least one space