summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladimir Glazunov <vg@openoffice.org>2010-08-26 10:19:06 +0200
committerVladimir Glazunov <vg@openoffice.org>2010-08-26 10:19:06 +0200
commit9587364f011f889d6d65a175d57275e915f65672 (patch)
treede39437eabca9c581cea4c332d312d0ea4975468
parent8d2d20c440adb1092b734865e14286fceb9235ae (diff)
parent2d1d910aa46b5067f0f20f4b5dc07dca25667b5a (diff)
CWS-TOOLING: integrate CWS dv20ooo/DEV300_m87
-rwxr-xr-xshell/inc/internal/utilities.hxx6
-rwxr-xr-x[-rw-r--r--]shell/source/win32/shlxthandler/columninfo/columninfo.cxx5
-rwxr-xr-x[-rw-r--r--]shell/source/win32/shlxthandler/infotips/infotips.cxx6
-rwxr-xr-xshell/source/win32/shlxthandler/ooofilt/ooofilt.cxx3
-rwxr-xr-x[-rw-r--r--]shell/source/win32/shlxthandler/prophdl/propertyhdl.cxx4
-rwxr-xr-xshell/source/win32/shlxthandler/propsheets/propsheets.cxx99
-rwxr-xr-x[-rw-r--r--]shell/source/win32/shlxthandler/thumbviewer/thumbviewer.cxx3
-rwxr-xr-x[-rw-r--r--]shell/source/win32/shlxthandler/util/fileextensions.cxx11
-rwxr-xr-x[-rw-r--r--]shell/source/win32/shlxthandler/util/utilities.cxx22
9 files changed, 110 insertions, 49 deletions
diff --git a/shell/inc/internal/utilities.hxx b/shell/inc/internal/utilities.hxx
index 7ae7de59be..598eed3375 100755
--- a/shell/inc/internal/utilities.hxx
+++ b/shell/inc/internal/utilities.hxx
@@ -84,6 +84,12 @@ bool HasOnlySpaces(const std::wstring& String);
Windows Locale Identifier corresponding to input LocaleSet.
*/
+//---------------------------------
+/** Convert a long path name using Windows api call GetShortPathName
+*/
+std::wstring getShortPathName( const std::wstring& aLongName );
+
+
#ifndef OS2
LCID LocaleSetToLCID( const LocaleSet_t & Locale );
#endif
diff --git a/shell/source/win32/shlxthandler/columninfo/columninfo.cxx b/shell/source/win32/shlxthandler/columninfo/columninfo.cxx
index f8db1e8eba..eccbf903b5 100644..100755
--- a/shell/source/win32/shlxthandler/columninfo/columninfo.cxx
+++ b/shell/source/win32/shlxthandler/columninfo/columninfo.cxx
@@ -152,14 +152,15 @@ HRESULT STDMETHODCALLTYPE CColumnInfo::GetColumnInfo(DWORD dwIndex, SHCOLUMNINFO
//
//-----------------------------
- HRESULT STDMETHODCALLTYPE CColumnInfo::GetItemData(LPCSHCOLUMNID pscid, LPCSHCOLUMNDATA pscd, VARIANT *pvarData)
+HRESULT STDMETHODCALLTYPE CColumnInfo::GetItemData(LPCSHCOLUMNID pscid, LPCSHCOLUMNDATA pscd, VARIANT *pvarData)
{
if (IsOOFileExtension(pscd->pwszExt))
{
try
{
+ std::wstring fname = getShortPathName( std::wstring( pscd->wszFile ) );
- CMetaInfoReader meta_info_accessor(WStringToString(pscd->wszFile));
+ CMetaInfoReader meta_info_accessor(WStringToString(fname));
VariantClear(pvarData);
diff --git a/shell/source/win32/shlxthandler/infotips/infotips.cxx b/shell/source/win32/shlxthandler/infotips/infotips.cxx
index 58f8a877b2..6ef6b57d8f 100644..100755
--- a/shell/source/win32/shlxthandler/infotips/infotips.cxx
+++ b/shell/source/win32/shlxthandler/infotips/infotips.cxx
@@ -352,14 +352,16 @@ HRESULT STDMETHODCALLTYPE CInfoTip::Load(LPCOLESTR pszFileName, DWORD /*dwMode*/
std::wstring::iterator end = fname.end();
m_FileNameOnly = std::wstring(begin, end);
-
+
+ fname = getShortPathName( fname );
+
std::string fnameA = WStringToString(fname);
// #115531#
// ZeroMemory because strncpy doesn't '\0'-terminates the destination
// string; reserve the last place in the buffer for the final '\0'
// that's why '(sizeof(m_szFileName) - 1)'
- ZeroMemory(m_szFileName, sizeof(m_szFileName));
+ ZeroMemory(m_szFileName, sizeof(m_szFileName));
strncpy(m_szFileName, fnameA.c_str(), (sizeof(m_szFileName) - 1));
return S_OK;
diff --git a/shell/source/win32/shlxthandler/ooofilt/ooofilt.cxx b/shell/source/win32/shlxthandler/ooofilt/ooofilt.cxx
index 89b0cc435d..07e1b06137 100755
--- a/shell/source/win32/shlxthandler/ooofilt/ooofilt.cxx
+++ b/shell/source/win32/shlxthandler/ooofilt/ooofilt.cxx
@@ -657,7 +657,8 @@ SCODE STDMETHODCALLTYPE COooFilter::IsDirty()
SCODE STDMETHODCALLTYPE COooFilter::Load(LPCWSTR pszFileName, DWORD /*dwMode*/)
{
// Load just sets the filename for GetChunk to read and ignores the mode
- m_pwszFileName = pszFileName;
+ m_pwszFileName = getShortPathName( pszFileName );
+
// Open the file previously specified in call to IPersistFile::Load and get content.
try
{
diff --git a/shell/source/win32/shlxthandler/prophdl/propertyhdl.cxx b/shell/source/win32/shlxthandler/prophdl/propertyhdl.cxx
index cb5d7e2627..19699be01f 100644..100755
--- a/shell/source/win32/shlxthandler/prophdl/propertyhdl.cxx
+++ b/shell/source/win32/shlxthandler/prophdl/propertyhdl.cxx
@@ -237,14 +237,14 @@ HRESULT STDMETHODCALLTYPE CPropertyHdl::Initialize( IStream *pStream, DWORD grfM
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;
}
-
- LoadProperties( pMetaInfoReader );
/*
// load extended properties and search content
_LoadExtendedProperties();
diff --git a/shell/source/win32/shlxthandler/propsheets/propsheets.cxx b/shell/source/win32/shlxthandler/propsheets/propsheets.cxx
index b81461fcf9..536a49255c 100755
--- a/shell/source/win32/shlxthandler/propsheets/propsheets.cxx
+++ b/shell/source/win32/shlxthandler/propsheets/propsheets.cxx
@@ -77,7 +77,7 @@ CPropertySheet::CPropertySheet(long RefCnt) :
//-----------------------------
CPropertySheet::~CPropertySheet()
-{
+{
OutputDebugStringFormat("CPropertySheet::DTor [%d], [%d]", m_RefCnt, g_DllRefCnt );
InterlockedDecrement(&g_DllRefCnt);
}
@@ -157,13 +157,26 @@ HRESULT STDMETHODCALLTYPE CPropertySheet::Initialize(
NULL,
0)))
{
- DragQueryFileA(
- reinterpret_cast<HDROP>(medium.hGlobal),
- 0,
- m_szFileName,
- sizeof(m_szFileName));
-
- hr = S_OK;
+ UINT size = DragQueryFile( reinterpret_cast<HDROP>(medium.hGlobal), 0, 0, 0 );
+ if ( size != 0 )
+ {
+ TCHAR * buffer = new TCHAR[ size + 1 ];
+ UINT result_size = DragQueryFile( reinterpret_cast<HDROP>(medium.hGlobal),
+ 0, buffer, size + 1 );
+ if ( result_size != 0 )
+ {
+ std::wstring fname = getShortPathName( buffer );
+ std::string fnameA = WStringToString( fname );
+ ZeroMemory( m_szFileName, sizeof( m_szFileName ) );
+ strncpy( m_szFileName, fnameA.c_str(), ( sizeof( m_szFileName ) - 1 ) );
+ hr = S_OK;
+ }
+ else
+ hr = E_INVALIDARG;
+ delete [] buffer;
+ }
+ else
+ hr = E_INVALIDARG;
}
else
hr = E_INVALIDARG;
@@ -320,47 +333,53 @@ BOOL CALLBACK CPropertySheet::PropPageStatisticsProc(HWND hwnd, UINT uiMsg, WPAR
//##################################
void CPropertySheet::InitPropPageSummary(HWND hwnd, LPPROPSHEETPAGE /*lppsp*/)
{
- CMetaInfoReader metaInfo(m_szFileName);
-
- SetWindowText(GetDlgItem(hwnd,IDC_TITLE), metaInfo.getTagData( META_INFO_TITLE ).c_str() );
- SetWindowText(GetDlgItem(hwnd,IDC_AUTHOR), metaInfo.getTagData( META_INFO_AUTHOR ).c_str() );
- SetWindowText(GetDlgItem(hwnd,IDC_SUBJECT), metaInfo.getTagData( META_INFO_SUBJECT ).c_str() );
- SetWindowText(GetDlgItem(hwnd,IDC_KEYWORDS), metaInfo.getTagData( META_INFO_KEYWORDS ).c_str() );
-
- // comments read from meta.xml use "\n" for return, but this will not displayable in Edit control, add
- // "\r" before "\n" to form "\r\n" in order to display return in Edit control.
- std::wstring tempStr = metaInfo.getTagData( META_INFO_DESCRIPTION ).c_str();
- std::wstring::size_type itor = tempStr.find ( L"\n" , 0 );
- while (itor != std::wstring::npos)
+ try
+ {
+ CMetaInfoReader metaInfo(m_szFileName);
+
+ SetWindowText(GetDlgItem(hwnd,IDC_TITLE), metaInfo.getTagData( META_INFO_TITLE ).c_str() );
+ SetWindowText(GetDlgItem(hwnd,IDC_AUTHOR), metaInfo.getTagData( META_INFO_AUTHOR ).c_str() );
+ SetWindowText(GetDlgItem(hwnd,IDC_SUBJECT), metaInfo.getTagData( META_INFO_SUBJECT ).c_str() );
+ SetWindowText(GetDlgItem(hwnd,IDC_KEYWORDS), metaInfo.getTagData( META_INFO_KEYWORDS ).c_str() );
+
+ // comments read from meta.xml use "\n" for return, but this will not displayable in Edit control, add
+ // "\r" before "\n" to form "\r\n" in order to display return in Edit control.
+ std::wstring tempStr = metaInfo.getTagData( META_INFO_DESCRIPTION ).c_str();
+ std::wstring::size_type itor = tempStr.find ( L"\n" , 0 );
+ while (itor != std::wstring::npos)
+ {
+ tempStr.insert(itor, L"\r");
+ itor = tempStr.find(L"\n", itor + 2);
+ }
+ SetWindowText(GetDlgItem(hwnd,IDC_COMMENTS), tempStr.c_str());
+ }
+ catch (const std::exception&)
{
- tempStr.insert(itor, L"\r");
- itor = tempStr.find(L"\n", itor + 2);
}
- SetWindowText(GetDlgItem(hwnd,IDC_COMMENTS), tempStr.c_str());
-
}
//---------------------------------
/**
*/
void CPropertySheet::InitPropPageStatistics(HWND hwnd, LPPROPSHEETPAGE /*lppsp*/)
-{
- CMetaInfoReader metaInfo(m_szFileName);
-
- document_statistic_reader_ptr doc_stat_reader = create_document_statistic_reader(m_szFileName, &metaInfo);
-
- statistic_group_list_t sgl;
- doc_stat_reader->read(&sgl);
-
- list_view_builder_ptr lv_builder = create_list_view_builder(
- GetDlgItem(hwnd, IDC_STATISTICSLIST),
- GetResString(IDS_PROPERTY),
- GetResString(IDS_PROPERTY_VALUE));
-
- lv_builder->build(sgl);
-
-}
+{
+ try
+ {
+ CMetaInfoReader metaInfo(m_szFileName);
+ document_statistic_reader_ptr doc_stat_reader = create_document_statistic_reader(m_szFileName, &metaInfo);
+ statistic_group_list_t sgl;
+ doc_stat_reader->read(&sgl);
+ list_view_builder_ptr lv_builder = create_list_view_builder(
+ GetDlgItem(hwnd, IDC_STATISTICSLIST),
+ GetResString(IDS_PROPERTY),
+ GetResString(IDS_PROPERTY_VALUE));
+ lv_builder->build(sgl);
+ }
+ catch (const std::exception&)
+ {
+ }
+}
diff --git a/shell/source/win32/shlxthandler/thumbviewer/thumbviewer.cxx b/shell/source/win32/shlxthandler/thumbviewer/thumbviewer.cxx
index 23831d07be..180f5c2f60 100644..100755
--- a/shell/source/win32/shlxthandler/thumbviewer/thumbviewer.cxx
+++ b/shell/source/win32/shlxthandler/thumbviewer/thumbviewer.cxx
@@ -367,7 +367,8 @@ HRESULT STDMETHODCALLTYPE CThumbviewer::Extract(HBITMAP *phBmpImage)
try
{
- std::auto_ptr<ZipFile> zipfile(new ZipFile(WStringToString(filename_)));
+ std::wstring fname = getShortPathName( filename_ );
+ std::auto_ptr<ZipFile> zipfile( new ZipFile( WStringToString( fname ) ) );
if (zipfile->HasContent(THUMBNAIL_CONTENT))
{
diff --git a/shell/source/win32/shlxthandler/util/fileextensions.cxx b/shell/source/win32/shlxthandler/util/fileextensions.cxx
index dd89a32853..16d537890c 100644..100755
--- a/shell/source/win32/shlxthandler/util/fileextensions.cxx
+++ b/shell/source/win32/shlxthandler/util/fileextensions.cxx
@@ -27,6 +27,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_shell.hxx"
+#include "algorithm"
#include "internal/fileextensions.hxx"
//------------------------------------
@@ -87,10 +88,18 @@ std::string get_file_name_extension(const std::string& file_name)
/** Return the type of a file
*/
+char easytolower( char in )
+{
+ if( in<='Z' && in>='A' )
+ return in-('Z'-'z');
+ return in;
+}
+
File_Type_t get_file_type(const std::string& file_name)
{
std::string fext = get_file_name_extension(file_name);
-
+ std::transform(fext.begin(), fext.end(), fext.begin(), easytolower);
+
if (std::string::npos != WRITER_FILE_EXTENSIONS.find(fext))
return WRITER;
else if (std::string::npos != CALC_FILE_EXTENSIONS.find(fext))
diff --git a/shell/source/win32/shlxthandler/util/utilities.cxx b/shell/source/win32/shlxthandler/util/utilities.cxx
index 55353e20f9..486abb0dd6 100644..100755
--- a/shell/source/win32/shlxthandler/util/utilities.cxx
+++ b/shell/source/win32/shlxthandler/util/utilities.cxx
@@ -148,6 +148,28 @@ bool HasOnlySpaces(const std::wstring& String)
return true;
}
+//---------------------------------
+/** helper function to convert windows pathes to short form.
+ @returns
+ shortend path.
+*/
+
+std::wstring getShortPathName( const std::wstring& aLongName )
+{
+ std::wstring shortName = aLongName;
+ long length = GetShortPathName( aLongName.c_str(), NULL, 0 );
+
+ if ( length != 0 )
+ {
+ TCHAR* buffer = new TCHAR[ length+1 ];
+ length = GetShortPathName( aLongName.c_str(), buffer, length );
+ if ( length != 0 )
+ shortName = std::wstring( buffer );
+ delete [] buffer;
+ }
+ return shortName;
+}
+
/** convert LocaleSet pair into Microsoft List of Locale ID (LCID)
according to ISO-639 and ISO-3166.
http://etext.lib.virginia.edu/tei/iso639.html