lok: state updates for vertical alignment

Change-Id: I6767904e3d3366e1316c932555b979a26e77b8c5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99998
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100459
Tested-by: Jenkins
This commit is contained in:
Szymon Kłos
2020-08-03 12:37:06 +02:00
parent 48215f9e92
commit a67da1808d
4 changed files with 35 additions and 3 deletions

View File

@@ -2819,6 +2819,9 @@ static void doc_iniUnoCommands ()
OUString(".uno:CharmapControl"),
OUString(".uno:EnterGroup"),
OUString(".uno:LeaveGroup"),
OUString(".uno:AlignUp"),
OUString(".uno:AlignMiddle"),
OUString(".uno:AlignDown"),
OUString(".uno:FreezePanesRow")
};

View File

@@ -1012,6 +1012,9 @@ static void InterceptLOKStateChangeEvent(sal_uInt16 nSID, SfxViewFrame* pViewFra
aEvent.FeatureURL.Path == "ObjectAlignLeft" ||
aEvent.FeatureURL.Path == "ObjectAlignRight" ||
aEvent.FeatureURL.Path == "AlignCenter" ||
aEvent.FeatureURL.Path == "AlignUp" ||
aEvent.FeatureURL.Path == "AlignMiddle" ||
aEvent.FeatureURL.Path == "AlignDown" ||
aEvent.FeatureURL.Path == "FormatPaintbrush")
{
bool bTemp = false;

View File

@@ -124,7 +124,7 @@ SfxBoolItem AlignCenter SID_OBJECT_ALIGN_CENTER
]
SfxVoidItem AlignDown SID_OBJECT_ALIGN_DOWN
SfxBoolItem AlignDown SID_OBJECT_ALIGN_DOWN
()
[
AutoUpdate = FALSE,
@@ -179,7 +179,7 @@ SvxAdjustItem Alignment SID_ATTR_PARA_ADJUST
]
SfxVoidItem AlignMiddle SID_OBJECT_ALIGN_MIDDLE
SfxBoolItem AlignMiddle SID_OBJECT_ALIGN_MIDDLE
()
[
AutoUpdate = FALSE,
@@ -215,7 +215,7 @@ SfxBoolItem ObjectAlignRight SID_OBJECT_ALIGN_RIGHT
]
SfxVoidItem AlignUp SID_OBJECT_ALIGN_UP
SfxBoolItem AlignUp SID_OBJECT_ALIGN_UP
()
[
AutoUpdate = FALSE,

View File

@@ -701,6 +701,8 @@ void SwDrawBaseShell::GetState(SfxItemSet& rSet)
bool bDisableHoriz = false;
bool bHoriz = (nWhich == SID_OBJECT_ALIGN_LEFT || nWhich == SID_OBJECT_ALIGN_CENTER ||
nWhich == SID_OBJECT_ALIGN_RIGHT);
bool bVert = (nWhich == SID_OBJECT_ALIGN_UP || nWhich == SID_OBJECT_ALIGN_MIDDLE ||
nWhich == SID_OBJECT_ALIGN_DOWN);
const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
if ( !rSh.IsAlignPossible() || bProtected )
{
@@ -744,6 +746,30 @@ void SwDrawBaseShell::GetState(SfxItemSet& rSet)
SwFormatHoriOrient aHOrient(pFrameFormat->GetFormatAttr(RES_HORI_ORIENT));
rSet.Put(SfxBoolItem(nWhich, aHOrient.GetHoriOrient() == nHoriOrient));
}
if (bVert && !bDisableThis && rMarkList.GetMarkCount() == 1)
{
sal_Int16 nVertOrient = -1;
switch(nWhich)
{
case SID_OBJECT_ALIGN_UP:
nVertOrient = text::VertOrientation::TOP;
break;
case SID_OBJECT_ALIGN_MIDDLE:
nVertOrient = text::VertOrientation::CENTER;
break;
case SID_OBJECT_ALIGN_DOWN:
nVertOrient = text::VertOrientation::BOTTOM;
break;
default:
break;
}
SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
SwFrameFormat* pFrameFormat = FindFrameFormat(pObj);
SwFormatVertOrient aVOrient(pFrameFormat->GetFormatAttr(RES_VERT_ORIENT));
rSet.Put(SfxBoolItem(nWhich, aVOrient.GetVertOrient() == nVertOrient));
}
}
break;