From f907a057665ac81356218d6ecb05008542b0db22 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Tue, 16 Mar 2010 11:28:36 +0100 Subject: odfmetadata4: #i109599#: SwXTextSection: add support for xml:id. --- sw/inc/unosection.hxx | 12 ++++++++++-- sw/source/core/unocore/unosect.cxx | 19 +++++++++++++++++++ 2 files changed, 29 insertions(+), 2 deletions(-) (limited to 'sw') diff --git a/sw/inc/unosection.hxx b/sw/inc/unosection.hxx index e5c189c26af0..e54bdd5775af 100644 --- a/sw/inc/unosection.hxx +++ b/sw/inc/unosection.hxx @@ -39,6 +39,8 @@ #include +#include + #include @@ -52,8 +54,9 @@ class SwSectionFmt; struct SwTextSectionProperties_Impl; -typedef ::cppu::WeakImplHelper7 -< ::com::sun::star::lang::XUnoTunnel +typedef ::cppu::ImplInheritanceHelper7 +< ::sfx2::MetadatableMixin +, ::com::sun::star::lang::XUnoTunnel , ::com::sun::star::lang::XServiceInfo , ::com::sun::star::beans::XPropertySet , ::com::sun::star::beans::XPropertyState @@ -84,6 +87,11 @@ public: CreateXTextSection(SwSectionFmt *const pFmt = 0, const bool bIndexHeader = false); + // MetadatableMixin + virtual ::sfx2::Metadatable* GetCoreObject(); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > + GetModel(); + static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelId(); // XUnoTunnel diff --git a/sw/source/core/unocore/unosect.cxx b/sw/source/core/unocore/unosect.cxx index 8654ae5d82b8..1e18cc5becc5 100644 --- a/sw/source/core/unocore/unosect.cxx +++ b/sw/source/core/unocore/unosect.cxx @@ -1894,3 +1894,22 @@ SwXTextSection::getSupportedServiceNames() throw (uno::RuntimeException) g_nServicesTextSection, g_ServicesTextSection); } + +// MetadatableMixin +::sfx2::Metadatable* SwXTextSection::GetCoreObject() +{ + SwSectionFmt *const pSectionFmt( m_pImpl->GetSectionFmt() ); + return pSectionFmt; +} + +uno::Reference SwXTextSection::GetModel() +{ + SwSectionFmt *const pSectionFmt( m_pImpl->GetSectionFmt() ); + if (pSectionFmt) + { + SwDocShell const*const pShell( pSectionFmt->GetDoc()->GetDocShell() ); + return (pShell) ? pShell->GetModel() : 0; + } + return 0; +} + -- cgit v1.2.3