[Libreoffice-commits] core.git: 2 commits - oox/source

Luboš Luňák l.lunak at suse.cz
Tue May 14 10:48:58 PDT 2013


 oox/source/core/binarycodec.cxx                     |    2 +-
 oox/source/drawingml/chart/objectformatter.cxx      |    2 +-
 oox/source/drawingml/color.cxx                      |    4 ++--
 oox/source/drawingml/fillpropertiesgroupcontext.cxx |    2 +-
 oox/source/helper/propertymap.cxx                   |    2 +-
 oox/source/helper/textinputstream.cxx               |    2 +-
 oox/source/ole/olehelper.cxx                        |   10 +++++-----
 oox/source/ole/vbacontrol.cxx                       |    2 +-
 oox/source/ole/vbahelper.cxx                        |    4 ++--
 oox/source/vml/vmlformatting.cxx                    |   14 +++++++-------
 oox/source/vml/vmlshape.cxx                         |   15 +++++++++++++--
 oox/source/vml/vmlshapecontext.cxx                  |    2 +-
 12 files changed, 36 insertions(+), 25 deletions(-)

New commits:
commit bc584fc5d8b06034f7acf229035483daf78a186e
Author: Luboš Luňák <l.lunak at suse.cz>
Date:   Tue May 14 19:46:43 2013 +0200

    detect whether a bezier shape is open or closed
    
    For open shapes e.g. fill does not work. Part of bnc#780044.
    
    Change-Id: Id0ce50e94ae86c0398f06b2a67e3fd13d487ae7a

diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index 0af325d..2aa3bac 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -692,8 +692,8 @@ BezierShape::BezierShape(Drawing& rDrawing)
 
 Reference< XShape > BezierShape::implConvertAndInsert( const Reference< XShapes >& rxShapes, const awt::Rectangle& rShapeRect ) const
 {
-    Reference< XShape > xShape = SimpleShape::implConvertAndInsert( rxShapes, rShapeRect );
     awt::Rectangle aCoordSys = getCoordSystem();
+    PolyPolygonBezierCoords aBezierCoords;
 
     if( (aCoordSys.Width > 0) && (aCoordSys.Height > 0) )
     {
@@ -747,7 +747,6 @@ Reference< XShape > BezierShape::implConvertAndInsert( const Reference< XShapes
                 }
         }
 
-        PolyPolygonBezierCoords aBezierCoords;
         aBezierCoords.Coordinates.realloc( aCoordLists.size() );
         for ( unsigned int i = 0; i < aCoordLists.size(); i++ )
             aBezierCoords.Coordinates[i] = ContainerHelper::vectorToSequence( aCoordLists[i] );
@@ -756,6 +755,18 @@ Reference< XShape > BezierShape::implConvertAndInsert( const Reference< XShapes
         for ( unsigned int i = 0; i < aFlagLists.size(); i++ )
             aBezierCoords.Flags[i] = ContainerHelper::vectorToSequence( aFlagLists[i] );
 
+        if( aCoordLists.front().front().X == aCoordLists.back().back().X
+            && aCoordLists.front().front().Y == aCoordLists.back().back().Y )
+        { // HACK: If the shape is in fact closed, which can be found out only when the path is known,
+          // force to closed bezier shape (otherwise e.g. fill won't work).
+            const_cast< BezierShape* >( this )->setService( "com.sun.star.drawing.ClosedBezierShape" );
+        }
+    }
+
+    Reference< XShape > xShape = SimpleShape::implConvertAndInsert( rxShapes, rShapeRect );
+
+    if( aBezierCoords.Coordinates.hasElements())
+    {
         PropertySet aPropSet( xShape );
         aPropSet.setProperty( PROP_PolyPolygonBezier, aBezierCoords );
     }
commit c2703b63fa8d16ce8efaa55e0431ae829fdd23c1
Author: Luboš Luňák <l.lunak at suse.cz>
Date:   Thu May 9 17:30:54 2013 +0200

    remove non-sensical /*static*/ comments
    
    They are presumably meant to say the functions are class-static,
    but at the function definition it's pretty confusing (looks like file-static).
    
    Change-Id: I28c69244c9eb7aa3f20f07d8784f3704dc6a57bf

diff --git a/oox/source/core/binarycodec.cxx b/oox/source/core/binarycodec.cxx
index 04ef753..f4d6b16 100644
--- a/oox/source/core/binarycodec.cxx
+++ b/oox/source/core/binarycodec.cxx
@@ -108,7 +108,7 @@ sal_uInt16 lclGetHash( const sal_uInt8* pnPassData, sal_Int32 nBufferSize )
 
 // ============================================================================
 
-/*static*/ sal_uInt16 CodecHelper::getPasswordHash( const AttributeList& rAttribs, sal_Int32 nElement )
+sal_uInt16 CodecHelper::getPasswordHash( const AttributeList& rAttribs, sal_Int32 nElement )
 {
     sal_Int32 nPasswordHash = rAttribs.getIntegerHex( nElement, 0 );
     OSL_ENSURE( (0 <= nPasswordHash) && (nPasswordHash <= SAL_MAX_UINT16), "CodecHelper::getPasswordHash - invalid password hash" );
diff --git a/oox/source/drawingml/chart/objectformatter.cxx b/oox/source/drawingml/chart/objectformatter.cxx
index c2eabfe..29cc07b 100644
--- a/oox/source/drawingml/chart/objectformatter.cxx
+++ b/oox/source/drawingml/chart/objectformatter.cxx
@@ -1132,7 +1132,7 @@ void ObjectFormatter::convertAutomaticFill( PropertySet& rPropSet, ObjectType eO
         pFormat->convertAutomaticFill( rPropSet, nSeriesIdx );
 }
 
-/*static*/ bool ObjectFormatter::isAutomaticFill( const ModelRef< Shape >& rxShapeProp )
+bool ObjectFormatter::isAutomaticFill( const ModelRef< Shape >& rxShapeProp )
 {
     return !rxShapeProp || !rxShapeProp->getFillProperties().moFillType.has();
 }
diff --git a/oox/source/drawingml/color.cxx b/oox/source/drawingml/color.cxx
index 89adca9..50a7e64 100644
--- a/oox/source/drawingml/color.cxx
+++ b/oox/source/drawingml/color.cxx
@@ -217,7 +217,7 @@ Color::~Color()
 {
 }
 
-/*static*/ sal_Int32 Color::getDmlPresetColor( sal_Int32 nToken, sal_Int32 nDefaultRgb )
+sal_Int32 Color::getDmlPresetColor( sal_Int32 nToken, sal_Int32 nDefaultRgb )
 {
     /*  Do not pass nDefaultRgb to ContainerHelper::getVectorElement(), to be
         able to catch the existing vector entries without corresponding XML
@@ -226,7 +226,7 @@ Color::~Color()
     return (nRgbValue >= 0) ? nRgbValue : nDefaultRgb;
 }
 
-/*static*/ sal_Int32 Color::getVmlPresetColor( sal_Int32 nToken, sal_Int32 nDefaultRgb )
+sal_Int32 Color::getVmlPresetColor( sal_Int32 nToken, sal_Int32 nDefaultRgb )
 {
     /*  Do not pass nDefaultRgb to ContainerHelper::getVectorElement(), to be
         able to catch the existing vector entries without corresponding XML
diff --git a/oox/source/drawingml/fillpropertiesgroupcontext.cxx b/oox/source/drawingml/fillpropertiesgroupcontext.cxx
index 7e004eb..4a07693 100644
--- a/oox/source/drawingml/fillpropertiesgroupcontext.cxx
+++ b/oox/source/drawingml/fillpropertiesgroupcontext.cxx
@@ -272,7 +272,7 @@ Reference< XFastContextHandler > FillPropertiesContext::createFastChildContext(
     return createFillContext( *this, nElement, rxAttribs, mrFillProps );
 }
 
-/*static*/ Reference< XFastContextHandler > FillPropertiesContext::createFillContext(
+Reference< XFastContextHandler > FillPropertiesContext::createFillContext(
         ContextHandler& rParent, sal_Int32 nElement,
         const Reference< XFastAttributeList >& rxAttribs, FillProperties& rFillProps )
 {
diff --git a/oox/source/helper/propertymap.cxx b/oox/source/helper/propertymap.cxx
index af3e0b4..2351082 100644
--- a/oox/source/helper/propertymap.cxx
+++ b/oox/source/helper/propertymap.cxx
@@ -203,7 +203,7 @@ PropertyMap::PropertyMap() :
 {
 }
 
-/*static*/ const OUString& PropertyMap::getPropertyName( sal_Int32 nPropId )
+const OUString& PropertyMap::getPropertyName( sal_Int32 nPropId )
 {
     OSL_ENSURE( (0 <= nPropId) && (nPropId < PROP_COUNT), "PropertyMap::getPropertyName - invalid property identifier" );
     return StaticPropertyNameVector::get()[ nPropId ];
diff --git a/oox/source/helper/textinputstream.cxx b/oox/source/helper/textinputstream.cxx
index 7bc5b5ac..92c0a2d 100644
--- a/oox/source/helper/textinputstream.cxx
+++ b/oox/source/helper/textinputstream.cxx
@@ -184,7 +184,7 @@ OUString TextInputStream::readToChar( sal_Unicode cChar, bool bIncludeChar )
     return OUString();
 }
 
-/*static*/ Reference< XTextInputStream2 > TextInputStream::createXTextInputStream(
+Reference< XTextInputStream2 > TextInputStream::createXTextInputStream(
         const Reference< XComponentContext >& rxContext, const Reference< XInputStream >& rxInStrm, rtl_TextEncoding eTextEnc )
 {
     Reference< XTextInputStream2 > xTextStrm;
diff --git a/oox/source/ole/olehelper.cxx b/oox/source/ole/olehelper.cxx
index 6ab01af..e87f2cd 100644
--- a/oox/source/ole/olehelper.cxx
+++ b/oox/source/ole/olehelper.cxx
@@ -247,7 +247,7 @@ StdFontInfo::StdFontInfo( const OUString& rName, sal_uInt32 nHeight,
 
 // ============================================================================
 
-/*static*/ sal_Int32 OleHelper::decodeOleColor(
+sal_Int32 OleHelper::decodeOleColor(
         const GraphicHelper& rGraphicHelper, sal_uInt32 nOleColor, bool bDefaultColorBgr )
 {
     static const sal_Int32 spnSystemColors[] =
@@ -279,12 +279,12 @@ StdFontInfo::StdFontInfo( const OUString& rName, sal_uInt32 nHeight,
     return API_RGB_BLACK;
 }
 
-/*static*/ sal_uInt32 OleHelper::encodeOleColor( sal_Int32 nRgbColor )
+sal_uInt32 OleHelper::encodeOleColor( sal_Int32 nRgbColor )
 {
     return OLE_COLORTYPE_BGR | lclSwapRedBlue( static_cast< sal_uInt32 >( nRgbColor & 0xFFFFFF ) );
 }
 
-/*static*/ OUString OleHelper::importGuid( BinaryInputStream& rInStrm )
+OUString OleHelper::importGuid( BinaryInputStream& rInStrm )
 {
     OUStringBuffer aBuffer;
     aBuffer.append( sal_Unicode( '{' ) );
@@ -303,7 +303,7 @@ StdFontInfo::StdFontInfo( const OUString& rName, sal_uInt32 nHeight,
     return aBuffer.makeStringAndClear();
 }
 
-/*static*/ bool OleHelper::importStdFont( StdFontInfo& orFontInfo, BinaryInputStream& rInStrm, bool bWithGuid )
+bool OleHelper::importStdFont( StdFontInfo& orFontInfo, BinaryInputStream& rInStrm, bool bWithGuid )
 {
     if( bWithGuid )
     {
@@ -321,7 +321,7 @@ StdFontInfo::StdFontInfo( const OUString& rName, sal_uInt32 nHeight,
     return !rInStrm.isEof() && (nVersion <= 1);
 }
 
-/*static*/ bool OleHelper::importStdPic( StreamDataSequence& orGraphicData, BinaryInputStream& rInStrm, bool bWithGuid )
+bool OleHelper::importStdPic( StreamDataSequence& orGraphicData, BinaryInputStream& rInStrm, bool bWithGuid )
 {
     if( bWithGuid )
     {
diff --git a/oox/source/ole/vbacontrol.cxx b/oox/source/ole/vbacontrol.cxx
index 6ce6615..9621884 100644
--- a/oox/source/ole/vbacontrol.cxx
+++ b/oox/source/ole/vbacontrol.cxx
@@ -716,7 +716,7 @@ void VbaFormControl::moveEmbeddedToAbsoluteParent()
     }
 }
 
-/*static*/ bool VbaFormControl::compareByTabIndex( const VbaFormControlRef& rxLeft, const VbaFormControlRef& rxRight )
+bool VbaFormControl::compareByTabIndex( const VbaFormControlRef& rxLeft, const VbaFormControlRef& rxRight )
 {
     // sort controls without model to the end
     sal_Int32 nLeftTabIndex = rxLeft->mxSiteModel.get() ? rxLeft->mxSiteModel->getTabIndex() : SAL_MAX_INT32;
diff --git a/oox/source/ole/vbahelper.cxx b/oox/source/ole/vbahelper.cxx
index 1681f2b..92c9562 100644
--- a/oox/source/ole/vbahelper.cxx
+++ b/oox/source/ole/vbahelper.cxx
@@ -30,7 +30,7 @@ using namespace ::com::sun::star::uno;
 
 // ============================================================================
 
-/*static*/ bool VbaHelper::readDirRecord( sal_uInt16& rnRecId, StreamDataSequence& rRecData, BinaryInputStream& rInStrm )
+bool VbaHelper::readDirRecord( sal_uInt16& rnRecId, StreamDataSequence& rRecData, BinaryInputStream& rInStrm )
 {
     // read the record header
     sal_Int32 nRecSize;
@@ -45,7 +45,7 @@ using namespace ::com::sun::star::uno;
     return !rInStrm.isEof() && (rInStrm.readData( rRecData, nRecSize ) == nRecSize);
 }
 
-/*static*/ bool VbaHelper::extractKeyValue( OUString& rKey, OUString& rValue, const OUString& rKeyValue )
+bool VbaHelper::extractKeyValue( OUString& rKey, OUString& rValue, const OUString& rKeyValue )
 {
     sal_Int32 nEqSignPos = rKeyValue.indexOf( '=' );
     if( nEqSignPos > 0 )
diff --git a/oox/source/vml/vmlformatting.cxx b/oox/source/vml/vmlformatting.cxx
index b3cac88..7932acd 100644
--- a/oox/source/vml/vmlformatting.cxx
+++ b/oox/source/vml/vmlformatting.cxx
@@ -62,7 +62,7 @@ bool lclExtractDouble( double& orfValue, sal_Int32& ornEndPos, const OUString& r
 
 // ----------------------------------------------------------------------------
 
-/*static*/ bool ConversionHelper::separatePair( OUString& orValue1, OUString& orValue2,
+bool ConversionHelper::separatePair( OUString& orValue1, OUString& orValue2,
         const OUString& rValue, sal_Unicode cSep )
 {
     sal_Int32 nSepPos = rValue.indexOf( cSep );
@@ -78,14 +78,14 @@ bool lclExtractDouble( double& orfValue, sal_Int32& ornEndPos, const OUString& r
     return !orValue1.isEmpty() && !orValue2.isEmpty();
 }
 
-/*static*/ bool ConversionHelper::decodeBool( const OUString& rValue )
+bool ConversionHelper::decodeBool( const OUString& rValue )
 {
     sal_Int32 nToken = AttributeConversion::decodeToken( rValue );
     // anything else than 't' or 'true' is considered to be false, as specified
     return (nToken == XML_t) || (nToken == XML_true);
 }
 
-/*static*/ double ConversionHelper::decodePercent( const OUString& rValue, double fDefValue )
+double ConversionHelper::decodePercent( const OUString& rValue, double fDefValue )
 {
     if( rValue.isEmpty() )
         return fDefValue;
@@ -108,7 +108,7 @@ bool lclExtractDouble( double& orfValue, sal_Int32& ornEndPos, const OUString& r
     return fDefValue;
 }
 
-/*static*/ sal_Int64 ConversionHelper::decodeMeasureToEmu( const GraphicHelper& rGraphicHelper,
+sal_Int64 ConversionHelper::decodeMeasureToEmu( const GraphicHelper& rGraphicHelper,
         const OUString& rValue, sal_Int32 nRefValue, bool bPixelX, bool bDefaultAsPixel )
 {
     // default for missing values is 0
@@ -168,13 +168,13 @@ bool lclExtractDouble( double& orfValue, sal_Int32& ornEndPos, const OUString& r
     return static_cast< sal_Int64 >( fValue + 0.5 );
 }
 
-/*static*/ sal_Int32 ConversionHelper::decodeMeasureToHmm( const GraphicHelper& rGraphicHelper,
+sal_Int32 ConversionHelper::decodeMeasureToHmm( const GraphicHelper& rGraphicHelper,
         const OUString& rValue, sal_Int32 nRefValue, bool bPixelX, bool bDefaultAsPixel )
 {
     return ::oox::drawingml::convertEmuToHmm( decodeMeasureToEmu( rGraphicHelper, rValue, nRefValue, bPixelX, bDefaultAsPixel ) );
 }
 
-/*static*/ Color ConversionHelper::decodeColor( const GraphicHelper& rGraphicHelper,
+Color ConversionHelper::decodeColor( const GraphicHelper& rGraphicHelper,
         const OptValue< OUString >& roVmlColor, const OptValue< double >& roVmlOpacity,
         sal_Int32 nDefaultRgb, sal_Int32 nPrimaryRgb )
 {
@@ -266,7 +266,7 @@ bool lclExtractDouble( double& orfValue, sal_Int32& ornEndPos, const OUString& r
     return aDmlColor;
 }
 
-/*static*/ void ConversionHelper::decodeVmlPath( ::std::vector< ::std::vector< Point > >& rPointLists, ::std::vector< ::std::vector< PolygonFlags > >& rFlagLists, const OUString& rPath )
+void ConversionHelper::decodeVmlPath( ::std::vector< ::std::vector< Point > >& rPointLists, ::std::vector< ::std::vector< PolygonFlags > >& rFlagLists, const OUString& rPath )
 {
     ::std::vector< sal_Int32 > aCoordList;
     Point aCurrentPoint;
diff --git a/oox/source/vml/vmlshapecontext.cxx b/oox/source/vml/vmlshapecontext.cxx
index e0f8cfb..658215a 100644
--- a/oox/source/vml/vmlshapecontext.cxx
+++ b/oox/source/vml/vmlshapecontext.cxx
@@ -232,7 +232,7 @@ ShapeContextBase::ShapeContextBase( ContextHandler2Helper& rParent ) :
 {
 }
 
-/*static*/ ContextHandlerRef ShapeContextBase::createShapeContext( ContextHandler2Helper& rParent,
+ContextHandlerRef ShapeContextBase::createShapeContext( ContextHandler2Helper& rParent,
         ShapeContainer& rShapes, sal_Int32 nElement, const AttributeList& rAttribs )
 {
     switch( nElement )


More information about the Libreoffice-commits mailing list