parent
d2bfdd05c3
commit
5b26217aa0
@ -1,60 +0,0 @@
|
||||
From d321d863052be950ba1779ccfdcca69bd3ef0f76 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
|
||||
Date: Mon, 30 Nov 2015 13:50:16 +0000
|
||||
Subject: [PATCH] Resolves: rhbz#1285380 get menus working under wayland
|
||||
|
||||
use GDK_WINDOW_TYPE_HINT_POPUP_MENU hint for menus
|
||||
|
||||
and set hints after widget is realized
|
||||
|
||||
and set gtk_window_set_transient_for menus too
|
||||
|
||||
then you get menus and tooltips apparently in the right place
|
||||
|
||||
Change-Id: I116d821d4eff480503348b8ff1fb8f4f247b4c1f
|
||||
---
|
||||
vcl/unx/gtk/gtksalframe.cxx | 19 ++++++++++---------
|
||||
1 file changed, 10 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/vcl/unx/gtk/gtksalframe.cxx b/vcl/unx/gtk/gtksalframe.cxx
|
||||
index c5c01a4..62b0e06 100644
|
||||
--- a/vcl/unx/gtk/gtksalframe.cxx
|
||||
+++ b/vcl/unx/gtk/gtksalframe.cxx
|
||||
@@ -1392,6 +1392,15 @@ void GtkSalFrame::Init( SalFrame* pParent, SalFrameStyleFlags nStyle )
|
||||
if( m_pParent && m_pParent->m_pWindow && ! isChild() )
|
||||
gtk_window_set_screen( GTK_WINDOW(m_pWindow), gtk_window_get_screen( GTK_WINDOW(m_pParent->m_pWindow) ) );
|
||||
|
||||
+ if (m_pParent)
|
||||
+ {
|
||||
+ if (!(m_pParent->m_nStyle & SalFrameStyleFlags::PLUG))
|
||||
+ gtk_window_set_transient_for( GTK_WINDOW(m_pWindow), GTK_WINDOW(m_pParent->m_pWindow) );
|
||||
+ m_pParent->m_aChildren.push_back( this );
|
||||
+ }
|
||||
+
|
||||
+ InitCommon();
|
||||
+
|
||||
// set window type
|
||||
bool bDecoHandling =
|
||||
! isChild() &&
|
||||
@@ -1432,17 +1441,9 @@ void GtkSalFrame::Init( SalFrame* pParent, SalFrameStyleFlags nStyle )
|
||||
#endif
|
||||
gtk_window_set_type_hint( GTK_WINDOW(m_pWindow), eType );
|
||||
gtk_window_set_gravity( GTK_WINDOW(m_pWindow), GDK_GRAVITY_STATIC );
|
||||
- if( m_pParent && ! (m_pParent->m_nStyle & SalFrameStyleFlags::PLUG) )
|
||||
- gtk_window_set_transient_for( GTK_WINDOW(m_pWindow), GTK_WINDOW(m_pParent->m_pWindow) );
|
||||
}
|
||||
else if( (nStyle & SalFrameStyleFlags::FLOAT) )
|
||||
- {
|
||||
- gtk_window_set_type_hint( GTK_WINDOW(m_pWindow), GDK_WINDOW_TYPE_HINT_UTILITY );
|
||||
- }
|
||||
- if( m_pParent )
|
||||
- m_pParent->m_aChildren.push_back( this );
|
||||
-
|
||||
- InitCommon();
|
||||
+ gtk_window_set_type_hint( GTK_WINDOW(m_pWindow), GDK_WINDOW_TYPE_HINT_POPUP_MENU );
|
||||
|
||||
if( eWinType == GTK_WINDOW_TOPLEVEL )
|
||||
{
|
||||
--
|
||||
2.5.0
|
||||
|
@ -1,57 +0,0 @@
|
||||
From fd94964ad6611d7f20523272fe6752d38e3aec88 Mon Sep 17 00:00:00 2001
|
||||
From: David Tardon <dtardon@redhat.com>
|
||||
Date: Mon, 14 Dec 2015 21:17:43 +0100
|
||||
Subject: [PATCH] don't be creative and use a simple lookup table
|
||||
|
||||
The original code breaks at least in optimized build on Fedora x86,
|
||||
because there nBits for 256 is computed as 9, not 8.
|
||||
|
||||
Change-Id: Ib157c415bc9e231bf7fd544349810e6bc83c8fcc
|
||||
---
|
||||
oox/source/ole/vbaexport.cxx | 23 +++++++++++++++++++++--
|
||||
1 file changed, 21 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/oox/source/ole/vbaexport.cxx b/oox/source/ole/vbaexport.cxx
|
||||
index 2cb2fea..2041d50 100644
|
||||
--- a/oox/source/ole/vbaexport.cxx
|
||||
+++ b/oox/source/ole/vbaexport.cxx
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include <sal/config.h>
|
||||
|
||||
+#include <cassert>
|
||||
#include <cmath>
|
||||
#include <random>
|
||||
|
||||
@@ -324,8 +325,26 @@ void VBACompressionChunk::CopyTokenHelp(sal_uInt16& rLengthMask, sal_uInt16& rOf
|
||||
sal_uInt16& rBitCount, sal_uInt16& rMaximumLength)
|
||||
{
|
||||
sal_uInt16 nDifference = mnDecompressedCurrent;
|
||||
- sal_uInt16 nBitCount = std::ceil(std::log(nDifference)/std::log(2));
|
||||
- rBitCount = std::max<sal_uInt16>(nBitCount, 4);
|
||||
+ assert(nDifference <= 4096);
|
||||
+ assert(nDifference >= 1);
|
||||
+ if (nDifference >= 2049)
|
||||
+ rBitCount = 12;
|
||||
+ else if (nDifference >= 1025)
|
||||
+ rBitCount = 11;
|
||||
+ else if (nDifference >= 513)
|
||||
+ rBitCount = 10;
|
||||
+ else if (nDifference >= 257)
|
||||
+ rBitCount = 9;
|
||||
+ else if (nDifference >= 129)
|
||||
+ rBitCount = 8;
|
||||
+ else if (nDifference >= 65)
|
||||
+ rBitCount = 7;
|
||||
+ else if (nDifference >= 33)
|
||||
+ rBitCount = 6;
|
||||
+ else if (nDifference >= 17)
|
||||
+ rBitCount = 5;
|
||||
+ else
|
||||
+ rBitCount = 4;
|
||||
rLengthMask = 0xffff >> rBitCount;
|
||||
rOffsetMask = ~rLengthMask;
|
||||
rMaximumLength = rLengthMask + 3;
|
||||
--
|
||||
2.5.0
|
||||
|
@ -1,33 +0,0 @@
|
||||
From 571f51c424ea50c31b85003fa68f420f0573065f Mon Sep 17 00:00:00 2001
|
||||
From: Noel Grandin <noel@peralex.com>
|
||||
Date: Mon, 7 Dec 2015 11:10:03 +0200
|
||||
Subject: [PATCH] fix powerpc build
|
||||
|
||||
fallout from the wide char changes
|
||||
|
||||
<sberg> noelgrandin, _rene_, ah, yeah, that's something that broke with 0b07406f7147b9abbb2095d9e038b13293cb8b10
|
||||
<IZBot> core - Use C++11 char16_t for sal_Unicode - http://cgit.freedesktop.org/libreoffice/core/commit/?id=0b07406f7147b9abbb2095d9e038b13293cb8b10
|
||||
|
||||
Change-Id: If4303bd1d8577612250b1857b809b022d13759e4
|
||||
(cherry picked from commit b2d145193e34b57ca991063fc7c3cf8200339dea)
|
||||
---
|
||||
include/oox/helper/helper.hxx | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/include/oox/helper/helper.hxx b/include/oox/helper/helper.hxx
|
||||
index 516c7a2..5029d5f 100644
|
||||
--- a/include/oox/helper/helper.hxx
|
||||
+++ b/include/oox/helper/helper.hxx
|
||||
@@ -218,6 +218,9 @@ public:
|
||||
#ifdef OSL_BIGENDIAN
|
||||
static void convertLittleEndian( sal_Int8& ) {} // present for usage in templates
|
||||
static void convertLittleEndian( sal_uInt8& ) {} // present for usage in templates
|
||||
+#if !defined SAL_W32 || defined __MINGW32__ // cf. sal/types.h sal_Unicode
|
||||
+ static void convertLittleEndian( char16_t& rnValue ) { swap2( reinterpret_cast< sal_uInt8* >( &rnValue ) ); }
|
||||
+#endif
|
||||
static void convertLittleEndian( sal_Int16& rnValue ) { swap2( reinterpret_cast< sal_uInt8* >( &rnValue ) ); }
|
||||
static void convertLittleEndian( sal_uInt16& rnValue ) { swap2( reinterpret_cast< sal_uInt8* >( &rnValue ) ); }
|
||||
static void convertLittleEndian( sal_Int32& rnValue ) { swap4( reinterpret_cast< sal_uInt8* >( &rnValue ) ); }
|
||||
--
|
||||
2.5.0
|
||||
|
@ -1,56 +0,0 @@
|
||||
From 585507a4127ff91d9360ca16938dbd36153aef0d Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
|
||||
Date: Tue, 1 Dec 2015 13:27:21 +0000
|
||||
Subject: [PATCH] gtk3+wayland: wrong dialog sizes
|
||||
|
||||
use inner container, not outer toxic toplevel
|
||||
|
||||
Change-Id: I44f2fe1e8e346e51e65158f7864293ef37732345
|
||||
---
|
||||
vcl/unx/gtk/gtksalframe.cxx | 10 ++++++----
|
||||
1 file changed, 6 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/vcl/unx/gtk/gtksalframe.cxx b/vcl/unx/gtk/gtksalframe.cxx
|
||||
index 791e04e..d147b49 100644
|
||||
--- a/vcl/unx/gtk/gtksalframe.cxx
|
||||
+++ b/vcl/unx/gtk/gtksalframe.cxx
|
||||
@@ -943,22 +943,24 @@ void GtkSalFrame::moveWindow( long nX, long nY )
|
||||
|
||||
void GtkSalFrame::widget_set_size_request(long nWidth, long nHeight)
|
||||
{
|
||||
+#if !GTK_CHECK_VERSION(3,0,0)
|
||||
gint nOrigwidth, nOrigheight;
|
||||
gtk_window_get_size(GTK_WINDOW(m_pWindow), &nOrigwidth, &nOrigheight);
|
||||
-#if !GTK_CHECK_VERSION(3,0,0)
|
||||
if (nWidth > nOrigwidth || nHeight > nOrigheight)
|
||||
{
|
||||
m_bPaintsBlocked = true;
|
||||
}
|
||||
-#endif
|
||||
gtk_widget_set_size_request(m_pWindow, nWidth, nHeight );
|
||||
+#else
|
||||
+ gtk_widget_set_size_request(GTK_WIDGET(m_pFixedContainer), nWidth, nHeight );
|
||||
+#endif
|
||||
}
|
||||
|
||||
void GtkSalFrame::window_resize(long nWidth, long nHeight)
|
||||
{
|
||||
+#if !GTK_CHECK_VERSION(3,0,0)
|
||||
gint nOrigwidth, nOrigheight;
|
||||
gtk_window_get_size(GTK_WINDOW(m_pWindow), &nOrigwidth, &nOrigheight);
|
||||
-#if !GTK_CHECK_VERSION(3,0,0)
|
||||
if (nWidth > nOrigwidth || nHeight > nOrigheight)
|
||||
{
|
||||
m_bPaintsBlocked = true;
|
||||
@@ -1080,7 +1082,7 @@ void GtkSalFrame::InitCommon()
|
||||
m_aMouseSignalIds.push_back(g_signal_connect( G_OBJECT(pEventWidget), "button-release-event", G_CALLBACK(signalButton), this ));
|
||||
#if GTK_CHECK_VERSION(3,0,0)
|
||||
g_signal_connect( G_OBJECT(m_pFixedContainer), "draw", G_CALLBACK(signalDraw), this );
|
||||
- g_signal_connect( G_OBJECT(m_pWindow), "size-allocate", G_CALLBACK(sizeAllocated), this );
|
||||
+ g_signal_connect( G_OBJECT(m_pFixedContainer), "size-allocate", G_CALLBACK(sizeAllocated), this );
|
||||
#if GTK_CHECK_VERSION(3,14,0)
|
||||
GtkGesture *pSwipe = gtk_gesture_swipe_new(pEventWidget);
|
||||
g_signal_connect(pSwipe, "swipe", G_CALLBACK(gestureSwipe), this);
|
||||
--
|
||||
2.5.0
|
||||
|
@ -1,27 +0,0 @@
|
||||
From 125382803df6502e467cb25b6ee70c24d5f4dfc0 Mon Sep 17 00:00:00 2001
|
||||
From: David Tardon <dtardon@redhat.com>
|
||||
Date: Mon, 7 Dec 2015 13:09:07 +0100
|
||||
Subject: [PATCH] tdf#96243 don't crash if LibO install. wasn't found
|
||||
|
||||
Change-Id: I538e7238feb711a7d71faf745033264894f688f4
|
||||
(cherry picked from commit 7f73ea2e3975b305e09467eb7980a3d01cd37de9)
|
||||
---
|
||||
include/LibreOfficeKit/LibreOfficeKitInit.h | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/include/LibreOfficeKit/LibreOfficeKitInit.h b/include/LibreOfficeKit/LibreOfficeKitInit.h
|
||||
index e2af109..1a20c8ce 100644
|
||||
--- a/include/LibreOfficeKit/LibreOfficeKitInit.h
|
||||
+++ b/include/LibreOfficeKit/LibreOfficeKitInit.h
|
||||
@@ -220,6 +220,8 @@ static LibreOfficeKit *lok_init_2( const char *install_path, const char *user_p
|
||||
LokHookFunction2 *pSym2;
|
||||
|
||||
dlhandle = lok_dlopen(install_path, &imp_lib);
|
||||
+ if (!dlhandle)
|
||||
+ return NULL;
|
||||
|
||||
pSym2 = (LokHookFunction2 *) lok_dlsym(dlhandle, "libreofficekit_hook_2");
|
||||
if (!pSym2)
|
||||
--
|
||||
2.5.0
|
||||
|
@ -1,35 +0,0 @@
|
||||
From f37903004d93e7d7b008b2667881159bd8fee1e1 Mon Sep 17 00:00:00 2001
|
||||
From: Pranav Kant <pranavk@libreoffice.org>
|
||||
Date: Sun, 6 Dec 2015 23:41:57 +0530
|
||||
Subject: [PATCH] tdf#96246: Make pRenderingArguments nullable
|
||||
|
||||
Type gchar* is not nullable by convention.
|
||||
|
||||
See:
|
||||
https://wiki.gnome.org/Projects/GObjectIntrospection/Annotations#Nullable_parameters
|
||||
|
||||
Change-Id: Ibfee816a3ef2d29c7376071fb61eda7bf0538efb
|
||||
Reviewed-on: https://gerrit.libreoffice.org/20425
|
||||
Tested-by: Jenkins <ci@libreoffice.org>
|
||||
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
|
||||
(cherry picked from commit 9e9703389e015d0f3520344715df6719559362e4)
|
||||
---
|
||||
include/LibreOfficeKit/LibreOfficeKitGtk.h | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/include/LibreOfficeKit/LibreOfficeKitGtk.h b/include/LibreOfficeKit/LibreOfficeKitGtk.h
|
||||
index c947ce3..8b6092c 100644
|
||||
--- a/include/LibreOfficeKit/LibreOfficeKitGtk.h
|
||||
+++ b/include/LibreOfficeKit/LibreOfficeKitGtk.h
|
||||
@@ -65,7 +65,7 @@ GtkWidget* lok_doc_view_new_from_widget (LOKDocView*
|
||||
* lok_doc_view_open_document:
|
||||
* @pDocView: The #LOKDocView instance
|
||||
* @pPath: (transfer full): The path of the document that #LOKDocView widget should try to open
|
||||
- * @pRenderingArguments: lok::Document::initializeForRendering() arguments.
|
||||
+ * @pRenderingArguments: (nullable): lok::Document::initializeForRendering() arguments.
|
||||
* @cancellable:
|
||||
* @callback:
|
||||
* @userdata:
|
||||
--
|
||||
2.5.0
|
||||
|
@ -1,28 +0,0 @@
|
||||
From e22f9ae034addbddbb5581cdee6bfd1c39aeedea Mon Sep 17 00:00:00 2001
|
||||
From: Miklos Vajna <vmiklos@collabora.co.uk>
|
||||
Date: Mon, 7 Dec 2015 14:54:19 +0100
|
||||
Subject: [PATCH] tdf#96250 desktop: empty str is the same as 0 str in
|
||||
jsonToPropertyValues()
|
||||
|
||||
Change-Id: I77306dc998afc53bb1d5710a8d1ae68717f945d1
|
||||
(cherry picked from commit 5cc574fefc8a2ee39db4a4bd843a3ec67dce2f11)
|
||||
---
|
||||
desktop/source/lib/init.cxx | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
|
||||
index 8682ce8..2bdea80 100644
|
||||
--- a/desktop/source/lib/init.cxx
|
||||
+++ b/desktop/source/lib/init.cxx
|
||||
@@ -264,7 +264,7 @@ static OUString getAbsoluteURL(const char* pURL)
|
||||
static void jsonToPropertyValues(const char* pJSON, uno::Sequence<beans::PropertyValue>& rPropertyValues)
|
||||
{
|
||||
std::vector<beans::PropertyValue> aArguments;
|
||||
- if (pJSON)
|
||||
+ if (pJSON && pJSON[0] != '\0')
|
||||
{
|
||||
boost::property_tree::ptree aTree;
|
||||
std::stringstream aStream(pJSON);
|
||||
--
|
||||
2.5.0
|
||||
|
@ -1,406 +0,0 @@
|
||||
From 0a28049853ce84aa8ef4f871065970c1220ae855 Mon Sep 17 00:00:00 2001
|
||||
From: Pranav Kant <pranavk@libreoffice.org>
|
||||
Date: Wed, 9 Dec 2015 01:03:02 +0530
|
||||
Subject: [PATCH 1/3] tdf#96316: Decouple view-only/editable modes
|
||||
|
||||
- Move text selection and graphic selection tasks into functions
|
||||
- Merge GDK_BUTTON_PRESS, GDK_BUTTON_RELEASE conditional code
|
||||
- Do not change to 'move' cursor in view-only mode
|
||||
- Ignore LOK_POST_COMMAND, LOK_SET_GRAPHIC_SELECTION in view-only
|
||||
|
||||
As a consequence this commit also allows dragging handles during text
|
||||
selection in view-only mode which was earlier not possible.
|
||||
|
||||
Change-Id: Iffb668d5447dd646a1e40237dee8d8d3fa3314b6
|
||||
Reviewed-on: https://gerrit.libreoffice.org/20487
|
||||
Reviewed-by: David Tardon <dtardon@redhat.com>
|
||||
Tested-by: David Tardon <dtardon@redhat.com>
|
||||
(cherry picked from commit b3bfc26d0863b074bb990725718f2ab23d05425d)
|
||||
---
|
||||
libreofficekit/source/gtk/lokdocview.cxx | 312 ++++++++++++++++++-------------
|
||||
1 file changed, 180 insertions(+), 132 deletions(-)
|
||||
|
||||
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
|
||||
index c808752..cbdac71 100644
|
||||
--- a/libreofficekit/source/gtk/lokdocview.cxx
|
||||
+++ b/libreofficekit/source/gtk/lokdocview.cxx
|
||||
@@ -312,6 +312,153 @@ isEmptyRectangle(const GdkRectangle& rRectangle)
|
||||
return rRectangle.x == 0 && rRectangle.y == 0 && rRectangle.width == 0 && rRectangle.height == 0;
|
||||
}
|
||||
|
||||
+/// if handled, returns TRUE else FALSE
|
||||
+static bool
|
||||
+handleTextSelectionOnButtonPress(GdkRectangle& aClick, LOKDocView* pDocView) {
|
||||
+ LOKDocViewPrivate& priv = getPrivate(pDocView);
|
||||
+
|
||||
+ if (gdk_rectangle_intersect(&aClick, &priv->m_aHandleStartRect, nullptr))
|
||||
+ {
|
||||
+ g_info("LOKDocView_Impl::signalButton: start of drag start handle");
|
||||
+ priv->m_bInDragStartHandle = true;
|
||||
+ return TRUE;
|
||||
+ }
|
||||
+ else if (gdk_rectangle_intersect(&aClick, &priv->m_aHandleMiddleRect, nullptr))
|
||||
+ {
|
||||
+ g_info("LOKDocView_Impl::signalButton: start of drag middle handle");
|
||||
+ priv->m_bInDragMiddleHandle = true;
|
||||
+ return TRUE;
|
||||
+ }
|
||||
+ else if (gdk_rectangle_intersect(&aClick, &priv->m_aHandleEndRect, nullptr))
|
||||
+ {
|
||||
+ g_info("LOKDocView_Impl::signalButton: start of drag end handle");
|
||||
+ priv->m_bInDragEndHandle = true;
|
||||
+ return TRUE;
|
||||
+ }
|
||||
+
|
||||
+ return FALSE;
|
||||
+}
|
||||
+
|
||||
+/// if handled, returns TRUE else FALSE
|
||||
+static bool
|
||||
+handleGraphicSelectionOnButtonPress(GdkRectangle& aClick, LOKDocView* pDocView) {
|
||||
+ LOKDocViewPrivate& priv = getPrivate(pDocView);
|
||||
+ GError* error = nullptr;
|
||||
+
|
||||
+ for (int i = 0; i < GRAPHIC_HANDLE_COUNT; ++i)
|
||||
+ {
|
||||
+ if (gdk_rectangle_intersect(&aClick, &priv->m_aGraphicHandleRects[i], nullptr))
|
||||
+ {
|
||||
+ g_info("LOKDocView_Impl::signalButton: start of drag graphic handle #%d", i);
|
||||
+ priv->m_bInDragGraphicHandles[i] = true;
|
||||
+
|
||||
+ GTask* task = g_task_new(pDocView, nullptr, nullptr, nullptr);
|
||||
+ LOEvent* pLOEvent = new LOEvent(LOK_SET_GRAPHIC_SELECTION);
|
||||
+ pLOEvent->m_nSetGraphicSelectionType = LOK_SETGRAPHICSELECTION_START;
|
||||
+ pLOEvent->m_nSetGraphicSelectionX = pixelToTwip(priv->m_aGraphicHandleRects[i].x + priv->m_aGraphicHandleRects[i].width / 2, priv->m_fZoom);
|
||||
+ pLOEvent->m_nSetGraphicSelectionY = pixelToTwip(priv->m_aGraphicHandleRects[i].y + priv->m_aGraphicHandleRects[i].height / 2, priv->m_fZoom);
|
||||
+ g_task_set_task_data(task, pLOEvent, LOEvent::destroy);
|
||||
+
|
||||
+ g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), &error);
|
||||
+ if (error != nullptr)
|
||||
+ {
|
||||
+ g_warning("Unable to call LOK_SET_GRAPHIC_SELECTION: %s", error->message);
|
||||
+ g_clear_error(&error);
|
||||
+ }
|
||||
+ g_object_unref(task);
|
||||
+
|
||||
+ return TRUE;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return FALSE;
|
||||
+}
|
||||
+
|
||||
+/// if handled, returns TRUE else FALSE
|
||||
+static bool
|
||||
+handleTextSelectionOnButtonRelease(LOKDocView* pDocView) {
|
||||
+ LOKDocViewPrivate& priv = getPrivate(pDocView);
|
||||
+
|
||||
+ if (priv->m_bInDragStartHandle)
|
||||
+ {
|
||||
+ g_info("LOKDocView_Impl::signalButton: end of drag start handle");
|
||||
+ priv->m_bInDragStartHandle = false;
|
||||
+ return TRUE;
|
||||
+ }
|
||||
+ else if (priv->m_bInDragMiddleHandle)
|
||||
+ {
|
||||
+ g_info("LOKDocView_Impl::signalButton: end of drag middle handle");
|
||||
+ priv->m_bInDragMiddleHandle = false;
|
||||
+ return TRUE;
|
||||
+ }
|
||||
+ else if (priv->m_bInDragEndHandle)
|
||||
+ {
|
||||
+ g_info("LOKDocView_Impl::signalButton: end of drag end handle");
|
||||
+ priv->m_bInDragEndHandle = false;
|
||||
+ return TRUE;
|
||||
+ }
|
||||
+
|
||||
+ return FALSE;
|
||||
+}
|
||||
+
|
||||
+/// if handled, returns TRUE else FALSE
|
||||
+static bool
|
||||
+handleGraphicSelectionOnButtonRelease(LOKDocView* pDocView, GdkEventButton* pEvent) {
|
||||
+ LOKDocViewPrivate& priv = getPrivate(pDocView);
|
||||
+ GError* error = nullptr;
|
||||
+
|
||||
+ for (int i = 0; i < GRAPHIC_HANDLE_COUNT; ++i)
|
||||
+ {
|
||||
+ if (priv->m_bInDragGraphicHandles[i])
|
||||
+ {
|
||||
+ g_info("LOKDocView_Impl::signalButton: end of drag graphic handle #%d", i);
|
||||
+ priv->m_bInDragGraphicHandles[i] = false;
|
||||
+
|
||||
+ GTask* task = g_task_new(pDocView, nullptr, nullptr, nullptr);
|
||||
+ LOEvent* pLOEvent = new LOEvent(LOK_SET_GRAPHIC_SELECTION);
|
||||
+ pLOEvent->m_nSetGraphicSelectionType = LOK_SETGRAPHICSELECTION_END;
|
||||
+ pLOEvent->m_nSetGraphicSelectionX = pixelToTwip(pEvent->x, priv->m_fZoom);
|
||||
+ pLOEvent->m_nSetGraphicSelectionY = pixelToTwip(pEvent->y, priv->m_fZoom);
|
||||
+ g_task_set_task_data(task, pLOEvent, LOEvent::destroy);
|
||||
+
|
||||
+ g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), &error);
|
||||
+ if (error != nullptr)
|
||||
+ {
|
||||
+ g_warning("Unable to call LOK_SET_GRAPHIC_SELECTION: %s", error->message);
|
||||
+ g_clear_error(&error);
|
||||
+ }
|
||||
+ g_object_unref(task);
|
||||
+
|
||||
+ return TRUE;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (priv->m_bInDragGraphicSelection)
|
||||
+ {
|
||||
+ g_info("LOKDocView_Impl::signalButton: end of drag graphic selection");
|
||||
+ priv->m_bInDragGraphicSelection = false;
|
||||
+
|
||||
+ GTask* task = g_task_new(pDocView, nullptr, nullptr, nullptr);
|
||||
+ LOEvent* pLOEvent = new LOEvent(LOK_SET_GRAPHIC_SELECTION);
|
||||
+ pLOEvent->m_nSetGraphicSelectionType = LOK_SETGRAPHICSELECTION_END;
|
||||
+ pLOEvent->m_nSetGraphicSelectionX = pixelToTwip(pEvent->x, priv->m_fZoom);
|
||||
+ pLOEvent->m_nSetGraphicSelectionY = pixelToTwip(pEvent->y, priv->m_fZoom);
|
||||
+ g_task_set_task_data(task, pLOEvent, LOEvent::destroy);
|
||||
+
|
||||
+ g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), &error);
|
||||
+ if (error != nullptr)
|
||||
+ {
|
||||
+ g_warning("Unable to call LOK_SET_GRAPHIC_SELECTION: %s", error->message);
|
||||
+ g_clear_error(&error);
|
||||
+ }
|
||||
+ g_object_unref(task);
|
||||
+
|
||||
+ return TRUE;
|
||||
+ }
|
||||
+
|
||||
+ return FALSE;
|
||||
+}
|
||||
+
|
||||
static void
|
||||
postKeyEventInThread(gpointer data)
|
||||
{
|
||||
@@ -747,11 +894,17 @@ callback (gpointer pData)
|
||||
break;
|
||||
case LOK_CALLBACK_MOUSE_POINTER:
|
||||
{
|
||||
- // The gtk docs claim that most css cursors should be supported, however
|
||||
- // on my system at least this is not true and many cursors are unsupported.
|
||||
- // In this case pCursor = null, which results in the default cursor being set.
|
||||
- GdkCursor* pCursor = gdk_cursor_new_from_name(gtk_widget_get_display(GTK_WIDGET(pDocView)), pCallback->m_aPayload.c_str());
|
||||
- gdk_window_set_cursor(gtk_widget_get_window(GTK_WIDGET(pDocView)), pCursor);
|
||||
+ // We do not want the cursor to get changed in view-only mode
|
||||
+ if (priv->m_bEdit)
|
||||
+ {
|
||||
+ // The gtk docs claim that most css cursors should be supported, however
|
||||
+ // on my system at least this is not true and many cursors are unsupported.
|
||||
+ // In this case pCursor = null, which results in the default cursor
|
||||
+ // being set.
|
||||
+ GdkCursor* pCursor = gdk_cursor_new_from_name(gtk_widget_get_display(GTK_WIDGET(pDocView)),
|
||||
+ pCallback->m_aPayload.c_str());
|
||||
+ gdk_window_set_cursor(gtk_widget_get_window(GTK_WIDGET(pDocView)), pCursor);
|
||||
+ }
|
||||
}
|
||||
break;
|
||||
case LOK_CALLBACK_GRAPHIC_SELECTION:
|
||||
@@ -1176,140 +1329,21 @@ lok_doc_view_signal_button(GtkWidget* pWidget, GdkEventButton* pEvent)
|
||||
(int)pixelToTwip(pEvent->y, priv->m_fZoom));
|
||||
gtk_widget_grab_focus(GTK_WIDGET(pDocView));
|
||||
|
||||
- if (pEvent->type == GDK_BUTTON_RELEASE)
|
||||
+ switch (pEvent->type)
|
||||
{
|
||||
- if (priv->m_bInDragStartHandle)
|
||||
- {
|
||||
- g_info("LOKDocView_Impl::signalButton: end of drag start handle");
|
||||
- priv->m_bInDragStartHandle = false;
|
||||
- return FALSE;
|
||||
- }
|
||||
- else if (priv->m_bInDragMiddleHandle)
|
||||
- {
|
||||
- g_info("LOKDocView_Impl::signalButton: end of drag middle handle");
|
||||
- priv->m_bInDragMiddleHandle = false;
|
||||
- return FALSE;
|
||||
- }
|
||||
- else if (priv->m_bInDragEndHandle)
|
||||
- {
|
||||
- g_info("LOKDocView_Impl::signalButton: end of drag end handle");
|
||||
- priv->m_bInDragEndHandle = false;
|
||||
- return FALSE;
|
||||
- }
|
||||
-
|
||||
- for (int i = 0; i < GRAPHIC_HANDLE_COUNT; ++i)
|
||||
- {
|
||||
- if (priv->m_bInDragGraphicHandles[i])
|
||||
- {
|
||||
- g_info("LOKDocView_Impl::signalButton: end of drag graphic handle #%d", i);
|
||||
- priv->m_bInDragGraphicHandles[i] = false;
|
||||
-
|
||||
- GTask* task = g_task_new(pDocView, nullptr, nullptr, nullptr);
|
||||
- LOEvent* pLOEvent = new LOEvent(LOK_SET_GRAPHIC_SELECTION);
|
||||
- pLOEvent->m_nSetGraphicSelectionType = LOK_SETGRAPHICSELECTION_END;
|
||||
- pLOEvent->m_nSetGraphicSelectionX = pixelToTwip(pEvent->x, priv->m_fZoom);
|
||||
- pLOEvent->m_nSetGraphicSelectionY = pixelToTwip(pEvent->y, priv->m_fZoom);
|
||||
- g_task_set_task_data(task, pLOEvent, LOEvent::destroy);
|
||||
-
|
||||
- g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), &error);
|
||||
- if (error != nullptr)
|
||||
- {
|
||||
- g_warning("Unable to call LOK_SET_GRAPHIC_SELECTION: %s", error->message);
|
||||
- g_clear_error(&error);
|
||||
- }
|
||||
- g_object_unref(task);
|
||||
-
|
||||
- return FALSE;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- if (priv->m_bInDragGraphicSelection)
|
||||
- {
|
||||
- g_info("LOKDocView_Impl::signalButton: end of drag graphic selection");
|
||||
- priv->m_bInDragGraphicSelection = false;
|
||||
-
|
||||
- GTask* task = g_task_new(pDocView, nullptr, nullptr, nullptr);
|
||||
- LOEvent* pLOEvent = new LOEvent(LOK_SET_GRAPHIC_SELECTION);
|
||||
- pLOEvent->m_nSetGraphicSelectionType = LOK_SETGRAPHICSELECTION_END;
|
||||
- pLOEvent->m_nSetGraphicSelectionX = pixelToTwip(pEvent->x, priv->m_fZoom);
|
||||
- pLOEvent->m_nSetGraphicSelectionY = pixelToTwip(pEvent->y, priv->m_fZoom);
|
||||
- g_task_set_task_data(task, pLOEvent, LOEvent::destroy);
|
||||
-
|
||||
- g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), &error);
|
||||
- if (error != nullptr)
|
||||
- {
|
||||
- g_warning("Unable to call LOK_SET_GRAPHIC_SELECTION: %s", error->message);
|
||||
- g_clear_error(&error);
|
||||
- }
|
||||
- g_object_unref(task);
|
||||
-
|
||||
- return FALSE;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- if (priv->m_bEdit)
|
||||
+ case GDK_BUTTON_PRESS:
|
||||
{
|
||||
GdkRectangle aClick;
|
||||
aClick.x = pEvent->x;
|
||||
aClick.y = pEvent->y;
|
||||
aClick.width = 1;
|
||||
aClick.height = 1;
|
||||
- if (pEvent->type == GDK_BUTTON_PRESS)
|
||||
- {
|
||||
- if (gdk_rectangle_intersect(&aClick, &priv->m_aHandleStartRect, nullptr))
|
||||
- {
|
||||
- g_info("LOKDocView_Impl::signalButton: start of drag start handle");
|
||||
- priv->m_bInDragStartHandle = true;
|
||||
- return FALSE;
|
||||
- }
|
||||
- else if (gdk_rectangle_intersect(&aClick, &priv->m_aHandleMiddleRect, nullptr))
|
||||
- {
|
||||
- g_info("LOKDocView_Impl::signalButton: start of drag middle handle");
|
||||
- priv->m_bInDragMiddleHandle = true;
|
||||
- return FALSE;
|
||||
- }
|
||||
- else if (gdk_rectangle_intersect(&aClick, &priv->m_aHandleEndRect, nullptr))
|
||||
- {
|
||||
- g_info("LOKDocView_Impl::signalButton: start of drag end handle");
|
||||
- priv->m_bInDragEndHandle = true;
|
||||
- return FALSE;
|
||||
- }
|
||||
|
||||
- for (int i = 0; i < GRAPHIC_HANDLE_COUNT; ++i)
|
||||
- {
|
||||
- if (gdk_rectangle_intersect(&aClick, &priv->m_aGraphicHandleRects[i], nullptr))
|
||||
- {
|
||||
- g_info("LOKDocView_Impl::signalButton: start of drag graphic handle #%d", i);
|
||||
- priv->m_bInDragGraphicHandles[i] = true;
|
||||
-
|
||||
- GTask* task = g_task_new(pDocView, nullptr, nullptr, nullptr);
|
||||
- LOEvent* pLOEvent = new LOEvent(LOK_SET_GRAPHIC_SELECTION);
|
||||
- pLOEvent->m_nSetGraphicSelectionType = LOK_SETGRAPHICSELECTION_START;
|
||||
- pLOEvent->m_nSetGraphicSelectionX = pixelToTwip(priv->m_aGraphicHandleRects[i].x + priv->m_aGraphicHandleRects[i].width / 2, priv->m_fZoom);
|
||||
- pLOEvent->m_nSetGraphicSelectionY = pixelToTwip(priv->m_aGraphicHandleRects[i].y + priv->m_aGraphicHandleRects[i].height / 2, priv->m_fZoom);
|
||||
- g_task_set_task_data(task, pLOEvent, LOEvent::destroy);
|
||||
-
|
||||
- g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), &error);
|
||||
- if (error != nullptr)
|
||||
- {
|
||||
- g_warning("Unable to call LOK_SET_GRAPHIC_SELECTION: %s", error->message);
|
||||
- g_clear_error(&error);
|
||||
- }
|
||||
- g_object_unref(task);
|
||||
-
|
||||
- return FALSE;
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- if (!priv->m_bEdit)
|
||||
- lok_doc_view_set_edit(pDocView, TRUE);
|
||||
+ if (handleTextSelectionOnButtonPress(aClick, pDocView))
|
||||
+ return FALSE;
|
||||
+ if (handleGraphicSelectionOnButtonPress(aClick, pDocView))
|
||||
+ return FALSE;
|
||||
|
||||
- switch (pEvent->type)
|
||||
- {
|
||||
- case GDK_BUTTON_PRESS:
|
||||
- {
|
||||
int nCount = 1;
|
||||
if ((pEvent->time - priv->m_nLastButtonPressTime) < 250)
|
||||
nCount++;
|
||||
@@ -1347,6 +1381,11 @@ lok_doc_view_signal_button(GtkWidget* pWidget, GdkEventButton* pEvent)
|
||||
}
|
||||
case GDK_BUTTON_RELEASE:
|
||||
{
|
||||
+ if (handleTextSelectionOnButtonRelease(pDocView))
|
||||
+ return FALSE;
|
||||
+ if (handleGraphicSelectionOnButtonRelease(pDocView, pEvent))
|
||||
+ return FALSE;
|
||||
+
|
||||
int nCount = 1;
|
||||
if ((pEvent->time - priv->m_nLastButtonReleaseTime) < 250)
|
||||
nCount++;
|
||||
@@ -1722,6 +1761,8 @@ lokThreadFunc(gpointer data, gpointer /*user_data*/)
|
||||
{
|
||||
GTask* task = G_TASK(data);
|
||||
LOEvent* pLOEvent = static_cast<LOEvent*>(g_task_get_task_data(task));
|
||||
+ LOKDocView* pDocView = LOK_DOC_VIEW(g_task_get_source_object(task));
|
||||
+ LOKDocViewPrivate& priv = getPrivate(pDocView);
|
||||
|
||||
switch (pLOEvent->m_nType)
|
||||
{
|
||||
@@ -1729,7 +1770,10 @@ lokThreadFunc(gpointer data, gpointer /*user_data*/)
|
||||
openDocumentInThread(task);
|
||||
break;
|
||||
case LOK_POST_COMMAND:
|
||||
- postCommandInThread(task);
|
||||
+ if (priv->m_bEdit)
|
||||
+ postCommandInThread(task);
|
||||
+ else
|
||||
+ g_info ("LOK_POST_COMMAND: ignoring commands in view-only mode");
|
||||
break;
|
||||
case LOK_SET_EDIT:
|
||||
setEditInThread(task);
|
||||
@@ -1741,6 +1785,7 @@ lokThreadFunc(gpointer data, gpointer /*user_data*/)
|
||||
setPartmodeInThread(task);
|
||||
break;
|
||||
case LOK_POST_KEY:
|
||||
+ // view-only/editable mode already checked during signal key signal emission
|
||||
postKeyEventInThread(task);
|
||||
break;
|
||||
case LOK_PAINT_TILE:
|
||||
@@ -1750,7 +1795,10 @@ lokThreadFunc(gpointer data, gpointer /*user_data*/)
|
||||
postMouseEventInThread(task);
|
||||
break;
|
||||
case LOK_SET_GRAPHIC_SELECTION:
|
||||
- setGraphicSelectionInThread(task);
|
||||
+ if (priv->m_bEdit)
|
||||
+ setGraphicSelectionInThread(task);
|
||||
+ else
|
||||
+ g_info ("LOK_SET_GRAPHIC_SELECTION: skipping graphical operation in view-only mode");
|
||||
break;
|
||||
case LOK_SET_CLIENT_ZOOM:
|
||||
setClientZoomInThread(task);
|
||||
--
|
||||
2.5.0
|
||||
|
@ -1,151 +0,0 @@
|
||||
From 9c01ac05618875e812c9f6a18edf5cc6a7909b5e Mon Sep 17 00:00:00 2001
|
||||
From: Pranav Kant <pranavk@libreoffice.org>
|
||||
Date: Wed, 9 Dec 2015 21:45:21 +0530
|
||||
Subject: [PATCH] tdf#96317: Add API for copy/paste from/to the widget
|
||||
|
||||
Change-Id: Iac869ddb65cbdd2227f96d047d83159ca7819f11
|
||||
Reviewed-on: https://gerrit.libreoffice.org/20534
|
||||
Reviewed-by: David Tardon <dtardon@redhat.com>
|
||||
Tested-by: David Tardon <dtardon@redhat.com>
|
||||
(cherry picked from commit 7d7fad258dfde500c5ee99b5f1691172724383bd)
|
||||
---
|
||||
include/LibreOfficeKit/LibreOfficeKitGtk.h | 29 +++++++++++++++++++
|
||||
.../qa/gtktiledviewer/gtktiledviewer.cxx | 8 ++----
|
||||
libreofficekit/source/gtk/lokdocview.cxx | 33 +++++++++++++++++++++-
|
||||
3 files changed, 64 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/include/LibreOfficeKit/LibreOfficeKitGtk.h b/include/LibreOfficeKit/LibreOfficeKitGtk.h
|
||||
index 1b03e46..903a742 100644
|
||||
--- a/include/LibreOfficeKit/LibreOfficeKitGtk.h
|
||||
+++ b/include/LibreOfficeKit/LibreOfficeKitGtk.h
|
||||
@@ -235,6 +235,35 @@ void lok_doc_view_highlight_all (LOKDocView*
|
||||
const gchar* pText);
|
||||
|
||||
/**
|
||||
+ * lok_doc_view_copy_selection:
|
||||
+ * @pDocView: The #LOKDocView instance
|
||||
+ * @pMimeType: suggests the return format, for example text/plain;charset=utf-8
|
||||
+ * @pUsedMimeType: (out): output parameter to inform about the determined format
|
||||
+ * (suggested or plain text).
|
||||
+ *
|
||||
+ * Returns: Selected text. The caller must free the returned buffer after use.
|
||||
+ */
|
||||
+gchar* lok_doc_view_copy_selection (LOKDocView* pDocView,
|
||||
+ const gchar* pMimeType,
|
||||
+ gchar** pUsedMimeType);
|
||||
+
|
||||
+/**
|
||||
+ * lok_doc_view_paste:
|
||||
+ * @pDocView: The #LOKDocView instance
|
||||
+ * @pMimeType: format of pData, for example text/plain;charset=utf-8
|
||||
+ * @pData: the data to be pasted
|
||||
+ * @nSize: length of data to be pasted
|
||||
+ *
|
||||
+ * Pastes the content at the current cursor position
|
||||
+ *
|
||||
+ * Returns: if pData was pasted successfully.
|
||||
+ */
|
||||
+gboolean lok_doc_view_paste (LOKDocView* pDocView,
|
||||
+ const gchar* pMimeType,
|
||||
+ const gchar* pData,
|
||||
+ gsize nSize);
|
||||
+
|
||||
+/**
|
||||
* lok_doc_view_pixel_to_twip:
|
||||
* @pDocView: The #LOKDocView instance
|
||||
* @fInput: The value in pixels to convert to twips
|
||||
diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
|
||||
index ac04833..b4dbe16 100644
|
||||
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
|
||||
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
|
||||
@@ -548,9 +548,8 @@ static void doCopy(GtkWidget* pButton, gpointer /*pItem*/)
|
||||
{
|
||||
TiledWindow& rWindow = lcl_getTiledWindow(pButton);
|
||||
LOKDocView* pLOKDocView = LOK_DOC_VIEW(rWindow.m_pDocView);
|
||||
- LibreOfficeKitDocument* pDocument = lok_doc_view_get_document(pLOKDocView);
|
||||
char* pUsedFormat = nullptr;
|
||||
- char* pSelection = pDocument->pClass->getTextSelection(pDocument, "text/html", &pUsedFormat);
|
||||
+ char* pSelection = lok_doc_view_copy_selection(pLOKDocView, "text/html", &pUsedFormat);
|
||||
|
||||
GtkClipboard* pClipboard = gtk_clipboard_get_for_display(gtk_widget_get_display(rWindow.m_pDocView), GDK_SELECTION_CLIPBOARD);
|
||||
std::string aUsedFormat(pUsedFormat);
|
||||
@@ -567,7 +566,6 @@ static void doPaste(GtkWidget* pButton, gpointer /*pItem*/)
|
||||
{
|
||||
TiledWindow& rWindow = lcl_getTiledWindow(pButton);
|
||||
LOKDocView* pLOKDocView = LOK_DOC_VIEW(rWindow.m_pDocView);
|
||||
- LibreOfficeKitDocument* pDocument = lok_doc_view_get_document(pLOKDocView);
|
||||
|
||||
GtkClipboard* pClipboard = gtk_clipboard_get_for_display(gtk_widget_get_display(rWindow.m_pDocView), GDK_SELECTION_CLIPBOARD);
|
||||
|
||||
@@ -591,7 +589,7 @@ static void doPaste(GtkWidget* pButton, gpointer /*pItem*/)
|
||||
GtkSelectionData* pSelectionData = gtk_clipboard_wait_for_contents(pClipboard, *oTarget);
|
||||
gint nLength;
|
||||
const guchar* pData = gtk_selection_data_get_data_with_length(pSelectionData, &nLength);
|
||||
- bool bSuccess = pDocument->pClass->paste(pDocument, "text/html", reinterpret_cast<const char*>(pData), nLength);
|
||||
+ bool bSuccess = lok_doc_view_paste(pLOKDocView, "text/html", reinterpret_cast<const char*>(pData), nLength);
|
||||
gtk_selection_data_free(pSelectionData);
|
||||
if (bSuccess)
|
||||
return;
|
||||
@@ -599,7 +597,7 @@ static void doPaste(GtkWidget* pButton, gpointer /*pItem*/)
|
||||
|
||||
gchar* pText = gtk_clipboard_wait_for_text(pClipboard);
|
||||
if (pText)
|
||||
- pDocument->pClass->paste(pDocument, "text/plain;charset=utf-8", pText, strlen(pText));
|
||||
+ lok_doc_view_paste(pLOKDocView, "text/plain;charset=utf-8", pText, strlen(pText));
|
||||
}
|
||||
|
||||
/// Click handler for the search next button.
|
||||
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
|
||||
index f734baa..d7a72cd 100644
|
||||
--- a/libreofficekit/source/gtk/lokdocview.cxx
|
||||
+++ b/libreofficekit/source/gtk/lokdocview.cxx
|
||||
@@ -344,7 +344,7 @@ doSearch(LOKDocView* pDocView, const char* pText, bool bBackwards, bool highligh
|
||||
cairo_region_get_rectangle(cairoVisRegion, 0, &cairoVisRect);
|
||||
x = pixelToTwip (cairoVisRect.x, priv->m_fZoom);
|
||||
y = pixelToTwip (cairoVisRect.y, priv->m_fZoom);
|
||||
-
|
||||
+
|
||||
aTree.put(boost::property_tree::ptree::path_type("SearchItem.SearchString/type", '/'), "string");
|
||||
aTree.put(boost::property_tree::ptree::path_type("SearchItem.SearchString/value", '/'), pText);
|
||||
aTree.put(boost::property_tree::ptree::path_type("SearchItem.Backward/type", '/'), "boolean");
|
||||
@@ -2669,6 +2669,37 @@ lok_doc_view_highlight_all (LOKDocView* pDocView,
|
||||
doSearch(pDocView, pText, false, true);
|
||||
}
|
||||
|
||||
+SAL_DLLPUBLIC_EXPORT gchar*
|
||||
+lok_doc_view_copy_selection (LOKDocView* pDocView,
|
||||
+ const gchar* pMimeType,
|
||||
+ gchar** pUsedMimeType)
|
||||
+{
|
||||
+ LibreOfficeKitDocument* pDocument = lok_doc_view_get_document(pDocView);
|
||||
+ return pDocument->pClass->getTextSelection(pDocument, pMimeType, pUsedMimeType);
|
||||
+}
|
||||
+
|
||||
+SAL_DLLPUBLIC_EXPORT gboolean
|
||||
+lok_doc_view_paste (LOKDocView* pDocView,
|
||||
+ const gchar* pMimeType,
|
||||
+ const gchar* pData,
|
||||
+ gsize nSize)
|
||||
+{
|
||||
+ LOKDocViewPrivate& priv = getPrivate(pDocView);
|
||||
+ LibreOfficeKitDocument* pDocument = priv->m_pDocument;
|
||||
+ gboolean ret = 0;
|
||||
+
|
||||
+ if (!priv->m_bEdit)
|
||||
+ {
|
||||
+ g_info ("ignoring paste in view-only mode");
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ if (pData)
|
||||
+ ret = pDocument->pClass->paste(pDocument, pMimeType, pData, nSize);
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
SAL_DLLPUBLIC_EXPORT float
|
||||
lok_doc_view_pixel_to_twip (LOKDocView* pDocView, float fInput)
|
||||
{
|
||||
--
|
||||
2.5.0
|
||||
|
@ -1,74 +0,0 @@
|
||||
From 3f13961c45ea9a6f90c0bc268a2274634d9b8033 Mon Sep 17 00:00:00 2001
|
||||
From: Pranav Kant <pranavk@libreoffice.org>
|
||||
Date: Thu, 10 Dec 2015 21:10:16 +0530
|
||||
Subject: [PATCH] tdf#96384: Add a new signal 'text-selection' to lokdocview
|
||||
|
||||
To help client know when the user has selected a non-null text.
|
||||
|
||||
Change-Id: Ie939612fc5f38e2e50e9ad9792e04e89ae918886
|
||||
Reviewed-on: https://gerrit.libreoffice.org/20621
|
||||
Tested-by: Jenkins <ci@libreoffice.org>
|
||||
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
|
||||
(cherry picked from commit ea5c99428f56e1d3a3e782505aa2f56f905038a4)
|
||||
Signed-off-by: David Tardon <dtardon@redhat.com>
|
||||
---
|
||||
libreofficekit/source/gtk/lokdocview.cxx | 21 ++++++++++++++++++++-
|
||||
1 file changed, 20 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
|
||||
index d7a72cd..139b5be 100644
|
||||
--- a/libreofficekit/source/gtk/lokdocview.cxx
|
||||
+++ b/libreofficekit/source/gtk/lokdocview.cxx
|
||||
@@ -186,6 +186,7 @@ enum
|
||||
SEARCH_RESULT_COUNT,
|
||||
COMMAND_RESULT,
|
||||
FORMULA_CHANGED,
|
||||
+ TEXT_SELECTION,
|
||||
|
||||
LAST_SIGNAL
|
||||
};
|
||||
@@ -925,8 +926,9 @@ callback (gpointer pData)
|
||||
case LOK_CALLBACK_TEXT_SELECTION:
|
||||
{
|
||||
priv->m_aTextSelectionRectangles = payloadToRectangles(pDocView, pCallback->m_aPayload.c_str());
|
||||
+ gboolean bIsTextSelected = !priv->m_aTextSelectionRectangles.empty();
|
||||
// In case the selection is empty, then we get no LOK_CALLBACK_TEXT_SELECTION_START/END events.
|
||||
- if (priv->m_aTextSelectionRectangles.empty())
|
||||
+ if (!bIsTextSelected)
|
||||
{
|
||||
memset(&priv->m_aTextSelectionStart, 0, sizeof(priv->m_aTextSelectionStart));
|
||||
memset(&priv->m_aHandleStartRect, 0, sizeof(priv->m_aHandleStartRect));
|
||||
@@ -935,6 +937,8 @@ callback (gpointer pData)
|
||||
}
|
||||
else
|
||||
memset(&priv->m_aHandleMiddleRect, 0, sizeof(priv->m_aHandleMiddleRect));
|
||||
+
|
||||
+ g_signal_emit(pDocView, doc_view_signals[TEXT_SELECTION], 0, bIsTextSelected);
|
||||
gtk_widget_queue_draw(GTK_WIDGET(pDocView));
|
||||
}
|
||||
break;
|
||||
@@ -2382,6 +2386,21 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass)
|
||||
g_cclosure_marshal_VOID__STRING,
|
||||
G_TYPE_NONE, 1,
|
||||
G_TYPE_STRING);
|
||||
+
|
||||
+ /**
|
||||
+ * LOKDocView::text-selection:
|
||||
+ * @pDocView: the #LOKDocView on which the signal is emitted
|
||||
+ * @bIsTextSelected: whether text selected is non-null
|
||||
+ */
|
||||
+ doc_view_signals[TEXT_SELECTION] =
|
||||
+ g_signal_new("text-selection",
|
||||
+ G_TYPE_FROM_CLASS(pGObjectClass),
|
||||
+ G_SIGNAL_RUN_FIRST,
|
||||
+ 0,
|
||||
+ nullptr, nullptr,
|
||||
+ g_cclosure_marshal_VOID__BOOLEAN,
|
||||
+ G_TYPE_NONE, 1,
|
||||
+ G_TYPE_BOOLEAN);
|
||||
}
|
||||
|
||||
SAL_DLLPUBLIC_EXPORT GtkWidget*
|
||||
--
|
||||
2.5.0
|
||||
|
@ -1,138 +0,0 @@
|
||||
From 2b5d5ab9aeeff082025d25b2bfe897e2aeee4c99 Mon Sep 17 00:00:00 2001
|
||||
From: David Tardon <dtardon@redhat.com>
|
||||
Date: Mon, 7 Dec 2015 12:55:11 +0100
|
||||
Subject: [PATCH] update the appstream files to most recent version of the spec
|
||||
|
||||
Change-Id: I6b23be2af3ab28431266075da389b62372508961
|
||||
(cherry picked from commit 8d7d3469da772d6ffcc0ed4fc69ea28e1813b407)
|
||||
---
|
||||
sysui/desktop/appstream-appdata/libreoffice-base.appdata.xml | 4 ++--
|
||||
sysui/desktop/appstream-appdata/libreoffice-calc.appdata.xml | 4 ++--
|
||||
sysui/desktop/appstream-appdata/libreoffice-draw.appdata.xml | 4 ++--
|
||||
sysui/desktop/appstream-appdata/libreoffice-impress.appdata.xml | 4 ++--
|
||||
sysui/desktop/appstream-appdata/libreoffice-writer.appdata.xml | 4 ++--
|
||||
5 files changed, 10 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/sysui/desktop/appstream-appdata/libreoffice-base.appdata.xml b/sysui/desktop/appstream-appdata/libreoffice-base.appdata.xml
|
||||
index 6338a37..2ca8a8f 100644
|
||||
--- a/sysui/desktop/appstream-appdata/libreoffice-base.appdata.xml
|
||||
+++ b/sysui/desktop/appstream-appdata/libreoffice-base.appdata.xml
|
||||
@@ -1,9 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<component type="desktop">
|
||||
<id>libreoffice-base.desktop</id>
|
||||
+<metadata_license>CC0-1.0</metadata_license>
|
||||
<project_license>MPL-2.0</project_license>
|
||||
<name>LibreOffice Base</name>
|
||||
-<summary>database manaager part of the LibreOffice productivity suite</summary>
|
||||
+<summary>Database manaager part of the LibreOffice productivity suite</summary>
|
||||
<description>
|
||||
<p>
|
||||
Base is a powerful database manager, part of the LibreOffice productivity suite.
|
||||
@@ -29,7 +30,6 @@ to connect to virtually any other existing database engine as well.
|
||||
<screenshot type="default">http://www.libreoffice.org/assets/Uploads/Screenshots/Base/Screenshot-78.png</screenshot>
|
||||
<screenshot>http://www.libreoffice.org/assets/Uploads/Screenshots/Base/Screenshot-80.png</screenshot>
|
||||
</screenshots>
|
||||
-<project_group>The Document Foundation</project_group>
|
||||
<developer_name>The Document Foundation</developer_name>
|
||||
<updatecontact>libreoffice_at_lists.freedesktop.org</updatecontact>
|
||||
</component>
|
||||
diff --git a/sysui/desktop/appstream-appdata/libreoffice-calc.appdata.xml b/sysui/desktop/appstream-appdata/libreoffice-calc.appdata.xml
|
||||
index b8beb71..836f100 100644
|
||||
--- a/sysui/desktop/appstream-appdata/libreoffice-calc.appdata.xml
|
||||
+++ b/sysui/desktop/appstream-appdata/libreoffice-calc.appdata.xml
|
||||
@@ -1,9 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<component type="desktop">
|
||||
<id>libreoffice-calc.desktop</id>
|
||||
+<metadata_license>CC0-1.0</metadata_license>
|
||||
<project_license>MPL-2.0</project_license>
|
||||
<name>LibreOffice Calc</name>
|
||||
-<summary>spreadsheet program of the LibreOffice productivity suite</summary>
|
||||
+<summary>Spreadsheet program of the LibreOffice productivity suite</summary>
|
||||
<description>
|
||||
<p>
|
||||
Calc is a powerful and extensible spreadsheet program, part of the LibreOffice
|
||||
@@ -22,7 +23,6 @@ worrying about compatibility.
|
||||
<screenshots>
|
||||
<screenshot type="default">http://www.libreoffice.org/assets/Uploads/Discover/Screenshots/_resampled/ResizedImage400300-Calc-02-exemple-ods.png</screenshot>
|
||||
</screenshots>
|
||||
-<project_group>The Document Foundation</project_group>
|
||||
<developer_name>The Document Foundation</developer_name>
|
||||
<updatecontact>libreoffice_at_lists.freedesktop.org</updatecontact>
|
||||
</component>
|
||||
diff --git a/sysui/desktop/appstream-appdata/libreoffice-draw.appdata.xml b/sysui/desktop/appstream-appdata/libreoffice-draw.appdata.xml
|
||||
index 2868598..4888653 100644
|
||||
--- a/sysui/desktop/appstream-appdata/libreoffice-draw.appdata.xml
|
||||
+++ b/sysui/desktop/appstream-appdata/libreoffice-draw.appdata.xml
|
||||
@@ -1,9 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<component type="desktop">
|
||||
<id>libreoffice-draw.desktop</id>
|
||||
+<metadata_license>CC0-1.0</metadata_license>
|
||||
<project_license>MPL-2.0</project_license>
|
||||
<name>LibreOffice Draw</name>
|
||||
-<summary>graphics editor part of the LibreOffice productivity suite</summary>
|
||||
+<summary>Graphics editor part of the LibreOffice productivity suite</summary>
|
||||
<description>
|
||||
<p>
|
||||
LibreOffice Draw is an easy-to-use graphics editor, which empowers you to create
|
||||
@@ -28,7 +29,6 @@ worrying about compatibility.
|
||||
<screenshot type="default">http://www.libreoffice.org/assets/Uploads/Discover/Screenshots/_resampled/ResizedImage400300-Draw-02-Tiger-fdo82219.png</screenshot>
|
||||
<screenshot>http://www.libreoffice.org/assets/Uploads/Discover/Screenshots/_resampled/ResizedImage400300-Draw-03-Square-fdo75097.png</screenshot>
|
||||
</screenshots>
|
||||
-<project_group>The Document Foundation</project_group>
|
||||
<developer_name>The Document Foundation</developer_name>
|
||||
<updatecontact>libreoffice_at_lists.freedesktop.org</updatecontact>
|
||||
</component>
|
||||
diff --git a/sysui/desktop/appstream-appdata/libreoffice-impress.appdata.xml b/sysui/desktop/appstream-appdata/libreoffice-impress.appdata.xml
|
||||
index ccb0e92..6174a0865 100644
|
||||
--- a/sysui/desktop/appstream-appdata/libreoffice-impress.appdata.xml
|
||||
+++ b/sysui/desktop/appstream-appdata/libreoffice-impress.appdata.xml
|
||||
@@ -1,9 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<component type="desktop">
|
||||
<id>libreoffice-impress.desktop</id>
|
||||
+<metadata_license>CC0-1.0</metadata_license>
|
||||
<project_license>MPL-2.0</project_license>
|
||||
<name>LibreOffice Impress</name>
|
||||
-<summary>presentation program of the LibreOffice productivity suite</summary>
|
||||
+<summary>Presentation program of the LibreOffice productivity suite</summary>
|
||||
<description>
|
||||
<p>
|
||||
Impress is a presentation program and part of the LibreOffice productivity suite.
|
||||
@@ -23,7 +24,6 @@ worrying about compatibility.
|
||||
<screenshots>
|
||||
<screenshot type="default">http://www.libreoffice.org/assets/Uploads/Discover/Screenshots/_resampled/ResizedImage400300-Impress-01-Blank.png</screenshot>
|
||||
</screenshots>
|
||||
-<project_group>The Document Foundation</project_group>
|
||||
<developer_name>The Document Foundation</developer_name>
|
||||
<updatecontact>libreoffice_at_lists.freedesktop.org</updatecontact>
|
||||
</component>
|
||||
diff --git a/sysui/desktop/appstream-appdata/libreoffice-writer.appdata.xml b/sysui/desktop/appstream-appdata/libreoffice-writer.appdata.xml
|
||||
index fbd09a7..7e4b07f 100644
|
||||
--- a/sysui/desktop/appstream-appdata/libreoffice-writer.appdata.xml
|
||||
+++ b/sysui/desktop/appstream-appdata/libreoffice-writer.appdata.xml
|
||||
@@ -1,9 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<component type="desktop">
|
||||
<id>libreoffice-writer.desktop</id>
|
||||
+<metadata_license>CC0-1.0</metadata_license>
|
||||
<project_license>MPL-2.0</project_license>
|
||||
<name>LibreOffice Writer</name>
|
||||
-<summary>word processor part of the LibreOffice productivity suite</summary>
|
||||
+<summary>Word processor part of the LibreOffice productivity suite</summary>
|
||||
<description>
|
||||
<p>
|
||||
Writer is the word processor inside LibreOffice productivity suite.
|
||||
@@ -30,7 +31,6 @@ worrying about compatibility.
|
||||
<screenshot type="default">http://www.libreoffice.org/assets/Uploads/Discover/Screenshots/_resampled/ResizedImage400300-Writer-02-Table-of-Contents-Getting-Started-Guide-4-2.png</screenshot>
|
||||
<screenshot>http://www.libreoffice.org/assets/Uploads/Discover/Screenshots/_resampled/ResizedImage400300-Writer-03-Technical-Doc-fdo83524.png</screenshot>
|
||||
</screenshots>
|
||||
-<project_group>The Document Foundation</project_group>
|
||||
<developer_name>The Document Foundation</developer_name>
|
||||
<updatecontact>libreoffice_at_lists.freedesktop.org</updatecontact>
|
||||
</component>
|
||||
--
|
||||
2.5.0
|
||||
|
@ -1,295 +0,0 @@
|
||||
From e7cdd6803485bbe4cfe27f5f466b427823318334 Mon Sep 17 00:00:00 2001
|
||||
From: Pranav Kant <pranavk@libreoffice.org>
|
||||
Date: Wed, 9 Dec 2015 10:33:05 +0530
|
||||
Subject: [PATCH 2/3] tdf#96318: Add searching API
|
||||
|
||||
Clients should now use these APIs to search for text in the
|
||||
widget, rather than executing UNO commands directly on the
|
||||
widget. This allows searching for text in the widget in view-only
|
||||
mode too.
|
||||
|
||||
Change-Id: I013b6f96e69a634ec33367394d39c0f645a4994d
|
||||
Reviewed-on: https://gerrit.libreoffice.org/20488
|
||||
Tested-by: Jenkins <ci@libreoffice.org>
|
||||
Reviewed-by: David Tardon <dtardon@redhat.com>
|
||||
(cherry picked from commit 0f64cf72ff3b930e306e937bb18f4cbe55a8026a)
|
||||
---
|
||||
include/LibreOfficeKit/LibreOfficeKitGtk.h | 38 ++++++++
|
||||
.../qa/gtktiledviewer/gtktiledviewer.cxx | 46 +++------
|
||||
libreofficekit/source/gtk/lokdocview.cxx | 107 +++++++++++++++++----
|
||||
3 files changed, 139 insertions(+), 52 deletions(-)
|
||||
|
||||
diff --git a/include/LibreOfficeKit/LibreOfficeKitGtk.h b/include/LibreOfficeKit/LibreOfficeKitGtk.h
|
||||
index 8b6092c..b2f17f1 100644
|
||||
--- a/include/LibreOfficeKit/LibreOfficeKitGtk.h
|
||||
+++ b/include/LibreOfficeKit/LibreOfficeKitGtk.h
|
||||
@@ -195,6 +195,44 @@ void lok_doc_view_post_command (LOKDocView*
|
||||
const gchar* pArguments,
|
||||
gboolean bNotifyWhenFinished);
|
||||
|
||||
+
|
||||
+/**
|
||||
+ * lok_doc_view_find_next:
|
||||
+ * @pDocView: The #LOKDocView instance
|
||||
+ * @pText: text to search for
|
||||
+ * @bHighlightAll: Whether all the matches should be highlighted or not
|
||||
+ *
|
||||
+ * Highlights the next matching text in the view. `search-not-found` signal will
|
||||
+ * be emitted when no search is found
|
||||
+ */
|
||||
+void lok_doc_view_find_next (LOKDocView* pDocView,
|
||||
+ const gchar* pText,
|
||||
+ gboolean bHighlightAll);
|
||||
+
|
||||
+/**
|
||||
+ * lok_doc_view_find_prev:
|
||||
+ * @pDocView: The #LOKDocView instance
|
||||
+ * @pText: text to search for
|
||||
+ * @bHighlightAll: Whether all the matches should be highlighted or not
|
||||
+ *
|
||||
+ * Highlights the previous matching text in the view. `search-not-found` signal
|
||||
+ * will be emitted when no search is found
|
||||
+ */
|
||||
+void lok_doc_view_find_prev (LOKDocView* pDocView,
|
||||
+ const gchar* pText,
|
||||
+ gboolean bHighlightAll);
|
||||
+
|
||||
+/**
|
||||
+ * lok_doc_view_highlight_all:
|
||||
+ * @pDocView: The #LOKDocView instance
|
||||
+ * @pText: text to search for
|
||||
+ *
|
||||
+ * Highlights all matching texts in the view. `search-not-found` signal
|
||||
+ * will be emitted when no search is found
|
||||
+ */
|
||||
+void lok_doc_view_highlight_all (LOKDocView* pDocView,
|
||||
+ const gchar* pText);
|
||||
+
|
||||
/**
|
||||
* lok_doc_view_pixel_to_twip:
|
||||
* @pDocView: The #LOKDocView instance
|
||||
diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
|
||||
index 77021bf..ac04833 100644
|
||||
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
|
||||
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
|
||||
@@ -439,7 +439,11 @@ static void toggleEditing(GtkWidget* pButton, gpointer /*pItem*/)
|
||||
static void toggleFindAll(GtkWidget* pButton, gpointer /*pItem*/)
|
||||
{
|
||||
TiledWindow& rWindow = lcl_getTiledWindow(pButton);
|
||||
+ GtkEntry* pEntry = GTK_ENTRY(rWindow.m_pFindbarEntry);
|
||||
+ const char* pText = gtk_entry_get_text(pEntry);
|
||||
+
|
||||
rWindow.m_bFindAll = !rWindow.m_bFindAll;
|
||||
+ lok_doc_view_highlight_all(LOK_DOC_VIEW(rWindow.m_pDocView), pText);
|
||||
}
|
||||
|
||||
/// Toggle the visibility of the findbar.
|
||||
@@ -598,48 +602,24 @@ static void doPaste(GtkWidget* pButton, gpointer /*pItem*/)
|
||||
pDocument->pClass->paste(pDocument, "text/plain;charset=utf-8", pText, strlen(pText));
|
||||
}
|
||||
|
||||
-/// Searches for the next or previous text of TiledWindow::m_pFindbarEntry.
|
||||
-static void doSearch(GtkWidget* pButton, bool bBackwards)
|
||||
+/// Click handler for the search next button.
|
||||
+static void signalSearchNext(GtkWidget* pButton, gpointer /*pItem*/)
|
||||
{
|
||||
TiledWindow& rWindow = lcl_getTiledWindow(pButton);
|
||||
GtkEntry* pEntry = GTK_ENTRY(rWindow.m_pFindbarEntry);
|
||||
const char* pText = gtk_entry_get_text(pEntry);
|
||||
- boost::property_tree::ptree aTree;
|
||||
- aTree.put(boost::property_tree::ptree::path_type("SearchItem.SearchString/type", '/'), "string");
|
||||
- aTree.put(boost::property_tree::ptree::path_type("SearchItem.SearchString/value", '/'), pText);
|
||||
- aTree.put(boost::property_tree::ptree::path_type("SearchItem.Backward/type", '/'), "boolean");
|
||||
- aTree.put(boost::property_tree::ptree::path_type("SearchItem.Backward/value", '/'), bBackwards);
|
||||
- if (rWindow.m_bFindAll)
|
||||
- {
|
||||
- aTree.put(boost::property_tree::ptree::path_type("SearchItem.Command/type", '/'), "unsigned short");
|
||||
- // SvxSearchCmd::FIND_ALL
|
||||
- aTree.put(boost::property_tree::ptree::path_type("SearchItem.Command/value", '/'), "1");
|
||||
- }
|
||||
-
|
||||
- LOKDocView* pLOKDocView = LOK_DOC_VIEW(rWindow.m_pDocView);
|
||||
- GdkRectangle aArea;
|
||||
- getVisibleAreaTwips(rWindow.m_pDocView, &aArea);
|
||||
- aTree.put(boost::property_tree::ptree::path_type("SearchItem.SearchStartPointX/type", '/'), "long");
|
||||
- aTree.put(boost::property_tree::ptree::path_type("SearchItem.SearchStartPointX/value", '/'), aArea.x);
|
||||
- aTree.put(boost::property_tree::ptree::path_type("SearchItem.SearchStartPointY/type", '/'), "long");
|
||||
- aTree.put(boost::property_tree::ptree::path_type("SearchItem.SearchStartPointY/value", '/'), aArea.y);
|
||||
-
|
||||
- std::stringstream aStream;
|
||||
- boost::property_tree::write_json(aStream, aTree);
|
||||
|
||||
- lok_doc_view_post_command(pLOKDocView, ".uno:ExecuteSearch", aStream.str().c_str(), false);
|
||||
-}
|
||||
-
|
||||
-/// Click handler for the search next button.
|
||||
-static void signalSearchNext(GtkWidget* pButton, gpointer /*pItem*/)
|
||||
-{
|
||||
- doSearch(pButton, /*bBackwards=*/false);
|
||||
+ lok_doc_view_find_next(LOK_DOC_VIEW(rWindow.m_pDocView), pText, rWindow.m_bFindAll);
|
||||
}
|
||||
|
||||
/// Click handler for the search previous button.
|
||||
static void signalSearchPrev(GtkWidget* pButton, gpointer /*pItem*/)
|
||||
{
|
||||
- doSearch(pButton, /*bBackwards=*/true);
|
||||
+ TiledWindow& rWindow = lcl_getTiledWindow(pButton);
|
||||
+ GtkEntry* pEntry = GTK_ENTRY(rWindow.m_pFindbarEntry);
|
||||
+ const char* pText = gtk_entry_get_text(pEntry);
|
||||
+
|
||||
+ lok_doc_view_find_prev(LOK_DOC_VIEW(rWindow.m_pDocView), pText, rWindow.m_bFindAll);
|
||||
}
|
||||
|
||||
/// Handles the key-press-event of the search entry widget.
|
||||
@@ -652,7 +632,7 @@ static gboolean signalFindbar(GtkWidget* pWidget, GdkEventKey* pEvent, gpointer
|
||||
case GDK_KEY_Return:
|
||||
{
|
||||
// Search forward.
|
||||
- doSearch(pWidget, /*bBackwards=*/false);
|
||||
+ signalSearchNext(pWidget, nullptr);
|
||||
return TRUE;
|
||||
}
|
||||
case GDK_KEY_Escape:
|
||||
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
|
||||
index cbdac71..488abc0 100644
|
||||
--- a/libreofficekit/source/gtk/lokdocview.cxx
|
||||
+++ b/libreofficekit/source/gtk/lokdocview.cxx
|
||||
@@ -306,6 +306,67 @@ callbackTypeToString (int nType)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
+static void
|
||||
+LOKPostCommand (LOKDocView* pDocView,
|
||||
+ const gchar* pCommand,
|
||||
+ const gchar* pArguments,
|
||||
+ gboolean bNotifyWhenFinished)
|
||||
+{
|
||||
+ LOKDocViewPrivate& priv = getPrivate(pDocView);
|
||||
+ GTask* task = g_task_new(pDocView, nullptr, nullptr, nullptr);
|
||||
+ LOEvent* pLOEvent = new LOEvent(LOK_POST_COMMAND);
|
||||
+ GError* error = nullptr;
|
||||
+ pLOEvent->m_pCommand = pCommand;
|
||||
+ pLOEvent->m_pArguments = g_strdup(pArguments);
|
||||
+ pLOEvent->m_bNotifyWhenFinished = bNotifyWhenFinished;
|
||||
+
|
||||
+ g_task_set_task_data(task, pLOEvent, LOEvent::destroy);
|
||||
+ g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), &error);
|
||||
+ if (error != nullptr)
|
||||
+ {
|
||||
+ g_warning("Unable to call LOK_POST_COMMAND: %s", error->message);
|
||||
+ g_clear_error(&error);
|
||||
+ }
|
||||
+ g_object_unref(task);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+doSearch(LOKDocView* pDocView, const char* pText, bool bBackwards, bool highlightAll)
|
||||
+{
|
||||
+ LOKDocViewPrivate& priv = getPrivate(pDocView);
|
||||
+ boost::property_tree::ptree aTree;
|
||||
+ GtkWidget* drawingWidget = GTK_WIDGET(pDocView);
|
||||
+ GdkWindow* drawingWindow = gtk_widget_get_window(drawingWidget);
|
||||
+ cairo_region_t* cairoVisRegion = gdk_window_get_visible_region(drawingWindow);
|
||||
+ cairo_rectangle_int_t cairoVisRect;
|
||||
+ int x, y;
|
||||
+
|
||||
+ cairo_region_get_rectangle(cairoVisRegion, 0, &cairoVisRect);
|
||||
+ x = pixelToTwip (cairoVisRect.x, priv->m_fZoom);
|
||||
+ y = pixelToTwip (cairoVisRect.y, priv->m_fZoom);
|
||||
+
|
||||
+ aTree.put(boost::property_tree::ptree::path_type("SearchItem.SearchString/type", '/'), "string");
|
||||
+ aTree.put(boost::property_tree::ptree::path_type("SearchItem.SearchString/value", '/'), pText);
|
||||
+ aTree.put(boost::property_tree::ptree::path_type("SearchItem.Backward/type", '/'), "boolean");
|
||||
+ aTree.put(boost::property_tree::ptree::path_type("SearchItem.Backward/value", '/'), bBackwards);
|
||||
+ if (highlightAll)
|
||||
+ {
|
||||
+ aTree.put(boost::property_tree::ptree::path_type("SearchItem.Command/type", '/'), "unsigned short");
|
||||
+ // SvxSearchCmd::FIND_ALL
|
||||
+ aTree.put(boost::property_tree::ptree::path_type("SearchItem.Command/value", '/'), "1");
|
||||
+ }
|
||||
+
|
||||
+ aTree.put(boost::property_tree::ptree::path_type("SearchItem.SearchStartPointX/type", '/'), "long");
|
||||
+ aTree.put(boost::property_tree::ptree::path_type("SearchItem.SearchStartPointX/value", '/'), x);
|
||||
+ aTree.put(boost::property_tree::ptree::path_type("SearchItem.SearchStartPointY/type", '/'), "long");
|
||||
+ aTree.put(boost::property_tree::ptree::path_type("SearchItem.SearchStartPointY/value", '/'), y);
|
||||
+
|
||||
+ std::stringstream aStream;
|
||||
+ boost::property_tree::write_json(aStream, aTree);
|
||||
+
|
||||
+ LOKPostCommand (pDocView, ".uno:ExecuteSearch", aStream.str().c_str(), false);
|
||||
+}
|
||||
+
|
||||
static bool
|
||||
isEmptyRectangle(const GdkRectangle& rRectangle)
|
||||
{
|
||||
@@ -1770,10 +1831,7 @@ lokThreadFunc(gpointer data, gpointer /*user_data*/)
|
||||
openDocumentInThread(task);
|
||||
break;
|
||||
case LOK_POST_COMMAND:
|
||||
- if (priv->m_bEdit)
|
||||
- postCommandInThread(task);
|
||||
- else
|
||||
- g_info ("LOK_POST_COMMAND: ignoring commands in view-only mode");
|
||||
+ postCommandInThread(task);
|
||||
break;
|
||||
case LOK_SET_EDIT:
|
||||
setEditInThread(task);
|
||||
@@ -2575,7 +2633,6 @@ lok_doc_view_get_edit (LOKDocView* pDocView)
|
||||
return priv->m_bEdit;
|
||||
}
|
||||
|
||||
-
|
||||
SAL_DLLPUBLIC_EXPORT void
|
||||
lok_doc_view_post_command (LOKDocView* pDocView,
|
||||
const gchar* pCommand,
|
||||
@@ -2583,21 +2640,33 @@ lok_doc_view_post_command (LOKDocView* pDocView,
|
||||
gboolean bNotifyWhenFinished)
|
||||
{
|
||||
LOKDocViewPrivate& priv = getPrivate(pDocView);
|
||||
- GTask* task = g_task_new(pDocView, nullptr, nullptr, nullptr);
|
||||
- LOEvent* pLOEvent = new LOEvent(LOK_POST_COMMAND);
|
||||
- GError* error = nullptr;
|
||||
- pLOEvent->m_pCommand = pCommand;
|
||||
- pLOEvent->m_pArguments = g_strdup(pArguments);
|
||||
- pLOEvent->m_bNotifyWhenFinished = bNotifyWhenFinished;
|
||||
+ if (priv->m_bEdit)
|
||||
+ LOKPostCommand(pDocView, pCommand, pArguments, bNotifyWhenFinished);
|
||||
+ else
|
||||
+ g_info ("LOK_POST_COMMAND: ignoring commands in view-only mode");
|
||||
+}
|
||||
|
||||
- g_task_set_task_data(task, pLOEvent, LOEvent::destroy);
|
||||
- g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), &error);
|
||||
- if (error != nullptr)
|
||||
- {
|
||||
- g_warning("Unable to call LOK_POST_COMMAND: %s", error->message);
|
||||
- g_clear_error(&error);
|
||||
- }
|
||||
- g_object_unref(task);
|
||||
+SAL_DLLPUBLIC_EXPORT void
|
||||
+lok_doc_view_find_prev (LOKDocView* pDocView,
|
||||
+ const gchar* pText,
|
||||
+ gboolean bHighlightAll)
|
||||
+{
|
||||
+ doSearch(pDocView, pText, true, bHighlightAll);
|
||||
+}
|
||||
+
|
||||
+SAL_DLLPUBLIC_EXPORT void
|
||||
+lok_doc_view_find_next (LOKDocView* pDocView,
|
||||
+ const gchar* pText,
|
||||
+ gboolean bHighlightAll)
|
||||
+{
|
||||
+ doSearch(pDocView, pText, false, bHighlightAll);
|
||||
+}
|
||||
+
|
||||
+SAL_DLLPUBLIC_EXPORT void
|
||||
+lok_doc_view_highlight_all (LOKDocView* pDocView,
|
||||
+ const gchar* pText)
|
||||
+{
|
||||
+ doSearch(pDocView, pText, false, true);
|
||||
}
|
||||
|
||||
SAL_DLLPUBLIC_EXPORT float
|
||||
--
|
||||
2.5.0
|
||||
|
@ -1,64 +0,0 @@
|
||||
From dabfa0ce06f605fd0e8de32774b6385fd6ffbd56 Mon Sep 17 00:00:00 2001
|
||||
From: Pranav Kant <pranavk@libreoffice.org>
|
||||
Date: Tue, 8 Dec 2015 23:14:25 +0530
|
||||
Subject: [PATCH 3/3] lokdocview: Set a 'default' path for LOK init
|
||||
|
||||
When passed NULL to lok_doc_view_new, use the default path :
|
||||
$libdir/libreoffice/program as LOK install path
|
||||
|
||||
Change-Id: I1e033c407184b29b1509cfb8c416b514591d67ce
|
||||
Reviewed-on: https://gerrit.libreoffice.org/20476
|
||||
Tested-by: Jenkins <ci@libreoffice.org>
|
||||
Reviewed-by: David Tardon <dtardon@redhat.com>
|
||||
(cherry picked from commit 424c09b10d3d6ba6edfed2dcf560d5ce2c950b9d)
|
||||
---
|
||||
include/LibreOfficeKit/LibreOfficeKitGtk.h | 3 ++-
|
||||
libreofficekit/Library_libreofficekitgtk.mk | 4 ++++
|
||||
libreofficekit/source/gtk/lokdocview.cxx | 2 +-
|
||||
3 files changed, 7 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/include/LibreOfficeKit/LibreOfficeKitGtk.h b/include/LibreOfficeKit/LibreOfficeKitGtk.h
|
||||
index b2f17f1..1b03e46 100644
|
||||
--- a/include/LibreOfficeKit/LibreOfficeKitGtk.h
|
||||
+++ b/include/LibreOfficeKit/LibreOfficeKitGtk.h
|
||||
@@ -42,7 +42,8 @@ GType lok_doc_view_get_type (void) G_GNUC
|
||||
|
||||
/**
|
||||
* lok_doc_view_new:
|
||||
- * @pPath: LibreOffice install path.
|
||||
+ * @pPath: (nullable): LibreOffice install path. Pass null to set it to default
|
||||
+ * path which in most cases would be $libdir/libreoffice/program
|
||||
* @cancellable: The cancellable object that you can use to cancel this
|
||||
* operation.
|
||||
* @error: The error that will be set if the object fails to initialize.
|
||||
diff --git a/libreofficekit/Library_libreofficekitgtk.mk b/libreofficekit/Library_libreofficekitgtk.mk
|
||||
index 3eba939..fc62e72 100644
|
||||
--- a/libreofficekit/Library_libreofficekitgtk.mk
|
||||
+++ b/libreofficekit/Library_libreofficekitgtk.mk
|
||||
@@ -28,6 +28,10 @@ $(eval $(call gb_Library_add_libs,libreofficekitgtk,\
|
||||
$(GTK3_LIBS) \
|
||||
))
|
||||
|
||||
+$(eval $(call gb_Library_add_defs,libreofficekitgtk,\
|
||||
+ -DLOK_PATH="\"$(LIBDIR)/libreoffice/$(LIBO_LIB_FOLDER)\"" \
|
||||
+))
|
||||
+
|
||||
ifeq ($(OS),$(filter LINUX %BSD SOLARIS, $(OS)))
|
||||
$(eval $(call gb_Library_add_libs,libreofficekitgtk,\
|
||||
$(DLOPEN_LIBS) -lm \
|
||||
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
|
||||
index 488abc0..f734baa 100644
|
||||
--- a/libreofficekit/source/gtk/lokdocview.cxx
|
||||
+++ b/libreofficekit/source/gtk/lokdocview.cxx
|
||||
@@ -2387,7 +2387,7 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass)
|
||||
SAL_DLLPUBLIC_EXPORT GtkWidget*
|
||||
lok_doc_view_new (const gchar* pPath, GCancellable *cancellable, GError **error)
|
||||
{
|
||||
- return GTK_WIDGET (g_initable_new (LOK_TYPE_DOC_VIEW, cancellable, error, "lopath", pPath, NULL));
|
||||
+ return GTK_WIDGET (g_initable_new (LOK_TYPE_DOC_VIEW, cancellable, error, "lopath", pPath == NULL ? LOK_PATH : pPath, NULL));
|
||||
}
|
||||
|
||||
SAL_DLLPUBLIC_EXPORT GtkWidget* lok_doc_view_new_from_widget(LOKDocView* pOldLOKDocView)
|
||||
--
|
||||
2.5.0
|
||||
|
Loading…
Reference in new issue