[Libreoffice-commits] core.git: Branch 'feature/calctiledrendering3' - 7 commits - desktop/source include/LibreOfficeKit include/osl include/vcl libreofficekit/qa libreofficekit/source sal/osl sal/util sc/inc sc/source sd/source sw/inc sw/source vcl/headless

Andrzej Hunt andrzej.hunt at collabora.com
Thu Jul 10 11:17:12 PDT 2014


Rebased ref, commits from common ancestor:
commit aef3fcd39558e424b816e5eb07a9421ab046ff0f
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date:   Thu Jul 10 12:19:36 2014 +0200

    Check whether Command Args are already set up before doing so.
    
    Could already be set up e.g. if a client application is using UNO
    separately, in addition to LOK.
    
    Change-Id: I50c3230b6f2456360273902a308c303576baac10

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index e1931b5..520d7ca 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -607,7 +607,14 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath)
 
     try
     {
-        osl_setCommandArgs(0, NULL);
+        // If we've set up the command args elsewhere then we cannot do it
+        // again (as an assert will fire), this will be the case e.g.
+        // for unit tests (and possibly if UNO is being used in addition
+        // to LOK in an external program).
+        if (!osl_areCommandArgsSet())
+        {
+            osl_setCommandArgs(0, NULL);
+        }
         initialize_uno(aAppURL);
         force_c_locale();
 
commit 91e852a36d57e514dd4b1fb5421e9e5e19172ea4
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date:   Thu Jul 10 12:17:05 2014 +0200

    Introduce osl_areCommandArgsSet.
    
    We cannot call osl_setCommandArgs twice, however there is currently
    no way to determine whether or not this has already been done. This is
    necessary e.g. for LibreOfficeKit where we may also be using UNO
    separately (and also for unit tests where LO is already set-up prior
    to the unit test running, and therefore we can't set up osl again
    from within LOK).
    
    Change-Id: Id1f357ef604eb2b6b7814c9a04ac6933a39fd3eb

diff --git a/include/osl/process.h b/include/osl/process.h
index 7d0960e..1a9a416 100644
--- a/include/osl/process.h
+++ b/include/osl/process.h
@@ -366,6 +366,11 @@ SAL_DLLPUBLIC sal_uInt32 SAL_CALL osl_getCommandArgCount(void);
 SAL_DLLPUBLIC oslProcessError SAL_CALL osl_getCommandArg(
         sal_uInt32 nArg, rtl_uString **strCommandArg);
 
+/** Determine whether or not the command args have already been set.
+    @return The command args are already set, and may not be set again.
+*/
+SAL_DLLPUBLIC int SAL_CALL osl_areCommandArgsSet ();
+
 /** Set the command-line arguments as passed to the main-function of this process.
 
     Deprecated: This function is only for internal use. Passing the args from main will
diff --git a/sal/osl/unx/process_impl.cxx b/sal/osl/unx/process_impl.cxx
index d28f46d..b63f222 100644
--- a/sal/osl/unx/process_impl.cxx
+++ b/sal/osl/unx/process_impl.cxx
@@ -191,6 +191,11 @@ oslProcessError SAL_CALL osl_getCommandArg (sal_uInt32 nArg, rtl_uString ** strC
     return (result);
 }
 
+int SAL_CALL osl_areCommandArgsSet (void)
+{
+    return (g_command_args.m_nCount > 0);
+}
+
 /***************************************
  osl_setCommandArgs().
  **************************************/
diff --git a/sal/osl/w32/process.cxx b/sal/osl/w32/process.cxx
index 3dd0e77..25f4e58 100644
--- a/sal/osl/w32/process.cxx
+++ b/sal/osl/w32/process.cxx
@@ -374,6 +374,12 @@ oslProcessError SAL_CALL osl_getCommandArg( sal_uInt32 nArg, rtl_uString **strCo
 
 /***************************************************************************/
 
+int SAL_CALL osl_areCommandArgsSet(void)
+{
+    return (g_command_args.m_nCount > 0);
+}
+
+
 void SAL_CALL osl_setCommandArgs (int argc, char ** argv)
 {
     osl_acquireMutex (*osl_getGlobalMutex());
diff --git a/sal/util/sal.map b/sal/util/sal.map
index 1d7d491..6e95369 100644
--- a/sal/util/sal.map
+++ b/sal/util/sal.map
@@ -677,6 +677,12 @@ LIBO_UDK_4.3 { # symbols available in >= LibO 4.3
         rtl_freeAlignedMemory;
 } LIBO_UDK_4.2;
 
+LIBO_UDK_4.4 { # symbols available in >= LibO 4.4
+    global:
+        osl_areCommandArgsSet;
+} LIBO_UDK_4.3;
+
+
 PRIVATE_1.0 {
     global:
         osl_detail_ObjectRegistry_storeAddresses;
commit 857191867751824db6fcc057f4ebaa04d374cf4d
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date:   Thu Jul 10 11:37:36 2014 +0200

    svp clipping again: Rectangle dimensions don't map directly to B2IBox.
    
    This is the same as in 80f3211a7aeff221718703c445be4c753e0a1067.
    
    Change-Id: Ibb981da064b4fc97fd865be2decabd8798de7380

diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx
index 35c582d..9c1d4e5 100644
--- a/vcl/headless/svpgdi.cxx
+++ b/vcl/headless/svpgdi.cxx
@@ -259,8 +259,8 @@ bool SvpSalGraphics::isClippedSetup( const basegfx::B2IBox &aRange, SvpSalGraphi
         m_aDevice = basebmp::subsetBitmapDevice( m_aOrigDevice,
                                                  basegfx::B2IBox (aHitRect.Left(),
                                                                   aHitRect.Top(),
-                                                                  aHitRect.Right(),
-                                                                  aHitRect.Bottom()) );
+                                                                  aHitRect.Right() + 1,
+                                                                  aHitRect.Bottom() + 1) );
         return false;
     }
 //    fprintf (stderr, "URK: complex & slow clipping case\n" );
commit c718b635c6ac4adafb3e2bcc9e7a2c3c7a8132a3
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date:   Tue Jul 8 16:41:56 2014 +0200

    Add Tiled Rendering outline to sd.
    
    Change-Id: I810d827f330690f8071b662b9ddd05cc41655a71

diff --git a/sd/source/ui/inc/unomodel.hxx b/sd/source/ui/inc/unomodel.hxx
index f9fafdd..6887663 100644
--- a/sd/source/ui/inc/unomodel.hxx
+++ b/sd/source/ui/inc/unomodel.hxx
@@ -45,6 +45,8 @@
 #include <sfx2/sfxbasemodel.hxx>
 #include <svx/fmdmod.hxx>
 
+#include <vcl/ITiledRenderable.hxx>
+
 #include <editeng/unoipset.hxx>
 
 #include <comphelper/servicehelper.hxx>
@@ -76,7 +78,8 @@ class SdXImpressDocument : public SfxBaseModel, // implements SfxListener, OWEAK
                            public ::com::sun::star::lang::XServiceInfo,
                            public ::com::sun::star::ucb::XAnyCompareFactory,
                            public ::com::sun::star::presentation::XHandoutMasterSupplier,
-                           public ::com::sun::star::view::XRenderable
+                           public ::com::sun::star::view::XRenderable,
+                           public ::vcl::ITiledRenderable
 {
     friend class SdDrawPagesAccess;
     friend class SdMasterPagesAccess;
@@ -218,6 +221,19 @@ public:
     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getRenderer( sal_Int32 nRenderer, const ::com::sun::star::uno::Any& aSelection, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& xOptions ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     virtual void SAL_CALL render( sal_Int32 nRenderer, const ::com::sun::star::uno::Any& aSelection, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& xOptions ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
 
+    // ITiledRenderable
+    virtual void paintTile( VirtualDevice& rDevice,
+                            int nOutputWidth,
+                            int nOutputHeight,
+                            int nTilePosX,
+                            int nTilePosY,
+                            long nTileWidth,
+                            long nTileHeight ) SAL_OVERRIDE;
+    virtual Size getDocumentSize() SAL_OVERRIDE;
+    virtual void setPart(   int nPart ) SAL_OVERRIDE;
+    virtual int  getPart() SAL_OVERRIDE;
+    virtual int  getParts() SAL_OVERRIDE;
+
     // XComponent
 
     /** This dispose implementation releases the resources held by the
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index bc970e9..74133b8 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -2185,6 +2185,41 @@ void SAL_CALL SdXImpressDocument::render( sal_Int32 nRenderer, const uno::Any& r
     }
 }
 
+void SdXImpressDocument::paintTile( VirtualDevice& rDevice,
+                            int nOutputWidth, int nOutputHeight,
+                            int nTilePosX, int nTilePosY,
+                            long nTileWidth, long nTileHeight )
+{
+    (void) rDevice;
+    (void) nOutputWidth;
+    (void) nOutputHeight;
+    (void) nTilePosX;
+    (void) nTilePosY;
+    (void) nTileWidth;
+    (void) nTileHeight;
+}
+
+void SdXImpressDocument::setPart( int nPart )
+{
+    (void) nPart;
+}
+
+int SdXImpressDocument::getParts()
+{
+    return mpDoc->GetPageCount();
+}
+
+int SdXImpressDocument::getPart()
+{
+    return 0;
+}
+
+Size SdXImpressDocument::getDocumentSize()
+{
+    return Size( 100, 100 );
+}
+
+
 uno::Reference< i18n::XForbiddenCharacters > SdXImpressDocument::getForbiddenCharsTable()
 {
     uno::Reference< i18n::XForbiddenCharacters > xForb(mxForbidenCharacters);
commit bcf6a3d73c66ea4b8a524e3e0a95bf67754fe551
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date:   Tue Jul 8 15:32:46 2014 +0200

    Add part selector to gtktiledviewer.
    
    Change-Id: I569c8f0ebf4476c0a247cde15a263d1db956a14b

diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index 3a232e8..b4ed50e 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -117,6 +117,29 @@ void changeQuadView( GtkWidget* /*pButton*/, gpointer /* pItem */ )
     }
 }
 
+void populatePartSelector( GtkComboBoxText* pSelector, LOKDocView* pView )
+{
+    char sText[10];
+    for ( int i = 0; i < lok_docview_get_parts(pView); i++ )
+    {
+        sprintf( sText, "%i", i+1 );
+        gtk_combo_box_text_append_text( pSelector, sText );
+    }
+    gtk_combo_box_set_active( GTK_COMBO_BOX(pSelector), 0 );
+}
+
+void changePart( GtkWidget* pSelector, gpointer /* pItem */ )
+{
+    int nPart = gtk_combo_box_get_active( GTK_COMBO_BOX(pSelector) );
+
+    // We don't really care about the quad view for now -- it's only purpose
+    // is to check that the edges of tiles aren't messed up, and no real
+    // reason to maintain it to be able to show other document parts etc.
+    if ( pDocView )
+    {
+        lok_docview_set_part( LOK_DOCVIEW(pDocView), nPart );
+    }
+}
 
 int main( int argc, char* argv[] )
 {
@@ -165,6 +188,15 @@ int main( int argc, char* argv[] )
     GtkToolItem* pSeparator1 = gtk_separator_tool_item_new();
     gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), pSeparator1, -1);
 
+    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 );
+
+    GtkToolItem* pSeparator2 = gtk_separator_tool_item_new();
+    gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), pSeparator2, -1);
+
     GtkToolItem* pEnableQuadView = gtk_toggle_tool_button_new();
     gtk_tool_button_set_label( GTK_TOOL_BUTTON(pEnableQuadView), "Use Quad View" );
     gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), pEnableQuadView, -1 );
