From 6a043e9c0acff20e1618ca8ec15c21d5d0fd0d37 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 2 May 2013 10:36:43 +0200 Subject: 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 Reviewed-by: Noel Grandin Tested-by: Noel Grandin --- xmloff/source/text/txtimp.cxx | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'xmloff/source/text/txtimp.cxx') 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 xRange(rCursor, UNO_QUERY); Reference 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&) -- cgit