diff options
author | Armin Le Grand <alg@apache.org> | 2012-01-26 08:16:51 +0000 |
---|---|---|
committer | Armin Le Grand <alg@apache.org> | 2012-01-26 08:16:51 +0000 |
commit | 894c947183df59f5e15d8f0b4b1dea1261bf31f2 (patch) | |
tree | 07ccb9b95b9d82bc3a9940b711e4324c4736d959 /drawinglayer | |
parent | 1aa9e75f69df24ffc4095829f8e90ca7fcba43f5 (diff) |
#118834# Unified usage of TextBreakupHelper as single tooling class for i18n text primitive breakup
Diffstat (limited to 'drawinglayer')
4 files changed, 110 insertions, 288 deletions
diff --git a/drawinglayer/inc/drawinglayer/primitive2d/textbreakuphelper.hxx b/drawinglayer/inc/drawinglayer/primitive2d/textbreakuphelper.hxx index 66560938221c..86ae3f7784c8 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/textbreakuphelper.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/textbreakuphelper.hxx @@ -43,9 +43,8 @@ namespace drawinglayer class DRAWINGLAYER_DLLPUBLIC TextBreakupHelper { private: - const Primitive2DReference mxSource; + const TextSimplePortionPrimitive2D& mrSource; Primitive2DSequence mxResult; - const TextSimplePortionPrimitive2D* mpSource; TextLayouterDevice maTextLayouter; basegfx::tools::B2DHomMatrixBufferedOnDemandDecompose maDecTrans; @@ -53,7 +52,7 @@ namespace drawinglayer bool mbNoDXArray : 1; /// create a portion from nIndex to nLength and append to rTempResult - void breakupPortion(Primitive2DVector& rTempResult, sal_uInt32 nIndex, sal_uInt32 nLength); + void breakupPortion(Primitive2DVector& rTempResult, sal_uInt32 nIndex, sal_uInt32 nLength, bool bWordLineMode); /// breakup complete primitive void breakup(BreakupUnit aBreakupUnit); @@ -65,19 +64,16 @@ namespace drawinglayer virtual bool allowChange(sal_uInt32 nCount, basegfx::B2DHomMatrix& rNewTransform, sal_uInt32 nIndex, sal_uInt32 nLength); /// allow read access to evtl. useful local parts - const TextSimplePortionPrimitive2D* getCastedSource() const { return mpSource; } const TextLayouterDevice& getTextLayouter() const { return maTextLayouter; } const basegfx::tools::B2DHomMatrixBufferedOnDemandDecompose& getDecTrans() const { return maDecTrans; } + const TextSimplePortionPrimitive2D& getSource() const { return mrSource; } public: - TextBreakupHelper(const Primitive2DReference& rxSource); + TextBreakupHelper(const TextSimplePortionPrimitive2D& rSource); virtual ~TextBreakupHelper(); /// get result const Primitive2DSequence& getResult(BreakupUnit aBreakupUnit = BreakupUnit_character) const; - - /// data read access - const Primitive2DReference& getSource() const { return mxSource; } }; } // end of namespace primitive2d diff --git a/drawinglayer/inc/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx index 6e0807b85ab8..b0b08928d9e4 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx @@ -81,13 +81,6 @@ namespace drawinglayer const ::std::vector< double >& rDXArray, const attribute::FontAttribute& rFontAttribute) const; - void impCorrectTextBoundary( - ::com::sun::star::i18n::Boundary& rNextWordBoundary) const; - - void impSplitSingleWords( - std::vector< Primitive2DReference >& rTarget, - basegfx::tools::B2DHomMatrixBufferedOnDemandDecompose& rDecTrans) const; - protected: /// local decomposition. virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; @@ -134,6 +127,10 @@ namespace drawinglayer bool getEmphasisMarkBelow() const { return mbEmphasisMarkBelow; } bool getShadow() const { return mbShadow; } + /// check if this needs to be a TextDecoratedPortionPrimitive2D or + /// if a TextSimplePortionPrimitive2D would be suficcient + bool decoratedIsNeeded() const; + /// compare operator virtual bool operator==( const BasePrimitive2D& rPrimitive ) const; diff --git a/drawinglayer/source/primitive2d/textbreakuphelper.cxx b/drawinglayer/source/primitive2d/textbreakuphelper.cxx index b4ff7bdb701b..d99997c90b04 100644 --- a/drawinglayer/source/primitive2d/textbreakuphelper.cxx +++ b/drawinglayer/source/primitive2d/textbreakuphelper.cxx @@ -28,6 +28,7 @@ #include <comphelper/processfactory.hxx> #include <com/sun/star/i18n/CharacterIteratorMode.hdl> #include <com/sun/star/i18n/WordType.hpp> +#include <com/sun/star/i18n/CharType.hpp> ////////////////////////////////////////////////////////////////////////////// @@ -35,28 +36,25 @@ namespace drawinglayer { namespace primitive2d { - TextBreakupHelper::TextBreakupHelper(const Primitive2DReference& rxSource) - : mxSource(rxSource), + TextBreakupHelper::TextBreakupHelper(const TextSimplePortionPrimitive2D& rSource) + : mrSource(rSource), mxResult(), - mpSource(dynamic_cast< const TextSimplePortionPrimitive2D* >(rxSource.get())), maTextLayouter(), maDecTrans(), mbNoDXArray(false) { - if(mpSource) - { - maDecTrans = mpSource->getTextTransform(); - mbNoDXArray = mpSource->getDXArray().empty(); + OSL_ENSURE(dynamic_cast< const TextSimplePortionPrimitive2D* >(&mrSource), "TextBreakupHelper with illegal primitive created (!)"); + maDecTrans = mrSource.getTextTransform(); + mbNoDXArray = mrSource.getDXArray().empty(); - if(mbNoDXArray) - { - // init TextLayouter when no dxarray - maTextLayouter.setFontAttribute( - mpSource->getFontAttribute(), - maDecTrans.getScale().getX(), - maDecTrans.getScale().getY(), - mpSource->getLocale()); - } + if(mbNoDXArray) + { + // init TextLayouter when no dxarray + maTextLayouter.setFontAttribute( + mrSource.getFontAttribute(), + maDecTrans.getScale().getX(), + maDecTrans.getScale().getY(), + mrSource.getLocale()); } } @@ -64,21 +62,21 @@ namespace drawinglayer { } - void TextBreakupHelper::breakupPortion(Primitive2DVector& rTempResult, sal_uInt32 nIndex, sal_uInt32 nLength) + void TextBreakupHelper::breakupPortion(Primitive2DVector& rTempResult, sal_uInt32 nIndex, sal_uInt32 nLength, bool bWordLineMode) { - if(mpSource && nLength && !(nIndex == mpSource->getTextPosition() && nLength == mpSource->getTextLength())) + if(nLength && !(nIndex == mrSource.getTextPosition() && nLength == mrSource.getTextLength())) { // prepare values for new portion basegfx::B2DHomMatrix aNewTransform; ::std::vector< double > aNewDXArray; - const bool bNewStartIsNotOldStart(nIndex > mpSource->getTextPosition()); + const bool bNewStartIsNotOldStart(nIndex > mrSource.getTextPosition()); if(!mbNoDXArray) { // prepare new DXArray for the single word aNewDXArray = ::std::vector< double >( - mpSource->getDXArray().begin() + (nIndex - mpSource->getTextPosition()), - mpSource->getDXArray().begin() + ((nIndex + nLength) - mpSource->getTextPosition())); + mrSource.getDXArray().begin() + (nIndex - mrSource.getTextPosition()), + mrSource.getDXArray().begin() + ((nIndex + nLength) - mrSource.getTextPosition())); } if(bNewStartIsNotOldStart) @@ -89,13 +87,13 @@ namespace drawinglayer if(mbNoDXArray) { // evaluate using TextLayouter - fOffset = maTextLayouter.getTextWidth(mpSource->getText(), mpSource->getTextPosition(), nIndex); + fOffset = maTextLayouter.getTextWidth(mrSource.getText(), mrSource.getTextPosition(), nIndex); } else { // get from DXArray - const sal_uInt32 nIndex2(static_cast< sal_uInt32 >(nIndex - mpSource->getTextPosition())); - fOffset = mpSource->getDXArray()[nIndex2 - 1]; + const sal_uInt32 nIndex2(static_cast< sal_uInt32 >(nIndex - mrSource.getTextPosition())); + fOffset = mrSource.getDXArray()[nIndex2 - 1]; } // need offset without FontScale for building the new transformation. The @@ -136,7 +134,7 @@ namespace drawinglayer { // check if we have a decorated primitive as source const TextDecoratedPortionPrimitive2D* pTextDecoratedPortionPrimitive2D = - dynamic_cast< const TextDecoratedPortionPrimitive2D* >(mpSource); + dynamic_cast< const TextDecoratedPortionPrimitive2D* >(&mrSource); if(pTextDecoratedPortionPrimitive2D) { @@ -144,13 +142,13 @@ namespace drawinglayer rTempResult.push_back( new TextDecoratedPortionPrimitive2D( aNewTransform, - mpSource->getText(), + mrSource.getText(), nIndex, nLength, aNewDXArray, - mpSource->getFontAttribute(), - mpSource->getLocale(), - mpSource->getFontColor(), + mrSource.getFontAttribute(), + mrSource.getLocale(), + mrSource.getFontColor(), pTextDecoratedPortionPrimitive2D->getOverlineColor(), pTextDecoratedPortionPrimitive2D->getTextlineColor(), @@ -158,7 +156,10 @@ namespace drawinglayer pTextDecoratedPortionPrimitive2D->getFontUnderline(), pTextDecoratedPortionPrimitive2D->getUnderlineAbove(), pTextDecoratedPortionPrimitive2D->getTextStrikeout(), - pTextDecoratedPortionPrimitive2D->getWordLineMode(), + + // reset WordLineMode when BreakupUnit_word is executed; else copy original + bWordLineMode ? false : pTextDecoratedPortionPrimitive2D->getWordLineMode(), + pTextDecoratedPortionPrimitive2D->getTextEmphasisMark(), pTextDecoratedPortionPrimitive2D->getEmphasisMarkAbove(), pTextDecoratedPortionPrimitive2D->getEmphasisMarkBelow(), @@ -171,13 +172,13 @@ namespace drawinglayer rTempResult.push_back( new TextSimplePortionPrimitive2D( aNewTransform, - mpSource->getText(), + mrSource.getText(), nIndex, nLength, aNewDXArray, - mpSource->getFontAttribute(), - mpSource->getLocale(), - mpSource->getFontColor())); + mrSource.getFontAttribute(), + mrSource.getLocale(), + mrSource.getFontColor())); } } } @@ -190,7 +191,7 @@ namespace drawinglayer void TextBreakupHelper::breakup(BreakupUnit aBreakupUnit) { - if(mpSource && mpSource->getTextLength()) + if(mrSource.getTextLength()) { Primitive2DVector aTempResult; static ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XBreakIterator > xBreakIterator; @@ -203,10 +204,10 @@ namespace drawinglayer if(xBreakIterator.is()) { - const rtl::OUString& rTxt = mpSource->getText(); - const sal_Int32 nTextLength(mpSource->getTextLength()); - const ::com::sun::star::lang::Locale& rLocale = mpSource->getLocale(); - const sal_Int32 nTextPosition(mpSource->getTextPosition()); + const rtl::OUString& rTxt = mrSource.getText(); + const sal_Int32 nTextLength(mrSource.getTextLength()); + const ::com::sun::star::lang::Locale& rLocale = mrSource.getLocale(); + const sal_Int32 nTextPosition(mrSource.getTextPosition()); sal_Int32 nCurrent(nTextPosition); switch(aBreakupUnit) @@ -221,13 +222,13 @@ namespace drawinglayer { if(a == nNextCellBreak) { - breakupPortion(aTempResult, nCurrent, a - nCurrent); + breakupPortion(aTempResult, nCurrent, a - nCurrent, false); nCurrent = a; nNextCellBreak = xBreakIterator->nextCharacters(rTxt, a, rLocale, ::com::sun::star::i18n::CharacterIteratorMode::SKIPCELL, 1, nDone); } } - breakupPortion(aTempResult, nCurrent, a - nCurrent); + breakupPortion(aTempResult, nCurrent, a - nCurrent, false); break; } case BreakupUnit_word: @@ -239,13 +240,31 @@ namespace drawinglayer { if(a == nNextWordBoundary.endPos) { - breakupPortion(aTempResult, nCurrent, a - nCurrent); + if(a > nCurrent) + { + breakupPortion(aTempResult, nCurrent, a - nCurrent, true); + } + nCurrent = a; + + // skip spaces (maybe enhanced with a bool later if needed) + { + const sal_Int32 nEndOfSpaces(xBreakIterator->endOfCharBlock(rTxt, a, rLocale, ::com::sun::star::i18n::CharType::SPACE_SEPARATOR)); + + if(nEndOfSpaces > a) + { + nCurrent = nEndOfSpaces; + } + } + nNextWordBoundary = xBreakIterator->getWordBoundary(rTxt, a + 1, rLocale, ::com::sun::star::i18n::WordType::ANY_WORD, sal_True); } } - breakupPortion(aTempResult, nCurrent, a - nCurrent); + if(a > nCurrent) + { + breakupPortion(aTempResult, nCurrent, a - nCurrent, true); + } break; } case BreakupUnit_sentence: @@ -257,13 +276,13 @@ namespace drawinglayer { if(a == nNextSentenceBreak) { - breakupPortion(aTempResult, nCurrent, a - nCurrent); + breakupPortion(aTempResult, nCurrent, a - nCurrent, false); nCurrent = a; nNextSentenceBreak = xBreakIterator->endOfSentence(rTxt, a + 1, rLocale); } } - breakupPortion(aTempResult, nCurrent, a - nCurrent); + breakupPortion(aTempResult, nCurrent, a - nCurrent, false); break; } } @@ -275,11 +294,7 @@ namespace drawinglayer const Primitive2DSequence& TextBreakupHelper::getResult(BreakupUnit aBreakupUnit) const { - if(mxResult.hasElements()) - { - return mxResult; - } - else if(mpSource) + if(!mxResult.hasElements()) { const_cast< TextBreakupHelper* >(this)->breakup(aBreakupUnit); } diff --git a/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx b/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx index ad8b51655547..4f41eac25c0e 100644 --- a/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx @@ -25,19 +25,16 @@ #include "precompiled_drawinglayer.hxx" #include <drawinglayer/primitive2d/textdecoratedprimitive2d.hxx> -#include <drawinglayer/primitive2d/textlayoutdevice.hxx> #include <drawinglayer/primitive2d/polygonprimitive2d.hxx> #include <drawinglayer/attribute/strokeattribute.hxx> #include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx> #include <basegfx/matrix/b2dhommatrixtools.hxx> -#include <comphelper/processfactory.hxx> -#include <com/sun/star/i18n/WordType.hpp> #include <drawinglayer/primitive2d/texteffectprimitive2d.hxx> #include <drawinglayer/primitive2d/shadowprimitive2d.hxx> -#include <com/sun/star/i18n/XBreakIterator.hpp> #include <drawinglayer/primitive2d/transformprimitive2d.hxx> #include <drawinglayer/primitive2d/textlineprimitive2d.hxx> #include <drawinglayer/primitive2d/textstrikeoutprimitive2d.hxx> +#include <drawinglayer/primitive2d/textbreakuphelper.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -165,231 +162,46 @@ namespace drawinglayer // TODO: Handle Font Emphasis Above/Below } - void TextDecoratedPortionPrimitive2D::impCorrectTextBoundary(::com::sun::star::i18n::Boundary& rNextWordBoundary) const - { - // truncate aNextWordBoundary to min/max possible values. This is necessary since the word start may be - // before/after getTextPosition() when a long string is the content and getTextPosition() - // is right inside a word. Same for end. - const sal_Int32 aMinPos(static_cast< sal_Int32 >(getTextPosition())); - const sal_Int32 aMaxPos(aMinPos + static_cast< sal_Int32 >(getTextLength())); - - if(rNextWordBoundary.startPos < aMinPos) - { - rNextWordBoundary.startPos = aMinPos; - } - else if(rNextWordBoundary.startPos > aMaxPos) - { - rNextWordBoundary.startPos = aMaxPos; - } - - if(rNextWordBoundary.endPos < aMinPos) - { - rNextWordBoundary.endPos = aMinPos; - } - else if(rNextWordBoundary.endPos > aMaxPos) - { - rNextWordBoundary.endPos = aMaxPos; - } - } - - void TextDecoratedPortionPrimitive2D::impSplitSingleWords( - std::vector< Primitive2DReference >& rTarget, - basegfx::tools::B2DHomMatrixBufferedOnDemandDecompose& rDecTrans) const + Primitive2DSequence TextDecoratedPortionPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { - // break iterator support - // made static so it only needs to be fetched once, even with many single - // constructed VclMetafileProcessor2D. It's still incarnated on demand, - // but exists for OOo runtime now by purpose. - static ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XBreakIterator > xLocalBreakIterator; - - if(!xLocalBreakIterator.is()) - { - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xMSF(::comphelper::getProcessServiceFactory()); - xLocalBreakIterator.set(xMSF->createInstance(rtl::OUString::createFromAscii("com.sun.star.i18n.BreakIterator")), ::com::sun::star::uno::UNO_QUERY); - } - - if(xLocalBreakIterator.is() && getTextLength()) + if(getWordLineMode()) { - // 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)); + // support for single word mode; split to single word primitives + // using TextBreakupHelper + const TextBreakupHelper aTextBreakupHelper(*this); + const Primitive2DSequence aBroken(aTextBreakupHelper.getResult(BreakupUnit_word)); - if(aNextWordBoundary.endPos == getTextPosition()) + if(aBroken.hasElements()) { - // backward hit, force next word - aNextWordBoundary = xLocalBreakIterator->getWordBoundary( - getText(), getTextPosition() + 1, getLocale(), ::com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES, sal_True); - } - - impCorrectTextBoundary(aNextWordBoundary); - - // prepare new font attributes WITHOUT outline - const attribute::FontAttribute aNewFontAttribute( - getFontAttribute().getFamilyName(), - getFontAttribute().getStyleName(), - getFontAttribute().getWeight(), - getFontAttribute().getSymbol(), - getFontAttribute().getVertical(), - getFontAttribute().getItalic(), - false, // no outline anymore, handled locally - getFontAttribute().getRTL(), - getFontAttribute().getBiDiStrong()); - - if(aNextWordBoundary.startPos == getTextPosition() && aNextWordBoundary.endPos == getTextLength()) - { - // it IS only a single word, handle as one word - impCreateGeometryContent(rTarget, rDecTrans, getText(), getTextPosition(), getTextLength(), getDXArray(), aNewFontAttribute); + // was indeed split to several words, use as result + return aBroken; } else { - // prepare TextLayouter - const bool bNoDXArray(getDXArray().empty()); - TextLayouterDevice aTextLayouter; - - if(bNoDXArray) - { - // ..but only completely when no DXArray - aTextLayouter.setFontAttribute( - getFontAttribute(), - rDecTrans.getScale().getX(), - rDecTrans.getScale().getY(), - getLocale()); - } - - // do iterate over single words - while(aNextWordBoundary.startPos != aNextWordBoundary.endPos) - { - // prepare values for new portion - const xub_StrLen nNewTextStart(static_cast< xub_StrLen >(aNextWordBoundary.startPos)); - const xub_StrLen nNewTextEnd(static_cast< xub_StrLen >(aNextWordBoundary.endPos)); - - // prepare transform for the single word - basegfx::B2DHomMatrix aNewTransform; - ::std::vector< double > aNewDXArray; - const bool bNewStartIsNotOldStart(nNewTextStart > getTextPosition()); - - if(!bNoDXArray) - { - // 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())); - } - - if(bNewStartIsNotOldStart) - { - // needs to be moved to a new start position - double fOffset(0.0); - - if(bNoDXArray) - { - // 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]; - } - - // 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(fOffsetNoScale, 0.0); - - if(!bNoDXArray) - { - // 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++) - { - aNewDXArray[a] -= fOffset; - } - } - } - - // add text transformation to new transformation - aNewTransform *= rDecTrans.getB2DHomMatrix(); - - // create geometry content for the single word. Do not forget - // to use the new transformation - basegfx::tools::B2DHomMatrixBufferedOnDemandDecompose aDecTrans(aNewTransform); - - impCreateGeometryContent(rTarget, aDecTrans, getText(), nNewTextStart, - nNewTextEnd - nNewTextStart, aNewDXArray, aNewFontAttribute); - - 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); - - 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); - } - } + // no split, was already a single word. Continue to + // decompse local entity } } - } - - Primitive2DSequence TextDecoratedPortionPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const - { std::vector< Primitive2DReference > aNewPrimitives; basegfx::tools::B2DHomMatrixBufferedOnDemandDecompose aDecTrans(getTextTransform()); Primitive2DSequence aRetval; // create basic geometry such as SimpleTextPrimitive, Overline, Underline, // Strikeout, etc... - if(getWordLineMode()) - { - // support for single word mode - impSplitSingleWords(aNewPrimitives, aDecTrans); - } - else - { - // prepare new font attributes WITHOUT outline - const attribute::FontAttribute aNewFontAttribute( - getFontAttribute().getFamilyName(), - getFontAttribute().getStyleName(), - getFontAttribute().getWeight(), - getFontAttribute().getSymbol(), - getFontAttribute().getVertical(), - getFontAttribute().getItalic(), - false, // no outline anymore, handled locally - getFontAttribute().getRTL(), - getFontAttribute().getBiDiStrong()); - - // handle as one word - impCreateGeometryContent(aNewPrimitives, aDecTrans, getText(), getTextPosition(), getTextLength(), getDXArray(), aNewFontAttribute); - } + // prepare new font attributes WITHOUT outline + const attribute::FontAttribute aNewFontAttribute( + getFontAttribute().getFamilyName(), + getFontAttribute().getStyleName(), + getFontAttribute().getWeight(), + getFontAttribute().getSymbol(), + getFontAttribute().getVertical(), + getFontAttribute().getItalic(), + false, // no outline anymore, handled locally + getFontAttribute().getRTL(), + getFontAttribute().getBiDiStrong()); + + // handle as one word + impCreateGeometryContent(aNewPrimitives, aDecTrans, getText(), getTextPosition(), getTextLength(), getDXArray(), aNewFontAttribute); // convert to Primitive2DSequence const sal_uInt32 nMemberCount(aNewPrimitives.size()); @@ -542,6 +354,16 @@ namespace drawinglayer { } + bool TextDecoratedPortionPrimitive2D::decoratedIsNeeded() const + { + return (TEXT_LINE_NONE != getFontOverline() + || TEXT_LINE_NONE != getFontUnderline() + || TEXT_STRIKEOUT_NONE != getTextStrikeout() + || TEXT_EMPHASISMARK_NONE != getTextEmphasisMark() + || TEXT_RELIEF_NONE != getTextRelief() + || getShadow()); + } + bool TextDecoratedPortionPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const { if(TextSimplePortionPrimitive2D::operator==(rPrimitive)) @@ -570,15 +392,7 @@ namespace drawinglayer // inking area, so add them if needed basegfx::B2DRange TextDecoratedPortionPrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const { - const bool bDecoratedIsNeeded( - TEXT_LINE_NONE != getFontOverline() - || TEXT_LINE_NONE != getFontUnderline() - || TEXT_STRIKEOUT_NONE != getTextStrikeout() - || TEXT_EMPHASISMARK_NONE != getTextEmphasisMark() - || TEXT_RELIEF_NONE != getTextRelief() - || getShadow()); - - if(bDecoratedIsNeeded) + if(decoratedIsNeeded()) { // decoration is used, fallback to BufferedDecompositionPrimitive2D::getB2DRange which uses // the own local decomposition for computation and thus creates all necessary |