[Libreoffice-commits] core.git: Branch 'feature/tiled-editing' - desktop/source include/LibreOfficeKit include/vcl libreofficekit/qa libreofficekit/source sd/source sw/source

Miklos Vajna vmiklos at collabora.co.uk
Fri Feb 20 08:38:42 PST 2015


 desktop/source/lib/init.cxx                         |   11 -
 desktop/source/lib/lokandroid.cxx                   |    2 
 include/LibreOfficeKit/LibreOfficeKit.h             |  109 +----------------
 include/LibreOfficeKit/LibreOfficeKit.hxx           |    2 
 include/LibreOfficeKit/LibreOfficeKitEnums.h        |  124 ++++++++++++++++++++
 include/LibreOfficeKit/LibreOfficeKitGtk.h          |    2 
 include/vcl/ITiledRenderable.hxx                    |    5 
 libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx |    1 
 libreofficekit/source/gtk/lokdocview.c              |    6 
 sd/source/ui/inc/unomodel.hxx                       |    2 
 sd/source/ui/unoidl/unomodel.cxx                    |    5 
 sd/source/ui/view/sdwindow.cxx                      |    1 
 sw/source/core/crsr/viscrs.cxx                      |    1 
 sw/source/uibase/docvw/edtwin.cxx                   |    1 
 sw/source/uibase/uno/unotxdoc.cxx                   |    2 
 15 files changed, 159 insertions(+), 115 deletions(-)

New commits:
commit 1219730490a7568fdfaf57b3c49f4a7a2a151410
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Fri Feb 20 16:21:06 2015 +0100

    Extract LibreOfficeKitEnums.h from LibreOfficeKit.h
    
    This massively reduces the rebuild time in case only a new enumeration
    value is added to one of the enums.
    
    Change-Id: I4e58adf36fcd29da1672a5e5091bd3f6744f148d

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index bd3a80a..769a2fc 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -18,6 +18,7 @@
 
 #define LOK_USE_UNSTABLE_API
 #include <LibreOfficeKit/LibreOfficeKit.h>
+#include <LibreOfficeKit/LibreOfficeKitEnums.h>
 
 #include <tools/errinf.hxx>
 #include <osl/file.hxx>
@@ -182,12 +183,12 @@ 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_getDocumentType(LibreOfficeKitDocument* pThis);
 static int doc_getParts(LibreOfficeKitDocument* pThis);
 static int doc_getPart(LibreOfficeKitDocument* pThis);
 static void doc_setPart(LibreOfficeKitDocument* pThis, int nPart);
 static char* doc_getPartName(LibreOfficeKitDocument* pThis, int nPart);
