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

Miklos Vajna vmiklos at collabora.co.uk
Mon Nov 25 08:32:56 PST 2013


 sw/qa/extras/ooxmlexport/ooxmlexport.cxx                 |   10 +++++++---
 writerfilter/source/dmapper/DomainMapperTableHandler.cxx |    8 ++++++++
 writerfilter/source/dmapper/DomainMapperTableManager.cxx |    7 +++++++
 writerfilter/source/dmapper/PropertyIds.cxx              |    1 +
 writerfilter/source/dmapper/PropertyIds.hxx              |    1 +
 5 files changed, 24 insertions(+), 3 deletions(-)

New commits:
commit 74bf915fb48c660bd1e3a04bec6c3a20c754b6af
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon Nov 25 16:59:56 2013 +0100

    DOCX import: tblHeader implies firstRow
    
    If a table row is marked as tblHeader, then the firstRow section of the
    table style should be applied, even if that row is in fact not the first
    row.
    
    Change-Id: I10605f404160e72c620e9204503203fea1c6d6d8

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 42f250c..5a3a554 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -1395,6 +1395,9 @@ DECLARE_OOXMLEXPORT_TEST(testCalendar2, "calendar2.docx")
     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"));
+    // Font size in the second row was 11.
+    xCell.set(xTable->getCellByName("A2"), uno::UNO_QUERY);
+    CPPUNIT_ASSERT_EQUAL(16.f, getProperty<float>(getRun(getParagraphOfText(1, xCell->getText()), 1), "CharHeight"));
 
     // This paragraph property was missing in table style.
     xmlDocPtr pXmlStyles = parseExport("word/styles.xml");
diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
index a8e51b0..1a9ad2d 100644
--- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
@@ -562,6 +562,7 @@ CellPropertyValuesSeq_t DomainMapperTableHandler::endTableGetCellProperties(Tabl
 
     //it's a uno::Sequence< beans::PropertyValues >*
     RowPropertyValuesSeq_t* pCellProperties = aCellProperties.getArray();
+    PropertyMapVector1::const_iterator aRowIter = m_aRowProperties.begin();
     while( aRowOfCellsIterator != aRowOfCellsIteratorEnd )
     {
         //aRowOfCellsIterator points to a vector of PropertyMapPtr
@@ -580,6 +581,8 @@ CellPropertyValuesSeq_t DomainMapperTableHandler::endTableGetCellProperties(Tabl
             if(rInfo.nTblLook&0x40)
                 nRowStyleMask |= CNF_LAST_ROW;      // last row style used
         }
+        else if (aRowIter->get() && aRowIter->get()->find(PROP_TBL_HEADER) != aRowIter->get()->end())
+            nRowStyleMask |= CNF_FIRST_ROW; // table header implies first row
         if(!nRowStyleMask)                          // if no row style used yet
         {
             // banding used only if not first and or last row style used
@@ -729,6 +732,7 @@ CellPropertyValuesSeq_t DomainMapperTableHandler::endTableGetCellProperties(Tabl
 #endif
         ++nRow;
         ++aRowOfCellsIterator;
+        ++aRowIter;
     }
 
 #ifdef DEBUG_DMAPPER_TABLE_HANDLER
@@ -758,6 +762,10 @@ RowPropertyValuesSeq_t DomainMapperTableHandler::endTableGetRowProperties()
             //set default to 'break across pages"
             if( aRowIter->get()->find(PROP_IS_SPLIT_ALLOWED) == aRowIter->get()->end())
                 aRowIter->get()->Insert( PROP_IS_SPLIT_ALLOWED, uno::makeAny(sal_True ) );
+            // tblHeader is only our property, remove before the property map hits UNO
+            PropertyMap::const_iterator aIter = aRowIter->get()->find(PROP_TBL_HEADER);
+            if (aIter != aRowIter->get()->end())
+                aRowIter->get()->erase(aIter);
 
             aRowProperties[nRow] = (*aRowIter)->GetPropertyValues();
 #ifdef DEBUG_DMAPPER_TABLE_HANDLER
diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
index ac75e07..7db941d 100644
--- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
@@ -201,6 +201,13 @@ bool DomainMapperTableManager::sprm(Sprm & rSprm)
                 }
                 else
                     m_nHeaderRepeat = -1;
+                if (nIntValue)
+                {
+                    // Store the info that this is a header, we'll need that when we apply table styles.
+                    TablePropertyMapPtr pPropMap( new TablePropertyMap );
+                    pPropMap->Insert( PROP_TBL_HEADER, uno::makeAny(nIntValue));
+                    insertRowProps(pPropMap);
+                }
             break;
             case 0xd608: // TDefTable
             {
diff --git a/writerfilter/source/dmapper/PropertyIds.cxx b/writerfilter/source/dmapper/PropertyIds.cxx
index b284855..4b05efa 100644
--- a/writerfilter/source/dmapper/PropertyIds.cxx
+++ b/writerfilter/source/dmapper/PropertyIds.cxx
@@ -344,6 +344,7 @@ const OUString& PropertyNameSupplier::GetName( PropertyIds eId ) const
             case PROP_SURROUND_TEXT_WRAP_SMALL: sName = "SurroundTextWrapSmall"; break;
             case PROP_PARA_SHADOW_FORMAT: sName = "ParaShadowFormat"; break;
             case PROP_FOOTNOTE_LINE_RELATIVE_WIDTH: sName = "FootnoteLineRelativeWidth"; break;
+            case PROP_TBL_HEADER: sName = "TblHeader"; break;
         }
         ::std::pair<PropertyNameMap_t::iterator,bool> aInsertIt =
                 m_pImpl->aNameMap.insert( PropertyNameMap_t::value_type( eId, sName ));
diff --git a/writerfilter/source/dmapper/PropertyIds.hxx b/writerfilter/source/dmapper/PropertyIds.hxx
index ee5045d..0de35ce 100644
--- a/writerfilter/source/dmapper/PropertyIds.hxx
+++ b/writerfilter/source/dmapper/PropertyIds.hxx
@@ -315,6 +315,7 @@ enum PropertyIds
         ,PROP_FOOTNOTE_LINE_RELATIVE_WIDTH
         ,PROP_PARA_TOP_MARGIN_BEFORE_AUTO_SPACING
         ,PROP_PARA_BOTTOM_MARGIN_AFTER_AUTO_SPACING
+        ,PROP_TBL_HEADER
     };
 struct PropertyNameSupplier_Impl;
 class PropertyNameSupplier
commit 1581b1fc3ac82a7bd62df968226e98604a4ca52d
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon Nov 25 17:24:39 2013 +0100

    CppunitTest_sw_ooxmlexport: make it possible to use ..._TEST_ONLY with -Werror
    
    Change-Id: I451f81495a8e8535c8e0194198602ee5732164c6

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 78b1256..42f250c 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -166,12 +166,13 @@ OUString Test::getXPath(xmlDocPtr pXmlDoc, const OString& rXPath, const OString&
     return OUString::createFromAscii((const char*)xmlGetProp(pXmlNode, BAD_CAST(rAttribute.getStr())));
 }
 
+#if 1
 #define DECLARE_OOXMLEXPORT_TEST(TestName, filename) DECLARE_SW_ROUNDTRIP_TEST(TestName, filename, Test)
 
 // For testing during development of a tast, you want to use
-// DECLARE_OOXMLEXPORT_TEST_ONLY, and change the below to #if 1
-// Of course, don't forget to set back to #if 0 when you are done :-)
-#if 0
+// DECLARE_OOXMLEXPORT_TEST_ONLY, and change the above to #if 0
+// Of course, don't forget to set back to #if 1 when you are done :-)
+#else
 #define DECLARE_OOXMLEXPORT_TEST_ONLY(TestName, filename) DECLARE_SW_ROUNDTRIP_TEST(TestName, filename, Test)
 
 #undef DECLARE_OOXMLEXPORT_TEST


More information about the Libreoffice-commits mailing list