summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2024-01-17 21:21:24 +0600
committerMike Kaganski <mike.kaganski@collabora.com>2024-01-18 10:15:31 +0100
commitc7ed1dfab8c6c2f47b45dbe9ae683a9150c33f7e (patch)
treee6bcc6955d93320854745d2c23e80854490a734f /oox
parent45b7500d951842f851f24f3b5896f87219c47732 (diff)
tdf#140912, tdf#159219: fix import of graphic placeholder with custom prompt
Importing the text marks the object as not empty. Then, the object would behave as an outliner object. This includes showing in slide show; allowing text esiting; stretching the placeholder image, which required a workaround implemented in commit 7b3be7f6f3d800e2ad86f5a043e6e9b21ed4409f (tdf#140912 Better handling of the picture placeholders, 2021-12-01). Instead, drop the custom prompt. More correct solution would be making sure to mark the object as empty after setting the text; but this doesn't round- trip to ODF; and it crashes export to PPTX. Proper support for the sustom placeholder prompt feature should be done separately. The new workaround (dropping the text) makes previous workaround (special handling of the placeholder graphic) unnecessary. The unit test is updated. Change-Id: Ic7f42493af8d1d725ffa39ffab58f1ff033351cc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162202 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162237 Tested-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'oox')
-rw-r--r--oox/source/drawingml/shape.cxx37
1 files changed, 7 insertions, 30 deletions
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index c42a9f7820a3..22cc551ed6b2 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -95,7 +95,6 @@
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <com/sun/star/document/XActionLockable.hpp>
#include <com/sun/star/chart2/data/XDataReceiver.hpp>
-#include <com/sun/star/text/GraphicCrop.hpp>
#include <svx/svdobj.hxx>
#include <svx/svdotable.hxx>
#include <svx/svdtrans.hxx>
@@ -1539,35 +1538,6 @@ Reference< XShape > const & Shape::createAndInsert(
propertySet->setPropertyValue("InteropGrabBag",uno::Any(aGrabBag));
}
- // If the shape is a picture placeholder.
- if (aServiceName == "com.sun.star.presentation.GraphicObjectShape" && !bClearText)
- {
- // Placeholder text should be in center of the shape.
- aShapeProps.setProperty(PROP_TextContourFrame, false);
-
- /* Placeholder icon should be at the center of the parent shape.
- * We use negative graphic crop property because of that we don't
- * have padding support.
- */
- uno::Reference<beans::XPropertySet> xGraphic(xSet->getPropertyValue("Graphic"), uno::UNO_QUERY);
- if (xGraphic.is())
- {
- awt::Size aBitmapSize;
- xGraphic->getPropertyValue("Size100thMM") >>= aBitmapSize;
- sal_Int32 nXMargin = (aShapeRectHmm.Width - aBitmapSize.Width) / 2;
- sal_Int32 nYMargin = (aShapeRectHmm.Height - aBitmapSize.Height) / 2;
- if (nXMargin > 0 && nYMargin > 0)
- {
- text::GraphicCrop aGraphicCrop;
- aGraphicCrop.Top = nYMargin * -1;
- aGraphicCrop.Bottom = nYMargin * -1;
- aGraphicCrop.Left = nXMargin * -1;
- aGraphicCrop.Right = nXMargin * -1;
- aShapeProps.setProperty(PROP_GraphicCrop, aGraphicCrop);
- }
- }
- }
-
PropertySet( xSet ).setProperties( aShapeProps );
if (mpTablePropertiesPtr && aServiceName == "com.sun.star.drawing.TableShape")
@@ -1873,6 +1843,13 @@ Reference< XShape > const & Shape::createAndInsert(
aPropertySet.setAnyProperty( PROP_VertOrientPosition, Any( maPosition.Y ) );
}
+ // Make sure to not set text to placeholders. Doing it here would eventually call
+ // SvxTextEditSourceImpl::UpdateData, SdrObject::SetEmptyPresObj(false), and that
+ // would make the object behave like a standard outline object.
+ // TODO/FIXME: support custom prompt text in placeholders.
+ if (rServiceName == "com.sun.star.presentation.GraphicObjectShape")
+ mpTextBody.reset();
+
// in some cases, we don't have any text body.
if( mpTextBody && ( !bDoNotInsertEmptyTextBody || !mpTextBody->isEmpty() ) )
{