summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2017-03-09 13:08:45 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-03-13 08:38:33 +0000
commit7c0e3d0b37131b12262d0f610505b3384923c4a1 (patch)
tree572046e375af0e25864ff2e155a0fa0226bd4ca7 /sw/source
parent25ea809f5b4548ff887aa4bb10bbf7b2fe86aedb (diff)
convert GraphicDrawMode to scoped enum
Change-Id: I18eec89c4e1ebb86d64297e7cef4b36bf12df59f Reviewed-on: https://gerrit.libreoffice.org/35004 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/core/graphic/grfatr.cxx4
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx10
-rw-r--r--sw/source/filter/ww8/wrtw8esh.cxx21
-rw-r--r--sw/source/filter/ww8/ww8graf.cxx8
-rw-r--r--sw/source/uibase/shells/grfsh.cxx6
-rw-r--r--sw/source/uibase/utlui/attrdesc.cxx6
6 files changed, 28 insertions, 27 deletions
diff --git a/sw/source/core/graphic/grfatr.cxx b/sw/source/core/graphic/grfatr.cxx
index 8c38558036a3..626d596a5ebc 100644
--- a/sw/source/core/graphic/grfatr.cxx
+++ b/sw/source/core/graphic/grfatr.cxx
@@ -288,7 +288,7 @@ SfxPoolItem* SwDrawModeGrf::Clone( SfxItemPool * ) const
sal_uInt16 SwDrawModeGrf::GetValueCount() const
{
- return GRAPHICDRAWMODE_WATERMARK + 1;
+ return (sal_uInt16)GraphicDrawMode::Watermark + 1;
}
bool SwDrawModeGrf::QueryValue( uno::Any& rVal,
@@ -303,7 +303,7 @@ bool SwDrawModeGrf::PutValue( const uno::Any& rVal,
sal_uInt8 )
{
sal_Int32 eVal = SWUnoHelper::GetEnumAsInt32( rVal );
- if(eVal >= 0 && eVal <= GRAPHICDRAWMODE_WATERMARK)
+ if(eVal >= 0 && eVal <= (sal_uInt16)GraphicDrawMode::Watermark)
{
SetEnumValue((sal_uInt16)eVal);
return true;
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 7614eaf01a4a..011a9b1df464 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -4367,16 +4367,16 @@ void DocxAttributeOutput::FlyFrameGraphic( const SwGrfNode* pGrfNode, const Size
FSEND );
pItem = nullptr;
- sal_uInt32 nMode = GRAPHICDRAWMODE_STANDARD;
+ GraphicDrawMode nMode = GraphicDrawMode::Standard;
if ( pGrfNode && SfxItemState::SET == pGrfNode->GetSwAttrSet().GetItemState(RES_GRFATR_DRAWMODE, true, &pItem))
{
- nMode = static_cast<const SfxEnumItemInterface*>(pItem)->GetEnumValue();
- if (nMode == GRAPHICDRAWMODE_GREYS)
+ nMode = (GraphicDrawMode)static_cast<const SfxEnumItemInterface*>(pItem)->GetEnumValue();
+ if (nMode == GraphicDrawMode::Greys)
m_pSerializer->singleElementNS (XML_a, XML_grayscl, FSEND);
- else if (nMode == GRAPHICDRAWMODE_MONO) //black/white has a 0,5 threshold in LibreOffice
+ else if (nMode == GraphicDrawMode::Mono) //black/white has a 0,5 threshold in LibreOffice
m_pSerializer->singleElementNS (XML_a, XML_biLevel, XML_thresh, OString::number(50000), FSEND);
- else if (nMode == GRAPHICDRAWMODE_WATERMARK) //watermark has a brightness/luminance of 0,5 and contrast of -0.7 in LibreOffice
+ else if (nMode == GraphicDrawMode::Watermark) //watermark has a brightness/luminance of 0,5 and contrast of -0.7 in LibreOffice
m_pSerializer->singleElementNS( XML_a, XML_lum, XML_bright, OString::number(70000), XML_contrast, OString::number(-70000), FSEND );
}
m_pSerializer->endElementNS( XML_a, XML_blip );
diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx
index b6d7771cdcbe..85b129603b67 100644
--- a/sw/source/filter/ww8/wrtw8esh.cxx
+++ b/sw/source/filter/ww8/wrtw8esh.cxx
@@ -1743,7 +1743,7 @@ void SwBasicEscherEx::WriteGrfAttr(const SwNoTextNode& rNd, const SwFrameFormat&
EscherPropertyContainer& rPropOpt)
{
const SfxPoolItem* pItem;
- sal_uInt32 nMode = GRAPHICDRAWMODE_STANDARD;
+ GraphicDrawMode nMode = GraphicDrawMode::Standard;
sal_Int32 nContrast = 0;
sal_Int16 nBrightness = 0;
@@ -1762,8 +1762,8 @@ void SwBasicEscherEx::WriteGrfAttr(const SwNoTextNode& rNd, const SwFrameFormat&
if (SfxItemState::SET == rNd.GetSwAttrSet().GetItemState(RES_GRFATR_DRAWMODE,
true, &pItem))
{
- nMode = static_cast<const SfxEnumItemInterface*>(pItem)->GetEnumValue();
- if (nMode == GRAPHICDRAWMODE_WATERMARK)
+ nMode = (GraphicDrawMode)static_cast<const SfxEnumItemInterface*>(pItem)->GetEnumValue();
+ if (nMode == GraphicDrawMode::Watermark)
{
/*
There is no real watermark mode in word, we must use standard
@@ -1778,17 +1778,18 @@ void SwBasicEscherEx::WriteGrfAttr(const SwNoTextNode& rNd, const SwFrameFormat&
nContrast -= 70;
if (nContrast < -100)
nContrast = -100;
- nMode = GRAPHICDRAWMODE_STANDARD;
+ nMode = GraphicDrawMode::Standard;
}
}
- if (nMode == GRAPHICDRAWMODE_GREYS)
- nMode = 0x40004;
- else if (nMode == GRAPHICDRAWMODE_MONO)
- nMode = 0x60006;
+ sal_uInt32 nPictureMode;
+ if (nMode == GraphicDrawMode::Greys)
+ nPictureMode = 0x40004;
+ else if (nMode == GraphicDrawMode::Mono)
+ nPictureMode = 0x60006;
else
- nMode = 0;
- rPropOpt.AddOpt( ESCHER_Prop_pictureActive, nMode );
+ nPictureMode = 0;
+ rPropOpt.AddOpt( ESCHER_Prop_pictureActive, nPictureMode );
if (nContrast != 0)
{
diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx
index e0c5fd60a36f..929840197d46 100644
--- a/sw/source/filter/ww8/ww8graf.cxx
+++ b/sw/source/filter/ww8/ww8graf.cxx
@@ -1607,7 +1607,7 @@ sal_Int32 SwWW8ImplReader::MatchSdrBoxIntoFlyBoxItem(const Color& rLineColor,
return nOutsideThick;
}
-#define WW8ITEMVALUE(ItemSet,Id,Cast) static_cast<const Cast&>((ItemSet).Get(Id)).GetValue()
+#define WW8ITEMVALUE(ItemSet,Id,Cast) ItemSet.GetItem<Cast>(Id)->GetValue()
void SwWW8ImplReader::MatchSdrItemsIntoFlySet( SdrObject* pSdrObj,
SfxItemSet& rFlySet, MSO_LineStyle eLineStyle, MSO_LineDashing eDashing, MSO_SPT eShapeType,
@@ -2122,10 +2122,10 @@ SwWW8ImplReader::SetAttributesAtGrfNode(SvxMSDffImportRec const*const pRecord,
}
// drawmode
- if (WW8ITEMVALUE(rOldSet, SDRATTR_GRAFMODE, SdrGrafModeItem))
+ auto nGrafMode = rOldSet.GetItem<SdrGrafModeItem>(SDRATTR_GRAFMODE)->GetValue();
+ if ( nGrafMode != GraphicDrawMode::Standard)
{
- SwDrawModeGrf aDrawMode( static_cast< sal_uInt16 >(WW8ITEMVALUE(rOldSet,
- SDRATTR_GRAFMODE, SdrGrafModeItem)) );
+ SwDrawModeGrf aDrawMode( nGrafMode );
pGrfNd->SetAttr( aDrawMode );
}
}
diff --git a/sw/source/uibase/shells/grfsh.cxx b/sw/source/uibase/shells/grfsh.cxx
index 9f3cb37f5645..0405fc7a4b67 100644
--- a/sw/source/uibase/shells/grfsh.cxx
+++ b/sw/source/uibase/shells/grfsh.cxx
@@ -600,7 +600,7 @@ void SwGrfShell::ExecAttr( SfxRequest &rReq )
case SID_ATTR_GRAF_MODE:
if( pItem )
aGrfSet.Put( SwDrawModeGrf(
- static_cast<const SfxUInt16Item*>(pItem)->GetValue() ));
+ (GraphicDrawMode)static_cast<const SfxUInt16Item*>(pItem)->GetValue() ));
break;
case SID_COLOR_SETTINGS:
@@ -777,8 +777,8 @@ void SwGrfShell::GetAttrState(SfxItemSet &rSet)
case SID_ATTR_GRAF_MODE:
if( !bParentCntProt )
- rSet.Put( SfxUInt16Item( nWhich, static_cast<const SwDrawModeGrf&>(
- aCoreSet.Get(RES_GRFATR_DRAWMODE)).GetValue() ));
+ rSet.Put( SfxUInt16Item( nWhich, (sal_uInt16)static_cast<const SwDrawModeGrf&>(
+ aCoreSet.Get(RES_GRFATR_DRAWMODE)).GetValue() ));
break;
case SID_GRFFILTER:
diff --git a/sw/source/uibase/utlui/attrdesc.cxx b/sw/source/uibase/utlui/attrdesc.cxx
index 35ef94e4344d..b78f77f9d3eb 100644
--- a/sw/source/uibase/utlui/attrdesc.cxx
+++ b/sw/source/uibase/utlui/attrdesc.cxx
@@ -815,9 +815,9 @@ bool SwDrawModeGrf::GetPresentation(
switch ( GetValue() )
{
- case GRAPHICDRAWMODE_GREYS: nId = STR_DRAWMODE_GREY; break;
- case GRAPHICDRAWMODE_MONO: nId = STR_DRAWMODE_BLACKWHITE; break;
- case GRAPHICDRAWMODE_WATERMARK: nId = STR_DRAWMODE_WATERMARK; break;
+ case GraphicDrawMode::Greys: nId = STR_DRAWMODE_GREY; break;
+ case GraphicDrawMode::Mono: nId = STR_DRAWMODE_BLACKWHITE; break;
+ case GraphicDrawMode::Watermark: nId = STR_DRAWMODE_WATERMARK; break;
default: nId = STR_DRAWMODE_STD; break;
}
rText = SW_RESSTR( STR_DRAWMODE ) + SW_RESSTR( nId );