[Libreoffice-commits] core.git: oox/source sw/qa
abdulmajeed ahmed
aalabdulrazzaq at kacst.edu.sa
Sat Jun 15 03:54:19 PDT 2013
oox/source/core/xmlfilterbase.cxx | 2 +-
oox/source/docprop/docprophandler.cxx | 4 ++--
sw/qa/extras/ooxmlexport/data/fdo63053.docx |binary
sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 11 ++++++++++-
4 files changed, 13 insertions(+), 4 deletions(-)
New commits:
commit 36de708ce421b31beaaddb1048d444de91b2e5e9
Author: abdulmajeed ahmed <aalabdulrazzaq at kacst.edu.sa>
Date: Sat Jun 15 12:43:29 2013 +0200
fix fdo#63053 ampersand in document title causes corrupt docx
FILESAVE, FILEOPEN: ampersand in document title causes corrupt docx when saving; truncates title when loading
diff --git a/oox/source/core/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx
index 9a06b81..8a59187 100644
--- a/oox/source/core/xmlfilterbase.cxx
+++ b/oox/source/core/xmlfilterbase.cxx
@@ -450,7 +450,7 @@ writeElement( FSHelperPtr pDoc, sal_Int32 nXmlElement, const OUString& sValue )
if( sValue.isEmpty() )
return;
pDoc->startElement( nXmlElement, FSEND );
- pDoc->write( sValue );
+ pDoc->writeEscaped( sValue );
pDoc->endElement( nXmlElement );
}
diff --git a/oox/source/docprop/docprophandler.cxx b/oox/source/docprop/docprophandler.cxx
index 08cfda0..50d5d4c 100644
--- a/oox/source/docprop/docprophandler.cxx
+++ b/oox/source/docprop/docprophandler.cxx
@@ -453,11 +453,11 @@ void SAL_CALL OOXMLDocPropHandler::characters( const OUString& aChars )
break;
case DC_TOKEN( subject ):
- m_xDocProp->setSubject( aChars );
+ m_xDocProp->setSubject( m_xDocProp->getSubject() + aChars );
break;
case DC_TOKEN( title ):
- m_xDocProp->setTitle( aChars );
+ m_xDocProp->setTitle( m_xDocProp->getTitle() + aChars );
break;
default:
diff --git a/sw/qa/extras/ooxmlexport/data/fdo63053.docx b/sw/qa/extras/ooxmlexport/data/fdo63053.docx
new file mode 100644
index 0000000..43282b0
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo63053.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 494076c..b832322 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -75,7 +75,7 @@ public:
void testPageGraphicBackground();
void testFdo65265();
void testFdo65655();
-
+ void testFDO63053();
CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT)
CPPUNIT_TEST(run);
@@ -127,6 +127,8 @@ void Test::run()
{"page-graphic-background.odt", &Test::testPageGraphicBackground},
{"fdo65265.docx", &Test::testFdo65265},
{"fdo65655.docx", &Test::testFdo65655},
+ {"fdo63053.docx" , &Test::testFDO63053},
+
};
// Don't test the first import of these, for some reason those tests fail
const char* aBlacklist[] = {
@@ -725,6 +727,13 @@ void Test::testFdo65655()
CPPUNIT_ASSERT_EQUAL(false, bool(bValue));
xPropertySet->getPropertyValue("FooterIsShared") >>= bValue;
CPPUNIT_ASSERT_EQUAL(false, bool(bValue));
+
+void Test::testFDO63053()
+{
+ uno::Reference<document::XDocumentPropertiesSupplier> xDocumentPropertiesSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<document::XDocumentProperties> xDocumentProperties = xDocumentPropertiesSupplier->getDocumentProperties();
+ CPPUNIT_ASSERT_EQUAL(OUString("test1&test2"), xDocumentProperties->getTitle());
+ CPPUNIT_ASSERT_EQUAL(OUString("test1&test2"), xDocumentProperties->getSubject());
}
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
More information about the Libreoffice-commits
mailing list