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 | 4 ++ 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, 42 insertions(+)
New commits: commit a68d39c34ea1e418deadc0a5ee2acc2019a582cf Author: Szymon Kłos <[email protected]> AuthorDate: Thu Aug 3 16:53:36 2023 +0200 Commit: Szymon Kłos <[email protected]> CommitDate: Fri Aug 4 10:17:33 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]> 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 ae3b97a69688553e6c40ef4b64655db09d5a0f5e Author: Szymon Kłos <[email protected]> AuthorDate: Thu Jul 27 08:43:59 2023 +0200 Commit: Szymon Kłos <[email protected]> CommitDate: Fri Aug 4 10:17:25 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]> 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 0fca9c0e1ac3..78a20b46861b 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 73fdab79508e..6407fb58a1f3 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 b6dd0f1c4603..a68ad18cf5b2 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: */
