diff options
Diffstat (limited to 'sw/source/ui/dialog/ascfldlg.cxx')
-rw-r--r-- | sw/source/ui/dialog/ascfldlg.cxx | 70 |
1 files changed, 41 insertions, 29 deletions
diff --git a/sw/source/ui/dialog/ascfldlg.cxx b/sw/source/ui/dialog/ascfldlg.cxx index 3f7b493f70..11fa3926ed 100644 --- a/sw/source/ui/dialog/ascfldlg.cxx +++ b/sw/source/ui/dialog/ascfldlg.cxx @@ -54,13 +54,15 @@ #include <dialog.hrc> #include <ascfldlg.hrc> +#include "vcl/metric.hxx" + using namespace ::com::sun::star; const sal_Unicode cDialogExtraDataClose = '}'; const char sDialogImpExtraData[] = "EncImpDlg:{"; const char sDialogExpExtraData[] = "EncExpDlg:{"; -const USHORT nDialogExtraDataLen = 11; // 12345678901 +const sal_uInt16 nDialogExtraDataLen = 11; // 12345678901 SwAsciiFilterDlg::SwAsciiFilterDlg( Window* pParent, SwDocShell& rDocSh, SvStream* pStream ) @@ -80,7 +82,7 @@ SwAsciiFilterDlg::SwAsciiFilterDlg( Window* pParent, SwDocShell& rDocSh, aCancelPB( this, SW_RES( PB_CANCEL )), aHelpPB( this, SW_RES( PB_HELP )), sSystemCharSet( SW_RES( STR_SYS_CHARSET )), - bSaveLineStatus( TRUE ) + bSaveLineStatus( sal_True ) { FreeResource(); @@ -89,7 +91,7 @@ SwAsciiFilterDlg::SwAsciiFilterDlg( Window* pParent, SwDocShell& rDocSh, const String& rFindNm = String::CreateFromAscii( pStream ? sDialogImpExtraData : sDialogExpExtraData); - USHORT nEnd, nStt = GetExtraData().Search( rFindNm ); + sal_uInt16 nEnd, nStt = GetExtraData().Search( rFindNm ); if( STRING_NOTFOUND != nStt ) { nStt += nDialogExtraDataLen; @@ -107,8 +109,8 @@ SwAsciiFilterDlg::SwAsciiFilterDlg( Window* pParent, SwDocShell& rDocSh, if( pStream ) { char aBuffer[ 4098 ]; - ULONG nOldPos = pStream->Tell(); - ULONG nBytesRead = pStream->Read( aBuffer, 4096 ); + sal_uLong nOldPos = pStream->Tell(); + sal_uLong nBytesRead = pStream->Read( aBuffer, 4096 ); pStream->Seek( nOldPos ); if( nBytesRead <= 4096 ) @@ -119,13 +121,13 @@ SwAsciiFilterDlg::SwAsciiFilterDlg( Window* pParent, SwDocShell& rDocSh, aBuffer[ nBytesRead + 2 ] = '0'; } - BOOL bCR = FALSE, bLF = FALSE, bNullChar = FALSE; - for( USHORT nCnt = 0; nCnt < nBytesRead; ++nCnt ) + sal_Bool bCR = sal_False, bLF = sal_False, bNullChar = sal_False; + for( sal_uInt16 nCnt = 0; nCnt < nBytesRead; ++nCnt ) switch( aBuffer[ nCnt ] ) { - case 0x0: bNullChar = TRUE; break; - case 0xA: bLF = TRUE; break; - case 0xD: bCR = TRUE; break; + case 0x0: bNullChar = sal_True; break; + case 0xA: bLF = sal_True; break; + case 0xD: bCR = sal_True; break; case 0xC: case 0x1A: case 0x9: break; @@ -153,9 +155,9 @@ SwAsciiFilterDlg::SwAsciiFilterDlg( Window* pParent, SwDocShell& rDocSh, SwDoc* pDoc = rDocSh.GetDoc(); - USHORT nAppScriptType = GetI18NScriptTypeOfLanguage( (USHORT)GetAppLanguage() ); + sal_uInt16 nAppScriptType = GetI18NScriptTypeOfLanguage( (sal_uInt16)GetAppLanguage() ); { - BOOL bDelPrinter = FALSE; + sal_Bool bDelPrinter = sal_False; SfxPrinter* pPrt = pDoc ? pDoc->getPrinter(false) : 0; if( !pPrt ) { @@ -164,21 +166,31 @@ SwAsciiFilterDlg::SwAsciiFilterDlg( Window* pParent, SwDocShell& rDocSh, SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC, 0 ); pPrt = new SfxPrinter( pSet ); - bDelPrinter = TRUE; + bDelPrinter = sal_True; } - - const USHORT nCount = pPrt->GetFontCount(); - for (USHORT i = 0; i < nCount; ++i) + + + // get the set of disctinct available family names + std::set< String > aFontNames; + int nFontNames = pPrt->GetDevFontCount(); + for( int i = 0; i < nFontNames; i++ ) + { + FontInfo aInf( pPrt->GetDevFont( i ) ); + aFontNames.insert( aInf.GetName() ); + } + + // insert to listbox + for( std::set< String >::const_iterator it = aFontNames.begin(); + it != aFontNames.end(); ++it ) { - const String &rStr = pPrt->GetFont(i)->GetName(); - aFontLB.InsertEntry( rStr ); + aFontLB.InsertEntry( *it ); } if( !aOpt.GetFontName().Len() ) { if(pDoc) { - USHORT nFontRes = RES_CHRATR_FONT; + sal_uInt16 nFontRes = RES_CHRATR_FONT; if(SCRIPTTYPE_ASIAN == nAppScriptType) nFontRes = RES_CHRATR_CJK_FONT; else if(SCRIPTTYPE_COMPLEX == nAppScriptType) @@ -189,7 +201,7 @@ SwAsciiFilterDlg::SwAsciiFilterDlg( Window* pParent, SwDocShell& rDocSh, } else { - USHORT nFontType = FONT_STANDARD; + sal_uInt16 nFontType = FONT_STANDARD; if(SCRIPTTYPE_ASIAN == nAppScriptType) nFontType = FONT_STANDARD_CJK; else if(SCRIPTTYPE_COMPLEX == nAppScriptType) @@ -209,7 +221,7 @@ SwAsciiFilterDlg::SwAsciiFilterDlg( Window* pParent, SwDocShell& rDocSh, { if(pDoc) { - USHORT nWhich = GetWhichOfScript( RES_CHRATR_LANGUAGE, nAppScriptType); + sal_uInt16 nWhich = GetWhichOfScript( RES_CHRATR_LANGUAGE, nAppScriptType); aOpt.SetLanguage( ((SvxLanguageItem&)pDoc-> GetDefault( nWhich )).GetLanguage()); } @@ -232,7 +244,7 @@ SwAsciiFilterDlg::SwAsciiFilterDlg( Window* pParent, SwDocShell& rDocSh, } } - aLanguageLB.SetLanguageList( LANG_LIST_ALL, TRUE, FALSE ); + aLanguageLB.SetLanguageList( LANG_LIST_ALL, sal_True, sal_False ); aLanguageLB.SelectLanguage( aOpt.GetLanguage() ); } } @@ -290,18 +302,18 @@ SwAsciiFilterDlg::~SwAsciiFilterDlg() void SwAsciiFilterDlg::FillOptions( SwAsciiOptions& rOptions ) { - ULONG nCCode = aCharSetLB.GetSelectTextEncoding(); + sal_uLong nCCode = aCharSetLB.GetSelectTextEncoding(); String sFont; - ULONG nLng = 0; + sal_uLong nLng = 0; if( aFontLB.IsVisible() ) { sFont = aFontLB.GetSelectEntry(); - nLng = (ULONG)aLanguageLB.GetSelectLanguage(); + nLng = (sal_uLong)aLanguageLB.GetSelectLanguage(); } rOptions.SetFontName( sFont ); rOptions.SetCharSet( rtl_TextEncoding( nCCode ) ); - rOptions.SetLanguage( USHORT( nLng ) ); + rOptions.SetLanguage( sal_uInt16( nLng ) ); rOptions.SetParaFlags( GetCRLF() ); // save the user settings @@ -312,7 +324,7 @@ void SwAsciiFilterDlg::FillOptions( SwAsciiOptions& rOptions ) const String& rFindNm = String::CreateFromAscii( aFontLB.IsVisible() ? sDialogImpExtraData : sDialogExpExtraData); - USHORT nEnd, nStt = GetExtraData().Search( rFindNm ); + sal_uInt16 nEnd, nStt = GetExtraData().Search( rFindNm ); if( STRING_NOTFOUND != nStt ) { // called twice, so remove "old" settings @@ -406,7 +418,7 @@ IMPL_LINK( SwAsciiFilterDlg, CharSetSelHdl, SvxTextEncodingBox*, pBox ) } } - bSaveLineStatus = FALSE; + bSaveLineStatus = sal_False; if( eEnd != (LineEnd)-1 ) // changed? { if( eOldEnd != eEnd ) @@ -419,7 +431,7 @@ IMPL_LINK( SwAsciiFilterDlg, CharSetSelHdl, SvxTextEncodingBox*, pBox ) aCR_RB.Check( aCR_RB.GetSavedValue() ); aLF_RB.Check( aLF_RB.GetSavedValue() ); } - bSaveLineStatus = TRUE; + bSaveLineStatus = sal_True; if( nOldLng != nLng && aFontLB.IsVisible() ) aLanguageLB.SelectLanguage( nLng ); |