diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-06-25 10:33:06 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-06-25 15:29:51 +0100 |
commit | a0ded09c55f944f57201651032eed5dcf7e22e48 (patch) | |
tree | 8b09bd795fcc38ba7bba3b55232ab9d1caa9b37d /svx | |
parent | df7595a5f5871f8343e4ee3869ad153e3ae4a7f3 (diff) |
implement equalize width and height for impress/draw
Equalize width/height adjusts width/height of selected objects to the
width/height of the last selected object.
Change-Id: I7c222a6591112cb674322d310ebd87f04a9198bd
Diffstat (limited to 'svx')
-rw-r--r-- | svx/inc/globlmn_tmpl.hrc | 20 | ||||
-rw-r--r-- | svx/sdi/svx.sdi | 47 | ||||
-rw-r--r-- | svx/source/svdraw/svdedtv2.cxx | 38 | ||||
-rw-r--r-- | svx/source/svdraw/svdstr.src | 8 |
4 files changed, 113 insertions, 0 deletions
diff --git a/svx/inc/globlmn_tmpl.hrc b/svx/inc/globlmn_tmpl.hrc index 9d511c810af8..8d8248914e21 100644 --- a/svx/inc/globlmn_tmpl.hrc +++ b/svx/inc/globlmn_tmpl.hrc @@ -306,6 +306,20 @@ Command = ".uno:Intersect" ; \ Text [ en-US ] = "I~ntersect" ; \ }; +#define ITEM_EQUALIZEWIDTH \ + MenuItem\ + {\ + Identifier = SID_EQUALIZEWIDTH ; \ + Command = ".uno:EqualizeWidth" ; \ + Text [ en-US ] = "Equalize ~Width" ; \ + }; +#define ITEM_EQUALIZEHEIGHT \ + MenuItem\ + {\ + Identifier = SID_EQUALIZEHEIGHT ; \ + Command = ".uno:EqualizeHeight" ; \ + Text [ en-US ] = "Equalize ~Height" ; \ + }; #define MNSUB_FORMEN \ MenuItem \ @@ -320,6 +334,12 @@ ITEM_POLY_MERGE \ ITEM_POLY_SUBSTRACT \ ITEM_POLY_INTERSECT \ + MenuItem \ + { \ + Separator = TRUE; \ + }; \ + ITEM_EQUALIZEWIDTH \ + ITEM_EQUALIZEHEIGHT \ };\ };\ }; diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi index 941f3e8d1966..b301c58b1176 100644 --- a/svx/sdi/svx.sdi +++ b/svx/sdi/svx.sdi @@ -11100,6 +11100,53 @@ SfxVoidItem Substract SID_POLY_SUBSTRACT GroupId = GID_MODIFY; ] +SfxVoidItem EqualizeWidth SID_EQUALIZEWIDTH +() +[ + /* flags: */ + AutoUpdate = FALSE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + /* config: */ + AccelConfig = TRUE, + MenuConfig = TRUE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_MODIFY; +] + +SfxVoidItem EqualizeHeight SID_EQUALIZEHEIGHT +() +[ + /* flags: */ + AutoUpdate = FALSE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + /* config: */ + AccelConfig = TRUE, + MenuConfig = TRUE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_MODIFY; +] SfxBoolItem SuperScript SID_SET_SUPER_SCRIPT diff --git a/svx/source/svdraw/svdedtv2.cxx b/svx/source/svdraw/svdedtv2.cxx index 0a60082c2422..ad7dd3fa5e96 100644 --- a/svx/source/svdraw/svdedtv2.cxx +++ b/svx/source/svdraw/svdedtv2.cxx @@ -1173,6 +1173,44 @@ void SdrEditView::MergeMarkedObjects(SdrMergeMode eMode) } } +void SdrEditView::EqualizeMarkedObjects(bool bWidth) +{ + const SdrMarkList& rMarkList = GetMarkedObjectList(); + size_t nMarked = rMarkList.GetMarkCount(); + + if (nMarked < 2) + return; + + SdrObject* pLastSelectedObj = rMarkList.GetMark(nMarked-1)->GetMarkedSdrObj(); + Size aLastRectSize(pLastSelectedObj->GetLogicRect().GetSize()); + + const bool bUndo = IsUndoEnabled(); + + if (bUndo) + BegUndo(); + + for (size_t a = 0; a < nMarked-1; ++a) + { + SdrMark* pM = rMarkList.GetMark(a); + SdrObject* pObj = pM->GetMarkedSdrObj(); + Rectangle aLogicRect(pObj->GetLogicRect()); + Size aLogicRectSize(aLogicRect.GetSize()); + if (bWidth) + aLogicRectSize.Width() = aLastRectSize.Width(); + else + aLogicRectSize.Height() = aLastRectSize.Height(); + aLogicRect.SetSize(aLogicRectSize); + pObj->SetLogicRect(aLogicRect); + } + + SetUndoComment( + ImpGetResStr(bWidth ? STR_EqualizeWidthMarkedObjects : STR_EqualizeHeightMarkedObjects), + rMarkList.GetMarkDescription()); + + if (bUndo) + EndUndo(); +} + void SdrEditView::CombineMarkedObjects(bool bNoPolyPoly) { // #105899# Start of Combine-Undo put to front, else ConvertMarkedToPolyObj would diff --git a/svx/source/svdraw/svdstr.src b/svx/source/svdraw/svdstr.src index 364749a015fc..6dc442028236 100644 --- a/svx/source/svdraw/svdstr.src +++ b/svx/source/svdraw/svdstr.src @@ -823,6 +823,14 @@ String STR_DistributeMarkedObjects { Text [ en-US ] = "Distribute selected objects"; }; +String STR_EqualizeWidthMarkedObjects +{ + Text [ en-US ] = "Equalize Width %1"; +}; +String STR_EqualizeHeightMarkedObjects +{ + Text [ en-US ] = "Equalize Height %1"; +}; String STR_EditCombine_OnePoly { Text [ en-US ] = "Combine %1" ; |