diff options
28 files changed, 485 insertions, 635 deletions
diff --git a/drawinglayer/inc/drawinglayer/primitive2d/embedded3dprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/embedded3dprimitive2d.hxx index a6c4a3935d5b..e0da8a36c3f5 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/embedded3dprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/embedded3dprimitive2d.hxx @@ -72,6 +72,9 @@ namespace drawinglayer // the primitiveSequence for on-demand created shadow primitives (see mbShadow3DChecked) Primitive2DSequence maShadowPrimitives; + // #i96669# add simple range buffering for this primitive + basegfx::B2DRange maB2DRange; + // bitfield // flag if given 3D geometry is already cheched for shadow definitions and 2d shadows // are created in maShadowPrimitives diff --git a/drawinglayer/inc/drawinglayer/primitive2d/pointarrayprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/pointarrayprimitive2d.hxx index c2c2e93e73b8..bdd4142b0584 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/pointarrayprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/pointarrayprimitive2d.hxx @@ -52,6 +52,9 @@ namespace drawinglayer std::vector< basegfx::B2DPoint > maPositions; basegfx::BColor maRGBColor; + // #i96669# add simple range buffering for this primitive + basegfx::B2DRange maB2DRange; + public: PointArrayPrimitive2D( const std::vector< basegfx::B2DPoint >& rPositions, diff --git a/drawinglayer/inc/drawinglayer/primitive2d/textprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/textprimitive2d.hxx index c0bf247cba5f..9515fcc22ee8 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/textprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/textprimitive2d.hxx @@ -135,6 +135,9 @@ namespace drawinglayer ::com::sun::star::lang::Locale maLocale; // the Locale for the text basegfx::BColor maFontColor; // font color + // #i96669# add simple range buffering for this primitive + basegfx::B2DRange maB2DRange; + protected: // local decomposition. virtual Primitive2DSequence createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const; diff --git a/drawinglayer/inc/drawinglayer/texture/texture.hxx b/drawinglayer/inc/drawinglayer/texture/texture.hxx index b680160fa65b..9b4301a6df58 100644 --- a/drawinglayer/inc/drawinglayer/texture/texture.hxx +++ b/drawinglayer/inc/drawinglayer/texture/texture.hxx @@ -39,6 +39,7 @@ #include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/range/b2drange.hxx> #include <basegfx/color/bcolor.hxx> +#include <basegfx/tools/gradienttools.hxx> #include <vector> ////////////////////////////////////////////////////////////////////////////// @@ -73,13 +74,10 @@ namespace drawinglayer class GeoTexSvxGradient : public GeoTexSvx { protected: - basegfx::B2DHomMatrix maTextureTransform; - basegfx::B2DHomMatrix maBackTextureTransform; + basegfx::ODFGradientInfo maGradientInfo; basegfx::B2DRange maTargetRange; basegfx::BColor maStart; basegfx::BColor maEnd; - sal_uInt32 mnSteps; - double mfAspect; double mfBorder; // helpers @@ -130,9 +128,6 @@ namespace drawinglayer { class GeoTexSvxGradientAxial : public GeoTexSvxGradient { - protected: - double mfInternalSteps; - public: GeoTexSvxGradientAxial(const basegfx::B2DRange& rTargetRange, const basegfx::BColor& rStart, const basegfx::BColor& rEnd, sal_uInt32 nSteps, double fBorder, double fAngle); virtual ~GeoTexSvxGradientAxial(); diff --git a/drawinglayer/source/primitive2d/embedded3dprimitive2d.cxx b/drawinglayer/source/primitive2d/embedded3dprimitive2d.cxx index c4377bb16c62..5805c02a61ed 100644 --- a/drawinglayer/source/primitive2d/embedded3dprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/embedded3dprimitive2d.cxx @@ -110,6 +110,7 @@ namespace drawinglayer mfShadowSlant(fShadowSlant), maScene3DRange(rScene3DRange), maShadowPrimitives(), + maB2DRange(), mbShadow3DChecked(false) { maLightNormal.normalize(); @@ -134,29 +135,35 @@ namespace drawinglayer basegfx::B2DRange Embedded3DPrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const { - // use the 3d transformation stack to create a projection of the 3D range - basegfx::B3DRange a3DRange(primitive3d::getB3DRangeFromPrimitive3DSequence(getChildren3D(), getViewInformation3D())); - a3DRange.transform(getViewInformation3D().getObjectToView()); - - // create 2d range from projected 3d and transform with scene's object transformation - basegfx::B2DRange aRetval; - aRetval.expand(basegfx::B2DPoint(a3DRange.getMinX(), a3DRange.getMinY())); - aRetval.expand(basegfx::B2DPoint(a3DRange.getMaxX(), a3DRange.getMaxY())); - aRetval.transform(getObjectTransformation()); - - // cehck for 3D shadows and their 2D projections. If those exist, they need to be - // taken into account - if(impGetShadow3D(rViewInformation)) + if(maB2DRange.isEmpty()) { - const basegfx::B2DRange aShadow2DRange(getB2DRangeFromPrimitive2DSequence(maShadowPrimitives, rViewInformation)); - - if(!aShadow2DRange.isEmpty()) + // use the 3d transformation stack to create a projection of the 3D range + basegfx::B3DRange a3DRange(primitive3d::getB3DRangeFromPrimitive3DSequence(getChildren3D(), getViewInformation3D())); + a3DRange.transform(getViewInformation3D().getObjectToView()); + + // create 2d range from projected 3d and transform with scene's object transformation + basegfx::B2DRange aNewRange; + aNewRange.expand(basegfx::B2DPoint(a3DRange.getMinX(), a3DRange.getMinY())); + aNewRange.expand(basegfx::B2DPoint(a3DRange.getMaxX(), a3DRange.getMaxY())); + aNewRange.transform(getObjectTransformation()); + + // cehck for 3D shadows and their 2D projections. If those exist, they need to be + // taken into account + if(impGetShadow3D(rViewInformation)) { - aRetval.expand(aShadow2DRange); + const basegfx::B2DRange aShadow2DRange(getB2DRangeFromPrimitive2DSequence(maShadowPrimitives, rViewInformation)); + + if(!aShadow2DRange.isEmpty()) + { + aNewRange.expand(aShadow2DRange); + } } + + // assign to buffered value + const_cast< Embedded3DPrimitive2D* >(this)->maB2DRange = aNewRange; } - return aRetval; + return maB2DRange; } // provide unique ID diff --git a/drawinglayer/source/primitive2d/pointarrayprimitive2d.cxx b/drawinglayer/source/primitive2d/pointarrayprimitive2d.cxx index fb973b9c172f..d144fd7030e6 100644 --- a/drawinglayer/source/primitive2d/pointarrayprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/pointarrayprimitive2d.cxx @@ -54,7 +54,8 @@ namespace drawinglayer const basegfx::BColor& rRGBColor) : BasePrimitive2D(), maPositions(rPositions), - maRGBColor(rRGBColor) + maRGBColor(rRGBColor), + maB2DRange() { } @@ -73,15 +74,21 @@ namespace drawinglayer basegfx::B2DRange PointArrayPrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const { - basegfx::B2DRange aRetval; - - // get the basic range from the position vector - for(std::vector< basegfx::B2DPoint >::const_iterator aIter(getPositions().begin()); aIter != getPositions().end(); aIter++) + if(maB2DRange.isEmpty()) { - aRetval.expand(*aIter); + basegfx::B2DRange aNewRange; + + // get the basic range from the position vector + for(std::vector< basegfx::B2DPoint >::const_iterator aIter(getPositions().begin()); aIter != getPositions().end(); aIter++) + { + aNewRange.expand(*aIter); + } + + // assign to buffered value + const_cast< PointArrayPrimitive2D* >(this)->maB2DRange = aNewRange; } - return aRetval; + return maB2DRange; } // provide unique ID diff --git a/drawinglayer/source/primitive2d/sceneprimitive2d.cxx b/drawinglayer/source/primitive2d/sceneprimitive2d.cxx index 796abb27c7df..73d26a71fa4c 100644 --- a/drawinglayer/source/primitive2d/sceneprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/sceneprimitive2d.cxx @@ -229,11 +229,13 @@ namespace drawinglayer if(aBitmapSizePixel.getWidth() && aBitmapSizePixel.getHeight()) { - // create transform for the created bitmap in discrete coordinates first + // create transform for the created bitmap in discrete coordinates first. + // #i97772# Do not forget to apply evtl. render size reduction to scaling basegfx::B2DHomMatrix aNew2DTransform; + const double fSizeReductionFactor(1.0 / fReduceFactor); - aNew2DTransform.set(0, 0, (double)(aBitmapSizePixel.getWidth() - 1)); - aNew2DTransform.set(1, 1, (double)(aBitmapSizePixel.getHeight() - 1)); + aNew2DTransform.set(0, 0, (double)(aBitmapSizePixel.getWidth() - 1) * fSizeReductionFactor); + aNew2DTransform.set(1, 1, (double)(aBitmapSizePixel.getHeight() - 1) * fSizeReductionFactor); aNew2DTransform.set(0, 2, aVisibleDiscreteRange.getMinX()); aNew2DTransform.set(1, 2, aVisibleDiscreteRange.getMinY()); diff --git a/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx b/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx index df4aa6a748ae..6ca69433827e 100644 --- a/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx @@ -503,6 +503,16 @@ namespace drawinglayer } else { + // prepare TextLayouter + const bool bNoDXArray(getDXArray().empty()); + TextLayouterDevice aTextLayouter; + + if(bNoDXArray) + { + // ..but only completely when no DXArray + aTextLayouter.setFontAttributes(getFontAttributes(), rDecTrans.getScale().getX(), rDecTrans.getScale().getY()); + } + // do iterate over single words while(aNextWordBoundary.startPos != aNextWordBoundary.endPos) { @@ -512,17 +522,18 @@ namespace drawinglayer // prepare transform for the single word basegfx::B2DHomMatrix aNewTransform; - double fDistance(0.0); + ::std::vector< double > aNewDXArray; const bool bNewStartIsNotOldStart(nNewTextStart > getTextPosition()); - if(bNewStartIsNotOldStart) + if(!bNoDXArray) { - // needs to be moved to a new start position (get from DXArray) - const sal_uInt32 nIndex(static_cast< sal_uInt32 >(nNewTextStart - getTextPosition())); - fDistance = getDXArray()[nIndex - 1]; - aNewTransform.translate(fDistance, 0.0); + // prepare new DXArray for the single word + aNewDXArray = ::std::vector< double >( + getDXArray().begin() + static_cast< sal_uInt32 >(nNewTextStart - getTextPosition()), + getDXArray().begin() + static_cast< sal_uInt32 >(nNewTextEnd - getTextPosition())); } +<<<<<<< .working aNewTransform *= rDecTrans.getB2DHomMatrix(); // prepare new DXArray for the single word @@ -530,26 +541,64 @@ namespace drawinglayer getDXArray().begin() + static_cast< sal_uInt32 >(nNewTextStart - getTextPosition()), getDXArray().begin() + static_cast< sal_uInt32 >(nNewTextEnd - getTextPosition())); +======= +>>>>>>> .merge-right.r266521 if(bNewStartIsNotOldStart) { - // DXArray values need to be corrected - const sal_uInt32 nArraySize(aNewDXArray.size()); + // needs to be moved to a new start position + double fOffset(0.0); - for(sal_uInt32 a(0); a < nArraySize; a++) + if(bNoDXArray) { - aNewDXArray[a] -= fDistance; + // evaluate using TextLayouter + fOffset = aTextLayouter.getTextWidth(getText(), getTextPosition(), nNewTextStart); + } + else + { + // get from DXArray + const sal_uInt32 nIndex(static_cast< sal_uInt32 >(nNewTextStart - getTextPosition())); + fOffset = getDXArray()[nIndex - 1]; + } + + // apply needed offset to transformation + aNewTransform.translate(fOffset, 0.0); + + if(!bNoDXArray) + { + // DXArray values need to be corrected with the offset, too + const sal_uInt32 nArraySize(aNewDXArray.size()); + + for(sal_uInt32 a(0); a < nArraySize; a++) + { + aNewDXArray[a] -= fOffset; + } } } +<<<<<<< .working // create geometry content for the single word +======= + + // add text transformation to new transformation + aNewTransform *= rDecTrans.getB2DHomMatrix(); + + // create geometry content for the single word. Do not forget + // to use the new transformation +>>>>>>> .merge-right.r266521 basegfx::DecomposedB2DHomMatrixContainer aDecTrans(aNewTransform); +<<<<<<< .working + impCreateGeometryContent(rTarget, aDecTrans, getText(), nNewTextStart, +======= + impCreateGeometryContent(rTarget, aDecTrans, getText(), nNewTextStart, +>>>>>>> .merge-right.r266521 nNewTextEnd - nNewTextStart, aNewDXArray, aNewFontAttributes); // prepare next word and truncate to possibilities aNextWordBoundary = xLocalBreakIterator->nextWord( getText(), aNextWordBoundary.endPos, getLocale(), ::com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES); + impCorrectTextBoundary(aNextWordBoundary); } } diff --git a/drawinglayer/source/primitive2d/textprimitive2d.cxx b/drawinglayer/source/primitive2d/textprimitive2d.cxx index c845289dd4f8..bf46f4ab21d0 100644 --- a/drawinglayer/source/primitive2d/textprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/textprimitive2d.cxx @@ -241,7 +241,8 @@ namespace drawinglayer maDXArray(rDXArray), maFontAttributes(rFontAttributes), maLocale(rLocale), - maFontColor(rFontColor) + maFontColor(rFontColor), + maB2DRange() { #ifdef DBG_UTIL const xub_StrLen aStringLength(getText().Len()); @@ -278,9 +279,7 @@ namespace drawinglayer basegfx::B2DRange TextSimplePortionPrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const { - basegfx::B2DRange aRetval; - - if(getTextLength()) + if(maB2DRange.isEmpty() && getTextLength()) { // get TextBoundRect as base size // decompose object transformation to single values @@ -304,7 +303,7 @@ namespace drawinglayer aTextLayouter.setFontAttributes(getFontAttributes(), aFontScale.getX(), aFontScale.getY()); // get basic text range - aRetval = aTextLayouter.getTextBoundRect(getText(), getTextPosition(), getTextLength()); + basegfx::B2DRange aNewRange(aTextLayouter.getTextBoundRect(getText(), getTextPosition(), getTextLength())); #ifdef WIN32 // when under Windows and the font is unequally scaled, need to correct font X-Scaling factor if(bCorrectScale) @@ -321,11 +320,14 @@ namespace drawinglayer aRangeTransformation.translate(aTranslate.getX(), aTranslate.getY()); // apply range transformation to it - aRetval.transform(aRangeTransformation); + aNewRange.transform(aRangeTransformation); + + // assign to buffered value + const_cast< TextSimplePortionPrimitive2D* >(this)->maB2DRange = aNewRange; } } - return aRetval; + return maB2DRange; } // provide unique ID diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx index 2ebc555958aa..be30e9fe6e77 100644 --- a/drawinglayer/source/processor2d/vclprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx @@ -282,12 +282,23 @@ namespace drawinglayer mpOutputDevice->SetFont(aFont); mpOutputDevice->SetTextColor(Color(aRGBFontColor)); - mpOutputDevice->DrawTextArray( - aStartPoint, - rTextCandidate.getText(), - aTransformedDXArray.size() ? &(aTransformedDXArray[0]) : NULL, - rTextCandidate.getTextPosition(), - rTextCandidate.getTextLength()); + if(aTransformedDXArray.size()) + { + mpOutputDevice->DrawTextArray( + aStartPoint, + rTextCandidate.getText(), + &(aTransformedDXArray[0]), + rTextCandidate.getTextPosition(), + rTextCandidate.getTextLength()); + } + else + { + mpOutputDevice->DrawText( + aStartPoint, + rTextCandidate.getText(), + rTextCandidate.getTextPosition(), + rTextCandidate.getTextLength()); + } if(rTextCandidate.getFontAttributes().getRTL()) { diff --git a/drawinglayer/source/texture/texture.cxx b/drawinglayer/source/texture/texture.cxx index dce24359f1a0..4f784c71897f 100644 --- a/drawinglayer/source/texture/texture.cxx +++ b/drawinglayer/source/texture/texture.cxx @@ -38,6 +38,7 @@ #include <drawinglayer/texture/texture.hxx> #include <basegfx/numeric/ftools.hxx> +#include <basegfx/tools/gradienttools.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -95,18 +96,18 @@ namespace drawinglayer aNew.set(1, 1, rRange.getHeight()); aNew.set(0, 2, rRange.getMinX()); aNew.set(1, 2, rRange.getMinY()); - rMatrices.push_back(maTextureTransform * aNew); + rMatrices.push_back(maGradientInfo.maTextureTransform * aNew); } void GeoTexSvxGradient::impAppendColorsRadial(::std::vector< basegfx::BColor >& rColors) { - if(mnSteps) + if(maGradientInfo.mnSteps) { rColors.push_back(maStart); - for(sal_uInt32 a(1L); a < mnSteps - 1L; a++) + for(sal_uInt32 a(1L); a < maGradientInfo.mnSteps - 1L; a++) { - rColors.push_back(interpolate(maStart, maEnd, (double)a / (double)mnSteps)); + rColors.push_back(interpolate(maStart, maEnd, (double)a / (double)maGradientInfo.mnSteps)); } rColors.push_back(maEnd); @@ -117,10 +118,10 @@ namespace drawinglayer : maTargetRange(rTargetRange), maStart(rStart), maEnd(rEnd), - mnSteps(nSteps), - mfAspect(1.0), mfBorder(fBorder) { + maGradientInfo.mnSteps = nSteps; + maGradientInfo.mfAspectRatio = 1.0; } GeoTexSvxGradient::~GeoTexSvxGradient() @@ -131,10 +132,10 @@ namespace drawinglayer { const GeoTexSvxGradient* pCompare = dynamic_cast< const GeoTexSvxGradient* >(&rGeoTexSvx); return (pCompare - && maTextureTransform == pCompare->maTextureTransform + && maGradientInfo.maTextureTransform == pCompare->maGradientInfo.maTextureTransform && maTargetRange == pCompare->maTargetRange - && mnSteps == pCompare->mnSteps - && mfAspect == pCompare->mfAspect + && maGradientInfo.mnSteps == pCompare->maGradientInfo.mnSteps + && maGradientInfo.mfAspectRatio == pCompare->maGradientInfo.mfAspectRatio && mfBorder == pCompare->mfBorder); } } // end of namespace texture @@ -149,54 +150,11 @@ namespace drawinglayer GeoTexSvxGradientLinear::GeoTexSvxGradientLinear(const basegfx::B2DRange& rTargetRange, const basegfx::BColor& rStart, const basegfx::BColor& rEnd, sal_uInt32 nSteps, double fBorder, double fAngle) : GeoTexSvxGradient(rTargetRange, rStart, rEnd, nSteps, fBorder) { - double fTargetSizeX(maTargetRange.getWidth()); - double fTargetSizeY(maTargetRange.getHeight()); - double fTargetOffsetX(maTargetRange.getMinX()); - double fTargetOffsetY(maTargetRange.getMinY()); - - // add object expansion - if(0.0 != fAngle) - { - const double fAbsCos(fabs(cos(fAngle))); - const double fAbsSin(fabs(sin(fAngle))); - const double fNewX(fTargetSizeX * fAbsCos + fTargetSizeY * fAbsSin); - const double fNewY(fTargetSizeY * fAbsCos + fTargetSizeX * fAbsSin); - fTargetOffsetX -= (fNewX - fTargetSizeX) / 2.0; - fTargetOffsetY -= (fNewY - fTargetSizeY) / 2.0; - fTargetSizeX = fNewX; - fTargetSizeY = fNewY; - } - - // add object scale before rotate - maTextureTransform.scale(fTargetSizeX, fTargetSizeY); - - // add texture rotate after scale to keep perpendicular angles - if(0.0 != fAngle) - { - basegfx::B2DPoint aCenter(0.5, 0.5); - aCenter *= maTextureTransform; - - maTextureTransform.translate(-aCenter.getX(), -aCenter.getY()); - maTextureTransform.rotate(fAngle); - maTextureTransform.translate(aCenter.getX(), aCenter.getY()); - } - - // add object translate - maTextureTransform.translate(fTargetOffsetX, fTargetOffsetY); - - // prepare aspect for texture - mfAspect = (0.0 != fTargetSizeY) ? fTargetSizeX / fTargetSizeY : 1.0; - - // build transform from u,v to [0.0 .. 1.0]. As base, use inverse texture transform - maBackTextureTransform = maTextureTransform; - maBackTextureTransform.invert(); - maBackTextureTransform.translate(0.0, -mfBorder); - const double fSizeWithoutBorder(1.0 - mfBorder); - - if(!basegfx::fTools::equal(fSizeWithoutBorder, 0.0)) - { - maBackTextureTransform.scale(1.0, 1.0 / fSizeWithoutBorder); - } + basegfx::tools::createLinearODFGradientInfo(maGradientInfo, + rTargetRange, + nSteps, + fBorder, + fAngle); } GeoTexSvxGradientLinear::~GeoTexSvxGradientLinear() @@ -205,12 +163,12 @@ namespace drawinglayer void GeoTexSvxGradientLinear::appendTransformations(::std::vector< basegfx::B2DHomMatrix >& rMatrices) { - if(mnSteps) + if(maGradientInfo.mnSteps) { const double fTop(mfBorder); - const double fStripeWidth((1.0 - fTop) / mnSteps); + const double fStripeWidth((1.0 - fTop) / maGradientInfo.mnSteps); - for(sal_uInt32 a(1L); a < mnSteps; a++) + for(sal_uInt32 a(1L); a < maGradientInfo.mnSteps; a++) { const double fOffsetUpper(fStripeWidth * (double)a); @@ -223,39 +181,20 @@ namespace drawinglayer void GeoTexSvxGradientLinear::appendColors(::std::vector< basegfx::BColor >& rColors) { - if(mnSteps) + if(maGradientInfo.mnSteps) { rColors.push_back(maStart); - for(sal_uInt32 a(1L); a < mnSteps; a++) + for(sal_uInt32 a(1L); a < maGradientInfo.mnSteps; a++) { - rColors.push_back(interpolate(maStart, maEnd, (double)a / (double)(mnSteps + 1L))); + rColors.push_back(interpolate(maStart, maEnd, (double)a / (double)(maGradientInfo.mnSteps + 1L))); } } } void GeoTexSvxGradientLinear::modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& /*rfOpacity*/) const { - const basegfx::B2DPoint aCoor(maBackTextureTransform * rUV); - - if(basegfx::fTools::lessOrEqual(aCoor.getY(), 0.0)) - { - rBColor = maStart; - return; - } - - if(basegfx::fTools::moreOrEqual(aCoor.getY(), 1.0)) - { - rBColor = maEnd; - return; - } - - double fScaler(aCoor.getY()); - - if(mnSteps > 2L && mnSteps < 128L) - { - fScaler = floor(fScaler * (double)mnSteps) / (double)(mnSteps + 1L); - } + const double fScaler(basegfx::tools::getLinearGradientAlpha(rUV, maGradientInfo)); rBColor = (maStart * (1.0 - fScaler)) + (maEnd * fScaler); } @@ -271,57 +210,11 @@ namespace drawinglayer GeoTexSvxGradientAxial::GeoTexSvxGradientAxial(const basegfx::B2DRange& rTargetRange, const basegfx::BColor& rStart, const basegfx::BColor& rEnd, sal_uInt32 nSteps, double fBorder, double fAngle) : GeoTexSvxGradient(rTargetRange, rStart, rEnd, nSteps, fBorder) { - double fTargetSizeX(maTargetRange.getWidth()); - double fTargetSizeY(maTargetRange.getHeight()); - double fTargetOffsetX(maTargetRange.getMinX()); - double fTargetOffsetY(maTargetRange.getMinY()); - - // add object expansion - if(0.0 != fAngle) - { - const double fAbsCos(fabs(cos(fAngle))); - const double fAbsSin(fabs(sin(fAngle))); - const double fNewX(fTargetSizeX * fAbsCos + fTargetSizeY * fAbsSin); - const double fNewY(fTargetSizeY * fAbsCos + fTargetSizeX * fAbsSin); - fTargetOffsetX -= (fNewX - fTargetSizeX) / 2.0; - fTargetOffsetY -= (fNewY - fTargetSizeY) / 2.0; - fTargetSizeX = fNewX; - fTargetSizeY = fNewY; - } - - // add object scale before rotate - maTextureTransform.scale(fTargetSizeX, fTargetSizeY); - - // add texture rotate after scale to keep perpendicular angles - if(0.0 != fAngle) - { - basegfx::B2DPoint aCenter(0.5, 0.5); - aCenter *= maTextureTransform; - - maTextureTransform.translate(-aCenter.getX(), -aCenter.getY()); - maTextureTransform.rotate(fAngle); - maTextureTransform.translate(aCenter.getX(), aCenter.getY()); - } - - // add object translate - maTextureTransform.translate(fTargetOffsetX, fTargetOffsetY); - - // prepare aspect for texture - mfAspect = (0.0 != fTargetSizeY) ? fTargetSizeX / fTargetSizeY : 1.0; - - // build transform from u,v to [0.0 .. 1.0]. As base, use inverse texture transform - maBackTextureTransform = maTextureTransform; - maBackTextureTransform.invert(); - maBackTextureTransform.translate(0.0, -0.5); - const double fSizeWithoutBorder((1.0 - mfBorder) * 0.5); - - if(!basegfx::fTools::equal(fSizeWithoutBorder, 0.0)) - { - maBackTextureTransform.scale(1.0, 1.0 / fSizeWithoutBorder); - } - - // fill internal steps for getBColor implementation - mfInternalSteps = (double)((mnSteps * 2L) - 1L); + basegfx::tools::createAxialODFGradientInfo(maGradientInfo, + rTargetRange, + nSteps, + fBorder, + fAngle); } GeoTexSvxGradientAxial::~GeoTexSvxGradientAxial() @@ -330,14 +223,14 @@ namespace drawinglayer void GeoTexSvxGradientAxial::appendTransformations(::std::vector< basegfx::B2DHomMatrix >& rMatrices) { - if(mnSteps) + if(maGradientInfo.mnSteps) { const double fHalfBorder(mfBorder * 0.5); double fTop(fHalfBorder); double fBottom(1.0 - fHalfBorder); - const double fStripeWidth((fBottom - fTop) / ((mnSteps * 2L) - 1L)); + const double fStripeWidth((fBottom - fTop) / ((maGradientInfo.mnSteps * 2L) - 1L)); - for(sal_uInt32 a(1L); a < mnSteps; a++) + for(sal_uInt32 a(1L); a < maGradientInfo.mnSteps; a++) { const double fOffset(fStripeWidth * (double)a); @@ -350,34 +243,20 @@ namespace drawinglayer void GeoTexSvxGradientAxial::appendColors(::std::vector< basegfx::BColor >& rColors) { - if(mnSteps) + if(maGradientInfo.mnSteps) { rColors.push_back(maEnd); - for(sal_uInt32 a(1L); a < mnSteps; a++) + for(sal_uInt32 a(1L); a < maGradientInfo.mnSteps; a++) { - rColors.push_back(interpolate(maEnd, maStart, (double)a / (double)mnSteps)); + rColors.push_back(interpolate(maEnd, maStart, (double)a / (double)maGradientInfo.mnSteps)); } } } void GeoTexSvxGradientAxial::modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& /*rfOpacity*/) const { - const basegfx::B2DPoint aCoor(maBackTextureTransform * rUV); - const double fAbsY(fabs(aCoor.getY())); - - if(basegfx::fTools::moreOrEqual(fAbsY, 1.0)) - { - rBColor = maEnd; - return; - } - - double fScaler(fAbsY); - - if(mnSteps > 2L && mnSteps < 128L) - { - fScaler = floor(((fScaler * mfInternalSteps) + 1.0) / 2.0) / (double)(mnSteps - 1L); - } + const double fScaler(basegfx::tools::getAxialGradientAlpha(rUV, maGradientInfo)); rBColor = (maStart * (1.0 - fScaler)) + (maEnd * fScaler); } @@ -393,46 +272,11 @@ namespace drawinglayer GeoTexSvxGradientRadial::GeoTexSvxGradientRadial(const basegfx::B2DRange& rTargetRange, const basegfx::BColor& rStart, const basegfx::BColor& rEnd, sal_uInt32 nSteps, double fBorder, double fOffsetX, double fOffsetY) : GeoTexSvxGradient(rTargetRange, rStart, rEnd, nSteps, fBorder) { - double fTargetSizeX(maTargetRange.getWidth()); - double fTargetSizeY(maTargetRange.getHeight()); - double fTargetOffsetX(maTargetRange.getMinX()); - double fTargetOffsetY(maTargetRange.getMinY()); - - // add object expansion - const double fOriginalDiag(sqrt((fTargetSizeX * fTargetSizeX) + (fTargetSizeY * fTargetSizeY))); - fTargetOffsetX -= (fOriginalDiag - fTargetSizeX) / 2.0; - fTargetOffsetY -= (fOriginalDiag - fTargetSizeY) / 2.0; - fTargetSizeX = fOriginalDiag; - fTargetSizeY = fOriginalDiag; - - // add object scale before rotate - maTextureTransform.scale(fTargetSizeX, fTargetSizeY); - - // add defined offsets after rotation - if(0.5 != fOffsetX || 0.5 != fOffsetY) - { - // use original target size - fTargetOffsetX += (fOffsetX - 0.5) * maTargetRange.getWidth(); - fTargetOffsetY += (fOffsetY - 0.5) * maTargetRange.getHeight(); - } - - // add object translate - maTextureTransform.translate(fTargetOffsetX, fTargetOffsetY); - - // prepare aspect for texture - mfAspect = (0.0 != fTargetSizeY) ? fTargetSizeX / fTargetSizeY : 1.0; - - // build transform from u,v to [0.0 .. 1.0]. As base, use inverse texture transform - maBackTextureTransform = maTextureTransform; - maBackTextureTransform.invert(); - maBackTextureTransform.translate(-0.5, -0.5); - const double fHalfBorder((1.0 - mfBorder) * 0.5); - - if(!basegfx::fTools::equal(fHalfBorder, 0.0)) - { - const double fFactor(1.0 / fHalfBorder); - maBackTextureTransform.scale(fFactor, fFactor); - } + basegfx::tools::createRadialODFGradientInfo(maGradientInfo, + rTargetRange, + basegfx::B2DVector(fOffsetX,fOffsetY), + nSteps, + fBorder); } GeoTexSvxGradientRadial::~GeoTexSvxGradientRadial() @@ -441,7 +285,7 @@ namespace drawinglayer void GeoTexSvxGradientRadial::appendTransformations(::std::vector< basegfx::B2DHomMatrix >& rMatrices) { - if(mnSteps) + if(maGradientInfo.mnSteps) { const double fHalfBorder((1.0 - mfBorder) * 0.5); double fLeft(0.5 - fHalfBorder); @@ -450,18 +294,18 @@ namespace drawinglayer double fBottom(0.5 + fHalfBorder); double fIncrementX, fIncrementY; - if(mfAspect > 1.0) + if(maGradientInfo.mfAspectRatio > 1.0) { - fIncrementY = (fBottom - fTop) / (double)(mnSteps * 2L); - fIncrementX = fIncrementY / mfAspect; + fIncrementY = (fBottom - fTop) / (double)(maGradientInfo.mnSteps * 2L); + fIncrementX = fIncrementY / maGradientInfo.mfAspectRatio; } else { - fIncrementX = (fRight - fLeft) / (double)(mnSteps * 2L); - fIncrementY = fIncrementX * mfAspect; + fIncrementX = (fRight - fLeft) / (double)(maGradientInfo.mnSteps * 2L); + fIncrementY = fIncrementX * maGradientInfo.mfAspectRatio; } - for(sal_uInt32 a(1L); a < mnSteps; a++) + for(sal_uInt32 a(1L); a < maGradientInfo.mnSteps; a++) { // next step fLeft += fIncrementX; @@ -483,21 +327,7 @@ namespace drawinglayer void GeoTexSvxGradientRadial::modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& /*rfOpacity*/) const { - const basegfx::B2DPoint aCoor(maBackTextureTransform * rUV); - const double fDist(aCoor.getX() * aCoor.getX() + aCoor.getY() * aCoor.getY()); - - if(basegfx::fTools::moreOrEqual(fDist, 1.0)) - { - rBColor = maStart; - return; - } - - double fScaler(1.0 - sqrt(fDist)); - - if(mnSteps > 2L && mnSteps < 128L) - { - fScaler = floor(fScaler * (double)mnSteps) / (double)(mnSteps - 1L); - } + const double fScaler(basegfx::tools::getRadialGradientAlpha(rUV, maGradientInfo)); rBColor = (maStart * (1.0 - fScaler)) + (maEnd * fScaler); } @@ -513,56 +343,12 @@ namespace drawinglayer GeoTexSvxGradientElliptical::GeoTexSvxGradientElliptical(const basegfx::B2DRange& rTargetRange, const basegfx::BColor& rStart, const basegfx::BColor& rEnd, sal_uInt32 nSteps, double fBorder, double fOffsetX, double fOffsetY, double fAngle) : GeoTexSvxGradient(rTargetRange, rStart, rEnd, nSteps, fBorder) { - double fTargetSizeX(maTargetRange.getWidth()); - double fTargetSizeY(maTargetRange.getHeight()); - double fTargetOffsetX(maTargetRange.getMinX()); - double fTargetOffsetY(maTargetRange.getMinY()); - - // add object expansion - fTargetOffsetX -= (0.4142 / 2.0 ) * fTargetSizeX; - fTargetOffsetY -= (0.4142 / 2.0 ) * fTargetSizeY; - fTargetSizeX = 1.4142 * fTargetSizeX; - fTargetSizeY = 1.4142 * fTargetSizeY; - - // add object scale before rotate - maTextureTransform.scale(fTargetSizeX, fTargetSizeY); - - // add texture rotate after scale to keep perpendicular angles - if(0.0 != fAngle) - { - basegfx::B2DPoint aCenter(0.5, 0.5); - aCenter *= maTextureTransform; - - maTextureTransform.translate(-aCenter.getX(), -aCenter.getY()); - maTextureTransform.rotate(fAngle); - maTextureTransform.translate(aCenter.getX(), aCenter.getY()); - } - - // add defined offsets after rotation - if(0.5 != fOffsetX || 0.5 != fOffsetY) - { - // use original target size - fTargetOffsetX += (fOffsetX - 0.5) * maTargetRange.getWidth(); - fTargetOffsetY += (fOffsetY - 0.5) * maTargetRange.getHeight(); - } - - // add object translate - maTextureTransform.translate(fTargetOffsetX, fTargetOffsetY); - - // prepare aspect for texture - mfAspect = (0.0 != fTargetSizeY) ? fTargetSizeX / fTargetSizeY : 1.0; - - // build transform from u,v to [0.0 .. 1.0]. As base, use inverse texture transform - maBackTextureTransform = maTextureTransform; - maBackTextureTransform.invert(); - maBackTextureTransform.translate(-0.5, -0.5); - const double fHalfBorder((1.0 - mfBorder) * 0.5); - - if(!basegfx::fTools::equal(fHalfBorder, 0.0)) - { - const double fFactor(1.0 / fHalfBorder); - maBackTextureTransform.scale(fFactor, fFactor); - } + basegfx::tools::createEllipticalODFGradientInfo(maGradientInfo, + rTargetRange, + basegfx::B2DVector(fOffsetX,fOffsetY), + nSteps, + fBorder, + fAngle); } GeoTexSvxGradientElliptical::~GeoTexSvxGradientElliptical() @@ -571,7 +357,7 @@ namespace drawinglayer void GeoTexSvxGradientElliptical::appendTransformations(::std::vector< basegfx::B2DHomMatrix >& rMatrices) { - if(mnSteps) + if(maGradientInfo.mnSteps) { const double fHalfBorder((1.0 - mfBorder) * 0.5); double fLeft(0.5 - fHalfBorder); @@ -580,18 +366,18 @@ namespace drawinglayer double fBottom(0.5 + fHalfBorder); double fIncrementX, fIncrementY; - if(mfAspect > 1.0) + if(maGradientInfo.mfAspectRatio > 1.0) { - fIncrementY = (fBottom - fTop) / (double)(mnSteps * 2L); - fIncrementX = fIncrementY / mfAspect; + fIncrementY = (fBottom - fTop) / (double)(maGradientInfo.mnSteps * 2L); + fIncrementX = fIncrementY / maGradientInfo.mfAspectRatio; } else { - fIncrementX = (fRight - fLeft) / (double)(mnSteps * 2L); - fIncrementY = fIncrementX * mfAspect; + fIncrementX = (fRight - fLeft) / (double)(maGradientInfo.mnSteps * 2L); + fIncrementY = fIncrementX * maGradientInfo.mfAspectRatio; } - for(sal_uInt32 a(1L); a < mnSteps; a++) + for(sal_uInt32 a(1L); a < maGradientInfo.mnSteps; a++) { // next step fLeft += fIncrementX; @@ -613,21 +399,7 @@ namespace drawinglayer void GeoTexSvxGradientElliptical::modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& /*rfOpacity*/) const { - const basegfx::B2DPoint aCoor(maBackTextureTransform * rUV); - const double fDist(aCoor.getX() * aCoor.getX() + aCoor.getY() * aCoor.getY()); - - if(basegfx::fTools::moreOrEqual(fDist, 1.0)) - { - rBColor = maStart; - return; - } - - double fScaler(1.0 - sqrt(fDist)); - - if(mnSteps > 2L && mnSteps < 128L) - { - fScaler = floor(fScaler * (double)mnSteps) / (double)(mnSteps - 1L); - } + const double fScaler(basegfx::tools::getEllipticalGradientAlpha(rUV, maGradientInfo)); rBColor = (maStart * (1.0 - fScaler)) + (maEnd * fScaler); } @@ -643,63 +415,12 @@ namespace drawinglayer GeoTexSvxGradientSquare::GeoTexSvxGradientSquare(const basegfx::B2DRange& rTargetRange, const basegfx::BColor& rStart, const basegfx::BColor& rEnd, sal_uInt32 nSteps, double fBorder, double fOffsetX, double fOffsetY, double fAngle) : GeoTexSvxGradient(rTargetRange, rStart, rEnd, nSteps, fBorder) { - double fTargetSizeX(maTargetRange.getWidth()); - double fTargetSizeY(maTargetRange.getHeight()); - double fTargetOffsetX(maTargetRange.getMinX()); - double fTargetOffsetY(maTargetRange.getMinY()); - - // add object expansion - if(0.0 != fAngle) - { - const double fAbsCos(fabs(cos(fAngle))); - const double fAbsSin(fabs(sin(fAngle))); - const double fNewX(fTargetSizeX * fAbsCos + fTargetSizeY * fAbsSin); - const double fNewY(fTargetSizeY * fAbsCos + fTargetSizeX * fAbsSin); - fTargetOffsetX -= (fNewX - fTargetSizeX) / 2.0; - fTargetOffsetY -= (fNewY - fTargetSizeY) / 2.0; - fTargetSizeX = fNewX; - fTargetSizeY = fNewY; - } - - // add object scale before rotate - maTextureTransform.scale(fTargetSizeX, fTargetSizeY); - - // add texture rotate after scale to keep perpendicular angles - if(0.0 != fAngle) - { - basegfx::B2DPoint aCenter(0.5, 0.5); - aCenter *= maTextureTransform; - - maTextureTransform.translate(-aCenter.getX(), -aCenter.getY()); - maTextureTransform.rotate(fAngle); - maTextureTransform.translate(aCenter.getX(), aCenter.getY()); - } - - // add defined offsets after rotation - if(0.5 != fOffsetX || 0.5 != fOffsetY) - { - // use scaled target size - fTargetOffsetX += (fOffsetX - 0.5) * fTargetSizeX; - fTargetOffsetY += (fOffsetY - 0.5) * fTargetSizeY; - } - - // add object translate - maTextureTransform.translate(fTargetOffsetX, fTargetOffsetY); - - // prepare aspect for texture - mfAspect = (0.0 != fTargetSizeY) ? fTargetSizeX / fTargetSizeY : 1.0; - - // build transform from u,v to [0.0 .. 1.0]. As base, use inverse texture transform - maBackTextureTransform = maTextureTransform; - maBackTextureTransform.invert(); - maBackTextureTransform.translate(-0.5, -0.5); - const double fHalfBorder((1.0 - mfBorder) * 0.5); - - if(!basegfx::fTools::equal(fHalfBorder, 0.0)) - { - const double fFactor(1.0 / fHalfBorder); - maBackTextureTransform.scale(fFactor, fFactor); - } + basegfx::tools::createSquareODFGradientInfo(maGradientInfo, + rTargetRange, + basegfx::B2DVector(fOffsetX,fOffsetY), + nSteps, + fBorder, + fAngle); } GeoTexSvxGradientSquare::~GeoTexSvxGradientSquare() @@ -708,7 +429,7 @@ namespace drawinglayer void GeoTexSvxGradientSquare::appendTransformations(::std::vector< basegfx::B2DHomMatrix >& rMatrices) { - if(mnSteps) + if(maGradientInfo.mnSteps) { const double fHalfBorder((1.0 - mfBorder) * 0.5); double fLeft(0.5 - fHalfBorder); @@ -717,26 +438,26 @@ namespace drawinglayer double fBottom(0.5 + fHalfBorder); double fIncrementX, fIncrementY; - if(mfAspect > 1.0) + if(maGradientInfo.mfAspectRatio > 1.0) { const double fWidth(fRight - fLeft); - const double fHalfAspectExpansion(((mfAspect - 1.0) * 0.5) * fWidth); + const double fHalfAspectExpansion(((maGradientInfo.mfAspectRatio - 1.0) * 0.5) * fWidth); fTop -= fHalfAspectExpansion; fBottom += fHalfAspectExpansion; - fIncrementX = fWidth / (double)(mnSteps * 2L); - fIncrementY = fIncrementX * mfAspect; + fIncrementX = fWidth / (double)(maGradientInfo.mnSteps * 2L); + fIncrementY = fIncrementX * maGradientInfo.mfAspectRatio; } else { const double fHeight(fBottom - fTop); - const double fHalfAspectExpansion((((1.0 / mfAspect) - 1.0) * 0.5) * fHeight); + const double fHalfAspectExpansion((((1.0 / maGradientInfo.mfAspectRatio) - 1.0) * 0.5) * fHeight); fLeft -= fHalfAspectExpansion; fRight += fHalfAspectExpansion; - fIncrementY = fHeight / (double)(mnSteps * 2L); - fIncrementX = fIncrementY / mfAspect; + fIncrementY = fHeight / (double)(maGradientInfo.mnSteps * 2L); + fIncrementX = fIncrementY / maGradientInfo.mfAspectRatio; } - for(sal_uInt32 a(1L); a < mnSteps; a++) + for(sal_uInt32 a(1L); a < maGradientInfo.mnSteps; a++) { // next step fLeft += fIncrementX; @@ -758,22 +479,7 @@ namespace drawinglayer void GeoTexSvxGradientSquare::modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& /*rfOpacity*/) const { - const basegfx::B2DPoint aCoor(maBackTextureTransform * rUV); - const double fAbsX(fabs(aCoor.getX())); - const double fAbsY(fabs(aCoor.getY())); - - if(basegfx::fTools::moreOrEqual(fAbsX, 1.0) || basegfx::fTools::moreOrEqual(fAbsY, 1.0)) - { - rBColor = maStart; - return; - } - - double fScaler(1.0 - (fAbsX > fAbsY ? fAbsX : fAbsY)); - - if(mnSteps > 2L && mnSteps < 128L) - { - fScaler = floor(fScaler * (double)mnSteps) / (double)(mnSteps - 1L); - } + const double fScaler(basegfx::tools::getSquareGradientAlpha(rUV, maGradientInfo)); rBColor = (maStart * (1.0 - fScaler)) + (maEnd * fScaler); } @@ -789,63 +495,12 @@ namespace drawinglayer GeoTexSvxGradientRect::GeoTexSvxGradientRect(const basegfx::B2DRange& rTargetRange, const basegfx::BColor& rStart, const basegfx::BColor& rEnd, sal_uInt32 nSteps, double fBorder, double fOffsetX, double fOffsetY, double fAngle) : GeoTexSvxGradient(rTargetRange, rStart, rEnd, nSteps, fBorder) { - double fTargetSizeX(maTargetRange.getWidth()); - double fTargetSizeY(maTargetRange.getHeight()); - double fTargetOffsetX(maTargetRange.getMinX()); - double fTargetOffsetY(maTargetRange.getMinY()); - - // add object expansion - if(0.0 != fAngle) - { - const double fAbsCos(fabs(cos(fAngle))); - const double fAbsSin(fabs(sin(fAngle))); - const double fNewX(fTargetSizeX * fAbsCos + fTargetSizeY * fAbsSin); - const double fNewY(fTargetSizeY * fAbsCos + fTargetSizeX * fAbsSin); - fTargetOffsetX -= (fNewX - fTargetSizeX) / 2.0; - fTargetOffsetY -= (fNewY - fTargetSizeY) / 2.0; - fTargetSizeX = fNewX; - fTargetSizeY = fNewY; - } - - // add object scale before rotate - maTextureTransform.scale(fTargetSizeX, fTargetSizeY); - - // add texture rotate after scale to keep perpendicular angles - if(0.0 != fAngle) - { - basegfx::B2DPoint aCenter(0.5, 0.5); - aCenter *= maTextureTransform; - - maTextureTransform.translate(-aCenter.getX(), -aCenter.getY()); - maTextureTransform.rotate(fAngle); - maTextureTransform.translate(aCenter.getX(), aCenter.getY()); - } - - // add defined offsets after rotation - if(0.5 != fOffsetX || 0.5 != fOffsetY) - { - // use scaled target size - fTargetOffsetX += (fOffsetX - 0.5) * fTargetSizeX; - fTargetOffsetY += (fOffsetY - 0.5) * fTargetSizeY; - } - - // add object translate - maTextureTransform.translate(fTargetOffsetX, fTargetOffsetY); - - // prepare aspect for texture - mfAspect = (0.0 != fTargetSizeY) ? fTargetSizeX / fTargetSizeY : 1.0; - - // build transform from u,v to [0.0 .. 1.0]. As base, use inverse texture transform - maBackTextureTransform = maTextureTransform; - maBackTextureTransform.invert(); - maBackTextureTransform.translate(-0.5, -0.5); - const double fHalfBorder((1.0 - mfBorder) * 0.5); - - if(!basegfx::fTools::equal(fHalfBorder, 0.0)) - { - const double fFactor(1.0 / fHalfBorder); - maBackTextureTransform.scale(fFactor, fFactor); - } + basegfx::tools::createRectangularODFGradientInfo(maGradientInfo, + rTargetRange, + basegfx::B2DVector(fOffsetX,fOffsetY), + nSteps, + fBorder, + fAngle); } GeoTexSvxGradientRect::~GeoTexSvxGradientRect() @@ -854,7 +509,7 @@ namespace drawinglayer void GeoTexSvxGradientRect::appendTransformations(::std::vector< basegfx::B2DHomMatrix >& rMatrices) { - if(mnSteps) + if(maGradientInfo.mnSteps) { const double fHalfBorder((1.0 - mfBorder) * 0.5); double fLeft(0.5 - fHalfBorder); @@ -863,18 +518,18 @@ namespace drawinglayer double fBottom(0.5 + fHalfBorder); double fIncrementX, fIncrementY; - if(mfAspect > 1.0) + if(maGradientInfo.mfAspectRatio > 1.0) { - fIncrementY = (fBottom - fTop) / (double)(mnSteps * 2L); - fIncrementX = fIncrementY / mfAspect; + fIncrementY = (fBottom - fTop) / (double)(maGradientInfo.mnSteps * 2L); + fIncrementX = fIncrementY / maGradientInfo.mfAspectRatio; } else { - fIncrementX = (fRight - fLeft) / (double)(mnSteps * 2L); - fIncrementY = fIncrementX * mfAspect; + fIncrementX = (fRight - fLeft) / (double)(maGradientInfo.mnSteps * 2L); + fIncrementY = fIncrementX * maGradientInfo.mfAspectRatio; } - for(sal_uInt32 a(1L); a < mnSteps; a++) + for(sal_uInt32 a(1L); a < maGradientInfo.mnSteps; a++) { // next step fLeft += fIncrementX; @@ -896,22 +551,7 @@ namespace drawinglayer void GeoTexSvxGradientRect::modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& /*rfOpacity*/) const { - const basegfx::B2DPoint aCoor(maBackTextureTransform * rUV); - const double fAbsX(fabs(aCoor.getX())); - const double fAbsY(fabs(aCoor.getY())); - - if(basegfx::fTools::moreOrEqual(fAbsX, 1.0) || basegfx::fTools::moreOrEqual(fAbsY, 1.0)) - { - rBColor = maStart; - return; - } - - double fScaler(1.0 - (fAbsX > fAbsY ? fAbsX : fAbsY)); - - if(mnSteps > 2L && mnSteps < 128L) - { - fScaler = floor(fScaler * (double)mnSteps) / (double)(mnSteps - 1L); - } + const double fScaler(basegfx::tools::getRectangularGradientAlpha(rUV, maGradientInfo)); rBColor = (maStart * (1.0 - fScaler)) + (maEnd * fScaler); } diff --git a/officecfg/registry/data/org/openoffice/Office/Canvas.xcu b/officecfg/registry/data/org/openoffice/Office/Canvas.xcu index de3a4704fd6e..00030d71bf9b 100755 --- a/officecfg/registry/data/org/openoffice/Office/Canvas.xcu +++ b/officecfg/registry/data/org/openoffice/Office/Canvas.xcu @@ -18,6 +18,8 @@ 4139 1317 54005803 4 5 12 1 1200 <!-- Mobility Radeon M6 16MB - blank screen 1st slide on internal LCD --> 4098 19545 -2132340659 0 6 13 3265 0 + <!-- ATI Mobility 128 AGP 2X - blank screen --> + 4098 19526 11604008 2 5 10 0 1028 </value> </prop> </node> diff --git a/svx/inc/svx/svdobj.hxx b/svx/inc/svx/svdobj.hxx index a2550c43696f..0b6e190ff025 100644 --- a/svx/inc/svx/svdobj.hxx +++ b/svx/inc/svx/svdobj.hxx @@ -556,7 +556,7 @@ public: static void Free( SdrObject*& _rpObject ); // This method is only for access from Property objects - void SetBoundRectDirty(); + virtual void SetBoundRectDirty(); virtual void SetObjList(SdrObjList* pNewObjList); SdrObjList* GetObjList() const { return pObjList; } diff --git a/svx/inc/svx/svdopage.hxx b/svx/inc/svx/svdopage.hxx index 7a4da5660007..b138b7c12be9 100644 --- a/svx/inc/svx/svdopage.hxx +++ b/svx/inc/svx/svdopage.hxx @@ -65,6 +65,9 @@ public: SdrPage* GetReferencedPage() const; void SetReferencedPage(SdrPage* pNewPage); + // #i96598# + virtual void SetBoundRectDirty(); + virtual UINT16 GetObjIdentifier() const; virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const; virtual void operator=(const SdrObject& rObj); diff --git a/svx/inc/svx/svdpntv.hxx b/svx/inc/svx/svdpntv.hxx index d8269e73f35c..d9e9d46739d3 100644 --- a/svx/inc/svx/svdpntv.hxx +++ b/svx/inc/svx/svdpntv.hxx @@ -385,14 +385,14 @@ public: // SdrPaintWindow again. This means: the SdrPaintWindow is no longer safe after this closing call. SdrPaintWindow* BeginCompleteRedraw(OutputDevice* pOut); void DoCompleteRedraw(SdrPaintWindow& rPaintWindow, const Region& rReg, sdr::contact::ViewObjectContactRedirector* pRedirector = 0); - void EndCompleteRedraw(SdrPaintWindow& rPaintWindow); + void EndCompleteRedraw(SdrPaintWindow& rPaintWindow, bool bPaintFormLayer); //////////////////////////////////////////////////////////////////////////////////////////////////// // used for the other applications basctl/sc/sw which call DrawLayer at PageViews // #i74769# Interface change to use common BeginCompleteRedraw/EndCompleteRedraw // #i76114# bDisableIntersect disables intersecting rReg with the Window's paint region SdrPaintWindow* BeginDrawLayers(OutputDevice* pOut, const Region& rReg, bool bDisableIntersect = false); - void EndDrawLayers(SdrPaintWindow& rPaintWindow); + void EndDrawLayers(SdrPaintWindow& rPaintWindow, bool bPaintFormLayer); protected: //////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/svx/source/dialog/contwnd.cxx b/svx/source/dialog/contwnd.cxx index 9983d589ba72..45e25388c028 100644 --- a/svx/source/dialog/contwnd.cxx +++ b/svx/source/dialog/contwnd.cxx @@ -355,7 +355,7 @@ void ContourWindow::Paint( const Rectangle& rRect ) // #i75482# const Region aRepaintRegion(rRect); pView->DoCompleteRedraw(*pPaintWindow, aRepaintRegion); - pView->EndCompleteRedraw(*pPaintWindow); + pView->EndCompleteRedraw(*pPaintWindow, true); } // eof diff --git a/svx/source/dialog/graphctl.cxx b/svx/source/dialog/graphctl.cxx index 5e48b318cf91..a3b57230da55 100644 --- a/svx/source/dialog/graphctl.cxx +++ b/svx/source/dialog/graphctl.cxx @@ -348,7 +348,7 @@ void GraphCtrl::Paint( const Rectangle& rRect ) const Region aRepaintRegion(rRect); pView->DoCompleteRedraw(*pPaintWindow, aRepaintRegion); - pView->EndCompleteRedraw(*pPaintWindow); + pView->EndCompleteRedraw(*pPaintWindow, true); } else { diff --git a/svx/source/dialog/tpshadow.cxx b/svx/source/dialog/tpshadow.cxx index e6be1e8dd407..4515f1f39a31 100644 --- a/svx/source/dialog/tpshadow.cxx +++ b/svx/source/dialog/tpshadow.cxx @@ -178,6 +178,16 @@ SvxShadowTabPage::SvxShadowTabPage( Window* pParent, const SfxItemSet& rInAttrs { rXFSet.Put( XFillColorItem( String(), COL_LIGHTRED ) ); } + + if(XFILL_NONE == eXFS) + { + // #i96350# + // fallback to solid fillmode when no fill mode is provided to have + // a reasonable shadow preview. The used color will be a set one or + // the default (currently blue8) + eXFS = XFILL_SOLID; + } + rXFSet.Put( XFillStyleItem( eXFS ) ); aCtlXRectPreview.SetRectangleAttributes(aXFillAttr.GetItemSet()); //aCtlXRectPreview.SetFillAttr( aXFillAttr ); diff --git a/svx/source/engine3d/helperhittest3d.cxx b/svx/source/engine3d/helperhittest3d.cxx index 12bc9a2b53d5..3df2e40b8145 100644 --- a/svx/source/engine3d/helperhittest3d.cxx +++ b/svx/source/engine3d/helperhittest3d.cxx @@ -47,6 +47,7 @@ #include <basegfx/polygon/b3dpolypolygontools.hxx> #include <drawinglayer/primitive3d/hittestprimitive3d.hxx> #include <com/sun/star/uno/Sequence.h> +#include <drawinglayer/primitive3d/hatchtextureprimitive3d.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -156,6 +157,17 @@ namespace drawinglayer // PolyPolygonMaterialPrimitive3D break; } + case PRIMITIVE3D_ID_HATCHTEXTUREPRIMITIVE3D : + { + // #i97321# + // For HatchTexturePrimitive3D, do not use the decomposition since it will produce + // clipped hatch lines in 3D. It can be used when the hatch also has a filling, but for + // simplicity, just use the children which are the PolyPolygonMaterialPrimitive3D + // which define the hatched areas anyways; for HitTest this is more than adequate + const primitive3d::HatchTexturePrimitive3D& rPrimitive = static_cast< const primitive3d::HatchTexturePrimitive3D& >(rCandidate); + process(rPrimitive.getChildren()); + break; + } case PRIMITIVE3D_ID_HITTESTPRIMITIVE3D : { // HitTestPrimitive3D, force usage due to we are doing a hit test and this diff --git a/svx/source/engine3d/scene3d.cxx b/svx/source/engine3d/scene3d.cxx index 7909ccbfd10a..ebd11f87c477 100644 --- a/svx/source/engine3d/scene3d.cxx +++ b/svx/source/engine3d/scene3d.cxx @@ -594,7 +594,8 @@ void E3dScene::SaveGeoData(SdrObjGeoData& rGeo) const void E3dScene::RestGeoData(const SdrObjGeoData& rGeo) { - E3DModifySceneSnapRectUpdater aUpdater(this); + // #i94832# removed E3DModifySceneSnapRectUpdater here. + // It should not be needed, is already part of E3dObject::RestGeoData E3dObject::RestGeoData (rGeo); SetCamera (((E3DSceneGeoData &) rGeo).aCamera); } diff --git a/svx/source/engine3d/view3d1.cxx b/svx/source/engine3d/view3d1.cxx index 0b8d2c929edc..5c4bb1c38be1 100644 --- a/svx/source/engine3d/view3d1.cxx +++ b/svx/source/engine3d/view3d1.cxx @@ -193,38 +193,21 @@ void E3dView::Set3DAttributes( const SfxItemSet& rAttr, E3dScene* pInScene, BOOL } else { - const SdrMarkList& rMarkList = GetMarkedObjectList(); - const sal_uInt32 nMarkCnt(rMarkList.GetMarkCount()); - std::vector< E3DModifySceneSnapRectUpdater* > aUpdaters; - sal_uInt32 a; - - // create late modifiers for evtl. updatable scenes - for(a = 0; a < nMarkCnt; a++) - { - SdrObject* pObj = GetMarkedObjectByIndex(a); - - if(dynamic_cast< E3dObject* >(pObj)) - { - aUpdaters.push_back(new E3DModifySceneSnapRectUpdater(GetMarkedObjectByIndex(a))); - } - } + // #i94832# removed usage of E3DModifySceneSnapRectUpdater here. + // They are not needed here, they are already handled in SetAttrToMarked // set at selected objects SetAttrToMarked(rAttr, bReplaceAll); // old run - for(a = 0; a < nMarkCnt; a++) + const SdrMarkList& rMarkList = GetMarkedObjectList(); + const sal_uInt32 nMarkCnt(rMarkList.GetMarkCount()); + + for(sal_uInt32 a(0); a < nMarkCnt; a++) { SdrObject* pObj = GetMarkedObjectByIndex(a); Imp_E3dView_InorderRun3DObjects(pObj, nSelectedItems); } - - // fire scene updaters - while(aUpdaters.size()) - { - delete aUpdaters.back(); - aUpdaters.pop_back(); - } } // DefaultValues pflegen diff --git a/svx/source/svdraw/svddrgv.cxx b/svx/source/svdraw/svddrgv.cxx index 4843cdc4afc4..f3d98b530bc6 100644 --- a/svx/source/svdraw/svddrgv.cxx +++ b/svx/source/svdraw/svddrgv.cxx @@ -451,17 +451,36 @@ BOOL SdrDragView::BegDragObj(const Point& rPnt, OutputDevice* pOut, SdrHdl* pHdl } else { - if((eDragHdl == HDL_MOVE) && (GetMarkedObjectCount() == 1) && GetMarkedObjectByIndex(0)->ISA(SdrObjCustomShape)) + if(HDL_MOVE == eDragHdl) { - mpCurrentSdrDragMethod = new SdrDragMove( *this ); + const bool bCustomShapeSelected(1 == GetMarkedObjectCount() && GetMarkedObjectByIndex(0)->ISA(SdrObjCustomShape)); + + if(bCustomShapeSelected) + { + mpCurrentSdrDragMethod = new SdrDragMove( *this ); + } } - else if((eDragHdl == HDL_POLY) && (!IsMoveAllowed() || !IsResizeAllowed())) + else if(HDL_POLY == eDragHdl) { - // #i77187# do not allow move of polygon points if object is move or size protected - return FALSE; + const bool bConnectorSelected(1 == GetMarkedObjectCount() && GetMarkedObjectByIndex(0)->ISA(SdrEdgeObj)); + + if(bConnectorSelected) + { + // #i97784# + // fallback to old behaviour for connectors (see + // text in task description for more details) + } + else if(!IsMoveAllowed() || !IsResizeAllowed()) + { + // #i77187# + // do not allow move of polygon points if object is move or size protected + return FALSE; + } } - else + + if(!pDragBla) { + // fallback to DragSpecial if no interaction defined bDragSpecial = TRUE; mpCurrentSdrDragMethod = new SdrDragObjOwn(*this); } diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx index 86ce62c58fc7..3f748e53ff47 100644 --- a/svx/source/svdraw/svdoashp.cxx +++ b/svx/source/svdraw/svdoashp.cxx @@ -1784,7 +1784,12 @@ void SdrObjCustomShape::NbcMove( const Size& rSiz ) { SdrObject* pRenderedCustomShape = GetSdrObjectFromXShape( mXRenderedCustomShape ); if ( pRenderedCustomShape ) + { + // #i97149# the visualisation shape needs to be informed + // about change, too + pRenderedCustomShape->ActionChanged(); pRenderedCustomShape->NbcMove( rSiz ); + } } // #i37011# adapt geometry shadow diff --git a/svx/source/svdraw/svdopage.cxx b/svx/source/svdraw/svdopage.cxx index 974e5be0d103..be174aeb5d69 100644 --- a/svx/source/svdraw/svdopage.cxx +++ b/svx/source/svdraw/svdopage.cxx @@ -140,6 +140,13 @@ void SdrPageObj::SetReferencedPage(SdrPage* pNewPage) } } +// #i96598# +void SdrPageObj::SetBoundRectDirty() +{ + // avoid resetting aOutRect which in case of this object is model data, + // not re-creatable view data +} + UINT16 SdrPageObj::GetObjIdentifier() const { return UINT16(OBJ_PAGE); diff --git a/svx/source/svdraw/svdopath.cxx b/svx/source/svdraw/svdopath.cxx index c2ee3d910559..d40c4a40d0ad 100644 --- a/svx/source/svdraw/svdopath.cxx +++ b/svx/source/svdraw/svdopath.cxx @@ -1955,7 +1955,7 @@ void SdrPathObj::TakeObjNameSingul(XubString& rName) const } rName = ImpGetResStr(nId); - sal_uInt16 nPos(rName.SearchAscii("%N")); + sal_uInt16 nPos(rName.SearchAscii("%2")); // #i96537# if(STRING_NOTFOUND != nPos) { diff --git a/svx/source/svdraw/svdotextdecomposition.cxx b/svx/source/svdraw/svdotextdecomposition.cxx index 4f07779147df..be1d19f96f4e 100644 --- a/svx/source/svdraw/svdotextdecomposition.cxx +++ b/svx/source/svdraw/svdotextdecomposition.cxx @@ -261,8 +261,9 @@ namespace // prepare DXArray content. To make it independent from font size (and such from // the text transformation), scale it to unit coordinates ::std::vector< double > aDXArray; + static bool bDisableTextArray(false); - if(rInfo.mpDXArray && rInfo.mnTextLen) + if(!bDisableTextArray && rInfo.mpDXArray && rInfo.mnTextLen) { const double fScaleFactor(basegfx::fTools::equalZero(aSize.getX()) ? 1.0 : 1.0 / aSize.getX()); aDXArray.reserve(rInfo.mnTextLen); @@ -273,96 +274,121 @@ namespace } } - // prepare overline data - drawinglayer::primitive2d::FontUnderline eFontOverline(mapTextLineStyle(rInfo.mrFont.GetOverline())); - - // prepare underline data - drawinglayer::primitive2d::FontUnderline eFontUnderline(mapTextLineStyle(rInfo.mrFont.GetUnderline())); + // create complex text primitive and append + const Color aFontColor(rInfo.mrFont.GetColor()); + const basegfx::BColor aBFontColor(aFontColor.getBColor()); - const bool bUnderlineAbove(drawinglayer::primitive2d::FONT_UNDERLINE_NONE != eFontUnderline && impIsUnderlineAbove(rInfo.mrFont)); + // prepare new primitive + drawinglayer::primitive2d::BasePrimitive2D* pNewPrimitive = 0; + const bool bDecoratedIsNeeded( + UNDERLINE_NONE != rInfo.mrFont.GetOverline() + || UNDERLINE_NONE != rInfo.mrFont.GetUnderline() + || STRIKEOUT_NONE != rInfo.mrFont.GetStrikeout() + || EMPHASISMARK_NONE != (rInfo.mrFont.GetEmphasisMark() & EMPHASISMARK_STYLE) + || RELIEF_NONE != rInfo.mrFont.GetRelief() + || rInfo.mrFont.IsShadow()); + + if(bDecoratedIsNeeded) + { + // TextDecoratedPortionPrimitive2D needed, prepare some more data + // get overline and underline color. If it's on automatic (0xffffffff) use FontColor instead + const Color aUnderlineColor(rInfo.maTextLineColor); + const basegfx::BColor aBUnderlineColor((0xffffffff == aUnderlineColor.GetColor()) ? aBFontColor : aUnderlineColor.getBColor()); + const Color aOverlineColor(rInfo.maOverlineColor); + const basegfx::BColor aBOverlineColor((0xffffffff == aOverlineColor.GetColor()) ? aBFontColor : aOverlineColor.getBColor()); - // prepare strikeout data - drawinglayer::primitive2d::FontStrikeout eFontStrikeout(drawinglayer::primitive2d::FONT_STRIKEOUT_NONE); + // prepare overline and underline data + const drawinglayer::primitive2d::FontUnderline eFontOverline(mapTextLineStyle(rInfo.mrFont.GetOverline())); + const drawinglayer::primitive2d::FontUnderline eFontUnderline(mapTextLineStyle(rInfo.mrFont.GetUnderline())); - switch(rInfo.mrFont.GetStrikeout()) - { - case STRIKEOUT_SINGLE: eFontStrikeout = drawinglayer::primitive2d::FONT_STRIKEOUT_SINGLE; break; - case STRIKEOUT_DOUBLE: eFontStrikeout = drawinglayer::primitive2d::FONT_STRIKEOUT_DOUBLE; break; - case STRIKEOUT_BOLD: eFontStrikeout = drawinglayer::primitive2d::FONT_STRIKEOUT_BOLD; break; - case STRIKEOUT_SLASH: eFontStrikeout = drawinglayer::primitive2d::FONT_STRIKEOUT_SLASH; break; - case STRIKEOUT_X: eFontStrikeout = drawinglayer::primitive2d::FONT_STRIKEOUT_X; break; - default : break; // FontStrikeout_FORCE_EQUAL_SIZE, STRIKEOUT_NONE, STRIKEOUT_DONTKNOW - } + // check UndelineAbove + const bool bUnderlineAbove(drawinglayer::primitive2d::FONT_UNDERLINE_NONE != eFontUnderline && impIsUnderlineAbove(rInfo.mrFont)); - // prepare wordLineMode (for underline and strikeout) - // NOT for bullet texts. It is set (this may be an error by itself), but needs to be suppressed to hinder e.g. '1)' - // to be splitted which would not look like the original - const bool bWordLineMode(rInfo.mrFont.IsWordLineMode() && !rInfo.mbEndOfBullet); + // prepare strikeout data + drawinglayer::primitive2d::FontStrikeout eFontStrikeout(drawinglayer::primitive2d::FONT_STRIKEOUT_NONE); - // prepare emphasis mark data - drawinglayer::primitive2d::FontEmphasisMark eFontEmphasisMark(drawinglayer::primitive2d::FONT_EMPHASISMARK_NONE); + switch(rInfo.mrFont.GetStrikeout()) + { + case STRIKEOUT_SINGLE: eFontStrikeout = drawinglayer::primitive2d::FONT_STRIKEOUT_SINGLE; break; + case STRIKEOUT_DOUBLE: eFontStrikeout = drawinglayer::primitive2d::FONT_STRIKEOUT_DOUBLE; break; + case STRIKEOUT_BOLD: eFontStrikeout = drawinglayer::primitive2d::FONT_STRIKEOUT_BOLD; break; + case STRIKEOUT_SLASH: eFontStrikeout = drawinglayer::primitive2d::FONT_STRIKEOUT_SLASH; break; + case STRIKEOUT_X: eFontStrikeout = drawinglayer::primitive2d::FONT_STRIKEOUT_X; break; + default : break; // FontStrikeout_FORCE_EQUAL_SIZE, STRIKEOUT_NONE, STRIKEOUT_DONTKNOW + } - switch(rInfo.mrFont.GetEmphasisMark() & EMPHASISMARK_STYLE) - { - case EMPHASISMARK_DOT : eFontEmphasisMark = drawinglayer::primitive2d::FONT_EMPHASISMARK_DOT; break; - case EMPHASISMARK_CIRCLE : eFontEmphasisMark = drawinglayer::primitive2d::FONT_EMPHASISMARK_CIRCLE; break; - case EMPHASISMARK_DISC : eFontEmphasisMark = drawinglayer::primitive2d::FONT_EMPHASISMARK_DISC; break; - case EMPHASISMARK_ACCENT : eFontEmphasisMark = drawinglayer::primitive2d::FONT_EMPHASISMARK_ACCENT; break; - } + // prepare wordLineMode (for underline and strikeout) + // NOT for bullet texts. It is set (this may be an error by itself), but needs to be suppressed to hinder e.g. '1)' + // to be splitted which would not look like the original + const bool bWordLineMode(rInfo.mrFont.IsWordLineMode() && !rInfo.mbEndOfBullet); - const bool bEmphasisMarkAbove(rInfo.mrFont.GetEmphasisMark() & EMPHASISMARK_POS_ABOVE); - const bool bEmphasisMarkBelow(rInfo.mrFont.GetEmphasisMark() & EMPHASISMARK_POS_BELOW); + // prepare emphasis mark data + drawinglayer::primitive2d::FontEmphasisMark eFontEmphasisMark(drawinglayer::primitive2d::FONT_EMPHASISMARK_NONE); - // prepare font relief data - drawinglayer::primitive2d::FontRelief eFontRelief(drawinglayer::primitive2d::FONT_RELIEF_NONE); + switch(rInfo.mrFont.GetEmphasisMark() & EMPHASISMARK_STYLE) + { + case EMPHASISMARK_DOT : eFontEmphasisMark = drawinglayer::primitive2d::FONT_EMPHASISMARK_DOT; break; + case EMPHASISMARK_CIRCLE : eFontEmphasisMark = drawinglayer::primitive2d::FONT_EMPHASISMARK_CIRCLE; break; + case EMPHASISMARK_DISC : eFontEmphasisMark = drawinglayer::primitive2d::FONT_EMPHASISMARK_DISC; break; + case EMPHASISMARK_ACCENT : eFontEmphasisMark = drawinglayer::primitive2d::FONT_EMPHASISMARK_ACCENT; break; + } - switch(rInfo.mrFont.GetRelief()) - { - case RELIEF_EMBOSSED : eFontRelief = drawinglayer::primitive2d::FONT_RELIEF_EMBOSSED; break; - case RELIEF_ENGRAVED : eFontRelief = drawinglayer::primitive2d::FONT_RELIEF_ENGRAVED; break; - default : break; // RELIEF_NONE, FontRelief_FORCE_EQUAL_SIZE - } + const bool bEmphasisMarkAbove(rInfo.mrFont.GetEmphasisMark() & EMPHASISMARK_POS_ABOVE); + const bool bEmphasisMarkBelow(rInfo.mrFont.GetEmphasisMark() & EMPHASISMARK_POS_BELOW); - // prepare shadow/outline data - const bool bShadow(rInfo.mrFont.IsShadow()); + // prepare font relief data + drawinglayer::primitive2d::FontRelief eFontRelief(drawinglayer::primitive2d::FONT_RELIEF_NONE); - // create complex text primitive and append - const Color aFontColor(rInfo.mrFont.GetColor()); - const basegfx::BColor aBFontColor(aFontColor.getBColor()); + switch(rInfo.mrFont.GetRelief()) + { + case RELIEF_EMBOSSED : eFontRelief = drawinglayer::primitive2d::FONT_RELIEF_EMBOSSED; break; + case RELIEF_ENGRAVED : eFontRelief = drawinglayer::primitive2d::FONT_RELIEF_ENGRAVED; break; + default : break; // RELIEF_NONE, FontRelief_FORCE_EQUAL_SIZE + } - // get overline color. If it's on automatic (0xffffffff) use FontColor instead - const Color aOverlineColor(rInfo.maOverlineColor); - const basegfx::BColor aBOverlineColor((0xffffffff == aOverlineColor.GetColor()) ? aBFontColor : aOverlineColor.getBColor()); - - // get underline color. If it's on automatic (0xffffffff) use FontColor instead - const Color aUnderlineColor(rInfo.maTextLineColor); - const basegfx::BColor aBUnderlineColor((0xffffffff == aUnderlineColor.GetColor()) ? aBFontColor : aUnderlineColor.getBColor()); - - drawinglayer::primitive2d::BasePrimitive2D* pNewPrimitive = new drawinglayer::primitive2d::TextDecoratedPortionPrimitive2D( - - // attributes for TextSimplePortionPrimitive2D - aNewTransform, - rInfo.mrText, - rInfo.mnTextStart, - rInfo.mnTextLen, - aDXArray, - aFontAttributes, - rInfo.mpLocale ? *rInfo.mpLocale : ::com::sun::star::lang::Locale(), - aBFontColor, - - // attributes for TextDecoratedPortionPrimitive2D - aBOverlineColor, - aBUnderlineColor, - eFontOverline, - eFontUnderline, - bUnderlineAbove, - eFontStrikeout, - bWordLineMode, - eFontEmphasisMark, - bEmphasisMarkAbove, - bEmphasisMarkBelow, - eFontRelief, - bShadow); + // prepare shadow/outline data + const bool bShadow(rInfo.mrFont.IsShadow()); + + // TextDecoratedPortionPrimitive2D is needed, create one + pNewPrimitive = new drawinglayer::primitive2d::TextDecoratedPortionPrimitive2D( + + // attributes for TextSimplePortionPrimitive2D + aNewTransform, + rInfo.mrText, + rInfo.mnTextStart, + rInfo.mnTextLen, + aDXArray, + aFontAttributes, + rInfo.mpLocale ? *rInfo.mpLocale : ::com::sun::star::lang::Locale(), + aBFontColor, + + // attributes for TextDecoratedPortionPrimitive2D + aBOverlineColor, + aBUnderlineColor, + eFontOverline, + eFontUnderline, + bUnderlineAbove, + eFontStrikeout, + bWordLineMode, + eFontEmphasisMark, + bEmphasisMarkAbove, + bEmphasisMarkBelow, + eFontRelief, + bShadow); + } + else + { + // TextSimplePortionPrimitive2D is enough + pNewPrimitive = new drawinglayer::primitive2d::TextSimplePortionPrimitive2D( + aNewTransform, + rInfo.mrText, + rInfo.mnTextStart, + rInfo.mnTextLen, + aDXArray, + aFontAttributes, + rInfo.mpLocale ? *rInfo.mpLocale : ::com::sun::star::lang::Locale(), + aBFontColor); + } if(rInfo.mbEndOfBullet) { diff --git a/svx/source/svdraw/svdotxtr.cxx b/svx/source/svdraw/svdotxtr.cxx index 33e1106094cd..addc538efb25 100644 --- a/svx/source/svdraw/svdotxtr.cxx +++ b/svx/source/svdraw/svdotxtr.cxx @@ -44,6 +44,8 @@ #include <svx/sdr/properties/properties.hxx> #include <basegfx/polygon/b2dpolypolygontools.hxx> #include "svdtxhdl.hxx" +#include <svtools/itemset.hxx> +#include <svditer.hxx> //////////////////////////////////////////////////////////////////////////////////////////////////// // @@ -414,20 +416,75 @@ SdrObject* SdrTextObj::ImpConvertMakeObj(const basegfx::B2DPolyPolygon& rPolyPol SdrObject* SdrTextObj::ImpConvertAddText(SdrObject* pObj, FASTBOOL bBezier) const { - if (!ImpCanConvTextToCurve()) return pObj; - SdrObject* pText=ImpConvertObj(!bBezier); - if (pText==NULL) return pObj; - if (pObj==NULL) return pText; - if (pText->IsGroupObject()) { + if(!ImpCanConvTextToCurve()) + { + return pObj; + } + + SdrObject* pText = ImpConvertObj(!bBezier); + + if(!pText) + { + return pObj; + } + + if(!pObj) + { + return pText; + } + + // #i97874# + // if shadow is set, apply it to created text, too + const bool bShadowOn(((SdrShadowItem&)GetObjectItem(SDRATTR_SHADOW)).GetValue()); + SfxItemSet aShadowSet(*(GetObjectItemSet().GetPool()), SDRATTR_SHADOW_FIRST, SDRATTR_SHADOW_LAST); + + if(bShadowOn) + { + // filter shadow items + aShadowSet.Put(GetObjectItemSet()); + } + + { // #i97874# + // copy needed attributes from local object to all newly created objects + SdrObjListIter aIter(*pText); + + while(aIter.IsMore()) + { + SdrObject* pCandidate = aIter.Next(); + + // make sure Layer and model are correct + pCandidate->NbcSetLayer(SdrLayerID(GetLayer())); + pCandidate->SetModel(pModel); + + // set shadow if needed + if(bShadowOn) + { + pCandidate->SetMergedItemSet(aShadowSet); + } + + // set used StyleSheet + pCandidate->NbcSetStyleSheet(GetStyleSheet(), true); + } + } + + if(pText->IsGroupObject()) + { + // is already group object, add partial shape in front SdrObjList* pOL=pText->GetSubList(); pOL->InsertObject(pObj,0); + return pText; - } else { + } + else + { + // not yet a group, create one and add partial and new shapes SdrObjGroup* pGrp=new SdrObjGroup; SdrObjList* pOL=pGrp->GetSubList(); pOL->InsertObject(pObj); pOL->InsertObject(pText); + return pGrp; } } +// eof diff --git a/svx/source/svdraw/svdpntv.cxx b/svx/source/svdraw/svdpntv.cxx index 80419733749b..1bebad93223d 100644 --- a/svx/source/svdraw/svdpntv.cxx +++ b/svx/source/svdraw/svdpntv.cxx @@ -791,7 +791,7 @@ void SdrPaintView::CompleteRedraw(OutputDevice* pOut, const Region& rReg, sdr::c OSL_ENSURE(pPaintWindow, "SdrPaintView::CompleteRedraw: No OutDev (!)"); DoCompleteRedraw(*pPaintWindow, aOptimizedRepaintRegion, pRedirector); - EndCompleteRedraw(*pPaintWindow); + EndCompleteRedraw(*pPaintWindow, true); #ifdef SVX_REPAINT_TIMER_TEST } @@ -888,7 +888,7 @@ void SdrPaintView::DoCompleteRedraw(SdrPaintWindow& rPaintWindow, const Region& } } -void SdrPaintView::EndCompleteRedraw(SdrPaintWindow& rPaintWindow) +void SdrPaintView::EndCompleteRedraw(SdrPaintWindow& rPaintWindow, bool bPaintFormLayer) { if(rPaintWindow.getTemporaryTarget()) { @@ -899,7 +899,10 @@ void SdrPaintView::EndCompleteRedraw(SdrPaintWindow& rPaintWindow) { // draw postprocessing, only for known devices // it is necessary to always paint FormLayer - ImpFormLayerDrawing(rPaintWindow); + if(bPaintFormLayer) + { + ImpFormLayerDrawing(rPaintWindow); + } // look for active TextEdit. As long as this cannot be painted to a VDev, // it cannot get part of buffering. In that case, output evtl. prerender @@ -1011,10 +1014,10 @@ SdrPaintWindow* SdrPaintView::BeginDrawLayers(OutputDevice* pOut, const Region& return pPaintWindow; } -void SdrPaintView::EndDrawLayers(SdrPaintWindow& rPaintWindow) +void SdrPaintView::EndDrawLayers(SdrPaintWindow& rPaintWindow, bool bPaintFormLayer) { // #i74769# use EndCompleteRedraw() as common base - EndCompleteRedraw(rPaintWindow); + EndCompleteRedraw(rPaintWindow, bPaintFormLayer); if(mpPageView) { |