[Libreoffice-commits] .: binfilter/bf_svtools binfilter/inc
Joseph Powers
jpowers at kemper.freedesktop.org
Thu May 5 21:06:37 PDT 2011
binfilter/bf_svtools/source/misc/svt_ctrltool.cxx | 36 ++++++++++++----------
binfilter/inc/bf_svtools/ctrltool.hxx | 11 ++++--
2 files changed, 28 insertions(+), 19 deletions(-)
New commits:
commit 9e995d0f18f83b32143da2866186577b0caa97f7
Author: Joseph Powers <jpowers27 at cox.net>
Date: Thu May 5 21:06:04 2011 -0700
Modify class FontList so it's no longer a child of List.
diff --git a/binfilter/bf_svtools/source/misc/svt_ctrltool.cxx b/binfilter/bf_svtools/source/misc/svt_ctrltool.cxx
index 0afb2fa..edf1535 100644
--- a/binfilter/bf_svtools/source/misc/svt_ctrltool.cxx
+++ b/binfilter/bf_svtools/source/misc/svt_ctrltool.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
@@ -113,21 +113,21 @@ ImplFontListNameInfo* FontList::ImplFind( const XubString& rSearchName, ULONG* p
// und somit die Wahrscheinlichkeit das hinten angehaengt werden muss
// sehr gross ist.
StringCompare eComp;
- ULONG nCnt = Count();
+ size_t nCnt = maFontListNameInfoList.size();
if ( !nCnt )
{
if ( pIndex )
- *pIndex = LIST_APPEND;
+ *pIndex = ULONG_MAX;
return NULL;
}
else
{
- ImplFontListNameInfo* pCmpData = (ImplFontListNameInfo*)List::GetObject( nCnt-1 );
+ ImplFontListNameInfo* pCmpData = maFontListNameInfoList[ nCnt-1 ];
eComp = rSearchName.CompareTo( pCmpData->maSearchName );
if ( eComp == COMPARE_GREATER )
{
if ( pIndex )
- *pIndex = LIST_APPEND;
+ *pIndex = ULONG_MAX;
return NULL;
}
else if ( eComp == COMPARE_EQUAL )
@@ -144,7 +144,7 @@ ImplFontListNameInfo* FontList::ImplFind( const XubString& rSearchName, ULONG* p
do
{
nMid = (nLow + nHigh) / 2;
- pCompareData = (ImplFontListNameInfo*)List::GetObject( nMid );
+ pCompareData = maFontListNameInfoList[ nMid ];
eComp = rSearchName.CompareTo( pCompareData->maSearchName );
if ( eComp == COMPARE_LESS )
{
@@ -226,7 +226,16 @@ void FontList::ImplInsertFonts( OutputDevice* pDevice, BOOL bAll,
pData->mpFirst = pNewInfo;
pNewInfo->mpNext = NULL;
pData->mnType = 0;
- Insert( (void*)pData, nIndex );
+ if ( nIndex < maFontListNameInfoList.size() )
+ {
+ ImplFontListNameInfoList::iterator it = maFontListNameInfoList.begin();
+ ::std::advance( it, nIndex );
+ maFontListNameInfoList.insert( it, pData );
+ }
+ else
+ {
+ maFontListNameInfoList.push_back( pData );
+ }
}
}
else
@@ -286,8 +295,7 @@ void FontList::ImplInsertFonts( OutputDevice* pDevice, BOOL bAll,
// =======================================================================
-FontList::FontList( OutputDevice* pDevice, OutputDevice* pDevice2, BOOL bAll ) :
- List( 4096, sal::static_int_cast< USHORT >(pDevice->GetDevFontCount()), 32 )
+FontList::FontList( OutputDevice* pDevice, OutputDevice* pDevice2, BOOL bAll )
{
// Variablen initialisieren
mpDev = pDevice;
@@ -329,21 +337,19 @@ FontList::~FontList()
delete[] mpSizeAry;
// FontInfos loeschen
- ImplFontListNameInfo* pData = (ImplFontListNameInfo*)First();
- while ( pData )
+ for( size_t i = 0, n = maFontListNameInfoList.size(); i < n; ++i )
{
ImplFontListFontInfo* pTemp;
- ImplFontListFontInfo* pInfo = pData->mpFirst;
+ ImplFontListFontInfo* pInfo = maFontListNameInfoList[ i ]->mpFirst;
while ( pInfo )
{
pTemp = pInfo->mpNext;
delete pInfo;
pInfo = pTemp;
}
- ImplFontListNameInfo* pNext = (ImplFontListNameInfo*)Next();
- delete pData;
- pData = pNext;
+ delete maFontListNameInfoList[ i ];
}
+ maFontListNameInfoList.clear();
}
// -----------------------------------------------------------------------
diff --git a/binfilter/inc/bf_svtools/ctrltool.hxx b/binfilter/inc/bf_svtools/ctrltool.hxx
index 7b2ca6a..971d01d 100644
--- a/binfilter/inc/bf_svtools/ctrltool.hxx
+++ b/binfilter/inc/bf_svtools/ctrltool.hxx
@@ -32,23 +32,26 @@
#include <bf_svtools/bf_solar.h>
#include <sal/types.h>
-#include <tools/list.hxx>
#include <vcl/metric.hxx>
+#include <vector>
class OutputDevice;
namespace binfilter {
class ImplFontListNameInfo;
+typedef ::std::vector< ImplFontListNameInfo* > ImplFontListNameInfoList;
+
#define FONTLIST_FONTINFO_NOTFOUND ((USHORT)0xFFFF)
#define FONTLIST_FONTNAMETYPE_PRINTER ((USHORT)0x0001)
#define FONTLIST_FONTNAMETYPE_SCREEN ((USHORT)0x0002)
#define FONTLIST_FONTNAMETYPE_SCALABLE ((USHORT)0x0004)
-class FontList : private List
+class FontList
{
private:
+ ImplFontListNameInfoList maFontListNameInfoList;
XubString maMapBoth;
XubString maMapPrinterOnly;
XubString maMapScreenOnly;
@@ -91,8 +94,8 @@ public:
FontWeight eWeight,
FontItalic eItalic ) const;
- USHORT GetFontNameCount() const
- { return (USHORT)List::Count(); }
+ size_t GetFontNameCount() const
+ { return maFontListNameInfoList.size(); }
private:
FontList( const FontList& );
FontList& operator =( const FontList& );
More information about the Libreoffice-commits
mailing list