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

2014-08-19 Thread Miklos Vajna
 sw/qa/extras/ooxmlexport/data/first-header-footer.docx  |binary
 sw/qa/extras/ooxmlexport/data/footer-body-distance.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx|   38 ++-
 sw/qa/extras/ww8import/data/fdo81102.doc|binary
 sw/qa/extras/ww8import/ww8import.cxx|   16 
 sw/source/filter/ww8/ww8par.cxx |5 -
 writerfilter/source/dmapper/DomainMapper_Impl.cxx   |4 -
 writerfilter/source/dmapper/PropertyMap.cxx |   53 +++-
 8 files changed, 69 insertions(+), 47 deletions(-)

New commits:
commit 4a1c82de77f28a107198b8d8da3cf840d541360a
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Mon Jul 14 12:34:23 2014 +0200

DOCX import: fix FooterBodyDistance for first pages

The root cause was that code in
SectionPropertyMap::PrepareHeaderFooterProperties() saved member
variables on the stack, modified them, then restored them at the end of
the method, but forgot to restore m_nBottomMargin there.

The result of this was that First Page's FooterBodyDistance got set to
zero, which is not the same as Default Style's FooterBodyDistance (150),
so on export sw::util::IsPlausableSingleWordSection() returned false,
which turned the page break into a section break.

Change-Id: I1afa2603de1313ae1e2aaefd4b7c771fce27e21e
(cherry picked from commit 8cf681c5049970573020d8b808c990441b9cf828)
Signed-off-by: Luboš Luňák l.lu...@collabora.com

diff --git a/sw/qa/extras/ooxmlexport/data/footer-body-distance.docx 
b/sw/qa/extras/ooxmlexport/data/footer-body-distance.docx
new file mode 100644
index 000..0244d76
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/footer-body-distance.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 30a6d2f..fdcab8a 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -3651,6 +3651,13 @@ DECLARE_OOXMLEXPORT_TEST(testFirstHeaderFooter, 
first-header-footer.docx)
 CPPUNIT_ASSERT_EQUAL(OUString(Even page footer 2),  
parseDump(/root/page[6]/footer/txt/text()));
 }
 
+DECLARE_OOXMLEXPORT_TEST(testFooterBodyDistance, footer-body-distance.docx)
+{
+if (xmlDocPtr pXmlDoc = parseExport())
+// Page break was exported as section break, this was 0
+assertXPath(pXmlDoc, /w:document/w:body/w:p/w:r/w:br, 1);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/dmapper/PropertyMap.cxx 
b/writerfilter/source/dmapper/PropertyMap.cxx
index 647c915..0b47cad 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -868,6 +868,7 @@ 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_nBottomMargin = nBottomMargin;
 m_nHeaderBottom = nHeaderBottom;
 }
 
commit 2e7a33658983b6863d3847daca0265e43fbe18ba
Author: Luke Deller l...@deller.id.au
Date:   Wed Jul 9 22:39:41 2014 +1000

fdo#81102: fix .doc import of blank even page header

Honour the different odd  even pages header/footer setting from the
doc file even if there is no content for an even page header or footer.

Conflicts:
sw/qa/extras/ww8import/ww8import.cxx
Reviewed on:
https://gerrit.libreoffice.org/10191

(cherry picked from commit b5bb15013617c6b9f1cdd089acae0bfb7104fa3a)
Signed-off-by: Luboš Luňák l.lu...@collabora.com

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

Change-Id: I963f7f7189e399b1d859db0788fbfd291e868c54

diff --git a/sw/qa/extras/ww8import/data/fdo81102.doc 
b/sw/qa/extras/ww8import/data/fdo81102.doc
new file mode 100755
index 000..e8a5507
Binary files /dev/null and b/sw/qa/extras/ww8import/data/fdo81102.doc differ
diff --git a/sw/qa/extras/ww8import/ww8import.cxx 
b/sw/qa/extras/ww8import/ww8import.cxx
index 81b0043..2fca67c 100644
--- a/sw/qa/extras/ww8import/ww8import.cxx
+++ b/sw/qa/extras/ww8import/ww8import.cxx
@@ -496,6 +496,22 @@ DECLARE_WW8IMPORT_TEST(testBnc787942, bnc787942.doc)
 parseDump(/root/page[1]/body/txt[4]/anchored);
 }
 