@@ -181,6 +213,7 @@ int main( int argc, char* argv[] )
 
     pFileName = argv[2];
     lok_docview_open_document( LOK_DOCVIEW(pDocView), argv[2] );
+    populatePartSelector( GTK_COMBO_BOX_TEXT(pComboBox), LOK_DOCVIEW(pDocView) );
 
     gtk_main();
 
commit 45aff273c251ebd35aa6fa7f28eb9305415a893e
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date:   Tue Jul 8 15:32:20 2014 +0200

    LOK DocView: implement part selection.
    
    Change-Id: I2e16ca9d2d5fcd25b0435f1b9b0fbcb52b92e012

diff --git a/include/LibreOfficeKit/LibreOfficeKitGtk.h b/include/LibreOfficeKit/LibreOfficeKitGtk.h
index f160925..37d21f0 100644
--- a/include/LibreOfficeKit/LibreOfficeKitGtk.h
+++ b/include/LibreOfficeKit/LibreOfficeKitGtk.h
@@ -58,8 +58,13 @@ void            lok_docview_set_zoom        (LOKDocView* pDocView,
                                              float fZoom);
 float           lok_docview_get_zoom        (LOKDocView* pDocView);
 
+int             lok_docview_get_parts       (LOKDocView* pDocView);
+int             lok_docview_get_part        (LOKDocView* pDocView);
+void            lok_docview_set_part        (LOKDocView* pDocView,
+                                             int nPart);
+
 #ifdef __cplusplus
 }
 #endif
 
