[Libreoffice-commits] .: sfx2/inc sfx2/source
Caolán McNamara
caolan at kemper.freedesktop.org
Tue Aug 9 14:01:43 PDT 2011
sfx2/inc/sfx2/sfxbasemodel.hxx | 2 ++
sfx2/source/doc/sfxbasemodel.cxx | 18 +++++++++++++-----
2 files changed, 15 insertions(+), 5 deletions(-)
New commits:
commit 10c0e027b8940e6cead7282fb69796cb28d2aeb9
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Aug 9 22:00:20 2011 +0100
Resolves: fdo#32177 add a modification listener on new XDocumentProperties
diff --git a/sfx2/inc/sfx2/sfxbasemodel.hxx b/sfx2/inc/sfx2/sfxbasemodel.hxx
index e3c773a..7855708 100644
--- a/sfx2/inc/sfx2/sfxbasemodel.hxx
+++ b/sfx2/inc/sfx2/sfxbasemodel.hxx
@@ -1503,6 +1503,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 4006ec7..777929d 100644
--- a/sfx2/source/doc/sfxbasemodel.cxx
+++ b/sfx2/source/doc/sfxbasemodel.cxx
@@ -894,6 +894,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 )
{
@@ -901,8 +910,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()
@@ -911,13 +921,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