fpicker/source/win32/VistaFilePicker.cxx | 19 +++++++++++++++++-- framework/source/fwe/helper/titlehelper.cxx | 15 +++++++++++++++ include/unotools/mediadescriptor.hxx | 1 + unotools/source/misc/mediadescriptor.cxx | 6 ++++++ 4 files changed, 39 insertions(+), 2 deletions(-)
New commits: commit 02a5cbb9814dc224114dfbf3bc0b6c53658450c9 Author: Ilhan Yesil <[email protected]> AuthorDate: Mon Nov 19 14:50:25 2018 +0100 Commit: Thorsten Behrens <[email protected]> CommitDate: Tue Nov 20 22:43:46 2018 +0100 tdf#121497 "Save As": File Format Type unchanged in Windows Added checks for filter title, so filter titles are Windows conform. Change-Id: I42485c465ea58540a99b8300c5205b902cb86a92 Reviewed-on: https://gerrit.libreoffice.org/63573 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <[email protected]> (cherry picked from commit c444eb7934d4a3c190e1d060805d9d175c1a9127) Reviewed-on: https://gerrit.libreoffice.org/63658 diff --git a/fpicker/source/win32/VistaFilePicker.cxx b/fpicker/source/win32/VistaFilePicker.cxx index e1eb66a9ce83..874bed2f5c5f 100644 --- a/fpicker/source/win32/VistaFilePicker.cxx +++ b/fpicker/source/win32/VistaFilePicker.cxx @@ -119,7 +119,14 @@ void SAL_CALL VistaFilePicker::appendFilter(const OUString& sTitle , { RequestRef rRequest(new Request()); rRequest->setRequest (VistaFilePickerImpl::E_APPEND_FILTER); - rRequest->setArgument(PROP_FILTER_TITLE, sTitle); + const sal_Int32 idx = sTitle.indexOf("(."); + if (idx > 0) + { + const OUString sTitle_ = sTitle.replaceAt(idx, 2, "(*."); + rRequest->setArgument(PROP_FILTER_TITLE, sTitle_); + } + else + rRequest->setArgument(PROP_FILTER_TITLE, sTitle); rRequest->setArgument(PROP_FILTER_VALUE, sFilter); m_aAsyncExecute.triggerRequestThreadAware(rRequest, AsyncRequests::NON_BLOCKED); @@ -129,7 +136,14 @@ void SAL_CALL VistaFilePicker::setCurrentFilter(const OUString& sTitle) { RequestRef rRequest(new Request()); rRequest->setRequest (VistaFilePickerImpl::E_SET_CURRENT_FILTER); - rRequest->setArgument(PROP_FILTER_TITLE, sTitle); + const sal_Int32 idx = sTitle.indexOf("(."); + if (idx > 0) + { + const OUString sTitle_ = sTitle.replaceAt(idx, 2, "(*."); + rRequest->setArgument(PROP_FILTER_TITLE, sTitle_); + } + else + rRequest->setArgument(PROP_FILTER_TITLE, sTitle); m_aAsyncExecute.triggerRequestThreadAware(rRequest, AsyncRequests::NON_BLOCKED); } @@ -142,6 +156,7 @@ OUString SAL_CALL VistaFilePicker::getCurrentFilter() m_aAsyncExecute.triggerRequestThreadAware(rRequest, AsyncRequests::BLOCKED); const OUString sTitle = rRequest->getArgumentOrDefault(PROP_FILTER_TITLE, OUString()); + return sTitle; } commit 8848881e25e75387a7ac26503c7da3787dd25b80 Author: Samuel Mehrbrodt <[email protected]> AuthorDate: Tue Nov 20 09:12:36 2018 +0100 Commit: Thorsten Behrens <[email protected]> CommitDate: Tue Nov 20 22:43:35 2018 +0100 tdf#121537 Display SuggestedSaveAsName in title if set Change-Id: I762eb7766a5cbe788c0a360c8a6f37b9b1106412 Reviewed-on: https://gerrit.libreoffice.org/63639 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <[email protected]> (cherry picked from commit 4355137901e18e24de2ab123fd0454147f1f3890) Reviewed-on: https://gerrit.libreoffice.org/63648 Reviewed-by: Thorsten Behrens <[email protected]> diff --git a/framework/source/fwe/helper/titlehelper.cxx b/framework/source/fwe/helper/titlehelper.cxx index 3d7943623753..36141cfba0f1 100644 --- a/framework/source/fwe/helper/titlehelper.cxx +++ b/framework/source/fwe/helper/titlehelper.cxx @@ -32,6 +32,7 @@ #include <unotools/configmgr.hxx> #include <unotools/bootstrap.hxx> +#include <unotools/mediadescriptor.hxx> #include <comphelper/sequenceashashmap.hxx> #include <rtl/ustrbuf.hxx> #include <osl/mutex.hxx> @@ -39,6 +40,11 @@ #include <vcl/opengl/OpenGLWrapper.hxx> #include <vcl/svapp.hxx> + +using namespace css; +using namespace css::uno; +using namespace css::frame; + namespace framework{ TitleHelper::TitleHelper(const css::uno::Reference< css::uno::XComponentContext >& rxContext) @@ -339,6 +345,10 @@ void TitleHelper::impl_updateTitleForModel (const css::uno::Reference< css::fram if (xURLProvider.is()) sURL = xURLProvider->getLocation (); + utl::MediaDescriptor aDescriptor(xModel->getArgs()); + const OUString sSuggestedSaveAsName = aDescriptor.getUnpackedValueOrDefault( + utl::MediaDescriptor::PROP_SUGGESTEDSAVEASNAME(), OUString()); + if (!sURL.isEmpty()) { sTitle = impl_convertURL2Title(sURL); @@ -346,6 +356,11 @@ void TitleHelper::impl_updateTitleForModel (const css::uno::Reference< css::fram xNumbers->releaseNumber (nLeasedNumber); nLeasedNumber = css::frame::UntitledNumbersConst::INVALID_NUMBER; } + else if (!sSuggestedSaveAsName.isEmpty()) + { + // tdf#121537 Use suggested save as name for title if file has not yet been saved + sTitle = sSuggestedSaveAsName; + } else { if (nLeasedNumber == css::frame::UntitledNumbersConst::INVALID_NUMBER) diff --git a/include/unotools/mediadescriptor.hxx b/include/unotools/mediadescriptor.hxx index 24e8d4678ec0..b568bd770f3a 100644 --- a/include/unotools/mediadescriptor.hxx +++ b/include/unotools/mediadescriptor.hxx @@ -99,6 +99,7 @@ class UNOTOOLS_DLLPUBLIC MediaDescriptor : public comphelper::SequenceAsHashMap static const OUString& PROP_MODEL(); static const OUString& PROP_VIEWONLY(); static const OUString& PROP_DOCUMENTBASEURL(); + static const OUString& PROP_SUGGESTEDSAVEASNAME(); // interface public: diff --git a/unotools/source/misc/mediadescriptor.cxx b/unotools/source/misc/mediadescriptor.cxx index 674f2a98a986..e0222f90ca89 100644 --- a/unotools/source/misc/mediadescriptor.cxx +++ b/unotools/source/misc/mediadescriptor.cxx @@ -326,6 +326,12 @@ const OUString& MediaDescriptor::PROP_DOCUMENTBASEURL() return sProp; } +const OUString& MediaDescriptor::PROP_SUGGESTEDSAVEASNAME() +{ + static const OUString sProp("SuggestedSaveAsName"); + return sProp; +} + MediaDescriptor::MediaDescriptor() : SequenceAsHashMap() { _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