+DECLARE_WW8IMPORT_TEST(testFdo81102, fdo81102.doc)
+{
+// get page style at beginning of document
+uno::Referencetext::XTextDocument textDocument(
+mxComponent, uno::UNO_QUERY);
+uno::Referencetext::XTextRange start(
+textDocument-getText()-getStart(), uno::UNO_QUERY);
+OUString pageStyleName = getPropertyOUString(start, PageStyleName);
+uno::Referencestyle::XStyle pageStyle(
+getStyles(PageStyles)-getByName(pageStyleName), uno::UNO_QUERY);
+
+// check that left and right 

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

2014-07-11 Thread Dushyant Bhalgami
 sw/qa/extras/ooxmlexport/data/fdo79968.docx  |binary
 sw/qa/extras/ooxmlexport/data/fdo79969_xlsb.docx |binary
 sw/qa/extras/ooxmlexport/data/fdo79969_xlsm.docx |binary
 sw/qa/extras/ooxmlexport/data/fdo80522.docx  |binary
 sw/qa/extras/ooxmlexport/data/fdo80523_pptm.docx |binary
 sw/qa/extras/ooxmlexport/data/fdo80523_sldm.docx |binary
 sw/qa/extras/ooxmlexport/data/fdo80898.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx |   96 +++
 sw/source/filter/ww8/docxattributeoutput.cxx |   43 ++
 9 files changed, 139 insertions(+)

New commits:
commit 6b76a1855a60fce90eb09e3d40a79dca0c5901bd
Author: Dushyant Bhalgami dushyant.bhalg...@synerzip.com
Date:   Fri Jul 4 13:35:54 2014 +0530

fdo#80898:Fix for embedded obj 97-2003 MS Doc File

Added implementation for embedded Word 97-2003 document.

Change-Id: I47ec39f25beee9a37f2a1e914384bc458df31b78
Reviewed-on: https://gerrit.libreoffice.org/10078
Reviewed-by: Miklos Vajna vmik...@collabora.co.uk
Tested-by: Miklos Vajna vmik...@collabora.co.uk
(cherry picked from commit 163b5fd59fe1e9b8c8a1bcac9dab069c0bcd27e9)
Signed-off-by: Michael Stahl mst...@redhat.com

diff --git a/sw/qa/extras/ooxmlexport/data/fdo80898.docx 
b/sw/qa/extras/ooxmlexport/data/fdo80898.docx
new file mode 100644
index 000..d4b9e1f
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo80898.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index da32d57..312d9d9 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -3595,6 +3595,20 @@ 
DECLARE_OOXMLEXPORT_TEST(testfdo80523_sldm,fdo80523_sldm.docx)
 /word/embeddings/oleObject1.sldm);
 }
 
+DECLARE_OOXMLEXPORT_TEST(testfdo80898, fdo80898.docx)
+{
+// This UT for DOCX embedded with binary excel work sheet.
+xmlDocPtr pXmlDoc = parseExport([Content_Types].xml);
+
+if (!pXmlDoc)
+   return;
+
+assertXPath(pXmlDoc,
+
/ContentType:Types/ContentType:Override[@ContentType='application/msword'],
+PartName,
+/word/embeddings/oleObject1.doc);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 0e7538a..3b71536 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -4199,6 +4199,13 @@ void DocxAttributeOutput::WriteOLE( SwOLENode rNode, 
const Size rSize, const S
 sRelationType = 
http://schemas.openxmlformats.org/officeDocument/2006/relationships/package;;
 sFileExtension = docm;
 }
+//Implementation for embedded Word 97-2003 document was missing
+else if( sProgID == Word.Document.8 )
+{
+sMediaType = application/msword;
+sRelationType = 
http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject;;
+sFileExtension = doc;
+}
 else
 {
 sMediaType = application/vnd.openxmlformats-officedocument.oleObject;
commit 1f9e3661ee2ca8334dc228c65cfc23442c2a9c39
Author: PriyankaGaikwad priyanka.gaik...@synerzip.com
Date:   Thu Jun 26 18:07:26 2014 +0530

fdo#80522  fdo#80523:Embedded Macro-Enabled objects are not preserved

Description :
fdo#80522
- DOCX contain embedded word Macro-Enabled document.
- Embedded word Macro-Enabled object is not preserved.
- .docm preserved as .bin so word Macro-Enabled document is converted to 
picture.

fdo#80523
1) Embedded PowerPoint Macro-Enabled Slide
   - DOCX contain embedded PowerPoint Macro-Enabled Slide
   - Embedded PowerPoint Macro-Enabled Slide is not preserved.
   - .sldm preserved as .bin so powerpoint Macro-Enabled slide is converted 
to picture.
2) Embedded PowerPoint Macro-Enabled Presentation
   - same case with embedded PowerPoint Macro-Enabled Presentation
   - Embedded PowerPoint Macro-Enabled presentation is not preserved.
   - .pptm preserved as .pptx so powerpoint Macro-Enabled presentation is 
