core.git: 2 commits - sw/qa sw/source

2024-04-30 Thread Xisco Fauli (via logerrit)
 sw/qa/extras/uiwriter/data/tdf143320.odt |binary
 sw/qa/extras/uiwriter/uiwriter4.cxx  |   37 +++
 sw/source/core/frmedt/fefly1.cxx |4 +--
 3 files changed, 39 insertions(+), 2 deletions(-)

New commits:
commit 17b2f3d96fb21dcfc2fb8e54ca9670a8c58840f1
Author: Xisco Fauli 
AuthorDate: Wed Jul 14 14:41:24 2021 +0200
Commit: Xisco Fauli 
CommitDate: Tue Apr 30 21:14:00 2024 +0200

tdf#143320, tdf#143387: sw_uiwriter4: Add unittest

Change-Id: I45aaa88c8ed70f3eebd30dfcd29edc4e1e4a5694
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118908
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sw/qa/extras/uiwriter/data/tdf143320.odt 
b/sw/qa/extras/uiwriter/data/tdf143320.odt
new file mode 100644
index ..b7aef0c34bb0
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf143320.odt differ
diff --git a/sw/qa/extras/uiwriter/uiwriter4.cxx 
b/sw/qa/extras/uiwriter/uiwriter4.cxx
index 7757ceb9701e..c361ddfb80e0 100644
--- a/sw/qa/extras/uiwriter/uiwriter4.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter4.cxx
@@ -2572,6 +2572,43 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf142157)
 CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xSections->getCount());
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf143320)
+{
+createSwDoc("tdf143320.odt");
+SwDoc* pDoc = getSwDoc();
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+
+CPPUNIT_ASSERT_EQUAL(1, getPages());
+CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("x"));
+
+dispatchCommand(mxComponent, ".uno:SelectAll", {});
+
+dispatchCommand(mxComponent, ".uno:Copy", {});
+
+// Create a new document
+createSwDoc();
+pDoc = getSwDoc();
+pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+CPPUNIT_ASSERT(pWrtShell);
+
+dispatchCommand(mxComponent, ".uno:Paste", {});
+
+CPPUNIT_ASSERT_EQUAL(1, getPages());
+CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("x"));
+
+dispatchCommand(mxComponent, ".uno:Undo", {});
+Scheduler::ProcessEventsToIdle();
+
+CPPUNIT_ASSERT_EQUAL(1, getPages());
+CPPUNIT_ASSERT_EQUAL(OUString(""), getParagraph(1)->getString());
+
+// Without the fix in place, this test would have crashed here
+dispatchCommand(mxComponent, ".uno:Paste", {});
+
+CPPUNIT_ASSERT_EQUAL(1, getPages());
+CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("x"));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit acad40220d21e73b5fb699404ae1a2dc29218faa
Author: Xisco Fauli 
AuthorDate: Tue Apr 30 10:07:23 2024 +0200
Commit: Xisco Fauli 
CommitDate: Tue Apr 30 21:13:52 2024 +0200

Fix UBSan failure (part 2)

Introduced by 495b5db74f0db59395ff68bacc8d8ca67595b66e
"sw: check GetUserCall"

https: //gerrit.libreoffice.org/c/core/+/166824/comments/8db24a41_2f4e7e4e
Change-Id: Ib6f981aa3055f0d37d0b83e3284842d310fe6ef0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166913
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx
index 280166ed888b..eca71843557b 100644
--- a/sw/source/core/frmedt/fefly1.cxx
+++ b/sw/source/core/frmedt/fefly1.cxx
@@ -386,7 +386,7 @@ const SwFrameFormat* SwFEShell::IsFlyInFly()
 return nullptr;
 
 SdrObject *pObj = rMrkList.GetMark( 0 )->GetMarkedSdrObj();
-SwDrawContact *pContact = static_cast(GetUserCall(pObj));
+SwContact* pContact = GetUserCall( pObj );
 if (!pContact)
 return nullptr;
 
@@ -400,7 +400,7 @@ const SwFrameFormat* SwFEShell::IsFlyInFly()
 }
 else
 {
-pFly = pContact->GetAnchorFrame(pObj);
+pFly = static_cast(pContact)->GetAnchorFrame(pObj);
 }
 
 OSL_ENSURE( pFly, "IsFlyInFly: Where's my anchor?" );


core.git: 2 commits - sw/qa sw/source

2024-04-28 Thread László Németh (via logerrit)
 sw/qa/extras/uiwriter/data/tdf160842.fodt |   75 +
 sw/qa/extras/uiwriter/uiwriter6.cxx   |  107 ++
 sw/source/core/frmedt/feshview.cxx|   22 ++
 sw/source/uibase/uiview/viewtab.cxx   |2 
 4 files changed, 205 insertions(+), 1 deletion(-)

New commits:
commit f3b899655018397e71300dbb32cdf4f82940a68b
Author: László Németh 
AuthorDate: Sat Apr 27 00:26:54 2024 +0200
Commit: László Németh 
CommitDate: Mon Apr 29 00:16:21 2024 +0200

tdf#160842 sw: select cell content instead of cropped part of image

It was not possible to select and edit the content of the bottom
cell, if an image cropped by the fixed row height "covered" it,
i.e. the image was in the previous row, anchored as character.

Note: table cells with fixed row height are usable to crop images
easily, with a single drag & drop, according to the requirement of
the text layout, while the cell above or bottom of the cell with
image is for the caption of the image. This is very useful to
adjust a book layout with sections with multiple columns and
illustrations.

Change-Id: I8683b4066db6ce43549ec3aa69b0e639a59e3681
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166794
Tested-by: Jenkins
Reviewed-by: László Németh 

diff --git a/sw/qa/extras/uiwriter/data/tdf160842.fodt 
b/sw/qa/extras/uiwriter/data/tdf160842.fodt
new file mode 100644
index ..217b9c1a9570
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data/tdf160842.fodt
@@ -0,0 +1,75 @@
+
+
+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:xforms="http://www.w3.org/2002/xforms; 
xmlns:dom="http://www.w3.org/2001/xml-events; 
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" 
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" 
xmlns:math="http://www.w3.org/1998/Math/MathML; 
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" 
xmlns:ooo="http://openoffice.org/2004/office; 
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" 
xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" 
xmlns:ooow="http://openoffice.org/2004/writer; 
xmlns:xlink="http://www.w3.org/1999/xlink; 
xmlns:drawooo="http://openoffice.org/2010/draw; 
xmlns:oooc="http://openoffice.org/2004/calc; 
xmlns:dc="http://purl.org/dc/elements/1.1/; xmlns:c
 alcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" 
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" 
xmlns:tableooo="http://openoffice.org/2009/table; 
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" 
xmlns:rpt="http://openoffice.org/2005/report; 
xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0"
 xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" 
xmlns:officeooo="http://openoffice.org/2009/office; 
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" 
xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" 
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" 
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:
 meta:1.0" 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
 office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text">
+ 
+  
+   
+   
+
+   
+   
+  
+  
+  
+   
+  
+  
+   
+  
+ 
+ 
+  
+   
+  
+  
+   
+  
+  
+   
+  
+  
+   
+  
+  
+   
+  
+  
+   
+  
+  
+   
+  
+  
+   
+  
+ 
+ 
+  
+ 
+ 
+  
+   
+ 
+  
+   
+   
+
+ 
+
iVBORw0KGgoNSUhEUgICCAIAAAD91JpzFklEQVQI12P2Ytilf46NeWX3
+ a804HgAg7QTAqXPBTwBJRU5ErkJggg==
+
+   
+  
+
+   
+   
+
+ Lorem ipsum dolor sit amet, consectetur 
adipiscing.
+
+   
+  
+ 
+
+  
+ 
+
diff --git a/sw/qa/extras/uiwriter/uiwriter6.cxx 
b/sw/qa/extras/uiwriter/uiwriter6.cxx
index 51f15a09f2d8..e6cff1c8ae9a 100644
--- a/sw/qa/extras/uiwriter/uiwriter6.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter6.cxx
@@ -55,6 +55,10 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -1463,6 +1467,43 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf44773)
 CPPUNIT_ASSERT_EQUAL(tools::Long(810), pCellA1->getFrameArea().Height());
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf160842)
+{
+createSwDoc("tdf160842.fodt");
+SwDoc* pDoc = getSwDoc();
+CPPUNIT_ASSERT(pDoc);
+

core.git: 2 commits - sw/qa sw/source

2024-03-06 Thread Michael Stahl (via logerrit)
 sw/qa/extras/uiwriter/data/pagebreak-source.fodt|  123 +++
 sw/qa/extras/uiwriter/data/pagebreak-target.fodt|  129 
 sw/qa/extras/uiwriter/uiwriter.cxx  |  109 +
 sw/qa/extras/uiwriter/uiwriter2.cxx |6 
 sw/qa/extras/uiwriter/uiwriter3.cxx |3 
 sw/source/core/doc/DocumentContentOperationsManager.cxx |   87 +-
 sw/source/core/docnode/nodes.cxx|2 
 sw/source/core/edit/edglss.cxx  |8 
 sw/source/core/frmedt/fecopy.cxx|   15 +
 sw/source/core/undo/untblk.cxx  |6 
 sw/source/core/unocore/unotext.cxx  |6 
 11 files changed, 436 insertions(+), 58 deletions(-)

New commits:
commit 1063e875c89789ee6bc1a4c77507e0f133832530
Author: Michael Stahl 
AuthorDate: Mon Mar 4 19:47:15 2024 +0100
Commit: Michael Stahl 
CommitDate: Wed Mar 6 10:46:05 2024 +0100

sw: remove dead code in CopyImplImpl()

This looks dead already in CVS import?

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

diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx 
b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index 975f0e0a0dbe..d065af3a60a5 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -5171,12 +5171,7 @@ bool 
DocumentContentOperationsManager::CopyImplImpl(SwPaM& rPam, SwPosition& rPo
 rDoc.getIDocumentContentOperations().SplitNode( rPos, 
false );
 }
 
-if (bCanMoveBack && rPos == *pCopyPam->GetPoint())
-{
-// after the SplitNode, span the CpyPam correctly again
-pCopyPam->Move( fnMoveBackward, GoInContent );
-pCopyPam->Move( fnMoveBackward, GoInContent );
-}
+assert(rPos != *pCopyPam->GetPoint()); // code removed
 
 pDestTextNd = rDoc.GetNodes()[ 
aInsPos.GetIndex()-SwNodeOffset(1) ]->GetTextNode();
 aDestIdx.Assign(
@@ -5262,12 +5257,7 @@ bool 
DocumentContentOperationsManager::CopyImplImpl(SwPaM& rPam, SwPosition& rPo
 rDoc.getIDocumentContentOperations().SplitNode( rPos, 
false );
 }
 
-if (bCanMoveBack && rPos == *pCopyPam->GetPoint())
-{
-// after the SplitNode, span the CpyPam correctly again
-pCopyPam->Move( fnMoveBackward, GoInContent );
-pCopyPam->Move( fnMoveBackward, GoInContent );
-}
+assert(rPos != *pCopyPam->GetPoint()); // code removed
 
 // Correct the area again
 if( bEndEqualIns )
commit fcd4222d36e1864452163e5c94976eea353bbaf0
Author: Michael Stahl 
AuthorDate: Mon Mar 4 15:45:07 2024 +0100
Commit: Michael Stahl 
CommitDate: Wed Mar 6 10:45:57 2024 +0100

sw: SelectAll of section with RES_PAGEDESC corner-case

The main problem here is that if a document has a RES_PAGEDESC on its
first body text node, and you paste a section whose first text node also
has a RES_PAGEDESC, the result inevitably has a page break that wasn't
there before, and which is unwanted.

SwEditShell::CopySelToDoc() needs a change to include the end node of a
section at the start, so it is copied.

Change CopyImplImpl() to insert a non-textnode *before* a text node at
the insert position, instead of after it.  This simplifies the
implementation: only SwFEShell::Paste() needs to care about removing an
empty trailing paragraph, but SwEditShell::CopySelToDoc() needs no
changes; both functions would need to delete the empty paragraph when
inserting after.

Several tests such as CppunitTest_sw_ooxmlexport3 testCrashWhileSave
fail because of this, which can be solved by removing the DelFullPara()
call in SwXText::copyText() that is now unnecessary.

Generalise and simplify the "bAfterTable" code in CopyImplImpl(): it
doesn't really matter what is before the insert position, what matters
is if the pasted text starts with a table or section.

Also, the fly-anchor-correction code (both here and in
SwUndoInserts::RedoImpl()) needs to move to the first text node also in
case a section was inserted (but the equal-looking code *before*
inserting remains as is!), in the situation where the last node will be
deleted.

Now there are some test failures:

  unowriter.cxx:430:Assertion
  Test name: (anonymous 
namespace)::testSectionAnchorCopyTableAtStart::TestBody
  equality 

core.git: 2 commits - sw/qa sw/source vcl/unx

2024-02-23 Thread Miklos Vajna (via logerrit)
 sw/qa/core/layout/data/floattable-in-section.docx |binary
 sw/qa/core/layout/layact.cxx  |   22 ++
 sw/source/core/layout/layact.cxx  |6 +-
 vcl/unx/gtk4/gtkaccessibletext.cxx|2 +-
 4 files changed, 28 insertions(+), 2 deletions(-)

New commits:
commit 397d72e582c725d162c7e0b819dc6c0bb62e42b0
Author: Miklos Vajna 
AuthorDate: Fri Feb 23 09:12:17 2024 +0100
Commit: Miklos Vajna 
CommitDate: Fri Feb 23 10:53:04 2024 +0100

Related: tdf#158986 sw floattable: fix unexpected page break with sections

Regression from commit c303981cfd95ce1c3881366023d5495ae2edce97
(tdf#156724 sw: layout: fix tables not splitting due to footnotes
differently, 2023-08-24), the floating table in the DOCX version of the
bugdoc went from page 1 to page 2.

It seems what happens is that the first page has 2 section frames, and
we used to directly recalc the last lower of the first section frame,
which triggered a recalc of the second section frame, so the table moved
from page 2 to page 1 once the top of the second section frame was
reduced (so the table could fit on page 1). But this direct recalc was
removed because it caused problems for split tables and footnotes in
tdf#156724.

Fix the problem by conditionally restoring the OptCalc() call in
SwLayAction::FormatLayout(): only do it for the last lower of section
frames, which is enough for the DOCX version of tdf#158986, but it keeps
the old tdf#156724 use-case working (the layout of that bugdoc doesn't
modify with this change).

The RTF version of the bugdoc (which was the originally reported
problem) still needs more work, but that's hopefully not a layout
problem but an RTF import one.

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

diff --git a/sw/qa/core/layout/data/floattable-in-section.docx 
b/sw/qa/core/layout/data/floattable-in-section.docx
index a0e9090bcccf..9aab264867f0 100644
Binary files a/sw/qa/core/layout/data/floattable-in-section.docx and 
b/sw/qa/core/layout/data/floattable-in-section.docx differ
diff --git a/sw/qa/core/layout/layact.cxx b/sw/qa/core/layout/layact.cxx
index d432ae52b7c5..8923d6b0e89a 100644
--- a/sw/qa/core/layout/layact.cxx
+++ b/sw/qa/core/layout/layact.cxx
@@ -86,6 +86,28 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf157096)
 
 CPPUNIT_ASSERT_EQUAL(1, getPages());
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testSplitFlyInSection)
+{
+// Given a document with multiple sections, the 2nd section on page 1 has 
a one-page floating
+// table:
+createSwDoc("floattable-in-section.docx");
+
+// When laying out that document:
+SwDoc* pDoc = getSwDoc();
+SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+
+// Then make sure the table is on page 1, not on page 2:
+auto pPage1 = pLayout->Lower()->DynCastPageFrame();
+CPPUNIT_ASSERT(pPage1);
+// Without the fix in place, it would have failed, the table was on page 
2, not on page 1.
+CPPUNIT_ASSERT(pPage1->GetSortedObjs());
+SwSortedObjs& rPage1Objs = *pPage1->GetSortedObjs();
+CPPUNIT_ASSERT_EQUAL(static_cast(1), rPage1Objs.size());
+auto pPage2 = pPage1->GetNext()->DynCastPageFrame();
+CPPUNIT_ASSERT(pPage2);
+CPPUNIT_ASSERT(!pPage2->GetSortedObjs());
+}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx
index 5c910ee59c65..abbca7d67eab 100644
--- a/sw/source/core/layout/layact.cxx
+++ b/sw/source/core/layout/layact.cxx
@@ -1433,7 +1433,11 @@ bool SwLayAction::FormatLayout( OutputDevice 
*pRenderContext, SwLayoutFrame *pLa
 PopFormatLayout();
 }
 }
-// else: don't calc content frames any more
+else if (pLay->IsSctFrame() && pLow->IsTextFrame() && pLow == 
pLay->GetLastLower())
+{
+// else: only calc the last text lower of sections
+pLow->OptCalc();
+}
 
 if ( IsAgain() )
 return false;
commit 4931a5c287b23d695ee8b4dfe4a90dedf5eb3d83
Author: Michael Weghorn 
AuthorDate: Fri Feb 23 08:57:00 2024 +0100
Commit: Michael Weghorn 
CommitDate: Fri Feb 23 10:53:01 2024 +0100

gtk4 a11y: Fix '--enable-werror' GCC build

`offset` is unsigned int, so can't be negative,
causing an `--enable-werror --enable-gtk4` GCC 13.2
build on Debian testing to fail like this:

.../libreoffice-WORKTREE/vcl/unx/gtk4/gtkaccessibletext.cxx: In 
function ‘GBytes* lo_accessible_text_get_contents_at(GtkAccessibleText*, 
unsigned int, GtkAccessibleTextGranularity, unsigned int*, unsigned int*)’:
.../libreoffice-WORKTREE/vcl/unx/gtk4/gtkaccessibletext.cxx:79:16: 
error: comparison of unsigned expression in 

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

2023-10-25 Thread Mike Kaganski (via logerrit)
 sw/qa/core/text/data/placeholder.fodt |9 +
 sw/qa/core/text/text.cxx  |   28 
 sw/source/core/text/itrform2.cxx  |2 
 sw/source/core/text/porfld.cxx|   69 ++-
 sw/source/core/text/porfld.hxx|   24 +++
 sw/source/core/text/txtfld.cxx|  210 +-
 6 files changed, 184 insertions(+), 158 deletions(-)

New commits:
commit 9299afbbd6bd264ba90e5e0ac21a700e88f56c0f
Author: Mike Kaganski 
AuthorDate: Tue Oct 24 23:20:30 2023 +0300
Commit: Mike Kaganski 
CommitDate: Wed Oct 25 15:54:59 2023 +0200

Export text placeholder fields as PDF form fields

Inspired by commit 82d90529dc2b3cb8359dec78852cbd910a66d275
(sw content controls, rich text: add initial PDF export, 2022-09-12).

Change-Id: I16cc45b6f2e070ab9dc83ba15e3c66ca0caa5e53
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158407
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/sw/qa/core/text/data/placeholder.fodt 
b/sw/qa/core/text/data/placeholder.fodt
new file mode 100644
index ..01cb60437618
--- /dev/null
+++ b/sw/qa/core/text/data/placeholder.fodt
@@ -0,0 +1,9 @@
+
+
+
+ 
+  
+   placeholder 
text
+  
+ 
+
\ No newline at end of file
diff --git a/sw/qa/core/text/text.cxx b/sw/qa/core/text/text.cxx
index 8a48b75a03e4..496c14006539 100644
--- a/sw/qa/core/text/text.cxx
+++ b/sw/qa/core/text/text.cxx
@@ -1174,6 +1174,34 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, 
testRichContentControlPDF)
 CPPUNIT_ASSERT_EQUAL(1, pPage->getAnnotationCount());
 }
 
+CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testPlaceholderFieldPDF)
+{
+std::shared_ptr pPDFium = vcl::pdf::PDFiumLibrary::get();
+if (!pPDFium)
+return;
+
+// Given a file with a text-type placeholder field:
+createSwDoc("placeholder.fodt");
+
+// When exporting to PDF (default setting is "create a PDF form"):
+save("writer_pdf_Export");
+
+// Then make sure that a fillable form widget is emitted:
+std::unique_ptr pPdfDocument = parsePDFExport();
+std::unique_ptr pPage = pPdfDocument->openPage(0);
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: 1
+// - Actual  : 0
+// i.e. the placeholder field was just exported as normal text.
+CPPUNIT_ASSERT_EQUAL(1, pPage->getAnnotationCount());
+std::unique_ptr pAnnotation = 
pPage->getAnnotation(0);
+CPPUNIT_ASSERT_EQUAL(vcl::pdf::PDFAnnotationSubType::Widget, 
pAnnotation->getSubType());
+
+// Also verify that the widget description is correct:
+CPPUNIT_ASSERT_EQUAL(OUString("reference text"),
+ 
pAnnotation->getFormFieldAlternateName(pPdfDocument.get()));
+}
+
 CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testNumberPortionFormat)
 {
 // Given a document with a single paragraph, direct formatting asks 24pt 
font size for the
diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx
index c3e718871189..b5077e6c775f 100644
--- a/sw/source/core/text/itrform2.cxx
+++ b/sw/source/core/text/itrform2.cxx
@@ -1182,7 +1182,7 @@ SwTextPortion *SwTextFormatter::WhichTextPor( 
SwTextFormatInfo  ) const
 }
 }
 assert(2 <= sal_Int32(nFieldLen));
-pPor = new SwFieldPortion(aFieldName, nullptr, false, nFieldLen);
+pPor = new SwFieldPortion(aFieldName, nullptr, nFieldLen);
 }
 else
 {
diff --git a/sw/source/core/text/porfld.cxx b/sw/source/core/text/porfld.cxx
index 66f39644ffed..580b4a2635a7 100644
--- a/sw/source/core/text/porfld.cxx
+++ b/sw/source/core/text/porfld.cxx
@@ -22,10 +22,14 @@
 #include 
 #include 
 #include 
+
+#include 
 #include 
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include "porlay.hxx"
@@ -44,6 +48,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using namespace ::com::sun::star;
 
@@ -59,7 +64,7 @@ SwFieldPortion *SwFieldPortion::Clone( const OUString 
 ) const
 }
 // #i107143#
 // pass placeholder property to created  instance.
-SwFieldPortion* pClone = new SwFieldPortion( rExpand, std::move(pNewFnt), 
m_bPlaceHolder );
+SwFieldPortion* pClone = new SwFieldPortion(rExpand, std::move(pNewFnt));
 pClone->SetNextOffset( m_nNextOffset );
 pClone->m_bNoLength = m_bNoLength;
 return pClone;
@@ -73,13 +78,13 @@ void SwFieldPortion::TakeNextOffset( const SwFieldPortion* 
pField )
 m_bFollow = true;
 }
 
-SwFieldPortion::SwFieldPortion(OUString aExpand, std::unique_ptr 
pFont, bool bPlaceHold, TextFrameIndex const nFieldLen)
+SwFieldPortion::SwFieldPortion(OUString aExpand, std::unique_ptr 
pFont, TextFrameIndex const nFieldLen)
 : m_aExpand(std::move(aExpand)), m_pFont(std::move(pFont)), 
m_nNextOffset(0)
 , m_nNextScriptChg(COMPLETE_STRING), m_nFieldLen(nFieldLen), 
m_nViewWidth(0)
 , m_bFollow( false ), m_bLeft( false), m_bHide( false)
 , m_bCenter (false), m_bHasFollow( 

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

2023-07-19 Thread Paris Oplopoios (via logerrit)
 sw/qa/extras/ww8export/data/continuous-sections.doc |binary
 sw/qa/extras/ww8export/data/inlinePageBreakFirstLine.doc|binary
 sw/qa/extras/ww8export/data/nonInlinePageBreakFirstLine.doc |binary
 sw/qa/extras/ww8export/ww8export.cxx|   11 ++
 sw/qa/extras/ww8export/ww8export4.cxx   |   61 
 sw/source/filter/ww8/ww8par.cxx |5 
 6 files changed, 76 insertions(+), 1 deletion(-)

New commits:
commit 6819adb7a66a162f5be40990ea62689cd58f7c8b
Author: Paris Oplopoios 
AuthorDate: Tue Jul 18 17:23:12 2023 +0300
Commit: Paris Oplopoios 
CommitDate: Wed Jul 19 14:19:37 2023 +0200

sw: Add test for continuous section breaks not adding page breaks

Change-Id: I1dbaa0075ff33012c7cc94f1aa82dd992dd0e680
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154588
Tested-by: Jenkins
Reviewed-by: Paris Oplopoios 

diff --git a/sw/qa/extras/ww8export/data/continuous-sections.doc 
b/sw/qa/extras/ww8export/data/continuous-sections.doc
new file mode 100644
index ..cf466c9e7286
Binary files /dev/null and 
b/sw/qa/extras/ww8export/data/continuous-sections.doc differ
diff --git a/sw/qa/extras/ww8export/ww8export.cxx 
b/sw/qa/extras/ww8export/ww8export.cxx
index 616df9bb9189..f767d51bbe96 100644
--- a/sw/qa/extras/ww8export/ww8export.cxx
+++ b/sw/qa/extras/ww8export/ww8export.cxx
@@ -1571,6 +1571,17 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf99474)
 CPPUNIT_ASSERT_EQUAL(COL_AUTO, getProperty(xStyle, "CharColor"));
 }
 
+DECLARE_WW8EXPORT_TEST(testContinuousSectionsNoPageBreak, 
"continuous-sections.doc")
+{
+SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get());
+CPPUNIT_ASSERT(pTextDoc);
+SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc();
+CPPUNIT_ASSERT(pDoc);
+
+// Continuous section breaks should not add new pages
+CPPUNIT_ASSERT_EQUAL(size_t(1), pDoc->GetPageDescCnt());
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit b33e485b1dc9aec04a8899671abf5397face30cd
Author: Paris Oplopoios 
AuthorDate: Wed Jul 12 16:56:25 2023 +0300
Commit: Paris Oplopoios 
CommitDate: Wed Jul 19 14:19:28 2023 +0200

Fix inline page breaks not imported correctly from .doc files

The way we handle page breaks is by creating new paragraphs. This
visually looks fine until the imported file has stuff like first line
indentation.

Change-Id: I26d5bbc1ce8b0ff4492b099305f0ff22de41e4cf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154358
Tested-by: Jenkins
Reviewed-by: Paris Oplopoios 

diff --git a/sw/qa/extras/ww8export/data/inlinePageBreakFirstLine.doc 
b/sw/qa/extras/ww8export/data/inlinePageBreakFirstLine.doc
new file mode 100644
index ..4f339511d664
Binary files /dev/null and 
b/sw/qa/extras/ww8export/data/inlinePageBreakFirstLine.doc differ
diff --git a/sw/qa/extras/ww8export/data/nonInlinePageBreakFirstLine.doc 
b/sw/qa/extras/ww8export/data/nonInlinePageBreakFirstLine.doc
new file mode 100644
index ..5351a9edecc7
Binary files /dev/null and 
b/sw/qa/extras/ww8export/data/nonInlinePageBreakFirstLine.doc differ
diff --git a/sw/qa/extras/ww8export/ww8export4.cxx 
b/sw/qa/extras/ww8export/ww8export4.cxx
index 7e3042aefab2..459daa69ec81 100644
--- a/sw/qa/extras/ww8export/ww8export4.cxx
+++ b/sw/qa/extras/ww8export/ww8export4.cxx
@@ -25,6 +25,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 class Test : public SwModelTestBase
 {
@@ -142,6 +144,65 @@ CPPUNIT_TEST_FIXTURE(Test, testDontBreakWrappedTables)
 CPPUNIT_ASSERT(bDontBreakWrappedTables);
 }
 
+static bool IsFirstLine(const SwTextNode* pTextNode)
+{
+const SfxPoolItem* pItem = pTextNode->GetNoCondAttr(RES_MARGIN_FIRSTLINE, 
false);
+return !!pItem;
+}
+
+DECLARE_WW8EXPORT_TEST(testInlinePageBreakFirstLine, 
"inlinePageBreakFirstLine.doc")
+{
+SwDoc* pDoc = getSwDoc();
+const SwNodes& rNodes = pDoc->GetNodes();
+
+std::vector aTextNodes;
+
+for (SwNodeOffset nNode(0); nNode < rNodes.Count(); ++nNode)
+{
+SwNode* pNode = pDoc->GetNodes()[nNode];
+SwTextNode* pTextNode = pNode->GetTextNode();
+if (!pTextNode)
+continue;
+aTextNodes.push_back(pTextNode);
+}
+
+CPPUNIT_ASSERT_EQUAL(size_t(3), aTextNodes.size());
+CPPUNIT_ASSERT_EQUAL(OUString("First line"), aTextNodes[0]->GetText());
+CPPUNIT_ASSERT(IsFirstLine(aTextNodes[0]));
+// Here exists an inline pagebreak (a pagebreak without a paragraph before 
it)
+// This text node is not indented because it is not the first line of the 
paragraph
+CPPUNIT_ASSERT_EQUAL(OUString("Should not be indented"), 
aTextNodes[1]->GetText());
+CPPUNIT_ASSERT(!IsFirstLine(aTextNodes[1]));
+// Here is the actual second paragraph
+CPPUNIT_ASSERT_EQUAL(OUString("Should be indented"), 
aTextNodes[2]->GetText());
+

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

2023-06-29 Thread Mike Kaganski (via logerrit)
 sw/qa/extras/htmlexport/data/frameWithText.fodt |   25 
 sw/qa/extras/htmlexport/htmlexport.cxx  |   19 ++
 sw/source/filter/html/htmlflywriter.cxx |5 ++--
 3 files changed, 47 insertions(+), 2 deletions(-)

New commits:
commit 532e37c8127c9ae8bc1c455ef2d582e6d2252fb5
Author: Mike Kaganski 
AuthorDate: Thu Jun 29 12:22:55 2023 +0300
Commit: Mike Kaganski 
CommitDate: Thu Jun 29 14:36:11 2023 +0200

XML-encode text that will appear in ReqIF

Change-Id: I56ced6717496d6c0a5fe0bcb86de47ae4142e953
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153738
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/sw/qa/extras/htmlexport/data/frameWithText.fodt 
b/sw/qa/extras/htmlexport/data/frameWithText.fodt
index 3c4635b14a78..97ee5b105984 100644
--- a/sw/qa/extras/htmlexport/data/frameWithText.fodt
+++ b/sw/qa/extras/htmlexport/data/frameWithText.fodt
@@ -16,7 +16,7 @@
A frame with text below

  
-  Some text in frame
+  Some text in frame  
foo
  
 
A text after the frame
diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx 
b/sw/qa/extras/htmlexport/htmlexport.cxx
index 04f8f0d164dc..f83f446f9589 100644
--- a/sw/qa/extras/htmlexport/htmlexport.cxx
+++ b/sw/qa/extras/htmlexport/htmlexport.cxx
@@ -2728,12 +2728,12 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, 
testReqIF_FrameTextAsObjectAltText)
 CPPUNIT_ASSERT(pDoc);
 
 // Without the fix, this would fail with
-// - Expected: Some text in frame
+// - Expected: Some text in frame & 
 // - Actual  : Frame1
 // i.e., frame name was used as the object element content, not frame text
 assertXPathContent(pDoc,

"/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:p[2]/reqif-xhtml:object",
-   "Some text in frame");
+   "Some text in frame & ");
 }
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/filter/html/htmlflywriter.cxx 
b/sw/source/filter/html/htmlflywriter.cxx
index d404e305e172..6aafdeaa0f2f 100644
--- a/sw/source/filter/html/htmlflywriter.cxx
+++ b/sw/source/filter/html/htmlflywriter.cxx
@@ -42,6 +42,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -1245,10 +1246,10 @@ OUString getFrameFormatText(const SwFrameFormat& 
rFrameFormat)
 {
 if (!result.isEmpty())
 result.append("\n");
-result.append(pTextNd->GetExpandText(
+
result.append(comphelper::string::encodeForXml(pTextNd->GetExpandText(
 nullptr, 0, -1, true, true, false,
 ExpandMode::ExpandFields | ExpandMode::HideInvisible | 
ExpandMode::HideDeletions
-| ExpandMode::HideFieldmarkCommands));
+| ExpandMode::HideFieldmarkCommands)));
 }
 }
 
commit 2d8e0ce32d6dccc3441c25dc29bb60489f886ea0
Author: Mike Kaganski 
AuthorDate: Thu Jun 29 12:00:31 2023 +0300
Commit: Mike Kaganski 
CommitDate: Thu Jun 29 14:36:00 2023 +0200

ReqIF: add unit test for frame text in 'object' elements' alt text

Change-Id: I369ee9a4e50d758f2a463f79e37e60fb38ca49b8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153734
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/sw/qa/extras/htmlexport/data/frameWithText.fodt 
b/sw/qa/extras/htmlexport/data/frameWithText.fodt
new file mode 100644
index ..3c4635b14a78
--- /dev/null
+++ b/sw/qa/extras/htmlexport/data/frameWithText.fodt
@@ -0,0 +1,25 @@
+
+
+
+ 
+  
+   
+  
+ 
+ 
+  
+   
+  
+ 
+ 
+  
+   A frame with text below
+   
+ 
+  Some text in frame
+ 
+
+   A text after the frame
+  
+ 
+
\ No newline at end of file
diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx 
b/sw/qa/extras/htmlexport/htmlexport.cxx
index 6fdb67f68eb7..04f8f0d164dc 100644
--- a/sw/qa/extras/htmlexport/htmlexport.cxx
+++ b/sw/qa/extras/htmlexport/htmlexport.cxx
@@ -2717,6 +2717,25 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, 
testReqIF_ListsNoStartAttribute)
 assertXPath(pDoc, "//reqif-xhtml:ol[@start]", 0);
 }
 
+CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqIF_FrameTextAsObjectAltText)
+{
+createSwDoc("frameWithText.fodt");
+ExportToReqif();
+
+SvMemoryStream aStream;
+WrapReqifFromTempFile(aStream);
+xmlDocUniquePtr pDoc = parseXmlStream();
+CPPUNIT_ASSERT(pDoc);
+
+// Without the fix, this would fail with
+// - Expected: Some text in frame
+// - Actual  : Frame1
+// i.e., frame name was used as the object element content, not frame text
+assertXPathContent(pDoc,
+   
"/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:p[2]/reqif-xhtml:object",
+   "Some text in frame");
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


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

2023-06-15 Thread Michael Stahl (via logerrit)
 sw/qa/extras/uiwriter/data/table-at-end-of-cell.fodt |  219 +++
 sw/qa/extras/uiwriter/uiwriter.cxx   |   18 +
 sw/source/core/docnode/ndtbl.cxx |   46 +++
 sw/source/core/edit/eddel.cxx|   10 
 4 files changed, 283 insertions(+), 10 deletions(-)

New commits:
commit 5ab4fb27f4232fe0f36cfc079acb065d1712a355
Author: Michael Stahl 
AuthorDate: Thu Jun 15 13:13:05 2023 +0200
Commit: Michael Stahl 
CommitDate: Thu Jun 15 17:18:48 2023 +0200

tdf#155685 sw: ExtendedSelectAll with tables, group the Undo objects

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

diff --git a/sw/source/core/edit/eddel.cxx b/sw/source/core/edit/eddel.cxx
index 6082dabb9ef0..10d086bbac63 100644
--- a/sw/source/core/edit/eddel.cxx
+++ b/sw/source/core/edit/eddel.cxx
@@ -99,6 +99,12 @@ void SwEditShell::DeleteSel(SwPaM& rPam, bool const 
isArtificialSelection, bool
 SwPaM * pPam = 
 if (oSelectAll)
 {
+if (!oSelectAll->second.empty())
+{
+SwRewriter aRewriter;
+aRewriter.AddRule(UndoArg1, SwResId(STR_MULTISEL));
+GetDoc()->GetIDocumentUndoRedo().StartUndo(SwUndoId::DELETE, 
);
+}
 // tdf#155685 tables at the end must be deleted separately
 for (SwTableNode *const pTable : oSelectAll->second)
 {
@@ -115,6 +121,10 @@ void SwEditShell::DeleteSel(SwPaM& rPam, bool const 
isArtificialSelection, bool
 GetDoc()->getIDocumentContentOperations().DeleteAndJoin(*pPam,
 isArtificialSelection ? SwDeleteFlags::ArtificialSelection : 
SwDeleteFlags::Default);
 SaveTableBoxContent( pPam->GetPoint() );
+if (oSelectAll && !oSelectAll->second.empty())
+{
+GetDoc()->GetIDocumentUndoRedo().EndUndo(SwUndoId::END, nullptr);
+}
 }
 
 // Selection is not needed anymore
commit 4ef548a672658ab164e45e45ebd1b9f0b9282019
Author: Michael Stahl 
AuthorDate: Thu Jun 15 12:22:11 2023 +0200
Commit: Michael Stahl 
CommitDate: Thu Jun 15 17:18:44 2023 +0200

tdf#155685 sw: fix another ExtendedSelectAll Redo crash w table at end

This can be reproduced with a table containing in the last cell a
paragraph followed by a table, then ExtendedSelectAll in the cell and
delete.

On Redo of the SwUndoDelete:

  warn:legacy.osl:326138:326138:sw/source/core/frmedt/tblsel.cxx:1775: 
MakeSelUnions with pStart or pEnd not in CellFrame
  In function:
const_reference std::vector::operator[](size_type) const
[_Tp = SwTableBox *, _Allocator = std::allocator]
  Error: attempt to subscript container with out-of-bounds index 0, but
  container only holds 0 elements.

The problem is that DelTable() calls PaMCorrAbs() with a target that is
outside of the outer table, so the SwEditShell::DeleteSel() rPam has one
end in the last table cell and other end outside the table.

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

diff --git a/sw/qa/extras/uiwriter/data/table-at-end-of-cell.fodt 
b/sw/qa/extras/uiwriter/data/table-at-end-of-cell.fodt
new file mode 100644
index ..4e18f7dc2ce4
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data/table-at-end-of-cell.fodt
@@ -0,0 +1,219 @@
+
+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:xforms="http://www.w3.org/2002/xforms; 
xmlns:dom="http://www.w3.org/2001/xml-events; 
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" 
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" 
xmlns:math="http://www.w3.org/1998/Math/MathML; 
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" 
xmlns:ooo="http://openoffice.org/2004/office; 
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" 
xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" 
xmlns:ooow="http://openoffice.org/2004/writer; 
xmlns:xlink="http://www.w3.org/1999/xlink; 
xmlns:drawooo="http://openoffice.org/2010/draw; 
xmlns:oooc="http://openoffice.org/2004/calc; 
xmlns:dc="http://purl.org/dc/elements/1.1/; xmlns:c
 alcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" 
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" 
xmlns:tableooo="http://openoffice.org/2009/table; 
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 

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

2023-04-02 Thread Caolán McNamara (via logerrit)
 sw/qa/core/data/ww8/pass/ofz57592-1.doc |binary
 sw/source/core/doc/DocumentContentOperationsManager.cxx |   17 +---
 vcl/source/filter/itiff/itiff.cxx   |3 +-
 3 files changed, 12 insertions(+), 8 deletions(-)

New commits:
commit b05fb34d48da717447b9b86db9546df72b25e988
Author: Caolán McNamara 
AuthorDate: Sat Apr 1 22:04:32 2023 +0100
Commit: Caolán McNamara 
CommitDate: Sun Apr 2 17:44:42 2023 +0200

use the same max size that libtiff defaults to for its own utilities

Change-Id: I67a769a6108fb8590d6304390a4f27ef95927c9b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149922
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/source/filter/itiff/itiff.cxx 
b/vcl/source/filter/itiff/itiff.cxx
index 47b15724b177..a31a1c384efd 100644
--- a/vcl/source/filter/itiff/itiff.cxx
+++ b/vcl/source/filter/itiff/itiff.cxx
@@ -155,7 +155,8 @@ bool ImportTiffGraphicImport(SvStream& rTIFF, Graphic& 
rGraphic)
 }
 
 uint32_t nPixelsRequired;
-constexpr size_t nMaxPixelsAllowed = SAL_MAX_INT32/4;
+// use the same max size that libtiff defaults to for its own utilities
+constexpr size_t nMaxPixelsAllowed = (256 * 1024 * 1024) / 4;
 // two buffers currently required, so limit further
 bool bOk = !o3tl::checked_multiply(w, h, nPixelsRequired) && 
nPixelsRequired <= nMaxPixelsAllowed / 2;
 SAL_WARN_IF(!bOk, "filter.tiff", "skipping oversized tiff image " << w 
<< " x " << h);
commit 484fa53f43977e390bf79831cf7096983a440cff
Author: Caolán McNamara 
AuthorDate: Sat Apr 1 21:31:12 2023 +0100
Commit: Caolán McNamara 
CommitDate: Sun Apr 2 17:44:34 2023 +0200

ofz#57592 Null-dereference READ

Change-Id: I6fc96bb0be6c5a872861987a195b0d628f574c46
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149918
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/sw/qa/core/data/ww8/pass/ofz57592-1.doc 
b/sw/qa/core/data/ww8/pass/ofz57592-1.doc
new file mode 100644
index ..289343a1afb7
Binary files /dev/null and b/sw/qa/core/data/ww8/pass/ofz57592-1.doc differ
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx 
b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index 01f1000eee7b..3d86d7ffec8f 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -636,18 +636,21 @@ namespace sw
 }
 while (!startedFields.empty())
 {
-SwPosition const& 
rStart(std::get<0>(startedFields.top())->GetMarkStart());
-std::pair const pos(
-rStart.GetNodeIndex(), rStart.GetContentIndex());
-auto it = std::lower_bound(rBreaks.begin(), rBreaks.end(), pos);
-assert(it == rBreaks.end() || *it != pos);
-rBreaks.insert(it, pos);
+if (const sw::mark::IFieldmark* pMark = 
std::get<0>(startedFields.top()))
+{
+SwPosition const& rStart(pMark->GetMarkStart());
+std::pair const pos(
+rStart.GetNodeIndex(), rStart.GetContentIndex());
+auto it = std::lower_bound(rBreaks.begin(), rBreaks.end(), 
pos);
+assert(it == rBreaks.end() || *it != pos);
+rBreaks.insert(it, pos);
+}
 if (std::get<1>(startedFields.top()))
 {
 std::pair const posSep(
 std::get<2>(startedFields.top()),
 std::get<3>(startedFields.top()));
-it = std::lower_bound(rBreaks.begin(), rBreaks.end(), posSep);
+auto it = std::lower_bound(rBreaks.begin(), rBreaks.end(), 
posSep);
 assert(it == rBreaks.end() || *it != posSep);
 rBreaks.insert(it, posSep);
 }


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

2023-03-22 Thread Gabor Kelemen (via logerrit)
 sw/qa/extras/odfexport/odfexport2.cxx  |3 +++
 sw/qa/extras/ooxmlexport/data/Table-of-Figures.odt |binary
 sw/qa/extras/ooxmlexport/ooxmlexport18.cxx |   13 +
 sw/source/filter/ww8/wrtw8sty.cxx  |2 +-
 writerfilter/source/dmapper/StyleSheetTable.cxx|3 ++-
 5 files changed, 19 insertions(+), 2 deletions(-)

New commits:
commit 667f5f87dee072f6737ee6b6491ed53b7cf154a7
Author: Gabor Kelemen 
AuthorDate: Tue Mar 21 20:12:13 2023 +0100
Commit: Gabor Kelemen 
CommitDate: Wed Mar 22 20:05:09 2023 +

tdf#153664 Export correct Table of Figures paragraph style

Change-Id: I892a0185a94aadd902e55ee9b719f855edbdfc89
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149258
Tested-by: Jenkins
Reviewed-by: Gabor Kelemen 

diff --git a/sw/qa/extras/ooxmlexport/data/Table-of-Figures.odt 
b/sw/qa/extras/ooxmlexport/data/Table-of-Figures.odt
new file mode 100644
index ..cd1502cf866f
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/Table-of-Figures.odt 
differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
index b19c196016b2..20db0327ccef 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
@@ -632,6 +632,19 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf148026)
 assertXPath(pXmlDoc, "//w:hyperlink", "tgtFrame", "_self");
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testTdf153664)
+{
+loadAndReload("Table-of-Figures.odt");
+CPPUNIT_ASSERT_EQUAL(1, getPages());
+xmlDocUniquePtr pXmlStyles = parseExport("word/styles.xml");
+CPPUNIT_ASSERT(pXmlStyles);
+// Without the fix this was styleId='FigureIndex1' and name was "Figure 
Index 1"
+// This led to syle settings being reset when ToF was updated in Word
+// TOF's paragraph style should be exported as "Table of Figures" as 
that's the default Word style name
+assertXPath(pXmlStyles, "/w:styles/w:style[12]", "styleId", 
"TableofFigures");
+assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='TableofFigures']/w:name", "val", "Table of 
Figures");
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/wrtw8sty.cxx 
b/sw/source/filter/ww8/wrtw8sty.cxx
index 1d556fc312b8..8e0bcdde91a1 100644
--- a/sw/source/filter/ww8/wrtw8sty.cxx
+++ b/sw/source/filter/ww8/wrtw8sty.cxx
@@ -268,7 +268,7 @@ sal_uInt16 MSWordStyles::GetWWId( const SwFormat& rFormat )
 case RES_POOLCOLL_FOOTER:   nRet = ww::stiFooter;
break;
 case RES_POOLCOLL_TOX_IDXH: nRet = ww::stiIndexHeading;  
break;
 case RES_POOLCOLL_LABEL:nRet = ww::stiCaption;   
break;
-case RES_POOLCOLL_LABEL_DRAWING:nRet = ww::stiToCaption; 
break;
+case RES_POOLCOLL_TOX_ILLUS1:   nRet = ww::stiToCaption; 
break;
 case RES_POOLCOLL_ENVELOPE_ADDRESS: nRet = ww::stiEnvAddr;   
break;
 case RES_POOLCOLL_SEND_ADDRESS: nRet = ww::stiEnvRet;
break;
 case RES_POOLCHR_FOOTNOTE_ANCHOR:   nRet = ww::stiFootnoteRef;   
break;
commit 9b89ce887836742bb84bf57afa3b536b6c3bb1c1
Author: Gabor Kelemen 
AuthorDate: Tue Mar 21 09:21:18 2023 +0100
Commit: Gabor Kelemen 
CommitDate: Wed Mar 22 20:04:57 2023 +

tdf#153659 Import Table of Figures paragraph style correctly

Change-Id: I5a995349c168bfbb5c8933dafa72e06eddb74ac6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149257
Tested-by: Jenkins
Reviewed-by: Gabor Kelemen 

diff --git a/sw/qa/extras/odfexport/odfexport2.cxx 
b/sw/qa/extras/odfexport/odfexport2.cxx
index e4da067f5396..269525a8756b 100644
--- a/sw/qa/extras/odfexport/odfexport2.cxx
+++ b/sw/qa/extras/odfexport/odfexport2.cxx
@@ -606,6 +606,9 @@ DECLARE_ODFEXPORT_TEST(testTdf153090, 
"Custom-Style-TOC.docx")
 uno::Reference 
xIndexes(xIndexSupplier->getDocumentIndexes());
 uno::Reference xTOC(xIndexes->getByIndex(0), 
uno::UNO_QUERY);
 CPPUNIT_ASSERT_EQUAL(OUString("_CustomImageCaption"), 
getProperty(xTOC, "CreateFromParagraphStyle"));
+// tdf#153659 this was imported as "table of figures" instead of "Figure 
Index 1"
+// thus custom settings were not retained after ToF update
+CPPUNIT_ASSERT_EQUAL(OUString("Figure Index 1"), 
getProperty(getParagraph(1), "ParaStyleName"));
 
 xTOC->update();
 OUString const tocContent(xTOC->getAnchor()->getString());
diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx 
b/writerfilter/source/dmapper/StyleSheetTable.cxx
index 1e10d4966dbf..a78ac4fda2db 100644
--- a/writerfilter/source/dmapper/StyleSheetTable.cxx
+++ b/writerfilter/source/dmapper/StyleSheetTable.cxx
@@ -1594,7 +1594,8 @@ OUString StyleSheetTable::ConvertStyleName( const 
OUString& rWWName, bool bExten
 { "footer", "Footer" }, // RES_POOLCOLL_FOOTER
 { "Index Heading", 

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

2023-01-20 Thread Caolán McNamara (via logerrit)
 sw/qa/core/text/text.cxx   |   24 
 sw/source/core/unocore/unoobj2.cxx |2 ++
 sw/source/core/unocore/unotext.cxx |2 +-
 sw/source/filter/xml/xmltbli.cxx   |   11 ++-
 sw/source/filter/xml/xmltexti.cxx  |2 +-
 5 files changed, 34 insertions(+), 7 deletions(-)

New commits:
commit 0f98e004706439057bfeef23514598c40cfef11b
Author: Caolán McNamara 
AuthorDate: Fri Jan 20 16:57:06 2023 +
Commit: Caolán McNamara 
CommitDate: Fri Jan 20 21:04:00 2023 +

cid#1520426 Unchecked dynamic_cast

and

cid#1520427 Unchecked dynamic_cast
cid#1520428 Unchecked dynamic_cast
cid#1520429 Unchecked dynamic_cast

Change-Id: I618308e02910faf8999e89981f7a396314fa751a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145909
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/sw/source/core/unocore/unoobj2.cxx 
b/sw/source/core/unocore/unoobj2.cxx
index 6983704ac2d2..38dc4eb8b827 100644
--- a/sw/source/core/unocore/unoobj2.cxx
+++ b/sw/source/core/unocore/unoobj2.cxx
@@ -1114,6 +1114,7 @@ bool XTextRangeToSwPaM( SwUnoInternalPaM & rToFill,
 xTextCursor.set(pHeadText->CreateTextCursor(true));
 xTextCursor->gotoEnd(true);
 pCursor = dynamic_cast(xTextCursor.get());
+assert(pCursor && "cant must succeed");
 pCursor->GetPaM()->Normalize();
 }
 else
@@ -1122,6 +1123,7 @@ bool XTextRangeToSwPaM( SwUnoInternalPaM & rToFill,
 xTextCursor.set( pText->CreateCursor() );
 xTextCursor->gotoEnd(true);
 pCursor = dynamic_cast(xTextCursor.get());
+assert(pCursor && "cant must succeed");
 }
 if(pRange && >GetDoc() == ())
 {
diff --git a/sw/source/core/unocore/unotext.cxx 
b/sw/source/core/unocore/unotext.cxx
index f7e9451efba8..f4637d4dd987 100644
--- a/sw/source/core/unocore/unotext.cxx
+++ b/sw/source/core/unocore/unotext.cxx
@@ -969,7 +969,7 @@ bool SwXText::Impl::CheckForOwnMember(
 
 OTextCursorHelper *const pOwnCursor =
 dynamic_cast(xOwnCursor.get());
-OSL_ENSURE(pOwnCursor, "OTextCursorHelper::getUnoTunnelId() ??? ");
+assert(pOwnCursor && "OTextCursorHelper::getUnoTunnelId() ???");
 const SwStartNode* pOwnStartNode =
 pOwnCursor->GetPaM()->GetPointNode().StartOfSectionNode();
 SwStartNodeType eSearchNodeType = SwNormalStartNode;
diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx
index 0e884e3c5fce..1dadf0bcedda 100644
--- a/sw/source/filter/xml/xmltbli.cxx
+++ b/sw/source/filter/xml/xmltbli.cxx
@@ -2667,14 +2667,15 @@ const SwStartNode 
*SwXMLTableContext::InsertTableSection(
 ->InsertTableSection(pPrevSttNd, pStringValueStyleName);
 
 const SwStartNode *pStNd;
-Reference xCursorTunnel( 
GetImport().GetTextImport()->GetCursor(),
-   UNO_QUERY);
-OSL_ENSURE( xCursorTunnel.is(), "missing XUnoTunnel for Cursor" );
-OTextCursorHelper *pTextCursor = 
dynamic_cast(xCursorTunnel.get());
-OSL_ENSURE( pTextCursor, "SwXTextCursor missing" );
 
 if( m_bFirstSection )
 {
+Reference xCursorTunnel( 
GetImport().GetTextImport()->GetCursor(),
+   UNO_QUERY);
+OSL_ENSURE( xCursorTunnel.is(), "missing XUnoTunnel for Cursor" );
+OTextCursorHelper *pTextCursor = 
dynamic_cast(xCursorTunnel.get());
+assert(pTextCursor && "SwXTextCursor missing");
+
 // The Cursor already is in the first section
 pStNd = pTextCursor->GetPaM()->GetPointNode().FindTableBoxStartNode();
 m_bFirstSection = false;
diff --git a/sw/source/filter/xml/xmltexti.cxx 
b/sw/source/filter/xml/xmltexti.cxx
index f64fceeaea1f..3035e22bce76 100644
--- a/sw/source/filter/xml/xmltexti.cxx
+++ b/sw/source/filter/xml/xmltexti.cxx
@@ -873,7 +873,7 @@ void SwXMLTextImportHelper::endAppletOrPlugin(
 SolarMutexGuard aGuard;
 
 SwXFrame* pFrame = dynamic_cast(rPropSet.get());
-OSL_ENSURE( pFrame, "SwXFrame missing" );
+assert(pFrame && "SwXFrame missing");
 SwFrameFormat *pFrameFormat = pFrame->GetFrameFormat();
 const SwFormatContent& rContent = pFrameFormat->GetContent();
 const SwNodeIndex *pNdIdx = rContent.GetContentIdx();
commit 114d41a0a8ffd6801896d04e01dd6cd0f13f7e34
Author: Caolán McNamara 
AuthorDate: Fri Jan 20 16:31:07 2023 +
Commit: Caolán McNamara 
CommitDate: Fri Jan 20 21:03:49 2023 +

don't crash with --disable-pdfium

Change-Id: I194e5624344aa4f6699e855624ce8c5286c8cd25
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145906
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/sw/qa/core/text/text.cxx b/sw/qa/core/text/text.cxx
index 9391630acd51..cb1eba81d97b 100644
--- a/sw/qa/core/text/text.cxx
+++ b/sw/qa/core/text/text.cxx
@@ -701,6 +701,10 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, 
testContentControlPlaceholderPDF)
 
 

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

2023-01-09 Thread Miklos Vajna (via logerrit)
 sw/qa/uibase/uno/uno.cxx  |   28 ++
 sw/source/uibase/inc/frmpage.hxx  |2 +
 sw/source/uibase/uno/loktxdoc.cxx |   40 --
 3 files changed, 68 insertions(+), 2 deletions(-)

New commits:
commit 2ddd41b420cea7f1b988f0b8acbca564b2811382
Author: Miklos Vajna 
AuthorDate: Mon Jan 9 13:53:35 2023 +0100
Commit: Miklos Vajna 
CommitDate: Tue Jan 10 07:06:00 2023 +

sw, lok: implement a getCommandValues(Sections)

There was no LOK API to get a list of all sections where the name
matches a certain prefix.

This is useful in case the API client wants to know what previously
inserted sections were deleted by the user as part of deleting text
content.

Add a new getCommandValues(".uno:Sections") that returns the names of
matching sections. Do not return the section text, assuming that would
be updated by the API client anyway.

In practice this is needed by Zotero in case it wants to model its
bibliography items with sections.

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

diff --git a/sw/qa/uibase/uno/uno.cxx b/sw/qa/uibase/uno/uno.cxx
index a23f6e0f4968..b9158c44426d 100644
--- a/sw/qa/uibase/uno/uno.cxx
+++ b/sw/qa/uibase/uno/uno.cxx
@@ -413,6 +413,34 @@ CPPUNIT_TEST_FIXTURE(SwUibaseUnoTest, testGetTextFormField)
  aTree.get("command"));
 }
 
+CPPUNIT_TEST_FIXTURE(SwUibaseUnoTest, testGetSections)
+{
+// Given a document with a section:
+createSwDoc();
+uno::Sequence aArgs = {
+comphelper::makePropertyValue(
+"RegionName", uno::Any(OUString("ZOTERO_BIBL {} CSL_BIBLIOGRAPHY 
RNDRfiit6mXBc"))),
+comphelper::makePropertyValue("Content", 
uno::Any(OUString("aaabbb"))),
+};
+dispatchCommand(mxComponent, ".uno:InsertSection", aArgs);
+
+// When asking for a list of section names:
+tools::JsonWriter aJsonWriter;
+std::string_view aCommand(".uno:Sections?namePrefix=ZOTERO_BIBL");
+auto pXTextDocument = dynamic_cast(mxComponent.get());
+pXTextDocument->getCommandValues(aJsonWriter, aCommand);
+
+// Make sure we find our just inserted section:
+std::unique_ptr 
pJSON(aJsonWriter.extractData());
+std::stringstream aStream(pJSON.get());
+boost::property_tree::ptree aTree;
+boost::property_tree::read_json(aStream, aTree);
+// Without the accompanying fix in place, this test would have failed with:
+// - No such node (sections)
+// i.e. the returned JSON was an empty object.
+CPPUNIT_ASSERT_EQUAL(static_cast(1), 
aTree.get_child("sections").count(""));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/uno/loktxdoc.cxx 
b/sw/source/uibase/uno/loktxdoc.cxx
index ec0e9303527d..9c92d071e27e 100644
--- a/sw/source/uibase/uno/loktxdoc.cxx
+++ b/sw/source/uibase/uno/loktxdoc.cxx
@@ -289,13 +289,44 @@ void GetFields(tools::JsonWriter& rJsonWriter, 
SwDocShell* pDocShell,
 rJsonWriter.put("name", pRefMark->GetRefName());
 }
 }
+
+/// Implements getCommandValues(".uno:Sections").
+///
+/// Parameters:
+///
+/// - namePrefix: field name prefix to not return all sections
+void GetSections(tools::JsonWriter& rJsonWriter, SwDocShell* pDocShell,
+ const std::map& rArguments)
+{
+OUString aNamePrefix;
+{
+auto it = rArguments.find("namePrefix");
+if (it != rArguments.end())
+{
+aNamePrefix = it->second;
+}
+}
+
+SwDoc* pDoc = pDocShell->GetDoc();
+tools::ScopedJsonWriterArray aBookmarks = 
rJsonWriter.startArray("sections");
+for (const auto& pSection : pDoc->GetSections())
+{
+if (!pSection->GetName().startsWith(aNamePrefix))
+{
+continue;
+}
+
+tools::ScopedJsonWriterStruct aProperty = rJsonWriter.startStruct();
+rJsonWriter.put("name", pSection->GetName());
+}
+}
 }
 
 bool SwXTextDocument::supportsCommandValues(std::u16string_view rCommand)
 {
 static const std::initializer_list vForward
-= { u"TextFormFields", u"TextFormField", u"SetDocumentProperties", 
u"Bookmarks",
-u"Fields" };
+= { u"TextFormFields", u"TextFormField", u"SetDocumentProperties",
+u"Bookmarks",  u"Fields",u"Sections" };
 
 return std::find(vForward.begin(), vForward.end(), rCommand) != 
vForward.end();
 }
@@ -309,6 +340,7 @@ void SwXTextDocument::getCommandValues(tools::JsonWriter& 
rJsonWriter, std::stri
 static constexpr OStringLiteral 
aSetDocumentProperties(".uno:SetDocumentProperties");
 static constexpr OStringLiteral aBookmarks(".uno:Bookmarks");
 static constexpr OStringLiteral aFields(".uno:Fields");
+static constexpr OStringLiteral aSections(".uno:Sections");
 
 

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

2022-03-02 Thread Caolán McNamara (via logerrit)
 sw/qa/core/data/ww6/fail/ofz45140-1.doc |binary
 sw/source/filter/ww8/ww8par2.cxx|   87 +++-
 2 files changed, 42 insertions(+), 45 deletions(-)

New commits:
commit 66cf7677a2352c3796ef12597bbff9145a2efdec
Author: Caolán McNamara 
AuthorDate: Wed Mar 2 11:46:38 2022 +
Commit: Caolán McNamara 
CommitDate: Wed Mar 2 16:35:13 2022 +0100

ofz#45140 just discard document where import has hopelessly failed

Change-Id: Ic772402f99cd68abf24c79f2cf2270692f21aa53
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130844
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/sw/qa/core/data/ww6/fail/ofz45140-1.doc 
b/sw/qa/core/data/ww6/fail/ofz45140-1.doc
new file mode 100644
index ..59538b13e450
Binary files /dev/null and b/sw/qa/core/data/ww6/fail/ofz45140-1.doc differ
diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index df34892bc8a9..016ce7244634 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -2856,7 +2856,7 @@ void WW8TabDesc::FinishSwTable()
 m_pIo->m_aInsertedTables.InsertTable(*m_pTableNd, *m_pIo->m_pPaM);
 
 if (aListener.WasDeleted())
-return;
+throw std::runtime_error("table unexpectedly destroyed by applying 
redlines");
 
 MergeCells();
 
commit a625a9e6858fa1c8c62d6201040d7d36e71a4efa
Author: Caolán McNamara 
AuthorDate: Wed Mar 2 12:04:32 2022 +
Commit: Caolán McNamara 
CommitDate: Wed Mar 2 16:34:57 2022 +0100

move these two DeleteListeners beside each other

Change-Id: I815223b88b09d19014bed7c4940873fc12b4854f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130845
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index e47f11913548..df34892bc8a9 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -169,12 +169,12 @@ sal_uInt32 wwSectionManager::GetWWPageTopMargin() const
 
 namespace
 {
-class DeleteListener final : public SvtListener
+class SvtDeleteListener final : public SvtListener
 {
 private:
 bool bObjectDeleted;
 public:
-explicit DeleteListener(SvtBroadcaster& rNotifier)
+explicit SvtDeleteListener(SvtBroadcaster& rNotifier)
 : bObjectDeleted(false)
 {
 StartListening(rNotifier);
@@ -191,6 +191,43 @@ namespace
 return bObjectDeleted;
 }
 };
+
+class SwDeleteListener final : public SwClient
+{
+private:
+SwModify* m_pModify;
+
+virtual void SwClientNotify(const SwModify&, const SfxHint& rHint) 
override
+{
+if (rHint.GetId() != SfxHintId::SwLegacyModify)
+return;
+auto pLegacy = static_cast();
+if (pLegacy->GetWhich() == RES_OBJECTDYING)
+{
+m_pModify->Remove(this);
+m_pModify = nullptr;
+}
+}
+
+public:
+SwDeleteListener(SwModify* pModify)
+: m_pModify(pModify)
+{
+m_pModify->Add(this);
+}
+
+bool WasDeleted() const
+{
+return !m_pModify;
+}
+
+virtual ~SwDeleteListener() override
+{
+if (!m_pModify)
+return;
+m_pModify->Remove(this);
+}
+};
 }
 
 sal_uInt16 SwWW8ImplReader::End_Footnote()
@@ -252,7 +289,7 @@ sal_uInt16 SwWW8ImplReader::End_Footnote()
 
 SwFormatFootnote& rFormatFootnote = 
static_cast(pFN->GetAttr());
 
-DeleteListener aDeleteListener(rFormatFootnote.GetNotifier());
+SvtDeleteListener aDeleteListener(rFormatFootnote.GetNotifier());
 
 // read content of Ft-/End-Note
 Read_HdFtFootnoteText( pSttIdx, rDesc.mnStartCp, rDesc.mnLen, 
rDesc.meType);
@@ -2789,46 +2826,6 @@ void WW8TabDesc::MoveOutsideTable()
 *m_pIo->m_pPaM->GetPoint() = *m_xTmpPos->GetPoint();
 }
 
-namespace
-{
-class SwTableNodeListener final : public SwClient
-{
-private:
-SwModify* m_pModify;
-
-virtual void SwClientNotify(const SwModify&, const SfxHint& rHint) 
override
-{
-if (rHint.GetId() != SfxHintId::SwLegacyModify)
-return;
-auto pLegacy = static_cast();
-if (pLegacy->GetWhich() == RES_OBJECTDYING)
-{
-m_pModify->Remove(this);
-m_pModify = nullptr;
-}
-}
-
-public:
-SwTableNodeListener(SwModify* pModify)
-: m_pModify(pModify)
-{
-m_pModify->Add(this);
-}
-
-bool WasDeleted() const
-{
-return !m_pModify;
-}
-
-virtual ~SwTableNodeListener() override
-{
-if (!m_pModify)
-return;
-m_pModify->Remove(this);
-  

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

2022-02-02 Thread Michael Stahl (via logerrit)
 sw/qa/extras/uiwriter/data/tdf147006.rtf  |   24 ++
 sw/qa/extras/uiwriter/uiwriter2.cxx   |   43 ++
 sw/source/core/crsr/bookmark.cxx  |   19 +++
 sw/source/core/doc/DocumentRedlineManager.cxx |3 +
 sw/source/core/doc/docbm.cxx  |8 +---
 sw/source/core/txtnode/modeltoviewhelper.cxx  |2 -
 sw/source/core/undo/rolbck.cxx|8 ++--
 7 files changed, 89 insertions(+), 18 deletions(-)

New commits:
commit bdf1d9b8151476531f2fbe06f66db260efcbc529
Author: Michael Stahl 
AuthorDate: Tue Feb 1 21:35:46 2022 +0100
Commit: Michael Stahl 
CommitDate: Wed Feb 2 09:47:36 2022 +0100

tdf#147006 sw_fieldmarkhide: fix crash when deleting fly with fieldmark

The problem is similar to commit eef10be20a4c5108c68b19ccdda263c5ca852386,
there is a fieldmark in a fly and this results in
UpdateFramesForRemoveDeleteRedline() re-creating fly frames that have
already been deleted in SwUndoFlyBase::DelFly(), and then the
SwFlyAtContentFrame::SwClientNotify() crashes on a null anchor position
in the SwFormat::ResetFormatAttr(RES_ANCHOR).

This time the passed rPam is empty, after removing the dummy characters
of the fieldmark; there isn't really anything to do in this case so
just return.

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

diff --git a/sw/qa/extras/uiwriter/data/tdf147006.rtf 
b/sw/qa/extras/uiwriter/data/tdf147006.rtf
new file mode 100644
index ..462c8dc4d52d
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data/tdf147006.rtf
@@ -0,0 +1,24 @@
+{\rtf1\ansi\deff3\adeflang1025
+{\fonttbl{\f0\froman\fprq2\fcharset0 Times New 
Roman;}{\f1\froman\fprq2\fcharset2 Symbol;}{\f2\fswiss\fprq2\fcharset0 
Arial;}{\f3\froman\fprq2\fcharset0 Liberation Serif{\*\falt Times New 
Roman};}{\f4\fswiss\fprq2\fcharset0 Liberation Sans{\*\falt 
Arial};}{\f5\fnil\fprq2\fcharset0 Source Han Sans CN;}{\f6\fnil\fprq2\fcharset0 
Lohit Devanagari;}{\f7\fnil\fprq0\fcharset128 Lohit Devanagari;}}
+{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;}
+{\stylesheet{\s0\snext0\rtlch\af6\afs24\alang1081 
\ltrch\lang1031\langfe2052\hich\af3\loch\widctlpar\hyphpar0\ltrpar\cf0\f3\fs24\lang1031\kerning1\dbch\af8\langfe2052
 Normal;}
+{\s20\sbasedon0\snext20 Frame Contents;}
+}{\*\generator LibreOfficeDev/7.4.0.0.alpha0$Linux_X86_64 
LibreOffice_project/086efd30b2f5857d2b155099ec06c522d57ad81f}{\info{\creatim\yr2022\mo2\dy1\hr21\min9}{\revtim\yr2022\mo2\dy1\hr21\min10}{\printim\yr0\mo0\dy0\hr0\min0}}{\*\userprops}\deftab709
+\hyphauto1\viewscale100
+{\*\pgdsctbl
+{\pgdsc0\pgdscuse451\pgwsxn11906\pghsxn16838\marglsxn1134\margrsxn1134\margtsxn1134\margbsxn1134\pgdscnxt0
 Default Page Style;}}
+\formshade\paperh16838\paperw11906\margl1134\margr1134\margt1134\margb1134\sectd\sbknone\pgndec\sftnnar\saftnnrlc\sectunlocked1\pgwsxn11906\pghsxn16838\marglsxn1134\margrsxn1134\margtsxn1134\margbsxn1134\ftnbj\ftnstart1\ftnrstcont\ftnnar\aenddoc\aftnrstcont\aftnstart1\aftnnrlc
+{\*\ftnsep\chftnsep}\pard\plain \s0\rtlch\af6\afs24\alang1081 
\ltrch\lang1031\langfe2052\hich\af3\loch\widctlpar\hyphpar0\ltrpar\cf0\f3\fs24\lang1031\kerning1\dbch\af8\langfe2052\loch\ql\ltrpar\loch
+{\shp{\*\shpinst\shpwr2\shpwrk0\shpbypara\shpbyignore\shptop114\shpbottom1248\shpbxcolumn\shpbxignore\shpleft4252\shpright5386\shpz0{\sp{\sn
 shapeType}{\sv 202}}{\sp{\sn dxWrapDistLeft}{\sv 72390}}{\sp{\sn 
dxWrapDistRight}{\sv 72390}}{\sp{\sn dyWrapDistTop}{\sv 72390}}{\sp{\sn 
dyWrapDistBottom}{\sv 72390}}{\sp{\sn posrelv}{\sv 2}}{\sp{\sn posv}{\sv 
1}}{\sp{\sn posrelh}{\sv 2}}{\sp{\sn posh}{\sv 2}}{\sp{\sn dxTextLeft}{\sv 
53975}}{\sp{\sn dyTextTop}{\sv 53975}}{\sp{\sn dxTextRight}{\sv 53975}}{\sp{\sn 
dyTextBottom}{\sv 53975}}{\sp{\sn lineColor}{\sv 0}}{\sp{\sn lineWidth}{\sv 
635}}{\shptxt\pgndec\s20\loch\ql{
+{\*\shppict{\pict{\*\picprop{\sp{\sn wzDescription}{\sv }}{\sp{\sn wzName}{\sv 
}}}\picscalex100\picscaley100\piccropl0\piccropr0\piccropt0\piccropb0\picw19\pich19\picwgoal380\pichgoal380\pngblip
+89504e470d0a1a0a000d4948445200130013080600725036cc00017352474200aece1ce90006624b474400ff00ff00ffa0bda793
+0009704859730b130b1301009a9c18000774494d4507db0906123403a1d7aeb200654944415438cb63fc3f03b50013318a2497b0
+fca78a6130838831908914171132908954afe13390899c30c225cf446e606353c7448e41b8d433e133e879cc1f467c7c747d3823009b467ce20c0c0c0c2cc428
+22d64026062a8251c38693618cd42c6901c5e32de14bf6d21e49454e44ae426082}}
+}{\loch

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

2022-02-01 Thread Michael Stahl (via logerrit)
 sw/qa/extras/ooxmlimport/ooxmlimport2.cxx |3 ++-
 sw/qa/inc/swmodeltestbase.hxx |4 +++-
 sw/qa/unit/swmodeltestbase.cxx|6 --
 sw/source/core/inc/bookmark.hxx   |4 
 4 files changed, 13 insertions(+), 4 deletions(-)

New commits:
commit 3eac118b31ed569dbcec845fc32386ebd0022f73
Author: Michael Stahl 
AuthorDate: Tue Feb 1 13:32:43 2022 +0100
Commit: Michael Stahl 
CommitDate: Tue Feb 1 21:40:21 2022 +0100

sw: add note to DateFieldmark

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

diff --git a/sw/source/core/inc/bookmark.hxx b/sw/source/core/inc/bookmark.hxx
index ed7d5ad82180..f352eebadf77 100644
--- a/sw/source/core/inc/bookmark.hxx
+++ b/sw/source/core/inc/bookmark.hxx
@@ -301,6 +301,10 @@ namespace sw::mark {
 };
 
 /// Fieldmark representing a date form field.
+/// TODO: this was an SDT in DOCX, which is modelled suboptimally here
+/// as a fieldmark; as it cannot contain paragraph breaks, must be
+/// well-formed XML element, and does not have field separator, it
+/// should be a nesting text attribute similar to SwTextMeta.
 class DateFieldmark final
 : virtual public IDateFieldmark
 , public FieldmarkWithDropDownButton
commit b72fcad54b7346615f8b8e703e243b72e5cca9f9
Author: Michael Stahl 
AuthorDate: Tue Feb 1 13:31:04 2022 +0100
Commit: Michael Stahl 
CommitDate: Tue Feb 1 21:40:05 2022 +0100

sw: change test to check the text content instead of just the length

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

diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
index bb677a125beb..f3eb3d4aad34 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
@@ -761,7 +761,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf126114)
 load(mpTestDocumentPath, "tdf126114.docx");
 // The problem was that after the drop-down form field, also the 
placeholder string
 // was imported as text. Beside the duplication of the field, it also 
caused a crash.
-CPPUNIT_ASSERT_EQUAL(7, getLength());
+// the word is from replacement of the drop-down field in ModelToViewHelper
+CPPUNIT_ASSERT_EQUAL(OUString("gehuwd\n"), getBodyText());
 }
 
 CPPUNIT_TEST_FIXTURE(Test, testTdf127825)
diff --git a/sw/qa/inc/swmodeltestbase.hxx b/sw/qa/inc/swmodeltestbase.hxx
index fc194c87c2a9..329a9a60b4d8 100644
--- a/sw/qa/inc/swmodeltestbase.hxx
+++ b/sw/qa/inc/swmodeltestbase.hxx
@@ -213,8 +213,10 @@ protected:
 
 void calcLayout();
 
-/// Get the length of the whole document.
+/// Get the length of the whole document. @deprecated why use this?
 int getLength() const;
+/// Get the body text of the whole document.
+OUString getBodyText() const;
 
 /// Get a family of styles, see com.sun.star.style.StyleFamilies for 
possible values.
 css::uno::Reference getStyles(const OUString& 
aFamily);
diff --git a/sw/qa/unit/swmodeltestbase.cxx b/sw/qa/unit/swmodeltestbase.cxx
index ee35a1cc7259..e1b28153110f 100644
--- a/sw/qa/unit/swmodeltestbase.cxx
+++ b/sw/qa/unit/swmodeltestbase.cxx
@@ -172,7 +172,9 @@ void SwModelTestBase::calcLayout()
 pDoc->getIDocumentLayoutAccess().GetCurrentViewShell()->CalcLayout();
 }
 
-int SwModelTestBase::getLength() const
+int SwModelTestBase::getLength() const { return getBodyText().getLength(); }
+
+OUString SwModelTestBase::getBodyText() const
 {
 uno::Reference xTextDocument(mxComponent, 
uno::UNO_QUERY);
 uno::Reference 
xParaEnumAccess(xTextDocument->getText(),
@@ -190,7 +192,7 @@ int SwModelTestBase::getLength() const
 aBuf.append(xRange->getString());
 }
 }
-return aBuf.getLength();
+return aBuf.makeStringAndClear();
 }
 
 uno::Reference SwModelTestBase::getStyles(const 
OUString& aFamily)


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

2021-11-19 Thread Justin Luth (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf135906.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport17.cxx   |5 +
 sw/source/filter/ww8/docxsdrexport.cxx   |1 +
 vcl/qt5/QtGraphics_GDI.cxx   |9 -
 vcl/qt5/QtSvpGraphics.cxx|9 -
 5 files changed, 22 insertions(+), 2 deletions(-)

New commits:
commit 0afd2d3bfa9d55249ffd1408681ff04decf2d8fa
Author: Justin Luth 
AuthorDate: Thu Nov 18 11:28:42 2021 +0200
Commit: Miklos Vajna 
CommitDate: Fri Nov 19 09:12:44 2021 +0100

tdf#135906 docxexport: set serializer before writing

This fixes a 6.3 regresssion from
commit aafaf1f55fa413ad49d4556cf7c0a713dd206ae4.

Change-Id: Ia2d3d26fe2cfa2b213326021f6b97f8d40c6e98c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125441
Tested-by: Jenkins
Reviewed-by: Justin Luth 
Reviewed-by: Miklos Vajna 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf135906.docx 
b/sw/qa/extras/ooxmlexport/data/tdf135906.docx
new file mode 100644
index ..701fccff5ed4
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf135906.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
index 0a7879269a75..a8a6029392f0 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
@@ -48,6 +48,11 @@ DECLARE_OOXMLEXPORT_TEST(testTdf135164_cancelledNumbering, 
"tdf135164_cancelledN
 CPPUNIT_ASSERT_EQUAL(OUString("i"), getProperty(xPara, 
"ListLabelString"));
 }
 
+DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf135906, "tdf135906.docx")
+{
+// just test round-tripping. The document was exported as corrupt and 
didn't re-load.
+}
+
 CPPUNIT_TEST_FIXTURE(Test, testParaStyleNumLevel)
 {
 loadAndSave("para-style-num-level.docx");
diff --git a/sw/source/filter/ww8/docxsdrexport.cxx 
b/sw/source/filter/ww8/docxsdrexport.cxx
index 3b25c0c0c608..2efafc412d82 100644
--- a/sw/source/filter/ww8/docxsdrexport.cxx
+++ b/sw/source/filter/ww8/docxsdrexport.cxx
@@ -1689,6 +1689,7 @@ void DocxSdrExport::writeDiagram(const SdrObject* 
sdrObject, const SwFrameFormat
 Size aSize(sdrObject->GetSnapRect().getWidth(), 
sdrObject->GetSnapRect().getHeight());
 startDMLAnchorInline(, aSize);
 
+m_pImpl->getDrawingML()->SetFS(m_pImpl->getSerializer());
 m_pImpl->getDrawingML()->WriteDiagram(xShape, nDiagramId);
 
 endDMLAnchorInline();
commit dc0016bc8d7e6c4456f4442c7ccf287bfc0c2e9b
Author: Michael Weghorn 
AuthorDate: Thu Nov 18 21:15:10 2021 +0100
Commit: Michael Weghorn 
CommitDate: Fri Nov 19 09:12:34 2021 +0100

tdf#137924 qt (>=5.14): Use proper DPI without requiring window handle

For Qt >= 5.14, don't require a window handle to retrieve
the screen and then the associated DPI value from that one,
but directly use 'QWidget::screen' (introduced in QT 5.14)
to retrieve the screen.

Previously, no DPI values would be set in case there was
no window handle.

This makes UI scaling work without having to manually set
'SAL_FORCEDPI' on Wayland.

While various UI elements (like e.g. the "Help" -> "About LibreOffice"
still look quite broken with the qt5 and kf5 VCL plugins
in a Plasma Wayland session (at least on my Debian testing with
Qt 5.15.2 and Plasma 5.23), they look OK
when using the qt6 VCL plugin with a custom build of qtbase
and qtwayland from Qt's "dev" git branches.

Change-Id: I5feae46ed86a8b7d3cf92d4a973f7a0f9a9f95de
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125507
Tested-by: Jenkins
Reviewed-by: Michael Weghorn 

diff --git a/vcl/qt5/QtGraphics_GDI.cxx b/vcl/qt5/QtGraphics_GDI.cxx
index 0f9faa022d0b..f87de50827df 100644
--- a/vcl/qt5/QtGraphics_GDI.cxx
+++ b/vcl/qt5/QtGraphics_GDI.cxx
@@ -746,10 +746,17 @@ void QtGraphics::GetResolution(sal_Int32& rDPIX, 
sal_Int32& rDPIY)
 return;
 }
 
-if (!m_pFrame || !m_pFrame->GetQWidget()->window()->windowHandle())
+if (!m_pFrame)
+return;
+
+#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
+QScreen* pScreen = m_pFrame->GetQWidget()->screen();
+#else
+if (!m_pFrame->GetQWidget()->window()->windowHandle())
 return;
 
 QScreen* pScreen = 
m_pFrame->GetQWidget()->window()->windowHandle()->screen();
+#endif
 rDPIX = pScreen->logicalDotsPerInchX() * pScreen->devicePixelRatio() + 0.5;
 rDPIY = pScreen->logicalDotsPerInchY() * pScreen->devicePixelRatio() + 0.5;
 }
diff --git a/vcl/qt5/QtSvpGraphics.cxx b/vcl/qt5/QtSvpGraphics.cxx
index b6018a95e299..3632c8990706 100644
--- a/vcl/qt5/QtSvpGraphics.cxx
+++ b/vcl/qt5/QtSvpGraphics.cxx
@@ -102,10 +102,17 @@ void QtSvpGraphics::GetResolution(sal_Int32& rDPIX, 
sal_Int32& rDPIY)
 return;
 }
 
-if (!m_pFrame || !m_pFrame->GetQWidget()->window()->windowHandle())
+if (!m_pFrame)
+return;
+
+#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
+

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

2021-08-27 Thread Michael Stahl (via logerrit)
 sw/qa/extras/uiwriter/data/cross_reference_demo_bmk.odt |binary
 sw/qa/extras/uiwriter/uiwriter3.cxx |   75 
 sw/source/core/doc/DocumentContentOperationsManager.cxx |   15 ++-
 sw/source/core/doc/docglbl.cxx  |9 -
 4 files changed, 90 insertions(+), 9 deletions(-)

New commits:
commit 4bf04dea9afb30a9395e80b07a81d1908937ee8b
Author: Michael Stahl 
AuthorDate: Fri Aug 27 14:38:18 2021 +0200
Commit: Michael Stahl 
CommitDate: Fri Aug 27 17:09:29 2021 +0200

tdf#128106 sw: copy bookmarks at start if whole node is copied

The CrossRefHeadingBookmarks are always at index 0 so copy them if the
selection also starts at index 0.

This happens in SwDoc::SplitDoc() for the 2nd etc. chapter.

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

diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx 
b/sw/qa/extras/uiwriter/uiwriter3.cxx
index 64e3c8fb61cb..c283f3022803 100644
--- a/sw/qa/extras/uiwriter/uiwriter3.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter3.cxx
@@ -2664,7 +2664,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf128106)
 CPPUNIT_ASSERT_EQUAL(sal_uInt16(REF_BOOKMARK), 
fields[1]->GetField()->GetSubType());
 CPPUNIT_ASSERT(
 static_cast(fields[1]->GetField())->IsRefToHeadingCrossRefBookmark());
-//CPPUNIT_ASSERT_EQUAL(OUString("Chapter 2"), 
static_cast(fields[1]->GetField())->GetPar2());
+CPPUNIT_ASSERT_EQUAL(OUString("Chapter 2"),
+ static_cast(fields[1]->GetField())->GetPar2());
 CPPUNIT_ASSERT_EQUAL(sal_uInt16(REF_BOOKMARK), 
fields[2]->GetField()->GetSubType());
 CPPUNIT_ASSERT_EQUAL(OUString("Bookmarkchapter1"),
  static_cast(fields[2]->GetField())->GetSetRefName());
@@ -2683,7 +2684,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf128106)
 CPPUNIT_ASSERT_EQUAL(sal_uInt16(REF_BOOKMARK), 
fields[5]->GetField()->GetSubType());
 CPPUNIT_ASSERT(
 static_cast(fields[5]->GetField())->IsRefToHeadingCrossRefBookmark());
-//CPPUNIT_ASSERT_EQUAL(OUString("Chapter 2"), 
static_cast(fields[5]->GetField())->GetPar2());
+CPPUNIT_ASSERT_EQUAL(OUString("Chapter 2"),
+ static_cast(fields[5]->GetField())->GetPar2());
 
 tempDir.EnableKillingFile();
 }
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx 
b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index 35044a92a3bd..9af97d1c4626 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -251,10 +251,21 @@ namespace sw
 const SwPosition& rMarkEnd = pMark->GetMarkEnd();
 // only include marks that are in the range and not touching both 
start and end
 // - not for annotation or checkbox marks.
+bool const isIncludeStart(
+   (rStt.nContent.GetIndex() == 0 // paragraph start selected?
+// also: only if inserting at the start - cross reference
+// marks require index to be 0, and there could be one
+// on the target node already
+&& rCpyPam.nContent.GetIndex() == 0)
+|| rMarkStart != rStt);
+bool const isIncludeEnd(
+   (rEnd.nNode.GetNode().IsTextNode() // paragraph end 
selected?
+&& rEnd.nContent.GetIndex() == 
rEnd.nNode.GetNode().GetTextNode()->Len())
+|| rMarkEnd != rEnd);
 const bool bIsNotOnBoundary =
 pMark->IsExpanded()
-? (rMarkStart != rStt || rMarkEnd != rEnd)  // rMarkStart != 
rMarkEnd
-: (rMarkStart != rStt && rMarkEnd != rEnd); // rMarkStart == 
rMarkEnd
+? (isIncludeStart || isIncludeEnd)  // rMarkStart != rMarkEnd
+: (isIncludeStart && isIncludeEnd); // rMarkStart == rMarkEnd
 const IDocumentMarkAccess::MarkType aMarkType = 
IDocumentMarkAccess::GetType(*pMark);
 if ( rMarkStart >= rStt && rMarkEnd <= rEnd
  && ( bIsNotOnBoundary
commit 3608de9a3647294361c64b923b1ae413ad9755df
Author: Michael Stahl 
AuthorDate: Thu Aug 26 17:09:22 2021 +0200
Commit: Michael Stahl 
CommitDate: Fri Aug 27 17:09:13 2021 +0200

tdf#128106 sw: copy bookmarks in SwDoc::SplitDoc()

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

diff --git a/sw/qa/extras/uiwriter/data/cross_reference_demo_bmk.odt 
b/sw/qa/extras/uiwriter/data/cross_reference_demo_bmk.odt
new file mode 100644
index ..df8d95f912c4
Binary files /dev/null and 
b/sw/qa/extras/uiwriter/data/cross_reference_demo_bmk.odt differ
diff --git 

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

2020-05-27 Thread Michael Stahl (via logerrit)
 sw/qa/extras/uiwriter/data2/tdf132236.odt |binary
 sw/qa/extras/uiwriter/uiwriter2.cxx   |   24 
 sw/source/core/layout/frmtool.cxx |   23 ---
 sw/source/core/layout/layhelp.hxx |1 +
 sw/source/core/text/xmldump.cxx   |6 ++
 sw/source/core/undo/undel.cxx |1 +
 6 files changed, 52 insertions(+), 3 deletions(-)

New commits:
commit ca8e04f1ab739e14288ab5e0be44723536b9ca4e
Author: Michael Stahl 
AuthorDate: Tue May 26 16:46:57 2020 +0200
Commit: Michael Stahl 
CommitDate: Wed May 27 19:18:26 2020 +0200

tdf#132236 sw_redlinehide: fix SwUndoDelete with sections even more

SwUndoDelete::UndoImpl may want to move something like this into the
nodes-array:

[   9]  0x6356fe0TextNode "",
[  10]  0x31cba00~DeletedNode ,
[  11]  0x64d8840TextNode "Introduction - xzn Overview Of 
KmneqxziTY\t3",
[  12]  0x64e9750TextNode "shell\t20",
[  13]  0x7a0f0a0~DeletedNode ,

The ~DeletedNode become end nodes of section nodes; in this case
m_nSectDiff != 0.

Don't skip these end nodes because in the above "Untitled 1.odt"
example, they are not necessarily consecutive.

Between the 1st and 2nd one a new SwSectionFrame must be created via the
outer section, so adapt InsertCnt_() to check for extra end nodes in the
range and do this.

(regression from 723728cd358693b8f4bc9d913541aa4479f2bd48)

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

diff --git a/sw/qa/extras/uiwriter/data2/tdf132236.odt 
b/sw/qa/extras/uiwriter/data2/tdf132236.odt
new file mode 100644
index ..f37c9befc095
Binary files /dev/null and b/sw/qa/extras/uiwriter/data2/tdf132236.odt differ
diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx 
b/sw/qa/extras/uiwriter/uiwriter2.cxx
index 13e53234b445..74f6c5e30c22 100644
--- a/sw/qa/extras/uiwriter/uiwriter2.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter2.cxx
@@ -289,6 +289,30 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, 
testRedlineInHiddenSection)
 CPPUNIT_ASSERT(pNode->GetNodes()[pNode->GetIndex() + 4]->IsEndNode());
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf132236)
+{
+load(DATA_DIRECTORY, "tdf132236.odt");
+
+SwXTextDocument* const pTextDoc = 
dynamic_cast(mxComponent.get());
+CPPUNIT_ASSERT(pTextDoc);
+
+// select everything and delete
+SwWrtShell* const pWrtShell(pTextDoc->GetDocShell()->GetWrtShell());
+pWrtShell->Down(true);
+pWrtShell->Down(true);
+pWrtShell->Down(true);
+pWrtShell->Delete();
+SwDoc* const pDoc(pWrtShell->GetDoc());
+sw::UndoManager& rUndoManager(pDoc->GetUndoManager());
+rUndoManager.Undo();
+
+// check that the text frames exist inside their sections
+xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+assertXPath(pXmlDoc, "/root/page[1]/body/section[1]/txt", 1);
+assertXPath(pXmlDoc, "/root/page[1]/body/section[2]/txt", 2);
+assertXPath(pXmlDoc, "/root/page[1]/body/txt", 1);
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf54819)
 {
 load(DATA_DIRECTORY, "tdf54819.fodt");
diff --git a/sw/source/core/layout/frmtool.cxx 
b/sw/source/core/layout/frmtool.cxx
index 01af928c3fe9..9253d7018d70 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -1478,7 +1478,23 @@ void InsertCnt_( SwLayoutFrame *pLay, SwDoc *pDoc,
 if( ( !pLay->IsInFootnote() || pSct->IsInFootnote() ) &&
 ( !pLay->IsInTab() || pSct->IsInTab() ) )
 {
-pActualSection.reset(new SwActualSection( nullptr, pSct, nullptr 
));
+pActualSection.reset(new SwActualSection(nullptr, pSct, 
pSct->GetSection()->GetFormat()->GetSectionNode()));
+// tdf#132236 for SwUndoDelete: find outer sections whose start
+// nodes aren't contained in the range but whose end nodes are,
+// because section frames may need to be created for them
+SwActualSection * pUpperSection(pActualSection.get());
+while (pUpperSection->GetSectionNode()->EndOfSectionIndex() < 
nEndIndex)
+{
+SwStartNode *const 
pStart(pUpperSection->GetSectionNode()->StartOfSectionNode());
+if (!pStart->IsSectionNode())
+{
+break;
+}
+// note: these don't have a section frame, check it in EndNode 
case!
+auto const pTmp(new SwActualSection(nullptr, nullptr, 
static_cast(pStart)));
+pUpperSection->SetUpper(pTmp);
+pUpperSection = pTmp;
+}
 OSL_ENSURE( !pLay->Lower() || !pLay->Lower()->IsColumnFrame(),
 "InsertCnt_: Wrong Call" );
 }
@@ -1800,7 +1816,7 @@ void InsertCnt_( SwLayoutFrame 

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

2020-04-15 Thread Michael Stahl (via logerrit)
 sw/qa/extras/ooxmlexport/ooxmlexport5.cxx |5 +--
 sw/source/filter/ww8/docxattributeoutput.cxx  |9 +
 sw/source/filter/ww8/docxexport.cxx   |   34 --
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |4 ++
 writerfilter/source/dmapper/SettingsTable.cxx |9 +
 writerfilter/source/dmapper/SettingsTable.hxx |1 
 6 files changed, 51 insertions(+), 11 deletions(-)

New commits:
commit 3cd3ae30217a80449799d7d9426c3756c572712e
Author: Michael Stahl 
AuthorDate: Tue Apr 14 18:10:53 2020 +0200
Commit: Michael Stahl 
CommitDate: Wed Apr 15 11:29:25 2020 +0200

writerfilter: DOCX import: import w:noLeading as AddExternalLeading

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

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 1e7f8a99e663..010cb3e3fe21 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -6654,6 +6654,10 @@ void DomainMapper_Impl::ApplySettingsTable()
 if( m_pSettingsTable->GetEmbedSystemFonts())
 xSettings->setPropertyValue( getPropertyName( 
PROP_EMBED_SYSTEM_FONTS ), uno::makeAny(true) );
 xSettings->setPropertyValue("AddParaTableSpacing", 
uno::makeAny(m_pSettingsTable->GetDoNotUseHTMLParagraphAutoSpacing()));
+if (m_pSettingsTable->GetNoLeading())
+{
+xSettings->setPropertyValue("AddExternalLeading", 
uno::makeAny(!m_pSettingsTable->GetNoLeading()));
+}
 if( m_pSettingsTable->GetProtectForm() )
 xSettings->setPropertyValue("ProtectForm", uno::makeAny( true 
));
 if( m_pSettingsTable->GetReadOnly() )
diff --git a/writerfilter/source/dmapper/SettingsTable.cxx 
b/writerfilter/source/dmapper/SettingsTable.cxx
index 303de47c8f71..81fadad6ac40 100644
--- a/writerfilter/source/dmapper/SettingsTable.cxx
+++ b/writerfilter/source/dmapper/SettingsTable.cxx
@@ -263,6 +263,7 @@ struct SettingsTable_Impl
 OUStringm_sRedlineProtectionKey;
 boolm_bReadOnly;
 boolm_bDisplayBackgroundShape;
+boolm_bNoLeading = false;
 
 uno::Sequence m_pThemeFontLangProps;
 
@@ -575,6 +576,9 @@ void SettingsTable::lcl_sprm(Sprm& rSprm)
 case NS_ooxml::LN_CT_Settings_displayBackgroundShape:
 m_pImpl->m_bDisplayBackgroundShape = nIntValue;
 break;
+case NS_ooxml::LN_CT_Compat_noLeading:
+m_pImpl->m_bNoLeading = nIntValue != 0;
+break;
 default:
 {
 #ifdef DBG_UTIL
@@ -851,6 +855,11 @@ bool SettingsTable::GetLongerSpaceSequence() const
 return m_pImpl->m_bLongerSpaceSequence;
 }
 
+bool SettingsTable::GetNoLeading() const
+{
+return m_pImpl->m_bNoLeading;
+}
+
 }//namespace dmapper
 } //namespace writerfilter
 
diff --git a/writerfilter/source/dmapper/SettingsTable.hxx 
b/writerfilter/source/dmapper/SettingsTable.hxx
index e8cbe8abaf6e..e058420c27db 100644
--- a/writerfilter/source/dmapper/SettingsTable.hxx
+++ b/writerfilter/source/dmapper/SettingsTable.hxx
@@ -77,6 +77,7 @@ class SettingsTable : public LoggedProperties, public 
LoggedTable
 bool GetProtectForm() const;
 bool GetReadOnly() const;
 bool GetLongerSpaceSequence() const;
+bool GetNoLeading() const;
 bool GetNoHyphenateCaps() const;
 sal_Int16 GetHypenationZone() const;
 
commit 968a7e3247169489d29cc7de0079eea12a663870
Author: Michael Stahl 
AuthorDate: Tue Apr 14 17:42:06 2020 +0200
Commit: Michael Stahl 
CommitDate: Wed Apr 15 11:29:15 2020 +0200

sw: DOCX export: export AddExternalLeading as w:noLeading

For 11pt Arial, can fit 59 paragraphs on a page vs. 57...

This is annoyingly complicated by the fact that Word 2013 ignores
w:noLeading element if compatibilityMode is 15.

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

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
index 95fcebbf9c42..ee4b35698533 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
@@ -1119,10 +1119,11 @@ DECLARE_OOXMLEXPORT_TEST(tdf106843, "tdf106843.fodt")
 assertXPath(pXmlSettings, "/w:settings/w:documentProtection", "edit",  
 "trackedChanges");
 assertXPath(pXmlSettings, "/w:settings/w:documentProtection", 
"enforcement","1");
 
-// LO intends to export a .docx format that is natively compatible 
with 2013.
+// LO intends to export a .docx format that is natively compatible 
with 2013
+// but this document has an implicitly 

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

2019-11-26 Thread Michael Stahl (via logerrit)
 sw/qa/core/data/ww8/pass/ofz19065.doc |binary
 sw/source/core/doc/docbm.cxx  |9 +
 sw/source/filter/ww8/ww8par5.cxx  |6 --
 sw/source/filter/xml/xmlexpit.cxx |8 +++-
 4 files changed, 12 insertions(+), 11 deletions(-)

New commits:
commit fbb3514aee8261211790b23586752d5be9ac2f34
Author: Michael Stahl 
AuthorDate: Mon Nov 25 15:51:24 2019 +0100
Commit: Caolán McNamara 
CommitDate: Tue Nov 26 10:01:13 2019 +0100

ofz#19065 sw: invalid fieldmarks created in SwWW8ImplReader::End_Field

The problem is that the check added in commit
06767a5394f1dfba71c4f0a2a07daa5664bdbd01 "sw: WW8: do not create
fieldmark with start in frame and end in body" doesn't work as well as
imagined; the CheckNodesRange will only check against mismatching
top-level and second-level (in the non-body-text top-levels)
sections, whereas in this case the start is in one table cell and the
end in the next one.

So replace that and move the check into MarkManager::makeMark(),
so other things than WW8 import are also checked.

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

diff --git a/sw/qa/core/data/ww8/pass/ofz19065.doc 
b/sw/qa/core/data/ww8/pass/ofz19065.doc
new file mode 100644
index ..a242f13bf8e6
Binary files /dev/null and b/sw/qa/core/data/ww8/pass/ofz19065.doc differ
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index dec1b3d58654..f736348480a5 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -583,6 +583,15 @@ namespace sw { namespace mark
 }
 
 if ((eType == MarkType::TEXT_FIELDMARK || eType == 
MarkType::DATE_FIELDMARK)
+&& (rPaM.GetPoint()->nNode.GetNode().StartOfSectionNode() != 
rPaM.GetMark()->nNode.GetNode().StartOfSectionNode()
+|| (pSepPos && 
rPaM.GetPoint()->nNode.GetNode().StartOfSectionNode() != 
pSepPos->nNode.GetNode().StartOfSectionNode(
+{
+SAL_WARN("sw.core", "MarkManager::makeMark(..)"
+" - invalid range on fieldmark, different nodes array 
sections");
+return nullptr;
+}
+
+if ((eType == MarkType::TEXT_FIELDMARK || eType == 
MarkType::DATE_FIELDMARK)
 // can't check for Copy - it asserts - but it's also obviously 
unnecessary
 && eMode == InsertMode::New
 && sw::mark::IsFieldmarkOverlap(rPaM))
diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx
index 39e13b8cac5d..e6f31bb0736a 100644
--- a/sw/source/filter/ww8/ww8par5.cxx
+++ b/sw/source/filter/ww8/ww8par5.cxx
@@ -533,12 +533,6 @@ sal_uInt16 SwWW8ImplReader::End_Field()
 case ww::eFORMTEXT:
 if (bUseEnhFields && m_pPaM!=nullptr && m_pPaM->GetPoint()!=nullptr) {
 SwPosition aEndPos = *m_pPaM->GetPoint();
-if (!::CheckNodesRange(m_aFieldStack.back().GetPtNode(),
-aEndPos.nNode, true))
-{   // example ofz7322-1.doc
-SAL_INFO("sw.ww8", "skipping field with invalid node range");
-break;
-}
 SwPaM aFieldPam( m_aFieldStack.back().GetPtNode(), 
m_aFieldStack.back().GetPtContent(), aEndPos.nNode, 
aEndPos.nContent.GetIndex());
 IDocumentMarkAccess* pMarksAccess = m_rDoc.getIDocumentMarkAccess( 
);
 IFieldmark *pFieldmark = pMarksAccess->makeFieldBookmark(
commit 85ed301feee92f799bcb9ddd54660a9f52ff5a2a
Author: Caolán McNamara 
AuthorDate: Sun Nov 24 19:27:09 2019 +
Commit: Caolán McNamara 
CommitDate: Tue Nov 26 10:00:31 2019 +0100

dynamic_cast followed by the same dynamic_cast

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

diff --git a/sw/source/filter/xml/xmlexpit.cxx 
b/sw/source/filter/xml/xmlexpit.cxx
index ab6ce1236e31..2c2391081b96 100644
--- a/sw/source/filter/xml/xmlexpit.cxx
+++ b/sw/source/filter/xml/xmlexpit.cxx
@@ -146,15 +146,13 @@ void SvXMLExportItemMapper::exportXML( const SvXMLExport& 
rExport,
 rAttrList.AddAttribute( sName, aValue );
 }
 }
-if( dynamic_cast( ) !=  nullptr )
+
+if (const SvXMLAttrContainerItem *pUnknown = dynamic_cast())
 {
 std::unique_ptr pNewNamespaceMap;
 const SvXMLNamespaceMap *pNamespaceMap = 
 
-const SvXMLAttrContainerItem *pUnknown =
-dynamic_cast(   );
-
-const sal_uInt16 nCount = pUnknown ? pUnknown->GetAttrCount() : 0;
+const sal_uInt16 nCount = pUnknown->GetAttrCount();
 for( sal_uInt16 i=0; i < nCount; i++ )
 {
 const OUString 

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

2019-11-19 Thread Michael Stahl (via logerrit)
 sw/qa/core/data/ww8/pass/ofz18554-1.doc |binary
 sw/qa/extras/ooxmlexport/data/tdf128889.fodt|   15 +++
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx  |   11 +
 sw/source/core/doc/DocumentContentOperationsManager.cxx |   32 +++-
 sw/source/core/doc/docbm.cxx|   10 +
 sw/source/core/inc/bookmrk.hxx  |3 +
 sw/source/core/undo/rolbck.cxx  |8 ++--
 sw/source/filter/ww8/attributeoutputbase.hxx|3 +
 sw/source/filter/ww8/docxattributeoutput.cxx|   21 --
 sw/source/filter/ww8/docxattributeoutput.hxx|6 ++-
 sw/source/filter/ww8/docxexport.cxx |4 +-
 sw/source/filter/ww8/rtfattributeoutput.cxx |3 +
 sw/source/filter/ww8/rtfattributeoutput.hxx |3 +
 sw/source/filter/ww8/rtfexport.cxx  |4 +-
 sw/source/filter/ww8/ww8atr.cxx |8 ++--
 sw/source/filter/ww8/ww8attributeoutput.hxx |2 -
 16 files changed, 103 insertions(+), 30 deletions(-)

New commits:
commit bd2ada701aad2c4e85d03cd8db68eaeae081d91c
Author: Michael Stahl 
AuthorDate: Tue Nov 19 15:39:33 2019 +0100
Commit: Caolán McNamara 
CommitDate: Tue Nov 19 22:18:30 2019 +0100

ofz#18554 sw: fix Null-dereference due to overlapping fieldmarks

The problem is that the WW8 import wants to set a fieldmark on a range
that contains only the CH_TXT_ATR_FIELDEND of another fieldmark:

(rr) p io_pDoc->GetNodes()[12]->m_Text.copy(33,10)
$30 = "\bÿÿÿ\001ÿÿÿ\001 "

MarkManager::makeMark() must check that a new fieldmark never overlaps
existing fieldmarks or meta-fields.

While at it, it looks like the test in
DocumentContentOperationsManager::DelFullPara() can't necessarily use
the passed rPam, because it obviously deletes entire nodes, but at
least SwRangeRedline::DelCopyOfSection() doesn't even set nContent
on rPam.

Also, the check in makeMark() triggers an assert in
CppunitTest_sw_uiwriter testTextFormFieldInsertion because
SwHistoryTextFieldmark::SetInDoc() was neglecting to subtract 1
from the end position for the CH_TXT_ATR_FIELDEND.

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

diff --git a/sw/qa/core/data/ww8/pass/ofz18554-1.doc 
b/sw/qa/core/data/ww8/pass/ofz18554-1.doc
new file mode 100644
index ..0a6b81d78b43
Binary files /dev/null and b/sw/qa/core/data/ww8/pass/ofz18554-1.doc differ
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx 
b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index 995e3dcfa482..3b9433619ae6 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -60,6 +60,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1796,6 +1797,16 @@ namespace //local functions originally from docfmt.cxx
 namespace sw
 {
 
+namespace mark
+{
+bool IsFieldmarkOverlap(SwPaM const& rPaM)
+{
+std::vector> Breaks;
+lcl_CalcBreaks(Breaks, rPaM);
+return !Breaks.empty();
+}
+}
+
 DocumentContentOperationsManager::DocumentContentOperationsManager( SwDoc& 
i_rSwdoc ) : m_rDoc( i_rSwdoc )
 {
 }
@@ -1947,9 +1958,16 @@ bool DocumentContentOperationsManager::DelFullPara( 
SwPaM& rPam )
 }
 
 {
-std::vector> Breaks;
-lcl_CalcBreaks(Breaks, rPam);
-if (!Breaks.empty())
+SwPaM temp(rPam, nullptr);
+if (SwTextNode *const pNode = 
temp.Start()->nNode.GetNode().GetTextNode())
+{ // rPam may not have nContent set but IsFieldmarkOverlap requires it
+pNode->MakeStartIndex(()->nContent);
+}
+if (SwTextNode *const pNode = 
temp.End()->nNode.GetNode().GetTextNode())
+{
+pNode->MakeEndIndex(()->nContent);
+}
+if (sw::mark::IsFieldmarkOverlap(temp))
 {   // a bit of a problem: we want to completely remove the nodes
 // but then how can the CH_TXT_ATR survive?
 return false;
@@ -2100,13 +2118,7 @@ bool DocumentContentOperationsManager::MoveRange( SwPaM& 
rPaM, SwPosition& rPos,
 if( !rPaM.HasMark() || *pStt >= *pEnd || (*pStt <= rPos && rPos < *pEnd))
 return false;
 
-#ifndef NDEBUG
-{
-std::vector> Breaks;
-lcl_CalcBreaks(Breaks, rPaM);
-assert(Breaks.empty()); // probably an invalid redline was created?
-}
-#endif
+assert(!sw::mark::IsFieldmarkOverlap(rPaM)); // probably an invalid 
redline was created?
 
 // Save the paragraph anchored Flys, so that they can be moved.
 SaveFlyArr aSaveFlyArr;
diff --git a/sw/source/core/doc/docbm.cxx 

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

2019-11-11 Thread László Németh (via logerrit)
 sw/qa/extras/rtfexport/data/tdf123703_compatible.rtf|   37 
+
 sw/qa/extras/rtfexport/data/tdf123703_stshfdbch.rtf |   31 
 sw/qa/extras/rtfexport/data/tdf128428_compatible_monospaced.rtf |   38 
++
 sw/qa/extras/rtfexport/data/tdf128428_monospaced.rtf|   33 
 sw/qa/extras/rtfexport/rtfexport3.cxx   |   29 +++
 sw/source/filter/ww8/wrtw8nds.cxx   |   11 --
 writerfilter/source/dmapper/DomainMapper_Impl.cxx   |   36 
+
 writerfilter/source/dmapper/SettingsTable.cxx   |   16 +++-
 writerfilter/source/dmapper/SettingsTable.hxx   |1 
 writerfilter/source/ooxml/model.xml |1 
 writerfilter/source/rtftok/rtfcontrolwords.hxx  |1 
 writerfilter/source/rtftok/rtfdispatchdestination.cxx   |3 
 writerfilter/source/rtftok/rtfdispatchvalue.cxx |6 +
 writerfilter/source/rtftok/rtfdocumentimpl.cxx  |6 +
 14 files changed, 223 insertions(+), 26 deletions(-)

New commits:
commit 24f17f0336badfbba276c1e6713a89b4f9bb7cb8
Author: László Németh 
AuthorDate: Mon Nov 11 10:05:12 2019 +0100
Commit: László Németh 
CommitDate: Mon Nov 11 11:38:36 2019 +0100

tdf#128428 RTF: clean-up for longer space sequence mode

Fix regressions from commit 24b04db5a63b57a74e58a7616091437ad68548ac
(tdf#123703 RTF import: fix length of space character sequence).

It seems, longer space sequence is an obsolete RTF-only feature, eg.
new RTF documents created in MSO don't use it, but old RTF documents
still keep their layout (only in RTF).

- Only old-style (without \stshfdbch) or compatible (\stshfdbch31505)
  RTF documents get longer space sequences using a one-time conversion;

- because Writer always exports old-style RTF documents, to avoid of
  enlargement of space sequences of new-style RTF documents later, RTF
  import doesn't modify the RTF documents saved in Writer (checking
  \generator);

- text in monospaced font "Courier New" doesn't get longer space
  sequence (despite its \prq2 (not monospaced) font setting).

Change-Id: I308ab06db57a2db5deec1d4c4573da3317cad8e9
Reviewed-on: https://gerrit.libreoffice.org/82145
Tested-by: Jenkins
Reviewed-by: László Németh 

diff --git a/sw/qa/extras/rtfexport/data/tdf123703_compatible.rtf 
b/sw/qa/extras/rtfexport/data/tdf123703_compatible.rtf
new file mode 100644
index ..3713b5fe54eb
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/tdf123703_compatible.rtf
@@ -0,0 +1,37 @@
+{\rtf1\adeflang1025\ansi\ansicpg1250\uc1\adeff31507\deff0\stshfdbch31505\stshfloch31506\stshfhich31506\stshfbi31507\deflang1038\deflangfe1038\themelang1038\themelangfe0\themelangcs0{\fonttbl{\f0\fbidi
 \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New 
Roman;}{\f2\fbidi \fmodern\fcharset0\fprq1{\*\panose 
02070309020205020404}Courier New;}
+{\f11\fbidi \fmodern\fcharset128\fprq1{\*\panose 02020609040205080304}MS 
Mincho{\*\falt \'82\'6c\'82\'72 \'96\'be\'92\'a9};}{\f11\fbidi 
\fmodern\fcharset128\fprq1{\*\panose 02020609040205080304}MS Mincho{\*\falt 
\'82\'6c\'82\'72 \'96\'be\'92\'a9};}
+{\f39\fbidi \fswiss\fcharset0\fprq2{\*\panose 
020f0502020204030204}Calibri;}{\f128\fbidi \fmodern\fcharset128\fprq1{\*\panose 
02020609040205080304}@MS Mincho;}{\flomajor\f31500\fbidi 
\froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}
+{\fdbmajor\f31501\fbidi \froman\fcharset0\fprq2{\*\panose 
02020603050405020304}Times New Roman;}{\fhimajor\f31502\fbidi 
\fswiss\fcharset0\fprq2{\*\panose 020f0302020204030204}Calibri Light;}
+{\fbimajor\f31503\fbidi \froman\fcharset0\fprq2{\*\panose 
02020603050405020304}Times New Roman;}{\flominor\f31504\fbidi 
\froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}
+{\fdbminor\f31505\fbidi \froman\fcharset0\fprq2{\*\panose 
02020603050405020304}Times New Roman;}{\fhiminor\f31506\fbidi 
\fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri;}
+{\fbiminor\f31507\fbidi \froman\fcharset0\fprq2{\*\panose 
02020603050405020304}Times New Roman;}{\f369\fbidi \froman\fcharset238\fprq2 
Times New Roman CE;}{\f370\fbidi \froman\fcharset204\fprq2 Times New Roman 
Cyr;}}
+word   
   word2\par
+word   
   word2\par
+word   
   word2\par
+word   
   word2\par
+word   
 

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

2019-10-23 Thread Michael Stahl (via logerrit)
 sw/qa/extras/ooxmlexport/ooxmlexport5.cxx |2 +-
 sw/qa/extras/ooxmlexport/ooxmlexport9.cxx |2 +-
 sw/source/filter/ww8/wrtw8nds.cxx |   21 +++--
 sw/source/filter/ww8/ww8par3.cxx  |5 +++--
 sw/source/filter/ww8/ww8par5.cxx  |1 +
 5 files changed, 25 insertions(+), 6 deletions(-)

New commits:
commit dd179e9c8f6f98268e204c0672be31bf008475cd
Author: Michael Stahl 
AuthorDate: Fri Oct 18 16:54:21 2019 +0200
Commit: Michael Stahl 
CommitDate: Wed Oct 23 13:08:39 2019 +0200

sw: WW8/RTF/DOCX export: handle CH_TXT_ATR_FIELDSEP

Move second part of the fieldmark export later, where the separator
dummy character is.

Somehow this may result in an additional empty run, but that shouldn't
matter, other than to a few tests.

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

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
index 99044821e1ee..14ba1cde9683 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
@@ -896,7 +896,7 @@ DECLARE_OOXMLEXPORT_TEST(testfdo83048, "fdo83048.docx")
 
 // Make sure Date is inside SDT tag.
 // This will happen only if right SDT properties are exported.
-assertXPathContent(pXmlDoc, 
"/w:ftr/w:sdt/w:sdtContent/w:p[1]/w:sdt/w:sdtContent/w:r[1]/w:t",
+assertXPathContent(pXmlDoc, 
"/w:ftr/w:sdt/w:sdtContent/w:p[1]/w:sdt/w:sdtContent/w:r[2]/w:t",
"1/2/2013");
 }
 
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index 2dda95ca0bce..ece282f437aa 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -1142,7 +1142,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf111964, "tdf111964.docx")
 return;
 // Unicode spaces that are not XML whitespace must not be trimmed
 const sal_Unicode sWSReference [] { 0x2002, 0x2002, 0x2002, 0x2002, 
0x2002, 0 };
-assertXPathContent(pXmlDoc, "/w:document/w:body/w:p/w:r[5]/w:t", 
sWSReference);
+assertXPathContent(pXmlDoc, "/w:document/w:body/w:p/w:r[6]/w:t", 
sWSReference);
 }
 
 DECLARE_OOXMLEXPORT_TEST(testWatermark, "watermark-shapetype.docx")
diff --git a/sw/source/filter/ww8/wrtw8nds.cxx 
b/sw/source/filter/ww8/wrtw8nds.cxx
index aa70daf65738..924ed9fbd5ee 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -256,11 +256,12 @@ sal_Int32 SwWW8AttrIter::SearchNext( sal_Int32 nStartPos )
 {
 ++fieldEndPos;
 }
+sal_Int32 fieldSepPos = aText.indexOf(CH_TXT_ATR_FIELDSEP, nStartPos);
 sal_Int32 fieldStartPos = aText.indexOf(CH_TXT_ATR_FIELDSTART, nStartPos);
 sal_Int32 formElementPos = aText.indexOf(CH_TXT_ATR_FORMELEMENT, 
nStartPos);
 
 const sal_Int32 pos = lcl_getMinPos(
-lcl_getMinPos( fieldEndPos, fieldStartPos ),
+lcl_getMinPos(lcl_getMinPos(fieldEndPos, fieldSepPos), fieldStartPos),
 formElementPos );
 
 sal_Int32 nMinPos = (pos>=0) ? pos : SAL_MAX_INT32;
@@ -2326,7 +2327,12 @@ void MSWordExportBase::OutputTextNode( SwTextNode& rNode 
)
 if ( !bTextAtr && nLen )
 {
 sal_Unicode ch = aStr[nCurrentPos];
-const sal_Int32 ofs = ( ch == CH_TXT_ATR_FIELDSTART || ch == 
CH_TXT_ATR_FIELDEND || ch == CH_TXT_ATR_FORMELEMENT? 1 : 0 );
+
+const sal_Int32 ofs = (ch == CH_TXT_ATR_FIELDSTART
+|| ch == CH_TXT_ATR_FIELDSEP
+|| ch == CH_TXT_ATR_FIELDEND
+|| ch == CH_TXT_ATR_FORMELEMENT)
+? 1 : 0;
 
 IDocumentMarkAccess* const pMarkAccess = 
m_pDoc->getIDocumentMarkAccess();
 if ( ch == CH_TXT_ATR_FIELDSTART )
@@ -2379,6 +2385,17 @@ void MSWordExportBase::OutputTextNode( SwTextNode& rNode 
)
 WriteFormData( *pFieldmark );
 else if (pFieldmark->GetFieldname() == ODF_HYPERLINK)
 WriteHyperlinkData( *pFieldmark );
+}
+}
+else if (ch == CH_TXT_ATR_FIELDSEP)
+{
+SwPosition aPosition(rNode, SwIndex(, nCurrentPos));
+// the innermost field is the correct one
+::sw::mark::IFieldmark const*const pFieldmark = 
pMarkAccess->getFieldmarkFor(aPosition);
+assert(pFieldmark);
+// DateFieldmark / ODF_FORMDATE is not a field...
+if (pFieldmark->GetFieldname() != ODF_FORMDATE)
+{
 OutputField( nullptr, lcl_getFieldId( pFieldmark ), 
OUString(), FieldFlags::CmdEnd );
 
 

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

2019-10-23 Thread Michael Stahl (via logerrit)
 sw/qa/extras/ooxmlexport/ooxmlexport12.cxx|2 
 sw/qa/extras/ooxmlexport/ooxmlexport9.cxx |2 
 sw/source/filter/ww8/wrtw8nds.cxx |   39 +-
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   79 +-
 4 files changed, 68 insertions(+), 54 deletions(-)

New commits:
commit 35b93ab6be79e5506248aea2f5b618db54e93c0f
Author: Michael Stahl 
AuthorDate: Mon Oct 14 18:17:24 2019 +0200
Commit: Michael Stahl 
CommitDate: Wed Oct 23 13:06:56 2019 +0200

sw: remove checks for invalid document model wrt fieldmarks...

... in MSWordExportBase::OutputTextNode() - better crash so we can fix
the bugs.

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

diff --git a/sw/source/filter/ww8/wrtw8nds.cxx 
b/sw/source/filter/ww8/wrtw8nds.cxx
index 4ad6d3a721ec..aa70daf65738 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -118,10 +118,8 @@ using namespace ::oox::vml;
 
 static OUString lcl_getFieldCode( const IFieldmark* pFieldmark )
 {
-OSL_ENSURE(pFieldmark!=nullptr, "where is my fieldmark???");
+assert(pFieldmark);
 
-if ( !pFieldmark)
-return OUString();
 if ( pFieldmark->GetFieldname( ) == ODF_FORMTEXT )
 return " FORMTEXT ";
 if ( pFieldmark->GetFieldname( ) == ODF_FORMDROPDOWN )
@@ -139,10 +137,10 @@ static OUString lcl_getFieldCode( const IFieldmark* 
pFieldmark )
 return pFieldmark->GetFieldname();
 }
 
-static ww::eField lcl_getFieldId( const IFieldmark* pFieldmark ) {
-OSL_ENSURE(pFieldmark!=nullptr, "where is my fieldmark???");
-if ( !pFieldmark )
-return ww::eUNKNOWN;
+static ww::eField lcl_getFieldId(const IFieldmark*const pFieldmark)
+{
+assert(pFieldmark);
+
 if ( pFieldmark->GetFieldname( ) == ODF_FORMTEXT )
 return ww::eFORMTEXT;
 if ( pFieldmark->GetFieldname( ) == ODF_FORMDROPDOWN )
@@ -2335,10 +2333,10 @@ void MSWordExportBase::OutputTextNode( SwTextNode& 
rNode )
 {
 SwPosition aPosition( rNode, SwIndex( , nCurrentPos 
) );
 ::sw::mark::IFieldmark const*const pFieldmark = 
pMarkAccess->getFieldmarkAt(aPosition);
-OSL_ENSURE( pFieldmark, "Looks like this doc is broken...; 
where is the Fieldmark for the FIELDSTART??" );
+assert(pFieldmark);
 
 // Date field is exported as content control, not as a 
simple field
-if(pFieldmark && pFieldmark->GetFieldname( ) == 
ODF_FORMDATE)
+if (pFieldmark->GetFieldname() == ODF_FORMDATE)
 {
 if(GetExportFormat() == 
MSWordExportBase::ExportFormat::DOCX) // supported by DOCX only
 {
@@ -2351,14 +2349,14 @@ void MSWordExportBase::OutputTextNode( SwTextNode& 
rNode )
 else
 {
 
-if ( pFieldmark && pFieldmark->GetFieldname() == 
ODF_FORMTEXT
+if (pFieldmark->GetFieldname() == ODF_FORMTEXT
  && GetExportFormat() != 
MSWordExportBase::ExportFormat::DOCX )
 {
AppendBookmark( pFieldmark->GetName() );
 }
 ww::eField eFieldId = lcl_getFieldId( pFieldmark );
 OUString sCode = lcl_getFieldCode( pFieldmark );
-if ( pFieldmark && pFieldmark->GetFieldname() == 
ODF_UNHANDLED )
+if (pFieldmark->GetFieldname() == ODF_UNHANDLED )
 {
 IFieldmark::parameter_map_t::const_iterator it = 
pFieldmark->GetParameters()->find( ODF_ID_PARAM );
 if ( it != pFieldmark->GetParameters()->end() )
@@ -2377,13 +2375,13 @@ void MSWordExportBase::OutputTextNode( SwTextNode& 
rNode )
 
 OutputField( nullptr, eFieldId, sCode, 
FieldFlags::Start | FieldFlags::CmdStart );
 
-if ( pFieldmark && pFieldmark->GetFieldname( ) == 
ODF_FORMTEXT)
+if (pFieldmark->GetFieldname() == ODF_FORMTEXT)
 WriteFormData( *pFieldmark );
-else if ( pFieldmark && pFieldmark->GetFieldname( ) == 
ODF_HYPERLINK )
+else if (pFieldmark->GetFieldname() == ODF_HYPERLINK)
 WriteHyperlinkData( *pFieldmark );
 OutputField( nullptr, lcl_getFieldId( pFieldmark ), 
OUString(), FieldFlags::CmdEnd );
 
-if ( pFieldmark && pFieldmark->GetFieldname() == 
ODF_UNHANDLED )
+if (pFieldmark->GetFieldname() == ODF_UNHANDLED)
 {
 // Check for the presence of a 

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

2019-10-23 Thread Michael Stahl (via logerrit)
 sw/qa/extras/globalfilter/globalfilter.cxx |8 ++--
 sw/source/core/crsr/bookmrk.cxx|   29 ++--
 sw/source/core/doc/docbm.cxx   |5 ++
 sw/source/core/inc/UndoBookmark.hxx|   28 +++
 sw/source/core/inc/rolbck.hxx  |8 +++-
 sw/source/core/undo/rolbck.cxx |   51 -
 sw/source/core/undo/unbkmk.cxx |   36 
 sw/source/uibase/shells/textfld.cxx|   10 +++--
 8 files changed, 132 insertions(+), 43 deletions(-)

New commits:
commit 12385f9e79e15b215c1d398b4bfb212ef1b23fb3
Author: Michael Stahl 
AuthorDate: Fri Oct 11 14:50:57 2019 +0200
Commit: Michael Stahl 
CommitDate: Wed Oct 23 13:01:11 2019 +0200

sw: fieldmark insert/delete Undo

SwHistoryTextFieldmark implementation doesn't work that well with its
hardcoded +5 etc. so reimplement that storing all 3 positions.

Add Undo classes for deletion as well, and use them automatically when
deleteMark() is called with Undo enabled.

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

diff --git a/sw/source/core/crsr/bookmrk.cxx b/sw/source/core/crsr/bookmrk.cxx
index 713d36d2d63d..7e514b7e18da 100644
--- a/sw/source/core/crsr/bookmrk.cxx
+++ b/sw/source/core/crsr/bookmrk.cxx
@@ -511,6 +511,12 @@ namespace sw { namespace mark
 
 void TextFieldmark::ReleaseDoc(SwDoc* const pDoc)
 {
+IDocumentUndoRedo & rIDUR(pDoc->GetIDocumentUndoRedo());
+if (rIDUR.DoesUndo())
+{
+rIDUR.AppendUndo(std::make_unique(*this));
+}
+::sw::UndoGuard const ug(rIDUR); // prevent SwUndoDeletes
 lcl_RemoveFieldMarks(this, pDoc, CH_TXT_ATR_FIELDSTART, 
CH_TXT_ATR_FIELDEND);
 }
 
@@ -540,6 +546,12 @@ namespace sw { namespace mark
 
 void NonTextFieldmark::ReleaseDoc(SwDoc* const pDoc)
 {
+IDocumentUndoRedo & rIDUR(pDoc->GetIDocumentUndoRedo());
+if (rIDUR.DoesUndo())
+{
+
rIDUR.AppendUndo(std::make_unique(*this));
+}
+::sw::UndoGuard const ug(rIDUR); // prevent SwUndoDeletes
 lcl_RemoveFieldMarks(this, pDoc,
 CH_TXT_ATR_FIELDSTART, CH_TXT_ATR_FORMELEMENT);
 }
@@ -656,6 +668,13 @@ namespace sw { namespace mark
 
 void DateFieldmark::ReleaseDoc(SwDoc* const pDoc)
 {
+IDocumentUndoRedo & rIDUR(pDoc->GetIDocumentUndoRedo());
+if (rIDUR.DoesUndo())
+{
+// TODO does this need a 3rd Undo class?
+rIDUR.AppendUndo(std::make_unique(*this));
+}
+::sw::UndoGuard const ug(rIDUR); // prevent SwUndoDeletes
 lcl_RemoveFieldMarks(this, pDoc, CH_TXT_ATR_FIELDSTART, 
CH_TXT_ATR_FIELDEND);
 }
 
diff --git a/sw/source/core/inc/UndoBookmark.hxx 
b/sw/source/core/inc/UndoBookmark.hxx
index 3e2017d0721d..ebaac8cd19e7 100644
--- a/sw/source/core/inc/UndoBookmark.hxx
+++ b/sw/source/core/inc/UndoBookmark.hxx
@@ -111,6 +111,20 @@ public:
 virtual void RedoImpl( ::sw::UndoRedoContext & ) override;
 };
 
+/// Handling undo / redo of checkbox and drop-down form field deletion
+class SwUndoDelNoTextFieldmark : public SwUndo
+{
+private:
+const std::unique_ptr m_pHistoryNoTextFieldmark;
+
+public:
+SwUndoDelNoTextFieldmark(const ::sw::mark::IFieldmark& rFieldmark);
+~SwUndoDelNoTextFieldmark();
+
+virtual void UndoImpl( ::sw::UndoRedoContext & ) override;
+virtual void RedoImpl( ::sw::UndoRedoContext & ) override;
+};
+
 /// Handling undo / redo of text form field insertion
 class SwUndoInsTextFieldmark : public SwUndo
 {
@@ -124,6 +138,20 @@ public:
 virtual void RedoImpl( ::sw::UndoRedoContext & ) override;
 };
 
+/// Handling undo / redo of text form field deletion
+class SwUndoDelTextFieldmark : public SwUndo
+{
+private:
+const std::unique_ptr m_pHistoryTextFieldmark;
+
+public:
+SwUndoDelTextFieldmark(const ::sw::mark::IFieldmark& rFieldmark);
+~SwUndoDelTextFieldmark();
+
+virtual void UndoImpl( ::sw::UndoRedoContext & ) override;
+virtual void RedoImpl( ::sw::UndoRedoContext & ) override;
+};
+
 #endif // INCLUDED_SW_SOURCE_CORE_INC_UNDOBOOKMARK_HXX
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/inc/rolbck.hxx b/sw/source/core/inc/rolbck.hxx
index 6fb81943af4d..91e9d85574b1 100644
--- a/sw/source/core/inc/rolbck.hxx
+++ b/sw/source/core/inc/rolbck.hxx
@@ -288,8 +288,12 @@ class SwHistoryTextFieldmark : public SwHistoryHint
 private:
 const OUString m_sName;
 const OUString m_sType;
-const sal_uLong m_nNode;
-const sal_Int32 m_nContent;
+const sal_uLong m_nStartNode;
+const sal_Int32 m_nStartContent;
+const sal_uLong m_nEndNode;
+const sal_Int32 m_nEndContent;
+/*const*/ sal_uLong m_nSepNode;
+/*const*/ 

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

2019-09-30 Thread Tünde Tóth (via logerrit)
 sw/qa/extras/ooxmlexport/data/internal_hyperlink_region.odt |binary
 sw/qa/extras/ooxmlexport/data/internal_hyperlink_table.odt  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport13.cxx  |   22 +
 sw/source/filter/ww8/docxattributeoutput.cxx|7 --
 sw/source/filter/ww8/wrtw8nds.cxx   |3 -
 sw/source/filter/ww8/wrtww8.cxx |   29 
 6 files changed, 55 insertions(+), 6 deletions(-)

New commits:
commit 5d5ec2a1ffe3862cc9689e667cebf1f9c1a5f330
Author: Tünde Tóth 
AuthorDate: Wed Sep 25 12:10:16 2019 +0200
Commit: László Németh 
CommitDate: Mon Sep 30 13:00:51 2019 +0200

tdf#127735 DOCX export: fix internal hyperlinks to table target

Hyperlinks with internal table targets didn't work in Microsoft Word.

Change-Id: I93b2b38d3d0196939f7aa5021811d2a9d5e482f5
Reviewed-on: https://gerrit.libreoffice.org/79524
Tested-by: Jenkins
Reviewed-by: László Németh 

diff --git a/sw/qa/extras/ooxmlexport/data/internal_hyperlink_table.odt 
b/sw/qa/extras/ooxmlexport/data/internal_hyperlink_table.odt
new file mode 100644
index ..f3144a30e5a3
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/internal_hyperlink_table.odt differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
index d13b7bf90144..ec8635943f4d 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
@@ -804,6 +804,17 @@ DECLARE_OOXMLEXPORT_TEST(testTdf127734, 
"internal_hyperlink_region.odt")
 CPPUNIT_ASSERT_EQUAL(anchor, bookmarkName);
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf127735, "internal_hyperlink_table.odt")
+{
+xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+if (!pXmlDoc)
+return;
+
+OUString bookmarkName = getXPath(pXmlDoc, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:p/w:bookmarkStart", "name");
+OUString anchor = getXPath(pXmlDoc, 
"/w:document/w:body/w:p[1]/w:hyperlink", "anchor");
+CPPUNIT_ASSERT_EQUAL(anchor, bookmarkName);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index f9f7c3c94c14..79d82b72c7a6 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -2914,11 +2914,8 @@ bool DocxAttributeOutput::StartURL( const OUString& 
rUrl, const OUString& rTarge
 }
 }
 }
-if (sMark.indexOf(' ') != -1 && !sMark.endsWith("|table"))
-{
-// Spaces are prohibited in bookmark name.
-sMark = sMark.replace(' ', '_');
-}
+// Spaces are prohibited in bookmark name.
+sMark = sMark.replace(' ', '_');
 m_pHyperlinkAttrList->add( FSNS( XML_w, XML_anchor ),
 OUStringToOString( sMark, RTL_TEXTENCODING_UTF8 ).getStr( 
) );
 }
diff --git a/sw/source/filter/ww8/wrtw8nds.cxx 
b/sw/source/filter/ww8/wrtw8nds.cxx
index b80f94656704..b722b22621d3 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -917,7 +917,8 @@ bool AttributeOutputBase::AnalyzeURL( const OUString& rUrl, 
const OUString& /*rT
 OUString());
 
 // #i21465# Only interested in outline references
-if ( !sRefType.isEmpty() && (sRefType == "outline" || sRefType == 
"graphic" || sRefType == "frame" || sRefType == "ole" || sRefType == "region") )
+if ( !sRefType.isEmpty() &&
+(sRefType == "outline" || sRefType == "graphic" || sRefType == 
"frame" || sRefType == "ole" || sRefType == "region" || sRefType == "table") )
 {
 for ( const auto& rBookmarkPair : GetExport().m_aImplicitBookmarks 
)
 {
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index fcb168f68bf1..542d24d7a64b 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -3130,6 +3130,20 @@ void MSWordExportBase::AddLinkTarget(const OUString& 
rURL)
 }
 }
 }
+else if( sCmp == "table" )
+{
+OUString aName(BookmarkToWriter(aURL.copy(0, nPos)));
+const SwTable* pTable = 
SwTable::FindTable(m_pDoc->FindTableFormatByName(aName));
+if (pTable)
+{
+SwTableNode* pTableNode = 
const_cast(pTable->GetTabSortBoxes()[1]->GetSttNd()->FindTableNode());
+if (pTableNode)
+{
+nIdx = pTableNode->GetIndex() + 2;
+noBookmark = true;
+}
+}
+}
 if (noBookmark)
 {
 aBookmarkPair aImplicitBookmark;
commit 7046846f840fb087cdda677a0e29461adca843aa
Author: Tünde Tóth 
AuthorDate: Wed Sep 25 10:23:52 2019 +0200
Commit: László Németh 

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

2019-07-11 Thread Tamás Zolnai (via logerrit)
 sw/qa/extras/ooxmlexport/ooxmlexport4.cxx|4 ++--
 sw/qa/extras/ooxmlexport/ooxmlexport8.cxx|8 
 sw/source/filter/ww8/docxattributeoutput.cxx |5 -
 writerfilter/source/dmapper/SdtHelper.cxx|5 -
 4 files changed, 14 insertions(+), 8 deletions(-)

New commits:
commit 6c256a1235f1a2ac3536d152edc8c3bee9b15022
Author: Tamás Zolnai 
AuthorDate: Wed Jul 3 19:21:35 2019 +0200
Commit: Tamás Zolnai 
CommitDate: Fri Jul 12 06:11:47 2019 +0200

MSForms: DOCX filter: reenable passing test

Change-Id: I566a65fa4ece6500128ceeb497c01f1c6e38470c
Reviewed-on: https://gerrit.libreoffice.org/75455
Tested-by: Jenkins
Reviewed-by: Tamás Zolnai 

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
index 2d717f106b54..0ab2ee04f42c 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
@@ -527,21 +527,21 @@ DECLARE_OOXMLEXPORT_TEST(testN780563, "n780563.docx")
 CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTables->getCount( ));
 }
 
-/*DECLARE_OOXMLEXPORT_TEST(testN780853, "n780853.docx")
-{*/
+DECLARE_OOXMLEXPORT_TEST(testN780853, "n780853.docx")
+{
 /*
  * The problem was that the table was not imported.
  *
  * xray ThisComponent.TextTables.Count 'was 0
  */
-/*uno::Reference 
xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
+uno::Reference xTextTablesSupplier(mxComponent, 
uno::UNO_QUERY);
 uno::Reference 
xIndexAccess(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
 CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount());
 
 //tdf#102619 - I would have expected this to be "Standard", but MSO 
2013/2010/2003 all give FollowStyle==Date
 uno::Reference< beans::XPropertySet > 
properties(getStyles("ParagraphStyles")->getByName("Date"), uno::UNO_QUERY);
 CPPUNIT_ASSERT_EQUAL(OUString("Date"), getProperty(properties, 
"FollowStyle"));
-}*/
+}
 
 DECLARE_OOXMLEXPORT_TEST(testN780843, "n780843.docx")
 {
commit 9c2feb75a6104d4376cccb157244dd7f6e88968a
Author: Tamás Zolnai 
AuthorDate: Wed Jul 3 14:43:54 2019 +0200
Commit: Tamás Zolnai 
CommitDate: Fri Jul 12 06:11:25 2019 +0200

MSForms: DOCX filter: handle date formats with quotation marks.

Change-Id: I61cc6d47200acdd55f147b4f1829330dec8562a0
Reviewed-on: https://gerrit.libreoffice.org/75454
Reviewed-by: Tamás Zolnai 
Tested-by: Tamás Zolnai 

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
index c6a3d05312fc..8d1d58986ddb 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
@@ -662,7 +662,7 @@ DECLARE_OOXMLEXPORT_TEST(testTableCurruption, 
"tableCurrupt.docx")
 CPPUNIT_ASSERT_EQUAL(sal_uInt32(0), aHeaderBottomBorder.LineWidth);
 }
 
-/*DECLARE_OOXMLEXPORT_TEST(testDateControl, "date-control.docx")
+DECLARE_OOXMLEXPORT_TEST(testDateControl, "date-control.docx")
 {
 // check XML
 xmlDocPtr pXmlDoc = parseExport("word/document.xml");
@@ -672,7 +672,7 @@ DECLARE_OOXMLEXPORT_TEST(testTableCurruption, 
"tableCurrupt.docx")
 assertXPath(pXmlDoc, 
"/w:document/w:body/w:p/w:sdt/w:sdtPr/w:date/w:dateFormat", "val", ", dd' 
de '' de '");
 assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:sdt/w:sdtPr/w:date/w:lid", 
"val", "es-ES");
 assertXPathContent(pXmlDoc, 
"/w:document/w:body/w:p/w:sdt/w:sdtContent/w:r/w:t", u"mi\u00E9rcoles, 05 de 
marzo de 2014");
-}*/
+}
 
 DECLARE_OOXMLEXPORT_TEST(test_OpeningBrace, "2120112713_OpenBrace.docx")
 {
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 82c5c30896ea..68d2e120bf5b 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -1891,8 +1891,11 @@ void DocxAttributeOutput::WriteFormDate(const OUString& 
sCurrentDate, const OUSt
 else
 m_pSerializer->startElementNS(XML_w, XML_date);
 
+OString sUTF8DateFormat = sDateFormat.toUtf8();
+// Replace quotation mark used for marking static strings in date format
+sUTF8DateFormat = sUTF8DateFormat.replaceAll("\"", "'");
 m_pSerializer->singleElementNS(XML_w, XML_dateFormat,
-   FSNS(XML_w, XML_val), sDateFormat.toUtf8());
+   FSNS(XML_w, XML_val), sUTF8DateFormat);
 m_pSerializer->singleElementNS(XML_w, XML_lid,
FSNS(XML_w, XML_val), sLang.toUtf8());
 m_pSerializer->singleElementNS(XML_w, XML_storeMappedDataAs,
diff --git a/writerfilter/source/dmapper/SdtHelper.cxx 
b/writerfilter/source/dmapper/SdtHelper.cxx
index c55ceaec0d65..5ba2126bc808 100644
--- a/writerfilter/source/dmapper/SdtHelper.cxx
+++ b/writerfilter/source/dmapper/SdtHelper.cxx
@@ -122,7 +122,10 @@ void SdtHelper::createDateContentControl()
 uno::Reference xNameCont = 

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

2019-07-11 Thread Tamás Zolnai (via logerrit)
 sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx |4 +-
 sw/source/core/crsr/DateFormFieldButton.cxx   |   39 ++--
 sw/source/core/text/itrform2.cxx  |   42 --
 sw/source/filter/ww8/docxattributeoutput.cxx  |   39 ++--
 sw/source/ui/fldui/DateFormFieldDialog.cxx|   25 ---
 5 files changed, 90 insertions(+), 59 deletions(-)

New commits:
commit 1e6b8e5c2a42b2ca35c963bbbe83f3e2e817ff50
Author: Tamás Zolnai 
AuthorDate: Mon Jul 1 13:45:09 2019 +0200
Commit: Tamás Zolnai 
CommitDate: Fri Jul 12 05:53:28 2019 +0200

MSForms: date field converions: better error handling

Change-Id: Ia518c7c50079e443ddf135f1c32c5c39d2c85552
Reviewed-on: https://gerrit.libreoffice.org/75449
Reviewed-by: Tamás Zolnai 
Tested-by: Tamás Zolnai 

diff --git a/sw/source/core/crsr/DateFormFieldButton.cxx 
b/sw/source/core/crsr/DateFormFieldButton.cxx
index 19dceb971bcc..5927d6a3c5e8 100644
--- a/sw/source/core/crsr/DateFormFieldButton.cxx
+++ b/sw/source/core/crsr/DateFormFieldButton.cxx
@@ -57,22 +57,26 @@ SwDatePickerDialog::SwDatePickerDialog(SwEditWin* parent, 
sw::mark::IFieldmark*
 OUString sDateString;
 pResult->second >>= sDateString;
 
-double dCurrentDate = 0;
 sal_uInt32 nFormat = 
m_pNumberFormatter->GetEntryKey(ODF_FORMDATE_CURRENTDATE_FORMAT,
  
ODF_FORMDATE_CURRENTDATE_LANGUAGE);
+bool bValidFormat = nFormat != NUMBERFORMAT_ENTRY_NOT_FOUND;
 if (nFormat == NUMBERFORMAT_ENTRY_NOT_FOUND)
 {
 sal_Int32 nCheckPos = 0;
 SvNumFormatType nType;
 OUString sFormat = ODF_FORMDATE_CURRENTDATE_FORMAT;
-m_pNumberFormatter->PutEntry(sFormat, nCheckPos, nType, 
nFormat,
- 
ODF_FORMDATE_CURRENTDATE_LANGUAGE);
+bValidFormat = m_pNumberFormatter->PutEntry(sFormat, 
nCheckPos, nType, nFormat,
+
ODF_FORMDATE_CURRENTDATE_LANGUAGE);
 }
 
-m_pNumberFormatter->IsNumberFormat(sDateString, nFormat, 
dCurrentDate);
+if (bValidFormat)
+{
+double dCurrentDate = 0;
+m_pNumberFormatter->IsNumberFormat(sDateString, nFormat, 
dCurrentDate);
 
-const Date& rNullDate = m_pNumberFormatter->GetNullDate();
-m_pCalendar->SetCurDate(rNullDate + sal_Int32(dCurrentDate));
+const Date& rNullDate = m_pNumberFormatter->GetNullDate();
+m_pCalendar->SetCurDate(rNullDate + sal_Int32(dCurrentDate));
+}
 }
 }
 m_pCalendar->SetSelectHdl(LINK(this, SwDatePickerDialog, ImplSelectHdl));
@@ -95,26 +99,31 @@ IMPL_LINK(SwDatePickerDialog, ImplSelectHdl, Calendar*, 
pCalendar, void)
 {
 if (m_pFieldmark != nullptr)
 {
-Color* pCol = nullptr;
-OUString sOutput;
 sal_uInt32 nFormat = 
m_pNumberFormatter->GetEntryKey(ODF_FORMDATE_CURRENTDATE_FORMAT,
  
ODF_FORMDATE_CURRENTDATE_LANGUAGE);
+bool bValidFormat = nFormat != NUMBERFORMAT_ENTRY_NOT_FOUND;
 if (nFormat == NUMBERFORMAT_ENTRY_NOT_FOUND)
 {
 sal_Int32 nCheckPos = 0;
 SvNumFormatType nType;
 OUString sFormat = ODF_FORMDATE_CURRENTDATE_FORMAT;
-m_pNumberFormatter->PutEntry(sFormat, nCheckPos, nType, 
nFormat,
- 
ODF_FORMDATE_CURRENTDATE_LANGUAGE);
+bValidFormat = m_pNumberFormatter->PutEntry(sFormat, 
nCheckPos, nType, nFormat,
+
ODF_FORMDATE_CURRENTDATE_LANGUAGE);
 }
 
-const Date& rNullDate = m_pNumberFormatter->GetNullDate();
-double dDate = pCalendar->GetFirstSelectedDate() - rNullDate;
+if (bValidFormat)
+{
+Color* pCol = nullptr;
+OUString sOutput;
 
-m_pNumberFormatter->GetOutputString(dDate, nFormat, sOutput, 
, false);
+const Date& rNullDate = m_pNumberFormatter->GetNullDate();
+double dDate = pCalendar->GetFirstSelectedDate() - rNullDate;
 
-sw::mark::IFieldmark::parameter_map_t* pParameters = 
m_pFieldmark->GetParameters();
-(*pParameters)[ODF_FORMDATE_CURRENTDATE] <<= sOutput;
+m_pNumberFormatter->GetOutputString(dDate, nFormat, sOutput, 
, false);
+
+sw::mark::IFieldmark::parameter_map_t* pParameters = 
m_pFieldmark->GetParameters();
+(*pParameters)[ODF_FORMDATE_CURRENTDATE] <<= sOutput;
+}
 }
 EndPopupMode();
 }
diff --git 

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

2019-07-11 Thread Tamás Zolnai (via logerrit)
 sw/qa/extras/globalfilter/data/date_form_field.odt |binary
 sw/qa/extras/globalfilter/globalfilter.cxx |   97 +
 sw/source/core/doc/docbm.cxx   |6 -
 sw/source/filter/ww8/docxattributeoutput.cxx   |   93 
 sw/source/filter/ww8/docxattributeoutput.hxx   |2 
 sw/source/filter/ww8/fields.hxx|3 
 sw/source/filter/ww8/wrtw8nds.cxx  |   40 +---
 xmloff/source/text/XMLTextMarkImportContext.cxx|5 -
 8 files changed, 228 insertions(+), 18 deletions(-)

New commits:
commit 865bfe5cc95c11ab7273bd3ac74cd4f4bd9e097e
Author: Tamás Zolnai 
AuthorDate: Fri Jun 21 20:40:27 2019 +0200
Commit: Tamás Zolnai 
CommitDate: Fri Jul 12 03:17:36 2019 +0200

MSForms: DOCX export of date content control

Change-Id: I546af6d552e5e3801925285d0095fc8502896a15
Reviewed-on: https://gerrit.libreoffice.org/75446
Tested-by: Jenkins
Reviewed-by: Tamás Zolnai 

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index e5167a264f41..0ccf7001c0e1 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -239,6 +239,7 @@ public:
 m_pSerializer->endElementNS( XML_w, XML_checkBox );
 writeFinish();
 }
+
 void WriteFormText(  const OUString& rName,
  const OUString& rEntryMacro,
  const OUString& rExitMacro,
@@ -1877,6 +1878,84 @@ void DocxAttributeOutput::WriteFFData(  const 
FieldInfos& rInfos )
 }
 }
 
+void DocxAttributeOutput::WriteFormDate(const OUString& sCurrentDate, const 
OUString& sDateFormat, const OUString& sLang)
+{
+m_pSerializer->startElementNS(XML_w, XML_sdt);
+m_pSerializer->startElementNS(XML_w, XML_sdtPr);
+
+if (!sCurrentDate.isEmpty())
+{
+OString sDate = sCurrentDate.toUtf8() + "T00:00:00Z";
+m_pSerializer->startElementNS(XML_w, XML_date, FSNS(XML_w, 
XML_fullDate), sDate);
+}
+else
+m_pSerializer->startElementNS(XML_w, XML_date);
+
+m_pSerializer->singleElementNS(XML_w, XML_dateFormat,
+   FSNS(XML_w, XML_val), sDateFormat.toUtf8());
+m_pSerializer->singleElementNS(XML_w, XML_lid,
+   FSNS(XML_w, XML_val), sLang.toUtf8());
+m_pSerializer->singleElementNS(XML_w, XML_storeMappedDataAs,
+   FSNS(XML_w, XML_val), "dateTime");
+m_pSerializer->singleElementNS(XML_w, XML_calendar,
+   FSNS(XML_w, XML_val), "gregorian");
+
+m_pSerializer->endElementNS(XML_w, XML_date);
+m_pSerializer->endElementNS(XML_w, XML_sdtPr);
+
+m_pSerializer->startElementNS(XML_w, XML_sdtContent);
+m_pSerializer->startElementNS(XML_w, XML_r);
+
+if (!sCurrentDate.isEmpty())
+{
+// Convert the current date to the right format
+if (!sCurrentDate.isEmpty())
+{
+SvNumberFormatter* pFormatter = 
m_rExport.m_pDoc->GetNumberFormatter();
+
+double dCurrentDate = 0.0;
+// First get the date internal double representation
+sal_uInt32 nFormat = 
pFormatter->GetEntryKey(ODF_FORMDATE_CURRENTDATE_FORMAT, 
ODF_FORMDATE_CURRENTDATE_LANGUAGE);if (nFormat == 
NUMBERFORMAT_ENTRY_NOT_FOUND)
+if (nFormat == NUMBERFORMAT_ENTRY_NOT_FOUND)
+{
+sal_Int32 nCheckPos = 0;
+SvNumFormatType nType;
+OUString sFormat = ODF_FORMDATE_CURRENTDATE_FORMAT;
+pFormatter->PutEntry(sFormat,
+ nCheckPos,
+ nType,
+ nFormat,
+ ODF_FORMDATE_CURRENTDATE_LANGUAGE);
+}
+pFormatter->IsNumberFormat(sCurrentDate, nFormat, dCurrentDate);
+
+// Then convert the date to a fromatter string
+OUString sOutput;
+Color* pCol = nullptr;
+nFormat = pFormatter->GetEntryKey(sDateFormat, 
LanguageTag(sLang).getLanguageType());
+if (nFormat == NUMBERFORMAT_ENTRY_NOT_FOUND)
+{
+sal_Int32 nCheckPos = 0;
+SvNumFormatType nType;
+OUString sNonConstDateFormat = sDateFormat;
+pFormatter->PutEntry(sNonConstDateFormat,
+ nCheckPos,
+ nType,
+ nFormat,
+ LanguageTag(sLang).getLanguageType());
+}
+pFormatter->GetOutputString(dCurrentDate, nFormat, sOutput, , 
false);
+
+RunText(sOutput);
+}
+}
+
+m_pSerializer->endElementNS(XML_w, XML_r);
+m_pSerializer->endElementNS(XML_w, XML_sdtContent);
+
+

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

2018-12-18 Thread Libreoffice Gerrit user
 sw/UIConfig_swriter.mk  |1 
 sw/qa/unit/data/sw-dialogs-test.txt |1 
 sw/qa/unit/data/sw-dialogs-test_2.txt   |1 
 sw/source/core/doc/DocumentContentOperationsManager.cxx |   16 +++
 sw/source/core/doc/DocumentRedlineManager.cxx   |   22 --
 sw/source/core/doc/docnum.cxx   |7 +--
 sw/source/core/inc/DocumentRedlineManager.hxx   |3 -
 sw/uiconfig/swriter/ui/queryshowchangesdialog.ui|   35 
 8 files changed, 12 insertions(+), 74 deletions(-)

New commits:
commit 866f10e75ddcd9dcfa327d02f587a1f322e6b6b5
Author: Thorsten Behrens 
AuthorDate: Tue Dec 18 00:36:24 2018 +0100
Commit: Michael Stahl 
CommitDate: Tue Dec 18 20:43:38 2018 +0100

sw_redlinehide: fix tdf#113479 by removing nag dialog

No need to suggest showing redlines beyond 250 changes anymore.

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

diff --git a/sw/UIConfig_swriter.mk b/sw/UIConfig_swriter.mk
index 37dffed460ed..bba8c908e805 100644
--- a/sw/UIConfig_swriter.mk
+++ b/sw/UIConfig_swriter.mk
@@ -198,7 +198,6 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/swriter,\
sw/uiconfig/swriter/ui/queryredlinedialog \
sw/uiconfig/swriter/ui/queryrotateintostandarddialog \
sw/uiconfig/swriter/ui/querysavelabeldialog \
-   sw/uiconfig/swriter/ui/queryshowchangesdialog \
sw/uiconfig/swriter/ui/mailmerge \
sw/uiconfig/swriter/ui/managechangessidebar \
sw/uiconfig/swriter/ui/mmaddressblockpage \
diff --git a/sw/qa/unit/data/sw-dialogs-test.txt 
b/sw/qa/unit/data/sw-dialogs-test.txt
index 931a40c09c28..54fa2761b575 100644
--- a/sw/qa/unit/data/sw-dialogs-test.txt
+++ b/sw/qa/unit/data/sw-dialogs-test.txt
@@ -163,7 +163,6 @@ modules/swriter/ui/querycontinueenddialog.ui
 modules/swriter/ui/querydefaultcompatdialog.ui
 modules/swriter/ui/queryrotateintostandarddialog.ui
 modules/swriter/ui/querysavelabeldialog.ui
-modules/swriter/ui/queryshowchangesdialog.ui
 modules/swriter/ui/renameautotextdialog.ui
 modules/swriter/ui/renameentrydialog.ui
 modules/swriter/ui/renameobjectdialog.ui
diff --git a/sw/qa/unit/data/sw-dialogs-test_2.txt 
b/sw/qa/unit/data/sw-dialogs-test_2.txt
index 797c410136dd..a36bbdca3dae 100644
--- a/sw/qa/unit/data/sw-dialogs-test_2.txt
+++ b/sw/qa/unit/data/sw-dialogs-test_2.txt
@@ -32,7 +32,6 @@ modules/swriter/ui/querycontinueenddialog.ui
 modules/swriter/ui/querydefaultcompatdialog.ui
 modules/swriter/ui/queryrotateintostandarddialog.ui
 modules/swriter/ui/querysavelabeldialog.ui
-modules/swriter/ui/queryshowchangesdialog.ui
 modules/swriter/ui/renameautotextdialog.ui
 modules/swriter/ui/renameentrydialog.ui
 modules/swriter/ui/renameobjectdialog.ui
diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx 
b/sw/source/core/doc/DocumentRedlineManager.cxx
index b4472e80c3a0..57b70c9ce3c5 100644
--- a/sw/source/core/doc/DocumentRedlineManager.cxx
+++ b/sw/source/core/doc/DocumentRedlineManager.cxx
@@ -800,7 +800,6 @@ DocumentRedlineManager::DocumentRedlineManager(SwDoc& 
i_rSwdoc)
 , mpRedlineTable(new SwRedlineTable)
 , mpExtraRedlineTable(new SwExtraRedlineTable)
 , mbIsRedlineMove(false)
-, mbReadlineChecked(false)
 , mnAutoFormatRedlnCommentNo(0)
 {
 }
@@ -2981,27 +2980,6 @@ void 
DocumentRedlineManager::SetAutoFormatRedlineComment( const OUString* pText,
 mnAutoFormatRedlnCommentNo = nSeqNo;
 }
 
-#define MAX_REDLINE_COUNT   250
-
-void DocumentRedlineManager::checkRedlining(RedlineFlags& _rReadlineMode)
-{
-const SwRedlineTable& rRedlineTable = GetRedlineTable();
-SwEditShell* pEditShell = m_rDoc.GetEditShell();
-vcl::Window* pParent = pEditShell ? pEditShell->GetWin() : nullptr;
-if ( pParent && !mbReadlineChecked && rRedlineTable.size() > 
MAX_REDLINE_COUNT
-&& ((_rReadlineMode & RedlineFlags::ShowDelete) != 
RedlineFlags::ShowDelete) )
-{
-std::unique_ptr 
xBuilder(Application::CreateBuilder(pParent->GetFrameWeld(), 
"modules/swriter/ui/queryshowchangesdialog.ui"));
-std::unique_ptr 
xQuery(xBuilder->weld_message_dialog("QueryShowChangesDialog"));
-sal_uInt16 nResult = xQuery->run();
-mbReadlineChecked = true;
-if ( nResult == RET_YES )
-{
-_rReadlineMode |= RedlineFlags::ShowInsert | 
RedlineFlags::ShowDelete;
-}
-}
-}
-
 DocumentRedlineManager::~DocumentRedlineManager()
 {
 }
diff --git a/sw/source/core/inc/DocumentRedlineManager.hxx 
b/sw/source/core/inc/DocumentRedlineManager.hxx
index c25abf25d394..8412e9a57c04 100644
--- a/sw/source/core/inc/DocumentRedlineManager.hxx
+++ b/sw/source/core/inc/DocumentRedlineManager.hxx
@@ -124,8 +124,6 @@ public:
  Sequence number is for conjoining of Redlines by the UI. */
 void SetAutoFormatRedlineComment( 

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

2018-02-02 Thread Michael Stahl
 sw/qa/extras/ooxmlexport/ooxmlexport10.cxx |3 +++
 sw/source/core/bastyp/swcache.cxx  |   23 +--
 2 files changed, 4 insertions(+), 22 deletions(-)

New commits:
commit c7f74bbab4c666a8b3b865dbd58b3666f1f63052
Author: Michael Stahl 
Date:   Fri Feb 2 15:50:19 2018 +0100

sw: disable ooxmlexport testWatermark on WNT

This one tends to fail quite a bit in CI builds, at least on Windows,
most recently in

https://tinderbox.libreoffice.org/cgi-bin/gunzip.cgi?tree=MASTER=1517580416.5910

Change-Id: I243b317fb27c51d06fbddf085713e51734eae27a

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
index 4451e06148f1..45af79c763f5 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
@@ -1782,8 +1782,11 @@ DECLARE_OOXMLEXPORT_TEST(testWatermark, "watermark.docx")
 sal_Int32 nDifference = 5150 - nHeight;
 std::stringstream ss;
 ss << "Difference: " << nDifference << " TotalHeight: " << nHeight;
+#ifndef _WIN32
+// FIXME why does this sometimes fail?
 CPPUNIT_ASSERT_MESSAGE(ss.str(), nDifference <= 4);
 CPPUNIT_ASSERT_MESSAGE(ss.str(), nDifference >= -4);
+#endif
 }
 
 DECLARE_OOXMLEXPORT_TEST(testWatermarkTrim, "tdf114308.docx")
commit 1e9716fded2ee81f414b12385393b90867dfc86e
Author: Michael Stahl 
Date:   Fri Feb 2 15:30:20 2018 +0100

sw: remove very dubious DBG_UTIL code

This looks like some defensive programming to avoid a crash only in
DBG_UTIL mode, which is a pretty moronic thing to want to do.

Change-Id: I93c791a76cf9114359be3fef6b604c86ec49da51

diff --git a/sw/source/core/bastyp/swcache.cxx 
b/sw/source/core/bastyp/swcache.cxx
index c5576d28adb7..8d8b5997ff9a 100644
--- a/sw/source/core/bastyp/swcache.cxx
+++ b/sw/source/core/bastyp/swcache.cxx
@@ -152,28 +152,7 @@ void SwCache::Flush()
 SwCacheObj *pTmp;
 while ( pObj )
 {
-#ifdef DBG_UTIL
-if ( pObj->IsLocked() )
-{
-OSL_FAIL( "Flushing locked objects." );
-if ( !m_pRealFirst )
-{
-m_pRealFirst = m_pFirst = m_pLast = pObj;
-pTmp = pObj->GetNext();
-pObj->SetNext( nullptr ); pObj->SetPrev( nullptr );
-pObj = pTmp;
-}
-else
-{   m_pLast->SetNext( pObj );
-pObj->SetPrev( m_pLast );
-m_pLast = pObj;
-pTmp = pObj->GetNext();
-pObj->SetNext( nullptr );
-pObj = pTmp;
-}
-}
-else
-#endif
+assert(!pObj->IsLocked());
 {
 pTmp = pObj;
 pObj = pTmp->GetNext();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-10-24 Thread Miklos Vajna
 sw/qa/extras/rtfexport/data/tdf113202.rtf|   42 +
 sw/qa/extras/rtfexport/rtfexport.cxx |6 +
 sw/source/core/inc/UndoTable.hxx |   22 ++--
 sw/source/core/undo/untbl.cxx|  120 +--
 writerfilter/source/dmapper/DomainMapper.cxx |8 +
 5 files changed, 127 insertions(+), 71 deletions(-)

New commits:
commit f8b5ecc622e2b3e82576b27bf0ded9c8eac21cae
Author: Miklos Vajna 
Date:   Tue Oct 24 09:27:19 2017 +0200

tdf#113202 RTF import: fix lack of expected contextual spacing

Upper, lower and contextual spacing are all stored in SvxULSpaceItem, so
if after spacing is set as direct formatting, contextual spacing has to
be set directly as well (having it in the paragraph style has no
effect).

Change-Id: Ie331c7561de7f2f16776a1613717e38fa083a541
Reviewed-on: https://gerrit.libreoffice.org/43735
Tested-by: Jenkins 
Reviewed-by: Miklos Vajna 

diff --git a/sw/qa/extras/rtfexport/data/tdf113202.rtf 
b/sw/qa/extras/rtfexport/data/tdf113202.rtf
new file mode 100644
index ..43860bf0becf
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/tdf113202.rtf
@@ -0,0 +1,42 @@
+{\rtf1\adeflang1037\ansi\ansicpg1252\uc1\adeff1\deff0\stshfdbch31506\stshfloch31506\stshfhich31506\stshfbi31507\deflang1033\deflangfe1033\themelang1033\themelangfe0\themelangcs0
+{\fonttbl
+{\f0\fbidi \froman\fcharset238\fprq2 Times New Roman;}
+{\f3\fbidi \froman\fcharset2\fprq2 Symbol;}
+{\f40\fbidi \fswiss\fcharset238\fprq2 Verdana;}
+}
+\noqfpromote
+{\stylesheet
+{\s15\ql 
\li720\ri0\sa200\sl276\slmult1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin720\itap0\contextualspace
 \rtlch\fcs1 \af1\afs22\alang1025 \ltrch\fcs0 
\f31506\fs22\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \sbasedon0 
\snext15 \sqformat \spriority34 List Paragraph;}
+}
+{\*\listtable
+{\list\listtemplateid1644085804\listhybrid
+{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace0\levelindent0
+{\leveltext
+\leveltemplateid67698689\'01\u-3913 ?;}
+{\levelnumbers;}
+\f3\fbias0 \fi-360\li720\lin720 }
+{\listname ;}
+\listid2028170298}
+}
+{\*\listoverridetable
+{\listoverride\listid2028170298\listoverridecount0\ls1}
+}
+\paperw12240\paperh15840\margl1417\margr1417\margt1417\margb1417
+\pard\plain \ltrpar
+\s15\ql 
\fi-360\li720\ri0\sa200\sl276\slmult1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\ls1\adjustright\rin0\lin720\itap0\contextualspace
 \rtlch\fcs1 \af1\afs22\alang1025 \ltrch\fcs0
+\f31506\fs22\lang1033\langfe1033\cgrid\langnp1033\langfenp1033
+{\rtlch\fcs1 \af37\afs16 \ltrch\fcs0 \f40\fs16 Profile 1 \endash A1\par}
+{\rtlch\fcs1 \af37\afs16 \ltrch\fcs0 \f40\fs16 Profile 1 \endash A2\par}
+{\rtlch\fcs1 \af37\afs16 \ltrch\fcs0 \f40\fs16 Profile 1 \endash A3\par}
+\pard \ltrpar\s15\ql \fi-360\li720\ri0\sl276\slmult1
+\widctlpar\wrapdefault\aspalpha\aspnum\faauto\ls1\adjustright\rin0\lin720\itap0\contextualspace
+{\rtlch\fcs1 \af37\afs16 \ltrch\fcs0 \f40\fs16 Profile 4 }
+{\rtlch\fcs1 \af37\afs16 \ltrch\fcs0
+\f40\fs16 \endash }
+{\rtlch\fcs1 \af37\afs16 \ltrch\fcs0 \f40\fs16 }
+{\rtlch\fcs1 \af37\afs16 \ltrch\fcs0 \f40\fs16 A4}
+{\rtlch\fcs1 \af37\afs16 \ltrch\fcs0
+\f40\fs16
+\par }
+\pard\plain\par
+}
diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx 
b/sw/qa/extras/rtfexport/rtfexport.cxx
index 5664cc8872f6..5923007b8d3a 100644
--- a/sw/qa/extras/rtfexport/rtfexport.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport.cxx
@@ -1307,6 +1307,12 @@ DECLARE_RTFEXPORT_TEST(testTdf112211, "tdf112211.rtf")
 CPPUNIT_ASSERT_EQUAL(static_cast(-635), 
aRule["FirstLineIndent"].get());
 }
 
+DECLARE_RTFEXPORT_TEST(testTdf113202, "tdf113202.rtf")
+{
+// This failed, contextual spacing in 4th paragraph was lost.
+CPPUNIT_ASSERT(getProperty(getParagraph(4), "ParaContextMargin"));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index af3579441047..2a831262e6de 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -405,8 +405,16 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
 case NS_ooxml::LN_CT_Spacing_after:
 m_pImpl->appendGrabBag(m_pImpl->m_aSubInteropGrabBag, "after", 
OUString::number(nIntValue));
 if (m_pImpl->GetTopContext())
+{
 // Don't overwrite NS_ooxml::LN_CT_Spacing_afterAutospacing.
 m_pImpl->GetTopContext()->Insert(PROP_PARA_BOTTOM_MARGIN, 
uno::makeAny( ConversionHelper::convertTwipToMM100( nIntValue ) ), false);
+
+uno::Any aContextualSpacingFromStyle = 
m_pImpl->GetPropertyFromStyleSheet(PROP_PARA_CONTEXT_MARGIN);
+if (aContextualSpacingFromStyle.hasValue())
+// Setting 

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

2017-09-25 Thread Miklos Vajna
 sw/qa/extras/uiwriter/data/split-section-in-nested-table.fodt |  154 ++
 sw/qa/extras/uiwriter/uiwriter.cxx|   17 +
 sw/source/core/layout/sectfrm.cxx |   28 -
 writerperfect/source/writer/exp/XMLSectionContext.cxx |2 
 writerperfect/source/writer/exp/XMLSectionContext.hxx |2 
 writerperfect/source/writer/exp/XMLTextFrameContext.cxx   |6 
 writerperfect/source/writer/exp/XMLTextFrameContext.hxx   |2 
 writerperfect/source/writer/exp/XMLTextListContext.cxx|2 
 writerperfect/source/writer/exp/XMLTextListContext.hxx|2 
 writerperfect/source/writer/exp/XMLTextListItemContext.cxx|2 
 writerperfect/source/writer/exp/XMLTextListItemContext.hxx|2 
 writerperfect/source/writer/exp/txtparai.cxx  |8 
 writerperfect/source/writer/exp/txtparai.hxx  |4 
 writerperfect/source/writer/exp/txtstyli.cxx  |2 
 writerperfect/source/writer/exp/txtstyli.hxx  |2 
 writerperfect/source/writer/exp/xmlfmt.cxx|2 
 writerperfect/source/writer/exp/xmlfmt.hxx|2 
 writerperfect/source/writer/exp/xmlictxt.cxx  |2 
 writerperfect/source/writer/exp/xmlictxt.hxx  |7 
 writerperfect/source/writer/exp/xmlimp.cxx|   10 
 writerperfect/source/writer/exp/xmlimp.hxx|2 
 writerperfect/source/writer/exp/xmlmetai.cxx  |2 
 writerperfect/source/writer/exp/xmlmetai.hxx  |2 
 writerperfect/source/writer/exp/xmltbli.cxx   |   10 
 writerperfect/source/writer/exp/xmltbli.hxx   |2 
 writerperfect/source/writer/exp/xmltext.cxx   |4 
 writerperfect/source/writer/exp/xmltext.hxx   |4 
 27 files changed, 218 insertions(+), 66 deletions(-)

New commits:
commit 8da365e2a7a6b30da6c2ca26b2a5f45f89cd5460
Author: Miklos Vajna 
Date:   Mon Sep 25 12:49:34 2017 +0200

sw: split section frames inside table cells, handle nested tables

Commit 3d1bb76ebf5c51141018cfd76eccdb63472de8de (tdf#112109 sw: split
section frames inside table cells, ignore nested tables, 2017-08-31)
explicitly disabled this, but the underlying problem is now fixed with
commit ec262cbc56822d8fffccd6e983848df196cf5c44 (tdf#112160 sw: audit
GetNextLayoutLeaf() calls in SwFrame::GetNextSctLeaf(), 2017-09-04), so
we can have it again.

Change-Id: Ic17c4921de2c69e4cc16ae82cfed58d096879db7

diff --git a/sw/qa/extras/uiwriter/data/split-section-in-nested-table.fodt 
b/sw/qa/extras/uiwriter/data/split-section-in-nested-table.fodt
new file mode 100644
index ..52d4f64742a4
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data/split-section-in-nested-table.fodt
@@ -0,0 +1,154 @@
+
+http://www.w3.org/1999/xlink; 
xmlns:dc="http://purl.org/dc/elements/1.1/; 
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" 
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" 
xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" 
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d: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:config="urn:oas
 is:names:tc:opendocument:xmlns:config:1.0" 
xmlns:ooo="http://openoffice.org/2004/office; 
xmlns:ooow="http://openoffice.org/2004/writer; 
xmlns:oooc="http://openoffice.org/2004/calc; 
xmlns:dom="http://www.w3.org/2001/xml-events; 
xmlns:xforms="http://www.w3.org/2002/xforms; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; 
xmlns:rpt="http://openoffice.org/2005/report; 
xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" 
xmlns:xhtml="http://www.w3.org/1999/xhtml; 
xmlns:grddl="http://www.w3.org/2003/g/data-view#; 
xmlns:officeooo="http://openoffice.org/2009/office; 
xmlns:tableooo="http://openoffice.org/2009/table; 
xmlns:drawooo="http://openoffice.org/2010/draw; 
xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0"
 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
 xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" 
xmlns:formx="urn:openoffice:names:
 experimental:ooxml-odf-interop:xmlns:form:1.0" 
xmlns:css3t="http://www.w3.org/TR/css3-text/; office:version="1.2" 
office:mimetype="application/vnd.oasis.opendocument.text">
+  
+
+  
+  
+
+  
+  
+
+
+  
+  
+
+
+  
+
+
+  
+
+
+
+  
+  
+
+
+  
+
+
+  
+
+
+  
+  
+
+
+  
+ 

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

2017-07-28 Thread Jan Holesovsky
 sw/qa/extras/htmlexport/htmlexport.cxx  |   31 ++-
 sw/source/filter/html/htmlflywriter.cxx |   20 ++--
 2 files changed, 36 insertions(+), 15 deletions(-)

New commits:
commit 587d6e13df7bb9c8f78ce605ebb8f8fd34b85a2c
Author: Jan Holesovsky 
Date:   Fri Jul 28 14:15:07 2017 +0200

sw htmlexport: Avoid unnecessary conversion to base64 + unit tests.

Change-Id: Ifdd86590f4258c84006f7ca94ea06058e600db1e

diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx 
b/sw/qa/extras/htmlexport/htmlexport.cxx
index 63435cee780a..1ea03e880de7 100644
--- a/sw/qa/extras/htmlexport/htmlexport.cxx
+++ b/sw/qa/extras/htmlexport/htmlexport.cxx
@@ -46,6 +46,8 @@ private:
 {
 if (getTestName().indexOf("SkipImages") != -1)
 setFilterOptions("SkipImages");
+else if (getTestName().indexOf("EmbedImages") != -1)
+setFilterOptions("EmbedImages");
 else
 setFilterOptions("");
 
@@ -285,6 +287,25 @@ DECLARE_HTMLEXPORT_TEST(testExtbChars, "extb.html")
 CPPUNIT_ASSERT_EQUAL(aExpected, xTextRange2->getString());
 }
 
+DECLARE_HTMLEXPORT_TEST(testNormalImageExport, "textAndImage.docx")
+{
+htmlDocPtr pDoc = parseHtml(maTempFile);
+CPPUNIT_ASSERT(pDoc);
+
+assertXPath(pDoc, "/html/body", 1);
+OUString imgSrc = getXPath(pDoc, "/html/body/p/img", "src");
+CPPUNIT_ASSERT(imgSrc.endsWith(".png"));
+}
+
+DECLARE_HTMLEXPORT_TEST(testEmbedImagesEnabled, "textAndImage.docx")
+{
+htmlDocPtr pDoc = parseHtml(maTempFile);
+CPPUNIT_ASSERT(pDoc);
+
+assertXPath(pDoc, "/html/body", 1);
+assertXPath(pDoc, "/html/body/p/img", "src", 
"data:image/png;base64,iVBORw0KGgoNSUhEUgAAADAwCAYAAABXAvmHCXBIWXMAAA3ZAAAN2QHmodeGAAAFyUlEQVR4nO1Za2gcVRQ+szuzO9ndZtfEktY2tVorVdNKxRpQweqPmh/B1w8JhCL4R4RYiPhCfKFEfwX/2VYULJIqJFDqg4KC1EaoEoyGhFJClBgbN+a9z9ndeXnOzJ3szCbbQuY2i5ADh5udmXvP953z3cdMRNM04f9sYq0B+LVNArW2TQJXM0EQdmKTQL+Mi4V2PWJwJ4CgBUkKdImi9F48HpGikTptfj4l19fLX2cyxeeQyALPeNwJxOOx/r17djz6+afdsX233QBg5CCXWYS3es62n/js4mXkdyeSmOMVjysBURQ7djVvbRv87p2oLJUAtHmLQDSUg963W8MhMSscPzXWh48e4RaT10BkKJkXens6orKYRvBZC7zlut2+231r6MOTI4exCgmswjKPmFwJFIvFu+5pqbczr7vB22QkMwd7d8vK2Hj+AD5+gUdMrgRCUnD+yt9T8ZubGsrAHSKMTHK2SDGTvGJyJaBp2g/9Z4abH7j7YMjJupvA0Mgi5BVDxUcneMXkSiCTVV/75ItLTx1qCTR2PpbwEJiYTMHjXamcUjSfMTmeIH0TwAm5H5s96JPou3N57f3n3xh99URfuL79IVmOR1UYGlXUL89phqrCabuLcAjbRvQCcjlfMwII5PCWaPib1ntv0S4O/Skn4jHhjn27FMPQ4d/ZJePjgWzJNExBDCW0gwciWp0ceLpQLHaMjM3UNTeZhcU0CLGI8FE2b75SEwJhSWx/ueuR6JvdD8Kx18+Yl/4oCN8PHEP9KyibAoC50krO76Hf/4EjnUkYHYDY+F8A93XCszhUbQiQSUHcsPQFJINz00TX5hhodCJS2WpLIAbBD
 
ARAkMN+o/OYxEYeQS0y0Gz3rQTtJmQs+0ftMp8EDFsm+qLdmvhbn7cBr8o+k5Se5oOcGZ8K6E4FBHb+8ejfS0jLcYBdNn4SInBm0CuhSiIkMc7fEPxLiIDqKgMZYgQqdA86F7Brmf8KmCQhzV6BKLvWHGBy2QDzEKAtEpsgu04eoMvsNqVRY62OO6hhXbXAsieIhL60AbDLZhFA3AQa6w8xsN9hybegy+wZAkspzaAvk2OfTFhaIcds4z+SiQiEABLwrejb0ZvQ8VBvESJiDkgigbPQIjGLfoU9U1NzZCKBnW0iEkEPu+6RUWqJCAGuQ4+CXaXIxsJdbQSSdE27iyMTEjG+jVsSIrBEziFCz1IViOBOzYD6C8OgPvEwSIPDYDYkvJJK4nx+qReMvg9W+oOEo2UVEEbGAcYmrMwovgjQZEQZlRgJhwBVIs6c5EQZp2yHGDHygK7Dzz/9Bvtbj8I2/Ft5EVv34HO4PZw97w24rdFqCvcfhZIQgEJOgSd9EUDwjoQINA1/I5QrILN7QZc7RtnWMjk4zn634QGtzT04ZhoQYEDH2gYD5esBAUo5xYz7Ab5CAGx9Oxp3iDQwAtJV+jp9qlo2b7cpnPYNXri0Ygex+r53OJKQiYPReypJiDROmqQDC8khAXYVnNXIWSeFa4F3E1hKewmwQUIYt+D39dLaB9ggJRyQCBQYGZoLtKzS8uosq4Eq46wJwiGwnFmzj8rj3dizE7MJXQS7EhQ+BTaRm8CeHzSZSVZO9t0VWWVZtr5UIUDzz1jZ0XkQsBDZWdFwcOfokAV79yVJUTVirn4kLQnKc8lLoHoFqJI70BcwDj2lrZdI1cPcGrKir8oRKFeAwEcZKfJVExJXKGuiVyFwO/o0+gx6ipby9UjqmqdRlhmSVRGDpKEsF2dnpi/NdPxIVfZdTlukiECw4hYBpaQYbBzn0MifgCeqnSF3EIVViGQwfbIfSl/9CCoDA5PT1vjJ3lOw/fQ5Kw
 
mmqtESav39K7rKXF/vhPb9PoBxVUaiZ2YBBtGdsxQZZfmX5AK0oFtAwc76FPbj8nLM5dMiy14aiXwLthyc5dZgm9UUjzhrGddvo4yIDtfzHbLCNv9LWWvbJFBr2yRQa/sP25LGjrtpN08ASUVORK5CYII=");
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/html/htmlflywriter.cxx 
b/sw/source/filter/html/htmlflywriter.cxx
index 725d4db2c2fd..b02c441a31e3 100644
--- a/sw/source/filter/html/htmlflywriter.cxx
+++ b/sw/source/filter/html/htmlflywriter.cxx
@@ -1358,19 +1358,19 @@ Writer& OutHTML_Image( Writer& rWrt, const 
SwFrameFormat ,
 
 aHtml.start(OOO_STRING_SVTOOLS_HTML_image);
 
-OUString aGraphicInBase64;
-if ( !XOutBitmap::GraphicToBase64(rGraphic, aGraphicInBase64) )
-{
-rHTMLWrt.m_nWarn = ErrCode(WARN_SWG_POOR_LOAD | WARN_SW_WRITE_BASE);
-}
-
 OStringBuffer sBuffer;
 if(rHTMLWrt.mbEmbedImages)
 {
-sBuffer.append(OOO_STRING_SVTOOLS_HTML_O_data);
-sBuffer.append(":");
-sBuffer.append(OUStringToOString(aGraphicInBase64, 
RTL_TEXTENCODING_UTF8));
-aHtml.attribute(OOO_STRING_SVTOOLS_HTML_O_src, 
sBuffer.makeStringAndClear().getStr());
+OUString aGraphicInBase64;
+if (XOutBitmap::GraphicToBase64(rGraphic, aGraphicInBase64))
+{
+sBuffer.append(OOO_STRING_SVTOOLS_HTML_O_data);
+sBuffer.append(":");

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

2017-06-26 Thread Michael Stahl
 sw/qa/extras/uiwriter/uiwriter.cxx |2 +-
 sw/source/core/inc/frame.hxx   |8 
 sw/source/core/layout/findfrm.cxx  |   12 
 sw/source/core/layout/ftnfrm.cxx   |   12 +++-
 sw/source/core/layout/sectfrm.cxx  |   32 
 sw/source/core/layout/trvlfrm.cxx  |8 
 6 files changed, 16 insertions(+), 58 deletions(-)

New commits:
commit 272d5a02a3de2350f8af7a93281b651316b24ae5
Author: Michael Stahl 
Date:   Mon Jun 26 15:01:36 2017 +0200

Revert "tdf#108524 sw: attempt to split section frames inside table cells"

This reverts commit f991b842aeada6dc45c4054deeca5aa7f17b.

It doesn't really work and crashes on ooo61225-1.sxw in

1 in SwFrame::FindTabFrame() (this=0x0) at sw/source/core/inc/frame.hxx:913
2 in SwFrame::GetNextSctLeaf(MakePageType) (this=0x3137130, 
eMakePage=MAKEPAGE_INSERT) at sw/source/core/layout/sectfrm.cxx:1529
3 in SwFrame::GetLeaf(MakePageType, bool) (this=0x3137130, 
eMakePage=MAKEPAGE_INSERT, bFwd=true) at sw/source/core/layout/flowfrm.cxx:805
4 in SwFlowFrame::MoveFwd(bool, bool, bool) (this=0x31371d8, 
bMakePage=true, bPageBreak=false, bMoveAlways=false) at 
sw/source/core/layout/flowfrm.cxx:1861

The code added in GetNextSctLeaf() looks unfinished to me: it assumes that
something else has added a follow-frame for the SwCellFrame containing
the SwSectionFrame already, but AFAICT the GetNextSctLeaf() function
is responsible for creating that SwCellFrame follow.

The caller (in GetLeaf()) specifically checks for this condition and
avoids calling GetNextCellLeaf().

Change-Id: I51875830771f07f5d2fec293f6063c73fc68d468

diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx 
b/sw/qa/extras/uiwriter/uiwriter.cxx
index cbcf944c7521..34974e3f3139 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -397,7 +397,7 @@ public:
 CPPUNIT_TEST(testMsWordCompTrailingBlanks);
 CPPUNIT_TEST(testCreateDocxAnnotation);
 CPPUNIT_TEST(testTdf107976);
-CPPUNIT_TEST(testTdf108524);
+//CPPUNIT_TEST(testTdf108524);
 CPPUNIT_TEST(testTableInSection);
 CPPUNIT_TEST_SUITE_END();
 
diff --git a/sw/source/core/inc/frame.hxx b/sw/source/core/inc/frame.hxx
index 50eac0865054..62ce2de3feae 100644
--- a/sw/source/core/inc/frame.hxx
+++ b/sw/source/core/inc/frame.hxx
@@ -41,7 +41,6 @@ class SwFootnoteFrame;
 class SwFootnoteBossFrame;
 class SwTabFrame;
 class SwRowFrame;
-class SwCellFrame;
 class SwFlowFrame;
 class SwContentFrame;
 class SfxPoolItem;
@@ -223,7 +222,6 @@ class SW_DLLPUBLIC SwFrame: public SwClient, public 
SfxBroadcaster
 const SwLayoutFrame* ImplGetNextLayoutLeaf( bool bFwd ) const;
 
 SwPageFrame* ImplFindPageFrame();
-SwCellFrame* ImplFindCellFrame();
 
 protected:
 SwSortedObjs* mpDrawObjs;// draw objects, can be 0
@@ -761,12 +759,6 @@ public:
 virtual void dumpAsXmlAttributes(xmlTextWriterPtr writer) const;
 void dumpChildrenAsXml(xmlTextWriterPtr writer) const;
 bool IsCollapse() const;
-
-/// Find the nearest table cell frame that contains us, if any.
-SwCellFrame* FindCellFrame()
-{
-return IsInTab() ? ImplFindCellFrame() : nullptr;
-}
 };
 
 inline bool SwFrame::IsInDocBody() const
diff --git a/sw/source/core/layout/findfrm.cxx 
b/sw/source/core/layout/findfrm.cxx
index df630a270c5c..74942256bef4 100644
--- a/sw/source/core/layout/findfrm.cxx
+++ b/sw/source/core/layout/findfrm.cxx
@@ -459,18 +459,6 @@ SwTabFrame* SwFrame::ImplFindTabFrame()
 return static_cast(pRet);
 }
 
-SwCellFrame* SwFrame::ImplFindCellFrame()
-{
-SwFrame *pRet = this;
-while (!pRet->IsCellFrame())
-{
-pRet = pRet->GetUpper();
-if (!pRet)
-return nullptr;
-}
-return static_cast(pRet);
-}
-
 SwSectionFrame* SwFrame::ImplFindSctFrame()
 {
 SwFrame *pRet = this;
diff --git a/sw/source/core/layout/sectfrm.cxx 
b/sw/source/core/layout/sectfrm.cxx
index 06c186c5d4c2..b94ba4582d85 100644
--- a/sw/source/core/layout/sectfrm.cxx
+++ b/sw/source/core/layout/sectfrm.cxx
@@ -22,7 +22,6 @@
 #include 
 #include 
 #include "sectfrm.hxx"
-#include "cellfrm.hxx"
 #include "section.hxx"
 #include 
 #include "rootfrm.hxx"
@@ -588,16 +587,6 @@ namespace
 return pLayFrame->GetNextLayoutLeaf();
 return pLayFrame;
 }
-
-/// Checks if pFrame is in a table, which itself is in a section.
-bool IsInTableInSection(SwFrame* pFrame)
-{
-if (!pFrame->IsInTab())
-return false;
-
-// The frame is in a table, see if the table is in a section.
-return pFrame->FindTabFrame()->IsInSct();
-}
 }
 
 void SwSectionFrame::MoveContentAndDelete( SwSectionFrame* pDel, bool bSave )
@@ -1450,9 +1439,9 @@ SwLayoutFrame *SwFrame::GetNextSctLeaf( MakePageType 
eMakePage )
 return 

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

2017-04-27 Thread Michael Stahl
 sw/qa/extras/uiwriter/uiwriter.cxx |   22 ++
 sw/source/core/layout/atrfrm.cxx   |2 +-
 2 files changed, 23 insertions(+), 1 deletion(-)

New commits:
commit daca28debc20f4bddcab8c22e8d3a0ca5a990486
Author: Michael Stahl 
Date:   Thu Apr 27 15:05:49 2017 +0200

sw: add test that SwXTextCursor is disposed if header is deleted

This test failed for 2 reasons:
1) since somewhere between LO 5.0 and 5.1, the PaMCorrAbs sent a
   SwMsgPoolItem but SwUnoCursorPointer checked for a LegacyModifyHint
   (fixed in commit a029a479429d334875b73e2fc4e34b314a1ad369)
2) the SwXHeadFootText being registered at the header format prevented
   its deletion (fixed in preceding commit)

Change-Id: I1d36bc2b9ca222b1b68fda94ded65451a677214a

diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx 
b/sw/qa/extras/uiwriter/uiwriter.cxx
index ef688fbd70ed..9cf0fad97ff3 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -143,6 +143,7 @@ public:
 void testBookmarkUndo();
 void testFdo85876();
 void testFdo87448();
+void testTextCursorInvalidation();
 void testTdf68183();
 void testCp1000115();
 void testTdf63214();
@@ -269,6 +270,7 @@ public:
 CPPUNIT_TEST(testBookmarkUndo);
 CPPUNIT_TEST(testFdo85876);
 CPPUNIT_TEST(testFdo87448);
+CPPUNIT_TEST(testTextCursorInvalidation);
 CPPUNIT_TEST(testTdf68183);
 CPPUNIT_TEST(testCp1000115);
 CPPUNIT_TEST(testTdf63214);
@@ -1261,6 +1263,26 @@ void SwUiWriterTest::testFdo87448()
 CPPUNIT_ASSERT_MESSAGE(aMsg.getStr(), abs(nFirstEnd - nSecondEnd) < 10);
 }
 
+void SwUiWriterTest::testTextCursorInvalidation()
+{
+createDoc();
+SwDoc* pDoc = createDoc();
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+uno::Reference 
xPageStyle(getStyles("PageStyles")->getByName("Standard"), uno::UNO_QUERY);
+CPPUNIT_ASSERT(xPageStyle.is());
+xPageStyle->setPropertyValue("HeaderIsOn", uno::makeAny(true));
+uno::Reference 
xHeader(getProperty(xPageStyle, "HeaderText"));
+CPPUNIT_ASSERT(xHeader.is());
+// create cursor inside the header text
+uno::Reference xCursor(xHeader->createTextCursor());
+// can't go right in empty header
+CPPUNIT_ASSERT(!xCursor->goRight(1, false));
+// this does not actually delete the header:
xPageStyle->setPropertyValue("HeaderIsOn", uno::makeAny(false));
+pWrtShell->ChangeHeaderOrFooter("Default Style", true, false, false);
+// must be disposed after deleting header
+CPPUNIT_ASSERT_THROW(xCursor->goRight(1, false), uno::RuntimeException);
+}
+
 void SwUiWriterTest::testTdf68183()
 {
 // First disable RSID and check if indeed no such attribute is inserted.
commit 99777c5a15df2d92bb8a9ddb6329fc3df1b2b8bf
Author: Michael Stahl 
Date:   Thu Apr 27 15:03:21 2017 +0200

sw: fix always-true condition in lcl_DelHFFormat ...

... that prevents headers from being deleted if they have a client.

(regression from d4267231754c1e6b03c7723a6fecc46750e7c780)

Change-Id: I71f52f8806e59c97b81aa14144c700c14c5527b0

diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx
index 7661a0511948..c6521ae769f3 100644
--- a/sw/source/core/layout/atrfrm.cxx
+++ b/sw/source/core/layout/atrfrm.cxx
@@ -120,7 +120,7 @@ static void lcl_DelHFFormat( SwClient *pToRemove, 
SwFrameFormat *pFormat )
 // It's suboptimal if the format is deleted beforehand.
 SwIterator aIter(*pFormat);
 for(SwClient* pLast = aIter.First(); bDel && pLast; pLast = 
aIter.Next())
-if(dynamic_cast( pLast ) ==  nullptr || 
!SwXHeadFootText::IsXHeadFootText(pLast))
+if (dynamic_cast(pLast) == nullptr && 
!SwXHeadFootText::IsXHeadFootText(pLast))
 bDel = false;
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-04-21 Thread Jan Holesovsky
 sw/qa/extras/uiwriter/uiwriter.cxx   |   28 +++
 sw/source/filter/ww8/docxattributeoutput.cxx |   24 +--
 2 files changed, 46 insertions(+), 6 deletions(-)

New commits:
commit 26930dfffe791de7d0c88d1a6dcb15498d6f6883
Author: Jan Holesovsky 
Date:   Fri Apr 21 12:12:37 2017 +0200

related tdf#68604: Unit test for writing the plaintext annotations in DOCX.

Change-Id: I8c747e72ca96ffd097c92326210c39740102ec79

diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx 
b/sw/qa/extras/uiwriter/uiwriter.cxx
index e9513d1bbf06..bb6c069d7192 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -234,6 +234,7 @@ public:
 void testTdf105625();
 void testTdf106736();
 void testMsWordCompTrailingBlanks();
+void testCreateDocxAnnotation();
 
 CPPUNIT_TEST_SUITE(SwUiWriterTest);
 CPPUNIT_TEST(testReplaceForward);
@@ -359,6 +360,7 @@ public:
 CPPUNIT_TEST(testTdf105625);
 CPPUNIT_TEST(testTdf106736);
 CPPUNIT_TEST(testMsWordCompTrailingBlanks);
+CPPUNIT_TEST(testCreateDocxAnnotation);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -4555,6 +4557,32 @@ void SwUiWriterTest::testMsWordCompTrailingBlanks()
 CPPUNIT_ASSERT_EQUAL( true, pDoc->getIDocumentSettingAccess().get( 
DocumentSettingId::MS_WORD_COMP_TRAILING_BLANKS ) );
 }
 
+void SwUiWriterTest::testCreateDocxAnnotation()
+{
+createDoc();
+
+// insert an annotation with a text
+const OUString aSomeText("some text");
+uno::Sequence aPropertyValues = 
comphelper::InitPropertySequence(
+{
+{"Text", uno::makeAny(aSomeText)},
+{"Author", uno::makeAny(OUString("me"))},
+});
+lcl_dispatchCommand(mxComponent, ".uno:InsertAnnotation", aPropertyValues);
+
+// Save it as DOCX & load it again
+reload("Office Open XML Text", "create-docx-annotation.docx");
+
+// get the annotation
+uno::Reference xTextFieldsSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xFieldsAccess(xTextFieldsSupplier->getTextFields());
+uno::Reference 
xFields(xFieldsAccess->createEnumeration());
+uno::Reference xField(xFields->nextElement(), 
uno::UNO_QUERY);
+
+// this was empty insetad of "some text"
+CPPUNIT_ASSERT_EQUAL(aSomeText, 
xField->getPropertyValue("Content").get());
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest);
 CPPUNIT_PLUGIN_IMPLEMENT();
 
commit 24fee4879c0df4fb88fad8de4f7d6259aafe
Author: Jan Holesovsky 
Date:   Fri Apr 21 09:47:13 2017 +0200

related tdf#68604: Write the plaintext version of the annotation...

...if the TextObject is not available.  This is perfectly valid situation in
the case when the SwPostItField was created via the .uno:InsertAnnotation 
API.

Change-Id: I3ae2a529ba7cc13cf5b04d57aa299d79e2044f37

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index b9d2fe38de4e..c59dc7520f5f 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -6762,7 +6762,7 @@ void DocxAttributeOutput::WritePostitFieldReference()
 
 void DocxAttributeOutput::WritePostitFields()
 {
-for(const std::pair & rPair : m_postitFields)
+for (const std::pair & rPair : m_postitFields)
 {
 OString idstr = OString::number( rPair.second);
 const SwPostItField* f = rPair.first;
@@ -6770,11 +6770,23 @@ void DocxAttributeOutput::WritePostitFields()
 FSNS( XML_w, XML_author ), OUStringToOString( f->GetPar1(), 
RTL_TEXTENCODING_UTF8 ).getStr(),
 FSNS( XML_w, XML_date ), 
DateTimeToOString(f->GetDateTime()).getStr(),
 FSNS( XML_w, XML_initials ), OUStringToOString( f->GetInitials(), 
RTL_TEXTENCODING_UTF8 ).getStr(), FSEND );
-// Check for the text object existing, it seems that it can be NULL 
when saving a newly created
-// comment without giving focus back to the main document. As 
GetText() is empty in that case as well,
-// that is probably a bug in the Writer core.
-if( f->GetTextObject() != nullptr )
-GetExport().WriteOutliner( *f->GetTextObject(), TXT_ATN );
+
+if (f->GetTextObject() != nullptr)
+{
+// richtext
+GetExport().WriteOutliner(*f->GetTextObject(), TXT_ATN);
+}
+else
+{
+// just plain text - eg. when the field was created via the
+// .uno:InsertAnnotation API
+m_pSerializer->startElementNS(XML_w, XML_p, FSEND);
+m_pSerializer->startElementNS(XML_w, XML_r, FSEND);
+RunText(f->GetText());
+m_pSerializer->endElementNS(XML_w, XML_r);
+m_pSerializer->endElementNS(XML_w, XML_p);
+}
+
 m_pSerializer->endElementNS( XML_w, XML_comment );
 }
 }
___
Libreoffice-commits mailing list

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

2017-03-02 Thread Michael Stahl
 sw/qa/extras/ooxmlexport/data/toxmarkhyperlink.fodt |   52 
 sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx   |5 +
 sw/source/filter/ww8/docxattributeoutput.cxx|   32 ++--
 3 files changed, 83 insertions(+), 6 deletions(-)

New commits:
commit 103efac8110be7e6f42fffcecc74abdcae4df7f9
Author: Michael Stahl 
Date:   Thu Mar 2 23:11:29 2017 +0100

tdf#101178 sw: DOCX export: fix crash

These conditions in DocxAttributeOutput::EndRun() are apparently not
mutually exclusive, so don't increment m_nFieldsInHyperlink twice.

Whether the m_nFieldsInHyperlink makes any sense considering there are
*2* hyperlinks then, i can't tell.

Change-Id: I5030f3303bd83633fcb044573860bc8ecaacae32

diff --git a/sw/qa/extras/ooxmlexport/data/toxmarkhyperlink.fodt 
b/sw/qa/extras/ooxmlexport/data/toxmarkhyperlink.fodt
index cbc8b59..b1323f6 100644
--- a/sw/qa/extras/ooxmlexport/data/toxmarkhyperlink.fodt
+++ b/sw/qa/extras/ooxmlexport/data/toxmarkhyperlink.fodt
@@ -42,6 +42,7 @@
 http://example.com/; text:style-name="Internet_20_link" 
text:visited-style-name="Visited_20_Internet_20_Link">foo
 http://example.com/; text:style-name="Internet_20_link" 
text:visited-style-name="Visited_20_Internet_20_Link">foo
 http://example.com/; text:style-name="Internet_20_link" 
text:visited-style-name="Visited_20_Internet_20_Link">foohttp://example.com/; text:style-name="Internet_20_link" 
text:visited-style-name="Visited_20_Internet_20_Link">bar
+http://example.com/; text:style-name="Internet_20_link" 
text:visited-style-name="Visited_20_Internet_20_Link">foohttp://example.com/; 
text:style-name="Internet_20_link" 
text:visited-style-name="Visited_20_Internet_20_Link">http://example.com/;>[fuh]
 
   
+  
+ 
+
diff --git a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
index 779e823..ec8b136 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
@@ -671,6 +671,11 @@ DECLARE_OOXMLEXPORT_TEST(testFixedDateFields, 
"fixed-date-field.docx")
 }
 }
 
+DECLARE_OOXMLEXPORT_TEST(testToxmarkHyperlink, "toxmarkhyperlink.fodt")
+{
+// test that export doesn't assert with overlapping fields / hyperlink attr
+}
+
 DECLARE_OOXMLEXPORT_TEST(testOO34469, "ooo34469-1.odt")
 {
 if (xmlDocPtr pXmlDoc = parseExport())
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 1a52d89..0212233 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -1214,8 +1214,31 @@ void DocxAttributeOutput::EndRun()
 }
 
 // Start the hyperlink after the fields separators or we would generate 
invalid file
+bool newStartedHyperlink(false);
 if ( m_pHyperlinkAttrList.is() )
 {
+// if we are ending a hyperlink and there's another one starting here,
+// don't do this, so that the fields are closed further down when
+// the end hyperlink is handled, which is more likely to put the end in
+// the right place, as far as i can tell (not very far in this muck)
+if (!m_closeHyperlinkInThisRun)
+{
+// end ToX fields that want to end _before_ starting the hyperlink
+for (auto it = m_Fields.rbegin(); it != m_Fields.rend(); )
+{
+if (it->bClose && !it->pField)
+{
+EndField_Impl(*it);
+it = 
decltype(m_Fields)::reverse_iterator(m_Fields.erase(it.base() - 1));
+}
+else
+{
+++it;
+}
+}
+}
+newStartedHyperlink = true;
+
 XFastAttributeListRef xAttrList ( m_pHyperlinkAttrList.get() );
 m_pHyperlinkAttrList.clear();
 
@@ -1350,7 +1373,7 @@ void DocxAttributeOutput::EndRun()
 m_closeHyperlinkInThisRun = false;
 }
 
-if (!m_startedHyperlink)
+if (!newStartedHyperlink)
 {
 while ( m_Fields.begin() != m_Fields.end() )
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-02-23 Thread Michael Stahl
 sw/qa/extras/rtfimport/data/hexcrlf.rtf|4 
 sw/qa/extras/rtfimport/rtfimport.cxx   |   10 ++
 sw/source/core/unocore/unotext.cxx |2 ++
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |   14 +-
 4 files changed, 29 insertions(+), 1 deletion(-)

New commits:
commit f1bd815f60c78495259ae19ea68eacdb8b43a9e8
Author: Michael Stahl 
Date:   Thu Feb 23 16:07:18 2017 +0100

sw: fix cursor backup in SwXText::insertTextPortion()

If the inserted string contains "\r", such as when importing
lp556169-2.rtf before the previous fix, the given cursor has one of its
positions mangled because its nNode will be on the new node, but the
nContent that is restored here is on the old node.

The invalid cursor causes an assert in the subsequent SetPropertyValues.

Change-Id: I73a2e6ecd02ccf75f7b9ffd89d90ae1e3a93ceb2

diff --git a/sw/source/core/unocore/unotext.cxx 
b/sw/source/core/unocore/unotext.cxx
index f32836a..78cce48 100644
--- a/sw/source/core/unocore/unotext.cxx
+++ b/sw/source/core/unocore/unotext.cxx
@@ -1352,10 +1352,12 @@ SwXText::insertTextPortion(
 
 if (!rText.isEmpty())
 {
+SwNodeIndex const nodeIndex(rCursor.GetPoint()->nNode, -1);
 const sal_Int32 nContentPos = rCursor.GetPoint()->nContent.GetIndex();
 SwUnoCursorHelper::DocInsertStringSplitCR(
 *m_pImpl->m_pDoc, rCursor, rText, false);
 SwUnoCursorHelper::SelectPam(rCursor, true);
+rCursor.GetPoint()->nNode = SwNodeIndex(nodeIndex, +1);
 rCursor.GetPoint()->nContent = nContentPos;
 }
 
commit 10e733908038407791f9c14af2a86417cc4a653c
Author: Michael Stahl 
Date:   Thu Feb 23 15:33:55 2017 +0100

writerfilter: RTF import: hex-escaped \r and \n create paragraph break

... in Word 2010, while the spec doesn't say what they do.
So just handle \'0d and \'0a like \par.

This fixes an assert failure on importing lp556169-2.rtf, where
insertTextPortion was called with a string containing "\r", which split
the paragraph and that messed up the SwPaM.

Change-Id: Iee8b5b47e15d18232de841adfbc9c6498727c384

diff --git a/sw/qa/extras/rtfimport/data/hexcrlf.rtf 
b/sw/qa/extras/rtfimport/data/hexcrlf.rtf
new file mode 100644
index 000..7c7ed1a
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/hexcrlf.rtf
@@ -0,0 +1,4 @@
+{\rtf1
+foo\'0dba
+r\'0abaz\'0d\'0aquux
+\par }
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx 
b/sw/qa/extras/rtfimport/rtfimport.cxx
index 855b2da..64a6dc9 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -1101,6 +1101,16 @@ DECLARE_RTFIMPORT_TEST(testFdo59419, "fdo59419.rtf")
 CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTables->getCount());
 }
 
+DECLARE_RTFIMPORT_TEST(testHexCRLF, "hexcrlf.rtf")
+{
+// hex-escaped \r and \n should create a paragraph break
+getParagraph(1, "foo");
+getParagraph(2, "bar");
+getParagraph(3, "baz");
+getParagraph(4, "");
+getParagraph(5, "quux");
+}
+
 DECLARE_RTFIMPORT_TEST(testFdo58076_2, "fdo58076-2.rtf")
 {
 // Position of the picture wasn't correct.
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index a42b528..ef5e086 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -1120,7 +1120,19 @@ RTFError RTFDocumentImpl::resolveChars(char ch)
 if (m_aStates.top().nInternalState == RTFInternalState::HEX && 
m_aStates.top().eDestination != Destination::LEVELNUMBERS)
 {
 if (!bSkipped)
-m_aHexBuffer.append(ch);
+{
+// note: apparently \'0d\'0a is interpreted as 2 breaks, not 1
+if (m_aStates.top().eDestination != Destination::DOCCOMM
+&& (ch == '\r' || ch == '\n'))
+{
+checkUnicode(/*bUnicode =*/ false, /*bHex =*/ true);
+dispatchSymbol(RTF_PAR);
+}
+else
+{
+m_aHexBuffer.append(ch);
+}
+}
 return RTFError::OK;
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-01-18 Thread Michael Stahl
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx  |   10 +---
 sw/source/uibase/uiview/view.cxx  |   20 +++-
 sw/source/uibase/uno/SwXDocumentSettings.cxx  |   16 -
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   27 +++---
 4 files changed, 30 insertions(+), 43 deletions(-)

New commits:
commit 2dce8dd41c208ecda40c054635f3736147ec8914
Author: Michael Stahl 
Date:   Wed Jan 18 18:25:46 2017 +0100

tdf#99074 sw: remove duplicate property "IsBrowseMode" again

Commit e0f9bb795251d950b5dd960fcd030170c8eb67aa added the property
"IsBrowseMode" to SwXDocumentSettings, but it is already available in
the API as SwXViewSettings property "ShowOnlineLayout".

The problem is that both of these properties get exported in ODF into
settings.xml, so it contains "IsBrowseMode" twice.

Unfortunately the SwXViewSettings are not available in writerfilter,
because the XModel::getCurrentController() is null, the view is created
after the import.

But there is already a way to store ViewData in the SfxBaseModel, which
is then used by SfxBaseController::ConnectSfxFrame_Impl() when creating
the view.  This applies the property at just the right time.

Change-Id: I842845d09a7b3fe81e27a1ed8ac8a8594da7f4e8

diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 97a0991..786c686 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -46,6 +46,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1321,10 +1322,13 @@ DECLARE_OOXMLIMPORT_TEST(testTdf98882, "tdf98882.docx")
 
 DECLARE_OOXMLIMPORT_TEST(testTdf99074, "tdf99074.docx")
 {
-uno::Reference xFactory(mxComponent, 
uno::UNO_QUERY);
-uno::Reference xSettings = 
xFactory->createInstance("com.sun.star.document.Settings");
+uno::Reference xModel(mxComponent, uno::UNO_QUERY);
+uno::Reference const xController(
+xModel->getCurrentController(), uno::UNO_QUERY);
+uno::Reference const xViewSettings(
+xController->getViewSettings());
 // This was false, Web Layout was ignored on import.
-CPPUNIT_ASSERT(getProperty(xSettings, "InBrowseMode"));
+CPPUNIT_ASSERT(getProperty(xViewSettings, "ShowOnlineLayout"));
 }
 
 DECLARE_OOXMLIMPORT_TEST(testTdf100830, "tdf100830.docx")
diff --git a/sw/source/uibase/uiview/view.cxx b/sw/source/uibase/uiview/view.cxx
index 53baef3..f01a65f 100644
--- a/sw/source/uibase/uiview/view.cxx
+++ b/sw/source/uibase/uiview/view.cxx
@@ -1264,7 +1264,8 @@ void SwView::ReadUserDataSequence ( const uno::Sequence < 
beans::PropertyValue >
  bGotVisibleTop = false, bGotVisibleRight = false,
  bGotVisibleBottom = false, bGotZoomType = false,
  bGotZoomFactor = false, bGotIsSelectedFrame = false,
- bGotViewLayoutColumns = false, bGotViewLayoutBookMode = false;
+ bGotViewLayoutColumns = false, bGotViewLayoutBookMode = false,
+ bBrowseMode = false, bGotBrowseMode = false;
 
 for (sal_Int32 i = 0 ; i < nLength; i++)
 {
@@ -1327,10 +1328,20 @@ void SwView::ReadUserDataSequence ( const uno::Sequence 
< beans::PropertyValue >
pValue->Value >>= bSelectedFrame;
bGotIsSelectedFrame = true;
 }
+else if (pValue->Name == "ShowOnlineLayout")
+{
+   pValue->Value >>= bBrowseMode;
+   bGotBrowseMode = true;
+}
 // Fallback to common SdrModel processing
 else 
GetDocShell()->GetDoc()->getIDocumentDrawModelAccess().GetDrawModel()->ReadUserDataSequenceValue(pValue);
 pValue++;
 }
+if (bGotBrowseMode)
+{
+// delegate further
+
GetViewImpl()->GetUNOObject_Impl()->getViewSettings()->setPropertyValue("ShowOnlineLayout",
 uno::Any(bBrowseMode));
+}
 if (bGotVisibleBottom)
 {
 Point aCursorPos( nX, nY );
diff --git a/sw/source/uibase/uno/SwXDocumentSettings.cxx 
b/sw/source/uibase/uno/SwXDocumentSettings.cxx
index f11fae73c..b369e98 100644
--- a/sw/source/uibase/uno/SwXDocumentSettings.cxx
+++ b/sw/source/uibase/uno/SwXDocumentSettings.cxx
@@ -136,7 +136,6 @@ enum SwDocumentSettingsPropertyHandles
 HANDLE_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING,
 HANDLE_PROP_LINE_SPACING_SHRINKS_FIRST_LINE,
 HANDLE_SUBTRACT_FLYS,
-HANDLE_BROWSE_MODE,
 };
 
 static MasterPropertySetInfo * lcl_createSettingsInfo()
@@ -213,7 +212,6 @@ static MasterPropertySetInfo * lcl_createSettingsInfo()
 { OUString("ApplyParagraphMarkFormatToNumbering"), 
HANDLE_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING, cppu::UnoType::get(), 0},
 { OUString("PropLineSpacingShrinksFirstLine"),   
HANDLE_PROP_LINE_SPACING_SHRINKS_FIRST_LINE, 

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

2016-12-08 Thread Miklos Vajna
 sw/qa/extras/rtfexport/data/custom-doc-props.rtf |6 
 sw/qa/extras/rtfexport/rtfexport.cxx |9 ++
 sw/source/filter/ww8/rtfexport.cxx   |   32 +--
 writerfilter/source/rtftok/rtfdispatchvalue.cxx  |6 
 writerfilter/source/rtftok/rtfdocumentimpl.cxx   |   27 +++
 5 files changed, 78 insertions(+), 2 deletions(-)

New commits:
commit 51c400dc4cd6a88c01b245e41d0de737d4df4017
Author: Miklos Vajna 
Date:   Thu Dec 8 17:25:07 2016 +0100

RTF filter: handle user-defined document properties of type double

This was the last unhandled type.

Change-Id: Ife9b93ac81ddab9409c6790228eec03e92920e01

diff --git a/sw/qa/extras/rtfexport/data/custom-doc-props.rtf 
b/sw/qa/extras/rtfexport/data/custom-doc-props.rtf
index 361631d..8c921e4 100644
--- a/sw/qa/extras/rtfexport/data/custom-doc-props.rtf
+++ b/sw/qa/extras/rtfexport/data/custom-doc-props.rtf
@@ -18,5 +18,8 @@
 {\propname d}
 \proptype64
 {\staticval 2016. 01. 30.}
+{\propname pi}
+\proptype5
+{\staticval 3.14}
 }
 }
diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx 
b/sw/qa/extras/rtfexport/rtfexport.cxx
index fa544ac..ce74f91 100644
--- a/sw/qa/extras/rtfexport/rtfexport.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport.cxx
@@ -1020,6 +1020,9 @@ DECLARE_RTFEXPORT_TEST(testCustomDocProps, 
"custom-doc-props.rtf")
 CPPUNIT_ASSERT_EQUAL(static_cast(2016), aDate.Year);
 CPPUNIT_ASSERT_EQUAL(static_cast(1), aDate.Month);
 CPPUNIT_ASSERT_EQUAL(static_cast(30), aDate.Day);
+
+// Test real number.
+CPPUNIT_ASSERT_EQUAL(3.14, getProperty(xUserDefinedProperties, 
"pi"));
 }
 
 DECLARE_RTFEXPORT_TEST(testTdf65642, "tdf65642.rtf")
diff --git a/sw/source/filter/ww8/rtfexport.cxx 
b/sw/source/filter/ww8/rtfexport.cxx
index dd3490b..fd8ade2 100644
--- a/sw/source/filter/ww8/rtfexport.cxx
+++ b/sw/source/filter/ww8/rtfexport.cxx
@@ -538,8 +538,19 @@ void RtfExport::WriteUserProps()
 }
 else if (aAny >>= fValue)
 {
-WriteUserPropType(3);
-WriteUserPropValue(OUString::number(fValue));
+aValue = OUString::number(fValue);
+if (aValue.indexOf('.') == -1)
+{
+// Integer.
+WriteUserPropType(3);
+WriteUserPropValue(aValue);
+}
+else
+{
+// Real number.
+WriteUserPropType(5);
+WriteUserPropValue(aValue);
+}
 }
 else if (aAny >>= aDate)
 {
diff --git a/writerfilter/source/rtftok/rtfdispatchvalue.cxx 
b/writerfilter/source/rtftok/rtfdispatchvalue.cxx
index 0cefa01..8c6075e 100644
--- a/writerfilter/source/rtftok/rtfdispatchvalue.cxx
+++ b/writerfilter/source/rtftok/rtfdispatchvalue.cxx
@@ -1397,6 +1397,9 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword 
nKeyword, int nParam)
 case 3:
 m_aStates.top().aPropType = cppu::UnoType::get();
 break;
+case 5:
+m_aStates.top().aPropType = cppu::UnoType::get();
+break;
 case 11:
 m_aStates.top().aPropType = cppu::UnoType::get();
 break;
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 09c84a0..c113167 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -2712,6 +2712,8 @@ RTFError RTFDocumentImpl::popState()
 aAny = uno::makeAny(aStaticVal.toBoolean());
 else if (m_aStates.top().aPropType == 
cppu::UnoType::get())
 aAny = uno::makeAny(getDateTimeFromUserProp(aStaticVal));
+else if (m_aStates.top().aPropType == cppu::UnoType::get())
+aAny = uno::makeAny(aStaticVal.toDouble());
 
 xPropertyContainer->addProperty(rKey, 
beans::PropertyAttribute::REMOVABLE, aAny);
 }
commit 07b0cde32a7eebce996b8c32aa58545e4ec15003
Author: Miklos Vajna 
Date:   Thu Dec 8 15:19:06 2016 +0100

RTF filter: handle user-defined document properties of type date

The date format is undefined by the RTF spec, but Word seems to work
with '. MM. DD.'.

Change-Id: I79a10984963851c86cba92892eab13cec1e37072

diff --git a/sw/qa/extras/rtfexport/data/custom-doc-props.rtf 
b/sw/qa/extras/rtfexport/data/custom-doc-props.rtf
index e774659..361631d 100644
--- a/sw/qa/extras/rtfexport/data/custom-doc-props.rtf
+++ b/sw/qa/extras/rtfexport/data/custom-doc-props.rtf
@@ -15,5 +15,8 @@
 {\propname bn}
 \proptype11
 {\staticval 0}
+{\propname d}
+\proptype64
+{\staticval 2016. 01. 30.}
 }
 }
diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx 

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

2016-10-05 Thread Michael Stahl
 sw/qa/extras/odfimport/data/tdf103025.odt |binary
 sw/qa/extras/odfimport/odfimport.cxx  |9 +
 sw/source/core/doc/docbm.cxx  |3 ---
 sw/source/core/layout/pagechg.cxx |   16 
 4 files changed, 9 insertions(+), 19 deletions(-)

New commits:
commit f933da55797566cf725e35ab0df17e91c7d5598f
Author: Michael Stahl 
Date:   Wed Oct 5 23:09:25 2016 +0200

tdf#103025 sw: don't format header/footer in SwPageFrame::PreparePage()

This has always been dead code because it used wrong constants
FRMTYPE_HEADER|FRMTYPE_FOOTER which is actually Page|Column and
SwPageFrame and SwColumnFrame are not direct children of SwPageFrame.

Then commit 901e5c3a21a1299d10c44bc844246fe8c329bb82 fixed the
constants but somehow the early formatting of header/footer results
in wrong expansion of variable text fields, so just remove this code.

Change-Id: I0af13168970f26355a1b247e071235166d08b7a4

diff --git a/sw/qa/extras/odfimport/data/tdf103025.odt 
b/sw/qa/extras/odfimport/data/tdf103025.odt
new file mode 100644
index 000..bd1e573
Binary files /dev/null and b/sw/qa/extras/odfimport/data/tdf103025.odt differ
diff --git a/sw/qa/extras/odfimport/odfimport.cxx 
b/sw/qa/extras/odfimport/odfimport.cxx
index ceb5572..e8bc1cf 100644
--- a/sw/qa/extras/odfimport/odfimport.cxx
+++ b/sw/qa/extras/odfimport/odfimport.cxx
@@ -631,6 +631,15 @@ DECLARE_ODFIMPORT_TEST(testBnc800714, "bnc800714.fodt")
 CPPUNIT_ASSERT(getProperty(getParagraph(2), "ParaKeepTogether"));
 }
 
+DECLARE_ODFIMPORT_TEST(testTdf103025, "tdf103025.odt")
+{
+CPPUNIT_ASSERT_EQUAL(OUString("2014-01"), 
parseDump("/root/page[1]/header/tab[2]/row[2]/cell[3]/txt/Special", "rText"));
+CPPUNIT_ASSERT_EQUAL(OUString("2014-01"), 
parseDump("/root/page[2]/header/tab[2]/row[2]/cell[3]/txt/Special", "rText"));
+CPPUNIT_ASSERT_EQUAL(OUString("2014-02"), 
parseDump("/root/page[3]/header/tab[2]/row[2]/cell[3]/txt/Special", "rText"));
+CPPUNIT_ASSERT_EQUAL(OUString("2014-03"), 
parseDump("/root/page[4]/header/tab[2]/row[2]/cell[3]/txt/Special", "rText"));
+CPPUNIT_ASSERT_EQUAL(OUString("2014-03"), 
parseDump("/root/page[5]/header/tab[2]/row[2]/cell[3]/txt/Special", "rText"));
+}
+
 DECLARE_ODFIMPORT_TEST(testTdf76322_columnBreakInHeader, 
"tdf76322_columnBreakInHeader.docx")
 {
 // column breaks were ignored. First line should start in column 2
diff --git a/sw/source/core/layout/pagechg.cxx 
b/sw/source/core/layout/pagechg.cxx
index 50d910b..720a541 100644
--- a/sw/source/core/layout/pagechg.cxx
+++ b/sw/source/core/layout/pagechg.cxx
@@ -467,22 +467,6 @@ void SwPageFrame::PreparePage( bool bFootnote )
 if ( GetPrev() && static_cast(GetPrev())->IsEmptyPage() )
 lcl_MakeObjs( *pDoc->GetSpzFrameFormats(), 
static_cast(GetPrev()) );
 lcl_MakeObjs( *pDoc->GetSpzFrameFormats(), this );
-
-// format footer/ header
-SwLayoutFrame *pLow = static_cast(Lower());
-while ( pLow )
-{
-if ( pLow->GetType() & (SwFrameType::Header|SwFrameType::Footer) )
-{
-SwContentFrame *pContent = pLow->ContainsContent();
-while ( pContent && pLow->IsAnLower( pContent ) )
-{
-pContent->OptCalc();  // not the predecessors
-pContent = pContent->GetNextContentFrame();
-}
-}
-pLow = static_cast(pLow->GetNext());
-}
 }
 }
 
commit 4e48432decd5c04c61bced9db71e866b54370ac3
Author: Michael Stahl 
Date:   Wed Oct 5 12:32:49 2016 +0200

sw: remove correctMarksAbsolute pre-condition check for now...

... in case the post-condition check fails it can be added for debugging.

Change-Id: Id3ee0895af598080a8bda10e8e9edff883188cbc

diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index 25f6b80..854ad5e 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -569,9 +569,6 @@ namespace sw { namespace mark
 const SwPosition& rNewPos,
 const sal_Int32 nOffset)
 {
-SAL_INFO("sw.core", "correctMarksAbsolute entry");
-lcl_DebugMarks(m_vAllMarks);
-
 const SwNode* const pOldNode = ();
 SwPosition aNewPos(rNewPos);
 aNewPos.nContent += nOffset;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2016-09-27 Thread Takeshi Abe
 sw/qa/extras/rtfimport/data/tdf90697.rtf |   73 +++
 sw/qa/extras/rtfimport/rtfimport.cxx |7 ++
 sw/source/core/inc/node2lay.hxx  |1 
 sw/source/core/inc/rolbck.hxx|1 
 sw/source/core/inc/tblrwcl.hxx   |2 
 sw/source/core/inc/threadmanager.hxx |1 
 sw/source/core/inc/txtfly.hxx|2 
 sw/source/core/inc/txtfrm.hxx|2 
 sw/source/core/inc/unoevent.hxx  |2 
 sw/source/core/inc/unofield.hxx  |2 
 sw/source/core/inc/unofootnote.hxx   |1 
 sw/source/core/inc/unoparaframeenum.hxx  |1 
 sw/source/core/inc/unoport.hxx   |1 
 sw/source/core/inc/unorefmark.hxx|1 
 sw/source/core/inc/unosection.hxx|2 
 sw/source/core/inc/unotextmarkup.hxx |1 
 16 files changed, 80 insertions(+), 20 deletions(-)

New commits:
commit 7664d30a9ab9b941e05a33cb1ddae3c92ddff288
Author: Takeshi Abe 
Date:   Tue Sep 27 00:15:49 2016 +0900

sw: Drop unused forward declarations

Change-Id: I2913466f8fa87b3c377a1abf65b8ccc477b73f40
Reviewed-on: https://gerrit.libreoffice.org/29311
Tested-by: Jenkins 
Reviewed-by: Noel Grandin 

diff --git a/sw/source/core/inc/node2lay.hxx b/sw/source/core/inc/node2lay.hxx
index 3cec60f..5531079 100644
--- a/sw/source/core/inc/node2lay.hxx
+++ b/sw/source/core/inc/node2lay.hxx
@@ -50,7 +50,6 @@ class SwLayoutFrame;
 class SwNode;
 class SwNodes;
 class Point;
-struct SwPosition;
 
 class SwNode2Layout
 {
diff --git a/sw/source/core/inc/rolbck.hxx b/sw/source/core/inc/rolbck.hxx
index e8785dc..5476cb7 100644
--- a/sw/source/core/inc/rolbck.hxx
+++ b/sw/source/core/inc/rolbck.hxx
@@ -32,7 +32,6 @@ namespace sfx2 {
 
 class SwDoc;
 class SwFormatColl;
-class SwHistoryHint;
 class SwTextAttr;
 class SfxPoolItem;
 class SwUndoSaveSection;
diff --git a/sw/source/core/inc/tblrwcl.hxx b/sw/source/core/inc/tblrwcl.hxx
index 5d85859..8646600 100644
--- a/sw/source/core/inc/tblrwcl.hxx
+++ b/sw/source/core/inc/tblrwcl.hxx
@@ -39,8 +39,6 @@ class SwContentNode;
 class SfxPoolItem;
 class SwShareBoxFormats;
 class SwFormatFrameSize;
-struct CpyPara;
-struct InsULPara;
 
 void sw_LineSetHeadCondColl( const SwTableLine* pLine );
 
diff --git a/sw/source/core/inc/threadmanager.hxx 
b/sw/source/core/inc/threadmanager.hxx
index d5b9ee6..4a88827 100644
--- a/sw/source/core/inc/threadmanager.hxx
+++ b/sw/source/core/inc/threadmanager.hxx
@@ -26,7 +26,6 @@
 #include 
 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/sw/source/core/inc/txtfly.hxx b/sw/source/core/inc/txtfly.hxx
index c6a967e..5c22fef 100644
--- a/sw/source/core/inc/txtfly.hxx
+++ b/sw/source/core/inc/txtfly.hxx
@@ -27,9 +27,7 @@
 class OutputDevice;
 class SwContentFrame;
 class SwPageFrame;
-class SwTextFly;
 class SdrObject;
-class SwTextPaintInfo;
 class SwFormat;
 class TextRanger;
 class SwAnchoredObject;
diff --git a/sw/source/core/inc/txtfrm.hxx b/sw/source/core/inc/txtfrm.hxx
index de06443..43f6210 100644
--- a/sw/source/core/inc/txtfrm.hxx
+++ b/sw/source/core/inc/txtfrm.hxx
@@ -42,8 +42,6 @@ struct SwCursorMoveState;
 struct SwFillData;
 class SwPortionHandler;
 class SwScriptInfo;
-class SwViewOption;
-class SwWrongList;
 
 #define NON_PRINTING_CHARACTER_COLOR RGB_COLORDATA(0x26, 0x8b, 0xd2)
 
diff --git a/sw/source/core/inc/unoevent.hxx b/sw/source/core/inc/unoevent.hxx
index 2224db7..452ff9d 100644
--- a/sw/source/core/inc/unoevent.hxx
+++ b/sw/source/core/inc/unoevent.hxx
@@ -24,12 +24,10 @@
 #include 
 
 class SvxMacroItem;
-class SvxMacro;
 class SwXFrame;
 class SwXTextFrame;
 class SwXTextGraphicObject;
 class SwXTextEmbeddedObject;
-class SwXFrameStyle;
 class SwFormatINetFormat;
 
 class SwHyperlinkEventDescriptor : public SvDetachedEventDescriptor
diff --git a/sw/source/core/inc/unofield.hxx b/sw/source/core/inc/unofield.hxx
index 9b9e888..5762e93 100644
--- a/sw/source/core/inc/unofield.hxx
+++ b/sw/source/core/inc/unofield.hxx
@@ -34,9 +34,7 @@
 class SwFieldType;
 class SwDoc;
 class SwFormatField;
-class SwField;
 class SwSetExpField;
-class SwTextAPIObject;
 
 typedef ::cppu::WeakImplHelper
 <   css::beans::XPropertySet
diff --git a/sw/source/core/inc/unofootnote.hxx 
b/sw/source/core/inc/unofootnote.hxx
index 705c03c..f199086 100644
--- a/sw/source/core/inc/unofootnote.hxx
+++ b/sw/source/core/inc/unofootnote.hxx
@@ -32,7 +32,6 @@
 #include 
 
 class SwDoc;
-class SwModify;
 class SwFormatFootnote;
 
 typedef ::cppu::WeakImplHelper
diff --git a/sw/source/core/inc/unoparaframeenum.hxx 
b/sw/source/core/inc/unoparaframeenum.hxx
index 9584ab9..dfdcebc 100644
--- a/sw/source/core/inc/unoparaframeenum.hxx
+++ b/sw/source/core/inc/unoparaframeenum.hxx
@@ -32,7 +32,6 @@
 #include 
 
 
-class SwDepend;
 class SwNodeIndex;
 class SwPaM;
 class SwFrameFormat;
diff --git a/sw/source/core/inc/unoport.hxx b/sw/source/core/inc/unoport.hxx
index 

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

2016-05-03 Thread Michael Stahl
 sw/qa/extras/uiwriter/uiwriter.cxx |   40 +
 sw/source/core/txtnode/ndtxt.cxx   |3 +-
 sw/source/uibase/fldui/fldmgr.cxx  |   11 +++---
 3 files changed, 50 insertions(+), 4 deletions(-)

New commits:
commit 39d719a80d8c87856c84e3ecd569d45fa6f8a30e
Author: Michael Stahl 
Date:   Tue May 3 11:39:37 2016 +0200

tdf#99529 sw: don't pop up input field dialog before inserting field

The dialog calls SwEditShell::UpdateFields(), so if there is already
a existing field at the current cursor position it will be "updated"
before the new field is inserted.

Change-Id: I8ddbbe00534950759781a1ce8d0dca0376663462

diff --git a/sw/source/uibase/fldui/fldmgr.cxx 
b/sw/source/uibase/fldui/fldmgr.cxx
index e9e586c..0b5ef6d 100644
--- a/sw/source/uibase/fldui/fldmgr.cxx
+++ b/sw/source/uibase/fldui/fldmgr.cxx
@@ -1185,9 +1185,6 @@ bool SwFieldMgr::InsertField(
 new SwInputField( pTyp, rData.m_sPar1, rData.m_sPar2, 
nSubType|nsSwExtendedSubType::SUB_INVISIBLE, nFormatId);
 pField = pInpField;
 }
-
-// start dialog
-pCurShell->StartInputFieldDlg(pField, false, rData.m_pParent);
 break;
 }
 
@@ -1329,6 +1326,14 @@ bool SwFieldMgr::InsertField(
 
 pCurShell->Insert( *pField );
 
+if (TYP_INPUTFLD == rData.m_nTypeId)
+{
+// start dialog, not before the field is inserted tdf#99529
+pCurShell->Left(CRSR_SKIP_CHARS,
+false, (INP_VAR == (nSubType & 0xff)) ? 1 : 2, false );
+pCurShell->StartInputFieldDlg(pField, false, rData.m_pParent);
+}
+
 if(bExp && bEvalExp)
 pCurShell->UpdateExpFields(true);
 
commit 20ae3d14187dacce2c2a1d2eab389e6110fe8442
Author: Michael Stahl 
Date:   Tue May 3 10:53:59 2016 +0200

tdf#98512 sw: add unit test

... and fix the SAL_WARN not to warn spuriously.

Change-Id: Ic951fc0d811e5cab39989285d34bdd2fff8f95fd

diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx 
b/sw/qa/extras/uiwriter/uiwriter.cxx
index 11a0824..fca4a79 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -112,6 +112,7 @@ public:
 void testFdo75110();
 void testFdo75898();
 void testFdo74981();
+void testTdf98512();
 void testShapeTextboxSelect();
 void testShapeTextboxDelete();
 void testCp171();
@@ -211,6 +212,7 @@ public:
 CPPUNIT_TEST(testFdo75110);
 CPPUNIT_TEST(testFdo75898);
 CPPUNIT_TEST(testFdo74981);
+CPPUNIT_TEST(testTdf98512);
 CPPUNIT_TEST(testShapeTextboxSelect);
 CPPUNIT_TEST(testShapeTextboxDelete);
 CPPUNIT_TEST(testCp171);
@@ -701,6 +703,44 @@ void SwUiWriterTest::testFdo74981()
 CPPUNIT_ASSERT(!pTextNode->HasHints());
 }
 
+void SwUiWriterTest::testTdf98512()
+{
+SwDoc* pDoc = createDoc();
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+SwInputFieldType *const pType(static_cast(
+pWrtShell->GetFieldType(0, RES_INPUTFLD)));
+SwInputField aField1(pType, OUString("foo"), OUString("bar"), INP_TXT, 0);
+pWrtShell->Insert(aField1);
+pWrtShell->SttEndDoc(/*bStt=*/true);
+SwInputField aField2(pType, OUString("baz"), OUString("quux"), INP_TXT, 0);
+pWrtShell->Insert(aField2);
+pWrtShell->SttEndDoc(/*bStt=*/true);
+pWrtShell->SetMark();
+pWrtShell->SttEndDoc(/*bStt=*/false);
+OUString const expected1(
+OUStringLiteral1() + "foo" + 
OUStringLiteral1());
+OUString const expected2(
+OUStringLiteral1() + "baz" + 
OUStringLiteral1()
++ expected1);
+CPPUNIT_ASSERT_EQUAL(expected2, 
pWrtShell->getShellCursor(false)->GetText());
+sw::UndoManager& rUndoManager = pDoc->GetUndoManager();
+rUndoManager.Undo();
+pWrtShell->SttEndDoc(/*bStt=*/true);
+pWrtShell->SetMark();
+pWrtShell->SttEndDoc(/*bStt=*/false);
+CPPUNIT_ASSERT_EQUAL(expected1, 
pWrtShell->getShellCursor(false)->GetText());
+rUndoManager.Redo();
+pWrtShell->SttEndDoc(/*bStt=*/true);
+pWrtShell->SetMark();
+pWrtShell->SttEndDoc(/*bStt=*/false);
+CPPUNIT_ASSERT_EQUAL(expected2, 
pWrtShell->getShellCursor(false)->GetText());
+rUndoManager.Undo();
+pWrtShell->SttEndDoc(/*bStt=*/true);
+pWrtShell->SetMark();
+pWrtShell->SttEndDoc(/*bStt=*/false);
+CPPUNIT_ASSERT_EQUAL(expected1, 
pWrtShell->getShellCursor(false)->GetText());
+}
+
 void SwUiWriterTest::testShapeTextboxSelect()
 {
 SwDoc* pDoc = createDoc("shape-textbox.odt");
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index ecc1d37..62b8024 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -1940,6 +1940,7 @@ OUString SwTextNode::InsertText( const OUString & rStr, 
const SwIndex & rIdx,
 
 if ( HasHints() )
 {
+bool const bHadHints(!m_pSwpHints->CanBeDeleted());

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

2016-01-20 Thread Miklos Vajna
 sw/qa/extras/tiledrendering/tiledrendering.cxx   |4 
 sw/source/core/txtnode/fntcache.cxx  |  106 +++
 writerfilter/source/dmapper/DomainMapperTableHandler.cxx |6 
 writerfilter/source/dmapper/DomainMapperTableHandler.hxx |3 
 4 files changed, 59 insertions(+), 60 deletions(-)

New commits:
commit 3e58329130038fe5f53ce645b738b40df7507bfc
Author: Miklos Vajna 
Date:   Wed Jan 20 09:35:45 2016 +0100

sw: indentation fixes

Change-Id: I8b281b425483fb7fc3cf34e31533c2ddc1b03637

diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx 
b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index 6d5cb78..160f3aa 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -82,8 +82,8 @@ private:
 
 SwTiledRenderingTest::SwTiledRenderingTest()
 : m_bFound(true),
-m_nSelectionBeforeSearchResult(0),
-m_nSelectionAfterSearchResult(0)
+  m_nSelectionBeforeSearchResult(0),
+  m_nSelectionAfterSearchResult(0)
 {
 }
 
diff --git a/sw/source/core/txtnode/fntcache.cxx 
b/sw/source/core/txtnode/fntcache.cxx
index 4f08a87..3f54a17 100644
--- a/sw/source/core/txtnode/fntcache.cxx
+++ b/sw/source/core/txtnode/fntcache.cxx
@@ -208,61 +208,61 @@ struct CalcLinePosData
 static void lcl_calcLinePos( const CalcLinePosData ,
 Point , Point , sal_Int32 nStart, sal_Int32 nWrLen )
 {
-   long nBlank = 0;
-   const sal_Int32 nEnd = nStart + nWrLen;
-   const long nTmpSpaceAdd = rData.rInf.GetSpace() / SPACING_PRECISION_FACTOR;
+long nBlank = 0;
+const sal_Int32 nEnd = nStart + nWrLen;
+const long nTmpSpaceAdd = rData.rInf.GetSpace() / SPACING_PRECISION_FACTOR;
 
-   if ( nEnd < rData.nCnt
+if ( nEnd < rData.nCnt
&& CH_BLANK == rData.rInf.GetText()[ rData.rInf.GetIdx() + nEnd ] )
-   {
-   if( nEnd + 1 == rData.nCnt )
-   nBlank -= nTmpSpaceAdd;
-   else
-   nBlank -= rData.nHalfSpace;
-   }
-
-   // determine start, end and length of wave line
-   sal_Int32 nKernStart = nStart ? rData.pKernArray[ nStart - 1 ] : 0;
-   sal_Int32 nKernEnd = rData.pKernArray[ nEnd - 1 ];
-
-   const sal_uInt16 nDir = rData.bBidiPor ? 1800 :
-   UnMapDirection( rData.rFont.GetOrientation(), rData.bSwitchH2V );
-
-   switch ( nDir )
-   {
-   case 0 :
-   rStart.X() += nKernStart;
-   rEnd.X() = nBlank + rData.rInf.GetPos().X() + nKernEnd;
-   rEnd.Y() = rData.rInf.GetPos().Y();
-   break;
-   case 900 :
-   rStart.Y() -= nKernStart;
-   rEnd.X() = rData.rInf.GetPos().X();
-   rEnd.Y() = nBlank + rData.rInf.GetPos().Y() - nKernEnd;
-   break;
-   case 1800 :
-   rStart.X() -= nKernStart;
-   rEnd.X() = rData.rInf.GetPos().X() - nKernEnd - nBlank;
-   rEnd.Y() = rData.rInf.GetPos().Y();
-   break;
-   case 2700 :
-   rStart.Y() += nKernStart;
-   rEnd.X() = rData.rInf.GetPos().X();
-   rEnd.Y() = nBlank + rData.rInf.GetPos().Y() + nKernEnd;
-   break;
-   }
-
-   if ( rData.bSwitchL2R )
-   {
-   rData.rInf.GetFrame()->SwitchLTRtoRTL( rStart );
-   rData.rInf.GetFrame()->SwitchLTRtoRTL( rEnd );
-   }
-
-   if ( rData.bSwitchH2V )
-   {
-   rData.rInf.GetFrame()->SwitchHorizontalToVertical( rStart );
-   rData.rInf.GetFrame()->SwitchHorizontalToVertical( rEnd );
-   }
+{
+if( nEnd + 1 == rData.nCnt )
+nBlank -= nTmpSpaceAdd;
+else
+nBlank -= rData.nHalfSpace;
+}
+
+// determine start, end and length of wave line
+sal_Int32 nKernStart = nStart ? rData.pKernArray[ nStart - 1 ] : 0;
+sal_Int32 nKernEnd = rData.pKernArray[ nEnd - 1 ];
+
+const sal_uInt16 nDir = rData.bBidiPor ? 1800 :
+UnMapDirection( rData.rFont.GetOrientation(), rData.bSwitchH2V );
+
+switch ( nDir )
+{
+case 0 :
+rStart.X() += nKernStart;
+rEnd.X() = nBlank + rData.rInf.GetPos().X() + nKernEnd;
+rEnd.Y() = rData.rInf.GetPos().Y();
+break;
+case 900 :
+rStart.Y() -= nKernStart;
+rEnd.X() = rData.rInf.GetPos().X();
+rEnd.Y() = nBlank + rData.rInf.GetPos().Y() - nKernEnd;
+break;
+case 1800 :
+rStart.X() -= nKernStart;
+rEnd.X() = rData.rInf.GetPos().X() - nKernEnd - nBlank;
+rEnd.Y() = rData.rInf.GetPos().Y();
+break;
+case 2700 :
+rStart.Y() += nKernStart;
+rEnd.X() = rData.rInf.GetPos().X();
+rEnd.Y() = nBlank + rData.rInf.GetPos().Y() + nKernEnd;
+break;
+}
+
+if ( rData.bSwitchL2R )
+{
+rData.rInf.GetFrame()->SwitchLTRtoRTL( rStart );
+rData.rInf.GetFrame()->SwitchLTRtoRTL( rEnd );
+}
+
+if ( rData.bSwitchH2V )
+{
+rData.rInf.GetFrame()->SwitchHorizontalToVertical( rStart );
+rData.rInf.GetFrame()->SwitchHorizontalToVertical( rEnd );
+}
 }
 
 // Returns the Ascent of the Font on the given output device;
commit 

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

2016-01-08 Thread Miklos Vajna
 sw/qa/extras/uiwriter/uiwriter.cxx |   30 --
 sw/source/core/layout/calcmove.cxx |5 +++--
 sw/source/core/layout/wsfrm.cxx|   18 --
 3 files changed, 47 insertions(+), 6 deletions(-)

New commits:
commit 49b67cdc36b599f865d4a6de214d901861f27196
Author: Miklos Vajna 
Date:   Fri Jan 8 17:10:17 2016 +0100

tdf#96961 sw Hide Whitespace: still show whitespace on the last page

Mainly to match Word's hide whitespace behavior.

Change-Id: Ica09bca5004adbfa14d1c9aca04079129f8a1a68

diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx 
b/sw/qa/extras/uiwriter/uiwriter.cxx
index f87b176..5d49784 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -180,6 +180,7 @@ public:
 void testTdf96943();
 void testTdf96536();
 void testTdf96479();
+void testTdf96961();
 
 CPPUNIT_TEST_SUITE(SwUiWriterTest);
 CPPUNIT_TEST(testReplaceForward);
@@ -266,6 +267,7 @@ public:
 CPPUNIT_TEST(testTdf96943);
 CPPUNIT_TEST(testTdf96536);
 CPPUNIT_TEST(testTdf96479);
+CPPUNIT_TEST(testTdf96961);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -3087,6 +3089,26 @@ void SwUiWriterTest::testTdf96479()
 }
 }
 
+void SwUiWriterTest::testTdf96961()
+{
+// Insert a page break.
+SwDoc* pDoc = createDoc();
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+pWrtShell->InsertPageBreak();
+
+// Enable hide whitespace mode.
+SwViewOption aViewOptions(*pWrtShell->GetViewOptions());
+aViewOptions.SetHideWhitespaceMode(true);
+pWrtShell->ApplyViewOptions(aViewOptions);
+
+calcLayout();
+
+// Assert that the height of the last page is larger than the height of 
other pages.
+sal_Int32 nOther = parseDump("/root/page[1]/infos/bounds", 
"height").toInt32();
+sal_Int32 nLast = parseDump("/root/page[2]/infos/bounds", 
"height").toInt32();
+CPPUNIT_ASSERT(nLast > nOther);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest);
 CPPUNIT_PLUGIN_IMPLEMENT();
 
diff --git a/sw/source/core/layout/calcmove.cxx 
b/sw/source/core/layout/calcmove.cxx
index 84daf90..94358bd 100644
--- a/sw/source/core/layout/calcmove.cxx
+++ b/sw/source/core/layout/calcmove.cxx
@@ -740,7 +740,8 @@ void SwPageFrame::MakeAll(vcl::RenderContext* 
pRenderContext)
 }
 assert(pAttrs);
 
-SwViewShell *pSh = getRootFrame()->GetCurrShell();
+SwRootFrame* pRootFrame = getRootFrame();
+SwViewShell* pSh = pRootFrame->GetCurrShell();
 if (pSh && pSh->GetViewOptions()->getBrowseMode())
 {
 // In BrowseView, we use fixed settings
@@ -787,7 +788,7 @@ void SwPageFrame::MakeAll(vcl::RenderContext* 
pRenderContext)
 mbValidSize = mbValidPrtArea = true;
 continue;
 }
-else if (pSh && pSh->GetViewOptions()->IsWhitespaceHidden())
+else if (pSh && pSh->GetViewOptions()->IsWhitespaceHidden() && 
pRootFrame->GetLastPage() != this)
 {
 long height = 0;
 SwLayoutFrame *pBody = FindBodyCont();
diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx
index 0f60476..032177a 100644
--- a/sw/source/core/layout/wsfrm.cxx
+++ b/sw/source/core/layout/wsfrm.cxx
@@ -2947,11 +2947,25 @@ void SwLayoutFrame::Format( vcl::RenderContext* 
/*pRenderContext*/, const SwBord
 if ( mbValidPrtArea && mbValidSize )
 return;
 
+bool bHideWhitespace = false;
+if (IsPageFrame())
+{
+SwViewShell* pShell = getRootFrame()->GetCurrShell();
+if (pShell && pShell->GetViewOptions()->IsWhitespaceHidden())
+{
+// This is needed so that no space is reserved for the margin on
+// the last page of the document. Other pages would have no margin
+// set even without this, as their frame height is the content
+// height already.
+bHideWhitespace = true;
+}
+}
+
 const sal_uInt16 nLeft = (sal_uInt16)pAttrs->CalcLeft(this);
-const sal_uInt16 nUpper = pAttrs->CalcTop();
+const sal_uInt16 nUpper = bHideWhitespace ? 0 : pAttrs->CalcTop();
 
 const sal_uInt16 nRight = (sal_uInt16)pAttrs->CalcRight(this);
-const sal_uInt16 nLower = pAttrs->CalcBottom();
+const sal_uInt16 nLower = bHideWhitespace ? 0 : pAttrs->CalcBottom();
 
 const bool bVert = IsVertical() && !IsPageFrame();
 SwRectFn fnRect = bVert ? ( IsVertLR() ? fnRectVertL2R : fnRectVert ) : 
fnRectHori;
commit cd51e0153a25f3950be54dd7fd58a0de6e148ae2
Author: Miklos Vajna 
Date:   Fri Jan 8 14:56:26 2016 +0100

CppunitTest_sw_uiwriter: don't assert the size of the last page

The size of the last page will change in a bit in Hide Whitespace mode,
the intention of the test is to check the 

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

2016-01-07 Thread Miklos Vajna
 sw/qa/extras/uiwriter/data/tdf96943.odt |binary
 sw/qa/extras/uiwriter/uiwriter.cxx  |   19 +++
 sw/source/core/inc/pagefrm.hxx  |3 +++
 sw/source/core/layout/calcmove.cxx  |   32 ++--
 sw/source/core/layout/pagechg.cxx   |   28 
 sw/source/core/text/widorp.cxx  |9 -
 6 files changed, 64 insertions(+), 27 deletions(-)

New commits:
commit 59ae2d11d5884ffdf77dec95d8cd2566943fd789
Author: Miklos Vajna 
Date:   Thu Jan 7 14:54:36 2016 +0100

Related: tdf#96943 sw Hide Whitespace: add HandleWhitespaceHiddenDiff()

To have the "we want the difference vs the nominal size, not the actual
size" code at a single place.

Change-Id: I9b4b9a33d5d2da825c5da93e69790277eba8d0b3

diff --git a/sw/source/core/inc/pagefrm.hxx b/sw/source/core/inc/pagefrm.hxx
index 840c580..2df4c1d 100644
--- a/sw/source/core/inc/pagefrm.hxx
+++ b/sw/source/core/inc/pagefrm.hxx
@@ -334,6 +334,9 @@ public:
 static const vcl::Font& GetEmptyPageFont();
 
 static SwTwips GetSidebarBorderWidth( const SwViewShell* );
+
+/// Adjust a bottom-of-page-frame - bottom-of-text-frame difference in 
case whitespace is hidden.
+void HandleWhitespaceHiddenDiff(SwTwips& nDiff);
 };
 
 inline SwContentFrame *SwPageFrame::FindFirstBodyContent()
diff --git a/sw/source/core/layout/calcmove.cxx 
b/sw/source/core/layout/calcmove.cxx
index 21d479a..84daf90 100644
--- a/sw/source/core/layout/calcmove.cxx
+++ b/sw/source/core/layout/calcmove.cxx
@@ -1522,32 +1522,12 @@ void SwContentFrame::MakeAll(vcl::RenderContext* 
/*pRenderContext*/)
 const long nPrtBottom = (GetUpper()->*fnRect->fnGetPrtBottom)();
 long nBottomDist = (Frame().*fnRect->fnBottomDist)(nPrtBottom);
 
-SwViewShell* pShell = getRootFrame()->GetCurrShell();
-if (pShell && pShell->GetViewOptions()->IsWhitespaceHidden())
-{
-// When whitespace is hidden, the page frame has two heights: the
-// nominal (defined by the frame format), and the actual (which is
-// at most the nominal height, but can be smaller in case there is
-// no content for the whole page).
-// The layout size is the actual one, but we want to move the
-// content frame to a new page only in case it doesn't fit the
-// nominal size.
-if (nBottomDist < 0)
-{
-// Content frame doesn't fit the actual size, check if it fits 
the nominal one.
-SwPageFrame* pPageFrame = FindPageFrame();
-const SwFrameFormat* pPageFormat = static_cast(pPageFrame->GetRegisteredIn());
-const Size& rPageSize = pPageFormat->GetFrameSize().GetSize();
-long nWhitespace = rPageSize.getHeight() - 
pPageFrame->Frame().Height();
-if (nWhitespace > -nBottomDist)
-{
-// It does: don't move it and invalidate our page frame so
-// that it gets a larger height.
-nBottomDist = 0;
-pPageFrame->InvalidateSize();
-}
-}
-}
+// Hide whitespace may require not to insert a new page.
+SwPageFrame* pPageFrame = FindPageFrame();
+long nOldBottomDist = nBottomDist;
+pPageFrame->HandleWhitespaceHiddenDiff(nBottomDist);
+if (nOldBottomDist != nBottomDist)
+pPageFrame->InvalidateSize();
 
 if( nBottomDist >= 0 )
 {
diff --git a/sw/source/core/layout/pagechg.cxx 
b/sw/source/core/layout/pagechg.cxx
index 34adb7a..967ee2f 100644
--- a/sw/source/core/layout/pagechg.cxx
+++ b/sw/source/core/layout/pagechg.cxx
@@ -2287,6 +2287,34 @@ bool SwPageFrame::IsOverHeaderFooterArea( const Point& 
rPt, FrameControlType 
 return false;
 }
 
+void SwPageFrame::HandleWhitespaceHiddenDiff(SwTwips& nDiff)
+{
+SwViewShell* pShell = getRootFrame()->GetCurrShell();
+if (pShell && pShell->GetViewOptions()->IsWhitespaceHidden())
+{
+// When whitespace is hidden, the page frame has two heights: the
+// nominal (defined by the frame format), and the actual (which is
+// at most the nominal height, but can be smaller in case there is
+// no content for the whole page).
+// The layout size is the actual one, but we want to move the
+// content frame to a new page only in case it doesn't fit the
+// nominal size.
+if (nDiff < 0)
+{
+// Content frame doesn't fit the actual size, check if it fits the 
nominal one.
+const SwFrameFormat* pPageFormat = static_cast(GetRegisteredIn());
+const Size& rPageSize = pPageFormat->GetFrameSize().GetSize();
+long nWhitespace = rPageSize.getHeight() - Frame().Height();
+if (nWhitespace > -nDiff)
+{
+

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

2015-11-11 Thread Caolán McNamara
 sw/qa/extras/ww8import/data/tdf95321.doc |binary
 sw/qa/extras/ww8import/ww8import.cxx |   10 ++
 sw/source/filter/ww8/ww8par.cxx  |2 +-
 tools/source/generic/gen.cxx |8 
 4 files changed, 11 insertions(+), 9 deletions(-)

New commits:
commit 6128c10f550924c2b75f18b6c6220cc1770adba4
Author: Caolán McNamara 
Date:   Wed Nov 11 12:34:01 2015 +

Resolves: tdf#95321 tables in headers/footers with wrong content

Change-Id: I937ed893dfd9919bf48b8fd38a1b83c524200532

diff --git a/sw/qa/extras/ww8import/data/tdf95321.doc 
b/sw/qa/extras/ww8import/data/tdf95321.doc
new file mode 100644
index 000..8b85472
Binary files /dev/null and b/sw/qa/extras/ww8import/data/tdf95321.doc differ
diff --git a/sw/qa/extras/ww8import/ww8import.cxx 
b/sw/qa/extras/ww8import/ww8import.cxx
index 600ca41..7e9307b 100644
--- a/sw/qa/extras/ww8import/ww8import.cxx
+++ b/sw/qa/extras/ww8import/ww8import.cxx
@@ -419,6 +419,16 @@ DECLARE_WW8IMPORT_TEST(testBnc863018, "bnc863018.doc")
 CPPUNIT_ASSERT_EQUAL(sal_Int32(5002), getProperty(xTable, 
"TopMargin"));
 }
 
+DECLARE_WW8IMPORT_TEST(testTdf95321, "tdf95321.doc")
+{
+// The problem was that there should be content in the second cell
+// but there wasn't.
+uno::Reference xTextTablesSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xIndexAccess(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
+uno::Reference xTable(xIndexAccess->getByIndex(0), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString("Second Column"), 
uno::Reference(xTable->getCellByName("B1"), 
uno::UNO_QUERY)->getString());
+}
+
 DECLARE_WW8IMPORT_TEST(testBnc875715, "bnc875715.doc")
 {
 uno::Reference 
xTextSectionsSupplier(mxComponent, uno::UNO_QUERY);
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 124cd50..00c39fa 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -3540,7 +3540,7 @@ bool SwWW8ImplReader::ReadChar(long nPosCp, long nCpOfs)
 //
 //So the 0x7 should be right at the end of the previous
 //range to be a real cell-end.
-if (pPap->nOrigStartPos == nCpOfs+nPosCp+1 ||
+if (pPap->nOrigStartPos == nPosCp+1 ||
 pPap->nOrigStartPos == WW8_CP_MAX)
 {
 TabCellEnd();   // Table cell/row end
commit 2b4d7be9484d360d8361dd71d767afbcc67fdcb2
Author: Caolán McNamara 
Date:   Wed Nov 11 12:09:23 2015 +

stream version doesn't matter here

Change-Id: I5871028b6c32194257d3a5f8bdf838cd0c277349

diff --git a/tools/source/generic/gen.cxx b/tools/source/generic/gen.cxx
index 8306ef8..499ab10 100644
--- a/tools/source/generic/gen.cxx
+++ b/tools/source/generic/gen.cxx
@@ -27,8 +27,6 @@
 
 SvStream& ReadPair( SvStream& rIStream, Pair& rPair )
 {
-SAL_WARN_IF( !rIStream.GetVersion(), "tools", "Pair::>> - Solar-Version 
not set on rIStream" );
-
 sal_Int32 nTmpA(0), nTmpB(0);
 rIStream.ReadInt32( nTmpA ).ReadInt32( nTmpB );
 rPair.nA = nTmpA;
@@ -39,8 +37,6 @@ SvStream& ReadPair( SvStream& rIStream, Pair& rPair )
 
 SvStream& WritePair( SvStream& rOStream, const Pair& rPair )
 {
-SAL_WARN_IF( !rOStream.GetVersion(), "tools", "Pair::<< - Solar-Version 
not set on rOStream" );
-
 rOStream.WriteInt32( rPair.nA ).WriteInt32( rPair.nB );
 
 return rOStream;
@@ -172,8 +168,6 @@ bool Rectangle::IsOver( const Rectangle& rRect ) const
 
 SvStream& ReadRectangle( SvStream& rIStream, Rectangle& rRect )
 {
-SAL_WARN_IF( !rIStream.GetVersion(), "tools", "Rectangle::>> - 
Solar-Version not set on rIStream" );
-
 sal_Int32 nTmpL(0), nTmpT(0), nTmpR(0), nTmpB(0);
 
 rIStream.ReadInt32( nTmpL ).ReadInt32( nTmpT ).ReadInt32( nTmpR 
).ReadInt32( nTmpB );
@@ -188,8 +182,6 @@ SvStream& ReadRectangle( SvStream& rIStream, Rectangle& 
rRect )
 
 SvStream& WriteRectangle( SvStream& rOStream, const Rectangle& rRect )
 {
-SAL_WARN_IF( !rOStream.GetVersion(), "tools", "Rectangle::<< - 
Solar-Version not set on rOStream" );
-
 rOStream.WriteInt32( rRect.nLeft )
 .WriteInt32( rRect.nTop )
 .WriteInt32( rRect.nRight )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 2 commits - sw/qa sw/source test/source toolkit/source ucb/source

2015-11-05 Thread Noel Grandin
 sw/qa/extras/odfexport/odfexport.cxx  |2 
 sw/qa/extras/ooxmlexport/ooxmlexport3.cxx |2 
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx  |4 -
 sw/source/core/unocore/unochart.cxx   |6 +-
 sw/source/core/unocore/unocrsrhelper.cxx  |5 -
 sw/source/core/unocore/unodraw.cxx|6 +-
 sw/source/core/unocore/unofield.cxx   |3 -
 sw/source/filter/html/htmlform.cxx|9 +--
 sw/source/filter/ww8/docxattributeoutput.cxx  |2 
 sw/source/filter/ww8/docxsdrexport.cxx|2 
 sw/source/filter/ww8/wrtw8nds.cxx |2 
 sw/source/filter/ww8/wrtww8.cxx   |3 -
 sw/source/filter/ww8/ww8par3.cxx  |4 -
 sw/source/filter/xml/xmlfmt.cxx   |2 
 sw/source/filter/xml/xmltbli.cxx  |2 
 sw/source/ui/dbui/addresslistdialog.cxx   |2 
 sw/source/ui/dbui/dbinsdlg.cxx|2 
 sw/source/ui/envelp/mailmrge.cxx  |4 -
 sw/source/ui/index/cntex.cxx  |3 -
 sw/source/ui/vba/vbafind.cxx  |2 
 sw/source/uibase/app/apphdl.cxx   |3 -
 sw/source/uibase/dbui/dbmgr.cxx   |   20 +++
 sw/source/uibase/dbui/dbtree.cxx  |   12 ++--
 sw/source/uibase/dbui/mailmergehelper.cxx |7 --
 sw/source/uibase/dochdl/swdtflvr.cxx  |2 
 sw/source/uibase/docvw/PageBreakWin.cxx   |   12 +---
 sw/source/uibase/fldui/fldmgr.cxx |2 
 sw/source/uibase/fldui/xfldui.cxx |8 +-
 sw/source/uibase/misc/numberingtypelistbox.cxx|2 
 sw/source/uibase/uno/unoatxt.cxx  |4 -
 sw/source/uibase/uno/unodispatch.cxx  |2 
 sw/source/uibase/uno/unomailmerge.cxx |5 -
 sw/source/uibase/uno/unomodule.cxx|2 
 sw/source/uibase/uno/unotxdoc.cxx |2 
 sw/source/uibase/uno/unotxvw.cxx  |6 +-
 sw/source/uibase/utlui/unotools.cxx   |2 
 test/source/sheet/xspreadsheets2.cxx  |6 +-
 toolkit/source/awt/vclxtoolkit.cxx|3 -
 toolkit/source/awt/vclxwindow.cxx |2 
 toolkit/source/controls/controlmodelcontainerbase.cxx |8 +-
 toolkit/source/controls/formattedcontrol.cxx  |2 
 toolkit/source/controls/geometrycontrolmodel.cxx  |2 
 toolkit/source/controls/stdtabcontroller.cxx  |4 -
 ucb/source/cacher/cachedcontentresultset.cxx  |6 +-
 ucb/source/cacher/contentresultsetwrapper.cxx |5 -
 ucb/source/cacher/dynamicresultsetwrapper.cxx |6 +-
 ucb/source/core/FileAccess.cxx|2 
 ucb/source/core/provprox.cxx  |4 -
 ucb/source/core/ucb.cxx   |3 -
 ucb/source/core/ucbcmds.cxx   |3 -
 ucb/source/sorter/sortdynres.cxx  |2 
 ucb/source/sorter/sortresult.cxx  |4 -
 ucb/source/ucp/cmis/cmis_content.cxx  |6 +-
 ucb/source/ucp/cmis/cmis_datasupplier.cxx |2 
 ucb/source/ucp/file/bc.cxx|5 -
 ucb/source/ucp/file/filrset.cxx   |4 -
 ucb/source/ucp/file/prov.cxx  |2 
 ucb/source/ucp/ftp/ftpdynresultset.cxx|4 -
 ucb/source/ucp/ftp/ftpresultsetI.cxx  |2 
 ucb/source/ucp/gio/gio_content.cxx|4 -
 ucb/source/ucp/gio/gio_datasupplier.cxx   |2 
 ucb/source/ucp/hierarchy/hierarchycontent.cxx |3 -
 ucb/source/ucp/hierarchy/hierarchydata.cxx|   49 +-
 ucb/source/ucp/hierarchy/hierarchydatasource.cxx  |4 -
 ucb/source/ucp/hierarchy/hierarchydatasupplier.cxx|2 
 ucb/source/ucp/hierarchy/hierarchyprovider.cxx|6 --
 ucb/source/ucp/package/pkgcontent.cxx |3 -
 ucb/source/ucp/package/pkgdatasupplier.cxx|2 
 ucb/source/ucp/package/pkgprovider.cxx|2 
 ucb/source/ucp/tdoc/tdoc_content.cxx  |3 -
 ucb/source/ucp/tdoc/tdoc_datasupplier.cxx |2 
 ucb/source/ucp/tdoc/tdoc_documentcontentfactory.cxx   |6 --
 ucb/source/ucp/tdoc/tdoc_storage.cxx  |4 -
 ucb/source/ucp/webdav-neon/webdavcontent.cxx  |   10 +--
 ucb/source/ucp/webdav-neon/webdavdatasupplier.cxx |2 
 ucb/source/ucp/webdav/webdavcontent.cxx   |   10 +--
 ucb/source/ucp/webdav/webdavdatasupplier.cxx  |2 
 77 files changed, 152 insertions(+), 209 deletions(-)


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

2015-11-04 Thread Tobias Lippert
 sw/qa/python/check_table.py  |   70 +++
 sw/source/core/docnode/ndtbl.cxx |2 -
 sw/source/core/text/widorp.hxx   |9 -
 3 files changed, 79 insertions(+), 2 deletions(-)

New commits:
commit 20538f233fe120b33a23d594458d4639b0c9670e
Author: Tobias Lippert 
Date:   Sun Sep 27 21:30:20 2015 +0200

tdf#83910 Formatting of lines which consist of a single dummy line only

The document which is attached to the ticket runs into an infinite
loop because GetLineNr() does not increase since
only dummy lines are added during formatting.

Change-Id: I92689c776fe69bb6f62af26b577989db7f34de43
Reviewed-on: https://gerrit.libreoffice.org/18896
Tested-by: Jenkins 
Reviewed-by: Oliver Specht 

diff --git a/sw/source/core/text/widorp.hxx b/sw/source/core/text/widorp.hxx
index 18e80f1..8541848 100644
--- a/sw/source/core/text/widorp.hxx
+++ b/sw/source/core/text/widorp.hxx
@@ -71,7 +71,14 @@ public:
 // method , which isn't virtual.
 bool IsBreakNowWidAndOrp( SwTextMargin  )
 {
-return ( rLine.GetLineNr() > nOrphLines ) && IsBreakNow( rLine );
+bool isOnFirstLine = (rLine.GetLineNr() == 1 && !rLine.GetPrev());
+if ( isOnFirstLine && rLine.GetCurr()->IsDummy()) {
+return IsBreakNow( rLine );
+}
+if ( rLine.GetLineNr() > nOrphLines ) {
+return IsBreakNow( rLine );
+}
+return false;
 }
 };
 
commit aa334d55ee34c125f6f4fdfaadbc1ed8fa33f5bc
Author: Niklas Johansson 
Date:   Fri Oct 23 19:52:17 2015 +0200

Make number recognition work in writer tables again

It seems that number recognition in tables are not working properly
enter 10-10-10 and it should be converted to a date but it is not.
I tracked it down to the fix of bug fdo#32082. It looks like bSetNumFmt
was changed to false by mistake. Since then it has changed name to
bSetNumFormat. From what I can tell fdo#32082 still works after this
patch, but I might have missed some nuance of that bug report.

Added two tests, one for the bug mentioned above and one to check
that number recognition is working. At least with a simple date.

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

diff --git a/sw/qa/python/check_table.py b/sw/qa/python/check_table.py
index a5a8308..1e361cf 100644
--- a/sw/qa/python/check_table.py
+++ b/sw/qa/python/check_table.py
@@ -7,6 +7,8 @@ from com.sun.star.table import BorderLine
 from com.sun.star.table import BorderLine2
 from com.sun.star.table.BorderLineStyle import (DOUBLE, SOLID, EMBOSSED,\
 THICKTHIN_LARGEGAP, DASHED, DOTTED)
+from com.sun.star.util import XNumberFormats
+from com.sun.star.lang import Locale
 
 class CheckTable(unittest.TestCase):
 _uno = None
@@ -450,6 +452,74 @@ class CheckTable(unittest.TestCase):
 self.assertEqual(
 [int(txtval) for txtval in xSeq.TextualData],
 [val forval in expectedValues[col]])
+xDoc.dispose()
+
+def test_tdf32082(self):
+xDoc = CheckTable._uno.openEmptyWriterDoc()
+xDocFrame = xDoc.CurrentController.Frame
+xContext = CheckTable._uno.getContext()
+xServiceManager = xContext.ServiceManager
+xDispatcher = xServiceManager.createInstanceWithContext(
+'com.sun.star.frame.DispatchHelper', xContext)
+xTable = xDoc.createInstance("com.sun.star.text.TextTable")
+xTable.initialize(1,1)
+xCursor = xDoc.Text.createTextCursor()
+xDoc.Text.insertTextContent(xCursor, xTable, False)
+# Setup numberformat for the cell
+xNumberFormats = xDoc.NumberFormats
+xLocale = Locale('en', 'US', '')
+formatString = '#,##0.00 [$€-407];[RED]-#,##0.00 [$€-407]'
+key = xNumberFormats.queryKey(formatString, xLocale, True)
+if key == -1:
+key = xNumberFormats.addNew(formatString, xLocale)
+# Apply the format on the first cell
+xTable.getCellByPosition(0,0).NumberFormat = key
+xDispatcher.executeDispatch(xDocFrame, '.uno:GoToStartOfDoc', '', 0, 
())
+xDispatcher.executeDispatch(xDocFrame, '.uno:InsertText', '', 0,
+   (PropertyValue('Text', 0, '3', 0),))
+xDispatcher.executeDispatch(xDocFrame, '.uno:JumpToNextCell', '', 0, 
())
+# Check that the formatting we set up is not destroyed
+self.assertEquals(xTable.getCellByPosition(0,0).getString(), '3.00 
€')
+self.assertEquals(xTable.getCellByPosition(0,0).getValue(), 3)
+# Verify that it works with number recognition turned on as well
+xDispatcher.executeDispatch(xDocFrame, 

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

2015-10-06 Thread Miklos Vajna
 sw/qa/extras/tiledrendering/tiledrendering.cxx |7 +
 sw/source/uibase/uiview/viewsrch.cxx   |   92 +
 2 files changed, 57 insertions(+), 42 deletions(-)

New commits:
commit 58c38e7ea5debc5440f1d81acf38d8d6ad0883d8
Author: Miklos Vajna 
Date:   Tue Oct 6 14:17:43 2015 +0200

sw tiled rendering: emit LOK_CALLBACK_SEARCH_RESULT* for normal search

We used to emit these for find-all only, for no good reason.

Change-Id: Id07dc7649f9a8528b9d4ec16d5f7c651fd607111

diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx 
b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index 2fd27dd..1eb57de 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -342,7 +342,10 @@ void lcl_search(bool bBackward)
 void SwTiledRenderingTest::testSearch()
 {
 #if !defined(WNT) && !defined(MACOSX)
+comphelper::LibreOfficeKit::setActive();
+
 SwXTextDocument* pXTextDocument = createDoc("search.odt");
+pXTextDocument->registerCallback(::callback, this);
 SwWrtShell* pWrtShell = pXTextDocument->GetDocShell()->GetWrtShell();
 size_t nNode = 
pWrtShell->getShellCrsr(false)->Start()->nNode.GetNode().GetIndex();
 
@@ -351,6 +354,8 @@ void SwTiledRenderingTest::testSearch()
 CPPUNIT_ASSERT(!pWrtShell->GetDrawView()->GetTextEditObject());
 size_t nActual = 
pWrtShell->getShellCrsr(false)->Start()->nNode.GetNode().GetIndex();
 CPPUNIT_ASSERT_EQUAL(nNode + 1, nActual);
+/// Make sure we get search result selection for normal find as well, not 
only find all.
+CPPUNIT_ASSERT(!m_aSearchResultSelection.empty());
 
 // Next hit, in the shape.
 lcl_search(false);
@@ -375,6 +380,8 @@ void SwTiledRenderingTest::testSearch()
 CPPUNIT_ASSERT(!pWrtShell->GetDrawView()->GetTextEditObject());
 nActual = 
pWrtShell->getShellCrsr(false)->Start()->nNode.GetNode().GetIndex();
 CPPUNIT_ASSERT_EQUAL(nNode + 1, nActual);
+
+comphelper::LibreOfficeKit::setActive(false);
 #endif
 }
 
diff --git a/sw/source/uibase/uiview/viewsrch.cxx 
b/sw/source/uibase/uiview/viewsrch.cxx
index 7d34a2a..3427fe4 100644
--- a/sw/source/uibase/uiview/viewsrch.cxx
+++ b/sw/source/uibase/uiview/viewsrch.cxx
@@ -253,7 +253,11 @@ void SwView::ExecSearch(SfxRequest& rReq, bool bNoMessage)
 {
 bool bRet = SearchAndWrap(bApi);
 if( bRet )
+{
 Scroll(m_pWrtShell->GetCharRect().SVRect());
+if (comphelper::LibreOfficeKit::isActive())
+lcl_emitSearchResultCallbacks(1, m_pSrchItem, 
m_pWrtShell);
+}
 rReq.SetReturnValue(SfxBoolItem(nSlot, bRet));
 #if HAVE_FEATURE_DESKTOP
 {
commit ca8016c3a317a7ba1f03e117d575fb78a572b4b3
Author: Miklos Vajna 
Date:   Tue Oct 6 12:29:33 2015 +0200

sw: extract lcl_emitSearchResultCallbacks() from SwView::ExecSearch()

Change-Id: I9c6b7540bcae85d6529e5cc195a7e86f58ee5713

diff --git a/sw/source/uibase/uiview/viewsrch.cxx 
b/sw/source/uibase/uiview/viewsrch.cxx
index 0b07ce5..7d34a2a 100644
--- a/sw/source/uibase/uiview/viewsrch.cxx
+++ b/sw/source/uibase/uiview/viewsrch.cxx
@@ -102,6 +102,51 @@ static void 
lcl_addContainerToJson(boost::property_tree::ptree& rTree, const OSt
 rTree.add_child(rKey.getStr(), aChildren);
 }
 
+/// Emits LOK callbacks (count, selection) for search results.
+static void lcl_emitSearchResultCallbacks(sal_uInt16 nFound, SvxSearchItem* 
pSearchItem, SwWrtShell* pWrtShell)
+{
+OString aPayload = OString::number(nFound) + ";" + 
pSearchItem->GetSearchString().toUtf8();
+pWrtShell->libreOfficeKitCallback(LOK_CALLBACK_SEARCH_RESULT_COUNT, 
aPayload.getStr());
+
+// Emit a callback also about the selection rectangles, grouped by matches.
+if (SwPaM* pPaM = pWrtShell->GetCrsr())
+{
+std::vector aMatches;
+for (SwPaM& rPaM : pPaM->GetRingContainer())
+{
+if (SwShellCrsr* pShellCrsr = dynamic_cast())
+{
+std::vector aSelectionRectangles;
+pShellCrsr->SwSelPaintRects::Show();
+std::stringstream ss;
+bool bFirst = true;
+for (size_t i = 0; i < aSelectionRectangles.size(); ++i)
+{
+const OString& rSelectionRectangle = 
aSelectionRectangles[i];
+if (rSelectionRectangle.isEmpty())
+continue;
+if (bFirst)
+bFirst = false;
+else
+ss << "; ";
+ss << rSelectionRectangle.getStr();
+}
+OString sRect = ss.str().c_str();
+aMatches.push_back(sRect);
+}
+}
+boost::property_tree::ptree aTree;
+aTree.put("searchString", 

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

2015-09-04 Thread Caolán McNamara
 sw/qa/core/data/ww8/pass/crash-4.doc   |binary
 sw/source/filter/ww8/ww8par.cxx|   17 -
 sw/source/filter/ww8/ww8par.hxx|   13 +++--
 sw/source/filter/ww8/ww8par6.cxx   |2 +-
 vcl/inc/outdevstatestack.hxx   |6 +++---
 vcl/source/outdev/outdevstatestack.cxx |4 ++--
 6 files changed, 25 insertions(+), 17 deletions(-)

New commits:
commit 01e6e93eed5efc22aa7818f50807ec68a4a3aa52
Author: Caolán McNamara 
Date:   Fri Sep 4 10:25:28 2015 +0100

vcl: replace boost::ptr_deque with std::deque

Change-Id: Id53ee54dda5454669affd5ca5324a2d7c5387063

diff --git a/vcl/inc/outdevstatestack.hxx b/vcl/inc/outdevstatestack.hxx
index 406d62b..10fa108 100644
--- a/vcl/inc/outdevstatestack.hxx
+++ b/vcl/inc/outdevstatestack.hxx
@@ -11,12 +11,12 @@
 #define INCLUDED_VCL_OUTDEVSTATESTACK_HXX
 
 #include 
-
-#include 
+#include 
+#include 
 
 class OutDevStateStack
 {
-typedef boost::ptr_deque DataType;
+typedef std::deque DataType;
 DataType maData;
 public:
 bool empty() const;
diff --git a/vcl/source/outdev/outdevstatestack.cxx 
b/vcl/source/outdev/outdevstatestack.cxx
index 0fcdcd5..24eb245 100644
--- a/vcl/source/outdev/outdevstatestack.cxx
+++ b/vcl/source/outdev/outdevstatestack.cxx
@@ -21,7 +21,7 @@ size_t OutDevStateStack::size() const
 
 void OutDevStateStack::push_back( OutDevState* p )
 {
-maData.push_back(p);
+maData.push_back(std::unique_ptr(p));
 }
 
 void OutDevStateStack::pop_back()
@@ -31,7 +31,7 @@ void OutDevStateStack::pop_back()
 
 OutDevState& OutDevStateStack::back()
 {
-return maData.back();
+return *maData.back();
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit d64105fd3a16356ff858da1497d7fd73b98f55c6
Author: Caolán McNamara 
Date:   Fri Sep 4 10:07:13 2015 +0100

drop pams before removing extraneous paras

and remove extra paras in order of largest index first

Change-Id: Iafbe612a8a8bd51cb157b4a4c07031c6603d92ee

diff --git a/sw/qa/core/data/ww8/pass/crash-4.doc 
b/sw/qa/core/data/ww8/pass/crash-4.doc
new file mode 100644
index 000..8658e0e
Binary files /dev/null and b/sw/qa/core/data/ww8/pass/crash-4.doc differ
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index d6a25cc..1142325 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -4632,9 +4632,8 @@ void wwSectionManager::InsertSegments()
 
 void wwExtraneousParas::delete_all_from_doc()
 {
-typedef std::vector::iterator myParaIter;
-myParaIter aEnd = m_aTextNodes.end();
-for (myParaIter aI = m_aTextNodes.begin(); aI != aEnd; ++aI)
+auto aEnd = m_aTextNodes.rend();
+for (auto aI = m_aTextNodes.rbegin(); aI != aEnd; ++aI)
 {
 SwTextNode *pTextNode = *aI;
 SwNodeIndex aIdx(*pTextNode);
@@ -5357,6 +5356,12 @@ sal_uLong SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss)
 DELETEZ( m_pLstManager );
 }
 
+SAL_WARN_IF(m_pTableEndPaM, "sw.ww8", "document ended without table 
ending");
+m_pTableEndPaM.reset();  //ensure this is deleted before pPaM
+mpCrsr.reset();
+m_pPaM = nullptr;
+m_pLastAnchorPos.reset();//ensure this is deleted before UpdatePageDescs
+
 // remove extra paragraphs after attribute ctrl
 // stacks etc. are destroyed, and before fields
 // are updated
@@ -5368,12 +5373,6 @@ sal_uLong SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss)
 if (m_bNewDoc)
   m_rDoc.getIDocumentRedlineAccess().SetRedlineMode((RedlineMode_t)( eMode 
));
 
-SAL_WARN_IF(m_pTableEndPaM, "sw.ww8", "document ended without table 
ending");
-m_pTableEndPaM.reset();  //ensure this is deleted before pPaM
-mpCrsr.reset();
-m_pPaM = nullptr;
-m_pLastAnchorPos.reset();//ensure this is deleted before UpdatePageDescs
-
 UpdatePageDescs(m_rDoc, nPageDescOffset);
 
 return nErrRet;
diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx
index a0d7202..7187bfe 100644
--- a/sw/source/filter/ww8/ww8par.hxx
+++ b/sw/source/filter/ww8/ww8par.hxx
@@ -49,6 +49,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -453,6 +454,14 @@ namespace SwWW8
 return r1.compareToIgnoreAsciiCase(r2)<0;
 }
 };
+
+struct ltnode
+{
+bool operator()(const SwTextNode *r1, const SwTextNode *r2) const
+{
+return r1->GetIndex() < r2->GetIndex();
+}
+};
 };
 
 class SwWW8ReferencedFltEndStack : public SwFltEndStack
@@ -920,12 +929,12 @@ private:
 /*
 A vector of SwTextNodes to erase from a document after import is complete
 */
-std::vector m_aTextNodes;
+std::set m_aTextNodes;
 SwDoc& m_rDoc;
 public:
 explicit wwExtraneousParas(SwDoc ) : m_rDoc(rDoc) {}
 ~wwExtraneousParas() { delete_all_from_doc(); }
-void push_back(SwTextNode 

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

2015-09-02 Thread Caolán McNamara
 sw/qa/core/data/ww8/pass/hang-8.doc |binary
 sw/source/core/doc/docredln.cxx |1 -
 sw/source/filter/ww8/ww8scan.cxx|   13 +
 3 files changed, 13 insertions(+), 1 deletion(-)

New commits:
commit ed7d22049596ac91ad75bfad1a5675c13714e203
Author: Caolán McNamara 
Date:   Wed Sep 2 20:44:06 2015 +0100

doc para property ranges cannot be 0 length

Change-Id: If946204873343d8bbc0c1d391ca2c65d8b2f8561

diff --git a/sw/qa/core/data/ww8/pass/hang-8.doc 
b/sw/qa/core/data/ww8/pass/hang-8.doc
new file mode 100644
index 000..4f0e30e
Binary files /dev/null and b/sw/qa/core/data/ww8/pass/hang-8.doc differ
diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
index ed6431a..27822fa 100644
--- a/sw/source/filter/ww8/ww8scan.cxx
+++ b/sw/source/filter/ww8/ww8scan.cxx
@@ -4351,6 +4351,19 @@ bool WW8PLCFx_AtnBook::getIsEnd() const
 // if we don't expect trouble thereby.
 void WW8PLCFMan::AdjustEnds( WW8PLCFxDesc& rDesc )
 {
+// might be necessary to do this for pChp and/or pSep as well,
+// but its definitely the case for paragraphs that EndPos > StartPos
+// for a well formed paragraph as those always have a paragraph
+//  in them
+if ( == pPap && rDesc.bRealLineEnd)
+{
+if (rDesc.nStartPos == rDesc.nEndPos && rDesc.nEndPos != WW8_CP_MAX)
+{
+SAL_WARN("sw.ww8", "WW8PLCFxDesc End same as Start, abandoning to 
avoid looping");
+rDesc.nEndPos = WW8_CP_MAX;
+}
+}
+
 //Store old end position for supercool new property finder that uses
 //cp instead of fc's as nature intended
 rDesc.nOrigEndPos = rDesc.nEndPos;
commit 43bcb7b05b1e950e2af15b00d7ede218b4f3edff
Author: Caolán McNamara 
Date:   Wed Sep 2 16:22:16 2015 +0100

-Wundefined-bool-conversion

'this' pointer cannot be null in well-defined C++ code; pointer may be 
assumed
to always convert to true [-Wundefined-bool-conversion]

Change-Id: Iafffb9ea81387ea19fb9c0a4c6ba929215ace3fa

diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index 0a71de7..1cbb2b5 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -1360,7 +1360,6 @@ void SwRangeRedline::MoveFromSection(size_t nMyPos)
 SwDoc* pDoc = GetDoc();
 const SwRedlineTable& rTable = 
pDoc->getIDocumentRedlineAccess().GetRedlineTable();
 std::vector aBeforeArr, aBehindArr;
-OSL_ENSURE( this, "this is not in the array?" );
 bool bBreak = false;
 SwRedlineTable::size_type n;
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-08-17 Thread Miklos Vajna
 sw/qa/core/data/ooxml/pass/tdf93284.docx |binary
 sw/source/core/bastyp/calc.cxx   |4 ++--
 sw/source/core/bastyp/init.cxx   |4 ++--
 vcl/source/filter/wmf/winmtf.cxx |6 +++---
 4 files changed, 7 insertions(+), 7 deletions(-)

New commits:
commit 047ebb1dadcc0219a268455f74fc03a23aa3d86d
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Mon Aug 17 09:13:12 2015 +0200

tdf#93284 vcl: fix VirtualDevice leaks in the WMF filter

We attempted to have 8884 VirtualDevices in parallel. This number is now
12 after fixing the leaks.

The original bugdoc has 135 images, 76 is enough to make Writer on
Windows crash. The minimized document has the same WMF data for all the
images, but still duplicated inside the ZIP container, so we trigger the
resource limit, but the document is still just 99K.

Change-Id: I4c6b3853eaf688302323daf67ff7b62dd64fc412

diff --git a/sw/qa/core/data/ooxml/pass/tdf93284.docx 
b/sw/qa/core/data/ooxml/pass/tdf93284.docx
new file mode 100755
index 000..aedc026
Binary files /dev/null and b/sw/qa/core/data/ooxml/pass/tdf93284.docx differ
diff --git a/vcl/source/filter/wmf/winmtf.cxx b/vcl/source/filter/wmf/winmtf.cxx
index 74a0774..a768b32 100644
--- a/vcl/source/filter/wmf/winmtf.cxx
+++ b/vcl/source/filter/wmf/winmtf.cxx
@@ -236,7 +236,7 @@ WinMtfFontStyle::WinMtfFontStyle( LOGFONTW rFont )
 {
 // #i117968# VirtualDevice is not thread safe, but filter is used in 
multithreading
 SolarMutexGuard aGuard;
-VclPtrInstance VirtualDevice  pVDev;
+ScopedVclPtrInstance VirtualDevice  pVDev;
 // converting the cell height into a font height
 aFont.SetSize( aFontSize );
 pVDev-SetFont( aFont );
@@ -1451,7 +1451,7 @@ void WinMtfOutput::DrawText( Point rPosition, OUString 
rText, long* pDXArry, b
 {
 // #i117968# VirtualDevice is not thread safe, but filter is used in 
multithreading
 SolarMutexGuard aGuard;
-VclPtrInstance VirtualDevice  pVDev;
+ScopedVclPtrInstance VirtualDevice  pVDev;
 sal_Int32 nTextWidth;
 pVDev-SetMapMode( MapMode( MAP_100TH_MM ) );
 pVDev-SetFont( maFont );
@@ -1499,7 +1499,7 @@ void WinMtfOutput::DrawText( Point rPosition, OUString 
rText, long* pDXArry, b
 {
 // #i117968# VirtualDevice is not thread safe, but filter is used 
in multithreading
 SolarMutexGuard aGuard;
-VclPtrInstance VirtualDevice  pVDev;
+ScopedVclPtrInstance VirtualDevice  pVDev;
 pDX = new long[ rText.getLength() ];
 pVDev-SetMapMode( MAP_100TH_MM );
 pVDev-SetFont( maLatestFont );
commit 42fc4f102bc848cf2d41ce33788c802af099b4d3
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Mon Aug 17 09:03:49 2015 +0200

sw: use std::unique_ptr in bastyp

Change-Id: I64909a408ff1c3537790e09e9b96f1ef467f96bd

diff --git a/sw/source/core/bastyp/calc.cxx b/sw/source/core/bastyp/calc.cxx
index 1b05744..db9680a 100644
--- a/sw/source/core/bastyp/calc.cxx
+++ b/sw/source/core/bastyp/calc.cxx
@@ -23,6 +23,7 @@
 #include cctype
 #include cfloat
 #include climits
+#include memory
 #include comphelper/processfactory.hxx
 #include comphelper/string.hxx
 #include com/sun/star/lang/XMultiServiceFactory.hpp
@@ -50,7 +51,6 @@
 #include unotools/useroptions.hxx
 #include usrfld.hxx
 #include viewsh.hxx
-#include boost/scoped_ptr.hpp
 
 using namespace ::com::sun::star;
 
@@ -1526,7 +1526,7 @@ bool SwCalc::Str2Double( const OUString rCommand, 
sal_Int32 rCommandPos,
  double rVal, SwDoc* const pDoc )
 {
 const SvtSysLocale aSysLocale;
-boost::scoped_ptrconst LocaleDataWrapper pLclD;
+std::unique_ptrconst LocaleDataWrapper pLclD;
 if( pDoc )
 {
 LanguageType eLang = GetDocAppScriptLang( *pDoc );
diff --git a/sw/source/core/bastyp/init.cxx b/sw/source/core/bastyp/init.cxx
index 7439d30..1d3962a 100644
--- a/sw/source/core/bastyp/init.cxx
+++ b/sw/source/core/bastyp/init.cxx
@@ -17,8 +17,8 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include memory
 #include acmplwrd.hxx
-#include boost/scoped_ptr.hpp
 #include breakit.hxx
 #include cellatr.hxx
 #include checkit.hxx
@@ -892,7 +892,7 @@ namespace
 class TransWrp
 {
 private:
-boost::scoped_ptr ::utl::TransliterationWrapper  xTransWrp;
+std::unique_ptrutl::TransliterationWrapper xTransWrp;
 public:
 TransWrp()
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-07-30 Thread Miklos Vajna
 sw/qa/extras/uiwriter/data/tdf89720.odt |binary
 sw/qa/extras/uiwriter/uiwriter.cxx  |   19 +++
 sw/source/uibase/docvw/SidebarWin.cxx   |3 ++-
 writerfilter/source/dmapper/PropertyMap.cxx |   18 +++---
 writerfilter/source/dmapper/PropertyMap.hxx |3 ++-
 5 files changed, 30 insertions(+), 13 deletions(-)

New commits:
commit 0af2e9fa64bc686f1c4f84b63faccc854bc1bd54
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Thu Jul 30 09:15:03 2015 +0200

writerfilter: manual memory management - boost::optional in PropertyMap

Change-Id: Ie8f7ce11ab03d47835cfe224c775324dd79a5e7a

diff --git a/writerfilter/source/dmapper/PropertyMap.cxx 
b/writerfilter/source/dmapper/PropertyMap.cxx
index 25bd9c1..57b0c88 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -432,7 +432,6 @@ SectionPropertyMap::SectionPropertyMap(bool 
bIsFirstSection) :
 {
 static sal_Int32 nNumber = 0;
 nSectionNumber = nNumber++;
-memset(m_pBorderLines, 0x00, sizeof(m_pBorderLines));
 for( sal_Int32 nBorder = 0; nBorder  4; ++nBorder )
 {
 m_nBorderDistances[ nBorder ] = -1;
@@ -471,8 +470,6 @@ SectionPropertyMap::SectionPropertyMap(bool 
bIsFirstSection) :
 
 SectionPropertyMap::~SectionPropertyMap()
 {
-for( sal_Int16 ePos = BORDER_LEFT; ePos = BORDER_BOTTOM; ++ePos)
-delete m_pBorderLines[ePos];
 }
 
 
@@ -564,8 +561,7 @@ uno::Reference beans::XPropertySet  
SectionPropertyMap::GetPageStyle(
 
 void SectionPropertyMap::SetBorder( BorderPosition ePos, sal_Int32 
nLineDistance, const table::BorderLine2 rBorderLine, bool bShadow )
 {
-delete m_pBorderLines[ePos];
-m_pBorderLines[ePos] = new table::BorderLine2( rBorderLine );
+m_oBorderLines[ePos] = rBorderLine;
 m_nBorderDistances[ePos] = nLineDistance;
 m_bBorderShadows[ePos] = bShadow;
 }
@@ -639,19 +635,19 @@ void SectionPropertyMap::ApplyBorderToPageStyles(
 
 for( sal_Int32 nBorder = 0; nBorder  4; ++nBorder)
 {
-if( m_pBorderLines[nBorder] )
+if( m_oBorderLines[nBorder] )
 {
 const OUString sBorderName = getPropertyName( aBorderIds[nBorder] 
);
 if (xFirst.is())
-xFirst-setPropertyValue( sBorderName, uno::makeAny( 
*m_pBorderLines[nBorder] ));
+xFirst-setPropertyValue( sBorderName, uno::makeAny( 
*m_oBorderLines[nBorder] ));
 if(xSecond.is())
-xSecond-setPropertyValue( sBorderName, uno::makeAny( 
*m_pBorderLines[nBorder] ));
+xSecond-setPropertyValue( sBorderName, uno::makeAny( 
*m_oBorderLines[nBorder] ));
 }
 if( m_nBorderDistances[nBorder] = 0 )
 {
 sal_uInt32 nLineWidth = 0;
-if (m_pBorderLines[nBorder])
-nLineWidth = m_pBorderLines[nBorder]-LineWidth;
+if (m_oBorderLines[nBorder])
+nLineWidth = m_oBorderLines[nBorder]-LineWidth;
 if(xFirst.is())
 SetBorderDistance( xFirst, aMarginIds[nBorder], 
aBorderDistanceIds[nBorder],
   m_nBorderDistances[nBorder], nOffsetFrom, nLineWidth );
@@ -663,7 +659,7 @@ void SectionPropertyMap::ApplyBorderToPageStyles(
 
 if (m_bBorderShadows[BORDER_RIGHT])
 {
-table::ShadowFormat aFormat = 
getShadowFromBorder(*m_pBorderLines[BORDER_RIGHT]);
+table::ShadowFormat aFormat = 
getShadowFromBorder(*m_oBorderLines[BORDER_RIGHT]);
 if (xFirst.is())
 xFirst-setPropertyValue(getPropertyName(PROP_SHADOW_FORMAT), 
uno::makeAny(aFormat));
 if (xSecond.is())
diff --git a/writerfilter/source/dmapper/PropertyMap.hxx 
b/writerfilter/source/dmapper/PropertyMap.hxx
index ffb0b1c..6aa53af 100644
--- a/writerfilter/source/dmapper/PropertyMap.hxx
+++ b/writerfilter/source/dmapper/PropertyMap.hxx
@@ -23,6 +23,7 @@
 #include com/sun/star/uno/Sequence.hxx
 #include com/sun/star/beans/PropertyValue.hpp
 #include com/sun/star/beans/XPropertySet.hpp
+#include com/sun/star/table/BorderLine2.hpp
 #include com/sun/star/uno/Any.h
 #include PropertyIds.hxx
 #include memory
@@ -190,7 +191,7 @@ class SectionPropertyMap : public PropertyMap
 css::uno::Referencecss::beans::XPropertySet m_aFirstPageStyle;
 css::uno::Referencecss::beans::XPropertySet m_aFollowPageStyle;
 
-css::table::BorderLine2* m_pBorderLines[4];
+boost::optionalcss::table::BorderLine2 m_oBorderLines[4];
 sal_Int32   m_nBorderDistances[4];
 sal_Int32   m_nBorderParams;
 boolm_bBorderShadows[4];
commit 780dd8c1cf5302ca503cf7b55357dace4d69beb9
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Thu Jul 30 09:11:35 2015 +0200

tdf#89720 sw: do not create text range overlay for reply annotations

Regression from commit 0761f81643a6890457e9ef7d913ab5c88c2593a4 (123792:
complete annotations on text 

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

2015-07-27 Thread Miklos Vajna
 sw/qa/extras/uiwriter/uiwriter.cxx|   42 ++
 sw/source/core/doc/DocumentLinksAdministrationManager.cxx |3 -
 writerfilter/source/dmapper/DomainMapper.cxx  |8 +-
 writerfilter/source/dmapper/DomainMapper.hxx  |6 +-
 4 files changed, 49 insertions(+), 10 deletions(-)

New commits:
commit 6d77d7db8704327071b3d46508310c8453cf1cd1
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Mon Jul 27 09:22:10 2015 +0200

writerfilter: use std::unique_ptr in DomainMapper

Change-Id: I569add9792d533bd3bcda5d5cb4023b37bd3f1ed

diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index 6a4a85a..25c3cd5 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -189,8 +189,6 @@ DomainMapper::~DomainMapper()
 (void)rEx;
 }
 
-delete m_pImpl;
-
 #ifdef DEBUG_WRITERFILTER
 TagLogger::getInstance().endDocument();
 #endif
@@ -1092,7 +1090,7 @@ sal_Int32 lcl_getCurrentNumberingProperty(
 }
 
 // In rtl-paragraphs the meaning of left/right are to be exchanged
-static bool ExchangeLeftRight(const PropertyMapPtr rContext, 
DomainMapper_Impl* m_pImpl)
+static bool ExchangeLeftRight(const PropertyMapPtr rContext, 
DomainMapper_Impl rImpl)
 {
 bool bExchangeLeftRight = false;
 boost::optionalPropertyMap::Property aPropPara = 
rContext-getProperty(PROP_WRITING_MODE);
@@ -1105,7 +1103,7 @@ static bool ExchangeLeftRight(const PropertyMapPtr 
rContext, DomainMapper_Impl*
 else
 {
 // check if there RTL bidi in default style for the paragraph
-StyleSheetEntryPtr pTable = 
m_pImpl-GetStyleSheetTable()-FindDefaultParaStyle();
+StyleSheetEntryPtr pTable = 
rImpl.GetStyleSheetTable()-FindDefaultParaStyle();
 if ( pTable )
 {
 boost::optionalPropertyMap::Property aPropStyle = 
pTable-pProperties-getProperty(PROP_WRITING_MODE);
@@ -1170,7 +1168,7 @@ void DomainMapper::sprmWithProps( Sprm rSprm, 
PropertyMapPtr rContext )
 switch(nSprmId)
 {
 case NS_ooxml::LN_CT_PPrBase_jc:
-handleParaJustification(nIntValue, rContext, ExchangeLeftRight( 
rContext, m_pImpl ));
+handleParaJustification(nIntValue, rContext, ExchangeLeftRight( 
rContext, *m_pImpl ));
 break;
 case NS_ooxml::LN_CT_PPrBase_keepLines:
 rContext-Insert(PROP_PARA_SPLIT, uno::makeAny(nIntValue == 0));
diff --git a/writerfilter/source/dmapper/DomainMapper.hxx 
b/writerfilter/source/dmapper/DomainMapper.hxx
index 0e30f22..0cd2878 100644
--- a/writerfilter/source/dmapper/DomainMapper.hxx
+++ b/writerfilter/source/dmapper/DomainMapper.hxx
@@ -26,7 +26,7 @@
 
 #include map
 #include vector
-#include boost/scoped_ptr.hpp
+#include memory
 
 namespace com{ namespace sun {namespace star{
 namespace beans{
@@ -72,7 +72,7 @@ enum SprmType
 class DomainMapper : public LoggedProperties, public LoggedTable,
 public BinaryObj, public LoggedStream
 {
-DomainMapper_Impl   *m_pImpl;
+std::unique_ptrDomainMapper_Impl m_pImpl;
 
 public:
 DomainMapper(const css::uno::Referencecss::uno::XComponentContext 
xContext,
@@ -169,7 +169,7 @@ private:
 static css::style::TabAlign getTabAlignFromValue(const sal_Int32 
nIntValue);
 static sal_Unicode getFillCharFromValue(const sal_Int32 nIntValue);
 bool mbIsSplitPara;
-boost::scoped_ptr GraphicZOrderHelper  zOrderHelper;
+std::unique_ptr GraphicZOrderHelper  zOrderHelper;
 };
 
 } // namespace dmapper
commit e06e2cb18874987d2dafd4faa0a8b71fc0aa6453
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Mon Jul 27 09:16:16 2015 +0200

tdf#90575 sw: fix pasting DDE links

Regression from commit 0761f81643a6890457e9ef7d913ab5c88c2593a4 (123792:
complete annotations on text ranges feature, 2013-12-19), the problem
was that the added additional IDocumentMarkAccess::GetType() check in
lcl_FindDdeBookmark(), which means that the function no longer finds
bookmarks with the matching name, only real DDE marks. This is a
problem, as SwTrnsfrDdeLink::WriteData() depends on the fact that
sw::mark::Bookmark inherits from sw::mark::DdeBookmark. As a result, the
fast IDocumentMarkAccess::GetType() (that intentionally doesn't handle
inheritance for performance reasons) can't be used here.

Change-Id: I2b7a07c18b641ac991f3227812a609dedc960e08

diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx 
b/sw/qa/extras/uiwriter/uiwriter.cxx
index 16bd01f..ebac88b 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -10,6 +10,7 @@
 #include com/sun/star/awt/FontWeight.hpp
 #include com/sun/star/drawing/GraphicExportFilter.hpp
 #include com/sun/star/i18n/TextConversionOption.hpp
+#include com/sun/star/frame/DispatchHelper.hpp
 #include swmodeltestbase.hxx
 #include ndtxt.hxx
 #include wrtsh.hxx
@@ -66,6 +67,7 @@
 #include 

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

2015-07-03 Thread Caolán McNamara
 sw/qa/extras/uiwriter/data/draw-anchor-undo.odt |binary
 sw/qa/extras/uiwriter/uiwriter.cxx  |   27 
 sw/source/core/undo/unattr.cxx  |   11 +++--
 3 files changed, 35 insertions(+), 3 deletions(-)

New commits:
commit b5a4e6974a5473c44fc239b6a9ae21f233111c2a
Author: Caolán McNamara caol...@redhat.com
Date:   Fri Jul 3 12:47:41 2015 +0100

add a shape resize undo test

Change-Id: I88c2d7de243660ba727f057d6a2d67726b41b982

diff --git a/sw/qa/extras/uiwriter/data/draw-anchor-undo.odt 
b/sw/qa/extras/uiwriter/data/draw-anchor-undo.odt
new file mode 100644
index 000..370799c
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/draw-anchor-undo.odt 
differ
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx 
b/sw/qa/extras/uiwriter/uiwriter.cxx
index 6138ed2..a0c1bfe 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -113,6 +113,7 @@ public:
 void testEmbeddedDataSource();
 void testUnoCursorPointer();
 void testTextTableCellNames();
+void testShapeAnchorUndo();
 
 CPPUNIT_TEST_SUITE(SwUiWriterTest);
 CPPUNIT_TEST(testReplaceForward);
@@ -163,6 +164,7 @@ public:
 CPPUNIT_TEST(testEmbeddedDataSource);
 CPPUNIT_TEST(testUnoCursorPointer);
 CPPUNIT_TEST(testTextTableCellNames);
+CPPUNIT_TEST(testShapeAnchorUndo);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -1476,6 +1478,31 @@ void SwUiWriterTest::testTextTableCellNames()
 CPPUNIT_ASSERT(nCol == 105);
 }
 
+void SwUiWriterTest::testShapeAnchorUndo()
+{
+SwDoc* pDoc = createDoc(draw-anchor-undo.odt);
+SwWrtShell* pWrtShell = pDoc-GetDocShell()-GetWrtShell();
+SdrPage* pPage = 
pDoc-getIDocumentDrawModelAccess().GetDrawModel()-GetPage(0);
+SdrObject* pObject = pPage-GetObj(0);
+Rectangle aOrigLogicRect(pObject-GetLogicRect());
+
+sw::UndoManager rUndoManager = pDoc-GetUndoManager();
+rUndoManager.StartUndo(UNDO_START, NULL);
+
+pWrtShell-SelectObj(Point(), 0, pObject);
+
+pWrtShell-GetDrawView()-MoveMarkedObj(Size(100, 100), false);
+pWrtShell-ChgAnchor(0, true, true);
+
+rUndoManager.EndUndo(UNDO_END, NULL);
+
+CPPUNIT_ASSERT(aOrigLogicRect != pObject-GetLogicRect());
+
+rUndoManager.Undo();
+
+CPPUNIT_ASSERT(aOrigLogicRect == pObject-GetLogicRect());
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest);
 CPPUNIT_PLUGIN_IMPLEMENT();
 
commit f1256611054701a2bba20225fb654814eecbf559
Author: Caolán McNamara caol...@redhat.com
Date:   Fri Jul 3 11:46:18 2015 +0100

Resolves: tdf#92137 drawing layer resize undo in writer fails...

to restore location correctly

if SwFEShell::EndDrag is tweaked to not group the anchor change
undo and the draw size/pos change undo together and then you
undo each step in the ui one at a time this works fine.

The first undo occurs, then the layout kicks in on idle and calls MakeObjPos
on the drawing item and updates it for the new anchor pos

Then on triggering size undo the anchor is correct so the new
pos is set correctly.

If they are bundled together however, the layout at idle doesn't occur
until after the anchor and size have been set, so the adjustment is
too late

Change-Id: I5402d851fcae7f240cc6e9a0e15159115bb663ce

diff --git a/sw/source/core/undo/unattr.cxx b/sw/source/core/undo/unattr.cxx
index ec5770d..9283ae2 100644
--- a/sw/source/core/undo/unattr.cxx
+++ b/sw/source/core/undo/unattr.cxx
@@ -480,9 +480,9 @@ bool 
SwUndoFormatAttr::RestoreFlyAnchor(::sw::UndoRedoContext  rContext)
 }
 }
 
+SwDrawContact *pCont = NULL;
 if ( RES_DRAWFRMFMT == pFrameFormat-Which() ) {
-SwDrawContact *pCont =
-static_castSwDrawContact*(pFrameFormat-FindContactObj());
+pCont = static_castSwDrawContact*(pFrameFormat-FindContactObj());
 // The Draw model also prepared an Undo object for its right 
positioning
 // which unfortunately is relative. Therefore block here a position
 // change of the Contact object by setting the anchor.
@@ -508,8 +508,13 @@ bool 
SwUndoFormatAttr::RestoreFlyAnchor(::sw::UndoRedoContext  rContext)
 pTextNd-InsertItem( aFormat, pPos-nContent.GetIndex(), 0 );
 }
 
-if( RES_DRAWFRMFMT != pFrameFormat-Which() )
+if (RES_DRAWFRMFMT != pFrameFormat-Which())
 pFrameFormat-MakeFrms();
+else
+{
+SdrObject* pSdrObj = pFrameFormat-FindSdrObject();
+pCont-GetAnchoredObj(pSdrObj)-MakeObjPos();
+}
 
 rContext.SetSelections(pFrameFormat, 0);
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-07-03 Thread Bjoern Michaelsen
 sw/qa/core/uwriter.cxx  |7 +++
 sw/qa/python/check_table.py |8 
 sw/source/core/doc/doc.cxx  |4 +---
 3 files changed, 12 insertions(+), 7 deletions(-)

New commits:
commit 6cadfe0f07659235c6438c345d501eca89b411d5
Author: Bjoern Michaelsen bjoern.michael...@canonical.com
Date:   Fri Jul 3 22:08:49 2015 +0200

tdf#92308: Dont crash on File  Send  Email Document

- crashed due to out-of-range index with empty vector
- kill pruposeless manual index fiddling for good
- add trivial test

Change-Id: Ic224c70f432d2b26718e05aa5a2742461cfb7bec

diff --git a/sw/qa/core/uwriter.cxx b/sw/qa/core/uwriter.cxx
index e312d5c..b74dbea 100644
--- a/sw/qa/core/uwriter.cxx
+++ b/sw/qa/core/uwriter.cxx
@@ -111,6 +111,7 @@ public:
 void testIntrusiveRing();
 void testClientModify();
 void test64kPageDescs();
+void testTdf92308();
 
 CPPUNIT_TEST_SUITE(SwDocTest);
 
@@ -144,6 +145,7 @@ public:
 CPPUNIT_TEST(testIntrusiveRing);
 CPPUNIT_TEST(testClientModify);
 CPPUNIT_TEST(test64kPageDescs);
+CPPUNIT_TEST(testTdf92308);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -1615,6 +1617,11 @@ void SwDocTest::test64kPageDescs()
 CPPUNIT_ASSERT( nPos == 0 );
 }
 
+void SwDocTest::testTdf92308()
+{
+CPPUNIT_ASSERT_EQUAL(m_pDoc-HasInvisibleContent(), false);
+}
+
 void SwDocTest::setUp()
 {
 BootstrapFixture::setUp();
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index 75e1b32..61fe589 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -1450,10 +1450,8 @@ bool SwDoc::HasInvisibleContent() const
 }
 }
 
-const SwSectionFormats rSectFormats = GetSections();
-for( SwSectionFormats::size_type n = rSectFormats.size()-1; n; --n )
+for(auto pSectFormat : GetSections())
 {
-SwSectionFormat* pSectFormat = rSectFormats[ n ];
 // don't add sections in Undo/Redo
 if( !pSectFormat-IsInNodesArr())
 continue;
commit 53e7011084e6f03bf2e9dc6f8e1f45224707
Author: Bjoern Michaelsen bjoern.michael...@canonical.com
Date:   Wed Jul 1 13:45:23 2015 +0200

be picky and check explicit implementation name

- the previous code tried to avoid breakage from changing an
  implementation detail
- this turns out to be harder than expected in a Python2/3 portable way
- also it would mean the intentional drive-by documentation of the
  expected implementation name will at least not bit rot now

Change-Id: I5972d0e79ef64abe30573182c5e23268e4830ade

diff --git a/sw/qa/python/check_table.py b/sw/qa/python/check_table.py
index 2996614..a5a8308 100644
--- a/sw/qa/python/check_table.py
+++ b/sw/qa/python/check_table.py
@@ -356,7 +356,7 @@ class CheckTable(unittest.TestCase):
 xTable.ChartRowAsLabel = False
 xTable.Data = ((1,2,3), (4,5,6), (7,8,9), (10,11,12))
 xRows = xTable.Rows
-self.assertIs(type(xRows.ImplementationName), type('SwXTableRows')) # 
not testing value, just type and coverage
+self.assertEquals(xRows.ImplementationName, 'SwXTableRows')
 self.assertTrue(xRows.supportsService('com.sun.star.text.TableRows'))
 self.assertFalse(xRows.supportsService('foo'))
 self.assertIn('com.sun.star.text.TableRows', 
xRows.SupportedServiceNames)
@@ -364,7 +364,7 @@ class CheckTable(unittest.TestCase):
 xRows.removeByIndex(1, 2)
 self.assertEqual( xTable.Data, ((1,2,3), (10,11,12)))
 xCols = xTable.Columns
-self.assertIs(type(xCols.ImplementationName), type('SwXTableColumns')) 
# not testing value, just type and coverage
+self.assertEquals(xCols.ImplementationName, 'SwXTableColumns')
 
self.assertTrue(xCols.supportsService('com.sun.star.text.TableColumns'))
 self.assertFalse(xCols.supportsService('foo'))
 self.assertIn('com.sun.star.text.TableColumns', 
xCols.SupportedServiceNames)
@@ -427,7 +427,7 @@ class CheckTable(unittest.TestCase):
 self.assertTrue(xTable.Name == 'Table1')
 self.assertIn('com.sun.star.text.GenericTextDocument', 
xDoc.SupportedServiceNames)
 xChartdataprovider = 
xDoc.createInstance('com.sun.star.chart2.data.DataProvider')
-self.assertIs(type(xChartdataprovider.ImplementationName), 
type('SwChartDataProvider')) # not testing value, just type and coverage
+self.assertEquals(xChartdataprovider.ImplementationName, 
'SwChartDataProvider')
 
self.assertTrue(xChartdataprovider.supportsService('com.sun.star.chart2.data.DataProvider'))
 self.assertFalse(xChartdataprovider.supportsService('foo'))
 self.assertIn('com.sun.star.chart2.data.DataProvider', 
xChartdataprovider.SupportedServiceNames)
@@ -440,7 +440,7 @@ class CheckTable(unittest.TestCase):
 expectedCellrange = ('A1:A2', 'B1:B2', 'C1:C2')
 for col in range(3):
 xSeq = xDataSource.DataSequences[col].Values
-

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

2015-06-09 Thread Bjoern Michaelsen
 sw/qa/extras/uiwriter/uiwriter.cxx |2 +-
 sw/source/core/attr/calbck.cxx |3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)

New commits:
commit a8f0a18fb992f554485b42cb4d594a20f06d4035
Author: Bjoern Michaelsen bjoern.michael...@canonical.com
Date:   Tue Jun 9 17:30:32 2015 +0200

disable UnoCursorPointer test for now as it fails on OSX

Change-Id: If2eb492ad4be3c6d570874c6a2fabadc3c233dab

diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx 
b/sw/qa/extras/uiwriter/uiwriter.cxx
index 1d9044e..2677f09 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -135,7 +135,7 @@ public:
 CPPUNIT_TEST(testTdf86639);
 CPPUNIT_TEST(testTdf90883TableBoxGetCoordinates);
 CPPUNIT_TEST(testEmbeddedDataSource);
-CPPUNIT_TEST(testUnoCursorPointer);
+//CPPUNIT_TEST(testUnoCursorPointer);
 CPPUNIT_TEST_SUITE_END();
 
 private:
commit e8a9a973da1fc96481a1351cc05efa31fc6904c8
Author: Bjoern Michaelsen bjoern.michael...@canonical.com
Date:   Tue Jun 9 16:49:31 2015 +0200

give better hints for the whodunnit in SwClient/Modify

Change-Id: Ic30f70cae1258fcf9e703d85093d52a059c9cd53

diff --git a/sw/source/core/attr/calbck.cxx b/sw/source/core/attr/calbck.cxx
index e09c04e..127a774 100644
--- a/sw/source/core/attr/calbck.cxx
+++ b/sw/source/core/attr/calbck.cxx
@@ -152,8 +152,7 @@ void SwModify::Add( SwClient* pDepend )
 {
 for(auto rIter : 
sw::ClientIteratorBase::our_pClientIters-GetRingContainer())
 {
-OSL_ENSURE( rIter.m_rRoot != m_pWriterListeners, Client 
added to active ClientIter );
-//assert(rIter.m_rRoot != m_pWriterListeners);
+SAL_WARN_IF(rIter.m_rRoot == m_pWriterListeners, sw.core, 
a   typeid(*pDepend).name()   client added as listener to a   
typeid(*this).name()   during client iteration.);
 }
 }
 #endif
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-05-31 Thread Matteo Casalin
 sw/qa/core/uwriter.cxx  |2 +-
 sw/source/filter/html/htmlftn.cxx   |2 +-
 sw/source/filter/xml/swxml.cxx  |2 +-
 sw/source/uibase/config/barcfg.cxx  |2 +-
 sw/source/uibase/docvw/AnnotationMenuButton.cxx |3 +--
 sw/source/uibase/lingu/sdrhhcwrap.cxx   |2 +-
 6 files changed, 6 insertions(+), 7 deletions(-)

New commits:
commit e61fcfea5c2a306e44a053976e921160e78917ac
Author: Matteo Casalin matteo.casa...@yahoo.com
Date:   Mon Jun 1 01:14:07 2015 +0200

WaE - Fix C4389: ´==´ : signed/unsigned mismatch

Change-Id: I049ca27a0b69887d7ab82312dd30311ddb2bed63

diff --git a/sw/source/filter/html/htmlftn.cxx 
b/sw/source/filter/html/htmlftn.cxx
index e0145c3..b8eaa26 100644
--- a/sw/source/filter/html/htmlftn.cxx
+++ b/sw/source/filter/html/htmlftn.cxx
@@ -275,7 +275,7 @@ Writer OutHTML_SwFormatFootnote( Writer rWrt, const 
SfxPoolItem rHt )
 if( rFormatFootnote.IsEndNote() )
 {
 nPos = rHTMLWrt.pFootEndNotes ? rHTMLWrt.pFootEndNotes-size() : 0;
-OSL_ENSURE( nPos == rHTMLWrt.nFootNote + rHTMLWrt.nEndNote,
+OSL_ENSURE( nPos == static_castsize_t(rHTMLWrt.nFootNote + 
rHTMLWrt.nEndNote),
 OutHTML_SwFormatFootnote: Position falsch );
 sClass = OOO_STRING_SVTOOLS_HTML_sdendnote_anc;
 sFootnoteName = OOO_STRING_SVTOOLS_HTML_sdendnote + OUString::number( 
(sal_Int32)(++rHTMLWrt.nEndNote) );
commit 8b55fe96cf64c64e4877d0ffa8ea694dc7dc8d17
Author: Matteo Casalin matteo.casa...@yahoo.com
Date:   Mon Jun 1 00:11:35 2015 +0200

Use auto or more proper integer types, avoid temporaries

Change-Id: Iae81c30d23aa61e92b8dfd79c326c554b4164987

diff --git a/sw/qa/core/uwriter.cxx b/sw/qa/core/uwriter.cxx
index 61d400b..d1e7460 100644
--- a/sw/qa/core/uwriter.cxx
+++ b/sw/qa/core/uwriter.cxx
@@ -1054,7 +1054,7 @@ void SwDocTest::randomTest()
 Jim, Bob, JimBobina, Helga, Gertrude, Spagna, Hurtleweed
 };
 
-for( sal_uInt16 rlm = 0; rlm  SAL_N_ELEMENTS(modes); rlm++ )
+for( size_t rlm = 0; rlm  SAL_N_ELEMENTS(modes); rlm++ )
 {
 m_pDoc-ClearDoc();
 
diff --git a/sw/source/filter/xml/swxml.cxx b/sw/source/filter/xml/swxml.cxx
index db7c64711..a14b839 100644
--- a/sw/source/filter/xml/swxml.cxx
+++ b/sw/source/filter/xml/swxml.cxx
@@ -383,7 +383,7 @@ static void lcl_AdjustOutlineStylesForOOo(SwDoc _rDoc)
 for ( sal_uInt8 i = 0; i  MAXLEVEL; ++i )
 {
 sStyleName =
-SwStyleNameMapper::GetProgName( static_cast sal_uInt16 
(RES_POOLCOLL_HEADLINE1 + i),
+SwStyleNameMapper::GetProgName( RES_POOLCOLL_HEADLINE1 + i,
 sStyleName );
 aDefOutlStyleNames[i] = sStyleName;
 }
diff --git a/sw/source/uibase/config/barcfg.cxx 
b/sw/source/uibase/config/barcfg.cxx
index 88cef25..3534285 100644
--- a/sw/source/uibase/config/barcfg.cxx
+++ b/sw/source/uibase/config/barcfg.cxx
@@ -38,7 +38,7 @@ SwToolbarConfigItem::SwToolbarConfigItem( bool bWeb ) :
 ConfigItem(bWeb ? OUString(Office.WriterWeb/ObjectBar) : 
OUString(Office.Writer/ObjectBar),
 ConfigItemMode::DelayedUpdate|ConfigItemMode::ReleaseTree)
 {
-for(sal_uInt16 i = 0; i = SEL_TYPE_GRAPHIC; i++ )
+for(int i = 0; i = SEL_TYPE_GRAPHIC; ++i)
 aTbxIdArray[i] = -1;
 
 SequenceOUString aNames = GetPropertyNames();
diff --git a/sw/source/uibase/docvw/AnnotationMenuButton.cxx 
b/sw/source/uibase/docvw/AnnotationMenuButton.cxx
index b2ff368..2df32e5 100644
--- a/sw/source/uibase/docvw/AnnotationMenuButton.cxx
+++ b/sw/source/uibase/docvw/AnnotationMenuButton.cxx
@@ -189,8 +189,7 @@ void AnnotationMenuButton::Paint(vcl::RenderContext 
rRenderContext, const Recta
 void AnnotationMenuButton::KeyInput(const KeyEvent rKeyEvt)
 {
 const vcl::KeyCode rKeyCode = rKeyEvt.GetKeyCode();
-const sal_uInt16 nKey = rKeyCode.GetCode();
-if (nKey == KEY_TAB)
+if (rKeyCode.GetCode() == KEY_TAB)
 {
 mrSidebarWin.ActivatePostIt();
 mrSidebarWin.GrabFocus();
diff --git a/sw/source/uibase/lingu/sdrhhcwrap.cxx 
b/sw/source/uibase/lingu/sdrhhcwrap.cxx
index e899234..5d8e364 100644
--- a/sw/source/uibase/lingu/sdrhhcwrap.cxx
+++ b/sw/source/uibase/lingu/sdrhhcwrap.cxx
@@ -122,7 +122,7 @@ bool SdrHHCWrapper::ConvertNextDocument()
 pTextObj = NULL;
 }
 
-sal_uInt16 n = nDocIndex;
+const auto n = nDocIndex;
 
 std::listSdrTextObj* aTextObjs;
 SwDrawContact::GetTextObjectsFromFormat( aTextObjs, 
pView-GetDocShell()-GetDoc() );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-05-12 Thread Mike Kaganski
 sw/qa/extras/rtfimport/data/copypaste-footnote-paste.rtf |3 -
 sw/source/filter/rtf/swparrtf.cxx|   25 ++-
 writerfilter/inc/rtftok/RTFDocument.hxx  |3 +
 writerfilter/source/dmapper/DomainMapper.cxx |3 +
 writerfilter/source/dmapper/DomainMapper_Impl.cxx|4 +-
 writerfilter/source/filter/RtfFilter.cxx |3 +
 writerfilter/source/rtftok/rtfdocumentfactory.cxx|5 +--
 writerfilter/source/rtftok/rtfdocumentimpl.cxx   |   13 ---
 writerfilter/source/rtftok/rtfdocumentimpl.hxx   |6 +++
 9 files changed, 50 insertions(+), 15 deletions(-)

New commits:
commit 0ddd9f9ff45f61013ea18763eca4c68aedce6caa
Author: Mike Kaganski mikekagan...@hotmail.com
Date:   Mon May 11 02:31:39 2015 +1000

tdf#70318: don't forget to clean up second fake paragraph

RTF insert is made into an empty paragraph. To do that, two splits
are made before the insert, but only one is reverted afterwards.
This patch removes the second.

Also fixes a memory leak from unreleased heap object

The corresponding unit test is corrected. It was incorrect
because \par doesn't begin new paragraph; it only ends paragraph.
If a RTF is ended with \par } then no newline is added to its end.
The old unit test only worked because of the bug fixed by this
patch. Correct way of inserting new paragraph in the end of a RTF
is \par \par}

Change-Id: I63d50a940d7960beb35f7d774c833ed8499acbef

diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx 
b/sw/qa/extras/uiwriter/uiwriter.cxx
index 648f3ea..f0a1449 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -287,7 +287,7 @@ void SwUiWriterTest::testImportRTF()
 CPPUNIT_ASSERT_EQUAL(sal_uLong(0), aReader.Read(*pRTFReader));
 
 sal_uLong nIndex = pWrtShell-GetCrsr()-GetNode().GetIndex();
-//CPPUNIT_ASSERT_EQUAL(OUString(fooHello world!), 
pDoc-GetNodes()[nIndex - 1]-GetTxtNode()-GetTxt());
+CPPUNIT_ASSERT_EQUAL(OUString(fooHello world!), pDoc-GetNodes()[nIndex 
- 1]-GetTxtNode()-GetTxt());
 CPPUNIT_ASSERT_EQUAL(OUString(bar), 
pDoc-GetNodes()[nIndex]-GetTxtNode()-GetTxt());
 }
 
diff --git a/sw/source/filter/rtf/swparrtf.cxx 
b/sw/source/filter/rtf/swparrtf.cxx
index 2730561b..987fba8 100644
--- a/sw/source/filter/rtf/swparrtf.cxx
+++ b/sw/source/filter/rtf/swparrtf.cxx
@@ -50,7 +50,7 @@ sal_uLong SwRTFReader::Read(SwDoc rDoc, const OUString 
/*rBaseURL*/, SwPaM rP
 // Step 1: XTextRange will be updated when content is inserted, so we know
 // the end position.
 const uno::Referencetext::XTextRange xInsertPosition = 
SwXTextRange::CreateXTextRange(rDoc, *rPam.GetPoint(), 0);
-SwNodeIndex* pSttNdIdx = new SwNodeIndex(rDoc.GetNodes());
+std::shared_ptrSwNodeIndex pSttNdIdx(new SwNodeIndex(rDoc.GetNodes()));
 const SwPosition* pPos = rPam.GetPoint();
 
 // Step 2: Split once and remember the node that has been split.
@@ -59,6 +59,8 @@ sal_uLong SwRTFReader::Read(SwDoc rDoc, const OUString 
/*rBaseURL*/, SwPaM rP
 
 // Step 3: Split again.
 rDoc.getIDocumentContentOperations().SplitNode(*pPos, false);
+std::shared_ptrSwNodeIndex pSttNdIdx2(new SwNodeIndex(rDoc.GetNodes()));
+*pSttNdIdx2 = pPos-nNode.GetIndex();
 
 // Step 4: Insert all content into the new node
 rPam.Move(fnMoveBackward);
@@ -126,6 +128,27 @@ sal_uLong SwRTFReader::Read(SwDoc rDoc, const OUString 
/*rBaseURL*/, SwPaM rP
 }
 }
 
+if (pSttNdIdx2-GetIndex())
+{
+// If we are in insert mode, join the split node that is after
+// the new content with the last new node. Or in other words:
+// Revert the second split node.
+SwTxtNode* pTxtNode = pSttNdIdx2-GetNode().GetTxtNode();
+SwNodeIndex aPrevIdx(*pSttNdIdx2);
+if (pTxtNode  pTxtNode-CanJoinPrev(aPrevIdx)  
pSttNdIdx2-GetIndex() - 1 == aPrevIdx.GetIndex())
+{
+// If the last new node isn't empty, convert  the node's text
+// attributes into hints. Otherwise, set the new node's
+// paragraph style at the next (empty) node.
+SwTxtNode* pDelNd = aPrevIdx.GetNode().GetTxtNode();
+if (pTxtNode-GetTxt().getLength())
+pDelNd-FmtToTxtAttr(pTxtNode);
+else
+pTxtNode-ChgFmtColl(pDelNd-GetTxtColl());
+pTxtNode-JoinPrev();
+}
+}
+
 return ret;
 }
 
commit e702c78843e387d83fd9c8fbd1597cbe27e3e656
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Mon May 11 23:24:22 2015 +0200

tdf#90260 writerfilter: pasted RTF documents may contain no \par

sw core is not yet adapted, will be done in the next commit.

Change-Id: If8da12427e0cdaced4c1c1776b9f0b8cbde5c57c

diff --git a/sw/qa/extras/rtfimport/data/copypaste-footnote-paste.rtf 
b/sw/qa/extras/rtfimport/data/copypaste-footnote-paste.rtf
index 

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

2015-04-21 Thread Miklos Vajna
 sw/qa/extras/inc/swmodeltestbase.hxx|6 ++
 sw/qa/extras/rtfexport/data/tdf90421.fodt   |8 +++
 sw/qa/extras/rtfexport/rtfexport.cxx|   23 
 sw/source/core/txtnode/txatbase.cxx |7 ++
 sw/source/filter/ww8/rtfattributeoutput.cxx |   74 +++-
 sw/source/filter/ww8/rtfattributeoutput.hxx |3 +
 6 files changed, 87 insertions(+), 34 deletions(-)

New commits:
commit 7d42346ba77c9c4df241ea40eaf550993ca18783
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Tue Apr 21 17:00:57 2015 +0200

tdf#90421 RTF export: ignore hyperlinks without an URL

Commit fe444d1f74abe417962be0bcd3340f40f2446b58 (fdo#62536: sw: fix
AutoCorrect bold/underline on existing AUTOFMT, 2013-06-20) adds an
empty inet format hint on the text node during autocorrection, on export
we can safely ignore that to provide well-formed output.

Change-Id: Iafae941a13e29dcc7d8b4bade5ce94a486b59638

diff --git a/sw/qa/extras/inc/swmodeltestbase.hxx 
b/sw/qa/extras/inc/swmodeltestbase.hxx
index 7528ced..f0d3428 100644
--- a/sw/qa/extras/inc/swmodeltestbase.hxx
+++ b/sw/qa/extras/inc/swmodeltestbase.hxx
@@ -240,6 +240,7 @@ protected:
 header();
 preTest(filename);
 load(mpTestDocumentPath, filename);
+postLoad(filename);
 reload(mpFilter, filename);
 postTest(filename);
 verify();
@@ -289,6 +290,11 @@ protected:
 {
 }
 
+/// Override this function if some special file-specific setup is needed 
during export test: after load, but before save.
+virtual void postLoad(const char* /*pFilename*/)
+{
+}
+
 /**
  * Override this function if some special filename-specific teardown is 
needed
  */
diff --git a/sw/qa/extras/rtfexport/data/tdf90421.fodt 
b/sw/qa/extras/rtfexport/data/tdf90421.fodt
new file mode 100644
index 000..a0da4b8
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/tdf90421.fodt
@@ -0,0 +1,8 @@
+?xml version=1.0 encoding=UTF-8?
+office:document 
xmlns:office=urn:oasis:names:tc:opendocument:xmlns:office:1.0 
xmlns:style=urn:oasis:names:tc:opendocument:xmlns:style:1.0 
xmlns:text=urn:oasis:names:tc:opendocument:xmlns:text:1.0 
xmlns:table=urn:oasis:names:tc:opendocument:xmlns:table:1.0 
xmlns:draw=urn:oasis:names:tc:opendocument:xmlns:drawing:1.0 
xmlns:fo=urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0 
xmlns:xlink=http://www.w3.org/1999/xlink; 
xmlns:dc=http://purl.org/dc/elements/1.1/; 
xmlns:meta=urn:oasis:names:tc:opendocument:xmlns:meta:1.0 
xmlns:number=urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0 
xmlns:svg=urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0 
xmlns:chart=urn:oasis:names:tc:opendocument:xmlns:chart:1.0 
xmlns:dr3d=urn:oasis:names:tc:opendocument:xmlns:dr3d: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:config=urn:oas
 is:names:tc:opendocument:xmlns:config:1.0 
xmlns:ooo=http://openoffice.org/2004/office; 
xmlns:ooow=http://openoffice.org/2004/writer; 
xmlns:oooc=http://openoffice.org/2004/calc; 
xmlns:dom=http://www.w3.org/2001/xml-events; 
xmlns:xforms=http://www.w3.org/2002/xforms; 
xmlns:xsd=http://www.w3.org/2001/XMLSchema; 
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; 
xmlns:rpt=http://openoffice.org/2005/report; 
xmlns:of=urn:oasis:names:tc:opendocument:xmlns:of:1.2 
xmlns:xhtml=http://www.w3.org/1999/xhtml; 
xmlns:grddl=http://www.w3.org/2003/g/data-view#; 
xmlns:officeooo=http://openoffice.org/2009/office; 
xmlns:tableooo=http://openoffice.org/2009/table; 
xmlns:drawooo=http://openoffice.org/2010/draw; 
xmlns:calcext=urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0
 
xmlns:loext=urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0
 xmlns:field=urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0 
xmlns:formx=urn:openoffice:names:
 experimental:ooxml-odf-interop:xmlns:form:1.0 
xmlns:css3t=http://www.w3.org/TR/css3-text/; office:version=1.2 
office:mimetype=application/vnd.oasis.opendocument.text
+ office:body
+  office:text
+   text:p text:style-name=P1A text:a xlink:type=simple 
xlink:href=http://s/; text:style-name=Internet_20_link 
text:visited-style-name=Visited_20_Internet_20_Linkhttp://s//text:a 
B/text:p
+  /office:text
+ /office:body
+/office:document
diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx 
b/sw/qa/extras/rtfexport/rtfexport.cxx
index 20f2a7d..33d6ca4 100644
--- a/sw/qa/extras/rtfexport/rtfexport.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport.cxx
@@ -78,6 +78,16 @@ public:
 return false;
 
 }
+
+virtual void postLoad(const char* pFilename) SAL_OVERRIDE
+{
+if (OString(pFilename) == tdf90421.fodt)
+{
+// Change the hyperlink, so its URL is empty.
+uno::Referencebeans::XPropertySet xRun(getRun(getParagraph(1), 
2), uno::UNO_QUERY);
+   

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

2015-04-20 Thread Miklos Vajna
 sw/qa/extras/rtfexport/data/hyphpar.rtf|5 +
 sw/qa/extras/rtfexport/rtfexport.cxx   |6 ++
 sw/source/filter/ww8/rtfattributeoutput.cxx|   16 ++--
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |3 +++
 4 files changed, 16 insertions(+), 14 deletions(-)

New commits:
commit a2fea109e6454b10e8e85148b93bdca89066fe8d
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Mon Apr 20 10:21:12 2015 +0200

RtfAttributeOutput::ParaHyphenZone: use \hyphpar

Previously SvxHyphenZoneItem was serialized to some custom RTF extension
that even our own RTF import ignores since LO 3.5.

Change-Id: Ia99d9750ad0b1a07105eeef2bee07e6fdbfe7876

diff --git a/sw/qa/extras/rtfexport/data/hyphpar.rtf 
b/sw/qa/extras/rtfexport/data/hyphpar.rtf
new file mode 100644
index 000..762392e
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/hyphpar.rtf
@@ -0,0 +1,5 @@
+{\rtf1\hyphauto1
+\pard\plain AAA\par
+\pard\plain\hyphpar0 BBB\par
+\pard\plain CCC\par
+}
diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx 
b/sw/qa/extras/rtfexport/rtfexport.cxx
index dc1107a..47a91db 100644
--- a/sw/qa/extras/rtfexport/rtfexport.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport.cxx
@@ -872,6 +872,12 @@ DECLARE_RTFEXPORT_TEST(testHyphauto, hyphauto.rtf)
 CPPUNIT_ASSERT_EQUAL(true, getPropertybool(getParagraph(1), 
ParaIsHyphenation));
 }
 
+DECLARE_RTFEXPORT_TEST(testHyphpar, hyphpar.rtf)
+{
+// Hyphenation was enabled for all 3 paragraphs, but it should be disabled 
for the 2nd one.
+CPPUNIT_ASSERT_EQUAL(false, getPropertybool(getParagraph(2), 
ParaIsHyphenation));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx 
b/sw/source/filter/ww8/rtfattributeoutput.cxx
index 4f7ce74..c05aacf 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -2663,20 +2663,8 @@ void RtfAttributeOutput::ParaTabStop(const 
SvxTabStopItem rTabStop)
 
 void RtfAttributeOutput::ParaHyphenZone(const SvxHyphenZoneItem rHyphenZone)
 {
-sal_Int32 nFlags = rHyphenZone.IsHyphen() ? 1 : 0;
-if (rHyphenZone.IsPageEnd())
-nFlags += 2;
-m_aStyles.append('{');
-m_aStyles.append(OOO_STRING_SVTOOLS_RTF_IGNORE);
-m_aStyles.append(OOO_STRING_SVTOOLS_RTF_HYPHEN);
-m_aStyles.append((sal_Int32)nFlags);
-m_aStyles.append(OOO_STRING_SVTOOLS_RTF_HYPHLEAD);
-m_aStyles.append((sal_Int32)rHyphenZone.GetMinLead());
-m_aStyles.append(OOO_STRING_SVTOOLS_RTF_HYPHTRAIL);
-m_aStyles.append((sal_Int32)rHyphenZone.GetMinTrail());
-m_aStyles.append(OOO_STRING_SVTOOLS_RTF_HYPHMAX);
-m_aStyles.append((sal_Int32)rHyphenZone.GetMaxHyphens());
-m_aStyles.append('}');
+m_aStyles.append(OOO_STRING_SVTOOLS_RTF_HYPHPAR);
+m_aStyles.append(int(rHyphenZone.IsHyphen()));
 }
 
 void RtfAttributeOutput::ParaNumRule_Impl(const SwTxtNode* pTxtNd, sal_Int32 
nLvl, sal_Int32 nNumId)
commit a3ec386c2283a196f8d9f1edd0ff97c38ddb281a
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Mon Apr 20 10:14:19 2015 +0200

RTF import: handle \hyphpar

Change-Id: I2a1d0e194af6eb5fb865d3ed26712eed09a3b28f

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index dd873fe..d8e5d6a 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -4890,6 +4890,9 @@ RTFError RTFDocumentImpl::dispatchToggle(RTFKeyword 
nKeyword, bool bParam, int n
 case RTF_HYPHAUTO:
 m_aSettingsTableSprms.set(NS_ooxml::LN_CT_Settings_autoHyphenation, 
pBoolValue);
 break;
+case RTF_HYPHPAR:
+
m_aStates.top().aParagraphSprms.set(NS_ooxml::LN_CT_PPrBase_suppressAutoHyphens,
 std::make_sharedRTFValue(int(bParam  nParam == 0)));
+break;
 default:
 {
 SAL_INFO(writerfilter, TODO handle toggle '  
lcl_RtfToString(nKeyword)  ');
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-04-17 Thread Miklos Vajna
 sw/qa/extras/rtfexport/data/hyphauto.rtf   |6 ++
 sw/qa/extras/rtfexport/rtfexport.cxx   |5 +
 sw/source/filter/ww8/rtfexport.cxx |   13 +
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |3 +++
 4 files changed, 27 insertions(+)

New commits:
commit 7b3c07a78b8db73a966a0999153c6a914cbedae5
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Fri Apr 17 17:13:51 2015 +0200

RTF filter: export \hyphauto

Change-Id: Ide8cb5f45d3eb60c45d86d58a9ab12bbc9f4cf47

diff --git a/sw/qa/extras/rtfexport/data/hyphauto.rtf 
b/sw/qa/extras/rtfexport/data/hyphauto.rtf
new file mode 100644
index 000..dd4767f
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/hyphauto.rtf
@@ -0,0 +1,6 @@
+{\rtf1
+\hyphauto1
+\pard\plain
+Hello.
+\par
+}
diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx 
b/sw/qa/extras/rtfexport/rtfexport.cxx
index 3ef2f13..dc1107a 100644
--- a/sw/qa/extras/rtfexport/rtfexport.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport.cxx
@@ -867,6 +867,11 @@ DECLARE_RTFEXPORT_TEST(testSautoupd, sautoupd.rtf)
 CPPUNIT_ASSERT_EQUAL(false, getPropertybool(xHeading2, IsAutoUpdate));
 }
 
+DECLARE_RTFEXPORT_TEST(testHyphauto, hyphauto.rtf)
+{
+CPPUNIT_ASSERT_EQUAL(true, getPropertybool(getParagraph(1), 
ParaIsHyphenation));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/rtfexport.cxx 
b/sw/source/filter/ww8/rtfexport.cxx
index 60ca1f0..ab5e763 100644
--- a/sw/source/filter/ww8/rtfexport.cxx
+++ b/sw/source/filter/ww8/rtfexport.cxx
@@ -36,6 +36,7 @@
 #include lineinfo.hxx
 #include swmodule.hxx
 #include IDocumentLayoutAccess.hxx
+#include IDocumentStylePoolAccess.hxx
 #include ww8par.hxx
 #include comphelper/string.hxx
 #include svtools/rtfkeywd.hxx
@@ -45,6 +46,7 @@
 #include iostream
 #endif
 #include svx/xflclit.hxx
+#include editeng/hyphenzoneitem.hxx
 
 using namespace ::com::sun::star;
 
@@ -502,6 +504,17 @@ void RtfExport::ExportDocument_Impl()
 WriteInfo();
 // Default TabSize
 
Strm().WriteCharPtr(m_pAttrOutput-m_aTabStop.makeStringAndClear().getStr()).WriteCharPtr(SAL_NEWLINE_STRING);
+
+// Automatic hyphenation: it's a global setting in Word, it's a paragraph 
setting in Writer.
+// Use the setting from the default style.
+SwTxtFmtColl* pTxtFmtColl = 
pDoc-getIDocumentStylePoolAccess().GetTxtCollFromPool(RES_POOLCOLL_STANDARD, 
/*bRegardLanguage=*/false);
+const SfxPoolItem* pItem;
+if (pTxtFmtColl  pTxtFmtColl-GetItemState(RES_PARATR_HYPHENZONE, false, 
pItem) == SfxItemState::SET)
+{
+Strm().WriteCharPtr(OOO_STRING_SVTOOLS_RTF_HYPHAUTO);
+OutULong(static_castconst SvxHyphenZoneItem*(pItem)-IsHyphen());
+}
+
 // Zoom
 SwViewShell* 
pViewShell(pDoc-getIDocumentLayoutAccess().GetCurrentViewShell());
 if (pViewShell  pViewShell-GetViewOptions()-GetZoomType() == 
SvxZoomType::PERCENT)
commit 830abf307aab9f9611db60b5c734fbafd3b3d8a3
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Fri Apr 17 16:52:46 2015 +0200

RTF filter: import \hyphauto

Automatically Hyphenate Document Contents When Displayed

Change-Id: I832eed60511b332a3f936b8239fd0a56a84879f1

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 4965e13..dd873fe 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -4887,6 +4887,9 @@ RTFError RTFDocumentImpl::dispatchToggle(RTFKeyword 
nKeyword, bool bParam, int n
 case RTF_FACINGP:
 m_aSettingsTableSprms.set(NS_ooxml::LN_CT_Settings_evenAndOddHeaders, 
pBoolValue);
 break;
+case RTF_HYPHAUTO:
+m_aSettingsTableSprms.set(NS_ooxml::LN_CT_Settings_autoHyphenation, 
pBoolValue);
+break;
 default:
 {
 SAL_INFO(writerfilter, TODO handle toggle '  
lcl_RtfToString(nKeyword)  ');
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-03-20 Thread Caolán McNamara
 sw/qa/core/data/xml/pass/ooo32780-1.sxw|binary
 sw/qa/core/filters-test.cxx|2 +-
 sw/qa/extras/odfimport/data/ooo32780-1.odt |binary
 sw/qa/extras/odfimport/odfimport.cxx   |5 +
 sw/source/core/layout/sectfrm.cxx  |   22 +++---
 5 files changed, 13 insertions(+), 16 deletions(-)

New commits:
commit abae860fa702b56fb11164ebb98acb4681e49cc1
Author: Caolán McNamara caol...@redhat.com
Date:   Fri Mar 20 13:31:47 2015 +

fix a bunch of crashtest import failures

as far as I can tell this has been broken since

commit 118dfcf180d2d5a2d015ebb5f0082962773b7d24
Date:   Thu Apr 17 15:07:52 2003 +

SwSectionFrm::CalcFtnCntnt() - consider that footnote/endnote can move

with a private bug id so not currently possible to find out what the 
original
problem to be solved was, so revert that and lock this down with an import 
test
and maybe we will flush out the original problem eventually.

Change-Id: I2af13b9b5875928aa157d47be0aaff2836ba38e1

diff --git a/sw/qa/core/data/xml/pass/ooo32780-1.sxw 
b/sw/qa/core/data/xml/pass/ooo32780-1.sxw
new file mode 100644
index 000..f946567
Binary files /dev/null and b/sw/qa/core/data/xml/pass/ooo32780-1.sxw differ
diff --git a/sw/qa/extras/odfimport/data/ooo32780-1.odt 
b/sw/qa/extras/odfimport/data/ooo32780-1.odt
new file mode 100644
index 000..e7185b6
Binary files /dev/null and b/sw/qa/extras/odfimport/data/ooo32780-1.odt differ
diff --git a/sw/qa/extras/odfimport/odfimport.cxx 
b/sw/qa/extras/odfimport/odfimport.cxx
index 139e2bc..dd32fb6 100644
--- a/sw/qa/extras/odfimport/odfimport.cxx
+++ b/sw/qa/extras/odfimport/odfimport.cxx
@@ -314,6 +314,11 @@ DECLARE_ODFIMPORT_TEST(testFdo56272, fdo56272.odt)
 CPPUNIT_ASSERT_EQUAL(sal_Int32(422), xShape-getPosition().Y); // Was -2371
 }
 
+DECLARE_ODFIMPORT_TEST(testCalcFtnCntnt, ooo32780-1.odt)
+{
+//this was a CalcFtnCntnt crash
+}
+
 DECLARE_ODFIMPORT_TEST(testFdo75872_ooo33, fdo75872_ooo33.odt)
 {
 // graphics default style: line color and fill color changed
diff --git a/sw/source/core/layout/sectfrm.cxx 
b/sw/source/core/layout/sectfrm.cxx
index 437a6c7..5215723 100644
--- a/sw/source/core/layout/sectfrm.cxx
+++ b/sw/source/core/layout/sectfrm.cxx
@@ -2497,11 +2497,6 @@ long SwSectionFrm::Undersize( bool bOverSize )
 return nRet;
 }
 
-/// OD 01.04.2003 #108446# - determine next frame for footnote/endnote 
formatting
-/// before format of current one, because current one can move backward.
-/// After moving backward to a previous page method FindNext() will return
-/// the text frame presenting the first page footnote, if it exists. Thus, the
-/// rest of the footnote/endnote container would not be formatted.
 void SwSectionFrm::CalcFtnCntnt()
 {
 SwFtnContFrm* pCont = ContainsFtnCont();
@@ -2515,20 +2510,17 @@ void SwSectionFrm::CalcFtnCntnt()
 SwFtnFrm* pFtn = pFrm-FindFtnFrm();
 if( pFtn )
 pFtn-Calc();
-// OD 01.04.2003 #108446# - determine next frame before format 
current frame.
-SwFrm* pNextFrm = 0;
+pFrm-Calc();
+if( pFrm-IsSctFrm() )
 {
-if( pFrm-IsSctFrm() )
-{
-pNextFrm = static_castSwSectionFrm*(pFrm)-ContainsAny();
-}
-if( !pNextFrm )
+SwFrm *pTmp = static_castSwSectionFrm*(pFrm)-ContainsAny();
+if( pTmp )
 {
-pNextFrm = pFrm-FindNext();
+pFrm = pTmp;
+continue;
 }
 }
-pFrm-Calc();
-pFrm = pNextFrm;
+pFrm = pFrm-FindNext();
 }
 }
 }
commit 7b9fbdd9a7d0701b6a771b5c590c5393f366a6b6
Author: Caolán McNamara caol...@redhat.com
Date:   Fri Mar 20 13:27:36 2015 +

Staroffice-StarOffice

Change-Id: I10055b9d448115c1699c82a0e86cfd6ed709b648

diff --git a/sw/qa/core/filters-test.cxx b/sw/qa/core/filters-test.cxx
index e6713fc..023b50d9a 100644
--- a/sw/qa/core/filters-test.cxx
+++ b/sw/qa/core/filters-test.cxx
@@ -135,7 +135,7 @@ bool SwFiltersTest::filter(const OUString rFilter, const 
OUString rURL,
 
 void SwFiltersTest::testCVEs()
 {
-testDir(OUString(Staroffice XML (Writer)),
+testDir(OUString(StarOffice XML (Writer)),
 getURLFromSrc(/sw/qa/core/data/xml/),
 OUString(FILTER_XML),
 SfxFilterFlags::IMPORT | SfxFilterFlags::OWN | 
SfxFilterFlags::DEFAULT,
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-02-15 Thread Miklos Vajna
 sw/qa/extras/rtfexport/data/margmirror.rtf |9 +
 sw/qa/extras/rtfexport/rtfexport.cxx   |8 
 sw/source/core/doc/fmtcol.cxx  |8 
 sw/source/core/docnode/nodedump.cxx|   12 
 sw/source/filter/ww8/rtfexport.cxx |3 +++
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |3 +++
 6 files changed, 31 insertions(+), 12 deletions(-)

New commits:
commit 92dae379f9e9da3a515216a95a820032e895eafe
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Sun Feb 15 13:44:36 2015 +0100

RTF filter: handle mirrored margins

Change-Id: I122f5f23e510ae42664d2b69504f4722aa05597e

diff --git a/sw/qa/extras/rtfexport/data/margmirror.rtf 
b/sw/qa/extras/rtfexport/data/margmirror.rtf
new file mode 100644
index 000..819cf5e
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/margmirror.rtf
@@ -0,0 +1,9 @@
+{\rtf1
+\paperw11906\paperh16838\margl1800\margr4200\margt1440\margb1440
+\margmirror
+foo
+\par
+\pagebb
+bar
+\par
+}
diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx 
b/sw/qa/extras/rtfexport/rtfexport.cxx
index 438cb2d..f056208 100644
--- a/sw/qa/extras/rtfexport/rtfexport.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport.cxx
@@ -15,6 +15,7 @@
 #include com/sun/star/drawing/FillStyle.hpp
 #include com/sun/star/drawing/PointSequenceSequence.hpp
 #include com/sun/star/frame/XStorable.hpp
+#include com/sun/star/style/PageStyleLayout.hpp
 #include com/sun/star/table/BorderLine2.hpp
 #include com/sun/star/table/ShadowFormat.hpp
 #include com/sun/star/text/FontEmphasis.hpp
@@ -859,6 +860,13 @@ DECLARE_RTFEXPORT_TEST(testTdf88583, tdf88583.odt)
 CPPUNIT_ASSERT_EQUAL(static_castsal_Int32(0x00cc00), 
getPropertysal_Int32(getParagraph(1), FillColor));
 }
 
+DECLARE_RTFEXPORT_TEST(testMargmirror, margmirror.rtf)
+{
+// \margmirror was not handled, this was PageStyleLayout_ALL.
+uno::Referencebeans::XPropertySet 
xPageStyle(getStyles(PageStyles)-getByName(Standard), uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(style::PageStyleLayout_MIRRORED, 
getPropertystyle::PageStyleLayout(xPageStyle, PageStyleLayout));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/rtfexport.cxx 
b/sw/source/filter/ww8/rtfexport.cxx
index 068e59d..a8b991b 100644
--- a/sw/source/filter/ww8/rtfexport.cxx
+++ b/sw/source/filter/ww8/rtfexport.cxx
@@ -512,6 +512,9 @@ void RtfExport::ExportDocument_Impl()
 // Record changes?
 if (nsRedlineMode_t::REDLINE_ON  mnRedlineMode)
 Strm().WriteCharPtr(OOO_STRING_SVTOOLS_RTF_REVISIONS);
+// Mirror margins?
+if ((nsUseOnPage::PD_MIRROR  pDoc-GetPageDesc(0).ReadUseOn()) == 
nsUseOnPage::PD_MIRROR)
+Strm().WriteCharPtr(OOO_STRING_SVTOOLS_RTF_MARGMIRROR);
 // Init sections
 m_pSections = new MSWordSections(*this);
 
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 0b124a5..d6adeae 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -3491,6 +3491,9 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword 
nKeyword)
 case RTF_NOCOLBAL:
 m_aSettingsTableSprms.set(NS_ooxml::LN_CT_Compat_noColumnBalance, 
std::make_sharedRTFValue(1));
 break;
+case RTF_MARGMIRROR:
+m_aSettingsTableSprms.set(NS_ooxml::LN_CT_Settings_mirrorMargins, 
std::make_sharedRTFValue(1));
+break;
 default:
 {
 SAL_INFO(writerfilter, TODO handle flag '  
lcl_RtfToString(nKeyword)  ');
commit f858994c989091e3d4d5f9ea9169802583be2fe9
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Sun Feb 15 13:34:11 2015 +0100

Extract SwTxtFmtColls::dumpAsXml() from docnode

Change-Id: Ie5d2865aeca0292044eaed72b8ea6c5e5316a3cb

diff --git a/sw/source/core/doc/fmtcol.cxx b/sw/source/core/doc/fmtcol.cxx
index 8f6af9c..5124ec4 100644
--- a/sw/source/core/doc/fmtcol.cxx
+++ b/sw/source/core/doc/fmtcol.cxx
@@ -472,6 +472,14 @@ void SwTxtFmtColl::dumpAsXml(xmlTextWriterPtr pWriter) 
const
 xmlTextWriterEndElement(pWriter);
 }
 
+void SwTxtFmtColls::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+xmlTextWriterStartElement(pWriter, BAD_CAST(swTxtFmtColls));
+for (size_t i = 0; i  size(); ++i)
+GetFmt(i)-dumpAsXml(pWriter);
+xmlTextWriterEndElement(pWriter);
+}
+
 //FEATURE::CONDCOLL
 
 SwCollCondition::SwCollCondition( SwTxtFmtColl* pColl, sal_uLong nMasterCond,
diff --git a/sw/source/core/docnode/nodedump.cxx 
b/sw/source/core/docnode/nodedump.cxx
index e2910b0..bd2438d 100644
--- a/sw/source/core/docnode/nodedump.cxx
+++ b/sw/source/core/docnode/nodedump.cxx
@@ -301,18 +301,6 @@ void SwSectionFmts::dumpAsXml(xmlTextWriterPtr w) const
 }
 }
 
-void SwTxtFmtColls::dumpAsXml(xmlTextWriterPtr w) const
-{
-WriterHelper writer(w);
-if (size())
-{
-writer.startElement(swtxtfmtcolls);
-for (size_t i = 0; i  size(); 

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

2015-01-18 Thread Miklos Vajna
 sw/qa/extras/odfexport/data/gerrit13858.odt |binary
 sw/qa/extras/odfexport/odfexport.cxx|5 
 sw/source/core/doc/textboxhelper.cxx|   31 +++-
 sw/source/filter/xml/xmltble.cxx|4 +--
 4 files changed, 33 insertions(+), 7 deletions(-)

New commits:
commit 8d758d0764beb78a49f3035c254eb085b112c2b1
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Sun Jan 18 21:17:03 2015 +0100

SwTextBoxHelper::findTextBoxes: optimize unnecessary O(n^2)

Change-Id: Ib127b6cf44a69709673465db99cc79417b18c266

diff --git a/sw/source/core/doc/textboxhelper.cxx 
b/sw/source/core/doc/textboxhelper.cxx
index d447b5b..f5096a0 100644
--- a/sw/source/core/doc/textboxhelper.cxx
+++ b/sw/source/core/doc/textboxhelper.cxx
@@ -114,17 +114,38 @@ void SwTextBoxHelper::destroy(SwFrmFmt* pShape)
 
 std::setconst SwFrmFmt* SwTextBoxHelper::findTextBoxes(const SwDoc* pDoc)
 {
-std::setconst SwFrmFmt* aRet;
+std::setconst SwFrmFmt* aTextBoxes;
+std::mapSwNodeIndex, const SwFrmFmt* aFlyFormats, aDrawFormats;
 
 const SwFrmFmts rSpzFrmFmts = *pDoc-GetSpzFrmFmts();
 for (SwFrmFmts::const_iterator it = rSpzFrmFmts.begin(); it != 
rSpzFrmFmts.end(); ++it)
 {
-SwFrmFmt* pTextBox = findTextBox(*it);
-if (pTextBox)
-aRet.insert(pTextBox);
+const SwFrmFmt* pFormat = *it;
+
+// A TextBox in the context of this class is a fly frame that has a
+// matching (same RES_CNTNT) draw frame.
+if (!pFormat-GetAttrSet().HasItem(RES_CNTNT) || 
!pFormat-GetCntnt().GetCntntIdx())
+continue;
+
+const SwNodeIndex rIndex = *pFormat-GetCntnt().GetCntntIdx();
+
+if (pFormat-Which() == RES_FLYFRMFMT)
+{
+if (aDrawFormats.find(rIndex) != aDrawFormats.end())
+aTextBoxes.insert(pFormat);
+else
+aFlyFormats[rIndex] = pFormat;
+}
+else if (pFormat-Which() == RES_DRAWFRMFMT)
+{
+if (aFlyFormats.find(rIndex) != aFlyFormats.end())
+aTextBoxes.insert(aFlyFormats[rIndex]);
+else
+aDrawFormats[rIndex] = pFormat;
+}
 }
 
-return aRet;
+return aTextBoxes;
 }
 
 std::setconst SwFrmFmt* SwTextBoxHelper::findTextBoxes(const SwNode rNode)
commit 80eb001e6a861c68f2915d4eebded5e36e1875f6
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Sun Jan 18 21:16:55 2015 +0100

ODT export: fix namespace of table:covered-table-cell inside shapes

Change-Id: If96b46bac7f8212cfb83dc8b4528986137f1eaea

diff --git a/sw/qa/extras/odfexport/data/gerrit13858.odt 
b/sw/qa/extras/odfexport/data/gerrit13858.odt
new file mode 100644
index 000..9b3dd37
Binary files /dev/null and b/sw/qa/extras/odfexport/data/gerrit13858.odt differ
diff --git a/sw/qa/extras/odfexport/odfexport.cxx 
b/sw/qa/extras/odfexport/odfexport.cxx
index 77ae4ec..f23c2a3 100644
--- a/sw/qa/extras/odfexport/odfexport.cxx
+++ b/sw/qa/extras/odfexport/odfexport.cxx
@@ -432,6 +432,11 @@ DECLARE_ODFEXPORT_TEST(testFdo86963, fdo86963.odt)
 CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDrawPage-getCount());
 }
 
+DECLARE_ODFEXPORT_TEST(testGerrit13858, gerrit13858.odt)
+{
+// Just make sure the output is valid.
+}
+
 #endif
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/filter/xml/xmltble.cxx b/sw/source/filter/xml/xmltble.cxx
index de682f2..b1db68f 100644
--- a/sw/source/filter/xml/xmltble.cxx
+++ b/sw/source/filter/xml/xmltble.cxx
@@ -897,7 +897,7 @@ void SwXMLExport::ExportTableLine( const SwTableLine rLine,
 const long nRowSpan = pBox-getRowSpan();
 if( nRowSpan  1 )
 {
-SvXMLElementExport aElem2( *this, XML_NAMESPACE_TABLE,
+SvXMLElementExport aElem2( *this, rTblInfo.GetPrefix(),
   XML_COVERED_TABLE_CELL, true,
   false );
 }
@@ -930,7 +930,7 @@ void SwXMLExport::ExportTableLine( const SwTableLine rLine,
 
 for( size_t i=nOldCol; inCol; ++i )
 {
-SvXMLElementExport aElemExport( *this, XML_NAMESPACE_TABLE,
+SvXMLElementExport aElemExport( *this, rTblInfo.GetPrefix(),
   XML_COVERED_TABLE_CELL, true,
   false );
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-12-27 Thread Miklos Vajna
 sw/qa/extras/odfexport/odfexport.cxx |5 +
 sw/source/core/docnode/node.cxx  |3 +++
 sw/source/filter/xml/xmltble.cxx |   34 ++
 sw/source/filter/xml/xmltbli.cxx |4 +++-
 xmloff/source/text/txtimp.cxx|1 +
 5 files changed, 34 insertions(+), 13 deletions(-)

New commits:
commit e4de5b40eb7220da2d337eb98d7905a98dc12c72
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Sat Dec 27 12:11:43 2014 +0100

fdo#84714 ODT export: write loext:table inside draw:custom-shape

Change-Id: I543ec24f8825bcc7c35acc106402f4fc6b4b5d79

diff --git a/sw/qa/extras/odfexport/odfexport.cxx 
b/sw/qa/extras/odfexport/odfexport.cxx
index 41c4ed9..194fc34 100644
--- a/sw/qa/extras/odfexport/odfexport.cxx
+++ b/sw/qa/extras/odfexport/odfexport.cxx
@@ -400,6 +400,11 @@ DECLARE_ODFEXPORT_TEST(testTextboxRoundedCorners, 
textbox-rounded-corners.odt)
 uno::Referencetext::XTextTable xTable(getParagraphOrTable(1, xText), 
uno::UNO_QUERY);
 uno::Referencetext::XTextRange xCell(xTable-getCellByName(A1), 
uno::UNO_QUERY);
 CPPUNIT_ASSERT_EQUAL(OUString(a), xCell-getString());
+
+// Table inside a textbox should be in the extension namespace.
+if (xmlDocPtr pXmlDoc = parseExport(content.xml))
+// This failed, as draw:custom-shape had a table:table child.
+assertXPath(pXmlDoc, //draw:custom-shape/loext:table, name, 
Table1);
 }
 
 DECLARE_ODFEXPORT_TEST(testFdo86963, fdo86963.odt)
diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx
index 98126b7..14af4ce 100644
--- a/sw/source/core/docnode/node.cxx
+++ b/sw/source/core/docnode/node.cxx
@@ -717,6 +717,9 @@ SwFrmFmt* SwNode::GetFlyFmt() const
 for( size_t n = 0; n  rFrmFmtTbl.size(); ++n )
 {
 SwFrmFmt* pFmt = rFrmFmtTbl[n];
+// Only Writer fly frames can contain Writer nodes.
+if (pFmt-Which() != RES_FLYFRMFMT)
+continue;
 const SwFmtCntnt rCntnt = pFmt-GetCntnt();
 if( rCntnt.GetCntntIdx() 
 rCntnt.GetCntntIdx()-GetNode() == pSttNd )
diff --git a/sw/source/filter/xml/xmltble.cxx b/sw/source/filter/xml/xmltble.cxx
index d426787..a698c94 100644
--- a/sw/source/filter/xml/xmltble.cxx
+++ b/sw/source/filter/xml/xmltble.cxx
@@ -50,6 +50,7 @@
 #include xmlexp.hxx
 #include boost/foreach.hpp
 #include o3tl/sorted_vector.hxx
+#include textboxhelper.hxx
 
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
@@ -461,10 +462,11 @@ class SwXMLTableInfo_Impl
 const SwTable *pTable;
 Reference  XTextSection  xBaseSection;
 bool bBaseSectionValid;
+sal_uInt32 m_nPrefix;
 
 public:
 
-inline SwXMLTableInfo_Impl( const SwTable *pTbl );
+inline SwXMLTableInfo_Impl( const SwTable *pTbl, sal_uInt16 nPrefix );
 
 const SwTable *GetTable() const { return pTable; }
 const SwFrmFmt *GetTblFmt() const { return pTable-GetFrmFmt(); }
@@ -472,11 +474,14 @@ public:
 bool IsBaseSectionValid() const { return bBaseSectionValid; }
 const Reference  XTextSection  GetBaseSection() const { return 
xBaseSection; }
 inline void SetBaseSection( const Reference  XTextSection  rBase );
+/// The namespace (table or loext) that should be used for the elements.
+sal_uInt16 GetPrefix() const { return m_nPrefix; }
 };
 
-inline SwXMLTableInfo_Impl::SwXMLTableInfo_Impl( const SwTable *pTbl ) :
+inline SwXMLTableInfo_Impl::SwXMLTableInfo_Impl( const SwTable *pTbl, 
sal_uInt16 nPrefix ) :
 pTable( pTbl ),
-bBaseSectionValid( false )
+bBaseSectionValid( false ),
+m_nPrefix(nPrefix)
 {
 }
 
@@ -719,7 +724,7 @@ void SwXMLExport::ExportTableAutoStyles( const SwTableNode 
rTblNd )
 SwXMLTableColumnsSortByWidth_Impl aExpCols;
 SwXMLTableFrmFmtsSort_Impl aExpRows;
 SwXMLTableFrmFmtsSort_Impl aExpCells;
-SwXMLTableInfo_Impl aTblInfo( rTbl );
+SwXMLTableInfo_Impl aTblInfo( rTbl, XML_NAMESPACE_TABLE );
 ExportTableLinesAutoStyles( rTbl.GetTabLines(), nAbsWidth, nBaseWidth,
 pTblFmt-GetName(), aExpCols, aExpRows, 
aExpCells,
 aTblInfo, true);
@@ -828,7 +833,7 @@ void SwXMLExport::ExportTableBox( const SwTableBox rBox,
 }
 
 // export cell element
-SvXMLElementExport aElem( *this, XML_NAMESPACE_TABLE,
+SvXMLElementExport aElem( *this, rTblInfo.GetPrefix(),
 XML_TABLE_CELL, true, true );
 
 // export cell content
@@ -879,8 +884,7 @@ void SwXMLExport::ExportTableLine( const SwTableLine rLine,
 }
 
 {
-SvXMLElementExport aElem( *this, XML_NAMESPACE_TABLE,
-  XML_TABLE_ROW, true, true );
+SvXMLElementExport aElem( *this, rTblInfo.GetPrefix(), XML_TABLE_ROW, 
true, true );
 const 

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

2014-12-19 Thread Miklos Vajna
 sw/qa/extras/ooxmlexport/data/decimal-numbering-no-leveltext.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport5.cxx |7 +++
 sw/qa/extras/rtfimport/rtfimport.cxx  |5 ++
 sw/source/filter/ww8/docxattributeoutput.cxx  |7 +++
 writerfilter/source/dmapper/NumberingManager.cxx  |   19 
++
 writerfilter/source/ooxml/OOXMLParserState.hxx|4 --
 6 files changed, 36 insertions(+), 6 deletions(-)

New commits:
commit e155e05ab70f1744d296dbee8c61564a5b7d346c
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Fri Dec 19 16:26:59 2014 +0100

DOCX filter: handle decimal number format with no level text correctly

The first problem was that no level text means no list text in Word, but
Writer only does that for the none numbering format.

Also, when the numbering format is none, then Writer doesn't show the
follow character (typically a tab), either, but Word does: add a zero
width space as a suffix to mimic the Word behavior on DOCX import.

Adapt CppunitTest_sw_rtfimport accordingly, that effectively tested that
LabelFollowedBy is lost on import.

Change-Id: I7d5c7e62ba3d02da4a750ba5afad07e68b0b8c38

diff --git a/sw/qa/extras/ooxmlexport/data/decimal-numbering-no-leveltext.docx 
b/sw/qa/extras/ooxmlexport/data/decimal-numbering-no-leveltext.docx
new file mode 100644
index 000..d7ec479
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/decimal-numbering-no-leveltext.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
index 89ead20..c65e546 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
@@ -99,6 +99,13 @@ DECLARE_OOXMLEXPORT_TEST(testfdo76589 , fdo76589.docx)
 assertXPath ( pXmlDoc, 
/w:numbering/w:abstractNum[1]/w:lvl[1]/w:lvlText,val,%1 );
 }
 
+DECLARE_OOXMLEXPORT_TEST(testDecimalNumberingNoLeveltext, 
decimal-numbering-no-leveltext.docx)
+{
+// This was %1, not empty: we turned a kind-of-none numbering into a 
decimal one.
+if (xmlDocPtr pXmlDoc = parseExport(word/numbering.xml))
+assertXPath (pXmlDoc, 
/w:numbering/w:abstractNum[1]/w:lvl[1]/w:lvlText,val, );
+}
+
 DECLARE_OOXMLEXPORT_TEST(testfdo79008, fdo79008.docx)
 {
 /* File getting crash while saving in LO.
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx 
b/sw/qa/extras/rtfimport/rtfimport.cxx
index 0e651d0..4a07fd0 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -582,7 +582,10 @@ DECLARE_RTFIMPORT_TEST(testFdo49692, fdo49692.rtf)
 const beans::PropertyValue rProp = aProps[i];
 
 if (rProp.Name == Suffix)
-CPPUNIT_ASSERT_EQUAL(sal_Int32(0), 
rProp.Value.getOUString().getLength());
+{
+OUString aExpected(static_castsal_Unicode(0x200B));
+CPPUNIT_ASSERT_EQUAL(aExpected, rProp.Value.getOUString());
+}
 }
 }
 
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index b45371b..4386d5b 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -5955,7 +5955,12 @@ void DocxAttributeOutput::NumberingLevel( sal_uInt8 
nLevel,
 }
 else
 {
-m_pSerializer-singleElementNS( XML_w, XML_lvlText,FSNS( XML_w, 
XML_val ), OUStringToOString( aBuffer.makeStringAndClear(), 
RTL_TEXTENCODING_UTF8 ).getStr(), FSEND );
+// Writer's zero width space suffix is necessary, so that 
LabelFollowedBy shows up, but Word doesn't require that.
+OUString aLevelText = aBuffer.makeStringAndClear();
+static OUString aZeroWidthSpace(static_castsal_Unicode(0x200B));
+if (aLevelText == aZeroWidthSpace)
+aLevelText.clear();
+m_pSerializer-singleElementNS(XML_w, XML_lvlText, FSNS(XML_w, 
XML_val), aLevelText.toUtf8(), FSEND);
 }
 
 // bullet
diff --git a/writerfilter/source/dmapper/NumberingManager.cxx 
b/writerfilter/source/dmapper/NumberingManager.cxx
index 0a1c52f..cae1b6a 100644
--- a/writerfilter/source/dmapper/NumberingManager.cxx
+++ b/writerfilter/source/dmapper/NumberingManager.cxx
@@ -33,6 +33,7 @@
 
 #include osl/diagnose.h
 #include rtl/ustring.hxx
+#include comphelper/sequenceashashmap.hxx
 
 #include dmapperLoggers.hxx
 
@@ -273,6 +274,10 @@ uno::Sequence beans::PropertyValue  
ListLevel::GetLevelProperties( )
 {
 if (!m_sGraphicURL.isEmpty() || m_sGraphicBitmap.is())
 nNumberFormat = style::NumberingType::BITMAP;
+else if (m_sBulletChar.isEmpty()  nNumberFormat != 
style::NumberingType::CHAR_SPECIAL)
+// w:lvlText is empty, that means no numbering in Word.
+// CHAR_SPECIAL is handled separately below.
+nNumberFormat = style::NumberingType::NUMBER_NONE;
 

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

2014-12-19 Thread Miklos Vajna
 sw/qa/extras/inc/swmodeltestbase.hxx |3 +++
 sw/qa/extras/odfexport/data/fdo86963.odt |binary
 sw/qa/extras/odfexport/odfexport.cxx |   10 --
 sw/source/core/unocore/unodraw.cxx   |   13 +++--
 4 files changed, 22 insertions(+), 4 deletions(-)

New commits:
commit 97952280f0adbe195e6a2e0bab8a21a7e352a721
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Fri Dec 19 19:41:52 2014 +0100

fdo#86963 SwXShape: don't ask SwTextBoxHelper for ZOrder of child shapes

Regression from commit 01fc08c0b5c57fef8ad3755672f4266d85e849a5
(fdo#85554 SwXShape: fix getting ZOrder property when doc contains
TextBoxes, 2014-11-20), the problem was that we returned wrong ZOrder of
shapes inside group shapes.

In SwXShape::getPropertyValue(), pObj points to the Writer-interfacing
outermost group shape in case of shapes contained by group shapes, while
GetSvxShape() gives access to the real shape. Given that TextBoxes are
only possible at the highest level (and not inside group shapes), just
check if the two pointers are the same: when not, then no need to
convert anything.

With this, child shapes get back their original ZOrder -- before in case
the group shape had ZOrder=0, all its child shapes had ZOrder=0 as well.

Change-Id: I9c4097154130cd04f6ab2f2082abafc1d4333872

diff --git a/sw/qa/extras/odfexport/data/fdo86963.odt 
b/sw/qa/extras/odfexport/data/fdo86963.odt
new file mode 100644
index 000..72896e1
Binary files /dev/null and b/sw/qa/extras/odfexport/data/fdo86963.odt differ
diff --git a/sw/qa/extras/odfexport/odfexport.cxx 
b/sw/qa/extras/odfexport/odfexport.cxx
index 9c2200c..41c4ed9 100644
--- a/sw/qa/extras/odfexport/odfexport.cxx
+++ b/sw/qa/extras/odfexport/odfexport.cxx
@@ -402,6 +402,14 @@ DECLARE_ODFEXPORT_TEST(testTextboxRoundedCorners, 
textbox-rounded-corners.odt)
 CPPUNIT_ASSERT_EQUAL(OUString(a), xCell-getString());
 }
 
+DECLARE_ODFEXPORT_TEST(testFdo86963, fdo86963.odt)
+{
+// Export of this document failed with beans::UnknownPropertyException.
+uno::Referencedrawing::XDrawPageSupplier xDrawPageSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Referencedrawing::XDrawPage xDrawPage = 
xDrawPageSupplier-getDrawPage();
+CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDrawPage-getCount());
+}
+
 #endif
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/core/unocore/unodraw.cxx 
b/sw/source/core/unocore/unodraw.cxx
index ea0dd24..3cc240e 100644
--- a/sw/source/core/unocore/unodraw.cxx
+++ b/sw/source/core/unocore/unodraw.cxx
@@ -1763,8 +1763,17 @@ uno::Any SwXShape::getPropertyValue(const OUString 
rPropertyName)
 const SdrObject* pObj = pFmt-FindRealSdrObject();
 if (pObj)
 {
-std::setconst SwFrmFmt* aTextBoxes = 
SwTextBoxHelper::findTextBoxes(pFmt-GetDoc());
-aRet = SwTextBoxHelper::getOrdNum(pObj, aTextBoxes);
+bool bConvert = true;
+if (SvxShape* pSvxShape = GetSvxShape())
+// In case of group shapes, pSvxShape points to 
the child shape, while pObj points to the outermost group shape.
+if (pSvxShape-GetSdrObject() != pObj)
+// Textboxes are not expected inside group 
shapes, so no conversion is necessary there.
+bConvert = false;
+if (bConvert)
+{
+std::setconst SwFrmFmt* aTextBoxes = 
SwTextBoxHelper::findTextBoxes(pFmt-GetDoc());
+aRet = SwTextBoxHelper::getOrdNum(pObj, 
aTextBoxes);
+}
 }
 }
 }
commit cdb8d7a53e587819044f2b5ea43c6416909686b1
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Fri Dec 19 22:31:11 2014 +0100

CppunitTest_sw_odfexport: allow running a single testcase

Change-Id: Iaaa3d8a4e8ddf419ecaf75dfa30d1b4a9bc984af

diff --git a/sw/qa/extras/inc/swmodeltestbase.hxx 
b/sw/qa/extras/inc/swmodeltestbase.hxx
index 8e8dea8..30b642c 100644
--- a/sw/qa/extras/inc/swmodeltestbase.hxx
+++ b/sw/qa/extras/inc/swmodeltestbase.hxx
@@ -91,6 +91,7 @@ using namespace css;
 #define DECLARE_RTFIMPORT_TEST(TestName, filename) 
DECLARE_SW_IMPORT_TEST(TestName, filename, Test)
 #define DECLARE_RTFEXPORT_TEST(TestName, filename) 
DECLARE_SW_ROUNDTRIP_TEST(TestName, filename, Test)
 #define DECLARE_ODFIMPORT_TEST(TestName, filename) 
DECLARE_SW_IMPORT_TEST(TestName, filename, Test)
+#define DECLARE_ODFEXPORT_TEST(TestName, filename) 
DECLARE_SW_ROUNDTRIP_TEST(TestName, filename, Test)
 #define DECLARE_WW8EXPORT_TEST(TestName, filename) 
DECLARE_SW_ROUNDTRIP_TEST(TestName, filename, Test)
 
 // For testing during development of a test, you want to use
@@ -102,6 +103,7 @@ using namespace css;
 #define 

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

2014-12-10 Thread Matúš Kukan
 sw/qa/extras/uiwriter/data/uno-cycle.odt |binary
 sw/qa/extras/uiwriter/uiwriter.cxx   |   17 +
 sw/source/core/unocore/unoportenum.cxx   |5 +
 3 files changed, 22 insertions(+)

New commits:
commit 4a3328a98f00818044694a9b6a0f7cda392273c6
Author: Matúš Kukan matus.ku...@collabora.com
Date:   Wed Dec 10 12:06:49 2014 +0100

sw: Unit test for cycle in lcl_CreatePortions

Reviewed on:
https://gerrit.libreoffice.org/13413
Conflicts:
sw/qa/extras/uiwriter/uiwriter.cxx

Change-Id: I26a8707046d7f30381fb51c41e49f8dee4796ba7

diff --git a/sw/qa/extras/uiwriter/data/uno-cycle.odt 
b/sw/qa/extras/uiwriter/data/uno-cycle.odt
new file mode 100644
index 000..51e798f
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/uno-cycle.odt differ
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx 
b/sw/qa/extras/uiwriter/uiwriter.cxx
index 4229877..d3649d0 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -63,6 +63,7 @@ public:
 void testAutoCorr();
 void testFdo87005();
 void testMergeDoc();
+void testCreatePortions();
 
 CPPUNIT_TEST_SUITE(SwUiWriterTest);
 CPPUNIT_TEST(testReplaceForward);
@@ -89,6 +90,7 @@ public:
 CPPUNIT_TEST(testAutoCorr);
 CPPUNIT_TEST(testFdo87005);
 CPPUNIT_TEST(testMergeDoc);
+CPPUNIT_TEST(testCreatePortions);
 
 CPPUNIT_TEST_SUITE_END();
 
@@ -662,6 +664,21 @@ void SwUiWriterTest::testMergeDoc()
 getParagraph(7, );
 }
 
+void SwUiWriterTest::testCreatePortions()
+{
+createDoc(uno-cycle.odt);
+uno::Referencetext::XBookmarksSupplier xBookmarksSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Referencetext::XTextContent 
xText(xBookmarksSupplier-getBookmarks()-getByName(Mark), uno::UNO_QUERY);
+uno::Referencecontainer::XEnumerationAccess 
xTextCursor(xText-getAnchor(), uno::UNO_QUERY);
+CPPUNIT_ASSERT(xTextCursor.is());
+
+uno::Referencecontainer::XEnumerationAccess xParagraph(
+xTextCursor-createEnumeration()-nextElement(), uno::UNO_QUERY);
+CPPUNIT_ASSERT(xParagraph.is());
+// This looped forever in lcl_CreatePortions
+xParagraph-createEnumeration();
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest);
 CPPUNIT_PLUGIN_IMPLEMENT();
 
commit 6d65e30fbaba383cbb9e1db6230a04865897ac8f
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Wed Dec 10 16:08:05 2014 +0100

sw UNO API: fix infinite loop when building portions of a bookmark range

The problem was that in case the bookmark range points to a number of
characters in a text node, where neither the start or the end is the 
paragraph
start and end, and in case there is an at-char anchored object at the 
beginning
of the paragraph, then lcl_CreatePortions() never ended.

It is assumed that the loop in lcl_CreatePortions() will end at some stage, 
as
every iteration moves the cursor forward. But this wasn't true in the above
situation: the first frame was anchored at char pos 0, the range was char
positions 1..7, and we failed to ignore frames which are anchored before 
start:
so position was constantly 1.

Fix the problem by explicitly ignoring frames before the current position, 
so
lcl_ExportFrames() properly returns -1 when there are no anchored objects in
the current range. Testcase is in the next commit.

Change-Id: I73662e09cd09ee7e0ea4575b1150beb40f1ccc3a

diff --git a/sw/source/core/unocore/unoportenum.cxx 
b/sw/source/core/unocore/unoportenum.cxx
index 039e60f..422bce9 100644
--- a/sw/source/core/unocore/unoportenum.cxx
+++ b/sw/source/core/unocore/unoportenum.cxx
@@ -1193,6 +1193,11 @@ static sal_Int32 lcl_ExportFrames(
 FrameDependSortList_t  i_rFrames,
 sal_Int32 const i_nCurrentIndex)
 {
+// Ignore frames which are not exported, as we are exporting a selection
+// and they are anchored before the start of the selection.
+while (i_rFrames.size()  i_rFrames.front().nIndex  i_nCurrentIndex)
+i_rFrames.pop_front();
+
 // find first Frame in (sorted) i_rFrames at current position
 while (i_rFrames.size()  (i_rFrames.front().nIndex == i_nCurrentIndex))
 // do not check for i_nEnd here; this is done implicity by lcl_MoveCursor
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-11-08 Thread Miklos Vajna
 sw/qa/extras/inc/swmodeltestbase.hxx |   84 ---
 sw/qa/extras/mailmerge/mailmerge.cxx |   84 +++
 sw/source/ui/frmdlg/frmdlg.cxx   |2 
 sw/source/uibase/inc/frmpage.hxx |4 -
 4 files changed, 87 insertions(+), 87 deletions(-)

New commits:
commit 1da74e727d7f8703006cfe574b26621d5f674693
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Sat Nov 8 13:52:38 2014 +0100

CppunitTest_sw_mailmerge: move more methods from header file

Change-Id: Idecf7c2ec3b736ba1d9a2826773c95f26ef91990

diff --git a/sw/qa/extras/inc/swmodeltestbase.hxx 
b/sw/qa/extras/inc/swmodeltestbase.hxx
index 413d016..3452950 100644
--- a/sw/qa/extras/inc/swmodeltestbase.hxx
+++ b/sw/qa/extras/inc/swmodeltestbase.hxx
@@ -149,12 +149,6 @@ using namespace css;
 CPPUNIT_TEST_SUITE_REGISTRATION(TestName); \
 void TestName::verify()
 
-/**
- * Maps database URIs to the registered database names for quick lookups
- */
-typedef std::mapOUString, OUString DBuriMap;
-DBuriMap aDBuriMap;
-
 /// Base class for filter tests loading or roundtriping a document, then 
asserting the document model.
 class SwModelTestBase : public test::BootstrapFixture, public 
unotest::MacrosTest, public XmlTestTools
 {
@@ -802,84 +796,6 @@ protected:
 xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST(formx), 
BAD_CAST(urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0));
 xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST(css3t), 
BAD_CAST(http://www.w3.org/TR/css3-text/;));
 }
-
-virtual OUString registerDBsource( const OUString aURI, const OUString 
aWorkDir )
-{
-OUString aDBName;
-DBuriMap::const_iterator pos = aDBuriMap.find( aURI );
-if (pos == aDBuriMap.end())
-{
-aDBName = SwDBManager::LoadAndRegisterDataSource( aURI, NULL, 
aWorkDir );
-aDBuriMap.insert( std::pair OUString, OUString ( aURI, aDBName ) 
);
-std::cout  New datasource name: '  aDBName  '  
std::endl;
-}
-else
-{
-aDBName = pos-second;
-std::cout  Old datasource name: '  aDBName  '  
std::endl;
-}
-CPPUNIT_ASSERT(!aDBName.isEmpty());
-return aDBName;
-}
-
-virtual void initMailMergeJobAndArgs( const char* filename, const char* 
tablename, const OUString aDBName,
-  const OUString aPrefix, const 
OUString aWorkDir, bool file )
-{
-uno::Reference task::XJob  xJob( 
getMultiServiceFactory()-createInstance( com.sun.star.text.MailMerge ), 
uno::UNO_QUERY_THROW );
-mxJob.set( xJob );
-
-int seq_id = 5;
-if (tablename) seq_id += 2;
-mSeqMailMergeArgs.realloc( seq_id );
-
-seq_id = 0;
-mSeqMailMergeArgs[ seq_id++ ] = beans::NamedValue( OUString( 
UNO_NAME_OUTPUT_TYPE ), uno::Any( file ? text::MailMergeType::FILE : 
text::MailMergeType::SHELL ) );
-mSeqMailMergeArgs[ seq_id++ ] = beans::NamedValue( OUString( 
UNO_NAME_DOCUMENT_URL ), uno::Any(
-( 
OUString(getURLFromSrc(mpTestDocumentPath) + 
OUString::createFromAscii(filename)) ) ) );
-mSeqMailMergeArgs[ seq_id++ ] = beans::NamedValue( OUString( 
UNO_NAME_DATA_SOURCE_NAME ), uno::Any( aDBName ) );
-mSeqMailMergeArgs[ seq_id++ ] = beans::NamedValue( OUString( 
UNO_NAME_OUTPUT_URL ), uno::Any( aWorkDir ) );
-mSeqMailMergeArgs[ seq_id++ ] = beans::NamedValue( OUString( 
UNO_NAME_FILE_NAME_PREFIX ), uno::Any( aPrefix ));
-if (tablename)
-{
-mSeqMailMergeArgs[ seq_id++ ] = beans::NamedValue( OUString( 
UNO_NAME_DAD_COMMAND_TYPE ), uno::Any( sdb::CommandType::TABLE ) );
-mSeqMailMergeArgs[ seq_id++ ] = beans::NamedValue( OUString( 
UNO_NAME_DAD_COMMAND ), uno::Any( OUString::createFromAscii(tablename) ) );
-}
-}
-
-virtual void executeMailMerge()
-{
-uno::Any res = mxJob-execute( mSeqMailMergeArgs );
-
-const beans::NamedValue *pArguments = 
mSeqMailMergeArgs.getConstArray();
-bool bOk = true;
-sal_Int32 nArgs = mSeqMailMergeArgs.getLength();
-
-for (sal_Int32 i = 0; i  nArgs; ++i) {
-const OUString rName  = pArguments[i].Name;
-const uno::Any rValue = pArguments[i].Value;
-
-// all error checking was already done by the MM job execution
-if (rName == UNO_NAME_OUTPUT_URL)
-bOk = rValue = mailMergeOutputURL;
-else if (rName == UNO_NAME_FILE_NAME_PREFIX)
-bOk = rValue = mailMergeOutputPrefix;
-else if (rName == UNO_NAME_OUTPUT_TYPE)
-bOk = rValue = nCurOutputType;
-}
-
-CPPUNIT_ASSERT(bOk);
-
-if (nCurOutputType == text::MailMergeType::SHELL)
-{
-CPPUNIT_ASSERT(res = mxMMComponent);
-CPPUNIT_ASSERT(mxMMComponent.is());
-}
-else
-

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

2014-11-07 Thread Mark Hung
 sw/qa/extras/rtfexport/data/cjklist12.rtf|  225 +++
 sw/qa/extras/rtfexport/data/cjklist13.rtf|  225 +++
 sw/qa/extras/rtfexport/data/cjklist16.rtf|  225 +++
 sw/qa/extras/rtfexport/data/cjklist20.rtf|  225 +++
 sw/qa/extras/rtfexport/data/cjklist21.rtf|  225 +++
 sw/qa/extras/rtfexport/data/cjklist24.rtf|  225 +++
 sw/qa/extras/rtfexport/data/cjklist25.rtf|  225 +++
 sw/qa/extras/rtfexport/data/cjklist30.rtf|  225 +++
 sw/qa/extras/rtfexport/data/cjklist31.rtf|  225 +++
 sw/qa/extras/rtfexport/data/cjklist34.rtf|  225 +++
 sw/qa/extras/rtfexport/data/cjklist38.rtf|  225 +++
 sw/qa/extras/rtfexport/rtfexport.cxx |  101 ++
 sw/qa/extras/rtfimport/rtfimport.cxx |   49 +
 sw/source/filter/ww8/docxattributeoutput.cxx |   52 +
 sw/source/filter/ww8/rtfattributeoutput.cxx  |   62 ++
 sw/source/filter/ww8/wrtw8num.cxx|   55 +
 sw/source/filter/ww8/ww8par2.cxx |   37 +++
 sw/source/filter/ww8/ww8par3.cxx |   63 --
 writerfilter/source/dmapper/ConversionHelper.cxx |   30 +--
 writerfilter/source/rtftok/rtfdocumentimpl.cxx   |   66 ++
 20 files changed, 2911 insertions(+), 79 deletions(-)

New commits:
commit d30a8ec448bcd08c6a52a37d6ae41a4b71c235da
Author: Mark Hung mark...@gmail.com
Date:   Tue Nov 4 05:31:53 2014 -0800

Correct number format mapping for CJK numbered lists in rtf/doc/docx 
filters.

Reviewed on:
https://gerrit.libreoffice.org/12252

Change-Id: I2d8760c7ecb3677464e167528b2424aaca19a0d7

diff --git a/sw/qa/extras/rtfexport/data/cjklist12.rtf 
b/sw/qa/extras/rtfexport/data/cjklist12.rtf
new file mode 100644
index 000..bb01457
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/cjklist12.rtf
@@ -0,0 +1,225 @@
+{\rtf1\adeflang1025\ansi\ansicpg950\uc2\adeff0\deff0\stshfdbch31505\stshfloch31506\stshfhich31506\stshfbi0\deflang1033\deflangfe1028\themelang1033\themelangfe1028\themelangcs0{\fonttbl{\f0\fbidi
 \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}
+{\f14\fbidi \froman\fcharset136\fprq2{\*\panose 
02020500}\'b7\'73\'b2\'d3\'a9\'fa\'c5\'e9{\*\falt 
PMingLiU};}{\f14\fbidi \froman\fcharset136\fprq2{\*\panose 
02020500}\'b7\'73\'b2\'d3\'a9\'fa\'c5\'e9{\*\falt PMingLiU};}
+{\f37\fbidi \fswiss\fcharset0\fprq2{\*\panose 
020f0502020204030204}Calibri;}{\f38\fbidi \froman\fcharset136\fprq2{\*\panose 
}@\'b7\'73\'b2\'d3\'a9\'fa\'c5\'e9;}
+{\flomajor\f31500\fbidi \froman\fcharset0\fprq2{\*\panose 
02020603050405020304}Times New Roman;}{\fdbmajor\f31501\fbidi 
\froman\fcharset136\fprq2{\*\panose 
02020500}\'b7\'73\'b2\'d3\'a9\'fa\'c5\'e9{\*\falt PMingLiU};}
+{\fhimajor\f31502\fbidi \froman\fcharset0\fprq2{\*\panose 
02040503050406030204}Cambria;}{\fbimajor\f31503\fbidi 
\froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}
+{\flominor\f31504\fbidi \froman\fcharset0\fprq2{\*\panose 
02020603050405020304}Times New Roman;}{\fdbminor\f31505\fbidi 
\froman\fcharset136\fprq2{\*\panose 
02020500}\'b7\'73\'b2\'d3\'a9\'fa\'c5\'e9{\*\falt PMingLiU};}
+{\fhiminor\f31506\fbidi \fswiss\fcharset0\fprq2{\*\panose 
020f0502020204030204}Calibri;}{\fbiminor\f31507\fbidi 
\froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New 
Roman;}{\f40\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}
+{\f41\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\f43\fbidi 
\froman\fcharset161\fprq2 Times New Roman Greek;}{\f44\fbidi 
\froman\fcharset162\fprq2 Times New Roman Tur;}{\f45\fbidi 
\froman\fcharset177\fprq2 Times New Roman (Hebrew);}
+{\f46\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\f47\fbidi 
\froman\fcharset186\fprq2 Times New Roman Baltic;}{\f48\fbidi 
\froman\fcharset163\fprq2 Times New Roman (Vietnamese);}
+{\f182\fbidi \froman\fcharset0\fprq2 PMingLiU Western{\*\falt 
PMingLiU};}{\f182\fbidi \froman\fcharset0\fprq2 PMingLiU Western{\*\falt 
PMingLiU};}{\f410\fbidi \fswiss\fcharset238\fprq2 Calibri CE;}{\f411\fbidi 
\fswiss\fcharset204\fprq2 Calibri Cyr;}
+{\f413\fbidi \fswiss\fcharset161\fprq2 Calibri Greek;}{\f414\fbidi 
\fswiss\fcharset162\fprq2 Calibri Tur;}{\f417\fbidi \fswiss\fcharset186\fprq2 
Calibri Baltic;}{\f418\fbidi \fswiss\fcharset163\fprq2 Calibri (Vietnamese);}
+{\f422\fbidi \froman\fcharset0\fprq2 @\'b7\'73\'b2\'d3\'a9\'fa\'c5\'e9 
Western;}{\flomajor\f31508\fbidi \froman\fcharset238\fprq2 Times New Roman 
CE;}{\flomajor\f31509\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}
+{\flomajor\f31511\fbidi \froman\fcharset161\fprq2 Times New Roman 
Greek;}{\flomajor\f31512\fbidi \froman\fcharset162\fprq2 Times New Roman 

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

2014-11-06 Thread Miklos Vajna
 sw/qa/extras/ooxmlimport/data/table-auto-column-fixed-size2.docx |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx |9 

 sw/source/core/docnode/nodedump.cxx  |3 +-
 writerfilter/source/dmapper/DomainMapperTableManager.cxx |   11 
--
 4 files changed, 12 insertions(+), 11 deletions(-)

New commits:
commit cbd0fbc287051f918e4adb32b3e9b58dfbf8059d
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Thu Nov 6 15:15:29 2014 +0100

DOCX import: fix w:tblW w:type=auto/ handling when cells have fixed 
widths

Commit 74c5ed19f430327988194cdcd6bdff09591a93fa (DOCX import fix for
table with auto size, 2013-06-26) correctly recognized that in case the
width type is auto, that doesn't always mean text::SizeType::VARIABLE.

However, when the size is fixed, then we should simply not do anything,
and that'll lead to the right behavior (by setting the column separators
on each row), don't try to be smart and try to set
TablePropertyMap::TABLE_WIDTH here.

Change-Id: I997b88e5fa34bbabe7c6940879c81a1d62d69043

diff --git a/sw/qa/extras/ooxmlimport/data/table-auto-column-fixed-size2.docx 
b/sw/qa/extras/ooxmlimport/data/table-auto-column-fixed-size2.docx
new file mode 100644
index 000..2125f09
Binary files /dev/null and 
b/sw/qa/extras/ooxmlimport/data/table-auto-column-fixed-size2.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 3992564..d4d1766 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -1393,6 +1393,15 @@ DECLARE_OOXMLIMPORT_TEST(testTableAutoColumnFixedSize, 
table-auto-column-fixed-
 CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(3996)), 
getPropertysal_Int32(xTextTable, Width));
 }
 
+DECLARE_OOXMLIMPORT_TEST(testTableAutoColumnFixedSize2, 
table-auto-column-fixed-size2.docx)
+{
+uno::Referencetext::XTextTablesSupplier xTablesSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Referencecontainer::XIndexAccess 
xTables(xTablesSupplier-getTextTables(), uno::UNO_QUERY);
+uno::Referencetext::XTextTable xTextTable(xTables-getByIndex(0), 
uno::UNO_QUERY);
+// This was 17907, i.e. the sum of the width of the 3 cells (10152 twips 
each), which is too wide.
+CPPUNIT_ASSERT_EQUAL(sal_Int32(16891), getPropertysal_Int32(xTextTable, 
Width));
+}
+
 DECLARE_OOXMLIMPORT_TEST(testFdo46361, fdo46361.docx)
 {
 uno::Referencecontainer::XIndexAccess xGroupShape(getShape(1), 
uno::UNO_QUERY);
diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx 
b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
index cad79e9..0caba65 100644
--- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
@@ -202,16 +202,7 @@ bool DomainMapperTableManager::sprm(Sprm  rSprm)
 }
 
 // Check whether the total width of given row is 
compared with the maximum value of rows (m_nMaxFixedWidth).
-if (bFixed )
-{
-// Check if total width
-if (m_nMaxFixedWidth  nRowFixedWidth)
-m_nMaxFixedWidth = nRowFixedWidth;
-
-pPropMap-setValue( 
TablePropertyMap::TABLE_WIDTH_TYPE, text::SizeType::FIX );
-pPropMap-setValue( 
TablePropertyMap::TABLE_WIDTH, m_nMaxFixedWidth );
-}
-else
+if (!bFixed)
 {
 // Set the width type of table with 'Auto' and 
set the width value to 100(%)
 pPropMap-setValue( 
TablePropertyMap::TABLE_WIDTH_TYPE, text::SizeType::VARIABLE );
commit f355bad3a055c6369d1cae4afd0c02d181584b09
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Thu Nov 6 15:14:28 2014 +0100

sw doc model dump: extend SwFmtFrmSize handling

Change-Id: I8b246e198f3b19e65feffb196afdecb1755a0581

diff --git a/sw/source/core/docnode/nodedump.cxx 
b/sw/source/core/docnode/nodedump.cxx
index 90e356b..5ccf26b 100644
--- a/sw/source/core/docnode/nodedump.cxx
+++ b/sw/source/core/docnode/nodedump.cxx
@@ -478,7 +478,8 @@ void lcl_dumpSfxItemSet(WriterHelper writer, const 
SfxItemSet* pSet)
 {
 pWhich = frame size;
 const SwFmtFrmSize* pSize = static_castconst 
SwFmtFrmSize*(pItem);
-oValue = height size type:  + 
OString::number(pSize-GetHeightSizeType()) + , width size type:  + 
OString::number(pSize-GetWidthSizeType());
+oValue = height size type:  + 
OString::number(pSize-GetHeightSizeType()) + , height:  + 
OString::number(pSize-GetHeight())
++ , width size type:  + 

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

2014-10-31 Thread Julien Nabet
 sw/qa/complex/writer/TextPortionEnumerationTest.java |   23 ++
 sw/source/core/txtnode/thints.cxx|   30 ---
 sw/source/uibase/wrtsh/wrtsh2.cxx|8 ++---
 3 files changed, 46 insertions(+), 15 deletions(-)

New commits:
commit 5aa299c034a89ffa9e332899bef33816d0b90963
Author: Julien Nabet serval2...@yahoo.fr
Date:   Fri Oct 31 22:44:41 2014 +0100

fdo#85562: sw: fix crash on insert of input field and set variable field

When a new field is inserted it doesn't have a SwFmtFld yet and it is
also not yet in the document so it is not necessary to listen for its
deletion.

(regression from bbd97fe57d9ec184ef6aee36bd57d6d7e53b4719)

Change-Id: I23c18aa8c490a6ad1de63a33f87679cc2358d7f5

diff --git a/sw/source/uibase/wrtsh/wrtsh2.cxx 
b/sw/source/uibase/wrtsh/wrtsh2.cxx
index 484a551..fec7e86 100644
--- a/sw/source/uibase/wrtsh/wrtsh2.cxx
+++ b/sw/source/uibase/wrtsh/wrtsh2.cxx
@@ -211,24 +211,24 @@ bool SwWrtShell::StartInputFldDlg( SwField* pFld, bool 
bNextButton,
 FieldDeletionModify aModify(pDlg.get());
 SwInputField *const pInputField(dynamic_castSwInputField*(pFld));
 SwSetExpField *const pSetExpFld(dynamic_castSwSetExpField*(pFld));
-if (pInputField)
+if (pInputField  pInputField-GetFmtFld())
 {
 // Register for possible input field deletion while dialog is open
 pInputField-GetFmtFld()-Add(aModify);
 }
-else if (pSetExpFld)
+else if (pSetExpFld  pSetExpFld-GetFmtFld())
 {
 pSetExpFld-GetFmtFld()-Add(aModify);
 }
 
 bool bRet = RET_CANCEL == pDlg-Execute();
 
-if (pInputField)
+if (pInputField  pInputField-GetFmtFld())
 {
 // Dialog closed, remove modification listener
 pInputField-GetFmtFld()-Remove(aModify);
 }
-else if (pSetExpFld)
+else if (pSetExpFld  pSetExpFld-GetFmtFld())
 {
 pSetExpFld-GetFmtFld()-Remove(aModify);
 }
commit 9b7542b0928f81b36365b13228a402e8cd64e8cd
Author: Michael Stahl mst...@redhat.com
Date:   Fri Oct 31 22:06:40 2014 +0100

sw: fix insertion of hyperlink inside hyperlink...

... when either the start or the end position of the new hint is equal
to an existing hint.  There is not just 1 case here but 3 different
ones; don't attempt to insert hints with start  end.

Change-Id: I39cf8a352f67d77b56b0d01de5872f4d341f6bdd

diff --git a/sw/qa/complex/writer/TextPortionEnumerationTest.java 
b/sw/qa/complex/writer/TextPortionEnumerationTest.java
index 4e62d33..b793b9a 100644
--- a/sw/qa/complex/writer/TextPortionEnumerationTest.java
+++ b/sw/qa/complex/writer/TextPortionEnumerationTest.java
@@ -2051,6 +2051,29 @@ public class TextPortionEnumerationTest
 // this one gets eaten, but we still need to test inserting it (#i106930#)
 //.appendChild( url6.dup().appendChild( new TextNode() ) )
 .appendChild( new TextNode(89) );
+// inside (left-edge)
+TreeNode url7 = new HyperlinkNode( mkName(url) );
+inserter.insertRange( new Range(0, 1, url7) );
+root = new TreeNode()
+.appendChild( url7.dup().appendChild( new TextNode(1) ) )
+.appendChild( url2.dup().appendChild( new TextNode(2) ) )
+.appendChild( url1.dup().appendChild( new TextNode(3) ) )
+.appendChild( url4.dup().appendChild( new TextNode(4) ) )
+.appendChild( url5.dup().appendChild( new TextNode(56) ) )
+.appendChild( url4.dup().appendChild( new TextNode(7) ) )
+.appendChild( new TextNode(89) );
+// inside (right-edge)
+TreeNode url8 = new HyperlinkNode( mkName(url) );
+inserter.insertRange( new Range(5, 6, url8) );
+root = new TreeNode()
+.appendChild( url7.dup().appendChild( new TextNode(1) ) )
+.appendChild( url2.dup().appendChild( new TextNode(2) ) )
+.appendChild( url1.dup().appendChild( new TextNode(3) ) )
+.appendChild( url4.dup().appendChild( new TextNode(4) ) )
+.appendChild( url5.dup().appendChild( new TextNode(5) ) )
+.appendChild( url8.dup().appendChild( new TextNode(6) ) )
+.appendChild( url4.dup().appendChild( new TextNode(7) ) )
+.appendChild( new TextNode(89) );
 doTest(root, false);
 }
 
diff --git a/sw/source/core/txtnode/thints.cxx 
b/sw/source/core/txtnode/thints.cxx
index c29f87e..1494553 100644
--- a/sw/source/core/txtnode/thints.cxx
+++ b/sw/source/core/txtnode/thints.cxx
@@ -550,23 +550,31 @@ SwpHints::TryInsertNesting( SwTxtNode  rNode, 
SwTxtAttrNesting  rNewHint )
 }
 else
 {
-   assert((nOtherStart  nNewStart)  (nNewEnd  nOtherEnd));
+   assert((nOtherStart  nNewStart) || (nNewEnd  nOtherEnd));
 // scenario: there is a RUBY, and contained within that a META;
 // now a RUBY is inserted within the META = the exising RUBY is 

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

2014-10-03 Thread Miklos Vajna
 sw/qa/extras/ooxmlexport/data/table-position.docx|binary
 sw/qa/extras/ooxmlexport/data/table-style-border-export.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx |   10 ++
 sw/source/filter/ww8/docxattributeoutput.cxx |8 ++--
 4 files changed, 16 insertions(+), 2 deletions(-)

New commits:
commit a3b154ab0262e39497e788917085708ec645eae6
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Fri Oct 3 18:04:56 2014 +0200

DOCX export: fix missing table border when original doc has table style

Scenario is that the original document has a table style, which sets
borders around the table, so A1 cell gets top and left borders (and none
for right/bottom). Then on export, if we write A1 as table default, then
this overwrites the table style, so the real right / bottom borders from
the table style are lost, as on export we think that they are available
from the table style already, so we don't write them.

Regression from commit ae61569eea0719a882010cfbb260a1a0d690d974 (oox: Do
not overwrite table style properties, 2014-04-03).

Change-Id: I54c10ffc2ade65260693b769274b1311efc086f9

diff --git a/sw/qa/extras/ooxmlexport/data/table-style-border-export.docx 
b/sw/qa/extras/ooxmlexport/data/table-style-border-export.docx
new file mode 100644
index 000..eeb23ee
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/table-style-border-export.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index c35b404..d1ef8ae 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -393,6 +393,16 @@ DECLARE_OOXMLEXPORT_TEST(testTableStyleBorder, 
table-style-border.docx)
 CPPUNIT_ASSERT(getPropertytable::BorderLine2(xCell, 
RightBorder).LineWidth  0);
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTableStyleBorderExport, 
table-style-border-export.docx)
+{
+uno::Referencetext::XTextTablesSupplier xTextTablesSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Referencecontainer::XIndexAccess 
xTables(xTextTablesSupplier-getTextTables(), uno::UNO_QUERY);
+uno::Referencetext::XTextTable xTable(xTables-getByIndex(0), 
uno::UNO_QUERY);
+uno::Referencetable::XCell xCell = xTable-getCellByName(A3);
+// Bottom border was white, so this was 0xff.
+CPPUNIT_ASSERT_EQUAL(sal_Int32(0x8064A2), 
getPropertytable::BorderLine2(xCell, BottomBorder).Color);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index da0c48c..36b1f30 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -3386,8 +3386,12 @@ void DocxAttributeOutput::TableDefaultBorders( 
ww8::WW8TableNodeInfoInner::Point
 
 bool bEcma = GetExport().GetFilter().getVersion( ) == 
oox::core::ECMA_DIALECT;
 
-// the defaults of the table are taken from the top-left cell
-impl_borders( m_pSerializer, pFrmFmt-GetBox( ), 
lcl_getTableDefaultBorderOptions(bEcma), NULL, m_aTableStyleConf );
+// Don't write table defaults based on the top-left cell if we have a 
table style available.
+if (m_aTableStyleConf.empty())
+{
+// the defaults of the table are taken from the top-left cell
+impl_borders(m_pSerializer, pFrmFmt-GetBox(), 
lcl_getTableDefaultBorderOptions(bEcma), NULL, m_aTableStyleConf);
+}
 }
 
 void DocxAttributeOutput::TableDefaultCellMargins( 
ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner )
commit 453583cc610b3dacddede52662fa4df276dd7c61
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Fri Oct 3 17:54:45 2014 +0200

CppunitTest_sw_ooxmlexport2: clean up test file

This test file wants to test table positioning, but it also has
references to table styles. Remove these references to keep the testcase
minimal.

Change-Id: Ib7c7086bf767a8580dd7bae4452d0773e02d32a2

diff --git a/sw/qa/extras/ooxmlexport/data/table-position.docx 
b/sw/qa/extras/ooxmlexport/data/table-position.docx
index 4347854..f59a5da 100644
Binary files a/sw/qa/extras/ooxmlexport/data/table-position.docx and 
b/sw/qa/extras/ooxmlexport/data/table-position.docx differ
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-09-19 Thread Caolán McNamara
 sw/qa/extras/ww8export/data/redline-export-1.odt |binary
 sw/qa/extras/ww8export/ww8export.cxx |   13 +
 sw/source/filter/ww8/attributeoutputbase.hxx |2 
 sw/source/filter/ww8/wrtw8nds.cxx|   50 +--
 sw/source/filter/ww8/wrtww8.hxx  |2 
 sw/source/filter/ww8/ww8atr.cxx  |4 -
 sw/source/filter/ww8/ww8attributeoutput.hxx  |2 
 7 files changed, 55 insertions(+), 18 deletions(-)

New commits:
commit 1e882a1dc49cc60aed7bae98b4924871ea1bf935
Author: Caolán McNamara caol...@redhat.com
Date:   Fri Sep 19 13:15:36 2014 +0100

consider following redline as well

a) In word each range that character properties affect are just stored by 
their
end. So the range is from the last end to the current one.

b) In word the paragraph end marker is a real character, in writer it is 
not.

c) So for redlining if a paragraph is redlined, but the previous one is not
then the redlining propes of the 2nd para will affect the end marker of the
previous one if the previous char properties do not include the para end 
mark.

We were currently handing the case where a paragraph end mark *is* inside
redlining and including it in the char property range, but we were not
considering the case where the paragraph end mark is *not* inside redlining
but the following paragraph *is*

to get the end of the previous paragraph not part of the following paragraph
character run, we emit an empty char section of it for this case.

Change-Id: I816335067f60d1d9332bfdb1117fb1448b564972

diff --git a/sw/qa/extras/ww8export/data/redline-export-1.odt 
b/sw/qa/extras/ww8export/data/redline-export-1.odt
new file mode 100644
index 000..31aacce
Binary files /dev/null and b/sw/qa/extras/ww8export/data/redline-export-1.odt 
differ
diff --git a/sw/qa/extras/ww8export/ww8export.cxx 
b/sw/qa/extras/ww8export/ww8export.cxx
index 61655ee..184815d 100644
--- a/sw/qa/extras/ww8export/ww8export.cxx
+++ b/sw/qa/extras/ww8export/ww8export.cxx
@@ -344,6 +344,19 @@ DECLARE_WW8EXPORT_TEST(testBorderColoursExport, 
bordercolours.odt)
 #endif
 }
 
+DECLARE_WW8EXPORT_TEST(testRedlineExport1, redline-export-1.odt)
+{
+uno::Referencetext::XTextRange xParagraph = getParagraph(1);
+uno::Referencecontainer::XEnumerationAccess xRunEnumAccess(xParagraph, 
uno::UNO_QUERY);
+uno::Referencecontainer::XEnumeration xRunEnum = 
xRunEnumAccess-createEnumeration();
+//there must be no redline information on the first line before or after 
reloading
+while (xRunEnum-hasMoreElements())
+{
+uno::Referencetext::XTextRange xRun(xRunEnum-nextElement(), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(false, hasProperty(xRun, RedlineType));
+}
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/attributeoutputbase.hxx 
b/sw/source/filter/ww8/attributeoutputbase.hxx
index a823b5f..0a644c2 100644
--- a/sw/source/filter/ww8/attributeoutputbase.hxx
+++ b/sw/source/filter/ww8/attributeoutputbase.hxx
@@ -224,7 +224,7 @@ public:
 /// Output FKP (Formatted disK Page) - necessary for binary formats only.
 /// FIXME having it in AttributeOutputBase is probably a hack, it
 /// should be in WW8AttributeOutput only...
-virtual void OutputFKP() {}
+virtual void OutputFKP(bool /*bForce*/ = false) {}
 
 /// Output style.
 virtual void ParagraphStyle( sal_uInt16 nStyle ) = 0;
diff --git a/sw/source/filter/ww8/wrtw8nds.cxx 
b/sw/source/filter/ww8/wrtw8nds.cxx
index fbd1d54..c17e3af 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -1252,7 +1252,7 @@ int SwWW8AttrIter::OutAttrWithRange(sal_Int32 nPos)
 return nRet;
 }
 
-bool SwWW8AttrIter::IsRedlineAtEnd( sal_Int32 nEnd ) const
+bool SwWW8AttrIter::IncludeEndOfParaCRInRedlineProperties( sal_Int32 nEnd ) 
const
 {
 // search next Redline
 for( sal_uInt16 nPos = nCurRedlinePos;
@@ -1260,16 +1260,32 @@ bool SwWW8AttrIter::IsRedlineAtEnd( sal_Int32 nEnd ) 
const
 {
 const SwRangeRedline *pRange = 
m_rExport.pDoc-getIDocumentRedlineAccess().GetRedlineTbl()[nPos];
 const SwPosition* pEnd = pRange-End();
+const SwPosition* pStart = pRange-Start();
+// In word the paragraph end marker is a real character, in writer it 
is not.
+// Here we find out if the para end marker we will emit is affected by
+// redlining, in which case it must be included by the range of 
character
+// attributes that contains the redlining information.
 if (pEnd-nNode == rNd)
 {
-// In word the paragraph end marker is a real character, in writer 
it is not.
 if (pEnd-nContent.GetIndex() == nEnd)
 {
-// This condition detects if the pseudo-char we will export is 
affected
-// by 

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

2014-09-16 Thread Caolán McNamara
 sw/qa/extras/ww8import/data/fdo68967.doc |binary
 sw/qa/extras/ww8import/ww8import.cxx |4 
 sw/source/core/layout/tabfrm.cxx |9 -
 3 files changed, 12 insertions(+), 1 deletion(-)

New commits:
commit 4fd5423739c12900e8efe2f3901568431e36a94c
Author: Caolán McNamara caol...@redhat.com
Date:   Tue Sep 16 13:24:05 2014 +0100

'Artur Dent' - 'Arthur Dent'

Change-Id: Idbeac2925ce0f91075f3c4f5468574c62e29f420

diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index f7a39f5..a946293 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -2169,7 +2169,7 @@ void SwTabFrm::MakeAll()
 //right moment to do some preferably constructive changes.
 
 //If I'm NOT allowed to leave the parent Frm, I've got a problem.
-// Following Artur Dent, we do the only thing that you can do with
+// Following Arthur Dent, we do the only thing that you can do with
 // an unsolvable problem: We ignore it with all our power.
 if ( !bMoveable )
 {
commit 1fec67aab152e0c0ad6dd85082c50f1beff7d520
Author: Caolán McNamara caol...@redhat.com
Date:   Tue Sep 16 13:22:44 2014 +0100

Resolves: fdo#68967 looping layout

RemoveFollowFlowLine() marks the layout invalid, but the
next cycle through does everything exactly the same again.

Try the same foul horror as nUnSplitted. But at least with
a test-case that nails down reproducing the bug if a better
fix is needed.

Change-Id: Id6698bcb2364bd0253bedd4a7c313e25f705be8d

diff --git a/sw/qa/extras/ww8import/data/fdo68967.doc 
b/sw/qa/extras/ww8import/data/fdo68967.doc
new file mode 100644
index 000..05271c3
Binary files /dev/null and b/sw/qa/extras/ww8import/data/fdo68967.doc differ
diff --git a/sw/qa/extras/ww8import/ww8import.cxx 
b/sw/qa/extras/ww8import/ww8import.cxx
index 463c5ae..5f4e0bc 100644
--- a/sw/qa/extras/ww8import/ww8import.cxx
+++ b/sw/qa/extras/ww8import/ww8import.cxx
@@ -510,6 +510,10 @@ DECLARE_WW8IMPORT_TEST(testBnc787942, bnc787942.doc)
 parseDump(/root/page[1]/body/txt[4]/anchored);
 }
 
+DECLARE_WW8IMPORT_TEST(testLayoutHanging, fdo68967.doc)
+{
+// This must not hang in layout
+}
 
 CPPUNIT_PLUGIN_IMPLEMENT();
 
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index 06f38c7..f7a39f5 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -1831,6 +1831,7 @@ void SwTabFrm::MakeAll()
 }
 
 int nUnSplitted = 5; // Just another loop control :-(
+int nThrowAwayValidLayoutLimit = 5; // And another one :-(
 SWRECTFN( this )
 while ( !mbValidPos || !mbValidSize || !mbValidPrtArea )
 {
@@ -2301,7 +2302,13 @@ void SwTabFrm::MakeAll()
 // An existing follow flow line has to be removed.
 if ( HasFollowFlowLine() )
 {
+if (!nThrowAwayValidLayoutLimit)
+continue;
+bool bInitialLoopEndCondition = mbValidPos  
mbValidSize  mbValidPrtArea;
 RemoveFollowFlowLine();
+bool bFinalLoopEndCondition = mbValidPos  
mbValidSize  mbValidPrtArea;
+if (bInitialLoopEndCondition  
!bFinalLoopEndCondition)
+--nThrowAwayValidLayoutLimit;
 }
 
 const bool bSplitError = !Split( nDeadLine, bTryToSplit, ( 
bTableRowKeep  !bAllowSplitOfRow ) );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-08-27 Thread Miklos Vajna
 sw/qa/extras/htmlexport/data/skipimage-embedded-document.docx |binary
 sw/qa/extras/htmlexport/htmlexport.cxx|   13 ++
 sw/source/filter/html/htmlplug.cxx|9 +++-
 sw/source/filter/html/wrthtml.cxx |   20 --
 sw/source/filter/html/wrthtml.hxx |2 +
 5 files changed, 39 insertions(+), 5 deletions(-)

New commits:
commit 8760b2b05c23e5fdf8ad7ad3f447a7489c2ddeac
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Wed Aug 27 16:02:10 2014 +0200

sw HTML export: avoid invalid output for embedded documents

When an sw document is embedded inside an sw one, then the inner sw HTML 
export
should just write what's inside the body. Add a filter option for that in 
sw,
similar to the one already existing in sc.

Change-Id: Id2cef966c1022ba45a3540bff234029c1d396778

diff --git a/sw/qa/extras/htmlexport/data/skipimage-embedded-document.docx 
b/sw/qa/extras/htmlexport/data/skipimage-embedded-document.docx
new file mode 100644
index 000..f48935a
Binary files /dev/null and 
b/sw/qa/extras/htmlexport/data/skipimage-embedded-document.docx differ
diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx 
b/sw/qa/extras/htmlexport/htmlexport.cxx
index fd800ab..9cfde5d 100644
--- a/sw/qa/extras/htmlexport/htmlexport.cxx
+++ b/sw/qa/extras/htmlexport/htmlexport.cxx
@@ -149,6 +149,19 @@ DECLARE_HTMLEXPORT_TEST(testSkipImageEmbedded, 
skipimage-embedded.doc)
 assertXPath(pDoc, //span/table, 1);
 }
 
+DECLARE_HTMLEXPORT_TEST(testSkipImageEmbeddedDocument, 
skipimage-embedded-document.docx)
+{
+// Similar to testSkipImageEmbedded, but with an embedded Writer object,
+// not a Calc one, and this time OOXML, not WW8.
+htmlDocPtr pDoc = parseHtml(maTempFile);
+CPPUNIT_ASSERT(pDoc);
+
+// This was 2, the HTML header was in the document two times.
+assertXPath(pDoc, //meta[@name='generator'], 1);
+// Text of embedded document was missing.
+assertXPathContent(pDoc, /html/body/p/span/p/span, Inner.);
+}
+
 #endif
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/filter/html/wrthtml.cxx 
b/sw/source/filter/html/wrthtml.cxx
index 1a34ff6..0ab79bd 100644
--- a/sw/source/filter/html/wrthtml.cxx
+++ b/sw/source/filter/html/wrthtml.cxx
@@ -152,6 +152,7 @@ SwHTMLWriter::SwHTMLWriter( const OUString rBaseURL )
 , bPreserveForm( false )
 , bCfgNetscape4( false )
 , mbSkipImages(false)
+, mbSkipHeaderFooter(false)
 {
 SetBaseURL(rBaseURL);
 }
@@ -177,6 +178,10 @@ void SwHTMLWriter::SetupFilterOptions(SfxMedium rMedium)
 {
 mbSkipImages = true;
 }
+else if (sFilterOptions == SkipHeaderFooter)
+{
+mbSkipHeaderFooter = true;
+}
 }
 
 sal_uLong SwHTMLWriter::WriteStream()
@@ -418,9 +423,12 @@ sal_uLong SwHTMLWriter::WriteStream()
 
 if( bLFPossible )
 OutNewLine();
-HTMLOutFuncs::Out_AsciiTag( Strm(), OOO_STRING_SVTOOLS_HTML_body, false );
-OutNewLine();
-HTMLOutFuncs::Out_AsciiTag( Strm(), OOO_STRING_SVTOOLS_HTML_html, false );
+if (!mbSkipHeaderFooter)
+{
+HTMLOutFuncs::Out_AsciiTag( Strm(), OOO_STRING_SVTOOLS_HTML_body, 
false );
+OutNewLine();
+HTMLOutFuncs::Out_AsciiTag( Strm(), OOO_STRING_SVTOOLS_HTML_html, 
false );
+}
 
 // loesche die Tabelle mit den freifliegenden Rahmen
 sal_uInt16 i;
@@ -930,6 +938,8 @@ sal_uInt16 SwHTMLWriter::OutHeaderAttrs()
 const SwPageDesc *SwHTMLWriter::MakeHeader( sal_uInt16 rHeaderAttrs )
 {
 OStringBuffer sOut;
+if (!mbSkipHeaderFooter)
+{
 sOut.append(OString(OOO_STRING_SVTOOLS_HTML_doctype) +   + 
OString(OOO_STRING_SVTOOLS_HTML_doctype40));
 HTMLOutFuncs::Out_AsciiTag( Strm(), sOut.makeStringAndClear().getStr() );
 
@@ -963,6 +973,7 @@ const SwPageDesc *SwHTMLWriter::MakeHeader( sal_uInt16 
rHeaderAttrs )
 rHeaderAttrs = OutHeaderAttrs();
 
 OutFootEndNoteInfo();
+}
 
 const SwPageDesc *pPageDesc = 0;
 
@@ -992,6 +1003,8 @@ const SwPageDesc *SwHTMLWriter::MakeHeader( sal_uInt16 
rHeaderAttrs )
 if( !pPageDesc )
 pPageDesc = pDoc-GetPageDesc( 0 );
 
+if (!mbSkipHeaderFooter)
+{
 // und nun ... das Style-Sheet!!!
 if( bCfgOutStyles )
 {
@@ -1043,6 +1056,7 @@ const SwPageDesc *SwHTMLWriter::MakeHeader( sal_uInt16 
rHeaderAttrs )
 OutBasicBodyEvents();
 
 Strm().WriteChar( '' );
+}
 
 return pPageDesc;
 }
diff --git a/sw/source/filter/html/wrthtml.hxx 
b/sw/source/filter/html/wrthtml.hxx
index 9953307..a62cae3 100644
--- a/sw/source/filter/html/wrthtml.hxx
+++ b/sw/source/filter/html/wrthtml.hxx
@@ -399,6 +399,8 @@ public:
 bool bCfgNetscape4 : 1; // Netscape4 Hacks
 
 bool mbSkipImages : 1;
+/// If HTML header and footer should be written as well, or just the 
content itself.
+bool mbSkipHeaderFooter : 1;
 
 // 23
 
commit 8d670c9452e930460be600212d73e22acd61cc0f
Author: Miklos Vajna 

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

2014-08-21 Thread Miklos Vajna
 sw/qa/extras/ooxmlexport/data/sdt-company-multipara.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx|9 
 sw/source/filter/ww8/docxattributeoutput.cxx |   16 ++-
 sw/source/filter/ww8/docxattributeoutput.hxx |2 +
 writerfilter/source/ooxml/modelpreprocess.py |5 
 5 files changed, 26 insertions(+), 6 deletions(-)

New commits:
commit 60974f5643745b7714b5a8629d9c574224b67e8c
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Thu Aug 21 15:09:29 2014 +0200

DOCX export: prevent multiple paragraphs in some SDT containers

E.g. Word doesn't do anything if you hit return in the middle of a
title; if that's so, then we should handle this situation on export as
well.

Change-Id: Ib5b52a59250b09c97023b53906b8046f530d0e31

diff --git a/sw/qa/extras/ooxmlexport/data/sdt-company-multipara.docx 
b/sw/qa/extras/ooxmlexport/data/sdt-company-multipara.docx
new file mode 100644
index 000..96d25ff
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/sdt-company-multipara.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
index d52423f..9a8951d 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
@@ -628,6 +628,15 @@ DECLARE_OOXMLEXPORT_TEST(testSdtHeader, sdt-header.docx)
 assertXPath(pXmlDoc, //w:sdt/w:sdtPr/w:date, 1);
 }
 
+DECLARE_OOXMLEXPORT_TEST(testSdtCompanyMultipara, sdt-company-multipara.docx)
+{
+if (xmlDocPtr pXmlDoc = parseExport(word/document.xml))
+{
+// This was 3, but multiple paragraphs inside Company SDT is now 
allowed.
+assertXPath(pXmlDoc, //w:sdtContent/w:p, 1);
+}
+}
+
 #endif
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 5e59bcc..f6ec6e3 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -223,6 +223,12 @@ void DocxAttributeOutput::RTLAndCJKState( bool bIsRTL, 
sal_uInt16 /*nScript*/ )
 m_pSerializer-singleElementNS( XML_w, XML_rtl, FSNS( XML_w, XML_val 
), true, FSEND );
 }
 
+/// Are multiple paragraphs disallowed inside this type of SDT?
+static bool lcl_isOnelinerSdt(const OUString rName)
+{
+return rName == Title || rName == Subtitle || rName == Company;
+}
+
 void DocxAttributeOutput::StartParagraph( ww8::WW8TableNodeInfo::Pointer_t 
pTextNodeInfo )
 {
 if ( m_nColBreakStatus == COLBRK_POSTPONE )
@@ -292,12 +298,15 @@ void DocxAttributeOutput::StartParagraph( 
ww8::WW8TableNodeInfo::Pointer_t pText
 bEndParaSdt = m_bStartedParaSdt  rMap.find(ParaSdtEndBefore) 
!= rMap.end();
 }
 }
-if (bEndParaSdt || (m_bStartedParaSdt  m_bHadSectPr))
+// TODO also avoid multiline paragarphs in those SDT types for shape text
+bool bOneliner = m_bStartedParaSdt  
!m_rExport.SdrExporter().IsDMLAndVMLDrawingOpen()  
lcl_isOnelinerSdt(m_aStartedParagraphSdtPrAlias);
+if (bEndParaSdt || (m_bStartedParaSdt  m_bHadSectPr) || bOneliner)
 {
 // This is the common case: close sdt before the current paragraph 
was requrested by the next paragraph.
 EndSdtBlock();
 bEndParaSdt = false;
 m_bStartedParaSdt = false;
+m_aStartedParagraphSdtPrAlias = ;
 }
 m_bHadSectPr = false;
 
@@ -7951,6 +7960,7 @@ void DocxAttributeOutput::ParaGrabBag(const 
SfxGrabBagItem rItem)
 {
 if (!(aPropertyValue.Value = m_aParagraphSdtPrAlias))
 SAL_WARN(sw.ww8, DocxAttributeOutput::ParaGrabBag: 
unexpected sdt alias value);
+m_aStartedParagraphSdtPrAlias = m_aParagraphSdtPrAlias;
 }
 else if (aPropertyValue.Name == ooxml:CT_SdtPr_checkbox)
 {
@@ -8007,6 +8017,10 @@ void DocxAttributeOutput::ParaGrabBag(const 
SfxGrabBagItem rItem)
 uno::Sequencebeans::PropertyValue aAttributes = i-second.get 
uno::Sequencebeans::PropertyValue ();
 m_pTableStyleExport-CnfStyle(aAttributes);
 }
+else if (i-first == ParaSdtEndBefore)
+{
+// Handled already in StartParagraph().
+}
 else
 SAL_WARN(sw.ww8, DocxAttributeOutput::ParaGrabBag: unhandled 
grab bag property   i-first );
 }
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx 
b/sw/source/filter/ww8/docxattributeoutput.hxx
index d0bfe92..1277203 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -911,6 +911,8 @@ private:
 ::sax_fastparser::FastAttributeList *m_pRunSdtPrDataBindingAttrs;
 /// Value of the w:alias paragraph SDT element.
 OUString m_aParagraphSdtPrAlias;
+/// Same as m_aParagraphSdtPrAlias, but its content is aviailable till the 
SDT is closed.

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

2014-08-19 Thread Miklos Vajna
 sw/qa/core/exportdata/ooxml/pass/sdt-sectpr.docx |binary
 sw/source/filter/ww8/docxattributeoutput.cxx |   15 ++-
 sw/source/filter/ww8/docxattributeoutput.hxx |4 
 sw/source/filter/ww8/docxexport.cxx  |4 
 writerfilter/CustomTarget_source.mk  |4 ++--
 writerfilter/source/ooxml/factoryimpl.py |   23 ---
 6 files changed, 40 insertions(+), 10 deletions(-)

New commits:
commit 788632dcb0450cc9863a5a332b6df50b92f30c4d
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Tue Aug 19 18:12:16 2014 +0200

DOCX export: handle SDT end right before a section break introducing headers

Change-Id: I0fab5ae4335ed6016d31aa243b131899c3154388

diff --git a/sw/qa/core/exportdata/ooxml/pass/sdt-sectpr.docx 
b/sw/qa/core/exportdata/ooxml/pass/sdt-sectpr.docx
new file mode 100644
index 000..334b6e5
Binary files /dev/null and b/sw/qa/core/exportdata/ooxml/pass/sdt-sectpr.docx 
differ
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index b3f2255..9f43f7f 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -292,13 +292,14 @@ void DocxAttributeOutput::StartParagraph( 
ww8::WW8TableNodeInfo::Pointer_t pText
 bEndParaSdt = m_bStartedParaSdt  rMap.find(ParaSdtEndBefore) 
!= rMap.end();
 }
 }
-if (bEndParaSdt)
+if (bEndParaSdt || (m_bStartedParaSdt  m_bHadSectPr))
 {
 // This is the common case: close sdt before the current paragraph 
was requrested by the next paragraph.
 EndSdtBlock();
 bEndParaSdt = false;
 m_bStartedParaSdt = false;
 }
+m_bHadSectPr = false;
 
 // this mark is used to be able to enclose the paragraph inside a sdr tag.
 // We will only know if we have to do that later.
@@ -5390,6 +5391,7 @@ void DocxAttributeOutput::StartSection()
 aSeqOrder[i] = aOrder[i];
 
 m_pSerializer-mark( aSeqOrder );
+m_bHadSectPr = true;
 }
 
 void DocxAttributeOutput::EndSection()
@@ -8216,6 +8218,7 @@ DocxAttributeOutput::DocxAttributeOutput( DocxExport 
rExport, FSHelperPtr pSeri
   m_pRedlineData( NULL ),
   m_nRedlineId( 0 ),
   m_bOpenedSectPr( false ),
+  m_bHadSectPr(false),
   m_bRunTextIsOn( false ),
   m_bWritingHeaderFooter( false ),
   m_bAnchorLinkedToNode(false),
@@ -8368,4 +8371,14 @@ void DocxAttributeOutput::AddToAttrList( 
::sax_fastparser::FastAttributeList* p
 va_end( args );
 }
 
+void DocxAttributeOutput::SetStartedParaSdt(bool bStartedParaSdt)
+{
+m_bStartedParaSdt = bStartedParaSdt;
+}
+
+bool DocxAttributeOutput::IsStartedParaSdt()
+{
+return m_bStartedParaSdt;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx 
b/sw/source/filter/ww8/docxattributeoutput.hxx
index 343afaf..d0bfe92 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -746,6 +746,8 @@ private:
 
 /// Flag indicating that the section properties are being written
 bool m_bOpenedSectPr;
+/// Did we have a section break in this paragraph? Set by StartSection(), 
reset by the next StartParagraph().
+bool m_bHadSectPr;
 
 /// Flag indicating that the Run Text is being written
 bool m_bRunTextIsOn;
@@ -960,6 +962,8 @@ public:
 void SetAlternateContentChoiceOpen( bool bAltContentChoiceOpen ) { 
m_bAlternateContentChoiceOpen = bAltContentChoiceOpen; }
 bool IsAlternateContentChoiceOpen( ) { return 
m_bAlternateContentChoiceOpen; }
 void GetSdtEndBefore(const SdrObject* pSdrObj);
+void SetStartedParaSdt(bool bStartedParaSdt);
+bool IsStartedParaSdt();
 };
 
 #endif // INCLUDED_SW_SOURCE_FILTER_WW8_DOCXATTRIBUTEOUTPUT_HXX
diff --git a/sw/source/filter/ww8/docxexport.cxx 
b/sw/source/filter/ww8/docxexport.cxx
index 43272db..7f8ef58 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -714,6 +714,9 @@ void DocxExport::WriteHeaderFooter( const SwFmt rFmt, bool 
bHeader, const char*
 m_pVMLExport-SetFS( pFS );
 m_pSdrExport-setSerializer(pFS);
 SetFS( pFS );
+bool bStartedParaSdt = m_pAttrOutput-IsStartedParaSdt();
+m_pAttrOutput-SetStartedParaSdt(false);
+
 m_pAttrOutput-switchHeaderFooter(true, m_nHeadersFootersInSection++);
 // do the work
 WriteHeaderFooterText( rFmt, bHeader );
@@ -728,6 +731,7 @@ void DocxExport::WriteHeaderFooter( const SwFmt rFmt, bool 
bHeader, const char*
 m_pVMLExport-SetFS( m_pDocumentFS );
 m_pSdrExport-setSerializer(m_pDocumentFS);
 SetFS( m_pDocumentFS );
+m_pAttrOutput-SetStartedParaSdt(bStartedParaSdt);
 
 // close the tag
 sal_Int32 nReference;
commit 1c06dc14a1f4cf6bf6121aa9a7b62e8890256161
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Tue Aug 19 14:26:28 2014 +0200

writerfilter: stop reading 

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

2014-08-18 Thread Miklos Vajna
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx |6 +++
 sw/source/filter/ww8/docxattributeoutput.cxx |   53 +--
 sw/source/filter/ww8/ww8par.hxx  |2 -
 sw/source/filter/ww8/ww8par6.cxx |6 +--
 4 files changed, 60 insertions(+), 7 deletions(-)

New commits:
commit be515af4d9e86c8bc13a47413676bda80cee6a3e
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Mon Aug 18 11:20:20 2014 +0200

DOCX filter: improve qFormat export handling

The old rule was: write qFormat for everything that's not a custom
style.

The new rule: write qFormat for everything that's a custom style + have
a whitelist of non-custom, but qFormat styles.

This matches better what Word does (whitelist is from the latent style
section of an empty document, created by Word).

Change-Id: Ie7a0802e886c41b8d26ca9aa154913aa2f3ff87a

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 2d47c8c..593358e 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -1191,6 +1191,12 @@ DECLARE_OOXMLEXPORT_TEST(testCharacterBorder, 
charborder.odt)
 CPPUNIT_ASSERT_EQUAL(table::ShadowLocation_BOTTOM_RIGHT, 
aShadow.Location);
 CPPUNIT_ASSERT_EQUAL(sal_Int16(318), aShadow.ShadowWidth);
 }
+
+if (xmlDocPtr pXmlStyles = parseExport(word/styles.xml))
+{
+// Make sure we write qFormat for custom style names.
+assertXPath(pXmlStyles, //w:style[@w:styleId='Heading']/w:qFormat, 
1);
+}
 }
 
 DECLARE_OOXMLEXPORT_TEST(testStyleInheritance, style-inheritance.docx)
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index f8f2d00..4ead526 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -5054,6 +5054,55 @@ oox::drawingml::DrawingML 
DocxAttributeOutput::GetDrawingML()
 return m_rDrawingML;
 }
 
+/// Functor to do case-insensitive ordering of OUString instances.
+struct OUStringIgnoreCase
+{
+bool operator() (const OUString lhs, const OUString rhs) const
+{
+return lhs.compareToIgnoreAsciiCase(rhs)  0;
+}
+};
+
+/// Guesses if a style created in Writer (no grab-bag) should be qFormat or 
not.
+static bool lcl_guessQFormat(const OUString rName, sal_uInt16 nWwId)
+{
+// If the style has no dedicated STI number, then it's probably a custom 
style - qFormat.
+if (nWwId == ww::stiUser)
+return true;
+
+static std::setOUString, OUStringIgnoreCase aWhitelist;
+if (aWhitelist.empty())
+{
+aWhitelist.insert(Normal);
+aWhitelist.insert(Heading 1);
+aWhitelist.insert(Heading 2);
+aWhitelist.insert(Heading 3);
+aWhitelist.insert(Heading 4);
+aWhitelist.insert(Heading 5);
+aWhitelist.insert(Heading 6);
+aWhitelist.insert(Heading 7);
+aWhitelist.insert(Heading 8);
+aWhitelist.insert(Heading 9);
+aWhitelist.insert(Caption);
+aWhitelist.insert(Title);
+aWhitelist.insert(Subtitle);
+aWhitelist.insert(Strong);
+aWhitelist.insert(Emphasis);
+aWhitelist.insert(No Spacing);
+aWhitelist.insert(List Paragraph);
+aWhitelist.insert(Quote);
+aWhitelist.insert(Intense Quote);
+aWhitelist.insert(Subtle Emphasis,);
+aWhitelist.insert(Intense Emphasis);
+aWhitelist.insert(Subtle Reference);
+aWhitelist.insert(Intense Reference);
+aWhitelist.insert(Book Title);
+aWhitelist.insert(TOC Heading);
+}
+// Not custom style? Then we have a list of standard styles which should 
be qFormat.
+return aWhitelist.find(rName) != aWhitelist.end();
+}
+
 void DocxAttributeOutput::StartStyle( const OUString rName, StyleType eType,
 sal_uInt16 nBase, sal_uInt16 nNext, sal_uInt16 nWwId, sal_uInt16 nId, 
bool bAutoUpdate )
 {
@@ -5148,9 +5197,7 @@ void DocxAttributeOutput::StartStyle( const OUString 
rName, StyleType eType,
 if (bUnhideWhenUsed)
 m_pSerializer-singleElementNS(XML_w, XML_unhideWhenUsed, FSEND);
 
-// If the style has a dedicated STI number, then chances are high that Word
-// will have qFormat enabled for it, so let's do the same.
-if (bQFormat || nWwId != ww::stiUser)
+if (bQFormat || lcl_guessQFormat(rName, nWwId))
 m_pSerializer-singleElementNS(XML_w, XML_qFormat, FSEND);
 if (bLocked)
 m_pSerializer-singleElementNS(XML_w, XML_locked, FSEND);
commit f1095b41c6506b153199a72b36fc720804ea9ebc
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Mon Aug 18 10:37:25 2014 +0200

Fix missing prefix

Change-Id: I0a9df00f90b63059e6446278d7a98d1cd902de4b

diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx
index 0f50969..d44e508 100644
--- a/sw/source/filter/ww8/ww8par.hxx
+++ 

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

2014-08-14 Thread Miklos Vajna
 sw/qa/extras/ooxmlimport/data/hidemark.docx  |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx |   13 
 sw/source/filter/ww8/rtfsdrexport.cxx|4 -
 writerfilter/source/dmapper/DomainMapperTableHandler.cxx |   48 +++
 writerfilter/source/dmapper/PropertyIds.cxx  |1 
 writerfilter/source/dmapper/PropertyIds.hxx  |1 
 writerfilter/source/dmapper/TablePropertiesHandler.cxx   |8 ++
 7 files changed, 72 insertions(+), 3 deletions(-)

New commits:
commit d1278ef4849661b9ae0eb7aaf4d74fbf91ccaf11
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Thu Aug 14 13:54:18 2014 +0200

bnc#865381 DOCX import: handle w:hideMark table cell property

Change-Id: Id0dd34110376168e34df4956869608895b86abfe

diff --git a/sw/qa/extras/ooxmlimport/data/hidemark.docx 
b/sw/qa/extras/ooxmlimport/data/hidemark.docx
new file mode 100644
index 000..4a273d6
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/hidemark.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 371b303..7c8f13b 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -2320,6 +2320,19 @@ 
DECLARE_OOXMLIMPORT_TEST(testFloatingTableSectionColumns, floating-table-sectio
 CPPUNIT_ASSERT( tableWidth.toInt32()  1 );
 }
 
+DECLARE_OOXMLIMPORT_TEST(testHidemark, hidemark.docx)
+{
+// Problem was that w:hideMark cell property was ignored.
+uno::Referencetext::XTextTablesSupplier xTablesSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Referencecontainer::XIndexAccess 
xTables(xTablesSupplier-getTextTables( ), uno::UNO_QUERY);
+uno::Referencetext::XTextTable xTextTable(xTables-getByIndex(0), 
uno::UNO_QUERY);
+uno::Referencetable::XTableRows xTableRows(xTextTable-getRows(), 
uno::UNO_QUERY);
+// Height should be minimal
+CPPUNIT_ASSERT_EQUAL(convertTwipToMm100(MINLAY), 
getPropertysal_Int64(xTableRows-getByIndex(1), Height));
+// Size type was MIN, should be FIX to avoid considering the end of 
paragraph marker.
+CPPUNIT_ASSERT_EQUAL(text::SizeType::FIX, 
getPropertysal_Int16(xTableRows-getByIndex(1), SizeType));
+}
+
 #endif
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx 
b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
index 8a121fa..0daa890 100644
--- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
@@ -29,9 +29,11 @@
 #include com/sun/star/text/RelOrientation.hpp
 #include com/sun/star/text/SizeType.hpp
 #include com/sun/star/text/VertOrientation.hpp
+#include com/sun/star/text/XTextRangeCompare.hpp
 #include com/sun/star/style/ParagraphAdjust.hpp
 #include dmapperLoggers.hxx
 #include TablePositionHandler.hxx
+#include ConversionHelper.hxx
 
 #ifdef DEBUG_DOMAINMAPPER
 #include PropertyMapHelper.hxx
@@ -804,12 +806,50 @@ CellPropertyValuesSeq_t 
DomainMapperTableHandler::endTableGetCellProperties(Tabl
 return aCellProperties;
 }
 
+/// Do all cells in this row have a CellHideMark property?
+bool lcl_hideMarks(PropertyMapVector1 rCellProperties)
+{
+for (size_t nCell = 0; nCell  rCellProperties.size(); ++nCell)
+if (!rCellProperties[nCell]-isSet(PROP_CELL_HIDE_MARK))
+return false;
+return true;
+}
+
+/// Are all cells in this row empty?
+bool lcl_emptyRow(TableSequence_t rTableSeq, sal_Int32 nRow)
+{
+if (nRow = rTableSeq.getLength())
+{
+SAL_WARN(writerfilter, m_aCellProperties not in sync with 
m_pTableSeq?);
+return false;
+}
+
+RowSequence_t rRowSeq = rTableSeq[nRow];
+uno::Referencetext::XTextRangeCompare 
xTextRangeCompare(rRowSeq[0][0]-getText(), uno::UNO_QUERY);
+try
+{
+for (sal_Int32 nCell = 0; nCell  rRowSeq.getLength(); ++nCell)
+// See SwXText::Impl::ConvertCell(), we need to compare the start 
of
+// the start and the end of the end. However for our text ranges, 
only
+// the starts are set, so compareRegionStarts() does what we need.
+if (xTextRangeCompare-compareRegionStarts(rRowSeq[nCell][0], 
rRowSeq[nCell][1]) != 0)
+return false;
+}
+catch (lang::IllegalArgumentException e)
+{
+SAL_WARN(writerfilter, compareRegionStarts() failed:   
e.Message);
+return false;
+}
+return true;
+}
+
 RowPropertyValuesSeq_t DomainMapperTableHandler::endTableGetRowProperties()
 {
 #ifdef DEBUG_DOMAINMAPPER
 dmapper_logger-startElement(getRowProperties);
 #endif
 
+static const int MINLAY = 23; // sw/inc/swtypes.hxx, minimal possible size 
of frames.
 RowPropertyValuesSeq_t aRowProperties( m_aRowProperties.size() );
 PropertyMapVector1::const_iterator aRowIter = m_aRowProperties.begin();
 PropertyMapVector1::const_iterator aRowIterEnd = m_aRowProperties.end();
@@ 

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

2014-08-08 Thread Miklos Vajna
 sw/qa/extras/ooxmlexport/data/sdt-header.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx |8 
 sw/source/filter/ww8/docxattributeoutput.cxx  |   54 
 sw/source/filter/ww8/docxattributeoutput.hxx  |2 
 writerfilter/source/dmapper/DomainMapper.cxx  |2 
 writerfilter/source/ooxml/model.xml   | 3222 --
 6 files changed, 60 insertions(+), 3228 deletions(-)

New commits:
commit ea258e380eb87db2eb468ba5354df9f957b7660f
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Fri Aug 8 18:17:43 2014 +0200

DOCX export: handle date SDT on paragraphs

Date SDT's are normally imported as form controls, while most other SDT
types are just custom properties on regular text portions or paragraphs.

However, given that form controls are not supported in headers/footers,
in that case even date SDT's are just custom properties. So support such
properties on paragraphs in the exporter to properly roundtrip date
SDT's in headers/footers.

Change-Id: I19eb73a3673e387a7b8780756ce7426a1851e796

diff --git a/sw/qa/extras/ooxmlexport/data/sdt-header.docx 
b/sw/qa/extras/ooxmlexport/data/sdt-header.docx
new file mode 100644
index 000..6a4bdfb2
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/sdt-header.docx 
differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
index 4c44216..be347b5 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
@@ -600,6 +600,14 @@ DECLARE_OOXMLEXPORT_TEST(testfdo81946, fdo81946.docx)
 assertXPath(pXmlDoc, 
/w:hdr[1]/w:p[1]/w:sdt[1]/w:sdtContent[1]/w:r[2]/mc:AlternateContent[1],0);
 }
 
+DECLARE_OOXMLEXPORT_TEST(testSdtHeader, sdt-header.docx)
+{
+// Problem was that w:sdt elements in headers were lost on import.
+if (xmlDocPtr pXmlDoc = parseExport(word/header1.xml))
+// This was 0, w:sdt (and then w:date) was missing.
+assertXPath(pXmlDoc, //w:sdt/w:sdtPr/w:date, 1);
+}
+
 #endif
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index a8bcc89..b0447cf 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -549,7 +549,7 @@ void DocxAttributeOutput::EndParagraph( 
ww8::WW8TableNodeInfoInner::Pointer_t pT
 m_pSerializer-endElementNS( XML_w, XML_p );
 // on export sdt blocks are never nested ATM
 if( !m_bAnchorLinkedToNode  !m_bStartedParaSdt )
-WriteSdtBlock( m_nParagraphSdtPrToken, m_pParagraphSdtPrTokenChildren, 
m_pParagraphSdtPrDataBindingAttrs, m_aParagraphSdtPrAlias, /*bPara=*/true );
+WriteSdtBlock( m_nParagraphSdtPrToken, m_pParagraphSdtPrTokenChildren, 
m_pParagraphSdtPrTokenAttributes, m_pParagraphSdtPrDataBindingAttrs, 
m_aParagraphSdtPrAlias, /*bPara=*/true );
 else
 {
 //These should be written out to the actual Node and not to the anchor.
@@ -591,6 +591,7 @@ void DocxAttributeOutput::EndParagraph( 
ww8::WW8TableNodeInfoInner::Pointer_t pT
 
 void DocxAttributeOutput::WriteSdtBlock( sal_Int32 nSdtPrToken,
  ::sax_fastparser::FastAttributeList* 
pSdtPrTokenChildren,
+ ::sax_fastparser::FastAttributeList* 
pSdtPrTokenAttributes,
  ::sax_fastparser::FastAttributeList* 
pSdtPrDataBindingAttrs,
  OUString rSdtPrAlias,
  bool bPara )
@@ -607,7 +608,14 @@ void DocxAttributeOutput::WriteSdtBlock( sal_Int32 
nSdtPrToken,
 
 if( nSdtPrToken  0  pSdtPrTokenChildren )
 {
-m_pSerializer-startElement( nSdtPrToken, FSEND );
+if (!pSdtPrTokenAttributes)
+m_pSerializer-startElement( nSdtPrToken, FSEND );
+else
+{
+XFastAttributeListRef xAttrList(pSdtPrTokenAttributes);
+m_pSerializer-startElement(nSdtPrToken, xAttrList);
+pSdtPrTokenAttributes = 0;
+}
 
 uno::Sequencexml::FastAttribute aChildren = 
pSdtPrTokenChildren-getFastAttributes();
 for( sal_Int32 i=0; i  aChildren.getLength(); ++i )
@@ -619,7 +627,16 @@ void DocxAttributeOutput::WriteSdtBlock( sal_Int32 
nSdtPrToken,
 m_pSerializer-endElement( nSdtPrToken );
 }
 else if( (nSdtPrToken  0)  nSdtPrToken != FSNS( XML_w, XML_id )  
!(m_bRunTextIsOn  m_rExport.SdrExporter().IsParagraphHasDrawing()))
-m_pSerializer-singleElement( nSdtPrToken, FSEND );
+{
+if (!pSdtPrTokenAttributes)
+m_pSerializer-singleElement( nSdtPrToken, FSEND );
+else
+{
+XFastAttributeListRef xAttrList(pSdtPrTokenAttributes);
+

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

2014-07-21 Thread Luboš Luňák
 sw/qa/extras/ooxmlimport/data/floating-table-section-columns.docx |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx  |7 +++
 sw/qa/extras/ww8import/data/floating-table-section-columns.doc|binary
 sw/qa/extras/ww8import/data/floating-table-section-margins.doc|binary
 sw/qa/extras/ww8import/ww8import.cxx  |   19 
++
 sw/source/filter/ww8/ww8par.cxx   |4 ++
 sw/source/filter/ww8/ww8par6.cxx  |4 +-
 writerfilter/source/dmapper/PropertyMap.cxx   |4 +-
 writerfilter/source/dmapper/PropertyMap.hxx   |1 
 9 files changed, 37 insertions(+), 2 deletions(-)

New commits:
commit c5ed52b1cd6f22787c94bec035ceecf9e1da3271
Author: Luboš Luňák l.lu...@collabora.com
Date:   Mon Jul 21 10:56:52 2014 +0200

ww8import create a pagedesc if continuous section changes margins 
(bnc#875383)

This is similar to what writerfilter does. MSWord can have one page with 
several
different margins, which are saved using continuous sections, which causes 
all
kinds of trouble, because either we treat them as Writer sections, which 
means
we lose some of the data, or we treat them as Writer page styles, which 
causes
spurious page breaks if in the wrong place. Either option has its problems, 
but
here it seems slightly better to go for keeping the data and hoping the page
break will be in a place where a break will be anyway.

Change-Id: I8f52aa820750da6788ea04180a15ac334f6bf87b

diff --git a/sw/qa/extras/ww8import/data/floating-table-section-margins.doc 
b/sw/qa/extras/ww8import/data/floating-table-section-margins.doc
new file mode 100644
index 000..f414be7
Binary files /dev/null and 
b/sw/qa/extras/ww8import/data/floating-table-section-margins.doc differ
diff --git a/sw/qa/extras/ww8import/ww8import.cxx 
b/sw/qa/extras/ww8import/ww8import.cxx
index a5f3a8c..fe4a8fc 100644
--- a/sw/qa/extras/ww8import/ww8import.cxx
+++ b/sw/qa/extras/ww8import/ww8import.cxx
@@ -34,6 +34,18 @@ public:
 
 #define DECLARE_WW8IMPORT_TEST(TestName, filename) 
DECLARE_SW_IMPORT_TEST(TestName, filename, Test)
 
+DECLARE_WW8IMPORT_TEST(testFloatingTableSectionMargins, 
floating-table-section-margins.doc)
+{
+sal_Int32 pageLeft = parseDump(/root/page[2]/infos/bounds, 
left).toInt32();
+sal_Int32 pageWidth = parseDump(/root/page[2]/infos/bounds, 
width).toInt32();
+sal_Int32 tableLeft = 
parseDump(/root/page[2]/body/column/body/section/column/body/txt[2]/anchored/fly/tab/infos/bounds,
 left).toInt32();
+sal_Int32 tableWidth = 
parseDump(/root/page[2]/body/column/body/section/column/body/txt[2]/anchored/fly/tab/infos/bounds,
 width).toInt32();
+CPPUNIT_ASSERT( pageWidth  0 );
+CPPUNIT_ASSERT( tableWidth  0 );
+// The table's resulting position should be roughly centered.
+CPPUNIT_ASSERT( abs(( pageLeft + pageWidth / 2 ) - ( tableLeft + 
tableWidth / 2 ))  20 );
+}
+
 DECLARE_WW8IMPORT_TEST(testN757910, n757910.doc)
 {
 // The internal margin was larger than 0.28cm
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 56c184d..0906232 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -4440,6 +4440,10 @@ void wwSectionManager::InsertSegments()
 
 bool bInsertSection = (aIter != aStart)  aIter-IsContinuous()   
bThisAndPreviousAreCompatible;
 bool bInsertPageDesc = !bInsertSection;
+// HACK Force new pagedesc if margins change, otherwise e.g. floating 
tables may be anchored improperly.
+if( aIter-maSep.dyaTop != aPrev-maSep.dyaTop || 
aIter-maSep.dyaBottom != aPrev-maSep.dyaBottom
+|| aIter-maSep.dxaLeft != aPrev-maSep.dxaLeft || 
aIter-maSep.dxaRight != aPrev-maSep.dxaRight )
+bInsertPageDesc = true;
 bool bProtected = SectionIsProtected(*aIter); // do we really  need 
this ?? I guess I have a different logic in editshell which disables this...
 if (bUseEnhFields  mrReader.pWDop-fProtEnabled  
aIter-IsNotProtected())
 {
commit 2aa6589aa5bbcd7cd74b33b81e431fb6837a2458
Author: Luboš Luňák l.lu...@collabora.com
Date:   Mon Jul 7 13:56:02 2014 +0200

fix floating table over section with several columns (part of bnc#875383)

Change-Id: Ic6e75cc2cedb61754b45bc4678a1185f580d5ed6

diff --git a/sw/qa/extras/ooxmlimport/data/floating-table-section-columns.docx 
b/sw/qa/extras/ooxmlimport/data/floating-table-section-columns.docx
new file mode 100644
index 000..50bb7ac
Binary files /dev/null and 
b/sw/qa/extras/ooxmlimport/data/floating-table-section-columns.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 061c393..a8c0936 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -2290,6 +2290,13 @@ 

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

2014-07-17 Thread Miklos Vajna
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx|   11 ---
 sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx |   11 +++
 sw/source/filter/ww8/docxsdrexport.cxx  |   20 +++-
 sw/source/filter/ww8/docxsdrexport.hxx  |2 --
 4 files changed, 22 insertions(+), 22 deletions(-)

New commits:
commit 461e46904ffa29820be1ccb64cdb9cb6d4469b6c
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Thu Jul 17 09:48:18 2014 +0200

DocxSdrExport: move member to impl class

Change-Id: I37aef651cf6424e7935ea3584b8f493f6f24c484

diff --git a/sw/source/filter/ww8/docxsdrexport.cxx 
b/sw/source/filter/ww8/docxsdrexport.cxx
index 363b5b9..da9dc23 100644
--- a/sw/source/filter/ww8/docxsdrexport.cxx
+++ b/sw/source/filter/ww8/docxsdrexport.cxx
@@ -164,6 +164,8 @@ struct DocxSdrExport::Impl
 bool m_bDMLAndVMLDrawingOpen;
 /// List of TextBoxes in this document: they are exported as part of their 
shape, never alone.
 std::setSwFrmFmt* m_aTextBoxes;
+/// Preserved rotation for TextFrames.
+sal_Int32 m_nDMLandVMLTextFrameRotation;
 
 Impl(DocxSdrExport rSdrExport, DocxExport rExport, 
sax_fastparser::FSHelperPtr pSerializer, oox::drawingml::DrawingML* pDrawingML)
 : m_rSdrExport(rSdrExport),
@@ -186,7 +188,8 @@ struct DocxSdrExport::Impl
   m_nId(0),
   m_nSeq(0),
   m_bDMLAndVMLDrawingOpen(false),
-  m_aTextBoxes(SwTextBoxHelper::findTextBoxes(m_rExport.pDoc))
+  m_aTextBoxes(SwTextBoxHelper::findTextBoxes(m_rExport.pDoc)),
+  m_nDMLandVMLTextFrameRotation(0)
 {
 }
 
@@ -203,8 +206,7 @@ struct DocxSdrExport::Impl
 };
 
 DocxSdrExport::DocxSdrExport(DocxExport rExport, sax_fastparser::FSHelperPtr 
pSerializer, oox::drawingml::DrawingML* pDrawingML)
-: m_pImpl(new Impl(*this, rExport, pSerializer, pDrawingML)),
-  DMLandVMLTextFrameRotation(0)
+: m_pImpl(new Impl(*this, rExport, pSerializer, pDrawingML))
 {
 }
 
@@ -1273,7 +1275,7 @@ void DocxSdrExport::writeDMLTextFrame(sw::Frame* 
pParentFrame, int nAnchorId, bo
  FSEND);
 
 uno::Any aRotation ;
-DMLandVMLTextFrameRotation = 0;
+m_pImpl-m_nDMLandVMLTextFrameRotation = 0;
 if (xPropSetInfo.is()  
xPropSetInfo-hasPropertyByName(FrameInteropGrabBag))
 {
 uno::Sequence beans::PropertyValue  propList;
@@ -1288,11 +1290,11 @@ void DocxSdrExport::writeDMLTextFrame(sw::Frame* 
pParentFrame, int nAnchorId, bo
 }
 }
 }
-aRotation = DMLandVMLTextFrameRotation ;
-OString 
sRotation(OString::number((OOX_DRAWINGML_EXPORT_ROTATE_CLOCKWISIFY(DMLandVMLTextFrameRotation;
+aRotation = m_pImpl-m_nDMLandVMLTextFrameRotation ;
+OString 
sRotation(OString::number((OOX_DRAWINGML_EXPORT_ROTATE_CLOCKWISIFY(m_pImpl-m_nDMLandVMLTextFrameRotation;
 // Shape properties
 pFS-startElementNS(XML_wps, XML_spPr, FSEND);
-if (DMLandVMLTextFrameRotation)
+if (m_pImpl-m_nDMLandVMLTextFrameRotation)
 {
 pFS-startElementNS(XML_a, XML_xfrm,
 XML_rot, sRotation.getStr(),
@@ -1466,9 +1468,9 @@ void DocxSdrExport::writeVMLTextFrame(sw::Frame* 
pParentFrame, bool bTextBoxOnly
 m_pImpl-m_pFlyAttrList = pFS-createAttrList();
 m_pImpl-m_pTextboxAttrList = pFS-createAttrList();
 m_pImpl-m_aTextFrameStyle = position:absolute;
-if(!bTextBoxOnly)
+if (!bTextBoxOnly)
 {
-OString sRotation(OString::number(DMLandVMLTextFrameRotation / -100));
+OString 
sRotation(OString::number(m_pImpl-m_nDMLandVMLTextFrameRotation / -100));
 
m_pImpl-m_rExport.SdrExporter().getTextFrameStyle().append(;rotation:).append(sRotation);
 }
 m_pImpl-m_rExport.OutputFormat(pParentFrame-GetFrmFmt(), false, false, 
true);
diff --git a/sw/source/filter/ww8/docxsdrexport.hxx 
b/sw/source/filter/ww8/docxsdrexport.hxx
index 1b8954d..5c98a42 100644
--- a/sw/source/filter/ww8/docxsdrexport.hxx
+++ b/sw/source/filter/ww8/docxsdrexport.hxx
@@ -101,8 +101,6 @@ public:
 bool isTextBox(const SwFrmFmt rFrmFmt);
 /// Writes text from Textbox for w:framePr
 void writeOnlyTextOfFrame(sw::Frame* pParentFrame);
-
-sal_Int32 DMLandVMLTextFrameRotation;
 };
 
 #endif // INCLUDED_SW_SOURCE_FILTER_WW8_DOCXSDREXPORT_HXX
commit c9227b26683ae960a79d60725caf70ac2515a4d0
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Thu Jul 17 09:44:35 2014 +0200

sw: move testcase to the right suite

Change-Id: Ieb89836facb28ef1432b48810532f6f0b4b00a89

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index afc8242..a5aa50d 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -3741,17 +3741,6 @@ DECLARE_OOXMLEXPORT_TEST(testfdo80898, fdo80898.docx)
 /word/embeddings/oleObject1.doc);
 }
 

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

2014-07-10 Thread Miklos Vajna
 sw/qa/extras/ooxmlexport/data/sdt-2-run.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx  |   10 
 sw/source/filter/ww8/docxattributeoutput.cxx  |   49 ++
 sw/source/filter/ww8/docxattributeoutput.hxx  |8 +++
 writerfilter/source/dmapper/DomainMapper.cxx  |   10 
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   10 
 writerfilter/source/dmapper/DomainMapper_Impl.hxx |6 ++
 writerfilter/source/dmapper/PropertyIds.cxx   |1 
 writerfilter/source/dmapper/PropertyIds.hxx   |1 
 9 files changed, 87 insertions(+), 8 deletions(-)

New commits:
commit 0a90643947e3767fd5d76784df54d7ee25e6793d
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Thu Jul 10 10:19:18 2014 +0200

DOCX export: allow multiple runs in w:sdt tags

Change-Id: Iec053f92ebdfb89ddd311e190609c9dd1a1c64ef

diff --git a/sw/qa/extras/ooxmlexport/data/sdt-2-run.docx 
b/sw/qa/extras/ooxmlexport/data/sdt-2-run.docx
new file mode 100644
index 000..6063ebc
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/sdt-2-run.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 494b8a8..d534ed9 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -3739,6 +3739,16 @@ DECLARE_OOXMLEXPORT_TEST(test2colHeader, 
2col-header.docx)
 CPPUNIT_ASSERT_EQUAL(true, getPropertybool(xPageStyle, HeaderIsOn));
 }
 
+DECLARE_OOXMLEXPORT_TEST(testSdt2Run, sdt-2-run.docx)
+{
+xmlDocPtr pXmlDoc = parseExport();
+if (!pXmlDoc)
+return;
+
+// The problem was that w:sdt was closed after first, not after 
second, so the second assert failed.
+assertXPathContent(pXmlDoc, 
/w:document/w:body/w:p/w:sdt/w:sdtContent/w:r[1]/w:t, first);
+assertXPathContent(pXmlDoc, 
/w:document/w:body/w:p/w:sdt/w:sdtContent/w:r[2]/w:t, second);
+}
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 937a337..85c45da 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -508,9 +508,16 @@ void DocxAttributeOutput::EndParagraph( 
ww8::WW8TableNodeInfoInner::Pointer_t pT
 m_nHyperLinkCount = 0;
 }
 
+if (m_bStartedCharSdt)
+{
+// Run-level SDT still open? Close it now.
+EndSdtBlock();
+m_bStartedCharSdt = false;
+}
+
 m_pSerializer-endElementNS( XML_w, XML_p );
 if( !m_bAnchorLinkedToNode )
-WriteSdtBlock( m_nParagraphSdtPrToken, m_pParagraphSdtPrTokenChildren, 
m_pParagraphSdtPrDataBindingAttrs );
+WriteSdtBlock( m_nParagraphSdtPrToken, m_pParagraphSdtPrTokenChildren, 
m_pParagraphSdtPrDataBindingAttrs, /*bPara=*/true );
 else
 {
 //These should be written out to the actual Node and not to the anchor.
@@ -549,7 +556,10 @@ void DocxAttributeOutput::EndParagraph( 
ww8::WW8TableNodeInfoInner::Pointer_t pT
 
 }
 
-void DocxAttributeOutput::WriteSdtBlock( sal_Int32 nSdtPrToken, 
::sax_fastparser::FastAttributeList* pSdtPrTokenChildren, 
::sax_fastparser::FastAttributeList* pSdtPrDataBindingAttrs )
+void DocxAttributeOutput::WriteSdtBlock( sal_Int32 nSdtPrToken,
+ ::sax_fastparser::FastAttributeList* 
pSdtPrTokenChildren,
+ ::sax_fastparser::FastAttributeList* 
pSdtPrDataBindingAttrs,
+ bool bPara )
 {
 if( nSdtPrToken  0 || pSdtPrDataBindingAttrs )
 {
@@ -597,8 +607,11 @@ void DocxAttributeOutput::WriteSdtBlock( sal_Int32 
nSdtPrToken, ::sax_fastparse
 m_pSerializer-mergeTopMarks( sax_fastparser::MERGE_MARKS_PREPEND );
 
 // write the ending tags after the paragraph
-m_pSerializer-endElementNS( XML_w, XML_sdtContent );
-m_pSerializer-endElementNS( XML_w, XML_sdt );
+if (bPara)
+EndSdtBlock();
+else
+// Support multiple runs inside a run-evel SDT: don't close the 
SDT block yet.
+m_bStartedCharSdt = true;
 
 // clear sdt status
 nSdtPrToken = 0;
@@ -611,6 +624,12 @@ void DocxAttributeOutput::WriteSdtBlock( sal_Int32 
nSdtPrToken, ::sax_fastparse
 }
 }
 
+void DocxAttributeOutput::EndSdtBlock()
+{
+m_pSerializer-endElementNS( XML_w, XML_sdtContent );
+m_pSerializer-endElementNS( XML_w, XML_sdt );
+}
+
 void DocxAttributeOutput::FinishTableRowCell( 
ww8::WW8TableNodeInfoInner::Pointer_t pInner, bool bForceEmptyParagraph )
 {
 if ( pInner.get() )
@@ -945,6 +964,14 @@ void DocxAttributeOutput::EndRun()
 // before postponed run start)
 m_pSerializer-mark(); // let's call it actual run start
 
+if (m_bEndCharSdt)
+{
+// This is the common case: close sdt before the current run was 
requrested by the next run.
+

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

2014-07-10 Thread Miklos Vajna
 sw/qa/extras/ooxmlexport/data/sdt-alias.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx |   11 +++
 sw/source/filter/ww8/docxattributeoutput.cxx |   25 -
 sw/source/filter/ww8/docxattributeoutput.hxx |7 ++-
 writerfilter/source/dmapper/DomainMapper.cxx |   12 +++-
 5 files changed, 48 insertions(+), 7 deletions(-)

New commits:
commit 06e696a043114fcaba005cd8feac0ecb7ecede4a
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Thu Jul 10 11:48:06 2014 +0200

DOCX export: write w:alias inside w:sdtPr

Change-Id: Iaa020c00ddb3f9c6e6a9a6b2bc248a47c01a89d4

diff --git a/sw/qa/extras/ooxmlexport/data/sdt-alias.docx 
b/sw/qa/extras/ooxmlexport/data/sdt-alias.docx
new file mode 100644
index 000..f46ef69
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/sdt-alias.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index d534ed9..d156805 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -3749,6 +3749,17 @@ DECLARE_OOXMLEXPORT_TEST(testSdt2Run, sdt-2-run.docx)
 assertXPathContent(pXmlDoc, 
/w:document/w:body/w:p/w:sdt/w:sdtContent/w:r[1]/w:t, first);
 assertXPathContent(pXmlDoc, 
/w:document/w:body/w:p/w:sdt/w:sdtContent/w:r[2]/w:t, second);
 }
+
+DECLARE_OOXMLEXPORT_TEST(testSdtAlias, sdt-alias.docx)
+{
+xmlDocPtr pXmlDoc = parseExport();
+if (!pXmlDoc)
+return;
+
+// w:alias was completely missing.
+assertXPath(pXmlDoc, /w:document/w:body/w:p/w:sdt/w:sdtPr/w:alias, 
val, Subtitle);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 85c45da..2026ddd 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -291,7 +291,7 @@ void DocxAttributeOutput::StartParagraph( 
ww8::WW8TableNodeInfo::Pointer_t pText
 m_bIsFirstParagraph = false;
 }
 
-static void lcl_deleteAndResetTheLists( ::sax_fastparser::FastAttributeList* 
pSdtPrTokenChildren, ::sax_fastparser::FastAttributeList* 
pSdtPrDataBindingAttrs)
+static void lcl_deleteAndResetTheLists( ::sax_fastparser::FastAttributeList* 
pSdtPrTokenChildren, ::sax_fastparser::FastAttributeList* 
pSdtPrDataBindingAttrs, OUString rSdtPrAlias)
 {
 if( pSdtPrTokenChildren )
 {
@@ -303,6 +303,8 @@ static void lcl_deleteAndResetTheLists( 
::sax_fastparser::FastAttributeList* pS
 delete pSdtPrDataBindingAttrs;
 pSdtPrDataBindingAttrs = NULL;
 }
+if (!rSdtPrAlias.isEmpty())
+rSdtPrAlias = ;
 }
 
 void DocxAttributeOutput::PopulateFrameProperties(const SwFrmFmt* pFrmFmt, 
const Size rSize)
@@ -516,14 +518,15 @@ void DocxAttributeOutput::EndParagraph( 
ww8::WW8TableNodeInfoInner::Pointer_t pT
 }
 
 m_pSerializer-endElementNS( XML_w, XML_p );
+OUString aParagraphSdtPrAlias;
 if( !m_bAnchorLinkedToNode )
-WriteSdtBlock( m_nParagraphSdtPrToken, m_pParagraphSdtPrTokenChildren, 
m_pParagraphSdtPrDataBindingAttrs, /*bPara=*/true );
+WriteSdtBlock( m_nParagraphSdtPrToken, m_pParagraphSdtPrTokenChildren, 
m_pParagraphSdtPrDataBindingAttrs, aParagraphSdtPrAlias, /*bPara=*/true );
 else
 {
 //These should be written out to the actual Node and not to the anchor.
 //Clear them as they will be repopulated when the node is processed.
 m_nParagraphSdtPrToken = 0;
-lcl_deleteAndResetTheLists( m_pParagraphSdtPrTokenChildren, 
m_pParagraphSdtPrDataBindingAttrs );
+lcl_deleteAndResetTheLists( m_pParagraphSdtPrTokenChildren, 
m_pParagraphSdtPrDataBindingAttrs, aParagraphSdtPrAlias );
 }
 
 //sdtcontent is written so Set m_bParagraphHasDrawing to false
@@ -559,6 +562,7 @@ void DocxAttributeOutput::EndParagraph( 
ww8::WW8TableNodeInfoInner::Pointer_t pT
 void DocxAttributeOutput::WriteSdtBlock( sal_Int32 nSdtPrToken,
  ::sax_fastparser::FastAttributeList* 
pSdtPrTokenChildren,
  ::sax_fastparser::FastAttributeList* 
pSdtPrDataBindingAttrs,
+ OUString rSdtPrAlias,
  bool bPara )
 {
 if( nSdtPrToken  0 || pSdtPrDataBindingAttrs )
@@ -598,6 +602,11 @@ void DocxAttributeOutput::WriteSdtBlock( sal_Int32 
nSdtPrToken,
 m_pSerializer-singleElementNS( XML_w, XML_dataBinding, xAttrList 
);
 }
 
+if (!rSdtPrAlias.isEmpty())
+m_pSerializer-singleElementNS(XML_w, XML_alias, FSNS(XML_w, 
XML_val),
+   OUStringToOString(rSdtPrAlias, 
RTL_TEXTENCODING_UTF8).getStr(),
+   FSEND);
+
 m_pSerializer-endElementNS( XML_w, XML_sdtPr );
 
 // sdt contents start tag
@@ -621,6 +630,7 

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

2014-06-27 Thread Michael Stahl
 sw/qa/extras/rtfexport/data/fdo78758.rtf |9 ++
 sw/qa/extras/rtfexport/rtfexport.cxx |   10 +++
 sw/source/filter/ww8/attributeoutputbase.hxx |2 -
 sw/source/filter/ww8/docxattributeoutput.cxx |2 -
 sw/source/filter/ww8/docxattributeoutput.hxx |2 -
 sw/source/filter/ww8/rtfattributeoutput.cxx  |   37 +--
 sw/source/filter/ww8/rtfattributeoutput.hxx  |9 --
 sw/source/filter/ww8/writerwordglue.cxx  |3 +-
 sw/source/filter/ww8/wrtw8esh.cxx|2 -
 sw/source/filter/ww8/wrtw8nds.cxx|4 +-
 sw/source/filter/ww8/wrtww8gr.cxx|2 -
 sw/source/filter/ww8/ww8attributeoutput.hxx  |2 -
 12 files changed, 49 insertions(+), 35 deletions(-)

New commits:
commit b8907bf3d3b37c686a414ffbbd2d732348aab5b9
Author: Michael Stahl mst...@redhat.com
Date:   Fri Jun 27 16:02:45 2014 +0200

fdo#78758: sw: RTF export: don't export multiple \fldrst for one hyperlink

Ensure that we export only one \fldresult per hyperlink by doing that in
StartURL() and EndURL(); the TextINetFormat() is called once per text
portion.  This shouldn't cause problems as there can't be anything
between the end of the \field group and the start of \fldresult anyway.

Replace the annoying call to EndURL() from EndRun() with a special case
in EndURL() to store things in the right buffer (hopefully).

(somehow this is regression from c4498251cb7181a9f272b0720f398597c0daef09)

Change-Id: I209ea7a384fb1cb5d1505a70ecc4a4536bbf26a2

diff --git a/sw/qa/extras/rtfexport/data/fdo78758.rtf 
b/sw/qa/extras/rtfexport/data/fdo78758.rtf
new file mode 100644
index 000..49c0502
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/fdo78758.rtf
@@ -0,0 +1,9 @@
+{\rtf1\ansi
+\par \pard\plain
+{{\field{\*\fldinst HYPERLINK #__RefHeading___Toc264438068 }
+{\fldrslt {\langfe1024\rtlch \ltrch\loch\lang1024
+EE5E EeEEE5EE}{\scaps\langfe1024\rtlch \ltrch\loch\lang1024
+e}{\langfe1024\rtlch \ltrch\loch\lang1024
+\tab 46
+\par
+}
diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx 
b/sw/qa/extras/rtfexport/rtfexport.cxx
index c01dc38..c2ed07c 100644
--- a/sw/qa/extras/rtfexport/rtfexport.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport.cxx
@@ -468,6 +468,16 @@ DECLARE_RTFEXPORT_TEST(testHyperlink, hyperlink.rtf)
 CPPUNIT_ASSERT_EQUAL(OUString(), 
getPropertyOUString(getRun(getParagraph(1), 3, !), HyperLinkURL));
 }
 
+DECLARE_RTFEXPORT_TEST(test78758, fdo78758.rtf)
+{
+CPPUNIT_ASSERT_EQUAL(OUString(#__RefHeading___Toc264438068),
+getPropertyOUString(getRun(getParagraph(2), 1, EE5E EeEEE5EE), 
HyperLinkURL));
+CPPUNIT_ASSERT_EQUAL(OUString(#__RefHeading___Toc264438068),
+getPropertyOUString(getRun(getParagraph(2), 2, e), 
HyperLinkURL));
+CPPUNIT_ASSERT_EQUAL(OUString(#__RefHeading___Toc264438068),
+getPropertyOUString(getRun(getParagraph(2), 3, \t46), 
HyperLinkURL));
+}
+
 DECLARE_RTFEXPORT_TEST(testTextFrameBorders, textframe-borders.rtf)
 {
 uno::Referencetext::XTextFramesSupplier xTextFramesSupplier(mxComponent, 
uno::UNO_QUERY);
diff --git a/sw/source/filter/ww8/attributeoutputbase.hxx 
b/sw/source/filter/ww8/attributeoutputbase.hxx
index d2df9c0..a32a4ba 100644
--- a/sw/source/filter/ww8/attributeoutputbase.hxx
+++ b/sw/source/filter/ww8/attributeoutputbase.hxx
@@ -203,7 +203,7 @@ public:
 virtual bool StartURL( const OUString rUrl, const OUString rTarget ) = 0;
 
 /// Output URL end.
-virtual bool EndURL() = 0;
+virtual bool EndURL(bool isAtEndOfParagraph) = 0;
 
 virtual void FieldVanish( const OUString rTxt, ww::eField eType ) = 0;
 
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 3b74b5b..fcd5794 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -2070,7 +2070,7 @@ bool DocxAttributeOutput::StartURL( const OUString rUrl, 
const OUString rTarge
 return true;
 }
 
-bool DocxAttributeOutput::EndURL()
+bool DocxAttributeOutput::EndURL(bool const)
 {
 m_closeHyperlinkInThisRun = true;
 if(m_startedHyperlink  m_hyperLinkAnchor !=   
m_hyperLinkAnchor.startsWith(_Toc))
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx 
b/sw/source/filter/ww8/docxattributeoutput.hxx
index 6465a71..5f979ad 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -190,7 +190,7 @@ public:
 virtual bool StartURL( const OUString rUrl, const OUString rTarget ) 
SAL_OVERRIDE;
 
 /// Output URL end.
-virtual bool EndURL() SAL_OVERRIDE;
+virtual bool EndURL(bool) SAL_OVERRIDE;
 
 virtual void FieldVanish( const OUString rTxt, ww::eField eType ) 
SAL_OVERRIDE;
 
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx 
b/sw/source/filter/ww8/rtfattributeoutput.cxx
index 5f41c34..6dabc93 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ 

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

2014-06-27 Thread Miklos Vajna
 sw/qa/extras/rtfexport/data/fdo80167.rtf |6 ++
 sw/qa/extras/rtfexport/rtfexport.cxx |   12 +---
 sw/source/filter/ww8/docxexport.hxx  |2 ++
 sw/source/filter/ww8/rtfexport.hxx   |5 +
 sw/source/filter/ww8/wrtww8.hxx  |5 +
 sw/source/filter/ww8/ww8atr.cxx  |   13 ++---
 6 files changed, 37 insertions(+), 6 deletions(-)

New commits:
commit 8100100298b877765e1781fb0eed285e82749ad1
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Fri Jun 27 21:28:36 2014 +0200

fdo#80167 RTF export: don't loose page breaks

DOCX export tries to write accurately both w:br and
w:pageBreakBefore, while DOC/RTF prefers just the page break before
paragraph attribute. Given that these later two exporters are not
adapted to write their equivalent of w:br at all, add a virtual method
to determine if writing page breaks as page break before is preferred
or not, that'll give the expected RTF export result.

This conditionally reverts commit
a31fbb53dba76736b37213b98b64937f05929a67 (fdo#74566:DOCX: Preservation
w:br tag for Break to Next Page, 2014-02-06).

Change-Id: I4a5dd295b07739a570cd8cc6709561e64d031273

diff --git a/sw/qa/extras/rtfexport/data/fdo80167.rtf 
b/sw/qa/extras/rtfexport/data/fdo80167.rtf
new file mode 100644
index 000..3aa9dd3
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/fdo80167.rtf
@@ -0,0 +1,6 @@
+{\rtf1
+\pard\plain
+one\par
+\pard\page\par
+\pard two\par
+}
diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx 
b/sw/qa/extras/rtfexport/rtfexport.cxx
index 1fe8c88..cdbb06d 100644
--- a/sw/qa/extras/rtfexport/rtfexport.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport.cxx
@@ -653,6 +653,12 @@ DECLARE_RTFEXPORT_TEST(testFdo79599, fdo79599.rtf)
 CPPUNIT_ASSERT_EQUAL(sal_uInt32(0x800080), getPropertysal_uInt32(xRun, 
CharBackColor));
 }
 
+DECLARE_RTFEXPORT_TEST(testFdo80167, fdo80167.rtf)
+{
+// Problem was that after export, the page break was missing, so this was 
1.
+CPPUNIT_ASSERT_EQUAL(2, getPages());
+}
+
 #endif
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/filter/ww8/docxexport.hxx 
b/sw/source/filter/ww8/docxexport.hxx
index 3415b03..9e2b6b7 100644
--- a/sw/source/filter/ww8/docxexport.hxx
+++ b/sw/source/filter/ww8/docxexport.hxx
@@ -124,6 +124,8 @@ public:
 
 virtual bool ignoreAttributeForStyles( sal_uInt16 nWhich ) const 
SAL_OVERRIDE;
 
+virtual bool PreferPageBreakBefore() const SAL_OVERRIDE { return false; }
+
 /// Guess the script (asian/western).
 virtual bool CollapseScriptsforWordOk( sal_uInt16 nScript, sal_uInt16 
nWhich ) SAL_OVERRIDE;
 
diff --git a/sw/source/filter/ww8/rtfexport.hxx 
b/sw/source/filter/ww8/rtfexport.hxx
index aebb839..c384289 100644
--- a/sw/source/filter/ww8/rtfexport.hxx
+++ b/sw/source/filter/ww8/rtfexport.hxx
@@ -80,6 +80,11 @@ public:
 return false;
 }
 
+virtual bool PreferPageBreakBefore() const SAL_OVERRIDE
+{
+return true;
+}
+
 /// Guess the script (asian/western).
 virtual bool CollapseScriptsforWordOk(sal_uInt16 nScript, sal_uInt16 
nWhich) SAL_OVERRIDE;
 
diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx
index 46c4077..d4eaa22 100644
--- a/sw/source/filter/ww8/wrtww8.hxx
+++ b/sw/source/filter/ww8/wrtww8.hxx
@@ -655,6 +655,9 @@ public:
 /// Used to filter out attributes that can be e.g. written to .doc but not 
to .docx
 virtual bool ignoreAttributeForStyles( sal_uInt16 /*nWhich*/ ) const { 
return false; }
 
+/// If saving page break is preferred as a paragraph attribute (yes) or as 
a special character (no).
+virtual bool PreferPageBreakBefore() const = 0;
+
 /// Guess the script (asian/western).
 ///
 /// Sadly word does not have two different sizes for asian font size and
@@ -974,6 +977,8 @@ public:
 /// False for WW6, true for WW8.
 virtual bool SupportsUnicode() const SAL_OVERRIDE { return bWrtWW8; }
 
+virtual bool PreferPageBreakBefore() const SAL_OVERRIDE { return true; }
+
 virtual bool SupportsOneColumnBreak() const SAL_OVERRIDE { return false; }
 
 virtual bool FieldsQuoted() const SAL_OVERRIDE { return false; }
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index 31b9df7..4eeb176 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -3765,9 +3765,16 @@ void AttributeOutputBase::FormatBreak( const 
SvxFmtBreakItem rBreak )
 break;
 
 case SVX_BREAK_PAGE_BEFORE: // PageBreak
-// From now on(fix for #i77900#) we prefer to save a page 
break as
-// paragraph attribute, this has to be done after the export 
of the
-// paragraph ( = !GetExport().bBreakBefore )
+// From now on(fix for #i77900#) we prefer to save a page break
+// as paragraph attribute (if the exporter is OK with that),
+ 

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

2014-06-19 Thread Miklos Vajna
 sw/qa/extras/rtfexport/data/fdo79599.rtf   |   38 
 sw/qa/extras/rtfexport/rtfexport.cxx   |9 +++
 sw/qa/extras/rtfimport/data/fdo79599.rtf   |   38 
 sw/qa/extras/rtfimport/rtfimport.cxx   |   57 -
 sw/source/filter/ww8/rtfattributeoutput.cxx|2 
 writerfilter/source/dmapper/DomainMapper.cxx   |2 
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |4 -
 7 files changed, 145 insertions(+), 5 deletions(-)

New commits:
commit aca657b380477f122e1b541e6b0050f34bfc23de
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Thu Jun 19 21:39:37 2014 +0200

whitespace

Change-Id: I2db68597c83285571da2ddd1257a61a4603a90ef

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 2c747f2..3a7ebfb 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -772,7 +772,7 @@ int RTFDocumentImpl::resolvePict(bool bInline)
 if (xShape.is())
 {
 uno::Referencelang::XServiceInfo xSI(xShape, uno::UNO_QUERY_THROW);
-if(!xSI-supportsService(com.sun.star.drawing.GraphicObjectShape))
+if (!xSI-supportsService(com.sun.star.drawing.GraphicObjectShape))
 xShape.clear();
 }
 
commit 7eafd8ccac56d7503b4287dfa3acac2cf0560b20
Author: nrb...@gmail.com nrb...@gmail.com
Date:   Tue Jun 10 12:26:26 2014 +0400

fdo#79599: use \highlightN instead of \chcbpatN in RTF import and export

Reviewed on:
https://gerrit.libreoffice.org/9776

Change-Id: I98ef606fb73368a3c275819cb83b936e2162769d

diff --git a/sw/qa/extras/rtfexport/data/fdo79599.rtf 
b/sw/qa/extras/rtfexport/data/fdo79599.rtf
new file mode 100755
index 000..f908709
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/fdo79599.rtf
@@ -0,0 +1,38 @@
+{\rtf1\deff0
+{\fonttbl
+{\f000 Courier New;}
+}
+{\colortbl;
+\red0\green0\blue0;
+\red255\green255\blue0;
+\red0\green255\blue0;
+\red0\green255\blue255;
+\red255\green0\blue255;
+\red0\green0\blue255;
+\red255\green0\blue0;
+\red0\green0\blue128;
+\red0\green128\blue128;
+\red0\green128\blue0;
+\red128\green0\blue128;
+\red128\green0\blue0;
+\red128\green128\blue0;
+\red128\green128\blue128;
+\red192\green192\blue192;
+}
+\highlight0 Should be ignored\par
+\highlight2 #00 = Yellow\par
+\highlight3 #00FF00 = Green\par
+\highlight4 #00 = Cyan\par
+\highlight5 #FF00FF = Magenta\par
+\highlight6 #FF = Blue\par
+\highlight7 #FF = Red\par
+\highlight8 #80 = Dark blue\par
+\highlight9 #008080 = Dark cyan\par
+\highlight10 #008000 = Dark green\par
+\highlight11 #800080 = Dark magenta\par
+\highlight12 #80 = Dark red\par
+\highlight13 #808000 = Dark yellow\par
+\highlight14 #808080 = Dark gray\par
+\highlight15 #C0C0C0 = Light gray\par
+\highlight1 #00 = Black\par
+}
diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx 
b/sw/qa/extras/rtfexport/rtfexport.cxx
index 71113f1..c01dc38 100644
--- a/sw/qa/extras/rtfexport/rtfexport.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport.cxx
@@ -634,6 +634,15 @@ DECLARE_RTFEXPORT_TEST(testFdo77600, fdo77600.rtf)
 CPPUNIT_ASSERT_EQUAL(OUString(Arial), 
getPropertyOUString(getRun(getParagraph(1), 3), CharFontName));
 }
 
+DECLARE_RTFEXPORT_TEST(testFdo79599, fdo79599.rtf)
+{
+// test for \highlightNN, document has full \colortbl (produced in MS Word 
2003 or 2007)
+
+// test \highlight11 = dark magenta
+uno::Referencebeans::XPropertySet xRun(getRun(getParagraph(11),1), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(sal_uInt32(0x800080), getPropertysal_uInt32(xRun, 
CharBackColor));
+}
+
 #endif
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/qa/extras/rtfimport/data/fdo79599.rtf 
b/sw/qa/extras/rtfimport/data/fdo79599.rtf
new file mode 100755
index 000..f908709
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo79599.rtf
@@ -0,0 +1,38 @@
+{\rtf1\deff0
+{\fonttbl
+{\f000 Courier New;}
+}
+{\colortbl;
+\red0\green0\blue0;
+\red255\green255\blue0;
+\red0\green255\blue0;
+\red0\green255\blue255;
+\red255\green0\blue255;
+\red0\green0\blue255;
+\red255\green0\blue0;
+\red0\green0\blue128;
+\red0\green128\blue128;
+\red0\green128\blue0;
+\red128\green0\blue128;
+\red128\green0\blue0;
+\red128\green128\blue0;
+\red128\green128\blue128;
+\red192\green192\blue192;
+}
+\highlight0 Should be ignored\par
+\highlight2 #00 = Yellow\par
+\highlight3 #00FF00 = Green\par
+\highlight4 #00 = Cyan\par
+\highlight5 #FF00FF = Magenta\par
+\highlight6 #FF = Blue\par
+\highlight7 #FF = Red\par
+\highlight8 #80 = Dark blue\par
+\highlight9 #008080 = Dark cyan\par
+\highlight10 #008000 = Dark green\par
+\highlight11 #800080 = Dark magenta\par
+\highlight12 #80 = Dark red\par
+\highlight13 #808000 = Dark yellow\par
+\highlight14 #808080 = Dark gray\par
+\highlight15 #C0C0C0 = Light gray\par
+\highlight1 #00 = Black\par
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx 

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

2014-06-13 Thread Miklos Vajna
 sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx |4 ++--
 sw/source/core/doc/textboxhelper.cxx|   17 +++--
 sw/source/core/unocore/unodraw.cxx  |8 +++-
 3 files changed, 24 insertions(+), 5 deletions(-)

New commits:
commit 54148d634d497dc0682399006890d77341402b42
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Fri Jun 13 21:55:39 2014 +0200

CppunitTest_sw_ooxmlsdrexport: clean up XPath expressions in testFDO77122

Change-Id: I1f8737bbe128c747c84c67e8ba8000ecef1ed4f7

diff --git a/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx
index ee40f9e..5157234 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx
@@ -1482,8 +1482,8 @@ DECLARE_OOXMLEXPORT_TEST(testFDO77122, 
LinkedTextBoxes.docx)
 if (!pXmlDoc)
 return;
 //ensure that the text box links are preserved.
-assertXPath(pXmlDoc, 
/w:document/w:body/w:p/w:r[2]/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData[1]/wps:wsp[1]/wps:txbx[1],
 id, 1);
-assertXPath(pXmlDoc, 
/w:document[1]/w:body[1]/w:p[1]/w:r[3]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:linkedTxbx[1],
 id, 1);
+assertXPath(pXmlDoc, //wps:txbx[1], id, 1);
+assertXPath(pXmlDoc, //wps:linkedTxbx[1], id, 1);
 }
 
 DECLARE_OOXMLEXPORT_TEST(test76734_2K7, test76734_2K7.docx)
commit 77c3c53cff8c2b8af535c2cb0236314434ba8c45
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Fri Jun 13 21:45:40 2014 +0200

SwXShape: getter for ChainNext/PrevName UNO property

Change-Id: I7e4fffabf6b1d96a458a3afd141f86d0e4565230

diff --git a/sw/source/core/doc/textboxhelper.cxx 
b/sw/source/core/doc/textboxhelper.cxx
index 5ddfbe0..c7fbb8d 100644
--- a/sw/source/core/doc/textboxhelper.cxx
+++ b/sw/source/core/doc/textboxhelper.cxx
@@ -11,6 +11,7 @@
 #include frmfmt.hxx
 #include fmtcntnt.hxx
 #include fmtanchr.hxx
+#include fmtcnct.hxx
 #include doc.hxx
 #include docsh.hxx
 #include docary.hxx
@@ -286,9 +287,21 @@ void SwTextBoxHelper::getProperty(SwFrmFmt* pShape, 
sal_uInt16 nWID, sal_uInt8 n
 
 if (SwFrmFmt* pFmt = findTextBox(pShape))
 {
-if (nWID == RES_CHAIN  nMemberId == MID_CHAIN_NAME)
+if (nWID == RES_CHAIN)
 {
-rValue = uno::makeAny(pFmt-GetName());
+switch (nMemberId)
+{
+case MID_CHAIN_PREVNAME:
+case MID_CHAIN_NEXTNAME:
+{
+const SwFmtChain rChain = pFmt-GetChain();
+rChain.QueryValue(rValue, nMemberId);
+}
+break;
+case MID_CHAIN_NAME:
+rValue = uno::makeAny(pFmt-GetName());
+break;
+}
 }
 }
 }
diff --git a/sw/source/core/unocore/unodraw.cxx 
b/sw/source/core/unocore/unodraw.cxx
index afbf447..f4924b9 100644
--- a/sw/source/core/unocore/unodraw.cxx
+++ b/sw/source/core/unocore/unodraw.cxx
@@ -1542,8 +1542,14 @@ uno::Any SwXShape::getPropertyValue(const OUString 
rPropertyName)
 }
 else if (pEntry-nWID == RES_CHAIN)
 {
-if (pEntry-nMemberId == MID_CHAIN_NAME)
+switch (pEntry-nMemberId)
+{
+case MID_CHAIN_PREVNAME:
+case MID_CHAIN_NEXTNAME:
+case MID_CHAIN_NAME:
 SwTextBoxHelper::getProperty(pFmt, pEntry-nWID, 
pEntry-nMemberId, aRet);
+break;
+}
 }
 // #i28749#
 else if ( FN_SHAPE_TRANSFORMATION_IN_HORI_L2R == pEntry-nWID )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-06-12 Thread Michael Stahl
 sw/qa/extras/rtfexport/rtfexport.cxx   |7 +++
 sw/source/filter/inc/msfilter.hxx  |   12 +-
 sw/source/filter/ww8/rtfattributeoutput.cxx|   19 -
 sw/source/filter/ww8/writerwordglue.cxx|   49 +
 sw/source/filter/ww8/wrtw8sty.cxx  |3 +
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |8 ++--
 6 files changed, 89 insertions(+), 9 deletions(-)

New commits:
commit e47a02b1524061143d8e77a54eb95c77f2e6dae2
Author: Michael Stahl mst...@redhat.com
Date:   Thu Jun 12 12:16:28 2014 +0200

fdo#77979: sw: RTF export: write non-ASCII font names encoded

Currently font names like 微软雅黑 (Microsoft YaHei) are
written as  in the RTF export; to avoid that, set the \fcharset
of the font entry to something that at least is able to encode
the font name and alternate name.

This requires a new function since the existing
rtl_TextEncodingToWinCharset was changed in
b88fe998ce8c80d7629fe70118311096615d959d to return default 0x01
(for OOXML) which is quite unhelpful for RTF.

This is not entirely satisfactory, as of course that is no guarantee
that the encoding can represent all of the actual text that has the
font applied; hence there are some \'3f in the fall-back encoded text
of the heading of the bugdoc, which indicates that the detected
Shift-JIS is insufficient and GB-2132 would be required; but it's not
obvious how to do better here without iterating over all the text
twice, and that still leaves the possibility that all text that has a
particular font applied cannot be represented by a single non-Unicode
encoding.

But since we always write text as the \u Unicode + legacy fall-back,
this should not be a big problem since modern RTF readers will simply
read the Unicode.

Change-Id: Ie6a42294c501d014dd9f0df82638519412ca19bb

diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx 
b/sw/qa/extras/rtfexport/rtfexport.cxx
index 9a38b49..ce91526 100644
--- a/sw/qa/extras/rtfexport/rtfexport.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport.cxx
@@ -317,6 +317,13 @@ DECLARE_RTFEXPORT_TEST(testMathRuns, math-runs.rtf)
 CPPUNIT_ASSERT_EQUAL(OUString(\\{ left [ right ] left ( right ) \\}), 
getFormula(getRun(getParagraph(1), 1)));
 }
 
+DECLARE_RTFEXPORT_TEST(testFdo77979, fdo77979.odt)
+{
+// font name is encoded with \fcharset of font
+CPPUNIT_ASSERT_EQUAL(OUString(微软雅黑, 12, RTL_TEXTENCODING_UTF8),
+getPropertyOUString(getRun(getParagraph(1), 1), CharFontName));
+}
+
 DECLARE_RTFEXPORT_TEST(testFdo53113, fdo53113.odt)
 {
 /*
diff --git a/sw/source/filter/inc/msfilter.hxx 
b/sw/source/filter/inc/msfilter.hxx
index babfc7e..8ff19a0 100644
--- a/sw/source/filter/inc/msfilter.hxx
+++ b/sw/source/filter/inc/msfilter.hxx
@@ -59,8 +59,7 @@ namespace sw
 {
 /** MSOffice appears to set the charset of unicode fonts to MS 932
 
-Arial Unicode MS for example is a unicode font, but word sets
-exported uses of it to the MS 932 charset
+But we do default, whatever that means.
 
 @param eTextEncoding
 the OOo encoding to convert from
@@ -73,6 +72,15 @@ namespace sw
 */
 sal_uInt8 rtl_TextEncodingToWinCharset(rtl_TextEncoding eTextEncoding);
 
+/** MSOffice appears to set the charset of unicode fonts to MS 932
+
+Arial Unicode MS for example is a unicode font, but word sets
+exported uses of it to the MS 932 charset
+
+*/
+sal_uInt8 rtl_TextEncodingToWinCharsetRTF(OUString const rFontName,
+OUString const rAltName, rtl_TextEncoding eTextEncoding);
+
 /** Import a MSWord XE field. Suitable for .doc and .rtf
 
 @param rDoc
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx 
b/sw/source/filter/ww8/rtfattributeoutput.cxx
index 41e06be..162b6cc 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -2073,7 +2073,12 @@ void RtfAttributeOutput::CharFont(const SvxFontItem 
rFont)
 m_aStylesEnd.append(OOO_STRING_SVTOOLS_RTF_LOCH);
 m_aStylesEnd.append(OOO_STRING_SVTOOLS_RTF_F);
 m_aStylesEnd.append((sal_Int32)m_rExport.maFontHelper.GetId(rFont));
-m_rExport.eCurrentEncoding = 
rtl_getTextEncodingFromWindowsCharset(rtl_getBestWindowsCharsetFromTextEncoding(rFont.GetCharSet()));
+// FIXME: this may be a tad expensive... but the charset needs to be
+// consistent with what wwFont::WriteRtf() does
+FontMapExport aTmp(rFont.GetFamilyName());
+m_rExport.eCurrentEncoding = rtl_getTextEncodingFromWindowsCharset(
+sw::ms::rtl_TextEncodingToWinCharsetRTF(
+aTmp.msPrimary, aTmp.msSecondary, rFont.GetCharSet()));
 if (m_rExport.eCurrentEncoding == RTL_TEXTENCODING_DONTKNOW)
 m_rExport.eCurrentEncoding = m_rExport.eDefaultEncoding;
 }

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

2014-04-30 Thread Miklos Vajna
 sw/qa/core/exportdata/html/pass/cp168.odt |binary
 sw/qa/core/filters-test.cxx   |8 
 sw/source/filter/writer/wrt_fn.cxx|3 ++-
 3 files changed, 10 insertions(+), 1 deletion(-)

New commits:
commit 1de73df9cb3fdda3732c5270864bc30e38e63c2f
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Wed Apr 30 14:40:16 2014 +0200

cp#168 testcase

Change-Id: I0dbbfd9c82600fbc5c98c5107639e1714b220c71

diff --git a/sw/qa/core/exportdata/html/fail/.gitignore 
b/sw/qa/core/exportdata/html/fail/.gitignore
new file mode 100644
index 000..e69de29
diff --git a/sw/qa/core/exportdata/html/indeterminate/.gitignore 
b/sw/qa/core/exportdata/html/indeterminate/.gitignore
new file mode 100644
index 000..e69de29
diff --git a/sw/qa/core/exportdata/html/pass/cp168.odt 
b/sw/qa/core/exportdata/html/pass/cp168.odt
new file mode 100644
index 000..8ae4ad5
Binary files /dev/null and b/sw/qa/core/exportdata/html/pass/cp168.odt 
differ
diff --git a/sw/qa/core/filters-test.cxx b/sw/qa/core/filters-test.cxx
index 3cbad56..8548616 100644
--- a/sw/qa/core/filters-test.cxx
+++ b/sw/qa/core/filters-test.cxx
@@ -180,6 +180,14 @@ void SwFiltersTest::testCVEs()
 0,
 0,
 /*bExport=*/true);
+
+testDir(HTML,
+getURLFromSrc(/sw/qa/core/exportdata/html/),
+OUString(sHTML),
+0,
+0,
+0,
+/*bExport=*/true);
 }
 
 void SwFiltersTest::setUp()
commit 78eadd2f122e072f217137199430f113f41b450a
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Wed Apr 30 11:28:40 2014 +0200

cp#168 sw HTML export: fix crash when trying to export new 
FillAttributes

Change-Id: I588b8f7d953fe6a3e04ad48074e5f3f554449a79

diff --git a/sw/source/filter/writer/wrt_fn.cxx 
b/sw/source/filter/writer/wrt_fn.cxx
index 2948160..07dca7f 100644
--- a/sw/source/filter/writer/wrt_fn.cxx
+++ b/sw/source/filter/writer/wrt_fn.cxx
@@ -60,7 +60,8 @@ Writer Out_SfxItemSet( const SwAttrFnTab pTab, Writer rWrt,
 SfxItemIter aIter( *pSet );
 pItem = aIter.GetCurItem();
 do {
-if( 0 != ( pOut = pTab[ pItem-Which() - RES_CHRATR_BEGIN] ))
+// pTab only covers POOLATTR_BEGIN..POOLATTR_END.
+if( pItem-Which() = POOLATTR_END  0 != ( pOut = pTab[ 
pItem-Which() - RES_CHRATR_BEGIN] ))
 (*pOut)( rWrt, *pItem );
 } while( !aIter.IsAtEnd()  0 != ( pItem = aIter.NextItem() ) );
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-04-03 Thread Jacobo Aragunde Pérez
 sw/qa/extras/ooxmlexport/data/table-theme-preservation.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx|5 
 sw/source/filter/ww8/docxattributeoutput.cxx|   97 
 sw/source/filter/ww8/docxattributeoutput.hxx|4 
 writerfilter/source/dmapper/DomainMapperTableHandler.cxx|   30 +++
 5 files changed, 105 insertions(+), 31 deletions(-)

New commits:
commit 42ced106ff6ed5688385a5d2b40d4b5caea68406
Author: Jacobo Aragunde Pérez jaragu...@igalia.com
Date:   Thu Apr 3 16:49:33 2014 +0200

oox: use HasItem instead of GetItemState

Code looks cleaner like this.

Change-Id: I43bd8d2ac40960347d60e687dcae4c17357991b0

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 1f4c301..a37282a 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -2703,10 +2703,8 @@ void DocxAttributeOutput::TableDefinition( 
ww8::WW8TableNodeInfoInner::Pointer_t
 FSEND );
 
 // Look for the table style property in the table grab bag
-const SfxPoolItem *pI = NULL;
-std::mapOUString, com::sun::star::uno::Any aGrabBag;
-if ( SFX_ITEM_ON == pTblFmt-GetAttrSet().GetItemState( 
RES_FRMATR_GRABBAG, false, pI ) )
-aGrabBag = dynamic_castconst SfxGrabBagItem *(pI)-GetGrabBag();
+std::mapOUString, com::sun::star::uno::Any aGrabBag =
+sw::util::HasItemSfxGrabBagItem( pTblFmt-GetAttrSet(), 
RES_FRMATR_GRABBAG )-GetGrabBag();
 
 // Extract properties from grab bag
 std::mapOUString, com::sun::star::uno::Any::iterator aGrabBagElement;
@@ -2829,19 +2827,13 @@ void DocxAttributeOutput::TableBackgrounds( 
ww8::WW8TableNodeInfoInner::Pointer_
 {
 const SwTableBox *pTblBox = pTableTextNodeInfoInner-getTableBox( );
 const SwFrmFmt *pFmt = pTblBox-GetFrmFmt( );
-const SfxPoolItem *pI = NULL;
-
-Color aColor;
-if ( SFX_ITEM_ON == pFmt-GetAttrSet().GetItemState( RES_BACKGROUND, 
false, pI ) )
-aColor = dynamic_castconst SvxBrushItem *(pI)-GetColor();
-else
-aColor = COL_AUTO;
 
+const SvxBrushItem *aColorProp = sw::util::HasItemSvxBrushItem( 
pFmt-GetAttrSet(), RES_BACKGROUND );
+Color aColor = aColorProp ? aColorProp-GetColor() : COL_AUTO;
 OString sColor = msfilter::util::ConvertColor( aColor );
 
-std::mapOUString, com::sun::star::uno::Any aGrabBag;
-if ( SFX_ITEM_ON == pFmt-GetAttrSet().GetItemState( RES_FRMATR_GRABBAG, 
false, pI ) )
-aGrabBag = dynamic_castconst SfxGrabBagItem *(pI)-GetGrabBag();
+std::mapOUString, com::sun::star::uno::Any aGrabBag =
+sw::util::HasItemSfxGrabBagItem( pFmt-GetAttrSet(), 
RES_FRMATR_GRABBAG )-GetGrabBag();
 
 OString sOriginalColor;
 std::mapOUString, com::sun::star::uno::Any::iterator aGrabBagElement = 
aGrabBag.find(fill);
commit ae61569eea0719a882010cfbb260a1a0d690d974
Author: Jacobo Aragunde Pérez jaragu...@igalia.com
Date:   Thu Apr 3 16:27:37 2014 +0200

oox: Do not overwrite table style properties

Some table properties can be defined by the table style but cells can
overwrite them in their cell properties section. Our exporter was
writing all the cell properties in all cases, regardless of them
being defined by the theme or not, and we shouldn't do that if we
want the document to work properly in Word.

To fix the issue I store the style-defined cell properties (the
format of all four borders) in the table grab bag. The exporter
recovers them and compares with the cell properties before writing
them; if the cell property matches the stlye-defined one, we don't
write it to the document.

An existing unit test was slightly modified to check that the actual
cell properties are not being skipped.

Change-Id: I3aa12d76fb8f73d3fd300f254d19e1683fb6146c

diff --git a/sw/qa/extras/ooxmlexport/data/table-theme-preservation.docx 
b/sw/qa/extras/ooxmlexport/data/table-theme-preservation.docx
index fe6b953..522dac8 100644
Binary files a/sw/qa/extras/ooxmlexport/data/table-theme-preservation.docx and 
b/sw/qa/extras/ooxmlexport/data/table-theme-preservation.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index b68b872..1e1fd6d 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -1956,6 +1956,11 @@ DECLARE_OOXMLEXPORT_TEST(testTableThemePreservation, 
table-theme-preservation.d
 
 // check table style has been preserved
 assertXPath(pXmlDocument, /w:document/w:body/w:tbl/w:tblPr/w:tblStyle, 
val, Sombreadoclaro-nfasis1);
+// check table style is not overwritten by other properties
+assertXPath(pXmlDocument, 
/w:document/w:body/w:tbl/w:tr[1]/w:tc[2]/w:tcPr/w:tcBorders/*, 0);
+assertXPath(pXmlDocument, 
/w:document/w:body/w:tbl/w:tr[1]/w:tc[3]/w:tcPr/w:tcBorders/*, 0);

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

2014-04-01 Thread Miklos Vajna
 sw/qa/unoapi/sw.sce |6 +++---
 sw/source/core/docnode/nodedump.cxx |8 
 sw/source/core/unocore/unostyle.cxx |4 ++--
 3 files changed, 13 insertions(+), 5 deletions(-)

New commits:
commit 1e3c7b854baac2502bed72ff8e3e1b21b507735b
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Tue Apr 1 15:54:58 2014 +0200

SwXStyle::getPropertyValue: don't try to read a float into a sal_Int32

The problem was that for the CharDiffHeight UNO property,
SvxFontHeightItem::QueryValue() put a float to the returned uno::Any.
When we noticed that it's not sal_Int16, we tried to read that into a
sal_Int32 (which failed), and then wrote back the result to the
uno::Any, that's how the result value was 0.

Fix this by checking if reading the uno::Any into a sal_Int32 succeeds.

Change-Id: Ie2269a24fe82ae241940811e7a2f5deaf9f1aeb0

diff --git a/sw/qa/unoapi/sw.sce b/sw/qa/unoapi/sw.sce
index cc6a359..4ea9fab 100644
--- a/sw/qa/unoapi/sw.sce
+++ b/sw/qa/unoapi/sw.sce
@@ -16,10 +16,10 @@
 #   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 #
 
-# FIXME port to FillAttributes -o sw.CharacterStyle
-# FIXME port to FillAttributes -o sw.ConditionalParagraphStyle
+-o sw.CharacterStyle
+-o sw.ConditionalParagraphStyle
 -o sw.PageStyle
-# FIXME port to FillAttributes -o sw.ParagraphStyle
+-o sw.ParagraphStyle
 #i97 -o sw.SwAccessibleDocumentPageView
 #i86751 -o sw.SwAccessibleDocumentView
 -o sw.SwAccessibleEndnoteView
diff --git a/sw/source/core/unocore/unostyle.cxx 
b/sw/source/core/unocore/unostyle.cxx
index 45047ed..1c417c8 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -2557,8 +2557,8 @@ static uno::Any lcl_GetStyleProperty(const 
SfxItemPropertySimpleEntry rEntry,
 {
 // since the sfx uint16 item now exports a sal_Int32, we may 
have to fix this here
 sal_Int32 nValue = 0;
-aRet = nValue;
-aRet = (sal_Int16)nValue;
+if (aRet = nValue)
+aRet = (sal_Int16)nValue;
 }
 
 // check for needed metric translation
commit 6f8ffc4eed5ff584bc9c9b9c210e7e0c58ccfd9b
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Tue Apr 1 15:40:46 2014 +0200

sw doc model xml dump: handle SvxFontHeightItem

Change-Id: I27a9681fdf86a8814be48ba9875202705aa2b014

diff --git a/sw/source/core/docnode/nodedump.cxx 
b/sw/source/core/docnode/nodedump.cxx
index 2d0cd2b..d6e1207 100644
--- a/sw/source/core/docnode/nodedump.cxx
+++ b/sw/source/core/docnode/nodedump.cxx
@@ -25,6 +25,7 @@
 #include editeng/charrotateitem.hxx
 #include editeng/rsiditem.hxx
 #include editeng/fontitem.hxx
+#include editeng/fhgtitem.hxx
 #include tools/datetimeutils.hxx
 
 #include libxml/encoding.h
@@ -319,6 +320,13 @@ void lcl_dumpSfxItemSet(WriterHelper writer, const 
SfxItemSet* pSet)
 case RES_CHRATR_FONT: pWhich = character font; oValue = 
OUStringToOString(static_castconst SvxFontItem*(pItem)-GetFamilyName(), 
RTL_TEXTENCODING_UTF8); break;
 case RES_CHRATR_BACKGROUND: pWhich = character background; break;
 case RES_CHRATR_CTL_FONT: pWhich = character ctl font; break;
+case RES_CHRATR_FONTSIZE:
+{
+pWhich = character font size;
+const SvxFontHeightItem* pFontHeightItem = static_castconst 
SvxFontHeightItem*(pItem);
+oValue = nHeight:  + 
OString::number(pFontHeightItem-GetHeight()) + , nProp:  + 
OString::number(pFontHeightItem-GetProp());
+}
+break;
 }
 if (pWhich)
 writer.writeFormatAttribute(which, %s, BAD_CAST(pWhich));
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-03-19 Thread Miklos Vajna
 sw/qa/extras/ooxmlexport/data/FDO76248.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx|8 +
 sw/source/filter/ww8/docxsdrexport.cxx  |  159 ++--
 3 files changed, 89 insertions(+), 78 deletions(-)

New commits:
commit 3e92847d75e8703d0537d5411d1f98bd1cd0402a
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Wed Mar 19 14:09:51 2014 +0100

fdo#76248 make the test fail without the fix

Change-Id: I26d27bfaafb83ee3ae74ce64bf72146b157ed7db

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 6a50def..ee6c511 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -2880,11 +2880,11 @@ DECLARE_OOXMLEXPORT_TEST(testSimpleSdts, 
simple-sdts.docx)
 
 DECLARE_OOXMLEXPORT_TEST(testFDO76248, FDO76248.docx)
 {
-uno::Referenceframe::XModel xModel(mxComponent, uno::UNO_QUERY);
-uno::Referencetext::XTextViewCursorSupplier 
xTextViewCursorSupplier(xModel-getCurrentController(), uno::UNO_QUERY);
-uno::Referencetext::XPageCursor 
xCursor(xTextViewCursorSupplier-getViewCursor(), uno::UNO_QUERY);
-xCursor-jumpToLastPage();
-CPPUNIT_ASSERT_EQUAL(sal_Int16(3), xCursor-getPage());
+xmlDocPtr pXmlDoc = parseExport(word/document.xml);
+if (!pXmlDoc)
+   return;
+// In two cases the a:graphicData elements had no children, which is 
invalid.
+assertXPath(pXmlDoc, //a:graphicData[not(*)], 0);
 }
 
 #endif
commit 79747314d368ab253e171877209d7172fd993c74
Author: Rohit Deshmukh rohit.deshm...@synerzip.com
Date:   Mon Mar 17 15:08:04 2014 +0530

fdo#76248: Fix for file corruption which contains Polyline shape.

Reviewed on:
https://gerrit.libreoffice.org/8623

Change-Id: I042eeb0829c55d6a0fd5d85c1712c7b1cddc8c96

diff --git a/sw/qa/extras/ooxmlexport/data/FDO76248.docx 
b/sw/qa/extras/ooxmlexport/data/FDO76248.docx
new file mode 100644
index 000..c7b868e
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/FDO76248.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 0a77ab5..6a50def 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -2878,6 +2878,14 @@ DECLARE_OOXMLEXPORT_TEST(testSimpleSdts, 
simple-sdts.docx)
 
 }
 
+DECLARE_OOXMLEXPORT_TEST(testFDO76248, FDO76248.docx)
+{
+uno::Referenceframe::XModel xModel(mxComponent, uno::UNO_QUERY);
+uno::Referencetext::XTextViewCursorSupplier 
xTextViewCursorSupplier(xModel-getCurrentController(), uno::UNO_QUERY);
+uno::Referencetext::XPageCursor 
xCursor(xTextViewCursorSupplier-getViewCursor(), uno::UNO_QUERY);
+xCursor-jumpToLastPage();
+CPPUNIT_ASSERT_EQUAL(sal_Int16(3), xCursor-getPage());
+}
 
 #endif
 
diff --git a/sw/source/filter/ww8/docxsdrexport.cxx 
b/sw/source/filter/ww8/docxsdrexport.cxx
index be0baa1..0e62973 100644
--- a/sw/source/filter/ww8/docxsdrexport.cxx
+++ b/sw/source/filter/ww8/docxsdrexport.cxx
@@ -536,95 +536,98 @@ void DocxSdrExport::writeVMLDrawing(const SdrObject* 
sdrObj, const SwFrmFmt rFr
 
 void DocxSdrExport::writeDMLDrawing(const SdrObject* pSdrObject, const 
SwFrmFmt* pFrmFmt, int nAnchorId)
 {
-sax_fastparser::FSHelperPtr pFS = m_pImpl-m_pSerializer;
-Size aSize(pSdrObject-GetLogicRect().GetWidth(), 
pSdrObject-GetLogicRect().GetHeight());
-startDMLAnchorInline(pFrmFmt, aSize);
-
-sax_fastparser::FastAttributeList* pDocPrAttrList = pFS-createAttrList();
-pDocPrAttrList-add(XML_id, OString::number(nAnchorId).getStr());
-pDocPrAttrList-add(XML_name, OUStringToOString(pSdrObject-GetName(), 
RTL_TEXTENCODING_UTF8));
-if (!pSdrObject-GetTitle().isEmpty())
-pDocPrAttrList-add(XML_title, 
OUStringToOString(pSdrObject-GetTitle(), RTL_TEXTENCODING_UTF8));
-if (!pSdrObject-GetDescription().isEmpty())
-pDocPrAttrList-add(XML_descr, 
OUStringToOString(pSdrObject-GetDescription(), RTL_TEXTENCODING_UTF8));
-sax_fastparser::XFastAttributeListRef xDocPrAttrListRef(pDocPrAttrList);
-pFS-singleElementNS(XML_wp, XML_docPr, xDocPrAttrListRef);
-
 uno::Referencedrawing::XShape 
xShape(const_castSdrObject*(pSdrObject)-getUnoShape(), uno::UNO_QUERY_THROW);
-uno::Referencelang::XServiceInfo xServiceInfo(xShape, 
uno::UNO_QUERY_THROW);
-uno::Reference beans::XPropertySet  xPropertySet(xShape, uno::UNO_QUERY);
-uno::Reference beans::XPropertySetInfo  xPropSetInfo;
-if (xPropertySet.is())
-xPropSetInfo = xPropertySet-getPropertySetInfo();
-
-bool bLockedCanvas = false;
-if (xPropSetInfo.is()  xPropSetInfo-hasPropertyByName(InteropGrabBag))
+if (m_pImpl-isSupportedDMLShape(xShape))
 {
-uno::Sequence beans::PropertyValue  propList;
-xPropertySet-getPropertyValue(InteropGrabBag) = propList;
-for (sal_Int32 nProp=0; nProp  propList.getLength(); ++nProp)
+sax_fastparser::FSHelperPtr pFS = 

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

2014-03-05 Thread Michael Stahl
 sw/qa/extras/ooxmlimport/data/rhbz988516.docx |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx  |   12 
 sw/source/core/unocore/unotext.cxx|2 ++
 writerfilter/source/ooxml/model.xml   |4 +++-
 4 files changed, 17 insertions(+), 1 deletion(-)

New commits:
commit 2b78f2cd7b9e4bab0f3b3b9119238f36a1bbc7b2
Author: Michael Stahl mst...@redhat.com
Date:   Wed Mar 5 23:29:06 2014 +0100

rhbz#988516: DOCX import: fix context stack when importing header/footer

When a header/footer substream is parsed, a ParagraphGroup is started,
but not ended; so the properties of the last paragraph in the
header/footer are applied to a paragraph in the body.

The obvious fix to add a call to endParagraphGroup() at the end of w:p
element breaks table cells.  So add a call to endParagraphGroup() at
the end of the hdr/ftr element.

(The problem in the bugdoc became much more visible with commit
ca555c596043c88894b964ac5e21f5a7271d5f3b, but was there before)

Change-Id: Ib054f1882793049b39424c1076ba5d4b319cd027

diff --git a/sw/qa/extras/ooxmlimport/data/rhbz988516.docx 
b/sw/qa/extras/ooxmlimport/data/rhbz988516.docx
new file mode 100644
index 000..38e2dcf
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/rhbz988516.docx 
differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 2392899..4f384d8 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -198,6 +198,18 @@ DECLARE_OOXMLIMPORT_TEST(testN757890, n757890.docx)
 CPPUNIT_ASSERT_EQUAL(text::HoriOrientation::CENTER, nValue);
 }
 
+DECLARE_OOXMLIMPORT_TEST(testRhbz988516, rhbz988516.docx)
+{
+// The problem was that the list properties of the footer leaked into body
+CPPUNIT_ASSERT_EQUAL(OUString(),
+getPropertyOUString(getParagraph(1), NumberingStyleName));
+CPPUNIT_ASSERT_EQUAL(OUString(Enclosure 3), 
getParagraph(2)-getString());
+CPPUNIT_ASSERT_EQUAL(OUString(),
+getPropertyOUString(getParagraph(2), NumberingStyleName));
+CPPUNIT_ASSERT_EQUAL(OUString(),
+getPropertyOUString(getParagraph(3), NumberingStyleName));
+}
+
 DECLARE_OOXMLIMPORT_TEST(testFdo49940, fdo49940.docx)
 {
 uno::Referencetext::XTextDocument xTextDocument(mxComponent, 
uno::UNO_QUERY);
diff --git a/writerfilter/source/ooxml/model.xml 
b/writerfilter/source/ooxml/model.xml
index 8739717..70289f5 100644
--- a/writerfilter/source/ooxml/model.xml
+++ b/writerfilter/source/ooxml/model.xml
@@ -24210,7 +24210,9 @@
   element name=headerReference 
tokenid=ooxml:EG_HdrFtrReferences_headerReference/
   element name=footerReference 
tokenid=ooxml:EG_HdrFtrReferences_footerReference/
 /resource
-resource name=CT_HdrFtr resource=Stream tag=header/
+resource name=CT_HdrFtr resource=Stream tag=header
+  action name=end action=endParagraphGroup/
+/resource
 resource name=EG_SectPrContents resource=Properties tag=section
   element name=bidi tokenid=ooxml:EG_SectPrContents_bidi/
   element name=cols tokenid=ooxml:EG_SectPrContents_cols/
commit d3fcaef7dce044b7e053278a7ea972dc957ca7e2
Author: Michael Stahl mst...@redhat.com
Date:   Wed Mar 5 15:01:36 2014 +0100

SwXText::convertToTable(): assert that SwTable is client of table format

... which is wild guessing related to crash in rhbz#1010982.

Change-Id: Ifbd9309a5cff1fff3a8c6022d3a20b2b8c175dce

diff --git a/sw/source/core/unocore/unotext.cxx 
b/sw/source/core/unocore/unotext.cxx
index 88e596b..721dda0 100644
--- a/sw/source/core/unocore/unotext.cxx
+++ b/sw/source/core/unocore/unotext.cxx
@@ -2319,6 +2319,8 @@ throw (lang::IllegalArgumentException, 
uno::RuntimeException, std::exception)
 {
 }
 
+assert(SwTable::FindTable(pTable-GetFrmFmt()) == pTable);
+assert(pTable-GetFrmFmt() == pTextTable-GetFrmFmt());
 return xRet;
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-02-26 Thread Alexander Wilms
 sw/qa/extras/ooxmlexport/data/fdo74566.docx   |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx  |   20 
 sw/source/filter/ww8/docxattributeoutput.cxx  |5 +
 sw/source/filter/ww8/wrtww8.hxx   |2 +-
 sw/source/filter/ww8/ww8atr.cxx   |   17 +
 xmlhelp/source/cxxhelp/provider/databases.cxx |8 
 6 files changed, 35 insertions(+), 17 deletions(-)

New commits:
commit 003342bfef0812454618f860a6e171c282d92d78
Author: Alexander Wilms f.alexander.wi...@gmail.com
Date:   Tue Feb 25 23:14:08 2014 +0100

Remove visual noise from xmlhelp

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

diff --git a/xmlhelp/source/cxxhelp/provider/databases.cxx 
b/xmlhelp/source/cxxhelp/provider/databases.cxx
index df174a4..7b69b85 100644
--- a/xmlhelp/source/cxxhelp/provider/databases.cxx
+++ b/xmlhelp/source/cxxhelp/provider/databases.cxx
@@ -1509,7 +1509,7 @@ helpdatafileproxy::Hdf* DataBaseIterator::nextHdf( 
OUString* o_pExtensionPath, O
 
 // Later:
 //case SHARED_MODULE
-//...
+
 
 case USER_EXTENSIONS:
 {
@@ -1624,7 +1624,7 @@ OUString KeyDataBaseFileIterator::nextDbFile( bool 
o_rbExtension )
 
 // Later:
 //case SHARED_MODULE
-//...
+
 
 case USER_EXTENSIONS:
 {
@@ -1700,7 +1700,7 @@ Reference XHierarchicalNameAccess  
JarFileIterator::nextJarFile
 
 // Later:
 //case SHARED_MODULE
-//...
+
 
 case USER_EXTENSIONS:
 {
@@ -1824,7 +1824,7 @@ OUString IndexFolderIterator::nextIndexFolder( bool 
o_rbExtension, bool o_rbTe
 
 // Later:
 //case SHARED_MODULE
-//...
+
 
 case USER_EXTENSIONS:
 {
commit a31fbb53dba76736b37213b98b64937f05929a67
Author: Pallavi Jadhav pallavi.jad...@synerzip.com
Date:   Thu Feb 6 13:58:03 2014 +0530

fdo#74566:DOCX: Preservation w:br tag for Break to Next Page

Issue :
'Break to Next Page' gets converted to 'Page Break Before'
 in RT.

XML diffrenece :
- LO exports w:br as w:pageBreakBefore / in document.xml
- The page break is written into wrong paragraph.

Implementation :
1] Removed implementation to export w:pageBreakBefore /.
2] Added a check to write w:br in correct paragraph.
3] Modified code to handle SectionBreak() even if Text node
   has no string.
   It is required when DOCX contains a PageBreak with footer.
4] Written Export Unit Test case.

Conflicts:
sw/qa/extras/ooxmlexport/ooxmlexport.cxx
Reviewed on:
https://gerrit.libreoffice.org/7891

Change-Id: I237b9c5fdd3083b441f6e81cd8442f458eccf1a0

diff --git a/sw/qa/extras/ooxmlexport/data/fdo74566.docx 
b/sw/qa/extras/ooxmlexport/data/fdo74566.docx
new file mode 100644
index 000..b197b94
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo74566.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 194b7c6..73d3393 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -3641,6 +3641,26 @@ 
DECLARE_OOXMLEXPORT_TEST(testFooterContainHyperlink,footer-contain-hyperlink.do
 // Check the value of Target which is http://www.google.com/.
 
assertXPath(pXmlRels,/rels:Relationships/rels:Relationship,Target,http://www.google.com/;);
 }
+
+DECLARE_OOXMLEXPORT_TEST(testPageBreak,fdo74566.docx)
+{
+/*  Break to next page was written into wrong paragraph as 
w:pageBreakBefore /.
+ *  LO was not preserving Page Break as w:br w:type=page /.
+ *  Now after fix , LO writes Page Break as the new paragraph and also
+ *  preserves the xml tag w:br.
+ */
+xmlDocPtr pXmlDoc = parseExport(word/document.xml);
+if (!pXmlDoc)
+return;
+
+uno::Referencetext::XTextRange xParagraph2 = getParagraph(2);
+uno::Referencetext::XTextRange xParagraph4 = getParagraph(4);
+
+getRun(xParagraph2, 1, First Page Second Line);
+assertXPath(pXmlDoc, 
/w:document/w:body/w:p[3]/w:r[2]/w:br,type,page);
+getRun(xParagraph4, 1, Second Page First line after Page Break);
+}
+
 #endif
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index b27aadc..46258f9 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -399,10 +399,7 @@ void DocxAttributeOutput::SectionBreaks(const SwTxtNode 
rNode)
 if ( aNextIndex.GetNode().IsTxtNode() )
 {
 const SwTxtNode* pTxtNode = static_cast 

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

2014-02-26 Thread Jacobo Aragunde Pérez
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx |2 -
 sw/source/filter/ww8/docxattributeoutput.cxx |   49 ---
 sw/source/filter/ww8/docxexport.cxx  |   16 +++-
 sw/source/filter/ww8/docxexport.hxx  |2 -
 writerfilter/source/dmapper/OLEHandler.cxx   |   45 
 writerfilter/source/dmapper/OLEHandler.hxx   |4 ++
 6 files changed, 102 insertions(+), 16 deletions(-)

New commits:
commit 1c993627d893c62ab8f01355895206374bf4eb6c
Author: Jacobo Aragunde Pérez jaragu...@igalia.com
Date:   Wed Feb 26 18:29:44 2014 +0100

sw: write other types of embeddings properly to docx

Improves patch 1428ec6f4e2bfe0d8654a9ccc713e274e08c6423

When embedding an object into a docx, several things interact:

* The properties in the o:OLEObject tag in document.xml
* The ContentType for the file defined in [Content_Types].xml
* The Type of the Relationship defined in document.xml.rels

You need the right combination of those three elements for Word to
properly recognize the embeddings in exported documents.

To know which values must be written, I store some interoperability
information in the import phase in the document grab bag. The
relevant information is the value of the ProgID attribute in the
o:OLEObject tag.

I have defined three cases depending on the value of ProgID, but more
could be needed in the future:
* Embedded xlsx sheet.
* Embedded pptx presentation.
* Generic OLE, this should work with embedded odt/ods in combination
  with the ProgID attribute stored in the import phase.

Change-Id: I26336cb3fe47bd33e1cef11dd1c7edcf390f2e56

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 675a012..12e5992 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -2579,7 +2579,7 @@ DECLARE_OOXMLEXPORT_TEST(testEmbeddedXlsx, 
embedded-xlsx.docx)
 int nImageFiles = 0;
 for (int i=0; inames.getLength(); i++)
 {
-if(names[i].startsWith(word/embeddings/Microsoft_Excel_Worksheet))
+if(names[i].startsWith(word/embeddings/oleObject))
 nSheetFiles++;
 if(names[i].startsWith(word/media/image))
 nImageFiles++;
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 362c1c8..1b91a13 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -3568,12 +3568,53 @@ void DocxAttributeOutput::WritePostponedOLE()
 
 SAL_INFO( sw.ww8, OSL_THIS_FUNC );
 
+// get interoperability information about embedded objects
+uno::Reference beans::XPropertySet  xPropSet( 
m_rExport.pDoc-GetDocShell()-GetBaseModel(), uno::UNO_QUERY_THROW );
+OUString pName = UNO_NAME_MISC_OBJ_INTEROPGRABBAG;
+uno::Sequence beans::PropertyValue  aGrabBag, aObjectsInteropList;
+xPropSet-getPropertyValue( pName ) = aGrabBag;
+for( sal_Int32 i=0; i  aGrabBag.getLength(); ++i )
+if ( aGrabBag[i].Name == EmbeddedObjects )
+{
+aGrabBag[i].Value = aObjectsInteropList;
+break;
+}
+
 for( std::list PostponedOLE ::iterator it = m_postponedOLE-begin();
  it != m_postponedOLE-end();
  ++it )
 {
+SwOLEObj aObject = it-object-GetOLEObj();
+uno::Reference  embed::XEmbeddedObject  xObj( aObject.GetOleRef() );
+comphelper::EmbeddedObjectContainer* aContainer = 
aObject.GetObject().GetContainer();
+OUString sObjectName = aContainer-GetEmbeddedObjectName( xObj );
+
+// set some attributes according to the type of the embedded object
+OUString sProgID, sMediaType, sRelationType;
+for( sal_Int32 i=0; i  aObjectsInteropList.getLength(); ++i )
+if ( aObjectsInteropList[i].Name == sObjectName )
+{
+aObjectsInteropList[i].Value = sProgID;
+break;
+}
+if( sProgID.startsWith(Excel.Sheet) )
+{
+sMediaType = 
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;
+sRelationType = 
http://schemas.openxmlformats.org/officeDocument/2006/relationships/package;;
+}
+else if( sProgID.startsWith(PowerPoint.Show) )
+{
+sMediaType = 
application/vnd.openxmlformats-officedocument.presentationml.presentation;
+sRelationType = 
http://schemas.openxmlformats.org/officeDocument/2006/relationships/package;;
+}
+else
+{
+sMediaType = 
application/vnd.openxmlformats-officedocument.oleObject;
+sRelationType = 
http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject;;
+}
+
 // write embedded file
-OString sId = m_rExport.WriteOLENode( *it-object );
+OString sId = 

  1   2   >