[Libreoffice-commits] core.git: 3 commits - sw/inc sw/qa sw/source

2016-09-08 Thread Noel Grandin
 sw/inc/IDocumentContentOperations.hxx   |2 
 sw/inc/IDocumentFieldsAccess.hxx|2 
 sw/inc/IDocumentRedlineAccess.hxx   |   48 +++--
 sw/inc/SwAppletImpl.hxx |2 
 sw/inc/SwUndoField.hxx  |3 
 sw/inc/editsh.hxx   |6 
 sw/inc/fesh.hxx |1 
 sw/inc/ftninfo.hxx  |2 
 sw/inc/grfatr.hxx   |4 
 sw/inc/ndgrf.hxx|3 
 sw/inc/postithelper.hxx |2 
 sw/inc/redline.hxx  |5 
 sw/inc/splargs.hxx  |7 
 sw/inc/swabstdlg.hxx|   18 --
 sw/inc/swcrsr.hxx   |2 
 sw/inc/swtable.hxx  |3 
 sw/inc/txatritr.hxx |5 
 sw/inc/undobj.hxx   |7 
 sw/inc/unocrsr.hxx  |2 
 sw/inc/unosett.hxx  |2 
 sw/inc/view.hxx |3 
 sw/inc/wdocsh.hxx   |2 
 sw/qa/core/uwriter.cxx  |   34 ++--
 sw/qa/extras/globalfilter/globalfilter.cxx  |   18 +-
 sw/qa/extras/uiwriter/uiwriter.cxx  |8 
 sw/source/core/access/parachangetrackinginfo.cxx|2 
 sw/source/core/crsr/crstrvl.cxx |2 
 sw/source/core/crsr/swcrsr.cxx  |6 
 sw/source/core/doc/DocumentContentOperationsManager.cxx |   70 
 sw/source/core/doc/DocumentFieldsManager.cxx|   10 -
 sw/source/core/doc/DocumentRedlineManager.cxx   |  129 +++-
 sw/source/core/doc/DocumentTimerManager.cxx |2 
 sw/source/core/doc/acmplwrd.cxx |8 
 sw/source/core/doc/doc.cxx  |6 
 sw/source/core/doc/doccomp.cxx  |   44 ++---
 sw/source/core/doc/docfld.cxx   |   39 +---
 sw/source/core/doc/docfmt.cxx   |6 
 sw/source/core/doc/docftn.cxx   |8 
 sw/source/core/doc/docglbl.cxx  |2 
 sw/source/core/doc/docnum.cxx   |8 
 sw/source/core/doc/docredln.cxx |   43 ++---
 sw/source/core/doc/docsort.cxx  |2 
 sw/source/core/doc/doctxm.cxx   |2 
 sw/source/core/doc/notxtfrm.cxx |2 
 sw/source/core/doc/tblrwcl.cxx  |4 
 sw/source/core/docnode/ndsect.cxx   |6 
 sw/source/core/docnode/ndtbl.cxx|   20 +-
 sw/source/core/docnode/node2lay.cxx |5 
 sw/source/core/docnode/section.cxx  |   16 -
 sw/source/core/edit/autofmt.cxx |   14 -
 sw/source/core/edit/edglss.cxx  |4 
 sw/source/core/edit/edlingu.cxx |2 
 sw/source/core/edit/edredln.cxx |   14 -
 sw/source/core/edit/edundo.cxx  |8 
 sw/source/core/fields/postithelper.cxx  |5 
 sw/source/core/frmedt/fecopy.cxx|   10 -
 sw/source/core/frmedt/fefly1.cxx|3 
 sw/source/core/inc/DocumentContentOperationsManager.hxx |2 
 sw/source/core/inc/DocumentFieldsManager.hxx|2 
 sw/source/core/inc/DocumentRedlineManager.hxx   |   10 -
 sw/source/core/inc/attrhint.hxx |8 
 sw/source/core/inc/docfld.hxx   |9 -
 sw/source/core/inc/node2lay.hxx |2 
 sw/source/core/layout/newfrm.cxx|2 
 sw/source/core/table/swtable.cxx|4 
 sw/source/core/text/atrhndl.hxx |3 
 sw/source/core/text/atrstck.cxx |5 
 sw/source/core/text/frmpaint.cxx|6 
 sw/source/core/text/inftxt.cxx  |   10 -
 sw/source/core/text/inftxt.hxx  |8 
 sw/source/core/text/itradj.cxx  |2 
 sw/source/core/text/porglue.cxx |4 
 sw/source/core/text/porglue.hxx |2 
 sw/source/core/text/porlay.cxx  |4 
 sw/source/core/text/pormulti.cxx|4 
 sw/source/core/text/porrst.cxx  |

[Libreoffice-commits] core.git: 3 commits - sw/inc sw/qa sw/source

