[Libreoffice-commits] core.git: 2 commits - include/oox oox/source sd/qa
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 AuthorDate: Thu Aug 3 16:53:36 2023 +0200 Commit: Szymon Kłos 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 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( 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 ..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 xShape(getShapeFromPage(2, 0)); + +uno::Reference 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 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 AuthorDate: Thu Jul 27 08:43:59 2023 +0200 Commit: Szymon Kłos 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 Reviewed-by: Henry Castro Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155335 Tested-by: Szymon Kłos Reviewed-by: Szymon Kłos 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: voidsetTxbxHasLinkedTxtBox( const bool rhs){ mbHasLinkedTxbx = rhs; }; const LinkedTxbxAttr& getLinkedTxbxAttributes() const { return maLinkedTxbxAttr; }; boolisLinkedTxbx() const { return mbHasLinkedTxbx; }; +voidsetHasCustomPrompt(bool bValue) { mbHasCustomPrompt = bValue; } +boolhasCustomPrompt() { return mbHasCustomPrompt; } void setZOrder(sal_Int32 nZOrder) { mnZOrder = nZOrder; } @@ -393,6 +395,7 @@ private: bool mbTextBox; ///< This shape has a textbox. LinkedTxbxAttr maLinkedTxbxAttr; boolmbHasLinkedTxbx; // this text box has linked text box ? +boolmbHasCustomPrompt; // indicates that it's not a generic placeholder css::uno::Sequence maDiagramDoms; diff
[Libreoffice-commits] core.git: 2 commits - include/oox oox/source sd/qa
include/oox/export/shapes.hxx |1 oox/source/export/shapes.cxx | 90 +- sd/qa/unit/export-tests.cxx | 28 + 3 files changed, 109 insertions(+), 10 deletions(-) New commits: commit a951d70609fa125def231c3d7579e72c381334f5 Author: Michael StahlDate: Mon Jan 11 17:16:24 2016 +0100 oox: getEntryName() could throw a WrongStateException let's guard against that. Change-Id: I970fb801a642592d9c23390572867f0e21f03132 diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx index 0facbf1..b4e7b13 100644 --- a/oox/source/export/shapes.cxx +++ b/oox/source/export/shapes.cxx @@ -1678,15 +1678,24 @@ ShapeExport& ShapeExport::WriteOLE2Shape( Reference< XShape > xShape ) return *this; } -uno::Reference const xParent( -uno::Reference(xObj, uno::UNO_QUERY)->getParent(), -uno::UNO_QUERY); - uno::Sequence grabBag; -xParent->getPropertyValue("InteropGrabBag") >>= grabBag; +OUString entryName; +try +{ +uno::Reference const xParent( +uno::Reference(xObj, uno::UNO_QUERY_THROW)->getParent(), +uno::UNO_QUERY_THROW); + +xParent->getPropertyValue("InteropGrabBag") >>= grabBag; + +entryName = uno::Reference(xObj, uno::UNO_QUERY)->getEntryName(); +} +catch (uno::Exception const& e) +{ +SAL_WARN("oox", "ShapeExport::WriteOLE2Shape: exception: " << e.Message); +return *this; +} -OUString const entryName( -uno::Reference(xObj, uno::UNO_QUERY)->getEntryName()); OUString progID; for (auto const& it : grabBag) commit cb890ae43bacd2be24bc74fad2e2e5cce8910995 Author: Michael Stahl Date: Fri Jan 15 15:26:43 2016 +0100 oox: export Math objects to PPTX files These hit the assert in lcl_StoreOwnAsOOXML now so better implement some export. Change-Id: I10c005a547e8a85f2a82198a49f9a03fc46a61d7 diff --git a/include/oox/export/shapes.hxx b/include/oox/export/shapes.hxx index 29f597f..ab67def 100644 --- a/include/oox/export/shapes.hxx +++ b/include/oox/export/shapes.hxx @@ -180,6 +180,7 @@ public: WriteTextShape( css::uno::Reference< css::drawing::XShape > xShape ); ShapeExport& WriteTableShape( css::uno::Reference< css::drawing::XShape > xShape ); +void WriteMathShape(css::uno::Reference const& xShape); ShapeExport& WriteOLE2Shape( css::uno::Reference< css::drawing::XShape > xShape ); virtual ShapeExport& diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx index 8320aad..0facbf1 100644 --- a/oox/source/export/shapes.cxx +++ b/oox/source/export/shapes.cxx @@ -93,6 +93,7 @@ #include #include #include +#include using namespace ::css; using namespace ::css::beans; @@ -1578,13 +1579,64 @@ ShapeExport& ShapeExport::WriteTextShape( Reference< XShape > xShape ) return *this; } +void ShapeExport::WriteMathShape(Reference const& xShape) +{ +Reference const xPropSet(xShape, UNO_QUERY); +assert(xPropSet.is()); +Reference xMathModel; +xPropSet->getPropertyValue("Model") >>= xMathModel; +assert(xMathModel.is()); +assert(GetDocumentType() != DOCUMENT_DOCX); // should be written in DocxAttributeOutput +SAL_WARN_IF(GetDocumentType() == DOCUMENT_XLSX, "oox", "Math export to XLSX isn't tested, should it happen here?"); + +// ECMA standard does not actually allow oMath outside of +// WordProcessingML so write a MCE like PPT 2010 does +mpFS->startElementNS(XML_mc, XML_AlternateContent, FSEND); +mpFS->startElementNS(XML_mc, XML_Choice, +FSNS(XML_xmlns, XML_a14), "http://schemas.microsoft.com/office/drawing/2010/main;, +XML_Requires, "a14", +FSEND); +mpFS->startElementNS(mnXmlNamespace, XML_sp, FSEND); +mpFS->startElementNS(mnXmlNamespace, XML_nvSpPr, FSEND); +mpFS->singleElementNS(mnXmlNamespace, XML_cNvPr, + XML_id, OString::number(GetNewShapeID(xShape)).getStr(), + XML_name, OString("Formula " + OString::number(mnShapeIdMax++)).getStr(), + FSEND); +mpFS->singleElementNS(mnXmlNamespace, XML_cNvSpPr, XML_txBox, "1", FSEND); +mpFS->singleElementNS(mnXmlNamespace, XML_nvPr, FSEND); +mpFS->endElementNS(mnXmlNamespace, XML_nvSpPr); +mpFS->startElementNS(mnXmlNamespace, XML_spPr, FSEND); +WriteShapeTransformation(xShape, XML_a); +WritePresetShape("rect"); +mpFS->endElementNS(mnXmlNamespace, XML_spPr); +mpFS->startElementNS(mnXmlNamespace, XML_txBody, FSEND); +mpFS->startElementNS(XML_a, XML_bodyPr, FSEND); +mpFS->endElementNS(XML_a, XML_bodyPr); +mpFS->startElementNS(XML_a, XML_p, FSEND); +mpFS->startElementNS(XML_a14, XML_m, FSEND); + +oox::FormulaExportBase *const
[Libreoffice-commits] core.git: 2 commits - include/oox oox/source sd/qa
include/oox/drawingml/shape.hxx |4 include/oox/drawingml/textliststyle.hxx |3 include/oox/ppt/pptshapegroupcontext.hxx|3 oox/source/drawingml/diagram/diagram.cxx| 39 ++-- oox/source/drawingml/diagram/diagramfragmenthandler.cxx | 49 ++--- oox/source/drawingml/textliststyle.cxx | 28 +++ oox/source/ppt/pptshapegroupcontext.cxx | 13 + sd/qa/unit/data/pptx/bnc870233_1.pptx |binary sd/qa/unit/data/pptx/bnc870233_2.pptx |binary sd/qa/unit/import-tests.cxx | 141 10 files changed, 239 insertions(+), 41 deletions(-) New commits: commit 639571d52b1b7e4cf912803642ca245c5dd86839 Author: Zolnai Tamás tamas.zol...@collabora.com Date: Fri Jun 6 10:16:39 2014 +0200 2nd part of bnc#870233: import font color from color fragment for SmartArts SmartArt import ignores some fragments during import if drawing fragment exists, which seems to be not complete. In this case font style is blank (white) in data (and drawing) fragment and the real value is defined in the ignored color fragment. So first make color fragment parsing work, then apply font color of node0 style on nodes of the SmartArt. Actually, it's a workaround, because node0 style label is hardcoded, for a proper solution layout fragment should be parsed too to get the right style label, but it interferes with the drawing fragment by now. Change-Id: I7db89176a07eee928563d42d3896fbd02190dfa8 diff --git a/include/oox/drawingml/shape.hxx b/include/oox/drawingml/shape.hxx index fcb4999..f8e1b7c 100644 --- a/include/oox/drawingml/shape.hxx +++ b/include/oox/drawingml/shape.hxx @@ -176,6 +176,9 @@ public: const ::std::vectorOUString getExtDrawings() { return maExtDrawings; } voidaddExtDrawingRelId( const OUString rRelId ) { maExtDrawings.push_back( rRelId ); } +// Set font color only for extdrawings. +voidsetFontRefColorForNodes(const Color rColor) { maFontRefColorForNodes = rColor; } +const ColorgetFontRefColorForNodes() const { return maFontRefColorForNodes; } voidsetLockedCanvas(bool bLockedCanvas); boolgetLockedCanvas(); voidsetWps(bool bWps); @@ -267,6 +270,7 @@ protected: com::sun::star::awt::Size maSize; com::sun::star::awt::Point maPosition; ::std::vectorOUStringmaExtDrawings; +Color maFontRefColorForNodes; private: enum FrameType diff --git a/include/oox/ppt/pptshapegroupcontext.hxx b/include/oox/ppt/pptshapegroupcontext.hxx index f4e1d7a..847d9b6 100644 --- a/include/oox/ppt/pptshapegroupcontext.hxx +++ b/include/oox/ppt/pptshapegroupcontext.hxx @@ -21,6 +21,7 @@ #define INCLUDED_OOX_PPT_PPTSHAPEGROUPCONTEXT_HXX #include oox/drawingml/shapegroupcontext.hxx +#include oox/drawingml/color.hxx #include oox/ppt/slidepersist.hxx namespace oox { namespace ppt { @@ -30,7 +31,9 @@ class PPTShapeGroupContext : public ::oox::drawingml::ShapeGroupContext SlidePersistPtr mpSlidePersistPtr; ShapeLocation meShapeLocation; oox::drawingml::ShapePtrpGraphicShape; + voidimportExtDrawings(); +voidapplyFontRefColor(oox::drawingml::ShapePtr pShape, const oox::drawingml::Color rFontRefColor); public: PPTShapeGroupContext( diff --git a/oox/source/drawingml/diagram/diagram.cxx b/oox/source/drawingml/diagram/diagram.cxx index 70d938a..a4ad279 100644 --- a/oox/source/drawingml/diagram/diagram.cxx +++ b/oox/source/drawingml/diagram/diagram.cxx @@ -320,7 +320,6 @@ void Diagram::build( ) #endif } - void Diagram::addTo( const ShapePtr pParentShape ) { // collect data, init maps @@ -432,7 +431,7 @@ void loadDiagram( ShapePtr pShape, } // extLst is present, lets bet on that and ignore the rest of the data from here -if( !pData-getExtDrawings().size() ) +if( pData-getExtDrawings().empty() ) { // layout if( !rLayoutPath.isEmpty() ) @@ -459,25 +458,33 @@ void loadDiagram( ShapePtr pShape, pDiagram, xRefQStyle); } - -// colors -if( !rColorStylePath.isEmpty() ) -{ -rtl::Reference core::FragmentHandler xRefColorStyle( -new ColorFragmentHandler( rFilter, rColorStylePath, pDiagram-getColors() )); - -importFragment(rFilter, -loadFragment(rFilter,xRefColorStyle), -OOXColor, -pDiagram, -xRefColorStyle); -} } else { // We still want to add the XDocuments to the DiagramDomMap DiagramDomMap rMainDomMap = pDiagram-getDomMap();
[Libreoffice-commits] core.git: 2 commits - include/oox oox/source sd/qa
include/oox/drawingml/textcharacterproperties.hxx |2 + oox/source/drawingml/textcharacterproperties.cxx|3 + oox/source/drawingml/textcharacterpropertiescontext.cxx |4 ++ sd/qa/unit/data/pptx/n862510_4.pptx |binary sd/qa/unit/import-tests.cxx | 27 5 files changed, 36 insertions(+) New commits: commit 186b96dcfbd0ed87ef414246555e9f953927d692 Author: Muthu Subramanian sumu...@collabora.com Date: Fri Mar 28 17:29:37 2014 +0530 Add unit test for text gradfill import. Change-Id: I803238fd21d1c73aae8146966a5e62e62ad48c5c diff --git a/sd/qa/unit/data/pptx/n862510_4.pptx b/sd/qa/unit/data/pptx/n862510_4.pptx new file mode 100644 index 000..0a461ee Binary files /dev/null and b/sd/qa/unit/data/pptx/n862510_4.pptx differ diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx index 81f6b8a..462e2ed 100644 --- a/sd/qa/unit/import-tests.cxx +++ b/sd/qa/unit/import-tests.cxx @@ -66,6 +66,7 @@ public: void testN862510_1(); void testN862510_2(); void testN862510_3(); +void testN862510_4(); void testFdo71961(); CPPUNIT_TEST_SUITE(SdFiltersTest); @@ -87,6 +88,7 @@ public: CPPUNIT_TEST(testN862510_1); CPPUNIT_TEST(testN862510_2); CPPUNIT_TEST(testN862510_3); +CPPUNIT_TEST(testN862510_4); CPPUNIT_TEST(testFdo71961); CPPUNIT_TEST_SUITE_END(); @@ -308,6 +310,31 @@ void SdFiltersTest::testN862510_3() } } +void SdFiltersTest::testN862510_4() +{ +::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc(/sd/qa/unit/data/pptx/n862510_4.pptx) ); +CPPUNIT_ASSERT_MESSAGE( failed to load, xDocShRef.Is() ); +CPPUNIT_ASSERT_MESSAGE( in destruction, !xDocShRef-IsInDestruction() ); + +SdDrawDocument *pDoc = xDocShRef-GetDoc(); +CPPUNIT_ASSERT_MESSAGE( no document, pDoc != NULL ); +const SdrPage *pPage = pDoc-GetPage( 1 ); +CPPUNIT_ASSERT_MESSAGE( no page, pPage != NULL ); +{ +std::vectorEECharAttrib rLst; +SdrObject *pObj = pPage-GetObj( 0 ); +SdrTextObj *pTxtObj = dynamic_castSdrTextObj *( pObj ); +CPPUNIT_ASSERT( pTxtObj ); +const EditTextObject aEdit = pTxtObj-GetOutlinerParaObject()-GetTextObject(); +aEdit.GetCharAttribs( 0, rLst ); +for( std::vectorEECharAttrib::reverse_iterator it = rLst.rbegin(); it != rLst.rend(); ++it ) +{ +const SvxColorItem *pC = dynamic_castconst SvxColorItem *( (*it).pAttr ); +CPPUNIT_ASSERT_MESSAGE( gradfill for text color not handled!, !( pC pC-GetValue().GetColor() == 0 ) ); +} +} +} + void SdFiltersTest::testN828390() { bool bPassed = false; commit cfc76de83e3c0a56abd30a8f3bd7c69d3500d223 Author: Muthu Subramanian sumu...@collabora.com Date: Fri Mar 28 17:24:45 2014 +0530 n#870234: Import gradfill for text colors. Uses the first color from the gradfill list. (Which is better than plain black!) Change-Id: I4c1c0c4b031f3681c95b75b3c0683eb4de95bffb diff --git a/include/oox/drawingml/textcharacterproperties.hxx b/include/oox/drawingml/textcharacterproperties.hxx index e51937f..4162c23 100644 --- a/include/oox/drawingml/textcharacterproperties.hxx +++ b/include/oox/drawingml/textcharacterproperties.hxx @@ -24,6 +24,7 @@ #include oox/helper/propertymap.hxx #include oox/drawingml/color.hxx #include oox/drawingml/textfont.hxx +#include oox/drawingml/fillproperties.hxx namespace oox { class PropertySet; } @@ -56,6 +57,7 @@ struct TextCharacterProperties OptValue bool moItalic; OptValue bool moUnderlineLineFollowText; OptValue bool moUnderlineFillFollowText; +GradientFillProperties maGradientProps; /// Properties for gradient text colors std::vectorcss::beans::PropertyValue maTextEffectsProperties; diff --git a/oox/source/drawingml/textcharacterproperties.cxx b/oox/source/drawingml/textcharacterproperties.cxx index 6f64f2a..5f7cf4f 100644 --- a/oox/source/drawingml/textcharacterproperties.cxx +++ b/oox/source/drawingml/textcharacterproperties.cxx @@ -65,6 +65,7 @@ void TextCharacterProperties::assignUsed( const TextCharacterProperties rSource moUnderlineFillFollowText.assignIfUsed( rSourceProps.moUnderlineFillFollowText ); maTextEffectsProperties = rSourceProps.maTextEffectsProperties; +maGradientProps.assignUsed( rSourceProps.maGradientProps ); } void TextCharacterProperties::pushToPropMap( PropertyMap rPropMap, const XmlFilterBase rFilter, bool bUseOptional ) const @@ -108,6 +109,8 @@ void TextCharacterProperties::pushToPropMap( PropertyMap rPropMap, const XmlFil if( maCharColor.isUsed() ) rPropMap.setProperty( PROP_CharColor, maCharColor.getColor( rFilter.getGraphicHelper() )); +if( maGradientProps.maGradientStops.size() 0 ) +rPropMap[ PROP_CharColor ] = maGradientProps.maGradientStops.begin()-second.getColor(