[Libreoffice-commits] core.git: 2 commits - android/experimental sd/source

Tomaž Vajngerl tomaz.vajngerl at collabora.com
Thu Sep 11 04:02:18 PDT 2014


 android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java            |    6 -
 android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/GeckoLayerClient.java |   40 ++-----
 sd/source/ui/unoidl/unohelp.hxx                                                      |    4 
 sd/source/ui/unoidl/unomodel.cxx                                                     |   46 +++++---
 sd/source/ui/unoidl/unopage.cxx                                                      |   55 ++++++----
 5 files changed, 82 insertions(+), 69 deletions(-)

New commits:
commit 0968e47b7190832c6c06c0aa38f8da129660f854
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.com>
Date:   Thu Sep 11 12:56:57 2014 +0200

    android: remove unneeded code paths
    
    Change-Id: I5da4ca67caf2bc2e368c74cf719b080c63b6d47f

diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java
index a831a55..b9dc0fb 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java
@@ -64,11 +64,7 @@ public class LOKitThread extends Thread {
         mViewportMetrics.setPageSize(new FloatSize(pageWidth, pageHeight));
 
         GeckoLayerClient layerClient = mApplication.getLayerClient();
-        boolean shouldContinue = layerClient.beginDrawing(mViewportMetrics);
-
-        if (!shouldContinue) {
-            return false;
-        }
+        layerClient.beginDrawing(mViewportMetrics);
 
         ViewportMetrics metrics = mApplication.getLayerController().getViewportMetrics();
         RectF viewport = normlizeRect(metrics);
diff --git a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/GeckoLayerClient.java b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/GeckoLayerClient.java
index bfac3a9..cf13afb 100644
--- a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/GeckoLayerClient.java
+++ b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/GeckoLayerClient.java
@@ -81,18 +81,12 @@ public class GeckoLayerClient {
         mScreenSize = new IntSize(0, 0);
     }
 
-    protected boolean setupLayer() {
-        Log.i(LOGTAG, "Creating MultiTileLayer");
+    protected void setupLayer() {
         if (mTileLayer == null) {
+            Log.i(LOGTAG, "Creating MultiTileLayer");
             mTileLayer = new MultiTileLayer(TILE_SIZE);
             mLayerController.setRoot(mTileLayer);
         }
-
-        // Force a resize event to be sent because the results of this
-        // are different depending on what tile system we're using
-        //sendResizeEventIfNecessary(true);
-
-        return false;
     }
 
     protected void updateLayerAfterDraw() {
@@ -119,15 +113,10 @@ public class GeckoLayerClient {
         sendResizeEventIfNecessary(false);
     }
 
-    public boolean beginDrawing(ViewportMetrics viewportMetrics) {
-        if (setupLayer()) {
-            Log.e(LOGTAG, "### Cancelling due to layer setup");
-            return false;
-        }
+    public void beginDrawing(ViewportMetrics viewportMetrics) {
+        setupLayer();
         mNewGeckoViewport = viewportMetrics;
         mTileLayer.beginTransaction();
-
-        return true;
     }
 
     public void endDrawing() {
@@ -213,19 +202,11 @@ public class GeckoLayerClient {
 
         long timeDelta = System.currentTimeMillis() - mLastViewportChangeTime;
         if (timeDelta < MIN_VIEWPORT_CHANGE_DELAY) {
-            mLayerController.getView().postDelayed(
-                    new Runnable() {
-                        public void run() {
-                            mPendingViewportAdjust = false;
-                            adjustViewport();
-                        }
-                    }, MIN_VIEWPORT_CHANGE_DELAY - timeDelta
-            );
+            mLayerController.getView().postDelayed(new AdjustRunnable(), MIN_VIEWPORT_CHANGE_DELAY - timeDelta);
             mPendingViewportAdjust = true;
-            return;
+        } else {
+            adjustViewport();
         }
-
-        adjustViewport();
     }
 
     public void viewportSizeChanged() {
@@ -273,4 +254,11 @@ public class GeckoLayerClient {
         }
         return null;
     }
+
+    private class AdjustRunnable implements Runnable {
+        public void run() {
+            mPendingViewportAdjust = false;
+            adjustViewport();
+        }
+    }
 }
\ No newline at end of file
commit aa4ac53ecdb5726a36ec642f860526f790586db9
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.com>
Date:   Thu Aug 14 20:32:26 2014 +0200

    get rid of QUERYINT macro in sd
    
    Change-Id: I058cf5bdd3d11fb28b3e497c1a13e4ffc7e4ed84

diff --git a/sd/source/ui/unoidl/unohelp.hxx b/sd/source/ui/unoidl/unohelp.hxx
index 8b43596..507d4dd 100644
--- a/sd/source/ui/unoidl/unohelp.hxx
+++ b/sd/source/ui/unoidl/unohelp.hxx
@@ -29,10 +29,6 @@ inline void bool2any( bool bBool, ::com::sun::star::uno::Any& rAny )
 
 }
 
-#define QUERYINT( xint ) \
-    if( rType == ::getCppuType((const uno::Reference< xint >*)0) ) \
-        aAny <<= uno::Reference< xint >(this)
-
 #endif // INCLUDED_SD_SOURCE_UI_UNOIDL_UNOHELP_HXX
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index abdda6d..ff86a44 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -251,24 +251,36 @@ uno::Any SAL_CALL SdXImpressDocument::queryInterface( const uno::Type & rType )
 {
     uno::Any aAny;
 
-    QUERYINT(lang::XServiceInfo);
-    else QUERYINT(beans::XPropertySet);
-    else QUERYINT(lang::XMultiServiceFactory);
-    else QUERYINT(drawing::XDrawPageDuplicator);
-    else QUERYINT(drawing::XLayerSupplier);
-    else QUERYINT(drawing::XMasterPagesSupplier);
-    else QUERYINT(drawing::XDrawPagesSupplier);
-    else QUERYINT(presentation::XHandoutMasterSupplier);
-    else QUERYINT(document::XLinkTargetSupplier);
-    else QUERYINT(style::XStyleFamiliesSupplier);
-    else QUERYINT(com::sun::star::ucb::XAnyCompareFactory);
-    else QUERYINT(view::XRenderable);
-    else if( mbImpressDoc && rType == cppu::UnoType<presentation::XPresentationSupplier>::get() )
-            aAny <<= uno::Reference< presentation::XPresentationSupplier >(this);
-    else if( mbImpressDoc && rType == cppu::UnoType<presentation::XCustomPresentationSupplier>::get() )
-            aAny <<= uno::Reference< presentation::XCustomPresentationSupplier >(this);
+    if (rType == cppu::UnoType<lang::XServiceInfo>::get())
+        aAny <<= uno::Reference<lang::XServiceInfo>(this);
+    else if (rType == cppu::UnoType<beans::XPropertySet>::get())
+        aAny <<= uno::Reference<beans::XPropertySet>(this);
+    else if (rType == cppu::UnoType<lang::XMultiServiceFactory>::get())
+        aAny <<= uno::Reference<lang::XMultiServiceFactory>(this);
+    else if (rType == cppu::UnoType<drawing::XDrawPageDuplicator>::get())
+        aAny <<= uno::Reference<drawing::XDrawPageDuplicator>(this);
+    else if (rType == cppu::UnoType<drawing::XLayerSupplier>::get())
+        aAny <<= uno::Reference<drawing::XLayerSupplier>(this);
+    else if (rType == cppu::UnoType<drawing::XMasterPagesSupplier>::get())
+        aAny <<= uno::Reference<drawing::XMasterPagesSupplier>(this);
+    else if (rType == cppu::UnoType<drawing::XDrawPagesSupplier>::get())
+        aAny <<= uno::Reference<drawing::XDrawPagesSupplier>(this);
+    else if (rType == cppu::UnoType<presentation::XHandoutMasterSupplier>::get())
+        aAny <<= uno::Reference<presentation::XHandoutMasterSupplier>(this);
+    else if (rType == cppu::UnoType<document::XLinkTargetSupplier>::get())
+        aAny <<= uno::Reference<document::XLinkTargetSupplier>(this);
+    else if (rType == cppu::UnoType<style::XStyleFamiliesSupplier>::get())
+        aAny <<= uno::Reference<style::XStyleFamiliesSupplier>(this);
+    else if (rType == cppu::UnoType<css::ucb::XAnyCompareFactory>::get())
+        aAny <<= uno::Reference<css::ucb::XAnyCompareFactory>(this);
+    else if (rType == cppu::UnoType<view::XRenderable>::get())
+        aAny <<= uno::Reference<view::XRenderable>(this);
+    else if (mbImpressDoc && rType == cppu::UnoType<presentation::XPresentationSupplier>::get())
+        aAny <<= uno::Reference< presentation::XPresentationSupplier >(this);
+    else if (mbImpressDoc && rType == cppu::UnoType<presentation::XCustomPresentationSupplier>::get())
+        aAny <<= uno::Reference< presentation::XCustomPresentationSupplier >(this);
     else
-        return SfxBaseModel::queryInterface( rType );
+        return SfxBaseModel::queryInterface(rType);
 
     return aAny;
 }
diff --git a/sd/source/ui/unoidl/unopage.cxx b/sd/source/ui/unoidl/unopage.cxx
index 3c99d4d..1ab438f 100644
--- a/sd/source/ui/unoidl/unopage.cxx
+++ b/sd/source/ui/unoidl/unopage.cxx
@@ -534,27 +534,48 @@ Any SAL_CALL SdGenericDrawPage::queryInterface( const uno::Type & rType )
 {
     Any aAny;
 
-    QUERYINT( beans::XPropertySet );
-    else QUERYINT( container::XNamed );
-    else QUERYINT( util::XReplaceable );
-    else QUERYINT( util::XSearchable );
-    else QUERYINT( document::XLinkTargetSupplier );
-    else QUERYINT( drawing::XShapeCombiner );
-    else QUERYINT( drawing::XShapeBinder );
-    else QUERYINT( beans::XMultiPropertySet );
-    else if( rType == cppu::UnoType<office::XAnnotationAccess>::get() )
+    if (rType == cppu::UnoType<beans::XPropertySet>::get())
     {
-        return Any( Reference< office::XAnnotationAccess >( this ) );
+        aAny <<= Reference<beans::XPropertySet>(this);
     }
-    else if( rType == cppu::UnoType<XAnimationNodeSupplier>::get() )
+    else if (rType == cppu::UnoType<container::XNamed>::get())
     {
-        if( mbIsImpressDocument )
-        {
-            const PageKind ePageKind = GetPage() ? GetPage()->GetPageKind() : PK_STANDARD;
+        aAny <<= Reference<container::XNamed>(this);
+    }
+    else if (rType == cppu::UnoType<util::XReplaceable>::get())
+    {
+        aAny <<= Reference<util::XReplaceable>(this);
+    }
+    else if (rType == cppu::UnoType<util::XSearchable>::get())
+    {
+        aAny <<= Reference<util::XSearchable>(this);
+    }
+    else if (rType == cppu::UnoType<document::XLinkTargetSupplier>::get())
+    {
+        aAny <<= Reference<document::XLinkTargetSupplier>(this);
+    }
+    else if (rType == cppu::UnoType<drawing::XShapeCombiner>::get())
+    {
+        aAny <<= Reference<drawing::XShapeCombiner>(this);
+    }
+    else if (rType == cppu::UnoType<drawing::XShapeBinder>::get())
+    {
+        aAny <<= Reference<drawing::XShapeBinder>(this);
+    }
+    else if (rType == cppu::UnoType<beans::XMultiPropertySet>::get())
+    {
+        aAny <<= Reference<beans::XMultiPropertySet>(this);
+    }
+    else if (rType == cppu::UnoType<office::XAnnotationAccess>::get())
+    {
+        aAny <<= Reference<office::XAnnotationAccess>(this);
+    }
+    else if (mbIsImpressDocument && rType == cppu::UnoType<XAnimationNodeSupplier>::get())
+    {
+        const PageKind ePageKind = GetPage() ? GetPage()->GetPageKind() : PK_STANDARD;
 
-            if( ePageKind == PK_STANDARD )
-                return makeAny( Reference< XAnimationNodeSupplier >( this ) );
-        }
+        if( ePageKind == PK_STANDARD )
+            return makeAny( Reference< XAnimationNodeSupplier >( this ) );
     }
     else
         return SvxDrawPage::queryInterface( rType );


More information about the Libreoffice-commits mailing list