From 762181f6f1168e0eb54009990222d7cb4cebebd5 Mon Sep 17 00:00:00 2001 From: Jens-Heiner Rechtien Date: Thu, 17 Sep 2009 10:29:02 +0000 Subject: CWS-TOOLING: integrate CWS aw077 2009-09-17 Armin Le Grand #resolved conflicts for integration 2009-09-07 Armin Le Grand #i103058# re-added handling of StatusBar texts for DrawObject creation, added FullDrag for circle-similar shapes (all in the ellipse toolbar) 2009-09-03 Armin Le Grand #i100514# extended TextAttributes and handling, adapted for super/subscript, adapted WordBreaking (again) 2009-09-02 Armin Le Grand #i104432# secured TextLayouterDevice::getTextBoundRect implementation and usage 2009-09-02 Armin Le Grand #i104232#, #i100514# Mainly solved 1st one, no more local SpellCheck remembering, but adding to compare op's where needed 2009-08-19 Armin Le Grand #i100514# commited in-between version due to 2week holiday 2009-08-13 Armin Le Grand #i99157# applied changes to BitmapEx and SdrHdlBitmapSet 2009-08-06 Armin Le Grand #i100357# added clipping for too big MetaFiles --- .../drawinglayer/primitive2d/textlayoutdevice.hxx | 42 +++-- .../drawinglayer/primitive2d/textprimitive2d.hxx | 8 - .../source/primitive2d/graphicprimitive2d.cxx | 33 +++- .../primitive2d/textdecoratedprimitive2d.cxx | 118 ++++++++---- .../source/primitive2d/textlayoutdevice.cxx | 200 +++++++++++---------- .../source/primitive2d/textprimitive2d.cxx | 167 +++++++++-------- drawinglayer/source/processor2d/vclprocessor2d.cxx | 75 ++------ svx/inc/svx/sdr/attribute/sdrtextattribute.hxx | 14 +- svx/inc/svx/sdr/primitive2d/sdrtextprimitive2d.hxx | 27 ++- svx/inc/svx/svdhdl.hxx | 7 - svx/inc/svx/svdotext.hxx | 9 +- svx/source/sdr/attribute/sdrtextattribute.cxx | 36 +++- svx/source/sdr/contact/viewcontactofgraphic.cxx | 3 + svx/source/sdr/overlay/overlaymanagerbuffered.cxx | 57 ++---- svx/source/sdr/primitive2d/sdrattributecreator.cxx | 8 +- .../sdr/primitive2d/sdrdecompositiontools.cxx | 6 +- .../sdr/primitive2d/sdrmeasureprimitive2d.cxx | 3 + svx/source/sdr/primitive2d/sdrprimitivetools.cxx | 25 ++- svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx | 81 ++++----- svx/source/svdraw/svdcrtv.cxx | 6 +- svx/source/svdraw/svddrgmt.cxx | 17 +- svx/source/svdraw/svdhdl.cxx | 51 +++--- svx/source/svdraw/svdocapt.cxx | 27 ++- svx/source/svdraw/svdocirc.cxx | 57 +++++- svx/source/svdraw/svdoedge.cxx | 18 +- svx/source/svdraw/svdopath.cxx | 106 +++++++++-- svx/source/svdraw/svdorect.cxx | 47 +++-- svx/source/svdraw/svdotextdecomposition.cxx | 73 +++----- svx/source/svdraw/svdotextpathdecomposition.cxx | 57 +++--- 29 files changed, 789 insertions(+), 589 deletions(-) diff --git a/drawinglayer/inc/drawinglayer/primitive2d/textlayoutdevice.hxx b/drawinglayer/inc/drawinglayer/primitive2d/textlayoutdevice.hxx index b9639aeacc50..df09718a7582 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/textlayoutdevice.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/textlayoutdevice.hxx @@ -76,8 +76,11 @@ namespace drawinglayer ~TextLayouterDevice(); void setFont(const Font& rFont); - void setFontAttributes(const FontAttributes& rFontAttributes, const basegfx::B2DHomMatrix& rTransform, const ::com::sun::star::lang::Locale & rLocale); - void setFontAttributes(const FontAttributes& rFontAttributes, double fFontScaleX, double fFontScaleY, const ::com::sun::star::lang::Locale & rLocale); + void setFontAttributes( + const FontAttributes& rFontAttributes, + double fFontScaleX, + double fFontScaleY, + const ::com::sun::star::lang::Locale & rLocale); double getTextHeight() const; double getOverlineHeight() const; @@ -85,9 +88,6 @@ namespace drawinglayer double getUnderlineHeight() const; double getUnderlineOffset() const; double getStrikeoutOffset() const; -#ifdef WIN32 - double getCurrentFontRelation() const; -#endif double getTextWidth( const String& rText, @@ -99,9 +99,7 @@ namespace drawinglayer const String& rText, xub_StrLen nIndex, xub_StrLen nLength, - // #i89784# added suppirt for DXArray for justified text - const ::std::vector< double >& rDXArray, - double fFontScaleWidth); + const ::std::vector< double >& rDXArray); basegfx::B2DRange getTextBoundRect( const String& rText, @@ -112,27 +110,33 @@ namespace drawinglayer } // end of namespace drawinglayer ////////////////////////////////////////////////////////////////////////////// +// helper methods for vcl font handling namespace drawinglayer { namespace primitive2d { - // helper methods for vcl font handling + // Create a VCL-Font based on the definitions in FontAttributes + // and the given FontScaling. The FontScaling defines the FontHeight + // (fFontScaleY) and the FontWidth (fFontScaleX). The combination of + // both defines FontStretching, where no stretching happens at + // fFontScaleY == fFontScaleX Font getVclFontFromFontAttributes( const FontAttributes& rFontAttributes, double fFontScaleX, double fFontScaleY, double fFontRotation, - const ::com::sun::star::lang::Locale & rLocale, - const OutputDevice& rOutDev); - - Font getVclFontFromFontAttributes( - const FontAttributes& rFontAttributes, - const basegfx::B2DHomMatrix& rTransform, - const ::com::sun::star::lang::Locale & rLocale, - const OutputDevice& rOutDev); - - FontAttributes getFontAttributesFromVclFont(basegfx::B2DVector& rSize, const Font& rFont, bool bRTL, bool bBiDiStrong); + const ::com::sun::star::lang::Locale & rLocale); + + // Generate FontAttributes DataSet derived from the given VCL-Font. + // The FontScaling with fFontScaleY, fFontScaleX relationship (see + // above) will be set in return parameter o_rSize to allow further + // processing + FontAttributes getFontAttributesFromVclFont( + basegfx::B2DVector& o_rSize, + const Font& rFont, + bool bRTL, + bool bBiDiStrong); } // end of namespace primitive2d } // end of namespace drawinglayer diff --git a/drawinglayer/inc/drawinglayer/primitive2d/textprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/textprimitive2d.hxx index 9515fcc22ee8..d7f9bdb1e89a 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/textprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/textprimitive2d.hxx @@ -158,14 +158,6 @@ namespace drawinglayer // the necessary VCL outline extractins, scaling adaptions and other stuff. void getTextOutlinesAndTransformation(basegfx::B2DPolyPolygonVector& rTarget, basegfx::B2DHomMatrix& rTransformation) const; - // adapts fontScale for usage with TextLayouter. Input is rScale which is the extracted - // scale from a text transformation. A copy goes to rFontScale and is modified so that - // it contains only positive scalings and XY-equal scalings to allow to get a non-X-scaled - // Vcl-Font for TextLayouter. rScale is adapted accordingly to contain the corrected scale - // which would need to be applied to e.g. outlines received from TextLayouter under - // usage of fontScale. This includes Y-Scale, X-Scale-correction and mirrorings. - void getCorrectedScaleAndFontScale(basegfx::B2DVector& rScale, basegfx::B2DVector& rFontScale) const; - // get data const basegfx::B2DHomMatrix& getTextTransform() const { return maTextTransform; } const String& getText() const { return maText; } diff --git a/drawinglayer/source/primitive2d/graphicprimitive2d.cxx b/drawinglayer/source/primitive2d/graphicprimitive2d.cxx index ffceaf8ce04a..1ed826dab562 100644 --- a/drawinglayer/source/primitive2d/graphicprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/graphicprimitive2d.cxx @@ -266,7 +266,38 @@ namespace drawinglayer case GRAPHIC_GDIMETAFILE : { - xPrimitive = Primitive2DReference(new MetafilePrimitive2D(getTransform(), aTransformedGraphic.GetGDIMetaFile())); + // create MetafilePrimitive2D + const GDIMetaFile& rMetafile = aTransformedGraphic.GetGDIMetaFile(); + + xPrimitive = Primitive2DReference( + new MetafilePrimitive2D( + getTransform(), + rMetafile)); + + // #i100357# find out if clipping is needed for this primitive. Unfortunately, + // there exist Metafiles who's content is bigger than the proposed PrefSize set + // at them. This is an error, but we need to work around this + const Size aMetaFilePrefSize(rMetafile.GetPrefSize()); + const Size aMetaFileRealSize( + const_cast< GDIMetaFile& >(rMetafile).GetBoundRect( + *Application::GetDefaultDevice()).GetSize()); + + if(aMetaFileRealSize.getWidth() > aMetaFilePrefSize.getWidth() + || aMetaFileRealSize.getHeight() > aMetaFilePrefSize.getHeight()) + { + // clipping needed. Embed to MaskPrimitive2D. Create childs and mask polygon + const primitive2d::Primitive2DSequence aChildContent(&xPrimitive, 1); + basegfx::B2DPolygon aMaskPolygon( + basegfx::tools::createPolygonFromRect( + basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); + aMaskPolygon.transform(getTransform()); + + xPrimitive = Primitive2DReference( + new MaskPrimitive2D( + basegfx::B2DPolyPolygon(aMaskPolygon), + aChildContent)); + } + break; } diff --git a/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx b/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx index 94e92a149e50..d337950c6c6b 100644 --- a/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx @@ -277,15 +277,16 @@ namespace drawinglayer const FontAttributes& rFontAttributes) const { // create the SimpleTextPrimitive needed in any case - rTarget.push_back(Primitive2DReference(new TextSimplePortionPrimitive2D( - rDecTrans.getB2DHomMatrix(), - rText, - aTextPosition, - aTextLength, - rDXArray, - rFontAttributes, - getLocale(), - getFontColor()))); + rTarget.push_back(Primitive2DReference( + new TextSimplePortionPrimitive2D( + rDecTrans.getB2DHomMatrix(), + rText, + aTextPosition, + aTextLength, + rDXArray, + rFontAttributes, + getLocale(), + getFontColor()))); // see if something else needs to be done const bool bOverlineUsed(FONT_UNDERLINE_NONE != getFontOverline()); @@ -305,7 +306,11 @@ namespace drawinglayer // TextLayouterDevice is needed to get metrics for text decorations like // underline/strikeout/emphasis marks from it. For setup, the font size is needed - aTextLayouter.setFontAttributes(getFontAttributes(), rDecTrans.getScale().getX(), rDecTrans.getScale().getY(), getLocale()); + aTextLayouter.setFontAttributes( + getFontAttributes(), + rDecTrans.getScale().getX(), + rDecTrans.getScale().getY(), + getLocale()); // get text width double fTextWidth(0.0); @@ -317,6 +322,14 @@ namespace drawinglayer else { fTextWidth = rDXArray.back() * rDecTrans.getScale().getX(); + const double fFontScaleX(rDecTrans.getScale().getX()); + + if(!basegfx::fTools::equal(fFontScaleX, 1.0) + && !basegfx::fTools::equalZero(fFontScaleX)) + { + // need to take FontScaling out of the DXArray + fTextWidth /= fFontScaleX; + } } if(bOverlineUsed) @@ -343,28 +356,26 @@ namespace drawinglayer const String aSingleCharString(aStrikeoutChar); const double fStrikeCharWidth(aTextLayouter.getTextWidth(aSingleCharString, 0, 1)); const double fStrikeCharCount(fabs(fTextWidth/fStrikeCharWidth)); - const sal_uInt32 nStrikeCharCount(static_cast< sal_uInt32 >(fStrikeCharCount + 0.9)); - const double fScaleX(rDecTrans.getScale().getX()); - const double fStrikeCharWidthUnscaled(basegfx::fTools::equalZero(fScaleX) ? fStrikeCharWidth : fStrikeCharWidth/fScaleX); - + const sal_uInt32 nStrikeCharCount(static_cast< sal_uInt32 >(fStrikeCharCount + 0.5)); std::vector aDXArray(nStrikeCharCount); String aStrikeoutString; for(sal_uInt32 a(0); a < nStrikeCharCount; a++) { aStrikeoutString += aSingleCharString; - aDXArray[a] = (a + 1) * fStrikeCharWidthUnscaled; + aDXArray[a] = (a + 1) * fStrikeCharWidth; } - rTarget.push_back(Primitive2DReference(new TextSimplePortionPrimitive2D( - rDecTrans.getB2DHomMatrix(), - aStrikeoutString, - 0, - aStrikeoutString.Len(), - aDXArray, - rFontAttributes, - getLocale(), - getFontColor()))); + rTarget.push_back(Primitive2DReference( + new TextSimplePortionPrimitive2D( + rDecTrans.getB2DHomMatrix(), + aStrikeoutString, + 0, + aStrikeoutString.Len(), + aDXArray, + rFontAttributes, + getLocale(), + getFontColor()))); } else { @@ -483,17 +494,15 @@ namespace drawinglayer xLocalBreakIterator.set(xMSF->createInstance(rtl::OUString::createFromAscii("com.sun.star.i18n.BreakIterator")), ::com::sun::star::uno::UNO_QUERY); } - if(xLocalBreakIterator.is()) + if(xLocalBreakIterator.is() && getTextLength()) { // init word iterator, get first word and truncate to possibilities ::com::sun::star::i18n::Boundary aNextWordBoundary(xLocalBreakIterator->getWordBoundary( getText(), getTextPosition(), getLocale(), ::com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES, sal_True)); - if(aNextWordBoundary.endPos == getTextPosition() && getTextLength() > 0) + if(aNextWordBoundary.endPos == getTextPosition()) { - // #i96474# - // a word before was found (this can happen when search starts on a whitespace and a word - // in front of it exists), force to look one position further + // backward hit, force next word aNextWordBoundary = xLocalBreakIterator->getWordBoundary( getText(), getTextPosition() + 1, getLocale(), ::com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES, sal_True); } @@ -526,7 +535,11 @@ namespace drawinglayer if(bNoDXArray) { // ..but only completely when no DXArray - aTextLayouter.setFontAttributes(getFontAttributes(), rDecTrans.getScale().getX(), rDecTrans.getScale().getY(),getLocale()); + aTextLayouter.setFontAttributes( + getFontAttributes(), + rDecTrans.getScale().getX(), + rDecTrans.getScale().getY(), + getLocale()); } // do iterate over single words @@ -566,12 +579,25 @@ namespace drawinglayer fOffset = getDXArray()[nIndex - 1]; } + // need offset without FontScale for building the new transformation. The + // new transformation will be multiplied with the current text transformation + // so FontScale would be double + double fOffsetNoScale(fOffset); + const double fFontScaleX(rDecTrans.getScale().getX()); + + if(!basegfx::fTools::equal(fFontScaleX, 1.0) + && !basegfx::fTools::equalZero(fFontScaleX)) + { + fOffsetNoScale /= fFontScaleX; + } + // apply needed offset to transformation - aNewTransform.translate(fOffset, 0.0); + aNewTransform.translate(fOffsetNoScale, 0.0); if(!bNoDXArray) { - // DXArray values need to be corrected with the offset, too + // DXArray values need to be corrected with the offset, too. Here, + // take the scaled offset since the DXArray is scaled const sal_uInt32 nArraySize(aNewDXArray.size()); for(sal_uInt32 a(0); a < nArraySize; a++) @@ -591,12 +617,30 @@ namespace drawinglayer impCreateGeometryContent(rTarget, aDecTrans, getText(), nNewTextStart, 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); + if(aNextWordBoundary.endPos >= getTextPosition() + getTextLength()) + { + // end reached + aNextWordBoundary.startPos = aNextWordBoundary.endPos; + } + else + { + // get new word portion + const sal_Int32 nLastEndPos(aNextWordBoundary.endPos); + + aNextWordBoundary = xLocalBreakIterator->getWordBoundary( + getText(), aNextWordBoundary.endPos, getLocale(), + ::com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES, sal_True); - impCorrectTextBoundary(aNextWordBoundary); + if(nLastEndPos == aNextWordBoundary.endPos) + { + // backward hit, force next word + aNextWordBoundary = xLocalBreakIterator->getWordBoundary( + getText(), nLastEndPos + 1, getLocale(), + ::com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES, sal_True); + } + + impCorrectTextBoundary(aNextWordBoundary); + } } } } diff --git a/drawinglayer/source/primitive2d/textlayoutdevice.cxx b/drawinglayer/source/primitive2d/textlayoutdevice.cxx index 0055af3ea4bd..e321783c8406 100644 --- a/drawinglayer/source/primitive2d/textlayoutdevice.cxx +++ b/drawinglayer/source/primitive2d/textlayoutdevice.cxx @@ -43,6 +43,7 @@ #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// // VDev RevDevice provider @@ -166,14 +167,18 @@ namespace drawinglayer mrDevice.SetFont( rFont ); } - void TextLayouterDevice::setFontAttributes(const FontAttributes& rFontAttributes, const basegfx::B2DHomMatrix& rTransform, const ::com::sun::star::lang::Locale & rLocale) - { - setFont(getVclFontFromFontAttributes(rFontAttributes, rTransform, rLocale, mrDevice)); - } - - void TextLayouterDevice::setFontAttributes(const FontAttributes& rFontAttributes, double fFontScaleX, double fFontScaleY, const ::com::sun::star::lang::Locale & rLocale) + void TextLayouterDevice::setFontAttributes( + const FontAttributes& rFontAttributes, + double fFontScaleX, + double fFontScaleY, + const ::com::sun::star::lang::Locale& rLocale) { - setFont(getVclFontFromFontAttributes(rFontAttributes, fFontScaleX, fFontScaleY, 0.0, rLocale, mrDevice)); + setFont(getVclFontFromFontAttributes( + rFontAttributes, + fFontScaleX, + fFontScaleY, + 0.0, + rLocale)); } double TextLayouterDevice::getOverlineOffset() const @@ -197,18 +202,6 @@ namespace drawinglayer return fRet; } -#ifdef WIN32 - double TextLayouterDevice::getCurrentFontRelation() const - { - const Font aFont(mrDevice.GetFont()); - const FontMetric aFontMetric(mrDevice.GetFontMetric(aFont)); - const double fWidth(aFontMetric.GetWidth()); - const double fHeight(aFont.GetHeight()); - - return basegfx::fTools::equalZero(fWidth) ? 1.0 : fHeight / fWidth; - } -#endif - double TextLayouterDevice::getOverlineHeight() const { const ::FontMetric& rMetric = mrDevice.GetFontMetric(); @@ -241,33 +234,42 @@ namespace drawinglayer const String& rText, xub_StrLen nIndex, xub_StrLen nLength, - // #i89784# added suppirt for DXArray for justified text - const ::std::vector< double >& rDXArray, - double fFontScaleWidth) + const ::std::vector< double >& rDXArray) { - std::vector< sal_Int32 > aTransformedDXArray; - const sal_uInt32 nDXArraySize(rDXArray.size()); + const sal_uInt32 nDXArrayCount(rDXArray.size()); - if(nDXArraySize && basegfx::fTools::more(fFontScaleWidth, 0.0)) + if(nDXArrayCount) { - OSL_ENSURE(nDXArraySize == nLength, "DXArray size does not correspond to text portion size (!)"); - aTransformedDXArray.reserve(nDXArraySize); + OSL_ENSURE(nDXArrayCount == nLength, "DXArray size does not correspond to text portion size (!)"); + std::vector< sal_Int32 > aIntegerDXArray(nDXArrayCount); - for(std::vector< double >::const_iterator aStart(rDXArray.begin()); aStart != rDXArray.end(); aStart++) + for(sal_uInt32 a(0); a < nDXArrayCount; a++) { - aTransformedDXArray.push_back(basegfx::fround((*aStart) * fFontScaleWidth)); + aIntegerDXArray[a] = basegfx::fround(rDXArray[a]); } - } - return mrDevice.GetTextOutlines( - rB2DPolyPolyVector, - rText, - nIndex, - nIndex, - nLength, - true, - 0, - nDXArraySize ? &(aTransformedDXArray[0]) : 0); + return mrDevice.GetTextOutlines( + rB2DPolyPolyVector, + rText, + nIndex, + nIndex, + nLength, + true, + 0, + &(aIntegerDXArray[0])); + } + else + { + return mrDevice.GetTextOutlines( + rB2DPolyPolyVector, + rText, + nIndex, + nIndex, + nLength, + true, + 0, + 0); + } } basegfx::B2DRange TextLayouterDevice::getTextBoundRect( @@ -286,7 +288,7 @@ namespace drawinglayer nIndex, nLength); - // #i102556# take empty results into account + // #i104432#, #i102556# take empty results into account if(!aRect.IsEmpty()) { return basegfx::B2DRange(aRect.Left(), aRect.Top(), aRect.Right(), aRect.Bottom()); @@ -305,40 +307,38 @@ namespace drawinglayer { namespace primitive2d { - Font getVclFontFromFontAttributes( - const FontAttributes& rFontAttributes, - const basegfx::B2DHomMatrix& rTransform, - const ::com::sun::star::lang::Locale & rLocale, - const OutputDevice& rOutDev) - { - // decompose matrix to have position and size of text - basegfx::B2DVector aScale, aTranslate; - double fRotate, fShearX; - - rTransform.decompose(aScale, aTranslate, fRotate, fShearX); - - return getVclFontFromFontAttributes(rFontAttributes, aScale.getX(), aScale.getY(), fRotate, rLocale, rOutDev); - } - Font getVclFontFromFontAttributes( const FontAttributes& rFontAttributes, double fFontScaleX, double fFontScaleY, double fFontRotation, - const ::com::sun::star::lang::Locale & rLocale, - const OutputDevice& /*rOutDev*/) + const ::com::sun::star::lang::Locale& rLocale) { - sal_uInt32 nWidth(basegfx::fround(fabs(fFontScaleX))); - sal_uInt32 nHeight(basegfx::fround(fabs(fFontScaleY))); + // detect FontScaling + const sal_uInt32 nHeight(basegfx::fround(fabs(fFontScaleY))); + const sal_uInt32 nWidth(basegfx::fround(fabs(fFontScaleX))); + const bool bFontIsScaled(nHeight != nWidth); + +#ifdef WIN32 + // for WIN32 systems, start with creating an unscaled font. If FontScaling + // is wanted, that width needs to be adapted using FontMetric again to get a + // width of the unscaled font Font aRetval( rFontAttributes.getFamilyName(), rFontAttributes.getStyleName(), -#ifdef WIN32 Size(0, nHeight)); #else - Size(nWidth, nHeight)); + // for non-WIN32 systems things are easier since these accept a Font creation + // with initially nWidth != nHeight for FontScaling. Despite that, use zero for + // FontWidth when no scaling is used to explicitely have that zero when e.g. the + // Font would be recorded in a MetaFile (The MetaFile FontAction WILL record a + // set FontWidth; import that in a WIN32 system, and trouble is there) + Font aRetval( + rFontAttributes.getFamilyName(), + rFontAttributes.getStyleName(), + Size(bFontIsScaled ? nWidth : 0, nHeight)); #endif - + // define various other FontAttributes aRetval.SetAlign(ALIGN_BASELINE); aRetval.SetCharSet(rFontAttributes.getSymbol() ? RTL_TEXTENCODING_SYMBOL : RTL_TEXTENCODING_UNICODE); aRetval.SetVertical(rFontAttributes.getVertical() ? TRUE : FALSE); @@ -348,32 +348,20 @@ namespace drawinglayer aRetval.SetLanguage(MsLangId::convertLocaleToLanguage(rLocale)); #ifdef WIN32 - // #100424# use higher precision - if(!basegfx::fTools::equal(fFontScaleX, fFontScaleY)) + // for WIN32 systems, correct the FontWidth if FontScaling is used + if(bFontIsScaled && nHeight > 0) { - // #i92757# - // Removed the relative calculation with GetFontMetric() usage again. On - // the one hand it was wrong (integer division always created zero), OTOH - // calculating a scale factor from current to target width and then using - // it to actually scale the current width does nothing but set the target - // value directly. Maybe more is needed here with WIN version of font - // width/height handling, but currently, this works the simple way. - // - // As can be seen, when this can stay the simple way, the OutputDevice - // can be removed from the whole getVclFontFromFontAttributes implementations - // again and make it more VCL-independent. - // - // Adapted nWidth usage to nWidth-1 to be completely compatible with - // non-primitive version. - // - // previous stuff: - // const FontMetric aFontMetric(rOutDev.GetFontMetric(aRetval)); - // const double fCurrentWidth(aFontMetric.GetWidth()); - // aRetval.SetWidth(basegfx::fround(fCurrentWidth * ((double)nWidth/(double)nHeight))); - aRetval.SetWidth(nWidth ? nWidth - 1 : 0); + const FontMetric aUnscaledFontMetric(Application::GetDefaultDevice()->GetFontMetric(aRetval)); + + if(aUnscaledFontMetric.GetWidth() > 0) + { + const double fScaleFactor((double)nWidth / (double)nHeight); + const sal_uInt32 nScaledWidth(basegfx::fround((double)aUnscaledFontMetric.GetWidth() * fScaleFactor)); + aRetval.SetWidth(nScaledWidth); + } } #endif - + // handle FontRotation (if defined) if(!basegfx::fTools::equalZero(fFontRotation)) { sal_Int16 aRotate10th((sal_Int16)(fFontRotation * (-1800.0/F_PI))); @@ -383,9 +371,13 @@ namespace drawinglayer return aRetval; } - FontAttributes getFontAttributesFromVclFont(basegfx::B2DVector& rSize, const Font& rFont, bool bRTL, bool bBiDiStrong) + FontAttributes getFontAttributesFromVclFont( + basegfx::B2DVector& o_rSize, + const Font& rFont, + bool bRTL, + bool bBiDiStrong) { - FontAttributes aRetval( + const FontAttributes aRetval( rFont.GetName(), rFont.GetStyleName(), static_cast(rFont.GetWeight()), @@ -397,12 +389,38 @@ namespace drawinglayer bBiDiStrong); // TODO: eKerning - const sal_Int32 nWidth(rFont.GetSize().getWidth()); - const sal_Int32 nHeight(rFont.GetSize().getHeight()); + // set FontHeight and init to no FontScaling + o_rSize.setY(rFont.GetSize().getHeight() > 0 ? rFont.GetSize().getHeight() : 0); + o_rSize.setX(o_rSize.getY()); - rSize.setX(nWidth ? nWidth : nHeight); - rSize.setY(nHeight); +#ifdef WIN32 + // for WIN32 systems, the FontScaling at the Font is detected by + // checking that FontWidth != 0. When FontScaling is used, WIN32 + // needs to do extra stuff to detect the correct width (since it's + // zero and not equal the font height) and it's relationship to + // the height + if(rFont.GetSize().getWidth() > 0) + { + Font aUnscaledFont(rFont); + aUnscaledFont.SetWidth(0); + const FontMetric aUnscaledFontMetric(Application::GetDefaultDevice()->GetFontMetric(aUnscaledFont)); + if(aUnscaledFontMetric.GetWidth() > 0) + { + const double fScaleFactor((double)rFont.GetSize().getWidth() / (double)aUnscaledFontMetric.GetWidth()); + o_rSize.setX(fScaleFactor * o_rSize.getY()); + } + } +#else + // For non-WIN32 systems the detection is the same, but the value + // is easier achieved since width == height is interpreted as no + // scaling. Ergo, Width == 0 means width == height, and width != 0 + // means the scaling is in the direct relation of width to height + if(rFont.GetSize().getWidth() > 0) + { + o_rSize.setX((double)rFont.GetSize().getWidth()); + } +#endif return aRetval; } } // end of namespace primitive2d diff --git a/drawinglayer/source/primitive2d/textprimitive2d.cxx b/drawinglayer/source/primitive2d/textprimitive2d.cxx index 7c62c235c21d..f8e413da0e8c 100644 --- a/drawinglayer/source/primitive2d/textprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/textprimitive2d.cxx @@ -70,49 +70,63 @@ namespace drawinglayer ////////////////////////////////////////////////////////////////////////////// -namespace drawinglayer +namespace { - namespace primitive2d + // adapts fontScale for usage with TextLayouter. Input is rScale which is the extracted + // scale from a text transformation. A copy is modified so that it contains only positive + // scalings and XY-equal scalings to allow to get a non-X-scaled Vcl-Font for TextLayouter. + // rScale is adapted accordingly to contain the corrected scale which would need to be + // applied to e.g. outlines received from TextLayouter under usage of fontScale. This + // includes Y-Scale, X-Scale-correction and mirrorings. + basegfx::B2DVector getCorrectedScaleAndFontScale(basegfx::B2DVector& rScale) { - void TextSimplePortionPrimitive2D::getCorrectedScaleAndFontScale(basegfx::B2DVector& rScale, basegfx::B2DVector& rFontScale) const - { - // copy input value - rFontScale = rScale; + // copy input value + basegfx::B2DVector aFontScale(rScale); - if(basegfx::fTools::equalZero(rFontScale.getY())) - { - // no font height; choose one and adapt scale to get back to original scaling - static double fDefaultFontScale(100.0); - rScale.setY(1.0 / fDefaultFontScale); - rFontScale.setY(fDefaultFontScale); - } - else if(basegfx::fTools::less(rFontScale.getY(), 0.0)) - { - // negative font height; invert and adapt scale to get back to original scaling - rFontScale.setY(-rFontScale.getY()); - rScale.setY(-1.0); - } - else - { - // positive font height; adapt scale; scaling will be part of the polygons - rScale.setY(1.0); - } + // correct FontHeight settings + if(basegfx::fTools::equalZero(aFontScale.getY())) + { + // no font height; choose one and adapt scale to get back to original scaling + static double fDefaultFontScale(100.0); + rScale.setY(1.0 / fDefaultFontScale); + aFontScale.setY(fDefaultFontScale); + } + else if(basegfx::fTools::less(aFontScale.getY(), 0.0)) + { + // negative font height; invert and adapt scale to get back to original scaling + aFontScale.setY(-aFontScale.getY()); + rScale.setY(-1.0); + } + else + { + // positive font height; adapt scale; scaling will be part of the polygons + rScale.setY(1.0); + } - if(basegfx::fTools::equal(rFontScale.getX(), rFontScale.getY())) - { - // adapt scale in X - rScale.setX(1.0); - } - else - { - // If font scale is different in X and Y, force font scale to equal - // in X and Y to get a non-scaled VCL font. - // Adapt scaling in X accordingly. FontScaleY cannot be zero here. - rScale.setX(rFontScale.getX()/rFontScale.getY()); - rFontScale.setX(rFontScale.getY()); - } + // correct FontWidth settings + if(basegfx::fTools::equal(aFontScale.getX(), aFontScale.getY())) + { + // no FontScale, adapt scale + rScale.setX(1.0); } + else + { + // If FontScale is used, force to no FontScale to get a non-scaled VCL font. + // Adapt scaling in X accordingly. + rScale.setX(aFontScale.getX() / aFontScale.getY()); + aFontScale.setX(aFontScale.getY()); + } + + return aFontScale; + } +} // end of anonymous namespace +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { void TextSimplePortionPrimitive2D::getTextOutlinesAndTransformation(basegfx::B2DPolyPolygonVector& rTarget, basegfx::B2DHomMatrix& rTransformation) const { if(getTextLength()) @@ -137,33 +151,47 @@ namespace drawinglayer // the font size. Since we want to extract polygons here, it is okay to // work just with scaling and to ignore shear, rotation and translation, // all that can be applied to the polygons later -#ifdef WIN32 - const bool bCorrectScale(!basegfx::fTools::equal(fabs(aScale.getX()), fabs(aScale.getY()))); -#endif - basegfx::B2DVector aFontScale; - getCorrectedScaleAndFontScale(aScale, aFontScale); + const basegfx::B2DVector aFontScale(getCorrectedScaleAndFontScale(aScale)); // prepare textlayoutdevice TextLayouterDevice aTextLayouter; - aTextLayouter.setFontAttributes(getFontAttributes(), aFontScale.getX(), aFontScale.getY(), getLocale()); -#ifdef WIN32 - // when under Windows and the font is unequally scaled, need to correct font X-Scaling factor - if(bCorrectScale) + aTextLayouter.setFontAttributes( + getFontAttributes(), + aFontScale.getX(), + aFontScale.getY(), + getLocale()); + + // When getting outlines from stretched text (aScale.getX() != 1.0) it + // is necessary to inverse-scale the DXArray (if used) to not get the + // outlines already aligned to given, but wrong DXArray + if(getDXArray().size() && !basegfx::fTools::equal(aScale.getX(), 1.0)) + { + ::std::vector< double > aScaledDXArray = getDXArray(); + const double fDXArrayScale(1.0 / aScale.getX()); + + for(sal_uInt32 a(0); a < aScaledDXArray.size(); a++) + { + aScaledDXArray[a] *= fDXArrayScale; + } + + // get the text outlines + aTextLayouter.getTextOutlines( + rTarget, + getText(), + getTextPosition(), + getTextLength(), + aScaledDXArray); + } + else { - const double fFontRelation(aTextLayouter.getCurrentFontRelation()); - aScale.setX(aScale.getX() * fFontRelation); - aFontScale.setX(aFontScale.getX() / fFontRelation); + // get the text outlines + aTextLayouter.getTextOutlines( + rTarget, + getText(), + getTextPosition(), + getTextLength(), + getDXArray()); } -#endif - // get the text outlines. No DXArray is given (would contain integers equal to unit vector - // transformed by object's transformation), let VCL do the job - aTextLayouter.getTextOutlines( - rTarget, getText(), - getTextPosition(), - getTextLength(), - // #i89784# added support for DXArray for justified text - getDXArray(), - aFontScale.getX()); // create primitives for the outlines const sal_uInt32 nCount(rTarget.size()); @@ -300,29 +328,22 @@ namespace drawinglayer // the font size. Since we want to extract polygons here, it is okay to // work just with scaling and to ignore shear, rotation and translation, // all that can be applied to the polygons later -#ifdef WIN32 - const bool bCorrectScale(!basegfx::fTools::equal(fabs(aScale.getX()), fabs(aScale.getY()))); -#endif - basegfx::B2DVector aFontScale; - getCorrectedScaleAndFontScale(aScale, aFontScale); + const basegfx::B2DVector aFontScale(getCorrectedScaleAndFontScale(aScale)); // prepare textlayoutdevice TextLayouterDevice aTextLayouter; - aTextLayouter.setFontAttributes(getFontAttributes(), aFontScale.getX(), aFontScale.getY(), getLocale()); + aTextLayouter.setFontAttributes( + getFontAttributes(), + aFontScale.getX(), + aFontScale.getY(), + getLocale()); // get basic text range basegfx::B2DRange aNewRange(aTextLayouter.getTextBoundRect(getText(), getTextPosition(), getTextLength())); - // #i102556# take empty results into account + // #i104432#, #i102556# take empty results into account if(!aNewRange.isEmpty()) { -#ifdef WIN32 - // when under Windows and the font is unequally scaled, need to correct font X-Scaling factor - if(bCorrectScale) - { - aScale.setX(aScale.getX() * aTextLayouter.getCurrentFontRelation()); - } -#endif // prepare object transformation for range basegfx::B2DHomMatrix aRangeTransformation; diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx index daf8ce5d525f..e5a88812dd10 100644 --- a/drawinglayer/source/processor2d/vclprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx @@ -138,79 +138,31 @@ namespace drawinglayer { // decompose matrix to have position and size of text basegfx::B2DHomMatrix aLocalTransform(maCurrentTransformation * rTextCandidate.getTextTransform()); - basegfx::B2DVector aScale, aTranslate; + basegfx::B2DVector aFontScaling, aTranslate; double fRotate, fShearX; - aLocalTransform.decompose(aScale, aTranslate, fRotate, fShearX); + aLocalTransform.decompose(aFontScaling, aTranslate, fRotate, fShearX); bool bPrimitiveAccepted(false); if(basegfx::fTools::equalZero(fShearX)) { - if(basegfx::fTools::less(aScale.getX(), 0.0) && basegfx::fTools::less(aScale.getY(), 0.0)) + if(basegfx::fTools::less(aFontScaling.getX(), 0.0) && basegfx::fTools::less(aFontScaling.getY(), 0.0)) { // handle special case: If scale is negative in (x,y) (3rd quadrant), it can - // be expressed as rotation by PI - aScale = basegfx::absolute(aScale); + // be expressed as rotation by PI. Use this since the Font rendering will not + // apply the negative scales in any form + aFontScaling = basegfx::absolute(aFontScaling); fRotate += F_PI; } - if(basegfx::fTools::more(aScale.getX(), 0.0) && basegfx::fTools::more(aScale.getY(), 0.0)) + if(basegfx::fTools::more(aFontScaling.getX(), 0.0) && basegfx::fTools::more(aFontScaling.getY(), 0.0)) { - // #i96581# Get the font forced without FontStretching (use FontHeight as FontWidth) + // Get the VCL font (use FontHeight as FontWidth) Font aFont(primitive2d::getVclFontFromFontAttributes( rTextCandidate.getFontAttributes(), - - // #i100373# FontScaling - // - // There are two different definitions for unscaled fonts, (1) 0==width and - // (2) height==width where (2) is the more modern one supported on all non-WIN32 - // systems and (1) is the old one coming from WIN16-VCL definitions where - // that ominous FontWidth (available over FontMetric) is involved. While - // WIN32 only supports (1), all other systems support (2). When on WIN32, the - // support for (1) is ensured inside getVclFontFromFontAttributes. - // - // The former usage of (2) leads to problems when it is used on non-WIN32 systems - // and exported to MetaFile FontActions where the scale is taken over unseen. When - // such a MetaFile is imported on a WIN32-System supporting (1), all fonts are - // seen as scaled an look wrong. - // - // The simplest and fastest solution is to fallback to (1) independent from the - // system we are running on. - // - // The best solution would be a system-independent Y-value just expressing the - // font scaling, e.g. when (2) is used and width == height, use 1.0 as Y-Value, - // which would also solve the involved ominous FontWidth value for WIN32-systems. - // This is a region which needs redesign urgently. - // - 0, // aScale.getY(), - - aScale.getY(), + aFontScaling.getX(), + aFontScaling.getY(), fRotate, - rTextCandidate.getLocale(), - *mpOutputDevice)); - - if(!basegfx::fTools::equal(aScale.getX(), aScale.getY())) - { - // #100424# We have a hint on FontScaling here. To decide a look - // at the pure font's scale is needed, since e.g. SC uses unequally scaled - // MapModes (was: #i96581#, but use available full precision from primitive - // now). aTranslate and fShearX can be reused since no longer needed. - basegfx::B2DVector aFontScale; - double fFontRotate; - rTextCandidate.getTextTransform().decompose(aFontScale, aTranslate, fFontRotate, fShearX); - - if(!basegfx::fTools::equal(aFontScale.getX(), aFontScale.getY())) - { - // indeed a FontScaling. Set at Font. Use the combined scale - // and rotate here - aFont = primitive2d::getVclFontFromFontAttributes( - rTextCandidate.getFontAttributes(), - aScale.getX(), - aScale.getY(), - fRotate, - rTextCandidate.getLocale(), - *mpOutputDevice); - } - } + rTextCandidate.getLocale())); // handle additional font attributes const primitive2d::TextDecoratedPortionPrimitive2D* pTCPP = @@ -314,10 +266,11 @@ namespace drawinglayer if(rTextCandidate.getDXArray().size()) { aTransformedDXArray.reserve(rTextCandidate.getDXArray().size()); - const basegfx::B2DVector aPixelVector(aLocalTransform * basegfx::B2DVector(1.0, 0.0)); + const basegfx::B2DVector aPixelVector(maCurrentTransformation * basegfx::B2DVector(1.0, 0.0)); const double fPixelVectorFactor(aPixelVector.getLength()); - for(::std::vector< double >::const_iterator aStart(rTextCandidate.getDXArray().begin()); aStart != rTextCandidate.getDXArray().end(); aStart++) + for(::std::vector< double >::const_iterator aStart(rTextCandidate.getDXArray().begin()); + aStart != rTextCandidate.getDXArray().end(); aStart++) { aTransformedDXArray.push_back(basegfx::fround((*aStart) * fPixelVectorFactor)); } diff --git a/svx/inc/svx/sdr/attribute/sdrtextattribute.hxx b/svx/inc/svx/sdr/attribute/sdrtextattribute.hxx index e0dcb51e9460..1759eb18d319 100644 --- a/svx/inc/svx/sdr/attribute/sdrtextattribute.hxx +++ b/svx/inc/svx/sdr/attribute/sdrtextattribute.hxx @@ -35,6 +35,7 @@ #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// // predefines @@ -68,6 +69,10 @@ namespace drawinglayer // #i101556# use versioning from text attributes to detect changes sal_uInt32 maPropertiesVersion; + // text alignments + SdrTextHorzAdjust maSdrTextHorzAdjust; + SdrTextVertAdjust maSdrTextVertAdjust; + // bitfield unsigned mbContour : 1; unsigned mbFitToSize : 1; @@ -75,6 +80,7 @@ namespace drawinglayer unsigned mbBlink : 1; unsigned mbScroll : 1; unsigned mbInEditMode : 1; + unsigned mbFixedCellHeight : 1; public: SdrTextAttribute( @@ -85,12 +91,15 @@ namespace drawinglayer sal_Int32 aTextUpperDistance, sal_Int32 aTextRightDistance, sal_Int32 aTextLowerDistance, + SdrTextHorzAdjust aSdrTextHorzAdjust, + SdrTextVertAdjust aSdrTextVertAdjust, bool bContour, bool bFitToSize, bool bHideContour, bool bBlink, bool bScroll, - bool bInEditMode); + bool bInEditMode, + bool bFixedCellHeight); ~SdrTextAttribute(); // copy constructor and assigment operator @@ -109,12 +118,15 @@ namespace drawinglayer bool isBlink() const { return mbBlink; } bool isScroll() const { return mbScroll; } bool isInEditMode() const { return mbInEditMode; } + bool isFixedCellHeight() const { return mbFixedCellHeight; } const SdrFormTextAttribute* getSdrFormTextAttribute() const { return mpSdrFormTextAttribute; } sal_Int32 getTextLeftDistance() const { return maTextLeftDistance; } sal_Int32 getTextUpperDistance() const { return maTextUpperDistance; } sal_Int32 getTextRightDistance() const { return maTextRightDistance; } sal_Int32 getTextLowerDistance() const { return maTextLowerDistance; } sal_uInt32 getPropertiesVersion() const { return maPropertiesVersion; } + SdrTextHorzAdjust getSdrTextHorzAdjust() const { return maSdrTextHorzAdjust; } + SdrTextVertAdjust getSdrTextVertAdjust() const { return maSdrTextVertAdjust; } // animation timing generation void getBlinkTextTiming(drawinglayer::animation::AnimationEntryList& rAnimList) const; diff --git a/svx/inc/svx/sdr/primitive2d/sdrtextprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrtextprimitive2d.hxx index 6dd60b45d2d5..132a3ecc2538 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrtextprimitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrtextprimitive2d.hxx @@ -40,6 +40,7 @@ #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// // predefines @@ -82,11 +83,6 @@ namespace drawinglayer Color maLastTextBackgroundColor; // bitfield - // remember if last decomposition was with or without spell checker. In this special - // case the get2DDecomposition implementation has to take care of this aspect. This is - // needed since different views do different text decompositons regarding spell checking. - unsigned mbLastSpellCheck : 1; - // is there a PageNumber, Header, Footer or DateTimeField used? Evaluated at construction unsigned mbContainsPageField : 1; unsigned mbContainsPageCountField : 1; @@ -96,9 +92,6 @@ namespace drawinglayer // support for XTEXT_PAINTSHAPE_BEGIN/XTEXT_PAINTSHAPE_END Metafile comments Primitive2DSequence encapsulateWithTextHierarchyBlockPrimitive2D(const Primitive2DSequence& rCandidate) const; - bool getLastSpellCheck() const { return (bool)mbLastSpellCheck; } - void setLastSpellCheck(bool bNew) { mbLastSpellCheck = bNew; } - public: SdrTextPrimitive2D( const SdrText* pSdrText, @@ -217,7 +210,12 @@ namespace drawinglayer // text range transformation from unit range ([0.0 .. 1.0]) to text range basegfx::B2DHomMatrix maTextRangeTransform; + // text alignments + SdrTextHorzAdjust maSdrTextHorzAdjust; + SdrTextVertAdjust maSdrTextVertAdjust; + // bitfield + unsigned mbFixedCellHeight : 1; unsigned mbUnlimitedPage : 1; // force layout with no text break unsigned mbCellText : 1; // this is a cell text as block text unsigned mbWordWrap : 1; // for CustomShapes text layout @@ -231,12 +229,18 @@ namespace drawinglayer const SdrText* pSdrText, const OutlinerParaObject& rOutlinerParaObjectPtr, const basegfx::B2DHomMatrix& rTextRangeTransform, + SdrTextHorzAdjust aSdrTextHorzAdjust, + SdrTextVertAdjust aSdrTextVertAdjust, + bool bFixedCellHeight, bool bUnlimitedPage, bool bCellText, bool bWordWrap); // get data const basegfx::B2DHomMatrix& getTextRangeTransform() const { return maTextRangeTransform; } + SdrTextHorzAdjust getSdrTextHorzAdjust() const { return maSdrTextHorzAdjust; } + SdrTextVertAdjust getSdrTextVertAdjust() const { return maSdrTextVertAdjust; } + bool isFixedCellHeight() const { return mbFixedCellHeight; } bool getUnlimitedPage() const { return mbUnlimitedPage; } bool getCellText() const { return mbCellText; } bool getWordWrap() const { return mbWordWrap; } @@ -265,6 +269,9 @@ namespace drawinglayer // text range transformation from unit range ([0.0 .. 1.0]) to text range basegfx::B2DHomMatrix maTextRangeTransform; + // bitfield + unsigned mbFixedCellHeight : 1; + protected: // local decomposition. virtual Primitive2DSequence createLocalDecomposition(const geometry::ViewInformation2D& aViewInformation) const; @@ -273,10 +280,12 @@ namespace drawinglayer SdrStretchTextPrimitive2D( const SdrText* pSdrText, const OutlinerParaObject& rOutlinerParaObjectPtr, - const basegfx::B2DHomMatrix& rTextRangeTransform); + const basegfx::B2DHomMatrix& rTextRangeTransform, + bool bFixedCellHeight); // get data const basegfx::B2DHomMatrix& getTextRangeTransform() const { return maTextRangeTransform; } + bool isFixedCellHeight() const { return mbFixedCellHeight; } // compare operator virtual bool operator==(const BasePrimitive2D& rPrimitive) const; diff --git a/svx/inc/svx/svdhdl.hxx b/svx/inc/svx/svdhdl.hxx index 11d400b85b8a..4960323feeb7 100644 --- a/svx/inc/svx/svdhdl.hxx +++ b/svx/inc/svx/svdhdl.hxx @@ -58,7 +58,6 @@ class SdrHdlList; class SdrMarkView; class SdrObject; class SdrPageView; -class SdrHdlBitmapSet; //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -155,12 +154,6 @@ class SVX_DLLPUBLIC SdrHdl friend class SdrMarkView; // fuer den Zugriff auf nObjHdlNum friend class SdrHdlList; - static SdrHdlBitmapSet* pSimpleSet; - static SdrHdlBitmapSet* pModernSet; - - // #101928# - static SdrHdlBitmapSet* pHighContrastSet; - // #101928# BitmapEx ImpGetBitmapEx(BitmapMarkerKind eKindOfMarker, sal_uInt16 nInd, sal_Bool bFine, sal_Bool bIsHighContrast); diff --git a/svx/inc/svx/svdotext.hxx b/svx/inc/svx/svdotext.hxx index 5298fc2dd79b..6ffa4ab5bd22 100644 --- a/svx/inc/svx/svdotext.hxx +++ b/svx/inc/svx/svdotext.hxx @@ -575,20 +575,19 @@ public: public: ////////////////////////////////////////////////////////////////////////////// // text primitive decomposition helpers - bool impCheckSpellCheckForDecomposeTextPrimitive() const; - bool impDecomposeContourTextPrimitive( + void impDecomposeContourTextPrimitive( drawinglayer::primitive2d::Primitive2DSequence& rTarget, const drawinglayer::primitive2d::SdrContourTextPrimitive2D& rSdrContourTextPrimitive, const drawinglayer::geometry::ViewInformation2D& aViewInformation) const; - bool impDecomposePathTextPrimitive( + void impDecomposePathTextPrimitive( drawinglayer::primitive2d::Primitive2DSequence& rTarget, const drawinglayer::primitive2d::SdrPathTextPrimitive2D& rSdrPathTextPrimitive, const drawinglayer::geometry::ViewInformation2D& aViewInformation) const; - bool impDecomposeBlockTextPrimitive( + void impDecomposeBlockTextPrimitive( drawinglayer::primitive2d::Primitive2DSequence& rTarget, const drawinglayer::primitive2d::SdrBlockTextPrimitive2D& rSdrBlockTextPrimitive, const drawinglayer::geometry::ViewInformation2D& aViewInformation) const; - bool impDecomposeStretchTextPrimitive( + void impDecomposeStretchTextPrimitive( drawinglayer::primitive2d::Primitive2DSequence& rTarget, const drawinglayer::primitive2d::SdrStretchTextPrimitive2D& rSdrStretchTextPrimitive, const drawinglayer::geometry::ViewInformation2D& aViewInformation) const; diff --git a/svx/source/sdr/attribute/sdrtextattribute.cxx b/svx/source/sdr/attribute/sdrtextattribute.cxx index 33c958fa6268..ae6204d15bef 100644 --- a/svx/source/sdr/attribute/sdrtextattribute.cxx +++ b/svx/source/sdr/attribute/sdrtextattribute.cxx @@ -57,12 +57,15 @@ namespace drawinglayer sal_Int32 aTextUpperDistance, sal_Int32 aTextRightDistance, sal_Int32 aTextLowerDistance, + SdrTextHorzAdjust aSdrTextHorzAdjust, + SdrTextVertAdjust aSdrTextVertAdjust, bool bContour, bool bFitToSize, bool bHideContour, bool bBlink, bool bScroll, - bool bInEditMode) + bool bInEditMode, + bool bFixedCellHeight) : mpSdrText(&rSdrText), maOutlinerParaObject(rOutlinerParaObject), mpSdrFormTextAttribute(0), @@ -71,12 +74,15 @@ namespace drawinglayer maTextRightDistance(aTextRightDistance), maTextLowerDistance(aTextLowerDistance), maPropertiesVersion(0), + maSdrTextHorzAdjust(aSdrTextHorzAdjust), + maSdrTextVertAdjust(aSdrTextVertAdjust), mbContour(bContour), mbFitToSize(bFitToSize), mbHideContour(bHideContour), mbBlink(bBlink), mbScroll(bScroll), - mbInEditMode(bInEditMode) + mbInEditMode(bInEditMode), + mbFixedCellHeight(bFixedCellHeight) { if(XFT_NONE != eFormTextStyle) { @@ -108,12 +114,16 @@ namespace drawinglayer maTextUpperDistance(rCandidate.getTextUpperDistance()), maTextRightDistance(rCandidate.getTextRightDistance()), maTextLowerDistance(rCandidate.getTextLowerDistance()), + maPropertiesVersion(rCandidate.getPropertiesVersion()), + maSdrTextHorzAdjust(rCandidate.getSdrTextHorzAdjust()), + maSdrTextVertAdjust(rCandidate.getSdrTextVertAdjust()), mbContour(rCandidate.isContour()), mbFitToSize(rCandidate.isFitToSize()), mbHideContour(rCandidate.isHideContour()), mbBlink(rCandidate.isBlink()), mbScroll(rCandidate.isScroll()), - mbInEditMode(rCandidate.isInEditMode()) + mbInEditMode(rCandidate.isInEditMode()), + mbFixedCellHeight(rCandidate.isFixedCellHeight()) { if(rCandidate.getSdrFormTextAttribute()) { @@ -142,36 +152,52 @@ namespace drawinglayer maTextUpperDistance = rCandidate.getTextUpperDistance(); maTextRightDistance = rCandidate.getTextRightDistance(); maTextLowerDistance = rCandidate.getTextLowerDistance(); + maPropertiesVersion = rCandidate.getPropertiesVersion(); + + maSdrTextHorzAdjust = rCandidate.getSdrTextHorzAdjust(); + maSdrTextVertAdjust = rCandidate.getSdrTextVertAdjust(); + mbContour = rCandidate.isContour(); mbFitToSize = rCandidate.isFitToSize(); mbHideContour = rCandidate.isHideContour(); mbBlink = rCandidate.isBlink(); mbScroll = rCandidate.isScroll(); mbInEditMode = rCandidate.isInEditMode(); + mbFixedCellHeight = rCandidate.isFixedCellHeight(); return *this; } bool SdrTextAttribute::operator==(const SdrTextAttribute& rCandidate) const { - return (getOutlinerParaObject() == rCandidate.getOutlinerParaObject() + return ( + // compares OPO and it's contents, but traditionally not the RedLining + // which is not seen as model, but as temporary information + getOutlinerParaObject() == rCandidate.getOutlinerParaObject() + // #i102062# for primitive visualisation, the WrongList (SpellChecking) // is important, too, so use isWrongListEqual since there is no WrongList // comparison in the regular OutlinerParaObject compare (since it's // not-persistent data) && getOutlinerParaObject().isWrongListEqual(rCandidate.getOutlinerParaObject()) + && pointerOrContentEqual(getSdrFormTextAttribute(), rCandidate.getSdrFormTextAttribute()) && getTextLeftDistance() == rCandidate.getTextLeftDistance() && getTextUpperDistance() == rCandidate.getTextUpperDistance() && getTextRightDistance() == rCandidate.getTextRightDistance() && getTextLowerDistance() == rCandidate.getTextLowerDistance() && getPropertiesVersion() == rCandidate.getPropertiesVersion() + + && getSdrTextHorzAdjust() == rCandidate.getSdrTextHorzAdjust() + && getSdrTextVertAdjust() == rCandidate.getSdrTextVertAdjust() + && isContour() == rCandidate.isContour() && isFitToSize() == rCandidate.isFitToSize() && isHideContour() == rCandidate.isHideContour() && isBlink() == rCandidate.isBlink() && isScroll() == rCandidate.isScroll() - && isInEditMode() == rCandidate.isInEditMode()); + && isInEditMode() == rCandidate.isInEditMode() + && isFixedCellHeight() == rCandidate.isFixedCellHeight()); } void SdrTextAttribute::getBlinkTextTiming(drawinglayer::animation::AnimationEntryList& rAnimList) const diff --git a/svx/source/sdr/contact/viewcontactofgraphic.cxx b/svx/source/sdr/contact/viewcontactofgraphic.cxx index b083a1014299..6a92cb27ff8c 100644 --- a/svx/source/sdr/contact/viewcontactofgraphic.cxx +++ b/svx/source/sdr/contact/viewcontactofgraphic.cxx @@ -305,6 +305,9 @@ namespace sdr pSdrText, *pOPO, aTextRangeTransform, + SDRTEXTHORZADJUST_LEFT, + SDRTEXTVERTADJUST_TOP, + false, false, false, false); diff --git a/svx/source/sdr/overlay/overlaymanagerbuffered.cxx b/svx/source/sdr/overlay/overlaymanagerbuffered.cxx index 2b664e816d42..3fedc40f37cf 100644 --- a/svx/source/sdr/overlay/overlaymanagerbuffered.cxx +++ b/svx/source/sdr/overlay/overlaymanagerbuffered.cxx @@ -39,6 +39,7 @@ #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -255,15 +256,21 @@ namespace sdr maBufferRememberedRangePixel.getMaxX(), maBufferRememberedRangePixel.getMaxY()); aBufferRememberedRangeLogic.transform(getOutputDevice().GetInverseViewTransformation()); + // prepare cursor handling const bool bTargetIsWindow(OUTDEV_WINDOW == rmOutputDevice.GetOutDevType()); - Cursor* pCursor = 0; + bool bCursorWasEnabled(false); - // #i75172# switch off VCL cursor during overlay refresh + // #i80730# switch off VCL cursor during overlay refresh if(bTargetIsWindow) { Window& rWindow = static_cast< Window& >(rmOutputDevice); - pCursor = rWindow.GetCursor(); - rWindow.SetCursor(0); + Cursor* pCursor = rWindow.GetCursor(); + + if(pCursor && pCursor->IsVisible()) + { + pCursor->Hide(); + bCursorWasEnabled = true; + } } if(DoRefreshWithPreRendering()) @@ -363,49 +370,19 @@ namespace sdr OverlayManager::ImpDrawMembers(aBufferRememberedRangeLogic, getOutputDevice()); } - // VCL hack for transparent child windows - // Problem is e.g. a radiobuttion form control in life mode. The used window - // is a transparence vcl childwindow. This flag only allows the parent window to - // paint into the child windows area, but there is no mechanism which takes - // care for a repaint of the child window. A transparent child window is NOT - // a window which always keeps it's content consistent over the parent, but it's - // more like just a paint flag for the parent. - // To get the update, the windows in question are updated manulally here. - if(bTargetIsWindow) + // #i80730# restore visibility of VCL cursor + if(bCursorWasEnabled) { Window& rWindow = static_cast< Window& >(rmOutputDevice); + Cursor* pCursor = rWindow.GetCursor(); - if(rWindow.IsChildTransparentModeEnabled() && rWindow.GetChildCount()) + if(pCursor) { - const Rectangle aRegionRectanglePixel( - maBufferRememberedRangePixel.getMinX(), maBufferRememberedRangePixel.getMinY(), - maBufferRememberedRangePixel.getMaxX(), maBufferRememberedRangePixel.getMaxY()); - - for(sal_uInt16 a(0); a < rWindow.GetChildCount(); a++) - { - Window* pCandidate = rWindow.GetChild(a); - - if(pCandidate && pCandidate->IsPaintTransparent()) - { - const Rectangle aCandidatePosSizePixel(pCandidate->GetPosPixel(), pCandidate->GetSizePixel()); - - if(aCandidatePosSizePixel.IsOver(aRegionRectanglePixel)) - { - pCandidate->Invalidate(INVALIDATE_NOTRANSPARENT|INVALIDATE_CHILDREN); - pCandidate->Update(); - } - } - } + // check if cursor still exists. It may have been deleted from someone + pCursor->Show(); } } - // #i75172# restore VCL cursor - if(bTargetIsWindow) - { - Window& rWindow = static_cast< Window& >(rmOutputDevice); - rWindow.SetCursor(pCursor); - } - // forget remembered Region maBufferRememberedRangePixel.reset(); } diff --git a/svx/source/sdr/primitive2d/sdrattributecreator.cxx b/svx/source/sdr/primitive2d/sdrattributecreator.cxx index 277ee70f82ca..4e57166b4723 100644 --- a/svx/source/sdr/primitive2d/sdrattributecreator.cxx +++ b/svx/source/sdr/primitive2d/sdrattributecreator.cxx @@ -76,6 +76,7 @@ #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -519,7 +520,7 @@ namespace drawinglayer } } - const SdrFitToSizeType eFit = rTextObj.GetFitToSize(); + const SdrFitToSizeType eFit(rTextObj.GetFitToSize()); const SdrTextAniKind eAniKind(rTextObj.GetTextAniKind()); pRetval = new attribute::SdrTextAttribute( @@ -530,12 +531,15 @@ namespace drawinglayer pUpper ? *pUpper : rTextObj.GetTextUpperDistance(), pRight ? *pRight : rTextObj.GetTextRightDistance(), pLower ? *pLower : rTextObj.GetTextLowerDistance(), + rTextObj.GetTextHorizontalAdjust(rSet), + rTextObj.GetTextVerticalAdjust(rSet), ((const SdrTextContourFrameItem&)rSet.Get(SDRATTR_TEXT_CONTOURFRAME)).GetValue(), (SDRTEXTFIT_PROPORTIONAL == eFit || SDRTEXTFIT_ALLLINES == eFit), ((const XFormTextHideFormItem&)rSet.Get(XATTR_FORMTXTHIDEFORM)).GetValue(), SDRTEXTANI_BLINK == eAniKind, SDRTEXTANI_SCROLL == eAniKind || SDRTEXTANI_ALTERNATE == eAniKind || SDRTEXTANI_SLIDE == eAniKind, - bInEditMode); + bInEditMode, + ((const SdrTextFixedCellHeightItem&)rSet.Get(SDRATTR_TEXT_USEFIXEDCELLHEIGHT)).GetValue()); } return pRetval; diff --git a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx index 9666bd2c1ac1..09769a2a013e 100644 --- a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx +++ b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx @@ -282,7 +282,8 @@ namespace drawinglayer pNew = new SdrStretchTextPrimitive2D( &rText.getSdrText(), rText.getOutlinerParaObject(), - aAnchorTransform); + aAnchorTransform, + rText.isFixedCellHeight()); } else // text in range { @@ -291,6 +292,9 @@ namespace drawinglayer &rText.getSdrText(), rText.getOutlinerParaObject(), aAnchorTransform, + rText.getSdrTextHorzAdjust(), + rText.getSdrTextVertAdjust(), + rText.isFixedCellHeight(), rText.isScroll(), bCellText, bWordWrap); diff --git a/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx index f515b9b6a5e9..94e59f79c3de 100644 --- a/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx @@ -129,8 +129,11 @@ namespace drawinglayer &pTextAttribute->getSdrText(), pTextAttribute->getOutlinerParaObject(), aTextMatrix, + SDRTEXTHORZADJUST_CENTER, + SDRTEXTVERTADJUST_CENTER, pTextAttribute->isScroll(), false, + false, false); aTextRange = pBlockText->getB2DRange(aViewInformation); } diff --git a/svx/source/sdr/primitive2d/sdrprimitivetools.cxx b/svx/source/sdr/primitive2d/sdrprimitivetools.cxx index 6c665cbef4c9..25b39ebb07d5 100644 --- a/svx/source/sdr/primitive2d/sdrprimitivetools.cxx +++ b/svx/source/sdr/primitive2d/sdrprimitivetools.cxx @@ -37,6 +37,7 @@ #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// // helper methods @@ -47,11 +48,11 @@ namespace drawinglayer { BitmapEx createDefaultCross_3x3(const basegfx::BColor& rBColor) { - static BitmapEx* pRetVal = NULL; + static vcl::DeleteOnDeinit< BitmapEx > aRetVal(0); static basegfx::BColor aColor; ::osl::Mutex m_mutex; - if(pRetVal == NULL || rBColor != aColor) + if(!aRetVal.get() || rBColor != aColor) { // copy values aColor = rBColor; @@ -81,23 +82,21 @@ namespace drawinglayer aContent.ReleaseAccess(pWContent); aMask.ReleaseAccess(pWMask); - if( pRetVal ) - delete pRetVal; - - pRetVal = new BitmapEx(aContent, aMask); + // create and exchange at aRetVal + delete aRetVal.set(new BitmapEx(aContent, aMask)); } - return *pRetVal; + return aRetVal.get() ? *aRetVal.get() : BitmapEx(); } BitmapEx createDefaultGluepoint_7x7(const basegfx::BColor& rBColorA, const basegfx::BColor& rBColorB) { - static BitmapEx* pRetVal = NULL; + static vcl::DeleteOnDeinit< BitmapEx > aRetVal(0); static basegfx::BColor aColorA; static basegfx::BColor aColorB; ::osl::Mutex m_mutex; - if(pRetVal == NULL || rBColorA != aColorA || rBColorB != aColorB) + if(!aRetVal.get() || rBColorA != aColorA || rBColorB != aColorB) { // copy values aColorA = rBColorA; @@ -171,13 +170,11 @@ namespace drawinglayer aContent.ReleaseAccess(pWContent); aMask.ReleaseAccess(pWMask); - if( pRetVal ) - delete pRetVal; - - pRetVal = new BitmapEx(aContent, aMask); + // create and exchange at aRetVal + delete aRetVal.set(new BitmapEx(aContent, aMask)); } - return *pRetVal; + return aRetVal.get() ? *aRetVal.get() : BitmapEx(); } // #i99123# diff --git a/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx index 0cad266f69d1..748270c36977 100644 --- a/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx @@ -116,7 +116,6 @@ namespace drawinglayer mnLastPageNumber(0), mnLastPageCount(0), maLastTextBackgroundColor(), - mbLastSpellCheck(false), mbContainsPageField(false), mbContainsPageCountField(false), mbContainsOtherFields(false) @@ -137,7 +136,13 @@ namespace drawinglayer { const SdrTextPrimitive2D& rCompare = (SdrTextPrimitive2D&)rPrimitive; - return (getOutlinerParaObject() == rCompare.getOutlinerParaObject()); + return ( + + // compare OPO and content, but not WrongList + getOutlinerParaObject() == rCompare.getOutlinerParaObject() + + // also compare WrongList (not-persistent data, but visualized) + && getOutlinerParaObject().isWrongListEqual(rCompare.getOutlinerParaObject())); } return false; @@ -145,9 +150,6 @@ namespace drawinglayer Primitive2DSequence SdrTextPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const { - const bool bCurrentSpellCheck(getSdrText() - ? getSdrText()->GetObject().impCheckSpellCheckForDecomposeTextPrimitive() - : false); uno::Reference< drawing::XDrawPage > xCurrentlyVisualizingPage; bool bCurrentlyVisualizingPageIsSet(false); Color aNewTextBackgroundColor; @@ -157,10 +159,10 @@ namespace drawinglayer if(getLocalDecomposition().hasElements()) { - bool bDoDelete(getLastSpellCheck() != bCurrentSpellCheck); + bool bDoDelete(false); // check visualized page - if(!bDoDelete && (mbContainsPageField || mbContainsPageCountField || mbContainsOtherFields)) + if(mbContainsPageField || mbContainsPageCountField || mbContainsOtherFields) { // get visualized page and remember xCurrentlyVisualizingPage = rViewInformation.getVisualizedPage(); @@ -236,7 +238,6 @@ namespace drawinglayer aNewTextBackgroundColor = rDrawOutliner.GetBackgroundColor(); } - const_cast< SdrTextPrimitive2D* >(this)->setLastSpellCheck(bCurrentSpellCheck); const_cast< SdrTextPrimitive2D* >(this)->mxLastVisualizingPage = xCurrentlyVisualizingPage; const_cast< SdrTextPrimitive2D* >(this)->mnLastPageNumber = nCurrentlyValidPageNumber; const_cast< SdrTextPrimitive2D* >(this)->mnLastPageCount = nCurrentlyValidPageCount; @@ -258,15 +259,7 @@ namespace drawinglayer Primitive2DSequence SdrContourTextPrimitive2D::createLocalDecomposition(const geometry::ViewInformation2D& aViewInformation) const { Primitive2DSequence aRetval; - const bool bCurrentSpellCheck(getSdrText() - ? getSdrText()->GetObject().impDecomposeContourTextPrimitive(aRetval, *this, aViewInformation) - : false); - - if(getLastSpellCheck() != bCurrentSpellCheck) - { - // remember last spell check state; this is part of the decomposition source data definition - const_cast< SdrContourTextPrimitive2D* >(this)->setLastSpellCheck(bCurrentSpellCheck); - } + getSdrText()->GetObject().impDecomposeContourTextPrimitive(aRetval, *this, aViewInformation); return encapsulateWithTextHierarchyBlockPrimitive2D(aRetval); } @@ -319,15 +312,7 @@ namespace drawinglayer Primitive2DSequence SdrPathTextPrimitive2D::createLocalDecomposition(const geometry::ViewInformation2D& aViewInformation) const { Primitive2DSequence aRetval; - const bool bCurrentSpellCheck(getSdrText() - ? getSdrText()->GetObject().impDecomposePathTextPrimitive(aRetval, *this, aViewInformation) - : false); - - if(getLastSpellCheck() != bCurrentSpellCheck) - { - // remember last spell check state; this is part of the decomposition source data definition - const_cast< SdrPathTextPrimitive2D* >(this)->setLastSpellCheck(bCurrentSpellCheck); - } + getSdrText()->GetObject().impDecomposePathTextPrimitive(aRetval, *this, aViewInformation); return encapsulateWithTextHierarchyBlockPrimitive2D(aRetval); } @@ -383,15 +368,7 @@ namespace drawinglayer Primitive2DSequence SdrBlockTextPrimitive2D::createLocalDecomposition(const geometry::ViewInformation2D& aViewInformation) const { Primitive2DSequence aRetval; - const bool bCurrentSpellCheck(getSdrText() - ? getSdrText()->GetObject().impDecomposeBlockTextPrimitive(aRetval, *this, aViewInformation) - : false); - - if(getLastSpellCheck() != bCurrentSpellCheck) - { - // remember last spell check state; this is part of the decomposition source data definition - const_cast< SdrBlockTextPrimitive2D* >(this)->setLastSpellCheck(bCurrentSpellCheck); - } + getSdrText()->GetObject().impDecomposeBlockTextPrimitive(aRetval, *this, aViewInformation); return encapsulateWithTextHierarchyBlockPrimitive2D(aRetval); } @@ -400,11 +377,17 @@ namespace drawinglayer const SdrText* pSdrText, const OutlinerParaObject& rOutlinerParaObject, const basegfx::B2DHomMatrix& rTextRangeTransform, + SdrTextHorzAdjust aSdrTextHorzAdjust, + SdrTextVertAdjust aSdrTextVertAdjust, + bool bFixedCellHeight, bool bUnlimitedPage, bool bCellText, bool bWordWrap) : SdrTextPrimitive2D(pSdrText, rOutlinerParaObject), maTextRangeTransform(rTextRangeTransform), + maSdrTextHorzAdjust(aSdrTextHorzAdjust), + maSdrTextVertAdjust(aSdrTextVertAdjust), + mbFixedCellHeight(bFixedCellHeight), mbUnlimitedPage(bUnlimitedPage), mbCellText(bCellText), mbWordWrap(bWordWrap) @@ -418,6 +401,9 @@ namespace drawinglayer const SdrBlockTextPrimitive2D& rCompare = (SdrBlockTextPrimitive2D&)rPrimitive; return (getTextRangeTransform() == rCompare.getTextRangeTransform() + && getSdrTextHorzAdjust() == rCompare.getSdrTextHorzAdjust() + && getSdrTextVertAdjust() == rCompare.getSdrTextVertAdjust() + && isFixedCellHeight() == rCompare.isFixedCellHeight() && getUnlimitedPage() == rCompare.getUnlimitedPage() && getCellText() == rCompare.getCellText() && getWordWrap() == rCompare.getWordWrap()); @@ -432,6 +418,9 @@ namespace drawinglayer getSdrText(), getOutlinerParaObject(), rTransform * getTextRangeTransform(), + getSdrTextHorzAdjust(), + getSdrTextVertAdjust(), + isFixedCellHeight(), getUnlimitedPage(), getCellText(), getWordWrap()); @@ -452,15 +441,7 @@ namespace drawinglayer Primitive2DSequence SdrStretchTextPrimitive2D::createLocalDecomposition(const geometry::ViewInformation2D& aViewInformation) const { Primitive2DSequence aRetval; - const bool bCurrentSpellCheck(getSdrText() - ? getSdrText()->GetObject().impDecomposeStretchTextPrimitive(aRetval, *this, aViewInformation) - : false); - - if(getLastSpellCheck() != bCurrentSpellCheck) - { - // remember last spell check state; this is part of the decomposition source data definition - const_cast< SdrStretchTextPrimitive2D* >(this)->setLastSpellCheck(bCurrentSpellCheck); - } + getSdrText()->GetObject().impDecomposeStretchTextPrimitive(aRetval, *this, aViewInformation); return encapsulateWithTextHierarchyBlockPrimitive2D(aRetval); } @@ -468,9 +449,11 @@ namespace drawinglayer SdrStretchTextPrimitive2D::SdrStretchTextPrimitive2D( const SdrText* pSdrText, const OutlinerParaObject& rOutlinerParaObject, - const basegfx::B2DHomMatrix& rTextRangeTransform) + const basegfx::B2DHomMatrix& rTextRangeTransform, + bool bFixedCellHeight) : SdrTextPrimitive2D(pSdrText, rOutlinerParaObject), - maTextRangeTransform(rTextRangeTransform) + maTextRangeTransform(rTextRangeTransform), + mbFixedCellHeight(bFixedCellHeight) { } @@ -480,7 +463,8 @@ namespace drawinglayer { const SdrStretchTextPrimitive2D& rCompare = (SdrStretchTextPrimitive2D&)rPrimitive; - return (getTextRangeTransform() == rCompare.getTextRangeTransform()); + return (getTextRangeTransform() == rCompare.getTextRangeTransform() + && isFixedCellHeight() == rCompare.isFixedCellHeight()); } return false; @@ -491,7 +475,8 @@ namespace drawinglayer return new SdrStretchTextPrimitive2D( getSdrText(), getOutlinerParaObject(), - rTransform * getTextRangeTransform()); + rTransform * getTextRangeTransform(), + isFixedCellHeight()); } // provide unique ID diff --git a/svx/source/svdraw/svdcrtv.cxx b/svx/source/svdraw/svdcrtv.cxx index 341ce6dd90c0..6773b8edf6f5 100644 --- a/svx/source/svdraw/svdcrtv.cxx +++ b/svx/source/svdraw/svdcrtv.cxx @@ -831,7 +831,11 @@ void SdrCreateView::ShowCreateObj(/*OutputDevice* pOut, BOOL bFull*/) if(pCircObj && OBJ_CIRC != pCircObj->GetObjIdentifier()) { - bUseSolidDragging = false; + // #i103058# Allow SolidDragging with four points + if(aDragStat.GetPointAnz() < 4) + { + bUseSolidDragging = false; + } } } diff --git a/svx/source/svdraw/svddrgmt.cxx b/svx/source/svdraw/svddrgmt.cxx index e427e42d80ab..eb6412b20259 100644 --- a/svx/source/svdraw/svddrgmt.cxx +++ b/svx/source/svdraw/svddrgmt.cxx @@ -1135,11 +1135,20 @@ void SdrDragObjOwn::createSdrDragEntries() void SdrDragObjOwn::TakeSdrDragComment(XubString& rStr) const { - const SdrObject* pObj = GetDragObj(); - - if(pObj) + // #i103058# get info string from the clone preferred, the original will + // not be changed. For security, use original as fallback + if(mpClone) { - rStr = pObj->getSpecialDragComment(DragStat()); + rStr = mpClone->getSpecialDragComment(DragStat()); + } + else + { + const SdrObject* pObj = GetDragObj(); + + if(pObj) + { + rStr = pObj->getSpecialDragComment(DragStat()); + } } } diff --git a/svx/source/svdraw/svdhdl.cxx b/svx/source/svdraw/svdhdl.cxx index 727e7f0bafcc..936c073f6e84 100644 --- a/svx/source/svdraw/svdhdl.cxx +++ b/svx/source/svdraw/svdhdl.cxx @@ -68,6 +68,7 @@ #include #include #include +#include //////////////////////////////////////////////////////////////////////////////////////////////////// // #i15222# @@ -275,9 +276,23 @@ const BitmapEx& SdrHdlBitmapSet::GetBitmapEx(BitmapMarkerKind eKindOfMarker, UIN //////////////////////////////////////////////////////////////////////////////////////////////////// -SdrHdlBitmapSet* SdrHdl::pSimpleSet = NULL; -SdrHdlBitmapSet* SdrHdl::pModernSet = NULL; -SdrHdlBitmapSet* SdrHdl::pHighContrastSet = NULL; +SdrHdlBitmapSet& getSimpleSet() +{ + static vcl::DeleteOnDeinit< SdrHdlBitmapSet > aSimpleSet(new SdrHdlBitmapSet(SIP_SA_MARKERS)); + return *aSimpleSet.get(); +} + +SdrHdlBitmapSet& getModernSet() +{ + static vcl::DeleteOnDeinit< SdrHdlBitmapSet > aModernSet(new SdrHdlBitmapSet(SIP_SA_MARKERS)); + return *aModernSet.get(); +} + +SdrHdlBitmapSet& getHighContrastSet() +{ + static vcl::DeleteOnDeinit< SdrHdlBitmapSet > aHighContrastSet(new SdrHdlBitmapSet(SIP_SA_MARKERS)); + return *aHighContrastSet.get(); +} //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -296,18 +311,6 @@ SdrHdl::SdrHdl(): bPlusHdl(FALSE), mbMoveOutside(false) { - if(!pSimpleSet) - pSimpleSet = new SdrHdlBitmapSet(SIP_SA_MARKERS); - DBG_ASSERT(pSimpleSet, "Could not construct SdrHdlBitmapSet()!"); - - if(!pModernSet) - pModernSet = new SdrHdlBitmapSet(SIP_SA_FINE_MARKERS); - DBG_ASSERT(pModernSet, "Could not construct SdrHdlBitmapSet()!"); - - // #101928# - if(!pHighContrastSet) - pHighContrastSet = new SdrHdlBitmapSet(SIP_SA_ACCESSIBILITY_MARKERS); - DBG_ASSERT(pHighContrastSet, "Could not construct SdrHdlBitmapSet()!"); } SdrHdl::SdrHdl(const Point& rPnt, SdrHdlKind eNewKind): @@ -326,18 +329,6 @@ SdrHdl::SdrHdl(const Point& rPnt, SdrHdlKind eNewKind): bPlusHdl(FALSE), mbMoveOutside(false) { - if(!pSimpleSet) - pSimpleSet = new SdrHdlBitmapSet(SIP_SA_MARKERS); - DBG_ASSERT(pSimpleSet, "Could not construct SdrHdlBitmapSet()!"); - - if(!pModernSet) - pModernSet = new SdrHdlBitmapSet(SIP_SA_FINE_MARKERS); - DBG_ASSERT(pModernSet, "Could not construct SdrHdlBitmapSet()!"); - - // #101928# - if(!pHighContrastSet) - pHighContrastSet = new SdrHdlBitmapSet(SIP_SA_ACCESSIBILITY_MARKERS); - DBG_ASSERT(pHighContrastSet, "Could not construct SdrHdlBitmapSet()!"); } SdrHdl::~SdrHdl() @@ -670,17 +661,17 @@ BitmapEx SdrHdl::ImpGetBitmapEx(BitmapMarkerKind eKindOfMarker, sal_uInt16 nInd, { if(bIsHighContrast) { - return pHighContrastSet->GetBitmapEx(eKindOfMarker, nInd); + return getHighContrastSet().GetBitmapEx(eKindOfMarker, nInd); } else { if(bFine) { - return pModernSet->GetBitmapEx(eKindOfMarker, nInd); + return getModernSet().GetBitmapEx(eKindOfMarker, nInd); } else { - return pSimpleSet->GetBitmapEx(eKindOfMarker, nInd); + return getSimpleSet().GetBitmapEx(eKindOfMarker, nInd); } } } diff --git a/svx/source/svdraw/svdocapt.cxx b/svx/source/svdraw/svdocapt.cxx index 7d41191c99a9..102b5b1eb824 100644 --- a/svx/source/svdraw/svdocapt.cxx +++ b/svx/source/svdraw/svdocapt.cxx @@ -401,26 +401,35 @@ bool SdrCaptionObj::applySpecialDrag(SdrDragStat& rDrag) String SdrCaptionObj::getSpecialDragComment(const SdrDragStat& rDrag) const { - const SdrHdl* pHdl = rDrag.GetHdl(); + const bool bCreateComment(rDrag.GetView() && this == rDrag.GetView()->GetCreateObj()); - if(pHdl && 0 == pHdl->GetPolyNum()) + if(bCreateComment) { - return SdrRectObj::getSpecialDragComment(rDrag); + return String(); } else { - XubString aStr; + const SdrHdl* pHdl = rDrag.GetHdl(); - if(!pHdl) + if(pHdl && 0 == pHdl->GetPolyNum()) { - ImpTakeDescriptionStr(STR_DragCaptFram, aStr); + return SdrRectObj::getSpecialDragComment(rDrag); } else { - ImpTakeDescriptionStr(STR_DragCaptTail, aStr); - } + XubString aStr; + + if(!pHdl) + { + ImpTakeDescriptionStr(STR_DragCaptFram, aStr); + } + else + { + ImpTakeDescriptionStr(STR_DragCaptTail, aStr); + } - return aStr; + return aStr; + } } } diff --git a/svx/source/svdraw/svdocirc.cxx b/svx/source/svdraw/svdocirc.cxx index 6af31224ee45..b3175566d561 100644 --- a/svx/source/svdraw/svdocirc.cxx +++ b/svx/source/svdraw/svdocirc.cxx @@ -589,23 +589,56 @@ bool SdrCircObj::applySpecialDrag(SdrDragStat& rDrag) String SdrCircObj::getSpecialDragComment(const SdrDragStat& rDrag) const { - const bool bWink(rDrag.GetHdl() && HDL_CIRC == rDrag.GetHdl()->GetKind()); + const bool bCreateComment(rDrag.GetView() && this == rDrag.GetView()->GetCreateObj()); - if(bWink) + if(bCreateComment) { XubString aStr; - const sal_Int32 nWink(1 == rDrag.GetHdl()->GetPointNum() ? nStartWink : nEndWink); + ImpTakeDescriptionStr(STR_ViewCreateObj, aStr); + const sal_uInt32 nPntAnz(rDrag.GetPointAnz()); + + if(OBJ_CIRC != meCircleKind && nPntAnz > 2) + { + ImpCircUser* pU = (ImpCircUser*)rDrag.GetUser(); + sal_Int32 nWink; + + aStr.AppendAscii(" ("); + + if(3 == nPntAnz) + { + nWink = pU->nStart; + } + else + { + nWink = pU->nEnd; + } - ImpTakeDescriptionStr(STR_DragCircAngle, aStr); - aStr.AppendAscii(" ("); - aStr += GetWinkStr(nWink,FALSE); - aStr += sal_Unicode(')'); + aStr += GetWinkStr(nWink,FALSE); + aStr += sal_Unicode(')'); + } return aStr; } else { - return SdrTextObj::getSpecialDragComment(rDrag); + const bool bWink(rDrag.GetHdl() && HDL_CIRC == rDrag.GetHdl()->GetKind()); + + if(bWink) + { + XubString aStr; + const sal_Int32 nWink(1 == rDrag.GetHdl()->GetPointNum() ? nStartWink : nEndWink); + + ImpTakeDescriptionStr(STR_DragCircAngle, aStr); + aStr.AppendAscii(" ("); + aStr += GetWinkStr(nWink,FALSE); + aStr += sal_Unicode(')'); + + return aStr; + } + else + { + return SdrTextObj::getSpecialDragComment(rDrag); + } } } @@ -698,6 +731,14 @@ FASTBOOL SdrCircObj::MovCreate(SdrDragStat& rStat) SetBoundRectDirty(); bSnapRectDirty=TRUE; SetXPolyDirty(); + + // #i103058# push current angle settings to ItemSet to + // allow FullDrag visualisation + if(rStat.GetPointAnz() >= 4) + { + ImpSetCircInfoToAttr(); + } + return TRUE; } diff --git a/svx/source/svdraw/svdoedge.cxx b/svx/source/svdraw/svdoedge.cxx index abadbf094981..e55eeaae42b7 100644 --- a/svx/source/svdraw/svdoedge.cxx +++ b/svx/source/svdraw/svdoedge.cxx @@ -1920,11 +1920,21 @@ bool SdrEdgeObj::applySpecialDrag(SdrDragStat& rDragStat) return true; } -String SdrEdgeObj::getSpecialDragComment(const SdrDragStat& /*rDrag*/) const +String SdrEdgeObj::getSpecialDragComment(const SdrDragStat& rDrag) const { - XubString aStr; - ImpTakeDescriptionStr(STR_DragEdgeTail,aStr); - return aStr; + const bool bCreateComment(rDrag.GetView() && this == rDrag.GetView()->GetCreateObj()); + + if(bCreateComment) + { + return String(); + } + else + { + XubString aStr; + ImpTakeDescriptionStr(STR_DragEdgeTail, aStr); + + return aStr; + } } //////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/svx/source/svdraw/svdopath.cxx b/svx/source/svdraw/svdopath.cxx index 1e9c9b57c52d..f44efe3c5dfa 100644 --- a/svx/source/svdraw/svdopath.cxx +++ b/svx/source/svdraw/svdopath.cxx @@ -951,32 +951,86 @@ bool ImpPathForDragAndCreate::endPathDrag(SdrDragStat& rDrag) String ImpPathForDragAndCreate::getSpecialDragComment(const SdrDragStat& rDrag) const { - ImpSdrPathDragData* pDragData = mpSdrPathDragData; + XubString aStr; + const SdrHdl* pHdl = rDrag.GetHdl(); + const bool bCreateComment(rDrag.GetView() && &mrSdrPathObject == rDrag.GetView()->GetCreateObj()); - if(!pDragData) + if(bCreateComment && rDrag.GetUser()) { - // getSpecialDragComment is also used from create, so fallback to GetUser() - // when mpSdrPathDragData is not set - pDragData = (ImpSdrPathDragData*)rDrag.GetUser(); - } + // #i103058# re-add old creation comment mode + ImpPathCreateUser* pU = (ImpPathCreateUser*)rDrag.GetUser(); + const SdrObjKind eKindMerk(meObjectKind); + mrSdrPathObject.meKind = pU->eAktKind; + mrSdrPathObject.ImpTakeDescriptionStr(STR_ViewCreateObj, aStr); + mrSdrPathObject.meKind = eKindMerk; - if(!pDragData) - { - DBG_ERROR("ImpPathForDragAndCreate::MovDrag(): ImpSdrPathDragData ist ungueltig"); - return String(); - } + Point aPrev(rDrag.GetPrev()); + Point aNow(rDrag.GetNow()); - // Hier auch mal pDragData verwenden !!! - XubString aStr; + if(pU->bLine) + aNow = pU->aLineEnd; - const SdrHdl* pHdl = rDrag.GetHdl(); + aNow -= aPrev; + aStr.AppendAscii(" ("); - if(!mrSdrPathObject.GetModel() || !pHdl) + XubString aMetr; + + if(pU->bCircle) + { + mrSdrPathObject.GetModel()->TakeWinkStr(Abs(pU->nCircRelWink), aMetr); + aStr += aMetr; + aStr.AppendAscii(" r="); + mrSdrPathObject.GetModel()->TakeMetricStr(pU->nCircRadius, aMetr, TRUE); + aStr += aMetr; + } + + aStr.AppendAscii("dx="); + mrSdrPathObject.GetModel()->TakeMetricStr(aNow.X(), aMetr, TRUE); + aStr += aMetr; + + aStr.AppendAscii(" dy="); + mrSdrPathObject.GetModel()->TakeMetricStr(aNow.Y(), aMetr, TRUE); + aStr += aMetr; + + if(!IsFreeHand(meObjectKind)) + { + INT32 nLen(GetLen(aNow)); + aStr.AppendAscii(" l="); + mrSdrPathObject.GetModel()->TakeMetricStr(nLen, aMetr, TRUE); + aStr += aMetr; + + INT32 nWink(GetAngle(aNow)); + aStr += sal_Unicode(' '); + mrSdrPathObject.GetModel()->TakeWinkStr(nWink, aMetr); + aStr += aMetr; + } + + aStr += sal_Unicode(')'); + } + else if(!mrSdrPathObject.GetModel() || !pHdl) { + // #i103058# fallback when no model and/or Handle, both needed + // for else-path mrSdrPathObject.ImpTakeDescriptionStr(STR_DragPathObj, aStr); } else { + // #i103058# standard for modification; model and handle needed + ImpSdrPathDragData* pDragData = mpSdrPathDragData; + + if(!pDragData) + { + // getSpecialDragComment is also used from create, so fallback to GetUser() + // when mpSdrPathDragData is not set + pDragData = (ImpSdrPathDragData*)rDrag.GetUser(); + } + + if(!pDragData) + { + DBG_ERROR("ImpPathForDragAndCreate::MovDrag(): ImpSdrPathDragData ist ungueltig"); + return String(); + } + if(!pDragData->IsMultiPointDrag() && pDragData->bEliminate) { // Punkt von ... @@ -2150,12 +2204,26 @@ bool SdrPathObj::applySpecialDrag(SdrDragStat& rDrag) String SdrPathObj::getSpecialDragComment(const SdrDragStat& rDrag) const { String aRetval; - ImpPathForDragAndCreate aDragAndCreate(*((SdrPathObj*)this)); - bool bDidWork(aDragAndCreate.beginPathDrag((SdrDragStat&)rDrag)); - if(bDidWork) + if(mpDAC) { - aRetval = aDragAndCreate.getSpecialDragComment(rDrag); + // #i103058# also get a comment when in creation + const bool bCreateComment(rDrag.GetView() && this == rDrag.GetView()->GetCreateObj()); + + if(bCreateComment) + { + aRetval = mpDAC->getSpecialDragComment(rDrag); + } + } + else + { + ImpPathForDragAndCreate aDragAndCreate(*((SdrPathObj*)this)); + bool bDidWork(aDragAndCreate.beginPathDrag((SdrDragStat&)rDrag)); + + if(bDidWork) + { + aRetval = aDragAndCreate.getSpecialDragComment(rDrag); + } } return aRetval; diff --git a/svx/source/svdraw/svdorect.cxx b/svx/source/svdraw/svdorect.cxx index 837b75bcf849..7d69955ec441 100644 --- a/svx/source/svdraw/svdorect.cxx +++ b/svx/source/svdraw/svdorect.cxx @@ -419,33 +419,42 @@ bool SdrRectObj::applySpecialDrag(SdrDragStat& rDrag) String SdrRectObj::getSpecialDragComment(const SdrDragStat& rDrag) const { - const bool bRad(rDrag.GetHdl() && HDL_CIRC == rDrag.GetHdl()->GetKind()); + const bool bCreateComment(rDrag.GetView() && this == rDrag.GetView()->GetCreateObj()); - if(bRad) + if(bCreateComment) { - Point aPt(rDrag.GetNow()); + return String(); + } + else + { + const bool bRad(rDrag.GetHdl() && HDL_CIRC == rDrag.GetHdl()->GetKind()); - // -sin fuer Umkehrung - if(aGeo.nDrehWink) - RotatePoint(aPt, aRect.TopLeft(), -aGeo.nSin, aGeo.nCos); + if(bRad) + { + Point aPt(rDrag.GetNow()); - sal_Int32 nRad(aPt.X() - aRect.Left()); + // -sin fuer Umkehrung + if(aGeo.nDrehWink) + RotatePoint(aPt, aRect.TopLeft(), -aGeo.nSin, aGeo.nCos); - if(nRad < 0) - nRad = 0; + sal_Int32 nRad(aPt.X() - aRect.Left()); - XubString aStr; + if(nRad < 0) + nRad = 0; - ImpTakeDescriptionStr(STR_DragRectEckRad, aStr); - aStr.AppendAscii(" ("); - aStr += GetMetrStr(nRad); - aStr += sal_Unicode(')'); + XubString aStr; - return aStr; - } - else - { - return SdrTextObj::getSpecialDragComment(rDrag); + ImpTakeDescriptionStr(STR_DragRectEckRad, aStr); + aStr.AppendAscii(" ("); + aStr += GetMetrStr(nRad); + aStr += sal_Unicode(')'); + + return aStr; + } + else + { + return SdrTextObj::getSpecialDragComment(rDrag); + } } } diff --git a/svx/source/svdraw/svdotextdecomposition.cxx b/svx/source/svdraw/svdotextdecomposition.cxx index 8ce4390ad6ac..93d3651e3f01 100644 --- a/svx/source/svdraw/svdotextdecomposition.cxx +++ b/svx/source/svdraw/svdotextdecomposition.cxx @@ -215,30 +215,23 @@ namespace { if(rInfo.mrText.Len() && rInfo.mnTextLen) { - basegfx::B2DVector aSize; - drawinglayer::primitive2d::FontAttributes aFontAttributes(drawinglayer::primitive2d::getFontAttributesFromVclFont( - aSize, - rInfo.mrFont, - rInfo.IsRTL(), - false)); + basegfx::B2DVector aFontScaling; + drawinglayer::primitive2d::FontAttributes aFontAttributes( + drawinglayer::primitive2d::getFontAttributesFromVclFont( + aFontScaling, + rInfo.mrFont, + rInfo.IsRTL(), + false)); basegfx::B2DHomMatrix aNewTransform; - // #i100489# need extra scale factor for DXArray which collects all scalings - // which are needed to get the DXArray to unit coordinates - double fDXArrayScaleFactor(aSize.getX()); - // add font scale to new transform - aNewTransform.scale(aSize.getX(), aSize.getY()); + aNewTransform.scale(aFontScaling.getX(), aFontScaling.getY()); // look for proportional font scaling, evtl scale accordingly if(100 != rInfo.mrFont.GetPropr()) { const double fFactor(rInfo.mrFont.GetPropr() / 100.0); aNewTransform.scale(fFactor, fFactor); - - // #i100489# proportional font scaling influences the DXArray, - // add to factor - fDXArrayScaleFactor *= fFactor; } // apply font rotate @@ -271,7 +264,7 @@ namespace } const double fEscapement(nEsc / -100.0); - aNewTransform.translate(0.0, fEscapement * aSize.getY()); + aNewTransform.translate(0.0, fEscapement * aFontScaling.getY()); } // apply transformA @@ -290,13 +283,11 @@ namespace if(!bDisableTextArray && rInfo.mpDXArray && rInfo.mnTextLen) { - // #i100489# use fDXArrayScaleFactor here - const double fScaleFactor(basegfx::fTools::equalZero(fDXArrayScaleFactor) ? 1.0 : 1.0 / fDXArrayScaleFactor); aDXArray.reserve(rInfo.mnTextLen); for(xub_StrLen a(0); a < rInfo.mnTextLen; a++) { - aDXArray.push_back((double)rInfo.mpDXArray[a] * fScaleFactor); + aDXArray.push_back((double)rInfo.mpDXArray[a]); } } @@ -472,6 +463,17 @@ namespace fEnd = fTextWidth - fEnd; } + // need to take FontScaling out of values; it's already part of + // aNewTransform and would be double applied + const double fFontScaleX(aFontScaling.getX()); + + if(!basegfx::fTools::equal(fFontScaleX, 1.0) + && !basegfx::fTools::equalZero(fFontScaleX)) + { + fStart /= fFontScaleX; + fEnd /= fFontScaleX; + } + maTextPortionPrimitives.push_back(new drawinglayer::primitive2d::WrongSpellPrimitive2D( aNewTransform, fStart, @@ -709,16 +711,7 @@ namespace ////////////////////////////////////////////////////////////////////////////// // primitive decompositions -bool SdrTextObj::impCheckSpellCheckForDecomposeTextPrimitive() const -{ - // #i102062# asked TL who killed this feature (CWS tl56). Obviously, there - // is no more support for EE_CNTRL_NOREDLINES anymore; redlining is always - // on nowadays. Unfortunately, not false, but true should be returned then. - // Trying if this is all... - return true; -} - -bool SdrTextObj::impDecomposeContourTextPrimitive( +void SdrTextObj::impDecomposeContourTextPrimitive( drawinglayer::primitive2d::Primitive2DSequence& rTarget, const drawinglayer::primitive2d::SdrContourTextPrimitive2D& rSdrContourTextPrimitive, const drawinglayer::geometry::ViewInformation2D& aViewInformation) const @@ -770,10 +763,9 @@ bool SdrTextObj::impDecomposeContourTextPrimitive( rOutliner.setVisualizedPage(0); rTarget = aConverter.getPrimitive2DSequence(); - return false; } -bool SdrTextObj::impDecomposeBlockTextPrimitive( +void SdrTextObj::impDecomposeBlockTextPrimitive( drawinglayer::primitive2d::Primitive2DSequence& rTarget, const drawinglayer::primitive2d::SdrBlockTextPrimitive2D& rSdrBlockTextPrimitive, const drawinglayer::geometry::ViewInformation2D& aViewInformation) const @@ -789,19 +781,15 @@ bool SdrTextObj::impDecomposeBlockTextPrimitive( // prepare outliner const bool bIsCell(rSdrBlockTextPrimitive.getCellText()); - const SfxItemSet& rTextItemSet = rSdrBlockTextPrimitive.getSdrText() - ? rSdrBlockTextPrimitive.getSdrText()->GetItemSet() - : GetObjectItemSet(); SdrOutliner& rOutliner = ImpGetDrawOutliner(); - SdrTextVertAdjust eVAdj = GetTextVerticalAdjust(rTextItemSet); - SdrTextHorzAdjust eHAdj = GetTextHorizontalAdjust(rTextItemSet); + SdrTextHorzAdjust eHAdj = rSdrBlockTextPrimitive.getSdrTextHorzAdjust(); + SdrTextVertAdjust eVAdj = rSdrBlockTextPrimitive.getSdrTextVertAdjust(); const sal_uInt32 nOriginalControlWord(rOutliner.GetControlWord()); const Size aNullSize; // set visualizing page at Outliner; needed e.g. for PageNumberField decomposition rOutliner.setVisualizedPage(GetSdrPageFromXDrawPage(aViewInformation.getVisualizedPage())); - - rOutliner.SetFixedCellHeight(((const SdrTextFixedCellHeightItem&)rTextItemSet.Get(SDRATTR_TEXT_USEFIXEDCELLHEIGHT)).GetValue()); + rOutliner.SetFixedCellHeight(rSdrBlockTextPrimitive.isFixedCellHeight()); rOutliner.SetControlWord(nOriginalControlWord|EE_CNTRL_AUTOPAGESIZE); rOutliner.SetMinAutoPaperSize(aNullSize); rOutliner.SetMaxAutoPaperSize(Size(1000000,1000000)); @@ -975,10 +963,9 @@ bool SdrTextObj::impDecomposeBlockTextPrimitive( rOutliner.setVisualizedPage(0); rTarget = aConverter.getPrimitive2DSequence(); - return false; } -bool SdrTextObj::impDecomposeStretchTextPrimitive( +void SdrTextObj::impDecomposeStretchTextPrimitive( drawinglayer::primitive2d::Primitive2DSequence& rTarget, const drawinglayer::primitive2d::SdrStretchTextPrimitive2D& rSdrStretchTextPrimitive, const drawinglayer::geometry::ViewInformation2D& aViewInformation) const @@ -995,13 +982,10 @@ bool SdrTextObj::impDecomposeStretchTextPrimitive( // prepare outliner SdrOutliner& rOutliner = ImpGetDrawOutliner(); const sal_uInt32 nOriginalControlWord(rOutliner.GetControlWord()); - const SfxItemSet& rTextItemSet = rSdrStretchTextPrimitive.getSdrText() - ? rSdrStretchTextPrimitive.getSdrText()->GetItemSet() - : GetObjectItemSet(); const Size aNullSize; rOutliner.SetControlWord(nOriginalControlWord|EE_CNTRL_STRETCHING|EE_CNTRL_AUTOPAGESIZE); - rOutliner.SetFixedCellHeight(((const SdrTextFixedCellHeightItem&)rTextItemSet.Get(SDRATTR_TEXT_USEFIXEDCELLHEIGHT)).GetValue()); + rOutliner.SetFixedCellHeight(rSdrStretchTextPrimitive.isFixedCellHeight()); rOutliner.SetMinAutoPaperSize(aNullSize); rOutliner.SetMaxAutoPaperSize(Size(1000000,1000000)); rOutliner.SetPaperSize(aNullSize); @@ -1059,7 +1043,6 @@ bool SdrTextObj::impDecomposeStretchTextPrimitive( rOutliner.setVisualizedPage(0); rTarget = aConverter.getPrimitive2DSequence(); - return false; } ////////////////////////////////////////////////////////////////////////////// diff --git a/svx/source/svdraw/svdotextpathdecomposition.cxx b/svx/source/svdraw/svdotextpathdecomposition.cxx index f3bdeeb4811c..f6a30d40b3d5 100644 --- a/svx/source/svdraw/svdotextpathdecomposition.cxx +++ b/svx/source/svdraw/svdotextpathdecomposition.cxx @@ -365,12 +365,13 @@ namespace for(sal_uInt32 a(0L); a < rTextPortions.size() && fPolyStart < fPolyEnd; a++) { const impPathTextPortion* pCandidate = rTextPortions[a]; - basegfx::B2DVector aSize; - const drawinglayer::primitive2d::FontAttributes aCandidateFontAttributes(drawinglayer::primitive2d::getFontAttributesFromVclFont( - aSize, - pCandidate->getFont(), - pCandidate->isRTL(), - false)); + basegfx::B2DVector aFontScaling; + const drawinglayer::primitive2d::FontAttributes aCandidateFontAttributes( + drawinglayer::primitive2d::getFontAttributesFromVclFont( + aFontScaling, + pCandidate->getFont(), + pCandidate->isRTL(), + false)); if(pCandidate && pCandidate->getTextLength()) { @@ -397,7 +398,7 @@ namespace basegfx::B2DPoint aEndPos(aStartPos); // add font scaling - aNewTransformA.scale(aSize.getX(), aSize.getY()); + aNewTransformA.scale(aFontScaling.getX(), aFontScaling.getY()); // prepare scaling of text primitive if(XFT_AUTOSIZE == mrSdrFormTextAttribute.getFormTextAdjust()) @@ -512,15 +513,16 @@ namespace pCandidate->getDoubleDXArray().begin() + nPortionIndex, pCandidate->getDoubleDXArray().begin() + nPortionIndex + nNextGlyphLen); - drawinglayer::primitive2d::TextSimplePortionPrimitive2D* pNew = new drawinglayer::primitive2d::TextSimplePortionPrimitive2D( - aNewTransformB * aNewShadowTransform * aNewTransformA, - pCandidate->getText(), - nPortionIndex, - nNextGlyphLen, - aNewDXArray, - aCandidateFontAttributes, - pCandidate->getLocale(), - aRGBShadowColor); + drawinglayer::primitive2d::TextSimplePortionPrimitive2D* pNew = + new drawinglayer::primitive2d::TextSimplePortionPrimitive2D( + aNewTransformB * aNewShadowTransform * aNewTransformA, + pCandidate->getText(), + nPortionIndex, + nNextGlyphLen, + aNewDXArray, + aCandidateFontAttributes, + pCandidate->getLocale(), + aRGBShadowColor); mrShadowDecomposition.push_back(pNew); } @@ -536,15 +538,16 @@ namespace pCandidate->getDoubleDXArray().begin() + nPortionIndex, pCandidate->getDoubleDXArray().begin() + nPortionIndex + nNextGlyphLen); - drawinglayer::primitive2d::TextSimplePortionPrimitive2D* pNew = new drawinglayer::primitive2d::TextSimplePortionPrimitive2D( - aNewTransformB * aNewTransformA, - pCandidate->getText(), - nPortionIndex, - nNextGlyphLen, - aNewDXArray, - aCandidateFontAttributes, - pCandidate->getLocale(), - aRGBColor); + drawinglayer::primitive2d::TextSimplePortionPrimitive2D* pNew = + new drawinglayer::primitive2d::TextSimplePortionPrimitive2D( + aNewTransformB * aNewTransformA, + pCandidate->getText(), + nPortionIndex, + nNextGlyphLen, + aNewDXArray, + aCandidateFontAttributes, + pCandidate->getLocale(), + aRGBColor); mrDecomposition.push_back(pNew); } @@ -671,7 +674,7 @@ namespace ////////////////////////////////////////////////////////////////////////////// // primitive decomposition -bool SdrTextObj::impDecomposePathTextPrimitive( +void SdrTextObj::impDecomposePathTextPrimitive( drawinglayer::primitive2d::Primitive2DSequence& rTarget, const drawinglayer::primitive2d::SdrPathTextPrimitive2D& rSdrPathTextPrimitive, const drawinglayer::geometry::ViewInformation2D& aViewInformation) const @@ -789,8 +792,6 @@ bool SdrTextObj::impDecomposePathTextPrimitive( // concatenate all results drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(rTarget, aRetvalA); drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(rTarget, aRetvalB); - - return false; } ////////////////////////////////////////////////////////////////////////////// -- cgit