diff options
-rw-r--r-- | svx/source/svdraw/svdfmtf.cxx | 63 |
1 files changed, 32 insertions, 31 deletions
diff --git a/svx/source/svdraw/svdfmtf.cxx b/svx/source/svdraw/svdfmtf.cxx index 524d6cfcbb97..1397dffb6aae 100644 --- a/svx/source/svdraw/svdfmtf.cxx +++ b/svx/source/svdraw/svdfmtf.cxx @@ -1277,6 +1277,29 @@ void ImpSdrGDIMetaFileImport::DoAction(MetaMaskScalePartAction& rAct) InsertObj(pGraf); } +XGradientStyle getXGradientStyleFromGradientStyle(const GradientStyle& rGradientStyle) +{ + XGradientStyle aXGradientStyle(XGRAD_LINEAR); + + switch(rGradientStyle) + { + case GRADIENT_LINEAR: aXGradientStyle = XGRAD_LINEAR; break; + case GRADIENT_AXIAL: aXGradientStyle = XGRAD_AXIAL; break; + case GRADIENT_RADIAL: aXGradientStyle = XGRAD_RADIAL; break; + case GRADIENT_ELLIPTICAL: aXGradientStyle = XGRAD_ELLIPTICAL; break; + case GRADIENT_SQUARE: aXGradientStyle = XGRAD_SQUARE; break; + case GRADIENT_RECT: aXGradientStyle = XGRAD_RECT; break; + + // Needed due to GRADIENT_FORCE_EQUAL_SIZE; this again is needed + // to force the enum defines in VCL to a defined size for the compilers, + // so despite it is never used it cannot be removed (would break the + // API implementation probably). + default: break; + } + + return aXGradientStyle; +} + void ImpSdrGDIMetaFileImport::DoAction(MetaGradientAction& rAct) { basegfx::B2DRange aRange(rAct.GetRect().Left(), rAct.GetRect().Top(), rAct.GetRect().Right(), rAct.GetRect().Bottom()); @@ -1293,18 +1316,7 @@ void ImpSdrGDIMetaFileImport::DoAction(MetaGradientAction& rAct) ceil(aRange.getMaxX()), ceil(aRange.getMaxY()))); SfxItemSet aGradientAttr(mpModel->GetItemPool(), XATTR_FILLSTYLE, XATTR_FILLSTYLE, XATTR_FILLGRADIENT, XATTR_FILLGRADIENT, 0, 0); - XGradientStyle aXGradientStyle(XGRAD_LINEAR); - - switch(rGradient.GetStyle()) - { - case GRADIENT_LINEAR: aXGradientStyle = XGRAD_LINEAR; break; - case GRADIENT_AXIAL: aXGradientStyle = XGRAD_AXIAL; break; - case GRADIENT_RADIAL: aXGradientStyle = XGRAD_RADIAL; break; - case GRADIENT_ELLIPTICAL: aXGradientStyle = XGRAD_ELLIPTICAL; break; - case GRADIENT_SQUARE: aXGradientStyle = XGRAD_SQUARE; break; - case GRADIENT_RECT: aXGradientStyle = XGRAD_RECT; break; - } - + const XGradientStyle aXGradientStyle(getXGradientStyleFromGradientStyle(rGradient.GetStyle())); const XFillGradientItem aXFillGradientItem( &mpModel->GetItemPool(), XGradient( @@ -1328,7 +1340,7 @@ void ImpSdrGDIMetaFileImport::DoAction(MetaGradientAction& rAct) } } -void ImpSdrGDIMetaFileImport::DoAction(MetaWallpaperAction& rAct) +void ImpSdrGDIMetaFileImport::DoAction(MetaWallpaperAction& /*rAct*/) { OSL_ENSURE(false, "Tried to construct SdrObject from MetaWallpaperAction: not supported (!)"); } @@ -1350,12 +1362,12 @@ void ImpSdrGDIMetaFileImport::DoAction(MetaTransparentAction& rAct) } } -void ImpSdrGDIMetaFileImport::DoAction(MetaEPSAction& rAct) +void ImpSdrGDIMetaFileImport::DoAction(MetaEPSAction& /*rAct*/) { OSL_ENSURE(false, "Tried to construct SdrObject from MetaEPSAction: not supported (!)"); } -void ImpSdrGDIMetaFileImport::DoAction(MetaTextLineAction& rAct) +void ImpSdrGDIMetaFileImport::DoAction(MetaTextLineAction& /*rAct*/) { OSL_ENSURE(false, "Tried to construct SdrObject from MetaTextLineAction: not supported (!)"); } @@ -1374,18 +1386,7 @@ void ImpSdrGDIMetaFileImport::DoAction(MetaGradientExAction& rAct) const Gradient& rGradient = rAct.GetGradient(); SdrPathObj* pPath = new SdrPathObj(OBJ_POLY, aSource); SfxItemSet aGradientAttr(mpModel->GetItemPool(), XATTR_FILLSTYLE, XATTR_FILLSTYLE, XATTR_FILLGRADIENT, XATTR_FILLGRADIENT, 0, 0); - XGradientStyle aXGradientStyle(XGRAD_LINEAR); - - switch(rGradient.GetStyle()) - { - case GRADIENT_LINEAR: aXGradientStyle = XGRAD_LINEAR; break; - case GRADIENT_AXIAL: aXGradientStyle = XGRAD_AXIAL; break; - case GRADIENT_RADIAL: aXGradientStyle = XGRAD_RADIAL; break; - case GRADIENT_ELLIPTICAL: aXGradientStyle = XGRAD_ELLIPTICAL; break; - case GRADIENT_SQUARE: aXGradientStyle = XGRAD_SQUARE; break; - case GRADIENT_RECT: aXGradientStyle = XGRAD_RECT; break; - } - + const XGradientStyle aXGradientStyle(getXGradientStyleFromGradientStyle(rGradient.GetStyle())); const XFillGradientItem aXFillGradientItem( &mpModel->GetItemPool(), XGradient( @@ -1527,9 +1528,9 @@ void ImpSdrGDIMetaFileImport::DoAction(MetaFloatTransparentAction& rAct) { const double fOpNew(1.0 - fTransparence); - for(sal_uInt32 y(0); y < pOld->Height(); y++) + for(sal_uInt32 y(0); y < static_cast< sal_uInt32 >(pOld->Height()); y++) { - for(sal_uInt32 x(0); x < pOld->Width(); x++) + for(sal_uInt32 x(0); x < static_cast< sal_uInt32 >(pOld->Width()); x++) { const double fOpOld(1.0 - (pOld->GetPixel(y, x).GetIndex() * fFactor)); const sal_uInt8 aCol(basegfx::fround((1.0 - (fOpOld * fOpNew)) * 255.0)); @@ -1546,9 +1547,9 @@ void ImpSdrGDIMetaFileImport::DoAction(MetaFloatTransparentAction& rAct) { if(pOld->Width() == pNew->Width() && pOld->Height() == pNew->Height()) { - for(sal_uInt32 y(0); y < pOld->Height(); y++) + for(sal_uInt32 y(0); y < static_cast< sal_uInt32 >(pOld->Height()); y++) { - for(sal_uInt32 x(0); x < pOld->Width(); x++) + for(sal_uInt32 x(0); x < static_cast< sal_uInt32 >(pOld->Width()); x++) { const double fOpOld(1.0 - (pOld->GetPixel(y, x).GetIndex() * fFactor)); const double fOpNew(1.0 - (pNew->GetPixel(y, x).GetIndex() * fFactor)); |