-#endif
\ No newline at end of file
+#endif
diff --git a/libreofficekit/source/gtk/lokdocview.c b/libreofficekit/source/gtk/lokdocview.c
index 12b004e08..cdc2339 100644
--- a/libreofficekit/source/gtk/lokdocview.c
+++ b/libreofficekit/source/gtk/lokdocview.c
@@ -174,4 +174,21 @@ SAL_DLLPUBLIC_EXPORT float lok_docview_get_zoom ( LOKDocView* pDocView )
     return pDocView->fZoom;
 }
 
+SAL_DLLPUBLIC_EXPORT int lok_docview_get_parts( LOKDocView* pDocView )
+{
+    return pDocView->pDocument->pClass->getParts( pDocView->pDocument );
+}
+
+SAL_DLLPUBLIC_EXPORT int lok_docview_get_part( LOKDocView* pDocView )
+{
+    return pDocView->pDocument->pClass->getPart( pDocView->pDocument );
+}
+
+SAL_DLLPUBLIC_EXPORT void lok_docview_set_part( LOKDocView* pDocView, int nPart)
+{
+    pDocView->pDocument->pClass->setPart( pDocView->pDocument, nPart );
+    renderDocument( pDocView );
+}
+
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit e5c6b77dea3c21c6a944282ff6d6ea309fbec4a2
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date:   Tue Jul 8 15:23:06 2014 +0200

    Add get/setPart to ITiledRenderable, and implement for sw/sc.
    
    Change-Id: Iec3d6374f029149cadf8fb9c9b16fec90146c31e

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 0f72bd6..e1931b5 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -181,7 +181,8 @@ extern "C"
 static void doc_destroy(LibreOfficeKitDocument* pThis);
 static int  doc_saveAs(LibreOfficeKitDocument* pThis, const char* pUrl, const char* pFormat, const char* pFilterOptions);
 static LibreOfficeKitDocumentType doc_getDocumentType(LibreOfficeKitDocument* pThis);
