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

2013-01-15 Thread Libreoffice Gerrit user
 sw/qa/extras/rtfimport/data/copypaste-footnote-paste.rtf |3 
 sw/qa/extras/rtfimport/data/copypaste-footnote.rtf   |6 +
 sw/qa/extras/rtfimport/rtfimport.cxx |   47 +++
 writerfilter/source/dmapper/DomainMapper_Impl.cxx|7 +-
 4 files changed, 49 insertions(+), 14 deletions(-)

New commits:
commit 078e8583eaee630dc24e4c355914b532cadeb316
Author: Miklos Vajna vmik...@suse.cz
Date:   Tue Jan 15 11:12:55 2013 +0100

clean up copypaste tests duplication

Change-Id: Idc3e959ba701f9967f7bdb95bd920c8e7416c80a

diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx 
b/sw/qa/extras/rtfimport/rtfimport.cxx
index 2e07e3b..480a63b 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -148,6 +148,27 @@ private:
 void run();
 /// Get page count.
 int getPages();
+/// Copypaste helper.
+void paste(OUString aFilename, uno::Referencetext::XTextRange xTextRange 
= uno::Referencetext::XTextRange())
+{
+uno::Referencedocument::XFilter 
xFilter(m_xSFactory-createInstance(com.sun.star.comp.Writer.RtfFilter), 
uno::UNO_QUERY_THROW);
+uno::Referencedocument::XImporter xImporter(xFilter, 
uno::UNO_QUERY_THROW);
+xImporter-setTargetDocument(mxComponent);
+uno::Sequencebeans::PropertyValue aDescriptor(xTextRange.is() ? 3 : 
2);
+aDescriptor[0].Name = InputStream;
+SvStream* pStream = 
utl::UcbStreamHelper::CreateStream(getURLFromSrc(/sw/qa/extras/rtfimport/data/)
 + aFilename, STREAM_WRITE);
+uno::Referenceio::XStream xStream(new utl::OStreamWrapper(*pStream));
+aDescriptor[0].Value = xStream;
+aDescriptor[1].Name = IsNewDoc;
+aDescriptor[1].Value = sal_False;
+if (xTextRange.is())
+{
+aDescriptor[2].Name = TextInsertModeRange;
+aDescriptor[2].Value = xTextRange;
+}
+xFilter-filter(aDescriptor);
+}
+
 };
 
 void Test::run()
@@ -849,18 +870,7 @@ void Test::testCopyPastePageStyle()
 {
 // The problem was that RTF import during copypaste did not ignore page 
styles.
 // Once we have more copypaste tests, makes sense to refactor this to 
some helper method.
-uno::Referenceuno::XInterface 
xInterface(m_xSFactory-createInstance(com.sun.star.comp.Writer.RtfFilter), 
uno::UNO_QUERY_THROW);
-uno::Referencedocument::XImporter xImporter(xInterface, 
uno::UNO_QUERY_THROW);
-xImporter-setTargetDocument(mxComponent);
-uno::Referencedocument::XFilter xFilter(xInterface, 
uno::UNO_QUERY_THROW);
-uno::Sequencebeans::PropertyValue aDescriptor(2);
-aDescriptor[0].Name = InputStream;
-SvStream* pStream = 
utl::UcbStreamHelper::CreateStream(getURLFromSrc(/sw/qa/extras/rtfimport/data/)
 + copypaste-pagestyle-paste.rtf, STREAM_WRITE);
-uno::Referenceio::XStream xStream(new utl::OStreamWrapper(*pStream));
-aDescriptor[0].Value = xStream;
-aDescriptor[1].Name = IsNewDoc;
-aDescriptor[1].Value = sal_False;
-xFilter-filter(aDescriptor);
+paste(copypaste-pagestyle-paste.rtf);
 
 uno::Referencebeans::XPropertySet 
xPropertySet(getStyles(PageStyles)-getByName(DEFAULT_STYLE), uno::UNO_QUERY);
 CPPUNIT_ASSERT_EQUAL(sal_Int32(21001), 
getPropertysal_Int32(xPropertySet, Width)); // Was letter, i.e. 21590
@@ -872,21 +882,7 @@ void Test::testCopyPasteFootnote()
 uno::Referencetext::XFootnotesSupplier xFootnotesSupplier(mxComponent, 
uno::UNO_QUERY);
 uno::Referencecontainer::XIndexAccess 
xFootnotes(xFootnotesSupplier-getFootnotes(), uno::UNO_QUERY);
 uno::Referencetext::XTextRange xTextRange(xFootnotes-getByIndex(0), 
uno::UNO_QUERY);
-
-uno::Referenceuno::XInterface 
xInterface(m_xSFactory-createInstance(com.sun.star.comp.Writer.RtfFilter), 
uno::UNO_QUERY_THROW);
-uno::Referencedocument::XImporter xImporter(xInterface, 
uno::UNO_QUERY_THROW);
-xImporter-setTargetDocument(mxComponent);
-uno::Referencedocument::XFilter xFilter(xInterface, 
uno::UNO_QUERY_THROW);
-uno::Sequencebeans::PropertyValue aDescriptor(3);
-aDescriptor[0].Name = InputStream;
-SvStream* pStream = 
utl::UcbStreamHelper::CreateStream(getURLFromSrc(/sw/qa/extras/rtfimport/data/)
 + copypaste-footnote-paste.rtf, STREAM_WRITE);
-uno::Referenceio::XStream xStream(new utl::OStreamWrapper(*pStream));
-aDescriptor[0].Value = xStream;
-aDescriptor[1].Name = IsNewDoc;
-aDescriptor[1].Value = sal_False;
-aDescriptor[2].Name = TextInsertModeRange;
-aDescriptor[2].Value = xTextRange;
-xFilter-filter(aDescriptor);
+paste(copypaste-footnote-paste.rtf, xTextRange);
 
 CPPUNIT_ASSERT_EQUAL(OUString(bbb), xTextRange-getString());
 }
commit b6a2083b9dfe5aceb0900315363ef41e2f3abef5
Author: Miklos Vajna vmik...@suse.cz
Date:   Tue Jan 15 09:58:48 2013 +0100

fdo#59338 fix RTF paste into footnote

Change-Id: I89501f267fd4256eb3b1316ef41a0f9b0786e0f0

diff --git 

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

2012-10-30 Thread Libreoffice Gerrit user
 sw/qa/extras/rtfimport/data/fdo56512.rtf   |5 +
 sw/qa/extras/rtfimport/rtfimport.cxx   |   11 +++
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |6 +-
 3 files changed, 21 insertions(+), 1 deletion(-)

New commits:
commit 2f6097e677dbb7e5387599f3bed4aa2d40755c88
Author: Miklos Vajna vmik...@suse.cz
Date:   Tue Oct 30 17:39:31 2012 +0100

fdo#56512 testcase

Change-Id: Ib075209a2b61041ed40685093bc277243a0bef04

diff --git a/sw/qa/extras/rtfimport/data/fdo56512.rtf 
b/sw/qa/extras/rtfimport/data/fdo56512.rtf
new file mode 100644
index 000..bc400cf
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo56512.rtf
@@ -0,0 +1,5 @@
+{\rtf1\ansi\ansicpg1255
+{\*\do\dobxpage\dobypara\dodhgt8192\dptxbx\dptxbxmar0
+{\dptxbxtext\ltrpar\f0\fs20\cf1\vertalc\qr\rtlch òåñ÷ îåøùä \par}
+\dpx929\dpy1700\dpxsize10556\dpysize221\dplinehollow0}
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx 
b/sw/qa/extras/rtfimport/rtfimport.cxx
index ba09889..4da71c6 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -121,6 +121,7 @@ public:
 void testDplinehollow();
 void testLeftmarginDefault();
 void testDppolyline();
+void testFdo56512();
 
 CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX)  !defined(WNT)
@@ -193,6 +194,7 @@ void Test::run()
 {dplinehollow.rtf, Test::testDplinehollow},
 {leftmargin-default.rtf, Test::testLeftmarginDefault},
 {dppolyline.rtf, Test::testDppolyline},
+{fdo56512.rtf, Test::testFdo56512},
 };
 for (unsigned int i = 0; i  SAL_N_ELEMENTS(aMethods); ++i)
 {
@@ -884,6 +886,15 @@ void Test::testDppolyline()
 CPPUNIT_ASSERT_EQUAL(sal_Int32(4), xDraws-getCount());
 }
 
+void Test::testFdo56512()
+{
+uno::Referencetext::XTextFramesSupplier xTextFramesSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Referencecontainer::XIndexAccess 
xIndexAccess(xTextFramesSupplier-getTextFrames(), uno::UNO_QUERY);
+uno::Referencetext::XTextRange xTextRange(xIndexAccess-getByIndex(0), 
uno::UNO_QUERY);
+OUString aExpected(עוסק מורשה , 20, RTL_TEXTENCODING_UTF8);
+CPPUNIT_ASSERT_EQUAL(aExpected, xTextRange-getString());
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
commit b99b91763f96dcd5ff24c2d4cd9233a493b58aa0
Author: Miklos Vajna vmik...@suse.cz
Date:   Tue Oct 30 16:41:24 2012 +0100

fdo#56512 fix RTF import of non-unicode Hebrew text

The trick here is that we can't just fall back to Hebrew encoding for
the whole document, as that would mirror shapes as well. Instead, check
where \rtlch is used, and there fall back to the default encoding.

Change-Id: Iaf155912fab6a559ed165870b8524c23cabcb86d

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index f350a7f..2333f52 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -2064,8 +2064,11 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
 }
 break;
 case RTF_LTRCH:
+// dmapper does not support this.
+break;
 case RTF_RTLCH:
-// dmapper does not support these.
+if (m_aDefaultState.nCurrentEncoding == RTL_TEXTENCODING_MS_1255)
+m_aStates.top().nCurrentEncoding = 
m_aDefaultState.nCurrentEncoding;
 break;
 case RTF_ULNONE:
 {
@@ -2587,6 +2590,7 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, 
int nParam)
 }
 break;
 case RTF_ANSICPG:
+m_aDefaultState.nCurrentEncoding = 
rtl_getTextEncodingFromWindowsCodePage(nParam);
 m_aStates.top().nCurrentEncoding = 
rtl_getTextEncodingFromWindowsCodePage(nParam);
 break;
 case RTF_CPG:
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2012-10-11 Thread Libreoffice Gerrit user
 sw/qa/extras/ooxmlimport/data/n783638.docx|binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx  |   13 
 writerfilter/source/dmapper/GraphicImport.cxx |   28 +-
 3 files changed, 32 insertions(+), 9 deletions(-)

New commits:
commit e2c481db7b905305128e733bb1fc8d0ad8cadbf5
Author: Miklos Vajna vmik...@suse.cz
Date:   Thu Oct 11 10:48:16 2012 +0200

n#783638 testcase

Change-Id: I6b6093ba1e6961e421ac9754fdbdea9ba63eeda0

diff --git a/sw/qa/extras/ooxmlimport/data/n783638.docx 
b/sw/qa/extras/ooxmlimport/data/n783638.docx
new file mode 100644
index 000..93b587b
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/n783638.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index acc2097..c3a0bc5 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -104,6 +104,7 @@ public:
 void testShadow();
 void testN782061();
 void testN782345();
+void testN783638();
 
 CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX)  !defined(WNT)
@@ -150,6 +151,7 @@ public:
 CPPUNIT_TEST(testShadow);
 CPPUNIT_TEST(testN782061);
 CPPUNIT_TEST(testN782345);
+CPPUNIT_TEST(testN783638);
 #endif
 CPPUNIT_TEST_SUITE_END();
 
@@ -1077,6 +1079,17 @@ void Test::testN779957()
 }
 }
 
