summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorMarco Cecchetti <marco.cecchetti@collabora.com>2019-11-04 17:10:45 +0100
committerMarco Cecchetti <marco.cecchetti@collabora.com>2020-03-06 10:40:29 +0100
commit366e328dc7f36061971c549c2d33d365026b65ca (patch)
tree25e3ea350dd73f5e68a9f83cdd5a191c1f9220b9 /sc
parent8ae1c4b6408d6601d73fa7b688b52e1f01513e4f (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')
-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 46321002fbf1..076acd2f06de 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -775,6 +775,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()
@@ -3793,7 +3799,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 cbbc8b2d0cf1..6a3fbb89f92d 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -168,6 +168,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 )
@@ -184,10 +185,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);
@@ -199,14 +205,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);
@@ -228,7 +240,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
@@ -291,6 +304,15 @@ void ScInputWindow::dispose()
}
}
+ if (comphelper::LibreOfficeKit::isActive())
+ {
+ if(const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier())
+ {
+ pNotifier->notifyWindow(GetLOKWindowId(), "close");
+ ReleaseLOKNotifier();
+ }
+ }
+
pRuntimeWindow.disposeAndClear();
aWndPos.disposeAndClear();
@@ -400,6 +422,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);
if (!comphelper::LibreOfficeKit::isActive())
@@ -413,6 +438,23 @@ void ScInputWindow::Paint(vcl::RenderContext& rRenderContext, const tools::Recta
}
}
+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();
@@ -435,9 +477,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
@@ -1177,6 +1247,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)
{
@@ -1185,7 +1259,7 @@ void ScTextWnd::Paint( vcl::RenderContext& rRenderContext, const tools::Rectangl
pView->Invalidate();
mbInvalidate = false;
}
- mpEditView->Paint(rRect, &rRenderContext);
+ mpEditView->Paint(aRect, &rRenderContext);
}
}
@@ -1570,6 +1644,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 71d1efcca17a..538adc9b0af4 100644
--- a/sc/source/ui/inc/inputwin.hxx
+++ b/sc/source/ui/inc/inputwin.hxx
@@ -264,6 +264,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;
@@ -301,6 +302,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 );
@@ -311,6 +314,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 b9ba63505887..b8fb79fcd69e 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