2016-08-29 Thread Tor Lillqvist
 sw/inc/cshtyp.hxx   |3 -
 sw/inc/pam.hxx  |   16 ++---
 sw/qa/core/macros-test.cxx  |   24 
 sw/qa/core/uwriter.cxx  |2 
 sw/qa/extras/globalfilter/globalfilter.cxx  |4 -
 sw/qa/extras/uiwriter/uiwriter.cxx  |   30 +-
 sw/source/core/access/acctable.cxx  |4 -
 sw/source/core/crsr/crsrsh.cxx  |   10 +--
 sw/source/core/crsr/crstrvl.cxx |4 -
 sw/source/core/crsr/findtxt.cxx |2 
 sw/source/core/crsr/pam.cxx |   44 +---
 sw/source/core/crsr/paminit.cxx |   11 
 sw/source/core/crsr/swcrsr.cxx  |   12 ++--
 sw/source/core/crsr/trvlreg.cxx |2 
 sw/source/core/crsr/trvltbl.cxx |   12 ++--
 sw/source/core/doc/DocumentContentOperationsManager.cxx |   26 -
 sw/source/core/doc/DocumentFieldsManager.cxx|2 
 sw/source/core/doc/doc.cxx  |4 -
 sw/source/core/doc/docglbl.cxx  |4 -
 sw/source/core/doc/docruby.cxx  |4 -
 sw/source/core/doc/tblcpy.cxx   |2 
 sw/source/core/docnode/ndtbl.cxx|8 +-
 sw/source/core/docnode/section.cxx  |2 
 sw/source/core/edit/autofmt.cxx |4 -
 sw/source/core/edit/eddel.cxx   |4 -
 sw/source/core/edit/edglss.cxx  |2 
 sw/source/core/edit/ednumber.cxx|4 -
 sw/source/core/edit/edtab.cxx   |2 
 sw/source/core/frmedt/fecopy.cxx|6 +-
 sw/source/core/frmedt/fetab.cxx |2 
 sw/source/core/frmedt/tblsel.cxx|4 -
 sw/source/core/inc/pamtyp.hxx   |   10 ---
 sw/source/core/swg/swblocks.cxx |4 -
 sw/source/core/undo/undel.cxx   |8 +-
 sw/source/core/undo/undobj.cxx  |4 -
 sw/source/core/undo/untbl.cxx   |   10 +--
 sw/source/core/undo/untblk.cxx  |2 
 sw/source/core/unocore/unochart.cxx |6 +-
 sw/source/core/unocore/unocrsrhelper.cxx|2 
 sw/source/core/unocore/unodraw.cxx  |4 -
 sw/source/core/unocore/unoframe.cxx |8 +-
 sw/source/core/unocore/unoftn.cxx   |4 -
 sw/source/core/unocore/unoidx.cxx   |4 -
 sw/source/core/unocore/unoobj.cxx   |8 +-
 sw/source/core/unocore/unoobj2.cxx  |4 -
 sw/source/core/unocore/unoredline.cxx   |8 +-
 sw/source/core/unocore/unosect.cxx  |4 -
 sw/source/core/unocore/unotbl.cxx   |   34 ++--
 sw/source/core/unocore/unotext.cxx  |   20 +++
 sw/source/filter/ascii/wrtasc.cxx   |2 
 sw/source/filter/basflt/shellio.cxx |   10 +--
 sw/source/filter/html/htmlgrin.cxx  |2 
 sw/source/filter/html/swhtml.cxx|2 
 sw/source/filter/ww8/docxexportfilter.cxx   |2 
 sw/source/filter/ww8/rtfexportfilter.cxx|2 
 sw/source/filter/ww8/ww8par2.cxx|2 
 sw/source/filter/ww8/ww8par6.cxx|2 
 sw/source/filter/xml/XMLRedlineImportHelper.cxx |2 
 sw/source/filter/xml/swxml.cxx  |2 
 sw/source/uibase/docvw/edtwin.cxx   |8 +-
 sw/source/uibase/lingu/hhcwrp.cxx   |2 
 sw/source/uibase/ribbar/inputwin.cxx|   12 ++--
 sw/source/uibase/wrtsh/move.cxx |   12 ++--
 sw/source/uibase/wrtsh/select.cxx   |4 -
 64 files changed, 206 insertions(+), 264 deletions(-)

New commits:
commit e66fe457ff73520877820ef0c5d35ecffda73105
Author: Tor Lillqvist 
Date:   Mon Aug 29 13:50:46 2016 +0300

Get rid of a pointless indirect function pointer variable

Sure, lots of them left. And actually, I don't know, maybe there is
some deeper reason why such are used in the sw coding style. Feel
free to revert these commits.

Change-Id: I5a1c31fe32b3bdf6d40489d029be165c38a8ba05

diff --git a/sw/inc/cshtyp.hxx b/sw/inc/cshtyp.hxx
index 44d9dcc..1dbe447 100644
--- a/sw/inc/cshtyp.hxx
+++ b/sw/inc/cshtyp.hxx
@@ -46,9 +46,10 @@ extern SwPosPara fnParaStart, fnParaEnd;
 // 

[Libreoffice-commits] core.git: 3 commits - sw/inc sw/qa sw/source

