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

Miklos Vajna vmiklos at collabora.co.uk
Wed Aug 6 06:21:12 PDT 2014


 writerfilter/source/dmapper/DomainMapper.cxx |   12 ++++++++++++
 writerfilter/source/dmapper/PropertyIds.cxx  |    1 +
 writerfilter/source/dmapper/PropertyIds.hxx  |    1 +
 writerfilter/source/dmapper/PropertyMap.cxx  |   22 +++++++++++++++++++++-
 writerfilter/source/dmapper/PropertyMap.hxx  |    1 +
 5 files changed, 36 insertions(+), 1 deletion(-)

New commits:
commit 3c01c88adc359102cb45f46e848bdb1ae652f573
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Wed Aug 6 15:12:42 2014 +0200

    DOCX import: handle <w:cnfStyle> row property
    
    Change-Id: I178cb5591c95cc5587ac56662abf808bfca7a336

diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 7864dd9..40c3afa 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -2504,6 +2504,18 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext )
         }
     }
     break;
+    case NS_ooxml::LN_CT_TrPrBase_cnfStyle:
+    {
+        m_pImpl->enableInteropGrabBag("cnfStyle");
+        resourcemodel::resolveSprmProps(*this, rSprm);
+
+        TablePropertyMapPtr pPropMap(new TablePropertyMap());
+        pPropMap->Insert(PROP_ROW_CNF_STYLE, uno::makeAny(uno::makeAny(m_pImpl->m_aInteropGrabBag.getAsConstList())), true, ROW_GRAB_BAG);
+        m_pImpl->getTableManager().insertRowProps(pPropMap);
+
+        m_pImpl->disableInteropGrabBag();
+    }
+    break;
     case NS_ooxml::LN_CT_TcPrBase_cnfStyle:
     {
         m_pImpl->enableInteropGrabBag("cnfStyle");
diff --git a/writerfilter/source/dmapper/PropertyIds.cxx b/writerfilter/source/dmapper/PropertyIds.cxx
index c12e97a..e95eaec 100644
--- a/writerfilter/source/dmapper/PropertyIds.cxx
+++ b/writerfilter/source/dmapper/PropertyIds.cxx
@@ -398,6 +398,7 @@ OUString PropertyNameSupplier::GetName( PropertyIds eId ) const
             case META_PROP_TABLE_LOOK: sName = "TableStyleLook"; break;
             case PROP_PARA_CNF_STYLE: sName = "ParaCnfStyle"; break;
             case PROP_CELL_CNF_STYLE: sName = "CellCnfStyle"; break;
+            case PROP_ROW_CNF_STYLE: sName = "RowCnfStyle"; 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 0ff6ee3..f9d65da 100644
--- a/writerfilter/source/dmapper/PropertyIds.hxx
+++ b/writerfilter/source/dmapper/PropertyIds.hxx
@@ -370,6 +370,7 @@ enum PropertyIds
         ,META_PROP_TABLE_LOOK
         ,PROP_PARA_CNF_STYLE
         ,PROP_CELL_CNF_STYLE
+        ,PROP_ROW_CNF_STYLE
     };
 struct PropertyNameSupplier_Impl;
 class PropertyNameSupplier
diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx
index 62c5ba6..e36dc1c 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -68,6 +68,7 @@ uno::Sequence< beans::PropertyValue > PropertyMap::GetPropertyValues(bool bCharG
         size_t nParaGrabBag = 0;
         size_t nCellGrabBag = 0;
         size_t nCellGrabBagSaved = 0; // How many entries do we save from the returned sequence.
+        size_t nRowGrabBag = 0;
         for (MapIterator i = m_vMap.begin(); i != m_vMap.end(); ++i)
         {
             if ( i->second.getGrabBagType() == CHAR_GRAB_BAG )
@@ -86,6 +87,8 @@ uno::Sequence< beans::PropertyValue > PropertyMap::GetPropertyValues(bool bCharG
                 nCellGrabBag += aSeq.getLength();
                 nCellGrabBagSaved++;
             }
+            else if ( i->second.getGrabBagType() == ROW_GRAB_BAG )
+                nRowGrabBag++;
         }
 
         // In case there are properties to be grab-bagged and we can have a char grab-bag, allocate one slot for it.
@@ -94,21 +97,26 @@ uno::Sequence< beans::PropertyValue > PropertyMap::GetPropertyValues(bool bCharG
             nCharGrabBagSize = nCharGrabBag ? 1 : 0;
         size_t nParaGrabBagSize = nParaGrabBag ? 1 : 0;
         size_t nCellGrabBagSize = nCellGrabBag ? 1 : 0;
+        size_t nRowGrabBagSize = nRowGrabBag ? 1 : 0;
 
         // If there are any grab bag properties, we need one slot for them.
         m_aValues.realloc( m_vMap.size() - nCharGrabBag + nCharGrabBagSize
                                   - nParaGrabBag + nParaGrabBagSize
-                                  - nCellGrabBagSaved + nCellGrabBagSize);
+                                  - nCellGrabBagSaved + nCellGrabBagSize
+                                  - nRowGrabBag + nRowGrabBagSize);
         ::com::sun::star::beans::PropertyValue* pValues = m_aValues.getArray();
         uno::Sequence<beans::PropertyValue> aCharGrabBagValues(nCharGrabBag);
         uno::Sequence<beans::PropertyValue> aParaGrabBagValues(nParaGrabBag);
         uno::Sequence<beans::PropertyValue> aCellGrabBagValues(nCellGrabBag);
+        uno::Sequence<beans::PropertyValue> aRowGrabBagValues(nRowGrabBag);
         beans::PropertyValue* pCharGrabBagValues = aCharGrabBagValues.getArray();
         beans::PropertyValue* pParaGrabBagValues = aParaGrabBagValues.getArray();
         beans::PropertyValue* pCellGrabBagValues = aCellGrabBagValues.getArray();
+        beans::PropertyValue* pRowGrabBagValues = aRowGrabBagValues.getArray();
         //style names have to be the first elements within the property sequence
         //otherwise they will overwrite 'hard' attributes
         sal_Int32 nValue = 0;
+        sal_Int32 nRowGrabBagValue = 0;
         sal_Int32 nCellGrabBagValue = 0;
         sal_Int32 nParaGrabBagValue = 0;
         sal_Int32 nCharGrabBagValue = 0;
@@ -161,6 +169,12 @@ uno::Sequence< beans::PropertyValue > PropertyMap::GetPropertyValues(bool bCharG
                     pCellGrabBagValues[nCellGrabBagValue].Value = aMapIter->second.getValue();
                     ++nCellGrabBagValue;
                 }
+                else if ( aMapIter->second.getGrabBagType() == ROW_GRAB_BAG )
+                {
+                    pRowGrabBagValues[nRowGrabBagValue].Name = rPropNameSupplier.GetName( aMapIter->first );
+                    pRowGrabBagValues[nRowGrabBagValue].Value = aMapIter->second.getValue();
+                    ++nRowGrabBagValue;
+                }
                 else
                 {
                     if (aMapIter->first == PROP_CELL_INTEROP_GRAB_BAG)
@@ -200,6 +214,12 @@ uno::Sequence< beans::PropertyValue > PropertyMap::GetPropertyValues(bool bCharG
             pValues[nValue].Value = uno::makeAny(aCellGrabBagValues);
             ++nValue;
         }
+        if (nRowGrabBag)
+        {
+            pValues[nValue].Name = "RowInteropGrabBag";
+            pValues[nValue].Value = uno::makeAny(aRowGrabBagValues);
+            ++nValue;
+        }
     }
     return m_aValues;
 }
diff --git a/writerfilter/source/dmapper/PropertyMap.hxx b/writerfilter/source/dmapper/PropertyMap.hxx
index 53f306e..4c1d2e2 100644
--- a/writerfilter/source/dmapper/PropertyMap.hxx
+++ b/writerfilter/source/dmapper/PropertyMap.hxx
@@ -68,6 +68,7 @@ enum BorderPosition
 enum GrabBagType
 {
     NO_GRAB_BAG,
+    ROW_GRAB_BAG,
     CELL_GRAB_BAG,
     PARA_GRAB_BAG,
     CHAR_GRAB_BAG


More information about the Libreoffice-commits mailing list