+void Test::testN783638()
+{
+// The problem was that the margins of inline images were not zero.
+load(n783638.docx);
+
+uno::Referencedrawing::XDrawPageSupplier xDrawPageSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Referencecontainer::XIndexAccess 
xDraws(xDrawPageSupplier-getDrawPage(), uno::UNO_QUERY);
+uno::Referencebeans::XPropertySet xPropertySet(xDraws-getByIndex(0), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getPropertysal_Int32(xPropertySet, 
LeftMargin));
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
commit 3d7e168a2a43c2414b0633379102ddb29437e75b
Author: Miklos Vajna vmik...@suse.cz
Date:   Thu Oct 11 10:21:57 2012 +0200

n#783638 DOCX import of wp:inline's distT/B/L/R attributes

Change-Id: I181fcae021eed07608b06744b469628e4d78ccba

diff --git a/writerfilter/source/dmapper/GraphicImport.cxx 
b/writerfilter/source/dmapper/GraphicImport.cxx
index 9042f80..5709a17 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -339,6 +339,15 @@ public:
 {
 return bYSizeValid;
 }
+
+void applyMargins(uno::Reference beans::XPropertySet  
xGraphicObjectProperties) const
+{
+PropertyNameSupplier rPropNameSupplier = 
PropertyNameSupplier::GetPropertyNameSupplier();
+xGraphicObjectProperties-setPropertyValue(rPropNameSupplier.GetName( 
PROP_LEFT_MARGIN ), uno::makeAny(nLeftMargin));
+xGraphicObjectProperties-setPropertyValue(rPropNameSupplier.GetName( 
PROP_RIGHT_MARGIN ), uno::makeAny(nRightMargin));
+xGraphicObjectProperties-setPropertyValue(rPropNameSupplier.GetName( 
PROP_TOP_MARGIN ), uno::makeAny(nTopMargin));
+xGraphicObjectProperties-setPropertyValue(rPropNameSupplier.GetName( 
PROP_BOTTOM_MARGIN ), uno::makeAny(nBottomMargin));
+}
 };
 
 
@@ -969,10 +978,17 @@ void GraphicImport::lcl_attribute(Id nName, Value  val)
 }
 break;
 case NS_ooxml::LN_CT_Inline_distT:
+m_pImpl-nTopMargin = 
ConversionHelper::convertTwipToMM100(nIntValue);
+break;
 case NS_ooxml::LN_CT_Inline_distB:
+m_pImpl-nBottomMargin = 
ConversionHelper::convertTwipToMM100(nIntValue);
+break;
 case NS_ooxml::LN_CT_Inline_distL:
+m_pImpl-nLeftMargin = 
ConversionHelper::convertTwipToMM100(nIntValue);
+break;
 case NS_ooxml::LN_CT_Inline_distR:
-//TODO: need to be handled
+m_pImpl-nRightMargin = 
ConversionHelper::convertTwipToMM100(nIntValue);
+break;
 break;
 case NS_ooxml::LN_CT_GraphicalObjectData_uri:
 val.getString();
@@ -1453,14 +1469,7 @@ uno::Reference text::XTextContent  
GraphicImport::createGraphicObject( const b
 uno::makeAny(m_pImpl-bContour));
 
xGraphicObjectProperties-setPropertyValue(rPropNameSupplier.GetName( 
PROP_CONTOUR_OUTSIDE ),
 uno::makeAny(m_pImpl-bContourOutside));
-
xGraphicObjectProperties-setPropertyValue(rPropNameSupplier.GetName( 
PROP_LEFT_MARGIN ),
-uno::makeAny(m_pImpl-nLeftMargin));
-
xGraphicObjectProperties-setPropertyValue(rPropNameSupplier.GetName( 
PROP_RIGHT_MARGIN ),
-uno::makeAny(m_pImpl-nRightMargin));
-
xGraphicObjectProperties-setPropertyValue(rPropNameSupplier.GetName( 
PROP_TOP_MARGIN ),
-uno::makeAny(m_pImpl-nTopMargin));
-
xGraphicObjectProperties-setPropertyValue(rPropNameSupplier.GetName( 

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

2012-10-03 Thread Libreoffice Gerrit user
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx  |2 +-
 writerfilter/source/dmapper/GraphicImport.cxx |4 
 2 files changed, 5 insertions(+), 1 deletion(-)

New commits:
commit ecb252af18f64b99f4ecfe34512dedfb7655fb40
Author: Cédric Bosdonnat cedric.bosdon...@free.fr
Date:   Wed Oct 3 14:38:04 2012 +0200

testShadow: test shadow width to be non-0 to avoid precision errors

Change-Id: I956f2c7f55d7e4966971bc310858967298d2933d

diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index ceb2381..acc2097 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -990,7 +990,7 @@ void Test::testShadow()
 
 table::ShadowFormat aShadow;
 xPropertySet-getPropertyValue(ShadowFormat) = aShadow;
-CPPUNIT_ASSERT_EQUAL(sal_Int32(273), sal_Int32(aShadow.ShadowWidth));
+CPPUNIT_ASSERT(sal_Int32(aShadow.ShadowWidth)  0);
 }
 
 void Test::testN782061()
commit f1fc7c5655dde547b721b3afffabcd8bdbe0add2
Author: Cédric Bosdonnat cedric.bosdon...@free.fr
Date:   Wed Oct 3 14:11:31 2012 +0200

fdo#44278: fix leaked image when import docx

Unused temporary XShape need to be disposed to avoid remaining garbage
in the document.

Change-Id: Iaf6e720a1c47605136f7f9ccafb605cab6dc260a

diff --git a/writerfilter/source/dmapper/GraphicImport.cxx 
b/writerfilter/source/dmapper/GraphicImport.cxx
index cbd59f9..9042f80 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -922,6 +922,10 @@ void GraphicImport::lcl_attribute(Id nName, Value  val)
uno::makeAny( aSize.Height ) );
 xGraphProps-setPropertyValue(Width,
uno::makeAny( aSize.Width ) );
+
+// We need to drop the shape here somehow
+uno::Reference lang::XComponent  
xShapeComponent( xShape, uno::UNO_QUERY );
+xShapeComponent-dispose( );
 }
 }
 catch( const beans::UnknownPropertyException  )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2012-10-01 Thread Libreoffice Gerrit user
 sw/qa/extras/ooxmlimport/data/n782345.docx|binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx  |   13 +
 writerfilter/source/dmapper/DomainMapper.cxx  |   10 ++
 writerfilter/source/dmapper/SettingsTable.cxx |   10 ++
 writerfilter/source/dmapper/SettingsTable.hxx |1 +
 5 files changed, 34 insertions(+)

New commits:
commit 738d5dab435084737aab2e0519fd817f62f1e83b
Author: Miklos Vajna vmik...@suse.cz
Date:   Mon Oct 1 15:06:25 2012 +0200

n#782345 testcase

Change-Id: Id5204572ab9fddf3f15b5fd1b96d8f25e7166878

diff --git a/sw/qa/extras/ooxmlimport/data/n782345.docx 
b/sw/qa/extras/ooxmlimport/data/n782345.docx
new file mode 100644
index 000..f25709f
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/n782345.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index a83a398..c545a89 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -47,6 +47,7 @@
 #include com/sun/star/text/XTextFrame.hpp
 #include com/sun/star/text/XTextFramesSupplier.hpp
 #include com/sun/star/text/XTextViewCursorSupplier.hpp
+#include com/sun/star/style/BreakType.hpp
 #include com/sun/star/style/ParagraphAdjust.hpp
 #include com/sun/star/table/ShadowFormat.hpp
 
@@ -97,6 +98,7 @@ public:
 void testN780843();
 void testShadow();
 void testN782061();
+void testN782345();
 
 CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX)  !defined(WNT)
@@ -140,6 +142,7 @@ public:
 CPPUNIT_TEST(testN780843);
 CPPUNIT_TEST(testShadow);
 CPPUNIT_TEST(testN782061);
+CPPUNIT_TEST(testN782345);
 #endif
 CPPUNIT_TEST_SUITE_END();
 
@@ -993,6 +996,16 @@ void Test::testN782061()
 CPPUNIT_ASSERT_EQUAL(sal_Int32(-9), 
getPropertysal_Int32(getRun(getParagraph(1), 2), CharEscapement));
 }
 
+void Test::testN782345()
+{
+/*
+ * The problem was that the page break was inserted before the 3rd para, 
instead of before the 2nd para.
+ */
+load(n782345.docx);
+
+CPPUNIT_ASSERT_EQUAL(style::BreakType_PAGE_BEFORE, 
getPropertystyle::BreakType(getParagraph(2), BreakType));
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
commit 40d93d978d4f8fa709bdeb061b106122789d8e32
Author: Miklos Vajna vmik...@suse.cz
Date:   Mon Oct 1 13:42:02 2012 +0200

n#782345 import DOCX w:splitPgBreakAndParaMark compat option

This fixes docx import of page breaks in empty paragraphs, when the
compat option in question is set.

Even empty paragraphs have an end of paragraph character in dmapper:
import page breaks there, instead of delaying the import till the
all-catcher importer at the start of the next paragraph.

Change-Id: Ie5c37042b3c445e0669771d15c8eb46380192db3

diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index 8b51034..64618bf 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -3542,6 +3542,16 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, 
size_t len)
 
 if(len == 1  (sText[0] == 0x0d || sText[0] == 0x07))
 {
+PropertyMapPtr pContext = 
m_pImpl-GetTopContextOfType(CONTEXT_PARAGRAPH);
+if (pContext  
m_pImpl-GetSettingsTable()-GetSplitPgBreakAndParaMark())
+{
+if (m_pImpl-isBreakDeferred(PAGE_BREAK))
+pContext-Insert(PROP_BREAK_TYPE, true, uno::makeAny( 
com::sun::star::style::BreakType_PAGE_BEFORE));
+else if (m_pImpl-isBreakDeferred(COLUMN_BREAK))
+pContext-Insert(PROP_BREAK_TYPE, true, uno::makeAny( 
com::sun::star::style::BreakType_COLUMN_BEFORE));
+m_pImpl-clearDeferredBreaks();
+}
+
 bool bSingleParagraph = m_pImpl-GetIsFirstParagraphInSection()  
m_pImpl-GetIsLastParagraphInSection();
 // If the paragraph contains only the section properties and it has
 // no runs, we should not create a paragraph for it in Writer, 
unless that would remove the whole section.
diff --git a/writerfilter/source/dmapper/SettingsTable.cxx 
b/writerfilter/source/dmapper/SettingsTable.cxx
index 18bef92..b01047a 100644
--- a/writerfilter/source/dmapper/SettingsTable.cxx
+++ b/writerfilter/source/dmapper/SettingsTable.cxx
@@ -72,6 +72,7 @@ struct SettingsTable_Impl
 boolembedTrueTypeFonts;
 boolembedSystemFonts;
 boolm_bDoNotUseHTMLParagraphAutoSpacing;
+boolm_bSplitPgBreakAndParaMark;
 
 SettingsTable_Impl( DomainMapper rDMapper, const uno::Reference 
lang::XMultiServiceFactory  xTextFactory ) :
 m_rDMapper( rDMapper )
@@ -95,6 +96,7 @@ struct SettingsTable_Impl
 , embedTrueTypeFonts(false)
 , embedSystemFonts(false)
 , m_bDoNotUseHTMLParagraphAutoSpacing(false)
+, 

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

2012-09-28 Thread Libreoffice Gerrit user
 sw/qa/extras/ooxmlimport/data/n782061.docx  |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx|   12 
 writerfilter/source/dmapper/DomainMapper.cxx|   14 +-
 writerfilter/source/dmapper/StyleSheetTable.cxx |4 
 writerfilter/source/dmapper/StyleSheetTable.hxx |3 +++
 5 files changed, 32 insertions(+), 1 deletion(-)

New commits:
commit 7a3a8a254363801bf6893b23d67f86a7461f8f3b
Author: Miklos Vajna vmik...@suse.cz
Date:   Fri Sep 28 09:52:29 2012 +0100

n#782061 testcase

Change-Id: I6aa95063ac8fe825b47decc68b08a35d81e4d59d

diff --git a/sw/qa/extras/ooxmlimport/data/n782061.docx 
b/sw/qa/extras/ooxmlimport/data/n782061.docx
new file mode 100644
index 000..9d8218b
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/n782061.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 1cefa39..a83a398 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -96,6 +96,7 @@ public:
 void testN780853();
 void testN780843();
 void testShadow();
+void testN782061();
 
 CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX)  !defined(WNT)
@@ -138,6 +139,7 @@ public:
 CPPUNIT_TEST(testN780853);
 CPPUNIT_TEST(testN780843);
 CPPUNIT_TEST(testShadow);
+CPPUNIT_TEST(testN782061);
 #endif
 CPPUNIT_TEST_SUITE_END();
 
@@ -981,6 +983,16 @@ void Test::testShadow()
 CPPUNIT_ASSERT_EQUAL(sal_Int32(273), sal_Int32(aShadow.ShadowWidth));
 }
 