-static int doc_getNumberOfParts(LibreOfficeKitDocument* pThis);
+static int doc_getParts(LibreOfficeKitDocument* pThis);
+static int doc_getPart(LibreOfficeKitDocument* pThis);
 static void doc_setPart(LibreOfficeKitDocument* pThis, int nPart);
 void        doc_paintTile(LibreOfficeKitDocument* pThis,
                           unsigned char* pBuffer,
@@ -210,7 +211,8 @@ struct LibLODocument_Impl : public _LibreOfficeKitDocument
             m_pDocumentClass->destroy = doc_destroy;
             m_pDocumentClass->saveAs = doc_saveAs;
             m_pDocumentClass->getDocumentType = doc_getDocumentType;
-            m_pDocumentClass->getNumberOfParts = doc_getNumberOfParts;
+            m_pDocumentClass->getParts = doc_getParts;
+            m_pDocumentClass->getPart = doc_getPart;
             m_pDocumentClass->setPart = doc_setPart;
             m_pDocumentClass->paintTile = doc_paintTile;
             m_pDocumentClass->getDocumentSize = doc_getDocumentSize;
@@ -420,17 +422,46 @@ static LibreOfficeKitDocumentType doc_getDocumentType (LibreOfficeKitDocument* p
     return LOK_DOCTYPE_OTHER;
 }
 
-static int doc_getNumberOfParts (LibreOfficeKitDocument* pThis)
+static int doc_getParts (LibreOfficeKitDocument* pThis)
 {
-    (void) pThis;
-    // Assume writer document for now.
-    return 1;
+    LibLODocument_Impl* pDocument = static_cast<LibLODocument_Impl*>(pThis);
+
+    ::vcl::ITiledRenderable* pDoc = dynamic_cast< ::vcl::ITiledRenderable* >( pDocument->mxComponent.get() );
+    if (!pDoc)
+    {
+        gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering";
+        return 0;
+    }
+
+    return pDoc->getParts();
+}
+
+static int doc_getPart (LibreOfficeKitDocument* pThis)
+{
+    LibLODocument_Impl* pDocument = static_cast<LibLODocument_Impl*>(pThis);
+
+    ::vcl::ITiledRenderable* pDoc = dynamic_cast< ::vcl::ITiledRenderable* >( pDocument->mxComponent.get() );
+    if (!pDoc)
+    {
+        gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering";
+        return 0;
+    }
+
+    return pDoc->getPart();
 }
 
 static void doc_setPart(LibreOfficeKitDocument* pThis, int nPart)
 {
-    (void) pThis;
-    (void) nPart;
+    LibLODocument_Impl* pDocument = static_cast<LibLODocument_Impl*>(pThis);
+
+    ::vcl::ITiledRenderable* pDoc = dynamic_cast< ::vcl::ITiledRenderable* >( pDocument->mxComponent.get() );
+    if (!pDoc)
+    {
+        gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering";
+        return;
+    }
+
+    pDoc->setPart( nPart );
 }
 
 void doc_paintTile (LibreOfficeKitDocument* pThis,
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h
index ba4319f..675eabc 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -77,8 +77,9 @@ struct _LibreOfficeKitDocumentClass
 
   // Part refers to either indivual sheets in a Spreadsheet, or slides
   // in a Slideshow, and has no relevance for wrtier documents.
-  int (*getNumberOfParts) (LibreOfficeKitDocument* pThis);
+  int (*getParts) (LibreOfficeKitDocument* pThis);
 
+  int (*getPart)          (LibreOfficeKitDocument* pThis);
   void (*setPart)         (LibreOfficeKitDocument* pThis,
                            int nPart);
 
diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx
index 427ea83..32faf26 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -49,9 +49,14 @@ public:
         return mpDoc->pClass->getDocumentType(mpDoc);
     }
 
-    inline int getNumberOfParts()
+    inline int getParts()
     {
-        return mpDoc->pClass->getNumberOfParts(mpDoc);
+        return mpDoc->pClass->getParts(mpDoc);
+    }
+
+    inline int getPart()
+    {
+        return mpDoc->pClass->getPart(mpDoc);
     }
 
     inline void setPart(int nPart)
@@ -75,7 +80,7 @@ public:
 
     inline void getDocumentSize(long* pWidth, long* pHeight)
     {
-        mpDoc->getDocumentSize(mpDoc, pWidth, pHeight);
+        mpDoc->pClass->getDocumentSize(mpDoc, pWidth, pHeight);
     }
 #endif // LOK_USE_UNSTABLE_API
 };
diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx
index fecfd6c..f5ce44a 100644
--- a/include/vcl/ITiledRenderable.hxx
+++ b/include/vcl/ITiledRenderable.hxx
@@ -41,6 +41,22 @@ public:
      */
     virtual Size getDocumentSize() = 0;
 
+    /**
+     * Set the document "part", i.e. slide for a slideshow, and
+     * tab for a spreadsheet.
+     */
+    virtual void setPart( int nPart ) = 0;
+
+    /**
+     * Get the number of parts -- see setPart for further details.
+     */
+    virtual int getParts() = 0;
+
+    /**
+     * Get the currently displayed/selected part -- see setPart for further
+     * details.
+     */
+    virtual int getPart() = 0;
 };
 
 } // namespace vcl
diff --git a/sc/inc/docuno.hxx b/sc/inc/docuno.hxx
index 27575fe..932017d 100644
--- a/sc/inc/docuno.hxx
+++ b/sc/inc/docuno.hxx
@@ -363,6 +363,9 @@ public:
                             long nTileWidth,
                             long nTileHeight ) SAL_OVERRIDE;
     virtual Size getDocumentSize() SAL_OVERRIDE;
+    virtual void setPart(   int nPart ) SAL_OVERRIDE;
+    virtual int  getPart() SAL_OVERRIDE;
+    virtual int  getParts() SAL_OVERRIDE;
 };
 
 class ScDrawPagesObj : public cppu::WeakImplHelper2<
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index ca18caa..d4c14cf 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -461,6 +461,24 @@ void ScModelObj::paintTile( VirtualDevice& rDevice,
                             nTilePosX, nTilePosY, nTileWidth, nTileHeight );
 }
 
