summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
authorMarco Cecchetti <marco.cecchetti@collabora.com>2019-11-04 17:10:45 +0100
committerAndras Timar <andras.timar@collabora.com>2020-05-17 10:51:18 +0200
commit1f0943e5e9432f96daff9f3b006388d5bc7415b2 (patch)
treec665fbf1e3fdd235a52b2c5f4c908930e7417bc3 /sc/source
parent05c2deedba1926eceb7d18531152f81f72b5feab (diff)
lok: calc formula bar tunneling
Change-Id: I92026098222e04a163796225a048c6d7dc1b37c5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89857 Tested-by: Jenkins Reviewed-by: Marco Cecchetti <marco.cecchetti@collabora.com>
Diffstat (limited to 'sc/source')
-rw-r--r--sc/source/ui/app/inputhdl.cxx8
-rw-r--r--sc/source/ui/app/inputwin.cxx103
-rw-r--r--sc/source/ui/inc/inputwin.hxx4
-rw-r--r--sc/source/ui/view/tabvwshc.cxx11
4 files changed, 115 insertions, 11 deletions
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index c50ea4ad22e8..33975e24baf5 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -772,6 +772,12 @@ ScInputHandler::ScInputHandler()
pDelayTimer.reset( new Timer( "ScInputHandlerDelay timer" ) );
pDelayTimer->SetTimeout( 500 ); // 500 ms delay
pDelayTimer->SetInvokeHandler( LINK( this, ScInputHandler, DelayTimer ) );
+
+ if (comphelper::LibreOfficeKit::isActive())
+ {
+ ScInputHandler::bOptLoaded = true; // Evaluate App options
+ ScInputHandler::bAutoComplete = true; // Is set in KeyInput
+ }
}
ScInputHandler::~ScInputHandler()
@@ -3693,7 +3699,7 @@ void ScInputHandler::InputCommand( const CommandEvent& rCEvt )
{
if (pTableView)
pTableView->Command( rCEvt );
- if (pTopView)
+ if (pTopView && !comphelper::LibreOfficeKit::isActive())
pTopView->Command( rCEvt );
if ( rCEvt.GetCommand() == CommandEventId::EndExtTextInput )
diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index 7ead3b5df503..7b2c3fdfad43 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -165,6 +165,7 @@ ScInputWindow::ScInputWindow( vcl::Window* pParent, const SfxBindings* pBind ) :
pRuntimeWindow ( lcl_chooseRuntimeImpl( this, pBind ) ),
aTextWindow ( *pRuntimeWindow ),
pInputHdl ( nullptr ),
+ mpViewShell ( nullptr ),
mnMaxY (0),
bIsOkCancelMode ( false ),
bInResize ( false )
@@ -181,10 +182,15 @@ ScInputWindow::ScInputWindow( vcl::Window* pParent, const SfxBindings* pBind ) :
}
OSL_ENSURE( pViewSh, "no view shell for input window" );
+ mpViewShell = pViewSh;
+
// Position window, 3 buttons, input window
- InsertWindow (1, aWndPos.get(), ToolBoxItemBits::NONE, 0);
- InsertSeparator (1);
- InsertItem (SID_INPUT_FUNCTION, Image(StockImage::Yes, RID_BMP_INPUT_FUNCTION), ToolBoxItemBits::NONE, 2);
+ if (!comphelper::LibreOfficeKit::isActive())
+ {
+ InsertWindow (1, aWndPos.get(), ToolBoxItemBits::NONE, 0);
+ InsertSeparator (1);
+ InsertItem (SID_INPUT_FUNCTION, Image(StockImage::Yes, RID_BMP_INPUT_FUNCTION), ToolBoxItemBits::NONE, 2);
+ }
InsertItem (SID_INPUT_SUM, Image(StockImage::Yes, RID_BMP_INPUT_SUM), ToolBoxItemBits::DROPDOWNONLY, 3);
InsertItem (SID_INPUT_EQUAL, Image(StockImage::Yes, RID_BMP_INPUT_EQUAL), ToolBoxItemBits::NONE, 4);
InsertItem (SID_INPUT_CANCEL, Image(StockImage::Yes, RID_BMP_INPUT_CANCEL), ToolBoxItemBits::NONE, 5);
@@ -193,14 +199,20 @@ ScInputWindow::ScInputWindow( vcl::Window* pParent, const SfxBindings* pBind ) :
InsertWindow (7, &aTextWindow, ToolBoxItemBits::NONE, 8);
SetDropdownClickHdl( LINK( this, ScInputWindow, DropdownClickHdl ));
- aWndPos ->SetQuickHelpText(ScResId(SCSTR_QHELP_POSWND));
- aWndPos ->SetHelpId (HID_INSWIN_POS);
+ if (!comphelper::LibreOfficeKit::isActive())
+ {
+ aWndPos ->SetQuickHelpText(ScResId(SCSTR_QHELP_POSWND));
+ aWndPos ->SetHelpId (HID_INSWIN_POS);
+ }
aTextWindow.SetQuickHelpText(ScResId(SCSTR_QHELP_INPUTWND));
aTextWindow.SetHelpId (HID_INSWIN_INPUT);
- // No SetHelpText: the helptexts come from the Help
- SetItemText (SID_INPUT_FUNCTION, ScResId(SCSTR_QHELP_BTNCALC));
- SetHelpId (SID_INPUT_FUNCTION, HID_INSWIN_CALC);
+ if (!comphelper::LibreOfficeKit::isActive())
+ {
+ // No SetHelpText: the helptexts come from the Help
+ SetItemText (SID_INPUT_FUNCTION, ScResId(SCSTR_QHELP_BTNCALC));
+ SetHelpId (SID_INPUT_FUNCTION, HID_INSWIN_CALC);
+ }
SetItemText (SID_INPUT_SUM, ScResId( SCSTR_QHELP_BTNSUM ) );
SetHelpId (SID_INPUT_SUM, HID_INSWIN_SUMME);
@@ -222,7 +234,8 @@ ScInputWindow::ScInputWindow( vcl::Window* pParent, const SfxBindings* pBind ) :
SetHelpId( HID_SC_INPUTWIN ); // For the whole input row
- aWndPos ->Show();
+ if (!comphelper::LibreOfficeKit::isActive())
+ aWndPos ->Show();
aTextWindow.Show();
pInputHdl = SC_MOD()->GetInputHdl( pViewSh, false ); // use own handler even if ref-handler is set
@@ -285,6 +298,15 @@ void ScInputWindow::dispose()
}
}
+ if (comphelper::LibreOfficeKit::isActive())
+ {
+ if(const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier())
+ {
+ pNotifier->notifyWindow(GetLOKWindowId(), "close");
+ ReleaseLOKNotifier();
+ }
+ }
+
pRuntimeWindow.disposeAndClear();
aWndPos.disposeAndClear();
@@ -394,6 +416,9 @@ void ScInputWindow::Select()
void ScInputWindow::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect)
{
+ if (comphelper::LibreOfficeKit::isActive() && !comphelper::LibreOfficeKit::isDialogPainting())
+ return;
+
ToolBox::Paint(rRenderContext, rRect);
// draw a line at the bottom to distinguish that from the grid
@@ -404,6 +429,23 @@ void ScInputWindow::Paint(vcl::RenderContext& rRenderContext, const tools::Recta
Point(aSize.Width() - 1, aSize.Height() - 1));
}
+void ScInputWindow::PixelInvalidate(const tools::Rectangle* pRectangle)
+{
+ if (comphelper::LibreOfficeKit::isDialogPainting() || !comphelper::LibreOfficeKit::isActive())
+ return;
+
+ if (pRectangle)
+ {
+ const Point aPos(pRectangle->getX() - GetOutOffXPixel(), pRectangle->getY() - GetOutOffYPixel());
+ const tools::Rectangle aRect(aPos, pRectangle->GetSize());
+ Window::PixelInvalidate(&aRect);
+ }
+ else
+ {
+ Window::PixelInvalidate(nullptr);
+ }
+}
+
void ScInputWindow::Resize()
{
ToolBox::Resize();
@@ -426,9 +468,37 @@ void ScInputWindow::Resize()
}
}
SetSizePixel(aSize);
+
+ if (const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier())
+ {
+ std::vector<vcl::LOKPayloadItem> aItems;
+ aItems.emplace_back("size", GetSizePixel().toString());
+ pNotifier->notifyWindow(GetLOKWindowId(), "size_changed", aItems);
+ }
+
Invalidate();
}
+void ScInputWindow::NotifyLOKClient()
+{
+ if (comphelper::LibreOfficeKit::isActive() && !GetLOKNotifier() && mpViewShell)
+ SetLOKNotifier(mpViewShell);
+
+ if (const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier())
+ {
+ Size aSize = GetSizePixel();
+ if (aSize.Width() != 0 && aSize.Height() != 0)
+ {
+ std::vector<vcl::LOKPayloadItem> aItems;
+ aItems.emplace_back("type", "calc-input-win");
+ aItems.emplace_back(std::make_pair("position", Point(0, 0).toString()));
+ aItems.emplace_back(std::make_pair("size", aSize.toString()));
+ pNotifier->notifyWindow(GetLOKWindowId(), "created", aItems);
+ }
+
+ }
+}
+
void ScInputWindow::SetFuncString( const OUString& rString, bool bDoEdit )
{
//! new method at ScModule to query if function autopilot is open
@@ -1165,6 +1235,10 @@ IMPL_LINK_NOARG(ScTextWndGroup, Impl_ScrollHdl, ScrollBar*, void)
void ScTextWnd::Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect )
{
+ if (comphelper::LibreOfficeKit::isActive() && !comphelper::LibreOfficeKit::isDialogPainting())
+ return;
+
+ tools::Rectangle aRect = comphelper::LibreOfficeKit::isActive() ? this->PixelToLogic(rRect) : rRect;
EditView* pView = GetEditView();
if (pView)
{
@@ -1173,7 +1247,7 @@ void ScTextWnd::Paint( vcl::RenderContext& rRenderContext, const tools::Rectangl
pView->Invalidate();
mbInvalidate = false;
}
- mpEditView->Paint(rRect, &rRenderContext);
+ mpEditView->Paint(aRect, &rRenderContext);
}
}
@@ -1558,6 +1632,15 @@ void ScTextWnd::Command( const CommandEvent& rCEvt )
}
}
}
+ else if ( nCommand == CommandEventId::EndExtTextInput )
+ {
+ if (bFormulaMode)
+ {
+ ScInputHandler* pHdl = SC_MOD()->GetInputHdl();
+ if (pHdl)
+ pHdl->InputCommand(rCEvt);
+ }
+ }
else if ( nCommand == CommandEventId::CursorPos )
{
// don't call InputChanged for CommandEventId::CursorPos
diff --git a/sc/source/ui/inc/inputwin.hxx b/sc/source/ui/inc/inputwin.hxx
index a60d879cb091..34bb7e66d88e 100644
--- a/sc/source/ui/inc/inputwin.hxx
+++ b/sc/source/ui/inc/inputwin.hxx
@@ -257,6 +257,7 @@ public:
virtual void dispose() override;
virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
+ virtual void PixelInvalidate(const tools::Rectangle* pRectangle) override;
virtual void Resize() override;
virtual void Select() override;
@@ -294,6 +295,8 @@ public:
virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
virtual void MouseMove( const MouseEvent& rMEvt ) override;
+ void NotifyLOKClient();
+
DECL_LINK( MenuHdl, Menu *, bool );
DECL_LINK( DropdownClickHdl, ToolBox*, void );
@@ -304,6 +307,7 @@ private:
VclPtr<ScTextWndBase> pRuntimeWindow;
ScTextWndBase& aTextWindow;
ScInputHandler* pInputHdl;
+ ScTabViewShell* mpViewShell;
long mnMaxY;
bool bIsOkCancelMode;
bool bInResize;
diff --git a/sc/source/ui/view/tabvwshc.cxx b/sc/source/ui/view/tabvwshc.cxx
index b936e5553a0d..48474a468170 100644
--- a/sc/source/ui/view/tabvwshc.cxx
+++ b/sc/source/ui/view/tabvwshc.cxx
@@ -51,6 +51,7 @@
#include <xmlsourcedlg.hxx>
#include <condformatdlgitem.hxx>
#include <formdata.hxx>
+#include <inputwin.hxx>
#include <RandomNumberGeneratorDialog.hxx>
#include <SamplingDialog.hxx>
@@ -436,6 +437,16 @@ int ScTabViewShell::getPart() const
void ScTabViewShell::afterCallbackRegistered()
{
UpdateInputHandler(true, false);
+
+ ScInputHandler* pHdl = mpInputHandler ? mpInputHandler.get() : SC_MOD()->GetInputHdl();
+ if (pHdl)
+ {
+ ScInputWindow* pInputWindow = pHdl->GetInputWindow();
+ if (pInputWindow)
+ {
+ pInputWindow->NotifyLOKClient();
+ }
+ }
}
void ScTabViewShell::NotifyCursor(SfxViewShell* pOtherShell) const