+void Test::testN782061()
+{
+/*
+ * The problem was that the character escapement in the second run was -58.
+ */
+load(n782061.docx);
+
+CPPUNIT_ASSERT_EQUAL(sal_Int32(-9), 
getPropertysal_Int32(getRun(getParagraph(1), 2), CharEscapement));
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
commit 0c8017a364efb0e8a1cab57b22257e9b319fa0a1
Author: Miklos Vajna vmik...@suse.cz
Date:   Fri Sep 28 09:51:42 2012 +0100

n#782061 DOCX import: w:position should respect w:sz in w:rPrDefault

Subscript relative font size (w:position) is in percents in Writer, but
is in half points in Word. When checking for the default font size to
count the percent value, the mapper should search font size (w:sz) not
only in direct character properties, but also in default character
properties (w:rPrDefault).

Change-Id: I9286d44c6498c765ddfee795d50921ef58b80071

diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index 52d8c1a..cfd8dad 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -2132,7 +2132,9 @@ void DomainMapper::sprmWithProps( Sprm rSprm, 
PropertyMapPtr rContext, SprmType
 if (xCharStyle.is())
 
xCharStyle-setPropertyValue(rPropNameSupplier.GetName(PROP_CHAR_HEIGHT), aVal);
 }
-m_pImpl-deferCharacterProperty( nSprmId, uno::makeAny( nIntValue 
));
+// Make sure char sizes defined in the stylesheets don't affect 
char props from direct formatting.
+if (!m_pImpl-IsStyleSheetImport())
+m_pImpl-deferCharacterProperty( nSprmId, uno::makeAny( 
nIntValue ));
 }
 break;
 case NS_sprm::LN_CHpsInc:
@@ -3300,12 +3302,22 @@ void DomainMapper::processDeferredCharacterProperties( 
const std::map sal_Int32
 else
 {
 std::map sal_Int32, uno::Any ::const_iterator font = 
deferredCharacterProperties.find( NS_sprm::LN_CHps );
+PropertyMapPtr pDefaultCharProps = 
m_pImpl-GetStyleSheetTable()-GetDefaultCharProps();
+PropertyMap::iterator aDefaultFont = 
pDefaultCharProps-find(PropertyDefinition( PROP_CHAR_HEIGHT, false ));
 if( font != deferredCharacterProperties.end())
 {
 double fontSize = 0;
 font-second = fontSize;
 nEscapement = nIntValue * 100 / fontSize;
 }
+// TODO if not direct formatting, check the style first, not 
directly the default char props.
+else if (aDefaultFont != pDefaultCharProps-end())
+{
+double fHeight = 0;
+aDefaultFont-second = fHeight;
+// fHeight is in points, nIntValue is in half points, 
nEscapement is in percents.
+nEscapement = nIntValue * 100 / fHeight / 2;
+}
 else
 { // TODO: Find out the font size. The 58/-58 values were here 
previous, but I have
   // no idea what they are (they are probably some random 
guess that did fit whatever
diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx 
b/writerfilter/source/dmapper/StyleSheetTable.cxx
index be06d59..044b53c 100644
--- 

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

2012-09-24 Thread Libreoffice Gerrit user
 sw/qa/extras/rtfimport/data/fdo49655.rtf   |5 +
 sw/qa/extras/rtfimport/rtfimport.cxx   |   15 +++
 writerfilter/source/dmapper/PropertyMap.cxx|2 ++
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |8 
 4 files changed, 30 insertions(+)

New commits:
commit af6b7d8ba30d395e5f4a17876526434cf0a06005
Author: Miklos Vajna vmik...@suse.cz
Date:   Mon Sep 24 09:41:02 2012 +0100

fdo#49655 fix RTF import of text in the middle of table definition

Usually table text comes after the \intbl control word, but it turns out
text is allowed earlier. Make sure such text is buffered, otherwise
we'll send paragraph / run properties to the dmapper in the middle of
table properties, which is obviously not allowed.

Change-Id: I34f1df7e171316a7d926179689627301860d492f

diff --git a/sw/qa/extras/rtfimport/data/fdo49655.rtf 
b/sw/qa/extras/rtfimport/data/fdo49655.rtf
new file mode 100644
index 000..60f90fc
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo49655.rtf
@@ -0,0 +1,5 @@
+{\rtf1
+{\colortbl 
\red0\green0\blue0;\red128\green128\blue128;\red255\green255\blue255;}
+\trowd \clvertalt \clbrdrt\brdrw15\brdrs \clbrdrl\brdrw15\brdrs  
\clbrdrb\brdrw15\brdrs \clbrdrr\brdrw15\brdrs \clcbpat1\cellx9600 
\intbl\qc\cf2\b Travaux Exceptionnels de Jardinage N° 12.03.0005.TEJ \b0\cell 
\row
+}
+\pard\par
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx 
b/sw/qa/extras/rtfimport/rtfimport.cxx
index 9d56761..873213b 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -111,6 +111,7 @@ public:
 void testFdo52052();
 void testInk();
 void testFdo52389();
+void testFdo49655();
 
 CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX)  !defined(WNT)
@@ -161,6 +162,7 @@ public:
 CPPUNIT_TEST(testFdo52052);
 CPPUNIT_TEST(testInk);
 CPPUNIT_TEST(testFdo52389);
+CPPUNIT_TEST(testFdo49655);
 #endif
 CPPUNIT_TEST_SUITE_END();
 
@@ -970,6 +972,19 @@ void Test::testFdo52389()
 CPPUNIT_ASSERT_EQUAL(6, getLength());
 }
 
+void Test::testFdo49655()
+{
+/*
+ * The problem was that the table was not imported due to the '  ' string 
in the middle of the table definition.
+ *
+ * xray ThisComponent.TextTables.Count 'was 0
+ */
+load(fdo49655.rtf);
+uno::Referencetext::XTextTablesSupplier xTextTablesSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Referencecontainer::XIndexAccess 
xIndexAccess(xTextTablesSupplier-getTextTables(), uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess-getCount());
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index f8200ff..5e33654 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -1006,6 +1006,14 @@ void RTFDocumentImpl::text(OUString rString)
 return;
 }
 
+// Are we in the middle of the table definition? (No cell defs yet, but we 
already have some cell props.)
+if 
(m_aStates.top().aTableCellSprms.find(NS_ooxml::LN_CT_TcPrBase_vAlign).get() 
+m_aStates.top().nCells == 0)
+{
+m_aTableBuffer.push_back(make_pair(BUFFER_UTEXT, 
RTFValue::Pointer_t(new RTFValue(rString;
+return;
+}
+
 checkFirstRun();
 checkNeedPap();
 
commit da9acd209918ac26b44bddcf7b38b8887d23bfef
Author: Miklos Vajna vmik...@suse.cz
Date:   Mon Sep 24 09:40:30 2012 +0100

fdo#49655 dmapper: fix default page style layout

The default in Writer is mirrored, but in Word it's left and right.

Change-Id: I8c615a3a18ad7493deb2a3a9369c13f3e4d5799d

diff --git a/writerfilter/source/dmapper/PropertyMap.cxx 
b/writerfilter/source/dmapper/PropertyMap.cxx
index d271299..8a0ece4 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -303,6 +303,8 @@ SectionPropertyMap::SectionPropertyMap(bool 
bIsFirstSection) :
 Insert( PROP_TOP_MARGIN, false, uno::makeAny( (sal_Int32)2540 ) );
 //page bottom margin, default 0x5a0 (1440) twip - 2540 1/100 mm
 Insert( PROP_BOTTOM_MARGIN, false, uno::makeAny( (sal_Int32) 2540 ) );
+//page style layout
+Insert(PROP_PAGE_STYLE_LAYOUT, false, 
uno::makeAny(style::PageStyleLayout::PageStyleLayout_ALL));
 uno::Any aFalse( ::uno::makeAny( false ) );
 Insert( PROP_GRID_DISPLAY, false, aFalse);
 Insert( PROP_GRID_PRINT, false, aFalse);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2012-09-21 Thread Libreoffice Gerrit user
 sw/qa/extras/ooxmlimport/data/n780563.docx   |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx |   13 
 writerfilter/source/dmapper/DomainMapperTableManager.cxx |   24 ---
 writerfilter/source/dmapper/DomainMapperTableManager.hxx |2 -
 writerfilter/source/dmapper/DomainMapper_Impl.cxx|1 
 5 files changed, 28 insertions(+), 12 deletions(-)

New commits:
commit 207aebf733cc568845cea5c2aeff78493e056b9a
Author: Cédric Bosdonnat cedric.bosdon...@free.fr
Date:   Fri Sep 21 17:17:33 2012 +0200

n#780563: Fixed table import in shapes table handler was missing

Change-Id: I7720cfc706d9612fcc1e8a53b13a31f22b91d99e

diff --git a/sw/qa/extras/ooxmlimport/data/n780563.docx 
b/sw/qa/extras/ooxmlimport/data/n780563.docx
new file mode 100644
index 000..508dc74
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/n780563.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 6b1c425..34581e5 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -92,6 +92,7 @@ public:
 void testN779834();
 void testN779627();
 void testFdo55187();
+void testN780563();
 
 CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX)  !defined(WNT)
@@ -130,6 +131,7 @@ public:
 CPPUNIT_TEST(testN779834);
 CPPUNIT_TEST(testN779627);
 CPPUNIT_TEST(testFdo55187);
+CPPUNIT_TEST(testN780563);
 #endif
 CPPUNIT_TEST_SUITE_END();
 
@@ -894,6 +896,17 @@ void Test::testFdo55187()
 getParagraph(1, OUString(lupčka, 7, RTL_TEXTENCODING_UTF8));
 }
 
+void Test::testN780563()
+{
+/*
+ * Make sure we have the table in the fly frame created
+ */
+load(n780563.docx);
+uno::Referencetext::XTextTablesSupplier xTablesSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Referencecontainer::XIndexAccess 
xTables(xTablesSupplier-getTextTables( ), uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTables-getCount( ));
+}
+
 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 e144f6e..112b837 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1598,6 +1598,7 @@ void DomainMapper_Impl::PushShapeContext( const 
uno::Reference drawing::XShape
 }
 
 appendTableManager( );
+appendTableHandler( );
 getTableManager().startLevel();
 }
 catch ( const uno::Exception e )
commit b14b0f2b953b68612b8c230dbf3cabc15247c72d
Author: Cédric Bosdonnat cedric.bosdonnat@free.fr
Date:   Thu Sep 20 13:28:37 2012 +0200

n#779627: fixed writerfilter import of grid when there are nested tables

When a nested table is ended, it resets the m_nCell to 0... and thus the
filter forgets about the previous cells of the outer table row it is
importing. Using a vector to store the m_nCell values for each table
solves the problem

Change-Id: I8007960f4c95d713bfedc6b815d5783a5d25af23

diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx 
b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
index bdcaa70..2753d7f 100644
--- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
@@ -42,7 +42,7 @@ using namespace ::std;
 
 DomainMapperTableManager::DomainMapperTableManager(bool bOOXML, bool 
bImplicitMerges) :
 m_nRow(0),
-m_nCell(0),
+m_nCell(),
 m_nGridSpan(1),
 m_nCellBorderIndex(0),
 m_nHeaderRepeat(0),
@@ -343,6 +343,7 @@ void DomainMapperTableManager::startLevel( )
 IntVectorPtr pNewSpans( new vectorsal_Int32 );
 m_aTableGrid.push_back( pNewGrid );
 m_aGridSpans.push_back( pNewSpans );
+m_nCell.push_back( 0 );
 m_nTableWidth = 0;
 }
 
@@ -350,6 +351,7 @@ void DomainMapperTableManager::endLevel( )
 {
 m_aTableGrid.pop_back( );
 m_aGridSpans.pop_back( );
+m_nCell.pop_back( );
 m_nTableWidth = 0;
 
 DomainMapperTableManager_Base_t::endLevel( );
@@ -373,7 +375,7 @@ void DomainMapperTableManager::endOfCellAction()
 
 getCurrentSpans()-push_back(m_nGridSpan);
 m_nGridSpan = 1;
-++m_nCell;
+++m_nCell.back( );
 }
 
 
@@ -416,10 +418,10 @@ void DomainMapperTableManager::endOfRowAction()
 }
 
 IntVectorPtr pCurrentSpans = getCurrentSpans( );
