[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-4.2' - 5 commits - oox/source sw/source

Luboš Luňák l.lunak at collabora.com
Mon Sep 29 12:25:26 PDT 2014


 oox/source/token/properties.txt              |    1 
 oox/source/vml/vmlshape.cxx                  |   27 ++++
 sw/source/filter/ww8/docxattributeoutput.cxx |  170 +++++++++++++--------------
 3 files changed, 114 insertions(+), 84 deletions(-)

New commits:
commit 1eb1ac5c26278c312fba9ade1b1ddc2cbe433312
Author: Luboš Luňák <l.lunak at collabora.com>
Date:   Mon Sep 29 18:53:44 2014 +0200

    map FRAME to VML's text
    
    Again, that's what this file does elsewhere, that's what (incomplete) import
    did before my changes, and it seems to match better the position that such
    an element gets in Word.
    
    Change-Id: Id09150eaaa505e6ddcd4baaf4a833000d52dd71d

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 71c6692..e2496e8 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -5795,9 +5795,9 @@ void DocxAttributeOutput::FormatVertOrientation( const SwFmtVertOrient& rFlyVert
         case text::RelOrientation::CHAR:
         case text::RelOrientation::PRINT_AREA:
         case text::RelOrientation::TEXT_LINE:
+        case text::RelOrientation::FRAME:
             sVAnchor = OString( "text" );
             break;
-        case text::RelOrientation::FRAME:
         case text::RelOrientation::PAGE_LEFT:
         case text::RelOrientation::PAGE_RIGHT:
         case text::RelOrientation::FRAME_LEFT:
@@ -5854,9 +5854,9 @@ void DocxAttributeOutput::FormatHorizOrientation( const SwFmtHoriOrient& rFlyHor
     {
         case text::RelOrientation::CHAR:
         case text::RelOrientation::PRINT_AREA:
+        case text::RelOrientation::FRAME:
             sHAnchor = OString( "text" );
             break;
-        case text::RelOrientation::FRAME:
         case text::RelOrientation::PAGE_LEFT:
         case text::RelOrientation::PAGE_RIGHT:
         case text::RelOrientation::FRAME_LEFT:
commit 37b200891f51ea2888b216747622e643a9fcd170
Author: Luboš Luňák <l.lunak at collabora.com>
Date:   Mon Sep 29 18:30:44 2014 +0200

    map PAGE_PRINT_AREA to VML's margin
    
    That's what the code does elsewhere in this file, and also import does it.
    
    Change-Id: I30e608f86a9cae66eed48dbb2e719b1455327ae3

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index c1c4515..71c6692 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -5802,10 +5802,10 @@ void DocxAttributeOutput::FormatVertOrientation( const SwFmtVertOrient& rFlyVert
         case text::RelOrientation::PAGE_RIGHT:
         case text::RelOrientation::FRAME_LEFT:
         case text::RelOrientation::FRAME_RIGHT:
+        case text::RelOrientation::PAGE_PRINT_AREA:
             sVAnchor = OString( "margin" );
             break;
         case text::RelOrientation::PAGE_FRAME:
-        case text::RelOrientation::PAGE_PRINT_AREA:
         default:
             break;
     }
@@ -5861,10 +5861,10 @@ void DocxAttributeOutput::FormatHorizOrientation( const SwFmtHoriOrient& rFlyHor
         case text::RelOrientation::PAGE_RIGHT:
         case text::RelOrientation::FRAME_LEFT:
         case text::RelOrientation::FRAME_RIGHT:
+        case text::RelOrientation::PAGE_PRINT_AREA:
             sHAnchor = OString( "margin" );
             break;
         case text::RelOrientation::PAGE_FRAME:
-        case text::RelOrientation::PAGE_PRINT_AREA:
         default:
             break;
     }
commit 1e89fec35c23889d3f2886b434211a803251799e
Author: Luboš Luňák <l.lunak at collabora.com>
Date:   Sun Sep 28 21:31:08 2014 +0200

    proper reading of mso-position-(horizontal|vertical)(-relative)
    
    Change-Id: I50f537c697f6e73c1fd150f3f03fc65b85ccbeaf

diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt
index 50571cb..0703ede 100644
--- a/oox/source/token/properties.txt
+++ b/oox/source/token/properties.txt
@@ -332,6 +332,7 @@ OutputPosition
 OverlapSequence
 PageScale
 PageStyle
+PageToggle
 PageViewZoomValue
 PaintTransparent
 ParaAdjust
diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index 7879315..5dd0e51 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -454,12 +454,38 @@ void lcl_SetAnchorType(PropertySet& rPropSet, const ShapeTypeModel& rTypeModel)
 {
     if ( rTypeModel.maPositionHorizontal == "center" )
         rPropSet.setAnyProperty(PROP_HoriOrient, makeAny(text::HoriOrientation::CENTER));
+    else if ( rTypeModel.maPositionHorizontal == "left" )
+        rPropSet.setAnyProperty(PROP_HoriOrient, makeAny(text::HoriOrientation::LEFT));
+    else if ( rTypeModel.maPositionHorizontal == "right" )
+        rPropSet.setAnyProperty(PROP_HoriOrient, makeAny(text::HoriOrientation::RIGHT));
+    else if ( rTypeModel.maPositionHorizontal == "inside" )
+    {
+        rPropSet.setAnyProperty(PROP_HoriOrient, makeAny(text::HoriOrientation::LEFT));
+        rPropSet.setAnyProperty(PROP_PageToggle, makeAny(sal_True));
+    }
+    else if ( rTypeModel.maPositionHorizontal == "outside" )
+    {
+        rPropSet.setAnyProperty(PROP_HoriOrient, makeAny(text::HoriOrientation::RIGHT));
+        rPropSet.setAnyProperty(PROP_PageToggle, makeAny(sal_True));
+    }
 
     if ( rTypeModel.maPositionHorizontalRelative == "page" )
         rPropSet.setAnyProperty(PROP_HoriOrientRelation, makeAny(text::RelOrientation::PAGE_FRAME));
+    else if ( rTypeModel.maPositionVerticalRelative == "margin" )
+        rPropSet.setProperty(PROP_VertOrientRelation, text::RelOrientation::PAGE_PRINT_AREA);
+    else if ( rTypeModel.maPositionVerticalRelative == "text" )
+        rPropSet.setProperty(PROP_VertOrientRelation, text::RelOrientation::FRAME);
 
     if ( rTypeModel.maPositionVertical == "center" )
         rPropSet.setAnyProperty(PROP_VertOrient, makeAny(text::VertOrientation::CENTER));
+    else if ( rTypeModel.maPositionVertical == "top" )
+        rPropSet.setAnyProperty(PROP_VertOrient, makeAny(text::VertOrientation::TOP));
+    else if ( rTypeModel.maPositionVertical == "bottom" )
+        rPropSet.setAnyProperty(PROP_VertOrient, makeAny(text::VertOrientation::BOTTOM));
+    else if ( rTypeModel.maPositionVertical == "inside" )
+        rPropSet.setAnyProperty(PROP_VertOrient, makeAny(text::VertOrientation::LINE_TOP));
+    else if ( rTypeModel.maPositionVertical == "outside" )
+        rPropSet.setAnyProperty(PROP_VertOrient, makeAny(text::VertOrientation::LINE_BOTTOM));
 
     if ( rTypeModel.maPosition == "absolute" )
     {
@@ -476,7 +502,6 @@ void lcl_SetAnchorType(PropertySet& rPropSet, const ShapeTypeModel& rTypeModel)
         }
         else
         {
-            // Vertical placement relative to margin, because parent style must not modify vertical position
             rPropSet.setProperty(PROP_VertOrientRelation, text::RelOrientation::FRAME);
         }
     }
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index d6ccd00..c1c4515 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -5776,13 +5776,17 @@ void DocxAttributeOutput::FormatVertOrientation( const SwFmtVertOrient& rFlyVert
             sAlign = OString( "center" );
             break;
         case text::VertOrientation::BOTTOM:
-        case text::VertOrientation::LINE_BOTTOM:
             sAlign = OString( "bottom" );
             break;
+        case text::VertOrientation::LINE_BOTTOM:
+            sAlign = OString( "outside" );
+            break;
         case text::VertOrientation::TOP:
+            sAlign = OString( "top" );
+            break;
         case text::VertOrientation::LINE_TOP:
         default:
-            sAlign = OString( "top" );
+            sAlign = OString( "inside" );
             break;
     }
     OString sVAnchor( "page" );
commit 06b25783a6f6fbf5e3756c9bf3f5712ce8285f68
Author: Luboš Luňák <l.lunak at collabora.com>
Date:   Sun Sep 28 21:14:02 2014 +0200

    export in .docx also vml mso-position-(horizontal|vertical)(-relative)
    
    Change-Id: I65321bb6244e0e37ef673d726b698c3708711d53

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 291181e..d6ccd00 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -5766,121 +5766,121 @@ void DocxAttributeOutput::FormatSurround( const SwFmtSurround& rSurround )
 
 void DocxAttributeOutput::FormatVertOrientation( const SwFmtVertOrient& rFlyVert )
 {
+    OString sAlign;
+    switch( rFlyVert.GetVertOrient() )
+    {
+        case text::VertOrientation::NONE:
+            break;
+        case text::VertOrientation::CENTER:
+        case text::VertOrientation::LINE_CENTER:
+            sAlign = OString( "center" );
+            break;
+        case text::VertOrientation::BOTTOM:
+        case text::VertOrientation::LINE_BOTTOM:
+            sAlign = OString( "bottom" );
+            break;
+        case text::VertOrientation::TOP:
+        case text::VertOrientation::LINE_TOP:
+        default:
+            sAlign = OString( "top" );
+            break;
+    }
+    OString sVAnchor( "page" );
+    switch ( rFlyVert.GetRelationOrient( ) )
+    {
+        case text::RelOrientation::CHAR:
+        case text::RelOrientation::PRINT_AREA:
+        case text::RelOrientation::TEXT_LINE:
+            sVAnchor = OString( "text" );
+            break;
+        case text::RelOrientation::FRAME:
+        case text::RelOrientation::PAGE_LEFT:
+        case text::RelOrientation::PAGE_RIGHT:
+        case text::RelOrientation::FRAME_LEFT:
+        case text::RelOrientation::FRAME_RIGHT:
+            sVAnchor = OString( "margin" );
+            break;
+        case text::RelOrientation::PAGE_FRAME:
+        case text::RelOrientation::PAGE_PRINT_AREA:
+        default:
+            break;
+    }
+
     if (m_bTextFrameSyntax)
     {
         m_aTextFrameStyle.append(";margin-top:").append(double(rFlyVert.GetPos()) / 20).append("pt");
+        if ( !sAlign.isEmpty() )
+            m_aTextFrameStyle.append(";mso-position-vertical:").append(sAlign);
+        m_aTextFrameStyle.append(";mso-position-vertical-relative:").append(sVAnchor);
     }
     else if ( m_rExport.bOutFlyFrmAttrs )
     {
         if ( !m_pFlyAttrList )
             m_pFlyAttrList = m_pSerializer->createAttrList();
-
-        OString sAlign;
-        switch( rFlyVert.GetVertOrient() )
-        {
-            case text::VertOrientation::NONE:
-                break;
-            case text::VertOrientation::CENTER:
-            case text::VertOrientation::LINE_CENTER:
-                sAlign = OString( "center" );
-                break;
-            case text::VertOrientation::BOTTOM:
-            case text::VertOrientation::LINE_BOTTOM:
-                sAlign = OString( "bottom" );
-                break;
-            case text::VertOrientation::TOP:
-            case text::VertOrientation::LINE_TOP:
-            default:
-                sAlign = OString( "top" );
-                break;
-        }
-
         if ( !sAlign.isEmpty() )
             m_pFlyAttrList->add( FSNS( XML_w, XML_yAlign ), sAlign );
         else
             m_pFlyAttrList->add( FSNS( XML_w, XML_y ),
                 OString::number( rFlyVert.GetPos() ) );
-
-        OString sVAnchor( "page" );
-        switch ( rFlyVert.GetRelationOrient( ) )
-        {
-            case text::RelOrientation::CHAR:
-            case text::RelOrientation::PRINT_AREA:
-            case text::RelOrientation::TEXT_LINE:
-                sVAnchor = OString( "text" );
-                break;
-            case text::RelOrientation::FRAME:
-            case text::RelOrientation::PAGE_LEFT:
-            case text::RelOrientation::PAGE_RIGHT:
-            case text::RelOrientation::FRAME_LEFT:
-            case text::RelOrientation::FRAME_RIGHT:
-                sVAnchor = OString( "margin" );
-                break;
-            case text::RelOrientation::PAGE_FRAME:
-            case text::RelOrientation::PAGE_PRINT_AREA:
-            default:
-                break;
-        }
-
         m_pFlyAttrList->add( FSNS( XML_w, XML_vAnchor ), sVAnchor );
     }
 }
 
 void DocxAttributeOutput::FormatHorizOrientation( const SwFmtHoriOrient& rFlyHori )
 {
+    OString sAlign;
+    switch( rFlyHori.GetHoriOrient() )
+    {
+        case text::HoriOrientation::NONE:
+            break;
+        case text::HoriOrientation::LEFT:
+            sAlign = OString( rFlyHori.IsPosToggle( ) ? "inside" : "left" );
+            break;
+        case text::HoriOrientation::RIGHT:
+            sAlign = OString( rFlyHori.IsPosToggle( ) ? "outside" : "right" );
+            break;
+        case text::HoriOrientation::CENTER:
+        case text::HoriOrientation::FULL: // FULL only for tables
+        default:
+            sAlign = OString( "center" );
+            break;
+    }
+    OString sHAnchor( "page" );
+    switch ( rFlyHori.GetRelationOrient( ) )
+    {
+        case text::RelOrientation::CHAR:
+        case text::RelOrientation::PRINT_AREA:
+            sHAnchor = OString( "text" );
+            break;
+        case text::RelOrientation::FRAME:
+        case text::RelOrientation::PAGE_LEFT:
+        case text::RelOrientation::PAGE_RIGHT:
+        case text::RelOrientation::FRAME_LEFT:
+        case text::RelOrientation::FRAME_RIGHT:
+            sHAnchor = OString( "margin" );
+            break;
+        case text::RelOrientation::PAGE_FRAME:
+        case text::RelOrientation::PAGE_PRINT_AREA:
+        default:
+            break;
+    }
+
     if (m_bTextFrameSyntax)
     {
         m_aTextFrameStyle.append(";margin-left:").append(double(rFlyHori.GetPos()) / 20).append("pt");
+        if ( !sAlign.isEmpty() )
+            m_aTextFrameStyle.append(";mso-position-horizontal:").append(sAlign);
+        m_aTextFrameStyle.append(";mso-position-horizontal-relative:").append(sHAnchor);
     }
     else if ( m_rExport.bOutFlyFrmAttrs )
     {
         if ( !m_pFlyAttrList )
             m_pFlyAttrList = m_pSerializer->createAttrList();
-
-        OString sAlign;
-        switch( rFlyHori.GetHoriOrient() )
-        {
-            case text::HoriOrientation::NONE:
-                break;
-            case text::HoriOrientation::LEFT:
-                sAlign = OString( rFlyHori.IsPosToggle( ) ? "inside" : "left" );
-                break;
-            case text::HoriOrientation::RIGHT:
-                sAlign = OString( rFlyHori.IsPosToggle( ) ? "outside" : "right" );
-                break;
-            case text::HoriOrientation::CENTER:
-            case text::HoriOrientation::FULL: // FULL only for tables
-            default:
-                sAlign = OString( "center" );
-                break;
-        }
-
         if ( !sAlign.isEmpty() )
             m_pFlyAttrList->add( FSNS( XML_w, XML_xAlign ), sAlign );
         else
             m_pFlyAttrList->add( FSNS( XML_w, XML_x ),
                 OString::number( rFlyHori.GetPos() ) );
-
-        OString sHAnchor( "page" );
-        switch ( rFlyHori.GetRelationOrient( ) )
-        {
-            case text::RelOrientation::CHAR:
-            case text::RelOrientation::PRINT_AREA:
-                sHAnchor = OString( "text" );
-                break;
-            case text::RelOrientation::FRAME:
-            case text::RelOrientation::PAGE_LEFT:
-            case text::RelOrientation::PAGE_RIGHT:
-            case text::RelOrientation::FRAME_LEFT:
-            case text::RelOrientation::FRAME_RIGHT:
-                sHAnchor = OString( "margin" );
-                break;
-            case text::RelOrientation::PAGE_FRAME:
-            case text::RelOrientation::PAGE_PRINT_AREA:
-            default:
-                break;
-        }
-
         m_pFlyAttrList->add( FSNS( XML_w, XML_hAnchor ), sHAnchor );
     }
 }
commit 6fed727ddef7051977211f6ef7fd63b46f7e7c3c
Author: Luboš Luňák <l.lunak at collabora.com>
Date:   Sat Sep 27 16:59:48 2014 +0200

    docx ST_VAnchor does not know "column", it should be "text"
    
    Change-Id: I3a5ab08e349c5c071373cda2f62e3cea593e263c

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 1d9479a..291181e 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -5807,7 +5807,7 @@ void DocxAttributeOutput::FormatVertOrientation( const SwFmtVertOrient& rFlyVert
             case text::RelOrientation::CHAR:
             case text::RelOrientation::PRINT_AREA:
             case text::RelOrientation::TEXT_LINE:
-                sVAnchor = OString( "column" );
+                sVAnchor = OString( "text" );
                 break;
             case text::RelOrientation::FRAME:
             case text::RelOrientation::PAGE_LEFT:


More information about the Libreoffice-commits mailing list