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

Miklos Vajna vmiklos at collabora.co.uk
Tue Oct 29 18:03:38 CET 2013


 writerfilter/source/dmapper/TablePropertiesHandler.cxx |   20 ++++++++++++++++-
 writerfilter/source/dmapper/TblStylePrHandler.cxx      |   12 ++++++++--
 2 files changed, 29 insertions(+), 3 deletions(-)

New commits:
commit c2b8170cbdac557bdd63a467be8bf4f124e74702
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue Oct 29 17:40:06 2013 +0100

    DOCX import: also read tblPr/tcPr inside tblStylePr into InteropGrabBag
    
    Change-Id: I1670e5c51d19aa17188c5707856ab61874fab6c2

diff --git a/writerfilter/source/dmapper/TablePropertiesHandler.cxx b/writerfilter/source/dmapper/TablePropertiesHandler.cxx
index e2b5c3b..255547c 100644
--- a/writerfilter/source/dmapper/TablePropertiesHandler.cxx
+++ b/writerfilter/source/dmapper/TablePropertiesHandler.cxx
@@ -133,7 +133,7 @@ namespace dmapper {
             case NS_ooxml::LN_CT_TcPrBase_vAlign://90694
             {
                 sal_Int16 nVertOrient = text::VertOrientation::NONE;
-                switch( nIntValue ) //0 - top 1 - center 3 - bottom
+                switch( nIntValue ) //0 - top 1 - center 3 - bottom (ST_VerticalJc)
                 {
                     case 1: nVertOrient = text::VertOrientation::CENTER; break;
                     case 3: nVertOrient = text::VertOrientation::BOTTOM; break;
@@ -143,6 +143,24 @@ namespace dmapper {
                 pCellPropMap->Insert( PROP_VERT_ORIENT, uno::makeAny( nVertOrient ) );
                 //todo: in ooxml import the value of m_ncell is wrong
                 cellProps( pCellPropMap );
+                if (m_pCurrentInteropGrabBag)
+                {
+                    OUString aVertOrient;
+                    switch( nIntValue )
+                    {
+                        case 0: aVertOrient = "top"; break;
+                        case 1: aVertOrient = "center"; break;
+                        case 2: aVertOrient = "both"; break;
+                        case 3: aVertOrient = "bottom"; break;
+                    };
+                    if (!aVertOrient.isEmpty())
+                    {
+                        beans::PropertyValue aValue;
+                        aValue.Name = "vAlign";
+                        aValue.Value = uno::makeAny(aVertOrient);
+                        m_pCurrentInteropGrabBag->push_back(aValue);
+                    }
+                }
             }
             break;
             case NS_ooxml::LN_CT_TblPrBase_tblBorders: //table borders, might be defined in table style
diff --git a/writerfilter/source/dmapper/TblStylePrHandler.cxx b/writerfilter/source/dmapper/TblStylePrHandler.cxx
index faedeba..194aceb 100644
--- a/writerfilter/source/dmapper/TblStylePrHandler.cxx
+++ b/writerfilter/source/dmapper/TblStylePrHandler.cxx
@@ -80,18 +80,26 @@ void TblStylePrHandler::lcl_sprm(Sprm & rSprm)
         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)
+            bool bGrabBag = rSprm.getId() == NS_ooxml::LN_CT_PPrBase ||
+                rSprm.getId() == NS_ooxml::LN_EG_RPrBase ||
+                rSprm.getId() == NS_ooxml::LN_CT_TblPrBase ||
+                rSprm.getId() == NS_ooxml::LN_CT_TcPrBase;
+            if (bGrabBag)
             {
                 aSavedGrabBag = m_aInteropGrabBag;
                 m_aInteropGrabBag.clear();
             }
             resolveSprmProps( rSprm );
-            if (rSprm.getId() == NS_ooxml::LN_CT_PPrBase || rSprm.getId() == NS_ooxml::LN_EG_RPrBase)
+            if (bGrabBag)
             {
                 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"));
+                else if (rSprm.getId() == NS_ooxml::LN_CT_TblPrBase)
+                    aSavedGrabBag.push_back(getInteropGrabBag("tblPr"));
+                else if (rSprm.getId() == NS_ooxml::LN_CT_TcPrBase)
+                    aSavedGrabBag.push_back(getInteropGrabBag("tcPr"));
                 m_aInteropGrabBag = aSavedGrabBag;
             }
         }


More information about the Libreoffice-commits mailing list