summaryrefslogtreecommitdiff
path: root/forms/source/xforms/model_ui.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 /forms/source/xforms/model_ui.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 'forms/source/xforms/model_ui.cxx')
-rw-r--r--forms/source/xforms/model_ui.cxx6
1 files changed, 2 insertions, 4 deletions
diff --git a/forms/source/xforms/model_ui.cxx b/forms/source/xforms/model_ui.cxx
index 39c269087710..7e28623c5a2f 100644
--- a/forms/source/xforms/model_ui.cxx
+++ b/forms/source/xforms/model_ui.cxx
@@ -669,7 +669,7 @@ Model::XNode_t Model::renameNode( const XNode_t& xNode,
// replace node
Reference<XNode> xParent = xNode->getParentNode();
xParent->removeChild( xNode );
- xNew = xParent->appendChild( Reference<XNode>( xAttr, UNO_QUERY ) );
+ xNew = xParent->appendChild( xAttr );
}
else
{
@@ -790,9 +790,7 @@ static OUString lcl_serializeForDisplay( const Reference<XNodeList>& xNodes )
Reference<XDocument> xDocument( getDocumentBuilder()->newDocument() );
Reference<XDocumentFragment> xFragment(
xDocument->createDocumentFragment() );
- Reference<XNode> xNode( xFragment, UNO_QUERY );
OSL_ENSURE( xFragment.is(), "xFragment" );
- OSL_ENSURE( xNode.is(), "xNode" );
sal_Int32 nAttributeNodes = 0;
@@ -824,7 +822,7 @@ static OUString lcl_serializeForDisplay( const Reference<XNodeList>& xNodes )
}
// append node
- xNode->appendChild( xDocument->importNode( xCurrent, sal_True ) );
+ xFragment->appendChild( xDocument->importNode( xCurrent, sal_True ) );
}
OSL_ENSURE( ( nAttributeNodes == 0 ) || ( nAttributeNodes == nLength ),
"lcl_serializeForDisplay: mixed attribute and non-attribute nodes?" );