summaryrefslogtreecommitdiff
path: root/sw/source/core/crsr/bookmrk.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/core/crsr/bookmrk.cxx')
-rw-r--r--sw/source/core/crsr/bookmrk.cxx30
1 files changed, 15 insertions, 15 deletions
diff --git a/sw/source/core/crsr/bookmrk.cxx b/sw/source/core/crsr/bookmrk.cxx
index 1028c7b2b432..a9321324be3a 100644
--- a/sw/source/core/crsr/bookmrk.cxx
+++ b/sw/source/core/crsr/bookmrk.cxx
@@ -49,6 +49,7 @@
SV_IMPL_REF( SwServerObject )
using namespace ::sw::mark;
+using namespace ::com::sun::star;
namespace
{
@@ -147,6 +148,16 @@ namespace sw { namespace mark
return aResult.append(nCount++).append(sUniquePostfix).makeStringAndClear();
}
+ // SwClient
+ void MarkBase::Modify(SfxPoolItem *pOld, SfxPoolItem *pNew)
+ {
+ SwModify::Modify(pOld, pNew);
+ if (pOld && (RES_REMOVE_UNO_OBJECT == pOld->Which()))
+ { // invalidate cached uno object
+ SetXBookmark(uno::Reference<text::XTextContent>(0));
+ }
+ }
+
NavigatorReminder::NavigatorReminder(const SwPaM& rPaM)
: MarkBase(rPaM, our_sNamePrefix)
@@ -240,24 +251,13 @@ namespace sw { namespace mark
return !pDoc->IsInHeaderFooter( SwNodeIndex(GetMarkPos().nNode) );
}
- ::com::sun::star::uno::Reference< ::com::sun::star::rdf::XMetadatable >
- Bookmark::MakeUnoObject()
+ uno::Reference< rdf::XMetadatable > Bookmark::MakeUnoObject()
{
- // re-use existing SwXBookmark
- SwClientIter iter( *this );
- SwClient * pClient( iter.First( TYPE( SwXBookmark ) ) );
- while (pClient) {
- SwXBookmark *const pBookmark( dynamic_cast<SwXBookmark*>(pClient) );
- if (pBookmark && pBookmark->GetCoreObject() == this) {
- return pBookmark;
- }
- pClient = iter.Next();
- }
-
- // create new SwXBookmark
SwDoc *const pDoc( GetMarkPos().GetDoc() );
OSL_ENSURE(pDoc, "Bookmark::MakeUnoObject: no doc?");
- return new SwXBookmark(this, pDoc);
+ const uno::Reference< rdf::XMetadatable> xMeta(
+ SwXBookmark::CreateXBookmark(*pDoc, *this), uno::UNO_QUERY);
+ return xMeta;
}