[Libreoffice-commits] core.git: sw/source
Dennis Francis (via logerrit)
logerrit at kemper.freedesktop.org
Wed Feb 12 13:26:00 UTC 2020
sw/source/uibase/shells/drwbassh.cxx | 53 +++++++++++++++++++++++++++++------
1 file changed, 44 insertions(+), 9 deletions(-)
New commits:
commit f5f39903f44f131c6d583ae056412dadee265d10
Author: Dennis Francis <dennis.francis at collabora.com>
AuthorDate: Fri Feb 7 12:49:59 2020 +0530
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Wed Feb 12 14:25:17 2020 +0100
Get the align states of draw-shapes in...
SwDrawBaseShell::GetState() so that the align buttons are informed
(in core desktop and online via statechange messages)
Change-Id: Ic69fb03bc98f39b1a6a389d50d3d6404fefd7f29
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88159
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88453
Tested-by: Jenkins
Reviewed-by: Andras Timar <andras.timar at collabora.com>
diff --git a/sw/source/uibase/shells/drwbassh.cxx b/sw/source/uibase/shells/drwbassh.cxx
index cb44b8955e31..18fce24f2c94 100644
--- a/sw/source/uibase/shells/drwbassh.cxx
+++ b/sw/source/uibase/shells/drwbassh.cxx
@@ -691,18 +691,53 @@ void SwDrawBaseShell::GetState(SfxItemSet& rSet)
case SID_OBJECT_ALIGN_MIDDLE:
case SID_OBJECT_ALIGN_DOWN:
case SID_OBJECT_ALIGN:
- if ( !rSh.IsAlignPossible() || bProtected )
- rSet.DisableItem( nWhich );
- else if ( rSh.GetAnchorId() == RndStdIds::FLY_AS_CHAR )
{
+ bool bDisableThis = false;
+ bool bDisableHoriz = false;
+ bool bHoriz = (nWhich == SID_OBJECT_ALIGN_LEFT || nWhich == SID_OBJECT_ALIGN_CENTER ||
+ nWhich == SID_OBJECT_ALIGN_RIGHT);
const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
- //if only one object is selected it can only be vertically
- // aligned because it is character bound
- if( rMarkList.GetMarkCount() == 1 )
+ if ( !rSh.IsAlignPossible() || bProtected )
+ {
+ bDisableThis = true;
+ rSet.DisableItem( nWhich );
+ }
+ else if ( rSh.GetAnchorId() == RndStdIds::FLY_AS_CHAR )
{
- rSet.DisableItem(SID_OBJECT_ALIGN_LEFT);
- rSet.DisableItem(SID_OBJECT_ALIGN_CENTER);
- rSet.DisableItem(SID_OBJECT_ALIGN_RIGHT);
+ //if only one object is selected it can only be vertically
+ // aligned because it is character bound
+ if( rMarkList.GetMarkCount() == 1 )
+ {
+ bDisableHoriz = true;
+ rSet.DisableItem(SID_OBJECT_ALIGN_LEFT);
+ rSet.DisableItem(SID_OBJECT_ALIGN_CENTER);
+ rSet.DisableItem(SID_OBJECT_ALIGN_RIGHT);
+ }
+ }
+
+ if (bHoriz && !bDisableThis && !bDisableHoriz &&
+ rMarkList.GetMarkCount() == 1)
+ {
+ sal_Int16 nHoriOrient = -1;
+ switch(nWhich)
+ {
+ case SID_OBJECT_ALIGN_LEFT:
+ nHoriOrient = text::HoriOrientation::LEFT;
+ break;
+ case SID_OBJECT_ALIGN_CENTER:
+ nHoriOrient = text::HoriOrientation::CENTER;
+ break;
+ case SID_OBJECT_ALIGN_RIGHT:
+ nHoriOrient = text::HoriOrientation::RIGHT;
+ break;
+ default:
+ break;
+ }
+
+ SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
+ SwFrameFormat* pFrameFormat = FindFrameFormat(pObj);
+ SwFormatHoriOrient aHOrient(pFrameFormat->GetFormatAttr(RES_HORI_ORIENT));
+ rSet.Put(SfxBoolItem(nWhich, aHOrient.GetHoriOrient() == nHoriOrient));
}
}
break;
More information about the Libreoffice-commits
mailing list