[Libreoffice-commits] core.git: Branch 'libreoffice-4-3-0' - sw/source

Tomaž Vajngerl tomaz.vajngerl at collabora.com
Tue Jul 15 08:38:58 PDT 2014


 sw/source/core/inc/txtfrm.hxx       |   12 ++++++++++++
 sw/source/core/text/frmpaint.cxx    |    3 ++-
 sw/source/core/text/inftxt.cxx      |   20 +++++++++++++++++++-
 sw/source/core/text/porrst.cxx      |    5 +++++
 sw/source/core/txtnode/fntcache.cxx |   25 +++++++++++++++++++++++++
 5 files changed, 63 insertions(+), 2 deletions(-)

New commits:
commit f7005e2a21d974f0b195e950a967a09b6a0d2520
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.com>
Date:   Mon Jul 14 22:43:58 2014 +0200

    fdo#79673 revert to old NPC for MacOSX only
    
    Change-Id: I83cfa2f11e76e03b919216e8dd04d1121ea6afd8
    Reviewed-on: https://gerrit.libreoffice.org/10316
    Reviewed-by: Norbert Thiebaud <nthiebaud at gmail.com>
    Reviewed-by: Tor Lillqvist <tml at collabora.com>
    Tested-by: Tor Lillqvist <tml at collabora.com>
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
    Tested-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/sw/source/core/inc/txtfrm.hxx b/sw/source/core/inc/txtfrm.hxx
index 9aaccd4..66ce49a 100644
--- a/sw/source/core/inc/txtfrm.hxx
+++ b/sw/source/core/inc/txtfrm.hxx
@@ -45,7 +45,19 @@ class SwScriptInfo;
 class SwViewOption;
 class SwWrongList;
 
+// LEGACY_NON_PRINTING_CHARACTER_COLOR_FUNCTIONALITY
+// Old handling of non printing character color - color is the same as current color
+// Because of problems drawing glyphs on correct position in OSX, this functionallity is
+// disabled on OSX. See fdo#79673 for details.
+#ifdef MACOSX
+#define LEGACY_NON_PRINTING_CHARACTER_COLOR_FUNCTIONALITY
+#else
+#undef LEGACY_NON_PRINTING_CHARACTER_COLOR_FUNCTIONALITY
+#endif
+
+#ifndef LEGACY_NON_PRINTING_CHARACTER_COLOR_FUNCTIONALITY
 #define NON_PRINTING_CHARACTER_COLOR RGB_COLORDATA( 0x6A, 0xBE, 0xD3 )
+#endif
 
 /// Represents the visualization of a paragraph.
 class SwTxtFrm: public SwCntntFrm
diff --git a/sw/source/core/text/frmpaint.cxx b/sw/source/core/text/frmpaint.cxx
index 112c148..cfc3137 100644
--- a/sw/source/core/text/frmpaint.cxx
+++ b/sw/source/core/text/frmpaint.cxx
@@ -562,8 +562,9 @@ bool SwTxtFrm::PaintEmpty( const SwRect &rRect, bool bCheck ) const
                     aDrawInf.SetFrm( this );
                     aDrawInf.SetFont( pFnt );
                     aDrawInf.SetSnapToGrid( false );
-
+                    #ifndef LEGACY_NON_PRINTING_CHARACTER_COLOR_FUNCTIONALITY
                     pFnt->SetColor(NON_PRINTING_CHARACTER_COLOR);
+                    #endif
                     pFnt->_DrawText( aDrawInf );
                 }
                 delete pClip;
diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx
index 1b133fb..39b4afe 100644
--- a/sw/source/core/text/inftxt.cxx
+++ b/sw/source/core/text/inftxt.cxx
@@ -887,6 +887,16 @@ static void lcl_DrawSpecial( const SwTxtPaintInfo& rInf, const SwLinePortion& rP
     ((SwTxtPaintInfo&)rInf).SetPos( aOldPos );
 }
 
+#ifdef LEGACY_NON_PRINTING_CHARACTER_COLOR_FUNCTIONALITY
+static void lcl_DrawSpecial( const SwTxtPaintInfo& rInf, const SwLinePortion& rPor,
+                      SwRect& rRect, sal_Unicode cChar, sal_uInt8 nOptions )
+{
+    const SwFont* pOldFnt = rInf.GetFont();
+    Color aColor = pOldFnt->GetColor();
+    lcl_DrawSpecial(rInf, rPor, rRect, aColor, cChar, nOptions);
+}
+#endif
+
 void SwTxtPaintInfo::DrawRect( const SwRect &rRect, bool bNoGraphic,
                                bool bRetouche ) const
 {
@@ -941,7 +951,11 @@ void SwTxtPaintInfo::DrawTab( const SwLinePortion &rPor ) const
         const sal_Unicode cChar = GetTxtFrm()->IsRightToLeft() ? CHAR_TAB_RTL : CHAR_TAB;
         const sal_uInt8 nOptions = DRAW_SPECIAL_OPTIONS_CENTER | DRAW_SPECIAL_OPTIONS_ROTATE;
 
-        lcl_DrawSpecial( *this, rPor, aRect, Color(0x6a, 0xbe, 0xd3), cChar, nOptions );
+        #ifdef LEGACY_NON_PRINTING_CHARACTER_COLOR_FUNCTIONALITY
+        lcl_DrawSpecial( *this, rPor, aRect, cChar, nOptions );
+        #else
+        lcl_DrawSpecial( *this, rPor, aRect, NON_PRINTING_CHARACTER_COLOR, cChar, nOptions );
+        #endif
     }
 }
 
