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

Miklos Vajna vmiklos at collabora.co.uk
Tue Oct 29 17:34:41 CET 2013


 writerfilter/source/dmapper/DomainMapper.cxx      |   13 +++++++++++++
 writerfilter/source/dmapper/StyleSheetTable.cxx   |    2 ++
 writerfilter/source/dmapper/TblStylePrHandler.cxx |   21 +++++++++++++++++++++
 3 files changed, 36 insertions(+)

New commits:
commit 97e9eda0cec15e4d8e8d86010b98f303cbf4fd02
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue Oct 29 16:40:51 2013 +0100

    DOCX import: read tblStylePr into InteropGrabBag
    
    Change-Id: I0217b76c8e2447c9053611f7d187251bf76c58e4

diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 75fbe65..1139671 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -58,6 +58,7 @@
 #include <com/sun/star/text/XFootnote.hpp>
 #include <comphelper/types.hxx>
 #include <comphelper/storagehelper.hxx>
+#include <filter/msfilter/util.hxx>
 
 #include <CellColorHandler.hxx>
 #include <SectionColumnHandler.hxx>
@@ -914,6 +915,7 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
         case NS_ooxml::LN_CT_Color_val:
             if (m_pImpl->GetTopContext())
                 m_pImpl->GetTopContext()->Insert(PROP_CHAR_COLOR, uno::makeAny( nIntValue ) );
+            m_pImpl->appendGrabBag(m_pImpl->m_aSubInteropGrabBag, "val", OStringToOUString(msfilter::util::ConvertColor(nIntValue), RTL_TEXTENCODING_UTF8));
             break;
         case NS_ooxml::LN_CT_Underline_color:
             if (m_pImpl->GetTopContext())
@@ -2152,6 +2154,8 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType
                         uno::Reference<beans::XPropertySet> xCharStyle(m_pImpl->GetCurrentNumberingCharStyle());
                         if (xCharStyle.is())
                             xCharStyle->setPropertyValue(rPropNameSupplier.GetName(PROP_CHAR_WEIGHT), aBold);
+                        if (nSprmId == NS_sprm::LN_CFBold)
+                            m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "b", OUString::number(nIntValue));
                     }
                     break;
                     case 61: /*sprmCFItalic*/
@@ -2162,6 +2166,8 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType
                         rContext->Insert( ePropertyId, aPosture );
                         if( nSprmId != NS_sprm::LN_CFItalicBi ) // sprmCFItalicBi
                             rContext->Insert(PROP_CHAR_POSTURE_ASIAN, aPosture );
+                        if (nSprmId == NS_sprm::LN_CFItalic)
+                            m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "i", OUString::number(nIntValue));
                     }
                     break;
                     case NS_sprm::LN_CFStrike: /*sprmCFStrike*/
@@ -2239,6 +2245,8 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType
             // Make sure char sizes defined in the stylesheets don't affect char props from direct formatting.
             if (!m_pImpl->IsStyleSheetImport())
                 m_pImpl->deferCharacterProperty( nSprmId, uno::makeAny( nIntValue ));
+            if (nSprmId == NS_sprm::LN_CHps)
+                m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "sz", OUString::number(nIntValue));
         }
         break;
     case NS_sprm::LN_CHpsInc:
@@ -3005,6 +3013,11 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType
             m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "rFonts", m_pImpl->m_aSubInteropGrabBag);
         else if (nSprmId == NS_ooxml::LN_EG_RPrBase_lang)
             m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "lang", m_pImpl->m_aSubInteropGrabBag);
+        else if (nSprmId == NS_ooxml::LN_EG_RPrBase_color)
+            m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "color", m_pImpl->m_aSubInteropGrabBag);
+    break;
+    case NS_ooxml::LN_CT_PPrBase_wordWrap:
+        m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "wordWrap", "");
     break;
     case NS_ooxml::LN_EG_SectPrContents_footnotePr:
     case NS_ooxml::LN_EG_SectPrContents_endnotePr:
diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx
index 45adc73..4506b69 100644
--- a/writerfilter/source/dmapper/StyleSheetTable.cxx
+++ b/writerfilter/source/dmapper/StyleSheetTable.cxx
@@ -663,6 +663,8 @@ void StyleSheetTable::lcl_sprm(Sprm & rSprm)
                 {
                     pTableEntry->AppendInteropGrabBag(pTblStylePrHandler->getInteropGrabBag("tblPr"));
                 }
+                else if (nSprmId == NS_ooxml::LN_CT_Style_tblStylePr)
+                    pTableEntry->AppendInteropGrabBag(pTblStylePrHandler->getInteropGrabBag("tblStylePr"));
             }
             break;
         }
diff --git a/writerfilter/source/dmapper/TblStylePrHandler.cxx b/writerfilter/source/dmapper/TblStylePrHandler.cxx
index 7884cbc..faedeba 100644
--- a/writerfilter/source/dmapper/TblStylePrHandler.cxx
+++ b/writerfilter/source/dmapper/TblStylePrHandler.cxx
@@ -78,7 +78,23 @@ void TblStylePrHandler::lcl_sprm(Sprm & rSprm)
         case NS_ooxml::LN_CT_TblPrBase:
         case NS_ooxml::LN_CT_TrPrBase:
         case NS_ooxml::LN_CT_TcPrBase:
+        {
+            std::vector<beans::PropertyValue> aSavedGrabBag;
+            if (rSprm.getId() == NS_ooxml::LN_CT_PPrBase || rSprm.getId() == NS_ooxml::LN_EG_RPrBase)
+            {
+                aSavedGrabBag = m_aInteropGrabBag;
+                m_aInteropGrabBag.clear();
+            }
             resolveSprmProps( rSprm );
+            if (rSprm.getId() == NS_ooxml::LN_CT_PPrBase || rSprm.getId() == NS_ooxml::LN_EG_RPrBase)
+            {
+                if (rSprm.getId() == NS_ooxml::LN_CT_PPrBase)
+                    aSavedGrabBag.push_back(getInteropGrabBag("pPr"));
+                else if (rSprm.getId() == NS_ooxml::LN_EG_RPrBase)
+                    aSavedGrabBag.push_back(getInteropGrabBag("rPr"));
+                m_aInteropGrabBag = aSavedGrabBag;
+            }
+        }
             break;
         default:
             // Tables specific properties have to handled here
@@ -90,7 +106,12 @@ void TblStylePrHandler::lcl_sprm(Sprm & rSprm)
             {
                 // The DomainMapper can handle some of the properties
                 m_rDMapper.PushStyleSheetProperties( m_pProperties, true );
+                // Just pass a non-empty string, the array will have a single element anyway.
+                m_rDMapper.enableInteropGrabBag("TblStylePrHandler");
                 m_rDMapper.sprm( rSprm );
+                uno::Sequence<beans::PropertyValue> aGrabBag = m_rDMapper.getInteropGrabBag().Value.get< uno::Sequence<beans::PropertyValue> >();
+                if (aGrabBag.hasElements())
+                    m_aInteropGrabBag.push_back(aGrabBag[0]);
                 m_rDMapper.PopStyleSheetProperties( true );
             }
     }


More information about the Libreoffice-commits mailing list