This is an automated email from the ASF dual-hosted git repository.
mseidel pushed a commit to branch AOO42X
in repository https://gitbox.apache.org/repos/asf/openoffice.git
The following commit(s) were added to refs/heads/AOO42X by this push:
new 5da75f4305 Maintenance cleanup
5da75f4305 is described below
commit 5da75f430512d9aa4ee613812299b74b569e3d23
Author: mseidel <[email protected]>
AuthorDate: Thu Jun 29 15:29:01 2023 +0200
Maintenance cleanup
(cherry picked from commit 48fbb5446f9ac8885b31e7389f29c9f354dcdedc)
---
.../win32/shlxthandler/columninfo/columninfo.cxx | 86 +++--
.../win32/shlxthandler/infotips/infotips.cxx | 2 +
.../win32/shlxthandler/ooofilt/stream_helper.cxx | 64 +--
.../win32/shlxthandler/prophdl/propertyhdl.cxx | 430 +++++++++++----------
.../win32/shlxthandler/thumbviewer/thumbviewer.cxx | 159 ++++----
5 files changed, 375 insertions(+), 366 deletions(-)
diff --git a/main/shell/source/win32/shlxthandler/columninfo/columninfo.cxx
b/main/shell/source/win32/shlxthandler/columninfo/columninfo.cxx
index d374218831..534f98ea5f 100644
--- a/main/shell/source/win32/shlxthandler/columninfo/columninfo.cxx
+++ b/main/shell/source/win32/shlxthandler/columninfo/columninfo.cxx
@@ -1,5 +1,5 @@
/**************************************************************
- *
+ *
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -7,16 +7,16 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- *
+ *
*************************************************************/
@@ -40,14 +40,14 @@ namespace /* private */
{
SHCOLUMNINFO ColumnInfoTable[] =
{
- {{PSGUID_SUMMARYINFORMATION, PIDSI_TITLE}, VT_BSTR,
LVCFMT_LEFT, 30, SHCOLSTATE_TYPE_STR, L"Title", L"Title"},
- {{PSGUID_SUMMARYINFORMATION, PIDSI_AUTHOR}, VT_BSTR,
LVCFMT_LEFT, 30, SHCOLSTATE_TYPE_STR, L"Author", L"Author"},
- {{PSGUID_SUMMARYINFORMATION, PIDSI_SUBJECT}, VT_BSTR,
LVCFMT_LEFT, 30, SHCOLSTATE_TYPE_STR, L"Subject", L"Subject"},
- {{PSGUID_SUMMARYINFORMATION, PIDSI_KEYWORDS}, VT_BSTR,
LVCFMT_LEFT, 30, SHCOLSTATE_TYPE_STR, L"Keywords", L"Keywords"},
- {{PSGUID_SUMMARYINFORMATION, PIDSI_COMMENTS}, VT_BSTR,
LVCFMT_LEFT, 30, SHCOLSTATE_TYPE_STR, L"Comments", L"Comments"},
- {{PSGUID_SUMMARYINFORMATION, PIDSI_PAGECOUNT},VT_BSTR,
LVCFMT_LEFT, 30, SHCOLSTATE_TYPE_STR, L"Pagecount", L"Pagecount"}
+ {{PSGUID_SUMMARYINFORMATION, PIDSI_TITLE}, VT_BSTR,
LVCFMT_LEFT, 30, SHCOLSTATE_TYPE_STR, L"Title", L"Title"},
+ {{PSGUID_SUMMARYINFORMATION, PIDSI_AUTHOR}, VT_BSTR,
LVCFMT_LEFT, 30, SHCOLSTATE_TYPE_STR, L"Author", L"Author"},
+ {{PSGUID_SUMMARYINFORMATION, PIDSI_SUBJECT}, VT_BSTR,
LVCFMT_LEFT, 30, SHCOLSTATE_TYPE_STR, L"Subject", L"Subject"},
+ {{PSGUID_SUMMARYINFORMATION, PIDSI_KEYWORDS}, VT_BSTR,
LVCFMT_LEFT, 30, SHCOLSTATE_TYPE_STR, L"Keywords", L"Keywords"},
+ {{PSGUID_SUMMARYINFORMATION, PIDSI_COMMENTS}, VT_BSTR,
LVCFMT_LEFT, 30, SHCOLSTATE_TYPE_STR, L"Comments", L"Comments"},
+ {{PSGUID_SUMMARYINFORMATION, PIDSI_PAGECOUNT}, VT_BSTR,
LVCFMT_LEFT, 30, SHCOLSTATE_TYPE_STR, L"Pagecount", L"Pagecount"}
};
-
+
size_t ColumnInfoTableSize =
sizeof(ColumnInfoTable)/sizeof(ColumnInfoTable[0]);
}
@@ -67,7 +67,7 @@ CColumnInfo::CColumnInfo(long RefCnt) :
CColumnInfo::~CColumnInfo()
{
- InterlockedDecrement(&g_DllRefCnt);
+ InterlockedDecrement(&g_DllRefCnt);
}
//-----------------------------
@@ -78,30 +78,30 @@ HRESULT STDMETHODCALLTYPE
CColumnInfo::QueryInterface(REFIID riid, void __RPC_FA
{
*ppvObject = 0;
- if (IID_IUnknown == riid || IID_IColumnProvider == riid)
+ if (IID_IUnknown == riid || IID_IColumnProvider == riid)
{
IUnknown* pUnk = static_cast<IColumnProvider*>(this);
pUnk->AddRef();
*ppvObject = pUnk;
return S_OK;
}
-
+
return E_NOINTERFACE;
}
//----------------------------
-//
+//
//----------------------------
-
+
ULONG STDMETHODCALLTYPE CColumnInfo::AddRef(void)
{
return InterlockedIncrement(&m_RefCnt);
}
//----------------------------
-//
+//
//----------------------------
-
+
ULONG STDMETHODCALLTYPE CColumnInfo::Release( void)
{
long refcnt = InterlockedDecrement(&m_RefCnt);
@@ -130,14 +130,14 @@ HRESULT STDMETHODCALLTYPE
CColumnInfo::GetColumnInfo(DWORD dwIndex, SHCOLUMNINFO
if (dwIndex >= ColumnInfoTableSize)
return S_FALSE;
- // Return information on each column we support. Return S_FALSE
- // to indicate that we have returned information on all our
- // columns. GetColumnInfo will be called repeatedly until S_FALSE
- // or an error is returned
+ // Return information on each column we support. Return S_FALSE
+ // to indicate that we have returned information on all our
+ // columns. GetColumnInfo will be called repeatedly until S_FALSE
+ // or an error is returned
psci->scid.fmtid = ColumnInfoTable[dwIndex].scid.fmtid;
psci->scid.pid = ColumnInfoTable[dwIndex].scid.pid;
- ZeroMemory(psci->wszTitle, sizeof(psci->wszTitle));
- wcsncpy(psci->wszTitle, ColumnInfoTable[dwIndex].wszTitle,
(sizeof(psci->wszTitle) - 1));
+ ZeroMemory(psci->wszTitle, sizeof(psci->wszTitle));
+ wcsncpy(psci->wszTitle, ColumnInfoTable[dwIndex].wszTitle,
(sizeof(psci->wszTitle) - 1));
//wcscpy(psci->wszTitle, ColumnInfoTable[dwIndex].wszTitle);
@@ -145,7 +145,7 @@ HRESULT STDMETHODCALLTYPE CColumnInfo::GetColumnInfo(DWORD
dwIndex, SHCOLUMNINFO
}
//-----------------------------
-//
+//
//-----------------------------
HRESULT STDMETHODCALLTYPE CColumnInfo::GetItemData(LPCSHCOLUMNID pscid,
LPCSHCOLUMNDATA pscd, VARIANT *pvarData)
@@ -154,54 +154,54 @@ HRESULT STDMETHODCALLTYPE
CColumnInfo::GetItemData(LPCSHCOLUMNID pscid, LPCSHCOL
{
try
{
- std::wstring fname = getShortPathName( std::wstring(
pscd->wszFile ) );
+ std::wstring fname = getShortPathName( std::wstring(
pscd->wszFile ) );
CMetaInfoReader
meta_info_accessor(WStringToString(fname));
-
+
VariantClear(pvarData);
if (IsEqualGUID (pscid->fmtid,
FMTID_SummaryInformation) && pscid->pid == PIDSI_TITLE)
{
pvarData->vt = VT_BSTR;
pvarData->bstrVal =
SysAllocString(meta_info_accessor.getTagData( META_INFO_TITLE ).c_str());
-
+
return S_OK;
}
else if (IsEqualGUID (pscid->fmtid,
FMTID_SummaryInformation) && pscid->pid == PIDSI_AUTHOR)
{
- pvarData->vt = VT_BSTR;
+ pvarData->vt = VT_BSTR;
pvarData->bstrVal =
SysAllocString(meta_info_accessor.getTagData( META_INFO_AUTHOR).c_str());
-
+
return S_OK;
}
else if (IsEqualGUID (pscid->fmtid,
FMTID_SummaryInformation) && pscid->pid == PIDSI_SUBJECT)
{
- pvarData->vt = VT_BSTR;
+ pvarData->vt = VT_BSTR;
pvarData->bstrVal =
SysAllocString(meta_info_accessor.getTagData( META_INFO_SUBJECT).c_str());
-
+
return S_OK;
}
else if (IsEqualGUID (pscid->fmtid,
FMTID_SummaryInformation) && pscid->pid == PIDSI_KEYWORDS)
{
- pvarData->vt = VT_BSTR;
+ pvarData->vt = VT_BSTR;
pvarData->bstrVal =
SysAllocString(meta_info_accessor.getTagData( META_INFO_KEYWORDS).c_str());
-
+
return S_OK;
}
else if (IsEqualGUID (pscid->fmtid,
FMTID_SummaryInformation) && pscid->pid == PIDSI_COMMENTS)
{
- pvarData->vt = VT_BSTR;
+ pvarData->vt = VT_BSTR;
pvarData->bstrVal =
SysAllocString(meta_info_accessor.getTagData( META_INFO_DESCRIPTION).c_str());
-
+
return S_OK;
- }
+ }
else if (IsEqualGUID (pscid->fmtid,
FMTID_SummaryInformation) && pscid->pid == PIDSI_PAGECOUNT)
{
- pvarData->vt = VT_BSTR;
+ pvarData->vt = VT_BSTR;
pvarData->bstrVal =
SysAllocString(meta_info_accessor.getTagAttribute(
META_INFO_DOCUMENT_STATISTIC, META_INFO_PAGES).c_str());
-
+
return S_OK;
- }
+ }
}
catch (const std::exception&)
{
@@ -213,7 +213,7 @@ HRESULT STDMETHODCALLTYPE
CColumnInfo::GetItemData(LPCSHCOLUMNID pscid, LPCSHCOL
}
//-----------------------------
-//
+//
//-----------------------------
bool CColumnInfo::IsOOFileExtension(wchar_t* Extension) const
@@ -224,5 +224,7 @@ bool CColumnInfo::IsOOFileExtension(wchar_t* Extension)
const
return true;
}
- return false;
+ return false;
}
+
+/* vim: set noet sw=4 ts=4: */
diff --git a/main/shell/source/win32/shlxthandler/infotips/infotips.cxx
b/main/shell/source/win32/shlxthandler/infotips/infotips.cxx
index 95c9472096..d1ef1632fe 100644
--- a/main/shell/source/win32/shlxthandler/infotips/infotips.cxx
+++ b/main/shell/source/win32/shlxthandler/infotips/infotips.cxx
@@ -399,3 +399,5 @@ HRESULT STDMETHODCALLTYPE CInfoTip::GetCurFile(LPOLESTR
__RPC_FAR * /*ppszFileNa
{
return E_NOTIMPL;
}
+
+/* vim: set noet sw=4 ts=4: */
diff --git a/main/shell/source/win32/shlxthandler/ooofilt/stream_helper.cxx
b/main/shell/source/win32/shlxthandler/ooofilt/stream_helper.cxx
index 983b313bef..3d76f1a06c 100644
--- a/main/shell/source/win32/shlxthandler/ooofilt/stream_helper.cxx
+++ b/main/shell/source/win32/shlxthandler/ooofilt/stream_helper.cxx
@@ -1,5 +1,5 @@
/**************************************************************
- *
+ *
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -7,16 +7,16 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- *
+ *
*************************************************************/
@@ -30,7 +30,7 @@
#include <windows.h>
#if defined _MSC_VER
#pragma warning(pop)
-#endif
+#endif
#include <stdio.h>
#include <objidl.h>
@@ -64,38 +64,38 @@ extern "C" {
//-----------------------------
IStream* PrepareIStream( IStream* pStream, zlib_filefunc_def &zFileFunc )
{
- // These next few lines work around the "Seek pointer" bug found on Vista.
- char cBuf[20];
- unsigned long nCount;
- HRESULT hr;
- ULARGE_INTEGER nNewPosition;
- LARGE_INTEGER nMove;
- nMove.QuadPart = 0;
- hr = pStream->Seek( nMove, STREAM_SEEK_SET, &nNewPosition );
- hr = pStream->Read( cBuf, 20, &nCount );
-
- fill_stream_filefunc( &zFileFunc );
- zFileFunc.opaque = (void*)pStream;
-
- return pStream;
+ // These next few lines work around the "Seek pointer" bug found on
Vista.
+ char cBuf[20];
+ unsigned long nCount;
+ HRESULT hr;
+ ULARGE_INTEGER nNewPosition;
+ LARGE_INTEGER nMove;
+ nMove.QuadPart = 0;
+ hr = pStream->Seek( nMove, STREAM_SEEK_SET, &nNewPosition );
+ hr = pStream->Read( cBuf, 20, &nCount );
+
+ fill_stream_filefunc( &zFileFunc );
+ zFileFunc.opaque = (void*)pStream;
+
+ return pStream;
}
extern "C" {
// IStream callback
- voidpf ZCALLBACK cb_sopen (voidpf opaque, const char* /*filename*/, int
/*mode*/) {
+ voidpf ZCALLBACK cb_sopen (voidpf opaque, const char* /*filename*/, int
/*mode*/) {
return opaque;
}
uLong ZCALLBACK cb_sread (voidpf /*opaque*/, voidpf stream, void* buf,
uLong size) {
unsigned long newsize;
HRESULT hr;
-
+
hr = ((IStream *)stream)->Read (buf, size, &newsize);
if (hr == S_OK){
return (unsigned long)newsize;
}
- else {
+ else {
return (uLong)0;
}
}
@@ -104,8 +104,8 @@ extern "C" {
// IStream::Seek parameters
HRESULT hr;
LARGE_INTEGER Move;
- DWORD dwOrigin;
- Move.QuadPart = (__int64)offset;
+ DWORD dwOrigin;
+ Move.QuadPart = (__int64)offset;
switch (origin) {
case SEEK_CUR:
@@ -120,12 +120,12 @@ extern "C" {
default:
return -1;
}
-
+
hr = ((IStream*)stream)->Seek (Move, dwOrigin, NULL);
- if (hr == S_OK){
+ if (hr == S_OK){
return 0;
}
- else {
+ else {
return -1;
}
}
@@ -137,9 +137,9 @@ extern "C" {
ULARGE_INTEGER NewPosition;
Move.QuadPart = 0;
NewPosition.QuadPart = 0;
-
+
hr = ((IStream*)stream)->Seek (Move, STREAM_SEEK_CUR,
&NewPosition);
- if (hr == S_OK){
+ if (hr == S_OK){
return (long) NewPosition.QuadPart;
}
else {
@@ -152,7 +152,7 @@ extern "C" {
}
int ZCALLBACK cb_serror (voidpf /*opaque*/, voidpf /*stream*/) {
- return 0; //RJK - for now
+ return 0; // RJK - for now
}
uLong ZCALLBACK cb_swrite (voidpf /*opaque*/, voidpf stream, const
void* buf, uLong size) {
@@ -172,6 +172,8 @@ extern "C" {
pzlib_filefunc_def->ztell_file = cb_stell;
pzlib_filefunc_def->zseek_file = cb_sseek;
pzlib_filefunc_def->zclose_file = cb_sclose;
- pzlib_filefunc_def->zerror_file = cb_serror;
+ pzlib_filefunc_def->zerror_file = cb_serror;
}
}
+
+/* vim: set noet sw=4 ts=4: */
diff --git a/main/shell/source/win32/shlxthandler/prophdl/propertyhdl.cxx
b/main/shell/source/win32/shlxthandler/prophdl/propertyhdl.cxx
index 8405e5d822..4cddd3d77f 100644
--- a/main/shell/source/win32/shlxthandler/prophdl/propertyhdl.cxx
+++ b/main/shell/source/win32/shlxthandler/prophdl/propertyhdl.cxx
@@ -1,5 +1,5 @@
/**************************************************************
- *
+ *
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -7,16 +7,16 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- *
+ *
*************************************************************/
@@ -43,24 +43,24 @@
//---------------------------
long g_DllRefCnt = 0;
HINSTANCE g_hModule = NULL;
-
+
//
// Map of property keys to the locations of their value(s) in the .??? XML
schema
//
struct PROPERTYMAP
{
- PROPERTYKEY key;
- PCWSTR pszXPathParent;
- PCWSTR pszValueNodeName;
+ PROPERTYKEY key;
+ PCWSTR pszXPathParent;
+ PCWSTR pszValueNodeName;
};
PROPERTYMAP g_rgPROPERTYMAP[] =
{
- { PKEY_Title, L"OpenOffice", L"Title" },
- { PKEY_Author, L"OpenOffice", L"Author" },
- { PKEY_Subject, L"OpenOffice", L"Subject" },
- { PKEY_Keywords, L"OpenOffice", L"Keyword" },
- { PKEY_Comment, L"OpenOffice", L"Comments" },
+ { PKEY_Title, L"OpenOffice", L"Title" },
+ { PKEY_Author, L"OpenOffice", L"Author" },
+ { PKEY_Subject, L"OpenOffice", L"Subject" },
+ { PKEY_Keywords, L"OpenOffice", L"Keyword" },
+ { PKEY_Comment, L"OpenOffice", L"Comments" },
};
size_t gPropertyMapTableSize =
sizeof(g_rgPROPERTYMAP)/sizeof(g_rgPROPERTYMAP[0]);
@@ -70,11 +70,11 @@ size_t gPropertyMapTableSize =
sizeof(g_rgPROPERTYMAP)/sizeof(g_rgPROPERTYMAP[0]
//----------------------------
CPropertyHdl::CPropertyHdl( long nRefCnt ) :
- m_RefCnt( nRefCnt ),
- m_pCache( NULL )
+ m_RefCnt( nRefCnt ),
+ m_pCache( NULL )
{
- OutputDebugStringFormat( "CPropertyHdl: CTOR\n" );
- InterlockedIncrement( &g_DllRefCnt );
+ OutputDebugStringFormat( "CPropertyHdl: CTOR\n" );
+ InterlockedIncrement( &g_DllRefCnt );
}
//----------------------------
@@ -83,12 +83,12 @@ CPropertyHdl::CPropertyHdl( long nRefCnt ) :
CPropertyHdl::~CPropertyHdl()
{
- if ( m_pCache )
- {
- m_pCache->Release();
- m_pCache = NULL;
- }
- InterlockedDecrement( &g_DllRefCnt );
+ if ( m_pCache )
+ {
+ m_pCache->Release();
+ m_pCache = NULL;
+ }
+ InterlockedDecrement( &g_DllRefCnt );
}
//-----------------------------
@@ -96,35 +96,35 @@ CPropertyHdl::~CPropertyHdl()
//-----------------------------
HRESULT STDMETHODCALLTYPE CPropertyHdl::QueryInterface(REFIID riid, void
__RPC_FAR *__RPC_FAR *ppvObject)
{
- *ppvObject = 0;
-
- if (IID_IUnknown == riid || IID_IPropertyStore == riid)
- {
- OutputDebugStringFormat( "CPropertyHdl: QueryInterface
(IID_IPropertyStore)\n" );
- IUnknown* pUnk = static_cast<IPropertyStore*>(this);
- pUnk->AddRef();
- *ppvObject = pUnk;
- return S_OK;
- }
- else if (IID_IPropertyStoreCapabilities == riid)
- {
- OutputDebugStringFormat( "CPropertyHdl: QueryInterface
(IID_IPropertyStoreCapabilities)\n" );
- IUnknown* pUnk = static_cast<IPropertyStore*>(this);
- pUnk->AddRef();
- *ppvObject = pUnk;
- return S_OK;
- }
- else if (IID_IInitializeWithStream == riid)
- {
- OutputDebugStringFormat( "CPropertyHdl: QueryInterface
(IID_IInitializeWithStream)\n" );
- IUnknown* pUnk = static_cast<IInitializeWithStream*>(this);
- pUnk->AddRef();
- *ppvObject = pUnk;
- return S_OK;
- }
- OutputDebugStringFormat( "CPropertyHdl: QueryInterface (something
different)\n" );
-
- return E_NOINTERFACE;
+ *ppvObject = 0;
+
+ if (IID_IUnknown == riid || IID_IPropertyStore == riid)
+ {
+ OutputDebugStringFormat( "CPropertyHdl: QueryInterface
(IID_IPropertyStore)\n" );
+ IUnknown* pUnk = static_cast<IPropertyStore*>(this);
+ pUnk->AddRef();
+ *ppvObject = pUnk;
+ return S_OK;
+ }
+ else if (IID_IPropertyStoreCapabilities == riid)
+ {
+ OutputDebugStringFormat( "CPropertyHdl: QueryInterface
(IID_IPropertyStoreCapabilities)\n" );
+ IUnknown* pUnk = static_cast<IPropertyStore*>(this);
+ pUnk->AddRef();
+ *ppvObject = pUnk;
+ return S_OK;
+ }
+ else if (IID_IInitializeWithStream == riid)
+ {
+ OutputDebugStringFormat( "CPropertyHdl: QueryInterface
(IID_IInitializeWithStream)\n" );
+ IUnknown* pUnk = static_cast<IInitializeWithStream*>(this);
+ pUnk->AddRef();
+ *ppvObject = pUnk;
+ return S_OK;
+ }
+ OutputDebugStringFormat( "CPropertyHdl: QueryInterface (something
different)\n" );
+
+ return E_NOINTERFACE;
}
//----------------------------
@@ -149,54 +149,54 @@ ULONG STDMETHODCALLTYPE CPropertyHdl::Release( void )
//-----------------------------
HRESULT STDMETHODCALLTYPE CPropertyHdl::GetCount( DWORD *pcProps )
{
- HRESULT hr = E_UNEXPECTED;
- if ( m_pCache && pcProps )
- {
- hr = m_pCache->GetCount( pcProps );
- }
+ HRESULT hr = E_UNEXPECTED;
+ if ( m_pCache && pcProps )
+ {
+ hr = m_pCache->GetCount( pcProps );
+ }
- return hr;
+ return hr;
}
//-----------------------------
HRESULT STDMETHODCALLTYPE CPropertyHdl::GetAt( DWORD iProp, PROPERTYKEY *pKey )
{
- HRESULT hr = E_UNEXPECTED;
- if ( m_pCache )
- {
- hr = m_pCache->GetAt( iProp, pKey );
- }
+ HRESULT hr = E_UNEXPECTED;
+ if ( m_pCache )
+ {
+ hr = m_pCache->GetAt( iProp, pKey );
+ }
- return hr;
+ return hr;
}
//-----------------------------
HRESULT STDMETHODCALLTYPE CPropertyHdl::GetValue( REFPROPERTYKEY key,
PROPVARIANT *pPropVar )
{
- HRESULT hr = E_UNEXPECTED;
- if ( m_pCache )
- {
- hr = m_pCache->GetValue( key, pPropVar );
- }
+ HRESULT hr = E_UNEXPECTED;
+ if ( m_pCache )
+ {
+ hr = m_pCache->GetValue( key, pPropVar );
+ }
- return hr;
+ return hr;
}
//-----------------------------
HRESULT STDMETHODCALLTYPE CPropertyHdl::SetValue( REFPROPERTYKEY key,
REFPROPVARIANT propVar )
{
- HRESULT hr = E_UNEXPECTED;
- if ( m_pCache )
- {
- hr = STG_E_ACCESSDENIED;
- }
- return hr;
+ HRESULT hr = E_UNEXPECTED;
+ if ( m_pCache )
+ {
+ hr = STG_E_ACCESSDENIED;
+ }
+ return hr;
}
//-----------------------------
HRESULT STDMETHODCALLTYPE CPropertyHdl::Commit()
{
- return S_OK;
+ return S_OK;
}
//-----------------------------
@@ -204,8 +204,8 @@ HRESULT STDMETHODCALLTYPE CPropertyHdl::Commit()
//-----------------------------
HRESULT STDMETHODCALLTYPE CPropertyHdl::IsPropertyWritable( REFPROPERTYKEY key
)
{
- // We start with read only properties only
- return S_FALSE;
+ // We start with read only properties only
+ return S_FALSE;
}
//-----------------------------
@@ -213,224 +213,224 @@ HRESULT STDMETHODCALLTYPE
CPropertyHdl::IsPropertyWritable( REFPROPERTYKEY key )
//-----------------------------
HRESULT STDMETHODCALLTYPE CPropertyHdl::Initialize( IStream *pStream, DWORD
grfMode )
{
- if ( grfMode & STGM_READWRITE )
- return STG_E_ACCESSDENIED;
+ if ( grfMode & STGM_READWRITE )
+ return STG_E_ACCESSDENIED;
- if ( !m_pCache )
- {
+ if ( !m_pCache )
+ {
#ifdef __MINGW32__
- if ( FAILED( PSCreateMemoryPropertyStore( IID_IPropertyStoreCache,
reinterpret_cast<void**>(&m_pCache) ) ) )
+ if ( FAILED( PSCreateMemoryPropertyStore(
IID_IPropertyStoreCache, reinterpret_cast<void**>(&m_pCache) ) ) )
#else
- if ( FAILED( PSCreateMemoryPropertyStore( IID_PPV_ARGS( &m_pCache ) )
) )
+ if ( FAILED( PSCreateMemoryPropertyStore( IID_PPV_ARGS(
&m_pCache ) ) ) )
#endif
- OutputDebugStringFormat( "CPropertyHdl::Initialize:
PSCreateMemoryPropertyStore failed" );
-
- zlib_filefunc_def z_filefunc;
- pStream = PrepareIStream( pStream, z_filefunc );
-
- CMetaInfoReader *pMetaInfoReader = NULL;
-
- try
- {
- pMetaInfoReader = new CMetaInfoReader( (void*)pStream, &z_filefunc
);
- LoadProperties( pMetaInfoReader );
- delete pMetaInfoReader;
- }
- catch (const std::exception& e)
- {
- OutputDebugStringFormat( "CPropertyHdl::Initialize: Caught
exception [%s]", e.what() );
- return E_FAIL;
- }
+ OutputDebugStringFormat( "CPropertyHdl::Initialize:
PSCreateMemoryPropertyStore failed" );
+
+ zlib_filefunc_def z_filefunc;
+ pStream = PrepareIStream( pStream, z_filefunc );
+
+ CMetaInfoReader *pMetaInfoReader = NULL;
+
+ try
+ {
+ pMetaInfoReader = new CMetaInfoReader( (void*)pStream,
&z_filefunc );
+ LoadProperties( pMetaInfoReader );
+ delete pMetaInfoReader;
+ }
+ catch (const std::exception& e)
+ {
+ OutputDebugStringFormat( "CPropertyHdl::Initialize:
Caught exception [%s]", e.what() );
+ return E_FAIL;
+ }
/*
- // load extended properties and search content
- _LoadExtendedProperties();
- _LoadSearchContent();
+ // load extended properties and search content
+ _LoadExtendedProperties();
+ _LoadSearchContent();
*/
- }
+ }
- return S_OK;
+ return S_OK;
}
//-----------------------------
void CPropertyHdl::LoadProperties( CMetaInfoReader *pMetaInfoReader )
{
- OutputDebugStringFormat( "CPropertyHdl: LoadProperties\n" );
- PROPVARIANT propvarValues;
-
- for ( UINT i = 0; i < (UINT)gPropertyMapTableSize; ++i )
- {
- PropVariantClear( &propvarValues );
- HRESULT hr = GetItemData( pMetaInfoReader, i, &propvarValues);
- if (hr == S_OK)
- {
- // coerce the value(s) to the appropriate type for the property key
- hr = PSCoerceToCanonicalValue( g_rgPROPERTYMAP[i].key,
&propvarValues );
- if (SUCCEEDED(hr))
- {
- // cache the value(s) loaded
- hr = m_pCache->SetValueAndState( g_rgPROPERTYMAP[i].key,
&propvarValues, PSC_NORMAL );
- }
- }
- }
+ OutputDebugStringFormat( "CPropertyHdl: LoadProperties\n" );
+ PROPVARIANT propvarValues;
+
+ for ( UINT i = 0; i < (UINT)gPropertyMapTableSize; ++i )
+ {
+ PropVariantClear( &propvarValues );
+ HRESULT hr = GetItemData( pMetaInfoReader, i, &propvarValues);
+ if (hr == S_OK)
+ {
+ // coerce the value(s) to the appropriate type for the
property key
+ hr = PSCoerceToCanonicalValue( g_rgPROPERTYMAP[i].key,
&propvarValues );
+ if (SUCCEEDED(hr))
+ {
+ // cache the value(s) loaded
+ hr = m_pCache->SetValueAndState(
g_rgPROPERTYMAP[i].key, &propvarValues, PSC_NORMAL );
+ }
+ }
+ }
}
//-----------------------------
HRESULT CPropertyHdl::GetItemData( CMetaInfoReader *pMetaInfoReader, UINT
nIndex, PROPVARIANT *pVarData )
{
- switch (nIndex) {
- case 0: {
- pVarData->vt = VT_BSTR;
- pVarData->bstrVal = SysAllocString( pMetaInfoReader->getTagData(
META_INFO_TITLE ).c_str() );
- OutputDebugStringFormat( "CPropertyHdl::GetItemData: Title=%S.\n",
pMetaInfoReader->getTagData( META_INFO_TITLE ).c_str() );
- return S_OK;
- }
- case 1: {
- pVarData->vt = VT_BSTR;
+ switch (nIndex) {
+ case 0: {
+ pVarData->vt = VT_BSTR;
+ pVarData->bstrVal = SysAllocString(
pMetaInfoReader->getTagData( META_INFO_TITLE ).c_str() );
+ OutputDebugStringFormat( "CPropertyHdl::GetItemData:
Title=%S.\n", pMetaInfoReader->getTagData( META_INFO_TITLE ).c_str() );
+ return S_OK;
+ }
+ case 1: {
+ pVarData->vt = VT_BSTR;
pVarData->bstrVal = SysAllocString(
pMetaInfoReader->getTagData( META_INFO_AUTHOR ).c_str() );
- OutputDebugStringFormat( "CPropertyHdl::GetItemData:
Author=%S.\n", pMetaInfoReader->getTagData( META_INFO_AUTHOR ).c_str() );
+ OutputDebugStringFormat( "CPropertyHdl::GetItemData:
Author=%S.\n", pMetaInfoReader->getTagData( META_INFO_AUTHOR ).c_str() );
return S_OK;
}
- case 2: {
- pVarData->vt = VT_BSTR;
+ case 2: {
+ pVarData->vt = VT_BSTR;
pVarData->bstrVal = SysAllocString(
pMetaInfoReader->getTagData( META_INFO_SUBJECT ).c_str() );
- OutputDebugStringFormat( "CPropertyHdl::GetItemData:
Subject=%S.\n", pMetaInfoReader->getTagData( META_INFO_SUBJECT ).c_str() );
+ OutputDebugStringFormat( "CPropertyHdl::GetItemData:
Subject=%S.\n", pMetaInfoReader->getTagData( META_INFO_SUBJECT ).c_str() );
return S_OK;
}
- case 3: {
- pVarData->vt = VT_BSTR;
- pVarData->bstrVal = SysAllocString( pMetaInfoReader->getTagData(
META_INFO_KEYWORDS ).c_str() );
- OutputDebugStringFormat( "CPropertyHdl::GetItemData:
Keywords=%S.\n", pMetaInfoReader->getTagData( META_INFO_KEYWORDS ).c_str() );
- return S_OK;
- }
- case 4: {
- pVarData->vt = VT_BSTR;
- pVarData->bstrVal = SysAllocString( pMetaInfoReader->getTagData(
META_INFO_DESCRIPTION ).c_str() );
- OutputDebugStringFormat( "CPropertyHdl::GetItemData:
Description=%S.\n", pMetaInfoReader->getTagData( META_INFO_DESCRIPTION
).c_str() );
- return S_OK;
- }
- case 5: {
- pVarData->vt = VT_BSTR;
- pVarData->bstrVal = SysAllocString(
pMetaInfoReader->getTagAttribute( META_INFO_DOCUMENT_STATISTIC, META_INFO_PAGES
).c_str() );
- OutputDebugStringFormat( "CPropertyHdl::GetItemData: Pages=%S.\n",
pMetaInfoReader->getTagAttribute( META_INFO_DOCUMENT_STATISTIC, META_INFO_PAGES
).c_str() );
- return S_OK;
- }
- }
+ case 3: {
+ pVarData->vt = VT_BSTR;
+ pVarData->bstrVal = SysAllocString(
pMetaInfoReader->getTagData( META_INFO_KEYWORDS ).c_str() );
+ OutputDebugStringFormat( "CPropertyHdl::GetItemData:
Keywords=%S.\n", pMetaInfoReader->getTagData( META_INFO_KEYWORDS ).c_str() );
+ return S_OK;
+ }
+ case 4: {
+ pVarData->vt = VT_BSTR;
+ pVarData->bstrVal = SysAllocString(
pMetaInfoReader->getTagData( META_INFO_DESCRIPTION ).c_str() );
+ OutputDebugStringFormat( "CPropertyHdl::GetItemData:
Description=%S.\n", pMetaInfoReader->getTagData( META_INFO_DESCRIPTION
).c_str() );
+ return S_OK;
+ }
+ case 5: {
+ pVarData->vt = VT_BSTR;
+ pVarData->bstrVal = SysAllocString(
pMetaInfoReader->getTagAttribute( META_INFO_DOCUMENT_STATISTIC, META_INFO_PAGES
).c_str() );
+ OutputDebugStringFormat( "CPropertyHdl::GetItemData:
Pages=%S.\n", pMetaInfoReader->getTagAttribute( META_INFO_DOCUMENT_STATISTIC,
META_INFO_PAGES ).c_str() );
+ return S_OK;
+ }
+ }
return S_FALSE;
}
//-----------------------------------------------------------------------------
-// CClassFactory
+// CClassFactory
//-----------------------------------------------------------------------------
long CClassFactory::s_ServerLocks = 0;
//-----------------------------------------------------------------------------
CClassFactory::CClassFactory( const CLSID& clsid ) :
- m_RefCnt(1),
- m_Clsid(clsid)
+ m_RefCnt(1),
+ m_Clsid(clsid)
{
- InterlockedIncrement( &g_DllRefCnt );
+ InterlockedIncrement( &g_DllRefCnt );
}
//-----------------------------------------------------------------------------
CClassFactory::~CClassFactory()
{
- InterlockedDecrement( &g_DllRefCnt );
+ InterlockedDecrement( &g_DllRefCnt );
}
//-----------------------------------------------------------------------------
-// IUnknown methods
+// IUnknown methods
//-----------------------------------------------------------------------------
HRESULT STDMETHODCALLTYPE CClassFactory::QueryInterface( REFIID riid, void
__RPC_FAR *__RPC_FAR *ppvObject )
{
- *ppvObject = 0;
-
- if ( IID_IUnknown == riid || IID_IClassFactory == riid )
- {
- IUnknown* pUnk = this;
- pUnk->AddRef();
- *ppvObject = pUnk;
- return S_OK;
- }
+ *ppvObject = 0;
+
+ if ( IID_IUnknown == riid || IID_IClassFactory == riid )
+ {
+ IUnknown* pUnk = this;
+ pUnk->AddRef();
+ *ppvObject = pUnk;
+ return S_OK;
+ }
- return E_NOINTERFACE;
+ return E_NOINTERFACE;
}
//-----------------------------------------------------------------------------
ULONG STDMETHODCALLTYPE CClassFactory::AddRef( void )
{
- return InterlockedIncrement( &m_RefCnt );
+ return InterlockedIncrement( &m_RefCnt );
}
//-----------------------------------------------------------------------------
ULONG STDMETHODCALLTYPE CClassFactory::Release( void )
{
- long refcnt = InterlockedDecrement( &m_RefCnt );
+ long refcnt = InterlockedDecrement( &m_RefCnt );
- if (0 == refcnt)
- delete this;
+ if (0 == refcnt)
+ delete this;
- return refcnt;
+ return refcnt;
}
//-----------------------------------------------------------------------------
-// IClassFactory methods
+// IClassFactory methods
//-----------------------------------------------------------------------------
HRESULT STDMETHODCALLTYPE CClassFactory::CreateInstance(
- IUnknown __RPC_FAR *pUnkOuter,
- REFIID riid,
- void __RPC_FAR *__RPC_FAR *ppvObject)
+ IUnknown __RPC_FAR *pUnkOuter,
+ REFIID riid,
+ void __RPC_FAR *__RPC_FAR *ppvObject)
{
- if ( pUnkOuter != NULL )
- return CLASS_E_NOAGGREGATION;
+ if ( pUnkOuter != NULL )
+ return CLASS_E_NOAGGREGATION;
- IUnknown* pUnk = 0;
+ IUnknown* pUnk = 0;
- if ( CLSID_PROPERTY_HANDLER == m_Clsid )
- pUnk = static_cast<IPropertyStore*>( new CPropertyHdl() );
+ if ( CLSID_PROPERTY_HANDLER == m_Clsid )
+ pUnk = static_cast<IPropertyStore*>( new CPropertyHdl() );
- POST_CONDITION(pUnk != 0, "Could not create COM object");
+ POST_CONDITION(pUnk != 0, "Could not create COM object");
- if (0 == pUnk)
- return E_OUTOFMEMORY;
+ if (0 == pUnk)
+ return E_OUTOFMEMORY;
- HRESULT hr = pUnk->QueryInterface( riid, ppvObject );
+ HRESULT hr = pUnk->QueryInterface( riid, ppvObject );
- // if QueryInterface failed the component will destroy itself
- pUnk->Release();
+ // if QueryInterface failed the component will destroy itself
+ pUnk->Release();
- return hr;
+ return hr;
}
//-----------------------------------------------------------------------------
HRESULT STDMETHODCALLTYPE CClassFactory::LockServer( BOOL fLock )
{
- if ( fLock )
- InterlockedIncrement( &s_ServerLocks );
- else
- InterlockedDecrement( &s_ServerLocks );
+ if ( fLock )
+ InterlockedIncrement( &s_ServerLocks );
+ else
+ InterlockedDecrement( &s_ServerLocks );
- return S_OK;
+ return S_OK;
}
//-----------------------------------------------------------------------------
bool CClassFactory::IsLocked()
{
- return ( s_ServerLocks > 0 );
+ return ( s_ServerLocks > 0 );
}
//-----------------------------------------------------------------------------
extern "C" STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void** ppv)
{
- OutputDebugStringFormat( "DllGetClassObject.\n" );
- *ppv = 0;
+ OutputDebugStringFormat( "DllGetClassObject.\n" );
+ *ppv = 0;
- if ( rclsid != CLSID_PROPERTY_HANDLER )
- return CLASS_E_CLASSNOTAVAILABLE;
+ if ( rclsid != CLSID_PROPERTY_HANDLER )
+ return CLASS_E_CLASSNOTAVAILABLE;
- if ( (riid != IID_IUnknown) && (riid != IID_IClassFactory) )
- return E_NOINTERFACE;
+ if ( (riid != IID_IUnknown) && (riid != IID_IClassFactory) )
+ return E_NOINTERFACE;
IUnknown* pUnk = new CClassFactory( rclsid );
if ( 0 == pUnk )
@@ -443,17 +443,19 @@ extern "C" STDAPI DllGetClassObject(REFCLSID rclsid,
REFIID riid, void** ppv)
//-----------------------------------------------------------------------------
extern "C" STDAPI DllCanUnloadNow( void )
{
- OutputDebugStringFormat( "DllCanUnloadNow.\n" );
- if (CClassFactory::IsLocked() || g_DllRefCnt > 0)
- return S_FALSE;
+ OutputDebugStringFormat( "DllCanUnloadNow.\n" );
+ if (CClassFactory::IsLocked() || g_DllRefCnt > 0)
+ return S_FALSE;
- return S_OK;
+ return S_OK;
}
//-----------------------------------------------------------------------------
BOOL WINAPI DllMain( HINSTANCE hInst, ULONG /*ul_reason_for_call*/, LPVOID
/*lpReserved*/ )
{
- OutputDebugStringFormat( "DllMain.\n" );
- g_hModule = hInst;
- return TRUE;
+ OutputDebugStringFormat( "DllMain.\n" );
+ g_hModule = hInst;
+ return TRUE;
}
+
+/* vim: set noet sw=4 ts=4: */
diff --git a/main/shell/source/win32/shlxthandler/thumbviewer/thumbviewer.cxx
b/main/shell/source/win32/shlxthandler/thumbviewer/thumbviewer.cxx
index d6ddc252a1..d8d03f8aa5 100644
--- a/main/shell/source/win32/shlxthandler/thumbviewer/thumbviewer.cxx
+++ b/main/shell/source/win32/shlxthandler/thumbviewer/thumbviewer.cxx
@@ -1,5 +1,5 @@
/**************************************************************
- *
+ *
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -7,16 +7,16 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- *
+ *
*************************************************************/
@@ -48,7 +48,7 @@
#include <shellapi.h>
#if defined _MSC_VER
#pragma warning(pop)
-#endif
+#endif
#include <memory>
extern HINSTANCE g_hModule;
@@ -62,8 +62,8 @@ namespace internal
{
HRSRC hrc = FindResource(g_hModule, TEXT("#2000"), RT_RCDATA);
DWORD size = SizeofResource(g_hModule, hrc);
- HGLOBAL hglob = LoadResource(g_hModule, hrc);
- char* data = reinterpret_cast<char*>(LockResource(hglob));
+ HGLOBAL hglob = LoadResource(g_hModule, hrc);
+ char* data = reinterpret_cast<char*>(LockResource(hglob));
buffer = ZipFile::ZipContentBuffer_t(data, data + size);
}
@@ -71,29 +71,29 @@ namespace internal
{
return zipfile->HasContent("META-INF/documentsignatures.xml");
}
-
+
bool IsWindowsXP()
{
OSVERSIONINFO osvi;
- ZeroMemory(&osvi, sizeof(osvi));
- osvi.dwOSVersionInfoSize = sizeof(osvi);
- GetVersionEx(&osvi);
-
+ ZeroMemory(&osvi, sizeof(osvi));
+ osvi.dwOSVersionInfoSize = sizeof(osvi);
+ GetVersionEx(&osvi);
+
return ((osvi.dwPlatformId == VER_PLATFORM_WIN32_NT) &&
((osvi.dwMajorVersion >= 5) && (osvi.dwMinorVersion >= 1)));
}
-
- /* Calculate where to position the signet image.
+
+ /* 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
+ 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)
{
int x = 0;
- int y = 0;
+ int y = 0;
int hoffset = canvas.GetRight() - thumbnail_border.GetRight();
int voffset = canvas.GetBottom() - thumbnail_border.GetBottom();
@@ -119,12 +119,12 @@ class StreamOnZipBuffer : public IStream
{
public:
StreamOnZipBuffer(const ZipFile::ZipContentBuffer_t& zip_buffer);
-
+
// IUnknown
virtual ULONG STDMETHODCALLTYPE AddRef();
virtual ULONG STDMETHODCALLTYPE Release( void);
virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void
__RPC_FAR *__RPC_FAR *ppvObject);
-
+
// IStream
virtual HRESULT STDMETHODCALLTYPE Read(void *pv, ULONG cb, ULONG *pcbRead);
virtual HRESULT STDMETHODCALLTYPE Write(void const *pv, ULONG cb, ULONG
*pcbWritten);
@@ -137,7 +137,7 @@ public:
virtual HRESULT STDMETHODCALLTYPE UnlockRegion(ULARGE_INTEGER libOffset,
ULARGE_INTEGER cb, DWORD dwLockType);
virtual HRESULT STDMETHODCALLTYPE Stat(STATSTG *pstatstg, DWORD
grfStatFlag);
virtual HRESULT STDMETHODCALLTYPE Clone(IStream **ppstm);
-
+
private:
LONG ref_count_;
const ZipFile::ZipContentBuffer_t& ref_zip_buffer_;
@@ -342,7 +342,7 @@ ULONG STDMETHODCALLTYPE CThumbviewer::AddRef(void)
{
return InterlockedIncrement(&ref_count_);
}
-
+
ULONG STDMETHODCALLTYPE CThumbviewer::Release( void)
{
long refcnt = InterlockedDecrement(&ref_count_);
@@ -358,30 +358,30 @@ ULONG STDMETHODCALLTYPE CThumbviewer::Release( void)
const std::string THUMBNAIL_CONTENT = "Thumbnails/thumbnail.png";
HRESULT STDMETHODCALLTYPE CThumbviewer::Extract(HBITMAP *phBmpImage)
-{
+{
HRESULT hr = E_FAIL;
-
+
try
{
std::wstring fname = getShortPathName( filename_ );
- std::auto_ptr<ZipFile> zipfile( new ZipFile( WStringToString( fname )
) );
-
+ std::auto_ptr<ZipFile> zipfile( new ZipFile( WStringToString( fname )
) );
+
if (zipfile->HasContent(THUMBNAIL_CONTENT))
- {
- ZipFile::ZipContentBuffer_t thumbnail;
- zipfile->GetUncompressedContent(THUMBNAIL_CONTENT, thumbnail);
+ {
+ ZipFile::ZipContentBuffer_t thumbnail;
+ zipfile->GetUncompressedContent(THUMBNAIL_CONTENT, thumbnail);
IStream* stream = new StreamOnZipBuffer(thumbnail);
- Gdiplus::Bitmap thumbnail_png(stream, TRUE);
-
+ Gdiplus::Bitmap thumbnail_png(stream, TRUE);
+
if ((thumbnail_png.GetHeight() == 0) || (thumbnail_png.GetWidth()
== 0))
{
stream->Release();
return E_FAIL;
}
-
+
HWND hwnd = GetDesktopWindow();
- HDC hdc = GetDC(hwnd);
+ HDC hdc = GetDC(hwnd);
HDC memDC = CreateCompatibleDC(hdc);
if (memDC)
@@ -415,14 +415,14 @@ HRESULT STDMETHODCALLTYPE CThumbviewer::Extract(HBITMAP
*phBmpImage)
Gdiplus::Graphics graphics(memDC);
Gdiplus::Pen blackPen(Gdiplus::Color(255, 0, 0, 0), 1);
- Gdiplus::SolidBrush whiteBrush(Gdiplus::Color(255, 255, 255,
255));
+ Gdiplus::SolidBrush whiteBrush(Gdiplus::Color(255, 255, 255,
255));
graphics.FillRectangle(&whiteBrush, canvas);
scaledRect.X = (canvas.Width - scaledRect.Width) / 2;
scaledRect.Y = (canvas.Height - scaledRect.Height) / 2;
- Gdiplus::Rect border_rect(scaledRect.X, scaledRect.Y,
scaledRect.Width, scaledRect.Height);
- graphics.DrawRectangle(&blackPen, border_rect);
+ Gdiplus::Rect border_rect(scaledRect.X, scaledRect.Y,
scaledRect.Width, scaledRect.Height);
+ graphics.DrawRectangle(&blackPen, border_rect);
scaledRect.X += 1;
scaledRect.Y += 1;
@@ -448,82 +448,83 @@ HRESULT STDMETHODCALLTYPE CThumbviewer::Extract(HBITMAP
*phBmpImage)
0, 0, signet_->GetWidth(), signet_->GetHeight(),
Gdiplus::UnitPixel);
}
-
+
if (stat == Gdiplus::Ok)
{
- *phBmpImage = hMemBmp;
+ *phBmpImage = hMemBmp;
hr = NOERROR;
- }
-
+ }
+
SelectObject(memDC, hOldObj);
- DeleteDC(memDC);
- }
-
- ReleaseDC(hwnd, hdc);
- stream->Release();
- }
- }
- catch(std::exception&)
- {
- OutputDebugStringFormat( "CThumbviewer Extract ERROR!\n" );
- hr = E_FAIL;
- }
- return hr;
+ DeleteDC(memDC);
+ }
+
+ ReleaseDC(hwnd, hdc);
+ stream->Release();
+ }
+ }
+ catch(std::exception&)
+ {
+ OutputDebugStringFormat( "CThumbviewer Extract ERROR!\n" );
+ hr = E_FAIL;
+ }
+ return hr;
}
HRESULT STDMETHODCALLTYPE CThumbviewer::GetLocation(
- LPWSTR pszPathBuffer, DWORD cchMax, DWORD *pdwPriority, const SIZE
*prgSize, DWORD dwRecClrDepth, DWORD *pdwFlags)
+ LPWSTR pszPathBuffer, DWORD cchMax, DWORD *pdwPriority, const SIZE
*prgSize, DWORD dwRecClrDepth, DWORD *pdwFlags)
{
- if ((prgSize == NULL) || (pdwFlags == NULL) || ((*pdwFlags &
IEIFLAG_ASYNC) && (pdwPriority == NULL)))
- return E_INVALIDARG;
-
- thumbnail_size_ = *prgSize;
- color_depth_ = dwRecClrDepth;
-
- *pdwFlags = IEIFLAG_CACHE; // we don't cache the image
-
- wcsncpy(pszPathBuffer, filename_.c_str(), cchMax);
-
- return NOERROR;
+ if ((prgSize == NULL) || (pdwFlags == NULL) || ((*pdwFlags &
IEIFLAG_ASYNC) && (pdwPriority == NULL)))
+ return E_INVALIDARG;
+
+ thumbnail_size_ = *prgSize;
+ color_depth_ = dwRecClrDepth;
+
+ *pdwFlags = IEIFLAG_CACHE; // we don't cache the image
+
+ wcsncpy(pszPathBuffer, filename_.c_str(), cchMax);
+
+ return NOERROR;
}
-
+
// IPersist methods
HRESULT STDMETHODCALLTYPE CThumbviewer::GetClassID(CLSID* pClassID)
{
- pClassID = const_cast<CLSID*>(&CLSID_THUMBVIEWER_HANDLER);
- return S_OK;
+ pClassID = const_cast<CLSID*>(&CLSID_THUMBVIEWER_HANDLER);
+ return S_OK;
}
// IPersistFile methods
HRESULT STDMETHODCALLTYPE CThumbviewer::Load(LPCOLESTR pszFileName, DWORD)
-{
- filename_ = pszFileName;
- return S_OK;
+{
+ filename_ = pszFileName;
+ return S_OK;
}
HRESULT STDMETHODCALLTYPE CThumbviewer::IsDirty()
{ return E_NOTIMPL; }
-
+
HRESULT STDMETHODCALLTYPE CThumbviewer::Save(LPCOLESTR, BOOL)
{ return E_NOTIMPL; }
-
+
HRESULT STDMETHODCALLTYPE CThumbviewer::SaveCompleted(LPCOLESTR)
{ return E_NOTIMPL; }
-
+
HRESULT STDMETHODCALLTYPE CThumbviewer::GetCurFile(LPOLESTR __RPC_FAR*)
{ return E_NOTIMPL; }
Gdiplus::Rect CThumbviewer::CalcScaledAspectRatio(Gdiplus::Rect src,
Gdiplus::Rect dest)
{
- Gdiplus::Rect result;
- if (src.Width >= src.Height)
- result = Gdiplus::Rect(0, 0, dest.Width, src.Height * dest.Width /
src.Width);
- else
- result = Gdiplus::Rect(0, 0, src.Width * dest.Height / src.Height,
dest.Height);
+ Gdiplus::Rect result;
+ if (src.Width >= src.Height)
+ result = Gdiplus::Rect(0, 0, dest.Width, src.Height *
dest.Width / src.Width);
+ else
+ result = Gdiplus::Rect(0, 0, src.Width * dest.Height /
src.Height, dest.Height);
- return result;
+ return result;
}
+/* vim: set noet sw=4 ts=4: */