RotGrfFlyFrame: Initial adaptions

To allow free rotation of Graphic FlyFrames in Writer,
several adaptions are necessary. This change takes care
of all needed changes to internally support a freely
definable rotation angle for that case. Save/Load round
trip is working, the graphic does no longer get modified
and added in 90-degree-changed state to the object, the
original will be preserved. Support for needed slot in
core/ui is implemented. Rotation can be applied from
Menus/Toolbars in the known 90/180 degree steps. Added
a slot/Button/command to reset rotation in these cases.
Added support in Sidebar to rotate using the rotation
wheel and/or numeric field. These fields and support added
to Image TabPage, too, fully functional.
Missing now is a solution for displaying the rotated
Graphic. For now, it just gets rotated, but this will not
be the final state of this change.

Change-Id: I6f3b85ebb5be2b4ad3311c536d54f27a37a494e7

RotGrfFlyFrame: Linux build adaptions

Change-Id: I365287ecd6525b1972e8436d61332f7121d88649
diff --git a/include/svx/svxids.hrc b/include/svx/svxids.hrc
index 8410328..79ebc50 100644
--- a/include/svx/svxids.hrc
+++ b/include/svx/svxids.hrc
@@ -919,7 +919,7 @@
#define SID_ROTATE_GRAPHIC_LEFT                         ( SID_SVX_START + 1121 )
#define SID_ROTATE_GRAPHIC_RIGHT                        ( SID_SVX_START + 1122 )
#define SID_ROTATE_GRAPHIC_180                          ( SID_SVX_START + 1123 )

#define SID_ROTATE_GRAPHIC_RESET                        ( SID_SVX_START + 1092 ) /* RotGrfFlyFrame: new slot */

// new slots for panels
#define SID_ATTR_FILL_TRANSPARENCE                      ( SID_SVX_START + 1124 )
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
index 5803979..52fec07 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
@@ -983,6 +983,14 @@
          <value>1</value>
        </prop>
      </node>
      <node oor:name=".uno:RotateReset" oor:op="replace">
        <prop oor:name="Label" oor:type="xs:string">
          <value xml:lang="en-US">Reset R~otation</value>
        </prop>
        <prop oor:name="Properties" oor:type="xs:int">
          <value>1</value>
        </prop>
      </node>
      <node oor:name=".uno:NewHtmlDoc" oor:op="replace">
        <prop oor:name="Label" oor:type="xs:string">
          <value xml:lang="en-US">Create ~HTML Document</value>
diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi
index 932aef3..acd7f4c9 100644
--- a/svx/sdi/svx.sdi
+++ b/svx/sdi/svx.sdi
@@ -4305,6 +4305,23 @@ SfxVoidItem RotateRight SID_ROTATE_GRAPHIC_RIGHT
    GroupId = SfxGroupId::Graphic;
]

SfxVoidItem RotateReset SID_ROTATE_GRAPHIC_RESET

[
    AutoUpdate = FALSE,
    FastCall = FALSE,
    ReadOnlyDoc = TRUE,
    Toggle = FALSE,
    Container = FALSE,
    RecordAbsolute = FALSE,
    RecordPerSet;

    AccelConfig = TRUE,
    MenuConfig = TRUE,
    ToolBoxConfig = TRUE,
    GroupId = SfxGroupId::Graphic;
]

SfxBoolItem Crop SID_OBJECT_CROP
()
[
diff --git a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
index ab27b80..3895b2a 100644
--- a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
+++ b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
@@ -270,6 +270,7 @@ void PosSizePropertyPanel::HandleContextChange(

        case CombinedEnumContext(Application::WriterVariants, Context::Graphic):
            bShowFlip = true;
            bShowAngle = true; // RotGrfFlyFrame: Writer FlyFrames for Graphics now support angle
            break;

        case CombinedEnumContext(Application::Calc, Context::Draw):
diff --git a/sw/sdi/_grfsh.sdi b/sw/sdi/_grfsh.sdi
index 1dc4536..8291745 100644
--- a/sw/sdi/_grfsh.sdi
+++ b/sw/sdi/_grfsh.sdi
@@ -94,6 +94,20 @@ interface BaseTextGraphic
        DisableFlags="SfxDisableFlags::SwOnProtectedCursor";
    ]

    SID_ROTATE_GRAPHIC_RESET
    [
        ExecMethod = ExecuteRotation ;
        StateMethod = GetAttrStateForRotation ;
        DisableFlags="SfxDisableFlags::SwOnProtectedCursor";
    ]

    SID_ATTR_TRANSFORM_ANGLE
    [
        ExecMethod = ExecuteRotation ;
        StateMethod = GetAttrStateForRotation ;
        DisableFlags="SfxDisableFlags::SwOnProtectedCursor";
    ]

    SID_OBJECT_CROP
    [
        ExecMethod = Execute ;
diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx
index c4791e0..a35f679 100644
--- a/sw/source/core/doc/notxtfrm.cxx
+++ b/sw/source/core/doc/notxtfrm.cxx
@@ -768,10 +768,21 @@ void paintGraphicUsingPrimitivesHelper(vcl::RenderContext & rOutputDevice,
    const basegfx::B2DRange aTargetRange(
        rAlignedGrfArea.Left(), rAlignedGrfArea.Top(),
        rAlignedGrfArea.Right(), rAlignedGrfArea.Bottom());
    const basegfx::B2DHomMatrix aTargetTransform(
        basegfx::utils::createScaleTranslateB2DHomMatrix(
            aTargetRange.getRange(),
            aTargetRange.getMinimum()));
    basegfx::B2DHomMatrix aTargetTransform;

    // RotGrfFlyFrame: Take rotation into account. Rotation is in 10th degrees
    if(0 != rGraphicAttr.GetRotation())
    {
        const double fRotate(static_cast< double >(-rGraphicAttr.GetRotation()) * (M_PI/1800.0));
        aTargetTransform.translate(-0.5, -0.5);
        aTargetTransform.rotate(fRotate);
        aTargetTransform.translate(0.5, 0.5);
    }

    // needed scale/translate
    aTargetTransform *= basegfx::utils::createScaleTranslateB2DHomMatrix(
        aTargetRange.getRange(),
        aTargetRange.getMinimum());

    drawinglayer::primitive2d::Primitive2DContainer aContent(1);
    bool bDone(false);
diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx
index e365954..f1abe60 100644
--- a/sw/source/ui/frmdlg/frmpage.cxx
+++ b/sw/source/ui/frmdlg/frmpage.cxx
@@ -2388,6 +2388,12 @@ SwGrfExtPage::SwGrfExtPage(vcl::Window *pParent, const SfxItemSet &rSet)
    get(m_pBmpWin, "preview");
    m_pBmpWin->SetBitmapEx(get<FixedImage>("fallback")->GetImage().GetBitmapEx());

    // RotGrfFlyFrame: Need Angle and RotateControls now
    get(m_pFlAngle, "FL_ANGLE");
    get(m_pNfAngle, "NF_ANGLE");
    get(m_pCtlAngle, "CTL_ANGLE");
    m_pCtlAngle->SetLinkedField( m_pNfAngle, 2 );

    SetExchangeSupport();
    m_pMirrorHorzBox->SetClickHdl( LINK(this, SwGrfExtPage, MirrorHdl));
    m_pMirrorVertBox->SetClickHdl( LINK(this, SwGrfExtPage, MirrorHdl));
@@ -2411,6 +2417,12 @@ void SwGrfExtPage::dispose()
    m_pBmpWin.clear();
    m_pConnectED.clear();
    m_pBrowseBT.clear();

    // RotGrfFlyFrame: Support RotationAngle
    m_pFlAngle.clear();
    m_pNfAngle.clear();
    m_pCtlAngle.clear();

    SfxTabPage::dispose();
}

@@ -2432,6 +2444,17 @@ void SwGrfExtPage::Reset(const SfxItemSet *rSet)
        m_pConnectED->SetReadOnly(false);
    }

    // RotGrfFlyFrame: Get RotationAngle and set at control
    if(SfxItemState::SET == rSet->GetItemState( SID_ATTR_TRANSFORM_ANGLE, false, &pItem))
    {
        m_pCtlAngle->SetRotation(static_cast<const SfxInt32Item*>(pItem)->GetValue());
    }
    else
    {
        m_pCtlAngle->SetRotation(0);
    }
    m_pCtlAngle->SaveValue();

    ActivatePage(*rSet);
}

@@ -2559,6 +2582,14 @@ bool SwGrfExtPage::FillItemSet( SfxItemSet *rSet )
        rSet->Put( SvxBrushItem( aGrfName, aFilterName, GPOS_LT,
                                SID_ATTR_GRAF_GRAPHIC ));
    }

    // RotGrfFlyFrame: Safe rotation if modified
    if(m_pCtlAngle->IsValueModified())
    {
        rSet->Put(SfxInt32Item(GetWhich(SID_ATTR_TRANSFORM_ANGLE), m_pCtlAngle->GetRotation()));
        bModified = true;
    }

    return bModified;
}

diff --git a/sw/source/uibase/frmdlg/frmmgr.cxx b/sw/source/uibase/frmdlg/frmmgr.cxx
index 73df037..fdc883b6 100644
--- a/sw/source/uibase/frmdlg/frmmgr.cxx
+++ b/sw/source/uibase/frmdlg/frmmgr.cxx
@@ -41,6 +41,7 @@
#include <com/sun/star/text/HoriOrientation.hpp>
#include <com/sun/star/text/VertOrientation.hpp>
#include <com/sun/star/text/RelOrientation.hpp>
#include <grfatr.hxx>

using namespace ::com::sun::star;

@@ -568,6 +569,16 @@ void SwFlyFrameAttrMgr::SetHeightSizeType( SwFrameSize eType )
    m_aSet.Put( aSize );
}

void SwFlyFrameAttrMgr::SetRotation(sal_uInt32 nOld, sal_uInt32 nNew, Size aUnrotatedSize)
{
    // RotGrfFlyFrame: Central handling of real change of rotation here. Adaption of pos/size
    // may be wanted in the future
    if(nOld != nNew)
    {
        m_pOwnSh->SetAttrItem(SwRotationGrf(static_cast<sal_uInt16>(nNew), aUnrotatedSize));
    }
}

