cui/source/customize/cfg.cxx | 12 ++-- filter/source/msfilter/svdfppt.cxx | 77 ++++++++++---------------- include/filter/msfilter/svdfppt.hxx | 3 - include/svx/itemwin.hxx | 4 - include/svx/linectrl.hxx | 2 include/tools/UnitConversion.hxx | 19 ++++++ sd/qa/unit/data/ppt/tdf79082.ppt |binary sd/qa/unit/export-tests.cxx | 42 ++++++++++++++ sd/source/filter/eppt/epptso.cxx | 8 +- svx/source/sdr/properties/groupproperties.cxx | 17 +++++ svx/source/tbxctrls/itemwin.cxx | 14 ++-- svx/source/tbxctrls/linectrl.cxx | 12 ++-- sw/qa/extras/ooxmlexport/ooxmlexport6.cxx | 4 - sw/qa/extras/ooxmlimport/data/tdf127778.docx |binary sw/qa/extras/ooxmlimport/ooxmlimport2.cxx | 12 ++++ sw/qa/uitest/writer_dialogs/openDialogs.py | 3 - sw/source/filter/ww8/docxattributeoutput.cxx | 11 +++ sw/source/filter/ww8/wrtw8sty.cxx | 12 ++++ sw/source/filter/ww8/wrtww8.hxx | 1 sw/source/ui/dbui/addresslistdialog.cxx | 7 ++ vcl/unx/generic/dtrans/X11_selection.cxx | 1 writerfilter/source/dmapper/PropertyMap.cxx | 9 --- 22 files changed, 186 insertions(+), 84 deletions(-)
New commits: commit 13a65ac084d124fb22aee9f48797fa4f8588cd55 Author: Samuel Mehrbrodt <[email protected]> AuthorDate: Tue May 12 12:47:31 2020 +0200 Commit: Andras Timar <[email protected]> CommitDate: Wed May 20 16:06:51 2020 +0200 tdf#79082 Improve ppt tab import/export Import/export the paragraph tabs without any text offset, tabs are relative to the text box anyway. Change-Id: Ife3b762e7581548e65500c16259a4481cc07a88f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94101 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <[email protected]> (cherry picked from commit 9c4048b1883f1dc9fdd621ffa2bb06ff9fe19d14) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94429 Reviewed-by: Thorsten Behrens <[email protected]> diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx index de39c837fe3a..48e96ef5b4ad 100644 --- a/filter/source/msfilter/svdfppt.cxx +++ b/filter/source/msfilter/svdfppt.cxx @@ -105,6 +105,7 @@ #include <svx/sxekitm.hxx> #include <editeng/flditem.hxx> #include <tools/zcodec.hxx> +#include <tools/UnitConversion.hxx> #include <filter/msfilter/svxmsbas.hxx> #include <sfx2/objsh.hxx> #include <editeng/brushitem.hxx> @@ -6316,13 +6317,11 @@ void PPTParagraphObj::ApplyTo( SfxItemSet& rSet, boost::optional< sal_Int16 >& sal_uInt32 nLatestManTab = 0; GetAttrib( PPT_ParaAttr_TextOfs, nTextOfs2, nDestinationInstance ); GetAttrib( PPT_ParaAttr_BulletOfs, nTab, nDestinationInstance ); - GetAttrib( PPT_ParaAttr_BulletOn, i, nDestinationInstance ); GetAttrib( PPT_ParaAttr_DefaultTab, nDefaultTab, nDestinationInstance ); + SvxTabStopItem aTabItem( 0, 0, SvxTabAdjust::Default, EE_PARA_TABS ); if ( GetTabCount() ) { - //paragraph offset = MIN(first_line_offset, hanging_offset) - sal_uInt32 nParaOffset = std::min(nTextOfs2, nTab); for ( i = 0; i < GetTabCount(); i++ ) { SvxTabAdjust eTabAdjust; @@ -6334,8 +6333,7 @@ void PPTParagraphObj::ApplyTo( SfxItemSet& rSet, boost::optional< sal_Int16 >& case 3 : eTabAdjust = SvxTabAdjust::Decimal; break; default : eTabAdjust = SvxTabAdjust::Left; } - if ( nTab > nParaOffset )//If tab stop greater than paragraph offset - aTabItem.Insert( SvxTabStop( ( ( (long( nTab - nTextOfs2 )) * 2540 ) / 576 ), eTabAdjust ) ); + aTabItem.Insert(SvxTabStop(convertMasterUnitToTwip(nTab), eTabAdjust)); } nLatestManTab = nTab; } @@ -6348,7 +6346,7 @@ void PPTParagraphObj::ApplyTo( SfxItemSet& rSet, boost::optional< sal_Int16 >& nTab = nDefaultTab * ( 1 + nTab ); for ( i = 0; ( i < 20 ) && ( nTab < 0x1b00 ); i++ ) { - aTabItem.Insert( SvxTabStop( static_cast<sal_uInt16>( ( ( nTab - nTextOfs2 ) * 2540 ) / 576 ) ) ); + aTabItem.Insert( SvxTabStop( convertMasterUnitToTwip(nTab))); nTab += nDefaultTab; } } diff --git a/include/tools/UnitConversion.hxx b/include/tools/UnitConversion.hxx new file mode 100644 index 000000000000..3f2a5d870aee --- /dev/null +++ b/include/tools/UnitConversion.hxx @@ -0,0 +1,19 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ + +#pragma once + +// Convert PPT's "master unit" (1/576 inch) to twips +constexpr sal_Int64 convertMasterUnitToTwip(sal_Int64 n) { return n * 2540.0 / 576.0; } + +// Convert twips to PPT's "master unit" +constexpr sal_Int64 convertTwipToMasterUnit(sal_Int64 n) { return n / (2540.0 / 576.0); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/filter/eppt/epptso.cxx b/sd/source/filter/eppt/epptso.cxx index 952a8275cbe8..14b0fe6f1959 100644 --- a/sd/source/filter/eppt/epptso.cxx +++ b/sd/source/filter/eppt/epptso.cxx @@ -29,6 +29,7 @@ #include <tools/poly.hxx> #include <tools/stream.hxx> #include <tools/fontenum.hxx> +#include <tools/UnitConversion.hxx> #include <sot/storage.hxx> #include <vcl/graph.hxx> #include <editeng/svxenum.hxx> @@ -1180,7 +1181,6 @@ void PPTWriter::ImplWriteTextStyleAtom( SvStream& rOut, int nTextInstance, sal_u pPara = aTextObj.GetParagraph(0); sal_uInt32 nParaFlags = 0x1f; sal_Int16 nMask, nNumberingRule[ 10 ]; - const sal_uInt32 nTextOfs = pPara->nTextOfs; const sal_uInt32 nTabs = pPara->maTabStop.getLength(); const auto& rTabStops = pPara->maTabStop; @@ -1219,7 +1219,7 @@ void PPTWriter::ImplWriteTextStyleAtom( SvStream& rOut, int nTextInstance, sal_u const sal_uInt32 nDefaultTabSize = MapSize( awt::Size( nDefaultTabSizeSrc, 1 ) ).Width; sal_uInt32 nDefaultTabs = std::abs( maRect.GetWidth() ) / nDefaultTabSize; if ( nTabs ) - nDefaultTabs -= static_cast<sal_Int32>( ( ( rTabStops[ nTabs - 1 ].Position / 4.40972 ) + nTextOfs ) / nDefaultTabSize ); + nDefaultTabs -= static_cast<sal_Int32>( convertTwipToMasterUnit(rTabStops[ nTabs - 1 ].Position) / nDefaultTabSize ); if ( static_cast<sal_Int32>(nDefaultTabs) < 0 ) nDefaultTabs = 0; @@ -1248,7 +1248,7 @@ void PPTWriter::ImplWriteTextStyleAtom( SvStream& rOut, int nTextInstance, sal_u pRuleOut->WriteUInt16( nTabCount ); for ( const css::style::TabStop& rTabStop : rTabStops ) { - sal_uInt16 nPosition = static_cast<sal_uInt16>( ( rTabStop.Position / 4.40972 ) + nTextOfs ); + sal_uInt16 nPosition = static_cast<sal_uInt16>( convertTwipToMasterUnit(rTabStop.Position) ); sal_uInt16 nType; switch ( rTabStop.Alignment ) { @@ -1265,7 +1265,7 @@ void PPTWriter::ImplWriteTextStyleAtom( SvStream& rOut, int nTextInstance, sal_u sal_uInt32 nWidth = 1; if ( nTabs ) - nWidth += static_cast<sal_Int32>( ( rTabStops[ nTabs - 1 ].Position / 4.40972 + nTextOfs ) / nDefaultTabSize ); + nWidth += static_cast<sal_Int32>( convertTwipToMasterUnit(rTabStops[ nTabs - 1 ].Position) / nDefaultTabSize ); nWidth *= nDefaultTabSize; for ( i = 0; i < nDefaultTabs; i++, nWidth += nDefaultTabSize ) pRuleOut->WriteUInt32( nWidth ); commit 2cc4d1a77641bea22aa05a4a61dafbe9551c12d2 Author: Samuel Mehrbrodt <[email protected]> AuthorDate: Fri May 1 00:26:21 2020 +0200 Commit: Andras Timar <[email protected]> CommitDate: Wed May 20 16:06:51 2020 +0200 tdf#79082 Add test for correctly importing tab stops from ppt Change-Id: Iafccbe50e6e00e3a4c5155dabf898c12e8b8176c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93397 Tested-by: Jenkins Tested-by: Samuel Mehrbrodt <[email protected]> Reviewed-by: Samuel Mehrbrodt <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94428 Reviewed-by: Thorsten Behrens <[email protected]> diff --git a/sd/qa/unit/data/ppt/tdf79082.ppt b/sd/qa/unit/data/ppt/tdf79082.ppt new file mode 100644 index 000000000000..259b8808515d Binary files /dev/null and b/sd/qa/unit/data/ppt/tdf79082.ppt differ diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx index 9f15a20e47c4..66a3f8fc9035 100644 --- a/sd/qa/unit/export-tests.cxx +++ b/sd/qa/unit/export-tests.cxx @@ -52,6 +52,7 @@ public: void testUnknownAttributes(); void testTdf80020(); void testLinkedGraphicRT(); + void testTdf79082(); void testImageWithSpecialID(); void testTdf62176(); void testTransparentBackground(); @@ -84,6 +85,7 @@ public: CPPUNIT_TEST(testUnknownAttributes); CPPUNIT_TEST(testTdf80020); CPPUNIT_TEST(testLinkedGraphicRT); + CPPUNIT_TEST(testTdf79082); CPPUNIT_TEST(testImageWithSpecialID); CPPUNIT_TEST(testTdf62176); CPPUNIT_TEST(testTransparentBackground); @@ -663,6 +665,46 @@ void SdExportTest::testLinkedGraphicRT() } } +void SdExportTest::testTdf79082() +{ + sd::DrawDocShellRef xDocShRef + = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/ppt/tdf79082.ppt"), PPT); + utl::TempFile tempFile; + tempFile.EnableKillingFile(); + xDocShRef = saveAndReload(xDocShRef.get(), ODP, &tempFile); + xmlDocPtr pXmlDoc = parseExport(tempFile, "content.xml"); + + // P1 should have 6 tab stops defined + assertXPathChildren( + pXmlDoc, "//style:style[@style:name='P1']/style:paragraph-properties/style:tab-stops", 6); + assertXPath(pXmlDoc, + "//style:style[@style:name='P1']/style:paragraph-properties/style:tab-stops/" + "style:tab-stop[1]", + "position", "0cm"); + assertXPath(pXmlDoc, + "//style:style[@style:name='P1']/style:paragraph-properties/style:tab-stops/" + "style:tab-stop[2]", + "position", "5.08cm"); + assertXPath(pXmlDoc, + "//style:style[@style:name='P1']/style:paragraph-properties/style:tab-stops/" + "style:tab-stop[3]", + "position", "10.16cm"); + assertXPath(pXmlDoc, + "//style:style[@style:name='P1']/style:paragraph-properties/style:tab-stops/" + "style:tab-stop[4]", + "position", "15.24cm"); + assertXPath(pXmlDoc, + "//style:style[@style:name='P1']/style:paragraph-properties/style:tab-stops/" + "style:tab-stop[5]", + "position", "20.32cm"); + assertXPath(pXmlDoc, + "//style:style[@style:name='P1']/style:paragraph-properties/style:tab-stops/" + "style:tab-stop[6]", + "position", "25.4cm"); + + xDocShRef->DoClose(); +} + void SdExportTest::testImageWithSpecialID() { // Check how LO handles when the imported graphic's ID is different from that one commit 8890b7c953c92a56b0f3a3a31115023252721aca Author: Piet van Oostrum <[email protected]> AuthorDate: Thu Nov 26 18:37:56 2015 +0400 Commit: Andras Timar <[email protected]> CommitDate: Wed May 20 16:06:50 2020 +0200 tdf#79082 Correctly import PPT tabs Change-Id: I7ac5ccb356501983da645f0a6037b5292ce8b5b4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/20207 Reviewed-by: Samuel Mehrbrodt <[email protected]> Tested-by: Jenkins (cherry picked from commit 070f44e3b2d7dcf26de68ee46c50dad5c0cf2170) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94427 Reviewed-by: Thorsten Behrens <[email protected]> diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx index a122e6aac203..de39c837fe3a 100644 --- a/filter/source/msfilter/svdfppt.cxx +++ b/filter/source/msfilter/svdfppt.cxx @@ -5827,7 +5827,6 @@ PPTParagraphObj::PPTParagraphObj( const PPTStyleSheet& rStyleSheet, TSS_Type nIn PPTNumberFormatCreator ( nullptr ), mrStyleSheet ( rStyleSheet ), mnInstance ( nInstance ), - mbTab ( true ), // style sheets always have to get the right tabulator setting mnCurrentObject ( 0 ) { mxParaSet->mnDepth = sanitizeForMaxPPTLevels(nDepth); @@ -5842,7 +5841,6 @@ PPTParagraphObj::PPTParagraphObj( PPTStyleTextPropReader& rPropReader, PPTTextRulerInterpreter ( rRuler ), mrStyleSheet ( rStyleSheet ), mnInstance ( nInstance ), - mbTab ( false ), mnCurrentObject ( 0 ) { if (rnCurCharPos < rPropReader.aCharPropList.size()) @@ -5857,10 +5855,6 @@ PPTParagraphObj::PPTParagraphObj( PPTStyleTextPropReader& rPropReader, rPropReader.aCharPropList[rnCurCharPos].get(); std::unique_ptr<PPTPortionObj> pPPTPortion(new PPTPortionObj( *pCharPropSet, rStyleSheet, nInstance, mxParaSet->mnDepth)); - if (!mbTab) - { - mbTab = pPPTPortion->HasTabulator(); - } m_PortionList.push_back(std::move(pPPTPortion)); } } @@ -5874,10 +5868,6 @@ void PPTParagraphObj::AppendPortion( PPTPortionObj& rPPTPortion ) { m_PortionList.push_back( std::make_unique<PPTPortionObj>(rPPTPortion)); - if ( !mbTab ) - { - mbTab = m_PortionList.back()->HasTabulator(); - } } void PPTParagraphObj::UpdateBulletRelSize( sal_uInt32& nBulletRelSize ) const @@ -6322,50 +6312,47 @@ void PPTParagraphObj::ApplyTo( SfxItemSet& rSet, boost::optional< sal_Int16 >& rSet.Put( aULSpaceItem ); } - if ( mbTab ) // makes it sense to apply tabsettings + sal_uInt32 i, nDefaultTab, nTab, nTextOfs2 = 0; + sal_uInt32 nLatestManTab = 0; + GetAttrib( PPT_ParaAttr_TextOfs, nTextOfs2, nDestinationInstance ); + GetAttrib( PPT_ParaAttr_BulletOfs, nTab, nDestinationInstance ); + GetAttrib( PPT_ParaAttr_BulletOn, i, nDestinationInstance ); + GetAttrib( PPT_ParaAttr_DefaultTab, nDefaultTab, nDestinationInstance ); + SvxTabStopItem aTabItem( 0, 0, SvxTabAdjust::Default, EE_PARA_TABS ); + if ( GetTabCount() ) { - sal_uInt32 i, nDefaultTab, nTab, nTextOfs2 = 0; - sal_uInt32 nLatestManTab = 0; - GetAttrib( PPT_ParaAttr_TextOfs, nTextOfs2, nDestinationInstance ); - GetAttrib( PPT_ParaAttr_BulletOfs, nTab, nDestinationInstance ); - GetAttrib( PPT_ParaAttr_BulletOn, i, nDestinationInstance ); - GetAttrib( PPT_ParaAttr_DefaultTab, nDefaultTab, nDestinationInstance ); - SvxTabStopItem aTabItem( 0, 0, SvxTabAdjust::Default, EE_PARA_TABS ); - if ( GetTabCount() ) + //paragraph offset = MIN(first_line_offset, hanging_offset) + sal_uInt32 nParaOffset = std::min(nTextOfs2, nTab); + for ( i = 0; i < GetTabCount(); i++ ) { - //paragraph offset = MIN(first_line_offset, hanging_offset) - sal_uInt32 nParaOffset = std::min(nTextOfs2, nTab); - for ( i = 0; i < GetTabCount(); i++ ) + SvxTabAdjust eTabAdjust; + nTab = GetTabOffsetByIndex( static_cast<sal_uInt16>(i) ); + switch( GetTabStyleByIndex( static_cast<sal_uInt16>(i) ) ) { - SvxTabAdjust eTabAdjust; - nTab = GetTabOffsetByIndex( static_cast<sal_uInt16>(i) ); - switch( GetTabStyleByIndex( static_cast<sal_uInt16>(i) ) ) - { - case 1 : eTabAdjust = SvxTabAdjust::Center; break; - case 2 : eTabAdjust = SvxTabAdjust::Right; break; - case 3 : eTabAdjust = SvxTabAdjust::Decimal; break; - default : eTabAdjust = SvxTabAdjust::Left; - } - if ( nTab > nParaOffset )//If tab stop greater than paragraph offset - aTabItem.Insert( SvxTabStop( ( ( (long( nTab - nTextOfs2 )) * 2540 ) / 576 ), eTabAdjust ) ); + case 1 : eTabAdjust = SvxTabAdjust::Center; break; + case 2 : eTabAdjust = SvxTabAdjust::Right; break; + case 3 : eTabAdjust = SvxTabAdjust::Decimal; break; + default : eTabAdjust = SvxTabAdjust::Left; } - nLatestManTab = nTab; + if ( nTab > nParaOffset )//If tab stop greater than paragraph offset + aTabItem.Insert( SvxTabStop( ( ( (long( nTab - nTextOfs2 )) * 2540 ) / 576 ), eTabAdjust ) ); } - if ( nIsBullet2 == 0 ) - aTabItem.Insert( SvxTabStop( sal_uInt16(0) ) ); - if ( nDefaultTab ) + nLatestManTab = nTab; + } + if ( nIsBullet2 == 0 ) + aTabItem.Insert( SvxTabStop( sal_uInt16(0) ) ); + if ( nDefaultTab ) + { + nTab = std::max( nTextOfs2, nLatestManTab ); + nTab /= nDefaultTab; + nTab = nDefaultTab * ( 1 + nTab ); + for ( i = 0; ( i < 20 ) && ( nTab < 0x1b00 ); i++ ) { - nTab = std::max( nTextOfs2, nLatestManTab ); - nTab /= nDefaultTab; - nTab = nDefaultTab * ( 1 + nTab ); - for ( i = 0; ( i < 20 ) && ( nTab < 0x1b00 ); i++ ) - { - aTabItem.Insert( SvxTabStop( static_cast<sal_uInt16>( ( ( nTab - nTextOfs2 ) * 2540 ) / 576 ) ) ); - nTab += nDefaultTab; - } + aTabItem.Insert( SvxTabStop( static_cast<sal_uInt16>( ( ( nTab - nTextOfs2 ) * 2540 ) / 576 ) ) ); + nTab += nDefaultTab; } - rSet.Put( aTabItem ); } + rSet.Put( aTabItem ); } sal_uInt32 PPTParagraphObj::GetTextSize() diff --git a/include/filter/msfilter/svdfppt.hxx b/include/filter/msfilter/svdfppt.hxx index efe56823e1c9..e7ee75ec0bde 100644 --- a/include/filter/msfilter/svdfppt.hxx +++ b/include/filter/msfilter/svdfppt.hxx @@ -1148,9 +1148,6 @@ class MSFILTER_DLLPUBLIC PPTParagraphObj void operator=(PPTParagraphObj const&) = delete; public: - - bool mbTab; // if true, this paragraph has tabulators in text - sal_uInt32 mnCurrentObject; ::std::vector<std::unique_ptr<PPTPortionObj>> m_PortionList; commit e77ed8957be12c37a9e0131b1478f808c23d41c6 Author: Miklos Vajna <[email protected]> AuthorDate: Mon May 11 21:08:35 2020 +0200 Commit: Andras Timar <[email protected]> CommitDate: Wed May 20 16:06:50 2020 +0200 tdf#127778 DOCX import: fix unexpected heading on non-first page ... ... when the first page has a heading Regression from commit 17e51f427b3f0cec74ac8e0a1b3f51189006ae6f (DOCX import: first page header should always set default headers as well, 2014-11-21), the problem is around how to split a first + follow page style on import, and then do the opposite on export. This is described using a single section in OOXML, but Writer has 2 page styles for this (unlike in case of the DOC filter). This means the header margin has to be taken from one of these page styles. The above commit tweaked the import, so the follow page style has the wanted header margin, but this leads to incorrect layout. Fix the problem by tweaking the export instead: it has random access to the doc model, so it can take the header margin from the first page style if needed, and then the import side can be reverted, leading to correct layout. Also remove some leftover debug code in test/, which was added in commit 5352d45dd4a04f8f02cf7f6ad4169126d3b3586a (convert AnimationImport to fast-parser APIs, 2020-02-18). (cherry picked from commit 51534ac2b9747975945acb6a1e1ba5cc6d73f5c2) Conflicts: sw/qa/extras/ooxmlexport/ooxmlexport6.cxx Change-Id: I4bbf7271f3a437e8432399bd1e32e9d24190a501 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94193 Tested-by: Jenkins Reviewed-by: Xisco Faulí <[email protected]> diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx index a459e8a57f27..a8fe7ac73ea0 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx @@ -510,7 +510,7 @@ DECLARE_OOXMLEXPORT_TEST(testVMLData, "TestVMLData.docx") { // The problem was exporter was exporting vml data for shape in w:rPr element. // vml data should not come under w:rPr element. - xmlDocPtr pXmlDoc = parseExport("word/header2.xml"); + xmlDocPtr pXmlDoc = parseExport("word/header1.xml"); if (!pXmlDoc) return; CPPUNIT_ASSERT(getXPath(pXmlDoc, "/w:hdr/w:p/w:r/mc:AlternateContent/mc:Fallback/w:pict/v:shape", "stroked").match("f")); @@ -520,7 +520,7 @@ DECLARE_OOXMLEXPORT_TEST(testImageData, "image_data.docx") { // The problem was exporter was exporting v:imagedata data for shape in w:pict as v:fill w element. - xmlDocPtr pXmlDoc = parseExport("word/header2.xml"); + xmlDocPtr pXmlDoc = parseExport("word/header1.xml"); if (!pXmlDoc) return; CPPUNIT_ASSERT(getXPath(pXmlDoc, "/w:hdr/w:p/w:r/mc:AlternateContent/mc:Fallback/w:pict/v:shape/v:imagedata", "detectmouseclick").match("t")); diff --git a/sw/qa/extras/ooxmlimport/data/tdf127778.docx b/sw/qa/extras/ooxmlimport/data/tdf127778.docx new file mode 100644 index 000000000000..a706d575763f Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf127778.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx index 7688e1927acb..a14b97aec66a 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx @@ -271,6 +271,18 @@ DECLARE_OOXMLIMPORT_TEST(testTdf43017, "tdf43017.docx") getProperty<sal_Int32>(xText, "CharColor")); } +CPPUNIT_TEST_FIXTURE(Test, testTdf127778) +{ + load(mpTestDocumentPath, "tdf127778.docx"); + xmlDocPtr pLayout = parseLayoutDump(); + // Without the accompanying fix in place, this test would have failed with: + // equality assertion failed + // - Expected: 0 + // - Actual : 1 + // i.e. the 2nd page had an unexpected header. + assertXPath(pLayout, "//page[2]/header", 0); +} + // related tdf#43017 DECLARE_OOXMLIMPORT_TEST(testTdf124754, "tdf124754.docx") { diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index a467a3cfc069..91085b203251 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -8311,6 +8311,17 @@ void DocxAttributeOutput::FormatULSpace( const SvxULSpaceItem& rULSpace ) sal_Int32 nHeader = 0; if ( aDistances.HasHeader() ) nHeader = sal_Int32( aDistances.dyaHdrTop ); + else if (m_rExport.m_pFirstPageFormat) + { + HdFtDistanceGlue aFirstPageDistances(m_rExport.m_pFirstPageFormat->GetAttrSet()); + if (aFirstPageDistances.HasHeader()) + { + // The follow page style has no header, but the first page style has. In Word terms, + // this means that the header margin of "the" section is coming from the first page + // style. + nHeader = sal_Int32(aFirstPageDistances.dyaHdrTop); + } + } // Page top m_pageMargins.nTop = aDistances.dyaTop; diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx index d43c96f8f3c8..e84d84e1c35f 100644 --- a/sw/source/filter/ww8/wrtw8sty.cxx +++ b/sw/source/filter/ww8/wrtw8sty.cxx @@ -1784,7 +1784,19 @@ void MSWordExportBase::SectionProperties( const WW8_SepInfo& rSepInfo, WW8_PdAtt m_pISet = &pPdFormat->GetAttrSet(); if (!bOutputStyleItemSet) + { + if (titlePage) + { + m_pFirstPageFormat = pPdFirstPgFormat; + } + AttrOutput().OutputStyleItemSet( pPdFormat->GetAttrSet(), false ); + + if (titlePage) + { + m_pFirstPageFormat = nullptr; + } + } AttrOutput().SectionPageBorders( pPdFormat, pPdFirstPgFormat ); m_pISet = pOldI; diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx index ccfb0a7caed1..7af4da2b7fd0 100644 --- a/sw/source/filter/ww8/wrtww8.hxx +++ b/sw/source/filter/ww8/wrtww8.hxx @@ -458,6 +458,7 @@ public: OUString const m_aMainStg; std::vector<const SwTOXType*> m_aTOXArr; const SfxItemSet* m_pISet; // for double attributes + const SwFrameFormat* m_pFirstPageFormat = nullptr; WW8_WrPct* m_pPiece; // Pointer to Piece-Table std::unique_ptr<SwNumRuleTable> m_pUsedNumTable; // all used NumRules /// overriding numdef index -> (existing numdef index, abstractnumdef index) diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx index 2d085b5775dd..ef5ac73ac4af 100644 --- a/writerfilter/source/dmapper/PropertyMap.cxx +++ b/writerfilter/source/dmapper/PropertyMap.cxx @@ -928,15 +928,6 @@ void SectionPropertyMap::CopyLastHeaderFooter( bool bFirstPage, DomainMapper_Imp void SectionPropertyMap::PrepareHeaderFooterProperties( bool bFirstPage ) { bool bCopyFirstToFollow = bFirstPage && m_bTitlePage && m_aFollowPageStyle.is(); - if (bCopyFirstToFollow) - { - // This is a first page and has a follow style, then enable the - // header/footer there as well to be consistent. - if (HasHeader(/*bFirstPage=*/true)) - m_aFollowPageStyle->setPropertyValue("HeaderIsOn", uno::makeAny(true)); - if (HasFooter(/*bFirstPage=*/true)) - m_aFollowPageStyle->setPropertyValue("FooterIsOn", uno::makeAny(true)); - } sal_Int32 nTopMargin = m_nTopMargin; sal_Int32 nHeaderTop = m_nHeaderTop; commit d733c26a16c48828e5442712551b8c43fa857506 Author: Caolán McNamara <[email protected]> AuthorDate: Thu May 14 13:42:52 2020 +0100 Commit: Andras Timar <[email protected]> CommitDate: Wed May 20 16:06:50 2020 +0200 tdf#132169 we always get the value in MapUnit::Map100thMM but must set it in the core metric of the target application since... commit f7c751439d4616f43509301d71af92b13b576a84 Date: Thu Nov 7 15:53:49 2019 +0100 jsdialog: consume .uno:LineWidth double value added parameters for online, but with parameters its no longer considered a simple slot and for non-simple slots the auto-conversion of values to/from twips isn't done. there's probably a much and older deeper bug here, but lets get this known broken line width working Change-Id: I8683431f02d2d14936411d35ba070944b9b80e1f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94203 Tested-by: Jenkins Reviewed-by: Xisco Faulí <[email protected]> diff --git a/include/svx/itemwin.hxx b/include/svx/itemwin.hxx index 13a63557f147..cbfaf3055339 100644 --- a/include/svx/itemwin.hxx +++ b/include/svx/itemwin.hxx @@ -61,7 +61,7 @@ class SVX_DLLPUBLIC SvxMetricField : public MetricField using Window::Update; OUString aCurTxt; - MapUnit ePoolUnit; + MapUnit eDestPoolUnit; FieldUnit eDlgUnit; Size aLogicalSize; css::uno::Reference< css::frame::XFrame > mxFrame; @@ -80,7 +80,7 @@ public: const css::uno::Reference< css::frame::XFrame >& rFrame ); void Update( const XLineWidthItem* pItem ); - void SetCoreUnit( MapUnit eUnit ); + void SetDestCoreUnit( MapUnit eUnit ); void RefreshDlgUnit(); }; diff --git a/include/svx/linectrl.hxx b/include/svx/linectrl.hxx index 68f92e9a64fa..d3c1e394b970 100644 --- a/include/svx/linectrl.hxx +++ b/include/svx/linectrl.hxx @@ -57,6 +57,8 @@ public: class SVX_DLLPUBLIC SvxLineWidthToolBoxControl final : public SfxToolBoxControl { + static MapUnit GetCoreMetric(); + public: SFX_DECL_TOOLBOX_CONTROL(); diff --git a/svx/source/tbxctrls/itemwin.cxx b/svx/source/tbxctrls/itemwin.cxx index 66314e592f21..1f16861ee84f 100644 --- a/svx/source/tbxctrls/itemwin.cxx +++ b/svx/source/tbxctrls/itemwin.cxx @@ -283,7 +283,7 @@ SvxMetricField::SvxMetricField( vcl::Window* pParent, const Reference< XFrame >& rFrame ) : MetricField(pParent, WB_BORDER | WB_SPIN | WB_REPEAT) , aCurTxt() - , ePoolUnit(MapUnit::MapCM) + , eDestPoolUnit(MapUnit::Map100thMM) , mxFrame(rFrame) { Size aSize( CalcMinimumSize() ); @@ -306,8 +306,10 @@ void SvxMetricField::Update( const XLineWidthItem* pItem ) { if ( pItem ) { - if ( pItem->GetValue() != GetCoreValue( *this, ePoolUnit ) ) - SetMetricValue( *this, pItem->GetValue(), ePoolUnit ); + // tdf#132169 we always get the value in MapUnit::Map100thMM but have + // to set it in the core metric of the target application + if (pItem->GetValue() != GetCoreValue(*this, MapUnit::Map100thMM)) + SetMetricValue(*this, pItem->GetValue(), MapUnit::Map100thMM); } else SetText( "" ); @@ -317,7 +319,7 @@ void SvxMetricField::Update( const XLineWidthItem* pItem ) void SvxMetricField::Modify() { MetricField::Modify(); - long nTmp = GetCoreValue( *this, ePoolUnit ); + long nTmp = GetCoreValue( *this, eDestPoolUnit ); XLineWidthItem aLineWidthItem( nTmp ); Any a; @@ -341,9 +343,9 @@ void SvxMetricField::ReleaseFocus_Impl() } } -void SvxMetricField::SetCoreUnit( MapUnit eUnit ) +void SvxMetricField::SetDestCoreUnit( MapUnit eUnit ) { - ePoolUnit = eUnit; + eDestPoolUnit = eUnit; } void SvxMetricField::RefreshDlgUnit() diff --git a/svx/source/tbxctrls/linectrl.cxx b/svx/source/tbxctrls/linectrl.cxx index 0704b88006dc..dfe0be2dd57c 100644 --- a/svx/source/tbxctrls/linectrl.cxx +++ b/svx/source/tbxctrls/linectrl.cxx @@ -225,10 +225,7 @@ void SvxLineWidthToolBoxControl::StateChanged( { DBG_ASSERT( dynamic_cast<const XLineWidthItem*>( pState) != nullptr, "wrong ItemType" ); - // Core-Unit handed over to MetricField - // Should not happen in CreateItemWin ()! - // CD!!! GetCoreMetric(); - pFld->SetCoreUnit( MapUnit::Map100thMM ); + pFld->SetDestCoreUnit(GetCoreMetric()); pFld->Update( static_cast<const XLineWidthItem*>(pState) ); } @@ -238,6 +235,13 @@ void SvxLineWidthToolBoxControl::StateChanged( } } +MapUnit SvxLineWidthToolBoxControl::GetCoreMetric() +{ + SfxObjectShell* pSh = SfxObjectShell::Current(); + SfxItemPool& rPool = pSh ? pSh->GetPool() : SfxGetpApp()->GetPool(); + sal_uInt16 nWhich = rPool.GetWhich(SID_ATTR_LINE_WIDTH); + return rPool.GetMetric(nWhich); +} VclPtr<vcl::Window> SvxLineWidthToolBoxControl::CreateItemWindow( vcl::Window *pParent ) { commit 5e65215b1d8703f4c7b4a2a3c816795231c8bf7d Author: Caolán McNamara <[email protected]> AuthorDate: Fri May 15 10:52:48 2020 +0100 Commit: Andras Timar <[email protected]> CommitDate: Wed May 20 16:06:49 2020 +0200 tdf#133036 notebookbar customize uses a special combobox id in all other cases the m_xSaveInListBox id contains a SaveInData pointer but not the notebookbar case for some reason, we're already checking for this special id in one case, extend to check in the other too Change-Id: I460afa165ee2f6baa6deb1a15b0257df274a4c94 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94269 Tested-by: Jenkins Reviewed-by: Xisco Faulí <[email protected]> diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx index 7b5e51b9d521..f317811968f9 100644 --- a/cui/source/customize/cfg.cxx +++ b/cui/source/customize/cfg.cxx @@ -1303,17 +1303,21 @@ bool SvxConfigPage::FillItemSet( SfxItemSet* ) for (int i = 0, nCount = m_xSaveInListBox->get_count(); i < nCount; ++i) { - SaveInData* pData = - reinterpret_cast<SaveInData*>(m_xSaveInListBox->get_id(i).toInt64()); - if(m_xSaveInListBox->get_id(i) != notebookbarTabScope) + OUString sId = m_xSaveInListBox->get_id(i); + if (sId != notebookbarTabScope) + { + SaveInData* pData = reinterpret_cast<SaveInData*>(sId.toInt64()); result = pData->Apply(); + } } return result; } IMPL_LINK_NOARG(SvxConfigPage, SelectSaveInLocation, weld::ComboBox&, void) { - pCurrentSaveInData = reinterpret_cast<SaveInData*>(m_xSaveInListBox->get_active_id().toInt64()); + OUString sId = m_xSaveInListBox->get_active_id(); + if (sId != notebookbarTabScope) + pCurrentSaveInData = reinterpret_cast<SaveInData*>(sId.toInt64()); Init(); } commit b53ecf73564a7d04d871ea53f8d0008083f31b18 Author: Michael Stahl <[email protected]> AuthorDate: Sat May 16 19:58:19 2020 +0200 Commit: Andras Timar <[email protected]> CommitDate: Wed May 20 16:06:49 2020 +0200 sw: UITest_writer_dialogs: disable MailMergeWizard In a build via ssh, the test hangs while trying to connect to Evolution Data Server that presumably isn't running: 1 in g_cond_wait () at /lib64/libglib-2.0.so.0 2 in e_flag_wait () at /lib64/libedataserver-1.2.so.24 3 in e_client_wait_for_connected_sync () at /lib64/libedataserver-1.2.so.24 4 in e_book_client_connect_sync () at /lib64/libebook-1.2.so.20 5 in e_book_client_connect_direct_sync () at /lib64/libebook-1.2.so.20 6 in connectivity::evoab::(anonymous namespace)::OEvoabVersion38Helper::createClient(ESource*) (this=0x912d150, pSource=0x90c0660) at connectivity/source/drivers/evoab2/NResultSet.cxx:480 ... 35 in SwMailMergeConfigItem::GetResultSet() const (this=0x8f10b30) at sw/source/uibase/dbui/mmconfigitem.cxx:875 ... 63 in SwMailMergeWizard::SwMailMergeWizard(SwView&, std::shared_ptr<SwMailMergeConfigItem> const&) (this=0x8f0f340, rView=..., rItem=std::shared_ptr<SwMailMergeConfigItem> (use count 3, weak count 0) = {...}) at sw/source/ui/dbui/mailmergewizard.cxx:60 Change-Id: I1b43b05509f4e293ce1f00044a05f045bf975ce4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94364 Tested-by: Jenkins Reviewed-by: Michael Stahl <[email protected]> (cherry picked from commit a782cce919952cff41c7cfa7ec3a6a915e1851aa) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94281 Reviewed-by: Xisco Faulí <[email protected]> diff --git a/sw/qa/uitest/writer_dialogs/openDialogs.py b/sw/qa/uitest/writer_dialogs/openDialogs.py index 442d0eef9095..60e126780d69 100644 --- a/sw/qa/uitest/writer_dialogs/openDialogs.py +++ b/sw/qa/uitest/writer_dialogs/openDialogs.py @@ -99,7 +99,8 @@ dialogs = [ # {"command": ".uno:LineNumberingDialog", "closeButton": "cancel"}, # tested in sw/qa/uitest/writer_tests3/lineNumbering.py {"command": ".uno:FootnoteDialog", "closeButton": "cancel"}, - {"command": ".uno:MailMergeWizard", "closeButton": "cancel"}, + # {"command": ".uno:MailMergeWizard", "closeButton": "cancel"}, + # may hang forever in e_book_client_connect_direct_sync {"command": ".uno:AddressBookSource", "closeButton": "cancel"}, {"command": ".uno:RunMacro", "closeButton": "cancel"}, {"command": ".uno:ScriptOrganizer", "closeButton": "close"}, commit b06b3c92664e21726a9f4108a0e5e5588c81225a Author: Caolán McNamara <[email protected]> AuthorDate: Thu May 7 09:13:22 2020 +0100 Commit: Andras Timar <[email protected]> CommitDate: Wed May 20 16:06:48 2020 +0200 Related: tdf#132678 select first entry if nothing else selected Change-Id: I94fae0f774c587d85e682414f5d54f35f0161c30 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93614 Tested-by: Jenkins Reviewed-by: Caolán McNamara <[email protected]> (cherry picked from commit 403776b17706107001d49cf5eed3c4415c4d8b9d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94270 Reviewed-by: Michael Stahl <[email protected]> diff --git a/sw/source/ui/dbui/addresslistdialog.cxx b/sw/source/ui/dbui/addresslistdialog.cxx index 1f982922f85e..8c2e5780348b 100644 --- a/sw/source/ui/dbui/addresslistdialog.cxx +++ b/sw/source/ui/dbui/addresslistdialog.cxx @@ -166,6 +166,7 @@ SwAddressListDialog::SwAddressListDialog(SwMailMergeAddressBlockPage* pParent) bool bEnableEdit = false; bool bEnableOK = true; + bool bSelected = false; m_xListLB->unselect_all(); SwDBConfig aDb; @@ -183,6 +184,7 @@ SwAddressListDialog::SwAddressListDialog(SwMailMergeAddressBlockPage* pParent) if (rName == rCurrentData.sDataSource) { m_xListLB->select(*m_xIter); + bSelected = true; m_xListLB->set_text(*m_xIter, rCurrentData.sCommand, 1); pUserData->nCommandType = rCurrentData.nCommandType; pUserData->xSource = rConfigItem.GetSource(); @@ -208,7 +210,10 @@ SwAddressListDialog::SwAddressListDialog(SwMailMergeAddressBlockPage* pParent) } } - m_xOK->set_sensitive(m_xListLB->n_children() > 0 && bEnableOK); + bool bHasChildren = m_xListLB->n_children() > 0; + if (bHasChildren && !bSelected) + m_xListLB->select(0); // select the first entry if nothing else selected + m_xOK->set_sensitive(bHasChildren && bEnableOK); m_xEditPB->set_sensitive(bEnableEdit); m_xRemovePB->set_sensitive(m_xListLB->n_children() > 0); m_xFilterPB->set_sensitive(m_xListLB->n_children() > 0); commit 19937a9686a204e826fe29a422970c5256a14edf Author: Julien Nabet <[email protected]> AuthorDate: Tue May 5 20:11:15 2020 +0200 Commit: Andras Timar <[email protected]> CommitDate: Wed May 20 16:06:48 2020 +0200 tdf#132730: fix assertion on group See bt here: https://bugs.documentfoundation.org/attachment.cgi?id=160397 Implement GroupProperties::ClearObjectItem Change-Id: I967f8bda6e4a4edaccdb4a0bd2150bb2af2c1316 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93512 Tested-by: Jenkins Reviewed-by: Julien Nabet <[email protected]> (cherry picked from commit c7709eb11cddc37883d1a2391a1dd83f03f5cfa3) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94271 Reviewed-by: Michael Stahl <[email protected]> diff --git a/svx/source/sdr/properties/groupproperties.cxx b/svx/source/sdr/properties/groupproperties.cxx index b5be536ede5b..ebedda8955f2 100644 --- a/svx/source/sdr/properties/groupproperties.cxx +++ b/svx/source/sdr/properties/groupproperties.cxx @@ -145,9 +145,22 @@ namespace sdr assert(!"GroupProperties::SetObjectItemDirect() should never be called"); } - void GroupProperties::ClearObjectItem(const sal_uInt16 /*nWhich*/) + void GroupProperties::ClearObjectItem(const sal_uInt16 nWhich) { - assert(!"GroupProperties::ClearObjectItem() should never be called"); + // iterate over contained SdrObjects + const SdrObjList* pSub(static_cast<const SdrObjGroup&>(GetSdrObject()).GetSubList()); + OSL_ENSURE(nullptr != pSub, "Children of SdrObject expected (!)"); + const size_t nCount(nullptr == pSub ? 0 : pSub->GetObjCount()); + + for(size_t a = 0; a < nCount; ++a) + { + SdrObject* pObj = pSub->GetObj(a); + + if(pObj) + { + pObj->GetProperties().ClearObjectItem(nWhich); + } + } } void GroupProperties::ClearObjectItemDirect(const sal_uInt16 /*nWhich*/) commit f96d9d702477eb601606eebd708af822b8ba2c13 Author: Caolán McNamara <[email protected]> AuthorDate: Fri May 15 10:28:03 2020 +0100 Commit: Andras Timar <[email protected]> CommitDate: Wed May 20 16:06:48 2020 +0200 tdf#133053 reset after clear so avoid later assert Change-Id: Ib2b637c8a6d5af04256bfd9631e43d334343b610 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94265 Tested-by: Jenkins Reviewed-by: Caolán McNamara <[email protected]> (cherry picked from commit 773b8e3cc1340e6f5bfc364f0705344b744edd8d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94273 Reviewed-by: Michael Stahl <[email protected]> diff --git a/vcl/unx/generic/dtrans/X11_selection.cxx b/vcl/unx/generic/dtrans/X11_selection.cxx index e9c00d0174fb..dc5824338cb2 100644 --- a/vcl/unx/generic/dtrans/X11_selection.cxx +++ b/vcl/unx/generic/dtrans/X11_selection.cxx @@ -2626,6 +2626,7 @@ bool SelectionManager::handleDragEvent( XEvent const & rMessage ) dte.Source = static_cast< OWeakObject* >( it->second.m_pTarget ); aGuard.clear(); it->second.m_pTarget->dragExit( dte ); + aGuard.reset(); } else if( m_aDropProxy != None && m_nCurrentProtocolVersion >= 0 ) { _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
