summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorCaolán McNamara <caolan.mcnamara@collabora.com>2024-03-03 14:53:19 +0000
committerCaolán McNamara <caolan.mcnamara@collabora.com>2024-03-03 17:42:29 +0100
commit5dab4eb854609d5d84bb0bfa918f0a5bf0459b53 (patch)
tree961c508e1e75f1cfc8f25dc5a809ea7480a75847 /svx
parent0c3580828811496052f41b09ad68fcc00a525f6f (diff)
Resolves: tdf#159696 Small capitals with 'Individual words' underlining
Change-Id: I79af3f74ef384f734273b00bddbcfed8952a3ad2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164303 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Diffstat (limited to 'svx')
-rw-r--r--svx/source/svdraw/svdotextdecomposition.cxx40
1 files changed, 33 insertions, 7 deletions
diff --git a/svx/source/svdraw/svdotextdecomposition.cxx b/svx/source/svdraw/svdotextdecomposition.cxx
index 3fe9de6fb7ba..5736f26f51b7 100644
--- a/svx/source/svdraw/svdotextdecomposition.cxx
+++ b/svx/source/svdraw/svdotextdecomposition.cxx
@@ -35,6 +35,7 @@
#include <basegfx/vector/b2dvector.hxx>
#include <sdr/primitive2d/sdrtextprimitive2d.hxx>
#include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx>
+#include <drawinglayer/primitive2d/textbreakuphelper.hxx>
#include <drawinglayer/primitive2d/textprimitive2d.hxx>
#include <drawinglayer/primitive2d/textdecoratedprimitive2d.hxx>
#include <basegfx/range/b2drange.hxx>
@@ -327,13 +328,38 @@ namespace
const drawinglayer::primitive2d::TextDecoratedPortionPrimitive2D* pTCPP =
static_cast<const drawinglayer::primitive2d::TextDecoratedPortionPrimitive2D*>(pNewPrimitive.get());
- pTCPP->CreateDecorationGeometryContent(
- aContainer,
- pTCPP->getTextTransform(),
- caseMappedText,
- rInfo.mnTextStart,
- rInfo.mnTextLen,
- aDXArray);
+ if (pTCPP->getWordLineMode()) // single word mode: 'Individual words' in UI
+ {
+ // Split to single word primitives using TextBreakupHelper
+ drawinglayer::primitive2d::TextBreakupHelper aTextBreakupHelper(*pTCPP);
+ drawinglayer::primitive2d::Primitive2DContainer aBroken(aTextBreakupHelper.extractResult(drawinglayer::primitive2d::BreakupUnit::Word));
+ for (auto& rPortion : aBroken)
+ {
+ assert(rPortion->getPrimitive2DID() == PRIMITIVE2D_ID_TEXTDECORATEDPORTIONPRIMITIVE2D &&
+ "TextBreakupHelper generates same output primitive type as input");
+
+ const drawinglayer::primitive2d::TextDecoratedPortionPrimitive2D* pPortion =
+ static_cast<const drawinglayer::primitive2d::TextDecoratedPortionPrimitive2D*>(rPortion.get());
+
+ pPortion->CreateDecorationGeometryContent(
+ aContainer,
+ pPortion->getTextTransform(),
+ caseMappedText,
+ pPortion->getTextPosition(),
+ pPortion->getTextLength(),
+ pPortion->getDXArray());
+ }
+ }
+ else
+ {
+ pTCPP->CreateDecorationGeometryContent(
+ aContainer,
+ pTCPP->getTextTransform(),
+ caseMappedText,
+ rInfo.mnTextStart,
+ rInfo.mnTextLen,
+ aDXArray);
+ }
}
pNewPrimitive = new drawinglayer::primitive2d::GroupPrimitive2D(std::move(aContainer));