summaryrefslogtreecommitdiff
path: root/xmloff/source/text/txtimp.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2013-05-02 10:36:43 +0200
committerNoel Grandin <noelgrandin@gmail.com>2013-05-22 10:44:29 +0000
commit6a043e9c0acff20e1618ca8ec15c21d5d0fd0d37 (patch)
tree2746468845d6f1159e3759ee2cf7a620fca15b6e /xmloff/source/text/txtimp.cxx
parent697a007c61b9cabceb9767fad87cd5822b300452 (diff)
Use the new type-checking Reference constructor to reduce code noise
Also create a Clang compiler plugin to detect such cases. Change-Id: I61ad1a1d6b1c017eeb51f226d2dde0e9bb7f1752 Reviewed-on: https://gerrit.libreoffice.org/4001 Tested-by: LibreOffice gerrit bot <gerrit@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'xmloff/source/text/txtimp.cxx')
-rw-r--r--xmloff/source/text/txtimp.cxx11
1 files changed, 5 insertions, 6 deletions
diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx
index 4b15efc9acfc..94f91c08a10b 100644
--- a/xmloff/source/text/txtimp.cxx
+++ b/xmloff/source/text/txtimp.cxx
@@ -1715,25 +1715,24 @@ OUString XMLTextImportHelper::SetStyleAndAttrs(
makeAny(rCursor->getString()));
// insert the field over it's original text
- Reference<XTextRange> xRange(rCursor, UNO_QUERY);
Reference<XTextContent> xTextContent(xTmp, UNO_QUERY);
- if (m_pImpl->m_xText.is() && xRange.is())
+ if (m_pImpl->m_xText.is() && rCursor.is())
{
// #i107225# the combined characters need to be inserted first
// the selected text has to be removed afterwards
- m_pImpl->m_xText->insertTextContent( xRange->getStart(), xTextContent, sal_True );
+ m_pImpl->m_xText->insertTextContent( rCursor->getStart(), xTextContent, sal_True );
- if( !xRange->getString().isEmpty() )
+ if( !rCursor->getString().isEmpty() )
{
try
{
- uno::Reference< text::XTextCursor > xCrsr = xRange->getText()->createTextCursorByRange( xRange->getStart() );
+ uno::Reference< text::XTextCursor > xCrsr = rCursor->getText()->createTextCursorByRange( rCursor->getStart() );
xCrsr->goLeft( 1, true );
uno::Reference< beans::XPropertySet> xCrsrProperties( xCrsr, uno::UNO_QUERY_THROW );
//the hard properties of the removed text need to be applied to the combined characters field
pStyle->FillPropertySet( xCrsrProperties );
xCrsr->collapseToEnd();
- xCrsr->gotoRange( xRange->getEnd(), true );
+ xCrsr->gotoRange( rCursor->getEnd(), true );
xCrsr->setString( OUString() );
}
catch(const uno::Exception&)