Kaydet (Commit) cb7412b8 authored tarafından Caolán McNamara's avatar Caolán McNamara

merge duplicated CreateFontDescriptor methods

Change-Id: I33f9df7f17158eedc4a4c0dedfd0fc4cddc6180f
üst ade27059
...@@ -182,12 +182,6 @@ namespace dbaui ...@@ -182,12 +182,6 @@ namespace dbaui
*/ */
SvxCellHorJustify mapTextJustify(const sal_Int32& _nAlignment); SvxCellHorJustify mapTextJustify(const sal_Int32& _nAlignment);
/** convert Font to ::com::sun::star::awt::FontDescriptor
@param _rFont Font to be converted
@return the new FontDescriptor
*/
::com::sun::star::awt::FontDescriptor CreateFontDescriptor( const Font& _rFont );
/** call the format dialog and set the selected format at the column /** call the format dialog and set the selected format at the column
@param _xAffectedCol Font to be converted @param _xAffectedCol Font to be converted
@param _xField Font to be converted @param _xField Font to be converted
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include "HtmlReader.hxx" #include "HtmlReader.hxx"
#include <connectivity/dbconversion.hxx> #include <connectivity/dbconversion.hxx>
#include <connectivity/dbtools.hxx> #include <connectivity/dbtools.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <tools/tenccvt.hxx> #include <tools/tenccvt.hxx>
#include <comphelper/extract.hxx> #include <comphelper/extract.hxx>
#include <comphelper/string.hxx> #include <comphelper/string.hxx>
...@@ -439,7 +440,7 @@ sal_Bool OHTMLReader::CreateTable(int nToken) ...@@ -439,7 +440,7 @@ sal_Bool OHTMLReader::CreateTable(int nToken)
SvxCellHorJustify eVal; SvxCellHorJustify eVal;
String aTableName; String aTableName;
FontDescriptor aFont = ::dbaui::CreateFontDescriptor(Application::GetSettings().GetStyleSettings().GetAppFont()); FontDescriptor aFont = VCLUnoHelper::CreateFontDescriptor(Application::GetSettings().GetStyleSettings().GetAppFont());
sal_Int32 nTextColor = 0; sal_Int32 nTextColor = 0;
do do
{ {
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include <com/sun/star/util/XNumberFormatTypes.hpp> #include <com/sun/star/util/XNumberFormatTypes.hpp>
#include "dbustrings.hrc" #include "dbustrings.hrc"
#include <svtools/rtftoken.h> #include <svtools/rtftoken.h>
#include <toolkit/helper/vclunohelper.hxx>
#include "dbu_misc.hrc" #include "dbu_misc.hrc"
#include <vcl/msgbox.hxx> #include <vcl/msgbox.hxx>
#include <connectivity/dbconversion.hxx> #include <connectivity/dbconversion.hxx>
...@@ -270,7 +271,7 @@ sal_Bool ORTFReader::CreateTable(int nToken) ...@@ -270,7 +271,7 @@ sal_Bool ORTFReader::CreateTable(int nToken)
int nTmpToken2 = nToken; int nTmpToken2 = nToken;
String aColumnName; String aColumnName;
FontDescriptor aFont = ::dbaui::CreateFontDescriptor(Application::GetSettings().GetStyleSettings().GetAppFont()); FontDescriptor aFont = VCLUnoHelper::CreateFontDescriptor(Application::GetSettings().GetStyleSettings().GetAppFont());
do do
{ {
switch(nTmpToken2) switch(nTmpToken2)
......
...@@ -753,84 +753,6 @@ SvxCellHorJustify mapTextJustify(const sal_Int32& _nAlignment) ...@@ -753,84 +753,6 @@ SvxCellHorJustify mapTextJustify(const sal_Int32& _nAlignment)
return eJustify; return eJustify;
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
float ConvertFontWeight( ::FontWeight eWeight )
{
if( eWeight == WEIGHT_DONTKNOW )
return ::com::sun::star::awt::FontWeight::DONTKNOW;
else if( eWeight == WEIGHT_THIN )
return ::com::sun::star::awt::FontWeight::THIN;
else if( eWeight == WEIGHT_ULTRALIGHT )
return ::com::sun::star::awt::FontWeight::ULTRALIGHT;
else if( eWeight == WEIGHT_LIGHT )
return ::com::sun::star::awt::FontWeight::LIGHT;
else if( eWeight == WEIGHT_SEMILIGHT )
return ::com::sun::star::awt::FontWeight::SEMILIGHT;
else if( ( eWeight == WEIGHT_NORMAL ) || ( eWeight == WEIGHT_MEDIUM ) )
return ::com::sun::star::awt::FontWeight::NORMAL;
else if( eWeight == WEIGHT_SEMIBOLD )
return ::com::sun::star::awt::FontWeight::SEMIBOLD;
else if( eWeight == WEIGHT_BOLD )
return ::com::sun::star::awt::FontWeight::BOLD;
else if( eWeight == WEIGHT_ULTRABOLD )
return ::com::sun::star::awt::FontWeight::ULTRABOLD;
else if( eWeight == WEIGHT_BLACK )
return ::com::sun::star::awt::FontWeight::BLACK;
SAL_WARN("dbaccess.ui", "Unknown FontWeight" );
return ::com::sun::star::awt::FontWeight::DONTKNOW;
}
// -----------------------------------------------------------------------------
float ConvertFontWidth( ::FontWidth eWidth )
{
if( eWidth == WIDTH_DONTKNOW )
return ::com::sun::star::awt::FontWidth::DONTKNOW;
else if( eWidth == WIDTH_ULTRA_CONDENSED )
return ::com::sun::star::awt::FontWidth::ULTRACONDENSED;
else if( eWidth == WIDTH_EXTRA_CONDENSED )
return ::com::sun::star::awt::FontWidth::EXTRACONDENSED;
else if( eWidth == WIDTH_CONDENSED )
return ::com::sun::star::awt::FontWidth::CONDENSED;
else if( eWidth == WIDTH_SEMI_CONDENSED )
return ::com::sun::star::awt::FontWidth::SEMICONDENSED;
else if( eWidth == WIDTH_NORMAL )
return ::com::sun::star::awt::FontWidth::NORMAL;
else if( eWidth == WIDTH_SEMI_EXPANDED )
return ::com::sun::star::awt::FontWidth::SEMIEXPANDED;
else if( eWidth == WIDTH_EXPANDED )
return ::com::sun::star::awt::FontWidth::EXPANDED;
else if( eWidth == WIDTH_EXTRA_EXPANDED )
return ::com::sun::star::awt::FontWidth::EXTRAEXPANDED;
else if( eWidth == WIDTH_ULTRA_EXPANDED )
return ::com::sun::star::awt::FontWidth::ULTRAEXPANDED;
SAL_WARN("dbaccess.ui", "Unknown FontWidth" );
return ::com::sun::star::awt::FontWidth::DONTKNOW;
}
// -----------------------------------------------------------------------------
::com::sun::star::awt::FontDescriptor CreateFontDescriptor( const Font& rFont )
{
::com::sun::star::awt::FontDescriptor aFD;
aFD.Name = rFont.GetName();
aFD.StyleName = rFont.GetStyleName();
aFD.Height = (sal_Int16)rFont.GetSize().Height();
aFD.Width = (sal_Int16)rFont.GetSize().Width();
aFD.Family = sal::static_int_cast< sal_Int16 >(rFont.GetFamily());
aFD.CharSet = rFont.GetCharSet();
aFD.Pitch = sal::static_int_cast< sal_Int16 >(rFont.GetPitch());
aFD.CharacterWidth = ConvertFontWidth( rFont.GetWidthType() );
aFD.Weight = ConvertFontWeight( rFont.GetWeight() );
aFD.Slant = (::com::sun::star::awt::FontSlant)rFont.GetItalic();
aFD.Underline = sal::static_int_cast< sal_Int16 >(
rFont.GetUnderline());
aFD.Strikeout = sal::static_int_cast< sal_Int16 >(
rFont.GetStrikeout());
aFD.Orientation = rFont.GetOrientation();
aFD.Kerning = rFont.IsKerning();
aFD.WordLineMode = rFont.IsWordLineMode();
aFD.Type = 0; // ??? => Nur an Metric...
return aFD;
}
// -----------------------------------------------------------------------------
void callColumnFormatDialog(const Reference<XPropertySet>& xAffectedCol, void callColumnFormatDialog(const Reference<XPropertySet>& xAffectedCol,
const Reference<XPropertySet>& xField, const Reference<XPropertySet>& xField,
SvNumberFormatter* _pFormatter, SvNumberFormatter* _pFormatter,
......
...@@ -94,7 +94,10 @@ public: ...@@ -94,7 +94,10 @@ public:
// Polygon // Polygon
static Polygon CreatePolygon( const ::com::sun::star::uno::Sequence< sal_Int32 >& DataX, const ::com::sun::star::uno::Sequence< sal_Int32 >& DataY ); static Polygon CreatePolygon( const ::com::sun::star::uno::Sequence< sal_Int32 >& DataX, const ::com::sun::star::uno::Sequence< sal_Int32 >& DataY );
// Font /** convert Font to ::com::sun::star::awt::FontDescriptor
@param rFont Font to be converted
@return the new FontDescriptor
*/
static ::com::sun::star::awt::FontDescriptor CreateFontDescriptor( const Font& rFont ); static ::com::sun::star::awt::FontDescriptor CreateFontDescriptor( const Font& rFont );
static Font CreateFont( const ::com::sun::star::awt::FontDescriptor& rDescr, const Font& rInitFont ); static Font CreateFont( const ::com::sun::star::awt::FontDescriptor& rDescr, const Font& rInitFont );
static Font CreateFont( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont >& rxFont ); static Font CreateFont( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont >& rxFont );
......
...@@ -305,7 +305,7 @@ FontWeight VCLUnoHelper::ConvertFontWeight( float f ) ...@@ -305,7 +305,7 @@ FontWeight VCLUnoHelper::ConvertFontWeight( float f )
else if( f <= ::com::sun::star::awt::FontWeight::BLACK ) else if( f <= ::com::sun::star::awt::FontWeight::BLACK )
return WEIGHT_BLACK; return WEIGHT_BLACK;
OSL_FAIL( "Unknown FontWeigth" ); OSL_FAIL( "Unknown FontWeight" );
return WEIGHT_DONTKNOW; return WEIGHT_DONTKNOW;
} }
......
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