summaryrefslogtreecommitdiff
path: root/sw/source/core/txtnode/ndtxt.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/core/txtnode/ndtxt.cxx')
-rw-r--r--sw/source/core/txtnode/ndtxt.cxx31
1 files changed, 12 insertions, 19 deletions
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 8e83c3cb9ded..acae6495e046 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -3623,6 +3623,12 @@ void SwTxtNode::Modify( SfxPoolItem* pOldValue, SfxPoolItem* pNewValue )
}
m_bNotifiable = bWasNotifiable;
+
+ if (pOldValue && (RES_REMOVE_UNO_OBJECT == pOldValue->Which()))
+ { // invalidate cached uno object
+ SetXParagraph(::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextContent>(0));
+ }
}
SwFmtColl* SwTxtNode::ChgFmtColl( SwFmtColl *pNewColl )
@@ -4973,27 +4979,14 @@ bool SwTxtNode::IsInContent() const
}
#include <unoparagraph.hxx>
-#include <unotextrange.hxx>
-::com::sun::star::uno::Reference< ::com::sun::star::rdf::XMetadatable >
+using namespace ::com::sun::star;
+
+uno::Reference< rdf::XMetadatable >
SwTxtNode::MakeUnoObject()
{
- // re-use existing SwXParagraph
- SwClientIter iter( *this );
- SwClient * pClient( iter.First( TYPE( SwXParagraph ) ) );
- while (pClient) {
- SwXParagraph *pPara( dynamic_cast<SwXParagraph*>(pClient) );
- if (pPara && pPara->GetCoreObject() == this ) {
- return pPara;
- }
- pClient = iter.Next();
- }
-
- // create new SwXParagraph
- SwPosition Pos( *this );
- ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > xParent(
- SwXTextRange::CreateParentXText( GetDoc(), Pos ) );
- SwXParagraph * pXPara( new SwXParagraph( xParent, this ) );
- return pXPara;
+ const uno::Reference<rdf::XMetadatable> xMeta(
+ SwXParagraph::CreateXParagraph(*GetDoc(), *this), uno::UNO_QUERY);
+ return xMeta;
}