summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorAndrzej Hunt <andrzej.hunt@collabora.com>2014-05-07 20:14:59 +0100
committerAndrzej Hunt <andrzej.hunt@collabora.com>2014-06-25 13:04:27 +0100
commit9e4f23698af8079edc114d7006ef6a7fc229c1c9 (patch)
tree9831192192211e33811798c29b81115a308ccbee /desktop
parent03675ab4a8994cb7000fd738d1685720c8b9e584 (diff)
TiledRendering: outline of basic gtk tiled rendering app using liblibreoffice.
Change-Id: I46760c0a1329b9823fd999c470b57fef66d28914
Diffstat (limited to 'desktop')
-rw-r--r--desktop/Executable_gtktiledviewer.mk44
-rw-r--r--desktop/Module_desktop.mk8
-rw-r--r--desktop/qa/gtktiledviewer/gtktiledviewer.cxx67
3 files changed, 119 insertions, 0 deletions
diff --git a/desktop/Executable_gtktiledviewer.mk b/desktop/Executable_gtktiledviewer.mk
new file mode 100644
index 000000000000..cb70de407391
--- /dev/null
+++ b/desktop/Executable_gtktiledviewer.mk
@@ -0,0 +1,44 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_Executable_Executable,gtktiledviewer))
+
+$(eval $(call gb_Executable_set_include,gtktiledviewer,\
+ $$(INCLUDE) \
+ -I$(SRCDIR)/desktop/inc \
+))
+
+$(eval $(call gb_Executable_use_externals,gtktiledviewer,\
+ gtk \
+))
+
+$(eval $(call gb_Executable_use_static_libraries,gtktiledviewer,\
+ libreofficekit \
+))
+
+$(eval $(call gb_Executable_add_libs,gtktiledviewer,\
+ -lX11 \
+ -lXext \
+ -lSM \
+ -lICE \
+))
+
+ifeq ($(OS),LINUX)
+$(eval $(call gb_Executable_add_libs,gtktiledviewer,\
+ -lm \
+ -ldl \
+ -lpthread \
+))
+endif
+
+$(eval $(call gb_Executable_add_exception_objects,gtktiledviewer,\
+ desktop/qa/gtktiledviewer/gtktiledviewer \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/desktop/Module_desktop.mk b/desktop/Module_desktop.mk
index cfaf0d93ecd9..04b71f7578c6 100644
--- a/desktop/Module_desktop.mk
+++ b/desktop/Module_desktop.mk
@@ -29,6 +29,14 @@ $(eval $(call gb_Module_add_l10n_targets,desktop,\
UIConfig_deployment \
))
+ifeq ($(OS),LINUX)
+ifneq ($(ENABLE_GTK),)
+$(eval $(call gb_Module_add_targets,desktop,\
+ Executable_gtktiledviewer \
+))
+endif
+endif
+
ifneq (,$(filter DESKTOP,$(BUILD_TYPE)))
$(eval $(call gb_Module_add_targets,desktop,\
Executable_soffice_bin \
diff --git a/desktop/qa/gtktiledviewer/gtktiledviewer.cxx b/desktop/qa/gtktiledviewer/gtktiledviewer.cxx
new file mode 100644
index 000000000000..fe63d7d4710e
--- /dev/null
+++ b/desktop/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <stdio.h>
+#include <string.h>
+
+#include <gtk/gtk.h>
+
+#include <LibreOfficeKit/LibreOfficeKit.hxx>
+
+static int help()
+{
+ fprintf( stderr, "Usage: gtktiledviewer <absolute-path-to-libreoffice-install> [path to document]\n" );
+ return 1;
+}
+
+int main( int argc, char* argv[] )
+{
+ if( argc < 2 ||
+ ( argc > 1 && ( !strcmp( argv[1], "--help" ) || !strcmp( argv[1], "-h" ) ) ) )
+ return help();
+
+ if ( argv[1][0] != '/' )
+ {
+ fprintf(stderr, "Absolute path required to libreoffice install\n");
+ return 1;
+ }
+
+ ::lok::Office *pOffice = ::lok::lok_cpp_init( argv[1] );
+ if( !pOffice )
+ {
+ fprintf( stderr, "Failed to initialize\n" );
+ return -1;
+ }
+
+ ::lok::Document* pDocument = pOffice->documentLoad( argv[2] );
+ (void) pDocument;
+
+ GtkWidget *pWindow;
+ GtkWidget *pScroller;
+
+ gtk_init( &argc, &argv );
+
+ pWindow = gtk_window_new( GTK_WINDOW_TOPLEVEL );
+ gtk_window_set_title( GTK_WINDOW(pWindow), "LibreOffice GTK Tiled Viewer" );
+ gtk_window_set_default_size(GTK_WINDOW(pWindow), 800, 600);
+ g_signal_connect( pWindow, "destroy", G_CALLBACK(gtk_main_quit), NULL );
+
+
+ pScroller = gtk_scrolled_window_new( 0, 0 );
+ gtk_container_add( GTK_CONTAINER(pWindow), pScroller );
+
+ gtk_widget_show( pScroller );
+ gtk_widget_show( pWindow );
+
+ //GDK_WINDOW_XWINDOW
+
+ gtk_main();
+
+ return 0;
+} \ No newline at end of file