2014-12-30 Thread Miklos Vajna
 sw/inc/hintids.hxx  |1 
 sw/qa/extras/ww8export/data/commented-table.doc |binary
 sw/qa/extras/ww8export/ww8export.cxx|   12 ++
 sw/source/filter/basflt/fltshell.cxx|   14 ++
 sw/source/filter/inc/fltshell.hxx   |2 
 sw/source/filter/ww8/ww8par.cxx |  144 
 sw/source/filter/ww8/ww8par.hxx |6 -
 sw/source/filter/ww8/ww8par5.cxx|   12 ++
 sw/source/filter/ww8/ww8par6.cxx|3 
 sw/source/filter/ww8/ww8scan.cxx|  141 +++
 sw/source/filter/ww8/ww8scan.hxx|   39 ++
 sw/source/filter/ww8/ww8struc.hxx   |8 -
 12 files changed, 219 insertions(+), 163 deletions(-)

New commits:
commit 0ec0ec267986644084baaa5bda5ba917dc5744df
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Tue Dec 30 18:49:04 2014 +0100

i#93570 DOC import: handle commented text ranges via RES_FLTR_ANNOTATIONMARK

And add a minimal reproducer that shows how the old way was broken.

Change-Id: Ic2dadf9905d603b0fd0573651b235ecd5dd70e71

diff --git a/sw/qa/extras/ww8export/data/commented-table.doc 
b/sw/qa/extras/ww8export/data/commented-table.doc
new file mode 100644
index 000..049c7e3
Binary files /dev/null and b/sw/qa/extras/ww8export/data/commented-table.doc 
differ
diff --git a/sw/qa/extras/ww8export/ww8export.cxx 
b/sw/qa/extras/ww8export/ww8export.cxx
index 8a4596a..11cf778 100644
--- a/sw/qa/extras/ww8export/ww8export.cxx
+++ b/sw/qa/extras/ww8export/ww8export.cxx
@@ -441,6 +441,18 @@ DECLARE_WW8EXPORT_TEST(testWw8Cjklist35, cjklist35.doc)
 CPPUNIT_ASSERT_EQUAL(style::NumberingType::NUMBER_LOWER_ZH, numFormat);
 }
 
