summaryrefslogtreecommitdiff
path: root/sw/inc
diff options
context:
space:
mode:
authorMichael Stahl <mst@openoffice.org>2010-01-08 17:13:51 +0100
committerMichael Stahl <mst@openoffice.org>2010-01-08 17:13:51 +0100
commit2fee7963e992089b67eeb2fb60da27054037da32 (patch)
tree9b6b4df49fd55cef127e587cc4641c00526afd06 /sw/inc
parent77ca8486db12a970aef9aeafea3ac9a4c297d2b2 (diff)
swunolocking1: #i105557#: fix locking for SwXTextSection:
replace SwXTextSectionClient with Impl struct, use UnoImplPtr to lock dtor. move all implementation details out of header, into Impl struct. remove ugly destruction of SwUnoCrsr via Application::PostUserEvent. replace broken SwClient iteration with a WeakReference in SwSectionFmt. add factory function CreateXTextSection. use new XUnoTunnel and XServiceInfo helpers. clean up the implementation a little.
Diffstat (limited to 'sw/inc')
-rw-r--r--sw/inc/frmfmt.hxx19
-rw-r--r--sw/inc/section.hxx20
-rw-r--r--sw/inc/unosection.hxx102
3 files changed, 43 insertions, 98 deletions
diff --git a/sw/inc/frmfmt.hxx b/sw/inc/frmfmt.hxx
index a86b1c6689a0..61663d131aad 100644
--- a/sw/inc/frmfmt.hxx
+++ b/sw/inc/frmfmt.hxx
@@ -30,11 +30,14 @@
#ifndef _FRMFMT_HXX
#define _FRMFMT_HXX
-#include <format.hxx>
-
// --> OD 2004-08-06 #i28749#
#include <com/sun/star/text/PositionLayoutDir.hpp>
// <--
+
+#include <cppuhelper/weakref.hxx>
+
+#include <format.hxx>
+
#include "swdllapi.h"
class SwFlyFrm;
@@ -51,8 +54,9 @@ class SW_DLLPUBLIC SwFrmFmt: public SwFmt
{
friend class SwDoc;
friend class SwPageDesc; //darf den protected CTor rufen.
-// friend class SwSwgReader; // der SW2-Reader auch!
-// friend class Sw3IoImp; // der SW3-Reader auch!
+
+ ::com::sun::star::uno::WeakReference<
+ ::com::sun::star::uno::XInterface> m_wXObject;
protected:
SwFrmFmt( SwAttrPool& rPool, const sal_Char* pFmtNm,
@@ -136,6 +140,13 @@ public:
virtual String GetDescription() const;
+ SW_DLLPRIVATE ::com::sun::star::uno::WeakReference<
+ ::com::sun::star::uno::XInterface> const& GetXObject() const
+ { return m_wXObject; }
+ SW_DLLPRIVATE void SetXObject(::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface> const& xObject)
+ { m_wXObject = xObject; }
+
DECL_FIXEDMEMPOOL_NEWDEL_DLL(SwFrmFmt)
};
diff --git a/sw/inc/section.hxx b/sw/inc/section.hxx
index c530c8280870..3acd8cab16cb 100644
--- a/sw/inc/section.hxx
+++ b/sw/inc/section.hxx
@@ -41,6 +41,11 @@
#include <svtools/svarray.hxx>
#include <frmfmt.hxx>
+
+namespace com { namespace sun { namespace star {
+ namespace text { class XTextSection; }
+} } }
+
// Forward Deklaration
class SwSectionFmt;
class SwDoc;
@@ -230,6 +235,13 @@ class SW_DLLPUBLIC SwSectionFmt : public SwFrmFmt
{
friend class SwDoc;
+ /** why does this exist in addition to the m_wXObject in SwFrmFmt?
+ in case of an index, both a SwXDocumentIndex and a SwXTextSection
+ register at this SwSectionFmt, so we need to have two refs.
+ */
+ ::com::sun::star::uno::WeakReference<
+ ::com::sun::star::text::XTextSection> m_wXTextSection;
+
/* SW_DLLPUBLIC */ SwSection* _GetSection() const;
SW_DLLPRIVATE void UpdateParent(); // Parent wurde veraendert
@@ -271,6 +283,14 @@ public:
// ist die Section eine gueltige fuers GlobalDocument?
const SwSection* GetGlobalDocSection() const;
+
+ SW_DLLPRIVATE ::com::sun::star::uno::WeakReference<
+ ::com::sun::star::text::XTextSection> const& GetXTextSection() const
+ { return m_wXTextSection; }
+ SW_DLLPRIVATE void SetXTextSection(::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextSection> const& xTextSection)
+ { m_wXTextSection = xTextSection; }
+
};
// -------------- inlines ---------------------------------
diff --git a/sw/inc/unosection.hxx b/sw/inc/unosection.hxx
index 31d15d7010d4..6f3eb1794c84 100644
--- a/sw/inc/unosection.hxx
+++ b/sw/inc/unosection.hxx
@@ -43,14 +43,9 @@
#include <cppuhelper/implbase7.hxx>
-#include <tools/link.hxx>
-#include <tools/string.hxx>
+#include <unobaseclass.hxx>
-#include <calbck.hxx>
-#include <unoevtlstnr.hxx>
-
-class SfxItemPropertySet;
class SwSectionFmt;
@@ -58,51 +53,6 @@ class SwSectionFmt;
--------------------------------------------------*/
-class SwXTextSection;
-
-class SwXTextSectionClient
- : public SwClient
-{
-
-private:
-
- friend class SwXTextSection;
-
- SwXTextSection * m_pSection;
- ::com::sun::star::uno::WeakReference<
- ::com::sun::star::text::XTextSection > m_xReference;
-
- // SwClient
- virtual void Modify(SfxPoolItem *pOld, SfxPoolItem *pNew);
-
- SwXTextSectionClient(
- SwSectionFmt& rFmt,
- SwXTextSection& rTextSection,
- ::com::sun::star::uno::Reference<
- ::com::sun::star::text::XTextSection > xSection);
-
- virtual ~SwXTextSectionClient();
-
- DECL_STATIC_LINK( SwXTextSectionClient, RemoveSectionClient_Impl,
- SwXTextSectionClient* );
-
-public:
-
- TYPEINFO();
-
- ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextSection >
- GetXTextSection();
-
- static ::com::sun::star::uno::Reference<
- ::com::sun::star::text::XTextSection >
- CreateXTextSection(SwSectionFmt* pFmt = 0, BOOL bIndexHeader = FALSE);
- static SwXTextSectionClient* Create(
- SwXTextSection& rSection,
- ::com::sun::star::uno::Reference<
- ::com::sun::star::text::XTextSection > xSection,
- SwSectionFmt& rFmt);
-};
-
struct SwTextSectionProperties_Impl;
@@ -122,57 +72,21 @@ class SwXTextSection
private:
- friend class SwXTextSectionClient;
-
- SwEventListenerContainer aLstnrCntnr;
- const SfxItemPropertySet* m_pPropSet;
+ class Impl;
+ ::sw::UnoImplPtr<Impl> m_pImpl;
- BOOL m_bIsDescriptor;
- BOOL m_bIndexHeader;
- String m_sName;
- SwTextSectionProperties_Impl* pProps;
- SwXTextSectionClient* m_pClient;
-
-protected:
-
- void SAL_CALL SetPropertyValues_Impl(
- const ::com::sun::star::uno::Sequence< ::rtl::OUString >&
- rPropertyNames,
- const ::com::sun::star::uno::Sequence<
- ::com::sun::star::uno::Any >& aValues)
- throw (::com::sun::star::beans::UnknownPropertyException,
- ::com::sun::star::beans::PropertyVetoException,
- ::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::lang::WrappedTargetException,
- ::com::sun::star::uno::RuntimeException);
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL
- GetPropertyValues_Impl(
- const ::com::sun::star::uno::Sequence< ::rtl::OUString >&
- rPropertyNames)
- throw (::com::sun::star::beans::UnknownPropertyException,
- ::com::sun::star::lang::WrappedTargetException,
- ::com::sun::star::uno::RuntimeException);
-
- SwXTextSection(sal_Bool bWithFormat, sal_Bool bIndexHeader = FALSE);
+ SwXTextSection(SwSectionFmt *const pFmt, const bool bIndexHeader = false);
virtual ~SwXTextSection();
- void ResetClient() { m_pClient = 0; }
- void SetClient(SwXTextSectionClient* pClient) { m_pClient = pClient; }
-
public:
- void attachToRange(
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::text::XTextRange > & xTextRange)
- throw (::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::uno::RuntimeException);
-
SwSectionFmt* GetFmt() const;
- static SwXTextSection* GetImplementation(
- ::com::sun::star::uno::Reference<
- ::com::sun::star::uno::XInterface> xRef);
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextSection >
+ CreateXTextSection(SwSectionFmt *const pFmt = 0,
+ const bool bIndexHeader = false);
static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelId();