[Libreoffice-commits] .: Branch 'libreoffice-3-5' - 4 commits - sw/source writerfilter/source

Cédric Bosdonnat cbosdo at kemper.freedesktop.org
Tue Mar 20 04:16:11 PDT 2012


 sw/source/core/layout/paintfrm.cxx             |   44 ++++++++++++++++++-------
 writerfilter/source/dmapper/BorderHandler.cxx  |    2 -
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |   18 ++++------
 3 files changed, 42 insertions(+), 22 deletions(-)

New commits:
commit c7524ab32f801910673da5c9c68669ada7c98769
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Mar 16 15:35:49 2012 +0100

    fdo#42750: delay painting borders until after subsidiary lines
    
    With commit 0f0896c26fb260d1bbf31d7a886df3f61837f0f2, borders are drawn
    immediately, but then the subsidiary lines are drawn over the borders,
    hiding 1 twip wide borders completely.
    
    Signed-off-by: Cédric Bosdonnat <cedric.bosdonnat.ooo at free.fr>

diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index 4de8650..3a93e47 100755
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -119,6 +119,7 @@
 #include <drawinglayer/primitive2d/textlayoutdevice.hxx>
 #include <svx/sdr/contact/objectcontacttools.hxx>
 #include <svx/unoapi.hxx>
+#include <comphelper/sequenceasvector.hxx>
 #include <basegfx/matrix/b2dhommatrix.hxx>
 #include <basegfx/matrix/b2dhommatrixtools.hxx>
 #include <basegfx/polygon/b2dpolygon.hxx>
@@ -220,6 +221,22 @@ public:
     inline void Ins( const SwRect &rRect, const sal_uInt8 nSCol );
 };
 
+class BorderLines
+{
+    ::comphelper::SequenceAsVector<
+         ::drawinglayer::primitive2d::Primitive2DReference> m_Lines;
+public:
+    void AddBorderLine(
+            ::drawinglayer::primitive2d::Primitive2DReference const& xLine)
+    {
+        m_Lines.push_back(xLine);
+    }
+    drawinglayer::primitive2d::Primitive2DSequence GetBorderLines() const
+    {
+        return m_Lines.getAsConstList();
+    }
+};
+
 //----------------- End of classes for border lines ----------------------
 
 static ViewShell *pGlobalShell = 0;
@@ -253,6 +270,7 @@ static double aEdgeScale = 0.5;
 // be compared with pLines before the work in order to avoid help lines
 // to hide borders.
 // bTablines is sal_True during the Paint of a table.
+static BorderLines *g_pBorderLines = 0;
 static SwLineRects *pLines = 0;
 static SwSubsRects *pSubsLines = 0;
 // global variable for sub-lines of body, header, footer, section and footnote frames.
@@ -335,6 +353,7 @@ class SwSavePaintStatics
     SwFlyFrm           *pSRetoucheFly,
                        *pSRetoucheFly2,
                        *pSFlyOnlyDraw;
+    BorderLines        *pBLines;
     SwLineRects        *pSLines;
     SwSubsRects        *pSSubsLines;
     SwSubsRects*        pSSpecSubsLines;
@@ -360,6 +379,7 @@ SwSavePaintStatics::SwSavePaintStatics() :
     pSRetoucheFly       ( pRetoucheFly      ),
     pSRetoucheFly2      ( pRetoucheFly2     ),
     pSFlyOnlyDraw       ( pFlyOnlyDraw      ),
+    pBLines             ( g_pBorderLines    ),
     pSLines             ( pLines            ),
     pSSubsLines         ( pSubsLines        ),
     pSSpecSubsLines     ( pSpecSubsLines    ),
@@ -384,6 +404,7 @@ SwSavePaintStatics::SwSavePaintStatics() :
     aScaleX = aScaleY = 1.0;
     aMinDistScale = 0.73;
     aEdgeScale = 0.5;
+    g_pBorderLines = 0;
     pLines = 0;
     pSubsLines = 0;
     pSpecSubsLines = 0L;
@@ -398,6 +419,7 @@ SwSavePaintStatics::~SwSavePaintStatics()
     pRetoucheFly       = pSRetoucheFly;
     pRetoucheFly2      = pSRetoucheFly2;
     pFlyOnlyDraw       = pSFlyOnlyDraw;
+    g_pBorderLines     = pBLines;
     pLines             = pSLines;
     pSubsLines         = pSSubsLines;
     pSpecSubsLines     = pSSpecSubsLines;
@@ -2888,6 +2910,7 @@ SwRootFrm::Paint(SwRect const& rRect, SwPrintData const*const pPrintData) const
                     pSubsLines = new SwSubsRects;
                     pSpecSubsLines = new SwSubsRects;
                 }
