summaryrefslogtreecommitdiff
path: root/unoxml
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 /unoxml
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 'unoxml')
-rw-r--r--unoxml/source/dom/attr.cxx2
-rw-r--r--unoxml/source/dom/characterdata.cxx2
-rw-r--r--unoxml/source/dom/document.cxx2
-rw-r--r--unoxml/source/dom/element.cxx8
-rw-r--r--unoxml/source/dom/node.cxx6
-rw-r--r--unoxml/source/dom/node.hxx2
-rw-r--r--unoxml/source/dom/saxbuilder.cxx12
7 files changed, 17 insertions, 17 deletions
diff --git a/unoxml/source/dom/attr.cxx b/unoxml/source/dom/attr.cxx
index dfa15b1f16be..4eaa92216056 100644
--- a/unoxml/source/dom/attr.cxx
+++ b/unoxml/source/dom/attr.cxx
@@ -207,7 +207,7 @@ namespace DOM
guard.clear(); // release mutex before calling event handlers
- dispatchEvent(Reference< XEvent >(event, UNO_QUERY));
+ dispatchEvent(event);
dispatchSubtreeModified();
}
diff --git a/unoxml/source/dom/characterdata.cxx b/unoxml/source/dom/characterdata.cxx
index e2b4ba97fa49..2282171e438b 100644
--- a/unoxml/source/dom/characterdata.cxx
+++ b/unoxml/source/dom/characterdata.cxx
@@ -48,7 +48,7 @@ namespace DOM
"DOMCharacterDataModified",
sal_True, sal_False, Reference< XNode >(),
prevValue, newValue, OUString(), (AttrChangeType)0 );
- dispatchEvent(Reference< XEvent >(event, UNO_QUERY));
+ dispatchEvent(event);
dispatchSubtreeModified();
}
diff --git a/unoxml/source/dom/document.cxx b/unoxml/source/dom/document.cxx
index 0c69dfb64cee..779b4c5d7416 100644
--- a/unoxml/source/dom/document.cxx
+++ b/unoxml/source/dom/document.cxx
@@ -898,7 +898,7 @@ namespace DOM
"DOMNodeInsertedIntoDocument", sal_True, sal_False, Reference< XNode >(),
OUString(), OUString(), OUString(), (AttrChangeType)0 );
Reference< XEventTarget > const xDocET(xDocument, UNO_QUERY);
- xDocET->dispatchEvent(Reference< XEvent >(event, UNO_QUERY));
+ xDocET->dispatchEvent(event);
}
return xNode;
diff --git a/unoxml/source/dom/element.cxx b/unoxml/source/dom/element.cxx
index 0149ca972768..41cfb0f0a515 100644
--- a/unoxml/source/dom/element.cxx
+++ b/unoxml/source/dom/element.cxx
@@ -575,13 +575,13 @@ namespace DOM
Reference< XMutationEvent > event(docevent->createEvent(
"DOMAttrModified"), UNO_QUERY);
event->initMutationEvent("DOMAttrModified",
- sal_True, sal_False, Reference< XNode >(xAttr, UNO_QUERY),
+ sal_True, sal_False, xAttr,
OUString(), xAttr->getValue(), xAttr->getName(),
AttrChangeType_ADDITION);
guard.clear(); // release mutex before calling event handlers
- dispatchEvent(Reference< XEvent >(event, UNO_QUERY));
+ dispatchEvent(event);
dispatchSubtreeModified();
return xAttr;
@@ -645,7 +645,7 @@ namespace DOM
oldValue, value, name, aChangeType);
guard.clear(); // release mutex before calling event handlers
- dispatchEvent(Reference< XEvent >(event, UNO_QUERY));
+ dispatchEvent(event);
dispatchSubtreeModified();
}
@@ -727,7 +727,7 @@ namespace DOM
oldValue, value, qualifiedName, aChangeType);
guard.clear(); // release mutex before calling event handlers
- dispatchEvent(Reference< XEvent >(event, UNO_QUERY));
+ dispatchEvent(event);
dispatchSubtreeModified();
}
diff --git a/unoxml/source/dom/node.cxx b/unoxml/source/dom/node.cxx
index a071247a1a2b..e68cd6afbf6d 100644
--- a/unoxml/source/dom/node.cxx
+++ b/unoxml/source/dom/node.cxx
@@ -378,7 +378,7 @@ namespace DOM
// and call event listeners, so release mutex to prevent deadlocks.
guard.clear();
- dispatchEvent(Reference< XEvent >(event, UNO_QUERY));
+ dispatchEvent(event);
// dispatch subtree modified for this node
dispatchSubtreeModified();
@@ -819,7 +819,7 @@ namespace DOM
// and call event listeners, so release mutex to prevent deadlocks.
guard.clear();
- dispatchEvent(Reference< XEvent >(event, UNO_QUERY));
+ dispatchEvent(event);
// subtree modified for this node
dispatchSubtreeModified();
@@ -943,7 +943,7 @@ namespace DOM
"DOMSubtreeModified", sal_True,
sal_False, Reference< XNode >(),
OUString(), OUString(), OUString(), (AttrChangeType)0 );
- dispatchEvent(Reference< XEvent >(event, UNO_QUERY));
+ dispatchEvent(event);
}
/**
diff --git a/unoxml/source/dom/node.hxx b/unoxml/source/dom/node.hxx
index b7e29544300a..093b7023cbb8 100644
--- a/unoxml/source/dom/node.hxx
+++ b/unoxml/source/dom/node.hxx
@@ -63,7 +63,7 @@ namespace DOM
maNamespaces( 1, std::vector<Namespace>() ),
maNamespaceMap(101),
mxAttribList(new FastAttributeList(i_xTokenHandler)),
- mxCurrentHandler(i_xHandler, UNO_QUERY_THROW),
+ mxCurrentHandler(i_xHandler),
mxDocHandler(i_xHandler),
mxTokenHandler(i_xTokenHandler)
{}
diff --git a/unoxml/source/dom/saxbuilder.cxx b/unoxml/source/dom/saxbuilder.cxx
index 459cd6bb9ee9..4568e745e008 100644
--- a/unoxml/source/dom/saxbuilder.cxx
+++ b/unoxml/source/dom/saxbuilder.cxx
@@ -135,7 +135,7 @@ namespace DOM
m_aDocument = ownerDoc;
Reference< XDocumentFragment > aFragment = m_aDocument->createDocumentFragment();
- m_aNodeStack.push(Reference< XNode >(aFragment, UNO_QUERY));
+ m_aNodeStack.push(aFragment);
m_aFragment = aFragment;
m_aState = SAXDocumentBuilderState_BUILDING_FRAGMENT;
}
@@ -169,7 +169,7 @@ namespace DOM
Reference< XDocumentBuilder > aBuilder(DocumentBuilder::create(comphelper::getComponentContext(m_aServiceManager)));
Reference< XDocument > aDocument = aBuilder->newDocument();
- m_aNodeStack.push(Reference< XNode >(aDocument, UNO_QUERY));
+ m_aNodeStack.push(aDocument);
m_aDocument = aDocument;
m_aState = SAXDocumentBuilderState_BUILDING_DOCUMENT;
}
@@ -258,9 +258,9 @@ namespace DOM
aElement = m_aDocument->createElement(aName);
}
aElement = Reference< XElement > (
- m_aNodeStack.top()->appendChild(Reference< XNode >(aElement, UNO_QUERY)),
+ m_aNodeStack.top()->appendChild(aElement),
UNO_QUERY);
- m_aNodeStack.push(Reference< XNode >(aElement, UNO_QUERY));
+ m_aNodeStack.push(aElement);
// set non xmlns attributes
aPrefix = OUString();
@@ -332,7 +332,7 @@ namespace DOM
throw SAXException();
Reference< XText > aText = m_aDocument->createTextNode(aChars);
- m_aNodeStack.top()->appendChild(Reference< XNode >(aText, UNO_QUERY));
+ m_aNodeStack.top()->appendChild(aText);
}
void SAL_CALL CSAXDocumentBuilder::ignorableWhitespace(const OUString& )
@@ -358,7 +358,7 @@ namespace DOM
Reference< XProcessingInstruction > aInstruction = m_aDocument->createProcessingInstruction(
aTarget, aData);
- m_aNodeStack.top()->appendChild(Reference< XNode >(aInstruction, UNO_QUERY));
+ m_aNodeStack.top()->appendChild(aInstruction);
}
void SAL_CALL CSAXDocumentBuilder::setDocumentLocator(const Reference< XLocator >& aLocator)