converted to picture .

Implementation :
Added sMediaType, sRelationType  sFileExtension for these embedded objects.

Change-Id: Ia58662ba921f3d940e8ead04a7f7ae83689a3b35
Reviewed-on: https://gerrit.libreoffice.org/9917
Reviewed-by: Miklos Vajna vmik...@collabora.co.uk
Tested-by: Miklos Vajna vmik...@collabora.co.uk
(cherry picked from commit f11d6421e4e61ce6f557ebd8272485f79968224e)
Signed-off-by: Michael Stahl mst...@redhat.com

diff --git a/sw/qa/extras/ooxmlexport/data/fdo80522.docx 
b/sw/qa/extras/ooxmlexport/data/fdo80522.docx
new file mode 100644
index 000..9445b73
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo80522.docx differ
diff --git a/sw/qa/extras/ooxmlexport/data/fdo80523_pptm.docx 

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

2014-06-12 Thread Michael Stahl
 sw/qa/extras/rtfexport/data/fdo77979.odt   |binary
 sw/qa/extras/rtfexport/rtfexport.cxx   |7 +++
 sw/source/filter/inc/msfilter.hxx  |   12 +-
 sw/source/filter/ww8/rtfattributeoutput.cxx|   21 +-
 sw/source/filter/ww8/writerwordglue.cxx|   49 +
 sw/source/filter/ww8/wrtw8sty.cxx  |3 +
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |9 ++--
 7 files changed, 91 insertions(+), 10 deletions(-)

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

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

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

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

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

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

Change-Id: Ie6a42294c501d014dd9f0df82638519412ca19bb
(cherry picked from commit e47a02b1524061143d8e77a54eb95c77f2e6dae2)

fdo#77979: argh forgot to add the test document
(cherry picked from commit 90b2b378aecfa1914be0ce9aa7aa4e006e225e96)

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

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

2014-06-06 Thread Jacobo Aragunde Pérez
 sw/qa/extras/ooxmlexport/data/theme-preservation.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx  |   10 +--
 sw/source/filter/ww8/docxattributeoutput.cxx  |   58 +-
 sw/source/filter/ww8/docxattributeoutput.hxx  |1 
 4 files changed, 52 insertions(+), 17 deletions(-)

New commits:
commit 5a09788e3507b0c5cb53e4d489e3a15e57c57f05
Author: Jacobo Aragunde Pérez jaragu...@igalia.com
Date:   Fri Jun 6 13:43:06 2014 +0200

fdo#79558: Do not overwrite w:shd value

When a w:shd has some pattern with two colors, LO blends both to
render the paragraph background. We must compare that blended color
with the paragraph color on export to know if the user has edited it
or not. We were using the w:fill attribute to compare, but that was
incorrect.

Modified an existing unit test to check this behaviour. The unit test
had to be retouched because Word remove some redundant information
from the original .docx file when I saved it again with some
background changes.

(cherry-picked from commit 1534c3363336003c4f84cfec1bf988fef6663f8a)

Change-Id: Ia2f1ddc4afd2637e1d87b6eccd441c26853045c4

