diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-06-17 16:38:04 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-06-17 16:00:44 +0000 |
commit | 45c2410041c48c22bd860efb42d4daadad7869b0 (patch) | |
tree | 7adf4d278976bcadd284c8d1cbd6a863f98c14d0 /include | |
parent | 9ec54e92407cd632c4e38317f914edd557835a86 (diff) |
LOK: change type of view ids to uintptr_t
This fixes the following problem:
- createView() = 1
- createView() = 2
- destroyView(1)
and then view #2 was renumbered to 1.
Instead expose the pointer address of the SfxViewShell as the ID, which
is not changing in such a situation.
Note that the SfxViewShell <-> ID mapping is an implementation detail of
SfxLokHelper, and only pointers are converted to IDs, user-supplied IDs
are never converted back to pointers.
Change-Id: If79ef8b99ba391011b5d82b219ad13447d44cd5a
Reviewed-on: https://gerrit.libreoffice.org/26423
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/LibreOfficeKit/LibreOfficeKit.h | 8 | ||||
-rw-r--r-- | include/LibreOfficeKit/LibreOfficeKit.hxx | 8 | ||||
-rw-r--r-- | include/sfx2/lokhelper.hxx | 9 |
3 files changed, 13 insertions, 12 deletions
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h index 110d4d58f8c8..a337bc319168 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.h +++ b/include/LibreOfficeKit/LibreOfficeKit.h @@ -209,13 +209,13 @@ struct _LibreOfficeKitDocumentClass void (*setClientVisibleArea) (LibreOfficeKitDocument* pThis, int nX, int nY, int nWidth, int nHeight); /// @see lok::Document::createView(). - int (*createView) (LibreOfficeKitDocument* pThis); + uintptr_t (*createView) (LibreOfficeKitDocument* pThis); /// @see lok::Document::destroyView(). - void (*destroyView) (LibreOfficeKitDocument* pThis, int nId); + void (*destroyView) (LibreOfficeKitDocument* pThis, uintptr_t nId); /// @see lok::Document::setView(). - void (*setView) (LibreOfficeKitDocument* pThis, int nId); + void (*setView) (LibreOfficeKitDocument* pThis, uintptr_t nId); /// @see lok::Document::getView(). - int (*getView) (LibreOfficeKitDocument* pThis); + uintptr_t (*getView) (LibreOfficeKitDocument* pThis); /// @see lok::Document::getViews(). int (*getViews) (LibreOfficeKitDocument* pThis); diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx index 7969ed52d32e..c496e2e5e7b8 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.hxx +++ b/include/LibreOfficeKit/LibreOfficeKit.hxx @@ -363,7 +363,7 @@ public: * By default a loaded document has 1 view. * @return the ID of the new view. */ - int createView() + uintptr_t createView() { return mpDoc->pClass->createView(mpDoc); } @@ -372,7 +372,7 @@ public: * Destroy a view of an existing document. * @param nId a view ID, returned by createView(). */ - void destroyView(int nId) + void destroyView(uintptr_t nId) { mpDoc->pClass->destroyView(mpDoc, nId); } @@ -381,7 +381,7 @@ public: * Set an existing view of an existing document as current. * @param nId a view ID, returned by createView(). */ - void setView(int nId) + void setView(uintptr_t nId) { mpDoc->pClass->setView(mpDoc, nId); } @@ -390,7 +390,7 @@ public: * Get the current view. * @return a view ID, previously returned by createView(). */ - int getView() + uintptr_t getView() { return mpDoc->pClass->getView(mpDoc); } diff --git a/include/sfx2/lokhelper.hxx b/include/sfx2/lokhelper.hxx index 399c1520c328..2a691f65759c 100644 --- a/include/sfx2/lokhelper.hxx +++ b/include/sfx2/lokhelper.hxx @@ -12,6 +12,7 @@ #include <sfx2/dllapi.h> #include <cstddef> +#include <cstdint> class SfxViewShell; @@ -19,13 +20,13 @@ class SFX2_DLLPUBLIC SfxLokHelper { public: /// Create a new view shell from the current view frame. - static int createView(); + static std::uintptr_t createView(); /// Destroy a view shell from the global shell list. - static void destroyView(std::size_t nId); + static void destroyView(std::uintptr_t nId); /// Set a view shell as current one. - static void setView(std::size_t nId); + static void setView(std::uintptr_t nId); /// Get the currently active view. - static std::size_t getView(); + static std::uintptr_t getView(); /// Get the number of views of the current object shell. static std::size_t getViews(); }; |