-if( pCurrentSpans-size()  m_nCell)
+if( pCurrentSpans-size()  m_nCell.back( ) )
 {
 //fill missing elements with '1'
-pCurrentSpans-insert( pCurrentSpans-end( ), m_nCell - 
pCurrentSpans-size(), 1 );
+pCurrentSpans-insert( pCurrentSpans-end( ), m_nCell.back( ) - 
pCurrentSpans-size(), 1 );
 }
 
 #ifdef DEBUG_DOMAINMAPPER
@@ -450,15 +452,15 @@ void DomainMapperTableManager::endOfRowAction()
 double nFullWidth = m_nTableWidth;

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

2012-09-19 Thread Libreoffice Gerrit user
 sw/qa/extras/ooxmlimport/data/n778828.docx  |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx|   17 +
 writerfilter/source/dmapper/PropertyMap.cxx |5 +++--
 3 files changed, 20 insertions(+), 2 deletions(-)

New commits:
commit e8a169c93d7e2443a2e56afe7e99cd0721a2c27b
Author: Miklos Vajna vmik...@suse.cz
Date:   Wed Sep 19 13:03:43 2012 +0200

n#778828 testcase

Change-Id: I38ba0fd4128acfa114eac0b6b6e28ea49c335f0c

diff --git a/sw/qa/extras/ooxmlimport/data/n778828.docx 
b/sw/qa/extras/ooxmlimport/data/n778828.docx
new file mode 100644
index 000..ad2e22d
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/n778828.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 4d25c9b..e2ab2b0 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -91,6 +91,7 @@ public:
 void testN777337();
 void testN778836();
 void testN778140();
+void testN778828();
 
 CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX)  !defined(WNT)
@@ -124,6 +125,7 @@ public:
 CPPUNIT_TEST(testN777337);
 CPPUNIT_TEST(testN778836);
 CPPUNIT_TEST(testN778140);
+CPPUNIT_TEST(testN778828);
 #endif
 CPPUNIT_TEST_SUITE_END();
 
@@ -830,6 +832,21 @@ void Test::testN778140()
 CPPUNIT_ASSERT_EQUAL(sal_Int32(353), 
getPropertysal_Int32(getParagraph(0), ParaBottomMargin));
 }
 
+void Test::testN778828()
+{
+/*
+ * The problem was that a page break after a continous section break caused
+ * double page break on title page.
+ */
+load(n778828.docx);
+
+uno::Referenceframe::XModel xModel(mxComponent, uno::UNO_QUERY);
+uno::Referencetext::XTextViewCursorSupplier 
xTextViewCursorSupplier(xModel-getCurrentController(), uno::UNO_QUERY);
+uno::Referencetext::XPageCursor 
xCursor(xTextViewCursorSupplier-getViewCursor(), uno::UNO_QUERY);
+xCursor-jumpToLastPage();
+CPPUNIT_ASSERT_EQUAL(sal_Int16(2), xCursor-getPage());
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
commit 1a60519fcd7706b487ceb7c5e879a81a6109f839
Author: Miklos Vajna vmik...@suse.cz
Date:   Wed Sep 19 12:06:57 2012 +0100

n#778828 fix docx import of continous section break on title page

Change-Id: Ib9e9cce5abdcf00c2546f831c8af191da10e1b15

diff --git a/writerfilter/source/dmapper/PropertyMap.cxx 
b/writerfilter/source/dmapper/PropertyMap.cxx
index fcb7572..d271299 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -996,8 +996,9 @@ void SectionPropertyMap::CloseSectionGroup( 
DomainMapper_Impl rDM_Impl )
 uno::Referencebeans::XPropertySet 
xRangeProperties(lcl_GetRangeProperties(m_bIsFirstSection, rDM_Impl, 
m_xStartingRange));
 /* break type
 0 - No break 1 - New Colunn 2 - New page 3 - Even page 4 - odd 
page */
-xRangeProperties-setPropertyValue(rPropNameSupplier.GetName( 
PROP_PAGE_DESC_NAME ),
-uno::makeAny( m_bTitlePage ? m_sFirstPageStyleName : 
m_sFollowPageStyleName ));
+if ((m_bTitlePage  m_bIsFirstSection) || !m_bTitlePage)
+
xRangeProperties-setPropertyValue(rPropNameSupplier.GetName( 
PROP_PAGE_DESC_NAME ),
+uno::makeAny( m_bTitlePage ? m_sFirstPageStyleName 
: m_sFollowPageStyleName ));
 // handle page breaks with odd/even page numbering
 style::PageStyleLayout 
nPageStyleLayout(style::PageStyleLayout_ALL);
 if (m_nBreakType == 3)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2012-08-30 Thread Libreoffice Gerrit user
 sw/qa/extras/ooxmlimport/data/n777337.docx  |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx|   20 ++--
 writerfilter/source/dmapper/PropertyMap.cxx |4 
 3 files changed, 22 insertions(+), 2 deletions(-)

New commits:
commit dd11bca8ab191ce10054a5f2de7010ca400eb0b5
Author: Miklos Vajna vmik...@suse.cz
Date:   Thu Aug 30 09:11:58 2012 +0100

n#777337 testcase

Also remove the #if 0 I forgot to remove previously.

Change-Id: I2cc5e1407c509414c8395d0fd63ab3b379bef04f

diff --git a/sw/qa/extras/ooxmlimport/data/n777337.docx 
b/sw/qa/extras/ooxmlimport/data/n777337.docx
new file mode 100644
index 000..8bb377d
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/n777337.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 00e36b8..ec61993 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -88,10 +88,10 @@ public:
 void testN775906();
 void testN775899();
 void testN777345();
+void testN777337();
 
 CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX)  !defined(WNT)
-#if 0
 CPPUNIT_TEST(testN751054);
 CPPUNIT_TEST(testN751117);
 CPPUNIT_TEST(testN751017);
@@ -118,8 +118,8 @@ public:
 CPPUNIT_TEST(testAllGapsWord);
 CPPUNIT_TEST(testN775906);
 CPPUNIT_TEST(testN775899);
-#endif
 CPPUNIT_TEST(testN777345);
+CPPUNIT_TEST(testN777337);
 #endif
 CPPUNIT_TEST_SUITE_END();
 
@@ -785,6 +785,22 @@ void Test::testN777345()
 CPPUNIT_ASSERT_EQUAL(sal_uLong(2404338915U), aGraphic.GetChecksum());
 }
 
