[Libreoffice-commits] core.git: Branch 'feature/lok_dialog2' - include/vcl vcl/source
Pranav Kant
pranavk at collabora.co.uk
Fri Dec 1 11:27:19 UTC 2017
include/vcl/window.hxx | 2 --
vcl/source/control/ctrl.cxx | 22 ++++++----------------
vcl/source/window/floatwin.cxx | 14 ++------------
vcl/source/window/window.cxx | 25 ++++++++-----------------
4 files changed, 16 insertions(+), 47 deletions(-)
New commits:
commit 9047e50b701af33d61ec51730c388cc7a6cdb8df
Author: Pranav Kant <pranavk at collabora.co.uk>
Date: Fri Dec 1 16:42:12 2017 +0530
fixup! lokdialog: Simplify; make the LOK dialog API more generic
Change-Id: I62078d2a060015dce0b3b275783ff65143bd1c81
diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx
index 644d9c16e37e..41040263a76f 100644
--- a/include/vcl/window.hxx
+++ b/include/vcl/window.hxx
@@ -1207,8 +1207,6 @@ public:
void SetComponentInterface( css::uno::Reference< css::awt::XWindowPeer > const & xIFace );
/// Interface to register for dialog / window tunneling.
- void LOKRegisterWindow();
- void LOKUnregisterWindow();
void SetLOKNotifier(const vcl::ILibreOfficeKitNotifier* pNotifier);
const vcl::ILibreOfficeKitNotifier* GetLOKNotifier() const;
vcl::LOKWindowId GetLOKWindowId() const;
diff --git a/vcl/source/control/ctrl.cxx b/vcl/source/control/ctrl.cxx
index 977003a14d16..37dc3dcdad8a 100644
--- a/vcl/source/control/ctrl.cxx
+++ b/vcl/source/control/ctrl.cxx
@@ -421,25 +421,15 @@ void Control::LogicInvalidate(const tools::Rectangle* /*pRectangle*/)
// ignore all of those
if (comphelper::LibreOfficeKit::isActive() && !comphelper::LibreOfficeKit::isDialogPainting())
{
- // If parent is a floating window, trigger an invalidate there
- vcl::Window* pWindow = this;
- while (pWindow)
+ if (vcl::Window* pParent = GetParentWithLOKNotifier())
{
- if (pWindow->ImplIsFloatingWindow() && pWindow->GetLOKWindowId())
- {
- static_cast<FloatingWindow*>(pWindow)->LogicInvalidate(nullptr);
- return;
- }
+ // invalidate the complete floating window for now
+ if (pParent->ImplIsFloatingWindow())
+ return pParent->LogicInvalidate(nullptr);
- pWindow = pWindow->GetParent();
+ const tools::Rectangle aRect(Point(GetOutOffXPixel(), GetOutOffYPixel()), Size(GetOutputWidthPixel(), GetOutputHeightPixel()));
+ pParent->LogicInvalidate(&aRect);
}
-
- // otherwise, for now, just invalidate the whole dialog
- Dialog* pParentDlg = GetParentDialog();
-
- const tools::Rectangle aRect(Point(GetOutOffXPixel(), GetOutOffYPixel()), Size(GetOutputWidthPixel(), GetOutputHeightPixel()));
- if (pParentDlg)
- pParentDlg->LogicInvalidate(&aRect);
}
}
diff --git a/vcl/source/window/floatwin.cxx b/vcl/source/window/floatwin.cxx
index 8e0a0e426306..57021be2f8cd 100644
--- a/vcl/source/window/floatwin.cxx
+++ b/vcl/source/window/floatwin.cxx
@@ -590,9 +590,6 @@ void FloatingWindow::LogicInvalidate(const tools::Rectangle* /*pRectangle*/)
if (vcl::Window* pParent = GetParentWithLOKNotifier())
{
const vcl::ILibreOfficeKitNotifier* pNotifier = pParent->GetLOKNotifier();
- // if we haven't yet created a LOK window id yet for ourself, we are
- // doing soemthing wrong
- assert(GetLOKWindowId());
pNotifier->notifyWindow(GetLOKWindowId(), "invalidate");
}
}
@@ -611,7 +608,7 @@ void FloatingWindow::StateChanged( StateChangedType nType )
const vcl::ILibreOfficeKitNotifier* pNotifier = pParent->GetLOKNotifier();
if (nType == StateChangedType::InitShow && IsVisible())
{
- LOKRegisterWindow();
+ SetLOKNotifier(pNotifier);
std::vector<vcl::LOKPayloadItem> aItems;
aItems.emplace_back(std::make_pair("type", "child"));
@@ -623,7 +620,7 @@ void FloatingWindow::StateChanged( StateChangedType nType )
else if (!IsVisible())
{
pNotifier->notifyWindow(GetLOKWindowId(), "close");
- LOKUnregisterWindow();
+ ReleaseLOKNotifier();
}
}
@@ -735,13 +732,6 @@ void FloatingWindow::StartPopupMode( const tools::Rectangle& rRect, FloatWinPopu
GrabFocus();
}
Show( true, ShowFlags::NoActivate );
-
- if (const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier())
- {
- std::vector<vcl::LOKPayloadItem> aItems;
- aItems.emplace_back(std::make_pair("size", rRect.GetSize().toString()));
- pNotifier->notifyWindow(GetLOKWindowId(), "created", aItems);
- }
}
void FloatingWindow::StartPopupMode( ToolBox* pBox, FloatWinPopupFlags nFlags )
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index aa26519288d2..615b44dc3102 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -3174,22 +3174,16 @@ void Window::SetComponentInterface( Reference< css::awt::XWindowPeer > const & x
pWrapper->SetWindowInterface( this, xIFace );
}
-void Window::LOKRegisterWindow()
-{
- // assign the LOK window id
- assert(mpWindowImpl->mnLOKWindowId == 0);
-
- mpWindowImpl->mnLOKWindowId = sLastLOKWindowId++;
- sLOKWindows.insert(std::map<vcl::LOKWindowId, VclPtr<vcl::Window>>::value_type(mpWindowImpl->mnLOKWindowId, this));
-}
-
void Window::SetLOKNotifier(const vcl::ILibreOfficeKitNotifier* pNotifier)
{
// don't allow setting this twice
assert(mpWindowImpl->mpLOKNotifier == nullptr);
assert(pNotifier);
- LOKRegisterWindow();
+ // assign the LOK window id
+ assert(mpWindowImpl->mnLOKWindowId == 0);
+ mpWindowImpl->mnLOKWindowId = sLastLOKWindowId++;
+ sLOKWindows.insert(std::map<vcl::LOKWindowId, VclPtr<vcl::Window>>::value_type(mpWindowImpl->mnLOKWindowId, this));
mpWindowImpl->mpLOKNotifier = pNotifier;
}
@@ -3203,19 +3197,14 @@ VclPtr<Window> Window::FindLOKWindow(vcl::LOKWindowId nWindowId)
return VclPtr<Window>();
}
-void Window::LOKUnregisterWindow()
+void Window::ReleaseLOKNotifier()
{
// unregister the LOK window binding
if (mpWindowImpl->mnLOKWindowId > 0)
sLOKWindows.erase(mpWindowImpl->mnLOKWindowId);
- mpWindowImpl->mnLOKWindowId = 0;
-}
-
-void Window::ReleaseLOKNotifier()
-{
- LOKUnregisterWindow();
mpWindowImpl->mpLOKNotifier = nullptr;
+ mpWindowImpl->mnLOKWindowId = 0;
}
const vcl::ILibreOfficeKitNotifier* Window::GetLOKNotifier() const
@@ -3225,6 +3214,8 @@ const vcl::ILibreOfficeKitNotifier* Window::GetLOKNotifier() const
vcl::LOKWindowId Window::GetLOKWindowId() const
{
+ assert(mpWindowImpl->mnLOKWindowId > 0);
+
return mpWindowImpl->mnLOKWindowId;
}
More information about the Libreoffice-commits
mailing list