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

2023-07-31 Thread Khaled Hosny (via logerrit)
 editeng/source/editeng/impedit2.cxx  |3 +--
 sw/qa/core/text/data/scriptinfo-surrogate-pairs.fodt |1 +
 sw/qa/core/text/text.cxx |   13 +++--
 sw/source/core/text/porlay.cxx   |2 +-
 4 files changed, 14 insertions(+), 5 deletions(-)

New commits:
commit 5526c523bc9fda890e15eacd45f280b0827f8ea0
Author: Khaled Hosny 
AuthorDate: Sat Jul 29 01:01:58 2023 +0300
Commit: Michael Stahl 
CommitDate: Mon Jul 31 12:32:17 2023 +0200

Fix surrogate pairs handling when tweaking script info

Followup to:

commit 3af30bafbedb8eb481024efb35cb7876c63d26dc
Author: Khaled Hosny 
Date:   Thu Jul 27 19:03:28 2023 +0300

sw: Handle surrogate pairs when tweaking script info

and:

commit d6efe8c302b81886706e18640148c51cf7883bbf
Author: Khaled Hosny 
Date:   Thu Jul 27 20:39:22 2023 +0300

tdf#112594: Group NNBSP with the Mongolian characters after it

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

diff --git a/editeng/source/editeng/impedit2.cxx 
b/editeng/source/editeng/impedit2.cxx
index d67c49b072b8..8d4960069cc8 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -1742,8 +1742,7 @@ void ImpEditEngine::InitScriptTypes( sal_Int32 nPara )
 (nPrevChar == 0x202F /* NNBSP, tdf#112594 */ &&
  u_getIntPropertyValue(nChar, UCHAR_SCRIPT) == 
USCRIPT_MONGOLIAN))
 {
---nPos;
-rTypes.back().nEndPos--;
+rTypes.back().nEndPos = nPos = nPrevPos;
 break;
 }
 }
diff --git a/sw/qa/core/text/data/scriptinfo-surrogate-pairs.fodt 
b/sw/qa/core/text/data/scriptinfo-surrogate-pairs.fodt
index c14997a80741..5b54fc9e8601 100644
--- a/sw/qa/core/text/data/scriptinfo-surrogate-pairs.fodt
+++ b/sw/qa/core/text/data/scriptinfo-surrogate-pairs.fodt
@@ -287,6 +287,7 @@
 

11◌໽
+   11퐀َ
   
  
 
\ No newline at end of file
diff --git a/sw/qa/core/text/text.cxx b/sw/qa/core/text/text.cxx
index 9d9e99f8d99b..123be460df8c 100644
--- a/sw/qa/core/text/text.cxx
+++ b/sw/qa/core/text/text.cxx
@@ -1475,9 +1475,18 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, 
testScriptinfosurrogatePairs)
 // Without the fix it fails with:
 // - Expected: 11
 // - Actual  : 11◌
-assertXPath(pXmlDoc, "//SwParaPortion/SwLineLayout/SwLinePortion[1]", 
"portion", u"11");
-assertXPath(pXmlDoc, "//SwParaPortion/SwLineLayout/SwLinePortion[2]", 
"portion",
+assertXPath(pXmlDoc, 
"//txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]", "portion", u"11");
+assertXPath(pXmlDoc, 
"//txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]", "portion",
 u"\u25CC\U00010EFD");
+
+// Without the fix this would crash because we got a lone surrogate that
+// can’t be converted to UTF-8, but if it were not for that it might fail
+// with something like:
+// - Expected: 11
+// - Actual  : 11퐀
+assertXPath(pXmlDoc, 
"//txt[2]/SwParaPortion/SwLineLayout/SwLinePortion[1]", "portion", u"11");
+assertXPath(pXmlDoc, 
"//txt[2]/SwParaPortion/SwLineLayout/SwLinePortion[2]", "portion",
+u"\U0001D400\u064E");
 }
 
 CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testTdf112594)
diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx
index 7d406a86df0c..567026d5b77a 100644
--- a/sw/source/core/text/porlay.cxx
+++ b/sw/source/core/text/porlay.cxx
@@ -1457,7 +1457,7 @@ void SwScriptInfo::InitScriptInfo(const SwTextNode& rNode,
 (nPrevChar == CHAR_NNBSP &&
  u_getIntPropertyValue(nChar, UCHAR_SCRIPT) == 
USCRIPT_MONGOLIAN))
 {
---nPos;
+nPos = nPrevPos;
 }
 }
 m_ScriptChanges.emplace_back(TextFrameIndex(nPos), nScript);


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

2023-06-23 Thread Khaled Hosny (via logerrit)
 editeng/source/editeng/impedit3.cxx |6 --
 sw/qa/core/text/data/tdf129810.odt  |binary
 sw/qa/core/text/text.cxx|   33 +
 sw/source/core/text/porlay.cxx  |3 +++
 4 files changed, 40 insertions(+), 2 deletions(-)

New commits:
commit 4a92323b54e7d63a8bc0b8e62fdc6b31760dcd05
Author: Khaled Hosny 
AuthorDate: Fri Jun 23 19:10:49 2023 +0300
Commit: خالد حسني 
CommitDate: Sat Jun 24 01:01:18 2023 +0200

tdf#129810: Compress fullwidth CJK punctuation

When compressions CJK punctuation, compress also full width versions to
match Word behaviour.

Change-Id: Ic35cfcbacca1974b7241d657f078148bac06478e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153530
Tested-by: Jenkins
Reviewed-by: خالد حسني 

