sw/inc/textboxhelper.hxx               |    7 +++----
 sw/source/core/doc/docfly.cxx          |    4 ++--
 sw/source/core/doc/textboxhelper.cxx   |   12 ++++++------
 sw/source/core/unocore/unocoll.cxx     |    2 +-
 sw/source/core/unocore/unodraw.cxx     |    4 ++--
 sw/source/core/unocore/unoframe.cxx    |    2 +-
 sw/source/core/unocore/unoobj2.cxx     |    2 +-
 sw/source/core/unocore/unoportenum.cxx |    4 ++--
 sw/source/filter/ww8/docxsdrexport.cxx |    2 +-
 9 files changed, 19 insertions(+), 20 deletions(-)

New commits:
commit 0da4e600e6df511edc20aa21353911f907e161d8
Author: Miklos Vajna <vmik...@collabora.co.uk>
Date:   Wed Jun 25 15:37:15 2014 +0200

    Let SwTextBoxHelper::findTextBoxes() return a set
    
    The intention was to have a container where it's fast to look elements
    up, and list is a linked list, so it doesn't fit.
    
    Change-Id: I3196c8dee96ecd4a6f464b74fd5141b27f1773b8

diff --git a/sw/inc/textboxhelper.hxx b/sw/inc/textboxhelper.hxx
index 8b48564..f2aab3b 100644
--- a/sw/inc/textboxhelper.hxx
+++ b/sw/inc/textboxhelper.hxx
@@ -10,7 +10,6 @@
 #ifndef INCLUDED_SW_INC_TEXTBOXHELPER_HXX
 #define INCLUDED_SW_INC_TEXTBOXHELPER_HXX
 
-#include <list>
 #include <map>
 #include <set>
 #include <vector>
@@ -68,13 +67,13 @@ public:
     static Rectangle getTextRectangle(SwFrmFmt* pShape, bool bAbsolute = true);
 
     /// Look up TextFrames in a document, which are in fact TextBoxes.
-    static std::list<SwFrmFmt*> findTextBoxes(const SwDoc* pDoc);
+    static std::set<SwFrmFmt*> findTextBoxes(const SwDoc* pDoc);
     /// Build a textbox -> shape format map.
     static std::map<SwFrmFmt*, SwFrmFmt*> findShapes(const SwDoc* pDoc);
     /// Count number of shapes in the document, excluding TextBoxes.
-    static sal_Int32 getCount(SdrPage* pPage, std::list<SwFrmFmt*>& 
rTextBoxes);
+    static sal_Int32 getCount(SdrPage* pPage, std::set<SwFrmFmt*>& rTextBoxes);
     /// Get a shape by index, excluding TextBoxes.
-    static css::uno::Any getByIndex(SdrPage* pPage, sal_Int32 nIndex, 
std::list<SwFrmFmt*>& rTextBoxes) throw(css::lang::IndexOutOfBoundsException);
+    static css::uno::Any getByIndex(SdrPage* pPage, sal_Int32 nIndex, 
std::set<SwFrmFmt*>& rTextBoxes) throw(css::lang::IndexOutOfBoundsException);
 
     /// Saves the current shape -> textbox links in a map, so they can be 
restored later.
     static void saveLinks(const SwFrmFmts& rFormats, std::map<const SwFrmFmt*, 
const SwFrmFmt*>& rLinks);
diff --git a/sw/source/core/doc/docfly.cxx b/sw/source/core/doc/docfly.cxx
index 79f516e..0e45f7a 100644
--- a/sw/source/core/doc/docfly.cxx
+++ b/sw/source/core/doc/docfly.cxx
@@ -78,7 +78,7 @@ sal_uInt16 SwDoc::GetFlyCount( FlyCntType eType, bool 
bIgnoreTextBoxes ) const
     sal_uInt16 nCount = 0;
     const SwNodeIndex* pIdx;
 
-    std::list<SwFrmFmt*> aTextBoxes;
+    std::set<SwFrmFmt*> aTextBoxes;
     if (bIgnoreTextBoxes)
         aTextBoxes = SwTextBoxHelper::findTextBoxes(this);
 
@@ -130,7 +130,7 @@ SwFrmFmt* SwDoc::GetFlyNum( sal_uInt16 nIdx, FlyCntType 
eType, bool bIgnoreTextB
     const SwNodeIndex* pIdx;
     sal_uInt16 nCount = 0;
 
-    std::list<SwFrmFmt*> aTextBoxes;
+    std::set<SwFrmFmt*> aTextBoxes;
     if (bIgnoreTextBoxes)
         aTextBoxes = SwTextBoxHelper::findTextBoxes(this);
 
diff --git a/sw/source/core/doc/textboxhelper.cxx 
b/sw/source/core/doc/textboxhelper.cxx
index 5e1b502..2c90530 100644
--- a/sw/source/core/doc/textboxhelper.cxx
+++ b/sw/source/core/doc/textboxhelper.cxx
@@ -111,16 +111,16 @@ void SwTextBoxHelper::destroy(SwFrmFmt* pShape)
     }
 }
 
-std::list<SwFrmFmt*> SwTextBoxHelper::findTextBoxes(const SwDoc* pDoc)
+std::set<SwFrmFmt*> SwTextBoxHelper::findTextBoxes(const SwDoc* pDoc)
 {
-    std::list<SwFrmFmt*> aRet;
+    std::set<SwFrmFmt*> aRet;
 
     const SwFrmFmts& rSpzFrmFmts = *pDoc->GetSpzFrmFmts();
     for (SwFrmFmts::const_iterator it = rSpzFrmFmts.begin(); it != 
rSpzFrmFmts.end(); ++it)
     {
         SwFrmFmt* pTextBox = findTextBox(*it);
         if (pTextBox)
-            aRet.push_back(pTextBox);
+            aRet.insert(pTextBox);
     }
 
     return aRet;
@@ -142,13 +142,13 @@ std::map<SwFrmFmt*, SwFrmFmt*> 
SwTextBoxHelper::findShapes(const SwDoc* pDoc)
 }
 
 /// If the passed SdrObject is in fact a TextFrame, that is used as a TextBox.
-bool lcl_isTextBox(SdrObject* pSdrObject, std::list<SwFrmFmt*>& rTextBoxes)
+bool lcl_isTextBox(SdrObject* pSdrObject, std::set<SwFrmFmt*>& rTextBoxes)
 {
     SwVirtFlyDrawObj* pObject = PTR_CAST(SwVirtFlyDrawObj, pSdrObject);
     return pObject && std::find(rTextBoxes.begin(), rTextBoxes.end(), 
pObject->GetFmt()) != rTextBoxes.end();
 }
 
-sal_Int32 SwTextBoxHelper::getCount(SdrPage* pPage, std::list<SwFrmFmt*>& 
rTextBoxes)
+sal_Int32 SwTextBoxHelper::getCount(SdrPage* pPage, std::set<SwFrmFmt*>& 
rTextBoxes)
 {
     sal_Int32 nRet = 0;
     for (size_t i = 0; i < pPage->GetObjCount(); ++i)
@@ -160,7 +160,7 @@ sal_Int32 SwTextBoxHelper::getCount(SdrPage* pPage, 
std::list<SwFrmFmt*>& rTextB
     return nRet;
 }
 
-uno::Any SwTextBoxHelper::getByIndex(SdrPage* pPage, sal_Int32 nIndex, 
std::list<SwFrmFmt*>& rTextBoxes) throw(lang::IndexOutOfBoundsException)
+uno::Any SwTextBoxHelper::getByIndex(SdrPage* pPage, sal_Int32 nIndex, 
std::set<SwFrmFmt*>& rTextBoxes) throw(lang::IndexOutOfBoundsException)
 {
     if (nIndex < 0 || nIndex >= getCount(pPage, rTextBoxes))
         throw lang::IndexOutOfBoundsException();
diff --git a/sw/source/core/unocore/unocoll.cxx 
b/sw/source/core/unocore/unocoll.cxx
index 084d486..c6a351d 100644
--- a/sw/source/core/unocore/unocoll.cxx
+++ b/sw/source/core/unocore/unocoll.cxx
@@ -1090,7 +1090,7 @@ SwXFrameEnumeration<T>::SwXFrameEnumeration(const SwDoc* 
const pDoc)
     // #i104937#
     SwFrmFmt* pFmt( 0 );
 
-    std::list<SwFrmFmt*> aTextBoxes = SwTextBoxHelper::findTextBoxes(pDoc);
+    std::set<SwFrmFmt*> aTextBoxes = SwTextBoxHelper::findTextBoxes(pDoc);
 
     for( size_t i = 0; i < nSize; ++i )
 //    for(SwFrmFmt* pFmt = (*pFmts)[0]; pFmt < pFmtsEnd; ++pFmt)
diff --git a/sw/source/core/unocore/unodraw.cxx 
b/sw/source/core/unocore/unodraw.cxx
index 4bc32b4..c11fc43 100644
--- a/sw/source/core/unocore/unodraw.cxx
+++ b/sw/source/core/unocore/unodraw.cxx
@@ -521,7 +521,7 @@ sal_Int32 SwXDrawPage::getCount(void) throw( 
uno::RuntimeException, std::excepti
     {
         ((SwXDrawPage*)this)->GetSvxPage();
 
-        std::list<SwFrmFmt*> aTextBoxes = SwTextBoxHelper::findTextBoxes(pDoc);
+        std::set<SwFrmFmt*> aTextBoxes = SwTextBoxHelper::findTextBoxes(pDoc);
 
         if (aTextBoxes.empty())
             return pDrawPage->getCount();
@@ -541,7 +541,7 @@ uno::Any SwXDrawPage::getByIndex(sal_Int32 nIndex)
         throw lang::IndexOutOfBoundsException();
 
     ((SwXDrawPage*)this)->GetSvxPage();
-    std::list<SwFrmFmt*> aTextBoxes = SwTextBoxHelper::findTextBoxes(pDoc);
+    std::set<SwFrmFmt*> aTextBoxes = SwTextBoxHelper::findTextBoxes(pDoc);
     if (aTextBoxes.empty())
         return pDrawPage->getByIndex( nIndex );
     else
diff --git a/sw/source/core/unocore/unoframe.cxx 
b/sw/source/core/unocore/unoframe.cxx
index ca1555b..99ada2c 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -1680,7 +1680,7 @@ void SwXFrame::setPropertyValue(const :: OUString& 
rPropertyName, const :: uno::
             aValue >>= nZOrder;
 
             // Don't set an explicit ZOrder on TextBoxes.
-            std::list<SwFrmFmt*> aTextBoxes = 
SwTextBoxHelper::findTextBoxes(pDoc);
+            std::set<SwFrmFmt*> aTextBoxes = 
SwTextBoxHelper::findTextBoxes(pDoc);
             if( nZOrder >= 0 && std::find(aTextBoxes.begin(), 
aTextBoxes.end(), pFmt) == aTextBoxes.end())
             {
                 SdrObject* pObject =
diff --git a/sw/source/core/unocore/unoobj2.cxx 
b/sw/source/core/unocore/unoobj2.cxx
index cb0dfc5..3f6734e 100644
--- a/sw/source/core/unocore/unoobj2.cxx
+++ b/sw/source/core/unocore/unoobj2.cxx
@@ -183,7 +183,7 @@ void CollectFrameAtNode( SwClient& rClnt, const 
SwNodeIndex& rIdx,
         const SwSortedObjs *pObjs = pCFrm->GetDrawObjs();
         if( pObjs )
         {
-            std::list<SwFrmFmt*> aTextBoxes = 
SwTextBoxHelper::findTextBoxes(pDoc);
+            std::set<SwFrmFmt*> aTextBoxes = 
SwTextBoxHelper::findTextBoxes(pDoc);
             for( sal_uInt32 i = 0; i < pObjs->Count(); ++i )
             {
                 SwAnchoredObject* pAnchoredObj = (*pObjs)[i];
diff --git a/sw/source/core/unocore/unoportenum.cxx 
b/sw/source/core/unocore/unoportenum.cxx
index c4d49ca..f05ccfb 100644
--- a/sw/source/core/unocore/unoportenum.cxx
+++ b/sw/source/core/unocore/unoportenum.cxx
@@ -690,7 +690,7 @@ lcl_ExportHints(
     const bool bRightMoveForbidden,
     bool & o_rbCursorMoved,
     sal_Int32 & o_rNextAttrPosition,
-    std::list<SwFrmFmt*>& rTextBoxes)
+    std::set<SwFrmFmt*>& rTextBoxes)
 {
     // if the attribute has a dummy character, then xRef is set (except META)
     // otherwise, the portion for the attribute is inserted into rPortions!
@@ -1242,7 +1242,7 @@ static void lcl_CreatePortions(
     PortionStack_t PortionStack;
     PortionStack.push( PortionList_t(&i_rPortions, (const SwTxtAttr *)0) );
 
-    std::list<SwFrmFmt*> aTextBoxes = SwTextBoxHelper::findTextBoxes(pDoc);
+    std::set<SwFrmFmt*> aTextBoxes = SwTextBoxHelper::findTextBoxes(pDoc);
 
     bool bAtEnd( false );
     while (!bAtEnd) // every iteration consumes at least current character!
diff --git a/sw/source/filter/ww8/docxsdrexport.cxx 
b/sw/source/filter/ww8/docxsdrexport.cxx
index d3efe2a..bb923aa 100644
--- a/sw/source/filter/ww8/docxsdrexport.cxx
+++ b/sw/source/filter/ww8/docxsdrexport.cxx
@@ -163,7 +163,7 @@ struct DocxSdrExport::Impl
     sal_Int32 m_nSeq ;
     bool m_bDMLAndVMLDrawingOpen;
     /// List of TextBoxes in this document: they are exported as part of their 
shape, never alone.
-    std::list<SwFrmFmt*> m_aTextBoxes;
+    std::set<SwFrmFmt*> m_aTextBoxes;
 
     Impl(DocxSdrExport& rSdrExport, DocxExport& rExport, 
sax_fastparser::FSHelperPtr pSerializer, oox::drawingml::DrawingML* pDrawingML)
         : m_rSdrExport(rSdrExport),
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to