diff options
author | Armin Le Grand (allotropia) <armin.le.grand.extern@allotropia.de> | 2024-02-22 15:13:33 +0100 |
---|---|---|
committer | Armin Le Grand <Armin.Le.Grand@me.com> | 2024-02-22 23:23:05 +0100 |
commit | 3a6bc34f076b27a366d7352e7e7b62730ff17b6f (patch) | |
tree | 4a83badd7b65ab7dc1877dd462d7d7b5522a3d15 /drawinglayer/source | |
parent | d9635e9bb42cf2b744b8d2f74633e2a209a8e3fd (diff) |
IASS: Re-define Text suppression for TextEdit
The current version suppressed text for Objects
in edit mode for the paint in the view since that
text is painted/visualized by the EditEngine/Overlay
while it is being edited, so that would be displayed
twice - and in different states.
That is correct, but e.g. also suppressed display
for e.g. an opened second Window for the Document or
in a running SlideShow.
The mechanism uses embedding the Text in case it gets
edited to a simple Primitive that then can be
suppressed by the view rendering it. It decomposed
to empty, thus to visualize it a renderer had to
actively identify and process it.
I now turnedd this around - it is a normal
GroupPrimitive2D and decomposes to the text content,
so will be visualized by all renderers that do not
actively suppress it. To actively suppress it I added
a get/setTextEditActive marker to ViewInformation2D
that will be used by the ObjectContactOfPageView
to signal exactly that and to suppress in the pixel
based VCLRenderer in that case.
This is important e.g. for 2nd view window, but also
for PDF export with active TextEdit (yes, happens)
and SlideShow.
There was also support missing for an up-to-now
empty/new object (no text yet) so that text from the
active TextEdit was not provided, corrected that.
Change-Id: I0d8befdb023028d78ce341091331e9a83a0173bd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163773
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
Diffstat (limited to 'drawinglayer/source')
4 files changed, 33 insertions, 16 deletions
diff --git a/drawinglayer/source/geometry/viewinformation2d.cxx b/drawinglayer/source/geometry/viewinformation2d.cxx index d238c9b893e0..50c7c4357b22 100644 --- a/drawinglayer/source/geometry/viewinformation2d.cxx +++ b/drawinglayer/source/geometry/viewinformation2d.cxx @@ -90,6 +90,12 @@ protected: // color to use for automatic color Color maAutoColor; + // a hint that the View that is being painted has an active TextEdit. This + // is important for handling of TextHierarchyEditPrimitive2D to suppress + // the text for objects in TextEdit - the text is visualized by the + // active EditEngine/Outliner overlay, so it would be double visualized + bool mbTextEditActive; + // allow to reduce DisplayQuality (e.g. sw 3d fallback renderer for interactions) bool mbReducedDisplayQuality : 1; @@ -110,6 +116,7 @@ public: , mxVisualizedPage() , mfViewTime(0.0) , maAutoColor(COL_AUTO) + , mbTextEditActive(false) , mbReducedDisplayQuality(false) , mbUseAntiAliasing(ViewInformation2D::getGlobalAntiAliasing()) , mbPixelSnapHairline(mbUseAntiAliasing && bForwardPixelSnapHairline) @@ -197,6 +204,9 @@ public: Color getAutoColor() const { return maAutoColor; } void setAutoColor(Color aNew) { maAutoColor = aNew; } + bool getTextEditActive() const { return mbTextEditActive; } + void setTextEditActive(bool bNew) { mbTextEditActive = bNew; } + bool getReducedDisplayQuality() const { return mbReducedDisplayQuality; } void setReducedDisplayQuality(bool bNew) { mbReducedDisplayQuality = bNew; } @@ -213,6 +223,7 @@ public: && maViewport == rCandidate.maViewport && mxVisualizedPage == rCandidate.mxVisualizedPage && mfViewTime == rCandidate.mfViewTime && maAutoColor == rCandidate.maAutoColor + && mbTextEditActive == rCandidate.mbTextEditActive && mbReducedDisplayQuality == rCandidate.mbReducedDisplayQuality && mbUseAntiAliasing == rCandidate.mbUseAntiAliasing && mbPixelSnapHairline == rCandidate.mbPixelSnapHairline); @@ -353,6 +364,16 @@ Color ViewInformation2D::getAutoColor() const { return mpViewInformation2D->getA void ViewInformation2D::setAutoColor(Color aNew) { mpViewInformation2D->setAutoColor(aNew); } +bool ViewInformation2D::getTextEditActive() const +{ + return mpViewInformation2D->getTextEditActive(); +} + +void ViewInformation2D::setTextEditActive(bool bNew) +{ + mpViewInformation2D->setTextEditActive(bNew); +} + bool ViewInformation2D::getPixelSnapHairline() const { return mpViewInformation2D->getPixelSnapHairline(); diff --git a/drawinglayer/source/primitive2d/texthierarchyprimitive2d.cxx b/drawinglayer/source/primitive2d/texthierarchyprimitive2d.cxx index 93cb4e455d76..172e8c758797 100644 --- a/drawinglayer/source/primitive2d/texthierarchyprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/texthierarchyprimitive2d.cxx @@ -137,8 +137,7 @@ namespace drawinglayer::primitive2d TextHierarchyEditPrimitive2D::TextHierarchyEditPrimitive2D(Primitive2DContainer&& aContent) - : BasePrimitive2D() - , maContent(std::move(aContent)) + : GroupPrimitive2D(std::move(aContent)) { } diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx index 570451c5b32b..4dc33974189f 100644 --- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx @@ -890,20 +890,6 @@ void VclMetafileProcessor2D::processBasePrimitive2D(const primitive2d::BasePrimi static_cast<const primitive2d::StructureTagPrimitive2D&>(rCandidate)); break; } - case PRIMITIVE2D_ID_TEXTHIERARCHYEDITPRIMITIVE2D: - { - // This primitive is created if a text edit is active and contains it's - // current content, not from model data itself. - // Pixel renderers need to suppress that content, it gets displayed by the active - // TextEdit in the EditView. Suppression is done by decomposing to nothing. - // MetaFile renderers have to show it, so that the edited text is part of the - // MetaFile, e.g. needed for presentation previews and exports. - // So take action here and process it's content: - // Note: Former error was #i97628# - process(static_cast<const primitive2d::TextHierarchyEditPrimitive2D&>(rCandidate) - .getContent()); - break; - } case PRIMITIVE2D_ID_EPSPRIMITIVE2D: { RenderEpsPrimitive2D(static_cast<const primitive2d::EpsPrimitive2D&>(rCandidate)); diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx index ba6f37a48a52..21939efad6c6 100644 --- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx @@ -339,6 +339,17 @@ void VclPixelProcessor2D::processBasePrimitive2D(const primitive2d::BasePrimitiv processInvertPrimitive2D(rCandidate); break; } + case PRIMITIVE2D_ID_TEXTHIERARCHYEDITPRIMITIVE2D: + { + // check if TextEdit is active + if (getViewInformation2D().getTextEditActive()) + // suppress text display + break; + + // visualize text + process(rCandidate); + break; + } case PRIMITIVE2D_ID_EPSPRIMITIVE2D: { RenderEpsPrimitive2D(static_cast<const primitive2d::EpsPrimitive2D&>(rCandidate)); |