diff options
Diffstat (limited to 'vcl/source/helper')
-rw-r--r-- | vcl/source/helper/canvasbitmap.cxx | 48 | ||||
-rw-r--r-- | vcl/source/helper/canvastools.cxx | 20 | ||||
-rw-r--r-- | vcl/source/helper/lazydelete.cxx | 2 | ||||
-rw-r--r-- | vcl/source/helper/makefile.mk | 1 | ||||
-rw-r--r-- | vcl/source/helper/smartid.cxx | 267 | ||||
-rw-r--r-- | vcl/source/helper/strhelper.cxx | 16 | ||||
-rw-r--r-- | vcl/source/helper/threadex.cxx | 4 | ||||
-rw-r--r-- | vcl/source/helper/xconnection.cxx | 77 |
8 files changed, 85 insertions, 350 deletions
diff --git a/vcl/source/helper/canvasbitmap.cxx b/vcl/source/helper/canvasbitmap.cxx index fc15cc77dcce..3138c55b2bb5 100644 --- a/vcl/source/helper/canvasbitmap.cxx +++ b/vcl/source/helper/canvasbitmap.cxx @@ -66,7 +66,7 @@ namespace } } -void VclCanvasBitmap::setComponentInfo( ULONG redShift, ULONG greenShift, ULONG blueShift ) +void VclCanvasBitmap::setComponentInfo( sal_uLong redShift, sal_uLong greenShift, sal_uLong blueShift ) { // sort channels in increasing order of appearance in the pixel // (starting with the least significant bits) @@ -683,14 +683,14 @@ sal_Bool SAL_CALL VclCanvasBitmap::getIndex( uno::Sequence< double >& o_entry, s { SolarMutexGuard aGuard; - const USHORT nCount( m_pBmpAcc ? + const sal_uInt16 nCount( m_pBmpAcc ? (m_pBmpAcc->HasPalette() ? m_pBmpAcc->GetPaletteEntryCount() : 0 ) : 0 ); OSL_ENSURE(nIndex >= 0 && nIndex < nCount,"Palette index out of range"); if( nIndex < 0 || nIndex >= nCount ) throw lang::IndexOutOfBoundsException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Palette index out of range")), static_cast<rendering::XBitmapPalette*>(this)); - const BitmapColor aCol = m_pBmpAcc->GetPaletteColor(sal::static_int_cast<USHORT>(nIndex)); + const BitmapColor aCol = m_pBmpAcc->GetPaletteColor(sal::static_int_cast<sal_uInt16>(nIndex)); o_entry.realloc(3); double* pColor=o_entry.getArray(); pColor[0] = aCol.GetRed(); @@ -704,7 +704,7 @@ sal_Bool SAL_CALL VclCanvasBitmap::setIndex( const uno::Sequence< double >&, sal { SolarMutexGuard aGuard; - const USHORT nCount( m_pBmpAcc ? + const sal_uInt16 nCount( m_pBmpAcc ? (m_pBmpAcc->HasPalette() ? m_pBmpAcc->GetPaletteEntryCount() : 0 ) : 0 ); OSL_ENSURE(nIndex >= 0 && nIndex < nCount,"Palette index out of range"); @@ -788,7 +788,7 @@ uno::Sequence<rendering::RGBColor> SAL_CALL VclCanvasBitmap::convertToRGB( const for( sal_Size i=0; i<nLen; i+=nComponentsPerPixel ) { const BitmapColor aCol = m_pBmpAcc->GetPaletteColor( - sal::static_int_cast<USHORT>(deviceColor[i+m_nIndexIndex])); + sal::static_int_cast<sal_uInt16>(deviceColor[i+m_nIndexIndex])); // TODO(F3): Convert result to sRGB color space *pOut++ = rendering::RGBColor(toDoubleColor(aCol.GetRed()), @@ -837,7 +837,7 @@ uno::Sequence<rendering::ARGBColor> SAL_CALL VclCanvasBitmap::convertToARGB( con for( sal_Size i=0; i<nLen; i+=nComponentsPerPixel ) { const BitmapColor aCol = m_pBmpAcc->GetPaletteColor( - sal::static_int_cast<USHORT>(deviceColor[i+m_nIndexIndex])); + sal::static_int_cast<sal_uInt16>(deviceColor[i+m_nIndexIndex])); // TODO(F3): Convert result to sRGB color space const double nAlpha( m_nAlphaIndex != -1 ? 1.0 - deviceColor[i+m_nAlphaIndex] : 1.0 ); @@ -890,7 +890,7 @@ uno::Sequence<rendering::ARGBColor> SAL_CALL VclCanvasBitmap::convertToPARGB( co for( sal_Size i=0; i<nLen; i+=nComponentsPerPixel ) { const BitmapColor aCol = m_pBmpAcc->GetPaletteColor( - sal::static_int_cast<USHORT>(deviceColor[i+m_nIndexIndex])); + sal::static_int_cast<sal_uInt16>(deviceColor[i+m_nIndexIndex])); // TODO(F3): Convert result to sRGB color space const double nAlpha( m_nAlphaIndex != -1 ? 1.0 - deviceColor[i+m_nAlphaIndex] : 1.0 ); @@ -1086,7 +1086,7 @@ uno::Sequence<double> SAL_CALL VclCanvasBitmap::convertFromIntegerColorSpace( co for( sal_Size i=0; i<nLen; i+=nComponentsPerPixel ) { const BitmapColor aCol = m_pBmpAcc->GetPaletteColor( - sal::static_int_cast<USHORT>(deviceColor[i+m_nIndexIndex])); + sal::static_int_cast<sal_uInt16>(deviceColor[i+m_nIndexIndex])); // TODO(F3): Convert result to sRGB color space const double nAlpha( m_nAlphaIndex != -1 ? 1.0 - deviceColor[i+m_nAlphaIndex] : 1.0 ); @@ -1146,7 +1146,7 @@ uno::Sequence<rendering::RGBColor> SAL_CALL VclCanvasBitmap::convertIntegerToRGB { SolarMutexGuard aGuard; - const BYTE* pIn( reinterpret_cast<const BYTE*>(deviceColor.getConstArray()) ); + const sal_uInt8* pIn( reinterpret_cast<const sal_uInt8*>(deviceColor.getConstArray()) ); const sal_Size nLen( deviceColor.getLength() ); const sal_Int32 nNumColors((nLen*8 + m_nBitsPerOutputPixel-1)/m_nBitsPerOutputPixel); @@ -1182,7 +1182,7 @@ uno::Sequence<rendering::RGBColor> SAL_CALL VclCanvasBitmap::convertIntegerToRGB const BitmapColor aCol = m_bPalette ? m_pBmpAcc->GetPaletteColor( - sal::static_int_cast<USHORT>( + sal::static_int_cast<sal_uInt16>( m_pBmpAcc->GetPixelFromData( pIn, i ))) : m_pBmpAcc->GetPixelFromData(pIn, i); @@ -1201,7 +1201,7 @@ uno::Sequence<rendering::ARGBColor> SAL_CALL VclCanvasBitmap::convertIntegerToAR { SolarMutexGuard aGuard; - const BYTE* pIn( reinterpret_cast<const BYTE*>(deviceColor.getConstArray()) ); + const sal_uInt8* pIn( reinterpret_cast<const sal_uInt8*>(deviceColor.getConstArray()) ); const sal_Size nLen( deviceColor.getLength() ); const sal_Int32 nNumColors((nLen*8 + m_nBitsPerOutputPixel-1)/m_nBitsPerOutputPixel); @@ -1239,7 +1239,7 @@ uno::Sequence<rendering::ARGBColor> SAL_CALL VclCanvasBitmap::convertIntegerToAR const BitmapColor aCol = m_bPalette ? m_pBmpAcc->GetPaletteColor( - sal::static_int_cast<USHORT>( + sal::static_int_cast<sal_uInt16>( m_pBmpAcc->GetPixelFromData( pIn, i ))) : m_pBmpAcc->GetPixelFromData(pIn, i); @@ -1259,7 +1259,7 @@ uno::Sequence<rendering::ARGBColor> SAL_CALL VclCanvasBitmap::convertIntegerToPA { SolarMutexGuard aGuard; - const BYTE* pIn( reinterpret_cast<const BYTE*>(deviceColor.getConstArray()) ); + const sal_uInt8* pIn( reinterpret_cast<const sal_uInt8*>(deviceColor.getConstArray()) ); const sal_Size nLen( deviceColor.getLength() ); const sal_Int32 nNumColors((nLen*8 + m_nBitsPerOutputPixel-1)/m_nBitsPerOutputPixel); @@ -1298,7 +1298,7 @@ uno::Sequence<rendering::ARGBColor> SAL_CALL VclCanvasBitmap::convertIntegerToPA const BitmapColor aCol = m_bPalette ? m_pBmpAcc->GetPaletteColor( - sal::static_int_cast<USHORT>( + sal::static_int_cast<sal_uInt16>( m_pBmpAcc->GetPixelFromData( pIn, i ))) : m_pBmpAcc->GetPixelFromData(pIn, i); @@ -1322,7 +1322,7 @@ uno::Sequence< ::sal_Int8 > SAL_CALL VclCanvasBitmap::convertIntegerFromRGB( con const sal_Int32 nNumBytes((nLen*m_nBitsPerOutputPixel+7)/8); uno::Sequence< sal_Int8 > aRes(nNumBytes); - BYTE* pColors=reinterpret_cast<BYTE*>(aRes.getArray()); + sal_uInt8* pColors=reinterpret_cast<sal_uInt8*>(aRes.getArray()); if( m_aBmpEx.IsTransparent() ) { @@ -1335,12 +1335,12 @@ uno::Sequence< ::sal_Int8 > SAL_CALL VclCanvasBitmap::convertIntegerFromRGB( con const BitmapColor aCol2 = m_bPalette ? BitmapColor( - sal::static_int_cast<BYTE>(m_pBmpAcc->GetBestPaletteIndex( aCol ))) : + sal::static_int_cast<sal_uInt8>(m_pBmpAcc->GetBestPaletteIndex( aCol ))) : aCol; m_pBmpAcc->SetPixelOnData(pColors,0,aCol2); pColors += nNonAlphaBytes; - *pColors++ = BYTE(255); + *pColors++ = sal_uInt8(255); } } else @@ -1353,7 +1353,7 @@ uno::Sequence< ::sal_Int8 > SAL_CALL VclCanvasBitmap::convertIntegerFromRGB( con const BitmapColor aCol2 = m_bPalette ? BitmapColor( - sal::static_int_cast<BYTE>(m_pBmpAcc->GetBestPaletteIndex( aCol ))) : + sal::static_int_cast<sal_uInt8>(m_pBmpAcc->GetBestPaletteIndex( aCol ))) : aCol; m_pBmpAcc->SetPixelOnData(pColors,i,aCol2); @@ -1371,7 +1371,7 @@ uno::Sequence< ::sal_Int8 > SAL_CALL VclCanvasBitmap::convertIntegerFromARGB( co const sal_Int32 nNumBytes((nLen*m_nBitsPerOutputPixel+7)/8); uno::Sequence< sal_Int8 > aRes(nNumBytes); - BYTE* pColors=reinterpret_cast<BYTE*>(aRes.getArray()); + sal_uInt8* pColors=reinterpret_cast<sal_uInt8*>(aRes.getArray()); if( m_aBmpEx.IsTransparent() ) { @@ -1384,7 +1384,7 @@ uno::Sequence< ::sal_Int8 > SAL_CALL VclCanvasBitmap::convertIntegerFromARGB( co const BitmapColor aCol2 = m_bPalette ? BitmapColor( - sal::static_int_cast<BYTE>(m_pBmpAcc->GetBestPaletteIndex( aCol ))) : + sal::static_int_cast<sal_uInt8>(m_pBmpAcc->GetBestPaletteIndex( aCol ))) : aCol; m_pBmpAcc->SetPixelOnData(pColors,0,aCol2); @@ -1402,7 +1402,7 @@ uno::Sequence< ::sal_Int8 > SAL_CALL VclCanvasBitmap::convertIntegerFromARGB( co const BitmapColor aCol2 = m_bPalette ? BitmapColor( - sal::static_int_cast<BYTE>(m_pBmpAcc->GetBestPaletteIndex( aCol ))) : + sal::static_int_cast<sal_uInt8>(m_pBmpAcc->GetBestPaletteIndex( aCol ))) : aCol; m_pBmpAcc->SetPixelOnData(pColors,i,aCol2); @@ -1420,7 +1420,7 @@ uno::Sequence< ::sal_Int8 > SAL_CALL VclCanvasBitmap::convertIntegerFromPARGB( c const sal_Int32 nNumBytes((nLen*m_nBitsPerOutputPixel+7)/8); uno::Sequence< sal_Int8 > aRes(nNumBytes); - BYTE* pColors=reinterpret_cast<BYTE*>(aRes.getArray()); + sal_uInt8* pColors=reinterpret_cast<sal_uInt8*>(aRes.getArray()); if( m_aBmpEx.IsTransparent() ) { @@ -1434,7 +1434,7 @@ uno::Sequence< ::sal_Int8 > SAL_CALL VclCanvasBitmap::convertIntegerFromPARGB( c const BitmapColor aCol2 = m_bPalette ? BitmapColor( - sal::static_int_cast<BYTE>(m_pBmpAcc->GetBestPaletteIndex( aCol ))) : + sal::static_int_cast<sal_uInt8>(m_pBmpAcc->GetBestPaletteIndex( aCol ))) : aCol; m_pBmpAcc->SetPixelOnData(pColors,0,aCol2); @@ -1452,7 +1452,7 @@ uno::Sequence< ::sal_Int8 > SAL_CALL VclCanvasBitmap::convertIntegerFromPARGB( c const BitmapColor aCol2 = m_bPalette ? BitmapColor( - sal::static_int_cast<BYTE>(m_pBmpAcc->GetBestPaletteIndex( aCol ))) : + sal::static_int_cast<sal_uInt8>(m_pBmpAcc->GetBestPaletteIndex( aCol ))) : aCol; m_pBmpAcc->SetPixelOnData(pColors,i,aCol2); diff --git a/vcl/source/helper/canvastools.cxx b/vcl/source/helper/canvastools.cxx index 005d544b9e02..3bf73ca7588d 100644 --- a/vcl/source/helper/canvastools.cxx +++ b/vcl/source/helper/canvastools.cxx @@ -117,11 +117,11 @@ namespace vcl { RTL_LOGFILE_CONTEXT( aLog, "::vcl::unotools::polygonFromPoint2DSequence()" ); - const USHORT nCurrSize( sal::static_int_cast<USHORT>(points.getLength()) ); + const sal_uInt16 nCurrSize( sal::static_int_cast<sal_uInt16>(points.getLength()) ); ::Polygon aPoly( nCurrSize ); - USHORT nCurrPoint; + sal_uInt16 nCurrPoint; for( nCurrPoint=0; nCurrPoint<nCurrSize; ++nCurrPoint ) aPoly[nCurrPoint] = pointFromRealPoint2D( points[nCurrPoint] ); @@ -255,7 +255,7 @@ namespace vcl { const rendering::ARGBColor& rColor=aARGBColors[x]; rWriteAcc->SetPixel( aRect.Y1, x, - (BYTE)rWriteAcc->GetBestPaletteIndex( + (sal_uInt8)rWriteAcc->GetBestPaletteIndex( BitmapColor( toByteColor(rColor.Red), toByteColor(rColor.Green), toByteColor(rColor.Blue))) ); @@ -287,7 +287,7 @@ namespace vcl { const rendering::RGBColor& rColor=aRGBColors[x]; rWriteAcc->SetPixel( aRect.Y1, x, - (BYTE)rWriteAcc->GetBestPaletteIndex( + (sal_uInt8)rWriteAcc->GetBestPaletteIndex( BitmapColor( toByteColor(rColor.Red), toByteColor(rColor.Green), toByteColor(rColor.Blue))) ); @@ -385,8 +385,8 @@ namespace vcl else nDepth = 8; - const USHORT nPaletteEntries( - sal::static_int_cast<USHORT>( + const sal_uInt16 nPaletteEntries( + sal::static_int_cast<sal_uInt16>( std::min(sal_Int32(255), nEntryCount))); // copy palette entries @@ -395,7 +395,7 @@ namespace vcl uno::Reference<rendering::XColorSpace> xPalColorSpace( xPalette->getColorSpace() ); uno::Sequence<double> aPaletteEntry; - for( USHORT j=0; j<nPaletteEntries; ++j ) + for( sal_uInt16 j=0; j<nPaletteEntries; ++j ) { if( !xPalette->getIndex(aPaletteEntry,j) && nAlphaDepth == 0 ) @@ -423,14 +423,14 @@ namespace vcl ( nDepth <= 8 ) ? 8 : 24; ::Bitmap aBitmap( aPixelSize, - sal::static_int_cast<USHORT>(nDepth), + sal::static_int_cast<sal_uInt16>(nDepth), aLayout.Palette.is() ? &aPalette : NULL ); ::Bitmap aAlpha; if( nAlphaDepth ) aAlpha = ::Bitmap( aPixelSize, - sal::static_int_cast<USHORT>(nAlphaDepth), + sal::static_int_cast<sal_uInt16>(nAlphaDepth), &::Bitmap::GetGreyPalette( - sal::static_int_cast<USHORT>(1L << nAlphaDepth)) ); + sal::static_int_cast<sal_uInt16>(1L << nAlphaDepth)) ); { // limit scoped access ScopedBitmapWriteAccess pWriteAccess( aBitmap.AcquireWriteAccess(), diff --git a/vcl/source/helper/lazydelete.cxx b/vcl/source/helper/lazydelete.cxx index 398b8338884d..9173474af759 100644 --- a/vcl/source/helper/lazydelete.cxx +++ b/vcl/source/helper/lazydelete.cxx @@ -69,7 +69,7 @@ void LazyDelete::flush() // specialized is_less function for Window template<> bool LazyDeletor<Window>::is_less( Window* left, Window* right ) { - return (left != right && right->IsChild( left, TRUE )) ? true : false; + return (left != right && right->IsChild( left, sal_True )) ? true : false; } // specialized is_less function for Menu diff --git a/vcl/source/helper/makefile.mk b/vcl/source/helper/makefile.mk index e708bdec9eaa..1a417417dbe4 100644 --- a/vcl/source/helper/makefile.mk +++ b/vcl/source/helper/makefile.mk @@ -46,7 +46,6 @@ SLOFILES=\ $(SLO)$/canvastools.obj \ $(SLO)$/xconnection.obj \ $(SLO)$/threadex.obj \ - $(SLO)$/smartid.obj \ $(SLO)$/lazydelete.obj # --- Targets ------------------------------------------------------ diff --git a/vcl/source/helper/smartid.cxx b/vcl/source/helper/smartid.cxx deleted file mode 100644 index 41a4cbe814ea..000000000000 --- a/vcl/source/helper/smartid.cxx +++ /dev/null @@ -1,267 +0,0 @@ -/* -*- 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_vcl.hxx" -#include <vcl/smartid.hxx> - -struct ImplSmartIdData -{ - String aUId; - ULONG nUId; - BOOL bHasStringId; - BOOL bHasNumericId; -}; - - -ImplSmartIdData* SmartId::GetSmartIdData() -{ - if ( !mpData ) - { - mpData = new ImplSmartIdData; -// mpData->aUId = ""; - mpData->nUId = 0; - mpData->bHasStringId = FALSE; - mpData->bHasNumericId = FALSE; - } - return mpData; -} - - -SmartId::SmartId( const String& rId ) -: mpData( NULL ) -{ - GetSmartIdData()->aUId = rId; - GetSmartIdData()->bHasStringId = TRUE; -} - -SmartId::SmartId( ULONG nId ) -: mpData( NULL ) -{ - GetSmartIdData()->nUId = nId; - GetSmartIdData()->bHasNumericId = TRUE; -} - -SmartId::SmartId( const String& rId, ULONG nId ) -: mpData( NULL ) -{ - GetSmartIdData()->aUId = rId; - GetSmartIdData()->bHasStringId = TRUE; - GetSmartIdData()->nUId = nId; - GetSmartIdData()->bHasNumericId = TRUE; -} - -SmartId::SmartId() -: mpData( NULL ) -{} - -SmartId::SmartId( const SmartId& rId ) -: mpData( NULL ) -{ - if ( rId.mpData ) - { - GetSmartIdData(); - mpData->aUId = rId.mpData->aUId; - mpData->bHasStringId = rId.mpData->bHasStringId; - mpData->nUId = rId.mpData->nUId; - mpData->bHasNumericId = rId.mpData->bHasNumericId; - } -} - -SmartId& SmartId::operator = ( const SmartId& rId ) -{ - if ( rId.mpData ) - GetSmartIdData(); - else - { - delete mpData; - mpData = NULL; - } - if ( mpData && rId.mpData ) - { - mpData->aUId = rId.mpData->aUId; - mpData->bHasStringId = rId.mpData->bHasStringId; - mpData->nUId = rId.mpData->nUId; - mpData->bHasNumericId = rId.mpData->bHasNumericId; - } - return *this; -} - -SmartId::~SmartId() -{ - if ( mpData ) - delete mpData; -#ifdef DBG_UTIL - if ( mpData ) - mpData = (ImplSmartIdData*)0xDeadBeef; -#endif -} - -void SmartId::UpdateId( const SmartId& rId, SmartIdUpdateMode aMode ) -{ - // Check if ImplData is needed - if ( aMode != SMART_SET_SMART || ( rId.HasString() || rId.HasNumeric() ) ) - GetSmartIdData(); - - if ( aMode == SMART_SET_STR || aMode == SMART_SET_ALL || ( aMode == SMART_SET_SMART && rId.HasString() ) ) - { - GetSmartIdData()->aUId = rId.GetStr(); - GetSmartIdData()->bHasStringId = rId.HasString(); - } - if ( aMode == SMART_SET_NUM || aMode == SMART_SET_ALL || ( aMode == SMART_SET_SMART && rId.HasNumeric() ) ) - { - GetSmartIdData()->nUId = rId.GetNum(); - GetSmartIdData()->bHasNumericId = rId.HasNumeric(); - } - - // remove ImplData when no IDs are set. This is Important because Implementation of Equals() Matches and HasAny relies on it - if ( mpData && !mpData->bHasStringId && !mpData->bHasNumericId ) - { - delete mpData; - mpData = NULL; - } -} - -BOOL SmartId::HasNumeric() const -{ - if ( !mpData ) - return FALSE; - else - return mpData->bHasNumericId; -} - -BOOL SmartId::HasString() const -{ - if ( !mpData ) - return FALSE; - else - return mpData->bHasStringId; -} - -BOOL SmartId::HasAny() const -{ - return mpData != NULL; -} - -ULONG SmartId::GetNum() const -{ - if ( !mpData ) - return 0; - else - return mpData->nUId; -} - -String SmartId::GetStr() const -{ - if ( !mpData ) - return String(); - else - return mpData->aUId; -} - - -String SmartId::GetText() const // return String for UI usage -{ - String aRes; - if ( HasNumeric() ) - aRes = String::CreateFromInt64( GetNum() ); - if ( HasString() ) - { - if ( HasNumeric() ) - aRes.AppendAscii( "/" ); - aRes.Append( GetStr() ); - } - return aRes; -} - -BOOL SmartId::Matches( const String &rId )const -{ - if ( HasString() ) - return GetStr().EqualsIgnoreCaseAscii( rId ); - else - return FALSE; -} - -BOOL SmartId::Matches( const ULONG nId ) const -{ - if ( HasNumeric() ) - return GetNum() == nId; - else - return FALSE; -} - -/****************************************************************************** -If Both Ids have nither Strings nor Numbers they don't match -If both Ids have Strings the result of Matching these is returned. -Numbers are then Ignored. -Else Matching Numbers is attempted. -******************************************************************************/ -BOOL SmartId::Matches( const SmartId &rId ) const -{ - if ( !mpData || !rId.mpData ) - return FALSE; - else if ( HasString() && rId.HasString() ) - return Matches( rId.GetStr() ); - else - return rId.HasNumeric() && Matches( rId.GetNum() ); -} - -BOOL SmartId::Equals( const SmartId &rId ) const -{ - if ( mpData && rId.mpData ) - return mpData->aUId.EqualsIgnoreCaseAscii( rId.mpData->aUId ) - && mpData->bHasStringId == rId.mpData->bHasStringId - && mpData->nUId == rId.mpData->nUId - && mpData->bHasNumericId == rId.mpData->bHasNumericId; - else if ( !mpData && !rId.mpData ) - return TRUE; - else - return FALSE; -} - -BOOL SmartId::operator == ( const SmartId& rRight ) const -{ - return Equals( rRight ); -} - -BOOL SmartId::operator < ( const SmartId& rRight ) const -{ - if ( HasString() && rRight.HasString() && GetStr() != rRight.GetStr() ) - return GetStr() < rRight.GetStr(); - else if ( HasNumeric() && rRight.HasNumeric() && GetNum() != rRight.GetNum() ) - return GetNum() < rRight.GetNum(); - else - { // Sort Strings to Front - if ( HasString() ) - return rRight.HasString() && rRight.HasNumeric(); - else - return rRight.HasString() || (!HasNumeric() && rRight.HasNumeric()); - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/helper/strhelper.cxx b/vcl/source/helper/strhelper.cxx index 7009468a02ec..c8b5cc7fbf22 100644 --- a/vcl/source/helper/strhelper.cxx +++ b/vcl/source/helper/strhelper.cxx @@ -326,7 +326,7 @@ int GetCommandLineTokenCount( const ByteString& rLine ) return nTokenCount; } -String WhitespaceToSpace( const String& rLine, BOOL bProtect ) +String WhitespaceToSpace( const String& rLine, sal_Bool bProtect ) { int nLen = rLine.Len(); if( ! nLen ) @@ -358,11 +358,11 @@ String WhitespaceToSpace( const String& rLine, BOOL bProtect ) pRun++; } else if( bProtect && *pRun == '`' ) - CopyUntil( pLeap, pRun, '`', TRUE ); + CopyUntil( pLeap, pRun, '`', sal_True ); else if( bProtect && *pRun == '\'' ) - CopyUntil( pLeap, pRun, '\'', TRUE ); + CopyUntil( pLeap, pRun, '\'', sal_True ); else if( bProtect && *pRun == '"' ) - CopyUntil( pLeap, pRun, '"', TRUE ); + CopyUntil( pLeap, pRun, '"', sal_True ); else { *pLeap = *pRun; @@ -383,7 +383,7 @@ String WhitespaceToSpace( const String& rLine, BOOL bProtect ) return aRet; } -ByteString WhitespaceToSpace( const ByteString& rLine, BOOL bProtect ) +ByteString WhitespaceToSpace( const ByteString& rLine, sal_Bool bProtect ) { int nLen = rLine.Len(); if( ! nLen ) @@ -415,11 +415,11 @@ ByteString WhitespaceToSpace( const ByteString& rLine, BOOL bProtect ) pRun++; } else if( bProtect && *pRun == '`' ) - CopyUntil( pLeap, pRun, '`', TRUE ); + CopyUntil( pLeap, pRun, '`', sal_True ); else if( bProtect && *pRun == '\'' ) - CopyUntil( pLeap, pRun, '\'', TRUE ); + CopyUntil( pLeap, pRun, '\'', sal_True ); else if( bProtect && *pRun == '"' ) - CopyUntil( pLeap, pRun, '"', TRUE ); + CopyUntil( pLeap, pRun, '"', sal_True ); else { *pLeap = *pRun; diff --git a/vcl/source/helper/threadex.cxx b/vcl/source/helper/threadex.cxx index 85ccffd34b6c..ad351410e2c2 100644 --- a/vcl/source/helper/threadex.cxx +++ b/vcl/source/helper/threadex.cxx @@ -112,8 +112,8 @@ long SolarThreadExecutor::impl_execute( const TimeValue* _pTimeout ) { osl_resetCondition( m_aStart ); osl_resetCondition( m_aFinish ); - ULONG nSolarMutexCount = Application::ReleaseSolarMutex(); - ULONG nEvent = Application::PostUserEvent( LINK( this, SolarThreadExecutor, worker ) ); + sal_uLong nSolarMutexCount = Application::ReleaseSolarMutex(); + sal_uLong nEvent = Application::PostUserEvent( LINK( this, SolarThreadExecutor, worker ) ); if ( osl_cond_result_timeout == osl_waitCondition( m_aStart, _pTimeout ) ) { m_bTimeout = true; diff --git a/vcl/source/helper/xconnection.cxx b/vcl/source/helper/xconnection.cxx index 0d03348e7712..d6aa0429bcf3 100644 --- a/vcl/source/helper/xconnection.cxx +++ b/vcl/source/helper/xconnection.cxx @@ -30,11 +30,18 @@ #include "precompiled_vcl.hxx" #include "svsys.h" +#include "rtl/ref.hxx" #include "vcl/xconnection.hxx" #include "vcl/svdata.hxx" #include "vcl/salinst.hxx" #include "vcl/svapp.hxx" +namespace { + +namespace css = com::sun::star; + +} + using namespace osl; using namespace vcl; using namespace com::sun::star::uno; @@ -44,13 +51,9 @@ using ::rtl::OUString; DisplayConnection::DisplayConnection() { - ImplSVData* pSVData = ImplGetSVData(); - pSVData->mpDefInst->SetEventCallback( this, dispatchEvent ); - pSVData->mpDefInst->SetErrorEventCallback( this, dispatchErrorEvent ); - SalInstance::ConnectionIdentifierType eType; int nBytes; - void* pBytes = pSVData->mpDefInst->GetConnectionIdentifier( eType, nBytes ); + void* pBytes = ImplGetSVData()->mpDefInst->GetConnectionIdentifier( eType, nBytes ); switch( eType ) { case SalInstance::AsciiCString: @@ -63,39 +66,54 @@ DisplayConnection::DisplayConnection() } DisplayConnection::~DisplayConnection() +{} + +void DisplayConnection::start() +{ + ImplSVData* pSVData = ImplGetSVData(); + pSVData->mpDefInst->SetEventCallback( this ); +} + +void DisplayConnection::terminate() { ImplSVData* pSVData = ImplGetSVData(); if( pSVData ) { - pSVData->mpDefInst->SetEventCallback( NULL, NULL ); - pSVData->mpDefInst->SetErrorEventCallback( NULL, NULL ); + pSVData->mpDefInst->SetEventCallback( NULL ); } -} + SolarMutexReleaser aRel; + + MutexGuard aGuard( m_aMutex ); + Any aEvent; + std::list< css::uno::Reference< XEventHandler > > aLocalList( m_aHandlers ); + for( ::std::list< css::uno::Reference< XEventHandler > >::const_iterator it = aLocalList.begin(); it != aLocalList.end(); ++it ) + (*it)->handleEvent( aEvent ); +} -void SAL_CALL DisplayConnection::addEventHandler( const Any& /*window*/, const Reference< XEventHandler >& handler, sal_Int32 /*eventMask*/ ) throw() +void SAL_CALL DisplayConnection::addEventHandler( const Any& /*window*/, const css::uno::Reference< XEventHandler >& handler, sal_Int32 /*eventMask*/ ) throw() { MutexGuard aGuard( m_aMutex ); m_aHandlers.push_back( handler ); } -void SAL_CALL DisplayConnection::removeEventHandler( const Any& /*window*/, const Reference< XEventHandler >& handler ) throw() +void SAL_CALL DisplayConnection::removeEventHandler( const Any& /*window*/, const css::uno::Reference< XEventHandler >& handler ) throw() { MutexGuard aGuard( m_aMutex ); m_aHandlers.remove( handler ); } -void SAL_CALL DisplayConnection::addErrorHandler( const Reference< XEventHandler >& handler ) throw() +void SAL_CALL DisplayConnection::addErrorHandler( const css::uno::Reference< XEventHandler >& handler ) throw() { MutexGuard aGuard( m_aMutex ); m_aErrorHandlers.push_back( handler ); } -void SAL_CALL DisplayConnection::removeErrorHandler( const Reference< XEventHandler >& handler ) throw() +void SAL_CALL DisplayConnection::removeErrorHandler( const css::uno::Reference< XEventHandler >& handler ) throw() { MutexGuard aGuard( m_aMutex ); @@ -107,52 +125,37 @@ Any SAL_CALL DisplayConnection::getIdentifier() throw() return m_aAny; } -void DisplayConnection::dispatchDowningEvent() -{ - SolarMutexReleaser aRel; - - MutexGuard aGuard( m_aMutex ); - Any aEvent; - std::list< Reference< XEventHandler > > aLocalList( m_aHandlers ); - for( ::std::list< Reference< XEventHandler > >::const_iterator it = aLocalList.begin(); it != aLocalList.end(); ++it ) - (*it)->handleEvent( aEvent ); -} - -bool DisplayConnection::dispatchEvent( void* pThis, void* pData, int nBytes ) +bool DisplayConnection::dispatchEvent( void* pData, int nBytes ) { SolarMutexReleaser aRel; - DisplayConnection* This = (DisplayConnection*)pThis; - Sequence< sal_Int8 > aSeq( (sal_Int8*)pData, nBytes ); Any aEvent; aEvent <<= aSeq; - ::std::list< Reference< XEventHandler > > handlers; + ::std::list< css::uno::Reference< XEventHandler > > handlers; { - MutexGuard aGuard( This->m_aMutex ); - handlers = This->m_aHandlers; + MutexGuard aGuard( m_aMutex ); + handlers = m_aHandlers; } - for( ::std::list< Reference< XEventHandler > >::const_iterator it = handlers.begin(); it != handlers.end(); ++it ) + for( ::std::list< css::uno::Reference< XEventHandler > >::const_iterator it = handlers.begin(); it != handlers.end(); ++it ) if( (*it)->handleEvent( aEvent ) ) return true; return false; } -bool DisplayConnection::dispatchErrorEvent( void* pThis, void* pData, int nBytes ) +bool DisplayConnection::dispatchErrorEvent( void* pData, int nBytes ) { SolarMutexReleaser aRel; - DisplayConnection* This = (DisplayConnection*)pThis; - Sequence< sal_Int8 > aSeq( (sal_Int8*)pData, nBytes ); Any aEvent; aEvent <<= aSeq; - ::std::list< Reference< XEventHandler > > handlers; + ::std::list< css::uno::Reference< XEventHandler > > handlers; { - MutexGuard aGuard( This->m_aMutex ); - handlers = This->m_aErrorHandlers; + MutexGuard aGuard( m_aMutex ); + handlers = m_aErrorHandlers; } - for( ::std::list< Reference< XEventHandler > >::const_iterator it = handlers.begin(); it != handlers.end(); ++it ) + for( ::std::list< css::uno::Reference< XEventHandler > >::const_iterator it = handlers.begin(); it != handlers.end(); ++it ) if( (*it)->handleEvent( aEvent ) ) return true; |