diff options
-rw-r--r-- | Repository.mk | 1 | ||||
-rw-r--r-- | desktop/Executable_gtktiledviewer.mk | 44 | ||||
-rw-r--r-- | desktop/Module_desktop.mk | 8 | ||||
-rw-r--r-- | desktop/qa/gtktiledviewer/gtktiledviewer.cxx | 67 |
4 files changed, 120 insertions, 0 deletions
diff --git a/Repository.mk b/Repository.mk index dcd9f545f788..8210aba9ca7b 100644 --- a/Repository.mk +++ b/Repository.mk @@ -101,6 +101,7 @@ $(eval $(call gb_Helper_register_executables,OOO, \ uri-encode \ ui-previewer \ tiledrendering \ + $(if $(and $(ENABLE_GTK), $(filter LINUX,$(OS))), gtktiledviewer) \ $(if $(filter DESKTOP,$(BUILD_TYPE)),unopkg_bin) \ xpdfimport \ $(if $(filter WNT,$(OS)), \ 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 |