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

2015-10-07 Thread Miklos Vajna
 sw/qa/extras/ooxmlimport/data/tdf92454.docx  |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx |   10 ++
 writerfilter/source/dmapper/DomainMapper.cxx |7 +++
 3 files changed, 17 insertions(+)

New commits:
commit 2ca166ebbe2adbd8f129403c7f8e5646c70ab67d
Author: Miklos Vajna 
Date:   Tue Sep 22 08:47:03 2015 +0200

tdf#92454 DOCX import: allow overriding para prop from num style in para 
style

Word has a feature like this: a paragraph style can refer to a numbering
style, and both can specify paragraph margins. If that's the case, then
the ones from the paragraph style has priority.

In Writer, the numbering style has priority, so the only chance for
correct import result is to set the margin directly on the paragraph in
this case.

(cherry picked from commit f4badd9a485f32f787d78431ed673e2932973887)

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

Change-Id: Iff3b03bcc56e0db3a48452c293acf41c91b8f159
Reviewed-on: https://gerrit.libreoffice.org/19100
Reviewed-by: Andras Timar 
Tested-by: Andras Timar 

diff --git a/sw/qa/extras/ooxmlimport/data/tdf92454.docx 
b/sw/qa/extras/ooxmlimport/data/tdf92454.docx
new file mode 100644
index 000..7042668
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf92454.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index fa8d504..a71c4f9 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -2647,6 +2647,16 @@ DECLARE_OOXMLIMPORT_TEST(testTdf93919, "tdf93919.docx")
 CPPUNIT_ASSERT_EQUAL(static_cast(1270), 
getProperty(getParagraph(1), "ParaLeftMargin"));
 }
 
+DECLARE_OOXMLIMPORT_TEST(testTdf92454, "tdf92454.docx")
+{
+// The first paragraph had a large indentation / left margin as inheritance
+// in Word and Writer works differently, and no direct value was set to be
+// explicit.
+uno::Reference xParagraph(getParagraph(1), 
uno::UNO_QUERY);
+// This was beans::PropertyState_DEFAULT_VALUE.
+CPPUNIT_ASSERT_EQUAL(beans::PropertyState_DIRECT_VALUE, 
xParagraph->getPropertyState("ParaFirstLineIndent"));
+}
+
 #endif
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index a56fbed..835e973 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -2017,6 +2017,13 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, 
PropertyMapPtr rContext )
 
 rContext->Insert(PROP_PARA_RIGHT_MARGIN, 
uno::makeAny(nParaRightMargin));
 }
+
+// Indent properties from the paragraph style have priority
+// over the ones from the numbering styles in Word, not in
+// Writer.
+boost::optional oProperty;
+if (pStyleSheetProperties && (oProperty = 
pStyleSheetProperties->getProperty(PROP_PARA_FIRST_LINE_INDENT)))
+rContext->Insert(PROP_PARA_FIRST_LINE_INDENT, 
oProperty->second);
 }
 
 if( pStyleSheetProperties && pStyleSheetProperties->GetListLevel() 
>= 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-4' - sw/qa writerfilter/source

2015-10-01 Thread Miklos Vajna
 sw/qa/extras/ooxmlimport/data/tdf93919.docx  |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx |6 ++
 writerfilter/source/dmapper/DomainMapper.cxx |5 +
 3 files changed, 11 insertions(+)

New commits:
commit 950cfbd75a216527d850351e4b3e0be4f8870a7d
Author: Miklos Vajna 
Date:   Mon Sep 28 14:03:25 2015 +0200

bnc#939996 tdf#93919 DOCX import: fix left-from-style and first-from-direct

With this,  as direct paragraph formatting and
 as a numbering level formatting is
properly merged, i.e. w:left is not lost, defaulting to 0.

(cherry picked from commit 56341e5d496f576dc45fe8e6c44831d780fecb73)

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

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

diff --git a/sw/qa/extras/ooxmlimport/data/tdf93919.docx 
b/sw/qa/extras/ooxmlimport/data/tdf93919.docx
new file mode 100644
index 000..c745469
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf93919.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 20cb6fe..fa8d504 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -2641,6 +2641,12 @@ DECLARE_OOXMLIMPORT_TEST(testTdf87924, "tdf87924.docx")
 CPPUNIT_ASSERT_EQUAL(static_cast(0), 
aGeometry["TextPreRotateAngle"].get());
 }
 
+DECLARE_OOXMLIMPORT_TEST(testTdf93919, "tdf93919.docx")
+{
+// This was 0, left margin was not inherited from the list style.
+CPPUNIT_ASSERT_EQUAL(static_cast(1270), 
getProperty(getParagraph(1), "ParaLeftMargin"));
+}
+
 #endif
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index b0c6724..a56fbed 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -466,6 +466,11 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
 sal_Int32 nValue = ConversionHelper::convertTwipToMM100( 
nIntValue );
 m_pImpl->GetTopContext()->Insert(
 PROP_PARA_FIRST_LINE_INDENT, uno::makeAny( - nValue ));
+
+// See above, need to inherit left margin from list style when 
first is set.
+sal_Int32 nParaLeftMargin = 
m_pImpl->getCurrentNumberingProperty("IndentAt");
+if (nParaLeftMargin != 0)
+m_pImpl->GetTopContext()->Insert(PROP_PARA_LEFT_MARGIN, 
uno::makeAny(nParaLeftMargin), /*bOverwrite=*/false);
 }
 break;
 case NS_ooxml::LN_CT_Ind_firstLine:
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-08-10 Thread Mark Hung
 sw/qa/extras/ooxmlexport/data/tdf91594.docx   |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx  |   17 +++
 writerfilter/source/dmapper/DomainMapper.cxx  |   51 +-
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |6 --
 writerfilter/source/dmapper/DomainMapper_Impl.hxx |   19 ++--
 writerfilter/source/ooxml/model.xml   |1 
 6 files changed, 55 insertions(+), 39 deletions(-)

New commits:
commit 53e86198f2a40f40f291fb6a9cf5cc67e45df94c
Author: Mark Hung mark...@gmail.com
Date:   Wed Jun 24 01:40:13 2015 +0800

tdf#91594 misinterprets letters from Symbol font in docx files

Fix the issue caused by wrong assumption about symbol chracter
and symbol font attributes order in writerfilter. Also allow
symbols to be displayed if user's language is not Western.

Reviewed-on: https://gerrit.libreoffice.org/16543
Tested-by: Jenkins c...@libreoffice.org
Reviewed-by: Michael Stahl mst...@redhat.com

Conflicts:
writerfilter/source/dmapper/DomainMapper.cxx

Change-Id: I602d9fbfa79c33c90f655dbf5ee22738b6391ae6
Reviewed-on: https://gerrit.libreoffice.org/17456
Reviewed-by: Miklos Vajna vmik...@collabora.co.uk
Tested-by: Miklos Vajna vmik...@collabora.co.uk

diff --git a/sw/qa/extras/ooxmlexport/data/tdf91594.docx 
b/sw/qa/extras/ooxmlexport/data/tdf91594.docx
new file mode 100644
index 000..ea539af
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf91594.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 2e4b8a3..2d265e2 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -661,6 +661,23 @@ DECLARE_OOXMLEXPORT_TEST(testTdf89890, tdf89890.docx)
 CPPUNIT_ASSERT(bFound);
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf91594, tdf91594.docx)
+{
+uno::Referencetext::XTextRange xPara1(getParagraph(1));
+CPPUNIT_ASSERT_EQUAL(sal_Unicode(0xf0fb), xPara1-getString()[0] );
+uno::Referencetext::XTextRange xPara2(getParagraph(2));
+CPPUNIT_ASSERT_EQUAL(sal_Unicode(0xf0fc), xPara2-getString()[0] );
+uno::Referencetext::XTextRange xPara3(getParagraph(3));
+CPPUNIT_ASSERT_EQUAL(sal_Unicode(0xf0fd), xPara3-getString()[0] );
+uno::Referencetext::XTextRange xPara4(getParagraph(4));
+CPPUNIT_ASSERT_EQUAL(sal_Unicode(0xf0fe), xPara4-getString()[0] );
+
+uno::Referencebeans::XPropertySet xRun(getRun(xPara1,1), uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString(Wingdings), getPropertyOUString(xRun, 
CharFontName));
+CPPUNIT_ASSERT_EQUAL(OUString(Wingdings), getPropertyOUString(xRun, 
CharFontNameAsian));
+CPPUNIT_ASSERT_EQUAL(OUString(Wingdings), getPropertyOUString(xRun, 
CharFontNameComplex));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index 8dc4ef2..b0c6724 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -239,37 +239,10 @@ void DomainMapper::lcl_attribute(Id nName, Value  val)
 break;
 
 case NS_ooxml::LN_CT_Sym_char:
-if( m_pImpl-GetTopContext()  
m_pImpl-GetTopContext()-GetFootnote().is())
-{
-m_pImpl-GetTopContext()-GetFootnote()-setLabel(OUString( 
sal_Unicode(nIntValue)));
-break;
-}
-else //it's a _real_ symbol
-{
-m_pImpl-SetSymbolData(nIntValue);
-}
+m_pImpl-SetSymbolChar(nIntValue);
 break;
 case NS_ooxml::LN_CT_Sym_font:
-//the footnote symbol and font are provided after the footnote is 
already inserted
-if( m_pImpl-GetTopContext()  
m_pImpl-GetTopContext()-GetFootnote().is())
-{
-uno::Reference beans::XPropertySet  xAnchorProps( 
m_pImpl-GetTopContext()-GetFootnote()-getAnchor(), uno::UNO_QUERY );
-xAnchorProps-setPropertyValue(
-PropertyNameSupplier::GetPropertyNameSupplier().GetName( 
PROP_CHAR_FONT_NAME),
-uno::makeAny( sStringValue ));
-}
-else //a real symbol
-if (m_pImpl-GetTopContext())
-{
-m_pImpl-GetTopContext()-Insert(PROP_CHAR_FONT_NAME, 
uno::makeAny( sStringValue ));
-/*
- * In case of symbol, symbol character get imported first and 
then font of symbols.
- * So we are storing symbol character and when we parse symbol 
font then create UNO object for text.
- */
-sal_Int32 symboldata = m_pImpl-GetSymbolData();
-utext( reinterpret_cast  const sal_uInt8 * ( (symboldata) 
), 1 );
-}
-
+m_pImpl-SetSymbolFont(sStringValue);
 break;
 case NS_ooxml::LN_CT_Underline_val:
 

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

2015-07-28 Thread Miklos Vajna
 sw/qa/extras/ooxmlimport/data/tdf89702.docx   |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx  |   14 ++
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   16 ++--
 3 files changed, 24 insertions(+), 6 deletions(-)

New commits:
commit 3370c2caa28577a80f81efb954a227c58531c6ee
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Tue Jul 21 09:04:44 2015 +0200

tdf#89702 DOCX import: fix too large bullet character

Commit c1f8437dbed0e8b989e41a345ef7e658a6e8a4cd (fdo#83465 RTF import:
handle font of numbering, 2014-09-25), changed the get the me character
style of the current numbering's current level member function to be
successfull even in case we're inside a DOCX run, not when we're inside
a DOCX paragraph, but outside runs.

While this is necessary for RTF, the side effect of this was that
unwanted run properties started to affect the above mentioned character
style in case of DOCX.

Fix the problem by enabling the in paragraph and run looking for RTF
only.

Change-Id: I610bfce6cec15b918fe547402360f5a894401f7e
(cherry picked from commit fc7c1a07d0d5e21a4e1533a0e5b0ac256763f973)
Reviewed-on: https://gerrit.libreoffice.org/17380
Reviewed-by: Jan Holesovsky ke...@collabora.com
Tested-by: Jan Holesovsky ke...@collabora.com

diff --git a/sw/qa/extras/ooxmlimport/data/tdf89702.docx 
b/sw/qa/extras/ooxmlimport/data/tdf89702.docx
new file mode 100644
index 000..5542d1c
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf89702.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 1f5843d..ced25ac 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -2609,6 +2609,20 @@ DECLARE_OOXMLIMPORT_TEST(testTdf90611, tdf90611.docx)
 CPPUNIT_ASSERT_EQUAL(10.f, getPropertyfloat(getParagraphOfText(1, 
xFootnoteText), CharHeight));
 }
 