diff --git a/editeng/source/editeng/impedit3.cxx 
b/editeng/source/editeng/impedit3.cxx
index 7a82359e8851..510ab1624319 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -142,14 +142,16 @@ AsianCompressionFlags GetCharTypeForCompression( 
sal_Unicode cChar )
 {
 case 0x3008: case 0x300A: case 0x300C: case 0x300E:
 case 0x3010: case 0x3014: case 0x3016: case 0x3018:
-case 0x301A: case 0x301D:
+case 0x301A: case 0x301D: case 0xFF09: case 0xFF3D:
+case 0xFF5D:
 {
 return AsianCompressionFlags::PunctuationRight;
 }
 case 0x3001: case 0x3002: case 0x3009: case 0x300B:
 case 0x300D: case 0x300F: case 0x3011: case 0x3015:
 case 0x3017: case 0x3019: case 0x301B: case 0x301E:
-case 0x301F:
+case 0x301F: case 0xFF08: case 0xFF0C: case 0xFF0E:
+case 0xFF1A: case 0xFF1B: case 0xFF3B: case 0xFF5B:
 {
 return AsianCompressionFlags::PunctuationLeft;
 }
diff --git a/sw/qa/core/text/data/tdf129810.odt 
b/sw/qa/core/text/data/tdf129810.odt
new file mode 100644
index ..b5a482b52caf
Binary files /dev/null and b/sw/qa/core/text/data/tdf129810.odt differ
diff --git a/sw/qa/core/text/text.cxx b/sw/qa/core/text/text.cxx
index 96ffbf4e74a3..0997d64725b8 100644
--- a/sw/qa/core/text/text.cxx
+++ b/sw/qa/core/text/text.cxx
@@ -18,6 +18,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1424,6 +1425,38 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, 
testParaUpperMarginFlyIntersect)
 CPPUNIT_ASSERT_EQUAL(521, nHeight);
 }
 
+CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testTdf129810)
+{
+// Load the document, which embeds a CJK font.
+createSwDoc("tdf129810.odt");
+
+// Render the document to a metafile.
+SwXTextDocument* pTextDoc = 
dynamic_cast(mxComponent.get());
+SwDocShell* pShell = pTextDoc->GetDocShell();
+std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile();
+CPPUNIT_ASSERT(xMetaFile);
+
+// Find the fist text array action
+for (size_t nAction = 0; nAction < xMetaFile->GetActionSize(); nAction++)
+{
+auto pAction = xMetaFile->GetAction(nAction);
+if (pAction->GetType() == MetaActionType::TEXTARRAY)
+{
+auto pTextArrayAction = static_cast(pAction);
+auto pDXArray = pTextArrayAction->GetDXArray();
+
+// There should be 13 chars on the first line
+CPPUNIT_ASSERT_GREATER(size_t(13), pDXArray.size());
+
+// Assert we are using the expected width for uncompressed chars
+CPPUNIT_ASSERT_EQUAL(sal_Int32(720), pDXArray[0]);
+// Assert we are using the expected width for compressed chars
+CPPUNIT_ASSERT_EQUAL(sal_Int32(500), pDXArray[6] - pDXArray[5]);
+break;
+}
+}
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx
index 14ac23395dcf..4f15fbcccbf7 100644
--- a/sw/source/core/text/porlay.cxx
+++ b/sw/source/core/text/porlay.cxx
@@ -1481,6 +1481,7 @@ void SwScriptInfo::InitScriptInfo(const SwTextNode& rNode,
 case 0x3008: case 0x300A: case 0x300C: case 0x300E:
 case 0x3010: case 0x3014: case 0x3016: case 0x3018:
 case 0x301A: case 0x301D:
+case 0xFF08: case 0xFF3B: case 0xFF5B:
 eState = SPECIAL_LEFT;
 break;
 // Right punctuation found
@@ -1488,9 +1489,11 @@ void SwScriptInfo::InitScriptInfo(const SwTextNode& 
rNode,
 case 0x300D: case 0x300F: case 0x3011: case 0x3015:
 case 0x3017: case 0x3019: case 0x301B: case 0x301E:
 case 0x301F:
+case 0xFF09: case 0xFF3D: case 0xFF5D:
 eState = SPECIAL_RIGHT;
 break;
 case 0x3001: case 0x3002:   // Fullstop or comma
+case 0xFF0C: case 0xFF0E: case 0xFF1A: case 0xFF1B:
 eState = SPECIAL_MIDDLE ;
 break;
 

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

2022-08-11 Thread Michael Stahl (via logerrit)
 editeng/source/items/frmitems.cxx  |3 +
 sw/qa/extras/odfexport/odfexport.cxx   |2 
 sw/qa/extras/rtfexport/data/tdf129631_lostBorders3.rtf |   27 +
 sw/qa/extras/rtfexport/rtfexport4.cxx  |   51 +
 sw/source/filter/ww8/rtfattributeoutput.cxx|   20 --
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |   15 +
 6 files changed, 110 insertions(+), 8 deletions(-)

New commits:
commit eca3ce35fe9a346965a32f42d02cb6d3f5a3982f
Author: Michael Stahl 
AuthorDate: Wed Aug 10 14:04:44 2022 +0200
Commit: Michael Stahl 
CommitDate: Thu Aug 11 19:07:57 2022 +0200

tdf#129631 writerfilter,sw: RTF import of invalid border...

... and export of border on paragraph that clears the border from the
paragraph style.

The import problem is that a lone \brdrcf17 without any preceding
keyword about which border it belongs to (as required by the EBNF in the
RTF spec) is apparently handled by Word as overriding/clearing all
paragraph borders that may be inherited from the paragraph style.

The export problem is that a null SvxBorderLine isn't exported at all,
but there needs to be a \brdrnone to override the definition from the
style.

There was also an API problem that the null SvxBorderLine is wrongly
converted to a table::BorderLine2 with LineStyle SOLID.

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

diff --git a/editeng/source/items/frmitems.cxx 
b/editeng/source/items/frmitems.cxx
index c4c79dc0428b..35e1be7b094c 100644
--- a/editeng/source/items/frmitems.cxx
+++ b/editeng/source/items/frmitems.cxx
@@ -1387,7 +1387,10 @@ table::BorderLine2 SvxBoxItem::SvxLineToLine(const 
SvxBorderLine* pLine, bool bC
 aLine.LineWidth  = sal_uInt32( bConvert ? convertTwipToMm100( 
pLine->GetWidth( ) ) : pLine->GetWidth( ) );
 }
 else
+{
 aLine.Color  = aLine.InnerLineWidth = aLine.OuterLineWidth = 
aLine.LineDistance  = 0;
+aLine.LineStyle = table::BorderLineStyle::NONE; // 0 is SOLID!
+}
 return aLine;
 }
 
diff --git a/sw/qa/extras/odfexport/odfexport.cxx 
b/sw/qa/extras/odfexport/odfexport.cxx
index 25110963896e..ad65d884437b 100644
--- a/sw/qa/extras/odfexport/odfexport.cxx
+++ b/sw/qa/extras/odfexport/odfexport.cxx
@@ -,7 +,7 @@ DECLARE_ODFEXPORT_TEST(testCharacterBorder, 
"charborder.odt")
 table::BorderLine2(0xFF,0,37,0,14,37), // Top (fine dashed 
line)
 table::BorderLine2(0x99FF66,26,26,53,11,106),  // Bottom
 table::BorderLine2(0xFF,9,26,9,12,71), // Left
-table::BorderLine2(0,0,0,0,0,0)// Right
+table::BorderLine2(0,0,0,0,table::BorderLineStyle::NONE,0) // Right
 };
 
 sal_Int32 aDistances[4] = { 400 /*Top*/, 300 /*Bottom*/, 250 /*Left*/, 
0 /*Right*/ };
diff --git a/sw/qa/extras/rtfexport/data/tdf129631_lostBorders3.rtf 
b/sw/qa/extras/rtfexport/data/tdf129631_lostBorders3.rtf
new file mode 100644
index ..dba7db7dc8e5
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/tdf129631_lostBorders3.rtf
@@ -0,0 +1,27 @@
+{\rtf1\ansi\deff4\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\froman\fprq0\fcharset0 Times New Roman;}{\f5\fnil\fprq2\fcharset0 
DejaVu Sans;}}
+{\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;\red6\green154\blue46;}
+{\stylesheet{\s0\snext0\dbch\af5\langfe2052\dbch\af4\afs24\alang1025\ql\widctlpar\ltrpar\hyphpar0\aspalpha\cf0\loch\f3\fs24\lang255\kerning1
 Normal;}
+{\*\cs15\snext15 CharShadow;}
+{\*\cs16\sbasedon15\snext16 CharShadow-removed;}
+{\s17\sbasedon0\snext18\dbch\af5\langfe2052\dbch\af4\afs28\alang1025\ql\widctlpar\sb240\sa120\keepn\ltrpar\cf0\loch\f4\fs28\lang255\kerning1
 Heading;}
+{\s18\sbasedon0\snext18\dbch\af5\langfe2052\dbch\af4\afs24\alang1025\sl276\slmult1\ql\widctlpar\sb0\sa140\ltrpar\cf0\loch\f3\fs24\lang255\kerning1
 Text Body;}
+{\s19\sbasedon18\snext19\dbch\af5\langfe2052\dbch\af4\afs24\alang1025\sl276\slmult1\ql\widctlpar\sb0\sa140\ltrpar\cf0\loch\f4\fs24\lang255\kerning1
 List;}
+{\s20\sbasedon0\snext20\dbch\af5\langfe2052\dbch\af4\afs24\alang1025\ai\ql\widctlpar\sb120\sa120\noline\ltrpar\cf0\loch\f4\fs24\lang255\i\kerning1
 Caption;}

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

2022-04-27 Thread Andrea Gelmini (via logerrit)
 editeng/source/rtf/rtfitem.cxx   |2 +-
 sw/qa/extras/uiwriter/uiwriter3.cxx  |2 +-
 sw/source/uibase/dochdl/swdtflvr.cxx |2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

New commits:
commit a58701650c2dd7ad8514752d571aa2569690fe37
Author: Andrea Gelmini 
AuthorDate: Wed Apr 27 16:46:55 2022 +0200
Commit: Julien Nabet 
CommitDate: Wed Apr 27 19:42:03 2022 +0200

Fix typos

Change-Id: I04c9c441a7e93cd998e99e4ede7d9894e14c364e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133519
Tested-by: Julien Nabet 
Reviewed-by: Julien Nabet 

diff --git a/editeng/source/rtf/rtfitem.cxx b/editeng/source/rtf/rtfitem.cxx
index bd75fe465567..1434657f7fdc 100644
--- a/editeng/source/rtf/rtfitem.cxx
+++ b/editeng/source/rtf/rtfitem.cxx
@@ -1114,7 +1114,7 @@ ATTR_SETEMPHASIS:
 }
 break;
 
-// We expect these to be preceeded by a RTF_HYPHEN and
+// We expect these to be preceded by a RTF_HYPHEN and
 // so normally are handled by the RTF_HYPHEN case, but
 // if they appear 'bare' in a document then safely skip
 // them here
diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx 
b/sw/qa/extras/uiwriter/uiwriter3.cxx
index 0d06474d1c6d..91b16d045868 100644
--- a/sw/qa/extras/uiwriter/uiwriter3.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter3.cxx
@@ -2647,7 +2647,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf148791)
 Scheduler::ProcessEventsToIdle();
 
 xmlDocUniquePtr pXmlDoc = parseLayoutDump();
-// Paste as Rows Above results 4-row table with default table aligment
+// Paste as Rows Above results 4-row table with default table alignment
 assertXPath(pXmlDoc, "/root/page[1]/body/tab/row", 4);
 assertXPath(pXmlDoc, "/root/page[1]/body/tab/row[1]/cell[1]/txt/Text", 
"Portion", "hello");
 assertXPath(pXmlDoc, "/root/page[1]/body/tab/row[3]/cell[1]/txt/Text", 
"Portion", "hello");
diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx 
b/sw/source/uibase/dochdl/swdtflvr.cxx
index a6e0060978be..43cd6bba9717 100644
--- a/sw/source/uibase/dochdl/swdtflvr.cxx
+++ b/sw/source/uibase/dochdl/swdtflvr.cxx
@@ -1580,7 +1580,7 @@ bool SwTransferable::Paste(SwWrtShell& rSh, 
TransferableDataHelper& rData, RndSt
 sal_Int32 nTableLevel = lcl_getLevel(aExpand, nIdx);
 // table rows repeated heading use extra indentation, too:
 //  is always used here, and the first table with  
is not nested,
-// if its indentation level is greater only by 1, than intentation 
level of the table
+// if its indentation level is greater only by 1, than indentation 
level of the table
 bool bShifted = lcl_getLevel(aExpand, aExpand.indexOf("

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

2021-03-01 Thread Miklos Vajna (via logerrit)
 editeng/source/items/frmitems.cxx|2 -
 sw/qa/core/layout/layout.cxx |   30 +++
 sw/source/core/layout/paintfrm.cxx   |   27 
 sw/source/filter/ww8/docxattributeoutput.cxx |9 
 writerfilter/source/dmapper/PropertyMap.cxx  |   26 ---
 writerfilter/source/dmapper/PropertyMap.hxx  |3 +-
 6 files changed, 65 insertions(+), 32 deletions(-)

New commits:
commit ebceee31d92f04b58e795d02a26f62b717c47737
Author: Miklos Vajna 
AuthorDate: Mon Mar 1 10:37:49 2021 +0100
Commit: Miklos Vajna 
CommitDate: Mon Mar 1 20:56:03 2021 +0100

tdf#140342 sw layout: remove explicit gutter handling when positioning 
borders

Word has two modes the specify border positions: the distance can be
measured from the edge of the page or from text. Similar to how
documents that have page borders but no gutter, page page border +
gutter documents should be always measured "from text" by the layout.

"From page" should be a concern for Word filters.

"From page" was already working -- fix "from text" by changing the
layout to do "from text" and then extending DOCX import/export to handle
gutter while handling the "from page" page borders.

This also requires allowing nominally negative top margins, because we
want to have the gutter unchanged, but the border might want to be on
the gutter area, which is only possible with a negative top margin.

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

diff --git a/editeng/source/items/frmitems.cxx 
b/editeng/source/items/frmitems.cxx
index 45cd825eab54..d010089b3052 100644
--- a/editeng/source/items/frmitems.cxx
+++ b/editeng/source/items/frmitems.cxx
@@ -725,7 +725,7 @@ bool SvxULSpaceItem::PutValue( const uno::Any& rVal, 
sal_uInt8 nMemberId )
 }
 break;
 case MID_UP_MARGIN :
-if(!(rVal >>= nVal) || nVal < 0)
+if(!(rVal >>= nVal))
 return false;
 SetUpper(static_cast(bConvert ? 
convertMm100ToTwip(nVal) : nVal));
 break;
diff --git a/sw/qa/core/layout/layout.cxx b/sw/qa/core/layout/layout.cxx
index a9a738f26e1d..7cd052725639 100644
--- a/sw/qa/core/layout/layout.cxx
+++ b/sw/qa/core/layout/layout.cxx
@@ -357,6 +357,36 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, 
testGutterMirrorMargin)
 CPPUNIT_ASSERT_EQUAL(nGutterTwips, nOldRight - nNewRight);
 }
 
+CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testGutterMarginPageBorder)
+{
+// FIXME this is 3369 on macOS -- calculate this number dynamically?
+#if !defined(MACOSX)
+// Given a document with a non-0 gutter margin.
+SwDoc* pDoc = createSwDoc();
+uno::Reference 
xStandard(getStyles("PageStyles")->getByName("Standard"),
+  uno::UNO_QUERY);
+sal_Int32 nGutterMm100 = 2000;
+xStandard->setPropertyValue("GutterMargin", uno::makeAny(nGutterMm100));
+
+// When setting a left border.
+table::BorderLine2 aBorder;
+aBorder.LineWidth = 2;
+aBorder.OuterLineWidth = 2;
+xStandard->setPropertyValue("LeftBorder", uno::makeAny(aBorder));
+
+// Then make sure border is at the left edge of the text area.
+SwDocShell* pShell = pDoc->GetDocShell();
+std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile();
+MetafileXmlDump dumper;
+xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: 2565
+// - Actual  : 1425
+// Where 2565 is close to the left edge of the text area (2553).
+assertXPath(pXmlDoc, "//polyline[@style='solid']/point[1]", "x", "2565");
+#endif
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/layout/paintfrm.cxx 
b/sw/source/core/layout/paintfrm.cxx
index ef69c5ff81ba..b3c940b87cea 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -1289,33 +1289,6 @@ static void lcl_CalcBorderRect( SwRect , const 
SwFrame *pFrame,
 
 SwRectFn fnRect = pFrame->IsVertical() ? ( pFrame->IsVertLR() ? 
(pFrame->IsVertLRBT() ? fnRectVertL2RB2T : fnRectVertL2R) : fnRectVert ) : 
fnRectHori;
 
-if (pFrame->IsPageFrame() && rAttrs.GetLRSpace())
-{
-tools::Long nGutterMargin = rAttrs.GetLRSpace()->GetGutterMargin();
-tools::Long nRightGutterMargin = 
rAttrs.GetLRSpace()->GetRightGutterMargin();
-const auto pPageFrame = static_cast(pFrame);
-bool bGutterAtTop = 
pPageFrame->GetFormat()->getIDocumentSettingAccess().get(
-DocumentSettingId::GUTTER_AT_TOP);
-if (bGutterAtTop)
-{
-// Paint the top border based on the top 

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

2020-01-03 Thread Justin Luth (via logerrit)
 editeng/source/items/frmitems.cxx |2 
 sw/qa/extras/ooxmlexport/data/tdf129522_removeShadowStyle.odt |binary
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx|   23 ++
 sw/qa/extras/ww8export/data/tdf129522_removeShadowStyle.odt   |binary
 sw/qa/extras/ww8export/ww8export3.cxx |   23 ++
 sw/source/filter/ww8/ww8par6.cxx  |8 ++-
 writerfilter/source/dmapper/DomainMapper.cxx  |8 ++-
 7 files changed, 58 insertions(+), 6 deletions(-)

New commits:
commit 4ca73073a0d7c62b12a7354f76f8f80adc5d98c1
Author: Justin Luth 
AuthorDate: Sat Dec 21 16:10:03 2019 +0300
Commit: Miklos Vajna 
CommitDate: Fri Jan 3 12:13:12 2020 +0100

tdf#129522 SvxShadowItem/writerfilter: allow shadow_NONE overrides

Both editeng and writerfilter were ignoring the case where NONE
should override an inherited shadow location. Of course,
this situation is very rare. Nearly all unit tests ran when
asserting that eLocation is already NONE.

The same is true for DOC, except that it is not affected by
SvxShadowItem's PutValue problem (and neither is ODT).

RTF is not even removing the borderlines themselves,
so no point in worrying about the shadow for RTF.

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

diff --git a/editeng/source/items/frmitems.cxx 
b/editeng/source/items/frmitems.cxx
index 718e87ee2e37..643f8b1db471 100644
--- a/editeng/source/items/frmitems.cxx
+++ b/editeng/source/items/frmitems.cxx
@@ -1093,9 +1093,9 @@ bool SvxShadowItem::PutValue( const uno::Any& rVal, 
sal_uInt8 nMemberId )
 
 if ( bRet )
 {
-//  SvxShadowLocation eSet = SvxShadowLocation::NONE;
 switch( aShadow.Location )
 {
+case table::ShadowLocation_NONE: eLocation = 
SvxShadowLocation::NONE; break;
 case table::ShadowLocation_TOP_LEFT: eLocation = 
SvxShadowLocation::TopLeft; break;
 case table::ShadowLocation_TOP_RIGHT   : eLocation = 
SvxShadowLocation::TopRight; break;
 case table::ShadowLocation_BOTTOM_LEFT : eLocation = 
SvxShadowLocation::BottomLeft ; break;
diff --git a/sw/qa/extras/ooxmlexport/data/tdf129522_removeShadowStyle.odt 
b/sw/qa/extras/ooxmlexport/data/tdf129522_removeShadowStyle.odt
new file mode 100644
index ..7ced9fc647c4
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf129522_removeShadowStyle.odt differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index fb93572bf725..216cdec15c3c 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -15,6 +15,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -79,6 +80,28 @@ DECLARE_OOXMLEXPORT_TEST(testTdf108350_noFontdefaults, 
"tdf108350_noFontdefaults
 //CPPUNIT_ASSERT_EQUAL_MESSAGE("Font size", 10.f, 
getProperty(xStyleProps, "CharHeight"));
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf129522_removeShadowStyle, 
"tdf129522_removeShadowStyle.odt")
+{
+uno::Reference< container::XNameAccess > paragraphStyles = 
getStyles("ParagraphStyles");
+uno::Reference< beans::XPropertySet > 
xStyleProps(paragraphStyles->getByName("Shadow"), uno::UNO_QUERY_THROW);
+table::ShadowFormat aShadow = 
getProperty(xStyleProps, "ParaShadowFormat");
+CPPUNIT_ASSERT_EQUAL(table::ShadowLocation_BOTTOM_RIGHT, aShadow.Location);
+
+// Shadows were inherited regardless of whether the style disabled them.
+xStyleProps.set(paragraphStyles->getByName("Shadow-removed"), 
uno::UNO_QUERY_THROW);
+aShadow = getProperty(xStyleProps, 
"ParaShadowFormat");
+CPPUNIT_ASSERT_EQUAL(table::ShadowLocation_NONE, aShadow.Location);
+
+uno::Reference< container::XNameAccess > characterStyles = 
getStyles("CharacterStyles");
+xStyleProps.set(characterStyles->getByName("CharShadow"), 
uno::UNO_QUERY_THROW);
+aShadow = getProperty(xStyleProps, 
"CharShadowFormat");
+CPPUNIT_ASSERT_EQUAL(table::ShadowLocation_BOTTOM_RIGHT, aShadow.Location);
+
+xStyleProps.set(characterStyles->getByName("CharShadow-removed"), 
uno::UNO_QUERY_THROW);
+aShadow = getProperty(xStyleProps, 
"CharShadowFormat");
+//CPPUNIT_ASSERT_EQUAL(table::ShadowLocation_NONE, aShadow.Location);
+}
+
 DECLARE_OOXMLIMPORT_TEST(testTdf125038, "tdf125038.docx")
 {
 OUString aActual = getParagraph(1)->getString();
diff --git a/sw/qa/extras/ww8export/data/tdf129522_removeShadowStyle.odt 
b/sw/qa/extras/ww8export/data/tdf129522_removeShadowStyle.odt
new file mode 100644
index ..7ced9fc647c4
Binary files /dev/null and 
b/sw/qa/extras/ww8export/data/tdf129522_removeShadowStyle.odt differ
diff --git 

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

2018-03-17 Thread Mike Kaganski
 editeng/source/items/frmitems.cxx |8 +-
 sw/qa/extras/ooxmlexport/data/tdf112118.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport11.cxx|   72 ++
 sw/qa/extras/ww8export/data/tdf112118.doc |binary
 sw/qa/extras/ww8export/ww8export2.cxx |   68 
 sw/source/core/tox/ToxTabStopTokenHandler.cxx |4 -
 sw/source/filter/ww8/docxattributeoutput.cxx  |4 -
 sw/source/filter/ww8/ww8atr.cxx   |4 -
 sw/source/filter/ww8/ww8par6.cxx  |2 
 9 files changed, 108 insertions(+), 54 deletions(-)

New commits:
commit 45f1b733e0f736f4db677ba1fd17695ac1009c9f
Author: Mike Kaganski 
Date:   Sat Mar 17 23:49:37 2018 +0300

tdf#112118: use correct border when calculating margin

This is a longstanding (at least since 2000: already present in commit
7b0b5cdf) error where left border linespace was used when calculating
right margin. It was copypasted from ww8 import to ooxml code verbatim.
The problem only manifests itself when left and right border spacings
are not the same; and since we had other errors in the borders import,
that additional problem simply wasn't apparent.

Also use scaled border width in border distance/margin calculations.

Unit tests updated.

Change-Id: I70961e1bde29471def69e1ef944ba2779cffe307
Reviewed-on: https://gerrit.libreoffice.org/51474
Tested-by: Jenkins 
Reviewed-by: Mike Kaganski 

diff --git a/editeng/source/items/frmitems.cxx 
b/editeng/source/items/frmitems.cxx
index 6b60d5a4ffaa..7339035a6500 100644
--- a/editeng/source/items/frmitems.cxx
+++ b/editeng/source/items/frmitems.cxx
@@ -2661,10 +2661,10 @@ void BorderDistancesToWord(const SvxBoxItem& rBox, 
const WordPageMargins& rMargi
 const SvxBorderLine* pLnR = rBox.GetLine(SvxBoxItemLine::RIGHT);
 
 // We need to take border widths into account
-const long nWidthT = pLnT ? pLnT->GetWidth() : 0;
-const long nWidthL = pLnL ? pLnL->GetWidth() : 0;
-const long nWidthB = pLnB ? pLnB->GetWidth() : 0;
-const long nWidthR = pLnR ? pLnR->GetWidth() : 0;
+const long nWidthT = pLnT ? pLnT->GetScaledWidth() : 0;
+const long nWidthL = pLnL ? pLnL->GetScaledWidth() : 0;
+const long nWidthB = pLnB ? pLnB->GetScaledWidth() : 0;
+const long nWidthR = pLnR ? pLnR->GetScaledWidth() : 0;
 
 // Resulting distances from text to borders
 const sal_Int32 nT2BT = pLnT ? nT : 0;
diff --git a/sw/qa/extras/ooxmlexport/data/tdf112118.docx 
b/sw/qa/extras/ooxmlexport/data/tdf112118.docx
index dc3e14ae82c7..3ddb06839492 100644
Binary files a/sw/qa/extras/ooxmlexport/data/tdf112118.docx and 
b/sw/qa/extras/ooxmlexport/data/tdf112118.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index ba89b63b2f6e..5990e635394a 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -283,33 +283,63 @@ DECLARE_OOXMLEXPORT_TEST(testTdf107035, "tdf107035.docx")
 
 DECLARE_OOXMLEXPORT_TEST(testTdf112118_DOCX, "tdf112118.docx")
 {
+// The resulting left margin width (2081) differs from its DOC counterpart 
from ww8export2.cxx,
+// because DOCX import does two conversions between mm/100 and twips on 
the route, loosing one
+// twip on the road and arriving with a value that is 2 mm/100 less. I 
don't see an obvious way
+// to avoid that.
+struct {
+const char* styleName;
+struct {
+const char* sideName;
+sal_Int32 nMargin;
+sal_Int32 nBorderDistance;
+sal_Int32 nBorderWidth;
+} sideParams[4];
+} styleParams[] = {  // Margin (MS-style), border 
distance, border width
+{
+"Standard",
+{
+{ "Top", 496, 847, 159 },//  851 twip, 24 pt (from text), 
4.5 pt
+{ "Left", 2081, 706, 212 },  // 1701 twip, 20 pt (from text), 
6.0 pt
+{ "Bottom", 1401, 564, 35 }, // 1134 twip, 16 pt (from text), 
1.0 pt
+{ "Right", 3471, 423, 106 }  // 2268 twip, 12 pt (from text), 
3.0 pt
+}
+},
+{
+"Converted1",
+{
+{ "Top", 847, 496, 159 },//  851 twip, 24 pt (from edge), 
4.5 pt
+{ "Left", 706, 2081, 212 },  // 1701 twip, 20 pt (from edge), 
6.0 pt
+{ "Bottom", 564, 1401, 35 }, // 1134 twip, 16 pt (from edge), 
1.0 pt
+{ "Right", 423, 3471, 106 }  // 2268 twip, 12 pt (from edge), 
3.0 pt
+}
+}
+};
 auto xStyles = getStyles("PageStyles");
-auto testProc = [&](const OUString& sStyleName, sal_Int32 nMargin, 
sal_Int32 nBorderDistance,
-sal_Int16 nBorderWidth)
+
+for (const auto& style : styleParams)
 {
-  

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

2018-02-15 Thread Michael Stahl
 editeng/source/misc/svxacorr.cxx  |4 +++
 sw/qa/extras/uiwriter/data/tdf83260-1.odt |binary
 sw/qa/extras/uiwriter/uiwriter.cxx|   35 ++
 sw/source/filter/xml/swxml.cxx|5 
 4 files changed, 44 insertions(+)

New commits:
commit 1c8efde4daea648204e3ba19f8edc01ef3e548bd
Author: Michael Stahl 
Date:   Wed Feb 14 12:57:49 2018 +0100

tdf#83260 sw: call CompressRedlines() in ODF import

It's possible that an ODF document contains redlines that will be
deduplicated by CompressRedlines().

If that happens during some editing operation, then a SwRedline
will be deleted and the nodes array becomes smaller by at least 3
nodes; any Undo actions that were created prior to the operation
that called CompressRedlines() will store invalid node indexes now
and Undo will crash.

So presumably it's a precondition of editing operations
that CompressRedlines() is a no-op.

Interestingly CompressRedlines() is also called from
SwEditShell::Undo()/Redo().

Ensure it's a no-op later by calling CompressRedlines() immediately
after load.

(Hopefully this should also work for the Insert File case.)

Add a test too.

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

diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index 1119879f178c..302c941b06b7 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -1228,6 +1228,7 @@ OUString SvxAutoCorrect::GetQuote( SvxAutoCorrDoc const & 
rDoc, sal_Int32 nInsPo
 return sRet;
 }
 
+// WARNING: rText may become invalid, see comment below
 void SvxAutoCorrect::DoAutoCorrect( SvxAutoCorrDoc& rDoc, const OUString& rTxt,
 sal_Int32 nInsPos, sal_Unicode cChar,
 bool bInsert, bool& io_bNbspRunNext, 
vcl::Window const * pFrameWin )
@@ -1338,6 +1339,9 @@ void SvxAutoCorrect::DoAutoCorrect( SvxAutoCorrDoc& rDoc, 
const OUString& rTxt,
 
 if( IsAutoCorrFlag( Autocorrect ) )
 {
+// WARNING ATTENTION: rTxt is an alias of the text node's OUString
+// and becomes INVALID if ChgAutoCorrWord returns true!
+// => use aPara/pPara to create a valid copy of the string!
 OUString aPara;
 OUString* pPara = IsAutoCorrFlag(CapitalStartSentence) ?  : 
nullptr;
 
diff --git a/sw/qa/extras/uiwriter/data/tdf83260-1.odt 
b/sw/qa/extras/uiwriter/data/tdf83260-1.odt
new file mode 100644
index ..b6e144b57751
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf83260-1.odt differ
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx 
b/sw/qa/extras/uiwriter/uiwriter.cxx
index 8dee21388fbe..0a16a201ad1a 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -156,6 +156,7 @@ public:
 void testChineseConversionSimplifiedToTraditional();
 void testFdo85554();
 void testAutoCorr();
+void testTdf83260();
 void testMergeDoc();
 void testCreatePortions();
 void testBookmarkUndo();
@@ -337,6 +338,7 @@ public:
 CPPUNIT_TEST(testChineseConversionSimplifiedToTraditional);
 CPPUNIT_TEST(testFdo85554);
 CPPUNIT_TEST(testAutoCorr);
+CPPUNIT_TEST(testTdf83260);
 CPPUNIT_TEST(testMergeDoc);
 CPPUNIT_TEST(testCreatePortions);
 CPPUNIT_TEST(testBookmarkUndo);
@@ -1424,6 +1426,39 @@ void SwUiWriterTest::testAutoCorr()
 CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xTable->getColumns()->getCount());
 }
 
+void SwUiWriterTest::testTdf83260()
+{
+SwDoc* const pDoc(createDoc("tdf83260-1.odt"));
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+SwAutoCorrect corr(*SvxAutoCorrCfg::Get().GetAutoCorrect());
+
+// enabled but not shown
+CPPUNIT_ASSERT(IDocumentRedlineAccess::IsHideChanges(
+pDoc->getIDocumentRedlineAccess().GetRedlineFlags()));
+CPPUNIT_ASSERT(IDocumentRedlineAccess::IsRedlineOn(
+pDoc->getIDocumentRedlineAccess().GetRedlineFlags()));
+
CPPUNIT_ASSERT(!pDoc->getIDocumentRedlineAccess().GetRedlineTable().empty());
+
+// the document contains redlines that are combined with CompressRedlines()
+// if that happens during AutoCorrect then indexes in Undo are off -> crash
+pWrtShell->Insert("tset");
+pWrtShell->AutoCorrect(corr, u' ');
+sw::UndoManager& rUndoManager = pDoc->GetUndoManager();
+auto const nActions(rUndoManager.GetUndoActionCount());
+for (auto i = nActions; 0 < i; --i)
+{
+rUndoManager.Undo();
+}
+for (auto i = nActions; 0 < i; --i)
+{
+rUndoManager.Redo();
+}
+for (auto i = nActions; 0 < i; --i)
+{
+rUndoManager.Undo();
+}
+}
+
 void 

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

2015-11-28 Thread Armin Le Grand
 editeng/source/items/frmitems.cxx|   56 ++-
 sw/qa/extras/htmlimport/data/PageAndParagraphFilled.html |   45 
 sw/qa/extras/htmlimport/htmlimport.cxx   |   42 +++
 sw/source/filter/html/parcss1.cxx|   12 ++-
 sw/source/filter/html/swhtml.cxx |   15 
 sw/source/filter/writer/wrt_fn.cxx   |   45 +++-
 6 files changed, 197 insertions(+), 18 deletions(-)

New commits:
commit 29dfcc7521311e547fc069466cc3edc9fcbdbe03
Author: Armin Le Grand 
Date:   Mon Nov 23 16:17:37 2015 +0100

tdf#94088 add import of HTML inline graphics

Related: fdo#63211 for saving. This one adds the import side, plus
fallbacks to use the new FillStyle attributes in HTML im/export in a
SvxBrushItem. Also added graphic import for inline graphics. Comment
markers inserted at places where functionality may be added in the
future when the new FillStyle attributes would be more used in this
content. Unit test checks PageBackground and ParagraphBaground import.

Change-Id: I3f198677db553ad198e0add3162603a4735398f1
Reviewed-on: https://gerrit.libreoffice.org/20129
Reviewed-by: Thorsten Behrens 
Tested-by: Thorsten Behrens 

diff --git a/editeng/source/items/frmitems.cxx 
b/editeng/source/items/frmitems.cxx
index 5bb1766..10211e4 100644
--- a/editeng/source/items/frmitems.cxx
+++ b/editeng/source/items/frmitems.cxx
@@ -3904,7 +3904,6 @@ void SvxBrushItem::PurgeMedium() const
 DELETEZ( pImpl->pStream );
 }
 
-
 const GraphicObject* SvxBrushItem::GetGraphicObject(OUString const & referer) 
const
 {
 if ( bLoadAgain && !maStrLink.isEmpty() && !pImpl->pGraphicObject )
@@ -3913,26 +3912,53 @@ const GraphicObject* 
SvxBrushItem::GetGraphicObject(OUString const & referer) co
 if (SvtSecurityOptions().isUntrustedReferer(referer)) {
 return nullptr;
 }
+
+// tdf#94088 prepare graphic and state
+Graphic aGraphic;
+bool bGraphicLoaded = false;
+
+// try to create stream directly from given URL
 pImpl->pStream = utl::UcbStreamHelper::CreateStream( maStrLink, 
STREAM_STD_READ );
+
+// tdf#94088 if we have a stream, try to load it directly as graphic
 if( pImpl->pStream && !pImpl->pStream->GetError() )
 {
-Graphic aGraphic;
-int nRes;
-pImpl->pStream->Seek( STREAM_SEEK_TO_BEGIN );
-nRes = GraphicFilter::GetGraphicFilter().
-ImportGraphic( aGraphic, maStrLink, *pImpl->pStream,
-   GRFILTER_FORMAT_DONTKNOW, nullptr, 
GraphicFilterImportFlags::DontSetLogsizeForJpeg );
-
-if( nRes != GRFILTER_OK )
+if (GRFILTER_OK == 
GraphicFilter::GetGraphicFilter().ImportGraphic( aGraphic, maStrLink, 
*pImpl->pStream,
+GRFILTER_FORMAT_DONTKNOW, nullptr, 
GraphicFilterImportFlags::DontSetLogsizeForJpeg ))
 {
-bLoadAgain = false;
+bGraphicLoaded = true;
 }
-else
+}
+
+// tdf#94088 if no succeeded, try if the string (which is not epty) 
contains
+// a 'data:' scheme url and try to load that (embedded graphics)
+if(!bGraphicLoaded)
+{
+INetURLObject aGraphicURL( maStrLink );
+
+if( INetProtocol::Data == aGraphicURL.GetProtocol() )
 {
-pImpl->pGraphicObject = new GraphicObject;
-pImpl->pGraphicObject->SetGraphic( aGraphic );
-const_cast < SvxBrushItem*> 
(this)->ApplyGraphicTransparency_Impl();
- }
+std::unique_ptr const 
pStream(aGraphicURL.getData());
+if (pStream)
+{
+if (GRFILTER_OK == 
GraphicFilter::GetGraphicFilter().ImportGraphic(aGraphic, "", *pStream))
+{
+bGraphicLoaded = true;
+
+// tdf#94088 delete the no longer needed data scheme 
URL which
+// is potentially pretty // large, containing a base64 
encoded copy of the graphic
+const_cast< SvxBrushItem* >(this)->maStrLink.clear();
+}
+}
+}
+}
+
+// tdf#94088 when we got a graphic, set it
+if(bGraphicLoaded && GRAPHIC_NONE != aGraphic.GetType())
+{
+pImpl->pGraphicObject = new GraphicObject;
+pImpl->pGraphicObject->SetGraphic( aGraphic );
+const_cast < SvxBrushItem*> 
(this)->ApplyGraphicTransparency_Impl();
 }
 else
 {
diff --git a/sw/qa/extras/htmlimport/data/PageAndParagraphFilled.html 
b/sw/qa/extras/htmlimport/data/PageAndParagraphFilled.html
new file mode 100644
index 000..fbe1ff1
--- /dev/null