tdf#168110 - sd fix Placeholder default text is visible
in presentation mode Do not render empty pres objects texts in slideshow. follow-up of commits:e136900e7a(tdf#159258 sd: fix to show objects in slideshow if they have)d323976fd6(tdf#159258 SD: SS: disable placeholdertext in image) co-author: Armin Le Grand <Armin.LeGrand@collabora.com> Change-Id: I6127cdc36a27dfeac79881b57b9b8cbf963c9d3a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195857 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Balazs Varga <balazs.varga@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196353 Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com> Tested-by: Jenkins
This commit is contained in:
@@ -85,6 +85,9 @@ protected:
|
||||
// interface to allow derivates to set ViewInformation2D
|
||||
void setViewInformation2D2D(const drawinglayer::geometry::ViewInformation2D& rViewInformation2D) { maViewInformation2D = rViewInformation2D; }
|
||||
|
||||
// Allow to set EditViewActive early at local ViewInformation2D from ObjectContactOfPageView
|
||||
void setEditViewActiveEarly() { maViewInformation2D.setEditViewActive(true); }
|
||||
|
||||
public:
|
||||
// basic constructor
|
||||
ObjectContact();
|
||||
|
||||
@@ -131,20 +131,20 @@ public:
|
||||
xmlDocUniquePtr svgDoc = parseXml(maTempFile);
|
||||
CPPUNIT_ASSERT(svgDoc);
|
||||
|
||||
assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[9]/SVG_G[2] ), "class", u"Master_Slide");
|
||||
assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[9]/SVG_G[2]/SVG_G[2] ), "class", u"BackgroundObjects");
|
||||
assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[8]/SVG_G[2] ), "class", u"Master_Slide");
|
||||
assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[8]/SVG_G[2]/SVG_G[2] ), "class", u"BackgroundObjects");
|
||||
// Current Date Field
|
||||
assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[9]/SVG_G[2]/SVG_G[2]/SVG_G[4] ), "class", u"TextShape");
|
||||
assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[9]/SVG_G[2]/SVG_G[2]/SVG_G[4]/SVG_G/SVG_TEXT/SVG_TSPAN/SVG_TSPAN/SVG_TSPAN ), "class", u"PlaceholderText Date");
|
||||
assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[8]/SVG_G[2]/SVG_G[2]/SVG_G[4] ), "class", u"TextShape");
|
||||
assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[8]/SVG_G[2]/SVG_G[2]/SVG_G[4]/SVG_G/SVG_TEXT/SVG_TSPAN/SVG_TSPAN/SVG_TSPAN ), "class", u"PlaceholderText Date");
|
||||
// Current Time Field
|
||||
assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[9]/SVG_G[2]/SVG_G[2]/SVG_G[5] ), "class", u"TextShape");
|
||||
assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[9]/SVG_G[2]/SVG_G[2]/SVG_G[5]/SVG_G/SVG_TEXT/SVG_TSPAN/SVG_TSPAN/SVG_TSPAN ), "class", u"PlaceholderText Time");
|
||||
assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[8]/SVG_G[2]/SVG_G[2]/SVG_G[5] ), "class", u"TextShape");
|
||||
assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[8]/SVG_G[2]/SVG_G[2]/SVG_G[5]/SVG_G/SVG_TEXT/SVG_TSPAN/SVG_TSPAN/SVG_TSPAN ), "class", u"PlaceholderText Time");
|
||||
// Slide Name Field
|
||||
assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[9]/SVG_G[2]/SVG_G[2]/SVG_G[6] ), "class", u"TextShape");
|
||||
assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[9]/SVG_G[2]/SVG_G[2]/SVG_G[6]/SVG_G/SVG_TEXT/SVG_TSPAN/SVG_TSPAN/SVG_TSPAN ), "class", u"PlaceholderText PageName");
|
||||
assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[8]/SVG_G[2]/SVG_G[2]/SVG_G[6] ), "class", u"TextShape");
|
||||
assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[8]/SVG_G[2]/SVG_G[2]/SVG_G[6]/SVG_G/SVG_TEXT/SVG_TSPAN/SVG_TSPAN/SVG_TSPAN ), "class", u"PlaceholderText PageName");
|
||||
// Slide Number Field
|
||||
assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[9]/SVG_G[2]/SVG_G[2]/SVG_G[7] ), "class", u"TextShape");
|
||||
assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[9]/SVG_G[2]/SVG_G[2]/SVG_G[7]/SVG_G/SVG_TEXT/SVG_TSPAN/SVG_TSPAN/SVG_TSPAN ), "class", u"PlaceholderText PageNumber");
|
||||
assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[8]/SVG_G[2]/SVG_G[2]/SVG_G[7] ), "class", u"TextShape");
|
||||
assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[8]/SVG_G[2]/SVG_G[2]/SVG_G[7]/SVG_G/SVG_TEXT/SVG_TSPAN/SVG_TSPAN/SVG_TSPAN ), "class", u"PlaceholderText PageNumber");
|
||||
}
|
||||
|
||||
void testSVGExportEmbeddedVideo()
|
||||
@@ -280,15 +280,15 @@ public:
|
||||
xmlDocUniquePtr svgDoc = parseXml(maTempFile);
|
||||
CPPUNIT_ASSERT(svgDoc);
|
||||
|
||||
assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[9]/SVG_G[2] ), "class", u"Master_Slide");
|
||||
assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[9]/SVG_G[2]/SVG_G[2] ), "class", u"BackgroundObjects");
|
||||
assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[8]/SVG_G[2] ), "class", u"Master_Slide");
|
||||
assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[8]/SVG_G[2]/SVG_G[2] ), "class", u"BackgroundObjects");
|
||||
|
||||
// Slide Name Field
|
||||
assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[9]/SVG_G[2]/SVG_G[2]/SVG_G[6] ), "class", u"TextShape");
|
||||
assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[9]/SVG_G[2]/SVG_G[2]/SVG_G[6]/SVG_G/SVG_TEXT/SVG_TSPAN/SVG_TSPAN/SVG_TSPAN ), "class", u"PlaceholderText PageName");
|
||||
assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[8]/SVG_G[2]/SVG_G[2]/SVG_G[6] ), "class", u"TextShape");
|
||||
assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[8]/SVG_G[2]/SVG_G[2]/SVG_G[6]/SVG_G/SVG_TEXT/SVG_TSPAN/SVG_TSPAN/SVG_TSPAN ), "class", u"PlaceholderText PageName");
|
||||
// Slide Number Field
|
||||
assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[9]/SVG_G[2]/SVG_G[2]/SVG_G[7] ), "class", u"TextShape");
|
||||
assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[9]/SVG_G[2]/SVG_G[2]/SVG_G[7]/SVG_G/SVG_TEXT/SVG_TSPAN/SVG_TSPAN/SVG_TSPAN ), "class", u"PlaceholderText PageNumber");
|
||||
assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[8]/SVG_G[2]/SVG_G[2]/SVG_G[7] ), "class", u"TextShape");
|
||||
assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[8]/SVG_G[2]/SVG_G[2]/SVG_G[7]/SVG_G/SVG_TEXT/SVG_TSPAN/SVG_TSPAN/SVG_TSPAN ), "class", u"PlaceholderText PageNumber");
|
||||
}
|
||||
|
||||
CPPUNIT_TEST_SUITE(SdSVGFilterTest);
|
||||
|
||||
@@ -263,7 +263,6 @@ CPPUNIT_TEST_FIXTURE(SdLayoutTest, tdf143258_testTbRlLayout)
|
||||
CPPUNIT_TEST_FIXTURE(SdLayoutTest, numberedList)
|
||||
{
|
||||
const OUString sText[] = {
|
||||
"Click to add Title",
|
||||
"1.",
|
||||
"Outer, one",
|
||||
"2.",
|
||||
@@ -364,7 +363,7 @@ CPPUNIT_TEST_FIXTURE(SdLayoutTest, testTdf156955)
|
||||
xmlDocUniquePtr pXmlDoc = parseLayout();
|
||||
|
||||
// Make sure text box has the right size - without the fix it was 2759.
|
||||
assertXPath(pXmlDoc, "/metafile/push/push/textarray[5]", "y", u"3183");
|
||||
assertXPath(pXmlDoc, "/metafile/push/push/textarray[3]", "y", u"3183");
|
||||
}
|
||||
|
||||
CPPUNIT_TEST_FIXTURE(SdLayoutTest, testTdf148966)
|
||||
|
||||
@@ -33,13 +33,15 @@ namespace drawinglayer::primitive2d
|
||||
{
|
||||
private:
|
||||
basegfx::B2DHomMatrix maTransform;
|
||||
attribute::SdrLineFillEffectsTextAttribute maSdrLFSTAttribute;
|
||||
attribute::SdrLineFillEffectsTextAttribute maSdrLFSTAttribute;
|
||||
double mfCornerRadiusX; // [0.0..1.0] relative to 1/2 width
|
||||
double mfCornerRadiusY; // [0.0..1.0] relative to 1/2 height
|
||||
|
||||
// flag which decides if the HitArea should be the filled geometry
|
||||
bool mbForceFillForHitTest : 1;
|
||||
|
||||
// flag which decides if the presentation object has empty placeholder text or not
|
||||
bool mbPlaceholderText : 1;
|
||||
// local decomposition.
|
||||
virtual Primitive2DReference create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const override;
|
||||
|
||||
@@ -49,7 +51,8 @@ namespace drawinglayer::primitive2d
|
||||
const attribute::SdrLineFillEffectsTextAttribute& rSdrLFSTAttribute,
|
||||
double fCornerRadiusX,
|
||||
double fCornerRadiusY,
|
||||
bool bForceFillForHitTest);
|
||||
bool bForceFillForHitTest,
|
||||
bool bPlaceholderText = false);
|
||||
|
||||
// data access
|
||||
const basegfx::B2DHomMatrix& getTransform() const { return maTransform; }
|
||||
@@ -57,6 +60,8 @@ namespace drawinglayer::primitive2d
|
||||
double getCornerRadiusX() const { return mfCornerRadiusX; }
|
||||
double getCornerRadiusY() const { return mfCornerRadiusY; }
|
||||
bool getForceFillForHitTest() const { return mbForceFillForHitTest; }
|
||||
bool getPlaceholderText() const { return mbPlaceholderText; }
|
||||
|
||||
|
||||
// compare operator
|
||||
virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
|
||||
|
||||
@@ -60,6 +60,14 @@ namespace sdr::contact
|
||||
: Idle(pDebugName)
|
||||
, mrPageWindow(rPageWindow)
|
||||
{
|
||||
// Set EditViewActive early at local ViewInformation2D. Usually this
|
||||
// gets updated at the 1st paint (see updateViewInformation2D calls).
|
||||
// To be independent of this mechanism and prepared for cases where
|
||||
// e.g. a HitTest is used before paint, initialize it here already.
|
||||
// This is the ObjectContact of PageView, so usage is bound to
|
||||
// EditView visualization anyways
|
||||
setEditViewActiveEarly();
|
||||
|
||||
// init PreviewRenderer flag
|
||||
setPreviewRenderer(static_cast<SdrPaintView&>(rPageWindow.GetPageView().GetView()).IsPreviewRenderer());
|
||||
|
||||
@@ -224,10 +232,10 @@ namespace sdr::contact
|
||||
if (static_cast<SdrPaintView&>(mrPageWindow.GetPageView().GetView()).IsTextEdit())
|
||||
aNewViewInformation2D.setTextEditActive(true);
|
||||
|
||||
if (!isOutputToRecordingMetaFile())
|
||||
if (!isOutputToRecordingMetaFile() && !comphelper::LibreOfficeKit::isSlideshowRendering())
|
||||
{
|
||||
// this is the EditView repaint, provide that information,
|
||||
// but only if we do not export to metafile
|
||||
// but only if we do not export to metafile and do not prepare a SlideShow
|
||||
aNewViewInformation2D.setEditViewActive(true);
|
||||
|
||||
// also copy the current DrawModeFlags
|
||||
|
||||
@@ -78,7 +78,8 @@ void ViewContactOfSdrRectObj::createViewIndependentPrimitive2DSequence(drawingla
|
||||
fCornerRadiusX,
|
||||
fCornerRadiusY,
|
||||
// #i105856# use fill for HitTest when TextFrame and not PickThrough
|
||||
GetRectObj().IsTextFrame() && !bPickThroughTransparentTextFrames));
|
||||
GetRectObj().IsTextFrame() && !bPickThroughTransparentTextFrames,
|
||||
GetRectObj().IsEmptyPresObj() && !GetRectObj().IsReallyEdited() /*bPlaceholderText*/));
|
||||
|
||||
rVisitor.visit(xReference);
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx>
|
||||
#include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx>
|
||||
#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
|
||||
#include <drawinglayer/primitive2d/exclusiveeditviewprimitive2d.hxx>
|
||||
#include <basegfx/polygon/b2dpolygon.hxx>
|
||||
#include <basegfx/polygon/b2dpolypolygon.hxx>
|
||||
#include <utility>
|
||||
@@ -122,7 +123,20 @@ namespace drawinglayer::primitive2d
|
||||
// add text glow
|
||||
aTempContentText = createEmbeddedTextGlowPrimitive(std::move(aTempContentText), getSdrLFSTAttribute().getGlowText());
|
||||
}
|
||||
aRetval.append(std::move(aTempContentText));
|
||||
|
||||
if (mbPlaceholderText)
|
||||
{
|
||||
// PlaceholderText is exclusive to e.g. EditView, so embed it
|
||||
// accordingly
|
||||
drawinglayer::primitive2d::Primitive2DReference aEmbedded(
|
||||
new drawinglayer::primitive2d::ExclusiveEditViewPrimitive2D(
|
||||
std::move(aTempContentText)));
|
||||
aRetval.append(std::move(aEmbedded));
|
||||
}
|
||||
else
|
||||
{
|
||||
aRetval.append(std::move(aTempContentText));
|
||||
}
|
||||
}
|
||||
|
||||
// add shadow
|
||||
@@ -141,12 +155,14 @@ namespace drawinglayer::primitive2d
|
||||
const attribute::SdrLineFillEffectsTextAttribute& rSdrLFSTAttribute,
|
||||
double fCornerRadiusX,
|
||||
double fCornerRadiusY,
|
||||
bool bForceFillForHitTest)
|
||||
bool bForceFillForHitTest,
|
||||
bool bPlaceholderText)
|
||||
: maTransform(std::move(aTransform)),
|
||||
maSdrLFSTAttribute(rSdrLFSTAttribute),
|
||||
mfCornerRadiusX(fCornerRadiusX),
|
||||
mfCornerRadiusY(fCornerRadiusY),
|
||||
mbForceFillForHitTest(bForceFillForHitTest)
|
||||
mbForceFillForHitTest(bForceFillForHitTest),
|
||||
mbPlaceholderText(bPlaceholderText)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -160,7 +176,8 @@ namespace drawinglayer::primitive2d
|
||||
&& getCornerRadiusY() == rCompare.getCornerRadiusY()
|
||||
&& getTransform() == rCompare.getTransform()
|
||||
&& getSdrLFSTAttribute() == rCompare.getSdrLFSTAttribute()
|
||||
&& getForceFillForHitTest() == rCompare.getForceFillForHitTest());
|
||||
&& getForceFillForHitTest() == rCompare.getForceFillForHitTest()
|
||||
&& getPlaceholderText() == rCompare.getPlaceholderText());
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user