Kaydet (Commit) ef096038 authored tarafından Noel Grandin's avatar Noel Grandin

convert include/svtools/htmltokn.h from String to OUString

Change-Id: Idf7401e67fda69655860e7eb3d5c740d77d9e086
üst ba39b8e7
...@@ -24,19 +24,21 @@ ...@@ -24,19 +24,21 @@
#include <sal/types.h> #include <sal/types.h>
#include <tools/solar.h> #include <tools/solar.h>
class String; namespace rtl {
class OUString;
};
// suche das Char zu dem CharNamen // suche das Char zu dem CharNamen
sal_Unicode GetHTMLCharName( const String& rName ); sal_Unicode GetHTMLCharName( const rtl::OUString& rName );
// suche die TokenID zu dem Token // suche die TokenID zu dem Token
SVT_DLLPUBLIC int GetHTMLToken( const String& rName ); SVT_DLLPUBLIC int GetHTMLToken( const rtl::OUString& rName );
// suche die TokenId zu einemm Attribut-Token // suche die TokenId zu einemm Attribut-Token
int GetHTMLOption( const String& rName ); int GetHTMLOption( const rtl::OUString& rName );
// suche die 24-bit-Farbe zu einem Farbnamen (nicht gefunden = ULONG_MAX) // suche die 24-bit-Farbe zu einem Farbnamen (nicht gefunden = ULONG_MAX)
SVT_DLLPUBLIC sal_uInt32 GetHTMLColor( const String& rName ); SVT_DLLPUBLIC sal_uInt32 GetHTMLColor( const rtl::OUString& rName );
// beginnen immer ab 256, groesser als ein char // beginnen immer ab 256, groesser als ein char
const int HTML_TOKEN_START = 0x100; const int HTML_TOKEN_START = 0x100;
......
...@@ -33,7 +33,7 @@ struct HTML_TokenEntry ...@@ -33,7 +33,7 @@ struct HTML_TokenEntry
union union
{ {
const sal_Char *sToken; const sal_Char *sToken;
const String *pUToken; const OUString *pUToken;
}; };
int nToken; int nToken;
}; };
...@@ -194,24 +194,22 @@ extern "C" ...@@ -194,24 +194,22 @@ extern "C"
static int SAL_CALL HTMLKeyCompare( const void *pFirst, const void *pSecond) static int SAL_CALL HTMLKeyCompare( const void *pFirst, const void *pSecond)
{ {
HTML_TokenEntry* pFirstEntry = (HTML_TokenEntry*)pFirst;
HTML_TokenEntry* pSecondEntry = (HTML_TokenEntry*)pSecond;
int nRet = 0; int nRet = 0;
if( -1 == ((HTML_TokenEntry*)pFirst)->nToken ) if( -1 == pFirstEntry->nToken )
{ {
if( -1 == ((HTML_TokenEntry*)pSecond)->nToken ) if( -1 == pSecondEntry->nToken )
nRet = ((HTML_TokenEntry*)pFirst)->pUToken->CompareTo( nRet = pFirstEntry->pUToken->compareTo( *pSecondEntry->pUToken );
*((HTML_TokenEntry*)pSecond)->pUToken );
else else
nRet = ((HTML_TokenEntry*)pFirst)->pUToken->CompareToAscii( nRet = pFirstEntry->pUToken->compareToAscii( pSecondEntry->sToken );
((HTML_TokenEntry*)pSecond)->sToken );
} }
else else
{ {
if( -1 == ((HTML_TokenEntry*)pSecond)->nToken ) if( -1 == pSecondEntry->nToken )
nRet = -1 * ((HTML_TokenEntry*)pSecond)->pUToken->CompareToAscii( nRet = -1 * pSecondEntry->pUToken->compareToAscii( pFirstEntry->sToken );
((HTML_TokenEntry*)pFirst)->sToken );
else else
nRet = strcmp( ((HTML_TokenEntry*)pFirst)->sToken, nRet = strcmp( pFirstEntry->sToken, pSecondEntry->sToken );
((HTML_TokenEntry*)pSecond)->sToken );
} }
return nRet; return nRet;
...@@ -219,7 +217,7 @@ static int SAL_CALL HTMLKeyCompare( const void *pFirst, const void *pSecond) ...@@ -219,7 +217,7 @@ static int SAL_CALL HTMLKeyCompare( const void *pFirst, const void *pSecond)
} }
int GetHTMLToken( const String& rName ) int GetHTMLToken( const OUString& rName )
{ {
if( !bSortKeyWords ) if( !bSortKeyWords )
{ {
...@@ -232,7 +230,7 @@ int GetHTMLToken( const String& rName ) ...@@ -232,7 +230,7 @@ int GetHTMLToken( const String& rName )
int nRet = 0; int nRet = 0;
if( !rName.CompareToAscii( OOO_STRING_SVTOOLS_HTML_comment, 3UL) ) if( !rName.compareTo( OOO_STRING_SVTOOLS_HTML_comment, 3 ) )
return HTML_COMMENT; return HTML_COMMENT;
void* pFound; void* pFound;
...@@ -240,11 +238,12 @@ int GetHTMLToken( const String& rName ) ...@@ -240,11 +238,12 @@ int GetHTMLToken( const String& rName )
aSrch.pUToken = &rName; aSrch.pUToken = &rName;
aSrch.nToken = -1; aSrch.nToken = -1;
if( 0 != ( pFound = bsearch( (sal_Char *) &aSrch, pFound = bsearch( (sal_Char *) &aSrch,
(void*) aHTMLTokenTab, (void*) aHTMLTokenTab,
sizeof( aHTMLTokenTab ) / sizeof( HTML_TokenEntry ), sizeof( aHTMLTokenTab ) / sizeof( HTML_TokenEntry ),
sizeof( HTML_TokenEntry ), sizeof( HTML_TokenEntry ),
HTMLKeyCompare ))) HTMLKeyCompare );
if( 0 != pFound )
nRet = ((HTML_TokenEntry*)pFound)->nToken; nRet = ((HTML_TokenEntry*)pFound)->nToken;
return nRet; return nRet;
} }
...@@ -254,7 +253,7 @@ struct HTML_CharEntry ...@@ -254,7 +253,7 @@ struct HTML_CharEntry
union union
{ {
const sal_Char *sName; const sal_Char *sName;
const String *pUName; const OUString *pUName;
}; };
sal_Unicode cChar; sal_Unicode cChar;
}; };
...@@ -540,32 +539,30 @@ extern "C" ...@@ -540,32 +539,30 @@ extern "C"
static int SAL_CALL HTMLCharNameCompare( const void *pFirst, const void *pSecond) static int SAL_CALL HTMLCharNameCompare( const void *pFirst, const void *pSecond)
{ {
HTML_CharEntry* pFirstEntry = (HTML_CharEntry*)pFirst;
HTML_CharEntry* pSecondEntry = (HTML_CharEntry*)pSecond;
int nRet = 0; int nRet = 0;
if( USHRT_MAX == ((HTML_CharEntry*)pFirst)->cChar ) if( USHRT_MAX == pFirstEntry->cChar )
{ {
if( USHRT_MAX == ((HTML_CharEntry*)pSecond)->cChar ) if( USHRT_MAX == pSecondEntry->cChar )
nRet = ((HTML_CharEntry*)pFirst)->pUName->CompareTo( nRet = pFirstEntry->pUName->compareTo( *pSecondEntry->pUName );
*((HTML_CharEntry*)pSecond)->pUName );
else else
nRet = ((HTML_CharEntry*)pFirst)->pUName->CompareToAscii( nRet = pFirstEntry->pUName->compareToAscii( pSecondEntry->sName );
((HTML_CharEntry*)pSecond)->sName );
} }
else else
{ {
if( USHRT_MAX == ((HTML_CharEntry*)pSecond)->cChar ) if( USHRT_MAX == pSecondEntry->cChar )
nRet = -1 * ((HTML_CharEntry*)pSecond)->pUName->CompareToAscii( nRet = -1 * pSecondEntry->pUName->compareToAscii( pFirstEntry->sName );
((HTML_CharEntry*)pFirst)->sName );
else else
nRet = strcmp( ((HTML_CharEntry*)pFirst)->sName, nRet = strcmp( pFirstEntry->sName, pSecondEntry->sName );
((HTML_CharEntry*)pSecond)->sName );
} }
return nRet; return nRet;
} }
} } // extern "C"
sal_Unicode GetHTMLCharName( const String& rName ) sal_Unicode GetHTMLCharName( const OUString& rName )
{ {
if( !bSortCharKeyWords ) if( !bSortCharKeyWords )
{ {
...@@ -796,7 +793,7 @@ static HTML_TokenEntry aHTMLOptionTab[] = { ...@@ -796,7 +793,7 @@ static HTML_TokenEntry aHTMLOptionTab[] = {
{{OOO_STRING_SVTOOLS_HTML_O_units}, HTML_O_UNITS} {{OOO_STRING_SVTOOLS_HTML_O_units}, HTML_O_UNITS}
}; };
int GetHTMLOption( const String& rName ) int GetHTMLOption( const OUString& rName )
{ {
if( !bSortOptionKeyWords ) if( !bSortOptionKeyWords )
{ {
...@@ -828,7 +825,7 @@ struct HTML_ColorEntry ...@@ -828,7 +825,7 @@ struct HTML_ColorEntry
union union
{ {
const sal_Char* sName; const sal_Char* sName;
const String *pUName; const OUString *pUName;
}; };
sal_uInt32 nColor; sal_uInt32 nColor;
}; };
...@@ -989,32 +986,30 @@ extern "C" ...@@ -989,32 +986,30 @@ extern "C"
static int SAL_CALL HTMLColorNameCompare( const void *pFirst, const void *pSecond) static int SAL_CALL HTMLColorNameCompare( const void *pFirst, const void *pSecond)
{ {
HTML_ColorEntry* pFirstEntry = (HTML_ColorEntry*)pFirst;
HTML_ColorEntry* pSecondEntry = (HTML_ColorEntry*)pSecond;
int nRet = 0; int nRet = 0;
if( HTML_NO_COLOR == ((HTML_ColorEntry*)pFirst)->nColor ) if( HTML_NO_COLOR == pFirstEntry->nColor )
{ {
if( HTML_NO_COLOR == ((HTML_ColorEntry*)pSecond)->nColor ) if( HTML_NO_COLOR == pSecondEntry->nColor )
nRet = ((HTML_ColorEntry*)pFirst)->pUName->CompareTo( nRet = pFirstEntry->pUName->compareTo( *pSecondEntry->pUName );
*((HTML_ColorEntry*)pSecond)->pUName );
else else
nRet = ((HTML_ColorEntry*)pFirst)->pUName->CompareToAscii( nRet = pFirstEntry->pUName->compareToAscii( pSecondEntry->sName );
((HTML_ColorEntry*)pSecond)->sName );
} }
else else
{ {
if( HTML_NO_COLOR == ((HTML_ColorEntry*)pSecond)->nColor ) if( HTML_NO_COLOR == pSecondEntry->nColor )
nRet = -1 * ((HTML_ColorEntry*)pSecond)->pUName->CompareToAscii( nRet = -1 * pSecondEntry->pUName->compareToAscii( pFirstEntry->sName );
((HTML_ColorEntry*)pFirst)->sName );
else else
nRet = strcmp( ((HTML_ColorEntry*)pFirst)->sName, nRet = strcmp( pFirstEntry->sName, pSecondEntry->sName );
((HTML_ColorEntry*)pSecond)->sName );
} }
return nRet; return nRet;
} }
} } // extern "C"
sal_uInt32 GetHTMLColor( const String& rName ) sal_uInt32 GetHTMLColor( const OUString& rName )
{ {
if( !bSortColorKeyWords ) if( !bSortColorKeyWords )
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment