summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorPranav Kant <pranavk@collabora.co.uk>2017-11-24 01:20:56 +0530
committerJan Holesovsky <kendy@collabora.com>2017-11-28 17:52:59 +0100
commitcf2443a12681f23850cfe9439a4dec680821c61a (patch)
tree0bdc55f6fd9bc9fa9c5478cd7273947feeca4ade /include
parent24396ba7f2e62e28401ddb0354c257539455de75 (diff)
lokdialog: Make vcl::DialogID an integer
This will help launching multiple instances of dialog from multiple views. The earlier approach of using the UNO command strings as dialog id would not have been useful for multi-view case. Change-Id: I01cfb3c8b204d5654df2417efdac6b50dc920f0e
Diffstat (limited to 'include')
-rw-r--r--include/LibreOfficeKit/LibreOfficeKit.h12
-rw-r--r--include/LibreOfficeKit/LibreOfficeKit.hxx36
-rw-r--r--include/sfx2/lokhelper.hxx4
-rw-r--r--include/sfx2/viewsh.hxx10
-rw-r--r--include/vcl/IDialogRenderable.hxx2
-rw-r--r--include/vcl/dialog.hxx6
6 files changed, 36 insertions, 34 deletions
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h
index 7aa4ba91a8d3..4bd48c9b1756 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -257,29 +257,29 @@ struct _LibreOfficeKitDocumentClass
/// Paints dialog with given dialog id to the buffer
/// @see lok::Document::paintDialog().
- void (*paintDialog) (LibreOfficeKitDocument* pThis, const char* pDialogId,
+ void (*paintDialog) (LibreOfficeKitDocument* pThis, unsigned nDialogId,
unsigned char* pBuffer,
const int x, const int y,
const int width, const int height);
/// Get info about dialog with given dialog id
/// @see lok::Document::getDialogInfo().
- void (*getDialogInfo) (LibreOfficeKitDocument* pThis, const char* pDialogId,
+ void (*getDialogInfo) (LibreOfficeKitDocument* pThis, unsigned nDialogId,
char** pDialogTitle, int* pWidth, int* pHeight);
/// @see lok::Document::paintActiveFloatingWindow().
- void (*paintActiveFloatingWindow) (LibreOfficeKitDocument* pThis, const char* pDialogId, unsigned char* pBuffer, int* nWidth, int* nHeight);
+ void (*paintActiveFloatingWindow) (LibreOfficeKitDocument* pThis, unsigned nDialogId, unsigned char* pBuffer, int* nWidth, int* nHeight);
/// @see lok::Document::postDialogKeyEvent().
void (*postDialogKeyEvent) (LibreOfficeKitDocument* pThis,
- const char* pDialogId,
+ unsigned nDialogId,
int nType,
int nCharCode,
int nKeyCode);
/// @see lok::Document::postDialogMouseEvent().
void (*postDialogMouseEvent) (LibreOfficeKitDocument* pThis,
- const char* pDialogId,
+ unsigned nDialogId,
int nType,
int nX,
int nY,
@@ -289,7 +289,7 @@ struct _LibreOfficeKitDocumentClass
/// @see lok::Document::postDialogChildMouseEvent().
void (*postDialogChildMouseEvent) (LibreOfficeKitDocument* pThis,
- const char* pDialogId,
+ unsigned nDialogId,
int nType,
int nX,
int nY,
diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx
index 2e4486ee4d29..dc623261036a 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -159,38 +159,38 @@ public:
*
* Client must truncate pBuffer according to the nWidth and nHeight returned after the call.
*
- * @param pDialogId Unique dialog id to be painted
+ * @param nDialogId Unique dialog id to be painted
* @param pBuffer Buffer with enough memory allocated to render any dialog
* @param x x-coordinate from where the dialog should start painting
* @param y y-coordinate from where the dialog should start painting
* @param width The width of the dialog image to be painted
* @param height The height of the dialog image to be painted
*/
- void paintDialog(const char* pDialogId,
+ void paintDialog(unsigned nDialogId,
unsigned char* pBuffer,
const int x,
const int y,
const int width,
const int height)
{
- return mpDoc->pClass->paintDialog(mpDoc, pDialogId, pBuffer,
+ return mpDoc->pClass->paintDialog(mpDoc, nDialogId, pBuffer,
x, y, width, height);
}
/* Get info about dialog with given dialog id
*
- * @param pDialogId Unique dialog id for which to get info about
+ * @param nDialogId Unique dialog id for which to get info about
* @param pDialogTitle Pointer to pointer pointing to string containing the
* dialog title. Caller should the pointer to allocated string themselves.
* @param pWidth The width of the dialog
* @param pHeight The height of the dialog
*/
- void getDialogInfo(const char* pDialogId,
+ void getDialogInfo(unsigned nDialogId,
char** pDialogTitle,
int& pWidth,
int& pHeight)
{
- return mpDoc->pClass->getDialogInfo(mpDoc, pDialogId, pDialogTitle, &pWidth, &pHeight);
+ return mpDoc->pClass->getDialogInfo(mpDoc, nDialogId, pDialogTitle, &pWidth, &pHeight);
}
@@ -199,17 +199,17 @@ public:
*
* Client must truncate pBuffer according to the nWidth and nHeight returned after the call.
*
- * @param pDialogId Unique dialog id
+ * @param nDialogId Unique dialog id
* @param pBuffer Buffer with enough memory allocated to render any dialog
* @param nWidth output parameter returning the width of the rendered dialog.
* @param nHeight output parameter returning the height of the rendered dialog
*/
- void paintActiveFloatingWindow(const char* pDialogId,
+ void paintActiveFloatingWindow(unsigned nDialogId,
unsigned char* pBuffer,
int& nWidth,
int& nHeight)
{
- return mpDoc->pClass->paintActiveFloatingWindow(mpDoc, pDialogId, pBuffer,
+ return mpDoc->pClass->paintActiveFloatingWindow(mpDoc, nDialogId, pBuffer,
&nWidth, &nHeight);
}
@@ -281,14 +281,14 @@ public:
/**
* Posts a keyboard event to the dialog
*
- * @param pDialogId Dialog id on which key event should be posted
+ * @param nDialogId Dialog id on which key event should be posted
* @param nType Event type, like press or release.
* @param nCharCode contains the Unicode character generated by this event or 0
* @param nKeyCode contains the integer code representing the key of the event (non-zero for control keys)
*/
- void postDialogKeyEvent(const char* pDialogId, int nType, int nCharCode, int nKeyCode)
+ void postDialogKeyEvent(unsigned nDialogId, int nType, int nCharCode, int nKeyCode)
{
- mpDoc->pClass->postDialogKeyEvent(mpDoc, pDialogId, nType, nCharCode, nKeyCode);
+ mpDoc->pClass->postDialogKeyEvent(mpDoc, nDialogId, nType, nCharCode, nKeyCode);
}
/**
@@ -309,7 +309,7 @@ public:
/**
* Posts a mouse event to the dialog with given id.
*
- * @param pDialogId Dialog id where mouse event is to be posted
+ * @param nDialogId Dialog id where mouse event is to be posted
* @param nType Event type, like down, move or up.
* @param nX horizontal position in document coordinates
* @param nY vertical position in document coordinates
@@ -317,15 +317,15 @@ public:
* @param nButtons: which mouse buttons: 1 for left, 2 for middle, 4 right
* @param nModifier: which keyboard modifier: (see include/vcl/vclenum.hxx for possible values)
*/
- void postDialogMouseEvent(const char* pDialogId, int nType, int nX, int nY, int nCount, int nButtons, int nModifier)
+ void postDialogMouseEvent(unsigned nDialogId, int nType, int nX, int nY, int nCount, int nButtons, int nModifier)
{
- mpDoc->pClass->postDialogMouseEvent(mpDoc, pDialogId, nType, nX, nY, nCount, nButtons, nModifier);
+ mpDoc->pClass->postDialogMouseEvent(mpDoc, nDialogId, nType, nX, nY, nCount, nButtons, nModifier);
}
/**
* Posts a mouse event to the child of a dialog with given id.
*
- * @param aDialogId Dialog id
+ * @param nDialogId Dialog id
* @param nType Event type, like down, move or up.
* @param nX horizontal position in document coordinates
* @param nY vertical position in document coordinates
@@ -333,9 +333,9 @@ public:
* @param nButtons: which mouse buttons: 1 for left, 2 for middle, 4 right
* @param nModifier: which keyboard modifier: (see include/vcl/vclenum.hxx for possible values)
*/
- void postDialogChildMouseEvent(const char* pDialogId, int nType, int nX, int nY, int nCount, int nButtons, int nModifier)
+ void postDialogChildMouseEvent(unsigned nDialogId, int nType, int nX, int nY, int nCount, int nButtons, int nModifier)
{
- mpDoc->pClass->postDialogChildMouseEvent(mpDoc, pDialogId, nType, nX, nY, nCount, nButtons, nModifier);
+ mpDoc->pClass->postDialogChildMouseEvent(mpDoc, nDialogId, nType, nX, nY, nCount, nButtons, nModifier);
}
diff --git a/include/sfx2/lokhelper.hxx b/include/sfx2/lokhelper.hxx
index 17521204590b..ce0a69b75e6f 100644
--- a/include/sfx2/lokhelper.hxx
+++ b/include/sfx2/lokhelper.hxx
@@ -42,11 +42,11 @@ public:
/// Same as notifyOtherViews(), but works on a selected "other" view, not on all of them.
static void notifyOtherView(SfxViewShell* pThisView, SfxViewShell* pOtherView, int nType, const OString& rKey, const OString& rPayload);
/// Emits a LOK_CALLBACK_DIALOG
- static void notifyDialog(const OUString& rDialogId,
+ static void notifyDialog(vcl::DialogID nDialogId,
const OUString& rAction,
const std::vector<vcl::LOKPayloadItem>& rPayload = std::vector<vcl::LOKPayloadItem>());
/// Emits a LOK_CALLBACK_DIALOG_CHILD
- static void notifyDialogChild(const OUString& rDialogID, const OUString& rAction, const Point& rPos);
+ static void notifyDialogChild(vcl::DialogID nDialogId, const OUString& rAction, const Point& rPos);
/// Emits a LOK_CALLBACK_INVALIDATE_TILES, but tweaks it according to setOptionalFeatures() if needed.
static void notifyInvalidation(SfxViewShell* pThisView, const OString& rPayload);
/// A special value to signify 'infinity'.
diff --git a/include/sfx2/viewsh.hxx b/include/sfx2/viewsh.hxx
index 3131fd49eee3..0db8fb3aec82 100644
--- a/include/sfx2/viewsh.hxx
+++ b/include/sfx2/viewsh.hxx
@@ -227,13 +227,13 @@ public:
virtual SfxShell* GetFormShell() { return nullptr; };
virtual const SfxShell* GetFormShell() const { return nullptr; };
- void RegisterDlg(const vcl::DialogID& rDialogId, VclPtr<Dialog> pDlg);
- VclPtr<Dialog> GetOpenedDlg(const vcl::DialogID& rDialogId);
- void UnregisterDlg(const vcl::DialogID& rDialogId);
+ void RegisterDlg(vcl::DialogID nDialogId, VclPtr<Dialog> pDlg);
+ VclPtr<Dialog> GetOpenedDlg(vcl::DialogID nDialogId);
+ void UnregisterDlg(vcl::DialogID nDialogId);
// IDialogNotifier
- virtual void notifyDialog(const vcl::DialogID& rDialogID, const OUString& rAction, const std::vector<vcl::LOKPayloadItem>& rPayload = std::vector<vcl::LOKPayloadItem>()) override;
- virtual void notifyDialogChild(const vcl::DialogID& rDialogID, const OUString& rAction, const Point& rPos) override;
+ virtual void notifyDialog(const vcl::DialogID& rDialogId, const OUString& rAction, const std::vector<vcl::LOKPayloadItem>& rPayload = std::vector<vcl::LOKPayloadItem>()) override;
+ virtual void notifyDialogChild(const vcl::DialogID& rDialogId, const OUString& rAction, const Point& rPos) override;
// Focus, KeyInput, Cursor
virtual void ShowCursor( bool bOn = true );
diff --git a/include/vcl/IDialogRenderable.hxx b/include/vcl/IDialogRenderable.hxx
index 6bb3777860a6..ccb99cb0adb2 100644
--- a/include/vcl/IDialogRenderable.hxx
+++ b/include/vcl/IDialogRenderable.hxx
@@ -25,7 +25,7 @@ namespace vcl
typedef std::pair<const OString, const OString> LOKPayloadItem;
-typedef OUString DialogID;
+typedef sal_uInt32 DialogID;
class VCL_DLLPUBLIC IDialogRenderable
{
diff --git a/include/vcl/dialog.hxx b/include/vcl/dialog.hxx
index bba69207fe3c..3586c116b31d 100644
--- a/include/vcl/dialog.hxx
+++ b/include/vcl/dialog.hxx
@@ -50,6 +50,8 @@ private:
vcl::IDialogNotifier* mpDialogNotifier; // to emit LOK callbacks
+ static vcl::DialogID mnLastDialogId;
+
SAL_DLLPRIVATE void ImplInitDialogData();
SAL_DLLPRIVATE void ImplInitSettings();
@@ -63,8 +65,8 @@ private:
protected:
using Window::ImplInit;
SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle, InitFlag eFlag = InitFlag::Default );
- /// Dialog ID (UNO name) for this dialog
- OUString maID;
+ /// Dialog ID (used for LOK)
+ vcl::DialogID maID;
/// Necessary to register dialog notifier instance to emit LOK callbacks
void registerDialogNotifier(vcl::IDialogNotifier* pDialogNotifier);