+void Test::testN777337()
+{
+/*
+ * The problem was that the top and bottom margin on the first page was 
only 0.1cm instead of 1.7cm.
+ *
+ * oFirst = ThisComponent.StyleFamilies.PageStyles.getByName(First Page)
+ * xray oFirst.TopMargin
+ * xray oFirst.BottomMargin
+ */
+load(n777337.docx);
+
+uno::Referencebeans::XPropertySet 
xPropertySet(getStyles(PageStyles)-getByName(First Page), uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(1702), getPropertysal_Int32(xPropertySet, 
TopMargin));
+CPPUNIT_ASSERT_EQUAL(sal_Int32(1702), getPropertysal_Int32(xPropertySet, 
BottomMargin));
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
commit a474559ff1e560b83952f00595dbd8ae7fde88b6
Author: Miklos Vajna vmik...@suse.cz
Date:   Thu Aug 30 09:11:17 2012 +0100

n#777337 fix DOCX import of title page top/bottom margin with 
headers/footers

SectionPropertyMap::PrepareHeaderFooterProperties() already backed up
m_nTopMargin to have the same result when that method is called multiple
times. Do the same for the header footer height values as well to match
the WW8 behaviour.

Change-Id: Ib2347abc3db39308900c7721c0e15de040d9a01f

diff --git a/writerfilter/source/dmapper/PropertyMap.cxx 
b/writerfilter/source/dmapper/PropertyMap.cxx
index 70bb53b..aceba89 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -712,6 +712,7 @@ void SectionPropertyMap::CopyLastHeaderFooter( bool 
bFirstPage, DomainMapper_Imp
 void SectionPropertyMap::PrepareHeaderFooterProperties( bool bFirstPage )
 {
 sal_Int32 nTopMargin = m_nTopMargin;
+sal_Int32 nHeaderTop = m_nHeaderTop;
 if(HasHeader(bFirstPage))
 {
 m_nTopMargin = m_nHeaderTop;
@@ -745,6 +746,7 @@ void SectionPropertyMap::PrepareHeaderFooterProperties( 
bool bFirstPage )
 }
 
 sal_Int32 nBottomMargin = m_nBottomMargin;
+sal_Int32 nHeaderBottom = m_nHeaderBottom;
 if( HasFooter( bFirstPage ) )
 {
 m_nBottomMargin = m_nHeaderBottom;
@@ -779,6 +781,8 @@ void SectionPropertyMap::PrepareHeaderFooterProperties( 
bool bFirstPage )
 
 // Restore original top margin, so we don't end up with a smaller margin 
in case we have to produce two page styles from one Word section.
 m_nTopMargin = nTopMargin;
+m_nHeaderTop = nHeaderTop;
+m_nHeaderBottom = nHeaderBottom;
 }
 
 uno::Referencebeans::XPropertySet lcl_GetRangeProperties(bool 
bIsFirstSection, DomainMapper_Impl rDM_Impl, uno::Referencetext::XTextRange 
xStartingRange)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2012-08-28 Thread Libreoffice Gerrit user
 sw/qa/extras/rtfimport/data/fdo52052.rtf   |   23 +++
 sw/qa/extras/rtfimport/rtfimport.cxx   |9 
 sw/qa/extras/swmodeltestbase.hxx   |   15 +--
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |   51 ++---
 writerfilter/source/rtftok/rtfdocumentimpl.hxx |3 +
 5 files changed, 92 insertions(+), 9 deletions(-)

New commits:
commit 1efa576ef88141c4deb5da9818537e053dc6517b
Author: Miklos Vajna vmik...@suse.cz
Date:   Tue Aug 28 11:21:50 2012 +0200

fdo#52052 fix RTF import of page breaks on landscape pages

The problem was that we tried to insert a page break before reaching the
first section break, where section properties are sent.

Additionally, the continuous section break at the end of the doc caused
trouble, so ignore it explicitly.

Change-Id: I22bc355994991beeadb41d26b44ce3e2beedbdb2

diff --git a/sw/qa/extras/rtfimport/data/fdo52052.rtf 
b/sw/qa/extras/rtfimport/data/fdo52052.rtf
new file mode 100644
index 000..329762e
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo52052.rtf
@@ -0,0 +1,23 @@
+{\rtf1\ansi\ansicpg1251\deff0\deflang1033
+{\fonttbl
+{\f0\fswiss\fcharset204 Arial;}
+}
+{\colortbl;\red0\green0\blue0;}
+{\info
+{\title }
+{\author Crystal Reports}
+{\doccomm Powered By Crystal}
+{\company Crystal Decisions}
+}
+\landscape\paperw16836\paperh11904\margl567\margr397\margt567\margb284\gutter0\windowctrl\ftnbj\viewkind1\viewscale100\sectd\linex0\sbknone
+{\pard first
+\par }
+\page\sect 
+{\pard \pvpg\phpg\posx13152\posy612\absw2984\absh-210\fi0 
\ltrpar\qr\tx360\tx720\tx1080\tx1440\tx1800\tx2160\tx2520\tx2880
+{\ltrch\f0 \b\i0\ul0\strike0\fs15 \cf1 second}
+\par }
+\page\sect 
+{\pard \pvpg\phpg\posx13152\posy612\absw2984\absh-210\fi0 
\ltrpar\qr\tx360\tx720\tx1080\tx1440\tx1800\tx2160\tx2520\tx2880
+{\ltrch\f0 \b\i0\ul0\strike0\fs15 \cf1 third}
+\par }
+\sect }
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx 
b/sw/qa/extras/rtfimport/rtfimport.cxx
index 219acbe..918e7a5 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -106,6 +106,7 @@ public:
 void testFdo48446();
 void testFdo47495();
 void testAllGapsWord();
+void testFdo52052();
 
 CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX)  !defined(WNT)
@@ -153,6 +154,7 @@ public:
 CPPUNIT_TEST(testFdo48446);
 CPPUNIT_TEST(testFdo47495);
 CPPUNIT_TEST(testAllGapsWord);
+CPPUNIT_TEST(testFdo52052);
 #endif
 CPPUNIT_TEST_SUITE_END();
 
@@ -915,6 +917,13 @@ void Test::testAllGapsWord()
 borderTest.testTheBorders(mxComponent);
 }
 
+void Test::testFdo52052()
+{
+load(fdo52052.rtf);
+// Make sure the textframe containing the text third appears on the 3rd 
page.
+CPPUNIT_ASSERT_EQUAL(OUString(third), 
parseDump(/root/page[3]/body/txt/anchored/fly/txt/text()));
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 8120540..330c34d 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -270,7 +270,8 @@ 
RTFDocumentImpl::RTFDocumentImpl(uno::Referenceuno::XComponentContext const x
 m_bFormField(false),
 m_bIsInFrame(false),
 m_aUnicodeBuffer(),
-m_aHexBuffer()
+m_aHexBuffer(),
+m_bDeferredContSectBreak(false)
 {
 OSL_ASSERT(xInputStream.is());
 m_pInStream.reset(utl::UcbStreamHelper::CreateStream(xInputStream, 
sal_True));
@@ -1093,6 +1094,7 @@ void RTFDocumentImpl::replayBuffer(RTFBuffer_t rBuffer)
 int RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword)
 {
 checkUnicode();
+checkDeferredContSectBreak();
 RTFSkipDestination aSkip(*this);
 switch (nKeyword)
 {
@@ -1516,6 +1518,7 @@ int RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword)
 {
 if (nKeyword != RTF_HEXCHAR)
 checkUnicode();
+checkDeferredContSectBreak();
 RTFSkipDestination aSkip(*this);
 sal_uInt8 cCh = 0;
 
@@ -1572,7 +1575,17 @@ int RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword)
 }
 break;
 case RTF_SECT:
-sectBreak();
+{
+RTFValue::Pointer_t pBreak = 
m_aStates.top().aSectionSprms.find(NS_sprm::LN_SBkc);
+if (pBreak.get()  !pBreak-getInt())
+{
+// This is a continous section break, don't send it yet.
+// It's possible that we'll have nothing after this token, 
and then we should ignore it.
+m_bDeferredContSectBreak = true;
+}
+else
+sectBreak();
+}
 break;
 case RTF_NOBREAK:
 {
@@ -1693,10 +1706,21 @@ int RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword)
 break;
 case RTF_PAGE:
 {
-

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

2012-08-13 Thread Miklos Vajna
 dev/null   |binary
 sw/qa/extras/odfimport/data/fdo53210.odt   |binary
 sw/qa/extras/odfimport/odfimport.cxx   |   23 +++
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |5 -
 writerfilter/source/rtftok/rtfdocumentimpl.hxx |3 +--
 writerfilter/source/rtftok/rtftokenizer.cxx|4 ++--
 6 files changed, 18 insertions(+), 17 deletions(-)

New commits:
commit 10e02dfdffb5ef3a02a40b52c6cda176f7f4447c
Author: Miklos Vajna vmik...@suse.cz
Date:   Mon Aug 13 10:59:26 2012 +0200

fdo#53210 testcase

Change-Id: I23606a7601b71890acf7e260951e1bacc0fc2df9

diff --git a/sw/qa/extras/odfimport/data/fdo53210.odt 
b/sw/qa/extras/odfimport/data/fdo53210.odt
new file mode 100644
index 000..cfa5044
Binary files /dev/null and b/sw/qa/extras/odfimport/data/fdo53210.odt differ
diff --git a/sw/qa/extras/odfimport/data/hello.odt 
b/sw/qa/extras/odfimport/data/hello.odt
deleted file mode 100644
index 23ce6a4..000
Binary files a/sw/qa/extras/odfimport/data/hello.odt and /dev/null differ
diff --git a/sw/qa/extras/odfimport/odfimport.cxx 
b/sw/qa/extras/odfimport/odfimport.cxx
index d473893..ef51e31 100644
--- a/sw/qa/extras/odfimport/odfimport.cxx
+++ b/sw/qa/extras/odfimport/odfimport.cxx
@@ -32,13 +32,13 @@ using rtl::OUString;
 class Test : public SwModelTestBase
 {
 public:
-void testHello();
 void testEmptySvgFamilyName();
+void testHideAllSections();
 
 CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX)  !defined(WNT)
-CPPUNIT_TEST(testHello);
 CPPUNIT_TEST(testEmptySvgFamilyName);
+CPPUNIT_TEST(testHideAllSections);
 #endif
 CPPUNIT_TEST_SUITE_END();
 
@@ -52,18 +52,25 @@ void Test::load(const OUString rFilename)
 mxComponent = 
loadFromDesktop(getURLFromSrc(/sw/qa/extras/odfimport/data/) + rFilename);
 }
 
-void Test::testHello()
-{
-load(hello.odt);
-CPPUNIT_ASSERT_EQUAL(12, getLength());
-}
-
 void Test::testEmptySvgFamilyName()
 {
 // .odt import did crash on the empty font list (which I think is valid 
according SVG spec)
 load( empty-svg-family-name.odt );
 }
 
+void Test::testHideAllSections()
+{
+// This document has a section that is conditionally hidden, but has no 
empty paragraph after it.
+load(fdo53210.odt);
+uno::Referencetext::XTextFieldsSupplier xTextFieldsSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Referencecontainer::XNameAccess xMasters = 
xTextFieldsSupplier-getTextFieldMasters();
+// Set _CS_Allgemein to 0
+uno::Referencebeans::XPropertySet 
xMaster(xMasters-getByName(com.sun.star.text.fieldmaster.User._CS_Allgemein),
 uno::UNO_QUERY);
+xMaster-setPropertyValue(Content, uno::makeAny(OUString(0)));
+// This used to crash
+uno::Referenceutil::XRefreshable(xTextFieldsSupplier-getTextFields(), 
uno::UNO_QUERY)-refresh();
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
commit 7b87ccf916547b4d59d0e892519600a2bf53b867
Author: Miklos Vajna vmik...@suse.cz
Date:   Mon Aug 13 10:45:42 2012 +0200

drop unnecessary RTFDocumentImpl::isEmpty

Change-Id: I657266697c30be0760971528adb1abf07f03ea23

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index adfb18c..2d66ed3 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -3902,11 +3902,6 @@ int RTFDocumentImpl::getGroup() const
 return m_nGroup;
 }
 
-bool RTFDocumentImpl::isEmpty() const
-{
-return m_aStates.empty();
-}
-
 void RTFDocumentImpl::setDestinationText(OUString rString)
 {
 m_aStates.top().aDestinationText.setLength(0);
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
index c05a0f5..0759a4c 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
@@ -424,8 +424,7 @@ namespace writerfilter {
 void seek(sal_uInt32 nPos);
 uno::Referencelang::XMultiServiceFactory getModelFactory();
 RTFParserState getState();
-/// If the stack of states is empty.
-bool isEmpty() const;
+/// Number of states on the stack.
 int getGroup() const;
 void setDestinationText(rtl::OUString rString);
 /// Resolve a picture: If not inline, then anchored.
diff --git a/writerfilter/source/rtftok/rtftokenizer.cxx 
b/writerfilter/source/rtftok/rtftokenizer.cxx
index e596aae..abe8cff 100644
--- a/writerfilter/source/rtftok/rtftokenizer.cxx
+++ b/writerfilter/source/rtftok/rtftokenizer.cxx
@@ -95,7 +95,7 @@ int RTFTokenizer::resolveParse()
 
 if (m_rImport.getGroup()  0)
 return ERROR_GROUP_UNDER;
-if (!m_rImport.isEmpty()  m_rImport.getState().nInternalState == 
INTERNAL_BIN)
+if (m_rImport.getGroup()  0  m_rImport.getState().nInternalState 

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

2012-08-02 Thread Miklos Vajna
 sw/qa/extras/ooxmlexport/data/fdo51034.odt|binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx  |9 +
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |2 +-
 3 files changed, 10 insertions(+), 1 deletion(-)

New commits:
commit 6ff70708b4a39011a61aa0f53541eb7eec09c813
Author: Miklos Vajna vmik...@suse.cz
Date:   Thu Aug 2 10:57:07 2012 +0200

fdo#51034 testcase

Change-Id: I9a7a4e596ffb14cdcb211ff0d905c66831d30708

diff --git a/sw/qa/extras/ooxmlexport/data/fdo51034.odt 
b/sw/qa/extras/ooxmlexport/data/fdo51034.odt
new file mode 100644
index 000..9720cfb
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo51034.odt differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 02f66a2..020bffd 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -42,6 +42,7 @@ public:
 void defaultTabStopNotInStyles();
 void testFdo38244();
 void testMathEscape();
+void testFdo51034();
 
 CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX)  !defined(WNT)
@@ -52,6 +53,7 @@ public:
 #if !(__GNUC__ == 4  __GNUC_MINOR__ == 4)
 CPPUNIT_TEST(testMathEscape);
 #endif
+CPPUNIT_TEST(testFdo51034);
 #endif
 CPPUNIT_TEST_SUITE_END();
 
@@ -170,6 +172,13 @@ void Test::testMathEscape()
 CPPUNIT_ASSERT_EQUAL(OUString(\\{ left [ right ] left ( right ) \\}), 
getFormula(getRun(getParagraph(1), 1)));
 }
 
+void Test::testFdo51034()
+{
+// The problem was that the 'l' param of the HYPERLINK field was parsed 
with = #, not += #.
+roundtrip(fdo51034.odt);
+CPPUNIT_ASSERT_EQUAL(OUString(http://Www.google.com/#a;), 
getPropertyOUString(getRun(getParagraph(1), 1), HyperLinkURL));
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
commit 9c53a7f94f3bdcb694498db335a01af25257853a
Author: Miklos Vajna vmik...@suse.cz
Date:   Thu Aug 2 10:49:02 2012 +0200

fdo#51034 fix docx import of HYPERLINK field, l param

Change-Id: Ic6896f7c795d7d303bf7589a74afb937d4a8e8b5

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index ebee085..164a2d4 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -2871,7 +2871,7 @@ void DomainMapper_Impl::CloseFieldCommand()
 if (aPartIt == aItEnd)
 break;
 
-sURL = OUString('#');
+sURL += OUString('#');
 sURL += *aPartIt;
 }
 else if ( *aPartIt == \\m || *aPartIt == \\n )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2012-06-25 Thread Miklos Vajna
 sw/qa/extras/ooxmltok/data/n766481.docx   |binary
 sw/qa/extras/ooxmltok/ooxmltok.cxx|   21 ++
 writerfilter/source/dmapper/DomainMapper.cxx  |   11 +++
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   31 ++
 writerfilter/source/dmapper/DomainMapper_Impl.hxx |   10 +++
 writerfilter/source/dmapper/PropertyMap.cxx   |1 
 6 files changed, 74 insertions(+)

New commits:
commit 0eb3a0f2fa66e67f21035c5c14a41d2d6fb4b345
Author: Miklos Vajna vmik...@suse.cz
Date:   Mon Jun 25 16:01:37 2012 +0200

n#766481 testcase

Change-Id: I0ebcb5c35f2e255da593c62b0a98cd4e0f44ba99

diff --git a/sw/qa/extras/ooxmltok/data/n766481.docx 
b/sw/qa/extras/ooxmltok/data/n766481.docx
new file mode 100644
index 000..e1521ec
Binary files /dev/null and b/sw/qa/extras/ooxmltok/data/n766481.docx differ
diff --git a/sw/qa/extras/ooxmltok/ooxmltok.cxx 
b/sw/qa/extras/ooxmltok/ooxmltok.cxx
index 4cd2aa3..1d1bbb1 100644
--- a/sw/qa/extras/ooxmltok/ooxmltok.cxx
+++ b/sw/qa/extras/ooxmltok/ooxmltok.cxx
@@ -71,6 +71,7 @@ public:
 void testN764745();
 void testN766477();
 void testN758883();
+void testN766481();
 
 CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX)  !defined(WNT)
@@ -92,6 +93,7 @@ public:
 CPPUNIT_TEST(testN764745);
 CPPUNIT_TEST(testN766477);
 CPPUNIT_TEST(testN758883);
+CPPUNIT_TEST(testN766481);
 #endif
 CPPUNIT_TEST_SUITE_END();
 
@@ -605,6 +607,25 @@ void Test::testN758883()
 CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_CHARACTER, 
eAnchorType);
 }
 
+void Test::testN766481()
+{
+/*
+ * The problem was that we had an additional paragraph before the 
pagebreak.
+ *
+ * oParas = ThisComponent.Text.createEnumeration
+ * oPara = oParas.nextElement
+ * oPara = oParas.nextElement
+ * xray oParas.hasMoreElements ' should be false
+ */
+load(n766481.docx);
+uno::Referencetext::XTextDocument xTextDocument(mxComponent, 
uno::UNO_QUERY);
+uno::Referencecontainer::XEnumerationAccess 
xParaEnumAccess(xTextDocument-getText(), uno::UNO_QUERY);
+uno::Referencecontainer::XEnumeration 
xParaEnum(xParaEnumAccess-createEnumeration());
+for (int i = 0; i  2; ++i)
+xParaEnum-nextElement();
+CPPUNIT_ASSERT_EQUAL(sal_False, xParaEnum-hasMoreElements());
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
commit b696600821d8aafb63b6a88016d299ef89478f56
Author: Miklos Vajna vmik...@suse.cz
Date:   Mon Jun 25 15:58:11 2012 +0200

n#766481 dmapper: don't import fake paragraph containing sectpr only, take 
two

Change-Id: I4623dfd05498b5ba8de73b7e301eaf486f667738

diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index f51ce3f..c11935d 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -2795,6 +2795,8 @@ void DomainMapper::sprmWithProps( Sprm rSprm, 
PropertyMapPtr rContext, SprmType
 case NS_ooxml::LN_CT_Style_rPr:
 case NS_ooxml::LN_CT_PPr_rPr:
 case NS_ooxml::LN_CT_PPrBase_numPr:
+if (nSprmId == NS_ooxml::LN_CT_PPr_sectPr)
+m_pImpl-SetParaSectpr(true);
 resolveSprmProps(*this, rSprm);
 break;
 case NS_ooxml::LN_EG_SectPrContents_footnotePr:
@@ -3396,7 +3398,16 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, 
size_t len)
 
 // RTF always uses text() instead of utext() for run break
 if(len == 1  ((*data_) == 0x0d || (*data_) == 0x07)  
!IsRTFImport())
+{
+bool bSingleParagraph = m_pImpl-GetIsFirstParagraphInSection()  
m_pImpl-GetIsLastParagraphInSection();
+// If the paragraph contains only the section properties and it has
+// no runs, we should not create a paragraph for it in Writer, 
unless that would remove the whole section.
+bool bRemove = !m_pImpl-GetParaChanged()  
m_pImpl-GetParaSectpr()  !bSingleParagraph;
+m_pImpl-SetParaSectpr(false);
 
m_pImpl-finishParagraph(m_pImpl-GetTopContextOfType(CONTEXT_PARAGRAPH));
+if (bRemove)
+m_pImpl-RemoveLastParagraph();
+}
 else
 {
 
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 8e6d2c6..776aaba 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -206,7 +206,9 @@ DomainMapper_Impl::DomainMapper_Impl(
 m_bIsCustomFtnMark( false ),
 m_bIsParaChange( false ),
 m_bParaChanged( false ),
+m_bIsFirstParaInSection( true ),
 m_bIsLastParaInSection( false ),
+m_bParaSectpr( false ),
 m_bUsingEnhancedFields( false )
 {
 appendTableManager( );
@@ -307,7 +309,35 @@ void DomainMapper_Impl::SetIsLastParagraphInSection( bool 
bIsLast )
 

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

2012-06-15 Thread Miklos Vajna
 sw/qa/extras/ooxmltok/ooxmltok.cxx|   13 +
 sw/qa/extras/rtftok/rtftok.cxx|   10 --
 sw/qa/extras/swmodeltestbase.hxx  |   10 ++
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |4 ++--
 writerfilter/source/dmapper/SettingsTable.cxx |   10 ++
 writerfilter/source/dmapper/SettingsTable.hxx |2 ++
 6 files changed, 37 insertions(+), 12 deletions(-)

New commits:
commit 7193d4ef0d61d82fe2138b4736f27b6d27fc8e0a
Author: Miklos Vajna vmik...@suse.cz
Date:   Fri Jun 15 15:09:53 2012 +0200

n#750935 fix docx import of w:evenAndOddHeaders

Change-Id: I172073bac10e8d0449c0f5c0a226dd7ace013376

diff --git a/sw/qa/extras/ooxmltok/ooxmltok.cxx 
b/sw/qa/extras/ooxmltok/ooxmltok.cxx
index 5026530..3afb8b7 100644
--- a/sw/qa/extras/ooxmltok/ooxmltok.cxx
+++ b/sw/qa/extras/ooxmltok/ooxmltok.cxx
@@ -193,7 +193,20 @@ void Test::testN750935()
 uno::Referencetext::XTextViewCursorSupplier 
xTextViewCursorSupplier(xModel-getCurrentController(), uno::UNO_QUERY);
 uno::Referencetext::XPageCursor 
xCursor(xTextViewCursorSupplier-getViewCursor(), uno::UNO_QUERY);
 xCursor-jumpToLastPage();
+// Some page break types were ignores, resulting in less pages.
 CPPUNIT_ASSERT_EQUAL(sal_Int16(5), xCursor-getPage());
+
+/*
+ * The problem was that the header and footer was not shared.
+ *
+ * xray ThisComponent.StyleFamilies.PageStyles.Default.FooterIsShared
+ */
+uno::Referencebeans::XPropertySet 
xPropertySet(getStyles(PageStyles)-getByName(Default), uno::UNO_QUERY);
+sal_Bool bValue = false;
+xPropertySet-getPropertyValue(HeaderIsShared) = bValue;
+CPPUNIT_ASSERT_EQUAL(sal_Bool(true), bValue);
+xPropertySet-getPropertyValue(FooterIsShared) = bValue;
+CPPUNIT_ASSERT_EQUAL(sal_Bool(true), bValue);
 }
 
 void Test::testN757890()
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index bda064d..1dcb7f5 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1271,7 +1271,7 @@ 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 )
+if( bLeft  m_pSettingsTable-GetEvenAndOddHeaders())
 
xPageStyle-setPropertyValue(rPropNameSupplier.GetName(PROP_HEADER_IS_SHARED), 
uno::makeAny( false ));
 
 //set the interface
@@ -1310,7 +1310,7 @@ 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 )
+if( bLeft  m_pSettingsTable-GetEvenAndOddHeaders())
 
xPageStyle-setPropertyValue(rPropNameSupplier.GetName(PROP_FOOTER_IS_SHARED), 
uno::makeAny( false ));
 //set the interface
 uno::Reference text::XText  xFooterText;
diff --git a/writerfilter/source/dmapper/SettingsTable.cxx 
b/writerfilter/source/dmapper/SettingsTable.cxx
index ab89c6a..2a69cc6 100644
--- a/writerfilter/source/dmapper/SettingsTable.cxx
+++ b/writerfilter/source/dmapper/SettingsTable.cxx
@@ -76,6 +76,7 @@ struct SettingsTable_Impl
 ::rtl::OUString m_sSalt;
 boolm_bLinkStyles;
 sal_Int16   m_nZoomFactor;
+boolm_bEvenAndOddHeaders;
 
 SettingsTable_Impl( DomainMapper rDMapper, const uno::Reference 
lang::XMultiServiceFactory  xTextFactory ) :
 m_rDMapper( rDMapper )
@@ -94,6 +95,7 @@ struct SettingsTable_Impl
 , m_nCryptSpinCount(0)
 , m_bLinkStyles(false)
 , m_nZoomFactor(0)
+, m_bEvenAndOddHeaders(false)
 {}
 
 };
@@ -165,6 +167,9 @@ void SettingsTable::lcl_sprm(Sprm rSprm)
 case NS_ooxml::LN_CT_Settings_linkStyles: // 92663;
 m_pImpl-m_bLinkStyles = nIntValue;
 break;
+case NS_ooxml::LN_CT_Settings_evenAndOddHeaders:
+m_pImpl-m_bEvenAndOddHeaders = nIntValue;
+break;
 case NS_ooxml::LN_CT_Settings_noPunctuationKerning: //  92526;
 m_pImpl-m_bNoPunctuationKerning = nIntValue ? true : false;
 break;
@@ -230,6 +235,11 @@ sal_Int16 SettingsTable::GetZoomFactor() const
 return m_pImpl-m_nZoomFactor;
 }
 
+bool SettingsTable::GetEvenAndOddHeaders() const
+{
+return m_pImpl-m_bEvenAndOddHeaders;
+}
+
 void SettingsTable::ApplyProperties( uno::Reference text::XTextDocument  
xDoc )
 {
 uno::Reference beans::XPropertySet xDocProps( xDoc, uno::UNO_QUERY );
diff --git a/writerfilter/source/dmapper/SettingsTable.hxx 
b/writerfilter/source/dmapper/SettingsTable.hxx
index 3d9a560..2c43ec6 100644
--- 

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

2012-05-09 Thread Miklos Vajna
 sw/qa/extras/rtftok/data/fdo49501.rtf  |5 
 sw/qa/extras/rtftok/rtftok.cxx |   26 
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |   27 -
 3 files changed, 44 insertions(+), 14 deletions(-)

New commits:
commit d6acd86fe1d2924a378e3053f83d47084a8bb108
Author: Miklos Vajna vmik...@suse.cz
Date:   Wed May 9 11:30:13 2012 +0200

fdo#49501 RTF_MARGL/R/T/B should also set the current margin

Change-Id: I I69b92d0cd07c9f08f14affb447b55b26b2556186

diff --git a/sw/qa/extras/rtftok/data/fdo49501.rtf 
b/sw/qa/extras/rtftok/data/fdo49501.rtf
new file mode 100644
index 000..47bd691
--- /dev/null
+++ b/sw/qa/extras/rtftok/data/fdo49501.rtf
@@ -0,0 +1,5 @@
+{\rtf
+\landscape \paperw15309 \paperh11907 \margl567 \margr567 \margt567 \margb567 
+Department
+\par
+}
diff --git a/sw/qa/extras/rtftok/rtftok.cxx b/sw/qa/extras/rtftok/rtftok.cxx
index 605a20d..e6de843 100644
--- a/sw/qa/extras/rtftok/rtftok.cxx
+++ b/sw/qa/extras/rtftok/rtftok.cxx
@@ -95,6 +95,7 @@ public:
 void testFdo47764();
 void testFdo38786();
 void testN757651();
+void testFdo49501();
 
 CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX)  !defined(WNT)
@@ -127,6 +128,7 @@ public:
 CPPUNIT_TEST(testFdo47764);
 CPPUNIT_TEST(testFdo38786);
 CPPUNIT_TEST(testN757651);
+CPPUNIT_TEST(testFdo49501);
 #endif
 CPPUNIT_TEST_SUITE_END();
 
@@ -701,6 +703,30 @@ void Test::testN757651()
 CPPUNIT_ASSERT_EQUAL(1, getPages());
 }
 
+void Test::testFdo49501()
+{
+load(fdo49501.rtf);
+
+uno::Referencestyle::XStyleFamiliesSupplier 
xStyleFamiliesSupplier(mxComponent, uno::UNO_QUERY);
+uno::Referencecontainer::XNameAccess 
xStyles(xStyleFamiliesSupplier-getStyleFamilies(), uno::UNO_QUERY);
+uno::Referencecontainer::XNameAccess 
xPageStyles(xStyles-getByName(PageStyles), uno::UNO_QUERY);
+uno::Referencebeans::XPropertySet 
xStyle(xPageStyles-getByName(Default), uno::UNO_QUERY);
+
+sal_Bool bIsLandscape = sal_False;
+xStyle-getPropertyValue(IsLandscape) = bIsLandscape;
+CPPUNIT_ASSERT_EQUAL(sal_True, bIsLandscape);
+sal_Int32 nExpected(TWIP_TO_MM100(567));
+sal_Int32 nValue = 0;
+xStyle-getPropertyValue(LeftMargin) = nValue;
+CPPUNIT_ASSERT_EQUAL(nExpected, nValue);
+xStyle-getPropertyValue(RightMargin) = nValue;
+CPPUNIT_ASSERT_EQUAL(nExpected, nValue);
+xStyle-getPropertyValue(TopMargin) = nValue;
+CPPUNIT_ASSERT_EQUAL(nExpected, nValue);
+xStyle-getPropertyValue(BottomMargin) = nValue;
+CPPUNIT_ASSERT_EQUAL(nExpected, nValue);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index b2f6c88..957174e 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -2620,34 +2620,30 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, 
int nParam)
 lcl_putNestedAttribute(m_aStates.top().aSectionSprms,
 NS_ooxml::LN_EG_SectPrContents_pgSz, 
NS_ooxml::LN_CT_PageSz_w, pIntValue, true);
 break;