+                g_pBorderLines = new BorderLines;
 
                 aPaintRect._Intersection( aRect );
 
@@ -3001,6 +3024,9 @@ SwRootFrm::Paint(SwRect const& rRect, SwPrintData const*const pPrintData) const
                     DELETEZ( pSubsLines );
                     DELETEZ( pSpecSubsLines );
                 }
+                // fdo#42750: delay painting these until after subsidiary lines
+                ProcessPrimitives(g_pBorderLines->GetBorderLines());
+                DELETEZ(g_pBorderLines);
                 pVout->Leave();
 
                 // #i68597#
@@ -4509,11 +4535,8 @@ void lcl_PaintLeftRightLine( const sal_Bool         _bLeft,
         ::lcl_SubTopBottom( aRect, rBox, _rAttrs, _rFrm, _rRectFn, bPrtOutputDev );
     }
 
-    // TODO Postpone the processing of the primitives
     if ( lcl_GetLineWidth( pLeftRightBorder ) > 0 )
     {
-        drawinglayer::primitive2d::Primitive2DSequence aSequence( 1 );
-
         double nExtentIS = lcl_GetExtent( pTopBorder, NULL );
         double nExtentIE = lcl_GetExtent( pBottomBorder, NULL );
         double nExtentOS = lcl_GetExtent( NULL, pTopBorder );
@@ -4535,21 +4558,22 @@ void lcl_PaintLeftRightLine( const sal_Bool         _bLeft,
         Color aLeftColor = _bLeft ? pLeftRightBorder->GetColorOut( _bLeft ) : pLeftRightBorder->GetColorIn( _bLeft );
         Color aRightColor = _bLeft ? pLeftRightBorder->GetColorIn( _bLeft ) : pLeftRightBorder->GetColorOut( _bLeft );
 
-        aSequence[0] = new drawinglayer::primitive2d::BorderLinePrimitive2D(
+        drawinglayer::primitive2d::Primitive2DReference xLine =
+            new drawinglayer::primitive2d::BorderLinePrimitive2D(
                 aStart, aEnd, nLeftWidth, pLeftRightBorder->GetDistance(), nRightWidth,
                 nExtentIS, nExtentIE, nExtentOS, nExtentOE,
                 aLeftColor.getBColor(), aRightColor.getBColor(),
                 pLeftRightBorder->GetColorGap().getBColor(),
                 pLeftRightBorder->HasGapColor(), pLeftRightBorder->GetStyle( ) );
 
-        _rFrm.ProcessPrimitives( aSequence );
+        g_pBorderLines->AddBorderLine(xLine);
     }
 }
 
 // OD 19.05.2003 #109667# - merge <lcl_PaintTopLine> and <lcl_PaintBottomLine>
 // into <lcl_PaintTopLine>
 void lcl_PaintTopBottomLine( const sal_Bool         _bTop,
-                             const SwFrm&           _rFrm,
+                             const SwFrm&           ,
                              const SwPageFrm&       /*_rPage*/,
                              const SwRect&          _rOutRect,
                              const SwRect&          /*_rRect*/,
@@ -4586,11 +4610,8 @@ void lcl_PaintTopBottomLine( const sal_Bool         _bTop,
                                      (aRect.*_rRectFn->fnGetHeight)() );
     }
 
-    // TODO Postpone the processing of the primitives
     if ( lcl_GetLineWidth( pTopBottomBorder ) > 0 )
     {
-        drawinglayer::primitive2d::Primitive2DSequence aSequence( 1 );
-
         double nExtentIS = lcl_GetExtent( pRightBorder, NULL );
         double nExtentIE = lcl_GetExtent( pLeftBorder, NULL );
         double nExtentOS = lcl_GetExtent( NULL, pRightBorder );
@@ -4612,14 +4633,15 @@ void lcl_PaintTopBottomLine( const sal_Bool         _bTop,
         Color aLeftColor = _bTop ? pTopBottomBorder->GetColorOut( _bTop ) : pTopBottomBorder->GetColorIn( _bTop );
         Color aRightColor = _bTop ? pTopBottomBorder->GetColorIn( _bTop ) : pTopBottomBorder->GetColorOut( _bTop );
 
-        aSequence[0] = new drawinglayer::primitive2d::BorderLinePrimitive2D(
+        drawinglayer::primitive2d::Primitive2DReference xLine =
+            new drawinglayer::primitive2d::BorderLinePrimitive2D(
                 aStart, aEnd, nLeftWidth, pTopBottomBorder->GetDistance(), nRightWidth,
                 nExtentIS, nExtentIE, nExtentOS, nExtentOE,
                 aLeftColor.getBColor(), aRightColor.getBColor(),
                 pTopBottomBorder->GetColorGap().getBColor(),
                 pTopBottomBorder->HasGapColor(), pTopBottomBorder->GetStyle( ) );
 
-        _rFrm.ProcessPrimitives( aSequence );
+        g_pBorderLines->AddBorderLine(xLine);
     }
 }
 
commit edc6079bbf61717de040bd8f473dba79ac22f24b
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Fri Mar 16 13:49:00 2012 +0100

    fdo#43965 fix RTF import of \up and \dn with custom parameters
    
    Signed-off-by: Cédric Bosdonnat <cedric.bosdonnat.ooo at free.fr>

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 4299e5a..241e05d 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -2258,18 +2258,11 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
                 m_aStates.top().aCharacterSprms->push_back(make_pair(0x6877, pValue));
             }
             break;
-        case RTF_UP: // TODO handle when point size is not shrinking
-            {
-                OUString aValue(RTL_CONSTASCII_USTRINGPARAM("superscript"));
-                RTFValue::Pointer_t pValue(new RTFValue(aValue));
-                m_aStates.top().aCharacterSprms->push_back(make_pair(NS_ooxml::LN_EG_RPrBase_vertAlign, pValue));
-            }
-            break;
+        case RTF_UP:
         case RTF_DN:
             {
-                OUString aValue(RTL_CONSTASCII_USTRINGPARAM("subscript"));
-                RTFValue::Pointer_t pValue(new RTFValue(aValue));
-                m_aStates.top().aCharacterSprms->push_back(make_pair(NS_ooxml::LN_EG_RPrBase_vertAlign, pValue));
+                RTFValue::Pointer_t pValue(new RTFValue(nParam * (nKeyword == RTF_UP ? 1 : -1)));
+                m_aStates.top().aCharacterSprms->push_back(make_pair(NS_sprm::LN_CHpsPos, pValue));
             }
             break;
         case RTF_HORZVERT:
commit b9aa086f71ef8940104c477664c1192bbd85e063
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Fri Mar 16 13:36:16 2012 +0100

    fdo#43965 dmapper: fix line width default
    
    Writer's default is 0, but Word's default is 26 (15 in 1/8 pt)
    
    Signed-off-by: Cédric Bosdonnat <cedric.bosdonnat.ooo at free.fr>

diff --git a/writerfilter/source/dmapper/BorderHandler.cxx b/writerfilter/source/dmapper/BorderHandler.cxx
index 90e8456..f4858f5 100644
--- a/writerfilter/source/dmapper/BorderHandler.cxx
+++ b/writerfilter/source/dmapper/BorderHandler.cxx
@@ -44,7 +44,7 @@ using namespace ::com::sun::star;
 BorderHandler::BorderHandler( bool bOOXML ) :
 LoggedProperties(dmapper_logger, "BorderHandler"),
 m_nCurrentBorderPosition( BORDER_TOP ),
-m_nLineWidth(0),
+m_nLineWidth(26), // Word default
 m_nLineType(0),
 m_nLineColor(0),
 m_nLineDistance(0),
commit 0361e92cb000371e6e3463a853b375bdeec984f5
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Wed Feb 29 16:14:34 2012 +0100

    Related: fdo#46662 fix RTF import of leveltext destination
    
    After leveltext is imported, the levelnumbers group modifies the
    contents of the previous group, but this modification was lost when the
    stack was popped.
    
    Signed-off-by: Cédric Bosdonnat <cedric.bosdonnat.ooo at free.fr>

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 824615d..4299e5a 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -2891,6 +2891,7 @@ int RTFDocumentImpl::popState()
     bool bListLevelEnd = false;
     bool bListOverrideEntryEnd = false;
     bool bLevelTextEnd = false;
+    bool bLevelNumbersEnd = false;
     RTFShape aShape;
     RTFPicture aPicture;
     bool bPopShapeProperties = false;
@@ -3031,6 +3032,8 @@ int RTFDocumentImpl::popState()
                 aBuf.append(aOrig.copy(i, 1));
         }
         pValue->setString(aBuf.makeStringAndClear());
+        aSprms = m_aStates.top().aTableSprms;
+        bLevelNumbersEnd = true;
     }
     else if (m_aStates.top().nDestinationState == DESTINATION_SHAPEPROPERTYNAME
             || m_aStates.top().nDestinationState == DESTINATION_SHAPEPROPERTYVALUE
@@ -3307,6 +3310,8 @@ int RTFDocumentImpl::popState()
         RTFValue::Pointer_t pValue(new RTFValue(aAttributes));
         m_aStates.top().aTableSprms->push_back(make_pair(NS_ooxml::LN_CT_Lvl_lvlText, pValue));
     }
+    else if (bLevelNumbersEnd)
+        m_aStates.top().aTableSprms = aSprms;
     else if (bPopShapeProperties)
     {
         m_aStates.top().aShape = aShape;


More information about the Libreoffice-commits mailing list