diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-06-19 10:11:34 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-06-19 11:29:31 +0200 |
commit | 692ea03e1d9974d036e1b9109c3fe32e1c0e51cd (patch) | |
tree | 3dfedbecd4b8e345d97635ec5cc2ac2a63766956 | |
parent | 7f77b8a689f84a03495ac5911236b68f01ee7b24 (diff) |
sw: add UI for removing the textbox of a draw shape
Change-Id: Ib95573228d3dc98c88cd4af19995c99433c84ae6
-rw-r--r-- | sw/inc/cmdid.h | 1 | ||||
-rw-r--r-- | sw/inc/swcommands.h | 1 | ||||
-rw-r--r-- | sw/sdi/drawsh.sdi | 7 | ||||
-rw-r--r-- | sw/sdi/swriter.sdi | 24 | ||||
-rw-r--r-- | sw/source/ui/app/mn.src | 6 | ||||
-rw-r--r-- | sw/source/uibase/shells/drawsh.cxx | 25 |
6 files changed, 64 insertions, 0 deletions
diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h index 79f4dc66c3ed..46c84b19ee50 100644 --- a/sw/inc/cmdid.h +++ b/sw/inc/cmdid.h @@ -479,6 +479,7 @@ #define FN_EXPAND_GLOSSARY (FN_EXTRA + 28) /* expand text building blocks */ #define FN_CHANGE_PAGENUM (FN_EXTRA + 34) /* change page numbers*/ #define FN_ADD_TEXT_BOX (FN_EXTRA + 35) /* add text box to draw shape */ +#define FN_REMOVE_TEXT_BOX (FN_EXTRA + 36) /* remove text box of draw shape */ // Region: Glossary diff --git a/sw/inc/swcommands.h b/sw/inc/swcommands.h index 3417a74dc088..0d7aadded56f 100644 --- a/sw/inc/swcommands.h +++ b/sw/inc/swcommands.h @@ -79,6 +79,7 @@ #define CMD_FN_PRINT_PAGEPREVIEW ".uno:PrintPagePreview" #define CMD_FN_TABLE_SET_READ_ONLY_CELLS ".uno:Protect" #define CMD_FN_REMOVE_CUR_TOX ".uno:RemoveTableOf" +#define CMD_FN_REMOVE_TEXT_BOX ".uno:RemoveTextBox" #define CMD_FN_FORMAT_RESET ".uno:ResetAttributes" #define CMD_FN_TOOL_ANCHOR_AT_CHAR ".uno:SetAnchorAtChar" #define CMD_FN_TOOL_ANCHOR_CHAR ".uno:SetAnchorToChar" diff --git a/sw/sdi/drawsh.sdi b/sw/sdi/drawsh.sdi index d181a0defc5a..5b2b27a7b975 100644 --- a/sw/sdi/drawsh.sdi +++ b/sw/sdi/drawsh.sdi @@ -515,5 +515,12 @@ shell SwDrawShell : SwDrawBaseShell StateMethod = GetState ; DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; ] + + FN_REMOVE_TEXT_BOX + [ + ExecMethod = Execute ; + StateMethod = GetState ; + DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; + ] } diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi index 271ad17b3892..fc78e4ab0a15 100644 --- a/sw/sdi/swriter.sdi +++ b/sw/sdi/swriter.sdi @@ -10103,3 +10103,27 @@ SfxVoidItem AddTextBox FN_ADD_TEXT_BOX ToolBoxConfig = TRUE, GroupId = GID_DRAWING; ] + +SfxVoidItem RemoveTextBox FN_REMOVE_TEXT_BOX +() +[ + /* 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_DRAWING; +] diff --git a/sw/source/ui/app/mn.src b/sw/source/ui/app/mn.src index 80090e0e8229..f62c8da77dd2 100644 --- a/sw/source/ui/app/mn.src +++ b/sw/source/ui/app/mn.src @@ -1050,6 +1050,12 @@ Menu MN_DRAW_POPUPMENU HelpId = CMD_FN_ADD_TEXT_BOX; Text [ en-US ] = "Add Text Box"; }; + MenuItem + { + Identifier = FN_REMOVE_TEXT_BOX; + HelpId = CMD_FN_REMOVE_TEXT_BOX; + Text [ en-US ] = "Remove Text Box"; + }; }; }; diff --git a/sw/source/uibase/shells/drawsh.cxx b/sw/source/uibase/shells/drawsh.cxx index 76d2538f7fd1..d4887fa3d4b3 100644 --- a/sw/source/uibase/shells/drawsh.cxx +++ b/sw/source/uibase/shells/drawsh.cxx @@ -409,6 +409,16 @@ void SwDrawShell::Execute(SfxRequest &rReq) } break; } + case FN_REMOVE_TEXT_BOX: + { + if (SdrObject* pObj = IsSingleFillableNonOLESelected()) + { + SwFrmFmt* pFrmFmt = ::FindFrmFmt(pObj); + if (pFrmFmt) + SwTextBoxHelper::destroy(pFrmFmt); + } + break; + } default: OSL_ENSURE(!this, "wrong dispatcher"); return; @@ -529,6 +539,21 @@ void SwDrawShell::GetState(SfxItemSet& rSet) rSet.DisableItem(nWhich); break; } + case FN_REMOVE_TEXT_BOX: + { + bool bDisable = true; + if (SdrObject* pObj = IsSingleFillableNonOLESelected()) + { + SwFrmFmt* pFrmFmt = ::FindFrmFmt(pObj); + // Allow removing a TextBox only in case it has one. + if (pFrmFmt && SwTextBoxHelper::findTextBox(pFrmFmt)) + bDisable = false; + } + + if (bDisable) + rSet.DisableItem(nWhich); + break; + } } nWhich = aIter.NextWhich(); } |