diff options
author | Jan-Marek Glogowski <glogow@fbihome.de> | 2016-07-22 17:50:52 +0200 |
---|---|---|
committer | Jan-Marek Glogowski <glogow@fbihome.de> | 2016-08-29 13:13:14 +0200 |
commit | 0bcc5b3daebeb2a7d2b5ba132af4745cc6c78cd0 (patch) | |
tree | 4fcff9413879a6dd789cee6e8450db5496785c75 /sw/source/core/unocore/unodraw.cxx | |
parent | 5bed080c77f99f22fd52ad6cf2d6274e7c1e12a8 (diff) |
Switch isTextBox to use the format pointers
This replaces all possible occurences of the text box format
maps, which just want to know, if a SwFrameFormat is part of a
text box to use the direct lookup via the isTextBox, which is
now a cheap call.
Change-Id: I3b4e2301f816aead1b719cd70a8ef118e685ccfc
Diffstat (limited to 'sw/source/core/unocore/unodraw.cxx')
-rw-r--r-- | sw/source/core/unocore/unodraw.cxx | 36 |
1 files changed, 6 insertions, 30 deletions
diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx index f3d7cf5614e2..846fe4252a70 100644 --- a/sw/source/core/unocore/unodraw.cxx +++ b/sw/source/core/unocore/unodraw.cxx @@ -397,10 +397,9 @@ 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 SwFrameFormat*> aTextBoxes = SwTextBoxHelper::findTextBoxes(pDrawPage->GetDoc()); for(sal_Int32 nIdx = 0; nIdx < nCount; nIdx++) { - uno::Reference<drawing::XShape> xShape(pDrawPage->getByIndex(nIdx, &aTextBoxes), uno::UNO_QUERY); + uno::Reference<drawing::XShape> xShape(pDrawPage->getByIndex(nIdx), uno::UNO_QUERY); *pInserter++ = uno::makeAny(xShape); } } @@ -523,13 +522,7 @@ sal_Int32 SwXDrawPage::getCount() throw( uno::RuntimeException, std::exception ) else { GetSvxPage(); - - std::set<const SwFrameFormat*> aTextBoxes = SwTextBoxHelper::findTextBoxes(pDoc); - - if (aTextBoxes.empty()) - return pDrawPage->getCount(); - else - return SwTextBoxHelper::getCount(pDrawPage->GetSdrPage(), aTextBoxes); + return SwTextBoxHelper::getCount(pDrawPage->GetSdrPage()); } } @@ -537,12 +530,6 @@ uno::Any SwXDrawPage::getByIndex(sal_Int32 nIndex) throw( lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException, std::exception ) { - return getByIndex(nIndex, nullptr); -} - -uno::Any SwXDrawPage::getByIndex(sal_Int32 nIndex, std::set<const SwFrameFormat*>* pTextBoxes) - throw(lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException, std::exception) -{ SolarMutexGuard aGuard; if(!pDoc) throw uno::RuntimeException(); @@ -550,17 +537,7 @@ uno::Any SwXDrawPage::getByIndex(sal_Int32 nIndex, std::set<const SwFrameFormat* throw lang::IndexOutOfBoundsException(); GetSvxPage(); - std::set<const SwFrameFormat*> 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, *pTextBoxes); + return SwTextBoxHelper::getByIndex(pDrawPage->GetSdrPage(), nIndex); } uno::Type SwXDrawPage::getElementType() throw( uno::RuntimeException, std::exception ) @@ -1554,7 +1531,7 @@ uno::Any SwXShape::getPropertyValue(const OUString& rPropertyName) } else if (pEntry->nWID == FN_TEXT_BOX) { - bool bValue = SwTextBoxHelper::findTextBox(pFormat); + bool bValue = SwTextBoxHelper::isTextBox(pFormat, RES_DRAWFRMFMT); aRet <<= bValue; } else if (pEntry->nWID == RES_CHAIN) @@ -1759,8 +1736,7 @@ uno::Any SwXShape::getPropertyValue(const OUString& rPropertyName) bConvert = false; if (bConvert) { - std::set<const SwFrameFormat*> aTextBoxes = SwTextBoxHelper::findTextBoxes(pFormat->GetDoc()); - aRet <<= SwTextBoxHelper::getOrdNum(pObj, aTextBoxes); + aRet <<= SwTextBoxHelper::getOrdNum(pObj); } } } @@ -1840,7 +1816,7 @@ uno::Sequence< beans::PropertyState > SwXShape::getPropertyStates( else if (pEntry->nWID == FN_TEXT_BOX) { // The TextBox property is set, if we can find a textbox for this shape. - if (pFormat && SwTextBoxHelper::findTextBox(pFormat)) + if (pFormat && SwTextBoxHelper::isTextBox(pFormat, RES_DRAWFRMFMT)) pRet[nProperty] = beans::PropertyState_DIRECT_VALUE; else pRet[nProperty] = beans::PropertyState_DEFAULT_VALUE; |