[Libreoffice-commits] .: Branch 'libreoffice-3-5' - chart2/source

Thorsten Behrens thorsten at kemper.freedesktop.org
Fri Mar 16 08:01:43 PDT 2012


 chart2/source/view/main/VLegendSymbolFactory.cxx |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

New commits:
commit 4ce99d42806e87378614207c8d5adf38d43c756c
Author: Katarina Machalkova <bubli at bubli.org>
Date:   Mon Feb 20 22:20:12 2012 +0100

    fdo#31551: Show actual line width in the legend
    
    however, limit the line width from above by legend entry height
    (which +- matches the font height)
    
    Signed-off-by: Thorsten Behrens <tbehrens at suse.com>

diff --git a/chart2/source/view/main/VLegendSymbolFactory.cxx b/chart2/source/view/main/VLegendSymbolFactory.cxx
index 31b2cbc..79db3c1 100644
--- a/chart2/source/view/main/VLegendSymbolFactory.cxx
+++ b/chart2/source/view/main/VLegendSymbolFactory.cxx
@@ -44,7 +44,8 @@ namespace
 void lcl_setPropetiesToShape(
     const Reference< beans::XPropertySet > & xProp,
     const Reference< drawing::XShape > & xShape,
-    ::chart::VLegendSymbolFactory::tPropertyType ePropertyType )
+    ::chart::VLegendSymbolFactory::tPropertyType ePropertyType,
+    const awt::Size& aMaxSymbolExtent = awt::Size(0,0))
 {
     const ::chart::tPropertyNameMap & aFilledSeriesNameMap( ::chart::PropertyMapper::getPropertyNameMapForFilledSeriesProperties());
     const ::chart::tPropertyNameMap & aLineSeriesNameMap( ::chart::PropertyMapper::getPropertyNameMapForLineSeriesProperties());
@@ -83,7 +84,8 @@ void lcl_setPropetiesToShape(
         sal_Int32 nLineWidth = 0;
         if( pLineWidthAny && (*pLineWidthAny>>=nLineWidth) )
         {
-            const sal_Int32 nMaxLineWidthForLegend = 50;/*1/100 mm*///todo: make this dependent from legend entry height
+            // use legend entry height as upper limit for line width
+            sal_Int32 nMaxLineWidthForLegend = aMaxSymbolExtent.Height;
             if( nLineWidth>nMaxLineWidthForLegend )
                 *pLineWidthAny = uno::makeAny( nMaxLineWidthForLegend );
         }
@@ -134,7 +136,7 @@ Reference< drawing::XShape > VLegendSymbolFactory::createSymbol(
                 xLine->setSize(  awt::Size( rEntryKeyAspectRatio.Width, 0 ));
                 xLine->setPosition( awt::Point( 0, rEntryKeyAspectRatio.Height/2 ));
 
-                lcl_setPropetiesToShape( xLegendEntryProperties, xLine, ePropertyType );
+                lcl_setPropetiesToShape( xLegendEntryProperties, xLine, ePropertyType, rEntryKeyAspectRatio );
             }
 
             Reference< drawing::XShape > xSymbol;


More information about the Libreoffice-commits mailing list