[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - sw/qa writerfilter/source

2014-03-07 Thread Michael Stahl
 sw/qa/extras/ooxmlimport/data/rhbz988516.docx |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx  |   14 ++
 writerfilter/source/ooxml/model.xml   |4 +++-
 3 files changed, 17 insertions(+), 1 deletion(-)

New commits:
commit 155397041b1a5687259605de1e33ed86ed955821
Author: Michael Stahl 
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)

(cherry picked from commit 2b78f2cd7b9e4bab0f3b3b9119238f36a1bbc7b2)

Conflicts:
sw/qa/extras/ooxmlimport/ooxmlimport.cxx

Change-Id: Ib054f1882793049b39424c1076ba5d4b319cd027
Reviewed-on: https://gerrit.libreoffice.org/8476
Reviewed-by: Miklos Vajna 
Tested-by: Miklos Vajna 

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 dee45c9..9a35a3e 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -139,6 +139,7 @@ public:
 void testRPrChangeClosed();
 void testFdo65090();
 void testFdo73389();
+void testRhbz988516();
 
 CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -243,6 +244,7 @@ void Test::run()
 {"rprchange_closed.docx", &Test::testRPrChangeClosed},
 {"fdo65090.docx", &Test::testFdo65090},
 {"fdo73389.docx", &Test::testFdo73389},
+{"rhbz988516.docx", &Test::testRhbz988516},
 };
 header();
 for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
@@ -376,6 +378,18 @@ void Test::testN757890()
 CPPUNIT_ASSERT_EQUAL(text::HoriOrientation::CENTER, nValue);
 }
 
+void Test::testRhbz988516()
+{
+// The problem was that the list properties of the footer leaked into body
+CPPUNIT_ASSERT_EQUAL(OUString(),
+getProperty(getParagraph(1), "NumberingStyleName"));
+CPPUNIT_ASSERT_EQUAL(OUString("Enclosure 3"), 
getParagraph(2)->getString());
+CPPUNIT_ASSERT_EQUAL(OUString(),
+getProperty(getParagraph(2), "NumberingStyleName"));
+CPPUNIT_ASSERT_EQUAL(OUString(),
+getProperty(getParagraph(3), "NumberingStyleName"));
+}
+
 void Test::testFdo49940()
 {
 uno::Reference xTextDocument(mxComponent, 
uno::UNO_QUERY);
diff --git a/writerfilter/source/ooxml/model.xml 
b/writerfilter/source/ooxml/model.xml
index d368dab..a42ab94 100644
--- a/writerfilter/source/ooxml/model.xml
+++ b/writerfilter/source/ooxml/model.xml
@@ -22508,7 +22508,9 @@
   
   
 
-
+
+  
+
 
   
   
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - sw/qa writerfilter/source

2014-03-04 Thread Adam Co
 sw/qa/extras/ooxmlexport/data/fdo65655.docx   |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx  |   16 
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   10 --
 3 files changed, 24 insertions(+), 2 deletions(-)

New commits:
commit d8a395033c7d0c924ce5898b2e9b301dbde80b44
Author: Adam Co 
Date:   Tue Jun 11 18:21:27 2013 +0300

fdo#65655 : fix for Different_Odd_And_Even_Pages flag ignored

Signed-off-by: Miklos Vajna 

Conflicts:
sw/qa/extras/ooxmlexport/ooxmlexport.cxx

(cherry picked from commit db23f89b76cb61b215bcae5495eadba2b5ceace2)
Signed-off-by: Michael Stahl 

Conflicts:
sw/qa/extras/ooxmlexport/ooxmlexport.cxx

Change-Id: Icf9949bb00aa905d22aedfd8f2b297dfa89dfedb

diff --git a/sw/qa/extras/ooxmlexport/data/fdo65655.docx 
b/sw/qa/extras/ooxmlexport/data/fdo65655.docx
new file mode 100644
index 000..5fe9451
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo65655.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 1372151..21fa482 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -78,6 +78,7 @@ public:
 void testCp115();
 void testFdo70812();
 void testBnc837302();
+void testFdo65655();
 
 CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -140,6 +141,7 @@ void Test::run()
 {"cp115.odt", &Test::testCp115},
 {"fdo70812.docx", &Test::testFdo70812},
 {"bnc837302.docx", &Test::testBnc837302},
+{"fdo65655.docx", &Test::testFdo65655},
 };
 // Don't test the first import of these, for some reason those tests fail
 const char* aBlacklist[] = {
@@ -813,6 +815,20 @@ void Test::testBnc837302()
 CPPUNIT_ASSERT_EQUAL(OUString(), aProperty);
 }
 
+void Test::testFdo65655()
+{
+// The problem was that the DOCX had a non-blank odd footer and a blank 
even footer
+// The 'Different Odd & Even Pages' was turned on
+// However - LO assumed that because the 'even' footer is blank - it 
should ignore the 'Different Odd & Even Pages' flag
+// So it did not import it and did not export it
+uno::Reference 
xPropertySet(getStyles("PageStyles")->getByName(DEFAULT_STYLE), uno::UNO_QUERY);
+sal_Bool bValue = false;
+xPropertySet->getPropertyValue("HeaderIsShared") >>= bValue;
+CPPUNIT_ASSERT_EQUAL(false, bool(bValue));
+xPropertySet->getPropertyValue("FooterIsShared") >>= bValue;
+CPPUNIT_ASSERT_EQUAL(false, bool(bValue));
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 131559f..b0cde8d 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1404,7 +1404,10 @@ void 
DomainMapper_Impl::PushPageHeader(SectionPropertyMap::PageType eType)
 uno::makeAny(sal_True) );
 // if a left header is available then header are not shared
 bool bLeft = eType == SectionPropertyMap::PAGE_LEFT;
-if( bLeft && m_pSettingsTable->GetEvenAndOddHeaders())
+
+// If the 'Different Even & Odd Pages' flag is turned on - do not 
ignore it
+// Even if the 'Even' header is blank - the flag should be 
imported (so it would look in LO like in Word)
+if( m_pSettingsTable->GetEvenAndOddHeaders())
 
xPageStyle->setPropertyValue(rPropNameSupplier.GetName(PROP_HEADER_IS_SHARED), 
uno::makeAny( false ));
 
 //set the interface
@@ -1446,7 +1449,10 @@ void 
DomainMapper_Impl::PushPageFooter(SectionPropertyMap::PageType eType)
 uno::makeAny(sal_True) );
 // if a left header is available then footer is not shared
 bool bLeft = eType == SectionPropertyMap::PAGE_LEFT;
-if( bLeft && m_pSettingsTable->GetEvenAndOddHeaders())
+
+// If the 'Different Even & Odd Pages' flag is turned on - do not 
ignore it
+// Even if the 'Even' footer is blank - the flag should be 
imported (so it would look in LO like in Word)
+if( m_pSettingsTable->GetEvenAndOddHeaders())
 
xPageStyle->setPropertyValue(rPropNameSupplier.GetName(PROP_FOOTER_IS_SHARED), 
uno::makeAny( false ));
 //set the interface
 uno::Reference< text::XText > xFooterText;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - sw/qa writerfilter/source

2014-02-24 Thread Miklos Vajna
 sw/qa/extras/ooxmlimport/data/fdo74357.docx  |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx |   11 +++
 writerfilter/source/dmapper/DomainMapperTableHandler.cxx |5 -
 3 files changed, 15 insertions(+), 1 deletion(-)

New commits:
commit 364682a19713169b374d949d0fc34d105a2be5d4
Author: Miklos Vajna 
Date:   Mon Feb 17 09:37:51 2014 +0100

fdo#74357 DOCX import: fix nested tables anchored inside tables

Regression from bbef85c157169efa958ea1014d91d467cb243e6f (bnc#779620
DOCX import: try harder to convert floating tables to text frames,
2013-10-01), the conversion of nested tables is delayed by default till
we know the page size. However, in case the anchor is in a table, we
should convert it right away, because the conversion of the parent table
would invalidate our XTextRange references.

(cherry picked from commit e5fd7c2dacf3c128cdc62622e736ce8abbc578a5)

Conflicts:
sw/qa/extras/ooxmlimport/ooxmlimport.cxx

Change-Id: Id41556e721c6e1c7239e4ea25abd57c999d2219b

diff --git a/sw/qa/extras/ooxmlimport/data/fdo74357.docx 
b/sw/qa/extras/ooxmlimport/data/fdo74357.docx
new file mode 100644
index 000..9703729
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/fdo74357.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 32545c2..dee45c9 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -85,6 +85,7 @@ public:
 void testN779627();
 void testN779941();
 void testFdo55187();
+void testFdo74357();
 void testN780563();
 void testN780853();
 void testN780843();
@@ -188,6 +189,7 @@ void Test::run()
 {"n779627.docx", &Test::testN779627},
 {"n779941.docx", &Test::testN779941},
 {"fdo55187.docx", &Test::testFdo55187},
+{"fdo74357.docx", &Test::testFdo74357},
 {"n780563.docx", &Test::testN780563},
 {"n780853.docx", &Test::testN780853},
 {"n780843.docx", &Test::testN780843},
@@ -969,6 +971,15 @@ void Test::testN779627()
 CPPUNIT_ASSERT_EQUAL_MESSAGE("Not centered vertically relatively to page", 
text::RelOrientation::PAGE_FRAME, nValue);
 }
 
+void Test::testFdo74357()
+{
+// Floating table wasn't converted to a textframe.
+uno::Reference xDrawPageSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xDrawPage(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
+// This was 0.
+CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDrawPage->getCount());
+}
+
 void Test::testFdo55187()
 {
 // 0x010d was imported as a newline.
diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx 
b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
index 28be09c..a79bc79 100644
--- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
@@ -947,9 +947,12 @@ void DomainMapperTableHandler::endTable(unsigned int 
nestedTableLevel)
 // SectionPropertyMap::CloseSectionGroup(), so we'll have no idea
 // about the text area width, nor can fix this by delaying the text
 // frame conversion: just do it here.
+// Also, we the anchor is within a table, then do it here as well,
+// as xStart/xEnd would not point to the start/end at conversion
+// time anyway.
 sal_Int32 nTableWidth = 0;
 m_aTableProperties->getValue(TablePropertyMap::TABLE_WIDTH, 
nTableWidth);
-if (m_rDMapper_Impl.GetSectionContext())
+if (m_rDMapper_Impl.GetSectionContext() && nestedTableLevel <= 1)
 
m_rDMapper_Impl.m_aPendingFloatingTables.push_back(FloatingTableInfo(xStart, 
xEnd, aFrameProperties, nTableWidth));
 else
 m_xText->convertToTextFrame(xStart, xEnd, aFrameProperties);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - sw/qa writerfilter/source

2014-02-18 Thread Michael Stahl
 sw/qa/extras/rtfimport/data/rhbz1065629.rtf|   81 +
 sw/qa/extras/rtfimport/rtfimport.cxx   |   22 ++
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |   14 
 writerfilter/source/rtftok/rtfdocumentimpl.hxx |1 
 4 files changed, 118 insertions(+)

New commits:
commit c30a06600a3b002c9eebb819c1b8dcee9d11abe0
Author: Michael Stahl 
Date:   Tue Feb 18 11:22:52 2014 +0100

rhbz#1065629: RTF import: don't drop nested cells if not enough \cellx

In this document written by "XMLmind XSL-FO Converter" there are less
\cellx than \cell and thus when reading \nestrow/\row a whole buffered
nested table \cell is lost and then subsequently the rest of the nested
table too.  Try to fix that by counting both \cell and \cellx and
replaying until the maximum of those.

Cannot count \intbl since we synthesize that in various places.

(regression in LO 3.5)

(cherry picked from commit 07ef4cf096015f0e427ffd17cd26bb6837e75481)
Conflicts:
sw/qa/extras/rtfimport/rtfimport.cxx

Change-Id: I3b64ad94af842e076611418589a0c83bd18841c6
Reviewed-on: https://gerrit.libreoffice.org/8101
Reviewed-by: Miklos Vajna 
Tested-by: Miklos Vajna 

diff --git a/sw/qa/extras/rtfimport/data/rhbz1065629.rtf 
b/sw/qa/extras/rtfimport/data/rhbz1065629.rtf
new file mode 100644
index 000..b22ec50
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/rhbz1065629.rtf
@@ -0,0 +1,81 @@
+{\rtf1\ansi\ansicpg1252\deff0
+{\fonttbl
+\f0\froman\fcharset0 Times New Roman;
+\f1\fswiss\fcharset0 Arial;
+\f2\fmodern\fcharset0 Courier New;
+\f3\ftech\fcharset2 Symbol;
+\f4\fswiss\fcharset0 Helvetica;
+}
+{\info
+{\*\userprops
+{\propname creator}\proptype30
+{\staticval XMLmind XSL-FO Converter Professional Edition 4.6.1}
+}
+}
+\facingp\fet0\ftnbj
+\sectd
+\pghsxn16114\pgwsxn12514
+\margtsxn720\margbsxn907\marglsxn907\margrsxn1080
+\headery720
+\footery547
+\pgncont\pgndec
+
+\par
+\trowd\trleft10
+\clvertalt
+\clcbpat17
+\clbrdrt\brdrs\brdrw20\brdrcf2\clbrdrb\brdrs\brdrw20\brdrcf2\clbrdrl\brdrs\brdrw20\brdrcf2\clbrdrr\brdrs\brdrw20\brdrcf2\cellx10262
+\pard\intbl
+{\plain\f4\fs19\b\cf15\ulc2
+Informations client
+}
+\cell
+\row
+\trowd\trleft10
+\clvertalt
+\clbrdrl\brdrs\brdrw10\brdrcf2\cellx5136
+\clvertalt
+\clbrdrl\brdrs\brdrw10\brdrcf2\clbrdrr\brdrs\brdrw10\brdrcf2\cellx10262
+\pard\intbl\itap2
+{\plain\f4\fs18\cf2\ulc2
+E-mail:
+}
+\nestcell
+{\*\nesttableprops
+\trowd\trleft0
+\clvertalt
+\cellx5400
+\nestrow}
+\pard\intbl
+\cell
+\pard\intbl\itap2
+{\plain\f4\fs18\b\cf2\ulc2
+Responsable Commercial:
+}
+\nestcell
+{\*\nesttableprops
+\trowd\trleft0
+\clvertalt
+\cellx5400
+\nestrow}
+\pard\intbl\itap2
+{\plain\f4\fs18\cf2\ulc2
+\~
+}
+\par
+\pard\intbl\itap2
+{\plain\f4\fs18\cf2\ulc2
+Nom: John Doe
+}
+\nestcell
+{\*\nesttableprops
+\trowd\trleft0
+\clvertalt
+\cellx5400
+\nestrow}
+\pard\intbl
+\cell
+\row
+
+\pard\sect
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx 
b/sw/qa/extras/rtfimport/rtfimport.cxx
index eca16e3..dd6f198 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -162,6 +162,8 @@ public:
 void testFdo69384();
 void testFdo70221();
 void testFdo65090();
+void testNestedTable();
+
 
 CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -308,6 +310,7 @@ void Test::run()
 {"hello.rtf", &Test::testFdo69384},
 {"fdo70221.rtf", &Test::testFdo70221},
 {"fdo65090.rtf", &Test::testFdo65090},
+{"rhbz1065629.rtf", &Test::testNestedTable},
 };
 header();
 for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
@@ -1500,6 +1503,25 @@ void Test::testFdo65090()
 CPPUNIT_ASSERT_EQUAL(sal_Int32(1), getProperty< 
uno::Sequence >(xTableRows->getByIndex(0), 
"TableColumnSeparators").getLength());
 }
 
+void Test::testNestedTable()
+{
+// nested table in second cell was missing
+uno::Reference xTextTablesSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
+uno::Reference xTable(xTables->getByIndex(1), 
uno::UNO_QUERY);
+uno::Reference xCell(xTable->getCellByName("A1"), 
uno::UNO_QUERY);
+uno::Reference 
xParaEnumAccess(xCell->getText(), uno::UNO_QUERY);
+uno::Reference xParaEnum = 
xParaEnumAccess->createEnumeration();
+uno::Reference xPara(xParaEnum->nextElement(), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString("Responsable Commercial:"), 
xPara->getString());
+xCell.set(xTable->getCellByName("A2"), uno::UNO_QUERY);
+xParaEnumAccess.set(xCell->getText(), uno::UNO_QUERY);
+xParaEnum = xParaEnumAccess->createEnumeration();
+xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY);
+xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString("Nom: John Doe"), xPara->getString());
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff

[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - sw/qa writerfilter/source

2014-01-22 Thread Zolnai Tamás
 sw/qa/extras/ooxmlimport/data/fdo73389.docx  |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx |   10 +++
 writerfilter/source/dmapper/DomainMapperTableManager.cxx |   19 ---
 3 files changed, 16 insertions(+), 13 deletions(-)

New commits:
commit 7a0eec199901962b03f04371e9474caf8c408c01
Author: Zolnai Tamás 
Date:   Mon Jan 20 13:44:46 2014 +0100

fdo#73389 Writer does not show a docx-document with nested table correctly

The table manager can work with more table simultaneously
and so m_aCellWidths contains more table's properties.Only one
item of it belongs to the current table (getCurrentCellwidths).
Regression from 74c5ed19f430327988194cdcd6bdff09591a93fa

(cherry picked from commit d0c383256ef72d5212d8e2db77582d0ebe417209)

Conflicts:
sw/qa/extras/ooxmlimport/ooxmlimport.cxx
writerfilter/source/dmapper/DomainMapperTableManager.cxx

Change-Id: I93efac0c004af1b2524c955ffb20c3ecd74a2920
Reviewed-on: https://gerrit.libreoffice.org/7565
Reviewed-by: Miklos Vajna 
Tested-by: Miklos Vajna 

diff --git a/sw/qa/extras/ooxmlimport/data/fdo73389.docx 
b/sw/qa/extras/ooxmlimport/data/fdo73389.docx
new file mode 100644
index 000..02b55f7
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/fdo73389.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 2c72214..32545c2 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -137,6 +137,7 @@ public:
 void testBnc779620();
 void testRPrChangeClosed();
 void testFdo65090();
+void testFdo73389();
 
 CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -239,6 +240,7 @@ void Test::run()
 {"bnc779620.docx", &Test::testBnc779620},
 {"rprchange_closed.docx", &Test::testRPrChangeClosed},
 {"fdo65090.docx", &Test::testFdo65090},
+{"fdo73389.docx", &Test::testFdo73389},
 };
 header();
 for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
@@ -1673,6 +1675,14 @@ void Test::testFdo65090()
 CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty< 
uno::Sequence >(xTableRows->getByIndex(0), 
"TableColumnSeparators").getLength());
 }
 
+void Test::testFdo73389()
+{
+uno::Reference xTablesSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY);
+// This was 9340, i.e. the width of the inner table was too large.
+CPPUNIT_ASSERT_EQUAL(sal_Int32(2842), 
getProperty(xTables->getByIndex(0), "Width"));
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx 
b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
index 59afbb3..157fbf8 100644
--- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
@@ -142,20 +142,13 @@ bool DomainMapperTableManager::sprm(Sprm & rSprm)
 */
 bool bFixed = false;
 sal_Int32 nRowFixedWidth = 0;
-if (!m_aCellWidths.empty())
+IntVectorPtr pCellWidths = getCurrentCellWidths();
+// Step 1. Check whether any cell has fixed width 
in the given row of table.
+for (std::vector::const_iterator 
aValIter = pCellWidths->begin(); aValIter != pCellWidths->end(); ++aValIter)
 {
-// Step 1. Check whether any cell has fixed 
width in the given row of table.
-::std::vector< IntVectorPtr >::iterator itr;
-for (itr = m_aCellWidths.begin(); itr != 
m_aCellWidths.end(); itr ++)
-{
-IntVectorPtr itrVal = (*itr);
-for 
(std::vector::const_iterator aValIter = itrVal->begin(); aValIter != 
itrVal->end(); ++aValIter)
-{
-// Sum the width of cells to find the 
total width of given row
-nRowFixedWidth += (*aValIter);
-bFixed = true;
-}
-}
+// Sum the width of cells to find the total 
width of given row
+nRowFixedWidth += (*aValIter);
+bFixed = true;
 }
 
 // Check whether the total width of given row is 
compared with the maximum value of rows (m_nMaxFixedWidth).
___
Libreoffice-commits mailing list
libreoffi

[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - sw/qa writerfilter/source

2013-12-28 Thread Zolnai Tamás
 sw/qa/extras/inc/swmodeltestbase.hxx|6 ++
 sw/qa/extras/ooxmlimport/data/rprchange_closed.docx |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx|9 +
 writerfilter/source/ooxml/model.xml |3 +++
 4 files changed, 18 insertions(+)

New commits:
commit a5d5aa022c2ae04e1d230050a773b3983a410cde
Author: Zolnai Tamás 
Date:   Tue Dec 24 08:05:58 2013 +0100

DOCX import: close rPrChange properly.

Call endtrackchanges when rPrChange ends so the
corresponding redline will be removed.

Conflicts:
sw/qa/extras/ooxmlimport/ooxmlimport.cxx
Reviewed on:
https://gerrit.libreoffice.org/7194

Change-Id: I4091d7b54e0a74f3158cc979f210577a2dc29783

diff --git a/sw/qa/extras/inc/swmodeltestbase.hxx 
b/sw/qa/extras/inc/swmodeltestbase.hxx
index a9b2368..727580d 100644
--- a/sw/qa/extras/inc/swmodeltestbase.hxx
+++ b/sw/qa/extras/inc/swmodeltestbase.hxx
@@ -166,6 +166,12 @@ protected:
 return data;
 }
 
+bool hasProperty(const uno::Reference& obj, const 
OUString& name) const
+{
+uno::Reference properties(obj, 
uno::UNO_QUERY_THROW);
+return properties->getPropertySetInfo()->hasPropertyByName(name);
+}
+
 /// Get number of paragraphs of the document.
 int getParagraphs()
 {
diff --git a/sw/qa/extras/ooxmlimport/data/rprchange_closed.docx 
b/sw/qa/extras/ooxmlimport/data/rprchange_closed.docx
new file mode 100644
index 000..ff53871
Binary files /dev/null and 
b/sw/qa/extras/ooxmlimport/data/rprchange_closed.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 2076c8c..d1fa650 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -135,6 +135,7 @@ public:
 void testVmlTextVerticalAdjust();
 void testGroupshapeSdt();
 void testBnc779620();
+void testRPrChangeClosed();
 
 CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -235,6 +236,7 @@ void Test::run()
 {"vml-text-vertical-adjust.docx", &Test::testVmlTextVerticalAdjust},
 {"groupshape-sdt.docx", &Test::testGroupshapeSdt},
 {"bnc779620.docx", &Test::testBnc779620},
+{"rprchange_closed.docx", &Test::testRPrChangeClosed},
 };
 header();
 for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
@@ -1652,6 +1654,13 @@ void Test::testBnc779620()
 CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount());
 }
 
+void Test::testRPrChangeClosed()
+{
+// Redline defined by rPrChanged wasn't removed.
+// First paragraph has an rPrChange element, make sure it doesn't appear 
in the second paragraph.
+CPPUNIT_ASSERT_EQUAL(false, hasProperty(getRun(getParagraph(2), 1), 
"RedlineType"));
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/ooxml/model.xml 
b/writerfilter/source/ooxml/model.xml
index 4fad4ba..d368dab 100644
--- a/writerfilter/source/ooxml/model.xml
+++ b/writerfilter/source/ooxml/model.xml
@@ -22077,6 +22077,9 @@
 
 
   
+  
+  
+  
 
 
   
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - sw/qa writerfilter/source

2013-12-03 Thread Jan Holesovsky
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx  |   11 +++
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   14 ++
 2 files changed, 25 insertions(+)

New commits:
commit 6cd9431a182f54d491ab1459443a80c6a8e4ae95
Author: Jan Holesovsky 
Date:   Wed Nov 20 13:39:18 2013 +0100

Related bnc#837302: Don't introduce a redlined delete and the end of doc.

Conflicts:
writerfilter/source/dmapper/DomainMapper_Impl.cxx

Change-Id: I5c3903a40b69867684707d33acbc92b1f80a93ec
Reviewed-on: https://gerrit.libreoffice.org/6898
Reviewed-by: Miklos Vajna 
Tested-by: Miklos Vajna 

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index d7a5c8b..1372151 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -800,6 +800,17 @@ void Test::testBnc837302()
 getRun(xParagraph, 3, "AAA");
 // interestingly the 'Insert' is set on the _previous_ run
 CPPUNIT_ASSERT_EQUAL(OUString("Insert"), 
getProperty(getRun(xParagraph, 2), "RedlineType"));
+
+// make sure we don't introduce a redlined delete in the 2nd paragraph
+xParagraph = getParagraph(2);
+OUString aProperty;
+try
+{
+// throws when not present
+aProperty = getProperty(getRun(xParagraph, 1), 
"RedlineType");
+}
+catch (const beans::UnknownPropertyException&) {}
+CPPUNIT_ASSERT_EQUAL(OUString(), aProperty);
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index ded106d..131559f 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -318,7 +318,21 @@ void DomainMapper_Impl::RemoveLastParagraph( )
 #else
 if (xCursor->getString() == "\r\n")
 #endif
+{
+uno::Reference 
xDocProps(GetTextDocument(), uno::UNO_QUERY);
+const OUString aRecordChanges("RecordChanges");
+uno::Any 
aPreviousValue(xDocProps->getPropertyValue(aRecordChanges));
+
+// disable redlining for this operation, otherwise we might
+// end up with an unwanted recorded deletion
+xDocProps->setPropertyValue(aRecordChanges, 
uno::Any(sal_False));
+
+// delete
 xCursor->setString(OUString());
+
+// restore again
+xDocProps->setPropertyValue(aRecordChanges, aPreviousValue);
+}
 }
 }
 catch( const uno::Exception& )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - sw/qa writerfilter/source

2013-11-11 Thread Miklos Vajna
 sw/qa/extras/ooxmlexport/data/fdo70812.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx |8 
 writerfilter/source/dmapper/DomainMapper.cxx |9 ++---
 3 files changed, 14 insertions(+), 3 deletions(-)

New commits:
commit 88cb2a731bf445776adb6c047010bbd0dae3c633
Author: Miklos Vajna 
Date:   Thu Nov 7 16:01:25 2013 +0100

fdo#70812 writerfilter: check for nullptr after dynamic_cast

Happens when we set "no number" in the default para style, which is
already the case for Writer anyway.

(cherry picked from commit 660d761bfeea81c0b76cf08b4c961a2ad8d09a06)

Conflicts:
sw/qa/extras/ooxmlexport/ooxmlexport.cxx

Change-Id: I3b262e633e52e4aae039c55d6edb744e36f0f354
Reviewed-on: https://gerrit.libreoffice.org/6636
Reviewed-by: Jan Holesovsky 
Tested-by: Jan Holesovsky 

diff --git a/sw/qa/extras/ooxmlexport/data/fdo70812.docx 
b/sw/qa/extras/ooxmlexport/data/fdo70812.docx
new file mode 100644
index 000..b9b5d52
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo70812.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 7983360..c1bb45e 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -76,6 +76,7 @@ public:
 void testFdo60990();
 void testBnc834035();
 void testCp115();
+void testFdo70812();
 
 CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -136,6 +137,7 @@ void Test::run()
 {"fdo60990.odt", &Test::testFdo60990},
 {"bnc834035.odt", &Test::testBnc834035},
 {"cp115.odt", &Test::testCp115},
+{"fdo70812.docx", &Test::testFdo70812},
 };
 // Don't test the first import of these, for some reason those tests fail
 const char* aBlacklist[] = {
@@ -781,6 +783,12 @@ void Test::testCp115()
 getParagraph(2, "http://www.google.com/";);
 }
 
+void Test::testFdo70812()
+{
+// Import just crashed.
+getParagraph(1, "Sample pages document.");
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index 5ac4b05..dfcf3a7 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -1561,7 +1561,8 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, 
PropertyMapPtr rContext, SprmType
 {
 //style sheets cannot have a numbering rule attached
 StyleSheetPropertyMap* pStyleSheetPropertyMap = dynamic_cast< 
StyleSheetPropertyMap* >( rContext.get() );
-pStyleSheetPropertyMap->SetListLevel( (sal_Int16)nIntValue );
+if (pStyleSheetPropertyMap)
+pStyleSheetPropertyMap->SetListLevel( (sal_Int16)nIntValue 
);
 }
 else
 rContext->Insert( PROP_NUMBERING_LEVEL, true, uno::makeAny( 
(sal_Int16)nIntValue ));
@@ -1575,7 +1576,8 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, 
PropertyMapPtr rContext, SprmType
 {
 //style sheets cannot have a numbering rule attached
 StyleSheetPropertyMap* pStyleSheetPropertyMap = dynamic_cast< 
StyleSheetPropertyMap* >( rContext.get() );
-pStyleSheetPropertyMap->SetListId( nIntValue );
+if (pStyleSheetPropertyMap)
+pStyleSheetPropertyMap->SetListId( nIntValue );
 }
 if( pList.get( ) )
 {
@@ -1593,7 +1595,8 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, 
PropertyMapPtr rContext, SprmType
 {
 // set the number id for AbstractNum references
 StyleSheetPropertyMap* pStyleSheetPropertyMap = 
dynamic_cast< StyleSheetPropertyMap* >( rContext.get() );
-pStyleSheetPropertyMap->SetNumId( nIntValue );
+if (pStyleSheetPropertyMap)
+pStyleSheetPropertyMap->SetNumId( nIntValue );
 }
 else
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - sw/qa writerfilter/source

2013-10-21 Thread Miklos Vajna
 sw/qa/extras/rtfimport/data/fdo70221.rtf   |binary
 sw/qa/extras/rtfimport/rtfimport.cxx   |   10 ++
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |1 +
 3 files changed, 11 insertions(+)

New commits:
commit 11726693c3d57e86e391f60370f1b42030ef69ea
Author: Miklos Vajna 
Date:   Mon Oct 21 09:31:55 2013 +0200

fdo#70221 fix RTF import of multi-group pictures

Pictures typically have a single RTF group, so we imported them at the
end of that group. Though multiple inner groups are also allowed, so
make sure we only do the import at the very end, instead of at the end
of all inner groups as well, resulting in multiple (fake) pictures.

Regression from 13c00ce322e78eb4e0f50ab84ded19cd6aae1ded (Enable the
writerfilter-based RTF import in non-experimental mode, 2011-08-18).

Change-Id: Id895b2c6d3b824d09d89bfa01ce59aba76c55d42
(cherry picked from commit a35fa8d8b127cb23ebff3952291742bf28477c74)
Reviewed-on: https://gerrit.libreoffice.org/6361
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sw/qa/extras/rtfimport/data/fdo70221.rtf 
b/sw/qa/extras/rtfimport/data/fdo70221.rtf
new file mode 100644
index 000..1ca7939
Binary files /dev/null and b/sw/qa/extras/rtfimport/data/fdo70221.rtf differ
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx 
b/sw/qa/extras/rtfimport/rtfimport.cxx
index e79d282..687baac 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -160,6 +160,7 @@ public:
 void testFdo68076();
 void testFdo68291();
 void testFdo69384();
+void testFdo70221();
 
 CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -304,6 +305,7 @@ void Test::run()
 {"fdo68076.rtf", &Test::testFdo68076},
 {"fdo68291.odt", &Test::testFdo68291},
 {"hello.rtf", &Test::testFdo69384},
+{"fdo70221.rtf", &Test::testFdo70221},
 };
 header();
 for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
@@ -1478,6 +1480,14 @@ void Test::testFdo69384()
 getStyles("ParagraphStyles")->getByName("Text body justified");
 }
 
+void Test::testFdo70221()
+{
+uno::Reference xDrawPageSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
+// The picture was imported twice.
+CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDraws->getCount());
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 59e138b..5e7ea2a 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -3727,6 +3727,7 @@ int RTFDocumentImpl::pushState()
 case DESTINATION_SHAPETEXT:
 case DESTINATION_FORMFIELD:
 case DESTINATION_FIELDINSTRUCTION:
+case DESTINATION_PICT:
 m_aStates.top().nDestinationState = DESTINATION_NORMAL;
 break;
 case DESTINATION_MNUM:
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - sw/qa writerfilter/source

2013-10-09 Thread Miklos Vajna
 sw/qa/extras/ooxmlimport/data/bnc779620.docx |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx |   10 ++
 writerfilter/source/dmapper/DomainMapperTableHandler.cxx |   25 ++-
 writerfilter/source/dmapper/DomainMapper_Impl.hxx|   18 ++
 writerfilter/source/dmapper/PropertyMap.cxx  |   15 +
 5 files changed, 54 insertions(+), 14 deletions(-)

New commits:
commit d41fc60d4443e3ff22ac3ef0e56cb9131cd49cc9
Author: Miklos Vajna 
Date:   Tue Oct 1 16:57:56 2013 +0200

bnc#779620 DOCX import: try harder to convert floating tables to text frames

Since 78d1f1c2835b9fae0f91ed771fc1d594c7817502, we convert floating
tables to text frames only in case it's possible that there will be
wrapping, to give better results for multi-page tables, which are
multi-page, and technically floating ones, but that has no effect on the
layout.

The problem was that we try to do this decision too early, effectively
the page width and margins were counted from the default letter size,
instead of the actual values, which did not arrive at the time of the
decision. Fix this by moving this logic at the section end.

(cherry picked from commit bbef85c157169efa958ea1014d91d467cb243e6f)

Conflicts:
sw/qa/extras/ooxmlimport/ooxmlimport.cxx
writerfilter/source/dmapper/DomainMapper_Impl.hxx

Change-Id: Ic1fbceb54c8ec223ed01836fafe6220bb3b2410a
Reviewed-on: https://gerrit.libreoffice.org/6104
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sw/qa/extras/ooxmlimport/data/bnc779620.docx 
b/sw/qa/extras/ooxmlimport/data/bnc779620.docx
new file mode 100644
index 000..23c126d
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/bnc779620.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 913cc16..2076c8c 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -134,6 +134,7 @@ public:
 void testFdo68607();
 void testVmlTextVerticalAdjust();
 void testGroupshapeSdt();
+void testBnc779620();
 
 CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -233,6 +234,7 @@ void Test::run()
 {"fdo68607.docx", &Test::testFdo68607},
 {"vml-text-vertical-adjust.docx", &Test::testVmlTextVerticalAdjust},
 {"groupshape-sdt.docx", &Test::testGroupshapeSdt},
+{"bnc779620.docx", &Test::testBnc779620},
 };
 header();
 for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
@@ -1642,6 +1644,14 @@ void Test::testGroupshapeSdt()
 CPPUNIT_ASSERT_EQUAL(sal_Int32(20), 
getProperty(getRun(getParagraphOfText(1, xShape->getText()), 1), 
"CharKerning"));
 }
 
+void Test::testBnc779620()
+{
+// The problem was that the floating table was imported as a non-floating 
one.
+uno::Reference xTextFramesSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount());
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx 
b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
index 7d5c44e..b613c07 100644
--- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
@@ -817,19 +817,7 @@ void DomainMapperTableHandler::endTable(unsigned int 
nestedTableLevel)
 uno::Reference xStart;
 uno::Reference xEnd;
 
