Rebased ref, commits from common ancestor: commit c38ba97261c0af28cb48786a7ad7edcab1e85cb4 Author: Serge Krot <serge.k...@cib.de> AuthorDate: Tue Feb 11 16:04:26 2020 +0100 Commit: Serge Krot (CIB) <serge.k...@cib.de> CommitDate: Thu Feb 13 09:47:40 2020 +0100
tdf#130610 docx export: handle bold as toggle properties Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88460 Reviewed-by: Michael Stahl <michael.st...@cib.de> Tested-by: Jenkins Conflicts: sw/qa/extras/ooxmlexport/ooxmlexport14.cxx Change-Id: I4c60b7eab6430a64ea1c8bcf40d0036d0b38516f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88574 Tested-by: Jenkins Reviewed-by: Serge Krot (CIB) <serge.k...@cib.de> diff --git a/sw/qa/extras/ooxmlexport/data/tdf130610_bold_in_2_styles.ott b/sw/qa/extras/ooxmlexport/data/tdf130610_bold_in_2_styles.ott new file mode 100755 index 000000000000..35937d9a8aa3 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf130610_bold_in_2_styles.ott differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx index bb9e3932320f..2ddc72515991 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx @@ -18,6 +18,7 @@ #include <com/sun/star/text/TableColumnSeparator.hpp> #include <com/sun/star/text/RelOrientation.hpp> #include <com/sun/star/text/XDocumentIndex.hpp> +#include <com/sun/star/awt/FontWeight.hpp> class Test : public SwModelTestBase { @@ -90,6 +91,34 @@ DECLARE_OOXMLEXPORT_TEST(testTdf87569d, "tdf87569_drawingml.docx") text::RelOrientation::FRAME, nValue); } +DECLARE_OOXMLEXPORT_TEST(testTdf130610, "tdf130610_bold_in_2_styles.ott") +{ + // check character properties + { + uno::Reference<beans::XPropertySet> xStyle( + getStyles("CharacterStyles")->getByName("WollMuxRoemischeZiffer"), + uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Bold", awt::FontWeight::BOLD, getProperty<float>(xStyle, "CharWeight")); + } + + // check paragraph properties + { + uno::Reference<beans::XPropertySet> xStyle( + getStyles("ParagraphStyles")->getByName("WollMuxVerfuegungspunkt"), + uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Bold", awt::FontWeight::BOLD, getProperty<float>(xStyle, "CharWeight")); + } + + // check inline text properties + { + xmlDocPtr pXmlDoc =parseExport("word/document.xml"); + if (pXmlDoc) + { + assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/w:rPr/w:b"); + } + } +} + DECLARE_OOXMLEXPORT_TEST(testTdf120315, "tdf120315.docx") { // tdf#120315 cells of the second column weren't vertically merged diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx index 3df5950cff84..cac4cdf247e1 100644 --- a/sw/source/filter/ww8/wrtw8nds.cxx +++ b/sw/source/filter/ww8/wrtw8nds.cxx @@ -43,6 +43,7 @@ #include <editeng/formatbreakitem.hxx> #include <editeng/frmdiritem.hxx> #include <editeng/tstpitem.hxx> +#include <editeng/wghtitem.hxx> #include <svl/grabbagitem.hxx> #include <svl/urihelper.hxx> #include <svl/whiter.hxx> @@ -473,6 +474,12 @@ void SwWW8AttrIter::OutAttr( sal_Int32 nSwPos, bool bWriteCombChars) if ( pCharFormatItem ) ClearOverridesFromSet( *pCharFormatItem, aExportSet ); + // check toggle properties in DOCX output + { + SvxWeightItem aBoldProperty(WEIGHT_BOLD, RES_CHRATR_WEIGHT); + handleToggleProperty(aExportSet, pCharFormatItem, RES_CHRATR_WEIGHT, &aBoldProperty); + } + // tdf#113790: AutoFormat style overwrites char style, so remove all // elements from CHARFMT grab bag which are set in AUTOFMT grab bag if (const SfxGrabBagItem *pAutoFmtGrabBag = dynamic_cast<const SfxGrabBagItem*>(pGrabBag)) @@ -535,6 +542,64 @@ void SwWW8AttrIter::OutAttr( sal_Int32 nSwPos, bool bWriteCombChars) m_rExport.AttrOutput().OutputItem( *pGrabBag ); } +// Toggle Properties +// +// If the value of the toggle property appears at multiple levels of the style hierarchy (17.7.2), their +// effective values shall be combined as follows: +// +// value_{effective} = val_{table} XOR val_{paragraph} XOR val_{character} +// +// If the value specified by the document defaults is true, the effective value is true. +// Otherwise, the values are combined by a Boolean XOR as follows: +// i.e., the effective value to be applied to the content shall be true if its effective value is true for +// an odd number of levels of the style hierarchy. +// +// To prevent such logic inside output, it is required to write inline w:b token on content level. +void SwWW8AttrIter::handleToggleProperty(SfxItemSet& rExportSet, const SwFormatCharFormat* pCharFormatItem, + sal_uInt16 nWhich, const SfxPoolItem* pValue) +{ + if (!rExportSet.HasItem(nWhich) && pValue) + { + bool hasPropertyInCharStyle = false; + bool hasPropertyInParaStyle = false; + + // get bold flag from specified character style + if (pCharFormatItem) + { + if (const SwCharFormat* pCharFormat = pCharFormatItem->GetCharFormat()) + { + const SfxPoolItem* pItem = nullptr; + if (pCharFormat->GetAttrSet().HasItem(nWhich, &pItem)) + { + hasPropertyInCharStyle = (*pItem == *pValue); + } + } + } + + // get bold flag from specified paragraph style + { + SwTextFormatColl& rTextColl = static_cast<SwTextFormatColl&>( rNd.GetAnyFormatColl() ); + sal_uInt16 nStyle = m_rExport.m_pStyles->GetSlot( &rTextColl ); + nStyle = ( nStyle != 0xfff ) ? nStyle : 0; + const SwFormat* pFormat = m_rExport.m_pStyles->GetSwFormat(nStyle); + if (pFormat) + { + const SfxPoolItem* pItem = nullptr; + if (pFormat->GetAttrSet().HasItem(nWhich, &pItem)) + { + hasPropertyInParaStyle = (*pItem == *pValue); + } + } + } + + // add inline property + if (hasPropertyInCharStyle && hasPropertyInParaStyle) + { + rExportSet.Put(*pValue); + } + } +} + bool SwWW8AttrIter::IsWatermarkFrame() { if (maFlyFrames.size() != 1) diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx index 9824f52b7d84..8c9c324d0509 100644 --- a/sw/source/filter/ww8/wrtww8.hxx +++ b/sw/source/filter/ww8/wrtww8.hxx @@ -1527,6 +1527,8 @@ private: SwWW8AttrIter(const SwWW8AttrIter&) = delete; SwWW8AttrIter& operator=(const SwWW8AttrIter&) = delete; + + void handleToggleProperty(SfxItemSet& rExportSet, const SwFormatCharFormat* pCharFormatItem, sal_uInt16 nWhich, const SfxPoolItem* pValue); public: SwWW8AttrIter( MSWordExportBase& rWr, const SwTextNode& rNd ); commit d3e77bd112c3f7084b0dd92c36ff60f1fd1ddc2f Author: Xisco Faulí <xiscofa...@libreoffice.org> AuthorDate: Wed Feb 12 11:51:34 2020 +0100 Commit: Xisco Faulí <xiscofa...@libreoffice.org> CommitDate: Thu Feb 13 07:41:21 2020 +0100 tdf#130614: Revert "tdf#125520 Fix OLE objects drag&drop with 'Insert as Copy'" This reverts commit e4cea049c80f4fd6d2a586e73fe9fa08ebd08371. Change-Id: Ic925cb5660df152208cdc63bfee62d82fe912717 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88493 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <thorsten.behr...@cib.de> (cherry picked from commit 09e6824bc868990095233825c415556399dd0652) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88500 Reviewed-by: Xisco Faulí <xiscofa...@libreoffice.org> diff --git a/svx/source/svdraw/svdxcgv.cxx b/svx/source/svdraw/svdxcgv.cxx index f18d536b7bf2..8fcd742ec71f 100644 --- a/svx/source/svdraw/svdxcgv.cxx +++ b/svx/source/svdraw/svdxcgv.cxx @@ -744,17 +744,8 @@ std::unique_ptr<SdrModel> SdrExchangeView::CreateMarkedObjModel() const if(nullptr == pNewObj) { - // not cloned yet - if (pObj->GetObjIdentifier() == OBJ_OLE2) - { - // tdf#125520 - pNewObj = pObj->CloneSdrObject(pObj->getSdrModelFromSdrObject()); - } - else - { - // use default way - pNewObj = pObj->CloneSdrObject(*pNewModel); - } + // not cloned yet, use default way + pNewObj = pObj->CloneSdrObject(*pNewModel); } if(pNewObj) commit c9605cc66bcc655f3d7c8f3264efa691de42aed5 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Mon Feb 3 12:06:23 2020 +0000 Commit: Thorsten Behrens <thorsten.behr...@cib.de> CommitDate: Wed Feb 12 22:23:02 2020 +0100 ofz#20455 sw: HTML import: fix invalid table in footer The obvious problem was that a bookmark failed to be copied to the correct node, it was created on a SwStartNode, which failed in makeMark() and caused a null-pointer. The target position was off by 1 node because there was a spurious StartNode/EndNode pair directly below the table: [ 41] 0x5b13430 TableNode , [ 42] 0x5b1d010 StartNode , [ 43] 0x5b12a50 StartNode , [ 44] 0x5b135f0 TextNode "", This was created by a special case in SwTableNode::MakeCopy() because .GetTabSortBoxes().size() == 1. But the table had actually quite a bunch more cells in the nodes-array, just they were not yet in the SwTable. In an exciting twist of events, it turns out the table was copied while it was not yet finished parsing: the problem was that in the middle of the table, some CSS set some page attributes, and this caused a first-page page style to be created in SwCSS1Parser::ParseStyleSheet(), by copying the master page style. Unfortunately the table was in the <div title="footer">, so it was copied in this incomplete and inconsistent state. It might be possible to get rid of the special case in SwTableNode::MakeCopy() by restricting the special case skipping of StartNodes at the start in SwNodes::CopyNodes() a bit so that StartNodes whose EndNodes are copied aren't skipped; at least that's the most reasonable explanation for the special case. But for now just fix the HTML import. Additionally, only on MacOSX, using libc++, this triggered an assert: Assertion failed: (!pImpl->mpStaticDefaults || typeid(rItem) == typeid(GetDefaultItem(nWhich))), function PutImpl, file /Users/tdf/lode/jenkins/workspace/lo_gerrit/Config/macosx_clang_dbgutil/svl/source/items/itempool.cxx, line 611. Probably because SdrTextAniCountItem is not marked DLLPUBLIC. Change-Id: Ia167265e7540eea649801eaac2b89f9e18b685cd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87859 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@cib.de> (cherry picked from commit 086e43148059a7ebc6caa416fa82bb60fd2cc92f) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88494 Reviewed-by: Thorsten Behrens <thorsten.behr...@cib.de> diff --git a/include/svx/sdtacitm.hxx b/include/svx/sdtacitm.hxx index bf145c8b6b6c..f34e5589ed53 100644 --- a/include/svx/sdtacitm.hxx +++ b/include/svx/sdtacitm.hxx @@ -23,7 +23,7 @@ #include <svx/svddef.hxx> // Number of loops. 0=infinite. -class SdrTextAniCountItem final : public SfxUInt16Item { +class SAL_DLLPUBLIC_RTTI SdrTextAniCountItem final : public SfxUInt16Item { public: SdrTextAniCountItem(sal_uInt16 nVal=0): SfxUInt16Item(SDRATTR_TEXT_ANICOUNT,nVal) {} diff --git a/sw/qa/core/data/html/pass/ofz20455.html b/sw/qa/core/data/html/pass/ofz20455.html new file mode 100644 index 000000000000..6e5ca0aa7e85 Binary files /dev/null and b/sw/qa/core/data/html/pass/ofz20455.html differ diff --git a/sw/source/filter/html/htmlcss1.cxx b/sw/source/filter/html/htmlcss1.cxx index e7a1827543a6..4f8d8bbe7d03 100644 --- a/sw/source/filter/html/htmlcss1.cxx +++ b/sw/source/filter/html/htmlcss1.cxx @@ -90,11 +90,13 @@ void SwCSS1Parser::ChgPageDesc( const SwPageDesc *pPageDesc, m_pDoc->ChgPageDesc( pos, rNewPageDesc ); } -SwCSS1Parser::SwCSS1Parser( SwDoc *pD, const sal_uInt32 aFHeights[7], const OUString& rBaseURL, bool bNewDoc ) : - SvxCSS1Parser( pD->GetAttrPool(), rBaseURL, - aItemIds, SAL_N_ELEMENTS(aItemIds)), - m_pDoc( pD ), - m_nDropCapCnt( 0 ), +SwCSS1Parser::SwCSS1Parser(SwDoc *const pDoc, SwHTMLParser const& rParser, + const sal_uInt32 aFHeights[7], const OUString& rBaseURL, bool const bNewDoc) + : SvxCSS1Parser(pDoc->GetAttrPool(), rBaseURL, + aItemIds, SAL_N_ELEMENTS(aItemIds)) + , m_pDoc( pDoc ) + , m_rHTMLParser(rParser) + , m_nDropCapCnt( 0 ), m_bIsNewDoc( bNewDoc ), m_bBodyBGColorSet( false ), m_bBodyBackgroundSet( false ), @@ -1344,6 +1346,12 @@ const SwPageDesc *SwCSS1Parser::GetPageDesc( sal_uInt16 nPoolId, bool bCreate ) const SwPageDesc *pPageDesc = FindPageDesc(m_pDoc, nPoolId); if( !pPageDesc && bCreate ) { + if (m_rHTMLParser.IsReadingHeaderOrFooter()) + { // (there should be only one definition of header/footer in HTML) + SAL_WARN("sw.html", "no creating PageDesc while reading header/footer"); + return nullptr; + } + // The first page is created from the right page, if there is one. SwPageDesc *pMasterPageDesc = nullptr; if( RES_POOLPAGE_FIRST == nPoolId ) diff --git a/sw/source/filter/html/swcss1.hxx b/sw/source/filter/html/swcss1.hxx index c6a3e6bdb8fd..54d03edb5892 100644 --- a/sw/source/filter/html/swcss1.hxx +++ b/sw/source/filter/html/swcss1.hxx @@ -33,6 +33,7 @@ class SwTextFormatColl; class SvxBrushItem; class SwFormatDrop; class SwPageDesc; +class SwHTMLParser; // This header looks harmless, but includes still quite // inconspicuous one or the other! On the other hand this class @@ -41,6 +42,7 @@ class SwPageDesc; class SwCSS1Parser : public SvxCSS1Parser { SwDoc *m_pDoc; + SwHTMLParser const& m_rHTMLParser; sal_uLong m_aFontHeights[7]; @@ -75,7 +77,8 @@ protected: using CSS1Parser::ParseStyleSheet; public: - SwCSS1Parser( SwDoc *pDoc, sal_uInt32 const aFHeight[7], const OUString& rBaseURL, bool bNewDoc ); + SwCSS1Parser( SwDoc *pDoc, SwHTMLParser const& rParser, + sal_uInt32 const aFHeight[7], const OUString& rBaseURL, bool bNewDoc); virtual ~SwCSS1Parser() override; virtual bool ParseStyleSheet( const OUString& rIn ) override; diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx index 4a5003c0dd7c..aaa6c2e7dd35 100644 --- a/sw/source/filter/html/swhtml.cxx +++ b/sw/source/filter/html/swhtml.cxx @@ -359,7 +359,7 @@ SwHTMLParser::SwHTMLParser( SwDoc* pD, SwPaM& rCursor, SvStream& rIn, m_bOldIsHTMLMode = m_xDoc->getIDocumentSettingAccess().get(DocumentSettingId::HTML_MODE); m_xDoc->getIDocumentSettingAccess().set(DocumentSettingId::HTML_MODE, true); - m_pCSS1Parser.reset( new SwCSS1Parser( m_xDoc.get(), m_aFontHeights, m_sBaseURL, IsNewDoc() ) ); + m_pCSS1Parser.reset(new SwCSS1Parser(m_xDoc.get(), *this, m_aFontHeights, m_sBaseURL, IsNewDoc())); m_pCSS1Parser->SetIgnoreFontFamily( rHtmlOptions.IsIgnoreFontFamily() ); if( bReadUTF8 ) diff --git a/sw/source/filter/html/swhtml.hxx b/sw/source/filter/html/swhtml.hxx index b9173c6271ab..58eaaaab715e 100644 --- a/sw/source/filter/html/swhtml.hxx +++ b/sw/source/filter/html/swhtml.hxx @@ -923,6 +923,8 @@ public: bool IsReqIF() const; + bool IsReadingHeaderOrFooter() const { return m_bReadingHeaderOrFooter; } + void NotifyMacroEventRead(); /// Strips query and fragment from a URL path if base URL is a file:// one. commit 2c9dc34b332b6cb4c121e85989e4e8e2ab822ea5 Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Sat Jan 18 12:01:24 2020 +0300 Commit: Eike Rathke <er...@redhat.com> CommitDate: Wed Feb 12 17:58:15 2020 +0100 tdf#130054: consider all row/col bars in ScTabView::EnableRefInput Left col bar and bottom row bar were ignored - apparently overlooked at least since commit 9ae5a91f7955e44d3b24a3f7741f9bca02ac7f24. Change-Id: I5c2386b0aa1fdbb42f352c0b654e268dc62c7e66 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87007 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> (cherry picked from commit bda31b1a95b284749cd5e4d9596aab8e1aa93714) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87022 Reviewed-by: Eike Rathke <er...@redhat.com> diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx index ec52581dad23..53e03e61de07 100644 --- a/sc/source/ui/view/tabview.cxx +++ b/sc/source/ui/view/tabview.cxx @@ -2245,18 +2245,15 @@ void ScTabView::EnableRefInput(bool bFlag) if(pTabControl!=nullptr) pTabControl->EnableInput(bFlag); - if(pGridWin[SC_SPLIT_BOTTOMLEFT]!=nullptr) - pGridWin[SC_SPLIT_BOTTOMLEFT]->EnableInput(bFlag,false); - if(pGridWin[SC_SPLIT_BOTTOMRIGHT]!=nullptr) - pGridWin[SC_SPLIT_BOTTOMRIGHT]->EnableInput(bFlag,false); - if(pGridWin[SC_SPLIT_TOPLEFT]!=nullptr) - pGridWin[SC_SPLIT_TOPLEFT]->EnableInput(bFlag,false); - if(pGridWin[SC_SPLIT_TOPRIGHT]!=nullptr) - pGridWin[SC_SPLIT_TOPRIGHT]->EnableInput(bFlag,false); - if(pColBar[SC_SPLIT_RIGHT]!=nullptr) - pColBar[SC_SPLIT_RIGHT]->EnableInput(bFlag,false); - if(pRowBar[SC_SPLIT_TOP]!=nullptr) - pRowBar[SC_SPLIT_TOP]->EnableInput(bFlag,false); + for (auto& p : pGridWin) + if (p) + p->EnableInput(bFlag, false); + for (auto& p : pColBar) + if (p) + p->EnableInput(bFlag, false); + for (auto& p : pRowBar) + if (p) + p->EnableInput(bFlag, false); } bool ScTabView::ContinueOnlineSpelling() _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits