[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - include/svx svx/source
Tomaž Vajngerl (via logerrit)
logerrit at kemper.freedesktop.org
Tue Jun 9 13:23:19 UTC 2020
include/svx/svdmrkv.hxx | 10 +++++++-
svx/source/svdraw/svdmrkv.cxx | 48 ++++++++++++++++++++++++++++++++++++++++--
2 files changed, 55 insertions(+), 3 deletions(-)
New commits:
commit fe69802e22bb2c8365b7542f3f0fbf71cb6182e7
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Wed May 27 15:27:14 2020 +0200
Commit: Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Tue Jun 9 15:22:23 2020 +0200
svx: add ability to show sub-selections in a marked object
Draws selection rectangles inside the object window.
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95347
Tested-by: Tomaž Vajngerl <quikee at gmail.com>
Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
(cherry picked from commit cf812f15b3295a17a9b5d7e3a1c51b00dcbf2629)
Change-Id: I994477426489ea4cea89c86f9e51c9978f16b350
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95921
Tested-by: Tomaž Vajngerl <quikee at gmail.com>
Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
diff --git a/include/svx/svdmrkv.hxx b/include/svx/svdmrkv.hxx
index 5b57da626d4f..f080a57d1bbb 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 SVX_DLLPUBLIC SdrMarkView : public SdrSnapView
{
@@ -94,6 +97,8 @@ class SVX_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 c6dd6928c755..326de3db561f 100644
--- a/svx/source/svdraw/svdmrkv.cxx
+++ b/svx/source/svdraw/svdmrkv.cxx
@@ -48,6 +48,7 @@
#include <sdr/overlay/overlayrollingrectangle.hxx>
#include <svx/sdr/overlay/overlaymanager.hxx>
#include <svx/sdr/table/tablecontroller.hxx>
+#include <svx/sdr/overlay/overlayselection.hxx>
#include <svx/sdr/contact/viewcontact.hxx>
#include <svx/sdrpaintwindow.hxx>
#include <svx/sdrpagewindow.hxx>
@@ -134,6 +135,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
@@ -929,6 +962,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
@@ -1023,6 +1058,11 @@ void SdrMarkView::SetMarkHandles(SfxViewShell* pOtherShell)
{
return;
}
+
+ if (!maSubSelectionList.empty())
+ {
+ mpMarkingSubSelectionOverlay = std::make_unique<MarkingSubSelectionOverlay>(*this, maSubSelectionList);
+ }
}
tools::Rectangle aRect(GetMarkedObjRect());
@@ -1918,7 +1958,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();
@@ -1935,7 +1976,10 @@ void SdrMarkView::MarkObj(SdrObject* pObj, SdrPageView* pPV, bool bUnmark, bool
GetMarkedObjectListWriteAccess().DeleteMark(nPos);
}
}
- if (!bImpNoSetMarkHdl) {
+
+ maSubSelectionList = rSubSelections;
+
+ if (!bDoNoSetMarkHdl) {
MarkListHasChanged();
AdjustMarkHdl();
}
More information about the Libreoffice-commits
mailing list