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

Miklos Vajna vmiklos at collabora.co.uk
Mon Nov 25 03:29:02 PST 2013


 sw/qa/extras/ooxmlexport/ooxmlexport.cxx     |    6 ++++++
 writerfilter/source/dmapper/DomainMapper.cxx |    5 +++--
 2 files changed, 9 insertions(+), 2 deletions(-)

New commits:
commit a6fe1a5b2806b40edf0d06c8543d35abe5249412
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon Nov 25 11:55:57 2013 +0100

    DOCX import: handle NS_sprm::LN_CFSmallCaps == 0 after NS_sprm::LN_CFCaps
    
    "caps and no smallcaps" means style::CaseMap::UPPERCASE, not
    style::CaseMap::NONE. Different XML elements in DOCX, single UNO
    property.
    
    Change-Id: I8cbc719f2c307d5d2cbd4af93ea61e35b640ad1d

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 06bedcc..78b1256 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -24,6 +24,7 @@
 #include <com/sun/star/text/XTextFramesSupplier.hpp>
 #include <com/sun/star/text/XTextViewCursorSupplier.hpp>
 #include <com/sun/star/text/XTextSection.hpp>
+#include <com/sun/star/style/CaseMap.hpp>
 #include <com/sun/star/style/ParagraphAdjust.hpp>
 #include <com/sun/star/style/LineSpacing.hpp>
 #include <com/sun/star/style/LineSpacingMode.hpp>
@@ -1389,6 +1390,11 @@ DECLARE_OOXMLEXPORT_TEST(testCalendar1, "calendar1.docx")
 
 DECLARE_OOXMLEXPORT_TEST(testCalendar2, "calendar2.docx")
 {
+    // Problem was that CharCaseMap was style::CaseMap::NONE.
+    uno::Reference<text::XTextTable> xTable(getParagraphOrTable(1), uno::UNO_QUERY);
+    uno::Reference<text::XTextRange> xCell(xTable->getCellByName("A1"), uno::UNO_QUERY);
+    CPPUNIT_ASSERT_EQUAL(style::CaseMap::UPPERCASE, getProperty<sal_Int16>(getRun(getParagraphOfText(1, xCell->getText()), 1), "CharCaseMap"));
+
     // This paragraph property was missing in table style.
     xmlDocPtr pXmlStyles = parseExport("word/styles.xml");
     if (!pXmlStyles)
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index ae81ad5..9edb914 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -2225,8 +2225,9 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType
                         rContext->Insert(ePropertyId, uno::makeAny( nIntValue ? true : false ));
                     break;
                     case NS_sprm::LN_CFSmallCaps: /*sprmCFSmallCaps*/
-                        rContext->Insert(ePropertyId,
-                                         uno::makeAny( nIntValue ? style::CaseMap::SMALLCAPS : style::CaseMap::NONE));
+                        // If smallcaps would be just disabled and an other casemap is already inserted, don't do anything.
+                        if (nIntValue || rContext->find(ePropertyId) == rContext->end())
+                            rContext->Insert(ePropertyId, uno::makeAny( nIntValue ? style::CaseMap::SMALLCAPS : style::CaseMap::NONE));
                         m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "smallCaps", OUString::number(nIntValue));
                     break;
                     case NS_sprm::LN_CFCaps: /*sprmCFCaps*/


More information about the Libreoffice-commits mailing list