+DECLARE_WW8EXPORT_TEST(testCommentedTable, commented-table.doc)
+{
+// Document has a non-trivial commented text range, as the range contains 
a table.
+uno::Referencetext::XTextFieldsSupplier xTextFieldsSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Referencecontainer::XEnumerationAccess 
xFieldsAccess(xTextFieldsSupplier-getTextFields());
+uno::Referencecontainer::XEnumeration 
xFields(xFieldsAccess-createEnumeration());
+uno::Referencetext::XTextContent xField(xFields-nextElement(), 
uno::UNO_QUERY);
+// After first import, there was an off-by-one during import, so this was 
efore.\nA1\nB1\nAfte. (Notice the additional e prefix.)
+// After export and import, things got worse, this was \nA1\nB1\nAfte.
+CPPUNIT_ASSERT_EQUAL(OUString(fore.\nA1\nB1\nAfte), 
xField-getAnchor()-getString());
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 7c42b69..67aa9ab 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -2185,79 +2185,6 @@ long SwWW8ImplReader::Read_And(WW8PLCFManResult* pRes)
 sAuthor = *pA;
 else
 sAuthor = sInitials;
-
-// If there is a bookmark tag, a text range should be commented.
-sal_uInt32 nTagBkmk = SVBT32ToUInt32(pDescri-ITagBkmk);
-if (nTagBkmk != 0x)
-{
-int nAtnIndex = GetAnnotationIndex(nTagBkmk);
-if (nAtnIndex != -1)
-{
-WW8_CP nStart = GetAnnotationStart(nAtnIndex);
-WW8_CP nEnd = 
GetAnnotationEnd(GetAnnotationEndIndex(nAtnIndex));
-//It is unfortunately fragile and wrong to assume that two
-//character positions in the original word document, which is
-//what nStart and nEnd are, will equate to the same length in
-//the destination writer document.
-//
-//Better would be, while writing the content into the writer
-//document to store the equivalent writer document positions
-//that relate to each annotation index as the parser passes
-//those points.
-sal_Int32 nLen = nEnd - nStart;
-// the start and end positions are apparently stored in
-// different arrays, so in an invalid file only one could exist
-if(SAL_MAX_INT32 != nEnd  SAL_MAX_INT32 != nStart  nLen  
0)
-{
-if (pPaM-GetPoint()-nContent.GetIndex() = nLen)
-{
-pPaM-SetMark();
-pPaM-GetPoint()-nContent -= nLen;
-}
-else if (pPaM-GetPoint()-nNode.GetNode().IsTxtNode() )
-{
-pPaM-SetMark();
-nLen -= pPaM-GetPoint()-nContent.GetIndex();
-
-SwTxtNode* pTxtNode = 0;
-
-// Find first text node which is affected by the 
comment
-while (nLen  0)
-{
- 

[Libreoffice-commits] core.git: 3 commits - sw/inc sw/qa sw/source

2014-12-03 Thread Bjoern Michaelsen
 sw/inc/edimp.hxx |2 
 sw/inc/ring.hxx  |   98 +--
 sw/qa/core/uwriter.cxx   |   16 +++---
 sw/source/core/doc/doccorr.cxx   |6 +-
 sw/source/core/edit/autofmt.cxx  |2 
 sw/source/core/frmedt/fecopy.cxx |2 
 sw/source/core/frmedt/fews.cxx   |9 +--
 7 files changed, 72 insertions(+), 63 deletions(-)

New commits:
commit 02ef3abd83f2d5f702349a8cd47928621ee5c620
Author: Bjoern Michaelsen bjoern.michael...@canonical.com
Date:   Wed Dec 3 09:22:54 2014 +0100

fdo#86929: Kill FOREACHPAM_START for good

Change-Id: Ibaff13e84f186616259ba9bbf9224bbe2d30c5d6

diff --git a/sw/source/core/frmedt/fews.cxx b/sw/source/core/frmedt/fews.cxx
index 16aa9bd..8b0aa53 100644
--- a/sw/source/core/frmedt/fews.cxx
+++ b/sw/source/core/frmedt/fews.cxx
@@ -507,9 +507,9 @@ bool SwFEShell::Sort(const SwSortOptions rOpt)
 else
 {
 // Sort text nothing else
-FOREACHPAM_START(GetCrsr())
-
-SwPaM* pPam = PCURCRSR;
+for(SwPaM rPaM : GetCrsr()-GetRingContainer())
+{
+SwPaM* pPam = rPaM;
 
 SwPosition* pStart = pPam-Start();
 SwPosition* pEnd   = pPam-End();
@@ -534,8 +534,7 @@ bool SwFEShell::Sort(const SwSortOptions rOpt)
 pPam-GetPoint()-nNode += nOffset;
 pCNd = pPam-GetCntntNode();
 pPam-GetPoint()-nContent.Assign( pCNd, pCNd-Len() );
-
-FOREACHPAM_END()
+}
 }
 
 EndAllAction();
commit 881458eb2970d6be0ac0648159efcd37fa1623e2
Author: Bjoern Michaelsen bjoern.michael...@canonical.com
Date:   Wed Dec 3 09:09:58 2014 +0100

move size() into the container too

Change-Id: I22ee641e7d07fa7c0cae7a4b36ce61dbed62b31f

diff --git a/sw/inc/ring.hxx b/sw/inc/ring.hxx
index 61181eb..174a5bb 100644
--- a/sw/inc/ring.hxx
+++ b/sw/inc/ring.hxx
@@ -22,6 +22,7 @@
 #include swdllapi.h
 #include swtypes.hxx
 #include utility
+#include iterator
 #include boost/iterator/iterator_facade.hpp
 #include boost/intrusive/circular_list_algorithms.hpp
 
@@ -94,9 +95,6 @@ namespace sw
 /** @return the previous item in the ring container */
 T* GetPrev() const
 { return pPrev; }
-/** @return the number of elements in the container */
-size_t size() const
-{ return algo::count(static_cast const T* (this)); }
 /** @return a stl-like container with begin()/end() for iteration */
 ring_container GetRingContainer();
 /** @return a stl-like container with begin()/end() for const 
iteration */
@@ -161,9 +159,9 @@ namespace sw
 iterator end();
 const_iterator begin() const;
 const_iterator end() const;
-///** @return the number of elements in the container */
-//size_t size() const
-//{ return algo::count(static_cast const T* (this)); }
+/** @return the number of elements in the container */
+size_t size() const
+{ return std::distance(begin(), end()); }
 };
 template class T
 class RingIterator SAL_FINAL : public boost::iterator_facade
diff --git a/sw/qa/core/uwriter.cxx b/sw/qa/core/uwriter.cxx
index 584f398..bad84c9 100644
--- a/sw/qa/core/uwriter.cxx
+++ b/sw/qa/core/uwriter.cxx
@@ -1296,18 +1296,18 @@ void SwDocTest::testIntrusiveRing()
 vRings.push_back(aRing3);
 vRings.push_back(aRing4);
 vRings.push_back(aRing5);
-CPPUNIT_ASSERT_EQUAL(aRing1.size(), static_castsize_t(1));
+CPPUNIT_ASSERT_EQUAL(aRing1.GetRingContainer().size(), 
static_castsize_t(1));
 aRing2.MoveTo(aRing1);
 aRing3.MoveTo(aRing1);
-CPPUNIT_ASSERT_EQUAL(aRing1.size(), static_castsize_t(3));
-CPPUNIT_ASSERT_EQUAL(aRing2.size(), static_castsize_t(3));
-CPPUNIT_ASSERT_EQUAL(aRing3.size(), static_castsize_t(3));
+CPPUNIT_ASSERT_EQUAL(aRing1.GetRingContainer().size(), 
static_castsize_t(3));
+CPPUNIT_ASSERT_EQUAL(aRing2.GetRingContainer().size(), 
static_castsize_t(3));
+CPPUNIT_ASSERT_EQUAL(aRing3.GetRingContainer().size(), 
static_castsize_t(3));
 aRing5.MoveTo(aRing4);
-CPPUNIT_ASSERT_EQUAL(aRing4.size(), static_castsize_t(2));
+CPPUNIT_ASSERT_EQUAL(aRing4.GetRingContainer().size(), 
static_castsize_t(2));
 aRing4.MoveRingTo(aRing1);
 BOOST_FOREACH(TestRing* pRing, vRings)
 {
-CPPUNIT_ASSERT_EQUAL(pRing-size(), static_castsize_t(5));
+CPPUNIT_ASSERT_EQUAL(pRing-GetRingContainer().size(), 
static_castsize_t(5));
 }
 for(std::vectorTestRing*::iterator ppRing = vRings.begin(); ppRing != 
vRings.end(); ++ppRing)
 {
diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx
index 95a5033..c10c8d9 100644
--- a/sw/source/core/frmedt/fecopy.cxx
+++ b/sw/source/core/frmedt/fecopy.cxx
@@ -719,7 +719,7 @@ bool SwFEShell::Paste( SwDoc* pClpDoc, bool 
bIncludingPageFrames )
 SwNodeIndex aClpIdx( aIdx );
 SwPaM* pStartCursor = GetCrsr();

[Libreoffice-commits] core.git: 3 commits - sw/inc sw/qa sw/source

2014-10-06 Thread Caolán McNamara
 sw/inc/format.hxx  |2 +-
 sw/inc/frmfmt.hxx  |2 +-
 sw/inc/swtblfmt.hxx|6 +++---
 sw/qa/core/uwriter.cxx |4 ++--
 sw/source/core/attr/format.cxx |   14 +++---
 sw/source/core/inc/frame.hxx   |2 +-
 sw/source/core/layout/atrfrm.cxx   |   12 ++--
 sw/source/core/layout/findfrm.cxx  |4 ++--
 sw/source/core/layout/frmtool.cxx  |2 +-
 sw/source/core/layout/paintfrm.cxx |2 +-
 sw/source/core/table/swtable.cxx   |6 +++---
 sw/source/filter/ww8/wrtww8.cxx|8 +++-
 12 files changed, 35 insertions(+), 29 deletions(-)

New commits:
commit f0859c4eae0f567393811c308074723329f1faab
Author: Caolán McNamara caol...@redhat.com
Date:   Mon Oct 6 15:59:09 2014 +0100

Resolves: fdo#84588 loop in TableInfo::getNextNode

Change-Id: I5bb44dc94041c3b3cd9d80ba125594a48c9c921f

diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index e64c9dd..64e86d0 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -2645,9 +2645,15 @@ void MSWordExportBase::WriteText()
 if ( rNd == rNd.GetNodes().GetEndOfContent() )
 break;
 
-SwNode * pCurrentNode = pCurPam-GetPoint()-nNode.GetNode();
+const SwNode * pCurrentNode = pCurPam-GetPoint()-nNode.GetNode();
 const SwNode * pNextNode = mpTableInfo-getNextNode(pCurrentNode);
 
+if (pCurrentNode == pNextNode)
+{
+SAL_WARN(sw.ww8, loop in TableInfo);
+pNextNode = NULL;
+}
+
 if (pNextNode != NULL)
 pCurPam-GetPoint()-nNode = SwNodeIndex(*pNextNode);
 else
commit 1a725ff0b42a6a97720f4663b9c5426fd5919079
Author: Caolán McNamara caol...@redhat.com
Date:   Mon Oct 6 15:48:08 2014 +0100

cast to size_t altogether

Change-Id: I93cb374bd9743c45c4f3a98799a5f448dbb46fd8

diff --git a/sw/qa/core/uwriter.cxx b/sw/qa/core/uwriter.cxx
index a9f4fbd..6b28654 100644
--- a/sw/qa/core/uwriter.cxx
+++ b/sw/qa/core/uwriter.cxx
@@ -964,8 +964,8 @@ static SwPosition
 getRandomPosition(SwDoc *pDoc, int /* nOffset */)
 {
 const SwPosition aPos(pDoc-GetNodes().GetEndOfContent());
-sal_uLong nNodes = aPos.nNode.GetNode().GetIndex() - 
aPos.nNode.GetNode().StartOfSectionIndex();
-sal_uLong n = 
comphelper::rng::uniform_int_distribution(static_castsal_uLong(0), nNodes);
+size_t nNodes = aPos.nNode.GetNode().GetIndex() - 
aPos.nNode.GetNode().StartOfSectionIndex();
+size_t n = 
comphelper::rng::uniform_int_distribution(static_castsize_t(0), nNodes);
 SwPaM pam(aPos);
 for (sal_uLong i = 0; i  n; ++i)
 {
commit 5c1482c3e37502bce2b3be106d1a70938ce8b30c
Author: Caolán McNamara caol...@redhat.com
Date:   Mon Oct 6 15:36:26 2014 +0100

Related; #i125163# rename IsAdaptedToNewFillProperties

to supportsFullDrawingLayerFillAttributeSet so as to rename our equivalent
solution of d3de12fcfc85feb36eda3b0495807ef11d8fe772
Resolves: fdo#81277 missing table cell background color in doc/html import
with that of 36cc153d32bc262c2285d333a1369f6ca36a7fba
i125163 Corrected FillStyle handling for tables in Writer

Change-Id: If8ecbc712e01d823d034ff3771bf38a4df16368d

diff --git a/sw/inc/format.hxx b/sw/inc/format.hxx
index 1b60569..b576048 100644
--- a/sw/inc/format.hxx
+++ b/sw/inc/format.hxx
@@ -334,7 +334,7 @@ public:
 
 // Access to DrawingLayer FillAttributes in a preprocessed form for 
primitive usage
 virtual drawinglayer::attribute::SdrAllFillAttributesHelperPtr 
getSdrAllFillAttributesHelper() const;
-virtual bool IsAdaptedToNewFillProperties() const;
+virtual bool supportsFullDrawingLayerFillAttributeSet() const;
 };
 
 inline void SwFmt::SetName( const sal_Char* pNewName,
diff --git a/sw/inc/frmfmt.hxx b/sw/inc/frmfmt.hxx
index 715f92a..8b33ec2 100644
--- a/sw/inc/frmfmt.hxx
+++ b/sw/inc/frmfmt.hxx
@@ -138,7 +138,7 @@ public:
 
 // Access to DrawingLayer FillAttributes in a preprocessed form for 
primitive usage
 virtual drawinglayer::attribute::SdrAllFillAttributesHelperPtr 
getSdrAllFillAttributesHelper() const SAL_OVERRIDE;
-virtual bool IsAdaptedToNewFillProperties() const SAL_OVERRIDE;
+virtual bool supportsFullDrawingLayerFillAttributeSet() const SAL_OVERRIDE;
 };
 
 // The FlyFrame-Format
diff --git a/sw/inc/swtblfmt.hxx b/sw/inc/swtblfmt.hxx
index 142959e..181bf23 100644
--- a/sw/inc/swtblfmt.hxx
+++ b/sw/inc/swtblfmt.hxx
@@ -42,7 +42,7 @@ public:
 
 DECL_FIXEDMEMPOOL_NEWDEL(SwTableFmt)
 
-virtual bool IsAdaptedToNewFillProperties() const SAL_OVERRIDE;
+virtual bool supportsFullDrawingLayerFillAttributeSet() const SAL_OVERRIDE;
 };
 
 class SwTableLineFmt : public SwFrmFmt
@@ -64,7 +64,7 @@ public:
 
 DECL_FIXEDMEMPOOL_NEWDEL(SwTableLineFmt)
 
-virtual bool IsAdaptedToNewFillProperties() const SAL_OVERRIDE;
+virtual bool supportsFullDrawingLayerFillAttributeSet() 

[Libreoffice-commits] core.git: 3 commits - sw/inc sw/qa sw/source

2014-08-15 Thread Miklos Vajna
 sw/inc/textboxhelper.hxx |8 
 sw/qa/extras/uiwriter/data/fdo82191.odt  |binary
 sw/qa/extras/uiwriter/uiwriter.cxx   |   24 
 sw/source/core/doc/DocumentLayoutManager.cxx |   11 +++
 sw/source/core/doc/docfly.cxx|4 ++--
 sw/source/core/doc/textboxhelper.cxx |   16 
 sw/source/core/frmedt/fecopy.cxx |6 ++
 sw/source/core/unocore/unocoll.cxx   |2 +-
 sw/source/core/unocore/unodraw.cxx   |4 ++--
 sw/source/core/unocore/unoframe.cxx  |2 +-
 sw/source/core/unocore/unoobj2.cxx   |2 +-
 sw/source/core/unocore/unoportenum.cxx   |4 ++--
 sw/source/filter/ww8/docxsdrexport.cxx   |2 +-
 13 files changed, 63 insertions(+), 22 deletions(-)

New commits:
commit c7307c77254557646f33017af915f6808a861e29
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Fri Aug 15 15:59:56 2014 +0200

fdo#82191 sw::DocumentLayoutManager: copy textbox content of draw formats

The SwFmtCntnt, i.e. the content of the draw format was already copied,
but that's only a pointer to the real content: instead duplicate the
real contents on copypaste, that's how we copy fly frames as well.

Change-Id: I42475e356aaa1c54c08fb23a6a395d1726e5f33e

diff --git a/sw/qa/extras/uiwriter/data/fdo82191.odt 
b/sw/qa/extras/uiwriter/data/fdo82191.odt
new file mode 100644
index 000..d0759c0
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/fdo82191.odt differ
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx 
b/sw/qa/extras/uiwriter/uiwriter.cxx
index 10cb454..e12af85 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -18,6 +18,7 @@
 #include section.hxx
 #include fmtclds.hxx
 #include dcontact.hxx
+#include textboxhelper.hxx
 
 #include svx/svdpage.hxx
 #include svx/svdview.hxx
@@ -46,6 +47,7 @@ public:
 void testCp171();
 void testShapeTextboxVertadjust();
 void testShapeTextboxAutosize();
+void testFdo82191();
 
 CPPUNIT_TEST_SUITE(SwUiWriterTest);
 CPPUNIT_TEST(testReplaceForward);
@@ -62,6 +64,7 @@ public:
 CPPUNIT_TEST(testCp171);
 CPPUNIT_TEST(testShapeTextboxVertadjust);
 CPPUNIT_TEST(testShapeTextboxAutosize);
+CPPUNIT_TEST(testFdo82191);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -390,6 +393,27 @@ void SwUiWriterTest::testShapeTextboxAutosize()
 CPPUNIT_ASSERT(pFirst-GetSnapRect().getHeight()  
pSecond-GetSnapRect().getHeight());
 }
 
+void SwUiWriterTest::testFdo82191()
+{
+SwDoc* pDoc = createDoc(fdo82191.odt);
+SdrPage* pPage = 
pDoc-getIDocumentDrawModelAccess().GetDrawModel()-GetPage(0);
+std::setconst SwFrmFmt* aTextBoxes = 
SwTextBoxHelper::findTextBoxes(pDoc);
+// Make sure we have a single draw shape.
+CPPUNIT_ASSERT_EQUAL(sal_Int32(1), SwTextBoxHelper::getCount(pPage, 
aTextBoxes));
+
+SwDoc aClipboard;
+SwWrtShell* pWrtShell = pDoc-GetDocShell()-GetWrtShell();
+SdrObject* pObject = pPage-GetObj(0);
+// Select it, then copy and paste.
+pWrtShell-SelectObj(Point(), 0, pObject);
+pWrtShell-Copy(aClipboard);
+pWrtShell-Paste(aClipboard);
+
+aTextBoxes = SwTextBoxHelper::findTextBoxes(pDoc);
+// This was one: the textbox of the shape wasn't copied.
+CPPUNIT_ASSERT_EQUAL(size_t(2), aTextBoxes.size());
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest);
 CPPUNIT_PLUGIN_IMPLEMENT();
 
diff --git a/sw/source/core/doc/DocumentLayoutManager.cxx 
b/sw/source/core/doc/DocumentLayoutManager.cxx
index 1772723..19b07cb 100644
--- a/sw/source/core/doc/DocumentLayoutManager.cxx
+++ b/sw/source/core/doc/DocumentLayoutManager.cxx
@@ -39,6 +39,7 @@
 #include unoframe.hxx
 #include docary.hxx
 #include dcontact.hxx
+#include textboxhelper.hxx
 
 using namespace ::com::sun::star;
 
@@ -493,6 +494,16 @@ SwFrmFmt *DocumentLayoutManager::CopyLayoutFmt(
 if( bMakeFrms )
 pDest-MakeFrms();
 
+// If the draw format has a TextBox, then copy its fly format as well.
+if (SwFrmFmt* pSourceTextBox = SwTextBoxHelper::findTextBox(rSource))
+{
+SwFrmFmt* pDestTextBox = CopyLayoutFmt(*pSourceTextBox, rNewAnchor, 
bSetTxtFlyAtt, bMakeFrms);
+SwAttrSet aSet(pDest-GetAttrSet());
+SwFmtCntnt 
aCntnt(pDestTextBox-GetCntnt().GetCntntIdx()-GetNode().GetStartNode());
+aSet.Put(aCntnt);
+pDest-SetFmtAttr(aSet);
+}
+
 return pDest;
 }
 
diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx
index 261f492..6bdf41f 100644
--- a/sw/source/core/frmedt/fecopy.cxx
+++ b/sw/source/core/frmedt/fecopy.cxx
@@ -75,6 +75,7 @@
 #include docsh.hxx
 #include pagedesc.hxx
 #include mvsave.hxx
+#include textboxhelper.hxx
 #include vcl/virdev.hxx
 #include svx/svdundo.hxx
 
@@ -884,6 +885,7 @@ bool SwFEShell::Paste( SwDoc* pClpDoc, bool 
bIncludingPageFrames )
 if( !Imp()-GetDrawView() )
 

[Libreoffice-commits] core.git: 3 commits - sw/inc sw/qa sw/source

2013-03-15 Thread Michael Stahl
 sw/inc/pagedesc.hxx|   39 -
 sw/qa/extras/odfimport/odfimport.cxx   |   11 +
 sw/source/core/layout/flowfrm.cxx  |7 +++--
 sw/source/core/layout/frmtool.cxx  |9 ---
 sw/source/core/layout/pagechg.cxx  |   28 ---
 sw/source/core/layout/pagedesc.cxx |   14 +++
 sw/source/ui/docvw/HeaderFooterWin.cxx |9 +++
 sw/source/ui/docvw/PostItMgr.cxx   |   10 +---
 8 files changed, 60 insertions(+), 67 deletions(-)

New commits:
commit 2832da0f5982f6b5d6d96346a5db9460d59b7e2e
Author: Michael Stahl mst...@redhat.com
Date:   Fri Mar 15 22:47:53 2013 +0100

fdo#61952: add unit test

Change-Id: Idef40ea4ad615fa5d09d2a5ed6eb3fe861f1b5ea

diff --git a/sw/qa/extras/odfimport/odfimport.cxx 
b/sw/qa/extras/odfimport/odfimport.cxx
index 37da317..3bef663 100644
--- a/sw/qa/extras/odfimport/odfimport.cxx
+++ b/sw/qa/extras/odfimport/odfimport.cxx
@@ -42,6 +42,7 @@ public:
 void testOdtBorders();
 void testPageStyleLayoutDefault();
 void testPageStyleLayoutRight();
+void testFdo61952();
 void testFdo60842();
 void testFdo56272();
 
@@ -63,6 +64,7 @@ void Test::run()
 {borders_ooo33.odt, Test::testOdtBorders},
 {hello.odt, Test::testPageStyleLayoutDefault},
 {hello.odt, Test::testPageStyleLayoutRight},
+{hello.odt, Test::testFdo61952},
 {fdo60842.odt, Test::testFdo60842},
 {fdo56272.odt, Test::testFdo56272},
 };
@@ -295,6 +297,15 @@ void Test::testPageStyleLayoutRight()
 xPropertySet-setPropertyValue(PageStyleLayout, 
uno::makeAny(style::PageStyleLayout_RIGHT));
 }
 
+void Test::testFdo61952()
+{
+uno::Referencebeans::XPropertySet xPara(getParagraph(0), uno::UNO_QUERY);
+xPara-setPropertyValue(PageDescName, uno::makeAny(OUString(Left 
Page)));
+xPara-setPropertyValue(PageDescName, uno::makeAny(OUString(Right 
Page)));
+xPara-setPropertyValue(PageDescName, uno::makeAny(OUString(Left 
Page)));
+xPara-setPropertyValue(PageDescName, uno::makeAny(OUString(Right 
Page)));
+}
+
 void Test::testFdo60842()
 {
 uno::Referencetext::XTextContent const xTable(getParagraphOrTable(0));
commit 4dc78aee9bcdb6ea5e9dc47ebb4a4b9e590c725a
Author: Michael Stahl mst...@redhat.com
Date:   Fri Mar 15 22:25:17 2013 +0100

fdo#61952: sw: fix left/right-only page styles and first-page

- remove PD_FIRST and GetFirstFmt:
  This flag makes no sense at all, since there are no first-only
  page styles (while there are left-only/right-only).
- instead add a parameter to GetLeftFmt/GetRightFmt to request a
  first page format, if such exists and is not shared
(regression from 02a934d03b101ce463a232f9cbb7b43e684de37e
 and fa0f42bafbf24e9141ddee728b160b5ab47077f2)

Change-Id: I4d50c2c0cc4f3cf231eacba891df22d0bcf6c4df

diff --git a/sw/inc/pagedesc.hxx b/sw/inc/pagedesc.hxx
index dbf3144..45ca5df 100644
--- a/sw/inc/pagedesc.hxx
+++ b/sw/inc/pagedesc.hxx
@@ -118,9 +118,8 @@ namespace nsUseOnPage
 const UseOnPage PD_NONE   = 0x; /// For internal use only.
 const UseOnPage PD_LEFT   = 0x0001;
 const UseOnPage PD_RIGHT  = 0x0002;
-const UseOnPage PD_FIRST  = 0x0004;
-const UseOnPage PD_ALL= 0x0007;
-const UseOnPage PD_MIRROR = 0x000F;
+const UseOnPage PD_ALL= 0x0003;
+const UseOnPage PD_MIRROR = 0x0007;
 const UseOnPage PD_HEADERSHARE= 0x0040;
 const UseOnPage PD_FOOTERSHARE= 0x0080;
 const UseOnPage PD_NOHEADERSHARE  = 0xFFBF; /// For internal use only.
@@ -204,12 +203,10 @@ public:
 
 /** Layout uses the following methods to obtain a format in order
to be able to create a page. */
-inline SwFrmFmt *GetRightFmt();
-inline const SwFrmFmt *GetRightFmt() const;
-inline SwFrmFmt *GetLeftFmt();
-inline const SwFrmFmt *GetLeftFmt() const;
-inline SwFrmFmt *GetFirstFmt();
-inline const SwFrmFmt *GetFirstFmt() const;
+   SwFrmFmt *GetRightFmt(bool const bFirst = false);
+inline const SwFrmFmt *GetRightFmt(bool const bFirst = false) const;
+   SwFrmFmt *GetLeftFmt(bool const bFirst = false);
+inline const SwFrmFmt *GetLeftFmt(bool const bFirst = false) const;
 
 sal_uInt16 GetRegHeight() const { return nRegHeight; }
 sal_uInt16 GetRegAscent() const { return nRegAscent; }
@@ -306,29 +303,13 @@ inline void SwPageDesc::ResetAllLeftAttr()
 ResetAllAttr( sal_True );
 }
 
-inline SwFrmFmt *SwPageDesc::GetRightFmt()
+inline const SwFrmFmt *SwPageDesc::GetRightFmt(bool const bFirst) const
 {
-return nsUseOnPage::PD_RIGHT  eUse ? aMaster : 0;
+return const_castSwPageDesc*(this)-GetRightFmt(bFirst);
 }
-inline const SwFrmFmt *SwPageDesc::GetRightFmt() const
+inline const SwFrmFmt *SwPageDesc::GetLeftFmt(bool const bFirst) const
 {
-return nsUseOnPage::PD_RIGHT  eUse ? aMaster : 0;
-}
-inline