[Libreoffice-commits] core.git: libreofficekit/source

Miklos Vajna vmiklos at collabora.co.uk
Tue Jul 19 15:15:51 UTC 2016


 libreofficekit/source/gtk/lokdocview.cxx |   14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

New commits:
commit 3c425926d48e513937ad727a56ab7744ca379e63
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue Jul 19 15:57:29 2016 +0200

    lokdocview: still allow view selections/cursors from other Writer views
    
    Writer pages are exposed as parts, but it still makes sense showing
    selections/cursors from other parts in that case.
    
    Change-Id: Ic76d93291bde2d959c149cf2ef5eba7ed33a45e8
    Reviewed-on: https://gerrit.libreoffice.org/27321
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Jenkins <ci at libreoffice.org>

diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index 1e32785..d5a1dd3 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -172,9 +172,12 @@ struct LOKDocViewPrivateImpl
     /// View ID, returned by createView() or 0 by default.
     int m_nViewId;
 
-    /// Part ID, returned by getPart().
+    /// Cached part ID, returned by getPart().
     int m_nPartId;
 
+    /// Cached document type, returned by getDocumentType().
+    LibreOfficeKitDocumentType m_eDocumentType;
+
     /**
      * Contains a freshly set zoom level: logic size of a tile.
      * It gets reset back to 0 when LOK was informed about this zoom change.
@@ -1601,7 +1604,8 @@ renderOverlay(LOKDocView* pDocView, cairo_t* pCairo)
             if (itVisibility != priv->m_aViewCursorVisibilities.end() && !itVisibility->second)
                 continue;
 
-            if (rPair.second.m_nPart != priv->m_nPartId)
+            // Show view cursors when in Writer or when the part matches.
+            if (rPair.second.m_nPart != priv->m_nPartId && priv->m_eDocumentType != LOK_DOCTYPE_TEXT)
                 continue;
 
             GdkRectangle& rCursor = rPair.second.m_aRectangle;
@@ -1677,7 +1681,7 @@ renderOverlay(LOKDocView* pDocView, cairo_t* pCairo)
     // Selections of other views.
     for (auto& rPair : priv->m_aTextViewSelectionRectangles)
     {
-        if (rPair.second.m_nPart != priv->m_nPartId)
+        if (rPair.second.m_nPart != priv->m_nPartId && priv->m_eDocumentType != LOK_DOCTYPE_TEXT)
             continue;
 
         for (GdkRectangle& rRectangle : rPair.second.m_aRectangles)
@@ -1704,7 +1708,7 @@ renderOverlay(LOKDocView* pDocView, cairo_t* pCairo)
     for (auto& rPair : priv->m_aGraphicViewSelections)
     {
         const ViewRectangle& rRectangle = rPair.second;
-        if (rRectangle.m_nPart != priv->m_nPartId)
+        if (rRectangle.m_nPart != priv->m_nPartId && priv->m_eDocumentType != LOK_DOCTYPE_TEXT)
             continue;
 
         const GdkRGBA& rDark = getDarkColor(rPair.first);
@@ -2061,6 +2065,7 @@ openDocumentInThread (gpointer data)
 
     priv->m_pOffice->pClass->registerCallback(priv->m_pOffice, globalCallbackWorker, pDocView);
     priv->m_pDocument = priv->m_pOffice->pClass->documentLoad( priv->m_pOffice, priv->m_aDocPath );
+    priv->m_eDocumentType = static_cast<LibreOfficeKitDocumentType>(priv->m_pDocument->pClass->getDocumentType(priv->m_pDocument));
     if ( !priv->m_pDocument )
     {
         char *pError = priv->m_pOffice->pClass->getError( priv->m_pOffice );
@@ -2334,6 +2339,7 @@ static void lok_doc_view_set_property (GObject* object, guint propId, const GVal
         break;
     case PROP_DOC_POINTER:
         priv->m_pDocument = static_cast<LibreOfficeKitDocument*>(g_value_get_pointer(value));
+        priv->m_eDocumentType = static_cast<LibreOfficeKitDocumentType>(priv->m_pDocument->pClass->getDocumentType(priv->m_pDocument));
         break;
     case PROP_EDITABLE:
         lok_doc_view_set_edit (pDocView, g_value_get_boolean (value));


More information about the Libreoffice-commits mailing list