void SwFlyFrameAttrMgr::SetSize( const Size& rSize )
{
    SwFormatFrameSize aSize( GetFrameSize() );
diff --git a/sw/source/uibase/inc/frmmgr.hxx b/sw/source/uibase/inc/frmmgr.hxx
index 43a0d05..cdc3680 100644
--- a/sw/source/uibase/inc/frmmgr.hxx
+++ b/sw/source/uibase/inc/frmmgr.hxx
@@ -92,6 +92,9 @@ public:

    void                SetHeightSizeType(SwFrameSize eType);

    // rotation
    void                SetRotation(sal_uInt32 nOld, sal_uInt32 nNew, Size aUnrotatedSize);

    // space to content
    void                SetLRSpace( long nLeft,
                                    long nRight );
diff --git a/sw/source/uibase/inc/frmpage.hxx b/sw/source/uibase/inc/frmpage.hxx
index 870ad08..45c5fd0 100644
--- a/sw/source/uibase/inc/frmpage.hxx
+++ b/sw/source/uibase/inc/frmpage.hxx
@@ -31,6 +31,7 @@
#include <svx/swframeexample.hxx>
#include <prcntfld.hxx>
#include <globals.hrc>
#include <svx/dialcontrol.hxx>

namespace sfx2{class FileDialogHelper;}
class SwWrtShell;
@@ -212,6 +213,11 @@ class SwGrfExtPage: public SfxTabPage
    VclPtr<Edit>           m_pConnectED;
    VclPtr<PushButton>     m_pBrowseBT;

    // RotGrfFlyFrame: Need Angle and RotateControls now
    VclPtr<VclFrame>            m_pFlAngle;
    VclPtr<NumericField>        m_pNfAngle;
    VclPtr<svx::DialControl>    m_pCtlAngle;

    OUString        aFilterName;
    OUString        aGrfName, aNewGrfName;

diff --git a/sw/source/uibase/shells/frmsh.cxx b/sw/source/uibase/shells/frmsh.cxx
index c995c01..9e4761c 100644
--- a/sw/source/uibase/shells/frmsh.cxx
+++ b/sw/source/uibase/shells/frmsh.cxx
@@ -85,6 +85,7 @@
#define SwFrameShell
#include <sfx2/msg.hxx>
#include <swslots.hxx>
#include <grfatr.hxx>

using ::editeng::SvxBorderLine;
using namespace ::com::sun::star;
@@ -363,6 +364,22 @@ void SwFrameShell::Execute(SfxRequest &rReq)
                bApplyNewSize = true;
            }

            // RotGrfFlyFrame: Get Value and disable is in SwGrfShell::GetAttrStateForRotation, but the
            // value setter uses SID_ATTR_TRANSFORM and a group of three values. Rotation is
            // added now, so use it in this central place. Do no forget to convert angle from
            // 100th degrees in SID_ATTR_TRANSFORM_ANGLE to 10th degrees in RES_GRFATR_ROTATION
            if (pArgs && SfxItemState::SET == pArgs->GetItemState(SID_ATTR_TRANSFORM_ANGLE, false, &pItem))
            {
                const sal_uInt32 nNewRot(static_cast<const SfxUInt32Item*>(pItem)->GetValue() / 10);
                SfxItemSet aSet(rSh.GetAttrPool(), svl::Items<RES_GRFATR_ROTATION, RES_GRFATR_ROTATION>{} );
                rSh.GetCurAttr(aSet);
                const SwRotationGrf& rRotation = static_cast<const SwRotationGrf&>(aSet.Get(RES_GRFATR_ROTATION));
                const sal_uInt32 nOldRot(rRotation.GetValue());

                // RotGrfFlyFrame: Rotation change here, SwFlyFrameAttrMgr aMgr is available
                aMgr.SetRotation(nOldRot, nNewRot, rRotation.GetUnrotatedSize());
            }

            if ( bApplyNewSize )
            {
                aMgr.SetSize( aNewSize );
diff --git a/sw/source/uibase/shells/grfsh.cxx b/sw/source/uibase/shells/grfsh.cxx
index dafb8d4..7b2e034 100644
--- a/sw/source/uibase/shells/grfsh.cxx
+++ b/sw/source/uibase/shells/grfsh.cxx
@@ -68,7 +68,7 @@
#include <svx/graphichelper.hxx>
#include <doc.hxx>
#include <IDocumentDrawModelAccess.hxx>

//#include <svx/svxids.hrc>
#include <svx/drawitem.hxx>
#define SwGrfShell

@@ -259,15 +259,17 @@ void SwGrfShell::Execute(SfxRequest &rReq)
                    SID_DOCFRAME, SID_DOCFRAME,
                    SID_REFERER, SID_REFERER,
                    SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER,
                    SID_ATTR_PAGE_SIZE, SID_ATTR_PAGE_SIZE,
                    SID_ATTR_PAGE_SIZE, SID_ATTR_PAGE_SIZE, // 10051
                    // RotGrfFlyFrame: Need RotationAngle now
                    SID_ATTR_TRANSFORM_ANGLE, SID_ATTR_TRANSFORM_ANGLE, // 10095
                    // Items to hand over XPropertyList things like
                    // XColorList, XHatchList, XGradientList, and XBitmapList to
                    // the Area TabPage:
                    SID_COLOR_TABLE, SID_PATTERN_LIST,
                    SID_HTML_MODE, SID_HTML_MODE,
                    SID_ATTR_GRAF_KEEP_ZOOM, SID_ATTR_GRAF_KEEP_ZOOM,
                    SID_ATTR_GRAF_FRMSIZE, SID_ATTR_GRAF_GRAPHIC,
                        // contains SID_ATTR_GRAF_FRMSIZE_PERCENT
                    SID_COLOR_TABLE, SID_PATTERN_LIST,  //10179
                    SID_HTML_MODE, SID_HTML_MODE,   //10414
                    SID_ATTR_GRAF_KEEP_ZOOM, SID_ATTR_GRAF_KEEP_ZOOM,   //10882
                    SID_ATTR_GRAF_FRMSIZE, SID_ATTR_GRAF_GRAPHIC,   // 10884
                    // contains SID_ATTR_GRAF_FRMSIZE_PERCENT
                    FN_GET_PRINT_AREA, FN_GET_PRINT_AREA,
                    FN_PARAM_GRF_CONNECT, FN_PARAM_GRF_CONNECT,
                    FN_PARAM_GRF_DIALOG, FN_PARAM_GRF_DIALOG,
@@ -375,6 +377,19 @@ void SwGrfShell::Execute(SfxRequest &rReq)
                    SfxStringItem(SID_REFERER, sh->GetMedium()->GetName()));
            }

            Size aUnrotatedSize;
            sal_uInt16 nCurrentRotation(0);
            {   // RotGrfFlyFrame: Add current RotationAngle value, convert from
                // RES_GRFATR_ROTATION to SID_ATTR_TRANSFORM_ANGLE. Do not forget to
                // convert from 10th degrees to 100th degrees
                SfxItemSet aTmpSet( rSh.GetAttrPool(), svl::Items<RES_GRFATR_ROTATION, RES_GRFATR_ROTATION>{} );
                rSh.GetCurAttr( aTmpSet );
                const SwRotationGrf& rRotation = static_cast<const SwRotationGrf&>(aTmpSet.Get(RES_GRFATR_ROTATION));
                nCurrentRotation = rRotation.GetValue();
                aUnrotatedSize = rRotation.GetUnrotatedSize();
                aSet.Put(SfxInt32Item(SID_ATTR_TRANSFORM_ANGLE, nCurrentRotation * 10));
            }

            SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
            OSL_ENSURE(pFact, "no dialog factory!");
            ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateFrameTabDialog("PictureDialog",
@@ -489,6 +504,15 @@ void SwGrfShell::Execute(SfxRequest &rReq)
                                        FN_UNO_DESCRIPTION, true, &pItem ))
                    rSh.SetObjDescription( static_cast<const SfxStringItem*>(pItem)->GetValue() );

                // RotGrfFlyFrame: Get and process evtl. changed RotationAngle
                if ( SfxItemState::SET == pSet->GetItemState(SID_ATTR_TRANSFORM_ANGLE, false, &pItem ))
                {
                    const sal_uInt32 aNewRotation((static_cast<const SfxUInt32Item*>(pItem)->GetValue() / 10) % 3600);

                    // RotGrfFlyFrame: Possible rotation change here, SwFlyFrameAttrMgr aMgr is available
                    aMgr.SetRotation(nCurrentRotation, aNewRotation, aUnrotatedSize);
                }

                SfxItemSet aGrfSet( rSh.GetAttrPool(), svl::Items<RES_GRFATR_BEGIN,
                                                       RES_GRFATR_END-1>{} );
                aGrfSet.Put( *pSet );
@@ -868,9 +892,14 @@ void SwGrfShell::GetAttrState(SfxItemSet &rSet)

