[Libreoffice-commits] .: svx/inc svx/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Dec 17 11:57:11 PST 2012


 svx/inc/svx/svdoashp.hxx       |    4 +---
 svx/source/svdraw/svdoashp.cxx |   28 +++++++++++-----------------
 2 files changed, 12 insertions(+), 20 deletions(-)

New commits:
commit bb3f2900a867fdcb6df916fff58199b4ce94dd05
Author: Michael Meeks <michael.meeks at suse.com>
Date:   Mon Dec 17 19:55:32 2012 +0000

    fdo#58399 - revert attempts to untangle and accelerate this mess.
    
    Reverts commits:
        76350361f386b78e1bc9edb75af89e7ff3afe356
        67f899e1d2db0dccde4b9587a52b7157fe1fb0be
        1d77d4eada214e14938336070b248c18705939ff
        1d16f59023b1b19d01ca69b8c9735be6d3baf5d9
    
    The bug has a great series of linked bugs and stack-traces; the
    weakref / mixed tools & UNO lifecycle here is simply hideous.

diff --git a/svx/inc/svx/svdoashp.hxx b/svx/inc/svx/svdoashp.hxx
index 987132f..847ebf1 100644
--- a/svx/inc/svx/svdoashp.hxx
+++ b/svx/inc/svx/svdoashp.hxx
@@ -92,12 +92,10 @@ public:
 
     com::sun::star::uno::Reference< com::sun::star::drawing::XShape > mXRenderedCustomShape;
 
-    mutable com::sun::star::uno::Reference< com::sun::star::drawing::XCustomShapeEngine > mxCustomShapeEngine;
-
     // #i37011# render geometry shadow
     SdrObject*                                          mpLastShadowGeometry;
 
-    com::sun::star::uno::Reference< com::sun::star::drawing::XCustomShapeEngine > GetCustomShapeEngine() const;
+    static com::sun::star::uno::Reference< com::sun::star::drawing::XCustomShapeEngine > GetCustomShapeEngine( const SdrObjCustomShape* pCustomShape );
 
 //  SVX_DLLPRIVATE com::sun::star::uno::Sequence< com::sun::star::uno::Reference< com::sun::star::drawing::XCustomShapeHandle > >
 //      SdrObjCustomShape::GetInteraction( const SdrObjCustomShape* pCustomShape ) const;
diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx
index 61b9002..abce04a 100644
--- a/svx/source/svdraw/svdoashp.cxx
+++ b/svx/source/svdraw/svdoashp.cxx
@@ -87,6 +87,7 @@ using namespace ::com::sun::star::lang;
 using namespace ::com::sun::star::beans;
 using namespace ::com::sun::star::drawing;
 
