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

2023-09-18 Thread Noel Grandin (via logerrit)
 sw/inc/fmtftn.hxx |3 +-
 sw/inc/formatlinebreak.hxx|3 +-
 sw/qa/core/unocore/unocore.cxx|2 -
 sw/source/core/doc/doc.cxx|5 +---
 sw/source/core/text/inftxt.cxx|   12 --
 sw/source/core/text/txtftn.cxx|9 +++
 sw/source/core/txtnode/atrftn.cxx |6 ++---
 sw/source/core/txtnode/attrlinebreak.cxx  |8 ++
 sw/source/filter/ww8/docxattributeoutput.cxx  |7 ++
 sw/source/ui/vba/vbaformfield.cxx |2 -
 sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx  |2 -
 sw/source/uibase/docvw/edtwin2.cxx|   16 ++---
 sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx |   21 ++
 13 files changed, 47 insertions(+), 49 deletions(-)

New commits:
commit b47a69ebee54a4b399c90311e17b994635140002
Author: Noel Grandin 
AuthorDate: Sun Sep 17 22:23:18 2023 +0200
Commit: Noel Grandin 
CommitDate: Mon Sep 18 15:31:30 2023 +0200

use more concrete UNO types in sw

Change-Id: I04d790ff9247f4a810da975128e91073e285f267
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157014
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 79b9df031924..683457983c20 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -9630,11 +9630,10 @@ void DocxAttributeOutput::FormatFillGradient( const 
XFillGradientItem& rFillGrad
 {
 SwFrameFormat & rFormat(
 
const_cast(m_rExport.m_pParentFrame->GetFrameFormat()));
-uno::Reference const xPropertySet(
-
static_cast(SwXTextFrame::CreateXTextFrame(*rFormat.GetDoc(),
 ).get()),
-uno::UNO_QUERY);
+rtl::Reference const xPropertySet =
+SwXTextFrame::CreateXTextFrame(*rFormat.GetDoc(), );
 m_rDrawingML.SetFS(m_pSerializer);
-m_rDrawingML.WriteGradientFill(xPropertySet);
+
m_rDrawingML.WriteGradientFill(uno::Reference(static_cast(xPropertySet.get(;
 }
 m_oFillStyle.reset();
 }
commit e0b73760a29ea80d242958942b153769a59bf0f9
Author: Noel Grandin 
AuthorDate: Sun Sep 17 22:19:05 2023 +0200
Commit: Noel Grandin 
CommitDate: Mon Sep 18 15:31:20 2023 +0200

use more concrete UNO types in sw

Change-Id: I446cf00ac7e320586da2dd0837cf873ca9ab0ca6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157013
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sw/inc/fmtftn.hxx b/sw/inc/fmtftn.hxx
index 009b75c3f98f..96742789d89a 100644
--- a/sw/inc/fmtftn.hxx
+++ b/sw/inc/fmtftn.hxx
@@ -36,6 +36,7 @@ class SwDoc;
 class SwTextFootnote;
 class SwRootFrame;
 class SwXFootnote;
+class SwXTextRange;
 
 // ATT_FTN
 
@@ -93,7 +94,7 @@ public:
 OUString GetViewNumStr(const SwDoc& rDoc, SwRootFrame const* pLayout,
 bool bInclStrings = false) const;
 
-css::uno::Reference getAnchor(SwDoc& rDoc) const;
+rtl::Reference getAnchor(SwDoc& rDoc) const;
 
 unotools::WeakReference const& GetXFootnote() const
 { return m_wXFootnote; }
diff --git a/sw/inc/formatlinebreak.hxx b/sw/inc/formatlinebreak.hxx
index 1bc05f092903..a5b7ba9f4a5e 100644
--- a/sw/inc/formatlinebreak.hxx
+++ b/sw/inc/formatlinebreak.hxx
@@ -30,6 +30,7 @@
 class SwDoc;
 class SwTextLineBreak;
 class SwXLineBreak;
+class SwXTextRange;
 
 /// Defines the location of a line break text wrapping restart.
 enum class SwLineBreakClear
@@ -69,7 +70,7 @@ public:
 
 sal_uInt16 GetValueCount() const override;
 
-css::uno::Reference GetAnchor() const;
+rtl::Reference GetAnchor() const;
 
 void SetTextLineBreak(SwTextLineBreak* pTextAttr) { m_pTextAttr = 
pTextAttr; }
 
diff --git a/sw/qa/core/unocore/unocore.cxx b/sw/qa/core/unocore/unocore.cxx
index cb6f52d0fdbb..8715a4868f30 100644
--- a/sw/qa/core/unocore/unocore.cxx
+++ b/sw/qa/core/unocore/unocore.cxx
@@ -64,7 +64,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testTdf119081)
 
 SwDoc* pDoc = pDocShell->GetDoc();
 SwPaM& rCursor = pWrtShell->GetCurrentShellCursor();
-uno::Reference xInsertPosition
+rtl::Reference xInsertPosition
 = SwXTextRange::CreateXTextRange(*pDoc, *rCursor.GetPoint(), nullptr);
 uno::Reference xTextAppend(xInsertPosition->getText(), 
uno::UNO_QUERY);
 // Without the accompanying fix in place, this test would have failed with:
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index 82b3b0da827c..da14a84674e3 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -1878,10 +1878,9 @@ void SwDoc::SetLanguage(const LanguageType eLang, const 
sal_uInt16 nId)
 
 bool SwDoc::HasParagraphDirectFormatting(const SwPosition& rPos)
 {
- 

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

2023-05-24 Thread Michael Stahl (via logerrit)
 sw/inc/anchoredobject.hxx  |5 +
 sw/qa/extras/layout/data/tdf148897.odt |binary
 sw/qa/extras/layout/layout2.cxx|   82 +++
 sw/source/core/inc/txtfly.hxx  |4 +
 sw/source/core/inc/txtfrm.hxx  |3 
 sw/source/core/layout/flylay.cxx   |2 
 sw/source/core/layout/frmtool.cxx  |5 +
 sw/source/core/layout/layact.cxx   |6 +
 sw/source/core/text/frmform.cxx|  100 +++--
 sw/source/core/text/txtfly.cxx |   29 +
 sw/source/core/view/viewsh.cxx |3 
 11 files changed, 219 insertions(+), 20 deletions(-)

New commits:
commit b0e2b60fa45f236f6a993cc1295a7afddabb5098
Author: Michael Stahl 
AuthorDate: Wed May 24 20:16:49 2023 +0200
Commit: Michael Stahl 
CommitDate: Wed May 24 22:29:15 2023 +0200

tdf#148897 tdf#143239 sw: move flys off the page in SwTextFrame::Format()

The bugfix regresses testTdf143239, so we add some scary additional hacks:

* testTdf143239: turns out that this was already moving back and forth
  many times but then ran into some loop control - now with the fix for
  tdf#148897 this still happens, but the result is now bad, where
  previously it was good (by accident?).

  Move the flys off the page also in SwTextFrame::Format() - there is
  already code there to detect that footnotes have been moved off by
  Format_() - this is similar, the formatting should be redone immediately
  if there is a fly that created SwFlyPortions in the current frame, but
  the fly was actually moved to the next page by the very same
  Format_() splitting the frame.

* testKeepWithNextPlusFlyFollowTextFlow: here the problem was that the
  para with the fly didn't move back to page 1; need to clear the
  SwLayouter when toggling FieldNames.

* testKeepwithnextFullheight: this test document will loop creating
  infinite pages if the newly add move code is run during
  SwObjectFormatterTextFrame - the latter must move the flys if it is
  active, not SwTextFrame::Format().

This is all a bit experimental but i failed to have a better idea...

(regression from previous commit)

Change-Id: Icfcbd270137116198128d549b34e7f49a47b6911
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152246
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/sw/source/core/inc/txtfly.hxx b/sw/source/core/inc/txtfly.hxx
index 37d78e3c822f..95d70198f858 100644
--- a/sw/source/core/inc/txtfly.hxx
+++ b/sw/source/core/inc/txtfly.hxx
@@ -152,7 +152,9 @@ class SwTextFly
 
 SwAnchoredObjList* InitAnchoredObjList();
 
+public:
 SwAnchoredObjList* GetAnchoredObjList() const;
+private:
 
 /**
 Look for the first object which overlaps with the rectangle.
@@ -302,6 +304,8 @@ public:
 void SetIgnoreContour( bool bNew );
 
 void SetIgnoreObjsInHeaderFooter( const bool bNew );
+
+SwRect GetFrameArea() const;
 };
 
 inline SwAnchoredObjList* SwTextFly::GetAnchoredObjList() const
diff --git a/sw/source/core/inc/txtfrm.hxx b/sw/source/core/inc/txtfrm.hxx
index 2376153b40d3..c4c51503ec98 100644
--- a/sw/source/core/inc/txtfrm.hxx
+++ b/sw/source/core/inc/txtfrm.hxx
@@ -268,7 +268,8 @@ class SW_DLLPUBLIC SwTextFrame final : public SwContentFrame
 
 // In order to safe stack space, we split this method:
 // Format_ calls Format_ with parameters
-void Format_( vcl::RenderContext* pRenderContext, SwParaPortion *pPara );
+void FormatImpl( vcl::RenderContext* pRenderContext, SwParaPortion *pPara,
+::std::vector & rIntersectingObjs);
 void Format_( SwTextFormatter , SwTextFormatInfo ,
   const bool bAdjust = false );
 void FormatOnceMore( SwTextFormatter , SwTextFormatInfo  );
diff --git a/sw/source/core/text/frmform.cxx b/sw/source/core/text/frmform.cxx
index 912047487a64..5fdf320d4eee 100644
--- a/sw/source/core/text/frmform.cxx
+++ b/sw/source/core/text/frmform.cxx
@@ -50,6 +50,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 // Tolerance in formatting and text output
 #define SLOPPY_TWIPS5
@@ -1775,7 +1777,8 @@ void SwTextFrame::FormatOnceMore( SwTextFormatter , 
SwTextFormatInfo 
 }
 }
 
-void SwTextFrame::Format_( vcl::RenderContext* pRenderContext, SwParaPortion 
*pPara )
+void SwTextFrame::FormatImpl(vcl::RenderContext* pRenderContext, SwParaPortion 
*pPara,
+std::vector & rIntersectingObjs)
 {
 const bool bIsEmpty = GetText().isEmpty();
 
@@ -1810,6 +1813,18 @@ void SwTextFrame::Format_( vcl::RenderContext* 
pRenderContext, SwParaPortion *pP
 if( aLine.IsOnceMore() )
 FormatOnceMore( aLine, aInf );
 
+if (aInf.GetTextFly().IsOn())
+{
+SwRect const aRect(aInf.GetTextFly().GetFrameArea());
+for (SwAnchoredObject *const pObj : 
*aInf.GetTextFly().GetAnchoredObjList())
+{
+if 

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

2023-01-27 Thread Michael Stahl (via logerrit)
 sw/inc/crsrsh.hxx |5 -
 sw/qa/extras/uiwriter/data/tdf114973.fodt |  144 ++
 sw/qa/extras/uiwriter/uiwriter3.cxx   |   34 +++
 sw/source/core/crsr/callnk.cxx|2 
 sw/source/core/crsr/crsrsh.cxx|   26 -
 sw/source/core/crsr/swcrsr.cxx|7 -
 sw/source/core/edit/eddel.cxx |2 
 sw/source/core/edit/edglss.cxx|2 
 sw/source/core/frmedt/fetab.cxx   |2 
 sw/source/core/text/frmcrsr.cxx   |2 
 sw/source/uibase/shells/tabsh.cxx |2 
 sw/source/uibase/wrtsh/select.cxx |2 
 12 files changed, 211 insertions(+), 19 deletions(-)

New commits:
commit bb733957dd39e6f0b9d80bb59eb0177188794797
Author: Michael Stahl 
AuthorDate: Fri Jan 27 16:06:08 2023 +0100
Commit: Michael Stahl 
CommitDate: Fri Jan 27 17:15:44 2023 +

tdf#114973 sw: enable SelectAll with hidden para at start/end

If there's a hidden para the shell cursor can't be positioned in it
ordinarily, so SelectAll will exclude these at the start or end of the
document.

There is already special code to handle a table at the start of the
document body, and it's relatively simple to adapt it to handle hidden
paragraphs as well.

This appears to work surprisingly well, the point is at the start of the
first node of the document, and moving it right immediately puts it to
the first non-hidden paragraph.

But it only works for paragraphs hidden by character formatting or
hidden paragraph field, not if there's a hidden section - there are no
(not even 0-height) SwTextFrames in hidden sections.

Change-Id: Ifd3c11f4169a037fdae2c2b376d0138bec46774f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146257
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx
index 31cad2cd6e71..689a354fffc7 100644
--- a/sw/inc/crsrsh.hxx
+++ b/sw/inc/crsrsh.hxx
@@ -332,8 +332,9 @@ public:
 void ExtendedSelectAll(bool bFootnotes = true);
 /// If ExtendedSelectAll() was called and selection didn't change since 
then.
 bool ExtendedSelectedAll();
-/// If document body starts with a table.
-bool StartsWithTable();
+enum class StartsWith { None, Table, HiddenPara };
+/// If document body starts with a table or starts/ends with hidden 
paragraph.
+StartsWith StartsWith_();
 
 SwCursor* GetCursor( bool bMakeTableCursor = true ) const;
 // return only the current cursor
diff --git a/sw/qa/extras/uiwriter/data/tdf114973.fodt 
b/sw/qa/extras/uiwriter/data/tdf114973.fodt
new file mode 100644
index ..8638cbbb6b4a
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data/tdf114973.fodt
@@ -0,0 +1,144 @@
+
+http://openoffice.org/2009/office; 
xmlns:css3t="http://www.w3.org/TR/css3-text/; 
xmlns:grddl="http://www.w3.org/2003/g/data-view#; 
xmlns:xhtml="http://www.w3.org/1999/xhtml; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema; 
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" 
xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 
xmlns:rpt="http://openoffice.org/2005/report; 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" 
xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" 
xmlns:xlink="http://www.w3.org/1999/xlink; 
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" 
xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" 
xmlns:dc="http://purl.org/dc/eleme
 nts/1.1/" xmlns:ooo="http://openoffice.org/2004/office; 
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" 
xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0"
 
xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0"
 xmlns:drawooo="http://openoffice.org/2010/draw; 
xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" 
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" 
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" 
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" 
xmlns:ooow="http://openoffice.org/2004/writer; 
xmlns:oooc="http://openoffice.org/2004/calc; 
xmlns:tableooo="http://openoffice.org/2009/table; 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
 xmlns:math="http://www.w3.org/1998/Math/MathML; 
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" 
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0
 " xmlns:dom="http://www.w3.org/2001/xml-events; 
xmlns:xforms="http://www.w3.org/2002/xforms; office:version="1.2" 

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

2022-06-10 Thread Miklos Vajna (via logerrit)
 sw/inc/node.hxx|2 ++
 sw/qa/extras/htmlexport/htmlexport.cxx |8 +++-
 sw/source/core/docnode/ndtbl.cxx   |   26 ++
 sw/source/core/docnode/node.cxx|8 +---
 sw/source/filter/html/css1atr.cxx  |   21 +++--
 5 files changed, 55 insertions(+), 10 deletions(-)

New commits:
commit 04cc6e079e3122c183054fde046c054ed6c7b737
Author: Miklos Vajna 
AuthorDate: Fri Jun 10 09:12:33 2022 +0200
Commit: Miklos Vajna 
CommitDate: Fri Jun 10 14:28:11 2022 +0200

sw XHTML export: avoid writing default transparent background for ReqIF

We started writing properties of tables and rows since commit
c3c3303516c3da9372dce3f05f38f15a104e961c (sw XHTML export: output table
/ table row background format using CSS, 2022-05-10).

In case the SwTableLine has an explicit SvxBrushItem with its color set
to COL_TRANSPARENT, we turn that into a "background: transparent" CSS by
default. This is a 1:1 mapping from the doc model, but HTML defaults to
this already, so this is considered as noise.

Extend IgnorePropertyForReqIF() to filter out these unwanted defaults,
and fix SwHTMLWriter::OutCSS1_Property(), because it used to not pass
the CSS value for the filter function.

The behavior for table cells is unchanged, we continue to not export
cell properties (in the ReqIF case) at all.

Change-Id: Idbcd07809e159def694f4de017eebc7ad4104575
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135576
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx 
b/sw/qa/extras/htmlexport/htmlexport.cxx
index 6ca8c80699ea..bc0af92e93c0 100644
--- a/sw/qa/extras/htmlexport/htmlexport.cxx
+++ b/sw/qa/extras/htmlexport/htmlexport.cxx
@@ -2266,10 +2266,14 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, 
testTableBackground)
 pWrtShell->SetTabBackground(aBrush);
 pWrtShell->Down(/*bSelect=*/false);
 pWrtShell->SplitNode();
-pWrtShell->InsertTable(aInsertTableOptions, /*nRows=*/1, /*nCols=*/1);
+pWrtShell->InsertTable(aInsertTableOptions, /*nRows=*/2, /*nCols=*/1);
 pWrtShell->MoveTable(GotoPrevTable, fnTableStart);
 aBrush.SetColor(0x00ff00);
 pWrtShell->SetRowBackground(aBrush);
+pWrtShell->Down(/*bSelect=*/false);
+// Second row has an explicit transparent background.
+aBrush.SetColor(COL_TRANSPARENT);
+pWrtShell->SetRowBackground(aBrush);
 
 // When exporting to reqif-xhtml:
 ExportToReqif();
@@ -2286,6 +2290,8 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, 
testTableBackground)
 assertXPath(pXmlDoc, "//reqif-xhtml:table[2]/reqif-xhtml:tr[1]", "style",
 "background: #00ff00");
 assertXPathNoAttribute(pXmlDoc, 
"//reqif-xhtml:table[2]/reqif-xhtml:tr[1]", "bgcolor");
+// Second row has no explicit style, the default is not written.
+assertXPathNoAttribute(pXmlDoc, 
"//reqif-xhtml:table[2]/reqif-xhtml:tr[2]", "style");
 }
 
 CPPUNIT_TEST_FIXTURE(HtmlExportTest, testImageKeepRatio)
diff --git a/sw/source/filter/html/css1atr.cxx 
b/sw/source/filter/html/css1atr.cxx
index 9619002314af..bc2449b865cc 100644
--- a/sw/source/filter/html/css1atr.cxx
+++ b/sw/source/filter/html/css1atr.cxx
@@ -185,9 +185,21 @@ OString lclConvToHex(sal_uInt16 nHex)
 bool IgnorePropertyForReqIF(bool bReqIF, std::string_view rProperty, 
std::string_view rValue,
 std::optional oMode)
 {
-if (!bReqIF || (oMode.has_value() && *oMode != 
sw::Css1Background::TableCell))
+if (!bReqIF)
 return false;
 
+if (oMode.has_value() && *oMode != sw::Css1Background::TableCell)
+{
+// Table or row.
+if (rProperty == sCSS1_P_background && rValue == "transparent")
+{
+// This is the default already.
+return true;
+}
+
+return false;
+}
+
 // Only allow these two keys, nothing else in ReqIF mode.
 if (rProperty == sCSS1_P_text_decoration)
 {
@@ -244,7 +256,12 @@ void SwHTMLWriter::OutCSS1_Property( const char *pProp,
  const OUString *pSVal,
  std::optional oMode )
 {
-if (IgnorePropertyForReqIF(mbReqIF, pProp, sVal, oMode))
+OString aPropertyValue(sVal);
+if (aPropertyValue.isEmpty() && pSVal)
+{
+aPropertyValue = pSVal->toUtf8();
+}
+if (IgnorePropertyForReqIF(mbReqIF, pProp, aPropertyValue, oMode))
 return;
 
 OStringBuffer sOut;
commit af3c766cb5ddb1959fb659e3c316e42f832d8de3
Author: Miklos Vajna 
AuthorDate: Fri Jun 10 09:11:55 2022 +0200
Commit: Miklos Vajna 
CommitDate: Fri Jun 10 14:27:55 2022 +0200

sw doc model xml dump: show table row properties

Also extract SwTableNode::dumpAsXml() from SwStartNode::dumpAsXml(),
ideally dumpAsXml() should only dump own members, not members of other
classes.


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

2021-10-05 Thread Luboš Luňák (via logerrit)
 sw/inc/swrect.hxx|   17 +
 sw/qa/core/test_rect.cxx |   22 ++
 sw/source/core/bastyp/swrect.cxx |6 --
 sw/source/core/view/viewimp.cxx  |   26 ++
 4 files changed, 65 insertions(+), 6 deletions(-)

New commits:
commit 71429b93ec0687bbbedcbb776b38c981f4017177
Author: Luboš Luňák 
AuthorDate: Mon Oct 4 22:58:24 2021 +0200
Commit: Luboš Luňák 
CommitDate: Tue Oct 5 08:01:42 2021 +0200

try to merge rectangles already in AddPaintRect()

It turns out that e.g. adding a new line in Writer results
in a number of paint rectangles that actually often line up and
form a large rectangle. So try to detect these and merge them
directly, resulting in less work for SwRegionsRects::Compress().

Change-Id: If89ae9463d9c80a1492431afd37bcedfd24bea2d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123077
Tested-by: Jenkins
Reviewed-by: Luboš Luňák 

diff --git a/sw/source/core/view/viewimp.cxx b/sw/source/core/view/viewimp.cxx
index e2243bb1ad88..abb2ef6b174a 100644
--- a/sw/source/core/view/viewimp.cxx
+++ b/sw/source/core/view/viewimp.cxx
@@ -126,6 +126,32 @@ bool SwViewShellImp::AddPaintRect( const SwRect  )
 m_pPaintRegion.reset(new SwRegionRects);
 m_pPaintRegion->ChangeOrigin(rArea);
 }
+if(!m_pPaintRegion->empty())
+{
+// This function often gets called with rectangles that line up 
vertically.
+// Try to extend the last one downwards to include the new one.
+SwRect& last = m_pPaintRegion->back();
+if(last.Left() == rRect.Left() && last.Width() == rRect.Width()
+&& last.Bottom() + 1 >= rRect.Top() && last.Bottom() <= 
rRect.Bottom())
+{
+last = SwRect( last.TopLeft(), rRect.BottomRight());
+// And these rectangles lined up vertically often come up in 
groups
+// that line up horizontally. Try to extend the previous 
rectangle
+// to the right to include the last one.
+if(m_pPaintRegion->size() > 1)
+{
+SwRect& last2 = (*m_pPaintRegion)[m_pPaintRegion->size() - 
2];
+if(last2.Top() == last.Top() && last2.Height() == 
last.Height()
+&& last2.Right() + 1 >= last.Left() && last2.Right() 
<= last2.Right())
+{
+last2 = SwRect( last.TopLeft(), rRect.BottomRight());
+m_pPaintRegion->pop_back();
+return true;
+}
+}
+return true;
+}
+}
 (*m_pPaintRegion) += rRect;
 return true;
 }
commit 8e49016473f0142cb07a1b30f4073f3e73aa4747
Author: Luboš Luňák 
AuthorDate: Mon Oct 4 21:19:13 2021 +0200
Commit: Luboš Luňák 
CommitDate: Tue Oct 5 08:01:31 2021 +0200

fix broken SwRect corner getters

BottomRight() wasn't equal to Point( Right(), Bottom()). Smart *sigh*.

Change-Id: I0af1c018cdf10a4ff23d95752004e565b4102b13
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123076
Tested-by: Jenkins
Reviewed-by: Luboš Luňák 

diff --git a/sw/inc/swrect.hxx b/sw/inc/swrect.hxx
index f6d8430b9d11..b4db7384f456 100644
--- a/sw/inc/swrect.hxx
+++ b/sw/inc/swrect.hxx
@@ -251,6 +251,23 @@ inline tools::Long SwRect::Bottom() const
 return m_Size.getHeight() ? m_Point.getY() + m_Size.getHeight() - 1 : 
m_Point.getY();
 }
 
+inline Point SwRect::TopLeft() const
+{
+return Point( Left(), Top());
+}
+inline Point SwRect::TopRight() const
+{
+return Point( Right(), Top());
+}
+inline Point SwRect::BottomLeft() const
+{
+return Point( Left(), Bottom());
+}
+inline Point SwRect::BottomRight() const
+{
+return Point( Right(), Bottom());
+}
+
 inline bool SwRect::operator == ( const SwRect& rRect ) const
 {
 return (m_Point == rRect.m_Point && m_Size == rRect.m_Size);
diff --git a/sw/qa/core/test_rect.cxx b/sw/qa/core/test_rect.cxx
index 755dbb91bb6e..cfb9fa63a04f 100644
--- a/sw/qa/core/test_rect.cxx
+++ b/sw/qa/core/test_rect.cxx
@@ -17,15 +17,37 @@
 class RectUnittest : public CppUnit::TestFixture
 {
 public:
+void testBasic();
 void testUnion();
 void testIntersection();
 
 CPPUNIT_TEST_SUITE(RectUnittest);
+CPPUNIT_TEST(testBasic);
 CPPUNIT_TEST(testUnion);
 CPPUNIT_TEST(testIntersection);
 CPPUNIT_TEST_SUITE_END();
 };
 
+void RectUnittest::testBasic()
+{
+SwRect rect(Point(10, 15), Size(20, 25));
+
+CPPUNIT_ASSERT_EQUAL(rect, SwRect(10, 15, 20, 25));
+CPPUNIT_ASSERT_EQUAL(rect, SwRect(Point(10, 15), Point(10 + 20 - 1, 15 + 
25 - 1)));
+
+CPPUNIT_ASSERT_EQUAL(tools::Long(20), rect.Width());
+CPPUNIT_ASSERT_EQUAL(tools::Long(25), rect.Height());
+CPPUNIT_ASSERT_EQUAL(tools::Long(10), rect.Left());
+

[Libreoffice-commits] core.git: 2 commits - sw/inc sw/qa sw/source test/source testtools/source

2019-12-23 Thread Noel Grandin (via logerrit)
 sw/inc/calc.hxx  |   60 ++---
 sw/inc/charfmt.hxx   |2 
 sw/inc/fmtcol.hxx|6 
 sw/inc/format.hxx|2 
 sw/inc/frmfmt.hxx|2 
 sw/inc/iodetect.hxx  |2 
 sw/inc/swfltopt.hxx  |4 
 sw/qa/extras/uiwriter/uiwriter.cxx   |4 
 sw/source/core/access/acccell.cxx|2 
 sw/source/core/access/acccontext.hxx |2 
 sw/source/core/access/accdoc.cxx |4 
 sw/source/core/access/accembedded.cxx|2 
 sw/source/core/access/accfootnote.cxx|4 
 sw/source/core/access/accheaderfooter.cxx|4 
 sw/source/core/access/accpage.cxx|2 
 sw/source/core/access/accpara.cxx|4 
 sw/source/core/access/accpreview.cxx |2 
 sw/source/core/access/acctable.cxx   |2 
 sw/source/core/attr/format.cxx   |2 
 sw/source/core/bastyp/calc.cxx   |   72 +++---
 sw/source/core/doc/doccomp.cxx   |   16 -
 sw/source/core/edit/edfcol.cxx   |2 
 sw/source/core/layout/atrfrm.cxx |2 
 sw/source/core/layout/dbg_lay.cxx|4 
 sw/source/core/tox/txmsrt.cxx|2 
 sw/source/core/unocore/unochart.cxx  |   10 
 sw/source/core/unocore/unofield.cxx  |2 
 sw/source/core/unocore/unotext.cxx   |2 
 sw/source/filter/ascii/parasc.cxx|8 
 sw/source/filter/basflt/fltini.cxx   |6 
 sw/source/filter/basflt/iodetect.cxx |8 
 sw/source/filter/html/css1atr.cxx|   58 ++--
 sw/source/filter/html/css1kywd.cxx   |  322 +--
 sw/source/filter/html/css1kywd.hxx   |  320 +-
 sw/source/filter/html/htmlatr.cxx|6 
 sw/source/filter/html/htmlcss1.cxx   |4 
 sw/source/filter/html/htmldrawwriter.cxx |2 
 sw/source/filter/html/htmlfld.cxx|6 
 sw/source/filter/html/htmlfldw.cxx   |6 
 sw/source/filter/html/htmlflywriter.cxx  |   16 -
 sw/source/filter/html/htmlform.cxx   |   10 
 sw/source/filter/html/htmlform.hxx   |8 
 sw/source/filter/html/htmlforw.cxx   |6 
 sw/source/filter/html/htmlftn.cxx|4 
 sw/source/filter/html/htmlnumwriter.cxx  |4 
 sw/source/filter/html/parcss1.cxx|2 
 sw/source/filter/html/svxcss1.hxx|2 
 sw/source/filter/html/swhtml.hxx |4 
 sw/source/filter/html/wrthtml.cxx|   10 
 sw/source/filter/html/wrthtml.hxx|   30 +-
 sw/source/filter/inc/wwstyles.hxx|2 
 sw/source/filter/writer/writer.cxx   |4 
 sw/source/filter/ww8/attributeoutputbase.hxx |4 
 sw/source/filter/ww8/docxattributeoutput.cxx |   14 -
 sw/source/filter/ww8/docxattributeoutput.hxx |2 
 sw/source/filter/ww8/rtfattributeoutput.cxx  |   32 +-
 sw/source/filter/ww8/rtfattributeoutput.hxx  |2 
 sw/source/filter/ww8/rtfexport.cxx   |   11 
 sw/source/filter/ww8/rtfexport.hxx   |6 
 sw/source/filter/ww8/styles.cxx  |6 
 sw/source/filter/ww8/wrtw8nds.cxx|2 
 sw/source/filter/ww8/wrtww8.cxx  |4 
 sw/source/filter/ww8/ww8atr.cxx  |4 
 sw/source/filter/ww8/ww8par.cxx  |   16 -
 sw/source/filter/ww8/ww8par2.cxx |2 
 sw/source/filter/ww8/ww8par3.cxx |2 
 sw/source/filter/ww8/ww8par5.cxx |   56 ++--
 sw/source/filter/ww8/ww8par6.cxx |2 
 sw/source/filter/ww8/ww8scan.cxx |2 
 sw/source/filter/ww8/ww8struc.hxx|2 
 sw/source/filter/xml/swxml.cxx   |8 
 sw/source/filter/xml/wrtxml.cxx  |6 
 sw/source/filter/xml/wrtxml.hxx  |6 
 sw/source/filter/xml/xmltexti.cxx|2 
 sw/source/ui/vba/service.cxx |2 
 sw/source/ui/vba/vbadialog.cxx   |2 
 sw/source/ui/vba/vbadocumentproperties.cxx   |2 
 sw/source/ui/vba/vbarow.cxx  |2 
 sw/source/ui/vba/vbastyles.cxx   |6 
 sw/source/uibase/app/docsh2.cxx  |2 
 sw/source/uibase/dochdl/swdtflvr.cxx |2 
 sw/source/uibase/inc/unodispatch.hxx |2 
 sw/source/uibase/uiview/srcview.cxx  |6 
 sw/source/uibase/uno/unodispatch.cxx |4 
 sw/source/uibase/uno/unofreg.cxx |2 
 sw/source/uibase/uno/unotxdoc.cxx|4 
 sw/source/uibase/utlui/unotools.cxx  |2 
 test/source/helper/transferable.cxx  |4 
 testtools/source/bridgetest/bridgetest.cxx   |2 
 testtools/source/bridgetest/cppobj.cxx   |2 
 testtools/source/performance/ubobject.cxx|2 
 

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

2019-12-10 Thread Noel Grandin (via logerrit)
 sw/inc/fmtfsize.hxx |   12 ++---
 sw/inc/section.hxx  |   12 ++---
 sw/qa/extras/layout/layout.cxx  |   10 ++--
 sw/qa/extras/uiwriter/uiwriter.cxx  |2 
 sw/qa/extras/uiwriter/uiwriter2.cxx |6 +-
 sw/source/core/access/accframe.cxx  |4 -
 sw/source/core/crsr/crstrvl.cxx |4 -
 sw/source/core/crsr/swcrsr.cxx  |2 
 sw/source/core/doc/DocumentStylePoolManager.cxx |4 -
 sw/source/core/doc/doccomp.cxx  |   32 +++---
 sw/source/core/doc/docdesc.cxx  |2 
 sw/source/core/doc/docfly.cxx   |4 -
 sw/source/core/doc/docglbl.cxx  |2 
 sw/source/core/doc/doclay.cxx   |8 +--
 sw/source/core/doc/docnew.cxx   |2 
 sw/source/core/doc/doctxm.cxx   |   18 
 sw/source/core/doc/htmltbl.cxx  |6 +-
 sw/source/core/doc/tblrwcl.cxx  |   14 +++---
 sw/source/core/docnode/ndsect.cxx   |   12 ++---
 sw/source/core/docnode/ndtbl.cxx|   28 ++--
 sw/source/core/docnode/ndtbl1.cxx   |2 
 sw/source/core/docnode/section.cxx  |   32 +++---
 sw/source/core/edit/edglbldc.cxx|4 -
 sw/source/core/edit/edsect.cxx  |4 -
 sw/source/core/edit/edtox.cxx   |6 +-
 sw/source/core/frmedt/fefly1.cxx|4 -
 sw/source/core/frmedt/feshview.cxx  |2 
 sw/source/core/frmedt/tblsel.cxx|2 
 sw/source/core/layout/atrfrm.cxx|   14 +++---
 sw/source/core/layout/fly.cxx   |   24 +--
 sw/source/core/layout/flylay.cxx|2 
 sw/source/core/layout/frmtool.cxx   |2 
 sw/source/core/layout/hffrm.cxx |2 
 sw/source/core/layout/paintfrm.cxx  |4 -
 sw/source/core/layout/ssfrm.cxx |4 -
 sw/source/core/layout/tabfrm.cxx|   16 +++
 sw/source/core/layout/wsfrm.cxx |   10 ++--
 sw/source/core/ole/ndole.cxx|2 
 sw/source/core/table/swnewtable.cxx |   12 ++---
 sw/source/core/table/swtable.cxx|4 -
 sw/source/core/text/EnhancedPDFExportHelper.cxx |6 +-
 sw/source/core/text/pormulti.cxx|2 
 sw/source/core/undo/unattr.cxx  |4 -
 sw/source/core/undo/unsect.cxx  |2 
 sw/source/core/unocore/unoidx.cxx   |   14 +++---
 sw/source/core/unocore/unosect.cxx  |   38 -
 sw/source/core/unocore/unostyle.cxx |2 
 sw/source/core/unocore/unotbl.cxx   |6 +-
 sw/source/filter/html/css1atr.cxx   |4 -
 sw/source/filter/html/htmlcss1.cxx  |4 -
 sw/source/filter/html/htmlflywriter.cxx |8 +--
 sw/source/filter/html/htmlgrin.cxx  |2 
 sw/source/filter/html/htmlplug.cxx  |4 -
 sw/source/filter/html/htmlsect.cxx  |6 +-
 sw/source/filter/html/htmltab.cxx   |   10 ++--
 sw/source/filter/html/wrthtml.cxx   |6 +-
 sw/source/filter/ww8/docxattributeoutput.cxx|   10 ++--
 sw/source/filter/ww8/docxexport.cxx |2 
 sw/source/filter/ww8/docxsdrexport.cxx  |3 -
 sw/source/filter/ww8/rtfattributeoutput.cxx |6 +-
 sw/source/filter/ww8/writerwordglue.cxx |2 
 sw/source/filter/ww8/wrtw8nds.cxx   |   10 ++--
 sw/source/filter/ww8/wrtw8sty.cxx   |   10 ++--
 sw/source/filter/ww8/wrtww8.cxx |8 +--
 sw/source/filter/ww8/ww8atr.cxx |8 +--
 sw/source/filter/ww8/ww8graf.cxx|   10 ++--
 sw/source/filter/ww8/ww8graf2.cxx   |4 -
 sw/source/filter/ww8/ww8par.cxx |4 -
 sw/source/filter/ww8/ww8par2.cxx|   16 +++
 sw/source/filter/ww8/ww8par4.cxx|2 
 sw/source/filter/ww8/ww8par5.cxx|2 
 sw/source/filter/ww8/ww8par6.cxx|   24 +--
 sw/source/filter/xml/xmlexpit.cxx   |4 -
 sw/source/filter/xml/xmlimpit.cxx   |   10 ++--
 sw/source/filter/xml/xmltbli.cxx|8 +--
 sw/source/filter/xml/xmltexti.cxx   |2 
 sw/source/ui/dbui/mmlayoutpage.cxx  |2 
 sw/source/ui/dialog/uiregionsw.cxx  |   52 
 sw/source/ui/frmdlg/column.cxx  |6 +-
 sw/source/ui/frmdlg/frmpage.cxx |   16 +++
 sw/source/ui/frmdlg/wrap.cxx|2 
 sw/source/ui/table/rowht.cxx|6 +-
 sw/source/uibase/app/appenv.cxx |4 -
 

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

2019-10-23 Thread Michael Stahl (via logerrit)
 sw/inc/IDocumentMarkAccess.hxx|2 +
 sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx |2 -
 sw/source/core/doc/docbm.cxx  |   15 +
 sw/source/uibase/wrtsh/delete.cxx |   10 +-
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   35 ++
 5 files changed, 55 insertions(+), 9 deletions(-)

New commits:
commit 6851182cb61a70d3ebd6ee098e8ba5f23582b352
Author: Michael Stahl 
AuthorDate: Fri Oct 11 14:06:25 2019 +0200
Commit: Michael Stahl 
CommitDate: Wed Oct 23 13:02:14 2019 +0200

sw: SwWrtShell: delete field command when deleting the field

Change-Id: I6dbb7a36bdca103d6e9e72a5b5b48ffc135080a1
Reviewed-on: https://gerrit.libreoffice.org/80676
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/sw/inc/IDocumentMarkAccess.hxx b/sw/inc/IDocumentMarkAccess.hxx
index 1e2db2436a61..a076a6dada66 100644
--- a/sw/inc/IDocumentMarkAccess.hxx
+++ b/sw/inc/IDocumentMarkAccess.hxx
@@ -343,6 +343,8 @@ class IDocumentMarkAccess
 
 static SW_DLLPUBLIC OUString GetCrossRefHeadingBookmarkNamePrefix();
 static SW_DLLPUBLIC bool IsLegalPaMForCrossRefHeadingBookmark( const 
SwPaM& rPaM );
+static void DeleteFieldmarkCommand(::sw::mark::IFieldmark const& 
rMark);
+
 protected:
 virtual ~IDocumentMarkAccess() {};
 };
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index 88a6019251b4..4f94baab5c90 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -530,6 +530,17 @@ bool 
IDocumentMarkAccess::IsLegalPaMForCrossRefHeadingBookmark( const SwPaM& rPa
rPaM.End()->nContent.GetIndex() == 
rPaM.End()->nNode.GetNode().GetTextNode()->Len() ) );
 }
 
