include/oox/drawingml/shape.hxx | 3 ++ oox/source/drawingml/shape.cxx | 2 + oox/source/drawingml/shapecontext.cxx | 2 + oox/source/drawingml/textparagraphproperties.cxx | 2 + oox/source/ppt/pptshape.cxx | 10 +++++-- sd/qa/unit/data/pptx/formatting-bullet-indent.pptx |binary sd/qa/unit/data/pptx/shape-master-text.pptx |binary sd/qa/unit/import-tests2.cxx | 29 +++++++++++++++++++++ 8 files changed, 46 insertions(+), 2 deletions(-)
New commits: commit 52516f695228d07d872bcd0a427c289c4d836952 Author: Szymon Kłos <[email protected]> AuthorDate: Fri Jul 28 12:16:36 2023 +0200 Commit: Xisco Fauli <[email protected]> CommitDate: Tue Aug 8 10:20:18 2023 +0200 pptx: import ellipse shape correctly Preset geometry "ellipse" was ignored: <a:prstGeom prst="ellipse"> Don't change service name to com.sun.star.presentation.OutlinerShape it should stay CustomShape to be correctly shown as an ellipse. Added next case: XML_body subtype in Layout and Slide mode. This is continuation for: commit 6df267780c4d41b41101c1be0a954b2f16ee8012 tdf#132557: PPTX import: Workaround for slide footer shape presets Signed-off-by: Szymon Kłos <[email protected]> Change-Id: Ifb914c58203a1ad533f9cc9b1857a48983354de6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155015 Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-by: Henry Castro <[email protected]> (cherry picked from commit e63a9553c022a9976d59113938df068f9d2b5d6c) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155233 Tested-by: Jenkins Signed-off-by: Xisco Fauli <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155418 diff --git a/oox/source/ppt/pptshape.cxx b/oox/source/ppt/pptshape.cxx index 0a4e5ecb7704..9634d44e83fe 100644 --- a/oox/source/ppt/pptshape.cxx +++ b/oox/source/ppt/pptshape.cxx @@ -336,8 +336,10 @@ void PPTShape::addShape( // Need to use service name css.drawing.CustomShape if they have a non default shape. // This workaround has the drawback of them not really being processed as placeholders // so it is only done for slide footers... - if ((mnSubType == XML_sldNum || mnSubType == XML_dt || mnSubType == XML_ftr) - && meShapeLocation == Slide && !mpCustomShapePropertiesPtr->representsDefaultShape()) + bool convertInSlideMode = meShapeLocation == Slide && + (mnSubType == XML_sldNum || mnSubType == XML_dt || mnSubType == XML_ftr || mnSubType == XML_body); + bool convertInLayoutMode = meShapeLocation == Layout && (mnSubType == XML_body); + if ((convertInSlideMode || convertInLayoutMode) && !mpCustomShapePropertiesPtr->representsDefaultShape()) { sServiceName = "com.sun.star.drawing.CustomShape"; } commit 40c9ed2f510a6fd61606554810d0115b6a228ccb Author: Szymon Kłos <[email protected]> AuthorDate: Thu Aug 3 16:53:36 2023 +0200 Commit: Xisco Fauli <[email protected]> CommitDate: Tue Aug 8 10:20:10 2023 +0200 oox: default first line indent is 0 When First Line Indent was defined in paragraph properties Impress remembered that value and applied for the next paragraph. Let's set it to default value (0) if property is not set explicitly. Change-Id: I3b075fab594fce64d953553634a49b9769c9341c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155336 Tested-by: Jenkins Reviewed-by: Szymon Kłos <[email protected]> Signed-off-by: Xisco Fauli <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155417 diff --git a/oox/source/drawingml/textparagraphproperties.cxx b/oox/source/drawingml/textparagraphproperties.cxx index 8122c4e53324..df3d36a21003 100644 --- a/oox/source/drawingml/textparagraphproperties.cxx +++ b/oox/source/drawingml/textparagraphproperties.cxx @@ -494,6 +494,8 @@ void TextParagraphProperties::pushToPropSet( const ::oox::core::XmlFilterBase* p aPropSet.setProperty( PROP_ParaTabStops, aSeq ); } } + else + aPropSet.setProperty<sal_Int32>( PROP_ParaFirstLineIndent, 0); if ( moDefaultTabSize ) { diff --git a/sd/qa/unit/data/pptx/formatting-bullet-indent.pptx b/sd/qa/unit/data/pptx/formatting-bullet-indent.pptx new file mode 100644 index 000000000000..3140d7ce57f8 Binary files /dev/null and b/sd/qa/unit/data/pptx/formatting-bullet-indent.pptx differ diff --git a/sd/qa/unit/import-tests2.cxx b/sd/qa/unit/import-tests2.cxx index 0b168ef2bd91..4d197b364449 100644 --- a/sd/qa/unit/import-tests2.cxx +++ b/sd/qa/unit/import-tests2.cxx @@ -1900,6 +1900,24 @@ CPPUNIT_TEST_FIXTURE(SdImportTest2, testShapeMasterText) CPPUNIT_ASSERT_EQUAL(OUString("Custom"), xRun->getString()); } +CPPUNIT_TEST_FIXTURE(SdImportTest2, testIndentDuplication) +{ + createSdImpressDoc("pptx/formatting-bullet-indent.pptx"); + uno::Reference<beans::XPropertySet> xShape(getShapeFromPage(2, 0)); + + uno::Reference<beans::XPropertySet> const xParagraph1(getParagraphFromShape(0, xShape), + uno::UNO_QUERY_THROW); + sal_Int32 nIndent1; + xParagraph1->getPropertyValue("ParaFirstLineIndent") >>= nIndent1; + CPPUNIT_ASSERT_EQUAL(sal_Int32(2500), nIndent1); + + uno::Reference<beans::XPropertySet> const xParagraph2(getParagraphFromShape(1, xShape), + uno::UNO_QUERY_THROW); + sal_Int32 nIndent2; + xParagraph2->getPropertyValue("ParaFirstLineIndent") >>= nIndent2; + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), nIndent2); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ commit e00aed7f132d6afd60d15512989add4e360df2a9 Author: Szymon Kłos <[email protected]> AuthorDate: Thu Jul 27 08:43:59 2023 +0200 Commit: Xisco Fauli <[email protected]> CommitDate: Tue Aug 8 10:20:03 2023 +0200 pptx: import shape text from master page If shape has custom text defined in master page but no text itself - don't prefer placeholder text but text from master page. Change-Id: Id4f7aeca0e74ecd8565905cd656a182c1195fa30 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154980 Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-by: Henry Castro <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155335 Tested-by: Szymon Kłos <[email protected]> Reviewed-by: Szymon Kłos <[email protected]> Signed-off-by: Xisco Fauli <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155416 Tested-by: Jenkins diff --git a/include/oox/drawingml/shape.hxx b/include/oox/drawingml/shape.hxx index ccf477bef805..4c8be792e7f6 100644 --- a/include/oox/drawingml/shape.hxx +++ b/include/oox/drawingml/shape.hxx @@ -237,6 +237,8 @@ public: void setTxbxHasLinkedTxtBox( const bool rhs){ mbHasLinkedTxbx = rhs; }; const LinkedTxbxAttr& getLinkedTxbxAttributes() const { return maLinkedTxbxAttr; }; bool isLinkedTxbx() const { return mbHasLinkedTxbx; }; + void setHasCustomPrompt(bool bValue) { mbHasCustomPrompt = bValue; } + bool hasCustomPrompt() { return mbHasCustomPrompt; } void setZOrder(sal_Int32 nZOrder) { mnZOrder = nZOrder; } @@ -393,6 +395,7 @@ private: bool mbTextBox; ///< This shape has a textbox. LinkedTxbxAttr maLinkedTxbxAttr; bool mbHasLinkedTxbx; // this text box has linked text box ? + bool mbHasCustomPrompt; // indicates that it's not a generic placeholder css::uno::Sequence<css::beans::PropertyValue> maDiagramDoms; diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index 3318198123e6..049f4ab2d34a 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -150,6 +150,7 @@ Shape::Shape( const char* pServiceName, bool bDefaultHeight ) , mbWps( false ) , mbTextBox( false ) , mbHasLinkedTxbx( false ) +, mbHasCustomPrompt( false ) , maDiagramDoms( 0 ) , mpDiagramHelper( nullptr ) { @@ -194,6 +195,7 @@ Shape::Shape( const ShapePtr& pSourceShape ) , mbWps( pSourceShape->mbWps ) , mbTextBox( pSourceShape->mbTextBox ) , mbHasLinkedTxbx(false) +, mbHasCustomPrompt( pSourceShape->mbHasCustomPrompt ) , maDiagramDoms( pSourceShape->maDiagramDoms ) , mnZOrder(pSourceShape->mnZOrder) , mnZOrderOff(pSourceShape->mnZOrderOff) diff --git a/oox/source/drawingml/shapecontext.cxx b/oox/source/drawingml/shapecontext.cxx index 289cda8dfd66..3375f6f6dddd 100644 --- a/oox/source/drawingml/shapecontext.cxx +++ b/oox/source/drawingml/shapecontext.cxx @@ -89,6 +89,8 @@ ContextHandlerRef ShapeContext::onCreateContext( sal_Int32 aElementToken, const mpShapePtr->setSubType( rAttribs.getToken( XML_type, XML_obj ) ); if( rAttribs.hasAttribute( XML_idx ) ) mpShapePtr->setSubTypeIndex( rAttribs.getInteger( XML_idx, 0 ) ); + if( rAttribs.hasAttribute( XML_hasCustomPrompt ) ) + mpShapePtr->setHasCustomPrompt( rAttribs.getBool( XML_hasCustomPrompt, false ) ); break; // nvSpPr CT_ShapeNonVisual end diff --git a/oox/source/ppt/pptshape.cxx b/oox/source/ppt/pptshape.cxx index ddc3ea935a70..0a4e5ecb7704 100644 --- a/oox/source/ppt/pptshape.cxx +++ b/oox/source/ppt/pptshape.cxx @@ -455,6 +455,10 @@ void PPTShape::addShape( Reference < XText > xText(mxShape, UNO_QUERY); if (xText.is()) { + if (mpPlaceholder && mpPlaceholder->getTextBody() && !mpPlaceholder->getTextBody()->isEmpty() + && mpPlaceholder->hasCustomPrompt()) + xText->setString(mpPlaceholder->getTextBody()->toString()); + TextCharacterProperties aCharStyleProperties; getTextBody()->ApplyStyleEmpty(rFilterBase, xText, aCharStyleProperties, mpMasterTextListStyle); } diff --git a/sd/qa/unit/data/pptx/shape-master-text.pptx b/sd/qa/unit/data/pptx/shape-master-text.pptx new file mode 100644 index 000000000000..ca056b852d3a Binary files /dev/null and b/sd/qa/unit/data/pptx/shape-master-text.pptx differ diff --git a/sd/qa/unit/import-tests2.cxx b/sd/qa/unit/import-tests2.cxx index 55ab505fc603..0b168ef2bd91 100644 --- a/sd/qa/unit/import-tests2.cxx +++ b/sd/qa/unit/import-tests2.cxx @@ -1889,6 +1889,17 @@ CPPUNIT_TEST_FIXTURE(SdImportTest2, testOverflowBehaviorClip) } } +CPPUNIT_TEST_FIXTURE(SdImportTest2, testShapeMasterText) +{ + createSdImpressDoc("pptx/shape-master-text.pptx"); + uno::Reference<beans::XPropertySet> xShape(getShapeFromPage(0, 0)); + + uno::Reference<text::XTextRange> const xParagraph(getParagraphFromShape(0, xShape)); + + uno::Reference<text::XTextRange> xRun(getRunFromParagraph(0, xParagraph)); + CPPUNIT_ASSERT_EQUAL(OUString("Custom"), xRun->getString()); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
