Kaydet (Commit) 43551379 authored tarafından Samuel Mehrbrodt's avatar Samuel Mehrbrodt

tdf#121537 Display SuggestedSaveAsName in title if set

Change-Id: I762eb7766a5cbe788c0a360c8a6f37b9b1106412
Reviewed-on: https://gerrit.libreoffice.org/63639
Tested-by: Jenkins
Reviewed-by: 's avatarSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
üst f2f21433
......@@ -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)
......
......@@ -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:
......
......@@ -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()
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment