From 871eb68e14631d22aeb00ec33f0e5d801291942e Mon Sep 17 00:00:00 2001 From: Pranav Kant Date: Wed, 22 Nov 2017 22:25:20 +0530 Subject: lokdialog: Changed dialog painting to allow for modal dialogs Split IDialogNotifier from IDialogRenderable and make SfxViewShell implement it. We now just send the dialog UNO command to the backend and wait for core to emit a 'created' dialog callback which signals dialog creation in the backend. The client is then supposed to send the paint commands for rendering the dialog. Change-Id: I1bfbce83c17955fa0212408376d6bcd1b2d2d1dd --- include/sfx2/lokhelper.hxx | 2 +- include/sfx2/viewsh.hxx | 13 ++++++++++++- include/tools/gen.hxx | 1 + include/vcl/IDialogRenderable.hxx | 6 ++++++ include/vcl/dialog.hxx | 10 +++++----- 5 files changed, 25 insertions(+), 7 deletions(-) (limited to 'include') diff --git a/include/sfx2/lokhelper.hxx b/include/sfx2/lokhelper.hxx index e22017c8eccc..93d61fc311fa 100644 --- a/include/sfx2/lokhelper.hxx +++ b/include/sfx2/lokhelper.hxx @@ -44,7 +44,7 @@ public: /// Emits a LOK_CALLBACK_DIALOG static void notifyDialog(const OUString& rDialogId, const OUString& rAction, - const std::vector& rPayload); + const std::vector& rPayload = std::vector()); /// Emits a LOK_CALLBACK_DIALOG_CHILD static void notifyDialogChild(const OUString& rDialogID, const OUString& rAction, const Point& rPos); /// Emits a LOK_CALLBACK_INVALIDATE_TILES, but tweaks it according to setOptionalFeatures() if needed. diff --git a/include/sfx2/viewsh.hxx b/include/sfx2/viewsh.hxx index 65975dc8e27d..ed0ea3f3817b 100644 --- a/include/sfx2/viewsh.hxx +++ b/include/sfx2/viewsh.hxx @@ -34,6 +34,8 @@ #include #include #include +#include +#include #include #include #include @@ -140,7 +142,7 @@ template bool checkSfxViewShell(const SfxViewShell* pShell) return dynamic_cast(pShell) != nullptr; } -class SFX2_DLLPUBLIC SfxViewShell: public SfxShell, public SfxListener, public OutlinerViewShell +class SFX2_DLLPUBLIC SfxViewShell: public SfxShell, public SfxListener, public OutlinerViewShell, public vcl::IDialogNotifier { friend class SfxViewFrame; friend class SfxBaseController; @@ -151,6 +153,7 @@ friend class SfxPrinterController; VclPtr pWindow; bool bNoNewWindow; bool mbPrinterSettingsModified; + std::vector > > maOpenedDialogs; protected: virtual void Activate(bool IsMDIActivate) override; @@ -219,6 +222,14 @@ public: virtual SfxShell* GetFormShell() { return nullptr; }; virtual const SfxShell* GetFormShell() const { return nullptr; }; + void RegisterDlg(const vcl::DialogID& rDialogId, VclPtr pDlg); + VclPtr GetOpenedDlg(const vcl::DialogID& rDialogId); + void UnregisterDlg(const vcl::DialogID& rDialogId); + + // IDialogNotifier + virtual void notifyDialog(const vcl::DialogID& rDialogID, const OUString& rAction, const std::vector& rPayload = std::vector()) override; + virtual void notifyDialogChild(const vcl::DialogID& rDialogID, const OUString& rAction, const Point& rPos) override; + // Focus, KeyInput, Cursor virtual void ShowCursor( bool bOn = true ); virtual bool KeyInput( const KeyEvent &rKeyEvent ); diff --git a/include/tools/gen.hxx b/include/tools/gen.hxx index 079ada40e2e6..2db20125d499 100644 --- a/include/tools/gen.hxx +++ b/include/tools/gen.hxx @@ -48,6 +48,7 @@ public: long& A() { return nA; } long& B() { return nB; } + TOOLS_DLLPUBLIC rtl::OString toString() const; TOOLS_DLLPUBLIC friend SvStream& ReadPair( SvStream& rIStream, Pair& rPair ); TOOLS_DLLPUBLIC friend SvStream& WritePair( SvStream& rOStream, const Pair& rPair ); diff --git a/include/vcl/IDialogRenderable.hxx b/include/vcl/IDialogRenderable.hxx index 4137e960edb9..9a63830566f0 100644 --- a/include/vcl/IDialogRenderable.hxx +++ b/include/vcl/IDialogRenderable.hxx @@ -45,6 +45,12 @@ public: virtual void postDialogChildMouseEvent(const DialogID& rDialogID, int nType, int nX, int nY, int nCount, int nButtons, int nModifier) = 0; +}; + +class VCL_DLLPUBLIC IDialogNotifier +{ +public: + virtual ~IDialogNotifier() {} // Callbacks virtual void notifyDialog(const DialogID& rDialogID, diff --git a/include/vcl/dialog.hxx b/include/vcl/dialog.hxx index 8d84aab17606..874828f92a0e 100644 --- a/include/vcl/dialog.hxx +++ b/include/vcl/dialog.hxx @@ -57,7 +57,7 @@ private: VclPtr mpActionArea; VclPtr mpContentArea; - vcl::IDialogRenderable* mpDialogRenderable; // to emit LOK callbacks + vcl::IDialogNotifier* mpDialogNotifier; // to emit LOK callbacks SAL_DLLPRIVATE void ImplInitDialogData(); SAL_DLLPRIVATE void ImplInitSettings(); @@ -73,8 +73,10 @@ private: protected: using Window::ImplInit; SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle, InitFlag eFlag = InitFlag::Default ); - OUString maID; // Dialog ID (UNO name) for this dialog (set - // and used by LOK for now) + /// Dialog ID (UNO name) for this dialog + OUString maID; + /// Necessary to register dialog notifier instance to emit LOK callbacks + void registerDialogNotifier(vcl::IDialogNotifier* pDialogNotifier); public: SAL_DLLPRIVATE bool IsInClose() const { return mbInClose; } @@ -84,8 +86,6 @@ public: void CloseFloatingWindow(); Size PaintActiveFloatingWindow(VirtualDevice& rDevice) const; - /// Necessary to register dialog renderable instance to emit LOK callbacks - void registerDialogRenderable(vcl::IDialogRenderable* pDialogRenderable, const OUString& aDialogId); /// Paints the current dialog to the given virtual device void paintDialog(VirtualDevice& rDevice); void LogicMouseButtonDown(const MouseEvent& rMouseEvent); -- cgit