[Libreoffice-commits] core.git: Branch 'feature/calctiledrendering4' - 8 commits - desktop/Library_sofficeapp.mk desktop/source libreofficekit/qa libreofficekit/source sd/source

Andrzej Hunt andrzej.hunt at collabora.com
Thu Jul 17 11:39:38 PDT 2014


 desktop/Library_sofficeapp.mk                       |    8 ++++
 desktop/source/app/app.cxx                          |   12 +++---
 desktop/source/app/sofficemain.cxx                  |   14 +++----
 desktop/source/lib/init.cxx                         |   30 ++++++++++++++-
 libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx |    9 ++++
 libreofficekit/qa/unit/tiledrendering.cxx           |   19 +++++++++
 libreofficekit/source/shim.c                        |   39 +++++++++++++-------
 sd/source/ui/inc/DrawViewShell.hxx                  |    2 -
 sd/source/ui/unoidl/unomodel.cxx                    |    9 +++-
 9 files changed, 112 insertions(+), 30 deletions(-)

New commits:
commit 4118724dd506269b836d08fbe42207b76632eac8
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date:   Thu Jul 17 20:20:24 2014 +0200

    libreofficekit_tiledrendering test: force lock file removal
    
    If the lock file still exists when running this test, LOK will fail
    resulting in "documentLoad failed: unknown load failure"
    (the actual error is that the lock file dialog cannot be confirmed
     by the user in headless mode, resulting in loading failure, however
     this is then hidden by multiple layers of exception redirection
     in sfx2).
    
    Change-Id: I025ea6187c3d17805f25ab6f756eae9646f2c7c8

diff --git a/libreofficekit/qa/unit/tiledrendering.cxx b/libreofficekit/qa/unit/tiledrendering.cxx
index dbe5b52..cec35ed 100644
--- a/libreofficekit/qa/unit/tiledrendering.cxx
+++ b/libreofficekit/qa/unit/tiledrendering.cxx
@@ -14,6 +14,7 @@
 #include <cppunit/extensions/HelperMacros.h>
 #include <cstdlib>
 #include <string>
+#include <stdio.h>
 
 #include <sal/types.h>
 #include <tools/stream.hxx>
@@ -66,6 +67,13 @@ void TiledRenderingTest::testOverlay()
     const string sInstDir = getenv( "INSTDIR" );
     const string sLOPath = sInstDir + "/program";
     const string sDocPath = sSrcRoot + "/odk/examples/java/DocumentHandling/test/test1.odt";
+    const string sLockFile = sSrcRoot + "/odk/examples/java/DocumentHandling/test/.~lock.test1.odt#";
+
+    // 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() );
 
     scoped_ptr< Office > pOffice( lok_cpp_init(
                                       sLOPath.c_str() ) );
commit f2720469cc16727ccc616d56466d79af21690b7b
Author: Matúš Kukan <matus.kukan at collabora.com>
Date:   Thu Jul 17 10:35:49 2014 +0200

    Fix some CppunitTest_libreofficekit_tiledrendering related problems
    
    Change-Id: Icdcde0af1b3d5744ef2842e4b4d2b85a094ac686

