summaryrefslogtreecommitdiff
path: root/sw/source/uibase/shells/drawsh.cxx
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2014-06-19 10:11:10 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-06-19 11:29:31 +0200
commit7f77b8a689f84a03495ac5911236b68f01ee7b24 (patch)
tree88641a11936b836c9a0167e20de72f1ed1df7c82 /sw/source/uibase/shells/drawsh.cxx
parentf870059a5a777b1e198b2a34af0675eb36feb8be (diff)
sw: add UI for adding a textbox for a draw shape
Change-Id: Icc4ff083431635f1769dba5907f26e7dc6b08d02
Diffstat (limited to 'sw/source/uibase/shells/drawsh.cxx')
-rw-r--r--sw/source/uibase/shells/drawsh.cxx27
1 files changed, 27 insertions, 0 deletions
diff --git a/sw/source/uibase/shells/drawsh.cxx b/sw/source/uibase/shells/drawsh.cxx
index cf7dba779fc1..76d2538f7fd1 100644
--- a/sw/source/uibase/shells/drawsh.cxx
+++ b/sw/source/uibase/shells/drawsh.cxx
@@ -32,6 +32,8 @@
#include <svx/fontworkbar.hxx>
#include <svx/tbxcustomshapes.hxx>
#include <uitool.hxx>
+#include <dcontact.hxx>
+#include <textboxhelper.hxx>
#include <wview.hxx>
#include <swmodule.hxx>
#include <swwait.hxx>
@@ -397,6 +399,16 @@ void SwDrawShell::Execute(SfxRequest &rReq)
break;
}
+ case FN_ADD_TEXT_BOX:
+ {
+ if (SdrObject* pObj = IsSingleFillableNonOLESelected())
+ {
+ SwFrmFmt* pFrmFmt = ::FindFrmFmt(pObj);
+ if (pFrmFmt)
+ SwTextBoxHelper::create(pFrmFmt);
+ }
+ break;
+ }
default:
OSL_ENSURE(!this, "wrong dispatcher");
return;
@@ -502,6 +514,21 @@ void SwDrawShell::GetState(SfxItemSet& rSet)
break;
}
+ case FN_ADD_TEXT_BOX:
+ {
+ bool bDisable = true;
+ if (SdrObject* pObj = IsSingleFillableNonOLESelected())
+ {
+ SwFrmFmt* pFrmFmt = ::FindFrmFmt(pObj);
+ // Allow creating a TextBox only in case this is a draw format without a TextBox so far.
+ if (pFrmFmt && pFrmFmt->Which() == RES_DRAWFRMFMT && !SwTextBoxHelper::findTextBox(pFrmFmt))
+ bDisable = false;
+ }
+
+ if (bDisable)
+ rSet.DisableItem(nWhich);
+ break;
+ }
}
nWhich = aIter.NextWhich();
}