Kaydet (Commit) b780822f authored tarafından Miklos Vajna's avatar Miklos Vajna

Introduce SdXImpressDocument::postMouseEvent() override

It's far from perfect, but the following use-case works:

- open an empty document with a singe slide (only two placeholder
  shapes)
- type a few characters (into the title shape), Esc to finish editing
- click into the non-title placeholder
- type + Esc -> characters appear in the non-title shape

Change-Id: Idc97c1fbeda0fb3ac53769e78b7cd665d8aee67b
üst 845708fc
......@@ -443,6 +443,11 @@ public:
SdPage* pPage,
const sal_Int32 nInsertPosition = -1);
/// Same as MouseButtonDown(), but coordinates are in logic unit.
void LogicMouseButtonDown(const MouseEvent& rMouseEvent);
/// Same as MouseButtonUp(), but coordinates are in logic unit.
void LogicMouseButtonUp(const MouseEvent& rMouseEvent);
class Implementation;
protected:
......
......@@ -244,6 +244,8 @@ public:
virtual void initializeForTiledRendering() SAL_OVERRIDE;
/// @see vcl::ITiledRenderable::registerCallback().
virtual void registerCallback(LibreOfficeKitCallback pCallback, void* pData) SAL_OVERRIDE;
/// @see vcl::ITiledRenderable::postMouseEvent().
virtual void postMouseEvent(int nType, int nX, int nY, int nCount) SAL_OVERRIDE;
// XComponent
......
......@@ -2362,6 +2362,30 @@ void SdXImpressDocument::registerCallback(LibreOfficeKitCallback pCallback, void
mpDoc->registerLibreOfficeKitCallback(pCallback, pData);
}
void SdXImpressDocument::postMouseEvent(int nType, int nX, int nY, int nCount)
{
SolarMutexGuard aGuard;
DrawViewShell* pViewShell = GetViewShell();
if (!pViewShell)
return;
MouseEvent aEvent(Point(convertTwipToMm100(nX), convertTwipToMm100(nY)), nCount, MouseEventModifiers::SIMPLECLICK, MOUSE_LEFT);
switch (nType)
{
case LOK_MOUSEEVENT_MOUSEBUTTONDOWN:
pViewShell->LogicMouseButtonDown(aEvent);
break;
case LOK_MOUSEEVENT_MOUSEBUTTONUP:
pViewShell->LogicMouseButtonUp(aEvent);
break;
default:
assert(false);
break;
}
}
uno::Reference< i18n::XForbiddenCharacters > SdXImpressDocument::getForbiddenCharsTable()
{
uno::Reference< i18n::XForbiddenCharacters > xForb(mxForbidenCharacters);
......
......@@ -502,6 +502,38 @@ void ViewShell::MouseButtonDown(const MouseEvent& rMEvt, ::sd::Window* pWin)
}
}
void ViewShell::LogicMouseButtonDown(const MouseEvent& rMouseEvent)
{
// When we're not doing tiled rendering, then positions must be passed as pixels.
assert(GetDoc()->isTiledRendering());
bool bMap = mpActiveWindow->IsMapModeEnabled();
mpActiveWindow->EnableMapMode(false);
Point aPoint = mpActiveWindow->GetPointerPosPixel();
mpActiveWindow->SetPointerPosPixel(rMouseEvent.GetPosPixel());
MouseButtonDown(rMouseEvent, 0);
mpActiveWindow->SetPointerPosPixel(aPoint);
mpActiveWindow->EnableMapMode(bMap);
}
void ViewShell::LogicMouseButtonUp(const MouseEvent& rMouseEvent)
{
// When we're not doing tiled rendering, then positions must be passed as pixels.
assert(GetDoc()->isTiledRendering());
bool bMap = mpActiveWindow->IsMapModeEnabled();
mpActiveWindow->EnableMapMode(false);
Point aPoint = mpActiveWindow->GetPointerPosPixel();
mpActiveWindow->SetPointerPosPixel(rMouseEvent.GetPosPixel());
MouseButtonUp(rMouseEvent, 0);
mpActiveWindow->SetPointerPosPixel(aPoint);
mpActiveWindow->EnableMapMode(bMap);
}
void ViewShell::MouseMove(const MouseEvent& rMEvt, ::sd::Window* pWin)
{
if (rMEvt.IsLeaveWindow())
......
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