diff options
author | Vladimir Glazunov <vg@openoffice.org> | 2009-12-15 12:29:03 +0100 |
---|---|---|
committer | Vladimir Glazunov <vg@openoffice.org> | 2009-12-15 12:29:03 +0100 |
commit | 6f76f6b590a755b82482184bd0fe4273dfbcbc46 (patch) | |
tree | 8fd60709e2e7bb68ef658a7229ac5f0ca8bca594 /vcl | |
parent | CWS-TOOLING: integrate CWS communitypatches320_DEV300 (diff) | |
parent | #i107554# protect against stack underflow (diff) | |
download | core-6f76f6b590a755b82482184bd0fe4273dfbcbc46.tar.gz core-6f76f6b590a755b82482184bd0fe4273dfbcbc46.zip |
CWS-TOOLING: integrate CWS ooo32gsl10_DEV300
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/gdi/pdfwriter_impl.cxx | 5 | ||||
-rw-r--r-- | vcl/unx/source/plugadapt/salplug.cxx | 58 |
2 files changed, 42 insertions, 21 deletions
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index d4bb54121f5b..4146f1764204 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -10332,12 +10332,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/unx/source/plugadapt/salplug.cxx b/vcl/unx/source/plugadapt/salplug.cxx index 14de25b13e4d..f1c63b8abee7 100644 --- a/vcl/unx/source/plugadapt/salplug.cxx +++ b/vcl/unx/source/plugadapt/salplug.cxx @@ -149,34 +149,53 @@ static const rtl::OUString& get_desktop_environment() return aRet; } -static const char* autodetect_plugin() +static SalInstance* autodetect_plugin() { + static const char* pKDEFallbackList[] = + { + "kde4", "kde", "gtk", "gen", 0 + }; + + static const char* pStandardFallbackList[] = + { + "gtk", "gen", 0 + }; + + static const char* pHeadlessFallbackList[] = + { + "svp", 0 + }; + const rtl::OUString& desktop( get_desktop_environment() ); - const char * pRet = "gen"; + const char ** pList = pStandardFallbackList; + int nListEntry = 0; // no server at all: dummy plugin if ( desktop.equalsAscii( desktop_strings[DESKTOP_NONE] ) ) - pRet = "svp"; + pList = pHeadlessFallbackList; else if ( desktop.equalsAscii( desktop_strings[DESKTOP_GNOME] ) ) - pRet = "gtk"; + pList = pStandardFallbackList; else if( desktop.equalsAscii( desktop_strings[DESKTOP_KDE] ) ) - pRet = "kde"; - else if( desktop.equalsAscii( desktop_strings[DESKTOP_KDE4] ) ) - pRet = "kde4"; - else { - // #i95296# use the much nicer looking gtk plugin - // on desktops that set gtk variables (e.g. XFCE) - static const char* pEnv = getenv( "GTK2_RC_FILES" ); - if( pEnv && *pEnv ) // check for existance and non emptiness - pRet = "gtk"; + pList = pKDEFallbackList; + nListEntry = 1; } + else if( desktop.equalsAscii( desktop_strings[DESKTOP_KDE4] ) ) + pList = pKDEFallbackList; -#if OSL_DEBUG_LEVEL > 1 - std::fprintf( stderr, "plugin autodetection: %s\n", pRet ); -#endif + SalInstance* pInst = NULL; + while( pList[nListEntry] && pInst == NULL ) + { + rtl::OUString aTry( rtl::OUString::createFromAscii( pList[nListEntry] ) ); + pInst = tryInstance( aTry ); + #if OSL_DEBUG_LEVEL > 1 + if( pInst ) + std::fprintf( stderr, "plugin autodetection: %s\n", pList[nListEntry] ); + #endif + nListEntry++; + } - return pRet; + return pInst; } static SalInstance* check_headless_plugin() @@ -202,10 +221,7 @@ SalInstance *CreateSalInstance() pInst = check_headless_plugin(); if( ! pInst && !(pUsePlugin && *pUsePlugin) ) - pUsePlugin = autodetect_plugin(); - - if( ! pInst && pUsePlugin && *pUsePlugin ) - pInst = tryInstance( OUString::createFromAscii( pUsePlugin ) ); + pInst = autodetect_plugin(); // fallback to gen if( ! pInst ) |