+DECLARE_OOXMLIMPORT_TEST(testTdf89702, tdf89702.docx)
+{
+// Get the first paragraph's numbering style's 2nd level's character style 
name.
+uno::Referencetext::XTextRange xParagraph = getParagraph(1);
+auto xLevels = getProperty uno::Referencecontainer::XIndexAccess 
(xParagraph, NumberingRules);
+uno::Sequencebeans::PropertyValue aLevel;
+xLevels-getByIndex(1) = aLevel; // 2nd level
+OUString aCharStyleName = std::find_if(aLevel.begin(), aLevel.end(), 
[](const beans::PropertyValue rValue) { return rValue.Name == CharStyleName; 
})-Value.getOUString();
+
+// Make sure that the font name is Arial, this was Verdana.
+uno::Referencebeans::XPropertySet 
xStyle(getStyles(CharacterStyles)-getByName(aCharStyleName), uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString(Arial), getPropertyOUString(xStyle, 
CharFontName));
+}
+
 #endif
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 66453ac..f6874f5 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -4942,12 +4942,16 @@ uno::Referencebeans::XPropertySet 
DomainMapper_Impl::GetCurrentNumberingCharSt
 uno::Referencecontainer::XIndexAccess xLevels = 
GetCurrentNumberingRules(nListLevel);
 if (!xLevels.is())
 {
-// Looking up the paragraph context explicitly (and not just taking
-// the top context) is necessary for RTF, where formatting of a run
-// and of the paragraph mark is not separated.
-PropertyMapPtr pContext = GetTopContextOfType(CONTEXT_PARAGRAPH);
-if (!pContext)
-return xRet;
+PropertyMapPtr pContext = m_pTopContext;
+if (IsRTFImport())
+{
+// Looking up the paragraph context explicitly (and not just 
taking
+// the top context) is necessary for RTF, where formatting of 
a run
+// and of the paragraph mark is not separated.
+pContext = GetTopContextOfType(CONTEXT_PARAGRAPH);
+if (!pContext)
+return xRet;
+}
 
 // In case numbering rules is not found via a style, try the 
direct formatting instead.
 boost::optionalPropertyMap::Property oProp = 
pContext-getProperty(PROP_NUMBERING_RULES);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-07-24 Thread Michael Stahl
 sw/qa/extras/rtfimport/data/tdf90046.rtf   |8 
 sw/qa/extras/rtfimport/rtfimport.cxx   |9 +
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |1 +
 3 files changed, 18 insertions(+)

New commits:
commit c6f8e34c713c205fa9d2e10f5560eff37ad95a34
Author: Michael Stahl mst...@redhat.com
Date:   Fri Jul 24 14:40:53 2015 +0200

tdf#90046: RTF import: ensure that a run is started before \footnote

Avoids crashing with empty context stacks.

Change-Id: I0ee8b457fdbb19b55f5c15876b7253680cde6e23
(cherry picked from commit a61fd02c819433a1206b3b3e61017ba2d0d3d467)
Reviewed-on: https://gerrit.libreoffice.org/17333
Reviewed-by: Caolán McNamara caol...@redhat.com
Tested-by: Caolán McNamara caol...@redhat.com

diff --git a/sw/qa/extras/rtfimport/data/tdf90046.rtf 
b/sw/qa/extras/rtfimport/data/tdf90046.rtf
new file mode 100644
index 000..656adb5
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/tdf90046.rtf
@@ -0,0 +1,8 @@
+{\rtf1\ansi\deflang1035
+{\fonttbl {\f0\fcharset0 Arial;} }
+
+\pard\ltrpar\uc1\lang1035
+{\super \chftn
+{\footnote {\pard\plain\super \chftn }{\plain\ltrch\f0 \fs18 \cf1 \uc0\u77 
\u97 }
+}}
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx 
b/sw/qa/extras/rtfimport/rtfimport.cxx
index bfff118..bd2e974 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -2225,6 +2225,15 @@ DECLARE_RTFIMPORT_TEST(testFdo85889pca, 
fdo85889-pca.rtf)
 CPPUNIT_ASSERT_EQUAL(aExpected, xTextRange-getString());
 }
 
+DECLARE_RTFIMPORT_TEST(testTdf90046, tdf90046.rtf)
+{
+// this was crashing on importing the footnote
+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);
+CPPUNIT_ASSERT_EQUAL(OUString(Ma), xTextRange-getString());
+}
+
 DECLARE_RTFIMPORT_TEST(testFdo85889mac, fdo85889-mac.rtf)
 {
 uno::Referencetext::XTextRange xTextRange = getRun(getParagraph(1), 1);
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index ea5a212..259a19a 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -1683,6 +1683,7 @@ int RTFDocumentImpl::dispatchDestination(RTFKeyword 
nKeyword)
 }
 break;
 case RTF_FOOTNOTE:
+checkFirstRun();
 if (!m_pSuperstream)
 {
 Id nId = NS_ooxml::LN_footnote;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-07-09 Thread Miklos Vajna
 sw/qa/extras/ooxmlimport/data/tdf90611.docx   |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx  |   10 ++
 writerfilter/source/dmapper/DomainMapper.cxx  |2 +-
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   13 +
 writerfilter/source/dmapper/DomainMapper_Impl.hxx |4 
 5 files changed, 28 insertions(+), 1 deletion(-)

New commits:
commit 6178e1e784b8a7881395972b9e6f0222c012a9b1
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Mon Jul 6 09:23:40 2015 +0200

tdf#90611 DOCX import: fix missing paragraph style on footnotes

One one hand, a problem since commit
330b860205c7ba69dd6603f65324d0f89ad9cd5f (fdo#68787 DOCX import: handle
when w:separator is missing for footnotes, 2013-09-04) was that the type
attribute from w:footnote w:type=separator resulted in two
ooxml:CT_FtnEdn_type tokens, ignoring too many paragraph ends for
footnotes, which resulted in missing paragraph style on footnotes.

On the other hand, fixing the first problem showed that it wasn't
correct that commit 9389cf78e304a5a99bcf1745b9388e14ac36281a (cp#118
RTF import: empty para at the end of footnote text got lost, 2013-11-15)
unconditionally removed the RemoveLastParagraph() call in
DomainMapper_Impl::PopFootOrEndnote(). It turns out that RTF and DOCX
have different semantics here, the footnote is always within a p/p
pair in DOCX, while in RTF a \par at the end of a
footnote means an empty paragraph. Fix that by conditionally restoring
the removed RemoveLastParagraph() call.

(cherry picked from commit 519b34300f73b1e08f6194d6ba49d4fc010cf186)

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

diff --git a/sw/qa/extras/ooxmlimport/data/tdf90611.docx 
b/sw/qa/extras/ooxmlimport/data/tdf90611.docx
new file mode 100644
index 000..ac54fee
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf90611.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index beab2d1..1f5843d 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -2599,6 +2599,16 @@ DECLARE_OOXMLIMPORT_TEST(testTdf87460, tdf87460.docx)
 CPPUNIT_ASSERT_EQUAL(static_castsal_Int32(1), xEndnotes-getCount());
 }
 
+DECLARE_OOXMLIMPORT_TEST(testTdf90611, tdf90611.docx)
+{
+uno::Referencetext::XFootnotesSupplier xFootnotesSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Referencecontainer::XIndexAccess 
xFootnotes(xFootnotesSupplier-getFootnotes(), uno::UNO_QUERY);
+uno::Referencetext::XText xFootnoteText;
+xFootnotes-getByIndex(0) = xFootnoteText;
+// This was 11.
+CPPUNIT_ASSERT_EQUAL(10.f, getPropertyfloat(getParagraphOfText(1, 
xFootnoteText), CharHeight));
+}
+
 #endif
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index 612b208..8dc4ef2 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -975,7 +975,7 @@ void DomainMapper::lcl_attribute(Id nName, Value  val)
 case NS_ooxml::LN_CT_FtnEdn_type:
 // This is the separator footnote, ignore its linebreak.
 if (static_castsal_uInt32(nIntValue) == 
NS_ooxml::LN_Value_doc_ST_FtnEdn_separator)
-m_pImpl-m_bIgnoreNextPara = true;
+m_pImpl-SeenFootOrEndnoteSeparator();
 break;
 case NS_ooxml::LN_CT_DataBinding_prefixMappings:
 m_pImpl-appendGrabBag(m_pImpl-m_aInteropGrabBag, 
ooxml:CT_DataBinding_prefixMappings, sStringValue);
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index f043ba1..66453ac 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -185,6 +185,7 @@ DomainMapper_Impl::DomainMapper_Impl(
 m_bInHeaderFooterImport( false ),
 m_bDiscardHeaderFooter( false ),
 m_bInFootOrEndnote(false),
+m_bSeenFootOrEndnoteSeparator(false),
 m_bLineNumberingSet( false ),
 m_bIsInFootnoteProperties( false ),
 m_bIsCustomFtnMark( false ),
@@ -1712,6 +1713,9 @@ void DomainMapper_Impl::PushAnnotation()
 
 void DomainMapper_Impl::PopFootOrEndnote()
 {
+if (!IsRTFImport())
+RemoveLastParagraph();
+
 // In case the foot or endnote did not contain a tab.
 m_bIgnoreNextTab = false;
 
@@ -1724,9 +1728,18 @@ void DomainMapper_Impl::PopFootOrEndnote()
 return;
 }
 m_aRedlines.pop();
+m_bSeenFootOrEndnoteSeparator = false;
 m_bInFootOrEndnote = false;
 }
 
+void DomainMapper_Impl::SeenFootOrEndnoteSeparator()
+{
+if 

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

2015-07-08 Thread Miklos Vajna
 sw/qa/extras/ooxmlexport/data/tdf89890.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx |   23 +++
 sw/qa/extras/ooxmlexport/ooxmlexport4.cxx|2 +-
 writerfilter/source/dmapper/NumberingManager.cxx |   14 ++
 4 files changed, 38 insertions(+), 1 deletion(-)

New commits:
commit e3d78d605905ef23b15002a29f0f3a6de5cc12ac
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Fri Jun 26 09:02:31 2015 +0200

tdf#89890 DOCX import: fix too large num pic bullet

Reading SwWW8ImplReader::CoreLoad()'s update graphic bullet
information block, it turns out that the numbering picture bullet's
height should be independent from the supplied bitmap, and only its
aspect ratio should be respected.

Reviewed-on: https://gerrit.libreoffice.org/16500
Reviewed-by: Miklos Vajna vmik...@collabora.co.uk
Tested-by: Jenkins c...@libreoffice.org
(cherry picked from commit eab89b7f024a8c86decdcb3362c40c40a7df37df)

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

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

diff --git a/sw/qa/extras/ooxmlexport/data/tdf89890.docx 
b/sw/qa/extras/ooxmlexport/data/tdf89890.docx
new file mode 100644
index 000..8b3e8eb
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf89890.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index ac4b246..2e4b8a3 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -638,6 +638,29 @@ DECLARE_OOXMLEXPORT_TEST(testTdf91261, tdf91261.docx)
 
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf89890, tdf89890.docx)
+{
+// Numbering picture bullet was too large.
+uno::Referencebeans::XPropertySet 
xPropertySet(getStyles(NumberingStyles)-getByName(WWNum1), uno::UNO_QUERY);
+uno::Referencecontainer::XIndexAccess 
xLevels(xPropertySet-getPropertyValue(NumberingRules), uno::UNO_QUERY);
+uno::Sequencebeans::PropertyValue aProps;
+xLevels-getByIndex(0) = aProps; // 1st level
+
+bool bFound = false;
+for (int i = 0; i  aProps.getLength(); ++i)
+{
+const beans::PropertyValue rProp = aProps[i];
+
+if (rProp.Name == GraphicSize)
+{
+// Height of the graphic was too large: 4382 after import, then 
2485 after roundtrip.
+CPPUNIT_ASSERT_EQUAL(static_castsal_Int32(279), 
rProp.Value.getawt::Size().Height);
+bFound = true;
+}
+}
+CPPUNIT_ASSERT(bFound);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
index e187959..9a495fd 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
@@ -353,7 +353,7 @@ DECLARE_OOXMLEXPORT_TEST(testFDO74215, FDO74215.docx)
 xmlDocPtr pXmlDoc = parseExport(word/numbering.xml);
 if (!pXmlDoc)
 return;
-assertXPath(pXmlDoc, /w:numbering/w:numPicBullet[2]/w:pict/v:shape, 
style, width:6.4pt;height:6.4pt);
+assertXPath(pXmlDoc, /w:numbering/w:numPicBullet[2]/w:pict/v:shape, 
style, width:7.9pt;height:7.9pt);
 }
 
 DECLARE_OOXMLEXPORT_TEST(testColumnBreak_ColumnCountIsZero,fdo74153.docx)
diff --git a/writerfilter/source/dmapper/NumberingManager.cxx 
b/writerfilter/source/dmapper/NumberingManager.cxx
index 2412f8c..17786ea 100644
--- a/writerfilter/source/dmapper/NumberingManager.cxx
+++ b/writerfilter/source/dmapper/NumberingManager.cxx
@@ -877,6 +877,20 @@ void ListsManager::lcl_sprm( Sprm rSprm )
 case NS_ooxml::LN_CT_NumPicBullet_pict:
 {
 uno::Referencedrawing::XShape xShape = 
m_rDMapper.PopPendingShape();
+
+// Respect only the aspect ratio of the picture, not its size.
+awt::Size aPrefSize = xShape-getSize();
+// See SwDefBulletConfig::InitFont(), default height is 14.
+const int nFontHeight = 14;
+// Point - mm100.
+const int nHeight = nFontHeight * 35;
+if (aPrefSize.Height * aPrefSize.Width != 0)
+{
+int nWidth = (nHeight * aPrefSize.Width) / 
aPrefSize.Height;
+awt::Size aSize(nWidth, nHeight);
+xShape-setSize(aSize);
+}
+
 m_pCurrentNumPicBullet-SetShape(xShape);
 }
 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-4' - sw/qa writerfilter/source

2015-07-07 Thread Miklos Vajna
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx  |4 ++--
 writerfilter/source/dmapper/GraphicImport.cxx |8 
 2 files changed, 6 insertions(+), 6 deletions(-)

New commits:
commit 8b7ec09054f3186ec9d6cb49a1314143cb89da78
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Wed Jun 24 09:08:56 2015 +0200

tdf#89698 DOCX import: inline picture should have no spacing

Commit 3d7e168a2a43c2414b0633379102ddb29437e75b (n#783638 DOCX import of
wp:inline's distT/B/L/R attributes, 2012-10-11) was about a picture that
had non-zero spacing in LO, but zero in Word. The hope was that the
problem is just that the value is not imported.

Then commit a88ac708403c03d0f950f09ec29c0d5a1e5a85b4 (fdo#63685
wp:inline's distT/B/L/R is in EMU's, not twips, 2013-04-19) was about a
picture that had so large spacing that the picture become invisible.
Fixing the unit of the spacing value made the picture visible again.

What was missed is that this value is just stored in the doc model, but
layout in Word doesn't use it at all till the anchoring is as-char.
Given that in LO as-char anchoring supports real spacing, just don't
import these values to have the same layout. That's what the WW8 import
does, too.

(cherry picked from commit 9781a8786da5c32e2250cbe1ae97bd10f84f39bb)

Change-Id: I1244269e06c5d190e8340349ddc12ae7b0572a4d
Reviewed-on: https://gerrit.libreoffice.org/16786
Reviewed-by: Michael Stahl mst...@redhat.com
Tested-by: Michael Stahl mst...@redhat.com

diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 99417ce..beab2d1 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -1267,8 +1267,8 @@ DECLARE_OOXMLIMPORT_TEST(testConditionalstylesTbllook, 
conditionalstyles-tblloo
 
 DECLARE_OOXMLIMPORT_TEST(testFdo63685, fdo63685.docx)
 {
-// Was 85697, i.e. original 114120 was converted to mm100 from twips, not 
from EMUs.
-CPPUNIT_ASSERT_EQUAL(sal_Int32(318), getPropertysal_Int32(getShape(1), 
TopMargin));
+// An inline image's wrapping should be always zero, even if the doc model 
has a non-zero value.
+CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getPropertysal_Int32(getShape(1), 
TopMargin));
 }
 
 DECLARE_OOXMLIMPORT_TEST(testN592908_Frame, n592908-frame.docx)
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx 
b/writerfilter/source/dmapper/GraphicImport.cxx
index 5851799..e2a2372 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -858,16 +858,16 @@ void GraphicImport::lcl_attribute(Id nName, Value rValue)
 }
 break;
 case NS_ooxml::LN_CT_Inline_distT:
-m_pImpl-nTopMargin = oox::drawingml::convertEmuToHmm(nIntValue);
+m_pImpl-nTopMargin = 0;
 break;
 case NS_ooxml::LN_CT_Inline_distB:
-m_pImpl-nBottomMargin = 
oox::drawingml::convertEmuToHmm(nIntValue);
+m_pImpl-nBottomMargin = 0;
 break;
 case NS_ooxml::LN_CT_Inline_distL:
-m_pImpl-nLeftMargin = oox::drawingml::convertEmuToHmm(nIntValue);
+m_pImpl-nLeftMargin = 0;
 break;
 case NS_ooxml::LN_CT_Inline_distR:
-m_pImpl-nRightMargin = oox::drawingml::convertEmuToHmm(nIntValue);
+m_pImpl-nRightMargin = 0;
 break;
 case NS_ooxml::LN_CT_GraphicalObjectData_uri:
 rValue.getString();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-06-30 Thread Miklos Vajna
 sw/qa/extras/rtfimport/data/tdf92061.rtf   |5 +
 sw/qa/extras/rtfimport/rtfimport.cxx   |6 ++
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |2 ++
 3 files changed, 13 insertions(+)

New commits:
commit 326ca9e0710d17274eb0a6cdc0d95d4f933784f0
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Mon Jun 22 09:05:30 2015 +0200

tdf#92061 RTF import: fix missing body text after footnote

A missing seek in the \footnote handler could result in a situation that
the missed text contained a { but not its matching }, which resulted
in the parser terminating earlier than the end of the document.

(cherry picked from commit 7b08304b55cf2284a3c583426c60baef618ba206)

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

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

diff --git a/sw/qa/extras/rtfimport/data/tdf92061.rtf 
b/sw/qa/extras/rtfimport/data/tdf92061.rtf
new file mode 100644
index 000..03978b4
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/tdf92061.rtf
@@ -0,0 +1,5 @@
+{\rtf1
+body-before
+{\footnote A {B} C}
+body-after\par
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx 
b/sw/qa/extras/rtfimport/rtfimport.cxx
index f7fa4de..bfff118 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -2309,6 +2309,12 @@ DECLARE_RTFIMPORT_TEST(testTdf90315, tdf90315.rtf)
 CPPUNIT_ASSERT_EQUAL(static_castsal_Int32(1270), 
getPropertysal_Int32(xTextSection-getPropertyValue(TextColumns), 
AutomaticDistance));
 }
 
+DECLARE_RTFIMPORT_TEST(testTdf92061, tdf92061.rtf)
+{
+// This was C, i.e. part of the footnote ended up in the body text.
+CPPUNIT_ASSERT_EQUAL(OUString(body-after), getRun(getParagraph(1), 
3)-getString());
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 75978e4..ea5a212 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -1690,11 +1690,13 @@ int RTFDocumentImpl::dispatchDestination(RTFKeyword 
nKeyword)
 // Check if this is an endnote.
 OStringBuffer aBuf;
 char ch;
+sal_Size nCurrent = Strm().Tell();
 for (int i = 0; i  7; ++i)
 {
 Strm().ReadChar(ch);
 aBuf.append(ch);
 }
+Strm().Seek(nCurrent);
 OString aKeyword = aBuf.makeStringAndClear();
 if (aKeyword.equals(\\ftnalt))
 nId = NS_ooxml::LN_endnote;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-06-16 Thread Miklos Vajna
 sw/qa/extras/ooxmlimport/data/tdf8255.docx  |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx|9 +
 writerfilter/source/dmapper/PropertyMap.cxx |   12 +++-
 3 files changed, 20 insertions(+), 1 deletion(-)

New commits:
commit 853033da3710f0e8df1b5d0d5355c6b0ce1c9ea0
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Mon Jun 8 07:48:42 2015 +0200

tdf#82553 DOCX import: handle table margin when converting floattables

(cherry picked from commit 292ec5fe8d01af6119325f1a426422bb42e58615)

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

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

diff --git a/sw/qa/extras/ooxmlimport/data/tdf8255.docx 
b/sw/qa/extras/ooxmlimport/data/tdf8255.docx
new file mode 100644
index 000..366e498
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf8255.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 0721a1e..4a7a8bc 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -2581,6 +2581,15 @@ DECLARE_OOXMLIMPORT_TEST(testFdo87488, fdo87488.docx)
 }
 }
 
+DECLARE_OOXMLIMPORT_TEST(testTdf8255, tdf8255.docx)
+{
+uno::Referencetext::XTextDocument xTextDocument(mxComponent, 
uno::UNO_QUERY);
+uno::Referencedrawing::XDrawPageSupplier 
xDrawPageSupplier(xTextDocument, uno::UNO_QUERY);
+uno::Referencedrawing::XDrawPage xDrawPage = 
xDrawPageSupplier-getDrawPage();
+// This was 1: a full-page-wide multi-page floating table was imported as 
a TextFrame.
+CPPUNIT_ASSERT_EQUAL(static_castsal_Int32(0), xDrawPage-getCount());
+}
+
 #endif
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/dmapper/PropertyMap.cxx 
b/writerfilter/source/dmapper/PropertyMap.cxx
index 845dbe6..f83862c 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -1037,6 +1037,16 @@ void SectionPropertyMap::CloseSectionGroup( 
DomainMapper_Impl rDM_Impl )
 for (size_t i = 0; i  rPendingFloatingTables.size(); ++i)
 {
 FloatingTableInfo rInfo = rPendingFloatingTables[i];
+
+// Count the layout width of the table.
+sal_Int32 nTableWidth = rInfo.m_nTableWidth;
+sal_Int32 nLeftMargin = 0;
+if (rInfo.getPropertyValue(LeftMargin) = nLeftMargin)
+nTableWidth += nLeftMargin;
+sal_Int32 nRightMargin = 0;
+if (rInfo.getPropertyValue(RightMargin) = nRightMargin)
+nTableWidth += nRightMargin;
+
 // 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.
@@ -1045,7 +1055,7 @@ void SectionPropertyMap::CloseSectionGroup( 
DomainMapper_Impl rDM_Impl )
 // If there are columns, always create the fly, otherwise the columns 
would
 // restrict geometry of the table.
 if ( ( rInfo.getPropertyValue(HoriOrientRelation) == 
text::RelOrientation::PAGE_FRAME ) ||
- ( rInfo.m_nTableWidth  nTextAreaWidth ) || ColumnCount() + 1 = 
2 )
+ nTableWidth  nTextAreaWidth || ColumnCount() + 1 = 2 )
 xBodyText-convertToTextFrame(rInfo.m_xStart, rInfo.m_xEnd, 
rInfo.m_aFrameProperties);
 }
 rPendingFloatingTables.clear();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-06-11 Thread Miklos Vajna
 sw/qa/extras/rtfimport/data/tdf90315.rtf |4 
 sw/qa/extras/rtfimport/rtfimport.cxx |9 +
 writerfilter/source/dmapper/SectionColumnHandler.cxx |2 +-
 3 files changed, 14 insertions(+), 1 deletion(-)

New commits:
commit 065a4d93287c0c3f16c516004c078fca948e3fc4
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Sat May 23 19:23:05 2015 +0100

tdf#90315 RTF import: fix \colsx default value

See SectPageInformation::mnColsx on the libreoffice-3-6 branch + the
spec agrees, too.

Change-Id: I6f70a125f8d962621f319e3e75e2865e5f126859
(cherry picked from commit e18adb7369d140f33b947668a69da2fa78738e7b)
Reviewed-on: https://gerrit.libreoffice.org/16225
Reviewed-by: Michael Stahl mst...@redhat.com
Tested-by: Michael Stahl mst...@redhat.com

diff --git a/sw/qa/extras/rtfimport/data/tdf90315.rtf 
b/sw/qa/extras/rtfimport/data/tdf90315.rtf
new file mode 100644
index 000..df99754
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/tdf90315.rtf
@@ -0,0 +1,4 @@
+{\rtf1\cols2
+foo\par
+bar\par
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx 
b/sw/qa/extras/rtfimport/rtfimport.cxx
index 66f04e7..f7fa4de 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -2300,6 +2300,15 @@ DECLARE_RTFIMPORT_TEST(testTdf86814, tdf86814.rtf)
 CPPUNIT_ASSERT_EQUAL(awt::FontWeight::BOLD, 
getPropertyfloat(getRun(getParagraph(1), 1), CharWeight));
 }
 
+DECLARE_RTFIMPORT_TEST(testTdf90315, tdf90315.rtf)
+{
+uno::Referencetext::XTextSectionsSupplier 
xTextSectionsSupplier(mxComponent, uno::UNO_QUERY);
+uno::Referencecontainer::XIndexAccess 
xTextSections(xTextSectionsSupplier-getTextSections(), uno::UNO_QUERY);
+uno::Referencebeans::XPropertySet 
xTextSection(xTextSections-getByIndex(0), uno::UNO_QUERY);
+// This was 0, but default should be 720 twips.
+CPPUNIT_ASSERT_EQUAL(static_castsal_Int32(1270), 
getPropertysal_Int32(xTextSection-getPropertyValue(TextColumns), 
AutomaticDistance));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/dmapper/SectionColumnHandler.cxx 
b/writerfilter/source/dmapper/SectionColumnHandler.cxx
index dbc5ac9..c5d971d 100644
--- a/writerfilter/source/dmapper/SectionColumnHandler.cxx
+++ b/writerfilter/source/dmapper/SectionColumnHandler.cxx
@@ -33,7 +33,7 @@ using namespace ::com::sun::star;
 SectionColumnHandler::SectionColumnHandler()
 : LoggedProperties(dmapper_logger, SectionColumnHandler)
 , bEqualWidth(false)
-, nSpace(0)
+, nSpace(1270) // 720 twips
 , nNum(0)
 , bSep(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-4' - sw/qa writerfilter/source

2015-06-03 Thread Miklos Vajna
 sw/qa/extras/rtfimport/data/tdf86814.rtf   |8 +++
 sw/qa/extras/rtfimport/rtfimport.cxx   |6 ++
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |   57 ++---
 3 files changed, 47 insertions(+), 24 deletions(-)

New commits:
commit 4c3afdb31382099005a16d2dd64a742c749f06ab
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Mon May 18 07:38:32 2015 +0200

tdf#86814 RTF import: fix sometimes lost bold style

The problem was that commit 76c0d0abc89cd8948706083c2660b71a2dad670c
(RTF import: adapt getProperties() to createStyleProperties(),
2014-09-07) only made the character style sprms/attributes a flat list,
but not the paragraph style ones. Fixing that inconsistency avoids the
tokenizer adding unwanted default sprms, which cause the bold sprms go
away in the bugdoc.

Change-Id: I86bd1b26af18cd968375c9b39be9c8e71d51271f
(cherry picked from commit cbe79789a0fc9b80b2fd14a5abfe0973a2cb69dc)
Reviewed-on: https://gerrit.libreoffice.org/16051
Reviewed-by: Caolán McNamara caol...@redhat.com
Tested-by: Caolán McNamara caol...@redhat.com

diff --git a/sw/qa/extras/rtfimport/data/tdf86814.rtf 
b/sw/qa/extras/rtfimport/data/tdf86814.rtf
new file mode 100644
index 000..6fb394e
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/tdf86814.rtf
@@ -0,0 +1,8 @@
+{\rtf1
+{\stylesheet
+{\s0 Normal;}
+{\s23\sbasedon0\snext23\sl288\slmult1\ql\widctlpar\faauto\li0\ri0\lin0\rin0\fi0\sb100\sa100\ltrpar\b\dbch\af10\langfe1049\dbch\af11\afs20\alang1025\ab\loch\f5\fs20\lang1049
 Style 23;}
+}
+\pard\plain 
\s23\sl288\slmult1\ql\widctlpar\faauto\li0\ri0\lin0\rin0\fi0\sb100\sa100\ltrpar\b\dbch\af10\langfe1049\dbch\af11\afs20\alang1025\ab\loch\f5\fs20\lang1049\ql\widctlpar\faauto\li0\ri0\lin0\rin0\fi0
+{\b\langfe1049\dbch\af11\afs20\alang1025\ab\rtlch \ltrch\loch\fs20\lang1049 
hello}
+\par}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx 
b/sw/qa/extras/rtfimport/rtfimport.cxx
index 0a57d66..bfa13c5 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -2290,6 +2290,12 @@ DECLARE_RTFIMPORT_TEST(testTdf90260Par, hello.rtf)
 CPPUNIT_ASSERT_EQUAL(2, getParagraphs());
 }
 
+DECLARE_RTFIMPORT_TEST(testTdf86814, tdf86814.rtf)
+{
+// This was awt::FontWeight::NORMAL, i.e. the first run wasn't bold, when 
it should be bold (applied paragraph style with direct formatting).
+CPPUNIT_ASSERT_EQUAL(awt::FontWeight::BOLD, 
getPropertyfloat(getRun(getParagraph(1), 1), CharWeight));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 0941d85..75978e4 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -417,6 +417,32 @@ void RTFDocumentImpl::setNeedSect(bool bNeedSect)
 }
 }
 
+/// Copy rProps to rStyleAttributes and rStyleSprms, but in case of nested 
sprms, copy their children as toplevel sprms/attributes.
+static void lcl_copyFlatten(RTFReferenceProperties rProps, RTFSprms 
rStyleAttributes, RTFSprms rStyleSprms)
+{
+for (RTFSprms::Iterator_t it = rProps.getSprms().begin(); it != 
rProps.getSprms().end(); ++it)
+{
+// createStyleProperties() puts properties to rPr, but here we need a 
flat list.
+if (it-first == NS_ooxml::LN_CT_Style_rPr)
+{
+// rPr can have both attributes and SPRMs, copy over both types.
+RTFSprms rRPrSprms = it-second-getSprms();
+for (RTFSprms::Iterator_t itRPrSprm = rRPrSprms.begin(); itRPrSprm 
!= rRPrSprms.end(); ++itRPrSprm)
+rStyleSprms.set(itRPrSprm-first, itRPrSprm-second);
+
+RTFSprms rRPrAttributes = it-second-getAttributes();
+for (RTFSprms::Iterator_t itRPrAttribute = rRPrAttributes.begin(); 
itRPrAttribute != rRPrAttributes.end(); ++itRPrAttribute)
+rStyleAttributes.set(itRPrAttribute-first, 
itRPrAttribute-second);
+}
+else
+rStyleSprms.set(it-first, it-second);
+}
+
+RTFSprms rAttributes = rProps.getAttributes();
+for (RTFSprms::Iterator_t itAttr = rAttributes.begin(); itAttr != 
rAttributes.end(); ++itAttr)
+rStyleAttributes.set(itAttr-first, itAttr-second);
+}
+
 writerfilter::ReferenceProperties::Pointer_t 
