diff options
author | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2011-06-19 12:47:44 +0200 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2011-06-19 12:47:44 +0200 |
commit | 941020379b1ea1ec7c564c21e68ea1674cda7683 (patch) | |
tree | 40fcaf109d6d585bcdc0faf7ea6c0812b3cc9a39 /tools/source/generic | |
parent | 0692507dcc62e94c7af88388961db1d7d12d6dbd (diff) | |
parent | 0d2916e03ea51529e15995830a1a8c36bd72e442 (diff) |
Merge branch 'master' into feature/gnumake4
Conflicts:
basebmp/prj/d.lst
basebmp/test/basictest.cxx
basebmp/test/makefile.mk
basegfx/inc/basegfx/basegfxdllapi.h
basegfx/inc/basegfx/tools/debugplotter.hxx
basegfx/inc/basegfx/tuple/b2ituple.hxx
basegfx/prj/d.lst
basegfx/source/numeric/makefile.mk
basegfx/source/polygon/makefile.mk
basegfx/source/range/makefile.mk
basegfx/source/raster/makefile.mk
basegfx/source/tuple/makefile.mk
basegfx/source/vector/makefile.mk
basegfx/test/basegfx1d.cxx
basegfx/test/makefile.mk
basegfx/util/makefile.mk
canvas/Library_canvasfactory.mk
canvas/Module_canvas.mk
canvas/prj/build.lst
canvas/prj/d.lst
canvas/source/cairo/cairo_canvashelper_texturefill.cxx
canvas/source/cairo/makefile.mk
canvas/source/tools/makefile.mk
comphelper/qa/string/makefile.mk
cppcanvas/Module_cppcanvas.mk
cppcanvas/inc/cppcanvas/cppcanvasdllapi.h
cppcanvas/prj/build.lst
cppcanvas/prj/d.lst
cppcanvas/source/mtfrenderer/makefile.mk
cppcanvas/util/makefile.mk
i18npool/source/search/makefile.mk
regexp/Library_regexp.mk
regexp/prj/d.lst
sax/CppunitTest_sax.mk
sax/Library_sax.mk
sax/prj/d.lst
sax/qa/cppunit/test_converter.cxx
sax/source/expatwrap/attrlistimpl.hxx
sax/util/makefile.mk
svtools/Library_svt.mk
tools/Executable_sspretty.mk
ucbhelper/prj/d.lst
ucbhelper/source/provider/configureucb.cxx
ucbhelper/source/provider/provconf.cxx
ucbhelper/util/makefile.mk
unotools/Library_utl.mk
unotools/Module_unotools.mk
unotools/Package_inc.mk
unotools/prj/build.lst
vcl/Library_desktop_detector.mk
vcl/Library_vcl.mk
vcl/Library_vclplug_gtk.mk
vcl/aqua/source/gdi/salprn.cxx
vcl/inc/aqua/saldata.hxx
vcl/unx/generic/gdi/salgdi3.cxx
Diffstat (limited to 'tools/source/generic')
-rw-r--r-- | tools/source/generic/b3dtrans.cxx | 9 | ||||
-rw-r--r-- | tools/source/generic/bigint.cxx | 105 | ||||
-rw-r--r-- | tools/source/generic/color.cxx | 77 | ||||
-rw-r--r-- | tools/source/generic/config.cxx | 35 | ||||
-rw-r--r-- | tools/source/generic/fract.cxx | 79 | ||||
-rw-r--r-- | tools/source/generic/gen.cxx | 31 | ||||
-rw-r--r-- | tools/source/generic/line.cxx | 3 | ||||
-rw-r--r-- | tools/source/generic/link.cxx | 7 | ||||
-rw-r--r-- | tools/source/generic/poly.cxx | 12 | ||||
-rw-r--r-- | tools/source/generic/poly2.cxx | 3 | ||||
-rw-r--r-- | tools/source/generic/svborder.cxx | 2 | ||||
-rw-r--r-- | tools/source/generic/svlibrary.cxx | 261 | ||||
-rw-r--r-- | tools/source/generic/toolsin.cxx | 8 |
13 files changed, 270 insertions, 362 deletions
diff --git a/tools/source/generic/b3dtrans.cxx b/tools/source/generic/b3dtrans.cxx index 9ed887457035..4af4b3edcb85 100644 --- a/tools/source/generic/b3dtrans.cxx +++ b/tools/source/generic/b3dtrans.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. @@ -111,18 +112,18 @@ void B3dTransformationSet::Ortho(basegfx::B3DHomMatrix& rTarget, double fLeft, d { if(fNear == fFar) { - DBG_ERROR("Near and far clipping plane in Ortho definition are identical"); + OSL_FAIL("Near and far clipping plane in Ortho definition are identical"); fFar = fNear + 1.0; } if(fLeft == fRight) { - DBG_ERROR("Left and right in Ortho definition are identical"); + OSL_FAIL("Left and right in Ortho definition are identical"); fLeft -= 1.0; fRight += 1.0; } if(fTop == fBottom) { - DBG_ERROR("Top and bottom in Ortho definition are identical"); + OSL_FAIL("Top and bottom in Ortho definition are identical"); fBottom -= 1.0; fTop += 1.0; } @@ -1012,3 +1013,5 @@ sal_Bool B3dCamera::CalcFocalLength() } // eof + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/generic/bigint.cxx b/tools/source/generic/bigint.cxx index 027105767063..4392e56d5e44 100644 --- a/tools/source/generic/bigint.cxx +++ b/tools/source/generic/bigint.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. @@ -77,12 +78,7 @@ void BigInt::MakeBigInt( const BigInt& rVal ) nNum[0] = (sal_uInt16)(nTmp & 0xffffL); nNum[1] = (sal_uInt16)(nTmp >> 16); -#ifndef _WIN16 if ( nTmp & 0xffff0000L ) -#else - long l = 0xffff0000L; - if ( nTmp & l ) -#endif nLen = 2; else nLen = 1; @@ -529,35 +525,7 @@ BigInt::BigInt( const BigInt& rBigInt ) // ----------------------------------------------------------------------- -BigInt::BigInt( const ByteString& rString ) -{ - bIsSet = sal_True; - bIsNeg = sal_False; - bIsBig = sal_False; - nVal = 0; - - sal_Bool bNeg = sal_False; - const sal_Char* p = rString.GetBuffer(); - if ( *p == '-' ) - { - bNeg = sal_True; - p++; - } - while( *p >= '0' && *p <= '9' ) - { - *this *= 10; - *this += *p - '0'; - p++; - } - if ( bIsBig ) - bIsNeg = bNeg; - else if( bNeg ) - nVal = -nVal; -} - -// ----------------------------------------------------------------------- - -BigInt::BigInt( const UniString& rString ) +BigInt::BigInt( const String& rString ) { bIsSet = sal_True; bIsNeg = sal_False; @@ -690,55 +658,12 @@ BigInt::operator double() const // ----------------------------------------------------------------------- -ByteString BigInt::GetByteString() const -{ - ByteString aString; - - if ( !bIsBig ) - aString = ByteString::CreateFromInt32( nVal ); - else - { - BigInt aTmp( *this ); - BigInt a1000000000( 1000000000L ); - aTmp.Abs(); - - do - { - BigInt a = aTmp; - a %= a1000000000; - aTmp /= a1000000000; - - ByteString aStr = aString; - if ( a.nVal < 100000000L ) - { // leading 0s - aString = ByteString::CreateFromInt32( a.nVal + 1000000000L ); - aString.Erase( 0, 1 ); - } - else - aString = ByteString::CreateFromInt32( a.nVal ); - aString += aStr; - } - while( aTmp.bIsBig ); - - ByteString aStr = aString; - if ( bIsNeg ) - aString = ByteString::CreateFromInt32( -aTmp.nVal ); - else - aString = ByteString::CreateFromInt32( aTmp.nVal ); - aString += aStr; - } - - return aString; -} - -// ----------------------------------------------------------------------- - -UniString BigInt::GetString() const +String BigInt::GetString() const { - UniString aString; + String aString; if ( !bIsBig ) - aString = UniString::CreateFromInt32( nVal ); + aString = String::CreateFromInt32( nVal ); else { BigInt aTmp( *this ); @@ -751,23 +676,23 @@ UniString BigInt::GetString() const a %= a1000000000; aTmp /= a1000000000; - UniString aStr = aString; + String aStr = aString; if ( a.nVal < 100000000L ) { // leading 0s - aString = UniString::CreateFromInt32( a.nVal + 1000000000L ); + aString = String::CreateFromInt32( a.nVal + 1000000000L ); aString.Erase(0,1); } else - aString = UniString::CreateFromInt32( a.nVal ); + aString = String::CreateFromInt32( a.nVal ); aString += aStr; } while( aTmp.bIsBig ); - UniString aStr = aString; + String aStr = aString; if ( bIsNeg ) - aString = UniString::CreateFromInt32( -aTmp.nVal ); + aString = String::CreateFromInt32( -aTmp.nVal ); else - aString = UniString::CreateFromInt32( aTmp.nVal ); + aString = String::CreateFromInt32( aTmp.nVal ); aString += aStr; } @@ -875,7 +800,7 @@ BigInt& BigInt::operator/=( const BigInt& rVal ) { if ( rVal.nVal == 0 ) { - DBG_ERROR( "BigInt::operator/ --> divide by zero" ); + OSL_FAIL( "BigInt::operator/ --> divide by zero" ); return *this; } @@ -936,7 +861,7 @@ void BigInt::DivMod( const BigInt& rVal, BigInt& rMod ) { if ( rVal.nVal == 0 ) { - DBG_ERROR( "BigInt::operator/ --> divide by zero" ); + OSL_FAIL( "BigInt::operator/ --> divide by zero" ); return; } @@ -1005,7 +930,7 @@ BigInt& BigInt::operator%=( const BigInt& rVal ) { if ( rVal.nVal == 0 ) { - DBG_ERROR( "BigInt::operator/ --> divide by zero" ); + OSL_FAIL( "BigInt::operator/ --> divide by zero" ); return *this; } @@ -1139,3 +1064,5 @@ sal_Bool operator >(const BigInt& rVal1, const BigInt& rVal2 ) return rVal1.nVal > rVal2.nVal; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/generic/color.cxx b/tools/source/generic/color.cxx index ec325b9ca3d3..5560e631767a 100644 --- a/tools/source/generic/color.cxx +++ b/tools/source/generic/color.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. @@ -29,16 +30,13 @@ #include "precompiled_tools.hxx" #include <stdlib.h> -#include <vos/macros.hxx> #include <tools/color.hxx> #include <tools/debug.hxx> #include <tools/stream.hxx> #include <tools/rc.hxx> #include <tools/rcid.h> #include <tools/resid.hxx> -#ifndef _SV_RC_H #include <tools/rc.h> -#endif // ----------- // - Inlines - @@ -90,18 +88,18 @@ sal_uInt8 Color::GetColorError( const Color& rCompareColor ) const void Color::IncreaseLuminance( sal_uInt8 cLumInc ) { - SetRed( (sal_uInt8) VOS_BOUND( (long) COLORDATA_RED( mnColor ) + cLumInc, 0L, 255L ) ); - SetGreen( (sal_uInt8) VOS_BOUND( (long) COLORDATA_GREEN( mnColor ) + cLumInc, 0L, 255L ) ); - SetBlue( (sal_uInt8) VOS_BOUND( (long) COLORDATA_BLUE( mnColor ) + cLumInc, 0L, 255L ) ); + SetRed( (sal_uInt8) SAL_BOUND( (long) COLORDATA_RED( mnColor ) + cLumInc, 0L, 255L ) ); + SetGreen( (sal_uInt8) SAL_BOUND( (long) COLORDATA_GREEN( mnColor ) + cLumInc, 0L, 255L ) ); + SetBlue( (sal_uInt8) SAL_BOUND( (long) COLORDATA_BLUE( mnColor ) + cLumInc, 0L, 255L ) ); } // ----------------------------------------------------------------------- void Color::DecreaseLuminance( sal_uInt8 cLumDec ) { - SetRed( (sal_uInt8) VOS_BOUND( (long) COLORDATA_RED( mnColor ) - cLumDec, 0L, 255L ) ); - SetGreen( (sal_uInt8) VOS_BOUND( (long) COLORDATA_GREEN( mnColor ) - cLumDec, 0L, 255L ) ); - SetBlue( (sal_uInt8) VOS_BOUND( (long) COLORDATA_BLUE( mnColor ) - cLumDec, 0L, 255L ) ); + SetRed( (sal_uInt8) SAL_BOUND( (long) COLORDATA_RED( mnColor ) - cLumDec, 0L, 255L ) ); + SetGreen( (sal_uInt8) SAL_BOUND( (long) COLORDATA_GREEN( mnColor ) - cLumDec, 0L, 255L ) ); + SetBlue( (sal_uInt8) SAL_BOUND( (long) COLORDATA_BLUE( mnColor ) - cLumDec, 0L, 255L ) ); } // ----------------------------------------------------------------------- @@ -113,9 +111,9 @@ void Color::IncreaseContrast( sal_uInt8 cContInc ) const double fM = 128.0 / ( 128.0 - 0.4985 * cContInc ); const double fOff = 128.0 - fM * 128.0; - SetRed( (sal_uInt8) VOS_BOUND( _FRound( COLORDATA_RED( mnColor ) * fM + fOff ), 0L, 255L ) ); - SetGreen( (sal_uInt8) VOS_BOUND( _FRound( COLORDATA_GREEN( mnColor ) * fM + fOff ), 0L, 255L ) ); - SetBlue( (sal_uInt8) VOS_BOUND( _FRound( COLORDATA_BLUE( mnColor ) * fM + fOff ), 0L, 255L ) ); + SetRed( (sal_uInt8) SAL_BOUND( _FRound( COLORDATA_RED( mnColor ) * fM + fOff ), 0L, 255L ) ); + SetGreen( (sal_uInt8) SAL_BOUND( _FRound( COLORDATA_GREEN( mnColor ) * fM + fOff ), 0L, 255L ) ); + SetBlue( (sal_uInt8) SAL_BOUND( _FRound( COLORDATA_BLUE( mnColor ) * fM + fOff ), 0L, 255L ) ); } } @@ -128,9 +126,9 @@ void Color::DecreaseContrast( sal_uInt8 cContDec ) const double fM = ( 128.0 - 0.4985 * cContDec ) / 128.0; const double fOff = 128.0 - fM * 128.0; - SetRed( (sal_uInt8) VOS_BOUND( _FRound( COLORDATA_RED( mnColor ) * fM + fOff ), 0L, 255L ) ); - SetGreen( (sal_uInt8) VOS_BOUND( _FRound( COLORDATA_GREEN( mnColor ) * fM + fOff ), 0L, 255L ) ); - SetBlue( (sal_uInt8) VOS_BOUND( _FRound( COLORDATA_BLUE( mnColor ) * fM + fOff ), 0L, 255L ) ); + SetRed( (sal_uInt8) SAL_BOUND( _FRound( COLORDATA_RED( mnColor ) * fM + fOff ), 0L, 255L ) ); + SetGreen( (sal_uInt8) SAL_BOUND( _FRound( COLORDATA_GREEN( mnColor ) * fM + fOff ), 0L, 255L ) ); + SetBlue( (sal_uInt8) SAL_BOUND( _FRound( COLORDATA_BLUE( mnColor ) * fM + fOff ), 0L, 255L ) ); } } @@ -263,6 +261,53 @@ ColorData Color::HSBtoRGB( sal_uInt16 nHue, sal_uInt16 nSat, sal_uInt16 nBri ) // ----------------------------------------------------------------------- +// CMYK values from 0 to 1 +ColorData Color::CMYKtoRGB( double fCyan, double fMagenta, double fYellow, double fKey ) +{ + fCyan = (fCyan * ( 1.0 - fKey )) + fKey; + fMagenta = (fMagenta * ( 1.0 - fKey )) + fKey; + fYellow = (fYellow * ( 1.0 - fKey )) + fKey; + + sal_uInt8 nRed = static_cast< sal_uInt8 >( std::max( std::min( ( 1.0 - fCyan ) * 255.0, 255.0), 0.0 ) ); + sal_uInt8 nGreen = static_cast< sal_uInt8 >( std::max( std::min( ( 1.0 - fMagenta ) * 255.0, 255.0), 0.0 ) ); + sal_uInt8 nBlue = static_cast< sal_uInt8 >( std::max( std::min( ( 1.0 - fYellow ) * 255.0, 255.0), 0.0 ) ); + + return RGB_COLORDATA( nRed, nGreen, nBlue ); +} + +// ----------------------------------------------------------------------- + +// RGB values from 0 to 255 +// CMY results from 0 to 1 +void Color::RGBtoCMYK( double& fCyan, double& fMagenta, double& fYellow, double& fKey ) +{ + fCyan = 1 - ( GetRed() / 255.0 ); + fMagenta = 1 - ( GetGreen() / 255.0 ); + fYellow = 1 - ( GetBlue() / 255.0 ); + + //CMYK and CMY values from 0 to 1 + fKey = 1.0; + if( fCyan < fKey ) fKey = fCyan; + if( fMagenta < fKey ) fKey = fMagenta; + if( fYellow < fKey ) fKey = fYellow; + + if ( fKey == 1.0 ) + { + //Black + fCyan = 0.0; + fMagenta = 0.0; + fYellow = 0.0; + } + else + { + fCyan = ( fCyan - fKey ) / ( 1.0 - fKey ); + fMagenta = ( fMagenta - fKey ) / ( 1.0 - fKey ); + fYellow = ( fYellow - fKey ) / ( 1.0 - fKey ); + } +} + +// ----------------------------------------------------------------------- + SvStream& Color::Read( SvStream& rIStm, sal_Bool bNewFormat ) { if ( bNewFormat ) @@ -508,3 +553,5 @@ SvStream& operator<<( SvStream& rOStream, const Color& rColor ) return rOStream; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/generic/config.cxx b/tools/source/generic/config.cxx index ff919fcf2505..6c533459f2a7 100644 --- a/tools/source/generic/config.cxx +++ b/tools/source/generic/config.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. @@ -129,7 +130,7 @@ static sal_uInt8* ImplSysReadConfig( const XubString& rFileName, if( aFile.open( osl_File_OpenFlag_Read ) == ::osl::FileBase::E_None ) { - sal_uInt64 nPos = 0, nRead = 0; + sal_uInt64 nPos = 0; if( aFile.getSize( nPos ) == ::osl::FileBase::E_None ) { if (nPos > std::numeric_limits< std::size_t >::max()) { @@ -137,6 +138,7 @@ static sal_uInt8* ImplSysReadConfig( const XubString& rFileName, return 0; } pBuf = new sal_uInt8[static_cast< std::size_t >(nPos)]; + sal_uInt64 nRead = 0; if( aFile.read( pBuf, nPos, nRead ) == ::osl::FileBase::E_None && nRead == nPos ) { //skip the byte-order-mark 0xEF 0xBB 0xBF, if it was UTF8 files @@ -216,20 +218,20 @@ static String ImplMakeConfigName( const XubString* pFileName, if ( pFileName ) { #ifdef UNX - aFileName = ::rtl::OUString::createFromAscii( "." ); + aFileName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "." )); aFileName += *pFileName; - aFileName += ::rtl::OUString::createFromAscii( "rc" ); + aFileName += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "rc" )); #else aFileName = *pFileName; - aFileName += ::rtl::OUString::createFromAscii( ".ini" ); + aFileName += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".ini" )); #endif } else { #ifdef UNX - aFileName = ::rtl::OUString::createFromAscii( ".sversionrc" ); + aFileName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".sversionrc" )); #else - aFileName = ::rtl::OUString::createFromAscii( "sversion.ini" ); + aFileName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "sversion.ini" )); #endif } @@ -248,7 +250,7 @@ static String ImplMakeConfigName( const XubString* pFileName, } ::rtl::OUString aName( aPathName ); - aName += ::rtl::OUString::createFromAscii( "/" ); + aName += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/" )); aName += aFileName; return aName; @@ -633,7 +635,7 @@ static void ImplWriteConfig( ImplConfigData* pData ) { if ( pData->mnTimeStamp != ImplSysGetConfigTimeStamp( pData->maFileName ) ) { - DBG_ERROR1( "Config overwrites modified configfile:\n %s", ByteString( pData->maFileName, RTL_TEXTENCODING_UTF8 ).GetBuffer() ); + OSL_TRACE( "Config overwrites modified configfile:\n %s", ByteString( pData->maFileName, RTL_TEXTENCODING_UTF8 ).GetBuffer() ); } } #endif @@ -777,7 +779,7 @@ Config::Config() mbPersistence = sal_True; #ifdef DBG_UTIL - DBG_TRACE( "Config::Config()" ); + OSL_TRACE( "Config::Config()" ); #endif } @@ -797,7 +799,7 @@ Config::Config( const XubString& rFileName ) ByteString aTraceStr( "Config::Config( " ); aTraceStr += ByteString( maFileName, RTL_TEXTENCODING_UTF8 ); aTraceStr += " )"; - DBG_TRACE( aTraceStr.GetBuffer() ); + OSL_TRACE( "%s", aTraceStr.GetBuffer() ); #endif } @@ -806,7 +808,7 @@ Config::Config( const XubString& rFileName ) Config::~Config() { #ifdef DBG_UTIL - DBG_TRACE( "Config::~Config()" ); + OSL_TRACE( "Config::~Config()" ); #endif Flush(); @@ -998,7 +1000,7 @@ ByteString Config::ReadKey( const ByteString& rKey, const ByteString& rDefault ) aTraceStr += GetGroup(); aTraceStr += " in "; aTraceStr += ByteString( maFileName, RTL_TEXTENCODING_UTF8 ); - DBG_TRACE( aTraceStr.GetBuffer() ); + OSL_TRACE( "%s", aTraceStr.GetBuffer() ); #endif // Config-Daten evt. updaten @@ -1035,7 +1037,7 @@ void Config::WriteKey( const ByteString& rKey, const ByteString& rStr ) aTraceStr += GetGroup(); aTraceStr += " in "; aTraceStr += ByteString( maFileName, RTL_TEXTENCODING_UTF8 ); - DBG_TRACE( aTraceStr.GetBuffer() ); + OSL_TRACE( "%s", aTraceStr.GetBuffer() ); DBG_ASSERTWARNING( rStr != ReadKey( rKey ), "Config::WriteKey() with the same Value" ); #endif @@ -1156,7 +1158,7 @@ sal_uInt16 Config::GetKeyCount() const aTraceStr += GetGroup(); aTraceStr += " in "; aTraceStr += ByteString( maFileName, RTL_TEXTENCODING_UTF8 ); - DBG_TRACE( aTraceStr.GetBuffer() ); + OSL_TRACE( "%s", aTraceStr.GetBuffer() ); #endif // Config-Daten evt. updaten @@ -1192,7 +1194,7 @@ ByteString Config::GetKeyName( sal_uInt16 nKey ) const aTraceStr += GetGroup(); aTraceStr += " in "; aTraceStr += ByteString( maFileName, RTL_TEXTENCODING_UTF8 ); - DBG_TRACE( aTraceStr.GetBuffer() ); + OSL_TRACE( "%s", aTraceStr.GetBuffer() ); #endif // Key suchen und Name zurueckgeben @@ -1227,7 +1229,7 @@ ByteString Config::ReadKey( sal_uInt16 nKey ) const aTraceStr += GetGroup(); aTraceStr += " in "; aTraceStr += ByteString( maFileName, RTL_TEXTENCODING_UTF8 ); - DBG_TRACE( aTraceStr.GetBuffer() ); + OSL_TRACE( "%s", aTraceStr.GetBuffer() ); #endif // Key suchen und Value zurueckgeben @@ -1302,3 +1304,4 @@ LineEnd Config::GetLineEnd() const return mpData->meLineEnd; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/generic/fract.cxx b/tools/source/generic/fract.cxx index 8481fef32e05..104662b4ff7b 100644 --- a/tools/source/generic/fract.cxx +++ b/tools/source/generic/fract.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. @@ -28,9 +29,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_tools.hxx" -#ifndef _LIMITS_H #include <limits.h> -#endif #include <tools/debug.hxx> #include <tools/fract.hxx> #include <tools/stream.hxx> @@ -44,15 +43,13 @@ |* Beschreibung Berechnet den groessten gemeinsamen Teiler von |* nVal1 und nVal2 |* Parameter long nVal1, long nVal2 -|* Ersterstellung DV 20.09.90 -|* Letzte Aenderung DV 21.12.92 |* *************************************************************************/ // Die Funktion GetGGT berechnet den groessten gemeinsamen Teiler der // beiden als Parameter uebergebenen Werte nVal1 und nVal2 nach dem // Algorithmus von Euklid. Hat einer der beiden Parameter den Wert 0 oder -// 1, so wird als Ergebnis der Wert 1 zurckgegeben. Da der Algorithmus +// 1, so wird als Ergebnis der Wert 1 zur�ckgegeben. Da der Algorithmus // nur mit positiven Zahlen arbeitet, werden die beiden Parameter // entsprechend umgewandelt. // Zum Algorithmus: die beiden Parameter werden solange ducheinander @@ -129,10 +126,6 @@ static void Reduce( BigInt &rVal1, BigInt &rVal2 ) |* |* Fraction::Fraction() |* -|* Beschreibung FRACT.SDW -|* Ersterstellung WP 07.03.97 -|* Letzte Aenderung -|* *************************************************************************/ Fraction::Fraction( long nN1, long nN2, long nD1, long nD2 ) @@ -178,10 +171,6 @@ Fraction::Fraction( long nN1, long nN2, long nD1, long nD2 ) |* |* Fraction::Fraction() |* -|* Beschreibung FRACT.SDW -|* Ersterstellung DV 20.09.90 -|* Letzte Aenderung DV 21.12.92 -|* *************************************************************************/ // Zur Initialisierung eines Bruches wird nNum dem Zaehler und nDen dem @@ -210,10 +199,6 @@ Fraction::Fraction( long nNum, long nDen ) |* |* Fraction::Fraction() |* -|* Beschreibung FRACT.SDW -|* Ersterstellung DV 20.09.90 -|* Letzte Aenderung DV 21.12.92 -|* *************************************************************************/ // Wenn der Wert von dVal groesser ist als LONG_MAX, dann wird der Bruch @@ -252,10 +237,6 @@ Fraction::Fraction( double dVal ) |* |* Fraction::operator double() |* -|* Beschreibung FRACT.SDW -|* Ersterstellung DV 20.09.90 -|* Letzte Aenderung DV 14.05.91 -|* *************************************************************************/ Fraction::operator double() const @@ -270,10 +251,6 @@ Fraction::operator double() const |* |* Fraction::operator+=() |* -|* Beschreibung FRACT.SDW -|* Ersterstellung DV 20.09.90 -|* Letzte Aenderung DV 21.12.92 -|* *************************************************************************/ // Zunaechst werden die beiden Parameter auf ihre Gueltigkeit ueberprueft. @@ -326,10 +303,6 @@ Fraction& Fraction::operator += ( const Fraction& rVal ) |* |* Fraction::operator-=() |* -|* Beschreibung FRACT.SDW -|* Ersterstellung DV 20.09.90 -|* Letzte Aenderung DV 21.12.92 -|* *************************************************************************/ // Zunaechst werden die beiden Parameter auf ihre Gueltigkeit ueberprueft. @@ -382,10 +355,6 @@ Fraction& Fraction::operator -= ( const Fraction& rVal ) |* |* Fraction::operator*=() |* -|* Beschreibung FRACT.SDW -|* Ersterstellung DV 20.09.90 -|* Letzte Aenderung TH 19.08.92 -|* *************************************************************************/ // Zunaechst werden die beiden Parameter auf ihre Gueltigkeit ueberprueft. @@ -434,10 +403,6 @@ Fraction& Fraction::operator *= ( const Fraction& rVal ) |* |* Fraction::operator/=() |* -|* Beschreibung FRACT.SDW -|* Ersterstellung DV 20.09.90 -|* Letzte Aenderung DV 21.12.92 -|* *************************************************************************/ // Zunaechst werden die beiden Parameter auf ihre Gueltigkeit ueberprueft. @@ -494,10 +459,6 @@ Fraction& Fraction::operator /= ( const Fraction& rVal ) |* |* Fraction::ReduceInaccurate() |* -|* Beschreibung FRACT.SDW -|* Ersterstellung JOE 17.09.95 -|* Letzte Aenderung kendy 2007-06-13 -|* *************************************************************************/ @@ -608,7 +569,7 @@ void Fraction::ReduceInaccurate( unsigned nSignificantBits ) if ( !nMul || !nDiv ) { // Return without reduction - DBG_ERROR( "Oops, we reduced too much..." ); + OSL_FAIL( "Oops, we reduced too much..." ); return; } @@ -628,16 +589,12 @@ void Fraction::ReduceInaccurate( unsigned nSignificantBits ) |* |* Fraction::operator ==() |* -|* Beschreibung FRACT.SDW -|* Ersterstellung DV 20.09.90 -|* Letzte Aenderung TH 19.08.92 -|* *************************************************************************/ -sal_Bool operator == ( const Fraction& rVal1, const Fraction& rVal2 ) +bool operator == ( const Fraction& rVal1, const Fraction& rVal2 ) { if ( !rVal1.IsValid() || !rVal2.IsValid() ) - return sal_False; + return false; return rVal1.nNumerator == rVal2.nNumerator && rVal1.nDenominator == rVal2.nDenominator; @@ -647,10 +604,6 @@ sal_Bool operator == ( const Fraction& rVal1, const Fraction& rVal2 ) |* |* Fraction::operator <() |* -|* Beschreibung FRACT.SDW -|* Ersterstellung DV 20.09.90 -|* Letzte Aenderung DV 21.12.92 -|* *************************************************************************/ // Beide Operanden werden zunaechst auf ihre Gueltigkeit ueberprueft und @@ -660,10 +613,10 @@ sal_Bool operator == ( const Fraction& rVal1, const Fraction& rVal2 ) // und (c*b) zu vergleichen. Das Ergebnis dieses Vergleichs wird // zurueckgegeben. -sal_Bool operator < ( const Fraction& rVal1, const Fraction& rVal2 ) +bool operator < ( const Fraction& rVal1, const Fraction& rVal2 ) { if ( !rVal1.IsValid() || !rVal2.IsValid() ) - return sal_False; + return false; BigInt nN( rVal1.nNumerator ); nN *= BigInt( rVal2.nDenominator ); @@ -677,10 +630,6 @@ sal_Bool operator < ( const Fraction& rVal1, const Fraction& rVal2 ) |* |* Fraction::operator >() |* -|* Beschreibung FRACT.SDW -|* Ersterstellung DV 20.09.90 -|* Letzte Aenderung TH 19.08.92 -|* *************************************************************************/ // Beide Operanden werden zunaechst auf ihre Gueltigkeit ueberprueft und @@ -690,10 +639,10 @@ sal_Bool operator < ( const Fraction& rVal1, const Fraction& rVal2 ) // und (c*b) zu vergleichen. Das Ergebnis dieses Vergleichs wird // zurueckgegeben. -sal_Bool operator > ( const Fraction& rVal1, const Fraction& rVal2 ) +bool operator > ( const Fraction& rVal1, const Fraction& rVal2 ) { if ( !rVal1.IsValid() || !rVal2.IsValid() ) - return sal_False; + return false; BigInt nN( rVal1.nNumerator ); nN *= BigInt( rVal2.nDenominator ); @@ -707,10 +656,6 @@ sal_Bool operator > ( const Fraction& rVal1, const Fraction& rVal2 ) |* |* SvStream& operator>>( SvStream& rIStream, Fraction& rFract ) |* -|* Beschreibung FRACT.SDW -|* Ersterstellung MM 08.01.96 -|* Letzte Aenderung MM 08.01.96 -|* *************************************************************************/ SvStream& operator >> ( SvStream& rIStream, Fraction& rFract ) { @@ -723,10 +668,6 @@ SvStream& operator >> ( SvStream& rIStream, Fraction& rFract ) |* |* SvStream& operator<<( SvStream& rIStream, Fraction& rFract ) |* -|* Beschreibung FRACT.SDW -|* Ersterstellung MM 08.01.96 -|* Letzte Aenderung MM 08.01.96 -|* *************************************************************************/ SvStream& operator << ( SvStream& rOStream, const Fraction& rFract ) { @@ -734,3 +675,5 @@ SvStream& operator << ( SvStream& rOStream, const Fraction& rFract ) rOStream << rFract.nDenominator; return rOStream; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/generic/gen.cxx b/tools/source/generic/gen.cxx index e4ef3ed58c82..8d72b1ab4cff 100644 --- a/tools/source/generic/gen.cxx +++ b/tools/source/generic/gen.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. @@ -193,10 +194,6 @@ SvStream& operator<<( SvStream& rOStream, const Pair& rPair ) |* |* Rectangle::SetSize() |* -|* Beschreibung GEN.SDW -|* Ersterstellung DV 29.10.91 -|* Letzte Aenderung MM 21.04.94 -|* *************************************************************************/ void Rectangle::SetSize( const Size& rSize ) @@ -220,10 +217,6 @@ void Rectangle::SetSize( const Size& rSize ) |* |* Rectangle::Union() |* -|* Beschreibung GEN.SDW -|* Ersterstellung TH 20.10.92 -|* Letzte Aenderung MM 21.04.94 -|* *************************************************************************/ Rectangle& Rectangle::Union( const Rectangle& rRect ) @@ -248,10 +241,6 @@ Rectangle& Rectangle::Union( const Rectangle& rRect ) |* |* Rectangle::Intersection() |* -|* Beschreibung GEN.SDW -|* Ersterstellung TH 20.10.92 -|* Letzte Aenderung MM 21.04.94 -|* *************************************************************************/ Rectangle& Rectangle::Intersection( const Rectangle& rRect ) @@ -286,10 +275,6 @@ Rectangle& Rectangle::Intersection( const Rectangle& rRect ) |* |* Rectangle::Justify() |* -|* Beschreibung GEN.SDW -|* Ersterstellung DV 07.03.91 -|* Letzte Aenderung DV 07.03.91 -|* *************************************************************************/ void Rectangle::Justify() @@ -317,10 +302,6 @@ void Rectangle::Justify() |* |* Rectangle::IsInside() |* -|* Beschreibung GEN.SDW -|* Ersterstellung TH 19.03.90 -|* Letzte Aenderung MM 21.04.94 -|* *************************************************************************/ sal_Bool Rectangle::IsInside( const Point& rPoint ) const @@ -356,10 +337,6 @@ sal_Bool Rectangle::IsInside( const Point& rPoint ) const |* |* Rectangle::IsInside() |* -|* Beschreibung GEN.SDW -|* Ersterstellung TH 19.03.90 -|* Letzte Aenderung MM 21.04.94 -|* *************************************************************************/ sal_Bool Rectangle::IsInside( const Rectangle& rRect ) const @@ -374,10 +351,6 @@ sal_Bool Rectangle::IsInside( const Rectangle& rRect ) const |* |* Rectangle::IsOver() |* -|* Beschreibung GEN.SDW -|* Ersterstellung TH 19.03.90 -|* Letzte Aenderung MM 21.04.94 -|* *************************************************************************/ sal_Bool Rectangle::IsOver( const Rectangle& rRect ) const @@ -659,3 +632,5 @@ SvStream& operator<<( SvStream& rOStream, const Rectangle& rRect ) return rOStream; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/generic/line.cxx b/tools/source/generic/line.cxx index ea3b92ad9005..c8558b7bf949 100644 --- a/tools/source/generic/line.cxx +++ b/tools/source/generic/line.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. @@ -361,3 +362,5 @@ void Line::Enum( const Link& rEnumLink ) rEnumLink.Call( &aEnum ); } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/generic/link.cxx b/tools/source/generic/link.cxx index 2d485a5036c4..8b5615e964bd 100644 --- a/tools/source/generic/link.cxx +++ b/tools/source/generic/link.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. @@ -33,10 +34,6 @@ |* |* Link::operator==() |* -|* Beschreibung LINK.SDW -|* Ersterstellung AM 14.02.91 -|* Letzte Aenderung TH 07.11.95 -|* *************************************************************************/ sal_Bool Link::operator==( const Link& rLink ) const @@ -56,3 +53,5 @@ sal_Bool Link::operator==( const Link& rLink ) const else return sal_False; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/generic/poly.cxx b/tools/source/generic/poly.cxx index 73e89c73900f..ea1fbb3b8e14 100644 --- a/tools/source/generic/poly.cxx +++ b/tools/source/generic/poly.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. @@ -36,12 +37,8 @@ #include <tools/vcompat.hxx> #include <poly.h> #include <tools/line.hxx> -#ifndef _VECTOR2D_H #include <tools/vector2d.hxx> -#endif -#ifndef _POLY_HXX #include <tools/poly.hxx> -#endif #include <basegfx/polygon/b2dpolygon.hxx> #include <basegfx/point/b2dpoint.hxx> #include <basegfx/vector/b2dvector.hxx> @@ -2176,6 +2173,7 @@ basegfx::B2DPolygon Polygon::getB2DPolygon() const // assert invalid polygons OSL_ENSURE(bControlA == bControlB, "Polygon::getB2DPolygon: Invalid source polygon (!)"); + (void)bControlB; if(a < nCount) { @@ -2250,7 +2248,7 @@ Polygon::Polygon(const basegfx::B2DPolygon& rPolygon) // #127979# Reduce source point count hard to the limit of the tools Polygon if(nB2DLocalCount > ((0x0000ffff / 3L) - 1L)) { - DBG_ERROR("Polygon::Polygon: Too many points in given B2DPolygon, need to reduce hard to maximum of tools Polygon (!)"); + OSL_FAIL("Polygon::Polygon: Too many points in given B2DPolygon, need to reduce hard to maximum of tools Polygon (!)"); nB2DLocalCount = ((0x0000ffff / 3L) - 1L); } @@ -2344,7 +2342,7 @@ Polygon::Polygon(const basegfx::B2DPolygon& rPolygon) // #127979# Reduce source point count hard to the limit of the tools Polygon if(nB2DLocalCount > (0x0000ffff - 1L)) { - DBG_ERROR("Polygon::Polygon: Too many points in given B2DPolygon, need to reduce hard to maximum of tools Polygon (!)"); + OSL_FAIL("Polygon::Polygon: Too many points in given B2DPolygon, need to reduce hard to maximum of tools Polygon (!)"); nB2DLocalCount = (0x0000ffff - 1L); } @@ -2378,3 +2376,5 @@ Polygon::Polygon(const basegfx::B2DPolygon& rPolygon) } // eof + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/generic/poly2.cxx b/tools/source/generic/poly2.cxx index a995c66f9cf0..fac5cf8c2d20 100644 --- a/tools/source/generic/poly2.cxx +++ b/tools/source/generic/poly2.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. @@ -889,3 +890,5 @@ PolyPolygon::PolyPolygon(const basegfx::B2DPolyPolygon& rPolyPolygon) } // eof + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/generic/svborder.cxx b/tools/source/generic/svborder.cxx index fa302384745f..86df3dcffd82 100644 --- a/tools/source/generic/svborder.cxx +++ b/tools/source/generic/svborder.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. @@ -75,3 +76,4 @@ Rectangle & operator -= ( Rectangle & rRect, const SvBorder & rBorder ) return rRect; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/generic/svlibrary.cxx b/tools/source/generic/svlibrary.cxx index 6ebfd0086b5c..fdf714933342 100644 --- a/tools/source/generic/svlibrary.cxx +++ b/tools/source/generic/svlibrary.cxx @@ -1,129 +1,132 @@ -/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * 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_tools.hxx"
-
-#include <tools/svlibrary.hxx>
-#include <com/sun/star/uno/Sequence.hxx>
-#include <com/sun/star/uno/Reference.hxx>
-#include <com/sun/star/uno/XComponentContext.hpp>
-#include <com/sun/star/util/XMacroExpander.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <comphelper/processfactory.hxx>
-#include <tools/string.hxx>
-#include <rtl/uri.hxx>
-
-using namespace com::sun::star;
-
-static uno::Sequence< rtl::OUString > GetMultiPaths_Impl()
-{
- uno::Sequence< rtl::OUString > aRes;
- uno::Sequence< rtl::OUString > aInternalPaths;
- uno::Sequence< rtl::OUString > aUserPaths;
-
- bool bSuccess = true;
- uno::Reference< lang::XMultiServiceFactory > xMgr( comphelper::getProcessServiceFactory() );
- if (xMgr.is())
- {
- try
- {
- String aInternal;
- aInternal.AppendAscii("Libraries");
- String aUser;
- aUser.AppendAscii("Libraries");
- aInternal .AppendAscii( "_internal" );
- aUser .AppendAscii( "_user" );
-
- uno::Reference< beans::XPropertySet > xPathSettings( xMgr->createInstance(
- rtl::OUString::createFromAscii( "com.sun.star.util.PathSettings" ) ), uno::UNO_QUERY_THROW );
- xPathSettings->getPropertyValue( aInternal ) >>= aInternalPaths;
- xPathSettings->getPropertyValue( aUser ) >>= aUserPaths;
- }
- catch (uno::Exception &)
- {
- bSuccess = false;
- }
- }
- if (bSuccess)
- {
- sal_Int32 nMaxEntries = aInternalPaths.getLength() + aUserPaths.getLength();
- aRes.realloc( nMaxEntries );
- rtl::OUString *pRes = aRes.getArray();
- sal_Int32 nCount = 0; // number of actually added entries
- for (int i = 0; i < 2; ++i)
- {
- const uno::Sequence< rtl::OUString > &rPathSeq = i == 0 ? aUserPaths : aInternalPaths;
- const rtl::OUString *pPathSeq = rPathSeq.getConstArray();
- for (sal_Int32 k = 0; k < rPathSeq.getLength(); ++k)
- {
- const bool bAddUser = (&rPathSeq == &aUserPaths);
- const bool bAddInternal = (&rPathSeq == &aInternalPaths);
- if ((bAddUser || bAddInternal) && pPathSeq[k].getLength() > 0)
- pRes[ nCount++ ] = pPathSeq[k];
- }
- }
- aRes.realloc( nCount );
- }
-
- return aRes;
-}
-
-bool SvLibrary::LoadModule( osl::Module& rModule, const rtl::OUString& rLibName, ::oslGenericFunction baseModule, ::sal_Int32 mode )
-{
- static uno::Sequence < rtl::OUString > aPaths = GetMultiPaths_Impl();
- bool bLoaded = false;
-
- for (sal_Int32 n=0; n<aPaths.getLength(); n++)
- {
- rtl::OUString aMod = aPaths[n];
- if ( aPaths[n].indexOfAsciiL("vnd.sun.star.expand",19) == 0)
- {
- uno::Reference< uno::XComponentContext > xComponentContext = comphelper::getProcessComponentContext();
- uno::Reference< util::XMacroExpander > xMacroExpander;
- xComponentContext->getValueByName(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/singletons/com.sun.star.util.theMacroExpander") ) )
- >>= xMacroExpander;
-
- aMod = aMod.copy( sizeof("vnd.sun.star.expand:") -1 );
- aMod = ::rtl::Uri::decode( aMod, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 );
- aMod = xMacroExpander->expandMacros( aMod );
- }
-
- aMod += ::rtl::OUString( sal_Unicode('/') );
- aMod += rLibName;
- bLoaded = rModule.load( aMod, mode );
- if ( bLoaded )
- break;
- }
-
- if (!bLoaded )
- bLoaded = rModule.loadRelative( baseModule, rLibName, mode );
-
- return bLoaded;
-}
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * 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_tools.hxx" + +#include <tools/svlibrary.hxx> +#include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/util/XMacroExpander.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <comphelper/processfactory.hxx> +#include <tools/string.hxx> +#include <rtl/uri.hxx> + +using namespace com::sun::star; + +static uno::Sequence< rtl::OUString > GetMultiPaths_Impl() +{ + uno::Sequence< rtl::OUString > aRes; + uno::Sequence< rtl::OUString > aInternalPaths; + uno::Sequence< rtl::OUString > aUserPaths; + + bool bSuccess = true; + uno::Reference< lang::XMultiServiceFactory > xMgr( comphelper::getProcessServiceFactory() ); + if (xMgr.is()) + { + try + { + String aInternal; + aInternal.AppendAscii("Libraries"); + String aUser; + aUser.AppendAscii("Libraries"); + aInternal .AppendAscii( "_internal" ); + aUser .AppendAscii( "_user" ); + + uno::Reference< beans::XPropertySet > xPathSettings( xMgr->createInstance( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.PathSettings" )) ), uno::UNO_QUERY_THROW ); + xPathSettings->getPropertyValue( aInternal ) >>= aInternalPaths; + xPathSettings->getPropertyValue( aUser ) >>= aUserPaths; + } + catch (const uno::Exception &) + { + bSuccess = false; + } + } + if (bSuccess) + { + sal_Int32 nMaxEntries = aInternalPaths.getLength() + aUserPaths.getLength(); + aRes.realloc( nMaxEntries ); + rtl::OUString *pRes = aRes.getArray(); + sal_Int32 nCount = 0; // number of actually added entries + for (int i = 0; i < 2; ++i) + { + const uno::Sequence< rtl::OUString > &rPathSeq = i == 0 ? aUserPaths : aInternalPaths; + const rtl::OUString *pPathSeq = rPathSeq.getConstArray(); + for (sal_Int32 k = 0; k < rPathSeq.getLength(); ++k) + { + const bool bAddUser = (&rPathSeq == &aUserPaths); + const bool bAddInternal = (&rPathSeq == &aInternalPaths); + if ((bAddUser || bAddInternal) && pPathSeq[k].getLength() > 0) + pRes[ nCount++ ] = pPathSeq[k]; + } + } + aRes.realloc( nCount ); + } + + return aRes; +} + +bool SvLibrary::LoadModule( osl::Module& rModule, const rtl::OUString& rLibName, ::oslGenericFunction baseModule, ::sal_Int32 mode ) +{ + static uno::Sequence < rtl::OUString > aPaths = GetMultiPaths_Impl(); + bool bLoaded = false; + + for (sal_Int32 n=0; n<aPaths.getLength(); n++) + { + rtl::OUString aMod = aPaths[n]; + if ( aPaths[n].indexOfAsciiL("vnd.sun.star.expand",19) == 0) + { + uno::Reference< uno::XComponentContext > xComponentContext = comphelper::getProcessComponentContext(); + uno::Reference< util::XMacroExpander > xMacroExpander; + xComponentContext->getValueByName( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/singletons/com.sun.star.util.theMacroExpander") ) ) + >>= xMacroExpander; + + aMod = aMod.copy( sizeof("vnd.sun.star.expand:") -1 ); + aMod = ::rtl::Uri::decode( aMod, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 ); + aMod = xMacroExpander->expandMacros( aMod ); + } + + aMod += ::rtl::OUString( sal_Unicode('/') ); + aMod += rLibName; + bLoaded = rModule.load( aMod, mode ); + if ( bLoaded ) + break; + } + + if (!bLoaded ) + bLoaded = rModule.loadRelative( baseModule, rLibName, mode ); + + return bLoaded; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/generic/toolsin.cxx b/tools/source/generic/toolsin.cxx index 50c9c0187b16..36ae30096f59 100644 --- a/tools/source/generic/toolsin.cxx +++ b/tools/source/generic/toolsin.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. @@ -35,7 +36,7 @@ #include <tools/debug.hxx> #include <toolsin.hxx> -#if defined WNT || defined OS2 +#if defined WNT #include <dll.hxx> #endif @@ -89,7 +90,6 @@ void GlobalDeInitTools() #if defined WNT ImpDeInitWinTools(); #endif -#ifdef OS2 - ImpDeInitOS2Tools(); -#endif } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |