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

Miklos Vajna vmiklos at collabora.co.uk
Wed Sep 24 00:11:32 PDT 2014


 writerfilter/source/dmapper/ConversionHelper.cxx |   22 ----
 writerfilter/source/dmapper/ConversionHelper.hxx |    1 
 writerfilter/source/dmapper/DomainMapper.cxx     |  107 +++++++----------------
 3 files changed, 36 insertions(+), 94 deletions(-)

New commits:
commit 0bcd32da2efd287bbab51e335b382ec27e023644
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Wed Sep 24 09:00:34 2014 +0200

    Unused writerfilter::dmapper::ConversionHelper::MakeBorderLine() variant
    
    Change-Id: Idbf7f6b8a1ec395c229e2ff6c173b8b0a6262977

diff --git a/writerfilter/source/dmapper/ConversionHelper.cxx b/writerfilter/source/dmapper/ConversionHelper.cxx
index d2dd41e..920ec4e 100644
--- a/writerfilter/source/dmapper/ConversionHelper.cxx
+++ b/writerfilter/source/dmapper/ConversionHelper.cxx
@@ -36,28 +36,6 @@ namespace writerfilter {
 namespace dmapper{
 namespace ConversionHelper{
 
-sal_Int32 MakeBorderLine( sal_Int32 nSprmValue, table::BorderLine2& rToFill )
-{
-    //TODO: Lines are always solid
-    //Border
-    //borders are defined as:
-    // 0x XX XX XX XX
-    //    || || || ||
-    //    || || ||  ---- Line width in 1/8 pt
-    //    || || ||
-    //    || ||  ------- Line type: 0 - none 1 - single ... 25 - engrave 3D and 64 - 230 page borders
-    //    || ||
-    //    ||  ---------- Line color
-    //    ||
-    //     ------------- seven bits line space
-    //    -------------- first bit: with shading
-    sal_Int16 nLineThicknessTwip = (sal_Int16)((nSprmValue & 0xff) * 20)/8L ;
-    sal_Int32 nLineType       = ((nSprmValue & 0xff00) >> 8);
-    sal_Int32 nLineColor    = (nSprmValue & 0xff0000)>>16;
-    sal_Int32 nLineDistance = (((nSprmValue & 0x3f000000)>>24) * 2540 + 36)/72L;
-    MakeBorderLine( nLineThicknessTwip, nLineType, nLineColor, rToFill, false);
-    return nLineDistance;
-}
 void MakeBorderLine( sal_Int32 nLineThickness,   sal_Int32 nLineType,
                                             sal_Int32 nLineColor,
                                             table::BorderLine2& rToFill, bool bIsOOXML )
diff --git a/writerfilter/source/dmapper/ConversionHelper.hxx b/writerfilter/source/dmapper/ConversionHelper.hxx
index 596237c..7a49663 100644
--- a/writerfilter/source/dmapper/ConversionHelper.hxx
+++ b/writerfilter/source/dmapper/ConversionHelper.hxx
@@ -36,7 +36,6 @@ namespace dmapper{
 namespace ConversionHelper{
 
     // create a border line and return the distance value
-    sal_Int32 MakeBorderLine( sal_Int32 nSprmValue, ::com::sun::star::table::BorderLine2& rToFill );
     void MakeBorderLine( sal_Int32 nLineThickness,   sal_Int32 nLineType,
                               sal_Int32 nLineColor,
                               ::com::sun::star::table::BorderLine2& rToFill, bool bIsOOXML );
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 6d07ca6..2fe97d9 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -1219,83 +1219,48 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext )
     case NS_ooxml::LN_CT_PBdr_bottom:
     case NS_ooxml::LN_CT_PBdr_right:
     case NS_ooxml::LN_CT_PBdr_between:
+    {
+        writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
+        if( pProperties.get())
         {
-            //in binary format the borders are directly provided in OOXML they are inside of properties
-            if( IsOOXMLImport() || IsRTFImport() )
+            BorderHandlerPtr pBorderHandler( new BorderHandler( true ) );
+            pProperties->resolve(*pBorderHandler);
+            PropertyIds eBorderId = PropertyIds( 0 );
+            PropertyIds eBorderDistId = PropertyIds( 0 );
+            switch( nSprmId )
             {
-                writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
-                if( pProperties.get())
-                {
-                    BorderHandlerPtr pBorderHandler( new BorderHandler( true ) );
-                    pProperties->resolve(*pBorderHandler);
-                    PropertyIds eBorderId = PropertyIds( 0 );
-                    PropertyIds eBorderDistId = PropertyIds( 0 );
-                    switch( nSprmId )
-                    {
-                        case NS_ooxml::LN_CT_PBdr_top:
-                            eBorderId = PROP_TOP_BORDER;
-                            eBorderDistId = PROP_TOP_BORDER_DISTANCE;
-                        break;
-                        case NS_ooxml::LN_CT_PBdr_left:
-                            eBorderId = PROP_LEFT_BORDER;
-                            eBorderDistId = PROP_LEFT_BORDER_DISTANCE;
-                        break;
-                        case NS_ooxml::LN_CT_PBdr_bottom:
-                            eBorderId = PROP_BOTTOM_BORDER         ;
-                            eBorderDistId = PROP_BOTTOM_BORDER_DISTANCE;
-                        break;
-                        case NS_ooxml::LN_CT_PBdr_right:
-                            eBorderId = PROP_RIGHT_BORDER;
-                            eBorderDistId = PROP_RIGHT_BORDER_DISTANCE ;
-                        break;
-                        case NS_ooxml::LN_CT_PBdr_between:
-                            //not supported
-                        break;
-                        default:;
-                    }
-                    if( eBorderId )
-                        rContext->Insert( eBorderId, uno::makeAny( pBorderHandler->getBorderLine()) , true);
-                    if(eBorderDistId)
-                        rContext->Insert(eBorderDistId, uno::makeAny( pBorderHandler->getLineDistance()), true);
-                    if (nSprmId == NS_ooxml::LN_CT_PBdr_right && pBorderHandler->getShadow())
-                    {
-                        table::ShadowFormat aFormat = writerfilter::dmapper::PropertyMap::getShadowFromBorder(pBorderHandler->getBorderLine());
-                        rContext->Insert(PROP_PARA_SHADOW_FORMAT, uno::makeAny(aFormat));
-                    }
-                }
+            case NS_ooxml::LN_CT_PBdr_top:
+                eBorderId = PROP_TOP_BORDER;
+                eBorderDistId = PROP_TOP_BORDER_DISTANCE;
+                break;
+            case NS_ooxml::LN_CT_PBdr_left:
+                eBorderId = PROP_LEFT_BORDER;
+                eBorderDistId = PROP_LEFT_BORDER_DISTANCE;
+                break;
+            case NS_ooxml::LN_CT_PBdr_bottom:
+                eBorderId = PROP_BOTTOM_BORDER         ;
+                eBorderDistId = PROP_BOTTOM_BORDER_DISTANCE;
+                break;
+            case NS_ooxml::LN_CT_PBdr_right:
+                eBorderId = PROP_RIGHT_BORDER;
+                eBorderDistId = PROP_RIGHT_BORDER_DISTANCE ;
+                break;
+            case NS_ooxml::LN_CT_PBdr_between:
+                //not supported
+                break;
+            default:;
             }
-            else
+            if( eBorderId )
+                rContext->Insert( eBorderId, uno::makeAny( pBorderHandler->getBorderLine()) , true);
+            if(eBorderDistId)
+                rContext->Insert(eBorderDistId, uno::makeAny( pBorderHandler->getLineDistance()), true);
+            if (nSprmId == NS_ooxml::LN_CT_PBdr_right && pBorderHandler->getShadow())
             {
-                table::BorderLine2 aBorderLine;
-                sal_Int32 nLineDistance = ConversionHelper::MakeBorderLine( nIntValue, aBorderLine );
-                PropertyIds eBorderId = PROP_LEFT_BORDER;
-                PropertyIds eBorderDistId = PROP_LEFT_BORDER_DISTANCE  ;
-                switch( nSprmId )
-                {
-                case NS_ooxml::LN_CT_PBdr_between:
-                    OSL_FAIL( "TODO: inner border is not handled");
-                    break;
-                case NS_ooxml::LN_CT_PBdr_left:
-                    eBorderId = PROP_LEFT_BORDER;
-                    eBorderDistId = PROP_LEFT_BORDER_DISTANCE  ;
-                    break;
-                case NS_ooxml::LN_CT_PBdr_right:
-                    eBorderId = PROP_RIGHT_BORDER          ;
-                    eBorderDistId = PROP_RIGHT_BORDER_DISTANCE ;
-                    break;
-                case NS_ooxml::LN_CT_PBdr_top:
-                    eBorderId = PROP_TOP_BORDER            ;
-                    eBorderDistId = PROP_TOP_BORDER_DISTANCE;
-                    break;
-                case NS_ooxml::LN_CT_PBdr_bottom:
-                default:
-                    eBorderId = PROP_BOTTOM_BORDER         ;
-                    eBorderDistId = PROP_BOTTOM_BORDER_DISTANCE;
-                }
-                rContext->Insert(eBorderId, uno::makeAny( aBorderLine ));
-                rContext->Insert(eBorderDistId, uno::makeAny( nLineDistance ));
+                table::ShadowFormat aFormat = writerfilter::dmapper::PropertyMap::getShadowFromBorder(pBorderHandler->getBorderLine());
+                rContext->Insert(PROP_PARA_SHADOW_FORMAT, uno::makeAny(aFormat));
             }
         }
+    }
     break;
     case NS_ooxml::LN_CT_PBdr_bar:
         break;


More information about the Libreoffice-commits mailing list