-case RTF_MARGL:
+case RTF_MARGL: // fall through: set the default + current value
 lcl_putNestedAttribute(m_aDefaultState.aSectionSprms,
 NS_ooxml::LN_EG_SectPrContents_pgMar, 
NS_ooxml::LN_CT_PageMar_left, pIntValue, true);
-break;
-case RTF_MARGR:
-lcl_putNestedAttribute(m_aDefaultState.aSectionSprms,
-NS_ooxml::LN_EG_SectPrContents_pgMar, 
NS_ooxml::LN_CT_PageMar_right, pIntValue, true);
-break;
-case RTF_MARGT:
-lcl_putNestedAttribute(m_aDefaultState.aSectionSprms,
-NS_ooxml::LN_EG_SectPrContents_pgMar, 
NS_ooxml::LN_CT_PageMar_top, pIntValue, true);
-break;
-case RTF_MARGB:
-lcl_putNestedAttribute(m_aDefaultState.aSectionSprms,
-NS_ooxml::LN_EG_SectPrContents_pgMar, 
NS_ooxml::LN_CT_PageMar_bottom, pIntValue, true);
-break;
 case RTF_MARGLSXN:
 lcl_putNestedAttribute(m_aStates.top().aSectionSprms,
 NS_ooxml::LN_EG_SectPrContents_pgMar, 
NS_ooxml::LN_CT_PageMar_left, pIntValue, true);
 break;
+case RTF_MARGR: // fall through: set the default + current value
+lcl_putNestedAttribute(m_aDefaultState.aSectionSprms,
+NS_ooxml::LN_EG_SectPrContents_pgMar, 
NS_ooxml::LN_CT_PageMar_right, pIntValue, true);
 case RTF_MARGRSXN:
 lcl_putNestedAttribute(m_aStates.top().aSectionSprms,
 NS_ooxml::LN_EG_SectPrContents_pgMar, 
NS_ooxml::LN_CT_PageMar_right, pIntValue, true);
 break;
+case RTF_MARGT: // fall through: set the default + current value
+

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

2012-04-25 Thread Miklos Vajna
 sw/qa/extras/rtftok/data/fdo48193.rtf  |   10 +++
 sw/qa/extras/rtftok/rtftok.cxx |8 ++
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |   80 +
 writerfilter/source/rtftok/rtfdocumentimpl.hxx |   11 +++
 4 files changed, 60 insertions(+), 49 deletions(-)

New commits:
commit f1fdcdea5436e927dde9b4dd242c4f90c2a75e9d
Author: Miklos Vajna vmik...@suse.cz
Date:   Wed Apr 25 11:28:49 2012 +0200

avoid code duplication by introducing RTFDocumentImpl::singleChar

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index ed89aa2..ba4db68 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -833,6 +833,24 @@ bool RTFFrame::inFrame()
 || nY  0;
 }
 
+void RTFDocumentImpl::singleChar(sal_uInt8 nValue)
+{
+sal_uInt8 sValue[] = { nValue };
+if (!m_pCurrentBuffer)
+{
+Mapper().startCharacterGroup();
+Mapper().text(sValue, 1);
+Mapper().endCharacterGroup();
+}
+else
+{
+m_pCurrentBuffer-push_back(make_pair(BUFFER_STARTRUN, 
RTFValue::Pointer_t()));
+RTFValue::Pointer_t pValue(new RTFValue(*sValue));
+m_pCurrentBuffer-push_back(make_pair(BUFFER_TEXT, pValue));
+m_pCurrentBuffer-push_back(make_pair(BUFFER_ENDRUN, 
RTFValue::Pointer_t()));
+}
+}
+
 void RTFDocumentImpl::text(OUString rString)
 {
 bool bRet = true;
@@ -1075,22 +1093,7 @@ int RTFDocumentImpl::dispatchDestination(RTFKeyword 
nKeyword)
 if (aBuf.toString().equals(EQ))
 m_bEq = true;
 else
-{
-sal_uInt8 sFieldStart[] = { 0x13 };
-if (!m_pCurrentBuffer)
-{
-Mapper().startCharacterGroup();
-Mapper().text(sFieldStart, 1);
-Mapper().endCharacterGroup();
-}
-else
-{
-m_pCurrentBuffer-push_back(make_pair(BUFFER_STARTRUN, 
RTFValue::Pointer_t()));
-RTFValue::Pointer_t pValue(new RTFValue(*sFieldStart));
-m_pCurrentBuffer-push_back(make_pair(BUFFER_TEXT, 
pValue));
-m_pCurrentBuffer-push_back(make_pair(BUFFER_ENDRUN, 
RTFValue::Pointer_t()));
-}
-}
+singleChar(0x13);
 m_aStates.top().nDestinationState = 
DESTINATION_FIELDINSTRUCTION;
 }
 break;
@@ -3025,42 +3028,12 @@ int RTFDocumentImpl::popState()
 m_aFormfieldSprms-clear();
 }
 if (!m_bEq)
-{
-sal_uInt8 sFieldSep[] = { 0x14 };
-if (!m_pCurrentBuffer)
-{
-Mapper().startCharacterGroup();
-Mapper().text(sFieldSep, 1);
-Mapper().endCharacterGroup();
-}
-else
-{
-m_pCurrentBuffer-push_back(make_pair(BUFFER_STARTRUN, 
RTFValue::Pointer_t()));
-RTFValue::Pointer_t pValue(new RTFValue(*sFieldSep));
-m_pCurrentBuffer-push_back(make_pair(BUFFER_TEXT, pValue));
-m_pCurrentBuffer-push_back(make_pair(BUFFER_ENDRUN, 
RTFValue::Pointer_t()));
-}
-}
+singleChar(0x14);
 }
 else if (m_aStates.top().nDestinationState == DESTINATION_FIELDRESULT)
 {
 if (!m_bEq)
-{
-sal_uInt8 sFieldEnd[] = { 0x15 };
-if (!m_pCurrentBuffer)
-{
-Mapper().startCharacterGroup();
-Mapper().text(sFieldEnd, 1);
-Mapper().endCharacterGroup();
-}
-else
-{
-m_pCurrentBuffer-push_back(make_pair(BUFFER_STARTRUN, 
RTFValue::Pointer_t()));
-RTFValue::Pointer_t pValue(new RTFValue(*sFieldEnd));
-m_pCurrentBuffer-push_back(make_pair(BUFFER_TEXT, pValue));
-m_pCurrentBuffer-push_back(make_pair(BUFFER_ENDRUN, 
RTFValue::Pointer_t()));
-}
-}
+singleChar(0x15);
 else
 m_bEq = false;
 }