-static void doc_setPartMode(LibreOfficeKitDocument* pThis, LibreOfficeKitPartMode ePartMode);
+static void doc_setPartMode(LibreOfficeKitDocument* pThis, int nPartMode);
 void        doc_paintTile(LibreOfficeKitDocument* pThis,
                           unsigned char* pBuffer,
                           const int nCanvasWidth, const int nCanvasHeight,
@@ -437,7 +438,7 @@ static int doc_saveAs(LibreOfficeKitDocument* pThis, const char* sUrl, const cha
     return false;
 }
 
-static LibreOfficeKitDocumentType doc_getDocumentType (LibreOfficeKitDocument* pThis)
+static int doc_getDocumentType (LibreOfficeKitDocument* pThis)
 {
     LibLODocument_Impl* pDocument = static_cast<LibLODocument_Impl*>(pThis);
 
@@ -528,7 +529,7 @@ static char* doc_getPartName(LibreOfficeKitDocument* pThis, int nPart)
 }
 
 static void doc_setPartMode(LibreOfficeKitDocument* pThis,
-                            LibreOfficeKitPartMode ePartMode)
+                            int nPartMode)
 {
     ITiledRenderable* pDoc = getTiledRenderable(pThis);
     if (!pDoc)
@@ -541,7 +542,7 @@ static void doc_setPartMode(LibreOfficeKitDocument* pThis,
 
     int nCurrentPart = pDoc->getPart();
 
-    pDoc->setPartMode(ePartMode);
+    pDoc->setPartMode(nPartMode);
 
     // We need to make sure the internal state is updated, just changing the mode
     // might not update the relevant shells (i.e. impress will keep rendering the
diff --git a/desktop/source/lib/lokandroid.cxx b/desktop/source/lib/lokandroid.cxx
index 9ea1842..a4f7297 100644
--- a/desktop/source/lib/lokandroid.cxx
+++ b/desktop/source/lib/lokandroid.cxx
@@ -209,7 +209,7 @@ extern "C" SAL_JNI_EXPORT void JNICALL Java_org_libreoffice_kit_Document_setPart
 {
     LibreOfficeKitDocument* pDocument = getHandle<LibreOfficeKitDocument>(pEnv, aObject);
 
-    pDocument->pClass->setPartMode(pDocument, (LibreOfficeKitPartMode) nPartMode);
+    pDocument->pClass->setPartMode(pDocument, nPartMode);
 }
 
 extern "C" SAL_JNI_EXPORT jint JNICALL Java_org_libreoffice_kit_Document_getDocumentTypeNative
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h
index 46346bc..f2554aa 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -31,103 +31,6 @@ typedef struct _LibreOfficeKitDocumentClass LibreOfficeKitDocumentClass;
 #define LIBREOFFICEKIT_HAS(pKit,member) LIBREOFFICEKIT_HAS_MEMBER(LibreOfficeKitClass,member,(pKit)->pClass->nSize)
 
 #ifdef LOK_USE_UNSTABLE_API
-typedef enum
-{
-  LOK_DOCTYPE_TEXT,
-  LOK_DOCTYPE_SPREADSHEET,
-  LOK_DOCTYPE_PRESENTATION,
-  LOK_DOCTYPE_DRAWING,
-  LOK_DOCTYPE_OTHER
-}
-LibreOfficeKitDocumentType;
-
-typedef enum
-{
-    LOK_PARTMODE_DEFAULT,
-    LOK_PARTMODE_SLIDE,
-    LOK_PARTMODE_NOTES,
-    LOK_PARTMODE_SLIDENOTES,
-    LOK_PARTMODE_EMBEDDEDOBJ
-}
-LibreOfficeKitPartMode;
-
-typedef enum
-{
-    /**
-     * Any tiles which are over the rectangle described in the payload are no
-     * longer valid.
-     *
-     * Rectangle format: "width, height, x, y", where all numbers are document
-     * coordinates, in twips.
-     */
-    LOK_CALLBACK_INVALIDATE_TILES,
-    /**
-     * The size and/or the position of the visible cursor changed.
-     *
-     * Rectangle format is the same as LOK_CALLBACK_INVALIDATE_TILES.
-     */
-    LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR,
-    /**
-     * The list of rectangles representing the current text selection changed.
-     *
-     * List format is "rectangle1[; rectangle2[; ...]]" (without quotes and
-     * brackets), where rectangleN has the same format as
-     * LOK_CALLBACK_INVALIDATE_TILES. When there is no selection, an empty
-     * string is provided.
-     */
-    LOK_CALLBACK_TEXT_SELECTION,
-    /**
-     * The size and/or the position of the cursor rectangle at the text
-     * selection start changed.
-     *
-     * If this callback is emitted, it's always followed by a
-     * LOK_CALLBACK_TEXT_SELECTION one. Rectangle format is the same as
-     * LOK_CALLBACK_INVALIDATE_TILES.
-     */
-    LOK_CALLBACK_TEXT_SELECTION_START,
-    /**
-     * The size and/or the position of the cursor rectangle at the text
-     * selection end changed.
-     *
-     * If this callback is emitted, it's always followed by a
-     * LOK_CALLBACK_TEXT_SELECTION one. Rectangle format is the same as
-     * LOK_CALLBACK_INVALIDATE_TILES.
-     */
-    LOK_CALLBACK_TEXT_SELECTION_END
-}
-LibreOfficeKitCallbackType;
-
-typedef enum
-{
-    /// A key on the keyboard is pressed.
-    LOK_KEYEVENT_KEYINPUT,
-    /// A key on the keyboard is released.
-    LOK_KEYEVENT_KEYUP
-}
-LibreOfficeKitKeyEventType;
-
-typedef enum
-{
-    /// A pressed gesture has started.
-    LOK_MOUSEEVENT_MOUSEBUTTONDOWN,
-    /// A pressed gesture has finished.
-    LOK_MOUSEEVENT_MOUSEBUTTONUP,
-    /// A change has happened during a press gesture.
-    LOK_MOUSEEVENT_MOUSEMOVE
-}
-LibreOfficeKitMouseEventType;
-
-typedef enum
-{
-    /// The start of selection is to be adjusted.
-    LOK_SETTEXTSELECTION_START,
-    /// The end of selection is to be adjusted.
-    LOK_SETTEXTSELECTION_END,
-    /// Both the start and the end of selection is to be adjusted.
-    LOK_SETTEXTSELECTION_RESET
-}
-LibreOfficeKitSetTextSelectionType;
-
 typedef void (*LibreOfficeKitCallback)(int nType, const char* pPayload, void* pData);
 #endif // LOK_USE_UNSTABLE_API
 
@@ -163,7 +66,11 @@ struct _LibreOfficeKitDocumentClass
                      const char* pFormat,
                      const char* pFilterOptions);
 #ifdef LOK_USE_UNSTABLE_API
-  LibreOfficeKitDocumentType (*getDocumentType) (LibreOfficeKitDocument* pThis);
+  /** Get document type.
+   *
+   * @returns an element of the LibreOfficeKitDocumentType enum.
+   */
+  int (*getDocumentType) (LibreOfficeKitDocument* pThis);
 
   /** Get number of part that the document contains.
    * Part refers to either indivual sheets in a Spreadsheet,
@@ -180,8 +87,12 @@ struct _LibreOfficeKitDocumentClass
   char* (*getPartName)    (LibreOfficeKitDocument* pThis,
                            int nPart);
 
+  /** Sets mode of the current part.
+   *
+   * @param nMode - element from the LibreOfficeKitPartMode enum.
+   */
   void (*setPartMode)     (LibreOfficeKitDocument* pThis,
-                           LibreOfficeKitPartMode eMode);
+                           int nMode);
 
   void (*paintTile)       (LibreOfficeKitDocument* pThis,
                            unsigned char* pBuffer,
diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx
index 6476e8f..99f39fc 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -44,7 +44,7 @@ public:
     inline LibreOfficeKitDocument *get() { return mpDoc; }
 
 #ifdef LOK_USE_UNSTABLE_API
-    inline LibreOfficeKitDocumentType getDocumentType()
+    inline int getDocumentType()
     {
         return mpDoc->pClass->getDocumentType(mpDoc);
     }
diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h
new file mode 100644
index 0000000..a8aca2f
--- /dev/null
+++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h
@@ -0,0 +1,124 @@
+/* -*- 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/.
+ */
+
+#ifndef INCLUDED_LIBREOFFICEKIT_LIBREOFFICEKITENUMS_H
+#define INCLUDED_LIBREOFFICEKIT_LIBREOFFICEKITENUMS_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#ifdef LOK_USE_UNSTABLE_API
+typedef enum
+{
+  LOK_DOCTYPE_TEXT,
+  LOK_DOCTYPE_SPREADSHEET,
+  LOK_DOCTYPE_PRESENTATION,
+  LOK_DOCTYPE_DRAWING,
+  LOK_DOCTYPE_OTHER
+}
+LibreOfficeKitDocumentType;
+
+typedef enum
+{
+    LOK_PARTMODE_DEFAULT,
+    LOK_PARTMODE_SLIDE,
+    LOK_PARTMODE_NOTES,
+    LOK_PARTMODE_SLIDENOTES,
+    LOK_PARTMODE_EMBEDDEDOBJ
+}
+LibreOfficeKitPartMode;
+
+typedef enum
+{
+    /**
+     * Any tiles which are over the rectangle described in the payload are no
+     * longer valid.
+     *
+     * Rectangle format: "width, height, x, y", where all numbers are document
+     * coordinates, in twips.
+     */
+    LOK_CALLBACK_INVALIDATE_TILES,
+    /**
+     * The size and/or the position of the visible cursor changed.
+     *
+     * Rectangle format is the same as LOK_CALLBACK_INVALIDATE_TILES.
+     */
+    LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR,
+    /**
+     * The list of rectangles representing the current text selection changed.
+     *
+     * List format is "rectangle1[; rectangle2[; ...]]" (without quotes and
+     * brackets), where rectangleN has the same format as
+     * LOK_CALLBACK_INVALIDATE_TILES. When there is no selection, an empty
+     * string is provided.
+     */
+    LOK_CALLBACK_TEXT_SELECTION,
+    /**
+     * The size and/or the position of the cursor rectangle at the text
+     * selection start changed.
+     *
+     * If this callback is emitted, it's always followed by a
+     * LOK_CALLBACK_TEXT_SELECTION one. Rectangle format is the same as
+     * LOK_CALLBACK_INVALIDATE_TILES.
+     */
+    LOK_CALLBACK_TEXT_SELECTION_START,
+    /**
+     * The size and/or the position of the cursor rectangle at the text
+     * selection end changed.
+     *
+     * If this callback is emitted, it's always followed by a
+     * LOK_CALLBACK_TEXT_SELECTION one. Rectangle format is the same as
+     * LOK_CALLBACK_INVALIDATE_TILES.
+     */
+    LOK_CALLBACK_TEXT_SELECTION_END
+}
+LibreOfficeKitCallbackType;
+
+typedef enum
+{
+    /// A key on the keyboard is pressed.
+    LOK_KEYEVENT_KEYINPUT,
+    /// A key on the keyboard is released.
+    LOK_KEYEVENT_KEYUP
+}
+LibreOfficeKitKeyEventType;
+
+typedef enum
+{
+    /// A pressed gesture has started.
+    LOK_MOUSEEVENT_MOUSEBUTTONDOWN,
+    /// A pressed gesture has finished.
+    LOK_MOUSEEVENT_MOUSEBUTTONUP,
+    /// A change has happened during a press gesture.
+    LOK_MOUSEEVENT_MOUSEMOVE
+}
+LibreOfficeKitMouseEventType;
+
+typedef enum
+{
+    /// The start of selection is to be adjusted.
+    LOK_SETTEXTSELECTION_START,
+    /// The end of selection is to be adjusted.
+    LOK_SETTEXTSELECTION_END,
+    /// Both the start and the end of selection is to be adjusted.
+    LOK_SETTEXTSELECTION_RESET
+}
+LibreOfficeKitSetTextSelectionType;
+
+#endif // LOK_USE_UNSTABLE_API
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // INCLUDED_LIBREOFFICEKIT_LIBREOFFICEKITENUMS_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/LibreOfficeKit/LibreOfficeKitGtk.h b/include/LibreOfficeKit/LibreOfficeKitGtk.h
index c1a1731..d6d720e 100644
--- a/include/LibreOfficeKit/LibreOfficeKitGtk.h
+++ b/include/LibreOfficeKit/LibreOfficeKitGtk.h
@@ -100,7 +100,7 @@ void            lok_docview_set_part        (LOKDocView* pDocView,
 char*           lok_docview_get_part_name   (LOKDocView* pDocView,
                                              int nPart);
 void            lok_docview_set_partmode    (LOKDocView* pDocView,
-                                             LibreOfficeKitPartMode ePartMode);
+                                             int nPartMode);
 /// Sets if the viewer is actually an editor or not.
 void            lok_docview_set_edit        (LOKDocView* pDocView,
                                              gboolean bEdit);
diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx
index d5b3e80..ee903ad 100644
--- a/include/vcl/ITiledRenderable.hxx
+++ b/include/vcl/ITiledRenderable.hxx
@@ -79,9 +79,10 @@ public:
         return OUString("");
     }
 
