diff options
Diffstat (limited to 'svx/source/svdraw')
-rw-r--r-- | svx/source/svdraw/svdcrtv.cxx | 9 | ||||
-rw-r--r-- | svx/source/svdraw/svddrgmt.cxx | 23 | ||||
-rw-r--r-- | svx/source/svdraw/svdedxv.cxx | 81 | ||||
-rw-r--r-- | svx/source/svdraw/svdhdl.cxx | 21 | ||||
-rw-r--r-- | svx/source/svdraw/svdobj.cxx | 54 | ||||
-rw-r--r-- | svx/source/svdraw/svdview.cxx | 31 |
6 files changed, 127 insertions, 92 deletions
diff --git a/svx/source/svdraw/svdcrtv.cxx b/svx/source/svdraw/svdcrtv.cxx index e6980bd72006..10bcaed1aac4 100644 --- a/svx/source/svdraw/svdcrtv.cxx +++ b/svx/source/svdraw/svdcrtv.cxx @@ -73,7 +73,8 @@ ImplConnectMarkerOverlay::ImplConnectMarkerOverlay(const SdrCreateView& rView, S Size aHalfLogicSize(xTargetOverlay->getOutputDevice().PixelToLogic(Size(4, 4))); // object - ::sdr::overlay::OverlayPolyPolygonStriped* pNew = new ::sdr::overlay::OverlayPolyPolygonStriped(aB2DPolyPolygon); + ::sdr::overlay::OverlayPolyPolygonStripedAndFilled* pNew = new ::sdr::overlay::OverlayPolyPolygonStripedAndFilled( + aB2DPolyPolygon); xTargetOverlay->add(*pNew); maObjects.append(*pNew); @@ -98,7 +99,8 @@ ImplConnectMarkerOverlay::ImplConnectMarkerOverlay(const SdrCreateView& rView, S basegfx::B2DPolyPolygon aTempPolyPoly; aTempPolyPoly.append(aTempPoly); - pNew = new ::sdr::overlay::OverlayPolyPolygonStriped(aTempPolyPoly); + pNew = new ::sdr::overlay::OverlayPolyPolygonStripedAndFilled( + aTempPolyPoly); xTargetOverlay->add(*pNew); maObjects.append(*pNew); } @@ -159,7 +161,8 @@ void ImpSdrCreateViewExtraData::CreateAndShowOverlay(const SdrCreateView& rView, if(rPolyPoly.count()) { - ::sdr::overlay::OverlayPolyPolygonStriped* pNew = new ::sdr::overlay::OverlayPolyPolygonStriped(rPolyPoly); + ::sdr::overlay::OverlayPolyPolygonStripedAndFilled* pNew = new ::sdr::overlay::OverlayPolyPolygonStripedAndFilled( + rPolyPoly); xOverlayManager->add(*pNew); maObjects.append(*pNew); } diff --git a/svx/source/svdraw/svddrgmt.cxx b/svx/source/svdraw/svddrgmt.cxx index d79d5f2add25..2255d58ad9a8 100644 --- a/svx/source/svdraw/svddrgmt.cxx +++ b/svx/source/svdraw/svddrgmt.cxx @@ -56,6 +56,7 @@ #include <svx/svdopath.hxx> #include <svx/polypolygoneditor.hxx> #include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx> +#include <drawinglayer/primitive2d/polygonprimitive2d.hxx> #include <drawinglayer/primitive2d/transformprimitive2d.hxx> #include <drawinglayer/primitive2d/markerarrayprimitive2d.hxx> #include <svx/sdr/primitive2d/sdrattributecreator.hxx> @@ -113,10 +114,22 @@ drawinglayer::primitive2d::Primitive2DSequence SdrDragEntryPolyPolygon::createPr aColB.invert(); } - drawinglayer::primitive2d::Primitive2DReference aPolyPolygonMarkerPrimitive2D( - new drawinglayer::primitive2d::PolyPolygonMarkerPrimitive2D(aCopy, aColA, aColB, fStripeLength)); + aRetval.realloc(2); + aRetval[0] = new drawinglayer::primitive2d::PolyPolygonMarkerPrimitive2D( + aCopy, + aColA, + aColB, + fStripeLength); - aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aPolyPolygonMarkerPrimitive2D, 1); + const basegfx::BColor aHilightColor(aSvtOptionsDrawinglayer.getHilightColor().getBColor()); + const double fTransparence(aSvtOptionsDrawinglayer.GetTransparentSelectionPercent() * 0.01); + + aRetval[1] = new drawinglayer::primitive2d::PolyPolygonSelectionPrimitive2D( + aCopy, + aHilightColor, + fTransparence, + 3.0, + false); } return aRetval; @@ -936,8 +949,8 @@ drawinglayer::primitive2d::Primitive2DSequence SdrDragMethod::AddConnectorOverla } drawinglayer::primitive2d::Primitive2DReference aPolyPolygonMarkerPrimitive2D( - new drawinglayer::primitive2d::PolyPolygonMarkerPrimitive2D( - basegfx::B2DPolyPolygon(aEdgePolygon), aColA, aColB, fStripeLength)); + new drawinglayer::primitive2d::PolygonMarkerPrimitive2D( + aEdgePolygon, aColA, aColB, fStripeLength)); drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, aPolyPolygonMarkerPrimitive2D); } } diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx index 273480f83366..492b0a754365 100644 --- a/svx/source/svdraw/svdedxv.cxx +++ b/svx/source/svdraw/svdedxv.cxx @@ -17,14 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ - #include <com/sun/star/i18n/WordType.hpp> - #include <svtools/accessibilityoptions.hxx> - #include <svx/svdedxv.hxx> #include <svl/solar.hrc> - #include <svl/itemiter.hxx> #include <vcl/msgbox.hxx> #include <vcl/hatch.hxx> @@ -33,7 +29,6 @@ #include <editeng/editstat.hxx> #include <vcl/cursor.hxx> #include <editeng/unotext.hxx> - #include <editeng/editdata.hxx> #include <editeng/editeng.hxx> #include <editeng/editobj.hxx> @@ -46,24 +41,26 @@ #include "svx/svditer.hxx" #include "svx/svdpagv.hxx" #include "svx/svdpage.hxx" -#include "svx/svdetc.hxx" // for GetDraftFillColor +#include "svx/svdetc.hxx" #include "svx/svdotable.hxx" #include <svx/selectioncontroller.hxx> #ifdef DBG_UTIL #include <svdibrow.hxx> #endif - -#include <svx/svddrgv.hxx> // for SetSolidDragging() -#include "svx/svdstr.hrc" // names taken from the resource -#include "svx/svdglob.hxx" // StringCache +#include <svx/svdoutl.hxx> +#include <svx/svddrgv.hxx> +#include "svx/svdstr.hrc" +#include "svx/svdglob.hxx" #include "svx/globl3d.hxx" #include <editeng/outliner.hxx> #include <editeng/adjustitem.hxx> - #include <svtools/colorcfg.hxx> #include <vcl/svapp.hxx> #include <svx/sdrpaintwindow.hxx> #include <svx/sdrundomanager.hxx> +#include <svx/sdr/overlay/overlaytools.hxx> +#include <drawinglayer/processor2d/baseprocessor2d.hxx> +#include <drawinglayer/processor2d/processorfromoutputdevice.hxx> //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -344,44 +341,36 @@ void SdrObjEditView::ImpPaintOutlinerView(OutlinerView& rOutlView, const Rectang if(bTextFrame && !bFitToSize) { - aPixRect.Left()--; - aPixRect.Top()--; - aPixRect.Right()++; - aPixRect.Bottom()++; - sal_uInt16 nPixSiz(rOutlView.GetInvalidateMore() - 1); + // completely reworked to use primitives; this ensures same look and functionality + const drawinglayer::geometry::ViewInformation2D aViewInformation2D; + + drawinglayer::processor2d::BaseProcessor2D* pProcessor = drawinglayer::processor2d::createBaseProcessor2DFromOutputDevice( + rTargetDevice, + aViewInformation2D); + if(pProcessor) { - // xPixRect Begrenzen, wegen Treiberproblem bei zu weit hinausragenden Pixelkoordinaten - Size aMaxXY(rTargetDevice.GetOutputSizePixel()); - long a(2 * nPixSiz); - long nMaxX(aMaxXY.Width() + a); - long nMaxY(aMaxXY.Height() + a); - - if (aPixRect.Left ()<-a) aPixRect.Left()=-a; - if (aPixRect.Top ()<-a) aPixRect.Top ()=-a; - if (aPixRect.Right ()>nMaxX) aPixRect.Right ()=nMaxX; - if (aPixRect.Bottom()>nMaxY) aPixRect.Bottom()=nMaxY; + const bool bMerk(rTargetDevice.IsMapModeEnabled()); + const basegfx::B2DRange aRange(aPixRect.Left(), aPixRect.Top(), aPixRect.Right(), aPixRect.Bottom()); + const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer; + const Color aHilightColor(aSvtOptionsDrawinglayer.getHilightColor()); + const double fTransparence(aSvtOptionsDrawinglayer.GetTransparentSelectionPercent() * 0.01); + const sal_uInt16 nPixSiz(rOutlView.GetInvalidateMore() - 1); + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::OverlayRectanglePrimitive( + aRange, + aHilightColor.getBColor(), + fTransparence, + std::max(6, nPixSiz - 2), // grow + 0.0, // shrink + 0.0)); + const drawinglayer::primitive2d::Primitive2DSequence aSequence(&xReference, 1); + + rTargetDevice.EnableMapMode(false); + pProcessor->process(aSequence); + rTargetDevice.EnableMapMode(bMerk); + delete pProcessor; } - - Rectangle aOuterPix(aPixRect); - aOuterPix.Left()-=nPixSiz; - aOuterPix.Top()-=nPixSiz; - aOuterPix.Right()+=nPixSiz; - aOuterPix.Bottom()+=nPixSiz; - - bool bMerk(rTargetDevice.IsMapModeEnabled()); - rTargetDevice.EnableMapMode(sal_False); - PolyPolygon aPolyPoly( 2 ); - - svtools::ColorConfig aColorConfig; - Color aHatchCol( aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor ); - const Hatch aHatch( HATCH_SINGLE, aHatchCol, 3, 450 ); - - aPolyPoly.Insert( aOuterPix ); - aPolyPoly.Insert( aPixRect ); - rTargetDevice.DrawHatch( aPolyPoly, aHatch ); - - rTargetDevice.EnableMapMode(bMerk); } rOutlView.ShowCursor(); diff --git a/svx/source/svdraw/svdhdl.cxx b/svx/source/svdraw/svdhdl.cxx index fa7dc52b3318..5a03983b0c64 100644 --- a/svx/source/svdraw/svdhdl.cxx +++ b/svx/source/svdraw/svdhdl.cxx @@ -50,7 +50,7 @@ #include <svx/sdr/overlay/overlaybitmapex.hxx> #include <svx/sdr/overlay/overlayline.hxx> #include <svx/sdr/overlay/overlaytriangle.hxx> -#include <svx/sdr/overlay/overlayhatchrect.hxx> +#include <svx/sdr/overlay/overlayrectangle.hxx> #include <svx/sdrpagewindow.hxx> #include <svx/sdrpaintwindow.hxx> #include <vcl/svapp.hxx> @@ -1402,7 +1402,8 @@ void E3dVolumeMarker::CreateB2dIAObject() if (xManager.is() && aWireframePoly.count()) { ::sdr::overlay::OverlayObject* pNewOverlayObject = new - ::sdr::overlay::OverlayPolyPolygonStriped(aWireframePoly); + ::sdr::overlay::OverlayPolyPolygonStripedAndFilled( + aWireframePoly); DBG_ASSERT(pNewOverlayObject, "Got NO new IAO!"); // OVERLAYMANAGER @@ -1654,17 +1655,21 @@ void ImpTextframeHdl::CreateB2dIAObject() { const basegfx::B2DPoint aTopLeft(maRect.Left(), maRect.Top()); const basegfx::B2DPoint aBottomRight(maRect.Right(), maRect.Bottom()); - const svtools::ColorConfig aColorConfig; - const Color aHatchCol( aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor ); + const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer; + const Color aHilightColor(aSvtOptionsDrawinglayer.getHilightColor()); + const double fTransparence(aSvtOptionsDrawinglayer.GetTransparentSelectionPercent() * 0.01); - ::sdr::overlay::OverlayHatchRect* pNewOverlayObject = new ::sdr::overlay::OverlayHatchRect( + ::sdr::overlay::OverlayRectangle* pNewOverlayObject = new ::sdr::overlay::OverlayRectangle( aTopLeft, aBottomRight, - aHatchCol, + aHilightColor, + fTransparence, 3.0, 3.0, - 45 * F_PI180, - nDrehWink * -F_PI18000); + nDrehWink * -F_PI18000, + 500, + true); // allow animation; the Handle is not shown at text edit time + pNewOverlayObject->setHittable(false); // OVERLAYMANAGER diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx index 98e3b9a6dfb9..6930128ad850 100644 --- a/svx/source/svdraw/svdobj.cxx +++ b/svx/source/svdraw/svdobj.cxx @@ -2416,6 +2416,33 @@ SdrObject* SdrObject::GetConnectedNode(bool /*bTail1*/) const //////////////////////////////////////////////////////////////////////////////////////////////////// +void extractLineContourFromPrimitive2DSequence( + const drawinglayer::primitive2d::Primitive2DSequence& rxSequence, + basegfx::B2DPolygonVector& rExtractedHairlines, + basegfx::B2DPolyPolygonVector& rExtractedLineFills) +{ + rExtractedHairlines.clear(); + rExtractedLineFills.clear(); + + if(rxSequence.hasElements()) + { + // use neutral ViewInformation + const drawinglayer::geometry::ViewInformation2D aViewInformation2D; + + // create extractor, process and get result + drawinglayer::processor2d::LineGeometryExtractor2D aExtractor(aViewInformation2D); + aExtractor.process(rxSequence); + + // copy line results + rExtractedHairlines = aExtractor.getExtractedHairlines(); + + // copy fill rsults + rExtractedLineFills = aExtractor.getExtractedLineFills(); + } +} + +//////////////////////////////////////////////////////////////////////////////////////////////////// + SdrObject* SdrObject::ImpConvertToContourObj(SdrObject* pRet, bool bForceLineDash) const { bool bNoChange(true); @@ -2428,37 +2455,28 @@ SdrObject* SdrObject::ImpConvertToContourObj(SdrObject* pRet, bool bForceLineDas if(xSequence.hasElements()) { - // use neutral ViewInformation - const drawinglayer::geometry::ViewInformation2D aViewInformation2D; - - // create extractor, process and get result - drawinglayer::processor2d::LineGeometryExtractor2D aExtractor(aViewInformation2D); - aExtractor.process(xSequence); + basegfx::B2DPolygonVector aExtractedHairlines; + basegfx::B2DPolyPolygonVector aExtractedLineFills; - // #i102241# check for line results - const basegfx::B2DPolygonVector& rHairlineVector = aExtractor.getExtractedHairlines(); + extractLineContourFromPrimitive2DSequence(xSequence, aExtractedHairlines, aExtractedLineFills); - if(!rHairlineVector.empty()) + if(!aExtractedHairlines.empty()) { // for SdrObject creation, just copy all to a single Hairline-PolyPolygon - for(sal_uInt32 a(0); a < rHairlineVector.size(); a++) + for(sal_uInt32 a(0); a < aExtractedHairlines.size(); a++) { - aMergedHairlinePolyPolygon.append(rHairlineVector[a]); + aMergedHairlinePolyPolygon.append(aExtractedHairlines[a]); } } - // #i102241# check for fill rsults - const basegfx::B2DPolyPolygonVector& rLineFillVector(aExtractor.getExtractedLineFills()); - - if(!rLineFillVector.empty()) + // check for fill rsults + if(!aExtractedLineFills.empty()) { // merge to a single PolyPolygon (OR) - aMergedLineFillPolyPolygon = basegfx::tools::mergeToSinglePolyPolygon(rLineFillVector); + aMergedLineFillPolyPolygon = basegfx::tools::mergeToSinglePolyPolygon(aExtractedLineFills); } } - // || aMergedHairlinePolyPolygon.Count() removed; the conversion is ONLY - // useful when new closed filled polygons are created if(aMergedLineFillPolyPolygon.count() || (bForceLineDash && aMergedHairlinePolyPolygon.count())) { SfxItemSet aSet(pRet->GetMergedItemSet()); diff --git a/svx/source/svdraw/svdview.cxx b/svx/source/svdraw/svdview.cxx index ea1c73700395..b9338608d60e 100644 --- a/svx/source/svdraw/svdview.cxx +++ b/svx/source/svdraw/svdview.cxx @@ -47,6 +47,8 @@ #include <svx/sdrpaintwindow.hxx> #include <svx/sdrpagewindow.hxx> #include <svx/sdrhittesthelper.hxx> +#include <svx/sdr/contact/viewcontact.hxx> +#include <drawinglayer/processor2d/contourextractor2d.hxx> //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -89,7 +91,9 @@ SdrViewEvent::~SdrViewEvent() //////////////////////////////////////////////////////////////////////////////////////////////////// // helper class for all D&D overlays -void SdrDropMarkerOverlay::ImplCreateOverlays(const SdrView& rView, const basegfx::B2DPolyPolygon& rPolyPolygon) +void SdrDropMarkerOverlay::ImplCreateOverlays( + const SdrView& rView, + const basegfx::B2DPolyPolygon& rLinePolyPolygon) { for(sal_uInt32 a(0L); a < rView.PaintWindowCount(); a++) { @@ -98,8 +102,9 @@ void SdrDropMarkerOverlay::ImplCreateOverlays(const SdrView& rView, const basegf if (xTargetOverlay.is()) { - ::sdr::overlay::OverlayPolyPolygonStriped* pNew = new ::sdr::overlay::OverlayPolyPolygonStriped( - rPolyPolygon); + ::sdr::overlay::OverlayPolyPolygonStripedAndFilled* pNew = new ::sdr::overlay::OverlayPolyPolygonStripedAndFilled( + rLinePolyPolygon); + xTargetOverlay->add(*pNew); maObjects.append(*pNew); } @@ -108,35 +113,37 @@ void SdrDropMarkerOverlay::ImplCreateOverlays(const SdrView& rView, const basegf SdrDropMarkerOverlay::SdrDropMarkerOverlay(const SdrView& rView, const SdrObject& rObject) { - ImplCreateOverlays(rView, rObject.TakeXorPoly()); + ImplCreateOverlays( + rView, + rObject.TakeXorPoly()); } SdrDropMarkerOverlay::SdrDropMarkerOverlay(const SdrView& rView, const 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); - basegfx::B2DPolyPolygon aB2DPolyPolygon; - aB2DPolyPolygon.append(aB2DPolygon); - - ImplCreateOverlays(rView, aB2DPolyPolygon); + 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); - basegfx::B2DPolyPolygon aB2DPolyPolygon; - aB2DPolyPolygon.append(aB2DPolygon); - - ImplCreateOverlays(rView, aB2DPolyPolygon); + ImplCreateOverlays( + rView, + basegfx::B2DPolyPolygon(aB2DPolygon)); } SdrDropMarkerOverlay::~SdrDropMarkerOverlay() |