Kaydet (Commit) a4e2e50c authored tarafından Jan Holesovsky's avatar Jan Holesovsky

Remove the unneeded "scalable font" icon from the font combobox.

Change-Id: Ifadad736ae39dff67ad7bc499f85bfbb484826ff
üst a12db69b
...@@ -42,11 +42,10 @@ ...@@ -42,11 +42,10 @@
class FontList; class FontList;
class ImplColorListData; class ImplColorListData;
class ImpLineListData; class ImpLineListData;
class ImplFontNameListData;
typedef ::std::vector< ImplColorListData* > ImpColorList; typedef ::std::vector< ImplColorListData* > ImpColorList;
typedef ::std::vector< ImpLineListData* > ImpLineList; typedef ::std::vector< ImpLineListData* > ImpLineList;
typedef ::std::vector< ImplFontNameListData* > ImplFontList; typedef ::std::vector< FontInfo > ImplFontList;
// FIXME: STYLE_* duplicate values from editeng::SvxBorderStyle, // FIXME: STYLE_* duplicate values from editeng::SvxBorderStyle,
// which in turn duplicates values from com::sun::star::table::BorderLineStyle: // which in turn duplicates values from com::sun::star::table::BorderLineStyle:
...@@ -111,9 +110,7 @@ Erlaubt die Auswahl von Fonts. Die ListBox wird mit Fill gefuellt, wo ...@@ -111,9 +110,7 @@ Erlaubt die Auswahl von Fonts. Die ListBox wird mit Fill gefuellt, wo
ein Pointer auf eine FontList uebergeben werden muss. ein Pointer auf eine FontList uebergeben werden muss.
Mit EnableWYSIWYG() kann man einstellen, das die Fontnamen in Ihrer Schrift Mit EnableWYSIWYG() kann man einstellen, das die Fontnamen in Ihrer Schrift
angezeigt werden und mit EnableSymbols() kann eingestellt werden, das angezeigt werden.
vor dem Namen ueber ein Symbol angezeigt wird, ob es sich um eine
Drucker oder Bildschirmschrift handelt.
Querverweise Querverweise
...@@ -433,21 +430,15 @@ class SVT_DLLPUBLIC FontNameBox : public ComboBox ...@@ -433,21 +430,15 @@ class SVT_DLLPUBLIC FontNameBox : public ComboBox
{ {
private: private:
ImplFontList* mpFontList; ImplFontList* mpFontList;
Image maImagePrinterFont;
Image maImageBitmapFont;
Image maImageScalableFont;
sal_Bool mbWYSIWYG; sal_Bool mbWYSIWYG;
sal_Bool mbSymbols; String maFontMRUEntriesFile;
String maFontMRUEntriesFile;
#ifdef _CTRLBOX_CXX #ifdef _CTRLBOX_CXX
SVT_DLLPRIVATE void ImplCalcUserItemSize(); SVT_DLLPRIVATE void ImplCalcUserItemSize();
SVT_DLLPRIVATE void ImplDestroyFontList(); SVT_DLLPRIVATE void ImplDestroyFontList();
#endif #endif
void InitBitmaps( void );
protected: protected:
virtual void DataChanged( const DataChangedEvent& rDCEvt );
void LoadMRUEntries( const String& aFontMRUEntriesFile, xub_Unicode cSep = ';' ); void LoadMRUEntries( const String& aFontMRUEntriesFile, xub_Unicode cSep = ';' );
void SaveMRUEntries( const String& aFontMRUEntriesFile, xub_Unicode cSep = ';' ) const; void SaveMRUEntries( const String& aFontMRUEntriesFile, xub_Unicode cSep = ';' ) const;
public: public:
...@@ -463,9 +454,6 @@ public: ...@@ -463,9 +454,6 @@ public:
void EnableWYSIWYG( sal_Bool bEnable = sal_True ); void EnableWYSIWYG( sal_Bool bEnable = sal_True );
sal_Bool IsWYSIWYGEnabled() const { return mbWYSIWYG; } sal_Bool IsWYSIWYGEnabled() const { return mbWYSIWYG; }
void EnableSymbols( sal_Bool bEnable = sal_True );
sal_Bool IsSymbolsEnabled() const { return mbSymbols; }
private: private:
void InitFontMRUEntriesFile(); void InitFontMRUEntriesFile();
......
...@@ -140,10 +140,6 @@ von der FontList, sollte deshalb das Array nicht mehr referenziert werden. ...@@ -140,10 +140,6 @@ von der FontList, sollte deshalb das Array nicht mehr referenziert werden.
#define FONTLIST_FONTINFO_NOTFOUND ((sal_uInt16)0xFFFF) #define FONTLIST_FONTINFO_NOTFOUND ((sal_uInt16)0xFFFF)
#define FONTLIST_FONTNAMETYPE_PRINTER ((sal_uInt16)0x0001)
#define FONTLIST_FONTNAMETYPE_SCREEN ((sal_uInt16)0x0002)
#define FONTLIST_FONTNAMETYPE_SCALABLE ((sal_uInt16)0x0004)
class SVT_DLLPUBLIC FontList class SVT_DLLPUBLIC FontList
{ {
private: private:
...@@ -202,7 +198,6 @@ public: ...@@ -202,7 +198,6 @@ public:
return (sal_uInt16)maEntries.size(); return (sal_uInt16)maEntries.size();
} }
const FontInfo& GetFontName( sal_uInt16 nFont ) const; const FontInfo& GetFontName( sal_uInt16 nFont ) const;
sal_uInt16 GetFontNameType( sal_uInt16 nFont ) const;
sal_Handle GetFirstFontInfo( const OUString& rName ) const; sal_Handle GetFirstFontInfo( const OUString& rName ) const;
sal_Handle GetNextFontInfo( sal_Handle hFontInfo ) const; sal_Handle GetNextFontInfo( sal_Handle hFontInfo ) const;
const FontInfo& GetFontInfo( sal_Handle hFontInfo ) const; const FontInfo& GetFontInfo( sal_Handle hFontInfo ) const;
......
...@@ -262,10 +262,6 @@ ...@@ -262,10 +262,6 @@
#define RID_IMG_TREENODE_COLLAPSED (RID_SVTOOLS_START + 0) #define RID_IMG_TREENODE_COLLAPSED (RID_SVTOOLS_START + 0)
#define RID_IMG_TREENODE_EXPANDED (RID_SVTOOLS_START + 1) #define RID_IMG_TREENODE_EXPANDED (RID_SVTOOLS_START + 1)
#define RID_IMG_PRINTERFONT (RID_SVTOOLS_START + 12)
#define RID_IMG_BITMAPFONT (RID_SVTOOLS_START + 13)
#define RID_IMG_SCALABLEFONT (RID_SVTOOLS_START + 14)
#define IMG_TRIANGLE_RIGHT (RID_SVTOOLS_START + 18) #define IMG_TRIANGLE_RIGHT (RID_SVTOOLS_START + 18)
#define IMG_TRIANGLE_DOWN (RID_SVTOOLS_START + 20) #define IMG_TRIANGLE_DOWN (RID_SVTOOLS_START + 20)
......
...@@ -58,7 +58,6 @@ ...@@ -58,7 +58,6 @@
#include <stdio.h> #include <stdio.h>
#define IMGINNERTEXTSPACE 2
#define IMGOUTERTEXTSPACE 5 #define IMGOUTERTEXTSPACE 5
#define EXTRAFONTSIZE 5 #define EXTRAFONTSIZE 5
#define GAPTOEXTRAPREVIEW 10 #define GAPTOEXTRAPREVIEW 10
...@@ -1024,28 +1023,11 @@ void LineListBox::DataChanged( const DataChangedEvent& rDCEvt ) ...@@ -1024,28 +1023,11 @@ void LineListBox::DataChanged( const DataChangedEvent& rDCEvt )
// FontNameBox // FontNameBox
// =================================================================== // ===================================================================
class ImplFontNameListData
{
public:
FontInfo maInfo;
sal_uInt16 mnType;
ImplFontNameListData( const FontInfo& rInfo,
sal_uInt16 nType ) :
maInfo( rInfo ),
mnType( nType )
{}
};
// -------------------------------------------------------------------
FontNameBox::FontNameBox( Window* pParent, WinBits nWinStyle ) : FontNameBox::FontNameBox( Window* pParent, WinBits nWinStyle ) :
ComboBox( pParent, nWinStyle ) ComboBox( pParent, nWinStyle )
{ {
InitBitmaps();
mpFontList = NULL; mpFontList = NULL;
mbWYSIWYG = sal_False; mbWYSIWYG = sal_False;
mbSymbols = sal_False;
InitFontMRUEntriesFile(); InitFontMRUEntriesFile();
} }
...@@ -1054,10 +1036,8 @@ FontNameBox::FontNameBox( Window* pParent, WinBits nWinStyle ) : ...@@ -1054,10 +1036,8 @@ FontNameBox::FontNameBox( Window* pParent, WinBits nWinStyle ) :
FontNameBox::FontNameBox( Window* pParent, const ResId& rResId ) : FontNameBox::FontNameBox( Window* pParent, const ResId& rResId ) :
ComboBox( pParent, rResId ) ComboBox( pParent, rResId )
{ {
InitBitmaps();
mpFontList = NULL; mpFontList = NULL;
mbWYSIWYG = sal_False; mbWYSIWYG = sal_False;
mbSymbols = sal_False;
InitFontMRUEntriesFile(); InitFontMRUEntriesFile();
} }
...@@ -1083,16 +1063,6 @@ FontNameBox::~FontNameBox() ...@@ -1083,16 +1063,6 @@ FontNameBox::~FontNameBox()
// ------------------------------------------------------------------- // -------------------------------------------------------------------
void FontNameBox::DataChanged( const DataChangedEvent& rDCEvt )
{
ComboBox::DataChanged( rDCEvt );
if( rDCEvt.GetType() == DATACHANGED_SETTINGS && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) )
InitBitmaps();
}
// -------------------------------------------------------------------
void FontNameBox::SaveMRUEntries( const String& aFontMRUEntriesFile, xub_Unicode cSep ) const void FontNameBox::SaveMRUEntries( const String& aFontMRUEntriesFile, xub_Unicode cSep ) const
{ {
rtl::OString aEntries(rtl::OUStringToOString(GetMRUEntries(cSep), rtl::OString aEntries(rtl::OUStringToOString(GetMRUEntries(cSep),
...@@ -1155,25 +1125,9 @@ void FontNameBox::InitFontMRUEntriesFile() ...@@ -1155,25 +1125,9 @@ void FontNameBox::InitFontMRUEntriesFile()
// ------------------------------------------------------------------- // -------------------------------------------------------------------
void FontNameBox::InitBitmaps( void )
{
maImagePrinterFont = Image( SvtResId( RID_IMG_PRINTERFONT ) );
maImageBitmapFont = Image( SvtResId( RID_IMG_BITMAPFONT ) );
maImageScalableFont = Image( SvtResId( RID_IMG_SCALABLEFONT ) );
}
// -------------------------------------------------------------------
void FontNameBox::ImplDestroyFontList() void FontNameBox::ImplDestroyFontList()
{ {
if ( mpFontList ) delete mpFontList;
{
for ( size_t i = 0, n = mpFontList->size(); i < n; ++i ) {
delete (*mpFontList)[ i ];
}
mpFontList->clear();
delete mpFontList;
}
} }
// ------------------------------------------------------------------- // -------------------------------------------------------------------
...@@ -1197,14 +1151,12 @@ void FontNameBox::Fill( const FontList* pList ) ...@@ -1197,14 +1151,12 @@ void FontNameBox::Fill( const FontList* pList )
sal_uLong nIndex = InsertEntry( rFontInfo.GetName() ); sal_uLong nIndex = InsertEntry( rFontInfo.GetName() );
if ( nIndex != LISTBOX_ERROR ) if ( nIndex != LISTBOX_ERROR )
{ {
sal_uInt16 nType = pList->GetFontNameType( i );
ImplFontNameListData* pData = new ImplFontNameListData( rFontInfo, nType );
if ( nIndex < mpFontList->size() ) { if ( nIndex < mpFontList->size() ) {
ImplFontList::iterator it = mpFontList->begin(); ImplFontList::iterator it = mpFontList->begin();
::std::advance( it, nIndex ); ::std::advance( it, nIndex );
mpFontList->insert( it, pData ); mpFontList->insert( it, rFontInfo );
} else { } else {
mpFontList->push_back( pData ); mpFontList->push_back( rFontInfo );
} }
} }
} }
...@@ -1228,19 +1180,7 @@ void FontNameBox::EnableWYSIWYG( sal_Bool bEnable ) ...@@ -1228,19 +1180,7 @@ void FontNameBox::EnableWYSIWYG( sal_Bool bEnable )
if ( bEnable != mbWYSIWYG ) if ( bEnable != mbWYSIWYG )
{ {
mbWYSIWYG = bEnable; mbWYSIWYG = bEnable;
EnableUserDraw( mbWYSIWYG | mbSymbols ); EnableUserDraw( mbWYSIWYG );
ImplCalcUserItemSize();
}
}
// -------------------------------------------------------------------
void FontNameBox::EnableSymbols( sal_Bool bEnable )
{
if ( bEnable != mbSymbols )
{
mbSymbols = bEnable;
EnableUserDraw( mbWYSIWYG | mbSymbols );
ImplCalcUserItemSize(); ImplCalcUserItemSize();
} }
} }
...@@ -1256,17 +1196,6 @@ void FontNameBox::ImplCalcUserItemSize() ...@@ -1256,17 +1196,6 @@ void FontNameBox::ImplCalcUserItemSize()
aUserItemSz.Height() *= 16; aUserItemSz.Height() *= 16;
aUserItemSz.Height() /= 10; aUserItemSz.Height() /= 10;
} }
if ( mbSymbols )
{
Size aSz = maImageScalableFont.GetSizePixel();
aUserItemSz.Width() += aSz.Width() + IMGINNERTEXTSPACE;
if ( mbWYSIWYG && mpFontList )
aUserItemSz.Width() += IMGOUTERTEXTSPACE;
if ( aSz.Height() > aUserItemSz.Height() )
aUserItemSz.Height() = aSz.Height();
}
SetUserItemSize( aUserItemSz ); SetUserItemSize( aUserItemSz );
} }
...@@ -1302,35 +1231,14 @@ namespace ...@@ -1302,35 +1231,14 @@ namespace
void FontNameBox::UserDraw( const UserDrawEvent& rUDEvt ) void FontNameBox::UserDraw( const UserDrawEvent& rUDEvt )
{ {
ImplFontNameListData* pData = (*mpFontList)[ rUDEvt.GetItemId() ]; assert( mpFontList );
const FontInfo& rInfo = pData->maInfo;
sal_uInt16 nType = pData->mnType;
Point aTopLeft = rUDEvt.GetRect().TopLeft();
long nX = aTopLeft.X();
long nH = rUDEvt.GetRect().GetHeight();
if ( mbSymbols )
{
nX += IMGINNERTEXTSPACE;
Image* pImg = NULL;
if ( (nType & (FONTLIST_FONTNAMETYPE_PRINTER | FONTLIST_FONTNAMETYPE_SCREEN)) == FONTLIST_FONTNAMETYPE_PRINTER )
pImg = &maImagePrinterFont;
else if ( nType & FONTLIST_FONTNAMETYPE_SCALABLE )
pImg = &maImageScalableFont;
else
pImg = &maImageBitmapFont;
if ( pImg ) FontInfo& rInfo = (*mpFontList)[ rUDEvt.GetItemId() ];
{ Point aTopLeft = rUDEvt.GetRect().TopLeft();
Point aPos( nX, aTopLeft.Y() + (nH-pImg->GetSizePixel().Height())/2 ); long nX = aTopLeft.X();
rUDEvt.GetDevice()->DrawImage( aPos, *pImg ); long nH = rUDEvt.GetRect().GetHeight();
}
// X immer um gleiche Breite aendern, auch wenn kein Image ausgegeben. if ( mbWYSIWYG )
nX += maImagePrinterFont.GetSizePixel().Width();
}
if ( mbWYSIWYG && mpFontList )
{ {
nX += IMGOUTERTEXTSPACE; nX += IMGOUTERTEXTSPACE;
......
...@@ -31,24 +31,6 @@ ...@@ -31,24 +31,6 @@
#endif #endif
IMAGE RID_IMG_SCALABLEFONT
{
ImageBitmap = Bitmap { File = "scalfont.png" ; };
MaskColor = IMAGE_STDBTN_COLOR ;
};
IMAGE RID_IMG_PRINTERFONT
{
ImageBitmap = Bitmap { File = "prnfont.png" ; };
MaskColor = IMAGE_STDBTN_COLOR ;
};
IMAGE RID_IMG_BITMAPFONT
{
ImageBitmap = Bitmap { File = "bmpfont.png" ; };
MaskColor = IMAGE_STDBTN_COLOR ;
};
String STR_SVT_AUTOMATIC_COLOR String STR_SVT_AUTOMATIC_COLOR
{ {
Text [ en-US ] = "Automatic"; Text [ en-US ] = "Automatic";
......
...@@ -116,7 +116,6 @@ class ImplFontListNameInfo ...@@ -116,7 +116,6 @@ class ImplFontListNameInfo
private: private:
XubString maSearchName; XubString maSearchName;
ImplFontListFontInfo* mpFirst; ImplFontListFontInfo* mpFirst;
sal_uInt16 mnType;
ImplFontListNameInfo( const XubString& rSearchName ) : ImplFontListNameInfo( const XubString& rSearchName ) :
maSearchName( rSearchName ) maSearchName( rSearchName )
...@@ -262,12 +261,6 @@ void FontList::ImplInsertFonts( OutputDevice* pDevice, sal_Bool bAll, ...@@ -262,12 +261,6 @@ void FontList::ImplInsertFonts( OutputDevice* pDevice, sal_Bool bAll,
{ {
rtl_TextEncoding eSystemEncoding = osl_getThreadTextEncoding(); rtl_TextEncoding eSystemEncoding = osl_getThreadTextEncoding();
sal_uInt16 nType;
if ( pDevice->GetOutDevType() != OUTDEV_PRINTER )
nType = FONTLIST_FONTNAMETYPE_SCREEN;
else
nType = FONTLIST_FONTNAMETYPE_PRINTER;
// Alle Fonts vom Device abfragen // Alle Fonts vom Device abfragen
int n = pDevice->GetDevFontCount(); int n = pDevice->GetDevFontCount();
sal_uInt16 i; sal_uInt16 i;
...@@ -294,7 +287,6 @@ void FontList::ImplInsertFonts( OutputDevice* pDevice, sal_Bool bAll, ...@@ -294,7 +287,6 @@ void FontList::ImplInsertFonts( OutputDevice* pDevice, sal_Bool bAll,
pData = new ImplFontListNameInfo( aSearchName ); pData = new ImplFontListNameInfo( aSearchName );
pData->mpFirst = pNewInfo; pData->mpFirst = pNewInfo;
pNewInfo->mpNext = NULL; pNewInfo->mpNext = NULL;
pData->mnType = 0;
if (nIndex < maEntries.size()) if (nIndex < maEntries.size())
maEntries.insert(maEntries.begin()+nIndex,pData); maEntries.insert(maEntries.begin()+nIndex,pData);
...@@ -347,13 +339,6 @@ void FontList::ImplInsertFonts( OutputDevice* pDevice, sal_Bool bAll, ...@@ -347,13 +339,6 @@ void FontList::ImplInsertFonts( OutputDevice* pDevice, sal_Bool bAll,
} }
} }
} }
if ( pData )
{
pData->mnType |= nType;
if ( aFontInfo.GetType() != TYPE_RASTER )
pData->mnType |= FONTLIST_FONTNAMETYPE_SCALABLE;
}
} }
} }
...@@ -681,15 +666,6 @@ const FontInfo& FontList::GetFontName( sal_uInt16 nFont ) const ...@@ -681,15 +666,6 @@ const FontInfo& FontList::GetFontName( sal_uInt16 nFont ) const
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
sal_uInt16 FontList::GetFontNameType( sal_uInt16 nFont ) const
{
DBG_ASSERT( nFont < GetFontNameCount(), "FontList::GetFontNameType(): nFont >= Count" );
return maEntries[nFont].mnType;
}
// -----------------------------------------------------------------------
sal_Handle FontList::GetFirstFontInfo(const OUString& rName) const sal_Handle FontList::GetFirstFontInfo(const OUString& rName) const
{ {
ImplFontListNameInfo* pData = ImplFindByName( rName ); ImplFontListNameInfo* pData = ImplFindByName( rName );
......
...@@ -747,7 +747,6 @@ void SvxFontNameBox_Impl::EnableControls_Impl() ...@@ -747,7 +747,6 @@ void SvxFontNameBox_Impl::EnableControls_Impl()
bEnable = aFontOpt.IsFontWYSIWYGEnabled(); bEnable = aFontOpt.IsFontWYSIWYGEnabled();
EnableWYSIWYG( bEnable ); EnableWYSIWYG( bEnable );
EnableSymbols( bEnable );
} }
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
......
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