From 68cf76917e342aa5f47deb7e3ef3f7706f8f5a5a Mon Sep 17 00:00:00 2001 From: Szymon Kłos Date: Tue, 11 Jul 2017 17:56:23 +0200 Subject: Show document title for embedded documents Embedded documents had "Untitled" name. This patch shows " (Embedded document)" string in the title bar. Change-Id: I6283240415f9e0c07c4c69672732a7c14eea9f5d Reviewed-on: https://gerrit.libreoffice.org/39835 Tested-by: Jenkins Reviewed-by: Miklos Vajna --- embeddedobj/Library_embobj.mk | 1 + embeddedobj/source/general/docholder.cxx | 15 +++++++++++++++ embeddedobj/source/inc/commonembobj.hxx | 1 + embeddedobj/source/msole/oleembed.cxx | 3 +++ 4 files changed, 20 insertions(+) (limited to 'embeddedobj') diff --git a/embeddedobj/Library_embobj.mk b/embeddedobj/Library_embobj.mk index 87c33c893d6f..dc0f88667be7 100644 --- a/embeddedobj/Library_embobj.mk +++ b/embeddedobj/Library_embobj.mk @@ -29,6 +29,7 @@ $(eval $(call gb_Library_use_libraries,embobj,\ svt \ vcl \ tl \ + i18nlangtag \ )) $(eval $(call gb_Library_add_exception_objects,embobj,\ diff --git a/embeddedobj/source/general/docholder.cxx b/embeddedobj/source/general/docholder.cxx index 1bef54e7741f..60ac61682ae1 100644 --- a/embeddedobj/source/general/docholder.cxx +++ b/embeddedobj/source/general/docholder.cxx @@ -19,6 +19,7 @@ #include #include +#include #include #include #include @@ -65,6 +66,9 @@ #include #include #include +#include +#include +#include #include #include @@ -962,6 +966,17 @@ bool DocumentHolder::LoadDocToFrame( bool bInPlace ) ::comphelper::NamedValueCollection aArgs; aArgs.put( "Model", m_xComponent ); aArgs.put( "ReadOnly", m_bReadOnly ); + + // set document title to show in the title bar + css::uno::Reference< css::frame::XTitle > xModelTitle( xDoc, css::uno::UNO_QUERY ); + if( xModelTitle.is() ) + { + LanguageTag aLocale( Application::GetSettings().GetUILanguageTag() ); + ResMgr* pResMgr = ResMgr::SearchCreateResMgr( "sfx", aLocale ); + OUString nTitle = ResId( STR_EMBEDDED_TITLE, *pResMgr ); + xModelTitle->setTitle( m_pEmbedObj->getContainerName() + nTitle ); + } + if ( bInPlace ) aArgs.put( "PluginMode", sal_Int16(1) ); OUString sUrl; diff --git a/embeddedobj/source/inc/commonembobj.hxx b/embeddedobj/source/inc/commonembobj.hxx index 52624c291775..5e857b0a3331 100644 --- a/embeddedobj/source/inc/commonembobj.hxx +++ b/embeddedobj/source/inc/commonembobj.hxx @@ -248,6 +248,7 @@ public: // not a real listener and should not be void PostEvent_Impl( const OUString& aEventName ); + OUString getContainerName() { return m_aContainerName; } // XInterface virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& rType ) override ; diff --git a/embeddedobj/source/msole/oleembed.cxx b/embeddedobj/source/msole/oleembed.cxx index c3acbb687e8b..2a075c8da812 100644 --- a/embeddedobj/source/msole/oleembed.cxx +++ b/embeddedobj/source/msole/oleembed.cxx @@ -357,6 +357,9 @@ bool OleEmbeddedObject::TryToConvertToOOo( const uno::Reference< io::XStream >& nStep = 4; m_xWrappedObject.set( xEmbCreator->createInstanceInitFromEntry( m_xParentStorage, m_aEntryName, uno::Sequence< beans::PropertyValue >(), uno::Sequence< beans::PropertyValue >() ), uno::UNO_QUERY_THROW ); + // remember parent document name to show in the title bar + m_xWrappedObject->setContainerName( m_aContainerName ); + bResult = true; // the change is no more revertable try { -- cgit