summaryrefslogtreecommitdiff
path: root/sw/inc
diff options
context:
space:
mode:
authorDaisuke Nishino <niboshi000@gmail.com>2011-11-23 13:12:43 +0000
committerCaolán McNamara <caolanm@redhat.com>2011-11-23 13:56:37 +0000
commit858b5b4f36a357fe7192e7c2ed9cc3cdfc81fd8f (patch)
tree963b3823812f1d3cdb1301036f50c8d194edefcb /sw/inc
parenta9edd1267e42ba4e7814102bcaab6610d14bc3b8 (diff)
SwSelBoxes: svarray -> std::map
Diffstat (limited to 'sw/inc')
-rw-r--r--sw/inc/swcrsr.hxx7
-rw-r--r--sw/inc/swtable.hxx5
-rw-r--r--sw/inc/tblsel.hxx27
3 files changed, 33 insertions, 6 deletions
diff --git a/sw/inc/swcrsr.hxx b/sw/inc/swcrsr.hxx
index d99d52708fc1..f7bb24827935 100644
--- a/sw/inc/swcrsr.hxx
+++ b/sw/inc/swcrsr.hxx
@@ -283,9 +283,12 @@ public:
virtual sal_Bool GotoTable( const String& rName );
void InsertBox( const SwTableBox& rTblBox );
- void DeleteBox( sal_uInt16 nPos ) { aSelBoxes.Remove( nPos ); bChg = sal_True; }
- sal_uInt16 GetBoxesCount() const { return aSelBoxes.Count(); }
+ void DeleteBox( SwSelBoxes::const_iterator it ) { aSelBoxes.erase( it ); bChg = sal_True; }
+ void DeleteBox( SwSelBoxes::const_iterator itFirst, SwSelBoxes::const_iterator itLast ) { aSelBoxes.erase( itFirst, itLast ); bChg = sal_True; }
+ void DeleteAllBoxes() { DeleteBox(aSelBoxes.begin(), aSelBoxes.end()); }
+ sal_uInt16 GetBoxesCount() const { return aSelBoxes.size(); }
const SwSelBoxes& GetBoxes() const { return aSelBoxes; }
+ SwSelBoxes& GetBoxes() { return aSelBoxes; }
// Creates cursor for all boxes.
SwCursor* MakeBoxSels( SwCursor* pAktCrsr );
diff --git a/sw/inc/swtable.hxx b/sw/inc/swtable.hxx
index 7e0157bdaa1f..4239bf6fcb21 100644
--- a/sw/inc/swtable.hxx
+++ b/sw/inc/swtable.hxx
@@ -34,6 +34,7 @@
#include <swtypes.hxx>
#include <calbck.hxx>
#include <swrect.hxx>
+#include <frmfmt.hxx>
#if OSL_DEBUG_LEVEL > 1
class SwStartNode;
@@ -45,7 +46,6 @@ class SwStartNode;
class SwFmt;
class Color;
-class SwFrmFmt;
class SwTableFmt;
class SwTableLineFmt;
class SwTableBoxFmt;
@@ -407,8 +407,7 @@ public:
const SwTableLine *GetUpper() const { return pUpper; }
void SetUpper( SwTableLine *pNew ) { pUpper = pNew; }
- SwFrmFmt* GetFrmFmt() { return (SwFrmFmt*)GetRegisteredIn(); }
- SwFrmFmt* GetFrmFmt() const { return (SwFrmFmt*)GetRegisteredIn(); }
+ SwFrmFmt* GetFrmFmt() const { return const_cast<SwFrmFmt*>(static_cast<const SwFrmFmt*>(GetRegisteredIn())); }
// Creates its own FrmFmt if more boxes depend on it.
SwFrmFmt* ClaimFrmFmt();
diff --git a/sw/inc/tblsel.hxx b/sw/inc/tblsel.hxx
index 83c127bfa9ef..314ce4728cfa 100644
--- a/sw/inc/tblsel.hxx
+++ b/sw/inc/tblsel.hxx
@@ -33,6 +33,8 @@
#include <swrect.hxx>
#include "swdllapi.h"
+#include <map>
+
class SwCrsrShell;
class SwCursor;
class SwTableCursor;
@@ -48,7 +50,30 @@ class SwUndoTblMerge;
class SwCellFrm;
SV_DECL_PTRARR( SwCellFrms, SwCellFrm*, 16, 16 )
-SV_DECL_PTRARR_SORT( SwSelBoxes, SwTableBoxPtr, 10, 20 )
+
+
+class SwSelBoxes : public std::map<sal_uLong, SwTableBox*> {
+ typedef std::map<sal_uLong, SwTableBox*> Base;
+public:
+ using Base::insert;
+ using Base::find;
+ using Base::count;
+
+ std::pair<iterator, bool>
+ insert(SwTableBox* pBox) { return Base::insert(std::make_pair(pBox->GetSttIdx(), pBox)); }
+
+ iterator
+ insert(iterator it, SwTableBox* pBox) { return Base::insert(it, std::make_pair(pBox->GetSttIdx(), pBox)); }
+
+ size_type
+ count(const SwTableBox* pBox) const { return Base::count(pBox->GetSttIdx()); }
+
+ iterator
+ find(const SwTableBox* pBox) { return Base::find(pBox->GetSttIdx()); }
+
+ const_iterator
+ find(const SwTableBox* pBox) const { return Base::find(pBox->GetSttIdx()); }
+};
// Collects all boxes in table that are selected.