diff options
author | Andreas Bille <abi@openoffice.org> | 2003-04-01 12:10:07 +0000 |
---|---|---|
committer | Andreas Bille <abi@openoffice.org> | 2003-04-01 12:10:07 +0000 |
commit | 3fecd3ca8611e8b3f14cec452db42a5bd7161ac2 (patch) | |
tree | 19c233443b131eb94788bd6860ec48518466d764 | |
parent | 9c7a7f349796fb6976bae9eda320627b9225bdb2 (diff) |
#i2822# setting some sort of title
-rw-r--r-- | embedserv/source/embed/docholder.cxx | 87 | ||||
-rwxr-xr-x | embedserv/source/embed/ed_ioleobject.cxx | 8 | ||||
-rw-r--r-- | embedserv/source/inc/docholder.hxx | 8 |
3 files changed, 97 insertions, 6 deletions
diff --git a/embedserv/source/embed/docholder.cxx b/embedserv/source/embed/docholder.cxx index dbfa9e3f814f..b92d6924a0f6 100644 --- a/embedserv/source/embed/docholder.cxx +++ b/embedserv/source/embed/docholder.cxx @@ -2,9 +2,9 @@ * * $RCSfile: docholder.cxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: abi $ $Date: 2003-03-31 13:50:04 $ + * last change: $Author: abi $ $Date: 2003-04-01 13:10:06 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -76,6 +76,12 @@ #ifndef _COM_SUN_STAR_UTIL_XCLOSEABLE_HPP_ #include <com/sun/star/util/XCloseAble.hpp> #endif +#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACESS_HPP_ +#include <com/sun/star/container/XNameAccess.hpp> +#endif +#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_ +#include <com/sun/star/beans/XPropertySet.hpp> +#endif #ifndef _COM_SUN_STAR_FRAME_XMODEL_HPP_ #include <com/sun/star/frame/XModel.hpp> #endif @@ -295,10 +301,87 @@ void DocumentHolder::show() 0, aSeq); } + setTitle(m_aDocumentNamePart); } } +void DocumentHolder::setTitle(const rtl::OUString& aDocumentName) +{ + if(m_xFrame.is()) + { + if(m_aFilterName.getLength() == 0) + { + rtl::OUString aFilterName; + uno::Sequence<beans::PropertyValue> aSeq; + if(m_xDocument.is()) + { + aSeq = + m_xDocument->getArgs(); + for(sal_Int32 j = 0; j < aSeq.getLength(); ++j) + { + if(aSeq[j].Name == + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("FilterName"))) + { + aSeq[j].Value >>= aFilterName; + break; + } + } + } + + if(aFilterName.getLength()) + { + uno::Reference<container::XNameAccess> xNameAccess( + m_xFactory->createInstance( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.document.FilterFactory"))), + uno::UNO_QUERY); + try { + if(xNameAccess.is() && + (xNameAccess->getByName(aFilterName) >>= aSeq)) + { + for(sal_Int32 j = 0; j < aSeq.getLength(); ++j) + if(aSeq[j].Name == + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("UIName"))) + { + aSeq[j].Value >>= m_aFilterName; + break; + } + } + } + catch(const uno::Exception& ) { + // nothing better to do here + m_aFilterName = aFilterName; + } + } + } + // set the title + uno::Reference<beans::XPropertySet> xPropSet( + m_xFrame,uno::UNO_QUERY); + if(xPropSet.is()) { + uno::Any aAny; + static const sal_Unicode u[] = { ' ','(',0 }; + static const sal_Unicode c[] = { ')',0 }; + rtl::OUString aTotalName(m_aFilterName); + aTotalName += rtl::OUString(u); + aTotalName += aDocumentName; + aTotalName += rtl::OUString(c); + aAny <<= aTotalName; + try { + xPropSet->setPropertyValue( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Title")), + aAny); + } + catch( const uno::Exception& ) { + } + } + } + + m_aDocumentNamePart = aDocumentName; +} + void DocumentHolder::hide() { if(m_xFrame.is()) diff --git a/embedserv/source/embed/ed_ioleobject.cxx b/embedserv/source/embed/ed_ioleobject.cxx index 7e3523d85ead..f7c9f5a618c7 100755 --- a/embedserv/source/embed/ed_ioleobject.cxx +++ b/embedserv/source/embed/ed_ioleobject.cxx @@ -2,9 +2,9 @@ * * $RCSfile: ed_ioleobject.cxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: abi $ $Date: 2003-03-28 16:31:27 $ + * last change: $Author: abi $ $Date: 2003-04-01 13:10:06 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -89,6 +89,10 @@ STDMETHODIMP EmbedDocument_Impl::GetClientSite( IOleClientSite** pSite ) STDMETHODIMP EmbedDocument_Impl::SetHostNames( LPCOLESTR szContainerApp, LPCOLESTR szContainerObj ) { + m_pDocHolder->setTitle( + rtl::OUString( + (sal_Unicode*)szContainerObj)); +// RTL_CONSTASCII_USTRINGPARAM(szContainerObj)); return S_OK; } diff --git a/embedserv/source/inc/docholder.hxx b/embedserv/source/inc/docholder.hxx index 0b7e3ac4668e..4dc05f49ffb5 100644 --- a/embedserv/source/inc/docholder.hxx +++ b/embedserv/source/inc/docholder.hxx @@ -2,9 +2,9 @@ * * $RCSfile: docholder.hxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: abi $ $Date: 2003-03-27 16:09:43 $ + * last change: $Author: abi $ $Date: 2003-04-01 13:10:07 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -97,6 +97,8 @@ private: ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > m_xDocument; ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xFrame; + ::rtl::OUString m_aDocumentNamePart,m_aFilterName; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > DocumentFrame(); public: @@ -110,6 +112,8 @@ public: void CloseFrame(); void FreeOffice(); + void setTitle(const rtl::OUString& aDocumentName); + void show(); void hide(); |