+void ScModelObj::setPart( int nPart )
+{
+    ScViewData* pViewData = ScDocShell::GetViewData();
+    pViewData->SetTabNo( nPart );
+}
+
+int ScModelObj::getParts()
+{
+    ScDocument& rDoc = pDocShell->GetDocument();
+    return rDoc.GetTableCount();
+}
+
+int ScModelObj::getPart()
+{
+    ScViewData* pViewData = ScDocShell::GetViewData();
+    return pViewData->GetTabNo();
+}
+
 Size ScModelObj::getDocumentSize()
 {
     // There seems to be no clear way of getting the grid window for this
diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx
index a48a8f3..1318071 100644
--- a/sw/inc/unotxdoc.hxx
+++ b/sw/inc/unotxdoc.hxx
@@ -439,6 +439,9 @@ public:
                             long nTileWidth,
                             long nTileHeight ) SAL_OVERRIDE;
     virtual Size getDocumentSize() SAL_OVERRIDE;
+    virtual void setPart(   int nPart ) SAL_OVERRIDE;
+    virtual int  getPart() SAL_OVERRIDE;
+    virtual int  getParts() SAL_OVERRIDE;
 
     void                        Invalidate();
     void                        Reactivate(SwDocShell* pNewDocShell);
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index b61eb77..d8c4af0 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -3137,6 +3137,21 @@ Size SwXTextDocument::getDocumentSize()
     return pViewShell->GetDocSize();
 }
 
+void SwXTextDocument::setPart( int /*nPart*/ )
+{
+}
+
+int SwXTextDocument::getPart()
+{
+    return 0;
+}
+
+int SwXTextDocument::getParts()
+{
+    // For now we treat the document as one large piece.
+    return 1;
+}
+
 void * SAL_CALL SwXTextDocument::operator new( size_t t) throw()
 {
     return SwXTextDocumentBaseClass::operator new(t);


More information about the Libreoffice-commits mailing list