diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-02-20 16:21:06 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-02-23 10:10:30 +0100 |
commit | 77debb673e61340dfc3ddc63b6d72731c091c210 (patch) | |
tree | 00166a3ca1312f24dd7a1689ec310e11c089e8ac | |
parent | 916d40e047ae7a46ce8da05776c66a4e8630c809 (diff) |
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
-rw-r--r-- | desktop/source/lib/init.cxx | 11 | ||||
-rw-r--r-- | desktop/source/lib/lokandroid.cxx | 2 | ||||
-rw-r--r-- | include/LibreOfficeKit/LibreOfficeKit.h | 109 | ||||
-rw-r--r-- | include/LibreOfficeKit/LibreOfficeKit.hxx | 2 | ||||
-rw-r--r-- | include/LibreOfficeKit/LibreOfficeKitEnums.h | 124 | ||||
-rw-r--r-- | include/LibreOfficeKit/LibreOfficeKitGtk.h | 2 | ||||
-rw-r--r-- | include/vcl/ITiledRenderable.hxx | 5 | ||||
-rw-r--r-- | libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx | 1 | ||||
-rw-r--r-- | libreofficekit/source/gtk/lokdocview.c | 6 | ||||
-rw-r--r-- | sd/source/ui/inc/unomodel.hxx | 2 | ||||
-rw-r--r-- | sd/source/ui/unoidl/unomodel.cxx | 5 | ||||
-rw-r--r-- | sd/source/ui/view/sdwindow.cxx | 1 | ||||
-rw-r--r-- | sw/source/core/crsr/viscrs.cxx | 1 | ||||
-rw-r--r-- | sw/source/uibase/docvw/edtwin.cxx | 1 | ||||
-rw-r--r-- | sw/source/uibase/uno/unotxdoc.cxx | 2 |
15 files changed, 159 insertions, 115 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index a144b51969bf..3acb7bf1f0c7 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, @@ -450,7 +451,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); @@ -541,7 +542,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) @@ -554,7 +555,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 9ea1842975a3..a4f7297e7178 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 c7dac9aed627..f8a62b243959 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 @@ -168,7 +71,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, @@ -185,8 +92,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 8f1958266c01..f8d6e195c82a 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 000000000000..a8aca2f7abec --- /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 c1a17319a4d5..d6d720e9ec90 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 d5b3e8077923..ee903ada6584 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 fbaa97fa224d..65bfb7d4606a 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 132b2d4c8770..31d9430ac331 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 fbeb73ae24f1..768e4f633f90 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 6f5edb31456f..ff9115a08a32 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 60d51e69e2ea..1c5bdd7ea8aa 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 cf68b8d98d0a..74b5ee6fec68 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 c8565d49646d..751a7e1a3e93 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 88320e86c267..0f0cbeb8dbf6 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> |