@@ -961,7 +975,11 @@ void SwTxtPaintInfo::DrawLineBreak( const SwLinePortion &rPor ) const
                                       CHAR_LINEBREAK_RTL : CHAR_LINEBREAK;
             const sal_uInt8 nOptions = 0;
 
+            #ifdef LEGACY_NON_PRINTING_CHARACTER_COLOR_FUNCTIONALITY
+            lcl_DrawSpecial( *this, rPor, aRect, cChar, nOptions );
+            #else
             lcl_DrawSpecial( *this, rPor, aRect, Color(NON_PRINTING_CHARACTER_COLOR), cChar, nOptions );
+            #endif
         }
 
         ((SwLinePortion&)rPor).Width( nOldWidth );
diff --git a/sw/source/core/text/porrst.cxx b/sw/source/core/text/porrst.cxx
index be6676e..8aed6aa 100644
--- a/sw/source/core/text/porrst.cxx
+++ b/sw/source/core/text/porrst.cxx
@@ -61,7 +61,12 @@ void SwTmpEndPortion::Paint( const SwTxtPaintInfo &rInf ) const
 {
     if( rInf.OnWin() && rInf.GetOpt().IsParagraph() )
     {
+        #ifdef LEGACY_NON_PRINTING_CHARACTER_COLOR_FUNCTIONALITY
+        const OUString aTmp( CH_PAR );
+        rInf.DrawText( aTmp, *this );
+        #else
         rInf.DrawSpecial( *this, CH_PAR, Color(NON_PRINTING_CHARACTER_COLOR) );
+        #endif
     }
 }
 
diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx
index b4a80b7..5b507f0 100644
--- a/sw/source/core/txtnode/fntcache.cxx
+++ b/sw/source/core/txtnode/fntcache.cxx
@@ -1353,7 +1353,11 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
     {
         const OUString* pStr = &rInf.GetText();
         OUString aStr;
+
+        #ifndef LEGACY_NON_PRINTING_CHARACTER_COLOR_FUNCTIONALITY
         OUString aBulletOverlay;
+        #endif
+
         bool bBullet = rInf.GetBullet();
         if( bSymbol )
             bBullet = false;
@@ -1479,9 +1483,26 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
             aStr = rInf.GetText().copy( nCopyStart, nCopyLen );
             pStr = &aStr;
 
+            #ifdef LEGACY_NON_PRINTING_CHARACTER_COLOR_FUNCTIONALITY
+            for (sal_Int32 i = 0; i < aStr.getLength(); ++i)
+            {
+                if (CH_BLANK == aStr[i])
+                {
+                    /* fdo#72488 Hack: try to see if the space is zero width
+                     * and don't bother with inserting a bullet in this case.
+                     */
+                    if ((i + nCopyStart + 1 >= rInf.GetLen()) ||
+                        pKernArray[i + nCopyStart] != pKernArray[ i + nCopyStart + 1])
+                    {
+                        aStr = aStr.replaceAt(i, 1, OUString(CH_BULLET));
+                    }
+                }
+            }
+            #else
             aBulletOverlay = rInf.GetText().copy( nCopyStart, nCopyLen );
 
             for( sal_Int32 i = 0; i < aBulletOverlay.getLength(); ++i )
+            {
                 if( CH_BLANK == aBulletOverlay[ i ] )
                 {
                     /* fdo#72488 Hack: try to see if the space is zero width
@@ -1501,6 +1522,8 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
                 {
                     aBulletOverlay = aBulletOverlay.replaceAt(i, 1, OUString(CH_BLANK));
                 }
+            }
+            #endif
         }
 
         sal_Int32 nCnt = rInf.GetText().getLength();
@@ -1724,6 +1747,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
 
                 rInf.GetOut().DrawTextArray( aPos, *pStr, pKernArray + nOffs,
                                              nTmpIdx + nOffs , nLen - nOffs );
+                #ifndef LEGACY_NON_PRINTING_CHARACTER_COLOR_FUNCTIONALITY
                 if (bBullet)
                 {
                     rInf.GetOut().Push();
@@ -1747,6 +1771,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
                     pTmpFont->SetStrikeout(aPreviousStrikeout);
                     rInf.GetOut().Pop();
                 }
+                #endif
             }
         }
         delete[] pScrArray;


More information about the Libreoffice-commits mailing list