summaryrefslogtreecommitdiff
path: root/fpicker
diff options
context:
space:
mode:
authorIlhan Yesil <ilhanyesil@gmx.de>2018-09-10 16:01:31 +0200
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2018-11-13 17:54:52 +0100
commit1b50fa88b148739a7b192ba70f08af2c6e326fd2 (patch)
tree18109155d881e346fdbcce222da426f7bd7adced /fpicker
parentafd4f48d164ca72a024159e0c6b7a49147351f64 (diff)
tdf#119747 FileSaveDialog: Windows dialog shows only one extension.
A temporary composed list of file types and extension types is build from the original list and provided to the IFileSaveDialog object, so that this dialog shows only one extension. Change-Id: Iae01c3e889ea38034332fc29e4cc397941930ac0 Reviewed-on: https://gerrit.libreoffice.org/60268 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Diffstat (limited to 'fpicker')
-rw-r--r--fpicker/source/win32/VistaFilePicker.cxx2
-rw-r--r--fpicker/source/win32/VistaFilePickerImpl.cxx39
-rw-r--r--fpicker/source/win32/VistaFilePickerImpl.hxx2
3 files changed, 37 insertions, 6 deletions
diff --git a/fpicker/source/win32/VistaFilePicker.cxx b/fpicker/source/win32/VistaFilePicker.cxx
index 0737100d07e6..e1eb66a9ce83 100644
--- a/fpicker/source/win32/VistaFilePicker.cxx
+++ b/fpicker/source/win32/VistaFilePicker.cxx
@@ -119,7 +119,7 @@ void SAL_CALL VistaFilePicker::appendFilter(const OUString& sTitle ,
{
RequestRef rRequest(new Request());
rRequest->setRequest (VistaFilePickerImpl::E_APPEND_FILTER);
- rRequest->setArgument(PROP_FILTER_TITLE, sTitle );
+ rRequest->setArgument(PROP_FILTER_TITLE, sTitle);
rRequest->setArgument(PROP_FILTER_VALUE, sFilter);
m_aAsyncExecute.triggerRequestThreadAware(rRequest, AsyncRequests::NON_BLOCKED);
diff --git a/fpicker/source/win32/VistaFilePickerImpl.cxx b/fpicker/source/win32/VistaFilePickerImpl.cxx
index ff0cf2c27956..aa33dcdacbdb 100644
--- a/fpicker/source/win32/VistaFilePickerImpl.cxx
+++ b/fpicker/source/win32/VistaFilePickerImpl.cxx
@@ -360,11 +360,22 @@ void VistaFilePickerImpl::impl_sta_appendFilter(const RequestRef& rRequest)
{
const OUString sTitle = rRequest->getArgumentOrDefault(PROP_FILTER_TITLE, OUString());
const OUString sFilter = rRequest->getArgumentOrDefault(PROP_FILTER_VALUE, OUString());
-
// SYNCHRONIZED->
::osl::ResettableMutexGuard aLock(m_aMutex);
- m_lFilters.addFilter(sTitle, sFilter);
+ const sal_Int32 idx = sTitle.indexOf("(.");
+ if (idx > 0)
+ {
+ const OUString sTitle_ = sTitle.copy(0, idx);
+ m_mapRealFilter[sTitle_] = std::make_pair(sTitle, sFilter);
+ m_lFilters.addFilter(sTitle_, sFilter);
+ }
+ else
+ {
+ m_mapRealFilter[sTitle] = std::make_pair(sTitle, sFilter);
+ m_lFilters.addFilter(sTitle, sFilter);
+ }
+
}
@@ -384,7 +395,20 @@ void VistaFilePickerImpl::impl_sta_appendFilterGroup(const RequestRef& rRequest)
for (i=0; i<c; ++i)
{
const css::beans::StringPair& rFilter = aFilterGroup[i];
- m_lFilters.addFilter(rFilter.First, rFilter.Second);
+ const OUString sTitle = rFilter.First;
+ const OUString sFilter = rFilter.Second;
+ const sal_Int32 idx = sTitle.indexOf("(.");
+ if (idx > 0)
+ {
+ const OUString sTitle_ = sTitle.copy(0, idx);
+ m_mapRealFilter[sTitle_] = std::make_pair(sTitle, sFilter);
+ m_lFilters.addFilter(sTitle_, sFilter);
+ }
+ else
+ {
+ m_mapRealFilter[sTitle] = std::make_pair(sTitle, sFilter);
+ m_lFilters.addFilter(sTitle, sFilter);
+ }
}
}
@@ -417,10 +441,15 @@ void VistaFilePickerImpl::impl_sta_getCurrentFilter(const RequestRef& rRequest)
OUString sTitle;
::sal_Int32 nRealIndex = (nIndex-1); // COM dialog base on 1 ... filter container on 0 .-)
if (
- (nRealIndex >= 0 ) &&
+ (nRealIndex >= 0) &&
(m_lFilters.getFilter(nRealIndex, sTitle))
- )
+ )
+ {
+ if (m_mapRealFilter.find(sTitle) != m_mapRealFilter.end())
+ sTitle = m_mapRealFilter[sTitle].first;
+
rRequest->setArgument(PROP_FILTER_TITLE, sTitle);
+ }
else if ( nRealIndex == -1 ) // Dialog not visible yet
{
sTitle = m_lFilters.getCurrentFilter();
diff --git a/fpicker/source/win32/VistaFilePickerImpl.hxx b/fpicker/source/win32/VistaFilePickerImpl.hxx
index 9cce75b5714f..460136a73b48 100644
--- a/fpicker/source/win32/VistaFilePickerImpl.hxx
+++ b/fpicker/source/win32/VistaFilePickerImpl.hxx
@@ -37,6 +37,7 @@
#include <osl/thread.hxx>
#include <osl/conditn.hxx>
#include <rtl/ustring.hxx>
+#include <map>
namespace fpicker{
namespace win32{
@@ -305,6 +306,7 @@ class VistaFilePickerImpl : private ::cppu::BaseMutex
/// @todo document me
CFilterContainer m_lFilters;
+ std::map<OUString, std::pair<OUString, OUString>> m_mapRealFilter;
/** help us to handle dialog events and provide them to interested office