[Libreoffice-commits] core.git: include/LibreOfficeKit sc/source
Marco Cecchetti
marco.cecchetti at collabora.com
Tue Apr 3 19:40:45 UTC 2018
include/LibreOfficeKit/LibreOfficeKitEnums.h | 11 ++++++
sc/source/ui/inc/gridwin.hxx | 2 +
sc/source/ui/view/gridwin.cxx | 35 ++++++++++++++++++++-
sc/source/ui/view/gridwin4.cxx | 43 ---------------------------
4 files changed, 46 insertions(+), 45 deletions(-)
New commits:
commit 00d5cbf5f2a47c1614891c071b35f4a9e0b54354
Author: Marco Cecchetti <marco.cecchetti at collabora.com>
Date: Tue Apr 3 16:49:08 2018 +0200
lok - sc: validity list drop down button callback
Change-Id: Iaedc7f15147ea7f09e71877b592f932e3ecb37d5
Reviewed-on: https://gerrit.libreoffice.org/51596
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Marco Cecchetti <mrcekets at gmail.com>
diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h
index 020bbff90f20..300d91e1c8c4 100644
--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h
+++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h
@@ -570,6 +570,15 @@ typedef enum
LOK_CALLBACK_WINDOW = 36,
/**
+ * When for the current cell is defined a validity list we need to show
+ * a drop down button in the form of a marker.
+ *
+ * The payload format is: "x, y, visible" where x, y are the current
+ * cell cursor coordinates and visible is set to 0 or 1.
+ */
+ LOK_CALLBACK_VALIDITY_LIST_BUTTON = 37,
+
+ /**
* Notification that the clipboard contents have changed.
* Typically fired in response to copying to clipboard.
*
@@ -578,7 +587,7 @@ typedef enum
* in the future the contents might be included for
* convenience.
*/
- LOK_CALLBACK_CLIPBOARD_CHANGED = 37,
+ LOK_CALLBACK_CLIPBOARD_CHANGED = 38,
}
LibreOfficeKitCallbackType;
diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx
index 958dc7849691..1775114c27c8 100644
--- a/sc/source/ui/inc/gridwin.hxx
+++ b/sc/source/ui/inc/gridwin.hxx
@@ -447,6 +447,8 @@ public:
ScViewData* getViewData();
virtual FactoryFunction GetUITestFactory() const override;
+ void updateLOKValListButton(bool bVisible, const ScAddress& rPos) const;
+
protected:
void ImpCreateOverlayObjects();
void ImpDestroyOverlayObjects();
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 79c987e8942f..309ef81bb842 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -4571,6 +4571,16 @@ void ScGridWindow::UpdateAutoFillMark(bool bMarked, const ScRange& rMarkRange)
}
}
+void ScGridWindow::updateLOKValListButton( bool bVisible, const ScAddress& rPos ) const
+{
+ SCCOL nX = rPos.Col();
+ SCROW nY = rPos.Row();
+ std::stringstream ss;
+ ss << nX << ", " << nY << ", " << static_cast<unsigned int>(bVisible);
+ ScTabViewShell* pViewShell = pViewData->GetViewShell();
+ pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_VALIDITY_LIST_BUTTON, ss.str().c_str());
+}
+
void ScGridWindow::UpdateListValPos( bool bVisible, const ScAddress& rPos )
{
bool bOldButton = bListValButton;
@@ -4584,7 +4594,14 @@ void ScGridWindow::UpdateListValPos( bool bVisible, const ScAddress& rPos )
if ( !bOldButton || aListValPos != aOldPos )
{
// paint area of new button
- Invalidate( PixelToLogic( GetListValButtonRect( aListValPos ) ) );
+ if ( comphelper::LibreOfficeKit::isActive() )
+ {
+ updateLOKValListButton( true, aListValPos );
+ }
+ else
+ {
+ Invalidate( PixelToLogic( GetListValButtonRect( aListValPos ) ) );
+ }
}
}
if ( bOldButton )
@@ -4592,7 +4609,14 @@ void ScGridWindow::UpdateListValPos( bool bVisible, const ScAddress& rPos )
if ( !bListValButton || aListValPos != aOldPos )
{
// paint area of old button
- Invalidate( PixelToLogic( GetListValButtonRect( aOldPos ) ) );
+ if ( comphelper::LibreOfficeKit::isActive() )
+ {
+ updateLOKValListButton( false, aOldPos );
+ }
+ else
+ {
+ Invalidate( PixelToLogic( GetListValButtonRect( aOldPos ) ) );
+ }
}
}
}
@@ -5631,9 +5655,16 @@ void ScGridWindow::updateLibreOfficeKitCellCursor(const SfxViewShell* pOtherShel
if (pOtherShell)
{
if (pOtherShell == pViewShell)
+ {
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_CURSOR, aCursor.getStr());
+
+ if (bListValButton && aListValPos == pViewData->GetCurPos())
+ updateLOKValListButton(true, aListValPos);
+ }
else
+ {
SfxLokHelper::notifyOtherView(pViewShell, pOtherShell, LOK_CALLBACK_CELL_VIEW_CURSOR, "rectangle", aCursor);
+ }
}
else
{
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index a6e7b484045d..de4ff2c7e003 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -1525,8 +1525,6 @@ void ScGridWindow::DrawPagePreview( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2,
void ScGridWindow::DrawButtons(SCCOL nX1, SCCOL nX2, const ScTableInfo& rTabInfo, OutputDevice* pContentDev)
{
- bool bIsTiledRendering = comphelper::LibreOfficeKit::isActive();
-
aComboButton.SetOutputDevice( pContentDev );
ScDocument* pDoc = pViewData->GetDocument();
@@ -1661,7 +1659,7 @@ void ScGridWindow::DrawButtons(SCCOL nX1, SCCOL nX2, const ScTableInfo& rTabInfo
}
}
- if ( bListValButton && pRowInfo[nArrY].nRowNo == aListValPos.Row() && pRowInfo[nArrY].bChanged )
+ if ( !comphelper::LibreOfficeKit::isActive() && bListValButton && pRowInfo[nArrY].nRowNo == aListValPos.Row() && pRowInfo[nArrY].bChanged )
{
tools::Rectangle aRect = GetListValButtonRect( aListValPos );
aComboButton.SetPosPixel( aRect.TopLeft() );
@@ -1672,45 +1670,6 @@ void ScGridWindow::DrawButtons(SCCOL nX1, SCCOL nX2, const ScTableInfo& rTabInfo
aComboButton.SetPosPixel( aOldPos ); // restore old state
aComboButton.SetSizePixel( aOldSize ); // for MouseUp/Down (AutoFilter)
}
-
- if (bIsTiledRendering)
- {
- ScTabViewShell* pThisViewShell = pViewData->GetViewShell();
- SfxViewShell* pViewShell = SfxViewShell::GetFirst();
-
- while (pViewShell)
- {
- if (pViewShell != pThisViewShell)
- {
- ScTabViewShell* pTabViewShell = dynamic_cast<ScTabViewShell*>(pViewShell);
- if (pTabViewShell)
- {
- ScViewData& rOtherViewData = pTabViewShell->GetViewData();
- ScGridWindow* pOtherWin = rOtherViewData.GetActiveWin();
- if (pOtherWin)
- {
- bool bOtherListValButton = pOtherWin->bListValButton;
- ScAddress aOtherListValPos = pOtherWin->aListValPos;
-
- if ( bOtherListValButton && pRowInfo[nArrY].nRowNo == aOtherListValPos.Row() && pRowInfo[nArrY].bChanged )
- {
- tools::Rectangle aRect = GetListValButtonRect( aOtherListValPos );
- aComboButton.SetPosPixel( aRect.TopLeft() );
- aComboButton.SetSizePixel( aRect.GetSize() );
- pContentDev->SetClipRegion(vcl::Region(aRect));
- aComboButton.Draw();
- pContentDev->SetClipRegion(); // always called from Draw() without clip region
- aComboButton.SetPosPixel( aOldPos ); // restore old state
- aComboButton.SetSizePixel( aOldSize ); // for MouseUp/Down (AutoFilter)
- }
-
- }
- }
- }
-
- pViewShell = SfxViewShell::GetNext(*pViewShell);
- }
- }
}
pQueryParam.reset();
More information about the Libreoffice-commits
mailing list