sd/qa/unit/import-tests-smartart.cxx | 1 - sw/source/filter/ww8/docxattributeoutput.cxx | 27 +++++++++++++++------------ sw/source/filter/ww8/docxattributeoutput.hxx | 18 +++++++++++++++++- 3 files changed, 32 insertions(+), 14 deletions(-)
New commits: commit 499247966af565071542f1cdfa882d6b8e6c33f0 Author: Justin Luth <justin.l...@collabora.com> AuthorDate: Tue Apr 11 11:19:56 2023 -0400 Commit: Justin Luth <jl...@mail.com> CommitDate: Thu Apr 13 21:04:12 2023 +0200 NFC tdf#154703 docx export framePr: cleanup prep before patch This sets up the building blocks for a series of patches. Lets get this formatting/renaming stuff out of the way first so that we can focus on the actual logic changes later on. Change-Id: I20aa333080d9f31af4f4b9e89a51eafba1d39530 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150354 Reviewed-by: Justin Luth <jl...@mail.com> Tested-by: Jenkins diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 8f7a5b9d7bf1..06915e5c4b17 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -575,6 +575,12 @@ OString DocxAttributeOutput::convertToOOXMLHoriOrientRel(sal_Int16 nOrientRel) } } +void FramePrHelper::SetFrame(ww8::Frame* pFrame) +{ + assert(!pFrame || !m_pFrame); + m_pFrame = pFrame; +} + void SdtBlockHelper::DeleteAndResetTheLists() { if (m_pTokenChildren.is() ) @@ -1099,9 +1105,9 @@ void DocxAttributeOutput::EndParagraph( ww8::WW8TableNodeInfoInner::Pointer_t pT for ( const auto & pFrame : aFramePrTextbox ) { DocxTableExportContext aTableExportContext(*this); - m_pCurrentFrame = pFrame.get(); + m_aFramePr.SetFrame(pFrame.get()); m_rExport.SdrExporter().writeOnlyTextOfFrame(pFrame.get()); - m_pCurrentFrame = nullptr; + m_aFramePr.SetFrame(nullptr); } m_pSerializer->mergeTopMarks(Tag_StartParagraph_2, sax_fastparser::MergeMarks::PREPEND); @@ -1477,16 +1483,14 @@ void DocxAttributeOutput::EndParagraphProperties(const SfxItemSet& rParagraphMar m_pSerializer->mergeTopMarks(Tag_InitCollectedRunProperties); m_pSerializer->endElementNS( XML_w, XML_rPr ); - if (!m_bWritingHeaderFooter && m_pCurrentFrame) + if (!m_bWritingHeaderFooter && m_aFramePr.Frame()) { - const SwFrameFormat& rFrameFormat = m_pCurrentFrame->GetFrameFormat(); - const SvxBoxItem& rBox = rFrameFormat.GetBox(); - if (TextBoxIsFramePr(rFrameFormat)) - { - const Size aSize = m_pCurrentFrame->GetSize(); - PopulateFrameProperties(&rFrameFormat, aSize); - FormatBox(rBox); - } + const SwFrameFormat& rFrameFormat = m_aFramePr.Frame()->GetFrameFormat(); + assert(TextBoxIsFramePr(rFrameFormat) && "by definition, because Frame()"); + + const Size aSize = m_aFramePr.Frame()->GetSize(); + PopulateFrameProperties(&rFrameFormat, aSize); + FormatBox(rFrameFormat.GetBox()); } m_pSerializer->endElementNS( XML_w, XML_pPr ); @@ -9852,7 +9856,6 @@ DocxAttributeOutput::DocxAttributeOutput( DocxExport &rExport, const FSHelperPtr m_nNextAnnotationMarkId( 0 ), m_nEmbedFlyLevel(0), m_pMoveRedlineData(nullptr), - m_pCurrentFrame( nullptr ), m_bParagraphOpened( false ), m_bParagraphFrameOpen( false ), m_bIsFirstParagraph( true ), diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx index 1d44240be9e5..5df2db780980 100644 --- a/sw/source/filter/ww8/docxattributeoutput.hxx +++ b/sw/source/filter/ww8/docxattributeoutput.hxx @@ -124,6 +124,22 @@ struct TableReference } }; +/** Using framePr, a paragraph can be enclosed in a frame described by its pPr paragraph settings, + * and therefore it needs to apply the frame's properties when exporting the paragraph properties. + */ +class FramePrHelper +{ + ww8::Frame* m_pFrame; + +public: + FramePrHelper() + : m_pFrame(nullptr) + {} + + ww8::Frame* Frame() { return m_pFrame; } + void SetFrame(ww8::Frame* pSet); +}; + class SdtBlockHelper { public: @@ -900,7 +916,7 @@ private: /// The current table helper std::unique_ptr<SwWriteTable> m_xTableWrt; - ww8::Frame* m_pCurrentFrame; + FramePrHelper m_aFramePr; bool m_bParagraphOpened; bool m_bParagraphFrameOpen; commit 6cd14af780efb5704538622b6d95c2a1ba3dc7dc Author: Stephan Bergmann <sberg...@redhat.com> AuthorDate: Thu Apr 13 15:53:48 2023 +0200 Commit: Stephan Bergmann <sberg...@redhat.com> CommitDate: Thu Apr 13 21:04:06 2023 +0200 -Werror,-Wunused-variable Unused ever since it got introduced in ea331fa8b498c66ec687c6611c69ffc61e58bc79 "tdf#131553: Add unittest". (Found with an experimental Clang build supporting __attribute__((warn_unused)) on individual ctors rather than just whole class types, and the corresponding css::uno::Reference ctor marked accordingly.) Change-Id: I9841713baf718be5b19d25acb35f3b856a94e1cf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150358 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sberg...@redhat.com> diff --git a/sd/qa/unit/import-tests-smartart.cxx b/sd/qa/unit/import-tests-smartart.cxx index 049a64eb0193..0a519c117b52 100644 --- a/sd/qa/unit/import-tests-smartart.cxx +++ b/sd/qa/unit/import-tests-smartart.cxx @@ -1412,7 +1412,6 @@ CPPUNIT_TEST_FIXTURE(SdImportTestSmartArt, testOrgChart2) CPPUNIT_TEST_FIXTURE(SdImportTestSmartArt, testTdf131553) { createSdImpressDoc("pptx/tdf131553.pptx"); - uno::Reference<drawing::XShape> xGroup(getShapeFromPage(0, 0), uno::UNO_QUERY); const SdrPage* pPage = GetPage(1); const SdrObjGroup* pObjGroup = dynamic_cast<SdrObjGroup*>(pPage->GetObj(0));