[PATCH] Create conversion constructor for Reference

Noel Grandin (via Code Review) gerrit at gerrit.libreoffice.org
Fri Apr 26 00:11:06 PDT 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/3613

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/13/3613/1

Create conversion constructor for Reference

makes UNO code less noisy.

Change-Id: Ib501f462e232ad7eda57e2a74634ea0646877e0f
---
M include/com/sun/star/uno/Reference.h
M sd/source/core/CustomAnimationEffect.cxx
2 files changed, 12 insertions(+), 1 deletion(-)



diff --git a/include/com/sun/star/uno/Reference.h b/include/com/sun/star/uno/Reference.h
index 94551a0..3297abc 100644
--- a/include/com/sun/star/uno/Reference.h
+++ b/include/com/sun/star/uno/Reference.h
@@ -248,6 +248,17 @@
         @param rRef another reference
     */
     inline Reference( const Reference< interface_type > & rRef ) SAL_THROW(());
+
+    /** Up-casting conversion constructor: Copies interface reference.
+
+        @param rRef another reference
+    */
+    template< class derived_interface_type >
+    inline Reference( const Reference< derived_interface_type > & rRef )
+    {
+        _pInterface = iquery( static_cast< interface_type* >(rRef.get()) );
+    }
+
     /** Constructor: Sets given interface pointer.
 
         @param pInterface an interface pointer
diff --git a/sd/source/core/CustomAnimationEffect.cxx b/sd/source/core/CustomAnimationEffect.cxx
index 21a098f..827bed2 100644
--- a/sd/source/core/CustomAnimationEffect.cxx
+++ b/sd/source/core/CustomAnimationEffect.cxx
@@ -1022,7 +1022,7 @@
     xAnimate->setFill( AnimationFill::HOLD );
     xAnimate->setTarget( maTarget );
 
-    return Reference< XAnimationNode >( xAnimate, UNO_QUERY_THROW );
+    return xAnimate;
 }
 
 // --------------------------------------------------------------------

-- 
To view, visit https://gerrit.libreoffice.org/3613
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib501f462e232ad7eda57e2a74634ea0646877e0f
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Noel Grandin <noelgrandin at gmail.com>



More information about the LibreOffice mailing list