summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--oox/source/drawingml/shape.cxx37
-rw-r--r--sd/qa/unit/export-tests-ooxml4.cxx22
2 files changed, 16 insertions, 43 deletions
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 5df335be727d..b4c50a91f730 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 <officecfg/Office/Common.hxx>
#include <svx/svdobj.hxx>
#include <svx/svdotable.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() ) )
{
diff --git a/sd/qa/unit/export-tests-ooxml4.cxx b/sd/qa/unit/export-tests-ooxml4.cxx
index cd3b5f5d5de4..9ebb88208cc1 100644
--- a/sd/qa/unit/export-tests-ooxml4.cxx
+++ b/sd/qa/unit/export-tests-ooxml4.cxx
@@ -751,22 +751,18 @@ CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testTdf147121)
CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testTdf140912_PicturePlaceholder)
{
- // FIXME: the DPI check should be removed when either (1) the test is fixed to work with
- // non-default DPI; or (2) unit tests on Windows are made to use svp VCL plugin.
- // -8490 in the test below turns into -8014 on my Windows box with 150% scaling.
- if (!IsDefaultDPI())
- return;
-
+ // Given a graphic placeholder with a custom prompt:
createSdImpressDoc("pptx/tdfpictureplaceholder.pptx");
uno::Reference<beans::XPropertySet> xShapeProps(getShapeFromPage(0, 0));
- bool bTextContourFrame = true;
- xShapeProps->getPropertyValue("TextContourFrame") >>= bTextContourFrame;
- CPPUNIT_ASSERT_EQUAL(false, bTextContourFrame);
-
- text::GraphicCrop aGraphicCrop;
- xShapeProps->getPropertyValue("GraphicCrop") >>= aGraphicCrop;
- CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(-8490), aGraphicCrop.Top);
+ bool isEmptyPresentationObject = false;
+ // Without the fix, it would not be imported as empty presentation object;
+ // the text would be treated as its content.
+ xShapeProps->getPropertyValue("IsEmptyPresentationObject") >>= isEmptyPresentationObject;
+ CPPUNIT_ASSERT(isEmptyPresentationObject);
+
+ // If we supported custom prompt text, here we would also test "String" property,
+ // which would be equal to "Insert Image".
}
CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testEnhancedPathViewBox)