Kaydet (Commit) d43ffd30 authored tarafından Pranav Kant's avatar Pranav Kant

lokdialog: Handle key events in core

Change-Id: If84aaac87beebf69d92db5446fc713d8cc20421e
üst 522a9c0a
...@@ -84,6 +84,9 @@ public: ...@@ -84,6 +84,9 @@ public:
void LogicMouseButtonUp(const MouseEvent& rMouseEvent); void LogicMouseButtonUp(const MouseEvent& rMouseEvent);
void LogicMouseMove(const MouseEvent& rMouseEvent); void LogicMouseMove(const MouseEvent& rMouseEvent);
void LOKKeyInput(const KeyEvent& rKeyEvent);
void LOKKeyUp(const KeyEvent& rKeyEvent);
protected: protected:
explicit Dialog( WindowType nType ); explicit Dialog( WindowType nType );
explicit Dialog( vcl::Window* pParent, const OUString& rID, const OUString& rUIXMLDescription, WindowType nType, InitFlag eFlag = InitFlag::Default ); explicit Dialog( vcl::Window* pParent, const OUString& rID, const OUString& rUIXMLDescription, WindowType nType, InitFlag eFlag = InitFlag::Default );
......
...@@ -3667,9 +3667,38 @@ void SwXTextDocument::paintDialog(const vcl::DialogID& rDialogID, VirtualDevice& ...@@ -3667,9 +3667,38 @@ void SwXTextDocument::paintDialog(const vcl::DialogID& rDialogID, VirtualDevice&
nHeight = aSize.getHeight(); nHeight = aSize.getHeight();
} }
void SwXTextDocument::postDialogKeyEvent(const vcl::DialogID& /*rDialogID*/, int /*nType*/, int /*nCharCode*/, int /*nKeyCode*/) void SwXTextDocument::postDialogKeyEvent(const vcl::DialogID& rDialogID, int nType, int nCharCode, int nKeyCode)
{ {
SolarMutexGuard aGuard;
// check if dialog is already open
SfxViewFrame* pViewFrame = pDocShell->GetView()->GetViewFrame();
SfxSlotPool* pSlotPool = SW_MOD()->GetSlotPool();
const SfxSlot* pSlot = pSlotPool->GetUnoSlot(rDialogID);
if (!pSlot)
{
SAL_WARN("lok.dialog", "No slot found for " << rDialogID);
return;
}
SfxChildWindow* pChild = pViewFrame->GetChildWindow(pSlot->GetSlotId());
if (pChild)
{
Dialog* pDialog = static_cast<Dialog*>(pChild->GetWindow());
KeyEvent aEvent(nCharCode, nKeyCode, 0);
switch (nType)
{
case LOK_KEYEVENT_KEYINPUT:
pDialog->LOKKeyInput(aEvent);
break;
case LOK_KEYEVENT_KEYUP:
pDialog->LOKKeyUp(aEvent);
break;
default:
assert(false);
break;
}
}
} }
void SwXTextDocument::postDialogMouseEvent(const vcl::DialogID& rDialogID, int nType, int nX, int nY, void SwXTextDocument::postDialogMouseEvent(const vcl::DialogID& rDialogID, int nType, int nX, int nY,
......
...@@ -898,6 +898,20 @@ void Dialog::LogicMouseMove(const MouseEvent& rMouseEvent) ...@@ -898,6 +898,20 @@ void Dialog::LogicMouseMove(const MouseEvent& rMouseEvent)
ImplWindowFrameProc(this, SalEvent::ExternalMouseMove, &rMouseEvent); ImplWindowFrameProc(this, SalEvent::ExternalMouseMove, &rMouseEvent);
} }
void Dialog::LOKKeyInput(const KeyEvent& rKeyEvent)
{
assert(comphelper::LibreOfficeKit::isActive());
ImplWindowFrameProc(this, SalEvent::ExternalKeyInput, &rKeyEvent);
}
void Dialog::LOKKeyUp(const KeyEvent& rKeyEvent)
{
assert(comphelper::LibreOfficeKit::isActive());
ImplWindowFrameProc(this, SalEvent::ExternalKeyUp, &rKeyEvent);
}
void Dialog::ensureRepaint() void Dialog::ensureRepaint()
{ {
// ensure repaint // ensure repaint
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment