[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - 2 commits - cui/source include/svx include/vcl svx/source vcl/source
Tomaž Vajngerl
quikee at gmail.com
Mon Jun 3 15:20:14 PDT 2013
cui/source/tabpages/transfrm.cxx | 2 +-
cui/source/tabpages/transfrm.src | 5 +++--
include/svx/dialcontrol.hxx | 10 ++++++++--
include/vcl/GraphicNativeTransform.hxx | 5 +++--
svx/source/dialog/dialcontrol.cxx | 15 ++++++++++-----
vcl/source/filter/GraphicNativeTransform.cxx | 21 ++++++++++++++++++++-
6 files changed, 45 insertions(+), 13 deletions(-)
New commits:
commit 4786d95b3187442ad2c3d0760e9bdcbc0a5e6825
Author: Tomaž Vajngerl <quikee at gmail.com>
Date: Mon Jun 3 22:11:34 2013 +0200
fdo#60120 Modify DialControl to store 100th degree angle.
DialControl internally stores the angle to a 100th of a degree
percision, but when SetRotation is called, the value was always
rounded to a 1 degree percision. This has now been modified to
round only on DialControl mouse interaction.
Additionally add add a parameter to SetLinkedField which states
the number of decimal places the NumericField is set to. This change
makes possible to set the NumericField to 100th of a Degree as the
internal angle is represented in. Default value is 0, so no change is
needed to existing DialControls.
Change-Id: I1f0c20092cdfccbd0878d7eb620bfdad7825b0fb
diff --git a/cui/source/tabpages/transfrm.cxx b/cui/source/tabpages/transfrm.cxx
index 9738521..a20ea83 100644
--- a/cui/source/tabpages/transfrm.cxx
+++ b/cui/source/tabpages/transfrm.cxx
@@ -235,7 +235,7 @@ SvxAngleTabPage::SvxAngleTabPage( Window* pParent, const SfxItemSet& rInAttrs )
aCtlRect.SetAccessibleRelationMemberOf(&aFlPosition);
aCtlAngle.SetAccessibleRelationLabeledBy(&aFtAnglePresets);
aCtlAngle.SetAccessibleRelationMemberOf(&aFlAngle);
- aCtlAngle.SetLinkedField( &maNfAngle );
+ aCtlAngle.SetLinkedField( &maNfAngle, 2 );
}
// -----------------------------------------------------------------------
diff --git a/cui/source/tabpages/transfrm.src b/cui/source/tabpages/transfrm.src
index b3220c8..69446b4 100644
--- a/cui/source/tabpages/transfrm.src
+++ b/cui/source/tabpages/transfrm.src
@@ -390,8 +390,9 @@ TabPage RID_SVXPAGE_ANGLE
Repeat = TRUE ;
Spin = TRUE ;
Minimum = 0 ;
- Maximum = 359 ;
- SpinSize = 5 ;
+ Maximum = 35999 ;
+ DecimalDigits = 2 ;
+ SpinSize = 10 ;
};
FixedText FT_ANGLEPRESETS
{
diff --git a/include/svx/dialcontrol.hxx b/include/svx/dialcontrol.hxx
index 342a384..84dc1dc 100644
--- a/include/svx/dialcontrol.hxx
+++ b/include/svx/dialcontrol.hxx
@@ -109,8 +109,13 @@ public:
/** Sets the rotation to the passed value (in 1/100 degrees). */
void SetRotation( sal_Int32 nAngle );
- /** Links the passed numeric edit field to the control (bi-directional). */
- void SetLinkedField( NumericField* pField );
+ /** Links the passed numeric edit field to the control (bi-directional).
+ * nDecimalPlaces:
+ * field value is usign given decimal places
+ * default is 0 which means field values are in degrees,
+ * 2 means 100th of degree
+ */
+ void SetLinkedField( NumericField* pField, sal_Int32 nDecimalPlaces = 0);
/** Returns the linked numeric edit field, or 0. */
NumericField* GetLinkedField() const;
@@ -133,6 +138,7 @@ protected:
::boost::scoped_ptr<DialControlBmp> mpBmpBuffered;
Link maModifyHdl;
NumericField* mpLinkField;
+ sal_Int32 mnLinkedFieldValueMultiplyer;
Size maWinSize;
Font maWinFont;
sal_Int32 mnAngle;
diff --git a/svx/source/dialog/dialcontrol.cxx b/svx/source/dialog/dialcontrol.cxx
index 080b0b3..4b26222 100644
--- a/svx/source/dialog/dialcontrol.cxx
+++ b/svx/source/dialog/dialcontrol.cxx
@@ -388,8 +388,10 @@ void DialControl::SetRotation( sal_Int32 nAngle )
SetRotation( nAngle, false );
}
-void DialControl::SetLinkedField( NumericField* pField )
+void DialControl::SetLinkedField( NumericField* pField, sal_Int32 nDecimalPlaces )
{
+ mpImpl->mnLinkedFieldValueMultiplyer = 100 / pow(10, nDecimalPlaces);
+
// remove modify handler from old linked field
ImplSetFieldLink( Link() );
// remember the new linked field
@@ -453,14 +455,15 @@ void DialControl::SetRotation( sal_Int32 nAngle, bool bBroadcast )
bool bOldSel = mpImpl->mbNoRot;
mpImpl->mbNoRot = false;
- while( nAngle < 0 ) nAngle += 36000;
- nAngle = (((nAngle + 50) / 100) * 100) % 36000;
+ while( nAngle < 0 )
+ nAngle += 36000;
+
if( !bOldSel || (mpImpl->mnAngle != nAngle) )
{
mpImpl->mnAngle = nAngle;
InvalidateControl();
if( mpImpl->mpLinkField )
- mpImpl->mpLinkField->SetValue( static_cast< long >( GetRotation() / 100 ) );
+ mpImpl->mpLinkField->SetValue( static_cast< long >( GetRotation() / mpImpl->mnLinkedFieldValueMultiplyer ) );
if( bBroadcast )
mpImpl->maModifyHdl.Call( this );
}
@@ -493,6 +496,8 @@ void DialControl::HandleMouseEvent( const Point& rPos, bool bInitial )
nAngle = 36000 - nAngle;
if( bInitial ) // round to entire 15 degrees
nAngle = ((nAngle + 750) / 1500) * 1500;
+ // Round up to 1 degree
+ nAngle = (((nAngle + 50) / 100) * 100) % 36000;
SetRotation( nAngle, true );
}
}
@@ -511,7 +516,7 @@ void DialControl::HandleEscapeEvent()
IMPL_LINK( DialControl, LinkedFieldModifyHdl, NumericField*, pField )
{
if( pField )
- SetRotation( static_cast< sal_Int32 >( pField->GetValue() * 100 ), false );
+ SetRotation( static_cast< sal_Int32 >( pField->GetValue() * mpImpl->mnLinkedFieldValueMultiplyer ), false );
return 0;
}
commit 01c5c1de3acc9039fabef1fa03d171fa1a75a702
Author: Tomaž Vajngerl <quikee at gmail.com>
Date: Mon Jun 3 23:39:30 2013 +0200
fdo#34423 Allow to rotate raw uncompressed bitmaps.
When using a graphic filter like blur or sharpen, a raw uncompressed
bitmap is created. Until now it was not possible to rotate such bitmap
but now this is allowed.
Change-Id: I716fa46e37680b1111131586fad20da28391de14
diff --git a/include/vcl/GraphicNativeTransform.hxx b/include/vcl/GraphicNativeTransform.hxx
index db727a2..4739e97 100644
--- a/include/vcl/GraphicNativeTransform.hxx
+++ b/include/vcl/GraphicNativeTransform.hxx
@@ -26,8 +26,9 @@ class VCL_DLLPUBLIC GraphicNativeTransform
{
Graphic& mrGraphic;
- bool rotateJPEG (sal_uInt16 aRotation);
- bool rotateGeneric (sal_uInt16 aRotation, OUString aType);
+ bool rotateBitmapOnly (sal_uInt16 aRotation);
+ bool rotateJPEG (sal_uInt16 aRotation);
+ bool rotateGeneric (sal_uInt16 aRotation, OUString aType);
public:
GraphicNativeTransform(Graphic& rGraphic);
diff --git a/vcl/source/filter/GraphicNativeTransform.cxx b/vcl/source/filter/GraphicNativeTransform.cxx
index 7b3f640..261ad90 100644
--- a/vcl/source/filter/GraphicNativeTransform.cxx
+++ b/vcl/source/filter/GraphicNativeTransform.cxx
@@ -47,7 +47,8 @@ bool GraphicNativeTransform::canBeRotated()
if ( aLink.GetType() == GFX_LINK_TYPE_NATIVE_JPG
|| aLink.GetType() == GFX_LINK_TYPE_NATIVE_PNG
- || aLink.GetType() == GFX_LINK_TYPE_NATIVE_GIF)
+ || aLink.GetType() == GFX_LINK_TYPE_NATIVE_GIF
+ || aLink.GetType() == GFX_LINK_TYPE_NONE)
{
return true;
}
@@ -82,9 +83,27 @@ bool GraphicNativeTransform::rotate(sal_uInt16 aInputRotation)
{
return rotateGeneric(aRotation, OUString("gif"));
}
+ else if ( aLink.GetType() == GFX_LINK_TYPE_NONE )
+ {
+ return rotateBitmapOnly(aRotation);
+ }
return false;
}
+bool GraphicNativeTransform::rotateBitmapOnly(sal_uInt16 aRotation)
+{
+ if (mrGraphic.IsAnimated())
+ {
+ return false;
+ }
+
+ BitmapEx aBitmap = mrGraphic.GetBitmapEx();
+ aBitmap.Rotate(aRotation, COL_BLACK);
+ mrGraphic = aBitmap;
+
+ return true;
+}
+
bool GraphicNativeTransform::rotateGeneric(sal_uInt16 aRotation, OUString aType)
{
// Can't rotate animations yet
More information about the Libreoffice-commits
mailing list