[Libreoffice-commits] core.git: Branch 'feature/tiled-editing' - 2 commits - libreofficekit/source svx/source

Miklos Vajna vmiklos at collabora.co.uk
Tue Mar 24 02:04:05 PDT 2015


 libreofficekit/source/gtk/lokdocview.cxx |  102 ++++++++++++++++---------------
 svx/source/svdraw/svdmrkv.cxx            |   12 +++
 2 files changed, 67 insertions(+), 47 deletions(-)

New commits:
commit 2879d21b1ef16fd0a350e0cc5ad99c5b42b02285
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue Mar 24 10:01:55 2015 +0100

    svx tiled rendering: fix Impress graphic selection
    
    With this, shapes on Impress slides can be selected and the graphic
    selection appears correctly around the expected shape.
    
    Change-Id: Ie819918a34952e8182553b26ff892fe9b5ae0258

diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx
index 060472d..eda88b5 100644
--- a/svx/source/svdraw/svdmrkv.cxx
+++ b/svx/source/svdraw/svdmrkv.cxx
@@ -710,7 +710,19 @@ void SdrMarkView::SetMarkHandles()
             if (aRect.IsEmpty())
                 sRectangle = "EMPTY";
             else
+            {
+                // In case the map mode is in 100th MM, then need to convert the coordinates over to twips for LOK.
+                if (pMarkedPV)
+                {
+                    if (OutputDevice* pOutputDevice = pMarkedPV->GetView().GetFirstOutputDevice())
+                    {
+                        if (pOutputDevice->GetMapMode().GetMapUnit() == MAP_100TH_MM)
+                            aRect = OutputDevice::LogicToLogic(aRect, MAP_100TH_MM, MAP_TWIP);
+                    }
+                }
+
                 sRectangle = aRect.toString();
+            }
             GetModel()->libreOfficeKitCallback(LOK_CALLBACK_GRAPHIC_SELECTION, sRectangle.getStr());
         }
 
commit 38ffc94114ee3461a8c4fe7f7978e94ec7caac7c
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue Mar 24 09:30:47 2015 +0100

    lokdocview: lcl_onDestroy() -> LOKDocView_Impl::destroy()
    
    Change-Id: I0910afdb6a0d031cb64f545b5b2c0d16f18a0f04

diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index 66568ca..35b23a2 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -93,58 +93,67 @@ struct LOKDocView_Impl
     bool m_bInDragGraphicHandles[8];
     ///@}
 
-    LOKDocView_Impl()
-        : m_pEventBox(gtk_event_box_new()),
-        m_pTable(0),
-        m_pCanvas(0),
-        m_fZoom(1),
-        m_pOffice(0),
-        m_pDocument(0),
-        m_bEdit(false),
-        m_aVisibleCursor({0, 0, 0, 0}),
-        m_bCursorOverlayVisible(false),
-        m_bCursorVisible(true),
-        m_nLastButtonPressTime(0),
-        m_nLastButtonReleaseTime(0),
-        m_pTextSelectionRectangles(0),
-        m_aTextSelectionStart({0, 0, 0, 0}),
-        m_aTextSelectionEnd({0, 0, 0, 0}),
-        m_aGraphicSelection({0, 0, 0, 0}),
-        m_bInDragGraphicSelection(false),
-
-        // Start/middle/end handle.
-        m_pHandleStart(0),
-        m_aHandleStartRect({0, 0, 0, 0}),
-        m_bInDragStartHandle(false),
-        m_pHandleMiddle(0),
-        m_aHandleMiddleRect({0, 0, 0, 0}),
-        m_bInDragMiddleHandle(false),
-        m_pHandleEnd(0),
-        m_aHandleEndRect({0, 0, 0, 0}),
-        m_bInDragEndHandle(false),
-
-        m_pGraphicHandle(0)
-    {
-        memset(&m_aGraphicHandleRects, 0, sizeof(m_aGraphicHandleRects));
-        memset(&m_bInDragGraphicHandles, 0, sizeof(m_bInDragGraphicHandles));
-    }
+    LOKDocView_Impl();
+    ~LOKDocView_Impl();
+    /// Connected to the destroy signal of LOKDocView, deletes its LOKDocView_Impl.
+    static void destroy(LOKDocView* pDocView, gpointer pData);
 };
 
-static void lok_docview_class_init( gpointer );
-static void lok_docview_init( GTypeInstance *, gpointer );
-static float pixelToTwip(float nInput);
-static gboolean renderOverlay(GtkWidget* pWidget, GdkEventExpose* pEvent, gpointer pData);
+LOKDocView_Impl::LOKDocView_Impl()
+    : m_pEventBox(gtk_event_box_new()),
+    m_pTable(0),
+    m_pCanvas(0),
+    m_fZoom(1),
+    m_pOffice(0),
+    m_pDocument(0),
+    m_bEdit(false),
+    m_aVisibleCursor({0, 0, 0, 0}),
+    m_bCursorOverlayVisible(false),
+    m_bCursorVisible(true),
+    m_nLastButtonPressTime(0),
+    m_nLastButtonReleaseTime(0),
+    m_pTextSelectionRectangles(0),
+    m_aTextSelectionStart({0, 0, 0, 0}),
+    m_aTextSelectionEnd({0, 0, 0, 0}),
+    m_aGraphicSelection({0, 0, 0, 0}),
+    m_bInDragGraphicSelection(false),
+
+    // Start/middle/end handle.
+    m_pHandleStart(0),
+    m_aHandleStartRect({0, 0, 0, 0}),
+    m_bInDragStartHandle(false),
+    m_pHandleMiddle(0),
+    m_aHandleMiddleRect({0, 0, 0, 0}),
+    m_bInDragMiddleHandle(false),
+    m_pHandleEnd(0),
+    m_aHandleEndRect({0, 0, 0, 0}),
+    m_bInDragEndHandle(false),
+
+    m_pGraphicHandle(0)
+{
+    memset(&m_aGraphicHandleRects, 0, sizeof(m_aGraphicHandleRects));
+    memset(&m_bInDragGraphicHandles, 0, sizeof(m_bInDragGraphicHandles));
+}
 
-// We specifically need to destroy the document when closing in order to ensure
-// that lock files etc. are cleaned up.
-void lcl_onDestroy(LOKDocView* pDocView, gpointer /*pData*/)
+LOKDocView_Impl::~LOKDocView_Impl()
 {
-    if (pDocView->m_pImpl->m_pDocument)
-        pDocView->m_pImpl->m_pDocument->pClass->destroy(pDocView->m_pImpl->m_pDocument);
-    pDocView->m_pImpl->m_pDocument = 0;
+    if (m_pDocument)
+        m_pDocument->pClass->destroy(m_pDocument);
+    m_pDocument = 0;
+}
+
+void LOKDocView_Impl::destroy(LOKDocView* pDocView, gpointer /*pData*/)
+{
+    // We specifically need to destroy the document when closing in order to ensure
+    // that lock files etc. are cleaned up.
     delete pDocView->m_pImpl;
 }
 
+static void lok_docview_class_init( gpointer );
+static void lok_docview_init( GTypeInstance *, gpointer );
+static float pixelToTwip(float nInput);
+static gboolean renderOverlay(GtkWidget* pWidget, GdkEventExpose* pEvent, gpointer pData);
+
 /**
  * The user drags the handle, which is below the cursor, but wants to move the
  * cursor accordingly.
@@ -458,8 +467,7 @@ static void lok_docview_init( GTypeInstance* pInstance, gpointer )
 
     gtk_widget_show( pDocView->m_pImpl->m_pEventBox );
 
-    gtk_signal_connect( GTK_OBJECT(pDocView), "destroy",
-                        GTK_SIGNAL_FUNC(lcl_onDestroy), NULL );
+    gtk_signal_connect(GTK_OBJECT(pDocView), "destroy", GTK_SIGNAL_FUNC(LOKDocView_Impl::destroy), 0);
     g_signal_connect_after(pDocView->m_pImpl->m_pEventBox, "expose-event",
                            G_CALLBACK(renderOverlay), pDocView);
 }


More information about the Libreoffice-commits mailing list