RTFDocumentImpl::getProperties(RTFSprms rAttributes, RTFSprms rSprms)
 {
 int nStyle = 0;
@@ -431,34 +457,17 @@ writerfilter::ReferenceProperties::Pointer_t 
RTFDocumentImpl::getProperties(RT
 // let's merge paragraph and character style properties here.
 int nCharStyle = m_aStates.top().nCurrentCharacterStyleIndex;
 RTFReferenceTable::Entries_t::iterator itChar = 
m_aStyleTableEntries.find(nCharStyle);
-RTFSprms aStyleSprms = rProps.getSprms();
-RTFSprms aStyleAttributes = rProps.getAttributes();
+RTFSprms aStyleSprms;
+ 

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

2015-05-28 Thread Miklos Vajna
 sw/qa/extras/rtfimport/data/tdf91074.rtf   |7 +++
 sw/qa/extras/rtfimport/rtfimport.cxx   |7 +++
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |6 ++-
 writerfilter/source/rtftok/rtfsdrimport.cxx|   45 ++---
 writerfilter/source/rtftok/rtfsdrimport.hxx|2 +
 5 files changed, 47 insertions(+), 20 deletions(-)

New commits:
commit fe898641dd7f8ff3cc74804f01340fdade3e5ed7
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Mon May 11 09:05:12 2015 +0200

tdf#91074 RTF import: handle \dplineco* for text frames

RTFSdrImport::resolve() already had the logic to use the relevant API
depending on if the shape is a text frame or not -- extract that to a
separate member function and use it from RTFDocumentImpl::popState(),
too.

(cherry picked from commit ec1a96e79e3e6225706151cb72eb3df763b0598d)

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

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

diff --git a/sw/qa/extras/rtfimport/data/tdf91074.rtf 
b/sw/qa/extras/rtfimport/data/tdf91074.rtf
new file mode 100644
index 000..ff3fe9b
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/tdf91074.rtf
@@ -0,0 +1,7 @@
+{\rtf1\ansi\ansicpg1252\deff0\deftab720
+{\*\do\dobxpage\dobypage\dodhgt8192\dptxbx
+{\dptxbxtext\pard\plain
+inner\par }
+\dpx674\dpy725\dpxsize1875\dpysize1020\dplinecor255\dplinecog0\dplinecob0\dplinew40\dpfillfgcr0\dpfillfgcg0\dpfillfgcb0\dpfillbgcr0\dpfillbgcg0\dpfillbgcb0\dpfillpat0}
+\par
+outer\par}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx 
b/sw/qa/extras/rtfimport/rtfimport.cxx
index 6c52362..535687f 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -2265,6 +2265,13 @@ DECLARE_RTFIMPORT_TEST(testTdf86182, tdf86182.rtf)
 CPPUNIT_ASSERT_EQUAL(text::WritingMode2::RL_TB, 
getPropertysal_Int16(getParagraph(1), WritingMode));
 }
 
+DECLARE_RTFIMPORT_TEST(testTdf91074, tdf91074.rtf)
+{
+// The file failed to load, as the border color was imported using the 
LineColor UNO property.
+uno::Referencedrawing::XShape xShape = getShape(1);
+CPPUNIT_ASSERT_EQUAL(static_castsal_Int32(COL_LIGHTRED), 
getPropertytable::BorderLine2(xShape, TopBorder).Color);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index ad9954b..b039ede 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -5541,7 +5541,11 @@ int RTFDocumentImpl::popState()
 xShape-setSize(awt::Size(rDrawing.nRight, rDrawing.nBottom));
 
 if (rDrawing.bHasLineColor)
-xPropertySet-setPropertyValue(LineColor, 
uno::makeAny(sal_uInt32((rDrawing.nLineColorR16) + (rDrawing.nLineColorG8) 
+ rDrawing.nLineColorB)));
+{
+uno::Any aLineColor = 
uno::makeAny(sal_uInt32((rDrawing.nLineColorR16) + (rDrawing.nLineColorG8) 
+ rDrawing.nLineColorB));
+uno::Any aLineWidth;
+RTFSdrImport::resolveLineColorAndWidth(bTextFrame, 
xPropertySet, aLineColor, aLineWidth);
+}
 if (rDrawing.bHasFillColor)
 xPropertySet-setPropertyValue(FillColor, 
uno::makeAny(sal_uInt32((rDrawing.nFillColorR16) + (rDrawing.nFillColorG8) 
+ rDrawing.nFillColorB)));
 else if (!bTextFrame)
diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx 
b/writerfilter/source/rtftok/rtfsdrimport.cxx
index 7969b0b..1ebaf46 100644
--- a/writerfilter/source/rtftok/rtfsdrimport.cxx
+++ b/writerfilter/source/rtftok/rtfsdrimport.cxx
@@ -128,6 +128,31 @@ void 
RTFSdrImport::resolveDhgt(uno::Referencebeans::XPropertySet const xPrope
 pHelper-addItem(xPropertySet, nZOrder);
 }
 
+void RTFSdrImport::resolveLineColorAndWidth(bool bTextFrame, const 
uno::Referencebeans::XPropertySet xPropertySet, uno::Any rLineColor, 
uno::Any rLineWidth)
+{
+if (!bTextFrame)
+{
+xPropertySet-setPropertyValue(LineColor, rLineColor);
+xPropertySet-setPropertyValue(LineWidth, rLineWidth);
+}
+else
+{
+static const char* aBorders[] =
+{
+TopBorder, LeftBorder, BottomBorder, RightBorder
+};
+for (unsigned int i = 0; i  SAL_N_ELEMENTS(aBorders); ++i)
+{
+table::BorderLine2 aBorderLine = 
xPropertySet-getPropertyValue(OUString::createFromAscii(aBorders[i])).gettable::BorderLine2();
+if (rLineColor.hasValue())
+aBorderLine.Color = rLineColor.getsal_Int32();
+if (rLineWidth.hasValue())
+

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

2015-05-25 Thread Mark Hung
 sw/qa/extras/ooxmlexport/data/tdf91261.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx |   19 +++
 writerfilter/source/dmapper/DomainMapper.cxx |   21 -
 writerfilter/source/dmapper/PropertyIds.cxx  |2 ++
 writerfilter/source/dmapper/PropertyIds.hxx  |2 ++
 writerfilter/source/dmapper/PropertyMap.cxx  |5 +
 writerfilter/source/dmapper/PropertyMap.hxx  |2 ++
 7 files changed, 46 insertions(+), 5 deletions(-)

New commits:
commit 5ad8c6c313f3d540f93742e9308a2773937b3120
Author: Mark Hung mark...@gmail.com
Date:   Thu May 14 23:02:21 2015 +0800

tdf#91261: DOCX import: snapGrid property of paragraphs are ignored

Fix the situation for OOXML import filter:
a) While handling DocGrid type, SnapToChars was treated as
   None. Now it is implemented as described in the article:
http://linpeifeng.blogspot.tw/2007/02/text-grid-enhancement.html
   Both LinesAndChars and SnapToChars will be translated to
   Writer grid type  lines and characters, and set SnapToGrid
   property to false or true accordingly.

b) All the imported paragraphs snap to grid because SnapToGrid was
   appended to grabbag, now it allows SnapToGrid property in
   paragraph and paragraph styles to be imported properly.

Reviewed-on: https://gerrit.libreoffice.org/15732
Reviewed-by: Michael Stahl mst...@redhat.com
Tested-by: Michael Stahl mst...@redhat.com
(cherry picked from commit b7c8c337d4ffad55fe111c9634c4c04afce78bad)

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

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

diff --git a/sw/qa/extras/ooxmlexport/data/tdf91261.docx 
b/sw/qa/extras/ooxmlexport/data/tdf91261.docx
new file mode 100644
index 000..6edb8b8
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf91261.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 5e05f6a..e43cf90 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -613,6 +613,25 @@ DECLARE_OOXMLEXPORT_TEST(testTdf88583, tdf88583.odt)
 CPPUNIT_ASSERT_EQUAL(static_castsal_Int32(0x00cc00), 
getPropertysal_Int32(getParagraph(1), FillColor));
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf91261, tdf91261.docx)
+{
+bool snapToGrid = true;
+uno::Reference text::XTextRange  xPara = getParagraph( 2 );
+uno::Reference beans::XPropertySet  properties( xPara, uno::UNO_QUERY);
+properties-getPropertyValue(SnapToGrid) = snapToGrid ;
+CPPUNIT_ASSERT_EQUAL(false, snapToGrid);
+
+uno::Reference beans::XPropertySet 
xStyle(getStyles(PageStyles)-getByName(Standard), uno::UNO_QUERY);
+sal_Int16 nGridMode;
+xStyle-getPropertyValue(GridMode) = nGridMode;
+CPPUNIT_ASSERT_EQUAL( sal_Int16(2), nGridMode);
+
+bool bGridSnapToChars;
+xStyle-getPropertyValue(GridSnapToChars) = bGridSnapToChars;
+CPPUNIT_ASSERT_EQUAL(true, bGridSnapToChars);
+
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index ad477c5..e1c5954 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -918,14 +918,18 @@ void DomainMapper::lcl_attribute(Id nName, Value  val)
 switch( nIntValue )
 {
 case NS_ooxml::LN_Value_doc_ST_DocGrid_default:
-case NS_ooxml::LN_Value_doc_ST_DocGrid_snapToChars:
-pSectionContext-SetGridType( 0 );
+pSectionContext-SetGridType(text::TextGridMode::NONE);
 break;
 case NS_ooxml::LN_Value_doc_ST_DocGrid_lines:
-pSectionContext-SetGridType( 1 );
+
pSectionContext-SetGridType(text::TextGridMode::LINES);
 break;
 case NS_ooxml::LN_Value_doc_ST_DocGrid_linesAndChars:
-pSectionContext-SetGridType( 2 );
+
pSectionContext-SetGridType(text::TextGridMode::LINES_AND_CHARS);
+pSectionContext-SetGridSnapToChars( false );
+break;
+case NS_ooxml::LN_Value_doc_ST_DocGrid_snapToChars:
+
pSectionContext-SetGridType(text::TextGridMode::LINES_AND_CHARS);
+pSectionContext-SetGridSnapToChars( true );
 break;
 default :
 OSL_FAIL(unknown SwTextGrid value);
@@ -1983,7 +1987,14 @@ void DomainMapper::sprmWithProps( Sprm rSprm, 
PropertyMapPtr rContext )

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

2015-04-30 Thread Miklos Vajna
 sw/qa/core/data/ooxml/pass/fill.docx |binary
 writerfilter/source/ooxml/model.xml  |6 --
 2 files changed, 6 deletions(-)

New commits:
commit 08ce53b292066ed732a00212d19893b4be80beb5
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Thu Apr 30 09:49:16 2015 +0200

writerfilter: unused fill and CT_Fill resources

These were added by commit cfc4650c8594334edecc3b50ca54461f6bee2d43
(Added some teaks to 'model.xml', 2014-09-16), but the matching dmapper
part is missing, so they aren't useful in practice, and cause a crash on
import of crashtest's File_953.docx.

Change-Id: I3d1c138534a37dc9ba500f1134ca4bb9ebae0e96
(cherry picked from commit 57d254d42b6e1d836bd21e6fb2e968af2b511c7d)
Reviewed-on: https://gerrit.libreoffice.org/15574
Reviewed-by: Caolán McNamara caol...@redhat.com
Tested-by: Caolán McNamara caol...@redhat.com

diff --git a/sw/qa/core/data/ooxml/pass/fill.docx 
b/sw/qa/core/data/ooxml/pass/fill.docx
new file mode 100644
index 000..b9a4501
Binary files /dev/null and b/sw/qa/core/data/ooxml/pass/fill.docx differ
diff --git a/writerfilter/source/ooxml/model.xml 
b/writerfilter/source/ooxml/model.xml
index ef288b1..ca1c464 100644
--- a/writerfilter/source/ooxml/model.xml
+++ b/writerfilter/source/ooxml/model.xml
@@ -9449,12 +9449,6 @@
 resource name=background resource=Properties
   element name=background tokenid=ooxml:background_background/
 /resource
-resource name=fill resource=Properties
-  element name=fill tokenid=ooxml:fill_fill/
-/resource
-resource name=CT_Fill resource=Properties
-  attribute name=type tokenid=ooxml:CT_Fill_type/
-/resource
   /namespace
   namespace name=vml-officeDrawing
 start name=shapedefaults/
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-04-22 Thread Miklos Vajna
 sw/qa/extras/rtfimport/data/tdf86182.rtf   |4 
 sw/qa/extras/rtfimport/rtfimport.cxx   |7 +++
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |2 +-
 3 files changed, 12 insertions(+), 1 deletion(-)

New commits:
commit 502e606c84666df66fa1b099ae4147220f262841
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Fri Apr 17 10:44:47 2015 +0200

tdf#86182 RTF import: fix handling of \rtlpar

Commit 558d5c25a0b1d6a937d33291a4b6cd7fca6cb15b (implement RTF_LTRPAR
and RTF_RTLPAR, 2011-06-09) was just a guess, this one is the proper
mapping.

(cherry picked from commit 4ee2a882dddb395a816cd54004b634d57cfb2446)

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

Change-Id: I1156ef5ddc34264d761d3e64dd0537bc6ec0ced7
Reviewed-on: https://gerrit.libreoffice.org/15481
Reviewed-by: Michael Stahl mst...@redhat.com
Tested-by: Michael Stahl mst...@redhat.com

diff --git a/sw/qa/extras/rtfimport/data/tdf86182.rtf 
b/sw/qa/extras/rtfimport/data/tdf86182.rtf
new file mode 100644
index 000..d63c489
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/tdf86182.rtf
@@ -0,0 +1,4 @@
+{\rtf1
+\rtlpar
+\u1662\'3f\u1587\'3f
+\par}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx 
b/sw/qa/extras/rtfimport/rtfimport.cxx
index 8dce8ee..6c52362 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -45,6 +45,7 @@
 #include com/sun/star/text/WrapTextMode.hpp
 #include com/sun/star/text/HoriOrientation.hpp
 #include com/sun/star/text/VertOrientation.hpp
+#include com/sun/star/text/WritingMode2.hpp
 #include com/sun/star/util/XNumberFormatsSupplier.hpp
 
 #include rtl/ustring.hxx
@@ -2258,6 +2259,12 @@ DECLARE_RTFIMPORT_TEST(testFdo75614, tdf75614.rtf)
 CPPUNIT_ASSERT_EQUAL(OUString(after.), getRun(getParagraph(1), 
3)-getString());
 }
 
+DECLARE_RTFIMPORT_TEST(testTdf86182, tdf86182.rtf)
+{
+// Writing mode was the default, i.e. text::WritingMode2::CONTEXT.
+CPPUNIT_ASSERT_EQUAL(text::WritingMode2::RL_TB, 
getPropertysal_Int16(getParagraph(1), WritingMode));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index d589598..ad9954b 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -3028,7 +3028,7 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
 case RTF_RTLPAR:
 {
 RTFValue::Pointer_t pValue(new RTFValue(nKeyword == RTF_LTRPAR ? 0 : 
1));
-
m_aStates.top().aParagraphSprms.set(NS_ooxml::LN_CT_PPrBase_textDirection, 
pValue);
+m_aStates.top().aParagraphSprms.set(NS_ooxml::LN_CT_PPrBase_bidi, 
pValue);
 }
 break;
 case RTF_LTRROW:
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-04-13 Thread Miklos Vajna
 sw/qa/extras/rtfimport/data/tdf75614.rtf   |   18 ++
 sw/qa/extras/rtfimport/rtfimport.cxx   |6 ++
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |6 +-
 3 files changed, 29 insertions(+), 1 deletion(-)

New commits:
commit a32b8e78b2847c39c3d51aad7f4a76a79370119c
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Sun Apr 12 15:01:23 2015 +0200

tdf#75614 RTF import: fix missing text after footnote

(cherry picked from commit cec5f2eab25578a9859134d697c200089c597faa)

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

Change-Id: I5901094cb603c35a1cd8ac718fd434a9dd55729b
Reviewed-on: https://gerrit.libreoffice.org/15270
Tested-by: David Tardon dtar...@redhat.com
Reviewed-by: David Tardon dtar...@redhat.com

diff --git a/sw/qa/extras/rtfimport/data/tdf75614.rtf 
b/sw/qa/extras/rtfimport/data/tdf75614.rtf
new file mode 100644
index 000..1233801
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/tdf75614.rtf
@@ -0,0 +1,18 @@
+{\rtf1\ansi\ansicpg0\uc1\deff0\deflang0\deflangfe0\fet2
+{\*\ftnsep\pard\plain\chftnsep }
+{\*\ftnsepc\pard\plain\chftnsepc}
+\paperw8391\paperh11906\margl567\margr567\margt567\margb567\headery567\footery6\viewscale150\viewzk0
+{\fonttbl
+{\f0\fnil Arial;}
+{\f1\fnil\fcharset204 times new roman;}
+{\f2\fnil\fcharset204 cambria;}
+{\f3\fnil\fcharset238 cambria;}
+{\f4\fnil\fcharset0 cambria;}
+{\f5\fnil\fcharset204 courier new;}
+{\f6\fnil\fcharset204 arial;}
+}
+{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;}
+\pard\plain Before\plain \super \chftn
+{\footnote
+\pard Footnote.}
+\plain after.\par}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx 
b/sw/qa/extras/rtfimport/rtfimport.cxx
index 1d77187..8dce8ee 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -2252,6 +2252,12 @@ DECLARE_RTFIMPORT_TEST(testTdf88811, tdf88811.rtf)
 CPPUNIT_ASSERT_EQUAL(static_castsal_Int32(4), xDrawPage-getCount());
 }
 
+DECLARE_RTFIMPORT_TEST(testFdo75614, tdf75614.rtf)
+{
+// Text after the footnote was missing, so this resulted in a 
css::container::NoSuchElementException.
+CPPUNIT_ASSERT_EQUAL(OUString(after.), getRun(getParagraph(1), 
3)-getString());
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 265fa1d..d589598 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -2337,8 +2337,12 @@ int RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword)
 }
 break;
 case RTF_CHFTN:
-// Nothing to do, dmapper assumes this is the default.
+{
+if (m_aStates.top().pCurrentBuffer == m_aSuperBuffer)
+// Stop buffering, there will be no custom mark for this footnote 
or endnote.
+m_aStates.top().pCurrentBuffer = 0;
 break;
+}
 case RTF_PAGE:
 {
 // Ignore page breaks inside tables.
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-01-16 Thread Michael Stahl
 sw/qa/extras/ooxmlimport/data/rhbz1180114.docx|binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx  |5 +
 writerfilter/source/dmapper/DomainMapper.cxx  |6 ++
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |3 ++-
 writerfilter/source/ooxml/model.xml   |   16 
 5 files changed, 29 insertions(+), 1 deletion(-)

New commits:
commit 42c261a9e459408653dd5dae548dcc5ba619cef1
Author: Michael Stahl mst...@redhat.com
Date:   Wed Jan 14 23:01:41 2015 +0100

rhbz#1180114: writerfilter: don't crash on w:customXmlDelRangeStart etc.

We can't do anything sensible with these CustomXML elements but now we
have to handle them because.

(regression from 9dbf817fe5c5253fba0831aefa17575ae0ba3af1)

Change-Id: If4247890ff9961a77434587802670d28608a7922
(cherry picked from commit f22964e0e622af1168e241f933e5cf98e093ec2b)
Reviewed-on: https://gerrit.libreoffice.org/13913
Reviewed-by: Caolán McNamara caol...@redhat.com
Tested-by: Caolán McNamara caol...@redhat.com

diff --git a/sw/qa/extras/ooxmlimport/data/rhbz1180114.docx 
b/sw/qa/extras/ooxmlimport/data/rhbz1180114.docx
new file mode 100644
index 000..23009eb
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/rhbz1180114.docx 
differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 27fe3d6..471095c 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -744,6 +744,11 @@ DECLARE_OOXMLIMPORT_TEST(testN779834, n779834.docx)
 // This document simply crashed the importer.
 }
 
+DECLARE_OOXMLIMPORT_TEST(testRHBZ1180114, rhbz1180114.docx)
+{
+// This document simply crashed the importer.
+}
+
 DECLARE_OOXMLIMPORT_TEST(testN779627, n779627.docx)
 {
 /*
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index 8d4f548..ad477c5 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -2196,6 +2196,12 @@ void DomainMapper::sprmWithProps( Sprm rSprm, 
PropertyMapPtr rContext )
 case NS_ooxml::LN_CT_PPr_pPrChange:
 case NS_ooxml::LN_trackchange:
 case NS_ooxml::LN_EG_RPrContent_rPrChange:
+case NS_ooxml::LN_EG_RangeMarkupElements_customXmlDelRangeStart:
+case NS_ooxml::LN_EG_RangeMarkupElements_customXmlDelRangeEnd:
+case NS_ooxml::LN_EG_RangeMarkupElements_customXmlMoveFromRangeStart:
+case NS_ooxml::LN_EG_RangeMarkupElements_customXmlMoveFromRangeEnd:
+case NS_ooxml::LN_EG_RangeMarkupElements_customXmlMoveToRangeStart:
+case NS_ooxml::LN_EG_RangeMarkupElements_customXmlMoveToRangeEnd:
 {
 HandleRedline( rSprm );
 }
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 20bd4ce..3e7e4af 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -4734,9 +4734,10 @@ void DomainMapper_Impl::SetCurrentRedlineId( sal_Int32 
sId )
 {
 // This should be an assert, but somebody had the smart idea to reuse 
this function also for comments and whatnot,
 // and in some cases the id is actually not handled, which may be in 
fact a bug.
-SAL_WARN( writerfilter, !m_currentRedline.get());
 if( m_currentRedline.get())
 m_currentRedline-m_nId = sId;
+else
+SAL_INFO(writerfilter.dmapper, no current redline);
 }
 }
 
diff --git a/writerfilter/source/ooxml/model.xml 
b/writerfilter/source/ooxml/model.xml
index 925d7ac..ef288b1 100644
--- a/writerfilter/source/ooxml/model.xml
+++ b/writerfilter/source/ooxml/model.xml
@@ -17281,6 +17281,22 @@
 resource name=CT_TrackChange resource=Properties
   attribute name=author tokenid=ooxml:CT_TrackChange_author/
   attribute name=date tokenid=ooxml:CT_TrackChange_date/
+  action name=end 
tokenid=ooxml:EG_RangeMarkupElements_customXmlInsRangeStart 
action=sendPropertiesWithId 
sendtokenid=ooxml:EG_RangeMarkupElements_customXmlInsRangeStart/
+  action name=end 
tokenid=ooxml:EG_RangeMarkupElements_customXmlInsRangeStart 
action=clearProps/
+  action name=end 
tokenid=ooxml:EG_RangeMarkupElements_customXmlInsRangeEnd 
action=sendPropertiesWithId 
sendtokenid=ooxml:EG_RangeMarkupElements_customXmlInsRangeEnd/
+  action name=end 
tokenid=ooxml:EG_RangeMarkupElements_customXmlInsRangeEnd 
action=clearProps/
+  action name=end 
tokenid=ooxml:EG_RangeMarkupElements_customXmlDelRangeStart 
action=sendPropertiesWithId 
sendtokenid=ooxml:EG_RangeMarkupElements_customXmlDelRangeStart/
+  action name=end 
tokenid=ooxml:EG_RangeMarkupElements_customXmlDelRangeStart 
action=clearProps/
+  action name=end 
tokenid=ooxml:EG_RangeMarkupElements_customXmlDelRangeEnd 
action=sendPropertiesWithId 

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

2014-12-14 Thread Miklos Vajna
 sw/qa/extras/htmlexport/htmlexport.cxx|4 +-
 sw/qa/extras/rtfimport/data/fdo85179.rtf  |4 ++
 sw/qa/extras/rtfimport/data/fdo86761.rtf  |   42 ++
 sw/qa/extras/rtfimport/rtfimport.cxx  |6 +++
 writerfilter/source/dmapper/GraphicImport.cxx |3 +
 writerfilter/source/rtftok/rtfsdrimport.cxx   |2 +
 6 files changed, 58 insertions(+), 3 deletions(-)

New commits:
commit e1de94244c1b0419c1c3415c02381e8b7a87abe0
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Sun Dec 14 11:13:17 2014 +0100

fdo#86761 RTF import: positive border width and fLine=0 means no border

Regression from 01a32b7d074511bed24044dc94e1159aea62722b (fdo#85179 RTF
filter: import image border, 2014-10-23), there were a number of
problems here:

- CppunitTest_sw_htmlexport: revert back to the old behavior, where in
  case there is no border, we don't set the color of it.
- The testcase of the above commit omitted fLine=1 shape property, which
  is present in the original bugdoc, and only with that should we put a
  border around the shape.
- Let fLine=1 explicitly change the line style from NONE.
- dmapper: if line style is NONE, then don't bother setting the border
  color and width.

Change-Id: Iffee41066d42822b699c478821645b9742df3f58
(cherry picked from commit 4568d1d298bf4fc98dcd86384743a04587a2fe6f)

diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx 
b/sw/qa/extras/htmlexport/htmlexport.cxx
index e454a40..fd07c75 100644
--- a/sw/qa/extras/htmlexport/htmlexport.cxx
+++ b/sw/qa/extras/htmlexport/htmlexport.cxx
@@ -120,7 +120,7 @@ DECLARE_HTMLEXPORT_TEST(testExportOfImages, 
textAndImage.docx)
 CPPUNIT_ASSERT(pDoc);
 
 assertXPath(pDoc, /html/body, 1);
-assertXPath(pDoc, /html/body/p/font/img, 1);
+assertXPath(pDoc, /html/body/p/img, 1);
 }
 
 DECLARE_HTMLEXPORT_TEST(testExportOfImagesWithSkipImageEnabled, 
textAndImage.docx)
@@ -129,7 +129,7 @@ 
DECLARE_HTMLEXPORT_TEST(testExportOfImagesWithSkipImageEnabled, textAndImage.do
 CPPUNIT_ASSERT(pDoc);
 
 assertXPath(pDoc, /html/body, 1);
-assertXPath(pDoc, /html/body/p/font/img, 0);
+assertXPath(pDoc, /html/body/p/img, 0);
 }
 
 DECLARE_HTMLEXPORT_TEST(testSkipImageEmbedded, skipimage-embedded.doc)
diff --git a/sw/qa/extras/rtfimport/data/fdo85179.rtf 
b/sw/qa/extras/rtfimport/data/fdo85179.rtf
index fb9bcfa..8c69d31 100644
--- a/sw/qa/extras/rtfimport/data/fdo85179.rtf
+++ b/sw/qa/extras/rtfimport/data/fdo85179.rtf
@@ -15,6 +15,10 @@
 {\sn lineWidth}
 {\sv 50800}
 }
+{\sp
+{\sn fLine}
+{\sv 1}
+}
 }
 
\picscalex100\picscaley100\piccropl0\piccropr0\piccropt0\piccropb0\picw1806\pich1806\picwgoal1024\pichgoal1024\pngblip
 
89504e470d0a1a0a000d4948445200400040080460b955000467414d41b18f0bfc610500017352474200aece1ce9
diff --git a/sw/qa/extras/rtfimport/data/fdo86761.rtf 
b/sw/qa/extras/rtfimport/data/fdo86761.rtf
new file mode 100644
index 000..f22d836
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo86761.rtf
@@ -0,0 +1,42 @@
+{\rtf1
+{\rtlch\fcs1 \af31507 \ltrch\fcs0 \insrsid3346813 
\hich\af31506\dbch\af31505\loch\f31506 Image with no border
+\par }
+{\rtlch\fcs1 \af31507 \ltrch\fcs0 
\lang1024\langfe1024\noproof\insrsid986338\charrsid3761114
+{\*\shppict
+{\pict
+{\*\picprop\shplid1026
+{\sp
+{\sn shapeType}
+{\sv 75}
+}
+{\sp
+{\sn fLockAgainstSelect}
+{\sv 0}
+}
+{\sp
+{\sn fLine}
+{\sv 0}
+}
+{\sp
+{\sn wzName}
+{\sv Picture 1}
+}
+}
+\picscalex100\picscaley100\piccropl0\piccropr0\piccropt0\piccropb0
+\picw3598\pich4233\picwgoal2040\pichgoal2400\jpegblip\bliptag-859510685
+{\*\blipuid ccc4e863fe2f64c0500a0ae3f1b81a42}
+89504e470d0a1a0a000d4948445200400040080460b955000467414d41b18f0bfc610500017352474200aece1ce9
+00206348524d7a268084fa0080e87530ea603a9817709cba513c0002624b4744aa8d233200096f464673
+0006000c7355d30009704859730dd70dd70142289b78000976704167004c0040009d31381b01cd4944415468
+deedd93d4fc24018c0f17f89c6cdc44940e3e222be2c0e7e0417e3a8113571707632514012a320c6f84d34be2c2ec2b750f40be8e6e4a00113cfe14a5b69b108
+f4589ee71652eefafce0b9f42e3d7063822aaac3f641d173a75d3efee85b6582c0c8749c5eb7332cfb4e6f213d336ed29807304477b1c7a94db80ae9e9c934d0
+fcdd12e7ffcefcc9168f9a0059143b8cb0d2de581f609854073fbecc220f60b18722479d0d14abed8c8cb5d3293ce2949903b0d8a7047cb1c98541008cba840c
+a736e1d2200046b967567f740961d3b197008873cf74835002eaac736319ca0d4296121675d2dc1a0440d2256428625163ed2f42cf011e8245d621b42c44
+0400485261a699706d192fa100d4490713220240dc25e438b1090185880ca09f8ece5c28d9843b009e82471ca25069d5cb785529bd007fdbfb8541b65b2f
+531100947a51530d42c1d92f9829818e31ca4ce9421c70e427440e80712a7a89b7c8fb0906003046a5311df31cf501a01f4d0ee1b80f00bd4c398558ee0340ff

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

2014-12-08 Thread Miklos Vajna
 sw/qa/extras/rtfimport/data/fdo86750.rtf  |4 
 sw/qa/extras/rtfimport/rtfimport.cxx  |6 ++
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |9 +
 3 files changed, 19 insertions(+)

New commits:
commit 7b16cf0f554680adadef19dfdf82c52243313e03
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Mon Dec 8 09:16:22 2014 +0100

fdo#86750 RTF import: fix table of contents links

Change-Id: I0f3d35a0e64c9ce5646fa63eda317bee42de5540
(cherry picked from commit 4517c94000153eab6c034ea548698953dd93f794)

diff --git a/sw/qa/extras/rtfimport/data/fdo86750.rtf 
b/sw/qa/extras/rtfimport/data/fdo86750.rtf
new file mode 100644
index 000..29f0b84
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo86750.rtf
@@ -0,0 +1,4 @@
+{\rtf1
+{\field{\*\fldinst { HYPERLINK \\l anchor }}{\fldrslt click}}\par
+{\*\bkmkstart anchor}target{\*\bkmkend anchor}\par
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx 
b/sw/qa/extras/rtfimport/rtfimport.cxx
index 0e916d3..1edf58c 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -2212,6 +2212,12 @@ DECLARE_RTFIMPORT_TEST(testFdo72031, fdo72031.rtf)
 CPPUNIT_ASSERT_EQUAL(aExpected, getRun(getParagraph(1), 1)-getString());
 }
 
+DECLARE_RTFIMPORT_TEST(testFdo86750, fdo86750.rtf)
+{
+// This was 'HYPERLINK#anchor', the URL of the hyperlink had the field 
type as a prefix, leading to broken links.
+CPPUNIT_ASSERT_EQUAL(OUString(#anchor), 
getPropertyOUString(getRun(getParagraph(1), 1), HyperLinkURL));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index b4fa15b..20bd4ce 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -3645,6 +3645,15 @@ void DomainMapper_Impl::CloseFieldCommand()
 case FIELD_HYPERLINK:
 {
 ::std::vectorOUString aParts = 
pContext-GetCommandParts();
+
+// Syntax is either:
+// HYPERLINK  \l link
+// or
+// HYPERLINK \l link
+// Make sure HYPERLINK doesn't end up as part of 
link in the second case.
+if (!aParts.empty()  aParts[0] == HYPERLINK)
+aParts.erase(aParts.begin());
+
 ::std::vectorOUString::const_iterator aItEnd = 
aParts.end();
 ::std::vectorOUString::const_iterator aPartIt = 
aParts.begin();
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-11-30 Thread Miklos Vajna
 sw/qa/extras/rtfimport/data/fdo72031.rtf   |1 
 sw/qa/extras/rtfimport/rtfimport.cxx   |9 ++--
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |   26 +++--
 3 files changed, 24 insertions(+), 12 deletions(-)

New commits:
commit 4cf0b919ed1d3bede755f403774fb2dc05b86a2a
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Sat Nov 29 11:43:10 2014 +0100

fdo#72031 RTF import: bogus call to getBestTextEncodingFromLocale()

There were two problems here. First, commit
bbe3627eece0c3486e7ea11f2f13377aaa3a8fed (rtftok: stop sending
sprm:CRgFtc{0,1,2} tokens, 2014-03-05) broke the use-case when the font
encoding is 0, but it's present. Before that commit, we parsed the font
encoding instantly; after that commit we parse it once we have a font
name. If we do that, then we have to have an idea if we have a font
encoding. Given that 0 is a valid encoding, use -1 for the have no
encoding case instead.

Second, commit 7839633fb356285652ed96f4bf3f85bcd5b561a4 (fdo#85889
handle pc, pca and mac rtf keywords in writerfilter, 2014-11-24) abused
m_nCurrentEncoding, which is meant to be used within the font table
only. The problem with this is that this way only the first font will
get the encoding, while the spec says it should be used in every context
where there is no other explicit encoding. Fix this by setting the
default encoding for those 3 control words instead -- and consider the
default encoding in getEncoding().

Change-Id: Ia1d71f8ce70f2a53a3770b4840e21362d082e71f
(cherry picked from commit fa15d039e3a553da8500c17190d27169a9477cf2)

diff --git a/sw/qa/extras/rtfimport/data/fdo72031.rtf 
b/sw/qa/extras/rtfimport/data/fdo72031.rtf
new file mode 100644
index 000..ee589da
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo72031.rtf
@@ -0,0 +1 @@
+{\rtf1\ansi\ansicpg1250\deff0\deflang1038{\fonttbl{\f0\fnil\fcharset2 
Symbol;}{\f1\fnil\fcharset238 MS Shell Dlg 
2;}}\viewkind4\uc1\pard\f0\fs23\'c5\f1\fs17\par}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx 
b/sw/qa/extras/rtfimport/rtfimport.cxx
index 7dc67c3..0e916d3 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -66,7 +66,7 @@ public:
 virtual void preTest(const char* filename) SAL_OVERRIDE
 {
 m_aSavedSettings = Application::GetSettings();
-if (OString(filename) == fdo48023.rtf)
+if (OString(filename) == fdo48023.rtf || OString(filename) == 
fdo72031.rtf)
 {
 AllSettings aSettings(m_aSavedSettings);
 aSettings.SetLanguageTag(LanguageTag(ru));
@@ -82,7 +82,7 @@ public:
 
 virtual void postTest(const char* filename) SAL_OVERRIDE
 {
-if (OString(filename) == fdo48023.rtf || OString(filename) == 
fdo44211.rtf)
+if (OString(filename) == fdo48023.rtf || OString(filename) == 
fdo72031.rtf || OString(filename) == fdo44211.rtf)
 Application::SetSettings(m_aSavedSettings);
 }
 
@@ -2206,6 +2206,11 @@ DECLARE_RTFIMPORT_TEST(testFdo85889mac, 
fdo85889-mac.rtf)
 CPPUNIT_ASSERT_EQUAL(aExpected, xTextRange-getString());
 }
 
+DECLARE_RTFIMPORT_TEST(testFdo72031, fdo72031.rtf)
+{
+OUString aExpected(\xc3\x85, 2, RTL_TEXTENCODING_UTF8);
+CPPUNIT_ASSERT_EQUAL(aExpected, getRun(getParagraph(1), 1)-getString());
+}
 
 CPPUNIT_PLUGIN_IMPLEMENT();
 
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 5bab89b..5fb1225 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -256,7 +256,7 @@ 
RTFDocumentImpl::RTFDocumentImpl(uno::Referenceuno::XComponentContext const x
   m_bObject(false),
   m_aFontTableEntries(),
   m_nCurrentFontIndex(0),
-  m_nCurrentEncoding(0),
+  m_nCurrentEncoding(-1),
   m_nDefaultFontIndex(-1),
   m_aStyleTableEntries(),
   m_nCurrentStyleIndex(0),
@@ -643,8 +643,14 @@ rtl_TextEncoding RTFDocumentImpl::getEncoding(int 
nFontIndex)
 {
 std::mapint, rtl_TextEncoding::iterator it = 
m_aFontEncodings.find(nFontIndex);
 if (it != m_aFontEncodings.end())
+// We have a font encoding associated to this font.
 return it-second;
-return 
msfilter::util::getBestTextEncodingFromLocale(Application::GetSettings().GetLanguageTag().getLocale());
+else if (m_aDefaultState.nCurrentEncoding != 
rtl_getTextEncodingFromWindowsCharset(0))
+// We have a default encoding.
+return m_aDefaultState.nCurrentEncoding;
+else
+// Guess based on locale.
+return 
msfilter::util::getBestTextEncodingFromLocale(Application::GetSettings().GetLanguageTag().getLocale());
 }
 else
 return m_pSuperstream-getEncoding(nFontIndex);
@@ -1165,10 +1171,10 @@ void RTFDocumentImpl::text(OUString rString)
 case 

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

2014-11-26 Thread Caolán McNamara
 sw/qa/core/data/rtf/pass/ooo121333-1.rtf   |   43 +
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |   13 ++-
 2 files changed, 48 insertions(+), 8 deletions(-)

New commits:
commit c51c39ddf6d513afda83d4f15549c6277a0cc211
Author: Caolán McNamara caol...@redhat.com
Date:   Wed Nov 26 12:44:10 2014 +

always pass bookmark name through to domainmapper

the rtf doc has three bookmark starts but only two matching
bookmark ends.

The tokenizer has three starts 0, 1, 2, but 0 is missing an end. Without the
end of 0, the mapper never inserts an entry for it, so later inserts the 
start
of rtftok index 1 as mapper index 0, and passing the end for a bare 1 
cannot
be found by index. If we pass the name then it finds it by name as mapper 
index
0 and all is well.

Change-Id: I344db84e4f1c7d55fca59cdfe692080c7d0b8033
(cherry picked from commit 2b54caceab9d975bffa7e24bf732cb877b16632f)
Reviewed-on: https://gerrit.libreoffice.org/13133
Reviewed-by: Miklos Vajna vmik...@collabora.co.uk
Tested-by: Miklos Vajna vmik...@collabora.co.uk

diff --git a/sw/qa/core/data/rtf/pass/ooo121333-1.rtf 
b/sw/qa/core/data/rtf/pass/ooo121333-1.rtf
new file mode 100644
index 000..7f3b531
--- /dev/null
+++ b/sw/qa/core/data/rtf/pass/ooo121333-1.rtf
@@ -0,0 +1,43 @@
+{\rtf1\ansi\deff0\adeflang1025
+{\fonttbl{\f0\froman\fprq2\fcharset0 Times New 
Roman;}{\f1\froman\fprq2\fcharset2 Symbol;}{\f2\fswiss\fprq2\fcharset0 
Arial;}{\f3\fswiss\fprq2\fcharset0 Trebuchet MS;}{\f4\fswiss\fprq2\fcharset128 
Arial;}{\f5\fswiss\fprq2\fcharset0 Arial Unicode MS;}{\f6\fnil\fprq2\fcharset0 
Mangal;}{\f7\fnil\fprq0\fcharset0 Mangal;}}
+{\colortbl;\red0\green0\blue0;\red128\green128\blue128;}
+{\stylesheet{\s0\snext0\ql{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\aspalpha\ltrpar\nowidctlpar\cf0\kerning1\hich\af5\langfe2052\dbch\af6\afs24\lang1081\loch\f0\fs24\lang1033
 Default;}
+{\s15\sbasedon0\snext16\ql{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\sb240\sa120\keepn\ltrpar\cf0\kerning1\hich\af5\langfe2052\dbch\af6\loch\f2\fs28\lang1033
 Heading;}
+{\s16\sbasedon0\snext16\ql{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\sb0\sa120\ltrpar\cf0\kerning1\hich\af0\langfe2052\dbch\af0\loch\f0\fs24\lang1033
 Text body;}
+{\s17\sbasedon16\snext17\ql{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\sb0\sa120\ltrpar\cf0\kerning1\hich\af0\langfe2052\dbch\af7\loch\f0\fs24\lang1033
 List;}
+{\s18\sbasedon0\snext18\ql{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\sb120\sa120\ltrpar\cf0\i\kerning1\hich\af0\langfe2052\dbch\af7\ai\loch\f0\fs24\lang1033
 Caption;}
+{\s19\sbasedon0\snext19\ql{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\ltrpar\cf0\kerning1\hich\af0\langfe2052\dbch\af7\loch\f0\fs24\lang1033
 Index;}
+}{\info{\author Lisa 
Stroyan}{\creatim\yr2012\mo11\dy10\hr15\min44}{\revtim\yr2012\mo11\dy10\hr16\min16}{\printim\yr0\mo0\dy0\hr0\min0}{\comment
 
OpenOffice.org}{\vern3410}}\deftab709\deftab709\deftab709\deftab709\deftab709\deftab709\deftab709\deftab709\deftab709\deftab709\deftab709\deftab709\deftab709\deftab709\deftab709\deftab709\deftab709\deftab709\deftab709\deftab709
+
+{\*\pgdsctbl
+{\pgdsc0\pgdscuse195\pgwsxn12240\pghsxn15840\marglsxn1134\margrsxn1134\margtsxn1134\margbsxn1134\pgdscnxt0
 Default;}}
+\formshade{\*\pgdscno0}\paperh15840\paperw12240\margl1134\margr1134\margt1134\margb1134\sectd\sbknone\sectunlocked1\pgndec\pgwsxn12240\pghsxn15840\marglsxn1134\margrsxn1134\margtsxn1134\margbsxn1134\ftnbj\ftnstart1\ftnrstcont\ftnnar\aenddoc\aftnrstcont\aftnstart1\aftnnrlc
+\pgndec\pard\plain 
\s0\ql{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\aspalpha\ltrpar\nowidctlpar\cf0\kerning1\hich\af5\langfe2052\dbch\af6\afs24\lang1081\loch\f0\fs24\lang1033{\rtlch
 \ltrch
+\'93}{\rtlch \ltrch\loch
+test\'94}
+\par \pard\plain 
\s0\ql{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\aspalpha\ltrpar\nowidctlpar\cf0\kerning1\hich\af5\langfe2052\dbch\af6\afs24\lang1081\loch\f0\fs24\lang1033{\rtlch
 \ltrch\loch
+}
+\par \pard\plain 
\s0\ql{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\aspalpha\ltrpar\nowidctlpar\cf0\kerning1\hich\af5\langfe2052\dbch\af6\afs24\lang1081\loch\f0\fs24\lang1033{\rtlch
 \ltrch\loch\f3
+\'93}{\rtlch \ltrch\loch\loch\f4
+Another }{\rtlch \ltrch\dbch\loch\f4
+\u21520\'3f}{\rtlch \ltrch\loch\loch\f4
+oo}{\rtlch \ltrch\loch\loch\f3
+ test\'94}
+\par \pard\plain 
\s0\ql{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\aspalpha\ltrpar\nowidctlpar\cf0\kerning1\hich\af5\langfe2052\dbch\af6\afs24\lang1081\loch\f0\fs24\lang1033{\rtlch
 \ltrch\loch
+}
+\par \pard\plain 
\s0\ql{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\aspalpha\ltrpar\nowidctlpar\cf0\kerning1\hich\af5\langfe2052\dbch\af6\afs24\lang1081\loch\f0\fs24\lang1033{{\*\bkmkstart
 __DdeLink__132_187012832}\rtlch \ltrch\loch\loch\f3
+Created (or opened) testoocharacters.odt file with angled double quotes, using 
both Times and Trebuchet. Saved as RTF, closed, and reopened.}
+\par \pard\plain