diff --git a/libreofficekit/qa/unit/tiledrendering.cxx b/libreofficekit/qa/unit/tiledrendering.cxx
index d0e9f34..dbe5b52 100644
--- a/libreofficekit/qa/unit/tiledrendering.cxx
+++ b/libreofficekit/qa/unit/tiledrendering.cxx
@@ -63,7 +63,8 @@ static void dumpRGBABitmap( const OUString& rPath, const unsigned char* pBuffer,
 void TiledRenderingTest::testOverlay()
 {
     const string sSrcRoot = getenv( "SRC_ROOT" );
-    const string sLOPath = sSrcRoot + "/instdir/program";
+    const string sInstDir = getenv( "INSTDIR" );
+    const string sLOPath = sInstDir + "/program";
     const string sDocPath = sSrcRoot + "/odk/examples/java/DocumentHandling/test/test1.odt";
 
     scoped_ptr< Office > pOffice( lok_cpp_init(
diff --git a/libreofficekit/source/shim.c b/libreofficekit/source/shim.c
index ac272e8..b533a61 100644
--- a/libreofficekit/source/shim.c
+++ b/libreofficekit/source/shim.c
@@ -22,7 +22,7 @@
 #endif
 
 #define TARGET_LIB        "lib" "sofficeapp" ".so"
-#define TARGET_MERGED_LIB "lib" "libmergedlo" ".so"
+#define TARGET_MERGED_LIB "lib" "mergedlo" ".so"
 
 typedef LibreOfficeKit *(HookFunction)( const char *install_path);
 
commit ea7dc5f61722cd9459127762daa473c6659d5e35
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Wed Jul 16 19:36:53 2014 +0200

    LibreOfficeKit: Check for libmerged too.
    
    And avoid some strcat's when at it.
    
    Change-Id: I0c70ee2a1abf0c9e2914f756b06bedc3a16df19b

diff --git a/libreofficekit/source/shim.c b/libreofficekit/source/shim.c
index 6a3f9a7..ac272e8 100644
--- a/libreofficekit/source/shim.c
+++ b/libreofficekit/source/shim.c
@@ -10,9 +10,9 @@
 #ifdef LINUX
 
 #include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
 
-#include <osl/module.h>
 #include <sal/types.h>
 #include <LibreOfficeKit/LibreOfficeKit.h>
 
@@ -21,37 +21,52 @@
 #  include <sys/ldr.h>
 #endif
 
-#define TARGET_LIB SAL_MODULENAME( "sofficeapp" )
+#define TARGET_LIB        "lib" "sofficeapp" ".so"
+#define TARGET_MERGED_LIB "lib" "libmergedlo" ".so"
 
 typedef LibreOfficeKit *(HookFunction)( const char *install_path);
 
 SAL_DLLPUBLIC_EXPORT LibreOfficeKit *lok_init( const char *install_path )
 {
     char *imp_lib;
+    size_t partial_length;
     void *dlhandle;
     HookFunction *pSym;
 
-    if( !install_path )
+    if (!install_path)
         return NULL;
-    if( !( imp_lib = (char *) malloc( strlen (install_path) + sizeof( TARGET_LIB ) + 2 ) ) )
+
+    // allocate large enough buffer
+    partial_length = strlen(install_path);
+    imp_lib = (char *) malloc(partial_length + sizeof(TARGET_LIB) + sizeof(TARGET_MERGED_LIB) + 2);
+    if (!imp_lib)
     {
         fprintf( stderr, "failed to open library : not enough memory\n");
         return NULL;
     }
 
-    strcpy( imp_lib, install_path );
-    strcat( imp_lib, "/" );
-    strcat( imp_lib, TARGET_LIB );
+    strcpy(imp_lib, install_path);
+
+    imp_lib[partial_length++] = '/';
+    strcpy(imp_lib + partial_length, TARGET_LIB);
 
-    if( !( dlhandle = dlopen( imp_lib, RTLD_LAZY ) ) )
+    dlhandle = dlopen(imp_lib, RTLD_LAZY);
+    if (!dlhandle)
     {
-        fprintf( stderr, "failed to open library '%s'\n", imp_lib );
-        free( imp_lib );
-        return NULL;
+        strcpy(imp_lib + partial_length, TARGET_MERGED_LIB);
+
+        dlhandle = dlopen(imp_lib, RTLD_LAZY);
+        if (!dlhandle)
+        {
+            fprintf(stderr, "failed to open library '%s' or '%s' in '%s/'\n", TARGET_LIB, TARGET_MERGED_LIB, install_path);
+            free(imp_lib);
+            return NULL;
+        }
     }
 
     pSym = (HookFunction *) dlsym( dlhandle, "libreofficekit_hook" );
-    if( !pSym ) {
+    if (!pSym)
+    {
         fprintf( stderr, "failed to find hook in library '%s'\n", imp_lib );
         dlclose( dlhandle );
         free( imp_lib );
commit 552052f15b0f94da99fe8db8eaf5e701388c0b66
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date:   Thu Jul 17 16:13:49 2014 +0200

    DO NOT MERGE YET: hack soffice_main into LOK.
    
    Change-Id: I86e13192ddb5904afabca38d3a201f17f145de09

diff --git a/desktop/Library_sofficeapp.mk b/desktop/Library_sofficeapp.mk
index be86dd1..a90bcd1 100644
--- a/desktop/Library_sofficeapp.mk
+++ b/desktop/Library_sofficeapp.mk
@@ -17,6 +17,13 @@ $(eval $(call gb_Library_set_include,sofficeapp,\
     -I$(SRCDIR)/vcl/inc \
 ))
 
+$(eval $(call gb_Library_add_libs,sofficeapp,\
+    $(if $(filter $(OS),LINUX), \
+        -ldl \
+        -lpthread \
+    ) \
+))
+
 $(eval $(call gb_Library_use_external,sofficeapp,boost_headers))
 
 $(eval $(call gb_Library_use_custom_headers,sofficeapp,\
@@ -47,6 +54,7 @@ $(eval $(call gb_Library_use_libraries,sofficeapp,\
     sfx \
     svl \
     svt \
+    sw \
     tk \
     tl \
     ucbhelper \
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index 3704bbd..a2df758 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -1365,12 +1365,12 @@ int Desktop::Main()
     CommandLineArgs& rCmdLineArgs = GetCommandLineArgs();
 
 #if HAVE_FEATURE_DESKTOP
-    OUString aUnknown( rCmdLineArgs.GetUnknown() );
-    if ( !aUnknown.isEmpty() )
-    {
-        displayCmdlineHelp( aUnknown );
-        return EXIT_FAILURE;
-    }
+    // OUString aUnknown( rCmdLineArgs.GetUnknown() );
+    // if ( !aUnknown.isEmpty() )
+    // {
+    //     displayCmdlineHelp( aUnknown );
+    //     return EXIT_FAILURE;
+    // }
     if ( rCmdLineArgs.IsHelp() )
     {
         displayCmdlineHelp( OUString() );
diff --git a/desktop/source/app/sofficemain.cxx b/desktop/source/app/sofficemain.cxx
index baf6a1b..8671a9d 100644
--- a/desktop/source/app/sofficemain.cxx
+++ b/desktop/source/app/sofficemain.cxx
@@ -61,13 +61,13 @@ extern "C" int DESKTOP_DLLPUBLIC soffice_main()
     // handle --version and --help already here, otherwise they would be handled
     // after VCL initialization that might fail if $DISPLAY is not set
     const desktop::CommandLineArgs& rCmdLineArgs = desktop::Desktop::GetCommandLineArgs();
-    OUString aUnknown( rCmdLineArgs.GetUnknown() );
-    if ( !aUnknown.isEmpty() )
-    {
-        desktop::Desktop::InitApplicationServiceManager();
-        desktop::displayCmdlineHelp( aUnknown );
-        return EXIT_FAILURE;
-    }
+    // OUString aUnknown( rCmdLineArgs.GetUnknown() );
+    // if ( !aUnknown.isEmpty() )
+    // {
+    //     desktop::Desktop::InitApplicationServiceManager();
+    //     desktop::displayCmdlineHelp( aUnknown );
+    //     return EXIT_FAILURE;
+    // }
     if ( rCmdLineArgs.IsHelp() )
     {
         desktop::Desktop::InitApplicationServiceManager();
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 6c4d5cc..e9a1eed 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -58,6 +58,9 @@
 #include <basebmp/bitmapdevice.hxx>
 #endif
 
+// We also need to hackily be able to start the main libreoffice thread
+#include "../app/sofficemain.h"
+
 using namespace css;
 using namespace utl;
 
@@ -587,6 +590,12 @@ static void initialize_uno(const OUString &aAppProgramURL)
     // configmgr setup ?
 }
 
+static void* lo_startmain(void*)
+{
+    soffice_main();
+    return 0;
+}
+
 static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath)
 {
     (void) pThis;
@@ -627,8 +636,27 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath)
         force_c_locale();
 
         // Force headless
+        // the "svp" headless vcl backend isn't able to do tiled rendering for
+        // us -- we need to use a full featured backend, i.e. "gen" or "gtk",
+        // gtk seems to be somewhat better.
         rtl::Bootstrap::set("SAL_USE_VCLPLUGIN", "svp");
-        InitVCL();
+//         InitVCL();
+        // InitVCL() happens in soffice_main for us -- and we can't call InitVCL twice
+        // unfortunately -- which is annoying since (see below)
+
+        pthread_t thread;
+        pthread_create(&thread, 0, lo_startmain, NULL);
+        sleep(10);
+        // We'll segfault trying to access Application if we're too fast...
+        // Specifically pImplSVData doesn't exist until InitVCL has been called,
+        // and that won't be immediate, but we can't call InitVCL ourselves
+        // as soffice_main already does so, but InitVCL would then fail
+        // within soffice_main if we have already called it earlier.
+        //
+        // And there's also a chance of deadlock if we try to open documents
+        // too early -- when running in a debugger we therefore need quite
+        // a large delay here (for now).
+
         Application::EnableHeadlessMode(true);
 
         ErrorHandler::RegisterDisplay(aBasicErrorFunc);
commit c1387da26dcc4f88af0e1e6d3393542bb2b758f8
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date:   Tue Jul 15 09:50:47 2014 +0200

    Render slides by default.
    
    We should probably introduce an API to allow selecting notes instead, however
    the default mode is to open whichever view we had open last for a given
    document -- whereas for nowwe probably always want to render the slides.
    
    Change-Id: I26540613d1a510f23e5abfc8fee2ad743c180f34

diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index f86e9cb..498c0c1 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -2225,8 +2225,6 @@ void SdXImpressDocument::paintTile( VirtualDevice& rDevice,
         Region(
             Rectangle( Point( nTilePosX, nTilePosY ),
                        Size( nTileWidth, nTileHeight ) ) ) );
-
-    // TODO: Set page kind in frameview?
 }
 
 void SdXImpressDocument::setPart( int nPart )
@@ -2234,6 +2232,13 @@ void SdXImpressDocument::setPart( int nPart )
     DrawViewShell* pViewSh = dynamic_cast< DrawViewShell* >( mpDoc->GetDocSh()->GetViewShell() );
     if (pViewSh)
     {
+        // TODO: have an API to allow selecting between PK_STANDARD (just slide)
+        // and PK_NOTES (which shows the combined slide above notes). There is alo
+        // a PK_HANDOUT -- that however just shows multiple empty pages (it's also
+        // only possible to select page 0 in this mode, I have no idea how you
+        // then actually select what is on the handout page, which defaults to
+        // a 4x4 grid of empty pages).
+        pViewSh->SetPageKind( PK_STANDARD );
         pViewSh->SwitchPage( nPart );
     }
 }
commit 0eda1db5b5b2e64614b687e46f9d2bf96e19f348
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date:   Tue Jul 15 09:49:24 2014 +0200

    Allow setting DrawViewShell PageKind directly.
    
    Currently the only way to change the PageKind is via the UI controls
    (i.e. via ExecCtrl) -- however for tiled rendering we want to select
    the PageKind directly.
    
    Change-Id: I3a3fa8f8cefaa0e0212832aef4026433fc596263

diff --git a/sd/source/ui/inc/DrawViewShell.hxx b/sd/source/ui/inc/DrawViewShell.hxx
index 125d007..37c2ec3 100644
--- a/sd/source/ui/inc/DrawViewShell.hxx
+++ b/sd/source/ui/inc/DrawViewShell.hxx
@@ -240,7 +240,7 @@ public:
     virtual bool    PrepareClose( bool bUI = true ) SAL_OVERRIDE;
 
     PageKind        GetPageKind() { return mePageKind; }
-
+    void            SetPageKind( PageKind ePageKind ) { mePageKind = ePageKind; }
     Point           GetMousePos() { return maMousePos; }
     bool            IsMousePosFreezed() { return mbMousePosFreezed; }
     void            SetMousePosFreezed( bool bIn ) { mbMousePosFreezed = bIn; }
commit 7f90415c4ad2fe099b71ebeb3ddd9f712434c49a
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date:   Mon Jul 14 13:12:56 2014 +0200

    LOK tiled rendering test: add some debug output.
    
    Change-Id: I0da29204809b6a1de42d5f0fc37705497a060493

diff --git a/libreofficekit/qa/unit/tiledrendering.cxx b/libreofficekit/qa/unit/tiledrendering.cxx
index 3fda443..d0e9f34 100644
--- a/libreofficekit/qa/unit/tiledrendering.cxx
+++ b/libreofficekit/qa/unit/tiledrendering.cxx
@@ -68,9 +68,17 @@ void TiledRenderingTest::testOverlay()
 
     scoped_ptr< Office > pOffice( lok_cpp_init(
                                       sLOPath.c_str() ) );
+    assert( pOffice.get() );
+
     scoped_ptr< Document> pDocument( pOffice->documentLoad(
                                          sDocPath.c_str() ) );
 
+    if ( !pDocument.get() )
+    {
+        fprintf( stderr, "documentLoad failed: %s\n", pOffice->getError() );
+        CPPUNIT_FAIL( "Document could not be loaded -- tiled rendering not possible." );
+    }
+
     // We render one large tile, then subdivide it into 4 and render those parts, and finally
     // iterate over each smaller tile and check whether their contents match the large
     // tile.
commit d8b6cdd6c3c759c89d5549c66c00c6783ccc0039
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date:   Sat Jul 12 05:45:28 2014 +0200

    GtkComboBoxText requires gtk >= 2.24.
    
    Seeing as this is only a test program, probably easiest just to disable
    this for gtk < 2.24, and rely on devs wanting to use it isntalling a new
    enough gtk version.

diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index b4ed50e..74661f1 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -117,6 +117,8 @@ void changeQuadView( GtkWidget* /*pButton*/, gpointer /* pItem */ )
     }
 }
 
+// GtkComboBox requires gtk 2.24 or later
+#if ( GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 24 ) || GTK_MAJOR_VERSION > 2
 void populatePartSelector( GtkComboBoxText* pSelector, LOKDocView* pView )
 {
     char sText[10];
@@ -140,6 +142,7 @@ void changePart( GtkWidget* pSelector, gpointer /* pItem */ )
         lok_docview_set_part( LOK_DOCVIEW(pDocView), nPart );
     }
 }
+#endif
 
 int main( int argc, char* argv[] )
 {
@@ -188,11 +191,14 @@ int main( int argc, char* argv[] )
     GtkToolItem* pSeparator1 = gtk_separator_tool_item_new();
     gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), pSeparator1, -1);
 
+// GtkComboBox requires gtk 2.24 or later
+#if ( GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 24 ) || GTK_MAJOR_VERSION > 2
     GtkToolItem* pPartSelectorToolItem = gtk_tool_item_new();
     GtkWidget* pComboBox = gtk_combo_box_text_new();
     gtk_container_add( GTK_CONTAINER(pPartSelectorToolItem), pComboBox );
     gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), pPartSelectorToolItem, -1 );
     g_signal_connect( G_OBJECT(pComboBox), "changed", G_CALLBACK(changePart), NULL );
+#endif
 
     GtkToolItem* pSeparator2 = gtk_separator_tool_item_new();
     gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), pSeparator2, -1);
@@ -213,7 +219,10 @@ int main( int argc, char* argv[] )
 
     pFileName = argv[2];
     lok_docview_open_document( LOK_DOCVIEW(pDocView), argv[2] );
+// GtkComboBox requires gtk 2.24 or later
+#if ( GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 24 ) || GTK_MAJOR_VERSION > 2
     populatePartSelector( GTK_COMBO_BOX_TEXT(pComboBox), LOK_DOCVIEW(pDocView) );
+#endif
 
     gtk_main();
 


More information about the Libreoffice-commits mailing list