void SwGrfShell::ExecuteRotation(SfxRequest const &rReq)
{
    sal_uInt16 aRotation;

    // RotGrfFlyFrame: Modify rotation attribute instead of manipulating the graphic
    SwWrtShell& rShell = GetShell();
    SfxItemSet aSet( rShell.GetAttrPool(), svl::Items<
        RES_GRFATR_ROTATION, RES_GRFATR_ROTATION,
        SID_ATTR_TRANSFORM_ANGLE, SID_ATTR_TRANSFORM_ANGLE>{} );
    rShell.GetCurAttr( aSet );
    const SwRotationGrf& rRotation = static_cast<const SwRotationGrf&>(aSet.Get(RES_GRFATR_ROTATION));
    sal_uInt16 aRotation(0);

    if (rReq.GetSlot() == SID_ROTATE_GRAPHIC_LEFT)
    {
@@ -884,59 +913,26 @@ void SwGrfShell::ExecuteRotation(SfxRequest const &rReq)
    {
        aRotation = 1800;
    }
    else

    if (rReq.GetSlot() == SID_ROTATE_GRAPHIC_RESET || 0 != aRotation)
    {
        return;
        rShell.StartAllAction();
        rShell.StartUndo(SwUndoId::START);

        if (rReq.GetSlot() == SID_ROTATE_GRAPHIC_RESET)
        {
            rShell.SetAttrItem(SwRotationGrf(0, rRotation.GetUnrotatedSize()));
        }
        else if(0 != aRotation)
        {
            sal_uInt16 aNewRotation((aRotation + rRotation.GetValue()) % 3600);

            rShell.SetAttrItem(SwRotationGrf(aNewRotation, rRotation.GetUnrotatedSize()));
        }

        rShell.EndUndo(SwUndoId::END);
        rShell.EndAllAction();
    }

    rShell.StartAllAction();
    rShell.StartUndo(SwUndoId::START);

    Graphic aGraphic = *rShell.GetGraphic();
    GraphicNativeTransform aTransform(aGraphic);
    aTransform.rotate(aRotation);
    rShell.ReRead(OUString(), OUString(), const_cast<const Graphic*>(&aGraphic));

    SwFlyFrameAttrMgr aManager(false, &rShell, rShell.IsFrameSelected() ? Frmmgr_Type::NONE : Frmmgr_Type::GRF);

    long nRotatedWidth = aManager.GetSize().Height();
    long nRotatedHeight = aManager.GetSize().Width();
    if (rReq.GetSlot() == SID_ROTATE_GRAPHIC_180)
      std::swap(nRotatedWidth, nRotatedHeight);
    Size aSize(nRotatedWidth, nRotatedHeight);
    aManager.SetSize(aSize);
    aManager.UpdateFlyFrame();
    SfxItemSet aSet( rShell.GetAttrPool(), svl::Items<RES_GRFATR_CROPGRF, RES_GRFATR_CROPGRF>{} );
    rShell.GetCurAttr( aSet );
    SwCropGrf aCrop( static_cast<const SwCropGrf&>( aSet.Get(RES_GRFATR_CROPGRF) ) );
    tools::Rectangle aCropRectangle(aCrop.GetLeft(),  aCrop.GetTop(), aCrop.GetRight(), aCrop.GetBottom());

    if (rReq.GetSlot() == SID_ROTATE_GRAPHIC_LEFT)
    {
        aCrop.SetLeft(   aCropRectangle.Top()    );
        aCrop.SetTop(    aCropRectangle.Right()  );
        aCrop.SetRight(  aCropRectangle.Bottom() );
        aCrop.SetBottom( aCropRectangle.Left()   );
    }
    else if (rReq.GetSlot() == SID_ROTATE_GRAPHIC_RIGHT)
    {
        aCrop.SetLeft(   aCropRectangle.Bottom() );
        aCrop.SetTop(    aCropRectangle.Left()   );
        aCrop.SetRight(  aCropRectangle.Top()    );
        aCrop.SetBottom( aCropRectangle.Right()  );
    }
    else if (rReq.GetSlot() == SID_ROTATE_GRAPHIC_180)
    {
        aCrop.SetLeft(   aCropRectangle.Right() );
        aCrop.SetTop(    aCropRectangle.Bottom()   );
        aCrop.SetRight(  aCropRectangle.Left()    );
        aCrop.SetBottom( aCropRectangle.Top()  );
    }

    rShell.SetAttrItem(aCrop);

    rShell.EndUndo(SwUndoId::END);
    rShell.EndAllAction();
}

void SwGrfShell::GetAttrStateForRotation(SfxItemSet &rSet)
@@ -953,25 +949,37 @@ void SwGrfShell::GetAttrStateForRotation(SfxItemSet &rSet)
        bool bDisable = bIsParentContentProtected;
        switch( nWhich )
        {
        case SID_ROTATE_GRAPHIC_LEFT:
        case SID_ROTATE_GRAPHIC_RIGHT:
        case SID_ROTATE_GRAPHIC_180:
            if( rShell.GetGraphicType() == GraphicType::NONE )
            case SID_ROTATE_GRAPHIC_LEFT:
            case SID_ROTATE_GRAPHIC_RIGHT:
            case SID_ROTATE_GRAPHIC_180:
            {
                bDisable = true;
            }
            else
            {
                Graphic aGraphic = *rShell.GetGraphic();
                GraphicNativeTransform aTransform(aGraphic);
                if (!aTransform.canBeRotated())
                if( rShell.GetGraphicType() == GraphicType::NONE )
                {
                    bDisable = true;
                }
                break;
            }
            break;
        default:
            bDisable = false;
            case SID_ROTATE_GRAPHIC_RESET:
            {
                // RotGrfFlyFrame: disable when already no rotation
                SfxItemSet aSet( rShell.GetAttrPool(), svl::Items<RES_GRFATR_ROTATION, RES_GRFATR_ROTATION>{} );
                rShell.GetCurAttr( aSet );
                const SwRotationGrf& rRotation = static_cast<const SwRotationGrf&>(aSet.Get(RES_GRFATR_ROTATION));
                bDisable = (0 == rRotation.GetValue());
                break;
            }
            case SID_ATTR_TRANSFORM_ANGLE:
            {
                // RotGrfFlyFrame: get rotation value from RES_GRFATR_ROTATION and copy to rSet as
                // SID_ATTR_TRANSFORM_ANGLE, convert from 10th degrees to 100th degrees
                SfxItemSet aSet( rShell.GetAttrPool(), svl::Items<RES_GRFATR_ROTATION, RES_GRFATR_ROTATION>{} );
                rShell.GetCurAttr( aSet );
                const SwRotationGrf& rRotation = static_cast<const SwRotationGrf&>(aSet.Get(RES_GRFATR_ROTATION));
                rSet.Put(SfxInt32Item(SID_ATTR_TRANSFORM_ANGLE, rRotation.GetValue() * 10));
                break;
            }
            default:
                bDisable = false;
        }

        if( bDisable )
diff --git a/sw/uiconfig/sglobal/menubar/menubar.xml b/sw/uiconfig/sglobal/menubar/menubar.xml
index b8457d6..e492f60 100644
--- a/sw/uiconfig/sglobal/menubar/menubar.xml
+++ b/sw/uiconfig/sglobal/menubar/menubar.xml
@@ -551,6 +551,7 @@
          <menu:menuitem menu:id=".uno:RotateLeft"/>
          <menu:menuitem menu:id=".uno:RotateRight"/>
          <menu:menuitem menu:id=".uno:Rotate180"/>
          <menu:menuitem menu:id=".uno:RotateReset"/>
        </menu:menupopup>
      </menu:menu>
      <menu:menu menu:id=".uno:GroupMenu">
diff --git a/sw/uiconfig/sglobal/popupmenu/graphic.xml b/sw/uiconfig/sglobal/popupmenu/graphic.xml
index 689b6a3..05875fa 100644
--- a/sw/uiconfig/sglobal/popupmenu/graphic.xml
+++ b/sw/uiconfig/sglobal/popupmenu/graphic.xml
@@ -59,6 +59,7 @@
      <menu:menuitem menu:id=".uno:RotateLeft"/>
      <menu:menuitem menu:id=".uno:RotateRight"/>
      <menu:menuitem menu:id=".uno:Rotate180"/>
      <menu:menuitem menu:id=".uno:RotateReset"/>
    </menu:menupopup>
  </menu:menu>
  <menu:menuseparator/>
diff --git a/sw/uiconfig/sglobal/toolbar/graphicobjectbar.xml b/sw/uiconfig/sglobal/toolbar/graphicobjectbar.xml
index 2874029..10513be 100644
--- a/sw/uiconfig/sglobal/toolbar/graphicobjectbar.xml
+++ b/sw/uiconfig/sglobal/toolbar/graphicobjectbar.xml
@@ -28,6 +28,7 @@
 <toolbar:toolbaritem xlink:href=".uno:FlipHorizontal"/>
 <toolbar:toolbaritem xlink:href=".uno:RotateLeft"/>
 <toolbar:toolbaritem xlink:href=".uno:RotateRight"/>
 <toolbar:toolbaritem xlink:href=".uno:RotateReset"/>
 <toolbar:toolbaritem xlink:href=".uno:Rotate180" toolbar:visible="false"/>
 <toolbar:toolbarseparator/>
 <toolbar:toolbaritem xlink:href=".uno:GrafTransparence"/>
diff --git a/sw/uiconfig/sweb/menubar/menubar.xml b/sw/uiconfig/sweb/menubar/menubar.xml
index 25ff1af..ab67785 100644
--- a/sw/uiconfig/sweb/menubar/menubar.xml
+++ b/sw/uiconfig/sweb/menubar/menubar.xml
@@ -274,6 +274,7 @@
          <menu:menuitem menu:id=".uno:RotateLeft"/>
          <menu:menuitem menu:id=".uno:RotateRight"/>
          <menu:menuitem menu:id=".uno:Rotate180"/>
          <menu:menuitem menu:id=".uno:RotateReset"/>
        </menu:menupopup>
      </menu:menu>
      <menu:menu menu:id=".uno:GroupMenu">
diff --git a/sw/uiconfig/sweb/popupmenu/graphic.xml b/sw/uiconfig/sweb/popupmenu/graphic.xml
index 689b6a3..05875fa 100644
--- a/sw/uiconfig/sweb/popupmenu/graphic.xml
+++ b/sw/uiconfig/sweb/popupmenu/graphic.xml
@@ -59,6 +59,7 @@
      <menu:menuitem menu:id=".uno:RotateLeft"/>
      <menu:menuitem menu:id=".uno:RotateRight"/>
      <menu:menuitem menu:id=".uno:Rotate180"/>
      <menu:menuitem menu:id=".uno:RotateReset"/>
    </menu:menupopup>
  </menu:menu>
  <menu:menuseparator/>
diff --git a/sw/uiconfig/swform/menubar/menubar.xml b/sw/uiconfig/swform/menubar/menubar.xml
index 3f61b2e..9bf7439 100644
--- a/sw/uiconfig/swform/menubar/menubar.xml
+++ b/sw/uiconfig/swform/menubar/menubar.xml
@@ -328,6 +328,7 @@
          <menu:menuitem menu:id=".uno:RotateLeft"/>
          <menu:menuitem menu:id=".uno:RotateRight"/>
          <menu:menuitem menu:id=".uno:Rotate180"/>
          <menu:menuitem menu:id=".uno:RotateReset"/>
        </menu:menupopup>
      </menu:menu>
      <menu:menu menu:id=".uno:GroupMenu">
diff --git a/sw/uiconfig/swform/popupmenu/graphic.xml b/sw/uiconfig/swform/popupmenu/graphic.xml
index 689b6a3..05875fa 100644
--- a/sw/uiconfig/swform/popupmenu/graphic.xml
+++ b/sw/uiconfig/swform/popupmenu/graphic.xml
@@ -59,6 +59,7 @@
      <menu:menuitem menu:id=".uno:RotateLeft"/>
      <menu:menuitem menu:id=".uno:RotateRight"/>
      <menu:menuitem menu:id=".uno:Rotate180"/>
      <menu:menuitem menu:id=".uno:RotateReset"/>
    </menu:menupopup>
  </menu:menu>
  <menu:menuseparator/>
diff --git a/sw/uiconfig/swform/toolbar/graphicobjectbar.xml b/sw/uiconfig/swform/toolbar/graphicobjectbar.xml
index 22257b2..b972e9b 100644
--- a/sw/uiconfig/swform/toolbar/graphicobjectbar.xml
+++ b/sw/uiconfig/swform/toolbar/graphicobjectbar.xml
@@ -30,6 +30,7 @@
 <toolbar:toolbaritem xlink:href=".uno:FlipHorizontal"/>
 <toolbar:toolbaritem xlink:href=".uno:RotateLeft"/>
 <toolbar:toolbaritem xlink:href=".uno:RotateRight"/>
 <toolbar:toolbaritem xlink:href=".uno:RotateReset"/>
 <toolbar:toolbaritem xlink:href=".uno:Rotate180"/>
 <toolbar:toolbaritem xlink:href=".uno:Crop"/>
 <toolbar:toolbarseparator/>
diff --git a/sw/uiconfig/swreport/menubar/menubar.xml b/sw/uiconfig/swreport/menubar/menubar.xml
index 41e438c..bc1a26d 100644
--- a/sw/uiconfig/swreport/menubar/menubar.xml
+++ b/sw/uiconfig/swreport/menubar/menubar.xml
@@ -330,6 +330,7 @@
          <menu:menuitem menu:id=".uno:RotateLeft"/>
          <menu:menuitem menu:id=".uno:RotateRight"/>
          <menu:menuitem menu:id=".uno:Rotate180"/>
          <menu:menuitem menu:id=".uno:RotateReset"/>
        </menu:menupopup>
      </menu:menu>
      <menu:menu menu:id=".uno:GroupMenu">
diff --git a/sw/uiconfig/swreport/popupmenu/graphic.xml b/sw/uiconfig/swreport/popupmenu/graphic.xml
index 689b6a3..05875fa 100644
--- a/sw/uiconfig/swreport/popupmenu/graphic.xml
+++ b/sw/uiconfig/swreport/popupmenu/graphic.xml
@@ -59,6 +59,7 @@
      <menu:menuitem menu:id=".uno:RotateLeft"/>
      <menu:menuitem menu:id=".uno:RotateRight"/>
      <menu:menuitem menu:id=".uno:Rotate180"/>
      <menu:menuitem menu:id=".uno:RotateReset"/>
    </menu:menupopup>
  </menu:menu>
  <menu:menuseparator/>
diff --git a/sw/uiconfig/swreport/toolbar/graphicobjectbar.xml b/sw/uiconfig/swreport/toolbar/graphicobjectbar.xml
index 22257b2..6e2c6a2 100644
--- a/sw/uiconfig/swreport/toolbar/graphicobjectbar.xml
+++ b/sw/uiconfig/swreport/toolbar/graphicobjectbar.xml
@@ -31,6 +31,7 @@
 <toolbar:toolbaritem xlink:href=".uno:RotateLeft"/>
 <toolbar:toolbaritem xlink:href=".uno:RotateRight"/>
 <toolbar:toolbaritem xlink:href=".uno:Rotate180"/>
 <toolbar:toolbaritem xlink:href=".uno:RotateReset"/>
 <toolbar:toolbaritem xlink:href=".uno:Crop"/>
 <toolbar:toolbarseparator/>
 <toolbar:toolbaritem xlink:href=".uno:FrameDialog"/>
diff --git a/sw/uiconfig/swriter/menubar/menubar.xml b/sw/uiconfig/swriter/menubar/menubar.xml
index ce25da9..b2e5bf5 100644
--- a/sw/uiconfig/swriter/menubar/menubar.xml
+++ b/sw/uiconfig/swriter/menubar/menubar.xml
@@ -551,6 +551,7 @@
          <menu:menuitem menu:id=".uno:RotateLeft"/>
          <menu:menuitem menu:id=".uno:RotateRight"/>
          <menu:menuitem menu:id=".uno:Rotate180"/>
          <menu:menuitem menu:id=".uno:RotateReset"/>
        </menu:menupopup>
      </menu:menu>
      <menu:menu menu:id=".uno:GroupMenu">
diff --git a/sw/uiconfig/swriter/popupmenu/graphic.xml b/sw/uiconfig/swriter/popupmenu/graphic.xml
index afd5b89..2ab3712 100644
--- a/sw/uiconfig/swriter/popupmenu/graphic.xml
+++ b/sw/uiconfig/swriter/popupmenu/graphic.xml
@@ -59,6 +59,7 @@
      <menu:menuitem menu:id=".uno:RotateRight"/>
      <menu:menuitem menu:id=".uno:RotateLeft"/>
      <menu:menuitem menu:id=".uno:Rotate180"/>
      <menu:menuitem menu:id=".uno:RotateReset"/>
      <menu:menuseparator/>
      <menu:menuitem menu:id=".uno:FlipVertical"/>
      <menu:menuitem menu:id=".uno:FlipHorizontal"/>
diff --git a/sw/uiconfig/swriter/toolbar/graphicobjectbar.xml b/sw/uiconfig/swriter/toolbar/graphicobjectbar.xml
index 2874029..172d8b4 100644
--- a/sw/uiconfig/swriter/toolbar/graphicobjectbar.xml
+++ b/sw/uiconfig/swriter/toolbar/graphicobjectbar.xml
@@ -29,6 +29,7 @@
 <toolbar:toolbaritem xlink:href=".uno:RotateLeft"/>
 <toolbar:toolbaritem xlink:href=".uno:RotateRight"/>
 <toolbar:toolbaritem xlink:href=".uno:Rotate180" toolbar:visible="false"/>
 <toolbar:toolbaritem xlink:href=".uno:RotateReset"/>
 <toolbar:toolbarseparator/>
 <toolbar:toolbaritem xlink:href=".uno:GrafTransparence"/>
 <toolbar:toolbarseparator/>
diff --git a/sw/uiconfig/swriter/ui/notebookbar.ui b/sw/uiconfig/swriter/ui/notebookbar.ui
index 59da4b4a..e2d8b1f 100644
--- a/sw/uiconfig/swriter/ui/notebookbar.ui
+++ b/sw/uiconfig/swriter/ui/notebookbar.ui
@@ -6347,6 +6347,32 @@
                            <property name="position">1</property>
                          </packing>
                        </child>
                        <child>
                          <object class="sfxlo-NotebookbarToolBox" id="rotate2">
                            <property name="visible">True</property>
                            <property name="can_focus">False</property>
                            <property name="show_arrow">False</property>
                            <child>
                              <object class="GtkToolButton" id="RotateReset">
                                <property name="use_action_appearance">False</property>
                                <property name="visible">True</property>
                                <property name="can_focus">False</property>
                                <property name="is_important">True</property>
                                <property name="action_name">.uno:RotateReset</property>
                                <property name="use_underline">True</property>
                              </object>
                              <packing>
                                <property name="expand">False</property>
                                <property name="homogeneous">True</property>
                              </packing>
                            </child>
                          </object>
                          <packing>
                            <property name="expand">False</property>
                            <property name="fill">True</property>
                            <property name="position">1</property>
                          </packing>
                        </child>
                      </object>
                      <packing>
                        <property name="expand">False</property>
diff --git a/sw/uiconfig/swriter/ui/notebookbar_groupedbar_compact.ui b/sw/uiconfig/swriter/ui/notebookbar_groupedbar_compact.ui
index dc39634..711d5e8 100644
--- a/sw/uiconfig/swriter/ui/notebookbar_groupedbar_compact.ui
+++ b/sw/uiconfig/swriter/ui/notebookbar_groupedbar_compact.ui
@@ -1714,6 +1714,13 @@
      </object>
    </child>
    <child>
      <object class="GtkMenuItem" id="RotateResetD">
        <property name="visible">True</property>
        <property name="can_focus">False</property>
        <property name="action_name">.uno:RotateReset</property>
      </object>
    </child>
    <child>
      <object class="GtkMenuItem" id="FlipVerticalD">
        <property name="visible">True</property>
        <property name="can_focus">False</property>
diff --git a/sw/uiconfig/swriter/ui/notebookbar_groupedbar_full.ui b/sw/uiconfig/swriter/ui/notebookbar_groupedbar_full.ui
index 3e0c96a..24e4269 100644
--- a/sw/uiconfig/swriter/ui/notebookbar_groupedbar_full.ui
+++ b/sw/uiconfig/swriter/ui/notebookbar_groupedbar_full.ui
@@ -1645,6 +1645,13 @@
      </object>
    </child>
    <child>
      <object class="GtkMenuItem" id="RotateResetD">
        <property name="visible">True</property>
        <property name="can_focus">False</property>
        <property name="action_name">.uno:RotateReset</property>
      </object>
    </child>
    <child>
      <object class="GtkMenuItem" id="FlipVerticalD">
        <property name="visible">True</property>
        <property name="can_focus">False</property>
diff --git a/sw/uiconfig/swriter/ui/picturepage.ui b/sw/uiconfig/swriter/ui/picturepage.ui
index b710ae9..4a9364e 100644
--- a/sw/uiconfig/swriter/ui/picturepage.ui
+++ b/sw/uiconfig/swriter/ui/picturepage.ui
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<!-- Generated with glade 3.16.1 -->
<interface domain="sw">
  <requires lib="gtk+" version="3.0"/>
  <requires lib="LibreOffice" version="1.0"/>
  <!-- interface-requires LibreOffice 1.0 -->
  <object class="GtkGrid" id="PicturePage">
    <property name="visible">True</property>
    <property name="can_focus">False</property>
@@ -37,6 +37,8 @@
                  <packing>
                    <property name="left_attach">1</property>
                    <property name="top_attach">1</property>
                    <property name="width">1</property>
                    <property name="height">1</property>
                  </packing>
                </child>
                <child>
@@ -49,6 +51,8 @@
                  <packing>
                    <property name="left_attach">0</property>
                    <property name="top_attach">1</property>
                    <property name="width">1</property>
                    <property name="height">1</property>
                  </packing>
                </child>
                <child>
@@ -64,6 +68,7 @@
                    <property name="left_attach">0</property>
                    <property name="top_attach">0</property>
                    <property name="width">2</property>
                    <property name="height">1</property>
                  </packing>
                </child>
              </object>
@@ -84,6 +89,8 @@
      <packing>
        <property name="left_attach">0</property>
        <property name="top_attach">1</property>
        <property name="width">1</property>
        <property name="height">1</property>
      </packing>
    </child>
    <child>
@@ -120,6 +127,8 @@
                  <packing>
                    <property name="left_attach">0</property>
                    <property name="top_attach">0</property>
                    <property name="width">1</property>
                    <property name="height">1</property>
                  </packing>
                </child>
                <child>
@@ -135,6 +144,8 @@
                  <packing>
                    <property name="left_attach">0</property>
                    <property name="top_attach">1</property>
                    <property name="width">1</property>
                    <property name="height">1</property>
                  </packing>
                </child>
                <child>
@@ -152,6 +163,8 @@
                  <packing>
                    <property name="left_attach">0</property>
                    <property name="top_attach">2</property>
                    <property name="width">1</property>
                    <property name="height">1</property>
                  </packing>
                </child>
                <child>
@@ -168,6 +181,8 @@
                  <packing>
                    <property name="left_attach">0</property>
                    <property name="top_attach">3</property>
                    <property name="width">1</property>
                    <property name="height">1</property>
                  </packing>
                </child>
                <child>
@@ -184,6 +199,8 @@
                  <packing>
                    <property name="left_attach">0</property>
                    <property name="top_attach">4</property>
                    <property name="width">1</property>
                    <property name="height">1</property>
                  </packing>
                </child>
                <child>
@@ -217,6 +234,7 @@
                  <packing>
                    <property name="left_attach">1</property>
                    <property name="top_attach">0</property>
                    <property name="width">1</property>
                    <property name="height">5</property>
                  </packing>
                </child>
@@ -238,6 +256,133 @@
      <packing>
        <property name="left_attach">0</property>
        <property name="top_attach">0</property>
        <property name="width">1</property>
        <property name="height">1</property>
      </packing>
    </child>
    <child>
      <object class="GtkFrame" id="FL_ANGLE">
        <property name="visible">True</property>
        <property name="can_focus">False</property>
        <property name="label_xalign">0</property>
        <property name="shadow_type">none</property>
        <child>
          <object class="GtkAlignment" id="alignment1">
            <property name="visible">True</property>
            <property name="can_focus">False</property>
            <property name="top_padding">6</property>
            <property name="left_padding">12</property>
            <child>
              <object class="GtkBox" id="box4">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="spacing">12</property>
                <property name="homogeneous">True</property>
                <child>
                  <object class="GtkBox" id="box5">
                    <property name="visible">True</property>
                    <property name="can_focus">False</property>
                    <property name="valign">start</property>
                    <property name="spacing">12</property>
                    <child>
                      <object class="GtkLabel" id="FT_ANGLE">
                        <property name="visible">True</property>
                        <property name="can_focus">False</property>
                        <property name="xalign">0</property>
                        <property name="label" translatable="yes" context="picturepage|FT_ANGLE">_Angle:</property>
                        <property name="use_underline">True</property>
                        <property name="mnemonic_widget">NF_ANGLE</property>
                      </object>
                      <packing>
                        <property name="expand">False</property>
                        <property name="fill">True</property>
                        <property name="position">0</property>
                      </packing>
                    </child>
                    <child>
                      <object class="GtkSpinButton" id="NF_ANGLE">
                        <property name="visible">True</property>
                        <property name="can_focus">True</property>
                        <property name="invisible_char">•</property>
                        <property name="text" translatable="yes" context="picturepage">0,00</property>
                        <property name="adjustment">adjustmentANGLE</property>
                        <property name="digits">2</property>
                        <property name="wrap">True</property>
                      </object>
                      <packing>
                        <property name="expand">False</property>
                        <property name="fill">True</property>
                        <property name="position">1</property>
                      </packing>
                    </child>
                  </object>
                  <packing>
                    <property name="expand">False</property>
                    <property name="fill">True</property>
                    <property name="position">0</property>
                  </packing>
                </child>
                <child>
                  <object class="GtkBox" id="box6">
                    <property name="visible">True</property>
                    <property name="can_focus">False</property>
                    <property name="orientation">vertical</property>
                    <property name="spacing">6</property>
                    <child>
                      <object class="GtkLabel" id="FT_ANGLEPRESETS">
                        <property name="visible">True</property>
                        <property name="can_focus">False</property>
                        <property name="label" translatable="yes" context="picturepage|FT_ANGLEPRESETS">Default _settings:</property>
                        <property name="use_underline">True</property>
                        <property name="mnemonic_widget">CTL_ANGLE</property>
                      </object>
                      <packing>
                        <property name="expand">False</property>
                        <property name="fill">True</property>
                        <property name="position">0</property>
                      </packing>
                    </child>
                    <child>
                      <object class="svxlo-DialControl" id="CTL_ANGLE">
                        <property name="visible">True</property>
                        <property name="can_focus">False</property>
                        <property name="tooltip_text" translatable="yes" context="picturepage|CTL_ANGLE|tooltip_text">Rotation Angle</property>
                        <property name="halign">center</property>
                      </object>
                      <packing>
                        <property name="expand">False</property>
                        <property name="fill">True</property>
                        <property name="position">1</property>
                      </packing>
                    </child>
                  </object>
                  <packing>
                    <property name="expand">False</property>
                    <property name="fill">True</property>
                    <property name="position">1</property>
                  </packing>
                </child>
              </object>
            </child>
          </object>
        </child>
        <child type="label">
          <object class="GtkLabel" id="label3">
            <property name="visible">True</property>
            <property name="can_focus">False</property>
            <property name="xalign">0</property>
            <property name="label" translatable="yes" context="picturepage|label2">Rotation Angle</property>
            <attributes>
              <attribute name="weight" value="bold"/>
            </attributes>
          </object>
        </child>
      </object>
      <packing>
        <property name="left_attach">0</property>
        <property name="top_attach">2</property>
        <property name="width">1</property>
        <property name="height">1</property>
      </packing>
    </child>
  </object>
diff --git a/sw/uiconfig/swxform/menubar/menubar.xml b/sw/uiconfig/swxform/menubar/menubar.xml
index f4b58eb..151a9e6 100644
--- a/sw/uiconfig/swxform/menubar/menubar.xml
+++ b/sw/uiconfig/swxform/menubar/menubar.xml
@@ -330,6 +330,7 @@
          <menu:menuitem menu:id=".uno:RotateLeft"/>
          <menu:menuitem menu:id=".uno:RotateRight"/>
          <menu:menuitem menu:id=".uno:Rotate180"/>
          <menu:menuitem menu:id=".uno:RotateReset"/>
        </menu:menupopup>
      </menu:menu>
      <menu:menu menu:id=".uno:GroupMenu">
diff --git a/sw/uiconfig/swxform/popupmenu/graphic.xml b/sw/uiconfig/swxform/popupmenu/graphic.xml
index 689b6a3..05875fa 100644
--- a/sw/uiconfig/swxform/popupmenu/graphic.xml
+++ b/sw/uiconfig/swxform/popupmenu/graphic.xml
@@ -59,6 +59,7 @@
      <menu:menuitem menu:id=".uno:RotateLeft"/>
      <menu:menuitem menu:id=".uno:RotateRight"/>
      <menu:menuitem menu:id=".uno:Rotate180"/>
      <menu:menuitem menu:id=".uno:RotateReset"/>
    </menu:menupopup>
  </menu:menu>
  <menu:menuseparator/>
diff --git a/sw/uiconfig/swxform/toolbar/graphicobjectbar.xml b/sw/uiconfig/swxform/toolbar/graphicobjectbar.xml
index 22257b2..6e2c6a2 100644
--- a/sw/uiconfig/swxform/toolbar/graphicobjectbar.xml
+++ b/sw/uiconfig/swxform/toolbar/graphicobjectbar.xml
@@ -31,6 +31,7 @@
 <toolbar:toolbaritem xlink:href=".uno:RotateLeft"/>
 <toolbar:toolbaritem xlink:href=".uno:RotateRight"/>
 <toolbar:toolbaritem xlink:href=".uno:Rotate180"/>
 <toolbar:toolbaritem xlink:href=".uno:RotateReset"/>
 <toolbar:toolbaritem xlink:href=".uno:Crop"/>
 <toolbar:toolbarseparator/>
 <toolbar:toolbaritem xlink:href=".uno:FrameDialog"/>
diff --git a/xmloff/source/text/XMLTextFrameContext.cxx b/xmloff/source/text/XMLTextFrameContext.cxx
index e6ca2f2..6526f91 100644
--- a/xmloff/source/text/XMLTextFrameContext.cxx
+++ b/xmloff/source/text/XMLTextFrameContext.cxx
@@ -996,7 +996,10 @@ XMLTextFrameContext_Impl::XMLTextFrameContext_Impl(
                    sValue = sValue.trim();
                    sal_Int32 nVal;
                    if (::sax::Converter::convertNumber( nVal, sValue ))
                        nRotation = (sal_Int16)(nVal % 360 );
                    {
                        // RotGrfFlyFrame: is in 10th degrees
                        nRotation = (sal_Int16)(nVal % 3600 );
                    }
                }
            }
            break;