+
 static void lcl_ShapeSegmentFromBinary( EnhancedCustomShapeSegment& rSegInfo, sal_uInt16 nSDat )
 {
     switch( nSDat >> 8 )
@@ -389,18 +390,16 @@ SdrObject* ImpCreateShadowObjectClone(const SdrObject& rOriginal, const SfxItemS
 
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 
-Reference< XCustomShapeEngine > SdrObjCustomShape::GetCustomShapeEngine() const
+Reference< XCustomShapeEngine > SdrObjCustomShape::GetCustomShapeEngine( const SdrObjCustomShape* pCustomShape )
 {
-    if (mxCustomShapeEngine.is())
-        return mxCustomShapeEngine;
-
-    String aEngine(((SdrCustomShapeEngineItem&)GetMergedItem( SDRATTR_CUSTOMSHAPE_ENGINE )).GetValue());
+    Reference< XCustomShapeEngine > xCustomShapeEngine;
+    String aEngine(((SdrCustomShapeEngineItem&)pCustomShape->GetMergedItem( SDRATTR_CUSTOMSHAPE_ENGINE )).GetValue());
     if ( !aEngine.Len() )
         aEngine = String( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.drawing.EnhancedCustomShapeEngine" ) );
 
     Reference< XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
 
-    Reference< XShape > aXShape = GetXShapeForSdrObject(const_cast<SdrObjCustomShape*>(this));
+    Reference< XShape > aXShape = GetXShapeForSdrObject( (SdrObjCustomShape*)pCustomShape );
     if ( aXShape.is() )
     {
         if ( aEngine.Len() && xFactory.is() )
@@ -412,18 +411,16 @@ Reference< XCustomShapeEngine > SdrObjCustomShape::GetCustomShapeEngine() const
             aArgument[ 0 ] <<= aPropValues;
             Reference< XInterface > xInterface( xFactory->createInstanceWithArguments( aEngine, aArgument ) );
             if ( xInterface.is() )
-                mxCustomShapeEngine = Reference< XCustomShapeEngine >( xInterface, UNO_QUERY );
+                xCustomShapeEngine = Reference< XCustomShapeEngine >( xInterface, UNO_QUERY );
         }
     }
-
-    return mxCustomShapeEngine;
+    return xCustomShapeEngine;
 }
-
 const SdrObject* SdrObjCustomShape::GetSdrObjectFromCustomShape() const
 {
     if ( !mXRenderedCustomShape.is() )
     {
-        Reference< XCustomShapeEngine > xCustomShapeEngine( GetCustomShapeEngine() );
+        Reference< XCustomShapeEngine > xCustomShapeEngine( GetCustomShapeEngine( this ) );
         if ( xCustomShapeEngine.is() )
             ((SdrObjCustomShape*)this)->mXRenderedCustomShape = xCustomShapeEngine->render();
     }
@@ -550,12 +547,10 @@ double SdrObjCustomShape::GetExtraTextRotation( const bool bPreRotation ) const
         *pAny >>= fExtraTextRotateAngle;
     return fExtraTextRotateAngle;
 }
-
 sal_Bool SdrObjCustomShape::GetTextBounds( Rectangle& rTextBound ) const
 {
     sal_Bool bRet = sal_False;
-
-    Reference< XCustomShapeEngine > xCustomShapeEngine( GetCustomShapeEngine() );
+    Reference< XCustomShapeEngine > xCustomShapeEngine( GetCustomShapeEngine( this ) ); // a candidate for being cached
     if ( xCustomShapeEngine.is() )
     {
         awt::Rectangle aR( xCustomShapeEngine->getTextBounds() );
@@ -570,7 +565,7 @@ sal_Bool SdrObjCustomShape::GetTextBounds( Rectangle& rTextBound ) const
 basegfx::B2DPolyPolygon SdrObjCustomShape::GetLineGeometry( const SdrObjCustomShape* pCustomShape, const sal_Bool bBezierAllowed )
 {
     basegfx::B2DPolyPolygon aRetval;
-    Reference< XCustomShapeEngine > xCustomShapeEngine( pCustomShape->GetCustomShapeEngine() );
+    Reference< XCustomShapeEngine > xCustomShapeEngine( GetCustomShapeEngine( pCustomShape ) );
     if ( xCustomShapeEngine.is() )
     {
         com::sun::star::drawing::PolyPolygonBezierCoords aBezierCoords = xCustomShapeEngine->getLineGeometry();
@@ -594,7 +589,7 @@ std::vector< SdrCustomShapeInteraction > SdrObjCustomShape::GetInteractionHandle
     std::vector< SdrCustomShapeInteraction > xRet;
     try
     {
-        Reference< XCustomShapeEngine > xCustomShapeEngine( pCustomShape->GetCustomShapeEngine() );
+        Reference< XCustomShapeEngine > xCustomShapeEngine( GetCustomShapeEngine( pCustomShape ) );
         if ( xCustomShapeEngine.is() )
         {
             int i;
@@ -3211,7 +3206,6 @@ bool SdrObjCustomShape::doConstructOrthogonal(const ::rtl::OUString& rName)
 void SdrObjCustomShape::InvalidateRenderGeometry()
 {
     mXRenderedCustomShape = 0L;
-    mxCustomShapeEngine = 0L;
     SdrObject::Free( mpLastShadowGeometry );
     mpLastShadowGeometry = 0L;
 }


More information about the Libreoffice-commits mailing list