Re: ESC meeting agenda: 2023-09-14 16:00 CEST
On 14/9/23 16:54, Julien Nabet wrote: It seems it would be good to have in the scope https://bugs.documentfoundation.org/show_bug.cgi?id=157231 concerning CVE-2023-4863 (libwebp). Did anything come of this? I see that 7.6.1 was released without this fix, and no mention of this issue in the ESC minutes. For reference, within the corporate environment where I work, the information security team is scanning all devices and servers for affected software and working to update or remove it. At the moment this means that anyone with LibreOffice installed on their Windows or Mac laptop will have to remove it since no fixed version has been released yet. I expect that many other large organisations will be conducting similar activity. Is there any possibility of making a security release sooner than the normal schedule for 7.6.2 / 7.5.7? I understand the risk to LibreOffice users is that if they open a document containing a malicious webp image then this buffer overflow vulnerability could possible allow remote code injection, does this sound accurate? Incidentally the libreoffice package from Ubuntu appears to be fine since it is compiled against the system libwebp which has been updated by Ubuntu already. I think the concern is more for Windows and Mac users. Thanks, Luke
[Libreoffice-commits] core.git: Branch 'feature/cib_contract57l' - sw/source
sw/source/core/inc/layact.hxx| 23 +-- sw/source/core/layout/layact.cxx | 59 +-- sw/source/core/view/viewsh.cxx |1 3 files changed, 47 insertions(+), 36 deletions(-) New commits: commit 7e70466060b1b393c6e5fec86b2b0e4a2722bc8d Author: Luke Deller AuthorDate: Fri Apr 9 09:08:37 2021 +1000 Commit: Samuel Mehrbrodt CommitDate: Tue Jan 18 13:33:06 2022 +0100 tdf#141556 Fix 100% CPU usage in Writer idle loop Do not interrupt the idle layout processing unnecessarily, because if it is continually interrupted before making enough progress then it will keep resuming at the same page, never finishing, constantly using CPU. This is achieved with two changes: - Revert "tdf#123583 use TaskStopwatch for Writer Idle loop" (commit 383032c50a3e3354f04200ce984a47ab9d2c5c67) which introduced a stopwatch timer to interrupt idle processing every 50ms. This reversion restores the previous behaviour where idle processing is interrupted only when there is an input event. - Filter out TIMER events so that they do not interrupt the idle loop; this fixes both tdf#123583 and tdf#141556 Conflicts: sw/source/core/inc/layact.hxx sw/source/core/layout/layact.cxx Change-Id: Ic989631e5f32199209d64b66b72059253fc0167a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113825 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski Reviewed-by: Miklos Vajna (cherry picked from commit 0fedac18214a6025401c4c426466a5166553e8ec) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114944 (cherry picked from commit b33148071ae6256845352f8625e58b1ab95be41c) diff --git a/sw/source/core/inc/layact.hxx b/sw/source/core/inc/layact.hxx index 1707383b62d7..bac0a23da163 100644 --- a/sw/source/core/inc/layact.hxx +++ b/sw/source/core/inc/layact.hxx @@ -22,7 +22,6 @@ #include #include -#include #include #include @@ -57,7 +56,6 @@ class SwLayAction { SwRootFrame *m_pRoot; SwViewShellImp *m_pImp; // here the action logs in and off -TaskStopwatch* m_pWatch; // For the sake of optimization, so that the tables stick a bit better to // the Cursor when hitting return/backspace in front of one. @@ -76,6 +74,7 @@ class SwLayAction std::clock_t m_nStartTicks; // The Action's starting time; if too much time passes the // WaitCursor can be enabled via CheckWaitCursor() +VclInputFlags m_nInputType; // Which input should terminate processing sal_uInt16 m_nEndPage;// StatBar control sal_uInt16 m_nCheckPageNum; // CheckPageDesc() was delayed if != USHRT_MAX // check from this page onwards @@ -85,8 +84,9 @@ class SwLayAction bool m_bCalcLayout;// Complete reformatting? bool m_bAgain; // For the automatically repeated Action if Pages are deleted bool m_bNextCycle; // Reset on the first invalid Page +bool m_bInput; // For terminating processing on input +bool m_bIdle; // True if the LayAction was triggered by the Idler bool m_bReschedule;// Call Reschedule depending on Progress? -bool m_bInterrupt; // For termination the layouting bool m_bCheckPages;// Run CheckPageDescs() or delay it bool m_bUpdateExpFields; // Is set if, after Formatting, we need to do another round for ExpField bool m_bBrowseActionStop; // Terminate Action early (as per bInput) and leave the rest to the Idler @@ -119,26 +119,33 @@ class SwLayAction bool RemoveEmptyBrowserPages(); +inline void CheckIdleEnd(); + public: -SwLayAction(SwRootFrame *pRt, SwViewShellImp *pImp, TaskStopwatch* pWatch = nullptr); +SwLayAction( SwRootFrame *pRt, SwViewShellImp *pImp ); ~SwLayAction(); +void SetIdle( bool bNew ) { m_bIdle = bNew; } void SetCheckPages ( bool bNew ) { m_bCheckPages = bNew; } void SetBrowseActionStop( bool bNew ) { m_bBrowseActionStop = bNew; } void SetNextCycle ( bool bNew ) { m_bNextCycle = bNew; } bool IsWaitAllowed()const { return m_bWaitAllowed; } bool IsNextCycle() const { return m_bNextCycle; } +bool IsInput() const { return m_bInput; } bool IsPaint() const { return m_bPaint; } +bool IsIdle() const { return m_bIdle; } bool IsReschedule() const { return m_bReschedule; } -bool IsIdle() const { return m_pWatch != nullptr; } -bool IsPaintExtraData() const { return m_bPaintExtraData; } -bool IsInterrupt(); +bool IsPaintExtraData() const { return m_bPaintExtraData;} +bool IsInterrupt() const { return IsInput(); } + +VclInputFlags Ge
[issue44705] Support Windows file open modes for `open` built-in function
New submission from Luke Deller : Microsoft Windows supports some extra file open modes including: "S"Specifies that caching is optimized for, but not restricted to, sequential access from disk. "T"Specifies a file as temporary. If possible, it is not flushed to disk. "D"Specifies a file as temporary. It is deleted when the last file pointer is closed Python 2 used to allow "T" and "D" flags in the built-in `open` function (though this was not documented): https://github.com/python/cpython/blob/2.7/Objects/fileobject.c#L214 It would be great if these flags were allowed in Python 3. I see that Python3 implementation uses `open`/`_wopen` rather than `fopen` now. The mapping to numeric flags for `_wopen` is shown in the documentation here: https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/fopen-wfopen (search for "Equivalent oflag value") -- components: IO messages: 397971 nosy: lukedeller1 priority: normal severity: normal status: open title: Support Windows file open modes for `open` built-in function type: enhancement versions: Python 3.10, Python 3.11, Python 3.6, Python 3.7, Python 3.8, Python 3.9 ___ Python tracker <https://bugs.python.org/issue44705> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[Libreoffice-commits] core.git: Branch 'feature/cib_contract57c' - 8 commits - external/openldap javaunohelper/com odk/build-examples_common.mk odk/examples solenv/gbuild sw/source
external/openldap/ExternalProject_openldap.mk |1 javaunohelper/com/sun/star/lib/uno/helper/InterfaceContainer.java | 48 odk/build-examples_common.mk |2 odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/Makefile |3 solenv/gbuild/platform/com_GCC_defs.mk |4 sw/source/core/inc/layact.hxx | 24 ++-- sw/source/core/layout/layact.cxx | 59 +- sw/source/core/view/viewsh.cxx |1 8 files changed, 77 insertions(+), 65 deletions(-) New commits: commit 5f6975bb5d83081ba0da5021b11434666ee49d4a Author: Luke Deller AuthorDate: Fri Apr 9 09:08:37 2021 +1000 Commit: Michael Stahl CommitDate: Wed Jun 23 17:24:52 2021 +0200 tdf#141556 Fix 100% CPU usage in Writer idle loop Do not interrupt the idle layout processing unnecessarily, because if it is continually interrupted before making enough progress then it will keep resuming at the same page, never finishing, constantly using CPU. This is achieved with two changes: - Revert "tdf#123583 use TaskStopwatch for Writer Idle loop" (commit 383032c50a3e3354f04200ce984a47ab9d2c5c67) which introduced a stopwatch timer to interrupt idle processing every 50ms. This reversion restores the previous behaviour where idle processing is interrupted only when there is an input event. - Filter out TIMER events so that they do not interrupt the idle loop; this fixes both tdf#123583 and tdf#141556 Conflicts: sw/source/core/inc/layact.hxx sw/source/core/layout/layact.cxx Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113825 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski Reviewed-by: Miklos Vajna (cherry picked from commit 0fedac18214a6025401c4c426466a5166553e8ec) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114944 (cherry picked from commit b33148071ae6256845352f8625e58b1ab95be41c) Change-Id: Ic989631e5f32199209d64b66b72059253fc0167a diff --git a/sw/source/core/inc/layact.hxx b/sw/source/core/inc/layact.hxx index 7a843e60f0d1..f114273c0231 100644 --- a/sw/source/core/inc/layact.hxx +++ b/sw/source/core/inc/layact.hxx @@ -21,7 +21,7 @@ #include -#include +#include #include @@ -54,7 +54,6 @@ class SwLayAction { SwRootFrame *m_pRoot; SwViewShellImp *m_pImp; // here the action logs in and off -TaskStopwatch* m_pWatch; // For the sake of optimization, so that the tables stick a bit better to // the Cursor when hitting return/backspace in front of one. @@ -73,6 +72,7 @@ class SwLayAction std::clock_t m_nStartTicks; // The Action's starting time; if too much time passes the // WaitCursor can be enabled via CheckWaitCursor() +VclInputFlags m_nInputType; // Which input should terminate processing sal_uInt16 m_nEndPage;// StatBar control sal_uInt16 m_nCheckPageNum; // CheckPageDesc() was delayed if != USHRT_MAX // check from this page onwards @@ -82,8 +82,9 @@ class SwLayAction bool m_bCalcLayout;// Complete reformatting? bool m_bAgain; // For the automatically repeated Action if Pages are deleted bool m_bNextCycle; // Reset on the first invalid Page +bool m_bInput; // For terminating processing on input +bool m_bIdle; // True if the LayAction was triggered by the Idler bool m_bReschedule;// Call Reschedule depending on Progress? -bool m_bInterrupt; // For termination the layouting bool m_bCheckPages;// Run CheckPageDescs() or delay it bool m_bUpdateExpFields; // Is set if, after Formatting, we need to do another round for ExpField bool m_bBrowseActionStop; // Terminate Action early (as per bInput) and leave the rest to the Idler @@ -116,26 +117,33 @@ class SwLayAction bool RemoveEmptyBrowserPages(); +inline void CheckIdleEnd(); + public: -SwLayAction(SwRootFrame *pRt, SwViewShellImp *pImp, TaskStopwatch* pWatch = nullptr); +SwLayAction( SwRootFrame *pRt, SwViewShellImp *pImp ); ~SwLayAction(); +void SetIdle( bool bNew ) { m_bIdle = bNew; } void SetCheckPages ( bool bNew ) { m_bCheckPages = bNew; } void SetBrowseActionStop( bool bNew ) { m_bBrowseActionStop = bNew; } void SetNextCycle ( bool bNew ) { m_bNextCycle = bNew; } bool IsWaitAllowed()const { return m_bWaitAllowed; } bool IsNextCycle() const { return m_bNextCycle; } +bool IsInput() const { return m_bInput; } bool IsPaint() const { return m_bPaint; } +bool IsIdle()
[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sw/source
sw/source/core/inc/layact.hxx| 23 +- sw/source/core/layout/layact.cxx | 60 +-- sw/source/core/view/viewsh.cxx |1 3 files changed, 48 insertions(+), 36 deletions(-) New commits: commit b33148071ae6256845352f8625e58b1ab95be41c Author: Luke Deller AuthorDate: Fri Apr 9 09:08:37 2021 +1000 Commit: Miklos Vajna CommitDate: Mon May 3 12:27:34 2021 +0200 tdf#141556 Fix 100% CPU usage in Writer idle loop Do not interrupt the idle layout processing unnecessarily, because if it is continually interrupted before making enough progress then it will keep resuming at the same page, never finishing, constantly using CPU. This is achieved with two changes: - Revert "tdf#123583 use TaskStopwatch for Writer Idle loop" (commit 383032c50a3e3354f04200ce984a47ab9d2c5c67) which introduced a stopwatch timer to interrupt idle processing every 50ms. This reversion restores the previous behaviour where idle processing is interrupted only when there is an input event. - Filter out TIMER events so that they do not interrupt the idle loop; this fixes both tdf#123583 and tdf#141556 Conflicts: sw/source/core/inc/layact.hxx sw/source/core/layout/layact.cxx Change-Id: Ic989631e5f32199209d64b66b72059253fc0167a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113825 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski Reviewed-by: Miklos Vajna (cherry picked from commit 0fedac18214a6025401c4c426466a5166553e8ec) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114944 diff --git a/sw/source/core/inc/layact.hxx b/sw/source/core/inc/layact.hxx index 433d4b70e59a..71484e00da5f 100644 --- a/sw/source/core/inc/layact.hxx +++ b/sw/source/core/inc/layact.hxx @@ -22,7 +22,6 @@ #include #include -#include #include #include @@ -57,7 +56,6 @@ class SwLayAction { SwRootFrame *m_pRoot; SwViewShellImp *m_pImp; // here the action logs in and off -TaskStopwatch* m_pWatch; // For the sake of optimization, so that the tables stick a bit better to // the Cursor when hitting return/backspace in front of one. @@ -76,6 +74,7 @@ class SwLayAction std::clock_t m_nStartTicks; // The Action's starting time; if too much time passes the // WaitCursor can be enabled via CheckWaitCursor() +VclInputFlags m_nInputType; // Which input should terminate processing sal_uInt16 m_nEndPage;// StatBar control sal_uInt16 m_nCheckPageNum; // CheckPageDesc() was delayed if != USHRT_MAX // check from this page onwards @@ -85,8 +84,9 @@ class SwLayAction bool m_bCalcLayout;// Complete reformatting? bool m_bAgain; // For the automatically repeated Action if Pages are deleted bool m_bNextCycle; // Reset on the first invalid Page +bool m_bInput; // For terminating processing on input +bool m_bIdle; // True if the LayAction was triggered by the Idler bool m_bReschedule;// Call Reschedule depending on Progress? -bool m_bInterrupt; // For termination the layouting bool m_bCheckPages;// Run CheckPageDescs() or delay it bool m_bUpdateExpFields; // Is set if, after Formatting, we need to do another round for ExpField bool m_bBrowseActionStop; // Terminate Action early (as per bInput) and leave the rest to the Idler @@ -124,26 +124,33 @@ class SwLayAction bool RemoveEmptyBrowserPages(); +inline void CheckIdleEnd(); + public: -SwLayAction(SwRootFrame *pRt, SwViewShellImp *pImp, TaskStopwatch* pWatch = nullptr); +SwLayAction( SwRootFrame *pRt, SwViewShellImp *pImp ); ~SwLayAction(); +void SetIdle( bool bNew ) { m_bIdle = bNew; } void SetCheckPages ( bool bNew ) { m_bCheckPages = bNew; } void SetBrowseActionStop( bool bNew ) { m_bBrowseActionStop = bNew; } void SetNextCycle ( bool bNew ) { m_bNextCycle = bNew; } bool IsWaitAllowed()const { return m_bWaitAllowed; } bool IsNextCycle() const { return m_bNextCycle; } +bool IsInput() const { return m_bInput; } bool IsPaint() const { return m_bPaint; } +bool IsIdle() const { return m_bIdle; } bool IsReschedule() const { return m_bReschedule; } -bool IsIdle() const { return m_pWatch != nullptr; } -bool IsPaintExtraData() const { return m_bPaintExtraData; } -bool IsInterrupt(); +bool IsPaintExtraData() const { return m_bPaintExtraData;} +bool IsInterrupt() const { return IsInput(); } + +VclInputFlags GetInputType()const { return m_nInputType; } // adjusting Action to
[Libreoffice-commits] core.git: sw/source
sw/source/core/inc/layact.hxx| 24 +-- sw/source/core/layout/layact.cxx | 60 +-- sw/source/core/view/viewsh.cxx |1 3 files changed, 49 insertions(+), 36 deletions(-) New commits: commit 0fedac18214a6025401c4c426466a5166553e8ec Author: Luke Deller AuthorDate: Fri Apr 9 09:08:37 2021 +1000 Commit: Miklos Vajna CommitDate: Wed Apr 14 08:25:05 2021 +0200 tdf#141556 Fix 100% CPU usage in Writer idle loop Do not interrupt the idle layout processing unnecessarily, because if it is continually interrupted before making enough progress then it will keep resuming at the same page, never finishing, constantly using CPU. This is achieved with two changes: - Revert "tdf#123583 use TaskStopwatch for Writer Idle loop" (commit 383032c50a3e3354f04200ce984a47ab9d2c5c67) which introduced a stopwatch timer to interrupt idle processing every 50ms. This reversion restores the previous behaviour where idle processing is interrupted only when there is an input event. - Filter out TIMER events so that they do not interrupt the idle loop; this fixes both tdf#123583 and tdf#141556 Conflicts: sw/source/core/inc/layact.hxx sw/source/core/layout/layact.cxx Change-Id: Ic989631e5f32199209d64b66b72059253fc0167a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113825 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski Reviewed-by: Miklos Vajna diff --git a/sw/source/core/inc/layact.hxx b/sw/source/core/inc/layact.hxx index 4729ea85ebff..f46c090dbb20 100644 --- a/sw/source/core/inc/layact.hxx +++ b/sw/source/core/inc/layact.hxx @@ -21,7 +21,7 @@ #include -#include +#include #include #include @@ -56,7 +56,6 @@ class SwLayAction { SwRootFrame *m_pRoot; SwViewShellImp *m_pImp; // here the action logs in and off -TaskStopwatch* m_pWatch; // For the sake of optimization, so that the tables stick a bit better to // the Cursor when hitting return/backspace in front of one. @@ -75,6 +74,7 @@ class SwLayAction std::clock_t m_nStartTicks; // The Action's starting time; if too much time passes the // WaitCursor can be enabled via CheckWaitCursor() +VclInputFlags m_nInputType; // Which input should terminate processing sal_uInt16 m_nEndPage;// StatBar control sal_uInt16 m_nCheckPageNum; // CheckPageDesc() was delayed if != USHRT_MAX // check from this page onwards @@ -84,8 +84,9 @@ class SwLayAction bool m_bCalcLayout;// Complete reformatting? bool m_bAgain; // For the automatically repeated Action if Pages are deleted bool m_bNextCycle; // Reset on the first invalid Page +bool m_bInput; // For terminating processing on input +bool m_bIdle; // True if the LayAction was triggered by the Idler bool m_bReschedule;// Call Reschedule depending on Progress? -bool m_bInterrupt; // For termination the layouting bool m_bCheckPages;// Run CheckPageDescs() or delay it bool m_bUpdateExpFields; // Is set if, after Formatting, we need to do another round for ExpField bool m_bBrowseActionStop; // Terminate Action early (as per bInput) and leave the rest to the Idler @@ -123,26 +124,33 @@ class SwLayAction bool RemoveEmptyBrowserPages(); +inline void CheckIdleEnd(); + public: -SwLayAction(SwRootFrame *pRt, SwViewShellImp *pImp, TaskStopwatch* pWatch = nullptr); +SwLayAction( SwRootFrame *pRt, SwViewShellImp *pImp ); ~SwLayAction(); +void SetIdle( bool bNew ) { m_bIdle = bNew; } void SetCheckPages ( bool bNew ) { m_bCheckPages = bNew; } void SetBrowseActionStop( bool bNew ) { m_bBrowseActionStop = bNew; } void SetNextCycle ( bool bNew ) { m_bNextCycle = bNew; } bool IsWaitAllowed()const { return m_bWaitAllowed; } bool IsNextCycle() const { return m_bNextCycle; } +bool IsInput() const { return m_bInput; } bool IsPaint() const { return m_bPaint; } +bool IsIdle() const { return m_bIdle; } bool IsReschedule() const { return m_bReschedule; } -bool IsIdle() const { return m_pWatch != nullptr; } -bool IsPaintExtraData() const { return m_bPaintExtraData; } -bool IsInterrupt(); +bool IsPaintExtraData() const { return m_bPaintExtraData;} +bool IsInterrupt() const { return IsInput(); } + +VclInputFlags GetInputType()const { return m_nInputType; } // adjusting Action to the wanted behaviour void SetPaint ( bool bNew ) { m_bPaint = bNew; } void SetComplete( bool bNew ) { m_bCompl
[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - include/vcl vcl/qa vcl/source
include/vcl/graphicfilter.hxx|8 +++ vcl/qa/cppunit/GraphicTest.cxx | 55 ++ vcl/source/filter/graphicfilter2.cxx | 72 --- vcl/source/gdi/impgraph.cxx | 19 + 4 files changed, 109 insertions(+), 45 deletions(-) New commits: commit cd5e86eba163cab14e1d4149dde4513fbe252340 Author: Luke Deller AuthorDate: Thu Oct 31 01:36:22 2019 +1100 Commit: Miklos Vajna CommitDate: Fri Nov 8 09:20:17 2019 +0100 tdf#118036 Fix IsTransparent for unloaded graphics Squashed two commits from master: [348460ec37b1] Fix IsTransparent() for unloaded graphics [d93740559872] Fix use of uninitialised variable Change-Id: I1753c0d11491f1dc518e23da8d7b3842945770cb Reviewed-on: https://gerrit.libreoffice.org/81959 Tested-by: Jenkins Tested-by: Xisco Faulí Reviewed-by: Miklos Vajna diff --git a/include/vcl/graphicfilter.hxx b/include/vcl/graphicfilter.hxx index 69fbc215ba77..88f6a7417f02 100644 --- a/include/vcl/graphicfilter.hxx +++ b/include/vcl/graphicfilter.hxx @@ -145,6 +145,8 @@ class VCL_DLLPUBLIC GraphicDescriptor final GraphicFileFormat nFormat; bool const bOwnStream; sal_uInt8 mnNumberOfImageComponents; +boolbIsTransparent; +boolbIsAlpha; voidImpConstruct(); @@ -214,6 +216,12 @@ public: /** @return number of color channels */ sal_uInt8 GetNumberOfImageComponents() const { return mnNumberOfImageComponents; } +/** @return whether image supports transparency */ +bool IsTransparent() const { return bIsTransparent; } + +/** @return whether image supports alpha values for translucent colours */ +bool IsAlpha() const { return bIsAlpha; } + /** @return filter number that is needed by the GraphFilter to read this format */ static OUString GetImportFormatShortName( GraphicFileFormat nFormat ); }; diff --git a/vcl/qa/cppunit/GraphicTest.cxx b/vcl/qa/cppunit/GraphicTest.cxx index d094da3ca957..c9593434674b 100644 --- a/vcl/qa/cppunit/GraphicTest.cxx +++ b/vcl/qa/cppunit/GraphicTest.cxx @@ -29,25 +29,40 @@ class GraphicTest : public CppUnit::TestFixture void testUnloadedGraphic(); void testUnloadedGraphicLoading(); void testUnloadedGraphicWmf(); +void testUnloadedGraphicAlpha(); CPPUNIT_TEST_SUITE(GraphicTest); CPPUNIT_TEST(testUnloadedGraphic); CPPUNIT_TEST(testUnloadedGraphicLoading); CPPUNIT_TEST(testUnloadedGraphicWmf); +CPPUNIT_TEST(testUnloadedGraphicAlpha); CPPUNIT_TEST_SUITE_END(); }; -BitmapEx createBitmap() +BitmapEx createBitmap(bool alpha = false) { -Bitmap aBitmap(Size(100, 100), 24); +Bitmap aBitmap(Size(120, 100), 24); aBitmap.Erase(COL_LIGHTRED); -return BitmapEx(aBitmap); +aBitmap.SetPrefSize(Size(6000, 5000)); +aBitmap.SetPrefMapMode(MapMode(MapUnit::Map100thMM)); + +if (alpha) +{ +sal_uInt8 uAlphaValue = 0x80; +AlphaMask aAlphaMask(Size(120, 100), ); + +return BitmapEx(aBitmap, aAlphaMask); +} +else +{ +return BitmapEx(aBitmap); +} } -void createBitmapAndExportForType(SvStream& rStream, OUString const& sType) +void createBitmapAndExportForType(SvStream& rStream, OUString const& sType, bool alpha) { -BitmapEx aBitmapEx = createBitmap(); +BitmapEx aBitmapEx = createBitmap(alpha); uno::Sequence aFilterData; GraphicFilter& rGraphicFilter = GraphicFilter::GetGraphicFilter(); @@ -57,11 +72,11 @@ void createBitmapAndExportForType(SvStream& rStream, OUString const& sType) rStream.Seek(STREAM_SEEK_TO_BEGIN); } -Graphic makeUnloadedGraphic(OUString const& sType) +Graphic makeUnloadedGraphic(OUString const& sType, bool alpha = false) { SvMemoryStream aStream; GraphicFilter& rGraphicFilter = GraphicFilter::GetGraphicFilter(); -createBitmapAndExportForType(aStream, sType); +createBitmapAndExportForType(aStream, sType, alpha); return rGraphicFilter.ImportUnloadedGraphic(aStream); } @@ -82,10 +97,15 @@ void GraphicTest::testUnloadedGraphic() // check GetSizePixel doesn't load graphic aGraphic = makeUnloadedGraphic("png"); CPPUNIT_ASSERT_EQUAL(false, aGraphic.isAvailable()); -CPPUNIT_ASSERT_EQUAL(100L, aGraphic.GetSizePixel().Width()); +CPPUNIT_ASSERT_EQUAL(120L, aGraphic.GetSizePixel().Width()); CPPUNIT_ASSERT_EQUAL(100L, aGraphic.GetSizePixel().Height()); CPPUNIT_ASSERT_EQUAL(false, aGraphic.isAvailable()); +// check GetPrefSize doesn't load graphic +CPPUNIT_ASSERT_EQUAL(6000L, aGraphic.GetPrefSize().Width()); +CPPUNIT_ASSERT_EQUAL(5000L, aGraphic.GetPrefSize().Height()); +CPPUNIT_ASSERT_EQUAL(false, aGraphic.isAvailable()); + // check GetSizeBytes loads graphic CPPUNIT_ASSERT_EQUAL(false, aGraphic.isAvailable()); CPPUNIT_ASSERT(aGra
[Libreoffice-commits] core.git: vcl/source
vcl/source/gdi/impgraph.cxx |3 +++ 1 file changed, 3 insertions(+) New commits: commit c01e9df2da2e2ab139482563b8a801d0410357c2 Author: Luke Deller AuthorDate: Fri Nov 1 23:21:24 2019 +1100 Commit: Stephan Bergmann CommitDate: Fri Nov 1 18:25:07 2019 +0100 Fix use of uninitialised variable Ensure ImpGraphic::maSwapInfo.mbIsTransparent/mbIsAlpha are initialised in the case where image type detection fails. Change-Id: I103d77760326aa3833dd3730ec65fd53d360271b Reviewed-on: https://gerrit.libreoffice.org/81882 Tested-by: Jenkins Reviewed-by: Stephan Bergmann diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx index 17c371e6d77f..2fbd6795394c 100644 --- a/vcl/source/gdi/impgraph.cxx +++ b/vcl/source/gdi/impgraph.cxx @@ -570,6 +570,9 @@ void ImpGraphic::ImplSetPrepared(bool bAnimated, const Size* pSizeHint) maSwapInfo.maSizePixel = aDescriptor.GetSizePixel(); maSwapInfo.mbIsTransparent = aDescriptor.IsTransparent(); maSwapInfo.mbIsAlpha = aDescriptor.IsAlpha(); +} else { +maSwapInfo.mbIsTransparent = false; +maSwapInfo.mbIsAlpha = false; } maSwapInfo.mnAnimationLoopCount = 0; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: include/vcl vcl/qa vcl/source
include/vcl/graphicfilter.hxx|8 +++ vcl/qa/cppunit/GraphicTest.cxx | 55 ++ vcl/source/filter/graphicfilter2.cxx | 72 --- vcl/source/gdi/impgraph.cxx | 16 --- 4 files changed, 106 insertions(+), 45 deletions(-) New commits: commit ef3dabd1f814d1b005efc5d5144978c1d26a8e73 Author: Luke Deller AuthorDate: Thu Oct 31 01:36:22 2019 +1100 Commit: Miklos Vajna CommitDate: Thu Oct 31 08:51:49 2019 +0100 Fix IsTransparent() for unloaded graphics Fix Graphic::IsAlpha() and Graphic::IsTransparent() for unloaded graphics. This fixes tdf#118036. GraphicDescriptor::Detect(true) is currently used to read the image size from the header of images which are not being fully loaded yet. This change extends GraphicDescriptor to also report whether the image supports transparency or alpha, implemented only for PNG format so far. Change-Id: I1753c0d11491f1dc518e23da8d7b3842945770cb Reviewed-on: https://gerrit.libreoffice.org/81785 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/include/vcl/graphicfilter.hxx b/include/vcl/graphicfilter.hxx index eea2e9ac8b7d..45fe8e261f9e 100644 --- a/include/vcl/graphicfilter.hxx +++ b/include/vcl/graphicfilter.hxx @@ -145,6 +145,8 @@ class VCL_DLLPUBLIC GraphicDescriptor final GraphicFileFormat nFormat; bool const bOwnStream; sal_uInt8 mnNumberOfImageComponents; +boolbIsTransparent; +boolbIsAlpha; voidImpConstruct(); @@ -214,6 +216,12 @@ public: /** @return number of color channels */ sal_uInt8 GetNumberOfImageComponents() const { return mnNumberOfImageComponents; } +/** @return whether image supports transparency */ +bool IsTransparent() const { return bIsTransparent; } + +/** @return whether image supports alpha values for translucent colours */ +bool IsAlpha() const { return bIsAlpha; } + /** @return filter number that is needed by the GraphFilter to read this format */ static OUString GetImportFormatShortName( GraphicFileFormat nFormat ); }; diff --git a/vcl/qa/cppunit/GraphicTest.cxx b/vcl/qa/cppunit/GraphicTest.cxx index af5985b01f99..56e05c8bf3de 100644 --- a/vcl/qa/cppunit/GraphicTest.cxx +++ b/vcl/qa/cppunit/GraphicTest.cxx @@ -28,25 +28,40 @@ class GraphicTest : public CppUnit::TestFixture void testUnloadedGraphic(); void testUnloadedGraphicLoading(); void testUnloadedGraphicWmf(); +void testUnloadedGraphicAlpha(); CPPUNIT_TEST_SUITE(GraphicTest); CPPUNIT_TEST(testUnloadedGraphic); CPPUNIT_TEST(testUnloadedGraphicLoading); CPPUNIT_TEST(testUnloadedGraphicWmf); +CPPUNIT_TEST(testUnloadedGraphicAlpha); CPPUNIT_TEST_SUITE_END(); }; -BitmapEx createBitmap() +BitmapEx createBitmap(bool alpha = false) { -Bitmap aBitmap(Size(100, 100), 24); +Bitmap aBitmap(Size(120, 100), 24); aBitmap.Erase(COL_LIGHTRED); -return BitmapEx(aBitmap); +aBitmap.SetPrefSize(Size(6000, 5000)); +aBitmap.SetPrefMapMode(MapMode(MapUnit::Map100thMM)); + +if (alpha) +{ +sal_uInt8 uAlphaValue = 0x80; +AlphaMask aAlphaMask(Size(120, 100), ); + +return BitmapEx(aBitmap, aAlphaMask); +} +else +{ +return BitmapEx(aBitmap); +} } -void createBitmapAndExportForType(SvStream& rStream, OUString const& sType) +void createBitmapAndExportForType(SvStream& rStream, OUString const& sType, bool alpha) { -BitmapEx aBitmapEx = createBitmap(); +BitmapEx aBitmapEx = createBitmap(alpha); uno::Sequence aFilterData; GraphicFilter& rGraphicFilter = GraphicFilter::GetGraphicFilter(); @@ -56,11 +71,11 @@ void createBitmapAndExportForType(SvStream& rStream, OUString const& sType) rStream.Seek(STREAM_SEEK_TO_BEGIN); } -Graphic makeUnloadedGraphic(OUString const& sType) +Graphic makeUnloadedGraphic(OUString const& sType, bool alpha = false) { SvMemoryStream aStream; GraphicFilter& rGraphicFilter = GraphicFilter::GetGraphicFilter(); -createBitmapAndExportForType(aStream, sType); +createBitmapAndExportForType(aStream, sType, alpha); return rGraphicFilter.ImportUnloadedGraphic(aStream); } @@ -81,10 +96,15 @@ void GraphicTest::testUnloadedGraphic() // check GetSizePixel doesn't load graphic aGraphic = makeUnloadedGraphic("png"); CPPUNIT_ASSERT_EQUAL(false, aGraphic.isAvailable()); -CPPUNIT_ASSERT_EQUAL(100L, aGraphic.GetSizePixel().Width()); +CPPUNIT_ASSERT_EQUAL(120L, aGraphic.GetSizePixel().Width()); CPPUNIT_ASSERT_EQUAL(100L, aGraphic.GetSizePixel().Height()); CPPUNIT_ASSERT_EQUAL(false, aGraphic.isAvailable()); +// check GetPrefSize doesn't load graphic +CPPUNIT_ASSERT_EQUAL(6000L, aGraphic.GetPrefSize().Width()); +CPPUNIT
[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - sw/qa vcl/source
sw/qa/extras/ww8export/data/tdf126708_containsemf.odt |binary sw/qa/extras/ww8export/ww8export3.cxx | 18 ++ vcl/source/filter/graphicfilter2.cxx | 48 -- 3 files changed, 62 insertions(+), 4 deletions(-) New commits: commit bea53649cb9716c48ab2a5518ef2cea76a2cbe3b Author: Luke Deller AuthorDate: Wed Aug 7 00:22:12 2019 +1000 Commit: Tomaž Vajngerl CommitDate: Thu Aug 8 12:52:54 2019 +0200 tdf#126708 Fix EMF image size in CLI .doc export Implement EMF image size detection, to fix this bug where an EMF image gets zero size when exported to .doc format from the command line. Reviewed-on: https://gerrit.libreoffice.org/77031 Tested-by: Jenkins Reviewed-by: Miklos Vajna (cherry picked from commit 6369cab9b1e16275c8700692bb717aec3c42d346) Conflicts: sw/qa/extras/ww8export/ww8export3.cxx Change-Id: If980c5d65d4880150815fd1df9704d9c1b3b93c9 Reviewed-on: https://gerrit.libreoffice.org/77136 Tested-by: Jenkins Tested-by: Xisco Faulí Reviewed-by: Tomaž Vajngerl diff --git a/sw/qa/extras/ww8export/data/tdf126708_containsemf.odt b/sw/qa/extras/ww8export/data/tdf126708_containsemf.odt new file mode 100644 index ..31b0fab8d02d Binary files /dev/null and b/sw/qa/extras/ww8export/data/tdf126708_containsemf.odt differ diff --git a/sw/qa/extras/ww8export/ww8export3.cxx b/sw/qa/extras/ww8export/ww8export3.cxx index fcf5fc44379f..9e8d17d86ac5 100644 --- a/sw/qa/extras/ww8export/ww8export3.cxx +++ b/sw/qa/extras/ww8export/ww8export3.cxx @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -259,6 +260,23 @@ DECLARE_WW8EXPORT_TEST(testTdf118375export, "tdf118375_240degClockwise.doc") CPPUNIT_ASSERT_DOUBLES_EQUAL(1152.0, static_cast(nPosY), 1.0); } +DECLARE_WW8EXPORT_TEST(testTdf126708emf, "tdf126708_containsemf.odt") +{ +auto xShape = getShape(1); +// First check the size of the EMF graphic contained in the shape. +auto xGraphic = getProperty< uno::Reference >( +xShape, "Graphic"); +auto xSize = getProperty(xGraphic, "Size100thMM"); +CPPUNIT_ASSERT_EQUAL(sal_Int32(8501), xSize.Height); +CPPUNIT_ASSERT_EQUAL(sal_Int32(18939), xSize.Width); + +// Now check that the shape itself has a decent size. +// This size varies slightly when round tripping through doc format. +xSize = getProperty(xShape, "Size"); +CPPUNIT_ASSERT(abs(xSize.Height - 7629) <= 6); +CPPUNIT_ASSERT(abs(xSize.Width - 17000) <= 6); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/filter/graphicfilter2.cxx b/vcl/source/filter/graphicfilter2.cxx index 27dd780b57c8..8839807aa962 100644 --- a/vcl/source/filter/graphicfilter2.cxx +++ b/vcl/source/filter/graphicfilter2.cxx @@ -1044,12 +1044,52 @@ bool GraphicDescriptor::ImpDetectWMF( SvStream&, bool ) return bRet; } -bool GraphicDescriptor::ImpDetectEMF( SvStream&, bool ) +bool GraphicDescriptor::ImpDetectEMF( SvStream& rStm, bool bExtendedInfo ) { -bool bRet = aPathExt.startsWith( "emf" ); -if (bRet) -nFormat = GraphicFileFormat::EMF; +sal_uInt32 nRecordType = 0; +bool bRet = false; + +sal_Int32 nStmPos = rStm.Tell(); +rStm.SetEndian( SvStreamEndian::LITTLE ); +rStm.ReadUInt32( nRecordType ); + +if ( nRecordType == 0x0001 ) +{ +sal_uInt32 nHeaderSize = 0; +sal_Int32 nBoundLeft = 0, nBoundTop = 0, nBoundRight = 0, nBoundBottom = 0; +sal_Int32 nFrameLeft = 0, nFrameTop = 0, nFrameRight = 0, nFrameBottom = 0; +sal_uInt32 nSignature = 0; + +rStm.ReadUInt32( nHeaderSize ); +rStm.ReadInt32( nBoundLeft ); +rStm.ReadInt32( nBoundTop ); +rStm.ReadInt32( nBoundRight ); +rStm.ReadInt32( nBoundBottom ); +rStm.ReadInt32( nFrameLeft ); +rStm.ReadInt32( nFrameTop ); +rStm.ReadInt32( nFrameRight ); +rStm.ReadInt32( nFrameBottom ); +rStm.ReadUInt32( nSignature ); + +if ( nSignature == 0x464d4520 ) +{ +nFormat = GraphicFileFormat::EMF; +bRet = true; +if ( bExtendedInfo ) +{ +// size in pixels +aPixSize.setWidth( nBoundRight - nBoundLeft + 1 ); +aPixSize.setHeight( nBoundBottom - nBoundTop + 1 ); + +// size in 0.01mm units +aLogSize.setWidth( nFrameRight - nFrameLeft + 1 ); +aLogSize.setHeight( nFrameBottom - nFrameTop + 1 ); +} +} +} + +rStm.Seek( nStmPos ); return bRet; } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sw/qa vcl/source
sw/qa/extras/ww8export/data/tdf126708_containsemf.odt |binary sw/qa/extras/ww8export/ww8export3.cxx | 18 ++ vcl/source/filter/graphicfilter2.cxx | 48 -- 3 files changed, 62 insertions(+), 4 deletions(-) New commits: commit 6369cab9b1e16275c8700692bb717aec3c42d346 Author: Luke Deller AuthorDate: Wed Aug 7 00:22:12 2019 +1000 Commit: Miklos Vajna CommitDate: Wed Aug 7 16:43:21 2019 +0200 tdf#126708 Fix EMF image size in CLI .doc export Implement EMF image size detection, to fix this bug where an EMF image gets zero size when exported to .doc format from the command line. Change-Id: If980c5d65d4880150815fd1df9704d9c1b3b93c9 Reviewed-on: https://gerrit.libreoffice.org/77031 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/sw/qa/extras/ww8export/data/tdf126708_containsemf.odt b/sw/qa/extras/ww8export/data/tdf126708_containsemf.odt new file mode 100644 index ..31b0fab8d02d Binary files /dev/null and b/sw/qa/extras/ww8export/data/tdf126708_containsemf.odt differ diff --git a/sw/qa/extras/ww8export/ww8export3.cxx b/sw/qa/extras/ww8export/ww8export3.cxx index dfb20c81fc67..a38424cc3ce1 100644 --- a/sw/qa/extras/ww8export/ww8export3.cxx +++ b/sw/qa/extras/ww8export/ww8export3.cxx @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -276,6 +277,23 @@ DECLARE_WW8EXPORT_TEST(testImageCommentAtChar, "image-comment-at-char.doc") getProperty(getRun(xPara, 5), "TextPortionType")); } +DECLARE_WW8EXPORT_TEST(testTdf126708emf, "tdf126708_containsemf.odt") +{ +auto xShape = getShape(1); +// First check the size of the EMF graphic contained in the shape. +auto xGraphic = getProperty< uno::Reference >( +xShape, "Graphic"); +auto xSize = getProperty(xGraphic, "Size100thMM"); +CPPUNIT_ASSERT_EQUAL(sal_Int32(8501), xSize.Height); +CPPUNIT_ASSERT_EQUAL(sal_Int32(18939), xSize.Width); + +// Now check that the shape itself has a decent size. +// This size varies slightly when round tripping through doc format. +xSize = getProperty(xShape, "Size"); +CPPUNIT_ASSERT(abs(xSize.Height - 7629) <= 6); +CPPUNIT_ASSERT(abs(xSize.Width - 17000) <= 6); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/filter/graphicfilter2.cxx b/vcl/source/filter/graphicfilter2.cxx index 27dd780b57c8..8839807aa962 100644 --- a/vcl/source/filter/graphicfilter2.cxx +++ b/vcl/source/filter/graphicfilter2.cxx @@ -1044,12 +1044,52 @@ bool GraphicDescriptor::ImpDetectWMF( SvStream&, bool ) return bRet; } -bool GraphicDescriptor::ImpDetectEMF( SvStream&, bool ) +bool GraphicDescriptor::ImpDetectEMF( SvStream& rStm, bool bExtendedInfo ) { -bool bRet = aPathExt.startsWith( "emf" ); -if (bRet) -nFormat = GraphicFileFormat::EMF; +sal_uInt32 nRecordType = 0; +bool bRet = false; + +sal_Int32 nStmPos = rStm.Tell(); +rStm.SetEndian( SvStreamEndian::LITTLE ); +rStm.ReadUInt32( nRecordType ); + +if ( nRecordType == 0x0001 ) +{ +sal_uInt32 nHeaderSize = 0; +sal_Int32 nBoundLeft = 0, nBoundTop = 0, nBoundRight = 0, nBoundBottom = 0; +sal_Int32 nFrameLeft = 0, nFrameTop = 0, nFrameRight = 0, nFrameBottom = 0; +sal_uInt32 nSignature = 0; + +rStm.ReadUInt32( nHeaderSize ); +rStm.ReadInt32( nBoundLeft ); +rStm.ReadInt32( nBoundTop ); +rStm.ReadInt32( nBoundRight ); +rStm.ReadInt32( nBoundBottom ); +rStm.ReadInt32( nFrameLeft ); +rStm.ReadInt32( nFrameTop ); +rStm.ReadInt32( nFrameRight ); +rStm.ReadInt32( nFrameBottom ); +rStm.ReadUInt32( nSignature ); + +if ( nSignature == 0x464d4520 ) +{ +nFormat = GraphicFileFormat::EMF; +bRet = true; +if ( bExtendedInfo ) +{ +// size in pixels +aPixSize.setWidth( nBoundRight - nBoundLeft + 1 ); +aPixSize.setHeight( nBoundBottom - nBoundTop + 1 ); + +// size in 0.01mm units +aLogSize.setWidth( nFrameRight - nFrameLeft + 1 ); +aLogSize.setHeight( nFrameBottom - nFrameTop + 1 ); +} +} +} + +rStm.Seek( nStmPos ); return bRet; } ___ 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/wrtw8esh.cxx | 40 -- 1 file changed, 1 insertion(+), 39 deletions(-) New commits: commit 58b784119646820f9164b455f065fc91286cb1f4 Author: Luke Deller AuthorDate: Wed Aug 7 00:30:43 2019 +1000 Commit: Noel Grandin CommitDate: Wed Aug 7 09:12:23 2019 +0200 Remove code for GetBlibID unused param rBoundRect commit 60fd81d83a2dbcb64a38910de49f8e2620353702 removed an unused parameter rBoundRect from EscherGraphicProvider::GetBlibID Now remove some code which was used only to provide that parameter, and is no longer needed. Change-Id: If3bc6be8cb4f971ef67a9e31a316c1c495f64beb Reviewed-on: https://gerrit.libreoffice.org/77033 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx index c8d04367c808..919ff1fd46b0 100644 --- a/sw/source/filter/ww8/wrtw8esh.cxx +++ b/sw/source/filter/ww8/wrtw8esh.cxx @@ -1584,16 +1584,6 @@ void SwBasicEscherEx::WriteGrfBullet(const Graphic& rGrf) OString aUniqueId = aGraphicObject.GetUniqueID(); if ( !aUniqueId.isEmpty() ) { -const MapMode aMap100mm( MapUnit::Map100thMM ); -SizeaSize( rGrf.GetPrefSize() ); -if ( MapUnit::MapPixel == rGrf.GetPrefMapMode().GetMapUnit() ) -{ -aSize = Application::GetDefaultDevice()->PixelToLogic(aSize, aMap100mm ); -} -else -{ -aSize = OutputDevice::LogicToLogic( aSize,rGrf.GetPrefMapMode(), aMap100mm ); -} sal_uInt32 nBlibId = mxGlobal->GetBlibID( *(mxGlobal->QueryPictureStream()), aGraphicObject ); if (nBlibId) aPropOpt.AddOpt(ESCHER_Prop_pib, nBlibId, true); @@ -1663,20 +1653,6 @@ sal_Int32 SwBasicEscherEx::WriteGrfFlyFrame(const SwFrameFormat& rFormat, sal_uI if (!aUniqueId.isEmpty()) { -const MapMode aMap100mm( MapUnit::Map100thMM ); -SizeaSize( aGraphic.GetPrefSize() ); - -if ( MapUnit::MapPixel == aGraphic.GetPrefMapMode().GetMapUnit() ) -{ -aSize = Application::GetDefaultDevice()->PixelToLogic( -aSize, aMap100mm ); -} -else -{ -aSize = OutputDevice::LogicToLogic( aSize, -aGraphic.GetPrefMapMode(), aMap100mm ); -} - sal_uInt32 nBlibId = mxGlobal->GetBlibID( *QueryPictureStream(), aGraphicObject); if (nBlibId) aPropOpt.AddOpt(ESCHER_Prop_pib, nBlibId, true); @@ -1886,20 +1862,6 @@ void SwBasicEscherEx::WriteBrushAttr(const SvxBrushItem , OString aUniqueId = pGraphicObject->GetUniqueID(); if (!aUniqueId.isEmpty()) { -const Graphic = pGraphicObject->GetGraphic(); -Size aSize(rGraphic.GetPrefSize()); -const MapMode aMap100mm(MapUnit::Map100thMM); -if (MapUnit::MapPixel == rGraphic.GetPrefMapMode().GetMapUnit()) -{ -aSize = Application::GetDefaultDevice()->PixelToLogic( -aSize, aMap100mm); -} -else -{ -aSize = OutputDevice::LogicToLogic(aSize, -rGraphic.GetPrefMapMode(), aMap100mm); -} - sal_uInt32 nBlibId = mxGlobal->GetBlibID(*QueryPictureStream(), *pGraphicObject); if (nBlibId) rPropOpt.AddOpt(ESCHER_Prop_fillBlip,nBlibId,true); @@ -2945,7 +2907,7 @@ void SwBasicEscherEx::WriteOLEPicture(EscherPropertyContainer , OString aId = aGraphicObject.GetUniqueID(); if (!aId.isEmpty()) { -// SJ: the fourth parameter (VisArea) should be set.. +// SJ: the third parameter (pVisArea) should be set.. sal_uInt32 nBlibId = mxGlobal->GetBlibID( *QueryPictureStream(), aGraphicObject, pVisArea); if (nBlibId) rPropOpt.AddOpt(ESCHER_Prop_pib, nBlibId, true); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/cib_contract57b' - 37 commits - configure.ac download.lst external/curl external/lcms2 external/libxml2 external/libxslt external/mdnsresponder external
| 20 sw/qa/extras/odfimport/data/tdf109080_loext_ns.odt |binary sw/qa/extras/odfimport/data/tdf109080_style_ns.odt |binary sw/qa/extras/odfimport/odfimport.cxx | 31 xmloff/source/text/txtimp.cxx |2 58 files changed, 1011 insertions(+), 3149 deletions(-) New commits: commit 0907998f5b962a524bebf859e3f064e6c259234c Author: Luke Deller AuthorDate: Wed Jul 12 23:56:50 2017 +1000 Commit: Michael Stahl CommitDate: Tue May 7 18:25:08 2019 +0200 tdf#109080 First page header/footer ODF (1/2) The proposal to add / to the ODF standard has not yet been accepted, so meanwhile we should be using an extension namespace for these elements. This first commit (intended for backport) adds support for reading / (cherry picked from commit bff8cd3d52223002263dcb8c09758c4fc753b6e3) Reviewed-on: https://gerrit.libreoffice.org/40227 Reviewed-by: Michael Stahl Tested-by: Jenkins (cherry picked from commit c027764f94a1fc0a367e03b412d3c11d6c10769c) Conflicts: sw/qa/extras/odfimport/odfimport.cxx Change-Id: I616b6a0acaead9d767ae7d119e539b865f3a6774 diff --git a/sw/qa/extras/odfimport/data/tdf109080_loext_ns.odt b/sw/qa/extras/odfimport/data/tdf109080_loext_ns.odt new file mode 100644 index ..ac7b3e272acc Binary files /dev/null and b/sw/qa/extras/odfimport/data/tdf109080_loext_ns.odt differ diff --git a/sw/qa/extras/odfimport/data/tdf109080_style_ns.odt b/sw/qa/extras/odfimport/data/tdf109080_style_ns.odt new file mode 100644 index ..ada290dc5fe1 Binary files /dev/null and b/sw/qa/extras/odfimport/data/tdf109080_style_ns.odt differ diff --git a/sw/qa/extras/odfimport/odfimport.cxx b/sw/qa/extras/odfimport/odfimport.cxx index 92069c00808c..fef7eb109e9b 100644 --- a/sw/qa/extras/odfimport/odfimport.cxx +++ b/sw/qa/extras/odfimport/odfimport.cxx @@ -646,5 +646,36 @@ DECLARE_ODFIMPORT_TEST(testTdf96113, "tdf96113.odt") CPPUNIT_ASSERT_EQUAL(sal_Int32(0x00ff00), getProperty(getShape(1), "BackColor")); } +DECLARE_ODFIMPORT_TEST(testTdf109080_loext_ns, "tdf109080_loext_ns.odt") +{ +// Test we can import and + +CPPUNIT_ASSERT_EQUAL(OUString("This is the first page header"), +parseDump("/root/page[1]/header/txt/text()")); +CPPUNIT_ASSERT_EQUAL(OUString("This is the non-first-page header"), +parseDump("/root/page[2]/header/txt/text()")); + +CPPUNIT_ASSERT_EQUAL(OUString("This is the first page footer"), +parseDump("/root/page[1]/footer/txt/text()")); +CPPUNIT_ASSERT_EQUAL(OUString("This is the non-first-page footer"), +parseDump("/root/page[2]/footer/txt/text()")); +} + +DECLARE_ODFIMPORT_TEST(testTdf109080_style_ns, "tdf109080_style_ns.odt") +{ +// Test we can import and +// (produced by LibreOffice 4.0 - 5.x) + +CPPUNIT_ASSERT_EQUAL(OUString("This is the first page header"), +parseDump("/root/page[1]/header/txt/text()")); +CPPUNIT_ASSERT_EQUAL(OUString("This is the non-first-page header"), +parseDump("/root/page[2]/header/txt/text()")); + +CPPUNIT_ASSERT_EQUAL(OUString("This is the first page footer"), +parseDump("/root/page[1]/footer/txt/text()")); +CPPUNIT_ASSERT_EQUAL(OUString("This is the non-first-page footer"), +parseDump("/root/page[2]/footer/txt/text()")); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx index 08dafafdcbfe..3158e272a58a 100644 --- a/xmloff/source/text/txtimp.cxx +++ b/xmloff/source/text/txtimp.cxx @@ -407,6 +407,8 @@ static const SvXMLTokenMapEntry aTextMasterPageElemTokenMap[] = { XML_NAMESPACE_STYLE, XML_FOOTER, XML_TOK_TEXT_MP_FOOTER }, { XML_NAMESPACE_STYLE, XML_HEADER_LEFT, XML_TOK_TEXT_MP_HEADER_LEFT }, { XML_NAMESPACE_STYLE, XML_FOOTER_LEFT, XML_TOK_TEXT_MP_FOOTER_LEFT }, +{ XML_NAMESPACE_LO_EXT, XML_HEADER_FIRST, XML_TOK_TEXT_MP_HEADER_FIRST }, +{ XML_NAMESPACE_LO_EXT, XML_FOOTER_FIRST, XML_TOK_TEXT_MP_FOOTER_FIRST }, { XML_NAMESPACE_STYLE, XML_HEADER_FIRST, XML_TOK_TEXT_MP_HEADER_FIRST }, { XML_NAMESPACE_STYLE, XML_FOOTER_FIRST, XML_TOK_TEXT_MP_FOOTER_FIRST }, commit 94d7adf2431f3d3f5aef6a0c00f067d5d94aff08 Author: Michael Stahl AuthorDate: Thu May 2 10:59:01 2019 +0200 Commit: Michael Stahl CommitDate: Tue May 7 17:01:29 2019 +0200 libpng: upgrade to release 1.6.37 Fixes CVE-2019-7317. Reviewed-on: https://gerrit.libreoffice.org/71663 Tested-by: Jenkins Revi
[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - sw/qa sw/source
sw/qa/extras/ww8export/data/tdf118412.doc |binary sw/qa/extras/ww8export/ww8export2.cxx | 10 ++ sw/source/filter/ww8/ww8par6.cxx |2 +- 3 files changed, 11 insertions(+), 1 deletion(-) New commits: commit 3fbb1d03110018c1ffe96c01b35b62e9b0742ded Author: Luke Deller Date: Fri Jun 29 00:40:14 2018 +1000 tdf#118412: DOC incorrect bottom page margin Fix a silly typo when determining if the page has a bottom margin Change-Id: I96857951725d00978c43d850d0e1bc64ab61d965 Reviewed-on: https://gerrit.libreoffice.org/56602 Tested-by: Jenkins Reviewed-by: Luke Deller (cherry picked from commit 9f331575ad8d371c95a18e33a245d404e873ca8a) Reviewed-on: https://gerrit.libreoffice.org/57055 Tested-by: Xisco Faulí Reviewed-by: Miklos Vajna diff --git a/sw/qa/extras/ww8export/data/tdf118412.doc b/sw/qa/extras/ww8export/data/tdf118412.doc new file mode 100644 index ..ef9b26cb3af8 Binary files /dev/null and b/sw/qa/extras/ww8export/data/tdf118412.doc differ diff --git a/sw/qa/extras/ww8export/ww8export2.cxx b/sw/qa/extras/ww8export/ww8export2.cxx index aa6879fa139d..6cb358bf81ab 100644 --- a/sw/qa/extras/ww8export/ww8export2.cxx +++ b/sw/qa/extras/ww8export/ww8export2.cxx @@ -870,6 +870,16 @@ DECLARE_WW8EXPORT_TEST(testTdf118133, "tdf118133.docx") CPPUNIT_ASSERT_EQUAL(static_cast(15240), getShape(1)->getSize().Width); } +DECLARE_WW8EXPORT_TEST(testTdf118412, "tdf118412.doc") +{ +/* Check that the first page's bottom margin is 1.251cm (not 2.540cm) */ +OUString sPageStyleName = getProperty(getParagraph(1), "PageStyleName"); +uno::Reference xPageStyle( +getStyles("PageStyles")->getByName(sPageStyleName), uno::UNO_QUERY); +sal_Int32 nBottomMargin = getProperty(xPageStyle, "BottomMargin"); +CPPUNIT_ASSERT_EQUAL(static_cast(1251), nBottomMargin); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx index 227fe8937a0f..3d543b74bc97 100644 --- a/sw/source/filter/ww8/ww8par6.cxx +++ b/sw/source/filter/ww8/ww8par6.cxx @@ -498,7 +498,7 @@ void wwSectionManager::GetPageULData(const wwSection , /* Check whether this section has headers / footers */ sal_uInt16 nHeaderMask = WW8_HEADER_EVEN | WW8_HEADER_ODD; -sal_uInt16 nFooterMask = WW8_HEADER_EVEN | WW8_HEADER_ODD; +sal_uInt16 nFooterMask = WW8_FOOTER_EVEN | WW8_FOOTER_ODD; /* Ignore the presence of a first-page header/footer unless it is enabled */ if( rSection.HasTitlePage() ) { ___ 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 sw/source
sw/qa/extras/ww8export/data/tdf117885.doc |binary sw/qa/extras/ww8export/data/tdf118412.doc |binary sw/qa/extras/ww8export/ww8export2.cxx | 29 + sw/source/filter/ww8/ww8par6.cxx | 16 +++- 4 files changed, 40 insertions(+), 5 deletions(-) New commits: commit 3db1874044c24dadfb2f273d0e57e15bdcada1f5 Author: Luke Deller Date: Thu May 31 23:16:26 2018 +1000 Fix top margin in DOC import for tdf#117885 When calculating the height of the top/bottom margin, we take into account whether the DOC section has a header/footer enabled. If the DOC section contains only a first-page header/footer, and the display of first-page header/footer in this section is not enabled, then we must consider the section to have no header/footer. (Also add a test case using the doc supplied by the reporter in tdf#117885) Change-Id: I8040298a2953b3f3fe8dd80bfd62db2304db938e Reviewed-on: https://gerrit.libreoffice.org/55135 Tested-by: Jenkins Reviewed-by: Miklos Vajna (cherry picked from commit 6c68e52532d45c97a83b2396bd40c98ade9b5bb4) Squashed with fixup commit from https://gerrit.libreoffice.org/56602 for tdf#118412: DOC incorrect bottom page margin Change-Id: I8040298a2953b3f3fe8dd80bfd62db2304db938e Reviewed-on: https://gerrit.libreoffice.org/55466 Reviewed-by: Michael Stahl Tested-by: Michael Stahl diff --git a/sw/qa/extras/ww8export/data/tdf117885.doc b/sw/qa/extras/ww8export/data/tdf117885.doc new file mode 100644 index ..bf8d0ef03d61 Binary files /dev/null and b/sw/qa/extras/ww8export/data/tdf117885.doc differ diff --git a/sw/qa/extras/ww8export/data/tdf118412.doc b/sw/qa/extras/ww8export/data/tdf118412.doc new file mode 100644 index ..ef9b26cb3af8 Binary files /dev/null and b/sw/qa/extras/ww8export/data/tdf118412.doc differ diff --git a/sw/qa/extras/ww8export/ww8export2.cxx b/sw/qa/extras/ww8export/ww8export2.cxx index 0695c309951b..03f55c6b0d78 100644 --- a/sw/qa/extras/ww8export/ww8export2.cxx +++ b/sw/qa/extras/ww8export/ww8export2.cxx @@ -741,6 +741,35 @@ DECLARE_OOXMLEXPORT_TEST( testObjectCrossReference, "object_cross_reference.odt" } } +DECLARE_WW8EXPORT_TEST(testTdf117885, "tdf117885.doc") +{ +xmlDocPtr pXmlDoc = parseLayoutDump(); + +/* Get the vertical position of the paragraph containing the text "Start" */ +sal_Int32 nParaA_Top = getXPath(pXmlDoc, +"/root/page/body/column[1]/body/txt[text()='Start']/infos/bounds", "top" +).toInt32(); + +/* Get the vertical position of the paragraph containing the text "Top B" */ +sal_Int32 nParaB_Top = getXPath(pXmlDoc, +"/root/page/body/column[2]/body/txt[text()='Top B']/infos/bounds", "top" +).toInt32(); + +/* These two paragraphs are supposed to be at the top of the left + * and right columns respectively. Check that they actually line up: */ +CPPUNIT_ASSERT_EQUAL(nParaA_Top, nParaB_Top); +} + +DECLARE_WW8EXPORT_TEST(testTdf118412, "tdf118412.doc") +{ +/* Check that the first page's bottom margin is 1.251cm (not 2.540cm) */ +OUString sPageStyleName = getProperty(getParagraph(1), "PageStyleName"); +uno::Reference xPageStyle( +getStyles("PageStyles")->getByName(sPageStyleName), uno::UNO_QUERY); +sal_Int32 nBottomMargin = getProperty(xPageStyle, "BottomMargin"); +CPPUNIT_ASSERT_EQUAL(static_cast(1251), nBottomMargin); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx index 249597032fa0..22141c52bad0 100644 --- a/sw/source/filter/ww8/ww8par6.cxx +++ b/sw/source/filter/ww8/ww8par6.cxx @@ -532,8 +532,17 @@ void wwSectionManager::GetPageULData(const wwSection , nWWUp += rSection.maSep.dzaGutter; } -rData.bHasHeader = (rSection.maSep.grpfIhdt & -(WW8_HEADER_EVEN | WW8_HEADER_ODD | WW8_HEADER_FIRST)) != 0; +/* Check whether this section has headers / footers */ +sal_uInt16 nHeaderMask = WW8_HEADER_EVEN | WW8_HEADER_ODD; +sal_uInt16 nFooterMask = WW8_FOOTER_EVEN | WW8_FOOTER_ODD; +/* Ignore the presence of a first-page header/footer unless it is enabled */ +if( rSection.HasTitlePage() ) +{ +nHeaderMask |= WW8_HEADER_FIRST; +nFooterMask |= WW8_FOOTER_FIRST; +} +rData.bHasHeader = (rSection.maSep.grpfIhdt & nHeaderMask) != 0; +rData.bHasFooter = (rSection.maSep.grpfIhdt & nFooterMask) != 0; if( rData.bHasHeader ) { @@ -554,9 +563,6 @@ void wwSectionManager::GetPageULData(const wwSection , else // no header -> just use Up as-is rData.nSwUp = std::abs(nWWUp); -rData.bHasFooter = (rSection.maSep.grpfIhdt &
[Libreoffice-commits] core.git: sw/qa sw/source
sw/qa/extras/ww8export/data/tdf118412.doc |binary sw/qa/extras/ww8export/ww8export2.cxx | 10 ++ sw/source/filter/ww8/ww8par6.cxx |2 +- 3 files changed, 11 insertions(+), 1 deletion(-) New commits: commit 9f331575ad8d371c95a18e33a245d404e873ca8a Author: Luke Deller Date: Fri Jun 29 00:40:14 2018 +1000 tdf#118412: DOC incorrect bottom page margin Fix a silly typo when determining if the page has a bottom margin Change-Id: I96857951725d00978c43d850d0e1bc64ab61d965 Reviewed-on: https://gerrit.libreoffice.org/56602 Tested-by: Jenkins Reviewed-by: Luke Deller diff --git a/sw/qa/extras/ww8export/data/tdf118412.doc b/sw/qa/extras/ww8export/data/tdf118412.doc new file mode 100644 index ..ef9b26cb3af8 Binary files /dev/null and b/sw/qa/extras/ww8export/data/tdf118412.doc differ diff --git a/sw/qa/extras/ww8export/ww8export2.cxx b/sw/qa/extras/ww8export/ww8export2.cxx index 83eaac7b9de5..c4d552393899 100644 --- a/sw/qa/extras/ww8export/ww8export2.cxx +++ b/sw/qa/extras/ww8export/ww8export2.cxx @@ -871,6 +871,16 @@ DECLARE_WW8EXPORT_TEST(testTdf118133, "tdf118133.docx") CPPUNIT_ASSERT_EQUAL(static_cast(15240), getShape(1)->getSize().Width); } +DECLARE_WW8EXPORT_TEST(testTdf118412, "tdf118412.doc") +{ +/* Check that the first page's bottom margin is 1.251cm (not 2.540cm) */ +OUString sPageStyleName = getProperty(getParagraph(1), "PageStyleName"); +uno::Reference xPageStyle( +getStyles("PageStyles")->getByName(sPageStyleName), uno::UNO_QUERY); +sal_Int32 nBottomMargin = getProperty(xPageStyle, "BottomMargin"); +CPPUNIT_ASSERT_EQUAL(static_cast(1251), nBottomMargin); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx index 2f81599eb5b6..f53501c2485c 100644 --- a/sw/source/filter/ww8/ww8par6.cxx +++ b/sw/source/filter/ww8/ww8par6.cxx @@ -498,7 +498,7 @@ void wwSectionManager::GetPageULData(const wwSection , /* Check whether this section has headers / footers */ sal_uInt16 nHeaderMask = WW8_HEADER_EVEN | WW8_HEADER_ODD; -sal_uInt16 nFooterMask = WW8_HEADER_EVEN | WW8_HEADER_ODD; +sal_uInt16 nFooterMask = WW8_FOOTER_EVEN | WW8_FOOTER_ODD; /* Ignore the presence of a first-page header/footer unless it is enabled */ if( rSection.HasTitlePage() ) { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - sw/qa sw/source
sw/qa/extras/ww8export/data/tdf117885.doc |binary sw/qa/extras/ww8export/ww8export2.cxx | 19 +++ sw/source/filter/ww8/ww8par6.cxx | 16 +++- 3 files changed, 30 insertions(+), 5 deletions(-) New commits: commit 294725dd76e6c5288d2e96f47c730a94c9b09037 Author: Luke Deller Date: Thu May 31 23:16:26 2018 +1000 Fix top margin in DOC import for tdf#117885 When calculating the height of the top/bottom margin, we take into account whether the DOC section has a header/footer enabled. If the DOC section contains only a first-page header/footer, and the display of first-page header/footer in this section is not enabled, then we must consider the section to have no header/footer. (Also add a test case using the doc supplied by the reporter in tdf#117885) Change-Id: I8040298a2953b3f3fe8dd80bfd62db2304db938e Reviewed-on: https://gerrit.libreoffice.org/55135 Tested-by: Jenkins Reviewed-by: Miklos Vajna (cherry picked from commit 6c68e52532d45c97a83b2396bd40c98ade9b5bb4) Reviewed-on: https://gerrit.libreoffice.org/55465 Tested-by: Jenkins Reviewed-by: Xisco Faulí diff --git a/sw/qa/extras/ww8export/data/tdf117885.doc b/sw/qa/extras/ww8export/data/tdf117885.doc new file mode 100644 index ..bf8d0ef03d61 Binary files /dev/null and b/sw/qa/extras/ww8export/data/tdf117885.doc differ diff --git a/sw/qa/extras/ww8export/ww8export2.cxx b/sw/qa/extras/ww8export/ww8export2.cxx index f7ec720bce99..af3185d5e41b 100644 --- a/sw/qa/extras/ww8export/ww8export2.cxx +++ b/sw/qa/extras/ww8export/ww8export2.cxx @@ -821,6 +821,25 @@ DECLARE_WW8EXPORT_TEST(testTdf117503, "tdf117503.docx") CPPUNIT_ASSERT_EQUAL(2, getPages()); } +DECLARE_WW8EXPORT_TEST(testTdf117885, "tdf117885.doc") +{ +xmlDocPtr pXmlDoc = parseLayoutDump(); + +/* Get the vertical position of the paragraph containing the text "Start" */ +sal_Int32 nParaA_Top = getXPath(pXmlDoc, +"/root/page/body/column[1]/body/txt[text()='Start']/infos/bounds", "top" +).toInt32(); + +/* Get the vertical position of the paragraph containing the text "Top B" */ +sal_Int32 nParaB_Top = getXPath(pXmlDoc, +"/root/page/body/column[2]/body/txt[text()='Top B']/infos/bounds", "top" +).toInt32(); + +/* These two paragraphs are supposed to be at the top of the left + * and right columns respectively. Check that they actually line up: */ +CPPUNIT_ASSERT_EQUAL(nParaA_Top, nParaB_Top); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx index 621a7060b4e7..227fe8937a0f 100644 --- a/sw/source/filter/ww8/ww8par6.cxx +++ b/sw/source/filter/ww8/ww8par6.cxx @@ -496,8 +496,17 @@ void wwSectionManager::GetPageULData(const wwSection , nWWUp += rSection.maSep.dzaGutter; } -rData.bHasHeader = (rSection.maSep.grpfIhdt & -(WW8_HEADER_EVEN | WW8_HEADER_ODD | WW8_HEADER_FIRST)) != 0; +/* Check whether this section has headers / footers */ +sal_uInt16 nHeaderMask = WW8_HEADER_EVEN | WW8_HEADER_ODD; +sal_uInt16 nFooterMask = WW8_HEADER_EVEN | WW8_HEADER_ODD; +/* Ignore the presence of a first-page header/footer unless it is enabled */ +if( rSection.HasTitlePage() ) +{ +nHeaderMask |= WW8_HEADER_FIRST; +nFooterMask |= WW8_FOOTER_FIRST; +} +rData.bHasHeader = (rSection.maSep.grpfIhdt & nHeaderMask) != 0; +rData.bHasFooter = (rSection.maSep.grpfIhdt & nFooterMask) != 0; if( rData.bHasHeader ) { @@ -518,9 +527,6 @@ void wwSectionManager::GetPageULData(const wwSection , else // no header -> just use Up as-is rData.nSwUp = std::abs(nWWUp); -rData.bHasFooter = (rSection.maSep.grpfIhdt & -(WW8_FOOTER_EVEN | WW8_FOOTER_ODD | WW8_FOOTER_FIRST)) != 0; - if( rData.bHasFooter ) { rData.nSwLo = nWWFBot; // footer -> convert ___ 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/ww8export/data/tdf117885.doc |binary sw/qa/extras/ww8export/ww8export2.cxx | 19 +++ sw/source/filter/ww8/ww8par6.cxx | 16 +++- 3 files changed, 30 insertions(+), 5 deletions(-) New commits: commit 6c68e52532d45c97a83b2396bd40c98ade9b5bb4 Author: Luke Deller Date: Thu May 31 23:16:26 2018 +1000 Fix top margin in DOC import for tdf#117885 When calculating the height of the top/bottom margin, we take into account whether the DOC section has a header/footer enabled. If the DOC section contains only a first-page header/footer, and the display of first-page header/footer in this section is not enabled, then we must consider the section to have no header/footer. (Also add a test case using the doc supplied by the reporter in tdf#117885) Change-Id: I8040298a2953b3f3fe8dd80bfd62db2304db938e Reviewed-on: https://gerrit.libreoffice.org/55135 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/sw/qa/extras/ww8export/data/tdf117885.doc b/sw/qa/extras/ww8export/data/tdf117885.doc new file mode 100644 index ..bf8d0ef03d61 Binary files /dev/null and b/sw/qa/extras/ww8export/data/tdf117885.doc differ diff --git a/sw/qa/extras/ww8export/ww8export2.cxx b/sw/qa/extras/ww8export/ww8export2.cxx index f7ec720bce99..af3185d5e41b 100644 --- a/sw/qa/extras/ww8export/ww8export2.cxx +++ b/sw/qa/extras/ww8export/ww8export2.cxx @@ -821,6 +821,25 @@ DECLARE_WW8EXPORT_TEST(testTdf117503, "tdf117503.docx") CPPUNIT_ASSERT_EQUAL(2, getPages()); } +DECLARE_WW8EXPORT_TEST(testTdf117885, "tdf117885.doc") +{ +xmlDocPtr pXmlDoc = parseLayoutDump(); + +/* Get the vertical position of the paragraph containing the text "Start" */ +sal_Int32 nParaA_Top = getXPath(pXmlDoc, +"/root/page/body/column[1]/body/txt[text()='Start']/infos/bounds", "top" +).toInt32(); + +/* Get the vertical position of the paragraph containing the text "Top B" */ +sal_Int32 nParaB_Top = getXPath(pXmlDoc, +"/root/page/body/column[2]/body/txt[text()='Top B']/infos/bounds", "top" +).toInt32(); + +/* These two paragraphs are supposed to be at the top of the left + * and right columns respectively. Check that they actually line up: */ +CPPUNIT_ASSERT_EQUAL(nParaA_Top, nParaB_Top); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx index 621a7060b4e7..227fe8937a0f 100644 --- a/sw/source/filter/ww8/ww8par6.cxx +++ b/sw/source/filter/ww8/ww8par6.cxx @@ -496,8 +496,17 @@ void wwSectionManager::GetPageULData(const wwSection , nWWUp += rSection.maSep.dzaGutter; } -rData.bHasHeader = (rSection.maSep.grpfIhdt & -(WW8_HEADER_EVEN | WW8_HEADER_ODD | WW8_HEADER_FIRST)) != 0; +/* Check whether this section has headers / footers */ +sal_uInt16 nHeaderMask = WW8_HEADER_EVEN | WW8_HEADER_ODD; +sal_uInt16 nFooterMask = WW8_HEADER_EVEN | WW8_HEADER_ODD; +/* Ignore the presence of a first-page header/footer unless it is enabled */ +if( rSection.HasTitlePage() ) +{ +nHeaderMask |= WW8_HEADER_FIRST; +nFooterMask |= WW8_FOOTER_FIRST; +} +rData.bHasHeader = (rSection.maSep.grpfIhdt & nHeaderMask) != 0; +rData.bHasFooter = (rSection.maSep.grpfIhdt & nFooterMask) != 0; if( rData.bHasHeader ) { @@ -518,9 +527,6 @@ void wwSectionManager::GetPageULData(const wwSection , else // no header -> just use Up as-is rData.nSwUp = std::abs(nWWUp); -rData.bHasFooter = (rSection.maSep.grpfIhdt & -(WW8_FOOTER_EVEN | WW8_FOOTER_ODD | WW8_FOOTER_FIRST)) != 0; - if( rData.bHasFooter ) { rData.nSwLo = nWWFBot; // footer -> convert ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3-desktop' - sw/qa sw/source
sw/qa/extras/ooxmlexport/data/tdf107035.docx |binary sw/source/core/unocore/unotext.cxx |4 2 files changed, 4 insertions(+) New commits: commit c51cd09e36e37226c79609899440e8d4458cb7ad Author: Luke Deller <l...@deller.id.au> Date: Mon Mar 5 00:14:28 2018 +1100 tdf#107035 Fix field character style DOCX import Reinstate a call to DontExpandFormat which was removed from appendTextContent in commit 232ad2f2588beff50cb5c1f3b689c581ba317583 This ensures that direct character formatting which ended immediately before the insertion point will not be expanded to cover the inserted content. Reviewed-on: https://gerrit.libreoffice.org/50729 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk> (cherry picked from commit 18cbb8fe699131a234355e1d00fa917fede6ac46) Change-Id: Ie5fa6b5c5acee4f885f9e67535e98801af23661a (cherry picked from commit c1f393d899360e11e25d562d90285895f1e751e9) diff --git a/sw/qa/extras/ooxmlexport/data/tdf107035.docx b/sw/qa/extras/ooxmlexport/data/tdf107035.docx new file mode 100644 index ..a8ab045b61c9 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf107035.docx differ diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx index baf80081d18b..9aa0b591f246 100644 --- a/sw/source/core/unocore/unotext.cxx +++ b/sw/source/core/unocore/unotext.cxx @@ -527,6 +527,10 @@ throw (lang::IllegalArgumentException, uno::RuntimeException, std::exception) aIllegal.Message = "first parameter invalid"; throw aIllegal; } +// Any direct formatting ending at the insert position (xRange) should not +// be expanded to cover the inserted content (xContent) +GetDoc()->DontExpandFormat( *aPam.Start() ); + // first test if the range is at the right position, then call // xContent->attach const SwStartNode* pOwnStartNode = GetStartNode(); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3-desktop' - filter/source include/filter sw/qa sw/source writerfilter/source
filter/source/msfilter/util.cxx |7 ++- include/filter/msfilter/util.hxx |5 + sw/qa/extras/ooxmlexport/ooxmlexport.cxx |2 +- sw/qa/extras/ooxmlexport/ooxmlexport5.cxx| 16 sw/qa/extras/ooxmlexport/ooxmlexport9.cxx| 10 ++ sw/source/core/text/xmldump.cxx |3 ++- writerfilter/source/dmapper/BorderHandler.cxx|2 +- writerfilter/source/dmapper/CellColorHandler.cxx | 10 +- writerfilter/source/dmapper/DomainMapper.cxx |2 +- writerfilter/source/dmapper/TDefTableHandler.cxx |2 +- writerfilter/source/ooxml/OOXMLFactory.cxx |9 + writerfilter/source/ooxml/OOXMLFactory.hxx |1 + writerfilter/source/ooxml/OOXMLPropertySet.cxx | 16 writerfilter/source/ooxml/OOXMLPropertySet.hxx |7 +++ writerfilter/source/ooxml/factoryimpl.py |5 - writerfilter/source/ooxml/model.xml |2 +- writerfilter/source/rtftok/rtfdocumentimpl.cxx |6 -- 17 files changed, 74 insertions(+), 31 deletions(-) New commits: commit e9c69bfa7254106458744bd832b101319ca518d8 Author: Luke Deller <l...@deller.id.au> Date: Thu Mar 8 01:11:40 2018 +1100 tdf#116179 Support reading "auto" colour from docx In docx a colour value is represented as a 6-digit hex RGB value, or alternatively the word "auto" to represent automatic colour. - Add support for reading the value "auto" as COL_AUTO. Previously this would be read as if it were a hex value, stopping at the letter 'u' which is not a valid hex digit, resulting in the colour 0x0A - a very dark blue, which looks close enough to black that it went unnoticed for a long time :-) - Remove code which tried to handle this wrong 0x0A value, including the constant OOXML_COLOR_AUTO, as it is no longer needed and will cause surprises for anyone who really wanted this exact shade of dark blue - Fix unit tests that were checking for 0x0A Reviewed-on: https://gerrit.libreoffice.org/50995 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk> Reviewed-on: https://gerrit.libreoffice.org/51461 Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> (cherry picked from commit 3967aebca94be9ceea3e36b43f7f53589473ad4e) Change-Id: I670341931147ff9341ad6281cd3b53c02b46 (cherry picked from commit ccef956c4f11ac6c0612a0d22845d02743c91039) diff --git a/filter/source/msfilter/util.cxx b/filter/source/msfilter/util.cxx index 607791f96a1f..24603aa4d704 100644 --- a/filter/source/msfilter/util.cxx +++ b/filter/source/msfilter/util.cxx @@ -126,14 +126,11 @@ sal_Unicode bestFitOpenSymbolToMSFont(sal_Unicode cChar, } -OString ConvertColor( const Color , bool bAutoColor ) +OString ConvertColor( const Color ) { OString color( "auto" ); -if (bAutoColor && rColor.GetColor() == OOXML_COLOR_AUTO) -return color; - -if ( rColor.GetColor() != COL_AUTO ) +if ( rColor != COL_AUTO ) { const char pHexDigits[] = "0123456789ABCDEF"; char pBuffer[] = "00"; diff --git a/include/filter/msfilter/util.hxx b/include/filter/msfilter/util.hxx index 8aa01f5be952..66183e35f2b9 100644 --- a/include/filter/msfilter/util.hxx +++ b/include/filter/msfilter/util.hxx @@ -58,15 +58,12 @@ MSFILTER_DLLPUBLIC sal_Unicode bestFitOpenSymbolToMSFont(sal_Unicode cBullet, rtl_TextEncoding& r_ioChrSet, OUString& r_ioFontName); -#define OOXML_COLOR_AUTO 0x0a - /** * Converts tools Color to HTML color (without leading hashmark). * * @param rColor color to convert - * @param bAutoColor if OOXML_COLOR_AUTO should be recognized as an auto color */ -MSFILTER_DLLPUBLIC OString ConvertColor( const Color , bool bAutoColor = false ); +MSFILTER_DLLPUBLIC OString ConvertColor( const Color ); /** Paper size in 1/100 millimeters. */ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index a767a6e5955a..0c2a84620139 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -694,7 +694,7 @@ DECLARE_OOXMLEXPORT_TEST(testNumOverrideLvltext, "num-override-lvltext.docx") CPPUNIT_ASSERT_EQUAL(sal_Int16(2), comphelper::SequenceAsHashMap(xRules->getByIndex(1))["ParentNumbering"].get()); // The paragraph marker's red font color was inherited by the number portion, this was ff. -CPPUNIT_ASSERT_EQUAL(OUString("0a"), parseDump("//Special[@nType='POR_NUMBER']/SwFont", "color")); +CPPUNIT_ASSERT_EQUAL(OUString(""), parseDump("//Special[@nType='POR_NUMBER']/SwFont",
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - filter/source include/filter sw/qa sw/source writerfilter/source
filter/source/msfilter/util.cxx |7 ++- include/filter/msfilter/util.hxx |5 + sw/qa/extras/ooxmlexport/ooxmlexport.cxx |2 +- sw/qa/extras/ooxmlexport/ooxmlexport5.cxx| 16 sw/qa/extras/ooxmlexport/ooxmlexport9.cxx| 10 ++ sw/source/core/text/xmldump.cxx |3 ++- writerfilter/source/dmapper/BorderHandler.cxx|2 +- writerfilter/source/dmapper/CellColorHandler.cxx | 10 +- writerfilter/source/dmapper/DomainMapper.cxx |2 +- writerfilter/source/dmapper/TDefTableHandler.cxx |2 +- writerfilter/source/ooxml/OOXMLFactory.cxx |9 + writerfilter/source/ooxml/OOXMLFactory.hxx |1 + writerfilter/source/ooxml/OOXMLPropertySet.cxx | 16 writerfilter/source/ooxml/OOXMLPropertySet.hxx |7 +++ writerfilter/source/ooxml/factoryimpl.py |5 - writerfilter/source/ooxml/model.xml |2 +- writerfilter/source/rtftok/rtfdocumentimpl.cxx |6 -- 17 files changed, 74 insertions(+), 31 deletions(-) New commits: commit ccef956c4f11ac6c0612a0d22845d02743c91039 Author: Luke Deller <l...@deller.id.au> Date: Thu Mar 8 01:11:40 2018 +1100 tdf#116179 Support reading "auto" colour from docx In docx a colour value is represented as a 6-digit hex RGB value, or alternatively the word "auto" to represent automatic colour. - Add support for reading the value "auto" as COL_AUTO. Previously this would be read as if it were a hex value, stopping at the letter 'u' which is not a valid hex digit, resulting in the colour 0x0A - a very dark blue, which looks close enough to black that it went unnoticed for a long time :-) - Remove code which tried to handle this wrong 0x0A value, including the constant OOXML_COLOR_AUTO, as it is no longer needed and will cause surprises for anyone who really wanted this exact shade of dark blue - Fix unit tests that were checking for 0x0A Reviewed-on: https://gerrit.libreoffice.org/50995 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk> Reviewed-on: https://gerrit.libreoffice.org/51461 Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> (cherry picked from commit 3967aebca94be9ceea3e36b43f7f53589473ad4e) Change-Id: I670341931147ff9341ad6281cd3b53c02b46 diff --git a/filter/source/msfilter/util.cxx b/filter/source/msfilter/util.cxx index 607791f96a1f..24603aa4d704 100644 --- a/filter/source/msfilter/util.cxx +++ b/filter/source/msfilter/util.cxx @@ -126,14 +126,11 @@ sal_Unicode bestFitOpenSymbolToMSFont(sal_Unicode cChar, } -OString ConvertColor( const Color , bool bAutoColor ) +OString ConvertColor( const Color ) { OString color( "auto" ); -if (bAutoColor && rColor.GetColor() == OOXML_COLOR_AUTO) -return color; - -if ( rColor.GetColor() != COL_AUTO ) +if ( rColor != COL_AUTO ) { const char pHexDigits[] = "0123456789ABCDEF"; char pBuffer[] = "00"; diff --git a/include/filter/msfilter/util.hxx b/include/filter/msfilter/util.hxx index 8aa01f5be952..66183e35f2b9 100644 --- a/include/filter/msfilter/util.hxx +++ b/include/filter/msfilter/util.hxx @@ -58,15 +58,12 @@ MSFILTER_DLLPUBLIC sal_Unicode bestFitOpenSymbolToMSFont(sal_Unicode cBullet, rtl_TextEncoding& r_ioChrSet, OUString& r_ioFontName); -#define OOXML_COLOR_AUTO 0x0a - /** * Converts tools Color to HTML color (without leading hashmark). * * @param rColor color to convert - * @param bAutoColor if OOXML_COLOR_AUTO should be recognized as an auto color */ -MSFILTER_DLLPUBLIC OString ConvertColor( const Color , bool bAutoColor = false ); +MSFILTER_DLLPUBLIC OString ConvertColor( const Color ); /** Paper size in 1/100 millimeters. */ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index a767a6e5955a..0c2a84620139 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -694,7 +694,7 @@ DECLARE_OOXMLEXPORT_TEST(testNumOverrideLvltext, "num-override-lvltext.docx") CPPUNIT_ASSERT_EQUAL(sal_Int16(2), comphelper::SequenceAsHashMap(xRules->getByIndex(1))["ParentNumbering"].get()); // The paragraph marker's red font color was inherited by the number portion, this was ff. -CPPUNIT_ASSERT_EQUAL(OUString("0a"), parseDump("//Special[@nType='POR_NUMBER']/SwFont", "color")); +CPPUNIT_ASSERT_EQUAL(OUString(""), parseDump("//Special[@nType='POR_NUMBER']/SwFont", "color")); } DECLARE_OOXMLEXPORT_TEST(testNumOverrideStart, &q
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - sw/qa sw/source
sw/qa/extras/ooxmlexport/data/tdf107035.docx |binary sw/source/core/unocore/unotext.cxx |4 2 files changed, 4 insertions(+) New commits: commit c1f393d899360e11e25d562d90285895f1e751e9 Author: Luke Deller <l...@deller.id.au> Date: Mon Mar 5 00:14:28 2018 +1100 tdf#107035 Fix field character style DOCX import Reinstate a call to DontExpandFormat which was removed from appendTextContent in commit 232ad2f2588beff50cb5c1f3b689c581ba317583 This ensures that direct character formatting which ended immediately before the insertion point will not be expanded to cover the inserted content. Reviewed-on: https://gerrit.libreoffice.org/50729 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk> (cherry picked from commit 18cbb8fe699131a234355e1d00fa917fede6ac46) Change-Id: Ie5fa6b5c5acee4f885f9e67535e98801af23661a diff --git a/sw/qa/extras/ooxmlexport/data/tdf107035.docx b/sw/qa/extras/ooxmlexport/data/tdf107035.docx new file mode 100644 index ..a8ab045b61c9 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf107035.docx differ diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx index 37ec4681d715..17e81aab7abe 100644 --- a/sw/source/core/unocore/unotext.cxx +++ b/sw/source/core/unocore/unotext.cxx @@ -527,6 +527,10 @@ throw (lang::IllegalArgumentException, uno::RuntimeException, std::exception) aIllegal.Message = "first parameter invalid"; throw aIllegal; } +// Any direct formatting ending at the insert position (xRange) should not +// be expanded to cover the inserted content (xContent) +GetDoc()->DontExpandFormat( *aPam.Start() ); + // first test if the range is at the right position, then call // xContent->attach const SwStartNode* pOwnStartNode = GetStartNode(); ___ 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' - filter/source include/filter sw/qa sw/source writerfilter/source
filter/source/msfilter/util.cxx |7 ++- include/filter/msfilter/util.hxx |5 + sw/qa/extras/ooxmlexport/ooxmlexport.cxx |2 +- sw/qa/extras/ooxmlexport/ooxmlexport11.cxx | 14 -- sw/qa/extras/ooxmlexport/ooxmlexport5.cxx| 16 sw/source/core/text/xmldump.cxx |3 ++- writerfilter/source/dmapper/BorderHandler.cxx|2 +- writerfilter/source/dmapper/CellColorHandler.cxx | 10 +- writerfilter/source/dmapper/DomainMapper.cxx |2 +- writerfilter/source/dmapper/TDefTableHandler.cxx |2 +- writerfilter/source/ooxml/OOXMLFactory.cxx |9 + writerfilter/source/ooxml/OOXMLFactory.hxx |1 + writerfilter/source/ooxml/OOXMLPropertySet.cxx | 16 writerfilter/source/ooxml/OOXMLPropertySet.hxx |8 writerfilter/source/ooxml/factoryimpl.py |5 - writerfilter/source/ooxml/model.xml |2 +- writerfilter/source/rtftok/rtfdocumentimpl.cxx |6 -- 17 files changed, 65 insertions(+), 45 deletions(-) New commits: commit 3967aebca94be9ceea3e36b43f7f53589473ad4e Author: Luke Deller <l...@deller.id.au> Date: Thu Mar 8 01:11:40 2018 +1100 tdf#116179 Support reading "auto" colour from docx In docx a colour value is represented as a 6-digit hex RGB value, or alternatively the word "auto" to represent automatic colour. - Add support for reading the value "auto" as COL_AUTO. Previously this would be read as if it were a hex value, stopping at the letter 'u' which is not a valid hex digit, resulting in the colour 0x0A - a very dark blue, which looks close enough to black that it went unnoticed for a long time :-) - Remove code which tried to handle this wrong 0x0A value, including the constant OOXML_COLOR_AUTO, as it is no longer needed and will cause surprises for anyone who really wanted this exact shade of dark blue - Fix unit tests that were checking for 0x0A Change-Id: I670341931147ff9341ad6281cd3b53c02b46 Reviewed-on: https://gerrit.libreoffice.org/50995 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk> Reviewed-on: https://gerrit.libreoffice.org/51461 Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/filter/source/msfilter/util.cxx b/filter/source/msfilter/util.cxx index 9cf01a0929a3..c563b0a54095 100644 --- a/filter/source/msfilter/util.cxx +++ b/filter/source/msfilter/util.cxx @@ -126,14 +126,11 @@ sal_Unicode bestFitOpenSymbolToMSFont(sal_Unicode cChar, } -OString ConvertColor( const Color , bool bAutoColor ) +OString ConvertColor( const Color ) { OString color( "auto" ); -if (bAutoColor && rColor.GetColor() == OOXML_COLOR_AUTO) -return color; - -if ( rColor.GetColor() != COL_AUTO ) +if ( rColor != COL_AUTO ) { const char pHexDigits[] = "0123456789ABCDEF"; char pBuffer[] = "00"; diff --git a/include/filter/msfilter/util.hxx b/include/filter/msfilter/util.hxx index 8895a4181bec..623f1cfe84db 100644 --- a/include/filter/msfilter/util.hxx +++ b/include/filter/msfilter/util.hxx @@ -59,15 +59,12 @@ MSFILTER_DLLPUBLIC sal_Unicode bestFitOpenSymbolToMSFont(sal_Unicode cBullet, rtl_TextEncoding& r_ioChrSet, OUString& r_ioFontName); -#define OOXML_COLOR_AUTO 0x0a - /** * Converts tools Color to HTML color (without leading hashmark). * * @param rColor color to convert - * @param bAutoColor if OOXML_COLOR_AUTO should be recognized as an auto color */ -MSFILTER_DLLPUBLIC OString ConvertColor( const Color , bool bAutoColor = false ); +MSFILTER_DLLPUBLIC OString ConvertColor( const Color ); /** Paper size in 1/100 millimeters. */ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index 536eea8c6d07..ce981644f5e1 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -699,7 +699,7 @@ DECLARE_OOXMLEXPORT_TEST(testNumOverrideLvltext, "num-override-lvltext.docx") CPPUNIT_ASSERT_EQUAL(sal_Int16(2), comphelper::SequenceAsHashMap(xRules->getByIndex(1))["ParentNumbering"].get()); // The paragraph marker's red font color was inherited by the number portion, this was ff. -CPPUNIT_ASSERT_EQUAL(OUString("0a"), parseDump("//Special[@nType='POR_NUMBER']/SwFont", "color")); +CPPUNIT_ASSERT_EQUAL(OUString(""), parseDump("//Special[@nType='POR_NUMBER']/SwFont", "color")); } DECLARE_OOXMLEXPORT_TEST(testNumOverrideStart, "num-override-start.docx") diff --git a/sw/qa/extras/oo
[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/qa sw/source
sw/qa/extras/ooxmlexport/data/tdf107035.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport11.cxx | 24 sw/source/core/unocore/unotext.cxx |4 3 files changed, 28 insertions(+) New commits: commit afe0aa7fde7e4d4f9a928235e41953bf73e2ea6c Author: Luke Deller <l...@deller.id.au> Date: Mon Mar 5 00:14:28 2018 +1100 tdf#107035 Fix field character style DOCX import Reinstate a call to DontExpandFormat which was removed from appendTextContent in commit 232ad2f2588beff50cb5c1f3b689c581ba317583 This ensures that direct character formatting which ended immediately before the insertion point will not be expanded to cover the inserted content. Change-Id: Ie5fa6b5c5acee4f885f9e67535e98801af23661a Reviewed-on: https://gerrit.libreoffice.org/50729 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk> (cherry picked from commit 18cbb8fe699131a234355e1d00fa917fede6ac46) Reviewed-on: https://gerrit.libreoffice.org/50815 Reviewed-by: Bartosz Kosiorek <gan...@poczta.onet.pl> diff --git a/sw/qa/extras/ooxmlexport/data/tdf107035.docx b/sw/qa/extras/ooxmlexport/data/tdf107035.docx new file mode 100644 index ..a8ab045b61c9 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf107035.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx index 35bf52ee25af..52128c0a740d 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx @@ -185,6 +185,30 @@ DECLARE_OOXMLEXPORT_TEST(testTdf113258, "tdf113258.docx") getProperty(xShape->getStart(), "ParaTopMargin")); } +DECLARE_OOXMLEXPORT_TEST(testTdf107035, "tdf107035.docx") +{ +// Select the second run containing the page number field +auto xPgNumRun = getRun(getParagraph(1), 2, "1"); + +// Check that the page number field colour is set to "automatic". +sal_Int32 nPgNumColour = getProperty(xPgNumRun, "CharColor"); +#if 0 +// TODO Enable this once tdf#116179 is fixed +CPPUNIT_ASSERT_EQUAL(sal_Int32(COL_AUTO), nPgNumColour); + +#else +// Meanwhile just check that the page number field colour is different +// from the green text before it: + +// Select the first run containing the green text +auto xTextRun = getRun(getParagraph(1), 1); + +// Check that the page number field colour is different from the green text +CPPUNIT_ASSERT(getProperty(xTextRun, "CharColor") != nPgNumColour); +#endif + +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx index db3d78c9c382..6d01370e5d19 100644 --- a/sw/source/core/unocore/unotext.cxx +++ b/sw/source/core/unocore/unotext.cxx @@ -528,6 +528,10 @@ SwXText::insertTextContent( aIllegal.Message = "first parameter invalid"; throw aIllegal; } +// Any direct formatting ending at the insert position (xRange) should not +// be expanded to cover the inserted content (xContent) +GetDoc()->DontExpandFormat( *aPam.Start() ); + // first test if the range is at the right position, then call // xContent->attach const SwStartNode* pOwnStartNode = GetStartNode(); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: filter/source include/filter sw/qa sw/source writerfilter/source
filter/source/msfilter/util.cxx |5 + include/filter/msfilter/util.hxx |5 + sw/qa/extras/ooxmlexport/ooxmlexport.cxx |2 +- sw/qa/extras/ooxmlexport/ooxmlexport11.cxx | 14 -- sw/qa/extras/ooxmlexport/ooxmlexport5.cxx| 16 sw/source/core/text/xmldump.cxx |3 ++- writerfilter/source/dmapper/BorderHandler.cxx|2 +- writerfilter/source/dmapper/CellColorHandler.cxx | 10 +- writerfilter/source/dmapper/DomainMapper.cxx |2 +- writerfilter/source/dmapper/TDefTableHandler.cxx |2 +- writerfilter/source/ooxml/OOXMLFactory.cxx |9 + writerfilter/source/ooxml/OOXMLFactory.hxx |1 + writerfilter/source/ooxml/OOXMLPropertySet.cxx | 16 writerfilter/source/ooxml/OOXMLPropertySet.hxx |8 writerfilter/source/ooxml/factoryimpl.py |5 - writerfilter/source/ooxml/model.xml |2 +- writerfilter/source/rtftok/rtfdocumentimpl.cxx |6 -- 17 files changed, 64 insertions(+), 44 deletions(-) New commits: commit fe6da2feb57c3d5e355a36f6b8ac09b48412ff39 Author: Luke Deller <l...@deller.id.au> Date: Thu Mar 8 01:11:40 2018 +1100 tdf#116179 Support reading "auto" colour from docx In docx a colour value is represented as a 6-digit hex RGB value, or alternatively the word "auto" to represent automatic colour. - Add support for reading the value "auto" as COL_AUTO. Previously this would be read as if it were a hex value, stopping at the letter 'u' which is not a valid hex digit, resulting in the colour 0x0A - a very dark blue, which looks close enough to black that it went unnoticed for a long time :-) - Remove code which tried to handle this wrong 0x0A value, including the constant OOXML_COLOR_AUTO, as it is no longer needed and will cause surprises for anyone who really wanted this exact shade of dark blue - Fix unit tests that were checking for 0x0A Change-Id: I670341931147ff9341ad6281cd3b53c02b46 Reviewed-on: https://gerrit.libreoffice.org/50995 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk> diff --git a/filter/source/msfilter/util.cxx b/filter/source/msfilter/util.cxx index cdb885bd9449..fec841f2d34f 100644 --- a/filter/source/msfilter/util.cxx +++ b/filter/source/msfilter/util.cxx @@ -126,13 +126,10 @@ sal_Unicode bestFitOpenSymbolToMSFont(sal_Unicode cChar, } -OString ConvertColor( const Color & rColor, bool bAutoColor ) +OString ConvertColor( const Color ) { OString color( "auto" ); -if (bAutoColor && rColor == OOXML_COLOR_AUTO) -return color; - if ( rColor != COL_AUTO ) { const char pHexDigits[] = "0123456789ABCDEF"; diff --git a/include/filter/msfilter/util.hxx b/include/filter/msfilter/util.hxx index 50252fc6191a..6718dffc9299 100644 --- a/include/filter/msfilter/util.hxx +++ b/include/filter/msfilter/util.hxx @@ -56,15 +56,12 @@ MSFILTER_DLLPUBLIC sal_Unicode bestFitOpenSymbolToMSFont(sal_Unicode cBullet, rtl_TextEncoding& r_ioChrSet, OUString& r_ioFontName); -#define OOXML_COLOR_AUTO 0x0a - /** * Converts tools Color to HTML color (without leading hashmark). * * @param rColor color to convert - * @param bAutoColor if OOXML_COLOR_AUTO should be recognized as an auto color */ -MSFILTER_DLLPUBLIC OString ConvertColor( const Color , bool bAutoColor = false ); +MSFILTER_DLLPUBLIC OString ConvertColor( const Color ); /** Paper size in 1/100 millimeters. */ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index b7acdffbdc16..bc831c024ec1 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -715,7 +715,7 @@ DECLARE_OOXMLEXPORT_TEST(testNumOverrideLvltext, "num-override-lvltext.docx") CPPUNIT_ASSERT_EQUAL(sal_Int16(2), comphelper::SequenceAsHashMap(xRules->getByIndex(1))["ParentNumbering"].get()); // The paragraph marker's red font color was inherited by the number portion, this was ff. -CPPUNIT_ASSERT_EQUAL(OUString("0a"), parseDump("//Special[@nType='POR_NUMBER']/SwFont", "color")); +CPPUNIT_ASSERT_EQUAL(OUString(""), parseDump("//Special[@nType='POR_NUMBER']/SwFont", "color")); } DECLARE_OOXMLEXPORT_TEST(testNumOverrideStart, "num-override-start.docx") diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx index 813b0c3c4f3c..4fdc51170d49 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cx
[Libreoffice-commits] core.git: sw/qa sw/source
sw/qa/extras/ooxmlexport/data/tdf107035.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport11.cxx | 24 sw/source/core/unocore/unotext.cxx |4 3 files changed, 28 insertions(+) New commits: commit 18cbb8fe699131a234355e1d00fa917fede6ac46 Author: Luke Deller <l...@deller.id.au> Date: Mon Mar 5 00:14:28 2018 +1100 tdf#107035 Fix field character style DOCX import Reinstate a call to DontExpandFormat which was removed from appendTextContent in commit 232ad2f2588beff50cb5c1f3b689c581ba317583 This ensures that direct character formatting which ended immediately before the insertion point will not be expanded to cover the inserted content. Change-Id: Ie5fa6b5c5acee4f885f9e67535e98801af23661a Reviewed-on: https://gerrit.libreoffice.org/50729 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk> diff --git a/sw/qa/extras/ooxmlexport/data/tdf107035.docx b/sw/qa/extras/ooxmlexport/data/tdf107035.docx new file mode 100644 index ..a8ab045b61c9 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf107035.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx index 4960c87bd9d0..ebc3d81d9f4a 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx @@ -263,6 +263,30 @@ DECLARE_OOXMLEXPORT_TEST(testTdf113258, "tdf113258.docx") getProperty(xShape->getStart(), "ParaTopMargin")); } +DECLARE_OOXMLEXPORT_TEST(testTdf107035, "tdf107035.docx") +{ +// Select the second run containing the page number field +auto xPgNumRun = getRun(getParagraph(1), 2, "1"); + +// Check that the page number field colour is set to "automatic". +sal_Int32 nPgNumColour = getProperty(xPgNumRun, "CharColor"); +#if 0 +// TODO Enable this once tdf#116179 is fixed +CPPUNIT_ASSERT_EQUAL(sal_Int32(COL_AUTO), nPgNumColour); + +#else +// Meanwhile just check that the page number field colour is different +// from the green text before it: + +// Select the first run containing the green text +auto xTextRun = getRun(getParagraph(1), 1); + +// Check that the page number field colour is different from the green text +CPPUNIT_ASSERT(getProperty(xTextRun, "CharColor") != nPgNumColour); +#endif + +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx index db3d78c9c382..6d01370e5d19 100644 --- a/sw/source/core/unocore/unotext.cxx +++ b/sw/source/core/unocore/unotext.cxx @@ -528,6 +528,10 @@ SwXText::insertTextContent( aIllegal.Message = "first parameter invalid"; throw aIllegal; } +// Any direct formatting ending at the insert position (xRange) should not +// be expanded to cover the inserted content (xContent) +GetDoc()->DontExpandFormat( *aPam.Start() ); + // first test if the range is at the right position, then call // xContent->attach const SwStartNode* pOwnStartNode = GetStartNode(); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/cib_contract561' - sw/qa xmloff/source
sw/qa/extras/odfimport/data/tdf109080_loext_ns.odt |binary sw/qa/extras/odfimport/data/tdf109080_style_ns.odt |binary sw/qa/extras/odfimport/odfimport.cxx | 31 + xmloff/source/text/txtimp.cxx |2 + 4 files changed, 33 insertions(+) New commits: commit 25c32884dfc537e328375aaad6261b72890ee778 Author: Luke Deller <l...@deller.id.au> Date: Wed Jul 12 23:56:50 2017 +1000 tdf#109080 First page header/footer ODF (1/2) The proposal to add / to the ODF standard has not yet been accepted, so meanwhile we should be using an extension namespace for these elements. This first commit (intended for backport) adds support for reading / Change-Id: I616b6a0acaead9d767ae7d119e539b865f3a6774 (cherry picked from commit bff8cd3d52223002263dcb8c09758c4fc753b6e3) Reviewed-on: https://gerrit.libreoffice.org/40227 Reviewed-by: Michael Stahl <mst...@redhat.com> Tested-by: Jenkins <c...@libreoffice.org> (cherry picked from commit c027764f94a1fc0a367e03b412d3c11d6c10769c) diff --git a/sw/qa/extras/odfimport/data/tdf109080_loext_ns.odt b/sw/qa/extras/odfimport/data/tdf109080_loext_ns.odt new file mode 100644 index ..ac7b3e272acc Binary files /dev/null and b/sw/qa/extras/odfimport/data/tdf109080_loext_ns.odt differ diff --git a/sw/qa/extras/odfimport/data/tdf109080_style_ns.odt b/sw/qa/extras/odfimport/data/tdf109080_style_ns.odt new file mode 100644 index ..ada290dc5fe1 Binary files /dev/null and b/sw/qa/extras/odfimport/data/tdf109080_style_ns.odt differ diff --git a/sw/qa/extras/odfimport/odfimport.cxx b/sw/qa/extras/odfimport/odfimport.cxx index 5c60935174b2..3307d793f27d 100644 --- a/sw/qa/extras/odfimport/odfimport.cxx +++ b/sw/qa/extras/odfimport/odfimport.cxx @@ -621,5 +621,36 @@ DECLARE_ODFIMPORT_TEST(testTdf96113, "tdf96113.odt") #endif +DECLARE_ODFIMPORT_TEST(testTdf109080_loext_ns, "tdf109080_loext_ns.odt") +{ +// Test we can import and + +CPPUNIT_ASSERT_EQUAL(OUString("This is the first page header"), +parseDump("/root/page[1]/header/txt/text()")); +CPPUNIT_ASSERT_EQUAL(OUString("This is the non-first-page header"), +parseDump("/root/page[2]/header/txt/text()")); + +CPPUNIT_ASSERT_EQUAL(OUString("This is the first page footer"), +parseDump("/root/page[1]/footer/txt/text()")); +CPPUNIT_ASSERT_EQUAL(OUString("This is the non-first-page footer"), +parseDump("/root/page[2]/footer/txt/text()")); +} + +DECLARE_ODFIMPORT_TEST(testTdf109080_style_ns, "tdf109080_style_ns.odt") +{ +// Test we can import and +// (produced by LibreOffice 4.0 - 5.x) + +CPPUNIT_ASSERT_EQUAL(OUString("This is the first page header"), +parseDump("/root/page[1]/header/txt/text()")); +CPPUNIT_ASSERT_EQUAL(OUString("This is the non-first-page header"), +parseDump("/root/page[2]/header/txt/text()")); + +CPPUNIT_ASSERT_EQUAL(OUString("This is the first page footer"), +parseDump("/root/page[1]/footer/txt/text()")); +CPPUNIT_ASSERT_EQUAL(OUString("This is the non-first-page footer"), +parseDump("/root/page[2]/footer/txt/text()")); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx index eb87ec39cdc8..97bfa7ad1f0b 100644 --- a/xmloff/source/text/txtimp.cxx +++ b/xmloff/source/text/txtimp.cxx @@ -408,6 +408,8 @@ static const SvXMLTokenMapEntry aTextMasterPageElemTokenMap[] = { XML_NAMESPACE_STYLE, XML_FOOTER, XML_TOK_TEXT_MP_FOOTER }, { XML_NAMESPACE_STYLE, XML_HEADER_LEFT, XML_TOK_TEXT_MP_HEADER_LEFT }, { XML_NAMESPACE_STYLE, XML_FOOTER_LEFT, XML_TOK_TEXT_MP_FOOTER_LEFT }, +{ XML_NAMESPACE_LO_EXT, XML_HEADER_FIRST, XML_TOK_TEXT_MP_HEADER_FIRST }, +{ XML_NAMESPACE_LO_EXT, XML_FOOTER_FIRST, XML_TOK_TEXT_MP_FOOTER_FIRST }, { XML_NAMESPACE_STYLE, XML_HEADER_FIRST, XML_TOK_TEXT_MP_HEADER_FIRST }, { XML_NAMESPACE_STYLE, XML_FOOTER_FIRST, XML_TOK_TEXT_MP_FOOTER_FIRST }, ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/cib/libreoffice-5-2' - sw/qa xmloff/source
sw/qa/extras/odfimport/data/tdf109080_loext_ns.odt |binary sw/qa/extras/odfimport/data/tdf109080_style_ns.odt |binary sw/qa/extras/odfimport/odfimport.cxx | 31 + xmloff/source/text/txtimp.cxx |2 + 4 files changed, 33 insertions(+) New commits: commit 634f25d8952d7025564f5da0a1872db81c4fe2db Author: Luke Deller <l...@deller.id.au> Date: Wed Jul 12 23:56:50 2017 +1000 tdf#109080 First page header/footer ODF (1/2) The proposal to add / to the ODF standard has not yet been accepted, so meanwhile we should be using an extension namespace for these elements. This first commit (intended for backport) adds support for reading / (cherry picked from commit bff8cd3d52223002263dcb8c09758c4fc753b6e3) Reviewed-on: https://gerrit.libreoffice.org/40227 Reviewed-by: Michael Stahl <mst...@redhat.com> Tested-by: Jenkins <c...@libreoffice.org> (cherry picked from commit c027764f94a1fc0a367e03b412d3c11d6c10769c) Conflicts: sw/qa/extras/odfimport/odfimport.cxx Change-Id: I616b6a0acaead9d767ae7d119e539b865f3a6774 diff --git a/sw/qa/extras/odfimport/data/tdf109080_loext_ns.odt b/sw/qa/extras/odfimport/data/tdf109080_loext_ns.odt new file mode 100644 index ..ac7b3e272acc Binary files /dev/null and b/sw/qa/extras/odfimport/data/tdf109080_loext_ns.odt differ diff --git a/sw/qa/extras/odfimport/data/tdf109080_style_ns.odt b/sw/qa/extras/odfimport/data/tdf109080_style_ns.odt new file mode 100644 index ..ada290dc5fe1 Binary files /dev/null and b/sw/qa/extras/odfimport/data/tdf109080_style_ns.odt differ diff --git a/sw/qa/extras/odfimport/odfimport.cxx b/sw/qa/extras/odfimport/odfimport.cxx index 92069c00808c..fef7eb109e9b 100644 --- a/sw/qa/extras/odfimport/odfimport.cxx +++ b/sw/qa/extras/odfimport/odfimport.cxx @@ -646,5 +646,36 @@ DECLARE_ODFIMPORT_TEST(testTdf96113, "tdf96113.odt") CPPUNIT_ASSERT_EQUAL(sal_Int32(0x00ff00), getProperty(getShape(1), "BackColor")); } +DECLARE_ODFIMPORT_TEST(testTdf109080_loext_ns, "tdf109080_loext_ns.odt") +{ +// Test we can import and + +CPPUNIT_ASSERT_EQUAL(OUString("This is the first page header"), +parseDump("/root/page[1]/header/txt/text()")); +CPPUNIT_ASSERT_EQUAL(OUString("This is the non-first-page header"), +parseDump("/root/page[2]/header/txt/text()")); + +CPPUNIT_ASSERT_EQUAL(OUString("This is the first page footer"), +parseDump("/root/page[1]/footer/txt/text()")); +CPPUNIT_ASSERT_EQUAL(OUString("This is the non-first-page footer"), +parseDump("/root/page[2]/footer/txt/text()")); +} + +DECLARE_ODFIMPORT_TEST(testTdf109080_style_ns, "tdf109080_style_ns.odt") +{ +// Test we can import and +// (produced by LibreOffice 4.0 - 5.x) + +CPPUNIT_ASSERT_EQUAL(OUString("This is the first page header"), +parseDump("/root/page[1]/header/txt/text()")); +CPPUNIT_ASSERT_EQUAL(OUString("This is the non-first-page header"), +parseDump("/root/page[2]/header/txt/text()")); + +CPPUNIT_ASSERT_EQUAL(OUString("This is the first page footer"), +parseDump("/root/page[1]/footer/txt/text()")); +CPPUNIT_ASSERT_EQUAL(OUString("This is the non-first-page footer"), +parseDump("/root/page[2]/footer/txt/text()")); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx index 08dafafdcbfe..3158e272a58a 100644 --- a/xmloff/source/text/txtimp.cxx +++ b/xmloff/source/text/txtimp.cxx @@ -407,6 +407,8 @@ static const SvXMLTokenMapEntry aTextMasterPageElemTokenMap[] = { XML_NAMESPACE_STYLE, XML_FOOTER, XML_TOK_TEXT_MP_FOOTER }, { XML_NAMESPACE_STYLE, XML_HEADER_LEFT, XML_TOK_TEXT_MP_HEADER_LEFT }, { XML_NAMESPACE_STYLE, XML_FOOTER_LEFT, XML_TOK_TEXT_MP_FOOTER_LEFT }, +{ XML_NAMESPACE_LO_EXT, XML_HEADER_FIRST, XML_TOK_TEXT_MP_HEADER_FIRST }, +{ XML_NAMESPACE_LO_EXT, XML_FOOTER_FIRST, XML_TOK_TEXT_MP_FOOTER_FIRST }, { XML_NAMESPACE_STYLE, XML_HEADER_FIRST, XML_TOK_TEXT_MP_HEADER_FIRST }, { XML_NAMESPACE_STYLE, XML_FOOTER_FIRST, XML_TOK_TEXT_MP_FOOTER_FIRST }, ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/cib/libreoffice-5-1' - sw/qa xmloff/source
sw/qa/extras/odfimport/data/tdf109080_loext_ns.odt |binary sw/qa/extras/odfimport/data/tdf109080_style_ns.odt |binary sw/qa/extras/odfimport/odfimport.cxx | 31 + xmloff/source/text/txtimp.cxx |2 + 4 files changed, 33 insertions(+) New commits: commit 44293c426fdeefccf0bf59ccac8f46443793b99c Author: Luke Deller <l...@deller.id.au> Date: Wed Jul 12 23:56:50 2017 +1000 tdf#109080 First page header/footer ODF (1/2) The proposal to add / to the ODF standard has not yet been accepted, so meanwhile we should be using an extension namespace for these elements. This first commit (intended for backport) adds support for reading / (cherry picked from commit bff8cd3d52223002263dcb8c09758c4fc753b6e3) Reviewed-on: https://gerrit.libreoffice.org/40227 Reviewed-by: Michael Stahl <mst...@redhat.com> Tested-by: Jenkins <c...@libreoffice.org> (cherry picked from commit c027764f94a1fc0a367e03b412d3c11d6c10769c) Conflicts: sw/qa/extras/odfimport/odfimport.cxx Change-Id: I616b6a0acaead9d767ae7d119e539b865f3a6774 diff --git a/sw/qa/extras/odfimport/data/tdf109080_loext_ns.odt b/sw/qa/extras/odfimport/data/tdf109080_loext_ns.odt new file mode 100644 index ..ac7b3e272acc Binary files /dev/null and b/sw/qa/extras/odfimport/data/tdf109080_loext_ns.odt differ diff --git a/sw/qa/extras/odfimport/data/tdf109080_style_ns.odt b/sw/qa/extras/odfimport/data/tdf109080_style_ns.odt new file mode 100644 index ..ada290dc5fe1 Binary files /dev/null and b/sw/qa/extras/odfimport/data/tdf109080_style_ns.odt differ diff --git a/sw/qa/extras/odfimport/odfimport.cxx b/sw/qa/extras/odfimport/odfimport.cxx index 908d17d2fd13..8373486b41bf 100644 --- a/sw/qa/extras/odfimport/odfimport.cxx +++ b/sw/qa/extras/odfimport/odfimport.cxx @@ -646,5 +646,36 @@ DECLARE_ODFIMPORT_TEST(testTdf96113, "tdf96113.odt") CPPUNIT_ASSERT_EQUAL(sal_Int32(0x00ff00), getProperty(getShape(1), "BackColor")); } +DECLARE_ODFIMPORT_TEST(testTdf109080_loext_ns, "tdf109080_loext_ns.odt") +{ +// Test we can import and + +CPPUNIT_ASSERT_EQUAL(OUString("This is the first page header"), +parseDump("/root/page[1]/header/txt/text()")); +CPPUNIT_ASSERT_EQUAL(OUString("This is the non-first-page header"), +parseDump("/root/page[2]/header/txt/text()")); + +CPPUNIT_ASSERT_EQUAL(OUString("This is the first page footer"), +parseDump("/root/page[1]/footer/txt/text()")); +CPPUNIT_ASSERT_EQUAL(OUString("This is the non-first-page footer"), +parseDump("/root/page[2]/footer/txt/text()")); +} + +DECLARE_ODFIMPORT_TEST(testTdf109080_style_ns, "tdf109080_style_ns.odt") +{ +// Test we can import and +// (produced by LibreOffice 4.0 - 5.x) + +CPPUNIT_ASSERT_EQUAL(OUString("This is the first page header"), +parseDump("/root/page[1]/header/txt/text()")); +CPPUNIT_ASSERT_EQUAL(OUString("This is the non-first-page header"), +parseDump("/root/page[2]/header/txt/text()")); + +CPPUNIT_ASSERT_EQUAL(OUString("This is the first page footer"), +parseDump("/root/page[1]/footer/txt/text()")); +CPPUNIT_ASSERT_EQUAL(OUString("This is the non-first-page footer"), +parseDump("/root/page[2]/footer/txt/text()")); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx index 5b740f1b6717..f08161d4a167 100644 --- a/xmloff/source/text/txtimp.cxx +++ b/xmloff/source/text/txtimp.cxx @@ -409,6 +409,8 @@ static const SvXMLTokenMapEntry aTextMasterPageElemTokenMap[] = { XML_NAMESPACE_STYLE, XML_FOOTER, XML_TOK_TEXT_MP_FOOTER }, { XML_NAMESPACE_STYLE, XML_HEADER_LEFT, XML_TOK_TEXT_MP_HEADER_LEFT }, { XML_NAMESPACE_STYLE, XML_FOOTER_LEFT, XML_TOK_TEXT_MP_FOOTER_LEFT }, +{ XML_NAMESPACE_LO_EXT, XML_HEADER_FIRST, XML_TOK_TEXT_MP_HEADER_FIRST }, +{ XML_NAMESPACE_LO_EXT, XML_FOOTER_FIRST, XML_TOK_TEXT_MP_FOOTER_FIRST }, { XML_NAMESPACE_STYLE, XML_HEADER_FIRST, XML_TOK_TEXT_MP_HEADER_FIRST }, { XML_NAMESPACE_STYLE, XML_FOOTER_FIRST, XML_TOK_TEXT_MP_FOOTER_FIRST }, ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/cib/libreoffice-5-0' - sw/qa xmloff/source
sw/qa/extras/odfimport/data/tdf109080_loext_ns.odt |binary sw/qa/extras/odfimport/data/tdf109080_style_ns.odt |binary sw/qa/extras/odfimport/odfimport.cxx | 31 + xmloff/source/text/txtimp.cxx |2 + 4 files changed, 33 insertions(+) New commits: commit aa54ca7953ea2f2d1a93267729331dcddd8a1798 Author: Luke Deller <l...@deller.id.au> Date: Wed Jul 12 23:56:50 2017 +1000 tdf#109080 First page header/footer ODF (1/2) The proposal to add / to the ODF standard has not yet been accepted, so meanwhile we should be using an extension namespace for these elements. This first commit (intended for backport) adds support for reading / Change-Id: I616b6a0acaead9d767ae7d119e539b865f3a6774 (cherry picked from commit bff8cd3d52223002263dcb8c09758c4fc753b6e3) Reviewed-on: https://gerrit.libreoffice.org/40227 Reviewed-by: Michael Stahl <mst...@redhat.com> Tested-by: Jenkins <c...@libreoffice.org> (cherry picked from commit c027764f94a1fc0a367e03b412d3c11d6c10769c) diff --git a/sw/qa/extras/odfimport/data/tdf109080_loext_ns.odt b/sw/qa/extras/odfimport/data/tdf109080_loext_ns.odt new file mode 100644 index ..ac7b3e272acc Binary files /dev/null and b/sw/qa/extras/odfimport/data/tdf109080_loext_ns.odt differ diff --git a/sw/qa/extras/odfimport/data/tdf109080_style_ns.odt b/sw/qa/extras/odfimport/data/tdf109080_style_ns.odt new file mode 100644 index ..ada290dc5fe1 Binary files /dev/null and b/sw/qa/extras/odfimport/data/tdf109080_style_ns.odt differ diff --git a/sw/qa/extras/odfimport/odfimport.cxx b/sw/qa/extras/odfimport/odfimport.cxx index 5c60935174b2..3307d793f27d 100644 --- a/sw/qa/extras/odfimport/odfimport.cxx +++ b/sw/qa/extras/odfimport/odfimport.cxx @@ -621,5 +621,36 @@ DECLARE_ODFIMPORT_TEST(testTdf96113, "tdf96113.odt") #endif +DECLARE_ODFIMPORT_TEST(testTdf109080_loext_ns, "tdf109080_loext_ns.odt") +{ +// Test we can import and + +CPPUNIT_ASSERT_EQUAL(OUString("This is the first page header"), +parseDump("/root/page[1]/header/txt/text()")); +CPPUNIT_ASSERT_EQUAL(OUString("This is the non-first-page header"), +parseDump("/root/page[2]/header/txt/text()")); + +CPPUNIT_ASSERT_EQUAL(OUString("This is the first page footer"), +parseDump("/root/page[1]/footer/txt/text()")); +CPPUNIT_ASSERT_EQUAL(OUString("This is the non-first-page footer"), +parseDump("/root/page[2]/footer/txt/text()")); +} + +DECLARE_ODFIMPORT_TEST(testTdf109080_style_ns, "tdf109080_style_ns.odt") +{ +// Test we can import and +// (produced by LibreOffice 4.0 - 5.x) + +CPPUNIT_ASSERT_EQUAL(OUString("This is the first page header"), +parseDump("/root/page[1]/header/txt/text()")); +CPPUNIT_ASSERT_EQUAL(OUString("This is the non-first-page header"), +parseDump("/root/page[2]/header/txt/text()")); + +CPPUNIT_ASSERT_EQUAL(OUString("This is the first page footer"), +parseDump("/root/page[1]/footer/txt/text()")); +CPPUNIT_ASSERT_EQUAL(OUString("This is the non-first-page footer"), +parseDump("/root/page[2]/footer/txt/text()")); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx index eb87ec39cdc8..97bfa7ad1f0b 100644 --- a/xmloff/source/text/txtimp.cxx +++ b/xmloff/source/text/txtimp.cxx @@ -408,6 +408,8 @@ static const SvXMLTokenMapEntry aTextMasterPageElemTokenMap[] = { XML_NAMESPACE_STYLE, XML_FOOTER, XML_TOK_TEXT_MP_FOOTER }, { XML_NAMESPACE_STYLE, XML_HEADER_LEFT, XML_TOK_TEXT_MP_HEADER_LEFT }, { XML_NAMESPACE_STYLE, XML_FOOTER_LEFT, XML_TOK_TEXT_MP_FOOTER_LEFT }, +{ XML_NAMESPACE_LO_EXT, XML_HEADER_FIRST, XML_TOK_TEXT_MP_HEADER_FIRST }, +{ XML_NAMESPACE_LO_EXT, XML_FOOTER_FIRST, XML_TOK_TEXT_MP_FOOTER_FIRST }, { XML_NAMESPACE_STYLE, XML_HEADER_FIRST, XML_TOK_TEXT_MP_HEADER_FIRST }, { XML_NAMESPACE_STYLE, XML_FOOTER_FIRST, XML_TOK_TEXT_MP_FOOTER_FIRST }, ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'private/swe/libreoffice-5-2+backports' - sw/qa xmloff/source
sw/qa/extras/odfimport/data/tdf109080_loext_ns.odt |binary sw/qa/extras/odfimport/data/tdf109080_style_ns.odt |binary sw/qa/extras/odfimport/odfimport.cxx | 31 + xmloff/source/text/txtimp.cxx |2 + 4 files changed, 33 insertions(+) New commits: commit e494191f5c4933f6a486697c0fa7522d28569939 Author: Luke Deller <l...@deller.id.au> Date: Wed Jul 12 23:56:50 2017 +1000 tdf#109080 First page header/footer ODF (1/2) The proposal to add / to the ODF standard has not yet been accepted, so meanwhile we should be using an extension namespace for these elements. This first commit (intended for backport) adds support for reading / Change-Id: I616b6a0acaead9d767ae7d119e539b865f3a6774 (cherry picked from commit bff8cd3d52223002263dcb8c09758c4fc753b6e3) Reviewed-on: https://gerrit.libreoffice.org/40227 Reviewed-by: Michael Stahl <mst...@redhat.com> Tested-by: Jenkins <c...@libreoffice.org> (cherry picked from commit c027764f94a1fc0a367e03b412d3c11d6c10769c) diff --git a/sw/qa/extras/odfimport/data/tdf109080_loext_ns.odt b/sw/qa/extras/odfimport/data/tdf109080_loext_ns.odt new file mode 100644 index ..ac7b3e272acc Binary files /dev/null and b/sw/qa/extras/odfimport/data/tdf109080_loext_ns.odt differ diff --git a/sw/qa/extras/odfimport/data/tdf109080_style_ns.odt b/sw/qa/extras/odfimport/data/tdf109080_style_ns.odt new file mode 100644 index ..ada290dc5fe1 Binary files /dev/null and b/sw/qa/extras/odfimport/data/tdf109080_style_ns.odt differ diff --git a/sw/qa/extras/odfimport/odfimport.cxx b/sw/qa/extras/odfimport/odfimport.cxx index 8b21e935c6ea..5694173bd69b 100644 --- a/sw/qa/extras/odfimport/odfimport.cxx +++ b/sw/qa/extras/odfimport/odfimport.cxx @@ -662,5 +662,36 @@ DECLARE_ODFIMPORT_TEST(testTdf100033_2, "tdf100033_2.odt") CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xIndexAccess->getCount()); } +DECLARE_ODFIMPORT_TEST(testTdf109080_loext_ns, "tdf109080_loext_ns.odt") +{ +// Test we can import and + +CPPUNIT_ASSERT_EQUAL(OUString("This is the first page header"), +parseDump("/root/page[1]/header/txt/text()")); +CPPUNIT_ASSERT_EQUAL(OUString("This is the non-first-page header"), +parseDump("/root/page[2]/header/txt/text()")); + +CPPUNIT_ASSERT_EQUAL(OUString("This is the first page footer"), +parseDump("/root/page[1]/footer/txt/text()")); +CPPUNIT_ASSERT_EQUAL(OUString("This is the non-first-page footer"), +parseDump("/root/page[2]/footer/txt/text()")); +} + +DECLARE_ODFIMPORT_TEST(testTdf109080_style_ns, "tdf109080_style_ns.odt") +{ +// Test we can import and +// (produced by LibreOffice 4.0 - 5.x) + +CPPUNIT_ASSERT_EQUAL(OUString("This is the first page header"), +parseDump("/root/page[1]/header/txt/text()")); +CPPUNIT_ASSERT_EQUAL(OUString("This is the non-first-page header"), +parseDump("/root/page[2]/header/txt/text()")); + +CPPUNIT_ASSERT_EQUAL(OUString("This is the first page footer"), +parseDump("/root/page[1]/footer/txt/text()")); +CPPUNIT_ASSERT_EQUAL(OUString("This is the non-first-page footer"), +parseDump("/root/page[2]/footer/txt/text()")); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx index 1395e1809a29..8692e505caba 100644 --- a/xmloff/source/text/txtimp.cxx +++ b/xmloff/source/text/txtimp.cxx @@ -407,6 +407,8 @@ static const SvXMLTokenMapEntry aTextMasterPageElemTokenMap[] = { XML_NAMESPACE_STYLE, XML_FOOTER, XML_TOK_TEXT_MP_FOOTER }, { XML_NAMESPACE_STYLE, XML_HEADER_LEFT, XML_TOK_TEXT_MP_HEADER_LEFT }, { XML_NAMESPACE_STYLE, XML_FOOTER_LEFT, XML_TOK_TEXT_MP_FOOTER_LEFT }, +{ XML_NAMESPACE_LO_EXT, XML_HEADER_FIRST, XML_TOK_TEXT_MP_HEADER_FIRST }, +{ XML_NAMESPACE_LO_EXT, XML_FOOTER_FIRST, XML_TOK_TEXT_MP_FOOTER_FIRST }, { XML_NAMESPACE_STYLE, XML_HEADER_FIRST, XML_TOK_TEXT_MP_HEADER_FIRST }, { XML_NAMESPACE_STYLE, XML_FOOTER_FIRST, XML_TOK_TEXT_MP_FOOTER_FIRST }, ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sw/qa sw/source
sw/qa/extras/odfimport/data/tdf94882.odt |binary sw/qa/extras/odfimport/odfimport.cxx | 13 + sw/source/core/layout/newfrm.cxx |2 +- 3 files changed, 14 insertions(+), 1 deletion(-) New commits: commit 342a65bdb3ca3db19eb6b1244b6f866a0e526a86 Author: Luke Deller <l...@deller.id.au> Date: Mon Sep 4 22:40:34 2017 +1000 tdf#94882 use first page header on first page The very first page of the document should always be formatted using the "first page" settings in the page style, regardless of the page number set for that page. (cherry picked from commit 232885c66422ab8f05d86cfeac9b377a97462ae4) Change-Id: I49cb00cef8b1d10120349073dee1511657dc84d1 Reviewed-on: https://gerrit.libreoffice.org/41892 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Christian Lohmaier <lohmaier+libreoff...@googlemail.com> diff --git a/sw/qa/extras/odfimport/data/tdf94882.odt b/sw/qa/extras/odfimport/data/tdf94882.odt new file mode 100644 index ..2aacb9836da2 Binary files /dev/null and b/sw/qa/extras/odfimport/data/tdf94882.odt differ diff --git a/sw/qa/extras/odfimport/odfimport.cxx b/sw/qa/extras/odfimport/odfimport.cxx index 2439334ea512..9f871c08ea4e 100644 --- a/sw/qa/extras/odfimport/odfimport.cxx +++ b/sw/qa/extras/odfimport/odfimport.cxx @@ -837,5 +837,18 @@ DECLARE_ODFIMPORT_TEST(testTdf109228, "tdf109228.odt") CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AS_CHARACTER, getProperty(getShape(1), "AnchorType")); } +DECLARE_ODFIMPORT_TEST(testTdf94882, "tdf94882.odt") +{ +// Get the header of the page containing our content +// (done this way to skip past any blank page inserted before it +// due to the page number being even) +OUString headertext = parseDump( +"/root/page[starts-with(body/txt/text(),'The paragraph style on this')]" +"/header/txt/text()" +); +// This header should be the first page header +CPPUNIT_ASSERT_EQUAL(OUString("This is the first page header"), headertext); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/layout/newfrm.cxx b/sw/source/core/layout/newfrm.cxx index dae63d1f8aa6..ee4674b54c40 100644 --- a/sw/source/core/layout/newfrm.cxx +++ b/sw/source/core/layout/newfrm.cxx @@ -538,7 +538,7 @@ void SwRootFrame::Init( SwFrameFormat* pFormat ) if ( !pDesc ) pDesc = >GetPageDesc( 0 ); const bool bOdd = !oPgNum || 0 != ( oPgNum.get() % 2 ); -bool bFirst = !oPgNum || 1 == oPgNum.get(); +const bool bFirst = true; // Create a page and put it in the layout SwPageFrame *pPage = ::InsertNewPage( *pDesc, this, bOdd, bFirst, false, false, nullptr ); ___ 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/inc/swmodeltestbase.hxx | 34 +++--- sw/qa/extras/odfimport/odfimport.cxx | 13 +++ sw/qa/extras/ooxmlexport/ooxmlexport4.cxx |2 - sw/qa/extras/ww8export/ww8export.cxx |7 +- sw/source/core/layout/newfrm.cxx |7 +- sw/source/core/layout/trvlfrm.cxx | 13 +-- 6 files changed, 64 insertions(+), 12 deletions(-) New commits: commit 14bb680949b47332d2921cc68f75340b31ad5c32 Author: Luke Deller <l...@deller.id.au> Date: Wed Jul 12 20:39:50 2017 +1000 Insert blank page when first page number is even When the page number is explicitly changed at a page break, LibreOffice will insert a blank page if necessary to ensure that even page numbers appear on "left" pages. This commit fixes a case that was missed: the case where the page number of the very first page in the document is explicitly set to be an even number. Also: - adjust a couple of unit tests which were referring to specific physical page numbers, that were not expecting this blank page to be there - enhance SwModelTestBase::parseDump to support xpath expressions evaluating to simple values rather than nodes, for use in a test case for this change Change-Id: I1f41760c3bb17bdffb868cf32a1331de87d1d0e1 Reviewed-on: https://gerrit.libreoffice.org/39858 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk> diff --git a/sw/qa/extras/inc/swmodeltestbase.hxx b/sw/qa/extras/inc/swmodeltestbase.hxx index 80874da95810..09fe3589b9a8 100644 --- a/sw/qa/extras/inc/swmodeltestbase.hxx +++ b/sw/qa/extras/inc/swmodeltestbase.hxx @@ -405,15 +405,35 @@ protected: xmlXPathContextPtr pXmlXpathCtx = xmlXPathNewContext(pXmlDoc); xmlXPathObjectPtr pXmlXpathObj = xmlXPathEvalExpression(BAD_CAST(aXPath.getStr()), pXmlXpathCtx); -xmlNodeSetPtr pXmlNodes = pXmlXpathObj->nodesetval; -CPPUNIT_ASSERT_EQUAL_MESSAGE("parsing dump failed", 1, xmlXPathNodeSetGetLength(pXmlNodes)); -xmlNodePtr pXmlNode = pXmlNodes->nodeTab[0]; -OUString aRet; -if (aAttribute.getLength()) -aRet = OUString::createFromAscii(reinterpret_cast<char*>(xmlGetProp(pXmlNode, BAD_CAST(aAttribute.getStr(); +CPPUNIT_ASSERT_MESSAGE("xpath evaluation failed", pXmlXpathObj); +xmlChar *pXpathStrResult; +if (pXmlXpathObj->type == XPATH_NODESET) +{ +xmlNodeSetPtr pXmlNodes = pXmlXpathObj->nodesetval; +CPPUNIT_ASSERT_EQUAL_MESSAGE("xpath should match exactly 1 node", +1, xmlXPathNodeSetGetLength(pXmlNodes)); +xmlNodePtr pXmlNode = pXmlNodes->nodeTab[0]; +if (aAttribute.getLength()) +pXpathStrResult = xmlGetProp(pXmlNode, BAD_CAST(aAttribute.getStr())); +else +pXpathStrResult = xmlNodeGetContent(pXmlNode); +} else -aRet = OUString::createFromAscii(reinterpret_cast<char*>(xmlNodeGetContent(pXmlNode))); +{ +// the xpath expression evaluated to a value, not a node +CPPUNIT_ASSERT_EQUAL_MESSAGE( +"attr name should not be supplied when xpath evals to a value", +aAttribute.getLength(), sal_Int32(0)); +pXpathStrResult = xmlXPathCastToString(pXmlXpathObj); +CPPUNIT_ASSERT_MESSAGE("xpath result cannot be cast to string", +pXpathStrResult); +} +OUString aRet = OUString(reinterpret_cast<char*>(pXpathStrResult), +xmlStrlen(pXpathStrResult), RTL_TEXTENCODING_UTF8); +xmlFree(pXpathStrResult); +xmlFree(pXmlXpathObj); +xmlFree(pXmlXpathCtx); xmlFreeDoc(pXmlDoc); return aRet; diff --git a/sw/qa/extras/odfimport/odfimport.cxx b/sw/qa/extras/odfimport/odfimport.cxx index 66d25f1919ef..67a6873f5617 100644 --- a/sw/qa/extras/odfimport/odfimport.cxx +++ b/sw/qa/extras/odfimport/odfimport.cxx @@ -857,5 +857,18 @@ DECLARE_ODFIMPORT_TEST(testTdf94882, "tdf94882.odt") CPPUNIT_ASSERT_EQUAL(OUString("This is the first page header"), headertext); } +DECLARE_ODFIMPORT_TEST(testBlankBeforeFirstPage, "tdf94882.odt") +{ +// This document starts on page 50, which is even, so it should have a +// blank page inserted before it to make it a left page + +CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be 2 pages output", +OUString("2"), parseDump("count(/root/page)") +); +CPPUNIT_ASSERT_EQUAL_MESSAGE("The first page should be blank", +OUString("0"), parseDump("count(/root/page[1]/body)") +); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /*
[Libreoffice-commits] core.git: sw/qa sw/source
sw/qa/extras/odfimport/data/tdf94882.odt |binary sw/qa/extras/odfimport/odfimport.cxx | 13 + sw/source/core/layout/newfrm.cxx |2 +- 3 files changed, 14 insertions(+), 1 deletion(-) New commits: commit 232885c66422ab8f05d86cfeac9b377a97462ae4 Author: Luke Deller <ldel...@iress.com.au> Date: Wed Jul 12 17:00:55 2017 +1000 tdf#94882 use first page header on first page The very first page of the document should always be formatted using the "first page" settings in the page style, regardless of the page number set for that page. Change-Id: I49cb00cef8b1d10120349073dee1511657dc84d1 Reviewed-on: https://gerrit.libreoffice.org/39851 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Michael Stahl <mst...@redhat.com> Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk> diff --git a/sw/qa/extras/odfimport/data/tdf94882.odt b/sw/qa/extras/odfimport/data/tdf94882.odt new file mode 100644 index ..2aacb9836da2 Binary files /dev/null and b/sw/qa/extras/odfimport/data/tdf94882.odt differ diff --git a/sw/qa/extras/odfimport/odfimport.cxx b/sw/qa/extras/odfimport/odfimport.cxx index edcdd5deb6f9..66d25f1919ef 100644 --- a/sw/qa/extras/odfimport/odfimport.cxx +++ b/sw/qa/extras/odfimport/odfimport.cxx @@ -844,5 +844,18 @@ DECLARE_ODFIMPORT_TEST(testTdf109228, "tdf109228.odt") CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AS_CHARACTER, getProperty(getShape(1), "AnchorType")); } +DECLARE_ODFIMPORT_TEST(testTdf94882, "tdf94882.odt") +{ +// Get the header of the page containing our content +// (done this way to skip past any blank page inserted before it +// due to the page number being even) +OUString headertext = parseDump( +"/root/page[starts-with(body/txt/text(),'The paragraph style on this')]" +"/header/txt/text()" +); +// This header should be the first page header +CPPUNIT_ASSERT_EQUAL(OUString("This is the first page header"), headertext); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/layout/newfrm.cxx b/sw/source/core/layout/newfrm.cxx index ddefc54aecdf..27e40e469fe7 100644 --- a/sw/source/core/layout/newfrm.cxx +++ b/sw/source/core/layout/newfrm.cxx @@ -538,7 +538,7 @@ void SwRootFrame::Init( SwFrameFormat* pFormat ) if ( !pDesc ) pDesc = >GetPageDesc( 0 ); const bool bOdd = !oPgNum || 0 != ( oPgNum.get() % 2 ); -bool bFirst = !oPgNum || 1 == oPgNum.get(); +const bool bFirst = true; // Create a page and put it in the layout SwPageFrame *pPage = ::InsertNewPage( *pDesc, this, bOdd, bFirst, false, false, nullptr ); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
Re: ODF 9.1.12 purpose of element
Hi Regina, I did some digging into the source history hoping to find clues about the original motivation for introducing this element. Support for importing this element was added to Calc in 2000 along with , as part of the initial work for freezing rows and columns as headers in a spreadsheet. Relevant commits are 7c9e9bfa for the export of headers, and 9cd39996 and 05c72064 for the import. I suppose the idea was that two groups of columns would be used: the header columns in a element followed by the non-header columns in a element. However the export was not actually updated to emit a element like this, only the import support was added. A couple of weeks later another similar element was added, for implementing the Outlines feature described in help here: https://help.libreoffice.org/Calc/Group_and_Outline In this Outlines change (commit 869fb45a), all these three column grouping elements were allowed to be nested inside each other. Prior to that, the and could only occur beneath the element. Anyway I think this background supports that the element was not necessary from the beginning. On 22/07/17 08:12, Regina Henschel wrote: Luke Deller schrieb: 2. A database (odb) file can contain reports containing tables, which will be emitted with . I was not able to generate such document. I have tried it with report as text document, report as spreadsheet and with the old kind of reports from OOo2.4.3. I always have got only elements. Sorry perhaps I should call it a "report design" rather than a "report". I created such a design using the "Use Wizard to Create Report" link in the "Tasks" pane in Base. Afterwards, in the Reports pane of Base, simply double clicking the report gives me a Writer document, but if I right click on the report and select "Edit", then I get a window entitled "Oracle Report Builder" which allows the design to be edited. (BTW should we update this window title?) The report design was stored in a separate XML file within the odb file, which was referenced in the content.xml like this: xlink:type="simple" db:as-template="false"/> The element was located in the file "reports/Obj11/content.xml" within the odb. Regards, Luke. ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: ODF 9.1.12 purpose of element
Hi Regina On 21/07/17 21:52, Regina Henschel wrote: it seems to me, that the element is useless. Exists any situation where LibreOffice writes such element? I can see only two places in the code which will emit this element: 1. A chart object (e.g. in a spreadsheet) contains a representing the data for the chart. LibreOffice always emits for this table. 2. A database (odb) file can contain reports containing tables, which will be emitted with . What is the purpose of this element? In both of these cases the simply wraps all the elements, which looks redundant to me. ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice
[Libreoffice-commits] core.git: sw/source uitest/uitest uitest/writer_tests
sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx | 16 ++-- uitest/uitest/test.py| 25 +- uitest/writer_tests/spellDialog.py | 70 +++ 3 files changed, 103 insertions(+), 8 deletions(-) New commits: commit 8b321625d50f33bbd9ae3eed08d5d2b6b1944248 Author: Luke Deller <l...@deller.id.au> Date: Mon Jul 17 23:25:49 2017 +1000 tdf#46852 fix spellcheck continue at beginning When a spellcheck reaches the end of the document, it is supposed to be able to continue from the beginning of the document to the point at which the spellcheck was started. This was not working in the case where the word at the starting position was replaced due to a spelling correction, which causes the starting position to be lost. Fix this situation by recording the position immediately *before* the spellcheck starting position, so that it will not be affected by a spelling correction *at* the starting position. Change-Id: I9483fd5937dc1e235f6f9639d4856fe15e3d47a6 Reviewed-on: https://gerrit.libreoffice.org/40123 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Michael Stahl <mst...@redhat.com> diff --git a/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx b/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx index f0b489455d49..f04020dabfbb 100644 --- a/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx +++ b/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx @@ -227,14 +227,20 @@ svx::SpellPortions SwSpellDialogChildWindow::GetNextWrongSentence(bool bRecheck) } else { -SwPaM* pCursor = pWrtShell->GetCursor(); // mark the start position only if not at start of doc if(!pWrtShell->IsStartOfDoc()) { -m_pSpellState->m_xStartRange = -SwXTextRange::CreateXTextRange( -*pWrtShell->GetDoc(), -*pCursor->Start(), pCursor->End()); +// Record the position *before* the current cursor, as +// the word at the current cursor can possibly be +// replaced by a spellcheck correction which invalidates +// an XTextRange at this position. +SwDoc *pDoc = pWrtShell->GetDoc(); +auto pStart = pWrtShell->GetCursor()->Start(); +auto pUnoCursor = pDoc->CreateUnoCursor(*pStart); +pUnoCursor->Left( 1 ); +pStart = pUnoCursor->Start(); +m_pSpellState->m_xStartRange += SwXTextRange::CreateXTextRange(*pDoc, *pStart, nullptr); } pWrtShell->SpellStart( SwDocPositions::Start, SwDocPositions::End, SwDocPositions::Curr ); } diff --git a/uitest/uitest/test.py b/uitest/uitest/test.py index f477369154fa..122df519da4d 100644 --- a/uitest/uitest/test.py +++ b/uitest/uitest/test.py @@ -177,7 +177,23 @@ class UITest(object): time_ += DEFAULT_SLEEP time.sleep(DEFAULT_SLEEP) -def execute_blocking_action(self, action, dialog_element, args = ()): +def execute_blocking_action(self, action, dialog_element=None, +args=(), dialog_handler=None): +"""Executes an action which blocks while a dialog is shown. + +Click a button or perform some other action on the dialog when it +is shown. + +Args: +action(callable): Will be called to show a dialog, and is expected +to block while the dialog is shown. +dialog_element(str, optional): The name of a button on the dialog +which will be clicked when the dialog is shown. +args(tuple, optional): The arguments to be passed to `action` +dialog_handler(callable, optional): Will be called when the dialog +is shown, with the dialog object passed as a parameter. +""" + thread = threading.Thread(target=action, args=args) with EventListener(self._xContext, ["DialogExecute", "ModelessDialogExecute"]) as event: thread.start() @@ -185,8 +201,11 @@ class UITest(object): while time_ < MAX_WAIT: if event.executed: xDlg = self._xUITest.getTopFocusWindow() -xUIElement = xDlg.getChild(dialog_element) -xUIElement.executeAction("CLICK", tuple()) +if dialog_element: +xUIElement = xDlg.getChild(dialog_element) +xUIE
[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sw/qa xmloff/source
sw/qa/extras/odfimport/data/tdf109080_loext_ns.odt |binary sw/qa/extras/odfimport/data/tdf109080_style_ns.odt |binary sw/qa/extras/odfimport/odfimport.cxx | 31 + xmloff/source/text/txtimp.cxx |2 + 4 files changed, 33 insertions(+) New commits: commit c027764f94a1fc0a367e03b412d3c11d6c10769c Author: Luke Deller <l...@deller.id.au> Date: Wed Jul 12 23:56:50 2017 +1000 tdf#109080 First page header/footer ODF (1/2) The proposal to add / to the ODF standard has not yet been accepted, so meanwhile we should be using an extension namespace for these elements. This first commit (intended for backport) adds support for reading / Change-Id: I616b6a0acaead9d767ae7d119e539b865f3a6774 (cherry picked from commit bff8cd3d52223002263dcb8c09758c4fc753b6e3) Reviewed-on: https://gerrit.libreoffice.org/40227 Reviewed-by: Michael Stahl <mst...@redhat.com> Tested-by: Jenkins <c...@libreoffice.org> diff --git a/sw/qa/extras/odfimport/data/tdf109080_loext_ns.odt b/sw/qa/extras/odfimport/data/tdf109080_loext_ns.odt new file mode 100644 index ..ac7b3e272acc Binary files /dev/null and b/sw/qa/extras/odfimport/data/tdf109080_loext_ns.odt differ diff --git a/sw/qa/extras/odfimport/data/tdf109080_style_ns.odt b/sw/qa/extras/odfimport/data/tdf109080_style_ns.odt new file mode 100644 index ..ada290dc5fe1 Binary files /dev/null and b/sw/qa/extras/odfimport/data/tdf109080_style_ns.odt differ diff --git a/sw/qa/extras/odfimport/odfimport.cxx b/sw/qa/extras/odfimport/odfimport.cxx index 06f2bf7f8a9c..2f1f1f1f 100644 --- a/sw/qa/extras/odfimport/odfimport.cxx +++ b/sw/qa/extras/odfimport/odfimport.cxx @@ -800,5 +800,36 @@ DECLARE_ODFIMPORT_TEST(testTdf100033_2, "tdf100033_2.odt") CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xIndexAccess->getCount()); } +DECLARE_ODFIMPORT_TEST(testTdf109080_loext_ns, "tdf109080_loext_ns.odt") +{ +// Test we can import and + +CPPUNIT_ASSERT_EQUAL(OUString("This is the first page header"), +parseDump("/root/page[1]/header/txt/text()")); +CPPUNIT_ASSERT_EQUAL(OUString("This is the non-first-page header"), +parseDump("/root/page[2]/header/txt/text()")); + +CPPUNIT_ASSERT_EQUAL(OUString("This is the first page footer"), +parseDump("/root/page[1]/footer/txt/text()")); +CPPUNIT_ASSERT_EQUAL(OUString("This is the non-first-page footer"), +parseDump("/root/page[2]/footer/txt/text()")); +} + +DECLARE_ODFIMPORT_TEST(testTdf109080_style_ns, "tdf109080_style_ns.odt") +{ +// Test we can import and +// (produced by LibreOffice 4.0 - 5.x) + +CPPUNIT_ASSERT_EQUAL(OUString("This is the first page header"), +parseDump("/root/page[1]/header/txt/text()")); +CPPUNIT_ASSERT_EQUAL(OUString("This is the non-first-page header"), +parseDump("/root/page[2]/header/txt/text()")); + +CPPUNIT_ASSERT_EQUAL(OUString("This is the first page footer"), +parseDump("/root/page[1]/footer/txt/text()")); +CPPUNIT_ASSERT_EQUAL(OUString("This is the non-first-page footer"), +parseDump("/root/page[2]/footer/txt/text()")); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx index 53bb6b70bced..234673c26461 100644 --- a/xmloff/source/text/txtimp.cxx +++ b/xmloff/source/text/txtimp.cxx @@ -407,6 +407,8 @@ static const SvXMLTokenMapEntry aTextMasterPageElemTokenMap[] = { XML_NAMESPACE_STYLE, XML_FOOTER, XML_TOK_TEXT_MP_FOOTER }, { XML_NAMESPACE_STYLE, XML_HEADER_LEFT, XML_TOK_TEXT_MP_HEADER_LEFT }, { XML_NAMESPACE_STYLE, XML_FOOTER_LEFT, XML_TOK_TEXT_MP_FOOTER_LEFT }, +{ XML_NAMESPACE_LO_EXT, XML_HEADER_FIRST, XML_TOK_TEXT_MP_HEADER_FIRST }, +{ XML_NAMESPACE_LO_EXT, XML_FOOTER_FIRST, XML_TOK_TEXT_MP_FOOTER_FIRST }, { XML_NAMESPACE_STYLE, XML_HEADER_FIRST, XML_TOK_TEXT_MP_HEADER_FIRST }, { XML_NAMESPACE_STYLE, XML_FOOTER_FIRST, XML_TOK_TEXT_MP_FOOTER_FIRST }, ___ 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/qa xmloff/source
sw/qa/extras/odfimport/data/tdf109080_loext_ns.odt |binary sw/qa/extras/odfimport/data/tdf109080_style_ns.odt |binary sw/qa/extras/odfimport/odfimport.cxx | 31 + xmloff/source/text/txtimp.cxx |2 + 4 files changed, 33 insertions(+) New commits: commit 63274a5b0528e82faf7eed9cbc50badfdd1d3b55 Author: Luke Deller <l...@deller.id.au> Date: Wed Jul 12 23:56:50 2017 +1000 tdf#109080 First page header/footer ODF (1/2) The proposal to add / to the ODF standard has not yet been accepted, so meanwhile we should be using an extension namespace for these elements. This first commit (intended for backport) adds support for reading / (cherry picked from commit bff8cd3d52223002263dcb8c09758c4fc753b6e3) Change-Id: I616b6a0acaead9d767ae7d119e539b865f3a6774 Reviewed-on: https://gerrit.libreoffice.org/40228 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Michael Stahl <mst...@redhat.com> diff --git a/sw/qa/extras/odfimport/data/tdf109080_loext_ns.odt b/sw/qa/extras/odfimport/data/tdf109080_loext_ns.odt new file mode 100644 index ..ac7b3e272acc Binary files /dev/null and b/sw/qa/extras/odfimport/data/tdf109080_loext_ns.odt differ diff --git a/sw/qa/extras/odfimport/data/tdf109080_style_ns.odt b/sw/qa/extras/odfimport/data/tdf109080_style_ns.odt new file mode 100644 index ..ada290dc5fe1 Binary files /dev/null and b/sw/qa/extras/odfimport/data/tdf109080_style_ns.odt differ diff --git a/sw/qa/extras/odfimport/odfimport.cxx b/sw/qa/extras/odfimport/odfimport.cxx index c262f9cf72e9..8911e8067107 100644 --- a/sw/qa/extras/odfimport/odfimport.cxx +++ b/sw/qa/extras/odfimport/odfimport.cxx @@ -777,5 +777,36 @@ DECLARE_ODFIMPORT_TEST(testTdf100033_2, "tdf100033_2.odt") CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xIndexAccess->getCount()); } +DECLARE_ODFIMPORT_TEST(testTdf109080_loext_ns, "tdf109080_loext_ns.odt") +{ +// Test we can import and + +CPPUNIT_ASSERT_EQUAL(OUString("This is the first page header"), +parseDump("/root/page[1]/header/txt/text()")); +CPPUNIT_ASSERT_EQUAL(OUString("This is the non-first-page header"), +parseDump("/root/page[2]/header/txt/text()")); + +CPPUNIT_ASSERT_EQUAL(OUString("This is the first page footer"), +parseDump("/root/page[1]/footer/txt/text()")); +CPPUNIT_ASSERT_EQUAL(OUString("This is the non-first-page footer"), +parseDump("/root/page[2]/footer/txt/text()")); +} + +DECLARE_ODFIMPORT_TEST(testTdf109080_style_ns, "tdf109080_style_ns.odt") +{ +// Test we can import and +// (produced by LibreOffice 4.0 - 5.x) + +CPPUNIT_ASSERT_EQUAL(OUString("This is the first page header"), +parseDump("/root/page[1]/header/txt/text()")); +CPPUNIT_ASSERT_EQUAL(OUString("This is the non-first-page header"), +parseDump("/root/page[2]/header/txt/text()")); + +CPPUNIT_ASSERT_EQUAL(OUString("This is the first page footer"), +parseDump("/root/page[1]/footer/txt/text()")); +CPPUNIT_ASSERT_EQUAL(OUString("This is the non-first-page footer"), +parseDump("/root/page[2]/footer/txt/text()")); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx index 8029ddfd075b..4d1b1333d9d2 100644 --- a/xmloff/source/text/txtimp.cxx +++ b/xmloff/source/text/txtimp.cxx @@ -407,6 +407,8 @@ static const SvXMLTokenMapEntry aTextMasterPageElemTokenMap[] = { XML_NAMESPACE_STYLE, XML_FOOTER, XML_TOK_TEXT_MP_FOOTER }, { XML_NAMESPACE_STYLE, XML_HEADER_LEFT, XML_TOK_TEXT_MP_HEADER_LEFT }, { XML_NAMESPACE_STYLE, XML_FOOTER_LEFT, XML_TOK_TEXT_MP_FOOTER_LEFT }, +{ XML_NAMESPACE_LO_EXT, XML_HEADER_FIRST, XML_TOK_TEXT_MP_HEADER_FIRST }, +{ XML_NAMESPACE_LO_EXT, XML_FOOTER_FIRST, XML_TOK_TEXT_MP_FOOTER_FIRST }, { XML_NAMESPACE_STYLE, XML_HEADER_FIRST, XML_TOK_TEXT_MP_HEADER_FIRST }, { XML_NAMESPACE_STYLE, XML_FOOTER_FIRST, XML_TOK_TEXT_MP_FOOTER_FIRST }, ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sw/qa xmloff/source
sw/qa/extras/odfexport/odfexport.cxx |1 - xmloff/source/text/XMLTextMasterPageExport.cxx |4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) New commits: commit f1481007077723f7676f517db8df1363d070d459 Author: Luke Deller <l...@deller.id.au> Date: Thu Jul 13 00:01:53 2017 +1000 tdf#109080 First page header/footer ODF (2/2) The proposal to add / to the ODF standard has not yet been accepted, so meanwhile we should be using an extension namespace for these elements. This second commit changes LibreOffice to emit / Change-Id: Iffec14696a09c3378a6e65b78b5c63b9a43d9b46 Reviewed-on: https://gerrit.libreoffice.org/39865 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk> diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx index b4c79b1b048c..38ce6a5596c6 100644 --- a/sw/qa/extras/odfexport/odfexport.cxx +++ b/sw/qa/extras/odfexport/odfexport.cxx @@ -53,7 +53,6 @@ public: "fdo86963.odt", "shape-relsize.odt", "fdo60769.odt", -"first-header-footer.odt", "fdo38244.odt" }; diff --git a/xmloff/source/text/XMLTextMasterPageExport.cxx b/xmloff/source/text/XMLTextMasterPageExport.cxx index 8d31899929e7..3c60880c6e18 100644 --- a/xmloff/source/text/XMLTextMasterPageExport.cxx +++ b/xmloff/source/text/XMLTextMasterPageExport.cxx @@ -155,7 +155,7 @@ void XMLTextMasterPageExport::exportMasterPageContent( if (bHeaderFirstShared) GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_DISPLAY, XML_FALSE ); -SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_STYLE, +SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_LO_EXT, XML_HEADER_FIRST, true, true ); exportHeaderFooterContent( xHeaderTextFirst, false ); } @@ -203,7 +203,7 @@ void XMLTextMasterPageExport::exportMasterPageContent( if (bFooterFirstShared) GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_DISPLAY, XML_FALSE ); -SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_STYLE, +SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_LO_EXT, XML_FOOTER_FIRST, true, true ); exportHeaderFooterContent( xFooterTextFirst, false ); } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sw/qa xmloff/source
sw/qa/extras/odfimport/data/tdf109080_loext_ns.odt |binary sw/qa/extras/odfimport/data/tdf109080_style_ns.odt |binary sw/qa/extras/odfimport/odfimport.cxx | 31 + xmloff/source/text/txtimp.cxx |2 + 4 files changed, 33 insertions(+) New commits: commit bff8cd3d52223002263dcb8c09758c4fc753b6e3 Author: Luke Deller <l...@deller.id.au> Date: Wed Jul 12 23:56:50 2017 +1000 tdf#109080 First page header/footer ODF (1/2) The proposal to add / to the ODF standard has not yet been accepted, so meanwhile we should be using an extension namespace for these elements. This first commit (intended for backport) adds support for reading / Change-Id: I616b6a0acaead9d767ae7d119e539b865f3a6774 Reviewed-on: https://gerrit.libreoffice.org/39863 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk> diff --git a/sw/qa/extras/odfimport/data/tdf109080_loext_ns.odt b/sw/qa/extras/odfimport/data/tdf109080_loext_ns.odt new file mode 100644 index ..ac7b3e272acc Binary files /dev/null and b/sw/qa/extras/odfimport/data/tdf109080_loext_ns.odt differ diff --git a/sw/qa/extras/odfimport/data/tdf109080_style_ns.odt b/sw/qa/extras/odfimport/data/tdf109080_style_ns.odt new file mode 100644 index ..ada290dc5fe1 Binary files /dev/null and b/sw/qa/extras/odfimport/data/tdf109080_style_ns.odt differ diff --git a/sw/qa/extras/odfimport/odfimport.cxx b/sw/qa/extras/odfimport/odfimport.cxx index dfd99a246634..481a388ea9a7 100644 --- a/sw/qa/extras/odfimport/odfimport.cxx +++ b/sw/qa/extras/odfimport/odfimport.cxx @@ -807,5 +807,36 @@ DECLARE_ODFIMPORT_TEST(testI61225, "i61225.sxw") calcLayout(); } +DECLARE_ODFIMPORT_TEST(testTdf109080_loext_ns, "tdf109080_loext_ns.odt") +{ +// Test we can import and + +CPPUNIT_ASSERT_EQUAL(OUString("This is the first page header"), +parseDump("/root/page[1]/header/txt/text()")); +CPPUNIT_ASSERT_EQUAL(OUString("This is the non-first-page header"), +parseDump("/root/page[2]/header/txt/text()")); + +CPPUNIT_ASSERT_EQUAL(OUString("This is the first page footer"), +parseDump("/root/page[1]/footer/txt/text()")); +CPPUNIT_ASSERT_EQUAL(OUString("This is the non-first-page footer"), +parseDump("/root/page[2]/footer/txt/text()")); +} + +DECLARE_ODFIMPORT_TEST(testTdf109080_style_ns, "tdf109080_style_ns.odt") +{ +// Test we can import and +// (produced by LibreOffice 4.0 - 5.x) + +CPPUNIT_ASSERT_EQUAL(OUString("This is the first page header"), +parseDump("/root/page[1]/header/txt/text()")); +CPPUNIT_ASSERT_EQUAL(OUString("This is the non-first-page header"), +parseDump("/root/page[2]/header/txt/text()")); + +CPPUNIT_ASSERT_EQUAL(OUString("This is the first page footer"), +parseDump("/root/page[1]/footer/txt/text()")); +CPPUNIT_ASSERT_EQUAL(OUString("This is the non-first-page footer"), +parseDump("/root/page[2]/footer/txt/text()")); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx index 8bd34398caea..b5b0b4243965 100644 --- a/xmloff/source/text/txtimp.cxx +++ b/xmloff/source/text/txtimp.cxx @@ -407,6 +407,8 @@ static const SvXMLTokenMapEntry aTextMasterPageElemTokenMap[] = { XML_NAMESPACE_STYLE, XML_FOOTER, XML_TOK_TEXT_MP_FOOTER }, { XML_NAMESPACE_STYLE, XML_HEADER_LEFT, XML_TOK_TEXT_MP_HEADER_LEFT }, { XML_NAMESPACE_STYLE, XML_FOOTER_LEFT, XML_TOK_TEXT_MP_FOOTER_LEFT }, +{ XML_NAMESPACE_LO_EXT, XML_HEADER_FIRST, XML_TOK_TEXT_MP_HEADER_FIRST }, +{ XML_NAMESPACE_LO_EXT, XML_FOOTER_FIRST, XML_TOK_TEXT_MP_FOOTER_FIRST }, { XML_NAMESPACE_STYLE, XML_HEADER_FIRST, XML_TOK_TEXT_MP_HEADER_FIRST }, { XML_NAMESPACE_STYLE, XML_FOOTER_FIRST, XML_TOK_TEXT_MP_FOOTER_FIRST }, ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: config_host.mk.in configure.ac
config_host.mk.in |1 + configure.ac | 15 +++ 2 files changed, 16 insertions(+) New commits: commit d6a1ba29a512aec9b4aa3d0ab4bd6b92aea7fef4 Author: Luke Deller <l...@deller.id.au> Date: Wed Jan 14 23:48:36 2015 +1100 enable optimization (-Og) with --enable-debug gcc-4.8 introduced a new optimization level -Og which enables optimizations that do not interfere with debugging. When configured with --enable-debug, use -Og rather than -O0 if available. Change-Id: Iff3f98d736681ae34e49b96510228a14ce456b34 Reviewed-on: https://gerrit.libreoffice.org/31333 Reviewed-by: Michael Stahl <mst...@redhat.com> Tested-by: Michael Stahl <mst...@redhat.com> diff --git a/config_host.mk.in b/config_host.mk.in index 9bf9d69..9181748 100644 --- a/config_host.mk.in +++ b/config_host.mk.in @@ -244,6 +244,7 @@ export HAVE_GCC_FNO_ENFORCE_EH_SPECS=@HAVE_GCC_FNO_ENFORCE_EH_SPECS@ export HAVE_GCC_FNO_INLINE=@HAVE_GCC_FNO_INLINE@ export HAVE_GCC_FNO_SIZED_DEALLOCATION=@HAVE_GCC_FNO_SIZED_DEALLOCATION@ export HAVE_GCC_GGDB2=@HAVE_GCC_GGDB2@ +export HAVE_GCC_OG=@HAVE_GCC_OG@ export HAVE_GCC_PRAGMA_OPERATOR=@HAVE_GCC_PRAGMA_OPERATOR@ export HAVE_GNUMAKE_FILE_FUNC=@HAVE_GNUMAKE_FILE_FUNC@ export HAVE_LD_BSYMBOLIC_FUNCTIONS=@HAVE_LD_BSYMBOLIC_FUNCTIONS@ diff --git a/configure.ac b/configure.ac index 77fefaa1..082b311 100644 --- a/configure.ac +++ b/configure.ac @@ -3733,6 +3733,7 @@ fi HAVE_GCC_GGDB2= HAVE_GCC_FINLINE_LIMIT= HAVE_GCC_FNO_INLINE= +HAVE_GCC_OG= if test "$GCC" = "yes"; then AC_MSG_CHECKING([whether $CC supports -ggdb2]) if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then @@ -3782,10 +3783,24 @@ if test "$GCC" = "yes"; then else AC_MSG_RESULT([no]) fi + +AC_MSG_CHECKING([whether $CC supports -Og]) +# Note that clang-3.1 reports a real error for this option +# so we do not need a special case for clang<=3.1 as above. +save_CFLAGS=$CFLAGS +CFLAGS="$CFLAGS -Werror -Og" +AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_OG=TRUE ],[]) +CFLAGS=$save_CFLAGS +if test "$HAVE_GCC_OG" = "TRUE"; then +AC_MSG_RESULT([yes]) +else +AC_MSG_RESULT([no]) +fi fi AC_SUBST(HAVE_GCC_GGDB2) AC_SUBST(HAVE_GCC_FINLINE_LIMIT) AC_SUBST(HAVE_GCC_FNO_INLINE) +AC_SUBST(HAVE_GCC_OG) dnl === dnl Test the gcc version ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: vcl/source
vcl/source/font/font.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 834809dbbef60de6677b80e26753c55c4edf96c2 Author: Luke Deller <l...@deller.id.au> Date: Wed Sep 14 23:53:33 2016 +1000 Avoid AskConfig when setting font family Avoid calling the expensive ImplFont::AskConfig from Font::SetFamily as we are just going to overwrite the font family anyway. It looks like this crept in accidentally in the recent refactor commit e418d1a9c87ce01b75141f92dc249c7fb1a1bdcb Change-Id: I12a9bde77ffcc81f03c37ce400c59ea3a9acac31 Reviewed-on: https://gerrit.libreoffice.org/28901 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: jan iversen <j...@documentfoundation.org> diff --git a/vcl/source/font/font.cxx b/vcl/source/font/font.cxx index c608faf..df0f891 100644 --- a/vcl/source/font/font.cxx +++ b/vcl/source/font/font.cxx @@ -124,7 +124,7 @@ void Font::SetFontSize( const Size& rSize ) void Font::SetFamily( FontFamily eFamily ) { -if( mpImplFont->GetFamilyType() != eFamily ) +if( mpImplFont->GetFamilyTypeNoAsk() != eFamily ) mpImplFont->SetFamilyType( eFamily ); } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sc/qa
sc/qa/extras/testdocuments/window2.xls |binary 1 file changed New commits: commit 8dc46fc45b5c7d833caca331a9045167d1794f1a Author: Luke Deller <l...@deller.id.au> Date: Wed Sep 21 12:00:02 2016 +1000 Avoid failure in VBA test when window is too small The VBA test case "SplitRow" in window2.xls requires the spreadsheet window to be large enough. It looks like this has been discovered previously and some of the assertions commented out with a note about the window size requirement. However we bumped into a failure in one of the remaining assertions on one of our tinderboxes. To resolve: - Maximize the window at the start of this test case - Skip the test if the window size is still too small - Re-enable assertions which had been commented out due to this issue. (Note that VBA which reads Window.SplitRow appears to be broken in LO, so I have left two assertions here commented out with a FIXME) Change-Id: I5e87a360958f665457bbf8ec9c703a99794a62dc Reviewed-on: https://gerrit.libreoffice.org/29110 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Markus Mohrhard <markus.mohrh...@googlemail.com> diff --git a/sc/qa/extras/testdocuments/window2.xls b/sc/qa/extras/testdocuments/window2.xls index e9deceb..306f5d0 100644 Binary files a/sc/qa/extras/testdocuments/window2.xls and b/sc/qa/extras/testdocuments/window2.xls differ ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: framework/qa
framework/qa/complex/XTitle/CheckXTitle.java | 58 +-- 1 file changed, 46 insertions(+), 12 deletions(-) New commits: commit 328310d52e0f52ed1ebbd23535a67a82693adc61 Author: Luke Deller <l...@deller.id.au> Date: Thu Sep 22 18:53:49 2016 +1000 Fix JunitTest_framework_complex:CheckXTitle This unit test class relies on calling waitForEventIdle to wait for UI transitions to complete. On Windows this is not reliable, due to VCL's use of PostMessage (Windows message queue) to asynchronously handle some events such as focus changes. This issue causes the test to intermittently fail when the dispatcher for the action the test wants to perform (like closing the print preview) is not available yet. - Change the test code to explicitly wait for the desired dispatcher to be available - Remove the sleep which was added earlier this year to address this symptom in one location Change-Id: Id701209a28cd0c806ab0a548508d31f9f11211f5 Reviewed-on: https://gerrit.libreoffice.org/29167 Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> Tested-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/framework/qa/complex/XTitle/CheckXTitle.java b/framework/qa/complex/XTitle/CheckXTitle.java index 1372cf3..994215a 100644 --- a/framework/qa/complex/XTitle/CheckXTitle.java +++ b/framework/qa/complex/XTitle/CheckXTitle.java @@ -100,18 +100,52 @@ public class CheckXTitle m_xMSF= null; } +private URL parseURL(String unoURL) +{ +URL[] aParseURL = new URL[] { new URL() }; +aParseURL[0].Complete = unoURL; +m_xParser.parseStrict(aParseURL); +return aParseURL[0]; +} + +private void waitUntilDispatcherAvailable(XModel xModel, String unoURL) +throws InterruptedException +{ +utils.waitForEventIdle(m_xMSF); + +// On Windows, some events such as focus changes are handled +// asynchronously using PostMessage (Windows message queue) +// so the previous UI transition may still not have completed yet +// even though we called waitForEventIdle. +// +// Loop a few times until the desired dispatcher is available, which +// is a better indication that the UI transition has completed. + +XDispatchProvider xDisProv; +XDispatch xDispatcher = null; +URL parsed_url = parseURL(unoURL); + +for (int ntries = 1; ntries < 5; ++ntries) { +xDisProv = UnoRuntime.queryInterface( +XDispatchProvider.class, xModel.getCurrentController() ); +xDispatcher = xDisProv.queryDispatch(parsed_url, "", 0); +if (xDispatcher != null) +break; +Thread.sleep(250); +} +assertNotNull("Can not obtain dispatcher for query: " + unoURL, xDispatcher); +} + + // prepare an uno URL query and dispatch it private void prepareQueryAndDispatch(XDispatchProvider xDisProv, String unoURL) { XDispatch xDispatcher = null; -URL[] aParseURL = new URL[1]; -aParseURL[0] = new URL(); -aParseURL[0].Complete = unoURL; -m_xParser.parseStrict(aParseURL); +URL parsed_url = parseURL(unoURL); -xDispatcher = xDisProv.queryDispatch(aParseURL[0], "", 0); +xDispatcher = xDisProv.queryDispatch(parsed_url, "", 0); assertNotNull("Can not obtain dispatcher for query: " + unoURL, xDispatcher); -xDispatcher.dispatch(aParseURL[0], null); +xDispatcher.dispatch(parsed_url, null); } /** @short checks the numbers displayed in the title @@ -142,7 +176,8 @@ public class CheckXTitle xDisProv = UnoRuntime.queryInterface( XDispatchProvider.class, xModel.getCurrentController() ); prepareQueryAndDispatch( xDisProv, UNO_URL_FOR_PRINT_PREVIEW ); -utils.waitForEventIdle(m_xMSF); +waitUntilDispatcherAvailable( xModel, UNO_URL_FOR_CLOSING_PRINT_PREVIEW ); + // get window title with ui in print preview mode String printPreviewTitle = xTitle.getTitle(); assertEquals("Title mismatch between default view window title and print preview window title", @@ -150,7 +185,8 @@ public class CheckXTitle xDisProv = UnoRuntime.queryInterface( XDispatchProvider.class, xModel.getCurrentController() ); prepareQueryAndDispatch( xDisProv, UNO_URL_FOR_CLOSING_PRINT_PREVIEW ); -utils.waitForEventIdle(m_xMSF); +waitUntilDispatcherAvailable( xModel, UNO_URL_FOR_CLOSING_DOC ); + //get window title with ui back in default mode String printPreviewClosedTitle = xTitle.getTitle(); assertEquals("Title mismatch between default view window title and title after switching from print preview to default view window"
[Libreoffice-commits] core.git: qadevOOo/tests
qadevOOo/tests/java/ifc/accessibility/_XAccessibleText.java |5 qadevOOo/tests/java/mod/_toolkit/AccessibleFixedText.java | 14 +++- 2 files changed, 13 insertions(+), 6 deletions(-) New commits: commit e28d52387383d5b9b3554f364e885a20f4292d81 Author: Luke Deller <l...@deller.id.au> Date: Fri Sep 16 23:49:24 2016 +1000 Fix JUnit test case for AccessibleFixedText This test case was failing on platforms where the default font does not fit inside the default size of a fixed text control (hard coded to be 12px high in UnoFixedTextControl's constructor) - Adjust the test case to explicitly set the text control's size to its preferred size. - Re-enable this checking on Mac OS X, where it had been disabled in 2013 due to this issue Change-Id: I469a733f0a2719c60564d61c89bb64ab3ab622ba Reviewed-on: https://gerrit.libreoffice.org/28961 Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> Tested-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/qadevOOo/tests/java/ifc/accessibility/_XAccessibleText.java b/qadevOOo/tests/java/ifc/accessibility/_XAccessibleText.java index 92082d3..a28592c 100644 --- a/qadevOOo/tests/java/ifc/accessibility/_XAccessibleText.java +++ b/qadevOOo/tests/java/ifc/accessibility/_XAccessibleText.java @@ -402,11 +402,6 @@ public class _XAccessibleText extends MultiMethodTest { log.println("Component rect: " + bounds.X + ", " + bounds.Y + ", " + bounds.Width + ", " + bounds.Height); -//TODO: For some reason that still needs to be investigated, -// the above test keeps failing on Mac OS X: -if (!System.getProperty("os.name").equals("Mac OS X")) { -res &= localres; -} } } } catch (com.sun.star.lang.IndexOutOfBoundsException e) { diff --git a/qadevOOo/tests/java/mod/_toolkit/AccessibleFixedText.java b/qadevOOo/tests/java/mod/_toolkit/AccessibleFixedText.java index fc2aca6..0fc71d6 100644 --- a/qadevOOo/tests/java/mod/_toolkit/AccessibleFixedText.java +++ b/qadevOOo/tests/java/mod/_toolkit/AccessibleFixedText.java @@ -26,6 +26,8 @@ import com.sun.star.awt.XControlContainer; import com.sun.star.awt.XControlModel; import com.sun.star.awt.XFixedText; import com.sun.star.awt.XWindow; +import com.sun.star.awt.XLayoutConstrains; +import com.sun.star.awt.Size; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.XInterface; @@ -109,6 +111,16 @@ public class AccessibleFixedText extends TestCase { XFixedText.class, txtControl); xFT.setText("FxedText"); +/* Set the text control to its preferred size, otherwise it + * defaults to the size hard coded in its constructor (100 x 12) */ +XLayoutConstrains xLCTxt = UnoRuntime.queryInterface( +XLayoutConstrains.class, txtControl); +Size textSize = xLCTxt.getPreferredSize(); +XWindow xWinTxt = UnoRuntime.queryInterface( +XWindow.class, txtControl); +xWinTxt.setPosSize(0, 0, textSize.Width, textSize.Height, + PosSize.SIZE); + XControlContainer ctrlCont = UnoRuntime.queryInterface( XControlContainer.class, dlgControl); @@ -173,4 +185,4 @@ public class AccessibleFixedText extends TestCase { log.println("Closing dialog ... "); xWinDlg.dispose(); } -} \ No newline at end of file +} ___ 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/ww8import/data/tdf95576.doc|binary sw/qa/extras/ww8import/ww8import.cxx| 41 sw/source/core/doc/DocumentStylePoolManager.cxx | 14 ++-- sw/source/core/doc/number.cxx | 10 - 4 files changed, 45 insertions(+), 20 deletions(-) New commits: commit 77171fc384b3c6359cdae026a0c38f2f112c9d60 Author: Luke Deller <l...@deller.id.au> Date: Mon May 9 21:59:10 2016 +1000 Remove default outline indent, fixes tdf#95576 The default document outline style has indents set appropriately for numbered headings. However numbering was disabled in the default outline style 20 years ago (!) so update the indents accordingly. Also revert commit 05fd8cb848ecba425124d61cd76e2f9418d5378c which attempted to work around this issue by explicitly setting a zero indent on the default paragraph styles "Heading 1", "Heading 2", etc, as this is no longer required. This change fixes a DOC import issue tdf#95576 (!) Reference: see this old German comment https://cgit.freedesktop.org/libreoffice/core/tree/sw/source/core/doc/number.cxx?id=84a3db80#%6E647 Change-Id: Id289143ed859861f2584e21969f16f348e215f6f Reviewed-on: https://gerrit.libreoffice.org/24806 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk> diff --git a/sw/qa/extras/ww8import/data/tdf95576.doc b/sw/qa/extras/ww8import/data/tdf95576.doc new file mode 100644 index 000..a8a6018 Binary files /dev/null and b/sw/qa/extras/ww8import/data/tdf95576.doc differ diff --git a/sw/qa/extras/ww8import/ww8import.cxx b/sw/qa/extras/ww8import/ww8import.cxx index b2e0f0d..d59b9ad 100644 --- a/sw/qa/extras/ww8import/ww8import.cxx +++ b/sw/qa/extras/ww8import/ww8import.cxx @@ -567,6 +567,47 @@ reading page numbers at sections > 255, in this case 256 CPPUNIT_ASSERT_EQUAL(sal_Int16(256), nOffset); } +DECLARE_WW8IMPORT_TEST(testTdf95576, "tdf95576.doc") +{ +// The first three paragraphs in this document (which are headings) +// should have zero indent and first line indent +for (int nPara = 1; nPara <= 3; ++nPara) { +std::cout << "nPara = " << nPara << "\n"; +auto xPara = getParagraph(nPara); + +// get the numbering rules effective at this paragraph +uno::Reference xNumRules( +getProperty< uno::Reference >( +xPara, "NumberingRules"), +uno::UNO_QUERY); + +// get the numbering level of this paragraph, and the properties +// associated with that numbering level +int numLevel = getProperty(xPara, "NumberingLevel"); +uno::Sequence< beans::PropertyValue > aPropertyValues; +xNumRules->getByIndex(numLevel) >>= aPropertyValues; + +// Now look through these properties for the indent and +// first line indent settings +sal_Int32 nIndentAt = -1; +sal_Int32 nFirstLineIndent = -1; +for(int j = 0 ; j< aPropertyValues.getLength() ; ++j) +{ +auto aProp = aPropertyValues[j]; +std::cout << "Prop.Name: " << aProp.Name << "\n"; +if (aProp.Name == "FirstLineIndent") { +nFirstLineIndent = aProp.Value.get(); +} else if (aProp.Name == "IndentAt") { +nIndentAt = aProp.Value.get(); +} +} + +// The indent and first line indent should be zero +CPPUNIT_ASSERT_EQUAL(sal_Int32(0), nIndentAt); +CPPUNIT_ASSERT_EQUAL(sal_Int32(0), nFirstLineIndent); +} +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/doc/DocumentStylePoolManager.cxx b/sw/source/core/doc/DocumentStylePoolManager.cxx index a335326..66254f4 100644 --- a/sw/source/core/doc/DocumentStylePoolManager.cxx +++ b/sw/source/core/doc/DocumentStylePoolManager.cxx @@ -195,21 +195,15 @@ namespace SwNumRule * pOutlineRule = pDoc->GetOutlineNumRule(); const SwNumFormat& rNFormat = pOutlineRule->Get( nLevel ); -SvxLRSpaceItem aLR( static_cast(pColl->GetFormatAttr( RES_LR_SPACE )) ); -if ( rNFormat.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION && +if ( rNFormat.GetPositionAndSpaceMode() == +SvxNumberFormat::LABEL_WIDTH_AND_POSITION && ( rNFormat.GetAbsLSpace() || rNFormat.GetFirstLineOffset() ) ) { +SvxLRSpaceItem aLR( static_cast(pColl->GetFormatAttr( RES_LR_SPACE )) ); aLR.SetTextFirstLineOfstValue( rNFormat.GetFirstLineOffset()
[Libreoffice-commits] core.git: pyuno/source
pyuno/source/module/pyuno_runtime.cxx |6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) New commits: commit f4604e43a653a067633c24e069b272b6309b2151 Author: Luke Deller <l...@deller.id.au> Date: Sun May 8 20:58:33 2016 +1000 Fix call to deleted Any constructor A recent commit 6e70103d deleted some Any constructors and methods, and updated all the places where these had been called - except it looks like one call was missed, active only when building against Python 2. Adjust this call following what was done for the Python 3 case. Change-Id: I0f92b7476b617d9fdf0e5f698e363360497d115e Reviewed-on: https://gerrit.libreoffice.org/24759 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Stephan Bergmann <sberg...@redhat.com> diff --git a/pyuno/source/module/pyuno_runtime.cxx b/pyuno/source/module/pyuno_runtime.cxx index 0669360..468d21f 100644 --- a/pyuno/source/module/pyuno_runtime.cxx +++ b/pyuno/source/module/pyuno_runtime.cxx @@ -658,13 +658,11 @@ Any Runtime::pyObject2Any ( const PyRef & source, enum ConversionMode mode ) con { if( o == Py_True ) { -sal_Bool b = sal_True; -a = Any( , cppu::UnoType::get() ); +a <<= true; } else if ( o == Py_False ) { -sal_Bool b = sal_False; -a = Any( , cppu::UnoType::get() ); +a <<= false; } else { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sw/qa writerfilter/source
sw/qa/extras/ooxmlimport/data/headerfooter-link-to-prev.docx |binary sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 100 ++ writerfilter/source/dmapper/DomainMapper_Impl.cxx|4 writerfilter/source/dmapper/PropertyMap.cxx | 173 +++ writerfilter/source/dmapper/PropertyMap.hxx | 21 + 5 files changed, 244 insertions(+), 54 deletions(-) New commits: commit 7e9b5d9ba6bccdc75bfee4ddfd2f1582ea10746f Author: Luke Deller <l...@deller.id.au> Date: Sun Jan 3 23:12:56 2016 +1100 tdf#93640 Fix import of linked left page header/footer In a docx section, any header/footer which is not defined in the section is considered to be linked to the previous section. In the Word UI this is shown as an option named "Link to Previous", and editing the header/footer in either section affects both sections. LO imports this by copying the header/footer contents from the previous section, but it did not handle the case where a section had different headers for left pages vs right pages. Fix this, which involved changing the mechanism used to detect whether a section has defined a certain header/footer (which unlinks it from the previous section): rather than trying to figure it out from the converted LO page styles, explicitly track which headers/footers have been defined using boolean member variables on the SectionPropertyMap instance. Conflicts: sw/qa/extras/ooxmlimport/ooxmlimport.cxx Change-Id: Ic43a867356c2cd5df09d39f2a3ddefa584b6765c Reviewed-on: https://gerrit.libreoffice.org/24608 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk> diff --git a/sw/qa/extras/ooxmlimport/data/headerfooter-link-to-prev.docx b/sw/qa/extras/ooxmlimport/data/headerfooter-link-to-prev.docx new file mode 100644 index 000..cc4ddc8 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/headerfooter-link-to-prev.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index b336fcb..1c026e6 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -3108,6 +3108,106 @@ DECLARE_OOXMLIMPORT_TEST(testTdf99140, "tdf99140.docx") CPPUNIT_ASSERT_EQUAL(text::HoriOrientation::LEFT_AND_WIDTH, getProperty(xTableProperties, "HoriOrient")); } +// base class to supply a helper method for testHFLinkToPrev +class testHFBase : public Test +{ +protected: +OUString +getHFText(const uno::Reference& xPageStyle, + const OUString ) +{ +auto xTextRange = getProperty< uno::Reference >( +xPageStyle, sPropName); +return xTextRange->getString(); +} +}; + +DECLARE_SW_IMPORT_TEST(testHFLinkToPrev, "headerfooter-link-to-prev.docx", +testHFBase) +{ +uno::Reference xPageStyles = getStyles("PageStyles"); + +// get a page cursor +uno::Reference xModel(mxComponent, uno::UNO_QUERY); +uno::Reference xTextViewCursorSupplier( +xModel->getCurrentController(), uno::UNO_QUERY); +uno::Reference xCursor( +xTextViewCursorSupplier->getViewCursor(), uno::UNO_QUERY); + +// get LO page style for page 1, corresponding to docx section 1 first page +xCursor->jumpToFirstPage(); +OUString pageStyleName = getProperty(xCursor, "PageStyleName"); +uno::Reference xPageStyle( +xPageStyles->getByName(pageStyleName), uno::UNO_QUERY); +// check page 1 header & footer text +CPPUNIT_ASSERT_EQUAL(getHFText(xPageStyle, "HeaderText"), +OUString("First page header for all sections")); +CPPUNIT_ASSERT_EQUAL(getHFText(xPageStyle, "FooterText"), +OUString("First page footer for section 1 only")); + +// get LO page style for page 2, corresponding to docx section 1 +xCursor->jumpToPage(2); +pageStyleName = getProperty(xCursor, "PageStyleName"); +xPageStyle.set( xPageStyles->getByName(pageStyleName), uno::UNO_QUERY ); +// check header & footer text +CPPUNIT_ASSERT_EQUAL(getHFText(xPageStyle, "HeaderTextLeft"), +OUString("Even page header for section 1 only")); +CPPUNIT_ASSERT_EQUAL(getHFText(xPageStyle, "FooterTextLeft"), +OUString("Even page footer for all sections")); +CPPUNIT_ASSERT_EQUAL(getHFText(xPageStyle, "HeaderText"), +OUString("Odd page header for all sections")); +CPPUNIT_ASSERT_EQUAL(getHFText(xPageStyle, "FooterText"), +OUString("Odd page footer for section 1 only")); + +// get LO page style for page 4, corresponding to docx section 2 first page +xCursor->jumpToPage(4); +pageStyleName = g
[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sw/qa sw/source
sw/qa/extras/ww8export/data/tdf99474.odt |binary sw/qa/extras/ww8export/ww8export.cxx | 28 sw/source/filter/ww8/wrtw8nds.cxx| 16 ++-- sw/source/filter/ww8/ww8atr.cxx |2 -- 4 files changed, 34 insertions(+), 12 deletions(-) New commits: commit 5e5e155ddf467cdce2312fa16d0392900afc7355 Author: Luke Deller <l...@deller.id.au> Date: Wed Apr 27 02:09:48 2016 +1000 tdf#99474 close direct char fmt at end of para When exporting to doc, ensure that the FKP entry for direct character formatting is closed at the end of a paragraph, so that any direct character formatting in the next paragraph does not apply to the end-of-paragraph marker (CR). Also revert the changes for i#119650 and tdf#87437 which targetted more specific examples of this problem, as those issues should now be covered by this fix. Add a test case for the example from tdf#99474 Change-Id: I2cb482adb39a84f152707dafcb18f289ca0bd550 Reviewed-on: https://gerrit.libreoffice.org/24609 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk> diff --git a/sw/qa/extras/ww8export/data/tdf99474.odt b/sw/qa/extras/ww8export/data/tdf99474.odt new file mode 100644 index 000..7530488 Binary files /dev/null and b/sw/qa/extras/ww8export/data/tdf99474.odt differ diff --git a/sw/qa/extras/ww8export/ww8export.cxx b/sw/qa/extras/ww8export/ww8export.cxx index 53a1513..9cb4131 100644 --- a/sw/qa/extras/ww8export/ww8export.cxx +++ b/sw/qa/extras/ww8export/ww8export.cxx @@ -622,6 +622,34 @@ DECLARE_WW8EXPORT_TEST(testTdf94386, "tdf94386.odt") CPPUNIT_ASSERT((fSize.Width != lSize.Width) && (fSize.Height != lSize.Height)); } +DECLARE_WW8EXPORT_TEST(testTdf99474, "tdf99474.odt") +{ +// The bullet colour of paragraph #3 should be COL_AUTO +auto xPara = getParagraph(3); +uno::Reference xNumRules( +getProperty< uno::Reference >( +xPara, "NumberingRules"), +uno::UNO_QUERY); +int numLevel = getProperty(xPara, "NumberingLevel"); +uno::Sequence< beans::PropertyValue > aPropertyValues; +xNumRules->getByIndex(numLevel) >>= aPropertyValues; +OUString charStyleName; +for(int j = 0 ; j< aPropertyValues.getLength() ; ++j) +{ +auto aProp = aPropertyValues[j]; +if (aProp.Name == OUString("CharStyleName")) { +charStyleName = aProp.Value.get(); +break; +} +} +CPPUNIT_ASSERT(charStyleName.getLength()); +uno::Reference xStyle( +getStyles("CharacterStyles")->getByName(charStyleName), +uno::UNO_QUERY); +ColorData charColor = getProperty(xStyle, "CharColor"); +CPPUNIT_ASSERT_EQUAL(COL_AUTO, charColor); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx index e66e9d2..9b0b60c 100644 --- a/sw/source/filter/ww8/wrtw8nds.cxx +++ b/sw/source/filter/ww8/wrtw8nds.cxx @@ -2114,7 +2114,6 @@ void MSWordExportBase::OutputTextNode( const SwTextNode& rNode ) sal_Int32 nAktPos = 0; sal_Int32 const nEnd = aStr.getLength(); -bool bIsEndOfCell = false; bool bIncludeEndOfParaCRInRedlineProperties = false; sal_Int32 nOpenAttrWithRange = 0; OUString aStringForImage("\001"); @@ -2123,9 +2122,6 @@ void MSWordExportBase::OutputTextNode( const SwTextNode& rNode ) if ( pTextNodeInfo.get() != nullptr ) { pTextNodeInfoInner = pTextNodeInfo->getFirstInner(); -if ( pTextNodeInfoInner && pTextNodeInfoInner->isEndOfCell() ) { -bIsEndOfCell = true; -} } do { @@ -2329,11 +2325,6 @@ void MSWordExportBase::OutputTextNode( const SwTextNode& rNode ) } WriteCR( pTextNodeInfoInner ); - -if ( (0 != nEnd) && bIsEndOfCell ) -{ -AttrOutput().OutputFKP(true); -} } } } @@ -2361,7 +2352,12 @@ void MSWordExportBase::OutputTextNode( const SwTextNode& rNode ) "odd to see this happening, expected 0"); } -AttrOutput().OutputFKP(); +// !bIncludeEndOfParaCRInRedlineProperties implies we have just +// emitted a CR, in which case we want to pass force=true to +// OutputFKP to ensure that an FKP entry for direct character +// formatting is written even if empty, so that the next one will +// start after the CR. +AttrOutput().OutputFKP(!bIncludeEndOfParaCRInRedlineProperties); if (bTextAtr || bAttrWithRange || bIncludeE
[Libreoffice-commits] core.git: sw/qa sw/source
sw/qa/extras/ww8export/data/tdf99474.odt |binary sw/qa/extras/ww8export/ww8export.cxx | 28 sw/source/filter/ww8/wrtw8nds.cxx| 16 ++-- sw/source/filter/ww8/ww8atr.cxx |2 -- 4 files changed, 34 insertions(+), 12 deletions(-) New commits: commit 817c3b17fa57a7c4c4f80569bc00a21001fb6807 Author: Luke Deller <l...@deller.id.au> Date: Wed Apr 27 02:09:48 2016 +1000 tdf#99474 close direct char fmt at end of para When exporting to doc, ensure that the FKP entry for direct character formatting is closed at the end of a paragraph, so that any direct character formatting in the next paragraph does not apply to the end-of-paragraph marker (CR). Also revert the changes for i#119650 and tdf#87437 which targetted more specific examples of this problem, as those issues should now be covered by this fix. Add a test case for the example from tdf#99474 Change-Id: I2cb482adb39a84f152707dafcb18f289ca0bd550 Reviewed-on: https://gerrit.libreoffice.org/24402 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk> diff --git a/sw/qa/extras/ww8export/data/tdf99474.odt b/sw/qa/extras/ww8export/data/tdf99474.odt new file mode 100644 index 000..7530488 Binary files /dev/null and b/sw/qa/extras/ww8export/data/tdf99474.odt differ diff --git a/sw/qa/extras/ww8export/ww8export.cxx b/sw/qa/extras/ww8export/ww8export.cxx index 452c8c2..0d59e31 100644 --- a/sw/qa/extras/ww8export/ww8export.cxx +++ b/sw/qa/extras/ww8export/ww8export.cxx @@ -692,6 +692,34 @@ DECLARE_WW8EXPORT_TEST(testTdf94386, "tdf94386.odt") CPPUNIT_ASSERT((fSize.Width != lSize.Width) && (fSize.Height != lSize.Height)); } +DECLARE_WW8EXPORT_TEST(testTdf99474, "tdf99474.odt") +{ +// The bullet colour of paragraph #3 should be COL_AUTO +auto xPara = getParagraph(3); +uno::Reference xNumRules( +getProperty< uno::Reference >( +xPara, "NumberingRules"), +uno::UNO_QUERY); +int numLevel = getProperty(xPara, "NumberingLevel"); +uno::Sequence< beans::PropertyValue > aPropertyValues; +xNumRules->getByIndex(numLevel) >>= aPropertyValues; +OUString charStyleName; +for(int j = 0 ; j< aPropertyValues.getLength() ; ++j) +{ +auto aProp = aPropertyValues[j]; +if (aProp.Name == OUString("CharStyleName")) { +charStyleName = aProp.Value.get(); +break; +} +} +CPPUNIT_ASSERT(charStyleName.getLength()); +uno::Reference xStyle( +getStyles("CharacterStyles")->getByName(charStyleName), +uno::UNO_QUERY); +ColorData charColor = getProperty(xStyle, "CharColor"); +CPPUNIT_ASSERT_EQUAL(COL_AUTO, charColor); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx index 0ca9415..3bbb733 100644 --- a/sw/source/filter/ww8/wrtw8nds.cxx +++ b/sw/source/filter/ww8/wrtw8nds.cxx @@ -2111,7 +2111,6 @@ void MSWordExportBase::OutputTextNode( const SwTextNode& rNode ) sal_Int32 nAktPos = 0; sal_Int32 const nEnd = aStr.getLength(); -bool bIsEndOfCell = false; bool bIncludeEndOfParaCRInRedlineProperties = false; sal_Int32 nOpenAttrWithRange = 0; OUString aStringForImage("\001"); @@ -2120,9 +2119,6 @@ void MSWordExportBase::OutputTextNode( const SwTextNode& rNode ) if ( pTextNodeInfo.get() != nullptr ) { pTextNodeInfoInner = pTextNodeInfo->getFirstInner(); -if ( pTextNodeInfoInner && pTextNodeInfoInner->isEndOfCell() ) { -bIsEndOfCell = true; -} } do { @@ -2332,11 +2328,6 @@ void MSWordExportBase::OutputTextNode( const SwTextNode& rNode ) } WriteCR( pTextNodeInfoInner ); - -if ( (0 != nEnd) && bIsEndOfCell ) -{ -AttrOutput().OutputFKP(true); -} } } } @@ -2364,7 +2355,12 @@ void MSWordExportBase::OutputTextNode( const SwTextNode& rNode ) "odd to see this happening, expected 0"); } -AttrOutput().OutputFKP(); +// !bIncludeEndOfParaCRInRedlineProperties implies we have just +// emitted a CR, in which case we want to pass force=true to +// OutputFKP to ensure that an FKP entry for direct character +// formatting is written even if empty, so that the next one will +// start after the CR. +AttrOutput().OutputFKP(!bIncludeEndOfParaCRInRedlineProperties); if (bTextAtr || bAttrWithRange || bIncludeE
[Libreoffice-commits] core.git: 2 commits - sw/qa writerfilter/source
sw/qa/extras/ooxmlimport/data/headerfooter-link-to-prev.docx |binary sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 100 ++ sw/qa/extras/rtfimport/data/tdf96308-tabpos.rtf | 12 sw/qa/extras/rtfimport/rtfimport.cxx | 16 + writerfilter/source/dmapper/DomainMapper_Impl.cxx|4 writerfilter/source/dmapper/PropertyMap.cxx | 173 +++ writerfilter/source/dmapper/PropertyMap.hxx | 21 + writerfilter/source/rtftok/rtfdocumentimpl.cxx |2 8 files changed, 274 insertions(+), 54 deletions(-) New commits: commit faa767dbef7ee9a0a7ab80bf4ad0fb529cec54a8 Author: Luke Deller <l...@deller.id.au> Date: Sun Jan 3 23:12:56 2016 +1100 tdf#93640 Fix import of linked left page header/footer In a docx section, any header/footer which is not defined in the section is considered to be linked to the previous section. In the Word UI this is shown as an option named "Link to Previous", and editing the header/footer in either section affects both sections. LO imports this by copying the header/footer contents from the previous section, but it did not handle the case where a section had different headers for left pages vs right pages. Fix this, which involved changing the mechanism used to detect whether a section has defined a certain header/footer (which unlinks it from the previous section): rather than trying to figure it out from the converted LO page styles, explicitly track which headers/footers have been defined using boolean member variables on the SectionPropertyMap instance. Conflicts: sw/qa/extras/ooxmlimport/ooxmlimport.cxx Change-Id: Ic43a867356c2cd5df09d39f2a3ddefa584b6765c diff --git a/sw/qa/extras/ooxmlimport/data/headerfooter-link-to-prev.docx b/sw/qa/extras/ooxmlimport/data/headerfooter-link-to-prev.docx new file mode 100644 index 000..cc4ddc8 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/headerfooter-link-to-prev.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index fe67d76..a245be0 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -3047,6 +3047,106 @@ DECLARE_OOXMLIMPORT_TEST(testTdf95213, "tdf95213.docx") CPPUNIT_ASSERT_EQUAL(awt::FontWeight::NORMAL, getProperty(xStyle, "CharWeight")); } +// base class to supply a helper method for testHFLinkToPrev +class testHFBase : public Test +{ +protected: +OUString +getHFText(const uno::Reference& xPageStyle, + const OUString ) +{ +auto xTextRange = getProperty< uno::Reference >( +xPageStyle, sPropName); +return xTextRange->getString(); +} +}; + +DECLARE_SW_IMPORT_TEST(testHFLinkToPrev, "headerfooter-link-to-prev.docx", +testHFBase) +{ +uno::Reference xPageStyles = getStyles("PageStyles"); + +// get a page cursor +uno::Reference xModel(mxComponent, uno::UNO_QUERY); +uno::Reference xTextViewCursorSupplier( +xModel->getCurrentController(), uno::UNO_QUERY); +uno::Reference xCursor( +xTextViewCursorSupplier->getViewCursor(), uno::UNO_QUERY); + +// get LO page style for page 1, corresponding to docx section 1 first page +xCursor->jumpToFirstPage(); +OUString pageStyleName = getProperty(xCursor, "PageStyleName"); +uno::Reference xPageStyle( +xPageStyles->getByName(pageStyleName), uno::UNO_QUERY); +// check page 1 header & footer text +CPPUNIT_ASSERT_EQUAL(getHFText(xPageStyle, "HeaderText"), +OUString("First page header for all sections")); +CPPUNIT_ASSERT_EQUAL(getHFText(xPageStyle, "FooterText"), +OUString("First page footer for section 1 only")); + +// get LO page style for page 2, corresponding to docx section 1 +xCursor->jumpToPage(2); +pageStyleName = getProperty(xCursor, "PageStyleName"); +xPageStyle.set( xPageStyles->getByName(pageStyleName), uno::UNO_QUERY ); +// check header & footer text +CPPUNIT_ASSERT_EQUAL(getHFText(xPageStyle, "HeaderTextLeft"), +OUString("Even page header for section 1 only")); +CPPUNIT_ASSERT_EQUAL(getHFText(xPageStyle, "FooterTextLeft"), +OUString("Even page footer for all sections")); +CPPUNIT_ASSERT_EQUAL(getHFText(xPageStyle, "HeaderText"), +OUString("Odd page header for all sections")); +CPPUNIT_ASSERT_EQUAL(getHFText(xPageStyle, "FooterText"), +OUString("Odd page footer for section 1 only")); + +// get LO page style for page 4, corresponding to docx section 2 first page +xCursor->jumpToPag
[Python-Dev] crash bug in weakref_richcompare?
Hi I have come across some dubious code in Objects/weakrefobject.c which looks like a bug to me, but wanted to run it past others. This was discovered from looking at crash dumps from a multithreaded python app (using Python 2.7.9, but the same weakref code exists in 3.5 and hg tip). The code that worries me is at the end of the "weakref_richcompare" function: return PyObject_RichCompare(PyWeakref_GET_OBJECT(self), PyWeakref_GET_OBJECT(other), op); At this point the code has established that the referents are still alive, and it is trying to compare the referents. However it has not acquired a strong reference to the referents, so I think it is possible for one of them to be deleted half way through this comparison. This can lead to a crash, because PyObject_RichCompare assumes that the PyObject*'s it was passed will remain usable for the duration of the call. The crashes I have seen involve data corruption consistent with one of these PyObject's being deleted and the memory reused for something else, eg: 00 python27!try_3way_compare+0x15 [objects\object.c @ 712] 01 python27!try_3way_to_rich_compare+0xb [objects\object.c @ 901] 02 python27!do_richcmp+0x2c [objects\object.c @ 935] 03 python27!PyObject_RichCompare+0x99 [objects\object.c @ 982] 04 python27!weakref_richcompare+0x6a [objects\weakrefobject.c @ 212] (In this example v->ob_type was 0x5f637865 which is ASCII "exc_", not a valid pointer at all) Other places in weakrefobject.c seem to have a similar weakness, eg in weakref_hash and weakref_repr. I have not been able to produce a small test case to exhibit this crash, but from this inspection of the code it looks like a bug - am I understanding this correctly? Thanks, Luke. ** Important Note This email (including any attachments) contains information which is confidential and may be subject to legal privilege. If you are not the intended recipient you must not use, distribute or copy this email. If you have received this email in error please notify the sender immediately and delete this email. Any views expressed in this email are not necessarily the views of IRESS Limited. It is the duty of the recipient to virus scan and otherwise test the information provided before loading onto any computer system. IRESS Limited does not warrant that the information is free of a virus or any other defect or error. ** ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: Review backlog
On 16 Aug 2015, at 9:34 am, Ashod Nakashian ashnak...@gmail.com wrote: Another issue, is that for one review I had a +2 review and flattering comment, I was disappointed to realize that just rebasing (without any changes to the patch) clears the review status! Gerrit has a configuration option which allows review scores to be retained across a trivial rebase, and the documentation recommends enabling this for the CodeReview label. Is this worth considering? https://gerrit-documentation.storage.googleapis.com/Documentation/2.11.2/config-labels.html#label_copyAllScoresOnTrivialRebase https://gerrit-documentation.storage.googleapis.com/Documentation/2.11.2/config-labels.html#label_copyAllScoresOnTrivialRebase Regards, Luke.___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: Bad Jenkins Slave?
On 22 Feb 2015, at 4:50 pm, Norbert Thiebaud nthieb...@gmail.com wrote: PS: Windows 2012 somehow ended-up with a 'ghost' directory that no-one could delete not even Admin ( Windows these days is so secure than even Administrator does not have the permission to delete files yeah that is the symptom: 'Permission denied' whatever you try to do with that Directory...) Solution: Standard Microsoft Support Technique: Reboot. Hard to imagine that some people are running this crap on 'production' system The situation on Windows is not quite that bad. I’ve had to run Jenkins on Windows before, and it was a reoccurring problem that a failed or aborted build could leave some process running which held a file open within the Jenkins workspace preventing cleanup of the workspace. Our solution was to use SysInternals Process Explorer to locate which process had a file open within that directory, then kill that process. http://technet.microsoft.com/en-au/sysinternals/bb896653.aspx I wonder if we should script this at the start or end of the Jenkins build. The corresponding command-line tool for locating which process has a file open is called “handle”: https://technet.microsoft.com/en-au/sysinternals/bb896655.aspx For some precedent there is a TeamCity plugin which uses this approach: https://confluence.jetbrains.com/display/TCD9/Build+Files+Cleaner+%28Swabra%29 Regards, Luke. ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice
[Libreoffice-commits] core.git: vcl/unx
vcl/unx/glxtest.cxx | 16 1 file changed, 12 insertions(+), 4 deletions(-) New commits: commit 231e74be5ed724a18cc5867212270e46a8fda9bc Author: Luke Deller l...@deller.id.au Date: Fri Jan 16 01:14:54 2015 +1100 Fix warning about ignoring write() return val glibc declares write() with the warn_unused_result attribute, so we need to check the return value to avoid a compiler warning. (This warning only seems to occur when gcc optimizations are enabled) Change-Id: I31962aae63d0a12eecfe44bb7920a68b29c05d8a Reviewed-on: https://gerrit.libreoffice.org/13927 Reviewed-by: Caolán McNamara caol...@redhat.com Tested-by: Caolán McNamara caol...@redhat.com diff --git a/vcl/unx/glxtest.cxx b/vcl/unx/glxtest.cxx index 8b9408d..75022b6 100644 --- a/vcl/unx/glxtest.cxx +++ b/vcl/unx/glxtest.cxx @@ -73,8 +73,12 @@ static func_ptr_type cast(void *ptr) static void fatal_error(const char *str) { - write(write_end_of_the_pipe, str, strlen(str)); - write(write_end_of_the_pipe, \n, 1); + int length = strlen(str); + if (write(write_end_of_the_pipe, str, length) != length + || write(write_end_of_the_pipe, \n, 1) != 1) + { + /* Cannot write to pipe. Fall through to call _exit */ + } _exit(EXIT_FAILURE); } @@ -88,7 +92,10 @@ x_error_handler(Display *, XErrorEvent *ev) ev-error_code, ev-request_code, ev-minor_code); - write(write_end_of_the_pipe, buf, length); + if (write(write_end_of_the_pipe, buf, length) != length) + { + /* Cannot write to pipe. Fall through to call _exit */ + } _exit(EXIT_FAILURE); return 0; } @@ -233,7 +240,8 @@ void glxtest() dlclose(libgl); / Finally write data to the pipe - write(write_end_of_the_pipe, buf, length); + if (write(write_end_of_the_pipe, buf, length) != length) +fatal_error(Could not write to pipe); } /** \returns true in the child glxtest process, false in the parent process */ ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
enabling optimizations (-Og) with --enable-debug
Hi, I saw that gcc-4.8 introduced a new optimization level -Og which enables optimizations that do not interfere with debugging. Yesterday I floated the idea on IRC of using this with --enable-debug rather than -O0 if available, and some feedback was that it enables gcc to report extra warnings which would be a good thing. I tried it out and can see that it does indeed break the build if --enable-werror is enabled, eg: /home/deller/build/libo/vcl/unx/glxtest.cxx: In function ‘void glxtest()’: /home/deller/build/libo/vcl/unx/glxtest.cxx:236:44: error: ignoring return value of ‘ssize_t write(int, const void*, size_t)’, declared with attribute warn_unused_result [-Werror=unused-result] write(write_end_of_the_pipe, buf, length); So I guess this means we couldn't incorporate -Og until all these new warnings are fixed right? Any other thoughts on whether this is a good idea to pursue? One fear was that it might slow down compilation, but it doesn't actually seem to slow down make clean make much at all for me. I'll get some proper timing measurements. (A draft patch is attached to enable -Og if available) Regards, Luke. commit 46809cf5731ae9d2ccbe22b38865242779658225 Author: Luke Deller l...@deller.id.au Date: Wed Jan 14 23:48:36 2015 +1100 enable optimization (-Og) with --enable-debug gcc-4.8 introduced a new optimization level -Og which enables optimizations that do not interfere with debugging. When configured with --enable-debug, use -Og rather than -O0 if available. Change-Id: Iff3f98d736681ae34e49b96510228a14ce456b34 diff --git a/config_host.mk.in b/config_host.mk.in index 26e38ea..131b348 100644 --- a/config_host.mk.in +++ b/config_host.mk.in @@ -247,6 +247,7 @@ export HAVE_GCC_FNO_DEFAULT_INLINE=@HAVE_GCC_FNO_DEFAULT_INLINE@ export HAVE_GCC_FNO_ENFORCE_EH_SPECS=@HAVE_GCC_FNO_ENFORCE_EH_SPECS@ export HAVE_GCC_FNO_INLINE=@HAVE_GCC_FNO_INLINE@ export HAVE_GCC_GGDB2=@HAVE_GCC_GGDB2@ +export HAVE_GCC_OG=@HAVE_GCC_OG@ export HAVE_GCC_PRAGMA_OPERATOR=@HAVE_GCC_PRAGMA_OPERATOR@ export HAVE_GCC_VISIBILITY_BROKEN=@HAVE_GCC_VISIBILITY_BROKEN@ export HAVE_GCC_VISIBILITY_FEATURE=@HAVE_GCC_VISIBILITY_FEATURE@ diff --git a/configure.ac b/configure.ac index ac3dc4e..449ce54 100644 --- a/configure.ac +++ b/configure.ac @@ -3223,6 +3223,7 @@ AC_SUBST(GCC_VERSION) HAVE_GCC_GGDB2= HAVE_GCC_FINLINE_LIMIT= HAVE_GCC_FNO_INLINE= +HAVE_GCC_OG= if test $GCC = yes; then AC_MSG_CHECKING([whether $CC supports -ggdb2]) if test -n $CLANGVER -a 0$CLANGVER -le 30100; then @@ -3272,10 +3273,24 @@ if test $GCC = yes; then else AC_MSG_RESULT([no]) fi + +AC_MSG_CHECKING([whether $CC supports -Og]) +# Note that clang-3.1 reports a real error for this option +# so we do not need a special case for clang=3.1 as above. +save_CFLAGS=$CFLAGS +CFLAGS=$CFLAGS -Werror -Og +AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_OG=TRUE ],[]) +CFLAGS=$save_CFLAGS +if test $HAVE_GCC_OG = TRUE; then +AC_MSG_RESULT([yes]) +else +AC_MSG_RESULT([no]) +fi fi AC_SUBST(HAVE_GCC_GGDB2) AC_SUBST(HAVE_GCC_FINLINE_LIMIT) AC_SUBST(HAVE_GCC_FNO_INLINE) +AC_SUBST(HAVE_GCC_OG) HAVE_LD_BSYMBOLIC_FUNCTIONS= if test $GCC = yes; then diff --git a/solenv/gbuild/platform/com_GCC_defs.mk b/solenv/gbuild/platform/com_GCC_defs.mk index 7acd068..715bd54 100644 --- a/solenv/gbuild/platform/com_GCC_defs.mk +++ b/solenv/gbuild/platform/com_GCC_defs.mk @@ -139,7 +139,13 @@ endif gb_PrecompiledHeader_EXCEPTIONFLAGS := $(gb_LinkTarget_EXCEPTIONFLAGS) # optimization level +# Use -Og if available (gcc-4.8+), which enables optimizations that do not +# interfere with debugging. +ifeq ($(HAVE_GCC_OG),TRUE) +gb_COMPILERNOOPTFLAGS := -Og -fstrict-aliasing -fstrict-overflow +else gb_COMPILERNOOPTFLAGS := -O0 -fstrict-aliasing -fstrict-overflow +endif # Clang does not know -ggdb2 or some other options ifeq ($(HAVE_GCC_GGDB2),TRUE) ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: Anti-Virus vendors warnings
On 01/10/14 19:55, Michael Meeks wrote: Ideally we could find a reproducer that we could check during configure and print out: You have a (typically) rubbish AV product installed - please un-install and or disable it ;-) I think this is not about AV products being rubbish. The LibreOffice source contains over 100 test documents named CVE-*, for example: sw/qa/core/data/ww8/pass/CVE-2012-4886-1.doc sw/qa/core/data/odt/pass/CVE-2012-4233-1.odt These appear to be documents which target known security vulnerabilities in LibreOffice or other software. I have experienced build failures on Windows caused by real time protection antivirus software blocking access to such files. It would seem to be quite reasonable for antivirus software to do that. ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice
[Libreoffice-commits] core.git: Changes to 'refs/changes/59/8759/3'
___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Changes to 'refs/changes/59/8759/1'
___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Changes to 'refs/changes/59/8759/2'
___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Changes to 'refs/changes/85/8885/1'
___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Changes to 'refs/changes/86/1386/1'
___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Changes to 'refs/changes/85/8885/2'
___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Changes to 'refs/changes/46/8646/1'
___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Changes to 'refs/changes/08/4008/2'
___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Changes to 'refs/changes/01/2601/2'
___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Changes to 'refs/changes/08/4008/1'
___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Changes to 'refs/changes/87/1387/1'
___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Changes to 'refs/changes/62/3662/1'
___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Changes to 'refs/changes/96/3596/2'
___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Changes to 'refs/changes/62/2062/2'
___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Changes to 'refs/changes/35/10235/2'
___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Changes to 'refs/changes/62/3662/2'
___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Changes to 'refs/changes/96/3596/1'
___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Changes to 'refs/changes/46/8646/2'
___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Changes to 'refs/changes/91/10191/1'
___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Changes to 'refs/changes/62/2062/1'
___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Changes to 'refs/changes/35/10235/3'
___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Changes to 'refs/changes/80/8780/1'
___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Changes to 'refs/changes/84/8884/1'
___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Changes to 'refs/changes/84/8884/2'
___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Changes to 'refs/changes/35/10235/1'
___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Changes to 'refs/changes/62/2062/3'
___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Changes to 'refs/changes/81/8781/1'
___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Changes to 'refs/changes/37/2137/1'
___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Changes to 'refs/changes/81/8781/2'
___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Changes to 'refs/changes/65/2065/1'
___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Changes to 'refs/changes/45/10145/1'
___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Changes to 'refs/changes/35/10335/5'
___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Changes to 'refs/changes/35/10335/2'
___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Changes to 'refs/changes/35/10335/3'
___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Changes to 'refs/changes/37/2137/2'
___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Changes to 'refs/changes/65/2065/2'
___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Changes to 'refs/changes/35/10335/4'
___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Changes to 'refs/changes/35/10335/1'
___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Changes to 'refs/changes/44/1244/2'
___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Changes to 'refs/changes/68/10168/1'
___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Changes to 'refs/changes/70/1170/2'
___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Changes to 'refs/changes/55/4055/1'
___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits