summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/inc/unodraw.hxx4
-rw-r--r--sw/source/core/unocore/unodraw.cxx26
2 files changed, 26 insertions, 4 deletions
diff --git a/sw/inc/unodraw.hxx b/sw/inc/unodraw.hxx
index 540448dd6965..06b4c3004710 100644
--- a/sw/inc/unodraw.hxx
+++ b/sw/inc/unodraw.hxx
@@ -34,6 +34,7 @@
#include <com/sun/star/container/XEnumerationAccess.hpp>
#include <com/sun/star/drawing/HomogenMatrix3.hpp>
#include <svl/itemprop.hxx>
+#include <set>
class SdrMarkList;
class SdrView;
@@ -116,6 +117,9 @@ public:
SwFmDrawPage* GetSvxPage();
// renamed and outlined to detect where it's called
void InvalidateSwDoc(); // {pDoc = 0;}
+ SwDoc* GetDoc();
+ /// Same as getByIndex(nIndex), except that it also takes a set of formats to ignore, so the method itself doesn't have to generate such a list.
+ css::uno::Any getByIndex(sal_Int32 nIndex, std::set<const SwFrmFmt*>* pTextBoxes) throw(css::lang::IndexOutOfBoundsException, css::lang::WrappedTargetException, css::uno::RuntimeException, std::exception);
};
class SwShapeDescriptor_Impl;
diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx
index af81b3550b14..8bcb838d3227 100644
--- a/sw/source/core/unocore/unodraw.cxx
+++ b/sw/source/core/unocore/unodraw.cxx
@@ -404,9 +404,10 @@ SwXShapesEnumeration::SwXShapesEnumeration(SwXDrawPage* const pDrawPage)
SolarMutexGuard aGuard;
::std::insert_iterator<shapescontainer_t> pInserter = ::std::insert_iterator<shapescontainer_t>(m_aShapes, m_aShapes.begin());
sal_Int32 nCount = pDrawPage->getCount();
+ std::set<const SwFrmFmt*> aTextBoxes = SwTextBoxHelper::findTextBoxes(pDrawPage->GetDoc());
for(sal_Int32 nIdx = 0; nIdx < nCount; nIdx++)
{
- uno::Reference<drawing::XShape> xShape = uno::Reference<drawing::XShape>(pDrawPage->getByIndex(nIdx), uno::UNO_QUERY);
+ uno::Reference<drawing::XShape> xShape = uno::Reference<drawing::XShape>(pDrawPage->getByIndex(nIdx, &aTextBoxes), uno::UNO_QUERY);
*pInserter++ = uno::makeAny(xShape);
}
}
@@ -545,6 +546,12 @@ uno::Any SwXDrawPage::getByIndex(sal_Int32 nIndex)
throw( lang::IndexOutOfBoundsException, lang::WrappedTargetException,
uno::RuntimeException, std::exception )
{
+ return getByIndex(nIndex, 0);
+}
+
+uno::Any SwXDrawPage::getByIndex(sal_Int32 nIndex, std::set<const SwFrmFmt*>* pTextBoxes)
+ throw(lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
+{
SolarMutexGuard aGuard;
if(!pDoc)
throw uno::RuntimeException();
@@ -552,11 +559,17 @@ uno::Any SwXDrawPage::getByIndex(sal_Int32 nIndex)
throw lang::IndexOutOfBoundsException();
((SwXDrawPage*)this)->GetSvxPage();
- std::set<const SwFrmFmt*> aTextBoxes = SwTextBoxHelper::findTextBoxes(pDoc);
- if (aTextBoxes.empty())
+ std::set<const SwFrmFmt*> aTextBoxes;
+ if (!pTextBoxes)
+ {
+ // We got no set, so let's generate one.
+ aTextBoxes = SwTextBoxHelper::findTextBoxes(pDoc);
+ pTextBoxes = &aTextBoxes;
+ }
+ if (pTextBoxes->empty())
return pDrawPage->getByIndex( nIndex );
else
- return SwTextBoxHelper::getByIndex(pDrawPage->GetSdrPage(), nIndex, aTextBoxes);
+ return SwTextBoxHelper::getByIndex(pDrawPage->GetSdrPage(), nIndex, *pTextBoxes);
}
uno::Type SwXDrawPage::getElementType(void) throw( uno::RuntimeException, std::exception )
@@ -864,6 +877,11 @@ void SwXDrawPage::InvalidateSwDoc()
pDoc = 0;
}
+SwDoc* SwXDrawPage::GetDoc()
+{
+ return pDoc;
+}
+
TYPEINIT1(SwXShape, SwClient);
namespace