[Libreoffice-commits] core.git: Branch 'distro/escriba/escriba-5.4' - 9 commits - offapi/com solenv/gbuild sw/inc sw/qa sw/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Mon Aug 13 12:49:47 UTC 2018
offapi/com/sun/star/text/TextRangeContentProperties.idl | 6 +
solenv/gbuild/platform/filter-showIncludes.awk | 7 +
sw/inc/cmdid.h | 1
sw/inc/unoprnms.hxx | 1
sw/qa/extras/uiwriter/data/paragraph-of-text-range.odt |binary
sw/qa/extras/uiwriter/data/table-in-sect.odt |binary
sw/qa/extras/uiwriter/data/tdf108524.odt |binary
sw/qa/extras/uiwriter/uiwriter.cxx | 59 ++++++++++++++++
sw/source/core/inc/cellfrm.hxx | 1
sw/source/core/layout/findfrm.cxx | 15 +---
sw/source/core/layout/tabfrm.cxx | 27 +++++++
sw/source/core/unocore/unocrsrhelper.cxx | 13 +++
sw/source/core/unocore/unomapproperties.hxx | 1
13 files changed, 121 insertions(+), 10 deletions(-)
New commits:
commit efaf2d6eb9342d83a9dc1fa93476ff3b61df6b0d
Author: Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Mon Jun 26 17:31:36 2017 +0200
Commit: Miklos Vajna <vmiklos at collabora.co.uk>
CommitDate: Mon Aug 13 14:44:13 2018 +0200
Avoid loplugin:unreffun
...after 272d5a02a3de2350f8af7a93281b651316b24ae5 "Revert 'tdf#108524 sw:
attempt to split section frames inside table cells'"
(cherry picked from commit 12ca907139c05ded23cb22aab2e03a52645adfa0)
Conflicts:
sw/qa/extras/uiwriter/uiwriter.cxx
Change-Id: Ic1ec8cd3284e2ba98630552c80d99b5d67fc7efd
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index 8d41d1ec21bd..d1e2cbd8ef2c 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -253,7 +253,9 @@ public:
void testTdf107976();
void testTdf113790();
void testParagraphOfTextRange();
+#if 0
void testTdf108524();
+#endif
void testTableInSection();
CPPUNIT_TEST_SUITE(SwUiWriterTest);
@@ -395,7 +397,9 @@ public:
CPPUNIT_TEST(testTdf107976);
CPPUNIT_TEST(testTdf113790);
CPPUNIT_TEST(testParagraphOfTextRange);
-// CPPUNIT_TEST(testTdf108524);
+#if 0
+ CPPUNIT_TEST(testTdf108524);
+#endif
CPPUNIT_TEST(testTableInSection);
CPPUNIT_TEST_SUITE_END();
@@ -5050,6 +5054,7 @@ void SwUiWriterTest::testParagraphOfTextRange()
CPPUNIT_ASSERT_EQUAL(OUString("In section"), xParagraph->getString());
}
+#if 0
void SwUiWriterTest::testTdf108524()
{
createDoc("tdf108524.odt");
@@ -5062,6 +5067,7 @@ void SwUiWriterTest::testTdf108524()
// and it was cut off.
assertXPath(pXmlDoc, "/root/page[2]/body/tab/row/cell/section", 1);
}
+#endif
void SwUiWriterTest::testTableInSection()
{
commit 427452557ed6852dcd0a3485ae9b7456bc316f0f
Author: Michael Stahl <mstahl at redhat.com>
AuthorDate: Mon Jun 26 15:01:36 2017 +0200
Commit: Miklos Vajna <vmiklos at collabora.co.uk>
CommitDate: Mon Aug 13 14:44:10 2018 +0200
Revert "tdf#108524 sw: attempt to split section frames inside table cells"
This reverts commit f991b842addddeada6dc45c4054deeca5aa7f17b.
It doesn't really work and crashes on ooo61225-1.sxw in
1 in SwFrame::FindTabFrame() (this=0x0) at sw/source/core/inc/frame.hxx:913
2 in SwFrame::GetNextSctLeaf(MakePageType) (this=0x3137130, eMakePage=MAKEPAGE_INSERT) at sw/source/core/layout/sectfrm.cxx:1529
3 in SwFrame::GetLeaf(MakePageType, bool) (this=0x3137130, eMakePage=MAKEPAGE_INSERT, bFwd=true) at sw/source/core/layout/flowfrm.cxx:805
4 in SwFlowFrame::MoveFwd(bool, bool, bool) (this=0x31371d8, bMakePage=true, bPageBreak=false, bMoveAlways=false) at sw/source/core/layout/flowfrm.cxx:1861
The code added in GetNextSctLeaf() looks unfinished to me: it assumes that
something else has added a follow-frame for the SwCellFrame containing
the SwSectionFrame already, but AFAICT the GetNextSctLeaf() function
is responsible for creating that SwCellFrame follow.
The caller (in GetLeaf()) specifically checks for this condition and
avoids calling GetNextCellLeaf().
(cherry picked from commit 272d5a02a3de2350f8af7a93281b651316b24ae5)
Conflicts:
sw/qa/extras/uiwriter/uiwriter.cxx
Change-Id: I51875830771f07f5d2fec293f6063c73fc68d468
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index 77d7894e1454..8d41d1ec21bd 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -395,7 +395,7 @@ public:
CPPUNIT_TEST(testTdf107976);
CPPUNIT_TEST(testTdf113790);
CPPUNIT_TEST(testParagraphOfTextRange);
- CPPUNIT_TEST(testTdf108524);
+// CPPUNIT_TEST(testTdf108524);
CPPUNIT_TEST(testTableInSection);
CPPUNIT_TEST_SUITE_END();
diff --git a/sw/source/core/inc/frame.hxx b/sw/source/core/inc/frame.hxx
index 182ec015d426..e4c3ddb82d25 100644
--- a/sw/source/core/inc/frame.hxx
+++ b/sw/source/core/inc/frame.hxx
@@ -41,7 +41,6 @@ class SwFootnoteFrame;
class SwFootnoteBossFrame;
class SwTabFrame;
class SwRowFrame;
-class SwCellFrame;
class SwFlowFrame;
class SwContentFrame;
class SfxPoolItem;
@@ -224,7 +223,6 @@ class SW_DLLPUBLIC SwFrame: public SwClient, public SfxBroadcaster
const SwLayoutFrame* ImplGetNextLayoutLeaf( bool bFwd ) const;
SwPageFrame* ImplFindPageFrame();
- SwCellFrame* ImplFindCellFrame();
protected:
SwSortedObjs* mpDrawObjs; // draw objects, can be 0
@@ -765,12 +763,6 @@ public:
virtual void dumpAsXmlAttributes(xmlTextWriterPtr writer) const;
void dumpChildrenAsXml(xmlTextWriterPtr writer) const;
bool IsCollapse() const;
-
- /// Find the nearest table cell frame that contains us, if any.
- SwCellFrame* FindCellFrame()
- {
- return IsInTab() ? ImplFindCellFrame() : nullptr;
- }
};
inline bool SwFrame::IsInDocBody() const
diff --git a/sw/source/core/layout/findfrm.cxx b/sw/source/core/layout/findfrm.cxx
index df630a270c5c..74942256bef4 100644
--- a/sw/source/core/layout/findfrm.cxx
+++ b/sw/source/core/layout/findfrm.cxx
@@ -459,18 +459,6 @@ SwTabFrame* SwFrame::ImplFindTabFrame()
return static_cast<SwTabFrame*>(pRet);
}
-SwCellFrame* SwFrame::ImplFindCellFrame()
-{
- SwFrame *pRet = this;
- while (!pRet->IsCellFrame())
- {
- pRet = pRet->GetUpper();
- if (!pRet)
- return nullptr;
- }
- return static_cast<SwCellFrame*>(pRet);
-}
-
SwSectionFrame* SwFrame::ImplFindSctFrame()
{
SwFrame *pRet = this;
diff --git a/sw/source/core/layout/sectfrm.cxx b/sw/source/core/layout/sectfrm.cxx
index 650345a11bf0..7dd2e43a976c 100644
--- a/sw/source/core/layout/sectfrm.cxx
+++ b/sw/source/core/layout/sectfrm.cxx
@@ -22,7 +22,6 @@
#include <fmtftn.hxx>
#include <fmtclbl.hxx>
#include "sectfrm.hxx"
-#include "cellfrm.hxx"
#include "section.hxx"
#include <IDocumentSettingAccess.hxx>
#include "rootfrm.hxx"
@@ -588,16 +587,6 @@ namespace
return pLayFrame->GetNextLayoutLeaf();
return pLayFrame;
}
-
- /// Checks if pFrame is in a table, which itself is in a section.
- bool IsInTableInSection(SwFrame* pFrame)
- {
- if (!pFrame->IsInTab())
- return false;
-
- // The frame is in a table, see if the table is in a section.
- return pFrame->FindTabFrame()->IsInSct();
- }
}
void SwSectionFrame::MoveContentAndDelete( SwSectionFrame* pDel, bool bSave )
@@ -1450,9 +1439,9 @@ SwLayoutFrame *SwFrame::GetNextSctLeaf( MakePageType eMakePage )
return static_cast<SwLayoutFrame*>(static_cast<SwLayoutFrame*>(GetUpper()->GetNext())->Lower());
if( GetUpper()->IsColBodyFrame() && GetUpper()->GetUpper()->GetNext() )
return static_cast<SwLayoutFrame*>(static_cast<SwLayoutFrame*>(GetUpper()->GetUpper()->GetNext())->Lower());
- // Inside a table-in-section, or sections of headers/footers, there can be only
+ // Inside a section, in tables, or sections of headers/footers, there can be only
// one column shift be made, one of the above shortcuts should have applied!
- if( IsInTableInSection(GetUpper()) || FindFooterOrHeader() )
+ if( GetUpper()->IsInTab() || FindFooterOrHeader() )
return nullptr;
SwSectionFrame *pSect = FindSctFrame();
@@ -1509,9 +1498,6 @@ SwLayoutFrame *SwFrame::GetNextSctLeaf( MakePageType eMakePage )
const bool bBody = IsInDocBody();
const bool bFootnotePage = FindPageFrame()->IsFootnotePage();
- // The "pLayLeaf is in a table" case is rejected by default, so that it
- // can't happen that we try to move a table to one of its own cells.
- bool bLayLeafTableAllowed = false;
SwLayoutFrame *pLayLeaf;
// A shortcut for TabFrames such that not all cells need to be visited
if( bWrongPage )
@@ -1521,16 +1507,6 @@ SwLayoutFrame *SwFrame::GetNextSctLeaf( MakePageType eMakePage )
SwContentFrame* pTmpCnt = static_cast<SwTabFrame*>(this)->FindLastContent();
pLayLeaf = pTmpCnt ? pTmpCnt->GetUpper() : nullptr;
}
- else if (IsInTab() && !IsInTableInSection(this))
- {
- // This frame is in a table-not-in-section, its follow should be
- // inserted under the follow of the frame's cell.
- pLayLeaf = FindCellFrame()->GetFollowCell();
- if (pLayLeaf->FindTabFrame() == FindTabFrame())
- SAL_WARN("sw.layout", "my table frame and my follow's table frame is the same");
- // In this case pLayLeaf pointing to an in-table frame is OK.
- bLayLeafTableAllowed = true;
- }
else
{
pLayLeaf = GetNextLayoutLeaf();
@@ -1558,10 +1534,10 @@ SwLayoutFrame *SwFrame::GetNextSctLeaf( MakePageType eMakePage )
pLayLeaf = nullptr;
continue;
}
- // Once inBody always inBody, don't step into tables-in-sections and not into other sections
+ // Once inBody always inBody, don't step into tables and not into other sections
if ( (bBody && !pLayLeaf->IsInDocBody()) ||
(IsInFootnote() != pLayLeaf->IsInFootnote() ) ||
- (pLayLeaf->IsInTab() && !bLayLeafTableAllowed) ||
+ pLayLeaf->IsInTab() ||
( pLayLeaf->IsInSct() && ( !pSect->HasFollow()
|| pSect->GetFollow() != pLayLeaf->FindSctFrame() ) ) )
{
commit 64f35d448621778d54affcb3a70aee5fd5fd8d4d
Author: Miklos Vajna <vmiklos at collabora.co.uk>
AuthorDate: Tue Jun 20 09:21:10 2017 +0200
Commit: Miklos Vajna <vmiklos at collabora.co.uk>
CommitDate: Mon Aug 13 14:44:07 2018 +0200
tdf#108524 sw: add split section in table testcase
And if we're at it, test the other way around as well, I almost broke
it.
Reviewed-on: https://gerrit.libreoffice.org/38999
Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
Tested-by: Jenkins <ci at libreoffice.org>
(cherry picked from commit e9d2016648c7fdfc57932ac0793547cf099749be)
Conflicts:
sw/qa/extras/uiwriter/uiwriter.cxx
Change-Id: Ia81e46f218336e5db13dafdbad7b896d8dadaf46
diff --git a/sw/qa/extras/uiwriter/data/table-in-sect.odt b/sw/qa/extras/uiwriter/data/table-in-sect.odt
new file mode 100644
index 000000000000..f439edef997e
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/table-in-sect.odt differ
diff --git a/sw/qa/extras/uiwriter/data/tdf108524.odt b/sw/qa/extras/uiwriter/data/tdf108524.odt
new file mode 100644
index 000000000000..d8978b269cab
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf108524.odt differ
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index 8186316b3742..77d7894e1454 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -253,6 +253,8 @@ public:
void testTdf107976();
void testTdf113790();
void testParagraphOfTextRange();
+ void testTdf108524();
+ void testTableInSection();
CPPUNIT_TEST_SUITE(SwUiWriterTest);
CPPUNIT_TEST(testReplaceForward);
@@ -393,6 +395,8 @@ public:
CPPUNIT_TEST(testTdf107976);
CPPUNIT_TEST(testTdf113790);
CPPUNIT_TEST(testParagraphOfTextRange);
+ CPPUNIT_TEST(testTdf108524);
+ CPPUNIT_TEST(testTableInSection);
CPPUNIT_TEST_SUITE_END();
private:
@@ -5046,6 +5050,32 @@ void SwUiWriterTest::testParagraphOfTextRange()
CPPUNIT_ASSERT_EQUAL(OUString("In section"), xParagraph->getString());
}
+void SwUiWriterTest::testTdf108524()
+{
+ createDoc("tdf108524.odt");
+ xmlDocPtr pXmlDoc = parseLayoutDump();
+ // In total we expect two cells containing a section.
+ assertXPath(pXmlDoc, "/root/page/body/tab/row/cell/section", 2);
+
+ assertXPath(pXmlDoc, "/root/page[1]/body/tab/row/cell/section", 1);
+ // This was 0, section wasn't split, instead it was only on the first page
+ // and it was cut off.
+ assertXPath(pXmlDoc, "/root/page[2]/body/tab/row/cell/section", 1);
+}
+
+void SwUiWriterTest::testTableInSection()
+{
+ // The document has a section, containing a table that spans over 2 pages.
+ createDoc("table-in-sect.odt");
+ xmlDocPtr pXmlDoc = parseLayoutDump();
+ // In total we expect 4 cells.
+ assertXPath(pXmlDoc, "/root/page/body/section/tab/row/cell", 4);
+
+ // Assert that on both pages the section contains 2 cells.
+ assertXPath(pXmlDoc, "/root/page[1]/body/section/tab/row/cell", 2);
+ assertXPath(pXmlDoc, "/root/page[2]/body/section/tab/row/cell", 2);
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest);
CPPUNIT_PLUGIN_IMPLEMENT();
commit bf9a67ee8178fcee51dbaceef4496585be1c34b9
Author: Miklos Vajna <vmiklos at collabora.co.uk>
AuthorDate: Mon Jun 19 15:24:12 2017 +0200
Commit: Miklos Vajna <vmiklos at collabora.co.uk>
CommitDate: Mon Aug 13 14:43:58 2018 +0200
tdf#108524 sw: attempt to split section frames inside table cells
Tables-in-sections were already split across multiple pages, but not
secions-in-tables. To be safe still don't allow
sections-in-tables-in-sections, so you can combine these in both orders
now, but not recursively.
To achieve this, relax two "not in table" conditions to just require
"not in a table that is already in a section", and define that in case a
section-in-table is to be split, the follow section frame should be
inserted under the follow of its cell.
With this, finally the section frame in the bugdoc is split into two,
and the second section frame is moved to the second page as expected.
Change-Id: I16ebb2d30870b145a2378d46603324ab267b0dd3
Reviewed-on: https://gerrit.libreoffice.org/38965
Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
Tested-by: Jenkins <ci at libreoffice.org>
(cherry picked from commit f991b842addddeada6dc45c4054deeca5aa7f17b)
diff --git a/sw/source/core/inc/frame.hxx b/sw/source/core/inc/frame.hxx
index e4c3ddb82d25..182ec015d426 100644
--- a/sw/source/core/inc/frame.hxx
+++ b/sw/source/core/inc/frame.hxx
@@ -41,6 +41,7 @@ class SwFootnoteFrame;
class SwFootnoteBossFrame;
class SwTabFrame;
class SwRowFrame;
+class SwCellFrame;
class SwFlowFrame;
class SwContentFrame;
class SfxPoolItem;
@@ -223,6 +224,7 @@ class SW_DLLPUBLIC SwFrame: public SwClient, public SfxBroadcaster
const SwLayoutFrame* ImplGetNextLayoutLeaf( bool bFwd ) const;
SwPageFrame* ImplFindPageFrame();
+ SwCellFrame* ImplFindCellFrame();
protected:
SwSortedObjs* mpDrawObjs; // draw objects, can be 0
@@ -763,6 +765,12 @@ public:
virtual void dumpAsXmlAttributes(xmlTextWriterPtr writer) const;
void dumpChildrenAsXml(xmlTextWriterPtr writer) const;
bool IsCollapse() const;
+
+ /// Find the nearest table cell frame that contains us, if any.
+ SwCellFrame* FindCellFrame()
+ {
+ return IsInTab() ? ImplFindCellFrame() : nullptr;
+ }
};
inline bool SwFrame::IsInDocBody() const
diff --git a/sw/source/core/layout/findfrm.cxx b/sw/source/core/layout/findfrm.cxx
index 74942256bef4..df630a270c5c 100644
--- a/sw/source/core/layout/findfrm.cxx
+++ b/sw/source/core/layout/findfrm.cxx
@@ -459,6 +459,18 @@ SwTabFrame* SwFrame::ImplFindTabFrame()
return static_cast<SwTabFrame*>(pRet);
}
+SwCellFrame* SwFrame::ImplFindCellFrame()
+{
+ SwFrame *pRet = this;
+ while (!pRet->IsCellFrame())
+ {
+ pRet = pRet->GetUpper();
+ if (!pRet)
+ return nullptr;
+ }
+ return static_cast<SwCellFrame*>(pRet);
+}
+
SwSectionFrame* SwFrame::ImplFindSctFrame()
{
SwFrame *pRet = this;
diff --git a/sw/source/core/layout/sectfrm.cxx b/sw/source/core/layout/sectfrm.cxx
index 7dd2e43a976c..650345a11bf0 100644
--- a/sw/source/core/layout/sectfrm.cxx
+++ b/sw/source/core/layout/sectfrm.cxx
@@ -22,6 +22,7 @@
#include <fmtftn.hxx>
#include <fmtclbl.hxx>
#include "sectfrm.hxx"
+#include "cellfrm.hxx"
#include "section.hxx"
#include <IDocumentSettingAccess.hxx>
#include "rootfrm.hxx"
@@ -587,6 +588,16 @@ namespace
return pLayFrame->GetNextLayoutLeaf();
return pLayFrame;
}
+
+ /// Checks if pFrame is in a table, which itself is in a section.
+ bool IsInTableInSection(SwFrame* pFrame)
+ {
+ if (!pFrame->IsInTab())
+ return false;
+
+ // The frame is in a table, see if the table is in a section.
+ return pFrame->FindTabFrame()->IsInSct();
+ }
}
void SwSectionFrame::MoveContentAndDelete( SwSectionFrame* pDel, bool bSave )
@@ -1439,9 +1450,9 @@ SwLayoutFrame *SwFrame::GetNextSctLeaf( MakePageType eMakePage )
return static_cast<SwLayoutFrame*>(static_cast<SwLayoutFrame*>(GetUpper()->GetNext())->Lower());
if( GetUpper()->IsColBodyFrame() && GetUpper()->GetUpper()->GetNext() )
return static_cast<SwLayoutFrame*>(static_cast<SwLayoutFrame*>(GetUpper()->GetUpper()->GetNext())->Lower());
- // Inside a section, in tables, or sections of headers/footers, there can be only
+ // Inside a table-in-section, or sections of headers/footers, there can be only
// one column shift be made, one of the above shortcuts should have applied!
- if( GetUpper()->IsInTab() || FindFooterOrHeader() )
+ if( IsInTableInSection(GetUpper()) || FindFooterOrHeader() )
return nullptr;
SwSectionFrame *pSect = FindSctFrame();
@@ -1498,6 +1509,9 @@ SwLayoutFrame *SwFrame::GetNextSctLeaf( MakePageType eMakePage )
const bool bBody = IsInDocBody();
const bool bFootnotePage = FindPageFrame()->IsFootnotePage();
+ // The "pLayLeaf is in a table" case is rejected by default, so that it
+ // can't happen that we try to move a table to one of its own cells.
+ bool bLayLeafTableAllowed = false;
SwLayoutFrame *pLayLeaf;
// A shortcut for TabFrames such that not all cells need to be visited
if( bWrongPage )
@@ -1507,6 +1521,16 @@ SwLayoutFrame *SwFrame::GetNextSctLeaf( MakePageType eMakePage )
SwContentFrame* pTmpCnt = static_cast<SwTabFrame*>(this)->FindLastContent();
pLayLeaf = pTmpCnt ? pTmpCnt->GetUpper() : nullptr;
}
+ else if (IsInTab() && !IsInTableInSection(this))
+ {
+ // This frame is in a table-not-in-section, its follow should be
+ // inserted under the follow of the frame's cell.
+ pLayLeaf = FindCellFrame()->GetFollowCell();
+ if (pLayLeaf->FindTabFrame() == FindTabFrame())
+ SAL_WARN("sw.layout", "my table frame and my follow's table frame is the same");
+ // In this case pLayLeaf pointing to an in-table frame is OK.
+ bLayLeafTableAllowed = true;
+ }
else
{
pLayLeaf = GetNextLayoutLeaf();
@@ -1534,10 +1558,10 @@ SwLayoutFrame *SwFrame::GetNextSctLeaf( MakePageType eMakePage )
pLayLeaf = nullptr;
continue;
}
- // Once inBody always inBody, don't step into tables and not into other sections
+ // Once inBody always inBody, don't step into tables-in-sections and not into other sections
if ( (bBody && !pLayLeaf->IsInDocBody()) ||
(IsInFootnote() != pLayLeaf->IsInFootnote() ) ||
- pLayLeaf->IsInTab() ||
+ (pLayLeaf->IsInTab() && !bLayLeafTableAllowed) ||
( pLayLeaf->IsInSct() && ( !pSect->HasFollow()
|| pSect->GetFollow() != pLayLeaf->FindSctFrame() ) ) )
{
commit fd2c8008a557f9f81df9485a48435c7118abae40
Author: Miklos Vajna <vmiklos at collabora.co.uk>
AuthorDate: Fri Jun 16 08:35:05 2017 +0200
Commit: Miklos Vajna <vmiklos at collabora.co.uk>
CommitDate: Mon Aug 13 14:15:54 2018 +0200
tdf#108524 sw: allow move of frame inside section without columns
The intention here is to deny the move of a frame that's inside a table
inside a section. But the code also checked if there a column frame
in-between, so it allowed the move for a frame in a section with 2 cols,
but not without columns (which does not sound intentional, since that's
a simpler case). So drop the requirement to have a column frame between
the argument and the section frame, just check that there is no table
frame in between.
This is needed, but not enough to split the section in the bugdoc (but
at least now the content of the section is marked as movable).
Change-Id: I9155b291a19c692efc30f01f8e206fac5f1ccf81
Reviewed-on: https://gerrit.libreoffice.org/38858
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
(cherry picked from commit 6ade80cf142664e78954c7544534e9436ceb90c7)
diff --git a/sw/source/core/layout/findfrm.cxx b/sw/source/core/layout/findfrm.cxx
index 490a95439715..74942256bef4 100644
--- a/sw/source/core/layout/findfrm.cxx
+++ b/sw/source/core/layout/findfrm.cxx
@@ -1252,17 +1252,14 @@ void SwFrame::InvalidateNextPrtArea()
}
}
-/// @returns true if the frame _directly_ sits in a section with columns
-/// but not if it sits in a table which itself sits in a section with columns.
-static bool lcl_IsInColSct( const SwFrame *pUp )
+/// @returns true if the frame _directly_ sits in a section
+/// but not if it sits in a table which itself sits in a section.
+static bool lcl_IsInSectionDirectly( const SwFrame *pUp )
{
- bool bRet = false;
while( pUp )
{
- if( pUp->IsColumnFrame() )
- bRet = true;
- else if( pUp->IsSctFrame() )
- return bRet;
+ if( pUp->IsSctFrame() )
+ return true;
else if( pUp->IsTabFrame() )
return false;
pUp = pUp->GetUpper();
@@ -1289,7 +1286,7 @@ bool SwFrame::IsMoveable( const SwLayoutFrame* _pLayoutFrame ) const
if ( _pLayoutFrame && IsFlowFrame() )
{
- if ( _pLayoutFrame->IsInSct() && lcl_IsInColSct( _pLayoutFrame ) )
+ if ( _pLayoutFrame->IsInSct() && lcl_IsInSectionDirectly( _pLayoutFrame ) )
{
bRetVal = true;
}
commit 41c23fa2f66289b210ac5218cdafadbf3855fff7
Author: Miklos Vajna <vmiklos at collabora.co.uk>
AuthorDate: Thu Jun 15 12:18:31 2017 +0200
Commit: Miklos Vajna <vmiklos at collabora.co.uk>
CommitDate: Mon Aug 13 14:07:58 2018 +0200
tdf#108524 sw: try to split rows that contain 1-col sections
We used to not even attempt to split a row that contains sections. Relax
this condition and try to split the row in case the table itself is not
in a section (to avoid recursion) and the section has no columns.
This is needed, but not enough to split the section in the bugdoc.
Change-Id: I6ad0d6eb18611f108ae29e4feea7101ffe552c48
Reviewed-on: https://gerrit.libreoffice.org/38824
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
(cherry picked from commit 336ec28195da1917c22494a24dbaf10b846d3141)
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index 319e896f1e3d..0775d381843f 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -915,7 +915,22 @@ static bool lcl_FindSectionsInRow( const SwRowFrame& rRow )
else
{
// #i26945# - search only for sections
- bRet = pTmpFrame->IsSctFrame();
+ if (pTmpFrame->IsSctFrame())
+ {
+ bRet = true;
+
+ if (!rRow.IsInSct())
+ {
+ // This row is not in a section.
+ if (const SwFrame* pSectionLower = pTmpFrame->GetLower())
+ {
+ if (!pSectionLower->IsColumnFrame())
+ // Section has a single column only, try to
+ // split that.
+ bRet = false;
+ }
+ }
+ }
}
if ( bRet )
commit e8ba34c557b242c061049c8fb10754da2a9e7586
Author: Miklos Vajna <vmiklos at collabora.co.uk>
AuthorDate: Thu Jun 15 11:08:48 2017 +0200
Commit: Miklos Vajna <vmiklos at collabora.co.uk>
CommitDate: Mon Aug 13 14:07:32 2018 +0200
Related: tdf#108524 sw: dump follow/precede of cell frames in layout xml dump
These point to the other cell frame on the previous/next page (in case
the cell frame is split across multiple pages).
Change-Id: Ic03cf9a194a49320d84dbdb5176fa737e5d6520d
Reviewed-on: https://gerrit.libreoffice.org/38818
Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
Tested-by: Jenkins <ci at libreoffice.org>
(cherry picked from commit 835c1586f60e6bc03e045e8210e38876e0fe1abc)
diff --git a/sw/source/core/inc/cellfrm.hxx b/sw/source/core/inc/cellfrm.hxx
index b70c54b54ede..541bbb872600 100644
--- a/sw/source/core/inc/cellfrm.hxx
+++ b/sw/source/core/inc/cellfrm.hxx
@@ -60,6 +60,7 @@ public:
const SwCellFrame& FindStartEndOfRowSpanCell( bool bStart ) const;
long GetLayoutRowSpan() const;
+ void dumpAsXmlAttributes(xmlTextWriterPtr writer) const override;
DECL_FIXEDMEMPOOL_NEWDEL(SwCellFrame)
};
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index fdeb528a86f0..319e896f1e3d 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -5107,6 +5107,16 @@ long SwCellFrame::GetLayoutRowSpan() const
return nRet;
}
+void SwCellFrame::dumpAsXmlAttributes(xmlTextWriterPtr pWriter) const
+{
+ SwFrame::dumpAsXmlAttributes(pWriter);
+ if (SwCellFrame* pFollow = GetFollowCell())
+ xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("follow"), "%" SAL_PRIuUINT32, pFollow->GetFrameId());
+
+ if (SwCellFrame* pPrevious = GetPreviousCell())
+ xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("precede"), "%" SAL_PRIuUINT32, pPrevious->GetFrameId());
+}
+
// #i103961#
void SwCellFrame::Cut()
{
commit f66978647f6f6a535ffd0a874a1843d6a1d4daa5
Author: Miklos Vajna <vmiklos at collabora.co.uk>
AuthorDate: Thu Jul 27 13:59:01 2017 +0200
Commit: Miklos Vajna <vmiklos at collabora.co.uk>
CommitDate: Mon Aug 13 14:07:16 2018 +0200
sw: add new TextParagraph property to XTextRange
A text range represents a selection or cursor position, so similar to
sections or tables, it makes sense to expose the containing paragraph as
well. This new property does exactly that.
Reviewed-on: https://gerrit.libreoffice.org/40483
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
(cherry picked from commit 7ed402ba648dd0f3de3b0dadebc13403b2c0a620)
Conflicts:
sw/qa/extras/uiwriter/uiwriter.cxx
Change-Id: If92a3b5e61f13c7c14ca52bc8593a2b286a596cc
diff --git a/offapi/com/sun/star/text/TextRangeContentProperties.idl b/offapi/com/sun/star/text/TextRangeContentProperties.idl
index 042b4d5b3736..9daad2e139dc 100644
--- a/offapi/com/sun/star/text/TextRangeContentProperties.idl
+++ b/offapi/com/sun/star/text/TextRangeContentProperties.idl
@@ -81,6 +81,12 @@ service TextRangeContentProperties
[optional, readonly, property] com::sun::star::text::XTextContent
NestedTextContent;
+ /** Paragraph for the start of this range.
+
+ @since LibreOffice 6.0
+ */
+ [optional, readonly, property] com::sun::star::text::XTextContent TextParagraph;
+
};
diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h
index e626bbb93458..c0ba90e33124 100644
--- a/sw/inc/cmdid.h
+++ b/sw/inc/cmdid.h
@@ -513,6 +513,7 @@
#define FN_UNO_FOOTER (FN_EXTRA2 + 38)
#define FN_UNO_FOOTER_LEFT (FN_EXTRA2 + 39)
#define FN_UNO_FOOTER_RIGHT (FN_EXTRA2 + 40)
+#define FN_UNO_TEXT_PARAGRAPH (FN_EXTRA2 + 41)
#define FN_UNO_FOLLOW_STYLE (FN_EXTRA2 + 59)
#define FN_API_CALL (FN_EXTRA2 + 60)
diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx
index 24cc71cb8740..489747da76ae 100644
--- a/sw/inc/unoprnms.hxx
+++ b/sw/inc/unoprnms.hxx
@@ -391,6 +391,7 @@
#define UNO_NAME_FOOTER_BODY_DISTANCE "FooterBodyDistance"
#define UNO_NAME_FOOTER_IS_DYNAMIC_HEIGHT "FooterIsDynamicHeight"
#define UNO_NAME_FOOTER_IS_SHARED "FooterIsShared"
+#define UNO_NAME_TEXT_PARAGRAPH "TextParagraph"
#define UNO_NAME_FOOTER_HEIGHT "FooterHeight"
#define UNO_NAME_FOOTER_IS_ON "FooterIsOn"
diff --git a/sw/qa/extras/uiwriter/data/paragraph-of-text-range.odt b/sw/qa/extras/uiwriter/data/paragraph-of-text-range.odt
new file mode 100644
index 000000000000..52cdb0be1ff2
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/paragraph-of-text-range.odt differ
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index 972ce9f7dcc4..8186316b3742 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -252,6 +252,7 @@ public:
void testCreateDocxAnnotation();
void testTdf107976();
void testTdf113790();
+ void testParagraphOfTextRange();
CPPUNIT_TEST_SUITE(SwUiWriterTest);
CPPUNIT_TEST(testReplaceForward);
@@ -391,6 +392,7 @@ public:
CPPUNIT_TEST(testCreateDocxAnnotation);
CPPUNIT_TEST(testTdf107976);
CPPUNIT_TEST(testTdf113790);
+ CPPUNIT_TEST(testParagraphOfTextRange);
CPPUNIT_TEST_SUITE_END();
private:
@@ -5023,6 +5025,27 @@ void SwUiWriterTest::testTdf113790()
CPPUNIT_ASSERT(dynamic_cast<SwXTextDocument *>(mxComponent.get()));
}
+void SwUiWriterTest::testParagraphOfTextRange()
+{
+ SwDoc* pDoc = createDoc("paragraph-of-text-range.odt");
+
+ // Enter the table.
+ SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+ pWrtShell->Down(/*bSelect=*/false);
+ CPPUNIT_ASSERT(pWrtShell->IsCursorInTable());
+ // Enter the section.
+ pWrtShell->Down(/*bSelect=*/false);
+ CPPUNIT_ASSERT(pWrtShell->IsDirectlyInSection());
+
+ // Assert that we get the right paragraph object.
+ uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
+ uno::Reference<text::XTextViewCursorSupplier> xController(xModel->getCurrentController(), uno::UNO_QUERY);
+ uno::Reference<text::XTextRange> xViewCursor(xController->getViewCursor(), uno::UNO_QUERY);
+ // This failed as there were no TextParagraph property.
+ auto xParagraph = getProperty< uno::Reference<text::XTextRange> >(xViewCursor->getStart(), "TextParagraph");
+ CPPUNIT_ASSERT_EQUAL(OUString("In section"), xParagraph->getString());
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx
index 71faf3dbb0bd..a29a8cfb6ef3 100644
--- a/sw/source/core/unocore/unocrsrhelper.cxx
+++ b/sw/source/core/unocore/unocrsrhelper.cxx
@@ -86,6 +86,7 @@
#include <SwNodeNum.hxx>
#include <fmtmeta.hxx>
#include <txtfld.hxx>
+#include <unoparagraph.hxx>
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -593,6 +594,18 @@ bool getCursorPropertyValue(const SfxItemPropertySimpleEntry& rEntry
eNewState = PropertyState_DEFAULT_VALUE;
}
break;
+ case FN_UNO_TEXT_PARAGRAPH:
+ {
+ SwTextNode* pTextNode = rPam.GetPoint()->nNode.GetNode().GetTextNode();
+ if (pTextNode)
+ {
+ uno::Reference<text::XTextContent> xParagraph = SwXParagraph::CreateXParagraph(*pTextNode->GetDoc(), pTextNode);
+ *pAny <<= xParagraph;
+ }
+ else
+ eNewState = PropertyState_DEFAULT_VALUE;
+ }
+ break;
case FN_UNO_ENDNOTE:
case FN_UNO_FOOTNOTE:
{
diff --git a/sw/source/core/unocore/unomapproperties.hxx b/sw/source/core/unocore/unomapproperties.hxx
index 633fd3db3e2e..b9825ff4a8d2 100644
--- a/sw/source/core/unocore/unomapproperties.hxx
+++ b/sw/source/core/unocore/unomapproperties.hxx
@@ -88,6 +88,7 @@
{ OUString(UNO_NAME_CELL), FN_UNO_CELL, cppu::UnoType<css::table::XCell>::get(), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY ,0 }, \
{ OUString(UNO_NAME_TEXT_FRAME), FN_UNO_TEXT_FRAME, cppu::UnoType<css::text::XTextFrame>::get(), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY ,0 }, \
{ OUString(UNO_NAME_TEXT_SECTION), FN_UNO_TEXT_SECTION, cppu::UnoType<css::text::XTextSection>::get(), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY ,0 }, \
+ { OUString(UNO_NAME_TEXT_PARAGRAPH), FN_UNO_TEXT_PARAGRAPH, cppu::UnoType<css::text::XTextContent>::get(), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY ,0 }, \
{ OUString(UNO_NAME_PARA_CHAPTER_NUMBERING_LEVEL), FN_UNO_PARA_CHAPTER_NUMBERING_LEVEL,cppu::UnoType<sal_Int8>::get(), PROPERTY_NONE, 0}, \
{ OUString(UNO_NAME_PARA_CONDITIONAL_STYLE_NAME), FN_UNO_PARA_CONDITIONAL_STYLE_NAME, cppu::UnoType<OUString>::get(), PropertyAttribute::READONLY, 0}, \
{ OUString(UNO_NAME_LIST_ID), FN_UNO_LIST_ID, cppu::UnoType<OUString>::get(), PropertyAttribute::MAYBEVOID, 0}, \
commit 474cdab82167c1c01233495b7edbae63e048f7c3
Author: Miklos Vajna <vmiklos at collabora.co.uk>
AuthorDate: Wed Jul 26 15:50:09 2017 +0200
Commit: Miklos Vajna <vmiklos at collabora.co.uk>
CommitDate: Mon Aug 13 14:06:10 2018 +0200
gbuild: strip away unexpected CR char at the end of Windows filenames
As reported at e.g.
<https://ask.libreoffice.org/en/question/90346/building-libreoffice-in-cygwin-leads-to-infinite-loop/>,
sometimes MSVC (seen with 2013 on libreoffice-5-2, but there is no
indication that 2015 on master would be different) emits CR characters
at the end of filenames, resulting in unnecessary rebuilds at per-module
builds, and actually to an infinite loop when doing toplevel make.
Given that CR characters are unexpected in any filenames, it should be
safe to just strip those away unconditionally.
Change-Id: I3d56670b4d930a32489f889085711bfd436de82a
Reviewed-on: https://gerrit.libreoffice.org/40452
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
(cherry picked from commit e9b9a456221b4b0660f90efa1ee092ea00c2c728)
diff --git a/solenv/gbuild/platform/filter-showIncludes.awk b/solenv/gbuild/platform/filter-showIncludes.awk
index a05af586aefa..b8a1db052701 100755
--- a/solenv/gbuild/platform/filter-showIncludes.awk
+++ b/solenv/gbuild/platform/filter-showIncludes.awk
@@ -45,6 +45,13 @@ BEGIN {
if (index($0, showincludes_prefix) == 1) {
$0 = substr($0, length(showincludes_prefix) + 1)
sub(/^ */, "")
+
+ # The output from MSVC may contain a carriage return character at the
+ # end of filenames, in which case the translation unit will depend on a
+ # non-existing header, resulting in constant rebuild of all files,
+ # prevent that.
+ sub(/
/, "")
+
gsub(/\\/, "/")
gsub(/ /, "\\ ")
if ($0 ~ whitelist) { # filter out system headers
More information about the Libreoffice-commits
mailing list