diff options
Diffstat (limited to 'sc/source/ui/app/inputwin.cxx')
-rw-r--r-- | sc/source/ui/app/inputwin.cxx | 103 |
1 files changed, 93 insertions, 10 deletions
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 |