[Libreoffice-commits] core.git: Branch 'distro/vector/vector-5.4' - cppcanvas/source
cppcanvas/source/mtfrenderer/emfplus.cxx | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) New commits: commit 508fc36db06172388b205053f41a3a1d3326920b Author: Patrick Jaap AuthorDate: Fri Oct 13 11:31:28 2017 +0200 Commit: Miklos Vajna CommitDate: Fri Mar 13 16:49:30 2020 +0100 tdf#31814 Fix for EMF+ DrawString and DrawImage DrawString: The value 'fontAttribute' is optional and may be null, results in missing characters. DrawImage: The case of 'metafile' was missing and leads to low resolution rendering. (cherry picked from commit 52a2a0101f71b21876f17d5419132ffa27f6e35d) Conflicts: drawinglayer/source/tools/emfphelperdata.cxx Change-Id: I81566d884975fda832f4a5af6663c837f355c383 diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx b/cppcanvas/source/mtfrenderer/emfplus.cxx index 00ca97a2d10c..710376b5d9e4 100644 --- a/cppcanvas/source/mtfrenderer/emfplus.cxx +++ b/cppcanvas/source/mtfrenderer/emfplus.cxx @@ -1236,7 +1236,16 @@ namespace cppcanvas } if (bValid) { -BitmapEx aBmp( image.graphic.GetBitmapEx () ); +BitmapEx aBmp; +if (image.type == 1) // Bitmap +{ +aBmp = image.graphic.GetBitmapEx(); +} +else if (image.type == 2) // Metafile +{ +GraphicConversionParameters aParameters(Size(aDstSize.getX(), aDstSize.getY())); +aBmp = image.graphic.GetBitmapEx(aParameters); +} aBmp.Crop( aSource ); Size aSize( aBmp.GetSizePixel() ); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - filter/source sw/qa
filter/source/msfilter/dffpropset.cxx | 11 +++ sw/qa/extras/ww8import/data/tdf130262.doc |binary sw/qa/extras/ww8import/ww8import.cxx |5 + 3 files changed, 16 insertions(+) New commits: commit 82288db9bbc69892408ebccb96091d03b2d0dabb Author: Patrick Jaap AuthorDate: Thu Feb 6 18:33:19 2020 +0100 Commit: Patrick Jaap CommitDate: Tue Feb 11 17:17:41 2020 +0100 tdf#130262 ignore negative wrap distance values in doc prop import Change-Id: I2c06b12c958dfde09adcc2ae4c59532ffde6b6fe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88127 Tested-by: Jenkins Reviewed-by: Miklos Vajna (cherry picked from commit 8cbd7f59bb99282c4bcb60639da1263c8eb3a5e3) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88399 Reviewed-by: Patrick Jaap diff --git a/filter/source/msfilter/dffpropset.cxx b/filter/source/msfilter/dffpropset.cxx index 73c0e45d64db..f0a5aae5cc29 100644 --- a/filter/source/msfilter/dffpropset.cxx +++ b/filter/source/msfilter/dffpropset.cxx @@ -1208,6 +1208,17 @@ void DffPropSet::ReadPropSet( SvStream& rIn, bool bSetUninitializedOnly ) } if ( bSetProperty ) { +// tdf#130262: ignore negative values for distances (maybe this list needs to be extended) +// LO does not allow negative values but [MS-ODRAW] does not forbid them +if (nRecType == DFF_Prop_dxWrapDistLeft || nRecType == DFF_Prop_dxWrapDistRight + || nRecType == DFF_Prop_dyWrapDistTop || nRecType == DFF_Prop_dyWrapDistBottom ) +{ +if ( static_cast(nContent) < 0 ) +{ +break; +} +} + mpPropSetEntries[ nRecType ].nContent = nContent; mpPropSetEntries[ nRecType ].aFlags = aPropFlag; } diff --git a/sw/qa/extras/ww8import/data/tdf130262.doc b/sw/qa/extras/ww8import/data/tdf130262.doc new file mode 100644 index ..fb60beacd79d Binary files /dev/null and b/sw/qa/extras/ww8import/data/tdf130262.doc differ diff --git a/sw/qa/extras/ww8import/ww8import.cxx b/sw/qa/extras/ww8import/ww8import.cxx index c67f2c9385b0..468cacfd0967 100644 --- a/sw/qa/extras/ww8import/ww8import.cxx +++ b/sw/qa/extras/ww8import/ww8import.cxx @@ -365,6 +365,11 @@ DECLARE_WW8IMPORT_TEST(testTdf110987, "tdf110987") CPPUNIT_ASSERT(sFilterName != "MS Word 97 Vorlage"); } +DECLARE_WW8IMPORT_TEST(testTdf130262, "tdf130262.doc") +{ +// We had an infinite layout loop +} + // tests should only be added to ww8IMPORT *if* they fail round-tripping in ww8EXPORT CPPUNIT_PLUGIN_IMPLEMENT(); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-4' - filter/source sw/qa
filter/source/msfilter/dffpropset.cxx | 11 +++ sw/qa/extras/ww8import/data/tdf130262.doc |binary sw/qa/extras/ww8import/ww8import.cxx |5 + 3 files changed, 16 insertions(+) New commits: commit 6e5444959ec914f6d0979aa1e6d4d8a462d79891 Author: Patrick Jaap AuthorDate: Thu Feb 6 18:33:19 2020 +0100 Commit: Patrick Jaap CommitDate: Tue Feb 11 15:29:27 2020 +0100 tdf#130262 ignore negative wrap distance values in doc prop import Change-Id: I2c06b12c958dfde09adcc2ae4c59532ffde6b6fe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88127 Tested-by: Jenkins Reviewed-by: Miklos Vajna (cherry picked from commit 8cbd7f59bb99282c4bcb60639da1263c8eb3a5e3) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88391 Reviewed-by: Patrick Jaap diff --git a/filter/source/msfilter/dffpropset.cxx b/filter/source/msfilter/dffpropset.cxx index 5b0b1194ae06..e5803046b4e4 100644 --- a/filter/source/msfilter/dffpropset.cxx +++ b/filter/source/msfilter/dffpropset.cxx @@ -1217,6 +1217,17 @@ void DffPropSet::ReadPropSet( SvStream& rIn, bool bSetUninitializedOnly ) } if ( bSetProperty ) { +// tdf#130262: ignore negative values for distances (maybe this list needs to be extended) +// LO does not allow negative values but [MS-ODRAW] does not forbid them +if (nRecType == DFF_Prop_dxWrapDistLeft || nRecType == DFF_Prop_dxWrapDistRight + || nRecType == DFF_Prop_dyWrapDistTop || nRecType == DFF_Prop_dyWrapDistBottom ) +{ +if ( static_cast(nContent) < 0 ) +{ +break; +} +} + mpPropSetEntries[ nRecType ].nContent = nContent; mpPropSetEntries[ nRecType ].aFlags = aPropFlag; } diff --git a/sw/qa/extras/ww8import/data/tdf130262.doc b/sw/qa/extras/ww8import/data/tdf130262.doc new file mode 100644 index ..fb60beacd79d Binary files /dev/null and b/sw/qa/extras/ww8import/data/tdf130262.doc differ diff --git a/sw/qa/extras/ww8import/ww8import.cxx b/sw/qa/extras/ww8import/ww8import.cxx index c67f2c9385b0..468cacfd0967 100644 --- a/sw/qa/extras/ww8import/ww8import.cxx +++ b/sw/qa/extras/ww8import/ww8import.cxx @@ -365,6 +365,11 @@ DECLARE_WW8IMPORT_TEST(testTdf110987, "tdf110987") CPPUNIT_ASSERT(sFilterName != "MS Word 97 Vorlage"); } +DECLARE_WW8IMPORT_TEST(testTdf130262, "tdf130262.doc") +{ +// We had an infinite layout loop +} + // tests should only be added to ww8IMPORT *if* they fail round-tripping in ww8EXPORT CPPUNIT_PLUGIN_IMPLEMENT(); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: filter/source sw/qa
filter/source/msfilter/dffpropset.cxx | 11 +++ sw/qa/extras/ww8import/data/tdf130262.doc |binary sw/qa/extras/ww8import/ww8import.cxx |5 + 3 files changed, 16 insertions(+) New commits: commit 8cbd7f59bb99282c4bcb60639da1263c8eb3a5e3 Author: Patrick Jaap AuthorDate: Thu Feb 6 18:33:19 2020 +0100 Commit: Miklos Vajna CommitDate: Mon Feb 10 09:35:13 2020 +0100 tdf#130262 ignore negative wrap distance values in doc prop import Change-Id: I2c06b12c958dfde09adcc2ae4c59532ffde6b6fe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88127 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/filter/source/msfilter/dffpropset.cxx b/filter/source/msfilter/dffpropset.cxx index 5b0b1194ae06..e5803046b4e4 100644 --- a/filter/source/msfilter/dffpropset.cxx +++ b/filter/source/msfilter/dffpropset.cxx @@ -1217,6 +1217,17 @@ void DffPropSet::ReadPropSet( SvStream& rIn, bool bSetUninitializedOnly ) } if ( bSetProperty ) { +// tdf#130262: ignore negative values for distances (maybe this list needs to be extended) +// LO does not allow negative values but [MS-ODRAW] does not forbid them +if (nRecType == DFF_Prop_dxWrapDistLeft || nRecType == DFF_Prop_dxWrapDistRight + || nRecType == DFF_Prop_dyWrapDistTop || nRecType == DFF_Prop_dyWrapDistBottom ) +{ +if ( static_cast(nContent) < 0 ) +{ +break; +} +} + mpPropSetEntries[ nRecType ].nContent = nContent; mpPropSetEntries[ nRecType ].aFlags = aPropFlag; } diff --git a/sw/qa/extras/ww8import/data/tdf130262.doc b/sw/qa/extras/ww8import/data/tdf130262.doc new file mode 100644 index ..fb60beacd79d Binary files /dev/null and b/sw/qa/extras/ww8import/data/tdf130262.doc differ diff --git a/sw/qa/extras/ww8import/ww8import.cxx b/sw/qa/extras/ww8import/ww8import.cxx index c67f2c9385b0..468cacfd0967 100644 --- a/sw/qa/extras/ww8import/ww8import.cxx +++ b/sw/qa/extras/ww8import/ww8import.cxx @@ -365,6 +365,11 @@ DECLARE_WW8IMPORT_TEST(testTdf110987, "tdf110987") CPPUNIT_ASSERT(sFilterName != "MS Word 97 Vorlage"); } +DECLARE_WW8IMPORT_TEST(testTdf130262, "tdf130262.doc") +{ +// We had an infinite layout loop +} + // tests should only be added to ww8IMPORT *if* they fail round-tripping in ww8EXPORT CPPUNIT_PLUGIN_IMPLEMENT(); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
DOC import filter: SvxULSpaceItem question
Hi! I am struggling with a regression I introduced to LO. You find the bug here: https://bugs.documentfoundation.org/show_bug.cgi?id=130262 As it turns out there seems to be a wrong SvxULSpaceItem setting for a small drawing line in the footer. The UL attribute claims there is 13500 twips upper AND lower space around the line. I think this is a bug and causes the regression. Since I am not familiar with doc / ww8 import: Where are the upper/lower space attributes of a drawing line set? Best, Patrick ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice
[Libreoffice-commits] core.git: Branch 'libreoffice-6-2' - sw/qa sw/source
sw/qa/extras/layout/data/tdf127235.odt |binary sw/qa/extras/layout/layout.cxx |9 + sw/source/core/text/txtfly.cxx | 21 +++-- 3 files changed, 28 insertions(+), 2 deletions(-) New commits: commit 1e9d08d046bfe362e5e2ffeb36e35692fc3b55f5 Author: Patrick Jaap AuthorDate: Fri Sep 6 10:50:05 2019 +0200 Commit: Miklos Vajna CommitDate: Tue Sep 24 09:01:19 2019 +0200 tdf#127235 break if object is larger than page We will always have an overlap if the object is larger than the whole page. Look for the next page style: if it is missing or the same as the current, we simply stop. Change-Id: I699d5146d215f17b4775dbcb32811fa5b6ebf60d Reviewed-on: https://gerrit.libreoffice.org/78696 Tested-by: Jenkins Reviewed-by: Miklos Vajna Reviewed-on: https://gerrit.libreoffice.org/79104 diff --git a/sw/qa/extras/layout/data/tdf127235.odt b/sw/qa/extras/layout/data/tdf127235.odt new file mode 100644 index ..5b27c921cf17 Binary files /dev/null and b/sw/qa/extras/layout/data/tdf127235.odt differ diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index c2c6d2cd5b9d..ec568d69f767 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -67,6 +67,7 @@ public: void testTdf122878(); void testTdf115094(); void testTdf118719(); +void testTdf127235(); CPPUNIT_TEST_SUITE(SwLayoutWriter); CPPUNIT_TEST(testRedlineFootnotes); @@ -106,6 +107,7 @@ public: CPPUNIT_TEST(testTdf122878); CPPUNIT_TEST(testTdf115094); CPPUNIT_TEST(testTdf118719); +CPPUNIT_TEST(testTdf127235); CPPUNIT_TEST_SUITE_END(); private: @@ -2728,6 +2730,13 @@ void SwLayoutWriter::testTdf118719() CPPUNIT_ASSERT_GREATER(nOther, nLast); } +void SwLayoutWriter::testTdf127235() +{ +SwDoc* pDoc = createDoc("tdf127235.odt"); +// This resulted in a layout loop. +pDoc->getIDocumentLayoutAccess().GetCurrentViewShell()->CalcLayout(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SwLayoutWriter); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/core/text/txtfly.cxx b/sw/source/core/text/txtfly.cxx index e16cd878ce75..18bec6284a57 100644 --- a/sw/source/core/text/txtfly.cxx +++ b/sw/source/core/text/txtfly.cxx @@ -998,6 +998,24 @@ bool SwTextFly::ForEach( const SwRect , SwRect* pRect, bool bAvoid ) const { SwSwapIfSwapped swap(const_cast(m_pCurrFrame)); +// Optimization +SwRectFnSet aRectFnSet(m_pCurrFrame); + +// tdf#127235 stop if the area is larger than the page +if( aRectFnSet.GetHeight(pPage->getFrameArea()) < aRectFnSet.GetHeight(rRect)) +{ +// get the doc model description +const SwPageDesc* pPageDesc = pPage->GetPageDesc(); + +// if there is no next page style or it is the same as the current +// => stop trying to place the frame (it would end in an infinite loop) +if( pPageDesc && +( !pPageDesc->GetFollow() || pPageDesc->GetFollow() == pPageDesc) ) +{ +return false; +} +} + bool bRet = false; // #i68520# const SwAnchoredObjList::size_type nCount( bOn ? GetAnchoredObjList()->size() : 0 ); @@ -1010,10 +1028,9 @@ bool SwTextFly::ForEach( const SwRect , SwRect* pRect, bool bAvoid ) const SwRect aRect( pAnchoredObj->GetObjRectWithSpaces() ); -// Optimization -SwRectFnSet aRectFnSet(m_pCurrFrame); if( aRectFnSet.GetLeft(aRect) > aRectFnSet.GetRight(rRect) ) break; + // #i68520# if ( mpCurrAnchoredObj != pAnchoredObj && aRect.IsOver( rRect ) ) { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
Re: CppunitTest_sw_layoutwriter failing on Windows with HiDPI
Hi! In my commit I tested for fly portions. Is this really the right commit? And I don't know in what specific environment the unit tests should be executed. Do we take display scaling into account? Best, Patrick Am Sonntag, 15. September 2019, 03:52:01 CEST schrieb Luke Benes: > The Unit Test added in > https://cgit.freedesktop.org/libreoffice/core/commit/?id=4ac31078b9c46231f8e > cf0409a1724749ac8c5a4 > > Is causing the core Unit Test CppunitTest_sw_layoutwriter to fail when you > set, Settings->Display->Scale=125% in Windows 10. > > > > horizontal_multilevel.odt: > C:/lode/dev/core/test/source/xmltesttools.cxx(168) : error : Assertion > Test name: testHorizontal_multilevel::TestBody > equality assertion failed > - Expected: 7945 > - Actual : 7946 > - In <>, attribute 'y' of > '/metafile/push[1]/push[1]/push[1]/push[3]/push[1]/textarray[7]' incorrect > value. > > Failures !!! > Run: 56 Failure total: 1 Failures: 1 Errors: 0 > > Error: a unit test failed, please do one of: > make CppunitTest_sw_layoutwriter CPPUNITTRACE=TRUE # which is a shortcut for > the following line make CppunitTest_sw_layoutwriter > CPPUNITTRACE="'C:/Program Files (x86)/Microsoft Visual > Studio/2017/Community/Common7/IDE/devenv.exe' /debugexe" # for interactive > debugging in Visual Studio make CppunitTest_sw_layoutwriter > CPPUNITTRACE="drmemory -free_max_frames 20" # for memory checking (install > Dr.Memory first, and put it to your PATH) > > You can limit the execution to just one particular test by: > > make CppunitTest_sw_layoutwriter CPPUNIT_TEST_NAME="testXYZ" ...above > mentioned params... > > make[1]: *** [C:/lode/dev/core/solenv/gbuild/CppunitTest.mk:114: > C:/lode/dev/core/workdir/CppunitTest/sw_layoutwriter.test] Error 1 make: > *** [Makefile:167: CppunitTest_sw_layoutwriter] Error 2 ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice
[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - sw/qa sw/source
sw/qa/extras/layout/data/tdf127235.odt |binary sw/qa/extras/layout/layout.cxx |7 +++ sw/source/core/text/txtfly.cxx | 21 +++-- 3 files changed, 26 insertions(+), 2 deletions(-) New commits: commit 154a9fc26890a34ac885f3191bf339b758c97936 Author: Patrick Jaap AuthorDate: Fri Sep 6 10:50:05 2019 +0200 Commit: Miklos Vajna CommitDate: Thu Sep 19 11:38:27 2019 +0200 tdf#127235 break if object is larger than page We will always have an overlap if the object is larger than the whole page. Look for the next page style: if it is missing or the same as the current, we simply stop. Change-Id: I699d5146d215f17b4775dbcb32811fa5b6ebf60d Reviewed-on: https://gerrit.libreoffice.org/78696 Tested-by: Jenkins Reviewed-by: Miklos Vajna Reviewed-on: https://gerrit.libreoffice.org/79101 diff --git a/sw/qa/extras/layout/data/tdf127235.odt b/sw/qa/extras/layout/data/tdf127235.odt new file mode 100644 index ..5b27c921cf17 Binary files /dev/null and b/sw/qa/extras/layout/data/tdf127235.odt differ diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index dc1a407969df..0ac66283857b 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -3117,6 +3117,13 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTabOverMargin) assertXPath(pXmlDoc, "/root/page/body/txt[2]/LineBreak", 1); } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf127235) +{ +SwDoc* pDoc = createDoc("tdf127235.odt"); +// This resulted in a layout loop. +pDoc->getIDocumentLayoutAccess().GetCurrentViewShell()->CalcLayout(); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/text/txtfly.cxx b/sw/source/core/text/txtfly.cxx index 2502c025e7e6..5d1887921aec 100644 --- a/sw/source/core/text/txtfly.cxx +++ b/sw/source/core/text/txtfly.cxx @@ -999,6 +999,24 @@ bool SwTextFly::ForEach( const SwRect , SwRect* pRect, bool bAvoid ) const { SwSwapIfSwapped swap(const_cast(m_pCurrFrame)); +// Optimization +SwRectFnSet aRectFnSet(m_pCurrFrame); + +// tdf#127235 stop if the area is larger than the page +if( aRectFnSet.GetHeight(pPage->getFrameArea()) < aRectFnSet.GetHeight(rRect)) +{ +// get the doc model description +const SwPageDesc* pPageDesc = pPage->GetPageDesc(); + +// if there is no next page style or it is the same as the current +// => stop trying to place the frame (it would end in an infinite loop) +if( pPageDesc && +( !pPageDesc->GetFollow() || pPageDesc->GetFollow() == pPageDesc) ) +{ +return false; +} +} + bool bRet = false; // #i68520# const SwAnchoredObjList::size_type nCount( bOn ? GetAnchoredObjList()->size() : 0 ); @@ -1011,10 +1029,9 @@ bool SwTextFly::ForEach( const SwRect , SwRect* pRect, bool bAvoid ) const SwRect aRect( pAnchoredObj->GetObjRectWithSpaces() ); -// Optimization -SwRectFnSet aRectFnSet(m_pCurrFrame); if( aRectFnSet.GetLeft(aRect) > aRectFnSet.GetRight(rRect) ) break; + // #i68520# if ( mpCurrAnchoredObj != pAnchoredObj && aRect.IsOver( rRect ) ) { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sw/qa sw/source
sw/qa/extras/layout/data/tdf127235.odt |binary sw/qa/extras/layout/layout.cxx |7 +++ sw/source/core/text/txtfly.cxx | 21 +++-- 3 files changed, 26 insertions(+), 2 deletions(-) New commits: commit 37b79c872b2637912c5d6972812ee2c9d5b096c7 Author: Patrick Jaap AuthorDate: Fri Sep 6 10:50:05 2019 +0200 Commit: Miklos Vajna CommitDate: Wed Sep 18 16:23:14 2019 +0200 WIP: tdf#127235 break if object is larger than page We will always have an overlap if the object is larger than the whole page. Look for the next page style: if it is missing or the same as the current, we simply stop. Change-Id: I699d5146d215f17b4775dbcb32811fa5b6ebf60d Reviewed-on: https://gerrit.libreoffice.org/78696 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/sw/qa/extras/layout/data/tdf127235.odt b/sw/qa/extras/layout/data/tdf127235.odt new file mode 100644 index ..5b27c921cf17 Binary files /dev/null and b/sw/qa/extras/layout/data/tdf127235.odt differ diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index af3cde2db379..59e1e08939e0 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -3089,6 +3089,13 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf113014) assertXPathContent(pXmlDoc, "/metafile/push[1]/push[1]/push[1]/textarray[5]/text", "3."); } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf127235) +{ +SwDoc* pDoc = createDoc("tdf127235.odt"); +// This resulted in a layout loop. +pDoc->getIDocumentLayoutAccess().GetCurrentViewShell()->CalcLayout(); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/text/txtfly.cxx b/sw/source/core/text/txtfly.cxx index 82b16055e82a..51befd6f2878 100644 --- a/sw/source/core/text/txtfly.cxx +++ b/sw/source/core/text/txtfly.cxx @@ -999,6 +999,24 @@ bool SwTextFly::ForEach( const SwRect , SwRect* pRect, bool bAvoid ) const { SwSwapIfSwapped swap(const_cast(m_pCurrFrame)); +// Optimization +SwRectFnSet aRectFnSet(m_pCurrFrame); + +// tdf#127235 stop if the area is larger than the page +if( aRectFnSet.GetHeight(pPage->getFrameArea()) < aRectFnSet.GetHeight(rRect)) +{ +// get the doc model description +const SwPageDesc* pPageDesc = pPage->GetPageDesc(); + +// if there is no next page style or it is the same as the current +// => stop trying to place the frame (it would end in an infinite loop) +if( pPageDesc && +( !pPageDesc->GetFollow() || pPageDesc->GetFollow() == pPageDesc) ) +{ +return false; +} +} + bool bRet = false; // #i68520# const SwAnchoredObjList::size_type nCount( bOn ? GetAnchoredObjList()->size() : 0 ); @@ -1011,10 +1029,9 @@ bool SwTextFly::ForEach( const SwRect , SwRect* pRect, bool bAvoid ) const SwRect aRect( pAnchoredObj->GetObjRectWithSpaces() ); -// Optimization -SwRectFnSet aRectFnSet(m_pCurrFrame); if( aRectFnSet.GetLeft(aRect) > aRectFnSet.GetRight(rRect) ) break; + // #i68520# if ( mpCurrAnchoredObj != pAnchoredObj && aRect.IsOver( rRect ) ) { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-2' - sw/qa sw/source
sw/qa/extras/ooxmlexport/data/tdf125324.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport13.cxx |7 +++ sw/source/filter/ww8/docxattributeoutput.cxx |6 ++ 3 files changed, 9 insertions(+), 4 deletions(-) New commits: commit a62583681703f28bb421da26e343fd0be9f8fe50 Author: Patrick Jaap AuthorDate: Mon Jun 3 17:27:03 2019 +0200 Commit: Miklos Vajna CommitDate: Fri Jun 7 11:48:35 2019 +0200 tdf#125324 table export: do not ignore default values It seems like Writer default values for table positioning differ from OOXML spec. if nothing is given. So write them anyway during export. Change-Id: If5bf77de71b457a826be8f1559212e7d06c5237c Reviewed-on: https://gerrit.libreoffice.org/73402 Tested-by: Jenkins Reviewed-by: Patrick Jaap (cherry picked from commit dac2ff37431151d13589801fa4767633b4df72b9) Reviewed-on: https://gerrit.libreoffice.org/73609 (cherry picked from commit 48653935ec71ab703c3a4c387dc192bae4643356) Reviewed-on: https://gerrit.libreoffice.org/73641 Reviewed-by: Miklos Vajna diff --git a/sw/qa/extras/ooxmlexport/data/tdf125324.docx b/sw/qa/extras/ooxmlexport/data/tdf125324.docx new file mode 100644 index ..9382e295f00c Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf125324.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx index ca211e0e7eb9..d9f1978705cf 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx @@ -112,6 +112,13 @@ DECLARE_OOXMLIMPORT_TEST(testTdf123460, "tdf123460.docx") CPPUNIT_ASSERT_EQUAL(true, bCaught); } +DECLARE_OOXMLEXPORT_TEST(testTdf125324, "tdf125324.docx") +{ +discardDumpedLayout(); +xmlDocPtr pXmlDoc = parseLayoutDump(); +assertXPath(pXmlDoc, "/root/page/body/txt[2]/anchored/fly/tab/infos/bounds", "top", "4193"); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 39f1318f1bce..0438a1e54caf 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -3859,15 +3859,13 @@ void DocxAttributeOutput::TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t OString sTblpYSpec = convertToOOXMLVertOrient( pFrame->GetFrameFormat().GetVertOrient().GetVertOrient() ); sOrientation = convertToOOXMLVertOrientRel( pFrame->GetFrameFormat().GetVertOrient().GetRelationOrient() ); -if(sOrientation != "page") // do not write default -attrListTablePos->add( FSNS( XML_w, XML_vertAnchor ), sOrientation.getStr() ); +attrListTablePos->add( FSNS( XML_w, XML_vertAnchor ), sOrientation.getStr() ); if( !sTblpYSpec.isEmpty() ) attrListTablePos->add( FSNS( XML_w, XML_tblpYSpec ), sTblpYSpec.getStr() ); sOrientation = convertToOOXMLHoriOrientRel( pFrame->GetFrameFormat().GetHoriOrient().GetRelationOrient() ); -if(sOrientation != "page") // do not wirte default -attrListTablePos->add( FSNS( XML_w, XML_horzAnchor ), sOrientation.getStr() ); +attrListTablePos->add( FSNS( XML_w, XML_horzAnchor ), sOrientation.getStr() ); if( !sTblpXSpec.isEmpty() ) attrListTablePos->add( FSNS( XML_w, XML_tblpXSpec ), sTblpXSpec.getStr() ); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - sw/qa sw/source
sw/qa/extras/ooxmlexport/data/tdf125324.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport13.cxx |7 +++ sw/source/filter/ww8/docxattributeoutput.cxx |6 ++ 3 files changed, 9 insertions(+), 4 deletions(-) New commits: commit 48653935ec71ab703c3a4c387dc192bae4643356 Author: Patrick Jaap AuthorDate: Mon Jun 3 17:27:03 2019 +0200 Commit: Patrick Jaap CommitDate: Fri Jun 7 08:58:30 2019 +0200 tdf#125324 table export: do not ignore default values It seems like Writer default values for table positioning differ from OOXML spec. if nothing is given. So write them anyway during export. Change-Id: If5bf77de71b457a826be8f1559212e7d06c5237c Reviewed-on: https://gerrit.libreoffice.org/73402 Tested-by: Jenkins Reviewed-by: Patrick Jaap (cherry picked from commit dac2ff37431151d13589801fa4767633b4df72b9) Reviewed-on: https://gerrit.libreoffice.org/73609 diff --git a/sw/qa/extras/ooxmlexport/data/tdf125324.docx b/sw/qa/extras/ooxmlexport/data/tdf125324.docx new file mode 100644 index ..9382e295f00c Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf125324.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx index 804d25b9612e..e392644f0de3 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx @@ -348,6 +348,13 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf125657, "tdf125657.docx") checkAttrIsInt("b"); } +DECLARE_OOXMLEXPORT_TEST(testTdf125324, "tdf125324.docx") +{ +discardDumpedLayout(); +xmlDocPtr pXmlDoc = parseLayoutDump(); +assertXPath(pXmlDoc, "/root/page/body/txt[2]/anchored/fly/tab/infos/bounds", "top", "4193"); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 5f0b20865008..a41f5dc96dce 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -3799,15 +3799,13 @@ void DocxAttributeOutput::TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t OString sTblpYSpec = convertToOOXMLVertOrient( pFrame->GetFrameFormat().GetVertOrient().GetVertOrient() ); sOrientation = convertToOOXMLVertOrientRel( pFrame->GetFrameFormat().GetVertOrient().GetRelationOrient() ); -if(sOrientation != "page") // do not write default -attrListTablePos->add( FSNS( XML_w, XML_vertAnchor ), sOrientation.getStr() ); +attrListTablePos->add( FSNS( XML_w, XML_vertAnchor ), sOrientation.getStr() ); if( !sTblpYSpec.isEmpty() ) attrListTablePos->add( FSNS( XML_w, XML_tblpYSpec ), sTblpYSpec.getStr() ); sOrientation = convertToOOXMLHoriOrientRel( pFrame->GetFrameFormat().GetHoriOrient().GetRelationOrient() ); -if(sOrientation != "page") // do not wirte default -attrListTablePos->add( FSNS( XML_w, XML_horzAnchor ), sOrientation.getStr() ); +attrListTablePos->add( FSNS( XML_w, XML_horzAnchor ), sOrientation.getStr() ); if( !sTblpXSpec.isEmpty() ) attrListTablePos->add( FSNS( XML_w, XML_tblpXSpec ), sTblpXSpec.getStr() ); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sw/qa sw/source
sw/qa/extras/ooxmlexport/data/tdf125324.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport13.cxx |7 +++ sw/source/filter/ww8/docxattributeoutput.cxx |6 ++ 3 files changed, 9 insertions(+), 4 deletions(-) New commits: commit dac2ff37431151d13589801fa4767633b4df72b9 Author: Patrick Jaap AuthorDate: Mon Jun 3 17:27:03 2019 +0200 Commit: Patrick Jaap CommitDate: Thu Jun 6 17:19:51 2019 +0200 tdf#125324 table export: do not ignore default values It seems like Writer default values for table positioning differ from OOXML spec. if nothing is given. So write them anyway during export. Change-Id: If5bf77de71b457a826be8f1559212e7d06c5237c Reviewed-on: https://gerrit.libreoffice.org/73402 Tested-by: Jenkins Reviewed-by: Patrick Jaap diff --git a/sw/qa/extras/ooxmlexport/data/tdf125324.docx b/sw/qa/extras/ooxmlexport/data/tdf125324.docx new file mode 100644 index ..9382e295f00c Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf125324.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx index 804d25b9612e..e392644f0de3 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx @@ -348,6 +348,13 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf125657, "tdf125657.docx") checkAttrIsInt("b"); } +DECLARE_OOXMLEXPORT_TEST(testTdf125324, "tdf125324.docx") +{ +discardDumpedLayout(); +xmlDocPtr pXmlDoc = parseLayoutDump(); +assertXPath(pXmlDoc, "/root/page/body/txt[2]/anchored/fly/tab/infos/bounds", "top", "4193"); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index dfd316ee1626..f2c30c2eb654 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -3799,15 +3799,13 @@ void DocxAttributeOutput::TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t OString sTblpYSpec = convertToOOXMLVertOrient( pFrame->GetFrameFormat().GetVertOrient().GetVertOrient() ); sOrientation = convertToOOXMLVertOrientRel( pFrame->GetFrameFormat().GetVertOrient().GetRelationOrient() ); -if(sOrientation != "page") // do not write default -attrListTablePos->add( FSNS( XML_w, XML_vertAnchor ), sOrientation.getStr() ); +attrListTablePos->add( FSNS( XML_w, XML_vertAnchor ), sOrientation.getStr() ); if( !sTblpYSpec.isEmpty() ) attrListTablePos->add( FSNS( XML_w, XML_tblpYSpec ), sTblpYSpec.getStr() ); sOrientation = convertToOOXMLHoriOrientRel( pFrame->GetFrameFormat().GetHoriOrient().GetRelationOrient() ); -if(sOrientation != "page") // do not wirte default -attrListTablePos->add( FSNS( XML_w, XML_horzAnchor ), sOrientation.getStr() ); +attrListTablePos->add( FSNS( XML_w, XML_horzAnchor ), sOrientation.getStr() ); if( !sTblpXSpec.isEmpty() ) attrListTablePos->add( FSNS( XML_w, XML_tblpXSpec ), sTblpXSpec.getStr() ); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-2' - sw/qa sw/source
sw/qa/extras/uiwriter/data2/floating-table-position.docx |binary sw/qa/extras/uiwriter/uiwriter2.cxx | 41 +++ sw/source/filter/ww8/docxattributeoutput.cxx | 197 +-- 3 files changed, 164 insertions(+), 74 deletions(-) New commits: commit 66e9170028380b04b5cfd80d0de57994af6ab973 Author: Patrick Jaap AuthorDate: Thu Feb 14 10:08:58 2019 +0100 Commit: Miklos Vajna CommitDate: Fri Apr 12 09:49:07 2019 +0200 FIX: DOCX export: use all updated attributes during table export In a previous commit only x/y coordinate were considered. For better overview make use of the OOXML converter for orients and relations. Change-Id: I9792ccfbc2ebb58fd768c14278cdfd9b54efe62f Reviewed-on: https://gerrit.libreoffice.org/69523 Tested-by: Jenkins Reviewed-by: Miklos Vajna Reviewed-on: https://gerrit.libreoffice.org/70589 diff --git a/sw/qa/extras/uiwriter/data2/floating-table-position.docx b/sw/qa/extras/uiwriter/data2/floating-table-position.docx new file mode 100644 index ..de7a467aac1b Binary files /dev/null and b/sw/qa/extras/uiwriter/data2/floating-table-position.docx differ diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx index 52768e05086e..2344aa743248 100644 --- a/sw/qa/extras/uiwriter/uiwriter2.cxx +++ b/sw/qa/extras/uiwriter/uiwriter2.cxx @@ -45,6 +45,7 @@ public: void testTdf101873(); void testTableWidth(); void testTdf122942(); +void testDocxAttributeTableExport(); CPPUNIT_TEST_SUITE(SwUiWriterTest2); CPPUNIT_TEST(testRedlineMoveInsertInDelete); @@ -59,6 +60,7 @@ public: CPPUNIT_TEST(testTdf101873); CPPUNIT_TEST(testTableWidth); CPPUNIT_TEST(testTdf122942); +CPPUNIT_TEST(testDocxAttributeTableExport); CPPUNIT_TEST_SUITE_END(); private: @@ -531,6 +533,45 @@ void SwUiWriterTest2::testTdf122942() CPPUNIT_ASSERT_LESS(static_cast(0), rVert.GetPos()); } +void SwUiWriterTest2::testDocxAttributeTableExport() +{ +createDoc("floating-table-position.docx"); + +// get the table frame, set new values and dismiss the references +{ +uno::Reference xDrawPageSupplier(mxComponent, uno::UNO_QUERY); +uno::Reference xDrawPage(xDrawPageSupplier->getDrawPage(), + uno::UNO_QUERY); +uno::Reference xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY); + +// change the properties +// 8133 -> 8000 +xShape->setPropertyValue("VertOrientPosition", uno::makeAny(static_cast(8000))); +// 5964 -> 5000 +xShape->setPropertyValue("HoriOrientPosition", uno::makeAny(static_cast(5000))); +// 0 (frame) -> 8 (page print area) +xShape->setPropertyValue("VertOrientRelation", uno::makeAny(static_cast(8))); +// 8 (page print area) -> 0 (frame) +xShape->setPropertyValue("HoriOrientRelation", uno::makeAny(static_cast(0))); +} +// save it to docx +reload("Office Open XML Text", "floating-table-position.docx"); + +uno::Reference xDrawPageSupplier(mxComponent, uno::UNO_QUERY); +uno::Reference xDrawPage(xDrawPageSupplier->getDrawPage(), + uno::UNO_QUERY); +uno::Reference xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY); + +// test the new values +sal_Int32 nValue = getProperty(xShape, "VertOrientPosition"); +CPPUNIT_ASSERT(sal_Int32(7999) <= nValue && nValue <= sal_Int32(8001)); +nValue = getProperty(xShape, "HoriOrientPosition"); +CPPUNIT_ASSERT(sal_Int32(4999) <= nValue && nValue <= sal_Int32(5001)); + +CPPUNIT_ASSERT_EQUAL(sal_Int16(8), getProperty(xShape, "VertOrientRelation")); +CPPUNIT_ASSERT_EQUAL(sal_Int16(0), getProperty(xShape, "HoriOrientRelation")); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest2); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index aab60d8cec1c..e18557016ec9 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -495,8 +495,6 @@ static OString convertToOOXMLVertOrient(sal_Int16 nOrient) { switch( nOrient ) { -case text::VertOrientation::NONE: -return OString(); case text::VertOrientation::CENTER: case text::VertOrientation::LINE_CENTER: return OString( "center" ); @@ -507,8 +505,9 @@ static OString convertToOOXMLVertOrient(sal_Int16 nOrient) case text::VertOrientation::TOP: return OString( "top" ); case text::VertOrientation::LINE_TOP: -default: return OSt
[Libreoffice-commits] core.git: Branch 'libreoffice-6-2' - sw/source
sw/source/filter/ww8/docxattributeoutput.cxx | 25 +++-- 1 file changed, 11 insertions(+), 14 deletions(-) New commits: commit cafed2e65e86d813822d2c650fa057f1a1f81c06 Author: Patrick Jaap AuthorDate: Wed Apr 3 14:58:05 2019 +0200 Commit: Miklos Vajna CommitDate: Thu Apr 11 10:15:29 2019 +0200 Fix in convertToOOXMLHoriOrient: values of VertOrient were taken Change-Id: I47093292aeed5c0579dd4b365561ee86935632e4 Reviewed-on: https://gerrit.libreoffice.org/70197 Tested-by: Jenkins Reviewed-by: Julien Nabet (cherry picked from commit 2111f607973166ebc39414ba6d2019832bcfe4da) Reviewed-on: https://gerrit.libreoffice.org/70513 Reviewed-by: Miklos Vajna diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 7d6a618b554f..aab60d8cec1c 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -512,24 +512,21 @@ static OString convertToOOXMLVertOrient(sal_Int16 nOrient) } } -static OString convertToOOXMLHoriOrient(sal_Int16 nOrient) +static OString convertToOOXMLHoriOrient(sal_Int16 nOrient, bool bIsPosToggle) { switch( nOrient ) { -case text::VertOrientation::NONE: +case text::HoriOrientation::NONE: return OString(); -case text::VertOrientation::CENTER: -case text::VertOrientation::LINE_CENTER: -return OString( "center" ); -case text::VertOrientation::BOTTOM: -return OString( "bottom" ); -case text::VertOrientation::LINE_BOTTOM: -return OString( "outside" ); -case text::VertOrientation::TOP: -return OString( "top" ); -case text::VertOrientation::LINE_TOP: +case text::HoriOrientation::LEFT: +return OString( bIsPosToggle ? "inside" : "left" ); +case text::HoriOrientation::RIGHT: +return OString( bIsPosToggle ? "outside" : "right" ); +case text::HoriOrientation::CENTER: +// fall-through indended +case text::HoriOrientation::FULL: default: -return OString( "inside" ); +return OString( "center" ); } } @@ -8407,7 +8404,7 @@ void DocxAttributeOutput::FormatVertOrientation( const SwFormatVertOrient& rFlyV void DocxAttributeOutput::FormatHorizOrientation( const SwFormatHoriOrient& rFlyHori ) { -OString sAlign = convertToOOXMLHoriOrient( rFlyHori.GetHoriOrient() ); +OString sAlign = convertToOOXMLHoriOrient( rFlyHori.GetHoriOrient(), rFlyHori.IsPosToggle() ); OString sHAnchor = convertToOOXMLHoriOrientRel( rFlyHori.GetRelationOrient() ); if (m_rExport.SdrExporter().getTextFrameSyntax()) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-2' - sw/qa sw/source
sw/qa/extras/ooxmlexport/ooxmlexport4.cxx| 11 sw/source/filter/ww8/docxattributeoutput.cxx | 37 +-- 2 files changed, 46 insertions(+), 2 deletions(-) New commits: commit ba5aa1e7ddf0e538132bacae059a66a3802f5693 Author: Patrick Jaap AuthorDate: Thu Feb 14 10:00:36 2019 +0100 Commit: Miklos Vajna CommitDate: Wed Apr 10 11:52:26 2019 +0200 FIX: Use correct table x/y postion in docx export Until now we exported the original x/y position values of the table from the grabbag. Ignoring users actions like moving the table around. Now, we compute the position from the parent frame and write the actual position in the docx file. Change-Id: I25a09f9c7c8fbe49acbd19e2b1440c7fa90b8aff Reviewed-on: https://gerrit.libreoffice.org/67969 Tested-by: Jenkins Reviewed-by: Miklos Vajna (cherry picked from commit 4f30b2ab729eb7f024e8078acbc099b25f588e9f) Reviewed-on: https://gerrit.libreoffice.org/70306 diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx index 70fb4a16a73e..f3faf8cfab15 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx @@ -1219,6 +1219,17 @@ DECLARE_OOXMLEXPORT_TEST(testTdf81345_045Original,"tdf81345.docx") CPPUNIT_ASSERT_EQUAL(sal_Int32(6736947), getProperty(xStyle, "CharColor")); } +DECLARE_OOXMLEXPORT_TEST(testDocxTablePosition, "floating-table-position.docx") +{ +xmlDocPtr pXmlDoc = parseExport("word/document.xml"); +if (!pXmlDoc) +return; + +// the exported positions were wrong due to some missing shifting in the export code +assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tblPr/w:tblpPr", "tblpX", "3494"); +assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tblPr/w:tblpPr", "tblpY", "4611"); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index dfb12d1cc25e..7d6a618b554f 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -3848,6 +3848,8 @@ void DocxAttributeOutput::TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t { FastAttributeList *attrListTablePos = FastSerializerHelper::createAttrList( ); uno::Sequence aTablePosition = rGrabBagElement.second.get >(); +// look for a surrounding frame and take it's position values +const ww8::Frame* pFrame = m_rExport.GetFloatingTableFrame(); for (sal_Int32 i = 0; i < aTablePosition.getLength(); ++i) { if (aTablePosition[i].Name == "vertAnchor" && !aTablePosition[i].Value.get().isEmpty()) @@ -3888,11 +3890,42 @@ void DocxAttributeOutput::TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t } else if (aTablePosition[i].Name == "tblpX") { -attrListTablePos->add( FSNS( XML_w, XML_tblpX ), OString::number( aTablePosition[i].Value.get() ) ); +sal_Int32 nValue = 0; +if (pFrame) +{ +nValue = pFrame->GetFrameFormat().GetHoriOrient().GetPos(); +// we need to revert the additional shift introduced by +// lcl_DecrementHoriOrientPosition() in writerfilter +// 1st: left distance of the table +const SwTableBox * pTabBox = pTableTextNodeInfoInner->getTableBox(); +const SwFrameFormat * pFrameFormat = pTabBox->GetFrameFormat(); +const SvxBoxItem& rBox = pFrameFormat->GetBox( ); +sal_uInt16 nLeftDistance = rBox.GetDistance(SvxBoxItemLine::LEFT); +nValue += nLeftDistance; + +// 2nd: if a left border is given, revert the shift by half the width +// from lcl_DecrementHoriOrientPosition() in writerfilter +if (const editeng::SvxBorderLine* pLeftBorder = rBox.GetLeft()) +{ +long nWidth = pLeftBorder->GetWidth(); +nValue += (nWidth / 2); +} +} +else +nValue = aTablePosition[i].Value.get(); + +attrListTablePos->add( FSNS( XML_w, XML_tblpX ), OString::number( nValue ) ); } else if (aTablePosition[i].Name == "tblpY") { -attrListTablePos->add( FSNS( XML_w, XML_tblpY ), OString::number
[Libreoffice-commits] core.git: Branch 'libreoffice-6-2' - sw/source
sw/source/filter/ww8/docxattributeoutput.cxx | 194 +++ 1 file changed, 81 insertions(+), 113 deletions(-) New commits: commit 90b7c88c154d85d1637cdd3c6d0d0150bb8158fd Author: Patrick Jaap AuthorDate: Thu Feb 14 10:08:58 2019 +0100 Commit: Miklos Vajna CommitDate: Mon Apr 8 13:47:11 2019 +0200 Converters for OOXML orients and relations Change-Id: I8e3ade11881d88e937b1a55598813b2265cafd95 Reviewed-on: https://gerrit.libreoffice.org/69522 Reviewed-by: Noel Grandin Tested-by: Jenkins Reviewed-by: Miklos Vajna (cherry picked from commit bbe8bc3c8610d5d218afaa779e86d822a7a76345) Reviewed-on: https://gerrit.libreoffice.org/70307 diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 78a41c64aa6e..dfb12d1cc25e 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -491,6 +491,79 @@ void DocxAttributeOutput::StartParagraph( ww8::WW8TableNodeInfo::Pointer_t pText m_bIsFirstParagraph = false; } +static OString convertToOOXMLVertOrient(sal_Int16 nOrient) +{ +switch( nOrient ) +{ +case text::VertOrientation::NONE: +return OString(); +case text::VertOrientation::CENTER: +case text::VertOrientation::LINE_CENTER: +return OString( "center" ); +case text::VertOrientation::BOTTOM: +return OString( "bottom" ); +case text::VertOrientation::LINE_BOTTOM: +return OString( "outside" ); +case text::VertOrientation::TOP: +return OString( "top" ); +case text::VertOrientation::LINE_TOP: +default: +return OString( "inside" ); +} +} + +static OString convertToOOXMLHoriOrient(sal_Int16 nOrient) +{ +switch( nOrient ) +{ +case text::VertOrientation::NONE: +return OString(); +case text::VertOrientation::CENTER: +case text::VertOrientation::LINE_CENTER: +return OString( "center" ); +case text::VertOrientation::BOTTOM: +return OString( "bottom" ); +case text::VertOrientation::LINE_BOTTOM: +return OString( "outside" ); +case text::VertOrientation::TOP: +return OString( "top" ); +case text::VertOrientation::LINE_TOP: +default: +return OString( "inside" ); +} +} + +static OString convertToOOXMLVertOrientRel(sal_Int16 nOrientRel) +{ +switch (nOrientRel) +{ +case text::RelOrientation::PAGE_PRINT_AREA: +return OString("margin"); +case text::RelOrientation::PAGE_FRAME: +return OString("page"); +case text::RelOrientation::FRAME: +case text::RelOrientation::TEXT_LINE: +default: +return OString("text"); +} +} + +static OString convertToOOXMLHoriOrientRel(sal_Int16 nOrientRel) +{ +switch (nOrientRel) +{ +case text::RelOrientation::PAGE_PRINT_AREA: +return OString("margin"); +case text::RelOrientation::PAGE_FRAME: +return OString("page"); +case text::RelOrientation::CHAR: +case text::RelOrientation::PAGE_RIGHT: +case text::RelOrientation::FRAME: +default: +return OString("text"); +} +} + static void lcl_deleteAndResetTheLists( rtl::Reference& pSdtPrTokenChildren, rtl::Reference& pSdtPrDataBindingAttrs, OUString& rSdtPrAlias) { if( pSdtPrTokenChildren.is() ) @@ -514,38 +587,8 @@ void DocxAttributeOutput::PopulateFrameProperties(const SwFrameFormat* pFrameFor attrList->add( FSNS( XML_w, XML_x), OString::number(aPos.X)); attrList->add( FSNS( XML_w, XML_y), OString::number(aPos.Y)); -const char* relativeFromH; -const char* relativeFromV; -switch (pFrameFormat->GetVertOrient().GetRelationOrient()) -{ -case text::RelOrientation::PAGE_PRINT_AREA: -relativeFromV = "margin"; -break; -case text::RelOrientation::PAGE_FRAME: -relativeFromV = "page"; -break; -case text::RelOrientation::FRAME: -case text::RelOrientation::TEXT_LINE: -default: -relativeFromV = "text"; -break; -} - -switch (pFrameFormat->GetHoriOrient().GetRelationOrient()) -{ -case text::RelOrientation::PAGE_PRINT_AREA: -relativeFromH = "margin"; -break; -case text::RelOrientation::PAGE_FRAME: -relativeFromH = "page"; -break; -case text::RelOrientation::CHAR: -case text::RelOrientation::PAGE_RIGHT: -case text::RelOrientation::FRAME: -default
[Libreoffice-commits] core.git: sw/qa sw/source
sw/qa/extras/uiwriter/data2/floating-table-position.docx |binary sw/qa/extras/uiwriter/uiwriter2.cxx | 41 +++ sw/source/filter/ww8/docxattributeoutput.cxx | 197 +-- 3 files changed, 164 insertions(+), 74 deletions(-) New commits: commit 2d6f8c36126effc66ea35af2e65da6609fcfe013 Author: Patrick Jaap AuthorDate: Thu Feb 14 10:08:58 2019 +0100 Commit: Miklos Vajna CommitDate: Fri Apr 5 15:33:48 2019 +0200 FIX: DOCX export: use all updated attributes during table export In a previous commit only x/y coordinate were considered. For better overview make use of the OOXML converter for orients and relations. Change-Id: I9792ccfbc2ebb58fd768c14278cdfd9b54efe62f Reviewed-on: https://gerrit.libreoffice.org/69523 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/sw/qa/extras/uiwriter/data2/floating-table-position.docx b/sw/qa/extras/uiwriter/data2/floating-table-position.docx new file mode 100644 index ..de7a467aac1b Binary files /dev/null and b/sw/qa/extras/uiwriter/data2/floating-table-position.docx differ diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx index 9655d1e9b80c..ddebd9a1a662 100644 --- a/sw/qa/extras/uiwriter/uiwriter2.cxx +++ b/sw/qa/extras/uiwriter/uiwriter2.cxx @@ -71,6 +71,7 @@ public: void testDropDownFormFieldInsertion(); void testMixedFormFieldInsertion(); void testTdf124261(); +void testDocxAttributeTableExport(); CPPUNIT_TEST_SUITE(SwUiWriterTest2); CPPUNIT_TEST(testRedlineMoveInsertInDelete); @@ -100,6 +101,7 @@ public: CPPUNIT_TEST(testDropDownFormFieldInsertion); CPPUNIT_TEST(testMixedFormFieldInsertion); CPPUNIT_TEST(testTdf124261); +CPPUNIT_TEST(testDocxAttributeTableExport); CPPUNIT_TEST_SUITE_END(); virtual std::unique_ptr preTest(const char* filename) override @@ -1158,6 +1160,45 @@ void SwUiWriterTest2::testTdf124261() #endif } +void SwUiWriterTest2::testDocxAttributeTableExport() +{ +createDoc("floating-table-position.docx"); + +// get the table frame, set new values and dismiss the references +{ +uno::Reference xDrawPageSupplier(mxComponent, uno::UNO_QUERY); +uno::Reference xDrawPage(xDrawPageSupplier->getDrawPage(), + uno::UNO_QUERY); +uno::Reference xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY); + +// change the properties +// 8133 -> 8000 +xShape->setPropertyValue("VertOrientPosition", uno::makeAny(static_cast(8000))); +// 5964 -> 5000 +xShape->setPropertyValue("HoriOrientPosition", uno::makeAny(static_cast(5000))); +// 0 (frame) -> 8 (page print area) +xShape->setPropertyValue("VertOrientRelation", uno::makeAny(static_cast(8))); +// 8 (page print area) -> 0 (frame) +xShape->setPropertyValue("HoriOrientRelation", uno::makeAny(static_cast(0))); +} +// save it to docx +reload("Office Open XML Text", "floating-table-position.docx"); + +uno::Reference xDrawPageSupplier(mxComponent, uno::UNO_QUERY); +uno::Reference xDrawPage(xDrawPageSupplier->getDrawPage(), + uno::UNO_QUERY); +uno::Reference xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY); + +// test the new values +sal_Int32 nValue = getProperty(xShape, "VertOrientPosition"); +CPPUNIT_ASSERT(sal_Int32(7999) <= nValue && nValue <= sal_Int32(8001)); +nValue = getProperty(xShape, "HoriOrientPosition"); +CPPUNIT_ASSERT(sal_Int32(4999) <= nValue && nValue <= sal_Int32(5001)); + +CPPUNIT_ASSERT_EQUAL(sal_Int16(8), getProperty(xShape, "VertOrientRelation")); +CPPUNIT_ASSERT_EQUAL(sal_Int16(0), getProperty(xShape, "HoriOrientRelation")); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest2); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index c1a20445fc09..e4ce85632f08 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -500,8 +500,6 @@ static OString convertToOOXMLVertOrient(sal_Int16 nOrient) { switch( nOrient ) { -case text::VertOrientation::NONE: -return OString(); case text::VertOrientation::CENTER: case text::VertOrientation::LINE_CENTER: return OString( "center" ); @@ -512,8 +510,9 @@ static OString convertToOOXMLVertOrient(sal_Int16 nOrient) case text::VertOrientation::TOP: return OString( "top" ); case text::VertOrientation::LINE_TOP: -default:
[Libreoffice-commits] core.git: sw/source
sw/source/filter/ww8/docxattributeoutput.cxx | 25 +++-- 1 file changed, 11 insertions(+), 14 deletions(-) New commits: commit 2111f607973166ebc39414ba6d2019832bcfe4da Author: Patrick Jaap AuthorDate: Wed Apr 3 14:58:05 2019 +0200 Commit: Julien Nabet CommitDate: Wed Apr 3 20:49:12 2019 +0200 Fix in convertToOOXMLHoriOrient: values of VertOrient were taken Change-Id: I47093292aeed5c0579dd4b365561ee86935632e4 Reviewed-on: https://gerrit.libreoffice.org/70197 Tested-by: Jenkins Reviewed-by: Julien Nabet diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 969c2f2e830f..663670e38c9c 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -517,24 +517,21 @@ static OString convertToOOXMLVertOrient(sal_Int16 nOrient) } } -static OString convertToOOXMLHoriOrient(sal_Int16 nOrient) +static OString convertToOOXMLHoriOrient(sal_Int16 nOrient, bool bIsPosToggle) { switch( nOrient ) { -case text::VertOrientation::NONE: +case text::HoriOrientation::NONE: return OString(); -case text::VertOrientation::CENTER: -case text::VertOrientation::LINE_CENTER: -return OString( "center" ); -case text::VertOrientation::BOTTOM: -return OString( "bottom" ); -case text::VertOrientation::LINE_BOTTOM: -return OString( "outside" ); -case text::VertOrientation::TOP: -return OString( "top" ); -case text::VertOrientation::LINE_TOP: +case text::HoriOrientation::LEFT: +return OString( bIsPosToggle ? "inside" : "left" ); +case text::HoriOrientation::RIGHT: +return OString( bIsPosToggle ? "outside" : "right" ); +case text::HoriOrientation::CENTER: +// fall-through indended +case text::HoriOrientation::FULL: default: -return OString( "inside" ); +return OString( "center" ); } } @@ -8392,7 +8389,7 @@ void DocxAttributeOutput::FormatVertOrientation( const SwFormatVertOrient& rFlyV void DocxAttributeOutput::FormatHorizOrientation( const SwFormatHoriOrient& rFlyHori ) { -OString sAlign = convertToOOXMLHoriOrient( rFlyHori.GetHoriOrient() ); +OString sAlign = convertToOOXMLHoriOrient( rFlyHori.GetHoriOrient(), rFlyHori.IsPosToggle() ); OString sHAnchor = convertToOOXMLHoriOrientRel( rFlyHori.GetRelationOrient() ); if (m_rExport.SdrExporter().getTextFrameSyntax()) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sw/source
sw/source/filter/ww8/docxattributeoutput.cxx | 194 +++ 1 file changed, 81 insertions(+), 113 deletions(-) New commits: commit bbe8bc3c8610d5d218afaa779e86d822a7a76345 Author: Patrick Jaap AuthorDate: Thu Feb 14 10:08:58 2019 +0100 Commit: Miklos Vajna CommitDate: Mon Mar 25 13:40:40 2019 +0100 Converters for OOXML orients and relations Change-Id: I8e3ade11881d88e937b1a55598813b2265cafd95 Reviewed-on: https://gerrit.libreoffice.org/69522 Reviewed-by: Noel Grandin Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 467af568afcb..c40121040717 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -495,6 +495,79 @@ void DocxAttributeOutput::StartParagraph( ww8::WW8TableNodeInfo::Pointer_t pText m_bIsFirstParagraph = false; } +static OString convertToOOXMLVertOrient(sal_Int16 nOrient) +{ +switch( nOrient ) +{ +case text::VertOrientation::NONE: +return OString(); +case text::VertOrientation::CENTER: +case text::VertOrientation::LINE_CENTER: +return OString( "center" ); +case text::VertOrientation::BOTTOM: +return OString( "bottom" ); +case text::VertOrientation::LINE_BOTTOM: +return OString( "outside" ); +case text::VertOrientation::TOP: +return OString( "top" ); +case text::VertOrientation::LINE_TOP: +default: +return OString( "inside" ); +} +} + +static OString convertToOOXMLHoriOrient(sal_Int16 nOrient) +{ +switch( nOrient ) +{ +case text::VertOrientation::NONE: +return OString(); +case text::VertOrientation::CENTER: +case text::VertOrientation::LINE_CENTER: +return OString( "center" ); +case text::VertOrientation::BOTTOM: +return OString( "bottom" ); +case text::VertOrientation::LINE_BOTTOM: +return OString( "outside" ); +case text::VertOrientation::TOP: +return OString( "top" ); +case text::VertOrientation::LINE_TOP: +default: +return OString( "inside" ); +} +} + +static OString convertToOOXMLVertOrientRel(sal_Int16 nOrientRel) +{ +switch (nOrientRel) +{ +case text::RelOrientation::PAGE_PRINT_AREA: +return OString("margin"); +case text::RelOrientation::PAGE_FRAME: +return OString("page"); +case text::RelOrientation::FRAME: +case text::RelOrientation::TEXT_LINE: +default: +return OString("text"); +} +} + +static OString convertToOOXMLHoriOrientRel(sal_Int16 nOrientRel) +{ +switch (nOrientRel) +{ +case text::RelOrientation::PAGE_PRINT_AREA: +return OString("margin"); +case text::RelOrientation::PAGE_FRAME: +return OString("page"); +case text::RelOrientation::CHAR: +case text::RelOrientation::PAGE_RIGHT: +case text::RelOrientation::FRAME: +default: +return OString("text"); +} +} + static void lcl_deleteAndResetTheLists( rtl::Reference& pSdtPrTokenChildren, rtl::Reference& pSdtPrDataBindingAttrs, OUString& rSdtPrAlias) { if( pSdtPrTokenChildren.is() ) @@ -518,38 +591,8 @@ void DocxAttributeOutput::PopulateFrameProperties(const SwFrameFormat* pFrameFor attrList->add( FSNS( XML_w, XML_x), OString::number(aPos.X)); attrList->add( FSNS( XML_w, XML_y), OString::number(aPos.Y)); -const char* relativeFromH; -const char* relativeFromV; -switch (pFrameFormat->GetVertOrient().GetRelationOrient()) -{ -case text::RelOrientation::PAGE_PRINT_AREA: -relativeFromV = "margin"; -break; -case text::RelOrientation::PAGE_FRAME: -relativeFromV = "page"; -break; -case text::RelOrientation::FRAME: -case text::RelOrientation::TEXT_LINE: -default: -relativeFromV = "text"; -break; -} - -switch (pFrameFormat->GetHoriOrient().GetRelationOrient()) -{ -case text::RelOrientation::PAGE_PRINT_AREA: -relativeFromH = "margin"; -break; -case text::RelOrientation::PAGE_FRAME: -relativeFromH = "page"; -break; -case text::RelOrientation::CHAR: -case text::RelOrientation::PAGE_RIGHT: -case text::RelOrientation::FRAME: -default: -relativeFromH = "text"; -break; -} +OString relativeFromH = convertToOOXMLHoriOrientRel(
[Libreoffice-commits] core.git: sw/qa sw/source
sw/qa/extras/ooxmlexport/ooxmlexport4.cxx| 11 sw/source/filter/ww8/docxattributeoutput.cxx | 37 +-- 2 files changed, 46 insertions(+), 2 deletions(-) New commits: commit 4f30b2ab729eb7f024e8078acbc099b25f588e9f Author: Patrick Jaap AuthorDate: Thu Feb 14 10:00:36 2019 +0100 Commit: Miklos Vajna CommitDate: Fri Mar 22 17:02:23 2019 +0100 FIX: Use correct table x/y postion in docx export Until now we exported the original x/y position values of the table from the grabbag. Ignoring users actions like moving the table around. Now, we compute the position from the parent frame and write the actual position in the docx file. Change-Id: I25a09f9c7c8fbe49acbd19e2b1440c7fa90b8aff Reviewed-on: https://gerrit.libreoffice.org/67969 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx index 5a27c6cec264..9fc349496f44 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx @@ -1237,6 +1237,17 @@ DECLARE_OOXMLEXPORT_TEST(testTdf81345_045Original,"tdf81345.docx") } #endif +DECLARE_OOXMLEXPORT_TEST(testDocxTablePosition, "floating-table-position.docx") +{ +xmlDocPtr pXmlDoc = parseExport("word/document.xml"); +if (!pXmlDoc) +return; + +// the exported positions were wrong due to some missing shifting in the export code +assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tblPr/w:tblpPr", "tblpX", "3494"); +assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tblPr/w:tblpPr", "tblpY", "4611"); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 0753ae83abf1..467af568afcb 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -3802,6 +3802,8 @@ void DocxAttributeOutput::TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t { FastAttributeList *attrListTablePos = FastSerializerHelper::createAttrList( ); uno::Sequence aTablePosition = rGrabBagElement.second.get >(); +// look for a surrounding frame and take it's position values +const ww8::Frame* pFrame = m_rExport.GetFloatingTableFrame(); for (sal_Int32 i = 0; i < aTablePosition.getLength(); ++i) { if (aTablePosition[i].Name == "vertAnchor" && !aTablePosition[i].Value.get().isEmpty()) @@ -3842,11 +3844,42 @@ void DocxAttributeOutput::TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t } else if (aTablePosition[i].Name == "tblpX") { -attrListTablePos->add( FSNS( XML_w, XML_tblpX ), OString::number( aTablePosition[i].Value.get() ) ); +sal_Int32 nValue = 0; +if (pFrame) +{ +nValue = pFrame->GetFrameFormat().GetHoriOrient().GetPos(); +// we need to revert the additional shift introduced by +// lcl_DecrementHoriOrientPosition() in writerfilter +// 1st: left distance of the table +const SwTableBox * pTabBox = pTableTextNodeInfoInner->getTableBox(); +const SwFrameFormat * pFrameFormat = pTabBox->GetFrameFormat(); +const SvxBoxItem& rBox = pFrameFormat->GetBox( ); +sal_uInt16 nLeftDistance = rBox.GetDistance(SvxBoxItemLine::LEFT); +nValue += nLeftDistance; + +// 2nd: if a left border is given, revert the shift by half the width +// from lcl_DecrementHoriOrientPosition() in writerfilter +if (const editeng::SvxBorderLine* pLeftBorder = rBox.GetLeft()) +{ +long nWidth = pLeftBorder->GetWidth(); +nValue += (nWidth / 2); +} +} +else +nValue = aTablePosition[i].Value.get(); + +attrListTablePos->add( FSNS( XML_w, XML_tblpX ), OString::number( nValue ) ); } else if (aTablePosition[i].Name == "tblpY") { -attrListTablePos->add( FSNS( XML_w, XML_tblpY ), OString::number( aTablePosition[i].Value.get() ) ); +sal_Int32 nValue = 0; +if (pFrame) +// no additional shift occur (like in the tblpX case) +
Re: autogen.sh : libEGL required
Hi! Am 12.11.18 um 18:36 schrieb Christian Lohmaier: No idea about possible conflicts with nvidia driver, but my distro calls the package libmesaegl1-devel / query your packages for the pkg-config file egl.pc or eglplatform.h header file Thanks for the quick answer! That package is no Ubuntu package, and I think it is the equivalent of "libegl1-mesa-dev" in Ubuntu. Nevertheless, I made a clean fresh install without messing around with my graphics drivers and see, now autogen.sh runs like charm. So, the problem is solved for me. ciao Christian Best, Patrick ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice
autogen.sh : libEGL required
Hi there! A try to build LibreOffice on an Ubuntu 18.04 machine and ./autogen.sh stops with [..] checking for gobject-introspection... yes checking for eglMakeCurrent in -lEGL... no configure: error: libEGL required. Error running configure at ./autogen.sh line 296. On my system are libegl1-mesa-dev libegl-mesa0 libegl1 libegl1-mesa libnvidia-gl-390 installed. I have some trouble with my nvidia driver. Can this cause the error? I don't know how to continue here... I reinstalled the libraries and nvidia driver. Maybe someone knows something! Regards, Patrick ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice
Need help with unit test (layout Writer)
Hi there! I need help with a Writer layout test. You can find my patch here: https://gerrit.libreoffice.org/#/c/62987/ bug: https://bugs.documentfoundation.org/show_bug.cgi?id=120839 The odt file on gerrit has a textbox at the second page. If I move it (using the mouse) a few cm higher, the content disappears without this patch on gerrit. How can I test this? Otherwise you can use the file from the bugtracker (last image). Regards, Patrick ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: LibreOffice Digest, Vol 99, Issue 1
Hi! Am 01.11.2018 um 13:00 schrieb libreoffice-requ...@lists.freedesktop.org: Hi, Check for en_US.UTF-8 locale was introduced in 6b56ca7a9bf67bcada666f4cb1c2e20e7c0d512e. You have to generate this locale on your machine: https://wiki.debian.org/Locale#Standard Regards, Arkadiy Illarionov That did the trick! Thanks! For other people affected: "dpkg-reconfigure locales" generates the missing locale on debian! Regards, Patrick ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: master build problems with en_US.utf8 locale
The autogen.sh error is introduced by commit 6b56ca7a9bf67bcada666f4cb1c2e20e7c0d512e Author: Mike Kaganski Date:  Mon Oct 29 14:36:24 2018 +0100    Add check for en_US.utf8 locale    Change-Id: I62ce7680c65ec49dd81085d4087c578f3b6c7907    Reviewed-on: https://gerrit.libreoffice.org/62508    Tested-by: Jenkins    Reviewed-by: Mike Kaganski Why is the en_US.utf8 locale necessary? Regards, Patrick Am 31.10.2018 um 12:59 schrieb Patrick Jaap: Hi! Currently, I cannot build master. The configuration stops with [...] checking for gawk... gawk checking for gawk... /usr/bin/gawk checking for bash... /bin/bash checking for en_US.utf8 locale... absent configure: error: you need en_US.utf8 locale to build Error running configure at /home/tu/git-stuff/libreoffice/autogen.sh line 296. On my older branches it works well. I have use "Debian testing" (64bit). Is this a LO related problem or is it a bug in Debian? Regrads, Patrick ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice
master build problems with en_US.utf8 locale
Hi! Currently, I cannot build master. The configuration stops with [...] checking for gawk... gawk checking for gawk... /usr/bin/gawk checking for bash... /bin/bash checking for en_US.utf8 locale... absent configure: error: you need en_US.utf8 locale to build Error running configure at /home/tu/git-stuff/libreoffice/autogen.sh line 296. On my older branches it works well. I have use "Debian testing" (64bit). Is this a LO related problem or is it a bug in Debian? Regrads, Patrick ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: layout.xml differs from parseDump(...)
Hi Thorsten! Thanks for the hint with the Scheduler method. Unfortunately, it did not change anything... I figured another way to do the unit test: I want to check that no "POR_FLY" portions are created in the document. A first ugly patch is here    https://gerrit.libreoffice.org/#/c/60319/ and I added you as a reviewer. Do you have an idea how to iterate over all "Special" parts of a text node? My first solution is really, really ugly. Regards, Patrick Am 08.09.2018 um 01:35 schrieb Thorsten Behrens: > Hi Patrick, > > Patrick Jaap wrote: >> So, the first one is equal, but the other ones are shifted by 333. >> >> How can this be caused? Is this a bug? >> > Looks odd indeed. First thing that comes to mind: layouting continues > asynchronously after the load - perhaps a > Scheduler::ProcessEventsToIdle() helps. See uiwriter.cxx for a few > examples where that is used. > > Other than that, all a bit speculative. Any code / patch yet to look > at? > > Cheers, > > -- Thorsten ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice
layout.xml differs from parseDump(...)
Hi! I'm trying to write a simple unit test but this time it is confusing. For my odt-document the layout.xml says: There are 6 "txt" portions in the body and "info"->"bounds"->"top" values are top="2269" top="6022" top="6502" top="6882" top="7262" top="7642" In the unit test, I have    SAL_DEBUG("1: " << parseDump("/root/page/body/txt[1]/infos/bounds", "top").toInt32());    SAL_DEBUG("2: " << parseDump("/root/page/body/txt[2]/infos/bounds", "top").toInt32());    SAL_DEBUG("3: " << parseDump("/root/page/body/txt[3]/infos/bounds", "top").toInt32());    SAL_DEBUG("4: " << parseDump("/root/page/body/txt[4]/infos/bounds", "top").toInt32());    SAL_DEBUG("5: " << parseDump("/root/page/body/txt[5]/infos/bounds", "top").toInt32());    SAL_DEBUG("6: " << parseDump("/root/page/body/txt[6]/infos/bounds", "top").toInt32()); which returns debug:15038:15038: 1: 2269 debug:15038:15038: 2: 5689 debug:15038:15038: 3: 6169 debug:15038:15038: 4: 6549 debug:15038:15038: 5: 6929 debug:15038:15038: 6: 7309 So, the first one is equal, but the other ones are shifted by 333. How can this be caused? Is this a bug? Regards, Patrick ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: Missing w:separator attribute in OOXML file
Hi Thorsten! Am 26.08.2018 um 20:32 schrieb Thorsten Behrens: Hi Patrick, Patrick Jaap wrote: Has the behavior of Word changed? Reading the commit message, it seems like in the past Word does not show the separator when the attribute is missing. Word 2013 shows the line. Perhaps if you could share the word/settings.xml from the original file, especially the element contents? I put the contents of setting.xml at the end of this mail. (there used to be AnonODF, which perhaps could have served as a starting point for something similar directed at OOXML, sadly http://opendocument.xml.org/product/anonodfpy-hwd points into the void now..) Cheers, -- Thorsten Regards, Patrick http://schemas.openxmlformats.org/markup-compatibility/2006"xmlns:o="urn:schemas-microsoft-com:office:office"xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"xmlns:v="urn:schemas-microsoft-com:vml"xmlns:w10="urn:schemas-microsoft-com:office:word"xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml"xmlns:sl="http://schemas.openxmlformats.org/schemaLibrary/2006/main"mc:Ignorable="w14;> ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice
Missing w:separator attribute in OOXML file
Hi everyone! We encountered a problem while opening an OOXML file with footnotes. There is no "w:separator" attribute in the source file and the representation between Word 2013 and current LO master differs: - Word 2013 shows the separator line - LO master hides the separator line A little investigation lead to the fact that LO creates a separator line with zero length. This behavior was introduced by Miklos in the commit 330b860205c7ba69dd6603f65324d0f89ad9cd5f back in 2013. When I save the document in Word 2013 (even in compatibility modes) the result always contains a "w:separator" attribute and thus, LO shows the line. (unfortunately, I cannot add the file due to privacy reasons. Every attempt to anonymize the file leads the a w:separator attibute in the file) Has the behavior of Word changed? Reading the commit message, it seems like in the past Word does not show the separator when the attribute is missing. Word 2013 shows the line. Thanks, Patrick ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice
[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/qa sw/source
sw/qa/extras/odfimport/data/tdf116195.odt |binary sw/qa/extras/odfimport/odfimport.cxx |8 sw/source/filter/xml/xmlimp.cxx |2 +- 3 files changed, 9 insertions(+), 1 deletion(-) New commits: commit 39f2125c4952063f4bdc36d9abba18daaee72d68 Author: Patrick Jaap Date: Tue Apr 10 15:29:56 2018 +0200 tdf#116195 swap a compatibility value There was a minor bug in the compat flag, leading to a regression from commit 8d62b79f168180c6992eb483ec864d473050635f Change-Id: I1e468e665a583ef15b6e474c3adb32f1dcf98f46 Reviewed-on: https://gerrit.libreoffice.org/52674 Tested-by: Jenkins Reviewed-by: Miklos Vajna (cherry picked from commit fe3d5766fa3c42f6cf8d1ea47af820e0b1c1cf48) Reviewed-on: https://gerrit.libreoffice.org/55120 Reviewed-by: Patrick Jaap Reviewed-by: Adolfo Jayme Barrientos diff --git a/sw/qa/extras/odfimport/data/tdf116195.odt b/sw/qa/extras/odfimport/data/tdf116195.odt new file mode 100644 index ..21a601f69d66 Binary files /dev/null and b/sw/qa/extras/odfimport/data/tdf116195.odt differ diff --git a/sw/qa/extras/odfimport/odfimport.cxx b/sw/qa/extras/odfimport/odfimport.cxx index 175fa31c888e..8c57b5b2ffc7 100644 --- a/sw/qa/extras/odfimport/odfimport.cxx +++ b/sw/qa/extras/odfimport/odfimport.cxx @@ -902,5 +902,13 @@ DECLARE_ODFIMPORT_TEST(testTdf108482, "tdf108482.odt") ); } +DECLARE_ODFIMPORT_TEST(testTdf116195, "tdf116195.odt") +{ +// The image was set to zero height due to a regression +CPPUNIT_ASSERT_EQUAL( +sal_Int32(12960), parseDump("/root/page/anchored/fly/notxt/infos/bounds", "height").toInt32() +); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx index dfbc7f832105..18ca69cb9589 100644 --- a/sw/source/filter/xml/xmlimp.cxx +++ b/sw/source/filter/xml/xmlimp.cxx @@ -1399,7 +1399,7 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC if (!bSubtractFlysAnchoredAtFlys) xProps->setPropertyValue("SubtractFlysAnchoredAtFlys", makeAny(true)); -if ( !bDisableOffPagePositioning ) +if ( bDisableOffPagePositioning ) xProps->setPropertyValue("DisableOffPagePositioning", makeAny(true)); SwDoc *pDoc = getDoc(); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
Writer bug: Different layout model with same document model?
Hi developers! The patch I wrote in the Hackfest Hamburg seems to cause trouble. It introduced a regression, see https://bugs.documentfoundation.org/show_bug.cgi?id=117187 What happens: I wrote a patch which considers upper space above a paragraph for intersecting with fly objects (I simply increased the height of the rectangle, commit d07fc485d46f431405a3f6a002f951a08c559677 ) With that, an annoying bug was fixed. But now, strange regressions appear (see bug 117187): After initially opening the odf file in Writer, the paragraph with the date is too low. If I move the text box located above the date to the left, the date jumps in the correct position. If I hit undo, everything is then OK (?)... So there is a difference in layout between initial opening and the situation after undo (which should be the same by definition...). Strange because the nodes.xml is the same before and after the undo action. I thought layout is based on the document model. How can it be different in this situation? Have a nice day! Patrick ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice
[Libreoffice-commits] core.git: sw/qa sw/source
sw/qa/extras/odfimport/data/tdf116195.odt |binary sw/qa/extras/odfimport/odfimport.cxx |8 sw/source/filter/xml/xmlimp.cxx |2 +- 3 files changed, 9 insertions(+), 1 deletion(-) New commits: commit fe3d5766fa3c42f6cf8d1ea47af820e0b1c1cf48 Author: Patrick Jaap <patrick.j...@tu-dresden.de> Date: Tue Apr 10 15:29:56 2018 +0200 tdf#116195 swap a compatibility value There was a minor bug in the compat flag, leading to a regression from commit 8d62b79f168180c6992eb483ec864d473050635f Change-Id: I1e468e665a583ef15b6e474c3adb32f1dcf98f46 Reviewed-on: https://gerrit.libreoffice.org/52674 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk> diff --git a/sw/qa/extras/odfimport/data/tdf116195.odt b/sw/qa/extras/odfimport/data/tdf116195.odt new file mode 100644 index ..21a601f69d66 Binary files /dev/null and b/sw/qa/extras/odfimport/data/tdf116195.odt differ diff --git a/sw/qa/extras/odfimport/odfimport.cxx b/sw/qa/extras/odfimport/odfimport.cxx index 1d4737318517..3b879d9f82ff 100644 --- a/sw/qa/extras/odfimport/odfimport.cxx +++ b/sw/qa/extras/odfimport/odfimport.cxx @@ -902,5 +902,13 @@ DECLARE_ODFIMPORT_TEST(testTdf108482, "tdf108482.odt") ); } +DECLARE_ODFIMPORT_TEST(testTdf116195, "tdf116195.odt") +{ +// The image was set to zero height due to a regression +CPPUNIT_ASSERT_EQUAL( +sal_Int32(12960), parseDump("/root/page/anchored/fly/notxt/infos/bounds", "height").toInt32() +); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx index 8def02edd002..64c71c6fb46b 100644 --- a/sw/source/filter/xml/xmlimp.cxx +++ b/sw/source/filter/xml/xmlimp.cxx @@ -1620,7 +1620,7 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC if (!bSubtractFlysAnchoredAtFlys) xProps->setPropertyValue("SubtractFlysAnchoredAtFlys", makeAny(true)); -if ( !bDisableOffPagePositioning ) +if ( bDisableOffPagePositioning ) xProps->setPropertyValue("DisableOffPagePositioning", makeAny(true)); SwDoc *pDoc = getDoc(); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - 2 commits - sw/qa sw/source
sw/qa/extras/ooxmlimport/data/tdf116486.docx |binary sw/qa/extras/ooxmlimport/ooxmlimport.cxx |6 ++ sw/source/core/layout/tabfrm.cxx |4 sw/source/core/text/itrform2.cxx | 12 4 files changed, 18 insertions(+), 4 deletions(-) New commits: commit ae910b993f69205866f94ac8928f13f57e94560b Author: Patrick Jaap <patrick.j...@tu-dresden.de> Date: Tue Apr 10 13:24:04 2018 +0200 tdf#116486 Consider upper margin in paragraph positioning with flys The problem was the following: There is a paragraph with an upper margin defined. Also, there is a flyframe intersecting this upper margin. The desired behavior is to reposition the parapgraph, such that it (including it's upper margin) is located below the flyframe. This patch increases the bounding rectangle of the paragraph by the upper margin. For compatibility, there is a compat-flag query. I re-used a related one. Change-Id: I9dbc75e07e2ba0658fdbbfa9989be24a68660713 Reviewed-on: https://gerrit.libreoffice.org/52685 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk> (cherry picked from commit d07fc485d46f431405a3f6a002f951a08c559677) Reviewed-on: https://gerrit.libreoffice.org/52938 diff --git a/sw/qa/extras/ooxmlimport/data/tdf116486.docx b/sw/qa/extras/ooxmlimport/data/tdf116486.docx new file mode 100644 index ..c6a4891b0cf4 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf116486.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 3af5a063c002..22bf0b01f752 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -1602,6 +1602,12 @@ DECLARE_OOXMLIMPORT_TEST(testTdf114217, "tdf114217.docx") CPPUNIT_ASSERT_EQUAL(static_cast(0), xDrawPage->getCount()); } +DECLARE_OOXMLIMPORT_TEST(testTdf116486, "tdf116486.docx") +{ +OUString aTop = parseDump("/root/page/body/txt/Special", "nHeight"); +CPPUNIT_ASSERT_EQUAL( OUString("4006"), aTop ); +} + // tests should only be added to ooxmlIMPORT *if* they fail round-tripping in ooxmlEXPORT CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx index 6421eedca0be..e762ab1f5842 100644 --- a/sw/source/core/text/itrform2.cxx +++ b/sw/source/core/text/itrform2.cxx @@ -2314,12 +2314,24 @@ void SwTextFormatter::CalcFlyWidth( SwTextFormatInfo ) SwRect aLine( rInf.X() + nLeftMin, nTop, rInf.RealWidth() - rInf.X() + nLeftMar - nLeftMin , nHeight ); +// tdf#116486: consider also the upper margin from getFramePrintArea because intersections +// with this additional space should lead to repositioning of paragraphs +// For compatibility we grab a related compat flag: +if ( GetTextFrame()->GetTextNode()->getIDocumentSettingAccess()->get(DocumentSettingId::ADD_VERTICAL_FLY_OFFSETS) ) +{ +const long nUpper = m_pFrame->getFramePrintArea().Top(); +// Increase the rectangle +if( nUpper > 0 && nTop >= nUpper ) +aLine.SubTop( nUpper ); +} SwRect aLineVert( aLine ); if ( m_pFrame->IsRightToLeft() ) m_pFrame->SwitchLTRtoRTL( aLineVert ); if ( m_pFrame->IsVertical() ) m_pFrame->SwitchHorizontalToVertical( aLineVert ); + +// GetFrame(...) determines and returns the intersection rectangle SwRect aInter( rTextFly.GetFrame( aLineVert ) ); if ( m_pFrame->IsRightToLeft() ) commit e68518d230eee6f69e4cc2ed90e99aaab268946b Author: Michael Stahl <michael.st...@cib.de> Date: Mon Apr 16 10:34:09 2018 +0200 Revert "sw-table-join-fix-i99267.diff:" This reverts commit 6b1204329ad365a46214472bcff335e63c51bdf4. The comment has nothing to do with the code around it, and it turns out the commit is utter nonsense: The actual intended change was done in CWS sw32bf02 at a different place in SwTabFrame::MakeAll(), see commit 4439427aadeaa0cb611011b46f0fa14bfa196f33. This was then apparently extracted as a patch and added to ooo-build: https://cgit.freedesktop.org/libreoffice/build/commit/?id=d33db589f6e7814df84f71506539f6f89448d9fd And then there was a rebase on top of a DEV300 that includes the CWS and that moved the patch to apply in this incorrect location: https://cgit.freedesktop.org/libreoffice/build/commit/?id=d91410b81a02ce9b970ebd838fda0b28f6d8a5f8 Change-Id: I89db4ea0d1b06450c8fd8618cc824612e225fffe Reviewed-on: https://gerrit.libreoffice.org/52945 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Michael Stahl <michael.st...@cib.de> (cherry picked fro
[Libreoffice-commits] core.git: sw/qa sw/source
sw/qa/extras/ooxmlimport/data/tdf116486.docx |binary sw/qa/extras/ooxmlimport/ooxmlimport.cxx |6 ++ sw/source/core/text/itrform2.cxx | 12 3 files changed, 18 insertions(+) New commits: commit d07fc485d46f431405a3f6a002f951a08c559677 Author: Patrick Jaap <patrick.j...@tu-dresden.de> Date: Tue Apr 10 13:24:04 2018 +0200 tdf#116486 Consider upper margin in paragraph positioning with flys The problem was the following: There is a paragraph with an upper margin defined. Also, there is a flyframe intersecting this upper margin. The desired behavior is to reposition the parapgraph, such that it (including it's upper margin) is located below the flyframe. This patch increases the bounding rectangle of the paragraph by the upper margin. For compatibility, there is a compat-flag query. I re-used a related one. Change-Id: I9dbc75e07e2ba0658fdbbfa9989be24a68660713 Reviewed-on: https://gerrit.libreoffice.org/52685 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk> diff --git a/sw/qa/extras/ooxmlimport/data/tdf116486.docx b/sw/qa/extras/ooxmlimport/data/tdf116486.docx new file mode 100644 index ..c6a4891b0cf4 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf116486.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index ef0d085e699c..439658a63b39 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -1586,6 +1586,12 @@ DECLARE_OOXMLIMPORT_TEST(testTdf114217, "tdf114217.docx") CPPUNIT_ASSERT_EQUAL(static_cast(0), xDrawPage->getCount()); } +DECLARE_OOXMLIMPORT_TEST(testTdf116486, "tdf116486.docx") +{ +OUString aTop = parseDump("/root/page/body/txt/Special", "nHeight"); +CPPUNIT_ASSERT_EQUAL( OUString("4006"), aTop ); +} + // tests should only be added to ooxmlIMPORT *if* they fail round-tripping in ooxmlEXPORT CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx index 7fc2ae4005df..f05a5f872509 100644 --- a/sw/source/core/text/itrform2.cxx +++ b/sw/source/core/text/itrform2.cxx @@ -2278,12 +2278,24 @@ void SwTextFormatter::CalcFlyWidth( SwTextFormatInfo ) SwRect aLine( rInf.X() + nLeftMin, nTop, rInf.RealWidth() - rInf.X() + nLeftMar - nLeftMin , nHeight ); +// tdf#116486: consider also the upper margin from getFramePrintArea because intersections +// with this additional space should lead to repositioning of paragraphs +// For compatibility we grab a related compat flag: +if ( GetTextFrame()->GetTextNode()->getIDocumentSettingAccess()->get(DocumentSettingId::ADD_VERTICAL_FLY_OFFSETS) ) +{ +const long nUpper = m_pFrame->getFramePrintArea().Top(); +// Increase the rectangle +if( nUpper > 0 && nTop >= nUpper ) +aLine.SubTop( nUpper ); +} SwRect aLineVert( aLine ); if ( m_pFrame->IsRightToLeft() ) m_pFrame->SwitchLTRtoRTL( aLineVert ); if ( m_pFrame->IsVertical() ) m_pFrame->SwitchHorizontalToVertical( aLineVert ); + +// GetFrame(...) determines and returns the intersection rectangle SwRect aInter( rTextFly.GetFrame( aLineVert ) ); if ( m_pFrame->IsRightToLeft() ) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: writerfilter/source
writerfilter/source/dmapper/GraphicHelpers.cxx |4 1 file changed, 4 insertions(+) New commits: commit 82dcf015154c3fb00240c5630ae926c74c7f4213 Author: Patrick Jaap <patrick.j...@tu-dresden.de> Date: Wed Jan 24 11:45:57 2018 +0100 Add SAL_WARN in writerfilter graphic import Change-Id: Iac6265094572c57f421b0533db2c90a41b2ef427 Reviewed-on: https://gerrit.libreoffice.org/48492 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Thorsten Behrens <thorsten.behr...@cib.de> diff --git a/writerfilter/source/dmapper/GraphicHelpers.cxx b/writerfilter/source/dmapper/GraphicHelpers.cxx index a7ce01868714..ca2892a013af 100644 --- a/writerfilter/source/dmapper/GraphicHelpers.cxx +++ b/writerfilter/source/dmapper/GraphicHelpers.cxx @@ -83,6 +83,8 @@ void PositionHandler::lcl_attribute( Id aName, Value& rVal ) break; // TODO There are some other unhandled values +default: +SAL_WARN("writerfilter", "unhandled case (" << nIntValue << ") in NS_ooxml::LN_CT_PosV_relativeFrom"); } } break; @@ -116,6 +118,8 @@ void PositionHandler::lcl_attribute( Id aName, Value& rVal ) break; // TODO There are some other unhandled values +default: +SAL_WARN("writerfilter", "unhandled case (" << nIntValue << ") in NS_ooxml::LN_CT_PosH_relativeFrom"); } } break; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/qa writerfilter/source
sw/qa/extras/ooxmlimport/data/tdf113946.docx |binary sw/qa/extras/ooxmlimport/ooxmlimport.cxx |7 ++ writerfilter/source/dmapper/GraphicHelpers.cxx | 86 - 3 files changed, 51 insertions(+), 42 deletions(-) New commits: commit ada232a67fbb3acf60b104a4916719dbdb891819 Author: Patrick Jaap <patrick.j...@tu-dresden.de> Date: Mon Jan 15 16:43:07 2018 +0100 tdf#113946 add 'topMargin' to GraphicHelpers import The case '...topMargin' was not caught for setting a relative vertical position in GraphicHelpers. The test file demands a '7' here, which stands for 'PAGE_FRAME'. The '7' was overwritten in GraphicImport in case 'LN_CT_Anchor_positionV' by a call of 'resolve'. For a better overview a switch is inserted here. Change-Id: Ie98209fe445ecbba15c3dafe5980ca52421126f8 Reviewed-on: https://gerrit.libreoffice.org/47908 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Thorsten Behrens <thorsten.behr...@cib.de> diff --git a/sw/qa/extras/ooxmlimport/data/tdf113946.docx b/sw/qa/extras/ooxmlimport/data/tdf113946.docx new file mode 100644 index ..060df76ecc2a Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf113946.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 4d65beeb90c4..449dae04ac59 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -1567,6 +1567,13 @@ DECLARE_OOXMLIMPORT_TEST(testTdf112443, "tdf112443.docx") CPPUNIT_ASSERT_EQUAL( OUString("30624"), aTop ); } + +DECLARE_OOXMLIMPORT_TEST(testTdf113946, "tdf113946.docx") +{ +OUString aTop = parseDump("/root/page/body/txt/anchored/SwAnchoredDrawObject/bounds", "top"); +CPPUNIT_ASSERT_EQUAL( OUString("1696"), aTop ); +} + // tests should only be added to ooxmlIMPORT *if* they fail round-tripping in ooxmlEXPORT CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/dmapper/GraphicHelpers.cxx b/writerfilter/source/dmapper/GraphicHelpers.cxx index 8108445d24fb..a7ce01868714 100644 --- a/writerfilter/source/dmapper/GraphicHelpers.cxx +++ b/writerfilter/source/dmapper/GraphicHelpers.cxx @@ -63,57 +63,59 @@ void PositionHandler::lcl_attribute( Id aName, Value& rVal ) { case NS_ooxml::LN_CT_PosV_relativeFrom: { -// TODO There are some other unhandled values -static const Id pVertRelValues[] = +switch ( nIntValue ) { - NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromV_margin, -NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromV_page, - NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromV_paragraph, -NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromV_line -}; +case NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromV_margin: +m_nRelation = text::RelOrientation::PAGE_PRINT_AREA; +break; -static const sal_Int16 pVertRelations[] = -{ -text::RelOrientation::PAGE_PRINT_AREA, -text::RelOrientation::PAGE_FRAME, -text::RelOrientation::FRAME, -text::RelOrientation::TEXT_LINE -}; +case NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromV_page: +case NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromV_topMargin: // fallthrough intended +m_nRelation = text::RelOrientation::PAGE_FRAME; +break; -for ( int i = 0; i < 4; i++ ) -{ -if ( pVertRelValues[i] == sal_uInt32( nIntValue ) ) -m_nRelation = pVertRelations[i]; +case NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromV_paragraph: +m_nRelation = text::RelOrientation::FRAME; +break; + +case NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromV_line: +m_nRelation = text::RelOrientation::TEXT_LINE; +break; + +// TODO There are some other unhandled values } } break; + case NS_ooxml::LN_CT_PosH_relativeFrom: { -// TODO There are some other unhandled values -static const Id pHoriRelValues[] = +switch ( nIntValue ) { - NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromH_margin, -NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromH_page, - NS_oox
[Libreoffice-commits] core.git: Branch 'libreoffice-6-0-0' - sw/qa writerfilter/source
sw/qa/extras/ooxmlimport/data/tdf113946.docx |binary sw/qa/extras/ooxmlimport/ooxmlimport.cxx |7 ++ writerfilter/source/dmapper/GraphicHelpers.cxx | 86 - 3 files changed, 51 insertions(+), 42 deletions(-) New commits: commit dc8665445e81891eafcbe8a25a5b5b80db330375 Author: Patrick Jaap <patrick.j...@tu-dresden.de> Date: Mon Jan 15 16:43:07 2018 +0100 tdf#113946 add 'topMargin' to GraphicHelpers import The case '...topMargin' was not caught for setting a relative vertical position in GraphicHelpers. The test file demands a '7' here, which stands for 'PAGE_FRAME'. The '7' was overwritten in GraphicImport in case 'LN_CT_Anchor_positionV' by a call of 'resolve'. For a better overview a switch is inserted here. Change-Id: Ie98209fe445ecbba15c3dafe5980ca52421126f8 Reviewed-on: https://gerrit.libreoffice.org/47905 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Thorsten Behrens <thorsten.behr...@cib.de> (cherry picked from commit ff8826d438a9fd080e8e61f8e66b3d3b2c8d752b) Reviewed-on: https://gerrit.libreoffice.org/48288 Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk> Reviewed-by: Michael Stahl <mst...@redhat.com> Tested-by: Michael Stahl <mst...@redhat.com> diff --git a/sw/qa/extras/ooxmlimport/data/tdf113946.docx b/sw/qa/extras/ooxmlimport/data/tdf113946.docx new file mode 100644 index ..060df76ecc2a Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf113946.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 4d65beeb90c4..449dae04ac59 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -1567,6 +1567,13 @@ DECLARE_OOXMLIMPORT_TEST(testTdf112443, "tdf112443.docx") CPPUNIT_ASSERT_EQUAL( OUString("30624"), aTop ); } + +DECLARE_OOXMLIMPORT_TEST(testTdf113946, "tdf113946.docx") +{ +OUString aTop = parseDump("/root/page/body/txt/anchored/SwAnchoredDrawObject/bounds", "top"); +CPPUNIT_ASSERT_EQUAL( OUString("1696"), aTop ); +} + // tests should only be added to ooxmlIMPORT *if* they fail round-tripping in ooxmlEXPORT CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/dmapper/GraphicHelpers.cxx b/writerfilter/source/dmapper/GraphicHelpers.cxx index 8108445d24fb..a7ce01868714 100644 --- a/writerfilter/source/dmapper/GraphicHelpers.cxx +++ b/writerfilter/source/dmapper/GraphicHelpers.cxx @@ -63,57 +63,59 @@ void PositionHandler::lcl_attribute( Id aName, Value& rVal ) { case NS_ooxml::LN_CT_PosV_relativeFrom: { -// TODO There are some other unhandled values -static const Id pVertRelValues[] = +switch ( nIntValue ) { - NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromV_margin, -NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromV_page, - NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromV_paragraph, -NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromV_line -}; +case NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromV_margin: +m_nRelation = text::RelOrientation::PAGE_PRINT_AREA; +break; -static const sal_Int16 pVertRelations[] = -{ -text::RelOrientation::PAGE_PRINT_AREA, -text::RelOrientation::PAGE_FRAME, -text::RelOrientation::FRAME, -text::RelOrientation::TEXT_LINE -}; +case NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromV_page: +case NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromV_topMargin: // fallthrough intended +m_nRelation = text::RelOrientation::PAGE_FRAME; +break; -for ( int i = 0; i < 4; i++ ) -{ -if ( pVertRelValues[i] == sal_uInt32( nIntValue ) ) -m_nRelation = pVertRelations[i]; +case NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromV_paragraph: +m_nRelation = text::RelOrientation::FRAME; +break; + +case NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromV_line: +m_nRelation = text::RelOrientation::TEXT_LINE; +break; + +// TODO There are some other unhandled values } } break; + case NS_ooxml::LN_CT_PosH_relativeFrom: { -// TODO There are some other unhandled values -static const Id pHo
[Libreoffice-commits] core.git: sw/qa writerfilter/source
sw/qa/extras/ooxmlimport/data/tdf113946.docx |binary sw/qa/extras/ooxmlimport/ooxmlimport.cxx |7 ++ writerfilter/source/dmapper/GraphicHelpers.cxx | 86 - 3 files changed, 51 insertions(+), 42 deletions(-) New commits: commit ff8826d438a9fd080e8e61f8e66b3d3b2c8d752b Author: Patrick Jaap <patrick.j...@tu-dresden.de> Date: Mon Jan 15 16:43:07 2018 +0100 tdf#113946 add 'topMargin' to GraphicHelpers import The case '...topMargin' was not caught for setting a relative vertical position in GraphicHelpers. The test file demands a '7' here, which stands for 'PAGE_FRAME'. The '7' was overwritten in GraphicImport in case 'LN_CT_Anchor_positionV' by a call of 'resolve'. For a better overview a switch is inserted here. Change-Id: Ie98209fe445ecbba15c3dafe5980ca52421126f8 Reviewed-on: https://gerrit.libreoffice.org/47905 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Thorsten Behrens <thorsten.behr...@cib.de> diff --git a/sw/qa/extras/ooxmlimport/data/tdf113946.docx b/sw/qa/extras/ooxmlimport/data/tdf113946.docx new file mode 100644 index ..060df76ecc2a Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf113946.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 4d65beeb90c4..449dae04ac59 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -1567,6 +1567,13 @@ DECLARE_OOXMLIMPORT_TEST(testTdf112443, "tdf112443.docx") CPPUNIT_ASSERT_EQUAL( OUString("30624"), aTop ); } + +DECLARE_OOXMLIMPORT_TEST(testTdf113946, "tdf113946.docx") +{ +OUString aTop = parseDump("/root/page/body/txt/anchored/SwAnchoredDrawObject/bounds", "top"); +CPPUNIT_ASSERT_EQUAL( OUString("1696"), aTop ); +} + // tests should only be added to ooxmlIMPORT *if* they fail round-tripping in ooxmlEXPORT CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/dmapper/GraphicHelpers.cxx b/writerfilter/source/dmapper/GraphicHelpers.cxx index 8108445d24fb..a7ce01868714 100644 --- a/writerfilter/source/dmapper/GraphicHelpers.cxx +++ b/writerfilter/source/dmapper/GraphicHelpers.cxx @@ -63,57 +63,59 @@ void PositionHandler::lcl_attribute( Id aName, Value& rVal ) { case NS_ooxml::LN_CT_PosV_relativeFrom: { -// TODO There are some other unhandled values -static const Id pVertRelValues[] = +switch ( nIntValue ) { - NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromV_margin, -NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromV_page, - NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromV_paragraph, -NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromV_line -}; +case NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromV_margin: +m_nRelation = text::RelOrientation::PAGE_PRINT_AREA; +break; -static const sal_Int16 pVertRelations[] = -{ -text::RelOrientation::PAGE_PRINT_AREA, -text::RelOrientation::PAGE_FRAME, -text::RelOrientation::FRAME, -text::RelOrientation::TEXT_LINE -}; +case NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromV_page: +case NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromV_topMargin: // fallthrough intended +m_nRelation = text::RelOrientation::PAGE_FRAME; +break; -for ( int i = 0; i < 4; i++ ) -{ -if ( pVertRelValues[i] == sal_uInt32( nIntValue ) ) -m_nRelation = pVertRelations[i]; +case NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromV_paragraph: +m_nRelation = text::RelOrientation::FRAME; +break; + +case NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromV_line: +m_nRelation = text::RelOrientation::TEXT_LINE; +break; + +// TODO There are some other unhandled values } } break; + case NS_ooxml::LN_CT_PosH_relativeFrom: { -// TODO There are some other unhandled values -static const Id pHoriRelValues[] = +switch ( nIntValue ) { - NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromH_margin, -NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromH_page, - NS_oox
[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/inc sw/qa sw/source writerfilter/source
sw/inc/IDocumentSettingAccess.hxx |2 + sw/qa/extras/ooxmlimport/data/tdf112443.docx|binary sw/qa/extras/ooxmlimport/ooxmlimport.cxx| 10 ++ sw/source/core/doc/DocumentSettingManager.cxx |7 sw/source/core/inc/DocumentSettingManager.hxx |1 sw/source/core/layout/flylay.cxx|6 sw/source/core/objectpositioning/anchoredobjectposition.cxx | 18 sw/source/filter/xml/xmlimp.cxx |7 sw/source/uibase/uno/SwXDocumentSettings.cxx| 17 +++ writerfilter/source/filter/WriterFilter.cxx |2 - 10 files changed, 67 insertions(+), 3 deletions(-) New commits: commit 529924a29ce6f688337f91de9dcf1aa9869e91ad Author: Patrick Jaap <patrick.j...@tu-dresden.de> Date: Wed Nov 29 12:41:33 2017 +0100 tdf#112443 disable off-page content positioning Disable the positioning for objects that are completely off-page. During import, LO writer forces content always back to the page and causes unwanted content on the page in constrast to MSO. To achive this the top/left position of the content is compared to the bottom/right border of the clipping region. A new compatibility flag OFF_PAGE_POSITIONING is introduced for legacy rendering of legacy documents. A unit test demonstrates the issue. It resolves tdf#112443. Change-Id: I263c129f9f09ed909ad777a34f8b9ffc84d871e4 Reviewed-on: https://gerrit.libreoffice.org/43313 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk> (cherry picked from commit 8d62b79f168180c6992eb483ec864d473050635f) Reviewed-on: https://gerrit.libreoffice.org/47260 diff --git a/sw/inc/IDocumentSettingAccess.hxx b/sw/inc/IDocumentSettingAccess.hxx index 6e9942bce66c..41b2c4ff79c3 100644 --- a/sw/inc/IDocumentSettingAccess.hxx +++ b/sw/inc/IDocumentSettingAccess.hxx @@ -81,6 +81,8 @@ enum class DocumentSettingId SURROUND_TEXT_WRAP_SMALL, PROP_LINE_SPACING_SHRINKS_FIRST_LINE, SUBTRACT_FLYS, +// tdf#112443 disable off-page content positioning +DISABLE_OFF_PAGE_POSITIONING, // COMPATIBILITY FLAGS END BROWSE_MODE, HTML_MODE, diff --git a/sw/qa/extras/ooxmlimport/data/tdf112443.docx b/sw/qa/extras/ooxmlimport/data/tdf112443.docx new file mode 100644 index ..385ce514c1c9 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf112443.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index cafef1d2ee53..4d65beeb90c4 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -118,7 +118,6 @@ public: } }; - DECLARE_OOXMLIMPORT_TEST(testImageHyperlink, "image-hyperlink.docx") { OUString URL = getProperty(getShape(1), "HyperLinkURL"); @@ -1559,6 +1558,15 @@ DECLARE_OOXMLIMPORT_TEST(testTdf43017, "tdf43017.docx") sal_Int32(-1), getProperty(xText, "CharColor")); } + +DECLARE_OOXMLIMPORT_TEST(testTdf112443, "tdf112443.docx") +{ +// the position of the flying text frame should be off page +// 30624 below its anchor +OUString aTop = parseDump("//fly[1]/infos/bounds", "top"); +CPPUNIT_ASSERT_EQUAL( OUString("30624"), aTop ); + +} // tests should only be added to ooxmlIMPORT *if* they fail round-tripping in ooxmlEXPORT CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/core/doc/DocumentSettingManager.cxx b/sw/source/core/doc/DocumentSettingManager.cxx index 47c513e1486e..77de92017537 100644 --- a/sw/source/core/doc/DocumentSettingManager.cxx +++ b/sw/source/core/doc/DocumentSettingManager.cxx @@ -87,7 +87,8 @@ sw::DocumentSettingManager::DocumentSettingManager(SwDoc ) mbPropLineSpacingShrinksFirstLine(true), mbSubtractFlys(false), mApplyParagraphMarkFormatToNumbering(false), -mbLastBrowseMode( false ) +mbLastBrowseMode( false ), +mbDisableOffPagePositioning ( false ) // COMPATIBILITY FLAGS END { @@ -202,6 +203,7 @@ bool sw::DocumentSettingManager::get(/*[in]*/ DocumentSettingId id) const case DocumentSettingId::EMBED_FONTS: return mEmbedFonts; case DocumentSettingId::EMBED_SYSTEM_FONTS: return mEmbedSystemFonts; case DocumentSettingId::APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING: return mApplyParagraphMarkFormatToNumbering; +case DocumentSettingId::DISABLE_OFF_PAGE_POSITIONING: return mbDisableOffPagePositioning; default: OSL_FAIL("Invalid setting id"); } @@ -416,6 +418,9 @@ void sw::DocumentSettingManager::set(/*[in]*/ DocumentSettingId id, /*[in]*/ boo case DocumentSettingId::APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING:
[Libreoffice-commits] core.git: sw/inc sw/qa sw/source writerfilter/source
sw/inc/IDocumentSettingAccess.hxx |2 + sw/qa/extras/ooxmlimport/data/tdf112443.docx|binary sw/qa/extras/ooxmlimport/ooxmlimport.cxx| 10 ++ sw/source/core/doc/DocumentSettingManager.cxx |7 sw/source/core/inc/DocumentSettingManager.hxx |1 sw/source/core/layout/flylay.cxx|6 sw/source/core/objectpositioning/anchoredobjectposition.cxx | 18 sw/source/filter/xml/xmlimp.cxx |7 sw/source/uibase/uno/SwXDocumentSettings.cxx| 17 +++ writerfilter/source/filter/WriterFilter.cxx |2 - 10 files changed, 67 insertions(+), 3 deletions(-) New commits: commit 8d62b79f168180c6992eb483ec864d473050635f Author: Patrick Jaap <patrick.j...@tu-dresden.de> Date: Wed Nov 29 12:41:33 2017 +0100 tdf#112443 disable off-page content positioning Disable the positioning for objects that are completely off-page. During import, LO writer forces content always back to the page and causes unwanted content on the page in constrast to MSO. To achive this the top/left position of the content is compared to the bottom/right border of the clipping region. A new compatibility flag OFF_PAGE_POSITIONING is introduced for legacy rendering of legacy documents. A unit test demonstrates the issue. It resolves tdf#112443. Change-Id: I263c129f9f09ed909ad777a34f8b9ffc84d871e4 Reviewed-on: https://gerrit.libreoffice.org/43313 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk> diff --git a/sw/inc/IDocumentSettingAccess.hxx b/sw/inc/IDocumentSettingAccess.hxx index 6e9942bce66c..41b2c4ff79c3 100644 --- a/sw/inc/IDocumentSettingAccess.hxx +++ b/sw/inc/IDocumentSettingAccess.hxx @@ -81,6 +81,8 @@ enum class DocumentSettingId SURROUND_TEXT_WRAP_SMALL, PROP_LINE_SPACING_SHRINKS_FIRST_LINE, SUBTRACT_FLYS, +// tdf#112443 disable off-page content positioning +DISABLE_OFF_PAGE_POSITIONING, // COMPATIBILITY FLAGS END BROWSE_MODE, HTML_MODE, diff --git a/sw/qa/extras/ooxmlimport/data/tdf112443.docx b/sw/qa/extras/ooxmlimport/data/tdf112443.docx new file mode 100644 index ..385ce514c1c9 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf112443.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index cafef1d2ee53..4d65beeb90c4 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -118,7 +118,6 @@ public: } }; - DECLARE_OOXMLIMPORT_TEST(testImageHyperlink, "image-hyperlink.docx") { OUString URL = getProperty(getShape(1), "HyperLinkURL"); @@ -1559,6 +1558,15 @@ DECLARE_OOXMLIMPORT_TEST(testTdf43017, "tdf43017.docx") sal_Int32(-1), getProperty(xText, "CharColor")); } + +DECLARE_OOXMLIMPORT_TEST(testTdf112443, "tdf112443.docx") +{ +// the position of the flying text frame should be off page +// 30624 below its anchor +OUString aTop = parseDump("//fly[1]/infos/bounds", "top"); +CPPUNIT_ASSERT_EQUAL( OUString("30624"), aTop ); + +} // tests should only be added to ooxmlIMPORT *if* they fail round-tripping in ooxmlEXPORT CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/core/doc/DocumentSettingManager.cxx b/sw/source/core/doc/DocumentSettingManager.cxx index 47c513e1486e..77de92017537 100644 --- a/sw/source/core/doc/DocumentSettingManager.cxx +++ b/sw/source/core/doc/DocumentSettingManager.cxx @@ -87,7 +87,8 @@ sw::DocumentSettingManager::DocumentSettingManager(SwDoc ) mbPropLineSpacingShrinksFirstLine(true), mbSubtractFlys(false), mApplyParagraphMarkFormatToNumbering(false), -mbLastBrowseMode( false ) +mbLastBrowseMode( false ), +mbDisableOffPagePositioning ( false ) // COMPATIBILITY FLAGS END { @@ -202,6 +203,7 @@ bool sw::DocumentSettingManager::get(/*[in]*/ DocumentSettingId id) const case DocumentSettingId::EMBED_FONTS: return mEmbedFonts; case DocumentSettingId::EMBED_SYSTEM_FONTS: return mEmbedSystemFonts; case DocumentSettingId::APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING: return mApplyParagraphMarkFormatToNumbering; +case DocumentSettingId::DISABLE_OFF_PAGE_POSITIONING: return mbDisableOffPagePositioning; default: OSL_FAIL("Invalid setting id"); } @@ -416,6 +418,9 @@ void sw::DocumentSettingManager::set(/*[in]*/ DocumentSettingId id, /*[in]*/ boo case DocumentSettingId::APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING: mApplyParagraphMarkFormatToNumbering = value; break; +case DocumentSettingId::DISABLE_OFF_PAGE_POSITIONING: +
[Libreoffice-commits] core.git: emfio/inc emfio/source
emfio/inc/emfreader.hxx |1 + emfio/source/reader/emfreader.cxx | 18 ++ 2 files changed, 19 insertions(+) New commits: commit e06807f51d157844b357dab1bbf960cc55162330 Author: Patrick Jaap <patrick.j...@tu-dresden.de> Date: Mon Oct 2 16:21:04 2017 +0200 tdf#31814 EMF/EMF+ implement dual mode There can be a dual mode flag set in the EMF+ data. If set, we should process either EMF or EMF+ data, because the contained information should be equal (says the documentation). The more advanced EMF+ renderer is chosen here. The flag is read in the EMFPlusReader and blocks the reading of other EMF records than HEADER, EOF and COMMENT. Thanks to Chris, for pointing out the dual mode! Change-Id: I8522930cebbb9e9ecc732397cbb3deea9e8c9127 Reviewed-on: https://gerrit.libreoffice.org/43122 Reviewed-by: Patrick Jaap <patrick.j...@tu-dresden.de> Reviewed-by: Bartosz Kosiorek <gan...@poczta.onet.pl> Tested-by: Bartosz Kosiorek <gan...@poczta.onet.pl> diff --git a/emfio/inc/emfreader.hxx b/emfio/inc/emfreader.hxx index 8ee533c24068..4b2855cf54f6 100644 --- a/emfio/inc/emfreader.hxx +++ b/emfio/inc/emfreader.hxx @@ -31,6 +31,7 @@ namespace emfio boolmbRecordPath : 1; boolmbEMFPlus : 1; +boolmbEMFPlusDualMode : 1; boolReadHeader(); // reads and converts the rectangle diff --git a/emfio/source/reader/emfreader.cxx b/emfio/source/reader/emfreader.cxx index 859c3510b759..8ff413b79033 100644 --- a/emfio/source/reader/emfreader.cxx +++ b/emfio/source/reader/emfreader.cxx @@ -384,6 +384,7 @@ namespace emfio , mnRecordCount(0) , mbRecordPath(false) , mbEMFPlus(false) +,mbEMFPlusDualMode(false) { } @@ -443,6 +444,15 @@ namespace emfio SAL_INFO ("vcl.emf", "\t\tEMF+ lock DC (device context)"); } +// look for the "dual mode" in header +// it indicates that either EMF or EMF+ records should be processed +// 0x4001= EMF+ header +// flags & 1 = dual mode active +if ( type == 0x4001 && flags & 1 ) +{ +mbEMFPlusDualMode = true; +} + // Get the length of the remaining data of this record based // on the alleged size sal_uInt32 nRemainingRecordData = size >= nRequiredHeaderSize ? @@ -697,6 +707,14 @@ namespace emfio } } } +else if ( !bHaveDC && mbEMFPlusDualMode && nRecType != EMR_HEADER && nRecType != EMR_EOF ) +{ +// skip content (EMF record) in dual mode +// we process only EMR_COMMENT (see above) to access EMF+ data +// with 2 exceptions, according to EMF+ specification: +// EMR_HEADER and EMR_EOF +// if a device context is given (bHaveDC) process the following EMF record, too. +} else if( !mbEMFPlus || bHaveDC || nRecType == EMR_EOF ) { switch( nRecType ) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: drawinglayer/source
drawinglayer/source/tools/emfphelperdata.cxx | 95 ++- 1 file changed, 52 insertions(+), 43 deletions(-) New commits: commit 52a2a0101f71b21876f17d5419132ffa27f6e35d Author: Patrick Jaap <patrick.j...@tu-dresden.de> Date: Fri Oct 13 11:31:28 2017 +0200 tdf#31814 Fix for EMF+ DrawString and DrawImage DrawString: The value 'fontAttribute' is optional and may be null, results in missing characters. DrawImage: The case of 'metafile' was missing and leads to low resolution rendering. Change-Id: I81566d884975fda832f4a5af6663c837f355c383 Reviewed-on: https://gerrit.libreoffice.org/43367 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Bartosz Kosiorek <gan...@poczta.onet.pl> diff --git a/drawinglayer/source/tools/emfphelperdata.cxx b/drawinglayer/source/tools/emfphelperdata.cxx index 1dc3d611a046..c39083336046 100644 --- a/drawinglayer/source/tools/emfphelperdata.cxx +++ b/drawinglayer/source/tools/emfphelperdata.cxx @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -1107,25 +1108,35 @@ namespace emfplushelper if (bValid) { -BitmapEx aBmp(image.graphic.GetBitmapEx()); -aBmp.Crop(aSource); -Size aSize(aBmp.GetSizePixel()); -SAL_INFO("cppcanvas.emf", "EMF+ bitmap size: " << aSize.Width() << "x" << aSize.Height()); -if (aSize.Width() > 0 && aSize.Height() > 0) +// create correct transform matrix +basegfx::B2DHomMatrix aTransformMatrix = basegfx::utils::createScaleTranslateB2DHomMatrix( +aDstSize.getX(), +aDstSize.getY(), +aDstPoint.getX(), +aDstPoint.getY()); + +if (image.type == 1) // Bitmap { -// create correct transform matrix -basegfx::B2DHomMatrix aTransformMatrix = basegfx::utils::createScaleTranslateB2DHomMatrix( -aDstSize.getX(), -aDstSize.getY(), -aDstPoint.getX(), -aDstPoint.getY()); - -mrTargetHolders.Current().append( -new drawinglayer::primitive2d::BitmapPrimitive2D(aBmp,aTransformMatrix)); +BitmapEx aBmp(image.graphic.GetBitmapEx()); +aBmp.Crop(aSource); +Size aSize(aBmp.GetSizePixel()); +SAL_INFO("cppcanvas.emf", "EMF+ bitmap size: " << aSize.Width() << "x" << aSize.Height()); +if (aSize.Width() > 0 && aSize.Height() > 0) +{ +mrTargetHolders.Current().append( +new drawinglayer::primitive2d::BitmapPrimitive2D(aBmp,aTransformMatrix)); +} +else +{ +SAL_INFO("cppcanvas.emf", "EMF+ warning: empty bitmap"); +} } -else +else if (image.type == 2) // Metafile { -SAL_INFO("cppcanvas.emf", "EMF+ warning: empty bitmap"); +GDIMetaFile aGDI(image.graphic.GetGDIMetaFile()); +aGDI.Clip(aSource); +mrTargetHolders.Current().append( +new drawinglayer::primitive2d::MetafilePrimitive2D(aTransformMatrix,aGDI)); } } else @@ -1158,11 +1169,11 @@ namespace emfplushelper // parse the string OUString text = read_uInt16s_ToOUString(rMS, stringLength); SAL_INFO("cppcanvas.emf", "EMF+ DrawString string: " << text); -// get the stringFormat from the Object table +// g
[Libreoffice-commits] core.git: drawinglayer/source
drawinglayer/source/tools/emfphelperdata.cxx | 19 +-- 1 file changed, 9 insertions(+), 10 deletions(-) New commits: commit 3b1db9b7a9afe147ed7f841c875bc3b91b03ace9 Author: Patrick Jaap <patrick.j...@tu-dresden.de> Date: Tue Sep 26 14:42:44 2017 +0200 tdf#112012 EMF+ dashed lines: correct dash length Since the first guess of the right transformation seemed to be wrong, here is the next try. The pure float value is multiplied with the pen width. This is way more intuitive for me and renders the EMF files from the bugtracker exactly like in MSO. See 588c5b0cff9bbdb2efbdfb259268154b0074e7e6 for the previous patch. Change-Id: I74e82a0f9800d950e0d989184765a53e520b48e6 Reviewed-on: https://gerrit.libreoffice.org/42810 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Thorsten Behrens <thorsten.behr...@cib.de> diff --git a/drawinglayer/source/tools/emfphelperdata.cxx b/drawinglayer/source/tools/emfphelperdata.cxx index e95b243f7a0d..513b8fbce930 100644 --- a/drawinglayer/source/tools/emfphelperdata.cxx +++ b/drawinglayer/source/tools/emfphelperdata.cxx @@ -421,11 +421,13 @@ namespace emfplushelper if (pen->penDataFlags & 0x0020 && pen->dashStyle != EmfPlusLineStyleCustom) // pen has a predefined line style { -// taken from the old cppcanvas implementation -const std::vector dash = { 3, 3 }; -const std::vector dot = { 1, 3 }; -const std::vector dashdot = { 3, 3, 1, 3 }; -const std::vector dashdotdot = { 3, 3, 1, 3, 1, 3 }; +// short writing +const double pw = transformedPenWidth; +// taken from the old cppcanvas implementation and multiplied with pen width +const std::vector dash = { 3*pw, 3*pw }; +const std::vector dot = { pw, 3*pw }; +const std::vector dashdot = { 3*pw, 3*pw, pw, 3*pw }; +const std::vector dashdotdot = { 3*pw, 3*pw, pw, 3*pw, pw, 3*pw }; drawinglayer::attribute::StrokeAttribute aStrokeAttribute; @@ -459,11 +461,8 @@ namespace emfplushelper std::vector aPattern(pen->dashPattern.size()); for (size_t i=0; i<aPattern.size(); i++) { -aPattern[i] = 0.5 * MapSize(double(pen->dashPattern[i]),0).getX(); -// here, this is just a guess -// without transform it es way too small -// with 1 * MapSize(...) it es too large -// with 0.5 * MapSize is looks like in MSO +// convert from float to double and multiply with the adjusted pen width +aPattern[i] = transformedPenWidth * pen->dashPattern[i]; } drawinglayer::attribute::StrokeAttribute strokeAttribute(aPattern); mrTargetHolders.Current().append( ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: drawinglayer/source
drawinglayer/source/tools/emfphelperdata.cxx | 66 +-- drawinglayer/source/tools/emfppen.cxx|7 -- drawinglayer/source/tools/emfppen.hxx|7 ++ 3 files changed, 69 insertions(+), 11 deletions(-) New commits: commit 588c5b0cff9bbdb2efbdfb259268154b0074e7e6 Author: Patrick Jaap <patrick.j...@tu-dresden.de> Date: Fri Aug 25 14:08:29 2017 +0200 tdf#112012 EMF+ add dashed line support add support for dashed lines as optional pen attribute. Change-Id: I8c49d178e1b25eb0b8cd15c32c2fc47497efb21b Reviewed-on: https://gerrit.libreoffice.org/41565 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Thorsten Behrens <thorsten.behr...@cib.de> diff --git a/drawinglayer/source/tools/emfphelperdata.cxx b/drawinglayer/source/tools/emfphelperdata.cxx index fef6ca8a1b3c..2b8ecbb6b22e 100644 --- a/drawinglayer/source/tools/emfphelperdata.cxx +++ b/drawinglayer/source/tools/emfphelperdata.cxx @@ -418,10 +418,68 @@ namespace emfplushelper transformedPenWidth, lineJoin, lineCap); -mrTargetHolders.Current().append( -new drawinglayer::primitive2d::PolyPolygonStrokePrimitive2D( -polygon, -lineAttribute)); + +if (pen->penDataFlags & 0x0020 && pen->dashStyle != EmfPlusLineStyleCustom) // pen has a predifined line style +{ +// taken from the old cppcanvas implementation +const std::vector dash = { 3, 3 }; +const std::vector dot = { 1, 3 }; +const std::vector dashdot = { 3, 3, 1, 3 }; +const std::vector dashdotdot = { 3, 3, 1, 3, 1, 3 }; + +drawinglayer::attribute::StrokeAttribute aStrokeAttribute; + +switch (pen->dashStyle) +{ +case EmfPlusLineStyleSolid: // do nothing special, use default stroke attribute +break; +case EmfPlusLineStyleDash: +aStrokeAttribute = drawinglayer::attribute::StrokeAttribute(dash); +break; +case EmfPlusLineStyleDot: +aStrokeAttribute = drawinglayer::attribute::StrokeAttribute(dot); +break; +case EmfPlusLineStyleDashDot: +aStrokeAttribute = drawinglayer::attribute::StrokeAttribute(dashdot); +break; +case EmfPlusLineStyleDashDotDot: +aStrokeAttribute = drawinglayer::attribute::StrokeAttribute(dashdotdot); +break; + +} +mrTargetHolders.Current().append( +new drawinglayer::primitive2d::PolyPolygonStrokePrimitive2D( +polygon, +lineAttribute, +aStrokeAttribute)); +} +else if (pen->penDataFlags & 0x0100) // pen has a custom dash line +{ +// StrokeAttribute needs a double vector while the pen provides a float vector +std::vector aPattern(pen->dashPattern.size()); +for (size_t i=0; i<aPattern.size(); i++) +{ +aPattern[i] = 0.5 * MapSize(double(pen->dashPattern[i]),0).getX(); +// here, this is just a guess +// without transform it es way too small +// with 1 * MapSize(...) it es too large +// with 0.5 * MapSize is looks like in MSO +} +drawinglayer::attribute::StrokeAttribute strokeAttribute(aPattern); +mrTargetHolders.Current().append( +new drawinglayer::primitive2d::PolyPolygonStrokePrimitive2D( +polygon, +lineAttribute, +strokeAttribute)); + +} +else // no further line decoration, so use simple primitive +{ +mrTargetHolders.Current().append( +new drawinglayer::primitive2d::PolyPolygonStrokePrimitive2D( +polygon, +lineAttribute)); +} mrPropertyHolders.Current().setLineColor(pen->GetColor().getBColor()); mrPropertyHolders.Current().setLineColorActive(true); diff --git a/drawinglayer/source/tools/emfppen.cxx b/drawinglayer/source/tools/emfppen.cxx index 1905b8cb6f48..686cac184254 100644 --- a/drawinglayer/source/tools/emfppen.cxx +++ b/drawinglayer/source/tools/emfppen.cxx @@ -60,13 +60,6 @@ namespace e
[Libreoffice-commits] core.git: emfio/qa test/source
emfio/qa/cppunit/emf/EmfImportTest.cxx | 42 +++ emfio/qa/cppunit/emf/data/TestDrawLine.emf |binary emfio/qa/cppunit/emf/data/TestDrawString.emf |binary test/source/primitive2dxmldump.cxx | 18 +++ 4 files changed, 60 insertions(+) New commits: commit 8d1dc9a662d2e1bc833d5488f3f0013f98e7f3fd Author: Patrick Jaap <patrick.j...@tu-dresden.de> Date: Tue Aug 22 12:31:15 2017 +0200 emfio: unit test for the EMF+ renderer Two unit tests, which test the EMF+ records DrawString and DrawLine independently. To this end, a fixed view decomposition of metafiles is implemented. The chosen primitives should be optimal, even for future extensions of the EMF+ parser. Change-Id: I12672d3b294ff0fdae63c7a5ce211517ef8f763c Reviewed-on: https://gerrit.libreoffice.org/41425 Reviewed-by: Thorsten Behrens <thorsten.behr...@cib.de> Tested-by: Thorsten Behrens <thorsten.behr...@cib.de> diff --git a/emfio/qa/cppunit/emf/EmfImportTest.cxx b/emfio/qa/cppunit/emf/EmfImportTest.cxx index ca766b8b67f3..bc14c4bd3062 100644 --- a/emfio/qa/cppunit/emf/EmfImportTest.cxx +++ b/emfio/qa/cppunit/emf/EmfImportTest.cxx @@ -39,12 +39,16 @@ class Test : public test::BootstrapFixture, public XmlTestTools void checkRectPrimitive(Primitive2DSequence const & rPrimitive); void testWorking(); +void TestDrawString(); +void TestDrawLine(); Primitive2DSequence parseEmf(const OUString& aSource); public: CPPUNIT_TEST_SUITE(Test); CPPUNIT_TEST(testWorking); +CPPUNIT_TEST(TestDrawString); +CPPUNIT_TEST(TestDrawLine); CPPUNIT_TEST_SUITE_END(); }; @@ -88,6 +92,44 @@ void Test::testWorking() checkRectPrimitive(aSequenceRect); } +void Test::TestDrawString() +{ +// This unit checks for a correct import of an EMF+ file with only one DrawString Record +// Since the text is undecorated the optimal choice is a simpletextportion primitive + +// first, get the sequence of primitives and dump it +Primitive2DSequence aSequence = parseEmf("/emfio/qa/cppunit/emf/data/TestDrawString.emf"); +CPPUNIT_ASSERT_EQUAL(1, (int) aSequence.getLength()); +Primitive2dXmlDump dumper; +xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer(aSequence)); +CPPUNIT_ASSERT (pDocument); + +// check correct import of the DrawString: height, position, text, color and font +assertXPath(pDocument, "/primitive2D/metafile/transform/textsimpleportion", "height", "276"); +assertXPath(pDocument, "/primitive2D/metafile/transform/textsimpleportion", "x", "25"); +assertXPath(pDocument, "/primitive2D/metafile/transform/textsimpleportion", "y", "323"); +assertXPath(pDocument, "/primitive2D/metafile/transform/textsimpleportion", "text", "TEST"); +assertXPath(pDocument, "/primitive2D/metafile/transform/textsimpleportion", "fontcolor", "#00"); +assertXPath(pDocument, "/primitive2D/metafile/transform/textsimpleportion", "familyname", "CALIBRI"); +} + +void Test::TestDrawLine() +{ +// This unit checks for a correct import of an EMF+ file with only one DrawLine Record +// The line is colored and has a specified width, therefore a polypolygonstroke primitive is the optimal choice + +// first, get the sequence of primitives and dump it +Primitive2DSequence aSequence = parseEmf("/emfio/qa/cppunit/emf/data/TestDrawLine.emf"); +CPPUNIT_ASSERT_EQUAL(1, (int) aSequence.getLength()); +Primitive2dXmlDump dumper; +xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer(aSequence)); +CPPUNIT_ASSERT (pDocument); + +// check correct import of the DrawLine: color and width of the line +assertXPath(pDocument, "/primitive2D/metafile/transform/polypolygonstroke/line", "color", "#00"); +assertXPath(pDocument, "/primitive2D/metafile/transform/polypolygonstroke/line", "width", "33"); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); } diff --git a/emfio/qa/cppunit/emf/data/TestDrawLine.emf b/emfio/qa/cppunit/emf/data/TestDrawLine.emf new file mode 100644 index ..89946c523f98 Binary files /dev/null and b/emfio/qa/cppunit/emf/data/TestDrawLine.emf differ diff --git a/emfio/qa/cppunit/emf/data/TestDrawString.emf b/emfio/qa/cppunit/emf/data/TestDrawString.emf new file mode 100644 index ..c7976f53b3c0 Binary files /dev/null and b/emfio/qa/cppunit/emf/data/TestDrawString.emf differ diff --git a/test/source/primitive2dxmldump.cxx b/test/source/primitive2dxmldump.cxx index 6523c4c0c971..563fb75acc19 100644 --- a/test/source/primitive2dxmldump.c
[Libreoffice-commits] core.git: drawinglayer/source
drawinglayer/source/tools/emfphelperdata.cxx | 173 +-- drawinglayer/source/tools/emfphelperdata.hxx |4 2 files changed, 90 insertions(+), 87 deletions(-) New commits: commit 50553df006f5fe8ac59cad3dcde0856735535b40 Author: Patrick Jaap <patrick.j...@tu-dresden.de> Date: Mon Aug 7 17:05:27 2017 +0200 new EMF+ Parser: Implementation of EmfPlusRecordTypeDrawDriverString The Implementation follows closely EmfPlusRecordTypeDrawString. For each set of characters with the same PosY a TextSimplePortionPrimitive2D is created. Change-Id: I04e4d11dc3c4e1e5bd16aefa8e7f00556aa5282b Reviewed-on: https://gerrit.libreoffice.org/40716 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Thorsten Behrens <thorsten.behr...@cib.de> diff --git a/drawinglayer/source/tools/emfphelperdata.cxx b/drawinglayer/source/tools/emfphelperdata.cxx index 335d5634880d..12e3a42b3e9c 100644 --- a/drawinglayer/source/tools/emfphelperdata.cxx +++ b/drawinglayer/source/tools/emfphelperdata.cxx @@ -35,6 +35,8 @@ #include #include #include +#include +#include namespace emfplushelper { @@ -329,6 +331,24 @@ namespace emfplushelper return maMapTransform * ::basegfx::B2DSize(iwidth, iheight); } +::basegfx::BColor EmfPlusHelperData::EMFPGetBrushColorOrARGBColor(sal_uInt16 flags, sal_uInt32 brushIndexOrColor){ +basegfx::BColor color; +if (flags & 0x8000) // we use a color +{ +color = Color(0xff - (brushIndexOrColor >> 24), (brushIndexOrColor >> 16) & 0xff, + (brushIndexOrColor >> 8) & 0xff, brushIndexOrColor & 0xff).getBColor(); +} +else // we use a pen +{ +const EMFPPen* pen = static_cast<EMFPPen*>(maEMFPObjects[brushIndexOrColor & 0xff].get()); +if (pen) +{ +color = pen->GetColor().getBColor(); +} +} +return color; +} + void EmfPlusHelperData::EMFPPlusDrawPolygon(const ::basegfx::B2DPolyPolygon& polygon, sal_uInt32 penIndex) { const EMFPPen* pen = static_cast<EMFPPen*>(maEMFPObjects[penIndex & 0xff].get()); @@ -1131,54 +1151,6 @@ namespace emfplushelper fontAttribute, locale, color)); - -// OUString text = read_uInt16s_ToOUString(rMS, stringLength); -// EMFPStringFormat *stringFormat = static_cast< EMFPStringFormat* >(maEMFPObjects[formatId & 0xff].get()); -//css::rendering::FontRequest aFontRequest; -// -//if (stringFormat) -//{ -//LanguageTag aLanguageTag(static_cast< LanguageType >(stringFormat->language)); -//aFontRequest.Locale = aLanguageTag.getLocale(false); -//SAL_INFO("cppcanvas.emf", "EMF+\t\t Font locale, Country:" << aLanguageTag.getCountry() << " Language:" << aLanguageTag.getLanguage()); -//} -// -//SAL_INFO("cppcanvas.emf", "EMF+\t\t TODO Use all string formatting attributes during drawing"); -// -//double cellSize = setFont(aFontRequest, flags & 0xff, rFactoryParms, rState); -//rState.textColor = COLOR(brushId); -// -//::basegfx::B2DPoint point(Map(lx + 0.15*cellSize, ly + cellSize)); -// -//ActionSharedPtr pTextAction( -//TextActionFactory::createTextAction( -//// position is just rough guess for now -//// we should calculate it exactly from layoutRect or font -//vcl::unotools::pointFromB2DPoint(point), -//::Size(), -//::Color(), -//::Size(), -//::Color(), -//text, -//0, -//stringLength, -//nullptr, -//rFactoryParms.mrVDev, -//rFactoryParms.mrCanvas, -//rState, -//rFactoryParms.mrParms, -//false)); -//if (pTextAction) -//{ -//
[Libreoffice-commits] core.git: drawinglayer/source
drawinglayer/source/tools/emfphelperdata.cxx | 24 ++-- 1 file changed, 10 insertions(+), 14 deletions(-) New commits: commit 5f040a4b0d1f50e3d619a8f147b36c79c375783e Author: Patrick Jaap <patrick.j...@tu-dresden.de> Date: Tue Aug 8 09:48:15 2017 +0200 new EMF+ Parser: Implementation of drawImage this small patch implements the EMF+ Record darwImage. It generates a BitmapPrimitive2D. Change-Id: I90d9a788ed9f520041c392d11f0d97f8e4233796 Reviewed-on: https://gerrit.libreoffice.org/40866 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Armin Le Grand <armin.le.gr...@cib.de> diff --git a/drawinglayer/source/tools/emfphelperdata.cxx b/drawinglayer/source/tools/emfphelperdata.cxx index 8528bcfbbfe1..335d5634880d 100644 --- a/drawinglayer/source/tools/emfphelperdata.cxx +++ b/drawinglayer/source/tools/emfphelperdata.cxx @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -1031,20 +1032,15 @@ namespace emfplushelper SAL_INFO("cppcanvas.emf", "EMF+ bitmap size: " << aSize.Width() << "x" << aSize.Height()); if (aSize.Width() > 0 && aSize.Height() > 0) { -//ActionSharedPtr pBmpAction( -// internal::BitmapActionFactory::createBitmapAction( -//aBmp, -//rState.mapModeTransform * aDstPoint, -//rState.mapModeTransform * aDstSize, -//rCanvas, -//rState)); -// -//if (pBmpAction) { -// maActions.push_back(MtfAction(pBmpAction, -// rFactoryParms.mrCurrActionIndex)); -// -//rFactoryParms.mrCurrActionIndex += pBmpAction->getActionCount() - 1; -//} +// create correct transform matrix +basegfx::B2DHomMatrix aTransformMatrix = basegfx::tools::createScaleTranslateB2DHomMatrix( +aDstSize.getX(), +aDstSize.getY(), +aDstPoint.getX(), +aDstPoint.getY()); + +mrTargetHolders.Current().append( +new drawinglayer::primitive2d::BitmapPrimitive2D(aBmp,aTransformMatrix)); } else { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: drawinglayer/source
drawinglayer/source/tools/emfphelperdata.cxx | 203 ++- 1 file changed, 196 insertions(+), 7 deletions(-) New commits: commit 70dd00331e3112e7c32d5c7ac121ad7e77535817 Author: Patrick Jaap <patrick.j...@tu-dresden.de> Date: Mon Aug 7 13:17:05 2017 +0200 new EMF+ Parser: Implementation of fillPolygon This implementation replaces hte old one. It uses the workaround hatch blending from the old implentation (basically just copied) It provides correct linear gradients, with correct transformations PathGradients are approximated via RadialGradients. Also, there is a better line width choice, solving problems caused by pictures like tdf#38580. Change-Id: Ida4f36a5de83b6325702a153b642abe5e45982ee Reviewed-on: https://gerrit.libreoffice.org/40831 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Bartosz Kosiorek <gan...@poczta.onet.pl> diff --git a/drawinglayer/source/tools/emfphelperdata.cxx b/drawinglayer/source/tools/emfphelperdata.cxx index d5249b1c5d39..0aac3e95f6f5 100644 --- a/drawinglayer/source/tools/emfphelperdata.cxx +++ b/drawinglayer/source/tools/emfphelperdata.cxx @@ -28,6 +28,8 @@ #include #include #include +#include +#include #include #include #include @@ -348,7 +350,15 @@ namespace emfplushelper SAL_WARN_IF(pen->startCap != pen->endCap, "cppcanvas.emf", "emf+ pen uses different start and end cap"); } // transform the pen width - const double transformedPenWidth = MapSize(pen->penWidth, 0).getX(); + double adjustedPenWidth = pen->penWidth; + if (!pen->penWidth) // no width specified, then use default value + { +adjustedPenWidth = pen->penUnit == 0 ? 0.18f // 0.18f is determined by comparison with MSO (case of Unit == World) + : 0.05f; // 0.05f is taken from old EMF+ implementation (case of Unit == Pixel etc.) + } + + // transform and compare to 5 (the value 5 is determined by comparison to MSO) + const double transformedPenWidth = std::max( MapSize(adjustedPenWidth,0).getX() , 5.); drawinglayer::attribute::LineAttribute lineAttribute(pen->GetColor().getBColor(), transformedPenWidth, lineJoin, @@ -362,14 +372,193 @@ namespace emfplushelper void EmfPlusHelperData::EMFPPlusFillPolygon(const ::basegfx::B2DPolyPolygon& polygon, bool isColor, sal_uInt32 brushIndexOrColor) { -if (polygon.count()) +if (!polygon.count()) + return; + +SAL_INFO("cppcanvas.emf", "EMF+\tfill polygon"); +if (isColor) // use Color { -if (isColor) +mrTargetHolders.Current().append( +new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D( +polygon, +::Color(0xff - (brushIndexOrColor >> 24), (brushIndexOrColor >> 16) & 0xff, (brushIndexOrColor >> 8) & 0xff, brushIndexOrColor & 0xff).getBColor())); +} +else // use Brush +{ +EMFPBrush* brush = static_cast<EMFPBrush*>( maEMFPObjects[brushIndexOrColor & 0xff].get() ); +SAL_INFO("cppcanvas.emf", "EMF+\tbrush fill slot: " << brushIndexOrColor << " (type: " << (brush ? brush->GetType() : -1) << ")"); + +// give up in case something wrong happened +if( !brush ) +return; +if (brush->type == BrushTypeHatchFill) +{ +// EMF+ like hatching is currently not supported. These are just color blends which serve as an approximation for some of them +// for the others the hatch "background" color (secondColor in brush) is used. + +bool isHatchBlend = true; +double blendFactor = 0.0; + +switch (brush->hatchStyle) +{ +case HatchStyle05Percent: blendFactor = 0.05; break; +case HatchStyle10Percent: blendFactor = 0.10; break; +case HatchStyle20Percent: blendFactor = 0.20; break; +case HatchStyle25Percent: blendFactor = 0.25; break; +case HatchStyle30Percent: blendFactor = 0.30; break; +case HatchStyle40Percent: blendFactor = 0.40; break; +case HatchStyle50Percent: blendFactor = 0.50; break; +case HatchStyle60Percent: blendFactor = 0.60; break; +case HatchStyle70Percent: blendFactor = 0.70; break; +case HatchStyle75Percen
[Libreoffice-commits] core.git: drawinglayer/source
drawinglayer/source/tools/emfpfont.hxx |5 ++ drawinglayer/source/tools/emfphelperdata.cxx | 62 + drawinglayer/source/tools/emfpstringformat.cxx |3 + drawinglayer/source/tools/emfpstringformat.hxx | 12 4 files changed, 82 insertions(+) New commits: commit 5a9e731d00de64dd906ffd4ebf77f7fc7f811f99 Author: Patrick Jaap <patrick.j...@tu-dresden.de> Date: Tue Aug 1 14:21:29 2017 +0200 new EMF+ Parser: Basic Text Primitives for EmfPlusRecordTypeDrawString Implementation of basic text primitives. It supports text, textstyle (bold, italic, font, font size, direction, color, locale. The positions are well-transformed. Also a few adjustments and supplements for EMFplus font and stringformat Change-Id: I2670b5d0f6b9ddcaa9ffc8262d8aee13ba224b77 Reviewed-on: https://gerrit.libreoffice.org/40635 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Armin Le Grand <armin.le.gr...@cib.de> diff --git a/drawinglayer/source/tools/emfpfont.hxx b/drawinglayer/source/tools/emfpfont.hxx index 6c9f73fd4455..22263faf728a 100644 --- a/drawinglayer/source/tools/emfpfont.hxx +++ b/drawinglayer/source/tools/emfpfont.hxx @@ -32,6 +32,11 @@ namespace emfplushelper OUString family; void Read(SvMemoryStream ); + +bool Bold() { return fontFlags & 0x1; } +bool Italic() { return fontFlags & 0x2; } +bool Underline(){ return fontFlags & 0x4; } +bool Strikaout(){ return fontFlags & 0x8; } }; } diff --git a/drawinglayer/source/tools/emfphelperdata.cxx b/drawinglayer/source/tools/emfphelperdata.cxx index d7919234842f..d5249b1c5d39 100644 --- a/drawinglayer/source/tools/emfphelperdata.cxx +++ b/drawinglayer/source/tools/emfphelperdata.cxx @@ -28,6 +28,8 @@ #include #include #include +#include +#include #include #include @@ -882,9 +884,69 @@ namespace emfplushelper if (flags & 0x8000) { +// read the layout rectangle float lx, ly, lw, lh; rMS.ReadFloat(lx).ReadFloat(ly).ReadFloat(lw).ReadFloat(lh); SAL_INFO("cppcanvas.emf", "EMF+ DrawString layoutRect: " << lx << "," << ly << " - " << lw << "x" << lh); +// parse the string +OUString text = read_uInt16s_ToOUString(rMS, stringLength); +SAL_INFO("cppcanvas.emf", "EMF+ DrawString string: " << text); +// get the stringFormat from the Object table +EMFPStringFormat *stringFormat = static_cast< EMFPStringFormat* >(maEMFPObjects[formatId & 0xff].get()); +// get the font from the flags +EMFPFont *font = static_cast< EMFPFont* >( maEMFPObjects[flags & 0xff].get() ); +if (!stringFormat || !font) +{ + break; +} +// done reading + +// transform to TextSimplePortionPrimitive2D + +const OUString emptyString; +drawinglayer::attribute::FontAttribute fontAttribute( +font->family, // font family +emptyString, // (no) font style +font->Bold() ? 8u : 1u, // weight: 8 = bold +font->family.compareTo("SYMBOL") == 0, // symbol +stringFormat->DirectionVertical(), // vertical +font->Italic(), // italic +false, // monospaced +false, // outline = false, no such thing in MS-EMFPLUS +stringFormat->DirectionRightToLeft(), // right-to-left +false); // BiDiStrong + +LanguageTag aLanguageTag(static_cast< LanguageType >(stringFormat->language)); +css::lang::Locale locale = aLanguageTag.getLocale(); + +basegfx::B2DHomMatrix transformMatrix = basegfx::tools::createScaleTranslateB2DHomMatrix(MapSize(font->emSize,font->emSize),Map(lx,ly+font->emSize)); + +
[Libreoffice-commits] core.git: drawinglayer/source
drawinglayer/source/tools/emfphelperdata.cxx | 28 +++ drawinglayer/source/tools/emfppen.cxx|4 ++- drawinglayer/source/tools/emfppen.hxx|2 + 3 files changed, 29 insertions(+), 5 deletions(-) New commits: commit a3926e25bb0a9c79e3ea1f413b8fa83b91915758 Author: Patrick Jaap <patrick.j...@tu-dresden.de> Date: Tue Aug 1 16:24:01 2017 +0200 new EMF+ parser: EMFPPlusDrawPolygon: use correct pen width the current implementation uses PolyPolygonHairlinePrimitive2D for polygons. This patch uses a PolyPolygonStrokePrimitive2D which makes use of the correct (transformed) pen width and some basic join and cap attributes. Change-Id: Ifbd8cbbc41004d9d45f3c48f2c13fe449025a229 Reviewed-on: https://gerrit.libreoffice.org/40638 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Armin Le Grand <armin.le.gr...@cib.de> diff --git a/drawinglayer/source/tools/emfphelperdata.cxx b/drawinglayer/source/tools/emfphelperdata.cxx index a648117982ff..d7919234842f 100644 --- a/drawinglayer/source/tools/emfphelperdata.cxx +++ b/drawinglayer/source/tools/emfphelperdata.cxx @@ -331,10 +331,30 @@ namespace emfplushelper if (pen && polygon.count()) { -mrTargetHolders.Current().append( -new drawinglayer::primitive2d::PolyPolygonHairlinePrimitive2D( -polygon, -pen->GetColor().getBColor())); + // we need a line join attribute + basegfx::B2DLineJoin lineJoin = basegfx::B2DLineJoin::Round; + if (pen->penDataFlags & 0x0008) // additional line join information + { +lineJoin = static_cast(EMFPPen::lcl_convertLineJoinType(pen->lineJoin)); + } + + // we need a line cap attribute + css::drawing::LineCap lineCap = css::drawing::LineCap_BUTT; + if (pen->penDataFlags & 0x0002) // additional line cap information + { +lineCap = static_cast(EMFPPen::lcl_convertStrokeCap(pen->startCap)); +SAL_WARN_IF(pen->startCap != pen->endCap, "cppcanvas.emf", "emf+ pen uses different start and end cap"); + } + // transform the pen width + const double transformedPenWidth = MapSize(pen->penWidth, 0).getX(); + drawinglayer::attribute::LineAttribute lineAttribute(pen->GetColor().getBColor(), + transformedPenWidth, + lineJoin, + lineCap); + mrTargetHolders.Current().append( + new drawinglayer::primitive2d::PolyPolygonStrokePrimitive2D( + polygon, + lineAttribute)); } } diff --git a/drawinglayer/source/tools/emfppen.cxx b/drawinglayer/source/tools/emfppen.cxx index 9bc66e6716af..1905b8cb6f48 100644 --- a/drawinglayer/source/tools/emfppen.cxx +++ b/drawinglayer/source/tools/emfppen.cxx @@ -69,6 +69,8 @@ namespace emfplushelper EMFPPen::EMFPPen() : EMFPBrush() +, penDataFlags(0) +, penUnit(0) , penWidth(0.0) , startCap(0) , endCap(0) @@ -169,7 +171,7 @@ namespace emfplushelper void EMFPPen::Read(SvStream& s, EmfPlusHelperData& rR) { -sal_uInt32 graphicsVersion, penType, penDataFlags, penUnit; +sal_uInt32 graphicsVersion, penType; int i; s.ReadUInt32(graphicsVersion).ReadUInt32(penType).ReadUInt32(penDataFlags).ReadUInt32(penUnit).ReadFloat(penWidth); SAL_INFO("cppcanvas.emf", "EMF+\tpen"); diff --git a/drawinglayer/source/tools/emfppen.hxx b/drawinglayer/source/tools/emfppen.hxx index c338fef62029..7b8f67d41d87 100644 --- a/drawinglayer/source/tools/emfppen.hxx +++ b/drawinglayer/source/tools/emfppen.hxx @@ -39,6 +39,8 @@ namespace emfplushelper struct EMFPPen : public EMFPBrush { basegfx::B2DHomMatrix pen_transformation; //TODO: This isn't used +sal_uInt32 penDataFlags; +sal_uInt32 penUnit; float penWidth; sal_Int32 startCap; sal_Int32 endCap; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sw/qa
sw/qa/extras/ooxmlimport/data/tdf101627.docx |binary sw/qa/extras/ooxmlimport/ooxmlimport.cxx |8 2 files changed, 8 insertions(+) New commits: commit d862741423cdf0ef228d34b2a25b09c9401be584 Author: Patrick Jaap <p...@mail.de> Date: Thu Apr 20 15:31:18 2017 +0200 tdf#101627 add unit test unit test for the patch 80b9b6761e8cb974e0cdc0c7be0eb95f8745d86f Change-Id: I68b7eb686fa52f1851455160e1196f0748935c4c Reviewed-on: https://gerrit.libreoffice.org/36747 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Michael Stahl <mst...@redhat.com> diff --git a/sw/qa/extras/ooxmlimport/data/tdf101627.docx b/sw/qa/extras/ooxmlimport/data/tdf101627.docx new file mode 100644 index ..0a1efd8f4295 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf101627.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 2a6bbf49dd05..9154ef1cfa3c 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -1304,6 +1304,14 @@ DECLARE_OOXMLIMPORT_TEST( testTdf106606, "tdf106606.docx" ) CPPUNIT_ASSERT( FindGraphicBitmapPropertyInNumStyle("WWNum2") ); } +DECLARE_OOXMLIMPORT_TEST(testTdf101627, "tdf101627.docx") +{ +// Do not shrink the textbox in the footer +uno::Reference xFrame(getShape(1), uno::UNO_QUERY); +CPPUNIT_ASSERT(xFrame->getString().startsWith( "1" ) ); +CPPUNIT_ASSERT_EQUAL(sal_Int32(466), getProperty(xFrame, "Height")); +} + // tests should only be added to ooxmlIMPORT *if* they fail round-tripping in ooxmlEXPORT CPPUNIT_PLUGIN_IMPLEMENT(); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - sw/source
sw/source/core/objectpositioning/anchoredobjectposition.cxx |8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) New commits: commit cbbe5c471cad37ab434a11b804c66e0b424af8a7 Author: Patrick Jaap <p...@mail.de> Date: Wed Mar 29 11:35:25 2017 +0200 tdf#101627 disable shrinking for footer textboxes the shrinking patch a4dee94afed9ade6ac50237c8d99a6e49d3bebc1 causes problems, if the textboxes are anchored in the footer. Therefore, disable it in this case. For details, see comments in bug tracker. Change-Id: I117a99041ff67c19a9de17803ff7864c62afdb50 Reviewed-on: https://gerrit.libreoffice.org/34517 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Michael Stahl <mst...@redhat.com> (cherry picked from commit 80b9b6761e8cb974e0cdc0c7be0eb95f8745d86f) Reviewed-on: https://gerrit.libreoffice.org/35845 Tested-by: Michael Stahl <mst...@redhat.com> diff --git a/sw/source/core/objectpositioning/anchoredobjectposition.cxx b/sw/source/core/objectpositioning/anchoredobjectposition.cxx index afd00eb3389a..d369ac46132a 100644 --- a/sw/source/core/objectpositioning/anchoredobjectposition.cxx +++ b/sw/source/core/objectpositioning/anchoredobjectposition.cxx @@ -486,8 +486,12 @@ SwTwips SwAnchoredObjectPosition::ImplAdjustVertRelPos( const SwTwips nTopOfAnch nAdjustedRelPosY = aPgAlignArea.Top() - nTopOfAnch; } -// tdf#91260 - allow textboxes extending beyond the page bottom -if ( nAdjustedRelPosY < nProposedRelPosY ) +// tdf#91260 - allow textboxes extending beyond the page bottom +// tdf#101627 - the patch a4dee94afed9ade6ac50237c8d99a6e49d3bebc1 +// for tdf#91260 causes problems if the textbox +// is anchored in the footer, so exclude this case +if ( !( GetAnchorFrame().GetUpper() && GetAnchorFrame().GetUpper()->IsFooterFrame() ) + && nAdjustedRelPosY < nProposedRelPosY ) { const SwFrameFormat* pFormat = &(GetFrameFormat()); if ( SwTextBoxHelper::isTextBox(()) ) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source
sw/source/core/objectpositioning/anchoredobjectposition.cxx |8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) New commits: commit da18188c359dee813fa1d4c7000490f1512c277b Author: Patrick Jaap <p...@mail.de> Date: Wed Mar 29 11:35:25 2017 +0200 tdf#101627 disable shrinking for footer textboxes the shrinking patch a4dee94afed9ade6ac50237c8d99a6e49d3bebc1 causes problems, if the textboxes are anchored in the footer. Therefore, disable it in this case. For details, see comments in bug tracker. Change-Id: I117a99041ff67c19a9de17803ff7864c62afdb50 Reviewed-on: https://gerrit.libreoffice.org/34517 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Michael Stahl <mst...@redhat.com> (cherry picked from commit 80b9b6761e8cb974e0cdc0c7be0eb95f8745d86f) Reviewed-on: https://gerrit.libreoffice.org/35844 diff --git a/sw/source/core/objectpositioning/anchoredobjectposition.cxx b/sw/source/core/objectpositioning/anchoredobjectposition.cxx index 4b300ce8bf3f..c1e7808517c1 100644 --- a/sw/source/core/objectpositioning/anchoredobjectposition.cxx +++ b/sw/source/core/objectpositioning/anchoredobjectposition.cxx @@ -486,8 +486,12 @@ SwTwips SwAnchoredObjectPosition::ImplAdjustVertRelPos( const SwTwips nTopOfAnch nAdjustedRelPosY = aPgAlignArea.Top() - nTopOfAnch; } -// tdf#91260 - allow textboxes extending beyond the page bottom -if ( nAdjustedRelPosY < nProposedRelPosY ) +// tdf#91260 - allow textboxes extending beyond the page bottom +// tdf#101627 - the patch a4dee94afed9ade6ac50237c8d99a6e49d3bebc1 +// for tdf#91260 causes problems if the textbox +// is anchored in the footer, so exclude this case +if ( !( GetAnchorFrame().GetUpper() && GetAnchorFrame().GetUpper()->IsFooterFrame() ) + && nAdjustedRelPosY < nProposedRelPosY ) { const SwFrameFormat* pFormat = &(GetFrameFormat()); if ( SwTextBoxHelper::isTextBox(()) ) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sw/source
sw/source/core/objectpositioning/anchoredobjectposition.cxx |8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) New commits: commit 80b9b6761e8cb974e0cdc0c7be0eb95f8745d86f Author: Patrick Jaap <p...@mail.de> Date: Wed Mar 29 11:35:25 2017 +0200 tdf#101627 disable shrinking for footer textboxes the shrinking patch a4dee94afed9ade6ac50237c8d99a6e49d3bebc1 causes problems, if the textboxes are anchored in the footer. Therefore, disable it in this case. For details, see comments in bug tracker. Change-Id: I117a99041ff67c19a9de17803ff7864c62afdb50 Reviewed-on: https://gerrit.libreoffice.org/34517 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Michael Stahl <mst...@redhat.com> diff --git a/sw/source/core/objectpositioning/anchoredobjectposition.cxx b/sw/source/core/objectpositioning/anchoredobjectposition.cxx index 373cf036a284..3a4d55f0f88d 100644 --- a/sw/source/core/objectpositioning/anchoredobjectposition.cxx +++ b/sw/source/core/objectpositioning/anchoredobjectposition.cxx @@ -486,8 +486,12 @@ SwTwips SwAnchoredObjectPosition::ImplAdjustVertRelPos( const SwTwips nTopOfAnch nAdjustedRelPosY = aPgAlignArea.Top() - nTopOfAnch; } -// tdf#91260 - allow textboxes extending beyond the page bottom -if ( nAdjustedRelPosY < nProposedRelPosY ) +// tdf#91260 - allow textboxes extending beyond the page bottom +// tdf#101627 - the patch a4dee94afed9ade6ac50237c8d99a6e49d3bebc1 +// for tdf#91260 causes problems if the textbox +// is anchored in the footer, so exclude this case +if ( !( GetAnchorFrame().GetUpper() && GetAnchorFrame().GetUpper()->IsFooterFrame() ) + && nAdjustedRelPosY < nProposedRelPosY ) { const SwFrameFormat* pFormat = &(GetFrameFormat()); if ( SwTextBoxHelper::isTextBox(()) ) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits