summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-07-19 15:57:29 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-07-19 15:15:27 +0000
commit3c425926d48e513937ad727a56ab7744ca379e63 (patch)
tree859a365c9f88feee31f062995cab3a961fd8b73d
parent3aa52d36824d11b8774de15708fdfcbb93cd9dc3 (diff)
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@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
-rw-r--r--libreofficekit/source/gtk/lokdocview.cxx14
1 files changed, 10 insertions, 4 deletions
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index 1e32785e5f36..d5a1dd34be93 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));