summaryrefslogtreecommitdiff
path: root/sw/inc
diff options
context:
space:
mode:
authorMichael Stahl <mst@openoffice.org>2010-01-08 17:13:50 +0100
committerMichael Stahl <mst@openoffice.org>2010-01-08 17:13:50 +0100
commit440e521dad8c97e939460af857c6a851b220c52e (patch)
tree84a4f19d97704b2efc0c1cd98ce42ecfbbd74a2e /sw/inc
parentfaf50e31a983c1be11d74c1b574cd6c5f63d3a4e (diff)
swunolocking1: #i105557#: fix locking for SwXBookmark:
add Impl struct, and use UnoImplPtr to lock destructor. move all implementation details out of header, into Impl struct. replace broken SwClient iteration with a WeakReference in sw::mark::MarkBase. make constructor protected, and add factory function CreateXBookmark. use new XUnoTunnel and XServiceInfo helpers. clean up the implementation a little. remove SwXBookmarks::GetObject().
Diffstat (limited to 'sw/inc')
-rw-r--r--sw/inc/unobookmark.hxx48
-rw-r--r--sw/inc/unocoll.hxx1
2 files changed, 22 insertions, 27 deletions
diff --git a/sw/inc/unobookmark.hxx b/sw/inc/unobookmark.hxx
index 2b16d7828001..46d0054551b7 100644
--- a/sw/inc/unobookmark.hxx
+++ b/sw/inc/unobookmark.hxx
@@ -41,12 +41,10 @@
#include <cppuhelper/implbase5.hxx>
-#include <tools/string.hxx>
#include <sfx2/Metadatable.hxx>
+#include <unobaseclass.hxx>
#include <IDocumentMarkAccess.hxx>
-#include <calbck.hxx>
-#include <unoevtlstnr.hxx>
class SwDoc;
@@ -63,33 +61,15 @@ typedef ::cppu::ImplInheritanceHelper5
class SwXBookmark
: public SwXBookmark_Base
- , private SwClient
{
private:
- SwEventListenerContainer m_aLstnrCntnr;
- SwDoc* m_pDoc;
- String m_aName;
- ::sw::mark::IMark* m_pRegisteredBookmark;
-
- void registerInMark(::sw::mark::IMark* const pBkmk);
+ class Impl;
+ ::sw::UnoImplPtr<Impl> m_pImpl;
protected:
- virtual ~SwXBookmark();
-
-public:
-
- SwXBookmark(::sw::mark::IMark* pMark = 0, SwDoc* pDoc = 0);
-
- const ::sw::mark::IMark* GetBookmark() const
- { return m_pRegisteredBookmark; }
- ::sw::mark::IMark* GetBookmark()
- { return m_pRegisteredBookmark; }
- SwDoc* GetDoc()
- { return m_pDoc; }
-
void attachToRangeEx(
const ::com::sun::star::uno::Reference<
::com::sun::star::text::XTextRange > & xTextRange,
@@ -102,10 +82,26 @@ public:
throw (::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::uno::RuntimeException);
- TYPEINFO();
+ const ::sw::mark::IMark* GetBookmark() const;
- // SwClient
- virtual void Modify( SfxPoolItem *pOld, SfxPoolItem *pNew );
+ virtual ~SwXBookmark();
+
+ /// @param pDoc and pMark != 0, but not & because of ImplInheritanceHelper
+ SwXBookmark(::sw::mark::IMark *const pMark, SwDoc *const pDoc);
+
+public:
+
+ /// descriptor
+ SwXBookmark();
+
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextContent>
+ CreateXBookmark(SwDoc & rDoc, ::sw::mark::IMark & rBookmark);
+
+ /// @return IMark for this, but only if it lives in pDoc
+ static ::sw::mark::IMark const* GetBookmarkInDoc(SwDoc const*const pDoc,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XUnoTunnel> & xUT);
// MetadatableMixin
virtual ::sfx2::Metadatable* GetCoreObject();
diff --git a/sw/inc/unocoll.hxx b/sw/inc/unocoll.hxx
index b630668f8965..f4d54a55adca 100644
--- a/sw/inc/unocoll.hxx
+++ b/sw/inc/unocoll.hxx
@@ -481,7 +481,6 @@ class SwXBookmarks : public SwCollectionBaseClass,
virtual BOOL SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
- static SwXBookmark* GetObject( ::sw::mark::IMark& rBkm, SwDoc* pDoc);
};
class SwXNumberingRulesCollection : public cppu::WeakImplHelper1