summaryrefslogtreecommitdiff
path: root/sw/source/core/unocore/unodraw.cxx
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2014-10-31 17:00:45 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-10-31 17:17:02 +0100
commit693014c9d3dcbf3c649d775143918e531b6e3ac0 (patch)
treeac0fef8fdc8a2522810c5dd44a18d832b79a9b50 /sw/source/core/unocore/unodraw.cxx
parent32bbe44e894a6575899418cff88f0ccdd5dae393 (diff)
SwXShapesEnumeration: don't generate a set of TextBoxes for each shape
Instead, generate it once and then pass around that list. Again, this helps ODF export. For a test document of 2000 mail merge records and 16 frames, the times for css::text::MailMerge::execute() are 7m53.575s -> 7m30.261s. Change-Id: Iec993ec34392350b1e26857f7d5434a0a9c494a3
Diffstat (limited to 'sw/source/core/unocore/unodraw.cxx')
-rw-r--r--sw/source/core/unocore/unodraw.cxx26
1 files changed, 22 insertions, 4 deletions
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