-    virtual void setPartMode(LibreOfficeKitPartMode ePartMode)
+    /// @see lok::Document::setPartMode().
+    virtual void setPartMode(int nPartMode)
     {
-        (void) ePartMode;
+        (void) nPartMode;
     }
 
     /**
diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index fbaa97f..65bfb7d 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -17,6 +17,7 @@
 
 #include <LibreOfficeKit/LibreOfficeKitGtk.h>
 #include <LibreOfficeKit/LibreOfficeKitInit.h>
+#include <LibreOfficeKit/LibreOfficeKitEnums.h>
 #include "../lokdocview_quad/lokdocview_quad.h"
 
 #include <com/sun/star/awt/Key.hpp>
diff --git a/libreofficekit/source/gtk/lokdocview.c b/libreofficekit/source/gtk/lokdocview.c
index 132b2d4..31d9430 100644
--- a/libreofficekit/source/gtk/lokdocview.c
+++ b/libreofficekit/source/gtk/lokdocview.c
@@ -13,7 +13,7 @@
 
 #define LOK_USE_UNSTABLE_API
 #include <LibreOfficeKit/LibreOfficeKit.h>
-
+#include <LibreOfficeKit/LibreOfficeKitEnums.h>
 #include <LibreOfficeKit/LibreOfficeKitGtk.h>
 
 #if !GLIB_CHECK_VERSION(2,32,0)
@@ -713,9 +713,9 @@ SAL_DLLPUBLIC_EXPORT char* lok_docview_get_part_name( LOKDocView* pDocView, int
 }
 
 SAL_DLLPUBLIC_EXPORT void lok_docview_set_partmode( LOKDocView* pDocView,
-                                                    LibreOfficeKitPartMode ePartMode )
+                                                    int nPartMode )
 {
-    pDocView->pDocument->pClass->setPartMode( pDocView->pDocument, ePartMode );
+    pDocView->pDocument->pClass->setPartMode( pDocView->pDocument, nPartMode );
     renderDocument(pDocView, NULL);
 }
 
diff --git a/sd/source/ui/inc/unomodel.hxx b/sd/source/ui/inc/unomodel.hxx
index fbeb73a..768e4f6 100644
--- a/sd/source/ui/inc/unomodel.hxx
+++ b/sd/source/ui/inc/unomodel.hxx
@@ -238,7 +238,7 @@ public:
     virtual int  getPart() SAL_OVERRIDE;
     virtual int  getParts() SAL_OVERRIDE;
     virtual OUString getPartName( int nPart ) SAL_OVERRIDE;
-    virtual void setPartMode( LibreOfficeKitPartMode ePartMode ) SAL_OVERRIDE;
+    virtual void setPartMode( int nPartMode ) SAL_OVERRIDE;
 
     /// @see vcl::ITiledRenderable::initializeForTiledRendering().
     virtual void initializeForTiledRendering() SAL_OVERRIDE;
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index 7193fbc..2fe0313 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -41,6 +41,7 @@
 #include <sfx2/bindings.hxx>
 #include <vcl/svapp.hxx>
 #include <vcl/settings.hxx>
+#include <LibreOfficeKit/LibreOfficeKitEnums.h>
 
 #include <editeng/UnoForbiddenCharsTable.hxx>
 #include <svx/svdoutl.hxx>
@@ -2302,14 +2303,14 @@ OUString SdXImpressDocument::getPartName( int nPart )
     return pPage->GetName();
 }
 
-void SdXImpressDocument::setPartMode( LibreOfficeKitPartMode ePartMode )
+void SdXImpressDocument::setPartMode( int nPartMode )
 {
     DrawViewShell* pViewSh = GetViewShell();
     if (!pViewSh)
         return;
 
     PageKind aPageKind( PK_STANDARD );
-    switch ( ePartMode )
+    switch ( nPartMode )
     {
     case LOK_PARTMODE_EMBEDDEDOBJ:
         // This will probably be handled higher up, i.e.
diff --git a/sd/source/ui/view/sdwindow.cxx b/sd/source/ui/view/sdwindow.cxx
index 076cba5..185bef8 100644
--- a/sd/source/ui/view/sdwindow.cxx
+++ b/sd/source/ui/view/sdwindow.cxx
@@ -40,6 +40,7 @@
 
 #include <vcl/svapp.hxx>
 #include <vcl/settings.hxx>
+#include <LibreOfficeKit/LibreOfficeKitEnums.h>
 
 namespace sd {
 
diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx
index 0803ae2..9155521 100644
--- a/sw/source/core/crsr/viscrs.cxx
+++ b/sw/source/core/crsr/viscrs.cxx
@@ -54,6 +54,7 @@
 #include <boost/scoped_ptr.hpp>
 
 #include <touch/touch.h>
+#include <LibreOfficeKit/LibreOfficeKitEnums.h>
 #include <paintfrm.hxx>
 
 // Here static members are defined. They will get changed on alteration of the
diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx
index 9fb33c8..01af8f1 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -68,6 +68,7 @@
 #include <basegfx/polygon/b2dpolygon.hxx>
 
 #include <touch/touch-impl.h>
+#include <LibreOfficeKit/LibreOfficeKitEnums.h>
 
 #include <editeng/acorrcfg.hxx>
 #include <SwSmartTagMgr.hxx>
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index 88320e8..0f0cbeb 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -28,6 +28,8 @@
 #include <sfx2/printer.hxx>
 #include <toolkit/helper/vclunohelper.hxx>
 #include <toolkit/awt/vclxdevice.hxx>
+#define LOK_USE_UNSTABLE_API
+#include <LibreOfficeKit/LibreOfficeKitEnums.h>
 #include <cmdid.h>
 #include <swtypes.hxx>
 #include <wdocsh.hxx>


More information about the Libreoffice-commits mailing list