summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGian Domenico Ceccarini <gdceccarini@gmail.com>2017-05-29 12:42:20 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2017-05-29 14:43:06 +0200
commitccd8f402a79cbb43aa5bae7a11d3fcae92971c75 (patch)
treeaa249d8ec0f4c0ea03b53db96c4df27e604ba06e
parentfe13c249c8964355e39869a357c393f3208b6def (diff)
tdf#36747 Add extension in Tools > Options > Load / Save > General
This commit take care about adding extension and not the order of the filters. Change-Id: Id776da2c2407037628007001af0a35e992791b1d Reviewed-on: https://gerrit.libreoffice.org/38134 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
-rw-r--r--cui/source/options/optsave.cxx24
1 files changed, 21 insertions, 3 deletions
diff --git a/cui/source/options/optsave.cxx b/cui/source/options/optsave.cxx
index a64a998a17a1..52a8d3893c29 100644
--- a/cui/source/options/optsave.cxx
+++ b/cui/source/options/optsave.cxx
@@ -42,6 +42,7 @@
#include <unotools/optionsdlg.hxx>
#include <vcl/msgbox.hxx>
+#include <sfx2/fcontnr.hxx>
using namespace com::sun::star::uno;
using namespace com::sun::star::util;
@@ -528,7 +529,7 @@ IMPL_LINK( SvxSaveTabPage, AutoClickHdl_Impl, Button*, pBox, void )
}
}
-static OUString lcl_ExtracUIName(const Sequence<PropertyValue> &rProperties)
+static OUString lcl_ExtracUIName(const Sequence<PropertyValue> &rProperties, const OUString& rExtension)
{
OUString sName;
const PropertyValue* pPropVal = rProperties.getConstArray();
@@ -540,7 +541,16 @@ static OUString lcl_ExtracUIName(const Sequence<PropertyValue> &rProperties)
{
OUString sUIName;
if ( ( pPropVal->Value >>= sUIName ) && sUIName.getLength() )
- return sUIName;
+ {
+ if (!rExtension.isEmpty())
+ {
+ return sUIName + " (" + rExtension + ")";
+ }
+ else
+ {
+ return sUIName;
+ }
+ }
}
else if (rName == "Name")
{
@@ -574,9 +584,17 @@ IMPL_LINK( SvxSaveTabPage, FilterHdl_Impl, ListBox&, rBox, void )
for(int nFilter = 0; nFilter < pImpl->aFilterArr[nData].getLength(); nFilter++)
{
Any aProps = pImpl->xFact->getByName(pFilters[nFilter]);
+ // get the extension of the filter
+ OUString extension;
+ SfxFilterMatcher matcher;
+ std::shared_ptr<const SfxFilter> pFilter = matcher.GetFilter4FilterName(pFilters[nFilter]);
+ if (pFilter)
+ {
+ extension = pFilter->GetWildcard().getGlob().getToken(0, ';');
+ }
Sequence<PropertyValue> aProperties;
aProps >>= aProperties;
- pUIFilters[nFilter] = lcl_ExtracUIName(aProperties);
+ pUIFilters[nFilter] = lcl_ExtracUIName(aProperties, extension);
}
}
const OUString* pUIFilters = pImpl->aUIFilterArr[nData].getConstArray();