diff --git a/sw/qa/extras/ooxmlexport/data/theme-preservation.docx 
b/sw/qa/extras/ooxmlexport/data/theme-preservation.docx
index 1c94b47..2de4374 100644
Binary files a/sw/qa/extras/ooxmlexport/data/theme-preservation.docx and 
b/sw/qa/extras/ooxmlexport/data/theme-preservation.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index ff3e138..fd98235 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -1928,9 +1928,7 @@ DECLARE_OOXMLEXPORT_TEST(testThemePreservation, 
theme-preservation.docx)
 // check theme font color value has been preserved
 assertXPath(pXmlDocument, 
/w:document/w:body/w:p[4]/w:r[1]/w:rPr/w:color, themeColor, accent3);
 OUString sThemeShade = getXPath(pXmlDocument, 
/w:document/w:body/w:p[4]/w:r[1]/w:rPr/w:color, themeShade);
-CPPUNIT_ASSERT_EQUAL(sThemeShade.toInt32(16), sal_Int32(0xbf));
-assertXPath(pXmlDocument, 
/w:document/w:body/w:p[7]/w:r[1]/w:rPr/w:color, themeColor, accent1);
-assertXPath(pXmlDocument, 
/w:document/w:body/w:p[7]/w:r[1]/w:rPr/w:color, themeTint, 99);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(0xbf), sThemeShade.toInt32(16));
 
 // check the themeFontLang values in settings file
 xmlDocPtr pXmlSettings = parseExport(word/settings.xml);
@@ -1954,8 +1952,12 @@ DECLARE_OOXMLEXPORT_TEST(testThemePreservation, 
theme-preservation.docx)
 CPPUNIT_ASSERT_EQUAL(OUString(Trebuchet MS),
  getPropertyOUString(getParagraph(5, Major theme 
font), CharFontName));
 
-// check the paragraph background theme color has been preserved
+// check the paragraph background pattern has been preserved including 
theme colors
+assertXPath(pXmlDocument, /w:document/w:body/w:p[6]/w:pPr/w:shd, val, 
thinHorzStripe);
 assertXPath(pXmlDocument, /w:document/w:body/w:p[6]/w:pPr/w:shd, 
themeFill, text2);
+assertXPath(pXmlDocument, /w:document/w:body/w:p[6]/w:pPr/w:shd, 
themeFillTint, 33);
+assertXPath(pXmlDocument, /w:document/w:body/w:p[6]/w:pPr/w:shd, 
themeColor, accent1);
+assertXPath(pXmlDocument, /w:document/w:body/w:p[6]/w:pPr/w:shd, 
themeShade, 80);
 }
 
 DECLARE_OOXMLEXPORT_TEST(testTableThemePreservation, 
table-theme-preservation.docx)
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 5bfce12..f16fdf6 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -6784,14 +6784,13 @@ void DocxAttributeOutput::FormatBackground( const 
SvxBrushItem rBrush )
 }
 else if ( !m_rExport.bOutPageDescs )
 {
-if( !m_pBackgroundAttrList )
-m_pBackgroundAttrList = m_pSerializer-createAttrList();
-
 // compare fill color with the original fill color
 OString sOriginalFill = rtl::OUStringToOString(
-m_pBackgroundAttrList-getOptionalValue( FSNS( XML_w, XML_fill 
) ), RTL_TEXTENCODING_UTF8 );
-if( sOriginalFill.isEmpty() )
+m_sOriginalBackgroundColor, RTL_TEXTENCODING_UTF8 );
+
+if( !m_pBackgroundAttrList )
 {
+m_pBackgroundAttrList = m_pSerializer-createAttrList();
 m_pBackgroundAttrList-add( FSNS( XML_w, XML_fill ), 
sColor.getStr() );
 m_pBackgroundAttrList-add( FSNS( XML_w, XML_val ), clear );
 }
@@ -6803,6 +6802,7 @@ void DocxAttributeOutput::FormatBackground( const 
SvxBrushItem rBrush )
 m_pBackgroundAttrList-add( FSNS( XML_w, XML_fill ), 
sColor.getStr() );
 m_pBackgroundAttrList-add( FSNS( XML_w, XML_val ), clear );
 }
+m_sOriginalBackgroundColor = ;
 }
 }
 
@@ -7189,7 +7189,7 @@ void