[Libreoffice-commits] .: Branch 'libreoffice-3-4' - sfx2/inc sfx2/source
Noel Power
noelp at kemper.freedesktop.org
Wed Aug 10 02:17:51 PDT 2011
sfx2/inc/sfx2/sfxbasemodel.hxx | 2 ++
sfx2/source/doc/sfxbasemodel.cxx | 18 +++++++++++++-----
2 files changed, 15 insertions(+), 5 deletions(-)
New commits:
commit 1e7daaf843293ecac51dc3a4c93bb85bf6823264
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Aug 9 21:00:20 2011 +0000
Resolves: fdo#32177 add a modification listener on new XDocumentProperties
Signed-off-by: Noel Power <noel.power at novell.com>
diff --git a/sfx2/inc/sfx2/sfxbasemodel.hxx b/sfx2/inc/sfx2/sfxbasemodel.hxx
index f7b3101..f52b6c6 100644
--- a/sfx2/inc/sfx2/sfxbasemodel.hxx
+++ b/sfx2/inc/sfx2/sfxbasemodel.hxx
@@ -1505,6 +1505,8 @@ public:
/** returns true if someone added a XEventListener to this XEventBroadcaster */
sal_Bool hasEventListeners() const;
+ void impl_setDocumentProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::document::XDocumentProperties >& );
+
protected:
/* returns a unique id for the model that is valid as long as the document
diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx
index 76e6b12..fb150a9 100644
--- a/sfx2/source/doc/sfxbasemodel.cxx
+++ b/sfx2/source/doc/sfxbasemodel.cxx
@@ -893,6 +893,15 @@ uno::Reference< document::XDocumentInfo > SAL_CALL SfxBaseModel::getDocumentInfo
return m_pData->m_xDocumentInfo;
}
+
+void
+SfxBaseModel::impl_setDocumentProperties( const uno::Reference< document::XDocumentProperties >& rxNewDocProps )
+{
+ m_pData->m_xDocumentProperties.set(rxNewDocProps, uno::UNO_QUERY_THROW);
+ uno::Reference<util::XModifyBroadcaster> xMB(m_pData->m_xDocumentProperties, uno::UNO_QUERY_THROW);
+ xMB->addModifyListener(new SfxDocInfoListener_Impl(*m_pData->m_pObjectShell));
+}
+
void
SfxBaseModel::setDocumentProperties( const uno::Reference< document::XDocumentProperties >& rxNewDocProps )
{
@@ -900,8 +909,9 @@ SfxBaseModel::setDocumentProperties( const uno::Reference< document::XDocumentPr
::SolarMutexGuard aGuard;
if ( impl_isDisposed() )
throw lang::DisposedException();
- m_pData->m_xDocumentProperties.set(rxNewDocProps, uno::UNO_QUERY_THROW);
+ impl_setDocumentProperties(rxNewDocProps);
}
+
// document::XDocumentPropertiesSupplier:
uno::Reference< document::XDocumentProperties > SAL_CALL
SfxBaseModel::getDocumentProperties()
@@ -910,13 +920,11 @@ SfxBaseModel::getDocumentProperties()
SfxModelGuard aGuard( *this, SfxModelGuard::E_INITIALIZING );
if ( !m_pData->m_xDocumentProperties.is() )
{
- uno::Reference< lang::XInitialization > xDocProps(
+ uno::Reference< document::XDocumentProperties > xDocProps(
::comphelper::getProcessServiceFactory()->createInstance(
DEFINE_CONST_UNICODE("com.sun.star.document.DocumentProperties") ),
uno::UNO_QUERY_THROW);
- m_pData->m_xDocumentProperties.set(xDocProps, uno::UNO_QUERY_THROW);
- uno::Reference<util::XModifyBroadcaster> xMB(m_pData->m_xDocumentProperties, uno::UNO_QUERY_THROW);
- xMB->addModifyListener(new SfxDocInfoListener_Impl(*m_pData->m_pObjectShell));
+ impl_setDocumentProperties(xDocProps);
}
return m_pData->m_xDocumentProperties;
More information about the Libreoffice-commits
mailing list