@@ -3465,22 +3438,7 @@ int RTFDocumentImpl::popState()
 else if (aState.nDestinationState == DESTINATION_FIELD)
 {
 if (aState.nFieldStatus == FIELD_INSTRUCTION)
-{
-sal_uInt8 sFieldEnd[] = { 0x15 };
-if (!m_pCurrentBuffer)
-{
-Mapper().startCharacterGroup();
-Mapper().text(sFieldEnd, 1);
-Mapper().endCharacterGroup();
-}
-else
-{
-m_pCurrentBuffer-push_back(make_pair(BUFFER_STARTRUN, 
RTFValue::Pointer_t()));
-RTFValue::Pointer_t pValue(new RTFValue(*sFieldEnd));
-

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

2012-04-21 Thread Miklos Vajna
 sw/qa/extras/rtftok/data/fdo48023.rtf  |8 
 sw/qa/extras/rtftok/rtftok.cxx |   25 +
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |   17 +++--
 3 files changed, 48 insertions(+), 2 deletions(-)

New commits:
commit e0190ffa766dbe26a9d4e9dd29e00baaf0ccd5b9
Author: Miklos Vajna vmik...@suse.cz
Date:   Sat Apr 21 11:28:41 2012 +0200

rtftok: dump collected strings after encoding

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 2b30481..e50cc1f 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -818,9 +818,9 @@ int RTFDocumentImpl::resolveChars(char ch)
 m_aStates.top().aLevelNumbers.push_back(sal_Int32(ch));
 return 0;
 }
-SAL_INFO(writerfilter, OSL_THIS_FUNC  : collected '  aStr.getStr() 
 ');
 
 OUString aOUStr(OStringToOUString(aStr, m_aStates.top().nCurrentEncoding));
+SAL_INFO(writerfilter, OSL_THIS_FUNC  : collected '  aOUStr  
');
 
 if (m_aStates.top().nDestinationState == DESTINATION_COLORTABLE)
 {
commit f8bda240a09b4ece1c3401874b3cc8f325dbcedb
Author: Miklos Vajna vmik...@suse.cz
Date:   Sat Apr 21 11:25:18 2012 +0200

fdo#48023 fix RTF import of Russian characters without an encoding specified

lcl_GetDefaultTextEncodingForRTF() in editeng did the same.

diff --git a/sw/qa/extras/rtftok/data/fdo48023.rtf 
b/sw/qa/extras/rtftok/data/fdo48023.rtf
new file mode 100644
index 000..6d6a0d9
--- /dev/null
+++ b/sw/qa/extras/rtftok/data/fdo48023.rtf
@@ -0,0 +1,8 @@
+{\rtf
+{\fonttbl
+{\f1 Arial;}
+}
+\pard
+\f1 Ïðîãðàììèñò
+\par
+}
diff --git a/sw/qa/extras/rtftok/rtftok.cxx b/sw/qa/extras/rtftok/rtftok.cxx
index fa1321f..6870f02 100644
--- a/sw/qa/extras/rtftok/rtftok.cxx
+++ b/sw/qa/extras/rtftok/rtftok.cxx
@@ -82,6 +82,7 @@ public:
 void testFdo44176();
 void testFdo39053();
 void testFdo48356();
+void testFdo48023();
 
 CPPUNIT_TEST_SUITE(RtfModelTest);
 #if !defined(MACOSX)  !defined(WNT)
@@ -106,6 +107,7 @@ public:
 CPPUNIT_TEST(testFdo44176);
 CPPUNIT_TEST(testFdo39053);
 CPPUNIT_TEST(testFdo48356);
+CPPUNIT_TEST(testFdo48023);
 #endif
 CPPUNIT_TEST_SUITE_END();
 
@@ -574,6 +576,29 @@ void RtfModelTest::testFdo48356()
 CPPUNIT_ASSERT_EQUAL(1, i);
 }
 
+void RtfModelTest::testFdo48023()
+{
+lang::Locale aLocale;
+aLocale.Language = ru;
+AllSettings aSettings(Application::GetSettings());
+AllSettings aSavedSettings(aSettings);
+aSettings.SetLocale(aLocale);
+Application::SetSettings(aSettings);
+load(fdo48023.rtf);
+Application::SetSettings(aSavedSettings);
+
+uno::Referencetext::XTextDocument xTextDocument(mxComponent, 
uno::UNO_QUERY);
+uno::Referencecontainer::XEnumerationAccess 
xParaEnumAccess(xTextDocument-getText(), uno::UNO_QUERY);
+uno::Referencecontainer::XEnumeration xParaEnum = 
xParaEnumAccess-createEnumeration();
+uno::Referencecontainer::XEnumerationAccess 
xRangeEnumAccess(xParaEnum-nextElement(), uno::UNO_QUERY);
+uno::Referencecontainer::XEnumeration xRangeEnum = 
xRangeEnumAccess-createEnumeration();
+uno::Referencetext::XTextRange xTextRange(xRangeEnum-nextElement(), 
uno::UNO_QUERY);
+
+// Implicit encoding detection based on locale was missing
+OUString aExpected(Программист, 22, RTL_TEXTENCODING_UTF8);
+CPPUNIT_ASSERT_EQUAL(aExpected, xTextRange-getString());
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(RtfModelTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 2527cef..2b30481 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -513,13 +513,26 @@ sal_uInt32 RTFDocumentImpl::getColorTable(sal_uInt32 
nIndex)
 return 0;
 }
 
+rtl_TextEncoding lcl_getDefaultTextEncoding()
+{
+
+const OUString rLanguage = 
Application::GetSettings().GetLocale().Language;
+
+if (rLanguage == ru || rLanguage == uk)
+return RTL_TEXTENCODING_MS_1251;
+if (rLanguage == tr)
+return RTL_TEXTENCODING_MS_1254;
+else
+return RTL_TEXTENCODING_MS_1252;
+}
+
 rtl_TextEncoding RTFDocumentImpl::getEncoding(sal_uInt32 nFontIndex)
 {
 if (!m_pSuperstream)
 {
 if (nFontIndex  m_aFontEncodings.size())
 return m_aFontEncodings[nFontIndex];
-return 0;
+return lcl_getDefaultTextEncoding();
 }
 else
 return m_pSuperstream-getEncoding(nFontIndex);
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2012-04-15 Thread Miklos Vajna
 sw/qa/extras/rtftok/data/fdo39053.rtf  |binary
 sw/qa/extras/rtftok/rtftok.cxx |   21 +++
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |   66 +
 writerfilter/source/rtftok/rtfdocumentimpl.hxx |4 +
 writerfilter/source/rtftok/rtftokenizer.cxx|4 +
 5 files changed, 74 insertions(+), 21 deletions(-)

New commits:
commit 385017e0f2147d2a49e36d6c44ae76a1e7600668
Author: Miklos Vajna vmik...@suse.cz
Date:   Sun Apr 15 14:39:27 2012 +0200

testcase for fdo#39053

diff --git a/sw/qa/extras/rtftok/data/fdo39053.rtf 
b/sw/qa/extras/rtftok/data/fdo39053.rtf
new file mode 100644
index 000..71d2691
Binary files /dev/null and b/sw/qa/extras/rtftok/data/fdo39053.rtf differ
diff --git a/sw/qa/extras/rtftok/rtftok.cxx b/sw/qa/extras/rtftok/rtftok.cxx
index 9fbffca..2b5146a 100644
--- a/sw/qa/extras/rtftok/rtftok.cxx
+++ b/sw/qa/extras/rtftok/rtftok.cxx
@@ -82,6 +82,7 @@ public:
 void testFdo45182();
 void testFdo44176();
 void testZoom();
+void testFdo39053();
 
 CPPUNIT_TEST_SUITE(RtfModelTest);
 #if !defined(MACOSX)  !defined(WNT)
@@ -105,6 +106,7 @@ public:
 CPPUNIT_TEST(testFdo45182);
 CPPUNIT_TEST(testFdo44176);
 CPPUNIT_TEST(testZoom);
+CPPUNIT_TEST(testFdo39053);
 #endif
 CPPUNIT_TEST_SUITE_END();
 
@@ -548,6 +550,25 @@ void RtfModelTest::testZoom()
 CPPUNIT_ASSERT_EQUAL(sal_Int16(42), nValue);
 }
 
+void RtfModelTest::testFdo39053()
+{
+load(fdo39053.rtf);
+
+uno::Referencedrawing::XDrawPageSupplier xDrawPageSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Referencecontainer::XIndexAccess 
xDraws(xDrawPageSupplier-getDrawPage(), uno::UNO_QUERY);
+int nAsCharacter = 0;
+for (int i = 0; i  xDraws-getCount(); ++i)
+{
+uno::Referencebeans::XPropertySet 
xPropertySet(xDraws-getByIndex(i), uno::UNO_QUERY);
+text::TextContentAnchorType eValue;
+xPropertySet-getPropertyValue(AnchorType) = eValue;
+if (eValue == text::TextContentAnchorType_AS_CHARACTER)
+nAsCharacter++;
+}
+// The image in binary format was ignored.
+CPPUNIT_ASSERT_EQUAL(1, nAsCharacter);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(RtfModelTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
commit 5187174cd4054486100ef29125ee4a36f7e3bee3
Author: Miklos Vajna vmik...@suse.cz
Date:   Sun Apr 15 14:10:49 2012 +0200

fdo#39053 writerfilter: implement RTF_BIN

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index e00458d..54fdac2 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -574,34 +574,42 @@ void RTFDocumentImpl::resolve(Stream  rMapper)
 int RTFDocumentImpl::resolvePict(bool bInline)
 {
 SvMemoryStream aStream;
-int b = 0, count = 2;
+SvStream *pStream = 0;
 
-// Feed the destination text to a stream.
-OString aStr = 
OUStringToOString(m_aStates.top().aDestinationText.makeStringAndClear(), 
RTL_TEXTENCODING_ASCII_US);
-const char *str = aStr.getStr();
-for (int i = 0; i  aStr.getLength(); ++i)
+if (!m_pBinaryData.get())
 {
-char ch = str[i];
-if (ch != 0x0d  ch != 0x0a)
+pStream = aStream;
+int b = 0, count = 2;
+
+// Feed the destination text to a stream.
+OString aStr = 
OUStringToOString(m_aStates.top().aDestinationText.makeStringAndClear(), 
RTL_TEXTENCODING_ASCII_US);
+const char *str = aStr.getStr();
+for (int i = 0; i  aStr.getLength(); ++i)
 {
-b = b  4;
-sal_Int8 parsed = m_pTokenizer-asHex(ch);
-if (parsed == -1)
-return ERROR_HEX_INVALID;
-b += parsed;
-count--;
-if (!count)
-{
-aStream  (char)b;
-count = 2;
-b = 0;
+char ch = str[i];
+if (ch != 0x0d  ch != 0x0a)
+{
+b = b  4;
+sal_Int8 parsed = m_pTokenizer-asHex(ch);
+if (parsed == -1)
+return ERROR_HEX_INVALID;
+b += parsed;
+count--;
+if (!count)
+{
+aStream  (char)b;
+count = 2;
+b = 0;
+}
 }
 }
 }
+else
+pStream = m_pBinaryData.get();
 
 // Store, and get its URL.
-aStream.Seek(0);
-uno::Referenceio::XInputStream xInputStream(new 
utl::OInputStreamWrapper(aStream));
+pStream-Seek(0);
+uno::Referenceio::XInputStream xInputStream(new 
utl::OInputStreamWrapper(pStream));
 WMF_EXTERNALHEADER aExtHeader;
 aExtHeader.mapMode = m_aStates.top().aPicture.eWMetafile;
 aExtHeader.xExt = m_aStates.top().aPicture.nWidth;
@@ -736,6 +744,19 @@ int RTFDocumentImpl::resolvePict(bool bInline)
 
 int RTFDocumentImpl::resolveChars(char ch)
 {
+

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

2012-04-02 Thread Miklos Vajna
 sw/qa/extras/rtftok/data/fdo48104.rtf  |6 ++
 sw/qa/extras/rtftok/rtftok.cxx |   25 -
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |   18 +-
 writerfilter/source/rtftok/rtfdocumentimpl.hxx |2 --
 4 files changed, 31 insertions(+), 20 deletions(-)

New commits:
commit 0f330ea25840690d05516adc20cfb3d1a9d33317
Author: Miklos Vajna vmik...@suse.cz
Date:   Mon Apr 2 14:24:53 2012 +0200

RtfModelTest: introduce common getPages() method

diff --git a/sw/qa/extras/rtftok/rtftok.cxx b/sw/qa/extras/rtftok/rtftok.cxx
index 7f9b498..ac7a2e4 100644
--- a/sw/qa/extras/rtftok/rtftok.cxx
+++ b/sw/qa/extras/rtftok/rtftok.cxx
@@ -103,6 +103,8 @@ private:
 void load(const OUString rURL);
 /// Get the length of the whole document.
 int getLength();
+/// Get page count.
+int getPages();
 uno::Referencelang::XComponent mxComponent;
 };
 
@@ -130,6 +132,15 @@ int RtfModelTest::getLength()
 return aBuf.getLength();
 }
 
+int RtfModelTest::getPages()
+{
+uno::Referenceframe::XModel xModel(mxComponent, uno::UNO_QUERY);
+uno::Referencetext::XTextViewCursorSupplier 
xTextViewCursorSupplier(xModel-getCurrentController(), uno::UNO_QUERY);
+uno::Referencetext::XPageCursor 
xCursor(xTextViewCursorSupplier-getViewCursor(), uno::UNO_QUERY);
+xCursor-jumpToLastPage();
+return xCursor-getPage();
+}
+
 void RtfModelTest::setUp()
 {
 test::BootstrapFixture::setUp();
@@ -382,11 +393,7 @@ void RtfModelTest::testFdo43965()
 CPPUNIT_ASSERT_EQUAL(sal_uInt32(26), aBorder.LineWidth);
 
 // Finally, make sure that we have two pages
-uno::Referenceframe::XModel xModel(mxComponent, uno::UNO_QUERY);
-uno::Referencetext::XTextViewCursorSupplier 
xTextViewCursorSupplier(xModel-getCurrentController(), uno::UNO_QUERY);
-uno::Referencetext::XPageCursor 
xCursor(xTextViewCursorSupplier-getViewCursor(), uno::UNO_QUERY);
-xCursor-jumpToLastPage();
-CPPUNIT_ASSERT_EQUAL(sal_Int16(2), xCursor-getPage());
+CPPUNIT_ASSERT_EQUAL(2, getPages());
 }
 
 void RtfModelTest::testN751020()
@@ -476,11 +483,7 @@ void RtfModelTest::testFdo45394()
 void RtfModelTest::testFdo48104()
 {
 load(OUString(RTL_CONSTASCII_USTRINGPARAM(fdo48104.rtf)));
-uno::Referenceframe::XModel xModel(mxComponent, uno::UNO_QUERY);
-uno::Referencetext::XTextViewCursorSupplier 
xTextViewCursorSupplier(xModel-getCurrentController(), uno::UNO_QUERY);
-uno::Referencetext::XPageCursor 
xCursor(xTextViewCursorSupplier-getViewCursor(), uno::UNO_QUERY);
-xCursor-jumpToLastPage();
-CPPUNIT_ASSERT_EQUAL(sal_Int16(2), xCursor-getPage());
+CPPUNIT_ASSERT_EQUAL(2, getPages());
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(RtfModelTest);
commit 7b58fc3dafc789aa55fff5ffef6ab83c3aa8b6e0
Author: Miklos Vajna vmik...@suse.cz
Date:   Mon Apr 2 14:10:39 2012 +0200

fdo#48104 fix RTF import of \page in inner groups

If we have a postponed page break and it's sent to dmapper during a new
inner group, we'll still have the page break request after the parser
state is popped, leading to duplicated page breaks. Instead of the
earlier workaround, just send the proper token to the domain mapper, and
it'll handle it properly.

diff --git a/sw/qa/extras/rtftok/data/fdo48104.rtf 
b/sw/qa/extras/rtftok/data/fdo48104.rtf
new file mode 100644
index 000..64d5e59
--- /dev/null
+++ b/sw/qa/extras/rtftok/data/fdo48104.rtf
@@ -0,0 +1,6 @@
+{\rtf1
+first page\par
+\page 
+{second page first line\par}
+second page second line\par
+}
diff --git a/sw/qa/extras/rtftok/rtftok.cxx b/sw/qa/extras/rtftok/rtftok.cxx
index f13e15d..7f9b498 100644
--- a/sw/qa/extras/rtftok/rtftok.cxx
+++ b/sw/qa/extras/rtftok/rtftok.cxx
@@ -75,6 +75,7 @@ public:
 void testFdo47036();
 void testFdo46955();
 void testFdo45394();
+void testFdo48104();
 
 CPPUNIT_TEST_SUITE(RtfModelTest);
 #if !defined(MACOSX)  !defined(WNT)
@@ -93,6 +94,7 @@ public:
 CPPUNIT_TEST(testFdo47036);
 CPPUNIT_TEST(testFdo46955);
 CPPUNIT_TEST(testFdo45394);
+CPPUNIT_TEST(testFdo48104);
 #endif
 CPPUNIT_TEST_SUITE_END();
 
@@ -471,6 +473,16 @@ void RtfModelTest::testFdo45394()
 CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess-getCount());
 }
 
+void RtfModelTest::testFdo48104()
+{
+load(OUString(RTL_CONSTASCII_USTRINGPARAM(fdo48104.rtf)));
+uno::Referenceframe::XModel xModel(mxComponent, uno::UNO_QUERY);
+uno::Referencetext::XTextViewCursorSupplier 
xTextViewCursorSupplier(xModel-getCurrentController(), uno::UNO_QUERY);
+uno::Referencetext::XPageCursor 
xCursor(xTextViewCursorSupplier-getViewCursor(), uno::UNO_QUERY);
+xCursor-jumpToLastPage();
+CPPUNIT_ASSERT_EQUAL(sal_Int16(2), xCursor-getPage());
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(RtfModelTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index e63c451..038ead9