summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorPranav Kant <pranavk@collabora.co.uk>2017-08-03 14:42:55 +0530
committerPranav Kant <pranavk@collabora.co.uk>2017-10-02 11:01:18 +0530
commit9cdaccc0cc5664ffb22035f65135b6be876de92f (patch)
treedb1a7c5ff2d08c90c3cb0c6ae94ff870783b49e5 /vcl
parent44737be728c1d1afa23631e7576569ddf2d3016c (diff)
lokdialog: Support for rendering floating window dialog widgets
Now gtktiledviewer can show floating window dialog widgets when user clicks any of such widget in the dialog. Change-Id: I13d756f236379bc8b2041ed41cb7b502f7fd9b24
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/window/dialog.cxx41
-rw-r--r--vcl/source/window/floatwin.cxx20
2 files changed, 55 insertions, 6 deletions
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index e5d784e4f667..29400ca55982 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -883,10 +883,49 @@ void Dialog::paintDialog(VirtualDevice& rDevice)
PaintToDevice(&rDevice, Point(0, 0), Size());
}
-void Dialog::LogicInvalidate(const tools::Rectangle* /*pRectangle*/)
+Size Dialog::PaintActiveFloatingWindow(VirtualDevice& rDevice)
+{
+ Size aRet;
+ ImplSVData* pSVData = ImplGetSVData();
+ FloatingWindow* pFirstFloat = pSVData->maWinData.mpFirstFloat;
+ if (pFirstFloat)
+ {
+ // TODO:: run a while loop here and check all the active floating
+ // windows ( chained together, cf. pFirstFloat->mpNextFloat )
+ // For now just assume that the active floating window is the one we
+ // want to render
+ if (pFirstFloat->GetParentDialog() == this)
+ {
+ pFirstFloat->PaintToDevice(&rDevice, Point(0, 0), Size());
+ aRet = ::isLayoutEnabled(pFirstFloat) ? pFirstFloat->get_preferred_size() : pFirstFloat->GetSizePixel();
+ }
+
+ pFirstFloat = nullptr;
+ }
+
+ return aRet;
+}
+
+void Dialog::InvalidateFloatingWindow(const Point& rPos)
{
if (comphelper::LibreOfficeKit::isActive() && mpDialogRenderable && !maID.isEmpty())
{
+ mpDialogRenderable->notifyDialogChild(maID, "invalidate", rPos);
+ }
+}
+
+void Dialog::CloseFloatingWindow()
+{
+ if (comphelper::LibreOfficeKit::isActive() && mpDialogRenderable && !maID.isEmpty())
+ {
+ mpDialogRenderable->notifyDialogChild(maID, "close", Point(0, 0));
+ }
+}
+
+void Dialog::LogicInvalidate(const tools::Rectangle* /*pRectangle*/)
+{
+ if (!comphelper::LibreOfficeKit::isDialogPainting() && mpDialogRenderable && !maID.isEmpty())
+ {
mpDialogRenderable->notifyDialogInvalidation(maID);
}
}
diff --git a/vcl/source/window/floatwin.cxx b/vcl/source/window/floatwin.cxx
index 23e56ce6e669..16bcb721a612 100644
--- a/vcl/source/window/floatwin.cxx
+++ b/vcl/source/window/floatwin.cxx
@@ -38,6 +38,7 @@ public:
VclPtr<ToolBox> mpBox;
tools::Rectangle maItemEdgeClipRect; // used to clip the common edge between a toolbar item and the border of this window
+ Point maPos; // position of the floating window wrt. parent
};
FloatingWindow::ImplData::ImplData()
@@ -592,6 +593,15 @@ void FloatingWindow::StateChanged( StateChangedType nType )
}
SystemWindow::StateChanged( nType );
+ Dialog* pParentDlg = GetParentDialog();
+ if (pParentDlg && nType == StateChangedType::InitShow && IsVisible())
+ {
+ pParentDlg->InvalidateFloatingWindow(mpImplData->maPos);
+ }
+ else if (pParentDlg && !IsVisible())
+ {
+ pParentDlg->CloseFloatingWindow();
+ }
if ( nType == StateChangedType::ControlBackground )
{
@@ -667,8 +677,8 @@ void FloatingWindow::StartPopupMode( const tools::Rectangle& rRect, FloatWinPopu
// compute window position according to flags and arrangement
sal_uInt16 nArrangeIndex;
- Point aPos = ImplCalcPos( this, rRect, nFlags, nArrangeIndex );
- SetPosPixel( aPos );
+ mpImplData->maPos = ImplCalcPos( this, rRect, nFlags, nArrangeIndex );
+ SetPosPixel( mpImplData->maPos );
// set data and display window
// convert maFloatRect to absolute device coordinates
@@ -714,10 +724,10 @@ void FloatingWindow::StartPopupMode( ToolBox* pBox, FloatWinPopupFlags nFlags )
// retrieve some data from the ToolBox
tools::Rectangle aRect = nItemId ? pBox->GetItemRect( nItemId ) : pBox->GetOverflowRect();
- Point aPos;
+
// convert to parent's screen coordinates
- aPos = GetParent()->OutputToScreenPixel( GetParent()->AbsoluteScreenToOutputPixel( pBox->OutputToAbsoluteScreenPixel( aRect.TopLeft() ) ) );
- aRect.SetPos( aPos );
+ mpImplData->maPos = GetParent()->OutputToScreenPixel( GetParent()->AbsoluteScreenToOutputPixel( pBox->OutputToAbsoluteScreenPixel( aRect.TopLeft() ) ) );
+ aRect.SetPos( mpImplData->maPos );
nFlags |=
FloatWinPopupFlags::AllMouseButtonClose |