include/svx/svdmrkv.hxx | 10 +++++++- svx/source/svdraw/svdmrkv.cxx | 48 ++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 55 insertions(+), 3 deletions(-)
New commits: commit cf812f15b3295a17a9b5d7e3a1c51b00dcbf2629 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Wed May 27 15:27:14 2020 +0200 Commit: Tomaž Vajngerl <qui...@gmail.com> CommitDate: Tue Jun 2 18:55:07 2020 +0200 svx: add ability to show sub-selections in a marked object Draws selection rectangles inside the object window. Change-Id: I994477426489ea4cea89c86f9e51c9978f16b350 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95347 Tested-by: Tomaž Vajngerl <qui...@gmail.com> Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> diff --git a/include/svx/svdmrkv.hxx b/include/svx/svdmrkv.hxx index 9ccf77ef2784..c7d7a4db4189 100644 --- a/include/svx/svdmrkv.hxx +++ b/include/svx/svdmrkv.hxx @@ -26,6 +26,8 @@ #include <svx/svdtypes.hxx> #include <svx/svxdllapi.h> #include <o3tl/typed_flags_set.hxx> +#include <basegfx/range/b2drectangle.hxx> + class SfxViewShell; @@ -84,6 +86,7 @@ enum class ImpGetDescriptionOptions }; class ImplMarkingOverlay; +class MarkingSubSelectionOverlay; class SVXCORE_DLLPUBLIC SdrMarkView : public SdrSnapView { @@ -94,6 +97,8 @@ class SVXCORE_DLLPUBLIC SdrMarkView : public SdrSnapView std::unique_ptr<ImplMarkingOverlay> mpMarkPointsOverlay; std::unique_ptr<ImplMarkingOverlay> mpMarkGluePointsOverlay; + std::unique_ptr<MarkingSubSelectionOverlay> mpMarkingSubSelectionOverlay; + protected: SdrObject* mpMarkedObj; // If not just one object ( i.e. More than one object ) is marked. SdrPageView* mpMarkedPV; // If all marked obects are situated on the same PageView. @@ -101,8 +106,10 @@ protected: Point maRef1; // Persistent - Rotation center / axis of reflection Point maRef2; // Persistent SdrHdlList maHdlList; + sdr::ViewSelection maSdrViewSelection; + std::vector<basegfx::B2DRectangle> maSubSelectionList; tools::Rectangle maMarkedObjRect; tools::Rectangle maMarkedPointsRect; tools::Rectangle maMarkedGluePointsRect; @@ -302,7 +309,8 @@ public: // Mark all objects within a rectangular area // Just objects are marked which are inclosed completely void MarkObj(const tools::Rectangle& rRect, bool bUnmark); - void MarkObj(SdrObject* pObj, SdrPageView* pPV, bool bUnmark=false, bool bImpNoSetMarkHdl=false); + void MarkObj(SdrObject* pObj, SdrPageView* pPV, bool bUnmark = false, bool bDoNoSetMarkHdl = false, + std::vector<basegfx::B2DRectangle> const & rSubSelections = std::vector<basegfx::B2DRectangle>()); void MarkAllObj(SdrPageView* pPV=nullptr); // pPage=NULL => all displayed pages void UnmarkAllObj(SdrPageView const * pPV=nullptr); // pPage=NULL => all displayed pages diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx index 988f33183a40..037bc7e4ad63 100644 --- a/svx/source/svdraw/svdmrkv.cxx +++ b/svx/source/svdraw/svdmrkv.cxx @@ -41,6 +41,7 @@ #include <sdr/overlay/overlayrollingrectangle.hxx> #include <svx/sdr/contact/objectcontact.hxx> #include <svx/sdr/overlay/overlaymanager.hxx> +#include <svx/sdr/overlay/overlayselection.hxx> #include <svx/sdr/contact/viewcontact.hxx> #include <svx/sdrpaintwindow.hxx> #include <svx/sdrpagewindow.hxx> @@ -125,6 +126,38 @@ void ImplMarkingOverlay::SetSecondPosition(const basegfx::B2DPoint& rNewPosition } } +class MarkingSubSelectionOverlay +{ + sdr::overlay::OverlayObjectList maObjects; + +public: + MarkingSubSelectionOverlay(const SdrPaintView& rView, std::vector<basegfx::B2DRectangle> const & rSelections) + { + if (comphelper::LibreOfficeKit::isActive()) + return; // We do client-side object manipulation with the Kit API + + for (sal_uInt32 a(0); a < rView.PaintWindowCount(); a++) + { + SdrPaintWindow* pCandidate = rView.GetPaintWindow(a); + const rtl::Reference<sdr::overlay::OverlayManager>& xTargetOverlay = pCandidate->GetOverlayManager(); + + if (xTargetOverlay.is()) + { + const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer; + const Color aHighlightColor = aSvtOptionsDrawinglayer.getHilightColor(); + + std::unique_ptr<sdr::overlay::OverlaySelection> pNew = + std::make_unique<sdr::overlay::OverlaySelection>( + sdr::overlay::OverlayType::Transparent, + aHighlightColor, rSelections, false); + + xTargetOverlay->add(*pNew); + maObjects.append(std::move(pNew)); + } + } + } +}; + // MarkView @@ -920,6 +953,8 @@ void SdrMarkView::SetMarkHandles(SfxViewShell* pOtherShell) SdrHdlKind eSaveKind(SdrHdlKind::Move); SdrObject* pSaveObj = nullptr; + mpMarkingSubSelectionOverlay.reset(); + if(pSaveOldFocusHdl && pSaveOldFocusHdl->GetObj() && dynamic_cast<const SdrPathObj*>(pSaveOldFocusHdl->GetObj()) != nullptr @@ -1014,6 +1049,11 @@ void SdrMarkView::SetMarkHandles(SfxViewShell* pOtherShell) { return; } + + if (!maSubSelectionList.empty()) + { + mpMarkingSubSelectionOverlay = std::make_unique<MarkingSubSelectionOverlay>(*this, maSubSelectionList); + } } tools::Rectangle aRect(GetMarkedObjRect()); @@ -1909,7 +1949,8 @@ void collectUIInformation(const SdrObject* pObj) } -void SdrMarkView::MarkObj(SdrObject* pObj, SdrPageView* pPV, bool bUnmark, bool bImpNoSetMarkHdl) +void SdrMarkView::MarkObj(SdrObject* pObj, SdrPageView* pPV, bool bUnmark, bool bDoNoSetMarkHdl, + std::vector<basegfx::B2DRectangle> const & rSubSelections) { if (pObj!=nullptr && pPV!=nullptr && IsObjMarkable(pObj, pPV)) { BrkAction(); @@ -1926,7 +1967,10 @@ void SdrMarkView::MarkObj(SdrObject* pObj, SdrPageView* pPV, bool bUnmark, bool GetMarkedObjectListWriteAccess().DeleteMark(nPos); } } - if (!bImpNoSetMarkHdl) { + + maSubSelectionList = rSubSelections; + + if (!bDoNoSetMarkHdl) { MarkListHasChanged(); AdjustMarkHdl(); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits