summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2014-06-06 11:44:15 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-06-06 14:24:26 +0200
commitff1c74f53a66695f20906fe3a0aebd15b6b0cd51 (patch)
treec014baec78914372834e003cff31754e6ff34dd8 /sw
parent0a1b1511faaa3302429d93ccdad3eb41dc8f36cb (diff)
SwTextBoxHelper::findTextBox: add an UNO version
Export filters don't have access to SwXShape, and it's probably good to have that way. Change-Id: I039bafec10d2fde7c7acdcfad5b07068a2a519f1
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/textboxhelper.hxx6
-rw-r--r--sw/source/core/doc/textboxhelper.cxx10
2 files changed, 15 insertions, 1 deletions
diff --git a/sw/inc/textboxhelper.hxx b/sw/inc/textboxhelper.hxx
index 75d2fac0eed4..2bb791f31c0d 100644
--- a/sw/inc/textboxhelper.hxx
+++ b/sw/inc/textboxhelper.hxx
@@ -12,10 +12,13 @@
#include <list>
+#include <com/sun/star/drawing/XShape.hpp>
#include <com/sun/star/uno/Any.h>
#include <com/sun/star/uno/Type.h>
#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
+#include <swdllapi.h>
+
class SdrPage;
class SwFrmFmt;
class SwDoc;
@@ -27,7 +30,7 @@ class Rectangle;
* This class provides helper methods to create, query and maintain such
* TextBoxes.
*/
-class SwTextBoxHelper
+class SW_DLLPUBLIC SwTextBoxHelper
{
public:
/// Create a TextBox for a shape.
@@ -44,6 +47,7 @@ public:
/// If we have an associated TextFrame, then return that.
static SwFrmFmt* findTextBox(SwFrmFmt* pShape);
+ static SwFrmFmt* findTextBox(css::uno::Reference<css::drawing::XShape> xShape);
/// Return the textbox rectangle of a draw shape (in twips).
static Rectangle getTextRectangle(SwFrmFmt* pShape, bool bAbsolute = true);
diff --git a/sw/source/core/doc/textboxhelper.cxx b/sw/source/core/doc/textboxhelper.cxx
index 0741dd81ba59..598d4b8da640 100644
--- a/sw/source/core/doc/textboxhelper.cxx
+++ b/sw/source/core/doc/textboxhelper.cxx
@@ -15,6 +15,7 @@
#include <docary.hxx>
#include <unocoll.hxx>
#include <unoframe.hxx>
+#include <unodraw.hxx>
#include <unotextbodyhf.hxx>
#include <unotextrange.hxx>
#include <unomid.h>
@@ -156,6 +157,15 @@ uno::Any SwTextBoxHelper::getByIndex(SdrPage* pPage, sal_Int32 nIndex, std::list
return pRet ? uno::makeAny(uno::Reference<drawing::XShape>(pRet->getUnoShape(), uno::UNO_QUERY)) : uno::Any();
}
+SwFrmFmt* SwTextBoxHelper::findTextBox(uno::Reference<drawing::XShape> xShape)
+{
+ SwXShape* pShape = dynamic_cast<SwXShape*>(xShape.get());
+ if (!pShape)
+ return 0;
+
+ return findTextBox(pShape->GetFrmFmt());
+}
+
SwFrmFmt* SwTextBoxHelper::findTextBox(SwFrmFmt* pShape)
{
SwFrmFmt* pRet = 0;