summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/core/doc/textboxhelper.cxx15
-rw-r--r--sw/source/core/frmedt/feshview.cxx17
-rw-r--r--sw/source/uibase/docvw/edtwin.cxx19
3 files changed, 49 insertions, 2 deletions
diff --git a/sw/source/core/doc/textboxhelper.cxx b/sw/source/core/doc/textboxhelper.cxx
index 8e6bfd5b152c..90d2b5446beb 100644
--- a/sw/source/core/doc/textboxhelper.cxx
+++ b/sw/source/core/doc/textboxhelper.cxx
@@ -126,6 +126,21 @@ std::list<SwFrmFmt*> SwTextBoxHelper::findTextBoxes(const SwDoc* pDoc)
return aRet;
}
+std::map<SwFrmFmt*, SwFrmFmt*> SwTextBoxHelper::findShapes(const SwDoc* pDoc)
+{
+ std::map<SwFrmFmt*, SwFrmFmt*> aRet;
+
+ const SwFrmFmts& rSpzFrmFmts = *pDoc->GetSpzFrmFmts();
+ for (SwFrmFmts::const_iterator it = rSpzFrmFmts.begin(); it != rSpzFrmFmts.end(); ++it)
+ {
+ SwFrmFmt* pTextBox = findTextBox(*it);
+ if (pTextBox)
+ aRet[pTextBox] = *it;
+ }
+
+ return aRet;
+}
+
/// If the passed SdrObject is in fact a TextFrame, that is used as a TextBox.
bool lcl_isTextBox(SdrObject* pSdrObject, std::list<SwFrmFmt*>& rTextBoxes)
{
diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx
index e1655e84112d..6ff58cc8c322 100644
--- a/sw/source/core/frmedt/feshview.cxx
+++ b/sw/source/core/frmedt/feshview.cxx
@@ -40,6 +40,7 @@
#include <DocumentSettingManager.hxx>
#include <cmdid.h>
#include <drawdoc.hxx>
+#include <textboxhelper.hxx>
#include <poolfmt.hrc>
#include <frmfmt.hxx>
#include <frmatr.hxx>
@@ -220,6 +221,22 @@ bool SwFEShell::SelectObj( const Point& rPt, sal_uInt8 nFlag, SdrObject *pObj )
}
}
+ // If the fly frame is a textbox of a shape, then select the shape instead.
+ std::map<SwFrmFmt*, SwFrmFmt*> aTextBoxShapes = SwTextBoxHelper::findShapes(mpDoc);
+ for (sal_uInt16 i = 0; i < rMrkList.GetMarkCount(); ++i)
+ {
+ SdrObject* pObject = rMrkList.GetMark(i)->GetMarkedSdrObj();
+ SwDrawContact* pDrawContact = static_cast<SwDrawContact*>(GetUserCall(pObject));
+ SwFrmFmt* pFmt = pDrawContact->GetFmt();
+ if (aTextBoxShapes.find(pFmt) != aTextBoxShapes.end())
+ {
+ SdrObject* pShape = aTextBoxShapes[pFmt]->FindSdrObject();
+ pDView->UnmarkAll();
+ pDView->MarkObj(pShape, Imp()->GetPageView(), bAddSelect, bEnterGroup);
+ break;
+ }
+ }
+
if ( bRet )
{
::lcl_GrabCursor(this, pOldSelFly);
diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx
index e1fda396a3a2..6887cd06b1c1 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -76,6 +76,8 @@
#include <wrtsh.hxx>
#include <IDocumentSettingAccess.hxx>
#include <IDocumentDrawModelAccess.hxx>
+#include <textboxhelper.hxx>
+#include <dcontact.hxx>
#include <fldbas.hxx>
#include <swmodule.hxx>
#include <docsh.hxx>
@@ -4241,8 +4243,21 @@ void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt)
SdrPageView* pPV;
if (pSdrView->PickObj(aDocPos, pSdrView->getHitTolLog(), pObj, pPV, SDRSEARCH_ALSOONMASTER ))
{
- pSdrView->UnmarkAllObj();
- pSdrView->MarkObj(pObj,pPV,false,false);
+ std::map<SwFrmFmt*, SwFrmFmt*> aTextBoxShapes = SwTextBoxHelper::findShapes(rSh.GetDoc());
+ SwDrawContact* pDrawContact = static_cast<SwDrawContact*>(GetUserCall(pObj));
+ SwFrmFmt* pFmt = pDrawContact->GetFmt();
+ if (aTextBoxShapes.find(pFmt) == aTextBoxShapes.end())
+ {
+ pSdrView->UnmarkAllObj();
+ pSdrView->MarkObj(pObj,pPV,false,false);
+ }
+ else
+ {
+ // If the fly frame is a textbox of a shape, then select the shape instead.
+ SdrObject* pShape = aTextBoxShapes[pFmt]->FindSdrObject();
+ pSdrView->UnmarkAllObj();
+ pSdrView->MarkObj(pShape, pPV, false, false);
+ }
}
}
ReleaseMouse();