summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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));