diff options
author | Tomaž Vajngerl <quikee@gmail.com> | 2013-04-21 14:05:01 +0200 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2013-04-21 21:55:46 +0200 |
commit | 8ae05bf7a04c961d82c6436f9d299ff22e2cc05a (patch) | |
tree | 74801cc4abc7b03b3fb1c76e620a1adb9539add8 /vcl | |
parent | 29545247e4bab9f0e0acd7043bfc52880409a310 (diff) |
canBeRotated added to ask if native rotation can be performed.
The canBeRotated method was added to determine if a native rotation
can be performed for a graphics or not.
Change-Id: I026cf6fe4baa4d964d0a2c2b6e36c3b15aa91549
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/vcl/GraphicNativeTransform.hxx | 2 | ||||
-rw-r--r-- | vcl/source/filter/GraphicNativeTransform.cxx | 20 |
2 files changed, 21 insertions, 1 deletions
diff --git a/vcl/inc/vcl/GraphicNativeTransform.hxx b/vcl/inc/vcl/GraphicNativeTransform.hxx index 6bf83fec0afe..db727a22c5ff 100644 --- a/vcl/inc/vcl/GraphicNativeTransform.hxx +++ b/vcl/inc/vcl/GraphicNativeTransform.hxx @@ -27,13 +27,13 @@ class VCL_DLLPUBLIC GraphicNativeTransform Graphic& mrGraphic; bool rotateJPEG (sal_uInt16 aRotation); - bool rotateSVG (sal_uInt16 aRotation); bool rotateGeneric (sal_uInt16 aRotation, OUString aType); public: GraphicNativeTransform(Graphic& rGraphic); virtual ~GraphicNativeTransform(); + bool canBeRotated(); bool rotate(sal_uInt16 aRotation); }; diff --git a/vcl/source/filter/GraphicNativeTransform.cxx b/vcl/source/filter/GraphicNativeTransform.cxx index d6790031c3f0..cf24d6ab018a 100644 --- a/vcl/source/filter/GraphicNativeTransform.cxx +++ b/vcl/source/filter/GraphicNativeTransform.cxx @@ -35,6 +35,26 @@ GraphicNativeTransform::GraphicNativeTransform(Graphic& rGraphic) : GraphicNativeTransform::~GraphicNativeTransform() {} +bool GraphicNativeTransform::canBeRotated() +{ + GfxLink aLink = mrGraphic.GetLink(); + + // Don't allow rotation on animations for now + if (mrGraphic.IsAnimated()) + { + return false; + } + + if ( aLink.GetType() == GFX_LINK_TYPE_NATIVE_JPG + || aLink.GetType() == GFX_LINK_TYPE_NATIVE_PNG + || aLink.GetType() == GFX_LINK_TYPE_NATIVE_GIF) + { + return true; + } + + return false; +} + bool GraphicNativeTransform::rotate(sal_uInt16 aInputRotation) { // Rotation can be between 0 and 3600 |