diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2025-03-07 14:52:51 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2025-03-07 17:30:39 +0100 |
commit | a0ac8d313c9e8469b4545f5d4fc30894a3719004 (patch) | |
tree | 07dded5db5cc9236517a30bb51341bb4e97b8c64 /sw/source/ui/vba/vbacontentcontrol.cxx | |
parent | 9a1f131a124cc6620c2423da5867985300962a42 (diff) |
use more concrete UNO in sw
Change-Id: Ibea3bdca049dac353c7a1d3ab1311db38f7da132
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182620
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source/ui/vba/vbacontentcontrol.cxx')
-rw-r--r-- | sw/source/ui/vba/vbacontentcontrol.cxx | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/sw/source/ui/vba/vbacontentcontrol.cxx b/sw/source/ui/vba/vbacontentcontrol.cxx index 90c313422b49..1839b6afc82f 100644 --- a/sw/source/ui/vba/vbacontentcontrol.cxx +++ b/sw/source/ui/vba/vbacontentcontrol.cxx @@ -548,21 +548,19 @@ sal_Bool SwVbaContentControl::getShowingPlaceholderText() { return m_pCC->GetSho uno::Reference<word::XRange> SwVbaContentControl::getRange() { - uno::Reference<word::XRange> xRet; SwTextNode* pTextNode = m_pCC->GetTextNode(); - if (pTextNode && m_pCC->GetTextAttr()) - { - // Don't select the text attribute itself at the start. - SwPosition aStart(*pTextNode, m_pCC->GetTextAttr()->GetStart() + 1); - // Don't select the CH_TXTATR_BREAKWORD itself at the end. - SwPosition aEnd(*pTextNode, *m_pCC->GetTextAttr()->End() - 1); - rtl::Reference<SwXTextRange> xText( - SwXTextRange::CreateXTextRange(pTextNode->GetDoc(), aStart, &aEnd)); - if (xText.is()) - xRet = new SwVbaRange(mxParent, mxContext, mxTextDocument, xText->getStart(), - xText->getEnd()); - } - return xRet; + if (!pTextNode || !m_pCC->GetTextAttr()) + return nullptr; + + // Don't select the text attribute itself at the start. + SwPosition aStart(*pTextNode, m_pCC->GetTextAttr()->GetStart() + 1); + // Don't select the CH_TXTATR_BREAKWORD itself at the end. + SwPosition aEnd(*pTextNode, *m_pCC->GetTextAttr()->End() - 1); + rtl::Reference<SwXTextRange> xText( + SwXTextRange::CreateXTextRange(pTextNode->GetDoc(), aStart, &aEnd)); + if (!xText.is()) + return nullptr; + return new SwVbaRange(mxParent, mxContext, mxTextDocument, xText->getStart(), xText->getEnd()); } OUString SwVbaContentControl::getRepeatingSectionItemTitle() |