basctl/inc/basidesh.hrc | 2 basctl/source/basicide/bastype2.cxx | 16 basctl/source/basicide/bastype3.cxx | 2 basctl/source/basicide/layout.cxx | 8 basctl/source/basicide/macrodlg.cxx | 2 basctl/source/basicide/moduldl2.cxx | 11 basctl/source/basicide/moduldlg.cxx | 16 basctl/source/basicide/moduldlg.hxx | 22 basctl/source/inc/bastype2.hxx | 25 basctl/source/inc/layout.hxx | 2 basic/source/classes/sbunoobj.cxx | 18 basic/source/sbx/sbxdec.cxx | 2 basic/source/sbx/sbxdec.hxx | 3 basic/source/sbx/sbxvalue.cxx | 12 canvas/source/cairo/cairo_canvashelper_text.cxx | 58 -- canvas/source/vcl/canvashelper.cxx | 4 canvas/source/vcl/canvashelper_texturefill.cxx | 4 canvas/source/vcl/impltools.cxx | 185 +------ canvas/source/vcl/impltools.hxx | 10 canvas/source/vcl/spritehelper.cxx | 4 chart2/inc/ChartView.hxx | 10 chart2/source/controller/accessibility/AccessibleBase.cxx | 17 chart2/source/controller/accessibility/AccessibleChartView.cxx | 4 chart2/source/controller/inc/AccessibleBase.hxx | 6 chart2/source/controller/inc/DataPointItemConverter.hxx | 3 chart2/source/controller/inc/GraphicPropertyItemConverter.hxx | 21 chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx | 2 chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx | 2 chart2/source/controller/itemsetwrapper/ErrorBarItemConverter.cxx | 2 chart2/source/controller/itemsetwrapper/GraphicPropertyItemConverter.cxx | 264 ++++------ chart2/source/controller/itemsetwrapper/LegendItemConverter.cxx | 2 chart2/source/controller/itemsetwrapper/MultipleChartConverters.cxx | 4 chart2/source/controller/itemsetwrapper/RegressionCurveItemConverter.cxx | 2 chart2/source/controller/itemsetwrapper/RegressionEquationItemConverter.cxx | 2 chart2/source/controller/itemsetwrapper/TitleItemConverter.cxx | 2 chart2/source/controller/main/ChartController_Properties.cxx | 16 chart2/source/view/main/ChartView.cxx | 10 37 files changed, 274 insertions(+), 501 deletions(-)
New commits: commit 80dd757500eeca2ee899bcf8e6d972d867690de0 Author: Noel Grandin <[email protected]> Date: Fri Feb 17 07:57:15 2017 +0200 convert GraphicObjectType to scoped enum and drop unused FILL_PROPERTIES enumerator Change-Id: I302d9d1d997c4fc491f7950b220060740f831539 diff --git a/chart2/source/controller/inc/DataPointItemConverter.hxx b/chart2/source/controller/inc/DataPointItemConverter.hxx index 0a96b3e..1cf452b 100644 --- a/chart2/source/controller/inc/DataPointItemConverter.hxx +++ b/chart2/source/controller/inc/DataPointItemConverter.hxx @@ -44,8 +44,7 @@ public: SfxItemPool& rItemPool, SdrModel& rDrawModel, const css::uno::Reference<css::lang::XMultiServiceFactory>& xNamedPropertyContainerFactory, - GraphicPropertyItemConverter::eGraphicObjectType eMapTo = - GraphicPropertyItemConverter::FILLED_DATA_POINT, + GraphicObjectType eMapTo = GraphicObjectType::FilledDataPoint, const css::awt::Size* pRefSize = nullptr, bool bDataSeries = false, bool bUseSpecialFillColor = false, diff --git a/chart2/source/controller/inc/GraphicPropertyItemConverter.hxx b/chart2/source/controller/inc/GraphicPropertyItemConverter.hxx index 0fafd00..ceeb581 100644 --- a/chart2/source/controller/inc/GraphicPropertyItemConverter.hxx +++ b/chart2/source/controller/inc/GraphicPropertyItemConverter.hxx @@ -30,24 +30,23 @@ namespace chart namespace wrapper { +enum class GraphicObjectType +{ + FilledDataPoint, + LineDataPoint, + LineProperties, + LineAndFillProperties +}; + class GraphicPropertyItemConverter : public ItemConverter { public: - enum eGraphicObjectType - { - FILLED_DATA_POINT, - LINE_DATA_POINT, - LINE_PROPERTIES, - FILL_PROPERTIES, - LINE_AND_FILL_PROPERTIES - }; - GraphicPropertyItemConverter( const css::uno::Reference< css::beans::XPropertySet > & rPropertySet, SfxItemPool& rItemPool, SdrModel& rDrawModel, const css::uno::Reference< css::lang::XMultiServiceFactory > & xNamedPropertyContainerFactory, - eGraphicObjectType eObjectType = FILLED_DATA_POINT ); + GraphicObjectType eObjectType = GraphicObjectType::FilledDataPoint ); virtual ~GraphicPropertyItemConverter() override; protected: @@ -58,7 +57,7 @@ protected: virtual bool ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet & rItemSet ) override; private: - eGraphicObjectType m_eGraphicObjectType; + GraphicObjectType m_GraphicObjectType; SdrModel & m_rDrawModel; css::uno::Reference< css::lang::XMultiServiceFactory > m_xNamedPropertyTableFactory; }; diff --git a/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx b/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx index c7f328e..e22dc88 100644 --- a/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx @@ -95,7 +95,7 @@ AxisItemConverter::AxisItemConverter( m_aConverters.push_back( new GraphicPropertyItemConverter( rPropertySet, rItemPool, rDrawModel, xNamedPropertyContainerFactory, - GraphicPropertyItemConverter::LINE_PROPERTIES )); + GraphicObjectType::LineProperties )); m_aConverters.push_back( new CharacterPropertyItemConverter(rPropertySet, rItemPool, pRefSize, "ReferencePageSize")); diff --git a/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx b/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx index d252b7d..fcd6c3f 100644 --- a/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx @@ -198,7 +198,7 @@ DataPointItemConverter::DataPointItemConverter( SfxItemPool& rItemPool, SdrModel& rDrawModel, const uno::Reference<lang::XMultiServiceFactory>& xNamedPropertyContainerFactory, - GraphicPropertyItemConverter::eGraphicObjectType eMapTo, + GraphicObjectType eMapTo, const awt::Size* pRefSize, bool bDataSeries, bool bUseSpecialFillColor, diff --git a/chart2/source/controller/itemsetwrapper/ErrorBarItemConverter.cxx b/chart2/source/controller/itemsetwrapper/ErrorBarItemConverter.cxx index 3226db7..b371237 100644 --- a/chart2/source/controller/itemsetwrapper/ErrorBarItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/ErrorBarItemConverter.cxx @@ -100,7 +100,7 @@ ErrorBarItemConverter::ErrorBarItemConverter( m_spGraphicConverter( new GraphicPropertyItemConverter( rPropertySet, rItemPool, rDrawModel, xNamedPropertyContainerFactory, - GraphicPropertyItemConverter::LINE_PROPERTIES )), + GraphicObjectType::LineProperties )), m_xModel( xModel ) {} diff --git a/chart2/source/controller/itemsetwrapper/GraphicPropertyItemConverter.cxx b/chart2/source/controller/itemsetwrapper/GraphicPropertyItemConverter.cxx index a86c320..9a775fc 100644 --- a/chart2/source/controller/itemsetwrapper/GraphicPropertyItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/GraphicPropertyItemConverter.cxx @@ -102,16 +102,10 @@ ItemPropertyMapType & lcl_GetFillPropertyMap() return aFillPropertyMap; } -bool lcl_supportsFillProperties( ::chart::wrapper::GraphicPropertyItemConverter::eGraphicObjectType eType ) +bool lcl_supportsFillProperties( ::chart::wrapper::GraphicObjectType eType ) { - return ( eType == ::chart::wrapper::GraphicPropertyItemConverter::FILLED_DATA_POINT || - eType == ::chart::wrapper::GraphicPropertyItemConverter::FILL_PROPERTIES || - eType == ::chart::wrapper::GraphicPropertyItemConverter::LINE_AND_FILL_PROPERTIES ); -} - -bool lcl_supportsLineProperties( ::chart::wrapper::GraphicPropertyItemConverter::eGraphicObjectType eType ) -{ - return ( eType != ::chart::wrapper::GraphicPropertyItemConverter::FILL_PROPERTIES ); + return ( eType == ::chart::wrapper::GraphicObjectType::FilledDataPoint || + eType == ::chart::wrapper::GraphicObjectType::LineAndFillProperties ); } bool lcl_SetContentForNamedProperty( @@ -144,9 +138,9 @@ GraphicPropertyItemConverter::GraphicPropertyItemConverter( SfxItemPool& rItemPool, SdrModel& rDrawModel, const uno::Reference< lang::XMultiServiceFactory > & xNamedPropertyContainerFactory, - eGraphicObjectType eObjectType /* = FILL_PROPERTIES */ ) : + GraphicObjectType eObjectType /* = FILL_PROPERTIES */ ) : ItemConverter( rPropertySet, rItemPool ), - m_eGraphicObjectType( eObjectType ), + m_GraphicObjectType( eObjectType ), m_rDrawModel( rDrawModel ), m_xNamedPropertyTableFactory( xNamedPropertyContainerFactory ) {} @@ -158,16 +152,14 @@ const sal_uInt16 * GraphicPropertyItemConverter::GetWhichPairs() const { const sal_uInt16 * pResult = nullptr; - switch( m_eGraphicObjectType ) + switch( m_GraphicObjectType ) { - case LINE_DATA_POINT: - case FILLED_DATA_POINT: + case GraphicObjectType::LineDataPoint: + case GraphicObjectType::FilledDataPoint: pResult = nRowWhichPairs; break; - case LINE_PROPERTIES: + case GraphicObjectType::LineProperties: pResult = nLinePropertyWhichPairs; break; - case FILL_PROPERTIES: - pResult = nFillPropertyWhichPairs; break; - case LINE_AND_FILL_PROPERTIES: + case GraphicObjectType::LineAndFillProperties: pResult = nLineAndFillPropertyWhichPairs; break; } @@ -179,27 +171,22 @@ bool GraphicPropertyItemConverter::GetItemProperty( tWhichIdType nWhichId, tProp ItemPropertyMapType::const_iterator aEndIt; ItemPropertyMapType::const_iterator aIt; - switch( m_eGraphicObjectType ) + switch( m_GraphicObjectType ) { - case LINE_DATA_POINT: + case GraphicObjectType::LineDataPoint: aEndIt = lcl_GetDataPointLinePropertyMap().end(); aIt = lcl_GetDataPointLinePropertyMap().find( nWhichId ); break; - case FILLED_DATA_POINT: + case GraphicObjectType::FilledDataPoint: aEndIt = lcl_GetDataPointFilledPropertyMap().end(); aIt = lcl_GetDataPointFilledPropertyMap().find( nWhichId ); break; - case LINE_PROPERTIES: + case GraphicObjectType::LineProperties: aEndIt = lcl_GetLinePropertyMap().end(); aIt = lcl_GetLinePropertyMap().find( nWhichId ); break; - case FILL_PROPERTIES: - aEndIt = lcl_GetFillPropertyMap().end(); - aIt = lcl_GetFillPropertyMap().find( nWhichId ); - break; - - case LINE_AND_FILL_PROPERTIES: + case GraphicObjectType::LineAndFillProperties: // line aEndIt = lcl_GetLinePropertyMap().end(); aIt = lcl_GetLinePropertyMap().find( nWhichId ); @@ -241,10 +228,10 @@ void GraphicPropertyItemConverter::FillSpecialItem( case XATTR_FILLFLOATTRANSPARENCE: try { - if( lcl_supportsFillProperties( m_eGraphicObjectType )) + if( lcl_supportsFillProperties( m_GraphicObjectType )) { OUString aPropName = - (m_eGraphicObjectType == FILLED_DATA_POINT) + (m_GraphicObjectType == GraphicObjectType::FilledDataPoint) ? OUString( "TransparencyGradientName" ) : OUString( "FillTransparenceGradientName" ); @@ -276,10 +263,10 @@ void GraphicPropertyItemConverter::FillSpecialItem( break; case XATTR_GRADIENTSTEPCOUNT: - if( lcl_supportsFillProperties( m_eGraphicObjectType )) + if( lcl_supportsFillProperties( m_GraphicObjectType )) { OUString aPropName = - (m_eGraphicObjectType == FILLED_DATA_POINT) + (m_GraphicObjectType == GraphicObjectType::FilledDataPoint) ? OUString( "GradientStepCount" ) : OUString( "FillGradientStepCount" ); @@ -293,36 +280,35 @@ void GraphicPropertyItemConverter::FillSpecialItem( break; case XATTR_LINEDASH: - if( lcl_supportsLineProperties( m_eGraphicObjectType )) - { - OUString aPropName = - (m_eGraphicObjectType == FILLED_DATA_POINT) - ? OUString( "BorderDashName" ) - : OUString( "LineDashName" ); - - XLineDashItem aItem; - aItem.PutValue( GetPropertySet()->getPropertyValue( aPropName ), MID_NAME ); - - lcl_SetContentForNamedProperty( - m_xNamedPropertyTableFactory, "com.sun.star.drawing.DashTable" , - aItem, MID_LINEDASH ); - - // translate model name to UI-name for predefined entries, so - // that the correct entry is chosen in the list of UI-names - XLineDashItem* pItemToPut = aItem.checkForUniqueItem( & m_rDrawModel ); - - if(pItemToPut) - rOutItemSet.Put( *pItemToPut ); - else - rOutItemSet.Put(aItem); - } + { + OUString aPropName = + (m_GraphicObjectType == GraphicObjectType::FilledDataPoint) + ? OUString( "BorderDashName" ) + : OUString( "LineDashName" ); + + XLineDashItem aItem; + aItem.PutValue( GetPropertySet()->getPropertyValue( aPropName ), MID_NAME ); + + lcl_SetContentForNamedProperty( + m_xNamedPropertyTableFactory, "com.sun.star.drawing.DashTable" , + aItem, MID_LINEDASH ); + + // translate model name to UI-name for predefined entries, so + // that the correct entry is chosen in the list of UI-names + XLineDashItem* pItemToPut = aItem.checkForUniqueItem( & m_rDrawModel ); + + if(pItemToPut) + rOutItemSet.Put( *pItemToPut ); + else + rOutItemSet.Put(aItem); + } break; case XATTR_FILLGRADIENT: - if( lcl_supportsFillProperties( m_eGraphicObjectType )) + if( lcl_supportsFillProperties( m_GraphicObjectType )) { OUString aPropName = - (m_eGraphicObjectType == FILLED_DATA_POINT) + (m_GraphicObjectType == GraphicObjectType::FilledDataPoint) ? OUString( "GradientName" ) : OUString( "FillGradientName" ); @@ -345,10 +331,10 @@ void GraphicPropertyItemConverter::FillSpecialItem( break; case XATTR_FILLHATCH: - if( lcl_supportsFillProperties( m_eGraphicObjectType )) + if( lcl_supportsFillProperties( m_GraphicObjectType )) { OUString aPropName = - (m_eGraphicObjectType == FILLED_DATA_POINT) + (m_GraphicObjectType == GraphicObjectType::FilledDataPoint) ? OUString( "HatchName" ) : OUString( "FillHatchName" ); @@ -371,7 +357,7 @@ void GraphicPropertyItemConverter::FillSpecialItem( break; case XATTR_FILLBITMAP: - if( lcl_supportsFillProperties( m_eGraphicObjectType )) + if( lcl_supportsFillProperties( m_GraphicObjectType )) { XFillBitmapItem aItem; aItem.PutValue( GetPropertySet()->getPropertyValue( "FillBitmapName" ), MID_NAME ); @@ -394,29 +380,28 @@ void GraphicPropertyItemConverter::FillSpecialItem( // hack, because QueryValue of XLineTransparenceItem returns sal_Int32 // instead of sal_Int16 case XATTR_LINETRANSPARENCE: - if( lcl_supportsLineProperties( m_eGraphicObjectType )) - { - OUString aPropName = - (m_eGraphicObjectType == FILLED_DATA_POINT) - ? OUString( "BorderTransparency" ) - : (m_eGraphicObjectType == LINE_DATA_POINT) - ? OUString( "Transparency" ) - : OUString( "LineTransparence" ); + { + OUString aPropName = + (m_GraphicObjectType == GraphicObjectType::FilledDataPoint) + ? OUString( "BorderTransparency" ) + : (m_GraphicObjectType == GraphicObjectType::LineDataPoint) + ? OUString( "Transparency" ) + : OUString( "LineTransparence" ); - XLineTransparenceItem aItem; - aItem.PutValue( GetPropertySet()->getPropertyValue( aPropName ), 0 ); + XLineTransparenceItem aItem; + aItem.PutValue( GetPropertySet()->getPropertyValue( aPropName ), 0 ); - rOutItemSet.Put( aItem ); - } - break; + rOutItemSet.Put( aItem ); + } + break; // hack, because QueryValue of XFillTransparenceItem returns sal_Int32 // instead of sal_Int16 case XATTR_FILLTRANSPARENCE: - if( lcl_supportsFillProperties( m_eGraphicObjectType )) + if( lcl_supportsFillProperties( m_GraphicObjectType )) { OUString aPropName = - (m_eGraphicObjectType == FILLED_DATA_POINT) + (m_GraphicObjectType == GraphicObjectType::FilledDataPoint) ? OUString( "Transparency" ) : OUString( "FillTransparence" ); @@ -439,7 +424,7 @@ bool GraphicPropertyItemConverter::ApplySpecialItem( { // bitmap property case XATTR_FILLBMP_STRETCH: - if( lcl_supportsFillProperties( m_eGraphicObjectType )) + if( lcl_supportsFillProperties( m_GraphicObjectType )) { const OUString aModePropName("FillBitmapMode"); bool bStretched = static_cast< const XFillBmpStretchItem & >( @@ -457,7 +442,7 @@ bool GraphicPropertyItemConverter::ApplySpecialItem( break; case XATTR_FILLBMP_TILE: - if( lcl_supportsFillProperties( m_eGraphicObjectType )) + if( lcl_supportsFillProperties( m_GraphicObjectType )) { const OUString aModePropName("FillBitmapMode"); bool bTiled = static_cast< const XFillBmpTileItem & >( @@ -477,10 +462,10 @@ bool GraphicPropertyItemConverter::ApplySpecialItem( case XATTR_FILLFLOATTRANSPARENCE: try { - if( lcl_supportsFillProperties( m_eGraphicObjectType )) + if( lcl_supportsFillProperties( m_GraphicObjectType )) { OUString aPropName = - (m_eGraphicObjectType == FILLED_DATA_POINT) + (m_GraphicObjectType == GraphicObjectType::FilledDataPoint) ? OUString( "TransparencyGradientName" ) : OUString( "FillTransparenceGradientName" ); @@ -528,10 +513,10 @@ bool GraphicPropertyItemConverter::ApplySpecialItem( case XATTR_GRADIENTSTEPCOUNT: { - if( lcl_supportsFillProperties( m_eGraphicObjectType )) + if( lcl_supportsFillProperties( m_GraphicObjectType )) { OUString aPropName = - (m_eGraphicObjectType == FILLED_DATA_POINT) + (m_GraphicObjectType == GraphicObjectType::FilledDataPoint) ? OUString( "GradientStepCount" ) : OUString( "FillGradientStepCount" ); @@ -550,33 +535,29 @@ bool GraphicPropertyItemConverter::ApplySpecialItem( case XATTR_LINEDASH: { - if( lcl_supportsLineProperties( m_eGraphicObjectType )) - { - - OUString aPropName = - (m_eGraphicObjectType == FILLED_DATA_POINT) - ? OUString( "BorderDashName" ) - : OUString( "LineDashName" ); + OUString aPropName = + (m_GraphicObjectType == GraphicObjectType::FilledDataPoint) + ? OUString( "BorderDashName" ) + : OUString( "LineDashName" ); - const XLineDashItem & rItem = - static_cast< const XLineDashItem & >( - rItemSet.Get( nWhichId )); + const XLineDashItem & rItem = + static_cast< const XLineDashItem & >( + rItemSet.Get( nWhichId )); - if( rItem.QueryValue( aValue, MID_NAME )) + if( rItem.QueryValue( aValue, MID_NAME )) + { + if( aValue != GetPropertySet()->getPropertyValue( aPropName )) { - if( aValue != GetPropertySet()->getPropertyValue( aPropName )) - { - // add LineDash to list - uno::Any aLineDash; - rItem.QueryValue( aLineDash, MID_LINEDASH ); - OUString aPreferredName; - aValue >>= aPreferredName; - aValue <<= PropertyHelper::addLineDashUniqueNameToTable( - aLineDash, m_xNamedPropertyTableFactory, aPreferredName ); + // add LineDash to list + uno::Any aLineDash; + rItem.QueryValue( aLineDash, MID_LINEDASH ); + OUString aPreferredName; + aValue >>= aPreferredName; + aValue <<= PropertyHelper::addLineDashUniqueNameToTable( + aLineDash, m_xNamedPropertyTableFactory, aPreferredName ); - GetPropertySet()->setPropertyValue( aPropName, aValue ); - bChanged = true; - } + GetPropertySet()->setPropertyValue( aPropName, aValue ); + bChanged = true; } } } @@ -584,10 +565,10 @@ bool GraphicPropertyItemConverter::ApplySpecialItem( case XATTR_FILLGRADIENT: { - if( lcl_supportsFillProperties( m_eGraphicObjectType )) + if( lcl_supportsFillProperties( m_GraphicObjectType )) { OUString aPropName = - (m_eGraphicObjectType == FILLED_DATA_POINT) + (m_GraphicObjectType == GraphicObjectType::FilledDataPoint) ? OUString( "GradientName" ) : OUString( "FillGradientName" ); @@ -617,10 +598,10 @@ bool GraphicPropertyItemConverter::ApplySpecialItem( case XATTR_FILLHATCH: { - if( lcl_supportsFillProperties( m_eGraphicObjectType )) + if( lcl_supportsFillProperties( m_GraphicObjectType )) { OUString aPropName = - (m_eGraphicObjectType == FILLED_DATA_POINT) + (m_GraphicObjectType == GraphicObjectType::FilledDataPoint) ? OUString( "HatchName" ) : OUString( "FillHatchName" ); @@ -650,7 +631,7 @@ bool GraphicPropertyItemConverter::ApplySpecialItem( case XATTR_FILLBITMAP: { - if( lcl_supportsFillProperties( m_eGraphicObjectType )) + if( lcl_supportsFillProperties( m_GraphicObjectType )) { const XFillBitmapItem & rItem = static_cast< const XFillBitmapItem & >( @@ -679,49 +660,48 @@ bool GraphicPropertyItemConverter::ApplySpecialItem( // hack, because QueryValue of XLineTransparenceItem returns sal_Int32 // instead of sal_Int16 case XATTR_LINETRANSPARENCE: - if( lcl_supportsLineProperties( m_eGraphicObjectType )) + { + OUString aPropName = + (m_GraphicObjectType == GraphicObjectType::FilledDataPoint) + ? OUString( "BorderTransparency" ) + : (m_GraphicObjectType == GraphicObjectType::LineDataPoint) + ? OUString( "Transparency" ) + : OUString( "LineTransparence" ); + + const XLineTransparenceItem & rItem = + static_cast< const XLineTransparenceItem & >( + rItemSet.Get( nWhichId )); + + if( rItem.QueryValue( aValue )) { - OUString aPropName = - (m_eGraphicObjectType == FILLED_DATA_POINT) - ? OUString( "BorderTransparency" ) - : (m_eGraphicObjectType == LINE_DATA_POINT) - ? OUString( "Transparency" ) - : OUString( "LineTransparence" ); - - const XLineTransparenceItem & rItem = - static_cast< const XLineTransparenceItem & >( - rItemSet.Get( nWhichId )); - - if( rItem.QueryValue( aValue )) + OSL_ENSURE( ! aValue.isExtractableTo( + cppu::UnoType<sal_Int16>::get()), + "TransparenceItem QueryValue bug is fixed. Remove hack." ); + sal_Int32 nValue = 0; + if( aValue >>= nValue ) { - OSL_ENSURE( ! aValue.isExtractableTo( - cppu::UnoType<sal_Int16>::get()), - "TransparenceItem QueryValue bug is fixed. Remove hack." ); - sal_Int32 nValue = 0; - if( aValue >>= nValue ) - { - OSL_ENSURE( nValue < SAL_MAX_INT16, "Transparency value too large" ); - sal_Int16 nValueToSet( static_cast< sal_Int16 >( nValue )); - aValue <<= nValueToSet; + OSL_ENSURE( nValue < SAL_MAX_INT16, "Transparency value too large" ); + sal_Int16 nValueToSet( static_cast< sal_Int16 >( nValue )); + aValue <<= nValueToSet; - GetPropertySet()->setPropertyValue( aPropName, aValue ); - bChanged = true; - } - else - { - OSL_FAIL( "Wrong type in Transparency Any" ); - } + GetPropertySet()->setPropertyValue( aPropName, aValue ); + bChanged = true; + } + else + { + OSL_FAIL( "Wrong type in Transparency Any" ); } } - break; + } + break; // hack, because QueryValue of XFillTransparenceItem returns sal_Int32 // instead of sal_Int16 case XATTR_FILLTRANSPARENCE: - if( lcl_supportsFillProperties( m_eGraphicObjectType )) + if( lcl_supportsFillProperties( m_GraphicObjectType )) { OUString aPropName = - (m_eGraphicObjectType == FILLED_DATA_POINT) + (m_GraphicObjectType == GraphicObjectType::FilledDataPoint) ? OUString( "Transparency" ) : OUString( "FillTransparence" ); @@ -744,7 +724,7 @@ bool GraphicPropertyItemConverter::ApplySpecialItem( GetPropertySet()->setPropertyValue( aPropName, aValue ); // if linear or no transparence is set, delete the gradient OUString aTransGradPropName = - (m_eGraphicObjectType == FILLED_DATA_POINT) + (m_GraphicObjectType == GraphicObjectType::FilledDataPoint) ? OUString( "TransparencyGradientName" ) : OUString( "FillTransparenceGradientName" ); GetPropertySet()->setPropertyValue( diff --git a/chart2/source/controller/itemsetwrapper/LegendItemConverter.cxx b/chart2/source/controller/itemsetwrapper/LegendItemConverter.cxx index c800a8c..8d2d251 100644 --- a/chart2/source/controller/itemsetwrapper/LegendItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/LegendItemConverter.cxx @@ -51,7 +51,7 @@ LegendItemConverter::LegendItemConverter( { m_aConverters.push_back( new GraphicPropertyItemConverter( rPropertySet, rItemPool, rDrawModel, xNamedPropertyContainerFactory, - GraphicPropertyItemConverter::LINE_AND_FILL_PROPERTIES )); + GraphicObjectType::LineAndFillProperties )); m_aConverters.push_back( new CharacterPropertyItemConverter( rPropertySet, rItemPool, pRefSize, "ReferencePageSize" )); diff --git a/chart2/source/controller/itemsetwrapper/MultipleChartConverters.cxx b/chart2/source/controller/itemsetwrapper/MultipleChartConverters.cxx index bb12287..2f22f13 100644 --- a/chart2/source/controller/itemsetwrapper/MultipleChartConverters.cxx +++ b/chart2/source/controller/itemsetwrapper/MultipleChartConverters.cxx @@ -83,7 +83,7 @@ AllGridItemConverter::AllGridItemConverter( Reference< beans::XPropertySet > xObjectProperties(aElementList[nA]); m_aConverters.push_back( new ::chart::wrapper::GraphicPropertyItemConverter( xObjectProperties, rItemPool, rDrawModel, xNamedPropertyContainerFactory, - ::chart::wrapper::GraphicPropertyItemConverter::LINE_PROPERTIES ) ); + ::chart::wrapper::GraphicObjectType::LineProperties ) ); } } @@ -120,7 +120,7 @@ AllDataLabelItemConverter::AllDataLabelItemConverter( m_aConverters.push_back( new ::chart::wrapper::DataPointItemConverter( xChartModel, xContext, xObjectProperties, *aIt, rItemPool, rDrawModel, - xNamedPropertyContainerFactory, GraphicPropertyItemConverter::FILLED_DATA_POINT, + xNamedPropertyContainerFactory, GraphicObjectType::FilledDataPoint, nullptr, true, false, 0, true, nNumberFormat, nPercentNumberFormat)); } } diff --git a/chart2/source/controller/itemsetwrapper/RegressionCurveItemConverter.cxx b/chart2/source/controller/itemsetwrapper/RegressionCurveItemConverter.cxx index bf9ff24..b220caa 100644 --- a/chart2/source/controller/itemsetwrapper/RegressionCurveItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/RegressionCurveItemConverter.cxx @@ -100,7 +100,7 @@ RegressionCurveItemConverter::RegressionCurveItemConverter( m_spGraphicConverter( new GraphicPropertyItemConverter( rPropertySet, rItemPool, rDrawModel, xNamedPropertyContainerFactory, - GraphicPropertyItemConverter::LINE_PROPERTIES )), + GraphicObjectType::LineProperties )), m_xCurveContainer( xContainer ) {} diff --git a/chart2/source/controller/itemsetwrapper/RegressionEquationItemConverter.cxx b/chart2/source/controller/itemsetwrapper/RegressionEquationItemConverter.cxx index 0f62797..bce257b 100644 --- a/chart2/source/controller/itemsetwrapper/RegressionEquationItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/RegressionEquationItemConverter.cxx @@ -59,7 +59,7 @@ RegressionEquationItemConverter::RegressionEquationItemConverter( m_aConverters.push_back( new GraphicPropertyItemConverter( rPropertySet, rItemPool, rDrawModel, xNamedPropertyContainerFactory, - GraphicPropertyItemConverter::LINE_AND_FILL_PROPERTIES )); + GraphicObjectType::LineAndFillProperties )); m_aConverters.push_back( new CharacterPropertyItemConverter(rPropertySet, rItemPool, pRefSize, "ReferencePageSize")); diff --git a/chart2/source/controller/itemsetwrapper/TitleItemConverter.cxx b/chart2/source/controller/itemsetwrapper/TitleItemConverter.cxx index 7a3c8f0..b158dbd 100644 --- a/chart2/source/controller/itemsetwrapper/TitleItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/TitleItemConverter.cxx @@ -100,7 +100,7 @@ TitleItemConverter::TitleItemConverter( m_aConverters.push_back( new GraphicPropertyItemConverter( rPropertySet, rItemPool, rDrawModel, xNamedPropertyContainerFactory, - GraphicPropertyItemConverter::LINE_AND_FILL_PROPERTIES )); + GraphicObjectType::LineAndFillProperties )); // CharacterProperties are not at the title but at its contained XFormattedString objects // take the first formatted string in the sequence diff --git a/chart2/source/controller/main/ChartController_Properties.cxx b/chart2/source/controller/main/ChartController_Properties.cxx index 7636aa9..5be1be5 100644 --- a/chart2/source/controller/main/ChartController_Properties.cxx +++ b/chart2/source/controller/main/ChartController_Properties.cxx @@ -99,7 +99,7 @@ wrapper::ItemConverter* createItemConverter( pItemConverter = new wrapper::GraphicPropertyItemConverter( xObjectProperties, rDrawModel.GetItemPool(), rDrawModel, uno::Reference< lang::XMultiServiceFactory >( xChartModel, uno::UNO_QUERY ), - wrapper::GraphicPropertyItemConverter::LINE_AND_FILL_PROPERTIES ); + wrapper::GraphicObjectType::LineAndFillProperties ); break; case OBJECTTYPE_TITLE: { @@ -134,7 +134,7 @@ wrapper::ItemConverter* createItemConverter( pItemConverter = new wrapper::GraphicPropertyItemConverter( xObjectProperties, rDrawModel.GetItemPool(), rDrawModel, uno::Reference< lang::XMultiServiceFactory >( xChartModel, uno::UNO_QUERY ), - wrapper::GraphicPropertyItemConverter::LINE_AND_FILL_PROPERTIES ); + wrapper::GraphicObjectType::LineAndFillProperties ); break; case OBJECTTYPE_AXIS: { @@ -202,8 +202,8 @@ wrapper::ItemConverter* createItemConverter( if (pRefSizeProvider) pRefSize.reset( new awt::Size( pRefSizeProvider->getPageSize())); - wrapper::GraphicPropertyItemConverter::eGraphicObjectType eMapTo = - wrapper::GraphicPropertyItemConverter::FILLED_DATA_POINT; + wrapper::GraphicObjectType eMapTo = + wrapper::GraphicObjectType::FilledDataPoint; uno::Reference< XDataSeries > xSeries = ObjectIdentifier::getDataSeriesForCID( aObjectCID, xChartModel ); uno::Reference< XChartType > xChartType = ChartModelHelper::getChartTypeOfSeries( xChartModel, xSeries ); @@ -211,7 +211,7 @@ wrapper::ItemConverter* createItemConverter( uno::Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xChartModel ) ); sal_Int32 nDimensionCount = DiagramHelper::getDimension( xDiagram ); if( !ChartTypeHelper::isSupportingAreaProperties( xChartType, nDimensionCount ) ) - eMapTo = wrapper::GraphicPropertyItemConverter::LINE_DATA_POINT; + eMapTo = wrapper::GraphicObjectType::LineDataPoint; bool bDataSeries = eObjectType == OBJECTTYPE_DATA_SERIES; @@ -255,7 +255,7 @@ wrapper::ItemConverter* createItemConverter( pItemConverter = new wrapper::GraphicPropertyItemConverter( xObjectProperties, rDrawModel.GetItemPool(), rDrawModel, uno::Reference< lang::XMultiServiceFactory >( xChartModel, uno::UNO_QUERY ), - wrapper::GraphicPropertyItemConverter::LINE_PROPERTIES ); + wrapper::GraphicObjectType::LineProperties ); break; case OBJECTTYPE_DATA_ERRORS_X: @@ -292,7 +292,7 @@ wrapper::ItemConverter* createItemConverter( pItemConverter = new wrapper::GraphicPropertyItemConverter( xObjectProperties, rDrawModel.GetItemPool(), rDrawModel, uno::Reference< lang::XMultiServiceFactory >( xChartModel, uno::UNO_QUERY ), - wrapper::GraphicPropertyItemConverter::LINE_AND_FILL_PROPERTIES ); + wrapper::GraphicObjectType::LineAndFillProperties ); break; default: //OBJECTTYPE_UNKNOWN break; @@ -776,7 +776,7 @@ bool ChartController::executeDlg_ObjectProperties_withoutUndoGuard( , m_pDrawModelWrapper->getSdrModel().GetItemPool() , m_pDrawModelWrapper->getSdrModel() , uno::Reference< lang::XMultiServiceFactory >( getModel(), uno::UNO_QUERY ) - , wrapper::GraphicPropertyItemConverter::FILLED_DATA_POINT ); + , wrapper::GraphicObjectType::FilledDataPoint ); pSymbolShapeProperties = new SfxItemSet( aSymbolItemConverter.CreateEmptyItemSet() ); aSymbolItemConverter.FillItemSet( *pSymbolShapeProperties ); commit 3ed6cb574888c82e250774ddf48d8a371483e890 Author: Noel Grandin <[email protected]> Date: Thu Feb 16 16:27:52 2017 +0200 convert AccessibleBase::EventType to scoped enum and drop unused enumerators Change-Id: I1ce08b16d587edcaee214b40798fe53fa3fc7923 diff --git a/chart2/source/controller/accessibility/AccessibleBase.cxx b/chart2/source/controller/accessibility/AccessibleBase.cxx index d887fa6..3a283d2 100644 --- a/chart2/source/controller/accessibility/AccessibleBase.cxx +++ b/chart2/source/controller/accessibility/AccessibleBase.cxx @@ -122,14 +122,7 @@ bool AccessibleBase::NotifyEvent( EventType eEventType, const AccessibleUniqueId aSelected <<= AccessibleStateType::SELECTED; switch( eEventType ) { - case OBJECT_CHANGE: - { - BroadcastAccEvent( AccessibleEventId::VISIBLE_DATA_CHANGED, aEmpty, aEmpty ); - SAL_INFO("chart2.accessibility", "Visible data event sent by: " << getAccessibleName()); - } - break; - - case GOT_SELECTION: + case EventType::GOT_SELECTION: { AddState( AccessibleStateType::SELECTED ); BroadcastAccEvent( AccessibleEventId::STATE_CHANGED, aSelected, aEmpty ); @@ -142,7 +135,7 @@ bool AccessibleBase::NotifyEvent( EventType eEventType, const AccessibleUniqueId } break; - case LOST_SELECTION: + case EventType::LOST_SELECTION: { RemoveState( AccessibleStateType::SELECTED ); BroadcastAccEvent( AccessibleEventId::STATE_CHANGED, aEmpty, aSelected ); @@ -153,12 +146,6 @@ bool AccessibleBase::NotifyEvent( EventType eEventType, const AccessibleUniqueId SAL_INFO("chart2.accessibility", "Selection lost by: " << getAccessibleName()); } break; - - case PROPERTY_CHANGE: - { - //not implemented --> rebuild all - } - break; } return true; } diff --git a/chart2/source/controller/accessibility/AccessibleChartView.cxx b/chart2/source/controller/accessibility/AccessibleChartView.cxx index 77c4457..ec0b112 100644 --- a/chart2/source/controller/accessibility/AccessibleChartView.cxx +++ b/chart2/source/controller/accessibility/AccessibleChartView.cxx @@ -338,11 +338,11 @@ void SAL_CALL AccessibleChartView::selectionChanged( const lang::EventObject& /* ObjectIdentifier aSelectedOID( xSelectionSupplier->getSelection() ); if ( m_aCurrentSelectionOID.isValid() ) { - NotifyEvent( LOST_SELECTION, m_aCurrentSelectionOID ); + NotifyEvent( EventType::LOST_SELECTION, m_aCurrentSelectionOID ); } if( aSelectedOID.isValid() ) { - NotifyEvent( GOT_SELECTION, aSelectedOID ); + NotifyEvent( EventType::GOT_SELECTION, aSelectedOID ); } m_aCurrentSelectionOID = aSelectedOID; } diff --git a/chart2/source/controller/inc/AccessibleBase.hxx b/chart2/source/controller/inc/AccessibleBase.hxx index 21da0b9..b808052 100644 --- a/chart2/source/controller/inc/AccessibleBase.hxx +++ b/chart2/source/controller/inc/AccessibleBase.hxx @@ -93,12 +93,10 @@ class AccessibleBase : public impl::AccessibleBase_Base { public: - enum EventType + enum class EventType { - OBJECT_CHANGE, GOT_SELECTION, - LOST_SELECTION, - PROPERTY_CHANGE + LOST_SELECTION }; AccessibleBase( const AccessibleElementInfo & rAccInfo, commit 802a76d4a972db180a21efb9cb6e05220b724c22 Author: Noel Grandin <[email protected]> Date: Thu Feb 16 16:24:59 2017 +0200 drop TimeBasedMode enum since we only ever use the AUTOMATIC enumerator Change-Id: I1370bf30ea31d0631e56524638ee843f18583933 diff --git a/chart2/inc/ChartView.hxx b/chart2/inc/ChartView.hxx index b82a308..fcb4f2b 100644 --- a/chart2/inc/ChartView.hxx +++ b/chart2/inc/ChartView.hxx @@ -55,22 +55,14 @@ class GL3DPlotterBase; class GL2DRenderer; struct CreateShapeParam2D; -enum TimeBasedMode -{ - MANUAL, - AUTOMATIC -}; - struct TimeBasedInfo { TimeBasedInfo(): bTimeBased(false), - nFrame(0), - eMode(AUTOMATIC) {} + nFrame(0) {} bool bTimeBased; size_t nFrame; - TimeBasedMode eMode; Timer maTimer; // only valid when we are in the time based mode diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx index fce14c8..12fc658 100644 --- a/chart2/source/view/main/ChartView.cxx +++ b/chart2/source/view/main/ChartView.cxx @@ -3342,16 +3342,10 @@ void ChartView::createShapes2D( const awt::Size& rPageSize ) } } - if(maTimeBased.eMode != MANUAL) - { - mrChartModel.setTimeBased(true); - mrChartModel.getNextTimePoint(); - } - else - maTimeBased.maTimer.Stop(); + maTimeBased.maTimer.Stop(); } - if(maTimeBased.bTimeBased && maTimeBased.eMode != MANUAL && !maTimeBased.maTimer.IsActive()) + if(maTimeBased.bTimeBased && !maTimeBased.maTimer.IsActive()) { maTimeBased.maTimer.SetTimeout(15); maTimeBased.maTimer.SetInvokeHandler(LINK(this, ChartView, UpdateTimeBased)); commit 58f75fb66a83b1bc7d8297dedc14ade88a9bbc9d Author: Noel Grandin <[email protected]> Date: Thu Feb 16 16:15:48 2017 +0200 drop ModulationMode enum since we only ever use the MODULE_NONE enumerator Change-Id: Icd075bb01b5938dbd75b901521d084ddd6469963 diff --git a/canvas/source/vcl/canvashelper.cxx b/canvas/source/vcl/canvashelper.cxx index f13780d..78036a4 100644 --- a/canvas/source/vcl/canvashelper.cxx +++ b/canvas/source/vcl/canvashelper.cxx @@ -830,9 +830,7 @@ namespace vclcanvas // complex transformation, use generic affine bitmap // transformation aBmpEx = tools::transformBitmap( aBmpEx, - aMatrix, - renderState.DeviceColor, - tools::MODULATE_NONE ); + aMatrix ); pGrfObj.reset( new GraphicObject( aBmpEx ) ); diff --git a/canvas/source/vcl/canvashelper_texturefill.cxx b/canvas/source/vcl/canvashelper_texturefill.cxx index 8f76a08..dd52366 100644 --- a/canvas/source/vcl/canvashelper_texturefill.cxx +++ b/canvas/source/vcl/canvashelper_texturefill.cxx @@ -857,9 +857,7 @@ namespace vclcanvas // complex transformation, use generic affine bitmap // transformation aBmpEx = tools::transformBitmap( aBmpEx, - aTotalTransform, - uno::Sequence< double >(), - tools::MODULATE_NONE); + aTotalTransform); pGrfObj.reset( new GraphicObject( aBmpEx ) ); diff --git a/canvas/source/vcl/impltools.cxx b/canvas/source/vcl/impltools.cxx index a6e1d7e..3689cce 100644 --- a/canvas/source/vcl/impltools.cxx +++ b/canvas/source/vcl/impltools.cxx @@ -197,9 +197,7 @@ namespace vclcanvas } ::BitmapEx transformBitmap( const BitmapEx& rBitmap, - const ::basegfx::B2DHomMatrix& rTransform, - const uno::Sequence< double >& rDeviceColor, - ModulationMode eModulationMode ) + const ::basegfx::B2DHomMatrix& rTransform ) { SAL_INFO( "canvas.vcl", "::vclcanvas::tools::transformBitmap()" ); SAL_INFO( "canvas.vcl", "::vclcanvas::tools::transformBitmap: 0x" << std::hex << &rBitmap ); @@ -230,14 +228,6 @@ namespace vclcanvas aSrcRect, rTransform ); - const bool bModulateColors( eModulationMode == MODULATE_WITH_DEVICECOLOR && - rDeviceColor.getLength() > 2 ); - const double nRedModulation( bModulateColors ? rDeviceColor[0] : 1.0 ); - const double nGreenModulation( bModulateColors ? rDeviceColor[1] : 1.0 ); - const double nBlueModulation( bModulateColors ? rDeviceColor[2] : 1.0 ); - const double nAlphaModulation( bModulateColors && rDeviceColor.getLength() > 3 ? - rDeviceColor[3] : 1.0 ); - Bitmap aSrcBitmap( rBitmap.GetBitmap() ); Bitmap aSrcAlpha; @@ -328,163 +318,50 @@ namespace vclcanvas // for the time being, always read as ARGB for( long y=0; y<aDestBmpSize.Height(); ++y ) { - if( bModulateColors ) + // differentiate mask and alpha channel (on-off + // vs. multi-level transparency) + if( rBitmap.IsTransparent() ) { - // TODO(P2): Have different branches for - // alpha-only modulation (color - // modulations eq. 1.0) - - // modulate all color channels with given - // values - - // differentiate mask and alpha channel (on-off - // vs. multi-level transparency) - if( rBitmap.IsTransparent() ) + // Handling alpha and mask just the same... + for( long x=0; x<aDestBmpSize.Width(); ++x ) { - // Handling alpha and mask just the same... - for( long x=0; x<aDestBmpSize.Width(); ++x ) + ::basegfx::B2DPoint aPoint(x,y); + aPoint *= aTransform; + + const int nSrcX( ::basegfx::fround( aPoint.getX() ) ); + const int nSrcY( ::basegfx::fround( aPoint.getY() ) ); + if( nSrcX < 0 || nSrcX >= aBmpSize.Width() || + nSrcY < 0 || nSrcY >= aBmpSize.Height() ) { - ::basegfx::B2DPoint aPoint(x,y); - aPoint *= aTransform; - - const int nSrcX( ::basegfx::fround( aPoint.getX() ) ); - const int nSrcY( ::basegfx::fround( aPoint.getY() ) ); - if( nSrcX < 0 || nSrcX >= aBmpSize.Width() || - nSrcY < 0 || nSrcY >= aBmpSize.Height() ) - { - pAlphaWriteAccess->SetPixel( y, x, BitmapColor(255) ); - } - else - { - // modulate alpha with - // nAlphaModulation. This is a - // little bit verbose, formula - // is 255 - (255-pixAlpha)*nAlphaModulation - // (invert 'alpha' pixel value, - // to get the standard alpha - // channel behaviour) - const sal_uInt8 cMappedAlphaIdx = aAlphaMap[ pAlphaReadAccess->GetPixelIndex( nSrcY, nSrcX ) ]; - const sal_uInt8 cModulatedAlphaIdx = 255U - static_cast<sal_uInt8>( nAlphaModulation* (255U - cMappedAlphaIdx) + .5 ); - pAlphaWriteAccess->SetPixelIndex( y, x, cModulatedAlphaIdx ); - BitmapColor aColor( pReadAccess->GetPixel( nSrcY, nSrcX ) ); - - aColor.SetRed( - static_cast<sal_uInt8>( - nRedModulation * - aColor.GetRed() + .5 )); - aColor.SetGreen( - static_cast<sal_uInt8>( - nGreenModulation * - aColor.GetGreen() + .5 )); - aColor.SetBlue( - static_cast<sal_uInt8>( - nBlueModulation * - aColor.GetBlue() + .5 )); - - pWriteAccess->SetPixel( y, x, - aColor ); - } + pAlphaWriteAccess->SetPixelIndex( y, x, 255 ); } - } - else - { - for( long x=0; x<aDestBmpSize.Width(); ++x ) + else { - ::basegfx::B2DPoint aPoint(x,y); - aPoint *= aTransform; - - const int nSrcX( ::basegfx::fround( aPoint.getX() ) ); - const int nSrcY( ::basegfx::fround( aPoint.getY() ) ); - if( nSrcX < 0 || nSrcX >= aBmpSize.Width() || - nSrcY < 0 || nSrcY >= aBmpSize.Height() ) - { - pAlphaWriteAccess->SetPixel( y, x, BitmapColor(255) ); - } - else - { - // modulate alpha with - // nAlphaModulation. This is a - // little bit verbose, formula - // is 255 - 255*nAlphaModulation - // (invert 'alpha' pixel value, - // to get the standard alpha - // channel behaviour) - pAlphaWriteAccess->SetPixel( y, x, - BitmapColor( - 255U - - static_cast<sal_uInt8>( - nAlphaModulation*255.0 - + .5 ) ) ); - - BitmapColor aColor( pReadAccess->GetPixel( nSrcY, - nSrcX ) ); - - aColor.SetRed( - static_cast<sal_uInt8>( - nRedModulation * - aColor.GetRed() + .5 )); - aColor.SetGreen( - static_cast<sal_uInt8>( - nGreenModulation * - aColor.GetGreen() + .5 )); - aColor.SetBlue( - static_cast<sal_uInt8>( - nBlueModulation * - aColor.GetBlue() + .5 )); - - pWriteAccess->SetPixel( y, x, - aColor ); - } + const sal_uInt8 cAlphaIdx = pAlphaReadAccess->GetPixelIndex( nSrcY, nSrcX ); + pAlphaWriteAccess->SetPixelIndex( y, x, aAlphaMap[ cAlphaIdx ] ); + pWriteAccess->SetPixel( y, x, pReadAccess->GetPixel( nSrcY, nSrcX ) ); } } } else { - // differentiate mask and alpha channel (on-off - // vs. multi-level transparency) - if( rBitmap.IsTransparent() ) + for( long x=0; x<aDestBmpSize.Width(); ++x ) { - // Handling alpha and mask just the same... - for( long x=0; x<aDestBmpSize.Width(); ++x ) + ::basegfx::B2DPoint aPoint(x,y); + aPoint *= aTransform; + + const int nSrcX( ::basegfx::fround( aPoint.getX() ) ); + const int nSrcY( ::basegfx::fround( aPoint.getY() ) ); + if( nSrcX < 0 || nSrcX >= aBmpSize.Width() || + nSrcY < 0 || nSrcY >= aBmpSize.Height() ) { - ::basegfx::B2DPoint aPoint(x,y); - aPoint *= aTransform; - - const int nSrcX( ::basegfx::fround( aPoint.getX() ) ); - const int nSrcY( ::basegfx::fround( aPoint.getY() ) ); - if( nSrcX < 0 || nSrcX >= aBmpSize.Width() || - nSrcY < 0 || nSrcY >= aBmpSize.Height() ) - { - pAlphaWriteAccess->SetPixelIndex( y, x, 255 ); - } - else - { - const sal_uInt8 cAlphaIdx = pAlphaReadAccess->GetPixelIndex( nSrcY, nSrcX ); - pAlphaWriteAccess->SetPixelIndex( y, x, aAlphaMap[ cAlphaIdx ] ); - pWriteAccess->SetPixel( y, x, pReadAccess->GetPixel( nSrcY, nSrcX ) ); - } + pAlphaWriteAccess->SetPixel( y, x, BitmapColor(255) ); } - } - else - { - for( long x=0; x<aDestBmpSize.Width(); ++x ) + else { - ::basegfx::B2DPoint aPoint(x,y); - aPoint *= aTransform; - - const int nSrcX( ::basegfx::fround( aPoint.getX() ) ); - const int nSrcY( ::basegfx::fround( aPoint.getY() ) ); - if( nSrcX < 0 || nSrcX >= aBmpSize.Width() || - nSrcY < 0 || nSrcY >= aBmpSize.Height() ) - { - pAlphaWriteAccess->SetPixel( y, x, BitmapColor(255) ); - } - else - { - pAlphaWriteAccess->SetPixel( y, x, BitmapColor(0) ); - pWriteAccess->SetPixel( y, x, pReadAccess->GetPixel( nSrcY, - nSrcX ) ); - } + pAlphaWriteAccess->SetPixel( y, x, BitmapColor(0) ); + pWriteAccess->SetPixel( y, x, pReadAccess->GetPixel( nSrcY, + nSrcX ) ); } } } diff --git a/canvas/source/vcl/impltools.hxx b/canvas/source/vcl/impltools.hxx index 62f1081..d07a841 100644 --- a/canvas/source/vcl/impltools.hxx +++ b/canvas/source/vcl/impltools.hxx @@ -171,16 +171,8 @@ namespace vclcanvas const css::rendering::ViewState& rViewState, const css::rendering::RenderState& rRenderState ); - enum ModulationMode - { - MODULATE_NONE, - MODULATE_WITH_DEVICECOLOR - }; - ::BitmapEx transformBitmap( const BitmapEx& rBitmap, - const ::basegfx::B2DHomMatrix& rTransform, - const css::uno::Sequence< double >& rDeviceColor, - ModulationMode eModulationMode ); + const ::basegfx::B2DHomMatrix& rTransform ); } } diff --git a/canvas/source/vcl/spritehelper.cxx b/canvas/source/vcl/spritehelper.cxx index 8dd45e0..ee70b21 100644 --- a/canvas/source/vcl/spritehelper.cxx +++ b/canvas/source/vcl/spritehelper.cxx @@ -204,9 +204,7 @@ namespace vclcanvas // actually re-create the bitmap ONLY if necessary if( bNeedBitmapUpdate ) maContent = tools::transformBitmap( *maContent, - aTransform, - uno::Sequence<double>(), - tools::MODULATE_NONE ); + aTransform ); aOutputSize = maContent->GetSizePixel(); } commit 51d474abdb8835fe8de055795f17ee580474fab4 Author: Noel Grandin <[email protected]> Date: Thu Feb 16 16:08:20 2017 +0200 drop cairocanvas::ColorType enum since we only use the one enumerator value Change-Id: Ifec39f4845348c753a6207795c62b27a7af1bbcd diff --git a/canvas/source/cairo/cairo_canvashelper_text.cxx b/canvas/source/cairo/cairo_canvashelper_text.cxx index 72084ae..c2a055e 100644 --- a/canvas/source/cairo/cairo_canvashelper_text.cxx +++ b/canvas/source/cairo/cairo_canvashelper_text.cxx @@ -37,11 +37,6 @@ using namespace ::com::sun::star; namespace cairocanvas { - enum ColorType - { - LINE_COLOR, FILL_COLOR, TEXT_COLOR, IGNORE_COLOR - }; - uno::Reference< rendering::XCanvasFont > CanvasHelper::createFont( const rendering::XCanvas* , const rendering::FontRequest& fontRequest, const uno::Sequence< beans::PropertyValue >& extraFontProperties, @@ -114,14 +109,13 @@ namespace cairocanvas setupOutDevState( OutputDevice& rOutDev, const rendering::XCanvas* pOwner, const rendering::ViewState& viewState, - const rendering::RenderState& renderState, - ColorType eColorType ) + const rendering::RenderState& renderState ) { ::canvas::tools::verifyInput( renderState, OSL_THIS_FUNC, const_cast<rendering::XCanvas*>(pOwner), // only for refcount 2, - eColorType == IGNORE_COLOR ? 0 : 3 ); + 3 /* text */ ); int nTransparency(0); @@ -129,45 +123,19 @@ namespace cairocanvas // state and change only when update is necessary ::canvas::tools::clipOutDev(viewState, renderState, rOutDev); - if( eColorType != IGNORE_COLOR ) - { - Color aColor( COL_WHITE ); - - if( renderState.DeviceColor.getLength() > 2 ) - { - aColor = vcl::unotools::stdColorSpaceSequenceToColor( renderState.DeviceColor ); - } - - // extract alpha, and make color opaque - // afterwards. Otherwise, OutputDevice won't draw anything - nTransparency = aColor.GetTransparency(); - aColor.SetTransparency(0); - - switch( eColorType ) - { - case LINE_COLOR: - rOutDev.SetLineColor( aColor ); - rOutDev.SetFillColor(); - - break; - - case FILL_COLOR: - rOutDev.SetFillColor( aColor ); - rOutDev.SetLineColor(); - - break; + Color aColor( COL_WHITE ); - case TEXT_COLOR: - rOutDev.SetTextColor( aColor ); + if( renderState.DeviceColor.getLength() > 2 ) + { + aColor = vcl::unotools::stdColorSpaceSequenceToColor( renderState.DeviceColor ); + } - break; + // extract alpha, and make color opaque + // afterwards. Otherwise, OutputDevice won't draw anything + nTransparency = aColor.GetTransparency(); + aColor.SetTransparency(0); - default: - ENSURE_OR_THROW( false, - "CanvasHelper::setupOutDevState(): Unexpected color type"); - break; - } - } + rOutDev.SetTextColor( aColor ); return nTransparency; } @@ -204,7 +172,7 @@ namespace cairocanvas const rendering::RenderState& renderState, const uno::Reference< rendering::XCanvasFont >& xFont ) { - setupOutDevState( rOutDev, pOwner, viewState, renderState, TEXT_COLOR ); + setupOutDevState( rOutDev, pOwner, viewState, renderState ); CanvasFont* pFont = dynamic_cast< CanvasFont* >( xFont.get() ); commit dc21a49ea3a5a655e6bf70860b1b99c20e5b7473 Author: Noel Grandin <[email protected]> Date: Thu Feb 16 15:52:16 2017 +0200 convert SbxDecimal::CmpResult to scoped enum Change-Id: Id2d887c3ce4316a223497ef6790ca326983c4817 diff --git a/basic/source/sbx/sbxdec.cxx b/basic/source/sbx/sbxdec.cxx index 8a2df8d..690b84b 100644 --- a/basic/source/sbx/sbxdec.cxx +++ b/basic/source/sbx/sbxdec.cxx @@ -324,7 +324,7 @@ SbxDecimal::CmpResult compare( const SbxDecimal &rLeft, const SbxDecimal &rRight { (void)rLeft; (void)rRight; - return (SbxDecimal::CmpResult)0; + return SbxDecimal::CmpResult::LT; } void SbxDecimal::setChar( sal_Unicode val ) { (void)val; } diff --git a/basic/source/sbx/sbxdec.hxx b/basic/source/sbx/sbxdec.hxx index 2bc201b..4d80b25 100644 --- a/basic/source/sbx/sbxdec.hxx +++ b/basic/source/sbx/sbxdec.hxx @@ -95,7 +95,8 @@ public: bool isZero(); - enum CmpResult { LT, EQ, GT }; + // must match the return values of the Microsoft VarDecCmp Automation function + enum class CmpResult { LT, EQ, GT }; friend CmpResult compare( const SbxDecimal &rLeft, const SbxDecimal &rRight ); }; diff --git a/basic/source/sbx/sbxvalue.cxx b/basic/source/sbx/sbxvalue.cxx index 4171320..f4bc905 100644 --- a/basic/source/sbx/sbxvalue.cxx +++ b/basic/source/sbx/sbxvalue.cxx @@ -1293,17 +1293,17 @@ bool SbxValue::Compare( SbxOperator eOp, const SbxValue& rOp ) const switch( eOp ) { case SbxEQ: - bRes = ( eRes == SbxDecimal::EQ ); break; + bRes = ( eRes == SbxDecimal::CmpResult::EQ ); break; case SbxNE: - bRes = ( eRes != SbxDecimal::EQ ); break; + bRes = ( eRes != SbxDecimal::CmpResult::EQ ); break; case SbxLT: - bRes = ( eRes == SbxDecimal::LT ); break; + bRes = ( eRes == SbxDecimal::CmpResult::LT ); break; case SbxGT: - bRes = ( eRes == SbxDecimal::GT ); break; + bRes = ( eRes == SbxDecimal::CmpResult::GT ); break; case SbxLE: - bRes = ( eRes != SbxDecimal::GT ); break; + bRes = ( eRes != SbxDecimal::CmpResult::GT ); break; case SbxGE: - bRes = ( eRes != SbxDecimal::LT ); break; + bRes = ( eRes != SbxDecimal::CmpResult::LT ); break; default: SetError( ERRCODE_SBX_NOTIMP ); } commit 4ea27cf64f050b98b8384d0acfe6df8e203413ba Author: Noel Grandin <[email protected]> Date: Thu Feb 16 15:45:17 2017 +0200 convert INVOKETYPE to scoped enum and drop unused SetProp enumerator Change-Id: Ic8a71991f6a4e08d0189d2eb93580b0c33204d1b diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx index 4f3406b..9d4d00d 100644 --- a/basic/source/classes/sbunoobj.cxx +++ b/basic/source/classes/sbunoobj.cxx @@ -1500,7 +1500,7 @@ void processAutomationParams( SbxArray* pParams, Sequence< Any >& args, bool bOL } } -enum INVOKETYPE +enum class INVOKETYPE { GetProp = 0, SetProp, @@ -1514,23 +1514,17 @@ Any invokeAutomationMethod( const OUString& Name, Sequence< Any >& args, SbxArra Any aRetAny; switch( invokeType ) { - case Func: + case INVOKETYPE::Func: aRetAny = rxInvocation->invoke( Name, args, OutParamIndex, OutParam ); break; - case GetProp: + case INVOKETYPE::GetProp: { Reference< XAutomationInvocation > xAutoInv( rxInvocation, UNO_QUERY ); aRetAny = xAutoInv->invokeGetProperty( Name, args, OutParamIndex, OutParam ); break; } - case SetProp: - { - Reference< XAutomationInvocation > xAutoInv( rxInvocation, UNO_QUERY_THROW ); - aRetAny = xAutoInv->invokePutProperty( Name, args, OutParamIndex, OutParam ); - break; - } default: - break; // should introduce an error here + assert(false); break; } const sal_Int16* pIndices = OutParamIndex.getConstArray(); @@ -2085,7 +2079,7 @@ void SbUnoObject::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) // XInvocation Sequence<Any> args; processAutomationParams( pParams, args, true, nParamCount ); - aRetAny = invokeAutomationMethod( pProp->GetName(), args, pParams, nParamCount, mxInvocation, GetProp ); + aRetAny = invokeAutomationMethod( pProp->GetName(), args, pParams, nParamCount, mxInvocation, INVOKETYPE::GetProp ); } else aRetAny = mxInvocation->getValue( pProp->GetName() ); @@ -2265,7 +2259,7 @@ void SbUnoObject::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) } else if( bInvocation && mxInvocation.is() ) { - Any aRetAny = invokeAutomationMethod( pMeth->GetName(), args, pParams, nParamCount, mxInvocation, Func ); + Any aRetAny = invokeAutomationMethod( pMeth->GetName(), args, pParams, nParamCount, mxInvocation, INVOKETYPE::Func ); unoToSbxValue( pVar, aRetAny ); } commit 792886d34bd87ad5e2b3d197e86ab41205a33618 Author: Noel Grandin <[email protected]> Date: Thu Feb 16 15:41:19 2017 +0200 convert basctl::Layout::SplittedSide::Side to scoped enum and drop unused enumerators Change-Id: I7c8338423eddb64bf4d4138d2613dd393408c9e3 diff --git a/basctl/source/basicide/layout.cxx b/basctl/source/basicide/layout.cxx index cf94305..b93e50a 100644 --- a/basctl/source/basicide/layout.cxx +++ b/basctl/source/basicide/layout.cxx @@ -37,8 +37,8 @@ Layout::Layout (vcl::Window* pParent) : Window(pParent, WB_CLIPCHILDREN), pChild(nullptr), bFirstSize(true), - aLeftSide(this, SplittedSide::Left), - aBottomSide(this, SplittedSide::Bottom) + aLeftSide(this, SplittedSide::Side::Left), + aBottomSide(this, SplittedSide::Side::Bottom) { SetBackground(GetSettings().GetStyleSettings().GetWindowColor()); @@ -169,8 +169,8 @@ void Layout::DataChanged (DataChangedEvent const& rDCEvt) // ctor Layout::SplittedSide::SplittedSide (Layout* pParent, Side eSide) : rLayout(*pParent), - bVertical(eSide == Left || eSide == Right), - bLower(eSide == Left || eSide == Top), + bVertical(eSide == Side::Left), + bLower(eSide == Side::Left), nSize(0), aSplitter(VclPtr<Splitter>::Create(pParent, bVertical ? WB_HSCROLL : WB_VSCROLL)) { diff --git a/basctl/source/inc/layout.hxx b/basctl/source/inc/layout.hxx index 434b6b1..5b66e41 100644 --- a/basctl/source/inc/layout.hxx +++ b/basctl/source/inc/layout.hxx @@ -79,7 +79,7 @@ private: class SplittedSide { public: - enum Side {Right, Top, Left, Bottom}; + enum class Side {Left, Bottom}; SplittedSide (Layout*, Side); void Add (DockingWindow*, Size const&); void Remove (DockingWindow*); commit 210db2bf9e199f0a58fbd7a629edda63903fabac Author: Noel Grandin <[email protected]> Date: Thu Feb 16 15:36:46 2017 +0200 convert BrowseMode to o3tl::typed_flags Change-Id: Id76339f73b3d4acd4908fd66c4c745c5b2b57c2f diff --git a/basctl/source/basicide/bastype2.cxx b/basctl/source/basicide/bastype2.cxx index 926cdaf..9b34559 100644 --- a/basctl/source/basicide/bastype2.cxx +++ b/basctl/source/basicide/bastype2.cxx @@ -163,7 +163,7 @@ TreeListBox::TreeListBox (vcl::Window* pParent, WinBits nStyle) { SetNodeDefaultImages(); SetSelectionMode( SelectionMode::Single ); - nMode = 0xFF; // everything + nMode = BrowseMode::All; // everything } VCL_BUILDER_FACTORY_CONSTRUCTOR(TreeListBox, WB_TABSTOP) @@ -256,7 +256,7 @@ void TreeListBox::ImpCreateLibEntries( SvTreeListEntry* pDocumentRootEntry, cons // create tree list box entry sal_uInt16 nId; - if ( ( nMode & BROWSEMODE_DIALOGS ) && !( nMode & BROWSEMODE_MODULES ) ) + if ( ( nMode & BrowseMode::Dialogs ) && !( nMode & BrowseMode::Modules ) ) nId = bLoaded ? RID_BMP_DLGLIB : RID_BMP_DLGLIBNOTLOADED; else nId = bLoaded ? RID_BMP_MODLIB : RID_BMP_MODLIBNOTLOADED; @@ -282,7 +282,7 @@ void TreeListBox::ImpCreateLibEntries( SvTreeListEntry* pDocumentRootEntry, cons void TreeListBox::ImpCreateLibSubEntries( SvTreeListEntry* pLibRootEntry, const ScriptDocument& rDocument, const OUString& rLibName ) { // modules - if ( nMode & BROWSEMODE_MODULES ) + if ( nMode & BrowseMode::Modules ) { Reference< script::XLibraryContainer > xModLibContainer( rDocument.getLibraryContainer( E_SCRIPTS ) ); @@ -313,7 +313,7 @@ void TreeListBox::ImpCreateLibSubEntries( SvTreeListEntry* pLibRootEntry, const } // methods - if ( nMode & BROWSEMODE_SUBS ) + if ( nMode & BrowseMode::Subs ) { Sequence< OUString > aNames = GetMethodNames( rDocument, rLibName, aModName ); sal_Int32 nCount = aNames.getLength(); @@ -345,7 +345,7 @@ void TreeListBox::ImpCreateLibSubEntries( SvTreeListEntry* pLibRootEntry, const } // dialogs - if ( nMode & BROWSEMODE_DIALOGS ) + if ( nMode & BrowseMode::Dialogs ) { Reference< script::XLibraryContainer > xDlgLibContainer( rDocument.getLibraryContainer( E_DIALOGS ) ); @@ -469,7 +469,7 @@ void TreeListBox::ImpCreateLibSubSubEntriesInVBAMode( SvTreeListEntry* pLibSubRo } // methods - if ( nMode & BROWSEMODE_SUBS ) + if ( nMode & BrowseMode::Subs ) { Sequence< OUString > aNames = GetMethodNames( rDocument, rLibName, aModName ); sal_Int32 nCount = aNames.getLength(); @@ -716,9 +716,9 @@ void TreeListBox::SetEntryBitmaps( SvTreeListEntry * pEntry, const Image& rImage LibraryType TreeListBox::GetLibraryType() const { LibraryType eType = LibraryType::All; - if ( ( nMode & BROWSEMODE_MODULES ) && !( nMode & BROWSEMODE_DIALOGS ) ) + if ( ( nMode & BrowseMode::Modules ) && !( nMode & BrowseMode::Dialogs ) ) eType = LibraryType::Module; - else if ( !( nMode & BROWSEMODE_MODULES ) && ( nMode & BROWSEMODE_DIALOGS ) ) + else if ( !( nMode & BrowseMode::Modules ) && ( nMode & BrowseMode::Dialogs ) ) eType = LibraryType::Dialog; return eType; } diff --git a/basctl/source/basicide/bastype3.cxx b/basctl/source/basicide/bastype3.cxx index ddb7def..49e2281 100644 --- a/basctl/source/basicide/bastype3.cxx +++ b/basctl/source/basicide/bastype3.cxx @@ -105,7 +105,7 @@ void TreeListBox::RequestingChildren( SvTreeListEntry* pEntry ) ImpCreateLibSubEntries( pEntry, aDocument, aOULibName ); // exchange image - const bool bDlgMode = (nMode & BROWSEMODE_DIALOGS) && !(nMode & BROWSEMODE_MODULES); + const bool bDlgMode = (nMode & BrowseMode::Dialogs) && !(nMode & BrowseMode::Modules); Image aImage(BitmapEx(IDEResId(bDlgMode ? RID_BMP_DLGLIB : RID_BMP_MODLIB))); SetEntryBitmaps( pEntry, aImage ); } diff --git a/basctl/source/basicide/macrodlg.cxx b/basctl/source/basicide/macrodlg.cxx index e31f618..80c820e 100644 --- a/basctl/source/basicide/macrodlg.cxx +++ b/basctl/source/basicide/macrodlg.cxx @@ -97,7 +97,7 @@ MacroChooser::MacroChooser( vcl::Window* pParnt, const Reference< frame::XFrame m_pMacroBox->SetDoubleClickHdl( LINK( this, MacroChooser, MacroDoubleClickHdl ) ); m_pMacroBox->SetSelectHdl( LINK( this, MacroChooser, MacroSelectHdl ) ); - m_pBasicBox->SetMode( BROWSEMODE_MODULES ); + m_pBasicBox->SetMode( BrowseMode::Modules ); m_pBasicBox->SetStyle( WB_TABSTOP | WB_BORDER | WB_HASLINES | WB_HASLINESATROOT | WB_HASBUTTONS | WB_HASBUTTONSATROOT | diff --git a/basctl/source/basicide/moduldl2.cxx b/basctl/source/basicide/moduldl2.cxx index 38f326d..30f51a9 100644 --- a/basctl/source/basicide/moduldl2.cxx +++ b/basctl/source/basicide/moduldl2.cxx @@ -1525,8 +1525,8 @@ void createLibImpl( vcl::Window* pWin, const ScriptDocument& rDocument, pEntry = pBasicBox->GetParent( pEntry ); } - sal_uInt16 nMode = pBasicBox->GetMode(); - bool bDlgMode = ( nMode & BROWSEMODE_DIALOGS ) && !( nMode & BROWSEMODE_MODULES ); + BrowseMode nMode = pBasicBox->GetMode(); + bool bDlgMode = ( nMode & BrowseMode::Dialogs ) && !( nMode & BrowseMode::Modules ); const sal_uInt16 nId = bDlgMode ? RID_BMP_DLGLIB : RID_BMP_MODLIB; SvTreeListEntry* pNewLibEntry = pBasicBox->AddEntry( aLibName, diff --git a/basctl/source/basicide/moduldlg.cxx b/basctl/source/basicide/moduldlg.cxx index 1d46f11..0cce2ab 100644 --- a/basctl/source/basicide/moduldlg.cxx +++ b/basctl/source/basicide/moduldlg.cxx @@ -506,14 +506,14 @@ IMPL_LINK( OrganizeDialog, ActivatePageHdl, TabControl *, pTabCtrl, void ) VclPtr<TabPage> pNewTabPage; if (sPageName == "modules") { - VclPtrInstance<ObjectPage> pObjectPage(pTabCtrl, "ModulePage", BROWSEMODE_MODULES); + VclPtrInstance<ObjectPage> pObjectPage(pTabCtrl, "ModulePage", BrowseMode::Modules); pNewTabPage.reset(pObjectPage); pObjectPage->SetTabDlg(this); pObjectPage->SetCurrentEntry(m_aCurEntry); } else if (sPageName == "dialogs") { - VclPtrInstance<ObjectPage> pObjectPage( pTabCtrl, "DialogPage", BROWSEMODE_DIALOGS ); + VclPtrInstance<ObjectPage> pObjectPage( pTabCtrl, "DialogPage", BrowseMode::Dialogs ); pNewTabPage.reset(pObjectPage); pObjectPage->SetTabDlg(this); pObjectPage->SetCurrentEntry(m_aCurEntry); @@ -537,7 +537,7 @@ IMPL_LINK( OrganizeDialog, ActivatePageHdl, TabControl *, pTabCtrl, void ) // ObjectPage -ObjectPage::ObjectPage(vcl::Window *pParent, const OString &rName, sal_uInt16 nMode) +ObjectPage::ObjectPage(vcl::Window *pParent, const OString &rName, BrowseMode nMode) : TabPage(pParent, rName, "modules/BasicIDE/ui/" + OStringToOUString(rName, RTL_TEXTENCODING_UTF8).toAsciiLowerCase() + ".ui") @@ -557,12 +557,12 @@ ObjectPage::ObjectPage(vcl::Window *pParent, const OString &rName, sal_uInt16 nM m_pDelButton->SetClickHdl( LINK( this, ObjectPage, ButtonHdl ) ); m_pBasicBox->SetSelectHdl( LINK( this, ObjectPage, BasicBoxHighlightHdl ) ); - if( nMode & BROWSEMODE_MODULES ) + if( nMode & BrowseMode::Modules ) { m_pNewModButton->SetClickHdl( LINK( this, ObjectPage, ButtonHdl ) ); m_pNewDlgButton->Hide(); } - else if ( nMode & BROWSEMODE_DIALOGS ) + else if ( nMode & BrowseMode::Dialogs ) { m_pNewDlgButton->SetClickHdl( LINK( this, ObjectPage, ButtonHdl ) ); m_pNewModButton->Hide(); @@ -620,12 +620,12 @@ void ObjectPage::CheckButtons() OUString aLibName( aDesc.GetLibName() ); OUString aLibSubName( aDesc.GetLibSubName() ); bool bVBAEnabled = aDocument.isInVBAMode(); - sal_uInt16 nMode = m_pBasicBox->GetMode(); + BrowseMode nMode = m_pBasicBox->GetMode(); sal_uInt16 nDepth = pCurEntry ? m_pBasicBox->GetModel()->GetDepth( pCurEntry ) : 0; if ( nDepth >= 2 ) { - if( bVBAEnabled && ( nMode & BROWSEMODE_MODULES ) && ( nDepth == 2 ) ) + if( bVBAEnabled && ( nMode & BrowseMode::Modules ) && ( nDepth == 2 ) ) m_pEditButton->Disable(); else m_pEditButton->Enable(); @@ -660,7 +660,7 @@ void ObjectPage::CheckButtons() // enable/disable delete button if ( nDepth >= 2 && !bReadOnly && eLocation != LIBRARY_LOCATION_SHARE ) { - if( bVBAEnabled && ( nMode & BROWSEMODE_MODULES ) && ( ( nDepth == 2 ) || aLibSubName == IDE_RESSTR(RID_STR_DOCUMENT_OBJECTS) ) ) + if( bVBAEnabled && ( nMode & BrowseMode::Modules ) && ( ( nDepth == 2 ) || aLibSubName == IDE_RESSTR(RID_STR_DOCUMENT_OBJECTS) ) ) m_pDelButton->Disable(); else m_pDelButton->Enable(); diff --git a/basctl/source/basicide/moduldlg.hxx b/basctl/source/basicide/moduldlg.hxx index 500dc04..39bd7d8 100644 --- a/basctl/source/basicide/moduldlg.hxx +++ b/basctl/source/basicide/moduldlg.hxx @@ -199,7 +199,7 @@ protected: virtual void DeactivatePage() override; public: - ObjectPage(vcl::Window* pParent, const OString& rName, sal_uInt16 nMode); + ObjectPage(vcl::Window* pParent, const OString& rName, BrowseMode nMode); virtual ~ObjectPage() override; virtual void dispose() override; diff --git a/basctl/source/inc/bastype2.hxx b/basctl/source/inc/bastype2.hxx index 60a8bd5..a648018 100644 --- a/basctl/source/inc/bastype2.hxx +++ b/basctl/source/inc/bastype2.hxx @@ -30,11 +30,23 @@ #include <basic/sbstar.hxx> #include <sbxitem.hxx> #include "basobj.hxx" +#include <o3tl/typed_flags_set.hxx> class SbModule; class SvTreeListEntry; class SbxVariable; +enum class BrowseMode +{ + Modules = 0x01, + Subs = 0x02, + Dialogs = 0x04, + All = Modules | Subs | Dialogs, +}; +namespace o3tl { + template<> struct typed_flags<BrowseMode> : is_typed_flags<BrowseMode, 0x7> {}; +} + namespace basctl { @@ -52,13 +64,6 @@ enum EntryType OBJ_TYPE_CLASS_MODULES }; -enum -{ - BROWSEMODE_MODULES = 0x01, - BROWSEMODE_SUBS = 0x02, - BROWSEMODE_DIALOGS = 0x04, -}; - class Entry { private: @@ -172,7 +177,7 @@ public: class TreeListBox : public SvTreeListBox, public DocumentEventListener { private: - sal_uInt16 nMode; + BrowseMode nMode; DocumentEventNotifier m_aNotifier; void SetEntryBitmaps( SvTreeListEntry * pEntry, const Image& rImage ); virtual void MouseButtonDown( const MouseEvent& rMEvt ) override; @@ -213,8 +218,8 @@ public: bool IsEntryProtected( SvTreeListEntry* pEntry ); - void SetMode( sal_uInt16 nM ) { nMode = nM; } - sal_uInt16 GetMode() const { return nMode; } + void SetMode( BrowseMode nM ) { nMode = nM; } + BrowseMode GetMode() const { return nMode; } SbModule* FindModule( SvTreeListEntry* pEntry ); SbxVariable* FindVariable( SvTreeListEntry* pEntry ); commit 14fb8f7960249271fd73123c056057ce49980667 Author: Noel Grandin <[email protected]> Date: Thu Feb 16 15:20:10 2017 +0200 convert ObjectMode to scoped enum and drop unused Method enumerator Change-Id: I5ba25fbeaf67280f748acf8d84ab903a4c71e40b diff --git a/basctl/inc/basidesh.hrc b/basctl/inc/basidesh.hrc index fea24c0..66a5b67b 100644 --- a/basctl/inc/basidesh.hrc +++ b/basctl/inc/basidesh.hrc @@ -92,7 +92,7 @@ #define RID_STR_NOIMPORT ( RID_BASICIDE_START + 68 ) #define RID_STR_ENTERPASSWORD ( RID_BASICIDE_START + 69 ) -#define RID_STR_NEWMETH ( RID_BASICIDE_START + 71 ) +// free #define RID_STR_USERMACROS ( RID_BASICIDE_START + 72 ) #define RID_STR_USERDIALOGS ( RID_BASICIDE_START + 73 ) #define RID_STR_USERMACROSDIALOGS ( RID_BASICIDE_START + 74 ) diff --git a/basctl/source/basicide/moduldl2.cxx b/basctl/source/basicide/moduldl2.cxx index efeab63..38f326d 100644 --- a/basctl/source/basicide/moduldl2.cxx +++ b/basctl/source/basicide/moduldl2.cxx @@ -189,7 +189,7 @@ void CheckBox::Init() SetHighlightRange(); } -void CheckBox::SetMode (ObjectMode::Mode e) +void CheckBox::SetMode (ObjectMode e) { eMode = e; @@ -356,7 +356,7 @@ IMPL_LINK_NOARG(NewObjectDialog, OkButtonHandler, Button*, void) } } -NewObjectDialog::NewObjectDialog(vcl::Window * pParent, ObjectMode::Mode eMode, +NewObjectDialog::NewObjectDialog(vcl::Window * pParent, ObjectMode eMode, bool bCheckName) : ModalDialog(pParent, "NewLibDialog", "modules/BasicIDE/ui/newlibdialog.ui") { @@ -373,9 +373,6 @@ NewObjectDialog::NewObjectDialog(vcl::Window * pParent, ObjectMode::Mode eMode, case ObjectMode::Module: SetText( IDE_RESSTR(RID_STR_NEWMOD) ); break; - case ObjectMode::Method: - SetText( IDE_RESSTR(RID_STR_NEWMETH) ); - break; case ObjectMode::Dialog: SetText( IDE_RESSTR(RID_STR_NEWDLG) ); break; diff --git a/basctl/source/basicide/moduldlg.hxx b/basctl/source/basicide/moduldlg.hxx index c196c48..500dc04 100644 --- a/basctl/source/basicide/moduldlg.hxx +++ b/basctl/source/basicide/moduldlg.hxx @@ -34,16 +34,12 @@ class SvxPasswordDialog; namespace basctl { -namespace ObjectMode +enum class ObjectMode { - enum Mode - { - Library = 1, - Module = 2, - Dialog = 3, - Method = 4, - }; -} + Library = 1, + Module = 2, + Dialog = 3, +}; class NewObjectDialog : public ModalDialog { @@ -53,7 +49,7 @@ private: DECL_LINK(OkButtonHandler, Button*, void); public: - NewObjectDialog (vcl::Window* pParent, ObjectMode::Mode, bool bCheckName = false); + NewObjectDialog (vcl::Window* pParent, ObjectMode, bool bCheckName = false); virtual ~NewObjectDialog() override; virtual void dispose() override; OUString GetObjectName() const { return m_pEdit->GetText(); } @@ -118,7 +114,7 @@ public: class CheckBox : public SvTabListBox { private: - ObjectMode::Mode eMode; + ObjectMode eMode; SvLBoxButtonData* pCheckButton; ScriptDocument m_aDocument; void Init(); @@ -140,7 +136,7 @@ public: void SetDocument( const ScriptDocument& rDocument ) { m_aDocument = rDocument; } - void SetMode (ObjectMode::Mode); + void SetMode(ObjectMode); }; class LibDialog: public ModalDialog _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
