diff options
author | Jens-Heiner Rechtien <hr@openoffice.org> | 2008-11-19 14:05:59 +0000 |
---|---|---|
committer | Jens-Heiner Rechtien <hr@openoffice.org> | 2008-11-19 14:05:59 +0000 |
commit | ddcf9b9ff2caaffcc59d250b2d7f50ca3ab20330 (patch) | |
tree | ad470e65da542ad344e126f1964ed2d7c248e3a2 | |
parent | 1d100003531c186944b2d5dee020246d9d2f9a0b (diff) |
CWS-TOOLING: integrate CWS aw058
2008-11-19 14:27:57 +0100 aw r263994 : #i95264# corrected line primitive range calculation for hairlines
2008-11-18 11:31:52 +0100 wg r263754 : i96156
2008-11-18 11:22:38 +0100 wg r263752 : i96156
2008-11-13 11:46:49 +0100 aw r263626 : #i93169# used flag the wrong way; true means that nothing was done yet
2008-11-12 15:33:41 +0100 wg r263601 : i96156
2008-11-12 13:22:38 +0100 wg r263592 : i95527
2008-11-12 13:18:51 +0100 wg r263591 : i95527
2008-10-29 13:22:02 +0100 aw r262794 : #i93485# identified reason and with PL's help changed problem accordingly with usage of an old fallback. This will need to be optimized again by HDU when he finds the time.
2008-10-28 18:23:04 +0100 aw r262763 : unxmacxi compiler warning fixed
2008-10-28 18:17:01 +0100 aw r262762 : unxmacxi compiler warning fixed
2008-10-28 17:55:18 +0100 aw r262761 : unxmacxi compiler warning fixed
2008-10-28 13:48:22 +0100 aw r262743 : #i93485# added UnifiedAlphaPrimitive2D to VclRenderer; corrected getB2DRange implementations for hairlines which are view-dependent
2008-10-28 12:40:55 +0100 aw r262735 : #i93485# had to move Pre/PostPaint to LocalPre/PostPaint since PrePaint is a virtual window method
2008-10-27 15:54:10 +0100 aw r262679 : #i19871# adapted the call order to parent implementations in some Nbc methods in SdrPathObj due to errors in SnapRect recalculation when GluePoints are involved
2008-10-24 18:31:48 +0200 aw r262661 : #i77187# disable all buttons in bezier toolbar when move and/or resize protected object is involved
2008-10-24 18:30:16 +0200 aw r262660 : #i77187# simplified and secured model changers, added toolbar update, disabled move drag start when polygon point is selected
2008-10-24 12:57:50 +0200 hdu r262635 : #i93485# use device transformation for SAL layer
2008-10-24 12:41:37 +0200 hdu r262634 : #i93485# use device transformation for SAL layer
2008-10-23 19:46:12 +0200 aw r262630 : mac compiler warning fixed
2008-10-23 18:15:02 +0200 aw r262628 : #i93485# modified dialog previews to use prerendering
2008-10-23 18:14:27 +0200 aw r262627 : #i93485# added assert when render helper uses Window as copy source
2008-10-22 18:07:30 +0200 aw r262610 : #i95264# fixes assertion
2008-10-22 14:31:51 +0200 aw r262606 : #i89661# also enabling DrawTransparent shortcut for VCL-Renderer
2008-10-22 14:10:31 +0200 aw r262604 : #i89661# new HitTest 2D primitive to support BoundRect and HitTest calculations/tests
2008-10-22 14:09:22 +0200 aw r262603 : #i89661# new HitTest tolerance, new TextFrame selection overlay, support for HitTest geometry
2008-10-22 14:08:16 +0200 aw r262602 : #i89661# correcting old HitTest tolerance expansion
2008-10-20 15:31:48 +0200 aw r262321 : #i89661# added patch to test it
2008-10-20 11:50:31 +0200 aw r262310 : #i87762# removed no longer used icons (aw053)
2008-10-17 15:41:48 +0200 aw r262288 : #i93169#, #i93180# FormControl corrections for Primitive handling
2008-10-17 15:40:54 +0200 aw r262287 : #i93169#, #i93180# FormControl corrections for Primitive handling
2008-10-16 11:12:44 +0200 aw r262253 : #i93595# removed superfluous grid interface
2008-10-16 11:11:20 +0200 aw r262252 : #i93595# changed grid display to sub-grid usage and new defaults
2008-10-15 15:09:40 +0200 aw r262234 : #i93597# moved flag for only vertical PageBorder, added reacting on it to primitive creation
2008-10-15 15:09:09 +0200 aw r262233 : #i93597# moved flag for only vertical PageBorder
2008-10-15 15:08:46 +0200 aw r262232 : #i93597# moved flag for only vertical PageBorder, added reacting on it to primitive creation
2008-10-14 16:27:07 +0200 aw r262207 : #i93648# (flushViewObjectContacts) and #i93318# (propertyChange)
2008-10-14 16:25:10 +0200 aw r262206 : #i93318# back to old state since detecting a change is not placed well at the primitive (which is a graphical information at the itme it was fetched). Instead i will add the needed check and flush at the FormControl's VOC
2008-10-14 13:47:38 +0200 aw r262201 : #i93318# added a change listener to the XControlModel and code to make the operator== at control primitive fail
52 files changed, 1509 insertions, 696 deletions
diff --git a/drawinglayer/inc/drawinglayer/attribute/sdrattribute.hxx b/drawinglayer/inc/drawinglayer/attribute/sdrattribute.hxx index 132ad00a98d5..a22d453c1657 100644 --- a/drawinglayer/inc/drawinglayer/attribute/sdrattribute.hxx +++ b/drawinglayer/inc/drawinglayer/attribute/sdrattribute.hxx @@ -73,6 +73,9 @@ namespace drawinglayer const ::std::vector< double >& rDotDashArray, double fFullDotDashLen); ~SdrLineAttribute(); + // constructor to create a line attribute for a colored hairline + SdrLineAttribute(const basegfx::BColor& rColor); + // compare operator bool operator==(const SdrLineAttribute& rCandidate) const; diff --git a/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx index 3be3b8c4a588..926ecfe96137 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx @@ -99,6 +99,7 @@ #define PRIMITIVE2D_ID_CHARTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 48) #define PRIMITIVE2D_ID_STRUCTURETAGRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 49) #define PRIMITIVE2D_ID_BORDERLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 50) +#define PRIMITIVE2D_ID_HITTESTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 51) ////////////////////////////////////////////////////////////////////////////// diff --git a/drawinglayer/inc/drawinglayer/primitive2d/hittestprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/hittestprimitive2d.hxx new file mode 100644 index 000000000000..2bbcad315eb3 --- /dev/null +++ b/drawinglayer/inc/drawinglayer/primitive2d/hittestprimitive2d.hxx @@ -0,0 +1,81 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hittestprimitive3d.hxx,v $ + * + * $Revision: 1.1.2.1 $ + * + * last change: $Author: aw $ $Date: 2008/09/24 14:27:39 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_HITTESTPRIMITIVE2D_HXX +#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_HITTESTPRIMITIVE2D_HXX + +#include <drawinglayer/primitive2d/groupprimitive2d.hxx> + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + // This primitive is used to represent geometry for non-visible objects, + // e.g. a PresObj's outline. To still be able to use primitives for HitTest + // functionality, the 2d decompositions will produce an as much as possible + // simplified line geometry encapsulated in this primtive when there is no + // line geometry. In a further enchanced version this may change to 'if neither + // filled nor lines' creation criteria. The whole primitive decomposes to nothing, + // so no one not knowing it will be influenced. Only helper processors for hit test + // (and maybe BoundRect extractors) will use it and it's children subcontent. + class HitTestPrimitive2D : public GroupPrimitive2D + { + protected: + // local decomposition. Implementation will return empty Primitive2DSequence + // since this is no visualisation data + virtual Primitive2DSequence createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + + public: + HitTestPrimitive2D(const Primitive2DSequence& rChildren); + + // despite returning an empty decomposition since it's no visualisation data, + // range calculation is intended to use invisible replacement geometry, so + // the local implementation will return the children's range + virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; + + // provide unique ID + DeclPrimitrive2DIDBlock() + }; + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_HITTESTPRIMITIVE2D_HXX + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx b/drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx index 82c65e249c2e..82c7f4824af4 100644 --- a/drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx +++ b/drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx @@ -54,6 +54,7 @@ namespace drawinglayer { namespace primitive2d { class PolyPolygonColorPrimitive2D; class MetafilePrimitive2D; class MaskPrimitive2D; + class UnifiedAlphaPrimitive2D; class AlphaPrimitive2D; class TransformPrimitive2D; class MarkerArrayPrimitive2D; @@ -103,6 +104,7 @@ namespace drawinglayer void RenderMetafilePrimitive2D(const primitive2d::MetafilePrimitive2D& rPolygonCandidate); void RenderMaskPrimitive2DPixel(const primitive2d::MaskPrimitive2D& rMaskCandidate); void RenderModifiedColorPrimitive2D(const primitive2d::ModifiedColorPrimitive2D& rModifiedCandidate); + void RenderUnifiedAlphaPrimitive2D(const primitive2d::UnifiedAlphaPrimitive2D& rTransCandidate); void RenderAlphaPrimitive2D(const primitive2d::AlphaPrimitive2D& rTransCandidate); void RenderTransformPrimitive2D(const primitive2d::TransformPrimitive2D& rTransformCandidate); void RenderPagePreviewPrimitive2D(const primitive2d::PagePreviewPrimitive2D& rPagePreviewCandidate); @@ -115,10 +117,6 @@ namespace drawinglayer void adaptLineToFillDrawMode() const; void adaptTextToFillDrawMode() const; - ///////////////////////////////////////////////////////////////////////////// - // FormControl support - basegfx::B2DPoint PositionAndSizeControl(const primitive2d::ControlPrimitive2D& rControlPrimitive2D); - public: // constructor/destructor VclProcessor2D( diff --git a/drawinglayer/prj/d.lst b/drawinglayer/prj/d.lst index 3e3055d73cfb..3f71b945fbbf 100644 --- a/drawinglayer/prj/d.lst +++ b/drawinglayer/prj/d.lst @@ -24,6 +24,7 @@ mkdir: %_DEST%\inc%_EXT%\drawinglayer\primitive2d ..\inc\drawinglayer\primitive2d\gridprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\gridprimitive2d.hxx ..\inc\drawinglayer\primitive2d\groupprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\groupprimitive2d.hxx ..\inc\drawinglayer\primitive2d\helplineprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\helplineprimitive2d.hxx +..\inc\drawinglayer\primitive2d\hittestprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\hittestprimitive2d.hxx ..\inc\drawinglayer\primitive2d\markerarrayprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\markerarrayprimitive2d.hxx ..\inc\drawinglayer\primitive2d\maskprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\maskprimitive2d.hxx ..\inc\drawinglayer\primitive2d\mediaprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\mediaprimitive2d.hxx diff --git a/drawinglayer/source/attribute/sdrattribute.cxx b/drawinglayer/source/attribute/sdrattribute.cxx index b34ed9cbf8d0..8e55afa6751e 100644 --- a/drawinglayer/source/attribute/sdrattribute.cxx +++ b/drawinglayer/source/attribute/sdrattribute.cxx @@ -58,6 +58,16 @@ namespace drawinglayer { } + SdrLineAttribute::SdrLineAttribute(const basegfx::BColor& rColor) + : meJoin(basegfx::B2DLINEJOIN_NONE), + mfWidth(0.0), + mfTransparence(0.0), + maColor(rColor), + maDotDashArray(), + mfFullDotDashLen(0.0) + { + } + SdrLineAttribute::~SdrLineAttribute() { } diff --git a/drawinglayer/source/primitive2d/hittestprimitive2d.cxx b/drawinglayer/source/primitive2d/hittestprimitive2d.cxx new file mode 100644 index 000000000000..daf65abd81d4 --- /dev/null +++ b/drawinglayer/source/primitive2d/hittestprimitive2d.cxx @@ -0,0 +1,76 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hittestprimitive3d.cxx,v $ + * + * $Revision: 1.1.2.1 $ + * + * last change: $Author: aw $ $Date: 2008/09/25 17:12:14 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_drawinglayer.hxx" + +#include <drawinglayer/primitive2d/hittestprimitive2d.hxx> +#include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx> + +////////////////////////////////////////////////////////////////////////////// + +using namespace com::sun::star; + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + Primitive2DSequence HitTestPrimitive2D::createLocalDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + { + // return empty sequence + return Primitive2DSequence(); + } + + HitTestPrimitive2D::HitTestPrimitive2D( + const Primitive2DSequence& rChildren) + : GroupPrimitive2D(rChildren) + { + } + + basegfx::B2DRange HitTestPrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const + { + return getB2DRangeFromPrimitive2DSequence(getChildren(), rViewInformation); + } + + // provide unique ID + ImplPrimitrive2DIDBlock(HitTestPrimitive2D, PRIMITIVE2D_ID_HITTESTPRIMITIVE2D) + + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/source/primitive2d/makefile.mk b/drawinglayer/source/primitive2d/makefile.mk index 563bd3ae6a71..b909d0fde9f5 100644 --- a/drawinglayer/source/primitive2d/makefile.mk +++ b/drawinglayer/source/primitive2d/makefile.mk @@ -61,6 +61,7 @@ SLOFILES= \ $(SLO)$/gridprimitive2d.obj \ $(SLO)$/groupprimitive2d.obj \ $(SLO)$/helplineprimitive2d.obj \ + $(SLO)$/hittestprimitive2d.obj \ $(SLO)$/markerarrayprimitive2d.obj \ $(SLO)$/pointarrayprimitive2d.obj \ $(SLO)$/maskprimitive2d.obj \ diff --git a/drawinglayer/source/primitive2d/polygonprimitive2d.cxx b/drawinglayer/source/primitive2d/polygonprimitive2d.cxx index f32492804b1a..958f11bf81ca 100644 --- a/drawinglayer/source/primitive2d/polygonprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/polygonprimitive2d.cxx @@ -42,6 +42,7 @@ #include <basegfx/polygon/b2dpolypolygontools.hxx> #include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx> #include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx> +#include <drawinglayer/geometry/viewinformation2d.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -75,10 +76,26 @@ namespace drawinglayer return false; } - basegfx::B2DRange PolygonHairlinePrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const + basegfx::B2DRange PolygonHairlinePrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const { + // this is a hairline, thus the line width is view-dependent. Get range of polygon + // as base size + basegfx::B2DRange aRetval(getB2DPolygon().getB2DRange()); + + if(!aRetval.isEmpty()) + { + // Calculate view-dependent hairline width + const basegfx::B2DVector aDiscreteSize(rViewInformation.getInverseObjectToViewTransformation() * basegfx::B2DVector(1.0, 0.0)); + const double fDiscreteHalfLineWidth(aDiscreteSize.getLength() * 0.5); + + if(basegfx::fTools::more(fDiscreteHalfLineWidth, 0.0)) + { + aRetval.grow(fDiscreteHalfLineWidth); + } + } + // return range - return basegfx::tools::getRange(getB2DPolygon()); + return aRetval; } // provide unique ID @@ -273,28 +290,44 @@ namespace drawinglayer basegfx::B2DRange PolygonStrokePrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const { + basegfx::B2DRange aRetval; + if(getLineAttribute().getWidth()) { if(basegfx::B2DLINEJOIN_MITER == getLineAttribute().getLineJoin()) { // if line is mitered, use parent call since mitered line // geometry may use more space than the geometry grown by half line width - return BasePrimitive2D::getB2DRange(rViewInformation); + aRetval = BasePrimitive2D::getB2DRange(rViewInformation); } else { // for all other B2DLINEJOIN_* get the range from the base geometry // and expand by half the line width - basegfx::B2DRange aRetval(basegfx::tools::getRange(getB2DPolygon())); - aRetval.grow(getLineAttribute().getWidth() / 2.0); - return aRetval; + aRetval = getB2DPolygon().getB2DRange(); + aRetval.grow(getLineAttribute().getWidth() * 0.5); } } else { - // range of polygon is adequate - return basegfx::tools::getRange(getB2DPolygon()); + // this is a hairline, thus the line width is view-dependent. Get range of polygon + // as base size + aRetval = getB2DPolygon().getB2DRange(); + + if(!aRetval.isEmpty()) + { + // Calculate view-dependent hairline width + const basegfx::B2DVector aDiscreteSize(rViewInformation.getInverseObjectToViewTransformation() * basegfx::B2DVector(1.0, 0.0)); + const double fDiscreteHalfLineWidth(aDiscreteSize.getLength() * 0.5); + + if(basegfx::fTools::more(fDiscreteHalfLineWidth, 0.0)) + { + aRetval.grow(fDiscreteHalfLineWidth); + } + } } + + return aRetval; } // provide unique ID @@ -396,15 +429,15 @@ namespace drawinglayer basegfx::B2DRange aRetval(PolygonStrokePrimitive2D::getB2DRange(rViewInformation)); // if WaveHeight, grow by it - if(!basegfx::fTools::equalZero(getWaveHeight())) + if(basegfx::fTools::more(getWaveHeight(), 0.0)) { aRetval.grow(getWaveHeight()); } // if line width, grow by it - if(!basegfx::fTools::equalZero(getLineAttribute().getWidth())) + if(basegfx::fTools::more(getLineAttribute().getWidth(), 0.0)) { - aRetval.grow(getLineAttribute().getWidth()); + aRetval.grow(getLineAttribute().getWidth() * 0.5); } return aRetval; diff --git a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx index 63ee8108c35c..629ad681a41f 100644 --- a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx +++ b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx @@ -68,6 +68,10 @@ namespace drawinglayer { maContent.SetOutputSizePixel(maDestPixel.GetSize(), false); + // #i93485# assert when copying from window to VDev is used + OSL_ENSURE(rOutDev.GetOutDevType() != OUTDEV_WINDOW, + "impBufferDevice render helper: Copying from Window to VDev, this should be avoided (!)"); + const bool bWasEnabledSrc(rOutDev.IsMapModeEnabled()); rOutDev.EnableMapMode(false); maContent.DrawOutDev(aEmptyPoint, maDestPixel.GetSize(), maDestPixel.TopLeft(), maDestPixel.GetSize(), rOutDev); diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx index 077670481c96..bc7e659a8996 100644 --- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx @@ -98,23 +98,14 @@ ////////////////////////////////////////////////////////////////////////////// +using namespace com::sun::star; + +////////////////////////////////////////////////////////////////////////////// + namespace drawinglayer { namespace processor2d { - ////////////////////////////////////////////////////////////////////////////// - // UNO usings - using ::com::sun::star::uno::Reference; - using ::com::sun::star::uno::UNO_QUERY; - using ::com::sun::star::uno::UNO_QUERY_THROW; - using ::com::sun::star::uno::Exception; - using ::com::sun::star::beans::XPropertySet; - using ::com::sun::star::beans::XPropertySetInfo; - using ::com::sun::star::awt::XView; - //using ::com::sun::star::awt::XGraphics; - //using ::com::sun::star::awt::XWindow; - //using ::com::sun::star::awt::PosSize::POSSIZE; - Rectangle VclMetafileProcessor2D::impDumpToMetaFile( const primitive2d::Primitive2DSequence& rContent, GDIMetaFile& o_rContentMetafile) @@ -387,7 +378,7 @@ namespace drawinglayer } // init static break iterator - Reference< ::com::sun::star::i18n::XBreakIterator > VclMetafileProcessor2D::mxBreakIterator; + uno::Reference< ::com::sun::star::i18n::XBreakIterator > VclMetafileProcessor2D::mxBreakIterator; VclMetafileProcessor2D::VclMetafileProcessor2D(const geometry::ViewInformation2D& rViewInformation, OutputDevice& rOutDev) : VclProcessor2D(rViewInformation, rOutDev), @@ -691,93 +682,113 @@ namespace drawinglayer case PRIMITIVE2D_ID_CONTROLPRIMITIVE2D : { const primitive2d::ControlPrimitive2D& rControlPrimitive = static_cast< const primitive2d::ControlPrimitive2D& >(rCandidate); - bool bDoProcessRecursively(true); - static bool bSuppressPDFExtOutDevDataSupport(false); - static bool bSuppressPrinterOutput(false); + const uno::Reference< awt::XControl >& rXControl(rControlPrimitive.getXControl()); + bool bIsPrintableControl(false); - if(mpPDFExtOutDevData && !bSuppressPDFExtOutDevDataSupport && mpPDFExtOutDevData->GetIsExportFormFields()) + // find out if control is printable + if(rXControl.is()) { - // emulate data handling from UnoControlPDFExportContact - // I have now moved describePDFControl to toolkit, thus i can implement the PDF - // form control support now as follows - ::std::auto_ptr< ::vcl::PDFWriter::AnyWidget > pPDFControl; - ::toolkitform::describePDFControl( rControlPrimitive.getXControl(), pPDFControl ); - - if(pPDFControl.get()) + try { - // still need to fill in the location (is a class Rectangle) - const basegfx::B2DRange aRangeLogic(rControlPrimitive.getB2DRange(getViewInformation2D())); - const Rectangle aRectLogic( - (sal_Int32)floor(aRangeLogic.getMinX()), (sal_Int32)floor(aRangeLogic.getMinY()), - (sal_Int32)ceil(aRangeLogic.getMaxX()), (sal_Int32)ceil(aRangeLogic.getMaxY())); - pPDFControl->Location = aRectLogic; - - Size aFontSize(pPDFControl->TextFont.GetSize()); - aFontSize = mpOutputDevice->LogicToLogic(aFontSize, MapMode(MAP_POINT), mpOutputDevice->GetMapMode()); - pPDFControl->TextFont.SetSize(aFontSize); + uno::Reference< beans::XPropertySet > xModelProperties(rXControl->getModel(), uno::UNO_QUERY); + uno::Reference< beans::XPropertySetInfo > xPropertyInfo(xModelProperties.is() + ? xModelProperties->getPropertySetInfo() + : uno::Reference< beans::XPropertySetInfo >()); + const ::rtl::OUString sPrintablePropertyName(RTL_CONSTASCII_USTRINGPARAM("Printable")); - mpPDFExtOutDevData->BeginStructureElement(vcl::PDFWriter::Form); - mpPDFExtOutDevData->CreateControl(*pPDFControl.get()); - mpPDFExtOutDevData->EndStructureElement(); - - // no normal paint needed (see original UnoControlPDFExportContact::do_PaintObject); - // do not process recursively - bDoProcessRecursively = false; + if(xPropertyInfo.is() && xPropertyInfo->hasPropertyByName(sPrintablePropertyName)) + { + OSL_VERIFY(xModelProperties->getPropertyValue(sPrintablePropertyName) >>= bIsPrintableControl); + } + } + catch(const uno::Exception&) + { + OSL_ENSURE(false, "VclMetafileProcessor2D: No access to printable flag of Control, caught an exception!"); } } - // printer output preparation - if(bDoProcessRecursively && !bSuppressPrinterOutput) + // PDF export and printing only for printable controls + if(bIsPrintableControl) { - // this needs to do the same as UnoControlPrintOrPreviewContact::do_PaintObject - // does ATM. This means prepare_PrintOrPrintPreview and paint_Control - bool bIsPrintableControl(false); + const bool bPDFExport(mpPDFExtOutDevData && mpPDFExtOutDevData->GetIsExportFormFields()); + bool bDoProcessRecursively(true); - if(rControlPrimitive.getXControl().is()) + if(bPDFExport) { - try + // PDF export. Emulate data handling from UnoControlPDFExportContact + // I have now moved describePDFControl to toolkit, thus i can implement the PDF + // form control support now as follows + ::std::auto_ptr< ::vcl::PDFWriter::AnyWidget > pPDFControl; + ::toolkitform::describePDFControl(rXControl, pPDFControl); + + if(pPDFControl.get()) { - // find out if control is printable - Reference< XPropertySet > xModelProperties(rControlPrimitive.getXControl()->getModel(), UNO_QUERY); - Reference< XPropertySetInfo > xPropertyInfo(xModelProperties.is() - ? xModelProperties->getPropertySetInfo() - : Reference< XPropertySetInfo >()); - const ::rtl::OUString sPrintablePropertyName(RTL_CONSTASCII_USTRINGPARAM("Printable")); - - if(xPropertyInfo.is() && xPropertyInfo->hasPropertyByName(sPrintablePropertyName)) - { - OSL_VERIFY(xModelProperties->getPropertyValue(sPrintablePropertyName) >>= bIsPrintableControl); - } + // still need to fill in the location (is a class Rectangle) + const basegfx::B2DRange aRangeLogic(rControlPrimitive.getB2DRange(getViewInformation2D())); + const Rectangle aRectLogic( + (sal_Int32)floor(aRangeLogic.getMinX()), (sal_Int32)floor(aRangeLogic.getMinY()), + (sal_Int32)ceil(aRangeLogic.getMaxX()), (sal_Int32)ceil(aRangeLogic.getMaxY())); + pPDFControl->Location = aRectLogic; + + Size aFontSize(pPDFControl->TextFont.GetSize()); + aFontSize = mpOutputDevice->LogicToLogic(aFontSize, MapMode(MAP_POINT), mpOutputDevice->GetMapMode()); + pPDFControl->TextFont.SetSize(aFontSize); + + mpPDFExtOutDevData->BeginStructureElement(vcl::PDFWriter::Form); + mpPDFExtOutDevData->CreateControl(*pPDFControl.get()); + mpPDFExtOutDevData->EndStructureElement(); + + // no normal paint needed (see original UnoControlPDFExportContact::do_PaintObject); + // do not process recursively + bDoProcessRecursively = false; } - catch(const Exception&) + else { - OSL_ENSURE(false, "VclMetafileProcessor2D: No access to printable flag of Control, caught an exception!"); + // PDF export did not work, try simple output. + // Fallback to printer output by not setting bDoProcessRecursively + // to false. } } - if(bIsPrintableControl) + // #i93169# used flag the wrong way; true means that nothing was done yet + if(bDoProcessRecursively) { + // printer output try { - // update position and size - const basegfx::B2DPoint aTopLeftPixel(PositionAndSizeControl(rControlPrimitive)); + // remember old graphics and create new + uno::Reference< awt::XView > xControlView(rXControl, uno::UNO_QUERY_THROW); + const uno::Reference< awt::XGraphics > xOriginalGraphics(xControlView->getGraphics()); + const uno::Reference< awt::XGraphics > xNewGraphics(mpOutputDevice->CreateUnoGraphics()); - // output to given device - Reference< XView > xControlView(rControlPrimitive.getXControl(), UNO_QUERY_THROW); - xControlView->draw(basegfx::fround(aTopLeftPixel.getX()), basegfx::fround(aTopLeftPixel.getY())); - bDoProcessRecursively = false; + if(xNewGraphics.is()) + { + // link graphics and view + xControlView->setGraphics(xNewGraphics); + + // get position + const basegfx::B2DHomMatrix aObjectToDiscrete(getViewInformation2D().getObjectToViewTransformation() * rControlPrimitive.getTransform()); + const basegfx::B2DPoint aTopLeftDiscrete(aObjectToDiscrete * basegfx::B2DPoint(0.0, 0.0)); + + // draw it + xControlView->draw(basegfx::fround(aTopLeftDiscrete.getX()), basegfx::fround(aTopLeftDiscrete.getY())); + bDoProcessRecursively = false; + + // restore original graphics + xControlView->setGraphics(xOriginalGraphics); + } } - catch( const Exception& ) + catch( const uno::Exception& ) { OSL_ENSURE(false, "VclMetafileProcessor2D: Printing of Control failed, caught an exception!"); } } - } - // process recursively and add MetaFile comment - if(bDoProcessRecursively) - { - process(rControlPrimitive.get2DDecomposition(getViewInformation2D())); + // process recursively if not done yet to export as decomposition (bitmap) + if(bDoProcessRecursively) + { + process(rControlPrimitive.get2DDecomposition(getViewInformation2D())); + } } break; @@ -917,8 +928,8 @@ namespace drawinglayer // support for TEXT_ MetaFile actions only for decorated texts if(!mxBreakIterator.is()) { - Reference< ::com::sun::star::lang::XMultiServiceFactory > xMSF(::comphelper::getProcessServiceFactory()); - mxBreakIterator.set(xMSF->createInstance(rtl::OUString::createFromAscii("com.sun.star.i18n.BreakIterator")), UNO_QUERY); + uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xMSF(::comphelper::getProcessServiceFactory()); + mxBreakIterator.set(xMSF->createInstance(rtl::OUString::createFromAscii("com.sun.star.i18n.BreakIterator")), uno::UNO_QUERY); } if(mxBreakIterator.is()) diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx index 3b3a0f19f612..cebc2d484889 100644 --- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx @@ -62,10 +62,16 @@ #include <drawinglayer/primitive2d/fillhatchprimitive2d.hxx> #include <basegfx/polygon/b2dpolygontools.hxx> #include <vcl/hatch.hxx> +#include <tools/diagnose_ex.h> +#include <com/sun/star/awt/PosSize.hpp> #include <cstdio> ////////////////////////////////////////////////////////////////////////////// +using namespace com::sun::star; + +////////////////////////////////////////////////////////////////////////////// + namespace drawinglayer { namespace processor2d @@ -242,9 +248,9 @@ namespace drawinglayer const primitive2d::Primitive2DSequence rContent = rUniAlphaCandidate.getChildren(); bool bDrawTransparentUsed(false); - // ATM need to disable this since OutputDevice::DrawTransparent uses the - // old tools::Polygon classes and may not be sufficient here. HDU is evaluating... - static bool bAllowUsingDrawTransparent(false); + // since DEV300 m33 DrawTransparent is supported in VCL (for some targets + // natively), so i am now enabling this shortcut + static bool bAllowUsingDrawTransparent(true); if(bAllowUsingDrawTransparent && rContent.hasElements() && 1 == rContent.getLength()) { @@ -268,8 +274,8 @@ namespace drawinglayer if(!bDrawTransparentUsed) { - // use decomposition - process(rCandidate.get2DDecomposition(getViewInformation2D())); + // unified sub-transparence. Draw to VDev first. + RenderUnifiedAlphaPrimitive2D(rUniAlphaCandidate); } break; @@ -308,35 +314,43 @@ namespace drawinglayer { // control primitive const primitive2d::ControlPrimitive2D& rControlPrimitive = static_cast< const primitive2d::ControlPrimitive2D& >(rCandidate); + const uno::Reference< awt::XControl >& rXControl(rControlPrimitive.getXControl()); - // if control primitive is a xWindow2 and visible, it oes not need to be painted - bool bControlIsVisibleAsChildWindow(false); - - if(rControlPrimitive.getXControl().is()) + try { - com::sun::star::uno::Reference< com::sun::star::awt::XWindow2 > xControlWindow(rControlPrimitive.getXControl(), com::sun::star::uno::UNO_QUERY_THROW); + // remember old graphics and create new + uno::Reference< awt::XView > xControlView(rXControl, uno::UNO_QUERY_THROW); + const uno::Reference< awt::XGraphics > xOriginalGraphics(xControlView->getGraphics()); + const uno::Reference< awt::XGraphics > xNewGraphics(mpOutputDevice->CreateUnoGraphics()); - if(xControlWindow.is()) + if(xNewGraphics.is()) { - if(xControlWindow->isVisible()) + // link graphics and view + xControlView->setGraphics(xNewGraphics); + + // get position + const basegfx::B2DHomMatrix aObjectToPixel(maCurrentTransformation * rControlPrimitive.getTransform()); + const basegfx::B2DPoint aTopLeftPixel(aObjectToPixel * basegfx::B2DPoint(0.0, 0.0)); + + // find out if the control is already visualized as a VCL-ChildWindow. If yes, + // it does not need to be painted at all. + uno::Reference< awt::XWindow2 > xControlWindow(rXControl, uno::UNO_QUERY_THROW); + const bool bControlIsVisibleAsChildWindow(rXControl->getPeer().is() && xControlWindow->isVisible()); + + if(!bControlIsVisibleAsChildWindow) { - bControlIsVisibleAsChildWindow = true; + // draw it + xControlView->draw(basegfx::fround(aTopLeftPixel.getX()), basegfx::fround(aTopLeftPixel.getY())); } - } - } - - if(bControlIsVisibleAsChildWindow) - { - // update position and size as VCL Child Window - static bool bDoSizeAndPositionControlsB(false); - if(bDoSizeAndPositionControlsB) - { - PositionAndSizeControl(rControlPrimitive); + // restore original graphics + xControlView->setGraphics(xOriginalGraphics); } } - else + catch(const uno::Exception&) { + DBG_UNHANDLED_EXCEPTION(); + // process recursively and use the decomposition as Bitmap process(rCandidate.get2DDecomposition(getViewInformation2D())); } diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx index 69368fbba2d5..41ac3ae318dc 100644 --- a/drawinglayer/source/processor2d/vclprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx @@ -56,6 +56,7 @@ #include <basegfx/polygon/b2dpolypolygontools.hxx> #include <vclhelperbufferdevice.hxx> #include <drawinglayer/primitive2d/modifiedcolorprimitive2d.hxx> +#include <drawinglayer/primitive2d/unifiedalphaprimitive2d.hxx> #include <drawinglayer/primitive2d/alphaprimitive2d.hxx> #include <drawinglayer/primitive2d/transformprimitive2d.hxx> #include <drawinglayer/primitive2d/markerarrayprimitive2d.hxx> @@ -64,6 +65,7 @@ #include <svtools/ctloptions.hxx> #include <vcl/svapp.hxx> #include <drawinglayer/primitive2d/pagepreviewprimitive2d.hxx> +#include <tools/diagnose_ex.h> ////////////////////////////////////////////////////////////////////////////// // control support @@ -94,6 +96,7 @@ namespace drawinglayer using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::UNO_QUERY; using ::com::sun::star::uno::UNO_QUERY_THROW; + using ::com::sun::star::uno::Exception; using ::com::sun::star::awt::XView; using ::com::sun::star::awt::XGraphics; using ::com::sun::star::awt::XWindow; @@ -712,6 +715,52 @@ namespace drawinglayer } } + // unified sub-transparence. Draw to VDev first. + void VclProcessor2D::RenderUnifiedAlphaPrimitive2D(const primitive2d::UnifiedAlphaPrimitive2D& rTransCandidate) + { + static bool bForceToDecomposition(false); + + if(rTransCandidate.getChildren().hasElements()) + { + if(bForceToDecomposition) + { + // use decomposition + process(rTransCandidate.get2DDecomposition(getViewInformation2D())); + } + else + { + if(0.0 == rTransCandidate.getAlpha()) + { + // no transparence used, so just use the content + process(rTransCandidate.getChildren()); + } + else if(rTransCandidate.getAlpha() > 0.0 && rTransCandidate.getAlpha() < 1.0) + { + // alpha is in visible range + basegfx::B2DRange aRange(primitive2d::getB2DRangeFromPrimitive2DSequence(rTransCandidate.getChildren(), getViewInformation2D())); + aRange.transform(maCurrentTransformation); + impBufferDevice aBufferDevice(*mpOutputDevice, aRange); + + if(aBufferDevice.isVisible()) + { + // remember last OutDev and set to content + OutputDevice* pLastOutputDevice = mpOutputDevice; + mpOutputDevice = &aBufferDevice.getContent(); + + // paint content to it + process(rTransCandidate.getChildren()); + + // back to old OutDev + mpOutputDevice = pLastOutputDevice; + + // dump buffer to outdev using given alpha + aBufferDevice.paint(rTransCandidate.getAlpha()); + } + } + } + } + } + // sub-transparence group. Draw to VDev first. void VclProcessor2D::RenderAlphaPrimitive2D(const primitive2d::AlphaPrimitive2D& rTransCandidate) { @@ -1100,32 +1149,6 @@ namespace drawinglayer } } - basegfx::B2DPoint VclProcessor2D::PositionAndSizeControl(const primitive2d::ControlPrimitive2D& rControlPrimitive2D) - { - // prepare output for given device - Reference< XGraphics > xGraphics(mpOutputDevice->CreateUnoGraphics()); - Reference< XView > xControlView(rControlPrimitive2D.getXControl(), UNO_QUERY_THROW); - xControlView->setGraphics(xGraphics); - - // set position and size (in pixel) - const basegfx::B2DHomMatrix aObjectToPixel(maCurrentTransformation * rControlPrimitive2D.getTransform()); - const basegfx::B2DPoint aTopLeftPixel(aObjectToPixel * basegfx::B2DPoint(0.0, 0.0)); - Reference< XWindow > xControlWindow(rControlPrimitive2D.getXControl(), UNO_QUERY); - - if(xControlWindow.is()) - { - const basegfx::B2DPoint aBottomRightPixel(aObjectToPixel * basegfx::B2DPoint(1.0, 1.0)); - - xControlWindow->setPosSize( - basegfx::fround(aTopLeftPixel.getX()), basegfx::fround(aTopLeftPixel.getY()), - basegfx::fround(aBottomRightPixel.getX() - aTopLeftPixel.getX()), - basegfx::fround(aBottomRightPixel.getY() - aTopLeftPixel.getY()), - POSSIZE); - } - - return aTopLeftPixel; - } - ////////////////////////////////////////////////////////////////////////////// // process support diff --git a/svx/inc/svx/dlgctrl.hxx b/svx/inc/svx/dlgctrl.hxx index 74c709c6b35d..c4a7ce195267 100644 --- a/svx/inc/svx/dlgctrl.hxx +++ b/svx/inc/svx/dlgctrl.hxx @@ -430,33 +430,60 @@ public: BOOL bStart = TRUE ); }; +////////////////////////////////////////////////////////////////////////////// + +class SdrObject; +class SdrModel; + +class SvxPreviewBase : public Control +{ +private: + SdrModel* mpModel; + VirtualDevice* mpBufferDevice; + +protected: + void InitSettings(bool bForeground, bool bBackground); + + // prepare buffered paint + void LocalPrePaint(); + + // end and output buffered paint + void LocalPostPaint(); + +public: + SvxPreviewBase( Window* pParent, const ResId& rResId ); + virtual ~SvxPreviewBase(); + + // change support + virtual void StateChanged(StateChangedType nStateChange); + virtual void DataChanged(const DataChangedEvent& rDCEvt); + + // dada read access + SdrModel& getModel() const { return *mpModel; } + OutputDevice& getBufferDevice() const { return *mpBufferDevice; } +}; + /************************************************************************* |* |* SvxLinePreview |* \************************************************************************/ -class SdrObject; -class SdrModel; - -class SVX_DLLPUBLIC SvxXLinePreview : public Control +class SVX_DLLPUBLIC SvxXLinePreview : public SvxPreviewBase { private: SdrObject* mpLineObjA; SdrObject* mpLineObjB; SdrObject* mpLineObjC; - SdrModel* mpModel; //#58425# Symbole auf einer Linie (z.B. StarChart) Graphic* mpGraphic; sal_Bool mbWithSymbol; Size maSymbolSize; - SVX_DLLPRIVATE void InitSettings( BOOL bForeground, BOOL bBackground ); - public: SvxXLinePreview( Window* pParent, const ResId& rResId ); - ~SvxXLinePreview(); + virtual ~SvxXLinePreview(); void SetLineAttributes(const SfxItemSet& rItemSet); @@ -465,8 +492,6 @@ public: void ResizeSymbol( const Size& s ); virtual void Paint( const Rectangle& rRect ); - virtual void StateChanged( StateChangedType nStateChange ); - virtual void DataChanged( const DataChangedEvent& rDCEvt ); }; /************************************************************************* @@ -475,23 +500,18 @@ public: |* \************************************************************************/ -class SVX_DLLPUBLIC SvxXRectPreview : public Control +class SVX_DLLPUBLIC SvxXRectPreview : public SvxPreviewBase { private: SdrObject* mpRectangleObject; - SdrModel* mpModel; - - SVX_DLLPRIVATE void InitSettings(bool bForeground, bool bBackground); public: SvxXRectPreview( Window* pParent, const ResId& rResId ); - ~SvxXRectPreview(); + virtual ~SvxXRectPreview(); void SetAttributes(const SfxItemSet& rItemSet); virtual void Paint( const Rectangle& rRect ); - virtual void StateChanged( StateChangedType nStateChange ); - virtual void DataChanged( const DataChangedEvent& rDCEvt ); }; /************************************************************************* @@ -500,26 +520,21 @@ public: |* \************************************************************************/ -class SVX_DLLPUBLIC SvxXShadowPreview : public Control +class SVX_DLLPUBLIC SvxXShadowPreview : public SvxPreviewBase { private: SdrObject* mpRectangleObject; SdrObject* mpRectangleShadow; - SdrModel* mpModel; - - SVX_DLLPRIVATE void InitSettings(bool bForeground, bool bBackground); public: SvxXShadowPreview( Window* pParent, const ResId& rResId ); - ~SvxXShadowPreview(); + virtual ~SvxXShadowPreview(); void SetRectangleAttributes(const SfxItemSet& rItemSet); void SetShadowAttributes(const SfxItemSet& rItemSet); void SetShadowPosition(const Point& rPos); virtual void Paint( const Rectangle& rRect ); - virtual void StateChanged( StateChangedType nStateChange ); - virtual void DataChanged( const DataChangedEvent& rDCEvt ); }; #endif // _SVX_DLG_CTRL_HXX diff --git a/svx/inc/svx/sdr/contact/viewcontact.hxx b/svx/inc/svx/sdr/contact/viewcontact.hxx index e5bf5d1a5f7e..ef1b3d6128e8 100644 --- a/svx/inc/svx/sdr/contact/viewcontact.hxx +++ b/svx/inc/svx/sdr/contact/viewcontact.hxx @@ -82,6 +82,9 @@ namespace sdr // A ViewObjectContact was deleted and shall be forgotten. void RemoveViewObjectContact(ViewObjectContact& rVOContact); + // internal tooling to delete VOCs + void deleteAllVOCs(); + protected: // Interface to allow derivates to travel over the registered VOC's sal_uInt32 getViewObjectContactCount() const { return maViewObjectContactVector.size(); } @@ -101,6 +104,9 @@ namespace sdr // asserted there virtual drawinglayer::primitive2d::Primitive2DSequence createViewIndependentPrimitive2DSequence() const; + // method for flushing View Independent Primitive2DSequence for VOC implementations + void flushViewIndependentPrimitive2DSequence() { mxViewIndependentPrimitive2DSequence.realloc(0); } + // basic constructor. Since this is a base class only, it shall // never be called directly ViewContact(); @@ -152,6 +158,12 @@ namespace sdr // add Gluepoints (if available) virtual drawinglayer::primitive2d::Primitive2DSequence createGluePointPrimitive2DSequence() const; + + // delete all existing VOCs including DrawHierarchy which will invalidate all + // visualisations, too. Used mostly at object removal from DrawHierarchy to + // delete all existing VOCs by purpose, but can also be used for other purposes. + // It is always possible to delete the VOCs, these are re-created on demand + void flushViewObjectContacts(bool bWithHierarchy = true); }; } // end of namespace contact } // end of namespace sdr diff --git a/svx/inc/svx/sdr/contact/viewobjectcontact.hxx b/svx/inc/svx/sdr/contact/viewobjectcontact.hxx index 52105fa58818..0e52c6d6285b 100644 --- a/svx/inc/svx/sdr/contact/viewobjectcontact.hxx +++ b/svx/inc/svx/sdr/contact/viewobjectcontact.hxx @@ -99,6 +99,9 @@ namespace sdr // This method will not handle included hierarchies and not check geometric visibility. virtual drawinglayer::primitive2d::Primitive2DSequence createPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const; + // method for flushing Primitive2DSequence for VOC implementations + void flushPrimitive2DSequence() { mxPrimitive2DSequence.realloc(0); } + public: // basic constructor. ViewObjectContact(ObjectContact& rObjectContact, ViewContact& rViewContact); diff --git a/svx/inc/svx/sdr/contact/viewobjectcontactofunocontrol.hxx b/svx/inc/svx/sdr/contact/viewobjectcontactofunocontrol.hxx index 227be1157fe2..7a40c25511e4 100644 --- a/svx/inc/svx/sdr/contact/viewobjectcontactofunocontrol.hxx +++ b/svx/inc/svx/sdr/contact/viewobjectcontactofunocontrol.hxx @@ -31,7 +31,7 @@ #ifndef SVX_SDR_CONTACT_VIEWOBJECTCONTACTOFUNOCONTROL_HXX #define SVX_SDR_CONTACT_VIEWOBJECTCONTACTOFUNOCONTROL_HXX -#include <svx/sdr/contact/viewobjectcontact.hxx> +#include <svx/sdr/contact/viewobjectcontactofsdrobj.hxx> /** === begin UNO includes === **/ #include <com/sun/star/uno/Reference.hxx> @@ -59,7 +59,7 @@ namespace sdr { namespace contact { //= ViewObjectContactOfUnoControl //==================================================================== class ViewObjectContactOfUnoControl_Impl; - class SVX_DLLPRIVATE ViewObjectContactOfUnoControl : public ViewObjectContact + class SVX_DLLPRIVATE ViewObjectContactOfUnoControl : public ViewObjectContactOfSdrObj { protected: ::rtl::Reference< ViewObjectContactOfUnoControl_Impl > m_pImpl; @@ -101,6 +101,14 @@ namespace sdr { namespace contact { */ void positionControlForPaint( const DisplayInfo& _rDisplayInfo ) const; + /** callback from impl class to react on changes of properties form the XControlModel + */ + void propertyChange(); + + /** React on changes of the object of this ViewContact + */ + virtual void ActionChanged(); + protected: ViewObjectContactOfUnoControl( ObjectContact& _rObjectContact, ViewContactOfUnoControl& _rViewContact ); ~ViewObjectContactOfUnoControl(); diff --git a/svx/inc/svx/sdr/overlay/overlayhatchrect.hxx b/svx/inc/svx/sdr/overlay/overlayhatchrect.hxx new file mode 100644 index 000000000000..b4c2f625384e --- /dev/null +++ b/svx/inc/svx/sdr/overlay/overlayhatchrect.hxx @@ -0,0 +1,92 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: overlaybitmap.cxx,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SDR_OVERLAY_OVERLAYHATCHRECT_HXX +#define _SDR_OVERLAY_OVERLAYHATCHRECT_HXX + +#include <svx/sdr/overlay/overlayobject.hxx> +#include <vcl/hatch.hxx> +#include <tools/gen.hxx> + +////////////////////////////////////////////////////////////////////////////// + +class PolyPolygon; + +namespace sdr +{ + namespace overlay + { + class OverlayHatchRect : public OverlayObjectWithBasePosition + { + // geometric definitions + basegfx::B2DPoint maSecondPosition; + const double mfDiscreteWidth; + const double mfHatchRotation; + const double mfRotation; + + // helper to create visualisation geometry from above values + basegfx::B2DPolyPolygon getGeometry(OutputDevice& rOutputDevice); + + // Draw geometry + virtual void drawGeometry(OutputDevice& rOutputDevice); + + // Create the BaseRange. This method needs to calculate maBaseRange. + virtual void createBaseRange(OutputDevice& rOutputDevice); + + public: + OverlayHatchRect( + const basegfx::B2DPoint& rBasePosition, + const basegfx::B2DPoint& rSecondPosition, + const Color& rHatchColor, + double fDiscreteWidth, + double fHatchRotation, + double fRotation); + + const basegfx::B2DPoint& getSecondPosition() const { return maSecondPosition; } + void setSecondPosition(const basegfx::B2DPoint&); + + // Zoom has changed. If the objects logical size + // depends on the MapMode of the used OutputDevice, use this call + // to invalidate the range in logical coordinates. + virtual void zoomHasChanged(); + + // data read access + const double getDiscreteWidth() const { return mfDiscreteWidth; } + const double getHatchRotation() const { return mfHatchRotation; } + const double getRotation() const { return mfRotation; } + }; + } // end of namespace overlay +} // end of namespace sdr + +////////////////////////////////////////////////////////////////////////////// + +#endif //_SDR_OVERLAY_OVERLAYHATCHRECT_HXX + +// eof diff --git a/svx/inc/svx/sdrmasterpagedescriptor.hxx b/svx/inc/svx/sdrmasterpagedescriptor.hxx index 97bd01eebd6e..b0593ab48774 100644 --- a/svx/inc/svx/sdrmasterpagedescriptor.hxx +++ b/svx/inc/svx/sdrmasterpagedescriptor.hxx @@ -69,7 +69,6 @@ namespace sdr // ViewContact part sdr::contact::ViewContact& GetViewContact() const; - void FlushViewContact() const; // this method is called form the destructor of the referenced page. // do all necessary action to forget the page. It is not necessary to call diff --git a/svx/inc/svx/svdhdl.hxx b/svx/inc/svx/svdhdl.hxx index 7d92ce26859c..ab4abfdd7458 100644 --- a/svx/inc/svx/svdhdl.hxx +++ b/svx/inc/svx/svdhdl.hxx @@ -430,6 +430,19 @@ public: }; //////////////////////////////////////////////////////////////////////////////////////////////////// + +class ImpTextframeHdl: public SdrHdl +{ + const Rectangle maRect; + + // create marker for this kind + virtual void CreateB2dIAObject(); + +public: + explicit ImpTextframeHdl(const Rectangle& rRect); +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/svx/inc/svx/svdobj.hxx b/svx/inc/svx/svdobj.hxx index 87149cb1685d..3d1b28bf1b9d 100644 --- a/svx/inc/svx/svdobj.hxx +++ b/svx/inc/svx/svdobj.hxx @@ -430,7 +430,6 @@ private: virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); public: sdr::contact::ViewContact& GetViewContact() const; - void FlushViewContact() const; // DrawContact support: Methods for handling Object changes void ActionChanged() const; diff --git a/svx/inc/svx/svdpage.hxx b/svx/inc/svx/svdpage.hxx index 89e8ed867363..d817ede41406 100644 --- a/svx/inc/svx/svdpage.hxx +++ b/svx/inc/svx/svdpage.hxx @@ -422,7 +422,6 @@ private: virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); public: sdr::contact::ViewContact& GetViewContact() const; - void FlushViewContact() const; // #110094# DrawContact support: Methods for handling Page changes void ActionChanged() const; @@ -458,10 +457,15 @@ protected: SetOfByte aPrefVisiLayers; USHORT nPageNum; - bool bMaster; // TRUE: Ich bin eine Stammseite - FASTBOOL bInserted; - FASTBOOL bObjectsNotPersistent; - FASTBOOL bSwappingLocked; + + // bitfield + unsigned mbMaster : 1; // flag if this is a MasterPage + unsigned mbInserted : 1; + unsigned mbObjectsNotPersistent : 1; + unsigned mbSwappingLocked : 1; + + // #i93597# + unsigned mbPageBorderOnlyLeftRight : 1; virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > createUnoPage(); @@ -471,19 +475,24 @@ public: // Copy-Ctor und Zuweisungeoperator sind nicht getestet! SdrPage(const SdrPage& rSrcPage); virtual ~SdrPage(); - // pModel, pPage, pUpList, pOwnerObj und bInserted werden Zuweisungeoperator nicht veraendert! + // pModel, pPage, pUpList, pOwnerObj und mbInserted werden Zuweisungeoperator nicht veraendert! virtual void operator=(const SdrPage& rSrcPage); virtual SdrPage* Clone() const; virtual SdrPage* Clone(SdrModel* pNewModel) const; - bool IsMasterPage() const { return bMaster; } - void SetInserted(FASTBOOL bJa=TRUE); - FASTBOOL IsInserted() const { return bInserted; } + bool IsMasterPage() const { return mbMaster; } + void SetInserted(bool bNew = true); + FASTBOOL IsInserted() const { return mbInserted; } virtual void SetChanged(); // #i68775# React on PageNum changes (from Model in most cases) void SetPageNum(sal_uInt16 nNew); sal_uInt16 GetPageNum() const; + // #i93597# Allow page border definition to not be the full rectangle but to + // use only the left and right vertical edges (reportdesigner) + void setPageBorderOnlyLeftRight(bool bNew) { mbPageBorderOnlyLeftRight = bNew; } + bool getPageBorderOnlyLeftRight() const { return mbPageBorderOnlyLeftRight; } + virtual void SetSize(const Size& aSiz); virtual Size GetSize() const; virtual void SetOrientation(Orientation eOri); @@ -545,16 +554,16 @@ public: // wenn pRect!=NULL, dann die Seiten, die von diesem Rect intersected werden // ansonsten die sichtbaren Seiten. virtual const SdrPageGridFrameList* GetGridFrameList(const SdrPageView* pPV, const Rectangle* pRect) const; - FASTBOOL IsObjectsNotPersistent() const { return bObjectsNotPersistent; } - void SetObjectsNotPersistent(FASTBOOL b) { bObjectsNotPersistent=b; } + bool IsObjectsNotPersistent() const { return mbObjectsNotPersistent; } + void SetObjectsNotPersistent(bool b) { mbObjectsNotPersistent = b; } // Durch Setzen dieses Flags, kann das Auslagern (Swappen) von // Teilen der Page (z.B. Grafiken) unterbunden werden. // Es werden hierdurch jedoch nicht automatisch alle ausgelagerten // Teile nachgeladen, dies geschieht erst bei konkretem Bedarf oder // durch Aufruf von SwapInAll(). // Fuer die MasterPage(s) der Page muss dies ggf. separat gemacht werden. - FASTBOOL IsSwappingLocked() const { return bSwappingLocked; } - void SetSwappingLocked(FASTBOOL bLock) { bSwappingLocked=bLock; } + bool IsSwappingLocked() const { return mbSwappingLocked; } + void SetSwappingLocked(bool bLock) { mbSwappingLocked = bLock; } SdrObject* GetBackgroundObj() const { return pBackgroundObj; } void SetBackgroundObj( SdrObject* pObj ); diff --git a/svx/inc/svx/svdpntv.hxx b/svx/inc/svx/svdpntv.hxx index a4ffdb0c7a94..d8269e73f35c 100644 --- a/svx/inc/svx/svdpntv.hxx +++ b/svx/inc/svx/svdpntv.hxx @@ -157,9 +157,6 @@ protected: MapMode aActualMapMode; Size aGridBig; // muss dann mal raus Size aGridFin; // muss dann mal raus - Size aGridSubdiv; - Fraction aGridWdtX; - Fraction aGridWdtY; SdrDragStat aDragStat; Rectangle aMaxWorkArea; SfxItemSet aDefaultAttr; @@ -216,7 +213,6 @@ protected: // is this a preview renderer? unsigned mbPreviewRenderer : 1; - unsigned bBordVisibleOnlyLeftRight : 1; // flags for calc for suppressing OLE, CHART or DRAW objects unsigned mbHideOle : 1; @@ -412,7 +408,6 @@ public: BOOL IsPageVisible() const { return bPageVisible; } // Seite (weisse Flaeche) malen oder nicht BOOL IsPageBorderVisible() const { return bPageBorderVisible; } // Seite (weisse Flaeche) malen oder nicht BOOL IsBordVisible() const { return bBordVisible; } // Seitenrandlinie malen oder nicht - BOOL IsBordVisibleOnlyLeftRight() const { return bBordVisibleOnlyLeftRight; } // draw only left and right border BOOL IsGridVisible() const { return bGridVisible; } // Rastergitter malen oder nicht BOOL IsGridFront() const { return bGridFront ; } // Rastergitter ueber die Objekte druebermalen oder dahinter BOOL IsHlplVisible() const { return bHlplVisible; } // Hilfslinien der Seiten malen oder nicht @@ -422,7 +417,6 @@ public: void SetPageVisible(bool bOn = true) { bPageVisible=bOn; InvalidateAllWin(); } void SetPageBorderVisible(bool bOn = true) { bPageBorderVisible=bOn; InvalidateAllWin(); } void SetBordVisible(bool bOn = true) { bBordVisible=bOn; InvalidateAllWin(); } - void SetBordVisibleOnlyLeftRight(bool bOn = true) { bBordVisibleOnlyLeftRight=bOn; InvalidateAllWin(); } void SetGridVisible(bool bOn = true) { bGridVisible=bOn; InvalidateAllWin(); } void SetGridFront(bool bOn = true) { bGridFront =bOn; InvalidateAllWin(); } void SetHlplVisible(bool bOn = true) { bHlplVisible=bOn; InvalidateAllWin(); } @@ -441,18 +435,10 @@ public: void setHideChart(bool bNew) { if(bNew != (bool)mbHideChart) mbHideChart = bNew; } void setHideDraw(bool bNew) { if(bNew != (bool)mbHideDraw) mbHideDraw = bNew; } - /*alt*/void SetGridCoarse(const Size& rSiz) { aGridBig=rSiz; SetGridWidth(Fraction(rSiz.Width(),1),Fraction(rSiz.Height(),1)); } - /*alt*/void SetGridFine(const Size& rSiz) { aGridFin=rSiz; if (aGridFin.Height()==0) aGridFin.Height()=aGridFin.Width(); if (bGridVisible) InvalidateAllWin(); } // #40479# - /*alt*/const Size& GetGridCoarse() const { return aGridBig; } - /*alt*/const Size& GetGridFine() const { return aGridFin; } - - // SetGridSubdivision(): Werte fuer X und Y sind die Anzahl der - // Zwischenraeume, also = Anzahl der Zwischenpunkte+1 - void SetGridWidth(const Fraction& rX, const Fraction& rY) { aGridWdtX=rX; aGridWdtY=rY; if (bGridVisible) InvalidateAllWin(); } - void SetGridSubdivision(const Size& rSubdiv) { aGridSubdiv=rSubdiv; if (bGridVisible) InvalidateAllWin(); } - const Fraction& GetGridWidthX() const { return aGridWdtX; } - const Fraction& GetGridWidthY() const { return aGridWdtY; } - const Size& GetGridSubdivision() const { return aGridSubdiv; } + void SetGridCoarse(const Size& rSiz) { aGridBig=rSiz; } + void SetGridFine(const Size& rSiz) { aGridFin=rSiz; if (aGridFin.Height()==0) aGridFin.Height()=aGridFin.Width(); if (bGridVisible) InvalidateAllWin(); } // #40479# + const Size& GetGridCoarse() const { return aGridBig; } + const Size& GetGridFine() const { return aGridFin; } void InvalidateAllWin(); void InvalidateAllWin(const Rectangle& rRect, BOOL bPlus1Pix=FALSE); diff --git a/svx/source/accessibility/AccessibleStaticTextBase.cxx b/svx/source/accessibility/AccessibleStaticTextBase.cxx index d945044b1cf1..b611b62b47e6 100644 --- a/svx/source/accessibility/AccessibleStaticTextBase.cxx +++ b/svx/source/accessibility/AccessibleStaticTextBase.cxx @@ -722,8 +722,8 @@ namespace accessibility // #104481# Return the empty string for 'no selection' if( nStart < 0 || nEnd < 0 ) return ::rtl::OUString(); - else - return getTextRange( nStart, nEnd ); + + return getTextRange( nStart, nEnd ); } sal_Int32 SAL_CALL AccessibleStaticTextBase::getSelectionStart() throw (uno::RuntimeException) diff --git a/svx/source/dialog/dlgctrl.cxx b/svx/source/dialog/dlgctrl.cxx index c48e74e1946a..beef4fe8ae48 100644 --- a/svx/source/dialog/dlgctrl.cxx +++ b/svx/source/dialog/dlgctrl.cxx @@ -56,6 +56,11 @@ #include <basegfx/polygon/b2dpolygon.hxx> #include <svx/svdorect.hxx> +#include <svx/svdmodel.hxx> +#include <svx/svdopath.hxx> +#include <svx/sdr/contact/objectcontactofobjlistpainter.hxx> +#include <svx/sdr/contact/displayinfo.hxx> + #define OUTPUT_DRAWMODE_COLOR (DRAWMODE_DEFAULT) #define OUTPUT_DRAWMODE_CONTRAST (DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT) @@ -1895,36 +1900,146 @@ void LineEndLB::Modify( XLineEndEntry* pEntry, USHORT nPos, Bitmap* pBmp, InsertEntry( pEntry->GetName(), nPos ); } +////////////////////////////////////////////////////////////////////////////// + +void SvxPreviewBase::InitSettings(bool bForeground, bool bBackground) +{ + const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); + + if(bForeground) + { + svtools::ColorConfig aColorConfig; + Color aTextColor(aColorConfig.GetColorValue(svtools::FONTCOLOR).nColor); + + if(IsControlForeground()) + { + aTextColor = GetControlForeground(); + } + + getBufferDevice().SetTextColor(aTextColor); + } + + if(bBackground) + { + if(IsControlBackground()) + { + getBufferDevice().SetBackground(GetControlBackground()); + } + else + { + getBufferDevice().SetBackground(rStyleSettings.GetWindowColor()); + } + } + + // do not paint background self, it gets painted buffered + SetControlBackground(); + SetBackground(); + + Invalidate(); +} + +SvxPreviewBase::SvxPreviewBase( Window* pParent, const ResId& rResId ) +: Control( pParent, rResId ), + mpModel( new SdrModel() ), + mpBufferDevice( new VirtualDevice(*this) ) +{ + // Draw the control's border as a flat thin black line. + SetBorderStyle(WINDOW_BORDER_MONO); + SetDrawMode( GetDisplayBackground().GetColor().IsDark() ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR ); + SetMapMode(MAP_100TH_MM); + + // init model + mpModel->GetItemPool().FreezeIdRanges(); +} + +SvxPreviewBase::~SvxPreviewBase() +{ + delete mpModel; + delete mpBufferDevice; +} + +void SvxPreviewBase::LocalPrePaint() +{ + // init BufferDevice + if(mpBufferDevice->GetOutputSizePixel() != GetOutputSizePixel()) + { + mpBufferDevice->SetDrawMode(GetDrawMode()); + mpBufferDevice->SetSettings(GetSettings()); + mpBufferDevice->SetAntialiasing(GetAntialiasing()); + mpBufferDevice->SetOutputSizePixel(GetOutputSizePixel()); + mpBufferDevice->SetMapMode(GetMapMode()); + } + + mpBufferDevice->Erase(); +} + +void SvxPreviewBase::LocalPostPaint() +{ + // copy to front (in pixel mode) + const bool bWasEnabledSrc(mpBufferDevice->IsMapModeEnabled()); + const bool bWasEnabledDst(IsMapModeEnabled()); + const Point aEmptyPoint; + + mpBufferDevice->EnableMapMode(false); + EnableMapMode(false); + + DrawOutDev( + aEmptyPoint, GetOutputSizePixel(), + aEmptyPoint, GetOutputSizePixel(), + *mpBufferDevice); + + mpBufferDevice->EnableMapMode(bWasEnabledSrc); + EnableMapMode(bWasEnabledDst); +} + +void SvxPreviewBase::StateChanged(StateChangedType nType) +{ + Control::StateChanged(nType); + + if(STATE_CHANGE_CONTROLFOREGROUND == nType) + { + InitSettings(true, false); + } + else if(STATE_CHANGE_CONTROLBACKGROUND == nType) + { + InitSettings(false, true); + } +} + +void SvxPreviewBase::DataChanged(const DataChangedEvent& rDCEvt) +{ + SetDrawMode(GetDisplayBackground().GetColor().IsDark() ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR); + + if((DATACHANGED_SETTINGS == rDCEvt.GetType()) && (rDCEvt.GetFlags() & SETTINGS_STYLE)) + { + InitSettings(true, true); + } + else + { + Control::DataChanged(rDCEvt); + } +} + /************************************************************************* |* |* SvxXLinePreview::SvxXLinePreview() |* *************************************************************************/ -#include <svx/svdmodel.hxx> -#include <svx/svdopath.hxx> -#include <svx/sdr/contact/objectcontactofobjlistpainter.hxx> -#include <svx/sdr/contact/displayinfo.hxx> SvxXLinePreview::SvxXLinePreview( Window* pParent, const ResId& rResId ) -: Control( pParent, rResId ), +: SvxPreviewBase( pParent, rResId ), mpLineObjA( 0L ), mpLineObjB( 0L ), mpLineObjC( 0L ), - mpModel( 0L ), mpGraphic( 0L ), mbWithSymbol( sal_False ) { - SetMapMode( MAP_100TH_MM ); const Size aOutputSize(GetOutputSize()); InitSettings( TRUE, TRUE ); const sal_Int32 nDistance(500L); const sal_Int32 nAvailableLength(aOutputSize.Width() - (4 * nDistance)); - // create model - mpModel = new SdrModel(); - mpModel->GetItemPool().FreezeIdRanges(); - // create DrawObectA const sal_Int32 aYPosA(aOutputSize.Height() / 2); const basegfx::B2DPoint aPointA1( nDistance, aYPosA); @@ -1933,7 +2048,7 @@ SvxXLinePreview::SvxXLinePreview( Window* pParent, const ResId& rResId ) aPolygonA.append(aPointA1); aPolygonA.append(aPointA2); mpLineObjA = new SdrPathObj(OBJ_LINE, basegfx::B2DPolyPolygon(aPolygonA)); - mpLineObjA->SetModel(mpModel); + mpLineObjA->SetModel(&getModel()); // create DrawObectB const sal_Int32 aYPosB1((aOutputSize.Height() * 3) / 4); @@ -1946,7 +2061,7 @@ SvxXLinePreview::SvxXLinePreview( Window* pParent, const ResId& rResId ) aPolygonB.append(aPointB2); aPolygonB.append(aPointB3); mpLineObjB = new SdrPathObj(OBJ_PLIN, basegfx::B2DPolyPolygon(aPolygonB)); - mpLineObjB->SetModel(mpModel); + mpLineObjB->SetModel(&getModel()); // create DrawObectC const basegfx::B2DPoint aPointC1( aPointB3.getX() + nDistance, aYPosB1); @@ -1957,11 +2072,7 @@ SvxXLinePreview::SvxXLinePreview( Window* pParent, const ResId& rResId ) aPolygonC.append(aPointC2); aPolygonC.append(aPointC3); mpLineObjC = new SdrPathObj(OBJ_PLIN, basegfx::B2DPolyPolygon(aPolygonC)); - mpLineObjC->SetModel(mpModel); - - // Draw the control's border as a flat thin black line. - SetBorderStyle (WINDOW_BORDER_MONO); - SetDrawMode( GetDisplayBackground().GetColor().IsDark() ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR ); + mpLineObjC->SetModel(&getModel()); } SvxXLinePreview::~SvxXLinePreview() @@ -1969,33 +2080,6 @@ SvxXLinePreview::~SvxXLinePreview() SdrObject::Free( mpLineObjA ); SdrObject::Free( mpLineObjB ); SdrObject::Free( mpLineObjC ); - delete mpModel; -} - -// ----------------------------------------------------------------------- - -void SvxXLinePreview::InitSettings( BOOL bForeground, BOOL bBackground ) -{ - const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); - - if ( bForeground ) - { - svtools::ColorConfig aColorConfig; - Color aTextColor( aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor ); - - if ( IsControlForeground() ) - aTextColor = GetControlForeground(); - SetTextColor( aTextColor ); - } - - if ( bBackground ) - { - if ( IsControlBackground() ) - SetBackground( GetControlBackground() ); - else - SetBackground( rStyleSettings.GetWindowColor() ); - } - Invalidate(); } // ----------------------------------------------------------------------- @@ -2037,15 +2121,15 @@ void SvxXLinePreview::SetLineAttributes(const SfxItemSet& rItemSet) void SvxXLinePreview::Paint( const Rectangle& ) { - const Size aOutputSize(GetOutputSize()); + LocalPrePaint(); - // paint objects + // paint objects to buffer device sdr::contact::SdrObjectVector aObjectVector; aObjectVector.push_back(mpLineObjA); aObjectVector.push_back(mpLineObjB); aObjectVector.push_back(mpLineObjC); - sdr::contact::ObjectContactOfObjListPainter aPainter(*this, aObjectVector, 0); + sdr::contact::ObjectContactOfObjListPainter aPainter(getBufferDevice(), aObjectVector, 0); sdr::contact::DisplayInfo aDisplayInfo; // do processing @@ -2053,35 +2137,14 @@ void SvxXLinePreview::Paint( const Rectangle& ) if ( mbWithSymbol && mpGraphic ) { + const Size aOutputSize(GetOutputSize()); Point aPos = Point( aOutputSize.Width() / 3, aOutputSize.Height() / 2 ); aPos.X() -= maSymbolSize.Width() / 2; aPos.Y() -= maSymbolSize.Height() / 2; - mpGraphic->Draw( this, aPos, maSymbolSize ); + mpGraphic->Draw( &getBufferDevice(), aPos, maSymbolSize ); } -} - -// ----------------------------------------------------------------------- - -void SvxXLinePreview::StateChanged( StateChangedType nType ) -{ - if ( nType == STATE_CHANGE_CONTROLFOREGROUND ) - InitSettings( TRUE, FALSE ); - else if ( nType == STATE_CHANGE_CONTROLBACKGROUND ) - InitSettings( FALSE, TRUE ); - - Control::StateChanged( nType ); -} - -// ----------------------------------------------------------------------- - -void SvxXLinePreview::DataChanged( const DataChangedEvent& rDCEvt ) -{ - if ( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) ) - InitSettings( TRUE, TRUE ); - else - Control::DataChanged( rDCEvt ); - SetDrawMode( GetDisplayBackground().GetColor().IsDark() ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR ); + LocalPostPaint(); } /************************************************************************* @@ -2090,57 +2153,21 @@ void SvxXLinePreview::DataChanged( const DataChangedEvent& rDCEvt ) |* *************************************************************************/ -void SvxXRectPreview::InitSettings(bool bForeground, bool bBackground) -{ - const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); - - if ( bForeground ) - { - svtools::ColorConfig aColorConfig; - Color aTextColor( aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor ); - - if ( IsControlForeground() ) - aTextColor = GetControlForeground(); - SetTextColor( aTextColor ); - } - - if ( bBackground ) - { - if ( IsControlBackground() ) - SetBackground( GetControlBackground() ); - else - SetBackground( rStyleSettings.GetWindowColor() ); - } - Invalidate(); -} - SvxXRectPreview::SvxXRectPreview( Window* pParent, const ResId& rResId ) -: Control( pParent, rResId ), - mpRectangleObject(0), - mpModel(0) +: SvxPreviewBase( pParent, rResId ), + mpRectangleObject(0) { - SetBorderStyle(WINDOW_BORDER_MONO); - SetMapMode(MAP_100TH_MM); InitSettings(true, true); - // create model - mpModel = new SdrModel(); - mpModel->GetItemPool().FreezeIdRanges(); - // create RectangleObject const Rectangle aObjectSize(Point(), GetOutputSize()); mpRectangleObject = new SdrRectObj(aObjectSize); - mpRectangleObject->SetModel(mpModel); - - // Draw the control's border as a flat thin black line. - SetBorderStyle (WINDOW_BORDER_MONO); - SetDrawMode( GetDisplayBackground().GetColor().IsDark() ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR ); + mpRectangleObject->SetModel(&getModel()); } SvxXRectPreview::~SvxXRectPreview() { SdrObject::Free(mpRectangleObject); - delete mpModel; } void SvxXRectPreview::SetAttributes(const SfxItemSet& rItemSet) @@ -2151,30 +2178,18 @@ void SvxXRectPreview::SetAttributes(const SfxItemSet& rItemSet) void SvxXRectPreview::Paint( const Rectangle& ) { + LocalPrePaint(); + sdr::contact::SdrObjectVector aObjectVector; + aObjectVector.push_back(mpRectangleObject); - sdr::contact::ObjectContactOfObjListPainter aPainter(*this, aObjectVector, 0); + + sdr::contact::ObjectContactOfObjListPainter aPainter(getBufferDevice(), aObjectVector, 0); sdr::contact::DisplayInfo aDisplayInfo; aPainter.ProcessDisplay(aDisplayInfo); -} -void SvxXRectPreview::StateChanged( StateChangedType nType ) -{ - if ( nType == STATE_CHANGE_CONTROLFOREGROUND ) - InitSettings(true, false); - else if ( nType == STATE_CHANGE_CONTROLBACKGROUND ) - InitSettings(false, true); - - Control::StateChanged( nType ); -} - -void SvxXRectPreview::DataChanged( const DataChangedEvent& rDCEvt ) -{ - if ( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) ) - InitSettings(true, true); - else - Control::DataChanged( rDCEvt ); + LocalPostPaint(); } /************************************************************************* @@ -2183,44 +2198,13 @@ void SvxXRectPreview::DataChanged( const DataChangedEvent& rDCEvt ) |* *************************************************************************/ -void SvxXShadowPreview::InitSettings(bool bForeground, bool bBackground) -{ - const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); - - if ( bForeground ) - { - svtools::ColorConfig aColorConfig; - Color aTextColor( aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor ); - - if ( IsControlForeground() ) - aTextColor = GetControlForeground(); - SetTextColor( aTextColor ); - } - - if ( bBackground ) - { - if ( IsControlBackground() ) - SetBackground( GetControlBackground() ); - else - SetBackground( rStyleSettings.GetWindowColor() ); - } - Invalidate(); -} - SvxXShadowPreview::SvxXShadowPreview( Window* pParent, const ResId& rResId ) -: Control( pParent, rResId ), +: SvxPreviewBase( pParent, rResId ), mpRectangleObject(0), - mpRectangleShadow(0), - mpModel(0) + mpRectangleShadow(0) { - SetBorderStyle(WINDOW_BORDER_MONO); - SetMapMode(MAP_100TH_MM); InitSettings(true, true); - // create model - mpModel = new SdrModel(); - mpModel->GetItemPool().FreezeIdRanges(); - // prepare size Size aSize = GetOutputSize(); aSize.Width() = aSize.Width() / 3; @@ -2229,23 +2213,18 @@ SvxXShadowPreview::SvxXShadowPreview( Window* pParent, const ResId& rResId ) // create RectangleObject const Rectangle aObjectSize( Point( aSize.Width(), aSize.Height() ), aSize ); mpRectangleObject = new SdrRectObj(aObjectSize); - mpRectangleObject->SetModel(mpModel); + mpRectangleObject->SetModel(&getModel()); // create ShadowObject const Rectangle aShadowSize( Point( aSize.Width(), aSize.Height() ), aSize ); mpRectangleShadow = new SdrRectObj(aShadowSize); - mpRectangleShadow->SetModel(mpModel); - - // Draw the control's border as a flat thin black line. - SetBorderStyle (WINDOW_BORDER_MONO); - SetDrawMode( GetDisplayBackground().GetColor().IsDark() ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR ); + mpRectangleShadow->SetModel(&getModel()); } SvxXShadowPreview::~SvxXShadowPreview() { SdrObject::Free(mpRectangleObject); SdrObject::Free(mpRectangleShadow); - delete mpModel; } void SvxXShadowPreview::SetRectangleAttributes(const SfxItemSet& rItemSet) @@ -2269,31 +2248,19 @@ void SvxXShadowPreview::SetShadowPosition(const Point& rPos) void SvxXShadowPreview::Paint( const Rectangle& ) { + LocalPrePaint(); + sdr::contact::SdrObjectVector aObjectVector; + aObjectVector.push_back(mpRectangleShadow); aObjectVector.push_back(mpRectangleObject); - sdr::contact::ObjectContactOfObjListPainter aPainter(*this, aObjectVector, 0); + + sdr::contact::ObjectContactOfObjListPainter aPainter(getBufferDevice(), aObjectVector, 0); sdr::contact::DisplayInfo aDisplayInfo; aPainter.ProcessDisplay(aDisplayInfo); -} - -void SvxXShadowPreview::StateChanged( StateChangedType nType ) -{ - if ( nType == STATE_CHANGE_CONTROLFOREGROUND ) - InitSettings( TRUE, FALSE ); - else if ( nType == STATE_CHANGE_CONTROLBACKGROUND ) - InitSettings( FALSE, TRUE ); - Control::StateChanged( nType ); -} - -void SvxXShadowPreview::DataChanged( const DataChangedEvent& rDCEvt ) -{ - if ( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) ) - InitSettings( TRUE, TRUE ); - else - Control::DataChanged( rDCEvt ); + LocalPostPaint(); } // ----------------------------------------------------------------------- diff --git a/svx/source/sdr/contact/viewcontact.cxx b/svx/source/sdr/contact/viewcontact.cxx index d3f09bcffdfe..fa9bc88d8f73 100644 --- a/svx/source/sdr/contact/viewcontact.cxx +++ b/svx/source/sdr/contact/viewcontact.cxx @@ -73,7 +73,12 @@ namespace sdr ViewContact::~ViewContact() { - // get rid of all contacts + deleteAllVOCs(); + } + + void ViewContact::deleteAllVOCs() + { + // get rid of all VOCs // #i84257# To avoid that each 'delete pCandidate' again uses // the local RemoveViewObjectContact with a search and removal in the // vector, simply copy and clear local vector. @@ -301,6 +306,24 @@ namespace sdr // default returns empty reference return drawinglayer::primitive2d::Primitive2DSequence(); } + + void ViewContact::flushViewObjectContacts(bool bWithHierarchy) + { + if(bWithHierarchy) + { + // flush DrawingLayer hierarchy + const sal_uInt32 nCount(GetObjectCount()); + + for(sal_uInt32 a(0); a < nCount; a++) + { + ViewContact& rChild = GetViewContact(a); + rChild.flushViewObjectContacts(bWithHierarchy); + } + } + + // delete local VOCs + deleteAllVOCs(); + } } // end of namespace contact } // end of namespace sdr diff --git a/svx/source/sdr/contact/viewcontactofe3d.cxx b/svx/source/sdr/contact/viewcontactofe3d.cxx index f8d2558baf90..77a5bf4dff3c 100644 --- a/svx/source/sdr/contact/viewcontactofe3d.cxx +++ b/svx/source/sdr/contact/viewcontactofe3d.cxx @@ -211,14 +211,7 @@ namespace sdr if(bFallbackToCreateAsLineForTest) { - ::std::vector< double > aEmptyVector; - return new drawinglayer::attribute::SdrLineAttribute( - basegfx::B2DLINEJOIN_NONE, - 0.0, - 0.0, - rBColor, - aEmptyVector, - 0.0); + return new drawinglayer::attribute::SdrLineAttribute(rBColor); } else { diff --git a/svx/source/sdr/contact/viewcontactofsdrpage.cxx b/svx/source/sdr/contact/viewcontactofsdrpage.cxx index de45da9e0b51..01eb6699c4aa 100644 --- a/svx/source/sdr/contact/viewcontactofsdrpage.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrpage.cxx @@ -305,18 +305,40 @@ namespace sdr drawinglayer::primitive2d::Primitive2DSequence ViewContactOfOuterPageBorder::createViewIndependentPrimitive2DSequence() const { + drawinglayer::primitive2d::Primitive2DSequence xRetval; const SdrPage& rPage = getPage(); const basegfx::B2DRange aPageBorderRange(0.0, 0.0, (double)rPage.GetWdt(), (double)rPage.GetHgt()); - const basegfx::B2DPolygon aPageBorderPolygon(basegfx::tools::createPolygonFromRect(aPageBorderRange)); // We have only the page information, not the view information. Use the // svtools::FONTCOLOR color for initialisation const svtools::ColorConfig aColorConfig; const Color aBorderColor(aColorConfig.GetColorValue(svtools::FONTCOLOR).nColor); const basegfx::BColor aRGBBorderColor(aBorderColor.getBColor()); - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aPageBorderPolygon, aRGBBorderColor)); - return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); + if(rPage.getPageBorderOnlyLeftRight()) + { + // #i93597# for Report Designer, the page border shall be only displayed right and left, + // but not top and bottom. Create simplified geometry. + basegfx::B2DPolygon aLeft, aRight; + + aLeft.append(basegfx::B2DPoint(aPageBorderRange.getMinX(), aPageBorderRange.getMinY())); + aLeft.append(basegfx::B2DPoint(aPageBorderRange.getMinX(), aPageBorderRange.getMaxY())); + + aRight.append(basegfx::B2DPoint(aPageBorderRange.getMaxX(), aPageBorderRange.getMinY())); + aRight.append(basegfx::B2DPoint(aPageBorderRange.getMaxX(), aPageBorderRange.getMaxY())); + + xRetval.realloc(2); + xRetval[0] = drawinglayer::primitive2d::Primitive2DReference(new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aLeft, aRGBBorderColor)); + xRetval[1] = drawinglayer::primitive2d::Primitive2DReference(new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aRight, aRGBBorderColor)); + } + else + { + xRetval.realloc(1); + const basegfx::B2DPolygon aPageBorderPolygon(basegfx::tools::createPolygonFromRect(aPageBorderRange)); + xRetval[0] = drawinglayer::primitive2d::Primitive2DReference(new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aPageBorderPolygon, aRGBBorderColor)); + } + + return xRetval; } ViewContactOfOuterPageBorder::ViewContactOfOuterPageBorder(ViewContactOfSdrPage& rParentViewContactOfSdrPage) diff --git a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx index 2631bc50c276..ea260f3285f7 100644 --- a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx @@ -1347,7 +1347,9 @@ namespace sdr { namespace contact { // a generic property changed. If we're in design mode, we need to repaint the control if ( impl_isControlDesignMode_nothrow() ) - m_pAntiImpl->GetObjectContact().InvalidatePartOfView( m_pAntiImpl->getObjectRange() ); + { + m_pAntiImpl->propertyChange(); + } } //-------------------------------------------------------------------- @@ -1477,7 +1479,7 @@ namespace sdr { namespace contact { DBG_NAME( ViewObjectContactOfUnoControl ) //-------------------------------------------------------------------- ViewObjectContactOfUnoControl::ViewObjectContactOfUnoControl( ObjectContact& _rObjectContact, ViewContactOfUnoControl& _rViewContact ) - :ViewObjectContact( _rObjectContact, _rViewContact ) + :ViewObjectContactOfSdrObj( _rObjectContact, _rViewContact ) ,m_pImpl( new ViewObjectContactOfUnoControl_Impl( this ) ) { DBG_CTOR( ViewObjectContactOfUnoControl, NULL ); @@ -1569,6 +1571,14 @@ namespace sdr { namespace contact { { VOCGuard aGuard( *m_pImpl ); m_pImpl->setControlDesignMode( _bDesignMode ); + + if(!_bDesignMode) + { + // when live mode is switched on, a refresh is needed. The edit mode visualisation + // needs to be repainted and the now used VCL-Window needs to be positioned and + // sized. Both is done from the repant refresh. + const_cast< ViewObjectContactOfUnoControl* >(this)->ActionChanged(); + } } //-------------------------------------------------------------------- @@ -1581,36 +1591,10 @@ namespace sdr { namespace contact { //-------------------------------------------------------------------- drawinglayer::primitive2d::Primitive2DSequence ViewObjectContactOfUnoControl::createPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const { - // current vsiualisation call. This is necessary to actually incarnate, position and size - // a control which is represented as VCL-ChildWindow. This mechanism is placed here ATM for - // convenience but may be placed to the View completely later: - // - // Let the OC (ObjectContact) aka View have a Pre-Run through the draw hierarchy and handle - // necessary changes at xShapes which ARE controls. This needs to be done in Preparation of a - // Paint. - // - // There is also the possibility to create a ControlPrimitiveRenderer which may be used as - // paint-pre-run and records/handles all ControlPrimitives he finds. - // - // To test the possibility that the renderer does the positioning and sizing i added a - // static flag here which will force a xControl to exist as a VCL Child window and it will - // be added to the Primitive. There is an analog flag in the VCL pixel renderer in drawinglayer - // to position and size he control there (look for bDoSizeAndPositionControlsA) - static bool bDoSizeAndPositionControlsA(true); - - if(bDoSizeAndPositionControlsA) - { - if(rDisplayInfo.GetControlLayerProcessingActive()) - { - positionControlForPaint(rDisplayInfo); - } - } - else - { - // force control here to make it a VCL ChildWindow. Will be fetched - // and used below by getExistentControl() - m_pImpl->ensureControl(); - } + // force control here to make it a VCL ChildWindow. Will be fetched + // and used below by getExistentControl() + m_pImpl->ensureControl(); + m_pImpl->positionControlForPaint(rDisplayInfo); // get needed data const ViewContactOfUnoControl& rViewContactOfUnoControl(static_cast< const ViewContactOfUnoControl& >(GetViewContact())); @@ -1650,6 +1634,42 @@ namespace sdr { namespace contact { } } + void ViewObjectContactOfUnoControl::propertyChange() + { + // graphical invalidate at all views + ActionChanged(); + + // #i93318# flush Primitive2DSequence to force recreation with updated XControlModel + // since e.g. background color has changed and existing decompositions are evtl. no + // longer valid. Unfortunately this is not detected from ControlPrimitive2D::operator== + // since it only has a uno reference to the XControlModel + flushPrimitive2DSequence(); + } + + void ViewObjectContactOfUnoControl::ActionChanged() + { + // call parent + ViewObjectContactOfSdrObj::ActionChanged(); + const ControlHolder& rControl(m_pImpl->getExistentControl()); + + if(rControl.is() && !rControl.isDesignMode()) + { + // #i93180# if layer visibility has changed and control is in live mode, it is necessary + // to correct visibility to make those control vanish on SdrObject LayerID changes + const SdrPageView* pSdrPageView = GetObjectContact().TryToGetSdrPageView(); + + if(pSdrPageView) + { + const bool bIsLayerVisible(pSdrPageView->GetVisibleLayers().IsSet(getSdrObject().GetLayer())); + + if(rControl.isVisible() != bIsLayerVisible) + { + rControl.setVisible(bIsLayerVisible); + } + } + } + } + //==================================================================== //= UnoControlDefaultContact //==================================================================== diff --git a/svx/source/sdr/overlay/makefile.mk b/svx/source/sdr/overlay/makefile.mk index 636e1f7c1d02..fa12baba4c5d 100644 --- a/svx/source/sdr/overlay/makefile.mk +++ b/svx/source/sdr/overlay/makefile.mk @@ -54,6 +54,7 @@ SLOFILES=\ $(SLO)$/overlaytriangle.obj \ $(SLO)$/overlaycrosshair.obj \ $(SLO)$/overlayhelpline.obj \ + $(SLO)$/overlayhatchrect.obj \ $(SLO)$/overlayrollingrectangle.obj \ $(SLO)$/overlaypolypolygon.obj \ $(SLO)$/overlaysdrobject.obj \ diff --git a/svx/source/sdr/overlay/overlayhatchrect.cxx b/svx/source/sdr/overlay/overlayhatchrect.cxx new file mode 100644 index 000000000000..a15d38f16bc9 --- /dev/null +++ b/svx/source/sdr/overlay/overlayhatchrect.cxx @@ -0,0 +1,149 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: overlaybitmap.cxx,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svx.hxx" + +#include <svx/sdr/overlay/overlayhatchrect.hxx> +#include <vcl/hatch.hxx> +#include <vcl/outdev.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> +#include <basegfx/polygon/b2dpolygontools.hxx> +#include <basegfx/polygon/b2dpolygon.hxx> +#include <basegfx/numeric/ftools.hxx> + +////////////////////////////////////////////////////////////////////////////// + +namespace sdr +{ + namespace overlay + { + basegfx::B2DPolyPolygon OverlayHatchRect::getGeometry(OutputDevice& rOutputDevice) + { + const basegfx::B2DPoint aDiscreteTopLeft(rOutputDevice.GetViewTransformation() * getBasePosition()); + const basegfx::B2DPoint aDiscreteBottomRight(rOutputDevice.GetViewTransformation() * getSecondPosition()); + + basegfx::B2DRange aInnerRange( + floor(aDiscreteTopLeft.getX()), floor(aDiscreteTopLeft.getY()), + floor(aDiscreteBottomRight.getX()), floor(aDiscreteBottomRight.getY())); + basegfx::B2DRange aOuterRange(aInnerRange); + basegfx::B2DPolyPolygon aRetval; + + aOuterRange.grow(getDiscreteWidth() * 0.5); + aInnerRange.grow(getDiscreteWidth() * -0.5); + + aRetval.append(basegfx::tools::createPolygonFromRect(aOuterRange)); + aRetval.append(basegfx::tools::createPolygonFromRect(aInnerRange)); + + if(!basegfx::fTools::equalZero(mfRotation)) + { + basegfx::B2DHomMatrix aTransform; + + aTransform.translate(-aOuterRange.getMinX(), -aOuterRange.getMinY()); + aTransform.rotate(getRotation()); + aTransform.translate(aOuterRange.getMinX(), aOuterRange.getMinY()); + + aRetval.transform(aTransform); + } + + return aRetval; + } + + void OverlayHatchRect::drawGeometry(OutputDevice& rOutputDevice) + { + const basegfx::B2DPolyPolygon aB2DGeometry(getGeometry(rOutputDevice)); + const bool bMapModeWasEnabled(rOutputDevice.IsMapModeEnabled()); + + // use VCL polygon and methodology for paint + double fFullRotation(getHatchRotation() - getRotation()); + + while(fFullRotation < 0.0) + { + fFullRotation += F_2PI; + } + + while(fFullRotation >= F_2PI) + { + fFullRotation -= F_2PI; + } + + const Hatch aHatch(HATCH_SINGLE, getBaseColor(), 3, (sal_uInt16)basegfx::fround(fFullRotation * ( 10.0 / F_PI180))); + rOutputDevice.EnableMapMode(false); + rOutputDevice.DrawHatch(PolyPolygon(aB2DGeometry), aHatch); + rOutputDevice.EnableMapMode(bMapModeWasEnabled); + } + + void OverlayHatchRect::createBaseRange(OutputDevice& rOutputDevice) + { + // reset range and expand with fresh geometry + maBaseRange = getGeometry(rOutputDevice).getB2DRange(); + + // getGeometry data is in discrete coordinates (pixels), so transform back to + // world coordinates (logic) + maBaseRange.transform(rOutputDevice.GetInverseViewTransformation()); + } + + OverlayHatchRect::OverlayHatchRect( + const basegfx::B2DPoint& rBasePosition, + const basegfx::B2DPoint& rSecondPosition, + const Color& rHatchColor, + double fDiscreteWidth, + double fHatchRotation, + double fRotation) + : OverlayObjectWithBasePosition(rBasePosition, rHatchColor), + maSecondPosition(rSecondPosition), + mfDiscreteWidth(fDiscreteWidth), + mfHatchRotation(fHatchRotation), + mfRotation(fRotation) + { + } + + void OverlayHatchRect::setSecondPosition(const basegfx::B2DPoint& rNew) + { + if(rNew != maSecondPosition) + { + // remember new value + maSecondPosition = rNew; + + // register change (after change) + objectChange(); + } + } + + void OverlayHatchRect::zoomHasChanged() + { + // reset validity of range in logical coor to force recalculation + mbIsChanged = sal_True; + } + } // end of namespace overlay +} // end of namespace sdr + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/svx/source/sdr/primitive2d/sdrcaptionprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrcaptionprimitive2d.cxx index 506792cb185d..d935cf3d2438 100644 --- a/svx/source/sdr/primitive2d/sdrcaptionprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrcaptionprimitive2d.cxx @@ -34,6 +34,7 @@ #include <svx/sdr/primitive2d/sdrdecompositiontools.hxx> #include <drawinglayer/primitive2d/groupprimitive2d.hxx> #include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx> +#include <drawinglayer/primitive2d/hittestprimitive2d.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -64,6 +65,17 @@ namespace drawinglayer appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolygonLinePrimitive(aUnitOutline, getTransform(), *getSdrLFSTAttribute().getLine())); appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolygonLinePrimitive(getTail(), getTransform(), *getSdrLFSTAttribute().getLine(), getSdrLFSTAttribute().getLineStartEnd())); } + else + { + // if initially no line is defined, create one for HitTest and BoundRect + Primitive2DSequence aLineSequence(2); + const attribute::SdrLineAttribute aBlackHairline(basegfx::BColor(0.0, 0.0, 0.0)); + + aLineSequence[0] = createPolygonLinePrimitive(aUnitOutline, getTransform(), aBlackHairline); + aLineSequence[1] = createPolygonLinePrimitive(getTail(), getTransform(), aBlackHairline); + + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, Primitive2DReference(new HitTestPrimitive2D(aLineSequence))); + } // add text if(getSdrLFSTAttribute().getText()) diff --git a/svx/source/sdr/primitive2d/sdrconnectorprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrconnectorprimitive2d.cxx index f560ddf2f73e..157bb3b5ec77 100644 --- a/svx/source/sdr/primitive2d/sdrconnectorprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrconnectorprimitive2d.cxx @@ -34,6 +34,7 @@ #include <basegfx/matrix/b2dhommatrix.hxx> #include <drawinglayer/primitive2d/groupprimitive2d.hxx> #include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx> +#include <drawinglayer/primitive2d/hittestprimitive2d.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -57,6 +58,15 @@ namespace drawinglayer { appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolygonLinePrimitive(getUnitPolygon(), aEmptyMatrix, *getSdrLSTAttribute().getLine(), getSdrLSTAttribute().getLineStartEnd())); } + else + { + // if initially no line is defined, create one for HitTest and BoundRect + const attribute::SdrLineAttribute aBlackHairline(basegfx::BColor(0.0, 0.0, 0.0)); + const Primitive2DReference xHiddenLineReference(createPolygonLinePrimitive(getUnitPolygon(), aEmptyMatrix, aBlackHairline)); + const Primitive2DSequence xHiddenLineSequence(&xHiddenLineReference, 1); + + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, Primitive2DReference(new HitTestPrimitive2D(xHiddenLineSequence))); + } // add text if(getSdrLSTAttribute().getText()) diff --git a/svx/source/sdr/primitive2d/sdrellipseprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrellipseprimitive2d.cxx index 4f99a2bce348..4c075453bd70 100644 --- a/svx/source/sdr/primitive2d/sdrellipseprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrellipseprimitive2d.cxx @@ -35,6 +35,9 @@ #include <svx/sdr/primitive2d/sdrdecompositiontools.hxx> #include <drawinglayer/primitive2d/groupprimitive2d.hxx> #include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx> +#include <drawinglayer/primitive2d/hittestprimitive2d.hxx> +#include <basegfx/color/bcolor.hxx> +#include <drawinglayer/attribute/sdrattribute.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -77,6 +80,15 @@ namespace drawinglayer { appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolygonLinePrimitive(aUnitOutline, getTransform(), *getSdrLFSTAttribute().getLine())); } + else + { + // if initially no line is defined, create one for HitTest and BoundRect + const attribute::SdrLineAttribute aBlackHairline(basegfx::BColor(0.0, 0.0, 0.0)); + const Primitive2DReference xHiddenLineReference(createPolygonLinePrimitive(aUnitOutline, getTransform(), aBlackHairline)); + const Primitive2DSequence xHiddenLineSequence(&xHiddenLineReference, 1); + + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, Primitive2DReference(new HitTestPrimitive2D(xHiddenLineSequence))); + } // add text if(getSdrLFSTAttribute().getText()) @@ -174,6 +186,15 @@ namespace drawinglayer { appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolygonLinePrimitive(aUnitOutline, getTransform(), *getSdrLFSTAttribute().getLine(), getSdrLFSTAttribute().getLineStartEnd())); } + else + { + // if initially no line is defined, create one for HitTest and BoundRect + const attribute::SdrLineAttribute aBlackHairline(basegfx::BColor(0.0, 0.0, 0.0)); + const Primitive2DReference xHiddenLineReference(createPolygonLinePrimitive(aUnitOutline, getTransform(), aBlackHairline)); + const Primitive2DSequence xHiddenLineSequence(&xHiddenLineReference, 1); + + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, Primitive2DReference(new HitTestPrimitive2D(xHiddenLineSequence))); + } // add text if(getSdrLFSTAttribute().getText()) diff --git a/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx index 7122918aaed2..0d774c02dbe1 100644 --- a/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx @@ -35,6 +35,7 @@ #include <svx/sdr/primitive2d/sdrdecompositiontools.hxx> #include <drawinglayer/primitive2d/groupprimitive2d.hxx> #include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx> +#include <drawinglayer/primitive2d/hittestprimitive2d.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -82,6 +83,15 @@ namespace drawinglayer appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolygonLinePrimitive(aUnitOutline, getTransform(), *getSdrLFSTAttribute().getLine())); } } + else + { + // if initially no line is defined, create one for HitTest and BoundRect + const attribute::SdrLineAttribute aBlackHairline(basegfx::BColor(0.0, 0.0, 0.0)); + const Primitive2DReference xHiddenLineReference(createPolygonLinePrimitive(aUnitOutline, getTransform(), aBlackHairline)); + const Primitive2DSequence xHiddenLineSequence(&xHiddenLineReference, 1); + + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, Primitive2DReference(new HitTestPrimitive2D(xHiddenLineSequence))); + } // add graphic content if(255L != getGraphicAttr().GetTransparency()) diff --git a/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx index b21757b26620..c4074a47217e 100644 --- a/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx @@ -38,6 +38,7 @@ #include <basegfx/tools/canvastools.hxx> #include <drawinglayer/primitive2d/groupprimitive2d.hxx> #include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx> +#include <drawinglayer/primitive2d/hittestprimitive2d.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -64,22 +65,21 @@ namespace drawinglayer { return createPolygonLinePrimitive(aPolygon, rObjectMatrix, *maSdrLSTAttribute.getLine(), 0L); } - else if(bLeftActive && bRightActive) + + if(bLeftActive && bRightActive) { return createPolygonLinePrimitive(aPolygon, rObjectMatrix, *maSdrLSTAttribute.getLine(), maSdrLSTAttribute.getLineStartEnd()); } - else - { - const attribute::SdrLineStartEndAttribute* pLineStartEnd = maSdrLSTAttribute.getLineStartEnd(); - const ::basegfx::B2DPolyPolygon aEmpty; - const attribute::SdrLineStartEndAttribute aLineStartEnd( - bLeftActive ? pLineStartEnd->getStartPolyPolygon() : aEmpty, bRightActive ? pLineStartEnd->getEndPolyPolygon() : aEmpty, - bLeftActive ? pLineStartEnd->getStartWidth() : 0.0, bRightActive ? pLineStartEnd->getEndWidth() : 0.0, - bLeftActive ? pLineStartEnd->isStartActive() : false, bRightActive ? pLineStartEnd->isEndActive() : false, - bLeftActive ? pLineStartEnd->isStartCentered() : false, bRightActive? pLineStartEnd->isEndCentered() : false); - - return createPolygonLinePrimitive(aPolygon, rObjectMatrix, *maSdrLSTAttribute.getLine(), &aLineStartEnd); - } + + const attribute::SdrLineStartEndAttribute* pLineStartEnd = maSdrLSTAttribute.getLineStartEnd(); + const ::basegfx::B2DPolyPolygon aEmpty; + const attribute::SdrLineStartEndAttribute aLineStartEnd( + bLeftActive ? pLineStartEnd->getStartPolyPolygon() : aEmpty, bRightActive ? pLineStartEnd->getEndPolyPolygon() : aEmpty, + bLeftActive ? pLineStartEnd->getStartWidth() : 0.0, bRightActive ? pLineStartEnd->getEndWidth() : 0.0, + bLeftActive ? pLineStartEnd->isStartActive() : false, bRightActive ? pLineStartEnd->isEndActive() : false, + bLeftActive ? pLineStartEnd->isStartCentered() : false, bRightActive? pLineStartEnd->isEndCentered() : false); + + return createPolygonLinePrimitive(aPolygon, rObjectMatrix, *maSdrLSTAttribute.getLine(), &aLineStartEnd); } Primitive2DSequence SdrMeasurePrimitive2D::createLocalDecomposition(const geometry::ViewInformation2D& aViewInformation) const @@ -128,7 +128,15 @@ namespace drawinglayer aTextRange = pBlockText->getB2DRange(aViewInformation); } - if(maSdrLSTAttribute.getLine()) + // prepare line attribute and result + const attribute::SdrLineAttribute* pLineAttribute(maSdrLSTAttribute.getLine()); + + if(!pLineAttribute) + { + // if initially no line is defined, create one for HitTest and BoundRect + pLineAttribute = new attribute::SdrLineAttribute(basegfx::BColor(0.0, 0.0, 0.0)); + } + { bool bArrowsOutside(false); bool bMainLineSplitted(false); @@ -167,7 +175,7 @@ namespace drawinglayer const double fSpaceNeededByArrows(fStartArrowH + fEndArrowH + ((fStartArrowW + fEndArrowW) * 0.5)); const double fArrowsOutsideLen((fStartArrowH + fEndArrowH + fStartArrowW + fEndArrowW) * 0.5); - const double fHalfLineWidth(maSdrLSTAttribute.getLine()->getWidth() * 0.5); + const double fHalfLineWidth(pLineAttribute->getWidth() * 0.5); if(fSpaceNeededByArrows > fDistance) { @@ -380,6 +388,16 @@ namespace drawinglayer } } + if(!maSdrLSTAttribute.getLine()) + { + // embed line geometry to invisible line group + const Primitive2DReference xHiddenLines(new HitTestPrimitive2D(aRetval)); + aRetval = Primitive2DSequence(&xHiddenLines, 1); + + // delete temporary LineAttribute again + delete pLineAttribute; + } + if(pBlockText) { // create transformation to text primitive end position diff --git a/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx b/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx index 84dc238eb7e6..e30678bdbf77 100644 --- a/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx @@ -33,6 +33,7 @@ #include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx> #include <basegfx/polygon/b2dpolygontools.hxx> #include <svx/sdr/primitive2d/sdrdecompositiontools.hxx> +#include <drawinglayer/primitive2d/hittestprimitive2d.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -64,31 +65,43 @@ namespace drawinglayer } // add line - if(!bBehaveCompatibleToPaintVersion && getSdrLFSTAttribute().getLine()) + if(getSdrLFSTAttribute().getLine()) { - // if line width is given, polygon needs to be grown by half of it to make the - // outline to be outside of the bitmap - if(0.0 != getSdrLFSTAttribute().getLine()->getWidth()) + if(bBehaveCompatibleToPaintVersion) { - // decompose to get scale - basegfx::B2DVector aScale, aTranslate; - double fRotate, fShearX; - getTransform().decompose(aScale, aTranslate, fRotate, fShearX); - - // create expanded range (add relative half line width to unit rectangle) - double fHalfLineWidth(getSdrLFSTAttribute().getLine()->getWidth() * 0.5); - double fScaleX(0.0 != aScale.getX() ? fHalfLineWidth / fabs(aScale.getX()) : 1.0); - double fScaleY(0.0 != aScale.getY() ? fHalfLineWidth / fabs(aScale.getY()) : 1.0); - const basegfx::B2DRange aExpandedRange(-fScaleX, -fScaleY, 1.0 + fScaleX, 1.0 + fScaleY); - basegfx::B2DPolygon aExpandedUnitOutline(basegfx::tools::createPolygonFromRect(aExpandedRange)); - - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolygonLinePrimitive(aExpandedUnitOutline, getTransform(), *getSdrLFSTAttribute().getLine())); - } - else - { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolygonLinePrimitive(aUnitOutline, getTransform(), *getSdrLFSTAttribute().getLine())); + // if line width is given, polygon needs to be grown by half of it to make the + // outline to be outside of the bitmap + if(0.0 != getSdrLFSTAttribute().getLine()->getWidth()) + { + // decompose to get scale + basegfx::B2DVector aScale, aTranslate; + double fRotate, fShearX; + getTransform().decompose(aScale, aTranslate, fRotate, fShearX); + + // create expanded range (add relative half line width to unit rectangle) + double fHalfLineWidth(getSdrLFSTAttribute().getLine()->getWidth() * 0.5); + double fScaleX(0.0 != aScale.getX() ? fHalfLineWidth / fabs(aScale.getX()) : 1.0); + double fScaleY(0.0 != aScale.getY() ? fHalfLineWidth / fabs(aScale.getY()) : 1.0); + const basegfx::B2DRange aExpandedRange(-fScaleX, -fScaleY, 1.0 + fScaleX, 1.0 + fScaleY); + basegfx::B2DPolygon aExpandedUnitOutline(basegfx::tools::createPolygonFromRect(aExpandedRange)); + + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolygonLinePrimitive(aExpandedUnitOutline, getTransform(), *getSdrLFSTAttribute().getLine())); + } + else + { + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolygonLinePrimitive(aUnitOutline, getTransform(), *getSdrLFSTAttribute().getLine())); + } } } + else + { + // if initially no line is defined, create one for HitTest and BoundRect + const attribute::SdrLineAttribute aBlackHairline(basegfx::BColor(0.0, 0.0, 0.0)); + const Primitive2DReference xHiddenLineReference(createPolygonLinePrimitive(aUnitOutline, getTransform(), aBlackHairline)); + const Primitive2DSequence xHiddenLineSequence(&xHiddenLineReference, 1); + + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, Primitive2DReference(new HitTestPrimitive2D(xHiddenLineSequence))); + } // add graphic content appendPrimitive2DSequenceToPrimitive2DSequence(aRetval, getChildren()); diff --git a/svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx index 7409100e9f7e..20367e49f5f0 100644 --- a/svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx @@ -34,6 +34,7 @@ #include <basegfx/polygon/b2dpolypolygontools.hxx> #include <drawinglayer/primitive2d/groupprimitive2d.hxx> #include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx> +#include <drawinglayer/primitive2d/hittestprimitive2d.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -70,6 +71,19 @@ namespace drawinglayer appendPrimitive2DSequenceToPrimitive2DSequence(aRetval, aTemp); } + else + { + // if initially no line is defined, create one for HitTest and BoundRect + const attribute::SdrLineAttribute aBlackHairline(basegfx::BColor(0.0, 0.0, 0.0)); + Primitive2DSequence xHiddenLineSequence(maUnitPolyPolygon.count()); + + for(sal_uInt32 a(0); a < maUnitPolyPolygon.count(); a++) + { + xHiddenLineSequence[a] = createPolygonLinePrimitive(maUnitPolyPolygon.getB2DPolygon(a), maTransform, aBlackHairline); + } + + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, Primitive2DReference(new HitTestPrimitive2D(xHiddenLineSequence))); + } // add text if(maSdrLFSTAttribute.getText()) diff --git a/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx index 6ffb9f9f08fd..ab54e1af1af5 100644 --- a/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx @@ -34,6 +34,7 @@ #include <svx/sdr/primitive2d/sdrdecompositiontools.hxx> #include <drawinglayer/primitive2d/groupprimitive2d.hxx> #include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx> +#include <drawinglayer/primitive2d/hittestprimitive2d.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -50,31 +51,40 @@ namespace drawinglayer Primitive2DSequence aRetval; // create unit outline polygon - ::basegfx::B2DPolygon aUnitOutline(::basegfx::tools::createPolygonFromRect(::basegfx::B2DRange(0.0, 0.0, 1.0, 1.0), mfCornerRadiusX, mfCornerRadiusY)); + ::basegfx::B2DPolygon aUnitOutline(::basegfx::tools::createPolygonFromRect(::basegfx::B2DRange(0.0, 0.0, 1.0, 1.0), getCornerRadiusX(), getCornerRadiusY())); // add fill - if(maSdrLFSTAttribute.getFill()) + if(getSdrLFSTAttribute().getFill()) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolyPolygonFillPrimitive(::basegfx::B2DPolyPolygon(aUnitOutline), maTransform, *maSdrLFSTAttribute.getFill(), maSdrLFSTAttribute.getFillFloatTransGradient())); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolyPolygonFillPrimitive(::basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getFill(), getSdrLFSTAttribute().getFillFloatTransGradient())); } // add line - if(maSdrLFSTAttribute.getLine()) + if(getSdrLFSTAttribute().getLine()) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolygonLinePrimitive(aUnitOutline, maTransform, *maSdrLFSTAttribute.getLine())); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolygonLinePrimitive(aUnitOutline, getTransform(), *getSdrLFSTAttribute().getLine())); + } + else + { + // if initially no line is defined, create one for HitTest and BoundRect + const attribute::SdrLineAttribute aBlackHairline(basegfx::BColor(0.0, 0.0, 0.0)); + const Primitive2DReference xHiddenLineReference(createPolygonLinePrimitive(aUnitOutline, getTransform(), aBlackHairline)); + const Primitive2DSequence xHiddenLineSequence(&xHiddenLineReference, 1); + + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, Primitive2DReference(new HitTestPrimitive2D(xHiddenLineSequence))); } // add text - if(maSdrLFSTAttribute.getText()) + if(getSdrLFSTAttribute().getText()) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(::basegfx::B2DPolyPolygon(aUnitOutline), maTransform, *maSdrLFSTAttribute.getText(), maSdrLFSTAttribute.getLine(), false, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(::basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false)); } // add shadow - if(maSdrLFSTAttribute.getShadow()) + if(getSdrLFSTAttribute().getShadow()) { // attention: shadow is added BEFORE object stuff to render it BEHIND object (!) - const Primitive2DReference xShadow(createShadowPrimitive(aRetval, *maSdrLFSTAttribute.getShadow())); + const Primitive2DReference xShadow(createShadowPrimitive(aRetval, *getSdrLFSTAttribute().getShadow())); if(xShadow.is()) { @@ -107,10 +117,10 @@ namespace drawinglayer { const SdrRectanglePrimitive2D& rCompare = (SdrRectanglePrimitive2D&)rPrimitive; - return (mfCornerRadiusX == rCompare.mfCornerRadiusX - && mfCornerRadiusY == rCompare.mfCornerRadiusY - && maTransform == rCompare.maTransform - && maSdrLFSTAttribute == rCompare.maSdrLFSTAttribute); + return (getCornerRadiusX() == rCompare.getCornerRadiusX() + && getCornerRadiusY() == rCompare.getCornerRadiusY() + && getTransform() == rCompare.getTransform() + && getSdrLFSTAttribute() == rCompare.getSdrLFSTAttribute()); } return false; diff --git a/svx/source/svdraw/sdrmasterpagedescriptor.cxx b/svx/source/svdraw/sdrmasterpagedescriptor.cxx index 9500c350e8d0..652327f3ff85 100644 --- a/svx/source/svdraw/sdrmasterpagedescriptor.cxx +++ b/svx/source/svdraw/sdrmasterpagedescriptor.cxx @@ -82,15 +82,6 @@ namespace sdr return *mpViewContact; } - void MasterPageDescriptor::FlushViewContact() const - { - if(mpViewContact) - { - delete mpViewContact; - ((MasterPageDescriptor*)this)->mpViewContact = 0; - } - } - // this method is called form the destructor of the referenced page. // do all necessary action to forget the page. It is not necessary to call // RemovePageUser(), that is done form the destructor. diff --git a/svx/source/svdraw/svddrgv.cxx b/svx/source/svdraw/svddrgv.cxx index 4d99598bed78..6cc43df61a3e 100644 --- a/svx/source/svdraw/svddrgv.cxx +++ b/svx/source/svdraw/svddrgv.cxx @@ -634,32 +634,49 @@ BOOL SdrDragView::BegDragObj(const Point& rPnt, OutputDevice* pOut, SdrHdl* pHdl } break; default: - { // SDRDRAG_MOVE - if ( ( eDragHdl == HDL_MOVE ) && !IsMoveAllowed() ) + { + // SDRDRAG_MOVE + if((eDragHdl == HDL_MOVE) && !IsMoveAllowed()) + { return FALSE; - else if ( eDragHdl==HDL_GLUE ) + } + else if(eDragHdl == HDL_GLUE) + { pDragBla = new SdrDragMove(*this); + } else { - if ( bFramDrag ) + if(bFramDrag) { - if ( eDragHdl == HDL_MOVE ) + if(eDragHdl == HDL_MOVE) + { pDragBla=new SdrDragMove(*this); + } else { - if (!IsResizeAllowed(TRUE)) return FALSE; - pDragBla=new SdrDragResize(*this); + if(!IsResizeAllowed(TRUE)) + { + return FALSE; + } + + pDragBla = new SdrDragResize(*this); } } else { - if ( ( eDragHdl == HDL_MOVE ) && ( GetMarkedObjectCount() == 1 ) - && GetMarkedObjectByIndex( 0 )->ISA( SdrObjCustomShape ) ) + if((eDragHdl == HDL_MOVE) && (GetMarkedObjectCount() == 1) && GetMarkedObjectByIndex(0)->ISA(SdrObjCustomShape)) + { pDragBla = new SdrDragMove( *this ); + } + else if((eDragHdl == HDL_POLY) && (!IsMoveAllowed() || !IsResizeAllowed())) + { + // #i77187# do not allow move of polygon points if object is move or size protected + return FALSE; + } else { - bDragSpecial=TRUE; - pDragBla=new SdrDragObjOwn(*this); + bDragSpecial = TRUE; + pDragBla = new SdrDragObjOwn(*this); } } } diff --git a/svx/source/svdraw/svdedtv1.cxx b/svx/source/svdraw/svdedtv1.cxx index 632761bb819c..ba1f8914ba8b 100644 --- a/svx/source/svdraw/svdedtv1.cxx +++ b/svx/source/svdraw/svdedtv1.cxx @@ -1410,40 +1410,74 @@ void SdrEditView::SetGeoAttrToMarked(const SfxItemSet& rAttr) MoveMarkedObj(Size(nPosDX,nPosDY)); } - // Position geschuetzt - if (SFX_ITEM_SET==rAttr.GetItemState(SID_ATTR_TRANSFORM_PROTECT_POS,TRUE,&pPoolItem)) + // protect position + if(SFX_ITEM_SET == rAttr.GetItemState(SID_ATTR_TRANSFORM_PROTECT_POS, TRUE, &pPoolItem)) { - BOOL bProtPos=((const SfxBoolItem*)pPoolItem)->GetValue(); - for (ULONG i=0; i<nMarkCount; i++) { - pObj=rMarkList.GetMark(i)->GetMarkedSdrObj(); - pObj->SetMoveProtect(bProtPos); - if( bProtPos ) - pObj->SetResizeProtect(true); + const sal_Bool bProtPos(((const SfxBoolItem*)pPoolItem)->GetValue()); + bool bChanged(false); + + for(sal_uInt32 i(0); i < nMarkCount; i++) + { + pObj = rMarkList.GetMark(i)->GetMarkedSdrObj(); + + if(pObj->IsMoveProtect() != bProtPos) + { + bChanged = true; + pObj->SetMoveProtect(bProtPos); + + if(bProtPos) + { + pObj->SetResizeProtect(true); + } + } + } + + if(bChanged) + { + bMoveProtect = bProtPos; + + if(bProtPos) + { + bResizeProtect = true; + } + + // #i77187# there is no simple method to get the toolbars updated + // in the application. The App is listening to selection change and i + // will use it here (even if not true). It's acceptable since changing + // this model data is pretty rare and only possible using the F4 dialog + MarkListHasChanged(); } - // BugFix 13897: hier muesste besser ein Broadcast her! - // Ausserdem fehlt Undo - // oder -> bProtPos/Size als Item (Interface) - bMoveProtect=bProtPos; - if( bProtPos ) - bResizeProtect=true; } - if( !bMoveProtect ) + if(!bMoveProtect) { - // Groesse geschuetzt - if (SFX_ITEM_SET==rAttr.GetItemState(SID_ATTR_TRANSFORM_PROTECT_SIZE,TRUE,&pPoolItem)) + // protect size + if(SFX_ITEM_SET == rAttr.GetItemState(SID_ATTR_TRANSFORM_PROTECT_SIZE, TRUE, &pPoolItem)) { - BOOL bProtSize=((const SfxBoolItem*)pPoolItem)->GetValue(); - for (ULONG i=0; i<nMarkCount; i++) { - pObj=rMarkList.GetMark(i)->GetMarkedSdrObj(); - pObj->SetResizeProtect(bProtSize); + const sal_Bool bProtSize(((const SfxBoolItem*)pPoolItem)->GetValue()); + bool bChanged(false); + + for(sal_uInt32 i(0); i < nMarkCount; i++) + { + pObj = rMarkList.GetMark(i)->GetMarkedSdrObj(); + + if(pObj->IsResizeProtect() != bProtSize) + { + bChanged = true; + pObj->SetResizeProtect(bProtSize); + } + } + + if(bChanged) + { + bResizeProtect = bProtSize; + + // #i77187# see above + MarkListHasChanged(); } - // BugFix 13897: hier muesste besser ein Broadcast her! - // Ausserdem fehlt Undo - // oder -> bProtPos/Size als Item (Interface) - bResizeProtect=bProtSize; } } + EndUndo(); } diff --git a/svx/source/svdraw/svdhdl.cxx b/svx/source/svdraw/svdhdl.cxx index 8ada8ace73fa..c338d9845c21 100644 --- a/svx/source/svdraw/svdhdl.cxx +++ b/svx/source/svdraw/svdhdl.cxx @@ -65,6 +65,7 @@ #include <svx/sdr/overlay/overlaybitmap.hxx> #include <svx/sdr/overlay/overlaylinestriped.hxx> #include <svx/sdr/overlay/overlaytriangle.hxx> +#include <svx/sdr/overlay/overlayhatchrect.hxx> #include <svx/sdrpagewindow.hxx> #include <sdrpaintwindow.hxx> #include <vcl/svapp.hxx> @@ -815,55 +816,50 @@ bool SdrHdl::IsHdlHit(const Point& rPnt) const Pointer SdrHdl::GetPointer() const { PointerStyle ePtr=POINTER_MOVE; - BOOL bSize=eKind>=HDL_UPLFT && eKind<=HDL_LWRGT; - // Fuer Resize von gedrehten Rechtecken die Mauszeiger etwas mitdrehen - if (bSize && nDrehWink!=0) - { - long nHdlWink=0; + const BOOL bSize=eKind>=HDL_UPLFT && eKind<=HDL_LWRGT; + const BOOL bRot=pHdlList!=NULL && pHdlList->IsRotateShear(); + const BOOL bDis=pHdlList!=NULL && pHdlList->IsDistortShear(); + if (bSize && pHdlList!=NULL && (bRot || bDis)) { switch (eKind) { - case HDL_UPLFT: nHdlWink=13500; break; - case HDL_UPPER: nHdlWink=9000; break; - case HDL_UPRGT: nHdlWink=4500; break; - case HDL_LEFT : nHdlWink=0; break; - case HDL_RIGHT: nHdlWink=0; break; - case HDL_LWLFT: nHdlWink=4500; break; - case HDL_LOWER: nHdlWink=9000; break; - case HDL_LWRGT: nHdlWink=13500; break; + case HDL_UPLFT: case HDL_UPRGT: + case HDL_LWLFT: case HDL_LWRGT: ePtr=bRot ? POINTER_ROTATE : POINTER_REFHAND; break; + case HDL_LEFT : case HDL_RIGHT: ePtr=POINTER_VSHEAR; break; + case HDL_UPPER: case HDL_LOWER: ePtr=POINTER_HSHEAR; break; default: break; } - nHdlWink+=nDrehWink+2249; // und etwas drauf (zum runden) - while (nHdlWink<0) nHdlWink+=18000; - while (nHdlWink>=18000) nHdlWink-=18000; - nHdlWink/=4500; - switch ((BYTE)nHdlWink) - { - case 0: ePtr=POINTER_ESIZE; break; - case 1: ePtr=POINTER_NESIZE; break; - case 2: ePtr=POINTER_SSIZE; break; - case 3: ePtr=POINTER_SESIZE; break; - } // switch - } - if (ePtr==POINTER_MOVE) - { - BOOL bRot=pHdlList!=NULL && pHdlList->IsRotateShear(); - BOOL bDis=pHdlList!=NULL && pHdlList->IsDistortShear(); - if (bSize && pHdlList!=NULL && (bRot || bDis)) - { - switch (eKind) - { - case HDL_UPLFT: case HDL_UPRGT: - case HDL_LWLFT: case HDL_LWRGT: ePtr=bRot ? POINTER_ROTATE : POINTER_REFHAND; break; - case HDL_LEFT : case HDL_RIGHT: ePtr=POINTER_VSHEAR; break; - case HDL_UPPER: case HDL_LOWER: ePtr=POINTER_HSHEAR; break; + } else { + // Fuer Resize von gedrehten Rechtecken die Mauszeiger etwas mitdrehen + if (bSize && nDrehWink!=0) { + long nHdlWink=0; + switch (eKind) { + case HDL_LWRGT: nHdlWink=31500; break; + case HDL_LOWER: nHdlWink=27000; break; + case HDL_LWLFT: nHdlWink=22500; break; + case HDL_LEFT : nHdlWink=18000; break; + case HDL_UPLFT: nHdlWink=13500; break; + case HDL_UPPER: nHdlWink=9000; break; + case HDL_UPRGT: nHdlWink=4500; break; + case HDL_RIGHT: nHdlWink=0; break; default: break; } - } - else - { - switch (eKind) - { + nHdlWink+=nDrehWink+2249; // und etwas drauf (zum runden) + while (nHdlWink<0) nHdlWink+=36000; + while (nHdlWink>=36000) nHdlWink-=36000; + nHdlWink/=4500; + switch ((BYTE)nHdlWink) { + case 0: ePtr=POINTER_ESIZE; break; + case 1: ePtr=POINTER_NESIZE; break; + case 2: ePtr=POINTER_NSIZE; break; + case 3: ePtr=POINTER_NWSIZE; break; + case 4: ePtr=POINTER_WSIZE; break; + case 5: ePtr=POINTER_SWSIZE; break; + case 6: ePtr=POINTER_SSIZE; break; + case 7: ePtr=POINTER_SESIZE; break; + } // switch + } else { + switch (eKind) { case HDL_UPLFT: ePtr=POINTER_NWSIZE; break; case HDL_UPPER: ePtr=POINTER_NSIZE; break; case HDL_UPRGT: ePtr=POINTER_NESIZE; break; @@ -1655,6 +1651,65 @@ Pointer ImpMeasureHdl::GetPointer() const //////////////////////////////////////////////////////////////////////////////////////////////////// +ImpTextframeHdl::ImpTextframeHdl(const Rectangle& rRect) : + SdrHdl(rRect.TopLeft(),HDL_MOVE), + maRect(rRect) +{ +} + +void ImpTextframeHdl::CreateB2dIAObject() +{ + // first throw away old one + GetRidOfIAObject(); + + if(pHdlList) + { + SdrMarkView* pView = pHdlList->GetView(); + + if(pView && !pView->areMarkHandlesHidden()) + { + SdrPageView* pPageView = pView->GetSdrPageView(); + + if(pPageView) + { + for(sal_uInt32 b(0L); b < pPageView->PageWindowCount(); b++) + { + const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b); + + if(rPageWindow.GetPaintWindow().OutputToWindow()) + { + if(rPageWindow.GetOverlayManager()) + { + 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 ); + + ::sdr::overlay::OverlayHatchRect* pNewOverlayObject = new ::sdr::overlay::OverlayHatchRect( + aTopLeft, + aBottomRight, + aHatchCol, + 6.0, + 45 * F_PI180, + nDrehWink * -F_PI18000); + pNewOverlayObject->setHittable(false); + + // OVERLAYMANAGER + if(pNewOverlayObject) + { + rPageWindow.GetOverlayManager()->add(*pNewOverlayObject); + maOverlayGroup.append(*pNewOverlayObject); + } + } + } + } + } + } + } +} + +//////////////////////////////////////////////////////////////////////////////////////////////////// + class ImpSdrHdlListSorter: public ContainerSorter { public: ImpSdrHdlListSorter(Container& rNewCont): ContainerSorter(rNewCont) {} diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx index 97793ffa769e..fb5f76d41229 100644 --- a/svx/source/svdraw/svdmrkv.cxx +++ b/svx/source/svdraw/svdmrkv.cxx @@ -696,10 +696,15 @@ void SdrMarkView::SetMarkHandles() { ULONG nMarkAnz=GetMarkedObjectCount(); BOOL bStdDrag=eDragMode==SDRDRAG_MOVE; + BOOL bSingleTextObjMark=FALSE; if (nMarkAnz==1) { pMarkedObj=GetMarkedObjectByIndex(0); + bSingleTextObjMark = + pMarkedObj && + pMarkedObj->ISA(SdrTextObj) && + static_cast<SdrTextObj*>(pMarkedObj)->IsTextFrame(); } BOOL bFrmHdl=ImpIsFrameHandles(); @@ -732,8 +737,20 @@ void SdrMarkView::SetMarkHandles() if(!aRect.IsEmpty() && !bHideHandlesWhenInTextEdit) { // sonst nix gefunden - - if( eDragMode==SDRDRAG_CROP ) + if( bSingleTextObjMark ) + { + const ULONG nSiz0=aHdl.GetHdlCount(); + pMarkedObj->AddToHdlList(aHdl); + const ULONG nSiz1=aHdl.GetHdlCount(); + for (ULONG i=nSiz0; i<nSiz1; i++) + { + SdrHdl* pHdl=aHdl.GetHdl(i); + pHdl->SetObj(pMarkedObj); + pHdl->SetPageView(pMarkedPV); + pHdl->SetObjHdlNum(USHORT(i-nSiz0)); + } + } + else if( eDragMode==SDRDRAG_CROP ) { aHdl.AddHdl(new SdrCropHdl(aRect.TopLeft() ,HDL_UPLFT)); aHdl.AddHdl(new SdrCropHdl(aRect.TopCenter() ,HDL_UPPER)); @@ -778,9 +795,9 @@ void SdrMarkView::SetMarkHandles() const SdrMark* pM=GetSdrMarkByIndex(nMarkNum); SdrObject* pObj=pM->GetMarkedSdrObj(); SdrPageView* pPV=pM->GetPageView(); - ULONG nSiz0=aHdl.GetHdlCount(); + const ULONG nSiz0=aHdl.GetHdlCount(); pObj->AddToHdlList(aHdl); - ULONG nSiz1=aHdl.GetHdlCount(); + const ULONG nSiz1=aHdl.GetHdlCount(); bool bPoly=pObj->IsPolyObj(); const SdrUShortCont* pMrkPnts=pM->GetMarkedPoints(); for (ULONG i=nSiz0; i<nSiz1; i++) @@ -1572,47 +1589,69 @@ void SdrMarkView::SetMarkHdlSizePixel(USHORT nSiz) #define SDRSEARCH_IMPISMASTER 0x80000000 /* MasterPage wird gerade durchsucht */ SdrObject* SdrMarkView::ImpCheckObjHit(const Point& rPnt, USHORT nTol, SdrObject* pObj, SdrPageView* pPV, ULONG nOptions, const SetOfByte* pMVisLay) const { - if ((nOptions & SDRSEARCH_IMPISMASTER) !=0 && pObj->IsNotVisibleAsMaster()) { + if((nOptions & SDRSEARCH_IMPISMASTER) && pObj->IsNotVisibleAsMaster()) + { return NULL; } - BOOL bCheckIfMarkable=(nOptions & SDRSEARCH_TESTMARKABLE)!=0; - //BOOL bBack=(nOptions & SDRSEARCH_BACKWARD)!=0; - BOOL bDeep=(nOptions & SDRSEARCH_DEEP)!=0; - BOOL bOLE=pObj->ISA(SdrOle2Obj); + + const bool bCheckIfMarkable(nOptions & SDRSEARCH_TESTMARKABLE); + const bool bDeep(nOptions & SDRSEARCH_DEEP); + const bool bOLE(pObj->ISA(SdrOle2Obj)); + const bool bTXT(pObj->ISA(SdrTextObj) && ((SdrTextObj*)pObj)->IsTextFrame()); SdrObject* pRet=NULL; Rectangle aRect(pObj->GetCurrentBoundRect()); - USHORT nTol2=nTol; - // Doppelte Tolezanz fuer ein an dieser View im TextEdit befindliches Objekt - if (bOLE || pObj==((SdrObjEditView*)this)->GetTextEditObject()) nTol2*=2; + USHORT nTol2(nTol); + + // double tolerance for OLE, text frames and objects in + // active text edit + if(bOLE || bTXT || pObj==((SdrObjEditView*)this)->GetTextEditObject()) + { + nTol2*=2; + } + aRect.Left ()-=nTol2; // Einmal Toleranz drauf fuer alle Objekte aRect.Top ()-=nTol2; aRect.Right ()+=nTol2; aRect.Bottom()+=nTol2; - if (aRect.IsInside(rPnt)) { - if ((!bCheckIfMarkable || IsObjMarkable(pObj,pPV))) { + + if (aRect.IsInside(rPnt)) + { + if ((!bCheckIfMarkable || IsObjMarkable(pObj,pPV))) + { SdrObjList* pOL=pObj->GetSubList(); - if (pOL!=NULL && pOL->GetObjCount()!=0) { + + if (pOL!=NULL && pOL->GetObjCount()!=0) + { SdrObject* pTmpObj; // OD 30.06.2003 #108784# - adjustment hit point for virtual // objects. Point aPnt( rPnt ); + if ( pObj->ISA(SdrVirtObj) ) { Point aOffset = static_cast<SdrVirtObj*>(pObj)->GetOffset(); aPnt.Move( -aOffset.X(), -aOffset.Y() ); } + pRet=ImpCheckObjHit(aPnt,nTol,pOL,pPV,nOptions,pMVisLay,pTmpObj); - } else { + } + else + { SdrLayerID nLay=pObj->GetLayer(); - if (pPV->GetVisibleLayers().IsSet(nLay) && - (pMVisLay==NULL || pMVisLay->IsSet(nLay))) + + if(pPV->GetVisibleLayers().IsSet(nLay) && (pMVisLay==NULL || pMVisLay->IsSet(nLay))) { pRet=pObj->CheckHit(rPnt,nTol2,&pPV->GetVisibleLayers()); } } } } - if (!bDeep && pRet!=NULL) pRet=pObj; + + if (!bDeep && pRet!=NULL) + { + pRet=pObj; + } + return pRet; } diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx index b68dddbd4637..514d78e2cbf9 100644 --- a/svx/source/svdraw/svdobj.cxx +++ b/svx/source/svdraw/svdobj.cxx @@ -365,15 +365,6 @@ sdr::contact::ViewContact& SdrObject::GetViewContact() const return *mpViewContact; } -void SdrObject::FlushViewContact() const -{ - if(mpViewContact) - { - delete mpViewContact; - ((SdrObject*)this)->mpViewContact = 0; - } -} - // DrawContact support: Methods for handling Object changes void SdrObject::ActionChanged() const { @@ -2637,23 +2628,23 @@ void SdrObject::SetInserted(sal_Bool bIns) void SdrObject::SetMoveProtect(sal_Bool bProt) { - bMovProt = bProt; - SetChanged(); - - if(IsInserted() && pModel) + if(IsMoveProtect() != bProt) { - SdrHint aHint(*this); - pModel->Broadcast(aHint); + // #i77187# secured and simplified + bMovProt = bProt; + SetChanged(); + BroadcastObjectChange(); } } void SdrObject::SetResizeProtect(sal_Bool bProt) { - bSizProt=bProt; - SetChanged(); - if (IsInserted() && pModel!=NULL) { - SdrHint aHint(*this); - pModel->Broadcast(aHint); + if(IsResizeProtect() != bProt) + { + // #i77187# secured and simplified + bSizProt = bProt; + SetChanged(); + BroadcastObjectChange(); } } diff --git a/svx/source/svdraw/svdopath.cxx b/svx/source/svdraw/svdopath.cxx index 6dd5003ae2ef..0f8213d37e9e 100644 --- a/svx/source/svdraw/svdopath.cxx +++ b/svx/source/svdraw/svdopath.cxx @@ -2346,50 +2346,52 @@ Pointer SdrPathObj::GetCreatePointer() const void SdrPathObj::NbcMove(const Size& rSiz) { - SdrTextObj::NbcMove(rSiz); - basegfx::B2DHomMatrix aTrans; aTrans.translate(rSiz.Width(), rSiz.Height()); maPathPolygon.transform(aTrans); + + // #i19871# first modify locally, then call parent (to get correct SnapRect with GluePoints) + SdrTextObj::NbcMove(rSiz); } void SdrPathObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) { - SdrTextObj::NbcResize(rRef,xFact,yFact); - basegfx::B2DHomMatrix aTrans; aTrans.translate(-rRef.X(), -rRef.Y()); aTrans.scale(double(xFact), double(yFact)); aTrans.translate(rRef.X(), rRef.Y()); maPathPolygon.transform(aTrans); + + // #i19871# first modify locally, then call parent (to get correct SnapRect with GluePoints) + SdrTextObj::NbcResize(rRef,xFact,yFact); } void SdrPathObj::NbcRotate(const Point& rRef, long nWink, double sn, double cs) { - SdrTextObj::NbcRotate(rRef,nWink,sn,cs); - basegfx::B2DHomMatrix aTrans; aTrans.translate(-rRef.X(), -rRef.Y()); aTrans.rotate(-nWink * nPi180); // Thank JOE, the angles are defined mirrored to the mathematical meanings aTrans.translate(rRef.X(), rRef.Y()); maPathPolygon.transform(aTrans); + + // #i19871# first modify locally, then call parent (to get correct SnapRect with GluePoints) + SdrTextObj::NbcRotate(rRef,nWink,sn,cs); } void SdrPathObj::NbcShear(const Point& rRefPnt, long nAngle, double fTan, FASTBOOL bVShear) { - SdrTextObj::NbcShear(rRefPnt,nAngle,fTan,bVShear); - basegfx::B2DHomMatrix aTrans; aTrans.translate(-rRefPnt.X(), -rRefPnt.Y()); aTrans.shearX(-fTan); // Thank JOE, the angles are defined mirrored to the mathematical meanings aTrans.translate(rRefPnt.X(), rRefPnt.Y()); maPathPolygon.transform(aTrans); + + // #i19871# first modify locally, then call parent (to get correct SnapRect with GluePoints) + SdrTextObj::NbcShear(rRefPnt,nAngle,fTan,bVShear); } void SdrPathObj::NbcMirror(const Point& rRefPnt1, const Point& rRefPnt2) { - SdrTextObj::NbcMirror(rRefPnt1,rRefPnt2); - basegfx::B2DHomMatrix aTrans; const double fDiffX(rRefPnt2.X() - rRefPnt1.X()); const double fDiffY(rRefPnt2.Y() - rRefPnt1.Y()); @@ -2403,13 +2405,19 @@ void SdrPathObj::NbcMirror(const Point& rRefPnt1, const Point& rRefPnt2) // #97538# Do Joe's special handling for lines when mirroring, too ImpForceKind(); + + // #i19871# first modify locally, then call parent (to get correct SnapRect with GluePoints) + SdrTextObj::NbcMirror(rRefPnt1,rRefPnt2); } void SdrPathObj::TakeUnrotatedSnapRect(Rectangle& rRect) const { - if (aGeo.nDrehWink==0) { - rRect=GetSnapRect(); - } else { + if(!aGeo.nDrehWink) + { + rRect = GetSnapRect(); + } + else + { XPolyPolygon aXPP(GetPathPoly()); RotateXPoly(aXPP,Point(),-aGeo.nSin,aGeo.nCos); rRect=aXPP.GetBoundRect(); diff --git a/svx/source/svdraw/svdorect.cxx b/svx/source/svdraw/svdorect.cxx index a338889afa48..8620110d6979 100644 --- a/svx/source/svdraw/svdorect.cxx +++ b/svx/source/svdraw/svdorect.cxx @@ -403,24 +403,34 @@ SdrHdl* SdrRectObj::GetHdl(sal_uInt32 nHdlNum) const SdrHdl* pH=NULL; Point aPnt; SdrHdlKind eKind=HDL_MOVE; - switch (nHdlNum) { - case 0: { - long a=GetEckenradius(); - long b=Max(aRect.GetWidth(),aRect.GetHeight())/2; // Wird aufgerundet, da GetWidth() eins draufaddiert - if (a>b) a=b; - if (a<0) a=0; - aPnt=aRect.TopLeft(); - aPnt.X()+=a; - eKind=HDL_CIRC; - } break; // Eckenradius - case 1: aPnt=aRect.TopLeft(); eKind=HDL_UPLFT; break; // Oben links - case 2: aPnt=aRect.TopCenter(); eKind=HDL_UPPER; break; // Oben - case 3: aPnt=aRect.TopRight(); eKind=HDL_UPRGT; break; // Oben rechts - case 4: aPnt=aRect.LeftCenter(); eKind=HDL_LEFT ; break; // Links - case 5: aPnt=aRect.RightCenter(); eKind=HDL_RIGHT; break; // Rechts - case 6: aPnt=aRect.BottomLeft(); eKind=HDL_LWLFT; break; // Unten links - case 7: aPnt=aRect.BottomCenter(); eKind=HDL_LOWER; break; // Unten - case 8: aPnt=aRect.BottomRight(); eKind=HDL_LWRGT; break; // Unten rechts + if( IsTextFrame() && !nHdlNum ) + { + pH=new ImpTextframeHdl(aRect); + pH->SetObj((SdrObject*)this); + pH->SetDrehWink(aGeo.nDrehWink); + return pH; + } + else + { + switch (nHdlNum) { + case 0: { + long a=GetEckenradius(); + long b=Max(aRect.GetWidth(),aRect.GetHeight())/2; // Wird aufgerundet, da GetWidth() eins draufaddiert + if (a>b) a=b; + if (a<0) a=0; + aPnt=aRect.TopLeft(); + aPnt.X()+=a; + eKind=HDL_CIRC; + } break; // Eckenradius + case 1: aPnt=aRect.TopLeft(); eKind=HDL_UPLFT; break; // Oben links + case 2: aPnt=aRect.TopCenter(); eKind=HDL_UPPER; break; // Oben + case 3: aPnt=aRect.TopRight(); eKind=HDL_UPRGT; break; // Oben rechts + case 4: aPnt=aRect.LeftCenter(); eKind=HDL_LEFT ; break; // Links + case 5: aPnt=aRect.RightCenter(); eKind=HDL_RIGHT; break; // Rechts + case 6: aPnt=aRect.BottomLeft(); eKind=HDL_LWLFT; break; // Unten links + case 7: aPnt=aRect.BottomCenter(); eKind=HDL_LOWER; break; // Unten + case 8: aPnt=aRect.BottomRight(); eKind=HDL_LWRGT; break; // Unten rechts + } } if (aGeo.nShearWink!=0) ShearPoint(aPnt,aRect.TopLeft(),aGeo.nTan); if (aGeo.nDrehWink!=0) RotatePoint(aPnt,aRect.TopLeft(),aGeo.nSin,aGeo.nCos); diff --git a/svx/source/svdraw/svdouno.cxx b/svx/source/svdraw/svdouno.cxx index ddf6e87fe51a..2c42adfd63c6 100644 --- a/svx/source/svdraw/svdouno.cxx +++ b/svx/source/svdraw/svdouno.cxx @@ -559,9 +559,9 @@ void SdrUnoObj::SetUnoControlModel( uno::Reference< awt::XControlModel > xModel) ViewContactOfUnoControl* pVC = NULL; if ( impl_getViewContact( pVC ) ) { - // FlushViewContact() removes all existing VOCs. This is always allowed - // since they will be re-created on demand (and with the changed model) - FlushViewContact(); + // flushViewObjectContacts() removes all existing VOCs for the local DrawHierarchy. This + // is always allowed since they will be re-created on demand (and with the changed model) + GetViewContact().flushViewObjectContacts(true); } } diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx index f7dca8ee7e00..2986cb482aae 100644 --- a/svx/source/svdraw/svdpage.cxx +++ b/svx/source/svdraw/svdpage.cxx @@ -257,9 +257,9 @@ void SdrObjList::Clear() SdrObject* pObj = maList.back(); RemoveObjectFromContainer(maList.size()-1); - // FlushViewContact() is done since SdrObject::Free is not guaranteed + // flushViewObjectContacts() is done since SdrObject::Free is not guaranteed // to delete the object and thus refresh visualisations - pObj->FlushViewContact(); + pObj->GetViewContact().flushViewObjectContacts(true); bObjectsRemoved = sal_True; @@ -441,8 +441,8 @@ SdrObject* SdrObjList::NbcRemoveObject(ULONG nObjNum) SdrObject* pObj=maList[nObjNum]; RemoveObjectFromContainer(nObjNum); - // FlushViewContact() clears the VOC's and those invalidate - pObj->FlushViewContact(); + // flushViewObjectContacts() clears the VOC's and those invalidate + pObj->GetViewContact().flushViewObjectContacts(true); DBG_ASSERT(pObj!=NULL,"Object zum Removen nicht gefunden"); if (pObj!=NULL) { @@ -475,8 +475,8 @@ SdrObject* SdrObjList::RemoveObject(ULONG nObjNum) DBG_ASSERT(pObj!=NULL,"Object zum Removen nicht gefunden"); if(pObj) { - // FlushViewContact() clears the VOC's and those invalidate - pObj->FlushViewContact(); + // flushViewObjectContacts() clears the VOC's and those invalidate + pObj->GetViewContact().flushViewObjectContacts(true); DBG_ASSERT(pObj->IsInserted(),"ZObjekt hat keinen Inserted-Status"); if (pModel!=NULL) { @@ -526,8 +526,8 @@ SdrObject* SdrObjList::NbcReplaceObject(SdrObject* pNewObj, ULONG nObjNum) pObj->SetPage(NULL); ReplaceObjectInContainer(*pNewObj,nObjNum); - // FlushViewContact() clears the VOC's and those invalidate - pObj->FlushViewContact(); + // flushViewObjectContacts() clears the VOC's and those invalidate + pObj->GetViewContact().flushViewObjectContacts(true); pNewObj->SetOrdNum(nObjNum); pNewObj->SetObjList(this); @@ -573,8 +573,8 @@ SdrObject* SdrObjList::ReplaceObject(SdrObject* pNewObj, ULONG nObjNum) pObj->SetPage(NULL); ReplaceObjectInContainer(*pNewObj,nObjNum); - // FlushViewContact() clears the VOC's and those invalidate - pObj->FlushViewContact(); + // flushViewObjectContacts() clears the VOC's and those invalidate + pObj->GetViewContact().flushViewObjectContacts(true); pNewObj->SetOrdNum(nObjNum); pNewObj->SetObjList(this); @@ -1231,15 +1231,6 @@ sdr::contact::ViewContact& SdrPage::GetViewContact() const return *mpViewContact; } -void SdrPage::FlushViewContact() const -{ - if(mpViewContact) - { - delete mpViewContact; - ((SdrPage*)this)->mpViewContact = 0; - } -} - //////////////////////////////////////////////////////////////////////////////////////////////////// TYPEINIT1(SdrPage,SdrObjList); @@ -1257,10 +1248,11 @@ SdrPage::SdrPage(SdrModel& rNewModel, bool bMasterPage) pBackgroundObj(0L), mpMasterPageDescriptor(0L), nPageNum(0L), - bMaster(bMasterPage), - bInserted(sal_False), - bObjectsNotPersistent(sal_False), - bSwappingLocked(sal_False) + mbMaster(bMasterPage), + mbInserted(false), + mbObjectsNotPersistent(false), + mbSwappingLocked(false), + mbPageBorderOnlyLeftRight(false) { DBG_CTOR(SdrPage,NULL); aPrefVisiLayers.SetAll(); @@ -1281,14 +1273,15 @@ SdrPage::SdrPage(const SdrPage& rSrcPage) pBackgroundObj(0L), mpMasterPageDescriptor(0L), nPageNum(rSrcPage.nPageNum), - bMaster(rSrcPage.bMaster), - bInserted(sal_False), - bObjectsNotPersistent(rSrcPage.bObjectsNotPersistent), - bSwappingLocked(rSrcPage.bSwappingLocked) + mbMaster(rSrcPage.mbMaster), + mbInserted(false), + mbObjectsNotPersistent(rSrcPage.mbObjectsNotPersistent), + mbSwappingLocked(rSrcPage.mbSwappingLocked), + mbPageBorderOnlyLeftRight(rSrcPage.mbPageBorderOnlyLeftRight) { DBG_CTOR(SdrPage,NULL); aPrefVisiLayers.SetAll(); - eListKind = (bMaster) ? SDROBJLIST_MASTERPAGE : SDROBJLIST_DRAWPAGE; + eListKind = (mbMaster) ? SDROBJLIST_MASTERPAGE : SDROBJLIST_DRAWPAGE; // copy things from source // Warning: this leads to slicing (see issue 93186) and has to be @@ -1297,7 +1290,7 @@ SdrPage::SdrPage(const SdrPage& rSrcPage) // be careful and correct eListKind, a member of SdrObjList which // will be changed by the SdrOIbjList::operator= before... - eListKind = (bMaster) ? SDROBJLIST_MASTERPAGE : SDROBJLIST_DRAWPAGE; + eListKind = (mbMaster) ? SDROBJLIST_MASTERPAGE : SDROBJLIST_DRAWPAGE; // The previous assignment to *this may have resulted in a call to // createUnoPage at a partially initialized (sliced) SdrPage object. @@ -1377,8 +1370,9 @@ void SdrPage::operator=(const SdrPage& rSrcPage) // copy all the local parameters to make this instance // a valid copy od source page before copying and inserting // the contained objects - bMaster = rSrcPage.bMaster; - bSwappingLocked = rSrcPage.bSwappingLocked; + mbMaster = rSrcPage.mbMaster; + mbSwappingLocked = rSrcPage.mbSwappingLocked; + mbPageBorderOnlyLeftRight = rSrcPage.mbPageBorderOnlyLeftRight; aPrefVisiLayers = rSrcPage.aPrefVisiLayers; nWdt = rSrcPage.nWdt; nHgt = rSrcPage.nHgt; @@ -1399,7 +1393,7 @@ void SdrPage::operator=(const SdrPage& rSrcPage) } //aMasters = rSrcPage.aMasters; - bObjectsNotPersistent = rSrcPage.bObjectsNotPersistent; + mbObjectsNotPersistent = rSrcPage.mbObjectsNotPersistent; if(rSrcPage.pBackgroundObj) { @@ -1621,8 +1615,10 @@ void SdrPage::SetPageNum(sal_uInt16 nNew) USHORT SdrPage::GetPageNum() const { - if (!bInserted) return 0; - if (bMaster) { + if (!mbInserted) + return 0; + + if (mbMaster) { if (pModel && pModel->IsMPgNumsDirty()) ((SdrModel*)pModel)->RecalcPageNums(TRUE); } else { @@ -1666,8 +1662,8 @@ void SdrPage::TRG_ClearMasterPage() { SetChanged(); - // the FlushViewContact() will do needed invalidates by deleting the involved VOCs - mpMasterPageDescriptor->GetUsedPage().FlushViewContact(); + // the flushViewObjectContacts() will do needed invalidates by deleting the involved VOCs + mpMasterPageDescriptor->GetUsedPage().GetViewContact().flushViewObjectContacts(true); delete mpMasterPageDescriptor; mpMasterPageDescriptor = 0L; @@ -1718,7 +1714,7 @@ FASTBOOL SdrPage::ImplGetFillColor(const Point& rPnt, const SetOfByte& rVisLayer { if (pModel==NULL) return FALSE; FASTBOOL bRet=SdrObjList::GetFillColor(rPnt,rVisLayers,/*bLayerSorted,*/rCol); - if (!bRet && !bMaster) + if (!bRet && !mbMaster) { // nun zu den Masterpages if(TRG_HasMasterPage()) @@ -1787,11 +1783,11 @@ void SdrPage::SetBackgroundObj( SdrObject* pObj ) pBackgroundObj = pObj; } -void SdrPage::SetInserted( FASTBOOL bIns ) +void SdrPage::SetInserted( bool bIns ) { - if( bInserted != bIns ) + if( mbInserted != bIns ) { - bInserted = bIns; + mbInserted = bIns; SdrObjListIter aIter( *this, IM_FLAT ); while ( aIter.IsMore() ) @@ -1799,7 +1795,7 @@ void SdrPage::SetInserted( FASTBOOL bIns ) SdrObject* pObj = aIter.Next(); if ( pObj->ISA(SdrOle2Obj) ) { - if( bInserted ) + if( mbInserted ) ( (SdrOle2Obj*) pObj)->Connect(); else ( (SdrOle2Obj*) pObj)->Disconnect(); diff --git a/svx/source/svdraw/svdpntv.cxx b/svx/source/svdraw/svdpntv.cxx index be6805c3c544..da0f28cce54c 100644 --- a/svx/source/svdraw/svdpntv.cxx +++ b/svx/source/svdraw/svdpntv.cxx @@ -228,7 +228,6 @@ void SdrPaintView::ImpClearVars() bPageVisible=TRUE; bPageBorderVisible=TRUE; bBordVisible=TRUE; - bBordVisibleOnlyLeftRight=FALSE; bGridVisible=TRUE; bGridFront =FALSE; bHlplVisible=TRUE; diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx index 1cc33d2560aa..9af61cebf6af 100644 --- a/svx/source/unodraw/unoshape.cxx +++ b/svx/source/unodraw/unoshape.cxx @@ -3221,17 +3221,15 @@ uno::Any SAL_CALL SvxShape::_getPropertyDefault( const OUString& aPropertyName ) { return getPropertyValue( aPropertyName ); } - else - { - // Default aus ItemPool holen - if(!mpModel->GetItemPool().IsWhich(pMap->nWID)) - throw beans::UnknownPropertyException(); - SfxItemSet aSet( mpModel->GetItemPool(), pMap->nWID, pMap->nWID); - aSet.Put(mpModel->GetItemPool().GetDefaultItem(pMap->nWID)); + // Default aus ItemPool holen + if(!mpModel->GetItemPool().IsWhich(pMap->nWID)) + throw beans::UnknownPropertyException(); - return GetAnyForItem( aSet, pMap ); - } + SfxItemSet aSet( mpModel->GetItemPool(), pMap->nWID, pMap->nWID); + aSet.Put(mpModel->GetItemPool().GetDefaultItem(pMap->nWID)); + + return GetAnyForItem( aSet, pMap ); } // XMultiPropertyStates diff --git a/svx/source/unoedit/unoedprx.cxx b/svx/source/unoedit/unoedprx.cxx index 44c4c302e506..7c31f8b14ffc 100644 --- a/svx/source/unoedit/unoedprx.cxx +++ b/svx/source/unoedit/unoedprx.cxx @@ -811,8 +811,8 @@ Rectangle SvxAccessibleTextAdapter::GetParaBounds( USHORT nPara ) const return aRect; } - else - return mrTextForwarder->GetParaBounds( nPara ); + + return mrTextForwarder->GetParaBounds( nPara ); } MapMode SvxAccessibleTextAdapter::GetMapMode() const |