[Libreoffice-commits] .: 4 commits - editeng/inc editeng/source svx/source
Caolán McNamara
caolan at kemper.freedesktop.org
Mon Oct 17 01:40:24 PDT 2011
editeng/inc/editeng/svxfont.hxx | 2
editeng/source/items/svxfont.cxx | 2
svx/source/dialog/fntctrl.cxx | 80 ++++++++++++++++++---------------------
3 files changed, 39 insertions(+), 45 deletions(-)
New commits:
commit f5aa9247c7f24078c237f8d212d3caa1286ee9b8
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sun Oct 16 14:39:51 2011 +0100
increase the amount of text shown in the font preview
diff --git a/svx/source/dialog/fntctrl.cxx b/svx/source/dialog/fntctrl.cxx
index 6af2f7a..2f5dcf0 100644
--- a/svx/source/dialog/fntctrl.cxx
+++ b/svx/source/dialog/fntctrl.cxx
@@ -83,7 +83,9 @@
// define ----------------------------------------------------------------
-#define TEXT_WIDTH 20
+//TODO: remove this and calculate off the actual size of text, not
+//an arbitrary number of characters
+#define TEXT_WIDTH 80
#define ISITEMSET rSet.GetItemState(nWhich)>=SFX_ITEM_DEFAULT
using namespace ::com::sun::star::uno;
commit f264a149850d688ec53af918c04bea684d8a1617
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sun Oct 16 14:35:24 2011 +0100
show CTL preview if CTL is enabled
diff --git a/svx/source/dialog/fntctrl.cxx b/svx/source/dialog/fntctrl.cxx
index 386edfc..6af2f7a 100644
--- a/svx/source/dialog/fntctrl.cxx
+++ b/svx/source/dialog/fntctrl.cxx
@@ -690,6 +690,7 @@ void SvxFontPrevWindow::Paint( const Rectangle& )
Printer* pPrinter = pImpl->pPrinter;
const SvxFont& rFont = pImpl->aFont;
const SvxFont& rCJKFont = pImpl->aCJKFont;
+ const SvxFont& rCTLFont = pImpl->aCTLFont;
if ( !IsEnabled() )
{
@@ -721,7 +722,17 @@ void SvxFontPrevWindow::Paint( const Rectangle& )
{
pImpl->aText = rFont.GetName();
if (pImpl->m_bCJKEnabled)
+ {
+ if (pImpl->aText.Len())
+ pImpl->aText.AppendAscii(" ");
pImpl->aText += rCJKFont.GetName();
+ }
+ if (pImpl->m_bCTLEnabled)
+ {
+ if (pImpl->aText.Len())
+ pImpl->aText.AppendAscii(" ");
+ pImpl->aText += rCTLFont.GetName();
+ }
}
if ( !pImpl->aText.Len() )
commit 62a37fd5f287999da57383ca55074d18983240e5
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sun Oct 16 14:34:09 2011 +0100
show CJK preview if CJK is enabled, not just if UI is CJK
diff --git a/svx/source/dialog/fntctrl.cxx b/svx/source/dialog/fntctrl.cxx
index 841c793..386edfc 100644
--- a/svx/source/dialog/fntctrl.cxx
+++ b/svx/source/dialog/fntctrl.cxx
@@ -56,6 +56,8 @@
// Item set includes
#include <svl/itemset.hxx>
#include <svl/itempool.hxx>
+#include <svl/stritem.hxx> // SfxStringItem
+#include <svl/languageoptions.hxx>
#include <editeng/colritem.hxx>
#include <editeng/fontitem.hxx>
@@ -79,8 +81,6 @@
#include <editeng/twolinesitem.hxx> // SvxTwoLinesItem
#include <editeng/charscaleitem.hxx> // SvxCharScaleWidthItem
-#include <svl/stritem.hxx> // SfxStringItem
-
// define ----------------------------------------------------------------
#define TEXT_WIDTH 20
@@ -173,11 +173,13 @@ class FontPrevWin_Impl
bPreviewBackgroundToCharacter : 1,
bTwoLines : 1,
bNoLines : 1,
- bIsCJKUI : 1,
- bIsCTLUI : 1,
bUseFontNameAsText : 1,
bTextInited : 1;
+ bool m_bCJKEnabled;
+ bool m_bCTLEnabled;
+
+
void _CheckScript();
public:
inline FontPrevWin_Impl() :
@@ -187,11 +189,14 @@ public:
bSelection( sal_False ), bGetSelection( sal_False ), bUseResText( sal_False ),
bDrawBaseLine( sal_True ), bPreviewBackgroundToCharacter( sal_False ), bTwoLines( sal_False ),
bNoLines( sal_False ),
- bIsCJKUI( sal_False ), bIsCTLUI( sal_False ),
bUseFontNameAsText( sal_False ), bTextInited( sal_False )
- {
- Invalidate100PercentFontWidth();
- }
+ {
+ SvtLanguageOptions aLanguageOptions;
+ m_bCJKEnabled = aLanguageOptions.IsAnyEnabled();
+ m_bCTLEnabled = aLanguageOptions.IsCTLFontEnabled();
+
+ Invalidate100PercentFontWidth();
+ }
inline ~FontPrevWin_Impl()
{
@@ -509,28 +514,6 @@ void SvxFontPrevWindow::Init()
initFont(pImpl->aCTLFont);
InitSettings( sal_True, sal_True );
SetBorderStyle( WINDOW_BORDER_MONO );
-
- LanguageType eLanguage = Application::GetSettings().GetUILanguage();
- switch( eLanguage )
- {
- case LANGUAGE_CHINESE:
- case LANGUAGE_JAPANESE:
- case LANGUAGE_KOREAN:
- case LANGUAGE_KOREAN_JOHAB:
- case LANGUAGE_CHINESE_SIMPLIFIED:
- case LANGUAGE_CHINESE_HONGKONG:
- case LANGUAGE_CHINESE_SINGAPORE:
- case LANGUAGE_CHINESE_MACAU:
- case LANGUAGE_CHINESE_TRADITIONAL:
- pImpl->bIsCJKUI = sal_True;
- break;
- // TODO: CTL Locale
- // pImpl->bIsCTLUI = sal_True;
- // break;
- default:
- pImpl->bIsCJKUI = pImpl->bIsCTLUI = sal_False;
- break;
- }
}
SvxFontPrevWindow::SvxFontPrevWindow( Window* pParent ) :
@@ -705,9 +688,8 @@ void SvxFontPrevWindow::SetPreviewBackgroundToCharacter(sal_Bool bSet)
void SvxFontPrevWindow::Paint( const Rectangle& )
{
Printer* pPrinter = pImpl->pPrinter;
- SvxFont& rFont = pImpl->aFont;
- SvxFont& rCJKFont = pImpl->aCJKFont;
- // TODO: SvxFont& rCTLFont = pImpl->aCTLFont;
+ const SvxFont& rFont = pImpl->aFont;
+ const SvxFont& rCJKFont = pImpl->aCJKFont;
if ( !IsEnabled() )
{
@@ -738,9 +720,8 @@ void SvxFontPrevWindow::Paint( const Rectangle& )
if ( !pImpl->bSelection || pImpl->bUseFontNameAsText )
{
pImpl->aText = rFont.GetName();
- if( pImpl->bIsCJKUI )
+ if (pImpl->m_bCJKEnabled)
pImpl->aText += rCJKFont.GetName();
- //TODO bIsCTLUI
}
if ( !pImpl->aText.Len() )
commit bf939922f0674a62e33bcc8c884db13bca37bb49
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sun Oct 16 14:20:46 2011 +0100
these can be const
diff --git a/editeng/inc/editeng/svxfont.hxx b/editeng/inc/editeng/svxfont.hxx
index d544afd..0dc33b6 100644
--- a/editeng/inc/editeng/svxfont.hxx
+++ b/editeng/inc/editeng/svxfont.hxx
@@ -104,7 +104,7 @@ public:
Size GetPhysTxtSize( const OutputDevice *pOut, const String &rTxt );
Size GetTxtSize( const OutputDevice *pOut, const String &rTxt,
- const sal_uInt16 nIdx = 0, const sal_uInt16 nLen = STRING_LEN );
+ const sal_uInt16 nIdx = 0, const sal_uInt16 nLen = STRING_LEN ) const;
void DrawText( OutputDevice *pOut, const Point &rPos, const String &rTxt,
const sal_uInt16 nIdx = 0, const sal_uInt16 nLen = STRING_LEN ) const;
diff --git a/editeng/source/items/svxfont.cxx b/editeng/source/items/svxfont.cxx
index e7062bf..964d67d 100644
--- a/editeng/source/items/svxfont.cxx
+++ b/editeng/source/items/svxfont.cxx
@@ -463,7 +463,7 @@ Size SvxFont::QuickGetTextSize( const OutputDevice *pOut, const XubString &rTxt,
Size SvxFont::GetTxtSize( const OutputDevice *pOut, const XubString &rTxt,
- const xub_StrLen nIdx, const xub_StrLen nLen )
+ const xub_StrLen nIdx, const xub_StrLen nLen ) const
{
xub_StrLen nTmp = nLen;
if ( nTmp == STRING_LEN ) // already initialized?
diff --git a/svx/source/dialog/fntctrl.cxx b/svx/source/dialog/fntctrl.cxx
index 923a234..841c793 100644
--- a/svx/source/dialog/fntctrl.cxx
+++ b/svx/source/dialog/fntctrl.cxx
@@ -115,7 +115,7 @@ namespace
_rFont.SetSize( aSize );
}
// -----------------------------------------------------------------------
- void calcFontHeightAnyAscent(OutputDevice* _pWin,Font& _rFont,long& _nHeight,long& _nAscent)
+ void calcFontHeightAnyAscent(OutputDevice* _pWin,const Font& _rFont,long& _nHeight,long& _nAscent)
{
if ( !_nHeight )
{
@@ -202,8 +202,8 @@ public:
}
void CheckScript();
- Size CalcTextSize( OutputDevice* pWin, OutputDevice* pPrt, SvxFont &rFont );
- void DrawPrev( OutputDevice* pWin, Printer* pPrt, Point &rPt, SvxFont &rFont );
+ Size CalcTextSize( OutputDevice* pWin, OutputDevice* pPrt, const SvxFont &rFont );
+ void DrawPrev( OutputDevice* pWin, Printer* pPrt, Point &rPt, const SvxFont &rFont );
sal_Bool SetFontWidthScale( sal_uInt16 nScaleInPercent );
inline void Invalidate100PercentFontWidth();
@@ -315,7 +315,7 @@ void FontPrevWin_Impl::_CheckScript()
*/
Size FontPrevWin_Impl::CalcTextSize( OutputDevice* pWin, OutputDevice* _pPrinter,
- SvxFont &rFont )
+ const SvxFont &rFont )
{
sal_uInt16 nScript;
sal_uInt16 nIdx = 0;
@@ -341,7 +341,7 @@ Size FontPrevWin_Impl::CalcTextSize( OutputDevice* pWin, OutputDevice* _pPrinter
long nCTLAscent = 0;
do
{
- SvxFont& rFnt = (nScript==com::sun::star::i18n::ScriptType::ASIAN) ? aCJKFont : ((nScript==com::sun::star::i18n::ScriptType::COMPLEX) ? aCTLFont : rFont);
+ const SvxFont& rFnt = (nScript==com::sun::star::i18n::ScriptType::ASIAN) ? aCJKFont : ((nScript==com::sun::star::i18n::ScriptType::COMPLEX) ? aCTLFont : rFont);
sal_uIntPtr nWidth = rFnt.GetTxtSize( _pPrinter, aText, nStart, nEnd-nStart ).
Width();
aTextWidth[ nIdx++ ] = nWidth;
@@ -393,7 +393,7 @@ Size FontPrevWin_Impl::CalcTextSize( OutputDevice* pWin, OutputDevice* _pPrinter
*/
void FontPrevWin_Impl::DrawPrev( OutputDevice* pWin, Printer* _pPrinter,
- Point &rPt, SvxFont &rFont )
+ Point &rPt, const SvxFont &rFont )
{
Font aOldFont = _pPrinter->GetFont();
sal_uInt16 nScript;
@@ -413,7 +413,7 @@ void FontPrevWin_Impl::DrawPrev( OutputDevice* pWin, Printer* _pPrinter,
}
do
{
- SvxFont& rFnt = (nScript==com::sun::star::i18n::ScriptType::ASIAN) ? aCJKFont : ((nScript==com::sun::star::i18n::ScriptType::COMPLEX) ? aCTLFont : rFont);
+ const SvxFont& rFnt = (nScript==com::sun::star::i18n::ScriptType::ASIAN) ? aCJKFont : ((nScript==com::sun::star::i18n::ScriptType::COMPLEX) ? aCTLFont : rFont);
_pPrinter->SetFont( rFnt );
rFnt.DrawPrev( pWin, _pPrinter, rPt, aText, nStart, nEnd - nStart );
More information about the Libreoffice-commits
mailing list