diff options
Diffstat (limited to 'fpicker/source/win32/filepicker/VistaFilePickerEventHandler.cxx')
-rw-r--r-- | fpicker/source/win32/filepicker/VistaFilePickerEventHandler.cxx | 102 |
1 files changed, 0 insertions, 102 deletions
diff --git a/fpicker/source/win32/filepicker/VistaFilePickerEventHandler.cxx b/fpicker/source/win32/filepicker/VistaFilePickerEventHandler.cxx index 00f8b5569b0b..12ca15ef6462 100644 --- a/fpicker/source/win32/filepicker/VistaFilePickerEventHandler.cxx +++ b/fpicker/source/win32/filepicker/VistaFilePickerEventHandler.cxx @@ -135,108 +135,6 @@ STDMETHODIMP VistaFilePickerEventHandler::OnFolderChange(IFileDialog* /*pDialog* return S_OK; } -//----------------------------------------------------------------------------- -::rtl::OUString lcl_getURLFromShellItem2 (IShellItem* pItem) -{ - LPOLESTR pStr = NULL; - ::rtl::OUString sURL; - - SIGDN eConversion = SIGDN_FILESYSPATH; - HRESULT hr = pItem->GetDisplayName ( eConversion, &pStr ); - - if ( FAILED(hr) ) - { - eConversion = SIGDN_URL; - hr = pItem->GetDisplayName ( eConversion, &pStr ); - - if ( FAILED(hr) ) - return ::rtl::OUString(); - - sURL = ::rtl::OUString(reinterpret_cast<sal_Unicode*>(pStr)); - } - else - { - ::osl::FileBase::getFileURLFromSystemPath( reinterpret_cast<sal_Unicode*>(pStr), sURL ); - } - - CoTaskMemFree (pStr); - return sURL; -} - -//----------------------------------------------------------------------------------------- -void lcl_updateVersionListDirectly(IFileDialog* pDialog) -{ - static const ::rtl::OUString SERVICENAME_REVISIONPERSISTENCE(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.DocumentRevisionListPersistence")); - static const ::sal_Int16 CONTROL_VERSIONLIST = css::ui::dialogs::ExtendedFilePickerElementIds::LISTBOX_VERSION; - - TFileDialog iDialog (pDialog); - TFileOpenDialog iOpen ; - TFileDialogCustomize iCustomize; - -#ifdef __MINGW32__ - iDialog->QueryInterface(IID_IFileOpenDialog, (void**)(&iOpen)); - iDialog->QueryInterface(IID_IFileDialogCustomize, (void**)(&iCustomize)); -#else - iDialog.query(&iOpen ); - iDialog.query(&iCustomize); -#endif - - // make sure version list match to the current selection always ... - // at least an empty version list will be better then the wrong one .-) - iCustomize->RemoveAllControlItems(CONTROL_VERSIONLIST); - - HRESULT hResult = E_FAIL; - ComPtr< IShellItemArray > iItems; - ComPtr< IShellItem > iItem; - - if (iOpen.is()) - { - hResult = iOpen->GetSelectedItems(&iItems); - if (FAILED(hResult)) - return; - - DWORD nCount; - hResult = iItems->GetCount(&nCount); - if ( FAILED(hResult) ) - return; - - // we can show one version list only within control - if (nCount != 1) - return; - - hResult = iItems->GetItemAt(0, &iItem); - } - else - if (iDialog.is()) - hResult = iDialog->GetCurrentSelection(&iItem); - - if ( FAILED(hResult) ) - return; - - const ::rtl::OUString sURL = lcl_getURLFromShellItem2(iItem); - if (sURL.getLength() < 1) - return; - try - { - css::uno::Reference< css::embed::XStorage > xStorage = ::comphelper::OStorageHelper::GetStorageFromURL(sURL, css::embed::ElementModes::READ); - if ( ! xStorage.is() ) - return; - - css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory(); - css::uno::Reference< css::document::XDocumentRevisionListPersistence > xReader (xSMGR->createInstance(SERVICENAME_REVISIONPERSISTENCE), css::uno::UNO_QUERY_THROW); - css::uno::Sequence< css::util::RevisionTag > lVersions = xReader->load(xStorage); - - for (::sal_Int32 i=0; i<lVersions.getLength(); ++i) - { - const css::util::RevisionTag& aTag = lVersions[i]; - iCustomize->AddControlItem(CONTROL_VERSIONLIST, i, reinterpret_cast<LPCTSTR>(aTag.Identifier.getStr())); - } - iCustomize->SetSelectedControlItem(CONTROL_VERSIONLIST, 0); - } - catch(const css::uno::Exception&) - {} -} - //----------------------------------------------------------------------------------------- STDMETHODIMP VistaFilePickerEventHandler::OnSelectionChange(IFileDialog* /*pDialog*/) { |