desktop/qa/desktop_lib/test_desktop_lib.cxx | 3 desktop/source/lib/init.cxx | 45 +++++++ include/LibreOfficeKit/LibreOfficeKit.h | 9 + include/LibreOfficeKit/LibreOfficeKit.hxx | 16 ++ include/vcl/GestureEvent.hxx | 42 ++++++ include/vcl/commandevent.hxx | 25 +++ include/vcl/svapp.hxx | 3 include/vcl/vclevent.hxx | 1 vcl/inc/salwtype.hxx | 14 ++ vcl/inc/widgetdraw/WidgetDefinition.hxx | 66 ++++------ vcl/inc/window.h | 1 vcl/qa/cppunit/widgetdraw/WidgetDefinitionReaderTest.cxx | 13 +- vcl/qa/cppunit/widgetdraw/data/definition1.xml | 8 - vcl/source/app/svapp.cxx | 68 +++++++++- vcl/source/control/imp_listbox.cxx | 4 vcl/source/gdi/FileDefinitionWidgetDraw.cxx | 96 ++++++--------- vcl/source/gdi/WidgetDefinition.cxx | 31 +--- vcl/source/gdi/WidgetDefinitionReader.cxx | 25 --- vcl/source/window/commandevent.cxx | 9 + vcl/source/window/window.cxx | 1 vcl/source/window/window2.cxx | 20 +++ vcl/source/window/winproc.cxx | 44 ++++++ 22 files changed, 382 insertions(+), 162 deletions(-)
New commits: commit 5526b0c6776aeb4362b76aa8d0ffd19149f8cd3e Author: Tomaž Vajngerl <[email protected]> AuthorDate: Tue Mar 26 21:46:34 2019 +0900 Commit: Tomaž Vajngerl <[email protected]> CommitDate: Wed Mar 27 11:33:53 2019 +0900 fix build against master Change-Id: I7ccdbc690d556ecf60ba3a98f67d5de2b0fbf434 diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index 5376e2991401..64fc7c40b7d1 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -898,8 +898,8 @@ ImplSVEvent* Application::PostGestureEvent(VclEventId nEvent, vcl::Window* pWin, { Point aTransformedPosition(pGestureEvent->mnX, pGestureEvent->mnY); - aTransformedPosition.AdjustX(pWin->GetOutOffXPixel()); - aTransformedPosition.AdjustY(pWin->GetOutOffYPixel()); + aTransformedPosition.MoveX(pWin->GetOutOffXPixel()); + aTransformedPosition.MoveY(pWin->GetOutOffYPixel()); const GestureEvent aGestureEvent{ sal_Int32(aTransformedPosition.X()), commit 00151d9a31446f5e9b529cacb5bd0e0c469df32e Author: Tomaž Vajngerl <[email protected]> AuthorDate: Mon Mar 25 18:23:36 2019 +0900 Commit: Tomaž Vajngerl <[email protected]> CommitDate: Wed Mar 27 11:33:53 2019 +0900 tdf#124146 support posting of gesture event for LOKit Reviewed-on: https://gerrit.libreoffice.org/69657 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <[email protected]> (cherry picked from commit 4a68361d578fe3bf313f80d8e186079bd34b2300) Change-Id: I51845f2e41dbcbe1ae6cb0a18cf9f42d5549968b diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 3bf935275025..691a82bcc4cb 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -2667,9 +2667,10 @@ void DesktopLOKTest::testABI() CPPUNIT_ASSERT_EQUAL(documentClassOffset(45), offsetof(struct _LibreOfficeKitDocumentClass, getSignatureState)); CPPUNIT_ASSERT_EQUAL(documentClassOffset(46), offsetof(struct _LibreOfficeKitDocumentClass, renderShapeSelection)); CPPUNIT_ASSERT_EQUAL(documentClassOffset(47), offsetof(struct _LibreOfficeKitDocumentClass, createViewWithOptions)); + CPPUNIT_ASSERT_EQUAL(documentClassOffset(48), offsetof(struct _LibreOfficeKitDocumentClass, postWindowGestureEvent)); // Extending is fine, update this, and add new assert for the offsetof the // new method - CPPUNIT_ASSERT_EQUAL(documentClassOffset(48), sizeof(struct _LibreOfficeKitDocumentClass)); + CPPUNIT_ASSERT_EQUAL(documentClassOffset(49), sizeof(struct _LibreOfficeKitDocumentClass)); } CPPUNIT_TEST_SUITE_REGISTRATION(DesktopLOKTest); diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index ee34831af726..1d21b994289d 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -103,6 +103,7 @@ #include <svx/svxids.hrc> #include <svx/ucsubset.hxx> #include <vcl/vclevent.hxx> +#include <vcl/GestureEvent.hxx> #include <vcl/svapp.hxx> #include <unotools/resmgr.hxx> #include <tools/fract.hxx> @@ -740,6 +741,12 @@ static void doc_postWindowMouseEvent (LibreOfficeKitDocument* pThis, int nCount, int nButtons, int nModifier); +static void doc_postWindowGestureEvent(LibreOfficeKitDocument* pThis, + unsigned nLOKWindowId, + const char* pType, + int nX, + int nY, + int nOffset); static void doc_postUnoCommand(LibreOfficeKitDocument* pThis, const char* pCommand, const char* pArguments, @@ -873,6 +880,7 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference <css::lang::XCompone m_pDocumentClass->getSignatureState = doc_getSignatureState; m_pDocumentClass->renderShapeSelection = doc_renderShapeSelection; + m_pDocumentClass->postWindowGestureEvent = doc_postWindowGestureEvent; m_pDocumentClass->createViewWithOptions = doc_createViewWithOptions; @@ -3053,6 +3061,43 @@ static void doc_postWindowMouseEvent(LibreOfficeKitDocument* /*pThis*/, unsigned } } +static void doc_postWindowGestureEvent(LibreOfficeKitDocument* /*pThis*/, unsigned nLOKWindowId, const char* pType, int nX, int nY, int nOffset) +{ + SolarMutexGuard aGuard; + if (gImpl) + gImpl->maLastExceptionMsg.clear(); + + VclPtr<Window> pWindow = vcl::Window::FindLOKWindow(nLOKWindowId); + if (!pWindow) + { + gImpl->maLastExceptionMsg = "Document doesn't support dialog rendering, or window not found."; + return; + } + + OString aType(pType); + GestureEventType eEventType = GestureEventType::PanningUpdate; + + if (aType == "panBegin") + eEventType = GestureEventType::PanningBegin; + else if (aType == "panEnd") + eEventType = GestureEventType::PanningEnd; + + GestureEvent aEvent { + sal_Int32(nX), + sal_Int32(nY), + eEventType, + sal_Int32(nOffset), + PanningOrientation::Vertical, + }; + + if (Dialog* pDialog = dynamic_cast<Dialog*>(pWindow.get())) + { + pDialog->EnableInput(); + } + + Application::PostGestureEvent(VclEventId::WindowGestureEvent, pWindow, &aEvent); +} + static void doc_setTextSelection(LibreOfficeKitDocument* pThis, int nType, int nX, int nY) { SolarMutexGuard aGuard; diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h index 0939cb661410..8a044b337e6d 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.h +++ b/include/LibreOfficeKit/LibreOfficeKit.h @@ -344,6 +344,7 @@ struct _LibreOfficeKitDocumentClass /// @see lok::Document::getSignatureState(). int (*getSignatureState) (LibreOfficeKitDocument* pThis); +// END CERTIFICATE AND SIGNING /// @see lok::Document::renderShapeSelection size_t (*renderShapeSelection)(LibreOfficeKitDocument* pThis, char** pOutput); @@ -351,6 +352,14 @@ struct _LibreOfficeKitDocumentClass /// @see lok::Document::createViewWithOptions(). int (*createViewWithOptions) (LibreOfficeKitDocument* pThis, const char* pOptions); + /// @see lok::Document::postWindowGestureEvent(). + void (*postWindowGestureEvent) (LibreOfficeKitDocument* pThis, + unsigned nWindowId, + const char* pType, + int nX, + int nY, + int nOffset); + #endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY }; diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx index 0440e8bae2f6..b2e3a57fa3c2 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.hxx +++ b/include/LibreOfficeKit/LibreOfficeKit.hxx @@ -605,6 +605,22 @@ public: return mpDoc->pClass->renderShapeSelection(mpDoc, pOutput); } + /** + * Posts a gesture event to the window with given id. + * + * @param nWindowId + * @param pType Event type, like panStart, panEnd, panUpdate. + * @param nX horizontal position in document coordinates + * @param nY vertical position in document coordinates + * @param nOffset difference value from when the gesture started to current value + */ + void postWindowGestureEvent(unsigned nWindowId, + const char* pType, + int nX, int nY, int nOffset) + { + return mpDoc->pClass->postWindowGestureEvent(mpDoc, nWindowId, pType, nX, nY, nOffset); + } + #endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY }; commit 92801ccc4958d103e5fa336bc6169a99d4393dba Author: Tomaž Vajngerl <[email protected]> AuthorDate: Mon Mar 25 18:10:26 2019 +0900 Commit: Tomaž Vajngerl <[email protected]> CommitDate: Wed Mar 27 11:33:53 2019 +0900 tdf#124146 Support panning (pan gesture) of the combobox list Change-Id: Ic57f4b784d96e69c71caa0e47dbe8117b019a712 Reviewed-on: https://gerrit.libreoffice.org/69656 Reviewed-by: Tomaž Vajngerl <[email protected]> Tested-by: Tomaž Vajngerl <[email protected]> (cherry picked from commit 2ccc0a9e24e3f02bfce39af922b5a4972baa2968) diff --git a/vcl/inc/window.h b/vcl/inc/window.h index 9c00d0adefc0..c15ee415ef93 100644 --- a/vcl/inc/window.h +++ b/vcl/inc/window.h @@ -153,6 +153,7 @@ struct ImplFrameData bool mbInSysObjFocusHdl; //< within a SysChildren's GetFocus handler bool mbInSysObjToTopHdl; //< within a SysChildren's ToTop handler bool mbSysObjFocus; //< does a SysChild have focus + sal_Int32 mnTouchPanPosition; css::uno::Reference< css::datatransfer::dnd::XDragSource > mxDragSource; css::uno::Reference< css::datatransfer::dnd::XDropTarget > mxDropTarget; diff --git a/vcl/source/control/imp_listbox.cxx b/vcl/source/control/imp_listbox.cxx index 9c946ad09f73..2161c041077e 100644 --- a/vcl/source/control/imp_listbox.cxx +++ b/vcl/source/control/imp_listbox.cxx @@ -2474,6 +2474,10 @@ bool ImplListBox::EventNotify( NotifyEvent& rNEvt ) bDone = HandleScrollCommand( rCEvt, mpHScrollBar, mpVScrollBar ); } } + else if (rCEvt.GetCommand() == CommandEventId::Gesture) + { + bDone = HandleScrollCommand(rCEvt, mpHScrollBar, mpVScrollBar); + } } return bDone || Window::EventNotify( rNEvt ); diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 07ff4a87c29b..c4286ae2c9a5 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -823,6 +823,7 @@ ImplFrameData::ImplFrameData( vcl::Window *pWindow ) mbInBufferedPaint = false; mnDPIX = 96; mnDPIY = 96; + mnTouchPanPosition = -1; } namespace vcl { diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx index 3e2ccb380474..adbaf44d7fed 100644 --- a/vcl/source/window/window2.cxx +++ b/vcl/source/window/window2.cxx @@ -809,6 +809,26 @@ bool Window::HandleScrollCommand( const CommandEvent& rCmd, } break; + case CommandEventId::Gesture: + { + const CommandGestureData* pData = rCmd.GetGestureData(); + if (pData->meEventType == GestureEventType::PanningBegin) + { + mpWindowImpl->mpFrameData->mnTouchPanPosition = pVScrl->GetThumbPos(); + } + else if(pData->meEventType == GestureEventType::PanningUpdate) + { + long nOriginalPosition = mpWindowImpl->mpFrameData->mnTouchPanPosition; + pVScrl->DoScroll(nOriginalPosition + (pData->mfOffset)); + } + if (pData->meEventType == GestureEventType::PanningEnd) + { + mpWindowImpl->mpFrameData->mnTouchPanPosition = -1; + } + bRet = true; + } + break; + case CommandEventId::AutoScroll: { const CommandScrollData* pData = rCmd.GetAutoScrollData(); commit a50412ee101e355a8ba6f39c0f693c3572672157 Author: Tomaž Vajngerl <[email protected]> AuthorDate: Mon Mar 25 18:05:35 2019 +0900 Commit: Tomaž Vajngerl <[email protected]> CommitDate: Wed Mar 27 11:33:53 2019 +0900 tdf#124146 add (general) gesture event support to VCL Reviewed-on: https://gerrit.libreoffice.org/69655 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <[email protected]> (cherry picked from commit 6b476080da0678faa59606ef814760bd4235de24) Change-Id: I766930bb35071442e132b91477cd3d55e8f00f48 diff --git a/include/vcl/GestureEvent.hxx b/include/vcl/GestureEvent.hxx new file mode 100644 index 000000000000..2070fc76d39a --- /dev/null +++ b/include/vcl/GestureEvent.hxx @@ -0,0 +1,42 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ + +#ifndef INCLUDED_VCL_GESTUREEVENT_HXX +#define INCLUDED_VCL_GESTUREEVENT_HXX + +#include <vcl/dllapi.h> + +enum class GestureEventType +{ + PanningBegin, + PanningUpdate, + PanningEnd +}; + +enum class PanningOrientation +{ + Horizontal, + Vertical +}; + +class VCL_DLLPUBLIC GestureEvent +{ +public: + sal_Int32 mnX; + sal_Int32 mnY; + GestureEventType meEventType; + + sal_Int32 mnOffset; + PanningOrientation meOrientation; +}; + +#endif // INCLUDED_VCL_GESTUREEVENT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/commandevent.hxx b/include/vcl/commandevent.hxx index 778348b3d1a3..1b2d5ab55425 100644 --- a/include/vcl/commandevent.hxx +++ b/include/vcl/commandevent.hxx @@ -27,6 +27,8 @@ #include <vcl/keycod.hxx> #include <vcl/font.hxx> #include <o3tl/typed_flags_set.hxx> +#include <rtl/ustring.hxx> +#include <vcl/GestureEvent.hxx> class CommandExtTextInputData; class CommandWheelData; @@ -37,6 +39,8 @@ class CommandMediaData; class CommandSelectionChangeData; class CommandSwipeData; class CommandLongPressData; +class CommandGestureData; + enum class CommandEventId; enum class ExtTextInputAttr { @@ -86,6 +90,7 @@ public: const CommandSelectionChangeData* GetSelectionChangeData() const; const CommandSwipeData* GetSwipeData() const; const CommandLongPressData* GetLongPressData() const; + const CommandGestureData* GetGestureData() const; }; class VCL_DLLPUBLIC CommandExtTextInputData @@ -305,6 +310,25 @@ public: double getY() const { return mnY; } }; +class VCL_DLLPUBLIC CommandGestureData +{ +public: + double const mfX; + double const mfY; + GestureEventType const meEventType; + + double const mfOffset; + PanningOrientation const meOrientation; + + CommandGestureData(double fX, double fY, GestureEventType eEventType, double fOffset, PanningOrientation eOrientation) + : mfX(fX) + , mfY(fY) + , meEventType(eEventType) + , mfOffset(fOffset) + , meOrientation(eOrientation) + {} +}; + enum class CommandEventId { NONE = 0, @@ -328,6 +352,7 @@ enum class CommandEventId QueryCharPosition = 20, Swipe = 21, LongPress = 22, + Gesture = 23, }; #endif // INCLUDED_VCL_COMMANDEVENT_HXX diff --git a/include/vcl/svapp.hxx b/include/vcl/svapp.hxx index 3cbb01d8b336..f65285aaae44 100644 --- a/include/vcl/svapp.hxx +++ b/include/vcl/svapp.hxx @@ -60,6 +60,7 @@ class Reflection; class NotifyEvent; class KeyEvent; class MouseEvent; +class GestureEvent; struct ImplSVEvent; struct ConvertData; @@ -753,6 +754,8 @@ public: */ static ImplSVEvent * PostMouseEvent( VclEventId nEvent, vcl::Window *pWin, MouseEvent const * pMouseEvent ); + static ImplSVEvent* PostGestureEvent(VclEventId nEvent, vcl::Window* pWin, GestureEvent const * pGestureEvent); + /** Remove mouse and keypress events from a window... any also zoom and scroll events if the platform supports it. diff --git a/include/vcl/vclevent.hxx b/include/vcl/vclevent.hxx index 8f15df2228c4..9e771bf59502 100644 --- a/include/vcl/vclevent.hxx +++ b/include/vcl/vclevent.hxx @@ -174,6 +174,7 @@ enum class VclEventId WindowShow, WindowStartDocking, // pData = DockingData WindowToggleFloating, + WindowGestureEvent, }; class VCL_DLLPUBLIC VclSimpleEvent diff --git a/vcl/inc/salwtype.hxx b/vcl/inc/salwtype.hxx index 1538c8e78a25..930da0c19972 100644 --- a/vcl/inc/salwtype.hxx +++ b/vcl/inc/salwtype.hxx @@ -23,6 +23,7 @@ #include <i18nlangtag/lang.h> #include <rtl/ustring.hxx> #include <tools/solar.h> +#include <vcl/GestureEvent.hxx> class SalGraphics; class SalFrame; @@ -81,7 +82,9 @@ enum class SalEvent { StartReconversion, QueryCharPosition, Swipe, - LongPress + LongPress, + ExternalGesture, + Gesture, }; // MOUSELEAVE must send, when the pointer leave the client area and @@ -258,6 +261,15 @@ struct SalLongPressEvent long mnY; }; +struct SalGestureEvent +{ + GestureEventType meEventType; + PanningOrientation meOrientation; + double mfOffset; + long mnX; + long mnY; +}; + typedef void (*SALTIMERPROC)(); #endif // INCLUDED_VCL_INC_SALWTYPE_HXX diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index c49564e2fc4e..5376e2991401 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -161,11 +161,26 @@ struct ImplPostEventData ImplSVEvent * mnEventId; KeyEvent maKeyEvent; MouseEvent maMouseEvent; - - ImplPostEventData( VclEventId nEvent, vcl::Window* pWin, const KeyEvent& rKeyEvent ) : - mnEvent( nEvent ), mpWin( pWin ), mnEventId( nullptr ), maKeyEvent( rKeyEvent ) {} - ImplPostEventData( VclEventId nEvent, vcl::Window* pWin, const MouseEvent& rMouseEvent ) : - mnEvent( nEvent ), mpWin( pWin ), mnEventId( nullptr ), maMouseEvent( rMouseEvent ) {} + GestureEvent maGestureEvent; + + ImplPostEventData(VclEventId nEvent, vcl::Window* pWin, const KeyEvent& rKeyEvent) + : mnEvent(nEvent) + , mpWin(pWin) + , mnEventId(nullptr) + , maKeyEvent(rKeyEvent) + {} + ImplPostEventData(VclEventId nEvent, vcl::Window* pWin, const MouseEvent& rMouseEvent) + : mnEvent(nEvent) + , mpWin(pWin) + , mnEventId(nullptr) + , maMouseEvent(rMouseEvent) + {} + ImplPostEventData(VclEventId nEvent, vcl::Window* pWin, const GestureEvent& rGestureEvent) + : mnEvent(nEvent) + , mpWin(pWin) + , mnEventId(nullptr) + , maGestureEvent(rGestureEvent) + {} }; Application* GetpApp() @@ -874,7 +889,43 @@ ImplSVEvent * Application::PostKeyEvent( VclEventId nEvent, vcl::Window *pWin, K return nEventId; } -ImplSVEvent * Application::PostMouseEvent( VclEventId nEvent, vcl::Window *pWin, MouseEvent const * pMouseEvent ) +ImplSVEvent* Application::PostGestureEvent(VclEventId nEvent, vcl::Window* pWin, GestureEvent const * pGestureEvent) +{ + const SolarMutexGuard aGuard; + ImplSVEvent * nEventId = nullptr; + + if (pWin && pGestureEvent) + { + Point aTransformedPosition(pGestureEvent->mnX, pGestureEvent->mnY); + + aTransformedPosition.AdjustX(pWin->GetOutOffXPixel()); + aTransformedPosition.AdjustY(pWin->GetOutOffYPixel()); + + const GestureEvent aGestureEvent{ + sal_Int32(aTransformedPosition.X()), + sal_Int32(aTransformedPosition.Y()), + pGestureEvent->meEventType, + pGestureEvent->mnOffset, + pGestureEvent->meOrientation + }; + + std::unique_ptr<ImplPostEventData> pPostEventData(new ImplPostEventData(nEvent, pWin, aGestureEvent)); + + nEventId = PostUserEvent( + LINK( nullptr, Application, PostEventHandler ), + pPostEventData.get()); + + if (nEventId) + { + pPostEventData->mnEventId = nEventId; + ImplGetSVData()->maAppData.maPostedEventList.emplace_back(pWin, pPostEventData.release()); + } + } + + return nEventId; +} + +ImplSVEvent* Application::PostMouseEvent( VclEventId nEvent, vcl::Window *pWin, MouseEvent const * pMouseEvent ) { const SolarMutexGuard aGuard; ImplSVEvent * nEventId = nullptr; @@ -943,6 +994,11 @@ IMPL_STATIC_LINK( Application, PostEventHandler, void*, pCallData, void ) pEventData = &pData->maKeyEvent; break; + case VclEventId::WindowGestureEvent: + nEvent = SalEvent::ExternalGesture; + pEventData = &pData->maGestureEvent; + break; + default: nEvent = SalEvent::NONE; pEventData = nullptr; diff --git a/vcl/source/window/commandevent.cxx b/vcl/source/window/commandevent.cxx index b298022abc56..c5dcf7c8b00e 100644 --- a/vcl/source/window/commandevent.cxx +++ b/vcl/source/window/commandevent.cxx @@ -191,4 +191,13 @@ const CommandLongPressData* CommandEvent::GetLongPressData() const return nullptr; } +const CommandGestureData* CommandEvent::GetGestureData() const +{ + if (mnCommand == CommandEventId::Gesture) + return static_cast<const CommandGestureData*>(mpData); + else + return nullptr; +} + + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx index 567a8e7330c2..e914d4e414b6 100644 --- a/vcl/source/window/winproc.cxx +++ b/vcl/source/window/winproc.cxx @@ -27,6 +27,7 @@ #include <vcl/unohelp.hxx> #include <vcl/timer.hxx> #include <vcl/event.hxx> +#include <vcl/GestureEvent.hxx> #include <vcl/settings.hxx> #include <vcl/svapp.hxx> #include <vcl/cursor.hxx> @@ -1546,6 +1547,30 @@ static bool ImplHandleLongPress(vcl::Window *pWindow, const SalLongPressEvent& r return aHandler.HandleEvent(); } +class HandleGeneralGestureEvent : public HandleGestureEvent +{ +private: + CommandGestureData m_aGestureData; + +public: + HandleGeneralGestureEvent(vcl::Window* pWindow, const SalGestureEvent& rEvent) + : HandleGestureEvent(pWindow, Point(rEvent.mnX, rEvent.mnY)) + , m_aGestureData(rEvent.mnX, rEvent.mnY, rEvent.meEventType, rEvent.mfOffset, rEvent.meOrientation) + { + } + + virtual bool CallCommand(vcl::Window* pWindow, const Point& /*rMousePos*/) override + { + return ImplCallCommand(pWindow, CommandEventId::Gesture, &m_aGestureData); + } +}; + +static bool ImplHandleGestureEvent(vcl::Window* pWindow, const SalGestureEvent& rEvent) +{ + HandleGeneralGestureEvent aHandler(pWindow, rEvent); + return aHandler.HandleEvent(); +} + static void ImplHandlePaint( vcl::Window* pWindow, const tools::Rectangle& rBoundRect, bool bImmediateUpdate ) { // system paint events must be checked for re-mirroring @@ -2529,7 +2554,26 @@ bool ImplWindowFrameProc( vcl::Window* _pWindow, SalEvent nEvent, const void* pE bRet = ImplHandleLongPress(pWindow, *static_cast<const SalLongPressEvent*>(pEvent)); break; + case SalEvent::ExternalGesture: + { + auto const * pGestureEvent = static_cast<GestureEvent const *>(pEvent); + + SalGestureEvent aSalGestureEvent; + aSalGestureEvent.mfOffset = pGestureEvent->mnOffset; + aSalGestureEvent.mnX = pGestureEvent->mnX; + aSalGestureEvent.mnY = pGestureEvent->mnY; + aSalGestureEvent.meEventType = pGestureEvent->meEventType; + aSalGestureEvent.meOrientation = pGestureEvent->meOrientation; + bRet = ImplHandleGestureEvent(pWindow, aSalGestureEvent); + } + break; + case SalEvent::Gesture: + { + auto const * aSalGestureEvent = static_cast<SalGestureEvent const *>(pEvent); + bRet = ImplHandleGestureEvent(pWindow, *aSalGestureEvent); + } + break; default: SAL_WARN( "vcl.layout", "ImplWindowFrameProc(): unknown event (" << (int)nEvent << ")" ); break; commit fb6d2b740ccb3be8474ed6f4fa1469dd870deb44 Author: Tomaž Vajngerl <[email protected]> AuthorDate: Fri Mar 22 10:16:39 2019 +0900 Commit: Tomaž Vajngerl <[email protected]> CommitDate: Wed Mar 27 11:33:52 2019 +0900 Rename DrawCommand* to WidgetDrawAction*, remove unused circ draw Reviewed-on: https://gerrit.libreoffice.org/69654 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <[email protected]> (cherry picked from commit d3922a93a096e07ab54e91fd0dd7c86302f33b78) Change-Id: Icef900e75255d477812a198fdb29e0cdebba35b8 diff --git a/vcl/inc/widgetdraw/WidgetDefinition.hxx b/vcl/inc/widgetdraw/WidgetDefinition.hxx index 77baf0922cd8..d5f5b3728abd 100644 --- a/vcl/inc/widgetdraw/WidgetDefinition.hxx +++ b/vcl/inc/widgetdraw/WidgetDefinition.hxx @@ -24,32 +24,40 @@ namespace vcl { -enum class DrawCommandType +enum class WidgetDrawActionType { RECTANGLE, - CIRCLE, LINE, IMAGE, EXTERNAL }; -class VCL_DLLPUBLIC DrawCommand +class VCL_DLLPUBLIC WidgetDrawAction { public: - DrawCommand(DrawCommandType aType) + WidgetDrawAction(WidgetDrawActionType aType) : maType(aType) - , mnStrokeWidth(-1) { } - DrawCommandType maType; + WidgetDrawActionType maType; +}; + +class VCL_DLLPUBLIC WidgetDrawActionShape : public WidgetDrawAction +{ +public: + WidgetDrawActionShape(WidgetDrawActionType aType) + : WidgetDrawAction(aType) + , mnStrokeWidth(-1) + { + } Color maStrokeColor; Color maFillColor; sal_Int32 mnStrokeWidth; }; -class VCL_DLLPUBLIC RectangleDrawCommand : public DrawCommand +class VCL_DLLPUBLIC WidgetDrawActionRectangle : public WidgetDrawActionShape { public: sal_Int32 mnRx; @@ -60,8 +68,8 @@ public: float mfX2; float mfY2; - RectangleDrawCommand() - : DrawCommand(DrawCommandType::RECTANGLE) + WidgetDrawActionRectangle() + : WidgetDrawActionShape(WidgetDrawActionType::RECTANGLE) , mnRx(0) , mnRy(0) , mfX1(0.0f) @@ -72,25 +80,7 @@ public: } }; -class VCL_DLLPUBLIC CircleDrawCommand : public DrawCommand -{ -public: - float mfX1; - float mfY1; - float mfX2; - float mfY2; - - CircleDrawCommand() - : DrawCommand(DrawCommandType::CIRCLE) - , mfX1(0.0f) - , mfY1(0.0f) - , mfX2(1.0f) - , mfY2(1.0f) - { - } -}; - -class VCL_DLLPUBLIC LineDrawCommand : public DrawCommand +class VCL_DLLPUBLIC WidgetDrawActionLine : public WidgetDrawActionShape { public: float mfX1; @@ -98,30 +88,30 @@ public: float mfX2; float mfY2; - LineDrawCommand() - : DrawCommand(DrawCommandType::LINE) + WidgetDrawActionLine() + : WidgetDrawActionShape(WidgetDrawActionType::LINE) { } }; -class VCL_DLLPUBLIC ImageDrawCommand : public DrawCommand +class VCL_DLLPUBLIC WidgetDrawActionImage : public WidgetDrawAction { public: OUString msSource; - ImageDrawCommand() - : DrawCommand(DrawCommandType::IMAGE) + WidgetDrawActionImage() + : WidgetDrawAction(WidgetDrawActionType::IMAGE) { } }; -class VCL_DLLPUBLIC ExternalSourceDrawCommand : public DrawCommand +class VCL_DLLPUBLIC WidgetDrawActionExternal : public WidgetDrawAction { public: OUString msSource; - ExternalSourceDrawCommand() - : DrawCommand(DrawCommandType::EXTERNAL) + WidgetDrawActionExternal() + : WidgetDrawAction(WidgetDrawActionType::EXTERNAL) { } }; @@ -179,12 +169,10 @@ public: OString const& sSelected, OString const& sButtonValue, OString const& sExtra); - std::vector<std::shared_ptr<DrawCommand>> mpDrawCommands; + std::vector<std::shared_ptr<WidgetDrawAction>> mpWidgetDrawActions; void addDrawRectangle(Color aStrokeColor, sal_Int32 nStrokeWidth, Color aFillColor, float fX1, float fY1, float fX2, float fY2, sal_Int32 nRx, sal_Int32 nRy); - void addDrawCircle(Color aStrokeColor, sal_Int32 nStrokeWidth, Color aFillColor, float fX1, - float fY1, float fX2, float fY2); void addDrawLine(Color aStrokeColor, sal_Int32 nStrokeWidth, float fX1, float fY1, float fX2, float fY2); diff --git a/vcl/qa/cppunit/widgetdraw/WidgetDefinitionReaderTest.cxx b/vcl/qa/cppunit/widgetdraw/WidgetDefinitionReaderTest.cxx index 75dc559067fc..843f449b7901 100644 --- a/vcl/qa/cppunit/widgetdraw/WidgetDefinitionReaderTest.cxx +++ b/vcl/qa/cppunit/widgetdraw/WidgetDefinitionReaderTest.cxx @@ -62,10 +62,11 @@ void WidgetDefinitionReaderTest::testRead() CPPUNIT_ASSERT_EQUAL(size_t(2), aStates.size()); - CPPUNIT_ASSERT_EQUAL(size_t(2), aStates[0]->mpDrawCommands.size()); - CPPUNIT_ASSERT_EQUAL(vcl::DrawCommandType::RECTANGLE, - aStates[0]->mpDrawCommands[0]->maType); - CPPUNIT_ASSERT_EQUAL(vcl::DrawCommandType::CIRCLE, aStates[0]->mpDrawCommands[1]->maType); + CPPUNIT_ASSERT_EQUAL(size_t(2), aStates[0]->mpWidgetDrawActions.size()); + CPPUNIT_ASSERT_EQUAL(vcl::WidgetDrawActionType::RECTANGLE, + aStates[0]->mpWidgetDrawActions[0]->maType); + CPPUNIT_ASSERT_EQUAL(vcl::WidgetDrawActionType::LINE, + aStates[0]->mpWidgetDrawActions[1]->maType); } // Radiobutton @@ -75,7 +76,7 @@ void WidgetDefinitionReaderTest::testRead() ->getStates(ControlType::Radiobutton, ControlPart::Entire, ControlState::NONE, ImplControlValue(ButtonValue::On)); CPPUNIT_ASSERT_EQUAL(size_t(1), aStates.size()); - CPPUNIT_ASSERT_EQUAL(size_t(2), aStates[0]->mpDrawCommands.size()); + CPPUNIT_ASSERT_EQUAL(size_t(2), aStates[0]->mpWidgetDrawActions.size()); } { @@ -84,7 +85,7 @@ void WidgetDefinitionReaderTest::testRead() ->getStates(ControlType::Radiobutton, ControlPart::Entire, ControlState::NONE, ImplControlValue(ButtonValue::Off)); CPPUNIT_ASSERT_EQUAL(size_t(1), aStates.size()); - CPPUNIT_ASSERT_EQUAL(size_t(1), aStates[0]->mpDrawCommands.size()); + CPPUNIT_ASSERT_EQUAL(size_t(1), aStates[0]->mpWidgetDrawActions.size()); } } diff --git a/vcl/qa/cppunit/widgetdraw/data/definition1.xml b/vcl/qa/cppunit/widgetdraw/data/definition1.xml index 4fb1c4230853..041e8fc24754 100644 --- a/vcl/qa/cppunit/widgetdraw/data/definition1.xml +++ b/vcl/qa/cppunit/widgetdraw/data/definition1.xml @@ -56,7 +56,7 @@ <part value="Entire"> <state enabled="any" focused="any" pressed="any" rollover="any" default="any" selected="any" button-value="any"> <rect stroke="#808080" fill="#FFFFFF" stroke-width="1.0" rx="5" ry="5" margin="1"/> - <circ stroke="#808080" fill="#808080" stroke-width="1.0" margin="1"/> + <line stroke="#808080" fill="#808080" stroke-width="1.0"/> </state> <state enabled="true" focused="any" pressed="any" rollover="true" default="true" selected="any" button-value="any"> <rect stroke="#808080" fill="#808080" stroke-width="1.0" rx="5" ry="5" margin="1"/> @@ -71,11 +71,11 @@ <radiobutton> <part value="Entire"> <state enabled="any" focused="any" pressed="any" rollover="any" default="any" selected="any" button-value="false"> - <circ stroke="#007AFF" fill="#FFFFFF" stroke-width="1" margin="0"/> + <rect stroke="#007AFF" fill="#FFFFFF" stroke-width="1" margin="0"/> </state> <state enabled="any" focused="any" pressed="any" rollover="any" default="any" selected="any" button-value="true"> - <circ stroke="#007AFF" fill="#FFFFFF" stroke-width="1" margin="0"/> - <circ stroke="#007AFF" fill="#007AFF" stroke-width="1" margin="3"/> + <rect stroke="#007AFF" fill="#FFFFFF" stroke-width="1" margin="0"/> + <rect stroke="#007AFF" fill="#007AFF" stroke-width="1" margin="3"/> </state> </part> </radiobutton> diff --git a/vcl/source/gdi/FileDefinitionWidgetDraw.cxx b/vcl/source/gdi/FileDefinitionWidgetDraw.cxx index 638f7872c50a..a31ef7a59bfc 100644 --- a/vcl/source/gdi/FileDefinitionWidgetDraw.cxx +++ b/vcl/source/gdi/FileDefinitionWidgetDraw.cxx @@ -254,95 +254,75 @@ void drawFromDrawCommands(gfx::DrawRoot const& rDrawRoot, SalGraphics& rGraphics } } -void munchDrawCommands(std::vector<std::shared_ptr<DrawCommand>> const& rDrawCommands, +void munchDrawCommands(std::vector<std::shared_ptr<WidgetDrawAction>> const& rDrawActions, SalGraphics& rGraphics, long nX, long nY, long nWidth, long nHeight) { - for (std::shared_ptr<DrawCommand> const& pDrawCommand : rDrawCommands) + for (std::shared_ptr<WidgetDrawAction> const& pDrawAction : rDrawActions) { - switch (pDrawCommand->maType) + switch (pDrawAction->maType) { - case DrawCommandType::RECTANGLE: + case WidgetDrawActionType::RECTANGLE: { - auto const& rRectDrawCommand - = static_cast<RectangleDrawCommand const&>(*pDrawCommand); + auto const& rWidgetDraw + = static_cast<WidgetDrawActionRectangle const&>(*pDrawAction); basegfx::B2DRectangle rRect( - nX + (nWidth * rRectDrawCommand.mfX1), nY + (nHeight * rRectDrawCommand.mfY1), - nX + (nWidth * rRectDrawCommand.mfX2), nY + (nHeight * rRectDrawCommand.mfY2)); + nX + (nWidth * rWidgetDraw.mfX1), nY + (nHeight * rWidgetDraw.mfY1), + nX + (nWidth * rWidgetDraw.mfX2), nY + (nHeight * rWidgetDraw.mfY2)); basegfx::B2DPolygon aB2DPolygon = basegfx::utils::createPolygonFromRect( - rRect, rRectDrawCommand.mnRx / rRect.getWidth() * 2.0, - rRectDrawCommand.mnRy / rRect.getHeight() * 2.0); + rRect, rWidgetDraw.mnRx / rRect.getWidth() * 2.0, + rWidgetDraw.mnRy / rRect.getHeight() * 2.0); rGraphics.SetLineColor(); - rGraphics.SetFillColor(ImplColorToSal(rRectDrawCommand.maFillColor)); + rGraphics.SetFillColor(ImplColorToSal(rWidgetDraw.maFillColor)); rGraphics.DrawPolyPolygon(basegfx::B2DPolyPolygon(aB2DPolygon), 0.0f, nullptr); - rGraphics.SetLineColor(ImplColorToSal(rRectDrawCommand.maStrokeColor)); + rGraphics.SetLineColor(ImplColorToSal(rWidgetDraw.maStrokeColor)); rGraphics.SetFillColor(); - rGraphics.DrawPolyLine(aB2DPolygon, 0.0f, - basegfx::B2DVector(rRectDrawCommand.mnStrokeWidth, - rRectDrawCommand.mnStrokeWidth), - basegfx::B2DLineJoin::Round, css::drawing::LineCap_ROUND, - 0.0f, nullptr); + rGraphics.DrawPolyLine( + aB2DPolygon, 0.0f, + basegfx::B2DVector(rWidgetDraw.mnStrokeWidth, rWidgetDraw.mnStrokeWidth), + basegfx::B2DLineJoin::Round, css::drawing::LineCap_ROUND, 0.0f, nullptr); } break; - case DrawCommandType::CIRCLE: + case WidgetDrawActionType::LINE: { - auto const& rCircleDrawCommand - = static_cast<CircleDrawCommand const&>(*pDrawCommand); - - basegfx::B2DRectangle rRect(nX + (nWidth * rCircleDrawCommand.mfX1), - nY + (nHeight * rCircleDrawCommand.mfY1), - nX + (nWidth * rCircleDrawCommand.mfX2), - nY + (nHeight * rCircleDrawCommand.mfY2)); - - basegfx::B2DPolygon aB2DPolygon = basegfx::utils::createPolygonFromEllipse( - rRect.getCenter(), rRect.getWidth() / 2.0, rRect.getHeight() / 2.0); - - rGraphics.SetLineColor(ImplColorToSal(rCircleDrawCommand.maStrokeColor)); - rGraphics.SetFillColor(ImplColorToSal(rCircleDrawCommand.maFillColor)); - rGraphics.DrawPolyPolygon(basegfx::B2DPolyPolygon(aB2DPolygon), 0.0f, nullptr); - } - break; - case DrawCommandType::LINE: - { - auto const& rLineDrawCommand = static_cast<LineDrawCommand const&>(*pDrawCommand); + auto const& rWidgetDraw = static_cast<WidgetDrawActionLine const&>(*pDrawAction); Point aRectPoint(nX + 1, nY + 1); Size aRectSize(nWidth - 1, nHeight - 1); rGraphics.SetFillColor(); - rGraphics.SetLineColor(ImplColorToSal(rLineDrawCommand.maStrokeColor)); + rGraphics.SetLineColor(ImplColorToSal(rWidgetDraw.maStrokeColor)); basegfx::B2DPolygon aB2DPolygon{ - { aRectPoint.X() + (aRectSize.Width() * rLineDrawCommand.mfX1), - aRectPoint.Y() + (aRectSize.Height() * rLineDrawCommand.mfY1) }, - { aRectPoint.X() + (aRectSize.Width() * rLineDrawCommand.mfX2), - aRectPoint.Y() + (aRectSize.Height() * rLineDrawCommand.mfY2) }, + { aRectPoint.X() + (aRectSize.Width() * rWidgetDraw.mfX1), + aRectPoint.Y() + (aRectSize.Height() * rWidgetDraw.mfY1) }, + { aRectPoint.X() + (aRectSize.Width() * rWidgetDraw.mfX2), + aRectPoint.Y() + (aRectSize.Height() * rWidgetDraw.mfY2) }, }; - rGraphics.DrawPolyLine(aB2DPolygon, 0.0f, - basegfx::B2DVector(rLineDrawCommand.mnStrokeWidth, - rLineDrawCommand.mnStrokeWidth), - basegfx::B2DLineJoin::Round, css::drawing::LineCap_ROUND, - 0.0f, nullptr); + rGraphics.DrawPolyLine( + aB2DPolygon, 0.0f, + basegfx::B2DVector(rWidgetDraw.mnStrokeWidth, rWidgetDraw.mnStrokeWidth), + basegfx::B2DLineJoin::Round, css::drawing::LineCap_ROUND, 0.0f, nullptr); } break; - case DrawCommandType::IMAGE: + case WidgetDrawActionType::IMAGE: { double nScaleFactor = 1.0; if (comphelper::LibreOfficeKit::isActive()) nScaleFactor = comphelper::LibreOfficeKit::getDPIScale(); - auto const& rDrawCommand = static_cast<ImageDrawCommand const&>(*pDrawCommand); + auto const& rWidgetDraw = static_cast<WidgetDrawActionImage const&>(*pDrawAction); auto& rCacheImages = ImplGetSVData()->maGDIData.maThemeImageCache; - OUString rCacheKey = rDrawCommand.msSource + "@" + OUString::number(nScaleFactor); + OUString rCacheKey = rWidgetDraw.msSource + "@" + OUString::number(nScaleFactor); auto& aIterator = rCacheImages.find(rCacheKey); BitmapEx aBitmap; if (aIterator == rCacheImages.end()) { - SvFileStream aFileStream(rDrawCommand.msSource, StreamMode::READ); + SvFileStream aFileStream(rWidgetDraw.msSource, StreamMode::READ); vcl::bitmap::loadFromSvg(aFileStream, "", aBitmap, nScaleFactor); if (!!aBitmap) @@ -376,19 +356,20 @@ void munchDrawCommands(std::vector<std::shared_ptr<DrawCommand>> const& rDrawCom } } break; - case DrawCommandType::EXTERNAL: + case WidgetDrawActionType::EXTERNAL: { - auto const& rDrawCommand = static_cast<ImageDrawCommand const&>(*pDrawCommand); + auto const& rWidgetDraw + = static_cast<WidgetDrawActionExternal const&>(*pDrawAction); auto& rCacheDrawCommands = ImplGetSVData()->maGDIData.maThemeDrawCommandsCache; - auto& aIterator = rCacheDrawCommands.find(rDrawCommand.msSource); + auto& aIterator = rCacheDrawCommands.find(rWidgetDraw.msSource); gfx::DrawRoot aDrawRoot; if (aIterator == rCacheDrawCommands.end()) { - SvFileStream aFileStream(rDrawCommand.msSource, StreamMode::READ); + SvFileStream aFileStream(rWidgetDraw.msSource, StreamMode::READ); uno::Reference<uno::XComponentContext> xContext( comphelper::getProcessComponentContext()); @@ -411,7 +392,7 @@ void munchDrawCommands(std::vector<std::shared_ptr<DrawCommand>> const& rDrawCom if (pDrawRoot) { rCacheDrawCommands.insert( - std::make_pair(rDrawCommand.msSource, *pDrawRoot)); + std::make_pair(rWidgetDraw.msSource, *pDrawRoot)); drawFromDrawCommands(*pDrawRoot, rGraphics, nX, nY, nWidth, nHeight); } } @@ -443,7 +424,8 @@ bool FileDefinitionWidgetDraw::resolveDefinition(ControlType eType, ControlPart // use last defined state auto const& pState = aStates.back(); { - munchDrawCommands(pState->mpDrawCommands, m_rGraphics, nX, nY, nWidth, nHeight); + munchDrawCommands(pState->mpWidgetDrawActions, m_rGraphics, nX, nY, nWidth, + nHeight); bOK = true; } } diff --git a/vcl/source/gdi/WidgetDefinition.cxx b/vcl/source/gdi/WidgetDefinition.cxx index 069e0b99e0f0..c41afb63fe91 100644 --- a/vcl/source/gdi/WidgetDefinition.cxx +++ b/vcl/source/gdi/WidgetDefinition.cxx @@ -134,7 +134,7 @@ void WidgetDefinitionState::addDrawRectangle(Color aStrokeColor, sal_Int32 nStro Color aFillColor, float fX1, float fY1, float fX2, float fY2, sal_Int32 nRx, sal_Int32 nRy) { - auto pCommand(std::make_shared<RectangleDrawCommand>()); + auto pCommand(std::make_shared<WidgetDrawActionRectangle>()); pCommand->maStrokeColor = aStrokeColor; pCommand->maFillColor = aFillColor; pCommand->mnStrokeWidth = nStrokeWidth; @@ -144,49 +144,34 @@ void WidgetDefinitionState::addDrawRectangle(Color aStrokeColor, sal_Int32 nStro pCommand->mfY1 = fY1; pCommand->mfX2 = fX2; pCommand->mfY2 = fY2; - mpDrawCommands.push_back(std::move(pCommand)); -} - -void WidgetDefinitionState::addDrawCircle(Color aStrokeColor, sal_Int32 nStrokeWidth, - Color aFillColor, float fX1, float fY1, float fX2, - float fY2) -{ - auto pCommand(std::make_shared<CircleDrawCommand>()); - pCommand->maStrokeColor = aStrokeColor; - pCommand->maFillColor = aFillColor; - pCommand->mnStrokeWidth = nStrokeWidth; - pCommand->mfX1 = fX1; - pCommand->mfY1 = fY1; - pCommand->mfX2 = fX2; - pCommand->mfY2 = fY2; - mpDrawCommands.push_back(std::move(pCommand)); + mpWidgetDrawActions.push_back(std::move(pCommand)); } void WidgetDefinitionState::addDrawLine(Color aStrokeColor, sal_Int32 nStrokeWidth, float fX1, float fY1, float fX2, float fY2) { - auto pCommand(std::make_shared<LineDrawCommand>()); + auto pCommand(std::make_shared<WidgetDrawActionLine>()); pCommand->maStrokeColor = aStrokeColor; pCommand->mnStrokeWidth = nStrokeWidth; pCommand->mfX1 = fX1; pCommand->mfY1 = fY1; pCommand->mfX2 = fX2; pCommand->mfY2 = fY2; - mpDrawCommands.push_back(std::move(pCommand)); + mpWidgetDrawActions.push_back(std::move(pCommand)); } void WidgetDefinitionState::addDrawImage(OUString const& sSource) { - auto pCommand(std::make_shared<ImageDrawCommand>()); + auto pCommand(std::make_shared<WidgetDrawActionImage>()); pCommand->msSource = sSource; - mpDrawCommands.push_back(std::move(pCommand)); + mpWidgetDrawActions.push_back(std::move(pCommand)); } void WidgetDefinitionState::addDrawExternal(OUString const& sSource) { - auto pCommand(std::make_shared<ExternalSourceDrawCommand>()); + auto pCommand(std::make_shared<WidgetDrawActionExternal>()); pCommand->msSource = sSource; - mpDrawCommands.push_back(std::move(pCommand)); + mpWidgetDrawActions.push_back(std::move(pCommand)); } } // end vcl namespace diff --git a/vcl/source/gdi/WidgetDefinitionReader.cxx b/vcl/source/gdi/WidgetDefinitionReader.cxx index c183cb717e9c..f825addd0042 100644 --- a/vcl/source/gdi/WidgetDefinitionReader.cxx +++ b/vcl/source/gdi/WidgetDefinitionReader.cxx @@ -226,31 +226,6 @@ void WidgetDefinitionReader::readDrawingDefinition(tools::XmlWalker& rWalker, rpState->addDrawRectangle(aStrokeColor, nStrokeWidth, aFillColor, fX1, fY1, fX2, fY2, nRx, nRy); } - else if (rWalker.name() == "circ") - { - Color aStrokeColor; - readColor(rWalker.attribute("stroke"), aStrokeColor); - Color aFillColor; - readColor(rWalker.attribute("fill"), aFillColor); - OString sStrokeWidth = rWalker.attribute("stroke-width"); - sal_Int32 nStrokeWidth = -1; - if (!sStrokeWidth.isEmpty()) - nStrokeWidth = sStrokeWidth.toInt32(); - - OString sX1 = rWalker.attribute("x1"); - float fX1 = sX1.isEmpty() ? 0.0 : sX1.toFloat(); - - OString sY1 = rWalker.attribute("y1"); - float fY1 = sY1.isEmpty() ? 0.0 : sY1.toFloat(); - - OString sX2 = rWalker.attribute("x2"); - float fX2 = sX2.isEmpty() ? 1.0 : sX2.toFloat(); - - OString sY2 = rWalker.attribute("y2"); - float fY2 = sY2.isEmpty() ? 1.0 : sY2.toFloat(); - - rpState->addDrawCircle(aStrokeColor, nStrokeWidth, aFillColor, fX1, fY1, fX2, fY2); - } else if (rWalker.name() == "line") { Color aStrokeColor; _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