+void IDocumentMarkAccess::DeleteFieldmarkCommand(::sw::mark::IFieldmark const& 
rMark)
+{
+if (GetType(rMark) != MarkType::TEXT_FIELDMARK)
+{
+return; // TODO FORMDATE has no command?
+}
+SwPaM pam(sw::mark::FindFieldSep(rMark), rMark.GetMarkStart());
+++pam.GetPoint()->nContent; // skip CH_TXT_ATR_FIELDSTART
+pam.GetDoc()->getIDocumentContentOperations().DeleteAndJoin(pam);
+}
+
 namespace sw { namespace mark
 {
 MarkManager::MarkManager(SwDoc& rDoc)
@@ -1104,6 +1115,10 @@ namespace sw { namespace mark
 }
 virtual ~LazyFieldmarkDeleter() override
 {
+// note: because of the call chain from SwUndoDelete, the field
+// command *cannot* be deleted here as it would create a separate
+// SwUndoDelete that's interleaved with the SwHistory of the outer
+// one - only delete the CH_TXT_ATR_FIELD*!
 m_pFieldmark->ReleaseDoc(m_pDoc);
 }
 };
diff --git a/sw/source/uibase/wrtsh/delete.cxx 
b/sw/source/uibase/wrtsh/delete.cxx
index cbb3fad91b69..4a2420ad7b84 100644
--- a/sw/source/uibase/wrtsh/delete.cxx
+++ b/sw/source/uibase/wrtsh/delete.cxx
@@ -239,10 +239,13 @@ bool SwWrtShell::DelLeft()
 const SwPosition* pCurPos = GetCursor()->GetPoint();
 SwPosition aPrevChar(*pCurPos);
 --aPrevChar.nContent;
-sw::mark::IFieldmark* pFm = 
getIDocumentMarkAccess()->getFieldmarkFor(aPrevChar);
+sw::mark::IFieldmark* pFm = 
getIDocumentMarkAccess()->getFieldmarkAt(aPrevChar);
 if (pFm && pFm->GetMarkEnd() == *pCurPos)
 {
+mxDoc->GetIDocumentUndoRedo().StartUndo(SwUndoId::EMPTY, nullptr);
+IDocumentMarkAccess::DeleteFieldmarkCommand(*pFm);
 getIDocumentMarkAccess()->deleteMark(pFm);
+mxDoc->GetIDocumentUndoRedo().EndUndo(SwUndoId::EMPTY, nullptr);
 return true;
 }
 
@@ -375,10 +378,13 @@ bool SwWrtShell::DelRight()
 
 {
 // If we are just ahead of a fieldmark, then remove it completely
-sw::mark::IFieldmark* pFm = GetCurrentFieldmark();
+sw::mark::IFieldmark *const pFm = 
getIDocumentMarkAccess()->getFieldmarkAt(*GetCursor()->GetPoint());
 if (pFm && pFm->GetMarkStart() == *GetCursor()->GetPoint())
 {
+mxDoc->GetIDocumentUndoRedo().StartUndo(SwUndoId::EMPTY, 
nullptr);
+IDocumentMarkAccess::DeleteFieldmarkCommand(*pFm);
 getIDocumentMarkAccess()->deleteMark(pFm);
+mxDoc->GetIDocumentUndoRedo().EndUndo(SwUndoId::EMPTY, 
nullptr);
 bRet = true;
 break;
 }
commit f610f9b611fe9f206b872ed06f7e859d688385fc
Author: Michael Stahl 
AuthorDate: Wed Oct 2 17:15:32 2019 +0200
Commit: Michael Stahl 
CommitDate: Wed Oct 23 13:01:53 2019 +0200

writerfilter: import nested generic fields from RTF

* for m_bStartGenericField, push new insert position onto the stack in
  DomainMapper_Impl::CloseFieldCommand(), not in
  DomainMapper_Impl::appendTextPortion()
* how is the field result inserted into the field, instead of after it?
  - it 

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

2019-10-23 Thread Michael Stahl (via logerrit)
 sw/inc/IDocumentMarkAccess.hxx |6 +++--
 sw/qa/extras/ww8export/ww8export2.cxx  |2 -
 sw/source/core/crsr/annotationmark.cxx |3 +-
 sw/source/core/crsr/bookmrk.cxx|   35 +++--
 sw/source/core/doc/docbm.cxx   |   15 +-
 sw/source/core/inc/MarkManager.hxx |6 +++--
 sw/source/core/inc/annotationmark.hxx  |2 -
 sw/source/core/inc/bookmrk.hxx |   10 -
 sw/source/filter/ww8/ww8par5.cxx   |6 +++--
 9 files changed, 56 insertions(+), 29 deletions(-)

New commits:
commit 7f2e61f884949ab27bcb7e1a02ece9a5cb4354b9
Author: Michael Stahl 
AuthorDate: Fri Oct 11 14:55:53 2019 +0200
Commit: Michael Stahl 
CommitDate: Wed Oct 23 13:00:23 2019 +0200

sw: WW8: fix the separator position

WW8 inserts the fieldmark at the end of the result, so separator should
be at the start; writerfilter inserts fieldmark at the end of command so
separator should be at the end.

Change-Id: I44c9811139a34f529c553dd2fd46fdaccd554732
Reviewed-on: https://gerrit.libreoffice.org/80674
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/sw/qa/extras/ww8export/ww8export2.cxx 
b/sw/qa/extras/ww8export/ww8export2.cxx
index 43c3252953f5..b2523b822370 100644
--- a/sw/qa/extras/ww8export/ww8export2.cxx
+++ b/sw/qa/extras/ww8export/ww8export2.cxx
@@ -312,7 +312,7 @@ DECLARE_WW8EXPORT_TEST(testTdf104334, "tdf104334.doc")
 // This failed with a container::NoSuchElementException: STYLEREF was
 // mapped to SwChapterField, and the field result was "This is a Heading 1"
 // instead of just "1".
-CPPUNIT_ASSERT_EQUAL(OUString("1"), getRun(getParagraph(2), 
3)->getString());
+CPPUNIT_ASSERT_EQUAL(OUString("1"), getRun(getParagraph(2), 
4)->getString());
 }
 
 DECLARE_WW8EXPORT_TEST(testTdf108072, "tdf108072.doc")
diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx
index 1c27d73c3021..1ddbb49c3823 100644
--- a/sw/source/filter/ww8/ww8par5.cxx
+++ b/sw/source/filter/ww8/ww8par5.cxx
@@ -541,7 +541,8 @@ sal_uInt16 SwWW8ImplReader::End_Field()
 SwPaM aFieldPam( m_aFieldStack.back().GetPtNode(), 
m_aFieldStack.back().GetPtContent(), aEndPos.nNode, 
aEndPos.nContent.GetIndex());
 IDocumentMarkAccess* pMarksAccess = m_rDoc.getIDocumentMarkAccess( 
);
 IFieldmark *pFieldmark = pMarksAccess->makeFieldBookmark(
-aFieldPam, m_aFieldStack.back().GetBookmarkName(), 
ODF_FORMTEXT );
+aFieldPam, m_aFieldStack.back().GetBookmarkName(), 
ODF_FORMTEXT,
+aFieldPam.Start() /*same pos as start!*/ );
 OSL_ENSURE(pFieldmark!=nullptr, "hmmm; why was the bookmark not 
created?");
 if (pFieldmark!=nullptr) {
 // adapt redline positions to inserted field mark start
@@ -640,7 +641,8 @@ sal_uInt16 SwWW8ImplReader::End_Field()
 IFieldmark* pFieldmark = pMarksAccess->makeFieldBookmark(
 aFieldPam,
 m_aFieldStack.back().GetBookmarkName(),
-ODF_UNHANDLED );
+ODF_UNHANDLED,
+aFieldPam.Start() /*same pos as start!*/ );
 if ( pFieldmark )
 {
 // adapt redline positions to inserted field mark start
commit 1332cf210803215857b81e8ca9c029aa3d6c49c2
Author: Michael Stahl 
AuthorDate: Fri Oct 11 14:48:12 2019 +0200
Commit: Michael Stahl 
CommitDate: Wed Oct 23 13:00:02 2019 +0200

sw: add CH_TXT_ATR_FIELDSEP position parameter when inserting

Different callers want it at the end, at the start, or in the case of
Undo it can even be in an arbitrary position... (except if it is ensured
that the field command is deleted before the fieldmark?).

So let's just pass in SwPosition and be flexible, if it is missing it
will be before the end as before.

Change-Id: Ibec222f633bdaf66abd1540027d0f5c75988c738
Reviewed-on: https://gerrit.libreoffice.org/80673
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/sw/inc/IDocumentMarkAccess.hxx b/sw/inc/IDocumentMarkAccess.hxx
index a8dacbcbd7e4..1e2db2436a61 100644
--- a/sw/inc/IDocumentMarkAccess.hxx
+++ b/sw/inc/IDocumentMarkAccess.hxx
@@ -132,11 +132,13 @@ class IDocumentMarkAccess
 */
 virtual ::sw::mark::IMark* makeMark(const SwPaM& rPaM,
 const OUString& rProposedName,
-MarkType eMark, ::sw::mark::InsertMode eMode) = 0;
+MarkType eMark, ::sw::mark::InsertMode eMode,
+SwPosition const* pSepPos = nullptr) = 0;
 
 virtual sw::mark::IFieldmark* makeFieldBookmark( const SwPaM& rPaM,
 const OUString& rName,
-const OUString& rType) = 0;
+const OUString& rType,
+SwPosition const* pSepPos 

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

2019-09-05 Thread Michael Stahl (via logerrit)
 sw/inc/list.hxx  |4 +-
 sw/qa/extras/ooxmlexport/ooxmlexport13.cxx   |3 -
 sw/source/filter/ww8/attributeoutputbase.hxx |4 ++
 sw/source/filter/ww8/docxattributeoutput.cxx |   12 ++
 sw/source/filter/ww8/docxattributeoutput.hxx |3 +
 sw/source/filter/ww8/rtfattributeoutput.cxx  |2 -
 sw/source/filter/ww8/rtfexport.cxx   |4 +-
 sw/source/filter/ww8/wrtw8num.cxx|   50 +++
 sw/source/filter/ww8/wrtww8.hxx  |   11 +
 sw/source/filter/ww8/ww8atr.cxx  |   29 ++-
 10 files changed, 107 insertions(+), 15 deletions(-)

New commits:
commit 1f6b7030cbdc81e8e408e3a13bfcd01fcbdd7550
Author: Michael Stahl 
AuthorDate: Wed Sep 4 12:27:52 2019 +0200
Commit: Michael Stahl 
CommitDate: Thu Sep 5 10:18:12 2019 +0200

tdf#95848 sw: DOCX export: crude implementation of abstractNum mapping

The abstractNum needs to correspond to a SwList, not to a SwNumRule as
it is currently implemented.

Add a mapping to MSWordExportBase for "overriding" numbering
definitions; these are added to m_pUsedNumTable, which appears to be
necessary to interact with DuplicateNumRule(), but here we just add
nullpointers, because we don't need to modify the SwNumrule, and neither
do we want the vector to double-delete it.

The mapping is created while iterating over the document, in
AttributeOutputBase::ParaNumRule().

It turns out that this approach would work for WW8 too as
DuplicateNumRule() was originally added for that format but it won't
work easily for RTF; in the DOCX case the WriteNumbering() is called
after the main text and footnotes/endnotes, but with RTF it's the
other way around :(

Change-Id: Ia0409f5ad0b2e089005024ef7f61850a06d4dcbe
Reviewed-on: https://gerrit.libreoffice.org/78607
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/sw/inc/list.hxx b/sw/inc/list.hxx
index 1cfdad5e0716..d8b3e16943ea 100644
--- a/sw/inc/list.hxx
+++ b/sw/inc/list.hxx
@@ -24,6 +24,8 @@
 #include 
 #include 
 
+#include "swdllapi.h"
+
 class SwNumRule;
 class SwNodes;
 class SwNodeNum;
@@ -40,7 +42,7 @@ class SwList
 
 const OUString & GetListId() const;
 
-const OUString & GetDefaultListStyleName() const;
+SW_DLLPUBLIC const OUString & GetDefaultListStyleName() const;
 void SetDefaultListStyleName(OUString const&);
 
 void InsertListItem( SwNodeNum& rNodeNum,
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
index ed6bcc309c93..88e65268cf01 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
@@ -66,8 +66,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf121374_sectionHF2, 
"tdf121374_sectionHF2.doc")
 CPPUNIT_ASSERT( xHeaderText->getString().startsWith("virkamatka-anomus") );
 }
 
-// TODO export has the same wrong assumption that abstractNum = SwNumRule
-DECLARE_SW_EXPORT_TEST(testTdf95848, "tdf95848.docx", nullptr, Test)
+DECLARE_OOXMLEXPORT_TEST(testTdf95848, "tdf95848.docx")
 {
 OUString listId;
 OUString listStyle;
diff --git a/sw/source/filter/ww8/attributeoutputbase.hxx 
b/sw/source/filter/ww8/attributeoutputbase.hxx
index b6eca7f2da22..ef681cf01e5a 100644
--- a/sw/source/filter/ww8/attributeoutputbase.hxx
+++ b/sw/source/filter/ww8/attributeoutputbase.hxx
@@ -346,6 +346,10 @@ public:
 /// Definition of a numbering instance.
 virtual void NumberingDefinition( sal_uInt16 nId, const SwNumRule  ) 
= 0;
 
+/// Numbering defintion that overrides abstract numbering definition
+virtual void OverrideNumberingDefinition(sal_uInt16 /*nNum*/, sal_uInt16 
/*nAbstractNum*/)
+{ assert(false); } // TODO implement for WW8/RTF
+
 /// Start of the abstract numbering definition instance.
 virtual void StartAbstractNumbering( sal_uInt16 /*nId*/ ) {}
 
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index debba8ae9ae1..deaf3fd59917 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -6558,6 +6558,18 @@ void DocxAttributeOutput::NumberingDefinition( 
sal_uInt16 nId, const SwNumRule &
 m_pSerializer->endElementNS( XML_w, XML_num );
 }
 
+void DocxAttributeOutput::OverrideNumberingDefinition(
+sal_uInt16 const nNum, sal_uInt16 const nAbstractNum)
+{
+m_pSerializer->startElementNS(XML_w, XML_num, FSNS(XML_w, XML_numId), 
OString::number(nNum));
+
+m_pSerializer->singleElementNS(XML_w, XML_abstractNumId, FSNS(XML_w, 
XML_val), OString::number(nAbstractNum));
+
+// TODO: write SwNumRule into w:lvlOverride
+
+m_pSerializer->endElementNS( XML_w, XML_num );
+}
+
 void DocxAttributeOutput::StartAbstractNumbering( sal_uInt16 nId )
 {
 const SwNumRule* pRule = (*m_rExport.m_pUsedNumTable)[nId - 1];
diff --git 

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

2018-12-10 Thread Libreoffice Gerrit user
 sw/inc/unosett.hxx  |   12 
 sw/qa/extras/layout/data/forcepoint76-1.rtf | 3388 
 sw/qa/extras/layout/layout.cxx  |5 
 sw/source/core/inc/frame.hxx|2 
 sw/source/core/inc/ftnfrm.hxx   |1 
 sw/source/core/layout/calcmove.cxx  |1 
 sw/source/core/layout/ftnfrm.cxx|   29 
 sw/source/core/layout/tabfrm.cxx|5 
 sw/source/core/unocore/unosett.cxx  |   56 
 9 files changed, 3461 insertions(+), 38 deletions(-)

New commits:
commit 0005b330eaed0b5559042d2597fb45e0c9125d7e
Author: Caolán McNamara 
AuthorDate: Wed Dec 5 13:22:44 2018 +
Commit: Caolán McNamara 
CommitDate: Mon Dec 10 14:18:48 2018 +0100

forcepoint#76 avoid deleting footnote that would delete undeletable page

Change-Id: I4622569eb9c757c6dcbdda32081ddc94e53db919
Reviewed-on: https://gerrit.libreoffice.org/64622
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sw/qa/extras/layout/data/forcepoint76-1.rtf 
b/sw/qa/extras/layout/data/forcepoint76-1.rtf
new file mode 100644
index ..f3ed2cc468e3
--- /dev/null
+++ b/sw/qa/extras/layout/data/forcepoint76-1.rtf
@@ -0,0 +1,3388 @@
+{\rtf1\a|eflang1037\ansi\ansicpg1252\uc1\adeff0\deff0\stshfdbch0\stshfloch0\stshfhich0\stshfbi0\deflang1033\deflangfe1033{\fonttbl{\f0\froman\fcharset0\fprq2{\*\panose
 02020603050405020304}Times New Roman;}{\f1\fswiss\fcharset0\fprq2{\*\panose 
020b0604020202020204}Arial;}
+{\f2\fmodern\fcharset0\fprq1{\*\panose 02070309020205020404}Courier 
New;}{\f3\froman\fcharset2\fprq2{\*\panose 
05050102010706020507}Symbol;}{\f4\fswiss\fcharset0\fprq2{\*\panose 
020b0604020202020204}Helvetica;}
+{\f5\fmodern\fcharset0\fprq1{\*\panose 
02060409020205020404}Courier;}{\f6\froman\fcharset0\fprq2{\*\panose 
02020603040505020304}Tms Rmn;}{\f7\fswiss\fcharset0\fprq2{\*\panose 
020b0604020202030204}Helv;}
+{\f8\froman\fcharset0\fprq2{\*\panose 02040503060506020304}New 
York;}{\f9\fswiss\fcharset0\fprq2{\*\panose 
}System;}{\f10\fnil\fcharset2\fprq2{\*\panose 
0500}Wingdings;}
+{\f11\froman\fcharset128\fprq1{\*\panose 02020609040205080304}MS 
Mincho{\*\falt ?l?r ??\'81\'66c};}{\f12\fnil\fcharset129\fprq1{\*\panose 
0203060101010101}Batang{\*\falt \'a2\'ae\'a1\'d7IoUAA};}
+{\f13\fnil\fcharset134\fprq2{\*\panose 02010600030101010101}SimSun{\*\falt 
\'a8\'ac??};}{\f14\fnil\fcharset136\fprq2{\*\panose 
02010601000101010101}PMingLiU{\*\falt !Ps2OcuAe};}
+{\f15\fmodern\fcharset128\fprq1{\*\panose 020b0609070205080204}MS 
Gothic{\*\falt ?l?r ?S?V?b?N};}
+{\f16\fmodern\fcharset129\fprq1{\*\panose 020b060101010101}Dotum{\*\falt 
\'a1\'cb\'a2\'e7Ii\'a1\'cb\'a2\'e7e\'a1\'cb\'a2\'e7\'a8\'cf\'a1\'a9\'a1\'cb\'a2\'e7e?o};}
+{\f17\fmodern\fcharset134\fprq1{\*\panose 02010600030101010101}SimHei{\*\falt 
o??\'a8\'ac2??\'a8\'ac??};}{\f0\fmodern\fcharset136\fprq1{\*\panose 
02010609000101010101}MingLiU{\*\falt 2OcuAe};}
+{\f19\froman\fcharset128\fprq1{\*\panose 7202762996549695502}Mincho{\*\falt 
??\'81\'66c};}
+{\f20\froman\fcharset129\fprq1{\*\panose 020b060101010101}Gulim{\*\falt 
\'a2\'aee\'a1\'cbc\'a2\'ae\'a1\'d7u\'a1\'cb\'a2\'e7\'a2\'ae\'a1\'bfu\'a1\'cb\'a2\'e7e\'a1\'cb\'a2\'e7\'a8\'cf\'a1\'a9\'a2\'ae\'a1\'d7I\'a1\'cb\'a2\'e7a};}
+{\f21\froman\fcharset0\fprq2{\*\panose 
02040603050705020303}Century;}{\f22\froman\fcharset0\fprq2{\*\panose 
02020603050405020304}Angsana New;}{\f23\fswiss\fcharset0\fprq2{\*\panose 
020b0304020202020204}Cordia New;}
+{\f24\fnil\fcharset1\fprq2{\*\panose 
0400}Mangal;}{\f25\fnil\fcharset1\fprq2{\*\panose 
02000400}Latha;}{\f26\froman\fcharset0\fprq2{\*\panose 
010a0502050306030303}Sylfaen;}
+{\f27\froman\fcharset1\fprq2{\*\panose 
0400}Vrinda;}{\f28\fnil\fcharset1\fprq2{\*\panose 
02000500}Raavi;}{\f29\fnil\fcharset1\fprq2{\*\panose 
02000500}Shruti;}
+{\f30\froman\fcharset1\fprq2{\*\panose 
0400}Sendnya;}{\f31\fnil\fcharset1\fprq2{\*\panose 
02000500}Gautami;}{\f32\fnil\fcharset1\fprq2{\*\panose 
0400}Tunga;}
+{\f33\fscript\fcharset1\fprq2{\*\panose 03080600}Estrangelo 
Edessa;}{\f34\froman\fcharset0\fprq2{\*\panose 020b0604020202020204}Arial 
Unicode MS;}{\f35\fswiss\fcharset0\fprq2{\*\panose 020b0604030504040204}Tahoma;}
+{\f36\fnil\fcharset134\fprq2{\*\panose 
}@SimSun;}{\f37\froman\fcharset0\fprq2 Times New Roman 
CE;}{\f38\froman\fcharset0\fprq2 Times New Roman 
CYR;}{\f39\froman\fcharset0\fprq2 Times New Roman Greek;}
+{\f40\froman\fcharset0\fprq2 Times New Roman TUR;}{\f41\froman\fcharset0\fprq2 
Times New Roman Baltic;}{\f42\fswiss\fcharset0\fprq2{\*\panose 
020b0604030504040204}Verdana;}{\f43\fswiss\fcharset0\fprq2{\*\panose 
020b0603020202020204}Trebuchet MS;}
+{\f44\fswiss\fcharset0\fprq2{\*\panose 020e0802040304020204}Albertus Extra 

[Libreoffice-commits] core.git: 2 commits - sw/inc sw/qa sw/source sw/uiconfig sw/UIConfig_swriter.mk

2018-04-25 Thread Caolán McNamara
 sw/UIConfig_swriter.mk   |1 
 sw/inc/strings.hrc   |2 
 sw/qa/unit/data/sw-dialogs-test.txt  |1 
 sw/source/ui/envelp/label1.cxx   |  176 ---
 sw/source/ui/envelp/labelexp.cxx |  134 ---
 sw/source/ui/envelp/swuilabimp.hxx   |   43 ---
 sw/source/uibase/inc/label.hxx   |1 
 sw/uiconfig/swriter/ui/cardformatpage.ui |  129 --
 sw/uiconfig/swriter/ui/labeldialog.ui|   37 +-
 9 files changed, 10 insertions(+), 514 deletions(-)

New commits:
commit fb55ab7c8ed49bdf5d9d0d57ca0741c20cb16451
Author: Caolán McNamara 
Date:   Wed Apr 25 10:19:15 2018 +0100

SwVisitingCardPage is now unused

Change-Id: I0d9d3cbcbc9c3e6019dbd220a42c0a18fdd1ca67
Reviewed-on: https://gerrit.libreoffice.org/53442
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sw/UIConfig_swriter.mk b/sw/UIConfig_swriter.mk
index 9092d085e48d..02b81e3a268c 100644
--- a/sw/UIConfig_swriter.mk
+++ b/sw/UIConfig_swriter.mk
@@ -105,7 +105,6 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/swriter,\
sw/uiconfig/swriter/ui/cannotsavelabeldialog \
sw/uiconfig/swriter/ui/captiondialog \
sw/uiconfig/swriter/ui/captionoptions \
-   sw/uiconfig/swriter/ui/cardformatpage \
sw/uiconfig/swriter/ui/cardmediumpage \
sw/uiconfig/swriter/ui/ccdialog \
sw/uiconfig/swriter/ui/characterproperties \
diff --git a/sw/qa/unit/data/sw-dialogs-test.txt 
b/sw/qa/unit/data/sw-dialogs-test.txt
index 2732cfa830ca..931a40c09c28 100644
--- a/sw/qa/unit/data/sw-dialogs-test.txt
+++ b/sw/qa/unit/data/sw-dialogs-test.txt
@@ -65,7 +65,6 @@ modules/swriter/ui/businessdatapage.ui
 modules/swriter/ui/cannotsavelabeldialog.ui
 modules/swriter/ui/captiondialog.ui
 modules/swriter/ui/captionoptions.ui
-modules/swriter/ui/cardformatpage.ui
 modules/swriter/ui/cardmediumpage.ui
 modules/swriter/ui/ccdialog.ui
 modules/swriter/ui/characterproperties.ui
diff --git a/sw/source/ui/envelp/label1.cxx b/sw/source/ui/envelp/label1.cxx
index 2b76d2c5b3eb..6ff18b882716 100644
--- a/sw/source/ui/envelp/label1.cxx
+++ b/sw/source/ui/envelp/label1.cxx
@@ -565,176 +565,6 @@ void SwLabPage::Reset(const SfxItemSet* rSet)
 m_pSheetButton->Check();
 }
 
-void SwVisitingCardPage::ClearUserData()
-{
-SvTreeListEntry* pEntry = m_pAutoTextLB->First();
-while(pEntry)
-{
-delete static_cast(pEntry->GetUserData());
-pEntry = m_pAutoTextLB->Next(pEntry);
-}
-}
-
-void SwVisitingCardPage::SetUserData( sal_uInt32 nCnt,
-const OUString* pNames, const OUString* pValues )
-{
-for( sal_uInt32 i = 0; i < nCnt; ++i )
-{
-SvTreeListEntry* pEntry = m_pAutoTextLB->InsertEntry( pNames[ i ] );
-pEntry->SetUserData( new OUString( pValues[ i ] ));
-}
-}
-
-SwVisitingCardPage::SwVisitingCardPage(vcl::Window* pParent, const SfxItemSet& 
rSet)
-: SfxTabPage(pParent, "CardFormatPage",
-"modules/swriter/ui/cardformatpage.ui", )
-, pExampleFrame(nullptr)
-{
-get(m_pAutoTextLB, "treeview");
-m_pAutoTextLB->set_height_request(m_pAutoTextLB->GetTextHeight() * 16);
-get(m_pAutoTextGroupLB, "autotext");
-get(m_pExampleWIN, "preview");
-
-m_pAutoTextLB->SetStyle( m_pAutoTextLB->GetStyle() | WB_HSCROLL );
-m_pAutoTextLB->SetSpaceBetweenEntries(0);
-m_pAutoTextLB->SetSelectionMode( SelectionMode::Single );
-
-SetExchangeSupport();
-m_pAutoTextLB->SetSelectHdl(LINK(this, SwVisitingCardPage, 
AutoTextSelectTreeListBoxHdl));
-m_pAutoTextGroupLB->SetSelectHdl(LINK(this, SwVisitingCardPage, 
AutoTextSelectHdl));
-
-m_pExampleWIN->Hide();
-
-InitFrameControl();
-}
-
-SwVisitingCardPage::~SwVisitingCardPage()
-{
-disposeOnce();
-}
-
-void SwVisitingCardPage::dispose()
-{
-for(sal_Int32 i = 0; i < m_pAutoTextGroupLB->GetEntryCount(); ++i)
-delete static_cast(m_pAutoTextGroupLB->GetEntryData( i ));
-m_xAutoText = nullptr;
-
-ClearUserData();
-delete pExampleFrame;
-m_pAutoTextLB.clear();
-m_pAutoTextGroupLB.clear();
-m_pExampleWIN.clear();
-SfxTabPage::dispose();
-}
-
-VclPtr SwVisitingCardPage::Create(TabPageParent pParent, const 
SfxItemSet* rSet)
-{
-return VclPtr::Create(pParent.pParent, *rSet);
-}
-
-void SwVisitingCardPage::ActivatePage(const SfxItemSet& rSet)
-{
-Reset(  );
-UpdateFields();
-}
-
-DeactivateRC SwVisitingCardPage::DeactivatePage(SfxItemSet* _pSet)
-{
-if (_pSet)
-FillItemSet(_pSet);
-return DeactivateRC::LeavePage;
-}
-
-bool SwVisitingCardPage::FillItemSet(SfxItemSet* rSet)
-{
-const OUString* pGroup = static_cast(m_pAutoTextGroupLB->GetSelectedEntryData());
-OSL_ENSURE(pGroup, "no group selected?");
-
-if (pGroup)
-

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

2017-09-13 Thread Jan Holesovsky
 sw/inc/shellio.hxx   |4 +-
 sw/qa/extras/txtexport/txtexport.cxx |   63 +++
 sw/source/filter/ascii/ascatr.cxx|4 +-
 sw/source/filter/writer/writer.cxx   |2 -
 4 files changed, 69 insertions(+), 4 deletions(-)

New commits:
commit 3563220f048da5e0e893b8ac7faf5e8f14889fa5
Author: Jan Holesovsky 
Date:   Tue Sep 12 13:29:46 2017 +0200

tdf#112191: Unit test.

This was the hard part of the fix :-)

Change-Id: Iae335c9d41d9b3420472b5d02113e2b42ab825da
Reviewed-on: https://gerrit.libreoffice.org/42203
Tested-by: Jenkins 
Reviewed-by: Jan Holesovsky 

diff --git a/sw/qa/extras/txtexport/txtexport.cxx 
b/sw/qa/extras/txtexport/txtexport.cxx
index b9cd02bdf0b5..59e64d215872 100644
--- a/sw/qa/extras/txtexport/txtexport.cxx
+++ b/sw/qa/extras/txtexport/txtexport.cxx
@@ -11,8 +11,41 @@
 
 #include 
 #include 
+
+#include 
+#include 
 #include 
 
+class TxtImportTest : public SwModelTestBase
+{
+public:
+TxtImportTest() :
+SwModelTestBase("/sw/qa/extras/txtexport/data/", "Text")
+{}
+
+// Export & assert part of the document (defined by SwPaM).
+void assertExportedRange(const OString& aExpected, SwPaM& rPaM)
+{
+WriterRef rAsciiWriter;
+GetASCWriter(aEmptyOUStr, OUString(), rAsciiWriter);
+CPPUNIT_ASSERT(rAsciiWriter.is());
+
+// no start char
+rAsciiWriter->bUCS2_WithStartChar = false;
+
+SvMemoryStream aMemoryStream;
+
+SwWriter aWriter(aMemoryStream, rPaM);
+ErrCode nError = aWriter.Write(rAsciiWriter);
+CPPUNIT_ASSERT_EQUAL(ERRCODE_NONE, nError);
+
+const char* pData = static_cast(aMemoryStream.GetData());
+OString aResult(pData, aMemoryStream.GetSize());
+
+CPPUNIT_ASSERT_EQUAL(aExpected, aResult);
+}
+};
+
 class TxtExportTest : public SwModelTestBase
 {
 public:
@@ -36,6 +69,7 @@ protected:
 }
 };
 
+#define DECLARE_TXTIMPORT_TEST(TestName, filename) 
DECLARE_SW_EXPORT_TEST(TestName, filename, nullptr, TxtImportTest)
 #define DECLARE_TXTEXPORT_TEST(TestName, filename) 
DECLARE_SW_EXPORT_TEST(TestName, filename, nullptr, TxtExportTest)
 
 DECLARE_TXTEXPORT_TEST(testBullets, "bullets.odt")
@@ -71,6 +105,35 @@ DECLARE_TXTEXPORT_TEST(testBullets, "bullets.odt")
 CPPUNIT_ASSERT_EQUAL(aExpected, aData);
 }
 
+DECLARE_TXTIMPORT_TEST(testTdf112191, "bullets.odt")
+{
+SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get());
+CPPUNIT_ASSERT(pTextDoc);
+SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc();
+CPPUNIT_ASSERT(pDoc);
+
+// just the 5th paragraph - no bullet
+uno::Reference xPara(getParagraph(5));
+SwUnoInternalPaM aPaM(*pDoc);
+bool bSuccess = sw::XTextRangeToSwPaM(aPaM, xPara);
+CPPUNIT_ASSERT(bSuccess);
+
+assertExportedRange(OString("First bullet"), aPaM);
+
+// but when we extend to the next paragraph - now there are bullets
+xPara = getParagraph(6);
+SwUnoInternalPaM aPaM2(*pDoc);
+bSuccess = sw::XTextRangeToSwPaM(aPaM2, xPara);
+CPPUNIT_ASSERT(bSuccess);
+
+OUString aString = OStringToOUString(
+"\xe2\x80\xa2 First bullet" SAL_NEWLINE_STRING
+"\xe2\x80\xa2 Second bullet", RTL_TEXTENCODING_UTF8);
+
+SwPaM aPaM3(*aPaM2.GetMark(), *aPaM.GetPoint());
+assertExportedRange(OUStringToOString(aString, 
osl_getThreadTextEncoding()), aPaM3);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 9ead87264328beead1c7e878c2aee03e03af
Author: Jan Holesovsky 
Date:   Tue Sep 12 13:28:32 2017 +0200

tdf#112191: Don't export bullets when only one paragraph is selected.

Change-Id: Ibea54f857e78a850ea05643743884ae2157dae57
Reviewed-on: https://gerrit.libreoffice.org/42202
Tested-by: Jenkins 
Reviewed-by: Jan Holesovsky 

diff --git a/sw/inc/shellio.hxx b/sw/inc/shellio.hxx
index 1ebc33e4e0a8..92544413bdfa 100644
--- a/sw/inc/shellio.hxx
+++ b/sw/inc/shellio.hxx
@@ -370,7 +370,6 @@ class SW_DLLPUBLIC Writer
 
 protected:
 
-SwPaM* pOrigPam;// Last Pam that has to be processed.
 const OUString* pOrigFileName;
 
 void ResetWriter();
@@ -390,6 +389,7 @@ protected:
 
 public:
 SwDoc* pDoc;
+SwPaM* pOrigPam;// Last Pam that has to be processed.
 SwPaM* pCurPam;
 bool bWriteAll : 1;
 bool bShowProgress : 1;
@@ -544,7 +544,7 @@ namespace SwReaderWriter
 }
 
 void GetRTFWriter( const OUString&, const OUString&, WriterRef& );
-void GetASCWriter( const OUString&, const OUString&, WriterRef& );
+SW_DLLPUBLIC void GetASCWriter(const OUString&, const OUString&, WriterRef&);
 void GetHTMLWriter( const OUString&, const OUString&, WriterRef& );
 void GetXMLWriter( const OUString&, const OUString&, WriterRef& );
 
diff --git a/sw/source/filter/ascii/ascatr.cxx 

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

2017-01-25 Thread Michael Stahl
 sw/inc/ToxLinkProcessor.hxx |9 +--
 sw/qa/core/test_ToxLinkProcessor.cxx|   38 ++--
 sw/source/core/tox/ToxLinkProcessor.cxx |   18 +++
 3 files changed, 32 insertions(+), 33 deletions(-)

New commits:
commit 68f7be01a78a5bad56ddd94c04764131676d6cc0
Author: Michael Stahl 
Date:   Wed Jan 25 17:12:42 2017 +0100

sw: revert ToX hyperlinks to LO 4.3 behaviour

Commit 94b296d5416dd71d721ad16216b50bce79e3dc04 changed this to
potentially insert multiple overlapping hyperlink items.

Unfortunately Writer can only have one RES_TXTATR_INETFMT on any given
position in the paragraph, so the hyperlink hints inevitably overwrite
each other.

Revert this to do it the same way as the old code in LO 4.3 did: match
the last unmatched link-start with the first link-end, and ignore all
the link-start before the matching one, as well as the link-end after
the matching one.

This should prevent surprising formatting changes on index update,
including entries spontaneously turning green, and there is no reason
why the result of the new way is objectively better than the old one.

Change-Id: I55be9c212c473908428fa8bd6487d136343fe852

diff --git a/sw/inc/ToxLinkProcessor.hxx b/sw/inc/ToxLinkProcessor.hxx
index 7fceef1..78bb7fb 100644
--- a/sw/inc/ToxLinkProcessor.hxx
+++ b/sw/inc/ToxLinkProcessor.hxx
@@ -82,7 +82,7 @@ private:
 
 std::vector m_ClosedLinks;
 
-std::vector m_StartedLinks;
+std::unique_ptr m_pStartedLink;
 
 friend class ::ToxLinkProcessorTest;
 };
diff --git a/sw/qa/core/test_ToxLinkProcessor.cxx 
b/sw/qa/core/test_ToxLinkProcessor.cxx
index eb4618e..d2d4721 100644
--- a/sw/qa/core/test_ToxLinkProcessor.cxx
+++ b/sw/qa/core/test_ToxLinkProcessor.cxx
@@ -30,17 +30,15 @@ using namespace sw;
 class ToxLinkProcessorTest : public test::BootstrapFixture
 {
 void NoExceptionIsThrownIfTooManyLinksAreClosed();
-void AddingAndClosingTwoLinksResultsInTwoClosedLinks();
+void AddingAndClosingTwoOverlappingLinksResultsInOneClosedLink();
 void LinkIsCreatedCorrectly();
 void LinkSequenceIsPreserved();
-void StandardOpenLinkIsAddedWhenMoreLinksThanAvaiableAreClosed();
 
 CPPUNIT_TEST_SUITE(ToxLinkProcessorTest);
 CPPUNIT_TEST(NoExceptionIsThrownIfTooManyLinksAreClosed);
-CPPUNIT_TEST(AddingAndClosingTwoLinksResultsInTwoClosedLinks);
+CPPUNIT_TEST(AddingAndClosingTwoOverlappingLinksResultsInOneClosedLink);
 CPPUNIT_TEST(LinkIsCreatedCorrectly);
 CPPUNIT_TEST(LinkSequenceIsPreserved);
-CPPUNIT_TEST(StandardOpenLinkIsAddedWhenMoreLinksThanAvaiableAreClosed);
 CPPUNIT_TEST_SUITE_END();
 public:
 void setUp() override {
@@ -71,30 +69,28 @@ 
ToxLinkProcessorTest::NoExceptionIsThrownIfTooManyLinksAreClosed()
 sut.CloseLink(1, URL_1);
 // fdo#85872 actually it turns out the UI does something like this
 // so an exception must not be thrown!
-sut.CloseLink(1, URL_1);
+// should not succeed either (for backward compatibility)
+sut.CloseLink(2, URL_1);
+CPPUNIT_ASSERT_EQUAL(1u, static_cast(sut.m_ClosedLinks.size()));
+CPPUNIT_ASSERT_EQUAL(1u, 
static_cast(sut.m_ClosedLinks.at(0)->mEndTextPos));
+CPPUNIT_ASSERT_MESSAGE("no links are open", sut.m_pStartedLink == nullptr);
 }
 
 void
-ToxLinkProcessorTest::StandardOpenLinkIsAddedWhenMoreLinksThanAvaiableAreClosed()
-{
-ToxLinkProcessor sut;
-sut.StartNewLink(0, STYLE_NAME_1);
-sut.CloseLink(1, URL_1);
-sut.CloseLink(1, URL_1);
-CPPUNIT_ASSERT_EQUAL(2u, static_cast(sut.m_ClosedLinks.size()));
-CPPUNIT_ASSERT_EQUAL(1u, 
static_cast(sut.m_ClosedLinks.at(1)->mEndTextPos));
-}
-
-void
-ToxLinkProcessorTest::AddingAndClosingTwoLinksResultsInTwoClosedLinks()
+ToxLinkProcessorTest::AddingAndClosingTwoOverlappingLinksResultsInOneClosedLink()
 {
 ToxLinkProcessor sut;
 sut.StartNewLink(0, STYLE_NAME_1);
 sut.StartNewLink(0, STYLE_NAME_2);
 sut.CloseLink(1, URL_1);
+// this should not cause an error, and should not succeed either
+// (for backward compatibility)
 sut.CloseLink(1, URL_2);
-CPPUNIT_ASSERT_EQUAL(2u, static_cast(sut.m_ClosedLinks.size()));
-CPPUNIT_ASSERT_MESSAGE("no links are open", sut.m_StartedLinks.empty());
+CPPUNIT_ASSERT_EQUAL(1u, static_cast(sut.m_ClosedLinks.size()));
+CPPUNIT_ASSERT_MESSAGE("no links are open", sut.m_pStartedLink == nullptr);
+// backward compatibility: the last start is closed by the first end
+CPPUNIT_ASSERT_EQUAL(STYLE_NAME_2, 
sut.m_ClosedLinks[0]->mINetFormat.GetINetFormat());
+CPPUNIT_ASSERT_EQUAL(URL_1, sut.m_ClosedLinks[0]->mINetFormat.GetValue());
 }
 
 class ToxLinkProcessorWithOverriddenObtainPoolId : public ToxLinkProcessor {
@@ -131,10 +127,10 @@ ToxLinkProcessorTest::LinkSequenceIsPreserved()
 // obtainpoolid needs to be overridden to check what we are
 

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

2015-10-05 Thread Miklos Vajna
 sw/inc/view.hxx|1 
 sw/qa/extras/tiledrendering/tiledrendering.cxx |   32 -
 sw/source/core/crsr/findtxt.cxx|5 +++
 3 files changed, 36 insertions(+), 2 deletions(-)

New commits:
commit b4e75e8f52c17d02a65022303fb6a0e4f1d97592
Author: Miklos Vajna 
Date:   Mon Oct 5 15:34:28 2015 +0200

CppunitTest_sw_tiledrendering: testcase for LOK_CALLBACK_SEARCH_RESULT_COUNT

Change-Id: I9f517bc2f3dfca9a2dc17a229f54c47b7790a355

diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx 
b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index e7ab149..c836f4b 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -18,6 +18,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -42,6 +43,7 @@ public:
 void testSearchTextFrame();
 void testSearchTextFrameWrapAround();
 void testDocumentSizeChanged();
+void testSearchAll();
 
 CPPUNIT_TEST_SUITE(SwTiledRenderingTest);
 CPPUNIT_TEST(testRegisterCallback);
@@ -56,6 +58,7 @@ public:
 CPPUNIT_TEST(testSearchTextFrame);
 CPPUNIT_TEST(testSearchTextFrameWrapAround);
 CPPUNIT_TEST(testDocumentSizeChanged);
+CPPUNIT_TEST(testSearchAll);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -66,10 +69,12 @@ private:
 Size m_aDocumentSize;
 OString m_aTextSelection;
 bool m_bFound;
+sal_Int32 m_nSearchResultCount;
 };
 
 SwTiledRenderingTest::SwTiledRenderingTest()
-: m_bFound(true)
+: m_bFound(true),
+  m_nSearchResultCount(0)
 {
 }
 
@@ -125,6 +130,11 @@ void SwTiledRenderingTest::callbackImpl(int nType, const 
char* pPayload)
 m_bFound = false;
 }
 break;
+case LOK_CALLBACK_SEARCH_RESULT_COUNT:
+{
+m_nSearchResultCount = OString(pPayload).toInt32();
+}
+break;
 }
 }
 
@@ -438,6 +448,26 @@ void SwTiledRenderingTest::testDocumentSizeChanged()
 #endif
 }
 
+void SwTiledRenderingTest::testSearchAll()
+{
+#if !defined(WNT) && !defined(MACOSX)
+comphelper::LibreOfficeKit::setActive();
+
+SwXTextDocument* pXTextDocument = createDoc("search.odt");
+pXTextDocument->registerCallback(::callback, this);
+uno::Sequence 
aPropertyValues(comphelper::InitPropertySequence(
+{
+{"SearchItem.SearchString", uno::makeAny(OUString("shape"))},
+{"SearchItem.Backward", uno::makeAny(false)},
+{"SearchItem.Command", 
uno::makeAny(static_cast(SvxSearchCmd::FIND_ALL))},
+}));
+comphelper::dispatchCommand(".uno:ExecuteSearch", aPropertyValues);
+// This was 0; should be 2 results in the body text.
+CPPUNIT_ASSERT_EQUAL(static_cast(2), m_nSearchResultCount);
+
+comphelper::LibreOfficeKit::setActive(false);
+#endif
+}
 CPPUNIT_TEST_SUITE_REGISTRATION(SwTiledRenderingTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
commit dce533e06d641d15c3171cd543875cb9fe835cd2
Author: Miklos Vajna 
Date:   Mon Oct 5 15:19:06 2015 +0200

sw: avoid hang with find-all and shape text

We can't easily have editeng & sw selection at the same time, so just
exlucde shapes in the find-all case for now: better than a hang.

Change-Id: I1090595e8c4bc11eb38ffa486885ad5fab67ab86

diff --git a/sw/inc/view.hxx b/sw/inc/view.hxx
index 8a2d5b7..633d5d2 100644
--- a/sw/inc/view.hxx
+++ b/sw/inc/view.hxx
@@ -638,6 +638,7 @@ public:
 SAL_DLLPRIVATE virtual bool  HasPrintOptionsPage() const SAL_OVERRIDE;
 SAL_DLLPRIVATE virtual VclPtr CreatePrintOptionsPage( 
vcl::Window* pParent,
 const SfxItemSet& rSet) 
SAL_OVERRIDE;
+static SvxSearchItem* GetSearchItem() { return m_pSrchItem; }
 };
 
 inline long SwView::GetXScroll() const
diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx
index 02952b4..b2cf56c 100644
--- a/sw/source/core/crsr/findtxt.cxx
+++ b/sw/source/core/crsr/findtxt.cxx
@@ -49,6 +49,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using namespace ::com::sun::star;
 using namespace util;
@@ -342,8 +343,10 @@ bool SwPaM::Find( const SearchOptions& rSearchOpt, bool 
bSearchInNotes , utl::Te
 }
 }
 
+// Writer and editeng selections are not supported in parallel.
+SvxSearchItem* pSearchItem = SwView::GetSearchItem();
 // If we just finished search in shape text, don't attempt to do 
that again.
-if (!bEndedTextEdit)
+if (!bEndedTextEdit && !(pSearchItem && pSearchItem->GetCommand() 
== SvxSearchCmd::FIND_ALL))
 {
 // If there are any shapes anchored to this node, search there.
 SwPaM aPaM(pNode->GetDoc()->GetNodes().GetEndOfContent());
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org

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

2015-03-23 Thread Stephan Bergmann
 sw/inc/calbck.hxx|   47 +++
 sw/qa/core/uwriter.cxx   |2 -
 sw/source/core/fields/expfld.cxx |2 -
 3 files changed, 25 insertions(+), 26 deletions(-)

New commits:
commit 5aaf17d2f6f2762fd34108a49d04de7b8e3090eb
Author: Stephan Bergmann sberg...@redhat.com
Date:   Mon Mar 23 10:50:37 2015 +0100

-Werror,-Winconsistent-missing-override

Change-Id: Iad15e1e9df25fdace5ca17dde71eb1e9a25ee13e

diff --git a/sw/qa/core/uwriter.cxx b/sw/qa/core/uwriter.cxx
index 5818d9b..1e0f985 100644
--- a/sw/qa/core/uwriter.cxx
+++ b/sw/qa/core/uwriter.cxx
@@ -1404,7 +1404,7 @@ namespace
 TestClient() : m_nModifyCount(0), m_nNotifyCount(0) {};
 virtual void Modify( const SfxPoolItem*, const SfxPoolItem*) 
SAL_OVERRIDE
 { ++m_nModifyCount; }
-virtual void SwClientNotify(const SwModify rModify, const SfxHint 
rHint)
+virtual void SwClientNotify(const SwModify rModify, const SfxHint 
rHint) SAL_OVERRIDE
 {
 if(typeid(TestHint) == typeid(rHint))
 ++m_nNotifyCount;
commit 5fb7f222f51b93a9dfffa0fe211a5b3e0c83757e
Author: Stephan Bergmann sberg...@redhat.com
Date:   Mon Mar 23 10:20:54 2015 +0100

Revert make ClientIteratorBase only know about WriterListener

This reverts commit 0bf4e6e21101a66bb63778ab49006ee90c16ea94,
~SwFmt in sw/source/core/attr/format.cxx contains

  SwClient* pDepend = (SwClient*)GetDepends();
  ...

that is unclear to me how to adapt to this commit's changes.

diff --git a/sw/inc/calbck.hxx b/sw/inc/calbck.hxx
index 6ad3116..6a121ef 100644
--- a/sw/inc/calbck.hxx
+++ b/sw/inc/calbck.hxx
@@ -98,7 +98,6 @@ class SW_DLLPUBLIC SwClient : ::sw::WriterListener
 // avoids making the details of the linked list and the callback method 
public
 friend class SwModify;
 friend class sw::ClientIteratorBase;
-templatetypename E, typename S friend class SwIterator;
 
 SwModify *pRegisteredIn;/// event source
 
@@ -193,7 +192,7 @@ public:
 
 void Add(SwClient *pDepend);
 SwClient* Remove(SwClient *pDepend);
-const sw::WriterListener* GetDepends() const  { return pRoot; }
+const SwClient* GetDepends() const  { return 
static_castSwClient*(pRoot); }
 
 // get information about attribute
 virtual bool GetInfo( SfxPoolItem ) const SAL_OVERRIDE;
@@ -251,11 +250,11 @@ namespace sw
 protected:
 const SwModify m_rRoot;
 // the current object in an iteration
-WriterListener* m_pCurrent;
+SwClient* m_pCurrent;
 // in case the current object is already removed, the next object 
in the list
 // is marked down to become the current object in the next step
 // this is necessary because iteration requires access to members 
of the current object
-WriterListener* m_pPosition;
+SwClient* m_pPosition;
 static SW_DLLPUBLIC ClientIteratorBase* our_pClientIters;
 
 ClientIteratorBase( const SwModify rModify )
@@ -263,15 +262,15 @@ namespace sw
 {
 MoveTo(our_pClientIters);
 our_pClientIters = this;
-m_pCurrent = m_pPosition = 
const_castWriterListener*(m_rRoot.GetDepends());
+m_pCurrent = m_pPosition = 
const_castSwClient*(m_rRoot.GetDepends());
 }
-WriterListener* GetLeftOfPos() { return m_pPosition-m_pLeft; }
-WriterListener* GetRightOfPos() { return m_pPosition-m_pRight; }
-WriterListener* GoStart()
+SwClient* GetLeftOfPos() { return 
static_castSwClient*(m_pPosition-m_pLeft); }
+SwClient* GetRightOfPos() { return 
static_castSwClient*(m_pPosition-m_pRight); }
+SwClient* GoStart()
 {
-if((m_pPosition = 
const_castWriterListener*(m_rRoot.GetDepends(
+if((m_pPosition = const_castSwClient*(m_rRoot.GetDepends(
 while( m_pPosition-m_pLeft )
-m_pPosition = m_pPosition-m_pLeft;
+m_pPosition = 
static_castSwClient*(m_pPosition-m_pLeft);
 return m_pCurrent = m_pPosition;
 }
 ~ClientIteratorBase() SAL_OVERRIDE
@@ -286,7 +285,7 @@ namespace sw
 // SwModify::Add() asserts this
 bool IsChanged() const { return m_pPosition != m_pCurrent; }
 // ensures the iterator to point at a current client
-WriterListener* Sync() { return m_pCurrent = m_pPosition; }
+SwClient* Sync() { return m_pCurrent = m_pPosition; }
 };
 }
 
@@ -307,29 +306,29 @@ public:
 TElementType* Last()
 {
 if(!m_pPosition)
-m_pPosition = 
const_castsw::WriterListener*(m_rRoot.GetDepends());
+m_pPosition = const_castSwClient*(m_rRoot.GetDepends());
 if(!m_pPosition)
-return 

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

2014-11-20 Thread Miklos Vajna
 sw/inc/ndtxt.hxx|3 ++
 sw/qa/extras/ooxmlexport/data/num-override-lvltext.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx|3 ++
 sw/source/core/text/txtfld.cxx  |   23 +++-
 sw/source/core/txtnode/thints.cxx   |7 ++--
 5 files changed, 31 insertions(+), 5 deletions(-)

New commits:
commit b2c1474c1dc93b69f0ede03fc5c9ab496c669955
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Thu Nov 20 11:02:45 2014 +0100

SwTxtNode::IsIgnoredCharFmtForNumbering: ignore RES_CHRATR_COLOR

And also in SwTxtFormatter::NewNumberPortion(), use
SwTxtNode::IsIgnoredCharFmtForNumbering(), via
checkApplyParagraphMarkFormatToNumbering().  Otherwise the color of the
paragraph mark is inherited by the numbering portion, which is not what
IDocumentSettingAccess::APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING
(mirroring Word's behavior) is supposed to do.

Change-Id: I5d8df9b404916cc4a4405bf796d971ede59e6111

diff --git a/sw/qa/extras/ooxmlexport/data/num-override-lvltext.docx 
b/sw/qa/extras/ooxmlexport/data/num-override-lvltext.docx
index 5ee3602..fe3142d 100644
Binary files a/sw/qa/extras/ooxmlexport/data/num-override-lvltext.docx and 
b/sw/qa/extras/ooxmlexport/data/num-override-lvltext.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 8c78d45..519ad65 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -596,6 +596,9 @@ DECLARE_OOXMLEXPORT_TEST(testNumOverrideLvltext, 
num-override-lvltext.docx)
 uno::Referencecontainer::XIndexAccess xRules = getProperty 
uno::Referencecontainer::XIndexAccess 
(getStyles(NumberingStyles)-getByName(WWNum1), NumberingRules);
 // This was 1, i.e. the numbering on the second level was 1, not 1.1.
 CPPUNIT_ASSERT_EQUAL(sal_Int16(2), 
comphelper::SequenceAsHashMap(xRules-getByIndex(1))[ParentNumbering].getsal_Int16());
+
+// 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']/pFont, color));
 }
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/core/text/txtfld.cxx b/sw/source/core/text/txtfld.cxx
index 9c39353..f3049fb 100644
--- a/sw/source/core/text/txtfld.cxx
+++ b/sw/source/core/text/txtfld.cxx
@@ -52,6 +52,7 @@
 #include flddat.hxx
 #include fmtautofmt.hxx
 #include IDocumentSettingAccess.hxx
+#include svl/itemiter.hxx
 
 static bool lcl_IsInBody( SwFrm *pFrm )
 {
@@ -427,7 +428,27 @@ static void checkApplyParagraphMarkFormatToNumbering( 
SwFont* pNumFnt, SwTxtForm
  hint-GetStart() == *hint-GetEnd()  hint-GetStart() == 
node-Len())
 {
 boost::shared_ptrSfxItemSet 
pSet(hint-GetAutoFmt().GetStyleHandle());
-pNumFnt-SetDiffFnt( pSet.get(), pIDSA );
+
+// Check each item and in case it should be ignored, then 
clear it.
+boost::shared_ptrSfxItemSet pCleanedSet;
+if (pSet.get())
+{
+pCleanedSet.reset(pSet-Clone());
+
+SfxItemIter aIter(*pSet);
+const SfxPoolItem* pItem = aIter.GetCurItem();
+while (true)
+{
+if 
(SwTxtNode::IsIgnoredCharFmtForNumbering(pItem-Which()))
+pCleanedSet-ClearItem(pItem-Which());
+
+if (aIter.IsAtEnd())
+break;
+
+pItem = aIter.NextItem();
+}
+}
+pNumFnt-SetDiffFnt(pCleanedSet.get(), pIDSA);
 }
 }
 }
diff --git a/sw/source/core/txtnode/thints.cxx 
b/sw/source/core/txtnode/thints.cxx
index 0308eb5..0e089f3 100644
--- a/sw/source/core/txtnode/thints.cxx
+++ b/sw/source/core/txtnode/thints.cxx
@@ -1781,7 +1781,7 @@ void SwTxtNode::DelSoftHyph( const sal_Int32 nStt, const 
sal_Int32 nEnd )
 
 bool SwTxtNode::IsIgnoredCharFmtForNumbering(const sal_uInt16 nWhich)
 {
-return (nWhich ==  RES_CHRATR_UNDERLINE || nWhich == RES_CHRATR_BACKGROUND 
|| nWhich == RES_CHRATR_ESCAPEMENT);
+return (nWhich ==  RES_CHRATR_UNDERLINE || nWhich == RES_CHRATR_COLOR || 
nWhich == RES_CHRATR_BACKGROUND || nWhich == RES_CHRATR_ESCAPEMENT);
 }
 
 //In MS Word, following properties of the paragraph end position wont affect 
the formatting of bullets, so we ignore them:
commit 96664bf0152ecf8ee64aa6b22ed399c1866117f1
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Thu Nov 20 09:54:15 2014 +0100

sw: move IsIgnoredCharFmtForNumbering() to SwTxtNode

I need this in SwTxtFormatter.

Change-Id: Ib1586299f468a88e92fdb367fbab69a683791dc9

diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx
index 66960e1..77c93c9 100644
--- 

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

2014-11-18 Thread Bjoern Michaelsen
 sw/inc/doc.hxx   |   42 ---
 sw/inc/docfunc.hxx   |   68 +++
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx |1 
 sw/source/core/doc/docdraw.cxx   |1 
 sw/source/core/doc/docfmt.cxx|1 
 sw/source/filter/xml/swxml.cxx   |1 
 sw/source/filter/xml/wrtxml.cxx  |1 
 sw/source/uibase/app/docsh.cxx   |1 
 8 files changed, 73 insertions(+), 43 deletions(-)

New commits:
commit b2efe90c07baa45d2ee7e13138dd306a29738473
Author: Bjoern Michaelsen bjoern.michael...@canonical.com
Date:   Tue Nov 18 00:51:30 2014 +0100

remove nonsense comment clutter

Change-Id: I9ab33513ffb927b02c27fbd6c115b41702751d18

diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index a0650a1..27fe3d6 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -2504,7 +2504,6 @@ DECLARE_OOXMLIMPORT_TEST(testBnc821804, bnc821804.docx)
 
 DECLARE_OOXMLIMPORT_TEST(testFdo85542, fdo85542.docx)
 {
-//CPPUNIT_ASSERT_EQUAL(false,true);
 uno::Referencetext::XBookmarksSupplier xBookmarksSupplier(mxComponent, 
uno::UNO_QUERY);
 uno::Referencecontainer::XIndexAccess 
xBookmarksByIdx(xBookmarksSupplier-getBookmarks(), uno::UNO_QUERY);
 CPPUNIT_ASSERT_EQUAL(xBookmarksByIdx-getCount(), 
static_castsal_Int32(3));
commit 1296f9063203a3f9488689136b833568c183edab
Author: Bjoern Michaelsen bjoern.michael...@canonical.com
Date:   Mon Nov 17 17:37:56 2014 +0100

move docfunc to own header

Change-Id: I5e1c66e09418e534bb47233f45c67206af20cab4

diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 414965d..a7b8829 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -1713,48 +1713,6 @@ inline void SwDoc::SetOLEPrtNotifyPending( bool bSet )
 mbAllOLENotify = false;
 }
 
-// namespace docfunc for functions and procedures working on a Writer 
document.
-namespace docfunc
-{
-/** method to check, if given Writer document contains at least one 
drawing object
-
-@author OD
-
-@param p_rDoc
-input parameter - reference to the Writer document, which is 
investigated.
-*/
-bool ExistsDrawObjs( SwDoc p_rDoc );
-
-/** method to check, if given Writer document contains only drawing 
objects,
-which are completely on its page.
-
-@author OD
-
-@param p_rDoc
-input parameter - reference to the Writer document, which is 
investigated.
-*/
-bool AllDrawObjsOnPage( SwDoc p_rDoc );
-
-/** method to check, if the outline style has to written as a normal list 
style
-
-#i69627#
-The outline style has to written as a normal list style, if a parent
-paragraph style of one of the paragraph styles, which are assigned to
-the list levels of the outline style, has a list style set or inherits
-a list style from its parent paragraphs style.
-This information is needed for the OpenDocument file format export.
-
-@author OD
-
-@param rDoc
-input parameter - reference to the text document, which is 
investigated.
-
-@return boolean
-indicating, if the outline style has to written as a normal list style
-*/
-bool HasOutlineStyleToBeWrittenAsNormalListStyle( SwDoc rDoc );
-}
-
 bool sw_GetPostIts( IDocumentFieldsAccess* pIDFA, _SetGetExpFlds * pSrtLst );
 
 #endif  //_DOC_HXX
diff --git a/sw/inc/docfunc.hxx b/sw/inc/docfunc.hxx
new file mode 100644
index 000..d4d1256
--- /dev/null
+++ b/sw/inc/docfunc.hxx
@@ -0,0 +1,68 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the License); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SW_INC_DOCFUNC_HXX
+#define INCLUDED_SW_INC_DOCFUNC_HXX
+
+class SwDoc;
+
+// namespace docfunc for functions and procedures working on a Writer 
document.
+namespace docfunc
+{
+/** method to check, if given Writer document contains at least one 
drawing object
+
+@author OD
+
+@param p_rDoc
+input parameter - reference to the Writer document, which is 
investigated.
+*/
+ 

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

2014-06-24 Thread Miklos Vajna
 dev/null |binary
 sw/inc/hintids.hxx   |   66 +--
 sw/inc/textboxhelper.hxx |2 
 sw/qa/extras/uiwriter/data/shape-textbox.odt |binary
 sw/qa/extras/uiwriter/uiwriter.cxx   |   24 +
 sw/source/core/doc/textboxhelper.cxx |   15 ++
 sw/source/core/frmedt/feshview.cxx   |   17 ++
 sw/source/uibase/docvw/edtwin.cxx|   19 ++-
 8 files changed, 107 insertions(+), 36 deletions(-)

New commits:
commit de00dd0a4e9c10e283f5b8093ac1771545cbe243
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Tue Jun 24 17:51:05 2014 +0200

sw: update hintid comments to match reality

Change-Id: I9c7f620e08865531c70b1c4e655ed9f0aed9d319

diff --git a/sw/inc/hintids.hxx b/sw/inc/hintids.hxx
index e0a6685..4a0840d 100644
--- a/sw/inc/hintids.hxx
+++ b/sw/inc/hintids.hxx
@@ -230,49 +230,49 @@ RES_FRMATR_BEGIN = RES_PARATR_LIST_END,
 RES_AUTO_STYLE, // 125
 RES_FRMATR_STYLE_NAME,  // 126
 RES_FRMATR_CONDITIONAL_STYLE_NAME,  // 127
-RES_FRMATR_GRABBAG, // 130
-RES_TEXT_VERT_ADJUST,   // 131
+RES_FRMATR_GRABBAG, // 128
+RES_TEXT_VERT_ADJUST,   // 129
 RES_FRMATR_END
 };
 
 enum RES_GRFATR
 {
 RES_GRFATR_BEGIN = RES_FRMATR_END,
-RES_GRFATR_MIRRORGRF = RES_GRFATR_BEGIN,// 132
-RES_GRFATR_CROPGRF, // 133
-
-RES_GRFATR_ROTATION,// 134
-RES_GRFATR_LUMINANCE,   // 135
-RES_GRFATR_CONTRAST,// 136
-RES_GRFATR_CHANNELR,// 137
-RES_GRFATR_CHANNELG,// 138
-RES_GRFATR_CHANNELB,// 139
-RES_GRFATR_GAMMA,   // 140
-RES_GRFATR_INVERT,  // 141
-RES_GRFATR_TRANSPARENCY,// 142
-RES_GRFATR_DRAWMODE,// 143
-
-RES_GRFATR_DUMMY1,  // 144
-RES_GRFATR_DUMMY2,  // 145
-RES_GRFATR_DUMMY3,  // 146
-RES_GRFATR_DUMMY4,  // 147
-RES_GRFATR_DUMMY5,  // 148
+RES_GRFATR_MIRRORGRF = RES_GRFATR_BEGIN,// 130
+RES_GRFATR_CROPGRF, // 131
+
+RES_GRFATR_ROTATION,// 132
+RES_GRFATR_LUMINANCE,   // 133
+RES_GRFATR_CONTRAST,// 134
+RES_GRFATR_CHANNELR,// 135
+RES_GRFATR_CHANNELG,// 136
+RES_GRFATR_CHANNELB,// 137
+RES_GRFATR_GAMMA,   // 138
+RES_GRFATR_INVERT,  // 139
+RES_GRFATR_TRANSPARENCY,// 140
+RES_GRFATR_DRAWMODE,// 141
+
+RES_GRFATR_DUMMY1,  // 142
+RES_GRFATR_DUMMY2,  // 143
+RES_GRFATR_DUMMY3,  // 144
+RES_GRFATR_DUMMY4,  // 145
+RES_GRFATR_DUMMY5,  // 146
 RES_GRFATR_END
 };
 
 enum RES_BOXATR
 {
 RES_BOXATR_BEGIN = RES_GRFATR_END,
-RES_BOXATR_FORMAT = RES_BOXATR_BEGIN,   // 149
-RES_BOXATR_FORMULA, // 150
-RES_BOXATR_VALUE,   // 151
+RES_BOXATR_FORMAT = RES_BOXATR_BEGIN,   // 147
+RES_BOXATR_FORMULA, // 148
+RES_BOXATR_VALUE,   // 149
 RES_BOXATR_END
 };
 
 enum RES_UNKNOWNATR
 {
 RES_UNKNOWNATR_BEGIN = RES_BOXATR_END,
-RES_UNKNOWNATR_CONTAINER = RES_UNKNOWNATR_BEGIN,// 152
+RES_UNKNOWNATR_CONTAINER = RES_UNKNOWNATR_BEGIN,// 150
 RES_UNKNOWNATR_END
 };
 
@@ -280,13 +280,13 @@ RES_UNKNOWNATR_END
 enum RES_FMT
 {
 RES_FMT_BEGIN = RES_UNKNOWNATR_END,
-RES_CHRFMT = RES_FMT_BEGIN, // 144
-RES_FRMFMT, // 145
-RES_FLYFRMFMT,  // 146
-RES_TXTFMTCOLL, // 147
-RES_GRFFMTCOLL, // 148
-RES_DRAWFRMFMT, // 149
-RES_CONDTXTFMTCOLL, // 150
+RES_CHRFMT = RES_FMT_BEGIN, // 151
+RES_FRMFMT, // 152
+RES_FLYFRMFMT,  // 153
+RES_TXTFMTCOLL, // 154
+RES_GRFFMTCOLL,   

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

2014-04-09 Thread Luke Deller
 sw/inc/SwStyleNameMapper.hxx  |1 
 sw/qa/extras/ww8export/data/bordercolours.odt |binary
 sw/qa/extras/ww8export/ww8export.cxx  |  125 ++
 sw/source/core/doc/SwStyleNameMapper.cxx  |  173 --
 4 files changed, 157 insertions(+), 142 deletions(-)

New commits:
commit 19644e657d1ccfa6cd9f57524cb77beb47161ae7
Author: Luke Deller l...@deller.id.au
Date:   Mon Apr 7 23:58:58 2014 +1000

Unit test for .doc export of full colour borders

This test exercises the *export* component of recent work to add support
for full colour borders in .doc import/export.

Change-Id: I2da0b8b488e399d0cd4791678fac6e1c85921c2c
Reviewed-on: https://gerrit.libreoffice.org/8887
Reviewed-by: Caolán McNamara caol...@redhat.com
Tested-by: Caolán McNamara caol...@redhat.com

diff --git a/sw/qa/extras/ww8export/data/bordercolours.odt 
b/sw/qa/extras/ww8export/data/bordercolours.odt
new file mode 100644
index 000..f34d595
Binary files /dev/null and b/sw/qa/extras/ww8export/data/bordercolours.odt 
differ
diff --git a/sw/qa/extras/ww8export/ww8export.cxx 
b/sw/qa/extras/ww8export/ww8export.cxx
index 2e3d200..d014dba 100644
--- a/sw/qa/extras/ww8export/ww8export.cxx
+++ b/sw/qa/extras/ww8export/ww8export.cxx
@@ -16,6 +16,7 @@
 #include com/sun/star/beans/XPropertySet.hpp
 #include com/sun/star/view/XViewSettingsSupplier.hpp
 #include com/sun/star/table/ShadowFormat.hpp
+#include com/sun/star/table/TableBorder2.hpp
 
 class Test : public SwModelTestBase
 {
@@ -196,6 +197,130 @@ DECLARE_WW8EXPORT_TEST(testCommentsNested, 
comments-nested.doc)
 CPPUNIT_ASSERT_EQUAL(OUString(Inner), getPropertyOUString(xInner, 
Content));
 }
 
+DECLARE_WW8EXPORT_TEST(testBorderColoursExport, bordercolours.odt)
+{
+// This is very close to testBorderColours in ww8import.cxx, but for export
+
+// The following 6 colours can only be represented with WW9 (Word 2000)
+// BRC (BoRder Control) structures.  We can tell that they have been
+// exported/imported using a WW8 (Word '97) BRC if they instead come
+// through as one of the 16 colours listed at this link:
+// http://msdn.microsoft.com/en-us/library/dd773060.aspx
+table::BorderLine2 expectedTop(0xFA670C, 0, 53, 0, 1, 53);
+table::BorderLine2 expectedLeft(0xD99594, 0, 79, 0, 0, 79);
+table::BorderLine2 expectedRight(0xB2A1C7, 53, 53, 53, 3, 159);
+table::BorderLine2 expectedBottom(0xB6DDE8, 0, 106, 0, 14, 106);
+table::BorderLine2 expectedDashedRed(0xFA670C, 0, 53, 0, 2, 53);
+table::BorderLine2 expectedDoubleGreen(0xC2D69B, 26, 106, 26, 4, 159);
+
+// Paragraph border
+uno::Referencetext::XBookmarksSupplier bookmarksSupplier(mxComponent,
+uno::UNO_QUERY);
+uno::Referencecontainer::XNameAccess bookmarks(
+bookmarksSupplier-getBookmarks(), uno::UNO_QUERY);
+uno::Referencetext::XTextContent bookmark(
+bookmarks-getByName(ParagraphBorder), uno::UNO_QUERY);
+uno::Referencetext::XTextRange anchor(bookmark-getAnchor());
+table::BorderLine2 border;
+border = getPropertytable::BorderLine2(anchor, TopBorder);
+CPPUNIT_ASSERT_BORDER_EQUAL(expectedTop, border);
+border = getPropertytable::BorderLine2(anchor, LeftBorder);
+CPPUNIT_ASSERT_BORDER_EQUAL(expectedLeft, border);
+border = getPropertytable::BorderLine2(anchor, RightBorder);
+CPPUNIT_ASSERT_BORDER_EQUAL(expectedRight, border);
+border = getPropertytable::BorderLine2(anchor, BottomBorder);
+CPPUNIT_ASSERT_BORDER_EQUAL(expectedBottom, border);
+
+// Page border
+OUString pageStyleName = getPropertyOUString(anchor, PageStyleName);
+uno::Referencestyle::XStyle pageStyle(
+getStyles(PageStyles)-getByName(pageStyleName), uno::UNO_QUERY);
+border = getPropertytable::BorderLine2(pageStyle, TopBorder);
+CPPUNIT_ASSERT_BORDER_EQUAL(expectedTop, border);
+border = getPropertytable::BorderLine2(pageStyle, LeftBorder);
+CPPUNIT_ASSERT_BORDER_EQUAL(expectedLeft, border);
+border = getPropertytable::BorderLine2(pageStyle, RightBorder);
+CPPUNIT_ASSERT_BORDER_EQUAL(expectedRight, border);
+border = getPropertytable::BorderLine2(pageStyle, BottomBorder);
+CPPUNIT_ASSERT_BORDER_EQUAL(expectedBottom, border);
+
+// Character border
+bookmark.set(bookmarks-getByName(CharBorder), uno::UNO_QUERY);
+anchor = bookmark-getAnchor();
+border = getPropertytable::BorderLine2(anchor, CharTopBorder);
+CPPUNIT_ASSERT_BORDER_EQUAL(expectedTop, border);
+border = getPropertytable::BorderLine2(anchor, CharLeftBorder);
+CPPUNIT_ASSERT_BORDER_EQUAL(expectedTop, border);
+border = getPropertytable::BorderLine2(anchor, CharRightBorder);
+CPPUNIT_ASSERT_BORDER_EQUAL(expectedTop, border);
+border = getPropertytable::BorderLine2(anchor, CharBottomBorder);
+CPPUNIT_ASSERT_BORDER_EQUAL(expectedTop, border);
+
+// Table border
+uno::Referencetext::XTextTablesSupplier 

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

2014-03-31 Thread Miklos Vajna
 sw/inc/unobrushitemhelper.hxx |7 ++-
 sw/qa/extras/rtfexport/rtfexport.cxx  |3 ---
 sw/source/core/attr/format.cxx|   10 +-
 sw/source/core/unocore/unobrushitemhelper.cxx |4 
 sw/source/core/unocore/unoframe.cxx   |   10 +-
 sw/source/core/unocore/unostyle.cxx   |6 +++---
 sw/source/filter/ww8/ww8atr.cxx   |   20 
 7 files changed, 43 insertions(+), 17 deletions(-)

New commits:
commit ebf960960a69c1edb5da1994c330becac44d
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Mon Mar 31 15:29:11 2014 +0200

sw: put getSvx* and setSvx* to a namespace, now that these are public

Change-Id: Iea2f6af83382608e4a36dd2e5803cbb936b78058

diff --git a/sw/inc/unobrushitemhelper.hxx b/sw/inc/unobrushitemhelper.hxx
index fa66383..9de5604 100644
--- a/sw/inc/unobrushitemhelper.hxx
+++ b/sw/inc/unobrushitemhelper.hxx
@@ -23,10 +23,14 @@
 #include swdllapi.h
 #include editeng/brushitem.hxx
 
+namespace sw {
+
 // helper function definintions for UNO API fallbacks to replace 
SvxBrushItem
 void setSvxBrushItemAsFillAttributesToTargetSet(const SvxBrushItem rBrush, 
SfxItemSet rToSet);
 SW_DLLPUBLIC SvxBrushItem getSvxBrushItemFromSourceSet(const SfxItemSet 
rSourceSet, sal_Bool bSearchInParents = sal_True);
 
+} // namespace sw
+
 #endif // _UNOBRUSHITEMHELPER_HXX
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/attr/format.cxx b/sw/source/core/attr/format.cxx
index ded0649..776827c 100644
--- a/sw/source/core/attr/format.cxx
+++ b/sw/source/core/attr/format.cxx
@@ -396,7 +396,7 @@ const SfxPoolItem SwFmt::GetFmtAttr( sal_uInt16 nWhich, 
sal_Bool bInParents ) c
 // fill the local static SvxBrushItem from the current ItemSet so that
 // the fill attributes [XATTR_FILL_FIRST .. XATTR_FILL_LAST] are used
 // as good as possible to create a fallback representation and return 
that
-aSvxBrushItem = getSvxBrushItemFromSourceSet(aSet, bInParents);
+aSvxBrushItem = sw::getSvxBrushItemFromSourceSet(aSet, bInParents);
 
 return aSvxBrushItem;
 }
@@ -421,7 +421,7 @@ SfxItemState SwFmt::GetItemState( sal_uInt16 nWhich, 
sal_Bool bSrchInParent, con
 // to and return as state that it is set
 static SvxBrushItem aSvxBrushItem(RES_BACKGROUND);
 
-aSvxBrushItem = getSvxBrushItemFromSourceSet(aSet, bSrchInParent);
+aSvxBrushItem = sw::getSvxBrushItemFromSourceSet(aSet, 
bSrchInParent);
 *ppItem = aSvxBrushItem;
 
 return SFX_ITEM_SET;
@@ -459,7 +459,7 @@ bool SwFmt::SetFmtAttr( const SfxPoolItem rAttr )
 // fill a local ItemSet with the attributes corresponding as good as 
possible
 // to the new fill properties [XATTR_FILL_FIRST .. XATTR_FILL_LAST] 
and set these
 // as ItemSet
-setSvxBrushItemAsFillAttributesToTargetSet(rSource, aTempSet);
+sw::setSvxBrushItemAsFillAttributesToTargetSet(rSource, aTempSet);
 
 if(IsModifyLocked())
 {
@@ -553,7 +553,7 @@ bool SwFmt::SetFmtAttr( const SfxItemSet rSet )
 // fill attribute ranges [XATTR_FILL_FIRST .. XATTR_FILL_LAST]. 
Add the attributes
 // corresponding as good as possible to the new fill properties 
and set the whole ItemSet
 const SvxBrushItem rSource(static_cast const SvxBrushItem 
(*pSource));
-setSvxBrushItemAsFillAttributesToTargetSet(rSource, aTempSet);
+sw::setSvxBrushItemAsFillAttributesToTargetSet(rSource, aTempSet);
 
 if(IsModifyLocked())
 {
@@ -782,7 +782,7 @@ const SvxBrushItem SwFmt::GetBackground(sal_Bool bInP) 
const
 // fill the local static SvxBrushItem from the current ItemSet so that
 // the fill attributes [XATTR_FILL_FIRST .. XATTR_FILL_LAST] are used
 // as good as possible to create a fallback representation and return 
that
-aSvxBrushItem = getSvxBrushItemFromSourceSet(aSet, bInP);
+aSvxBrushItem = sw::getSvxBrushItemFromSourceSet(aSet, bInP);
 
 return aSvxBrushItem;
 }
diff --git a/sw/source/core/unocore/unobrushitemhelper.cxx 
b/sw/source/core/unocore/unobrushitemhelper.cxx
index 07a6e69..ebf9a94 100644
--- a/sw/source/core/unocore/unobrushitemhelper.cxx
+++ b/sw/source/core/unocore/unobrushitemhelper.cxx
@@ -38,6 +38,8 @@
 #include svx/xfltrit.hxx
 #include svx/xflhtit.hxx
 
+namespace sw {
+
 //
 void setSvxBrushItemAsFillAttributesToTargetSet(const SvxBrushItem rBrush, 
SfxItemSet rToSet)
 {
@@ -304,4 +306,6 @@ SvxBrushItem getSvxBrushItemFromSourceSet(const SfxItemSet 
rSourceSet, sal_Bool
 return aRetval;
 }
 
+} // namespace sw
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/unocore/unoframe.cxx 
b/sw/source/core/unocore/unoframe.cxx
index 37bcb3d..b77266a 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ 

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

2014-01-16 Thread Miklos Vajna
 sw/inc/shellio.hxx |4 ++--
 sw/qa/extras/uiwriter/uiwriter.cxx |   30 ++
 sw/source/filter/basflt/fltini.cxx |2 +-
 3 files changed, 33 insertions(+), 3 deletions(-)

New commits:
commit 8477394f9bbe001d8648c38cd6e3c1c72dd17d8e
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Thu Jan 16 15:07:01 2014 +0100

CppunitTest_sw_uiwriter: add testcase for ExportRTF()

Change-Id: I49a86e6a5cd525118d902b37825cfdb7dc8e70d2

diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx 
b/sw/qa/extras/uiwriter/uiwriter.cxx
index dd1e63b..dc9004b 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -27,6 +27,7 @@ public:
 void testFdo69893();
 void testFdo70807();
 void testImportRTF();
+void testExportRTF();
 
 CPPUNIT_TEST_SUITE(SwUiWriterTest);
 CPPUNIT_TEST(testReplaceForward);
@@ -34,6 +35,7 @@ public:
 CPPUNIT_TEST(testFdo69893);
 CPPUNIT_TEST(testFdo70807);
 CPPUNIT_TEST(testImportRTF);
+CPPUNIT_TEST(testExportRTF);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -168,6 +170,34 @@ void SwUiWriterTest::testImportRTF()
 CPPUNIT_ASSERT_EQUAL(OUString(bar), 
static_castSwTxtNode*(pDoc-GetNodes()[nIndex])-GetTxt());
 }
 
+void SwUiWriterTest::testExportRTF()
+{
+// Insert aaabbbccc and select bbb.
+SwDoc* pDoc = createDoc();
+SwWrtShell* pWrtShell = pDoc-GetDocShell()-GetWrtShell();
+pWrtShell-Insert(aaabbbccc);
+pWrtShell-Left(CRSR_SKIP_CHARS, /*bSelect=*/false, 3, 
/*bBasicCall=*/false);
+pWrtShell-Left(CRSR_SKIP_CHARS, /*bSelect=*/true, 3, 
/*bBasicCall=*/false);
+
+// Create the clipboard document.
+boost::shared_ptrSwDoc pClpDoc(new SwDoc());
+pClpDoc-SetClipBoard(true);
+pWrtShell-Copy(pClpDoc.get());
+
+// And finally export it as RTF.
+WriterRef xWrt;
+SwReaderWriter::GetWriter(RTF, OUString(), xWrt);
+SvMemoryStream aStream;
+SwWriter aWrt(aStream, *pClpDoc);
+aWrt.Write(xWrt);
+
+OString aData(static_castconst sal_Char*(aStream.GetBuffer()), 
aStream.GetSize());
+CPPUNIT_ASSERT(aData.startsWith({\\rtf1));
+CPPUNIT_ASSERT_EQUAL(-1, aData.indexOf(aaa));
+CPPUNIT_ASSERT(aData.indexOf(bbb) != -1);
+CPPUNIT_ASSERT_EQUAL(-1, aData.indexOf(ccc));
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest);
 CPPUNIT_PLUGIN_IMPLEMENT();
 
commit 9758961f6c6d2e40eec2d89c7bb1a5d065a6a1d8
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Thu Jan 16 15:06:12 2014 +0100

sw: make these public as well for unit tests

All are Sw-prefixed or are in Sw-prefixed namespace, so what can go
wrong.

Change-Id: Icbd8cead5e1db88d34519b09b21e64735ccb2734

diff --git a/sw/inc/shellio.hxx b/sw/inc/shellio.hxx
index bfdac41..6fe135b 100644
--- a/sw/inc/shellio.hxx
+++ b/sw/inc/shellio.hxx
@@ -506,7 +506,7 @@ public:
 
 // Interface class for general access on special writers.
 
-class SwWriter
+class SW_DLLPUBLIC SwWriter
 {
 SvStream* pStrm;
 SotStorageRef pStg;
@@ -566,7 +566,7 @@ namespace SwReaderWriter
 Reader* GetReader( const OUString rFltName );
 
 /// Return writer based on the name.
-void GetWriter( const OUString rFltName, const OUString rBaseURL, 
WriterRef xWrt );
+SW_DLLPUBLIC void GetWriter( const OUString rFltName, const OUString 
rBaseURL, WriterRef xWrt );
 }
 
 void GetRTFWriter( const OUString, const OUString, WriterRef );
diff --git a/sw/source/filter/basflt/fltini.cxx 
b/sw/source/filter/basflt/fltini.cxx
index 1f784b7..a415b3a 100644
--- a/sw/source/filter/basflt/fltini.cxx
+++ b/sw/source/filter/basflt/fltini.cxx
@@ -171,7 +171,7 @@ SW_DLLPUBLIC Reader* GetReader( ReaderWriterEnum eReader )
 return aReaderWriter[eReader].GetReader();
 }
 
-void GetWriter( const OUString rFltName, const OUString rBaseURL, WriterRef 
xRet )
+SW_DLLPUBLIC void GetWriter( const OUString rFltName, const OUString 
rBaseURL, WriterRef xRet )
 {
 for( sal_uInt16 n = 0; n  MAXFILTER; ++n )
 if ( aFilterDetect[n].IsFilter( rFltName ) )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2013-09-30 Thread Miklos Vajna
 sw/inc/crsrsh.hxx|4 ++--
 sw/qa/extras/odfimport/data/fdo69862.odt |binary
 sw/qa/extras/odfimport/odfimport.cxx |   19 +++
 sw/source/core/crsr/crsrsh.cxx   |   12 ++--
 sw/source/core/docnode/nodedump.cxx  |6 --
 sw/source/core/edit/eddel.cxx|2 +-
 sw/source/core/edit/edglss.cxx   |2 +-
 sw/source/ui/wrtsh/select.cxx|2 +-
 8 files changed, 34 insertions(+), 13 deletions(-)

New commits:
commit 959711f1276106b0aaee69ab660f1b0d3ece5bbc
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Mon Sep 30 11:45:35 2013 +0200

fdo#69862 SwCrsrShell::ExtendedSelectAll: don't always select footnotes

ExtendedSelectAll() was originally invented to e.g. select the whole
document, change the language of the selection and then inmediately
(before the layout is updated) undo the selection.

When using it for select all and doc starts with a table purposes,
then footnotes shouldn't be selected, just like those are not selected
either, when the doc starts with a normal paragraph. Their anchor is
still selected, and that's enough to have correct delete and copypaste.

Change-Id: I4fc49db628054a4b8a46effc2d0328eaabcaa9f8

diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx
index 9166edc..c01d3ea 100644
--- a/sw/inc/crsrsh.hxx
+++ b/sw/inc/crsrsh.hxx
@@ -326,9 +326,9 @@ public:
 // SelAll() selects the document body content
 // if ExtendedSelect() is called afterwards, the whole nodes array is 
selected
 // only for usage in special cases allowed!
-void ExtendedSelectAll();
+void ExtendedSelectAll(bool bFootnotes = true);
 /// If ExtendedSelectAll() was called and selection didn't change since 
then.
-bool ExtendedSelectedAll();
+bool ExtendedSelectedAll(bool bFootnotes = true);
 /// If document body starts with a table.
 bool StartsWithTable();
 
diff --git a/sw/qa/extras/odfimport/data/fdo69862.odt 
b/sw/qa/extras/odfimport/data/fdo69862.odt
new file mode 100644
index 000..aec48fd
Binary files /dev/null and b/sw/qa/extras/odfimport/data/fdo69862.odt differ
diff --git a/sw/qa/extras/odfimport/odfimport.cxx 
b/sw/qa/extras/odfimport/odfimport.cxx
index 34d4f82..f541d22 100644
--- a/sw/qa/extras/odfimport/odfimport.cxx
+++ b/sw/qa/extras/odfimport/odfimport.cxx
@@ -36,6 +36,7 @@ public:
 void testFdo68839();
 void testFdo37606();
 void testFdo37606Copy();
+void testFdo69862();
 
 CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX)  !defined(WNT)
@@ -62,6 +63,7 @@ void Test::run()
 {fdo68839.odt, Test::testFdo68839},
 {fdo37606.odt, Test::testFdo37606},
 {fdo37606.odt, Test::testFdo37606Copy},
+{fdo69862.odt, Test::testFdo69862},
 };
 header();
 for (unsigned int i = 0; i  SAL_N_ELEMENTS(aMethods); ++i)
@@ -426,6 +428,23 @@ void Test::testFdo37606Copy()
 CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTables-getCount());
 }
 
+void Test::testFdo69862()
+{
+// The test doc is special in that it starts with a table and it also has 
a footnote.
+SwXTextDocument* pTxtDoc = dynamic_castSwXTextDocument 
*(mxComponent.get());
+SwWrtShell* pWrtShell = pTxtDoc-GetDocShell()-GetWrtShell();
+SwShellCrsr* pShellCrsr = pWrtShell-getShellCrsr(false);
+
+pWrtShell-SelAll();
+SwTxtNode rStart = 
dynamic_castSwTxtNode(pShellCrsr-Start()-nNode.GetNode());
+// This was Footnote., as Ctrl-A also selected footnotes, but it should 
not.
+CPPUNIT_ASSERT_EQUAL(OUString(A1), rStart.GetTxt());
+
+SwTxtNode rEnd = 
dynamic_castSwTxtNode(pShellCrsr-End()-nNode.GetNode());
+CPPUNIT_ASSERT_EQUAL(OUString(H \x01 ello.), rEnd.GetTxt());
+
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index e64b63d..106e150 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -227,7 +227,7 @@ void SwCrsrShell::StartAction()
 
 void SwCrsrShell::EndAction( const sal_Bool bIdleEnd )
 {
-comphelper::FlagRestorationGuard g(mbSelectAll, StartsWithTable()  
ExtendedSelectedAll());
+comphelper::FlagRestorationGuard g(mbSelectAll, StartsWithTable()  
ExtendedSelectedAll(/*bFootnotes =*/ false));
 sal_Bool bVis = m_bSVCrsrVis;
 
 // Idle-formatting?
@@ -520,11 +520,11 @@ sal_Bool SwCrsrShell::SttEndDoc( sal_Bool bStt )
 return bRet;
 }
 
-void SwCrsrShell::ExtendedSelectAll()
+void SwCrsrShell::ExtendedSelectAll(bool bFootnotes)
 {
 SwNodes rNodes = GetDoc()-GetNodes();
 SwPosition* pPos = m_pCurCrsr-GetPoint();
-pPos-nNode = rNodes.GetEndOfPostIts();
+pPos-nNode = bFootnotes ? rNodes.GetEndOfPostIts() : 
rNodes.GetEndOfInserts();
 pPos-nContent.Assign( rNodes.GoNext( pPos-nNode ), 0 );
 pPos = m_pCurCrsr-GetMark();
 pPos-nNode = rNodes.GetEndOfContent();
@@ -532,10 +532,10 @@ void