include/oox/export/drawingml.hxx | 13 ++++++- include/oox/export/shapes.hxx | 2 - oox/source/export/drawingml.cxx | 68 +++++++++++++++++++++++++++++++++------ oox/source/export/shapes.cxx | 4 +- vcl/unx/gtk3/gtkinst.cxx | 19 ++++++++++ 5 files changed, 92 insertions(+), 14 deletions(-)
New commits: commit 6c4e61fcc73574eb5d55cc0bcb3c6ff8d69debc6 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Wed Jun 16 09:18:00 2021 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Wed Jun 16 15:01:40 2021 +0200 gtk4: reenable some more working dialogs Change-Id: Iaa8d77b231f8366ff4c33221691e9a3cadb73fa4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117312 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx index b8ece3292b5d..6e5917a40356 100644 --- a/vcl/unx/gtk3/gtkinst.cxx +++ b/vcl/unx/gtk3/gtkinst.cxx @@ -22245,12 +22245,15 @@ weld::Builder* GtkInstance::CreateBuilder(weld::Widget* pParent, const OUString& rUIFile != "cui/ui/areatabpage.ui" && rUIFile != "cui/ui/autocorrectdialog.ui" && rUIFile != "cui/ui/bitmaptabpage.ui" && + rUIFile != "cui/ui/borderpage.ui" && rUIFile != "cui/ui/breaknumberoption.ui" && rUIFile != "cui/ui/colorpage.ui" && rUIFile != "cui/ui/colorpickerdialog.ui" && rUIFile != "cui/ui/editdictionarydialog.ui" && rUIFile != "cui/ui/eventassigndialog.ui" && rUIFile != "cui/ui/eventassignpage.ui" && + rUIFile != "cui/ui/gradientpage.ui" && + rUIFile != "cui/ui/hatchpage.ui" && rUIFile != "cui/ui/hangulhanjaadddialog.ui" && rUIFile != "cui/ui/hangulhanjaconversiondialog.ui" && rUIFile != "cui/ui/hangulhanjaeditdictdialog.ui" && @@ -22268,13 +22271,20 @@ weld::Builder* GtkInstance::CreateBuilder(weld::Widget* pParent, const OUString& rUIFile != "cui/ui/macroassignpage.ui" && rUIFile != "cui/ui/macroselectordialog.ui" && rUIFile != "cui/ui/namedialog.ui" && + rUIFile != "cui/ui/numberingoptionspage.ui" && + rUIFile != "cui/ui/numberingpositionpage.ui" && rUIFile != "cui/ui/objectnamedialog.ui" && rUIFile != "cui/ui/objecttitledescdialog.ui" && rUIFile != "cui/ui/optjsearchpage.ui" && rUIFile != "cui/ui/optlingupage.ui" && rUIFile != "cui/ui/optnewdictionarydialog.ui" && rUIFile != "cui/ui/pastespecial.ui" && + rUIFile != "cui/ui/patterntabpage.ui" && rUIFile != "cui/ui/percentdialog.ui" && + rUIFile != "cui/ui/pickbulletpage.ui" && + rUIFile != "cui/ui/pickgraphicpage.ui" && + rUIFile != "cui/ui/picknumberingpage.ui" && + rUIFile != "cui/ui/pickoutlinepage.ui" && rUIFile != "cui/ui/qrcodegen.ui" && rUIFile != "cui/ui/scriptorganizer.ui" && rUIFile != "cui/ui/searchattrdialog.ui" && @@ -22286,6 +22296,7 @@ weld::Builder* GtkInstance::CreateBuilder(weld::Widget* pParent, const OUString& rUIFile != "cui/ui/thesaurus.ui" && rUIFile != "cui/ui/tipofthedaydialog.ui" && rUIFile != "cui/ui/toolbarmodedialog.ui" && + rUIFile != "cui/ui/transparencytabpage.ui" && rUIFile != "cui/ui/wordcompletionpage.ui" && rUIFile != "cui/ui/zoomdialog.ui" && rUIFile != "filter/ui/pdfgeneralpage.ui" && @@ -22313,6 +22324,7 @@ weld::Builder* GtkInstance::CreateBuilder(weld::Widget* pParent, const OUString& rUIFile != "sfx/ui/password.ui" && rUIFile != "sfx/ui/printeroptionsdialog.ui" && rUIFile != "sfx/ui/safemodequerydialog.ui" && + rUIFile != "sfx/ui/saveastemplatedlg.ui" && rUIFile != "sfx/ui/securityinfopage.ui" && rUIFile != "sfx/ui/singletabdialog.ui" && rUIFile != "sfx/ui/templatecategorydlg.ui" && @@ -22330,6 +22342,7 @@ weld::Builder* GtkInstance::CreateBuilder(weld::Widget* pParent, const OUString& rUIFile != "svx/ui/chineseconversiondialog.ui" && rUIFile != "svx/ui/chinesedictionary.ui" && rUIFile != "svx/ui/colorwindow.ui" && + rUIFile != "svx/ui/docrecoveryprogressdialog.ui" && rUIFile != "svx/ui/docrecoverysavedialog.ui" && rUIFile != "svx/ui/findreplacedialog.ui" && rUIFile != "svx/ui/fontworkgallerydialog.ui" && @@ -22399,6 +22412,7 @@ weld::Builder* GtkInstance::CreateBuilder(weld::Widget* pParent, const OUString& rUIFile != "modules/smath/ui/symdefinedialog.ui" && rUIFile != "modules/swriter/ui/autotext.ui" && rUIFile != "modules/swriter/ui/bibliographyentry.ui" && + rUIFile != "modules/swriter/ui/bulletsandnumbering.ui" && rUIFile != "modules/swriter/ui/columndialog.ui" && rUIFile != "modules/swriter/ui/columnpage.ui" && rUIFile != "modules/swriter/ui/editcategories.ui" && @@ -22407,6 +22421,10 @@ weld::Builder* GtkInstance::CreateBuilder(weld::Widget* pParent, const OUString& rUIFile != "modules/swriter/ui/footendnotedialog.ui" && rUIFile != "modules/swriter/ui/footnotepage.ui" && rUIFile != "modules/swriter/ui/footnotesendnotestabpage.ui" && + rUIFile != "modules/swriter/ui/framedialog.ui" && + rUIFile != "modules/swriter/ui/frmaddpage.ui" && + rUIFile != "modules/swriter/ui/frmtypepage.ui" && + rUIFile != "modules/swriter/ui/frmurlpage.ui" && rUIFile != "modules/swriter/ui/gotopagedialog.ui" && rUIFile != "modules/swriter/ui/indentpage.ui" && rUIFile != "modules/swriter/ui/indexentry.ui" && @@ -22429,6 +22447,7 @@ weld::Builder* GtkInstance::CreateBuilder(weld::Widget* pParent, const OUString& rUIFile != "modules/swriter/ui/statisticsinfopage.ui" && rUIFile != "modules/swriter/ui/titlepage.ui" && rUIFile != "modules/swriter/ui/watermarkdialog.ui" && + rUIFile != "modules/swriter/ui/wrappage.ui" && rUIFile != "modules/swriter/ui/wordcount.ui" && rUIFile != "vcl/ui/printdialog.ui" && rUIFile != "vcl/ui/printerdevicepage.ui" && commit 0f9dc676eefce79ea63218edd910af486a09a52b Author: Sarper Akdemir <sarper.akde...@collabora.com> AuthorDate: Wed Jun 9 07:58:44 2021 +0300 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Wed Jun 16 15:01:19 2021 +0200 tdf#59323: pptx export: add initial support for lstStyles in textboxes Adds initial support for writing lstStyles that are specific to a shape. Current implementation only writes first paragraph and first textruns properties in it. Made WriteParagraphProperties return a bool that determines whether or not it wrote a pPr tag. Needed this since lvl1pPr tag should be started even if there was no paragraph properties since run properties also written inside it. Change-Id: Ie0cfc9b9f221093db3a1111ca29140a6dfb5e8ad Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117011 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmik...@collabora.com> diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx index 7f6de9f99006..c90e1c06a844 100644 --- a/include/oox/export/drawingml.hxx +++ b/include/oox/export/drawingml.hxx @@ -276,10 +276,19 @@ public: void WriteTransformation(const css::uno::Reference< css::drawing::XShape >& xShape, const tools::Rectangle& rRectangle, sal_Int32 nXmlNamespace, bool bFlipH = false, bool bFlipV = false, sal_Int32 nRotation = 0, bool bIsGroupShape = false); - void WriteText( const css::uno::Reference< css::uno::XInterface >& rXIface, bool bBodyPr, bool bText = true, sal_Int32 nXmlNamespace = 0); + void WriteText( const css::uno::Reference< css::uno::XInterface >& rXIface, bool bBodyPr, bool bText = true, sal_Int32 nXmlNamespace = 0, bool bWritePropertiesAsLstStyles = false); + + /** Populates the lstStyle with the shape's text run and paragraph properties */ + void WriteLstStyles(const css::uno::Reference<css::text::XTextContent>& rParagraph, + bool& rbOverridingCharHeight, sal_Int32& rnCharHeight, + const css::uno::Reference<css::beans::XPropertySet>& rXShapePropSet); void WriteParagraph( const css::uno::Reference< css::text::XTextContent >& rParagraph, bool& rbOverridingCharHeight, sal_Int32& rnCharHeight, const css::uno::Reference< css::beans::XPropertySet >& rXShapePropSet); - void WriteParagraphProperties(const css::uno::Reference< css::text::XTextContent >& rParagraph, float fFirstCharHeight); + /** Writes paragraph properties + + @returns true if any paragraph properties were written + */ + bool WriteParagraphProperties(const css::uno::Reference< css::text::XTextContent >& rParagraph, float fFirstCharHeight, const sal_Int32 nElement = XML_pPr ); void WriteParagraphNumbering(const css::uno::Reference< css::beans::XPropertySet >& rXPropSet, float fFirstCharHeight, sal_Int16 nLevel ); void WriteParagraphTabStops(const css::uno::Reference<css::beans::XPropertySet>& rXPropSet); diff --git a/include/oox/export/shapes.hxx b/include/oox/export/shapes.hxx index 6ac3aa754cc5..3e9bf364d400 100644 --- a/include/oox/export/shapes.hxx +++ b/include/oox/export/shapes.hxx @@ -179,7 +179,7 @@ public: * @return <tt>*this</tt> */ ShapeExport& WriteShape( const css::uno::Reference< css::drawing::XShape >& xShape ); - ShapeExport& WriteTextBox( const css::uno::Reference< css::uno::XInterface >& xIface, sal_Int32 nXmlNamespace ); + ShapeExport& WriteTextBox( const css::uno::Reference< css::uno::XInterface >& xIface, sal_Int32 nXmlNamespace, bool bWritePropertiesAsLstStyles = false ); virtual ShapeExport& WriteTextShape( const css::uno::Reference< css::drawing::XShape >& xShape ); ShapeExport& diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 26598636efbd..76874c5b1493 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -1899,7 +1899,7 @@ void DrawingML::WriteRunProperties( const Reference< XPropertySet >& rRun, bool else if (GetProperty(rXPropSet, "CharHeight")) { nSize = static_cast<sal_Int32>(100*(*o3tl::doAccess<float>(mAny))); - if ( nElement == XML_rPr ) + if ( nElement == XML_rPr || nElement == XML_defRPr ) { rbOverridingCharHeight = true; rnCharHeight = nSize; @@ -2822,14 +2822,14 @@ void DrawingML::WriteLinespacing( const LineSpacing& rSpacing ) } } -void DrawingML::WriteParagraphProperties( const Reference< XTextContent >& rParagraph, float fFirstCharHeight) +bool DrawingML::WriteParagraphProperties( const Reference< XTextContent >& rParagraph, float fFirstCharHeight, sal_Int32 nElement) { Reference< XPropertySet > rXPropSet( rParagraph, UNO_QUERY ); Reference< XPropertyState > rXPropState( rParagraph, UNO_QUERY ); PropertyState eState; if( !rXPropSet.is() || !rXPropState.is() ) - return; + return false; sal_Int16 nLevel = -1; if (GetProperty(rXPropSet, "NumberingLevel")) @@ -2878,17 +2878,17 @@ void DrawingML::WriteParagraphProperties( const Reference< XTextContent >& rPara if( !(nLevel != -1 || nAlignment != style::ParagraphAdjust_LEFT || bHasLinespacing) ) - return; + return false; if (nParaLeftMargin) // For Paragraph - mpFS->startElementNS( XML_a, XML_pPr, + mpFS->startElementNS( XML_a, nElement, XML_lvl, sax_fastparser::UseIf(OString::number(nLevel), nLevel > 0), XML_marL, sax_fastparser::UseIf(OString::number(oox::drawingml::convertHmmToEmu(nParaLeftMargin)), nParaLeftMargin > 0), XML_indent, sax_fastparser::UseIf(OString::number(oox::drawingml::convertHmmToEmu(nParaFirstLineIndent)), nParaFirstLineIndent != 0), XML_algn, GetAlignment( nAlignment ), XML_rtl, sax_fastparser::UseIf(ToPsz10(bRtl), bRtl)); else - mpFS->startElementNS( XML_a, XML_pPr, + mpFS->startElementNS( XML_a, nElement, XML_lvl, sax_fastparser::UseIf(OString::number(nLevel), nLevel > 0), XML_marL, sax_fastparser::UseIf(OString::number(oox::drawingml::convertHmmToEmu(nLeftMargin)), nLeftMargin > 0), XML_indent, sax_fastparser::UseIf(OString::number(oox::drawingml::convertHmmToEmu(nLineIndentation)), nLineIndentation != 0), @@ -2927,7 +2927,50 @@ void DrawingML::WriteParagraphProperties( const Reference< XTextContent >& rPara WriteParagraphTabStops( rXPropSet ); - mpFS->endElementNS( XML_a, XML_pPr ); + // do not end element for lstStyles since, defRPr should be stacked inside it + if( nElement != XML_lvl1pPr ) + mpFS->endElementNS( XML_a, nElement ); + + return true; +} + +void DrawingML::WriteLstStyles(const css::uno::Reference<css::text::XTextContent>& rParagraph, + bool& rbOverridingCharHeight, sal_Int32& rnCharHeight, + const css::uno::Reference<css::beans::XPropertySet>& rXShapePropSet) +{ + Reference<XEnumerationAccess> access(rParagraph, UNO_QUERY); + if (!access.is()) + return; + + Reference<XEnumeration> enumeration(access->createEnumeration()); + if (!enumeration.is()) + return; + + + Reference<XTextRange> rRun; + + if (enumeration->hasMoreElements()) + { + Any aAny(enumeration->nextElement()); + if (aAny >>= rRun) + { + float fFirstCharHeight = rnCharHeight / 1000.; + Reference<XPropertySet> xFirstRunPropSet(rRun, UNO_QUERY); + Reference<XPropertySetInfo> xFirstRunPropSetInfo + = xFirstRunPropSet->getPropertySetInfo(); + + if (xFirstRunPropSetInfo->hasPropertyByName("CharHeight")) + fFirstCharHeight = xFirstRunPropSet->getPropertyValue("CharHeight").get<float>(); + + mpFS->startElementNS(XML_a, XML_lstStyle); + if( !WriteParagraphProperties(rParagraph, fFirstCharHeight, XML_lvl1pPr) ) + mpFS->startElementNS(XML_a, XML_lvl1pPr); + WriteRunProperties(xFirstRunPropSet, false, XML_defRPr, true, rbOverridingCharHeight, + rnCharHeight, GetScriptType(rRun->getString()), rXShapePropSet); + mpFS->endElementNS(XML_a, XML_lvl1pPr); + mpFS->endElementNS(XML_a, XML_lstStyle); + } + } } void DrawingML::WriteParagraph( const Reference< XTextContent >& rParagraph, @@ -3005,7 +3048,7 @@ bool DrawingML::IsFontworkShape(const css::uno::Reference<css::beans::XPropertyS } void DrawingML::WriteText(const Reference<XInterface>& rXIface, bool bBodyPr, bool bText, - sal_Int32 nXmlNamespace) + sal_Int32 nXmlNamespace, bool bWritePropertiesAsLstStyles) { // ToDo: Fontwork in DOCX Reference< XText > xXText( rXIface, UNO_QUERY ); @@ -3433,6 +3476,7 @@ void DrawingML::WriteText(const Reference<XInterface>& rXIface, bool bBodyPr, bo bool bOverridingCharHeight = false; sal_Int32 nCharHeight = -1; + bool bFirstParagraph = true; while( enumeration->hasMoreElements() ) { @@ -3440,7 +3484,13 @@ void DrawingML::WriteText(const Reference<XInterface>& rXIface, bool bBodyPr, bo Any any ( enumeration->nextElement() ); if( any >>= paragraph) - WriteParagraph( paragraph, bOverridingCharHeight, nCharHeight, rXPropSet ); + { + if (bFirstParagraph && bWritePropertiesAsLstStyles) + WriteLstStyles(paragraph, bOverridingCharHeight, nCharHeight, rXPropSet); + + WriteParagraph(paragraph, bOverridingCharHeight, nCharHeight, rXPropSet); + bFirstParagraph = false; + } } } diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx index f45b0aabc61d..323b0ebcc2f5 100644 --- a/oox/source/export/shapes.cxx +++ b/oox/source/export/shapes.cxx @@ -1552,7 +1552,7 @@ ShapeExport& ShapeExport::WriteShape( const Reference< XShape >& xShape ) return *this; } -ShapeExport& ShapeExport::WriteTextBox( const Reference< XInterface >& xIface, sal_Int32 nXmlNamespace ) +ShapeExport& ShapeExport::WriteTextBox( const Reference< XInterface >& xIface, sal_Int32 nXmlNamespace, bool bWritePropertiesAsLstStyles ) { // In case this shape has an associated textbox, then export that, and we're done. if (GetDocumentType() == DOCUMENT_DOCX && GetTextExport()) @@ -1577,7 +1577,7 @@ ShapeExport& ShapeExport::WriteTextBox( const Reference< XInterface >& xIface, s pFS->startElementNS(nXmlNamespace, (GetDocumentType() != DOCUMENT_DOCX ? XML_txBody : XML_txbx)); - WriteText( xIface, /*bBodyPr=*/(GetDocumentType() != DOCUMENT_DOCX) ); + WriteText( xIface, /*bBodyPr=*/(GetDocumentType() != DOCUMENT_DOCX), true, 0, bWritePropertiesAsLstStyles ); pFS->endElementNS( nXmlNamespace, (GetDocumentType() != DOCUMENT_DOCX ? XML_txBody : XML_txbx) ); if (GetDocumentType() == DOCUMENT_DOCX) WriteText( xIface, /*bBodyPr=*/true, /*bText=*/false, /*nXmlNamespace=*/nXmlNamespace ); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits