[Libreoffice-commits] .: 3 commits - basic/inc basic/source editeng/source sw/source
August Sodora
augsod at kemper.freedesktop.org
Sat Jan 14 12:13:23 PST 2012
basic/inc/basic/sbx.hxx | 6 +++---
basic/source/sbx/sbxbase.cxx | 29 ++++++++++++-----------------
basic/source/sbx/sbxvar.cxx | 19 +++++++++----------
editeng/source/editeng/eeng_pch.hxx | 1 -
editeng/source/editeng/impedit.hxx | 6 +-----
editeng/source/editeng/impedit2.cxx | 16 +++++-----------
editeng/source/outliner/outleeng.hxx | 3 +--
editeng/source/outliner/outliner.cxx | 18 +++++-------------
sw/source/core/edit/acorrect.cxx | 3 ---
9 files changed, 36 insertions(+), 65 deletions(-)
New commits:
commit 3447718347c6ffe4135fb3d3faeff367401e25f4
Author: August Sodora <augsod at gmail.com>
Date: Sat Jan 14 15:11:10 2012 -0500
SV_DECL_PTRARR_DEL->std::vector
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index c05b83e..39107a4 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -78,10 +78,6 @@ DBG_NAMEEX( EditEngine )
#define LINE_SEP 0x0A
-typedef EENotify* EENotifyPtr;
-SV_DECL_PTRARR_DEL( NotifyList, EENotifyPtr, 1, 1 ) // IMPL is in outliner.cxx, move to EE later and share declaration, or use BlockNotifications from EE directly
-
-
class EditView;
class EditEngine;
class SvxFontTable;
@@ -440,7 +436,7 @@ private:
ImplIMEInfos* mpIMEInfos;
- NotifyList aNotifyCache;
+ std::vector<EENotify> aNotifyCache;
XubString aWordDelimiters;
XubString aGroupChars;
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index b344b3a..a53c670 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -4383,14 +4383,9 @@ sal_Bool ImpEditEngine::DoVisualCursorTraveling( const ContentNode* )
void ImpEditEngine::CallNotify( EENotify& rNotify )
{
if ( !nBlockNotifications )
- {
GetNotifyHdl().Call( &rNotify );
- }
else
- {
- EENotify* pNewNotify = new EENotify( rNotify );
- aNotifyCache.Insert( pNewNotify, aNotifyCache.Count() );
- }
+ aNotifyCache.push_back(rNotify);
}
void ImpEditEngine::EnterBlockNotifications()
@@ -4416,13 +4411,12 @@ void ImpEditEngine::LeaveBlockNotifications()
if ( !nBlockNotifications )
{
// Call blocked notify events...
- while ( aNotifyCache.Count() )
+ while(!aNotifyCache.empty())
{
- EENotify* pNotify = aNotifyCache[0];
+ EENotify aNotify(aNotifyCache[0]);
// Remove from list before calling, maybe we enter LeaveBlockNotifications while calling the handler...
- aNotifyCache.Remove( 0 );
- GetNotifyHdl().Call( pNotify );
- delete pNotify;
+ aNotifyCache.erase(aNotifyCache.begin());
+ GetNotifyHdl().Call( &aNotify );
}
EENotify aNotify( EE_NOTIFY_BLOCKNOTIFICATION_END );
diff --git a/editeng/source/outliner/outleeng.hxx b/editeng/source/outliner/outleeng.hxx
index 59124b8..14051c3 100644
--- a/editeng/source/outliner/outleeng.hxx
+++ b/editeng/source/outliner/outleeng.hxx
@@ -31,8 +31,7 @@
#include <editeng/outliner.hxx>
#include <editeng/editeng.hxx>
-typedef EENotify* EENotifyPtr;
-SV_DECL_PTRARR_DEL( NotifyList, EENotifyPtr, 1, 1 )
+typedef std::vector<EENotify> NotifyList;
class OutlinerEditEng : public EditEngine
{
diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx
index 37a569e..f62cec6 100644
--- a/editeng/source/outliner/outliner.cxx
+++ b/editeng/source/outliner/outliner.cxx
@@ -2039,8 +2039,6 @@ void Outliner::SetLevelDependendStyleSheet( sal_uInt16 nPara )
pEditEngine->SetParaAttribs( nPara, aOldAttrs );
}
-SV_IMPL_PTRARR( NotifyList, EENotifyPtr );
-
void Outliner::ImplBlockInsertionCallbacks( sal_Bool b )
{
if ( b )
@@ -2054,13 +2052,12 @@ void Outliner::ImplBlockInsertionCallbacks( sal_Bool b )
if ( !bBlockInsCallback )
{
// Call blocked notify events...
- while ( pEditEngine->aNotifyCache.Count() )
+ while(!pEditEngine->aNotifyCache.empty())
{
- EENotify* pNotify = pEditEngine->aNotifyCache[0];
+ EENotify aNotify(pEditEngine->aNotifyCache.front());
// Remove from list before calling, maybe we enter LeaveBlockNotifications while calling the handler...
- pEditEngine->aNotifyCache.Remove( 0 );
- pEditEngine->aOutlinerNotifyHdl.Call( pNotify );
- delete pNotify;
+ pEditEngine->aNotifyCache.erase(pEditEngine->aNotifyCache.begin());
+ pEditEngine->aOutlinerNotifyHdl.Call( &aNotify );
}
}
}
@@ -2069,14 +2066,9 @@ void Outliner::ImplBlockInsertionCallbacks( sal_Bool b )
IMPL_LINK( Outliner, EditEngineNotifyHdl, EENotify*, pNotify )
{
if ( !bBlockInsCallback )
- {
pEditEngine->aOutlinerNotifyHdl.Call( pNotify );
- }
else
- {
- EENotify* pNewNotify = new EENotify( *pNotify );
- pEditEngine->aNotifyCache.Insert( pNewNotify, pEditEngine->aNotifyCache.Count() );
- }
+ pEditEngine->aNotifyCache.push_back(*pNotify);
return 0;
}
commit 440a7c9b92822206db52861dc79d053450004a9f
Author: August Sodora <augsod at gmail.com>
Date: Sat Jan 14 01:48:28 2012 -0500
SV_DECL_PTRARR_DEL->boost::ptr_vector
diff --git a/basic/inc/basic/sbx.hxx b/basic/inc/basic/sbx.hxx
index 7a74e25..ad24fae 100644
--- a/basic/inc/basic/sbx.hxx
+++ b/basic/inc/basic/sbx.hxx
@@ -41,6 +41,8 @@
#include <basic/sbxmeth.hxx>
#include "basicdllapi.h"
+#include <boost/ptr_container/ptr_vector.hpp>
+
class String;
class UniString;
class SvStream;
@@ -56,8 +58,6 @@ class SbxFactory;
class SfxBroadcaster;
class SvDispatch;
-
-
#ifndef __SBX_SBXPARAMINFO
#define __SBX_SBXPARAMINFO
@@ -74,7 +74,7 @@ struct SbxParamInfo
~SbxParamInfo() {}
};
-SV_DECL_PTRARR_DEL(SbxParams,SbxParamInfo*,4,4)
+typedef boost::ptr_vector<SbxParamInfo> SbxParams;
#endif
diff --git a/basic/source/sbx/sbxbase.cxx b/basic/source/sbx/sbxbase.cxx
index 9e1baf3..84dc307 100644
--- a/basic/source/sbx/sbxbase.cxx
+++ b/basic/source/sbx/sbxbase.cxx
@@ -26,8 +26,6 @@
*
************************************************************************/
-
-
#include <tools/shl.hxx>
#include <tools/stream.hxx>
@@ -41,7 +39,6 @@
// AppData-Structure for SBX:
-SV_IMPL_PTRARR(SbxParams,SbxParamInfo*);
SV_IMPL_PTRARR(SbxFacs,SbxFactory*);
TYPEINIT0(SbxBase)
@@ -367,21 +364,20 @@ SbxInfo::~SbxInfo()
void SbxInfo::AddParam
( const XubString& rName, SbxDataType eType, sal_uInt16 nFlags )
{
- const SbxParamInfo* p = new SbxParamInfo( rName, eType, nFlags );
- aParams.Insert( p, aParams.Count() );
+ aParams.push_back(new SbxParamInfo(rName, eType, nFlags));
}
const SbxParamInfo* SbxInfo::GetParam( sal_uInt16 n ) const
{
- if( n < 1 || n > aParams.Count() )
+ if( n < 1 || n > aParams.size() )
return NULL;
else
- return aParams.GetObject( n-1 );
+ return &(aParams[n - 1]);
}
sal_Bool SbxInfo::LoadData( SvStream& rStrm, sal_uInt16 nVer )
{
- aParams.Remove( 0, aParams.Count() );
+ aParams.clear();
sal_uInt16 nParam;
aComment = read_lenPrefixed_uInt8s_ToOUString<sal_uInt16>(rStrm,
RTL_TEXTENCODING_ASCII_US);
@@ -399,8 +395,8 @@ sal_Bool SbxInfo::LoadData( SvStream& rStrm, sal_uInt16 nVer )
if( nVer > 1 )
rStrm >> nUserData;
AddParam( aName, (SbxDataType) nType, nFlags );
- SbxParamInfo* p = aParams.GetObject( aParams.Count() - 1 );
- p->nUserData = nUserData;
+ SbxParamInfo& p(aParams.back());
+ p.nUserData = nUserData;
}
return sal_True;
}
@@ -411,15 +407,14 @@ sal_Bool SbxInfo::StoreData( SvStream& rStrm ) const
RTL_TEXTENCODING_ASCII_US );
write_lenPrefixed_uInt8s_FromOUString<sal_uInt16>(rStrm, aHelpFile,
RTL_TEXTENCODING_ASCII_US);
- rStrm << nHelpId << aParams.Count();
- for( sal_uInt16 i = 0; i < aParams.Count(); i++ )
+ rStrm << nHelpId << static_cast<sal_uInt16>(aParams.size());
+ for(SbxParams::const_iterator i = aParams.begin(); i != aParams.end(); ++i)
{
- SbxParamInfo* p = aParams.GetObject( i );
- write_lenPrefixed_uInt8s_FromOUString<sal_uInt16>(rStrm, p->aName,
+ write_lenPrefixed_uInt8s_FromOUString<sal_uInt16>(rStrm, i->aName,
RTL_TEXTENCODING_ASCII_US);
- rStrm << (sal_uInt16) p->eType
- << (sal_uInt16) p->nFlags
- << (sal_uInt32) p->nUserData;
+ rStrm << (sal_uInt16) i->eType
+ << (sal_uInt16) i->nFlags
+ << (sal_uInt32) i->nUserData;
}
return sal_True;
}
diff --git a/basic/source/sbx/sbxvar.cxx b/basic/source/sbx/sbxvar.cxx
index 386c8d3..e4ad651 100644
--- a/basic/source/sbx/sbxvar.cxx
+++ b/basic/source/sbx/sbxvar.cxx
@@ -236,7 +236,7 @@ const XubString& SbxVariable::GetName( SbxNameType t ) const
((SbxVariable*)this)->GetInfo();
// Append nothing, if it is a simple property (no empty brackets)
if( !pInfo
- || ( !pInfo->aParams.Count() && GetClass() == SbxCLASS_PROPERTY ) )
+ || ( pInfo->aParams.empty() && GetClass() == SbxCLASS_PROPERTY ) )
return maName;
xub_Unicode cType = ' ';
XubString aTmp( maName );
@@ -250,17 +250,16 @@ const XubString& SbxVariable::GetName( SbxNameType t ) const
aTmp += cType;
}
aTmp += '(';
- for( sal_uInt16 i = 0; i < pInfo->aParams.Count(); i++ )
+ for(SbxParams::const_iterator i = pInfo->aParams.begin(); i != pInfo->aParams.end(); ++i)
{
- const SbxParamInfo* q = pInfo->aParams.GetObject( i );
- int nt = q->eType & 0x0FFF;
- if( i )
+ int nt = i->eType & 0x0FFF;
+ if( i != pInfo->aParams.begin() )
aTmp += ',';
- if( q->nFlags & SBX_OPTIONAL )
+ if( i->nFlags & SBX_OPTIONAL )
aTmp += String( SbxRes( STRING_OPTIONAL ) );
- if( q->eType & SbxBYREF )
+ if( i->eType & SbxBYREF )
aTmp += String( SbxRes( STRING_BYREF ) );
- aTmp += q->aName;
+ aTmp += i->aName;
cType = ' ';
// short type? Then fetch it, posible this is 0.
if( t == SbxNAME_SHORT_TYPES )
@@ -271,12 +270,12 @@ const XubString& SbxVariable::GetName( SbxNameType t ) const
if( cType != ' ' )
{
aTmp += cType;
- if( q->eType & SbxARRAY )
+ if( i->eType & SbxARRAY )
aTmp.AppendAscii( "()" );
}
else
{
- if( q->eType & SbxARRAY )
+ if( i->eType & SbxARRAY )
aTmp.AppendAscii( "()" );
// long type?
if( t != SbxNAME_SHORT )
commit 1c0912ab00d5b324c07fc973655a73d1cea9c199
Author: August Sodora <augsod at gmail.com>
Date: Sat Jan 14 00:59:08 2012 -0500
Remove useless macro
diff --git a/editeng/source/editeng/eeng_pch.hxx b/editeng/source/editeng/eeng_pch.hxx
index 7f80ed5..8585428 100644
--- a/editeng/source/editeng/eeng_pch.hxx
+++ b/editeng/source/editeng/eeng_pch.hxx
@@ -25,7 +25,6 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-#define _STD_VAR_ARRAYS
#include <vcl/wrkwin.hxx>
#include <vcl/dialog.hxx>
diff --git a/sw/source/core/edit/acorrect.cxx b/sw/source/core/edit/acorrect.cxx
index d864ddb..62547c5 100644
--- a/sw/source/core/edit/acorrect.cxx
+++ b/sw/source/core/edit/acorrect.cxx
@@ -26,9 +26,6 @@
*
************************************************************************/
-
-
-#define _STD_VAR_ARRAYS
#include <hintids.hxx>
#include <svx/svxids.hrc>
More information about the Libreoffice-commits
mailing list