From 5aee0c13cc62a81a38d4132db7972dc301c21b3d Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Tue, 29 Jan 2013 12:32:36 +0000 Subject: Resolves: #i121532# enhanced visualisation of text edit&selection D&D overhauled (cherry picked from commit c6e63b6bbb6b4a63fe1302de57fc32cd28432378) Conflicts: drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx drawinglayer/inc/drawinglayer/primitive2d/polypolygonprimitive2d.hxx drawinglayer/inc/drawinglayer/processor2d/linegeometryextractor2d.hxx drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx svx/Package_inc.mk svx/inc/svx/sdr/overlay/overlayanimatedbitmapex.hxx svx/inc/svx/sdr/overlay/overlayobject.hxx svx/inc/svx/sdr/overlay/overlaypolypolygon.hxx svx/inc/svx/sdr/overlay/overlayrectangle.hxx svx/inc/svx/sdr/overlay/overlaytools.hxx svx/inc/svx/sdr/primitive2d/svx_primitivetypes2d.hxx svx/inc/svx/svdview.hxx svx/source/engine3d/view3d.cxx svx/source/sdr/overlay/overlayanimatedbitmapex.cxx svx/source/sdr/overlay/overlayhatchrect.cxx svx/source/sdr/overlay/overlaypolypolygon.cxx svx/source/sdr/overlay/overlaytools.cxx svx/source/svdraw/svdcrtv.cxx svx/source/svdraw/svdedxv.cxx svx/source/svdraw/svdhdl.cxx svx/source/svdraw/svdobj.cxx svx/source/svdraw/svdview.cxx sw/source/ui/dochdl/swdtflvr.cxx Unname unused arguments to prevent WaE issues. (cherry picked from commit 0735a61e631b8d4bb3d4e889bee436fb9e7c5734) Change-Id: I3b1cf4754063985dc1b4adac44b33e52e200607f e4288936cadd1f6e06bdf79611536d7114236b56 --- .../controller/main/DragMethod_RotateDiagram.cxx | 3 +- .../source/primitive2d/polypolygonprimitive2d.cxx | 112 ++++++++++++++- .../primitive2d/drawinglayer_primitivetypes2d.hxx | 3 +- .../primitive2d/polypolygonprimitive2d.hxx | 65 +++++++++ .../processor2d/linegeometryextractor2d.hxx | 2 +- .../svx/sdr/overlay/overlayanimatedbitmapex.hxx | 9 +- include/svx/sdr/overlay/overlayobject.hxx | 3 + include/svx/sdr/overlay/overlaypolypolygon.hxx | 13 +- include/svx/sdr/overlay/overlayrectangle.hxx | 87 ++++++++++++ include/svx/sdr/overlay/overlaytools.hxx | 21 ++- .../svx/sdr/primitive2d/svx_primitivetypes2d.hxx | 2 +- include/svx/svdview.hxx | 6 +- sd/source/ui/view/sdview2.cxx | 8 +- sd/source/ui/view/sdview3.cxx | 97 ++++++++----- svx/Library_svxcore.mk | 2 +- svx/source/engine3d/dragmt3d.cxx | 3 +- svx/source/engine3d/view3d.cxx | 3 +- svx/source/sdr/overlay/overlayanimatedbitmapex.cxx | 15 +-- svx/source/sdr/overlay/overlayhatchrect.cxx | 71 ---------- svx/source/sdr/overlay/overlaymanager.cxx | 10 +- svx/source/sdr/overlay/overlayobject.cxx | 14 ++ svx/source/sdr/overlay/overlaypolypolygon.cxx | 33 +++-- svx/source/sdr/overlay/overlayrectangle.cxx | 150 +++++++++++++++++++++ svx/source/sdr/overlay/overlayrollingrectangle.cxx | 26 ++-- svx/source/sdr/overlay/overlaytools.cxx | 119 ++++++++++------ svx/source/svdraw/svdcrtv.cxx | 9 +- svx/source/svdraw/svddrgmt.cxx | 23 +++- svx/source/svdraw/svdedxv.cxx | 81 +++++------ svx/source/svdraw/svdhdl.cxx | 21 +-- svx/source/svdraw/svdobj.cxx | 54 +++++--- svx/source/svdraw/svdview.cxx | 31 +++-- svx/source/table/svdotable.cxx | 2 +- svx/source/table/tablehandles.cxx | 31 +++-- svx/source/table/tablehandles.hxx | 8 +- sw/source/core/frmedt/fecopy.cxx | 38 +++++- sw/source/ui/dochdl/swdtflvr.cxx | 90 ++++++++++--- sw/source/ui/inc/swdtflvr.hxx | 4 +- 37 files changed, 932 insertions(+), 337 deletions(-) create mode 100644 include/svx/sdr/overlay/overlayrectangle.hxx delete mode 100644 svx/source/sdr/overlay/overlayhatchrect.cxx create mode 100644 svx/source/sdr/overlay/overlayrectangle.cxx diff --git a/chart2/source/controller/main/DragMethod_RotateDiagram.cxx b/chart2/source/controller/main/DragMethod_RotateDiagram.cxx index 00cada78f8a1..a983d85ba5b8 100644 --- a/chart2/source/controller/main/DragMethod_RotateDiagram.cxx +++ b/chart2/source/controller/main/DragMethod_RotateDiagram.cxx @@ -215,7 +215,8 @@ void DragMethod_RotateDiagram::CreateOverlayGeometry(sdr::overlay::OverlayManage // transform to 2D view coordinates aPolyPolygon.transform(rVCScene.getObjectTransformation()); - sdr::overlay::OverlayPolyPolygonStriped* pNew = new ::sdr::overlay::OverlayPolyPolygonStriped(aPolyPolygon); + sdr::overlay::OverlayPolyPolygonStripedAndFilled* pNew = new ::sdr::overlay::OverlayPolyPolygonStripedAndFilled( + aPolyPolygon); rOverlayManager.add(*pNew); addToOverlayObjectList(*pNew); } diff --git a/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx b/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx index 7cd2a1a1b50c..39cbdd87a1ff 100644 --- a/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx @@ -28,6 +28,8 @@ #include #include #include +#include +#include #include ////////////////////////////////////////////////////////////////////////////// @@ -111,7 +113,12 @@ namespace drawinglayer for(sal_uInt32 a(0L); a < nCount; a++) { - aRetval[a] = Primitive2DReference(new PolygonMarkerPrimitive2D(aPolyPolygon.getB2DPolygon(a), getRGBColorA(), getRGBColorB(), getDiscreteDashLength())); + aRetval[a] = Primitive2DReference( + new PolygonMarkerPrimitive2D( + aPolyPolygon.getB2DPolygon(a), + getRGBColorA(), + getRGBColorB(), + getDiscreteDashLength())); } return aRetval; @@ -473,4 +480,107 @@ namespace drawinglayer } // end of namespace primitive2d } // end of namespace drawinglayer +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + Primitive2DSequence PolyPolygonSelectionPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + { + Primitive2DSequence aRetval; + + if(getTransparence() < 1.0 && getB2DPolyPolygon().count()) + { + if(getFill() && getB2DPolyPolygon().isClosed()) + { + // create fill primitive + const Primitive2DReference aFill( + new PolyPolygonColorPrimitive2D( + getB2DPolyPolygon(), + getColor())); + + aRetval = Primitive2DSequence(&aFill, 1); + } + + if(getDiscreteGrow() > 0.0) + { + const attribute::LineAttribute aLineAttribute( + getColor(), + getDiscreteGrow() * getDiscreteUnit() * 2.0); + const Primitive2DReference aFatLine( + new PolyPolygonStrokePrimitive2D( + getB2DPolyPolygon(), + aLineAttribute)); + + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, aFatLine); + } + + // embed filled to transparency (if used) + if(aRetval.getLength() && getTransparence() > 0.0) + { + const Primitive2DReference aTrans( + new UnifiedTransparencePrimitive2D( + aRetval, + getTransparence())); + + aRetval = Primitive2DSequence(&aTrans, 1); + } + } + + return aRetval; + } + + PolyPolygonSelectionPrimitive2D::PolyPolygonSelectionPrimitive2D( + const basegfx::B2DPolyPolygon& rPolyPolygon, + const basegfx::BColor& rColor, + double fTransparence, + double fDiscreteGrow, + bool bFill) + : DiscreteMetricDependentPrimitive2D(), + maPolyPolygon(rPolyPolygon), + maColor(rColor), + mfTransparence(fTransparence), + mfDiscreteGrow(fabs(fDiscreteGrow)), + mbFill(bFill) + { + } + + bool PolyPolygonSelectionPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const + { + if(DiscreteMetricDependentPrimitive2D::operator==(rPrimitive)) + { + const PolyPolygonSelectionPrimitive2D& rCompare = (PolyPolygonSelectionPrimitive2D&)rPrimitive; + + return (getB2DPolyPolygon() == rCompare.getB2DPolyPolygon() + && getColor() == rCompare.getColor() + && getTransparence() == rCompare.getTransparence() + && getDiscreteGrow() == rCompare.getDiscreteGrow() + && getFill() == rCompare.getFill()); + } + + return false; + } + + basegfx::B2DRange PolyPolygonSelectionPrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const + { + basegfx::B2DRange aRetval(basegfx::tools::getRange(getB2DPolyPolygon())); + + if(getDiscreteGrow() > 0.0) + { + // get the current DiscreteUnit (not sure if getDiscreteUnit() is updated here, better go safe way) + const double fDiscreteUnit((rViewInformation.getInverseObjectToViewTransformation() * basegfx::B2DVector(1.0, 0.0)).getLength()); + + aRetval.grow(fDiscreteUnit * getDiscreteGrow()); + } + + return aRetval; + } + + // provide unique ID + ImplPrimitive2DIDBlock(PolyPolygonSelectionPrimitive2D, PRIMITIVE2D_ID_POLYPOLYGONSELECTIONPRIMITIVE2D) + + } // end of namespace primitive2d +} // end of namespace drawinglayer + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx b/include/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx index c6467f482c70..2899b37244e1 100644 --- a/include/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx +++ b/include/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx @@ -101,7 +101,8 @@ #define PRIMITIVE2D_ID_CROPPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 66) #define PRIMITIVE2D_ID_PATTERNFILLPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 67) #define PRIMITIVE2D_ID_OBJECTINFOPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 68) -#define PRIMITIVE2D_ID_CLIPPEDBORDERLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 69) +#define PRIMITIVE2D_ID_POLYPOLYGONSELECTIONPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 69) +#define PRIMITIVE2D_ID_CLIPPEDBORDERLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 70) ////////////////////////////////////////////////////////////////////////////// diff --git a/include/drawinglayer/primitive2d/polypolygonprimitive2d.hxx b/include/drawinglayer/primitive2d/polypolygonprimitive2d.hxx index 0679ce4deb8c..4afb5edf501d 100644 --- a/include/drawinglayer/primitive2d/polypolygonprimitive2d.hxx +++ b/include/drawinglayer/primitive2d/polypolygonprimitive2d.hxx @@ -30,6 +30,7 @@ #include #include #include +#include #include ////////////////////////////////////////////////////////////////////////////// @@ -375,6 +376,70 @@ namespace drawinglayer } // end of namespace primitive2d } // end of namespace drawinglayer +////////////////////////////////////////////////////////////////////////////// +// PolyPolygonSelectionPrimitive2D class + +namespace drawinglayer +{ + namespace primitive2d + { + /** PolyPolygonSelectionPrimitive2D class + + This primitive defines a PolyPolygon which gets filled with a defined color + and a defined transparence, but also gets extended ('grown') by the given + discrete size (thus being a view-dependent primitive) + */ + class DRAWINGLAYER_DLLPUBLIC PolyPolygonSelectionPrimitive2D : public DiscreteMetricDependentPrimitive2D + { + private: + /// the PolyPolygon geometry + basegfx::B2DPolyPolygon maPolyPolygon; + + /// the color + basegfx::BColor maColor; + + /// the transparence [0.0 .. 1.0] + double mfTransparence; + + /// the discrete grow size ('pixels'), only posivive values allowed + double mfDiscreteGrow; + + /// bitfield + /// draw polygons filled when fill is set + bool mbFill : 1; + + protected: + /// local decomposition. + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + + public: + /// constructor + PolyPolygonSelectionPrimitive2D( + const basegfx::B2DPolyPolygon& rPolyPolygon, + const basegfx::BColor& rColor, + double fTransparence, + double fDiscreteGrow, + bool bFill); + + /// data read access + const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; } + const basegfx::BColor& getColor() const { return maColor; } + double getTransparence() const { return mfTransparence; } + double getDiscreteGrow() const { return mfDiscreteGrow; } + bool getFill() const { return mbFill; } + + /// compare operator + virtual bool operator==(const BasePrimitive2D& rPrimitive) const; + + /// get range + virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; + + /// provide unique ID + DeclPrimitive2DIDBlock() + }; + } // end of namespace primitive2d +} // end of namespace drawinglayer + ////////////////////////////////////////////////////////////////////////////// #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_POLYPOLYGONPRIMITIVE2D_HXX diff --git a/include/drawinglayer/processor2d/linegeometryextractor2d.hxx b/include/drawinglayer/processor2d/linegeometryextractor2d.hxx index 4905f4062c5f..906dd9e11ec2 100644 --- a/include/drawinglayer/processor2d/linegeometryextractor2d.hxx +++ b/include/drawinglayer/processor2d/linegeometryextractor2d.hxx @@ -35,7 +35,7 @@ namespace drawinglayer /** LineGeometryExtractor2D class This processor can extract the line geometry from feeded primpitives. The - hairlines and the fille geometry from fat lines are separated. + hairlines and the fill geometry from fat lines are separated. */ class DRAWINGLAYER_DLLPUBLIC LineGeometryExtractor2D : public BaseProcessor2D { diff --git a/include/svx/sdr/overlay/overlayanimatedbitmapex.hxx b/include/svx/sdr/overlay/overlayanimatedbitmapex.hxx index 756d2dac3731..ee9a4a66017c 100644 --- a/include/svx/sdr/overlay/overlayanimatedbitmapex.hxx +++ b/include/svx/sdr/overlay/overlayanimatedbitmapex.hxx @@ -45,16 +45,13 @@ namespace sdr // #i53216# added CursorBlinkTime (in ms) sal_uInt32 mnBlinkTime; - // bitfield - // Flag to remember which state to draw. Inited with sal_False (0) - unsigned mbOverlayState : 1; + /// bitfield + // Flag to remember which state to draw. Inited with false (0) + bool mbOverlayState : 1; // geometry creation for OverlayObject virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence(); - // #i53216# check blink time value range (currently 25 < mnBlinkTime < 10000) - void impCheckBlinkTimeValueRange(); - public: OverlayAnimatedBitmapEx( const basegfx::B2DPoint& rBasePos, diff --git a/include/svx/sdr/overlay/overlayobject.hxx b/include/svx/sdr/overlay/overlayobject.hxx index 263e9a9ab57c..3b56c97556ed 100644 --- a/include/svx/sdr/overlay/overlayobject.hxx +++ b/include/svx/sdr/overlay/overlayobject.hxx @@ -82,6 +82,9 @@ namespace sdr // a missing implementation virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence(); + // #i53216# check blink time value range (currently 25 < mnBlinkTime < 10000) + sal_uInt32 impCheckBlinkTimeValueRange(sal_uInt32 nBlinkTime) const; + // region in logical coordinates basegfx::B2DRange maBaseRange; diff --git a/include/svx/sdr/overlay/overlaypolypolygon.hxx b/include/svx/sdr/overlay/overlaypolypolygon.hxx index d7dd82751f53..a716aac43069 100644 --- a/include/svx/sdr/overlay/overlaypolypolygon.hxx +++ b/include/svx/sdr/overlay/overlaypolypolygon.hxx @@ -22,6 +22,7 @@ #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -29,21 +30,23 @@ namespace sdr { namespace overlay { - class SVX_DLLPUBLIC OverlayPolyPolygonStriped : public OverlayObject + class SVX_DLLPUBLIC OverlayPolyPolygonStripedAndFilled : public OverlayObject { protected: // geometry - basegfx::B2DPolyPolygon maPolyPolygon; + basegfx::B2DPolyPolygon maLinePolyPolygon; // geometry creation for OverlayObject virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence(); public: - explicit OverlayPolyPolygonStriped(const basegfx::B2DPolyPolygon& rPolyPolygon); - virtual ~OverlayPolyPolygonStriped(); + explicit OverlayPolyPolygonStripedAndFilled( + const basegfx::B2DPolyPolygon& rLinePolyPolygon); + virtual ~OverlayPolyPolygonStripedAndFilled(); // change geometry - basegfx::B2DPolyPolygon getPolyPolygon() const { return maPolyPolygon; } + basegfx::B2DPolyPolygon getLinePolyPolygon() const { return maLinePolyPolygon; } + void setLinePolyPolygon(const basegfx::B2DPolyPolygon& rNew); // react on stripe definition change virtual void stripeDefinitionHasChanged(); diff --git a/include/svx/sdr/overlay/overlayrectangle.hxx b/include/svx/sdr/overlay/overlayrectangle.hxx new file mode 100644 index 000000000000..3d2f6f708be5 --- /dev/null +++ b/include/svx/sdr/overlay/overlayrectangle.hxx @@ -0,0 +1,87 @@ +/* + * 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 . + */ +#ifndef _SDR_OVERLAY_OVERLAYRECTANGLE_HXX +#define _SDR_OVERLAY_OVERLAYRECTANGLE_HXX + +#include +#include + +////////////////////////////////////////////////////////////////////////////// + +class PolyPolygon; + +namespace sdr +{ + namespace overlay + { + class OverlayRectangle : public OverlayObjectWithBasePosition + { + // geometric definitions + basegfx::B2DPoint maSecondPosition; + const double mfTransparence; + const double mfDiscreteGrow; + const double mfDiscreteShrink; + const double mfRotation; + + // #i53216# added CursorBlinkTime (in ms) + sal_uInt32 mnBlinkTime; + + /// bitfield + // Flag to remember which state to draw. Inited with false (0) + bool mbOverlayState : 1; + + // geometry creation for OverlayObject + virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence(); + + public: + OverlayRectangle( + const basegfx::B2DPoint& rBasePosition, + const basegfx::B2DPoint& rSecondPosition, + const Color& rHatchColor, + double fTransparence, + double fDiscreteGrow, + double fDiscreteShrink, + double fRotation, + sal_uInt32 nBlinkTime, + bool bAnimate); + + const basegfx::B2DPoint& getSecondPosition() const { return maSecondPosition; } + void setSecondPosition(const basegfx::B2DPoint&); + + // data read access + double getTransparence() const { return mfTransparence; } + double getDiscreteGrow() const { return mfDiscreteGrow; } + double getDiscreteShrink() const { return mfDiscreteShrink; } + double getRotation() const { return mfRotation; } + + // added CursorBlinkTime (in ms) + sal_uInt32 getBlinkTime() const { return mnBlinkTime; } + void setBlinkTime(sal_uInt32 nNew); + + // execute event from base class ::sdr::animation::Event. Default + // implementation does nothing and does not create a new event. + virtual void Trigger(sal_uInt32 nTime); + }; + } // end of namespace overlay +} // end of namespace sdr + +////////////////////////////////////////////////////////////////////////////// + +#endif //_SDR_OVERLAY_OVERLAYRECTANGLE_HXX + +// eof diff --git a/include/svx/sdr/overlay/overlaytools.hxx b/include/svx/sdr/overlay/overlaytools.hxx index 408c81b40d01..57bbcf72ebdb 100644 --- a/include/svx/sdr/overlay/overlaytools.hxx +++ b/include/svx/sdr/overlay/overlaytools.hxx @@ -118,16 +118,15 @@ namespace drawinglayer { namespace primitive2d { - class OverlayHatchRectanglePrimitive : public DiscreteMetricDependentPrimitive2D + class OverlayRectanglePrimitive : public DiscreteMetricDependentPrimitive2D { private: // the logic rectangle definition basegfx::B2DRange maObjectRange; - // the hatch definition - double mfDiscreteHatchDistance; - double mfHatchRotation; - basegfx::BColor maHatchColor; + // the graphic definition + basegfx::BColor maColor; + double mfTransparence; // the dscrete grow and shrink of the box double mfDiscreteGrow; @@ -140,20 +139,18 @@ namespace drawinglayer virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: - OverlayHatchRectanglePrimitive( + OverlayRectanglePrimitive( const basegfx::B2DRange& rObjectRange, - double fDiscreteHatchDistance, - double fHatchRotation, - const basegfx::BColor& rHatchColor, + const basegfx::BColor& rColor, + double fTransparence, double fDiscreteGrow, double fDiscreteShrink, double fRotation); // data access const basegfx::B2DRange& getObjectRange() const { return maObjectRange; } - double getDiscreteHatchDistance() const { return mfDiscreteHatchDistance; } - double getHatchRotation() const { return mfHatchRotation; } - const basegfx::BColor& getHatchColor() const { return maHatchColor; } + const basegfx::BColor& getColor() const { return maColor; } + double getTransparence() const { return mfTransparence; } double getDiscreteGrow() const { return mfDiscreteGrow; } double getDiscreteShrink() const { return mfDiscreteShrink; } double getRotation() const { return mfRotation; } diff --git a/include/svx/sdr/primitive2d/svx_primitivetypes2d.hxx b/include/svx/sdr/primitive2d/svx_primitivetypes2d.hxx index 6178695bf66d..42d5109d5c80 100644 --- a/include/svx/sdr/primitive2d/svx_primitivetypes2d.hxx +++ b/include/svx/sdr/primitive2d/svx_primitivetypes2d.hxx @@ -42,7 +42,7 @@ #define PRIMITIVE2D_ID_SDRBORDERLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 15) #define PRIMITIVE2D_ID_OVERLAYBITMAPEXPRIMITIVE (PRIMITIVE2D_ID_RANGE_SVX| 16) #define PRIMITIVE2D_ID_OVERLAYCROSSHAIRPRIMITIVE (PRIMITIVE2D_ID_RANGE_SVX| 17) -#define PRIMITIVE2D_ID_OVERLAYHATCHRECTANGLEPRIMITIVE (PRIMITIVE2D_ID_RANGE_SVX| 18) +#define PRIMITIVE2D_ID_OVERLAYRECTANGLEPRIMITIVE (PRIMITIVE2D_ID_RANGE_SVX| 18) #define PRIMITIVE2D_ID_OVERLAYHELPLINESTRIPEDPRIMITIVE (PRIMITIVE2D_ID_RANGE_SVX| 19) #define PRIMITIVE2D_ID_OVERLAYROLLINGRECTANGLEPRIMITIVE (PRIMITIVE2D_ID_RANGE_SVX| 20) #define PRIMITIVE2D_ID_SDRCONTROLPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 21) diff --git a/include/svx/svdview.hxx b/include/svx/svdview.hxx index ef28a17f4513..7628926770e8 100644 --- a/include/svx/svdview.hxx +++ b/include/svx/svdview.hxx @@ -28,6 +28,8 @@ #include "svx/svxdllapi.h" #include #include +#include +#include //////////////////////////////////////////////////////////////////////////////////////////////////// // @@ -151,7 +153,9 @@ class SVX_DLLPUBLIC SdrDropMarkerOverlay // The OverlayObjects ::sdr::overlay::OverlayObjectList maObjects; - void ImplCreateOverlays(const SdrView& rView, const basegfx::B2DPolyPolygon& rPolyPolygon); + void ImplCreateOverlays( + const SdrView& rView, + const basegfx::B2DPolyPolygon& rLinePolyPolygon); public: SdrDropMarkerOverlay(const SdrView& rView, const SdrObject& rObject); diff --git a/sd/source/ui/view/sdview2.cxx b/sd/source/ui/view/sdview2.cxx index e030435357f7..fa14fe1d896b 100644 --- a/sd/source/ui/view/sdview2.cxx +++ b/sd/source/ui/view/sdview2.cxx @@ -512,6 +512,12 @@ sal_Int8 View::AcceptDrop( const AcceptDropEvent& rEvt, DropTargetHelper& rTarge { SdTransferable* pDragTransferable = SD_MOD()->pTransferDrag; + if(pDragTransferable && (nDropAction & DND_ACTION_LINK)) + { + // suppress own data when it's intention is to use it as fill information + pDragTransferable = 0; + } + if( pDragTransferable ) { const View* pSourceView = pDragTransferable->GetView(); @@ -581,7 +587,7 @@ sal_Int8 View::AcceptDrop( const AcceptDropEvent& rEvt, DropTargetHelper& rTarge } if( bHasPickObj && !bIsPresTarget && - ( !pPickObj->ISA( SdrGrafObj ) || bGraphic || bMtf || bBitmap || ( bXFillExchange && !pPickObj->ISA( SdrGrafObj ) && !pPickObj->ISA( SdrOle2Obj ) ) ) ) + ( bGraphic || bMtf || bBitmap || bXFillExchange ) ) { if( mpDropMarkerObj != pPickObj ) { diff --git a/sd/source/ui/view/sdview3.cxx b/sd/source/ui/view/sdview3.cxx index ab2cfec23670..cdbe0aeb2a3d 100644 --- a/sd/source/ui/view/sdview3.cxx +++ b/sd/source/ui/view/sdview3.cxx @@ -265,7 +265,7 @@ sal_Bool View::InsertData( const TransferableDataHelper& rDataHelper, SdrObject* pPickObj = NULL; SdPage* pPage = NULL; ImageMap* pImageMap = NULL; - sal_Bool bReturn = sal_False; + bool bReturn = false; sal_Bool bLink = ( ( mnAction & DND_ACTION_LINK ) != 0 ); sal_Bool bCopy = ( ( ( mnAction & DND_ACTION_COPY ) != 0 ) || bLink ); sal_uLong nPasteOptions = SDRINSERT_SETDEFLAYER; @@ -291,6 +291,12 @@ sal_Bool View::InsertData( const TransferableDataHelper& rDataHelper, SdTransferable* pOwnData = NULL; SdTransferable* pImplementation = SdTransferable::getImplementation( aDataHelper.GetTransferable() ); + if(pImplementation && (rDnDAction & DND_ACTION_LINK)) + { + // suppress own data when it's intention is to use it as fill information + pImplementation = 0; + } + // try to get own transfer data if( pImplementation ) { @@ -343,11 +349,14 @@ sal_Bool View::InsertData( const TransferableDataHelper& rDataHelper, } } + // Changed the whole decision tree to be dependent of bReturn as a flag that + // the work was done; this allows to check multiple formats and not just fail + // when a CHECK_FORMAT_TRANS(*format*) detected format does not work. This is + // e.g. necessary for FORMAT_BITMAP if( pOwnData && !nFormat ) { const View* pSourceView = pOwnData->GetView(); - if( pOwnData->GetDocShell() && pOwnData->IsPageTransferable() && ISA( View ) ) { mpClipboard->HandlePageDrop (*pOwnData); @@ -389,7 +398,7 @@ sal_Bool View::InsertData( const TransferableDataHelper& rDataHelper, } } - bReturn = sal_True; + bReturn = true; } } else @@ -565,12 +574,12 @@ sal_Bool View::InsertData( const TransferableDataHelper& rDataHelper, if( pMarkList != mpDragSrcMarkList ) delete pMarkList; - bReturn = sal_True; + bReturn = true; } else { maDropErrorTimer.Start(); - bReturn = sal_False; + bReturn = false; } } } @@ -579,7 +588,7 @@ sal_Bool View::InsertData( const TransferableDataHelper& rDataHelper, pOwnData->SetInternalMove( sal_True ); MoveAllMarked( Size( maDropPos.X() - pOwnData->GetStartPos().X(), maDropPos.Y() - pOwnData->GetStartPos().Y() ), bCopy ); - bReturn = sal_True; + bReturn = true; } } } @@ -605,7 +614,7 @@ sal_Bool View::InsertData( const TransferableDataHelper& rDataHelper, else { maDropErrorTimer.Start(); - bReturn = sal_False; + bReturn = false; } } } @@ -641,7 +650,8 @@ sal_Bool View::InsertData( const TransferableDataHelper& rDataHelper, pPage->SetPresentationLayout( aLayout, sal_False, sal_False ); } } - else if( CHECK_FORMAT_TRANS( SOT_FORMATSTR_ID_DRAWING ) ) + + if(!bReturn && CHECK_FORMAT_TRANS( SOT_FORMATSTR_ID_DRAWING )) { SotStorageStreamRef xStm; @@ -794,7 +804,8 @@ sal_Bool View::InsertData( const TransferableDataHelper& rDataHelper, } } } - else if( CHECK_FORMAT_TRANS( SOT_FORMATSTR_ID_SBA_FIELDDATAEXCHANGE ) ) + + if(!bReturn && CHECK_FORMAT_TRANS(SOT_FORMATSTR_ID_SBA_FIELDDATAEXCHANGE)) { OUString aOUString; @@ -813,14 +824,15 @@ sal_Bool View::InsertData( const TransferableDataHelper& rDataHelper, aRect.SetPos( maDropPos ); pObj->SetLogicRect( aRect ); InsertObjectAtView( pObj, *GetSdrPageView(), SDRINSERT_SETDEFLAYER ); - bReturn = sal_True; + bReturn = true; } } } - else if( !bLink && - ( CHECK_FORMAT_TRANS( SOT_FORMATSTR_ID_EMBED_SOURCE ) || - CHECK_FORMAT_TRANS( SOT_FORMATSTR_ID_EMBEDDED_OBJ ) ) && - aDataHelper.HasFormat( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR ) ) + + if(!bReturn && + !bLink && + (CHECK_FORMAT_TRANS(SOT_FORMATSTR_ID_EMBED_SOURCE) || CHECK_FORMAT_TRANS(SOT_FORMATSTR_ID_EMBEDDED_OBJ)) && + aDataHelper.HasFormat(SOT_FORMATSTR_ID_OBJECTDESCRIPTOR)) { //TODO/LATER: is it possible that this format is binary?! (from old versions of SO) uno::Reference < io::XInputStream > xStm; @@ -987,15 +999,16 @@ sal_Bool View::InsertData( const TransferableDataHelper& rDataHelper, } } - bReturn = sal_True; + bReturn = true; } } } } - else if( !bLink && - ( CHECK_FORMAT_TRANS( SOT_FORMATSTR_ID_EMBEDDED_OBJ_OLE ) || - CHECK_FORMAT_TRANS( SOT_FORMATSTR_ID_EMBED_SOURCE_OLE ) ) && - aDataHelper.HasFormat( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR_OLE ) ) + + if(!bReturn && + !bLink && + (CHECK_FORMAT_TRANS(SOT_FORMATSTR_ID_EMBEDDED_OBJ_OLE) || CHECK_FORMAT_TRANS(SOT_FORMATSTR_ID_EMBED_SOURCE_OLE)) && + aDataHelper.HasFormat(SOT_FORMATSTR_ID_OBJECTDESCRIPTOR_OLE)) { // online insert ole if format is forced or no gdi metafile is available if( (nFormat != 0) || !aDataHelper.HasFormat( FORMAT_GDIMETAFILE ) ) @@ -1136,7 +1149,7 @@ sal_Bool View::InsertData( const TransferableDataHelper& rDataHelper, // let the object stay in loaded state after insertion pObj->Unload(); - bReturn = sal_True; + bReturn = true; } } } @@ -1148,7 +1161,8 @@ sal_Bool View::InsertData( const TransferableDataHelper& rDataHelper, bReturn = true; } } - else if( ( !bLink || pPickObj ) && CHECK_FORMAT_TRANS( SOT_FORMATSTR_ID_SVXB ) ) + + if(!bReturn && (!bLink || pPickObj) && CHECK_FORMAT_TRANS(SOT_FORMATSTR_ID_SVXB)) { SotStorageStreamRef xStm; @@ -1182,10 +1196,11 @@ sal_Bool View::InsertData( const TransferableDataHelper& rDataHelper, ImpCheckInsertPos(aInsertPos, aImageMapSize, GetWorkArea()); InsertGraphic( aGraphic, mnAction, aInsertPos, NULL, pImageMap ); - bReturn = sal_True; + bReturn = true; } } - else if( ( !bLink || pPickObj ) && CHECK_FORMAT_TRANS( FORMAT_GDIMETAFILE ) ) + + if(!bReturn && (!bLink || pPickObj) && CHECK_FORMAT_TRANS(FORMAT_GDIMETAFILE)) { Point aInsertPos( rPos ); @@ -1208,7 +1223,8 @@ sal_Bool View::InsertData( const TransferableDataHelper& rDataHelper, bReturn = InsertMetaFile( aDataHelper, aInsertPos, pImageMap, nFormat == 0 ? true : false ) ? sal_True : sal_False; } - else if( ( !bLink || pPickObj ) && CHECK_FORMAT_TRANS( FORMAT_BITMAP ) ) + + if(!bReturn && (!bLink || pPickObj) && CHECK_FORMAT_TRANS(FORMAT_BITMAP)) { BitmapEx aBmpEx; @@ -1259,10 +1275,11 @@ sal_Bool View::InsertData( const TransferableDataHelper& rDataHelper, ImpCheckInsertPos(aInsertPos, aImageMapSize, GetWorkArea()); InsertGraphic( aBmpEx, mnAction, aInsertPos, NULL, pImageMap ); - bReturn = sal_True; + bReturn = true; } } - else if( pPickObj && CHECK_FORMAT_TRANS( SOT_FORMATSTR_ID_XFA ) ) + + if(!bReturn && pPickObj && CHECK_FORMAT_TRANS( SOT_FORMATSTR_ID_XFA ) ) { SotStorageStreamRef xStm; @@ -1325,7 +1342,8 @@ sal_Bool View::InsertData( const TransferableDataHelper& rDataHelper, } } } - else if( !bLink && CHECK_FORMAT_TRANS( SOT_FORMATSTR_ID_HTML ) ) + + if(!bReturn && !bLink && CHECK_FORMAT_TRANS(SOT_FORMATSTR_ID_HTML)) { SotStorageStreamRef xStm; @@ -1336,7 +1354,8 @@ sal_Bool View::InsertData( const TransferableDataHelper& rDataHelper, bReturn = SdrView::Paste( *xStm, String(), EE_FORMAT_HTML, maDropPos, pPage, nPasteOptions ); } } - else if( !bLink && CHECK_FORMAT_TRANS( SOT_FORMATSTR_ID_EDITENGINE ) ) + + if(!bReturn && !bLink && CHECK_FORMAT_TRANS(SOT_FORMATSTR_ID_EDITENGINE)) { SotStorageStreamRef xStm; @@ -1355,7 +1374,7 @@ sal_Bool View::InsertData( const TransferableDataHelper& rDataHelper, { // mba: clipboard always must contain absolute URLs (could be from alien source) pOLV->Read( *xStm, String(), EE_FORMAT_BIN, sal_False, mpDocSh->GetHeaderAttributes() ); - bReturn = sal_True; + bReturn = true; } } @@ -1364,7 +1383,8 @@ sal_Bool View::InsertData( const TransferableDataHelper& rDataHelper, bReturn = SdrView::Paste( *xStm, String(), EE_FORMAT_BIN, maDropPos, pPage, nPasteOptions ); } } - else if( !bLink && CHECK_FORMAT_TRANS( FORMAT_RTF ) ) + + if(!bReturn && !bLink && CHECK_FORMAT_TRANS(FORMAT_RTF)) { SotStorageStreamRef xStm; @@ -1389,7 +1409,7 @@ sal_Bool View::InsertData( const TransferableDataHelper& rDataHelper, { // mba: clipboard always must contain absolute URLs (could be from alien source) pOLV->Read( *xStm, String(), EE_FORMAT_RTF, sal_False, mpDocSh->GetHeaderAttributes() ); - bReturn = sal_True; + bReturn = true; } } @@ -1399,7 +1419,8 @@ sal_Bool View::InsertData( const TransferableDataHelper& rDataHelper, } } } - else if( CHECK_FORMAT_TRANS( FORMAT_FILE_LIST ) ) + + if(!bReturn && CHECK_FORMAT_TRANS(FORMAT_FILE_LIST)) { FileList aDropFileList; @@ -1413,9 +1434,10 @@ sal_Bool View::InsertData( const TransferableDataHelper& rDataHelper, maDropInsertFileTimer.Start(); } - bReturn = sal_True; + bReturn = true; } - else if( CHECK_FORMAT_TRANS( FORMAT_FILE ) ) + + if(!bReturn && CHECK_FORMAT_TRANS(FORMAT_FILE)) { String aDropFile; @@ -1426,9 +1448,10 @@ sal_Bool View::InsertData( const TransferableDataHelper& rDataHelper, maDropInsertFileTimer.Start(); } - bReturn = sal_True; + bReturn = true; } - else if( !bLink && CHECK_FORMAT_TRANS( FORMAT_STRING ) ) + + if(!bReturn && !bLink && CHECK_FORMAT_TRANS(FORMAT_STRING)) { if( ( FORMAT_STRING == nFormat ) || ( !aDataHelper.HasFormat( SOT_FORMATSTR_ID_SOLK ) && @@ -1444,7 +1467,7 @@ sal_Bool View::InsertData( const TransferableDataHelper& rDataHelper, if( pOLV ) { pOLV->InsertText( aOUString ); - bReturn = sal_True; + bReturn = true; } if( !bReturn ) diff --git a/svx/Library_svxcore.mk b/svx/Library_svxcore.mk index 21a03bf47a18..30a33a4cdbfc 100644 --- a/svx/Library_svxcore.mk +++ b/svx/Library_svxcore.mk @@ -196,7 +196,7 @@ $(eval $(call gb_Library_add_exception_objects,svxcore,\ svx/source/sdr/overlay/overlayrollingrectangle \ svx/source/sdr/overlay/overlaytriangle \ svx/source/sdr/overlay/overlayselection \ - svx/source/sdr/overlay/overlayhatchrect \ + svx/source/sdr/overlay/overlayrectangle \ svx/source/sdr/overlay/overlaybitmapex \ svx/source/sdr/overlay/overlaymanagerbuffered \ svx/source/sdr/overlay/overlayhelpline \ diff --git a/svx/source/engine3d/dragmt3d.cxx b/svx/source/engine3d/dragmt3d.cxx index ccc796eb6dbe..4e0bf86df28e 100644 --- a/svx/source/engine3d/dragmt3d.cxx +++ b/svx/source/engine3d/dragmt3d.cxx @@ -259,7 +259,8 @@ void E3dDragMethod::CreateOverlayGeometry(::sdr::overlay::OverlayManager& rOverl if(aResult.count()) { - ::sdr::overlay::OverlayPolyPolygonStriped* pNew = new ::sdr::overlay::OverlayPolyPolygonStriped(aResult); + ::sdr::overlay::OverlayPolyPolygonStripedAndFilled* pNew = new ::sdr::overlay::OverlayPolyPolygonStripedAndFilled( + aResult); rOverlayManager.add(*pNew); addToOverlayObjectList(*pNew); } diff --git a/svx/source/engine3d/view3d.cxx b/svx/source/engine3d/view3d.cxx index 5f856ed538a8..15a4787a68bd 100644 --- a/svx/source/engine3d/view3d.cxx +++ b/svx/source/engine3d/view3d.cxx @@ -213,7 +213,8 @@ void Impl3DMirrorConstructOverlay::SetMirrorAxis(Point aMirrorAxisA, Point aMirr basegfx::B2DPolyPolygon aPolyPolygon(mpPolygons[b]); aPolyPolygon.transform(aMatrixTransform); - ::sdr::overlay::OverlayPolyPolygonStriped* pNew = new ::sdr::overlay::OverlayPolyPolygonStriped(aPolyPolygon); + ::sdr::overlay::OverlayPolyPolygonStripedAndFilled* pNew = new ::sdr::overlay::OverlayPolyPolygonStripedAndFilled( + aPolyPolygon); xTargetOverlay->add(*pNew); maObjects.append(*pNew); } diff --git a/svx/source/sdr/overlay/overlayanimatedbitmapex.cxx b/svx/source/sdr/overlay/overlayanimatedbitmapex.cxx index cf9d5842a37b..ff4d97b8c9d2 100644 --- a/svx/source/sdr/overlay/overlayanimatedbitmapex.cxx +++ b/svx/source/sdr/overlay/overlayanimatedbitmapex.cxx @@ -29,19 +29,6 @@ namespace sdr { namespace overlay { - // #i53216# check blink time value range - void OverlayAnimatedBitmapEx::impCheckBlinkTimeValueRange() - { - if(mnBlinkTime < 25) - { - mnBlinkTime = 25; - } - else if(mnBlinkTime > 10000) - { - mnBlinkTime = 10000; - } - } - drawinglayer::primitive2d::Primitive2DSequence OverlayAnimatedBitmapEx::createOverlayObjectPrimitive2DSequence() { if(mbOverlayState) @@ -89,7 +76,7 @@ namespace sdr mbAllowsAnimation = true; // #i53216# check blink time value range - impCheckBlinkTimeValueRange(); + mnBlinkTime = impCheckBlinkTimeValueRange(mnBlinkTime); } OverlayAnimatedBitmapEx::~OverlayAnimatedBitmapEx() diff --git a/svx/source/sdr/overlay/overlayhatchrect.cxx b/svx/source/sdr/overlay/overlayhatchrect.cxx deleted file mode 100644 index 2b6c7e1e3668..000000000000 --- a/svx/source/sdr/overlay/overlayhatchrect.cxx +++ /dev/null @@ -1,71 +0,0 @@ -/* -*- 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 -#include -#include -#include -#include -#include -#include -#include - -////////////////////////////////////////////////////////////////////////////// - -namespace sdr -{ - namespace overlay - { - drawinglayer::primitive2d::Primitive2DSequence OverlayHatchRect::createOverlayObjectPrimitive2DSequence() - { - const basegfx::B2DRange aHatchRange(getBasePosition(), getSecondPosition()); - const drawinglayer::primitive2d::Primitive2DReference aReference( - new drawinglayer::primitive2d::OverlayHatchRectanglePrimitive( - aHatchRange, - 3.0, - getHatchRotation(), - getBaseColor().getBColor(), - getDiscreteGrow(), - getDiscreteShrink(), - getRotation())); - - return drawinglayer::primitive2d::Primitive2DSequence(&aReference, 1); - } - - OverlayHatchRect::OverlayHatchRect( - const basegfx::B2DPoint& rBasePosition, - const basegfx::B2DPoint& rSecondPosition, - const Color& rHatchColor, - double fDiscreteGrow, - double fDiscreteShrink, - double fHatchRotation, - double fRotation) - : OverlayObjectWithBasePosition(rBasePosition, rHatchColor), - maSecondPosition(rSecondPosition), - mfDiscreteGrow(fDiscreteGrow), - mfDiscreteShrink(fDiscreteShrink), - mfHatchRotation(fHatchRotation), - mfRotation(fRotation) - { - } - } // end of namespace overlay -} // end of namespace sdr - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/sdr/overlay/overlaymanager.cxx b/svx/source/sdr/overlay/overlaymanager.cxx index 818bfc6b6b27..d9a0ef4772ac 100644 --- a/svx/source/sdr/overlay/overlaymanager.cxx +++ b/svx/source/sdr/overlay/overlaymanager.cxx @@ -157,8 +157,14 @@ namespace sdr if(OUTDEV_WINDOW == getOutputDevice().GetOutDevType()) { const Size aOutputSizePixel(getOutputDevice().GetOutputSizePixel()); - aViewRange = basegfx::B2DRange(0.0, 0.0, aOutputSizePixel.getWidth(), aOutputSizePixel.getHeight()); - aViewRange.transform(getOutputDevice().GetInverseViewTransformation()); + + // only set when we *have* a output size, else let aViewRange + // stay on empty + if(aOutputSizePixel.Width() && aOutputSizePixel.Height()) + { + aViewRange = basegfx::B2DRange(0.0, 0.0, aOutputSizePixel.getWidth(), aOutputSizePixel.getHeight()); + aViewRange.transform(getOutputDevice().GetInverseViewTransformation()); + } } OverlayManager* pThis = const_cast< OverlayManager* >(this); diff --git a/svx/source/sdr/overlay/overlayobject.cxx b/svx/source/sdr/overlay/overlayobject.cxx index da15079b7f54..292cb5a0c220 100644 --- a/svx/source/sdr/overlay/overlayobject.cxx +++ b/svx/source/sdr/overlay/overlayobject.cxx @@ -63,6 +63,20 @@ namespace sdr return drawinglayer::primitive2d::Primitive2DSequence(); } + sal_uInt32 OverlayObject::impCheckBlinkTimeValueRange(sal_uInt32 nBlinkTime) const + { + if(nBlinkTime < 25) + { + nBlinkTime = 25; + } + else if(nBlinkTime > 10000) + { + nBlinkTime = 10000; + } + + return nBlinkTime; + } + void OverlayObject::allowAntiAliase(bool bNew) { if(bNew != (bool)mbAllowsAntiAliase) diff --git a/svx/source/sdr/overlay/overlaypolypolygon.cxx b/svx/source/sdr/overlay/overlaypolypolygon.cxx index e1b06469d1be..f85021c7e797 100644 --- a/svx/source/sdr/overlay/overlaypolypolygon.cxx +++ b/svx/source/sdr/overlay/overlaypolypolygon.cxx @@ -30,7 +30,7 @@ namespace sdr { namespace overlay { - drawinglayer::primitive2d::Primitive2DSequence OverlayPolyPolygonStriped::createOverlayObjectPrimitive2DSequence() + drawinglayer::primitive2d::Primitive2DSequence OverlayPolyPolygonStripedAndFilled::createOverlayObjectPrimitive2DSequence() { drawinglayer::primitive2d::Primitive2DSequence aRetval; @@ -39,34 +39,47 @@ namespace sdr const basegfx::BColor aRGBColorA(getOverlayManager()->getStripeColorA().getBColor()); const basegfx::BColor aRGBColorB(getOverlayManager()->getStripeColorB().getBColor()); const double fStripeLengthPixel(getOverlayManager()->getStripeLengthPixel()); - - const drawinglayer::primitive2d::Primitive2DReference aReference( + const drawinglayer::primitive2d::Primitive2DReference aStriped( new drawinglayer::primitive2d::PolyPolygonMarkerPrimitive2D( - getPolyPolygon(), + getLinePolyPolygon(), aRGBColorA, aRGBColorB, fStripeLengthPixel)); - aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aReference, 1); + aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aStriped, 1); + + const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer; + const basegfx::BColor aHilightColor(aSvtOptionsDrawinglayer.getHilightColor().getBColor()); + const double fTransparence(aSvtOptionsDrawinglayer.GetTransparentSelectionPercent() * 0.01); + + const drawinglayer::primitive2d::Primitive2DReference aFilled( + new drawinglayer::primitive2d::PolyPolygonSelectionPrimitive2D( + getLinePolyPolygon(), + aHilightColor, + fTransparence, + 3.0, + false)); + + drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, aFilled); } return aRetval; } - void OverlayPolyPolygonStriped::stripeDefinitionHasChanged() + void OverlayPolyPolygonStripedAndFilled::stripeDefinitionHasChanged() { // react on OverlayManager's stripe definition change objectChange(); } - OverlayPolyPolygonStriped::OverlayPolyPolygonStriped( - const basegfx::B2DPolyPolygon& rPolyPolygon) + OverlayPolyPolygonStripedAndFilled::OverlayPolyPolygonStripedAndFilled( + const basegfx::B2DPolyPolygon& rLinePolyPolygon) : OverlayObject(Color(COL_BLACK)), - maPolyPolygon(rPolyPolygon) + maLinePolyPolygon(rLinePolyPolygon) { } - OverlayPolyPolygonStriped::~OverlayPolyPolygonStriped() + OverlayPolyPolygonStripedAndFilled::~OverlayPolyPolygonStripedAndFilled() { } } // end of namespace overlay diff --git a/svx/source/sdr/overlay/overlayrectangle.cxx b/svx/source/sdr/overlay/overlayrectangle.cxx new file mode 100644 index 000000000000..7f07be08633d --- /dev/null +++ b/svx/source/sdr/overlay/overlayrectangle.cxx @@ -0,0 +1,150 @@ +/* + * 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 +#include +#include +#include +#include +#include +#include +#include +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace sdr +{ + namespace overlay + { + drawinglayer::primitive2d::Primitive2DSequence OverlayRectangle::createOverlayObjectPrimitive2DSequence() + { + const basegfx::B2DRange aHatchRange(getBasePosition(), getSecondPosition()); + basegfx::BColor aColor(getBaseColor().getBColor()); + static double fChange(0.1); // just small optical change, do not make it annoying + + if(mbOverlayState) + { + aColor += basegfx::B3DTuple(fChange, fChange, fChange); + aColor.clamp(); + } + else + { + aColor -= basegfx::B3DTuple(fChange, fChange, fChange); + aColor.clamp(); + } + + const drawinglayer::primitive2d::Primitive2DReference aReference( + new drawinglayer::primitive2d::OverlayRectanglePrimitive( + aHatchRange, + aColor, + getTransparence(), + getDiscreteGrow(), + getDiscreteShrink(), + getRotation())); + + return drawinglayer::primitive2d::Primitive2DSequence(&aReference, 1); + } + + OverlayRectangle::OverlayRectangle( + const basegfx::B2DPoint& rBasePosition, + const basegfx::B2DPoint& rSecondPosition, + const Color& rHatchColor, + double fTransparence, + double fDiscreteGrow, + double fDiscreteShrink, + double fRotation, + sal_uInt32 nBlinkTime, + bool bAnimate) + : OverlayObjectWithBasePosition(rBasePosition, rHatchColor), + maSecondPosition(rSecondPosition), + mfTransparence(fTransparence), + mfDiscreteGrow(fDiscreteGrow), + mfDiscreteShrink(fDiscreteShrink), + mfRotation(fRotation), + mnBlinkTime(nBlinkTime), + mbOverlayState(false) + { + if(Application::GetSettings().GetStyleSettings().GetHighContrastMode()) + { + // no animation in high contrast mode + bAnimate = false; + } + + // set AllowsAnimation flag to mark this object as animation capable + mbAllowsAnimation = bAnimate; + + // #i53216# check blink time value range + mnBlinkTime = impCheckBlinkTimeValueRange(mnBlinkTime); + } + + void OverlayRectangle::setSecondPosition(const basegfx::B2DPoint& rNew) + { + if(rNew != maSecondPosition) + { + // remember new value + maSecondPosition = rNew; + + // register change (after change) + objectChange(); + } + } + + void OverlayRectangle::setBlinkTime(sal_uInt32 nNew) + { + if(mnBlinkTime != nNew) + { + // remember new value + mnBlinkTime = nNew; + + // #i53216# check blink time value range + mnBlinkTime = impCheckBlinkTimeValueRange(mnBlinkTime); + + // register change (after change) + objectChange(); + } + } + + void OverlayRectangle::Trigger(sal_uInt32 nTime) + { + if(getOverlayManager()) + { + // #i53216# produce event after nTime + x + SetTime(nTime + mnBlinkTime); + + // switch state + if(mbOverlayState) + { + mbOverlayState = false; + } + else + { + mbOverlayState = true; + } + + // re-insert me as event + getOverlayManager()->InsertEvent(this); + + // register change (after change) + objectChange(); + } + } + } // end of namespace overlay +} // end of namespace sdr + +////////////////////////////////////////////////////////////////////////////// diff --git a/svx/source/sdr/overlay/overlayrollingrectangle.cxx b/svx/source/sdr/overlay/overlayrollingrectangle.cxx index 977c91e2275f..496cec8d320f 100644 --- a/svx/source/sdr/overlay/overlayrollingrectangle.cxx +++ b/svx/source/sdr/overlay/overlayrollingrectangle.cxx @@ -24,7 +24,7 @@ #include #include #include -#include +#include ////////////////////////////////////////////////////////////////////////////// @@ -47,14 +47,24 @@ namespace sdr { // view-independent part, create directly const basegfx::B2DPolygon aPolygon(basegfx::tools::createPolygonFromRect(aRollingRectangle)); - const drawinglayer::primitive2d::Primitive2DReference aReference( - new drawinglayer::primitive2d::PolygonMarkerPrimitive2D( - aPolygon, - aRGBColorA, - aRGBColorB, - fStripeLengthPixel)); - drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, aReference); + aRetval.realloc(2); + aRetval[0] = new drawinglayer::primitive2d::PolyPolygonMarkerPrimitive2D( + basegfx::B2DPolyPolygon(aPolygon), + aRGBColorA, + aRGBColorB, + fStripeLengthPixel); + + const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer; + const basegfx::BColor aHilightColor(aSvtOptionsDrawinglayer.getHilightColor().getBColor()); + const double fTransparence(aSvtOptionsDrawinglayer.GetTransparentSelectionPercent() * 0.01); + + aRetval[1] = new drawinglayer::primitive2d::PolyPolygonSelectionPrimitive2D( + basegfx::B2DPolyPolygon(aPolygon), + aHilightColor, + fTransparence, + 3.0, + false); } if(getExtendedLines()) diff --git a/svx/source/sdr/overlay/overlaytools.cxx b/svx/source/sdr/overlay/overlaytools.cxx index 92e0ff5866eb..d3ae3f97694c 100644 --- a/svx/source/sdr/overlay/overlaytools.cxx +++ b/svx/source/sdr/overlay/overlaytools.cxx @@ -28,6 +28,8 @@ #include #include #include +#include +#include ////////////////////////////////////////////////////////////////////////////// @@ -178,82 +180,121 @@ namespace drawinglayer { namespace primitive2d { - OverlayHatchRectanglePrimitive::OverlayHatchRectanglePrimitive( + OverlayRectanglePrimitive::OverlayRectanglePrimitive( const basegfx::B2DRange& rObjectRange, - double fDiscreteHatchDistance, - double fHatchRotation, - const basegfx::BColor& rHatchColor, + const basegfx::BColor& rColor, + double fTransparence, double fDiscreteGrow, double fDiscreteShrink, double fRotation) : DiscreteMetricDependentPrimitive2D(), maObjectRange(rObjectRange), - mfDiscreteHatchDistance(fDiscreteHatchDistance), - mfHatchRotation(fHatchRotation), - maHatchColor(rHatchColor), + maColor(rColor), + mfTransparence(fTransparence), mfDiscreteGrow(fDiscreteGrow), mfDiscreteShrink(fDiscreteShrink), mfRotation(fRotation) {} - Primitive2DSequence OverlayHatchRectanglePrimitive::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + Primitive2DSequence OverlayRectanglePrimitive::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { Primitive2DSequence aRetval; + basegfx::B2DRange aInnerRange(getObjectRange()); - if(basegfx::fTools::more(getDiscreteUnit(), 0.0)) + if(!aInnerRange.isEmpty() && basegfx::fTools::more(getDiscreteUnit(), 0.0) && getTransparence() <= 1.0) { - basegfx::B2DRange aInnerRange(getObjectRange()); basegfx::B2DRange aOuterRange(getObjectRange()); - basegfx::B2DPolyPolygon aHatchPolyPolygon; + // grow/shrink inner/outer polygons aOuterRange.grow(getDiscreteUnit() * getDiscreteGrow()); aInnerRange.grow(getDiscreteUnit() * -getDiscreteShrink()); - aHatchPolyPolygon.append(basegfx::tools::createPolygonFromRect(aOuterRange)); - - if(!aInnerRange.isEmpty()) - { - aHatchPolyPolygon.append(basegfx::tools::createPolygonFromRect(aInnerRange)); - } - + // convert to polygons + const double fFullGrow(getDiscreteGrow() + getDiscreteShrink()); + const double fRelativeRadiusX(fFullGrow / aOuterRange.getWidth()); + const double fRelativeRadiusY(fFullGrow / aOuterRange.getHeight()); + basegfx::B2DPolygon aOuterPolygon( + basegfx::tools::createPolygonFromRect( + aOuterRange, + fRelativeRadiusX, + fRelativeRadiusY)); + basegfx::B2DPolygon aInnerPolygon( + basegfx::tools::createPolygonFromRect( + aInnerRange)); + + // apply evtl. existing rotation if(!basegfx::fTools::equalZero(getRotation())) { const basegfx::B2DHomMatrix aTransform(basegfx::tools::createRotateAroundPoint( getObjectRange().getMinX(), getObjectRange().getMinY(), getRotation())); - aHatchPolyPolygon.transform(aTransform); + aOuterPolygon.transform(aTransform); + aInnerPolygon.transform(aTransform); } - const basegfx::BColor aEmptyColor(0.0, 0.0, 0.0); - const drawinglayer::attribute::FillHatchAttribute aFillHatchAttribute( - drawinglayer::attribute::HATCHSTYLE_SINGLE, - getDiscreteHatchDistance() * getDiscreteUnit(), - getHatchRotation() - getRotation(), - getHatchColor(), - 3, // same default as VCL, a minimum of three discrete units (pixels) offset - false); - const Primitive2DReference aPrimitive( - new PolyPolygonHatchPrimitive2D( - aHatchPolyPolygon, - aEmptyColor, - aFillHatchAttribute)); + // create filled primitive + basegfx::B2DPolyPolygon aPolyPolygon; - aRetval = Primitive2DSequence(&aPrimitive, 1); + aPolyPolygon.append(aOuterPolygon); + aPolyPolygon.append(aInnerPolygon); + + if(Application::GetSettings().GetStyleSettings().GetHighContrastMode()) + { + // for high contrast, use hatch + const basegfx::BColor aHighContrastLineColor(Application::GetSettings().GetStyleSettings().GetFontColor().getBColor()); + const basegfx::BColor aEmptyColor(0.0, 0.0, 0.0); + const double fHatchRotation(45 * F_PI180); + const double fDiscreteHatchDistance(3.0); + const drawinglayer::attribute::FillHatchAttribute aFillHatchAttribute( + drawinglayer::attribute::HATCHSTYLE_SINGLE, + fDiscreteHatchDistance * getDiscreteUnit(), + fHatchRotation - getRotation(), + aHighContrastLineColor, + 3, // same default as VCL, a minimum of three discrete units (pixels) offset + false); + const Primitive2DReference aHatch( + new PolyPolygonHatchPrimitive2D( + aPolyPolygon, + aEmptyColor, + aFillHatchAttribute)); + + aRetval = Primitive2DSequence(&aHatch, 1); + } + else + { + // create fill primitive + const Primitive2DReference aFill( + new PolyPolygonColorPrimitive2D( + aPolyPolygon, + getColor())); + + aRetval = Primitive2DSequence(&aFill, 1); + + // embed filled to transparency (if used) + if(getTransparence() > 0.0) + { + const Primitive2DReference aFillTransparent( + new UnifiedTransparencePrimitive2D( + aRetval, + getTransparence())); + + aRetval = Primitive2DSequence(&aFillTransparent, 1); + } + } } return aRetval; } - bool OverlayHatchRectanglePrimitive::operator==( const BasePrimitive2D& rPrimitive ) const + bool OverlayRectanglePrimitive::operator==( const BasePrimitive2D& rPrimitive ) const { if(DiscreteMetricDependentPrimitive2D::operator==(rPrimitive)) { - const OverlayHatchRectanglePrimitive& rCompare = static_cast< const OverlayHatchRectanglePrimitive& >(rPrimitive); + const OverlayRectanglePrimitive& rCompare = static_cast< const OverlayRectanglePrimitive& >(rPrimitive); return (getObjectRange() == rCompare.getObjectRange() - && getDiscreteHatchDistance() == rCompare.getDiscreteHatchDistance() - && getHatchRotation() == rCompare.getHatchRotation() - && getHatchColor() == rCompare.getHatchColor() + && getColor() == rCompare.getColor() + && getTransparence() == rCompare.getTransparence() && getDiscreteGrow() == rCompare.getDiscreteGrow() && getDiscreteShrink() == rCompare.getDiscreteShrink() && getRotation() == rCompare.getRotation()); @@ -262,7 +303,7 @@ namespace drawinglayer return false; } - ImplPrimitive2DIDBlock(OverlayHatchRectanglePrimitive, PRIMITIVE2D_ID_OVERLAYHATCHRECTANGLEPRIMITIVE) + ImplPrimitive2DIDBlock(OverlayRectanglePrimitive, PRIMITIVE2D_ID_OVERLAYRECTANGLEPRIMITIVE) } // end of namespace primitive2d } // end of namespace drawinglayer 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 #include #include +#include #include #include #include @@ -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 - #include - #include #include - #include #include #include @@ -33,7 +29,6 @@ #include #include #include - #include #include #include @@ -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 #ifdef DBG_UTIL #include #endif - -#include // for SetSolidDragging() -#include "svx/svdstr.hrc" // names taken from the resource -#include "svx/svdglob.hxx" // StringCache +#include +#include +#include "svx/svdstr.hrc" +#include "svx/svdglob.hxx" #include "svx/globl3d.hxx" #include #include - #include #include #include #include +#include +#include +#include //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -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 #include #include -#include +#include #include #include #include @@ -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 #include #include +#include +#include //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -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() diff --git a/svx/source/table/svdotable.cxx b/svx/source/table/svdotable.cxx index bed3988c7c81..2148eb98bf0a 100644 --- a/svx/source/table/svdotable.cxx +++ b/svx/source/table/svdotable.cxx @@ -2215,7 +2215,7 @@ void SdrTableObj::AddToHdlList(SdrHdlList& rHdlList) const // add remaining handles SdrHdl* pH=0; - rHdlList.AddHdl( pH = new TableBorderHdl( aRect ) ); pH->SetMoveOutside( true ); + rHdlList.AddHdl( pH = new TableBorderHdl( aRect, !IsTextEditActive() ) ); pH->SetMoveOutside( true ); rHdlList.AddHdl( pH = new SdrHdl(aRect.TopLeft(),HDL_UPLFT) ); pH->SetMoveOutside( true ); rHdlList.AddHdl( pH = new SdrHdl(aRect.TopCenter(),HDL_UPPER) ); pH->SetMoveOutside( true ); rHdlList.AddHdl( pH = new SdrHdl(aRect.TopRight(),HDL_UPRGT) ); pH->SetMoveOutside( true ); diff --git a/svx/source/table/tablehandles.cxx b/svx/source/table/tablehandles.cxx index 07fd729804b6..d6457e7becc0 100644 --- a/svx/source/table/tablehandles.cxx +++ b/svx/source/table/tablehandles.cxx @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include namespace sdr { namespace table { @@ -246,11 +246,13 @@ drawinglayer::primitive2d::Primitive2DSequence OverlayTableEdge::createOverlayOb // ==================================================================== -TableBorderHdl::TableBorderHdl( const Rectangle& rRect ) -: SdrHdl( rRect.TopLeft(), HDL_MOVE ) -, maRectangle( rRect ) +TableBorderHdl::TableBorderHdl( + const Rectangle& rRect, + bool bAnimate) +: SdrHdl(rRect.TopLeft(), HDL_MOVE), + maRectangle(rRect), + mbAnimate(bAnimate) { - } Pointer TableBorderHdl::GetPointer() const @@ -272,7 +274,6 @@ void TableBorderHdl::CreateB2dIAObject() { for(sal_uInt32 nWindow = 0; nWindow < pPageView->PageWindowCount(); nWindow++) { - // const SdrPageViewWinRec& rPageViewWinRec = rPageViewWinList[b]; const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(nWindow); if(rPageWindow.GetPaintWindow().OutputToWindow()) @@ -281,14 +282,24 @@ void TableBorderHdl::CreateB2dIAObject() if (xManager.is()) { const basegfx::B2DRange aRange(vcl::unotools::b2DRectangleFromRectangle(maRectangle)); - sdr::overlay::OverlayObject* pOverlayObject = new sdr::overlay::OverlayHatchRect( + const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer; + const Color aHilightColor(aSvtOptionsDrawinglayer.getHilightColor()); + const double fTransparence(aSvtOptionsDrawinglayer.GetTransparentSelectionPercent() * 0.01); + + sdr::overlay::OverlayObject* pOverlayObject = new sdr::overlay::OverlayRectangle( aRange.getMinimum(), aRange.getMaximum(), - Color(0x80, 0x80, 0x80), + aHilightColor, + fTransparence, 6.0, 0.0, - 45 * F_PI180, - 0.0); + 0.0, + 500, + // make animation dependent from text edit active, because for tables + // this handle is also used when text edit *is* active for it. This + // interferes too much concerning repaint stuff (at least as long as + // text edit is not yet on the overlay) + getAnimate()); xManager->add(*pOverlayObject); maOverlayGroup.append(*pOverlayObject); diff --git a/svx/source/table/tablehandles.hxx b/svx/source/table/tablehandles.hxx index 28e2200881a4..b9b745a89ba5 100644 --- a/svx/source/table/tablehandles.hxx +++ b/svx/source/table/tablehandles.hxx @@ -70,9 +70,12 @@ private: class TableBorderHdl : public SdrHdl { public: - TableBorderHdl( const Rectangle& rRect ); + TableBorderHdl( + const Rectangle& rRect, + bool bAnimate); virtual Pointer GetPointer() const; + bool getAnimate() const { return mbAnimate; } protected: // create marker for this kind @@ -80,6 +83,9 @@ protected: private: Rectangle maRectangle; + + /// bitfield + bool mbAnimate : 1; }; } // end of namespace table diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx index 3fa4a73870ee..a38e0cd2d901 100644 --- a/sw/source/core/frmedt/fecopy.cxx +++ b/sw/source/core/frmedt/fecopy.cxx @@ -1452,7 +1452,43 @@ void SwFEShell::Paste( SvStream& rStrm, sal_uInt16 nAction, const Point* pPt ) case SW_PASTESDR_SETATTR: { SfxItemSet aSet( GetAttrPool() ); - aSet.Put(pClpObj->GetMergedItemSet()); + const SdrGrafObj* pSdrGrafObj = dynamic_cast< const SdrGrafObj* >(pClpObj); + + if(pSdrGrafObj) + { + SdrObject* pTarget = 0; + + if(0 != pView->GetMarkedObjectList().GetMarkCount()) + { + // try to get target (if it's at least one, take first) + SdrMark* pMark = pView->GetMarkedObjectList().GetMark(0); + + if(pMark) + { + pTarget = pMark->GetMarkedSdrObj(); + } + } + + if(pTarget) + { + // copy ItemSet from target + aSet.Set(pTarget->GetMergedItemSet()); + } + + // for SdrGrafObj, use the graphic as fill style argument + const Graphic& rGraphic = pSdrGrafObj->GetGraphic(); + + if(GRAPHIC_NONE != rGraphic.GetType() && GRAPHIC_DEFAULT != rGraphic.GetType()) + { + aSet.Put(XFillBitmapItem(String(), rGraphic)); + aSet.Put(XFillStyleItem(XFILL_BITMAP)); + } + } + else + { + aSet.Put(pClpObj->GetMergedItemSet()); + } + pView->SetAttributes( aSet, sal_False ); } break; diff --git a/sw/source/ui/dochdl/swdtflvr.cxx b/sw/source/ui/dochdl/swdtflvr.cxx index 03efaa1bc0bb..80485bd41b8d 100644 --- a/sw/source/ui/dochdl/swdtflvr.cxx +++ b/sw/source/ui/dochdl/swdtflvr.cxx @@ -407,8 +407,13 @@ sal_Bool SwTransferable::GetData( const DataFlavor& rFlavor ) { SelectionType nSelectionType = pWrtShell->GetSelectionType(); -// SEL_GRF comes from ContentType of editsh - if( (nsSelectionType::SEL_GRF | nsSelectionType::SEL_DRW_FORM) & nSelectionType ) + // when pending we will not get the correct type, but nsSelectionType::SEL_TXT + // as fallback. This *happens* durning D&D, so we need to check if we are in + // the fallback and just try to get a graphic + const bool bPending(pWrtShell->BasicActionPend()); + + // SEL_GRF kommt vom ContentType der editsh + if(bPending || ((nsSelectionType::SEL_GRF | nsSelectionType::SEL_DRW_FORM) & nSelectionType)) { pClpGraphic = new Graphic; if( !pWrtShell->GetDrawObjGraphic( FORMAT_GDIMETAFILE, *pClpGraphic )) @@ -1215,8 +1220,31 @@ int SwTransferable::PasteData( TransferableDataHelper& rData, SwTransferable *pTrans=0, *pTunneledTrans=GetSwTransferable( rData ); - if( pPt && ( bPasteSelection ? 0 != ( pTrans = pMod->pXSelection ) - : 0 != ( pTrans = pMod->pDragDrop) )) + // check for private drop + bool bPrivateDrop(pPt && (bPasteSelection ? 0 != (pTrans = pMod->pXSelection) : 0 != (pTrans = pMod->pDragDrop))); + bool bNeedToSelectBeforePaste(false); + + if(bPrivateDrop && DND_ACTION_LINK == nDropAction) + { + // internal drop on object, suppress bPrivateDrop to change internal fill + bPrivateDrop = false; + bNeedToSelectBeforePaste = true; + } + + if(bPrivateDrop && pPt && DND_ACTION_MOVE == nDropAction) + { + // check if dragged over a useful target. If yes, use as content exchange + // drop as if from external + const SwFrmFmt* pSwFrmFmt = rSh.GetFmtFromObj(*pPt); + + if(pSwFrmFmt && 0 != dynamic_cast< const SwDrawFrmFmt* >(pSwFrmFmt)) + { + bPrivateDrop = false; + bNeedToSelectBeforePaste = true; + } + } + + if(bPrivateDrop) { // then internal Drag & Drop or XSelection nRet = pTrans->PrivateDrop( rSh, *pPt, DND_ACTION_MOVE == nDropAction, @@ -1267,7 +1295,7 @@ int SwTransferable::PasteData( TransferableDataHelper& rData, case SOT_FORMATSTR_ID_DRAWING: nRet = SwTransferable::_PasteSdrFormat( rData, rSh, SW_PASTESDR_INSERT, pPt, - nActionFlags ); + nActionFlags, bNeedToSelectBeforePaste); break; case SOT_FORMATSTR_ID_HTML: @@ -1305,7 +1333,7 @@ int SwTransferable::PasteData( TransferableDataHelper& rData, case SOT_FORMAT_GDIMETAFILE: nRet = SwTransferable::_PasteGrf( rData, rSh, nFormat, SW_PASTESDR_INSERT,pPt, - nActionFlags, bMsg ); + nActionFlags, nDropAction, bNeedToSelectBeforePaste); break; case SOT_FORMATSTR_ID_XFORMS: @@ -1425,7 +1453,7 @@ int SwTransferable::PasteData( TransferableDataHelper& rData, case SOT_FORMATSTR_ID_DRAWING: nRet = SwTransferable::_PasteSdrFormat( rData, rSh, SW_PASTESDR_SETATTR, pPt, - nActionFlags ); + nActionFlags, bNeedToSelectBeforePaste); break; case SOT_FORMATSTR_ID_SVXB: case SOT_FORMAT_GDIMETAFILE: @@ -1436,7 +1464,7 @@ int SwTransferable::PasteData( TransferableDataHelper& rData, case SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR: nRet = SwTransferable::_PasteGrf( rData, rSh, nFormat, SW_PASTESDR_SETATTR, pPt, - nActionFlags, bMsg ); + nActionFlags, nDropAction, bNeedToSelectBeforePaste); break; default: OSL_FAIL( "unknown format" ); @@ -1447,7 +1475,7 @@ int SwTransferable::PasteData( TransferableDataHelper& rData, case EXCHG_OUT_ACTION_INSERT_DRAWOBJ: nRet = SwTransferable::_PasteSdrFormat( rData, rSh, SW_PASTESDR_INSERT, pPt, - nActionFlags ); + nActionFlags, bNeedToSelectBeforePaste); break; case EXCHG_OUT_ACTION_INSERT_SVXB: case EXCHG_OUT_ACTION_INSERT_GDIMETAFILE: @@ -1455,13 +1483,13 @@ int SwTransferable::PasteData( TransferableDataHelper& rData, case EXCHG_OUT_ACTION_INSERT_GRAPH: nRet = SwTransferable::_PasteGrf( rData, rSh, nFormat, SW_PASTESDR_INSERT, pPt, - nActionFlags, bMsg ); + nActionFlags, nDropAction, bNeedToSelectBeforePaste); break; case EXCHG_OUT_ACTION_REPLACE_DRAWOBJ: nRet = SwTransferable::_PasteSdrFormat( rData, rSh, SW_PASTESDR_REPLACE, pPt, - nActionFlags ); + nActionFlags, bNeedToSelectBeforePaste); break; case EXCHG_OUT_ACTION_REPLACE_SVXB: @@ -1470,7 +1498,7 @@ int SwTransferable::PasteData( TransferableDataHelper& rData, case EXCHG_OUT_ACTION_REPLACE_GRAPH: nRet = SwTransferable::_PasteGrf( rData, rSh, nFormat, SW_PASTESDR_REPLACE,pPt, - nActionFlags, bMsg ); + nActionFlags, nDropAction, bNeedToSelectBeforePaste); break; case EXCHG_OUT_ACTION_INSERT_INTERACTIVE: @@ -2151,13 +2179,21 @@ int SwTransferable::_PasteDDE( TransferableDataHelper& rData, int SwTransferable::_PasteSdrFormat( TransferableDataHelper& rData, SwWrtShell& rSh, sal_uInt16 nAction, - const Point* pPt, sal_uInt8 nActionFlags ) + const Point* pPt, sal_uInt8 nActionFlags, bool bNeedToSelectBeforePaste) { int nRet = 0; SotStorageStreamRef xStrm; if( rData.GetSotStorageStream( SOT_FORMATSTR_ID_DRAWING, xStrm )) { xStrm->SetVersion( SOFFICE_FILEFORMAT_50 ); + + if(bNeedToSelectBeforePaste && pPt) + { + // if this is an internal drag, need to set the target right (select it), else + // still the source will be selected + SwTransferable::SetSelInShell( rSh, sal_True, pPt ); + } + rSh.Paste( *xStrm, nAction, pPt ); nRet = 1; @@ -2170,7 +2206,7 @@ int SwTransferable::_PasteSdrFormat( TransferableDataHelper& rData, int SwTransferable::_PasteGrf( TransferableDataHelper& rData, SwWrtShell& rSh, sal_uLong nFmt, sal_uInt16 nAction, const Point* pPt, - sal_uInt8 nActionFlags, sal_Bool /*bMsg*/ ) + sal_uInt8 nActionFlags, sal_Int8 /* nDropAction */, bool bNeedToSelectBeforePaste) { int nRet = 0; @@ -2185,6 +2221,19 @@ int SwTransferable::_PasteGrf( TransferableDataHelper& rData, SwWrtShell& rSh, nRet = rData.GetGraphic( nFmt, aGraphic ); break; + case SOT_FORMATSTR_ID_SVXB: + { + SotStorageStreamRef xStm; + + if(rData.GetSotStorageStream(SOT_FORMATSTR_ID_SVXB, xStm)) + { + *xStm >> aGraphic; + nRet = (GRAPHIC_NONE != aGraphic.GetType() && GRAPHIC_DEFAULT != aGraphic.GetType()); + } + + break; + } + case SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK: case SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR: case SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR: @@ -2237,6 +2286,15 @@ int SwTransferable::_PasteGrf( TransferableDataHelper& rData, SwWrtShell& rSh, } } + if(pPt && bNeedToSelectBeforePaste) + { + // when using internal D&Ds, still the source object is selected and + // this is necessary to get the correct source data which is also + // dependent from selection. After receiving the drag data it is + // now tiime to select the correct target object + SwTransferable::SetSelInShell( rSh, sal_True, pPt ); + } + if( nRet ) { //Check and Perform rotation if needed @@ -2402,10 +2460,10 @@ int SwTransferable::_PasteAsHyperlink( TransferableDataHelper& rData, int SwTransferable::_PasteFileName( TransferableDataHelper& rData, SwWrtShell& rSh, sal_uLong nFmt, sal_uInt16 nAction, const Point* pPt, - sal_uInt8 nActionFlags, sal_Bool bMsg ) + sal_uInt8 nActionFlags, sal_Bool /* bMsg */) { int nRet = SwTransferable::_PasteGrf( rData, rSh, nFmt, nAction, - pPt, nActionFlags, bMsg ); + pPt, nActionFlags, 0, false); if( nRet ) nRet |= SWTRANSFER_GRAPHIC_INSERTED; if( !nRet ) diff --git a/sw/source/ui/inc/swdtflvr.hxx b/sw/source/ui/inc/swdtflvr.hxx index e790297a7b1d..ad9d369d5128 100644 --- a/sw/source/ui/inc/swdtflvr.hxx +++ b/sw/source/ui/inc/swdtflvr.hxx @@ -101,11 +101,11 @@ class SwTransferable : public TransferableHelper static int _PasteSdrFormat( TransferableDataHelper& rData, SwWrtShell& rSh, sal_uInt16 nAction, - const Point* pPt, sal_uInt8 nActionFlags ); + const Point* pPt, sal_uInt8 nActionFlags, bool bNeedToSelectBeforePaste); static int _PasteGrf( TransferableDataHelper& rData, SwWrtShell& rSh, sal_uLong nFmt, sal_uInt16 nAction, const Point* pPt, - sal_uInt8 nActionFlags, sal_Bool bMsg ); + sal_uInt8 nActionFlags, sal_Int8 nDropAction, bool bNeedToSelectBeforePaste); static int _PasteImageMap( TransferableDataHelper& rData, SwWrtShell& rSh ); -- cgit