diff options
Diffstat (limited to 'vcl/source/gdi/print3.cxx')
-rw-r--r--[-rwxr-xr-x] | vcl/source/gdi/print3.cxx | 56 |
1 files changed, 27 insertions, 29 deletions
diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx index 3bc47e6cf8fb..0e99923ccc0f 100755..100644 --- a/vcl/source/gdi/print3.cxx +++ b/vcl/source/gdi/print3.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -50,8 +51,8 @@ #include "com/sun/star/awt/Size.hpp" #include "comphelper/processfactory.hxx" -#include <hash_map> -#include <hash_set> +#include <boost/unordered_map.hpp> +#include <boost/unordered_set.hpp> using namespace com::sun::star; using namespace com::sun::star::uno; @@ -76,13 +77,8 @@ class ImplPageCache { if( maCacheRanking[0] != nLastHit ) { - bool bMove = false; for( sal_Int32 i = nCacheSize-1; i > 0; i-- ) - { - if( maCacheRanking[i] == nLastHit ) - bMove = true; maCacheRanking[i] = maCacheRanking[i-1]; - } maCacheRanking[0] = nLastHit; } } @@ -149,9 +145,9 @@ public: ControlDependency() : mnDependsOnEntry( -1 ) {} }; - typedef std::hash_map< rtl::OUString, size_t, rtl::OUStringHash > PropertyToIndexMap; - typedef std::hash_map< rtl::OUString, ControlDependency, rtl::OUStringHash > ControlDependencyMap; - typedef std::hash_map< rtl::OUString, Sequence< sal_Bool >, rtl::OUStringHash > ChoiceDisableMap; + typedef boost::unordered_map< rtl::OUString, size_t, rtl::OUStringHash > PropertyToIndexMap; + typedef boost::unordered_map< rtl::OUString, ControlDependency, rtl::OUStringHash > ControlDependencyMap; + typedef boost::unordered_map< rtl::OUString, Sequence< sal_Bool >, rtl::OUStringHash > ChoiceDisableMap; boost::shared_ptr<Printer> mpPrinter; Sequence< PropertyValue > maUIOptions; @@ -775,21 +771,21 @@ PrinterController::PageSize vcl::ImplPrinterControllerData::modifyJobSetup( cons sal_Int32 nPaperBin = mnDefaultPaperBin; for( sal_Int32 nProperty = 0, nPropertyCount = i_rProps.getLength(); nProperty < nPropertyCount; ++nProperty ) { - if( i_rProps[ nProperty ].Name.equalsAscii( "PreferredPageSize" ) ) + if( i_rProps[ nProperty ].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "PreferredPageSize" ) ) ) { i_rProps[ nProperty ].Value >>= aSetSize; } - else if( i_rProps[ nProperty ].Name.equalsAscii( "PageSize" ) ) + else if( i_rProps[ nProperty ].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "PageSize" ) ) ) { i_rProps[ nProperty ].Value >>= aIsSize; } - else if( i_rProps[ nProperty ].Name.equalsAscii( "PageIncludesNonprintableArea" ) ) + else if( i_rProps[ nProperty ].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "PageIncludesNonprintableArea" ) ) ) { sal_Bool bVal = sal_False; i_rProps[ nProperty ].Value >>= bVal; aPageSize.bFullPaper = static_cast<bool>(bVal); } - else if( i_rProps[ nProperty ].Name.equalsAscii( "PrinterPaperTray" ) ) + else if( i_rProps[ nProperty ].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "PrinterPaperTray" ) ) ) { sal_Int32 nBin = -1; i_rProps[ nProperty ].Value >>= nBin; @@ -1235,7 +1231,7 @@ bool PrinterController::getReversePrint() const Sequence< PropertyValue > PrinterController::getJobProperties( const Sequence< PropertyValue >& i_rMergeList ) const { - std::hash_set< rtl::OUString, rtl::OUStringHash > aMergeSet; + boost::unordered_set< rtl::OUString, rtl::OUStringHash > aMergeSet; size_t nResultLen = size_t(i_rMergeList.getLength()) + mpImplData->maUIProperties.size() + 3; for( int i = 0; i < i_rMergeList.getLength(); i++ ) aMergeSet.insert( i_rMergeList[i].Name ); @@ -1284,14 +1280,14 @@ const Sequence< beans::PropertyValue >& PrinterController::getUIOptions() const beans::PropertyValue* PrinterController::getValue( const rtl::OUString& i_rProperty ) { - std::hash_map< rtl::OUString, size_t, rtl::OUStringHash >::const_iterator it = + boost::unordered_map< rtl::OUString, size_t, rtl::OUStringHash >::const_iterator it = mpImplData->maPropertyToIndex.find( i_rProperty ); return it != mpImplData->maPropertyToIndex.end() ? &mpImplData->maUIProperties[it->second] : NULL; } const beans::PropertyValue* PrinterController::getValue( const rtl::OUString& i_rProperty ) const { - std::hash_map< rtl::OUString, size_t, rtl::OUStringHash >::const_iterator it = + boost::unordered_map< rtl::OUString, size_t, rtl::OUStringHash >::const_iterator it = mpImplData->maPropertyToIndex.find( i_rProperty ); return it != mpImplData->maPropertyToIndex.end() ? &mpImplData->maUIProperties[it->second] : NULL; } @@ -1321,7 +1317,7 @@ void PrinterController::setValue( const rtl::OUString& i_rName, const Any& i_rVa void PrinterController::setValue( const beans::PropertyValue& i_rValue ) { - std::hash_map< rtl::OUString, size_t, rtl::OUStringHash >::const_iterator it = + boost::unordered_map< rtl::OUString, size_t, rtl::OUStringHash >::const_iterator it = mpImplData->maPropertyToIndex.find( i_rValue.Name ); if( it != mpImplData->maPropertyToIndex.end() ) mpImplData->maUIProperties[ it->second ] = i_rValue; @@ -1352,7 +1348,7 @@ void PrinterController::setUIOptions( const Sequence< beans::PropertyValue >& i_ for( int n = 0; n < aOptProp.getLength(); n++ ) { const beans::PropertyValue& rEntry( aOptProp[ n ] ); - if( rEntry.Name.equalsAscii( "Property" ) ) + if( rEntry.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Property" ) ) ) { PropertyValue aVal; rEntry.Value >>= aVal; @@ -1362,17 +1358,17 @@ void PrinterController::setUIOptions( const Sequence< beans::PropertyValue >& i_ aPropName = aVal.Name; bHaveProperty = true; } - else if( rEntry.Name.equalsAscii( "Enabled" ) ) + else if( rEntry.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Enabled" ) ) ) { sal_Bool bValue = sal_True; rEntry.Value >>= bValue; bIsEnabled = bValue; } - else if( rEntry.Name.equalsAscii( "DependsOnName" ) ) + else if( rEntry.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "DependsOnName" ) ) ) { rEntry.Value >>= aDep.maDependsOnName; } - else if( rEntry.Name.equalsAscii( "DependsOnEntry" ) ) + else if( rEntry.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "DependsOnEntry" ) ) ) { rEntry.Value >>= aDep.mnDependsOnEntry; } @@ -1400,7 +1396,7 @@ void PrinterController::setUIOptions( const Sequence< beans::PropertyValue >& i_ void PrinterController::enableUIOption( const rtl::OUString& i_rProperty, bool i_bEnable ) { - std::hash_map< rtl::OUString, size_t, rtl::OUStringHash >::const_iterator it = + boost::unordered_map< rtl::OUString, size_t, rtl::OUStringHash >::const_iterator it = mpImplData->maPropertyToIndex.find( i_rProperty ); if( it != mpImplData->maPropertyToIndex.end() ) { @@ -1418,7 +1414,7 @@ void PrinterController::enableUIOption( const rtl::OUString& i_rProperty, bool i bool PrinterController::isUIOptionEnabled( const rtl::OUString& i_rProperty ) const { bool bEnabled = false; - std::hash_map< rtl::OUString, size_t, rtl::OUStringHash >::const_iterator prop_it = + boost::unordered_map< rtl::OUString, size_t, rtl::OUStringHash >::const_iterator prop_it = mpImplData->maPropertyToIndex.find( i_rProperty ); if( prop_it != mpImplData->maPropertyToIndex.end() ) { @@ -1458,7 +1454,7 @@ bool PrinterController::isUIOptionEnabled( const rtl::OUString& i_rProperty ) co else { // if the type does not match something is awry - OSL_ENSURE( 0, "strange type in control dependency" ); + OSL_FAIL( "strange type in control dependency" ); bEnabled = false; } } @@ -1526,7 +1522,7 @@ rtl::OUString PrinterController::makeEnabled( const rtl::OUString& i_rProperty ) else { // if the type does not match something is awry - OSL_ENSURE( 0, "strange type in control dependency" ); + OSL_FAIL( "strange type in control dependency" ); } } } @@ -1639,7 +1635,7 @@ sal_Bool PrinterController::getBoolProperty( const rtl::OUString& i_rProperty, s Any PrinterOptionsHelper::getValue( const rtl::OUString& i_rPropertyName ) const { Any aRet; - std::hash_map< rtl::OUString, Any, rtl::OUStringHash >::const_iterator it = + boost::unordered_map< rtl::OUString, Any, rtl::OUStringHash >::const_iterator it = m_aPropertyMap.find( i_rPropertyName ); if( it != m_aPropertyMap.end() ) aRet = it->second; @@ -1654,7 +1650,7 @@ void PrinterOptionsHelper::setValue( const rtl::OUString& i_rPropertyName, const bool PrinterOptionsHelper::hasProperty( const rtl::OUString& i_rPropertyName ) const { Any aRet; - std::hash_map< rtl::OUString, Any, rtl::OUStringHash >::const_iterator it = + boost::unordered_map< rtl::OUString, Any, rtl::OUStringHash >::const_iterator it = m_aPropertyMap.find( i_rPropertyName ); return it != m_aPropertyMap.end(); } @@ -1694,7 +1690,7 @@ bool PrinterOptionsHelper::processProperties( const Sequence< PropertyValue >& i for( sal_Int32 i = 0; i < nElements; i++ ) { bool bElementChanged = false; - std::hash_map< rtl::OUString, Any, rtl::OUStringHash >::iterator it = + boost::unordered_map< rtl::OUString, Any, rtl::OUStringHash >::iterator it = m_aPropertyMap.find( pVals[ i ].Name ); if( it != m_aPropertyMap.end() ) { @@ -1945,3 +1941,5 @@ Any PrinterOptionsHelper::getEditControlOpt( const rtl::OUString& i_rTitle, i_rControlOptions ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |