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

2023-06-05 Thread Stephan Bergmann (via logerrit)
 libreofficekit/qa/gtktiledviewer/gtv-main-toolbar.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 436c879b355f2cde763b0386df92e0d3708180a7
Author: Stephan Bergmann 
AuthorDate: Mon Jun 5 13:52:01 2023 +0200
Commit: Stephan Bergmann 
CommitDate: Mon Jun 5 15:57:33 2023 +0200

Missing include (for std::find_if)

Change-Id: I91d70d72ea6cb18ed4fde2f3b3a3d037668767e5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152615
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/libreofficekit/qa/gtktiledviewer/gtv-main-toolbar.cxx 
b/libreofficekit/qa/gtktiledviewer/gtv-main-toolbar.cxx
index a89b8fc7fc72..7127581856fc 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-main-toolbar.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-main-toolbar.cxx
@@ -16,6 +16,7 @@
 
 #include 
 
+#include 
 #include 
 #include 
 #include 


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

2023-03-11 Thread Michael Meeks (via logerrit)
 libreofficekit/qa/tilebench/tilebench.cxx |   25 ++---
 1 file changed, 22 insertions(+), 3 deletions(-)

New commits:
commit 950ad392c8e57a78a92450330a91b2f8233f038c
Author: Michael Meeks 
AuthorDate: Fri Mar 10 22:18:39 2023 +
Commit: Michael Meeks 
CommitDate: Sat Mar 11 14:40:03 2023 +

tilebench: allow save after rendering, and better load fail diagnostic.

Change-Id: I24df1a42b1d3e991a430cf0ca25e9dc53b4bbff2
Signed-off-by: Michael Meeks 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148674

diff --git a/libreofficekit/qa/tilebench/tilebench.cxx 
b/libreofficekit/qa/tilebench/tilebench.cxx
index 6b6dcf4056a4..382003e9ec5a 100644
--- a/libreofficekit/qa/tilebench/tilebench.cxx
+++ b/libreofficekit/qa/tilebench/tilebench.cxx
@@ -32,7 +32,7 @@ static int help( const char *error = nullptr )
 {
 if (error)
 fprintf (stderr, "Error: %s\n\n", error);
-fprintf( stderr, "Usage: tilebench  
[path to document] [--preinit] \n");
+fprintf( stderr, "Usage: tilebench  
[path to document] [--preinit] [--save ] \n");
 fprintf( stderr, "\trenders a selection of small tiles from the document, 
checksums them and times the process based on options:\n" );
 fprintf( stderr, "\t--tile\t[max parts|-1] [max tiles|-1]\n" );
 fprintf( stderr, "\t--dialog\t<.uno:Command>\n" );
@@ -579,6 +579,14 @@ int main( int argc, char* argv[] )
 mode = argv[arg++];
 }
 
+const char *saveToPath = nullptr;
+if (!strcmp (mode, "--save"))
+{
+pre_init = true;
+saveToPath = argv[arg++];
+mode = argv[arg++];
+}
+
 std::string user_url("file:///");
 user_url.append(argv[1]);
 user_url.append("../user");
@@ -598,6 +606,7 @@ int main( int argc, char* argv[] )
 const char *user_profile = nullptr;
 const char *doc_url = strdup([NSBundle mainBundle] bundleURL] 
absoluteString] stringByAppendingString:@"/test.odt"] UTF8String]);
 const char *mode = "--tile";
+const char *saveToPath = nullptr;
 #endif
 
 aTimes.emplace_back("initialization");
@@ -655,9 +664,19 @@ int main( int argc, char* argv[] )
 }
 }
 testDialog (pDocument.get(), uno_cmd);
-} else
+}
+else
 return help ("unknown parameter");
-}
+
+if (saveToPath != nullptr)
+{
+aTimes.emplace_back("save");
+pDocument->saveAs(saveToPath);
+aTimes.emplace_back();
+}
+} else
+fprintf(stderr, "Failed to load document '%s'\n",
+(doc_url ? doc_url : ""));
 
 #ifdef IOS
 Application::Quit();


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

2023-01-09 Thread Stephan Bergmann (via logerrit)
 libreofficekit/qa/gtktiledviewer/gtv-calc-header-bar.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 42d9077fc4ffc35d769412a979d91e836adb2536
Author: Stephan Bergmann 
AuthorDate: Mon Jan 9 08:26:45 2023 +0100
Commit: Stephan Bergmann 
CommitDate: Mon Jan 9 08:26:19 2023 +

Missing include

...as reported at


"boost 1.81 breaks libetonyek and gtv-calc-header-bar.cxx",

> 
/home/etna/Tmpbuild/libreoffice/libreofficekit/qa/gtktiledviewer/gtv-calc-header-bar.cxx:36:25:
 error: implicit instantiation of undefined template 'std::vector<(anonymous 
namespace)::GtvCalcHeaderBarPrivateImpl::Header>'
> std::vector m_aHeaders;
> ^
> 
/home/etna/Runtime/BuildSystem/LLVM13WithWASM/bin/../include/c++/v1/iosfwd:251:28:
 note: template is declared here
> class _LIBCPP_TEMPLATE_VIS vector;
>^

Change-Id: I6cc93195147979a5bf2785faf4bb0e71a9fd4a94
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145185
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/libreofficekit/qa/gtktiledviewer/gtv-calc-header-bar.cxx 
b/libreofficekit/qa/gtktiledviewer/gtv-calc-header-bar.cxx
index 22aadbe2f337..6019050236e8 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-calc-header-bar.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-calc-header-bar.cxx
@@ -11,6 +11,7 @@
 
 #include 
 #include 
+#include 
 
 #include "gtv-calc-header-bar.hxx"
 


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

2022-11-30 Thread Miklos Vajna (via logerrit)
 libreofficekit/qa/gtktiledviewer/gtv-main-toolbar.cxx|1 
 libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx |   35 +++
 libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.hxx |2 
 libreofficekit/qa/gtktiledviewer/gtv.ui  |   20 +++-
 4 files changed, 55 insertions(+), 3 deletions(-)

New commits:
commit 2c149dc9983317bce9116649270c3513adc35514
Author: Miklos Vajna 
AuthorDate: Wed Nov 30 08:57:50 2022 +0100
Commit: Miklos Vajna 
CommitDate: Wed Nov 30 10:26:06 2022 +0100

libreofficekit: add a way to invoke getCommandValues()

- add a new button to the toolbar to invoke the getCommandValues() LOK
  API with user-provided command name (and parameters)

- log the result using g_info(), which is visible on the console if
  gtktiledviewer is started with G_MESSAGES_DEBUG=all

- change some labels to tooltip texts that actually show up on mouse
  hover so you can understand what button does what

- tweak the icons, so the question mark icon is the getter and the info
  icon is the setter

Change-Id: If6984d2dde3d669b42aafcc3f58a0ca757ccaaff
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143477
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/libreofficekit/qa/gtktiledviewer/gtv-main-toolbar.cxx 
b/libreofficekit/qa/gtktiledviewer/gtv-main-toolbar.cxx
index 84c5335b32c2..a89b8fc7fc72 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-main-toolbar.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-main-toolbar.cxx
@@ -129,6 +129,7 @@ gtv_main_toolbar_init(GtvMainToolbar* toolbar)
 gtk_builder_add_callback_symbol(builder.get(), "getRulerState", 
G_CALLBACK(getRulerState));
 gtk_builder_add_callback_symbol(builder.get(), "recentUnoChanged", 
G_CALLBACK(recentUnoChanged));
 gtk_builder_add_callback_symbol(builder.get(), "unoCommandDebugger", 
G_CALLBACK(unoCommandDebugger));
+gtk_builder_add_callback_symbol(builder.get(), "commandValuesDebugger", 
G_CALLBACK(commandValuesDebugger));
 gtk_builder_add_callback_symbol(builder.get(), "toggleEditing", 
G_CALLBACK(toggleEditing));
 gtk_builder_add_callback_symbol(builder.get(), "changePartMode", 
G_CALLBACK(changePartMode));
 gtk_builder_add_callback_symbol(builder.get(), "changePart", 
G_CALLBACK(changePart));
diff --git a/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx 
b/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx
index 973e2095275a..1f2520162c10 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx
@@ -284,6 +284,41 @@ void unoCommandDebugger(GtkWidget* pButton, gpointer /* 
pItem */)
 gtk_widget_destroy(pUnoCmdDialog);
 }
 
+void commandValuesDebugger(GtkWidget* pButton, gpointer /* pItem */)
+{
+GtvApplicationWindow* window = 
GTV_APPLICATION_WINDOW(gtk_widget_get_toplevel(pButton));
+GtkWidget* pUnoCmdDialog = gtk_dialog_new_with_buttons ("Get command 
values",
+GTK_WINDOW 
(window),
+GTK_DIALOG_MODAL,
+"Execute",
+GTK_RESPONSE_OK,
+nullptr);
+g_object_set(G_OBJECT(pUnoCmdDialog), "resizable", FALSE, nullptr);
+GtkWidget* pDialogMessageArea = gtk_dialog_get_content_area (GTK_DIALOG 
(pUnoCmdDialog));
+GtkWidget* pUnoCmdAreaBox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
+gtk_box_pack_start(GTK_BOX(pDialogMessageArea), pUnoCmdAreaBox, true, 
true, 2);
+
+GtkWidget* pUnoCmdLabel = gtk_label_new("Enter UNO command");
+gtk_box_pack_start(GTK_BOX(pUnoCmdAreaBox), pUnoCmdLabel, true, true, 2);
+
+GtkWidget* pUnoCmdEntry = gtk_entry_new ();
+gtk_box_pack_start(GTK_BOX(pUnoCmdAreaBox), pUnoCmdEntry, true, true, 2);
+gtk_entry_set_placeholder_text(GTK_ENTRY(pUnoCmdEntry), "e.g. .uno:Undo");
+
+gtk_widget_show_all(pUnoCmdDialog);
+
+gint res = gtk_dialog_run (GTK_DIALOG(pUnoCmdDialog));
+if (res == GTK_RESPONSE_OK)
+{
+const gchar* pUnoCmd = gtk_entry_get_text(GTK_ENTRY(pUnoCmdEntry));
+gchar* pValues = 
lok_doc_view_get_command_values(LOK_DOC_VIEW(window->lokdocview), pUnoCmd);
+g_info("lok::Document::getCommandValues(%s) : %s", pUnoCmd, pValues);
+g_free(pValues);
+}
+
+gtk_widget_destroy(pUnoCmdDialog);
+}
+
 void toggleEditing(GtkWidget* pButton, gpointer /*pItem*/)
 {
 GtvApplicationWindow* window = 
GTV_APPLICATION_WINDOW(gtk_widget_get_toplevel(pButton));
diff --git a/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.hxx 
b/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.hxx
index c06017d87414..447b7be8898f 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.hxx
+++ b/libreo

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

2022-10-26 Thread Mike Kaganski (via logerrit)
 libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx |5 
+
 1 file changed, 5 insertions(+)

New commits:
commit 4a8fa1ba2fa5b4e3c95a255c0cb2d45df54aea38
Author: Mike Kaganski 
AuthorDate: Wed Oct 26 17:10:10 2022 +0300
Commit: Mike Kaganski 
CommitDate: Wed Oct 26 16:59:53 2022 +0200

gtktiledviewer: don't crash on sidebar creation

There's no dialog parent for the sidebar child window.
Just ignore the signal for now.

Change-Id: Iadfae9174780b10b94e8dd3e6c9efc8c4e8b4b2b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141878
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git 
a/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx 
b/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx
index 8d1b3eb67e10..520472f201e5 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx
@@ -367,6 +367,11 @@ void LOKDocViewSigHandlers::window(LOKDocView* pDocView, 
gchar* pPayload, gpoint
 {
 const unsigned nParentId = 
std::atoi(aRoot.get("parentId").c_str());
 GtkWindow* pDialog = 
gtv_application_window_get_child_window_by_id(window, nParentId);
+if (!pDialog)
+{
+g_warning("no parent dialog (id: %d) for created child; is 
child a sidebar?", nParentId);
+return;
+}
 const std::string aPos = aRoot.get("position");
 std::vector aPosPoints = GtvHelpers::split(aPos, ", ", 
2);
 gtv_lok_dialog_child_create(GTV_LOK_DIALOG(pDialog), nWinId, 
aPosPoints[0], aPosPoints[1], aSizePoints[0], aSizePoints[1]);


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

2022-10-24 Thread Mike Kaganski (via logerrit)
 libreofficekit/qa/gtktiledviewer/gtv-application-window.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 56b5046e03d2db684fe35239acfea553ff7d9b7f
Author: Mike Kaganski 
AuthorDate: Mon Oct 24 18:13:02 2022 +0200
Commit: Mike Kaganski 
CommitDate: Mon Oct 24 20:01:25 2022 +0200

_MSC_VER is more appropriate to guard MSVC-specific #pragma

Thanks to sberg for noticing this

Change-Id: I37a3031cbfa3f8a0751bab126bd742dcec36664f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141743
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/libreofficekit/qa/gtktiledviewer/gtv-application-window.cxx 
b/libreofficekit/qa/gtktiledviewer/gtv-application-window.cxx
index 32ad84ac116a..ef2f26917b30 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-application-window.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-application-window.cxx
@@ -151,7 +151,7 @@ static void initWindow(GtvApplicationWindow* window)
 #if defined __GNUC__
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-#elif defined _WIN32
+#elif defined _MSC_VER
 #pragma warning(push)
 #pragma warning(disable:4996)
 #endif
@@ -161,7 +161,7 @@ static void initWindow(GtvApplicationWindow* window)
 gtk_container_set_focus_chain ( GTK_CONTAINER (priv->container), 
focusChain );
 #if defined __GNUC__
 #pragma GCC diagnostic pop
-#elif defined _WIN32
+#elif defined _MSC_VER
 #pragma warning(pop)
 #endif
 


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

2022-10-24 Thread Mike Kaganski (via logerrit)
 libreofficekit/qa/gtktiledviewer/gtv-application-window.cxx |9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

New commits:
commit 60b9008d20641b4e454431c148fa8d77c98a75c8
Author: Mike Kaganski 
AuthorDate: Mon Oct 24 13:52:27 2022 +0200
Commit: Mike Kaganski 
CommitDate: Mon Oct 24 17:17:54 2022 +0200

Avoid "deprecated" warning on Windows, too

Change-Id: I199adcb3e8b7fabc625b3ac1735326934cc84088
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141739
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/libreofficekit/qa/gtktiledviewer/gtv-application-window.cxx 
b/libreofficekit/qa/gtktiledviewer/gtv-application-window.cxx
index 7e2f9f907ebf..32ad84ac116a 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-application-window.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-application-window.cxx
@@ -148,16 +148,21 @@ static void initWindow(GtvApplicationWindow* window)
 {
 GtvApplicationWindowPrivate* priv = getPrivate(window);
 
-#ifdef __GNUC__
+#if defined __GNUC__
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#elif defined _WIN32
+#pragma warning(push)
+#pragma warning(disable:4996)
 #endif
 GList *focusChain = nullptr;
 focusChain = g_list_append( focusChain, window->lokdocview );
 
 gtk_container_set_focus_chain ( GTK_CONTAINER (priv->container), 
focusChain );
-#ifdef __GNUC__
+#if defined __GNUC__
 #pragma GCC diagnostic pop
+#elif defined _WIN32
+#pragma warning(pop)
 #endif
 
 // TODO: Implement progressbar in statusbar


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

2022-10-22 Thread Mike Kaganski (via logerrit)
 libreofficekit/qa/gtktiledviewer/gtv-helpers.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit b5acaa1cf36c30ab3cb1a2796ead850598ed233f
Author: Mike Kaganski 
AuthorDate: Sat Oct 22 11:27:23 2022 +0200
Commit: Mike Kaganski 
CommitDate: Sat Oct 22 13:59:05 2022 +0200

g_get_real_name is a proper match for passwd::pw_gecos

This fixes 66fcc9db0f7eacd0ebda06d9ee634af2d0e73d04. Also nullptr check
is added (passing nullptr to std::string ctor taking null-terminated
string is UB).

GLib implementation:

* 
https://gitlab.gnome.org/GNOME/glib/-/blob/476e33c3f3632bd32370fadc67b10d61da9a4098/glib/gutils.c#L743
* 
https://gitlab.gnome.org/GNOME/glib/-/blob/476e33c3f3632bd32370fadc67b10d61da9a4098/glib/gutils.c#L577

Change-Id: I4e36cf836f2889f9aa03167c5ade81c69d9b1dfd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141586
Tested-by: Mike Kaganski 
Reviewed-by: Mike Kaganski 

diff --git a/libreofficekit/qa/gtktiledviewer/gtv-helpers.cxx 
b/libreofficekit/qa/gtktiledviewer/gtv-helpers.cxx
index 109b0946366a..f2c1e9b9351a 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-helpers.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-helpers.cxx
@@ -92,7 +92,9 @@ void GtvHelpers::clipboardSetHtml(GtkClipboard* pClipboard, 
const char* pSelecti
 std::string GtvHelpers::getNextAuthor()
 {
 static int nCounter = 0;
-return std::string(g_get_user_name()) + " #" + std::to_string(++nCounter);
+const gchar* pname = g_get_real_name();
+std::string name = pname ? std::string(pname) : std::string();
+return name + " #" + std::to_string(++nCounter);
 }
 
 GtkWidget* GtvHelpers::createCommentBox(const boost::property_tree::ptree& 
aComment)


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

2022-10-21 Thread Mike Kaganski (via logerrit)
 libreofficekit/qa/gtktiledviewer/gtv-helpers.cxx |5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

New commits:
commit 66fcc9db0f7eacd0ebda06d9ee634af2d0e73d04
Author: Mike Kaganski 
AuthorDate: Fri Oct 21 23:10:00 2022 +0200
Commit: Mike Kaganski 
CommitDate: Sat Oct 22 07:16:49 2022 +0200

Use g_get_user_name instead of access through getpwuid

It is more portable - available also on Windows

Change-Id: I424e1993ad9621ca42b6f48896d5025832ac681e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141584
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/libreofficekit/qa/gtktiledviewer/gtv-helpers.cxx 
b/libreofficekit/qa/gtktiledviewer/gtv-helpers.cxx
index b557fe4ba99b..109b0946366a 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-helpers.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-helpers.cxx
@@ -9,8 +9,6 @@
 
 #include 
 
-#include 
-
 #include 
 
 #include "gtv-helpers.hxx"
@@ -94,8 +92,7 @@ void GtvHelpers::clipboardSetHtml(GtkClipboard* pClipboard, 
const char* pSelecti
 std::string GtvHelpers::getNextAuthor()
 {
 static int nCounter = 0;
-struct passwd* pPasswd = getpwuid(getuid());
-return std::string(pPasswd->pw_gecos) + " #" + std::to_string(++nCounter);
+return std::string(g_get_user_name()) + " #" + std::to_string(++nCounter);
 }
 
 GtkWidget* GtvHelpers::createCommentBox(const boost::property_tree::ptree& 
aComment)


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

2022-09-05 Thread Radhey Parekh (via logerrit)
 libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx |   12 ++--
 oox/source/drawingml/textbodypropertiescontext.cxx   |2 +-
 oox/source/ole/olehelper.cxx |2 +-
 sc/qa/unit/ucalc_sort.cxx|8 
 4 files changed, 12 insertions(+), 12 deletions(-)

New commits:
commit feb8d07333544ff2206489b786b7af30744d014a
Author: Radhey Parekh 
AuthorDate: Mon Aug 22 18:13:15 2022 +0530
Commit: Hossein 
CommitDate: Tue Sep 6 02:26:36 2022 +0200

tdf#147021 Use std::size() instead of SAL_N_ELEMENTS() macro

Change-Id: Ic9009eda963f922fc4d2e75a5002026eda63a7aa
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138686
Tested-by: Jenkins
Reviewed-by: Hossein 

diff --git a/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx 
b/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx
index bb0e7edd390d..973e2095275a 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx
@@ -377,11 +377,11 @@ void changeZoom( GtkWidget* pButton, gpointer /* pItem */ 
)
 
 if ( strcmp(sName, "zoom-in-symbolic") == 0)
 {
-for ( size_t i = 0; i < SAL_N_ELEMENTS( fZooms ); i++ )
+for ( const auto& i : fZooms )
 {
-if ( fCurrentZoom < fZooms[i] )
+if ( fCurrentZoom < i )
 {
-fZoom = fZooms[i];
+fZoom = i;
 break;
 }
 }
@@ -392,11 +392,11 @@ void changeZoom( GtkWidget* pButton, gpointer /* pItem */ 
)
 }
 else if ( strcmp(sName, "zoom-out-symbolic") == 0)
 {
-for ( size_t i = 0; i < SAL_N_ELEMENTS( fZooms ); i++ )
+for ( const auto& i : fZooms )
 {
-if ( fCurrentZoom > fZooms[i] )
+if ( fCurrentZoom > i )
 {
-fZoom = fZooms[i];
+fZoom = i;
 }
 }
 }
diff --git a/oox/source/drawingml/textbodypropertiescontext.cxx 
b/oox/source/drawingml/textbodypropertiescontext.cxx
index bf2feb132e0a..8b1c6db6a791 100644
--- a/oox/source/drawingml/textbodypropertiescontext.cxx
+++ b/oox/source/drawingml/textbodypropertiescontext.cxx
@@ -66,7 +66,7 @@ TextBodyPropertiesContext::TextBodyPropertiesContext( 
ContextHandler2Helper cons
 // ST_Coordinate
 OUString sValue;
 sal_Int32 aIns[] = { XML_lIns, XML_tIns, XML_rIns, XML_bIns };
-for( sal_Int32 i = 0; i < sal_Int32(SAL_N_ELEMENTS( aIns )); i++)
+for( sal_Int32 i = 0; i < sal_Int32(std::size( aIns )); i++)
 {
 sValue = rAttribs.getStringDefaulted( aIns[i] );
 if( !sValue.isEmpty() )
diff --git a/oox/source/ole/olehelper.cxx b/oox/source/ole/olehelper.cxx
index f3f73b52f5ed..d953cf17f9da 100644
--- a/oox/source/ole/olehelper.cxx
+++ b/oox/source/ole/olehelper.cxx
@@ -172,7 +172,7 @@ classIdToGUIDCNamePairMap::classIdToGUIDCNamePairMap()
  { AX_GUID_SCROLLBAR, "ScrollBar"},
 }
 };
-int const length = SAL_N_ELEMENTS( initialCntrlData );
+int const length = std::size( initialCntrlData );
 IdCntrlData const * pData = initialCntrlData;
 for ( int index = 0; index < length; ++index, ++pData )
 mnIdToGUIDCNamePairMap[ pData->nId ] = pData->aData;
diff --git a/sc/qa/unit/ucalc_sort.cxx b/sc/qa/unit/ucalc_sort.cxx
index 0f0218753403..21b734d1d37c 100644
--- a/sc/qa/unit/ucalc_sort.cxx
+++ b/sc/qa/unit/ucalc_sort.cxx
@@ -487,7 +487,7 @@ void TestSort::testSortWithFormulaRefs()
 m_pDoc->SetString( 0, i, 0, OUString::createFromAscii(aTextData[i-1]) 
);
 
 // Insert formulas in A1:A6 on the 2nd sheet.
-for (size_t i = 0; i < SAL_N_ELEMENTS(aFormulaData); ++i)
+for (size_t i = 0; i < std::size(aFormulaData); ++i)
 m_pDoc->SetString( 0, i, 1, OUString::createFromAscii(aFormulaData[i]) 
);
 
 // Sort data in A2:A8 on the 1st sheet. No column header.
@@ -501,7 +501,7 @@ void TestSort::testSortWithFormulaRefs()
 
 m_pDoc->Sort(0, aSortData, false, true, nullptr, nullptr);
 
-for (size_t i = 0; i < SAL_N_ELEMENTS(aResults); ++i)
+for (size_t i = 0; i < std::size(aResults); ++i)
 {
 OUString sResult = m_pDoc->GetString(0, i + 1, 0);
 CPPUNIT_ASSERT_EQUAL( OUString::createFromAscii( aResults[i] ), 
sResult );
@@ -602,7 +602,7 @@ void TestSort::testSortInFormulaGroup()
 104.0, 104.0
 };
 
-for ( SCROW i = 0; i < SCROW(SAL_N_ELEMENTS( aEntries )); ++i )
+for ( SCROW i = 0; i < SCROW(std::size( aEntries )); ++i )
 {
 double val = m_pDoc->GetValue( aEntries[i].nCol, aEntries[i].nRow, 0 );
 CPPUNIT_ASSERT_MESSAGE("Mis-matching value after sort.",
@@ -790,7 +790,7 @@ void TestSort::testSortRefUpdate()
 m_pDoc->SetString(ScAddress(0,0,0), "Header");
 
 double aValues[] = { 4.0, 36.0, 14.0, 29.0, 98.0, 78.0, 0.0, 99.0, 1.0 };
-size_t nCount = SAL_N_ELEMENTS(aValues);
+size_t nCo

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

2022-06-22 Thread Noel Grandin (via logerrit)
 libreofficekit/qa/gtktiledviewer/gtv-calc-header-bar.cxx |5 +++--
 libreofficekit/source/gtk/lokdocview.cxx |5 +++--
 2 files changed, 6 insertions(+), 4 deletions(-)

New commits:
commit 154cffd87ee4a21b5c0c291f84c95d74cde2a143
Author: Noel Grandin 
AuthorDate: Wed Jun 22 09:11:15 2022 +0200
Commit: Noel Grandin 
CommitDate: Thu Jun 23 08:53:17 2022 +0200

clang-tidy modernize-pass-by-value in libreofficekit

Change-Id: I1a6b4eb804a8cc4eb5e67ae4bbf8f31863f323d7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136273
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/libreofficekit/qa/gtktiledviewer/gtv-calc-header-bar.cxx 
b/libreofficekit/qa/gtktiledviewer/gtv-calc-header-bar.cxx
index dc106e58dcb4..22aadbe2f337 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-calc-header-bar.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-calc-header-bar.cxx
@@ -16,6 +16,7 @@
 
 #include 
 #include 
+#include 
 
 namespace {
 
@@ -26,9 +27,9 @@ struct GtvCalcHeaderBarPrivateImpl
 {
 int m_nSize;
 std::string m_aText;
-Header(int nSize, const std::string& rText)
+Header(int nSize, std::string aText)
 : m_nSize(nSize),
-  m_aText(rText)
+  m_aText(std::move(aText))
 { }
 };
 
diff --git a/libreofficekit/source/gtk/lokdocview.cxx 
b/libreofficekit/source/gtk/lokdocview.cxx
index 39f2281b0c7d..a092a1dbf1ab 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -11,6 +11,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -358,9 +359,9 @@ struct CallbackData
 std::string m_aPayload;
 LOKDocView* m_pDocView;
 
-CallbackData(int nType, const std::string& rPayload, LOKDocView* pDocView)
+CallbackData(int nType, std::string aPayload, LOKDocView* pDocView)
 : m_nType(nType),
-  m_aPayload(rPayload),
+  m_aPayload(std::move(aPayload)),
   m_pDocView(pDocView) {}
 };
 


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

2021-11-10 Thread Stephan Bergmann (via logerrit)
 libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 8e08fb9476c1b13937ac6d1148b7f675a2e327ad
Author: Stephan Bergmann 
AuthorDate: Wed Nov 10 12:46:49 2021 +0100
Commit: Stephan Bergmann 
CommitDate: Wed Nov 10 14:36:39 2021 +0100

Avoid -Werror=maybe-uninitialized

...with recent GCC 12 trunk,

> libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx:194:31: error: 
‘unoParam’ may be used uninitialized [-Werror=maybe-uninitialized]
>   194 | gchar* pPath = g_strconcat(unoParam[1], "/", "type", nullptr);
>   |~~~^~~

Change-Id: Ia7ac20ac63b995e8f4a8b4c79447799972639588
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124961
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx 
b/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx
index be7cd4445536..e7208e5860a3 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx
@@ -16,6 +16,7 @@
 
 #include 
 
+#include 
 #include 
 #include 
 
@@ -186,8 +187,9 @@ static void iterateUnoParams(GtkWidget* pWidget, gpointer 
userdata)
 GList* pIt = nullptr;
 guint i = 0;
 const gchar* unoParam[3];
-for (pIt = pChildren.get(), i = 0; pIt != nullptr && i < 3; pIt = 
pIt->next, i++)
+for (pIt = pChildren.get(), i = 0; i < 3; pIt = pIt->next, i++)
 {
+assert(pIt != nullptr);
 unoParam[i] = gtk_entry_get_text(GTK_ENTRY(pIt->data));
 }
 


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

2021-03-21 Thread Caolán McNamara (via logerrit)
 libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx |   42 +++
 1 file changed, 22 insertions(+), 20 deletions(-)

New commits:
commit 4efc4a43ff481661990b304f9599f811db39f7dc
Author: Caolán McNamara 
AuthorDate: Sat Mar 20 20:11:25 2021 +
Commit: Caolán McNamara 
CommitDate: Sun Mar 21 15:33:20 2021 +0100

cid#1474277 Resource leak

and...

cid#1474319 Resource leak
cid#1473965 Resource leak
cid#1474109 Resource leak
cid#1474179 Resource leak

Change-Id: I7daba2a0173a7fe7a912c0febf7957667f0fae83
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112822
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx 
b/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx
index fef712ceef0a..be7cd4445536 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx
@@ -38,8 +38,8 @@ void btn_clicked(GtkWidget* pButton, gpointer)
 GtvHelpers::userPromptDialog(GTK_WINDOW(window), "Insert Comment", 
aEntries);
 
 boost::property_tree::ptree aTree;
-aTree.put(boost::property_tree::ptree::path_type(g_strconcat("Text", 
"/", "type", nullptr), '/'), "string");
-aTree.put(boost::property_tree::ptree::path_type(g_strconcat("Text", 
"/", "value", nullptr), '/'), aEntries["Text"]);
+aTree.put(boost::property_tree::ptree::path_type("Text/type", '/'), 
"string");
+aTree.put(boost::property_tree::ptree::path_type("Text/value", '/'), 
aEntries["Text"]);
 
 std::stringstream aStream;
 boost::property_tree::write_json(aStream, aTree);
@@ -191,8 +191,12 @@ static void iterateUnoParams(GtkWidget* pWidget, gpointer 
userdata)
 unoParam[i] = gtk_entry_get_text(GTK_ENTRY(pIt->data));
 }
 
-pTree->put(boost::property_tree::ptree::path_type(g_strconcat(unoParam[1], 
"/", "type", nullptr), '/'), unoParam[0]);
-pTree->put(boost::property_tree::ptree::path_type(g_strconcat(unoParam[1], 
"/", "value", nullptr), '/'), unoParam[2]);
+gchar* pPath = g_strconcat(unoParam[1], "/", "type", nullptr);
+pTree->put(boost::property_tree::ptree::path_type(pPath, '/'), 
unoParam[0]);
+g_free(pPath);
+pPath = g_strconcat(unoParam[1], "/", "value", nullptr);
+pTree->put(boost::property_tree::ptree::path_type(pPath, '/'), 
unoParam[2]);
+g_free(pPath);
 }
 
 void recentUnoChanged( GtkWidget* pSelector, gpointer /* pItem */ )
@@ -256,11 +260,9 @@ void unoCommandDebugger(GtkWidget* pButton, gpointer /* 
pItem */)
 gtk_widget_show_all(pUnoCmdDialog);
 
 gint res = gtk_dialog_run (GTK_DIALOG(pUnoCmdDialog));
-switch (res)
-{
-case GTK_RESPONSE_OK:
+if (res == GTK_RESPONSE_OK)
 {
-const gchar* sUnoCmd = g_strconcat(".uno:", 
gtk_entry_get_text(GTK_ENTRY(pUnoCmdEntry)), nullptr);
+gchar* sUnoCmd = g_strconcat(".uno:", 
gtk_entry_get_text(GTK_ENTRY(pUnoCmdEntry)), nullptr);
 
 boost::property_tree::ptree aTree;
 gtk_container_foreach(GTK_CONTAINER(pUnoParamAreaBox), 
iterateUnoParams, &aTree);
@@ -273,8 +275,8 @@ void unoCommandDebugger(GtkWidget* pButton, gpointer /* 
pItem */)
 
 lok_doc_view_post_command(LOK_DOC_VIEW(window->lokdocview), sUnoCmd, 
(aArguments.empty() ? nullptr : aArguments.c_str()), false);
 addToRecentUnoCommands(window, sUnoCmd, aArguments);
-}
-break;
+
+g_free(sUnoCmd);
 }
 
 gtk_widget_destroy(pUnoCmdDialog);
@@ -649,11 +651,11 @@ void editButtonClicked(GtkWidget* pWidget, gpointer 
userdata)
 gchar *commentId = 
static_cast(g_object_get_data(G_OBJECT(userdata), "id"));
 
 boost::property_tree::ptree aTree;
-aTree.put(boost::property_tree::ptree::path_type(g_strconcat("Id", "/", 
"type", nullptr), '/'), "string");
-aTree.put(boost::property_tree::ptree::path_type(g_strconcat("Id", "/", 
"value", nullptr), '/'), std::string(commentId));
+aTree.put(boost::property_tree::ptree::path_type("Id/type", '/'), 
"string");
+aTree.put(boost::property_tree::ptree::path_type("Id/value", '/'), 
std::string(commentId));
 
-aTree.put(boost::property_tree::ptree::path_type(g_strconcat("Text", "/", 
"type", nullptr), '/'), "string");
-aTree.put(boost::property_tree::ptree::path_type(g_strconcat("Text", "/", 
"value", nullptr), '/'), aEntries["Text"]);
+aTree.put(boost::property_tree::ptree::path_type("Text/type", '/'), 
"string");
+aTree.put(boost::property_tree::ptree::path_type("Text/value", '/'), 
aEntries["Text"]);
 
 std::stringstream aStream;
 boost::property_tree::write_json(aStream, aTree);
@@ -673,11 +675,11 @@ void replyButtonClicked(GtkWidget* pWidget, gpointer 
userdata)
 gchar *commentId = 
static_cast(g_object_get_data(G_OBJECT(userdata), "id"));
 
 boost::property_tree::ptree aTree;
-aTree.put(boost::property_tree::ptree::path_type(g_strconcat("Id", "/", 
"t

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

2020-12-09 Thread Stephan Bergmann (via logerrit)
 libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 8acadd0430f5789545b4a1af789780814f2e1247
Author: Stephan Bergmann 
AuthorDate: Wed Dec 9 15:54:55 2020 +0100
Commit: Stephan Bergmann 
CommitDate: Wed Dec 9 17:19:32 2020 +0100

Missing include (definition of std::stringstream)

Regression introduced with 877f40ac3f2add2b6dc37bae280d4d98dd102286 
"tdf#42949
Fix new IWYU warnings in directories [h-r]*".

Change-Id: I8a86f5764ebe8c876ed6d6b144c87c005abefdb4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107472
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx 
b/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx
index bb70a15159d1..a67d3427eae5 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx
@@ -11,6 +11,7 @@
 #include 
 
 #include 
+#include 
 
 #include 
 #include 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: libreofficekit/qa libreofficekit/source solenv/clang-format

2020-11-19 Thread Philipp Hofer (via logerrit)
 libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.hxx |   10 +++
 libreofficekit/qa/unit/compile_test.c|5 ---
 libreofficekit/source/gtk/tilebuffer.hxx |   21 +--
 solenv/clang-format/excludelist  |3 --
 4 files changed, 19 insertions(+), 20 deletions(-)

New commits:
commit 39821e7d24deffa72bd9254414d4b58f22be2fca
Author: Philipp Hofer 
AuthorDate: Thu Nov 12 13:05:19 2020 +0100
Commit: Christian Lohmaier 
CommitDate: Thu Nov 19 10:43:43 2020 +0100

tdf#123936 Formatting files in module libreofficekit with clang-format

Change-Id: I3f086de3a49181d32e54d7d58e1206615a9371e3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105687
Tested-by: Jenkins
Reviewed-by: Christian Lohmaier 

diff --git a/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.hxx 
b/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.hxx
index bddf5c29e625..a441d4e13bf5 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.hxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.hxx
@@ -22,19 +22,19 @@ void createView(GtkWidget* pButton, gpointer /*pItem*/);
 
 void getRulerState(GtkWidget* pButton, gpointer /*pItem*/);
 
-void recentUnoChanged( GtkWidget* pSelector, gpointer /* pItem */ );
+void recentUnoChanged(GtkWidget* pSelector, gpointer /* pItem */);
 
 void unoCommandDebugger(GtkWidget* pButton, gpointer /* pItem */);
 
 void toggleEditing(GtkWidget* pButton, gpointer /*pItem*/);
 
-void changePartMode( GtkWidget* pSelector, gpointer /* pItem */ );
+void changePartMode(GtkWidget* pSelector, gpointer /* pItem */);
 
-void changePart( GtkWidget* pSelector, gpointer /*pItem*/ );
+void changePart(GtkWidget* pSelector, gpointer /*pItem*/);
 
-void openLokDialog( GtkWidget* pSelector, gpointer /*pItem*/ );
+void openLokDialog(GtkWidget* pSelector, gpointer /*pItem*/);
 
-void changeZoom( GtkWidget* pButton, gpointer /* pItem */ );
+void changeZoom(GtkWidget* pButton, gpointer /* pItem */);
 
 void toggleFindbar(GtkWidget* pButton, gpointer /*pItem*/);
 
diff --git a/libreofficekit/qa/unit/compile_test.c 
b/libreofficekit/qa/unit/compile_test.c
index bf0b1e5f1824..650718efaab2 100644
--- a/libreofficekit/qa/unit/compile_test.c
+++ b/libreofficekit/qa/unit/compile_test.c
@@ -15,9 +15,6 @@
 #include "test.h"
 
 // just make sure this stuff compiles from a plain C file
-LibreOfficeKit* compile_test(void)
-{
-return lok_init("install/path");
-}
+LibreOfficeKit* compile_test(void) { return lok_init("install/path"); }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/libreofficekit/source/gtk/tilebuffer.hxx 
b/libreofficekit/source/gtk/tilebuffer.hxx
index 9e7203b3bd69..79fa48c555db 100644
--- a/libreofficekit/source/gtk/tilebuffer.hxx
+++ b/libreofficekit/source/gtk/tilebuffer.hxx
@@ -54,8 +54,12 @@ GQuark LOKTileBufferErrorQuark(void);
 */
 class Tile
 {
- public:
-Tile() : valid(false), m_pBuffer(nullptr) {}
+public:
+Tile()
+: valid(false)
+, m_pBuffer(nullptr)
+{
+}
 ~Tile()
 {
 if (m_pBuffer)
@@ -75,7 +79,7 @@ class Tile
 
 private:
 /// Pixel buffer data for this tile
-cairo_surface_t *m_pBuffer;
+cairo_surface_t* m_pBuffer;
 };
 
 /**
@@ -87,11 +91,12 @@ private:
 */
 class TileBuffer
 {
- public:
- TileBuffer(int columns = 0, int scale = 1)
- : m_nWidth(columns)
+public:
+TileBuffer(int columns = 0, int scale = 1)
+: m_nWidth(columns)
 {
-cairo_surface_t *pSurface = 
cairo_image_surface_create(CAIRO_FORMAT_ARGB32, nTileSizePixels * scale, 
nTileSizePixels * scale);
+cairo_surface_t* pSurface = cairo_image_surface_create(
+CAIRO_FORMAT_ARGB32, nTileSizePixels * scale, nTileSizePixels * 
scale);
 m_DummyTile.setSurface(pSurface);
 cairo_surface_destroy(pSurface);
 }
@@ -118,7 +123,7 @@ class TileBuffer
 /*
   Takes ownership of the surface and sets it on a tile at a given location
 */
-void  setTile(int x, int y, cairo_surface_t *surface);
+void setTile(int x, int y, cairo_surface_t* surface);
 
 /// Returns true if a valid tile exists at this location
 bool hasValidTile(int x, int y);
diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist
index ec3e954aacd4..c5a0601d11ba 100644
--- a/solenv/clang-format/excludelist
+++ b/solenv/clang-format/excludelist
@@ -7282,13 +7282,10 @@ 
libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.hxx
 libreofficekit/qa/gtktiledviewer/gtv-main-toolbar.cxx
 libreofficekit/qa/gtktiledviewer/gtv-main-toolbar.hxx
 libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx
-libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.hxx
 libreofficekit/qa/tilebench/tilebench.cxx
-libreofficekit/qa/unit/compile_test.c
 libreofficekit/qa/unit/tiledrendering.cxx
 libreofficekit/source/gtk/lokdocview.cxx
 libreofficekit/source/gtk/tilebuffer.cxx
-libreofficekit/source/gtk

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

2020-11-04 Thread Caolán McNamara (via logerrit)
 libreofficekit/qa/tilebench/tilebench.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 6fe5d7dfb27d5c282dc5bb59caa530ff47ab706b
Author: Caolán McNamara 
AuthorDate: Wed Nov 4 09:15:08 2020 +
Commit: Caolán McNamara 
CommitDate: Wed Nov 4 18:00:42 2020 +0100

silence qa test coverity warning

Change-Id: Ic25815921360bb5899bf5d452ce77dd9b99fee03
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105281
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/libreofficekit/qa/tilebench/tilebench.cxx 
b/libreofficekit/qa/tilebench/tilebench.cxx
index 978b7aa5eaa0..6b6dcf4056a4 100644
--- a/libreofficekit/qa/tilebench/tilebench.cxx
+++ b/libreofficekit/qa/tilebench/tilebench.cxx
@@ -630,6 +630,7 @@ int main( int argc, char* argv[] )
 int max_tiles = (argc > arg ? atoi(argv[arg++]) : -1);
 const bool dump = true;
 
+// coverity[tainted_data] - we trust the contents of this variable
 testTile (pDocument.get(), max_parts, max_tiles, dump);
 }
 else if (!strcmp(mode, "--join"))
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-09-04 Thread Tor Lillqvist (via logerrit)
 libreofficekit/qa/unit/tiledrendering.cxx |1 -
 1 file changed, 1 deletion(-)

New commits:
commit 052cf89f2fc3f32150d0f6dbcbc859a127fa595b
Author: Tor Lillqvist 
AuthorDate: Fri Sep 4 11:30:09 2020 +0300
Commit: Tor Lillqvist 
CommitDate: Fri Sep 4 13:10:33 2020 +0200

Remove an odd CPPUNIT_ASSERT(0)

The unit test that code is in isn't even run currently (commented out
in Module_libreofficekit.mk), so no harm in not making it fail
intentionally. (The commit message of the commit that added the test
with the intentionally always failing assertion does not tell what the
idea was.)

Change-Id: I93407723ce10c77366e6f7f96df93d86f214f497
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102030
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist 

diff --git a/libreofficekit/qa/unit/tiledrendering.cxx 
b/libreofficekit/qa/unit/tiledrendering.cxx
index d0c128fb3a34..ee935cf82cdb 100644
--- a/libreofficekit/qa/unit/tiledrendering.cxx
+++ b/libreofficekit/qa/unit/tiledrendering.cxx
@@ -447,7 +447,6 @@ void TiledRenderingTest::testMultiKeyInput(Office *pOffice)
 // get track changes ?
 char *values = pDocument->getCommandValues(".uno:AcceptTrackedChanges");
 std::cerr << "Values: '" << values << "'\n";
-CPPUNIT_ASSERT(0);
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(TiledRenderingTest);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-08-11 Thread Stephan Bergmann (via logerrit)
 libreofficekit/qa/gtktiledviewer/gtv-helpers.hxx|1 +
 libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx |1 +
 2 files changed, 2 insertions(+)

New commits:
commit db1c992f08668558777f157ee566f0e4772abdd4
Author: Stephan Bergmann 
AuthorDate: Wed Aug 12 07:35:36 2020 +0200
Commit: Stephan Bergmann 
CommitDate: Wed Aug 12 08:29:23 2020 +0200

Missing includes

...found when building against LLVM 12 trunk libc++ on Linux

Change-Id: Iea8e623222940ed3d3e5830706a4538558ecf418
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100571
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/libreofficekit/qa/gtktiledviewer/gtv-helpers.hxx 
b/libreofficekit/qa/gtktiledviewer/gtv-helpers.hxx
index c4a4f4130695..4b304ab895cd 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-helpers.hxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-helpers.hxx
@@ -15,6 +15,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
diff --git a/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx 
b/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx
index bb70a15159d1..a67d3427eae5 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx
@@ -11,6 +11,7 @@
 #include 
 
 #include 
+#include 
 
 #include 
 #include 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-07-20 Thread Tor Lillqvist (via logerrit)
 libreofficekit/qa/tilebench/tilebench.cxx |7 +++
 1 file changed, 7 insertions(+)

New commits:
commit 06ca0ae15f2c467cb69561c43779cc09d5666227
Author: Tor Lillqvist 
AuthorDate: Mon Jul 20 10:44:16 2020 +0300
Commit: Tor Lillqvist 
CommitDate: Mon Jul 20 13:14:46 2020 +0200

We apparently need to call Application::Quit() on iOS now

(This file is included in ios/UnitTest/UnitTest/ViewController.mm.)

Change-Id: I79170785db43d9bdb3aca6f500161862eb6a111b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99028
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Tor Lillqvist 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99031
Tested-by: Jenkins

diff --git a/libreofficekit/qa/tilebench/tilebench.cxx 
b/libreofficekit/qa/tilebench/tilebench.cxx
index f2fbd1752c75..8f06cc16b2fd 100644
--- a/libreofficekit/qa/tilebench/tilebench.cxx
+++ b/libreofficekit/qa/tilebench/tilebench.cxx
@@ -20,6 +20,10 @@
 #include 
 #include 
 
+#ifdef IOS
+#include 
+#endif
+
 #include 
 
 using namespace lok;
@@ -654,6 +658,9 @@ int main( int argc, char* argv[] )
 return help ("unknown parameter");
 }
 
+#ifdef IOS
+Application::Quit();
+#endif
 aTimes.emplace_back("destroy document");
 pDocument.reset();
 aTimes.emplace_back();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-07-01 Thread Stephan Bergmann (via logerrit)
 libreofficekit/qa/gtktiledviewer/gtv-calc-header-bar.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit c4304e8ad97db57b3aaa4889be71e08d8992c189
Author: Stephan Bergmann 
AuthorDate: Wed Jul 1 11:08:28 2020 +0200
Commit: Stephan Bergmann 
CommitDate: Wed Jul 1 13:27:53 2020 +0200

Upcoming improved loplugin:staticanonymous -> redundantstatic: 
libreofficekit

Change-Id: I113905b8e13f65f48529969fb93e66074dc6407d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97601
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/libreofficekit/qa/gtktiledviewer/gtv-calc-header-bar.cxx 
b/libreofficekit/qa/gtktiledviewer/gtv-calc-header-bar.cxx
index 794d157667bc..dc106e58dcb4 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-calc-header-bar.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-calc-header-bar.cxx
@@ -65,8 +65,8 @@ G_DEFINE_TYPE_WITH_PRIVATE(GtvCalcHeaderBar, 
gtv_calc_header_bar, GTK_TYPE_DRAWI
 #endif
 #endif
 
-static const int ROW_HEADER_WIDTH = 50;
-static const int COLUMN_HEADER_HEIGHT = 20;
+const int ROW_HEADER_WIDTH = 50;
+const int COLUMN_HEADER_HEIGHT = 20;
 
 static GtvCalcHeaderBarPrivate&
 getPrivate(GtvCalcHeaderBar* headerbar)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-05-28 Thread Tor Lillqvist (via logerrit)
 libreofficekit/qa/gtktiledviewer/gtv-application.cxx |   17 ++---
 1 file changed, 10 insertions(+), 7 deletions(-)

New commits:
commit fb2045ee7f113b9f6252b216ebb17544e730c410
Author: Tor Lillqvist 
AuthorDate: Wed May 27 18:08:20 2020 +0300
Commit: Tor Lillqvist 
CommitDate: Thu May 28 10:37:49 2020 +0200

Make gtktiledviewer accept multiple documents to open

It doesn't really work that well, though. With the right combination
of different kinds of documents on the command line, it will even
crash.

Change-Id: Iccab34a714288fd04c52a21881b6256cfcb86081
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94980
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist 

diff --git a/libreofficekit/qa/gtktiledviewer/gtv-application.cxx 
b/libreofficekit/qa/gtktiledviewer/gtv-application.cxx
index 8b54b7f951f9..4268d4e1962a 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-application.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-application.cxx
@@ -51,15 +51,18 @@ gtv_application_activate(GApplication*)
 }
 
 static void
-gtv_application_open(GApplication* app, GFile** file, gint /*nFiles*/, const 
gchar* /*hint*/)
+gtv_application_open(GApplication* app, GFile** file, gint nFiles, const 
gchar* /*hint*/)
 {
-// TODO: add some option to create a new view for existing document
-// For now, this just opens a new document
-GtvApplicationWindow* window = 
GTV_APPLICATION_WINDOW(gtv_application_window_new(GTK_APPLICATION(app)));
-gtk_window_present(GTK_WINDOW(window));
+for (gint i = 0; i < nFiles; i++)
+{
+// TODO: add some option to create a new view for existing document
+// For now, this just opens a new document
+GtvApplicationWindow* window = 
GTV_APPLICATION_WINDOW(gtv_application_window_new(GTK_APPLICATION(app)));
+gtk_window_present(GTK_WINDOW(window));
 
-GtvApplicationPrivate* priv = getPrivate(GTV_APPLICATION(app));
-gtv_application_window_load_document(window, priv->m_pRenderingArgs, 
std::string(g_file_get_path(file[0])));
+GtvApplicationPrivate* priv = getPrivate(GTV_APPLICATION(app));
+gtv_application_window_load_document(window, priv->m_pRenderingArgs, 
std::string(g_file_get_path(file[i])));
+}
 }
 
 static void
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2019-12-09 Thread Stephan Bergmann (via logerrit)
 libreofficekit/qa/gtktiledviewer/gtv-calc-header-bar.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 9631f5d35d1870faf4ca2a19fe30b827a1f59905
Author: Stephan Bergmann 
AuthorDate: Mon Dec 9 15:13:59 2019 +0100
Commit: Stephan Bergmann 
CommitDate: Mon Dec 9 16:25:00 2019 +0100

Prefer O3TL_UNREACHABLE over assert(false)

...so that -Werror=maybe-uninitialized is also silenced (cf.
281f3d5c418e50a2858619633ebca290bd626c03 "Silence 
-Werror=maybe-uninitialized")
with --disable-assert-always-abort

Change-Id: Ie31e18d27823b061375a0740b85bec95740bbecd
Reviewed-on: https://gerrit.libreoffice.org/84752
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/libreofficekit/qa/gtktiledviewer/gtv-calc-header-bar.cxx 
b/libreofficekit/qa/gtktiledviewer/gtv-calc-header-bar.cxx
index 10b9de01d9a0..43037b5059f5 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-calc-header-bar.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-calc-header-bar.cxx
@@ -9,7 +9,6 @@
 
 #include 
 
-#include 
 #include 
 #include 
 
@@ -21,6 +20,7 @@
 #include 
 #include 
 #include 
+#include 
 
 namespace {
 
@@ -150,7 +150,7 @@ static bool gtv_calc_header_bar_draw_impl(GtkWidget* 
pWidget, cairo_t* pCairo)
 }
 else
 {
-assert(false); // should never happen
+O3TL_UNREACHABLE; // should never happen
 }
 
 gtv_calc_header_bar_draw_text(pCairo, aRectangle, rHeader.m_aText);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-12-04 Thread Stephan Bergmann (via logerrit)
 libreofficekit/qa/gtktiledviewer/gtv-calc-header-bar.cxx |5 +
 1 file changed, 5 insertions(+)

New commits:
commit 281f3d5c418e50a2858619633ebca290bd626c03
Author: Stephan Bergmann 
AuthorDate: Wed Dec 4 16:51:28 2019 +0100
Commit: Stephan Bergmann 
CommitDate: Wed Dec 4 20:10:38 2019 +0100

Silence -Werror=maybe-uninitialized

...where the members of aRectangle passed into gtv_calc_header_bar_draw_text
(and unconditionally used there, see the definition further up in this 
file) are
only set for ROW and COLUMN types.  Lets assume that no other types can 
happen
here?  (This is part of libreofficekit/Executable_gtktiledviewer.mk, see
libreofficekit/README for how to execute it.)

Change-Id: I487be241e564127183751758710140ab24941f63
Reviewed-on: https://gerrit.libreoffice.org/84424
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/libreofficekit/qa/gtktiledviewer/gtv-calc-header-bar.cxx 
b/libreofficekit/qa/gtktiledviewer/gtv-calc-header-bar.cxx
index a332d9608551..10b9de01d9a0 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-calc-header-bar.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-calc-header-bar.cxx
@@ -9,6 +9,7 @@
 
 #include 
 
+#include 
 #include 
 #include 
 
@@ -147,6 +148,10 @@ static bool gtv_calc_header_bar_draw_impl(GtkWidget* 
pWidget, cairo_t* pCairo)
 cairo_rectangle(pCairo, aRectangle.x, aRectangle.height, 
aRectangle.width, 1);
 cairo_fill(pCairo);
 }
+else
+{
+assert(false); // should never happen
+}
 
 gtv_calc_header_bar_draw_text(pCairo, aRectangle, rHeader.m_aText);
 nPrevious = rHeader.m_nSize;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-11-09 Thread Michael Meeks (via logerrit)
 libreofficekit/qa/data/join/calc-object-offset.ods |binary
 libreofficekit/qa/tilebench/tilebench.cxx  |   63 +++--
 2 files changed, 46 insertions(+), 17 deletions(-)

New commits:
commit 658925635262d21f93bedcc6dfeaa934cbcef1cf
Author: Michael Meeks 
AuthorDate: Sat Nov 9 17:47:28 2019 +
Commit: Michael Meeks 
CommitDate: Sat Nov 9 21:12:49 2019 +0100

lok: tilebench: slightly sloppy pixel comparison & larger area.

Change-Id: Ief9d4bc5ce0e83a9eb9564cb94f773a3ff6048ba
Reviewed-on: https://gerrit.libreoffice.org/82357
Tested-by: Jenkins
Reviewed-by: Michael Meeks 

diff --git a/libreofficekit/qa/data/join/calc-object-offset.ods 
b/libreofficekit/qa/data/join/calc-object-offset.ods
new file mode 100644
index ..b86ef3107449
Binary files /dev/null and b/libreofficekit/qa/data/join/calc-object-offset.ods 
differ
diff --git a/libreofficekit/qa/tilebench/tilebench.cxx 
b/libreofficekit/qa/tilebench/tilebench.cxx
index f5dccf81affa..2a8142de9a7c 100644
--- a/libreofficekit/qa/tilebench/tilebench.cxx
+++ b/libreofficekit/qa/tilebench/tilebench.cxx
@@ -259,6 +259,31 @@ static uint32_t fade(uint32_t col)
 return (a<<24) + (grey<<16) + (grey<<8) + grey;
 }
 
+static bool sloppyEqual(uint32_t pixA, uint32_t pixB)
+{
+uint8_t a[4], b[4];
+
+a[0] = (pixA >> 24) & 0xff;
+a[1] = (pixA >> 16) & 0xff;
+a[2] = (pixA >>  8) & 0xff;
+a[3] = (pixA >>  0) & 0xff;
+
+b[0] = (pixB >> 24) & 0xff;
+b[1] = (pixB >> 16) & 0xff;
+b[2] = (pixB >>  8) & 0xff;
+b[3] = (pixB >>  0) & 0xff;
+
+for (int i = 0; i < 4; ++i)
+{
+int delta = a[i];
+delta -= b[i];
+// tolerate small differences
+if (delta < -4 || delta > 4)
+return false;
+}
+return true;
+}
+
 // Count and build a picture of any differences into rDiff
 static int diffTiles( const std::vector &vBase,
long nBaseRowPixelWidth,
@@ -283,7 +308,7 @@ static int diffTiles( const std::vector 
&vBase,
 pDiff[nDiffRowStart + left  + x] = pBase[nBaseOffset + x];
 pDiff[nDiffRowStart + mid   + x] = pCompare[nCompareOffset + x];
 pDiff[nDiffRowStart + right + x] = fade(pBase[nBaseOffset + x]);
-if (pBase[nBaseOffset + x] != pCompare[nCompareOffset + x])
+if (!sloppyEqual(pBase[nBaseOffset + x], pCompare[nCompareOffset + 
x]))
 {
 pDiff[nDiffRowStart + right + x] = 0x00ff;
 if (!nDifferent)
@@ -310,9 +335,9 @@ static std::vector paintTile( Document 
*pDocument,
 return vData;
 }
 
-static bool testJoinsAt( Document *pDocument, long nX, long nY,
- long const nTilePixelSize,
- long const nTileTwipSize )
+static int testJoinsAt( Document *pDocument, long nX, long nY,
+long const nTilePixelSize,
+long const nTileTwipSize )
 {
 const int mode = pDocument->getTileMode();
 
@@ -352,6 +377,7 @@ static bool testJoinsAt( Document *pDocument, long nX, long 
nY,
 { 1, 1 }
 };
 
+int nDifferences = 0;
 // Compare each of the 4x tiles with a sub-tile of the larger image
 for( auto &rPos : aCompare )
 {
@@ -363,15 +389,15 @@ static bool testJoinsAt( Document *pDocument, long nX, 
long nY,
   nTileTwipWidth, nTileTwipHeight));
 
 std::vector vDiff( nTilePixelWidth * 3 * 
nTilePixelHeight * 4 );
-int nDifferences = diffTiles( vBase, nTilePixelWidth * 2,
-  vCompare, nTilePixelWidth,
-  nTilePixelHeight,
-  rPos.X, rPos.Y * nTilePixelHeight,
-  vDiff );
-if ( nDifferences > 0 )
+int nDiffs = diffTiles( vBase, nTilePixelWidth * 2,
+vCompare, nTilePixelWidth,
+nTilePixelHeight,
+rPos.X, rPos.Y * nTilePixelHeight,
+vDiff );
+if ( nDiffs > 0 )
 {
 fprintf( stderr, "  %d differences in sub-tile pixel mismatch at 
%ld, %ld at offset %ld, %ld (twips) size %ld\n",
- nDifferences, rPos.X, rPos.Y, initPosX, initPosY,
+ nDiffs, rPos.X, rPos.Y, initPosX, initPosY,
  nTileTwipWidth);
 dumpTile("_base", nTilePixelWidth * 2, nTilePixelHeight * 2,
  mode, vBase.data());
@@ -382,11 +408,11 @@ static bool testJoinsAt( Document *pDocument, long nX, 
long nY,
 dumpTile("_compare", nTilePixelWidth, nTilePixelHeight,
 mode, vCompare.data());*/
 dumpTile("_diff", nTilePixelWidth * 3, nTilePixelHeight, mode, 
vDiff.data());
-return false;
 }
+nDifferences += nDiffs;
 }
 
-return true;
+return nD

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

2019-11-05 Thread Michael Meeks (via logerrit)
 libreofficekit/qa/tilebench/tilebench.cxx |   81 --
 1 file changed, 65 insertions(+), 16 deletions(-)

New commits:
commit ae30d3aca5bb6cb614a027b7e62de2d8fd90c1b6
Author: Michael Meeks 
AuthorDate: Fri Oct 25 21:16:42 2019 +0100
Commit: Michael Meeks 
CommitDate: Tue Nov 5 22:19:28 2019 +0100

lok: tilebench: implement zoom tests.

Change-Id: Ieffc89b8119c2baf56383ac8b5d3cb54dc9d0d2d
Reviewed-on: https://gerrit.libreoffice.org/82090
Tested-by: Jenkins
Reviewed-by: Michael Meeks 

diff --git a/libreofficekit/qa/tilebench/tilebench.cxx 
b/libreofficekit/qa/tilebench/tilebench.cxx
index fef5271bdf27..f5dccf81affa 100644
--- a/libreofficekit/qa/tilebench/tilebench.cxx
+++ b/libreofficekit/qa/tilebench/tilebench.cxx
@@ -295,6 +295,21 @@ static int diffTiles( const std::vector 
&vBase,
 return nDifferent;
 }
 
+static std::vector paintTile( Document *pDocument,
+ long nX, long nY,
+ long const nTilePixelWidth,
+ long const nTilePixelHeight,
+ long const nTileTwipWidth,
+ long const nTileTwipHeight )
+{
+//long e = 0; // tweak if we suspect an overlap / visibility issue.
+//pDocument->setClientVisibleArea( nX - e, nY - e, nTileTwipWidth + e, 
nTileTwipHeight + e );
+std::vector vData( nTilePixelWidth * nTilePixelHeight * 4 );
+pDocument->paintTile( vData.data(), nTilePixelWidth, nTilePixelHeight,
+  nX, nY, nTileTwipWidth, nTileTwipHeight );
+return vData;
+}
+
 static bool testJoinsAt( Document *pDocument, long nX, long nY,
  long const nTilePixelSize,
  long const nTileTwipSize )
@@ -306,12 +321,26 @@ static bool testJoinsAt( Document *pDocument, long nX, 
long nY,
 long const nTileTwipWidth = nTileTwipSize;
 long const nTileTwipHeight = nTileTwipSize;
 
-// Get a base image 4x the size
 long initPosX = nX * nTileTwipWidth, initPosY = nY * nTileTwipHeight;
-std::vector vBase( nTilePixelWidth * nTilePixelHeight * 4 * 
4 );
 
-pDocument->paintTile( vBase.data(), nTilePixelWidth * 2, nTilePixelHeight 
* 2,
-  initPosX, initPosY, nTileTwipWidth * 2, 
nTileTwipHeight * 2 );
+// Calc has to do significant work on changing zoom ...
+pDocument->setClientZoom( nTilePixelWidth, nTilePixelHeight,
+  nTileTwipWidth, nTileTwipHeight );
+
+// Unfortunately without getting this nothing renders ...
+std::stringstream aForceHeaders;
+aForceHeaders << ".uno:ViewRowColumnHeaders?x=" << initPosX << "&y=" << 
initPosY <<
+"&width=" << (nTileTwipWidth * 2) << "&height=" << (nTileTwipHeight * 
2);
+std::string cmd = aForceHeaders.str();
+char* pJSON = pDocument->getCommandValues(cmd.c_str());
+fprintf(stderr, "command: '%s' values '%s'\n", cmd.c_str(), pJSON);
+free(pJSON);
+
+// Get a base image 4x the size
+std::vector vBase(
+paintTile(pDocument, initPosX, initPosY,
+  nTilePixelWidth * 2, nTilePixelHeight * 2,
+  nTileTwipWidth * 2, nTileTwipHeight * 2));
 
 const struct {
 long X;
@@ -326,11 +355,13 @@ static bool testJoinsAt( Document *pDocument, long nX, 
long nY,
 // Compare each of the 4x tiles with a sub-tile of the larger image
 for( auto &rPos : aCompare )
 {
-std::vector vCompare( nTilePixelWidth * 
nTilePixelHeight * 4 );
-pDocument->paintTile( vCompare.data(), nTilePixelWidth, 
nTilePixelHeight,
-  initPosX + rPos.X * nTileTwipWidth,
-  initPosY + rPos.Y * nTileTwipHeight,
-  nTileTwipWidth, nTileTwipHeight );
+std::vector vCompare(
+paintTile(pDocument,
+  initPosX + rPos.X * nTileTwipWidth,
+  initPosY + rPos.Y * nTileTwipHeight,
+  nTilePixelWidth, nTilePixelHeight,
+  nTileTwipWidth, nTileTwipHeight));
+
 std::vector vDiff( nTilePixelWidth * 3 * 
nTilePixelHeight * 4 );
 int nDifferences = diffTiles( vBase, nTilePixelWidth * 2,
   vCompare, nTilePixelWidth,
@@ -339,8 +370,9 @@ static bool testJoinsAt( Document *pDocument, long nX, long 
nY,
   vDiff );
 if ( nDifferences > 0 )
 {
-fprintf( stderr, "  %d differences in sub-tile pixel mismatch at 
%ld, %ld at offset %ld, %ld (twips)\n",
- nDifferences, rPos.X, rPos.Y, initPosX, initPosY );
+fprintf( stderr, "  %d differences in sub-tile pixel mismatch at 
%ld, %ld at offset %ld, %ld (twips) size %ld\n",
+ nDifferences, rPos.X, rPos.Y, initPosX, i

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

2019-10-22 Thread Michael Meeks (via logerrit)
 libreofficekit/qa/tilebench/tilebench.cxx |   69 --
 1 file changed, 48 insertions(+), 21 deletions(-)

New commits:
commit 397729426498a82f55794d23e08dbd7391a085ab
Author: Michael Meeks 
AuthorDate: Mon Oct 21 18:10:22 2019 +0100
Commit: Michael Meeks 
CommitDate: Tue Oct 22 12:01:31 2019 +0200

tilebench: output a helpful delta image and highlight the diffs.

Change-Id: I545b3b262805361851ed2c829110c6a4f852e25e
Reviewed-on: https://gerrit.libreoffice.org/81267
Tested-by: Jenkins
Reviewed-by: Michael Meeks 

diff --git a/libreofficekit/qa/tilebench/tilebench.cxx 
b/libreofficekit/qa/tilebench/tilebench.cxx
index ac5e5d387173..a1d415fe56bb 100644
--- a/libreofficekit/qa/tilebench/tilebench.cxx
+++ b/libreofficekit/qa/tilebench/tilebench.cxx
@@ -247,27 +247,50 @@ static void testTile( Document *pDocument, int max_parts,
 }
 }
 
-static bool subTileIdentical( const std::vector &vBase,
-  long nBaseRowStride,
-  const std::vector &vCompare,
-  long nCompareRowStride,
-  long nTilePixelHeight,
-  long nPosX, long nPosY )
+static uint32_t fade(uint32_t col)
 {
+uint8_t a = (col >> 24) & 0xff;
+uint8_t b = (col >> 16) & 0xff;
+uint8_t g = (col >>  8) & 0xff;
+uint8_t r = (col >>  0) & 0xff;
+uint8_t grey = (r+g+b)/6;
+return (a<<24) + (grey<<16) + (grey<<8) + grey;
+}
+
+// Count and build a picture of any differences into rDiff
+static int diffTiles( const std::vector &vBase,
+   long nBaseRowPixelWidth,
+   const std::vector &vCompare,
+   long nCompareRowPixelWidth,
+   long nTilePixelHeight,
+   long nPosX, long nPosY,
+   std::vector &rDiff )
+{
+int nDifferent = 0;
+const uint32_t *pBase = reinterpret_cast(vBase.data());
+const uint32_t *pCompare = reinterpret_cast(vCompare.data());
+uint32_t *pDiff = reinterpret_cast(rDiff.data());
+long left = 0, mid = nCompareRowPixelWidth, right = 
nCompareRowPixelWidth*2;
 for (long y = 0; y < nTilePixelHeight; ++y)
 {
-long nBaseOffset = nBaseRowStride * (y + nPosY) + nPosX * 
nCompareRowStride;
-long nCompareOffset = nCompareRowStride * y;
-for (long x = 0; x < nCompareRowStride; ++x)
+long nBaseOffset = nBaseRowPixelWidth * (y + nPosY) + nPosX * 
nCompareRowPixelWidth;
+long nCompareOffset = nCompareRowPixelWidth * y;
+long nDiffRowStart = nCompareOffset * 3;
+for (long x = 0; x < nCompareRowPixelWidth; ++x)
 {
-if (vBase[nBaseOffset + x] != vCompare[nCompareOffset + x])
+pDiff[nDiffRowStart + left  + x] = pBase[nBaseOffset + x];
+pDiff[nDiffRowStart + mid   + x] = pCompare[nCompareOffset + x];
+pDiff[nDiffRowStart + right + x] = fade(pBase[nBaseOffset + x]);
+if (pBase[nBaseOffset + x] != pCompare[nCompareOffset + x])
 {
-fprintf (stderr, "Mismatching pixel at %ld (bytes) into row 
%ld\n", x, y);
-return false;
+pDiff[nDiffRowStart + right + x] = 0x00ff;
+if (!nDifferent)
+fprintf (stderr, "First mismatching pixel at %ld (pixels) 
into row %ld\n", x, y);
+nDifferent++;
 }
 }
 }
-return true;
+return nDifferent;
 }
 
 static bool testJoinsAt( Document *pDocument, long nX, long nY,
@@ -306,21 +329,25 @@ static bool testJoinsAt( Document *pDocument, long nX, 
long nY,
   initPosX + rPos.X * nTileTwipWidth,
   initPosY + rPos.Y * nTileTwipHeight,
   nTileTwipWidth, nTileTwipHeight );
-if ( !subTileIdentical( vBase, nTilePixelWidth * 2 * 4,
-vCompare, nTilePixelWidth * 4,
-nTilePixelHeight,
-rPos.X, rPos.Y * nTilePixelHeight ) )
+std::vector vDiff( nTilePixelWidth * 3 * 
nTilePixelHeight * 4 );
+int nDifferences = diffTiles( vBase, nTilePixelWidth * 2,
+  vCompare, nTilePixelWidth,
+  nTilePixelHeight,
+  rPos.X, rPos.Y * nTilePixelHeight,
+  vDiff );
+if ( nDifferences > 0 )
 {
-fprintf( stderr, "  sub-tile pixel mismatch at %ld, %ld at offset 
%ld, %ld (twips)\n",
- rPos.X, rPos.Y, initPosX, initPosY );
+fprintf( stderr, "  %d differences in sub-tile pixel mismatch at 
%ld, %ld at offset %ld, %ld (twips)\n",
+ nDifferences, rPos.X, rPos.Y, initPosX, initPosY );
 dumpTile("_base", nTilePixelWidth * 2

[Libreoffice-commits] core.git: libreofficekit/qa libreofficekit/source ucb/source vcl/unx

2019-10-17 Thread Stephan Bergmann (via logerrit)
 libreofficekit/qa/gtktiledviewer/gtv-application-window.cxx |   11 +++
 libreofficekit/qa/gtktiledviewer/gtv-application.cxx|   11 +++
 libreofficekit/qa/gtktiledviewer/gtv-calc-header-bar.cxx|   11 +++
 libreofficekit/qa/gtktiledviewer/gtv-comments-sidebar.cxx   |5 +
 libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx |   11 +++
 libreofficekit/qa/gtktiledviewer/gtv-main-toolbar.cxx   |   11 +++
 libreofficekit/source/gtk/lokdocview.cxx|5 +
 ucb/source/ucp/gio/gio_mount.cxx|5 +
 vcl/unx/gtk3/gtk3gloactiongroup.cxx |   10 ++
 vcl/unx/gtk3/gtk3glomenu.cxx|5 +
 10 files changed, 85 insertions(+)

New commits:
commit 0b3db87249652351f5a859ded1a876329ab18261
Author: Stephan Bergmann 
AuthorDate: Thu Oct 17 12:05:49 2019 +0200
Commit: Stephan Bergmann 
CommitDate: Thu Oct 17 18:58:21 2019 +0200

Silence Clang 10 trunk -Wdeprecated-volatile in GLib for now

See  "Avoid C++20
deprecated assignment to volatile" for a potential fix in GLib (but also 
see my
question at  "[c++20]
P1152R4: warn on any simple-assignment to a volatile lvalue" whether that 
Clang
warning is actually wanted here).

With glib2-devel-2.62.1-1.fc31.x86_64, the suppressed warnings looked like

> libreofficekit/source/gtk/lokdocview.cxx:327:1: error: use of result of 
assignment to object of volatile-qualified type 'volatile gsize' (aka 'volatile 
unsigned long') is deprecated [-Werror,-Wdeprecated-volatile]
> G_DEFINE_TYPE_WITH_CODE (LOKDocView, lok_doc_view, GTK_TYPE_DRAWING_AREA,
> ^
> /usr/include/glib-2.0/gobject/gtype.h:1617:56: note: expanded from macro 
'G_DEFINE_TYPE_WITH_CODE'
> #define G_DEFINE_TYPE_WITH_CODE(TN, t_n, T_P, _C_)  
_G_DEFINE_TYPE_EXTENDED_BEGIN (TN, t_n, T_P, 0) {_C_;} 
_G_DEFINE_TYPE_EXTENDED_END()
> ^
> /usr/include/glib-2.0/gobject/gtype.h:2034:3: note: expanded from macro 
'_G_DEFINE_TYPE_EXTENDED_BEGIN'
>   _G_DEFINE_TYPE_EXTENDED_BEGIN_REGISTER(TypeName, type_name, 
TYPE_PARENT, flags) \
>   ^
> /usr/include/glib-2.0/gobject/gtype.h:2005:7: note: expanded from macro 
'_G_DEFINE_TYPE_EXTENDED_BEGIN_REGISTER'
>   g_once_init_leave (&g_define_type_id__volatile, g_define_type_id); \
>   ^
> /usr/include/glib-2.0/glib/gthread.h:257:17: note: expanded from macro 
'g_once_init_leave'
> (void) (0 ? *(location) = (result) : 0); \
> ^

Change-Id: If67ad04f8fb242f50b43a1d98ad2b28c4bed55a4
Reviewed-on: https://gerrit.libreoffice.org/80937
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/libreofficekit/qa/gtktiledviewer/gtv-application-window.cxx 
b/libreofficekit/qa/gtktiledviewer/gtv-application-window.cxx
index 17f2ef77a1d3..7692b0b4a162 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-application-window.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-application-window.cxx
@@ -43,7 +43,18 @@ struct GtvApplicationWindowPrivate
 GtvRenderingArgs* m_pRenderingArgs;
 };
 
+#if defined __clang__
+#if __has_warning("-Wdeprecated-volatile")
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-volatile"
+#endif
+#endif
 G_DEFINE_TYPE_WITH_PRIVATE(GtvApplicationWindow, gtv_application_window, 
GTK_TYPE_APPLICATION_WINDOW);
+#if defined __clang__
+#if __has_warning("-Wdeprecated-volatile")
+#pragma clang diagnostic pop
+#endif
+#endif
 
 static GtvApplicationWindowPrivate*
 getPrivate(GtvApplicationWindow* win)
diff --git a/libreofficekit/qa/gtktiledviewer/gtv-application.cxx 
b/libreofficekit/qa/gtktiledviewer/gtv-application.cxx
index 7481076778eb..b6598991f44b 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-application.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-application.cxx
@@ -19,7 +19,18 @@ struct GtvApplicationPrivate
 GtvRenderingArgs* m_pRenderingArgs;
 };
 
+#if defined __clang__
+#if __has_warning("-Wdeprecated-volatile")
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-volatile"
+#endif
+#endif
 G_DEFINE_TYPE_WITH_PRIVATE(GtvApplication, gtv_application, 
GTK_TYPE_APPLICATION);
+#if defined __clang__
+#if __has_warning("-Wdeprecated-volatile")
+#pragma clang diagnostic pop
+#endif
+#endif
 
 static GtvApplicationPrivate*
 getPrivate(GtvApplication* app)
diff --git a/libreofficekit/qa/gtktiledviewer/gtv-calc-header-bar.cxx 
b/libreofficekit/qa/gtktiledviewer/gtv-calc-header-bar.cxx
index 57eba3e0efb3..9346057b7d01 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-calc-header-bar.cxx
+++ b/libreofficekit/qa/gtktiledvi

[Libreoffice-commits] core.git: libreofficekit/qa solenv/gbuild vcl/osx vcl/unx vcl/workben

2019-10-04 Thread Noel Grandin (via logerrit)
 libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx |2 
 solenv/gbuild/platform/com_GCC_defs.mk  |4 +
 vcl/osx/a11yselectionwrapper.mm |4 -
 vcl/osx/a11ytablewrapper.mm |6 +-
 vcl/osx/a11ytextattributeswrapper.mm|4 -
 vcl/osx/a11ytextwrapper.mm  |   22 
+-
 vcl/osx/a11ywrapper.mm  |   10 ++--
 vcl/osx/salframe.cxx|2 
 vcl/unx/gtk3/a11y/gtk3atkutil.cxx   |2 
 vcl/unx/gtk3/gtk3gtkframe.cxx   |2 
 vcl/workben/svpclient.cxx   |2 
 11 files changed, 31 insertions(+), 29 deletions(-)

New commits:
commit 2debad5fbe059b504da14e65719e6d18c1dc4989
Author: Noel Grandin 
AuthorDate: Fri Oct 4 09:59:34 2019 +0200
Commit: Noel Grandin 
CommitDate: Fri Oct 4 14:23:17 2019 +0200

enable -Wunused-exception-parameter on clang

which is useful because our MSVC build will warn about this by default

Change-Id: Idcc0f08b69b6eda4dd2ab010a5fdb674787bebcf
Reviewed-on: https://gerrit.libreoffice.org/80184
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git 
a/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx 
b/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx
index 17120e5a4ada..73d945420ab0 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx
@@ -386,7 +386,7 @@ void LOKDocViewSigHandlers::window(LOKDocView* pDocView, 
gchar* pPayload, gpoint
 if (aRectPoints.size() == 4)
 aGdkRectangle = {aRectPoints[0], aRectPoints[1], 
aRectPoints[2], aRectPoints[3]};
 }
-catch(const std::exception& e)
+catch(const std::exception&)
 {}
 
 gtv_lok_dialog_invalidate(GTV_LOK_DIALOG(pDialog), 
aGdkRectangle);
diff --git a/solenv/gbuild/platform/com_GCC_defs.mk 
b/solenv/gbuild/platform/com_GCC_defs.mk
index 654e75f7de25..fc3ba6958321 100644
--- a/solenv/gbuild/platform/com_GCC_defs.mk
+++ b/solenv/gbuild/platform/com_GCC_defs.mk
@@ -104,7 +104,9 @@ gb_LinkTarget_LDFLAGS += -Wl,--gc-sections
 endif
 
 ifeq ($(COM_IS_CLANG),TRUE)
-gb_CXXFLAGS_COMMON += -Wimplicit-fallthrough
+gb_CXXFLAGS_COMMON += \
+   -Wimplicit-fallthrough \
+   -Wunused-exception-parameter
 else
 gb_CFLAGS_COMMON += \
 -Wduplicated-cond \
diff --git a/vcl/osx/a11yselectionwrapper.mm b/vcl/osx/a11yselectionwrapper.mm
index cc5b280994bd..163fe27da32c 100644
--- a/vcl/osx/a11yselectionwrapper.mm
+++ b/vcl/osx/a11yselectionwrapper.mm
@@ -42,7 +42,7 @@ using namespace ::com::sun::star::uno;
 
 return children;
 
-} catch ( Exception& e)
+} catch ( Exception&)
 {
 }
 }
@@ -79,7 +79,7 @@ using namespace ::com::sun::star::uno;
 for ( unsigned i = 0 ; i < c ; ++i ) {
 xAccessibleSelection -> selectAccessibleChild( [ [ value 
objectAtIndex: i ] accessibleContext ] -> getAccessibleIndexInParent() );
 }
-} catch ( Exception& e) {
+} catch ( Exception&) {
 }
 }
 
diff --git a/vcl/osx/a11ytablewrapper.mm b/vcl/osx/a11ytablewrapper.mm
index be26940b275f..e7cd02fcee7e 100644
--- a/vcl/osx/a11ytablewrapper.mm
+++ b/vcl/osx/a11ytablewrapper.mm
@@ -95,7 +95,7 @@ using namespace ::com::sun::star::uno;
 }
 pResult = NSAccessibilityUnignoredChildren( cells );
 }
-catch (const Exception &e) 
+catch (const Exception &) 
 {
 }
 [cells autorelease];
@@ -147,7 +147,7 @@ using namespace ::com::sun::star::uno;
 }
 pResult = NSAccessibilityUnignoredChildren( cells );
 }
-catch (const Exception &e) 
+catch (const Exception &) 
 {
 pResult = nil;
 }
@@ -186,7 +186,7 @@ using namespace ::com::sun::star::uno;
 }
 pResult = NSAccessibilityUnignoredChildren( cells );
 }
-catch (const Exception &e) 
+catch (const Exception &) 
 {
 pResult = nil;
 }
diff --git a/vcl/osx/a11ytextattributeswrapper.mm 
b/vcl/osx/a11ytextattributeswrapper.mm
index f57aaac2680a..c4f5c5567d66 100644
--- a/vcl/osx/a11ytextattributeswrapper.mm
+++ b/vcl/osx/a11ytextattributeswrapper.mm
@@ -347,9 +347,9 @@ SAL_WNODEPRECATED_DECLARATIONS_POP
 [AquaA11yTextAttributesWrapper addMarkup:[wrapper 
accessibleTextMarkup] toString:string inRange:[origRange rangeValue]];
 [ string endEditing ];
 }
-

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

2019-09-27 Thread Caolán McNamara (via logerrit)
 libreofficekit/qa/tilebench/tilebench.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit d4a3a59d413c29697e9c1e02a39811adfc5a04a8
Author: Caolán McNamara 
AuthorDate: Fri Sep 27 09:07:35 2019 +0100
Commit: Caolán McNamara 
CommitDate: Fri Sep 27 12:14:52 2019 +0200

cid#1454003 silence 'Constant' variable guards dead code

Change-Id: I4ba26647f4081f5c13726b78c737b54e8ab1773d
Reviewed-on: https://gerrit.libreoffice.org/79675
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/libreofficekit/qa/tilebench/tilebench.cxx 
b/libreofficekit/qa/tilebench/tilebench.cxx
index d9b6341495c9..ac5e5d387173 100644
--- a/libreofficekit/qa/tilebench/tilebench.cxx
+++ b/libreofficekit/qa/tilebench/tilebench.cxx
@@ -90,7 +90,7 @@ static void dumpTile(const char *pNameStem,
 << nHeight << "\n"
 << 255 << "\n" ;
 
-bool dumpText = false;
+const bool dumpText = false;
 
 if (dumpText)
 fprintf(stderr, "Stream %s - %dx%d:\n", pNameStem, nWidth, nHeight);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-09-19 Thread Michael Meeks (via logerrit)
 libreofficekit/qa/tilebench/tilebench.cxx |  155 --
 1 file changed, 148 insertions(+), 7 deletions(-)

New commits:
commit 496f93c8667a28a37112f1a9835308b756d771de
Author: Michael Meeks 
AuthorDate: Sat Sep 14 11:47:19 2019 +0100
Commit: Michael Meeks 
CommitDate: Thu Sep 19 21:22:37 2019 +0200

tilebench: initial joining test

Add sub-tile dumping code, and do compares.

Change-Id: I5bc29c07e1075ac40b495f35d01d433e81ba309a
Reviewed-on: https://gerrit.libreoffice.org/79195
Tested-by: Jenkins
Reviewed-by: Michael Meeks 

diff --git a/libreofficekit/qa/tilebench/tilebench.cxx 
b/libreofficekit/qa/tilebench/tilebench.cxx
index 5e7ed19af668..d9b6341495c9 100644
--- a/libreofficekit/qa/tilebench/tilebench.cxx
+++ b/libreofficekit/qa/tilebench/tilebench.cxx
@@ -35,6 +35,7 @@ static int help( const char *error = nullptr )
 fprintf( stderr, "\trenders a selection of small tiles from the document, 
checksums them and times the process based on options:\n" );
 fprintf( stderr, "\t--tile\t[max parts|-1] [max tiles|-1]\n" );
 fprintf( stderr, "\t--dialog\t<.uno:Command>\n" );
+fprintf( stderr, "\t--join\trun tile joining tests\n" );
 return 1;
 }
 
@@ -60,12 +61,22 @@ struct TimeRecord {
 };
 static std::vector< TimeRecord > aTimes;
 
-/// Dump an array of RGBA or BGRA to an RGB PPM file.
-static void dumpTile(const int nWidth, const int nHeight, const int mode, 
const unsigned char* pBufferU)
+/// Dump an array (or sub-array) of RGBA or BGRA to an RGB PPM file.
+static void dumpTile(const char *pNameStem,
+ const int nWidth, const int nHeight,
+ const int mode, const unsigned char* pBufferU,
+ const int nOffX = 0, const int nOffY = 0,
+ int nTotalWidth = -1)
 {
+if (nTotalWidth < 0)
+nTotalWidth = nWidth;
+
 auto pBuffer = reinterpret_cast(pBufferU);
+std::string aName = "/tmp/dump_tile";
+aName += pNameStem;
+aName += ".ppm";
 #ifndef IOS
-std::ofstream ofs("/tmp/dump_tile.ppm");
+std::ofstream ofs(aName);
 #else
 NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, 
NSUserDomainMask, YES);
 NSString *documentsDirectory = [paths objectAtIndex:0];
@@ -79,9 +90,14 @@ static void dumpTile(const int nWidth, const int nHeight, 
const int mode, const
 << nHeight << "\n"
 << 255 << "\n" ;
 
+bool dumpText = false;
+
+if (dumpText)
+fprintf(stderr, "Stream %s - %dx%d:\n", pNameStem, nWidth, nHeight);
+
 for (int y = 0; y < nHeight; ++y)
 {
-const char* row = pBuffer + y * nWidth * 4;
+const char* row = pBuffer + (y + nOffY) * nTotalWidth * 4 + nOffX * 4;
 for (int x = 0; x < nWidth; ++x)
 {
 const char* pixel = row + x * 4;
@@ -108,13 +124,20 @@ static void dumpTile(const int nWidth, const int nHeight, 
const int mode, const
 
 ofs.write(buf, 3);
 }
+if (dumpText)
+{
+int lowResI = (pixel[0] + pixel[1] + pixel[2])/(3*16);
+fprintf(stderr,"%1x", lowResI);
+}
 }
+if (dumpText)
+fprintf(stderr,"\n");
 }
 ofs.close();
 }
 
 static void testTile( Document *pDocument, int max_parts,
-   int max_tiles, bool dump )
+  int max_tiles, bool dump )
 {
 const int mode = pDocument->getTileMode();
 
@@ -170,7 +193,7 @@ static void testTile( Document *pDocument, int max_parts,
  nWidth/2, 2000, 1000, 1000);
 aTimes.emplace_back();
 if (dump)
-dumpTile(nTilePixelWidth, nTilePixelHeight, mode, pPixels);
+dumpTile("tile", nTilePixelWidth, nTilePixelHeight, mode, 
pPixels);
 }
 
 { // 1:1
@@ -224,6 +247,114 @@ static void testTile( Document *pDocument, int max_parts,
 }
 }
 
+static bool subTileIdentical( const std::vector &vBase,
+  long nBaseRowStride,
+  const std::vector &vCompare,
+  long nCompareRowStride,
+  long nTilePixelHeight,
+  long nPosX, long nPosY )
+{
+for (long y = 0; y < nTilePixelHeight; ++y)
+{
+long nBaseOffset = nBaseRowStride * (y + nPosY) + nPosX * 
nCompareRowStride;
+long nCompareOffset = nCompareRowStride * y;
+for (long x = 0; x < nCompareRowStride; ++x)
+{
+if (vBase[nBaseOffset + x] != vCompare[nCompareOffset + x])
+{
+fprintf (stderr, "Mismatching pixel at %ld (bytes) into row 
%ld\n", x, y);
+return false;
+}
+}
+}
+return true;
+}
+
+static bool testJoinsAt( Document *pDocument, long nX, long nY,
+ long const nTilePixelSize,
+  

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

2019-08-06 Thread Stephan Bergmann (via logerrit)
 libreofficekit/qa/tilebench/tilebench.cxx |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit f2c08b1de813a3cc0ec61c0dfd7774045382526f
Author: Stephan Bergmann 
AuthorDate: Tue Aug 6 16:52:32 2019 +0200
Commit: Stephan Bergmann 
CommitDate: Wed Aug 7 08:24:12 2019 +0200

Mark some vars as const

...with the benefit of avoiding some Clang 10
-Werror,-Wimplicit-int-float-conversion in places where they are implicitly
converted to double

Change-Id: I0a8e85b23e3cb19d736e436b793ad83bb5fb99c4
Reviewed-on: https://gerrit.libreoffice.org/77034
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/libreofficekit/qa/tilebench/tilebench.cxx 
b/libreofficekit/qa/tilebench/tilebench.cxx
index cf14315dd9eb..5e7ed19af668 100644
--- a/libreofficekit/qa/tilebench/tilebench.cxx
+++ b/libreofficekit/qa/tilebench/tilebench.cxx
@@ -140,10 +140,10 @@ static void testTile( Document *pDocument, int max_parts,
 aTimes.emplace_back();
 
 // Use realistic dimensions, similar to the Online client.
-long nTilePixelWidth = 512;
-long nTilePixelHeight = 512;
-long nTileTwipWidth = 3840;
-long nTileTwipHeight = 3840;
+long const nTilePixelWidth = 512;
+long const nTilePixelHeight = 512;
+long const nTileTwipWidth = 3840;
+long const nTileTwipHeight = 3840;
 
 // Estimate the maximum tiles based on the number of parts requested, if 
Writer.
 if (pDocument->getDocumentType() == LOK_DOCTYPE_TEXT)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-07-26 Thread Ashod Nakashian (via logerrit)
 libreofficekit/qa/gtktiledviewer/gtv-application.cxx |7 +++
 1 file changed, 7 insertions(+)

New commits:
commit 3cb02bcee8d5f5550952967f9d40475d2f08b61b
Author: Ashod Nakashian 
AuthorDate: Mon Apr 29 22:21:39 2019 -0400
Commit: Noel Grandin 
CommitDate: Fri Jul 26 15:20:28 2019 +0200

gtktiledviewer: provide activation function

This fixes the gtktiledviewer on some distros/gtk
versions that require an activation function to be
provided.

Change-Id: I95fb3ed4e92e27d9c725ca38b4cb5a4f8af51771
Reviewed-on: https://gerrit.libreoffice.org/71588
Reviewed-by: Jan Holesovsky 
Tested-by: Jan Holesovsky 
Reviewed-on: https://gerrit.libreoffice.org/76373
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/libreofficekit/qa/gtktiledviewer/gtv-application.cxx 
b/libreofficekit/qa/gtktiledviewer/gtv-application.cxx
index 15e5f15f1697..7481076778eb 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-application.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-application.cxx
@@ -28,6 +28,12 @@ getPrivate(GtvApplication* app)
 }
 
 static void
+gtv_application_activate(GApplication*)
+{
+// If this isn't provided, some GTK versions fail to run us at all.
+}
+
+static void
 gtv_application_open(GApplication* app, GFile** file, gint /*nFiles*/, const 
gchar* /*hint*/)
 {
 // TODO: add some option to create a new view for existing document
@@ -145,6 +151,7 @@ gtv_application_handle_local_options(GApplication* app, 
GVariantDict* options)
 static void
 gtv_application_class_init(GtvApplicationClass* klass)
 {
+G_APPLICATION_CLASS(klass)->activate = gtv_application_activate;
 G_APPLICATION_CLASS(klass)->open = gtv_application_open;
 G_APPLICATION_CLASS(klass)->handle_local_options = 
gtv_application_handle_local_options;
 G_OBJECT_CLASS(klass)->dispose = gtv_application_dispose;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-05-10 Thread Michael Meeks (via logerrit)
 libreofficekit/qa/gtktiledviewer/gtv-application-window.cxx |   15 ++
 libreofficekit/qa/gtktiledviewer/gtv-application-window.hxx |2 
 libreofficekit/qa/gtktiledviewer/gtv-application.cxx|5 
 libreofficekit/source/gtk/lokdocview.cxx|   63 
 4 files changed, 81 insertions(+), 4 deletions(-)

New commits:
commit f29fded5a52f4c2fc1aae307e1f43326dd04108c
Author: Michael Meeks 
AuthorDate: Thu May 9 18:25:22 2019 +0100
Commit: Michael Meeks 
CommitDate: Fri May 10 22:16:42 2019 +0200

unipoll: add a --unipoll parameter to gtktiledviewer.

Arguably should be the default. Implementation is a bit cute -
re-starting the main-loop as a child of a callback from its
idle handler.

Change-Id: I95e87c8a4ae3de745d7ca1f636859dd1d8deca17
Reviewed-on: https://gerrit.libreoffice.org/72072
Tested-by: Jenkins
Reviewed-by: Michael Meeks 

diff --git a/libreofficekit/qa/gtktiledviewer/gtv-application-window.cxx 
b/libreofficekit/qa/gtktiledviewer/gtv-application-window.cxx
index 1de1aa94568d..564c1de137c6 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-application-window.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-application-window.cxx
@@ -356,9 +356,18 @@ gtv_application_window_load_document(GtvApplicationWindow* 
window,
 *(priv->m_pRenderingArgs) = *aArgs;
 
 // setup lokdocview
-window->lokdocview = 
lok_doc_view_new_from_user_profile(priv->m_pRenderingArgs->m_aLoPath.c_str(),
-
priv->m_pRenderingArgs->m_aUserProfile.empty() ? nullptr : 
priv->m_pRenderingArgs->m_aUserProfile.c_str(),
-  nullptr, nullptr);
+const char *pUserProfile = priv->m_pRenderingArgs->m_aUserProfile.empty() ?
+nullptr : priv->m_pRenderingArgs->m_aUserProfile.c_str();
+
+window->lokdocview = GTK_WIDGET(
+g_initable_new(LOK_TYPE_DOC_VIEW, nullptr, nullptr,
+   "lopath", priv->m_pRenderingArgs->m_aLoPath.c_str(),
+   "unipoll", priv->m_pRenderingArgs->m_bUnipoll,
+   "userprofileurl", pUserProfile,
+   "halign", GTK_ALIGN_CENTER,
+   "valign", GTK_ALIGN_CENTER,
+   nullptr));
+
 gtk_container_add(GTK_CONTAINER(window->scrolledwindow), 
window->lokdocview);
 
 setupDocView(window);
diff --git a/libreofficekit/qa/gtktiledviewer/gtv-application-window.hxx 
b/libreofficekit/qa/gtktiledviewer/gtv-application-window.hxx
index 748195c5aff0..21508097e077 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-application-window.hxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-application-window.hxx
@@ -24,6 +24,7 @@ struct GtvRenderingArgs
 std::string m_aLoPath;
 std::string m_aUserProfile;
 bool m_bEnableTiledAnnotations;
+bool m_bUnipoll;
 
 std::string m_aBackgroundColor;
 bool m_bHidePageShadow;
@@ -31,6 +32,7 @@ struct GtvRenderingArgs
 
 GtvRenderingArgs()
 : m_bEnableTiledAnnotations(false),
+  m_bUnipoll(false),
   m_bHidePageShadow(false),
   m_bHideWhiteSpace(false)
 { }
diff --git a/libreofficekit/qa/gtktiledviewer/gtv-application.cxx 
b/libreofficekit/qa/gtktiledviewer/gtv-application.cxx
index 3d802ee325d4..15e5f15f1697 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-application.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-application.cxx
@@ -46,6 +46,7 @@ gtv_application_init(GtvApplication* app)
 {
 { "version", 0, 0, G_OPTION_ARG_NONE, nullptr, "Show LOkit version", 
nullptr },
 { "lo-path", 0, 0, G_OPTION_ARG_STRING, nullptr, "LO path", nullptr },
+{ "unipoll", 0, 0, G_OPTION_ARG_NONE, nullptr, "Enable unified polling 
loop", nullptr },
 { "user-profile", 0, 0, G_OPTION_ARG_STRING, nullptr, "User profile to 
use", nullptr },
 { "enable-tiled-annotations", 0, 0, G_OPTION_ARG_NONE, nullptr, 
"Whether tiled annotations should be enabled", nullptr },
 { "background-color", 0, 0, G_OPTION_ARG_STRING, nullptr, "Background 
color", nullptr },
@@ -92,11 +93,13 @@ gtv_application_handle_local_options(GApplication* app, 
GVariantDict* options)
 return 1; // Cannot afford to continue in absence of this param
 }
 
+if (g_variant_dict_contains(options, "unipoll"))
+priv->m_pRenderingArgs->m_bUnipoll = true;
+
 if (g_variant_dict_contains(options, "version"))
 {
 if (!priv->m_pRenderingArgs->m_aLoPath.empty())
 {
-// FIXME: Crashes for some reason
 GtkWidget* pDocView = 
lok_doc_view_new(priv->m_pRenderingArgs->m_aLoPath.c_str(), nullptr, nullptr);
 const gchar* versionInfo = 
lok_doc_view_get_version_info(LOK_DOC_VIEW(pDocView));
 if (versionInfo)
diff --git a/libreofficekit/source/gtk/lokdocview.cxx 
b/libreofficekit/source/gtk/lokdocview.cxx
index 3187daed6a41..54c63de367

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

2019-02-13 Thread Libreoffice Gerrit user
 libreofficekit/qa/unit/tiledrendering.cxx |   56 ++
 1 file changed, 56 insertions(+)

New commits:
commit f637b79e3517235883a65bd33a303642fb17fdee
Author: Michael Meeks 
AuthorDate: Fri Jan 25 22:55:20 2019 +
Commit: Michael Meeks 
CommitDate: Wed Feb 13 14:14:17 2019 +0100

lok: keystroke attribution issue.

Change-Id: I7e5ed3c72fef12d31b5500ac622b5f4129de
Reviewed-on: https://gerrit.libreoffice.org/66931
Tested-by: Jenkins
Reviewed-by: Michael Meeks 

diff --git a/libreofficekit/qa/unit/tiledrendering.cxx 
b/libreofficekit/qa/unit/tiledrendering.cxx
index 69f7c5dbe6f8..7d605e7a5839 100644
--- a/libreofficekit/qa/unit/tiledrendering.cxx
+++ b/libreofficekit/qa/unit/tiledrendering.cxx
@@ -8,6 +8,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -108,6 +109,7 @@ public:
 void testCalcSheetNames( Office* pOffice );
 void testPaintPartTile( Office* pOffice );
 void testDocumentLoadLanguage(Office* pOffice);
+void testMultiKeyInput(Office *pOffice);
 #if 0
 void testOverlay( Office* pOffice );
 #endif
@@ -132,6 +134,7 @@ void TiledRenderingTest::runAllTests()
 
 testDocumentLoadFail( pOffice.get() );
 testDocumentTypes( pOffice.get() );
+testMultiKeyInput(pOffice.get());
 testImpressSlideNames( pOffice.get() );
 testCalcSheetNames( pOffice.get() );
 testPaintPartTile( pOffice.get() );
@@ -394,6 +397,59 @@ void TiledRenderingTest::testOverlay( Office* /*pOffice*/ )
 }
 #endif
 
+void TiledRenderingTest::testMultiKeyInput(Office *pOffice)
+{
+std::unique_ptr pDocument(loadDocument(pOffice, 
"blank_text.odt"));
+
+CPPUNIT_ASSERT(pDocument.get());
+CPPUNIT_ASSERT_EQUAL(LOK_DOCTYPE_TEXT, 
static_cast(pDocument->getDocumentType()));
+
+// Create two views.
+int nViewA = pDocument->getView();
+
pDocument->initializeForRendering("{\".uno:Author\":{\"type\":\"string\",\"value\":\"jill\"}}");
+
+pDocument->createView();
+int nViewB = pDocument->getView();
+
pDocument->initializeForRendering("{\".uno:Author\":{\"type\":\"string\",\"value\":\"jack\"}}");
+
+// Enable change tracking
+pDocument->postUnoCommand(".uno:TrackChanges");
+
+// First a key-stroke from a
+pDocument->setView(nViewA);
+pDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 97, 0); // a
+pDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, 512);   // 'a
+
+// A space on 'a' - force commit
+pDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 32, 0); // ' '
+pDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, 1284);   // '' '
+
+// Another 'a'
+pDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 97, 0); // a
+pDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, 512);   // 'a
+
+// FIXME: Wait for writer input handler to commit that.
+// without this we fall foul of edtwin's KeyInputFlushTimer
+std::this_thread::sleep_for(std::chrono::milliseconds(300));
+
+// Quickly a new key-stroke from b
+pDocument->setView(nViewB);
+pDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 98, 0); // b
+pDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, 514);   // 'b
+
+// A space on 'b' - force commit
+pDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 32, 0); // ' '
+pDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, 1284);   // '' '
+
+// Wait for writer input handler to commit that.
+std::this_thread::sleep_for(std::chrono::milliseconds(300));
+
+// get track changes ?
+char *values = pDocument->getCommandValues(".uno:AcceptTrackedChanges");
+std::cerr << "Values: '" << values << "'\n";
+CPPUNIT_ASSERT(0);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(TiledRenderingTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-01-25 Thread Libreoffice Gerrit user
 libreofficekit/qa/unit/tiledrendering.cxx |  116 --
 1 file changed, 49 insertions(+), 67 deletions(-)

New commits:
commit b1d35c809aaa2ba6ac1f5fb12f5d251e8718aa7c
Author: Michael Meeks 
AuthorDate: Fri Jan 25 17:51:19 2019 +
Commit: Michael Meeks 
CommitDate: Fri Jan 25 22:21:35 2019 +0100

lok: calm down CnP issues & simplify.

Change-Id: I67669b9b3accbcf89bddf3b8dc8435edba89224b
Reviewed-on: https://gerrit.libreoffice.org/66925
Tested-by: Jenkins
Reviewed-by: Michael Meeks 

diff --git a/libreofficekit/qa/unit/tiledrendering.cxx 
b/libreofficekit/qa/unit/tiledrendering.cxx
index c0ded3e1a7e6..69f7c5dbe6f8 100644
--- a/libreofficekit/qa/unit/tiledrendering.cxx
+++ b/libreofficekit/qa/unit/tiledrendering.cxx
@@ -37,6 +37,35 @@ using namespace ::boost;
 using namespace ::lok;
 using namespace ::std;
 
+namespace {
+
+void processEventsToIdle()
+{
+typedef void (ProcessEventsToIdleFn)(void);
+static ProcessEventsToIdleFn *processFn = nullptr;
+if (!processFn)
+{
+void *me = dlopen(nullptr, RTLD_NOW);
+processFn = reinterpret_cast(dlsym(me, 
"unit_lok_process_events_to_idle"));
+}
+
+CPPUNIT_ASSERT(processFn);
+
+(*processFn)();
+}
+
+void insertString(Document& rDocument, const std::string& s)
+{
+for (const char c : s)
+{
+rDocument.postKeyEvent(LOK_KEYEVENT_KEYINPUT, c, 0);
+rDocument.postKeyEvent(LOK_KEYEVENT_KEYUP, c, 0);
+processEventsToIdle();
+}
+}
+
+}
+
 OUString getFileURLFromSystemPath(OUString const & path)
 {
 OUString url;
@@ -57,6 +86,9 @@ public:
 const string m_sInstDir;
 const string m_sLOPath;
 
+std::unique_ptr loadDocument( Office *pOffice, const string 
&pName,
+const char *pFilterOptions = 
nullptr );
+
 TiledRenderingTest()
 : m_sSrcRoot( getenv( "SRC_ROOT" ) )
 , m_sInstDir( getenv( "INSTDIR" ) )
@@ -130,20 +162,26 @@ int getDocumentType( Office* pOffice, const string& rPath 
)
 return pDocument->getDocumentType();
 }
 
-void TiledRenderingTest::testDocumentTypes( Office* pOffice )
+std::unique_ptr TiledRenderingTest::loadDocument( Office *pOffice, 
const string &pName,
+const char 
*pFilterOptions )
 {
-const string sTextDocPath = m_sSrcRoot + 
"/libreofficekit/qa/data/blank_text.odt";
-const string sTextLockFile = m_sSrcRoot 
+"/libreofficekit/qa/data/.~lock.blank_text.odt#";
+const string sDocPath = m_sSrcRoot + "/libreofficekit/qa/data/" + pName;
+const string sLockFile = m_sSrcRoot +"/libreofficekit/qa/data/.~lock." + 
pName + "#";
 
-// FIXME: same comment as below wrt lockfile removal.
-remove( sTextLockFile.c_str() );
+remove( sLockFile.c_str() );
+
+return std::unique_ptr(pOffice->documentLoad( sDocPath.c_str(), 
pFilterOptions ));
+}
+
+void TiledRenderingTest::testDocumentTypes( Office* pOffice )
+{
+std::unique_ptr pDocument(loadDocument(pOffice, 
"blank_text.odt"));
 
-std::unique_ptr pDocument(pOffice->documentLoad( 
sTextDocPath.c_str()));
 CPPUNIT_ASSERT(pDocument.get());
 CPPUNIT_ASSERT_EQUAL(LOK_DOCTYPE_TEXT, 
static_cast(pDocument->getDocumentType()));
 // This crashed.
 pDocument->postUnoCommand(".uno:Bold");
-Scheduler::ProcessEventsToIdle();
+processEventsToIdle();
 
 const string sPresentationDocPath = m_sSrcRoot + 
"/libreofficekit/qa/data/blank_presentation.odp";
 const string sPresentationLockFile = m_sSrcRoot 
+"/libreofficekit/qa/data/.~lock.blank_presentation.odp#";
@@ -158,16 +196,7 @@ void TiledRenderingTest::testDocumentTypes( Office* 
pOffice )
 
 void TiledRenderingTest::testImpressSlideNames( Office* pOffice )
 {
-const string sDocPath = m_sSrcRoot + 
"/libreofficekit/qa/data/impress_slidenames.odp";
-const string sLockFile = m_sSrcRoot 
+"/libreofficekit/qa/data/.~lock.impress_slidenames.odp#";
-
-// FIXME: this is a temporary hack: LOK will fail when trying to open a
-// locked file, and since we're reusing the file for a different unit
-// test it's entirely possible that an unwanted lock file will remain.
-// Hence forcefully remove it here.
-remove( sLockFile.c_str() );
-
-std::unique_ptr< Document> pDocument( pOffice->documentLoad( 
sDocPath.c_str() ) );
+std::unique_ptr pDocument(loadDocument(pOffice, 
"impress_slidenames.odp"));
 
 CPPUNIT_ASSERT_EQUAL(3, pDocument->getParts());
 CPPUNIT_ASSERT_EQUAL(std::string("TestText1"), 
std::string(pDocument->getPartName(0)));
@@ -179,13 +208,7 @@ void TiledRenderingTest::testImpressSlideNames( Office* 
pOffice )
 
 void TiledRenderingTest::testCalcSheetNames( Office* pOffice )
 {
-const string sDocPath = m_sSrcRoot + 
"/libreofficekit/qa/data/calc_sheetnames.ods";
-const string sLockFile = m_sSrcRoot 
+"/libreofficekit/qa/data/.~lock.calc_sheetnames.ods#";
-
-// FIXME: LOK will fail when t

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

2018-10-10 Thread Libreoffice Gerrit user
 libreofficekit/qa/tilebench/tilebench.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit cde5ea63cd90a1068d99358d6aee0c53af57e441
Author: Tor Lillqvist 
AuthorDate: Wed Oct 10 16:36:34 2018 +0300
Commit: Tor Lillqvist 
CommitDate: Wed Oct 10 16:36:34 2018 +0300

Sure it is a square

Change-Id: I2a48c31bfcfa0c1fee213a70f3c25bcdcc1de56d

diff --git a/libreofficekit/qa/tilebench/tilebench.cxx 
b/libreofficekit/qa/tilebench/tilebench.cxx
index 1d275d6a44ed..8f1a2f793494 100644
--- a/libreofficekit/qa/tilebench/tilebench.cxx
+++ b/libreofficekit/qa/tilebench/tilebench.cxx
@@ -167,7 +167,7 @@ static void testTile( Document *pDocument, int max_parts,
 // whole part; meaningful only for non-writer documents.
 aTimes.emplace_back("render whole part");
 pDocument->paintTile(pPixels, nTilePixelWidth, nTilePixelHeight,
- nWidth/2, 2000, 1000, 1000); // not square
+ nWidth/2, 2000, 1000, 1000);
 aTimes.emplace_back();
 if (dump)
 dumpTile(nTilePixelWidth, nTilePixelHeight, mode, pPixels);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-10-05 Thread Libreoffice Gerrit user
 libreofficekit/qa/tilebench/tilebench.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 7f1c085e72f80f087c7077bd377d100ff06b7a3d
Author: Tor Lillqvist 
AuthorDate: Fri Oct 5 21:29:45 2018 +0300
Commit: Tor Lillqvist 
CommitDate: Fri Oct 5 21:29:45 2018 +0300

s/0/nullptr/

Change-Id: Id1b75435134da830130ebe725d86ad4e273d1f06

diff --git a/libreofficekit/qa/tilebench/tilebench.cxx 
b/libreofficekit/qa/tilebench/tilebench.cxx
index 0b999f2994c7..47d468f01773 100644
--- a/libreofficekit/qa/tilebench/tilebench.cxx
+++ b/libreofficekit/qa/tilebench/tilebench.cxx
@@ -390,7 +390,7 @@ int main( int argc, char* argv[] )
 if (pDocument)
 {
 
pDocument->initializeForRendering("{\".uno:Author\":{\"type\":\"string\",\"value\":\"Local
 Host #0\"}}");
-pDocument->registerCallback(documentCallback, 0);
+pDocument->registerCallback(documentCallback, nullptr);
 if (!strcmp(mode, "--tile"))
 {
 const int max_parts = (argc > arg ? atoi(argv[arg++]) : -1);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-10-05 Thread Libreoffice Gerrit user
 libreofficekit/qa/tilebench/tilebench.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 08afdd3dab674707bafab9f4dee892d77d3c872a
Author: Tor Lillqvist 
AuthorDate: Fri Oct 5 20:57:59 2018 +0300
Commit: Tor Lillqvist 
CommitDate: Fri Oct 5 20:57:59 2018 +0300

WaE: unused parameter

Change-Id: I0ccdad335f0a2cd6f14a4a226590b0e1d3033244

diff --git a/libreofficekit/qa/tilebench/tilebench.cxx 
b/libreofficekit/qa/tilebench/tilebench.cxx
index 60b471bcad92..0b999f2994c7 100644
--- a/libreofficekit/qa/tilebench/tilebench.cxx
+++ b/libreofficekit/qa/tilebench/tilebench.cxx
@@ -313,7 +313,7 @@ static void testDialog( Document *pDocument, const char 
*uno_cmd )
 pDocument->destroyView(view);
 }
 
-static void documentCallback(const int type, const char* p, void* data)
+static void documentCallback(const int type, const char* p, void*)
 {
 std::cerr << "Document callback " << type << ": " << (p ? p : "(null)") << 
"\n";
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: libreofficekit/qa vcl/unx

2018-09-29 Thread Libreoffice Gerrit user
 libreofficekit/qa/gtktiledviewer/gtv-application-window.cxx |8 
 vcl/unx/gtk/gloactiongroup.cxx  |8 +++-
 2 files changed, 15 insertions(+), 1 deletion(-)

New commits:
commit 618d474f059a75c2ac04df16c830d71a88690118
Author: Julien Nabet 
AuthorDate: Sat Sep 29 13:18:49 2018 +0200
Commit: Julien Nabet 
CommitDate: Sat Sep 29 20:27:49 2018 +0200

band-aid: deprecated-declarations related to gtk

Don't hesitate to revert this one but only if there's a patch to fix it.

Change-Id: Ib15352e1a94d0542120f6710acfe19887494ed51
Reviewed-on: https://gerrit.libreoffice.org/61142
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/libreofficekit/qa/gtktiledviewer/gtv-application-window.cxx 
b/libreofficekit/qa/gtktiledviewer/gtv-application-window.cxx
index d9c709604a28..5d6ecb01728d 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-application-window.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-application-window.cxx
@@ -135,9 +135,17 @@ static void initWindow(GtvApplicationWindow* window)
 {
 GtvApplicationWindowPrivate* priv = getPrivate(window);
 
+#ifdef __GNUC__
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
 GList *focusChain = nullptr;
 focusChain = g_list_append( focusChain, window->lokdocview );
+
 gtk_container_set_focus_chain ( GTK_CONTAINER (priv->container), 
focusChain );
+#ifdef __GNUC__
+#pragma GCC diagnostic pop
+#endif
 
 // TODO: Implement progressbar in statusbar
 LibreOfficeKitDocument* pDocument = 
lok_doc_view_get_document(LOK_DOC_VIEW(window->lokdocview));
diff --git a/vcl/unx/gtk/gloactiongroup.cxx b/vcl/unx/gtk/gloactiongroup.cxx
index b058417b821f..73a432769a08 100644
--- a/vcl/unx/gtk/gloactiongroup.cxx
+++ b/vcl/unx/gtk/gloactiongroup.cxx
@@ -327,8 +327,14 @@ g_lo_action_group_class_init (GLOActionGroupClass *klass)
 GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
 object_class->finalize = g_lo_action_group_finalize;
-
+#ifdef __GNUC__
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
 g_type_class_add_private (klass, sizeof (GLOActionGroupPrivate));
+#ifdef __GNUC__
+#pragma GCC diagnostic pop
+#endif
 }
 
 static void
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-09-29 Thread Libreoffice Gerrit user
 libreofficekit/qa/gtktiledviewer/gtv-helpers.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 003bc12a3c11d67e54c14d1bc48fb8bba56ec49c
Author: Julien Nabet 
AuthorDate: Sun Sep 23 16:15:13 2018 +0200
Commit: Julien Nabet 
CommitDate: Sat Sep 29 08:59:53 2018 +0200

Band-aid fix for deprecate gtk_css_provider_get_default

by gtk_css_provider_new

Don't hesitate to revert this one but only if there's a patch
to fix it.
Change-Id: Id91fefb689326a31e029a788bd3729e670fe3100
Reviewed-on: https://gerrit.libreoffice.org/60915
Reviewed-by: Julien Nabet 
Tested-by: Julien Nabet 

diff --git a/libreofficekit/qa/gtktiledviewer/gtv-helpers.cxx 
b/libreofficekit/qa/gtktiledviewer/gtv-helpers.cxx
index d810170dc675..2a4784da5209 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-helpers.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-helpers.cxx
@@ -105,7 +105,7 @@ GtkWidget* GtvHelpers::createCommentBox(const 
boost::property_tree::ptree& aComm
 if (aComment.get("parent", -1) > 0)
 {
 GtkStyleContext* pStyleContext = 
gtk_widget_get_style_context(pCommentVBox);
-GtkCssProvider* pCssProvider = gtk_css_provider_get_default();
+GtkCssProvider* pCssProvider = gtk_css_provider_new();
 gtk_style_context_add_class(pStyleContext, "commentbox");
 gtk_style_context_add_provider(pStyleContext, 
GTK_STYLE_PROVIDER(pCssProvider), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
 gtk_css_provider_load_from_data(pCssProvider, ".commentbox 
{background-color: lightgreen;}", -1, nullptr);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-07-16 Thread Libreoffice Gerrit user
 libreofficekit/qa/tilebench/tilebench.cxx |   11 +--
 1 file changed, 5 insertions(+), 6 deletions(-)

New commits:
commit a3b960feb8541be75c9bd37578b8c899a292c5c4
Author: Caolán McNamara 
AuthorDate: Sun Jul 15 21:14:32 2018 +0100
Commit: Caolán McNamara 
CommitDate: Mon Jul 16 09:44:32 2018 +0200

coverity#1437959 Copy into fixed size buffer

Change-Id: I5578e195c834b2a3ceacd5c528f58d1d03502c2e
Reviewed-on: https://gerrit.libreoffice.org/57461
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/libreofficekit/qa/tilebench/tilebench.cxx 
b/libreofficekit/qa/tilebench/tilebench.cxx
index 16fc047ce655..4cb76dd1366e 100644
--- a/libreofficekit/qa/tilebench/tilebench.cxx
+++ b/libreofficekit/qa/tilebench/tilebench.cxx
@@ -313,23 +313,22 @@ int main( int argc, char* argv[] )
 mode = argv[arg++];
 }
 
-char user_url[8046];;
-strcpy(user_url, "file:///");
-strcat(user_url, argv[1]);
-strcat(user_url, "../user");
+std::string user_url("file:///");
+user_url.append(argv[1]);
+user_url.append("../user");
 
 if (pre_init)
 {
 aTimes.emplace_back("pre-initialization");
 setenv("LOK_WHITELIST_LANGUAGES", "en_US", 0);
 // coverity[tainted_string] - build time test tool
-lok_preinit(argv[1], user_url);
+lok_preinit(argv[1], user_url.c_str());
 aTimes.emplace_back();
 }
 
 aTimes.emplace_back("initialization");
 // coverity[tainted_string] - build time test tool
-Office *pOffice = lok_cpp_init(argv[1], user_url);
+Office *pOffice = lok_cpp_init(argv[1], user_url.c_str());
 if (pOffice == nullptr)
 {
 fprintf(stderr, "Failed to initialize Office from %s\n", argv[1]);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-03-21 Thread Ashod Nakashian
 libreofficekit/qa/tilebench/tilebench.cxx |6 ++
 1 file changed, 6 insertions(+)

New commits:
commit 519293447189f75e842065f7ff211d395d0da4b6
Author: Ashod Nakashian 
Date:   Fri Mar 16 20:29:27 2018 -0400

lok: be informative and exit when tilebench fails to initialize

Change-Id: I11078e36aafc715b7103998a17e0cb01926b8e97
Reviewed-on: https://gerrit.libreoffice.org/51618
Tested-by: Jenkins 
Reviewed-by: Ashod Nakashian 

diff --git a/libreofficekit/qa/tilebench/tilebench.cxx 
b/libreofficekit/qa/tilebench/tilebench.cxx
index 751fb179169f..ed3d57d05b3f 100644
--- a/libreofficekit/qa/tilebench/tilebench.cxx
+++ b/libreofficekit/qa/tilebench/tilebench.cxx
@@ -113,6 +113,12 @@ int main( int argc, char* argv[] )
 aTimes.emplace_back("initialization");
 // coverity[tainted_string] - build time test tool
 Office *pOffice = lok_cpp_init(argv[1]);
+if (pOffice == nullptr)
+{
+fprintf(stderr, "Failed to initialize Office from %s\n", argv[1]);
+return 1;
+}
+
 aTimes.emplace_back();
 
 const int max_parts = (argc > 3 ? atoi(argv[3]) : -1);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-03-14 Thread Pranav Kant
 libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx |6 ++
 1 file changed, 6 insertions(+)

New commits:
commit 859b7b09f5b1330b7135744795c578358736ded3
Author: Pranav Kant 
Date:   Wed Mar 14 14:50:58 2018 +0530

lokdialog: debug red-colored boundary for last painted region

Easier to see what's going on inside the LOK dialog.

Change-Id: I59974200af3d2356b7c27eb3dd4032a59c00dbed
Reviewed-on: https://gerrit.libreoffice.org/51263
Tested-by: Jenkins 
Reviewed-by: pranavk 

diff --git a/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx 
b/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx
index 75c4bae71df5..1d7a2482c069 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx
@@ -117,7 +117,13 @@ gtv_lok_dialog_draw(GtkWidget* pDialogDrawingArea, 
cairo_t* pCairo, gpointer)
 cairo_surface_mark_dirty(pSurface);
 
 cairo_set_source_surface(pCairo, pSurface, aRect.x, aRect.y);
+// paint the dialog image
 cairo_paint(pCairo);
+
+// debug red-colored border around the painted region
+cairo_set_source_rgb(pCairo, 1.0, 0, 0);
+cairo_rectangle(pCairo, aRect.x, aRect.y, nWidth, nHeight);
+cairo_stroke(pCairo);
 }
 
 static gboolean
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-03-12 Thread Pranav Kant
 libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx |9 
 libreofficekit/source/gtk/lokdocview.cxx|   22 
++
 2 files changed, 31 insertions(+)

New commits:
commit f495a324921589d731d7d16f4554e36d4230476b
Author: Pranav Kant 
Date:   Mon Mar 12 22:03:05 2018 +0530

lokdocview: new property 'is-initialized'; fix gtktiledviewer for calc

there's no lokdocview property to tell if the doc has been completely
initialized (initializeForRendering() has been called, etc.). This new
property takes care of that which we now use to ignore
configure event fired before document is initialized for rendering.
Configure event handler queries document for row/col header which
asserts because some values hasn't been initialized yet.

Change-Id: I58385b2cb56bf317fe20ecf0570b7095f7260174
Reviewed-on: https://gerrit.libreoffice.org/51156
Tested-by: Jenkins 
Reviewed-by: pranavk 

diff --git 
a/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx 
b/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx
index 5983b7f77e5b..c3ee592a5463 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx
@@ -403,6 +403,15 @@ void LOKDocViewSigHandlers::window(LOKDocView* pDocView, 
gchar* pPayload, gpoint
 gboolean LOKDocViewSigHandlers::configureEvent(GtkWidget* pWidget, 
GdkEventConfigure* /*pEvent*/, gpointer /*pData*/)
 {
 GtvApplicationWindow* window = 
GTV_APPLICATION_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(pWidget)));
+
+gboolean isInit = false;
+g_object_get(G_OBJECT(window->lokdocview), "is-initialized", &isInit, 
nullptr);
+if (!isInit)
+{
+g_info("Ignoring configure event; document not yet ready");
+return false;
+}
+
 LibreOfficeKitDocument* pDocument = 
lok_doc_view_get_document(LOK_DOC_VIEW(window->lokdocview));
 if (pDocument && pDocument->pClass->getDocumentType(pDocument) == 
LOK_DOCTYPE_SPREADSHEET)
 {
diff --git a/libreofficekit/source/gtk/lokdocview.cxx 
b/libreofficekit/source/gtk/lokdocview.cxx
index 87b69ec409af..8a76c78e1151 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -82,6 +82,7 @@ struct LOKDocViewPrivateImpl
 std::string m_aRenderingArguments;
 gdouble m_nLoadProgress;
 gboolean m_bIsLoading;
+gboolean m_bInit; // initializeForRendering() has been called
 gboolean m_bCanZoomIn;
 gboolean m_bCanZoomOut;
 LibreOfficeKit* m_pOffice;
@@ -194,6 +195,7 @@ struct LOKDocViewPrivateImpl
 LOKDocViewPrivateImpl()
 : m_nLoadProgress(0),
 m_bIsLoading(false),
+m_bInit(false),
 m_bCanZoomIn(true),
 m_bCanZoomOut(true),
 m_pOffice(nullptr),
@@ -293,6 +295,7 @@ enum
 PROP_LOAD_PROGRESS,
 PROP_ZOOM,
 PROP_IS_LOADING,
+PROP_IS_INITIALIZED,
 PROP_DOC_WIDTH,
 PROP_DOC_HEIGHT,
 PROP_CAN_ZOOM_IN,
@@ -970,6 +973,9 @@ static gboolean postDocumentLoad(gpointer pData)
 gtk_widget_grab_focus(GTK_WIDGET(pLOKDocView));
 lok_doc_view_set_zoom(pLOKDocView, 1.0);
 
+// we are completely loaded
+priv->m_bInit = TRUE;
+
 return G_SOURCE_REMOVE;
 }
 
@@ -2575,6 +2581,9 @@ static void lok_doc_view_get_property (GObject* object, 
guint propId, GValue *va
 case PROP_IS_LOADING:
 g_value_set_boolean (value, priv->m_bIsLoading);
 break;
+case PROP_IS_INITIALIZED:
+g_value_set_boolean (value, priv->m_bInit);
+break;
 case PROP_DOC_WIDTH:
 g_value_set_long (value, priv->m_nDocumentWidthTwips);
 break;
@@ -2845,6 +2854,19 @@ static void lok_doc_view_class_init (LOKDocViewClass* 
pClass)
   G_PARAM_STATIC_STRINGS));
 
 /**
+ * LOKDocView:is-initialized:
+ *
+ * Whether the requested document has completely loaded or not.
+ */
+properties[PROP_IS_INITIALIZED] =
+g_param_spec_boolean("is-initialized",
+ "Has initialized",
+ "Whether the view has completely initialized",
+ FALSE,
+ static_cast(G_PARAM_READABLE |
+  G_PARAM_STATIC_STRINGS));
+
+/**
  * LOKDocView:doc-width:
  *
  * The width of the currently loaded document in #LOKDocView in twips.
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-12-23 Thread Ashod Nakashian
 libreofficekit/qa/tilebench/tilebench.cxx |   71 +-
 1 file changed, 60 insertions(+), 11 deletions(-)

New commits:
commit 62c36eb8c600fe328954c22d83b6f8dda57d5d15
Author: Ashod Nakashian 
Date:   Sun Dec 3 23:34:22 2017 -0500

LOK: support tile-dumping in tilebench

And other improvements.

(cherry picked from commit b7d893d8a1ecb24290c4470e12d71caba2b85216)
Reviewed-on: https://gerrit.libreoffice.org/46678
Reviewed-by: Jan Holesovsky 
Tested-by: Jan Holesovsky 
(cherry picked from commit 0e7ccbdd559df3a446e73c367b12824c6c143579)

Change-Id: I5a27d6d2df5f946a708dd3b0b4fef8159da86e5c
Reviewed-on: https://gerrit.libreoffice.org/46985
Tested-by: Jenkins 
Reviewed-by: Ashod Nakashian 

diff --git a/libreofficekit/qa/tilebench/tilebench.cxx 
b/libreofficekit/qa/tilebench/tilebench.cxx
index ed8d44c13789..61bc562ae9a7 100644
--- a/libreofficekit/qa/tilebench/tilebench.cxx
+++ b/libreofficekit/qa/tilebench/tilebench.cxx
@@ -13,6 +13,7 @@
 #include 
 
 #include 
+#include 
 #include 
 
 #include 
@@ -36,6 +37,48 @@ static double getTimeNow()
(double)aValue.Nanosec / (1000*1000*1000);
 }
 
+/// Dump an array of RGBA or BGRA to an RGB PPM file.
+static void dumpTile(const int nWidth, const int nHeight, const int mode, 
const char* pBuffer)
+{
+std::ofstream ofs("/tmp/dump_tile.ppm");
+ofs << "P6\n"
+<< nWidth << " "
+<< nHeight << "\n"
+<< 255 << "\n" ;
+
+for (int y = 0; y < nHeight; ++y)
+{
+const char* row = pBuffer + y * nWidth * 4;
+for (int x = 0; x < nWidth; ++x)
+{
+const char* pixel = row + x * 4;
+if (mode == LOK_TILEMODE_RGBA)
+{
+ofs.write(pixel, 3); // Skip alpha
+}
+else if (mode == LOK_TILEMODE_BGRA)
+{
+const int alpha = *(pixel + 3);
+char buf[3];
+if (alpha == 0)
+{
+buf[0] = 0;
+buf[1] = 0;
+buf[2] = 0;
+}
+else
+{
+buf[0] = (*(pixel + 2) * 255 + alpha / 2) / alpha;
+buf[1] = (*(pixel + 1) * 255 + alpha / 2) / alpha;
+buf[2] = (*(pixel + 0) * 255 + alpha / 2) / alpha;
+}
+
+ofs.write(buf, 3);
+}
+}
+}
+}
+
 int main( int argc, char* argv[] )
 {
 static const double origin = getTimeNow();
@@ -73,35 +116,42 @@ int main( int argc, char* argv[] )
 aTimes.emplace_back();
 
 const int max_parts = (argc > 3 ? atoi(argv[3]) : -1);
-const int max_tiles = (argc > 4 ? atoi(argv[4]) : -1);
+int max_tiles = (argc > 4 ? atoi(argv[4]) : -1);
+const bool dump = true;
 
 if (argv[2] != nullptr)
 {
 aTimes.emplace_back("load document");
 Document *pDocument(pOffice->documentLoad(argv[2]));
 aTimes.emplace_back();
+const int mode = pDocument->getTileMode();
 
 aTimes.emplace_back("getparts");
-const int nOriginalPart = pDocument->getPart();
+const int nOriginalPart = (pDocument->getDocumentType() == 
LOK_DOCTYPE_TEXT ? 1 : pDocument->getPart());
 // Writer really has 1 part (the full doc).
 const int nTotalParts = (pDocument->getDocumentType() == 
LOK_DOCTYPE_TEXT ? 1 : pDocument->getParts());
 const int nParts = (max_parts < 0 ? nTotalParts : std::min(max_parts, 
nTotalParts));
-fprintf(stderr, "Parts to render: %d, Total Parts: %d, Max parts: %d, 
Max tiles: %d\n", nParts, nTotalParts, max_parts, max_tiles);
 aTimes.emplace_back();
 
 aTimes.emplace_back("get size of parts");
+long nWidth = 0;
+long nHeight = 0;
 for (int n = 0; n < nParts; ++n)
 {
 const int nPart = (nOriginalPart + n) % nTotalParts;
 char* pName = pDocument->getPartName(nPart);
 pDocument->setPart(nPart);
-long nWidth = 0, nHeight = 0;
 pDocument->getDocumentSize(&nWidth, &nHeight);
 fprintf (stderr, "  '%s' -> %ld, %ld\n", pName, nWidth, nHeight);
 free (pName);
 }
 aTimes.emplace_back();
 
+// Estimate the maximum tiles based on the number of parts requested, 
if Writer.
+if (pDocument->getDocumentType() == LOK_DOCTYPE_TEXT)
+max_tiles = (int)ceil(max_parts * 16128. / nTilePixelHeight) * 
ceil((double)nWidth / nTilePixelWidth);
+fprintf(stderr, "Parts to render: %d, Total Parts: %d, Max parts: %d, 
Max tiles: %d\n", nParts, nTotalParts, max_parts, max_tiles);
+
 std::vector vBuffer(nTilePixelWidth * nTilePixelHeight 
* 4);
 unsigned char* pPixels = &vBuffer[0];
 
@@ -110,25 +160,25 @@ int main( int argc, char* argv[] )
 const int nPart = (nOriginalPart + n) % nTotalParts;
 char

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

2017-12-04 Thread Pranav Kant
 libreofficekit/qa/gtktiledviewer/gtv-helpers.cxx|   19 ---
 libreofficekit/qa/gtktiledviewer/gtv-helpers.hxx|   23 +++
 libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx |6 -
 libreofficekit/qa/gtktiledviewer/gtv-main-toolbar.cxx   |   60 
+-
 libreofficekit/qa/gtktiledviewer/gtv-main-toolbar.hxx   |8 -
 libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx|   34 
+
 libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.hxx|2 
 libreofficekit/qa/gtktiledviewer/gtv.ui |   49 
+++-
 8 files changed, 170 insertions(+), 31 deletions(-)

New commits:
commit 0d5ccc4eb114117b11f7ec53a2c75f9efcb4c651
Author: Pranav Kant 
Date:   Tue Nov 28 16:43:54 2017 +0530

gtv: Remember recently executed UNO commands

Saves the recently executed UNO commands in a temp file and make it
accessible to user in a combo box. Useful when debugging.

Change-Id: Ic66961a388cc59dee3f65cb8d4de3c29a8a75eaa
Reviewed-on: https://gerrit.libreoffice.org/45540
Tested-by: Jenkins 
Reviewed-by: pranavk 

diff --git a/libreofficekit/qa/gtktiledviewer/gtv-helpers.cxx 
b/libreofficekit/qa/gtktiledviewer/gtv-helpers.cxx
index 3c4457b38215..d2fcb979e3d3 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-helpers.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-helpers.cxx
@@ -146,23 +146,4 @@ const std::string GtvHelpers::getDirPath(const 
std::string& filePath)
 return dirPath;
 }
 
-const std::vector GtvHelpers::splitIntoIntegers(const std::string& 
aPayload, const std::string& aDelim, const int nItems)
-{
-std::vector aRet;
-
-if (!aPayload.empty())
-{
-gchar** ppCoordinates = g_strsplit(aPayload.c_str(), aDelim.c_str(), 
nItems);
-gchar** ppCoordinate  = ppCoordinates;
-while (*ppCoordinate)
-{
-aRet.push_back(atoi(*ppCoordinate));
-++ppCoordinate;
-}
-g_strfreev(ppCoordinates);
-}
-
-return aRet;
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/libreofficekit/qa/gtktiledviewer/gtv-helpers.hxx 
b/libreofficekit/qa/gtktiledviewer/gtv-helpers.hxx
index 9e984846f0ab..9474f4c0271a 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-helpers.hxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-helpers.hxx
@@ -39,7 +39,28 @@ namespace GtvHelpers
 
 const std::string getDirPath(const std::string& filePath);
 
-const std::vector splitIntoIntegers(const std::string& aPayload, 
const std::string& aDelim, const int nItems);
+template
+const std::vector split(const std::string& aPayload, const std::string& 
aDelim, const int nItems)
+{
+std::vector aRet;
+
+if (!aPayload.empty())
+{
+gchar** ppCoordinates = g_strsplit(aPayload.c_str(), 
aDelim.c_str(), nItems);
+gchar** ppCoordinate  = ppCoordinates;
+while (*ppCoordinate)
+{
+std::stringstream strstream(*ppCoordinate);
+T item;
+strstream >> item;
+aRet.push_back(item);
+++ppCoordinate;
+}
+g_strfreev(ppCoordinates);
+}
+
+return aRet;
+}
 }
 
 #endif
diff --git 
a/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx 
b/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx
index 79839aeccad2..2c97bd4d7393 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx
@@ -314,7 +314,7 @@ void LOKDocViewSigHandlers::dialog(LOKDocView* pDocView, 
gchar* pPayload, gpoint
 if (aAction == "created")
 {
 const std::string aSize = aRoot.get("size");
-std::vector aPoints = GtvHelpers::splitIntoIntegers(aSize, ", ", 
2);
+std::vector aPoints = GtvHelpers::split(aSize, ", ", 2);
 GtkWidget* pDialog = gtv_lok_dialog_new(pDocView, nDialogId, 
aPoints[0], aPoints[1]);
 g_info("created  dialog, for dialogid: %d with size: %s", nDialogId, 
aSize.c_str());
 
@@ -345,7 +345,7 @@ void LOKDocViewSigHandlers::dialog(LOKDocView* pDocView, 
gchar* pPayload, gpoint
 else if (aAction == "size_changed")
 {
 const std::string aSize = aRoot.get("size");
-std::vector aSizePoints = 
GtvHelpers::splitIntoIntegers(aSize, ", ", 2);
+std::vector aSizePoints = GtvHelpers::split(aSize, 
", ", 2);
 if (aSizePoints.size() != 2)
 {
 g_error("Malformed size_changed callback");
@@ -366,7 +366,7 @@ void LOKDocViewSigHandlers::dialog(LOKDocView* pDocView, 
gchar* pPayload, gpoint
 try
 {
 const std::string aRectangle = 
aRoot.get("rectangle");
-std::vector aRectPoints = 
GtvHelpe

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

2017-11-14 Thread Ashod Nakashian
 libreofficekit/qa/gtktiledviewer/gtv.ui |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit a3f432a68733b6e76ecb68cf5704a59d1be1e5cb
Author: Ashod Nakashian 
Date:   Tue Nov 14 09:17:59 2017 -0500

gtktiledviewer downgrade min gtk+ to 3.16

Change-Id: Ieb964ec1bbdeb632bd771db9b773f64b78107fc5
Reviewed-on: https://gerrit.libreoffice.org/44724
Reviewed-by: pranavk 
Tested-by: pranavk 

diff --git a/libreofficekit/qa/gtktiledviewer/gtv.ui 
b/libreofficekit/qa/gtktiledviewer/gtv.ui
index ab93d0d48105..7030ecaead5b 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv.ui
+++ b/libreofficekit/qa/gtktiledviewer/gtv.ui
@@ -1,7 +1,7 @@
 
 
 
-  
+  
   
 True
 False
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-10-30 Thread Andrea Gelmini
 libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 26dce73a1a7005c4d5359b6d1f6b56b5f0b43378
Author: Andrea Gelmini 
Date:   Sun Oct 29 08:06:20 2017 +0100

Fix typo

Change-Id: I51351518d4df9fbe44f70cbcea92b360f1acc94a
Reviewed-on: https://gerrit.libreoffice.org/44060
Tested-by: Jenkins 
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx 
b/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx
index f65f2f023bef..2a3d1a9d9cd9 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx
@@ -87,7 +87,7 @@ gtv_lok_dialog_draw(GtkWidget* pDialogDrawingArea, cairo_t* 
pCairo, gpointer)
 GtvLokDialog* pDialog = 
GTV_LOK_DIALOG(gtk_widget_get_toplevel(pDialogDrawingArea));
 GtvLokDialogPrivate* priv = getPrivate(pDialog);
 
-g_info("panting dialog");
+g_info("painting dialog");
 int nWidth = 1024;
 int nHeight = 768;
 cairo_surface_t* pSurface = 
cairo_image_surface_create(CAIRO_FORMAT_ARGB32, nWidth, nHeight);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-10-28 Thread Pranav Kant
 libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit 79fa071767c7c6b88950b82143fa76df63b172e6
Author: Pranav Kant 
Date:   Thu Oct 26 15:25:41 2017 -0700

lokdialog: Clear the pointer after destroying

Change-Id: Iebbe3fab6f6144f0cf1de9a1c45a0b2a62b07e0b
Reviewed-on: https://gerrit.libreoffice.org/43958
Tested-by: Jenkins 
Reviewed-by: pranavk 

diff --git a/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx 
b/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx
index b0d86bddb6e8..6948b842f633 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx
@@ -643,7 +643,10 @@ void gtv_lok_dialog_child_close(GtvLokDialog* dialog)
 
 GtvLokDialogPrivate* priv = getPrivate(dialog);
 if (priv->pFloatingWin)
+{
 gtk_widget_destroy(priv->pFloatingWin);
+priv->pFloatingWin = nullptr;
+}
 }
 
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-10-02 Thread Andrea Gelmini
 libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx  |2 +-
 libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx |2 +-
 sw/source/core/edit/edfcol.cxx   |4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 7d843ea451cfe25b85528b2e2164a9411f6f245d
Author: Andrea Gelmini 
Date:   Mon Oct 2 17:39:31 2017 +0200

Fix typos

Change-Id: I325141f90104496c62af8704d75568df3418952a
Reviewed-on: https://gerrit.libreoffice.org/43050
Reviewed-by: Julien Nabet 
Tested-by: Julien Nabet 

diff --git a/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx 
b/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx
index c7f5bfe39e10..9ea7632ba6cc 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx
@@ -88,7 +88,7 @@ gtv_lok_dialog_draw(GtkWidget* pDialogDrawingArea, cairo_t* 
pCairo, gpointer)
 GtvLokDialogPrivate* priv = getPrivate(pDialog);
 
 
-g_info("panting dialog");
+g_info("painting dialog");
 int nWidth = 1024;
 int nHeight = 768;
 cairo_surface_t* pSurface = 
cairo_image_surface_create(CAIRO_FORMAT_ARGB32, nWidth, nHeight);
diff --git a/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx 
b/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx
index 6ca78a61a2b2..4ce48746cc64 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx
@@ -293,7 +293,7 @@ void changePartMode( GtkWidget* pSelector, gpointer /* 
pItem */ )
 static gboolean deleteLokDialog(GtkWidget* pWidget, GdkEvent* /*event*/, 
gpointer userdata)
 {
 GtvApplicationWindow* window = GTV_APPLICATION_WINDOW(userdata);
-g_info("deletLokDialog");
+g_info("deleteLokDialog");
 gtv_application_window_unregister_child_window(window, 
GTK_WINDOW(pWidget));
 
 return FALSE;
diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx
index 0d7523252d75..920e25032cee 100644
--- a/sw/source/core/edit/edfcol.cxx
+++ b/sw/source/core/edit/edfcol.cxx
@@ -239,7 +239,7 @@ std::pair lcl_getFieldRDF(const 
uno::Reference& xModel,
const 
uno::Reference& xField)
 {
@@ -333,7 +333,7 @@ void lcl_RemoveParagraphMetadataField(const 
uno::Reference& 
xModel,
 const 
uno::Reference& xField,
 const OUString& sKey = OUString())
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-09-22 Thread Tamás Zolnai
 libreofficekit/qa/gtktiledviewer/gtv-application.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 7df3faa8ebb05cdc36113d07910498d4ba180856
Author: Tamás Zolnai 
Date:   Fri Sep 22 15:36:21 2017 +0200

Fix gtktiledviewer crash: this should be a null terminated list

Change-Id: I06e0923980b98b37b06ab45d8db68424b01d4f71
Reviewed-on: https://gerrit.libreoffice.org/42645
Reviewed-by: pranavk 
Tested-by: pranavk 

diff --git a/libreofficekit/qa/gtktiledviewer/gtv-application.cxx 
b/libreofficekit/qa/gtktiledviewer/gtv-application.cxx
index 88106ae6b583..ba1096c538ec 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-application.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-application.cxx
@@ -50,7 +50,8 @@ gtv_application_init(GtvApplication* app)
 { "enable-tiled-annotations", 0, 0, G_OPTION_ARG_NONE, nullptr, 
"Whether tiled annotations should be enabled", nullptr },
 { "background-color", 0, 0, G_OPTION_ARG_STRING, nullptr, "Background 
color", nullptr },
 { "hide-page-shadow", 0, 0, G_OPTION_ARG_NONE, nullptr, "Hide page 
shadow", nullptr },
-{ "hide-whitespace", 0, 0, G_OPTION_ARG_NONE, nullptr, "Hide 
whitespace", nullptr }
+{ "hide-whitespace", 0, 0, G_OPTION_ARG_NONE, nullptr, "Hide 
whitespace", nullptr },
+{ nullptr, 0, 0, G_OPTION_ARG_NONE, nullptr, nullptr, nullptr },
 };
 
 g_application_add_main_option_entries(G_APPLICATION(app), 
commandLineOptions);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-07-18 Thread Pranav Kant
 libreofficekit/qa/gtktiledviewer/gtv-application.cxx |   14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

New commits:
commit ecba18e226b4b03a4b2af99d92097f1d1b71467a
Author: Pranav Kant 
Date:   Tue Jul 18 12:17:24 2017 +0530

gtv: G_OPTION_FLAG_NONE is available since 2.42 only

Change-Id: Ic3aacb79a3e828e59fede437213f2b7298e49bc1

diff --git a/libreofficekit/qa/gtktiledviewer/gtv-application.cxx 
b/libreofficekit/qa/gtktiledviewer/gtv-application.cxx
index b43c187dd3fd..88106ae6b583 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-application.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-application.cxx
@@ -44,13 +44,13 @@ gtv_application_init(GtvApplication* app)
 {
 static const GOptionEntry commandLineOptions[] =
 {
-{ "version", 0, G_OPTION_FLAG_NONE, G_OPTION_ARG_NONE, nullptr, "Show 
LOkit version", nullptr },
-{ "lo-path", 0, G_OPTION_FLAG_NONE, G_OPTION_ARG_STRING, nullptr, "LO 
path", nullptr },
-{ "user-profile", 0, G_OPTION_FLAG_NONE, G_OPTION_ARG_STRING, nullptr, 
"User profile to use", nullptr },
-{ "enable-tiled-annotations", 0, G_OPTION_FLAG_NONE, 
G_OPTION_ARG_NONE, nullptr, "Whether tiled annotations should be enabled", 
nullptr },
-{ "background-color", 0, G_OPTION_FLAG_NONE, G_OPTION_ARG_STRING, 
nullptr, "Background color", nullptr },
-{ "hide-page-shadow", 0, G_OPTION_FLAG_NONE, G_OPTION_ARG_NONE, 
nullptr, "Hide page shadow", nullptr },
-{ "hide-whitespace", 0, G_OPTION_FLAG_NONE, G_OPTION_ARG_NONE, 
nullptr, "Hide whitespace", nullptr }
+{ "version", 0, 0, G_OPTION_ARG_NONE, nullptr, "Show LOkit version", 
nullptr },
+{ "lo-path", 0, 0, G_OPTION_ARG_STRING, nullptr, "LO path", nullptr },
+{ "user-profile", 0, 0, G_OPTION_ARG_STRING, nullptr, "User profile to 
use", nullptr },
+{ "enable-tiled-annotations", 0, 0, G_OPTION_ARG_NONE, nullptr, 
"Whether tiled annotations should be enabled", nullptr },
+{ "background-color", 0, 0, G_OPTION_ARG_STRING, nullptr, "Background 
color", nullptr },
+{ "hide-page-shadow", 0, 0, G_OPTION_ARG_NONE, nullptr, "Hide page 
shadow", nullptr },
+{ "hide-whitespace", 0, 0, G_OPTION_ARG_NONE, nullptr, "Hide 
whitespace", nullptr }
 };
 
 g_application_add_main_option_entries(G_APPLICATION(app), 
commandLineOptions);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-07-14 Thread Pranav Kant
 libreofficekit/qa/gtktiledviewer/gtv-application-window.hxx |2 +-
 libreofficekit/qa/gtktiledviewer/gtv-application.hxx|2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 5850debba42bc5ce65ec8363a5381a9d8d2cdaea
Author: Pranav Kant 
Date:   Fri Jul 14 16:47:40 2017 +0530

gtktiledviewer: Typo; these should be classes

Change-Id: Iba449fc66423959340c7967c64bc422a28fc75dd

diff --git a/libreofficekit/qa/gtktiledviewer/gtv-application-window.hxx 
b/libreofficekit/qa/gtktiledviewer/gtv-application-window.hxx
index 21a84e37cdac..ec3b0666d76d 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-application-window.hxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-application-window.hxx
@@ -70,7 +70,7 @@ struct GtvApplicationWindow
 
 struct GtvApplicationWindowClass
 {
-GtkApplicationWindow parentClass;
+GtkApplicationWindowClass parentClass;
 };
 
 GType gtv_application_window_get_type   (void) G_GNUC_CONST;
diff --git a/libreofficekit/qa/gtktiledviewer/gtv-application.hxx 
b/libreofficekit/qa/gtktiledviewer/gtv-application.hxx
index b04e16cb3631..660350366240 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-application.hxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-application.hxx
@@ -28,7 +28,7 @@ struct GtvApplication
 
 struct GtvApplicationClass
 {
-GtkApplication parentClass;
+GtkApplicationClass parentClass;
 };
 
 GType gtv_application_get_type   (void) G_GNUC_CONST;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-04-11 Thread Miklos Vajna
 libreofficekit/qa/unit/tiledrendering.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 84ed9adab673ff6d97ce634daf64f4e8bd0d00c1
Author: Miklos Vajna 
Date:   Tue Apr 11 20:36:30 2017 +0200

CppunitTest_libreofficekit_tiledrendering: add more processEventsToIdle 
calls

With this the test passes for me 10 times in a row, while previously it
failed from time to time, hopefully this fixes the false negatives.

Change-Id: I233276ddfe4e9d8c86557f7f1c29d997f2fb51f6
Reviewed-on: https://gerrit.libreoffice.org/36420
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins 

diff --git a/libreofficekit/qa/unit/tiledrendering.cxx 
b/libreofficekit/qa/unit/tiledrendering.cxx
index a805121992e5..77d149d6b346 100644
--- a/libreofficekit/qa/unit/tiledrendering.cxx
+++ b/libreofficekit/qa/unit/tiledrendering.cxx
@@ -273,6 +273,7 @@ void TiledRenderingTest::testDocumentLoadLanguage(Office* 
pOffice)
 
 pDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, css::awt::Key::RETURN);
 pDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, css::awt::Key::RETURN);
+processEventsToIdle();
 pDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, css::awt::Key::UP);
 pDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, css::awt::Key::UP);
 processEventsToIdle();
@@ -300,6 +301,7 @@ void TiledRenderingTest::testDocumentLoadLanguage(Office* 
pOffice)
 
 pDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, css::awt::Key::RETURN);
 pDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, css::awt::Key::RETURN);
+processEventsToIdle();
 pDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, css::awt::Key::UP);
 pDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, css::awt::Key::UP);
 processEventsToIdle();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-03-06 Thread Michael Stahl
 libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx |9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

New commits:
commit 45dd570ac474c336cceac1ca2792f243ee125fa2
Author: Michael Stahl 
Date:   Mon Mar 6 13:13:52 2017 +0100

libreofficekit: GTK 3.22 deprecates gtk_show_uri

Avoid -Werror=deprecated-declaration and use
gtk_show_uri_on_window instead, which needs a GtkWindow.

Change-Id: Ia77978348809c8d88cb2823a1549cbdeffcc6c97
Reviewed-on: https://gerrit.libreoffice.org/34926
Reviewed-by: pranavk 
Tested-by: pranavk 

diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx 
b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index 0ad1c2e..ed1d7f1 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -1525,10 +1525,17 @@ static void signalPart(LOKDocView* pLOKDocView, int 
nPart, gpointer /*pData*/)
 }
 
 /// User clicked on a command button -> inform LOKDocView.
-static void signalHyperlink(LOKDocView* /*pLOKDocView*/, char* pPayload, 
gpointer /*pData*/)
+static void signalHyperlink(LOKDocView* pLOKDocView, char* pPayload, gpointer 
/*pData*/)
 {
 GError* pError = nullptr;
+#if GTK_CHECK_VERSION(3,22,0)
+gtk_show_uri_on_window(
+GTK_WINDOW (gtk_widget_get_toplevel(GTK_WIDGET(pLOKDocView))),
+pPayload, GDK_CURRENT_TIME, &pError);
+#else
+(void) pLOKDocView;
 gtk_show_uri(nullptr, pPayload, GDK_CURRENT_TIME, &pError);
+#endif
 if (pError != nullptr)
 {
 g_warning("Unable to show URI %s : %s", pPayload, pError->message);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-02-20 Thread Pranav Kant
 libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx |7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

New commits:
commit 57d75ba3176063249e27524a7c7e425b3a2e75b4
Author: Pranav Kant 
Date:   Mon Feb 20 11:27:53 2017 +0530

gtktiledviewer: Different reply uno command for impress

Change-Id: I9dcd32a7e64198ca4772f263ed89a458e298c53b

diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx 
b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index c8bf3ee..59faff1 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -330,7 +330,12 @@ static void replyButtonClicked(GtkWidget* pWidget, 
gpointer userdata)
 boost::property_tree::write_json(aStream, aTree);
 std::string aArguments = aStream.str();
 
-lok_doc_view_post_command(LOK_DOC_VIEW(rWindow.m_pDocView), 
".uno:ReplyComment", aArguments.c_str(), false);
+// Different reply UNO command for impress
+std::string replyCommand = ".uno:ReplyComment";
+LibreOfficeKitDocument* pDocument = 
lok_doc_view_get_document(LOK_DOC_VIEW(rWindow.m_pDocView));
+if (pDocument && pDocument->pClass->getDocumentType(pDocument) == 
LOK_DOCTYPE_PRESENTATION)
+replyCommand = ".uno:ReplyToAnnotation";
+lok_doc_view_post_command(LOK_DOC_VIEW(rWindow.m_pDocView), 
replyCommand.c_str(), aArguments.c_str(), false);
 }
 
 static void deleteCommentButtonClicked(GtkWidget* pWidget, gpointer userdata)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-01-31 Thread Pranav Kant
 libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx |   14 --
 1 file changed, 12 insertions(+), 2 deletions(-)

New commits:
commit 96f597acf70ce52f2bdb59c85dd052be54b8d629
Author: Pranav Kant 
Date:   Tue Jan 31 19:35:49 2017 +0530

gtktiledviewer: gtk version checks

There is no major harm in excluding these lines of code on
platforms with older gtk.

Change-Id: Ica3f1e2b4f60f0bab55254632663ace7b4c61d4d

diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx 
b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index 4307426..675341f 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -258,8 +258,9 @@ static void userPromptDialog(GtkWidget* pDocView, const 
std::string& aTitle, std
 for (const auto& entry : aEntries)
 {
 GtkWidget* pEntry = gtk_entry_new();
+#if GTK_CHECK_VERSION(3,2,0)
 gtk_entry_set_placeholder_text(GTK_ENTRY(pEntry), entry.first.c_str());
-
+#endif
 gtk_container_add(GTK_CONTAINER(pEntryArea), pEntry);
 }
 
@@ -447,9 +448,11 @@ gboolean CommentsSidebar::docConfigureEvent(GtkWidget* 
pDocView, GdkEventConfigu
 gtk_container_add(GTK_CONTAINER(rWindow.m_pMainHBox), 
rWindow.m_pCommentsSidebar->m_pMainVBox);
 
 rWindow.m_pCommentsSidebar->m_pViewAnnotationsButton = 
gtk_button_new_with_label(".uno:ViewAnnotations");
+#if GTK_CHECK_VERSION(3,12,0)
 // Hack to make sidebar grid wide enough to not need any 
horizontal scrollbar
 
gtk_widget_set_margin_start(rWindow.m_pCommentsSidebar->m_pViewAnnotationsButton,
 20);
 
gtk_widget_set_margin_end(rWindow.m_pCommentsSidebar->m_pViewAnnotationsButton, 
20);
+#endif
 
gtk_container_add(GTK_CONTAINER(rWindow.m_pCommentsSidebar->m_pMainVBox), 
rWindow.m_pCommentsSidebar->m_pViewAnnotationsButton);
 
g_signal_connect(rWindow.m_pCommentsSidebar->m_pViewAnnotationsButton, 
"clicked", G_CALLBACK(CommentsSidebar::unoViewAnnotations), nullptr);
 
@@ -691,15 +694,21 @@ static void addMoreUnoParam(GtkWidget* /*pWidget*/, 
gpointer userdata)
 
 GtkWidget* pTypeEntry = gtk_entry_new();
 gtk_box_pack_start(GTK_BOX(pParamContainer), pTypeEntry, TRUE, TRUE, 2);
+#if GTK_CHECK_VERSION(3,2,0)
 gtk_entry_set_placeholder_text(GTK_ENTRY(pTypeEntry), "Param type (Eg. 
boolean, string etc.)");
+#endif
 
 GtkWidget* pNameEntry = gtk_entry_new();
 gtk_box_pack_start(GTK_BOX(pParamContainer), pNameEntry, TRUE, TRUE, 2);
+#if GTK_CHECK_VERSION(3,2,0)
 gtk_entry_set_placeholder_text(GTK_ENTRY(pNameEntry), "Param name");
+#endif
 
 GtkWidget* pValueEntry = gtk_entry_new();
 gtk_box_pack_start(GTK_BOX(pParamContainer), pValueEntry, TRUE, TRUE, 2);
+#if GTK_CHECK_VERSION(3,2,0)
 gtk_entry_set_placeholder_text(GTK_ENTRY(pValueEntry), "Param value");
+#endif
 
 GtkWidget* pRemoveButton = 
gtk_button_new_from_icon_name("list-remove-symbolic", GTK_ICON_SIZE_BUTTON);
 g_signal_connect(pRemoveButton, "clicked", G_CALLBACK(removeUnoParam), 
pUnoParamAreaBox);
@@ -942,8 +951,9 @@ static void unoCommandDebugger(GtkWidget* pButton, gpointer 
/* pItem */)
 
 GtkWidget* pUnoCmdEntry = gtk_entry_new ();
 gtk_box_pack_start(GTK_BOX(pUnoCmdAreaBox), pUnoCmdEntry, TRUE, TRUE, 2);
+#if GTK_CHECK_VERSION(3,2,0)
 gtk_entry_set_placeholder_text(GTK_ENTRY(pUnoCmdEntry), "UNO command (Eg. 
Bold, Italic etc.)");
-
+#endif
 GtkWidget* pUnoParamAreaBox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
 gtk_box_pack_start(GTK_BOX(pDialogMessageArea), pUnoParamAreaBox, TRUE, 
TRUE, 2);
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-01-28 Thread Caolán McNamara
 libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit e073bb9c3ea2f7d03a7cf0759efc70edf84fc033
Author: Caolán McNamara 
Date:   Sat Jan 28 21:29:54 2017 +

coverity#1351757 Uninitialized pointer field

Change-Id: Ieeae560fc6b6c82ef92ad5331cc6cddacb893a19

diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx 
b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index 8286b18..6ea864b 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -196,6 +196,7 @@ public:
 m_pScrolledWindow(nullptr),
 m_bToolItemBroadcast(true),
 m_pVBox(nullptr),
+m_pMainHBox(nullptr),
 m_pPartSelector(nullptr),
 m_pPartModeComboBox(nullptr),
 m_bPartSelectorBroadcast(true),
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-01-27 Thread Pranav Kant
 libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx |   23 +++--
 libreofficekit/source/gtk/lokdocview.cxx|   27 +++-
 2 files changed, 42 insertions(+), 8 deletions(-)

New commits:
commit 3616f875b014b7d58f81cd871ff7bbf9fd6c78d5
Author: Pranav Kant 
Date:   Tue Jan 24 17:41:54 2017 +0530

lokdocview: Separate gobject property for turning off comments

Pass --enable-tiled-annotations to gtktiledviewer on command line
to turn comments on again, by default they are turned off now.

Change-Id: I40e93ab683ec9538e088ae9aa83cda2eaaf9939e
Reviewed-on: https://gerrit.libreoffice.org/33622
Reviewed-by: pranavk 
Tested-by: pranavk 

diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx 
b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index cb32cd6..c2faacd 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -288,7 +288,11 @@ gboolean CommentsSidebar::docConfigureEvent(GtkWidget* 
pDocView, GdkEventConfigu
 TiledWindow& rWindow = lcl_getTiledWindow(pDocView);
 LibreOfficeKitDocument* pDocument = 
lok_doc_view_get_document(LOK_DOC_VIEW(pDocView));
 
-if (pDocument && pDocument->pClass->getDocumentType(pDocument) == 
LOK_DOCTYPE_TEXT)
+// whether tield rendering is turned on
+gboolean bTiledAnnotations;
+g_object_get(G_OBJECT(pDocView), "tiled-annotations", &bTiledAnnotations, 
nullptr);
+
+if (!bTiledAnnotations && pDocument && 
pDocument->pClass->getDocumentType(pDocument) == LOK_DOCTYPE_TEXT)
 {
 if (!rWindow.m_pCommentsSidebar)
 {
@@ -933,19 +937,20 @@ static void toggleFindbar(GtkWidget* pButton, gpointer 
/*pItem*/)
 }
 
 static void
-setLOKFeatures (GtkWidget* pDocView)
+setLOKFeatures (GtkWidget* pDocView, gboolean bTiledAnnotations)
 {
 g_object_set(G_OBJECT(pDocView),
  "doc-password", TRUE,
  "doc-password-to-modify", TRUE,
+ "tiled-annotations", bTiledAnnotations,
  nullptr);
 }
 
 /// Common initialization, regardless if it's just a new view or a full init.
-static TiledWindow& setupWidgetAndCreateWindow(GtkWidget* pDocView)
+static TiledWindow& setupWidgetAndCreateWindow(GtkWidget* pDocView, gboolean 
bTiledAnnotations)
 {
 setupDocView(pDocView);
-setLOKFeatures(pDocView);
+setLOKFeatures(pDocView, bTiledAnnotations);
 TiledWindow aWindow;
 aWindow.m_pDocView = pDocView;
 GtkWidget* pWindow = createWindow(aWindow);
@@ -974,8 +979,9 @@ static void createView(GtkWidget* pButton, gpointer 
/*pItem*/)
 std::string aArguments = aStream.str();
 
 GtkWidget* pDocView = 
lok_doc_view_new_from_widget(LOK_DOC_VIEW(rWindow.m_pDocView), 
aArguments.c_str());
-
-TiledWindow& rNewWindow = setupWidgetAndCreateWindow(pDocView);
+gboolean bTiledAnnotations;
+g_object_get(G_OBJECT(rWindow.m_pDocView), "tiled-annotations", 
&bTiledAnnotations, nullptr);
+TiledWindow& rNewWindow = setupWidgetAndCreateWindow(pDocView, 
bTiledAnnotations);
 // Hide the unused progress bar.
 gtk_widget_show_all(rNewWindow.m_pStatusBar);
 gtk_widget_hide(rNewWindow.m_pProgressBar);
@@ -988,17 +994,20 @@ static void createView(GtkWidget* pButton, gpointer 
/*pItem*/)
 static void createModelAndView(const char* pLOPath, const char* pDocPath, 
const std::vector& rArguments)
 {
 std::string aUserProfile;
+gboolean bTiledAnnotations = FALSE;
 for (size_t i = 0; i < rArguments.size(); ++i)
 {
 const std::string& rArgument = rArguments[i];
 if (rArgument == "--user-profile" && i + 1 < rArguments.size())
 aUserProfile = std::string("vnd.sun.star.pathname:")
 + rArguments[i + 1].c_str();
+else if (rArgument == "--enable-tiled-annotations")
+bTiledAnnotations = TRUE;
 }
 const gchar* pUserProfile = aUserProfile.empty() ? nullptr : 
aUserProfile.c_str();
 GtkWidget* pDocView = lok_doc_view_new_from_user_profile(pLOPath, 
pUserProfile, nullptr, nullptr);
 
-TiledWindow& rWindow = setupWidgetAndCreateWindow(pDocView);
+TiledWindow& rWindow = setupWidgetAndCreateWindow(pDocView, 
bTiledAnnotations);
 
 boost::property_tree::ptree aTree;
 for (size_t i = 0; i < rArguments.size(); ++i)
diff --git a/libreofficekit/source/gtk/lokdocview.cxx 
b/libreofficekit/source/gtk/lokdocview.cxx
index 1cd2c05..80d40f5 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -299,6 +299,7 @@ enum
 PROP_CAN_ZOOM_OUT,
 PROP_DOC_PASSWORD,
 PROP_DOC_PASSWORD_TO_MODIFY,
+PROP_TILED_ANNOTATIONS,
 
 PROP_LAST
 };
@@ -2465,6 +2466,7 @@ static void lok_doc_view_set_property (GObject* object, 
guint propId, const GVal
 LOKDocViewPrivate& priv = getPrivate(pDocView);
 gboolean bDocPasswordEnabled = priv->m_nLOKFeatures & 
LOK_FEATURE_DOCUMENT_PASSWORD;
 gboolean b

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

2017-01-27 Thread Pranav Kant
 libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx |   98 +++-
 1 file changed, 96 insertions(+), 2 deletions(-)

New commits:
commit 99a2a1f975da68c33ec213fab0f9cf75c31b49c8
Author: Pranav Kant 
Date:   Tue Jan 24 17:08:33 2017 +0530

gtktiledviewer: Comments sidebar

Change-Id: Icf5bb78859668bfb5c43efc3e5fa9afce8458f41
Reviewed-on: https://gerrit.libreoffice.org/33621
Reviewed-by: pranavk 
Tested-by: pranavk 

diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx 
b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index 03f0852..cb32cd6 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -40,6 +40,24 @@ static int help()
 return 1;
 }
 
+/// Represents the comment sidebar widget (only for text documents as of now)
+class CommentsSidebar
+{
+public:
+/// Main Vertical Box containing comments box and additional controls (eg. 
buttons)
+GtkWidget* m_pMainVBox;
+/// Button to issue a .uno:ViewAnnotations command
+GtkWidget* m_pViewAnnotationsButton;
+/// top level container for all comments in the sidebar
+GtkWidget* m_pCommentsVBox;
+
+/// Click even handler for m_pViewAnnotationsButton
+static void unoViewAnnotations(GtkWidget* pWidget, gpointer userdata);
+/// Configure event handler for window
+static gboolean docConfigureEvent(GtkWidget* pWidget, GdkEventConfigure* 
pEvent, gpointer pData);
+};
+
+
 /// Represents the row or column header widget for spreadsheets.
 class TiledRowColumnBar
 {
@@ -128,6 +146,7 @@ public:
 std::map m_aToolItemSensitivities;
 bool m_bToolItemBroadcast;
 GtkWidget* m_pVBox;
+GtkWidget* m_pMainHBox;
 GtkComboBoxText* m_pPartSelector;
 GtkWidget* m_pPartModeComboBox;
 /// Should the part selector avoid calling lok::Document::setPart()?
@@ -139,6 +158,7 @@ public:
 std::shared_ptr m_pRowBar;
 std::shared_ptr m_pColumnBar;
 std::shared_ptr m_pCornerButton;
+std::shared_ptr m_pCommentsSidebar;
 /// Rendering arguments, which are the same for all views.
 boost::property_tree::ptree m_aRenderingArguments;
 
@@ -218,6 +238,75 @@ static void lcl_registerToolItem(TiledWindow& rWindow, 
GtkToolItem* pItem, const
 rWindow.m_aToolItemSensitivities[pItem] = true;
 }
 
+void CommentsSidebar::unoViewAnnotations(GtkWidget* pWidget, gpointer 
/*userdata*/)
+{
+TiledWindow& rWindow = lcl_getTiledWindow(pWidget);
+
+LibreOfficeKitDocument* pDocument = 
lok_doc_view_get_document(LOK_DOC_VIEW(rWindow.m_pDocView));
+char* pValues = pDocument->pClass->getCommandValues(pDocument, 
".uno:ViewAnnotations");
+g_info("lok::Document::getCommandValues(%s) : %s", ".uno:ViewAnnotations", 
pValues);
+std::stringstream aStream(pValues);
+free(pValues);
+
+gtk_widget_destroy(rWindow.m_pCommentsSidebar->m_pCommentsVBox);
+
+rWindow.m_pCommentsSidebar->m_pCommentsVBox = 
gtk_box_new(GTK_ORIENTATION_VERTICAL, 2);
+gtk_container_add(GTK_CONTAINER(rWindow.m_pCommentsSidebar->m_pMainVBox), 
rWindow.m_pCommentsSidebar->m_pCommentsVBox);
+
+boost::property_tree::ptree aTree;
+boost::property_tree::read_json(aStream, aTree);
+try
+{
+for (boost::property_tree::ptree::value_type& rValue : 
aTree.get_child("comments"))
+{
+GtkWidget* pCommentVBox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 1);
+
gtk_container_add(GTK_CONTAINER(rWindow.m_pCommentsSidebar->m_pCommentsVBox), 
pCommentVBox);
+
+GtkWidget* pCommentText = 
gtk_label_new(rValue.second.get("text").c_str());
+GtkWidget* pCommentAuthor = 
gtk_label_new(rValue.second.get("author").c_str());
+GtkWidget* pCommentDate = 
gtk_label_new(rValue.second.get("dateTime").c_str());
+GtkWidget* pCommentSeparator = 
gtk_separator_new(GTK_ORIENTATION_HORIZONTAL);
+
+gtk_container_add(GTK_CONTAINER(pCommentVBox), pCommentText);
+gtk_container_add(GTK_CONTAINER(pCommentVBox), pCommentAuthor);
+gtk_container_add(GTK_CONTAINER(pCommentVBox), pCommentDate);
+gtk_container_add(GTK_CONTAINER(pCommentVBox), pCommentSeparator);
+
+gtk_label_set_line_wrap(GTK_LABEL(pCommentText), TRUE);
+gtk_label_set_max_width_chars(GTK_LABEL(pCommentText), 35);
+}
+gtk_widget_show_all(rWindow.m_pCommentsSidebar->m_pCommentsVBox);
+}
+catch(boost::property_tree::ptree_bad_path& rException)
+{
+std::cerr << "CommentsSidebar::unoViewAnnotations: failed to get 
comments" << rException.what() << std::endl;
+}
+}
+
+gboolean CommentsSidebar::docConfigureEvent(GtkWidget* pDocView, 
GdkEventConfigure* /*pEvent*/, gpointer /*userdata*/)
+{
+TiledWindow& rWindow = lcl_getTiledWindow(pDocView);
+LibreOfficeKitDocument* pDocument = 
lok_doc_view_get_document(LOK_DOC_VIEW(pDocView));
+
+if (pDocument && pDocument->pClass->getDocumentTyp

[Libreoffice-commits] core.git: libreofficekit/qa sw/qa

2017-01-27 Thread Miklos Vajna
 libreofficekit/qa/unit/tiledrendering.cxx |   16 
 sw/qa/core/test_ToxLinkProcessor.cxx  |4 ++--
 2 files changed, 10 insertions(+), 10 deletions(-)

New commits:
commit 777a15db74a48ec5341e5b835240db3050605649
Author: Miklos Vajna 
Date:   Fri Jan 27 09:13:31 2017 +0100

CppunitTest_libreofficekit_tiledrendering: fix cppunitassertequals warnings

Change-Id: I0fce00d4c794918e5b14b2c4f3f9f36231f28718
Reviewed-on: https://gerrit.libreoffice.org/33604
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins 

diff --git a/libreofficekit/qa/unit/tiledrendering.cxx 
b/libreofficekit/qa/unit/tiledrendering.cxx
index 1df2eff..5987d14 100644
--- a/libreofficekit/qa/unit/tiledrendering.cxx
+++ b/libreofficekit/qa/unit/tiledrendering.cxx
@@ -144,7 +144,7 @@ void TiledRenderingTest::testDocumentTypes( Office* pOffice 
)
 // FIXME: same comment as below wrt lockfile removal.
 remove( sPresentationLockFile.c_str() );
 
-CPPUNIT_ASSERT( getDocumentType( pOffice, sPresentationDocPath ) == 
LOK_DOCTYPE_PRESENTATION );
+CPPUNIT_ASSERT_EQUAL(LOK_DOCTYPE_PRESENTATION, 
static_cast(getDocumentType(pOffice, 
sPresentationDocPath)));
 
 // TODO: do this for all supported document types
 }
@@ -162,9 +162,9 @@ void TiledRenderingTest::testImpressSlideNames( Office* 
pOffice )
 
 std::unique_ptr< Document> pDocument( pOffice->documentLoad( 
sDocPath.c_str() ) );
 
-CPPUNIT_ASSERT( pDocument->getParts() == 3 );
-CPPUNIT_ASSERT( strcmp( pDocument->getPartName( 0 ), "TestText1" ) == 0 );
-CPPUNIT_ASSERT( strcmp( pDocument->getPartName( 1 ), "TestText2" ) == 0 );
+CPPUNIT_ASSERT_EQUAL(3, pDocument->getParts());
+CPPUNIT_ASSERT_EQUAL(std::string("TestText1"), 
std::string(pDocument->getPartName(0)));
+CPPUNIT_ASSERT_EQUAL(std::string("TestText2"), 
std::string(pDocument->getPartName(1)));
 // The third slide hasn't had a name given to it (i.e. using the rename
 // context menu in Impress), thus it should (as far as I can determine)
 // have a localised version of "Slide 3".
@@ -180,10 +180,10 @@ void TiledRenderingTest::testCalcSheetNames( Office* 
pOffice )
 
 std::unique_ptr< Document> pDocument( pOffice->documentLoad( 
sDocPath.c_str() ) );
 
-CPPUNIT_ASSERT( pDocument->getParts() == 3 );
-CPPUNIT_ASSERT( strcmp( pDocument->getPartName( 0 ), "TestText1" ) == 0 );
-CPPUNIT_ASSERT( strcmp( pDocument->getPartName( 1 ), "TestText2" ) == 0 );
-CPPUNIT_ASSERT( strcmp( pDocument->getPartName( 2 ), "Sheet3" ) == 0 );
+CPPUNIT_ASSERT_EQUAL(3, pDocument->getParts());
+CPPUNIT_ASSERT_EQUAL(std::string("TestText1"), 
std::string(pDocument->getPartName(0)));
+CPPUNIT_ASSERT_EQUAL(std::string("TestText2"), 
std::string(pDocument->getPartName(1)));
+CPPUNIT_ASSERT_EQUAL(std::string("Sheet3"), 
std::string(pDocument->getPartName(2)));
 }
 
 #if 0
diff --git a/sw/qa/core/test_ToxLinkProcessor.cxx 
b/sw/qa/core/test_ToxLinkProcessor.cxx
index d2d4721..d630979 100644
--- a/sw/qa/core/test_ToxLinkProcessor.cxx
+++ b/sw/qa/core/test_ToxLinkProcessor.cxx
@@ -73,7 +73,7 @@ 
ToxLinkProcessorTest::NoExceptionIsThrownIfTooManyLinksAreClosed()
 sut.CloseLink(2, URL_1);
 CPPUNIT_ASSERT_EQUAL(1u, static_cast(sut.m_ClosedLinks.size()));
 CPPUNIT_ASSERT_EQUAL(1u, 
static_cast(sut.m_ClosedLinks.at(0)->mEndTextPos));
-CPPUNIT_ASSERT_MESSAGE("no links are open", sut.m_pStartedLink == nullptr);
+CPPUNIT_ASSERT_MESSAGE("no links are open", !sut.m_pStartedLink);
 }
 
 void
@@ -87,7 +87,7 @@ 
ToxLinkProcessorTest::AddingAndClosingTwoOverlappingLinksResultsInOneClosedLink(
 // (for backward compatibility)
 sut.CloseLink(1, URL_2);
 CPPUNIT_ASSERT_EQUAL(1u, static_cast(sut.m_ClosedLinks.size()));
-CPPUNIT_ASSERT_MESSAGE("no links are open", sut.m_pStartedLink == nullptr);
+CPPUNIT_ASSERT_MESSAGE("no links are open", !sut.m_pStartedLink);
 // backward compatibility: the last start is closed by the first end
 CPPUNIT_ASSERT_EQUAL(STYLE_NAME_2, 
sut.m_ClosedLinks[0]->mINetFormat.GetINetFormat());
 CPPUNIT_ASSERT_EQUAL(URL_1, sut.m_ClosedLinks[0]->mINetFormat.GetValue());
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-01-23 Thread Pranav Kant
 libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 18fe7c8687182a1c5e6e497ec433d57b010d2e55
Author: Pranav Kant 
Date:   Mon Jan 23 23:14:20 2017 +0530

gtktiledviewer: Make edit mode the default one

This is a testing tool, most of the time developers want to do
something with the document to test some functionality, lets keep
edit mode on by default and save them a second.

Change-Id: I61bbd2b85054b7ebdd14e69ca170674e260368e5

diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx 
b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index b53789b..03f0852 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -1470,6 +1470,8 @@ static void openDocumentCallback (GObject* source_object, 
GAsyncResult* res, gpo
 
 gtk_widget_show_all(rWindow.m_pStatusBar);
 gtk_widget_hide(rWindow.m_pProgressBar);
+
+
gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(rWindow.m_pEnableEditing),
 TRUE);
 }
 
 /**
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-01-06 Thread Pranav Kant
 libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx |   22 +++-
 1 file changed, 8 insertions(+), 14 deletions(-)

New commits:
commit 29f697711e06b88fb8387518e7f8440cf49f0933
Author: Pranav Kant 
Date:   Fri Jan 6 15:57:43 2017 +0530

gtktiledviewer: Lets avoid using manual buffer sizes

Change-Id: I76e70ccb5b1f40193a1eda1cbca19b3444168dae

diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx 
b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index 3382987..3c774c1 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -375,23 +375,17 @@ gboolean TiledRowColumnBar::docConfigureEvent(GtkWidget* 
pDocView, GdkEventConfi
 gtk_widget_show(rWindow.m_pFormulabarEntry);
 
 // Change horizontal alignment uno commands for spreadsheet
-const char* unoHorAlignArgs =
+const std::string argsPrefix =
 "{"
 "\"HorizontalAlignment\":{"
 "\"type\":\"unsigned short\", "
-"\"value\":\"%d\""
-"}"
-"}";
-
-char unoHorAlignArgsFormatted[strlen(unoHorAlignArgs)];
-snprintf(unoHorAlignArgsFormatted, sizeof(unoHorAlignArgsFormatted), 
unoHorAlignArgs, 1);
-lcl_registerToolItem(rWindow, rWindow.m_pLeftpara, 
".uno:HorizontalAlignment", std::string(unoHorAlignArgsFormatted));
-snprintf(unoHorAlignArgsFormatted, sizeof(unoHorAlignArgsFormatted), 
unoHorAlignArgs, 2);
-lcl_registerToolItem(rWindow, rWindow.m_pCenterpara, 
".uno:HorizontalAlignment", std::string(unoHorAlignArgsFormatted));
-snprintf(unoHorAlignArgsFormatted, sizeof(unoHorAlignArgsFormatted), 
unoHorAlignArgs, 3);
-lcl_registerToolItem(rWindow, rWindow.m_pRightpara, 
".uno:HorizontalAlignment", std::string(unoHorAlignArgsFormatted));
-snprintf(unoHorAlignArgsFormatted, sizeof(unoHorAlignArgsFormatted), 
unoHorAlignArgs, 4);
-lcl_registerToolItem(rWindow, rWindow.m_pJustifypara, 
".uno:HorizontalAlignment", std::string(unoHorAlignArgsFormatted));
+"\"value\":\"";
+const std::string argsSuffix = "\"}}";
+
+lcl_registerToolItem(rWindow, rWindow.m_pLeftpara, 
".uno:HorizontalAlignment", argsPrefix + std::to_string(1) + argsSuffix);
+lcl_registerToolItem(rWindow, rWindow.m_pCenterpara, 
".uno:HorizontalAlignment", argsPrefix + std::to_string(2) + argsSuffix);
+lcl_registerToolItem(rWindow, rWindow.m_pRightpara, 
".uno:HorizontalAlignment", argsPrefix + std::to_string(3) + argsSuffix);
+lcl_registerToolItem(rWindow, rWindow.m_pJustifypara, 
".uno:HorizontalAlignment", argsPrefix + std::to_string(4) + argsSuffix);
 }
 
 return TRUE;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-01-06 Thread Pranav Kant
 libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx |   19 +++
 1 file changed, 19 insertions(+)

New commits:
commit 6ccd698371a8e88ea06ed0e144171dd1b6236aa7
Author: Pranav Kant 
Date:   Fri Jan 6 14:27:27 2017 +0530

gtktiledviewer: Override alignment buttons uno commands for calc

Use .uno:HorizontalAlignment instead of .uno:XXXPara for calc

Change-Id: I5af4fe62dc3075af4ba779499d062e6d91f21ecf
Reviewed-on: https://gerrit.libreoffice.org/32773
Reviewed-by: pranavk 
Tested-by: pranavk 

diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx 
b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index 2f75a65..3382987 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -373,6 +373,25 @@ gboolean TiledRowColumnBar::docConfigureEvent(GtkWidget* 
pDocView, GdkEventConfi
 gtk_widget_show(rWindow.m_pColumnBar->m_pDrawingArea);
 gtk_widget_queue_draw(rWindow.m_pColumnBar->m_pDrawingArea);
 gtk_widget_show(rWindow.m_pFormulabarEntry);
+
+// Change horizontal alignment uno commands for spreadsheet
+const char* unoHorAlignArgs =
+"{"
+"\"HorizontalAlignment\":{"
+"\"type\":\"unsigned short\", "
+"\"value\":\"%d\""
+"}"
+"}";
+
+char unoHorAlignArgsFormatted[strlen(unoHorAlignArgs)];
+snprintf(unoHorAlignArgsFormatted, sizeof(unoHorAlignArgsFormatted), 
unoHorAlignArgs, 1);
+lcl_registerToolItem(rWindow, rWindow.m_pLeftpara, 
".uno:HorizontalAlignment", std::string(unoHorAlignArgsFormatted));
+snprintf(unoHorAlignArgsFormatted, sizeof(unoHorAlignArgsFormatted), 
unoHorAlignArgs, 2);
+lcl_registerToolItem(rWindow, rWindow.m_pCenterpara, 
".uno:HorizontalAlignment", std::string(unoHorAlignArgsFormatted));
+snprintf(unoHorAlignArgsFormatted, sizeof(unoHorAlignArgsFormatted), 
unoHorAlignArgs, 3);
+lcl_registerToolItem(rWindow, rWindow.m_pRightpara, 
".uno:HorizontalAlignment", std::string(unoHorAlignArgsFormatted));
+snprintf(unoHorAlignArgsFormatted, sizeof(unoHorAlignArgsFormatted), 
unoHorAlignArgs, 4);
+lcl_registerToolItem(rWindow, rWindow.m_pJustifypara, 
".uno:HorizontalAlignment", std::string(unoHorAlignArgsFormatted));
 }
 
 return TRUE;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-01-06 Thread Pranav Kant
 libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx |   21 +++-
 1 file changed, 12 insertions(+), 9 deletions(-)

New commits:
commit 3ab6e2783bf7142729924cb95ca730404d0c54e1
Author: Pranav Kant 
Date:   Fri Jan 6 14:26:53 2017 +0530

gtktiledviewer: Support for posting arguments to uno commands

Change-Id: I5db217b525d0f976ef6a7840e370f8f6a21d60cb
Reviewed-on: https://gerrit.libreoffice.org/32772
Reviewed-by: pranavk 
Tested-by: pranavk 

diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx 
b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index 27c8e43..2f75a65 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -121,6 +121,7 @@ public:
 GtkWidget* m_pFormulabarEntry;
 GtkWidget* m_pScrolledWindow;
 std::map m_aToolItemCommandNames;
+std::map m_aToolItemCommandArgs;
 std::map m_aCommandNameToolItems;
 /// Sensitivity (enabled or disabled) or each tool item, ignoring edit
 /// state.
@@ -209,6 +210,14 @@ static std::string getNextAuthor()
 return std::string(pPasswd->pw_gecos) + " #" + std::to_string(++nCounter);
 }
 
+static void lcl_registerToolItem(TiledWindow& rWindow, GtkToolItem* pItem, 
const std::string& rName, const std::string& rArgs = "")
+{
+rWindow.m_aToolItemCommandNames[pItem] = rName;
+rWindow.m_aToolItemCommandArgs[pItem] = rArgs;
+rWindow.m_aCommandNameToolItems[rName] = pItem;
+rWindow.m_aToolItemSensitivities[pItem] = true;
+}
+
 TiledRowColumnBar::TiledRowColumnBar(TiledBarType eType)
 : m_pDrawingArea(gtk_drawing_area_new()),
 m_nSizePixel(0),
@@ -396,13 +405,6 @@ gboolean TiledCornerButton::drawImpl(GtkWidget* 
/*pWidget*/, cairo_t* pCairo)
 return FALSE;
 }
 
-static void lcl_registerToolItem(TiledWindow& rWindow, GtkToolItem* pItem, 
const std::string& rName)
-{
-rWindow.m_aToolItemCommandNames[pItem] = rName;
-rWindow.m_aCommandNameToolItems[rName] = pItem;
-rWindow.m_aToolItemSensitivities[pItem] = true;
-}
-
 const float fZooms[] = { 0.25, 0.5, 0.75, 1.0, 1.5, 2.0, 3.0, 5.0 };
 
 static void iterateUnoParams(GtkWidget* pWidget, gpointer userdata)
@@ -1332,12 +1334,13 @@ static void toggleToolItem(GtkWidget* pWidget, gpointer 
/*pData*/)
 LOKDocView* pLOKDocView = LOK_DOC_VIEW(rWindow.m_pDocView);
 GtkToolItem* pItem = GTK_TOOL_ITEM(pWidget);
 const std::string& rString = rWindow.m_aToolItemCommandNames[pItem];
-g_info("toggleToolItem: lok_doc_view_post_command('%s')", 
rString.c_str());
+const std::string& rArguments = rWindow.m_aToolItemCommandArgs[pItem];
+g_info("toggleToolItem: lok_doc_view_post_command('%s %s')", 
rString.c_str(), rArguments.c_str());
 
 // notify about the finished Save
 gboolean bNotify = (rString == ".uno:Save");
 
-lok_doc_view_post_command(pLOKDocView, rString.c_str(), 
/*pArguments=*/nullptr, bNotify);
+lok_doc_view_post_command(pLOKDocView, rString.c_str(), 
rArguments.c_str(), bNotify);
 }
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2016-09-23 Thread Pranav Kant
 libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx |   10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

New commits:
commit 4151c09d9a03731c3ffbb1314ead26dbd8edae85
Author: Pranav Kant 
Date:   Fri Sep 23 16:59:52 2016 +0530

gtktiledviewer: Wrap dialogs in a GtkScrolledWindow

Change-Id: I33be18779ea680f7a9c20814ca3c3d94d206900b

diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx 
b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index 385203d..27c8e43 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -487,7 +487,9 @@ static void documentRedline(GtkWidget* pButton, gpointer 
/*pItem*/)
  "Jump",
  GTK_RESPONSE_APPLY,
  nullptr);
+gtk_window_set_default_size(GTK_WINDOW(pDialog), 800, 600);
 GtkWidget* pContentArea = gtk_dialog_get_content_area(GTK_DIALOG 
(pDialog));
+GtkWidget* pScrolledWindow = gtk_scrolled_window_new(nullptr, nullptr);
 
 // Build the table.
 GtkTreeStore* pTreeStore = gtk_tree_store_new(6, G_TYPE_INT, 
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
@@ -515,7 +517,8 @@ static void documentRedline(GtkWidget* pButton, gpointer 
/*pItem*/)
   
nullptr);
 gtk_tree_view_append_column(GTK_TREE_VIEW(pTreeView), pColumn);
 }
-gtk_box_pack_start(GTK_BOX(pContentArea), pTreeView, TRUE, TRUE, 2);
+gtk_container_add(GTK_CONTAINER(pScrolledWindow), pTreeView);
+gtk_box_pack_start(GTK_BOX(pContentArea), pScrolledWindow, TRUE, TRUE, 2);
 
 // Show the dialog.
 gtk_widget_show_all(pDialog);
@@ -589,7 +592,9 @@ static void documentRepair(GtkWidget* pButton, gpointer 
/*pItem*/)
  "Jump to state",
  GTK_RESPONSE_OK,
  nullptr);
+gtk_window_set_default_size(GTK_WINDOW(pDialog), 800, 600);
 GtkWidget* pContentArea = gtk_dialog_get_content_area(GTK_DIALOG 
(pDialog));
+GtkWidget* pScrolledWindow = gtk_scrolled_window_new(nullptr, nullptr);
 
 // Build the table.
 GtkTreeStore* pTreeStore = gtk_tree_store_new(5, G_TYPE_STRING, 
G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
@@ -620,7 +625,8 @@ static void documentRepair(GtkWidget* pButton, gpointer 
/*pItem*/)
   
nullptr);
 gtk_tree_view_append_column(GTK_TREE_VIEW(pTreeView), pColumn);
 }
-gtk_box_pack_start(GTK_BOX(pContentArea), pTreeView, TRUE, TRUE, 2);
+gtk_container_add(GTK_CONTAINER(pScrolledWindow), pTreeView);
+gtk_box_pack_start(GTK_BOX(pContentArea), pScrolledWindow, TRUE, TRUE, 2);
 
 // Show the dialog.
 gtk_widget_show_all(pDialog);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2016-09-15 Thread Miklos Vajna
 libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx |9 --
 sw/qa/extras/uiwriter/uiwriter.cxx  |   30 ++--
 sw/sdi/swriter.sdi  |1 
 sw/source/uibase/uiview/view2.cxx   |   16 +-
 4 files changed, 49 insertions(+), 7 deletions(-)

New commits:
commit 84e91157c674b0b78b792fc1d4f841fe50b1dd9b
Author: Miklos Vajna 
Date:   Thu Sep 15 16:04:05 2016 +0200

sw: allow select of redline by index

Previously .uno:NextTrackedChange always worked by cursor position, but
redlines are stored in the redline table, so they have a unique index.
Allow specifying that index when invoking the command, and in that case
ignore the cursor position.

Change-Id: I7dbe8044feca8fcc48635482a22317b024f40ffa

diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx 
b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index 97b3350..2576f99 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -482,6 +482,8 @@ static void documentRedline(GtkWidget* pButton, gpointer 
/*pItem*/)
  GTK_RESPONSE_YES,
  "Reject",
  GTK_RESPONSE_NO,
+ "Jump",
+ GTK_RESPONSE_APPLY,
  nullptr);
 GtkWidget* pContentArea = gtk_dialog_get_content_area(GTK_DIALOG 
(pDialog));
 
@@ -518,7 +520,7 @@ static void documentRedline(GtkWidget* pButton, gpointer 
/*pItem*/)
 gint res = gtk_dialog_run(GTK_DIALOG(pDialog));
 
 // Dispatch the matching command, if necessary.
-if (res == GTK_RESPONSE_YES || res == GTK_RESPONSE_NO)
+if (res == GTK_RESPONSE_YES || res == GTK_RESPONSE_NO || res == 
GTK_RESPONSE_APPLY)
 {
 GtkTreeSelection* pSelection = 
gtk_tree_view_get_selection(GTK_TREE_VIEW(pTreeView));
 GtkTreeIter aTreeIter;
@@ -531,8 +533,11 @@ static void documentRedline(GtkWidget* pButton, gpointer 
/*pItem*/)
 std::string aCommand;
 if (res == GTK_RESPONSE_YES)
 aCommand = ".uno:AcceptTrackedChange";
-else
+else if (res == GTK_RESPONSE_NO)
 aCommand = ".uno:RejectTrackedChange";
+else
+// Just select the given redline, don't accept or reject it.
+aCommand = ".uno:NextTrackedChange";
 // Without the '.uno:' prefix.
 std::string aKey = aCommand.substr(strlen(".uno:"));
 
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx 
b/sw/qa/extras/uiwriter/uiwriter.cxx
index 8d0ed48..5080f37 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -3853,15 +3853,39 @@ void SwUiWriterTest::testRedlineParam()
 pWrtShell->EndDoc();
 pWrtShell->Insert("zzz");
 
-// Move the cursor to the start again, and reject the second change.
+// Select the first redline.
 pWrtShell->SttDoc();
 uno::Sequence 
aPropertyValues(comphelper::InitPropertySequence(
 {
-{"RejectTrackedChange", uno::makeAny(static_cast(1))}
+{"NextTrackedChange", uno::makeAny(static_cast(0))}
 }));
-lcl_dispatchCommand(mxComponent, ".uno:RejectTrackedChange", 
aPropertyValues);
+lcl_dispatchCommand(mxComponent, ".uno:NextTrackedChange", 
aPropertyValues);
 Scheduler::ProcessEventsToIdle();
 SwShellCursor* pShellCursor = pWrtShell->getShellCursor(false);
+// This failed: the parameter wasn't handled so the next change (zzz) was
+// selected, not the first one (aaa).
+CPPUNIT_ASSERT_EQUAL(OUString("aaa"), pShellCursor->GetText());
+
+// Select the second redline.
+pWrtShell->SttDoc();
+aPropertyValues = comphelper::InitPropertySequence(
+{
+{"NextTrackedChange", uno::makeAny(static_cast(1))}
+});
+lcl_dispatchCommand(mxComponent, ".uno:NextTrackedChange", 
aPropertyValues);
+Scheduler::ProcessEventsToIdle();
+pShellCursor = pWrtShell->getShellCursor(false);
+CPPUNIT_ASSERT_EQUAL(OUString("zzz"), pShellCursor->GetText());
+
+// Move the cursor to the start again, and reject the second change.
+pWrtShell->SttDoc();
+aPropertyValues = comphelper::InitPropertySequence(
+{
+{"RejectTrackedChange", uno::makeAny(static_cast(1))}
+});
+lcl_dispatchCommand(mxComponent, ".uno:RejectTrackedChange", 
aPropertyValues);
+Scheduler::ProcessEventsToIdle();
+pShellCursor = pWrtShell->getShellCursor(false);
 
 // This was 'middlezzz', the uno command rejected the redline under the
 // cursor, instead of the requested one.
diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi
index 96a05e1..c5c6568 100644
--- a/sw/sdi/swriter.sdi
+++ b/sw/sdi/swrit

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

2016-08-30 Thread Miklos Vajna
 libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit 30b84816eb5c6cd44bdee459cac1bb9f90859aec
Author: Miklos Vajna 
Date:   Tue Aug 30 15:15:42 2016 +0200

gtktiledviewer: don't crash on unimplemented tracked change list

As it's currently implemented only for Writer.

Change-Id: I8c281b2294564472f2c2c5b7de5dd3f86a11a94a

diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx 
b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index e1e86bb4d..97b3350 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -462,6 +462,9 @@ static void documentRedline(GtkWidget* pButton, gpointer 
/*pItem*/)
 // Get the data.
 LibreOfficeKitDocument* pDocument = lok_doc_view_get_document(pDocView);
 char* pValues = pDocument->pClass->getCommandValues(pDocument, 
".uno:AcceptTrackedChanges");
+if (!pValues)
+return;
+
 std::stringstream aInfo;
 aInfo << "lok::Document::getCommandValues('.uno:AcceptTrackedChanges') 
returned '" << pValues << "'" << std::endl;
 g_info("%s", aInfo.str().c_str());
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2016-08-29 Thread Miklos Vajna
 libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx |   19 ++-
 sw/qa/extras/uiwriter/uiwriter.cxx  |9 +
 sw/source/uibase/shells/textfld.cxx |7 +++
 3 files changed, 14 insertions(+), 21 deletions(-)

New commits:
commit e2c240627c8a1a9cea1f9eedfb064214c8e93a39
Author: Miklos Vajna 
Date:   Mon Aug 29 17:57:05 2016 +0200

sw: use SwModule::GetRedlineAuthor() in SwTextShell::ExecField()

This avoids some code duplication, and also means that the redline
author set by SwDocShell::SetView() affects the inserted Writer comments
as well, while those were 'Unknown Author' in the LOK case.

Change-Id: Ib51183302ee6904fdf69fb16f27ecfe6df39e6cb

diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx 
b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index 9bfaa85..e1e86bb4d 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -137,8 +137,6 @@ public:
 std::shared_ptr m_pRowBar;
 std::shared_ptr m_pColumnBar;
 std::shared_ptr m_pCornerButton;
-/// Author string, used for comment insertion.
-std::string m_aAuthor;
 /// Rendering arguments, which are the same for all views.
 boost::property_tree::ptree m_aRenderingArguments;
 
@@ -865,7 +863,6 @@ static void createView(GtkWidget* pButton, gpointer 
/*pItem*/)
 GtkWidget* pDocView = 
lok_doc_view_new_from_widget(LOK_DOC_VIEW(rWindow.m_pDocView), 
aArguments.c_str());
 
 TiledWindow& rNewWindow = setupWidgetAndCreateWindow(pDocView);
-rNewWindow.m_aAuthor = aAuthor;
 // Hide the unused progress bar.
 gtk_widget_show_all(rNewWindow.m_pStatusBar);
 gtk_widget_hide(rNewWindow.m_pProgressBar);
@@ -917,9 +914,8 @@ static void createModelAndView(const char* pLOPath, const 
char* pDocPath, const
 // Save rendering arguments for views which are created later.
 rWindow.m_aRenderingArguments = aTree;
 
-rWindow.m_aAuthor = getNextAuthor();
 aTree.put(boost::property_tree::ptree::path_type(".uno:Author/type", '/'), 
"string");
-aTree.put(boost::property_tree::ptree::path_type(".uno:Author/value", 
'/'), rWindow.m_aAuthor);
+aTree.put(boost::property_tree::ptree::path_type(".uno:Author/value", 
'/'), getNextAuthor());
 
 std::stringstream aStream;
 boost::property_tree::write_json(aStream, aTree);
@@ -1316,18 +1312,7 @@ static void toggleToolItem(GtkWidget* pWidget, gpointer 
/*pData*/)
 // notify about the finished Save
 gboolean bNotify = (rString == ".uno:Save");
 
-std::string aArguments;
-if (rString == ".uno:InsertAnnotation" && !rWindow.m_aAuthor.empty())
-{
-boost::property_tree::ptree aTree;
-aTree.put(boost::property_tree::ptree::path_type("Author/type", 
'/'), "string");
-aTree.put(boost::property_tree::ptree::path_type("Author/value", 
'/'), rWindow.m_aAuthor);
-std::stringstream aStream;
-boost::property_tree::write_json(aStream, aTree);
-aArguments = aStream.str();
-}
-
-lok_doc_view_post_command(pLOKDocView, rString.c_str(), 
(aArguments.empty() ? nullptr : aArguments.c_str()), bNotify);
+lok_doc_view_post_command(pLOKDocView, rString.c_str(), 
/*pArguments=*/nullptr, bNotify);
 }
 }
 
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx 
b/sw/qa/extras/uiwriter/uiwriter.cxx
index dd63e8c..5f5e833 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -3888,6 +3888,15 @@ void SwUiWriterTest::testRedlineViewAuthor()
 SwRangeRedline* pRedline = rTable[0];
 // This was 'Unknown Author' instead of 'A U. Thor'.
 CPPUNIT_ASSERT_EQUAL(aAuthor, pRedline->GetAuthorString());
+
+// Insert a comment and assert that SwView::SetRedlineAuthor() affects 
this as well.
+lcl_dispatchCommand(mxComponent, ".uno:.uno:InsertAnnotation", {});
+uno::Reference xTextFieldsSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xFieldsAccess(xTextFieldsSupplier->getTextFields());
+uno::Reference 
xFields(xFieldsAccess->createEnumeration());
+uno::Reference xField(xFields->nextElement(), 
uno::UNO_QUERY);
+// This was 'Unknown Author' instead of 'A U. Thor'.
+CPPUNIT_ASSERT_EQUAL(aAuthor, 
xField->getPropertyValue("Author").get());
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest);
diff --git a/sw/source/uibase/shells/textfld.cxx 
b/sw/source/uibase/shells/textfld.cxx
index 04f3ea1..4279963 100644
--- a/sw/source/uibase/shells/textfld.cxx
+++ b/sw/source/uibase/shells/textfld.cxx
@@ -70,6 +70,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using namespace nsSwDocInfoSubType;
 
@@ -381,10 +382,8 @@ void SwTextShell::ExecField(SfxRequest &rReq)
 sAuthor = pAuthorItem->GetValue();
 else
 {
-SvtUserOptions aUserOpt;
- 

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

2016-08-17 Thread Miklos Vajna
 libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx |   41 ++--
 sw/qa/extras/uiwriter/uiwriter.cxx  |   33 
 sw/sdi/swriter.sdi  |2 
 sw/source/uibase/uiview/view2.cxx   |   20 -
 4 files changed, 89 insertions(+), 7 deletions(-)

New commits:
commit 087b71f423cf6c047137fb1316527132bb47fc05
Author: Miklos Vajna 
Date:   Wed Aug 17 15:40:14 2016 +0200

sw: allow accept/reject of redline by index

Previously .uno:AcceptTrackedChange / .uno:RejectTrackedChange always
worked by cursor position, but redlines are stored in the redline table,
so they have a unique index. Allow specifying that index when invoking
the command, and in that case ignore the cursor position.

The index is not stable after an insertion / deletion.

Change-Id: I493a22e84800ded224fb6b9c61261744dc0fb64f
Reviewed-on: https://gerrit.libreoffice.org/28192
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins 

diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx 
b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index 9351b61..e975381 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -466,8 +466,10 @@ static void documentRedline(GtkWidget* pButton, gpointer 
/*pItem*/)
 GtkWidget* pDialog = gtk_dialog_new_with_buttons("Manage Changes",
  GTK_WINDOW 
(gtk_widget_get_toplevel(GTK_WIDGET(pDocView))),
  GTK_DIALOG_MODAL,
- "Close",
- GTK_RESPONSE_OK,
+ "Accept",
+ GTK_RESPONSE_YES,
+ "Reject",
+ GTK_RESPONSE_NO,
  nullptr);
 GtkWidget* pContentArea = gtk_dialog_get_content_area(GTK_DIALOG 
(pDialog));
 
@@ -486,7 +488,7 @@ static void documentRedline(GtkWidget* pButton, gpointer 
/*pItem*/)
-1);
 }
 GtkWidget* pTreeView = 
gtk_tree_view_new_with_model(GTK_TREE_MODEL(pTreeStore));
-std::vector aColumns = {"Index", "Type", "Comment", "Author", 
"Timestamp"};
+std::vector aColumns = {"Index", "Author", "Type", "Comment", 
"Timestamp"};
 for (size_t nColumn = 0; nColumn < aColumns.size(); ++nColumn)
 {
 GtkCellRenderer* pRenderer = gtk_cell_renderer_text_new();
@@ -500,7 +502,38 @@ static void documentRedline(GtkWidget* pButton, gpointer 
/*pItem*/)
 
 // Show the dialog.
 gtk_widget_show_all(pDialog);
-gtk_dialog_run(GTK_DIALOG(pDialog));
+gint res = gtk_dialog_run(GTK_DIALOG(pDialog));
+
+// Dispatch the matching command, if necessary.
+if (res == GTK_RESPONSE_YES || res == GTK_RESPONSE_NO)
+{
+GtkTreeSelection* pSelection = 
gtk_tree_view_get_selection(GTK_TREE_VIEW(pTreeView));
+GtkTreeIter aTreeIter;
+GtkTreeModel* pTreeModel;
+if (gtk_tree_selection_get_selected(pSelection, &pTreeModel, 
&aTreeIter))
+{
+gint nIndex = 0;
+// 0: index
+gtk_tree_model_get(pTreeModel, &aTreeIter, 0, &nIndex, -1);
+std::string aCommand;
+if (res == GTK_RESPONSE_YES)
+aCommand = ".uno:AcceptTrackedChange";
+else
+aCommand = ".uno:RejectTrackedChange";
+// Without the '.uno:' prefix.
+std::string aKey = aCommand.substr(strlen(".uno:"));
+
+// Post the command.
+boost::property_tree::ptree aCommandTree;
+aCommandTree.put(boost::property_tree::ptree::path_type(aKey + 
"/type", '/'), "unsigned short");
+aCommandTree.put(boost::property_tree::ptree::path_type(aKey + 
"/value", '/'), nIndex);
+
+aStream.str(std::string());
+boost::property_tree::write_json(aStream, aCommandTree);
+std::string aArguments = aStream.str();
+lok_doc_view_post_command(pDocView, aCommand.c_str(), 
aArguments.c_str(), false);
+}
+}
 
 gtk_widget_destroy(pDialog);
 }
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx 
b/sw/qa/extras/uiwriter/uiwriter.cxx
index a835533..c0fa9e2 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -202,6 +202,7 @@ public:
 void testTdf84695();
 void testTdf84695NormalChar();
 void testTableStyleUndo();
+void testRedlineParam();
 
 CPPUNIT_TEST_SUITE(SwUiWriterTest);
 CPPUNIT_TEST(testReplaceForward);
@@ -305,6 +306,7 @@ public:
 CPPUNIT_TEST(testTdf84695);
 CPPUNIT_TEST(testTdf84695NormalChar);
 CPPUNIT_TEST(testTableStyleUnd

[Libreoffice-commits] core.git: libreofficekit/qa sfx2/sdi sfx2/source sw/inc sw/qa sw/source

2016-08-10 Thread Miklos Vajna
 libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx |5 ++
 sfx2/sdi/sfx.sdi|4 -
 sfx2/source/control/dispatch.cxx|   18 
 sw/inc/IDocumentUndoRedo.hxx|5 ++
 sw/qa/extras/tiledrendering/tiledrendering.cxx  |   41 
 sw/source/core/inc/UndoManager.hxx  |4 +
 sw/source/core/undo/docundo.cxx |   15 ++-
 sw/source/uibase/shells/basesh.cxx  |   17 +++-
 8 files changed, 103 insertions(+), 6 deletions(-)

New commits:
commit e9bcd3475131b24b0b8818cfdfa256854ca5a59d
Author: Miklos Vajna 
Date:   Wed Aug 10 17:42:54 2016 +0200

sw undo: add a Repair argument to the .uno:Undo/Redo commands

Undo/redo is limited to undo actions created by the same view in the LOK
case, this argument removes this limit. This can be used by a client for
"document repair" purposes, where undo/redo of others' changes is
intentional.

The sfx command dispatch has support for FASTCALL slots (a state
function is not called, the command is always enabled) and also has
support for state functions, but those functions only get the ID of the
slots, not its parameters. What is needed here is a command that's
disabled by default, but in case a Repair argument is used, then it's
unconditionally enabled. So handle that case in the sfx dispatcher
directly for now.

Change-Id: I96c1130bf51abcdd722684b1fa4a8277f92fd555

diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx 
b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index 6c8e2d5..a53bd00 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -535,6 +535,11 @@ static void documentRepair(GtkWidget* pButton, gpointer 
/*pItem*/)
 boost::property_tree::ptree aTree;
 aTree.put(boost::property_tree::ptree::path_type(aKey + "/type", 
'/'), "unsigned short");
 aTree.put(boost::property_tree::ptree::path_type(aKey + "/value", 
'/'), nIndex + 1);
+
+// Without this, we could only undo our own commands.
+aTree.put(boost::property_tree::ptree::path_type("Repair/type", 
'/'), "boolean");
+aTree.put(boost::property_tree::ptree::path_type("Repair/value", 
'/'), true);
+
 std::stringstream aStream;
 boost::property_tree::write_json(aStream, aTree);
 std::string aArguments = aStream.str();
diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi
index f5e366a..5275aef 100644
--- a/sfx2/sdi/sfx.sdi
+++ b/sfx2/sdi/sfx.sdi
@@ -3428,7 +3428,7 @@ SfxBoolItem MacroRecordingFloat SID_RECORDING_FLOATWINDOW
 
 
 SfxVoidItem Redo SID_REDO
-( SfxUInt16Item Redo SID_REDO )
+( SfxUInt16Item Redo SID_REDO, SfxBoolItem Repair SID_REPAIRPACKAGE )
 [
 AutoUpdate = FALSE,
 FastCall = FALSE,
@@ -4555,7 +4555,7 @@ SfxVoidItem BasicIDEShowWindow SID_BASICIDE_SHOWWINDOW
 
 
 SfxVoidItem Undo SID_UNDO
-( SfxUInt16Item Undo SID_UNDO )
+( SfxUInt16Item Undo SID_UNDO, SfxBoolItem Repair SID_REPAIRPACKAGE )
 [
 AutoUpdate = FALSE,
 FastCall = FALSE,
diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx
index 0d973a9..c464fba 100644
--- a/sfx2/source/control/dispatch.cxx
+++ b/sfx2/source/control/dispatch.cxx
@@ -313,6 +313,22 @@ bool SfxDispatcher::IsAppDispatcher() const
 return !xImp->pFrame;
 }
 
+/// Decides if the request is FASTCALL or not, depending on arguments.
+bool lcl_IsConditionalFastCall(SfxRequest &rReq)
+{
+sal_uInt16 nId = rReq.GetSlot();
+bool bRet = false;
+
+if (nId == SID_UNDO || nId == SID_REDO)
+{
+const SfxItemSet* pArgs = rReq.GetArgs();
+if (pArgs && pArgs->HasItem(SID_REPAIRPACKAGE))
+bRet = true;
+}
+
+return bRet;
+}
+
 /** Helper function to check whether a slot can be executed and
 check the execution itself
 */
@@ -321,7 +337,7 @@ void SfxDispatcher::Call_Impl(SfxShell& rShell, const 
SfxSlot &rSlot, SfxRequest
 SFX_STACK(SfxDispatcher::Call_Impl);
 
 // The slot may be called (meaning enabled)
-if ( rSlot.IsMode(SfxSlotMode::FASTCALL) || 
rShell.CanExecuteSlot_Impl(rSlot) )
+if ( rSlot.IsMode(SfxSlotMode::FASTCALL) || 
rShell.CanExecuteSlot_Impl(rSlot) || lcl_IsConditionalFastCall(rReq))
 {
 if ( GetFrame() )
 {
diff --git a/sw/inc/IDocumentUndoRedo.hxx b/sw/inc/IDocumentUndoRedo.hxx
index 6c044f6..2266f30 100644
--- a/sw/inc/IDocumentUndoRedo.hxx
+++ b/sw/inc/IDocumentUndoRedo.hxx
@@ -64,6 +64,11 @@ public:
  */
 virtual bool DoesDrawUndo() const = 0;
 
+/// Enable repair mode.
+virtual void DoRepair(bool bRepair) = 0;
+/// Is repair mode active?
+virtual bool DoesRepair() const = 0;
+
 /** Set the position at which the document is in the "unmodified" state
 to the current position in the Undo stack.
 

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

2016-08-09 Thread Miklos Vajna
 libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx |   47 +---
 1 file changed, 31 insertions(+), 16 deletions(-)

New commits:
commit 5cb52cf97d04859c0c730cf03430254041d6388b
Author: Miklos Vajna 
Date:   Tue Aug 9 12:10:26 2016 +0200

gtktiledviewer: fix incorrect undo/redo state

Edit state = false disabled undo, then edit state = true enabled the
undo button, even the last LOK callback was '.uno:Undo=disabled'.  Fix
this by storing the LOK state in a map, and using it when edit is
enabled.

With this, clicking on the Edit button right after loading a document
results disabled undo/redo buttons as expected.

Change-Id: Id6023f976f13a43486f71603c823e59d8d60
Reviewed-on: https://gerrit.libreoffice.org/28003
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins 

diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx 
b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index eaf1555..6c8e2d5 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -120,6 +120,9 @@ public:
 GtkWidget* m_pScrolledWindow;
 std::map m_aToolItemCommandNames;
 std::map m_aCommandNameToolItems;
+/// Sensitivity (enabled or disabled) or each tool item, ignoring edit
+/// state.
+std::map m_aToolItemSensitivities;
 bool m_bToolItemBroadcast;
 GtkWidget* m_pVBox;
 GtkComboBoxText* m_pPartSelector;
@@ -386,6 +389,7 @@ static void lcl_registerToolItem(TiledWindow& rWindow, 
GtkToolItem* pItem, const
 {
 rWindow.m_aToolItemCommandNames[pItem] = rName;
 rWindow.m_aCommandNameToolItems[rName] = pItem;
+rWindow.m_aToolItemSensitivities[pItem] = true;
 }
 
 const float fZooms[] = { 0.25, 0.5, 0.75, 1.0, 1.5, 2.0, 3.0, 5.0 };
@@ -958,6 +962,13 @@ static gboolean signalFormulabar(GtkWidget* /*pWidget*/, 
GdkEventKey* /*pEvent*/
 return TRUE;
 }
 
+/// Set sensitivity based on rWindow.m_aToolItemSensitivities, taking edit
+/// state into account.
+static void setSensitiveIfInEdit(GtkToolItem* pItem, gboolean bEdit, 
TiledWindow& rWindow)
+{
+gtk_widget_set_sensitive(GTK_WIDGET(pItem), bEdit && 
rWindow.m_aToolItemSensitivities[pItem]);
+}
+
 /// LOKDocView changed edit state -> inform the tool button.
 static void signalEdit(LOKDocView* pLOKDocView, gboolean bWasEdit, gpointer 
/*pData*/)
 {
@@ -966,22 +977,22 @@ static void signalEdit(LOKDocView* pLOKDocView, gboolean 
bWasEdit, gpointer /*pD
 g_info("signalEdit: %d -> %d", bWasEdit, bEdit);
 
 // Set toggle button sensitivity
-gtk_widget_set_sensitive(GTK_WIDGET(rWindow.m_pBold), bEdit);
-gtk_widget_set_sensitive(GTK_WIDGET(rWindow.m_pItalic), bEdit);
-gtk_widget_set_sensitive(GTK_WIDGET(rWindow.m_pUnderline), bEdit);
-gtk_widget_set_sensitive(GTK_WIDGET(rWindow.m_pStrikethrough), bEdit);
-gtk_widget_set_sensitive(GTK_WIDGET(rWindow.m_pSuperscript), bEdit);
-gtk_widget_set_sensitive(GTK_WIDGET(rWindow.m_pSubscript), bEdit);
-gtk_widget_set_sensitive(GTK_WIDGET(rWindow.m_pLeftpara), bEdit);
-gtk_widget_set_sensitive(GTK_WIDGET(rWindow.m_pCenterpara), bEdit);
-gtk_widget_set_sensitive(GTK_WIDGET(rWindow.m_pRightpara), bEdit);
-gtk_widget_set_sensitive(GTK_WIDGET(rWindow.m_pJustifypara), bEdit);
-gtk_widget_set_sensitive(GTK_WIDGET(rWindow.m_pInsertAnnotation), bEdit);
-gtk_widget_set_sensitive(GTK_WIDGET(rWindow.m_pDeleteComment), bEdit);
-gtk_widget_set_sensitive(GTK_WIDGET(rWindow.m_pUndo), bEdit);
-gtk_widget_set_sensitive(GTK_WIDGET(rWindow.m_pRedo), bEdit);
-gtk_widget_set_sensitive(GTK_WIDGET(rWindow.m_pPasteButton), bEdit);
-gtk_widget_set_sensitive(GTK_WIDGET(rWindow.m_pSaveButton), bEdit);
+setSensitiveIfInEdit(rWindow.m_pBold, bEdit, rWindow);
+setSensitiveIfInEdit(rWindow.m_pItalic, bEdit, rWindow);
+setSensitiveIfInEdit(rWindow.m_pUnderline, bEdit, rWindow);
+setSensitiveIfInEdit(rWindow.m_pStrikethrough, bEdit, rWindow);
+setSensitiveIfInEdit(rWindow.m_pSuperscript, bEdit, rWindow);
+setSensitiveIfInEdit(rWindow.m_pSubscript, bEdit, rWindow);
+setSensitiveIfInEdit(rWindow.m_pLeftpara, bEdit, rWindow);
+setSensitiveIfInEdit(rWindow.m_pCenterpara, bEdit, rWindow);
+setSensitiveIfInEdit(rWindow.m_pRightpara, bEdit, rWindow);
+setSensitiveIfInEdit(rWindow.m_pJustifypara, bEdit, rWindow);
+setSensitiveIfInEdit(rWindow.m_pInsertAnnotation, bEdit, rWindow);
+setSensitiveIfInEdit(rWindow.m_pDeleteComment, bEdit, rWindow);
+setSensitiveIfInEdit(rWindow.m_pUndo, bEdit, rWindow);
+setSensitiveIfInEdit(rWindow.m_pRedo, bEdit, rWindow);
+setSensitiveIfInEdit(rWindow.m_pPasteButton, bEdit, rWindow);
+setSensitiveIfInEdit(rWindow.m_pSaveButton, bEdit, rWindow);
 }
 
 /// LOKDocView changed command state -> inform the tool button.
@@ -1010,6 +1021,10 @@ static void signalCommand(LOKDocView* pLOKDocView, char* 
pPayload, gpointer /*pD
 } else if (a

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

2016-08-05 Thread Miklos Vajna
 libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx |  108 +++-
 libreofficekit/source/gtk/lokdocview.cxx|2 
 svl/source/undo/undo.cxx|4 
 3 files changed, 110 insertions(+), 4 deletions(-)

New commits:
commit a141cba76606c7dcc4965f0a25cc9a4ff2d8879e
Author: Miklos Vajna 
Date:   Fri Aug 5 18:01:06 2016 +0200

gtktiledviewer: expose undo/redo info in a repair document dialog

This shows the full undo and redo stack, with all the metadata available
via the LOK API.

Also fix SfxUndoManager::GetRedoActionsInfo(), so it's easy to show the
undo/redo stack in linear time; and fix a use-after-free in lokdocview.

Change-Id: I66625ed453efa61b5738d99d7d1ad8f468908240
Reviewed-on: https://gerrit.libreoffice.org/27913
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins 

diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx 
b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index 37cf7e2..eaf1555 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -441,6 +441,106 @@ static void addMoreUnoParam(GtkWidget* /*pWidget*/, 
gpointer userdata)
 gtk_widget_show_all(pUnoParamAreaBox);
 }
 
+static void documentRepair(GtkWidget* pButton, gpointer /*pItem*/)
+{
+TiledWindow& rWindow = lcl_getTiledWindow(pButton);
+LOKDocView* pDocView = LOK_DOC_VIEW(rWindow.m_pDocView);
+// Get the data.
+LibreOfficeKitDocument* pDocument = lok_doc_view_get_document(pDocView);
+// How it in linear time, so first redo in reverse order, then undo.
+std::vector aTypes = {".uno:Redo", ".uno:Undo"};
+std::vector aTrees;
+for (size_t nType = 0; nType < aTypes.size(); ++nType)
+{
+const std::string& rType = aTypes[nType];
+char* pValues = pDocument->pClass->getCommandValues(pDocument, 
rType.c_str());
+std::stringstream aInfo;
+aInfo << "lok::Document::getCommandValues('" << rType << "') returned 
'" << pValues << "'" << std::endl;
+g_info("%s", aInfo.str().c_str());
+std::stringstream aStream(pValues);
+free(pValues);
+assert(!aStream.str().empty());
+boost::property_tree::ptree aTree;
+boost::property_tree::read_json(aStream, aTree);
+aTrees.push_back(aTree);
+}
+
+// Create the dialog.
+GtkWidget* pDialog = gtk_dialog_new_with_buttons("Repair document",
+ GTK_WINDOW 
(gtk_widget_get_toplevel(GTK_WIDGET(pDocView))),
+ GTK_DIALOG_MODAL,
+ "Jump to state",
+ GTK_RESPONSE_OK,
+ nullptr);
+GtkWidget* pContentArea = gtk_dialog_get_content_area(GTK_DIALOG 
(pDialog));
+
+// Build the table.
+GtkTreeStore* pTreeStore = gtk_tree_store_new(5, G_TYPE_STRING, 
G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
+for (size_t nTree = 0; nTree < aTrees.size(); ++nTree)
+{
+const auto& rTree = aTrees[nTree];
+for (const auto& rValue : rTree.get_child("actions"))
+{
+GtkTreeIter aTreeIter;
+gtk_tree_store_append(pTreeStore, &aTreeIter, nullptr);
+gtk_tree_store_set(pTreeStore, &aTreeIter,
+   0, aTypes[nTree].c_str(),
+   1, rValue.second.get("index"),
+   2, 
rValue.second.get("comment").c_str(),
+   3, 
rValue.second.get("viewId").c_str(),
+   4, 
rValue.second.get("dateTime").c_str(),
+   -1);
+}
+}
+GtkWidget* pTreeView = 
gtk_tree_view_new_with_model(GTK_TREE_MODEL(pTreeStore));
+std::vector aColumns = {"Type", "Index", "Comment", "View 
ID", "Timestamp"};
+for (size_t nColumn = 0; nColumn < aColumns.size(); ++nColumn)
+{
+GtkCellRenderer* pRenderer = gtk_cell_renderer_text_new();
+GtkTreeViewColumn* pColumn = 
gtk_tree_view_column_new_with_attributes(aColumns[nColumn].c_str(),
+  
pRenderer,
+  
"text", nColumn,
+  
nullptr);
+gtk_tree_view_append_column(GTK_TREE_VIEW(pTreeView), pColumn);
+}
+gtk_box_pack_start(GTK_BOX(pContentArea), pTreeView, TRUE, TRUE, 2);
+
+// Show the dialog.
+gtk_widget_show_all(pDialog);
+gint res = gtk_dialog_run(GTK_DIALOG(pDialog));
+
+// Dispatch the matching command, if necessary.
+if (res == GTK_RESPONSE_OK)
+{
+GtkTreeSelection* pSelection = 
gtk_tree_view_get_selection(GTK_TR

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

2016-07-28 Thread Miklos Vajna
 libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx |   17 -
 1 file changed, 16 insertions(+), 1 deletion(-)

New commits:
commit 538ea31c992acb9d47ffd783543e50e149272aac
Author: Miklos Vajna 
Date:   Thu Jul 28 09:52:25 2016 +0200

gtktiledviewer: quit after the last view is destroyed

To allow debugging crash-on-exit problems.

Change-Id: Ie54a8391e721c3ba8034b4618dd30733bac97a27
Reviewed-on: https://gerrit.libreoffice.org/27605
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins 

diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx 
b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index 58139a5..37cf7e2 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -1210,13 +1210,28 @@ static void openDocumentCallback (GObject* 
source_object, GAsyncResult* res, gpo
 gtk_widget_hide(rWindow.m_pProgressBar);
 }
 
+/**
+ * Wrapper around gtk_widget_destroy() that quits when the last tiled window is
+ * destroyed.
+ */
+static void destroyWindow(GtkWidget* pWidget)
+{
+gtk_widget_destroy(pWidget);
+auto it = g_aWindows.find(pWidget);
+if (it != g_aWindows.end())
+g_aWindows.erase(it);
+
+if (g_aWindows.empty())
+gtk_main_quit();
+}
+
 /// Creates the GtkWindow that has main widget as children and registers it in 
the window map.
 static GtkWidget* createWindow(TiledWindow& rWindow)
 {
 GtkWidget *pWindow = gtk_window_new(GTK_WINDOW_TOPLEVEL);
 gtk_window_set_title(GTK_WINDOW(pWindow), "LibreOfficeKit GTK Tiled 
Viewer");
 gtk_window_set_default_size(GTK_WINDOW(pWindow), 1024, 768);
-g_signal_connect(pWindow, "destroy", G_CALLBACK(gtk_widget_destroy), 
pWindow);
+g_signal_connect(pWindow, "destroy", G_CALLBACK(destroyWindow), pWindow);
 
 rWindow.m_pVBox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
 gtk_container_add(GTK_CONTAINER(pWindow), rWindow.m_pVBox);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2016-07-22 Thread Miklos Vajna
 libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx |   12 +++-
 1 file changed, 11 insertions(+), 1 deletion(-)

New commits:
commit 672b7411637f92acd30622ec2aaee840cbbbd0a9
Author: Miklos Vajna 
Date:   Fri Jul 22 10:38:18 2016 +0200

gtktiledviewer: align to top/left for Calc

Otherwise when zooming out enough that not all available space is used,
the default horizontal/vertical centering happens, and the row/column
headers and the tiles become out of sync.

Also revert to the previous default window size, I'm not sure why that
was necessary. Currently checking the mentioned situation (empty Writer
document with comments only) does not require this larger size, and
testing two views is easier with the smaller size.

Change-Id: Ia92a591387f62655a671e2d09f5053827fde5045
Reviewed-on: https://gerrit.libreoffice.org/27427
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins 

diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx 
b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index f80b506..58139a5 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -1189,6 +1189,16 @@ static void openDocumentCallback (GObject* 
source_object, GAsyncResult* res, gpo
 return;
 }
 
+LibreOfficeKitDocument* pDocument = lok_doc_view_get_document(pDocView);
+if (pDocument && pDocument->pClass->getDocumentType(pDocument) == 
LOK_DOCTYPE_SPREADSHEET)
+{
+// Align to top left corner, so the tiles are in sync with the
+// row/column bar, even when zooming out enough that not all space is
+// used.
+gtk_widget_set_halign(GTK_WIDGET(pDocView), GTK_ALIGN_START);
+gtk_widget_set_valign(GTK_WIDGET(pDocView), GTK_ALIGN_START);
+}
+
 populatePartSelector(pDocView);
 populatePartModeSelector( GTK_COMBO_BOX_TEXT(rWindow.m_pPartModeComboBox) 
);
 registerSelectorHandlers(rWindow);
@@ -1205,7 +1215,7 @@ static GtkWidget* createWindow(TiledWindow& rWindow)
 {
 GtkWidget *pWindow = gtk_window_new(GTK_WINDOW_TOPLEVEL);
 gtk_window_set_title(GTK_WINDOW(pWindow), "LibreOfficeKit GTK Tiled 
Viewer");
-gtk_window_set_default_size(GTK_WINDOW(pWindow), 1280, 720);
+gtk_window_set_default_size(GTK_WINDOW(pWindow), 1024, 768);
 g_signal_connect(pWindow, "destroy", G_CALLBACK(gtk_widget_destroy), 
pWindow);
 
 rWindow.m_pVBox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2016-07-15 Thread Miklos Vajna
 libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx |2 -
 libreofficekit/source/gtk/lokdocview.cxx|   28 +++-
 2 files changed, 23 insertions(+), 7 deletions(-)

New commits:
commit 99f05d9947db2dd0676fafa66106d17e4d8eea6d
Author: Miklos Vajna 
Date:   Fri Jul 15 15:37:51 2016 +0200

gtktiledviewer: allow testing of destroyView()

By calling it when we're not the last window.

Change-Id: I6fd4763243fc088ccfe015b6c03b6b3f25146fac

diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx 
b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index f0aabdf..f80b506 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -1206,7 +1206,7 @@ static GtkWidget* createWindow(TiledWindow& rWindow)
 GtkWidget *pWindow = gtk_window_new(GTK_WINDOW_TOPLEVEL);
 gtk_window_set_title(GTK_WINDOW(pWindow), "LibreOfficeKit GTK Tiled 
Viewer");
 gtk_window_set_default_size(GTK_WINDOW(pWindow), 1280, 720);
-g_signal_connect(pWindow, "destroy", G_CALLBACK(gtk_main_quit), 0);
+g_signal_connect(pWindow, "destroy", G_CALLBACK(gtk_widget_destroy), 
pWindow);
 
 rWindow.m_pVBox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
 gtk_container_add(GTK_CONTAINER(pWindow), rWindow.m_pVBox);
diff --git a/libreofficekit/source/gtk/lokdocview.cxx 
b/libreofficekit/source/gtk/lokdocview.cxx
index 613a909..0c9d135 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -155,6 +155,9 @@ struct LOKDocViewPrivateImpl
 GdkRectangle m_aVisibleArea;
 bool m_bVisibleAreaSet;
 
+/// Event source ID for handleTimeout() of this widget.
+guint m_nTimeoutId;
+
 LOKDocViewPrivateImpl()
 : m_aLOPath(nullptr),
 m_pUserProfileURL(nullptr),
@@ -196,11 +199,17 @@ struct LOKDocViewPrivateImpl
 m_nViewId(0),
 m_nTileSizeTwips(0),
 m_aVisibleArea({0, 0, 0, 0}),
-m_bVisibleAreaSet(false)
+m_bVisibleAreaSet(false),
+m_nTimeoutId(0)
 {
 memset(&m_aGraphicHandleRects, 0, sizeof(m_aGraphicHandleRects));
 memset(&m_bInDragGraphicHandles, 0, sizeof(m_bInDragGraphicHandles));
 }
+
+~LOKDocViewPrivateImpl()
+{
+g_source_remove(m_nTimeoutId);
+}
 };
 
 /// Wrapper around LOKDocViewPrivateImpl, managed by malloc/memset/free.
@@ -873,7 +882,7 @@ static gboolean postDocumentLoad(gpointer pData)
 priv->m_pDocument->pClass->getDocumentSize(priv->m_pDocument, 
&priv->m_nDocumentWidthTwips, &priv->m_nDocumentHeightTwips);
 priv->m_nParts = priv->m_pDocument->pClass->getParts(priv->m_pDocument);
 aGuard.unlock();
-g_timeout_add(600, handleTimeout, pLOKDocView);
+priv->m_nTimeoutId = g_timeout_add(600, handleTimeout, pLOKDocView);
 
 float zoom = priv->m_fZoom;
 long nDocumentWidthTwips = priv->m_nDocumentWidthTwips;
@@ -2385,10 +2394,17 @@ static void lok_doc_view_finalize (GObject* object)
 LOKDocView* pDocView = LOK_DOC_VIEW (object);
 LOKDocViewPrivate& priv = getPrivate(pDocView);
 
-if (priv->m_pDocument)
-priv->m_pDocument->pClass->destroy (priv->m_pDocument);
-if (priv->m_pOffice)
-priv->m_pOffice->pClass->destroy (priv->m_pOffice);
+if (priv->m_pDocument && 
priv->m_pDocument->pClass->getViews(priv->m_pDocument) > 1)
+{
+priv->m_pDocument->pClass->destroyView(priv->m_pDocument, 
priv->m_nViewId);
+}
+else
+{
+if (priv->m_pDocument)
+priv->m_pDocument->pClass->destroy (priv->m_pDocument);
+if (priv->m_pOffice)
+priv->m_pOffice->pClass->destroy (priv->m_pOffice);
+}
 delete priv.m_pImpl;
 priv.m_pImpl = nullptr;
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2016-06-13 Thread Miklos Vajna
 libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx |   21 +---
 1 file changed, 18 insertions(+), 3 deletions(-)

New commits:
commit bf11fe9fa1e2caf752c1f9ec3ead1ef20425143f
Author: Miklos Vajna 
Date:   Mon Jun 13 18:09:47 2016 +0200

gtktiledviewer: fix the per-view part selector

Need to populate it & register handlers for the non-first windows as
well.

Change-Id: I27231027c3f33fb081768c51ecc291b9f2a7e99b
Reviewed-on: https://gerrit.libreoffice.org/26225
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins 

diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx 
b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index 1c68e81..380bc04 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -181,6 +181,12 @@ static std::map g_aWindows;
 static void setupDocView(GtkWidget* pDocView);
 static GtkWidget* createWindow(TiledWindow& rWindow);
 static void openDocumentCallback (GObject* source_object, GAsyncResult* res, 
gpointer userdata);
+/// Called when the document size is changed.
+static void signalSize(LOKDocView* pLOKDocView, gpointer pData);
+/// Handler for m_pPartModeComboBox.
+static void changePartMode( GtkWidget* pSelector, gpointer /*pItem*/);
+/// Handler for m_pPartSelector.
+static void changePart( GtkWidget* pSelector, gpointer /*pItem*/ );
 
 static TiledWindow& lcl_getTiledWindow(GtkWidget* pWidget)
 {
@@ -515,6 +521,14 @@ static TiledWindow& setupWidgetAndCreateWindow(GtkWidget* 
pDocView)
 return lcl_getTiledWindow(pWindow);
 }
 
+/// Register handlers on the combo boxes.
+static void registerSelectorHandlers(TiledWindow& rWindow)
+{
+// Connect these signals after populating the selectors, to avoid 
re-rendering on setting the default part/partmode.
+g_signal_connect(G_OBJECT(rWindow.m_pPartModeComboBox), "changed", 
G_CALLBACK(changePartMode), 0);
+g_signal_connect(G_OBJECT(rWindow.m_pPartSelector), "changed", 
G_CALLBACK(changePart), 0);
+}
+
 /// Creates a new view, i.e. no LOK init or document load.
 static void createView(GtkWidget* pButton, gpointer /*pItem*/)
 {
@@ -525,6 +539,9 @@ static void createView(GtkWidget* pButton, gpointer 
/*pItem*/)
 // Hide the unused progress bar.
 gtk_widget_show_all(rNewWindow.m_pStatusBar);
 gtk_widget_hide(rNewWindow.m_pProgressBar);
+// Trigger a 'document size changed' event to populate the part selectors.
+signalSize(LOK_DOC_VIEW(pDocView), nullptr);
+registerSelectorHandlers(rNewWindow);
 }
 
 /// Creates a new model, i.e. LOK init and document load, one view implicitly.
@@ -1067,9 +1084,7 @@ static void openDocumentCallback (GObject* source_object, 
GAsyncResult* res, gpo
 
 populatePartSelector(pDocView);
 populatePartModeSelector( GTK_COMBO_BOX_TEXT(rWindow.m_pPartModeComboBox) 
);
-// Connect these signals after populating the selectors, to avoid 
re-rendering on setting the default part/partmode.
-g_signal_connect(G_OBJECT(rWindow.m_pPartModeComboBox), "changed", 
G_CALLBACK(changePartMode), 0);
-g_signal_connect(G_OBJECT(rWindow.m_pPartSelector), "changed", 
G_CALLBACK(changePart), 0);
+registerSelectorHandlers(rWindow);
 
 focusChain = g_list_append( focusChain, pDocView );
 gtk_container_set_focus_chain ( GTK_CONTAINER (rWindow.m_pVBox), 
focusChain );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2016-06-10 Thread Miklos Vajna
 libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx |   13 -
 1 file changed, 8 insertions(+), 5 deletions(-)

New commits:
commit 65731b68bdc67d5be1b459eea7919ec6ca26c4bc
Author: Miklos Vajna 
Date:   Fri Jun 10 17:17:03 2016 +0200

gtktiledviewer: fix runtime warnings caused by .uno:InsertAnnotation button

It's a GtkToolButton, but not a GtkToggleToolButton, so don't cast
command buttons down unconditionally.

Change-Id: Ie7c9bdf6fa8725363e40c1544f4e1e835a559f3a
Reviewed-on: https://gerrit.libreoffice.org/26171
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins 

diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx 
b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index 8a3099e..1c68e81 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -777,12 +777,15 @@ static void signalCommand(LOKDocView* pLOKDocView, char* 
pPayload, gpointer /*pD
 {
 GtkToolItem* pItem = rWindow.m_aCommandNameToolItems[aKey];
 gboolean bEdit = aValue == "true";
-if 
(gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(pItem)) != bEdit)
+if (GTK_IS_TOGGLE_TOOL_BUTTON(pItem))
 {
-// Avoid invoking lok_doc_view_post_command().
-rWindow.m_bToolItemBroadcast = false;
-
gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(pItem), bEdit);
-rWindow.m_bToolItemBroadcast = true;
+if 
(gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(pItem)) != bEdit)
+{
+// Avoid invoking lok_doc_view_post_command().
+rWindow.m_bToolItemBroadcast = false;
+
gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(pItem), bEdit);
+rWindow.m_bToolItemBroadcast = true;
+}
 }
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: libreofficekit/qa vcl/unx

2016-02-09 Thread Michael Stahl
 libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx |4 
 vcl/unx/gtk3/gtk3gtkinst.cxx|4 
 2 files changed, 8 insertions(+)

New commits:
commit 678e0ea1472478d248d1a45c1e0ade5ed84f9d46
Author: Michael Stahl 
Date:   Tue Feb 9 14:13:48 2016 +0100

vcl, libreofficekit: gtk_clipboard_wait_for_contents() may return null

Don't crash then.

Change-Id: I4980fe4ea56e023cbf303fa43d1e6b383d983d2e

diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx 
b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index b2962d4..7ec2b78 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -656,6 +656,10 @@ static void doPaste(GtkWidget* pButton, gpointer /*pItem*/)
 if (oTarget)
 {
 GtkSelectionData* pSelectionData = 
gtk_clipboard_wait_for_contents(pClipboard, *oTarget);
+if (!pSelectionData)
+{
+return;
+}
 gint nLength;
 const guchar* pData = 
gtk_selection_data_get_data_with_length(pSelectionData, &nLength);
 bool bSuccess = lok_doc_view_paste(pLOKDocView, aTargetName.c_str(), 
reinterpret_cast(pData), nLength);
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index f914e45..32e1a57 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -206,6 +206,10 @@ public:
 css::uno::Any aRet;
 GtkSelectionData* data = gtk_clipboard_wait_for_contents(clipboard,
  it->second);
+if (!data)
+{
+return css::uno::Any();
+}
 gint length;
 const guchar *rawdata = gtk_selection_data_get_data_with_length(data,
 
&length);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2016-02-04 Thread Miklos Vajna
 libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit e1acc9f0438dcfbc739bea019acb68614cc8cff3
Author: Miklos Vajna 
Date:   Thu Feb 4 09:27:19 2016 +0100

gtktiledviewer: cid#1351757 uninitialized members

Change-Id: Ifb48dc528e95519097477faf79b10e3e7637869d

diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx 
b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index c294430..0e77d96 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -151,6 +151,8 @@ public:
 m_pCenterpara(nullptr),
 m_pRightpara(nullptr),
 m_pJustifypara(nullptr),
+m_pInsertAnnotation(nullptr),
+m_pDeleteComment(nullptr),
 m_pFormulabarEntry(nullptr),
 m_pScrolledWindow(nullptr),
 m_bToolItemBroadcast(true),
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2016-01-28 Thread Stephan Bergmann
 libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 63cada47911029cce512f3b8ac0b6a6d2c323032
Author: Stephan Bergmann 
Date:   Thu Jan 28 15:47:41 2016 +0100

Missing include

Change-Id: I4930837c2a5bd78c16a83dcccde34843d3026618

diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx 
b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index c6dbc7d..8b7c931 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -11,6 +11,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2016-01-21 Thread Pranav Kant
 libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx |  143 +---
 1 file changed, 98 insertions(+), 45 deletions(-)

New commits:
commit e3edebcf0dda6b72d4e03151b4daf6309097ac2d
Author: Pranav Kant 
Date:   Wed Jan 20 18:17:21 2016 +0530

gtktiledviewer: Set buttons insensitive in view-only mode

These buttons, such as, bold, italic, underline, paste, doesn't
make any sense in view-only mode. Lets make them insensitive in
view-only mode.

Change-Id: I194f6a4d707b72d1d6aa3967aa526092445f0926
Reviewed-on: https://gerrit.libreoffice.org/21642
Tested-by: Jenkins 
Reviewed-by: David Tardon 

diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx 
b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index 3c8f781..1bc6529 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -96,6 +96,11 @@ public:
 GtkWidget* m_pProgressBar;
 GtkWidget* m_pStatusbarLabel;
 GtkWidget* m_pZoomLabel;
+GtkToolItem* m_pSaveButton;
+GtkToolItem* m_pCopyButton;
+GtkToolItem* m_pPasteButton;
+GtkToolItem* m_pUndo;
+GtkToolItem* m_pRedo;
 GtkToolItem* m_pEnableEditing;
 GtkToolItem* m_pBold;
 GtkToolItem* m_pItalic;
@@ -107,6 +112,8 @@ public:
 GtkToolItem* m_pCenterpara;
 GtkToolItem* m_pRightpara;
 GtkToolItem* m_pJustifypara;
+GtkToolItem* m_pInsertAnnotation;
+GtkToolItem* m_pDeleteComment;
 GtkWidget* m_pFormulabarEntry;
 GtkWidget* m_pScrolledWindow;
 std::map m_aToolItemCommandNames;
@@ -678,11 +685,26 @@ static gboolean signalFormulabar(GtkWidget* /*pWidget*/, 
GdkEventKey* /*pEvent*/
 static void signalEdit(LOKDocView* pLOKDocView, gboolean bWasEdit, gpointer 
/*pData*/)
 {
 TiledWindow& rWindow = lcl_getTiledWindow(GTK_WIDGET(pLOKDocView));
-
 gboolean bEdit = lok_doc_view_get_edit(pLOKDocView);
-g_info("signalEdit: %d -> %d", bWasEdit, 
lok_doc_view_get_edit(pLOKDocView));
-if 
(gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(rWindow.m_pEnableEditing))
 != bEdit)
-
gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(rWindow.m_pEnableEditing),
 bEdit);
+g_info("signalEdit: %d -> %d", bWasEdit, bEdit);
+
+// Set toggle button sensitivity
+gtk_widget_set_sensitive(GTK_WIDGET(rWindow.m_pBold), bEdit);
+gtk_widget_set_sensitive(GTK_WIDGET(rWindow.m_pItalic), bEdit);
+gtk_widget_set_sensitive(GTK_WIDGET(rWindow.m_pUnderline), bEdit);
+gtk_widget_set_sensitive(GTK_WIDGET(rWindow.m_pStrikethrough), bEdit);
+gtk_widget_set_sensitive(GTK_WIDGET(rWindow.m_pSuperscript), bEdit);
+gtk_widget_set_sensitive(GTK_WIDGET(rWindow.m_pSubscript), bEdit);
+gtk_widget_set_sensitive(GTK_WIDGET(rWindow.m_pLeftpara), bEdit);
+gtk_widget_set_sensitive(GTK_WIDGET(rWindow.m_pCenterpara), bEdit);
+gtk_widget_set_sensitive(GTK_WIDGET(rWindow.m_pRightpara), bEdit);
+gtk_widget_set_sensitive(GTK_WIDGET(rWindow.m_pJustifypara), bEdit);
+gtk_widget_set_sensitive(GTK_WIDGET(rWindow.m_pInsertAnnotation), bEdit);
+gtk_widget_set_sensitive(GTK_WIDGET(rWindow.m_pDeleteComment), bEdit);
+gtk_widget_set_sensitive(GTK_WIDGET(rWindow.m_pUndo), bEdit);
+gtk_widget_set_sensitive(GTK_WIDGET(rWindow.m_pRedo), bEdit);
+gtk_widget_set_sensitive(GTK_WIDGET(rWindow.m_pPasteButton), bEdit);
+gtk_widget_set_sensitive(GTK_WIDGET(rWindow.m_pSaveButton), bEdit);
 }
 
 /// LOKDocView changed command state -> inform the tool button.
@@ -976,40 +998,49 @@ static GtkWidget* createWindow(TiledWindow& rWindow)
 gtk_toolbar_set_style(GTK_TOOLBAR(pUpperToolbar), GTK_TOOLBAR_ICONS);
 
 // Save.
-GtkToolItem* pSave = gtk_tool_button_new(nullptr, nullptr);
-gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(pSave), 
"document-save-symbolic");
-gtk_tool_item_set_tooltip_text(pSave, "Save");
-gtk_toolbar_insert(GTK_TOOLBAR(pUpperToolbar), pSave, -1);
+rWindow.m_pSaveButton = gtk_tool_button_new(nullptr, nullptr);
+gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(rWindow.m_pSaveButton), 
"document-save-symbolic");
+gtk_tool_item_set_tooltip_text(rWindow.m_pSaveButton, "Save");
+gtk_toolbar_insert(GTK_TOOLBAR(pUpperToolbar), rWindow.m_pSaveButton, -1);
+g_signal_connect(G_OBJECT(rWindow.m_pSaveButton), "clicked", 
G_CALLBACK(toggleToolItem), nullptr);
+lcl_registerToolItem(rWindow, rWindow.m_pSaveButton, ".uno:Save");
+gtk_widget_set_sensitive(GTK_WIDGET(rWindow.m_pSaveButton), false);
+
 gtk_toolbar_insert(GTK_TOOLBAR(pUpperToolbar), 
gtk_separator_tool_item_new(), -1);
-g_signal_connect(G_OBJECT(pSave), "clicked", G_CALLBACK(toggleToolItem), 
nullptr);
-lcl_registerToolItem(rWindow, pSave, ".uno:Save");
 
 // Copy and paste.
-GtkToolItem* pCopyButton = gtk_tool_button_new( nullptr, nullptr);
-gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(pCopyButton), 
"edit-copy-symbolic");
-gtk_tool_item_set_tooltip_tex

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

2016-01-08 Thread Miklos Vajna
 libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx |   14 +-
 1 file changed, 9 insertions(+), 5 deletions(-)

New commits:
commit 13e0ec9f38736557d9b4737298ca9a858919e6e3
Author: Miklos Vajna 
Date:   Fri Jan 8 17:38:23 2016 +0100

gtktiledviewer: hide new view button when it's not supposed to work

Change-Id: I91003540f994eeaab78bc66ed6e0df9e9f59ee4b

diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx 
b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index 7c2cc56..3c8f781 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -1058,11 +1058,15 @@ static GtkWidget* createWindow(TiledWindow& rWindow)
 gtk_toolbar_insert(GTK_TOOLBAR(pUpperToolbar), pEnableEditing, -1);
 g_signal_connect(G_OBJECT(pEnableEditing), "toggled", 
G_CALLBACK(toggleEditing), nullptr);
 
-GtkToolItem* pNewViewButton = gtk_tool_button_new( nullptr, nullptr);
-gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (pNewViewButton), 
"view-continuous-symbolic");
-gtk_tool_item_set_tooltip_text(pNewViewButton, "New View");
-gtk_toolbar_insert(GTK_TOOLBAR(pUpperToolbar), pNewViewButton, -1);
-g_signal_connect(G_OBJECT(pNewViewButton), "clicked", 
G_CALLBACK(createView), nullptr);
+static bool bViewCallback = getenv("LOK_VIEW_CALLBACK");
+if (bViewCallback)
+{
+GtkToolItem* pNewViewButton = gtk_tool_button_new( nullptr, nullptr);
+gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (pNewViewButton), 
"view-continuous-symbolic");
+gtk_tool_item_set_tooltip_text(pNewViewButton, "New View");
+gtk_toolbar_insert(GTK_TOOLBAR(pUpperToolbar), pNewViewButton, -1);
+g_signal_connect(G_OBJECT(pNewViewButton), "clicked", 
G_CALLBACK(createView), nullptr);
+}
 gtk_box_pack_start(GTK_BOX(rWindow.m_pVBox), pUpperToolbar, FALSE, FALSE, 
0 ); // Adds to top.
 
 // Lower toolbar.
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-11-19 Thread Stephan Bergmann
 libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx |4 
 1 file changed, 4 insertions(+)

New commits:
commit 9a29e2f539fe3ca21229d6073455a736c64cc4e8
Author: Stephan Bergmann 
Date:   Fri Nov 20 08:55:58 2015 +0100

-Werror,-Wdeprecated-declarations

Change-Id: I7c7d3dda02a3745128a5a125b4b6952e087cdcda

diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx 
b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index 9c2692c..390f01b 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -19,6 +19,8 @@
 #include 
 #include 
 
+#include 
+
 #define LOK_USE_UNSTABLE_API
 #include 
 #include 
@@ -497,7 +499,9 @@ static void createModelAndView(const char* pLOPath, const 
char* pDocPath, const
 {
 GdkRGBA color;
 gdk_rgba_parse(&color, rArguments[i + 1].c_str());
+SAL_WNODEPRECATED_DECLARATIONS_PUSH
 
gtk_widget_override_background_color(gtk_widget_get_toplevel(pDocView), 
GTK_STATE_FLAG_NORMAL, &color);
+SAL_WNODEPRECATED_DECLARATIONS_POP
 }
 }
 std::stringstream aStream;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-11-19 Thread Miklos Vajna
 libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx |   10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

New commits:
commit 9dea0a9775c1ab8c6ce8bbf00df83757cba34fb0
Author: Miklos Vajna 
Date:   Thu Nov 19 17:29:31 2015 +0100

gtktiledviewer: allow setting custom background color

E.g. it helps testing the semi-transparent shadow around Writer pages to
append "--background-color yellow" to the commandline arguments.

Change-Id: Ib94750e936abe3f41e4982534431fd5115e2c543

diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx 
b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index f76ad1a..9c2692c 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -32,6 +32,7 @@ static int help()
 fprintf(stderr, "Usage: gtktiledviewer 
  
[ ... ]\n\n");
 fprintf(stderr, "Options:\n\n");
 fprintf(stderr, "--hide-whitespace: Hide whitespace between pages in text 
documents.\n");
+fprintf(stderr, "--background-color : Set custom background color, 
e.g. 'yellow'.\n");
 return 1;
 }
 
@@ -484,13 +485,20 @@ static void createModelAndView(const char* pLOPath, const 
char* pDocPath, const
 setupWidgetAndCreateWindow(pDocView);
 
 boost::property_tree::ptree aTree;
-for (const std::string& rArgument : rArguments)
+for (size_t i = 0; i < rArguments.size(); ++i)
 {
+const std::string& rArgument = rArguments[i];
 if (rArgument == "--hide-whitespace")
 {
 
aTree.put(boost::property_tree::ptree::path_type(".uno:HideWhitespace/type", 
'/'), "boolean");
 
aTree.put(boost::property_tree::ptree::path_type(".uno:HideWhitespace/value", 
'/'), true);
 }
+else if (rArgument == "--background-color" && i + 1 < 
rArguments.size())
+{
+GdkRGBA color;
+gdk_rgba_parse(&color, rArguments[i + 1].c_str());
+
gtk_widget_override_background_color(gtk_widget_get_toplevel(pDocView), 
GTK_STATE_FLAG_NORMAL, &color);
+}
 }
 std::stringstream aStream;
 boost::property_tree::write_json(aStream, aTree);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-11-17 Thread Miklos Vajna
 libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx |   17 -
 1 file changed, 16 insertions(+), 1 deletion(-)

New commits:
commit e0080a60ac2fb0a57cbf1ecbeda250e37d8b402e
Author: Miklos Vajna 
Date:   Tue Nov 17 20:57:49 2015 +0100

gtktiledviewer: set author name when inserting a comment

Change-Id: Iee66687ce813ff801f29e4568329ed2a39f905ba

diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx 
b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index c65e4a1..fe35f2e 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -10,6 +10,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -118,6 +119,7 @@ public:
 std::shared_ptr m_pRowBar;
 std::shared_ptr m_pColumnBar;
 std::shared_ptr m_pCornerButton;
+std::string m_aAuthor;
 
 TiledWindow()
 : m_pDocView(nullptr),
@@ -148,6 +150,8 @@ public:
 m_pFindbarLabel(nullptr),
 m_bFindAll(false)
 {
+struct passwd* pPasswd = getpwuid(getuid());
+m_aAuthor = std::string(pPasswd->pw_gecos);
 }
 };
 
@@ -800,7 +804,18 @@ static void toggleToolItem(GtkWidget* pWidget, gpointer 
/*pData*/)
 // notify about the finished Save
 gboolean bNotify = (rString == ".uno:Save");
 
-lok_doc_view_post_command(pLOKDocView, rString.c_str(), nullptr, 
bNotify);
+std::string aArguments;
+if (rString == ".uno:InsertAnnotation" && !rWindow.m_aAuthor.empty())
+{
+boost::property_tree::ptree aTree;
+aTree.put(boost::property_tree::ptree::path_type("Author/type", 
'/'), "string");
+aTree.put(boost::property_tree::ptree::path_type("Author/value", 
'/'), rWindow.m_aAuthor);
+std::stringstream aStream;
+boost::property_tree::write_json(aStream, aTree);
+aArguments = aStream.str();
+}
+
+lok_doc_view_post_command(pLOKDocView, rString.c_str(), 
(aArguments.empty() ? nullptr : aArguments.c_str()), bNotify);
 }
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-11-13 Thread Miklos Vajna
 libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 0bf24b19c7618ee83f88aa9364f68a4db1d2c04d
Author: Miklos Vajna 
Date:   Fri Nov 13 09:45:03 2015 +0100

libreofficekit: loplugin:cstylecast

Change-Id: Iea7ba258b661c09744191933fc23a06ed57fdf3b

diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx 
b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index b751fec..c16a87b 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -782,7 +782,7 @@ static void cursorChanged(LOKDocView* pDocView, gint nX, 
gint nY,
 static void formulaChanged(LOKDocView* pLOKDocView, char* pPayload, gpointer 
/*pData*/)
 {
 TiledWindow& rWindow = lcl_getTiledWindow(GTK_WIDGET(pLOKDocView));
-gtk_entry_set_text((GtkEntry*)rWindow.m_pFormulabarEntry, pPayload);
+gtk_entry_set_text(GTK_ENTRY(rWindow.m_pFormulabarEntry), pPayload);
 }
 
 static void toggleToolItem(GtkWidget* pWidget, gpointer /*pData*/)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-11-03 Thread Stephan Bergmann
 libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 1347b90c9e5f54fd0b7e7147519f34d3c1b282d5
Author: Stephan Bergmann 
Date:   Tue Nov 3 16:06:26 2015 +0100

-Werror,-Wformat-security

Change-Id: I34976a4900a73505a91d3e58736675ab39ad174c

diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx 
b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index fb05477..2ba6866 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -264,7 +264,7 @@ gboolean TiledRowColumnBar::docConfigureEvent(GtkWidget* 
pDocView, GdkEventConfi
 aCommand << "&height=" << 
int(lok_doc_view_pixel_to_twip(LOK_DOC_VIEW(pDocView), 
rWindow.m_pRowBar->m_nSizePixel));
 std::stringstream ss;
 ss << "lok::Document::getCommandValues(" << aCommand.str() << ")";
-g_info(ss.str().c_str());
+g_info("%s", ss.str().c_str());
 char* pValues = pDocument->pClass->getCommandValues(pDocument, 
aCommand.str().c_str());
 std::stringstream aStream(pValues);
 free(pValues);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-11-02 Thread Miklos Vajna
 libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx |   43 ++--
 1 file changed, 39 insertions(+), 4 deletions(-)

New commits:
commit 7c4733661b0a80098e84413fbc91b84b4c14cfc1
Author: Miklos Vajna 
Date:   Mon Nov 2 17:03:08 2015 +0100

gtktiledviewer: adjust spreadsheet row/column headers on scrolling

Change-Id: I7ed9e19df071b6baf1e941faee24c332c7b5e804

diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx 
b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index 3d6577d..5f76e36 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -57,12 +57,16 @@ public:
 std::vector m_aHeaders;
 /// Height for row bar, width for column bar.
 int m_nSizePixel;
+/// Left/top position for the column/row bar -- initially 0, then may grow 
due to scrolling.
+int m_nPositionPixel;
 TiledBarType m_eType;
 
 TiledRowColumnBar(TiledBarType eType);
 static gboolean draw(GtkWidget* pWidget, cairo_t* pCairo, gpointer pData);
 gboolean drawImpl(GtkWidget* pWidget, cairo_t* pCairo);
 static gboolean docConfigureEvent(GtkWidget* pWidget, GdkEventConfigure* 
pEvent, gpointer pData);
+/// Adjustments of the doc widget changed -- horizontal or vertical scroll.
+static void docAdjustmentChanged(GtkAdjustment* pAdjustment, gpointer 
pData);
 /// Draws rText at the center of rRectangle on pCairo.
 static void drawText(cairo_t* pCairo, const GdkRectangle& rRectangle, 
const std::string& rText);
 };
@@ -233,17 +237,26 @@ gboolean TiledRowColumnBar::drawImpl(GtkWidget* 
/*pWidget*/, cairo_t* pCairo)
 return FALSE;
 }
 
+void TiledRowColumnBar::docAdjustmentChanged(GtkAdjustment* /*pAdjustment*/, 
gpointer pData)
+{
+GtkWidget* pDocView = static_cast(pData);
+docConfigureEvent(pDocView, 0, 0);
+}
+
 gboolean TiledRowColumnBar::docConfigureEvent(GtkWidget* pDocView, 
GdkEventConfigure* /*pEvent*/, gpointer /*pData*/)
 {
 TiledWindow& rWindow = lcl_getTiledWindow(pDocView);
 GtkAdjustment* pVAdjustment = 
gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(rWindow.m_pScrolledWindow));
 rWindow.m_pRowBar->m_nSizePixel = 
gtk_adjustment_get_page_size(pVAdjustment);
+rWindow.m_pRowBar->m_nPositionPixel = 
gtk_adjustment_get_value(pVAdjustment);
 GtkAdjustment* pHAdjustment = 
gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(rWindow.m_pScrolledWindow));
 rWindow.m_pColumnBar->m_nSizePixel = 
gtk_adjustment_get_page_size(pHAdjustment);
+rWindow.m_pColumnBar->m_nPositionPixel = 
gtk_adjustment_get_value(pHAdjustment);
 
 LibreOfficeKitDocument* pDocument = 
lok_doc_view_get_document(LOK_DOC_VIEW(pDocView));
 if (pDocument && pDocument->pClass->getDocumentType(pDocument) == 
LOK_DOCTYPE_SPREADSHEET)
 {
+g_info("lok::Document::getCommandValues(.uno:ViewRowColumnHeaders)");
 char* pValues = pDocument->pClass->getCommandValues(pDocument, 
".uno:ViewRowColumnHeaders");
 std::stringstream aStream(pValues);
 free(pValues);
@@ -254,21 +267,39 @@ gboolean TiledRowColumnBar::docConfigureEvent(GtkWidget* 
pDocView, GdkEventConfi
 gtk_widget_show(rWindow.m_pCornerButton->m_pDrawingArea);
 
 rWindow.m_pRowBar->m_aHeaders.clear();
+int nTotal = 0;
 for (boost::property_tree::ptree::value_type& rValue : 
aTree.get_child("rows"))
 {
 int nSize = lok_doc_view_twip_to_pixel(LOK_DOC_VIEW(pDocView), 
std::atof(rValue.second.get("size").c_str()));
-Header aHeader(nSize, rValue.second.get("text"));
-rWindow.m_pRowBar->m_aHeaders.push_back(aHeader);
+int nScrolledSize = nSize;
+if (nTotal + nSize >= rWindow.m_pRowBar->m_nPositionPixel)
+{
+if (nTotal < rWindow.m_pRowBar->m_nPositionPixel)
+// First visible row: reduce height because the row is 
only partially visible.
+nScrolledSize = nTotal + nSize - 
rWindow.m_pRowBar->m_nPositionPixel;
+Header aHeader(nScrolledSize, 
rValue.second.get("text"));
+rWindow.m_pRowBar->m_aHeaders.push_back(aHeader);
+}
+nTotal += nSize;
 }
 gtk_widget_show(rWindow.m_pRowBar->m_pDrawingArea);
 gtk_widget_queue_draw(rWindow.m_pRowBar->m_pDrawingArea);
 
 rWindow.m_pColumnBar->m_aHeaders.clear();
+nTotal = 0;
 for (boost::property_tree::ptree::value_type& rValue : 
aTree.get_child("columns"))
 {
 int nSize = lok_doc_view_twip_to_pixel(LOK_DOC_VIEW(pDocView), 
std::atof(rValue.second.get("size").c_str()));
-Header aHeader(nSize, rValue.second.get("text"));
-rWindow.m_pColumnBar->m_aHeaders.push_back(aHeader);
+int nScrolledSize = nSize;
+if (nTotal + nSize >= rWindow.m_pColumnBar->m_nPositionPixel)
+{
+if (nTotal < rWindo

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

2015-11-02 Thread Miklos Vajna
 libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx |6 --
 sc/source/core/data/global.cxx  |6 +++---
 sc/source/ui/view/tabview.cxx   |7 +--
 3 files changed, 12 insertions(+), 7 deletions(-)

New commits:
commit 708d1c5ab242b545ced598879233fc662d7e6cc0
Author: Miklos Vajna 
Date:   Mon Nov 2 10:56:43 2015 +0100

sc lok: emit RowColumnHeader info in twips

As that's the unit we use everywhere else in the LOK API. Also, make the
ScGlobal::nScreenPPTX/Y calculation more precise, otherwise rounding
errors occur during the pixel -> twip conversion.

Example with the old precision: col height is 103 px, nScreenPPTY is
0.067, twips is 1537.3134328358208, convering it back is 102.487562189
px.

Example with the new precision: col height is 103 px, nScreenPPTY is
0.0667, twips is 1544.2278860569716, convering it back is 102.948525737
px.

Change-Id: I19f5285508ef0c751614d07969b3a7a037e7d1ec

diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx 
b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index 23233ac..db7beb4 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -250,7 +250,8 @@ gboolean TiledRowColumnBar::docConfigureEvent(GtkWidget* 
pDocView, GdkEventConfi
 rWindow.m_pRowBar->m_aHeaders.clear();
 for (boost::property_tree::ptree::value_type& rValue : 
aTree.get_child("rows"))
 {
-Header 
aHeader(std::atoi(rValue.second.get("size").c_str()), 
rValue.second.get("text"));
+int nSize = 
std::round(lok_doc_view_twip_to_pixel(LOK_DOC_VIEW(pDocView), 
std::atof(rValue.second.get("size").c_str(;
+Header aHeader(nSize, rValue.second.get("text"));
 rWindow.m_pRowBar->m_aHeaders.push_back(aHeader);
 }
 gtk_widget_show(rWindow.m_pRowBar->m_pDrawingArea);
@@ -259,7 +260,8 @@ gboolean TiledRowColumnBar::docConfigureEvent(GtkWidget* 
pDocView, GdkEventConfi
 rWindow.m_pColumnBar->m_aHeaders.clear();
 for (boost::property_tree::ptree::value_type& rValue : 
aTree.get_child("columns"))
 {
-Header 
aHeader(std::atoi(rValue.second.get("size").c_str()), 
rValue.second.get("text"));
+int nSize = 
std::round(lok_doc_view_twip_to_pixel(LOK_DOC_VIEW(pDocView), 
std::atof(rValue.second.get("size").c_str(;
+Header aHeader(nSize, rValue.second.get("text"));
 rWindow.m_pColumnBar->m_aHeaders.push_back(aHeader);
 }
 gtk_widget_show(rWindow.m_pColumnBar->m_pDrawingArea);
diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx
index 90d31e9..c97c026 100644
--- a/sc/source/core/data/global.cxx
+++ b/sc/source/core/data/global.cxx
@@ -545,9 +545,9 @@ void ScGlobal::UpdatePPT( OutputDevice* pDev )
 
 if ( !pDev )
 pDev = Application::GetDefaultDevice();
-Point aPix1000 = pDev->LogicToPixel( Point(1000,1000), MAP_TWIP );
-nScreenPPTX = aPix1000.X() / 1000.0;
-nScreenPPTY = aPix1000.Y() / 1000.0;
+Point aPix1000 = pDev->LogicToPixel( Point(1,1), MAP_TWIP );
+nScreenPPTX = aPix1000.X() / 1.0;
+nScreenPPTY = aPix1000.Y() / 1.0;
 nPPTZoom = nCurrentZoom;
 }
 }
diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx
index 7254ff9..744ccb0 100644
--- a/sc/source/ui/view/tabview.cxx
+++ b/sc/source/ui/view/tabview.cxx
@@ -2289,12 +2289,15 @@ OUString ScTabView::getRowColumnHeaders()
 SCROW nEndRow = 0;
 pDoc->GetTiledRenderingArea(aViewData.GetTabNo(), nEndCol, nEndRow);
 
+double nPPTX = aViewData.GetPPTX();
+double nPPTY = aViewData.GetPPTY();
+
 boost::property_tree::ptree aRows;
 for (SCROW nRow = 0; nRow <= nEndRow; ++nRow)
 {
 boost::property_tree::ptree aRow;
 sal_uInt16 nSize = pRowBar[SC_SPLIT_BOTTOM]->GetEntrySize(nRow);
-aRow.put("size", OString::number(nSize).getStr());
+aRow.put("size", OString::number(nSize / nPPTY).getStr());
 OUString aText = pRowBar[SC_SPLIT_BOTTOM]->GetEntryText(nRow);
 aRow.put("text", aText.toUtf8().getStr());
 aRows.push_back(std::make_pair("", aRow));
@@ -2305,7 +2308,7 @@ OUString ScTabView::getRowColumnHeaders()
 {
 boost::property_tree::ptree aCol;
 sal_uInt16 nSize = pColBar[SC_SPLIT_LEFT]->GetEntrySize(nCol);
-aCol.put("size", OString::number(nSize).getStr());
+aCol.put("size", OString::number(nSize / nPPTX).getStr());
 OUString aText = pColBar[SC_SPLIT_LEFT]->GetEntryText(nCol);
 aCol.put("text", aText.toUtf8().getStr());
 aCols.push_back(std::make_pair("", aCol));
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice

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

2015-10-30 Thread Stephan Bergmann
 libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 86585175a607982f0549ddad19851f1ebf52148c
Author: Stephan Bergmann 
Date:   Fri Oct 30 16:54:39 2015 +0100

loplugin:staticmethods

Change-Id: I9ac908d0981734e4b2930a79f160ec0462127483

diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx 
b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index 72297aa..5097135 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -74,7 +74,7 @@ public:
 GtkWidget* m_pDrawingArea;
 TiledCornerButton();
 static gboolean draw(GtkWidget* pWidget, cairo_t* pCairo, gpointer pData);
-gboolean drawImpl(GtkWidget* pWidget, cairo_t* pCairo);
+static gboolean drawImpl(GtkWidget* pWidget, cairo_t* pCairo);
 };
 
 /// Represents all the state that is specific to one GtkWindow of this app.
@@ -264,9 +264,9 @@ TiledCornerButton::TiledCornerButton()
 g_signal_connect(m_pDrawingArea, "draw", 
G_CALLBACK(TiledCornerButton::draw), this);
 }
 
-gboolean TiledCornerButton::draw(GtkWidget* pWidget, cairo_t* pCairo, gpointer 
pData)
+gboolean TiledCornerButton::draw(GtkWidget* pWidget, cairo_t* pCairo, gpointer)
 {
-return static_cast(pData)->drawImpl(pWidget, pCairo);
+return drawImpl(pWidget, pCairo);
 }
 
 gboolean TiledCornerButton::drawImpl(GtkWidget* /*pWidget*/, cairo_t* pCairo)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-10-30 Thread Noel Grandin
 libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit bee72ee6199950f9489ac4ed313db63586f2b742
Author: Noel Grandin 
Date:   Fri Oct 30 14:24:26 2015 +0200

loplugin:staticmethods

Change-Id: I4cdf2fa91dde1968cfb984faf0bdd3aad42eefd2

diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx 
b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index 8d6d172..2502b50 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -60,7 +60,7 @@ public:
 static gboolean docConfigureEvent(GtkWidget* pWidget, GdkEventConfigure* 
pEvent, gpointer pData);
 gboolean docConfigureEventImpl(GtkWidget* pWidget, GdkEventConfigure* 
pEvent);
 /// Draws rText at the center of rRectangle on pCairo.
-void drawText(cairo_t* pCairo, const GdkRectangle& rRectangle, const 
std::string& rText);
+static void drawText(cairo_t* pCairo, const GdkRectangle& rRectangle, 
const std::string& rText);
 };
 
 /// Represents all the state that is specific to one GtkWindow of this app.
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-08-17 Thread Pranav Kant
 libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx |   85 
 libreofficekit/source/gtk/lokdocview.cxx|   25 +
 2 files changed, 93 insertions(+), 17 deletions(-)

New commits:
commit a9b266aeea80423210618fe4c015e4791ceb1bc2
Author: Pranav Kant 
Date:   Sat Aug 15 18:48:11 2015 +0530

gtktiledviewer: Jump to cursor position when it changes

Change-Id: If50ac0bd21e59b0e0639aa353513451e88ae2a9f

diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx 
b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index 73db976..8de7110 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -57,6 +57,25 @@ static void lcl_registerToolItem(GtkToolItem* pItem, const 
std::string& rName)
 
 const float fZooms[] = { 0.25, 0.5, 0.75, 1.0, 1.5, 2.0, 3.0, 5.0 };
 
+
+/// Get the visible area of the scrolled window
+static void getVisibleAreaTwips(GdkRectangle* pArea)
+{
+#if GTK_CHECK_VERSION(2,14,0) // we need gtk_adjustment_get_page_size()
+GtkAdjustment* pHAdjustment = 
gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(pScrolledWindow));
+GtkAdjustment* pVAdjustment = 
gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(pScrolledWindow));
+
+pArea->x  = lok_doc_view_pixel_to_twip(LOK_DOC_VIEW(pDocView),
+   
gtk_adjustment_get_value(pHAdjustment));
+pArea->y  = lok_doc_view_pixel_to_twip(LOK_DOC_VIEW(pDocView),
+   
gtk_adjustment_get_value(pVAdjustment));
+pArea->width  = lok_doc_view_pixel_to_twip(LOK_DOC_VIEW(pDocView),
+   
gtk_adjustment_get_page_size(pHAdjustment));
+pArea->height = lok_doc_view_pixel_to_twip(LOK_DOC_VIEW(pDocView),
+   
gtk_adjustment_get_page_size(pVAdjustment));
+#endif
+}
+
 static void changeZoom( GtkWidget* pButton, gpointer /* pItem */ )
 {
 const char *sName = gtk_tool_button_get_icon_name( 
GTK_TOOL_BUTTON(pButton) );
@@ -175,23 +194,6 @@ static void doCopy(GtkWidget* /*pButton*/, gpointer 
/*pItem*/)
 free(pUsedFormat);
 }
 
-/// Get the visible area of the scrolled window
-static void getVisibleAreaTwips(GdkRectangle* pArea)
-{
-#if GTK_CHECK_VERSION(2,14,0) // we need gtk_adjustment_get_page_size()
-GtkAdjustment* pHAdjustment = 
gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(pScrolledWindow));
-GtkAdjustment* pVAdjustment = 
gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(pScrolledWindow));
-
-pArea->x  = lok_doc_view_pixel_to_twip(LOK_DOC_VIEW(pDocView),
-   
gtk_adjustment_get_value(pHAdjustment));
-pArea->y  = lok_doc_view_pixel_to_twip(LOK_DOC_VIEW(pDocView),
-   
gtk_adjustment_get_value(pVAdjustment));
-pArea->width  = lok_doc_view_pixel_to_twip(LOK_DOC_VIEW(pDocView),
-   
gtk_adjustment_get_page_size(pHAdjustment));
-pArea->height = lok_doc_view_pixel_to_twip(LOK_DOC_VIEW(pDocView),
-   
gtk_adjustment_get_page_size(pVAdjustment));
-#endif
-}
 
 /// Searches for the next or previous text of pFindbarEntry.
 static void doSearch(bool bBackwards)
@@ -319,6 +321,54 @@ static void signalHyperlink(LOKDocView* /*pLOKDocView*/, 
char* pPayload, gpointe
 }
 }
 
+/// Cursor position changed
+static void cursorChanged(LOKDocView* /*pDocView*/, gint nX, gint nY,
+  gint /*nWidth*/, gint /*nHeight*/, gpointer 
/*pData*/)
+{
+GtkAdjustment* vadj = 
gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(pScrolledWindow));
+GtkAdjustment* hadj = 
gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(pScrolledWindow));
+GdkRectangle visArea;
+gdouble upper;
+gint x = -1, y = -1;
+
+getVisibleAreaTwips(&visArea);
+
+// check vertically
+if (nY < visArea.y)
+{
+y = nY - visArea.height/2;
+if (y < 0)
+y = gtk_adjustment_get_lower(vadj);
+}
+else if (nY > visArea.y + visArea.height)
+{
+y = nY - visArea.height/2;
+upper = lok_doc_view_pixel_to_twip(LOK_DOC_VIEW(pDocView), 
gtk_adjustment_get_upper(vadj));
+if (y > upper)
+y = upper;
+
+}
+
+if (nX < visArea.x)
+{
+x = nX - visArea.width/2;
+if (x < 0)
+x = gtk_adjustment_get_lower(hadj);
+}
+else if (nX > visArea.x + visArea.width)
+{
+x = nX - visArea.width/2;
+upper = lok_doc_view_pixel_to_twip(LOK_DOC_VIEW(pDocView), 
gtk_adjustment_get_upper(hadj));
+if (x > upper)
+x = upper;
+}
+
+if (y!=-1)
+gtk_adjustment_set_value(vadj, 
lok_doc_view_twip_to_pixel(LOK_DOC_VIEW(pDocView), y));
+if (x!=-1)
+gtk_adjustment_set_value(hadj,

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

2015-07-27 Thread Mihai Varga
 libreofficekit/qa/data/calc_sheetnames.ods |binary
 libreofficekit/qa/unit/tiledrendering.cxx  |   24 +---
 sc/inc/docuno.hxx  |3 +++
 sc/source/ui/unoobj/docuno.cxx |8 
 4 files changed, 32 insertions(+), 3 deletions(-)

New commits:
commit 50fe21c7807afb9650c048e1a82bd97a7fc1d226
Author: Mihai Varga 
Date:   Wed Jul 22 16:21:08 2015 +0300

tiledrendering: added getPartName method for calc

This method is used to get the sheet's name and to display it
in the tabs (sheet selector)
I've also added an unit test for it and uncommented a similar one

Change-Id: Ia866815c594a873812c71a6c86e303c869e1f093
Reviewed-on: https://gerrit.libreoffice.org/17294
Tested-by: Jenkins 
Reviewed-by: Jan Holesovsky 

diff --git a/libreofficekit/qa/data/calc_sheetnames.ods 
b/libreofficekit/qa/data/calc_sheetnames.ods
new file mode 100644
index 000..f6627a0
Binary files /dev/null and b/libreofficekit/qa/data/calc_sheetnames.ods differ
diff --git a/libreofficekit/qa/unit/tiledrendering.cxx 
b/libreofficekit/qa/unit/tiledrendering.cxx
index 2499fc5..0ebbc6a 100644
--- a/libreofficekit/qa/unit/tiledrendering.cxx
+++ b/libreofficekit/qa/unit/tiledrendering.cxx
@@ -65,8 +65,9 @@ public:
 
 void testDocumentLoadFail( Office* pOffice );
 void testDocumentTypes( Office* pOffice );
-#if 0
 void testImpressSlideNames( Office* pOffice );
+void testCalcSheetNames( Office* pOffice );
+#if 0
 void testOverlay( Office* pOffice );
 #endif
 
@@ -90,8 +91,9 @@ void TiledRenderingTest::runAllTests()
 
 testDocumentLoadFail( pOffice.get() );
 testDocumentTypes( pOffice.get() );
-#if 0
 testImpressSlideNames( pOffice.get() );
+testCalcSheetNames( pOffice.get() );
+#if 0
 testOverlay( pOffice.get() );
 #endif
 }
@@ -142,7 +144,6 @@ void TiledRenderingTest::testDocumentTypes( Office* pOffice 
)
 // TODO: do this for all supported document types
 }
 
-#if 0
 void TiledRenderingTest::testImpressSlideNames( Office* pOffice )
 {
 const string sDocPath = m_sSrcRoot + 
"/libreofficekit/qa/data/impress_slidenames.odp";
@@ -164,6 +165,23 @@ void TiledRenderingTest::testImpressSlideNames( Office* 
pOffice )
 // have a localised version of "Slide 3".
 }
 
+void TiledRenderingTest::testCalcSheetNames( Office* pOffice )
+{
+const string sDocPath = m_sSrcRoot + 
"/libreofficekit/qa/data/calc_sheetnames.ods";
+const string sLockFile = m_sSrcRoot 
+"/libreofficekit/qa/data/.~lock.calc_sheetnames.ods#";
+
+// FIXME: LOK will fail when trying to open a locked file
+remove( sLockFile.c_str() );
+
+scoped_ptr< Document> pDocument( pOffice->documentLoad( sDocPath.c_str() ) 
);
+
+CPPUNIT_ASSERT( pDocument->getParts() == 3 );
+CPPUNIT_ASSERT( strcmp( pDocument->getPartName( 0 ), "TestText1" ) == 0 );
+CPPUNIT_ASSERT( strcmp( pDocument->getPartName( 1 ), "TestText2" ) == 0 );
+CPPUNIT_ASSERT( strcmp( pDocument->getPartName( 2 ), "Sheet3" ) == 0 );
+}
+
+#if 0
 static void dumpRGBABitmap( const OUString& rPath, const unsigned char* 
pBuffer,
 const int nWidth, const int nHeight )
 {
diff --git a/sc/inc/docuno.hxx b/sc/inc/docuno.hxx
index a7e9af5..cd68885 100644
--- a/sc/inc/docuno.hxx
+++ b/sc/inc/docuno.hxx
@@ -388,6 +388,9 @@ public:
 /// @see vcl::ITiledRenderable::getParts().
 virtual int getParts() SAL_OVERRIDE;
 
+/// @see vcl::ITiledRenderable::getPartName().
+virtual OUString getPartName(int nPart) SAL_OVERRIDE;
+
 /// @see vcl::ITiledRenderable::initializeForTiledRendering().
 virtual void initializeForTiledRendering() SAL_OVERRIDE;
 
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index a1bf527..fd9cb63 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -510,6 +510,14 @@ int ScModelObj::getPart()
 return pViewData->GetTabNo();
 }
 
+OUString ScModelObj::getPartName( int nPart )
+{
+OUString sTabName;
+ScViewData* pViewData = ScDocShell::GetViewData();
+pViewData->GetDocument()->GetName(nPart, sTabName);
+return sTabName;
+}
+
 Size ScModelObj::getDocumentSize()
 {
 Size aSize(10, 10); // minimum size
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-06-29 Thread Caolán McNamara
 libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 48abc97220bd95841225cf4e18cd067ef470929a
Author: Caolán McNamara 
Date:   Mon Jun 29 13:31:56 2015 +0100

g_assert_nonnull was not declared

Change-Id: Ie98c37d4bdaa365ac27e8620fb5bbecbb0faccdf

diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx 
b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index f7b065c..ec70a88 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -520,7 +520,9 @@ int main( int argc, char* argv[] )
 
 // Docview
 pDocView = lok_doc_view_new (argv[1], NULL, NULL);
+#if GLIB_CHECK_VERSION(2,40,0)
 g_assert_nonnull(pDocView);
+#endif
 
 g_signal_connect(pDocView, "edit-changed", G_CALLBACK(signalEdit), NULL);
 g_signal_connect(pDocView, "command-changed", G_CALLBACK(signalCommand), 
NULL);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-06-18 Thread Miklos Vajna
 libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx |   21 
 1 file changed, 21 insertions(+)

New commits:
commit 437210d58f32177ef1829d704f7f4d2f1bbfbfdd
Author: Miklos Vajna 
Date:   Thu Jun 18 09:18:18 2015 +0200

gtktiledviewer: add copy button

Change-Id: I56ed5047da118eac01d7dea150597133215278e2

diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx 
b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index 8b00679..9496ba5 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -125,6 +125,19 @@ static void toggleFindbar(GtkWidget* /*pButton*/, gpointer 
/*pItem*/)
 }
 }
 
+/// Handler for the copy button: write clipboard.
+static void doCopy(GtkWidget* /*pButton*/, gpointer /*pItem*/)
+{
+LOKDocView* pLOKDocView = LOK_DOC_VIEW(pDocView);
+LibreOfficeKitDocument* pDocument = lok_doc_view_get_document(pLOKDocView);
+char* pSelection = pDocument->pClass->getTextSelection(pDocument, 
"text/plain;charset=utf-8");
+
+GtkClipboard* pClipboard = 
gtk_clipboard_get_for_display(gtk_widget_get_display(pDocView), 
GDK_SELECTION_CLIPBOARD);
+gtk_clipboard_set_text(pClipboard, pSelection, -1);
+
+free(pSelection);
+}
+
 /// Get the visible area of the scrolled window
 static void getVisibleAreaTwips(GdkRectangle* pArea)
 {
@@ -394,6 +407,14 @@ int main( int argc, char* argv[] )
 gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), pPartModeSelectorToolItem, -1 );
 
 gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), gtk_separator_tool_item_new(), 
-1);
+
+// Cut, copy & paste.
+GtkToolItem* pCopyButton = gtk_tool_button_new( NULL, NULL);
+gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(pCopyButton), 
"edit-copy-symbolic");
+gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), pCopyButton, -1);
+g_signal_connect(G_OBJECT(pCopyButton), "clicked", G_CALLBACK(doCopy), 
NULL);
+gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), gtk_separator_tool_item_new(), 
-1);
+
 pEnableEditing = gtk_toggle_tool_button_new();
 gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (pEnableEditing), 
"insert-text-symbolic");
 gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), pEnableEditing, -1);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-05-23 Thread Miklos Vajna
 libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 5d9c2f2115dd8d3741501cbbc0313e4609bee896
Author: Miklos Vajna 
Date:   Sat May 23 11:08:07 2015 +0100

libreofficekit: fix Linux baseline build

Change-Id: Ib0a076d78aacfec5e0625d7592ae24815e600ad6

diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx 
b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index d066a83..188d662 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -458,9 +458,9 @@ int main( int argc, char* argv[] )
 populatePartModeSelector( GTK_COMBO_BOX_TEXT(pPartModeComboBox) );
 // Connect these signals after populating the selectors, to avoid 
re-rendering on setting the default part/partmode.
 g_signal_connect(G_OBJECT(pPartModeComboBox), "changed", 
G_CALLBACK(changePartMode), 0);
-#endif
 
 g_signal_connect(G_OBJECT(pPartSelector), "changed", 
G_CALLBACK(changePart), 0);
+#endif
 
 gtk_main();
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-05-08 Thread Pranav Kant
 libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx |   24 ++--
 1 file changed, 12 insertions(+), 12 deletions(-)

New commits:
commit 92361b81d46b0c4cea71cf8643130d636f1821b6
Author: Pranav Kant 
Date:   Fri May 8 23:07:52 2015 +0530

gtktiledviewer: Make all functions static

These functions are only being used inside this file.

Change-Id: I473b33f794cfbaff590d00f22d2832456482d15a
Reviewed-on: https://gerrit.libreoffice.org/15680
Tested-by: Jenkins 
Reviewed-by: Miklos Vajna 

diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx 
b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index cb84ee7..7509b2f 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -59,7 +59,7 @@ static void lcl_registerToolItem(GtkToolItem* pItem, const 
std::string& rName)
 
 const float fZooms[] = { 0.25, 0.5, 0.75, 1.0, 1.5, 2.0, 3.0, 5.0 };
 
-void changeZoom( GtkWidget* pButton, gpointer /* pItem */ )
+static void changeZoom( GtkWidget* pButton, gpointer /* pItem */ )
 {
 const char *sName = gtk_tool_button_get_stock_id( GTK_TOOL_BUTTON(pButton) 
);
 
@@ -107,7 +107,7 @@ void changeZoom( GtkWidget* pButton, gpointer /* pItem */ )
 }
 
 /// User clicked on the button -> inform LOKDocView.
-void toggleEditing(GtkWidget* /*pButton*/, gpointer /*pItem*/)
+static void toggleEditing(GtkWidget* /*pButton*/, gpointer /*pItem*/)
 {
 LOKDocView* pLOKDocView = LOK_DOCVIEW(pDocView);
 bool bActive = 
gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(pEnableEditing));
@@ -116,7 +116,7 @@ void toggleEditing(GtkWidget* /*pButton*/, gpointer 
/*pItem*/)
 }
 
 /// Toggle the visibility of the findbar.
-void toggleFindbar(GtkWidget* /*pButton*/, gpointer /*pItem*/)
+static void toggleFindbar(GtkWidget* /*pButton*/, gpointer /*pItem*/)
 {
 #if GTK_CHECK_VERSION(2,18,0) // we need gtk_widget_get_visible()
 if (gtk_widget_get_visible(pFindbar))
@@ -146,7 +146,7 @@ static gboolean signalKey(GtkWidget* pWidget, GdkEventKey* 
pEvent, gpointer pDat
 }
 
 /// Searches for the next or previous text of pFindbarEntry.
-void doSearch(bool bBackwards)
+static void doSearch(bool bBackwards)
 {
 GtkEntry* pEntry = GTK_ENTRY(pFindbarEntry);
 const char* pText = gtk_entry_get_text(pEntry);
@@ -163,19 +163,19 @@ void doSearch(bool bBackwards)
 }
 
 /// Click handler for the search next button.
-void signalSearchNext(GtkWidget* /*pButton*/, gpointer /*pItem*/)
+static void signalSearchNext(GtkWidget* /*pButton*/, gpointer /*pItem*/)
 {
 doSearch(/*bBackwards=*/false);
 }
 
 /// Click handler for the search previous button.
-void signalSearchPrev(GtkWidget* /*pButton*/, gpointer /*pItem*/)
+static void signalSearchPrev(GtkWidget* /*pButton*/, gpointer /*pItem*/)
 {
 doSearch(/*bBackwards=*/true);
 }
 
 /// Handles the key-press-event of the search entry widget.
-gboolean signalFindbar(GtkWidget* /*pWidget*/, GdkEventKey* pEvent, gpointer 
/*pData*/)
+static gboolean signalFindbar(GtkWidget* /*pWidget*/, GdkEventKey* pEvent, 
gpointer /*pData*/)
 {
 switch(pEvent->keyval)
 {
@@ -231,7 +231,7 @@ static void signalCommand(LOKDocView* /*pLOKDocView*/, 
char* pPayload, gpointer
 }
 
 /// User clicked on a cmmand button -> inform LOKDocView.
-void toggleToolItem(GtkWidget* pWidget, gpointer /*pData*/)
+static void toggleToolItem(GtkWidget* pWidget, gpointer /*pData*/)
 {
 if (g_bToolItemBroadcast)
 {
@@ -245,7 +245,7 @@ void toggleToolItem(GtkWidget* pWidget, gpointer /*pData*/)
 
 // GtkComboBox requires gtk 2.24 or later
 #if ( GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 24 ) || GTK_MAJOR_VERSION 
> 2
-void populatePartSelector()
+static void populatePartSelector()
 {
 gtk_list_store_clear( GTK_LIST_STORE(
   gtk_combo_box_get_model(
@@ -273,7 +273,7 @@ void populatePartSelector()
   lok_docview_get_part( LOK_DOCVIEW(pDocView) ) );
 }
 
-void changePart( GtkWidget* pSelector, gpointer /* pItem */ )
+static void changePart( GtkWidget* pSelector, gpointer /* pItem */ )
 {
 int nPart = gtk_combo_box_get_active( GTK_COMBO_BOX(pSelector) );
 
@@ -283,7 +283,7 @@ void changePart( GtkWidget* pSelector, gpointer /* pItem */ 
)
 }
 }
 
-void populatePartModeSelector( GtkComboBoxText* pSelector )
+static void populatePartModeSelector( GtkComboBoxText* pSelector )
 {
 gtk_combo_box_text_append_text( pSelector, "Default" );
 gtk_combo_box_text_append_text( pSelector, "Slide" );
@@ -293,7 +293,7 @@ void populatePartModeSelector( GtkComboBoxText* pSelector )
 gtk_combo_box_set_active( GTK_COMBO_BOX(pSelector), 0 );
 }
 
-void changePartMode( GtkWidget* pSelector, gpointer /* pItem */ )
+static void changePartMode( GtkWidget* pSelector, gpointer /* pItem */ )
 {
 // Just convert directly back to the LibreOfficeKitPartMode enum.
 // I.e. the ordering above should match the enum member ordering.

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

2015-05-08 Thread Pranav Kant
 libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx |   11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

New commits:
commit 40ad68bbe7cd1c86a8ebefb1539fb7b403506792
Author: Pranav Kant 
Date:   Fri May 8 19:19:57 2015 +0530

gtktiledviewer: Stop event propagation to GtkToolbar when in edit mode

If not stopped, key-press events are interpreted by both LOKDocView and
GtkToolbar leading to poor editing experience.

Change-Id: Ie878d168e202a0f3e1d52191aa3fd7cc00a7cbfd
Reviewed-on: https://gerrit.libreoffice.org/15677
Tested-by: Miklos Vajna 
Reviewed-by: Miklos Vajna 

diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx 
b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index 14cf767..cb84ee7 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -132,12 +132,17 @@ void toggleFindbar(GtkWidget* /*pButton*/, gpointer 
/*pItem*/)
 }
 
 /// Handles the key-press-event of the window.
-static void signalKey(GtkWidget* pWidget, GdkEventKey* pEvent, gpointer pData)
+static gboolean signalKey(GtkWidget* pWidget, GdkEventKey* pEvent, gpointer 
pData)
 {
+LOKDocView* pLOKDocView = LOK_DOCVIEW(pDocView);
 #if GTK_CHECK_VERSION(2,18,0) // we need gtk_widget_get_visible()
-if (!gtk_widget_get_visible(pFindbar))
-lok_docview_post_key(pWidget, pEvent, pData);
+if (!gtk_widget_get_visible(pFindbar) && 
bool(lok_docview_get_edit(pLOKDocView)))
+{
+lok_docview_post_key(pWidget, pEvent, pData);
+return TRUE;
+}
 #endif
+return FALSE;
 }
 
 /// Searches for the next or previous text of pFindbarEntry.
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-05-08 Thread Tor Lillqvist
 libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit c5a96b5d3d2a40ab202acc1559c361712d8ffe32
Author: Tor Lillqvist 
Date:   Fri May 8 10:50:14 2015 +0300

Clarify the usage message a bit

Change-Id: I6ae2f5c12ae5c20fd2f33bff639129dd303c3c20

diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx 
b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index 72988d7..14cf767 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -28,7 +28,7 @@
 
 static int help()
 {
-fprintf( stderr, "Usage: gtktiledviewer 
 \n" );
+fprintf( stderr, "Usage: gtktiledviewer 
 
\n" );
 return 1;
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


  1   2   >