[Libreoffice-commits] core.git: editeng/source include/editeng sw/source

Miklos Vajna vmiklos at suse.cz
Wed Jul 10 00:42:11 PDT 2013


 editeng/source/items/frmitems.cxx            |    4 ++--
 include/editeng/brushitem.hxx                |    1 +
 sw/source/filter/ww8/docxattributeoutput.cxx |    3 +--
 3 files changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 9487b7130609c85ccd9c6ece331bb31e3be68a51
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Wed Jul 10 09:41:23 2013 +0200

    SvxBrushItem::TransparencyToPercent: add this to avoid copypaste
    
    Change-Id: I9b77c0a48b7de39eadae118c24c70ac415898293

diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx
index 8dedafd..987c888 100644
--- a/editeng/source/items/frmitems.cxx
+++ b/editeng/source/items/frmitems.cxx
@@ -3567,7 +3567,7 @@ static inline sal_Int8 lcl_PercentToTransparency(long nPercent)
     //0xff must not be returned!
     return sal_Int8(nPercent ? (50 + 0xfe * nPercent) / 100 : 0);
 }
-static inline sal_Int8 lcl_TransparencyToPercent(sal_Int32 nTrans)
+sal_Int8 SvxBrushItem::TransparencyToPercent(sal_Int32 nTrans)
 {
     return (sal_Int8)((nTrans * 100 + 127) / 254);
 }
@@ -3584,7 +3584,7 @@ bool SvxBrushItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
             rVal <<= (sal_Int32)( aColor.GetRGBColor() );
         break;
         case MID_BACK_COLOR_TRANSPARENCY:
-            rVal <<= lcl_TransparencyToPercent(aColor.GetTransparency());
+            rVal <<= SvxBrushItem::TransparencyToPercent(aColor.GetTransparency());
         break;
         case MID_GRAPHIC_POSITION:
             rVal <<= (style::GraphicLocation)(sal_Int16)eGraphicPos;
diff --git a/include/editeng/brushitem.hxx b/include/editeng/brushitem.hxx
index d18882a..d05ee3b 100644
--- a/include/editeng/brushitem.hxx
+++ b/include/editeng/brushitem.hxx
@@ -122,6 +122,7 @@ public:
 
     static SvxGraphicPosition   WallpaperStyle2GraphicPos( WallpaperStyle eStyle );
     static WallpaperStyle       GraphicPos2WallpaperStyle( SvxGraphicPosition ePos );
+    static sal_Int8             TransparencyToPercent(sal_Int32 nTrans);
 };
 
 #endif // #ifndef _SVX_BRSHITEM_HXX
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 5a0f8a0..69c3888 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -4864,8 +4864,7 @@ void DocxAttributeOutput::FormatBackground( const SvxBrushItem& rBrush )
         if (nTransparency)
         {
             // Convert transparency to percent
-            // Consider editeng/source/items/frmitems.cxx : lcl_TransparencyToPercent() function.
-            sal_Int8 nTransparencyPercent = (sal_Int8)((nTransparency * 100 + 127) / 254);
+            sal_Int8 nTransparencyPercent = SvxBrushItem::TransparencyToPercent(nTransparency);
 
             // Calculate alpha value
             // Consider oox/source/drawingml/color.cxx : getTransparency() function.


More information about the Libreoffice-commits mailing list