[Libreoffice-commits] .: binfilter/bf_svx
Joseph Powers
jpowers at kemper.freedesktop.org
Tue May 3 21:30:04 PDT 2011
binfilter/bf_svx/source/outliner/paralist.hxx | 47 +++++++++++++++-------
binfilter/bf_svx/source/outliner/svx_paralist.cxx | 47 +++++++++-------------
2 files changed, 54 insertions(+), 40 deletions(-)
New commits:
commit e0e7d2a2d881cdb2b50601bd03b2db6602e772b1
Author: Joseph Powers <jpowers27 at cox.net>
Date: Tue May 3 07:15:17 2011 -0700
Remove the base List class from ParagraphList
diff --git a/binfilter/bf_svx/source/outliner/paralist.hxx b/binfilter/bf_svx/source/outliner/paralist.hxx
index 89c4cf3..dffcc3d 100644
--- a/binfilter/bf_svx/source/outliner/paralist.hxx
+++ b/binfilter/bf_svx/source/outliner/paralist.hxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -29,30 +29,51 @@
#ifndef _PARALIST_HXX
#define _PARALIST_HXX
-
#include <bf_svtools/bf_solar.h>
-
-#include <tools/list.hxx>
-
#include <tools/link.hxx>
+#include <vector>
+
namespace binfilter {
class Paragraph;
-class ParagraphList : private List
+class ParagraphList
{
private:
Link aVisibleStateChangedHdl;
+ std::vector< Paragraph* > aList;
public:
void Clear( BOOL bDestroyParagraphs );
- ULONG GetParagraphCount() const { return List::Count(); }
- Paragraph* GetParagraph( ULONG nPos ) const { return (Paragraph*)List::GetObject( nPos ); }
-
- ULONG GetAbsPos( Paragraph* pParent ) const { return List::GetPos( pParent ); }
-
- void Insert( Paragraph* pPara, ULONG nAbsPos = LIST_APPEND ) { List::Insert( pPara, nAbsPos ); }
- void Remove( ULONG nPara ) { List::Remove( nPara ); }
+ ULONG GetParagraphCount() const { return aList.size(); }
+ Paragraph* GetParagraph( ULONG nPos ) const { return aList[ nPos ]; }
+
+ ULONG GetAbsPos( Paragraph* pParent ) const {
+ for( size_t i = 0, n = aList.size(); i < n; ++i ) {
+ if ( pParent == aList[ i ] ) {
+ return i;
+ }
+ }
+ return ULONG_MAX;
+ }
+
+ void Insert( Paragraph* pPara, ULONG nAbsPos = ULONG_MAX ) {
+ if ( nAbsPos < aList.size() ) {
+ std::vector< Paragraph* >::iterator it = aList.begin();
+ std::advance( it, nAbsPos );
+ aList.insert( it, pPara );
+ } else {
+ aList.push_back( pPara );
+ }
+ }
+
+ void Remove( ULONG nPara ) {
+ if ( nPara < aList.size() ) {
+ std::vector< Paragraph* >::iterator it = aList.begin();
+ std::advance( it, nPara );
+ aList.erase( it );
+ }
+ }
/*NBFF*/ Paragraph* GetParent( Paragraph* pParagraph, USHORT& rRelPos ) const;
diff --git a/binfilter/bf_svx/source/outliner/svx_paralist.cxx b/binfilter/bf_svx/source/outliner/svx_paralist.cxx
index 19f81cf..e2fd3ad 100644
--- a/binfilter/bf_svx/source/outliner/svx_paralist.cxx
+++ b/binfilter/bf_svx/source/outliner/svx_paralist.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -41,39 +41,32 @@ namespace binfilter {
/*N*/ : aBulSize( -1, -1)
/*N*/ {
/*N*/ DBG_CTOR( Paragraph, 0 );
-/*N*/
+/*N*/
/*N*/ DBG_ASSERT( ( nDDepth < SVX_MAX_NUM ) || ( nDDepth == 0xFFFF ), "Paragraph-CTOR: nDepth invalid!" );
-/*N*/
+/*N*/
/*N*/ nDepth = nDDepth;
/*N*/ nFlags = 0;
/*N*/ bVisible = TRUE;
/*N*/ }
-/*N*/ Paragraph::~Paragraph()
-/*N*/ {
-/*N*/ DBG_DTOR( Paragraph, 0 );
-/*N*/ }
-
-/*N*/ void ParagraphList::Clear( BOOL bDestroyParagraphs )
-/*N*/ {
-/*N*/ if ( bDestroyParagraphs )
-/*N*/ {
-/*N*/ for ( ULONG n = GetParagraphCount(); n; )
-/*N*/ {
-/*N*/ Paragraph* pPara = GetParagraph( --n );
-/*N*/ delete pPara;
-/*N*/ }
-/*N*/ }
-/*N*/ List::Clear();
-/*N*/ }
-
-
-
-
-
-
+Paragraph::~Paragraph()
+{
+ DBG_DTOR( Paragraph, 0 );
+}
+void ParagraphList::Clear( BOOL bDestroyParagraphs )
+{
+ if ( bDestroyParagraphs )
+ {
+ for ( ULONG n = GetParagraphCount(); n; )
+ {
+ Paragraph* pPara = GetParagraph( --n );
+ delete pPara;
+ }
+ }
+ aList.clear();
+}
/*NBFF*/ Paragraph* ParagraphList::GetParent( Paragraph* pParagraph, USHORT& rRelPos ) const
@@ -87,7 +80,7 @@ namespace binfilter {
/*NBFF*/ rRelPos++;
/*NBFF*/ pPrev = GetParagraph( --n );
/*NBFF*/ }
-/*NBFF*/
+/*NBFF*/
/*NBFF*/ return pPrev;
/*NBFF*/ }
More information about the Libreoffice-commits
mailing list