-bool bNoFly = false;
-if (SectionPropertyMap* pSectionContext = 
m_rDMapper_Impl.GetSectionContext())
-{
-sal_Int32 nTextAreaWidth = pSectionContext->GetPageWidth() - 
pSectionContext->GetLeftMargin() - pSectionContext->GetRightMargin();
-sal_Int32 nTableWidth = 0;
-m_aTableProperties->getValue( TablePropertyMap::TABLE_WIDTH, 
nTableWidth );
-// If the table is wider than the text area, then don't create a 
fly
-// for the table: no wrapping will be performed anyway, but 
multi-page
-// tables will be broken.
-bNoFly = nTableWidth >= nTextAreaWidth;
-}
-
-bool bFloating = aFrameProperties.hasElements() && !bNoFly;
+bool bFloating = aFrameProperties.hasElements();
 // Additional checks: if we can do this.
 if (bFloating && (*m_pTableSeq)[0].getLength() > 0 && 
(*m_pTableSeq)[0][0].getLength() > 0)
 {
@@ -916,7 +904,16 @@ void DomainMapperTableHandler::endTable(unsigned int 
nestedTableLevel)
 // A non-zero left margin would move the table out of the frame, 
move the frame itself instead.
 xTableProperties->setPropertyValue("LeftMargin", 
uno::makeAny(sal_Int32(0)));
 
-uno::Reference< text:

[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - sw/qa writerfilter/source

2013-10-04 Thread Miklos Vajna
 sw/qa/extras/rtfimport/data/fdo69384-paste.rtf  |   17 +
 sw/qa/extras/rtfimport/rtfimport.cxx|   14 ++
 writerfilter/source/dmapper/StyleSheetTable.cxx |   11 +--
 3 files changed, 40 insertions(+), 2 deletions(-)

New commits:
commit a3fa048790b6e0928be3ff8bcd102813e0bcedb3
Author: Miklos Vajna 
Date:   Fri Oct 4 11:02:59 2013 +0200

fdo#69384 fix impress -> writer copy&paste

Regression from 2ade07126971b79c92f729fae5709f2e2e2b495c (fdo#62044 RTF
import: don't overwrite existing styles when pasting, 2013-06-04),
during paste, if existing style was found, then the intention was to
skip that style, but instead we tried to create one.

(cherry picked from commit 5ebe826caf75e8d00656b385bf0bbc05cb27)

Conflicts:
writerfilter/source/dmapper/StyleSheetTable.cxx

Change-Id: I83adaf9fe6b8a578fa60c21b9463fabde7707d7e
Reviewed-on: https://gerrit.libreoffice.org/6126
Reviewed-by: Michael Stahl 
Tested-by: Michael Stahl 

diff --git a/sw/qa/extras/rtfimport/data/fdo69384-paste.rtf 
b/sw/qa/extras/rtfimport/data/fdo69384-paste.rtf
new file mode 100644
index 000..cbdca5b
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo69384-paste.rtf
@@ -0,0 +1,17 @@
+{\rtf\ansi
+{\fonttbl{\f0\froman\fprq2\fcharset0 Times New Roman;}{\f1\fprq2\fcharset0 
Segoe UI;}{\f2\fprq2\fcharset0 Arial;}{\f3\froman\fprq2\fcharset0 
Arial;}{\f4\fprq2\fcharset0 Droid Sans Fallback;}}
+{\colortbl\red255\green255\blue255;;}
+{\stylesheet
+{\s1\fi0\li0\ri0\sb0\sa0\sl200\slmult0\cf0\f3\fs36\b0\ulnone\strike0\i0\outl0\shad0\kerning1\f4\f2\fs36\fs36\b0\b0\i0\i0\accnone\olnone\snext1
 Default;}
+{\s2\fi0\li0\ri0\sb0\sa0\sl200\slmult0\cf0\f3\fs36\b0\ulnone\strike0\i0\outl0\shad0\kerning1\f4\f2\fs36\fs36\b0\b0\i0\i0\accnone\olnone\sbasedon1\snext2
 Object with arrow;}
+{\s3\fi0\li0\ri0\sb0\sa0\sl200\slmult0\cf0\f3\fs36\b0\ulnone\strike0\i0\outl0\shad0\kerning1\f4\f2\fs36\fs36\b0\b0\i0\i0\accnone\olnone\sbasedon1\snext3
 Object with shadow;}
+{\s4\fi0\li0\ri0\sb0\sa0\sl200\slmult0\cf0\f3\fs36\b0\ulnone\strike0\i0\outl0\shad0\kerning1\f4\f2\fs36\fs36\b0\b0\i0\i0\accnone\olnone\sbasedon1\snext4
 Object without fill;}
+{\s5\fi0\li0\ri0\sb0\sa0\sl200\slmult0\cf0\f3\fs36\b0\ulnone\strike0\i0\outl0\shad0\kerning1\f4\f2\fs36\fs36\b0\b0\i0\i0\accnone\olnone\sbasedon1\snext5
 Object with no fill and no line;}
+{\s6\fi0\li0\ri0\sb0\sa0\sl200\slmult0\cf0\f3\fs36\b0\ulnone\strike0\i0\outl0\shad0\kerning1\f4\f2\fs36\fs36\b0\b0\i0\i0\accnone\olnone\sbasedon1\snext6
 Text;}
+{\s7\fi0\li0\ri0\sb0\sa0\sl200\slmult0\cf0\f3\fs32\b0\ulnone\strike0\i0\outl0\shad0\kerning1\f4\f2\fs36\fs36\b0\b0\i0\i0\accnone\olnone\sbasedon1\snext7
 Text body;}
+{\s8\fi0\li0\ri0\sb0\sa0\sl200\slmult0\ql\cf0\f3\fs36\b0\ulnone\strike0\i0\outl0\shad0\kerning1\f4\f2\fs36\fs36\b0\b0\i0\i0\accnone\olnone\sbasedon1\snext8
 Text body justified;}}
+{\*\EditEnginePoolDefaults\ltrpar\fi0\li0\ri0\fi0\li0\ri0\sb0\sa0\sl0\slmult0\ql\cf0\f0\fs48\b0\ulnone\strike0\i0\outl0\shad0\kerning0\expndtw0\f1\f2\fs48\fs48\b0\b0\i0\i0\accnone\olnone}
+\deftab709
+{
+\s27\fi0\li0\ri0\qc\cf0\f3\fs64\b0\ulnone\strike0\i0\outl0\shad0\kerning1\f4\f2\fs64\fs64\b0\b0\i0\i0\accnone\olnone
 {\f3\fs64\b0\i0 sss}\par\pard\plain
+}}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx 
b/sw/qa/extras/rtfimport/rtfimport.cxx
index 8508909..e79d282 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -159,6 +159,7 @@ public:
 void testFdo44715();
 void testFdo68076();
 void testFdo68291();
+void testFdo69384();
 
 CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -302,6 +303,7 @@ void Test::run()
 {"fdo44715.rtf", &Test::testFdo44715},
 {"fdo68076.rtf", &Test::testFdo68076},
 {"fdo68291.odt", &Test::testFdo68291},
+{"hello.rtf", &Test::testFdo69384},
 };
 header();
 for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
@@ -1464,6 +1466,18 @@ void Test::testFdo68291()
 CPPUNIT_ASSERT_EQUAL(OUString(), getProperty(getParagraph(1), 
"PageDescName"));
 }
 
+void Test::testFdo69384()
+{
+uno::Reference xTextDocument(mxComponent, 
uno::UNO_QUERY);
+uno::Reference xText(xTextDocument->getText(), 
uno::UNO_QUERY);
+uno::Reference xEnd = xText->getEnd();
+paste("fdo69384-paste.rtf", xEnd);
+
+// Import got interrupted in the middle of style sheet table import,
+// resuling in missing styles and text.
+getStyles("ParagraphStyles")->getByName("Text body justified");
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx 
b/writerfilter/source/dmapper/StyleSheetTable.cxx
index 8352b1b..61ff0ba 100644
--- a/writerfilter/source/dmapper/StyleSheetTable.cxx
+++ b/writerfilter/source/dmapper/StyleSheetTable.cxx
@@ -724,9 +724,16 @@ void StyleSheetTable::ApplyStyleSheets( FontTablePtr 
rFon

[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - sw/qa writerfilter/source

2013-09-30 Thread Miklos Vajna
 sw/qa/extras/rtfexport/data/fdo66743.rtf   |5 +
 sw/qa/extras/rtfexport/rtfexport.cxx   |   10 ++
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |4 ++--
 3 files changed, 17 insertions(+), 2 deletions(-)

New commits:
commit bbf96f4feb309f94741e76bd92ec06f25d3e9734
Author: Miklos Vajna 
Date:   Mon Sep 23 10:05:53 2013 +0200

fdo#66743 fix import of some RTF_CLSHDNG values

This should be in sync with model.xml, got broken when the somewhat
random values got fixed to be the same as the ones which are in the ww8
spec.

(Regression from 26d40686128e70916a636e20f5ccc5763bbb6cc8.)

(cherry picked from commit 21e07d473d1ce995ca0f1d0ac0edb03e75a7dfc1)

Conflicts:
sw/qa/extras/rtfexport/rtfexport.cxx

Change-Id: Id62047e0b2d5d8402a7c8bce95de487afe627e32
Reviewed-on: https://gerrit.libreoffice.org/6091
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sw/qa/extras/rtfexport/data/fdo66743.rtf 
b/sw/qa/extras/rtfexport/data/fdo66743.rtf
new file mode 100644
index 000..81ffc77
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/fdo66743.rtf
@@ -0,0 +1,5 @@
+{\rtf1
+\trowd \clshdng1500\cellx4000
+\pard\plain A1\cell\row
+\pard\par
+}
diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx 
b/sw/qa/extras/rtfexport/rtfexport.cxx
index fafa4f1..442665f 100644
--- a/sw/qa/extras/rtfexport/rtfexport.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport.cxx
@@ -65,6 +65,7 @@ public:
 void testTextFrameBorders();
 void testTextframeGradient();
 void testFdo66682();
+void testFdo66743();
 
 CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -119,6 +120,7 @@ void Test::run()
 {"textframe-borders.rtf", &Test::testTextFrameBorders},
 {"textframe-gradient.rtf", &Test::testTextframeGradient},
 {"fdo66682.rtf", &Test::testFdo66682},
+{"fdo66743.rtf", &Test::testFdo66743},
 };
 // Don't test the first import of these, for some reason those tests fail
 const char* aBlacklist[] = {
@@ -605,6 +607,14 @@ void Test::testFdo66682()
 CPPUNIT_ASSERT_EQUAL(OUString(" "), aSuffix);
 }
 
+void Test::testFdo66743()
+{
+uno::Reference xTable(getParagraphOrTable(1), 
uno::UNO_QUERY);
+uno::Reference xCell = xTable->getCellByName("A1");
+// This was too dark, 0x7f7f7f.
+CPPUNIT_ASSERT_EQUAL(sal_Int32(0xd8d8d8), getProperty(xCell, 
"BackColor"));
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 8ca130b..59e138b 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -3512,8 +3512,8 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, 
int nParam)
 {
 case 500: nValue = 2; break;
 case 1000: nValue = 3; break;
-case 1200: nValue = 27; break;
-case 1500: nValue = 28; break;
+case 1200: nValue = 37; break;
+case 1500: nValue = 38; break;
 case 2000: nValue = 4; break;
 case 2500: nValue = 5; break;
 case 3000: nValue = 6; break;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - sw/qa writerfilter/source

2013-09-06 Thread Miklos Vajna
 sw/qa/extras/ooxmlimport/data/table-pagebreak.docx|binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx  |   11 +++
 writerfilter/source/dmapper/DomainMapper.cxx  |6 ++
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |8 +++-
 writerfilter/source/dmapper/DomainMapper_Impl.hxx |9 +
 writerfilter/source/ooxml/OOXMLFastContextHandler.cxx |   10 ++
 writerfilter/source/ooxml/model.xml   |1 +
 7 files changed, 44 insertions(+), 1 deletion(-)

New commits:
commit 869dc1a6b8a65f2bf8b3926169478ced0cf382ae
Author: Miklos Vajna 
Date:   Mon Sep 2 10:27:49 2013 +0200

bnc#816593 DOCX import: ignore page breaks in tables

(cherry picked from commit 7d3778e0ef9f54f3c8988f1b84d58e7002d6c625)

Conflicts:
writerfilter/source/dmapper/DomainMapper.cxx

Change-Id: Ibb250148d41d1929fa17dd993bb71c93c0e09dcf
Reviewed-on: https://gerrit.libreoffice.org/5787
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sw/qa/extras/ooxmlimport/data/table-pagebreak.docx 
b/sw/qa/extras/ooxmlimport/data/table-pagebreak.docx
new file mode 100755
index 000..06ecf95
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/table-pagebreak.docx 
differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 090b5d8..5223c87 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -130,6 +130,7 @@ public:
 void testTableFloating();
 void testTableAutoNested();
 void testTableStyleParprop();
+void testTablePagebreak();
 
 CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -225,6 +226,7 @@ void Test::run()
 {"table-floating.docx", &Test::testTableFloating},
 {"table-auto-nested.docx", &Test::testTableAutoNested},
 {"table-style-parprop.docx", &Test::testTableStyleParprop},
+{"table-pagebreak.docx", &Test::testTablePagebreak},
 };
 header();
 for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
@@ -1594,6 +1596,15 @@ void Test::testTableStyleParprop()
 CPPUNIT_ASSERT_EQUAL(sal_Int32(0), 
getProperty(getParagraphOfText(1, xCell->getText()), 
"ParaBottomMargin"));
 }
 
+void Test::testTablePagebreak()
+{
+// Page break inside table: should be ignored (was 
style::BreakType_PAGE_BEFORE before).
+CPPUNIT_ASSERT_EQUAL(style::BreakType_NONE, 
getProperty(getParagraphOrTable(2), "BreakType"));
+
+// This one is outside the table: should not be ignored.
+CPPUNIT_ASSERT_EQUAL(style::BreakType_PAGE_BEFORE, 
getProperty(getParagraph(3), "BreakType"));
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index a2b2bce..5ac4b05 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -3356,6 +3356,12 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, 
PropertyMapPtr rContext, SprmType
 }
 }
 break;
+case NS_ooxml::LN_tblStart:
+m_pImpl->m_nTableDepth++;
+break;
+case NS_ooxml::LN_tblEnd:
+m_pImpl->m_nTableDepth--;
+break;
 default:
 {
 #ifdef DEBUG_DOMAINMAPPER
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 6319c79..5bd4e62 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -190,7 +190,8 @@ DomainMapper_Impl::DomainMapper_Impl(
 m_xInsertTextRange(xInsertTextRange),
 m_bIsNewDoc(bIsNewDoc),
 m_bInTableStyleRunProps(false),
-m_pSdtHelper(0)
+m_pSdtHelper(0),
+m_nTableDepth(0)
 
 {
 appendTableManager( );
@@ -632,6 +633,11 @@ void DomainMapper_Impl::deferBreak( BreakType 
deferredBreakType)
 m_bIsColumnBreakDeferred = true;
 break;
 case PAGE_BREAK:
+// See SwWW8ImplReader::HandlePageBreakChar(), page break should be
+// ignored inside tables.
+if (m_nTableDepth > 0)
+return;
+
 m_bIsPageBreakDeferred = true;
 break;
 default:
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
index 30cc2c7..c65d804 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -691,6 +691,15 @@ public:
 
 /// Document background color, applied to every page style.
 boost::optional m_oBackgroundColor;
+
+/**
+ * This contains the raw table depth. m_nTableDepth > 0 is the same as
+ * getTableManager().isInTable(), unless we're in the first paragraph of a
+ * table, or first paragraph after a table, as the table manager is only
+ * updat

[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - sw/qa writerfilter/source

2013-09-06 Thread Miklos Vajna
 sw/qa/extras/ooxmlimport/data/fdo68607.docx  |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx |   10 ++
 writerfilter/source/dmapper/DomainMapperTableHandler.cxx |   15 ++-
 writerfilter/source/dmapper/PropertyMap.cxx  |5 +
 writerfilter/source/dmapper/PropertyMap.hxx  |3 +++
 5 files changed, 32 insertions(+), 1 deletion(-)

New commits:
commit 45ea0b563bbc3e8830c485e7d04aa98a52a1e2fc
Author: Miklos Vajna 
Date:   Tue Sep 3 11:52:51 2013 +0200

fdo#68607 bnc#816593 DomainMapperTableHandler: don't always start a frame

This is a port of commit 8fe8bd6c3b5b1a539b7370f8c457fa69c061d2de
"Related: fdo#61594 SwWW8ImplReader::StartApo: don't always start a
frame" from the WW8 filter to the DOCX one.

(regression from edc4861a68e0269b83b17e0ec57912a1ce4220ad)

(cherry picked from commit 78d1f1c2835b9fae0f91ed771fc1d594c7817502)

Change-Id: If1bb4a8a3786aacd618585cf859b57ce9be85c51
Reviewed-on: https://gerrit.libreoffice.org/5788
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sw/qa/extras/ooxmlimport/data/fdo68607.docx 
b/sw/qa/extras/ooxmlimport/data/fdo68607.docx
new file mode 100644
index 000..11f5706
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/fdo68607.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 5223c87..af5a3f2 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -131,6 +131,7 @@ public:
 void testTableAutoNested();
 void testTableStyleParprop();
 void testTablePagebreak();
+void testFdo68607();
 
 CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -227,6 +228,7 @@ void Test::run()
 {"table-auto-nested.docx", &Test::testTableAutoNested},
 {"table-style-parprop.docx", &Test::testTableStyleParprop},
 {"table-pagebreak.docx", &Test::testTablePagebreak},
+{"fdo68607.docx", &Test::testFdo68607},
 };
 header();
 for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
@@ -1605,6 +1607,14 @@ void Test::testTablePagebreak()
 CPPUNIT_ASSERT_EQUAL(style::BreakType_PAGE_BEFORE, 
getProperty(getParagraph(3), "BreakType"));
 }
 
+void Test::testFdo68607()
+{
+// Bugdoc was 8 pages in Word, 1 in Writer due to pointlessly wrapping the
+// table in a frame. Exact layout may depend on fonts available, etc. --
+// but at least make sure that our table spans over multiple pages now.
+CPPUNIT_ASSERT(getPages() > 1);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx 
b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
index d7d498a..7d5c44e 100644
--- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
@@ -816,7 +816,20 @@ void DomainMapperTableHandler::endTable(unsigned int 
nestedTableLevel)
 {
 uno::Reference xStart;
 uno::Reference xEnd;
-bool bFloating = aFrameProperties.hasElements();
+
+bool bNoFly = false;
+if (SectionPropertyMap* pSectionContext = 
m_rDMapper_Impl.GetSectionContext())
+{
+sal_Int32 nTextAreaWidth = pSectionContext->GetPageWidth() - 
pSectionContext->GetLeftMargin() - pSectionContext->GetRightMargin();
+sal_Int32 nTableWidth = 0;
+m_aTableProperties->getValue( TablePropertyMap::TABLE_WIDTH, 
nTableWidth );
+// If the table is wider than the text area, then don't create a 
fly
+// for the table: no wrapping will be performed anyway, but 
multi-page
+// tables will be broken.
+bNoFly = nTableWidth >= nTextAreaWidth;
+}
+
+bool bFloating = aFrameProperties.hasElements() && !bNoFly;
 // Additional checks: if we can do this.
 if (bFloating && (*m_pTableSeq)[0].getLength() > 0 && 
(*m_pTableSeq)[0][0].getLength() > 0)
 {
diff --git a/writerfilter/source/dmapper/PropertyMap.cxx 
b/writerfilter/source/dmapper/PropertyMap.cxx
index 623c20c8..21974a4 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -1169,6 +1169,11 @@ void SectionPropertyMap::SetFirstPaperBin( sal_Int32 
nSet )
 }
 
 
+sal_Int32 SectionPropertyMap::GetPageWidth()
+{
+return operator[](PropertyDefinition(PROP_WIDTH, false)).get();
+}
+
 StyleSheetPropertyMap::StyleSheetPropertyMap() :
 mnCT_Spacing_line( 0 ),
 mnCT_Spacing_lineRule( 0 ),
diff --git a/writerfilter/source/dmapper/PropertyMap.hxx 
b/writerfilter/source/dmapper/PropertyMap.hxx
index a79c2c2..fb4e4ad 100644
--- a/writerfilter/source/dmapper/PropertyMap.hxx
+++ b/writerfilter/source/dmapper/PropertyMap.hxx
@@ -240,11 +240,14 @@ public:
 void SetFirstPaperBin( sal_

[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - sw/qa writerfilter/source

2013-09-06 Thread Miklos Vajna
 sw/qa/extras/ooxmlimport/data/table-style-parprop.docx   |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx |   11 
 writerfilter/source/dmapper/DomainMapperTableHandler.cxx |   38 +++
 3 files changed, 49 insertions(+)

New commits:
commit 124b2e26797726851116646b478f056583213d5b
Author: Miklos Vajna 
Date:   Thu Aug 29 14:17:09 2013 +0200

bnc#816593 DOCX filter: import paragraph spacing from table style

(cherry picked from commit 17e904ed66c3caf87e658b9d3a18d7b13f4a0b52)

Change-Id: I9dce59ecd8a2d2bfadb8c7273cd46c6c0cf17774
Reviewed-on: https://gerrit.libreoffice.org/5786
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sw/qa/extras/ooxmlimport/data/table-style-parprop.docx 
b/sw/qa/extras/ooxmlimport/data/table-style-parprop.docx
new file mode 100755
index 000..1c68c70
Binary files /dev/null and 
b/sw/qa/extras/ooxmlimport/data/table-style-parprop.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 0c066df..090b5d8 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -129,6 +129,7 @@ public:
 void testTableAutoColumnFixedSize();
 void testTableFloating();
 void testTableAutoNested();
+void testTableStyleParprop();
 
 CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -223,6 +224,7 @@ void Test::run()
 {"table-auto-column-fixed-size.docx", 
&Test::testTableAutoColumnFixedSize},
 {"table-floating.docx", &Test::testTableFloating},
 {"table-auto-nested.docx", &Test::testTableAutoNested},
+{"table-style-parprop.docx", &Test::testTableStyleParprop},
 };
 header();
 for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
@@ -1583,6 +1585,15 @@ void Test::testTableAutoNested()
 CPPUNIT_ASSERT_EQUAL(sal_Int32(23051), 
getProperty(xTables->getByIndex(1), "Width"));
 }
 
+void Test::testTableStyleParprop()
+{
+// The problem was that w:spacing's w:after=0 (a paragraph property) 
wasn't imported from table style.
+uno::Reference xTable(getParagraphOrTable(1), 
uno::UNO_QUERY);
+uno::Reference xCell(xTable->getCellByName("A1"), 
uno::UNO_QUERY);
+// This was 353, the document default, i.e. paragraph property from table 
style had no effect.
+CPPUNIT_ASSERT_EQUAL(sal_Int32(0), 
getProperty(getParagraphOfText(1, xCell->getText()), 
"ParaBottomMargin"));
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx 
b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
index 8cbf48c..d7d498a 100644
--- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
@@ -19,9 +19,12 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -772,6 +775,22 @@ RowPropertyValuesSeq_t 
DomainMapperTableHandler::endTableGetRowProperties()
 return aRowProperties;
 }
 
+// Apply paragraph property to each paragraph within a cell.
+static void lcl_ApplyCellParaProps(uno::Reference xCell, 
uno::Any aBottomMargin)
+{
+uno::Reference xEnumerationAccess(xCell, 
uno::UNO_QUERY);
+uno::Reference xEnumeration = 
xEnumerationAccess->createEnumeration();
+while (xEnumeration->hasMoreElements())
+{
+uno::Reference 
xParagraph(xEnumeration->nextElement(), uno::UNO_QUERY);
+uno::Reference xPropertyState(xParagraph, 
uno::UNO_QUERY);
+// Don't apply in case direct formatting is already present.
+// TODO: probably paragraph style has priority over table style here.
+if (xPropertyState.is() && 
xPropertyState->getPropertyState("ParaBottomMargin") == 
beans::PropertyState_DEFAULT_VALUE)
+xParagraph->setPropertyValue("ParaBottomMargin", aBottomMargin);
+}
+}
+
 void DomainMapperTableHandler::endTable(unsigned int nestedTableLevel)
 {
 #ifdef DEBUG_DMAPPER_TABLE_HANDLER
@@ -818,6 +837,25 @@ void DomainMapperTableHandler::endTable(unsigned int 
nestedTableLevel)
 
 if (xTable.is())
 m_xTableRange = xTable->getAnchor( );
+
+// OOXML table style may container paragraph properties, apply 
these now.
+for (int i = 0; i < aTableInfo.aTableProperties.getLength(); 
++i)
+{
+if (aTableInfo.aTableProperties[i].Name == 
"ParaBottomMargin")
+{
+uno::Reference xCellRange(xTable, 
uno::UNO_QUERY);
+uno::Any aBottomMargin = 
aTableInfo.aTableProperties[i].Value;
+sal_Int32 nRows = aCellProperties.getLength();
+for (sal_Int32 nRow = 0; nRow < nRows; ++nRow)
+{
+const uno::Sequence< bean

[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - sw/qa writerfilter/source

2013-09-06 Thread Miklos Vajna
 sw/qa/extras/ooxmlimport/data/table-auto-column-fixed-size.docx |binary
 sw/qa/extras/ooxmlimport/data/table-auto-nested.docx|binary
 sw/qa/extras/ooxmlimport/data/table-floating.docx   |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx|   44 
 writerfilter/source/dmapper/DomainMapperTableHandler.cxx|   30 -
 writerfilter/source/dmapper/DomainMapperTableHandler.hxx|4 
 writerfilter/source/dmapper/DomainMapperTableManager.cxx|   55 
+-
 writerfilter/source/dmapper/DomainMapperTableManager.hxx|1 
 writerfilter/source/dmapper/TablePositionHandler.cxx|   12 +-
 writerfilter/source/dmapper/TablePositionHandler.hxx|2 
 10 files changed, 135 insertions(+), 13 deletions(-)

New commits:
commit cb5a333fdda48ec1d141d1aa9ce7ae899aea2777
Author: Miklos Vajna 
Date:   Tue Sep 3 15:23:46 2013 +0200

bnc#816593 DOCX import: fix auto table width wrt nested tables

This is a backport of the fix + 3 other commits from master, which were
needed to make the testcase pass on -4-1 as well.

(cherry picked from commits 74c5ed19f430327988194cdcd6bdff09591a93fa,
824cc4bf4ae9035d4108e8da8e81eb57284f0b54,
53d27a30ce5f2c9f7d37a4089286116854c16215 and
76d1ca523ddcf89cc269fe51c70e66066943ef5a)

Change-Id: I62a1f526cf1d4e4056daa1495d61f1b9f5c0b1b2
Reviewed-on: https://gerrit.libreoffice.org/5785
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sw/qa/extras/ooxmlimport/data/table-auto-column-fixed-size.docx 
b/sw/qa/extras/ooxmlimport/data/table-auto-column-fixed-size.docx
new file mode 100644
index 000..557edcb
Binary files /dev/null and 
b/sw/qa/extras/ooxmlimport/data/table-auto-column-fixed-size.docx differ
diff --git a/sw/qa/extras/ooxmlimport/data/table-auto-nested.docx 
b/sw/qa/extras/ooxmlimport/data/table-auto-nested.docx
new file mode 100755
index 000..85f47db
Binary files /dev/null and 
b/sw/qa/extras/ooxmlimport/data/table-auto-nested.docx differ
diff --git a/sw/qa/extras/ooxmlimport/data/table-floating.docx 
b/sw/qa/extras/ooxmlimport/data/table-floating.docx
new file mode 100755
index 000..1e0cb30
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/table-floating.docx 
differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 9a685c4..0c066df 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -126,6 +126,9 @@ public:
 void testFdo46361();
 void testFdo65632();
 void testN816593();
+void testTableAutoColumnFixedSize();
+void testTableFloating();
+void testTableAutoNested();
 
 CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -217,6 +220,9 @@ void Test::run()
 {"fdo46361.docx", &Test::testFdo46361},
 {"fdo65632.docx", &Test::testFdo65632},
 {"n816593.docx", &Test::testN816593},
+{"table-auto-column-fixed-size.docx", 
&Test::testTableAutoColumnFixedSize},
+{"table-floating.docx", &Test::testTableFloating},
+{"table-auto-nested.docx", &Test::testTableAutoNested},
 };
 header();
 for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
@@ -1539,6 +1545,44 @@ void Test::testN816593()
 CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTables->getCount());
 }
 
+void Test::testTableAutoColumnFixedSize()
+{
+uno::Reference xTablesSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY);
+uno::Reference xTextTable(xTables->getByIndex(0), 
uno::UNO_QUERY);
+
+// Width was not recognized during import when table size was 'auto'
+CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(3996)), 
getProperty(xTextTable, "Width"));
+}
+
+void Test::testTableFloating()
+{
+// Both the size and the position of the table was incorrect.
+uno::Reference xTablesSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY);
+// Second table was too wide: 16249, i.e. as wide as the first table.
+CPPUNIT_ASSERT_EQUAL(sal_Int32(11248), 
getProperty(xTables->getByIndex(1), "Width"));
+
+uno::Reference xTextFramesSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY);
+uno::Reference xFrame(xIndexAccess->getByIndex(0), 
uno::UNO_QUERY);
+// This was 0, should be the the opposite of (left margin + half of the 
border width).
+CPPUNIT_ASSERT_EQUAL(sal_Int32(-199), getProperty(xFrame, 
"HoriOrientPosition"));
+// Was 0 as well, should be the right margin.
+CPPUNIT_ASSERT_EQUAL(sal_Int32(191), getProperty(xFrame, 
"RightMargin"));
+}
+
+void Test::testTableAutoNested()
+{
+// This was 176, when compat option is not enabled, the auto paragraph 
bottom margin value was incorrect.
+CPP

[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - sw/qa writerfilter/source

2013-08-22 Thread Miklos Vajna
 sw/qa/extras/rtfimport/data/fdo68076.rtf   |   18 ++
 sw/qa/extras/rtfimport/rtfimport.cxx   |9 +
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |5 +++--
 3 files changed, 30 insertions(+), 2 deletions(-)

New commits:
commit b8a3e787e9c48d8e7af80800456919726ed8dd4b
Author: Miklos Vajna 
Date:   Thu Aug 22 11:21:25 2013 +0200

fdo#68076 RTF import: default font had priority over the specified one

Regression from 60c17b2873506ed8b068b34840aecda0c1d9bd65.

(cherry picked from commit f1e5e271f9aadc2c5e5af3ffae410b6c598e5398)

Change-Id: Ie16d611622e6a814d5cbea00c3f992cd9ecba027
Reviewed-on: https://gerrit.libreoffice.org/5579
Reviewed-by: Michael Stahl 
Tested-by: Michael Stahl 

diff --git a/sw/qa/extras/rtfimport/data/fdo68076.rtf 
b/sw/qa/extras/rtfimport/data/fdo68076.rtf
new file mode 100644
index 000..84c605a
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo68076.rtf
@@ -0,0 +1,18 @@
+{\rtf1\ansi\ansicpg1251\uc1 \deff0\deflang1033\deflangfe1049
+{\fonttbl
+{\f0\froman\fcharset0\fprq2
+{\*\panose 02020603050405020304}
+Times New Roman;}
+{\f31\froman\fcharset238\fprq2 Times New Roman CE;}
+{\f32\froman\fcharset204\fprq2 Times New Roman Cyr;}
+{\f34\froman\fcharset161\fprq2 Times New Roman Greek;}
+{\f35\froman\fcharset162\fprq2 Times New Roman Tur;}
+{\f36\froman\fcharset186\fprq2 Times New Roman Baltic;}
+}
+\paperw11906\paperh16838\margl1701\margr1134\margt1276\margb992 
\widowctrl\ftnbj\aenddoc\hyphhotz142\hyphcaps0\hyphauto1\formshade\viewkind1\viewscale90\viewzk2\pgbrdrhead\pgbrdrfoot
 \fet0\sectd 
+\psz9\linex0\headery709\footery709\colsx709\endnhere\titlepg\sectdefaultcl 
+\pard\plain \li5812\nowidctlpar\widctlpar\adjustright \fs28\lang1049\cgrid 
+{\f32 \'ce\'e1\'fa\'e5\'ea\'f2 \endash  \'f3}
+{
+\par }
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx 
b/sw/qa/extras/rtfimport/rtfimport.cxx
index 0715387..58f0594 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -157,6 +157,7 @@ public:
 void testFdo53556();
 void testFdo63428();
 void testFdo44715();
+void testFdo68076();
 
 CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -298,6 +299,7 @@ void Test::run()
 {"fdo53556.rtf", &Test::testFdo53556},
 {"hello.rtf", &Test::testFdo63428},
 {"fdo44715.rtf", &Test::testFdo44715},
+{"fdo68076.rtf", &Test::testFdo68076},
 };
 header();
 for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
@@ -1442,6 +1444,13 @@ void Test::testFdo44715()
 CPPUNIT_ASSERT_EQUAL(12.f, getProperty(getParagraphOfText(2, 
xCell->getText()), "CharHeight"));
 }
 
+void Test::testFdo68076()
+{
+// Encoding of the last char was wrong (more 'o' than 'y').
+OUString aExpected("\xD0\x9E\xD0\xB1\xD1\x8A\xD0\xB5\xD0\xBA\xD1\x82 
\xE2\x80\x93 \xD1\x83", 19, RTL_TEXTENCODING_UTF8);
+getParagraph(1, aExpected);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index e0a4c20..8ca130b 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -381,9 +381,10 @@ void RTFDocumentImpl::checkFirstRun()
 Mapper().startSectionGroup();
 Mapper().startParagraphGroup();
 
-// set the requested default font
+// set the requested default font, if there are none
 RTFValue::Pointer_t pFont = 
m_aDefaultState.aCharacterSprms.find(NS_sprm::LN_CRgFtc0);
-if (pFont.get())
+RTFValue::Pointer_t pCurrentFont = 
m_aStates.top().aCharacterSprms.find(NS_sprm::LN_CRgFtc0);
+if (pFont && !pCurrentFont)
 dispatchValue(RTF_F, pFont->getInt());
 m_bFirstRun = false;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - sw/qa writerfilter/source

2013-08-18 Thread Miklos Vajna
 sw/qa/extras/rtfimport/data/fdo44715.rtf   |   42 +
 sw/qa/extras/rtfimport/rtfimport.cxx   |   10 +
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |   14 ++--
 3 files changed, 57 insertions(+), 9 deletions(-)

New commits:
commit 28771ae622f648a6e424d3d664333e0407df4739
Author: Miklos Vajna 
Date:   Sat Aug 17 11:38:45 2013 +0200

fdo#44715 RTF import: reset styles in tables on RTF_PARD

Commit 4a507f732d82c188ad81b022cbe3037951e58ac3 added an exception to
RTF_PARD (reset paragraph properties) handling: when we're inside a
table, it should not reset the fact that we're inside a table (which is
a paragraph property).

However, instead of just re-adding that property, it disabled resetting
for all properties, and we had a growing list of exceptions since then.
The next thing to add there would be the paragraph attributes, which
contains the style information. Instead of growing that ad-hoc list,
reset everything again and just re-add the "in table" SPRM.

This makes the second and later paragraphs in the A1 cell of the bugdoc
have proper font size.

(cherry picked from commit b9c1a9b9aa41dbbb6bed0c77f4370ab6105c7fb1)

Conflicts:
sw/qa/extras/rtfimport/rtfimport.cxx
writerfilter/source/rtftok/rtfdocumentimpl.cxx

Change-Id: I2de80894fcd5da3bf45d221af9a04a307c70a29b
Reviewed-on: https://gerrit.libreoffice.org/5471
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sw/qa/extras/rtfimport/data/fdo44715.rtf 
b/sw/qa/extras/rtfimport/data/fdo44715.rtf
new file mode 100644
index 000..1b2287f
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo44715.rtf
@@ -0,0 +1,42 @@
+{\rtf1\ansi\ansicpg1251\uc1 \deff0\deflang1033\deflangfe1049
+{\fonttbl
+{\f0\froman\fcharset204\fprq2
+Times New Roman;}
+{\f1\fswiss\fcharset204\fprq2
+Arial;}
+}
+{\stylesheet
+{\nowidctlpar\widctlpar\adjustright \lang1049\cgrid \snext0 style0;}
+{\s1\sb240\sa60\nowidctlpar\widctlpar\adjustright 
\b\f1\fs32\lang1049\kerning32\cgrid 
+\sbasedon0 \snext0 style 1;}
+{\*\cs10 \additive style10;}
+}
+\paperw16838\paperh11906\margl1134\margr1134\margt1701\margb851 
+\deftab708\widowctrl\ftnbj\aenddoc\noxlattoyen\expshrtn\noultrlspc\dntblnsbdb\nospaceforul\formshade\viewkind1\viewscale100\pgbrdrhead\pgbrdrfoot
 \fet0\sectd 
\lndscpsxn\psz9\linex0\headery709\footery709\colsx708\endnhere\sectlinegrid360\sectdefaultcl
 
+\trowd \trgaph108\trrh105\trleft237\trkeep\trbrdrt\brdrs\brdrw45 
\trbrdrl\brdrs\brdrw45 \trbrdrb\brdrs\brdrw45 \trbrdrr\brdrs\brdrw45 
\clvmgf\clvertalt\clbrdrt
+\brdrs\brdrw45 \clbrdrl\brdrs\brdrw45 \clbrdrb\brdrs\brdrw45 
\clbrdrr\brdrs\brdrw45 \cltxlrtb 
\cellx3274\clvmgf\clvertalt\clbrdrt\brdrs\brdrw45 \clbrdrl\brdrs\brdrw45 
\clbrdrb\brdrs\brdrw15 \cltxlrtb \cellx7187\clvertalt\clbrdrt\brdrs\brdrw45 
\cltxlrtb 
+\cellx7753\clvmgf\clvertalt\clbrdrt\brdrs\brdrw45 \clbrdrb\brdrs\brdrw15 
\clbrdrr\brdrs\brdrw45 \cltxlrtb \cellx11026\pard\plain 
\s1\qc\sb240\sa60\nowidctlpar\widctlpar\intbl\outlinelevel0\adjustright 
\b\f1\fs32\lang1049\kerning32\cgrid 
+{\fs16 first line
+\par }
+\pard\plain \qc\nowidctlpar\widctlpar\intbl\adjustright \lang1049\cgrid 
+{
+\par 
+\par }
+{\b\fs18 last line\cell }
+\pard \nowidctlpar\widctlpar\intbl\adjustright 
+{\fs16
+picture
+}
+{\fs16\lang1033 
+\par }
+{\fs16 \cell }
+{\f15\fs16 \cell }
+{\b\i\f15\fs16 last cell}
+{\fs16 )
+\par \cell }
+\pard \nowidctlpar\widctlpar\intbl\adjustright 
+{\fs20 \row }
+\pard \nowidctlpar\widctlpar\adjustright 
+{
+\par }
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx 
b/sw/qa/extras/rtfimport/rtfimport.cxx
index fc276f6..0715387 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -156,6 +156,7 @@ public:
 void testPoshPosv();
 void testFdo53556();
 void testFdo63428();
+void testFdo44715();
 
 CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -296,6 +297,7 @@ void Test::run()
 {"posh-posv.rtf", &Test::testPoshPosv},
 {"fdo53556.rtf", &Test::testFdo53556},
 {"hello.rtf", &Test::testFdo63428},
+{"fdo44715.rtf", &Test::testFdo44715},
 };
 header();
 for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
@@ -1432,6 +1434,14 @@ void Test::testFdo63428()
 CPPUNIT_ASSERT_EQUAL(OUString("TextFieldEnd"), 
getProperty(getRun(getParagraph(1), 4), "TextPortionType"));
 }
 
+void Test::testFdo44715()
+{
+uno::Reference xTable(getParagraphOrTable(1), 
uno::UNO_QUERY);
+uno::Reference xCell(xTable->getCellByName("A1"), 
uno::UNO_QUERY);
+// Style information wasn't reset, which caused character height to be 16.
+CPPUNIT_ASSERT_EQUAL(12.f, getProperty(getParagraphOfText(2, 
xCell->getText()), "CharHeight"));
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/wri

[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - sw/qa writerfilter/source

2013-08-12 Thread Miklos Vajna
 sw/qa/extras/rtfimport/data/fdo63428.rtf  |8 
 sw/qa/extras/rtfimport/rtfimport.cxx  |   15 +++
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   13 +
 3 files changed, 32 insertions(+), 4 deletions(-)

New commits:
commit eb27a889d5c3f20dc6c1eecf7f588e54fa08a9f7
Author: Miklos Vajna 
Date:   Mon Aug 12 11:53:45 2013 +0200

fdo#63428 writerfilter: fix paste of commented text ranges

There were multiple problems here:

- xFoo->createTextCursorByRange() got a text range argument,
  where the text range wasn't from the xFoo text
- it was assumed that all XText implements text::XParagraphCursor as
  well, but this is not true for e.g. comment text
- commented text ranges were pasted as normal comments (once again, the
  insert position wasn't passed around)

(cherry picked from commit c73b8072a1732f829d3d6ba6c1172d96d55b1c4f)

Change-Id: I9a975a08b08a7f32b1ee71e42f58736cc0dbb09d
Reviewed-on: https://gerrit.libreoffice.org/5368
Reviewed-by: Tor Lillqvist 
Tested-by: Tor Lillqvist 

diff --git a/sw/qa/extras/rtfimport/data/fdo63428.rtf 
b/sw/qa/extras/rtfimport/data/fdo63428.rtf
new file mode 100644
index 000..826d4ca
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo63428.rtf
@@ -0,0 +1,8 @@
+{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf390
+\stshfdbch0{\fonttbl\f0\fnil\fcharset0 Verdana;}
+{\colortbl;\red255\green255\blue255;}
+\paperw12240\paperh15840\margl1800\margr1800\margt1440\margb1440\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\fi360\sl288\slmult1\pardirnatural
+
+\f0\fs28 \cf0 {\*\atrfstart 1}\f0\fs28\b0\i0\ul0 hello{\*\atrfend 
1}\f0\fs28\b0\i0\ul0 {\chatn{\*\annotation{\*\atnref 
1}\pard\plain\f0\fs28\b0\i0\ul0 
+\fs20 crash
+\fs28 }}\f0\fs28\b0 \i0 \ul0  }
\ No newline at end of file
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx 
b/sw/qa/extras/rtfimport/rtfimport.cxx
index 0a56525..fc276f6 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -155,6 +155,7 @@ public:
 void testFdo47440();
 void testPoshPosv();
 void testFdo53556();
+void testFdo63428();
 
 CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -294,6 +295,7 @@ void Test::run()
 {"fdo47440.rtf", &Test::testFdo47440},
 {"posh-posv.rtf", &Test::testPoshPosv},
 {"fdo53556.rtf", &Test::testFdo53556},
+{"hello.rtf", &Test::testFdo63428},
 };
 header();
 for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
@@ -1417,6 +1419,19 @@ void Test::testFdo53556()
 CPPUNIT_ASSERT_EQUAL(OUString("FrameShape"), 
xShapeDescriptor->getShapeType());
 }
 
+void Test::testFdo63428()
+{
+// Pasting content that contained an annotation caused a crash.
+uno::Reference xTextDocument(mxComponent, 
uno::UNO_QUERY);
+uno::Reference xText(xTextDocument->getText(), 
uno::UNO_QUERY);
+uno::Reference xEnd = xText->getEnd();
+paste("fdo63428.rtf", xEnd);
+
+// Additionally, commented range was imported as a normal comment.
+CPPUNIT_ASSERT_EQUAL(OUString("TextFieldStart"), 
getProperty(getRun(getParagraph(1), 2), "TextPortionType"));
+CPPUNIT_ASSERT_EQUAL(OUString("TextFieldEnd"), 
getProperty(getRun(getParagraph(1), 4), "TextPortionType"));
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index a1a4d66..467e587 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -306,7 +306,7 @@ void DomainMapper_Impl::RemoveLastParagraph( )
 uno::Reference 
xParagraph(xEnumeration->nextElement(), uno::UNO_QUERY);
 xParagraph->dispose();
 }
-else
+else if (xCursor.is())
 {
 xCursor->goLeft( 1, true );
 // If this is a text on a shape, possibly the text has the trailing
@@ -1587,7 +1587,7 @@ void DomainMapper_Impl::PushAnnotation()
 uno::Reference< text::XText > xAnnotationText;
 m_xAnnotationField->getPropertyValue("TextRange") >>= xAnnotationText;
 m_aTextAppendStack.push(TextAppendContext(uno::Reference< 
text::XTextAppend >( xAnnotationText, uno::UNO_QUERY_THROW ),
-m_bIsNewDoc ? uno::Reference() : 
m_xBodyText->createTextCursorByRange(xAnnotationText->getStart(;
+m_bIsNewDoc ? uno::Reference() : 
xAnnotationText->createTextCursorByRange(xAnnotationText->getStart(;
 }
 catch( const uno::Exception& )
 {
@@ -3610,8 +3610,13 @@ void DomainMapper_Impl::AddAnnotationPosition(const bool 
bStart)
 uno::Reference xCurrent;
 if (xTextAppend.is())
 {
-uno::Reference xCursor = 
xTextAppend->createTextCursorByRange(xTextAppend->getEnd());
-xCurrent = xCursor->getStart();
+uno::Reference 

[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - sw/qa writerfilter/source

2013-08-11 Thread Miklos Vajna
 sw/qa/extras/rtfimport/data/fdo53556.rtf   |   49 ++
 sw/qa/extras/rtfimport/data/posh-posv.rtf  |   24 +
 sw/qa/extras/rtfimport/rtfimport.cxx   |   28 +
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |   40 ++--
 writerfilter/source/rtftok/rtfdocumentimpl.hxx |5 +
 writerfilter/source/rtftok/rtfsdrimport.cxx|  118 +
 writerfilter/source/rtftok/rtfsdrimport.hxx|8 +
 7 files changed, 244 insertions(+), 28 deletions(-)

New commits:
commit b93ad36d89b16890ba213c9e5e44973591a2d65c
Author: Miklos Vajna 
Date:   Sat Jun 15 19:05:50 2013 +0200

fdo#53556 RTF import: fix visibility and text wrapping issues

This is a backport of 6 commits from master:

- the first 3 are earlier fixes on master, without them the test doc
  has only 1 shape imported out of 3 (on master, this was already fine)
- the next 2 are the real fixes
- the last one is the testcase

(cherry picked from commits 9d640dc6ad0f0b58fa62b70f78478e2bc8796e69,
2fc088afdf6dcb2defbd462a9e64ba7e53ba5caf,
4ab658b56f5c6ff0082d38d8ace1924d11e30e96,
03f0cbd354646733977e4dec754c0113a5cbc3c9,
9f1f7199736e2ae07b34849ba66f61a1ef5782e8 and
aa6959ba2c4ef1b718d8249fd47faaf677b16111)

Conflicts:
sw/qa/extras/rtfimport/rtfimport.cxx
writerfilter/source/rtftok/rtfdocumentimpl.cxx
writerfilter/source/rtftok/rtfdocumentimpl.hxx
writerfilter/source/rtftok/rtfsdrimport.cxx

Change-Id: If58376aec31ab00cab19221beed73e8275a834d2
Reviewed-on: https://gerrit.libreoffice.org/5328
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sw/qa/extras/rtfimport/data/fdo53556.rtf 
b/sw/qa/extras/rtfimport/data/fdo53556.rtf
new file mode 100644
index 000..aafa11c
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo53556.rtf
@@ -0,0 +1,49 @@
+{\rtf1\ansi\deff0\viewkind1\paperw12240\paperh15840\marglsxn0\margrsxn0\margtsxn0\margbsxn0
+{\shp\shpbxpage\shpbypage\shpwr5\shpfhdr0\shpfblwtxt0\shpz3\shpleft1000\shpright12000\shptop1000\shpbottom1800
+{\sp
+{\sn fFilled}
+{\sv 0}
+}
+{\shpinst
+{\sp
+{\sn fLine}
+{\sv 0}
+}
+{\shptxt
+{\pard\cb1 \qc\sl367 \f0\fs32\b\cf2 ARL STATISTICS 2011-2012\line 
WORKSHEET\plain\par}
+}
+}
+}
+{\shp\shpbxpage\shpbypage\shpwr5\shpfhdr0\shpfblwtxt0\shpz18\shpleft1000\shpright4700\shptop900\shpbottom15040
+{\sp
+{\sn fFilled}
+{\sv 0}
+}
+{\shpinst
+{\sp
+{\sn shapeType}
+{\sv 1}
+}
+{\sp
+{\sn fLine}
+{\sv 0}
+}
+}
+}
+{\shp\shpbxpage\shpbypage\shpwr5\shpfhdr0\shpfblwtxt0\shpz2\shpleft1000\shpright12000\shptop2480\shpbottom3320
+{\sp
+{\sn fFilled}
+{\sv 0}
+}
+{\shpinst
+{\sp
+{\sn fLine}
+{\sv 0}
+}
+{\shptxt
+{\pard\cb1 \ql\sl252 \f0\fs22\cf2 This worksheet is designed to help you plan 
your submission for the 2011-2012 ARL Statistics. The figures on this worksheet 
should be similar to those in the Summary page of your web form, except in 
cases where data are unavailable. If an exact figure is unavailable, use NA/UA. 
If the appropriate answer is zero or none, use 0.\plain\par}
+}
+}
+}
+\par
+}
diff --git a/sw/qa/extras/rtfimport/data/posh-posv.rtf 
b/sw/qa/extras/rtfimport/data/posh-posv.rtf
new file mode 100644
index 000..5ff1fe8
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/posh-posv.rtf
@@ -0,0 +1,24 @@
+{\rtf1
+{\shp
+{\*\shpinst\shpleft0\shptop0\shpright3727\shpbottom2212\shpfhdr0\shpbxcolumn\shpbxignore\shpbypara\shpbyignore\shpwr3\shpwrk0\shpfblwtxt0\shpz0\shplid1026
+{\sp
+{\sn shapeType}
+{\sv 202}
+}
+{\shptxt test}
+{\sp
+{\sn fFitShapeToText}
+{\sv 1}
+}
+{\sp
+{\sn posh}
+{\sv 2}
+}
+{\sp
+{\sn posv}
+{\sv 2}
+}
+}
+}
+\par
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx 
b/sw/qa/extras/rtfimport/rtfimport.cxx
index d432f0b..0a56525 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -10,6 +10,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -34,6 +35,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 
 #include 
@@ -150,6 +153,8 @@ public:
 void testFdo67365();
 void testFdo67498();
 void testFdo47440();
+void testPoshPosv();
+void testFdo53556();
 
 CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -287,6 +292,8 @@ void Test::run()
 {"fdo67365.rtf", &Test::testFdo67365},
 {"fdo67498.rtf", &Test::testFdo67498},
 {"fdo47440.rtf", &Test::testFdo47440},
+{"posh-posv.rtf", &Test::testPoshPosv},
+{"fdo53556.rtf", &Test::testFdo53556},
 };
 header();
 for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
@@ -1389,6 +1396,27 @@ void Test::testFdo47440()
 CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, 
getProperty(xDraws->getByIndex(0), "VertOrientRelation"));
 }
 
+void Test::testPoshPosv()
+{
+uno::Reference xDrawPageSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xDraws(xDrawPageSupplier->

[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - sw/qa writerfilter/source

2013-08-08 Thread Miklos Vajna
 sw/qa/extras/rtfimport/data/fdo47440.rtf   |   27 +
 sw/qa/extras/rtfimport/rtfimport.cxx   |   11 ++
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |   21 ---
 writerfilter/source/rtftok/rtfdocumentimpl.hxx |6 +++--
 4 files changed, 56 insertions(+), 9 deletions(-)

New commits:
commit 88fec7695f5f3c9574bc305e31120758004493cf
Author: Miklos Vajna 
Date:   Tue Aug 6 16:31:29 2013 +0200

fdo#47440 import RTF_SHPBX/YPAGE for Writer pictures, too

Previously this was only handled for drawinglayer shapes.

(cherry picked from commit b755df14a431543f1b70246a5e58830a0a480602)

Change-Id: I7ce440a27ebe44fc867b8a7f4ee62217076677f0
Reviewed-on: https://gerrit.libreoffice.org/5303
Reviewed-by: Luboš Luňák 
Tested-by: Luboš Luňák 

diff --git a/sw/qa/extras/rtfimport/data/fdo47440.rtf 
b/sw/qa/extras/rtfimport/data/fdo47440.rtf
new file mode 100644
index 000..e21627e
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo47440.rtf
@@ -0,0 +1,27 @@
+{\rtf1\ansi\deff0
+\viewkind1\paperw11900\paperh16840\marglsxn400\margrsxn400\margtsxn400\margbsxn400\deftab800
+{\shp
+{\*\shpinst\shpbxpage\shpbypage\shpwr5\shpfhdr0\shpfblwtxt0\shpz5\shpleft9700\shpright11420\shptop400\shpbottom1460
+{\sp
+{\sn shapeType}
+{\sv 75}
+}
+{\sp
+{\sn fFilled}
+{\sv 0}
+}
+{\sp
+{\sn fLockAspectRatio}
+{\sv 0}
+}
+{\sp
+{\sn pib}
+{\sv 
+{\pict\pngblip
+47494638396110001000d5ffffc0c0c0555f00aafcfcfcf6f6f6eaeaeae6e6e6e4e4e4e3e3e3c2c2c2c1c1c1bcbcbcb5b5b5b3b3b3b0b0b0adadada5a5a5a2a2a2a1a1a19f9f9f9494948a8a8a888686867b7b7b6c6c6c5c5c5c4e4e4e4b4b4b4747474646463d3d3d3c3c3c2e2e2e2525251b1b1b1818181010100909090606060303030021f9040102002c1000100684408170482c0a06c8a4728924389f506833b281302a8e6b164b18103024c52111504cca67332102e0042e9a40d9319f8300a343c1200f54e47f7e2a1e0b0a7d0d728a010d838400261a7c0d94947784252700127e9d159f6c8411140019080ea7a9a85f842122281612b1b3b25d6b1f29291d0fbbbdbc5d5e51c34e4cc64a46c94341003b}
+}
+}
+}
+}
+\par
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx 
b/sw/qa/extras/rtfimport/rtfimport.cxx
index dd8b72c..d432f0b 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -149,6 +149,7 @@ public:
 void testFdo64637();
 void testFdo67365();
 void testFdo67498();
+void testFdo47440();
 
 CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -285,6 +286,7 @@ void Test::run()
 {"fdo64637.rtf", &Test::testFdo64637},
 {"fdo67365.rtf", &Test::testFdo67365},
 {"fdo67498.rtf", &Test::testFdo67498},
+{"fdo47440.rtf", &Test::testFdo47440},
 };
 header();
 for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
@@ -1378,6 +1380,15 @@ void Test::testFdo67498()
 CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(5954)), 
getProperty(getStyles("PageStyles")->getByName(DEFAULT_STYLE), 
"LeftMargin"));
 }
 
+void Test::testFdo47440()
+{
+// Vertical and horizontal orientation of the picture wasn't imported (was 
text::RelOrientation::FRAME).
+uno::Reference xDrawPageSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, 
getProperty(xDraws->getByIndex(0), "HoriOrientRelation"));
+CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, 
getProperty(xDraws->getByIndex(0), "VertOrientRelation"));
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 5ff3132..5895057 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -840,17 +840,20 @@ int RTFDocumentImpl::resolvePict(bool bInline)
 if (aAnchorWrapAttributes.size())
 aAnchorSprms.set(NS_ooxml::LN_EG_WrapType_wrapSquare, 
pAnchorWrapValue);
 
-// See OOXMLFastContextHandler::positionOffset(), we can't just put 
values in an RTFValue.
+// See OOXMLFastContextHandler::positionOffset(), we can't just put 
offset values in an RTFValue.
+RTFSprms aPoshSprms;
+if (m_aStates.top().aShape.nHoriOrientRelationToken > 0)
+aPoshSprms.set(NS_ooxml::LN_CT_PosH_relativeFrom, 
RTFValue::Pointer_t(new 
RTFValue(m_aStates.top().aShape.nHoriOrientRelationToken)));
 if (m_aStates.top().aShape.nLeft > 0)
-{
 
writerfilter::dmapper::PositionHandler::setPositionOffset(OUString::number(MM100_TO_EMU(m_aStates.top().aShape.nLeft)),
 false);
-aAnchorSprms.set(NS_ooxml::LN_CT_Anchor_positionH, 
RTFValue::Pointer_t(new RTFValue(RTFSprms(;
-}
+aAnchorSprms.set(NS_ooxml::LN_CT_Anchor_posi

[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - sw/qa writerfilter/source

2013-08-07 Thread Miklos Vajna
 sw/qa/extras/rtfimport/data/fdo67498.rtf|5 ++
 sw/qa/extras/rtfimport/rtfimport.cxx|8 
 writerfilter/source/dmapper/PropertyMap.cxx |   47 
 writerfilter/source/dmapper/PropertyMap.hxx |2 +
 4 files changed, 43 insertions(+), 19 deletions(-)

New commits:
commit 0fabc1154c962e8f2884f9afaa37b666b08cf833
Author: Miklos Vajna 
Date:   Mon Aug 5 17:08:20 2013 +0200

fdo#67498 RTF import: fix missing margins vs continuous section breaks

The document had 3 sections, separated by continuous section breaks.
Previously only margins from the last section were imported, this way
the first page had default margins.

Now margins are also applied when we hit continuous section breaks. This
way margin values from the last section break affecting the page wins. A
later commit could improve this further by setting the minimum of these
and setting a section margin for each non-minimal sections.

(cherry picked from commit c7884509a84d46a9d99b2950159d949589862f3a)

Conflicts:
writerfilter/source/dmapper/PropertyMap.cxx

Change-Id: I4d9a4585e795220533909bd1d467d933caaa0d71
Reviewed-on: https://gerrit.libreoffice.org/5286
Reviewed-by: Bosdonnat Cedric 
Tested-by: Bosdonnat Cedric 

diff --git a/sw/qa/extras/rtfimport/data/fdo67498.rtf 
b/sw/qa/extras/rtfimport/data/fdo67498.rtf
new file mode 100644
index 000..f1058c0
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo67498.rtf
@@ -0,0 +1,5 @@
+{\rtf1\paperw11906\paperh16838\margl5954\margr454\margt567\margb8505\sectd\sbknone
+a\sect\sectd\sbknone
+b\sect\sectd
+c\par
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx 
b/sw/qa/extras/rtfimport/rtfimport.cxx
index 455c3a2..dd8b72c 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -148,6 +148,7 @@ public:
 void testFdo54900();
 void testFdo64637();
 void testFdo67365();
+void testFdo67498();
 
 CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -283,6 +284,7 @@ void Test::run()
 {"fdo54900.rtf", &Test::testFdo54900},
 {"fdo64637.rtf", &Test::testFdo64637},
 {"fdo67365.rtf", &Test::testFdo67365},
+{"fdo67498.rtf", &Test::testFdo67498},
 };
 header();
 for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
@@ -1370,6 +1372,12 @@ void Test::testFdo67365()
 CPPUNIT_ASSERT_EQUAL(style::ParagraphAdjust_LEFT, 
static_cast(getProperty(getParagraphOfText(1,
 xCell->getText()), "ParaAdjust")));
 }
 
+void Test::testFdo67498()
+{
+// Left margin of the default page style wasn't set (was 2000).
+CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(5954)), 
getProperty(getStyles("PageStyles")->getByName(DEFAULT_STYLE), 
"LeftMargin"));
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/dmapper/PropertyMap.cxx 
b/writerfilter/source/dmapper/PropertyMap.cxx
index 9de69fc..623c20c8 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -820,6 +820,29 @@ uno::Reference 
lcl_GetRangeProperties(bool bIsFirstSection,
 return xRangeProperties;
 }
 
+void SectionPropertyMap::HandleMarginsHeaderFooter(DomainMapper_Impl& rDM_Impl)
+{
+if( m_nDzaGutter > 0 )
+{
+//todo: iGutterPos from DocProperties are missing
+if( m_bGutterRTL )
+m_nRightMargin += m_nDzaGutter;
+else
+m_nLeftMargin += m_nDzaGutter;
+}
+operator[]( PropertyDefinition( PROP_LEFT_MARGIN, false )) =  
uno::makeAny( m_nLeftMargin  );
+operator[]( PropertyDefinition( PROP_RIGHT_MARGIN, false )) = 
uno::makeAny( m_nRightMargin );
+
+if (rDM_Impl.m_oBackgroundColor)
+operator[](PropertyDefinition(PROP_BACK_COLOR, false)) = 
uno::makeAny(*rDM_Impl.m_oBackgroundColor);
+
+/*** if headers/footers are available then the top/bottom margins of the
+  header/footer are copied to the top/bottom margin of the page
+  */
+CopyLastHeaderFooter( false, rDM_Impl );
+PrepareHeaderFooterProperties( false );
+}
+
 void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
 {
 PropertyNameSupplier& rPropNameSupplier = 
PropertyNameSupplier::GetPropertyNameSupplier();
@@ -868,6 +891,10 @@ void SectionPropertyMap::CloseSectionGroup( 
DomainMapper_Impl& rDM_Impl )
 try
 {
 
xRangeProperties->setPropertyValue(rPropNameSupplier.GetName(PROP_PAGE_DESC_NAME),
 uno::makeAny(aName));
+uno::Reference xPageStyle 
(rDM_Impl.GetPageStyles()->getByName(aName), uno::UNO_QUERY_THROW);
+HandleMarginsHeaderFooter(rDM_Impl);
+if (rDM_Impl.IsNewDoc())
+_ApplyProperties(xPageStyle);
 }
 catch( const uno::Exception& )
 {
@@ -899,25 +926,7 @@

[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - sw/qa writerfilter/source

2013-07-28 Thread Miklos Vajna
 sw/qa/extras/rtfimport/data/fdo67365.rtf   |   35 +
 sw/qa/extras/rtfimport/rtfimport.cxx   |   17 
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |8 -
 3 files changed, 58 insertions(+), 2 deletions(-)

New commits:
commit 336efde38d46fcf57ae7937c2ce4ffd35f052a10
Author: Miklos Vajna 
Date:   Sat Jul 27 00:06:51 2013 +0200

fdo#67365 fix RTF import of inherited row props wrt unusual group stack

Inheriting row properties (in particular, the number of cells) should be
independent from the RTF parser stack, but they were not.

Also fix two more problems once the lost rows reappeared:

- unequal cell widths were equal
- some cells were aligned to center instead of to left

(cherry picked from commits 494937776956370eda868f91922c4cff34656050,
986ebb668d45a42bc1e8b744980619857e891ef5,
165cd8332a0844314e698cf59936799676257ea1 and
83e0489217fd4b0fcf3ab62d002257b47e7a6459)

Conflicts:
sw/qa/extras/rtfimport/rtfimport.cxx

Change-Id: I273d89a0708601a38dd8bda734a72b4c92da2cc4
Reviewed-on: https://gerrit.libreoffice.org/5137
Reviewed-by: Fridrich Strba 
Tested-by: Fridrich Strba 

diff --git a/sw/qa/extras/rtfimport/data/fdo67365.rtf 
b/sw/qa/extras/rtfimport/data/fdo67365.rtf
new file mode 100755
index 000..07755cc
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo67365.rtf
@@ -0,0 +1,35 @@
+{\rtf1
+\paperw11906\paperh16838\margl1134\margr567\margt851\margb567 
\widowctrl\ftnbj\aenddoc\hyphcaps0\formshade\viewkind1\viewscale100\pgbrdrhead\pgbrdrfoot
 \fet0
+\sectd \linex0\headery397\footery397\colsx709\endnhere\sectdefaultcl
+\trowd \trgaph28\trleft-28\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 
\trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 
\trbrdrv\brdrs\brdrw10 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 
\clbrdrb\brdrs\brdrw10 \clbrdrr \brdrs\brdrw10 \cltxlrtb 
\cellx5387\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 
\clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb \cellx10206
+\pard \li57\widctlpar\intbl\adjustright 
+{\fs22 A1\cell }
+\pard \qc\widctlpar\intbl\adjustright 
+{\fs22 
+\cell }
+\pard \widctlpar\intbl\adjustright 
+{\fs22 \row }
+\trowd \trgaph28\trleft-28\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 
\trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 
\trbrdrv\brdrs\brdrw10 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 
\clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb 
\cellx5387\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 
\clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb \cellx10206
+\pard \li57\widctlpar\intbl\adjustright 
+{
+\fs22 A2\cell }
+\pard \qc\widctlpar\intbl\adjustright 
+{\fs22 \cell }
+\pard \widctlpar\intbl\adjustright 
+{\fs22 \row }
+\pard \li57\widctlpar\intbl\adjustright 
+{\fs22 A3\cell }
+\pard 
+\qc\widctlpar\intbl\adjustright 
+{\fs22 \cell }
+\pard \widctlpar\intbl\adjustright 
+{\fs22 \row }
+\trowd \trgaph28\trleft-28\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 
\trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv 
\brdrs\brdrw10 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 
\clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb 
\cellx5387\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 
\clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb \cellx10206
+\pard \li57\widctlpar\intbl\adjustright 
+{\fs22 A4\cell \cell }
+\pard \widctlpar\intbl\adjustright 
+{\fs22 \row }
+\pard \qj\sb120\widctlpar\adjustright 
+foo
+\par
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx 
b/sw/qa/extras/rtfimport/rtfimport.cxx
index 9a6974f..455c3a2 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -147,6 +147,7 @@ public:
 void testFdo66565();
 void testFdo54900();
 void testFdo64637();
+void testFdo67365();
 
 CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -281,6 +282,7 @@ void Test::run()
 {"fdo66565.rtf", &Test::testFdo66565},
 {"fdo54900.rtf", &Test::testFdo54900},
 {"fdo64637.rtf", &Test::testFdo64637},
+{"fdo67365.rtf", &Test::testFdo67365},
 };
 header();
 for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
@@ -1353,6 +1355,21 @@ void Test::testFdo64637()
 CPPUNIT_ASSERT_EQUAL(OUString("bbb"), getProperty(xPropertySet, 
"Company"));
 }
 
+void Test::testFdo67365()
+{
+uno::Reference xTextTablesSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
+uno::Reference xTable(xTables->getByIndex(0), 
uno::UNO_QUERY);
+uno::Reference xRows = xTable->getRows();
+// The table only had 3 rows.
+CPPUNIT_ASSERT_EQUAL(sal_Int32(4), xRows->getCount());
+// This was 4999, i.e. the two cells of the row had equal widths instead 
of a larger and a smaller cell.

[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - sw/qa writerfilter/source

2013-07-23 Thread Miklos Vajna
 sw/qa/extras/rtfimport/data/fdo64637.rtf   |   13 +
 sw/qa/extras/rtfimport/rtfimport.cxx   |   10 ++
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |9 +++--
 3 files changed, 30 insertions(+), 2 deletions(-)

New commits:
commit 58a285d8d504c5ae952d314238dbbaa873b51db7
Author: Miklos Vajna 
Date:   Tue Jul 23 12:01:47 2013 +0200

fdo#64637 RTF import: handle multiple RTF_COMPANY

Instead of unconditionally calling addProperty(), first check the
existence with hasPropertyByName() and call setPropertyValue() instead,
if necessary.

(cherry picked from commit bb67e709b70919efb41ec41e93dd92953dc6a003)

Change-Id: Ie0a075bbfe6eaa1f66726c456105dcdef9001d30
Reviewed-on: https://gerrit.libreoffice.org/5049
Reviewed-by: Fridrich Strba 
Tested-by: Fridrich Strba 

diff --git a/sw/qa/extras/rtfimport/data/fdo64637.rtf 
b/sw/qa/extras/rtfimport/data/fdo64637.rtf
new file mode 100644
index 000..9bec690
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo64637.rtf
@@ -0,0 +1,13 @@
+{\rtf1
+{\info
+{\upr
+{\company aaa}
+{\*\ud
+{\company
+bbb
+}
+}
+}
+}
+foo
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx 
b/sw/qa/extras/rtfimport/rtfimport.cxx
index 58353bf..9a6974f 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -146,6 +146,7 @@ public:
 void testFdo39001();
 void testFdo66565();
 void testFdo54900();
+void testFdo64637();
 
 CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -279,6 +280,7 @@ void Test::run()
 {"fdo39001.rtf", &Test::testFdo39001},
 {"fdo66565.rtf", &Test::testFdo66565},
 {"fdo54900.rtf", &Test::testFdo54900},
+{"fdo64637.rtf", &Test::testFdo64637},
 };
 header();
 for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
@@ -1343,6 +1345,14 @@ void Test::testFdo54900()
 CPPUNIT_ASSERT_EQUAL(style::ParagraphAdjust_CENTER, 
static_cast(getProperty(getParagraphOfText(1,
 xCell->getText()), "ParaAdjust")));
 }
 
+void Test::testFdo64637()
+{
+// The problem was that the custom "Company" property was added twice, the 
second invocation resulted in an exception.
+uno::Reference 
xDocumentPropertiesSupplier(mxComponent, uno::UNO_QUERY);
+uno::Reference 
xPropertySet(xDocumentPropertiesSupplier->getDocumentProperties()->getUserDefinedProperties(),
 uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString("bbb"), getProperty(xPropertySet, 
"Company"));
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 5e93fc2..769191b 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -4006,11 +4006,16 @@ int RTFDocumentImpl::popState()
 case DESTINATION_COMPANY:
 {
 OUString aName = aState.nDestinationState == 
DESTINATION_OPERATOR ? OUString("Operator") : OUString("Company");
+uno::Any aValue = 
uno::makeAny(m_aStates.top().aDestinationText.makeStringAndClear());
 if (m_xDocumentProperties.is())
 {
 uno::Reference 
xUserDefinedProperties = m_xDocumentProperties->getUserDefinedProperties();
-xUserDefinedProperties->addProperty(aName, 
beans::PropertyAttribute::REMOVABLE,
-
uno::makeAny(m_aStates.top().aDestinationText.makeStringAndClear()));
+uno::Reference 
xPropertySet(xUserDefinedProperties, uno::UNO_QUERY);
+uno::Reference xPropertySetInfo = 
xPropertySet->getPropertySetInfo();
+if (xPropertySetInfo->hasPropertyByName(aName))
+xPropertySet->setPropertyValue(aName, aValue);
+else
+xUserDefinedProperties->addProperty(aName, 
beans::PropertyAttribute::REMOVABLE, aValue);
 }
 }
 break;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - sw/qa writerfilter/source

2013-07-22 Thread Miklos Vajna
 sw/qa/extras/ooxmlimport/data/fdo65632.docx   |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx  |   13 ++
 writerfilter/source/dmapper/DomainMapper.cxx  |6 ++--
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   28 +++---
 writerfilter/source/dmapper/DomainMapper_Impl.hxx |2 -
 writerfilter/source/ooxml/model.xml   |4 ++-
 writerfilter/source/rtftok/rtfdocumentimpl.cxx|   21 +++-
 writerfilter/source/rtftok/rtfdocumentimpl.hxx|1 
 8 files changed, 56 insertions(+), 19 deletions(-)

New commits:
commit fe5e35009f23b025ac58fcb5abc892a90c6a264c
Author: Miklos Vajna 
Date:   Wed Jul 17 15:32:03 2013 +0200

fdo#65632 RTF import: send NS_ooxml::LN_trackchange only once for one range

The problem was that in case we had
{\deleted foo\b bar}
then both "foo" and "bar" triggered a trackchange, but "}" only ended
one, resulting in overlapping redline ranges. This was cought by core,
but caused a performance problem.

For the first bugdoc, before:
real3m57.803s
after:
real0m3.072s

(cherry picked from commits 7c0a1557406bb8145f8035ce86d31e927667,
ed187fcbd457d01be6ac382d61b493039a5af7d5 and
54518a209d0ffe00f8e391472da92e398c474392 and
9f7676033585ab3bf352d5dc2ef43a3a9d8d5c46)

Conflicts:
writerfilter/source/rtftok/rtfdocumentimpl.cxx
writerfilter/source/rtftok/rtfdocumentimpl.hxx

Change-Id: Ibf6f2db30109f0b9a2571d2e4fb3cc76294f68d1
Reviewed-on: https://gerrit.libreoffice.org/4964
Reviewed-by: Fridrich Strba 
Tested-by: Fridrich Strba 

diff --git a/sw/qa/extras/ooxmlimport/data/fdo65632.docx 
b/sw/qa/extras/ooxmlimport/data/fdo65632.docx
new file mode 100755
index 000..8c336c2
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/fdo65632.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 26ecdf3..1db7829 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -124,6 +124,7 @@ public:
 void testN820504();
 void testFdo43641();
 void testFdo46361();
+void testFdo65632();
 
 CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -213,6 +214,7 @@ void Test::run()
 {"n820504.docx", &Test::testN820504},
 {"fdo43641.docx", &Test::testFdo43641},
 {"fdo46361.docx", &Test::testFdo46361},
+{"fdo65632.docx", &Test::testFdo65632},
 };
 header();
 for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
@@ -1511,6 +1513,17 @@ void Test::testFdo46361()
 CPPUNIT_ASSERT_EQUAL(OUString("text\ntext\n"), 
uno::Reference(xGroupShape->getByIndex(2), 
uno::UNO_QUERY)->getString());
 }
 
+void Test::testFdo65632()
+{
+// The problem was that the footnote text had fake redline: only the body
+// text has redline in fact.
+uno::Reference xFootnotesSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xFootnotes(xFootnotesSupplier->getFootnotes(), uno::UNO_QUERY);
+uno::Reference xText(xFootnotes->getByIndex(0), 
uno::UNO_QUERY);
+//uno::Reference xParagraph = getParagraphOfText(1, 
xText);
+CPPUNIT_ASSERT_EQUAL(OUString("Text"), 
getProperty(getRun(getParagraphOfText(1, xText), 1), 
"TextPortionType"));
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index 91d5d94..fb4786e 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -1402,9 +1402,6 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
 case NS_ooxml::LN_CT_Color_themeShade:
 //unsupported
 break;
-case NS_ooxml::LN_endtrackchange:
-m_pImpl->RemoveCurrentRedline( );
-break;
 case NS_ooxml::LN_CT_DocGrid_linePitch:
 {
 //see SwWW8ImplReader::SetDocumentGrid
@@ -3276,6 +3273,9 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, 
PropertyMapPtr rContext, SprmType
 m_pImpl->EndParaChange( );
 }
 break;
+case NS_ooxml::LN_endtrackchange:
+m_pImpl->RemoveCurrentRedline( );
+break;
 case NS_ooxml::LN_CT_RPrChange_rPr:
 break;
 case NS_ooxml::LN_object:
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index e2b2ea5..c437471 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -208,6 +208,8 @@ DomainMapper_Impl::DomainMapper_Impl(
 m_bUsingEnhancedFields = lcl_IsUsingEnhancedFields( m_xComponentContext );
 
 m_pSdtHelper = new SdtHelper(*this);
+
+m_aRedlines.push(std::vector());
 }
 
 
@@ -1449,6 +1451,9 @@ void DomainMapper_Impl::PushFootOrEndnote( bool 
bIsFootnote )
 {
 try
 

[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - sw/qa writerfilter/source

2013-07-15 Thread Miklos Vajna
 sw/qa/extras/rtfimport/data/fdo54900.rtf   |   17 +
 sw/qa/extras/rtfimport/rtfimport.cxx   |   13 +
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |1 +
 3 files changed, 31 insertions(+)

New commits:
commit 49d3f271b0da11f1793135b067b9b5d4f48cf537
Author: Miklos Vajna 
Date:   Mon Jul 15 11:24:39 2013 +0200

fdo#54900 RTF import: support setting para align after text

Both Word and Writer typically write all paragraph properties before the
first text in each paragraph, but at least for paragraph alignment, it's
valid to write them at the end.

(cherry picked from commit 431853bfae7dccd139804caf7ac2505a7c283e63)

Change-Id: I0337e63678ad45c662a204ab2fc59378607abe74
Reviewed-on: https://gerrit.libreoffice.org/4913
Reviewed-by: David Tardon 
Tested-by: David Tardon 

diff --git a/sw/qa/extras/rtfimport/data/fdo54900.rtf 
b/sw/qa/extras/rtfimport/data/fdo54900.rtf
new file mode 100644
index 000..0ebd9d1
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo54900.rtf
@@ -0,0 +1,17 @@
+{\rtf1\ansi\ansicpg1251\deflang1033
+{\fonttbl
+{\f0\froman\fcharset204 TIMES NEW ROMAN;\f1\froman\fcharset204 TIMES NEW 
ROMAN;\f2\froman\fcharset204 ARIAL;\f3\froman\fcharset204 ARIAL;}
+}
+\sectd\lndscpsxn\pgwsxn16840\pghsxn11907\marglsxn1133\margrsxn850\margtsxn850\margbsxn850\linex0\headery709\footery709\colsx709\endnhere\sectdefaultcl
+\b0\i0\nosupersub\b\f2 \fs28 
+{\qc
+\b0\i0\nosupersub\b\f3 \fs24 foo
+\b0\i0\nosupersub\b\f2 \fs24 \par}
+{\trowd\trql\clbrdrt\brdrdb\brdrw10\clbrdrl\brdrdb\brdrw10\clbrdrr\brdrs\brdrw10\cellx453
+\intbl
+{\b\f0\fs16 N
+}
+{\qc\b\f0\fs16\li0\ri0 \cell}
+{\row}
+\pard}
+\par}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx 
b/sw/qa/extras/rtfimport/rtfimport.cxx
index fd05bdc..58353bf 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -17,6 +17,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -144,6 +145,7 @@ public:
 void testN823655();
 void testFdo39001();
 void testFdo66565();
+void testFdo54900();
 
 CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -276,6 +278,7 @@ void Test::run()
 {"n823655.rtf", &Test::testN823655},
 {"fdo39001.rtf", &Test::testFdo39001},
 {"fdo66565.rtf", &Test::testFdo66565},
+{"fdo54900.rtf", &Test::testFdo54900},
 };
 header();
 for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
@@ -1330,6 +1333,16 @@ void Test::testFdo66565()
 CPPUNIT_ASSERT_EQUAL(sal_Int16(304), getProperty< 
uno::Sequence >(xTableRows->getByIndex(1), 
"TableColumnSeparators")[0].Position);
 }
 
+void Test::testFdo54900()
+{
+uno::Reference xTextTablesSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
+uno::Reference xTable(xTables->getByIndex(0), 
uno::UNO_QUERY);
+uno::Reference xCell(xTable->getCellByName("A1"), 
uno::UNO_QUERY);
+// Paragraph was aligned to left, should be center.
+CPPUNIT_ASSERT_EQUAL(style::ParagraphAdjust_CENTER, 
static_cast(getProperty(getParagraphOfText(1,
 xCell->getText()), "ParaAdjust")));
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 8bf0e06..fe15892 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -2006,6 +2006,7 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
 {
 RTFValue::Pointer_t pValue(new RTFValue(nParam));
 m_aStates.top().aParagraphSprms.set(NS_sprm::LN_PJc, pValue);
+m_bNeedPap = true;
 return 0;
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - sw/qa writerfilter/source

2013-07-09 Thread Miklos Vajna
 sw/qa/extras/rtfimport/data/fdo66565.rtf   |   35 +
 sw/qa/extras/rtfimport/rtfimport.cxx   |   12 
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |5 ++-
 3 files changed, 50 insertions(+), 2 deletions(-)

New commits:
commit 0e24e60733c8743de89abd779d77f1a8784894a6
Author: Miklos Vajna 
Date:   Tue Jul 9 11:29:33 2013 +0200

fdo#66565 RTF import: don't produce cell widths smaller than MINLAY

In case we have a table of a given width and the second (or later) row
has fewer cells, we have to add a fake cell to such a row. However, it
doesn't make sense to do this when the difference is only a few twips:
we can't create such a small frame inside the cell later anyway.

Regression from c3b0f13546b30e5db3aecd311c7178e4e0933208.

(cherry picked from commit f6a00c88482ec30b61855cb6a95a5ad240b7a517)

Conflicts:
sw/qa/extras/rtfimport/rtfimport.cxx

Change-Id: Ibc0f02d4184b58bd423c3405e786e1ec25b9dd13
Reviewed-on: https://gerrit.libreoffice.org/4785
Reviewed-by: Petr Mladek 
Tested-by: Petr Mladek 

diff --git a/sw/qa/extras/rtfimport/data/fdo66565.rtf 
b/sw/qa/extras/rtfimport/data/fdo66565.rtf
new file mode 100644
index 000..2169dc3
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo66565.rtf
@@ -0,0 +1,35 @@
+{\rtf1\ansi\ansicpg1251\deflang1033
+\sectd\lndscpsxn\pgwsxn16840\pghsxn11907\marglsxn1133\margrsxn850\margtsxn850\margbsxn850\linex0\headery709\footery709\colsx709\endnhere\sectdefaultcl
+{\trowd\trql\clbrdrt\brdrdb\brdrw10\clbrdrl\brdrdb\brdrw10\clbrdrr\brdrs\brdrw10\cellx453\clbrdrt\brdrdb\brdrw10\clbrdrl\brdrs\brdrw10\clbrdrr\brdrs\brdrw10\cellx5039\clbrdrt\brdrdb\brdrw10\clbrdrb\brdrs\brdrw10\clbrdrl\brdrs\brdrw10\clbrdrr\brdrs\brdrw10\cellx7420\clbrdrt\brdrdb\brdrw10\clbrdrl\brdrs\brdrw10\clbrdrr\brdrs\brdrw10\cellx8162\clbrdrt\brdrdb\brdrw10\clbrdrb\brdrs\brdrw10\clbrdrl\brdrs\brdrw10\clbrdrr\brdrs\brdrw10\cellx13717\clbrdrt\brdrdb\brdrw10\clbrdrl\brdrs\brdrw10\clbrdrr\brdrs\brdrw10\cellx14227\clbrdrt\brdrdb\brdrw10\clbrdrl\brdrs\brdrw10\clbrdrr\brdrdb\brdrw10\cellx14850
+\intbl
+{\b\f0\fs16 A1 \cell}
+{\b\f0\fs16 B1 \cell}
+{\b\f0\fs16 C1 \cell}
+{\b\f0\fs16 D1 \cell}
+{\b\f0\fs16 E1 \cell}
+{\b\f0\fs16 F1 \cell}
+{\b\f0\fs16 G1 \cell}
+{\row}
+\trowd\trql\clbrdrb\brdrdb\brdrw10\clbrdrl\brdrdb\brdrw10\clbrdrr\brdrs\brdrw10\cellx453\clbrdrb\brdrdb\brdrw10\clbrdrl\brdrs\brdrw10\clbrdrr\brdrs\brdrw10\cellx5039\clbrdrt\brdrs\brdrw10\clbrdrb\brdrdb\brdrw10\clbrdrl\brdrs\brdrw10\clbrdrr\brdrs\brdrw10\cellx5832\clbrdrt\brdrs\brdrw10\clbrdrb\brdrdb\brdrw10\clbrdrl\brdrs\brdrw10\clbrdrr\brdrs\brdrw10\cellx6625\clbrdrt\brdrs\brdrw10\clbrdrb\brdrdb\brdrw10\clbrdrl\brdrs\brdrw10\clbrdrr\brdrs\brdrw10\cellx7418\clbrdrb\brdrdb\brdrw10\clbrdrl\brdrs\brdrw10\clbrdrr\brdrs\brdrw10\cellx8160\clbrdrt\brdrs\brdrw10\clbrdrb\brdrdb\brdrw10\clbrdrl\brdrs\brdrw10\clbrdrr\brdrs\brdrw10\cellx9123\clbrdrt\brdrs\brdrw10\clbrdrb\brdrdb\brdrw10\clbrdrl\brdrs\brdrw10\clbrdrr\brdrs\brdrw10\cellx9633\clbrdrt\brdrs\brdrw10\clbrdrb\brdrdb\brdrw10\clbrdrl\brdrs\brdrw10\clbrdrr\brdrs\brdrw10\cellx10143\clbrdrt\brdrs\brdrw10\clbrdrb\brdrdb\brdrw10\clbrdrl\brdrs\brdrw10\clbrdrr\brdrs\brdrw10\cellx10653\clbrdrt\brdrs\brdrw10\clbrdrb\brdrdb\brdrw10\clbrdr
 
l\brdrs\brdrw10\clbrdrr\brdrs\brdrw10\cellx11163\clbrdrt\brdrs\brdrw10\clbrdrb\brdrdb\brdrw10\clbrdrl\brdrs\brdrw10\clbrdrr\brdrs\brdrw10\cellx11673\clbrdrt\brdrs\brdrw10\clbrdrb\brdrdb\brdrw10\clbrdrl\brdrs\brdrw10\clbrdrr\brdrs\brdrw10\cellx12183\clbrdrt\brdrs\brdrw10\clbrdrb\brdrdb\brdrw10\clbrdrl\brdrs\brdrw10\clbrdrr\brdrs\brdrw10\cellx12693\clbrdrt\brdrs\brdrw10\clbrdrb\brdrdb\brdrw10\clbrdrl\brdrs\brdrw10\clbrdrr\brdrs\brdrw10\cellx13203\clbrdrt\brdrs\brdrw10\clbrdrb\brdrdb\brdrw10\clbrdrl\brdrs\brdrw10\clbrdrr\brdrs\brdrw10\cellx13713\clbrdrb\brdrdb\brdrw10\clbrdrl\brdrs\brdrw10\clbrdrr\brdrs\brdrw10\cellx14223\clbrdrb\brdrdb\brdrw10\clbrdrl\brdrs\brdrw10\clbrdrr\brdrdb\brdrw10\cellx14846
+\intbl
+{\b\f0\fs16 A2 \cell}
+{\b\f0\fs16 B2 \cell}
+{\b\f0\fs16 C2 \cell}
+{\b\f0\fs16 D2 \cell}
+{\b\f0\fs16 E2 \cell}
+{\b\f0\fs16 F2 \cell}
+{\b\f0\fs16 G2 \cell}
+{\b\f0\fs16 H2 \cell}
+{\b\f0\fs16 I2 \cell}
+{\b\f0\fs16 J2 \cell}
+{\b\f0\fs16 K2 \cell}
+{\b\f0\fs16 L2 \cell}
+{\b\f0\fs16 M2 \cell}
+{\b\f0\fs16 N2 \cell}
+{\b\f0\fs16 O2 \cell}
+{\b\f0\fs16 P2 \cell}
+{\b\f0\fs16 Q2 \cell}
+{\b\f0\fs16 R2 \cell}
+{\row}
+\pard}
+\par}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx 
b/sw/qa/extras/rtfimport/rtfimport.cxx
index 80b52ef..fd05bdc 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -143,6 +143,7 @@ public:
 void testParaBottomMargin();
 void testN823655();
 void testFdo39001();
+void testFdo66565();
 
 CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -274,6 +275,7 @@ void Test::run()
 {"para-bottom-margin.rtf", &Test::testParaBottomMargin},
 {"n823

[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - sw/qa writerfilter/source

2013-07-08 Thread Miklos Vajna
 sw/qa/extras/rtfimport/data/fdo39001.rtf   |   22 ++
 sw/qa/extras/rtfimport/rtfimport.cxx   |8 
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |   12 +++-
 3 files changed, 37 insertions(+), 5 deletions(-)

New commits:
commit 5430b9e0f4082025ff9bf7621d18292db0361121
Author: Miklos Vajna 
Date:   Fri Jul 5 11:37:24 2013 +0200

fdo#39001 RTF import: fix fake empty page at the end of the doc

In case we have a \sect, there was no \sbknone (so it counts as a page
break as well) and there is nothing after it, we should not make extra
efforts to make that have some effect, but adding at least one empty
paragraph to that new page.

(cherry picked from commit 4108f285207ed4a60c8876a8206bc5f2d7f05620)

Conflicts:
sw/qa/extras/rtfimport/rtfimport.cxx

Change-Id: Ibcbecabcb590ed34ef96a97698e4ab8f638d3483
Reviewed-on: https://gerrit.libreoffice.org/4737
Reviewed-by: Fridrich Strba 
Tested-by: Fridrich Strba 

diff --git a/sw/qa/extras/rtfimport/data/fdo39001.rtf 
b/sw/qa/extras/rtfimport/data/fdo39001.rtf
new file mode 100644
index 000..939b21d
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo39001.rtf
@@ -0,0 +1,22 @@
+{\rtf1 \ansi 
+{\*\generator Apache XML Graphics RTF Library;}
+\fet0 \ftnbj \paperw11905 \paperh16837 \margt2267 \margb1133 \margl1417 
\margr1417 \headery2267 \footery1984 \itap0 
+\sectd 
+{\li0 \f3 \b0 \ql \ri0 \fs24 \cf1 \i0 
+{\f3 \strike0 \ul0 \b0 \sa0 \sb0 \fs24 \cf1 \i0 
+FIRST PAGE
+\par 
+}
+}\sect \sbkpage 
+{\li0 \f3 \b0 \ql \ri0 \fs24 \cf1 \i0 
+{\f3 \strike0 \ul0 \b0 \sa0 \sb0 \fs24 \cf1 \i0 
+NEXT PAGE
+\par 
+}
+}
+{\li0 \f3 \sbkpage \b0 \ql \sect \ri0 \fs24 \cf1 \i0 
+{\f3 \strike0 \ul0 \b0 \sa0 \sb0 \fs24 \cf1 \i0 
+LAST PAGE
+\par 
+}
+}\sect }
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx 
b/sw/qa/extras/rtfimport/rtfimport.cxx
index 76967db..80b52ef 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -142,6 +142,7 @@ public:
 void testN825305();
 void testParaBottomMargin();
 void testN823655();
+void testFdo39001();
 
 CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -272,6 +273,7 @@ void Test::run()
 {"n825305.rtf", &Test::testN825305},
 {"para-bottom-margin.rtf", &Test::testParaBottomMargin},
 {"n823655.rtf", &Test::testN823655},
+{"fdo39001.rtf", &Test::testFdo39001},
 };
 header();
 for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
@@ -1310,6 +1312,12 @@ void Test::testN823655()
 CPPUNIT_ASSERT_EQUAL(sal_Int32(286), 
aCoordinates[0].Second.Value.get());
 }
 
+void Test::testFdo39001()
+{
+// Document was of 4 pages, \sect at the end of the doc wasn't ignored.
+CPPUNIT_ASSERT_EQUAL(3, getPages());
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 80db68d..1e0803a 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -505,8 +505,11 @@ void RTFDocumentImpl::sectBreak(bool bFinal = false)
 {
 SAL_INFO("writerfilter", OSL_THIS_FUNC << ": final? " << bFinal << ", 
needed? " << m_bNeedSect);
 bool bNeedSect = m_bNeedSect;
-// If there is no paragraph in this section, then insert a dummy one, as 
required by Writer
-if (m_bNeedPar)
+RTFValue::Pointer_t pBreak = 
m_aStates.top().aSectionSprms.find(NS_sprm::LN_SBkc);
+bool bContinuous = pBreak.get() && pBreak->getInt() == 0;
+// If there is no paragraph in this section, then insert a dummy one, as 
required by Writer,
+// unless this is the end of the doc, we had nothing since the last 
section break and this is not a continuous one.
+if (m_bNeedPar && !(bFinal && !m_bNeedSect && !bContinuous))
 dispatchSymbol(RTF_PAR);
 // It's allowed to not have a non-table paragraph at the end of an RTF 
doc, add it now if required.
 if (m_bNeedFinalPar && bFinal)
@@ -525,9 +528,8 @@ void RTFDocumentImpl::sectBreak(bool bFinal = false)
 // last control word in the document is a section break itself.
 if (!bNeedSect || !m_bHadSect)
 {
-RTFValue::Pointer_t pBreak = 
m_aStates.top().aSectionSprms.find(NS_sprm::LN_SBkc);
-// In case the last section is a continous one, we don't need to 
output a section break.
-if (bFinal && pBreak.get() && !pBreak->getInt())
+// In case the last section is a continuous one, we don't need to 
output a section break.
+if (bFinal && bContinuous)
 m_aStates.top().aSectionSprms.erase(NS_sprm::LN_SBkc);
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - sw/qa writerfilter/source

2013-06-28 Thread Miklos Vajna
 sw/qa/extras/rtfimport/data/n823655.rtf |   48 
 sw/qa/extras/rtfimport/rtfimport.cxx|   26 +++
 writerfilter/source/rtftok/rtfsdrimport.cxx |   14 
 3 files changed, 81 insertions(+), 7 deletions(-)

New commits:
commit 22ae9ec4cdfdd2e449f00c74c7317084e7080129
Author: Miklos Vajna 
Date:   Mon Jun 24 14:13:39 2013 +0200

bnc#823655 fix RTF import of freeform shape coordinates

E.g. 0,1 was imported as 1,0, as we did not differentiate between not
having the coordinate yet and having it as zero.

Change-Id: Ia5fbbcc791dc9c6866ffd4c146793690661d81b4
(cherry picked from commit fe8d6ffa05c467bddb3480e43d7043a3d3c9)
Reviewed-on: https://gerrit.libreoffice.org/4483
Reviewed-by: Fridrich Strba 
Tested-by: Fridrich Strba 

diff --git a/sw/qa/extras/rtfimport/data/n823655.rtf 
b/sw/qa/extras/rtfimport/data/n823655.rtf
new file mode 100644
index 000..94e73ed
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/n823655.rtf
@@ -0,0 +1,48 @@
+{\rtf1
+foo
+{\shp
+{\*\shpinst\shpleft450\shptop1904\shpright11595\shpbottom2190\shpfhdr0\shpbxpage\shpbxignore\shpbypage\shpbyignore\shpwr3\shpwrk0\shpfblwtxt1\shpz0\shplid1026
+{\sp
+{\sn shapeType}
+{\sv 0}
+}
+{\sp
+{\sn fFlipH}
+{\sv 0}
+}
+{\sp
+{\sn fFlipV}
+{\sv 0}
+}
+{\sp
+{\sn geoRight}
+{\sv 11145}
+}
+{\sp
+{\sn geoBottom}
+{\sv 286}
+}
+{\sp
+{\sn pVerticies}
+{\sv 8;4;(0,286);(11145,286);(11145,1);(0,1)}
+}
+{\sp
+{\sn pSegmentInfo}
+{\sv 2;5;16384;1;1;1;32768}
+}
+{\sp
+{\sn fFillOK}
+{\sv 1}
+}
+{\sp
+{\sn fillColor}
+{\sv 15000804}
+}
+{\sp
+{\sn fFilled}
+{\sv 1}
+}
+}
+}
+\par
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx 
b/sw/qa/extras/rtfimport/rtfimport.cxx
index bbfadcd..76967db 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -8,6 +8,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -140,6 +141,7 @@ public:
 void testFdo62044();
 void testN825305();
 void testParaBottomMargin();
+void testN823655();
 
 CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -269,6 +271,7 @@ void Test::run()
 {"fdo62044.rtf", &Test::testFdo62044},
 {"n825305.rtf", &Test::testN825305},
 {"para-bottom-margin.rtf", &Test::testParaBottomMargin},
+{"n823655.rtf", &Test::testN823655},
 };
 header();
 for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
@@ -1284,6 +1287,29 @@ void Test::testParaBottomMargin()
 CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty(getParagraph(1), 
"ParaBottomMargin"));
 }
 
+void Test::testN823655()
+{
+uno::Reference xDrawPageSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
+uno::Sequence aProps = getProperty< 
uno::Sequence >(xDraws->getByIndex(0), 
"CustomShapeGeometry");
+uno::Sequence aPathProps;
+for (int i = 0; i < aProps.getLength(); ++i)
+{
+const beans::PropertyValue& rProp = aProps[i];
+if (rProp.Name == "Path")
+aPathProps = rProp.Value.get< uno::Sequence 
>();
+}
+uno::Sequence aCoordinates;
+for (int i = 0; i < aPathProps.getLength(); ++i)
+{
+const beans::PropertyValue& rProp = aPathProps[i];
+if (rProp.Name == "Coordinates")
+aCoordinates = rProp.Value.get< 
uno::Sequence >();
+}
+// The first coordinate pair of this freeform shape was 286,0 instead of 
0,286.
+CPPUNIT_ASSERT_EQUAL(sal_Int32(286), 
aCoordinates[0].Second.Value.get());
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx 
b/writerfilter/source/rtftok/rtfsdrimport.cxx
index a984431f..07913b1 100644
--- a/writerfilter/source/rtftok/rtfsdrimport.cxx
+++ b/writerfilter/source/rtftok/rtfsdrimport.cxx
@@ -251,19 +251,19 @@ void RTFSdrImport::resolve(RTFShape& rShape)
 // The coordinates are in an (x,y) form.
 aToken = aToken.copy(1, aToken.getLength() - 2);
 sal_Int32 nI = 0;
-sal_Int32 nX = 0;
-sal_Int32 nY = 0;
+boost::optional oX;
+boost::optional oY;
 do
 {
 OUString aPoint = aToken.getToken(0, ',', nI);
-if (!nX)
-nX = aPoint.toInt32();
+if (!oX)
+oX.reset(aPoint.toInt32());
 else
-nY = aPoint.toInt32();
+oY.reset(aPoint.toInt32());
 }
 while (nI >= 0);
-aCoordinates[nIndex].First.Value <<= nX;
-aCoordinates[nIndex].Second.Value <<= nY;
+aCoordinates[nIndex].First.Value <<= *oX;

[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - sw/qa writerfilter/source

2013-06-28 Thread Miklos Vajna
 sw/qa/extras/rtfimport/data/para-bottom-margin.rtf |   14 ++
 sw/qa/extras/rtfimport/rtfimport.cxx   |8 
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |3 +++
 3 files changed, 25 insertions(+)

New commits:
commit 34a30f6e6ba7ea666bf51f89d077c5d9fb2c8bcb
Author: Miklos Vajna 
Date:   Fri Jun 21 15:48:39 2013 +0200

bnc#823655 RTF import: ignore styles without a type

Regression from 29dcdf6b56f8dbc1b7de0478afb04122f8dbf0f9.

Change-Id: I970c0e7b3652d7e6f093815b90e04e0c45904b28
(cherry picked from commit c6a941b51b68eb097d4d43323b39ff1aba4c753e)
Reviewed-on: https://gerrit.libreoffice.org/4482
Reviewed-by: Fridrich Strba 
Tested-by: Fridrich Strba 

diff --git a/sw/qa/extras/rtfimport/data/para-bottom-margin.rtf 
b/sw/qa/extras/rtfimport/data/para-bottom-margin.rtf
new file mode 100644
index 000..7bc5051
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/para-bottom-margin.rtf
@@ -0,0 +1,14 @@
+{\rtf1
+{\stylesheet
+{\ql \li0\ri0\sa200\sl276\slmult1
+\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 
\rtlch\fcs1 \af31507\afs22\alang1025 \ltrch\fcs0 
\fs22\lang4105\langfe4105\loch\f31506\hich\af31506\dbch\af31505\cgrid\langnp4105\langfenp4105
 \snext0 \sqformat \spriority0 Normal;}
+{\*\cs10 \additive \ssemihidden \sunhideused \spriority1 Default Paragraph 
Font;}
+{\*
+\ts11\tsrowd\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\trcbpat1\trcfpat1\tblind0\tblindtype3\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv
 \ql \li0\ri0\sa200\sl276\slmult1
+\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 
\rtlch\fcs1 \af31507\afs22\alang1025 \ltrch\fcs0 
\fs22\lang4105\langfe4105\loch\f31506\hich\af31506\dbch\af31505\cgrid\langnp4105\langfenp4105
 \snext11 \ssemihidden \sunhideused 
+Normal Table;}
+}
+\pard \ltrpar\ql 
\li720\ri0\sb1\sl-179\slmult0\nowidctlpar\tx9924\wrapdefault\faauto\rin0\lin720\itap0
 
+{\rtlch\fcs1 \af0\afs16 \ltrch\fcs0 
\f0\fs16\expnd-1\expndtw-5\cf1\insrsid10962741 \hich\af0\dbch\af31505\loch\f0 
hello
+\par }
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx 
b/sw/qa/extras/rtfimport/rtfimport.cxx
index 0ec3fd3..bbfadcd 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -139,6 +139,7 @@ public:
 void testFdo64671();
 void testFdo62044();
 void testN825305();
+void testParaBottomMargin();
 
 CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -267,6 +268,7 @@ void Test::run()
 {"fdo64671.rtf", &Test::testFdo64671},
 {"fdo62044.rtf", &Test::testFdo62044},
 {"n825305.rtf", &Test::testN825305},
+{"para-bottom-margin.rtf", &Test::testParaBottomMargin},
 };
 header();
 for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
@@ -1276,6 +1278,12 @@ void Test::testN825305()
 CPPUNIT_ASSERT_EQUAL(beans::PropertyState_DIRECT_VALUE, ePropertyState);
 }
 
+void Test::testParaBottomMargin()
+{
+// This was 353, i.e. bottom margin of the paragraph was 0.35cm instead of 
0.
+CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty(getParagraph(1), 
"ParaBottomMargin"));
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 5c44b25..80db68d 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -1034,6 +1034,7 @@ void RTFDocumentImpl::text(OUString& rString)
 break;
 case DESTINATION_STYLESHEET:
 case DESTINATION_STYLEENTRY:
+if 
(m_aStates.top().aTableAttributes.find(NS_rtf::LN_SGC))
 {
 RTFValue::Pointer_t pValue(new 
RTFValue(m_aStates.top().aDestinationText.makeStringAndClear()));
 
m_aStates.top().aTableAttributes.set(NS_rtf::LN_XSTZNAME1, pValue);
@@ -1043,6 +1044,8 @@ void RTFDocumentImpl::text(OUString& rString)
 );
 
m_aStyleTableEntries.insert(make_pair(m_nCurrentStyleIndex, pProp));
 }
+else
+SAL_INFO("writerfilter", "no RTF style type 
defined, ignoring");
 break;
 case DESTINATION_REVISIONTABLE:
 case DESTINATION_REVISIONENTRY:
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - sw/qa writerfilter/source

2013-06-18 Thread Miklos Vajna
 sw/qa/extras/rtfimport/data/n825305.rtf |   76 
 sw/qa/extras/rtfimport/rtfimport.cxx|   14 +
 writerfilter/source/rtftok/rtfsdrimport.cxx |5 +
 3 files changed, 95 insertions(+)

New commits:
commit 3400f0c0ff71c428c8d93bd0f04730e33cf4f7d5
Author: Miklos Vajna 
Date:   Tue Jun 18 16:22:32 2013 +0200

bnc#825305 RTF import of fFilled shape property

(cherry picked from commit b08743d3c4381a77eee6e123230fb423acfbc116)

Conflicts:
sw/qa/extras/rtfimport/rtfimport.cxx
writerfilter/source/rtftok/rtfsdrimport.cxx

Change-Id: Iaa2ff9d5d1a28aec046f885acecbd1a44c734ec0
Reviewed-on: https://gerrit.libreoffice.org/4345
Reviewed-by: Noel Power 
Tested-by: Noel Power 

diff --git a/sw/qa/extras/rtfimport/data/n825305.rtf 
b/sw/qa/extras/rtfimport/data/n825305.rtf
new file mode 100755
index 000..72a6b52
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/n825305.rtf
@@ -0,0 +1,76 @@
+{\rtf 
+\viewkind1\margl360\margr360
+\margt360\margb360\paperw12240\paperh15840\pard
+{\shp 
+{\*\shpinst\shpleft555\shpright1185\shptop5715\shpbottom5970\shpbxpage
+\shpbypage\shpwr3\shpz1 
+{\sp 
+{\sn shapeType}
+{\sv 1}
+}
+{\sp 
+{\sn fLine}
+{\sv 1}
+}
+{\sp
+ 
+{\sn lineWidth}
+{\sv 0}
+}
+{\sp 
+{\sn lineColor}
+{\sv 10485760}
+}
+{\sp 
+{\sn lineDashing
+}
+{\sv 0}
+}
+{\sp 
+{\sn fFilled}
+{\sv 1}
+}
+{\sp 
+{\sn fillColor}
+{\sv 10485760}
+}
+}
+}
+{\shp 
+{\*\shpinst\shpleft780\shpright1425\shptop5790\shpbottom6030\shpbxpage
+\shpbypage\shpwr3\shpz2 
+{\sp 
+{\sn shapeType}
+{\sv 202}
+}
+{\sp 
+{\sn dxTextLeft}
+{\sv 
+0}
+}
+{\sp 
+{\sn dxTextRight}
+{\sv 0}
+}
+{\sp 
+{\sn dyTextTop}
+{\sv 0}
+}
+{\sp 
+{\sn 
+dyTextBottom}
+{\sv 0}
+}
+{\sp 
+{\sn fLine}
+{\sv 0}
+}
+{\shptxt\plain\pard\f29\fs20 Ln #
+\par}
+{\sp 
+{\sn fFilled}
+{\sv 0}
+}
+}
+}
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx 
b/sw/qa/extras/rtfimport/rtfimport.cxx
index 4700ecbb..0ec3fd3 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -138,6 +138,7 @@ public:
 void testN818997();
 void testFdo64671();
 void testFdo62044();
+void testN825305();
 
 CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -265,6 +266,7 @@ void Test::run()
 {"n818997.rtf", &Test::testN818997},
 {"fdo64671.rtf", &Test::testFdo64671},
 {"fdo62044.rtf", &Test::testFdo62044},
+{"n825305.rtf", &Test::testN825305},
 };
 header();
 for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
@@ -1262,6 +1264,18 @@ void Test::testFdo62044()
 CPPUNIT_ASSERT_EQUAL(10.f, getProperty(xPropertySet, 
"CharHeight")); // Was 18, i.e. reset back to original value.
 }
 
+void Test::testN825305()
+{
+// The problem was that the textbox wasn't transparent, due to 
unimplemented fFilled == 0.
+uno::Reference xDrawPageSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
+uno::Reference 
xPropertyState(xDraws->getByIndex(1), uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(100), 
getProperty(xDraws->getByIndex(1), "BackColorTransparency"));
+beans::PropertyState ePropertyState = 
xPropertyState->getPropertyState("BackColorTransparency");
+// Was beans::PropertyState_DEFAULT_VALUE.
+CPPUNIT_ASSERT_EQUAL(beans::PropertyState_DIRECT_VALUE, ePropertyState);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx 
b/writerfilter/source/rtftok/rtfsdrimport.cxx
index d3bda9692..a984431f 100644
--- a/writerfilter/source/rtftok/rtfsdrimport.cxx
+++ b/writerfilter/source/rtftok/rtfsdrimport.cxx
@@ -120,6 +120,7 @@ void RTFSdrImport::resolve(RTFShape& rShape)
 bool bPib = false;
 bool bCustom = false;
 bool bTextFrame = false;
+bool bFilled = true;
 
 uno::Reference xShape;
 uno::Reference xPropertySet;
@@ -414,6 +415,8 @@ void RTFSdrImport::resolve(RTFShape& rShape)
 break;
 }
 }
+else if (i->first == "fFilled")
+bFilled = i->second.toInt32() == 1;
 else
 SAL_INFO("writerfilter", "TODO handle shape property '" << 
i->first << "':'" << i->second << "'");
 }
@@ -445,6 +448,8 @@ void RTFSdrImport::resolve(RTFShape& rShape)
 xPropertySet->setPropertyValue("WritingMode", 
uno::makeAny(sal_Int16(eWritingMode)));
 else
 xPropertySet->setPropertyValue("TextWritingMode", 
uno::makeAny(eWritingMode));
+if (!bFilled)
+xPropertySet->setPropertyValue("BackColorTransparency", 
uno::makeAny(sal_Int32(100)));
 }
 
 if (nType == ESCHER_ShpInst_PictureFrame) // picture frame
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - sw/qa writerfilter/source

2013-06-04 Thread Miklos Vajna
 sw/qa/extras/rtfimport/data/fdo62044-paste.rtf|7 +++
 sw/qa/extras/rtfimport/data/fdo62044.rtf  |7 +++
 sw/qa/extras/rtfimport/rtfimport.cxx  |   14 ++
 writerfilter/source/dmapper/DomainMapper_Impl.hxx |2 +-
 writerfilter/source/dmapper/StyleSheetTable.cxx   |   15 +--
 writerfilter/source/dmapper/StyleSheetTable.hxx   |2 +-
 6 files changed, 39 insertions(+), 8 deletions(-)

New commits:
commit 9a63f21bcefe07250de463c488c459b0767534b4
Author: Miklos Vajna 
Date:   Tue Jun 4 12:21:11 2013 +0200

fdo#62044 RTF import: don't overwrite existing styles when pasting

(cherry picked from commit 2ade07126971b79c92f729fae5709f2e2e2b495c)

Conflicts:
sw/qa/extras/rtfimport/rtfimport.cxx

Change-Id: I80a83caebc8fa3f038cf2ff080c6c6ec8e93fb70

diff --git a/sw/qa/extras/rtfimport/data/fdo62044-paste.rtf 
b/sw/qa/extras/rtfimport/data/fdo62044-paste.rtf
new file mode 100644
index 000..cea4373
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo62044-paste.rtf
@@ -0,0 +1,7 @@
+{\rtf
+{\stylesheet
+{\s14\fs36 Heading1;}
+}
+from impress
+\par
+}
diff --git a/sw/qa/extras/rtfimport/data/fdo62044.rtf 
b/sw/qa/extras/rtfimport/data/fdo62044.rtf
new file mode 100644
index 000..8ab293b
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo62044.rtf
@@ -0,0 +1,7 @@
+{\rtf1
+{\stylesheet
+{\s1\fs20 Heading 1;}
+}
+\s1 this is heading 1
+\par
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx 
b/sw/qa/extras/rtfimport/rtfimport.cxx
index 5aadfa6..4700ecbb 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -137,6 +137,7 @@ public:
 void testFdo62977();
 void testN818997();
 void testFdo64671();
+void testFdo62044();
 
 CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -263,6 +264,7 @@ void Test::run()
 {"fdo62977.rtf", &Test::testFdo62977},
 {"n818997.rtf", &Test::testN818997},
 {"fdo64671.rtf", &Test::testFdo64671},
+{"fdo62044.rtf", &Test::testFdo62044},
 };
 header();
 for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
@@ -1248,6 +1250,18 @@ void Test::testFdo64671()
 getRun(getParagraph(1), 1, OUString("\xC5\xBD", 2, RTL_TEXTENCODING_UTF8));
 }
 
+void Test::testFdo62044()
+{
+// The problem was that RTF import during copy&paste did not ignore 
existing paragraph styles.
+uno::Reference xTextDocument(mxComponent, 
uno::UNO_QUERY);
+uno::Reference xText(xTextDocument->getText(), 
uno::UNO_QUERY);
+uno::Reference xEnd = xText->getEnd();
+paste("fdo62044-paste.rtf", xEnd);
+
+uno::Reference 
xPropertySet(getStyles("ParagraphStyles")->getByName("Heading 1"), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(10.f, getProperty(xPropertySet, 
"CharHeight")); // Was 18, i.e. reset back to original value.
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
index fba658a..6864c7b 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -480,7 +480,7 @@ public:
 StyleSheetTablePtr GetStyleSheetTable()
 {
 if(!m_pStyleSheetTable)
-m_pStyleSheetTable.reset(new StyleSheetTable( m_rDMapper, 
m_xTextDocument ));
+m_pStyleSheetTable.reset(new StyleSheetTable( m_rDMapper, 
m_xTextDocument, m_bIsNewDoc ));
 return m_pStyleSheetTable;
 }
 ListsManager::Pointer GetListTable();
diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx 
b/writerfilter/source/dmapper/StyleSheetTable.cxx
index e3dac30..74adb0b 100644
--- a/writerfilter/source/dmapper/StyleSheetTable.cxx
+++ b/writerfilter/source/dmapper/StyleSheetTable.cxx
@@ -275,19 +275,21 @@ struct StyleSheetTable_Impl
 PropertyMapPtr  m_pCurrentProps;
 StringPairMap_t m_aStyleNameMap;
 ListCharStylePropertyVector_t   m_aListCharStylePropertyVector;
+boolm_bIsNewDoc;
 
-StyleSheetTable_Impl(DomainMapper& rDMapper, uno::Reference< 
text::XTextDocument> xTextDocument);
+StyleSheetTable_Impl(DomainMapper& rDMapper, uno::Reference< 
text::XTextDocument> xTextDocument, bool bIsNewDoc);
 
 OUString HasListCharStyle( const PropertyValueVector_t& rCharProperties );
 };
 
 
-StyleSheetTable_Impl::StyleSheetTable_Impl(DomainMapper& rDMapper, 
uno::Reference< text::XTextDocument> xTextDocument ) :
+StyleSheetTable_Impl::StyleSheetTable_Impl(DomainMapper& rDMapper, 
uno::Reference< text::XTextDocument> xTextDocument, bool bIsNewDoc ) :
 m_rDMapper( rDMapper ),
 m_xTextDocument( xTextDocument ),
 m_pCurrentEntry(),
 m_pDefaultParaProps(new PropertyMap),
-m_pDefaultCharProps(new PropertyMap)
+m_p

[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - sw/qa writerfilter/source

2013-05-27 Thread Miklos Vajna
 sw/qa/extras/ooxmlimport/data/page-background.docx |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx   |9 +
 writerfilter/source/dmapper/DomainMapper.cxx   |3 +++
 writerfilter/source/dmapper/DomainMapper_Impl.hxx  |3 +++
 writerfilter/source/dmapper/PropertyMap.cxx|3 +++
 writerfilter/source/ooxml/model.xml|2 +-
 6 files changed, 19 insertions(+), 1 deletion(-)

New commits:
commit 62c705c106bd3c2b87462f30732f162fcb0bde87
Author: Miklos Vajna 
Date:   Mon May 27 17:09:44 2013 +0200

bnc#817956 DOCX import of document background color

See wwSectionManager::SetSegmentToPageDesc(), this has to be applied to
every page style.

Change-Id: Iea2707ae665a55eabda3ed7575cf3658f7af5237
(cherry picked from commit 992da0d5cf04497bad55637f6a6ebfcdaec03e16)

diff --git a/sw/qa/extras/ooxmlimport/data/page-background.docx 
b/sw/qa/extras/ooxmlimport/data/page-background.docx
new file mode 100644
index 000..8c1f2ebd
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/page-background.docx 
differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index e9f4839..adbe872 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -113,6 +113,7 @@ public:
 void testN592908_Picture();
 void testN779630();
 void testIndentation();
+void testPageBackground();
 
 CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -194,6 +195,7 @@ void Test::run()
 {"n592908-picture.docx", &Test::testN592908_Picture},
 {"n779630.docx", &Test::testN779630},
 {"indentation.docx", &Test::testIndentation},
+{"page-background.docx", &Test::testPageBackground},
 };
 header();
 for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
@@ -1379,6 +1381,13 @@ void Test::testIndentation()
 CPPUNIT_ASSERT_EQUAL(text::WritingMode2::LR_TB, 
getProperty(xPropertySet, "WritingMode"));
 }
 
+void Test::testPageBackground()
+{
+// The problem was that   was ignored.
+uno::Reference 
xPageStyle(getStyles("PageStyles")->getByName(DEFAULT_STYLE), uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(0x92D050), 
getProperty(xPageStyle, "BackColor"));
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index 10a018a..7768ddb 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -1445,6 +1445,9 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
 case NS_ooxml::LN_CT_SdtListItem_value:
 m_pImpl->m_pSdtHelper->getDropDownItems().push_back(sStringValue);
 break;
+case NS_ooxml::LN_CT_Background_color:
+m_pImpl->m_oBackgroundColor.reset(nIntValue);
+break;
 default:
 {
 #if OSL_DEBUG_LEVEL > 0
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
index b7da3a9..fba658a 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -684,6 +684,9 @@ public:
 bool m_bInTableStyleRunProps;
 
 SdtHelper* m_pSdtHelper;
+
+/// Document background color, applied to every page style.
+boost::optional m_oBackgroundColor;
 };
 } //namespace dmapper
 } //namespace writerfilter
diff --git a/writerfilter/source/dmapper/PropertyMap.cxx 
b/writerfilter/source/dmapper/PropertyMap.cxx
index 9e22551..2ab0ff5 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -889,6 +889,9 @@ void SectionPropertyMap::CloseSectionGroup( 
DomainMapper_Impl& rDM_Impl )
 operator[]( PropertyDefinition( PROP_LEFT_MARGIN, false )) =  
uno::makeAny( m_nLeftMargin  );
 operator[]( PropertyDefinition( PROP_RIGHT_MARGIN, false )) = 
uno::makeAny( m_nRightMargin );
 
+if (rDM_Impl.m_oBackgroundColor)
+operator[](PropertyDefinition(PROP_BACK_COLOR, false)) = 
uno::makeAny(*rDM_Impl.m_oBackgroundColor);
+
 /*** if headers/footers are available then the top/bottom margins of 
the
 header/footer are copied to the top/bottom margin of the page
   */
diff --git a/writerfilter/source/ooxml/model.xml 
b/writerfilter/source/ooxml/model.xml
index 0e11017..cdafa91 100644
--- a/writerfilter/source/ooxml/model.xml
+++ b/writerfilter/source/ooxml/model.xml
@@ -14997,7 +14997,7 @@
 
 
   
-
+
 Background Color
   
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - sw/qa writerfilter/source

2013-05-21 Thread Miklos Vajna
 sw/qa/extras/rtfimport/data/n818997.rtf   |   77 ++
 sw/qa/extras/rtfimport/rtfimport.cxx  |8 ++
 writerfilter/source/dmapper/DomainMapper.cxx  |   13 +++
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   15 
 writerfilter/source/dmapper/DomainMapper_Impl.hxx |1 
 writerfilter/source/rtftok/rtfdocumentimpl.cxx|4 +
 writerfilter/source/rtftok/rtfdocumentimpl.hxx|2 
 7 files changed, 120 insertions(+)

New commits:
commit 0b22370730ef1e8a34c2b15397484cbd2019dd57
Author: Miklos Vajna 
Date:   Tue May 21 14:56:45 2013 +0200

bnc#818997 RTF import: don't ignore page breaks between shapes

Change-Id: Ief71ba9a3c60356714e73d08e88d0a3105b17b1a
(cherry picked from commit b40fe8e5a5037d2745cc7b1c9cc408ce6c79b9d9)

diff --git a/sw/qa/extras/rtfimport/data/n818997.rtf 
b/sw/qa/extras/rtfimport/data/n818997.rtf
new file mode 100644
index 000..2ce4404
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/n818997.rtf
@@ -0,0 +1,77 @@
+{\rtf 
+{\shp 
+{\*\shpinst\shpleft2310\shpright6060\shptop8685\shpbottom8985\shpbxpage
+\shpbypage\shpwr3\shpz2 
+{\sp 
+{\sn shapeType}
+{\sv 202}
+}
+{\sp 
+{\sn dxTextLeft}
+{\sv 
+0}
+}
+{\sp 
+{\sn dxTextRight}
+{\sv 0}
+}
+{\sp 
+{\sn dyTextTop}
+{\sv 0}
+}
+{\sp 
+{\sn 
+dyTextBottom}
+{\sv 0}
+}
+{\sp 
+{\sn fLine}
+{\sv 0}
+}
+{\shptxt\plain\pard\f29\fs24 
+On first page.\par}
+{\sp 
+{\sn fFilled}
+{\sv 0}
+}
+}
+}
+\page
+{\shp 
+{\*\shpinst\shpleft4800\shpright8025\shptop780\shpbottom1080\shpbxpage
+\shpbypage\shpwr3\shpz2 
+{\sp 
+{\sn shapeType}
+{\sv 202}
+}
+{\sp 
+{\sn dxTextLeft}
+{\sv 
+0}
+}
+{\sp 
+{\sn dxTextRight}
+{\sv 0}
+}
+{\sp 
+{\sn dyTextTop}
+{\sv 0}
+}
+{\sp 
+{\sn 
+dyTextBottom}
+{\sv 0}
+}
+{\sp 
+{\sn fLine}
+{\sv 0}
+}
+{\shptxt\plain\pard\f29\fs24\b 
+On second page.\par}
+{\sp 
+{\sn fFilled}
+{\sv 0}
+}
+}
+}
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx 
b/sw/qa/extras/rtfimport/rtfimport.cxx
index d2ccfba..c0ceabc 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -135,6 +135,7 @@ public:
 void testFdo63023();
 void testFdo42109();
 void testFdo62977();
+void testN818997();
 
 CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -259,6 +260,7 @@ void Test::run()
 {"fdo63023.rtf", &Test::testFdo63023},
 {"fdo42109.rtf", &Test::testFdo42109},
 {"fdo62977.rtf", &Test::testFdo62977},
+{"n818997.rtf", &Test::testN818997},
 };
 header();
 for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
@@ -1232,6 +1234,12 @@ void Test::testFdo62977()
 getRun(getParagraph(1), 1, 
OUString("\xE5\xB9\xB4\xEF\xBC\x94\xE6\x9C\x88", 9, RTL_TEXTENCODING_UTF8));
 }
 
+void Test::testN818997()
+{
+// \page was ignored between two \shp tokens.
+CPPUNIT_ASSERT_EQUAL(2, getPages());
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index 9de2fa6..10a018a 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -3486,6 +3486,19 @@ void DomainMapper::lcl_startShape( uno::Reference< 
drawing::XShape > xShape )
 {
 if (m_pImpl->GetTopContext())
 {
+// If there is a deferred page break, handle it now, so that the
+// started shape will be on the correct page.
+if (m_pImpl->isBreakDeferred(PAGE_BREAK))
+{
+m_pImpl->clearDeferredBreak(PAGE_BREAK);
+lcl_startCharacterGroup();
+sal_uInt8 sBreak[] = { 0xd };
+lcl_text(sBreak, 1);
+lcl_endCharacterGroup();
+lcl_endParagraphGroup();
+lcl_startParagraphGroup();
+m_pImpl->GetTopContext()->Insert(PROP_BREAK_TYPE, true, 
uno::makeAny( com::sun::star::style::BreakType_PAGE_BEFORE));
+}
 m_pImpl->PushShapeContext( xShape );
 lcl_startParagraphGroup();
 }
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index c05750c..fa6b36d 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -644,6 +644,21 @@ bool DomainMapper_Impl::isBreakDeferred( BreakType 
deferredBreakType )
 }
 }
 
+void DomainMapper_Impl::clearDeferredBreak(BreakType deferredBreakType)
+{
+switch (deferredBreakType)
+{
+case COLUMN_BREAK:
+m_bIsColumnBreakDeferred = false;
+break;
+case PAGE_BREAK:
+m_bIsPageBreakDeferred = false;
+break;
+default:
+break;
+}
+}
+
 void DomainMapper_Impl::clearDeferredBreaks()
 {
 m_bIsColumnBreakDeferred = false;
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
index 60faa83..b7da3a9 100644
--- a/writ