Kaydet (Commit) ff1c74f5 authored tarafından Miklos Vajna's avatar Miklos Vajna

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
üst 0a1b1511
...@@ -12,10 +12,13 @@ ...@@ -12,10 +12,13 @@
#include <list> #include <list>
#include <com/sun/star/drawing/XShape.hpp>
#include <com/sun/star/uno/Any.h> #include <com/sun/star/uno/Any.h>
#include <com/sun/star/uno/Type.h> #include <com/sun/star/uno/Type.h>
#include <com/sun/star/lang/IndexOutOfBoundsException.hpp> #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
#include <swdllapi.h>
class SdrPage; class SdrPage;
class SwFrmFmt; class SwFrmFmt;
class SwDoc; class SwDoc;
...@@ -27,7 +30,7 @@ class Rectangle; ...@@ -27,7 +30,7 @@ class Rectangle;
* This class provides helper methods to create, query and maintain such * This class provides helper methods to create, query and maintain such
* TextBoxes. * TextBoxes.
*/ */
class SwTextBoxHelper class SW_DLLPUBLIC SwTextBoxHelper
{ {
public: public:
/// Create a TextBox for a shape. /// Create a TextBox for a shape.
...@@ -44,6 +47,7 @@ public: ...@@ -44,6 +47,7 @@ public:
/// If we have an associated TextFrame, then return that. /// If we have an associated TextFrame, then return that.
static SwFrmFmt* findTextBox(SwFrmFmt* pShape); 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). /// Return the textbox rectangle of a draw shape (in twips).
static Rectangle getTextRectangle(SwFrmFmt* pShape, bool bAbsolute = true); static Rectangle getTextRectangle(SwFrmFmt* pShape, bool bAbsolute = true);
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include <docary.hxx> #include <docary.hxx>
#include <unocoll.hxx> #include <unocoll.hxx>
#include <unoframe.hxx> #include <unoframe.hxx>
#include <unodraw.hxx>
#include <unotextbodyhf.hxx> #include <unotextbodyhf.hxx>
#include <unotextrange.hxx> #include <unotextrange.hxx>
#include <unomid.h> #include <unomid.h>
...@@ -156,6 +157,15 @@ uno::Any SwTextBoxHelper::getByIndex(SdrPage* pPage, sal_Int32 nIndex, std::list ...@@ -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(); 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* SwTextBoxHelper::findTextBox(SwFrmFmt* pShape)
{ {
SwFrmFmt* pRet = 0; SwFrmFmt* pRet = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment