summaryrefslogtreecommitdiff
path: root/vcl/source
diff options
context:
space:
mode:
Diffstat (limited to 'vcl/source')
-rw-r--r--vcl/source/app/salvtables.cxx7
-rw-r--r--vcl/source/app/session.cxx26
-rwxr-xr-x[-rw-r--r--]vcl/source/app/settings.cxx203
-rw-r--r--vcl/source/app/svapp.cxx173
-rw-r--r--vcl/source/app/svdata.cxx8
-rw-r--r--vcl/source/app/svmain.cxx10
-rw-r--r--vcl/source/app/vclevent.cxx53
-rw-r--r--vcl/source/control/button.cxx175
-rw-r--r--vcl/source/control/combobox.cxx6
-rw-r--r--vcl/source/control/ctrl.cxx189
-rw-r--r--vcl/source/control/edit.cxx20
-rw-r--r--vcl/source/control/field2.cxx11
-rw-r--r--vcl/source/control/fixed.cxx108
-rw-r--r--vcl/source/control/group.cxx44
-rw-r--r--vcl/source/control/ilstbox.cxx40
-rw-r--r--vcl/source/control/lstbox.cxx6
-rw-r--r--vcl/source/control/spinfld.cxx4
-rw-r--r--vcl/source/control/tabctrl.cxx74
-rw-r--r--vcl/source/fontsubset/cff.cxx78
-rw-r--r--vcl/source/fontsubset/gsub.cxx8
-rw-r--r--vcl/source/gdi/base14.cxx2
-rw-r--r--vcl/source/gdi/bitmapex.cxx73
-rw-r--r--vcl/source/gdi/configsettings.cxx205
-rw-r--r--vcl/source/gdi/cvtsvm.cxx354
-rw-r--r--vcl/source/gdi/font.cxx12
-rw-r--r--vcl/source/gdi/fontcfg.cxx1381
-rw-r--r--vcl/source/gdi/fontcvt.cxx1528
-rw-r--r--vcl/source/gdi/impimagetree.cxx60
-rw-r--r--vcl/source/gdi/implncvt.cxx577
-rw-r--r--vcl/source/gdi/implncvt.hxx78
-rw-r--r--vcl/source/gdi/lineinfo.cxx109
-rwxr-xr-x[-rw-r--r--]vcl/source/gdi/makefile.mk86
-rw-r--r--vcl/source/gdi/metaact.cxx114
-rw-r--r--vcl/source/gdi/outdev.cxx297
-rw-r--r--vcl/source/gdi/outdev3.cxx795
-rw-r--r--vcl/source/gdi/outdev6.cxx14
-rw-r--r--vcl/source/gdi/pdfextoutdevdata.cxx13
-rw-r--r--vcl/source/gdi/pdfwriter_impl.cxx290
-rw-r--r--vcl/source/gdi/pdfwriter_impl.hxx10
-rw-r--r--vcl/source/gdi/regband.cxx2
-rw-r--r--vcl/source/gdi/region.cxx25
-rw-r--r--vcl/source/gdi/salgdilayout.cxx1
-rwxr-xr-xvcl/source/gdi/sallayout.cxx15
-rw-r--r--vcl/source/gdi/salmisc.cxx8
-rwxr-xr-xvcl/source/gdi/textlayout.cxx384
-rw-r--r--vcl/source/glyphs/gcach_ftyp.cxx15
-rw-r--r--vcl/source/glyphs/glyphcache.cxx2
-rw-r--r--vcl/source/glyphs/graphite_adaptors.cxx10
-rw-r--r--vcl/source/glyphs/makefile.mk3
-rw-r--r--vcl/source/window/accmgr.cxx17
-rw-r--r--vcl/source/window/dialog.cxx14
-rw-r--r--vcl/source/window/menu.cxx24
-rw-r--r--vcl/source/window/status.cxx7
-rw-r--r--vcl/source/window/syswin.cxx24
-rw-r--r--vcl/source/window/toolbox2.cxx3
-rw-r--r--vcl/source/window/window.cxx6
-rw-r--r--vcl/source/window/wrkwin.cxx2
57 files changed, 2710 insertions, 5093 deletions
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 9d398aef10cd..516b23dd76be 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -61,6 +61,13 @@ void SalFrame::Flush( const Rectangle& )
// -----------------------------------------------------------------------
+void SalFrame::SetRepresentedURL( const rtl::OUString& )
+{
+ // currently this is Mac only functionality
+}
+
+// -----------------------------------------------------------------------
+
SalInstance::~SalInstance()
{
}
diff --git a/vcl/source/app/session.cxx b/vcl/source/app/session.cxx
index ed8e355c2071..e82e93a9ccca 100644
--- a/vcl/source/app/session.cxx
+++ b/vcl/source/app/session.cxx
@@ -38,6 +38,7 @@
#include <tools/debug.hxx>
#include <com/sun/star/frame/XSessionManagerClient.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/frame/XSessionManagerListener2.hpp>
#include <list>
@@ -81,6 +82,7 @@ class VCLSession : public cppu::WeakComponentImplHelper1 < XSessionManagerClient
void callSaveRequested( bool bShutdown, bool bCancelable );
void callShutdownCancelled();
void callInteractionGranted( bool bGranted );
+ void callQuit();
public:
VCLSession();
virtual ~VCLSession();
@@ -199,6 +201,27 @@ void VCLSession::callShutdownCancelled()
Application::AcquireSolarMutex( nAcquireCount );
}
+void VCLSession::callQuit()
+{
+ std::list< Listener > aListeners;
+ {
+ osl::MutexGuard aGuard( m_aMutex );
+ // copy listener list since calling a listener may remove it.
+ aListeners = m_aListeners;
+ // set back interaction state
+ m_bInteractionRequested = m_bInteractionDone = m_bInteractionGranted = false;
+ }
+
+ ULONG nAcquireCount = Application::ReleaseSolarMutex();
+ for( std::list< Listener >::const_iterator it = aListeners.begin(); it != aListeners.end(); ++it )
+ {
+ Reference< XSessionManagerListener2 > xListener2( it->m_xListener, UNO_QUERY );
+ if( xListener2.is() )
+ xListener2->doQuit();
+ }
+ Application::AcquireSolarMutex( nAcquireCount );
+}
+
void VCLSession::SalSessionEventProc( SalSessionEvent* pEvent )
{
switch( pEvent->m_eType )
@@ -218,6 +241,9 @@ void VCLSession::SalSessionEventProc( SalSessionEvent* pEvent )
case ShutdownCancel:
pOneInstance->callShutdownCancelled();
break;
+ case Quit:
+ pOneInstance->callQuit();
+ break;
}
}
diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx
index 6aa453563596..bd90d8824d91 100644..100755
--- a/vcl/source/app/settings.cxx
+++ b/vcl/source/app/settings.cxx
@@ -37,14 +37,17 @@
#include "vcl/event.hxx"
#include "vcl/settings.hxx"
#include "vcl/i18nhelp.hxx"
-#include "vcl/fontcfg.hxx"
+#include "unotools/fontcfg.hxx"
#include "vcl/configsettings.hxx"
#include "vcl/gradient.hxx"
#include "vcl/unohelp.hxx"
+#include "vcl/bitmapex.hxx"
+#include "vcl/impimagetree.hxx"
#include "unotools/localedatawrapper.hxx"
#include "unotools/collatorwrapper.hxx"
#include "unotools/configmgr.hxx"
#include "unotools/confignode.hxx"
+#include <unotools/syslocaleoptions.hxx>
#ifdef WNT
#include "tools/prewin.h"
@@ -66,7 +69,6 @@ DBG_NAME( AllSettings )
STYLE_OPTION_NOMNEMONICS)
// =======================================================================
-
ImplMachineData::ImplMachineData()
{
mnRefCount = 1;
@@ -549,7 +551,7 @@ void ImplStyleData::SetStandardStyles()
Font aStdFont( FAMILY_SWISS, Size( 0, 8 ) );
aStdFont.SetCharSet( gsl_getSystemTextEncoding() );
aStdFont.SetWeight( WEIGHT_NORMAL );
- aStdFont.SetName( vcl::DefaultFontConfiguration::get()->getUserInterfaceFont(com::sun::star::lang::Locale( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("en") ), rtl::OUString(), rtl::OUString() ) ) );
+ aStdFont.SetName( utl::DefaultFontConfiguration::get()->getUserInterfaceFont(com::sun::star::lang::Locale( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("en") ), rtl::OUString(), rtl::OUString() ) ) );
maAppFont = aStdFont;
maHelpFont = aStdFont;
maMenuFont = aStdFont;
@@ -706,6 +708,7 @@ void StyleSettings::Set3DColors( const Color& rColor )
case STYLE_SYMBOLS_INDUSTRIAL: return ::rtl::OUString::createFromAscii( "industrial" );
case STYLE_SYMBOLS_CRYSTAL: return ::rtl::OUString::createFromAscii( "crystal" );
case STYLE_SYMBOLS_TANGO: return ::rtl::OUString::createFromAscii( "tango" );
+ case STYLE_SYMBOLS_OXYGEN: return ::rtl::OUString::createFromAscii( "oxygen" );
case STYLE_SYMBOLS_CLASSIC: return ::rtl::OUString::createFromAscii( "classic" );
}
@@ -726,6 +729,8 @@ ULONG StyleSettings::ImplNameToSymbolsStyle( const ::rtl::OUString &rName ) cons
return STYLE_SYMBOLS_CRYSTAL;
else if ( rName == ::rtl::OUString::createFromAscii( "tango" ) )
return STYLE_SYMBOLS_TANGO;
+ else if ( rName == ::rtl::OUString::createFromAscii( "oxygen" ) )
+ return STYLE_SYMBOLS_OXYGEN;
else if ( rName == ::rtl::OUString::createFromAscii( "classic" ) )
return STYLE_SYMBOLS_CLASSIC;
@@ -759,12 +764,12 @@ ULONG StyleSettings::GetCurrentSymbolsStyle() const
// style selected in Tools -> Options... -> OpenOffice.org -> View
ULONG nStyle = GetSymbolsStyle();
- if ( nStyle == STYLE_SYMBOLS_AUTO )
+ if ( nStyle == STYLE_SYMBOLS_AUTO || ( !CheckSymbolStyle (nStyle) ) )
{
// the preferred style can be read from the desktop setting by the desktop native widgets modules
ULONG nPreferredStyle = GetPreferredSymbolsStyle();
- if ( nPreferredStyle == STYLE_SYMBOLS_AUTO )
+ if ( nPreferredStyle == STYLE_SYMBOLS_AUTO || ( !CheckSymbolStyle (nPreferredStyle) ) )
{
// use a hardcoded desktop-specific fallback if no preferred style has been detected
@@ -780,7 +785,10 @@ ULONG StyleSettings::GetCurrentSymbolsStyle() const
nPreferredStyle = snFallbackDesktopStyle;
}
- nStyle = GetHighContrastMode()? STYLE_SYMBOLS_HICONTRAST: nPreferredStyle;
+ if (GetHighContrastMode() && CheckSymbolStyle (STYLE_SYMBOLS_HICONTRAST) )
+ nStyle = STYLE_SYMBOLS_HICONTRAST;
+ else
+ nStyle = nPreferredStyle;
}
return nStyle;
@@ -814,6 +822,33 @@ ULONG StyleSettings::GetAutoSymbolsStyle() const
nRet = STYLE_SYMBOLS_TANGO;
else if( rDesktopEnvironment.equalsIgnoreAsciiCaseAscii( "kde" ) )
nRet = STYLE_SYMBOLS_CRYSTAL;
+ else if( rDesktopEnvironment.equalsIgnoreAsciiCaseAscii( "kde4" ) )
+ nRet = STYLE_SYMBOLS_OXYGEN;
+ }
+
+ // falback to any existing style
+ if ( ! CheckSymbolStyle (nRet) )
+ {
+ for ( ULONG n = 0 ; n <= STYLE_SYMBOLS_THEMES_MAX ; n++ )
+ {
+ ULONG nStyleToCheck = n;
+
+ // auto is not a real theme => can't be fallback
+ if ( nStyleToCheck == STYLE_SYMBOLS_AUTO )
+ continue;
+
+ // will check hicontrast in the end
+ if ( nStyleToCheck == STYLE_SYMBOLS_HICONTRAST )
+ continue;
+ if ( nStyleToCheck == STYLE_SYMBOLS_THEMES_MAX )
+ nStyleToCheck = STYLE_SYMBOLS_HICONTRAST;
+
+ if ( CheckSymbolStyle ( nStyleToCheck ) )
+ {
+ nRet = nStyleToCheck;
+ n = STYLE_SYMBOLS_THEMES_MAX;
+ }
+ }
}
return nRet;
@@ -821,6 +856,14 @@ ULONG StyleSettings::GetAutoSymbolsStyle() const
// -----------------------------------------------------------------------
+bool StyleSettings::CheckSymbolStyle( ULONG nStyle ) const
+{
+ static ImplImageTreeSingletonRef aImageTree;
+ return aImageTree->checkStyle( ImplSymbolsStyleToName( nStyle ) );
+}
+
+// -----------------------------------------------------------------------
+
void StyleSettings::SetStandardStyles()
{
CopyData();
@@ -1069,7 +1112,6 @@ BOOL StyleSettings::operator ==( const StyleSettings& rSet ) const
ImplMiscData::ImplMiscData()
{
mnRefCount = 1;
- mnTwoDigitYearStart = 1930;
mnEnableATT = sal::static_int_cast<USHORT>(~0U);
mnDisablePrinting = sal::static_int_cast<USHORT>(~0U);
static const char* pEnv = getenv("SAL_DECIMALSEP_ENABLED" ); // set default without UI
@@ -1081,7 +1123,6 @@ ImplMiscData::ImplMiscData()
ImplMiscData::ImplMiscData( const ImplMiscData& rData )
{
mnRefCount = 1;
- mnTwoDigitYearStart = rData.mnTwoDigitYearStart;
mnEnableATT = rData.mnEnableATT;
mnDisablePrinting = rData.mnDisablePrinting;
mbEnableLocalizedDecimalSep = rData.mbEnableLocalizedDecimalSep;
@@ -1155,8 +1196,7 @@ BOOL MiscSettings::operator ==( const MiscSettings& rSet ) const
if ( mpData == rSet.mpData )
return TRUE;
- if ( (mpData->mnTwoDigitYearStart == rSet.mpData->mnTwoDigitYearStart ) &&
- (mpData->mnEnableATT == rSet.mpData->mnEnableATT ) &&
+ if ( (mpData->mnEnableATT == rSet.mpData->mnEnableATT ) &&
(mpData->mnDisablePrinting == rSet.mpData->mnDisablePrinting ) &&
(mpData->mbEnableLocalizedDecimalSep == rSet.mpData->mbEnableLocalizedDecimalSep ) )
return TRUE;
@@ -1513,28 +1553,20 @@ BOOL HelpSettings::operator ==( const HelpSettings& rSet ) const
// =======================================================================
-static BOOL ImplCompareLocales( const ::com::sun::star::lang::Locale& L1, const ::com::sun::star::lang::Locale& L2 )
-{
- return ( ( L1.Language == L2.Language ) &&
- ( L1.Country == L2.Country ) &&
- ( L1.Variant == L2.Variant ) );
-}
-
-// =======================================================================
-
ImplAllSettingsData::ImplAllSettingsData()
{
mnRefCount = 1;
mnSystemUpdate = SETTINGS_ALLSETTINGS;
mnWindowUpdate = SETTINGS_ALLSETTINGS;
meLanguage = LANGUAGE_SYSTEM;
- meUILanguage = LANGUAGE_SYSTEM;
+ meUILanguage = LANGUAGE_SYSTEM;
mpLocaleDataWrapper = NULL;
mpUILocaleDataWrapper = NULL;
mpCollatorWrapper = NULL;
mpUICollatorWrapper = NULL;
mpI18nHelper = NULL;
mpUII18nHelper = NULL;
+ maMiscSettings.SetEnableLocalizedDecimalSep( maSysLocale.GetOptions().IsDecimalSeparatorAsLocale() );
}
// -----------------------------------------------------------------------
@@ -1546,15 +1578,12 @@ ImplAllSettingsData::ImplAllSettingsData( const ImplAllSettingsData& rData ) :
maMiscSettings( rData.maMiscSettings ),
maNotificationSettings( rData.maNotificationSettings ),
maHelpSettings( rData.maHelpSettings ),
- maLocale( rData.maLocale ),
- maUILocale( rData.maUILocale )
-
+ maLocale( rData.maLocale )
{
mnRefCount = 1;
mnSystemUpdate = rData.mnSystemUpdate;
mnWindowUpdate = rData.mnWindowUpdate;
meLanguage = rData.meLanguage;
- meUILanguage = rData.meUILanguage;
// Pointer couldn't shared and objects haven't a copy ctor
// So we create the cache objects new, if the GetFunction is
// called
@@ -1750,11 +1779,7 @@ ULONG AllSettings::Update( ULONG nFlags, const AllSettings& rSet )
if ( nFlags & SETTINGS_UILOCALE )
{
- if ( mpData->meUILanguage || rSet.mpData->meUILanguage )
- {
- SetUILanguage( rSet.mpData->meUILanguage );
- nChangeFlags |= SETTINGS_UILOCALE;
- }
+ // UILocale can't be changed
}
return nChangeFlags;
@@ -1793,9 +1818,6 @@ ULONG AllSettings::GetChangeFlags( const AllSettings& rSet ) const
if ( mpData->meLanguage || rSet.mpData->meLanguage )
nChangeFlags |= SETTINGS_LOCALE;
- if ( mpData->meUILanguage || rSet.mpData->meUILanguage )
- nChangeFlags |= SETTINGS_UILOCALE;
-
return nChangeFlags;
}
@@ -1817,18 +1839,13 @@ BOOL AllSettings::operator ==( const AllSettings& rSet ) const
(mpData->maNotificationSettings == rSet.mpData->maNotificationSettings) &&
(mpData->maHelpSettings == rSet.mpData->maHelpSettings) &&
(mpData->mnSystemUpdate == rSet.mpData->mnSystemUpdate) &&
+ (mpData->maLocale == rSet.mpData->maLocale) &&
(mpData->mnWindowUpdate == rSet.mpData->mnWindowUpdate) )
{
- // special treatment for Locale, because maLocale is only
- // initialized after first call of GetLocale().
- ::com::sun::star::lang::Locale aEmptyLocale;
- if ( ( ImplCompareLocales( mpData->maLocale, aEmptyLocale ) && ImplCompareLocales( rSet.mpData->maLocale, aEmptyLocale ) )
- || ImplCompareLocales( GetLocale(), rSet.GetLocale() ) )
- {
- return TRUE;
- }
+ return TRUE;
}
- return FALSE;
+ else
+ return FALSE;
}
// -----------------------------------------------------------------------
@@ -1857,70 +1874,39 @@ void AllSettings::SetLocale( const ::com::sun::star::lang::Locale& rLocale )
// -----------------------------------------------------------------------
-void AllSettings::SetUILocale( const ::com::sun::star::lang::Locale& rLocale )
+void AllSettings::SetUILocale( const ::com::sun::star::lang::Locale& )
{
- CopyData();
-
- mpData->maUILocale = rLocale;
-
- if ( !rLocale.Language.getLength() )
- mpData->meUILanguage = LANGUAGE_SYSTEM;
- else
- mpData->meUILanguage = MsLangId::convertLocaleToLanguage( rLocale );
- if ( mpData->mpUILocaleDataWrapper )
- {
- delete mpData->mpUILocaleDataWrapper;
- mpData->mpUILocaleDataWrapper = NULL;
- }
- if ( mpData->mpUII18nHelper )
- {
- delete mpData->mpUII18nHelper;
- mpData->mpUII18nHelper = NULL;
- }
+ // there is only one UILocale per process
}
// -----------------------------------------------------------------------
void AllSettings::SetLanguage( LanguageType eLang )
{
- CopyData();
-
- mpData->meLanguage = eLang;
-
- // Will be calculated in GetLocale()
- mpData->maLocale = ::com::sun::star::lang::Locale();
- if ( mpData->mpLocaleDataWrapper )
- {
- delete mpData->mpLocaleDataWrapper;
- mpData->mpLocaleDataWrapper = NULL;
- }
- if ( mpData->mpI18nHelper )
+ if ( eLang != mpData->meLanguage )
{
- delete mpData->mpI18nHelper;
- mpData->mpI18nHelper = NULL;
+ CopyData();
+
+ mpData->meLanguage = eLang;
+ MsLangId::convertLanguageToLocale( GetLanguage(), ((AllSettings*)this)->mpData->maLocale );
+ if ( mpData->mpLocaleDataWrapper )
+ {
+ delete mpData->mpLocaleDataWrapper;
+ mpData->mpLocaleDataWrapper = NULL;
+ }
+ if ( mpData->mpI18nHelper )
+ {
+ delete mpData->mpI18nHelper;
+ mpData->mpI18nHelper = NULL;
+ }
}
}
// -----------------------------------------------------------------------
-void AllSettings::SetUILanguage( LanguageType eLang )
+void AllSettings::SetUILanguage( LanguageType )
{
- CopyData();
-
- mpData->meUILanguage = eLang;
-
- // Will be calculated in GetUILocale()
- mpData->maUILocale = ::com::sun::star::lang::Locale();
- if ( mpData->mpUILocaleDataWrapper )
- {
- delete mpData->mpUILocaleDataWrapper;
- mpData->mpUILocaleDataWrapper = NULL;
- }
- if ( mpData->mpUII18nHelper )
- {
- delete mpData->mpUII18nHelper;
- mpData->mpUII18nHelper = NULL;
- }
+ // there is only one UILanguage per process
}
// -----------------------------------------------------------------------
@@ -1973,8 +1959,7 @@ BOOL AllSettings::GetLayoutRTL() const
const ::com::sun::star::lang::Locale& AllSettings::GetLocale() const
{
if ( !mpData->maLocale.Language.getLength() )
- MsLangId::convertLanguageToLocale( GetLanguage(),
- ((AllSettings*)this)->mpData->maLocale );
+ mpData->maLocale = mpData->maSysLocale.GetLocale();
return mpData->maLocale;
}
@@ -1983,9 +1968,9 @@ const ::com::sun::star::lang::Locale& AllSettings::GetLocale() const
const ::com::sun::star::lang::Locale& AllSettings::GetUILocale() const
{
+ // the UILocale is never changed
if ( !mpData->maUILocale.Language.getLength() )
- MsLangId::convertLanguageToLocale( GetUILanguage(),
- ((AllSettings*)this)->mpData->maUILocale );
+ mpData->maUILocale = mpData->maSysLocale.GetUILocale();
return mpData->maUILocale;
}
@@ -1994,8 +1979,9 @@ const ::com::sun::star::lang::Locale& AllSettings::GetUILocale() const
LanguageType AllSettings::GetLanguage() const
{
+ // meLanguage == LANGUAGE_SYSTEM means: use settings from SvtSysLocale
if ( mpData->meLanguage == LANGUAGE_SYSTEM )
- return MsLangId::getSystemLanguage();
+ return mpData->maSysLocale.GetLanguage();
return mpData->meLanguage;
}
@@ -2004,10 +1990,8 @@ LanguageType AllSettings::GetLanguage() const
LanguageType AllSettings::GetUILanguage() const
{
- if ( mpData->meUILanguage == LANGUAGE_SYSTEM )
- return MsLangId::getSystemUILanguage();
-
- return mpData->meUILanguage;
+ // the UILanguage is never changed
+ return mpData->maSysLocale.GetUILanguage();
}
// -----------------------------------------------------------------------
@@ -2076,3 +2060,22 @@ const CollatorWrapper& AllSettings::GetUICollatorWrapper() const
}
*/
+void AllSettings::LocaleSettingsChanged( sal_uInt32 nHint )
+{
+ AllSettings aAllSettings( Application::GetSettings() );
+ if ( nHint & SYSLOCALEOPTIONS_HINT_DECSEP )
+ {
+ MiscSettings aMiscSettings = aAllSettings.GetMiscSettings();
+ BOOL bIsDecSepAsLocale = aAllSettings.mpData->maSysLocale.GetOptions().IsDecimalSeparatorAsLocale();
+ if ( aMiscSettings.GetEnableLocalizedDecimalSep() != bIsDecSepAsLocale )
+ {
+ aMiscSettings.SetEnableLocalizedDecimalSep( bIsDecSepAsLocale );
+ aAllSettings.SetMiscSettings( aMiscSettings );
+ }
+ }
+
+ if ( (nHint & SYSLOCALEOPTIONS_HINT_LOCALE) )
+ aAllSettings.SetLocale( aAllSettings.mpData->maSysLocale.GetOptions().GetLocale() );
+
+ Application::SetSettings( aAllSettings );
+}
diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx
index 6057409baa14..7f329f2d24d5 100644
--- a/vcl/source/app/svapp.cxx
+++ b/vcl/source/app/svapp.cxx
@@ -31,63 +31,53 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_vcl.hxx"
-#ifndef _SV_SVSYS_HXX
-#include <svsys.h>
-#endif
-#include <vcl/salinst.hxx>
-#include <vcl/salframe.hxx>
-#include <vcl/salsys.hxx>
-#ifndef _VOS_PROCESS_HXX
-#include <vos/process.hxx>
-#endif
-#ifndef _VOS_MUTEX_HXX
-#include <vos/mutex.hxx>
-#endif
-#include <tools/tools.h>
-#include <tools/debug.hxx>
-#include <tools/time.hxx>
-#include <i18npool/mslangid.hxx>
-#include <vcl/svdata.hxx>
-#include <vcl/settings.hxx>
-#ifndef _ACCMGR_HXX
-#include <vcl/accmgr.hxx>
-#endif
-#ifndef _SV_KEYCOD_HXX
-#include <vcl/keycod.hxx>
-#endif
-#include <vcl/event.hxx>
-#include <vcl/virdev.hxx>
-#include <vcl/windata.hxx>
-#include <vcl/window.h>
-#include <vcl/wrkwin.hxx>
-#include <vcl/idlemgr.hxx>
-#include <vcl/svapp.hxx>
-#include <vcl/cvtgrf.hxx>
-#include <vcl/unowrap.hxx>
-#include <vcl/xconnection.hxx>
-#ifndef _SV_SVIDS_HRC
-#include <vcl/svids.hrc>
-#endif
-#include <vcl/timer.hxx>
-
-#include <vcl/unohelp.hxx>
-
-#include <com/sun/star/uno/Reference.h>
-#include <com/sun/star/awt/XToolkit.hpp>
-#include <com/sun/star/uno/XNamingService.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <comphelper/processfactory.hxx>
-
-#include <osl/module.h>
-#include <osl/file.hxx>
+#include "svsys.h"
+#include "vcl/salinst.hxx"
+#include "vcl/salframe.hxx"
+#include "vcl/salsys.hxx"
+#include "vos/process.hxx"
+#include "vos/mutex.hxx"
+#include "tools/tools.h"
+#include "tools/debug.hxx"
+#include "tools/time.hxx"
+#include "i18npool/mslangid.hxx"
+#include "vcl/svdata.hxx"
+#include "vcl/settings.hxx"
+#include "vcl/accmgr.hxx"
+#include "vcl/keycod.hxx"
+#include "vcl/event.hxx"
+#include "vcl/vclevent.hxx"
+#include "vcl/virdev.hxx"
+#include "vcl/windata.hxx"
+#include "vcl/window.h"
+#include "vcl/wrkwin.hxx"
+#include "vcl/idlemgr.hxx"
+#include "vcl/svapp.hxx"
+#include "vcl/cvtgrf.hxx"
+#include "vcl/unowrap.hxx"
+#include "vcl/xconnection.hxx"
+#include "vcl/svids.hrc"
+#include "vcl/timer.hxx"
+
+#include "vcl/unohelp.hxx"
+
+#include "com/sun/star/uno/Reference.h"
+#include "com/sun/star/awt/XToolkit.hpp"
+#include "com/sun/star/uno/XNamingService.hpp"
+#include "com/sun/star/lang/XMultiServiceFactory.hpp"
+#include "comphelper/processfactory.hxx"
+
+#include "osl/module.h"
+#include "osl/file.hxx"
#include "osl/thread.h"
#include "rtl/tencinfo.h"
-#include <rtl/instance.hxx>
-#include <vcl/salimestatus.hxx>
+#include "rtl/instance.hxx"
+#include "vcl/salimestatus.hxx"
#include <utility>
#include <vcl/lazydelete.hxx>
+#include <unotools/syslocaleoptions.hxx>
using namespace ::com::sun::star::uno;
@@ -467,7 +457,7 @@ void Application::Execute()
// -----------------------------------------------------------------------
-void Application::Reschedule( bool bAllEvents )
+inline void ImplYield( bool i_bWait, bool i_bAllEvents )
{
ImplSVData* pSVData = ImplGetSVData();
@@ -477,34 +467,45 @@ void Application::Reschedule( bool bAllEvents )
Timer::ImplTimerCallbackProc();
pSVData->maAppData.mnDispatchLevel++;
- pSVData->mpDefInst->Yield( false, bAllEvents );
+ // do not wait for events if application was already quit; in that
+ // case only dispatch events already available
+ // do not wait for events either if the app decided that it is too busy for timers
+ // (feature added for the slideshow)
+ pSVData->mpDefInst->Yield( i_bWait && !pSVData->maAppData.mbAppQuit && !pSVData->maAppData.mbNoYield, i_bAllEvents );
pSVData->maAppData.mnDispatchLevel--;
// flush lazy deleted objects
if( pSVData->maAppData.mnDispatchLevel == 0 )
vcl::LazyDelete::flush();
+
+ // the system timer events will not necesseraly come in in non waiting mode
+ // e.g. on aqua; need to trigger timer checks manually
+ if( pSVData->maAppData.mbNoYield && !pSVData->mbNoCallTimer )
+ {
+ do
+ {
+ Timer::ImplTimerCallbackProc();
+ }
+ while( pSVData->mbNotAllTimerCalled );
+ }
+
+ // call post yield listeners
+ if( pSVData->maAppData.mpPostYieldListeners )
+ pSVData->maAppData.mpPostYieldListeners->callListeners( NULL );
}
// -----------------------------------------------------------------------
-void Application::Yield( bool bAllEvents )
+void Application::Reschedule( bool i_bAllEvents )
{
- ImplSVData* pSVData = ImplGetSVData();
-
- // run timers that have timed out
- if ( !pSVData->mbNoCallTimer )
- while ( pSVData->mbNotAllTimerCalled )
- Timer::ImplTimerCallbackProc();
+ ImplYield( false, i_bAllEvents );
+}
- // do not wait for events if application was already quit; in that
- // case only dispatch events already available
- pSVData->maAppData.mnDispatchLevel++;
- pSVData->mpDefInst->Yield( !pSVData->maAppData.mbAppQuit, bAllEvents );
- pSVData->maAppData.mnDispatchLevel--;
+// -----------------------------------------------------------------------
- // flush lazy deleted objects
- if( pSVData->maAppData.mnDispatchLevel == 0 )
- vcl::LazyDelete::flush();
+void Application::Yield( bool i_bAllEvents )
+{
+ ImplYield( true, i_bAllEvents );
}
// -----------------------------------------------------------------------
@@ -704,12 +705,10 @@ bool Application::ValidateSystemFont()
void Application::SetSettings( const AllSettings& rSettings )
{
- MsLangId::setConfiguredSystemLanguage( rSettings.GetLanguage());
- MsLangId::setConfiguredSystemUILanguage( rSettings.GetUILanguage());
ImplSVData* pSVData = ImplGetSVData();
if ( !pSVData->maAppData.mpSettings )
{
- pSVData->maAppData.mpSettings = new AllSettings();
+ GetSettings();
*pSVData->maAppData.mpSettings = rSettings;
ResMgr::SetDefaultLocale( rSettings.GetUILocale() );
}
@@ -811,7 +810,12 @@ const AllSettings& Application::GetSettings()
{
ImplSVData* pSVData = ImplGetSVData();
if ( !pSVData->maAppData.mpSettings )
+ {
+ pSVData->maAppData.mpCfgListener = new LocaleConfigurationListener;
pSVData->maAppData.mpSettings = new AllSettings();
+ pSVData->maAppData.mpSettings->GetSysLocale().GetOptions().AddListener( pSVData->maAppData.mpCfgListener );
+ }
+
return *(pSVData->maAppData.mpSettings);
}
@@ -1193,6 +1197,33 @@ void Application::RemoveIdleHdl( const Link& rLink )
// -----------------------------------------------------------------------
+void Application::EnableNoYieldMode( bool i_bNoYield )
+{
+ ImplSVData* pSVData = ImplGetSVData();
+ pSVData->maAppData.mbNoYield = i_bNoYield;
+}
+
+// -----------------------------------------------------------------------
+
+void Application::AddPostYieldListener( const Link& i_rListener )
+{
+ ImplSVData* pSVData = ImplGetSVData();
+ if( ! pSVData->maAppData.mpPostYieldListeners )
+ pSVData->maAppData.mpPostYieldListeners = new VclEventListeners2();
+ pSVData->maAppData.mpPostYieldListeners->addListener( i_rListener );
+}
+
+// -----------------------------------------------------------------------
+
+void Application::RemovePostYieldListener( const Link& i_rListener )
+{
+ ImplSVData* pSVData = ImplGetSVData();
+ if( pSVData->maAppData.mpPostYieldListeners )
+ pSVData->maAppData.mpPostYieldListeners->removeListener( i_rListener );
+}
+
+// -----------------------------------------------------------------------
+
WorkWindow* Application::GetAppWindow()
{
return ImplGetSVData()->maWinData.mpAppWin;
diff --git a/vcl/source/app/svdata.cxx b/vcl/source/app/svdata.cxx
index 21e1f34c1ef5..6a61d15db4c0 100644
--- a/vcl/source/app/svdata.cxx
+++ b/vcl/source/app/svdata.cxx
@@ -47,7 +47,7 @@
#include <uno/current_context.hxx>
#include <cppuhelper/implbase1.hxx>
#include <tools/debug.hxx>
-#include <vcl/fontcfg.hxx>
+#include <unotools/fontcfg.hxx>
#include <vcl/configsettings.hxx>
#include <vcl/svdata.hxx>
#include <vcl/window.h>
@@ -523,3 +523,9 @@ Window* ImplFindWindow( const SalFrame* pFrame, Point& rSalFramePos )
return NULL;
}
+
+void LocaleConfigurationListener::ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 nHint )
+{
+ AllSettings::LocaleSettingsChanged( nHint );
+}
+
diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx
index 6c09978e37b1..310c01a40673 100644
--- a/vcl/source/app/svmain.cxx
+++ b/vcl/source/app/svmain.cxx
@@ -79,8 +79,8 @@
#include "com/sun/star/lang/XMultiServiceFactory.hpp"
#include "com/sun/star/lang/XComponent.hpp"
#include "rtl/logfile.hxx"
-
-#include "vcl/fontcfg.hxx"
+#include <unotools/syslocaleoptions.hxx>
+#include "unotools/fontcfg.hxx"
#include "vcl/configsettings.hxx"
#include "vcl/lazydelete.hxx"
@@ -467,6 +467,12 @@ void DeInitVCL()
if ( pSVData->maAppData.mpSettings )
{
+ if ( pSVData->maAppData.mpCfgListener )
+ {
+ pSVData->maAppData.mpSettings->GetSysLocale().GetOptions().RemoveListener( pSVData->maAppData.mpCfgListener );
+ delete pSVData->maAppData.mpCfgListener;
+ }
+
delete pSVData->maAppData.mpSettings;
pSVData->maAppData.mpSettings = NULL;
}
diff --git a/vcl/source/app/vclevent.cxx b/vcl/source/app/vclevent.cxx
index 8ebc65c8a3f6..704d68c5bc7f 100644
--- a/vcl/source/app/vclevent.cxx
+++ b/vcl/source/app/vclevent.cxx
@@ -80,3 +80,56 @@ BOOL VclEventListeners::Process( VclSimpleEvent* pEvent ) const
}
return bProcessed;
}
+
+VclEventListeners2::VclEventListeners2()
+{
+}
+
+VclEventListeners2::~VclEventListeners2()
+{
+}
+
+void VclEventListeners2::addListener( const Link& i_rLink )
+{
+ // ensure uniqueness
+ for( std::list< Link >::const_iterator it = m_aListeners.begin(); it != m_aListeners.end(); ++it )
+ {
+ if( *it == i_rLink )
+ return;
+ }
+ m_aListeners.push_back( i_rLink );
+}
+
+void VclEventListeners2::removeListener( const Link& i_rLink )
+{
+ size_t n = m_aIterators.size();
+ for( size_t i = 0; i < n; i++ )
+ {
+ if( m_aIterators[i].m_aIt != m_aListeners.end() && *m_aIterators[i].m_aIt == i_rLink )
+ {
+ m_aIterators[i].m_bWasInvalidated = true;
+ ++m_aIterators[i].m_aIt;
+ }
+ }
+ m_aListeners.remove( i_rLink );
+}
+
+void VclEventListeners2::callListeners( VclSimpleEvent* i_pEvent )
+{
+ vcl::DeletionListener aDel( this );
+
+ m_aIterators.push_back( ListenerIt() );
+ size_t nIndex = m_aIterators.size() - 1;
+ m_aIterators[ nIndex ].m_aIt = m_aListeners.begin();
+ while( ! aDel.isDeleted() && m_aIterators[ nIndex ].m_aIt != m_aListeners.end() )
+ {
+ m_aIterators[ nIndex ].m_aIt->Call( i_pEvent );
+ if( m_aIterators[ nIndex ].m_bWasInvalidated )
+ // check if the current element was removed and the iterator increased in the meantime
+ m_aIterators[ nIndex ].m_bWasInvalidated = false;
+ else
+ ++m_aIterators[ nIndex ].m_aIt;
+ }
+ m_aIterators.pop_back();
+}
+
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index e7a4aadb8694..53a060af6bd6 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -50,7 +50,7 @@
#include <tools/poly.hxx>
#include <vcl/button.hxx>
#include <vcl/window.h>
-#include <vcl/controllayout.hxx>
+#include <vcl/controldata.hxx>
#ifndef _SV_NATIVEWIDGET_HXX
#include <vcl/salnativewidgets.hxx>
#endif
@@ -383,8 +383,8 @@ void Button::ImplDrawAlignedImage( OutputDevice* pDev, Point& rPos,
WinBits nWinStyle = GetStyle();
Rectangle aOutRect( rPos, rSize );
- MetricVector *pVector = bLayout ? &mpLayoutData->m_aUnicodeBoundRects : NULL;
- String *pDisplayText = bLayout ? &mpLayoutData->m_aDisplayText : NULL;
+ MetricVector *pVector = bLayout ? &mpControlData->mpLayoutData->m_aUnicodeBoundRects : NULL;
+ String *pDisplayText = bLayout ? &mpControlData->mpLayoutData->m_aDisplayText : NULL;
ImageAlign eImageAlign = mpButtonData->meImageAlign;
Size aImageSize = mpButtonData->maImage.GetSizePixel();
@@ -406,13 +406,12 @@ void Button::ImplDrawAlignedImage( OutputDevice* pDev, Point& rPos,
}
else if ( bDrawText && !bDrawImage && !bHasSymbol )
{
- aOutRect = pDev->GetTextRect( aOutRect, aText, nTextStyle );
- rSize = aOutRect.GetSize();
- rPos = aOutRect.TopLeft();
+ DrawControlText( *pDev, aOutRect, aText, nTextStyle, pVector, pDisplayText );
ImplSetFocusRect( aOutRect );
+ rSize = aOutRect.GetSize();
+ rPos = aOutRect.TopLeft();
- pDev->DrawText( aOutRect, aText, nTextStyle, pVector, pDisplayText );
return;
}
@@ -853,31 +852,25 @@ WinBits PushButton::ImplInitStyle( const Window* pPrevWindow, WinBits nStyle )
return nStyle;
}
+// -----------------------------------------------------------------
+
+const Font& PushButton::GetCanonicalFont( const StyleSettings& _rStyle ) const
+{
+ return _rStyle.GetPushButtonFont();
+}
+
+// -----------------------------------------------------------------
+const Color& PushButton::GetCanonicalTextColor( const StyleSettings& _rStyle ) const
+{
+ return _rStyle.GetButtonTextColor();
+}
+
// -----------------------------------------------------------------------
void PushButton::ImplInitSettings( BOOL bFont,
BOOL bForeground, BOOL bBackground )
{
- const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
-
- if ( bFont )
- {
- Font aFont = rStyleSettings.GetPushButtonFont();
- if ( IsControlFont() )
- aFont.Merge( GetControlFont() );
- SetZoomedPointFont( aFont );
- }
-
- if ( bForeground || bFont )
- {
- Color aColor;
- if ( IsControlForeground() )
- aColor = GetControlForeground();
- else
- aColor = rStyleSettings.GetButtonTextColor();
- SetTextColor( aColor );
- SetTextFillColor();
- }
+ Button::ImplInitSettings( bFont, bForeground );
if ( bBackground )
{
@@ -1659,7 +1652,7 @@ void PushButton::KeyUp( const KeyEvent& rKEvt )
void PushButton::FillLayoutData() const
{
- mpLayoutData = new vcl::ControlLayoutData();
+ mpControlData->mpLayoutData = new vcl::ControlLayoutData();
const_cast<PushButton*>(this)->ImplDrawPushButton( true );
}
@@ -2225,31 +2218,25 @@ WinBits RadioButton::ImplInitStyle( const Window* pPrevWindow, WinBits nStyle )
return nStyle;
}
+// -----------------------------------------------------------------
+
+const Font& RadioButton::GetCanonicalFont( const StyleSettings& _rStyle ) const
+{
+ return _rStyle.GetRadioCheckFont();
+}
+
+// -----------------------------------------------------------------
+const Color& RadioButton::GetCanonicalTextColor( const StyleSettings& _rStyle ) const
+{
+ return _rStyle.GetRadioCheckTextColor();
+}
+
// -----------------------------------------------------------------------
void RadioButton::ImplInitSettings( BOOL bFont,
BOOL bForeground, BOOL bBackground )
{
- const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
-
- if ( bFont )
- {
- Font aFont = rStyleSettings.GetRadioCheckFont();
- if ( IsControlFont() )
- aFont.Merge( GetControlFont() );
- SetZoomedPointFont( aFont );
- }
-
- if ( bForeground || bFont )
- {
- Color aColor;
- if ( IsControlForeground() )
- aColor = GetControlForeground();
- else
- aColor = rStyleSettings.GetRadioCheckTextColor();
- SetTextColor( aColor );
- SetTextFillColor();
- }
+ Button::ImplInitSettings( bFont, bForeground );
if ( bBackground )
{
@@ -2424,16 +2411,14 @@ if ( bNativeOK == FALSE )
void RadioButton::ImplDraw( OutputDevice* pDev, ULONG nDrawFlags,
const Point& rPos, const Size& rSize,
- const Size& rImageSize, long nImageSep,
- Rectangle& rStateRect,
- Rectangle& rMouseRect,
- bool bLayout )
+ const Size& rImageSize, Rectangle& rStateRect,
+ Rectangle& rMouseRect, bool bLayout )
{
WinBits nWinStyle = GetStyle();
XubString aText( GetText() );
Rectangle aRect( rPos, rSize );
- MetricVector* pVector = bLayout ? &mpLayoutData->m_aUnicodeBoundRects : NULL;
- String* pDisplayText = bLayout ? &mpLayoutData->m_aDisplayText : NULL;
+ MetricVector* pVector = bLayout ? &mpControlData->mpLayoutData->m_aUnicodeBoundRects : NULL;
+ String* pDisplayText = bLayout ? &mpControlData->mpLayoutData->m_aDisplayText : NULL;
pDev->Push( PUSH_CLIPREGION );
pDev->IntersectClipRegion( Rectangle( rPos, rSize ) );
@@ -2446,9 +2431,9 @@ void RadioButton::ImplDraw( OutputDevice* pDev, ULONG nDrawFlags,
{
USHORT nTextStyle = Button::ImplGetTextStyle( aText, nWinStyle, nDrawFlags );
+ const long nImageSep = GetDrawPixel( pDev, ImplGetImageToTextDistance() );
Size aSize( rSize );
Point aPos( rPos );
-
aPos.X() += rImageSize.Width() + nImageSep;
aSize.Width() -= rImageSize.Width() + nImageSep;
@@ -2578,7 +2563,7 @@ void RadioButton::ImplDrawRadioButton( bool bLayout )
// Draw control text
ImplDraw( this, 0, Point(), GetOutputSizePixel(),
- aImageSize, IMPL_SEP_BUTTON_IMAGE, maStateRect, maMouseRect, bLayout );
+ aImageSize, maStateRect, maMouseRect, bLayout );
if( !bLayout || (IsNativeControlSupported(CTRL_RADIOBUTTON, PART_ENTIRE_CONTROL)==TRUE) )
{
@@ -2854,7 +2839,7 @@ void RadioButton::KeyUp( const KeyEvent& rKEvt )
void RadioButton::FillLayoutData() const
{
- mpLayoutData = new vcl::ControlLayoutData();
+ mpControlData->mpLayoutData = new vcl::ControlLayoutData();
const_cast<RadioButton*>(this)->ImplDrawRadioButton( true );
}
@@ -2909,8 +2894,7 @@ void RadioButton::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize
pDev->SetTextFillColor();
ImplDraw( pDev, nFlags, aPos, aSize,
- aImageSize, GetDrawPixel( pDev, IMPL_SEP_BUTTON_IMAGE ),
- aStateRect, aMouseRect );
+ aImageSize, aStateRect, aMouseRect );
Point aCenterPos = aStateRect.Center();
long nRadX = aImageSize.Width()/2;
@@ -3158,6 +3142,15 @@ void RadioButton::Check( BOOL bCheck )
// -----------------------------------------------------------------------
+long RadioButton::ImplGetImageToTextDistance() const
+{
+ // 4 pixels, but take zoom into account, so the text doesn't "jump" relative to surrounding elements,
+ // which might have been aligned with the text of the check box
+ return CalcZoom( 4 );
+}
+
+// -----------------------------------------------------------------------
+
Size RadioButton::ImplGetRadioImageSize() const
{
Size aSize;
@@ -3331,12 +3324,12 @@ Size RadioButton::CalcMinimumSize( long nMaxWidth ) const
{
// subtract what will be added later
nMaxWidth-=2;
- nMaxWidth -= IMPL_SEP_BUTTON_IMAGE;
+ nMaxWidth -= ImplGetImageToTextDistance();
Size aTextSize = GetTextRect( Rectangle( Point(), Size( nMaxWidth > 0 ? nMaxWidth : 0x7fffffff, 0x7fffffff ) ),
aText, FixedText::ImplGetTextStyle( GetStyle() ) ).GetSize();
aSize.Width()+=2; // for focus rect
- aSize.Width() += IMPL_SEP_BUTTON_IMAGE;
+ aSize.Width() += ImplGetImageToTextDistance();
aSize.Width() += aTextSize.Width();
if ( aSize.Height() < aTextSize.Height() )
aSize.Height() = aTextSize.Height();
@@ -3395,31 +3388,25 @@ WinBits CheckBox::ImplInitStyle( const Window* pPrevWindow, WinBits nStyle )
return nStyle;
}
+// -----------------------------------------------------------------
+
+const Font& CheckBox::GetCanonicalFont( const StyleSettings& _rStyle ) const
+{
+ return _rStyle.GetRadioCheckFont();
+}
+
+// -----------------------------------------------------------------
+const Color& CheckBox::GetCanonicalTextColor( const StyleSettings& _rStyle ) const
+{
+ return _rStyle.GetRadioCheckTextColor();
+}
+
// -----------------------------------------------------------------------
void CheckBox::ImplInitSettings( BOOL bFont,
BOOL bForeground, BOOL bBackground )
{
- const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
-
- if ( bFont )
- {
- Font aFont = rStyleSettings.GetRadioCheckFont();
- if ( IsControlFont() )
- aFont.Merge( GetControlFont() );
- SetZoomedPointFont( aFont );
- }
-
- if ( bForeground || bFont )
- {
- Color aColor;
- if ( IsControlForeground() )
- aColor = GetControlForeground();
- else
- aColor = rStyleSettings.GetRadioCheckTextColor();
- SetTextColor( aColor );
- SetTextFillColor();
- }
+ Button::ImplInitSettings( bFont, bForeground );
if ( bBackground )
{
@@ -3527,9 +3514,8 @@ void CheckBox::ImplDrawCheckBoxState()
void CheckBox::ImplDraw( OutputDevice* pDev, ULONG nDrawFlags,
const Point& rPos, const Size& rSize,
- const Size& rImageSize, long nImageSep,
- Rectangle& rStateRect, Rectangle& rMouseRect,
- bool bLayout )
+ const Size& rImageSize, Rectangle& rStateRect,
+ Rectangle& rMouseRect, bool bLayout )
{
WinBits nWinStyle = GetStyle();
XubString aText( GetText() );
@@ -3543,6 +3529,7 @@ void CheckBox::ImplDraw( OutputDevice* pDev, ULONG nDrawFlags,
{
USHORT nTextStyle = Button::ImplGetTextStyle( aText, nWinStyle, nDrawFlags );
+ const long nImageSep = GetDrawPixel( pDev, ImplGetImageToTextDistance() );
Size aSize( rSize );
Point aPos( rPos );
aPos.X() += rImageSize.Width() + nImageSep;
@@ -3640,7 +3627,7 @@ void CheckBox::ImplDrawCheckBox( bool bLayout )
HideFocus();
ImplDraw( this, 0, Point(), GetOutputSizePixel(), aImageSize,
- IMPL_SEP_BUTTON_IMAGE, maStateRect, maMouseRect, bLayout );
+ maStateRect, maMouseRect, bLayout );
if( !bLayout )
{
@@ -3797,7 +3784,7 @@ void CheckBox::KeyUp( const KeyEvent& rKEvt )
void CheckBox::FillLayoutData() const
{
- mpLayoutData = new vcl::ControlLayoutData();
+ mpControlData->mpLayoutData = new vcl::ControlLayoutData();
const_cast<CheckBox*>(this)->ImplDrawCheckBox( true );
}
@@ -3852,8 +3839,7 @@ void CheckBox::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize,
pDev->SetTextFillColor();
ImplDraw( pDev, nFlags, aPos, aSize,
- aImageSize, GetDrawPixel( pDev, IMPL_SEP_BUTTON_IMAGE ),
- aStateRect, aMouseRect, false );
+ aImageSize, aStateRect, aMouseRect, false );
pDev->SetLineColor();
pDev->SetFillColor( Color( COL_BLACK ) );
@@ -4099,6 +4085,15 @@ void CheckBox::EnableTriState( BOOL bTriState )
// -----------------------------------------------------------------------
+long CheckBox::ImplGetImageToTextDistance() const
+{
+ // 4 pixels, but take zoom into account, so the text doesn't "jump" relative to surrounding elements,
+ // which might have been aligned with the text of the check box
+ return CalcZoom( 4 );
+}
+
+// -----------------------------------------------------------------------
+
Size CheckBox::ImplGetCheckImageSize() const
{
Size aSize;
@@ -4232,12 +4227,12 @@ Size CheckBox::CalcMinimumSize( long nMaxWidth ) const
{
// subtract what will be added later
nMaxWidth-=2;
- nMaxWidth -= IMPL_SEP_BUTTON_IMAGE;
+ nMaxWidth -= ImplGetImageToTextDistance();
Size aTextSize = GetTextRect( Rectangle( Point(), Size( nMaxWidth > 0 ? nMaxWidth : 0x7fffffff, 0x7fffffff ) ),
aText, FixedText::ImplGetTextStyle( GetStyle() ) ).GetSize();
aSize.Width()+=2; // for focus rect
- aSize.Width() += IMPL_SEP_BUTTON_IMAGE;
+ aSize.Width() += ImplGetImageToTextDistance();
aSize.Width() += aTextSize.Width();
if ( aSize.Height() < aTextSize.Height() )
aSize.Height() = aTextSize.Height();
diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx
index f83e46e38302..21707d0182f5 100644
--- a/vcl/source/control/combobox.cxx
+++ b/vcl/source/control/combobox.cxx
@@ -44,7 +44,7 @@
#include <vcl/subedit.hxx>
#include <vcl/event.hxx>
#include <vcl/combobox.hxx>
-#include <vcl/controllayout.hxx>
+#include <vcl/controldata.hxx>
@@ -689,7 +689,7 @@ void ComboBox::Resize()
void ComboBox::FillLayoutData() const
{
- mpLayoutData = new vcl::ControlLayoutData();
+ mpControlData->mpLayoutData = new vcl::ControlLayoutData();
AppendLayoutData( *mpSubEdit );
mpSubEdit->SetLayoutDataParent( this );
Control* pMainWindow = mpImplLB->GetMainWindow();
@@ -1534,7 +1534,7 @@ void ComboBox::SetBorderStyle( USHORT nBorderStyle )
long ComboBox::GetIndexForPoint( const Point& rPoint, USHORT& rPos ) const
{
- if( ! mpLayoutData )
+ if( !HasLayoutData() )
FillLayoutData();
// check whether rPoint fits at all
diff --git a/vcl/source/control/ctrl.cxx b/vcl/source/control/ctrl.cxx
index 55c979fbd69f..1800327df33c 100644
--- a/vcl/source/control/ctrl.cxx
+++ b/vcl/source/control/ctrl.cxx
@@ -39,10 +39,12 @@
#include <vcl/event.hxx>
#include <vcl/ctrl.hxx>
#include <vcl/decoview.hxx>
-#include <vcl/controllayout.hxx>
+#include <vcl/controldata.hxx>
#include <vcl/salnativewidgets.hxx>
+#include <vcl/textlayout.hxx>
-
+#include <comphelper/processfactory.hxx>
+#include <tools/diagnose_ex.h>
using namespace vcl;
@@ -51,7 +53,7 @@ using namespace vcl;
void Control::ImplInitControlData()
{
mbHasFocus = FALSE;
- mpLayoutData = NULL;
+ mpControlData = new ImplControlData;
}
// -----------------------------------------------------------------------
@@ -90,7 +92,7 @@ Control::Control( Window* pParent, const ResId& rResId ) :
Control::~Control()
{
- delete mpLayoutData, mpLayoutData = NULL;
+ delete mpControlData, mpControlData = NULL;
}
// -----------------------------------------------------------------------
@@ -111,7 +113,7 @@ void Control::LoseFocus()
void Control::Resize()
{
- delete mpLayoutData, mpLayoutData = NULL;
+ ImplClearLayoutData();
Window::Resize();
}
@@ -123,10 +125,31 @@ void Control::FillLayoutData() const
// -----------------------------------------------------------------------
+void Control::CreateLayoutData() const
+{
+ DBG_ASSERT( !mpControlData->mpLayoutData, "Control::CreateLayoutData: should be called with non-existent layout data only!" );
+ mpControlData->mpLayoutData = new ::vcl::ControlLayoutData();
+}
+
+// -----------------------------------------------------------------------
+
+bool Control::HasLayoutData() const
+{
+ return mpControlData->mpLayoutData != NULL;
+}
+
+// -----------------------------------------------------------------------
+
+::vcl::ControlLayoutData* Control::GetLayoutData() const
+{
+ return mpControlData->mpLayoutData;
+}
+
+// -----------------------------------------------------------------------
+
void Control::SetText( const String& rStr )
{
- delete mpLayoutData;
- mpLayoutData = NULL;
+ ImplClearLayoutData();
Window::SetText( rStr );
}
@@ -142,9 +165,9 @@ Rectangle ControlLayoutData::GetCharacterBounds( long nIndex ) const
Rectangle Control::GetCharacterBounds( long nIndex ) const
{
- if( ! mpLayoutData )
+ if( !HasLayoutData() )
FillLayoutData();
- return mpLayoutData ? mpLayoutData->GetCharacterBounds( nIndex ) : Rectangle();
+ return mpControlData->mpLayoutData ? mpControlData->mpLayoutData->GetCharacterBounds( nIndex ) : Rectangle();
}
// -----------------------------------------------------------------------
@@ -167,9 +190,9 @@ long ControlLayoutData::GetIndexForPoint( const Point& rPoint ) const
long Control::GetIndexForPoint( const Point& rPoint ) const
{
- if( ! mpLayoutData )
+ if( ! HasLayoutData() )
FillLayoutData();
- return mpLayoutData ? mpLayoutData->GetIndexForPoint( rPoint ) : -1;
+ return mpControlData->mpLayoutData ? mpControlData->mpLayoutData->GetIndexForPoint( rPoint ) : -1;
}
// -----------------------------------------------------------------------
@@ -186,9 +209,9 @@ long ControlLayoutData::GetLineCount() const
long Control::GetLineCount() const
{
- if( ! mpLayoutData )
+ if( !HasLayoutData() )
FillLayoutData();
- return mpLayoutData ? mpLayoutData->GetLineCount() : 0;
+ return mpControlData->mpLayoutData ? mpControlData->mpLayoutData->GetLineCount() : 0;
}
// -----------------------------------------------------------------------
@@ -220,9 +243,9 @@ Pair ControlLayoutData::GetLineStartEnd( long nLine ) const
Pair Control::GetLineStartEnd( long nLine ) const
{
- if( ! mpLayoutData )
+ if( !HasLayoutData() )
FillLayoutData();
- return mpLayoutData ? mpLayoutData->GetLineStartEnd( nLine ) : Pair( -1, -1 );
+ return mpControlData->mpLayoutData ? mpControlData->mpLayoutData->GetLineStartEnd( nLine ) : Pair( -1, -1 );
}
// -----------------------------------------------------------------------
@@ -263,18 +286,18 @@ long ControlLayoutData::ToRelativeLineIndex( long nIndex ) const
long Control::ToRelativeLineIndex( long nIndex ) const
{
- if( ! mpLayoutData )
+ if( !HasLayoutData() )
FillLayoutData();
- return mpLayoutData ? mpLayoutData->ToRelativeLineIndex( nIndex ) : -1;
+ return mpControlData->mpLayoutData ? mpControlData->mpLayoutData->ToRelativeLineIndex( nIndex ) : -1;
}
// -----------------------------------------------------------------------
String Control::GetDisplayText() const
{
- if( ! mpLayoutData )
+ if( !HasLayoutData() )
FillLayoutData();
- return mpLayoutData ? mpLayoutData->m_aDisplayText : GetText();
+ return mpControlData->mpLayoutData ? mpControlData->mpLayoutData->m_aDisplayText : GetText();
}
// -----------------------------------------------------------------------
@@ -321,8 +344,7 @@ void Control::StateChanged( StateChangedType nStateChange )
nStateChange == STATE_CHANGE_CONTROLFONT
)
{
- delete mpLayoutData;
- mpLayoutData = NULL;
+ ImplClearLayoutData();
}
Window::StateChanged( nStateChange );
}
@@ -331,25 +353,25 @@ void Control::StateChanged( StateChangedType nStateChange )
void Control::AppendLayoutData( const Control& rSubControl ) const
{
- if( ! rSubControl.mpLayoutData )
+ if( !rSubControl.HasLayoutData() )
rSubControl.FillLayoutData();
- if( ! rSubControl.mpLayoutData || ! rSubControl.mpLayoutData->m_aDisplayText.Len() )
+ if( !rSubControl.HasLayoutData() || !rSubControl.mpControlData->mpLayoutData->m_aDisplayText.Len() )
return;
- long nCurrentIndex = mpLayoutData->m_aDisplayText.Len();
- mpLayoutData->m_aDisplayText.Append( rSubControl.mpLayoutData->m_aDisplayText );
- int nLines = rSubControl.mpLayoutData->m_aLineIndices.size();
+ long nCurrentIndex = mpControlData->mpLayoutData->m_aDisplayText.Len();
+ mpControlData->mpLayoutData->m_aDisplayText.Append( rSubControl.mpControlData->mpLayoutData->m_aDisplayText );
+ int nLines = rSubControl.mpControlData->mpLayoutData->m_aLineIndices.size();
int n;
- mpLayoutData->m_aLineIndices.push_back( nCurrentIndex );
+ mpControlData->mpLayoutData->m_aLineIndices.push_back( nCurrentIndex );
for( n = 1; n < nLines; n++ )
- mpLayoutData->m_aLineIndices.push_back( rSubControl.mpLayoutData->m_aLineIndices[n] + nCurrentIndex );
- int nRectangles = rSubControl.mpLayoutData->m_aUnicodeBoundRects.size();
+ mpControlData->mpLayoutData->m_aLineIndices.push_back( rSubControl.mpControlData->mpLayoutData->m_aLineIndices[n] + nCurrentIndex );
+ int nRectangles = rSubControl.mpControlData->mpLayoutData->m_aUnicodeBoundRects.size();
Rectangle aRel = const_cast<Control&>(rSubControl).GetWindowExtentsRelative( const_cast<Control*>(this) );
for( n = 0; n < nRectangles; n++ )
{
- Rectangle aRect = rSubControl.mpLayoutData->m_aUnicodeBoundRects[n];
+ Rectangle aRect = rSubControl.mpControlData->mpLayoutData->m_aUnicodeBoundRects[n];
aRect.Move( aRel.Left(), aRel.Top() );
- mpLayoutData->m_aUnicodeBoundRects.push_back( aRect );
+ mpControlData->mpLayoutData->m_aUnicodeBoundRects.push_back( aRect );
}
}
@@ -378,15 +400,15 @@ BOOL Control::ImplCallEventListenersAndHandler( ULONG nEvent, const Link& rHand
void Control::SetLayoutDataParent( const Control* pParent ) const
{
- if( mpLayoutData )
- mpLayoutData->m_pParent = pParent;
+ if( HasLayoutData() )
+ mpControlData->mpLayoutData->m_pParent = pParent;
}
// -----------------------------------------------------------------
void Control::ImplClearLayoutData() const
{
- delete mpLayoutData, mpLayoutData = NULL;
+ delete mpControlData->mpLayoutData, mpControlData->mpLayoutData = NULL;
}
// -----------------------------------------------------------------------
@@ -467,3 +489,102 @@ Size Control::GetOptimalSize(WindowSizeType eType) const
return Size( LONG_MAX, LONG_MAX );
}
}
+
+// -----------------------------------------------------------------
+
+void Control::SetReferenceDevice( OutputDevice* _referenceDevice )
+{
+ if ( mpControlData->mpReferenceDevice == _referenceDevice )
+ return;
+
+ mpControlData->mpReferenceDevice = _referenceDevice;
+ Invalidate();
+}
+
+// -----------------------------------------------------------------
+
+OutputDevice* Control::GetReferenceDevice() const
+{
+ return mpControlData->mpReferenceDevice;
+}
+
+// -----------------------------------------------------------------
+
+const Font& Control::GetCanonicalFont( const StyleSettings& _rStyle ) const
+{
+ return _rStyle.GetLabelFont();
+}
+
+// -----------------------------------------------------------------
+const Color& Control::GetCanonicalTextColor( const StyleSettings& _rStyle ) const
+{
+ return _rStyle.GetLabelTextColor();
+}
+
+// -----------------------------------------------------------------
+void Control::ImplInitSettings( const BOOL _bFont, const BOOL _bForeground )
+{
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+
+ if ( _bFont )
+ {
+ Font aFont( GetCanonicalFont( rStyleSettings ) );
+ if ( IsControlFont() )
+ aFont.Merge( GetControlFont() );
+ SetZoomedPointFont( aFont );
+ }
+
+ if ( _bForeground || _bFont )
+ {
+ Color aColor;
+ if ( IsControlForeground() )
+ aColor = GetControlForeground();
+ else
+ aColor = GetCanonicalTextColor( rStyleSettings );
+ SetTextColor( aColor );
+ SetTextFillColor();
+ }
+}
+
+// -----------------------------------------------------------------
+
+void Control::DrawControlText( OutputDevice& _rTargetDevice, Rectangle& _io_rRect, const XubString& _rStr,
+ USHORT _nStyle, MetricVector* _pVector, String* _pDisplayText ) const
+{
+#ifdef FS_DEBUG
+ if ( !_pVector )
+ {
+ static MetricVector aCharRects;
+ static String sDisplayText;
+ aCharRects.clear();
+ sDisplayText = String();
+ _pVector = &aCharRects;
+ _pDisplayText = &sDisplayText;
+ }
+#endif
+
+ if ( !mpControlData->mpReferenceDevice || ( mpControlData->mpReferenceDevice == &_rTargetDevice ) )
+ {
+ _io_rRect = _rTargetDevice.GetTextRect( _io_rRect, _rStr, _nStyle );
+ _rTargetDevice.DrawText( _io_rRect, _rStr, _nStyle, _pVector, _pDisplayText );
+ }
+ else
+ {
+ ControlTextRenderer aRenderer( *this, _rTargetDevice, *mpControlData->mpReferenceDevice );
+ _io_rRect = aRenderer.DrawText( _io_rRect, _rStr, _nStyle, _pVector, _pDisplayText );
+ }
+
+#ifdef FS_DEBUG
+ _rTargetDevice.Push( PUSH_LINECOLOR | PUSH_FILLCOLOR );
+ _rTargetDevice.SetLineColor( COL_LIGHTRED );
+ _rTargetDevice.SetFillColor();
+ for ( MetricVector::const_iterator cr = _pVector->begin();
+ cr != _pVector->end();
+ ++cr
+ )
+ {
+ _rTargetDevice.DrawRect( *cr );
+ }
+ _rTargetDevice.Pop();
+#endif
+}
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index 5f41a441c6a1..b654e034470f 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -47,7 +47,7 @@
#include <vcl/subedit.hxx>
#include <vcl/edit.hxx>
#include <vcl/svapp.hxx>
-#include <vcl/controllayout.hxx>
+#include <vcl/controldata.hxx>
#include <vcl/msgbox.hxx>
#include <vcl/window.h>
@@ -409,7 +409,7 @@ void Edit::ImplInitSettings( BOOL bFont, BOOL bForeground, BOOL bBackground )
if ( IsControlFont() )
aFont.Merge( GetControlFont() );
SetZoomedPointFont( aFont );
- delete mpLayoutData, mpLayoutData = NULL;
+ ImplClearLayoutData();
}
if ( bFont || bForeground )
@@ -526,8 +526,8 @@ void Edit::ImplRepaint( xub_StrLen nStart, xub_StrLen nEnd, bool bLayout )
long nPos = nStart ? pDX[2*nStart] : 0;
aPos.X() = nPos + mnXOffset + ImplGetExtraOffset();
- MetricVector* pVector = &mpLayoutData->m_aUnicodeBoundRects;
- String* pDisplayText = &mpLayoutData->m_aDisplayText;
+ MetricVector* pVector = &mpControlData->mpLayoutData->m_aUnicodeBoundRects;
+ String* pDisplayText = &mpControlData->mpLayoutData->m_aDisplayText;
DrawText( aPos, aText, nStart, nEnd - nStart, pVector, pDisplayText );
@@ -722,7 +722,7 @@ void Edit::ImplDelete( const Selection& rSelection, BYTE nDirection, BYTE nMode
((rSelection.Max() == aText.Len()) && (nDirection == EDIT_DEL_RIGHT))) )
return;
- delete mpLayoutData, mpLayoutData = NULL;
+ ImplClearLayoutData();
Selection aSelection( rSelection );
aSelection.Justify();
@@ -864,7 +864,7 @@ void Edit::ImplInsertText( const XubString& rStr, const Selection* pNewSel, sal_
rtl::OUString aNewText( ImplGetValidString( rStr ) );
ImplTruncateToMaxLen( aNewText, aSelection.Len() );
- delete mpLayoutData, mpLayoutData = NULL;
+ ImplClearLayoutData();
if ( aSelection.Len() )
maText.Erase( (xub_StrLen)aSelection.Min(), (xub_StrLen)aSelection.Len() );
@@ -1006,7 +1006,7 @@ void Edit::ImplSetText( const XubString& rText, const Selection* pNewSelection )
// wird, dann InsertText, damit flackerfrei.
if ( ( rText.Len() <= mnMaxTextLen ) && ( (rText != maText) || (pNewSelection && (*pNewSelection != maSelection)) ) )
{
- delete mpLayoutData, mpLayoutData = NULL;
+ ImplClearLayoutData();
maSelection.Min() = 0;
maSelection.Max() = maText.Len();
if ( mnXOffset || HasPaintEvent() )
@@ -1637,7 +1637,7 @@ BOOL Edit::ImplHandleKeyEvent( const KeyEvent& rKEvt )
{
if ( !rKEvt.GetKeyCode().IsMod2() )
{
- delete mpLayoutData, mpLayoutData = NULL;
+ ImplClearLayoutData();
uno::Reference < i18n::XBreakIterator > xBI = ImplGetBreakIterator();
Selection aSel( maSelection );
@@ -1858,7 +1858,7 @@ void Edit::KeyInput( const KeyEvent& rKEvt )
void Edit::FillLayoutData() const
{
- mpLayoutData = new vcl::ControlLayoutData();
+ mpControlData->mpLayoutData = new vcl::ControlLayoutData();
const_cast<Edit*>(this)->ImplRepaint( 0, STRING_LEN, true );
}
@@ -2648,7 +2648,7 @@ void Edit::ImplSetSelection( const Selection& rSelection, BOOL bPaint )
if ( aNew != maSelection )
{
- delete mpLayoutData, mpLayoutData = NULL;
+ ImplClearLayoutData();
maSelection = aNew;
if ( bPaint && ( aOld.Len() || aNew.Len() || IsPaintTransparent() ) )
diff --git a/vcl/source/control/field2.cxx b/vcl/source/control/field2.cxx
index b417774142d3..a7729f4ace24 100644
--- a/vcl/source/control/field2.cxx
+++ b/vcl/source/control/field2.cxx
@@ -55,6 +55,7 @@
#include <unotools/localedatawrapper.hxx>
#include <unotools/calendarwrapper.hxx>
#include <unotools/charclass.hxx>
+#include <unotools/misccfg.hxx>
using namespace ::com::sun::star;
@@ -1214,7 +1215,7 @@ static BOOL ImplDateProcessKeyInput( Edit*, const KeyEvent& rKEvt, ExtDateFieldF
static BOOL ImplDateGetValue( const XubString& rStr, Date& rDate, ExtDateFieldFormat eDateFormat,
const LocaleDataWrapper& rLocaleDataWrapper, const CalendarWrapper& rCalendarWrapper,
- const AllSettings& rSettings )
+ const AllSettings& )
{
USHORT nDay = 0;
USHORT nMonth = 0;
@@ -1312,7 +1313,7 @@ static BOOL ImplDateGetValue( const XubString& rStr, Date& rDate, ExtDateFieldFo
return FALSE;
Date aNewDate( nDay, nMonth, nYear );
- DateFormatter::ExpandCentury( aNewDate, rSettings.GetMiscSettings().GetTwoDigitYearStart() );
+ DateFormatter::ExpandCentury( aNewDate, utl::MiscCfg().GetYear2000() );
if ( aNewDate.IsValid() )
{
rDate = aNewDate;
@@ -1355,7 +1356,7 @@ BOOL DateFormatter::ImplDateReformat( const XubString& rStr, XubString& rOutStr,
// -----------------------------------------------------------------------
XubString DateFormatter::ImplGetDateAsText( const Date& rDate,
- const AllSettings& rSettings ) const
+ const AllSettings& ) const
{
BOOL bShowCentury = FALSE;
switch ( GetExtDateFormat() )
@@ -1379,7 +1380,7 @@ XubString DateFormatter::ImplGetDateAsText( const Date& rDate,
if ( !bShowCentury )
{
// Check if I have to use force showing the century
- USHORT nTwoDigitYearStart = rSettings.GetMiscSettings().GetTwoDigitYearStart();
+ USHORT nTwoDigitYearStart = utl::MiscCfg().GetYear2000();
USHORT nYear = rDate.GetYear();
// Wenn Jahr nicht im 2stelligen Grenzbereich liegt,
@@ -2033,7 +2034,7 @@ void DateFormatter::Reformat()
void DateFormatter::ExpandCentury( Date& rDate )
{
- ExpandCentury( rDate, Application::GetSettings().GetMiscSettings().GetTwoDigitYearStart() );
+ ExpandCentury( rDate, utl::MiscCfg().GetYear2000() );
}
// -----------------------------------------------------------------------
diff --git a/vcl/source/control/fixed.cxx b/vcl/source/control/fixed.cxx
index ecb066d107ce..3d19e288a1ce 100644
--- a/vcl/source/control/fixed.cxx
+++ b/vcl/source/control/fixed.cxx
@@ -33,7 +33,7 @@
#include <vcl/decoview.hxx>
#include <vcl/event.hxx>
#include <vcl/fixed.hxx>
-#include <vcl/controllayout.hxx>
+#include <vcl/controldata.hxx>
#include <vcl/window.h>
#include <tools/rc.h>
@@ -109,40 +109,25 @@ WinBits FixedText::ImplInitStyle( WinBits nStyle )
return nStyle;
}
+// -----------------------------------------------------------------
+
+const Font& FixedText::GetCanonicalFont( const StyleSettings& _rStyle ) const
+{
+ return ( GetStyle() & WB_INFO ) ? _rStyle.GetInfoFont() : _rStyle.GetLabelFont();
+}
+
+// -----------------------------------------------------------------
+const Color& FixedText::GetCanonicalTextColor( const StyleSettings& _rStyle ) const
+{
+ return ( GetStyle() & WB_INFO ) ? _rStyle.GetInfoTextColor() : _rStyle.GetLabelTextColor();
+}
+
// -----------------------------------------------------------------------
void FixedText::ImplInitSettings( BOOL bFont,
BOOL bForeground, BOOL bBackground )
{
- const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
-
- if ( bFont )
- {
- Font aFont;
- if ( GetStyle() & WB_INFO )
- aFont = rStyleSettings.GetInfoFont();
- else
- aFont = rStyleSettings.GetLabelFont();
- if ( IsControlFont() )
- aFont.Merge( GetControlFont() );
- SetZoomedPointFont( aFont );
- }
-
- if ( bForeground || bFont )
- {
- Color aColor;
- if ( IsControlForeground() )
- aColor = GetControlForeground();
- else
- {
- if ( GetStyle() & WB_INFO )
- aColor = rStyleSettings.GetInfoTextColor();
- else
- aColor = rStyleSettings.GetLabelTextColor();
- }
- SetTextColor( aColor );
- SetTextFillColor();
- }
+ Control::ImplInitSettings( bFont, bForeground );
if ( bBackground )
{
@@ -278,17 +263,13 @@ void FixedText::ImplDraw( OutputDevice* pDev, ULONG nDrawFlags,
nTextStyle |= TEXT_DRAW_MONO;
if( bFillLayout )
- {
- mpLayoutData->m_aDisplayText = String();
- pDev->DrawText( Rectangle( aPos, rSize ),
- aText,
- nTextStyle,
- &mpLayoutData->m_aUnicodeBoundRects,
- &mpLayoutData->m_aDisplayText
- );
- }
- else
- pDev->DrawText( Rectangle( aPos, rSize ), aText, nTextStyle );
+ mpControlData->mpLayoutData->m_aDisplayText = String();
+
+ Rectangle aRect( Rectangle( aPos, rSize ) );
+ DrawControlText( *pDev, aRect, aText, nTextStyle,
+ bFillLayout ? &mpControlData->mpLayoutData->m_aUnicodeBoundRects : NULL,
+ bFillLayout ? &mpControlData->mpLayoutData->m_aDisplayText : NULL
+ );
}
// -----------------------------------------------------------------------
@@ -446,7 +427,7 @@ Size FixedText::GetOptimalSize(WindowSizeType eType) const
void FixedText::FillLayoutData() const
{
- mpLayoutData = new vcl::ControlLayoutData();
+ mpControlData->mpLayoutData = new vcl::ControlLayoutData();
ImplDraw( const_cast<FixedText*>(this), 0, Point(), GetOutputSizePixel(), true );
}
@@ -468,31 +449,25 @@ WinBits FixedLine::ImplInitStyle( WinBits nStyle )
return nStyle;
}
+// -----------------------------------------------------------------
+
+const Font& FixedLine::GetCanonicalFont( const StyleSettings& _rStyle ) const
+{
+ return _rStyle.GetGroupFont();
+}
+
+// -----------------------------------------------------------------
+const Color& FixedLine::GetCanonicalTextColor( const StyleSettings& _rStyle ) const
+{
+ return _rStyle.GetGroupTextColor();
+}
+
// -----------------------------------------------------------------------
void FixedLine::ImplInitSettings( BOOL bFont,
BOOL bForeground, BOOL bBackground )
{
- const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
-
- if ( bFont )
- {
- Font aFont = rStyleSettings.GetGroupFont();
- if ( IsControlFont() )
- aFont.Merge( GetControlFont() );
- SetZoomedPointFont( aFont );
- }
-
- if ( bForeground || bFont )
- {
- Color aColor;
- if ( IsControlForeground() )
- aColor = GetControlForeground();
- else
- aColor = rStyleSettings.GetGroupTextColor();
- SetTextColor( aColor );
- SetTextFillColor();
- }
+ Control::ImplInitSettings( bFont, bForeground );
if ( bBackground )
{
@@ -526,8 +501,8 @@ void FixedLine::ImplDraw( bool bLayout )
String aText = GetText();
const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
WinBits nWinStyle = GetStyle();
- MetricVector* pVector = bLayout ? &mpLayoutData->m_aUnicodeBoundRects : NULL;
- String* pDisplayText = bLayout ? &mpLayoutData->m_aDisplayText : NULL;
+ MetricVector* pVector = bLayout ? &mpControlData->mpLayoutData->m_aUnicodeBoundRects : NULL;
+ String* pDisplayText = bLayout ? &mpControlData->mpLayoutData->m_aDisplayText : NULL;
if ( rStyleSettings.GetOptions() & STYLE_OPTION_MONO )
SetLineColor( Color( COL_BLACK ) );
@@ -574,8 +549,7 @@ void FixedLine::ImplDraw( bool bLayout )
if ( rStyleSettings.GetOptions() & STYLE_OPTION_MONO )
nStyle |= TEXT_DRAW_MONO;
- aRect = GetTextRect( aRect, aText, nStyle );
- DrawText( aRect, aText, nStyle, pVector, pDisplayText );
+ DrawControlText( *this, aRect, aText, nStyle, pVector, pDisplayText );
if( !pVector )
{
@@ -617,7 +591,7 @@ FixedLine::FixedLine( Window* pParent, const ResId& rResId ) :
void FixedLine::FillLayoutData() const
{
- mpLayoutData = new vcl::ControlLayoutData();
+ mpControlData->mpLayoutData = new vcl::ControlLayoutData();
const_cast<FixedLine*>(this)->ImplDraw( true );
}
diff --git a/vcl/source/control/group.cxx b/vcl/source/control/group.cxx
index a844c2f2eb93..4adc91f88d84 100644
--- a/vcl/source/control/group.cxx
+++ b/vcl/source/control/group.cxx
@@ -32,7 +32,7 @@
#include "precompiled_vcl.hxx"
#include <vcl/event.hxx>
#include <vcl/group.hxx>
-#include <vcl/controllayout.hxx>
+#include <vcl/controldata.hxx>
#ifndef _SV_RC_H
#include <tools/rc.h>
@@ -66,31 +66,25 @@ WinBits GroupBox::ImplInitStyle( WinBits nStyle )
return nStyle;
}
+// -----------------------------------------------------------------
+
+const Font& GroupBox::GetCanonicalFont( const StyleSettings& _rStyle ) const
+{
+ return _rStyle.GetGroupFont();
+}
+
+// -----------------------------------------------------------------
+const Color& GroupBox::GetCanonicalTextColor( const StyleSettings& _rStyle ) const
+{
+ return _rStyle.GetGroupTextColor();
+}
+
// -----------------------------------------------------------------------
void GroupBox::ImplInitSettings( BOOL bFont,
BOOL bForeground, BOOL bBackground )
{
- const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
-
- if ( bFont )
- {
- Font aFont = rStyleSettings.GetGroupFont();
- if ( IsControlFont() )
- aFont.Merge( GetControlFont() );
- SetZoomedPointFont( aFont );
- }
-
- if ( bForeground || bFont )
- {
- Color aColor;
- if ( IsControlForeground() )
- aColor = GetControlForeground();
- else
- aColor = rStyleSettings.GetGroupTextColor();
- SetTextColor( aColor );
- SetTextFillColor();
- }
+ Control::ImplInitSettings( bFont, bForeground );
if ( bBackground )
{
@@ -227,16 +221,16 @@ void GroupBox::ImplDraw( OutputDevice* pDev, ULONG nDrawFlags,
}
}
- MetricVector* pVector = bLayout ? &mpLayoutData->m_aUnicodeBoundRects : NULL;
- String* pDisplayText = bLayout ? &mpLayoutData->m_aDisplayText : NULL;
- pDev->DrawText( aRect, aText, nTextStyle, pVector, pDisplayText );
+ MetricVector* pVector = bLayout ? &mpControlData->mpLayoutData->m_aUnicodeBoundRects : NULL;
+ String* pDisplayText = bLayout ? &mpControlData->mpLayoutData->m_aDisplayText : NULL;
+ DrawControlText( *pDev, aRect, aText, nTextStyle, pVector, pDisplayText );
}
// -----------------------------------------------------------------------
void GroupBox::FillLayoutData() const
{
- mpLayoutData = new vcl::ControlLayoutData();
+ mpControlData->mpLayoutData = new vcl::ControlLayoutData();
const_cast<GroupBox*>(this)-> ImplDraw( const_cast<GroupBox*>(this), 0, Point(), GetOutputSizePixel(), true );
}
diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx
index c0a28c8b03fd..a915d8e6b9e8 100644
--- a/vcl/source/control/ilstbox.cxx
+++ b/vcl/source/control/ilstbox.cxx
@@ -40,7 +40,7 @@
#include <vcl/lstbox.h>
#include <vcl/ilstbox.hxx>
#include <vcl/i18nhelp.hxx>
-#include <vcl/controllayout.hxx>
+#include <vcl/controldata.hxx>
#include <vcl/unohelp.hxx>
#ifndef _COM_SUN_STAR_UTIL_XCOLLATOR_HPP_
#include <com/sun/star/i18n/XCollator.hpp>
@@ -647,7 +647,7 @@ void ImplListBoxWindow::Clear()
mnTop = 0;
mnLeft = 0;
mbImgsDiffSz = FALSE;
- delete mpLayoutData, mpLayoutData = NULL;
+ ImplClearLayoutData();
mnCurrentPos = LISTBOX_ENTRY_NOTFOUND;
@@ -656,7 +656,7 @@ void ImplListBoxWindow::Clear()
void ImplListBoxWindow::SetUserItemSize( const Size& rSz )
{
- delete mpLayoutData, mpLayoutData = NULL;
+ ImplClearLayoutData();
maUserItemSize = rSz;
ImplCalcMetrics();
}
@@ -778,7 +778,7 @@ void ImplListBoxWindow::ImplCallSelect()
nMRUCount--;
}
- delete mpLayoutData, mpLayoutData = NULL;
+ ImplClearLayoutData();
ImplEntryType* pNewEntry = new ImplEntryType( aSelected );
pNewEntry->mbIsSelected = bSelectNewEntry;
@@ -798,7 +798,7 @@ void ImplListBoxWindow::ImplCallSelect()
USHORT ImplListBoxWindow::InsertEntry( USHORT nPos, ImplEntryType* pNewEntry )
{
- delete mpLayoutData, mpLayoutData = NULL;
+ ImplClearLayoutData();
USHORT nNewPos = mpEntryList->InsertEntry( nPos, pNewEntry, mbSort );
if( (GetStyle() & WB_WORDBREAK) )
@@ -812,7 +812,7 @@ USHORT ImplListBoxWindow::InsertEntry( USHORT nPos, ImplEntryType* pNewEntry )
void ImplListBoxWindow::RemoveEntry( USHORT nPos )
{
- delete mpLayoutData, mpLayoutData = NULL;
+ ImplClearLayoutData();
mpEntryList->RemoveEntry( nPos );
if( mnCurrentPos >= mpEntryList->GetEntryCount() )
mnCurrentPos = LISTBOX_ENTRY_NOTFOUND;
@@ -1062,7 +1062,7 @@ void ImplListBoxWindow::SelectEntry( USHORT nPos, BOOL bSelect )
ImplPaint( nPos );
if ( !IsVisible( nPos ) )
{
- delete mpLayoutData, mpLayoutData = NULL;
+ ImplClearLayoutData();
USHORT nVisibleEntries = GetLastVisibleEntry()-mnTop;
if ( !nVisibleEntries || !IsReallyVisible() || ( nPos < GetTopEntry() ) )
{
@@ -1233,7 +1233,7 @@ BOOL ImplListBoxWindow::SelectEntries( USHORT nSelect, LB_EVENT_TYPE eLET, BOOL
if( HasFocus() )
ImplShowFocusRect();
}
- delete mpLayoutData, mpLayoutData = NULL;
+ ImplClearLayoutData();
}
return bSelectionChanged;
}
@@ -1838,8 +1838,8 @@ void ImplListBoxWindow::DrawEntry( USHORT nPos, BOOL bDrawImage, BOOL bDrawText,
if( bDrawText )
{
- MetricVector* pVector = bLayout ? &mpLayoutData->m_aUnicodeBoundRects : NULL;
- String* pDisplayText = bLayout ? &mpLayoutData->m_aDisplayText : NULL;
+ MetricVector* pVector = bLayout ? &mpControlData->mpLayoutData->m_aUnicodeBoundRects : NULL;
+ String* pDisplayText = bLayout ? &mpControlData->mpLayoutData->m_aDisplayText : NULL;
XubString aStr( mpEntryList->GetEntryText( nPos ) );
if ( aStr.Len() )
{
@@ -1859,7 +1859,7 @@ void ImplListBoxWindow::DrawEntry( USHORT nPos, BOOL bDrawImage, BOOL bDrawText,
}
if( bLayout )
- mpLayoutData->m_aLineIndices.push_back( mpLayoutData->m_aDisplayText.Len() );
+ mpControlData->mpLayoutData->m_aLineIndices.push_back( mpControlData->mpLayoutData->m_aDisplayText.Len() );
// pb: #106948# explicit mirroring for calc
if ( mbMirroring )
@@ -1900,7 +1900,7 @@ void ImplListBoxWindow::DrawEntry( USHORT nPos, BOOL bDrawImage, BOOL bDrawText,
void ImplListBoxWindow::FillLayoutData() const
{
- mpLayoutData = new vcl::ControlLayoutData();
+ mpControlData->mpLayoutData = new vcl::ControlLayoutData();
const_cast<ImplListBoxWindow*>(this)->
ImplDoPaint( Rectangle( Point( 0, 0 ), GetOutputSize() ), true );
}
@@ -1978,7 +1978,7 @@ void ImplListBoxWindow::Resize()
if ( bShowFocusRect )
ImplShowFocusRect();
- delete mpLayoutData, mpLayoutData = NULL;
+ ImplClearLayoutData();
}
// -----------------------------------------------------------------------
@@ -2034,7 +2034,7 @@ void ImplListBoxWindow::SetTopEntry( USHORT nTop )
if ( nTop != mnTop )
{
- delete mpLayoutData, mpLayoutData = NULL;
+ ImplClearLayoutData();
long nDiff = mpEntryList->GetAddedHeight( mnTop, nTop, 0 );
Update();
ImplHideFocusRect();
@@ -2078,7 +2078,7 @@ void ImplListBoxWindow::ScrollHorz( long n )
if ( nDiff )
{
- delete mpLayoutData, mpLayoutData = NULL;
+ ImplClearLayoutData();
mnLeft = sal::static_int_cast<USHORT>(mnLeft + nDiff);
Update();
ImplHideFocusRect();
@@ -2148,7 +2148,7 @@ void ImplListBoxWindow::StateChanged( StateChangedType nType )
ImplInitSettings( FALSE, FALSE, TRUE );
Invalidate();
}
- delete mpLayoutData, mpLayoutData = NULL;
+ ImplClearLayoutData();
}
// -----------------------------------------------------------------------
@@ -2162,7 +2162,7 @@ void ImplListBoxWindow::DataChanged( const DataChangedEvent& rDCEvt )
((rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
(rDCEvt.GetFlags() & SETTINGS_STYLE)) )
{
- delete mpLayoutData, mpLayoutData = NULL;
+ ImplClearLayoutData();
ImplInitSettings( TRUE, TRUE, TRUE );
ImplCalcMetrics();
Invalidate();
@@ -2743,7 +2743,7 @@ void ImplWin::MouseButtonDown( const MouseEvent& )
void ImplWin::FillLayoutData() const
{
- mpLayoutData = new vcl::ControlLayoutData();
+ mpControlData->mpLayoutData = new vcl::ControlLayoutData();
const_cast<ImplWin*>(this)->ImplDraw( true );
}
@@ -2936,8 +2936,8 @@ void ImplWin::DrawEntry( BOOL bDrawImage, BOOL bDrawText, BOOL bDrawTextAtImageP
aTextRect.Left() += nMaxWidth + IMG_TXT_DISTANCE;
}
- MetricVector* pVector = bLayout ? &mpLayoutData->m_aUnicodeBoundRects : NULL;
- String* pDisplayText = bLayout ? &mpLayoutData->m_aDisplayText : NULL;
+ MetricVector* pVector = bLayout ? &mpControlData->mpLayoutData->m_aUnicodeBoundRects : NULL;
+ String* pDisplayText = bLayout ? &mpControlData->mpLayoutData->m_aDisplayText : NULL;
DrawText( aTextRect, maString, nTextStyle, pVector, pDisplayText );
}
diff --git a/vcl/source/control/lstbox.cxx b/vcl/source/control/lstbox.cxx
index a4d3cbc22544..ceabbe4ab166 100644
--- a/vcl/source/control/lstbox.cxx
+++ b/vcl/source/control/lstbox.cxx
@@ -43,7 +43,7 @@
#include "vcl/ilstbox.hxx"
#include "vcl/lstbox.hxx"
#include "vcl/combobox.hxx"
-#include "vcl/controllayout.hxx"
+#include "vcl/controldata.hxx"
#include "tools/debug.hxx"
@@ -719,7 +719,7 @@ void ListBox::Resize()
void ListBox::FillLayoutData() const
{
- mpLayoutData = new vcl::ControlLayoutData();
+ mpControlData->mpLayoutData = new vcl::ControlLayoutData();
const Control* pMainWin = mpImplLB->GetMainWindow();
if( mpFloatWin )
{
@@ -743,7 +743,7 @@ void ListBox::FillLayoutData() const
long ListBox::GetIndexForPoint( const Point& rPoint, USHORT& rPos ) const
{
- if( ! mpLayoutData )
+ if( !HasLayoutData() )
FillLayoutData();
// check whether rPoint fits at all
diff --git a/vcl/source/control/spinfld.cxx b/vcl/source/control/spinfld.cxx
index 0d656da40ba7..1cdaa39298df 100644
--- a/vcl/source/control/spinfld.cxx
+++ b/vcl/source/control/spinfld.cxx
@@ -36,7 +36,7 @@
#include "vcl/decoview.hxx"
#include "vcl/spin.h"
#include "vcl/spinfld.hxx"
-#include "vcl/controllayout.hxx"
+#include "vcl/controldata.hxx"
#include "vcl/svdata.hxx"
// =======================================================================
@@ -637,7 +637,7 @@ void SpinField::FillLayoutData() const
{
if( mbSpin )
{
- mpLayoutData = new vcl::ControlLayoutData();
+ mpControlData->mpLayoutData = new vcl::ControlLayoutData();
AppendLayoutData( *GetSubEdit() );
GetSubEdit()->SetLayoutDataParent( this );
}
diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx
index 561d550b1168..9a34629ddf8e 100644
--- a/vcl/source/control/tabctrl.cxx
+++ b/vcl/source/control/tabctrl.cxx
@@ -45,7 +45,7 @@
#include <vcl/button.hxx>
#include <vcl/tabpage.hxx>
#include <vcl/tabctrl.hxx>
-#include <vcl/controllayout.hxx>
+#include <vcl/controldata.hxx>
#include <vcl/sound.hxx>
#include <vcl/window.h>
@@ -169,31 +169,25 @@ void TabControl::ImplInit( Window* pParent, WinBits nStyle )
EnableChildTransparentMode( TRUE );
}
+// -----------------------------------------------------------------
+
+const Font& TabControl::GetCanonicalFont( const StyleSettings& _rStyle ) const
+{
+ return _rStyle.GetAppFont();
+}
+
+// -----------------------------------------------------------------
+const Color& TabControl::GetCanonicalTextColor( const StyleSettings& _rStyle ) const
+{
+ return _rStyle.GetButtonTextColor();
+}
+
// -----------------------------------------------------------------------
void TabControl::ImplInitSettings( BOOL bFont,
BOOL bForeground, BOOL bBackground )
{
- const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
-
- if ( bFont )
- {
- Font aFont = rStyleSettings.GetAppFont();
- if ( IsControlFont() )
- aFont.Merge( GetControlFont() );
- SetZoomedPointFont( aFont );
- }
-
- if ( bForeground || bFont )
- {
- Color aColor;
- if ( IsControlForeground() )
- aColor = GetControlForeground();
- else
- aColor = rStyleSettings.GetButtonTextColor();
- SetTextColor( aColor );
- SetTextFillColor();
- }
+ Control::ImplInitSettings( bFont, bForeground );
if ( bBackground )
{
@@ -232,9 +226,9 @@ void TabControl::ImplInitSettings( BOOL bFont,
void TabControl::ImplFreeLayoutData()
{
- if( mpLayoutData )
+ if( HasLayoutData() )
{
- delete mpLayoutData, mpLayoutData = NULL;
+ ImplClearLayoutData();
mpTabCtrlData->maLayoutPageIdToLine.clear();
mpTabCtrlData->maLayoutLineToPageId.clear();
}
@@ -864,9 +858,9 @@ void TabControl::ImplDrawItem( ImplTabItem* pItem, const Rectangle& rCurRect, bo
if( bLayout )
{
- if( ! mpLayoutData )
+ if( !HasLayoutData() )
{
- mpLayoutData = new vcl::ControlLayoutData();
+ mpControlData->mpLayoutData = new vcl::ControlLayoutData();
mpTabCtrlData->maLayoutLineToPageId.clear();
mpTabCtrlData->maLayoutPageIdToLine.clear();
mpTabCtrlData->maTabRectangles.clear();
@@ -1010,8 +1004,8 @@ void TabControl::ImplDrawItem( ImplTabItem* pItem, const Rectangle& rCurRect, bo
if( bLayout )
{
- int nLine = mpLayoutData->m_aLineIndices.size();
- mpLayoutData->m_aLineIndices.push_back( mpLayoutData->m_aDisplayText.Len() );
+ int nLine = mpControlData->mpLayoutData->m_aLineIndices.size();
+ mpControlData->mpLayoutData->m_aLineIndices.push_back( mpControlData->mpLayoutData->m_aDisplayText.Len() );
mpTabCtrlData->maLayoutPageIdToLine[ (int)pItem->mnId ] = nLine;
mpTabCtrlData->maLayoutLineToPageId[ nLine ] = (int)pItem->mnId;
mpTabCtrlData->maTabRectangles.push_back( aRect );
@@ -1044,8 +1038,8 @@ void TabControl::ImplDrawItem( ImplTabItem* pItem, const Rectangle& rCurRect, bo
DrawCtrlText( Point( nXPos + aImageSize.Width(), nYPos ),
pItem->maFormatText,
0, STRING_LEN, nStyle,
- bLayout ? &mpLayoutData->m_aUnicodeBoundRects : NULL,
- bLayout ? &mpLayoutData->m_aDisplayText : NULL
+ bLayout ? &mpControlData->mpLayoutData->m_aUnicodeBoundRects : NULL,
+ bLayout ? &mpControlData->mpLayoutData->m_aDisplayText : NULL
);
}
@@ -2108,17 +2102,17 @@ Rectangle TabControl::GetCharacterBounds( USHORT nPageId, long nIndex ) const
{
Rectangle aRet;
- if( ! mpLayoutData || ! mpTabCtrlData->maLayoutPageIdToLine.size() )
+ if( !HasLayoutData() || ! mpTabCtrlData->maLayoutPageIdToLine.size() )
FillLayoutData();
- if( mpLayoutData )
+ if( HasLayoutData() )
{
std::hash_map< int, int >::const_iterator it = mpTabCtrlData->maLayoutPageIdToLine.find( (int)nPageId );
if( it != mpTabCtrlData->maLayoutPageIdToLine.end() )
{
- Pair aPair = mpLayoutData->GetLineStartEnd( it->second );
+ Pair aPair = mpControlData->mpLayoutData->GetLineStartEnd( it->second );
if( (aPair.B() - aPair.A()) >= nIndex )
- aRet = mpLayoutData->GetCharacterBounds( aPair.A() + nIndex );
+ aRet = mpControlData->mpLayoutData->GetCharacterBounds( aPair.A() + nIndex );
}
}
@@ -2131,20 +2125,20 @@ long TabControl::GetIndexForPoint( const Point& rPoint, USHORT& rPageId ) const
{
long nRet = -1;
- if( ! mpLayoutData || ! mpTabCtrlData->maLayoutPageIdToLine.size() )
+ if( !HasLayoutData() || ! mpTabCtrlData->maLayoutPageIdToLine.size() )
FillLayoutData();
- if( mpLayoutData )
+ if( HasLayoutData() )
{
- int nIndex = mpLayoutData->GetIndexForPoint( rPoint );
+ int nIndex = mpControlData->mpLayoutData->GetIndexForPoint( rPoint );
if( nIndex != -1 )
{
// what line (->pageid) is this index in ?
- int nLines = mpLayoutData->GetLineCount();
+ int nLines = mpControlData->mpLayoutData->GetLineCount();
int nLine = -1;
while( ++nLine < nLines )
{
- Pair aPair = mpLayoutData->GetLineStartEnd( nLine );
+ Pair aPair = mpControlData->mpLayoutData->GetLineStartEnd( nLine );
if( aPair.A() <= nIndex && aPair.B() >= nIndex )
{
nRet = nIndex - aPair.A();
@@ -2173,10 +2167,10 @@ Rectangle TabControl::GetTabPageBounds( USHORT nPage ) const
{
Rectangle aRet;
- if( ! mpLayoutData || ! mpTabCtrlData->maLayoutPageIdToLine.size() )
+ if( !HasLayoutData() || ! mpTabCtrlData->maLayoutPageIdToLine.size() )
FillLayoutData();
- if( mpLayoutData )
+ if( HasLayoutData() )
{
std::hash_map< int, int >::const_iterator it = mpTabCtrlData->maLayoutPageIdToLine.find( (int)nPage );
if( it != mpTabCtrlData->maLayoutPageIdToLine.end() )
diff --git a/vcl/source/fontsubset/cff.cxx b/vcl/source/fontsubset/cff.cxx
index e5d83dc0733a..dd198ff521db 100644
--- a/vcl/source/fontsubset/cff.cxx
+++ b/vcl/source/fontsubset/cff.cxx
@@ -332,12 +332,13 @@ struct CffLocal
int mnLocalSubrBase;
int mnLocalSubrCount;
int mnLocalSubrBias;
- int mnNominalWidth;
- int mnDefaultWidth;
+
+ ValType maNominalWidth;
+ ValType maDefaultWidth;
// ATM hinting related values
- int mnStemStdHW;
- int mnStemStdVW;
+ ValType maStemStdHW;
+ ValType maStemStdVW;
ValVector maStemSnapH;
ValVector maStemSnapV;
ValVector maBlueValues;
@@ -461,10 +462,10 @@ public: // TODO: is public really needed?
void getHintPair( int nIndex, ValType* nMin, ValType* nEnd) const;
// accessing other charstring specifics
- bool hasCharWidth( void) const { return (mnCharWidth != -1);}
- int getCharWidth( void) const { return mnCharWidth;}
- void setNominalWidth( int nWidth) { mpCffLocal->mnNominalWidth = nWidth;}
- void setDefaultWidth( int nWidth) { mpCffLocal->mnDefaultWidth = nWidth;}
+ bool hasCharWidth( void) const { return (maCharWidth > 0);}
+ ValType getCharWidth( void) const { return maCharWidth;}
+ void setNominalWidth( ValType aWidth) { mpCffLocal->maNominalWidth = aWidth;}
+ void setDefaultWidth( ValType aWidth) { mpCffLocal->maDefaultWidth = aWidth;}
void updateWidth( bool bUseFirstVal);
private:
@@ -477,7 +478,7 @@ private:
int mnHorzHintSize;
ValType mnHintStack[ NMAXHINTS];
- int mnCharWidth;
+ ValType maCharWidth;
};
// --------------------------------------------------------------------
@@ -488,7 +489,7 @@ CffSubsetterContext::CffSubsetterContext( const U8* pBasePtr, int nBaseLen)
, mnStackIdx(0)
, mnHintSize(0)
, mnHorzHintSize(0)
-, mnCharWidth(-1)
+, maCharWidth(-1)
{
// setCharStringType( 1);
// TODO: new CffLocal[ mnFDAryCount];
@@ -542,13 +543,13 @@ inline void CffSubsetterContext::updateWidth( bool bUseFirstVal)
return;
#endif
if( bUseFirstVal) {
- mnCharWidth = static_cast<int>(mpCffLocal->mnNominalWidth + mnValStack[0]);
+ maCharWidth = mpCffLocal->maNominalWidth + mnValStack[0];
// remove bottom stack entry
--mnStackIdx;
for( int i = 0; i < mnStackIdx; ++i)
mnValStack[ i] = mnValStack[ i+1];
} else {
- mnCharWidth = mpCffLocal->mnDefaultWidth;
+ maCharWidth = mpCffLocal->maDefaultWidth;
}
}
@@ -615,7 +616,7 @@ void CffSubsetterContext::readCharString( const U8* pTypeOps, int nTypeLen)
mnStackIdx = 0;
mnHintSize = 0;
mnHorzHintSize = 0;
- mnCharWidth = -1;
+ maCharWidth = -1;
assert( nTypeLen >= 0);
// assert( nEnd <= getLength());
@@ -659,14 +660,14 @@ void CffSubsetterContext::readDictOp( void)
nVal = popVal();
nInt = static_cast<int>(nVal);
switch( nOpId) {
- case 10: mpCffLocal->mnStemStdHW = nInt; break; // "StdHW"
- case 11: mpCffLocal->mnStemStdVW = nInt; break; // "StdVW"
+ case 10: mpCffLocal->maStemStdHW = nVal; break; // "StdHW"
+ case 11: mpCffLocal->maStemStdVW = nVal; break; // "StdVW"
case 15: mnCharsetBase = nInt; break; // "charset"
case 16: mnEncodingBase = nInt; break; // "nEncoding"
case 17: mnCharStrBase = nInt; break; // "nCharStrings"
case 19: mpCffLocal->mnLocalSubrOffs = nInt; break;// "nSubrs"
- case 20: setDefaultWidth( nInt ); break; // "defaultWidthX"
- case 21: setNominalWidth( nInt ); break; // "nominalWidthX"
+ case 20: setDefaultWidth( nVal ); break; // "defaultWidthX"
+ case 21: setNominalWidth( nVal ); break; // "nominalWidthX"
case 909: mpCffLocal->mfBlueScale = nVal; break; // "BlueScale"
case 910: mpCffLocal->mfBlueShift = nVal; break; // "BlueShift"
case 911: mpCffLocal->mfBlueFuzz = nVal; break; // "BlueFuzz"
@@ -1477,7 +1478,7 @@ int CffSubsetterContext::convert2Type1Ops( CffLocal* pCffLocal, const U8* const
mbSawError = false;
mbNeedClose = false;
mbIgnoreHints = false;
-mnHintSize=mnHorzHintSize=mnStackIdx=0; mnCharWidth=-1;//#######
+mnHintSize=mnHorzHintSize=mnStackIdx=0; maCharWidth=-1;//#######
mnCntrMask = 0;
while( mpReadPtr < mpReadEnd)
convertOneTypeOp();
@@ -1673,10 +1674,10 @@ CffLocal::CffLocal( void)
, mnLocalSubrBase( 0)
, mnLocalSubrCount( 0)
, mnLocalSubrBias( 0)
-, mnNominalWidth( 0)
-, mnDefaultWidth( 0)
-, mnStemStdHW( 0)
-, mnStemStdVW( 0)
+, maNominalWidth( 0)
+, maDefaultWidth( 0)
+, maStemStdHW( 0)
+, maStemStdVW( 0)
, mfBlueScale( 0.0)
, mfBlueShift( 0.0)
, mfBlueFuzz( 0.0)
@@ -2296,8 +2297,8 @@ bool CffSubsetterContext::emitAsType1( Type1Emitter& rEmitter,
nPrivEntryCount += (mpCffLocal->mfBlueShift != 0.0);
nPrivEntryCount += (mpCffLocal->mfBlueFuzz != 0.0);
// emit stem hints only if non-default values
- nPrivEntryCount += (mpCffLocal->mnStemStdHW != 0);
- nPrivEntryCount += (mpCffLocal->mnStemStdVW != 0);
+ nPrivEntryCount += (mpCffLocal->maStemStdHW != 0);
+ nPrivEntryCount += (mpCffLocal->maStemStdVW != 0);
nPrivEntryCount += !mpCffLocal->maStemSnapH.empty();
nPrivEntryCount += !mpCffLocal->maStemSnapV.empty();
// emit other hints only if non-default values
@@ -2337,10 +2338,10 @@ bool CffSubsetterContext::emitAsType1( Type1Emitter& rEmitter,
pOut += sprintf( pOut, "/BlueFuzz %.1f def\n", mpCffLocal->mfBlueFuzz);
// emit stem hint related privdict entries
- if( mpCffLocal->mnStemStdHW)
- pOut += sprintf( pOut, "/StdHW [%d] def\n", mpCffLocal->mnStemStdHW);
- if( mpCffLocal->mnStemStdVW)
- pOut += sprintf( pOut, "/StdVW [%d] def\n", mpCffLocal->mnStemStdVW);
+ if( mpCffLocal->maStemStdHW)
+ pOut += sprintf( pOut, "/StdHW [%g] def\n", mpCffLocal->maStemStdHW);
+ if( mpCffLocal->maStemStdVW)
+ pOut += sprintf( pOut, "/StdVW [%g] def\n", mpCffLocal->maStemStdVW);
rEmitter.emitValVector( "/StemSnapH [", "]ND\n", mpCffLocal->maStemSnapH);
rEmitter.emitValVector( "/StemSnapV [", "]ND\n", mpCffLocal->maStemSnapV);
@@ -2413,8 +2414,12 @@ bool CffSubsetterContext::emitAsType1( Type1Emitter& rEmitter,
pOut += sprintf( pOut, " ND\n");
rEmitter.emitAllCrypted();
// provide individual glyphwidths if requested
- if( pGlyphWidths )
- pGlyphWidths[i] = getCharWidth();
+ if( pGlyphWidths ) {
+ ValType aCharWidth = getCharWidth();
+ if( maFontMatrix.size() >= 4)
+ aCharWidth *= 1000.0F * maFontMatrix[0];
+ pGlyphWidths[i] = static_cast<GlyphWidth>(aCharWidth);
+ }
}
pOut += sprintf( pOut, "end end\nreadonly put\nput\n");
pOut += sprintf( pOut, "dup/FontName get exch definefont pop\n");
@@ -2446,8 +2451,17 @@ bool CffSubsetterContext::emitAsType1( Type1Emitter& rEmitter,
// provide details to the subset requesters, TODO: move into own method?
// note: Top and Bottom are flipped between Type1 and VCL
- rFSInfo.m_aFontBBox = Rectangle( Point( static_cast<long>(maFontBBox[0]), static_cast<long>(maFontBBox[1]) ),
- Point( static_cast<long>(maFontBBox[2]), static_cast<long>(maFontBBox[3]) ) );
+ // note: the rest of VCL expects the details below to be scaled like for an emUnits==1000 font
+ ValType fXFactor = 1.0;
+ ValType fYFactor = 1.0;
+ if( maFontMatrix.size() >= 4) {
+ fXFactor = 1000.0F * maFontMatrix[0];
+ fYFactor = 1000.0F * maFontMatrix[3];
+ }
+ rFSInfo.m_aFontBBox = Rectangle( Point( static_cast<long>(maFontBBox[0] * fXFactor),
+ static_cast<long>(maFontBBox[1] * fYFactor) ),
+ Point( static_cast<long>(maFontBBox[2] * fXFactor),
+ static_cast<long>(maFontBBox[3] * fYFactor) ) );
// PDF-Spec says the values below mean the ink bounds!
// TODO: use better approximations for these ink bounds
rFSInfo.m_nAscent = +rFSInfo.m_aFontBBox.Bottom(); // for capital letters
diff --git a/vcl/source/fontsubset/gsub.cxx b/vcl/source/fontsubset/gsub.cxx
index 9715e7fc8585..600c03194210 100644
--- a/vcl/source/fontsubset/gsub.cxx
+++ b/vcl/source/fontsubset/gsub.cxx
@@ -32,6 +32,8 @@
#include "gsub.h"
+#include <osl/diagnose.h>
+
#include <vector>
#include <map>
#include <algorithm>
@@ -280,9 +282,11 @@ int ReadGSUB( struct _TrueTypeFont* pTTFile,
{
const USHORT nGlyph0 = NEXT_UShort( pCoverage );
const USHORT nGlyph1 = NEXT_UShort( pCoverage );
- const USHORT nCovIdx = NEXT_UShort( pCoverage );
+ const USHORT nStartCoverageIndex = NEXT_UShort( pCoverage );
+ OSL_ENSURE( aSubstVector.size() == nStartCoverageIndex, "coverage index mismatch");
+ (void)nStartCoverageIndex;
for( USHORT j = nGlyph0; j <= nGlyph1; ++j )
- aSubstVector.push_back( GlyphSubst( j + nCovIdx, 0 ) );
+ aSubstVector.push_back( GlyphSubst( j, 0 ) );
}
}
break;
diff --git a/vcl/source/gdi/base14.cxx b/vcl/source/gdi/base14.cxx
index 17e616d196b4..56d1c3ff5eba 100644
--- a/vcl/source/gdi/base14.cxx
+++ b/vcl/source/gdi/base14.cxx
@@ -601,7 +601,7 @@ const PDFWriterImpl::BuiltinFont PDFWriterImpl::m_aBuiltinFonts[ 14 ] = {
"Symbol", // PSName
1010, -293, // ascend, descend
FAMILY_DONTKNOW, // family style
- RTL_TEXTENCODING_SYMBOL, // charset
+ RTL_TEXTENCODING_ADOBE_SYMBOL, // charset
PITCH_VARIABLE, // pitch
WIDTH_NORMAL, // width type
WEIGHT_NORMAL, // weight type
diff --git a/vcl/source/gdi/bitmapex.cxx b/vcl/source/gdi/bitmapex.cxx
index cfcac8851089..4e2ed20a7966 100644
--- a/vcl/source/gdi/bitmapex.cxx
+++ b/vcl/source/gdi/bitmapex.cxx
@@ -47,6 +47,7 @@
#include <tools/rc.h>
#endif
#include <vcl/svapp.hxx>
+#include <vcl/bmpacc.hxx>
// ------------
// - BitmapEx -
@@ -761,6 +762,78 @@ void BitmapEx::Draw( OutputDevice* pOutDev,
// ------------------------------------------------------------------
+sal_uInt8 BitmapEx::GetTransparency(sal_Int32 nX, sal_Int32 nY) const
+{
+ sal_uInt8 nTransparency(0xff);
+
+ if(!aBitmap.IsEmpty())
+ {
+ if(nX >= 0 && nX < aBitmapSize.Width() && nY >= 0 && nY < aBitmapSize.Height())
+ {
+ switch(eTransparent)
+ {
+ case TRANSPARENT_NONE:
+ {
+ // not transparent, ergo all covered
+ nTransparency = 0x00;
+ break;
+ }
+ case TRANSPARENT_COLOR:
+ {
+ Bitmap aTestBitmap(aBitmap);
+ BitmapReadAccess* pRead = aTestBitmap.AcquireReadAccess();
+
+ if(pRead)
+ {
+ const Color aColor = pRead->GetColor(nY, nX);
+
+ // if color is not equal to TransparentColor, we are not transparent
+ if(aColor != aTransparentColor)
+ {
+ nTransparency = 0x00;
+ }
+
+ aTestBitmap.ReleaseAccess(pRead);
+ }
+ break;
+ }
+ case TRANSPARENT_BITMAP:
+ {
+ if(!aMask.IsEmpty())
+ {
+ Bitmap aTestBitmap(aMask);
+ BitmapReadAccess* pRead = aTestBitmap.AcquireReadAccess();
+
+ if(pRead)
+ {
+ const BitmapColor aBitmapColor(pRead->GetPixel(nY, nX));
+
+ if(bAlpha)
+ {
+ nTransparency = aBitmapColor.GetIndex();
+ }
+ else
+ {
+ if(0x00 != aBitmapColor.GetIndex())
+ {
+ nTransparency = 0x00;
+ }
+ }
+
+ aTestBitmap.ReleaseAccess(pRead);
+ }
+ }
+ break;
+ }
+ }
+ }
+ }
+
+ return nTransparency;
+}
+
+// ------------------------------------------------------------------
+
SvStream& operator<<( SvStream& rOStm, const BitmapEx& rBitmapEx )
{
rBitmapEx.aBitmap.Write( rOStm );
diff --git a/vcl/source/gdi/configsettings.cxx b/vcl/source/gdi/configsettings.cxx
new file mode 100644
index 000000000000..b601caef301a
--- /dev/null
+++ b/vcl/source/gdi/configsettings.cxx
@@ -0,0 +1,205 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_vcl.hxx"
+
+#include <vcl/configsettings.hxx>
+#include <vcl/svdata.hxx>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/beans/PropertyValue.hpp>
+
+using namespace rtl;
+using namespace utl;
+using namespace vcl;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::beans;
+using namespace com::sun::star::container;
+
+#define SETTINGS_CONFIGNODE "VCL/Settings"
+
+/*
+ * SettingsConfigItem::get
+ */
+
+SettingsConfigItem* SettingsConfigItem::get()
+{
+ ImplSVData* pSVData = ImplGetSVData();
+ if( ! pSVData->mpSettingsConfigItem )
+ pSVData->mpSettingsConfigItem = new SettingsConfigItem();
+ return pSVData->mpSettingsConfigItem;
+}
+
+/*
+ * SettignsConfigItem constructor
+ */
+
+SettingsConfigItem::SettingsConfigItem()
+ :
+ ConfigItem( OUString( RTL_CONSTASCII_USTRINGPARAM( SETTINGS_CONFIGNODE ) ),
+ CONFIG_MODE_DELAYED_UPDATE ),
+ m_aSettings( 0 )
+{
+ getValues();
+}
+
+/*
+ * SettingsConfigItem destructor
+ */
+
+SettingsConfigItem::~SettingsConfigItem()
+{
+ if( IsModified() )
+ Commit();
+}
+
+/*
+ * SettingsConfigItem::Commit
+ */
+
+void SettingsConfigItem::Commit()
+{
+ if( ! IsValidConfigMgr() )
+ return;
+
+ std::hash_map< OUString, SmallOUStrMap, rtl::OUStringHash >::const_iterator group;
+
+ for( group = m_aSettings.begin(); group != m_aSettings.end(); ++group )
+ {
+ String aKeyName( group->first );
+ /*sal_Bool bAdded =*/ AddNode( OUString(), aKeyName );
+ Sequence< PropertyValue > aValues( group->second.size() );
+ PropertyValue* pValues = aValues.getArray();
+ int nIndex = 0;
+ SmallOUStrMap::const_iterator it;
+ for( it = group->second.begin(); it != group->second.end(); ++it )
+ {
+ String aName( aKeyName );
+ aName.Append( '/' );
+ aName.Append( String( it->first ) );
+ pValues[nIndex].Name = aName;
+ pValues[nIndex].Handle = 0;
+ pValues[nIndex].Value <<= it->second;
+ pValues[nIndex].State = PropertyState_DIRECT_VALUE;
+ nIndex++;
+ }
+ ReplaceSetProperties( aKeyName, aValues );
+ }
+}
+
+/*
+ * SettingsConfigItem::Notify
+ */
+
+void SettingsConfigItem::Notify( const Sequence< OUString >& )
+{
+ getValues();
+}
+
+/*
+ * SettingsConfigItem::getValues
+ */
+void SettingsConfigItem::getValues()
+{
+ if( ! IsValidConfigMgr() )
+ return;
+
+ m_aSettings.clear();
+
+ Sequence< OUString > aNames( GetNodeNames( OUString() ) );
+ m_aSettings.resize( aNames.getLength() );
+
+ for( int j = 0; j < aNames.getLength(); j++ )
+ {
+#if OSL_DEBUG_LEVEL > 2
+ fprintf( stderr, "found settings data for \"%s\"\n",
+ OUStringToOString( aNames.getConstArray()[j], RTL_TEXTENCODING_ASCII_US ).getStr()
+ );
+#endif
+ String aKeyName( aNames.getConstArray()[j] );
+ Sequence< OUString > aKeys( GetNodeNames( aKeyName ) );
+ Sequence< OUString > aSettingsKeys( aKeys.getLength() );
+ const OUString* pFrom = aKeys.getConstArray();
+ OUString* pTo = aSettingsKeys.getArray();
+ for( int m = 0; m < aKeys.getLength(); m++ )
+ {
+ String aName( aKeyName );
+ aName.Append( '/' );
+ aName.Append( String( pFrom[m] ) );
+ pTo[m] = aName;
+ }
+ Sequence< Any > aValues( GetProperties( aSettingsKeys ) );
+ const Any* pValue = aValues.getConstArray();
+ for( int i = 0; i < aValues.getLength(); i++, pValue++ )
+ {
+ if( pValue->getValueTypeClass() == TypeClass_STRING )
+ {
+ const OUString* pLine = (const OUString*)pValue->getValue();
+ if( pLine->getLength() )
+ m_aSettings[ aKeyName ][ pFrom[i] ] = *pLine;
+#if OSL_DEBUG_LEVEL > 2
+ fprintf( stderr, " \"%s\"=\"%.30s\"\n",
+ OUStringToOString( aKeys.getConstArray()[i], RTL_TEXTENCODING_ASCII_US ).getStr(),
+ OUStringToOString( *pLine, RTL_TEXTENCODING_ASCII_US ).getStr()
+ );
+#endif
+ }
+ }
+ }
+}
+
+/*
+ * SettingsConfigItem::getDefaultFont
+ */
+
+const OUString& SettingsConfigItem::getValue( const OUString& rGroup, const OUString& rKey ) const
+{
+ ::std::hash_map< OUString, SmallOUStrMap, rtl::OUStringHash >::const_iterator group = m_aSettings.find( rGroup );
+ if( group == m_aSettings.end() || group->second.find( rKey ) == group->second.end() )
+ {
+ static OUString aEmpty;
+ return aEmpty;
+ }
+ return group->second.find(rKey)->second;
+}
+
+/*
+ * SettingsConfigItem::setDefaultFont
+ */
+
+void SettingsConfigItem::setValue( const OUString& rGroup, const OUString& rKey, const OUString& rValue )
+{
+ bool bModified = m_aSettings[ rGroup ][ rKey ] != rValue;
+ if( bModified )
+ {
+ m_aSettings[ rGroup ][ rKey ] = rValue;
+ SetModified();
+ }
+}
+
diff --git a/vcl/source/gdi/cvtsvm.cxx b/vcl/source/gdi/cvtsvm.cxx
index c1c02b673658..8c4b6f1a2cb2 100644
--- a/vcl/source/gdi/cvtsvm.cxx
+++ b/vcl/source/gdi/cvtsvm.cxx
@@ -88,18 +88,6 @@ void ImplReadPoly( SvStream& rIStm, Polygon& rPoly )
// ------------------------------------------------------------------------
-void ImplWritePoly( SvStream& rOStm, const Polygon& rPoly )
-{
- INT32 nSize = rPoly.GetSize();
-
- rOStm << nSize;
-
- for( INT32 i = 0; i < nSize; i++ )
- rOStm << rPoly[ (USHORT) i ];
-}
-
-// ------------------------------------------------------------------------
-
void ImplReadPolyPoly( SvStream& rIStm, PolyPolygon& rPolyPoly )
{
Polygon aPoly;
@@ -131,13 +119,17 @@ void ImplWritePolyPolyAction( SvStream& rOStm, const PolyPolygon& rPolyPoly )
for( n = 0; n < nPoly; n++ )
{
- const Polygon& rPoly = rPolyPoly[ n ];
- const USHORT nSize = rPoly.GetSize();
+ // #i102224# Here the evtl. curved nature of Polygon was
+ // ignored (for all those Years). Adapted to at least write
+ // a polygon representing the curve as good as possible
+ Polygon aSimplePoly;
+ rPolyPoly[n].AdaptiveSubdivide(aSimplePoly);
+ const USHORT nSize(aSimplePoly.GetSize());
rOStm << (INT32) nSize;
for( USHORT j = 0; j < nSize; j++ )
- rOStm << rPoly[ j ];
+ rOStm << aSimplePoly[ j ];
}
}
@@ -378,6 +370,128 @@ void ImplSkipActions( SvStream& rIStm, ULONG nSkipCount )
}
}
+// ------------------------------------------------------------------------
+
+bool ImplWriteExtendedPolyPolygonAction(SvStream& rOStm, const PolyPolygon& rPolyPolygon, bool bOnlyWhenCurve)
+{
+ const sal_uInt16 nPolygonCount(rPolyPolygon.Count());
+
+ if(nPolygonCount)
+ {
+ sal_uInt32 nAllPolygonCount(0);
+ sal_uInt32 nAllPointCount(0);
+ sal_uInt32 nAllFlagCount(0);
+ sal_uInt16 a(0);
+
+ for(a = 0; a < nPolygonCount; a++)
+ {
+ const Polygon& rCandidate = rPolyPolygon.GetObject(a);
+ const sal_uInt16 nPointCount(rCandidate.GetSize());
+
+ if(nPointCount)
+ {
+ nAllPolygonCount++;
+ nAllPointCount += nPointCount;
+
+ if(rCandidate.HasFlags())
+ {
+ nAllFlagCount += nPointCount;
+ }
+ }
+ }
+
+ if((bOnlyWhenCurve && nAllFlagCount) || (!bOnlyWhenCurve && nAllPointCount))
+ {
+ rOStm << (INT16) GDI_EXTENDEDPOLYGON_ACTION;
+
+ const sal_Int32 nActionSize(
+ 4 + // Action size
+ 2 + // PolygonCount
+ (nAllPolygonCount * 2) + // Points per polygon
+ (nAllPointCount << 3) + // Points themselves
+ nAllPolygonCount + // Bool if (when poly has points) it has flags, too
+ nAllFlagCount); // Flags themselves
+
+ rOStm << nActionSize;
+ rOStm << (sal_uInt16)nAllPolygonCount;
+
+ for(a = 0; a < nPolygonCount; a++)
+ {
+ const Polygon& rCandidate = rPolyPolygon.GetObject(a);
+ const sal_uInt16 nPointCount(rCandidate.GetSize());
+
+ if(nPointCount)
+ {
+ rOStm << nPointCount;
+
+ for(sal_uInt16 b(0); b < nPointCount; b++)
+ {
+ rOStm << rCandidate[b];
+ }
+
+ if(rCandidate.HasFlags())
+ {
+ rOStm << (BYTE)true;
+
+ for(sal_uInt16 c(0); c < nPointCount; c++)
+ {
+ rOStm << (BYTE)rCandidate.GetFlags(c);
+ }
+ }
+ else
+ {
+ rOStm << (BYTE)false;
+ }
+ }
+ }
+
+ return true;
+ }
+ }
+
+ return false;
+}
+
+// ------------------------------------------------------------------------
+
+void ImplReadExtendedPolyPolygonAction(SvStream& rIStm, PolyPolygon& rPolyPoly)
+{
+ rPolyPoly.Clear();
+ sal_uInt16 nPolygonCount(0);
+ rIStm >> nPolygonCount;
+
+ for(sal_uInt16 a(0); a < nPolygonCount; a++)
+ {
+ sal_uInt16 nPointCount(0);
+ rIStm >> nPointCount;
+ Polygon aCandidate(nPointCount);
+
+ if(nPointCount)
+ {
+ for(sal_uInt16 b(0); b < nPointCount; b++)
+ {
+ rIStm >> aCandidate[b];
+ }
+
+ BYTE bHasFlags(false);
+ rIStm >> bHasFlags;
+
+ if(bHasFlags)
+ {
+ BYTE aPolyFlags(0);
+
+ for(sal_uInt16 c(0); c < nPointCount; c++)
+ {
+ rIStm >> aPolyFlags;
+ aCandidate.SetFlags(c, (PolyFlags)aPolyFlags);
+ }
+ }
+ }
+
+ rPolyPoly.Insert(aCandidate);
+ }
+}
+
// ----------------
// - SVMConverter -
// ----------------
@@ -450,6 +564,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
rMtf.SetPrefSize( aPrefSz );
rMtf.SetPrefMapMode( aMapMode );
+ sal_uInt32 nLastPolygonAction(0);
for( INT32 i = 0L; i < nActions; i++ )
{
@@ -483,6 +598,99 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
}
break;
+ case (GDI_LINEJOIN_ACTION) :
+ {
+ INT16 nLineJoin(0);
+ rIStm >> nLineJoin;
+ aLineInfo.SetLineJoin((basegfx::B2DLineJoin)nLineJoin);
+ }
+ break;
+
+ case (GDI_LINEDASHDOT_ACTION) :
+ {
+ INT16 a(0);
+ INT32 b(0);
+
+ rIStm >> a; aLineInfo.SetDashCount(a);
+ rIStm >> b; aLineInfo.SetDashLen(b);
+ rIStm >> a; aLineInfo.SetDotCount(a);
+ rIStm >> b; aLineInfo.SetDotLen(b);
+ rIStm >> b; aLineInfo.SetDistance(b);
+
+ if(((aLineInfo.GetDashCount() && aLineInfo.GetDashLen())
+ || (aLineInfo.GetDotCount() && aLineInfo.GetDotLen()))
+ && aLineInfo.GetDistance())
+ {
+ aLineInfo.SetStyle(LINE_DASH);
+ }
+ }
+ break;
+
+ case (GDI_EXTENDEDPOLYGON_ACTION) :
+ {
+ // read the PolyPolygon in every case
+ PolyPolygon aInputPolyPolygon;
+ ImplReadExtendedPolyPolygonAction(rIStm, aInputPolyPolygon);
+
+ // now check if it can be set somewhere
+ if(nLastPolygonAction < rMtf.GetActionCount())
+ {
+ MetaPolyLineAction* pPolyLineAction = dynamic_cast< MetaPolyLineAction* >(rMtf.GetAction(nLastPolygonAction));
+
+ if(pPolyLineAction)
+ {
+ // replace MetaPolyLineAction when we have a single polygon. Do not rely on the
+ // same point count; the originally written GDI_POLYLINE_ACTION may have been
+ // Subdivided for better quality for older usages
+ if(1 == aInputPolyPolygon.Count())
+ {
+ rMtf.ReplaceAction(
+ new MetaPolyLineAction(
+ aInputPolyPolygon.GetObject(0),
+ pPolyLineAction->GetLineInfo()),
+ nLastPolygonAction);
+ pPolyLineAction->Delete();
+ }
+ }
+ else
+ {
+ MetaPolyPolygonAction* pPolyPolygonAction = dynamic_cast< MetaPolyPolygonAction* >(rMtf.GetAction(nLastPolygonAction));
+
+ if(pPolyPolygonAction)
+ {
+ // replace MetaPolyPolygonAction when we have a curved polygon. Do rely on the
+ // same sub-polygon count
+ if(pPolyPolygonAction->GetPolyPolygon().Count() == aInputPolyPolygon.Count())
+ {
+ rMtf.ReplaceAction(
+ new MetaPolyPolygonAction(
+ aInputPolyPolygon),
+ nLastPolygonAction);
+ pPolyPolygonAction->Delete();
+ }
+ }
+ else
+ {
+ MetaPolygonAction* pPolygonAction = dynamic_cast< MetaPolygonAction* >(rMtf.GetAction(nLastPolygonAction));
+
+ if(pPolygonAction)
+ {
+ // replace MetaPolygonAction
+ if(1 == aInputPolyPolygon.Count())
+ {
+ rMtf.ReplaceAction(
+ new MetaPolygonAction(
+ aInputPolyPolygon.GetObject(0)),
+ nLastPolygonAction);
+ pPolygonAction->Delete();
+ }
+ }
+ }
+ }
+ }
+ }
+ break;
+
case( GDI_RECT_ACTION ):
{
ImplReadRect( rIStm, aRect );
@@ -573,6 +781,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
case( GDI_POLYLINE_ACTION ):
{
ImplReadPoly( rIStm, aActionPoly );
+ nLastPolygonAction = rMtf.GetActionCount();
if( bFatLine )
rMtf.AddAction( new MetaPolyLineAction( aActionPoly, aLineInfo ) );
@@ -594,7 +803,10 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
rMtf.AddAction( new MetaPolyLineAction( aActionPoly, aLineInfo ) );
}
else
+ {
+ nLastPolygonAction = rMtf.GetActionCount();
rMtf.AddAction( new MetaPolygonAction( aActionPoly ) );
+ }
}
break;
@@ -615,7 +827,10 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
rMtf.AddAction( new MetaPolyLineAction( aPolyPoly[ nPoly ], aLineInfo ) );
}
else
+ {
+ nLastPolygonAction = rMtf.GetActionCount();
rMtf.AddAction( new MetaPolyPolygonAction( aPolyPoly ) );
+ }
}
break;
@@ -1247,12 +1462,32 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf,
{
MetaLineAction* pAct = (MetaLineAction*) pAction;
const LineInfo& rInfo = pAct->GetLineInfo();
- const BOOL bFatLine = ( !rInfo.IsDefault() && ( LINE_NONE != rInfo.GetStyle() ) );
+ const bool bFatLine(!rInfo.IsDefault() && (LINE_NONE != rInfo.GetStyle()));
+ const bool bLineJoin(bFatLine && basegfx::B2DLINEJOIN_ROUND != rInfo.GetLineJoin());
+ const bool bLineDashDot(LINE_DASH == rInfo.GetStyle());
if( bFatLine )
{
ImplWritePushAction( rOStm );
ImplWriteLineColor( rOStm, rLineCol, 1, rInfo.GetWidth() );
+
+ if(bLineJoin)
+ {
+ rOStm << (INT16) GDI_LINEJOIN_ACTION;
+ rOStm << (INT32) 6;
+ rOStm << (INT16) rInfo.GetLineJoin();
+ }
+
+ if(bLineDashDot)
+ {
+ rOStm << (INT16) GDI_LINEDASHDOT_ACTION;
+ rOStm << (INT32) 4 + 16;
+ rOStm << (INT16)rInfo.GetDashCount();
+ rOStm << (INT32)rInfo.GetDashLen();
+ rOStm << (INT16)rInfo.GetDotCount();
+ rOStm << (INT32)rInfo.GetDotLen();
+ rOStm << (INT32)rInfo.GetDistance();
+ }
}
rOStm << (INT16) GDI_LINE_ACTION;
@@ -1265,6 +1500,16 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf,
{
ImplWritePopAction( rOStm );
nCount += 3;
+
+ if(bLineJoin)
+ {
+ nCount += 1;
+ }
+
+ if(bLineDashDot)
+ {
+ nCount += 1;
+ }
}
}
break;
@@ -1345,23 +1590,47 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf,
for( USHORT n = 0; n < nPoints; n++ )
rOStm << aChordPoly[ n ];
-
nCount++;
}
break;
case( META_POLYLINE_ACTION ):
{
+ // #i102224#
MetaPolyLineAction* pAct = (MetaPolyLineAction*) pAction;
- const Polygon& rPoly = pAct->GetPolygon();
- const LineInfo& rInfo = pAct->GetLineInfo();
- const USHORT nPoints = rPoly.GetSize();
- const BOOL bFatLine = ( !rInfo.IsDefault() && ( LINE_NONE != rInfo.GetStyle() ) );
+ // #i102224# Here the evtl. curved nature of Polygon was
+ // ignored (for all those Years). Adapted to at least write
+ // a polygon representing the curve as good as possible
+ Polygon aSimplePoly;
+ pAct->GetPolygon().AdaptiveSubdivide(aSimplePoly);
+ const LineInfo& rInfo = pAct->GetLineInfo();
+ const USHORT nPoints(aSimplePoly.GetSize());
+ const bool bFatLine(!rInfo.IsDefault() && (LINE_NONE != rInfo.GetStyle()));
+ const bool bLineJoin(bFatLine && basegfx::B2DLINEJOIN_ROUND != rInfo.GetLineJoin());
+ const bool bLineDashDot(LINE_DASH == rInfo.GetStyle());
if( bFatLine )
{
ImplWritePushAction( rOStm );
ImplWriteLineColor( rOStm, rLineCol, 1, rInfo.GetWidth() );
+
+ if(bLineJoin)
+ {
+ rOStm << (INT16) GDI_LINEJOIN_ACTION;
+ rOStm << (INT32) 6;
+ rOStm << (INT16) rInfo.GetLineJoin();
+ }
+ }
+
+ if(bLineDashDot)
+ {
+ rOStm << (INT16) GDI_LINEDASHDOT_ACTION;
+ rOStm << (INT32) 4 + 16;
+ rOStm << (INT16)rInfo.GetDashCount();
+ rOStm << (INT32)rInfo.GetDashLen();
+ rOStm << (INT16)rInfo.GetDotCount();
+ rOStm << (INT32)rInfo.GetDotLen();
+ rOStm << (INT32)rInfo.GetDistance();
}
rOStm << (INT16) GDI_POLYLINE_ACTION;
@@ -1369,32 +1638,60 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf,
rOStm << (INT32) nPoints;
for( USHORT n = 0; n < nPoints; n++ )
- rOStm << rPoly[ n ];
+ {
+ rOStm << aSimplePoly[ n ];
+ }
nCount++;
+ const PolyPolygon aPolyPolygon(pAct->GetPolygon());
+ if(ImplWriteExtendedPolyPolygonAction(rOStm, aPolyPolygon, true))
+ {
+ nCount++;
+ }
+
if( bFatLine )
{
ImplWritePopAction( rOStm );
nCount += 3;
+
+ if(bLineJoin)
+ {
+ nCount += 1;
+ }
+ }
+
+ if(bLineDashDot)
+ {
+ nCount += 1;
}
}
break;
case( META_POLYGON_ACTION ):
{
- MetaPolygonAction* pAct = (MetaPolygonAction*) pAction;
- const Polygon& rPoly = pAct->GetPolygon();
- const USHORT nPoints = rPoly.GetSize();
+ MetaPolygonAction* pAct = (MetaPolygonAction*)pAction;
+ // #i102224# Here the evtl. curved nature of Polygon was
+ // ignored (for all those Years). Adapted to at least write
+ // a polygon representing the curve as good as possible
+ Polygon aSimplePoly;
+ pAct->GetPolygon().AdaptiveSubdivide(aSimplePoly);
+ const USHORT nPoints(aSimplePoly.GetSize());
rOStm << (INT16) GDI_POLYGON_ACTION;
rOStm << (INT32) ( 8 + ( nPoints << 3 ) );
rOStm << (INT32) nPoints;
for( USHORT n = 0; n < nPoints; n++ )
- rOStm << rPoly[ n ];
+ rOStm << aSimplePoly[ n ];
nCount++;
+
+ const PolyPolygon aPolyPolygon(pAct->GetPolygon());
+ if(ImplWriteExtendedPolyPolygonAction(rOStm, aPolyPolygon, true))
+ {
+ nCount++;
+ }
}
break;
@@ -1403,6 +1700,11 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf,
MetaPolyPolygonAction* pAct = (MetaPolyPolygonAction*) pAction;
ImplWritePolyPolyAction( rOStm, pAct->GetPolyPolygon() );
nCount++;
+
+ if(ImplWriteExtendedPolyPolygonAction(rOStm, pAct->GetPolyPolygon(), true))
+ {
+ nCount++;
+ }
}
break;
diff --git a/vcl/source/gdi/font.cxx b/vcl/source/gdi/font.cxx
index 3bbdba5dad5f..afd6181351b4 100644
--- a/vcl/source/gdi/font.cxx
+++ b/vcl/source/gdi/font.cxx
@@ -38,8 +38,8 @@
#include "tools/debug.hxx"
#include "vcl/font.hxx"
#include "vcl/impfont.hxx"
-#include "vcl/fontcfg.hxx"
-#include "vcl/outdev.h" // just for ImplGetEnglishSearchFontName! TODO: move it
+#include "vcl/outfont.hxx"
+#include "unotools/fontcfg.hxx"
#include <algorithm>
@@ -169,7 +169,7 @@ void Impl_Font::AskConfig()
mbConfigLookup = true;
// prepare the FontSubst configuration lookup
- const vcl::FontSubstConfiguration* pFontSubst = vcl::FontSubstConfiguration::get();
+ const utl::FontSubstConfiguration* pFontSubst = utl::FontSubstConfiguration::get();
String aShortName;
String aFamilyName;
@@ -177,12 +177,12 @@ void Impl_Font::AskConfig()
FontWeight eWeight = WEIGHT_DONTKNOW;
FontWidth eWidthType = WIDTH_DONTKNOW;
String aMapName = maFamilyName;
- ImplGetEnglishSearchFontName( aMapName );
- vcl::FontSubstConfiguration::getMapName( aMapName,
+ GetEnglishSearchFontName( aMapName );
+ utl::FontSubstConfiguration::getMapName( aMapName,
aShortName, aFamilyName, eWeight, eWidthType, nType );
// lookup the font name in the configuration
- const vcl::FontNameAttr* pFontAttr = pFontSubst->getSubstInfo( aMapName );
+ const utl::FontNameAttr* pFontAttr = pFontSubst->getSubstInfo( aMapName );
// if the direct lookup failed try again with an alias name
if ( !pFontAttr && (aShortName != aMapName) )
diff --git a/vcl/source/gdi/fontcfg.cxx b/vcl/source/gdi/fontcfg.cxx
deleted file mode 100644
index 68d3b499341d..000000000000
--- a/vcl/source/gdi/fontcfg.cxx
+++ /dev/null
@@ -1,1381 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: fontcfg.cxx,v $
- * $Revision: 1.49.114.1 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_vcl.hxx"
-#include <vcl/fontcfg.hxx>
-#include <vcl/configsettings.hxx>
-#include <vcl/outdev.hxx>
-#include <vcl/svdata.hxx>
-#include <vcl/svapp.hxx>
-#include <vcl/unohelp.hxx>
-#include <com/sun/star/uno/Any.hxx>
-#include <com/sun/star/uno/Sequence.hxx>
-#include <com/sun/star/beans/PropertyValue.hpp>
-#include <unotools/configpathes.hxx>
-#include <rtl/ustrbuf.hxx>
-
-#if OSL_DEBUG_LEVEL > 1
-#include <stdio.h>
-#endif
-
-#include <string.h>
-#include <list>
-#include <algorithm>
-
-#define DEFAULTFONT_CONFIGNODE "VCL/DefaultFonts"
-#define SUBSTFONT_CONFIGNODE "VCL/FontSubstitutions"
-#define SETTINGS_CONFIGNODE "VCL/Settings"
-
-using namespace vcl;
-using namespace rtl;
-using namespace utl;
-using namespace com::sun::star::uno;
-using namespace com::sun::star::lang;
-using namespace com::sun::star::beans;
-using namespace com::sun::star::container;
-
-
-/*
- * DefaultFontConfiguration
- */
-
-static const char* getKeyType( int nKeyType )
-{
- switch( nKeyType )
- {
- case DEFAULTFONT_CJK_DISPLAY: return "CJK_DISPLAY";
- case DEFAULTFONT_CJK_HEADING: return "CJK_HEADING";
- case DEFAULTFONT_CJK_PRESENTATION: return "CJK_PRESENTATION";
- case DEFAULTFONT_CJK_SPREADSHEET: return "CJK_SPREADSHEET";
- case DEFAULTFONT_CJK_TEXT: return "CJK_TEXT";
- case DEFAULTFONT_CTL_DISPLAY: return "CTL_DISPLAY";
- case DEFAULTFONT_CTL_HEADING: return "CTL_HEADING";
- case DEFAULTFONT_CTL_PRESENTATION: return "CTL_PRESENTATION";
- case DEFAULTFONT_CTL_SPREADSHEET: return "CTL_SPREADSHEET";
- case DEFAULTFONT_CTL_TEXT: return "CTL_TEXT";
- case DEFAULTFONT_FIXED: return "FIXED";
- case DEFAULTFONT_LATIN_DISPLAY: return "LATIN_DISPLAY";
- case DEFAULTFONT_LATIN_FIXED: return "LATIN_FIXED";
- case DEFAULTFONT_LATIN_HEADING: return "LATIN_HEADING";
- case DEFAULTFONT_LATIN_PRESENTATION: return "LATIN_PRESENTATION";
- case DEFAULTFONT_LATIN_SPREADSHEET: return "LATIN_SPREADSHEET";
- case DEFAULTFONT_LATIN_TEXT: return "LATIN_TEXT";
- case DEFAULTFONT_SANS: return "SANS";
- case DEFAULTFONT_SANS_UNICODE: return "SANS_UNICODE";
- case DEFAULTFONT_SERIF: return "SERIF";
- case DEFAULTFONT_SYMBOL: return "SYMBOL";
- case DEFAULTFONT_UI_FIXED: return "UI_FIXED";
- case DEFAULTFONT_UI_SANS: return "UI_SANS";
- default:
- DBG_ERROR( "unmatched type" );
- return "";
- }
-}
-
-DefaultFontConfiguration* DefaultFontConfiguration::get()
-{
- ImplSVData* pSVData = ImplGetSVData();
- if( ! pSVData->maGDIData.mpDefaultFontConfiguration )
- pSVData->maGDIData.mpDefaultFontConfiguration = new DefaultFontConfiguration();
- return pSVData->maGDIData.mpDefaultFontConfiguration;
-}
-
-DefaultFontConfiguration::DefaultFontConfiguration()
-{
- try
- {
- // get service provider
- Reference< XMultiServiceFactory > xSMgr( unohelper::GetMultiServiceFactory() );
- // create configuration hierachical access name
- if( xSMgr.is() )
- {
- try
- {
- m_xConfigProvider =
- Reference< XMultiServiceFactory >(
- xSMgr->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.configuration.ConfigurationProvider" ))),
- UNO_QUERY );
- if( m_xConfigProvider.is() )
- {
- Sequence< Any > aArgs(1);
- PropertyValue aVal;
- aVal.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "nodepath" ) );
- aVal.Value <<= OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.VCL/DefaultFonts" ) );
- aArgs.getArray()[0] <<= aVal;
- m_xConfigAccess =
- Reference< XNameAccess >(
- m_xConfigProvider->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.configuration.ConfigurationAccess" )),
- aArgs ),
- UNO_QUERY );
- if( m_xConfigAccess.is() )
- {
- Sequence< OUString > aLocales = m_xConfigAccess->getElementNames();
- // fill config hash with empty interfaces
- int nLocales = aLocales.getLength();
- const OUString* pLocaleStrings = aLocales.getConstArray();
- Locale aLoc;
- for( int i = 0; i < nLocales; i++ )
- {
- sal_Int32 nIndex = 0;
- aLoc.Language = pLocaleStrings[i].getToken( 0, sal_Unicode('-'), nIndex ).toAsciiLowerCase();
- if( nIndex != -1 )
- aLoc.Country = pLocaleStrings[i].getToken( 0, sal_Unicode('-'), nIndex ).toAsciiUpperCase();
- else
- aLoc.Country = OUString();
- if( nIndex != -1 )
- aLoc.Variant = pLocaleStrings[i].getToken( 0, sal_Unicode('-'), nIndex ).toAsciiUpperCase();
- else
- aLoc.Variant = OUString();
- m_aConfig[ aLoc ] = LocaleAccess();
- m_aConfig[ aLoc ].aConfigLocaleString = pLocaleStrings[i];
- }
- }
- }
- }
- catch( Exception& )
- {
- // configuration is awry
- m_xConfigProvider.clear();
- m_xConfigAccess.clear();
- }
- }
- }
- catch( WrappedTargetException& )
- {
- }
- #if OSL_DEBUG_LEVEL > 1
- fprintf( stderr, "config provider: %s, config access: %s\n",
- m_xConfigProvider.is() ? "true" : "false",
- m_xConfigAccess.is() ? "true" : "false"
- );
- #endif
-}
-
-DefaultFontConfiguration::~DefaultFontConfiguration()
-{
- // release all nodes
- m_aConfig.clear();
- // release top node
- m_xConfigAccess.clear();
- // release config provider
- m_xConfigProvider.clear();
-}
-
-OUString DefaultFontConfiguration::tryLocale( const Locale& rLocale, const OUString& rType ) const
-{
- OUString aRet;
-
- std::hash_map< Locale, LocaleAccess, LocaleHash >::const_iterator it =
- m_aConfig.find( rLocale );
- if( it != m_aConfig.end() )
- {
- if( !it->second.xAccess.is() )
- {
- try
- {
- Reference< XNameAccess > xNode;
- if ( m_xConfigAccess->hasByName( it->second.aConfigLocaleString ) )
- {
- Any aAny = m_xConfigAccess->getByName( it->second.aConfigLocaleString );
- if( aAny >>= xNode )
- it->second.xAccess = xNode;
- }
- }
- catch( NoSuchElementException )
- {
- }
- catch( WrappedTargetException )
- {
- }
- }
- if( it->second.xAccess.is() )
- {
- try
- {
- if ( it->second.xAccess->hasByName( rType ) )
- {
- Any aAny = it->second.xAccess->getByName( rType );
- aAny >>= aRet;
- }
- }
- catch( NoSuchElementException& )
- {
- }
- catch( WrappedTargetException& )
- {
- }
- }
- }
-
- return aRet;
-}
-
-OUString DefaultFontConfiguration::getDefaultFont( const Locale& rLocale, int nType ) const
-{
- Locale aLocale;
- aLocale.Language = rLocale.Language.toAsciiLowerCase();
- aLocale.Country = rLocale.Country.toAsciiUpperCase();
- aLocale.Variant = rLocale.Variant.toAsciiUpperCase();
-
- OUString aType = OUString::createFromAscii( getKeyType( nType ) );
- OUString aRet = tryLocale( aLocale, aType );
- if( ! aRet.getLength() && aLocale.Variant.getLength() )
- {
- aLocale.Variant = OUString();
- aRet = tryLocale( aLocale, aType );
- }
- if( ! aRet.getLength() && aLocale.Country.getLength() )
- {
- aLocale.Country = OUString();
- aRet = tryLocale( aLocale, aType );
- }
- if( ! aRet.getLength() )
- {
- aLocale.Language = OUString( RTL_CONSTASCII_USTRINGPARAM( "en" ) );
- aRet = tryLocale( aLocale, aType );
- }
- return aRet;
-}
-
-OUString DefaultFontConfiguration::getUserInterfaceFont( const Locale& rLocale ) const
-{
- Locale aLocale = rLocale;
- if( ! aLocale.Language.getLength() )
- aLocale = Application::GetSettings().GetUILocale();
-
- OUString aUIFont = getDefaultFont( aLocale, DEFAULTFONT_UI_SANS );
-
- if( aUIFont.getLength() )
- return aUIFont;
-
- // fallback mechanism (either no configuration or no entry in configuration
-
- #define FALLBACKFONT_UI_SANS "Andale Sans UI;Albany;Albany AMT;Tahoma;Arial Unicode MS;Arial;Nimbus Sans L;Bitstream Vera Sans;gnu-unifont;Interface User;Geneva;WarpSans;Dialog;Swiss;Lucida;Helvetica;Charcoal;Chicago;MS Sans Serif;Helv;Times;Times New Roman;Interface System"
- #define FALLBACKFONT_UI_SANS_LATIN2 "Andale Sans UI;Albany;Albany AMT;Tahoma;Arial Unicode MS;Arial;Nimbus Sans L;Luxi Sans;Bitstream Vera Sans;Interface User;Geneva;WarpSans;Dialog;Swiss;Lucida;Helvetica;Charcoal;Chicago;MS Sans Serif;Helv;Times;Times New Roman;Interface System"
- #define FALLBACKFONT_UI_SANS_ARABIC "Tahoma;Traditional Arabic;Simplified Arabic;Lucidasans;Lucida Sans;Supplement;Andale Sans UI;clearlyU;Interface User;Arial Unicode MS;Lucida Sans Unicode;WarpSans;Geneva;MS Sans Serif;Helv;Dialog;Albany;Lucida;Helvetica;Charcoal;Chicago;Arial;Helmet;Interface System;Sans Serif"
- #define FALLBACKFONT_UI_SANS_THAI "OONaksit;Tahoma;Lucidasans;Arial Unicode MS"
- #define FALLBACKFONT_UI_SANS_KOREAN "SunGulim;BaekmukGulim;Gulim;Roundgothic;Arial Unicode MS;Lucida Sans Unicode;gnu-unifont;Andale Sans UI"
- #define FALLBACKFONT_UI_SANS_JAPANESE1 "HG-GothicB-Sun;Andale Sans UI;HG MhinchoLightJ"
- #define FALLBACKFONT_UI_SANS_JAPANESE2 "Kochi Gothic;Gothic"
- #define FALLBACKFONT_UI_SANS_CHINSIM "Andale Sans UI;Arial Unicode MS;ZYSong18030;AR PL SungtiL GB;AR PL KaitiM GB;SimSun;Lucida Sans Unicode;Fangsong;Hei;Song;Kai;Ming;gnu-unifont;Interface User;"
- #define FALLBACKFONT_UI_SANS_CHINTRD "Andale Sans UI;Arial Unicode MS;AR PL Mingti2L Big5;AR PL KaitiM Big5;Kai;PMingLiU;MingLiU;Ming;Lucida Sans Unicode;gnu-unifont;Interface User;"
-
- // we need localized names for japanese fonts
- static sal_Unicode const aMSGothic[] = { 0xFF2D, 0xFF33, ' ', 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0, 0 };
- static sal_Unicode const aMSPGothic[] = { 0xFF2D, 0xFF33, ' ', 0xFF30, 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0, 0 };
- static sal_Unicode const aTLPGothic[] = { 0x0054, 0x004C, 0x0050, 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0, 0 };
- static sal_Unicode const aLXGothic[] = { 0x004C, 0x0058, 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0, 0 };
- static sal_Unicode const aKochiGothic[] = { 0x6771, 0x98A8, 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0, 0 };
-
- String aFallBackJapaneseLocalized( RTL_CONSTASCII_USTRINGPARAM( "MS UI Gothic;" ) );
- aFallBackJapaneseLocalized += String( RTL_CONSTASCII_USTRINGPARAM( FALLBACKFONT_UI_SANS_JAPANESE1 ) );
- aFallBackJapaneseLocalized += String( aMSPGothic );
- aFallBackJapaneseLocalized += String(RTL_CONSTASCII_USTRINGPARAM( ";" ) );
- aFallBackJapaneseLocalized += String( aMSGothic );
- aFallBackJapaneseLocalized += String(RTL_CONSTASCII_USTRINGPARAM( ";" ) );
- aFallBackJapaneseLocalized += String( aTLPGothic );
- aFallBackJapaneseLocalized += String(RTL_CONSTASCII_USTRINGPARAM( ";" ) );
- aFallBackJapaneseLocalized += String( aLXGothic );
- aFallBackJapaneseLocalized += String(RTL_CONSTASCII_USTRINGPARAM( ";" ) );
- aFallBackJapaneseLocalized += String( aKochiGothic );
- aFallBackJapaneseLocalized += String(RTL_CONSTASCII_USTRINGPARAM( ";" ) );
- aFallBackJapaneseLocalized += String(RTL_CONSTASCII_USTRINGPARAM( FALLBACKFONT_UI_SANS_JAPANESE2 ) );
- static const OUString aFallBackJapanese( aFallBackJapaneseLocalized );
- static const OUString aFallback (RTL_CONSTASCII_USTRINGPARAM(FALLBACKFONT_UI_SANS));
- static const OUString aFallbackLatin2 (RTL_CONSTASCII_USTRINGPARAM(FALLBACKFONT_UI_SANS_LATIN2));
- static const OUString aFallBackArabic (RTL_CONSTASCII_USTRINGPARAM( FALLBACKFONT_UI_SANS_ARABIC ) );
- static const OUString aFallBackThai (RTL_CONSTASCII_USTRINGPARAM( FALLBACKFONT_UI_SANS_THAI ) );
- static const OUString aFallBackChineseSIM (RTL_CONSTASCII_USTRINGPARAM( FALLBACKFONT_UI_SANS_CHINSIM ) );
- static const OUString aFallBackChineseTRD (RTL_CONSTASCII_USTRINGPARAM( FALLBACKFONT_UI_SANS_CHINTRD ) );
-
- // we need localized names for korean fonts
- static sal_Unicode const aSunGulim[] = { 0xC36C, 0xAD74, 0xB9BC, 0 };
- static sal_Unicode const aBaekmukGulim[] = { 0xBC31, 0xBC35, 0xAD74, 0xB9BC, 0 };
- String aFallBackKoreanLocalized( aSunGulim );
- aFallBackKoreanLocalized += String(RTL_CONSTASCII_USTRINGPARAM( ";" ) );
- aFallBackKoreanLocalized += String( aBaekmukGulim );
- aFallBackKoreanLocalized += String(RTL_CONSTASCII_USTRINGPARAM( ";" ) );
- aFallBackKoreanLocalized += String(RTL_CONSTASCII_USTRINGPARAM( FALLBACKFONT_UI_SANS_KOREAN ) );
- static const OUString aFallBackKorean( aFallBackKoreanLocalized );
-
- // optimize font list for some locales, as long as Andale Sans UI does not support them
- if( aLocale.Language.equalsAscii( "ar" ) ||
- aLocale.Language.equalsAscii( "he" ) ||
- aLocale.Language.equalsAscii( "iw" ) )
- {
- return aFallBackArabic;
- }
- else if( aLocale.Language.equalsAscii( "th" ) )
- {
- return aFallBackThai;
- }
- else if( aLocale.Language.equalsAscii( "ko" ) )
- {
- return aFallBackKorean;
- }
- else if( aLocale.Language.equalsAscii( "cs" ) ||
- aLocale.Language.equalsAscii( "hu" ) ||
- aLocale.Language.equalsAscii( "pl" ) ||
- aLocale.Language.equalsAscii( "ro" ) ||
- aLocale.Language.equalsAscii( "rm" ) ||
- aLocale.Language.equalsAscii( "hr" ) ||
- aLocale.Language.equalsAscii( "sk" ) ||
- aLocale.Language.equalsAscii( "sl" ) ||
- aLocale.Language.equalsAscii( "sb" ) )
- {
- return aFallbackLatin2;
- }
- else if( aLocale.Language.equalsAscii( "zh" ) )
- {
- if( ! aLocale.Country.equalsAscii( "cn" ) )
- return aFallBackChineseTRD;
- else
- return aFallBackChineseSIM;
- }
- else if( aLocale.Language.equalsAscii( "ja" ) )
- {
- return aFallBackJapanese;
- }
-
- return aFallback;
-}
-
-// ------------------------------------------------------------------------------------
-
-/*
- * FontSubstConfigItem::get
- */
-
-FontSubstConfiguration* FontSubstConfiguration::get()
-{
- ImplSVData* pSVData = ImplGetSVData();
- if( ! pSVData->maGDIData.mpFontSubstConfiguration )
- pSVData->maGDIData.mpFontSubstConfiguration = new FontSubstConfiguration();
- return pSVData->maGDIData.mpFontSubstConfiguration;
-}
-
-/*
- * FontSubstConfigItem::FontSubstConfigItem
- */
-
-FontSubstConfiguration::FontSubstConfiguration() :
- maSubstHash( 300 )
-{
- try
- {
- // get service provider
- Reference< XMultiServiceFactory > xSMgr( unohelper::GetMultiServiceFactory() );
- // create configuration hierachical access name
- if( xSMgr.is() )
- {
- try
- {
- m_xConfigProvider =
- Reference< XMultiServiceFactory >(
- xSMgr->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.configuration.ConfigurationProvider" ))),
- UNO_QUERY );
- if( m_xConfigProvider.is() )
- {
- Sequence< Any > aArgs(1);
- PropertyValue aVal;
- aVal.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "nodepath" ) );
- aVal.Value <<= OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.VCL/FontSubstitutions" ) );
- aArgs.getArray()[0] <<= aVal;
- m_xConfigAccess =
- Reference< XNameAccess >(
- m_xConfigProvider->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.configuration.ConfigurationAccess" )),
- aArgs ),
- UNO_QUERY );
- if( m_xConfigAccess.is() )
- {
- Sequence< OUString > aLocales = m_xConfigAccess->getElementNames();
- // fill config hash with empty interfaces
- int nLocales = aLocales.getLength();
- const OUString* pLocaleStrings = aLocales.getConstArray();
- Locale aLoc;
- for( int i = 0; i < nLocales; i++ )
- {
- sal_Int32 nIndex = 0;
- aLoc.Language = pLocaleStrings[i].getToken( 0, sal_Unicode('-'), nIndex ).toAsciiLowerCase();
- if( nIndex != -1 )
- aLoc.Country = pLocaleStrings[i].getToken( 0, sal_Unicode('-'), nIndex ).toAsciiUpperCase();
- else
- aLoc.Country = OUString();
- if( nIndex != -1 )
- aLoc.Variant = pLocaleStrings[i].getToken( 0, sal_Unicode('-'), nIndex ).toAsciiUpperCase();
- else
- aLoc.Variant = OUString();
- m_aSubst[ aLoc ] = LocaleSubst();
- m_aSubst[ aLoc ].aConfigLocaleString = pLocaleStrings[i];
- }
- }
- }
- }
- catch( Exception& )
- {
- // configuration is awry
- m_xConfigProvider.clear();
- m_xConfigAccess.clear();
- }
- }
- }
- catch( WrappedTargetException& )
- {
- }
- #if OSL_DEBUG_LEVEL > 1
- fprintf( stderr, "config provider: %s, config access: %s\n",
- m_xConfigProvider.is() ? "true" : "false",
- m_xConfigAccess.is() ? "true" : "false"
- );
- #endif
-}
-
-/*
- * FontSubstConfigItem::~FontSubstConfigItem
- */
-
-FontSubstConfiguration::~FontSubstConfiguration()
-{
- // release config access
- m_xConfigAccess.clear();
- // release config provider
- m_xConfigProvider.clear();
-}
-
-/*
- * FontSubstConfigItem::getMapName
- */
-// =======================================================================
-
-static const char* const aImplKillLeadingList[] =
-{
- "microsoft",
- "monotype",
- "linotype",
- "baekmuk",
- "adobe",
- "nimbus",
- "zycjk",
- "itc",
- "sun",
- "amt",
- "ms",
- "mt",
- "cg",
- "hg",
- "fz",
- "ipa",
- "sazanami",
- "kochi",
- NULL
-};
-
-// -----------------------------------------------------------------------
-
-static const char* const aImplKillTrailingList[] =
-{
- "microsoft",
- "monotype",
- "linotype",
- "adobe",
- "nimbus",
- "itc",
- "sun",
- "amt",
- "ms",
- "mt",
- "clm",
- // Scripts, for compatibility with older versions
- "we",
- "cyr",
- "tur",
- "wt",
- "greek",
- "wl",
- // CJK extensions
- "gb",
- "big5",
- "pro",
- "z01",
- "z02",
- "z03",
- "z13",
- "b01",
- "w3x12",
- // Old Printer Fontnames
- "5cpi",
- "6cpi",
- "7cpi",
- "8cpi",
- "9cpi",
- "10cpi",
- "11cpi",
- "12cpi",
- "13cpi",
- "14cpi",
- "15cpi",
- "16cpi",
- "18cpi",
- "24cpi",
- "scale",
- "pc",
- NULL
-};
-
-// -----------------------------------------------------------------------
-
-static const char* const aImplKillTrailingWithExceptionsList[] =
-{
- "ce", "monospace", "oldface", NULL,
- "ps", "caps", NULL,
- NULL
-};
-
-// -----------------------------------------------------------------------
-
-struct ImplFontAttrWeightSearchData
-{
- const char* mpStr;
- FontWeight meWeight;
-};
-
-static ImplFontAttrWeightSearchData const aImplWeightAttrSearchList[] =
-{
-// the attribute names are ordered by "first match wins"
-// e.g. "semilight" should wins over "semi"
-{ "extrablack", WEIGHT_BLACK },
-{ "ultrablack", WEIGHT_BLACK },
-{ "ultrabold", WEIGHT_ULTRABOLD },
-{ "semibold", WEIGHT_SEMIBOLD },
-{ "semilight", WEIGHT_SEMILIGHT },
-{ "semi", WEIGHT_SEMIBOLD },
-{ "demi", WEIGHT_SEMIBOLD },
-{ "black", WEIGHT_BLACK },
-{ "bold", WEIGHT_BOLD },
-{ "heavy", WEIGHT_BLACK },
-{ "ultralight", WEIGHT_ULTRALIGHT },
-{ "light", WEIGHT_LIGHT },
-{ "medium", WEIGHT_MEDIUM },
-{ NULL, WEIGHT_DONTKNOW },
-};
-
-// -----------------------------------------------------------------------
-
-struct ImplFontAttrWidthSearchData
-{
- const char* mpStr;
- FontWidth meWidth;
-};
-
-static ImplFontAttrWidthSearchData const aImplWidthAttrSearchList[] =
-{
-{ "narrow", WIDTH_CONDENSED },
-{ "semicondensed", WIDTH_SEMI_CONDENSED },
-{ "ultracondensed", WIDTH_ULTRA_CONDENSED },
-{ "semiexpanded", WIDTH_SEMI_EXPANDED },
-{ "ultraexpanded", WIDTH_ULTRA_EXPANDED },
-{ "expanded", WIDTH_EXPANDED },
-{ "wide", WIDTH_ULTRA_EXPANDED },
-{ "condensed", WIDTH_CONDENSED },
-{ "cond", WIDTH_CONDENSED },
-{ "cn", WIDTH_CONDENSED },
-{ NULL, WIDTH_DONTKNOW },
-};
-
-struct ImplFontAttrTypeSearchData
-{
- const char* mpStr;
- ULONG mnType;
-};
-
-static ImplFontAttrTypeSearchData const aImplTypeAttrSearchList[] =
-{
-{ "monotype", 0 },
-{ "linotype", 0 },
-{ "titling", IMPL_FONT_ATTR_TITLING },
-{ "captitals", IMPL_FONT_ATTR_CAPITALS },
-{ "captital", IMPL_FONT_ATTR_CAPITALS },
-{ "caps", IMPL_FONT_ATTR_CAPITALS },
-{ "italic", IMPL_FONT_ATTR_ITALIC },
-{ "oblique", IMPL_FONT_ATTR_ITALIC },
-{ "rounded", IMPL_FONT_ATTR_ROUNDED },
-{ "outline", IMPL_FONT_ATTR_OUTLINE },
-{ "shadow", IMPL_FONT_ATTR_SHADOW },
-{ "handwriting", IMPL_FONT_ATTR_HANDWRITING | IMPL_FONT_ATTR_SCRIPT },
-{ "hand", IMPL_FONT_ATTR_HANDWRITING | IMPL_FONT_ATTR_SCRIPT },
-{ "signet", IMPL_FONT_ATTR_HANDWRITING | IMPL_FONT_ATTR_SCRIPT },
-{ "script", IMPL_FONT_ATTR_BRUSHSCRIPT | IMPL_FONT_ATTR_SCRIPT },
-{ "calligraphy", IMPL_FONT_ATTR_CHANCERY | IMPL_FONT_ATTR_SCRIPT },
-{ "chancery", IMPL_FONT_ATTR_CHANCERY | IMPL_FONT_ATTR_SCRIPT },
-{ "corsiva", IMPL_FONT_ATTR_CHANCERY | IMPL_FONT_ATTR_SCRIPT },
-{ "gothic", IMPL_FONT_ATTR_SANSSERIF | IMPL_FONT_ATTR_GOTHIC },
-{ "schoolbook", IMPL_FONT_ATTR_SERIF | IMPL_FONT_ATTR_SCHOOLBOOK },
-{ "schlbk", IMPL_FONT_ATTR_SERIF | IMPL_FONT_ATTR_SCHOOLBOOK },
-{ "typewriter", IMPL_FONT_ATTR_TYPEWRITER | IMPL_FONT_ATTR_FIXED },
-{ "lineprinter", IMPL_FONT_ATTR_TYPEWRITER | IMPL_FONT_ATTR_FIXED },
-{ "monospaced", IMPL_FONT_ATTR_FIXED },
-{ "monospace", IMPL_FONT_ATTR_FIXED },
-{ "mono", IMPL_FONT_ATTR_FIXED },
-{ "fixed", IMPL_FONT_ATTR_FIXED },
-{ "sansserif", IMPL_FONT_ATTR_SANSSERIF },
-{ "sans", IMPL_FONT_ATTR_SANSSERIF },
-{ "swiss", IMPL_FONT_ATTR_SANSSERIF },
-{ "serif", IMPL_FONT_ATTR_SERIF },
-{ "bright", IMPL_FONT_ATTR_SERIF },
-{ "symbols", IMPL_FONT_ATTR_SYMBOL },
-{ "symbol", IMPL_FONT_ATTR_SYMBOL },
-{ "dingbats", IMPL_FONT_ATTR_SYMBOL },
-{ "dings", IMPL_FONT_ATTR_SYMBOL },
-{ "ding", IMPL_FONT_ATTR_SYMBOL },
-{ "bats", IMPL_FONT_ATTR_SYMBOL },
-{ "math", IMPL_FONT_ATTR_SYMBOL },
-{ "oldstyle", IMPL_FONT_ATTR_OTHERSTYLE },
-{ "oldface", IMPL_FONT_ATTR_OTHERSTYLE },
-{ "old", IMPL_FONT_ATTR_OTHERSTYLE },
-{ "new", 0 },
-{ "modern", 0 },
-{ "lucida", 0 },
-{ "regular", 0 },
-{ "extended", 0 },
-{ "extra", IMPL_FONT_ATTR_OTHERSTYLE },
-{ "ext", 0 },
-{ "scalable", 0 },
-{ "scale", 0 },
-{ "nimbus", 0 },
-{ "adobe", 0 },
-{ "itc", 0 },
-{ "amt", 0 },
-{ "mt", 0 },
-{ "ms", 0 },
-{ "cpi", 0 },
-{ "no", 0 },
-{ NULL, 0 },
-};
-
-// -----------------------------------------------------------------------
-
-static bool ImplKillLeading( String& rName, const char* const* ppStr )
-{
- for(; *ppStr; ++ppStr )
- {
- const char* pStr = *ppStr;
- const xub_Unicode* pNameStr = rName.GetBuffer();
- while ( (*pNameStr == (xub_Unicode)(unsigned char)*pStr) && *pStr )
- {
- pNameStr++;
- pStr++;
- }
- if ( !*pStr )
- {
- xub_StrLen nLen = sal::static_int_cast<xub_StrLen>(pNameStr - rName.GetBuffer());
- rName.Erase( 0, nLen );
- return true;
- }
- }
-
- // special case for Baekmuk
- // TODO: allow non-ASCII KillLeading list
- const xub_Unicode* pNameStr = rName.GetBuffer();
- if( (pNameStr[0]==0xBC31) && (pNameStr[1]==0xBC35) )
- {
- xub_StrLen nLen = (pNameStr[2]==0x0020) ? 3 : 2;
- rName.Erase( 0, nLen );
- return true;
- }
-
- return false;
-}
-
-// -----------------------------------------------------------------------
-
-static xub_StrLen ImplIsTrailing( const String& rName, const char* pStr )
-{
- xub_StrLen nStrLen = static_cast<xub_StrLen>( strlen( pStr ) );
- if( nStrLen >= rName.Len() )
- return 0;
-
- const xub_Unicode* pEndName = rName.GetBuffer() + rName.Len();
- const sal_Unicode* pNameStr = pEndName - nStrLen;
- do if( *(pNameStr++) != *(pStr++) )
- return 0;
- while( *pStr );
-
- return nStrLen;
-}
-
-// -----------------------------------------------------------------------
-
-static bool ImplKillTrailing( String& rName, const char* const* ppStr )
-{
- for(; *ppStr; ++ppStr )
- {
- xub_StrLen nTrailLen = ImplIsTrailing( rName, *ppStr );
- if( nTrailLen )
- {
- rName.Erase( rName.Len()-nTrailLen );
- return true;
- }
- }
-
- return false;
-}
-
-// -----------------------------------------------------------------------
-
-static bool ImplKillTrailingWithExceptions( String& rName, const char* const* ppStr )
-{
- for(; *ppStr; ++ppStr )
- {
- xub_StrLen nTrailLen = ImplIsTrailing( rName, *ppStr );
- if( nTrailLen )
- {
- // check string match against string exceptions
- while( *++ppStr )
- if( ImplIsTrailing( rName, *ppStr ) )
- return false;
-
- rName.Erase( rName.Len()-nTrailLen );
- return true;
- }
- else
- {
- // skip exception strings
- while( *++ppStr ) ;
- }
- }
-
- return false;
-}
-
-// -----------------------------------------------------------------------
-
-static BOOL ImplFindAndErase( String& rName, const char* pStr )
-{
- xub_StrLen nPos = rName.SearchAscii( pStr );
- if ( nPos == STRING_NOTFOUND )
- return FALSE;
-
- const char* pTempStr = pStr;
- while ( *pTempStr )
- pTempStr++;
- rName.Erase( nPos, (xub_StrLen)(pTempStr-pStr) );
- return TRUE;
-}
-
-// =======================================================================
-
-void FontSubstConfiguration::getMapName( const String& rOrgName, String& rShortName,
- String& rFamilyName, FontWeight& rWeight, FontWidth& rWidth, ULONG& rType )
-{
- rShortName = rOrgName;
-
- // TODO: get rid of the crazy O(N*strlen) searches below
- // they should be possible in O(strlen)
-
- // Kill leading vendor names and other unimportant data
- ImplKillLeading( rShortName, aImplKillLeadingList );
-
- // Kill trailing vendor names and other unimportant data
- ImplKillTrailing( rShortName, aImplKillTrailingList );
- ImplKillTrailingWithExceptions( rShortName, aImplKillTrailingWithExceptionsList );
-
- rFamilyName = rShortName;
-
- // Kill attributes from the name and update the data
- // Weight
- const ImplFontAttrWeightSearchData* pWeightList = aImplWeightAttrSearchList;
- while ( pWeightList->mpStr )
- {
- if ( ImplFindAndErase( rFamilyName, pWeightList->mpStr ) )
- {
- if ( (rWeight == WEIGHT_DONTKNOW) || (rWeight == WEIGHT_NORMAL) )
- rWeight = pWeightList->meWeight;
- break;
- }
- pWeightList++;
- }
-
- // Width
- const ImplFontAttrWidthSearchData* pWidthList = aImplWidthAttrSearchList;
- while ( pWidthList->mpStr )
- {
- if ( ImplFindAndErase( rFamilyName, pWidthList->mpStr ) )
- {
- if ( (rWidth == WIDTH_DONTKNOW) || (rWidth == WIDTH_NORMAL) )
- rWidth = pWidthList->meWidth;
- break;
- }
- pWidthList++;
- }
-
- // Type
- rType = 0;
- const ImplFontAttrTypeSearchData* pTypeList = aImplTypeAttrSearchList;
- while ( pTypeList->mpStr )
- {
- if ( ImplFindAndErase( rFamilyName, pTypeList->mpStr ) )
- rType |= pTypeList->mnType;
- pTypeList++;
- }
-
- // Remove numbers
- // TODO: also remove localized and fullwidth digits
- xub_StrLen i = 0;
- while ( i < rFamilyName.Len() )
- {
- sal_Unicode c = rFamilyName.GetChar( i );
- if ( (c >= 0x0030) && (c <= 0x0039) )
- rFamilyName.Erase( i, 1 );
- else
- i++;
- }
-}
-
-
-struct StrictStringSort : public ::std::binary_function< const FontNameAttr&, const FontNameAttr&, bool >
-{
- bool operator()( const FontNameAttr& rLeft, const FontNameAttr& rRight )
- { return rLeft.Name.CompareTo( rRight.Name ) == COMPARE_LESS ; }
-};
-
-static const char* const pAttribNames[] =
-{
- "default",
- "standard",
- "normal",
- "symbol",
- "fixed",
- "sansserif",
- "serif",
- "decorative",
- "special",
- "italic",
- "title",
- "capitals",
- "cjk",
- "cjk_jp",
- "cjk_sc",
- "cjk_tc",
- "cjk_kr",
- "ctl",
- "nonelatin",
- "full",
- "outline",
- "shadow",
- "rounded",
- "typewriter",
- "script",
- "handwriting",
- "chancery",
- "comic",
- "brushscript",
- "gothic",
- "schoolbook",
- "other"
-};
-
-struct enum_convert
-{
- const char* pName;
- int nEnum;
-};
-
-
-static const enum_convert pWeightNames[] =
-{
- { "normal", WEIGHT_NORMAL },
- { "medium", WEIGHT_MEDIUM },
- { "bold", WEIGHT_BOLD },
- { "black", WEIGHT_BLACK },
- { "semibold", WEIGHT_SEMIBOLD },
- { "light", WEIGHT_LIGHT },
- { "semilight", WEIGHT_SEMILIGHT },
- { "ultrabold", WEIGHT_ULTRABOLD },
- { "semi", WEIGHT_SEMIBOLD },
- { "demi", WEIGHT_SEMIBOLD },
- { "heavy", WEIGHT_BLACK },
- { "unknown", WEIGHT_DONTKNOW },
- { "thin", WEIGHT_THIN },
- { "ultralight", WEIGHT_ULTRALIGHT }
-};
-
-static const enum_convert pWidthNames[] =
-{
- { "normal", WIDTH_NORMAL },
- { "condensed", WIDTH_CONDENSED },
- { "expanded", WIDTH_EXPANDED },
- { "unknown", WIDTH_DONTKNOW },
- { "ultracondensed", WIDTH_ULTRA_CONDENSED },
- { "extracondensed", WIDTH_EXTRA_CONDENSED },
- { "semicondensed", WIDTH_SEMI_CONDENSED },
- { "semiexpanded", WIDTH_SEMI_EXPANDED },
- { "extraexpanded", WIDTH_EXTRA_EXPANDED },
- { "ultraexpanded", WIDTH_ULTRA_EXPANDED }
-};
-
-void FontSubstConfiguration::fillSubstVector( const com::sun::star::uno::Reference< XNameAccess > xFont,
- const rtl::OUString& rType,
- std::vector< String >& rSubstVector ) const
-{
- try
- {
- Any aAny = xFont->getByName( rType );
- if( aAny.getValueTypeClass() == TypeClass_STRING )
- {
- const OUString* pLine = (const OUString*)aAny.getValue();
- sal_Int32 nIndex = 0;
- sal_Int32 nLength = pLine->getLength();
- if( nLength )
- {
- const sal_Unicode* pStr = pLine->getStr();
- sal_Int32 nTokens = 0;
- // count tokens
- while( nLength-- )
- {
- if( *pStr++ == sal_Unicode(';') )
- nTokens++;
- }
- rSubstVector.clear();
- // optimize performance, heap fragmentation
- rSubstVector.reserve( nTokens );
- while( nIndex != -1 )
- {
- OUString aSubst( pLine->getToken( 0, ';', nIndex ) );
- if( aSubst.getLength() )
- {
- UniqueSubstHash::iterator aEntry = maSubstHash.find( aSubst );
- if (aEntry != maSubstHash.end())
- aSubst = *aEntry;
- else
- maSubstHash.insert( aSubst );
- rSubstVector.push_back( aSubst );
- }
- }
- }
- }
- }
- catch( NoSuchElementException )
- {
- }
- catch( WrappedTargetException )
- {
- }
-}
-
-FontWeight FontSubstConfiguration::getSubstWeight( const com::sun::star::uno::Reference< XNameAccess > xFont,
- const rtl::OUString& rType ) const
-{
- int weight = -1;
- try
- {
- Any aAny = xFont->getByName( rType );
- if( aAny.getValueTypeClass() == TypeClass_STRING )
- {
- const OUString* pLine = (const OUString*)aAny.getValue();
- if( pLine->getLength() )
- {
- for( weight=sizeof(pWeightNames)/sizeof(pWeightNames[0])-1; weight >= 0; weight-- )
- if( pLine->equalsIgnoreAsciiCaseAscii( pWeightNames[weight].pName ) )
- break;
- }
-#if OSL_DEBUG_LEVEL > 1
- if( weight < 0 )
- fprintf( stderr, "Error: invalid weight %s\n",
- OUStringToOString( *pLine, RTL_TEXTENCODING_ASCII_US ).getStr() );
-#endif
- }
- }
- catch( NoSuchElementException )
- {
- }
- catch( WrappedTargetException )
- {
- }
- return (FontWeight)( weight >= 0 ? pWeightNames[weight].nEnum : WEIGHT_DONTKNOW );
-}
-
-FontWidth FontSubstConfiguration::getSubstWidth( const com::sun::star::uno::Reference< XNameAccess > xFont,
- const rtl::OUString& rType ) const
-{
- int width = -1;
- try
- {
- Any aAny = xFont->getByName( rType );
- if( aAny.getValueTypeClass() == TypeClass_STRING )
- {
- const OUString* pLine = (const OUString*)aAny.getValue();
- if( pLine->getLength() )
- {
- for( width=sizeof(pWidthNames)/sizeof(pWidthNames[0])-1; width >= 0; width-- )
- if( pLine->equalsIgnoreAsciiCaseAscii( pWidthNames[width].pName ) )
- break;
- }
-#if OSL_DEBUG_LEVEL > 1
- if( width < 0 )
- fprintf( stderr, "Error: invalid width %s\n",
- OUStringToOString( *pLine, RTL_TEXTENCODING_ASCII_US ).getStr() );
-#endif
- }
- }
- catch( NoSuchElementException )
- {
- }
- catch( WrappedTargetException )
- {
- }
- return (FontWidth)( width >= 0 ? pWidthNames[width].nEnum : WIDTH_DONTKNOW );
-}
-
-unsigned long FontSubstConfiguration::getSubstType( const com::sun::star::uno::Reference< XNameAccess > xFont,
- const rtl::OUString& rType ) const
-{
- unsigned long type = 0;
- try
- {
- Any aAny = xFont->getByName( rType );
- if( aAny.getValueTypeClass() == TypeClass_STRING )
- {
- const OUString* pLine = (const OUString*)aAny.getValue();
- if( pLine->getLength() )
- {
- sal_Int32 nIndex = 0;
- while( nIndex != -1 )
- {
- String aToken( pLine->getToken( 0, ',', nIndex ) );
- for( int k = 0; k < 32; k++ )
- if( aToken.EqualsIgnoreCaseAscii( pAttribNames[k] ) )
- {
- type |= 1 << k;
- break;
- }
- }
- }
- }
- }
- catch( NoSuchElementException )
- {
- }
- catch( WrappedTargetException )
- {
- }
-
- return type;
-}
-
-void FontSubstConfiguration::readLocaleSubst( const com::sun::star::lang::Locale& rLocale ) const
-{
- std::hash_map< Locale, LocaleSubst, LocaleHash >::const_iterator it =
- m_aSubst.find( rLocale );
- if( it != m_aSubst.end() )
- {
- if( ! it->second.bConfigRead )
- {
- it->second.bConfigRead = true;
- Reference< XNameAccess > xNode;
- try
- {
- Any aAny = m_xConfigAccess->getByName( it->second.aConfigLocaleString );
- aAny >>= xNode;
- }
- catch( NoSuchElementException )
- {
- }
- catch( WrappedTargetException )
- {
- }
- if( xNode.is() )
- {
- Sequence< OUString > aFonts = xNode->getElementNames();
- int nFonts = aFonts.getLength();
- const OUString* pFontNames = aFonts.getConstArray();
- // improve performance, heap fragmentation
- it->second.aSubstAttributes.reserve( nFonts );
-
- // strings for subst retrieval, construct only once
- OUString aSubstFontsStr ( RTL_CONSTASCII_USTRINGPARAM( "SubstFonts" ) );
- OUString aSubstFontsMSStr ( RTL_CONSTASCII_USTRINGPARAM( "SubstFontsMS" ) );
- OUString aSubstFontsPSStr ( RTL_CONSTASCII_USTRINGPARAM( "SubstFontsPS" ) );
- OUString aSubstFontsHTMLStr ( RTL_CONSTASCII_USTRINGPARAM( "SubstFontsHTML" ) );
- OUString aSubstWeightStr ( RTL_CONSTASCII_USTRINGPARAM( "FontWeight" ) );
- OUString aSubstWidthStr ( RTL_CONSTASCII_USTRINGPARAM( "FontWidth" ) );
- OUString aSubstTypeStr ( RTL_CONSTASCII_USTRINGPARAM( "FontType" ) );
- for( int i = 0; i < nFonts; i++ )
- {
- Reference< XNameAccess > xFont;
- try
- {
- Any aAny = xNode->getByName( pFontNames[i] );
- aAny >>= xFont;
- }
- catch( NoSuchElementException )
- {
- }
- catch( WrappedTargetException )
- {
- }
- if( ! xFont.is() )
- {
- #if OSL_DEBUG_LEVEL > 1
- fprintf( stderr, "did not get font attributes for %s\n",
- OUStringToOString( pFontNames[i], RTL_TEXTENCODING_UTF8 ).getStr() );
- #endif
- continue;
- }
-
- FontNameAttr aAttr;
- // read subst attributes from config
- aAttr.Name = pFontNames[i];
- fillSubstVector( xFont, aSubstFontsStr, aAttr.Substitutions );
- fillSubstVector( xFont, aSubstFontsMSStr, aAttr.MSSubstitutions );
- fillSubstVector( xFont, aSubstFontsPSStr, aAttr.PSSubstitutions );
- fillSubstVector( xFont, aSubstFontsHTMLStr, aAttr.HTMLSubstitutions );
- aAttr.Weight = getSubstWeight( xFont, aSubstWeightStr );
- aAttr.Width = getSubstWidth( xFont, aSubstWidthStr );
- aAttr.Type = getSubstType( xFont, aSubstTypeStr );
-
- // finally insert this entry
- it->second.aSubstAttributes.push_back( aAttr );
- }
- std::sort( it->second.aSubstAttributes.begin(), it->second.aSubstAttributes.end(), StrictStringSort() );
- }
- }
- }
-}
-
-const FontNameAttr* FontSubstConfiguration::getSubstInfo( const String& rFontName, const Locale& rLocale ) const
-{
- if( !rFontName.Len() )
- return NULL;
-
- // search if a (language dep.) replacement table for the given font exists
- // fallback is english
- String aSearchFont( rFontName );
- aSearchFont.ToLowerAscii();
- FontNameAttr aSearchAttr;
- aSearchAttr.Name = aSearchFont;
-
- Locale aLocale;
- aLocale.Language = rLocale.Language.toAsciiLowerCase();
- aLocale.Country = rLocale.Country.toAsciiUpperCase();
- aLocale.Variant = rLocale.Variant.toAsciiUpperCase();
-
- if( ! aLocale.Language.getLength() )
- aLocale = Application::GetSettings().GetUILocale();
-
- while( aLocale.Language.getLength() )
- {
- std::hash_map< Locale, LocaleSubst, LocaleHash >::const_iterator lang = m_aSubst.find( aLocale );
- if( lang != m_aSubst.end() )
- {
- if( ! lang->second.bConfigRead )
- readLocaleSubst( aLocale );
- // try to find an exact match
- // because the list is sorted this will also find fontnames of the form searchfontname*
- std::vector< FontNameAttr >::const_iterator it = ::std::lower_bound( lang->second.aSubstAttributes.begin(), lang->second.aSubstAttributes.end(), aSearchAttr, StrictStringSort() );
- if( it != lang->second.aSubstAttributes.end() && aSearchFont.CompareTo( it->Name, aSearchFont.Len() ) == COMPARE_EQUAL )
- return &(*it);
- }
- // gradually become more unspecific
- if( aLocale.Variant.getLength() )
- aLocale.Variant = OUString();
- else if( aLocale.Country.getLength() )
- aLocale.Country = OUString();
- else if( ! aLocale.Language.equalsAscii( "en" ) )
- aLocale.Language = OUString( RTL_CONSTASCII_USTRINGPARAM( "en" ) );
- else
- aLocale.Language = OUString();
- }
- return NULL;
-}
-
-/*
- * SettingsConfigItem::get
- */
-
-SettingsConfigItem* SettingsConfigItem::get()
-{
- ImplSVData* pSVData = ImplGetSVData();
- if( ! pSVData->mpSettingsConfigItem )
- pSVData->mpSettingsConfigItem = new SettingsConfigItem();
- return pSVData->mpSettingsConfigItem;
-}
-
-/*
- * SettignsConfigItem constructor
- */
-
-SettingsConfigItem::SettingsConfigItem()
- :
- ConfigItem( OUString( RTL_CONSTASCII_USTRINGPARAM( SETTINGS_CONFIGNODE ) ),
- CONFIG_MODE_DELAYED_UPDATE ),
- m_aSettings( 0 )
-{
- getValues();
-}
-
-/*
- * SettingsConfigItem destructor
- */
-
-SettingsConfigItem::~SettingsConfigItem()
-{
- if( IsModified() )
- Commit();
-}
-
-/*
- * SettingsConfigItem::Commit
- */
-
-void SettingsConfigItem::Commit()
-{
- if( ! IsValidConfigMgr() )
- return;
-
- std::hash_map< OUString, SmallOUStrMap, rtl::OUStringHash >::const_iterator group;
-
- for( group = m_aSettings.begin(); group != m_aSettings.end(); ++group )
- {
- String aKeyName( group->first );
- /*sal_Bool bAdded =*/ AddNode( OUString(), aKeyName );
- Sequence< PropertyValue > aValues( group->second.size() );
- PropertyValue* pValues = aValues.getArray();
- int nIndex = 0;
- SmallOUStrMap::const_iterator it;
- for( it = group->second.begin(); it != group->second.end(); ++it )
- {
- String aName( aKeyName );
- aName.Append( '/' );
- aName.Append( String( it->first ) );
- pValues[nIndex].Name = aName;
- pValues[nIndex].Handle = 0;
- pValues[nIndex].Value <<= it->second;
- pValues[nIndex].State = PropertyState_DIRECT_VALUE;
- nIndex++;
- }
- ReplaceSetProperties( aKeyName, aValues );
- }
-}
-
-/*
- * SettingsConfigItem::Notify
- */
-
-void SettingsConfigItem::Notify( const Sequence< OUString >& )
-{
- getValues();
-}
-
-/*
- * SettingsConfigItem::getValues
- */
-void SettingsConfigItem::getValues()
-{
- if( ! IsValidConfigMgr() )
- return;
-
- m_aSettings.clear();
-
- Sequence< OUString > aNames( GetNodeNames( OUString() ) );
- m_aSettings.resize( aNames.getLength() );
-
- for( int j = 0; j < aNames.getLength(); j++ )
- {
-#if OSL_DEBUG_LEVEL > 2
- fprintf( stderr, "found settings data for \"%s\"\n",
- OUStringToOString( aNames.getConstArray()[j], RTL_TEXTENCODING_ASCII_US ).getStr()
- );
-#endif
- String aKeyName( aNames.getConstArray()[j] );
- Sequence< OUString > aKeys( GetNodeNames( aKeyName ) );
- Sequence< OUString > aSettingsKeys( aKeys.getLength() );
- const OUString* pFrom = aKeys.getConstArray();
- OUString* pTo = aSettingsKeys.getArray();
- for( int m = 0; m < aKeys.getLength(); m++ )
- {
- String aName( aKeyName );
- aName.Append( '/' );
- aName.Append( String( pFrom[m] ) );
- pTo[m] = aName;
- }
- Sequence< Any > aValues( GetProperties( aSettingsKeys ) );
- const Any* pValue = aValues.getConstArray();
- for( int i = 0; i < aValues.getLength(); i++, pValue++ )
- {
- if( pValue->getValueTypeClass() == TypeClass_STRING )
- {
- const OUString* pLine = (const OUString*)pValue->getValue();
- if( pLine->getLength() )
- m_aSettings[ aKeyName ][ pFrom[i] ] = *pLine;
-#if OSL_DEBUG_LEVEL > 2
- fprintf( stderr, " \"%s\"=\"%.30s\"\n",
- OUStringToOString( aKeys.getConstArray()[i], RTL_TEXTENCODING_ASCII_US ).getStr(),
- OUStringToOString( *pLine, RTL_TEXTENCODING_ASCII_US ).getStr()
- );
-#endif
- }
- }
- }
-}
-
-/*
- * SettingsConfigItem::getDefaultFont
- */
-
-const OUString& SettingsConfigItem::getValue( const OUString& rGroup, const OUString& rKey ) const
-{
- ::std::hash_map< OUString, SmallOUStrMap, rtl::OUStringHash >::const_iterator group = m_aSettings.find( rGroup );
- if( group == m_aSettings.end() || group->second.find( rKey ) == group->second.end() )
- {
- static OUString aEmpty;
- return aEmpty;
- }
- return group->second.find(rKey)->second;
-}
-
-/*
- * SettingsConfigItem::setDefaultFont
- */
-
-void SettingsConfigItem::setValue( const OUString& rGroup, const OUString& rKey, const OUString& rValue )
-{
- bool bModified = m_aSettings[ rGroup ][ rKey ] != rValue;
- if( bModified )
- {
- m_aSettings[ rGroup ][ rKey ] = rValue;
- SetModified();
- }
-}
-
diff --git a/vcl/source/gdi/fontcvt.cxx b/vcl/source/gdi/fontcvt.cxx
deleted file mode 100644
index 565c92740dad..000000000000
--- a/vcl/source/gdi/fontcvt.cxx
+++ /dev/null
@@ -1,1528 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: fontcvt.cxx,v $
- * $Revision: 1.24 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_vcl.hxx"
-#include <vcl/fontcvt.hxx>
-#include <vcl/outdev.h>
-
-#ifndef _STLP_MAP
-#include <map>
-#endif
-#ifndef _STLP_VECTOR
-#include <vector>
-#endif
-#ifndef _STLP_ALGORITHM
-#include <algorithm>
-#endif
-#ifndef _STLP_FUNCTIONAL
-#include <functional>
-#endif
-
-//=======================================================================
-// note: the character mappings that are only approximations
-// are marked (with an empty comment)
-
-static const sal_Unicode aStarBatsTab[224] =
-{
- // F020
- 0x0020, 0x263a, 0x25cf, 0x274d,
- 0x25a0, 0x25a1, 0xE000, 0x2751,
- 0x2752, 0xE001, 0xE002, 0xE003,
- 0x2756, 0xE004, 0xE005, 0x27a2,
- // F030
- 0xE006, 0x2794, 0x2713, 0x2612,
- 0x2611, 0x27b2, 0x261b, 0x270d,
- 0x270e, 0xE007, 0x2714, 0xE008,
- 0xE009, 0xE00A, 0x274f, 0x2750,
- // F040
- 0xE00B, 0xE00C, 0xE00D, 0xE00E,
- 0x2722, 0x2723, 0x2724, 0x2725,
- 0x2733, 0x2734, 0x2735, 0x2736,
- 0x2737, 0x2738, 0x2739, 0x2717,
- // F050
- 0x2718, 0x2719, 0x271a, 0x271b,
- 0x271c, 0x272b, 0x272c, 0x272d,
- 0x272e, 0x272f, 0x2730, 0,
- 0xE00F, 0x278a, 0x278b, 0x278c,
- // F060
- 0x278d, 0x278e, 0x278f, 0x2790,
- 0x2791, 0x2792, 0x2793, 0xE010,
- 0x2780, 0x2781, 0x2782, 0x2783,
- 0x2784, 0x2785, 0x2786, 0x2787,
- // F070
- 0x2788, 0x2789, 0xE011, 0xE012,
- 0x260e, 0xE013, 0xE014, 0xE015,
- 0xE016, 0xE017, 0xE018, 0xE019,
- 0xE01A, 0x261e, 0xE01B, 0,
- // F080
- 0x20ac, 0, 0x201a, 0x0192,
- 0x201e, 0x2026, 0x2020, 0x2021,
- 0xE01c, 0x2030, 0x0160, 0x2039,
- 0x0152, 0, 0x017d, 0,
- // F090
- 0, 0x2018, 0x2019, 0x201c,
- 0x201d, 0x2022, 0x2013, 0x2014,
- 0xE01d, 0x2122, 0x0161, 0x203a,
- 0x0153, 0, 0x017e, 0x0178,
- // F0A0
- 0, 0x21e7, 0x21e8, 0x21e9,
- 0x21e6, 0xE01e, 0xE01f, 0x00a7,
- 0xE020, 0xE021, 0xE022, 0x00ab,
- 0xE023, 0x2639, 0xE024, 0xE025,
- // F0B0
- 0xE026, 0xE027, 0xE028, 0x21e5,
- 0x21e4, 0x2192, 0x2193, 0x2190,
- 0x2191, 0xE029, 0xE02a, 0x00bb,
- 0xE02b, 0xE02c, 0xE02d, 0xE02e,
- // F0C0
- 0xE02f, 0xE030, 0xE031, 0xE032,
- 0x25be, 0x25b4, 0x25bf, 0x25b5,
- 0xE033, 0xE034, 0xE035, 0x2702,
- 0x2708, 0x2721, 0x273f, 0x2744,
- // F0D0
- 0x25d7, 0x2759, 0xE036, 0xE037,
- 0x2762, 0x2663, 0x2665, 0x2660,
- 0x2194, 0x2195, 0x2798, 0x279a,
- 0x27b8, 0, 0x00b6, 0,
- // F0E0
- 0x00a2, 0x00a4, 0x00a5, 0xE038,
- 0x20a1, 0x20a2, 0x20a3, 0x20a4,
- 0x20a9, 0x20ab, 0x20a8, 0xE039,
- 0, 0, 0, 0,
- // F0F0
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0xE03a
-};
-
-// -----------------------------------------------------------------------
-
-static const sal_Unicode aStarMathTab[224] =
-{
- // F020
- 0x0020, 0x0021, 0x0022, 0x0023,
- 0xE080, 0x0025, 0x0026, 0x221e,
- 0x0028, 0x0029, 0x002a, 0x002b,
- 0x002c, 0x002d, 0x002e, 0x002f,
- // F030
- 0x2224, 0x21d2, 0x21d0, 0x21d4,
- 0xE081, 0xE082, 0x00b0, 0,
- 0, 0, 0x003a, 0x003b,
- 0x003c, 0x003d, 0x003e, 0x00bf,
- // F040
- 0x2260, 0xE083, 0x2212, 0x2217,
- 0x00d7, 0x22c5, 0x00f7, 0x00b1,
- 0x2213, 0x2295, 0x2296, 0x2297,
- 0x2298, 0x2299, 0x222a, 0x2229,
- // F050
- 0xE084, 0xE085, 0x2264, 0x2265,
- 0xE086, 0xE087, 0x226a, 0x226b,
- 0x007e, 0x2243, 0x2248, 0x225d,
- 0x2261, 0x221d, 0x2202, 0x2282,
- // F060
- 0x2283, 0x2286, 0x2287, 0x2284,
- 0x2285, 0x2288, 0x2289, 0x2208,
- 0x2209, 0xE089, 0x2203, 0x220d,
- 0x2135, 0x2111, 0x211c, 0x2118,
- // F070
- 0xE08a, 0x2221, 0x2222, 0x2223,
- 0x2225, 0x22a5, 0xE08b, 0x22ef,
- 0x22ee, 0x22f0, 0x22f1, 0x22b6,
- 0x22b7, 0xE08c, 0x2216, 0x00ac,
- // F080
- 0x222b, 0x222c, 0x222d, 0x222e,
- 0x222f, 0x2230, 0x221a, 0xE08d,
- 0xE08e, 0xE08f, 0x2210, 0x220f,
- 0x2211, 0x2207, 0x2200, 0xE090,
- // F090
- 0xE091, 0xE092, 0xE093, 0xE094,
- 0xE095, 0xE096, 0xE097, 0xE098,
- 0x02d9, 0x00a8, 0xE09b, 0x02da,
- 0x2227, 0x2228, 0x220b, 0x2205,
- // F0A0
- 0x007b, 0x007d, 0xe09e, 0xe09f,
- 0x2329, 0x232a, 0x005b, 0x005d,
- 0xE0a0, 0x22be, 0xE0a1, 0x2259,
- 0x2254, 0x2255, 0x21b3, 0x2197,
- // F0B0
- 0x2198, 0x2245, 0x301a, 0x301b,
- 0x2373, 0xE0a5, 0xE0a6, 0x22a4,
- 0x2112, 0x2130, 0x2131, 0,
- 0xE0a7, 0xE0a8, 0xE0a9, 0xE0aa,
- // F0C0
- 0x2308, 0x230a, 0x2309, 0x230b,
- 0, 0xe0ab, 0xe0ac, 0xe0ad,
- 0xe0ae, 0xe0af, 0xe0b0, 0xe0b1,
- 0xe0b2, 0xe0b3, 0xe0b4, 0xe0b5,
- // F0D0
- 0xe0b6, 0xe0b7, 0xe0b8, 0xe0b9,
- 0xe0ba, 0xe0bb, 0xe0bc, 0xe0bd,
- 0xe0be, 0xe0bf, 0xe0c0, 0xe0c1,
- 0xe0c2, 0xe0c3, 0xe0c4, 0xe0c5,
- // F0E0
- 0xe0c6, 0xe0c7, 0xe0c8, 0xe0c9,
- 0xe0ca, 0xe0cb, 0xe0cc, 0xe0cd,
- 0xe0ce, 0xe0cf, 0xe0d0, 0xe0d1,
- 0x03f1, 0xe0d3, 0xe0d4, 0xe0d5,
- // F0F0
- 0x2113, 0xe0d6, 0x2107, 0x2127,
- 0x210a, 0xe0d9, 0x210f, 0x019b,
- 0xe0db, 0xe0dc, 0xe0dd, 0x2115,
- 0x2124, 0x211a, 0x211d, 0x2102
-};
-
-// -----------------------------------------------------------------------
-
-static const sal_Unicode aWingDingsTab[224] =
-{
- // F020
- 0x0020, 0xe400, 0xe401, 0xe402,
- 0xe403, 0xe404, 0xe405, 0xe406,
- 0xe407, 0xe408, 0xe409, 0xe40a,
- 0xe40b, 0xe40c, 0xe40d, 0xe40e,
- // F030
- 0xe40f, 0xe410, 0xe411, 0xe412,
- 0xe413, 0xe414, 0xe415, 0xe416,
- 0xe417, 0xe418, 0xe419, 0xe41a,
- 0xe41b, 0xe41c, 0x2707, 0xe41d,
- // F040
- 0xe41e, 0xe41f, 0xe420, 0xe421,
- 0x261c, 0xe423, 0x261d, 0x261f,
- 0x261f, 0xe424, 0xe425, 0xe426,
- 0xe427, 0xe428, 0xe429, 0xe42a,
- // F050
- 0xe42b, 0xe42c, 0x263c, 0xe42d,
- 0xe42e, 0xe42f, 0xe430, 0xe431,
- 0xe432, 0xe433, 0x262a, 0x262f,
- 0x0950, 0xe434, 0x2648, 0x2649,
- // F060
- 0x264a, 0x264b, 0x264c, 0x264d,
- 0x264e, 0x264f, 0x2650, 0x2651,
- 0x2652, 0x2653, 0xe435, 0xe436,
- 0xe437, 0xe438, 0xe439, 0xe43a,
- // F070
- 0xe43b, 0xe43c, 0xe43d, 0xe43e,
- 0xe43f, 0xe440, 0xe441, 0xe442,
- 0xe443, 0x2353, 0x2318, 0xe444,
- 0xe445, 0xe446, 0xe447, 0,
- // F080
- 0xe448, 0xe449, 0xe44a, 0xe44b,
- 0xe44c, 0xe44d, 0xe44e, 0xe44f,
- 0xe450, 0xe451, 0xe452, 0xe453,
- 0xe454, 0xe455, 0xe456, 0xe457,
- // F090
- 0xe458, 0xe459, 0xe45a, 0xe45b,
- 0xe45c, 0xe45d, 0xe45e, 0xe45f,
- 0xe460, 0xe461, 0xe462, 0xe463,
- 0xe464, 0xe465, 0xe466, 0xe467,
- // F0a0
- 0xe468, 0xe469, 0xe46a, 0xe46b,
- 0xe46c, 0xe46d, 0xe46e, 0xe46f,
- 0xe470, 0xe471, 0xe472, 0xe473,
- 0xe474, 0xe475, 0xe476, 0xe477,
- // F0b0
- 0xe478, 0xe479, 0xe47a, 0xe47b,
- 0xe47c, 0xe47d, 0xe47e, 0xe47f,
- 0xe480, 0xe481, 0xe482, 0xe483,
- 0xe484, 0xe485, 0xe486, 0xe487,
- // F0c0
- 0xe488, 0xe489, 0xe48a, 0xe48b,
- 0xe48c, 0xe48d, 0xe48e, 0xe48f,
- 0xe490, 0xe491, 0xe492, 0xe493,
- 0xe494, 0xe495, 0xe496, 0xe497,
- // F0d0
- 0xe498, 0xe499, 0xe49a, 0xe49b,
- 0xe49c, 0x232b, 0x2326, 0xe49d,
- 0xe49e, 0xe49f, 0xe4a0, 0xe4a1,
- 0xe4a2, 0xe4a3, 0xe4a4, 0xe4a5,
- // F0e0
- 0xe4a6, 0xe4a7, 0xe4a8, 0xe4a9,
- 0xe4aa, 0xe4ab, 0xe4ac, 0xe4ad,
- 0xe4ae, 0xe4af, 0xe4b0, 0xe4b1,
- 0xe4b2, 0xe4b3, 0xe4b4, 0xe4b5,
- // F0f0
- 0xe4b6, 0xe4b7, 0xe4b8, 0xe4b9,
- 0xe4ba, 0xe4bb, 0xe4bc, 0xe4bd,
- 0xe4be, 0xe4bf, 0xe4c0, 0xe4c1,
- 0xe4c2, 0xe4c3, 0xe4c4, 0xe4c5
-};
-
-// -----------------------------------------------------------------------
-
-static const sal_Unicode aWingDings2Tab[224] =
-{
- // F020
- 0x0020, 0xe500, 0xe501, 0xe502,
- 0xe503, 0xe504, 0xe505, 0xe506,
- 0xe507, 0xe508, 0xe509, 0xe50a,
- 0xe50b, 0xe50c, 0xe50d, 0xe50e,
- // F030
- 0xe50f, 0xe510, 0xe511, 0xe512,
- 0xe513, 0xe514, 0xe515, 0xe516,
- 0xe517, 0xe518, 0xe519, 0xe51a,
- 0xe51b, 0xe51c, 0xe51d, 0xe51e,
- // F040
- 0xe51f, 0xe520, 0xe521, 0xe522,
- 0xe523, 0xe524, 0xe525, 0xe526,
- 0xe527, 0xe528, 0xe529, 0xe52a,
- 0xe52b, 0xe52c, 0xe52d, 0xe52e,
- // F050
- 0xe52f, 0xe530, 0xe531, 0xe532,
- 0xe533, 0xe534, 0xe535, 0xe536,
- 0xe537, 0xe538, 0xe539, 0xe53a,
- 0xe53b, 0xe53c, 0xe53d, 0xe53e,
- // F060
- 0xe53f, 0xe540, 0xe541, 0xe542,
- 0xe543, 0xe544, 0xe545, 0xe546,
- 0xe547, 0xe548, 0xe549, 0xe54a,
- 0xe54b, 0xe54c, 0xe54d, 0xe54e,
- // F070
- 0xe54e, 0xe54f, 0xe550, 0xe551,
- 0xe552, 0xe553, 0xe554, 0xe555,
- 0xe556, 0xe557, 0xe558, 0xe559,
- 0xe55a, 0xe55b, 0xe55c, 0,
- // F080
- 0x2609, 0x25cb, 0x263d, 0x263e,
- 0xe55d, 0xe55e, 0xe55f, 0xe560,
- 0xe561, 0xe562, 0xe563, 0xe564,
- 0xe565, 0xe566, 0xe567, 0xe568,
- // F090
- 0xe569, 0xe56a, 0xe56b, 0xe56c,
- 0xe56d, 0xe56e, 0xe56f, 0xe570,
- 0xe571, 0xe572, 0xe573, 0xe574,
- 0xe575, 0xe576, 0xe577, 0xe578,
- // F0a0
- 0xe579, 0xe57a, 0xe57b, 0xe57c,
- 0xe57d, 0xe57e, 0xe57f, 0xe580,
- 0xe581, 0xe582, 0xe583, 0xe584,
- 0xe585, 0xe586, 0xe587, 0xe588,
- // F0b0
- 0xe589, 0xe58a, 0xe58b, 0xe58c,
- 0xe58d, 0xe58e, 0xe58f, 0xe590,
- 0xe591, 0xe592, 0xe593, 0xe594,
- 0xe595, 0xe596, 0xe597, 0xe598,
- // F0c0
- 0xe599, 0xe59a, 0xe59b, 0xe59c,
- 0xe59d, 0xe59e, 0xe59f, 0xe5a0,
- 0xe5a1, 0xe5a2, 0xe5a3, 0xe5a4,
- 0xe5a5, 0xe5a6, 0xe5a7, 0xe5a8,
- // F0d0
- 0xe5a9, 0xe5aa, 0xe5ab, 0xe5ac,
- 0xe5ad, 0xe5ae, 0xe5af, 0xe5b0,
- 0xe5b1, 0xe5b2, 0xe5b3, 0xe5b4,
- 0xe5b5, 0xe5b6, 0xe5b7, 0xe5b8,
- // F0e0
- 0xe5b9, 0xe5ba, 0xe5bb, 0xe5bc,
- 0xe5bd, 0xe5be, 0xe5bf, 0xe5c0,
- 0xe5c1, 0xe5c2, 0xe5c3, 0xe5c4,
- 0xe5c5, 0xe5c6, 0xe5c7, 0xe5c8,
- // F0f0
- 0xe5c9, 0xe5ca, 0xe5cb, 0xe5cc,
- 0xe5cd, 0xe5ce, 0xe5cf, 0xe5d0,
- 0x203b, 0x2042, 0, 0,
- 0, 0, 0, 0
-};
-
-// -----------------------------------------------------------------------
-
-static const sal_Unicode aWingDings3Tab[224] =
-{
- // F020
- 0x0020, 0xe600, 0xe601, 0xe602,
- 0xe603, 0x2196, 0xe604, 0x2199,
- 0xe605, 0xe606, 0xe607, 0xe608,
- 0xe609, 0xe60a, 0xe60b, 0x21de,
- // F030
- 0x21df, 0xe60c, 0xe60d, 0xe60e,
- 0x21e2, 0x21e1, 0x21e3, 0x21af,
- 0x21b5, 0xe60f, 0xe610, 0xe611,
- 0xe612, 0xe613, 0xe614, 0xe615,
- // F040
- 0xe616, 0xe617, 0xe618, 0xe619,
- 0x21c4, 0x21c5, 0xe61a, 0xe61b,
- 0x21c7, 0x21c9, 0x21c8, 0x21ca,
- 0x21b6, 0x21b7, 0xe61c, 0xe61d,
- // F050
- 0x21bb, 0x21ba, 0xe61e, 0x2324,
- 0x2303, 0x2325, 0x2334, 0xe61f,
- 0x21ea, 0xe620, 0xe621, 0xe622,
- 0xe623, 0xe624, 0xe625, 0xe626,
- // F060
- 0xe627, 0xe628, 0xe629, 0xe62a,
- 0xe62b, 0xe62c, 0xe62d, 0xe62e,
- 0xe62f, 0xe630, 0xe631, 0xe632,
- 0xe633, 0xe634, 0xe635, 0xe636,
- // F070
- 0xe637, 0xe638, 0x25b3, 0x25bd,
- 0x25c0, 0x25b6, 0x25c1, 0x25b7,
- 0x25e3, 0xe639, 0x25e4, 0x25e5,
- 0x25c2, 0x25b8, 0xe63a, 0,
- // F080
- 0xe63b, 0xe63c, 0xe63d, 0xe63e,
- 0xe63f, 0xe640, 0xe641, 0xe642,
- 0xe643, 0xe644, 0xe645, 0xe646,
- 0xe647, 0xe648, 0xe649, 0xe64a,
- // F090
- 0xe64b, 0xe64c, 0xe64d, 0xe64e,
- 0xe64f, 0xe650, 0xe651, 0xe652,
- 0xe653, 0xe654, 0xe655, 0xe656,
- 0xe657, 0xe658, 0xe659, 0xe65a,
- // F0a0
- 0xe65b, 0xe65c, 0xe65d, 0xe65e,
- 0xe65f, 0xe660, 0xe661, 0xe662,
- 0xe663, 0xe664, 0xe665, 0xe666,
- 0xe667, 0xe668, 0xe669, 0xe66a,
- // F0b0
- 0xe66b, 0xe66c, 0xe66d, 0xe66e,
- 0xe66f, 0xe670, 0xe671, 0xe672,
- 0xe673, 0xe674, 0xe675, 0xe676,
- 0xe677, 0xe678, 0xe679, 0xe67a,
- // F0c0
- 0xe67b, 0xe67c, 0xe67d, 0xe67e,
- 0xe67f, 0xe680, 0xe681, 0xe682,
- 0xe683, 0xe684, 0xe685, 0xe686,
- 0xe687, 0xe688, 0xe689, 0xe68a,
- // F0d0
- 0xe68b, 0xe68c, 0xe68d, 0xe68e,
- 0xe68f, 0xe690, 0xe691, 0xe692,
- 0xe693, 0xe694, 0xe695, 0xe696,
- 0xe697, 0xe698, 0xe699, 0xe69a,
- // F0e0
- 0xe69b, 0xe69c, 0xe69d, 0xe69e,
- 0xe69f, 0xe6a0, 0xe6a1, 0xe6a2,
- 0xe6a3, 0xe6a4, 0xe6a5, 0xe6a6,
- 0xe6a7, 0xe6a8, 0xe6a9, 0xe6aa,
- // F0f0
- 0xe6ab, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0
-};
-
-// -----------------------------------------------------------------------
-
-static const sal_Unicode aWebDingsTab[224] =
-{
- // F020
- 0x0020, 0xe300, 0xe301, 0xe302,
- 0xe303, 0xe304, 0xe305, 0xe306,
- 0xe307, 0xe308, 0xe309, 0xe30a,
- 0xe30b, 0xe30c, 0xe30d, 0xe30e,
- // F030
- 0xe30f, 0xe310, 0xe311, 0xe312,
- 0xe313, 0xe314, 0xe315, 0xe316,
- 0xe317, 0xe318, 0xe319, 0xe31a,
- 0xe31b, 0xe31c, 0xe31d, 0xe31e,
- // F040
- 0xe31f, 0xe320, 0xe321, 0xe322,
- 0xe323, 0xe324, 0xe325, 0xe326,
- 0xe327, 0xe328, 0xe329, 0xe32a,
- 0xe32b, 0xe32c, 0xe32d, 0xe32e,
- // F050
- 0xe32f, 0xe330, 0xe331, 0xe332,
- 0xe333, 0xe334, 0xe335, 0xe336,
- 0xe337, 0xe338, 0xe339, 0xe33a,
- 0xe33b, 0xe33c, 0xe33d, 0xe33e,
- // F060
- 0xe33f, 0xe340, 0xe341, 0xe342,
- 0xe343, 0xe344, 0xe345, 0xe346,
- 0xe347, 0xe348, 0xe349, 0xe34a,
- 0xe34b, 0xe34c, 0xe34d, 0xe34e,
- // F070
- 0xe34f, 0xe350, 0xe351, 0xe352,
- 0xe353, 0xe354, 0xe355, 0xe356,
- 0xe357, 0xe358, 0xe359, 0xe35a,
- 0xe35b, 0xe35c, 0xe35d, 0,
- // F080
- 0xe35e, 0xe35f, 0xe360, 0xe361,
- 0xe362, 0xe363, 0xe364, 0xe365,
- 0xe366, 0xe367, 0xe368, 0xe369,
- 0xe36a, 0xe36b, 0xe36c, 0xe36d,
- // F090
- 0xe36e, 0xe36f, 0xe370, 0xe371,
- 0xe372, 0xe373, 0xe374, 0xe375,
- 0xe376, 0xe377, 0xe378, 0xe379,
- 0xe37a, 0xe37b, 0xe37c, 0xe37d,
- // F0a0
- 0xe37e, 0xe37f, 0xe380, 0xe381,
- 0xe382, 0xe383, 0xe384, 0xe385,
- 0xe386, 0xe387, 0xe388, 0xe389,
- 0xe38a, 0xe38b, 0xe38c, 0xe38d,
- // F0b0
- 0xe38e, 0xe38f, 0xe390, 0xe391,
- 0xe392, 0xe393, 0xe394, 0xe395,
- 0xe396, 0xe397, 0xe398, 0xe399,
- 0xe39a, 0xe39b, 0xe39c, 0xe39d,
- // F0c0
- 0xe39e, 0xe39f, 0xe3a0, 0xe3a1,
- 0xe3a2, 0xe3a3, 0xe3a4, 0xe3a5,
- 0xe3a6, 0xe3a7, 0xe3a8, 0xe3a9,
- 0xe3aa, 0xe3ab, 0xe3ac, 0xe3ad,
- // F0d0
- 0xe3ae, 0xe3af, 0xe3b0, 0xe3b1,
- 0xe3b2, 0xe3b3, 0xe3b4, 0xe3b5,
- 0xe3b6, 0xe3b7, 0xe3b8, 0xe3b9,
- 0xe3ba, 0xe3bb, 0xe3bc, 0xe3bd,
- // F0e0
- 0xe3be, 0xe3bf, 0xe3c0, 0xe3c1,
- 0xe3c2, 0xe3c3, 0xe3c4, 0xe3c5,
- 0xe3c6, 0xe3c7, 0xe3c8, 0xe3c9,
- 0xe3ca, 0xe3cb, 0xe3cd, 0xe3ce,
- // F0f0
- 0xe3cf, 0xe3d0, 0xe3d1, 0xe3d2,
- 0xe3d3, 0xe3d4, 0xe3d5, 0xe3d6,
- 0xe3d7, 0xe3d8, 0xe3d9, 0xe3da,
- 0xe3db, 0xe3dc, 0xe3dd, 0xe3de
-};
-
-// -----------------------------------------------------------------------
-
-static const sal_Unicode aAdobeSymbolTab[224] =
-{
-//TODO:
- // F020
- 0x0020, 0xe100, 0xe101, 0xe102,
- 0xe103, 0xe104, 0xe16a, 0xe105,
- 0xe106, 0xe107, 0xe108, 0xe109,
- 0xe10a, 0xe10b, 0xe10c, 0xe10d,
- // F030
- 0x0030, 0x0031, 0x0032, 0x0033,
- 0x0034, 0x0035, 0x0036, 0x0037,
- 0x0038, 0x0039, 0xe10e, 0xe10f,
- 0xe110, 0xe111, 0xe112, 0x003f,
- // F040
- 0xe113, 0x0391, 0x0392, 0x03a7,
- 0x0394, 0x0395, 0x03a6, 0x0393,
- 0x0397, 0x0399, 0x03d1, 0x039a,
- 0x039b, 0x039c, 0x039d, 0x039f,
- // F050
- 0x03a0, 0x0398, 0x03a1, 0x03a3,
- 0x03a4, 0x03a5, 0x03c2, 0x03a9,
- 0x039e, 0x03a8, 0x0396, 0xe114,
- 0x2234, 0xe115, 0xe116, 0x005f,
- // F060
- 0x00af, 0x03b1, 0x03b2, 0x03c7,
- 0x03b4, 0x03b5, 0x03d5, 0x03b3,
- 0x03b7, 0x03b9, 0x03c6, 0x03ba,
- 0x03bb, 0x03bc, 0x03bd, 0x03bf,
- // F070
- 0x03c0, 0x03b8, 0x03c1, 0x03c3,
- 0x03c4, 0x03c5, 0x03d6, 0x03c9,
- 0x03be, 0x03c8, 0x03b6, 0xe117,
- 0x007c, 0xe118, 0xe119, 0,
- // F080
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- // F090
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- // F0a0
- 0xe11a, 0x03d2, 0x0384, 0xe11b,
- 0x2215, 0xe11c, 0xe11d, 0xe11e,
- 0x2666, 0xe11f, 0xe120, 0xe121,
- 0xe122, 0xe123, 0xe124, 0xe125,
- // F0b0
- 0xe126, 0xe127, 0x2033, 0xe128,
- 0xe129, 0xe12a, 0xe12b, 0xe12c,
- 0xe12d, 0xe12e, 0xe12f, 0xe130,
- 0xe131, 0x2502, 0x2500, 0x21b2,
- // F0c0
- 0xe132, 0xe133, 0xe134, 0xe135,
- 0xe136, 0xe137, 0xe138, 0xe139,
- 0xe13a, 0xe13b, 0xe13c, 0xe13d,
- 0xe13e, 0xe13f, 0xe140, 0xe141,
- // F0d0
- 0x2220, 0xe142, 0x00ae, 0x00a9,
- 0xe143, 0xe144, 0xe145, 0xe146,
- 0xe147, 0xe148, 0xe149, 0xe14a,
- 0xe14b, 0x21d1, 0xe14c, 0x21d3,
- // F0e0
- 0x25ca, 0xe14d, 0xe14e, 0xe14f,
- 0xe150, 0xe151, 0xe152, 0xe153,
- 0xe154, 0xe155, 0xe156, 0xe157,
- 0xe158, 0xe159, 0xe15a, 0xe15b,
- // F0f0
- 0, 0xe15c, 0xe15d, 0xe15e,
- 0xe15f, 0xe160, 0xe161, 0xe162,
- 0xe163, 0xe164, 0xe165, 0xe166,
- 0xe167, 0xe168, 0xe169, 0,
-};
-
-// -----------------------------------------------------------------------
-
-static const sal_Unicode aMonotypeSortsTab[224] =
-{
- // F020
- 0x0020, 0x2701, 0xe200, 0x2703,
- 0x2704, 0xe201, 0x2706, 0xe202,
- 0xe203, 0xe203, 0xe204, 0xe205,
- 0x270c, 0xe206, 0xe207, 0xe208,
- // F030
- 0x2710, 0x2711, 0x2712, 0xe209,
- 0xe20a, 0x2715, 0x2716, 0xe20b,
- 0xe20c, 0xe20d, 0xe20e, 0xe20f,
- 0xe210, 0x271d, 0x271e, 0x271f,
- // F040
- 0x2720, 0xe211, 0xe212, 0xe213,
- 0xe214, 0xe215, 0x2726, 0x2727,
- 0x2605, 0x2729, 0x272a, 0xe216,
- 0xe217, 0xe218, 0xe219, 0xe21a,
- // F050
- 0xe21b, 0xe21c, 0x2732, 0xe21d,
- 0xe21e, 0xe21f, 0xe220, 0xe221,
- 0xe222, 0xe223, 0x273a, 0x273b,
- 0x273c, 0x273d, 0x273e, 0xe224,
- // F060
- 0x2740, 0x2741, 0x2742, 0x2743,
- 0xe225, 0x2745, 0x2746, 0x2747,
- 0x2748, 0x2749, 0x274a, 0x274b,
- 0xe226, 0xe227, 0xe228, 0xe229,
- // F070
- 0xe22a, 0xe22b, 0xe22c, 0x25b2,
- 0x25bc, 0xe22d, 0xe22e, 0xe22f,
- 0x2758, 0xe230, 0x275a, 0x275b,
- 0x275c, 0x275d, 0x275e, 0,
- // F080
- 0xe231, 0xe232, 0xe233, 0xe234,
- 0xe235, 0xe236, 0xe237, 0xe238,
- 0xe239, 0xe23a, 0xe23b, 0xe23c,
- 0xe23d, 0xe23e, 0, 0,
- // F090
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- // F0a0
- 0, 0xe23f, 0xe240, 0x2763,
- 0x2764, 0x2765, 0x2766, 0x2767,
- 0xe241, 0xe242, 0xe243, 0xe244,
- 0x2460, 0x2461, 0x2462, 0x2463,
- // F0b0
- 0x2464, 0x2465, 0x2466, 0x2467,
- 0x2468, 0x2469, 0x2776, 0x2777,
- 0x2778, 0x2779, 0x277a, 0x277b,
- 0x277c, 0x277d, 0x277e, 0x277f,
- // F0c0
- 0xe245, 0xe246, 0xe247, 0xe248,
- 0xe249, 0xe24a, 0xe24b, 0xe24c,
- 0xe24d, 0xe24e, 0xe24f, 0xe250,
- 0xe251, 0xe252, 0xe253, 0xe254,
- // F0d0
- 0xe255, 0xe256, 0xe257, 0xe258,
- 0xe259, 0xe25a, 0xe25b, 0xe25c,
- 0xe25d, 0x2799, 0xe25e, 0x279b,
- 0x279c, 0x279d, 0x279e, 0x279f,
- // F0e0
- 0x27a0, 0x27a1, 0xe25f, 0x27a3,
- 0x27a4, 0x27a5, 0x27a6, 0x27a7,
- 0x27a8, 0x27a9, 0x27aa, 0x27ab,
- 0x27ac, 0x27ad, 0x27ae, 0x27af,
- // F0f0
- 0, 0x27b1, 0xe260, 0x27b3,
- 0x27b4, 0x27b5, 0x27b6, 0x27b7,
- 0xe261, 0x27b9, 0x27ba, 0x27bb,
- 0x27bc, 0x27bd, 0x27be, 0,
-};
-
-// -----------------------------------------------------------------------
-
-/*
-static const sal_Unicode aMonotypeSorts2Tab[224] =
-{
-//TODO:
- // F020
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- // F030
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- // F040
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- // F050
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- // F060
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- // F070
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- // F080
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- // F090
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- // F0a0
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- // F0b0
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- // F0c0
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- // F0d0
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- // F0e0
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- // F0f0
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
-};
-*/
-
-static const sal_Unicode aMTExtraTab[224] =
-{
- // F020
- 0x0020, 0, 0, 0xE095,
- 0xE091, 0xE096, 0x02D9, 0,
- 0xE093, 0, 0, 0,
- 0, 0, 0, 0,
- // F030
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0x25C1, 0, 0x25B7, 0,
- // F040
- 0, 0, 0x2210, 0x019b,
- 0, 0, 0, 0,
- 0, 0x2229, 0, 0xE08B,
- 0x22EF, 0x22EE, 0x22F0, 0x22F1,
- // F050
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- // F060
- 0xE095, 0, 0xE25C, 0xE4BA,
- 0, 0, 0x210F, 0,
- 0, 0, 0, 0,
- 0x2113, 0x2213, 0, 0x00B0,
- // F070
- 0, 0, 0xE098, 0,
- 0, 0xE097, 0, 0,
- 0, 0, 0, 0xE081,
- 0, 0xE082, 0, 0,
- // F080
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- // F090
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- // F0a0
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- // F0b0
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- // F0c0
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- // F0d0
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- // F0e0
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- // F0f0
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0
-};
-
-
-//=======================================================================
-
-static sal_Unicode ImplStarSymbolToStarBats( sal_Unicode c )
-{
- switch ( c )
- {
- case 0x00A2: c = 0xF0E0; break;
- case 0x00A4: c = 0xF0E1; break;
- case 0x00A5: c = 0xF0E2; break;
- case 0x00A7: c = 0xF0A7; break;
- case 0x00AB: c = 0xF0AB; break;
- case 0x00B6: c = 0xF0DE; break;
- case 0x00BB: c = 0xF0BB; break;
-
- case 0x0152: c = 0xF08C; break;
- case 0x0153: c = 0xF09C; break;
- case 0x0160: c = 0xF08A; break;
- case 0x0161: c = 0xF09A; break;
- case 0x0178: c = 0xF09F; break;
- case 0x017D: c = 0xF08E; break;
- case 0x017E: c = 0xF09E; break;
-
- case 0x0192: c = 0xF083; break;
- case 0x02C6: c = 0xF088; break;
- case 0x02DC: c = 0xF098; break;
- case 0x2013: c = 0xF096; break;
- case 0x2014: c = 0xF097; break;
- case 0x2018: c = 0xF091; break;
-
- case 0x2019: c = 0xF092; break;
- case 0x201A: c = 0xF082; break;
- case 0x201C: c = 0xF093; break;
- case 0x201D: c = 0xF094; break;
- case 0x201E: c = 0xF084; break;
- case 0x2020: c = 0xF086; break;
-
- case 0x2021: c = 0xF087; break;
- case 0x2022: c = 0xF095; break;
- case 0x2026: c = 0xF085; break;
- case 0x2030: c = 0xF089; break;
- case 0x2039: c = 0xF08B; break;
- case 0x203A: c = 0xF09B; break;
-
- case 0x20A1: c = 0xF0E4; break;
- case 0x20A2: c = 0xF0E5; break;
- case 0x20A3: c = 0xF0E6; break;
- case 0x20A4: c = 0xF0E7; break;
- case 0x20A8: c = 0xF0EA; break;
- case 0x20A9: c = 0xF0E8; break;
- case 0x20AB: c = 0xF0E9; break;
- case 0x20AC: c = 0xF080; break;
-
- case 0x2122: c = 0xF099; break;
- case 0x2190: c = 0xF0B7; break;
- case 0x2191: c = 0xF0B8; break;
- case 0x2192: c = 0xF0B5; break;
- case 0x2193: c = 0xF0B6; break;
- case 0x2194: c = 0xF0D8; break;
- case 0x2195: c = 0xF0D9; break;
-
- case 0x21E4: c = 0xF0B4; break;
- case 0x21E5: c = 0xF0B3; break;
- case 0x21E6: c = 0xF0A4; break;
- case 0x21E7: c = 0xF0B2; break;
- case 0x21E8: c = 0xF0AF; break;
- case 0x21E9: c = 0xF0A3; break;
-
- case 0x25A0: c = 0xF024; break;
- case 0x25A1: c = 0xF025; break;
- case 0x25B4: c = 0xF0C5; break;
- case 0x25B5: c = 0xF0C7; break;
- case 0x25BE: c = 0xF0C4; break;
- case 0x25BF: c = 0xF0C6; break;
- case 0x25C6: c = 0xF043; break;
- case 0x25CF: c = 0xF022; break;
- case 0x25D7: c = 0xF0D0; break;
-
- case 0x260E: c = 0xF074; break;
- case 0x2611: c = 0xF034; break;
- case 0x2612: c = 0xF033; break;
- case 0x261B: c = 0xF036; break;
- case 0x261E: c = 0xF07D; break;
- case 0x2639: c = 0xF0AD; break;
- case 0x263A: c = 0xF021; break;
-
- case 0x2702: c = 0xF0CB; break;
- case 0x2708: c = 0xF0CC; break;
- case 0x270D: c = 0xF07E; break;
- case 0x270E: c = 0xF038; break;
-
- case 0x2713: c = 0xF039; break;
- case 0x2714: c = 0xF03A; break;
- case 0x2717: c = 0xF04F; break;
- case 0x2718: c = 0xF050; break;
- case 0x2719: c = 0xF051; break;
- case 0x271A: c = 0xF052; break;
- case 0x271B: c = 0xF053; break;
- case 0x271C: c = 0xF054; break;
-
- case 0x2721: c = 0xF0CD; break;
- case 0x2722: c = 0xF044; break;
- case 0x2723: c = 0xF045; break;
- case 0x2724: c = 0xF046; break;
- case 0x2725: c = 0xF047; break;
- case 0x272B: c = 0xF055; break;
- case 0x272C: c = 0xF056; break;
- case 0x272D: c = 0xF057; break;
- case 0x272E: c = 0xF058; break;
- case 0x272F: c = 0xF059; break;
-
- case 0x2730: c = 0xF05A; break;
- case 0x2733: c = 0xF048; break;
- case 0x2734: c = 0xF049; break;
- case 0x2735: c = 0xF04A; break;
- case 0x2736: c = 0xF04B; break;
- case 0x2737: c = 0xF04C; break;
- case 0x2738: c = 0xF04D; break;
- case 0x2739: c = 0xF04E; break;
- case 0x273F: c = 0xF0CE; break;
-
- case 0x2744: c = 0xF0CF; break;
- case 0x274D: c = 0xF023; break;
- case 0x274F: c = 0xF03E; break;
- case 0x2750: c = 0xF03F; break;
- case 0x2751: c = 0xF027; break;
- case 0x2752: c = 0xF028; break;
- case 0x2756: c = 0xF02C; break;
- case 0x2759: c = 0xF0D1; break;
- case 0x2762: c = 0xF0D4; break;
-
- case 0x2780: c = 0xF068; break;
- case 0x2781: c = 0xF069; break;
- case 0x2782: c = 0xF06A; break;
- case 0x2783: c = 0xF06B; break;
- case 0x2784: c = 0xF06C; break;
- case 0x2785: c = 0xF06D; break;
- case 0x2786: c = 0xF06E; break;
- case 0x2787: c = 0xF06F; break;
- case 0x2788: c = 0xF070; break;
- case 0x2789: c = 0xF071; break;
- case 0x278A: c = 0xF05D; break;
- case 0x278B: c = 0xF05E; break;
- case 0x278C: c = 0xF05F; break;
- case 0x278D: c = 0xF060; break;
- case 0x278E: c = 0xF061; break;
- case 0x278F: c = 0xF062; break;
-
- case 0x2790: c = 0xF063; break;
- case 0x2791: c = 0xF064; break;
- case 0x2792: c = 0xF065; break;
- case 0x2793: c = 0xF066; break;
- case 0x2794: c = 0xF031; break;
- case 0x2798: c = 0xF0DA; break;
- case 0x279A: c = 0xF0DB; break;
-
- case 0x27A2: c = 0xF02F; break;
- case 0x27B2: c = 0xF035; break;
- case 0x27B8: c = 0xF0DC; break;
-
- case 0xE000: c = 0xF000+38; break;
- case 0xE001: c = 0xF000+41; break;
- case 0xE002: c = 0xF000+42; break;
- case 0xE003: c = 0xF000+43; break;
- case 0xE004: c = 0xF000+45; break;
- case 0xE005: c = 0xF000+46; break;
- case 0xE006: c = 0xF000+48; break;
- case 0xE007: c = 0xF000+57; break;
-
- case 0xE008: c = 0xF000+59; break;
- case 0xE009: c = 0xF000+60; break;
- case 0xE00a: c = 0xF000+61; break;
- case 0xE00b: c = 0xF000+64; break;
- case 0xE00c: c = 0xF000+65; break;
- case 0xE00d: c = 0xF000+66; break;
- case 0xE00e: c = 0xF000+67; break;
- case 0xE00f: c = 0xF000+92; break;
-
- case 0xE010: c = 0xF000+103; break;
- case 0xE011: c = 0xF000+114; break;
- case 0xE012: c = 0xF000+115; break;
- case 0xE013: c = 0xF000+117; break;
- case 0xE014: c = 0xF000+118; break;
- case 0xE015: c = 0xF000+119; break;
- case 0xE016: c = 0xF000+120; break;
- case 0xE017: c = 0xF000+121; break;
-
- case 0xE018: c = 0xF000+122; break;
- case 0xE019: c = 0xF000+123; break;
- case 0xE01a: c = 0xF000+124; break;
- case 0xE01b: c = 0xF000+126; break;
- case 0xE01c: c = 0xF000+136; break;
- case 0xE01d: c = 0xF000+155; break;
- case 0xE01e: c = 0xF000+165; break;
- case 0xE01f: c = 0xF000+166; break;
-
- case 0xE020: c = 0xF000+168; break;
- case 0xE021: c = 0xF000+169; break;
- case 0xE022: c = 0xF000+170; break;
- case 0xE023: c = 0xF000+172; break;
- case 0xE024: c = 0xF000+174; break;
- case 0xE025: c = 0xF000+175; break;
- case 0xE026: c = 0xF000+176; break;
- case 0xE027: c = 0xF000+177; break;
-
- case 0xE028: c = 0xF000+178; break;
- case 0xE029: c = 0xF000+185; break;
- case 0xE02a: c = 0xF000+186; break;
- case 0xE02b: c = 0xF000+188; break;
- case 0xE02c: c = 0xF000+189; break;
- case 0xE02d: c = 0xF000+190; break;
- case 0xE02e: c = 0xF000+191; break;
- case 0xE02f: c = 0xF000+192; break;
-
- case 0xE030: c = 0xF000+193; break;
- case 0xE031: c = 0xF000+194; break;
- case 0xE032: c = 0xF000+195; break;
- case 0xE033: c = 0xF000+200; break;
- case 0xE034: c = 0xF000+201; break;
- case 0xE035: c = 0xF000+202; break;
- case 0xE036: c = 0xF000+210; break;
- case 0xE037: c = 0xF000+211; break;
-
- case 0xE038: c = 0xF000+227; break;
- case 0xE039: c = 0xF000+235; break;
- case 0xE03a: c = 0xF000+255; break;
-
- default: c = 0; break;
- }
-
- return c;
-}
-
-enum SymbolFont
-{
- Symbol=1, Wingdings=2, MonotypeSorts=4, Webdings=8, Wingdings2=16,
- Wingdings3=32, MTExtra=64, TimesNewRoman=128
-};
-
-const char *aSymbolNames[] =
-{
- "Symbol", "Wingdings", "Monotype Sorts", "Webdings", "Wingdings 2",
- "Wingdings 3", "MT Extra", "Times New Roman"
-};
-
-struct SymbolEntry
-{
- sal_uInt8 cIndex;
- enum SymbolFont eFont;
-};
-
-class StarSymbolToMSMultiFontImpl : public StarSymbolToMSMultiFont
-{
-private:
- ::std::multimap<sal_Unicode, SymbolEntry> maMagicMap;
-public:
- StarSymbolToMSMultiFontImpl(bool bPerfectOnly);
- String ConvertChar(sal_Unicode &rChar);
- String ConvertString(String &rString, xub_StrLen& rIndex);
-};
-
-struct ExtraTable { sal_Unicode cStar; sal_uInt8 cMS;};
-
-ExtraTable aWingDingsExtraTab[] =
-{
- {0x25cf, 0x6C}, {0x2714, 0xFC}, {0x2717, 0xFB}, {0x2794, 0xE8},
- {0x27a2, 0xD8}, {0xe000, 0x6F}, {0xe001, 0x73}, {0xe002, 0x74},
- {0xe003, 0x75}, {0xe004, 0x77}, {0xe005, 0xA6}, {0xe006, 0xE0},
- {0xe007, 0xFC}, {0xe008, 0x6C}, {0xe009, 0x6D}, {0xe00a, 0x6E},
- {0xe00b, 0x72}, {0xe00c, 0x75}, {0xe00d, 0x76}, {0xe00e, 0x74},
- {0xe00f, 0x8B}, {0xe010, 0x80}, {0xe011, 0x2B}, {0xe012, 0x3A},
- {0xe013, 0x5D}, {0xe014, 0x29}, {0xe015, 0x3A}, {0xe016, 0x3C},
- {0xe017, 0x38}, {0xe018, 0x3A}, {0xe019, 0x2A}, {0xe01a, 0x2B},
- {0xe01b, 0x3F}, {0xe01c, 0x9F}, {0xe01d, 0x80}, {0xe01e, 0x8B},
- {0xe023, 0x4A}, {0xe025, 0xF0}, {0xe026, 0xF2}, {0xe027, 0xEF},
- {0xe028, 0xF1}, {0xe029, 0x52}, {0xe02a, 0x29}, {0xe02b, 0xE0},
- {0xe02c, 0xE2}, {0xe02d, 0xDF}, {0xe02e, 0xE1}, {0xe02f, 0xAC},
- {0xe030, 0xAD}, {0xe031, 0xAE}, {0xe032, 0x7C}, {0xe033, 0x43},
- {0xe034, 0x4D}, {0xe0aa, 0x71}, {0xe422, 0x44}
-};
-
-ExtraTable aSymbolExtraTab2[] =
-{
- {0x0020, 0x20}, {0x00A0, 0x20}, {0x0021, 0x21}, {0x2200, 0x22},
- {0x0023, 0x23}, {0x2203, 0x24}, {0x0025, 0x25}, {0x0026, 0x26},
- {0x220B, 0x27}, {0x0028, 0x28}, {0x0029, 0x29}, {0x2217, 0x2A},
- {0x002B, 0x2B}, {0x002C, 0x2C}, {0x2212, 0x2D}, {0x002E, 0x2E},
- {0x002F, 0x2F}, {0x003A, 0x3A}, {0x003B, 0x3B}, {0x003C, 0x3C},
- {0x003D, 0x3D}, {0x003E, 0x3E}, {0x2245, 0x40}, {0x2206, 0x44},
- {0x2126, 0x57}, {0x005B, 0x5B}, {0x005D, 0x5D}, {0x22A5, 0x5E},
- {0x03C6, 0x66}, {0x03D5, 0x6A}, {0x00B5, 0x6D}, {0x007B, 0x7B},
- {0x007C, 0x7C}, {0x007D, 0x7D}, {0x223C, 0x7E}, {0x20AC, 0xA0},
- {0x2032, 0xA2}, {0x2264, 0xA3}, {0x2044, 0xA4}, {0x221E, 0xA5},
- {0x0192, 0xA6}, {0x2663, 0xA7}, {0x2665, 0xA9}, {0x2660, 0xAA},
- {0x2194, 0xAB}, {0x2190, 0xAC}, {0x2191, 0xAD}, {0x2192, 0xAE},
- {0x2193, 0xAF}, {0x00B0, 0xB0}, {0x00B1, 0xB1}, {0x2265, 0xB3},
- {0x00D7, 0xB4}, {0x221D, 0xB5}, {0x2202, 0xB6}, {0x2022, 0xB7},
- {0x00F7, 0xB8}, {0x2260, 0xB9}, {0x2261, 0xBA}, {0x2248, 0xBB},
- {0x2026, 0xBC}, {0x21B5, 0xBF}, {0x2135, 0xC0}, {0x2111, 0xC1},
- {0x211C, 0xC2}, {0x2118, 0xC3}, {0x2297, 0xC4}, {0x2295, 0xC5},
- {0x2205, 0xC6}, {0x2229, 0xC7}, {0x222A, 0xC8}, {0x2283, 0xC9},
- {0x2287, 0xCA}, {0x2284, 0xCB}, {0x2282, 0xCC}, {0x2286, 0xCD},
- {0x2208, 0xCE}, {0x2209, 0xCF}, {0x2207, 0xD1}, {0x220F, 0xD5},
- {0x221A, 0xD6}, {0x22C5, 0xD7}, {0x00AC, 0xD8}, {0x2227, 0xD9},
- {0x2228, 0xDA}, {0x21D4, 0xDB}, {0x21D0, 0xDC}, {0x21D2, 0xDE},
- {0x2329, 0xE1}, {0x2211, 0xE5}, {0x232A, 0xF1}, {0x222B, 0xF2},
- {0x2320, 0xF3}, {0x2321, 0xF5}, {0x2013, 0x2D}
-};
-
-ExtraTable aSymbolExtraTab[] =
-{
- {0xe021, 0xD3}, {0xe024, 0xD2}, {0xe035, 0x20}, {0xe036, 0x28},
- {0xe037, 0x29}, {0xe039, 0x20}, {0xe083, 0x2B}, {0xe084, 0x3C},
- {0xe085, 0x3E}, {0xe086, 0xA3}, {0xe087, 0xB3}, {0xe089, 0xCE},
- {0xe08a, 0xA6}, {0xe08c, 0xAE}, {0xe08d, 0xD6}, {0xe08e, 0xD6},
- {0xe08f, 0xD6}, {0xe094, 0xA2}, {0xe09e, 0x28}, {0xe09f, 0x29},
- {0xe0a0, 0xD0}, {0xe0a6, 0xA2}, {0xe0a7, 0x7C}, {0xe0a8, 0x2F},
- {0xe0ab, 0x7C}, {0xe0ac, 0x47}, {0xe0ad, 0x44}, {0xe0ae, 0x51},
- {0xe0af, 0x4C}, {0xe0b0, 0x58}, {0xe0b1, 0x50}, {0xe0b2, 0x53},
- {0xe0b3, 0x55}, {0xe0b4, 0x46}, {0xe0b5, 0x59}, {0xe0b6, 0x57},
- {0xe0b7, 0x61}, {0xe0b8, 0x62}, {0xe0b9, 0x67}, {0xe0ba, 0x64},
- {0xe0bb, 0x65}, {0xe0bc, 0x7A}, {0xe0bd, 0x68}, {0xe0be, 0x71},
- {0xe0bf, 0x69}, {0xe0c0, 0x6B}, {0xe0c1, 0x6C}, {0xe0c2, 0x6D},
- {0xe0c3, 0x6E}, {0xe0c4, 0x78}, {0xe0c5, 0x6F}, {0xe0c6, 0x70},
- {0xe0c7, 0x72}, {0xe0c8, 0x73}, {0xe0c9, 0x74}, {0xe0ca, 0x75},
- {0xe0cb, 0x66}, {0xe0cc, 0x63}, {0xe0cd, 0x79}, {0xe0ce, 0x77},
- {0xe0cf, 0x65}, {0xe0d0, 0x4A}, {0xe0d1, 0x76}, {0xe0d3, 0x56},
- {0xe0d4, 0x6A}, {0xe0d5, 0xB6}, {0xe0d6, 0x69}, {0xe0db, 0xAC},
- {0xe0dc, 0xAD}, {0xe0dd, 0xAF}
-};
-
-ExtraTable aTNRExtraTab[] =
-{
- {0xe021, 0xA9},
- {0xe022, 0x40},
- {0xe024, 0xAE},
- {0xe035, 0x20},
- {0xe036, '('},
- {0xe037, ')'},
- {0xe039, 0x20},
- {0xe03a, 0x80},
- {0xe080, 0x89},
- {0xe083, '+'},
- {0xe084, '<'},
- {0xe085, '>'},
- {0xe0a9, '\\'}
-};
-
-StarSymbolToMSMultiFontImpl::StarSymbolToMSMultiFontImpl(bool bPerfectOnly)
-{
- struct ConvertTable
- {
- enum SymbolFont meFont;
- const sal_Unicode* pTab;
- };
-
- //In order of preference
- const ConvertTable aConservativeTable[] =
- {
- {Symbol, aAdobeSymbolTab},
- {Wingdings, aWingDingsTab},
- {MonotypeSorts, aMonotypeSortsTab},
- {Webdings, aWebDingsTab},
- {Wingdings2, aWingDings2Tab},
- {Wingdings3, aWingDings3Tab},
- {MTExtra, aMTExtraTab}
- };
-
- struct ExtendedConvertTable
- {
- enum SymbolFont meFont;
- const ExtraTable *mpTable;
- size_t mnSize;
- ExtendedConvertTable(SymbolFont eFont, const ExtraTable *pTable,
- size_t nSize)
- : meFont(eFont), mpTable(pTable), mnSize(nSize) {}
- };
-
- //Reverse map from a given starsymbol char to exact matches in ms symbol
- //fonts.
- int nEntries = sizeof(aConservativeTable) / sizeof(aConservativeTable[0]);
- int i;
- for (i = 0; i < nEntries; ++i)
- {
- const ConvertTable& r = aConservativeTable[i];
- SymbolEntry aEntry;
- aEntry.eFont = r.meFont;
- for (aEntry.cIndex = 0xFF; aEntry.cIndex >= 0x20; --aEntry.cIndex)
- {
- if (sal_Unicode cChar = r.pTab[aEntry.cIndex-0x20])
- maMagicMap.insert(
- ::std::multimap<sal_Unicode, SymbolEntry>::value_type(
- cChar, aEntry));
- }
- }
-
- //In order of preference
- const ExtendedConvertTable aAgressiveTable[] =
- {
- ExtendedConvertTable(Symbol, aSymbolExtraTab2,
- sizeof(aSymbolExtraTab2)),
- ExtendedConvertTable(Symbol, aSymbolExtraTab,
- sizeof(aSymbolExtraTab)),
- ExtendedConvertTable(Wingdings, aWingDingsExtraTab,
- sizeof(aWingDingsExtraTab)),
- ExtendedConvertTable(TimesNewRoman, aTNRExtraTab,
- sizeof(aTNRExtraTab))
- };
-
- //Allow extra conversions that are not perfect, but "good enough"
- if (!bPerfectOnly)
- nEntries = sizeof(aAgressiveTable) / sizeof(aAgressiveTable[0]);
- else
- nEntries = 1;
-
- for (i = 0; i < nEntries; ++i)
- {
- const ExtendedConvertTable& r = aAgressiveTable[i];
- SymbolEntry aEntry;
- aEntry.eFont = r.meFont;
- for (int j = r.mnSize / sizeof(r.mpTable[0]); j >=0; --j)
- {
- aEntry.cIndex = r.mpTable[j].cMS;
- maMagicMap.insert(
- ::std::multimap<sal_Unicode, SymbolEntry>::value_type(
- r.mpTable[j].cStar, aEntry));
- }
- }
-}
-
-const char *SymbolFontToString(int nResult)
-{
- const char **ppName = aSymbolNames;
- int nI = Symbol;
- while (nI <= nResult)
- {
- if (!(nI & nResult))
- nI = nI << 1;
- else
- break;
- ppName++;
- }
- return *ppName;
-}
-
-String StarSymbolToMSMultiFontImpl::ConvertChar(sal_Unicode &rChar)
-{
- String sRet;
-
- ::std::multimap<sal_Unicode, SymbolEntry>::const_iterator aResult =
- maMagicMap.find(rChar);
-
- if (aResult != maMagicMap.end())
- {
- const SymbolEntry &rEntry = (*aResult).second;
- sRet.AssignAscii(SymbolFontToString(rEntry.eFont));
- rChar = rEntry.cIndex;
- }
-
- return sRet;
-}
-
-String StarSymbolToMSMultiFontImpl::ConvertString(String &rString,
- xub_StrLen& rIndex)
-{
- typedef ::std::multimap<sal_Unicode, SymbolEntry>::iterator MI;
- typedef ::std::pair<MI, MI> Result;
-
- String sRet;
-
- xub_StrLen nLen = rString.Len();
- if (rIndex >= nLen)
- return sRet;
-
- int nTotal = 0, nResult = 0;
- ::std::vector<Result> aPossibilities;
- aPossibilities.reserve(nLen - rIndex);
- xub_StrLen nStart = rIndex;
- do
- {
- Result aResult = maMagicMap.equal_range(rString.GetChar(rIndex));
- int nBitfield = 0;
- for (MI aIndex = aResult.first; aIndex != aResult.second; ++aIndex)
- nBitfield |= aIndex->second.eFont;
-
- if (!nTotal)
- nTotal = nBitfield;
- else
- {
- if (nTotal != nBitfield) //Allow a series of failures
- {
- nTotal &= nBitfield;
- if (!nTotal)
- break;
- }
- }
- nResult = nTotal;
- if (nResult) //Don't bother storing a series of failures
- aPossibilities.push_back(aResult);
- ++rIndex;
- }while(rIndex < nLen);
-
- if (nResult)
- {
- int nI = Symbol;
- while (nI <= nResult)
- {
- if (!(nI & nResult))
- nI = nI << 1;
- else
- break;
- }
- sRet.AssignAscii(SymbolFontToString(nI));
-
- xub_StrLen nSize = sal::static_int_cast<xub_StrLen>(aPossibilities.size());
- for(xub_StrLen nPos = 0; nPos < nSize; ++nPos)
- {
- const Result &rResult = aPossibilities[nPos];
-
- for (MI aIndex = rResult.first; aIndex != rResult.second; ++aIndex)
- {
- if (aIndex->second.eFont == nI)
- {
- rString.SetChar(nPos+nStart, aIndex->second.cIndex);
- break;
- }
- }
- }
- }
-
- return sRet;
-}
-
-StarSymbolToMSMultiFont *CreateStarSymbolToMSMultiFont(bool bPerfectOnly)
-{
- return new StarSymbolToMSMultiFontImpl(bPerfectOnly);
-}
-
-//=======================================================================
-
-sal_Unicode ImplRecodeChar( const ImplCvtChar* pConversion, sal_Unicode cChar )
-{
- sal_Unicode cRetVal = 0;
- if( pConversion->mpCvtFunc )
- {
- // use a conversion function for recoding
- cRetVal = pConversion->mpCvtFunc( cChar );
- }
- else
- {
- // use a conversion table for recoding
- sal_Unicode cIndex = cChar;
- // allow symbol aliasing
- if( cIndex & 0xFF00 )
- cIndex -= 0xF000;
- // recode the symbol
- if( cIndex>=0x0020 && cIndex<=0x00FF )
- cRetVal = pConversion->mpCvtTab[ cIndex - 0x0020 ];
- }
-
- return cRetVal ? cRetVal : cChar;
-}
-
-// -----------------------------------------------------------------------
-
-// recode the string assuming the character codes are symbol codes
-// from an traditional symbol font (i.e. U+F020..U+F0FF)
-void ImplRecodeString( const ImplCvtChar* pConversion, String& rStr,
- xub_StrLen nIndex, xub_StrLen nLen )
-{
- ULONG nLastIndex = (ULONG)nIndex + nLen;
- if( nLastIndex > rStr.Len() )
- nLastIndex = rStr.Len();
-
- for(; nIndex < nLastIndex; ++nIndex )
- {
- sal_Unicode cOrig = rStr.GetChar( nIndex );
- // only recode symbols and their U+00xx aliases
- if( ((cOrig < 0x0020) || (cOrig > 0x00FF))
- && ((cOrig < 0xF020) || (cOrig > 0xF0FF)) )
- continue;
-
- // recode a symbol
- sal_Unicode cNew = ImplRecodeChar( pConversion, cOrig );
- if( cOrig != cNew )
- rStr.SetChar( nIndex, cNew );
- }
-}
-
-//=======================================================================
-
-struct RecodeTable { const char* pOrgName; ImplCvtChar aCvt;};
-
-static RecodeTable aRecodeTable[] =
-{
- // the first two entries must be StarMath and StarBats; do not reorder!
- // reason: fgrep for FONTTOSUBSFONT_ONLYOLDSOSYMBOLFONTS
- {"starbats", {aStarBatsTab, "StarSymbol", NULL}},
- {"starmath", {aStarMathTab, "StarSymbol", NULL}},
-
- {"symbol", {aAdobeSymbolTab, "StarSymbol", NULL}},
- {"standardsymbols", {aAdobeSymbolTab, "StarSymbol", NULL}},
- {"standardsymbolsl",{aAdobeSymbolTab, "StarSymbol", NULL}},
-
- {"monotypesorts", {aMonotypeSortsTab, "StarSymbol", NULL}},
-// {"monotypesorts2", {aMonotypeSorts2Tab, "StarSymbol", NULL}}
- {"zapfdingbats", {aMonotypeSortsTab, "StarSymbol", NULL}}, //ZapfDingbats=MonotypeSorts-X?
- {"itczapfdingbats", {aMonotypeSortsTab, "StarSymbol", NULL}},
- {"dingbats", {aMonotypeSortsTab, "StarSymbol", NULL}},
-
- {"webdings", {aWebDingsTab, "StarSymbol", NULL}},
- {"wingdings", {aWingDingsTab, "StarSymbol", NULL}},
- {"wingdings2", {aWingDings2Tab, "StarSymbol", NULL}},
- {"wingdings3", {aWingDings3Tab, "StarSymbol", NULL}},
- {"mtextra", {aMTExtraTab, "StarSymbol", NULL}}
-};
-
-static ImplCvtChar aImplStarSymbolCvt = { NULL, "StarBats", ImplStarSymbolToStarBats };
-#if 0
-// not used
-static ImplCvtChar aImplDingBatsCvt = { aMonotypeSortsTab, "StarSymbol", NULL };
-#endif
-
-// -----------------------------------------------------------------------
-
-const ImplCvtChar* ImplGetRecodeData( const String& rOrgFontName,
- const String& rMapFontName )
-{
- const ImplCvtChar* pCvt = NULL;
- String aOrgName( rOrgFontName );
- ImplGetEnglishSearchFontName( aOrgName );
- String aMapName( rMapFontName );
- ImplGetEnglishSearchFontName( aMapName );
-
- if( aMapName.EqualsAscii( "starsymbol" )
- || aMapName.EqualsAscii( "opensymbol" ) )
- {
- int nEntries = sizeof(aRecodeTable) / sizeof(aRecodeTable[0]);
- for( int i = 0; i < nEntries; ++i)
- {
- RecodeTable& r = aRecodeTable[i];
- if( aOrgName.EqualsAscii( r.pOrgName ) )
- { pCvt = &r.aCvt; break; }
- }
- }
- else if( aMapName.EqualsAscii( "starbats" ) )
- {
- if( aOrgName.EqualsAscii( "starsymbol" ) )
- pCvt = &aImplStarSymbolCvt;
- else if( aOrgName.EqualsAscii( "opensymbol" ) )
- pCvt = &aImplStarSymbolCvt;
- }
-
- return pCvt;
-}
-
-//=======================================================================
-
-FontToSubsFontConverter CreateFontToSubsFontConverter(
- const String& rOrgName, ULONG nFlags )
-{
- const ImplCvtChar* pCvt = NULL;
-
- String aName = rOrgName;
- ImplGetEnglishSearchFontName( aName );
-
- if ( nFlags & FONTTOSUBSFONT_IMPORT )
- {
- int nEntries = sizeof(aRecodeTable) / sizeof(aRecodeTable[0]);
- if ( nFlags & FONTTOSUBSFONT_ONLYOLDSOSYMBOLFONTS ) // only StarMath+StarBats
- nEntries = 2;
- for( int i = 0; i < nEntries; ++i )
- {
- RecodeTable& r = aRecodeTable[i];
- if( aName.EqualsAscii( r.pOrgName ) )
- { pCvt = &r.aCvt; break; }
- }
- }
- else
- {
- // TODO: FONTTOSUBSFONT_ONLYOLDSOSYMBOLFONTS
- if( aName.EqualsAscii( "starsymbol" ) ) pCvt = &aImplStarSymbolCvt;
- else if( aName.EqualsAscii( "opensymbol" ) ) pCvt = &aImplStarSymbolCvt;
- }
-
- return (FontToSubsFontConverter)pCvt;
-}
-
-// -----------------------------------------------------------------------
-
-void DestroyFontToSubsFontConverter( FontToSubsFontConverter )
-{
- // nothing to do for now, because we use static ImplCvtChars
-}
-
-// -----------------------------------------------------------------------
-
-sal_Unicode ConvertFontToSubsFontChar(
- FontToSubsFontConverter hConverter, sal_Unicode cChar )
-{
- if ( hConverter )
- return ImplRecodeChar( (ImplCvtChar*)hConverter, cChar );
- else
- return cChar;
-}
-
-// -----------------------------------------------------------------------
-
-String GetFontToSubsFontName( FontToSubsFontConverter hConverter )
-{
- if ( !hConverter )
- return String();
-
- const char* pName = ((ImplCvtChar*)hConverter)->mpSubsFontName;
- return String::CreateFromAscii( pName );
-}
diff --git a/vcl/source/gdi/impimagetree.cxx b/vcl/source/gdi/impimagetree.cxx
index 039041826124..8178204a4ffd 100644
--- a/vcl/source/gdi/impimagetree.cxx
+++ b/vcl/source/gdi/impimagetree.cxx
@@ -46,6 +46,7 @@
#include "com/sun/star/uno/RuntimeException.hpp"
#include "com/sun/star/uno/Sequence.hxx"
#include "comphelper/processfactory.hxx"
+#include "osl/file.hxx"
#include "osl/diagnose.h"
#include "rtl/bootstrap.hxx"
#include "rtl/string.h"
@@ -118,12 +119,43 @@ ImplImageTree::ImplImageTree() {}
ImplImageTree::~ImplImageTree() {}
+bool ImplImageTree::checkStyle(rtl::OUString const & style)
+{
+ bool exists;
+
+ // using cache because setStyle is an expensive operation
+ // setStyle calls resetZips => closes any opened zip files with icons, cleans the icon cache, ...
+ if (checkStyleCacheLookup(style, exists)) {
+ return exists;
+ }
+
+ setStyle(style);
+
+ exists = false;
+ const rtl::OUString sBrandURLSuffix(RTL_CONSTASCII_USTRINGPARAM("_brand.zip"));
+ for (Zips::iterator i(m_zips.begin()); i != m_zips.end() && !exists;) {
+ ::rtl::OUString aZipURL = i->first;
+ sal_Int32 nFromIndex = aZipURL.getLength() - sBrandURLSuffix.getLength();
+ // skip brand-specific icon themes; they are incomplete and thus not useful for this check
+ if (nFromIndex < 0 || !aZipURL.match(sBrandURLSuffix, nFromIndex)) {
+ osl::File aZip(aZipURL);
+ if (aZip.open(OpenFlag_Read) == ::osl::FileBase::E_None) {
+ aZip.close();
+ exists = true;
+ }
+ }
+ ++i;
+ }
+ m_checkStyleCache[style] = exists;
+ return exists;
+}
+
bool ImplImageTree::loadImage(
rtl::OUString const & name, rtl::OUString const & style, BitmapEx & bitmap,
bool localized)
{
setStyle(style);
- if (cacheLookup(name, localized, bitmap)) {
+ if (iconCacheLookup(name, localized, bitmap)) {
return true;
}
if (!bitmap.IsEmpty()) {
@@ -164,7 +196,7 @@ bool ImplImageTree::loadImage(
rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8).getStr());
}
if (found) {
- m_cache[name.intern()] = std::make_pair(localized, bitmap);
+ m_iconCache[name.intern()] = std::make_pair(localized, bitmap);
}
return found;
}
@@ -173,7 +205,8 @@ void ImplImageTree::shutDown() {
m_style = rtl::OUString();
// for safety; empty m_style means "not initialized"
m_zips.clear();
- m_cache.clear();
+ m_iconCache.clear();
+ m_checkStyleCache.clear();
}
void ImplImageTree::setStyle(rtl::OUString const & style) {
@@ -181,7 +214,7 @@ void ImplImageTree::setStyle(rtl::OUString const & style) {
if (style != m_style) {
m_style = style;
resetZips();
- m_cache.clear();
+ m_iconCache.clear();
}
}
@@ -241,6 +274,7 @@ void ImplImageTree::resetZips() {
u.GetMainURL(INetURLObject::NO_DECODE),
css::uno::Reference< css::container::XNameAccess >()));
}
+ if ( m_style.equals(::rtl::OUString::createFromAscii("default")) )
{
rtl::OUString url(
RTL_CONSTASCII_USTRINGPARAM(
@@ -252,11 +286,23 @@ void ImplImageTree::resetZips() {
}
}
-bool ImplImageTree::cacheLookup(
+bool ImplImageTree::checkStyleCacheLookup(
+ rtl::OUString const & style, bool &exists)
+{
+ CheckStyleCache::iterator i(m_checkStyleCache.find(style));
+ if (i != m_checkStyleCache.end()) {
+ exists = i->second;
+ return true;
+ } else {
+ return false;
+ }
+}
+
+bool ImplImageTree::iconCacheLookup(
rtl::OUString const & name, bool localized, BitmapEx & bitmap)
{
- Cache::iterator i(m_cache.find(name));
- if (i != m_cache.end() && i->second.first == localized) {
+ IconCache::iterator i(m_iconCache.find(name));
+ if (i != m_iconCache.end() && i->second.first == localized) {
bitmap = i->second.second;
return true;
} else {
diff --git a/vcl/source/gdi/implncvt.cxx b/vcl/source/gdi/implncvt.cxx
deleted file mode 100644
index e59fde15b5be..000000000000
--- a/vcl/source/gdi/implncvt.cxx
+++ /dev/null
@@ -1,577 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: implncvt.cxx,v $
- * $Revision: 1.10.136.1 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_vcl.hxx"
-#include <vcl/salbtype.hxx>
-#ifndef _SV_IMPLNCVT_HXX
-#include "implncvt.hxx"
-#endif
-
-// -----------
-// - Defines -
-// -----------
-
-#define CURVE_LEFT 1
-#define CURVE_RIGHT 2
-#define CURVE_STRAIGHTON 3
-
-// -----------------
-// - ImplFloatPoint
-// -----------------
-
-struct ImplFloatPoint
-{
- double fX;
- double fY;
-
- inline ImplFloatPoint() {}
- inline ImplFloatPoint( const Point& rPoint ) { fX = rPoint.X(); fY = rPoint.Y(); }
- inline ImplFloatPoint( double _fX, double _fY ) { fX = _fX; fY = _fY; }
- inline ImplFloatPoint( const ImplFloatPoint& rPoint ) { fX = rPoint.fX; fY = rPoint.fY; }
- inline ~ImplFloatPoint() {}
-
- void operator+=( const ImplFloatPoint& rPoint ) { fX += rPoint.fX; fY += rPoint.fY; }
- void operator-=( const ImplFloatPoint& rPoint ) { fX -= rPoint.fX; fY -= rPoint.fY; }
- void operator*=( const double& rD ) { fX *= rD; fY *= rD; }
- BOOL operator==( const ImplFloatPoint& rPoint ) const { return ( ( rPoint.fX == fX ) && ( rPoint.fY == fY ) ); }
- void operator=( const Point& rPoint ) { fX = rPoint.X(); fY = rPoint.Y(); }
-
- ImplFloatPoint GetOVec( const ImplFloatPoint& rPoint ) const;
- ImplFloatPoint GetNVec( const ImplFloatPoint& rPoint ) const;
-};
-
-// -----------------------------------------------------------------------------
-
-ImplFloatPoint ImplFloatPoint::GetOVec( const ImplFloatPoint& rPoint ) const
-{
- double fxt = rPoint.fX - fX;
- double fyt = rPoint.fY - fY;
- double fL;
-
- if( fyt != 0.0 )
- {
- fyt = -fxt / fyt;
- fL = sqrt( 1 + fyt * fyt );
-
- return ImplFloatPoint( 1.0 / fL, fyt / fL );
- }
- else
- return ImplFloatPoint( fyt, ( fxt > 0.0 ) ? 1.0 : -1.0 );
-};
-
-// -----------------------------------------------------------------------------
-
-ImplFloatPoint ImplFloatPoint::GetNVec( const ImplFloatPoint& rPoint ) const
-{
- const double fxt = rPoint.fX - fX;
- const double fyt = rPoint.fY - fY;
- const double fL = hypot( fxt, fyt );
-
- return ImplFloatPoint( fxt / fL, fyt / fL );
-};
-
-// --------------------
-// - ImplLineConverter
-// --------------------
-
-ImplLineConverter::ImplLineConverter( const Polygon& rPolygon, const LineInfo& rLineInfo, const Point* pRefPoint ) :
- mbRefPoint ( FALSE ),
- mfWidthHalf ( rLineInfo.GetWidth() >> 1 ),
- maLineInfo ( rLineInfo ),
- mpFloat0 ( new ImplFloatPoint[ 6 ] ),
- mpFloat1 ( new ImplFloatPoint[ 6 ] ),
- mnLines ( 0 ),
- mpFloatPoint ( NULL )
-{
- UINT16 nIndex, nPolySize = rPolygon.GetSize();
- if ( nPolySize )
- {
- if( rPolygon.GetFlags( 0 ) == POLY_NORMAL )
- {
- mpFloatPoint = new ImplFloatPoint[ nPolySize ];
- mpFloatPoint[ 0 ] = rPolygon[ 0 ];
-
- nIndex = 0;
-
- while( ++nIndex < nPolySize ) // doppelte Punkte eliminieren und ein FloatPointArray anlegen
- {
- if( rPolygon.GetFlags( nIndex ) == POLY_NORMAL )
- {
- double nxt = mpFloatPoint[ mnLines ].fX;
- double nyt = mpFloatPoint[ mnLines ].fY;
-
- if ( ( nxt == rPolygon[ nIndex ].X() ) && ( nyt == rPolygon[ nIndex ].Y() ) )
- continue;
-
- mpFloatPoint[ ++mnLines ] = rPolygon[ nIndex ];
- }
- else
- {
- DBG_ERROR( "Bezier points not supported!" );
- }
- }
- mbClosed = ( mpFloatPoint[ 0 ] == mpFloatPoint[ mnLines ] ) ;
-
- if ( ( mnLines == 1 ) && ( maLineInfo.GetStyle() == LINE_DASH ) )
- {
- BOOL bX = mpFloatPoint[ 0 ].fY == mpFloatPoint[ 1 ].fY;
- BOOL bY = mpFloatPoint[ 0 ].fX == mpFloatPoint[ 1 ].fX;
- mbRefPoint = pRefPoint && ( bX || bY );
- if ( mbRefPoint )
- {
- if ( !maLineInfo.GetDashCount() )
- {
- maLineInfo.SetDashCount( maLineInfo.GetDotCount() );
- maLineInfo.SetDashLen( maLineInfo.GetDotLen() );
- maLineInfo.SetDotCount( 0 );
- }
- INT32 nDistance = maLineInfo.GetDistance();
- INT32 nDashLen = maLineInfo.GetDashCount() * ( maLineInfo.GetDashLen() + nDistance );
- INT32 nDotLen = maLineInfo.GetDotCount() * ( maLineInfo.GetDotLen() + nDistance );
- if ( bX )
- {
- if ( mpFloatPoint[ 1 ].fX > mpFloatPoint[ 0 ].fX )
- {
- ImplFloatPoint aFloat = mpFloatPoint[ 0 ];
- mpFloatPoint[ 0 ] = mpFloatPoint[ 1 ];
- mpFloatPoint[ 1 ] = aFloat;
- }
- mnRefDistance = (INT32)mpFloatPoint[ mnLines ].fX - pRefPoint->X();
- }
- else
- {
- if ( mpFloatPoint[ 1 ].fY > mpFloatPoint[ 0 ].fY )
- {
- ImplFloatPoint aFloat = mpFloatPoint[ 0 ];
- mpFloatPoint[ 0 ] = mpFloatPoint[ 1 ];
- mpFloatPoint[ 1 ] = aFloat;
- }
- mnRefDistance = (INT32)mpFloatPoint[ mnLines ].fY - pRefPoint->Y();
- }
-
-// mnRefDistance = ( (INT32)mpFloatPoint[ mnLines ].fX - pRefPoint->X() ) +
-// ( (INT32)mpFloatPoint[ mnLines ].fY - pRefPoint->Y() );
-
- mnRefDistance = mnRefDistance % ( nDashLen + nDotLen );
- if ( mnRefDistance < 0 )
- mnRefDistance = ( nDashLen + nDotLen ) + mnRefDistance;
- }
- }
- }
- }
-};
-
-//------------------------------------------------------------------------
-
-ImplLineConverter::~ImplLineConverter()
-{
- delete[] mpFloat0;
- delete[] mpFloat1;
- delete[] mpFloatPoint;
-};
-
-//------------------------------------------------------------------------
-
-const Polygon* ImplLineConverter::ImplGetFirst()
-{
- mnFloat1Points = 0;
- mnLinesAvailable = mnLines;
-
- if ( mnLines )
- {
- if ( maLineInfo.GetStyle() == LINE_DASH )
- {
- mnDashCount = maLineInfo.GetDashCount();
- mnDotCount = maLineInfo.GetDotCount();
- mfDashDotLenght = mnDashCount ? maLineInfo.GetDashLen() : maLineInfo.GetDotLen();
-
- if ( mbRefPoint )
- {
- INT32 nDistance = maLineInfo.GetDistance();
- INT32 nDashLen = maLineInfo.GetDashLen() + nDistance;
- INT32 nDashesLen = maLineInfo.GetDashCount() * nDashLen;
- INT32 nDotLen = maLineInfo.GetDotLen() + nDistance;
-
- if ( mnRefDistance >= nDashesLen )
- {
- // get dotcount
- if ( nDotLen )
- {
- INT32 nLen = ( mnRefDistance - nDashesLen ) % nDotLen;
- if ( nLen >= maLineInfo.GetDotLen() )
- {
- mnDotCount -= 1 + ( mnRefDistance - nDashesLen ) / nDotLen;
- if ( mnDotCount )
- mnDashCount = 0;
- else
- mnDotCount = maLineInfo.GetDotCount();
- mfDashDotLenght = 0.0;
- mfDistanceLenght = ( maLineInfo.GetDotLen() + nDistance ) - nLen;
- }
- else
- {
- mnDashCount = 0;
- mfDashDotLenght = maLineInfo.GetDotLen() - nLen;
- mnDotCount -= ( mnRefDistance - nDashesLen ) / nDotLen;
- }
- }
- }
- else
- {
- if ( nDashLen )
- {
- // get dashcount
- INT32 nLen = mnRefDistance % nDashLen;
- if ( nLen >= maLineInfo.GetDashLen() )
- {
- mfDashDotLenght = 0.0;
- mfDistanceLenght = ( maLineInfo.GetDashLen() + nDistance ) - nLen;
- mnDashCount -= 1 + ( mnRefDistance / nDashLen );
- }
- else
- {
- mfDashDotLenght = maLineInfo.GetDashLen() - nLen;
- mnDashCount -= ( mnRefDistance / nDashLen );
- }
- }
- }
- if ( ! ( mnDashCount | mnDotCount ) )
- {
- mnDashCount = maLineInfo.GetDashCount();
- mnDotCount = maLineInfo.GetDotCount();
- }
- if ( ( mfDashDotLenght == 0.0 ) && ( mfDistanceLenght == 0.0 ) )
- mfDistanceLenght = maLineInfo.GetDistance();
- }
- }
- }
- return ImplGetNext();
-};
-
-//------------------------------------------------------------------------
-
-const Polygon* ImplLineConverter::ImplGetNext()
-{
- while( mnFloat1Points || mnLinesAvailable )
- {
- if ( maLineInfo.GetWidth() > 1 )
- {
- if ( !mnFloat1Points )
- {
- ImplFloatPoint aPointA( mpFloatPoint[ mnLinesAvailable-- ] );
- ImplFloatPoint aPointB( mpFloatPoint[ mnLinesAvailable ] );
- ImplFloatPoint aOVecAB( aPointA.GetOVec( aPointB ) );
- ImplFloatPoint aN1Vec( aPointA.GetNVec( aPointB ) );
- aN1Vec *= mfWidthHalf;
-
- if ( !mbClosed && ( ( mnLinesAvailable + 1 ) == mnLines ) )
- aPointA -= aN1Vec;
-
- aOVecAB *= mfWidthHalf;
- mpFloat0[ 0 ] = aPointA;
- mpFloat0[ 0 ] -= aOVecAB;
- mpFloat0[ 3 ] = aPointA;
- mpFloat0[ 3 ] += aOVecAB;
- mpFloat0[ 1 ] = aPointB;
- mpFloat0[ 1 ] -= aOVecAB;
- mpFloat0[ 2 ] = aPointB;
- mpFloat0[ 2 ] += aOVecAB;
-
- double f1D = ( aN1Vec.fX == 0 ) ? 1 : ( aN1Vec.fY / aN1Vec.fX );
- double f2D = -f1D;
-
- mnFloat0Points = 4;
-
- int nDirection;
-
- BOOL bContinues = ( mnLinesAvailable || mbClosed );
- if ( bContinues )
- {
- ImplFloatPoint aPointC;
-
- if ( mnLinesAvailable )
- aPointC = mpFloatPoint[ mnLinesAvailable - 1 ];
- else
- aPointC = mpFloatPoint[ mnLines - 1 ];
-
- ImplFloatPoint aOVecBC( aPointB.GetOVec( aPointC ) );
- aOVecBC *= mfWidthHalf;
- ImplFloatPoint aPointR0( aPointB );
- aPointR0 -= aOVecBC;
- ImplFloatPoint aPointR1( aPointB );
- aPointR1 += aOVecBC;
- ImplFloatPoint aN2Vec( aPointB.GetNVec( aPointC ) );
- aN2Vec *= mfWidthHalf;
-
- f2D = ( fabs( aN2Vec.fX ) < 0.00000001 ) ? 1 : ( aN2Vec.fY / aN2Vec.fX );
- if ( fabs( f1D - f2D ) < 0.00000001 )
- nDirection = CURVE_STRAIGHTON;
- else
- {
- if ( ( aN1Vec.fX * aN2Vec.fY - aN1Vec.fY * aN2Vec.fX ) > 0 )
- nDirection = CURVE_LEFT;
- else
- nDirection = CURVE_RIGHT;
- }
- if ( nDirection != CURVE_STRAIGHTON )
- {
- double fWidth;
- ImplFloatPoint aDestPoint;
- if ( hypot( aPointR0.fX - aPointA.fX, aPointR0.fY - aPointA.fY ) > hypot( aPointR1.fX - aPointA.fX, aPointR1.fY - aPointA.fY ) )
- aDestPoint = aPointR0;
- else
- aDestPoint = aPointR1;
-
- UINT16 nFirst = 0;
- if ( aN1Vec.fY > 0 )
- {
- if ( nDirection != CURVE_RIGHT )
- nFirst++;
- }
- else
- {
- if ( nDirection == CURVE_RIGHT )
- nFirst++;
- }
- fWidth = hypot( mpFloat0[ 1 + nFirst ].fX - aDestPoint.fX, mpFloat0[ 1 + nFirst ].fY - aDestPoint.fY );
- fWidth = sqrt( fWidth * fWidth / 2 );
- if ( fWidth > mfWidthHalf )
- {
- // Spitzer Winkel :
- mnFloat0Points = 6;
- mpFloat0[ (4 + nFirst) ^ 1 ] = aDestPoint;
- aDestPoint -= aN2Vec;
- mpFloat0[ 4 + nFirst ] = aDestPoint;
- mpFloat0[ 1 + nFirst ] += aN1Vec;
- }
- else
- {
- // Stumpferwinkel : Schnittpunkt wird berechnet
- mnFloat0Points = 5;
- ImplFloatPoint aSourcePoint;
- double fX = 0;
- double fY;
- double fBDest = 0;
- double fBSource = 0;
- aSourcePoint = mpFloat0[ 1 + nFirst ];
-
- int nValid = 0;
-
- if ( fabs( aN2Vec.fX ) < 0.00000001 )
- {
- fX = aDestPoint.fX;
- nValid = 1;
- }
- else
- fBDest = aDestPoint.fY - ( aN2Vec.fY / aN2Vec.fX * aDestPoint.fX );
-
- if ( fabs( aN1Vec.fX ) < 0.000000001 )
- {
- fX = aSourcePoint.fX;
- nValid = 2;
- }
- else
- fBSource = aSourcePoint.fY - ( aN1Vec.fY / aN1Vec.fX * aSourcePoint.fX );
-
- if ( !nValid )
- fX = ( fBSource - fBDest ) / ( aN2Vec.fY / aN2Vec.fX - aN1Vec.fY / aN1Vec.fX );
- if ( nValid < 2 )
- fY = aN1Vec.fY / aN1Vec.fX * fX + fBSource;
- else
- fY = aN2Vec.fY / aN2Vec.fX * fX + fBDest;
-
- mpFloat0[ 1 + nFirst ].fX = fX;
- mpFloat0[ 1 + nFirst ].fY = fY;
- mpFloat0[ 4 ] = aDestPoint;
- }
- }
- else if ( ( aN1Vec.fX - aN2Vec.fX + aN1Vec.fY - aN2Vec.fY ) != 0 ) // besitzt zweiter Richtungsvektor die gleiche Steigung aber andere
- bContinues = FALSE; // Richtung, dann wird hinten noch eine halbe Linienbreite angehaengt
- }
- if ( !bContinues )
- {
- mpFloat0[ 1 ] += aN1Vec;
- mpFloat0[ 2 ] += aN1Vec;
- }
- }
- else
- {
- mnFloat0Points = mnFloat1Points;
- ImplFloatPoint* pTemp = mpFloat1;
- mpFloat1 = mpFloat0;
- mpFloat0 = pTemp;
- }
- if ( maLineInfo.GetStyle() == LINE_DASH )
- {
- double fLenghtDone = 0;
- double fLenght = ( mfDashDotLenght > 0.0 ) ? mfDashDotLenght : mfDistanceLenght;
-
- double fDistance;
-
- fDistance = hypot( mpFloat0[ 0 ].fX - mpFloat0[ 1 ].fX, mpFloat0[ 0 ].fY - mpFloat0[ 1 ].fY );
- if ( mnFloat0Points == 5 )
- {
- double fDist = hypot( mpFloat0[ 2 ].fX - mpFloat0[ 3 ].fX, mpFloat0[ 2 ].fY - mpFloat0[ 3 ].fY );
- if ( fDist < fDistance )
- fDistance = fDist;
- }
-
- if ( fDistance > fLenght )
- {
- fLenghtDone = fLenght;
-
- ImplFloatPoint aNVec( mpFloat0[ 0 ].GetNVec( mpFloat0[ 1 ] ) );
- aNVec *= fLenght;
- mnFloat1Points = mnFloat0Points;
- ImplFloatPoint* pTemp = mpFloat1;
- mpFloat1 = mpFloat0;
- mpFloat0 = pTemp;
- mnFloat0Points = 4;
- mpFloat0[ 0 ] = mpFloat0[ 1 ] = mpFloat1[ 0 ];
- mpFloat0[ 1 ] += aNVec;
- mpFloat0[ 2 ] = mpFloat0[ 3 ] = mpFloat1[ 3 ];
- mpFloat0[ 2 ] += aNVec;
-
- mpFloat1[ 0 ] = mpFloat0[ 1 ];
- mpFloat1[ 3 ] = mpFloat0[ 2 ];
- }
- else
- {
- mnFloat1Points = 0;
- fLenghtDone = fDistance;
- }
-
- if ( mfDashDotLenght > 0.0 )
- { // Ein Dash oder Dot wurde erzeugt
- mfDashDotLenght -= fLenghtDone;
- if ( mfDashDotLenght == 0.0 )
- { // Komplett erzeugt
- if ( mnDashCount )
- mnDashCount--;
- else
- mnDotCount--;
-
- if ( ! ( mnDashCount | mnDotCount ) )
- {
- mnDashCount = maLineInfo.GetDashCount();
- mnDotCount = maLineInfo.GetDotCount();
- }
- mfDistanceLenght = maLineInfo.GetDistance();
- }
- }
- else
- { // Das erzeugte Polygon muessen wir ignorieren
- mfDistanceLenght -= fLenghtDone;
- if ( mfDistanceLenght == 0.0 )
- mfDashDotLenght = ( mnDashCount ) ? maLineInfo.GetDashLen() : maLineInfo.GetDotLen();
- continue;
- }
- }
- maPolygon.SetSize( (UINT16)mnFloat0Points );
- UINT16 i = 0;
- maPolygon[ i++ ] = Point( FRound( mpFloat0[ 0 ].fX ), FRound( mpFloat0[ 0 ].fY ) );
- maPolygon[ i++ ] = Point( FRound( mpFloat0[ 1 ].fX ), FRound( mpFloat0[ 1 ].fY ) );
- if ( mnFloat0Points > 4 )
- maPolygon[ i++ ] = Point( FRound( mpFloat0[ 4 ].fX ), FRound( mpFloat0[ 4 ].fY ) );
- if ( mnFloat0Points > 5 )
- maPolygon[ i++ ] = Point( FRound( mpFloat0[ 5 ].fX ), FRound( mpFloat0[ 5 ].fY ) );
- maPolygon[ i++ ] = Point( FRound( mpFloat0[ 2 ].fX ), FRound( mpFloat0[ 2 ].fY ) );
- maPolygon[ i ] = Point( FRound( mpFloat0[ 3 ].fX ), FRound( mpFloat0[ 3 ].fY ) );
-
- }
- else
- {
- if ( !mnFloat1Points )
- {
- mpFloat0[ 0 ] = mpFloatPoint[ mnLinesAvailable-- ];
- mpFloat0[ 1 ] = mpFloatPoint[ mnLinesAvailable ];
- }
- else
- {
- mpFloat0[ 0 ] = mpFloat1[ 0 ];
- mpFloat0[ 1 ] = mpFloat1[ 1 ];
- }
- if ( maLineInfo.GetStyle() == LINE_DASH )
- {
- double fLenghtDone = 0;
- double fLenght = ( mfDashDotLenght > 0.0 ) ? mfDashDotLenght : mfDistanceLenght;
- double fDistance;
- fDistance = hypot( mpFloat0[ 0 ].fX - mpFloat0[ 1 ].fX, mpFloat0[ 0 ].fY - mpFloat0[ 1 ].fY );
- if ( fDistance > fLenght )
- {
- fLenghtDone = fLenght;
- ImplFloatPoint aNVec( mpFloat0[ 0 ].GetNVec( mpFloat0[ 1 ] ) );
- aNVec *= fLenght;
- mpFloat1[ 1 ] = mpFloat0[ 1 ];
- mpFloat0[ 1 ] = mpFloat0[ 0 ];
- mpFloat0[ 1 ] += aNVec;
- mpFloat1[ 0 ] = mpFloat0[ 1 ];
- mnFloat1Points = 2;
- }
- else
- {
- mnFloat1Points = 0;
- fLenghtDone = fDistance;
- }
- if ( mfDashDotLenght > 0.0 )
- { // Ein Dash oder Dot wurde erzeugt
- mfDashDotLenght -= fLenghtDone;
- if ( mfDashDotLenght == 0.0 )
- { // Komplett erzeugt
- if ( mnDashCount )
- mnDashCount--;
- else
- mnDotCount--;
-
- if ( ! ( mnDashCount | mnDotCount ) )
- {
- mnDashCount = maLineInfo.GetDashCount();
- mnDotCount = maLineInfo.GetDotCount();
- }
- mfDistanceLenght = maLineInfo.GetDistance();
- }
- }
- else
- { // Das erzeugte Polygon muessen wir ignorieren
- mfDistanceLenght -= fLenghtDone;
- if ( mfDistanceLenght == 0.0 )
- mfDashDotLenght = ( mnDashCount ) ? maLineInfo.GetDashLen() : maLineInfo.GetDotLen();
- continue;
- }
- }
- maPolygon.SetSize( 2 );
- maPolygon[ 0 ] = Point( (long)mpFloat0[ 0 ].fX, (long)mpFloat0[ 0 ].fY );
- maPolygon[ 1 ] = Point( (long)mpFloat0[ 1 ].fX, (long)mpFloat0[ 1 ].fY );
- }
- return &maPolygon;
- }
- return NULL;
-};
diff --git a/vcl/source/gdi/implncvt.hxx b/vcl/source/gdi/implncvt.hxx
deleted file mode 100644
index 2d369d12f253..000000000000
--- a/vcl/source/gdi/implncvt.hxx
+++ /dev/null
@@ -1,78 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: implncvt.hxx,v $
- * $Revision: 1.5 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _SV_LINECONV_HXX
-#define _SV_LINECONV_HXX
-
-#include <tools/poly.hxx>
-#include <vcl/lineinfo.hxx>
-
-// --------------------
-// - ImplLineConverter
-// --------------------
-
-struct ImplFloatPoint;
-
-class ImplLineConverter
-{
- BOOL mbClosed;
- BOOL mbRefPoint;
- INT32 mnRefDistance;
-
- double mfWidthHalf;
- LineInfo maLineInfo;
-
- double mfDashDotLenght;
- double mfDistanceLenght;
-
- UINT32 mnDashCount;
- UINT32 mnDotCount;
-
- Polygon maPolygon;
- UINT32 mnFloat0Points;
- ImplFloatPoint* mpFloat0;
- UINT32 mnFloat1Points;
- ImplFloatPoint* mpFloat1;
-
- UINT32 mnLinesAvailable;
- UINT32 mnLines;
-
- ImplFloatPoint* mpFloatPoint;
-
- public:
-
- ImplLineConverter( const Polygon& rPoly, const LineInfo& rLineInfo, const Point* pRefPoint );
- ~ImplLineConverter();
-
- const Polygon* ImplGetFirst();
- const Polygon* ImplGetNext();
-};
-
-#endif
diff --git a/vcl/source/gdi/lineinfo.cxx b/vcl/source/gdi/lineinfo.cxx
index 98f16713a145..7aa50811106b 100644
--- a/vcl/source/gdi/lineinfo.cxx
+++ b/vcl/source/gdi/lineinfo.cxx
@@ -34,6 +34,10 @@
#include <tools/vcompat.hxx>
#include <tools/debug.hxx>
#include <vcl/lineinfo.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <basegfx/polygon/b2dlinegeometry.hxx>
+#include <numeric>
DBG_NAME( LineInfo )
@@ -49,7 +53,8 @@ ImplLineInfo::ImplLineInfo() :
mnDashLen ( 0 ),
mnDotCount ( 0 ),
mnDotLen ( 0 ),
- mnDistance ( 0 )
+ mnDistance ( 0 ),
+ meLineJoin ( basegfx::B2DLINEJOIN_ROUND )
{
}
@@ -63,7 +68,8 @@ ImplLineInfo::ImplLineInfo( const ImplLineInfo& rImplLineInfo ) :
mnDashLen ( rImplLineInfo.mnDashLen ),
mnDotCount ( rImplLineInfo.mnDotCount ),
mnDotLen ( rImplLineInfo.mnDotLen ),
- mnDistance ( rImplLineInfo.mnDistance )
+ mnDistance ( rImplLineInfo.mnDistance ),
+ meLineJoin ( rImplLineInfo.meLineJoin )
{
}
@@ -209,6 +215,19 @@ void LineInfo::SetDistance( long nDistance )
// -----------------------------------------------------------------------
+void LineInfo::SetLineJoin(basegfx::B2DLineJoin eLineJoin)
+{
+ DBG_CHKTHIS( LineInfo, NULL );
+
+ if(eLineJoin != mpImplLineInfo->meLineJoin)
+ {
+ ImplMakeUnique();
+ mpImplLineInfo->meLineJoin = eLineJoin;
+ }
+}
+
+// -----------------------------------------------------------------------
+
SvStream& operator>>( SvStream& rIStm, ImplLineInfo& rImplLineInfo )
{
VersionCompat aCompat( rIStm, STREAM_READ );
@@ -225,6 +244,12 @@ SvStream& operator>>( SvStream& rIStm, ImplLineInfo& rImplLineInfo )
rIStm >> rImplLineInfo.mnDistance;
}
+ if( aCompat.GetVersion() >= 3 )
+ {
+ // version 3
+ rIStm >> nTmp16; rImplLineInfo.meLineJoin = (basegfx::B2DLineJoin) nTmp16;
+ }
+
return rIStm;
}
@@ -232,7 +257,7 @@ SvStream& operator>>( SvStream& rIStm, ImplLineInfo& rImplLineInfo )
SvStream& operator<<( SvStream& rOStm, const ImplLineInfo& rImplLineInfo )
{
- VersionCompat aCompat( rOStm, STREAM_WRITE, 2 );
+ VersionCompat aCompat( rOStm, STREAM_WRITE, 3 );
// version 1
rOStm << (UINT16) rImplLineInfo.meStyle << rImplLineInfo.mnWidth;
@@ -242,6 +267,9 @@ SvStream& operator<<( SvStream& rOStm, const ImplLineInfo& rImplLineInfo )
rOStm << rImplLineInfo.mnDotCount << rImplLineInfo.mnDotLen;
rOStm << rImplLineInfo.mnDistance;
+ // since version3
+ rOStm << (UINT16) rImplLineInfo.meLineJoin;
+
return rOStm;
}
@@ -259,3 +287,78 @@ SvStream& operator<<( SvStream& rOStm, const LineInfo& rLineInfo )
{
return( rOStm << *rLineInfo.mpImplLineInfo );
}
+
+// -----------------------------------------------------------------------
+
+bool LineInfo::isDashDotOrFatLineUsed() const
+{
+ return (LINE_DASH == GetStyle() || GetWidth() > 1);
+}
+
+// -----------------------------------------------------------------------
+
+void LineInfo::applyToB2DPolyPolygon(
+ basegfx::B2DPolyPolygon& io_rLinePolyPolygon,
+ basegfx::B2DPolyPolygon& o_rFillPolyPolygon) const
+{
+ o_rFillPolyPolygon.clear();
+
+ if(io_rLinePolyPolygon.count())
+ {
+ if(LINE_DASH == GetStyle())
+ {
+ ::std::vector< double > fDotDashArray;
+ const double fDashLen(GetDashLen());
+ const double fDotLen(GetDotLen());
+ const double fDistance(GetDistance());
+
+ for(sal_uInt16 a(0); a < GetDashCount(); a++)
+ {
+ fDotDashArray.push_back(fDashLen);
+ fDotDashArray.push_back(fDistance);
+ }
+
+ for(sal_uInt16 b(0); b < GetDotCount(); b++)
+ {
+ fDotDashArray.push_back(fDotLen);
+ fDotDashArray.push_back(fDistance);
+ }
+
+ const double fAccumulated(::std::accumulate(fDotDashArray.begin(), fDotDashArray.end(), 0.0));
+
+ if(fAccumulated > 0.0)
+ {
+ basegfx::B2DPolyPolygon aResult;
+
+ for(sal_uInt32 c(0); c < io_rLinePolyPolygon.count(); c++)
+ {
+ basegfx::B2DPolyPolygon aLineTraget;
+ basegfx::tools::applyLineDashing(
+ io_rLinePolyPolygon.getB2DPolygon(c),
+ fDotDashArray,
+ &aLineTraget);
+ aResult.append(aLineTraget);
+ }
+
+ io_rLinePolyPolygon = aResult;
+ }
+ }
+
+ if(GetWidth() > 1 && io_rLinePolyPolygon.count())
+ {
+ const double fHalfLineWidth((GetWidth() * 0.5) + 0.5);
+
+ for(sal_uInt32 a(0); a < io_rLinePolyPolygon.count(); a++)
+ {
+ o_rFillPolyPolygon.append(basegfx::tools::createAreaGeometry(
+ io_rLinePolyPolygon.getB2DPolygon(a),
+ fHalfLineWidth,
+ GetLineJoin()));
+ }
+
+ io_rLinePolyPolygon.clear();
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
diff --git a/vcl/source/gdi/makefile.mk b/vcl/source/gdi/makefile.mk
index a09ae92dcb5e..eda537bf629a 100644..100755
--- a/vcl/source/gdi/makefile.mk
+++ b/vcl/source/gdi/makefile.mk
@@ -1,7 +1,7 @@
#*************************************************************************
#
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
+#
# Copyright 2008 by Sun Microsystems, Inc.
#
# OpenOffice.org - a multi-platform office productivity suite
@@ -51,7 +51,34 @@ CDEFS+=-DENABLE_GRAPHITE
# --- Files --------------------------------------------------------
-SLOFILES= $(SLO)$/salmisc.obj \
+EXCEPTIONSFILES= $(SLO)$/salmisc.obj \
+ $(SLO)$/outdev.obj \
+ $(SLO)$/outdev3.obj \
+ $(SLO)$/gfxlink.obj \
+ $(SLO)$/print.obj \
+ $(SLO)$/print2.obj \
+ $(SLO)$/configsettings.obj \
+ $(SLO)$/sallayout.obj \
+ $(SLO)$/image.obj \
+ $(SLO)$/impimage.obj \
+ $(SLO)$/impgraph.obj \
+ $(SLO)$/metric.obj \
+ $(SLO)$/pdfwriter_impl.obj \
+ $(SLO)$/pdffontcache.obj\
+ $(SLO)$/bmpconv.obj \
+ $(SLO)$/pdfextoutdevdata.obj \
+ $(SLO)$/jobset.obj \
+ $(SLO)$/impimagetree.obj \
+ $(SLO)$/pngread.obj \
+ $(SLO)$/pngwrite.obj \
+ $(SLO)$/virdev.obj \
+ $(SLO)$/impprn.obj \
+ $(SLO)$/gdimtf.obj \
+ $(SLO)$/graphictools.obj \
+ $(SLO)$/textlayout.obj \
+ $(SLO)$/lineinfo.obj
+
+SLOFILES= $(EXCEPTIONSFILES) \
$(SLO)$/animate.obj \
$(SLO)$/impanmvw.obj \
$(SLO)$/bitmap.obj \
@@ -68,81 +95,28 @@ SLOFILES= $(SLO)$/salmisc.obj \
$(SLO)$/cvtsvm.obj \
$(SLO)$/cvtgrf.obj \
$(SLO)$/font.obj \
- $(SLO)$/gdimtf.obj \
- $(SLO)$/gfxlink.obj \
$(SLO)$/gradient.obj \
$(SLO)$/hatch.obj \
$(SLO)$/graph.obj \
- $(SLO)$/image.obj \
- $(SLO)$/impimage.obj \
$(SLO)$/impbmp.obj \
- $(SLO)$/impgraph.obj \
- $(SLO)$/impimagetree.obj \
$(SLO)$/imagerepository.obj \
- $(SLO)$/impprn.obj \
$(SLO)$/impvect.obj \
- $(SLO)$/implncvt.obj \
- $(SLO)$/jobset.obj \
- $(SLO)$/lineinfo.obj \
$(SLO)$/mapmod.obj \
$(SLO)$/metaact.obj \
- $(SLO)$/metric.obj \
$(SLO)$/octree.obj \
$(SLO)$/outmap.obj \
- $(SLO)$/outdev.obj \
$(SLO)$/outdev2.obj \
- $(SLO)$/outdev3.obj \
$(SLO)$/outdev4.obj \
$(SLO)$/outdev5.obj \
$(SLO)$/outdev6.obj \
- $(SLO)$/virdev.obj \
- $(SLO)$/fontcvt.obj \
- $(SLO)$/print.obj \
- $(SLO)$/print2.obj \
$(SLO)$/regband.obj \
$(SLO)$/region.obj \
$(SLO)$/wall.obj \
- $(SLO)$/fontcfg.obj \
$(SLO)$/base14.obj \
$(SLO)$/pdfwriter.obj \
- $(SLO)$/pdfwriter_impl.obj \
- $(SLO)$/pdffontcache.obj\
- $(SLO)$/sallayout.obj \
$(SLO)$/salgdilayout.obj \
$(SLO)$/extoutdevdata.obj \
- $(SLO)$/pdfextoutdevdata.obj \
- $(SLO)$/salnativewidgets-none.obj \
- $(SLO)$/bmpconv.obj \
- $(SLO)$/pngread.obj \
- $(SLO)$/pngwrite.obj \
- $(SLO)$/graphictools.obj
-
-EXCEPTIONSFILES= $(SLO)$/salmisc.obj \
- $(SLO)$/outdev.obj \
- $(SLO)$/outdev3.obj \
- $(SLO)$/gfxlink.obj \
- $(SLO)$/print.obj \
- $(SLO)$/print2.obj \
- $(SLO)$/sallayout.obj \
- $(SLO)$/image.obj \
- $(SLO)$/impimage.obj \
- $(SLO)$/impgraph.obj \
- $(SLO)$/metric.obj \
- $(SLO)$/pdfwriter_impl.obj \
- $(SLO)$/pdffontcache.obj\
- $(SLO)$/fontcfg.obj \
- $(SLO)$/bmpconv.obj \
- $(SLO)$/pdfextoutdevdata.obj \
- $(SLO)$/fontcvt.obj \
- $(SLO)$/jobset.obj \
- $(SLO)$/impimagetree.obj \
- $(SLO)$/pngread.obj \
- $(SLO)$/pngwrite.obj \
- $(SLO)$/virdev.obj \
- $(SLO)$/impprn.obj \
- $(SLO)$/gdimtf.obj \
- $(SLO)$/graphictools.obj
-
+ $(SLO)$/salnativewidgets-none.obj
# --- Targets ------------------------------------------------------
diff --git a/vcl/source/gdi/metaact.cxx b/vcl/source/gdi/metaact.cxx
index 4fe9a41be797..1f27ad2afe7d 100644
--- a/vcl/source/gdi/metaact.cxx
+++ b/vcl/source/gdi/metaact.cxx
@@ -52,14 +52,6 @@ inline void ImplScalePoint( Point& rPt, double fScaleX, double fScaleY )
// ------------------------------------------------------------------------
-inline void ImplScaleSize( Size& rSz, double fScaleX, double fScaleY )
-{
- rSz.Width() = FRound( fScaleX * rSz.Width() );
- rSz.Height() = FRound( fScaleY * rSz.Height() );
-}
-
-// ------------------------------------------------------------------------
-
inline void ImplScaleRect( Rectangle& rRect, double fScaleX, double fScaleY )
{
Point aTL( rRect.TopLeft() );
@@ -69,6 +61,7 @@ inline void ImplScaleRect( Rectangle& rRect, double fScaleX, double fScaleY )
ImplScalePoint( aBR, fScaleX, fScaleY );
rRect = Rectangle( aTL, aBR );
+ rRect.Justify();
}
// ------------------------------------------------------------------------
@@ -85,7 +78,7 @@ inline void ImplScaleLineInfo( LineInfo& rLineInfo, double fScaleX, double fScal
{
if( !rLineInfo.IsDefault() )
{
- const double fScale = ( fScaleX + fScaleY ) * 0.5;
+ const double fScale = ( fabs(fScaleX) + fabs(fScaleY) ) * 0.5;
rLineInfo.SetWidth( FRound( fScale * rLineInfo.GetWidth() ) );
rLineInfo.SetDashLen( FRound( fScale * rLineInfo.GetDashLen() ) );
@@ -598,8 +591,8 @@ void MetaRoundRectAction::Move( long nHorzMove, long nVertMove )
void MetaRoundRectAction::Scale( double fScaleX, double fScaleY )
{
ImplScaleRect( maRect, fScaleX, fScaleY );
- mnHorzRound = FRound( mnHorzRound * fScaleX );
- mnVertRound = FRound( mnVertRound * fScaleY );
+ mnHorzRound = FRound( mnHorzRound * fabs(fScaleX) );
+ mnVertRound = FRound( mnVertRound * fabs(fScaleY) );
}
// ------------------------------------------------------------------------
@@ -989,7 +982,7 @@ void MetaPolyLineAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
WRITE_BASE_COMPAT( rOStm, 3, pData );
Polygon aSimplePoly;
- maPoly.GetSimple( aSimplePoly );
+ maPoly.AdaptiveSubdivide( aSimplePoly );
rOStm << aSimplePoly; // Version 1
rOStm << maLineInfo; // Version 2
@@ -1077,7 +1070,7 @@ void MetaPolygonAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
WRITE_BASE_COMPAT( rOStm, 2, pData );
Polygon aSimplePoly; // Version 1
- maPoly.GetSimple( aSimplePoly );
+ maPoly.AdaptiveSubdivide( aSimplePoly );
rOStm << aSimplePoly;
sal_uInt8 bHasPolyFlags = maPoly.HasFlags(); // Version 2
@@ -1169,7 +1162,7 @@ void MetaPolyPolygonAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
const Polygon& rPoly = maPolyPoly.GetObject( i );
if ( rPoly.HasFlags() )
nNumberOfComplexPolygons++;
- rPoly.GetSimple( aSimplePoly );
+ rPoly.AdaptiveSubdivide( aSimplePoly );
rOStm << aSimplePoly;
}
@@ -1396,7 +1389,7 @@ void MetaTextArrayAction::Scale( double fScaleX, double fScaleY )
if ( mpDXAry && mnLen )
{
for ( USHORT i = 0, nCount = mnLen; i < nCount; i++ )
- mpDXAry[ i ] = FRound( mpDXAry[ i ] * fScaleX );
+ mpDXAry[ i ] = FRound( mpDXAry[ i ] * fabs(fScaleX) );
}
}
@@ -1524,7 +1517,7 @@ void MetaStretchTextAction::Move( long nHorzMove, long nVertMove )
void MetaStretchTextAction::Scale( double fScaleX, double fScaleY )
{
ImplScalePoint( maPt, fScaleX, fScaleY );
- mnWidth = (ULONG)FRound( mnWidth * fScaleX );
+ mnWidth = (ULONG)FRound( mnWidth * fabs(fScaleX) );
}
// ------------------------------------------------------------------------
@@ -1717,7 +1710,7 @@ void MetaTextLineAction::Move( long nHorzMove, long nVertMove )
void MetaTextLineAction::Scale( double fScaleX, double fScaleY )
{
ImplScalePoint( maPos, fScaleX, fScaleY );
- mnWidth = FRound( mnWidth * fScaleX );
+ mnWidth = FRound( mnWidth * fabs(fScaleX) );
}
// ------------------------------------------------------------------------
@@ -1876,8 +1869,10 @@ void MetaBmpScaleAction::Move( long nHorzMove, long nVertMove )
void MetaBmpScaleAction::Scale( double fScaleX, double fScaleY )
{
- ImplScalePoint( maPt, fScaleX, fScaleY );
- ImplScaleSize( maSz, fScaleX, fScaleY );
+ Rectangle aRectangle(maPt, maSz);
+ ImplScaleRect( aRectangle, fScaleX, fScaleY );
+ maPt = aRectangle.TopLeft();
+ maSz = aRectangle.GetSize();
}
// ------------------------------------------------------------------------
@@ -1953,8 +1948,10 @@ void MetaBmpScalePartAction::Move( long nHorzMove, long nVertMove )
void MetaBmpScalePartAction::Scale( double fScaleX, double fScaleY )
{
- ImplScalePoint( maDstPt, fScaleX, fScaleY );
- ImplScaleSize( maDstSz, fScaleX, fScaleY );
+ Rectangle aRectangle(maDstPt, maDstSz);
+ ImplScaleRect( aRectangle, fScaleX, fScaleY );
+ maDstPt = aRectangle.TopLeft();
+ maDstSz = aRectangle.GetSize();
}
// ------------------------------------------------------------------------
@@ -2099,8 +2096,10 @@ void MetaBmpExScaleAction::Move( long nHorzMove, long nVertMove )
void MetaBmpExScaleAction::Scale( double fScaleX, double fScaleY )
{
- ImplScalePoint( maPt, fScaleX, fScaleY );
- ImplScaleSize( maSz, fScaleX, fScaleY );
+ Rectangle aRectangle(maPt, maSz);
+ ImplScaleRect( aRectangle, fScaleX, fScaleY );
+ maPt = aRectangle.TopLeft();
+ maSz = aRectangle.GetSize();
}
// ------------------------------------------------------------------------
@@ -2176,8 +2175,10 @@ void MetaBmpExScalePartAction::Move( long nHorzMove, long nVertMove )
void MetaBmpExScalePartAction::Scale( double fScaleX, double fScaleY )
{
- ImplScalePoint( maDstPt, fScaleX, fScaleY );
- ImplScaleSize( maDstSz, fScaleX, fScaleY );
+ Rectangle aRectangle(maDstPt, maDstSz);
+ ImplScaleRect( aRectangle, fScaleX, fScaleY );
+ maDstPt = aRectangle.TopLeft();
+ maDstSz = aRectangle.GetSize();
}
// ------------------------------------------------------------------------
@@ -2328,8 +2329,10 @@ void MetaMaskScaleAction::Move( long nHorzMove, long nVertMove )
void MetaMaskScaleAction::Scale( double fScaleX, double fScaleY )
{
- ImplScalePoint( maPt, fScaleX, fScaleY );
- ImplScaleSize( maSz, fScaleX, fScaleY );
+ Rectangle aRectangle(maPt, maSz);
+ ImplScaleRect( aRectangle, fScaleX, fScaleY );
+ maPt = aRectangle.TopLeft();
+ maSz = aRectangle.GetSize();
}
// ------------------------------------------------------------------------
@@ -2408,8 +2411,10 @@ void MetaMaskScalePartAction::Move( long nHorzMove, long nVertMove )
void MetaMaskScalePartAction::Scale( double fScaleX, double fScaleY )
{
- ImplScalePoint( maDstPt, fScaleX, fScaleY );
- ImplScaleSize( maDstSz, fScaleX, fScaleY );
+ Rectangle aRectangle(maDstPt, maDstSz);
+ ImplScaleRect( aRectangle, fScaleX, fScaleY );
+ maDstPt = aRectangle.TopLeft();
+ maDstSz = aRectangle.GetSize();
}
// ------------------------------------------------------------------------
@@ -2581,7 +2586,13 @@ sal_Bool MetaGradientExAction::Compare( const MetaAction& rMetaAction ) const
void MetaGradientExAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
{
WRITE_BASE_COMPAT( rOStm, 1, pData );
- rOStm << maPolyPoly << maGradient;
+
+ // #i105373# see comment at MetaTransparentAction::Write
+ PolyPolygon aNoCurvePolyPolygon;
+ maPolyPoly.AdaptiveSubdivide(aNoCurvePolyPolygon);
+
+ rOStm << aNoCurvePolyPolygon;
+ rOStm << maGradient;
}
// ------------------------------------------------------------------------
@@ -2649,7 +2660,13 @@ sal_Bool MetaHatchAction::Compare( const MetaAction& rMetaAction ) const
void MetaHatchAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
{
WRITE_BASE_COMPAT( rOStm, 1, pData );
- rOStm << maPolyPoly << maHatch;
+
+ // #i105373# see comment at MetaTransparentAction::Write
+ PolyPolygon aNoCurvePolyPolygon;
+ maPolyPoly.AdaptiveSubdivide(aNoCurvePolyPolygon);
+
+ rOStm << aNoCurvePolyPolygon;
+ rOStm << maHatch;
}
// ------------------------------------------------------------------------
@@ -3486,9 +3503,9 @@ MetaAction* MetaFontAction::Clone()
void MetaFontAction::Scale( double fScaleX, double fScaleY )
{
- Size aSize( maFont.GetSize() );
-
- ImplScaleSize( aSize, fScaleX, fScaleY );
+ const Size aSize(
+ FRound(maFont.GetSize().Width() * fabs(fScaleX)),
+ FRound(maFont.GetSize().Height() * fabs(fScaleY)));
maFont.SetSize( aSize );
}
@@ -3716,7 +3733,20 @@ sal_Bool MetaTransparentAction::Compare( const MetaAction& rMetaAction ) const
void MetaTransparentAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
{
WRITE_BASE_COMPAT( rOStm, 1, pData );
- rOStm << maPolyPoly;
+
+ // #i105373# The PolyPolygon in this action may be a curve; this
+ // was ignored until now what is an error. To make older office
+ // versions work with MetaFiles, i opt for applying AdaptiveSubdivide
+ // to the PolyPoylgon.
+ // The alternative would be to really write the curve information
+ // like in MetaPolyPolygonAction::Write (where someone extended it
+ // correctly, but not here :-( ).
+ // The golden solution would be to combine both, but i think it's
+ // not necessary; a good subdivision will be sufficient.
+ PolyPolygon aNoCurvePolyPolygon;
+ maPolyPoly.AdaptiveSubdivide(aNoCurvePolyPolygon);
+
+ rOStm << aNoCurvePolyPolygon;
rOStm << mnTransPercent;
}
@@ -3766,14 +3796,18 @@ MetaAction* MetaFloatTransparentAction::Clone()
void MetaFloatTransparentAction::Move( long nHorzMove, long nVertMove )
{
maPoint.Move( nHorzMove, nVertMove );
+ maMtf.Move(nHorzMove, nVertMove);
}
// ------------------------------------------------------------------------
void MetaFloatTransparentAction::Scale( double fScaleX, double fScaleY )
{
- ImplScalePoint( maPoint, fScaleX, fScaleY );
- ImplScaleSize( maSize, fScaleX, fScaleY );
+ Rectangle aRectangle(maPoint, maSize);
+ ImplScaleRect( aRectangle, fScaleX, fScaleY );
+ maPoint = aRectangle.TopLeft();
+ maSize = aRectangle.GetSize();
+ maMtf.Scale(fScaleX, fScaleY);
}
// ------------------------------------------------------------------------
@@ -3847,8 +3881,10 @@ void MetaEPSAction::Move( long nHorzMove, long nVertMove )
void MetaEPSAction::Scale( double fScaleX, double fScaleY )
{
- ImplScalePoint( maPoint, fScaleX, fScaleY );
- ImplScaleSize( maSize, fScaleX, fScaleY );
+ Rectangle aRectangle(maPoint, maSize);
+ ImplScaleRect( aRectangle, fScaleX, fScaleY );
+ maPoint = aRectangle.TopLeft();
+ maSize = aRectangle.GetSize();
}
// ------------------------------------------------------------------------
diff --git a/vcl/source/gdi/outdev.cxx b/vcl/source/gdi/outdev.cxx
index 5b543258cb0b..91ea8419cba9 100644
--- a/vcl/source/gdi/outdev.cxx
+++ b/vcl/source/gdi/outdev.cxx
@@ -56,7 +56,6 @@
#include <vcl/gdimtf.hxx>
#include <vcl/outdata.hxx>
#include <vcl/print.hxx>
-#include <implncvt.hxx>
#include <vcl/outdev.h>
#include <vcl/outdev.hxx>
#include <vcl/unowrap.hxx>
@@ -77,6 +76,8 @@
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <vcl/unohelp.hxx>
+#include <numeric>
+
using namespace ::com::sun::star;
DBG_NAME( OutputDevice )
@@ -1128,11 +1129,16 @@ namespace
{
inline int iround( float x )
{
- sal_Int32 a = *reinterpret_cast<const sal_Int32 *>(&x);
- sal_Int32 exponent = (127 + 31) - ((a >> 23) & 0xFF);
- sal_Int32 r = ((sal_Int32(a) << 8) | (1U << 31)) >> exponent;
+ union
+ {
+ float f;
+ sal_Int32 i;
+ };
+ f = x;
+ sal_Int32 exponent = (127 + 31) - ((i >> 23) & 0xFF);
+ sal_Int32 r = ((sal_Int32(i) << 8) | (1U << 31)) >> exponent;
r &= ((exponent - 32) >> 31);
- sal_Int32 sign = a >> 31;
+ sal_Int32 sign = i >> 31;
return r = (r ^ sign) - sign;
}
@@ -2325,6 +2331,130 @@ void OutputDevice::DrawLine( const Point& rStartPt, const Point& rEndPt )
// -----------------------------------------------------------------------
+void OutputDevice::impPaintLineGeometryWithEvtlExpand(
+ const LineInfo& rInfo,
+ basegfx::B2DPolyPolygon aLinePolyPolygon)
+{
+ const bool bTryAA((mnAntialiasing & ANTIALIASING_ENABLE_B2DDRAW)
+ && mpGraphics->supportsOperation(OutDevSupport_B2DDraw)
+ && ROP_OVERPAINT == GetRasterOp()
+ && IsLineColor());
+ basegfx::B2DPolyPolygon aFillPolyPolygon;
+ const bool bDashUsed(LINE_DASH == rInfo.GetStyle());
+ const bool bLineWidthUsed(rInfo.GetWidth() > 1);
+
+ if(bDashUsed && aLinePolyPolygon.count())
+ {
+ ::std::vector< double > fDotDashArray;
+ const double fDashLen(rInfo.GetDashLen());
+ const double fDotLen(rInfo.GetDotLen());
+ const double fDistance(rInfo.GetDistance());
+
+ for(sal_uInt16 a(0); a < rInfo.GetDashCount(); a++)
+ {
+ fDotDashArray.push_back(fDashLen);
+ fDotDashArray.push_back(fDistance);
+ }
+
+ for(sal_uInt16 b(0); b < rInfo.GetDotCount(); b++)
+ {
+ fDotDashArray.push_back(fDotLen);
+ fDotDashArray.push_back(fDistance);
+ }
+
+ const double fAccumulated(::std::accumulate(fDotDashArray.begin(), fDotDashArray.end(), 0.0));
+
+ if(fAccumulated > 0.0)
+ {
+ basegfx::B2DPolyPolygon aResult;
+
+ for(sal_uInt32 c(0); c < aLinePolyPolygon.count(); c++)
+ {
+ basegfx::B2DPolyPolygon aLineTraget;
+ basegfx::tools::applyLineDashing(
+ aLinePolyPolygon.getB2DPolygon(c),
+ fDotDashArray,
+ &aLineTraget);
+ aResult.append(aLineTraget);
+ }
+
+ aLinePolyPolygon = aResult;
+ }
+ }
+
+ if(bLineWidthUsed && aLinePolyPolygon.count())
+ {
+ const double fHalfLineWidth((rInfo.GetWidth() * 0.5) + 0.5);
+
+ for(sal_uInt32 a(0); a < aLinePolyPolygon.count(); a++)
+ {
+ aFillPolyPolygon.append(basegfx::tools::createAreaGeometry(
+ aLinePolyPolygon.getB2DPolygon(a),
+ fHalfLineWidth,
+ rInfo.GetLineJoin()));
+ }
+
+ aLinePolyPolygon.clear();
+ }
+
+ GDIMetaFile* pOldMetaFile = mpMetaFile;
+ mpMetaFile = NULL;
+
+ if(aLinePolyPolygon.count())
+ {
+ for(sal_uInt32 a(0); a < aLinePolyPolygon.count(); a++)
+ {
+ const basegfx::B2DPolygon aCandidate(aLinePolyPolygon.getB2DPolygon(a));
+ bool bDone(false);
+
+ if(bTryAA)
+ {
+ bDone = mpGraphics->DrawPolyLine(aCandidate, basegfx::B2DVector(1.0, 1.0), basegfx::B2DLINEJOIN_NONE, this);
+ }
+
+ if(!bDone)
+ {
+ const Polygon aPolygon(aCandidate);
+ mpGraphics->DrawPolyLine(aPolygon.GetSize(), (const SalPoint*)aPolygon.GetConstPointAry(), this);
+ }
+ }
+ }
+
+ if(aFillPolyPolygon.count())
+ {
+ const Color aOldLineColor( maLineColor );
+ const Color aOldFillColor( maFillColor );
+
+ SetLineColor();
+ ImplInitLineColor();
+ SetFillColor( aOldLineColor );
+ ImplInitFillColor();
+
+ bool bDone(false);
+
+ if(bTryAA)
+ {
+ bDone = mpGraphics->DrawPolyPolygon(aFillPolyPolygon, 0.0, this);
+ }
+
+ if(!bDone)
+ {
+ for(sal_uInt32 a(0); a < aFillPolyPolygon.count(); a++)
+ {
+ const Polygon aPolygon(aFillPolyPolygon.getB2DPolygon(a));
+ mpGraphics->DrawPolygon(aPolygon.GetSize(), (const SalPoint*)aPolygon.GetConstPointAry(), this);
+ }
+ }
+
+ SetFillColor( aOldFillColor );
+ SetLineColor( aOldLineColor );
+ }
+
+ mpMetaFile = pOldMetaFile;
+}
+
+// -----------------------------------------------------------------------
+
void OutputDevice::DrawLine( const Point& rStartPt, const Point& rEndPt,
const LineInfo& rLineInfo )
{
@@ -2352,47 +2482,22 @@ void OutputDevice::DrawLine( const Point& rStartPt, const Point& rEndPt,
if ( mbOutputClipped )
return;
+ const Point aStartPt( ImplLogicToDevicePixel( rStartPt ) );
+ const Point aEndPt( ImplLogicToDevicePixel( rEndPt ) );
const LineInfo aInfo( ImplLogicToDevicePixel( rLineInfo ) );
+ const bool bDashUsed(LINE_DASH == aInfo.GetStyle());
+ const bool bLineWidthUsed(aInfo.GetWidth() > 1);
- if( ( aInfo.GetWidth() > 1L ) || ( LINE_DASH == aInfo.GetStyle() ) )
+ if(bDashUsed || bLineWidthUsed)
{
- Polygon aPoly( 2 ); aPoly[ 0 ] = rStartPt; aPoly[ 1 ] = rEndPt;
- GDIMetaFile* pOldMetaFile = mpMetaFile;
- ImplLineConverter aLineCvt( ImplLogicToDevicePixel( aPoly ), aInfo, ( mbRefPoint ) ? &maRefPoint : NULL );
-
- mpMetaFile = NULL;
+ basegfx::B2DPolygon aLinePolygon;
+ aLinePolygon.append(basegfx::B2DPoint(aStartPt.X(), aStartPt.Y()));
+ aLinePolygon.append(basegfx::B2DPoint(aEndPt.X(), aEndPt.Y()));
- if ( aInfo.GetWidth() > 1 )
- {
- const Color aOldLineColor( maLineColor );
- const Color aOldFillColor( maFillColor );
-
- SetLineColor();
- ImplInitLineColor();
- SetFillColor( aOldLineColor );
- ImplInitFillColor();
-
- for( const Polygon* pPoly = aLineCvt.ImplGetFirst(); pPoly; pPoly = aLineCvt.ImplGetNext() )
- mpGraphics->DrawPolygon( pPoly->GetSize(), (const SalPoint*) pPoly->GetConstPointAry(), this );
-
- SetFillColor( aOldFillColor );
- SetLineColor( aOldLineColor );
- }
- else
- {
- if ( mbInitLineColor )
- ImplInitLineColor();
-
- for ( const Polygon* pPoly = aLineCvt.ImplGetFirst(); pPoly; pPoly = aLineCvt.ImplGetNext() )
- mpGraphics->DrawLine( (*pPoly)[ 0 ].X(), (*pPoly)[ 0 ].Y(), (*pPoly)[ 1 ].X(), (*pPoly)[ 1 ].Y(), this );
- }
- mpMetaFile = pOldMetaFile;
+ impPaintLineGeometryWithEvtlExpand(aInfo, basegfx::B2DPolyPolygon(aLinePolygon));
}
else
{
- const Point aStartPt( ImplLogicToDevicePixel( rStartPt ) );
- const Point aEndPt( ImplLogicToDevicePixel( rEndPt ) );
-
if ( mbInitLineColor )
ImplInitLineColor();
@@ -2541,7 +2646,7 @@ void OutputDevice::DrawPolyLine( const Polygon& rPoly, const LineInfo& rLineInfo
if((mnAntialiasing & ANTIALIASING_ENABLE_B2DDRAW)
&& LINE_SOLID == rLineInfo.GetStyle())
{
- DrawPolyLine(rPoly.getB2DPolygon(), (double)rLineInfo.GetWidth(), basegfx::B2DLINEJOIN_ROUND);
+ DrawPolyLine(rPoly.getB2DPolygon(), (double)rLineInfo.GetWidth(), rLineInfo.GetLineJoin());
return;
}
@@ -2553,7 +2658,7 @@ void OutputDevice::DrawPolyLine( const Polygon& rPoly, const LineInfo& rLineInfo
void OutputDevice::ImpDrawPolyLineWithLineInfo(const Polygon& rPoly, const LineInfo& rLineInfo)
{
- USHORT nPoints = rPoly.GetSize();
+ USHORT nPoints(rPoly.GetSize());
if ( !IsDeviceOutputNecessary() || !mbLineColor || ( nPoints < 2 ) || ( LINE_NONE == rLineInfo.GetStyle() ) || ImplIsRecordLayout() )
return;
@@ -2561,11 +2666,19 @@ void OutputDevice::ImpDrawPolyLineWithLineInfo(const Polygon& rPoly, const LineI
Polygon aPoly = ImplLogicToDevicePixel( rPoly );
// #100127# LineInfo is not curve-safe, subdivide always
- if( aPoly.HasFlags() )
- {
- aPoly = ImplSubdivideBezier( aPoly );
- nPoints = aPoly.GetSize();
- }
+ //
+ // What shall this mean? It's wrong to subdivide here when the
+ // polygon is a fat line. In that case, the painted geometry
+ // WILL be much different.
+ // I also have no idea how this could be related to the given ID
+ // which reads 'consolidate boost versions' in the task description.
+ // Removing.
+ //
+ //if( aPoly.HasFlags() )
+ //{
+ // aPoly = ImplSubdivideBezier( aPoly );
+ // nPoints = aPoly.GetSize();
+ //}
// we need a graphics
if ( !mpGraphics && !ImplGetGraphics() )
@@ -2577,67 +2690,29 @@ void OutputDevice::ImpDrawPolyLineWithLineInfo(const Polygon& rPoly, const LineI
if ( mbOutputClipped )
return;
- const LineInfo aInfo( ImplLogicToDevicePixel( rLineInfo ) );
- const bool bTryAA((mnAntialiasing & ANTIALIASING_ENABLE_B2DDRAW)
- && mpGraphics->supportsOperation(OutDevSupport_B2DDraw)
- && ROP_OVERPAINT == GetRasterOp()
- && IsLineColor());
-
- if( aInfo.GetWidth() > 1L )
- {
- const Color aOldLineColor( maLineColor );
- const Color aOldFillColor( maFillColor );
- GDIMetaFile* pOldMetaFile = mpMetaFile;
- ImplLineConverter aLineCvt( aPoly, aInfo, ( mbRefPoint ) ? &maRefPoint : NULL );
-
- mpMetaFile = NULL;
- SetLineColor();
+ if ( mbInitLineColor )
ImplInitLineColor();
- SetFillColor( aOldLineColor );
- ImplInitFillColor();
- bool bDone(false);
- if(bTryAA)
- {
- // #i101491# try AAed version
- // Use old on-the-fly geometry preparation, combine with AA
- bool bSuccess(true);
-
- for(const Polygon* pPoly = aLineCvt.ImplGetFirst(); bSuccess && pPoly; pPoly = aLineCvt.ImplGetNext())
- {
- bSuccess = mpGraphics->DrawPolyPolygon(basegfx::B2DPolyPolygon(pPoly->getB2DPolygon()), 0.0, this);
- }
-
- if(bSuccess)
- {
- bDone = true;
- }
- }
-
- if(!bDone)
- {
- for( const Polygon* pPoly = aLineCvt.ImplGetFirst(); pPoly; pPoly = aLineCvt.ImplGetNext() )
- {
- mpGraphics->DrawPolygon( pPoly->GetSize(), (const SalPoint*) pPoly->GetConstPointAry(), this );
- }
- }
+ const LineInfo aInfo( ImplLogicToDevicePixel( rLineInfo ) );
+ const bool bDashUsed(LINE_DASH == aInfo.GetStyle());
+ const bool bLineWidthUsed(aInfo.GetWidth() > 1);
- SetLineColor( aOldLineColor );
- SetFillColor( aOldFillColor );
- mpMetaFile = pOldMetaFile;
+ if(bDashUsed || bLineWidthUsed)
+ {
+ impPaintLineGeometryWithEvtlExpand(aInfo, basegfx::B2DPolyPolygon(aPoly.getB2DPolygon()));
}
else
{
- if ( mbInitLineColor )
- ImplInitLineColor();
- if ( LINE_DASH == aInfo.GetStyle() )
+ // #100127# the subdivision HAS to be done here since only a pointer
+ // to an array of points is given to the DrawPolyLine method, there is
+ // NO way to find out there that it's a curve.
+ if( aPoly.HasFlags() )
{
- ImplLineConverter aLineCvt( aPoly, aInfo, ( mbRefPoint ) ? &maRefPoint : NULL );
- for( const Polygon* pPoly = aLineCvt.ImplGetFirst(); pPoly; pPoly = aLineCvt.ImplGetNext() )
- mpGraphics->DrawPolyLine( pPoly->GetSize(), (const SalPoint*)pPoly->GetConstPointAry(), this );
+ aPoly = ImplSubdivideBezier( aPoly );
+ nPoints = aPoly.GetSize();
}
- else
- mpGraphics->DrawPolyLine( nPoints, (const SalPoint*) aPoly.GetConstPointAry(), this );
+
+ mpGraphics->DrawPolyLine(nPoints, (const SalPoint*)aPoly.GetConstPointAry(), this);
}
if( mpAlphaVDev )
@@ -3042,7 +3117,12 @@ void OutputDevice::DrawPolyLine(
SetFillColor(aOldLineColor);
ImplInitFillColor();
- ImpDrawPolyPolygonWithB2DPolyPolygon(aAreaPolyPolygon);
+ // draw usig a loop; else the topology will paint a PolyPolygon
+ for(sal_uInt32 a(0); a < aAreaPolyPolygon.count(); a++)
+ {
+ ImpDrawPolyPolygonWithB2DPolyPolygon(
+ basegfx::B2DPolyPolygon(aAreaPolyPolygon.getB2DPolygon(a)));
+ }
SetLineColor(aOldLineColor);
ImplInitLineColor();
@@ -3059,14 +3139,15 @@ void OutputDevice::DrawPolyLine(
}
}
}
-
- // fallback to old polygon drawing if needed. This will really
- // use ImplLineConverter, but still try to AA lines
- const Polygon aToolsPolygon( rB2DPolygon );
- LineInfo aLineInfo;
- if( fLineWidth != 0.0 )
- aLineInfo.SetWidth( static_cast<long>(fLineWidth+0.5) );
- ImpDrawPolyLineWithLineInfo( aToolsPolygon, aLineInfo );
+ else
+ {
+ // fallback to old polygon drawing if needed
+ const Polygon aToolsPolygon( rB2DPolygon );
+ LineInfo aLineInfo;
+ if( fLineWidth != 0.0 )
+ aLineInfo.SetWidth( static_cast<long>(fLineWidth+0.5) );
+ ImpDrawPolyLineWithLineInfo( aToolsPolygon, aLineInfo );
+ }
}
// -----------------------------------------------------------------------
diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx
index 0a7a8b765b6b..51aad0790a26 100644
--- a/vcl/source/gdi/outdev3.cxx
+++ b/vcl/source/gdi/outdev3.cxx
@@ -56,11 +56,12 @@
#include <vcl/window.hxx>
#include <vcl/svapp.hxx>
#include <vcl/bmpacc.hxx>
-#include <vcl/fontcvt.hxx>
+#include <unotools/fontcvt.hxx>
#include <vcl/outdev.hxx>
#include <vcl/edit.hxx>
-#include <vcl/fontcfg.hxx>
+#include <unotools/fontcfg.hxx>
#include <vcl/sysdata.hxx>
+#include <vcl/textlayout.hxx>
#ifndef _OSL_FILE_H
#include <osl/file.h>
#endif
@@ -96,6 +97,7 @@
#include <memory>
#include <algorithm>
+
// =======================================================================
DBG_NAMEEX( OutputDevice )
@@ -107,6 +109,7 @@ using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::rtl;
using namespace ::vcl;
+using namespace ::utl;
// =======================================================================
@@ -304,451 +307,6 @@ void OutputDevice::ImplUpdateAllFontData( bool bNewFontLists )
// =======================================================================
-struct ImplLocalizedFontName
-{
- const char* mpEnglishName;
- const sal_Unicode* mpLocalizedNames;
-};
-
-static sal_Unicode const aBatang[] = { 0xBC14, 0xD0D5, 0, 0 };
-static sal_Unicode const aBatangChe[] = { 0xBC14, 0xD0D5, 0xCCB4, 0, 0 };
-static sal_Unicode const aGungsuh[] = { 0xAD81, 0xC11C, 0, 0 };
-static sal_Unicode const aGungsuhChe[] = { 0xAD81, 0xC11C, 0xCCB4, 0, 0 };
-static sal_Unicode const aGulim[] = { 0xAD74, 0xB9BC, 0, 0 };
-static sal_Unicode const aGulimChe[] = { 0xAD74, 0xB9BC, 0xCCB4, 0, 0 };
-static sal_Unicode const aDotum[] = { 0xB3CB, 0xC6C0, 0, 0 };
-static sal_Unicode const aDotumChe[] = { 0xB3CB, 0xC6C0, 0xCCB4, 0, 0 };
-static sal_Unicode const aSimSun[] = { 0x5B8B, 0x4F53, 0, 0 };
-static sal_Unicode const aNSimSun[] = { 0x65B0, 0x5B8B, 0x4F53, 0, 0 };
-static sal_Unicode const aSimHei[] = { 0x9ED1, 0x4F53, 0, 0 };
-static sal_Unicode const aSimKai[] = { 0x6977, 0x4F53, 0, 0 };
-static sal_Unicode const azycjkSun[] = { 0x4E2D, 0x6613, 0x5B8B, 0x4F53, 0, 0 };
-static sal_Unicode const azycjkHei[] = { 0x4E2D, 0x6613, 0x9ED1, 0x4F53, 0, 0 };
-static sal_Unicode const azycjkKai[] = { 0x4E2D, 0x6613, 0x6977, 0x4F53, 0, 0 };
-static sal_Unicode const aFZHei[] = { 0x65B9, 0x6B63, 0x9ED1, 0x4F53, 0, 0 };
-static sal_Unicode const aFZKai[] = { 0x65B9, 0x6B63, 0x6977, 0x4F53, 0, 0 };
-static sal_Unicode const aFZSongYI[] = { 0x65B9, 0x6B63, 0x5B8B, 0x4E00, 0, 0 };
-static sal_Unicode const aFZShuSong[] = { 0x65B9, 0x6B63, 0x4E66, 0x5B8B, 0, 0 };
-static sal_Unicode const aFZFangSong[] = { 0x65B9, 0x6B63, 0x4EFF, 0x5B8B, 0, 0 };
-// Attention: this fonts includes the wrong encoding vector - so we double the names with correct and wrong encoding
-// First one is the GB-Encoding (we think the correct one), second is the big5 encoded name
-static sal_Unicode const aMHei[] = { 'm', 0x7B80, 0x9ED1, 0, 'm', 0x6F60, 0x7AAA, 0, 0 };
-static sal_Unicode const aMKai[] = { 'm', 0x7B80, 0x6977, 0x566C, 0, 'm', 0x6F60, 0x7FF1, 0x628E, 0, 0 };
-static sal_Unicode const aMSong[] = { 'm', 0x7B80, 0x5B8B, 0, 'm', 0x6F60, 0x51BC, 0, 0 };
-static sal_Unicode const aCFangSong[] = { 'm', 0x7B80, 0x592B, 0x5B8B, 0, 'm', 0x6F60, 0x6E98, 0x51BC, 0, 0 };
-static sal_Unicode const aMingLiU[] = { 0x7D30, 0x660E, 0x9AD4, 0, 0 };
-static sal_Unicode const aPMingLiU[] = { 0x65B0, 0x7D30, 0x660E, 0x9AD4, 0, 0 };
-static sal_Unicode const aHei[] = { 0x6865, 0, 0 };
-static sal_Unicode const aKai[] = { 0x6B61, 0, 0 };
-static sal_Unicode const aMing[] = { 0x6D69, 0x6E67, 0, 0 };
-static sal_Unicode const aMSGothic[] = { 'm','s', 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0, 0 };
-static sal_Unicode const aMSPGothic[] = { 'm','s','p', 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0, 0 };
-static sal_Unicode const aMSMincho[] = { 'm', 's', 0x660E, 0x671D, 0 };
-static sal_Unicode const aMSPMincho[] = { 'm','s','p', 0x660E, 0x671D, 0 };
-static sal_Unicode const aMeiryo[] = { 0x30e1, 0x30a4, 0x30ea, 0x30aa, 0 };
-static sal_Unicode const aHGMinchoL[] = { 'h','g', 0x660E, 0x671D, 'l', 0, 0 };
-static sal_Unicode const aHGGothicB[] = { 'h','g', 0x30B4, 0x30B7, 0x30C3, 0x30AF, 'b', 0 };
-static sal_Unicode const aHGPMinchoL[] = { 'h','g','p', 0x660E, 0x671D, 'l', 0 };
-static sal_Unicode const aHGPGothicB[] = { 'h','g','p', 0x30B4, 0x30B7, 0x30C3, 0x30AF, 'b', 0 };
-static sal_Unicode const aHGMinchoLSun[] = { 'h','g', 0x660E, 0x671D, 'l', 's', 'u', 'n', 0 };
-static sal_Unicode const aHGPMinchoLSun[] = { 'h','g','p', 0x660E, 0x671D, 'l', 's', 'u', 'n', 0 };
-static sal_Unicode const aHGGothicBSun[] = { 'h', 'g', 0x30B4, 0x30B7, 0x30C3, 0x30AF, 'b', 's', 'u', 'n', 0 };
-static sal_Unicode const aHGPGothicBSun[] = { 'h', 'g', 'p', 0x30B4, 0x30B7, 0x30C3, 0x30AF, 'b', 's', 'u', 'n', 0 };
-static sal_Unicode const aHGHeiseiMin[] = { 'h', 'g', 0x5E73, 0x6210, 0x660E, 0x671D, 0x4F53, 0, 'h', 'g', 0x5E73, 0x6210, 0x660E, 0x671D, 0x4F53, 'w', '3', 'x', '1', '2', 0, 0 };
-static sal_Unicode const aIPAMincho[] = { 'i', 'p', 'a', 0x660E, 0x671D, 0 };
-static sal_Unicode const aIPAPMincho[] = { 'i', 'p', 'a', 'p', 0x660E, 0x671D, 0 };
-static sal_Unicode const aIPAGothic[] = { 'i', 'p', 'a', 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0 };
-static sal_Unicode const aIPAPGothic[] = { 'i', 'p', 'a', 'p', 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0 };
-static sal_Unicode const aIPAUIGothic[] = { 'i', 'p', 'a', 'u', 'i', 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0 };
-static sal_Unicode const aSazanamiMincho[] = { 0x3055, 0x3056, 0x306A, 0x307F, 0x660E, 0x671D, 0, 0 };
-static sal_Unicode const aSazanamiGothic[] = { 0x3055, 0x3056, 0x306A, 0x307F, 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0, 0 };
-static sal_Unicode const aKochiMincho[] = { 0x6771, 0x98A8, 0x660E, 0x671D, 0, 0 };
-static sal_Unicode const aKochiGothic[] = { 0x6771, 0x98A8, 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0, 0 };
-static sal_Unicode const aSunDotum[] = { 0xC36C, 0xB3CB, 0xC6C0, 0, 0 };
-static sal_Unicode const aSunGulim[] = { 0xC36C, 0xAD74, 0xB9BC, 0, 0 };
-static sal_Unicode const aSunBatang[] = { 0xC36C, 0xBC14, 0xD0D5, 0, 0 };
-static sal_Unicode const aBaekmukDotum[] = { 0xBC31, 0xBB35, 0xB3CB, 0xC6C0, 0, 0 };
-static sal_Unicode const aBaekmukGulim[] = { 0xBC31, 0xBB35, 0xAD74, 0xB9BC, 0, 0 };
-static sal_Unicode const aBaekmukBatang[] = { 0xBC31, 0xBB35, 0xBC14, 0xD0D5, 0, 0 };
-static sal_Unicode const aFzMingTi[] = { 0x65B9, 0x6B63, 0x660E, 0x9AD4, 0, 0 };
-static sal_Unicode const aFzHeiTiTW[]= { 0x65B9, 0x6B63, 0x9ED1, 0x9AD4, 0, 0 };
-static sal_Unicode const aFzKaiTiTW[]= { 0x65B9, 0x6B63, 0x6977, 0x9AD4, 0, 0 };
-static sal_Unicode const aFzHeiTiCN[]= { 0x65B9, 0x6B63, 0x9ED1, 0x4F53, 0, 0 };
-static sal_Unicode const aFzKaiTiCN[]= { 0x65B9, 0x6B63, 0x6977, 0x4F53, 0, 0 };
-static sal_Unicode const aFzSongTi[] = { 0x65B9, 0x6B63, 0x5B8B, 0x4F53, 0, 0 };
-static sal_Unicode const aHYMyeongJoExtra[] = { 'h', 'y', 0xACAC, 0xBA85, 0xC870, 0, 0 };
-static sal_Unicode const aHYSinMyeongJoMedium[] = { 'h', 'y', 0xC2E0, 0xBA85, 0xC870, 0, 0 };
-static sal_Unicode const aHYGothicMedium[] = { 'h', 'y', 0xC911, 0xACE0, 0xB515, 0, 0 };
-static sal_Unicode const aHYGraphicMedium[] = { 'h', 'y', 0xADF8, 0xB798, 0xD53D, 'm', 0, 0 };
-static sal_Unicode const aHYGraphic[] = { 'h', 'y', 0xADF8, 0xB798, 0xD53D, 0, 0 };
-static sal_Unicode const aNewGulim[] = { 0xC0C8, 0xAD74, 0xB9BC, 0, 0 };
-static sal_Unicode const aSunGungseo[] = { 0xC36C, 0xAD81, 0xC11C, 0, 0 };
-static sal_Unicode const aHYGungSoBold[] = { 'h','y', 0xAD81, 0xC11C, 'b', 0, 0 };
-static sal_Unicode const aHYGungSo[] = { 'h','y', 0xAD81, 0xC11C, 0, 0 };
-static sal_Unicode const aSunHeadLine[] = { 0xC36C, 0xD5E4, 0xB4DC, 0xB77C, 0xC778, 0, 0 };
-static sal_Unicode const aHYHeadLineMedium[] = { 'h', 'y', 0xD5E4, 0xB4DC, 0xB77C, 0xC778, 'm', 0, 0 };
-static sal_Unicode const aHYHeadLine[] = { 'h', 'y', 0xD5E4, 0xB4DC, 0xB77C, 0xC778, 0, 0 };
-static sal_Unicode const aYetR[] = { 0xD734, 0xBA3C, 0xC61B, 0xCCB4, 0, 0 };
-static sal_Unicode const aHYGothicExtra[] = { 'h', 'y', 0xACAC, 0xACE0, 0xB515, 0, 0 };
-static sal_Unicode const aSunMokPan[] = { 0xC36C, 0xBAA9, 0xD310, 0, 0 };
-static sal_Unicode const aSunYeopseo[] = { 0xC36C, 0xC5FD, 0xC11C, 0, 0 };
-static sal_Unicode const aSunBaekSong[] = { 0xC36C, 0xBC31, 0xC1A1, 0, 0 };
-static sal_Unicode const aHYPostLight[] = { 'h', 'y', 0xC5FD, 0xC11C, 'l', 0, 0 };
-static sal_Unicode const aHYPost[] = { 'h', 'y', 0xC5FD, 0xC11C, 0, 0 };
-static sal_Unicode const aMagicR[] = { 0xD734, 0xBA3C, 0xB9E4, 0xC9C1, 0xCCB4, 0, 0 };
-static sal_Unicode const aSunCrystal[] = { 0xC36C, 0xD06C, 0xB9AC, 0xC2A4, 0xD0C8, 0, 0 };
-static sal_Unicode const aSunSaemmul[] = { 0xC36C, 0xC0D8, 0xBB3C, 0, 0 };
-static sal_Unicode const aHaansoftBatang[] = { 0xD55C, 0xCEF4, 0xBC14, 0xD0D5, 0, 0 };
-static sal_Unicode const aHaansoftDotum[] = { 0xD55C, 0xCEF4, 0xB3CB, 0xC6C0, 0, 0 };
-static sal_Unicode const aHyhaeseo[] = { 0xD55C, 0xC591, 0xD574, 0xC11C, 0, 0 };
-static sal_Unicode const aMDSol[] = { 'm', 'd', 0xC194, 0xCCB4, 0, 0 };
-static sal_Unicode const aMDGaesung[] = { 'm', 'd', 0xAC1C, 0xC131, 0xCCB4, 0, 0 };
-static sal_Unicode const aMDArt[] = { 'm', 'd', 0xC544, 0xD2B8, 0xCCB4, 0, 0 };
-static sal_Unicode const aMDAlong[] = { 'm', 'd', 0xC544, 0xB871, 0xCCB4, 0, 0 };
-static sal_Unicode const aMDEasop[] = { 'm', 'd', 0xC774, 0xC19D, 0xCCB4, 0, 0 };
-static sal_Unicode const aHYShortSamulMedium[] = { 'h', 'y', 0xC595, 0xC740, 0xC0D8, 0xBB3C, 'm', 0 };
-static sal_Unicode const aHYShortSamul[] = { 'h', 'y', 0xC595, 0xC740, 0xC0D8, 0xBB3C, 0 };
-static sal_Unicode const aHGGothicE[] = { 'h','g', 0xFF7A, 0xFF9E, 0xFF7C, 0xFF6F, 0xFF78, 'e', 0 };
-static sal_Unicode const aHGPGothicE[] = { 'h','g','p', 0xFF7A, 0xFF9E, 0xFF7C, 0xFF6F, 0xFF78, 'e', 0 };
-static sal_Unicode const aHGSGothicE[] = { 'h','g','s', 0xFF7A, 0xFF9E, 0xFF7C, 0xFF6F, 0xFF78, 'e', 0 };
-static sal_Unicode const aHGGothicM[] = { 'h','g', 0xFF7A, 0xFF9E, 0xFF7C, 0xFF6F, 0xFF78, 'm', 0 };
-static sal_Unicode const aHGPGothicM[] = { 'h','g','p', 0xFF7A, 0xFF9E, 0xFF7C, 0xFF6F, 0xFF78, 'm', 0 };
-static sal_Unicode const aHGSGothicM[] = { 'h','g','s', 0xFF7A, 0xFF9E, 0xFF7C, 0xFF6F, 0xFF78, 'm', 0 };
-static sal_Unicode const aHGGyoshotai[] = { 'h','g', 0x884C, 0x66F8, 0x4F53, 0 };
-static sal_Unicode const aHGPGyoshotai[] = { 'h','g','p', 0x884C, 0x66F8, 0x4F53, 0 };
-static sal_Unicode const aHGSGyoshotai[] = { 'h','g','s', 0x884C, 0x66F8, 0x4F53, 0 };
-static sal_Unicode const aHGKyokashotai[] = { 'h','g', 0x6559, 0x79D1, 0x66F8, 0x4F53, 0 };
-static sal_Unicode const aHGPKyokashotai[] = { 'h','g','p', 0x6559, 0x79D1, 0x66F8, 0x4F53, 0 };
-static sal_Unicode const aHGSKyokashotai[] = { 'h','g','s', 0x6559, 0x79D1, 0x66F8, 0x4F53, 0 };
-static sal_Unicode const aHGMinchoB[] = { 'h','g', 0x660E, 0x671D, 'b', 0 };
-static sal_Unicode const aHGPMinchoB[] = { 'h','g','p', 0x660E, 0x671D, 'b', 0 };
-static sal_Unicode const aHGSMinchoB[] = { 'h','g','s', 0x660E, 0x671D, 'b', 0 };
-static sal_Unicode const aHGMinchoE[] = { 'h','g', 0x660E, 0x671D, 'e', 0 };
-static sal_Unicode const aHGPMinchoE[] = { 'h','g','p', 0x660E, 0x671D, 'e', 0 };
-static sal_Unicode const aHGSMinchoE[] = { 'h','g','s', 0x660E, 0x671D, 'e', 0 };
-static sal_Unicode const aHGSoeiKakupoptai[] = { 'h','g', 0x5275,0x82F1,0x89D2,0xFF8E,
- 0xFF9F,0xFF6F,0xFF8C,0xFF9F,0x4F53,0};
-static sal_Unicode const aHGPSoeiKakupoptai[] = { 'h','g', 'p', 0x5275,0x82F1,0x89D2,0xFF8E,
- 0xFF9F,0xFF6F,0xFF8C,0xFF9F,0x4F53,0};
-static sal_Unicode const aHGSSoeiKakupoptai[] = { 'h','g', 's', 0x5275,0x82F1,0x89D2,0xFF8E,
- 0xFF9F,0xFF6F,0xFF8C,0xFF9F,0x4F53,0};
-static sal_Unicode const aHGSoeiPresenceEB[] = { 'h','g', 0x5275,0x82F1,0xFF8C,0xFF9F,
- 0xFF9A,0xFF7E,0xFF9E,0xFF9D,0xFF7D, 'e','b',0};
-static sal_Unicode const aHGPSoeiPresenceEB[] = { 'h','g','p', 0x5275,0x82F1,0xFF8C,0xFF9F,
- 0xFF9A,0xFF7E,0xFF9E,0xFF9D,0xFF7D, 'e','b',0};
-static sal_Unicode const aHGSSoeiPresenceEB[] = { 'h','g','s', 0x5275,0x82F1,0xFF8C,0xFF9F,
- 0xFF9A,0xFF7E,0xFF9E,0xFF9D,0xFF7D, 'e','b',0};
-static sal_Unicode const aHGSoeiKakugothicUB[] = { 'h','g', 0x5275,0x82F1,0x89D2,0xFF7A,
- 0xFF9E,0xFF7C,0xFF6F,0xFF78,'u','b',0};
-static sal_Unicode const aHGPSoeiKakugothicUB[] = { 'h','g','p', 0x5275,0x82F1,0x89D2,0xFF7A,
- 0xFF9E,0xFF7C,0xFF6F,0xFF78,'u','b',0};
-static sal_Unicode const aHGSSoeiKakugothicUB[] = { 'h','g','s', 0x5275,0x82F1,0x89D2,0xFF7A,
- 0xFF9E,0xFF7C,0xFF6F,0xFF78,'u','b',0};
-static sal_Unicode const aHGSeikaishotaiPRO[] = { 'h','g', 0x6B63,0x6977,0x66F8,0x4F53, '-','p','r','o',0};
-static sal_Unicode const aHGMaruGothicMPRO[] = { 'h','g', 0x4E38,0xFF7A,0xFF9E,0xFF7C,0xFF6F,0xFF78, '-','p','r','o',0};
-static sal_Unicode const aHiraginoMinchoPro[] = { 0x30D2, 0x30E9, 0x30AE, 0x30CE, 0x660E, 0x671D, 'p','r','o',0};
-static sal_Unicode const aHiraginoMinchoProN[] = { 0x30D2, 0x30E9, 0x30AE, 0x30CE, 0x660E, 0x671D, 'p','r','o','n',0};
-static sal_Unicode const aHiraginoKakuGothicPro[] = { 0x30D2, 0x30E9, 0x30AE, 0x30CE, 0x89D2, 0x30B4, 'p','r','o',0};
-static sal_Unicode const aHiraginoKakuGothicProN[] = { 0x30D2, 0x30E9, 0x30AE, 0x30CE, 0x89D2, 0x30B4, 'p','r','o','n',0};
-static sal_Unicode const aHiraginoMaruGothicPro[] = { 0x30D2, 0x30E9, 0x30AE, 0x30CE, 0x4E38, 0x30B4, 'p','r','o',0};
-static sal_Unicode const aHiraginoMaruGothicProN[] = { 0x30D2, 0x30E9, 0x30AE, 0x30CE, 0x4E38, 0x30B4, 'p','r','o','n',0};
-
-
-static ImplLocalizedFontName aImplLocalizedNamesList[] =
-{
-{ "batang", aBatang },
-{ "batangche", aBatangChe },
-{ "gungshu", aGungsuh },
-{ "gungshuche", aGungsuhChe },
-{ "gulim", aGulim },
-{ "gulimche", aGulimChe },
-{ "dotum", aDotum },
-{ "dotumche", aDotumChe },
-{ "simsun", aSimSun },
-{ "nsimsun", aNSimSun },
-{ "simhei", aSimHei },
-{ "simkai", aSimKai },
-{ "zycjksun", azycjkSun },
-{ "zycjkhei", azycjkHei },
-{ "zycjkkai", azycjkKai },
-{ "fzhei", aFZHei },
-{ "fzkai", aFZKai },
-{ "fzsong", aFZSongYI },
-{ "fzshusong", aFZShuSong },
-{ "fzfangsong", aFZFangSong },
-{ "mhei", aMHei },
-{ "mkai", aMKai },
-{ "msong", aMSong },
-{ "cfangsong", aCFangSong },
-{ "mingliu", aMingLiU },
-{ "pmingliu", aPMingLiU },
-{ "hei", aHei },
-{ "kai", aKai },
-{ "ming", aMing },
-{ "msgothic", aMSGothic },
-{ "mspgothic", aMSPGothic },
-{ "msmincho", aMSMincho },
-{ "mspmincho", aMSPMincho },
-{ "meiryo", aMeiryo },
-{ "hgminchol", aHGMinchoL },
-{ "hggothicb", aHGGothicB },
-{ "hgpminchol", aHGPMinchoL },
-{ "hgpgothicb", aHGPGothicB },
-{ "hgmincholsun", aHGMinchoLSun },
-{ "hggothicbsun", aHGGothicBSun },
-{ "hgpmincholsun", aHGPMinchoLSun },
-{ "hgpgothicbsun", aHGPGothicBSun },
-{ "hgheiseimin", aHGHeiseiMin },
-{ "ipamincho", aIPAMincho },
-{ "ipapmincho", aIPAPMincho },
-{ "ipagothic", aIPAGothic },
-{ "ipapgothic", aIPAPGothic },
-{ "ipauigothic", aIPAUIGothic },
-{ "sazanamimincho", aSazanamiMincho },
-{ "sazanamigothic", aSazanamiGothic },
-{ "kochimincho", aKochiMincho },
-{ "kochigothic", aKochiGothic },
-{ "sundotum", aSunDotum },
-{ "sungulim", aSunGulim },
-{ "sunbatang", aSunBatang },
-{ "baekmukdotum", aBaekmukDotum },
-{ "baekmukgulim", aBaekmukGulim },
-{ "baekmukbatang", aBaekmukBatang },
-{ "fzheiti", aFzHeiTiCN },
-{ "fzheiti", aFzHeiTiTW },
-{ "fzkaiti", aFzKaiTiCN },
-{ "fzkaitib", aFzKaiTiTW },
-{ "fzmingtib", aFzMingTi },
-{ "fzsongti", aFzSongTi },
-{ "hymyeongjoextra", aHYMyeongJoExtra },
-{ "hysinmyeongjomedium", aHYSinMyeongJoMedium },
-{ "hygothicmedium", aHYGothicMedium },
-{ "hygraphicmedium", aHYGraphicMedium },
-{ "hygraphic", aHYGraphic },
-{ "newgulim", aNewGulim },
-{ "sungungseo", aSunGungseo },
-{ "hygungsobold", aHYGungSoBold },
-{ "hygungso", aHYGungSo },
-{ "sunheadline", aSunHeadLine },
-{ "hyheadlinemedium", aHYHeadLineMedium },
-{ "hyheadline", aHYHeadLine },
-{ "yetr", aYetR },
-{ "hygothicextra", aHYGothicExtra },
-{ "sunmokpan", aSunMokPan },
-{ "sunyeopseo", aSunYeopseo },
-{ "sunbaeksong", aSunBaekSong },
-{ "hypostlight", aHYPostLight },
-{ "hypost", aHYPost },
-{ "magicr", aMagicR },
-{ "suncrystal", aSunCrystal },
-{ "sunsaemmul", aSunSaemmul },
-{ "hyshortsamulmedium", aHYShortSamulMedium },
-{ "hyshortsamul", aHYShortSamul },
-{ "haansoftbatang", aHaansoftBatang },
-{ "haansoftdotum", aHaansoftDotum },
-{ "hyhaeseo", aHyhaeseo },
-{ "mdsol", aMDSol },
-{ "mdgaesung", aMDGaesung },
-{ "mdart", aMDArt },
-{ "mdalong", aMDAlong },
-{ "mdeasop", aMDEasop },
-{ "hggothice", aHGGothicE },
-{ "hgpgothice", aHGPGothicE },
-{ "hgpothice", aHGSGothicE },
-{ "hggothicm", aHGGothicM },
-{ "hgpgothicm", aHGPGothicM },
-{ "hgpgothicm", aHGSGothicM },
-{ "hggyoshotai", aHGGyoshotai },
-{ "hgpgyoshotai", aHGPGyoshotai },
-{ "hgsgyoshotai", aHGSGyoshotai },
-{ "hgkyokashotai", aHGKyokashotai },
-{ "hgpkyokashotai", aHGPKyokashotai },
-{ "hgskyokashotai", aHGSKyokashotai },
-{ "hgminchob", aHGMinchoB },
-{ "hgpminchob", aHGPMinchoB },
-{ "hgsminchob", aHGSMinchoB },
-{ "hgminchoe", aHGMinchoE },
-{ "hgpminchoe", aHGPMinchoE },
-{ "hgsminchoe", aHGSMinchoE },
-{ "hgsoeikakupoptai", aHGSoeiKakupoptai },
-{ "hgpsoeikakupopta", aHGPSoeiKakupoptai },
-{ "hgssoeikakupopta", aHGSSoeiKakupoptai },
-{ "hgsoeipresenceeb", aHGSoeiPresenceEB },
-{ "hgpsoeipresenceeb", aHGPSoeiPresenceEB },
-{ "hgssoeipresenceeb", aHGSSoeiPresenceEB },
-{ "hgsoeikakugothicub", aHGSoeiKakugothicUB },
-{ "hgpsoeikakugothicub", aHGPSoeiKakugothicUB },
-{ "hgssoeikakugothicub", aHGSSoeiKakugothicUB },
-{ "hgseikaishotaipro", aHGSeikaishotaiPRO },
-{ "hgmarugothicmpro", aHGMaruGothicMPRO },
-{ "hiraginominchopro", aHiraginoMinchoPro },
-{ "hiraginominchopron", aHiraginoMinchoProN },
-{ "hiraginokakugothicpro", aHiraginoKakuGothicPro },
-{ "hiraginokakugothicpron", aHiraginoKakuGothicProN },
-{ "hiraginomarugothicpro", aHiraginoMaruGothicPro },
-{ "hiraginomarugothicpron", aHiraginoMaruGothicProN },
-{ NULL, NULL },
-};
-
-// -----------------------------------------------------------------------
-
-void ImplGetEnglishSearchFontName( String& rName )
-{
- bool bNeedTranslation = false;
- xub_StrLen nLen = rName.Len();
-
- // Remove trailing whitespaces
- xub_StrLen i = nLen;
- while ( i && (rName.GetChar( i-1 ) < 32) )
- i--;
- if ( i != nLen )
- rName.Erase( i );
-
- // Remove Script at the end
- // Scriptname must be the last part of the fontname and
- // looks like "fontname (scriptname)". So there can only be a
- // script name at the and of the fontname, when the last char is ')'
- if ( (nLen >= 3) && rName.GetChar( nLen-1 ) == ')' )
- {
- int nOpen = 1;
- xub_StrLen nTempLen = nLen-2;
- while ( nTempLen )
- {
- if ( rName.GetChar( nTempLen ) == '(' )
- {
- nOpen--;
- if ( !nOpen )
- {
- // Remove Space at the end
- if ( nTempLen && (rName.GetChar( nTempLen-1 ) == ' ') )
- nTempLen--;
- rName.Erase( nTempLen );
- nLen = nTempLen;
- break;
- }
- }
- if ( rName.GetChar( nTempLen ) == ')' )
- nOpen++;
- nTempLen--;
- }
- }
-
- // remove all whitespaces and converts to lower case ASCII
- // TODO: better transliteration to ASCII e.g. all digits
- i = 0;
- while ( i < nLen )
- {
- sal_Unicode c = rName.GetChar( i );
- if ( c > 127 )
- {
- // Translate to Lowercase-ASCII
- // FullWidth-ASCII to half ASCII
- if ( (c >= 0xFF00) && (c <= 0xFF5E) )
- {
- c -= 0xFF00-0x0020;
- // Upper to Lower
- if ( (c >= 'A') && (c <= 'Z') )
- c += 'a' - 'A';
- rName.SetChar( i, c );
- }
- else
- {
- // Only Fontnames with None-Ascii-Characters must be translated
- bNeedTranslation = true;
- }
- }
- // not lowercase Ascii
- else if ( !((c >= 'a') && (c <= 'z')) )
- {
- // To Lowercase-Ascii
- if ( (c >= 'A') && (c <= 'Z') )
- {
- c += 'a' - 'A';
- rName.SetChar( i, c );
- }
- else if( ((c < '0') || (c > '9')) && (c != ';') ) // not 0-9 or semicolon
- {
- // Remove white spaces and special characters
- rName.Erase( i, 1 );
- nLen--;
- continue;
- }
- }
-
- i++;
- }
-
- // translate normalized localized name to its normalized English ASCII name
- if( bNeedTranslation )
- {
- typedef std::hash_map<const String, const char*,FontNameHash> FontNameDictionary;
- static FontNameDictionary aDictionary( sizeof(aImplLocalizedNamesList) / sizeof(*aImplLocalizedNamesList) );
- // the font name dictionary needs to be intialized once
- if( aDictionary.empty() )
- {
- // TODO: check if all dictionary entries are already normalized?
- const ImplLocalizedFontName* pList = aImplLocalizedNamesList;
- for(; pList->mpEnglishName; ++pList )
- aDictionary[ pList->mpLocalizedNames ] = pList->mpEnglishName;
- }
-
- FontNameDictionary::const_iterator it = aDictionary.find( rName );
- if( it != aDictionary.end() )
- rName.AssignAscii( it->second );
- }
-}
-
-// -----------------------------------------------------------------------
-
-static String GetNextFontToken( const String& rTokenStr, xub_StrLen& rIndex )
-{
- // check for valid start index
- int nStringLen = rTokenStr.Len();
- if( rIndex >= nStringLen )
- {
- rIndex = STRING_NOTFOUND;
- return String();
- }
-
- // find the next token delimiter and return the token substring
- const sal_Unicode* pStr = rTokenStr.GetBuffer() + rIndex;
- const sal_Unicode* pEnd = rTokenStr.GetBuffer() + nStringLen;
- for(; pStr < pEnd; ++pStr )
- if( (*pStr == ';') || (*pStr == ',') )
- break;
-
- xub_StrLen nTokenStart = rIndex;
- xub_StrLen nTokenLen;
- if( pStr < pEnd )
- {
- rIndex = sal::static_int_cast<xub_StrLen>(pStr - rTokenStr.GetBuffer());
- nTokenLen = rIndex - nTokenStart;
- ++rIndex; // skip over token separator
- }
- else
- {
- // no token delimiter found => handle last token
- rIndex = STRING_NOTFOUND;
- nTokenLen = STRING_LEN;
-
- // optimize if the token string consists of just one token
- if( !nTokenStart )
- return rTokenStr;
- }
-
- return String( rTokenStr, nTokenStart, nTokenLen );
-}
-
-// TODO: get rid of this in another incompatible build with SW project.
-// SW's WW8 and RTF filters still use this (from fontcvt.hxx)
-String GetFontToken( const String& rTokenStr, xub_StrLen nToken, xub_StrLen& rIndex )
-{
- // skip nToken Tokens
- for( xub_StrLen i = 0; (i < nToken) && (rIndex != STRING_NOTFOUND); ++i )
- GetNextFontToken( rTokenStr, rIndex );
-
- return GetNextFontToken( rTokenStr, rIndex );
-}
// =======================================================================
@@ -812,8 +370,8 @@ ImplFontSubstEntry::ImplFontSubstEntry( const String& rFontName,
{
maSearchName = rFontName;
maSearchReplaceName = rSubstFontName;
- ImplGetEnglishSearchFontName( maSearchName );
- ImplGetEnglishSearchFontName( maSearchReplaceName );
+ GetEnglishSearchFontName( maSearchName );
+ GetEnglishSearchFontName( maSearchReplaceName );
}
// -----------------------------------------------------------------------
@@ -913,7 +471,7 @@ static void ImplFontSubstitute( String& rFontName,
{
#ifdef DBG_UTIL
String aTempName = rFontName;
- ImplGetEnglishSearchFontName( aTempName );
+ GetEnglishSearchFontName( aTempName );
DBG_ASSERT( aTempName == rFontName, "ImplFontSubstitute() called without a searchname" );
#endif
@@ -938,44 +496,6 @@ static void ImplFontSubstitute( String& rFontName,
}
}
-// =======================================================================
-
-static bool ImplIsFontToken( const String& rName, const String& rToken )
-{
- String aTempName;
- xub_StrLen nIndex = 0;
- do
- {
- aTempName = GetNextFontToken( rName, nIndex );
- if ( rToken == aTempName )
- return true;
- }
- while ( nIndex != STRING_NOTFOUND );
-
- return false;
-}
-
-// -----------------------------------------------------------------------
-
-static void ImplAppendFontToken( String& rName, const String& rNewToken )
-{
- if ( rName.Len() )
- {
- rName.Append( ';' );
- rName.Append( rNewToken );
- }
- else
- rName = rNewToken;
-}
-
-// -----------------------------------------------------------------------
-
-static void ImplAddTokenFontName( String& rName, const String& rNewToken )
-{
- if ( !ImplIsFontToken( rName, rNewToken ) )
- ImplAppendFontToken( rName, rNewToken );
-}
-
// -----------------------------------------------------------------------
Font OutputDevice::GetDefaultFont( USHORT nType, LanguageType eLang,
@@ -993,7 +513,7 @@ Font OutputDevice::GetDefaultFont( USHORT nType, LanguageType eLang,
MsLangId::convertLanguageToLocale( eLang, aLocale );
}
- DefaultFontConfiguration& rDefaults = *DefaultFontConfiguration::get();
+ utl::DefaultFontConfiguration& rDefaults = *utl::DefaultFontConfiguration::get();
String aSearch = rDefaults.getUserInterfaceFont( aLocale ); // ensure a fallback
String aDefault = rDefaults.getDefaultFont( aLocale, nType );
if( aDefault.Len() )
@@ -1072,11 +592,11 @@ Font OutputDevice::GetDefaultFont( USHORT nType, LanguageType eLang,
do
{
aSearchName = GetNextFontToken( aSearch, nIndex );
- ImplGetEnglishSearchFontName( aSearchName );
+ GetEnglishSearchFontName( aSearchName );
ImplDevFontListData* pFontFamily = pOutDev->mpFontList->ImplFindBySearchName( aSearchName );
if( pFontFamily )
{
- ImplAddTokenFontName( aName, pFontFamily->GetFamilyName() );
+ AddTokenFontName( aName, pFontFamily->GetFamilyName() );
if( nFlags & DEFAULTFONT_FLAGS_ONLYONE )
break;
}
@@ -1176,61 +696,6 @@ Font OutputDevice::GetDefaultFont( USHORT nType, LanguageType eLang,
// =======================================================================
-String GetSubsFontName( const String& rName, ULONG nFlags )
-{
- String aName;
-
- xub_StrLen nIndex = 0;
- String aOrgName = GetNextFontToken( rName, nIndex );
- ImplGetEnglishSearchFontName( aOrgName );
-
- // #93662# do not try to replace StarSymbol with MS only font
- if( nFlags == (SUBSFONT_MS|SUBSFONT_ONLYONE)
- && ( aOrgName.EqualsAscii( "starsymbol" )
- || aOrgName.EqualsAscii( "opensymbol" ) ) )
- return aName;
-
- const FontNameAttr* pAttr = FontSubstConfiguration::get()->getSubstInfo( aOrgName );
- if ( pAttr )
- {
- for( int i = 0; i < 3; i++ )
- {
- const ::std::vector< String >* pVector = NULL;
- switch( i )
- {
- case 0:
- if( nFlags & SUBSFONT_MS && pAttr->MSSubstitutions.size() )
- pVector = &pAttr->MSSubstitutions;
- break;
- case 1:
- if( nFlags & SUBSFONT_PS && pAttr->PSSubstitutions.size() )
- pVector = &pAttr->PSSubstitutions;
- break;
- case 2:
- if( nFlags & SUBSFONT_HTML && pAttr->HTMLSubstitutions.size() )
- pVector = &pAttr->HTMLSubstitutions;
- break;
- }
- if( ! pVector )
- continue;
- for( ::std::vector< String >::const_iterator it = pVector->begin(); it != pVector->end(); ++it )
- if( ! ImplIsFontToken( rName, *it ) )
- {
- ImplAppendFontToken( aName, *it );
- if( nFlags & SUBSFONT_ONLYONE )
- {
- i = 4;
- break;
- }
- }
- }
- }
-
- return aName;
-}
-
-// =======================================================================
-
static unsigned ImplIsCJKFont( const String& rFontName )
{
// Test, if Fontname includes CJK characters --> In this case we
@@ -1695,7 +1160,7 @@ bool ImplDevFontListData::AddFontFace( ImplFontData* pNewData )
// -----------------------------------------------------------------------
// get font attributes using the normalized font family name
-void ImplDevFontListData::InitMatchData( const vcl::FontSubstConfiguration& rFontSubst,
+void ImplDevFontListData::InitMatchData( const utl::FontSubstConfiguration& rFontSubst,
const String& rSearchName )
{
String aShortName;
@@ -1834,29 +1299,6 @@ void ImplDevFontList::Clear()
mbMatchData = false;
}
-// -----------------------------------------------------------------------
-
-// TODO: use a more generic String hash
-int FontNameHash::operator()( const String& rStr ) const
-{
- // this simple hash just has to be good enough for font names
- int nHash = 0;
- const int nLen = rStr.Len();
- const sal_Unicode* p = rStr.GetBuffer();
- switch( nLen )
- {
- default: nHash = (p[0]<<16) - (p[1]<<8) + p[2];
- nHash += nLen;
- p += nLen - 3;
- // fall through
- case 3: nHash += (p[2]<<16); // fall through
- case 2: nHash += (p[1]<<8); // fall through
- case 1: nHash += p[0]; // fall through
- case 0: break;
- };
-
- return nHash;
-}
// -----------------------------------------------------------------------
@@ -2003,7 +1445,7 @@ ImplDevFontListData* ImplDevFontList::GetGlyphFallbackFont( ImplFontSelectData&
// call the hook to query the best matching glyph fallback font
if( mpFallbackHook->FindFontSubstitute( rFontSelData, rMissingCodes ) )
// apply outdev3.cxx specific fontname normalization
- ImplGetEnglishSearchFontName( rFontSelData.maSearchName );
+ GetEnglishSearchFontName( rFontSelData.maSearchName );
else
rFontSelData.maSearchName = String();
@@ -2058,7 +1500,7 @@ void ImplDevFontList::Add( ImplFontData* pNewData )
for( xub_StrLen nMapNameIndex = 0; nMapNameIndex != STRING_NOTFOUND; )
{
String aSearchName = pNewData->maName;
- ImplGetEnglishSearchFontName( aSearchName );
+ GetEnglishSearchFontName( aSearchName );
DevFontList::const_iterator it = maDevFontList.find( aSearchName );
ImplDevFontListData* pFoundData = NULL;
@@ -2095,7 +1537,7 @@ ImplDevFontListData* ImplDevFontList::ImplFindBySearchName( const String& rSearc
{
#ifdef DEBUG
String aTempName = rSearchName;
- ImplGetEnglishSearchFontName( aTempName );
+ GetEnglishSearchFontName( aTempName );
DBG_ASSERT( aTempName == rSearchName, "ImplDevFontList::ImplFindBySearchName() called with non-normalized name" );
#endif
@@ -2150,7 +1592,7 @@ ImplDevFontListData* ImplDevFontList::FindFontFamily( const String& rFontName )
{
// normalize the font fomily name and
String aName = rFontName;
- ImplGetEnglishSearchFontName( aName );
+ GetEnglishSearchFontName( aName );
ImplDevFontListData* pFound = ImplFindBySearchName( aName );
return pFound;
}
@@ -2167,7 +1609,7 @@ ImplDevFontListData* ImplDevFontList::ImplFindByTokenNames( const String& rToken
String aSearchName = GetNextFontToken( rTokenStr, nTokenPos );
if( !aSearchName.Len() )
continue;
- ImplGetEnglishSearchFontName( aSearchName );
+ GetEnglishSearchFontName( aSearchName );
pFoundData = ImplFindBySearchName( aSearchName );
if( pFoundData )
break;
@@ -2178,7 +1620,7 @@ ImplDevFontListData* ImplDevFontList::ImplFindByTokenNames( const String& rToken
// -----------------------------------------------------------------------
-ImplDevFontListData* ImplDevFontList::ImplFindBySubstFontAttr( const vcl::FontNameAttr& rFontAttr ) const
+ImplDevFontListData* ImplDevFontList::ImplFindBySubstFontAttr( const utl::FontNameAttr& rFontAttr ) const
{
ImplDevFontListData* pFoundData = NULL;
@@ -2187,7 +1629,7 @@ ImplDevFontListData* ImplDevFontList::ImplFindBySubstFontAttr( const vcl::FontNa
for(; it != rFontAttr.Substitutions.end(); ++it )
{
String aSearchName( *it );
- ImplGetEnglishSearchFontName( aSearchName );
+ GetEnglishSearchFontName( aSearchName );
pFoundData = ImplFindBySearchName( aSearchName );
if( pFoundData )
@@ -2933,7 +2375,7 @@ ImplFontEntry* ImplFontCache::GetFontEntry( ImplDevFontList* pFontList,
// if we found a different symbol font we need a symbol conversion table
if( pFontData->IsSymbolFont() )
if( aFontSelData.maTargetName != aFontSelData.maSearchName )
- pEntry->mpConversion = ImplGetRecodeData( aFontSelData.maTargetName, aFontSelData.maSearchName );
+ pEntry->mpConversion = ConvertChar::GetRecodeData( aFontSelData.maTargetName, aFontSelData.maSearchName );
// add the new entry to the cache
maFontInstanceList[ aFontSelData ] = pEntry;
@@ -2981,7 +2423,7 @@ ImplDevFontListData* ImplDevFontList::ImplFindByFont( ImplFontSelectData& rFSD,
#endif
- ImplGetEnglishSearchFontName( aSearchName );
+ GetEnglishSearchFontName( aSearchName );
ImplFontSubstitute( aSearchName, nSubstFlags, pDevSpecific );
// #114999# special emboldening for Ricoh fonts
// TODO: smarter check for special cases by using PreMatch infrastructure?
@@ -3029,7 +2471,7 @@ ImplDevFontListData* ImplDevFontList::ImplFindByFont( ImplFontSelectData& rFSD,
#endif
if( mpPreMatchHook )
if( mpPreMatchHook->FindFontSubstitute( rFSD ) )
- ImplGetEnglishSearchFontName( aSearchName );
+ GetEnglishSearchFontName( aSearchName );
#ifdef ENABLE_GRAPHITE
// the prematch hook uses the target name to search, but we now need
// to restore the features to make the font selection data unique
@@ -3056,13 +2498,13 @@ ImplDevFontListData* ImplDevFontList::ImplFindByFont( ImplFontSelectData& rFSD,
{
rFSD.maTargetName = GetNextFontToken( rFSD.maName, nTokenPos );
aSearchName = rFSD.maTargetName;
- ImplGetEnglishSearchFontName( aSearchName );
+ GetEnglishSearchFontName( aSearchName );
}
else
nTokenPos = STRING_NOTFOUND;
if( mpPreMatchHook )
if( mpPreMatchHook->FindFontSubstitute( rFSD ) )
- ImplGetEnglishSearchFontName( aSearchName );
+ GetEnglishSearchFontName( aSearchName );
ImplFontSubstitute( aSearchName, nSubstFlags, pDevSpecific );
ImplDevFontListData* pFoundData = ImplFindBySearchName( aSearchName );
if( pFoundData )
@@ -3076,7 +2518,7 @@ ImplDevFontListData* ImplDevFontList::ImplFindByFont( ImplFontSelectData& rFSD,
nTokenPos = 0;
rFSD.maTargetName = GetNextFontToken( rFSD.maName, nTokenPos );
aSearchName = rFSD.maTargetName;
- ImplGetEnglishSearchFontName( aSearchName );
+ GetEnglishSearchFontName( aSearchName );
}
String aSearchShortName;
@@ -3151,7 +2593,7 @@ ImplDevFontListData* ImplDevFontList::ImplFindByFont( ImplFontSelectData& rFSD,
continue;
aSearchName = rFSD.maTargetName;
- ImplGetEnglishSearchFontName( aSearchName );
+ GetEnglishSearchFontName( aSearchName );
String aTempShortName;
String aTempFamilyName;
@@ -4835,7 +4277,7 @@ void OutputDevice::ImplGetEmphasisMark( PolyPolygon& rPolyPoly, BOOL& rPolyLine,
double dScale = ((double)nDotSize)/1000.0;
aPoly.Scale( dScale, dScale );
Polygon aTemp;
- aPoly.GetSimple( aTemp );
+ aPoly.AdaptiveSubdivide( aTemp );
Rectangle aBoundRect = aTemp.GetBoundRect();
rWidth = aBoundRect.GetWidth();
nDotSize = aBoundRect.GetHeight();
@@ -5257,7 +4699,7 @@ void OutputDevice::ImplDrawText( SalLayout& rSalLayout )
long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo,
long nWidth, const XubString& rStr,
- USHORT nStyle ) const
+ USHORT nStyle, const ::vcl::ITextLayout& _rLayout )
{
DBG_ASSERTWARNING( nWidth >= 0, "ImplGetTextLines: nWidth <= 0!" );
@@ -5295,7 +4737,7 @@ long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo,
while ( ( nBreakPos < nLen ) && ( rStr.GetChar( nBreakPos ) != _CR ) && ( rStr.GetChar( nBreakPos ) != _LF ) )
nBreakPos++;
- long nLineWidth = GetTextWidth( rStr, nPos, nBreakPos-nPos );
+ long nLineWidth = _rLayout.GetTextWidth( rStr, nPos, nBreakPos-nPos );
if ( ( nLineWidth > nWidth ) && ( nStyle & TEXT_DRAW_WORDBREAK ) )
{
if ( !xBI.is() )
@@ -5304,7 +4746,7 @@ long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo,
if ( xBI.is() )
{
const com::sun::star::lang::Locale& rDefLocale(Application::GetSettings().GetUILocale());
- xub_StrLen nSoftBreak = GetTextBreak( rStr, nWidth, nPos, nBreakPos - nPos );
+ xub_StrLen nSoftBreak = _rLayout.GetTextBreak( rStr, nWidth, nPos, nBreakPos - nPos );
DBG_ASSERT( nSoftBreak < nBreakPos, "Break?!" );
//aHyphOptions.hyphenIndex = nSoftBreak;
i18n::LineBreakResults aLBR = xBI->getLineBreak( aText, nSoftBreak, rDefLocale, nPos, aHyphOptions, aUserOptions );
@@ -5408,7 +4850,7 @@ long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo,
} // if ( xHyph.is() )
} // if ( (nStyle & TEXT_DRAW_WORDBREAK_HYPHENATION) == TEXT_DRAW_WORDBREAK_HYPHENATION )
}
- nLineWidth = GetTextWidth( rStr, nPos, nBreakPos-nPos );
+ nLineWidth = _rLayout.GetTextWidth( rStr, nPos, nBreakPos-nPos );
}
else
{
@@ -5422,14 +4864,14 @@ long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo,
{
if( nSpacePos > nPos )
nSpacePos--;
- nW = GetTextWidth( rStr, nPos, nSpacePos-nPos );
+ nW = _rLayout.GetTextWidth( rStr, nPos, nSpacePos-nPos );
}
} while( nW > nWidth );
if( nSpacePos != STRING_NOTFOUND )
{
nBreakPos = nSpacePos;
- nLineWidth = GetTextWidth( rStr, nPos, nBreakPos-nPos );
+ nLineWidth = _rLayout.GetTextWidth( rStr, nPos, nBreakPos-nPos );
if( nBreakPos < rStr.Len()-1 )
nBreakPos++;
}
@@ -6159,6 +5601,10 @@ void OutputDevice::DrawTextArray( const Point& rStartPt, const String& rStr,
if ( !IsDeviceOutputNecessary() )
return;
+ if( mbInitClipRegion )
+ ImplInitClipRegion();
+ if( mbOutputClipped )
+ return;
SalLayout* pSalLayout = ImplLayout( rStr, nIndex, nLen, rStartPt, 0, pDXAry, true );
if( pSalLayout )
@@ -6483,7 +5929,7 @@ SalLayout* OutputDevice::ImplLayout( const String& rOrigStr,
// convert from logical units to physical units
// recode string if needed
if( mpFontEntry->mpConversion )
- ImplRecodeString( mpFontEntry->mpConversion, aStr, 0, aStr.Len() );
+ mpFontEntry->mpConversion->RecodeString( aStr, 0, aStr.Len() );
long nPixelWidth = nLogicalWidth;
if( nLogicalWidth && mbMap )
@@ -6771,9 +6217,10 @@ xub_StrLen OutputDevice::GetTextBreak( const String& rStr, long nTextWidth,
// -----------------------------------------------------------------------
-void OutputDevice::ImplDrawText( const Rectangle& rRect,
+void OutputDevice::ImplDrawText( OutputDevice& rTargetDevice, const Rectangle& rRect,
const String& rOrigStr, USHORT nStyle,
- MetricVector* pVector, String* pDisplayText )
+ MetricVector* pVector, String* pDisplayText,
+ ::vcl::ITextLayout& _rLayout )
{
Color aOldTextColor;
Color aOldTextFillColor;
@@ -6782,12 +6229,12 @@ void OutputDevice::ImplDrawText( const Rectangle& rRect,
{
BOOL bHighContrastBlack = FALSE;
BOOL bHighContrastWhite = FALSE;
- const StyleSettings& rStyleSettings( GetSettings().GetStyleSettings() );
+ const StyleSettings& rStyleSettings( rTargetDevice.GetSettings().GetStyleSettings() );
if( rStyleSettings.GetHighContrastMode() )
{
Color aCol;
- if( IsBackground() )
- aCol = GetBackground().GetColor();
+ if( rTargetDevice.IsBackground() )
+ aCol = rTargetDevice.GetBackground().GetColor();
else
// best guess is the face color here
// but it may be totally wrong. the background color
@@ -6798,16 +6245,16 @@ void OutputDevice::ImplDrawText( const Rectangle& rRect,
bHighContrastWhite = aCol.IsBright();
}
- aOldTextColor = GetTextColor();
- if ( IsTextFillColor() )
+ aOldTextColor = rTargetDevice.GetTextColor();
+ if ( rTargetDevice.IsTextFillColor() )
{
bRestoreFillColor = TRUE;
- aOldTextFillColor = GetTextFillColor();
+ aOldTextFillColor = rTargetDevice.GetTextFillColor();
}
if( bHighContrastBlack )
- SetTextColor( COL_GREEN );
+ rTargetDevice.SetTextColor( COL_GREEN );
else if( bHighContrastWhite )
- SetTextColor( COL_LIGHTGREEN );
+ rTargetDevice.SetTextColor( COL_LIGHTGREEN );
else
{
// draw disabled text always without shadow
@@ -6818,7 +6265,7 @@ void OutputDevice::ImplDrawText( const Rectangle& rRect,
aRect.Move( 1, 1 );
DrawText( aRect, rOrigStr, nStyle & ~TEXT_DRAW_DISABLE );
*/
- SetTextColor( GetSettings().GetStyleSettings().GetDisableColor() );
+ rTargetDevice.SetTextColor( rTargetDevice.GetSettings().GetStyleSettings().GetDisableColor() );
}
}
@@ -6830,14 +6277,16 @@ void OutputDevice::ImplDrawText( const Rectangle& rRect,
Point aPos = rRect.TopLeft();
- long nTextHeight = GetTextHeight();
- TextAlign eAlign = GetTextAlign();
+ long nTextHeight = rTargetDevice.GetTextHeight();
+ TextAlign eAlign = rTargetDevice.GetTextAlign();
xub_StrLen nMnemonicPos = STRING_NOTFOUND;
String aStr = rOrigStr;
if ( nStyle & TEXT_DRAW_MNEMONIC )
aStr = GetNonMnemonicString( aStr, nMnemonicPos );
+ const bool bDrawMnemonics = !(rTargetDevice.GetSettings().GetStyleSettings().GetOptions() & STYLE_OPTION_NOMNEMONICS) && !pVector;
+
// Mehrzeiligen Text behandeln wir anders
if ( nStyle & TEXT_DRAW_MULTILINE )
{
@@ -6852,7 +6301,7 @@ void OutputDevice::ImplDrawText( const Rectangle& rRect,
if ( nTextHeight )
{
- nMaxTextWidth = ImplGetTextLines( aMultiLineInfo, nWidth, aStr, nStyle );
+ nMaxTextWidth = ImplGetTextLines( aMultiLineInfo, nWidth, aStr, nStyle, _rLayout );
nLines = (xub_StrLen)(nHeight/nTextHeight);
nFormatLines = aMultiLineInfo.Count();
if ( !nLines )
@@ -6874,7 +6323,7 @@ void OutputDevice::ImplDrawText( const Rectangle& rRect,
if ( aLastLine.GetChar( i ) == _LF )
aLastLine.SetChar( i, ' ' );
}
- aLastLine = GetEllipsisString( aLastLine, nWidth, nStyle );
+ aLastLine = ImplGetEllipsisString( rTargetDevice, aLastLine, nWidth, nStyle, _rLayout );
nStyle &= ~(TEXT_DRAW_VCENTER | TEXT_DRAW_BOTTOM);
nStyle |= TEXT_DRAW_TOP;
}
@@ -6892,8 +6341,8 @@ void OutputDevice::ImplDrawText( const Rectangle& rRect,
// Clipping setzen
if ( nStyle & TEXT_DRAW_CLIP )
{
- Push( PUSH_CLIPREGION );
- IntersectClipRegion( rRect );
+ rTargetDevice.Push( PUSH_CLIPREGION );
+ rTargetDevice.IntersectClipRegion( rRect );
}
// Vertikales Alignment
@@ -6906,7 +6355,7 @@ void OutputDevice::ImplDrawText( const Rectangle& rRect,
if ( eAlign == ALIGN_BOTTOM )
aPos.Y() += nTextHeight;
else if ( eAlign == ALIGN_BASELINE )
- aPos.Y() += GetFontMetric().GetAscent();
+ aPos.Y() += rTargetDevice.GetFontMetric().GetAscent();
// Alle Zeilen ausgeben, bis auf die letzte
for ( i = 0; i < nFormatLines; i++ )
@@ -6918,8 +6367,8 @@ void OutputDevice::ImplDrawText( const Rectangle& rRect,
aPos.X() += (nWidth-pLineInfo->GetWidth())/2;
xub_StrLen nIndex = pLineInfo->GetIndex();
xub_StrLen nLineLen = pLineInfo->GetLen();
- DrawText( aPos, aStr, nIndex, nLineLen, pVector, pDisplayText );
- if ( !(GetSettings().GetStyleSettings().GetOptions() & STYLE_OPTION_NOMNEMONICS) && !pVector )
+ _rLayout.DrawText( aPos, aStr, nIndex, nLineLen, pVector, pDisplayText );
+ if ( bDrawMnemonics )
{
if ( (nMnemonicPos >= nIndex) && (nMnemonicPos < nIndex+nLineLen) )
{
@@ -6928,16 +6377,16 @@ void OutputDevice::ImplDrawText( const Rectangle& rRect,
long nMnemonicWidth;
sal_Int32* pCaretXArray = (sal_Int32*) alloca( 2 * sizeof(sal_Int32) * nLineLen );
- /*BOOL bRet =*/ GetCaretPositions( aStr, pCaretXArray,
- nIndex, nLineLen);
+ /*BOOL bRet =*/ _rLayout.GetCaretPositions( aStr, pCaretXArray,
+ nIndex, nLineLen );
long lc_x1 = pCaretXArray[2*(nMnemonicPos - nIndex)];
long lc_x2 = pCaretXArray[2*(nMnemonicPos - nIndex)+1];
- nMnemonicWidth = ::abs((int)(lc_x1 - lc_x2));
+ nMnemonicWidth = rTargetDevice.ImplLogicWidthToDevicePixel( ::abs((int)(lc_x1 - lc_x2)) );
- Point aTempPos = LogicToPixel( aPos );
- nMnemonicX = mnOutOffX + aTempPos.X() + ImplLogicWidthToDevicePixel( Min( lc_x1, lc_x2 ) );
- nMnemonicY = mnOutOffY + aTempPos.Y() + ImplLogicWidthToDevicePixel( GetFontMetric().GetAscent() );
- ImplDrawMnemonicLine( nMnemonicX, nMnemonicY, nMnemonicWidth );
+ Point aTempPos = rTargetDevice.LogicToPixel( aPos );
+ nMnemonicX = rTargetDevice.GetOutOffXPixel() + aTempPos.X() + rTargetDevice.ImplLogicWidthToDevicePixel( Min( lc_x1, lc_x2 ) );
+ nMnemonicY = rTargetDevice.GetOutOffYPixel() + aTempPos.Y() + rTargetDevice.ImplLogicWidthToDevicePixel( rTargetDevice.GetFontMetric().GetAscent() );
+ rTargetDevice.ImplDrawMnemonicLine( nMnemonicX, nMnemonicY, nMnemonicWidth );
}
}
aPos.Y() += nTextHeight;
@@ -6948,26 +6397,26 @@ void OutputDevice::ImplDrawText( const Rectangle& rRect,
// Gibt es noch eine letzte Zeile, dann diese linksbuendig ausgeben,
// da die Zeile gekuerzt wurde
if ( aLastLine.Len() )
- DrawText( aPos, aLastLine, 0, STRING_LEN, pVector, pDisplayText );
+ _rLayout.DrawText( aPos, aLastLine, 0, STRING_LEN, pVector, pDisplayText );
// Clipping zuruecksetzen
if ( nStyle & TEXT_DRAW_CLIP )
- Pop();
+ rTargetDevice.Pop();
}
}
else
{
- long nTextWidth = GetTextWidth( aStr );
+ long nTextWidth = _rLayout.GetTextWidth( aStr, 0, STRING_LEN );
// Evt. Text kuerzen
if ( nTextWidth > nWidth )
{
if ( nStyle & TEXT_DRAW_ELLIPSIS )
{
- aStr = GetEllipsisString( aStr, nWidth, nStyle );
+ aStr = ImplGetEllipsisString( rTargetDevice, aStr, nWidth, nStyle, _rLayout );
nStyle &= ~(TEXT_DRAW_CENTER | TEXT_DRAW_RIGHT);
nStyle |= TEXT_DRAW_LEFT;
- nTextWidth = GetTextWidth( aStr );
+ nTextWidth = _rLayout.GetTextWidth( aStr, 0, aStr.Len() );
}
}
else
@@ -6986,7 +6435,7 @@ void OutputDevice::ImplDrawText( const Rectangle& rRect,
if ( eAlign == ALIGN_BOTTOM )
aPos.Y() += nTextHeight;
else if ( eAlign == ALIGN_BASELINE )
- aPos.Y() += GetFontMetric().GetAscent();
+ aPos.Y() += rTargetDevice.GetFontMetric().GetAscent();
if ( nStyle & TEXT_DRAW_BOTTOM )
aPos.Y() += nHeight-nTextHeight;
@@ -6999,44 +6448,44 @@ void OutputDevice::ImplDrawText( const Rectangle& rRect,
if ( nMnemonicPos != STRING_NOTFOUND )
{
sal_Int32* pCaretXArray = (sal_Int32*) alloca( 2 * sizeof(sal_Int32) * aStr.Len() );
- /*BOOL bRet =*/ GetCaretPositions( aStr, pCaretXArray, 0, aStr.Len() );
+ /*BOOL bRet =*/ _rLayout.GetCaretPositions( aStr, pCaretXArray, 0, aStr.Len() );
long lc_x1 = pCaretXArray[2*(nMnemonicPos)];
long lc_x2 = pCaretXArray[2*(nMnemonicPos)+1];
- nMnemonicWidth = ::abs((int)(lc_x1 - lc_x2));
+ nMnemonicWidth = rTargetDevice.ImplLogicWidthToDevicePixel( ::abs((int)(lc_x1 - lc_x2)) );
- Point aTempPos = LogicToPixel( aPos );
- nMnemonicX = mnOutOffX + aTempPos.X() + ImplLogicWidthToDevicePixel( Min(lc_x1, lc_x2) );
- nMnemonicY = mnOutOffY + aTempPos.Y() + ImplLogicWidthToDevicePixel( GetFontMetric().GetAscent() );
+ Point aTempPos = rTargetDevice.LogicToPixel( aPos );
+ nMnemonicX = rTargetDevice.GetOutOffXPixel() + aTempPos.X() + rTargetDevice.ImplLogicWidthToDevicePixel( Min(lc_x1, lc_x2) );
+ nMnemonicY = rTargetDevice.GetOutOffYPixel() + aTempPos.Y() + rTargetDevice.ImplLogicWidthToDevicePixel( rTargetDevice.GetFontMetric().GetAscent() );
}
if ( nStyle & TEXT_DRAW_CLIP )
{
- Push( PUSH_CLIPREGION );
- IntersectClipRegion( rRect );
- DrawText( aPos, aStr, 0, STRING_LEN, pVector, pDisplayText );
- if ( !(GetSettings().GetStyleSettings().GetOptions() & STYLE_OPTION_NOMNEMONICS) && !pVector )
+ rTargetDevice.Push( PUSH_CLIPREGION );
+ rTargetDevice.IntersectClipRegion( rRect );
+ _rLayout.DrawText( aPos, aStr, 0, STRING_LEN, pVector, pDisplayText );
+ if ( bDrawMnemonics )
{
if ( nMnemonicPos != STRING_NOTFOUND )
- ImplDrawMnemonicLine( nMnemonicX, nMnemonicY, nMnemonicWidth );
+ rTargetDevice.ImplDrawMnemonicLine( nMnemonicX, nMnemonicY, nMnemonicWidth );
}
- Pop();
+ rTargetDevice.Pop();
}
else
{
- DrawText( aPos, aStr, 0, STRING_LEN, pVector, pDisplayText );
- if ( !(GetSettings().GetStyleSettings().GetOptions() & STYLE_OPTION_NOMNEMONICS) && !pVector )
+ _rLayout.DrawText( aPos, aStr, 0, STRING_LEN, pVector, pDisplayText );
+ if ( bDrawMnemonics )
{
if ( nMnemonicPos != STRING_NOTFOUND )
- ImplDrawMnemonicLine( nMnemonicX, nMnemonicY, nMnemonicWidth );
+ rTargetDevice.ImplDrawMnemonicLine( nMnemonicX, nMnemonicY, nMnemonicWidth );
}
}
}
if ( nStyle & TEXT_DRAW_DISABLE && !pVector )
{
- SetTextColor( aOldTextColor );
+ rTargetDevice.SetTextColor( aOldTextColor );
if ( bRestoreFillColor )
- SetTextFillColor( aOldTextFillColor );
+ rTargetDevice.SetTextFillColor( aOldTextFillColor );
}
}
@@ -7069,7 +6518,8 @@ void OutputDevice::AddTextRectActions( const Rectangle& rRect,
// #i47157# Factored out to ImplDrawTextRect(), to be shared
// between us and DrawText()
- ImplDrawText( rRect, rOrigStr, nStyle, NULL, NULL );
+ DefaultTextLayout aLayout( *this );
+ ImplDrawText( *this, rRect, rOrigStr, nStyle, NULL, NULL, aLayout );
// and restore again
EnableOutput( bOutputEnabled );
@@ -7078,10 +6528,9 @@ void OutputDevice::AddTextRectActions( const Rectangle& rRect,
// -----------------------------------------------------------------------
-void OutputDevice::DrawText( const Rectangle& rRect,
- const String& rOrigStr, USHORT nStyle,
- MetricVector* pVector, String* pDisplayText )
-
+void OutputDevice::DrawText( const Rectangle& rRect, const String& rOrigStr, USHORT nStyle,
+ MetricVector* pVector, String* pDisplayText,
+ ::vcl::ITextLayout* _pTextLayout )
{
if( mpOutDevData && mpOutDevData->mpRecordLayout )
{
@@ -7092,10 +6541,11 @@ void OutputDevice::DrawText( const Rectangle& rRect,
DBG_TRACE( "OutputDevice::DrawText( const Rectangle& )" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
- if ( mpMetaFile )
+ bool bDecomposeTextRectAction = ( _pTextLayout != NULL ) && _pTextLayout->DecomposeTextRectAction();
+ if ( mpMetaFile && !bDecomposeTextRectAction )
mpMetaFile->AddAction( new MetaTextRectAction( rRect, rOrigStr, nStyle ) );
- if ( ( !IsDeviceOutputNecessary() && ! pVector ) || !rOrigStr.Len() || rRect.IsEmpty() )
+ if ( ( !IsDeviceOutputNecessary() && !pVector && !bDecomposeTextRectAction ) || !rOrigStr.Len() || rRect.IsEmpty() )
return;
// we need a graphics
@@ -7103,17 +6553,19 @@ void OutputDevice::DrawText( const Rectangle& rRect,
return;
if( mbInitClipRegion )
ImplInitClipRegion();
- if( mbOutputClipped )
+ if( mbOutputClipped && !bDecomposeTextRectAction )
return;
// temporarily disable mtf action generation (ImplDrawText _does_
// create META_TEXT_ACTIONs otherwise)
GDIMetaFile* pMtf = mpMetaFile;
- mpMetaFile = NULL;
+ if ( !bDecomposeTextRectAction )
+ mpMetaFile = NULL;
- // #i47157# Factored out to ImplDrawTextRect(), to be used also
+ // #i47157# Factored out to ImplDrawText(), to be used also
// from AddTextRectActions()
- ImplDrawText( rRect, rOrigStr, nStyle, pVector, pDisplayText );
+ DefaultTextLayout aDefaultLayout( *this );
+ ImplDrawText( *this, rRect, rOrigStr, nStyle, pVector, pDisplayText, _pTextLayout ? *_pTextLayout : aDefaultLayout );
// and enable again
mpMetaFile = pMtf;
@@ -7125,8 +6577,9 @@ void OutputDevice::DrawText( const Rectangle& rRect,
// -----------------------------------------------------------------------
Rectangle OutputDevice::GetTextRect( const Rectangle& rRect,
- const String& rOrigStr, USHORT nStyle,
- TextRectInfo* pInfo ) const
+ const XubString& rStr, USHORT nStyle,
+ TextRectInfo* pInfo,
+ const ::vcl::ITextLayout* _pTextLayout ) const
{
DBG_TRACE( "OutputDevice::GetTextRect()" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
@@ -7137,7 +6590,7 @@ Rectangle OutputDevice::GetTextRect( const Rectangle& rRect,
long nMaxWidth;
long nTextHeight = GetTextHeight();
- String aStr = rOrigStr;
+ String aStr = rStr;
if ( nStyle & TEXT_DRAW_MNEMONIC )
aStr = GetNonMnemonicString( aStr );
@@ -7149,7 +6602,8 @@ Rectangle OutputDevice::GetTextRect( const Rectangle& rRect,
xub_StrLen i;
nMaxWidth = 0;
- ImplGetTextLines( aMultiLineInfo, nWidth, aStr, nStyle );
+ DefaultTextLayout aDefaultLayout( *const_cast< OutputDevice* >( this ) );
+ ImplGetTextLines( aMultiLineInfo, nWidth, aStr, nStyle, _pTextLayout ? *_pTextLayout : aDefaultLayout );
nFormatLines = aMultiLineInfo.Count();
if ( !nTextHeight )
nTextHeight = 1;
@@ -7197,7 +6651,7 @@ Rectangle OutputDevice::GetTextRect( const Rectangle& rRect,
else
{
nLines = 1;
- nMaxWidth = GetTextWidth( aStr );
+ nMaxWidth = _pTextLayout ? _pTextLayout->GetTextWidth( aStr, 0, aStr.Len() ) : GetTextWidth( aStr );
if ( pInfo )
{
@@ -7256,11 +6710,20 @@ static BOOL ImplIsCharIn( xub_Unicode c, const sal_Char* pStr )
String OutputDevice::GetEllipsisString( const String& rOrigStr, long nMaxWidth,
USHORT nStyle ) const
{
- DBG_TRACE( "OutputDevice::GetEllipsisString()" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+ DefaultTextLayout aTextLayout( *const_cast< OutputDevice* >( this ) );
+ return ImplGetEllipsisString( *this, rOrigStr, nMaxWidth, nStyle, aTextLayout );
+}
+
+// -----------------------------------------------------------------------
+
+String OutputDevice::ImplGetEllipsisString( const OutputDevice& rTargetDevice, const XubString& rOrigStr, long nMaxWidth,
+ USHORT nStyle, const ::vcl::ITextLayout& _rLayout )
+{
+ DBG_TRACE( "OutputDevice::ImplGetEllipsisString()" );
String aStr = rOrigStr;
- xub_StrLen nIndex = GetTextBreak( aStr, nMaxWidth );
+ xub_StrLen nIndex = _rLayout.GetTextBreak( aStr, nMaxWidth, 0, aStr.Len() );
if ( nIndex != STRING_LEN )
@@ -7271,7 +6734,7 @@ String OutputDevice::GetEllipsisString( const String& rOrigStr, long nMaxWidth,
if ( nIndex > 1 )
{
aStr.AppendAscii( "..." );
- while ( aStr.Len() && (GetTextWidth( aStr ) > nMaxWidth) )
+ while ( aStr.Len() && (_rLayout.GetTextWidth( aStr, 0, aStr.Len() ) > nMaxWidth) )
{
if ( (nIndex > 1) || (nIndex == aStr.Len()) )
nIndex--;
@@ -7307,8 +6770,8 @@ String OutputDevice::GetEllipsisString( const String& rOrigStr, long nMaxWidth,
XubString aLastStr( aStr, nLastContent, aStr.Len() );
XubString aTempLastStr1( RTL_CONSTASCII_USTRINGPARAM( "..." ) );
aTempLastStr1 += aLastStr;
- if ( GetTextWidth( aTempLastStr1 ) > nMaxWidth )
- aStr = GetEllipsisString( aStr, nMaxWidth, nStyle | TEXT_DRAW_ENDELLIPSIS );
+ if ( _rLayout.GetTextWidth( aTempLastStr1, 0, aTempLastStr1.Len() ) > nMaxWidth )
+ aStr = OutputDevice::ImplGetEllipsisString( rTargetDevice, aStr, nMaxWidth, nStyle | TEXT_DRAW_ENDELLIPSIS, _rLayout );
else
{
USHORT nFirstContent = 0;
@@ -7323,7 +6786,7 @@ String OutputDevice::GetEllipsisString( const String& rOrigStr, long nMaxWidth,
nFirstContent++;
if ( nFirstContent >= nLastContent )
- aStr = GetEllipsisString( aStr, nMaxWidth, nStyle | TEXT_DRAW_ENDELLIPSIS );
+ aStr = OutputDevice::ImplGetEllipsisString( rTargetDevice, aStr, nMaxWidth, nStyle | TEXT_DRAW_ENDELLIPSIS, _rLayout );
else
{
if ( nFirstContent > 4 )
@@ -7332,8 +6795,8 @@ String OutputDevice::GetEllipsisString( const String& rOrigStr, long nMaxWidth,
aFirstStr.AppendAscii( "..." );
XubString aTempStr = aFirstStr;
aTempStr += aLastStr;
- if ( GetTextWidth( aTempStr ) > nMaxWidth )
- aStr = GetEllipsisString( aStr, nMaxWidth, nStyle | TEXT_DRAW_ENDELLIPSIS );
+ if ( _rLayout.GetTextWidth( aTempStr, 0, aTempStr.Len() ) > nMaxWidth )
+ aStr = OutputDevice::ImplGetEllipsisString( rTargetDevice, aStr, nMaxWidth, nStyle | TEXT_DRAW_ENDELLIPSIS, _rLayout );
else
{
do
@@ -7357,7 +6820,7 @@ String OutputDevice::GetEllipsisString( const String& rOrigStr, long nMaxWidth,
XubString aTempLastStr( aStr, nLastContent, aStr.Len() );
aTempStr = aFirstStr;
aTempStr += aTempLastStr;
- if ( GetTextWidth( aTempStr ) > nMaxWidth )
+ if ( _rLayout.GetTextWidth( aTempStr, 0, aTempStr.Len() ) > nMaxWidth )
break;
}
}
diff --git a/vcl/source/gdi/outdev6.cxx b/vcl/source/gdi/outdev6.cxx
index 79986988afd7..2d436ea43659 100644
--- a/vcl/source/gdi/outdev6.cxx
+++ b/vcl/source/gdi/outdev6.cxx
@@ -1158,9 +1158,11 @@ void OutputDevice::ImplDraw2ColorFrame( const Rectangle& rRect,
// -----------------------------------------------------------------------
-void OutputDevice::DrawEPS( const Point& rPoint, const Size& rSize,
+bool OutputDevice::DrawEPS( const Point& rPoint, const Size& rSize,
const GfxLink& rGfxLink, GDIMetaFile* pSubst )
{
+ bool bDrawn(true);
+
if ( mpMetaFile )
{
GDIMetaFile aSubst;
@@ -1172,20 +1174,20 @@ void OutputDevice::DrawEPS( const Point& rPoint, const Size& rSize,
}
if ( !IsDeviceOutputNecessary() || ImplIsRecordLayout() )
- return;
+ return bDrawn;
if( mbOutputClipped )
- return;
+ return bDrawn;
Rectangle aRect( ImplLogicToDevicePixel( Rectangle( rPoint, rSize ) ) );
+
if( !aRect.IsEmpty() )
{
// draw the real EPS graphics
- bool bDrawn = FALSE;
if( rGfxLink.GetData() && rGfxLink.GetDataSize() )
{
if( !mpGraphics && !ImplGetGraphics() )
- return;
+ return bDrawn;
if( mbInitClipRegion )
ImplInitClipRegion();
@@ -1208,4 +1210,6 @@ void OutputDevice::DrawEPS( const Point& rPoint, const Size& rSize,
if( mpAlphaVDev )
mpAlphaVDev->DrawEPS( rPoint, rSize, rGfxLink, pSubst );
+
+ return bDrawn;
}
diff --git a/vcl/source/gdi/pdfextoutdevdata.cxx b/vcl/source/gdi/pdfextoutdevdata.cxx
index a7d91abcbd5f..9c8c1ec1bf5e 100644
--- a/vcl/source/gdi/pdfextoutdevdata.cxx
+++ b/vcl/source/gdi/pdfextoutdevdata.cxx
@@ -283,8 +283,6 @@ struct PageSyncData
std::deque< Graphic > mGraphics;
std::deque< ::boost::shared_ptr< PDFWriter::AnyWidget > >
mControls;
- std::set< ::rtl::OUString > mControlNames;
-
GlobalSyncData* mpGlobalData;
sal_Bool mbGroupIgnoreGDIMtfActions;
@@ -375,7 +373,6 @@ sal_Bool PageSyncData::PlaySyncPageAct( PDFWriter& rWriter, sal_uInt32& rCurGDIM
if ( pControl.get() )
rWriter.CreateControl( *pControl );
mControls.pop_front();
- mControlNames.erase( pControl->Name );
}
break;
case PDFExtOutDevDataSync::BeginGroup :
@@ -772,16 +769,6 @@ void PDFExtOutDevData::CreateControl( const PDFWriter::AnyWidget& rControlType,
mpPageSyncData->PushAction( mrOutDev, PDFExtOutDevDataSync::CreateControl );
::boost::shared_ptr< PDFWriter::AnyWidget > pClone( rControlType.Clone() );
- // ensure a unique name
- ::rtl::OUString sUniqueName( pClone->Name );
- sal_Int32 nUniqueNumber( 0 );
- while ( mpPageSyncData->mControlNames.find( sUniqueName ) != mpPageSyncData->mControlNames.end() )
- {
- sUniqueName = pClone->Name + ::rtl::OUString::valueOf( ++nUniqueNumber );
- }
- pClone->Name = sUniqueName;
- mpPageSyncData->mControlNames.insert( pClone->Name );
-
mpPageSyncData->mControls.push_back( pClone );
}
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index e7ee18ec7705..c0205f1f325d 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -41,7 +41,6 @@
#include <tools/debug.hxx>
#include <tools/zcodec.hxx>
#include <tools/stream.hxx>
-#include <tools/urlobj.hxx> //for relative url
#include <i18npool/mslangid.hxx>
#include <vcl/virdev.hxx>
#include <vcl/bmpacc.hxx>
@@ -51,6 +50,7 @@
#include <vcl/sallayout.hxx>
#include <vcl/metric.hxx>
#include <vcl/fontsubset.hxx>
+#include <vcl/textlayout.hxx>
#include <svsys.h>
#include <vcl/salgdi.hxx>
#include <vcl/svapp.hxx>
@@ -61,11 +61,9 @@
#include <comphelper/processfactory.hxx>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/util/URL.hpp>
-
-#include "implncvt.hxx"
-
#include "cppuhelper/implbase1.hxx"
#include <icc/sRGB-IEC61966-2.1.hxx>
+#include <vcl/lineinfo.hxx>
using namespace vcl;
using namespace rtl;
@@ -667,26 +665,29 @@ OString PDFWriterImpl::convertWidgetFieldName( const rtl::OUString& rString )
}
OString aRet = aBuffer.makeStringAndClear();
- std::hash_map<OString, sal_Int32, OStringHash>::iterator it = m_aFieldNameMap.find( aRet );
-
- if( it != m_aFieldNameMap.end() ) // not unique
+ if( ! m_aContext.AllowDuplicateFieldNames )
{
- std::hash_map< OString, sal_Int32, OStringHash >::const_iterator check_it;
- OString aTry;
- do
+ std::hash_map<OString, sal_Int32, OStringHash>::iterator it = m_aFieldNameMap.find( aRet );
+
+ if( it != m_aFieldNameMap.end() ) // not unique
{
- OStringBuffer aUnique( aRet.getLength() + 16 );
- aUnique.append( aRet );
- aUnique.append( '_' );
- aUnique.append( it->second );
- it->second++;
- aTry = aUnique.makeStringAndClear();
- check_it = m_aFieldNameMap.find( aTry );
- } while( check_it != m_aFieldNameMap.end() );
- aRet = aTry;
+ std::hash_map< OString, sal_Int32, OStringHash >::const_iterator check_it;
+ OString aTry;
+ do
+ {
+ OStringBuffer aUnique( aRet.getLength() + 16 );
+ aUnique.append( aRet );
+ aUnique.append( '_' );
+ aUnique.append( it->second );
+ it->second++;
+ aTry = aUnique.makeStringAndClear();
+ check_it = m_aFieldNameMap.find( aTry );
+ } while( check_it != m_aFieldNameMap.end() );
+ aRet = aTry;
+ }
+ else
+ m_aFieldNameMap[ aRet ] = 2;
}
- else
- m_aFieldNameMap[ aRet ] = 2;
return aRet;
}
@@ -2844,6 +2845,121 @@ static bool getPfbSegmentLengths( const unsigned char* pFontBytes, int nByteLen,
return true;
}
+std::map< sal_Int32, sal_Int32 > PDFWriterImpl::emitSystemFont( const ImplFontData* pFont, EmbedFont& rEmbed )
+{
+ std::map< sal_Int32, sal_Int32 > aRet;
+ if( isBuiltinFont( pFont ) )
+ {
+ aRet[ rEmbed.m_nNormalFontID ] = emitBuiltinFont( pFont );
+ return aRet;
+ }
+
+ sal_Int32 nFontObject = 0;
+ sal_Int32 nFontDescriptor = 0;
+ rtl::OString aSubType( "/Type1" );
+ FontSubsetInfo aInfo;
+ // fill in dummy values
+ aInfo.m_nAscent = 1000;
+ aInfo.m_nDescent = 200;
+ aInfo.m_nCapHeight = 1000;
+ aInfo.m_aFontBBox = Rectangle( Point( -200, -200 ), Size( 1700, 1700 ) );
+ aInfo.m_aPSName = pFont->maName;
+ sal_Int32 pWidths[256];
+ rtl_zeroMemory( pWidths, sizeof(pWidths) );
+ if( pFont->IsEmbeddable() )
+ {
+ const unsigned char* pFontData = NULL;
+ long nFontLen = 0;
+ sal_Ucs nEncodedCodes[256];
+ sal_Int32 pEncWidths[256];
+ if( (pFontData = (const unsigned char*)m_pReferenceDevice->mpGraphics->GetEmbedFontData( pFont, nEncodedCodes, pEncWidths, aInfo, &nFontLen )) != NULL )
+ {
+ m_pReferenceDevice->mpGraphics->FreeEmbedFontData( pFontData, nFontLen );
+ for( int i = 0; i < 256; i++ )
+ {
+ if( nEncodedCodes[i] >= 32 && nEncodedCodes[i] < 256 )
+ {
+ pWidths[i] = pEncWidths[ i ];
+ }
+ }
+ }
+ }
+ else if( pFont->mbSubsettable )
+ {
+ aSubType = rtl::OString( "/TrueType" );
+ Int32Vector aGlyphWidths;
+ Ucs2UIntMap aUnicodeMap;
+ m_pReferenceDevice->mpGraphics->GetGlyphWidths( pFont, false, aGlyphWidths, aUnicodeMap );
+
+ OUString aTmpName;
+ osl_createTempFile( NULL, NULL, &aTmpName.pData );
+ sal_Int32 pGlyphIDs[ 256 ];
+ sal_uInt8 pEncoding[ 256 ];
+ sal_Ucs pUnicodes[ 256 ];
+ sal_Int32 pDuWidths[ 256 ];
+
+ memset( pGlyphIDs, 0, sizeof( pGlyphIDs ) );
+ memset( pEncoding, 0, sizeof( pEncoding ) );
+ memset( pUnicodes, 0, sizeof( pUnicodes ) );
+ memset( pDuWidths, 0, sizeof( pDuWidths ) );
+
+ for( sal_Ucs c = 32; c < 256; c++ )
+ {
+ pUnicodes[c] = c;
+ pEncoding[c] = c;
+ pGlyphIDs[c] = 0;
+ if( aUnicodeMap.find( c ) != aUnicodeMap.end() )
+ pWidths[ c ] = aGlyphWidths[ aUnicodeMap[ c ] ];
+ }
+
+ m_pReferenceDevice->mpGraphics->CreateFontSubset( aTmpName, pFont, pGlyphIDs, pEncoding, pDuWidths, 256, aInfo );
+ osl_removeFile( aTmpName.pData );
+ }
+ else
+ {
+ DBG_ERROR( "system font neither embeddable nor subsettable" );
+ }
+
+ // write font descriptor
+ nFontDescriptor = emitFontDescriptor( pFont, aInfo, 0, 0 );
+ if( nFontDescriptor )
+ {
+ // write font object
+ sal_Int32 nObject = createObject();
+ if( updateObject( nObject ) )
+ {
+ OStringBuffer aLine( 1024 );
+ aLine.append( nObject );
+ aLine.append( " 0 obj\n"
+ "<</Type/Font/Subtype" );
+ aLine.append( aSubType );
+ aLine.append( "/BaseFont/" );
+ appendName( aInfo.m_aPSName, aLine );
+ aLine.append( "\n" );
+ if( !pFont->mbSymbolFlag )
+ aLine.append( "/Encoding/WinAnsiEncoding\n" );
+ aLine.append( "/FirstChar 32 /LastChar 255\n"
+ "/Widths[" );
+ for( int i = 32; i < 256; i++ )
+ {
+ aLine.append( pWidths[i] );
+ aLine.append( ((i&15) == 15) ? "\n" : " " );
+ }
+ aLine.append( "]\n"
+ "/FontDescriptor " );
+ aLine.append( nFontDescriptor );
+ aLine.append( " 0 R>>\n"
+ "endobj\n\n" );
+ writeBuffer( aLine.getStr(), aLine.getLength() );
+
+ nFontObject = nObject;
+ aRet[ rEmbed.m_nNormalFontID ] = nObject;
+ }
+ }
+
+ return aRet;
+}
+
// TODO: always subset instead of embedding the full font => this method becomes obsolete then
std::map< sal_Int32, sal_Int32 > PDFWriterImpl::emitEmbeddedFont( const ImplFontData* pFont, EmbedFont& rEmbed )
{
@@ -3603,23 +3719,28 @@ sal_Int32 PDFWriterImpl::emitFontDescriptor( const ImplFontData* pFont, FontSubs
// According to PDF reference 1.4 StemV is required
// seems a tad strange to me, but well ...
aLine.append( "\n"
- "/StemV 80\n"
- "/FontFile" );
- switch( rInfo.m_nFontType )
+ "/StemV 80\n" );
+ if( nFontStream )
{
- case FontSubsetInfo::SFNT_TTF:
- aLine.append( '2' );
- break;
- case FontSubsetInfo::TYPE1_PFA:
- case FontSubsetInfo::TYPE1_PFB:
- break;
- default:
- DBG_ERROR( "unknown fonttype in PDF font descriptor" );
- return 0;
+ aLine.append( "/FontFile" );
+ switch( rInfo.m_nFontType )
+ {
+ case FontSubsetInfo::SFNT_TTF:
+ aLine.append( '2' );
+ break;
+ case FontSubsetInfo::TYPE1_PFA:
+ case FontSubsetInfo::TYPE1_PFB:
+ case FontSubsetInfo::ANY_TYPE1:
+ break;
+ default:
+ DBG_ERROR( "unknown fonttype in PDF font descriptor" );
+ return 0;
+ }
+ aLine.append( ' ' );
+ aLine.append( nFontStream );
+ aLine.append( " 0 R\n" );
}
- aLine.append( ' ' );
- aLine.append( nFontStream );
- aLine.append( " 0 R>>\n"
+ aLine.append( ">>\n"
"endobj\n\n" );
CHECK_RETURN( writeBuffer( aLine.getStr(), aLine.getLength() ) );
@@ -3876,6 +3997,17 @@ bool PDFWriterImpl::emitFonts()
}
}
+ // emit system fonts
+ for( FontEmbedData::iterator sit = m_aSystemFonts.begin(); sit != m_aSystemFonts.end(); ++sit )
+ {
+ std::map< sal_Int32, sal_Int32 > aObjects = emitSystemFont( sit->first, sit->second );
+ for( std::map< sal_Int32, sal_Int32 >::iterator fit = aObjects.begin(); fit != aObjects.end(); ++fit )
+ {
+ CHECK_RETURN( fit->second );
+ aFontIDToObject[ fit->first ] = fit->second;
+ }
+ }
+
OStringBuffer aFontDict( 1024 );
aFontDict.append( getFontDictObject() );
aFontDict.append( " 0 obj\n"
@@ -4576,13 +4708,25 @@ void PDFWriterImpl::createDefaultEditAppearance( PDFWidget& rEdit, const PDFWrit
// prepare font to use, draw field border
Font aFont = drawFieldBorder( rEdit, rWidget, rSettings );
- sal_Int32 nBest = getBestBuiltinFont( aFont );
+ sal_Int32 nBest = m_aContext.FieldsUseSystemFonts ? getSystemFont( aFont ): getBestBuiltinFont( aFont );
// prepare DA string
OStringBuffer aDA( 32 );
appendNonStrokingColor( replaceColor( rWidget.TextColor, rSettings.GetFieldTextColor() ), aDA );
aDA.append( ' ' );
- aDA.append( m_aBuiltinFonts[nBest].getNameObject() );
+ if( m_aContext.FieldsUseSystemFonts )
+ {
+ aDA.append( "/F" );
+ aDA.append( nBest );
+
+ OStringBuffer aDR( 32 );
+ aDR.append( "/Font " );
+ aDR.append( getFontDictObject() );
+ aDR.append( " 0 R" );
+ rEdit.m_aDRDict = aDR.makeStringAndClear();
+ }
+ else
+ aDA.append( m_aBuiltinFonts[nBest].getNameObject() );
aDA.append( ' ' );
m_aPages[ m_nCurrentPage ].appendMappedLength( sal_Int32( aFont.GetHeight() ), aDA );
aDA.append( " Tf" );
@@ -4616,7 +4760,7 @@ void PDFWriterImpl::createDefaultListBoxAppearance( PDFWidget& rBox, const PDFWr
// prepare font to use, draw field border
Font aFont = drawFieldBorder( rBox, rWidget, rSettings );
- sal_Int32 nBest = getBestBuiltinFont( aFont );
+ sal_Int32 nBest = m_aContext.FieldsUseSystemFonts ? getSystemFont( aFont ): getBestBuiltinFont( aFont );
beginRedirect( pListBoxStream, rBox.m_aRect );
OStringBuffer aAppearance( 64 );
@@ -4664,9 +4808,22 @@ void PDFWriterImpl::createDefaultListBoxAppearance( PDFWidget& rBox, const PDFWr
aDA.append( " 2 Tr " );
}
#endif
+ // prepare DA string
appendNonStrokingColor( replaceColor( rWidget.TextColor, rSettings.GetFieldTextColor() ), aDA );
aDA.append( ' ' );
- aDA.append( m_aBuiltinFonts[nBest].getNameObject() );
+ if( m_aContext.FieldsUseSystemFonts )
+ {
+ aDA.append( "/F" );
+ aDA.append( nBest );
+
+ OStringBuffer aDR( 32 );
+ aDR.append( "/Font " );
+ aDR.append( getFontDictObject() );
+ aDR.append( " 0 R" );
+ rBox.m_aDRDict = aDR.makeStringAndClear();
+ }
+ else
+ aDA.append( m_aBuiltinFonts[nBest].getNameObject() );
aDA.append( ' ' );
m_aPages[ m_nCurrentPage ].appendMappedLength( sal_Int32( aFont.GetHeight() ), aDA );
aDA.append( " Tf" );
@@ -5243,9 +5400,18 @@ bool PDFWriterImpl::emitWidgetAnnotations()
}
if( rWidget.m_aDAString.getLength() )
{
- aLine.append( "/DR<</Font<<" );
- appendBuiltinFontsToDict( aLine );
- aLine.append( ">>>>\n" );
+ if( rWidget.m_aDRDict.getLength() )
+ {
+ aLine.append( "/DR<<" );
+ aLine.append( rWidget.m_aDRDict );
+ aLine.append( ">>\n" );
+ }
+ else
+ {
+ aLine.append( "/DR<</Font<<" );
+ appendBuiltinFontsToDict( aLine );
+ aLine.append( ">>>>\n" );
+ }
aLine.append( "/DA" );
appendLiteralStringEncrypt( rWidget.m_aDAString, rWidget.m_nObject, aLine );
aLine.append( "\n" );
@@ -6386,6 +6552,29 @@ std::set< PDFWriter::ErrorCode > PDFWriterImpl::getErrors()
return m_aErrors;
}
+sal_Int32 PDFWriterImpl::getSystemFont( const Font& i_rFont )
+{
+ getReferenceDevice()->Push();
+ getReferenceDevice()->SetFont( i_rFont );
+ getReferenceDevice()->ImplNewFont();
+
+ const ImplFontData* pDevFont = m_pReferenceDevice->mpFontEntry->maFontSelData.mpFontData;
+ sal_Int32 nFontID = 0;
+ FontEmbedData::iterator it = m_aSystemFonts.find( pDevFont );
+ if( it != m_aSystemFonts.end() )
+ nFontID = it->second.m_nNormalFontID;
+ else
+ {
+ nFontID = m_nNextFID++;
+ m_aSystemFonts[ pDevFont ] = EmbedFont();
+ m_aSystemFonts[ pDevFont ].m_nNormalFontID = nFontID;
+ }
+
+ getReferenceDevice()->Pop();
+ getReferenceDevice()->ImplNewFont();
+
+ return nFontID;
+}
void PDFWriterImpl::registerGlyphs( int nGlyphs,
sal_GlyphId* pGlyphs,
@@ -7307,7 +7496,8 @@ void PDFWriterImpl::drawText( const Rectangle& rRect, const String& rOrigStr, US
if ( nTextHeight )
{
- nMaxTextWidth = m_pReferenceDevice->ImplGetTextLines( aMultiLineInfo, nWidth, aStr, nStyle );
+ ::vcl::DefaultTextLayout aLayout( *m_pReferenceDevice );
+ nMaxTextWidth = OutputDevice::ImplGetTextLines( aMultiLineInfo, nWidth, aStr, nStyle, aLayout );
nLines = (xub_StrLen)(nHeight/nTextHeight);
nFormatLines = aMultiLineInfo.Count();
if ( !nLines )
@@ -8792,6 +8982,13 @@ bool PDFWriterImpl::writeTransparentObject( TransparencyEmit& rObject )
aLine.append( ' ' );
appendFixedInt( rObject.m_aBoundRect.Bottom()+1, aLine );
aLine.append( " ]\n" );
+ if( ! rObject.m_pSoftMaskStream )
+ {
+ if( ! m_bIsPDF_A1 )
+ {
+ aLine.append( "/Group<</S/Transparency/CS/DeviceRGB/K true>>\n" );
+ }
+ }
/* #i42884# the PDF reference recommends that each Form XObject
* should have a resource dict; alas if that is the same object
* as the one of the page it triggers an endless recursion in
@@ -10133,12 +10330,17 @@ void PDFWriterImpl::setFont( const Font& rFont )
void PDFWriterImpl::push( sal_uInt16 nFlags )
{
+ OSL_ENSURE( m_aGraphicsStack.size() > 0, "invalid graphics stack" );
m_aGraphicsStack.push_front( m_aGraphicsStack.front() );
m_aGraphicsStack.front().m_nFlags = nFlags;
}
void PDFWriterImpl::pop()
{
+ OSL_ENSURE( m_aGraphicsStack.size() > 1, "pop without push" );
+ if( m_aGraphicsStack.size() < 2 )
+ return;
+
GraphicsState aState = m_aGraphicsStack.front();
m_aGraphicsStack.pop_front();
GraphicsState& rOld = m_aGraphicsStack.front();
diff --git a/vcl/source/gdi/pdfwriter_impl.hxx b/vcl/source/gdi/pdfwriter_impl.hxx
index 7d5ec2bf4f61..e058cfa487db 100644
--- a/vcl/source/gdi/pdfwriter_impl.hxx
+++ b/vcl/source/gdi/pdfwriter_impl.hxx
@@ -311,6 +311,8 @@ public:
{
sal_Int32 m_nNormalFontID;
std::list< EmbedEncoding > m_aExtendedEncodings;
+
+ EmbedFont() : m_nNormalFontID( 0 ) {}
};
typedef std::map< const ImplFontData*, EmbedFont > FontEmbedData;
@@ -396,6 +398,7 @@ public:
USHORT m_nTextStyle;
rtl::OUString m_aValue;
rtl::OString m_aDAString;
+ rtl::OString m_aDRDict;
rtl::OString m_aMKDict;
rtl::OString m_aMKDictCAString; // i12626, added to be able to encrypt the /CA text string
// since the object number is not known at the moment
@@ -612,6 +615,7 @@ private:
FontSubsetData m_aSubsets;
bool m_bEmbedStandardFonts;
FontEmbedData m_aEmbeddedFonts;
+ FontEmbedData m_aSystemFonts;
sal_Int32 m_nNextFID;
PDFFontCache m_aFontCache;
@@ -679,6 +683,7 @@ private:
m_aOverlineColor( COL_TRANSPARENT ),
m_nAntiAlias( 1 ),
m_nLayoutMode( 0 ),
+ m_aDigitLanguage( 0 ),
m_nTransparentPercent( 0 ),
m_nFlags( 0xffff ),
m_nUpdateFlags( 0xffff )
@@ -693,6 +698,7 @@ private:
m_aClipRegion( rState.m_aClipRegion ),
m_nAntiAlias( rState.m_nAntiAlias ),
m_nLayoutMode( rState.m_nLayoutMode ),
+ m_aDigitLanguage( rState.m_aDigitLanguage ),
m_nTransparentPercent( rState.m_nTransparentPercent ),
m_nFlags( rState.m_nFlags ),
m_nUpdateFlags( rState.m_nUpdateFlags )
@@ -710,6 +716,7 @@ private:
m_aClipRegion = rState.m_aClipRegion;
m_nAntiAlias = rState.m_nAntiAlias;
m_nLayoutMode = rState.m_nLayoutMode;
+ m_aDigitLanguage = rState.m_aDigitLanguage;
m_nTransparentPercent = rState.m_nTransparentPercent;
m_nFlags = rState.m_nFlags;
m_nUpdateFlags = rState.m_nUpdateFlags;
@@ -897,6 +904,8 @@ i12626
sal_Int32 emitBuiltinFont( const ImplFontData*, sal_Int32 nObject = -1 );
/* writes a type1 embedded font object and returns its mapping from font ids to object ids (or 0 in case of failure ) */
std::map< sal_Int32, sal_Int32 > emitEmbeddedFont( const ImplFontData*, EmbedFont& );
+ /* writes a type1 system font object and returns its mapping from font ids to object ids (or 0 in case of failure ) */
+ std::map< sal_Int32, sal_Int32 > emitSystemFont( const ImplFontData*, EmbedFont& );
/* writes a font descriptor and returns its object id (or 0) */
sal_Int32 emitFontDescriptor( const ImplFontData*, FontSubsetInfo&, sal_Int32 nSubsetID, sal_Int32 nStream );
/* writes a ToUnicode cmap, returns the corresponding stream object */
@@ -983,6 +992,7 @@ i12626
sal_Int32 findRadioGroupWidget( const PDFWriter::RadioButtonWidget& rRadio );
Font replaceFont( const Font& rControlFont, const Font& rAppSetFont );
sal_Int32 getBestBuiltinFont( const Font& rFont );
+ sal_Int32 getSystemFont( const Font& i_rFont );
// used for edit and listbox
Font drawFieldBorder( PDFWidget&, const PDFWriter::AnyWidget&, const StyleSettings& );
diff --git a/vcl/source/gdi/regband.cxx b/vcl/source/gdi/regband.cxx
index 938a30351f9a..09c97ef7cd2b 100644
--- a/vcl/source/gdi/regband.cxx
+++ b/vcl/source/gdi/regband.cxx
@@ -110,7 +110,7 @@ ImplRegionBand::ImplRegionBand(
if ( ! bIgnorePoints)
{
// Copy points.
- ImplRegionBandPoint* pPoint = mpFirstBandPoint;
+ ImplRegionBandPoint* pPoint = rRegionBand.mpFirstBandPoint;
ImplRegionBandPoint* pPrevPointCopy = NULL;
while (pPoint != NULL)
{
diff --git a/vcl/source/gdi/region.cxx b/vcl/source/gdi/region.cxx
index 43bb224aaa94..fefbf8cdcb08 100644
--- a/vcl/source/gdi/region.cxx
+++ b/vcl/source/gdi/region.cxx
@@ -49,6 +49,7 @@
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <basegfx/polygon/b2dpolypolygontools.hxx>
#include <basegfx/range/b2drange.hxx>
+#include <basegfx/matrix/b2dhommatrixtools.hxx>
// =======================================================================
//
@@ -1303,9 +1304,7 @@ void Region::Move( long nHorzMove, long nVertMove )
mpImplRegion->mpPolyPoly->Move( nHorzMove, nVertMove );
else if( mpImplRegion->mpB2DPolyPoly )
{
- ::basegfx::B2DHomMatrix aTransform;
- aTransform.translate( nHorzMove, nVertMove );
- mpImplRegion->mpB2DPolyPoly->transform( aTransform );
+ mpImplRegion->mpB2DPolyPoly->transform(basegfx::tools::createTranslateB2DHomMatrix(nHorzMove, nVertMove));
}
else
{
@@ -1346,9 +1345,7 @@ void Region::Scale( double fScaleX, double fScaleY )
mpImplRegion->mpPolyPoly->Scale( fScaleX, fScaleY );
else if( mpImplRegion->mpB2DPolyPoly )
{
- ::basegfx::B2DHomMatrix aTransform;
- aTransform.scale( fScaleX, fScaleY );
- mpImplRegion->mpB2DPolyPoly->transform( aTransform );
+ mpImplRegion->mpB2DPolyPoly->transform(basegfx::tools::createScaleB2DHomMatrix(fScaleX, fScaleY));
}
else
{
@@ -2459,6 +2456,14 @@ SvStream& operator>>( SvStream& rIStrm, Region& rRegion )
}
}
+ if( rIStrm.IsEof() )
+ {
+ DBG_ERROR( "premature end of region stream" );
+ delete rRegion.mpImplRegion;
+ rRegion.mpImplRegion = (ImplRegion*)&aImplEmptyRegion;
+ return rIStrm;
+ }
+
// get next header
rIStrm >> nTmp16;
}
@@ -2537,7 +2542,13 @@ SvStream& operator<<( SvStream& rOStrm, const Region& rRegion )
rOStrm << bHasPolyPolygon;
if( bHasPolyPolygon )
- rOStrm << rRegion.GetPolyPolygon();
+ {
+ // #i105373#
+ PolyPolygon aNoCurvePolyPolygon;
+ rRegion.GetPolyPolygon().AdaptiveSubdivide(aNoCurvePolyPolygon);
+
+ rOStrm << aNoCurvePolyPolygon;
+ }
}
return rOStrm;
diff --git a/vcl/source/gdi/salgdilayout.cxx b/vcl/source/gdi/salgdilayout.cxx
index 1e9572887e0b..c1f987377c67 100644
--- a/vcl/source/gdi/salgdilayout.cxx
+++ b/vcl/source/gdi/salgdilayout.cxx
@@ -52,7 +52,6 @@
#include <vcl/gdimtf.hxx>
#include <vcl/outdata.hxx>
#include <vcl/print.hxx>
-#include <implncvt.hxx>
#include <vcl/outdev.h>
#include <vcl/outdev.hxx>
#include <vcl/unowrap.hxx>
diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx
index 21ac05a498fc..c8748c65e2d3 100755
--- a/vcl/source/gdi/sallayout.cxx
+++ b/vcl/source/gdi/sallayout.cxx
@@ -44,6 +44,7 @@
#include <vcl/sallayout.hxx>
#include <basegfx/polygon/b2dpolypolygon.hxx>
#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/matrix/b2dhommatrixtools.hxx>
#include <i18npool/lang.h>
#ifndef _TL_DEBUG_HXX
@@ -95,11 +96,12 @@ bool IsDiacritic( sal_UCS4 nChar )
if( nChar >= 0x2100 )
return false;
+ // TODO: #i105058# use icu uchar.h's character classification instead of the handcrafted table
struct DiaRange { sal_UCS4 mnMin, mnEnd;};
static const DiaRange aRanges[] = {
{0x0300, 0x0370},
- {0x0590, 0x05C0}, {0x05C1, 0x05C3}, {0x05C3, 0x05C6}, {0x05C7, 0x05C8},
- {0x0610, 0x061B}, {0x064B, 0x0660}, {0x0670, 0x0671}, {0x06D6, 0x06DC}, {0x06DF, 0x06EE},
+ {0x0590, 0x05BE}, {0x05BF, 0x05C0}, {0x05C1, 0x05C3}, {0x05C4, 0x05C6}, {0x05C7, 0x05C8},
+ {0x0610, 0x061B}, {0x064B, 0x0660}, {0x0670, 0x0671}, {0x06D6, 0x06DD}, {0x06DF, 0x06E5}, {0x06E7, 0x06E9}, {0x06EA,0x06EF},
{0x0730, 0x074D}, {0x07A6, 0x07B1}, {0x07EB, 0x07F4},
#if 0 // all known fonts have zero-width diacritics already, so no need to query it
{0x0900, 0x0904}, {0x093C, 0x093D}, {0x0941, 0x0948}, {0x094D, 0x0950}, {0x0951, 0x0958},
@@ -107,7 +109,8 @@ bool IsDiacritic( sal_UCS4 nChar )
{0x0A00, 0x0A05}, {0x0A3C, 0x0A59}, //...
#endif
{0x1DC0, 0x1E00},
- {0x205F, 0x2070}, {0x20D0, 0x2100}
+ {0x205F, 0x2070}, {0x20D0, 0x2100},
+ {0xFB1E, 0xFB1F}
};
// TODO: almost anything is faster than an O(n) search
@@ -891,10 +894,8 @@ bool SalLayout::GetOutline( SalGraphics& rSalGraphics,
{
if( aPos.X() || aPos.Y() )
{
- ::basegfx::B2DHomMatrix aMatrix;
- aMatrix.translate( aPos.X(), aPos.Y() );
- aGlyphOutline.transform( aMatrix );
- }
+ aGlyphOutline.transform(basegfx::tools::createTranslateB2DHomMatrix(aPos.X(), aPos.Y()));
+ }
// insert outline at correct position
rVector.push_back( aGlyphOutline );
diff --git a/vcl/source/gdi/salmisc.cxx b/vcl/source/gdi/salmisc.cxx
index fc24c0289b50..8b442086eabf 100644
--- a/vcl/source/gdi/salmisc.cxx
+++ b/vcl/source/gdi/salmisc.cxx
@@ -426,10 +426,10 @@ BitmapBuffer* StretchAndConvert( const BitmapBuffer& rSrcBuffer, const SalTwoRec
// memory exception, clean up
// remark: the buffer ptr causing the exception
// is still NULL here
- delete pSrcScan;
- delete pDstScan;
- delete pMapX;
- delete pMapY;
+ delete[] pSrcScan;
+ delete[] pDstScan;
+ delete[] pMapX;
+ delete[] pMapY;
delete pDstBuffer;
return NULL;
}
diff --git a/vcl/source/gdi/textlayout.cxx b/vcl/source/gdi/textlayout.cxx
new file mode 100755
index 000000000000..67a30c351b7a
--- /dev/null
+++ b/vcl/source/gdi/textlayout.cxx
@@ -0,0 +1,384 @@
+/*************************************************************************
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2009 by Sun Microsystems, Inc.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_vcl.hxx"
+
+#include "vcl/ctrl.hxx"
+#include "vcl/outdev.hxx"
+#include "vcl/outfont.hxx"
+#include "vcl/textlayout.hxx"
+
+#include <com/sun/star/i18n/ScriptDirection.hpp>
+
+#include <tools/diagnose_ex.h>
+
+#if OSL_DEBUG_LEVEL > 1
+#include <rtl/strbuf.hxx>
+#endif
+
+//........................................................................
+namespace vcl
+{
+//........................................................................
+
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::Exception;
+ namespace ScriptDirection = ::com::sun::star::i18n::ScriptDirection;
+
+ //====================================================================
+ //= DefaultTextLayout
+ //====================================================================
+ //--------------------------------------------------------------------
+ DefaultTextLayout::~DefaultTextLayout()
+ {
+ }
+
+ //--------------------------------------------------------------------
+ long DefaultTextLayout::GetTextWidth( const XubString& _rText, xub_StrLen _nStartIndex, xub_StrLen _nLength ) const
+ {
+ return m_rTargetDevice.GetTextWidth( _rText, _nStartIndex, _nLength );
+ }
+
+ //--------------------------------------------------------------------
+ void DefaultTextLayout::DrawText( const Point& _rStartPoint, const XubString& _rText, xub_StrLen _nStartIndex,
+ xub_StrLen _nLength, MetricVector* _pVector, String* _pDisplayText )
+ {
+ m_rTargetDevice.DrawText( _rStartPoint, _rText, _nStartIndex, _nLength, _pVector, _pDisplayText );
+ }
+
+ //--------------------------------------------------------------------
+ bool DefaultTextLayout::GetCaretPositions( const XubString& _rText, sal_Int32* _pCaretXArray,
+ xub_StrLen _nStartIndex, xub_StrLen _nLength ) const
+ {
+ return m_rTargetDevice.GetCaretPositions( _rText, _pCaretXArray, _nStartIndex, _nLength );
+ }
+
+ //--------------------------------------------------------------------
+ xub_StrLen DefaultTextLayout::GetTextBreak( const XubString& _rText, long _nMaxTextWidth, xub_StrLen _nStartIndex, xub_StrLen _nLength ) const
+ {
+ return m_rTargetDevice.GetTextBreak( _rText, _nMaxTextWidth, _nStartIndex, _nLength );
+ }
+
+ //--------------------------------------------------------------------
+ bool DefaultTextLayout::DecomposeTextRectAction() const
+ {
+ return false;
+ }
+
+ //====================================================================
+ //= ReferenceDeviceTextLayout
+ //====================================================================
+ class ReferenceDeviceTextLayout : public ITextLayout
+ {
+ public:
+ ReferenceDeviceTextLayout( const Control& _rControl, OutputDevice& _rTargetDevice, OutputDevice& _rReferenceDevice );
+ virtual ~ReferenceDeviceTextLayout();
+
+ // ITextLayout
+ virtual long GetTextWidth( const XubString& rStr, xub_StrLen nIndex, xub_StrLen nLen ) const;
+ virtual void DrawText( const Point& _rStartPoint, const XubString& _rText, xub_StrLen _nStartIndex, xub_StrLen _nLength, MetricVector* _pVector, String* _pDisplayText );
+ virtual bool GetCaretPositions( const XubString& _rText, sal_Int32* _pCaretXArray, xub_StrLen _nStartIndex, xub_StrLen _nLength ) const;
+ virtual xub_StrLen GetTextBreak( const XubString& _rText, long _nMaxTextWidth, xub_StrLen _nStartIndex, xub_StrLen _nLength ) const;
+ virtual bool DecomposeTextRectAction() const;
+
+ public:
+ // equivalents to the respective OutputDevice methods, which take the reference device into account
+ long GetTextArray( const XubString& _rText, sal_Int32* _pDXAry, xub_StrLen _nStartIndex, xub_StrLen _nLength ) const;
+ Rectangle DrawText( const Rectangle& _rRect, const XubString& _rText, USHORT _nStyle, MetricVector* _pVector, String* _pDisplayText );
+
+ protected:
+ void onBeginDrawText()
+ {
+ m_aCompleteTextRect.SetEmpty();
+ }
+ Rectangle onEndDrawText()
+ {
+ return m_aCompleteTextRect;
+ }
+
+ private:
+ OutputDevice& m_rTargetDevice;
+ OutputDevice& m_rReferenceDevice;
+ Font m_aUnzoomedPointFont;
+ const Fraction m_aZoom;
+ const bool m_bRTLEnabled;
+
+ Rectangle m_aCompleteTextRect;
+ };
+
+ //====================================================================
+ //= ControlTextRenderer
+ //====================================================================
+ ReferenceDeviceTextLayout::ReferenceDeviceTextLayout( const Control& _rControl, OutputDevice& _rTargetDevice,
+ OutputDevice& _rReferenceDevice )
+ :m_rTargetDevice( _rTargetDevice )
+ ,m_rReferenceDevice( _rReferenceDevice )
+ ,m_aUnzoomedPointFont( _rControl.GetUnzoomedControlPointFont() )
+ ,m_aZoom( _rControl.GetZoom() )
+ ,m_bRTLEnabled( _rControl.IsRTLEnabled() )
+ {
+ m_rTargetDevice.Push( PUSH_MAPMODE | PUSH_FONT | PUSH_TEXTLAYOUTMODE );
+
+ MapMode aTargetMapMode( m_rTargetDevice.GetMapMode() );
+ OSL_ENSURE( aTargetMapMode.GetOrigin() == Point(), "ReferenceDeviceTextLayout::ReferenceDeviceTextLayout: uhm, the code below won't work here ..." );
+
+ // normally, controls simulate "zoom" by "zooming" the font. This is responsible for (part of) the discrepancies
+ // between text in Writer and text in controls in Writer, though both have the same font.
+ // So, if we have a zoom set at the control, then we do not scale the font, but instead modify the map mode
+ // to accomodate for the zoom.
+ aTargetMapMode.SetScaleX( m_aZoom ); // TODO: shouldn't this be "current_scale * zoom"?
+ aTargetMapMode.SetScaleY( m_aZoom );
+
+ // also, use a higher-resolution map unit than "pixels", which should save us some rounding errors when
+ // translating coordinates between the reference device and the target device.
+ OSL_ENSURE( aTargetMapMode.GetMapUnit() == MAP_PIXEL,
+ "ReferenceDeviceTextLayout::ReferenceDeviceTextLayout: this class is not expected to work with such target devices!" );
+ // we *could* adjust all the code in this class to handle this case, but at the moment, it's not necessary
+ const MapUnit eTargetMapUnit = m_rReferenceDevice.GetMapMode().GetMapUnit();
+ aTargetMapMode.SetMapUnit( eTargetMapUnit );
+ OSL_ENSURE( aTargetMapMode.GetMapUnit() != MAP_PIXEL,
+ "ReferenceDeviceTextLayout::ReferenceDeviceTextLayout: a reference device which has map mode PIXEL?!" );
+
+ m_rTargetDevice.SetMapMode( aTargetMapMode );
+
+ // now that the Zoom is part of the map mode, reset the target device's font to the "unzoomed" version
+ Font aDrawFont( m_aUnzoomedPointFont );
+ aDrawFont.SetSize( m_rTargetDevice.LogicToLogic( aDrawFont.GetSize(), MAP_POINT, eTargetMapUnit ) );
+ _rTargetDevice.SetFont( aDrawFont );
+
+ // transfer font to the reference device
+ m_rReferenceDevice.Push( PUSH_FONT | PUSH_TEXTLAYOUTMODE );
+ Font aRefFont( m_aUnzoomedPointFont );
+ aRefFont.SetSize( OutputDevice::LogicToLogic(
+ aRefFont.GetSize(), MAP_POINT, m_rReferenceDevice.GetMapMode().GetMapUnit() ) );
+ m_rReferenceDevice.SetFont( aRefFont );
+ }
+
+ //--------------------------------------------------------------------
+ ReferenceDeviceTextLayout::~ReferenceDeviceTextLayout()
+ {
+ m_rReferenceDevice.Pop();
+ m_rTargetDevice.Pop();
+ }
+
+ //--------------------------------------------------------------------
+ namespace
+ {
+ //................................................................
+ bool lcl_normalizeLength( const XubString& _rText, const xub_StrLen _nStartIndex, xub_StrLen& _io_nLength )
+ {
+ xub_StrLen nTextLength = _rText.Len();
+ if ( _nStartIndex > nTextLength )
+ return false;
+ if ( _nStartIndex + _io_nLength > nTextLength )
+ _io_nLength = nTextLength - _nStartIndex;
+ return true;
+ }
+ }
+
+ //--------------------------------------------------------------------
+ long ReferenceDeviceTextLayout::GetTextArray( const XubString& _rText, sal_Int32* _pDXAry, xub_StrLen _nStartIndex,
+ xub_StrLen _nLength ) const
+ {
+ if ( !lcl_normalizeLength( _rText, _nStartIndex, _nLength ) )
+ return 0;
+
+ // retrieve the character widths from the reference device
+ long nTextWidth = m_rReferenceDevice.GetTextArray( _rText, _pDXAry, _nStartIndex, _nLength );
+#if OSL_DEBUG_LEVEL > 1
+ if ( _pDXAry )
+ {
+ ::rtl::OStringBuffer aTrace;
+ aTrace.append( "ReferenceDeviceTextLayout::GetTextArray( " );
+ aTrace.append( ::rtl::OUStringToOString( _rText, RTL_TEXTENCODING_UTF8 ) );
+ aTrace.append( " ): " );
+ aTrace.append( nTextWidth );
+ aTrace.append( " = ( " );
+ for ( size_t i=0; i<_nLength; )
+ {
+ aTrace.append( _pDXAry[i] );
+ if ( ++i < _nLength )
+ aTrace.append( ", " );
+ }
+ aTrace.append( ")" );
+ OSL_TRACE( aTrace.makeStringAndClear().getStr() );
+ }
+#endif
+ return nTextWidth;
+ }
+
+ //--------------------------------------------------------------------
+ long ReferenceDeviceTextLayout::GetTextWidth( const XubString& _rText, xub_StrLen _nStartIndex, xub_StrLen _nLength ) const
+ {
+ return GetTextArray( _rText, NULL, _nStartIndex, _nLength );
+ }
+
+ //--------------------------------------------------------------------
+ void ReferenceDeviceTextLayout::DrawText( const Point& _rStartPoint, const XubString& _rText, xub_StrLen _nStartIndex, xub_StrLen _nLength, MetricVector* _pVector, String* _pDisplayText )
+ {
+ if ( !lcl_normalizeLength( _rText, _nStartIndex, _nLength ) )
+ return;
+
+ if ( _pVector && _pDisplayText )
+ {
+ MetricVector aGlyphBounds;
+ m_rReferenceDevice.GetGlyphBoundRects( _rStartPoint, _rText, _nStartIndex, _nLength, _nStartIndex, aGlyphBounds );
+ ::std::copy(
+ aGlyphBounds.begin(), aGlyphBounds.end(),
+ ::std::insert_iterator< MetricVector > ( *_pVector, _pVector->end() ) );
+ _pDisplayText->Append( _rText.Copy( _nStartIndex, _nLength ) );
+ return;
+ }
+
+ sal_Int32* pCharWidths = new sal_Int32[ _nLength ];
+ long nTextWidth = GetTextArray( _rText, pCharWidths, _nStartIndex, _nLength );
+ m_rTargetDevice.DrawTextArray( _rStartPoint, _rText, pCharWidths, _nStartIndex, _nLength );
+ delete[] pCharWidths;
+
+ m_aCompleteTextRect.Union( Rectangle( _rStartPoint, Size( nTextWidth, m_rTargetDevice.GetTextHeight() ) ) );
+ }
+
+ //--------------------------------------------------------------------
+ bool ReferenceDeviceTextLayout::GetCaretPositions( const XubString& _rText, sal_Int32* _pCaretXArray,
+ xub_StrLen _nStartIndex, xub_StrLen _nLength ) const
+ {
+ if ( !lcl_normalizeLength( _rText, _nStartIndex, _nLength ) )
+ return false;
+
+ // retrieve the caret positions from the reference device
+ if ( !m_rReferenceDevice.GetCaretPositions( _rText, _pCaretXArray, _nStartIndex, _nLength ) )
+ return false;
+
+ return true;
+ }
+
+ //--------------------------------------------------------------------
+ xub_StrLen ReferenceDeviceTextLayout::GetTextBreak( const XubString& _rText, long _nMaxTextWidth, xub_StrLen _nStartIndex, xub_StrLen _nLength ) const
+ {
+ if ( !lcl_normalizeLength( _rText, _nStartIndex, _nLength ) )
+ return 0;
+
+ return m_rReferenceDevice.GetTextBreak( _rText, _nMaxTextWidth, _nStartIndex, _nLength );
+ }
+
+ //--------------------------------------------------------------------
+ bool ReferenceDeviceTextLayout::DecomposeTextRectAction() const
+ {
+ return true;
+ }
+
+ //--------------------------------------------------------------------
+ namespace
+ {
+ long zoomBy( long _value, const Fraction& _zoom )
+ {
+ double n = (double)_value;
+ n *= (double)_zoom.GetNumerator();
+ n /= (double)_zoom.GetDenominator();
+ return (long)::rtl::math::round( n );
+ }
+ long unzoomBy( long _value, const Fraction& _zoom )
+ {
+ return zoomBy( _value, Fraction( _zoom.GetDenominator(), _zoom.GetNumerator() ) );
+ }
+ }
+
+ //--------------------------------------------------------------------
+ Rectangle ReferenceDeviceTextLayout::DrawText( const Rectangle& _rRect, const XubString& _rText, USHORT _nStyle, MetricVector* _pVector, String* _pDisplayText )
+ {
+ if ( !_rText.Len() )
+ return Rectangle();
+
+ // determine text layout mode from the RTL-ness of the control whose text we render
+ ULONG nTextLayoutMode = m_bRTLEnabled ? TEXT_LAYOUT_BIDI_RTL : TEXT_LAYOUT_BIDI_LTR;
+ m_rReferenceDevice.SetLayoutMode( nTextLayoutMode );
+ m_rTargetDevice.SetLayoutMode( nTextLayoutMode | TEXT_LAYOUT_TEXTORIGIN_LEFT );
+ // TEXT_LAYOUT_TEXTORIGIN_LEFT is because when we do actually draw the text (in DrawText( Point, ... )), then
+ // our caller gives us the left border of the draw position, regardless of script type, text layout,
+ // and the like
+
+ // in our ctor, we set the map mode of the target device from pixel to twip, but our caller doesn't know this,
+ // but passed pixel coordinates. So, adjust the rect.
+ Rectangle aRect( m_rTargetDevice.PixelToLogic( _rRect ) );
+
+ onBeginDrawText();
+ m_rTargetDevice.DrawText( aRect, _rText, _nStyle, _pVector, _pDisplayText, this );
+ Rectangle aTextRect = onEndDrawText();
+
+ if ( aTextRect.IsEmpty() && !aRect.IsEmpty() )
+ {
+ // this happens for instance if we're in a PaintToDevice call, where only a MetaFile is recorded,
+ // but no actual painting happens, so our "DrawText( Point, ... )" is never called
+ // In this case, calculate the rect from what OutputDevice::GetTextRect would give us. This has
+ // the disadvantage of less accuracy, compared with the approach to calculate the rect from the
+ // single "DrawText( Point, ... )" calls, since more intermediate arithmetics will translate
+ // from ref- to target-units.
+ aTextRect = m_rTargetDevice.GetTextRect( aRect, _rText, _nStyle, NULL, this );
+ }
+
+ // similar to above, the text rect now contains TWIPs (or whatever unit the ref device has), but the caller
+ // expects pixel coordinates
+ aTextRect = m_rTargetDevice.LogicToPixel( aTextRect );
+
+ // convert the metric vector
+ if ( _pVector )
+ {
+ for ( MetricVector::iterator charRect = _pVector->begin();
+ charRect != _pVector->end();
+ ++charRect
+ )
+ {
+ *charRect = m_rTargetDevice.LogicToPixel( *charRect );
+ }
+ }
+
+ return aTextRect;
+ }
+
+ //====================================================================
+ //= ControlTextRenderer
+ //====================================================================
+ //--------------------------------------------------------------------
+ ControlTextRenderer::ControlTextRenderer( const Control& _rControl, OutputDevice& _rTargetDevice, OutputDevice& _rReferenceDevice )
+ :m_pImpl( new ReferenceDeviceTextLayout( _rControl, _rTargetDevice, _rReferenceDevice ) )
+ {
+ }
+
+ //--------------------------------------------------------------------
+ ControlTextRenderer::~ControlTextRenderer()
+ {
+ }
+
+ //--------------------------------------------------------------------
+ Rectangle ControlTextRenderer::DrawText( const Rectangle& _rRect, const XubString& _rText, USHORT _nStyle,
+ MetricVector* _pVector, String* _pDisplayText )
+ {
+ return m_pImpl->DrawText( _rRect, _rText, _nStyle, _pVector, _pDisplayText );
+ }
+
+//........................................................................
+} // namespace vcl
+//........................................................................
diff --git a/vcl/source/glyphs/gcach_ftyp.cxx b/vcl/source/glyphs/gcach_ftyp.cxx
index 712c2334b35c..b92bea929c51 100644
--- a/vcl/source/glyphs/gcach_ftyp.cxx
+++ b/vcl/source/glyphs/gcach_ftyp.cxx
@@ -43,6 +43,7 @@
#include "tools/poly.hxx"
#include "basegfx/matrix/b2dhommatrix.hxx"
+#include <basegfx/matrix/b2dhommatrixtools.hxx>
#include "basegfx/polygon/b2dpolypolygon.hxx"
#include "osl/file.hxx"
@@ -135,7 +136,8 @@ static int nFTVERSION = 0;
static FT_Error (*pFTNewSize)(FT_Face,FT_Size*);
static FT_Error (*pFTActivateSize)(FT_Size);
static FT_Error (*pFTDoneSize)(FT_Size);
-static FT_Error (*pFTEmbolden)(FT_GlyphSlot);
+FT_Error (*pFTEmbolden)(FT_GlyphSlot);
+FT_Error (*pFTOblique)(FT_GlyphSlot);
static bool bEnableSizeFT = false;
struct EqStr{ bool operator()(const char* a, const char* b) const { return !strcmp(a,b); } };
@@ -472,6 +474,7 @@ FreetypeManager::FreetypeManager()
pFTActivateSize = (FT_Error(*)(FT_Size))(sal_IntPtr)dlsym( RTLD_DEFAULT, "FT_Activate_Size" );
pFTDoneSize = (FT_Error(*)(FT_Size))(sal_IntPtr)dlsym( RTLD_DEFAULT, "FT_Done_Size" );
pFTEmbolden = (FT_Error(*)(FT_GlyphSlot))(sal_IntPtr)dlsym( RTLD_DEFAULT, "FT_GlyphSlot_Embolden" );
+ pFTOblique = (FT_Error(*)(FT_GlyphSlot))(sal_IntPtr)dlsym( RTLD_DEFAULT, "FT_GlyphSlot_Oblique" );
bEnableSizeFT = (pFTNewSize!=NULL) && (pFTActivateSize!=NULL) && (pFTDoneSize!=NULL);
@@ -2280,9 +2283,7 @@ bool FreetypeServerFont::GetGlyphOutline( int nGlyphIndex,
// convert to basegfx polypolygon
// TODO: get rid of the intermediate tools polypolygon
rB2DPolyPoly = aToolPolyPolygon.getB2DPolyPolygon();
- ::basegfx::B2DHomMatrix aMatrix;
- aMatrix.scale( +1.0/(1<<6), -1.0/(1<<6) );
- rB2DPolyPoly.transform( aMatrix );
+ rB2DPolyPoly.transform(basegfx::tools::createScaleB2DHomMatrix( +1.0/(1<<6), -1.0/(1<<6) ));
return true;
}
@@ -2487,10 +2488,12 @@ bool FreetypeServerFont::ApplyGSUB( const ImplFontSelectData& rFSD )
{
const USHORT nGlyph0 = GetUShort( pCoverage+0 );
const USHORT nGlyph1 = GetUShort( pCoverage+2 );
- const USHORT nCovIdx = GetUShort( pCoverage+4 );
+ const USHORT nStartCoverageIndex = GetUShort( pCoverage+4 );
+ DBG_ASSERT( aSubstVector.size() == nStartCoverageIndex, "coverage index mismatch");
+ (void)nStartCoverageIndex;
pCoverage += 6;
for( USHORT j = nGlyph0; j <= nGlyph1; ++j )
- aSubstVector.push_back( GlyphSubst( j + nCovIdx, 0 ) );
+ aSubstVector.push_back( GlyphSubst( j, 0 ) );
}
}
break;
diff --git a/vcl/source/glyphs/glyphcache.cxx b/vcl/source/glyphs/glyphcache.cxx
index e3e840e40730..17e70c539254 100644
--- a/vcl/source/glyphs/glyphcache.cxx
+++ b/vcl/source/glyphs/glyphcache.cxx
@@ -79,9 +79,7 @@ GlyphCache::~GlyphCache()
// -----------------------------------------------------------------------
-#ifndef IRIX
inline
-#endif
size_t GlyphCache::IFSD_Hash::operator()( const ImplFontSelectData& rFontSelData ) const
{
// TODO: is it worth to improve this hash function?
diff --git a/vcl/source/glyphs/graphite_adaptors.cxx b/vcl/source/glyphs/graphite_adaptors.cxx
index 9b16318fdc40..34e2f5f5bbe3 100644
--- a/vcl/source/glyphs/graphite_adaptors.cxx
+++ b/vcl/source/glyphs/graphite_adaptors.cxx
@@ -71,6 +71,8 @@ namespace
typedef std::hash_map<long,bool> SilfMap;
SilfMap sSilfMap;
}
+extern FT_Error (*pFTEmbolden)(FT_GlyphSlot);
+extern FT_Error (*pFTOblique)(FT_GlyphSlot);
// class CharacterRenderProperties implentation.
//
@@ -303,11 +305,11 @@ void GraphiteFontAdaptor::getGlyphMetrics(gr::gid16 nGlyphId, gr::Rect & aBoundi
return;
}
// check whether we need synthetic bold/italic otherwise metric is wrong
- if (mrFont.NeedsArtificialBold())
- FT_GlyphSlot_Embolden(aFace->glyph);
+ if (mrFont.NeedsArtificialBold() && pFTEmbolden)
+ (*pFTEmbolden)(aFace->glyph);
- if (mrFont.NeedsArtificialItalic())
- FT_GlyphSlot_Oblique(aFace->glyph);
+ if (mrFont.NeedsArtificialItalic() && pFTOblique)
+ (*pFTOblique)(aFace->glyph);
const FT_Glyph_Metrics &gm = aFace->glyph->metrics;
diff --git a/vcl/source/glyphs/makefile.mk b/vcl/source/glyphs/makefile.mk
index 3e79cdc63da2..e43daaeac2ee 100644
--- a/vcl/source/glyphs/makefile.mk
+++ b/vcl/source/glyphs/makefile.mk
@@ -42,9 +42,6 @@ ENABLE_EXCEPTIONS=true
.INCLUDE : $(PRJ)$/util$/makefile2.pmk
CFLAGS+= $(FREETYPE_CFLAGS)
-.IF "$(USE_FT_EMBOLDEN)" == "YES"
-CFLAGS+=-DUSE_FT_EMBOLDEN
-.ENDIF
# --- Files --------------------------------------------------------
diff --git a/vcl/source/window/accmgr.cxx b/vcl/source/window/accmgr.cxx
index 71373bbabee5..36064fc8bc6b 100644
--- a/vcl/source/window/accmgr.cxx
+++ b/vcl/source/window/accmgr.cxx
@@ -83,6 +83,23 @@ void ImplAccelManager::RemoveAccel( Accelerator* pAccel )
if ( !mpAccelList )
return;
+ //e.g. #i90599#. Someone starts typing a sequence in a dialog, but doesn't
+ //end it, and then closes the dialog, deleting the accelerators. So if
+ //we're removing an accelerator that a sub-accelerator which is in the
+ //sequence list, throw away the entire sequence
+ if ( mpSequenceList )
+ {
+ for (USHORT i = 0; i < pAccel->GetItemCount(); ++i)
+ {
+ Accelerator* pSubAccel = pAccel->GetAccel(pAccel->GetItemId(i));
+ if ( mpSequenceList->GetPos( pSubAccel ) != LIST_ENTRY_NOTFOUND )
+ {
+ EndSequence( true );
+ break;
+ }
+ }
+ }
+
// Raus damit
mpAccelList->Remove( pAccel );
}
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index 1fc2b9be703a..997e63d8b22e 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -453,6 +453,14 @@ Dialog::~Dialog()
// -----------------------------------------------------------------------
+IMPL_LINK( Dialog, ImplAsyncCloseHdl, void*, EMPTYARG )
+{
+ Close();
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
long Dialog::Notify( NotifyEvent& rNEvt )
{
// Zuerst Basisklasse rufen wegen TabSteuerung
@@ -468,7 +476,11 @@ long Dialog::Notify( NotifyEvent& rNEvt )
if ( (nKeyCode == KEY_ESCAPE) &&
((GetStyle() & WB_CLOSEABLE) || ImplGetCancelButton( this ) || ImplGetOKButton( this )) )
{
- Close();
+ // #i89505# for the benefit of slightly mentally challenged implementations
+ // like e.g. SfxModelessDialog which destroy themselves inside Close()
+ // post this Close asynchronous so we can leave our key handler before
+ // we get destroyed
+ PostUserEvent( LINK( this, Dialog, ImplAsyncCloseHdl ), this );
return TRUE;
}
}
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index ebd4475a80fc..c9e0c23e7f16 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -5136,15 +5136,23 @@ IMPL_LINK( MenuBarWindow, CloserHdl, PushButton*, EMPTYARG )
return 0;
if( aCloser.GetCurItemId() == IID_DOCUMENTCLOSE )
- return ((MenuBar*)pMenu)->GetCloserHdl().Call( pMenu );
- std::map<USHORT,AddButtonEntry>::iterator it = m_aAddButtons.find( aCloser.GetCurItemId() );
- if( it != m_aAddButtons.end() )
{
- MenuBar::MenuBarButtonCallbackArg aArg;
- aArg.nId = it->first;
- aArg.bHighlight = (aCloser.GetHighlightItemId() == it->first);
- aArg.pMenuBar = dynamic_cast<MenuBar*>(pMenu);
- return it->second.m_aSelectLink.Call( &aArg );
+ // #i106052# call close hdl asynchronously to ease handler implementation
+ // this avoids still being in the handler while the DecoToolBox already
+ // gets destroyed
+ Application::PostUserEvent( ((MenuBar*)pMenu)->GetCloserHdl(), pMenu );
+ }
+ else
+ {
+ std::map<USHORT,AddButtonEntry>::iterator it = m_aAddButtons.find( aCloser.GetCurItemId() );
+ if( it != m_aAddButtons.end() )
+ {
+ MenuBar::MenuBarButtonCallbackArg aArg;
+ aArg.nId = it->first;
+ aArg.bHighlight = (aCloser.GetHighlightItemId() == it->first);
+ aArg.pMenuBar = dynamic_cast<MenuBar*>(pMenu);
+ return it->second.m_aSelectLink.Call( &aArg );
+ }
}
return 0;
}
diff --git a/vcl/source/window/status.cxx b/vcl/source/window/status.cxx
index 4aaef6a707b1..ede3bcc107aa 100644
--- a/vcl/source/window/status.cxx
+++ b/vcl/source/window/status.cxx
@@ -1320,8 +1320,13 @@ void StatusBar::SetItemText( USHORT nItemId, const XubString& rText )
// adjust item width - see also DataChanged()
long nFudge = GetTextHeight()/4;
long nWidth = GetTextWidth( pItem->maText ) + nFudge;
- if( nWidth > pItem->mnWidth + STATUSBAR_OFFSET )
+ if( (nWidth > pItem->mnWidth + STATUSBAR_OFFSET) ||
+ ((nWidth < pItem->mnWidth) && (mnDX - STATUSBAR_OFFSET) < mnItemsWidth ))
+ {
pItem->mnWidth = nWidth + STATUSBAR_OFFSET;
+ ImplFormat();
+ Invalidate();
+ }
// Item neu Zeichen, wenn StatusBar sichtbar und
// UpdateMode gesetzt ist
diff --git a/vcl/source/window/syswin.cxx b/vcl/source/window/syswin.cxx
index f3ce8b2d05ea..2d99fbb20b65 100644
--- a/vcl/source/window/syswin.cxx
+++ b/vcl/source/window/syswin.cxx
@@ -62,6 +62,7 @@ public:
TaskPaneList* mpTaskPaneList;
Size maMaxOutSize;
+ rtl::OUString maRepresentedURL;
};
SystemWindow::ImplData::ImplData()
@@ -277,6 +278,29 @@ void SystemWindow::SetZLevel( BYTE nLevel )
// -----------------------------------------------------------------------
+void SystemWindow::SetRepresentedURL( const rtl::OUString& i_rURL )
+{
+ bool bChanged = (i_rURL != mpImplData->maRepresentedURL);
+ mpImplData->maRepresentedURL = i_rURL;
+ if ( !mbSysChild && bChanged )
+ {
+ const Window* pWindow = this;
+ while ( pWindow->mpWindowImpl->mpBorderWindow )
+ pWindow = pWindow->mpWindowImpl->mpBorderWindow;
+
+ if ( pWindow->mpWindowImpl->mbFrame )
+ pWindow->mpWindowImpl->mpFrame->SetRepresentedURL( i_rURL );
+ }
+}
+// -----------------------------------------------------------------------
+
+const rtl::OUString& SystemWindow::GetRepresentedURL() const
+{
+ return mpImplData->maRepresentedURL;
+}
+
+// -----------------------------------------------------------------------
+
void SystemWindow::SetIcon( USHORT nIcon )
{
if ( mnIcon == nIcon )
diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx
index 9ec86fab20de..ecc335420f18 100644
--- a/vcl/source/window/toolbox2.cxx
+++ b/vcl/source/window/toolbox2.cxx
@@ -1002,6 +1002,9 @@ const Size& ToolBox::GetDefaultImageSize() const
case STYLE_SYMBOLS_CRYSTAL:
aLargeButtonSize = Size( TB_LARGEIMAGESIZE_CRYSTAL, TB_LARGEIMAGESIZE_CRYSTAL );
break;
+ case STYLE_SYMBOLS_OXYGEN:
+ aLargeButtonSize = Size( TB_LARGEIMAGESIZE_OXYGEN, TB_LARGEIMAGESIZE_OXYGEN );
+ break;
default:
aLargeButtonSize = Size( TB_LARGEIMAGESIZE, TB_LARGEIMAGESIZE );
}
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 63bf407ce49f..bcf86c749673 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -68,7 +68,7 @@
#include "vcl/wall.hxx"
#include "vcl/gradient.hxx"
#include "vcl/toolbox.h"
-#include "vcl/fontcfg.hxx"
+#include "unotools/fontcfg.hxx"
#include "vcl/sysdata.hxx"
#include "vcl/sallayout.hxx"
#include "vcl/button.hxx" // Button::GetStandardText
@@ -310,7 +310,7 @@ void Window::ImplUpdateGlobalSettings( AllSettings& rSettings, BOOL bCallHdl )
if ( !bUseSystemFont )
{
ImplInitFontList();
- String aConfigFont = vcl::DefaultFontConfiguration::get()->getUserInterfaceFont( rSettings.GetUILocale() );
+ String aConfigFont = utl::DefaultFontConfiguration::get()->getUserInterfaceFont( rSettings.GetUILocale() );
xub_StrLen nIndex = 0;
while( nIndex != STRING_NOTFOUND )
{
@@ -9752,6 +9752,8 @@ void Window::ImplPaintToDevice( OutputDevice* i_pTargetOutDev, const Point& i_rP
EnableOutput();
DBG_ASSERT( GetMapMode().GetMapUnit() == MAP_PIXEL, "MapMode must be PIXEL based" );
+ if ( GetMapMode().GetMapUnit() != MAP_PIXEL )
+ return;
// preserve graphicsstate
Push();
diff --git a/vcl/source/window/wrkwin.cxx b/vcl/source/window/wrkwin.cxx
index 0c19c5c5ee4f..c1f80bb061e5 100644
--- a/vcl/source/window/wrkwin.cxx
+++ b/vcl/source/window/wrkwin.cxx
@@ -310,7 +310,7 @@ void WorkWindow::Maximize( BOOL bMaximize )
ImplSetFrameState( bMaximize ? SAL_FRAMESTATE_MAXIMIZED : SAL_FRAMESTATE_NORMAL );
}
-BOOL WorkWindow::IsMaximized()
+BOOL WorkWindow::IsMaximized() const
{
BOOL bRet = FALSE;