[Libreoffice-commits] core.git: Branch 'feature/tiled-editing' - desktop/source include/LibreOfficeKit include/vcl libreofficekit/source sw/inc sw/source
Miklos Vajna
vmiklos at collabora.co.uk
Tue Mar 10 08:17:14 PDT 2015
desktop/source/lib/init.cxx | 14 ++++++++++++++
include/LibreOfficeKit/LibreOfficeKit.h | 2 ++
include/LibreOfficeKit/LibreOfficeKit.hxx | 8 ++++++++
include/vcl/ITiledRenderable.hxx | 5 +++++
libreofficekit/source/gtk/lokdocview.c | 5 +++++
sw/inc/unotxdoc.hxx | 2 ++
sw/source/uibase/uno/unotxdoc.cxx | 8 ++++++++
7 files changed, 44 insertions(+)
New commits:
commit b963fb48cb61e8b206b99e8793de81da0899aa25
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Tue Mar 10 16:13:53 2015 +0100
lok::Document: add resetSelection()
Change-Id: Ib24003178bb576ff1450d674d74ef8978b350b92
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 0cc0d79..e1e0cb2 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -220,6 +220,7 @@ static void doc_setGraphicSelection (LibreOfficeKitDocument* pThis,
int nType,
int nX,
int nY);
+static void doc_resetSelection (LibreOfficeKitDocument* pThis);
struct LibLODocument_Impl : public _LibreOfficeKitDocument
{
@@ -251,6 +252,7 @@ struct LibLODocument_Impl : public _LibreOfficeKitDocument
m_pDocumentClass->postMouseEvent = doc_postMouseEvent;
m_pDocumentClass->setTextSelection = doc_setTextSelection;
m_pDocumentClass->setGraphicSelection = doc_setGraphicSelection;
+ m_pDocumentClass->resetSelection = doc_resetSelection;
gDocumentClass = m_pDocumentClass;
}
@@ -756,6 +758,18 @@ static void doc_setGraphicSelection(LibreOfficeKitDocument* pThis, int nType, in
pDoc->setGraphicSelection(nType, nX, nY);
}
+static void doc_resetSelection(LibreOfficeKitDocument* pThis)
+{
+ ITiledRenderable* pDoc = getTiledRenderable(pThis);
+ if (!pDoc)
+ {
+ gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering";
+ return;
+ }
+
+ pDoc->resetSelection();
+}
+
static char* lo_getError (LibreOfficeKit *pThis)
{
LibLibreOffice_Impl* pLib = static_cast<LibLibreOffice_Impl*>(pThis);
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h
index 0b23adf..07a2a2c 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -143,6 +143,8 @@ struct _LibreOfficeKitDocumentClass
int nType,
int nX,
int nY);
+ /// @see lok::Document::resetSelection
+ void (*resetSelection)(LibreOfficeKitDocument* pThis);
#endif // LOK_USE_UNSTABLE_API
};
diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx
index 2993193..c19aa50 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -153,6 +153,14 @@ public:
{
mpDoc->pClass->setGraphicSelection(mpDoc, nType, nX, nY);
}
+
+ /**
+ * Gets rid of any text or graphic selection.
+ */
+ inline void resetSelection()
+ {
+ mpDoc->pClass->resetSelection(mpDoc);
+ }
#endif // LOK_USE_UNSTABLE_API
};
diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx
index 7f63b1f..6bd75a4 100644
--- a/include/vcl/ITiledRenderable.hxx
+++ b/include/vcl/ITiledRenderable.hxx
@@ -122,6 +122,11 @@ public:
* @see lok::Document::setGraphicSelection().
*/
virtual void setGraphicSelection(int /*nType*/, int /*nX*/, int /*nY*/) { }
+
+ /**
+ * @see lok::Document::resetSelection().
+ */
+ virtual void resetSelection() { }
};
} // namespace vcl
diff --git a/libreofficekit/source/gtk/lokdocview.c b/libreofficekit/source/gtk/lokdocview.c
index 3980a50..cb967ff 100644
--- a/libreofficekit/source/gtk/lokdocview.c
+++ b/libreofficekit/source/gtk/lokdocview.c
@@ -973,6 +973,11 @@ SAL_DLLPUBLIC_EXPORT void lok_docview_set_edit( LOKDocView* pDocView,
if (!pDocView->m_bEdit && bEdit)
g_info("lok_docview_set_edit: entering edit mode");
+ else if (pDocView->m_bEdit && !bEdit)
+ {
+ g_info("lok_docview_set_edit: leaving edit mode");
+ pDocView->pDocument->pClass->resetSelection(pDocView->pDocument);
+ }
pDocView->m_bEdit = bEdit;
g_signal_emit(pDocView, docview_signals[EDIT_CHANGED], 0, bWasEdit);
gtk_widget_queue_draw(GTK_WIDGET(pDocView->pEventBox));
diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx
index b840385..778d073 100644
--- a/sw/inc/unotxdoc.hxx
+++ b/sw/inc/unotxdoc.hxx
@@ -419,6 +419,8 @@ public:
virtual void setTextSelection(int nType, int nX, int nY) SAL_OVERRIDE;
/// @see vcl::ITiledRenderable::setGraphicSelection().
virtual void setGraphicSelection(int nType, int nX, int nY) SAL_OVERRIDE;
+ /// @see vcl::ITiledRenderable::resetSelection().
+ virtual void resetSelection() SAL_OVERRIDE;
void Invalidate();
void Reactivate(SwDocShell* pNewDocShell);
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index 6c0b893..e806a50 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -3242,6 +3242,14 @@ void SwXTextDocument::setGraphicSelection(int nType, int nX, int nY)
}
}
+void SwXTextDocument::resetSelection()
+{
+ SolarMutexGuard aGuard;
+
+ SwWrtShell* pWrtShell = pDocShell->GetWrtShell();
+ pWrtShell->ResetSelect(0, false);
+}
+
void * SAL_CALL SwXTextDocument::operator new( size_t t) throw()
{
return SwXTextDocumentBaseClass::operator new(t);
More information about the Libreoffice-commits
mailing list