summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--compilerplugins/clang/refcounting.cxx42
-rw-r--r--sw/inc/unoparagraph.hxx5
-rw-r--r--sw/inc/unotext.hxx4
-rw-r--r--sw/inc/unotextbodyhf.hxx2
-rw-r--r--sw/inc/unotextrange.hxx3
-rw-r--r--sw/source/core/access/AccessibilityCheck.cxx22
-rw-r--r--sw/source/core/doc/rdfhelper.cxx9
-rw-r--r--sw/source/core/edit/edfcol.cxx8
-rw-r--r--sw/source/core/inc/unocontentcontrol.hxx7
-rw-r--r--sw/source/core/inc/unometa.hxx11
-rw-r--r--sw/source/core/inc/unoport.hxx3
-rw-r--r--sw/source/core/layout/atrfrm.cxx2
-rw-r--r--sw/source/core/txtnode/fmtatr2.cxx3
-rw-r--r--sw/source/core/txtnode/ndtxt.cxx3
-rw-r--r--sw/source/core/unocore/unocoll.cxx2
-rw-r--r--sw/source/core/unocore/unocontentcontrol.cxx18
-rw-r--r--sw/source/core/unocore/unocrsrhelper.cxx2
-rw-r--r--sw/source/core/unocore/unoobj2.cxx10
-rw-r--r--sw/source/core/unocore/unoparagraph.cxx12
-rw-r--r--sw/source/core/unocore/unoportenum.cxx14
-rw-r--r--sw/source/core/unocore/unorefmk.cxx21
-rw-r--r--sw/source/core/unocore/unosect.cxx7
-rw-r--r--sw/source/core/unocore/unotext.cxx6
23 files changed, 116 insertions, 100 deletions
diff --git a/compilerplugins/clang/refcounting.cxx b/compilerplugins/clang/refcounting.cxx
index ca6c0d97d9f0..801173ce6488 100644
--- a/compilerplugins/clang/refcounting.cxx
+++ b/compilerplugins/clang/refcounting.cxx
@@ -378,24 +378,30 @@ static bool containsStaticTypeMethod(const CXXRecordDecl* x)
void RefCounting::checkUnoReference(QualType qt, const Decl* decl, const RecordDecl* parent, const std::string& rDeclName)
{
- if (loplugin::TypeCheck(qt).Class("Reference").Namespace("uno").Namespace("star").Namespace("sun").Namespace("com").GlobalNamespace()) {
- const CXXRecordDecl* pRecordDecl = qt->getAsCXXRecordDecl();
- const ClassTemplateSpecializationDecl* pTemplate = dyn_cast<ClassTemplateSpecializationDecl>(pRecordDecl);
- const TemplateArgument& rArg = pTemplate->getTemplateArgs()[0];
- const CXXRecordDecl* templateParam = rArg.getAsType()->getAsCXXRecordDecl()->getDefinition();
- if (templateParam && !containsStaticTypeMethod(templateParam)) {
- report(
- DiagnosticsEngine::Warning,
- ("uno::Reference %0 with template parameter that does not"
- " contain ::static_type() %1%select{|, parent is %3,}2 should"
- " probably be using rtl::Reference instead"),
- decl->getLocation())
- << rDeclName << qt << (parent != nullptr)
- << (parent != nullptr
- ? parent->getQualifiedNameAsString() : std::string())
- << decl->getSourceRange();
- }
- }
+ if (!loplugin::TypeCheck(qt).Class("Reference").Namespace("uno").Namespace("star").Namespace("sun").Namespace("com").GlobalNamespace())
+ return;
+ const CXXRecordDecl* pRecordDecl = qt->getAsCXXRecordDecl();
+ const ClassTemplateSpecializationDecl* pTemplate = dyn_cast<ClassTemplateSpecializationDecl>(pRecordDecl);
+ const TemplateArgument& rArg = pTemplate->getTemplateArgs()[0];
+ const CXXRecordDecl* templateParam = rArg.getAsType()->getAsCXXRecordDecl()->getDefinition();
+ if (!templateParam)
+ return;
+ // SwXText is a special case. It is a mixin class that does not inherit from OWeakObject, so
+ // we cannot use rtl::Reference.
+ if (loplugin::DeclCheck(templateParam).Class("SwXText"))
+ return;
+ if (containsStaticTypeMethod(templateParam))
+ return;
+ report(
+ DiagnosticsEngine::Warning,
+ ("uno::Reference %0 with template parameter that does not"
+ " contain ::static_type() %1%select{|, parent is %3,}2 should"
+ " probably be using rtl::Reference instead"),
+ decl->getLocation())
+ << rDeclName << qt << (parent != nullptr)
+ << (parent != nullptr
+ ? parent->getQualifiedNameAsString() : std::string())
+ << decl->getSourceRange();
}
bool RefCounting::visitTemporaryObjectExpr(Expr const * expr) {
diff --git a/sw/inc/unoparagraph.hxx b/sw/inc/unoparagraph.hxx
index 860edc18e938..cbdfe202a1cb 100644
--- a/sw/inc/unoparagraph.hxx
+++ b/sw/inc/unoparagraph.hxx
@@ -70,7 +70,7 @@ private:
virtual ~SwXParagraph() override;
- SwXParagraph(css::uno::Reference< css::text::XText > const & xParent,
+ SwXParagraph(css::uno::Reference< SwXText > const & xParent,
SwTextNode & rTextNode,
const sal_Int32 nSelStart, const sal_Int32 nSelEnd);
@@ -81,8 +81,7 @@ public:
static rtl::Reference<SwXParagraph>
CreateXParagraph(SwDoc & rDoc, SwTextNode * pTextNode,
- css::uno::Reference< css::text::XText>
- const& xParentText = nullptr,
+ css::uno::Reference<SwXText> const& xParentText,
const sal_Int32 nSelStart = -1, const sal_Int32 nSelEnd = - 1);
const SwTextNode * GetTextNode() const;
diff --git a/sw/inc/unotext.hxx b/sw/inc/unotext.hxx
index 7429d9f4cb66..5dbb7e993fc9 100644
--- a/sw/inc/unotext.hxx
+++ b/sw/inc/unotext.hxx
@@ -83,6 +83,10 @@ public:
const SwDoc* GetDoc() const;
SwDoc* GetDoc();
+ // declare these here to resolve ambiguity when we declared rtl::Reference<subtype-of-SwXText>
+ virtual void SAL_CALL acquire() override = 0;
+ virtual void SAL_CALL release() override = 0;
+
// XInterface
virtual css::uno::Any SAL_CALL queryInterface(
const css::uno::Type& rType) override;
diff --git a/sw/inc/unotextbodyhf.hxx b/sw/inc/unotextbodyhf.hxx
index 8e10e22a68fb..3c16da8f7574 100644
--- a/sw/inc/unotextbodyhf.hxx
+++ b/sw/inc/unotextbodyhf.hxx
@@ -105,7 +105,7 @@ class SwXHeadFootText final
public:
- static css::uno::Reference< css::text::XText >
+ static rtl::Reference< SwXHeadFootText >
CreateXHeadFootText(SwFrameFormat & rHeadFootFormat, const bool bIsHeader);
rtl::Reference< SwXTextCursor > CreateTextCursor(const bool bIgnoreTables = false);
diff --git a/sw/inc/unotextrange.hxx b/sw/inc/unotextrange.hxx
index a234d1092805..1d2265ddfec1 100644
--- a/sw/inc/unotextrange.hxx
+++ b/sw/inc/unotextrange.hxx
@@ -37,6 +37,7 @@
class SwDoc;
class SwUnoCursor;
class SwFrameFormat;
+class SwXText;
class SW_DLLPUBLIC SwUnoInternalPaM final
: public SwPaM
@@ -66,7 +67,7 @@ namespace sw {
const css::uno::Reference<css::text::XTextRange> & xTextRange,
TextRangeMode eMode = TextRangeMode::RequireTextNode);
- css::uno::Reference< css::text::XText >
+ css::uno::Reference< SwXText >
CreateParentXText(SwDoc & rDoc, const SwPosition& rPos);
bool GetDefaultTextContentValue(css::uno::Any& rAny,
diff --git a/sw/source/core/access/AccessibilityCheck.cxx b/sw/source/core/access/AccessibilityCheck.cxx
index cf214d060a76..63443bcb89bd 100644
--- a/sw/source/core/access/AccessibilityCheck.cxx
+++ b/sw/source/core/access/AccessibilityCheck.cxx
@@ -41,6 +41,7 @@
#include <svx/swframetypes.hxx>
#include <fmtanchr.hxx>
#include <dcontact.hxx>
+#include <unotext.hxx>
#include <svx/svdoashp.hxx>
#include <svx/sdasitm.hxx>
@@ -380,13 +381,12 @@ public:
return;
SwTextNode* pTextNode = pCurrent->GetTextNode();
- uno::Reference<text::XTextContent> xParagraph
- = SwXParagraph::CreateXParagraph(pTextNode->GetDoc(), pTextNode);
+ rtl::Reference<SwXParagraph> xParagraph
+ = SwXParagraph::CreateXParagraph(pTextNode->GetDoc(), pTextNode, nullptr);
if (!xParagraph.is())
return;
- uno::Reference<container::XEnumerationAccess> xRunEnumAccess(xParagraph, uno::UNO_QUERY);
- uno::Reference<container::XEnumeration> xRunEnum = xRunEnumAccess->createEnumeration();
+ uno::Reference<container::XEnumeration> xRunEnum = xParagraph->createEnumeration();
sal_Int32 nStart = 0;
while (xRunEnum->hasMoreElements())
{
@@ -571,13 +571,12 @@ public:
return;
SwTextNode* pTextNode = pCurrent->GetTextNode();
- uno::Reference<text::XTextContent> xParagraph;
- xParagraph = SwXParagraph::CreateXParagraph(pTextNode->GetDoc(), pTextNode);
+ rtl::Reference<SwXParagraph> xParagraph
+ = SwXParagraph::CreateXParagraph(pTextNode->GetDoc(), pTextNode, nullptr);
if (!xParagraph.is())
return;
- uno::Reference<container::XEnumerationAccess> xRunEnumAccess(xParagraph, uno::UNO_QUERY);
- uno::Reference<container::XEnumeration> xRunEnum = xRunEnumAccess->createEnumeration();
+ uno::Reference<container::XEnumeration> xRunEnum = xParagraph->createEnumeration();
sal_Int32 nStart = 0;
while (xRunEnum->hasMoreElements())
{
@@ -1072,13 +1071,12 @@ public:
return;
SwTextNode* pTextNode = pCurrent->GetTextNode();
- uno::Reference<text::XTextContent> xParagraph;
- xParagraph = SwXParagraph::CreateXParagraph(pTextNode->GetDoc(), pTextNode);
+ rtl::Reference<SwXParagraph> xParagraph
+ = SwXParagraph::CreateXParagraph(pTextNode->GetDoc(), pTextNode, nullptr);
if (!xParagraph.is())
return;
- uno::Reference<container::XEnumerationAccess> xRunEnumAccess(xParagraph, uno::UNO_QUERY);
- uno::Reference<container::XEnumeration> xRunEnum = xRunEnumAccess->createEnumeration();
+ uno::Reference<container::XEnumeration> xRunEnum = xParagraph->createEnumeration();
sal_Int32 nStart = 0;
while (xRunEnum->hasMoreElements())
{
diff --git a/sw/source/core/doc/rdfhelper.cxx b/sw/source/core/doc/rdfhelper.cxx
index c06126830967..d4e5d9da2b52 100644
--- a/sw/source/core/doc/rdfhelper.cxx
+++ b/sw/source/core/doc/rdfhelper.cxx
@@ -21,6 +21,7 @@
#include <docsh.hxx>
#include <ndtxt.hxx>
#include <unoparagraph.hxx>
+#include <unotext.hxx>
using namespace com::sun::star;
@@ -201,13 +202,13 @@ void SwRDFHelper::cloneStatements(const css::uno::Reference<css::frame::XModel>&
std::map<OUString, OUString> SwRDFHelper::getTextNodeStatements(const OUString& rType, SwTextNode& rTextNode)
{
- uno::Reference<rdf::XResource> xTextNode(SwXParagraph::CreateXParagraph(rTextNode.GetDoc(), &rTextNode));
+ uno::Reference<rdf::XResource> xTextNode(SwXParagraph::CreateXParagraph(rTextNode.GetDoc(), &rTextNode, nullptr));
return getStatements(rTextNode.GetDoc().GetDocShell()->GetBaseModel(), rType, xTextNode);
}
void SwRDFHelper::addTextNodeStatement(const OUString& rType, const OUString& rPath, SwTextNode& rTextNode, const OUString& rKey, const OUString& rValue)
{
- uno::Reference<rdf::XResource> xSubject(SwXParagraph::CreateXParagraph(rTextNode.GetDoc(), &rTextNode));
+ uno::Reference<rdf::XResource> xSubject(SwXParagraph::CreateXParagraph(rTextNode.GetDoc(), &rTextNode, nullptr));
addStatement(rTextNode.GetDoc().GetDocShell()->GetBaseModel(), rType, rPath, xSubject, rKey, rValue);
}
@@ -222,7 +223,7 @@ void SwRDFHelper::removeTextNodeStatement(const OUString& rType, SwTextNode& rTe
uno::Reference<rdf::XURI> xGraphName = aGraphNames[0];
uno::Reference<rdf::XNamedGraph> xGraph = xDocumentMetadataAccess->getRDFRepository()->getGraph(xGraphName);
- uno::Reference<rdf::XResource> xSubject(SwXParagraph::CreateXParagraph(rTextNode.GetDoc(), &rTextNode));
+ uno::Reference<rdf::XResource> xSubject(SwXParagraph::CreateXParagraph(rTextNode.GetDoc(), &rTextNode, nullptr));
uno::Reference<rdf::XURI> xKey = rdf::URI::create(xComponentContext, rKey);
uno::Reference<rdf::XLiteral> xValue = rdf::Literal::create(xComponentContext, rValue);
xGraph->removeStatements(xSubject, xKey, xValue);
@@ -246,7 +247,7 @@ void SwRDFHelper::updateTextNodeStatement(const OUString& rType, const OUString&
}
uno::Reference<rdf::XNamedGraph> xGraph = xDocumentMetadataAccess->getRDFRepository()->getGraph(xGraphName);
- uno::Reference<rdf::XResource> xSubject(SwXParagraph::CreateXParagraph(rTextNode.GetDoc(), &rTextNode));
+ uno::Reference<rdf::XResource> xSubject(SwXParagraph::CreateXParagraph(rTextNode.GetDoc(), &rTextNode, nullptr));
uno::Reference<rdf::XURI> xKey = rdf::URI::create(xComponentContext, rKey);
if (aGraphNames.hasElements())
diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx
index 9462de2f16bb..66ac033189a3 100644
--- a/sw/source/core/edit/edfcol.cxx
+++ b/sw/source/core/edit/edfcol.cxx
@@ -1286,7 +1286,7 @@ void SwEditShell::ApplyParagraphClassification(std::vector<svx::ClassificationRe
});
uno::Reference<frame::XModel> xModel = pDocShell->GetBaseModel();
- rtl::Reference<SwXParagraph> xParent = SwXParagraph::CreateXParagraph(pNode->GetDoc(), pNode);
+ rtl::Reference<SwXParagraph> xParent = SwXParagraph::CreateXParagraph(pNode->GetDoc(), pNode, nullptr);
lcl_ApplyParagraphClassification(GetDoc(), xModel, xParent, css::uno::Reference<css::rdf::XResource>(xParent), std::move(aResults));
}
@@ -1360,7 +1360,7 @@ std::vector<svx::ClassificationResult> SwEditShell::CollectParagraphClassificati
if (pNode == nullptr)
return aResult;
- uno::Reference<text::XTextContent> xParent = SwXParagraph::CreateXParagraph(pNode->GetDoc(), pNode);
+ rtl::Reference<SwXParagraph> xParent = SwXParagraph::CreateXParagraph(pNode->GetDoc(), pNode, nullptr);
uno::Reference<frame::XModel> xModel = pDocShell->GetBaseModel();
return lcl_CollectParagraphClassification(xModel, xParent);
}
@@ -1779,7 +1779,7 @@ void SwEditShell::SignParagraph()
return;
// 1. Get the text (without fields).
- const uno::Reference<text::XTextContent> xParagraph = SwXParagraph::CreateXParagraph(pNode->GetDoc(), pNode);
+ const rtl::Reference<SwXParagraph> xParagraph = SwXParagraph::CreateXParagraph(pNode->GetDoc(), pNode, nullptr);
const OString utf8Text = lcl_getParagraphBodyText(xParagraph);
if (utf8Text.isEmpty())
return;
@@ -1849,7 +1849,7 @@ void SwEditShell::ValidateParagraphSignatures(SwTextNode* pNode, bool updateDont
SetParagraphSignatureValidation(bOldValidationFlag);
});
- uno::Reference<text::XTextContent> xParentText = SwXParagraph::CreateXParagraph(*GetDoc(), pNode);
+ rtl::Reference<SwXParagraph> xParentText = SwXParagraph::CreateXParagraph(*GetDoc(), pNode, nullptr);
lcl_ValidateParagraphSignatures(*GetDoc(), xParentText, updateDontRemove);
}
diff --git a/sw/source/core/inc/unocontentcontrol.hxx b/sw/source/core/inc/unocontentcontrol.hxx
index b037091b6bfd..d2881e0c8b08 100644
--- a/sw/source/core/inc/unocontentcontrol.hxx
+++ b/sw/source/core/inc/unocontentcontrol.hxx
@@ -41,6 +41,7 @@ class SwPaM;
class SwTextNode;
class SwFormatContentControl;
class SwContentControl;
+class SwXText;
/**
* UNO API wrapper around an SwContentControl, exposed as the com.sun.star.text.ContentControl
@@ -64,7 +65,7 @@ protected:
SwXContentControl& operator=(const SwXContentControl&) = delete;
SwXContentControl(SwDoc* pDoc, SwContentControl* pContentControl,
- const css::uno::Reference<css::text::XText>& xParentText,
+ const css::uno::Reference<SwXText>& xParentText,
std::unique_ptr<const TextRangeList_t> pPortions);
SwXContentControl(SwDoc* pDoc);
@@ -72,7 +73,7 @@ protected:
public:
static rtl::Reference<SwXContentControl>
CreateXContentControl(SwContentControl& rContentControl,
- const css::uno::Reference<css::text::XText>& xParentText = nullptr,
+ const css::uno::Reference<SwXText>& xParentText = nullptr,
std::unique_ptr<const TextRangeList_t>&& pPortions
= std::unique_ptr<const TextRangeList_t>());
@@ -80,7 +81,7 @@ public:
/// Initializes params with position of the attribute content (without CH_TXTATR).
bool SetContentRange(SwTextNode*& rpNode, sal_Int32& rStart, sal_Int32& rEnd) const;
- const css::uno::Reference<css::text::XText>& GetParentText() const;
+ const css::uno::Reference<SwXText>& GetParentText() const;
// XServiceInfo
OUString SAL_CALL getImplementationName() override;
diff --git a/sw/source/core/inc/unometa.hxx b/sw/source/core/inc/unometa.hxx
index e0ebf444ccdb..d89ef914df1f 100644
--- a/sw/source/core/inc/unometa.hxx
+++ b/sw/source/core/inc/unometa.hxx
@@ -42,6 +42,7 @@ typedef std::deque<
class SwPaM;
class SwTextNode;
+class SwXText;
namespace sw {
class Meta;
@@ -81,7 +82,7 @@ protected:
/// @param pDoc and pMeta != 0, but not & because of ImplInheritanceHelper
SwXMeta(SwDoc *const pDoc, ::sw::Meta *const pMeta,
- css::uno::Reference< css::text::XText> const& xParentText,
+ css::uno::Reference<SwXText> const& xParentText,
std::unique_ptr<TextRangeList_t const> pPortions);
SwXMeta(SwDoc *const pDoc);
@@ -91,7 +92,7 @@ public:
static rtl::Reference<SwXMeta>
CreateXMeta(
::sw::Meta & rMeta,
- css::uno::Reference< css::text::XText> const& xParentText = nullptr,
+ css::uno::Reference<SwXText> xParentText,
std::unique_ptr<TextRangeList_t const> && pPortions = std::unique_ptr<TextRangeList_t const>());
static rtl::Reference<SwXMeta>
@@ -99,7 +100,7 @@ public:
/// init params with position of the attribute content (w/out CH_TXTATR)
bool SetContentRange( SwTextNode *& rpNode, sal_Int32 & rStart, sal_Int32 & rEnd) const;
- css::uno::Reference< css::text::XText > const & GetParentText() const;
+ css::uno::Reference< SwXText > const & GetParentText() const;
/// @throws css::lang::IllegalArgumentException
/// @throws css::uno::RuntimeException
@@ -192,11 +193,11 @@ private:
friend rtl::Reference<SwXMeta>
SwXMeta::CreateXMeta(::sw::Meta &,
- css::uno::Reference< css::text::XText> const&,
+ css::uno::Reference<SwXText>,
std::unique_ptr<TextRangeList_t const> && pPortions);
SwXMetaField(SwDoc *const pDoc, ::sw::Meta *const pMeta,
- css::uno::Reference< css::text::XText> const& xParentText,
+ css::uno::Reference<SwXText> const& xParentText,
std::unique_ptr<TextRangeList_t const> pPortions);
friend rtl::Reference<SwXMeta>
diff --git a/sw/source/core/inc/unoport.hxx b/sw/source/core/inc/unoport.hxx
index 1315334d3992..53f05964fabd 100644
--- a/sw/source/core/inc/unoport.hxx
+++ b/sw/source/core/inc/unoport.hxx
@@ -45,6 +45,7 @@ namespace com::sun::star::text { class XFootnote; }
class SwFrameFormat;
class SwRangeRedline;
class SwTextRuby;
+class SwXText;
typedef std::deque<
css::uno::Reference< css::text::XTextRange > >
@@ -257,7 +258,7 @@ class SwXTextPortionEnumeration final
public:
/// @param bOnlyTextFields tries to return less data, but may return more than just text fields
SwXTextPortionEnumeration(SwPaM& rParaCursor,
- css::uno::Reference< css::text::XText > const & xParent,
+ css::uno::Reference< SwXText > const & xParent,
const sal_Int32 nStart, const sal_Int32 nEnd, bool bOnlyTextFields = false );
SwXTextPortionEnumeration(SwPaM& rParaCursor,
diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx
index 08d47bd16479..5e3c26e708c7 100644
--- a/sw/source/core/layout/atrfrm.cxx
+++ b/sw/source/core/layout/atrfrm.cxx
@@ -2725,7 +2725,7 @@ void SwFrameFormat::SwClientNotify(const SwModify& rMod, const SfxHint& rHint)
pOldAnchorNode = static_cast<const SwFormatAnchor*>(pLegacy->m_pOld)->GetAnchorNode();
break;
case RES_REMOVE_UNO_OBJECT:
- SetXObject(uno::Reference<uno::XInterface>(nullptr));
+ SetXObject(nullptr);
break;
}
diff --git a/sw/source/core/txtnode/fmtatr2.cxx b/sw/source/core/txtnode/fmtatr2.cxx
index 367658e84456..ba7862fd4110 100644
--- a/sw/source/core/txtnode/fmtatr2.cxx
+++ b/sw/source/core/txtnode/fmtatr2.cxx
@@ -46,6 +46,7 @@
#include <ndtxt.hxx>
#include <doc.hxx>
#include <unometa.hxx>
+#include <unotext.hxx>
#include <docsh.hxx>
#include <osl/diagnose.h>
@@ -735,7 +736,7 @@ bool Meta::IsInContent() const
css::uno::Reference< css::rdf::XMetadatable > Meta::MakeUnoObject()
{
- return SwXMeta::CreateXMeta(*this);
+ return SwXMeta::CreateXMeta(*this, {});
}
MetaField::MetaField(SwFormatMeta * const i_pFormat,
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 10a4209356a3..bd87f2d2bcbe 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -78,6 +78,7 @@
#include <attrhint.hxx>
#include <memory>
#include <unoparagraph.hxx>
+#include <unotext.hxx>
#include <wrtsh.hxx>
#include <fmtpdsc.hxx>
#include <svx/sdr/attribute/sdrallfillattributeshelper.hxx>
@@ -5535,7 +5536,7 @@ uno::Reference< rdf::XMetadatable >
SwTextNode::MakeUnoObject()
{
const uno::Reference<rdf::XMetadatable> xMeta(
- SwXParagraph::CreateXParagraph(GetDoc(), this));
+ SwXParagraph::CreateXParagraph(GetDoc(), this, nullptr));
return xMeta;
}
diff --git a/sw/source/core/unocore/unocoll.cxx b/sw/source/core/unocore/unocoll.cxx
index 3f412181d470..14229655e6a0 100644
--- a/sw/source/core/unocore/unocoll.cxx
+++ b/sw/source/core/unocore/unocoll.cxx
@@ -789,7 +789,7 @@ SwXServiceProvider::MakeInstance(SwServiceType nObjectType, SwDoc & rDoc)
}
break;
case SwServiceType::Paragraph:
- xRet = static_cast<cppu::OWeakObject*>(SwXParagraph::CreateXParagraph(rDoc, nullptr).get());
+ xRet = static_cast<cppu::OWeakObject*>(SwXParagraph::CreateXParagraph(rDoc, nullptr, nullptr).get());
break;
case SwServiceType::NumberingRules:
xRet = static_cast<cppu::OWeakObject*>(new SwXNumberingRules(rDoc));
diff --git a/sw/source/core/unocore/unocontentcontrol.cxx b/sw/source/core/unocore/unocontentcontrol.cxx
index fa610f256523..541fc46699b3 100644
--- a/sw/source/core/unocore/unocontentcontrol.cxx
+++ b/sw/source/core/unocore/unocontentcontrol.cxx
@@ -82,7 +82,7 @@ SwXContentControlText::SwXContentControlText(SwDoc& rDoc, SwXContentControl& rCo
const SwStartNode* SwXContentControlText::GetStartNode() const
{
- auto pParent = dynamic_cast<SwXText*>(m_rContentControl.GetParentText().get());
+ SwXText* pParent = m_rContentControl.GetParentText().get();
return pParent ? pParent->GetStartNode() : nullptr;
}
@@ -148,7 +148,7 @@ public:
// 3 possible states: not attached, attached, disposed
bool m_bIsDisposed;
bool m_bIsDescriptor;
- uno::Reference<text::XText> m_xParentText;
+ css::uno::Reference<SwXText> m_xParentText;
rtl::Reference<SwXContentControlText> m_xText;
SwContentControl* m_pContentControl;
bool m_bShowingPlaceHolder;
@@ -178,7 +178,7 @@ public:
OUString m_aLock;
Impl(SwXContentControl& rThis, SwDoc& rDoc, SwContentControl* pContentControl,
- uno::Reference<text::XText> xParentText, std::unique_ptr<const TextRangeList_t> pPortions)
+ css::uno::Reference<SwXText> xParentText, std::unique_ptr<const TextRangeList_t> pPortions)
: m_pTextPortions(std::move(pPortions))
, m_bIsDisposed(false)
, m_bIsDescriptor(pContentControl == nullptr)
@@ -236,13 +236,13 @@ void SwXContentControl::Impl::Notify(const SfxHint& rHint)
m_EventListeners.disposeAndClear(aGuard, aEvent);
}
-const uno::Reference<text::XText>& SwXContentControl::GetParentText() const
+const css::uno::Reference<SwXText>& SwXContentControl::GetParentText() const
{
return m_pImpl->m_xParentText;
}
SwXContentControl::SwXContentControl(SwDoc* pDoc, SwContentControl* pContentControl,
- const uno::Reference<text::XText>& xParentText,
+ const css::uno::Reference<SwXText>& xParentText,
std::unique_ptr<const TextRangeList_t> pPortions)
: m_pImpl(new SwXContentControl::Impl(*this, *pDoc, pContentControl, xParentText,
std::move(pPortions)))
@@ -265,7 +265,7 @@ rtl::Reference<SwXContentControl> SwXContentControl::CreateXContentControl(SwDoc
rtl::Reference<SwXContentControl>
SwXContentControl::CreateXContentControl(SwContentControl& rContentControl,
- const uno::Reference<text::XText>& xParent,
+ const css::uno::Reference<SwXText>& xParent,
std::unique_ptr<const TextRangeList_t>&& pPortions)
{
// re-use existing SwXContentControl
@@ -281,7 +281,7 @@ SwXContentControl::CreateXContentControl(SwContentControl& rContentControl,
if (xContentControl->m_pImpl->m_xParentText.get() != xParent.get())
{
SAL_WARN("sw.uno", "SwXContentControl with different parent");
- xContentControl->m_pImpl->m_xParentText.set(xParent);
+ xContentControl->m_pImpl->m_xParentText = xParent;
}
}
return xContentControl;
@@ -294,7 +294,7 @@ SwXContentControl::CreateXContentControl(SwContentControl& rContentControl,
SAL_WARN("sw.uno", "CreateXContentControl: no text node");
return nullptr;
}
- uno::Reference<text::XText> xParentText(xParent);
+ css::uno::Reference<SwXText> xParentText(xParent);
if (!xParentText.is())
{
SwTextContentControl* pTextAttr = rContentControl.GetTextAttr();
@@ -304,7 +304,7 @@ SwXContentControl::CreateXContentControl(SwContentControl& rContentControl,
return nullptr;
}
SwPosition aPos(*pTextNode, pTextAttr->GetStart());
- xParentText.set(sw::CreateParentXText(pTextNode->GetDoc(), aPos));
+ xParentText = sw::CreateParentXText(pTextNode->GetDoc(), aPos);
}
if (!xParentText.is())
{
diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx
index d68169643f81..935b165bf274 100644
--- a/sw/source/core/unocore/unocrsrhelper.cxx
+++ b/sw/source/core/unocore/unocrsrhelper.cxx
@@ -651,7 +651,7 @@ bool getCursorPropertyValue(const SfxItemPropertyMapEntry& rEntry
{
if (pAny)
{
- uno::Reference<text::XTextContent> xParagraph = SwXParagraph::CreateXParagraph(pTextNode->GetDoc(), pTextNode);
+ uno::Reference<text::XTextContent> xParagraph = SwXParagraph::CreateXParagraph(pTextNode->GetDoc(), pTextNode, nullptr);
*pAny <<= xParagraph;
}
}
diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx
index 04f5ed1e33d5..6e9bf1cfe7e1 100644
--- a/sw/source/core/unocore/unoobj2.cxx
+++ b/sw/source/core/unocore/unoobj2.cxx
@@ -1250,10 +1250,10 @@ SwXTextRange::CreateXTextRange(
namespace sw {
-uno::Reference< text::XText >
+css::uno::Reference< SwXText >
CreateParentXText(SwDoc & rDoc, const SwPosition& rPos)
{
- uno::Reference< text::XText > xParentText;
+ css::uno::Reference< SwXText > xParentText;
SwStartNode* pSttNode = rPos.GetNode().StartOfSectionNode();
while(pSttNode && pSttNode->IsSectionNode())
{
@@ -1332,8 +1332,8 @@ CreateParentXText(SwDoc & rDoc, const SwPosition& rPos)
if (pSttNode == pTextFootnote->GetStartNode()->GetNode().
FindSttNodeByType(SwFootnoteStartNode))
{
- xParentText.set(SwXFootnote::CreateXFootnote(rDoc,
- &const_cast<SwFormatFootnote&>(rFootnote)));
+ xParentText = SwXFootnote::CreateXFootnote(rDoc,
+ &const_cast<SwFormatFootnote&>(rFootnote));
break;
}
}
@@ -1347,7 +1347,7 @@ CreateParentXText(SwDoc & rDoc, const SwPosition& rPos)
const uno::Reference<frame::XModel> xModel = pDocSh->GetBaseModel();
const uno::Reference< text::XTextDocument > xDoc(
xModel, uno::UNO_QUERY);
- xParentText = xDoc->getText();
+ xParentText = dynamic_cast<SwXText*>(xDoc->getText().get());
}
}
}
diff --git a/sw/source/core/unocore/unoparagraph.cxx b/sw/source/core/unocore/unoparagraph.cxx
index 15f9b56c490f..198f23ff2272 100644
--- a/sw/source/core/unocore/unoparagraph.cxx
+++ b/sw/source/core/unocore/unoparagraph.cxx
@@ -125,11 +125,11 @@ public:
sal_Int32 m_nSelectionStartPos;
sal_Int32 m_nSelectionEndPos;
OUString m_sText;
- uno::Reference<text::XText> m_xParentText;
+ css::uno::Reference<SwXText> m_xParentText;
SwTextNode* m_pTextNode;
Impl(SwXParagraph& rThis,
- SwTextNode* const pTextNode = nullptr, uno::Reference<text::XText> xParent = nullptr,
+ SwTextNode* const pTextNode = nullptr, css::uno::Reference<SwXText> xParent = nullptr,
const sal_Int32 nSelStart = -1, const sal_Int32 nSelEnd = -1)
: m_rThis(rThis)
, m_rPropSet(*aSwMapProvider.GetPropertySet(PROPERTY_MAP_PARAGRAPH))
@@ -219,7 +219,7 @@ SwXParagraph::SwXParagraph()
}
SwXParagraph::SwXParagraph(
- uno::Reference< text::XText > const & xParent,
+ css::uno::Reference< SwXText > const & xParent,
SwTextNode & rTextNode,
const sal_Int32 nSelStart, const sal_Int32 nSelEnd)
: m_pImpl(
@@ -243,7 +243,7 @@ bool SwXParagraph::IsDescriptor() const
rtl::Reference<SwXParagraph>
SwXParagraph::CreateXParagraph(SwDoc & rDoc, SwTextNode *const pTextNode,
- uno::Reference< text::XText> const& i_xParent,
+ css::uno::Reference< SwXText> const& i_xParent,
const sal_Int32 nSelStart, const sal_Int32 nSelEnd)
{
// re-use existing SwXParagraph
@@ -259,11 +259,11 @@ SwXParagraph::CreateXParagraph(SwDoc & rDoc, SwTextNode *const pTextNode,
}
// create new SwXParagraph
- uno::Reference<text::XText> xParentText(i_xParent);
+ css::uno::Reference<SwXText> xParentText(i_xParent);
if (!xParentText.is() && pTextNode)
{
SwPosition Pos(*pTextNode);
- xParentText.set(::sw::CreateParentXText( rDoc, Pos ));
+ xParentText = ::sw::CreateParentXText( rDoc, Pos );
}
SwXParagraph *const pXPara( pTextNode
? new SwXParagraph(xParentText, *pTextNode, nSelStart, nSelEnd)
diff --git a/sw/source/core/unocore/unoportenum.cxx b/sw/source/core/unocore/unoportenum.cxx
index fd6cc626336b..642a49ae1805 100644
--- a/sw/source/core/unocore/unoportenum.cxx
+++ b/sw/source/core/unocore/unoportenum.cxx
@@ -1,4 +1,5 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
@@ -23,6 +24,7 @@
#include <utility>
#include <unoport.hxx>
+#include <unotext.hxx>
#include <IMark.hxx>
#include <crossrefbookmark.hxx>
#include <annotationmark.hxx>
@@ -74,7 +76,7 @@ typedef std::stack< PortionList_t > PortionStack_t;
static void lcl_CreatePortions(
TextRangeList_t & i_rPortions,
- uno::Reference< text::XText > const& i_xParentText,
+ css::uno::Reference< SwXText > const& i_xParentText,
SwUnoCursor* pUnoCursor,
FrameClientSortList_t & i_rFrames,
const sal_Int32 i_nStartPos, const sal_Int32 i_nEndPos, bool bOnlyTextFields );
@@ -296,7 +298,7 @@ Sequence< OUString > SwXTextPortionEnumeration::getSupportedServiceNames()
SwXTextPortionEnumeration::SwXTextPortionEnumeration(
SwPaM& rParaCursor,
- uno::Reference< XText > const & xParentText,
+ css::uno::Reference< SwXText > const & xParentText,
const sal_Int32 nStart,
const sal_Int32 nEnd,
bool bOnlyTextFields)
@@ -516,7 +518,7 @@ lcl_CreateTOXMarkPortion(
static uno::Reference<text::XTextRange>
lcl_CreateMetaPortion(
- uno::Reference<text::XText> const& xParent,
+ css::uno::Reference<SwXText> const& xParent,
const SwUnoCursor * const pUnoCursor,
SwTextAttr & rAttr, std::unique_ptr<TextRangeList_t const> && pPortions)
{
@@ -542,7 +544,7 @@ lcl_CreateMetaPortion(
/// Creates a text portion that has a non-empty ContentControl property.
static uno::Reference<text::XTextRange>
-lcl_CreateContentControlPortion(const uno::Reference<text::XText>& xParent,
+lcl_CreateContentControlPortion(const css::uno::Reference<SwXText>& xParent,
const SwUnoCursor* pUnoCursor, SwTextAttr& rAttr,
std::unique_ptr<const TextRangeList_t>&& pPortions)
{
@@ -701,7 +703,7 @@ SwXRedlinePortion_ImplList;
static Reference<XTextRange>
lcl_ExportHints(
PortionStack_t & rPortionStack,
- const Reference<XText> & xParent,
+ const css::uno::Reference<SwXText> & xParent,
SwUnoCursor * const pUnoCursor,
SwpHints const * const pHints,
const sal_Int32 i_nStartPos,
@@ -1330,7 +1332,7 @@ static sal_Int32 lcl_GetNextIndex(
static void lcl_CreatePortions(
TextRangeList_t & i_rPortions,
- uno::Reference< text::XText > const & i_xParentText,
+ css::uno::Reference< SwXText > const & i_xParentText,
SwUnoCursor * const pUnoCursor,
FrameClientSortList_t & i_rFrames,
const sal_Int32 i_nStartPos,
diff --git a/sw/source/core/unocore/unorefmk.cxx b/sw/source/core/unocore/unorefmk.cxx
index 20d3b7d323d1..feb403c05f0d 100644
--- a/sw/source/core/unocore/unorefmk.cxx
+++ b/sw/source/core/unocore/unorefmk.cxx
@@ -516,8 +516,7 @@ SwXMetaText::SwXMetaText(SwDoc & rDoc, SwXMeta & rMeta)
const SwStartNode *SwXMetaText::GetStartNode() const
{
- SwXText const * const pParent(
- dynamic_cast<SwXText*>(m_rMeta.GetParentText().get()));
+ SwXText const * const pParent = m_rMeta.GetParentText().get();
return pParent ? pParent->GetStartNode() : nullptr;
}
@@ -588,13 +587,13 @@ public:
// 3 possible states: not attached, attached, disposed
bool m_bIsDisposed;
bool m_bIsDescriptor;
- uno::Reference<text::XText> m_xParentText;
+ css::uno::Reference<SwXText> m_xParentText;
rtl::Reference<SwXMetaText> m_xText;
sw::Meta* m_pMeta;
Impl(SwXMeta& rThis, SwDoc& rDoc,
::sw::Meta* const pMeta,
- uno::Reference<text::XText> xParentText,
+ css::uno::Reference<SwXText> xParentText,
std::unique_ptr<TextRangeList_t const> pPortions)
: m_pTextPortions(std::move(pPortions))
, m_bIsDisposed(false)
@@ -639,13 +638,13 @@ void SwXMeta::Impl::Notify(const SfxHint& rHint)
m_EventListeners.disposeAndClear(aGuard, ev);
}
-uno::Reference<text::XText> const & SwXMeta::GetParentText() const
+css::uno::Reference<SwXText> const & SwXMeta::GetParentText() const
{
return m_pImpl->m_xParentText;
}
SwXMeta::SwXMeta(SwDoc *const pDoc, ::sw::Meta *const pMeta,
- uno::Reference<text::XText> const& xParentText,
+ css::uno::Reference<SwXText> const& xParentText,
std::unique_ptr<TextRangeList_t const> pPortions)
: m_pImpl( new SwXMeta::Impl(*this, *pDoc, pMeta, xParentText, std::move(pPortions)) )
{
@@ -673,7 +672,7 @@ SwXMeta::CreateXMeta(SwDoc & rDoc, bool const isField)
rtl::Reference<SwXMeta>
SwXMeta::CreateXMeta(::sw::Meta & rMeta,
- uno::Reference<text::XText> const& i_xParent,
+ css::uno::Reference<SwXText> i_xParent,
std::unique_ptr<TextRangeList_t const> && pPortions)
{
// re-use existing SwXMeta
@@ -691,7 +690,7 @@ SwXMeta::CreateXMeta(::sw::Meta & rMeta,
if (xMeta->m_pImpl->m_xParentText.get() != i_xParent.get())
{
SAL_WARN("sw.uno", "SwXMeta with different parent?");
- xMeta->m_pImpl->m_xParentText.set(i_xParent);
+ xMeta->m_pImpl->m_xParentText = i_xParent;
}
}
return xMeta;
@@ -701,14 +700,14 @@ SwXMeta::CreateXMeta(::sw::Meta & rMeta,
SwTextNode * const pTextNode( rMeta.GetTextNode() );
SAL_WARN_IF(!pTextNode, "sw.uno", "CreateXMeta: no text node?");
if (!pTextNode) { return nullptr; }
- uno::Reference<text::XText> xParentText(i_xParent);
+ css::uno::Reference<SwXText> xParentText(i_xParent);
if (!xParentText.is())
{
SwTextMeta * const pTextAttr( rMeta.GetTextAttr() );
SAL_WARN_IF(!pTextAttr, "sw.uno", "CreateXMeta: no text attr?");
if (!pTextAttr) { return nullptr; }
const SwPosition aPos(*pTextNode, pTextAttr->GetStart());
- xParentText.set( ::sw::CreateParentXText(pTextNode->GetDoc(), aPos) );
+ xParentText = ::sw::CreateParentXText(pTextNode->GetDoc(), aPos);
}
if (!xParentText.is()) { return nullptr; }
// this is why the constructor is private: need to acquire pXMeta here
@@ -1190,7 +1189,7 @@ inline const ::sw::MetaField* SwXMeta::Impl::GetMetaField() const
}
SwXMetaField::SwXMetaField(SwDoc *const pDoc, ::sw::Meta *const pMeta,
- uno::Reference<text::XText> const& xParentText,
+ css::uno::Reference<SwXText> const& xParentText,
std::unique_ptr<TextRangeList_t const> pPortions)
: SwXMetaField_Base(pDoc, pMeta, xParentText, std::move(pPortions))
{
diff --git a/sw/source/core/unocore/unosect.cxx b/sw/source/core/unocore/unosect.cxx
index 69ec954d063a..490bd8d1c435 100644
--- a/sw/source/core/unocore/unosect.cxx
+++ b/sw/source/core/unocore/unosect.cxx
@@ -19,6 +19,7 @@
#include <memory>
#include <unosection.hxx>
+#include <unotext.hxx>
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
@@ -391,7 +392,7 @@ SwXTextSection::attach(const uno::Reference< text::XTextRange > & xTextRange)
static_cast< ::cppu::OWeakObject*>(this), 0);
}
m_pImpl->Attach(pRet->GetFormat());
- pRet->GetFormat()->SetXObject(static_cast< ::cppu::OWeakObject*>(this));
+ pRet->GetFormat()->SetXObject(static_cast<cppu::OWeakObject*>(this));
// XML import must hide sections depending on their old
// condition status
@@ -451,8 +452,8 @@ SwXTextSection::getAnchor()
}
if (isMoveIntoTable)
{
- uno::Reference<text::XText> const xParentText(
- ::sw::CreateParentXText(*pSectFormat->GetDoc(), SwPosition(*pIdx)));
+ css::uno::Reference<SwXText> const xParentText =
+ ::sw::CreateParentXText(*pSectFormat->GetDoc(), SwPosition(*pIdx));
xRet = new SwXTextRange(*pSectFormat);
}
else // for compatibility, keep the old way in this case
diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx
index f0d6c05b1693..9ca70148accd 100644
--- a/sw/source/core/unocore/unotext.cxx
+++ b/sw/source/core/unocore/unotext.cxx
@@ -2535,17 +2535,17 @@ class SwXHeadFootText::Impl
}
};
-uno::Reference<text::XText> SwXHeadFootText::CreateXHeadFootText(
+rtl::Reference<SwXHeadFootText> SwXHeadFootText::CreateXHeadFootText(
SwFrameFormat& rHeadFootFormat,
const bool bIsHeader)
{
// re-use existing SwXHeadFootText
// #i105557#: do not iterate over the registered clients: race condition
- uno::Reference<text::XText> xText(rHeadFootFormat.GetXObject(), uno::UNO_QUERY);
+ rtl::Reference<SwXHeadFootText> xText = dynamic_cast<SwXHeadFootText*>(rHeadFootFormat.GetXObject().get().get());
if(!xText.is())
{
xText = new SwXHeadFootText(rHeadFootFormat, bIsHeader);
- rHeadFootFormat.SetXObject(xText);
+ rHeadFootFormat.SetXObject(static_cast<cppu::OWeakObject*>(xText.get()));
}
return xText;
}