diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2022-06-28 22:27:37 +0200 |
---|---|---|
committer | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2022-06-28 22:37:51 +0200 |
commit | 4810b3b483d50b68aa7c8dd3be44e016b230a671 (patch) | |
tree | 3ca6618e42b588559d6decbe9443f6fc86bfc6b8 | |
parent | svx: extract SdrViewEvent into own header file (diff) | |
download | core-private/tvajngerl/staging.tar.gz core-private/tvajngerl/staging.zip |
svx: move SdrDropMarkerOverlay into it's own file
private/tvajngerl/staging
Change-Id: Ia09dcba2b7b469912f4f3b72a3cc60ded05a03ca
-rw-r--r-- | include/svx/sdr/view/DropMarkerOverlay.hxx | 42 | ||||
-rw-r--r-- | include/svx/svdview.hxx | 18 | ||||
-rw-r--r-- | sc/source/ui/inc/drawview.hxx | 1 | ||||
-rw-r--r-- | sd/source/ui/inc/View.hxx | 1 | ||||
-rw-r--r-- | svx/Library_svxcore.mk | 1 | ||||
-rw-r--r-- | svx/source/svdraw/svdview.cxx | 67 | ||||
-rw-r--r-- | svx/source/view/DropMarkerOverlay.cxx | 84 | ||||
-rw-r--r-- | sw/source/core/frmedt/feshview.cxx | 1 | ||||
-rw-r--r-- | sw/source/core/frmedt/fews.cxx | 1 | ||||
-rw-r--r-- | sw/source/uibase/docvw/edtdd.cxx | 1 | ||||
-rw-r--r-- | sw/source/uibase/docvw/edtwin.cxx | 1 |
11 files changed, 134 insertions, 84 deletions
diff --git a/include/svx/sdr/view/DropMarkerOverlay.hxx b/include/svx/sdr/view/DropMarkerOverlay.hxx new file mode 100644 index 000000000000..03f1419c7413 --- /dev/null +++ b/include/svx/sdr/view/DropMarkerOverlay.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/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <svx/svxdllapi.h> +#include <basegfx/polygon/b2dpolypolygon.hxx> +#include <svx/svdview.hxx> +#include <svx/sdr/overlay/overlaymanager.hxx> + +// helper class for all D&D overlays +class SVXCORE_DLLPUBLIC SdrDropMarkerOverlay +{ + // The OverlayObjects + sdr::overlay::OverlayObjectList maObjects; + + void ImplCreateOverlays(const SdrView& rView, const basegfx::B2DPolyPolygon& rLinePolyPolygon); + +public: + SdrDropMarkerOverlay(const SdrView& rView, const SdrObject& rObject); + SdrDropMarkerOverlay(const SdrView& rView, const tools::Rectangle& rRectangle); + SdrDropMarkerOverlay(const SdrView& rView, const Point& rStart, const Point& rEnd); + ~SdrDropMarkerOverlay(); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/svdview.hxx b/include/svx/svdview.hxx index 03afde95b00e..1e2627dc8807 100644 --- a/include/svx/svdview.hxx +++ b/include/svx/svdview.hxx @@ -52,24 +52,6 @@ namespace sdr::contact { class ObjectContact; } -// helper class for all D&D overlays -class SVXCORE_DLLPUBLIC SdrDropMarkerOverlay -{ - // The OverlayObjects - sdr::overlay::OverlayObjectList maObjects; - - void ImplCreateOverlays( - const SdrView& rView, - const basegfx::B2DPolyPolygon& rLinePolyPolygon); - -public: - SdrDropMarkerOverlay(const SdrView& rView, const SdrObject& rObject); - SdrDropMarkerOverlay(const SdrView& rView, const tools::Rectangle& rRectangle); - SdrDropMarkerOverlay(const SdrView& rView, const Point& rStart, const Point& rEnd); - ~SdrDropMarkerOverlay(); -}; - - class SVXCORE_DLLPUBLIC SdrView : public SdrCreateView, public tools::WeakBase { friend class SdrPageView; diff --git a/sc/source/ui/inc/drawview.hxx b/sc/source/ui/inc/drawview.hxx index 816a3428aacf..669f12969ba6 100644 --- a/sc/source/ui/inc/drawview.hxx +++ b/sc/source/ui/inc/drawview.hxx @@ -22,6 +22,7 @@ #include <svx/fmview.hxx> #include <global.hxx> +#include <svx/sdr/view/DropMarkerOverlay.hxx> namespace com::sun::star::datatransfer { class XTransferable; } diff --git a/sd/source/ui/inc/View.hxx b/sd/source/ui/inc/View.hxx index 4e530e3f9227..d26c5b261c38 100644 --- a/sd/source/ui/inc/View.hxx +++ b/sd/source/ui/inc/View.hxx @@ -26,6 +26,7 @@ #include <svx/fmview.hxx> #include <svx/svdpage.hxx> #include <vcl/idle.hxx> +#include <svx/sdr/view/DropMarkerOverlay.hxx> #include "smarttag.hxx" #include "fusearch.hxx" diff --git a/svx/Library_svxcore.mk b/svx/Library_svxcore.mk index 5cacdf82ebcc..440ef4dc69aa 100644 --- a/svx/Library_svxcore.mk +++ b/svx/Library_svxcore.mk @@ -463,6 +463,7 @@ $(eval $(call gb_Library_add_exception_objects,svxcore,\ svx/source/unodraw/unoshtxt \ svx/source/unodraw/unottabl \ svx/source/unodraw/XPropertyTable \ + svx/source/view/DropMarkerOverlay \ svx/source/xml/xmleohlp \ svx/source/xml/xmlexport \ svx/source/xml/xmlgrhlp \ diff --git a/svx/source/svdraw/svdview.cxx b/svx/source/svdraw/svdview.cxx index 7dc8ae174fc5..48850c6974c2 100644 --- a/svx/source/svdraw/svdview.cxx +++ b/svx/source/svdraw/svdview.cxx @@ -38,8 +38,6 @@ #include <svx/svddrgmt.hxx> #include <svx/svdotable.hxx> #include <tools/debug.hxx> -#include <svx/sdr/overlay/overlaypolypolygon.hxx> -#include <svx/sdr/overlay/overlaymanager.hxx> #include <svx/sdrpaintwindow.hxx> #include <svx/sdrpagewindow.hxx> #include <svx/sdrhittesthelper.hxx> @@ -51,70 +49,7 @@ #include <vcl/ptrstyle.hxx> #include <vcl/window.hxx> #include <comphelper/lok.hxx> - -// helper class for all D&D overlays - -void SdrDropMarkerOverlay::ImplCreateOverlays( - const SdrView& rView, - const basegfx::B2DPolyPolygon& rLinePolyPolygon) -{ - 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()) - { - std::unique_ptr<sdr::overlay::OverlayPolyPolygonStripedAndFilled> pNew(new sdr::overlay::OverlayPolyPolygonStripedAndFilled( - rLinePolyPolygon)); - - xTargetOverlay->add(*pNew); - maObjects.append(std::move(pNew)); - } - } -} - -SdrDropMarkerOverlay::SdrDropMarkerOverlay(const SdrView& rView, const SdrObject& rObject) -{ - ImplCreateOverlays( - rView, - rObject.TakeXorPoly()); -} - -SdrDropMarkerOverlay::SdrDropMarkerOverlay(const SdrView& rView, const tools::Rectangle& rRectangle) -{ - basegfx::B2DPolygon aB2DPolygon; - - aB2DPolygon.append(basegfx::B2DPoint(rRectangle.Left(), rRectangle.Top())); - aB2DPolygon.append(basegfx::B2DPoint(rRectangle.Right(), rRectangle.Top())); - aB2DPolygon.append(basegfx::B2DPoint(rRectangle.Right(), rRectangle.Bottom())); - aB2DPolygon.append(basegfx::B2DPoint(rRectangle.Left(), rRectangle.Bottom())); - aB2DPolygon.setClosed(true); - - ImplCreateOverlays( - rView, - basegfx::B2DPolyPolygon(aB2DPolygon)); -} - -SdrDropMarkerOverlay::SdrDropMarkerOverlay(const SdrView& rView, const Point& rStart, const Point& rEnd) -{ - basegfx::B2DPolygon aB2DPolygon; - - aB2DPolygon.append(basegfx::B2DPoint(rStart.X(), rStart.Y())); - aB2DPolygon.append(basegfx::B2DPoint(rEnd.X(), rEnd.Y())); - aB2DPolygon.setClosed(true); - - ImplCreateOverlays( - rView, - basegfx::B2DPolyPolygon(aB2DPolygon)); -} - -SdrDropMarkerOverlay::~SdrDropMarkerOverlay() -{ - // The OverlayObjects are cleared using the destructor of OverlayObjectList. - // That destructor calls clear() at the list which removes all objects from the - // OverlayManager and deletes them. -} +#include <svx/sdr/view/DropMarkerOverlay.hxx> SdrView::SdrView( SdrModel& rSdrModel, diff --git a/svx/source/view/DropMarkerOverlay.cxx b/svx/source/view/DropMarkerOverlay.cxx new file mode 100644 index 000000000000..3b0c7ee873b9 --- /dev/null +++ b/svx/source/view/DropMarkerOverlay.cxx @@ -0,0 +1,84 @@ +/* -*- 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/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include <svx/sdr/view/DropMarkerOverlay.hxx> +#include <svx/svdobj.hxx> +#include <svx/sdr/overlay/overlaypolypolygon.hxx> +#include <svx/sdrpaintwindow.hxx> + +// helper class for all D&D overlays + +void SdrDropMarkerOverlay::ImplCreateOverlays(const SdrView& rView, + const basegfx::B2DPolyPolygon& rLinePolyPolygon) +{ + 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()) + { + std::unique_ptr<sdr::overlay::OverlayPolyPolygonStripedAndFilled> pNew( + new sdr::overlay::OverlayPolyPolygonStripedAndFilled(rLinePolyPolygon)); + + xTargetOverlay->add(*pNew); + maObjects.append(std::move(pNew)); + } + } +} + +SdrDropMarkerOverlay::SdrDropMarkerOverlay(const SdrView& rView, const SdrObject& rObject) +{ + ImplCreateOverlays(rView, rObject.TakeXorPoly()); +} + +SdrDropMarkerOverlay::SdrDropMarkerOverlay(const SdrView& rView, const tools::Rectangle& rRectangle) +{ + basegfx::B2DPolygon aB2DPolygon; + + aB2DPolygon.append(basegfx::B2DPoint(rRectangle.Left(), rRectangle.Top())); + aB2DPolygon.append(basegfx::B2DPoint(rRectangle.Right(), rRectangle.Top())); + aB2DPolygon.append(basegfx::B2DPoint(rRectangle.Right(), rRectangle.Bottom())); + aB2DPolygon.append(basegfx::B2DPoint(rRectangle.Left(), rRectangle.Bottom())); + aB2DPolygon.setClosed(true); + + ImplCreateOverlays(rView, basegfx::B2DPolyPolygon(aB2DPolygon)); +} + +SdrDropMarkerOverlay::SdrDropMarkerOverlay(const SdrView& rView, const Point& rStart, + const Point& rEnd) +{ + basegfx::B2DPolygon aB2DPolygon; + + aB2DPolygon.append(basegfx::B2DPoint(rStart.X(), rStart.Y())); + aB2DPolygon.append(basegfx::B2DPoint(rEnd.X(), rEnd.Y())); + aB2DPolygon.setClosed(true); + + ImplCreateOverlays(rView, basegfx::B2DPolyPolygon(aB2DPolygon)); +} + +SdrDropMarkerOverlay::~SdrDropMarkerOverlay() +{ + // The OverlayObjects are cleared using the destructor of OverlayObjectList. + // That destructor calls clear() at the list which removes all objects from the + // OverlayManager and deletes them. +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx index 8369004ac3c5..d8efce1a9048 100644 --- a/sw/source/core/frmedt/feshview.cxx +++ b/sw/source/core/frmedt/feshview.cxx @@ -43,6 +43,7 @@ #include <svx/svdpage.hxx> #include <svx/svdpagv.hxx> #include <svx/dialmgr.hxx> +#include <svx/sdr/view/DropMarkerOverlay.hxx> #include <tools/globname.hxx> #include <sot/exchange.hxx> #include <IDocumentDrawModelAccess.hxx> diff --git a/sw/source/core/frmedt/fews.cxx b/sw/source/core/frmedt/fews.cxx index 0e9a0a2ca18e..130b4b0b0291 100644 --- a/sw/source/core/frmedt/fews.cxx +++ b/sw/source/core/frmedt/fews.cxx @@ -18,6 +18,7 @@ */ #include <svx/svdobj.hxx> +#include <svx/sdr/view/DropMarkerOverlay.hxx> #include <osl/diagnose.h> #include <comphelper/lok.hxx> #include <init.hxx> diff --git a/sw/source/uibase/docvw/edtdd.cxx b/sw/source/uibase/docvw/edtdd.cxx index 8f86aa1d310a..d697a65334b6 100644 --- a/sw/source/uibase/docvw/edtdd.cxx +++ b/sw/source/uibase/docvw/edtdd.cxx @@ -18,6 +18,7 @@ */ #include <svx/svdview.hxx> +#include <svx/sdr/view/DropMarkerOverlay.hxx> #include <editeng/outliner.hxx> #include <svx/svdobj.hxx> #include <sot/exchange.hxx> diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx index 420da9d0b295..0c4d98108916 100644 --- a/sw/source/uibase/docvw/edtwin.cxx +++ b/sw/source/uibase/docvw/edtwin.cxx @@ -58,6 +58,7 @@ #include <svx/svdview.hxx> #include <svx/svdhdl.hxx> #include <svx/svdoutl.hxx> +#include <svx/sdr/view/DropMarkerOverlay.hxx> #include <editeng/editeng.hxx> #include <editeng/editview.hxx> #include <editeng/svxacorr.hxx> |