diff options
662 files changed, 10722 insertions, 20409 deletions
diff --git a/basebmp/inc/basebmp/bitmapdevice.hxx b/basebmp/inc/basebmp/bitmapdevice.hxx index 488425cde4c0..0db4099213f4 100644 --- a/basebmp/inc/basebmp/bitmapdevice.hxx +++ b/basebmp/inc/basebmp/bitmapdevice.hxx @@ -67,6 +67,11 @@ typedef boost::shared_ptr< const std::vector<Color> > PaletteMemorySharedVecto struct ImplBitmapDevice; +class BitmapDeviceDamageTracker { + public: + virtual void damaged (const basegfx::B2IRange& rDamageRect) = 0; +}; + /** Definition of BitmapDevice interface Use the createBitmapDevice() factory method to create instances. @@ -115,6 +120,8 @@ public: */ RawMemorySharedArray getBuffer() const; + BitmapDeviceDamageTracker *getDamageTracker() const; + /** Get pointer to palette The returned pointer is const on purpose, since the @@ -548,7 +555,8 @@ protected: sal_Int32 nScanlineStride, sal_uInt8* pFirstScanline, const RawMemorySharedArray& rMem, - const PaletteMemorySharedVector& rPalette ); + const PaletteMemorySharedVector& rPalette, + BitmapDeviceDamageTracker* pDamage = NULL ); virtual ~BitmapDevice(); @@ -648,7 +656,8 @@ private: */ BASEBMP_DLLPUBLIC BitmapDeviceSharedPtr createBitmapDevice( const basegfx::B2IVector& rSize, bool bTopDown, - sal_Int32 nScanlineFormat ); + sal_Int32 nScanlineFormat, + BitmapDeviceDamageTracker* pDamage = NULL ); /** Factory method to create a BitmapDevice for given scanline format with the given palette diff --git a/basebmp/source/bitmapdevice.cxx b/basebmp/source/bitmapdevice.cxx index bf4cafd16cb2..a483197aa54d 100644 --- a/basebmp/source/bitmapdevice.cxx +++ b/basebmp/source/bitmapdevice.cxx @@ -273,6 +273,7 @@ namespace dest_iterator_type maBegin; typename accessor_traits::color_lookup maColorLookup; + BitmapDeviceDamageTracker *mpDamage; to_uint32_functor maToUInt32Converter; dest_accessor_type maAccessor; colorblend_accessor_type maColorBlendAccessor; @@ -288,6 +289,7 @@ namespace raw_maskedxor_accessor_type maRawMaskedXorAccessor; raw_maskedmask_accessor_type maRawMaskedMaskAccessor; + // ------------------------------------------------------- BitmapRenderer( const basegfx::B2IRange& rBounds, @@ -298,11 +300,14 @@ namespace raw_accessor_type rawAccessor, dest_accessor_type accessor, const RawMemorySharedArray& rMem, - const PaletteMemorySharedVector& rPalette ) : + const PaletteMemorySharedVector& rPalette, + BitmapDeviceDamageTracker* pDamage ) : BitmapDevice( rBounds, nScanlineFormat, - nScanlineStride, pFirstScanline, rMem, rPalette ), + nScanlineStride, pFirstScanline, rMem, rPalette, + pDamage ), maBegin( begin ), maColorLookup(), + mpDamage( pDamage ), maToUInt32Converter(), maAccessor( accessor ), maColorBlendAccessor( accessor ), @@ -320,6 +325,32 @@ namespace {} private: + + void damaged( const basegfx::B2IRange& rDamageRect ) const + { + if( mpDamage ) + mpDamage->damaged( rDamageRect ); + } + + void damagedPointSize( const basegfx::B2IPoint& rPoint, + const basegfx::B2IRange& rSize ) const + { + if( mpDamage ) { + basegfx::B2IPoint aLower( rPoint.getX() + rSize.getWidth(), + rPoint.getY() + rSize.getHeight() ); + damaged( basegfx::B2IRange( rPoint, aLower ) ); + } + } + + void damagedPixel( const basegfx::B2IPoint& rDamagePoint ) const + { + if( !mpDamage ) + return; + basegfx::B2IPoint aEnd( rDamagePoint.getX() + 1, + rDamagePoint.getY() + 1 ); + damaged( basegfx::B2IRange( rDamagePoint, aEnd ) ); + } + boost::shared_ptr<BitmapRenderer> getCompatibleBitmap( const BitmapDeviceSharedPtr& bmp ) const { return boost::dynamic_pointer_cast< BitmapRenderer >( bmp ); @@ -373,6 +404,7 @@ namespace maColorLookup( maAccessor, fillColor) ); + damaged( rBounds ); } virtual void setPixel_i( const basegfx::B2IPoint& rPt, @@ -388,6 +420,7 @@ namespace else maAccessor.set( pixelColor, pixel ); + damagedPixel(rPt); } virtual void setPixel_i( const basegfx::B2IPoint& rPt, @@ -411,6 +444,7 @@ namespace else maMaskedAccessor.set( pixelColor, aIter ); + damagedPixel(rPt); } virtual Color getPixel_i(const basegfx::B2IPoint& rPt ) @@ -443,6 +477,9 @@ namespace col, begin, rawAcc ); + // FIXME: perhaps this needs pushing up the stack a bit + // to make more complex polygons more efficient ... + damaged( basegfx::B2IRange( rPt1, rPt2 ) ); } template< typename Iterator, typename Accessor, typename RawAcc > @@ -593,6 +630,12 @@ namespace rBounds, aPoly, basegfx::FillRule_EVEN_ODD ); + + if( mpDamage ) + { + basegfx::B2DRange const aPolyBounds( basegfx::tools::getRange(aPoly) ); + damaged( basegfx::fround( aPolyBounds ) ); + } } virtual void fillPolyPolygon_i(const basegfx::B2DPolyPolygon& rPoly, @@ -648,6 +691,7 @@ namespace acc, rDstRect), rSrcBitmap.get() == this ); + damaged( rDstRect ); } template< typename Iterator, typename Acc > @@ -666,6 +710,7 @@ namespace destIterRange(begin, acc, rDstRect)); + damaged( rDstRect ); } virtual void drawBitmap_i(const BitmapDeviceSharedPtr& rSrcBitmap, @@ -695,6 +740,7 @@ namespace maBegin, maAccessor); } + damaged( rDstRect ); } virtual void drawBitmap_i(const BitmapDeviceSharedPtr& rSrcBitmap, @@ -725,6 +771,7 @@ namespace getMaskedIter(rClip), maMaskedAccessor); } + damaged( rDstRect ); } virtual void drawMaskedColor_i(Color aSrcColor, @@ -773,6 +820,7 @@ namespace maGenericColorBlendAccessor, rDstPoint) ); } + damagedPointSize( rDstPoint, rSrcRect ); } virtual void drawMaskedColor_i(Color aSrcColor, @@ -835,6 +883,7 @@ namespace maGenericMaskedColorBlendAccessor, rDstPoint) ); } + damagedPointSize( rDstPoint, rSrcRect ); } template< typename Iterator, typename Acc > @@ -865,6 +914,7 @@ namespace FastMask >::type(acc), rDstRect), rSrcBitmap.get() == this); + damaged( rDstRect ); } template< typename Iterator, typename Acc > @@ -898,6 +948,7 @@ namespace Masks::clipmask_polarity, NoFastMask >::type(acc), rDstRect)); + damaged( rDstRect ); } virtual void drawMaskedBitmap_i(const BitmapDeviceSharedPtr& rSrcBitmap, @@ -933,6 +984,7 @@ namespace maBegin, maAccessor); } + damaged( rDstRect ); } virtual void drawMaskedBitmap_i(const BitmapDeviceSharedPtr& rSrcBitmap, @@ -969,6 +1021,7 @@ namespace getMaskedIter(rClip), maMaskedAccessor); } + damaged( rDstRect ); } }; } // namespace @@ -981,6 +1034,8 @@ struct ImplBitmapDevice */ RawMemorySharedArray mpMem; + BitmapDeviceDamageTracker *mpDamage; + /// Palette memory plus deleter (might be NULL) PaletteMemorySharedVector mpPalette; @@ -1037,10 +1092,12 @@ BitmapDevice::BitmapDevice( const basegfx::B2IRange& rBounds, sal_Int32 nScanlineStride, sal_uInt8* pFirstScanline, const RawMemorySharedArray& rMem, - const PaletteMemorySharedVector& rPalette ) : + const PaletteMemorySharedVector& rPalette, + BitmapDeviceDamageTracker* pDamage ) : mpImpl( new ImplBitmapDevice ) { mpImpl->mpMem = rMem; + mpImpl->mpDamage = pDamage; mpImpl->mpPalette = rPalette; mpImpl->maBounds = rBounds; mpImpl->maLineClipRect = basegfx::B2IRange( rBounds.getMinX(), @@ -1059,7 +1116,6 @@ BitmapDevice::~BitmapDevice() basegfx::B2IVector BitmapDevice::getSize() const { - return basegfx::B2IVector( mpImpl->maBounds.getMaxX() - mpImpl->maBounds.getMinX(), mpImpl->maBounds.getMaxY() - mpImpl->maBounds.getMinY() ); @@ -1091,6 +1147,11 @@ PaletteMemorySharedVector BitmapDevice::getPalette() const return mpImpl->mpPalette; } +BitmapDeviceDamageTracker *BitmapDevice::getDamageTracker() const +{ + return mpImpl->mpDamage; +} + sal_Int32 BitmapDevice::getPaletteEntryCount() const { return mpImpl->mpPalette ? mpImpl->mpPalette->size() : 0; @@ -1641,8 +1702,8 @@ BitmapDeviceSharedPtr createRenderer( typename FormatTraits::accessor_selector::template wrap_accessor< typename FormatTraits::raw_accessor_type>::type const& rAccessor, boost::shared_array< sal_uInt8 > pMem, - const PaletteMemorySharedVector& pPal ) - + const PaletteMemorySharedVector& pPal, + BitmapDeviceDamageTracker* pDamage ) #else template< class FormatTraits, class MaskTraits, class Accessor > @@ -1654,7 +1715,8 @@ BitmapDeviceSharedPtr createRenderer( typename FormatTraits::raw_accessor_type const& rRawAccessor, Accessor const& rAccessor, boost::shared_array< sal_uInt8 > pMem, - const PaletteMemorySharedVector& pPal ) + const PaletteMemorySharedVector& pPal, + BitmapDeviceDamageTracker* pDamage ) #endif { @@ -1676,7 +1738,8 @@ BitmapDeviceSharedPtr createRenderer( rRawAccessor, rAccessor, pMem, - pPal )); + pPal, + pDamage )); } /// Create standard grey level palette @@ -1707,7 +1770,8 @@ BitmapDeviceSharedPtr createRenderer( sal_Int32 nScanlineStride, sal_uInt8* pFirstScanline, boost::shared_array< sal_uInt8 > pMem, - const PaletteMemorySharedVector& pPal ) + const PaletteMemorySharedVector& pPal, + BitmapDeviceDamageTracker* pDamage ) { return createRenderer<FormatTraits, MaskTraits>(rBounds, @@ -1719,7 +1783,8 @@ BitmapDeviceSharedPtr createRenderer( wrap_accessor< typename FormatTraits::raw_accessor_type>::type(), pMem, - pPal); + pPal, + pDamage); } template< class FormatTraits, class MaskTraits > @@ -1730,7 +1795,8 @@ BitmapDeviceSharedPtr createRenderer( sal_uInt8* pFirstScanline, boost::shared_array< sal_uInt8 > pMem, PaletteMemorySharedVector pPal, - int nBitsPerPixel ) + int nBitsPerPixel, + BitmapDeviceDamageTracker* pDamage ) { pPal = createStandardPalette(pPal, 1UL << nBitsPerPixel); @@ -1748,7 +1814,8 @@ BitmapDeviceSharedPtr createRenderer( &pPal->at(0), pPal->size()), pMem, - pPal); + pPal, + pDamage); } //---------------------------------------------------------------------------------- @@ -1784,7 +1851,8 @@ BitmapDeviceSharedPtr createBitmapDeviceImpl( const basegfx::B2IVector& r sal_Int32 nScanlineFormat, boost::shared_array< sal_uInt8 > pMem, PaletteMemorySharedVector pPal, - const basegfx::B2IRange* pSubset ) + const basegfx::B2IRange* pSubset, + BitmapDeviceDamageTracker* pDamage ) { if( nScanlineFormat <= Format::NONE || nScanlineFormat > Format::MAX ) @@ -1852,24 +1920,24 @@ BitmapDeviceSharedPtr createBitmapDeviceImpl( const basegfx::B2IVector& r case Format::ONE_BIT_MSB_GREY: return createRenderer<PixelFormatTraits_GREY1_MSB,StdMasks>( aBounds, nScanlineFormat, nScanlineStride, - pFirstScanline, pMem, pPal ); + pFirstScanline, pMem, pPal, pDamage ); case Format::ONE_BIT_LSB_GREY: return createRenderer<PixelFormatTraits_GREY1_LSB,StdMasks>( aBounds, nScanlineFormat, nScanlineStride, - pFirstScanline, pMem, pPal ); + pFirstScanline, pMem, pPal, pDamage ); case Format::ONE_BIT_MSB_PAL: return createRenderer<PixelFormatTraits_PAL1_MSB,StdMasks>( aBounds, nScanlineFormat, nScanlineStride, pFirstScanline, pMem, pPal, - bitsPerPixel[nScanlineFormat] ); + bitsPerPixel[nScanlineFormat], pDamage ); case Format::ONE_BIT_LSB_PAL: return createRenderer<PixelFormatTraits_PAL1_LSB,StdMasks>( aBounds, nScanlineFormat, nScanlineStride, pFirstScanline, pMem, pPal, - bitsPerPixel[nScanlineFormat] ); + bitsPerPixel[nScanlineFormat], pDamage ); // ---------------------------------------------------------------------- @@ -1878,24 +1946,24 @@ BitmapDeviceSharedPtr createBitmapDeviceImpl( const basegfx::B2IVector& r case Format::FOUR_BIT_MSB_GREY: return createRenderer<PixelFormatTraits_GREY4_MSB,StdMasks>( aBounds, nScanlineFormat, nScanlineStride, - pFirstScanline, pMem, pPal ); + pFirstScanline, pMem, pPal, pDamage ); case Format::FOUR_BIT_LSB_GREY: return createRenderer<PixelFormatTraits_GREY4_LSB,StdMasks>( aBounds, nScanlineFormat, nScanlineStride, - pFirstScanline, pMem, pPal ); + pFirstScanline, pMem, pPal, pDamage ); case Format::FOUR_BIT_MSB_PAL: return createRenderer<PixelFormatTraits_PAL4_MSB,StdMasks>( aBounds, nScanlineFormat, nScanlineStride, pFirstScanline, pMem, pPal, - bitsPerPixel[nScanlineFormat] ); + bitsPerPixel[nScanlineFormat], pDamage ); case Format::FOUR_BIT_LSB_PAL: return createRenderer<PixelFormatTraits_PAL4_LSB,StdMasks>( aBounds, nScanlineFormat, nScanlineStride, pFirstScanline, pMem, pPal, - bitsPerPixel[nScanlineFormat] ); + bitsPerPixel[nScanlineFormat], pDamage ); // ---------------------------------------------------------------------- @@ -1904,13 +1972,13 @@ BitmapDeviceSharedPtr createBitmapDeviceImpl( const basegfx::B2IVector& r case Format::EIGHT_BIT_GREY: return createRenderer<PixelFormatTraits_GREY8,StdMasks>( aBounds, nScanlineFormat, nScanlineStride, - pFirstScanline, pMem, pPal ); + pFirstScanline, pMem, pPal, pDamage ); case Format::EIGHT_BIT_PAL: return createRenderer<PixelFormatTraits_PAL8,StdMasks>( aBounds, nScanlineFormat, nScanlineStride, pFirstScanline, pMem, pPal, - bitsPerPixel[nScanlineFormat] ); + bitsPerPixel[nScanlineFormat], pDamage ); // ---------------------------------------------------------------------- @@ -1919,12 +1987,12 @@ BitmapDeviceSharedPtr createBitmapDeviceImpl( const basegfx::B2IVector& r case Format::SIXTEEN_BIT_LSB_TC_MASK: return createRenderer<PixelFormatTraits_RGB16_565_LSB,StdMasks>( aBounds, nScanlineFormat, nScanlineStride, - pFirstScanline, pMem, pPal ); + pFirstScanline, pMem, pPal, pDamage ); case Format::SIXTEEN_BIT_MSB_TC_MASK: return createRenderer<PixelFormatTraits_RGB16_565_MSB,StdMasks>( aBounds, nScanlineFormat, nScanlineStride, - pFirstScanline, pMem, pPal ); + pFirstScanline, pMem, pPal, pDamage ); // ---------------------------------------------------------------------- @@ -1932,7 +2000,7 @@ BitmapDeviceSharedPtr createBitmapDeviceImpl( const basegfx::B2IVector& r case Format::TWENTYFOUR_BIT_TC_MASK: return createRenderer<PixelFormatTraits_BGR24,StdMasks>( aBounds, nScanlineFormat, nScanlineStride, - pFirstScanline, pMem, pPal ); + pFirstScanline, pMem, pPal, pDamage ); // ---------------------------------------------------------------------- @@ -1941,12 +2009,12 @@ BitmapDeviceSharedPtr createBitmapDeviceImpl( const basegfx::B2IVector& r case Format::THIRTYTWO_BIT_TC_MASK: return createRenderer<PixelFormatTraits_RGB32_888,StdMasks>( aBounds, nScanlineFormat, nScanlineStride, - pFirstScanline, pMem, pPal ); + pFirstScanline, pMem, pPal, pDamage ); case Format::THIRTYTWO_BIT_TC_MASK_ARGB: return createRenderer<PixelFormatTraits_BGR32_888,StdMasks>( aBounds, nScanlineFormat, nScanlineStride, - pFirstScanline, pMem, pPal ); + pFirstScanline, pMem, pPal, pDamage ); } // TODO(F3): other formats not yet implemented @@ -1957,14 +2025,16 @@ BitmapDeviceSharedPtr createBitmapDeviceImpl( const basegfx::B2IVector& r BitmapDeviceSharedPtr createBitmapDevice( const basegfx::B2IVector& rSize, bool bTopDown, - sal_Int32 nScanlineFormat ) + sal_Int32 nScanlineFormat, + BitmapDeviceDamageTracker* pDamage ) { return createBitmapDeviceImpl( rSize, bTopDown, nScanlineFormat, boost::shared_array< sal_uInt8 >(), PaletteMemorySharedVector(), - NULL ); + NULL, + pDamage ); } BitmapDeviceSharedPtr createBitmapDevice( const basegfx::B2IVector& rSize, @@ -1977,6 +2047,7 @@ BitmapDeviceSharedPtr createBitmapDevice( const basegfx::B2IVector& rSize nScanlineFormat, boost::shared_array< sal_uInt8 >(), rPalette, + NULL, NULL ); } @@ -1991,6 +2062,7 @@ BitmapDeviceSharedPtr createBitmapDevice( const basegfx::B2IVector& rSize nScanlineFormat, rMem, rPalette, + NULL, NULL ); } @@ -2002,7 +2074,8 @@ BitmapDeviceSharedPtr subsetBitmapDevice( const BitmapDeviceSharedPtr& rProt rProto->getScanlineFormat(), rProto->getBuffer(), rProto->getPalette(), - &rSubset ); + &rSubset, + rProto->getDamageTracker() ); } BitmapDeviceSharedPtr cloneBitmapDevice( const basegfx::B2IVector& rSize, @@ -2013,7 +2086,8 @@ BitmapDeviceSharedPtr cloneBitmapDevice( const basegfx::B2IVector& rSize, rProto->getScanlineFormat(), boost::shared_array< sal_uInt8 >(), rProto->getPalette(), - NULL ); + NULL, + rProto->getDamageTracker() ); } //---------------------------------------------------------------------------------- diff --git a/basegfx/inc/basegfx/matrix/b3dhommatrix.hxx b/basegfx/inc/basegfx/matrix/b3dhommatrix.hxx index ccd4cfe707a8..a3eb8d311ec4 100644 --- a/basegfx/inc/basegfx/matrix/b3dhommatrix.hxx +++ b/basegfx/inc/basegfx/matrix/b3dhommatrix.hxx @@ -53,9 +53,6 @@ namespace basegfx B3DHomMatrix(const B3DHomMatrix& rMat); ~B3DHomMatrix(); - /// unshare this matrix with all internally shared instances - void makeUnique(); - double get(sal_uInt16 nRow, sal_uInt16 nColumn) const; void set(sal_uInt16 nRow, sal_uInt16 nColumn, double fValue); @@ -67,20 +64,12 @@ namespace basegfx /// Reset to the identity matrix void identity(); - bool isInvertible() const; /// Invert the matrix (if possible) bool invert(); - bool isNormalized() const; - /// Normalize (i.e. force w=1) the matrix - void normalize(); - /// Calc the matrix determinant double determinant() const; - /// Calc the matrix trace - double trace() const; - /// Transpose the matrix void transpose(); @@ -95,8 +84,6 @@ namespace basegfx // Shearing-Matrices void shearXY(double fSx, double fSy); - void shearYZ(double fSy, double fSz); - void shearXZ(double fSx, double fSz); // Projection matrices, used for converting between eye and // clip coordinates diff --git a/basegfx/inc/basegfx/point/b3dhompoint.hxx b/basegfx/inc/basegfx/point/b3dhompoint.hxx deleted file mode 100644 index 1b43afc03b38..000000000000 --- a/basegfx/inc/basegfx/point/b3dhompoint.hxx +++ /dev/null @@ -1,409 +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. - * - ************************************************************************/ - -#ifndef _BGFX_POINT_B3DHOMPOINT_HXX -#define _BGFX_POINT_B3DHOMPOINT_HXX - -#include <basegfx/point/b3dpoint.hxx> -#include <basegfx/basegfxdllapi.h> - -namespace basegfx -{ - /** Basic homogen Point class with three double values and one homogen factor - - This class provides access to homogen coordinates in 3D. - For this purpose all the operators which need to do specific - action due to their homogenity are implemented here. - The only caveat are member methods which are declared as const - but do change the content. These are documented for that reason. - The class is designed to provide homogenous coordinates without - direct access to the homogen part (mfW). This is also the reason - for leaving out the [] operators which return references to members. - - @see B3DTuple - */ - class BASEGFX_DLLPUBLIC B3DHomPoint - { - protected: - /// This member contains the coordinate part of the point - ::basegfx::B3DTuple maTuple; - - /// This Member holds the homogenous part of the point - double mfW; - - /** Test if this homogen point does have a homogenous part - - @return Returns true if this point has no homogenous part - */ - bool implIsHomogenized() const - { - const double fOne(1.0); - return ::basegfx::fTools::equal(mfW, fOne); - } - - /** Remove homogenous part of this Point - - This method does necessary calculations to remove - the evtl. homogenous part of this Point. This may - change all members. - */ - void implHomogenize(); - - /** Test and on demand remove homogenous part - - This method tests if this Point does have a homogenous part - and then evtl. takes actions to remove that part. - - @attention Even when this method is const it may change all - members of this instance. This is due to the fact that changing - the homogenous part of a homogenous point does from a mathematical - point of view not change the point at all. - */ - void implTestAndHomogenize() const - { - if(!implIsHomogenized()) - ((B3DHomPoint*)this)->implHomogenize(); - } - - public: - /** Create a homogen point - - The point is initialized to (0.0, 0.0, 0.0) - */ - B3DHomPoint() - : maTuple(), - mfW(1.0) - {} - - /** Create a homogen point - - @param fX - This parameter is used to initialize the X-coordinate - of the Point. The homogenous part is initialized to 1.0. - - @param fY - This parameter is used to initialize the Y-coordinate - of the Point. The homogenous part is initialized to 1.0. - - @param fZ - This parameter is used to initialize the Z-coordinate - of the Point. The homogenous part is initialized to 1.0. - */ - B3DHomPoint(double fX, double fY, double fZ) - : maTuple(fX, fY, fZ), - mfW(1.0) - {} - - /** Create a copy of a 3D Point - - @param rVec - The 3D point which will be copied. The homogenous part - is initialized to 1.0. - */ - B3DHomPoint(const B3DPoint& rVec) - : maTuple(rVec), - mfW(1.0) - {} - - /** Create a copy of a homogen point - - @param rVec - The homogen point which will be copied. The homogenous part - is copied, too. - */ - B3DHomPoint(const B3DHomPoint& rVec) - : maTuple(rVec.maTuple.getX(), rVec.maTuple.getY(), rVec.maTuple.getZ()), - mfW(rVec.mfW) - {} - - ~B3DHomPoint() - {} - - /** get a 3D point from this homogenous point - - This method normalizes this homogen point if necessary and - returns the corresponding 3D point for this homogen point. - - @attention Even when this method is const it may change all - members of this instance. - */ - B3DPoint getB3DPoint() const - { - implTestAndHomogenize(); - return B3DPoint(maTuple.getX(), maTuple.getY(), maTuple.getZ()); - } - - /** get X-coordinate - - This method normalizes this homogen point if necessary and - returns the corresponding X-coordinate for this homogen point. - - @attention Even when this method is const it may change all - members of this instance. - */ - double getX() const - { - implTestAndHomogenize(); - return maTuple.getX(); - } - - /** get Y-coordinate - - This method normalizes this homogen point if necessary and - returns the corresponding Y-coordinate for this homogen point. - - @attention Even when this method is const it may change all - members of this instance. - */ - double getY() const - { - implTestAndHomogenize(); - return maTuple.getY(); - } - - /** get Z-coordinate - - This method normalizes this homogen point if necessary and - returns the corresponding Z-coordinate for this homogen point. - - @attention Even when this method is const it may change all - members of this instance. - */ - double getZ() const - { - implTestAndHomogenize(); - return maTuple.getY(); - } - - /** Set X-coordinate of the homogen point. - - This method sets the X-coordinate of the homogen point. If - the point does have a homogenous part this is taken into account. - - @param fX - The to-be-set X-coordinate without homogenous part. - */ - void setX(double fX) - { - maTuple.setX(implIsHomogenized() ? fX : fX * mfW ); - } - - /** Set Y-coordinate of the homogen point. - - This method sets the Y-coordinate of the homogen point. If - the point does have a homogenous part this is taken into account. - - @param fY - The to-be-set Y-coordinate without homogenous part. - */ - void setY(double fY) - { - maTuple.setY(implIsHomogenized() ? fY : fY * mfW ); - } - - /** Set Z-coordinate of the homogen point. - - This method sets the Z-coordinate of the homogen point. If - the point does have a homogenous part this is taken into account. - - @param fZ - The to-be-set Z-coordinate without homogenous part. - */ - void setZ(double fZ) - { - maTuple.setZ(implIsHomogenized() ? fZ : fZ * mfW ); - } - - // operators - ////////////////////////////////////////////////////////////////////// - - B3DHomPoint& operator+=( const B3DHomPoint& rPnt ) - { - maTuple.setX(getX() * rPnt.mfW + rPnt.getX() * mfW); - maTuple.setY(getY() * rPnt.mfW + rPnt.getY() * mfW); - maTuple.setZ(getZ() * rPnt.mfW + rPnt.getZ() * mfW); - mfW = mfW * rPnt.mfW; - - return *this; - } - - B3DHomPoint& operator-=( const B3DHomPoint& rPnt ) - { - maTuple.setX(getX() * rPnt.mfW - rPnt.getX() * mfW); - maTuple.setY(getY() * rPnt.mfW - rPnt.getY() * mfW); - maTuple.setZ(getZ() * rPnt.mfW - rPnt.getZ() * mfW); - mfW = mfW * rPnt.mfW; - - return *this; - } - - B3DHomPoint& operator*=(double t) - { - if(!::basegfx::fTools::equalZero(t)) - { - mfW /= t; - } - - return *this; - } - - B3DHomPoint& operator/=(double t) - { - mfW *= t; - return *this; - } - - B3DHomPoint& operator-(void) - { - mfW = -mfW; - return *this; - } - - bool operator==( const B3DHomPoint& rPnt ) const - { - implTestAndHomogenize(); - return (maTuple == rPnt.maTuple); - } - - bool operator!=( const B3DHomPoint& rPnt ) const - { - implTestAndHomogenize(); - return (maTuple != rPnt.maTuple); - } - - B3DHomPoint& operator=( const B3DHomPoint& rPnt ) - { - maTuple = rPnt.maTuple; - mfW = rPnt.mfW; - return *this; - } - }; - - // external operators - ////////////////////////////////////////////////////////////////////////// - - inline B3DHomPoint minimum(const B3DHomPoint& rVecA, const B3DHomPoint& rVecB) - { - B3DHomPoint aMin( - (rVecB.getX() < rVecA.getX()) ? rVecB.getX() : rVecA.getX(), - (rVecB.getY() < rVecA.getY()) ? rVecB.getY() : rVecA.getY(), - (rVecB.getZ() < rVecA.getZ()) ? rVecB.getZ() : rVecA.getZ()); - return aMin; - } - - inline B3DHomPoint maximum(const B3DHomPoint& rVecA, const B3DHomPoint& rVecB) - { - B3DHomPoint aMax( - (rVecB.getX() > rVecA.getX()) ? rVecB.getX() : rVecA.getX(), - (rVecB.getY() > rVecA.getY()) ? rVecB.getY() : rVecA.getY(), - (rVecB.getZ() > rVecA.getZ()) ? rVecB.getZ() : rVecA.getZ()); - return aMax; - } - - inline B3DHomPoint absolute(const B3DHomPoint& rVec) - { - B3DHomPoint aAbs( - (0.0 > rVec.getX()) ? -rVec.getX() : rVec.getX(), - (0.0 > rVec.getY()) ? -rVec.getY() : rVec.getY(), - (0.0 > rVec.getZ()) ? -rVec.getZ() : rVec.getZ()); - return aAbs; - } - - inline B3DHomPoint interpolate(B3DHomPoint& rOld1, B3DHomPoint& rOld2, double t) - { - B3DHomPoint aInt( - ((rOld2.getX() - rOld1.getX()) * t) + rOld1.getX(), - ((rOld2.getY() - rOld1.getY()) * t) + rOld1.getY(), - ((rOld2.getZ() - rOld1.getZ()) * t) + rOld1.getZ()); - return aInt; - } - - inline B3DHomPoint average(B3DHomPoint& rOld1, B3DHomPoint& rOld2) - { - B3DHomPoint aAvg( - (rOld1.getX() + rOld2.getX()) * 0.5, - (rOld1.getY() + rOld2.getY()) * 0.5, - (rOld1.getZ() + rOld2.getZ()) * 0.5); - return aAvg; - } - - inline B3DHomPoint average(B3DHomPoint& rOld1, B3DHomPoint& rOld2, B3DHomPoint& rOld3) - { - B3DHomPoint aAvg( - (rOld1.getX() + rOld2.getX() + rOld3.getX()) * (1.0 / 3.0), - (rOld1.getY() + rOld2.getY() + rOld3.getY()) * (1.0 / 3.0), - (rOld1.getZ() + rOld2.getZ() + rOld3.getZ()) * (1.0 / 3.0)); - return aAvg; - } - - inline B3DHomPoint operator+(const B3DHomPoint& rVecA, const B3DHomPoint& rVecB) - { - B3DHomPoint aSum(rVecA); - aSum += rVecB; - return aSum; - } - - inline B3DHomPoint operator-(const B3DHomPoint& rVecA, const B3DHomPoint& rVecB) - { - B3DHomPoint aSub(rVecA); - aSub -= rVecB; - return aSub; - } - - inline B3DHomPoint operator*(const B3DHomPoint& rVec, double t) - { - B3DHomPoint aNew(rVec); - aNew *= t; - return aNew; - } - - inline B3DHomPoint operator*(double t, const B3DHomPoint& rVec) - { - B3DHomPoint aNew(rVec); - aNew *= t; - return aNew; - } - - inline B3DHomPoint operator/(const B3DHomPoint& rVec, double t) - { - B3DHomPoint aNew(rVec); - aNew /= t; - return aNew; - } - - inline B3DHomPoint operator/(double t, const B3DHomPoint& rVec) - { - B3DHomPoint aNew(rVec); - aNew /= t; - return aNew; - } -} // end of namespace basegfx - -#endif /* _BGFX_POINT_B3DHOMPOINT_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basegfx/inc/basegfx/tools/unotools.hxx b/basegfx/inc/basegfx/tools/unotools.hxx new file mode 100644 index 000000000000..e7bcc27fb561 --- /dev/null +++ b/basegfx/inc/basegfx/tools/unotools.hxx @@ -0,0 +1,55 @@ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License or as specified alternatively below. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is + * Thorsten Behrens <tbehrens@novell.com> + * Portions created by the Initial Developer are Copyright (C) 2011 the + * Initial Developer. All Rights Reserved. + * + * For minor contributions see the git repository. + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#ifndef INCLUDED_BASEGFX_UNOTOOLS_HXX +#define INCLUDED_BASEGFX_UNOTOOLS_HXX + +#include <cppuhelper/basemutex.hxx> +#include <cppuhelper/compbase3.hxx> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/rendering/FillRule.hpp> +#include <com/sun/star/rendering/XLinePolyPolygon2D.hpp> +#include <com/sun/star/rendering/XBezierPolyPolygon2D.hpp> +#include <basegfx/polygon/b2dpolypolygon.hxx> + + +namespace basegfx +{ +class B2DPolyPolygon; + +namespace unotools +{ + + B2DPolyPolygon polyPolygonBezierToB2DPolyPolygon(const ::com::sun::star::drawing::PolyPolygonBezierCoords& rSourcePolyPolygon) + throw( ::com::sun::star::lang::IllegalArgumentException ); + + void b2DPolyPolygonToPolyPolygonBezier( const B2DPolyPolygon& rPolyPoly, + ::com::sun::star::drawing::PolyPolygonBezierCoords& rRetval ); +} +} + +#endif /* INCLUDED_BASEGFX_UNOTOOLS_HXX */ diff --git a/basegfx/prj/build.lst b/basegfx/prj/build.lst index ed12d718c12d..ab5cf9bda8e4 100644 --- a/basegfx/prj/build.lst +++ b/basegfx/prj/build.lst @@ -1,3 +1,3 @@ -fx basegfx : o3tl sal offuh cppuhelper cppu CPPUNIT:cppunit NULL +fx basegfx : o3tl sal offapi comphelper cppuhelper cppu CPPUNIT:cppunit NULL fx basegfx\prj nmake - all fx_prj NULL diff --git a/basegfx/prj/d.lst b/basegfx/prj/d.lst index e69de29bb2d1..997a23399ff6 100644 --- a/basegfx/prj/d.lst +++ b/basegfx/prj/d.lst @@ -0,0 +1 @@ +..\inc\basegfx\tools\unotools.hxx %_DEST%\inc\basegfx\tools\unotools.hxx diff --git a/basegfx/source/matrix/b3dhommatrix.cxx b/basegfx/source/matrix/b3dhommatrix.cxx index e665b47d58a6..80a5024893b4 100644 --- a/basegfx/source/matrix/b3dhommatrix.cxx +++ b/basegfx/source/matrix/b3dhommatrix.cxx @@ -63,11 +63,6 @@ namespace basegfx return *this; } - void B3DHomMatrix::makeUnique() - { - mpImpl.make_unique(); - } - double B3DHomMatrix::get(sal_uInt16 nRow, sal_uInt16 nColumn) const { return mpImpl->get(nRow, nColumn); @@ -96,11 +91,6 @@ namespace basegfx mpImpl = IdentityMatrix::get(); } - bool B3DHomMatrix::isInvertible() const - { - return mpImpl->isInvertible(); - } - bool B3DHomMatrix::invert() { Impl3DHomMatrix aWork(*mpImpl); @@ -119,27 +109,11 @@ namespace basegfx return false; } - bool B3DHomMatrix::isNormalized() const - { - return mpImpl->isNormalized(); - } - - void B3DHomMatrix::normalize() - { - if(!const_cast<const B3DHomMatrix*>(this)->mpImpl->isNormalized()) - mpImpl->doNormalize(); - } - double B3DHomMatrix::determinant() const { return mpImpl->doDeterminant(); } - double B3DHomMatrix::trace() const - { - return mpImpl->doTrace(); - } - void B3DHomMatrix::transpose() { mpImpl->doTranspose(); @@ -290,34 +264,6 @@ namespace basegfx } } - void B3DHomMatrix::shearYZ(double fSy, double fSz) - { - // #i76239# do not test againt 1.0, but against 0.0. We are talking about a value not on the diagonal (!) - if(!fTools::equalZero(fSy) || !fTools::equalZero(fSz)) - { - Impl3DHomMatrix aShearYZMat; - - aShearYZMat.set(1, 0, fSy); - aShearYZMat.set(2, 0, fSz); - - mpImpl->doMulMatrix(aShearYZMat); - } - } - - void B3DHomMatrix::shearXZ(double fSx, double fSz) - { - // #i76239# do not test againt 1.0, but against 0.0. We are talking about a value not on the diagonal (!) - if(!fTools::equalZero(fSx) || !fTools::equalZero(fSz)) - { - Impl3DHomMatrix aShearXZMat; - - aShearXZMat.set(0, 1, fSx); - aShearXZMat.set(2, 1, fSz); - - mpImpl->doMulMatrix(aShearXZMat); - } - } - void B3DHomMatrix::frustum(double fLeft, double fRight, double fBottom, double fTop, double fNear, double fFar) { const double fZero(0.0); diff --git a/basegfx/source/polygon/b2dpolypolygon.cxx b/basegfx/source/polygon/b2dpolypolygon.cxx index 4c8ab7b44a45..b55af03e9575 100644 --- a/basegfx/source/polygon/b2dpolypolygon.cxx +++ b/basegfx/source/polygon/b2dpolypolygon.cxx @@ -93,21 +93,10 @@ public: void insert(sal_uInt32 nIndex, const basegfx::B2DPolyPolygon& rPolyPolygon) { - const sal_uInt32 nCount = rPolyPolygon.count(); - - if(nCount) - { - // add nCount polygons from rPolyPolygon - maPolygons.reserve(maPolygons.size() + nCount); - PolygonVector::iterator aIndex(maPolygons.begin()); - aIndex += nIndex; - - for(sal_uInt32 a(0L); a < nCount; a++) - { - aIndex = maPolygons.insert(aIndex, rPolyPolygon.getB2DPolygon(a)); - ++aIndex; - } - } + // add all polygons from rPolyPolygon + PolygonVector::iterator aIndex(maPolygons.begin()); + aIndex += nIndex; + maPolygons.insert(aIndex, rPolyPolygon.begin(), rPolyPolygon.end()); } void remove(sal_uInt32 nIndex, sal_uInt32 nCount) diff --git a/basegfx/source/polygon/b2dsvgpolypolygon.cxx b/basegfx/source/polygon/b2dsvgpolypolygon.cxx index 50a04dbaa075..074cfd9e25d5 100644 --- a/basegfx/source/polygon/b2dsvgpolypolygon.cxx +++ b/basegfx/source/polygon/b2dsvgpolypolygon.cxx @@ -787,10 +787,7 @@ namespace basegfx // (since // createPolygonFromEllipseSegment() // normalizes to e.g. cw arc) - const bool bLessThanPi(fmod(fTheta2+2*M_PI-fTheta1, - 2*M_PI)<M_PI); - const bool bFlipSegment( (bLargeArcFlag!=0) == bLessThanPi ); - if( bFlipSegment ) + if( !bSweepFlag ) std::swap(fTheta1,fTheta2); // finally, create bezier polygon from this @@ -812,7 +809,7 @@ namespace basegfx // always creates arcs that are // positively oriented - flip polygon // if we swapped angles above - if( bFlipSegment ) + if( !bSweepFlag ) aSegment.flip(); aCurrPoly.append(aSegment); } diff --git a/basegfx/source/tools/unotools.cxx b/basegfx/source/tools/unotools.cxx new file mode 100644 index 000000000000..710568b8d737 --- /dev/null +++ b/basegfx/source/tools/unotools.cxx @@ -0,0 +1,264 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * Portions Copright 2011 Thorsten Behrens <tbehrens@novell.com> + * + * 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_basegfx.hxx" + +#include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp> +#include <com/sun/star/drawing/PointSequence.hpp> +#include <com/sun/star/drawing/FlagSequence.hpp> +#include <basegfx/polygon/b2dpolypolygontools.hxx> +#include <basegfx/polygon/b2dpolygontools.hxx> +#include <basegfx/polygon/b2dpolygon.hxx> +#include <basegfx/curve/b2dcubicbezier.hxx> + +#include <basegfx/tools/unotools.hxx> +#include <comphelper/sequence.hxx> + + +using namespace ::com::sun::star; + +namespace basegfx +{ +namespace unotools +{ + + B2DPolyPolygon polyPolygonBezierToB2DPolyPolygon(const drawing::PolyPolygonBezierCoords& rSourcePolyPolygon) + throw( lang::IllegalArgumentException ) + { + const sal_Int32 nOuterSequenceCount(rSourcePolyPolygon.Coordinates.getLength()); + B2DPolyPolygon aNewPolyPolygon; + + if(rSourcePolyPolygon.Flags.getLength() != nOuterSequenceCount) + throw lang::IllegalArgumentException(); + + // get pointers to inner sequence + const drawing::PointSequence* pInnerSequence = rSourcePolyPolygon.Coordinates.getConstArray(); + const drawing::FlagSequence* pInnerSequenceFlags = rSourcePolyPolygon.Flags.getConstArray(); + + for(sal_Int32 a(0); a < nOuterSequenceCount; a++) + { + const sal_Int32 nInnerSequenceCount(pInnerSequence->getLength()); + + if(pInnerSequenceFlags->getLength() != nInnerSequenceCount) + throw lang::IllegalArgumentException(); + + // prepare new polygon + basegfx::B2DPolygon aNewPolygon; + const awt::Point* pArray = pInnerSequence->getConstArray(); + const drawing::PolygonFlags* pArrayFlags = pInnerSequenceFlags->getConstArray(); + + // get first point and flag + basegfx::B2DPoint aNewCoordinatePair(pArray->X, pArray->Y); pArray++; + drawing::PolygonFlags ePolyFlag(*pArrayFlags); pArrayFlags++; + basegfx::B2DPoint aControlA; + basegfx::B2DPoint aControlB; + + // first point is not allowed to be a control point + if(drawing::PolygonFlags_CONTROL == ePolyFlag) + throw lang::IllegalArgumentException(); + + // add first point as start point + aNewPolygon.append(aNewCoordinatePair); + for(sal_Int32 b(1); b < nInnerSequenceCount;) + { + // prepare loop + bool bControlA(false); + bool bControlB(false); + + // get next point and flag + aNewCoordinatePair = basegfx::B2DPoint(pArray->X, pArray->Y); + ePolyFlag = *pArrayFlags; + pArray++; pArrayFlags++; b++; + + if(b < nInnerSequenceCount && drawing::PolygonFlags_CONTROL == ePolyFlag) + { + aControlA = aNewCoordinatePair; + bControlA = true; + + // get next point and flag + aNewCoordinatePair = basegfx::B2DPoint(pArray->X, pArray->Y); + ePolyFlag = *pArrayFlags; + pArray++; pArrayFlags++; b++; + } + + if(b < nInnerSequenceCount && drawing::PolygonFlags_CONTROL == ePolyFlag) + { + aControlB = aNewCoordinatePair; + bControlB = true; + + // get next point and flag + aNewCoordinatePair = basegfx::B2DPoint(pArray->X, pArray->Y); + ePolyFlag = *pArrayFlags; + pArray++; pArrayFlags++; b++; + } + + // two or no control points are consumed, another one would be an error. + // It's also an error if only one control point was read + if(drawing::PolygonFlags_CONTROL == ePolyFlag || bControlA != bControlB) + throw lang::IllegalArgumentException(); + + // the previous writes used the B2DPolyPoygon -> PolyPolygon converter + // which did not create minimal PolyPolygons, but created all control points + // as null vectors (identical points). Because of the former P(CA)(CB)-norm of + // B2DPolygon and it's unused sign of being the zero-vector and CA and CB being + // relative to P, an empty edge was exported as P == CA == CB. Luckily, the new + // export format can be read without errors by the old OOo-versions, so we need only + // to correct here at read and do not need to export a wrong but compatible version + // for the future. + if(bControlA + && aControlA.equal(aControlB) + && aControlA.equal(aNewPolygon.getB2DPoint(aNewPolygon.count() - 1))) + { + bControlA = bControlB = false; + } + + if(bControlA) + { + // add bezier edge + aNewPolygon.appendBezierSegment(aControlA, aControlB, aNewCoordinatePair); + } + else + { + // add edge + aNewPolygon.append(aNewCoordinatePair); + } + } + + // next sequence + pInnerSequence++; + pInnerSequenceFlags++; + + // #i72807# API import uses old line start/end-equal definition for closed, + // so we need to correct this to closed state here + basegfx::tools::checkClosed(aNewPolygon); + + // add new subpolygon + aNewPolyPolygon.append(aNewPolygon); + } + + return aNewPolyPolygon; + } + + ///////////////////////////////////////////////////////////////////////////////// + + void b2DPolyPolygonToPolyPolygonBezier( const basegfx::B2DPolyPolygon& rPolyPoly, + drawing::PolyPolygonBezierCoords& rRetval ) + { + rRetval.Coordinates.realloc(rPolyPoly.count()); + rRetval.Flags.realloc(rPolyPoly.count()); + + drawing::PointSequence* pOuterSequence = rRetval.Coordinates.getArray(); + drawing::FlagSequence* pOuterFlags = rRetval.Flags.getArray(); + + for(sal_uInt32 a=0;a<rPolyPoly.count();a++) + { + const B2DPolygon& rPoly = rPolyPoly.getB2DPolygon(a); + sal_uInt32 nCount(rPoly.count()); + const bool bClosed(rPoly.isClosed()); + + // calculate input vertex count + const sal_uInt32 nLoopCount(bClosed ? nCount : (nCount ? nCount - 1L : 0L )); + + std::vector<awt::Point> aPoints; aPoints.reserve(nLoopCount); + std::vector<drawing::PolygonFlags> aFlags; aFlags.reserve(nLoopCount); + + // prepare insert index and current point + basegfx::B2DCubicBezier aBezier; + aBezier.setStartPoint(rPoly.getB2DPoint(0)); + + for(sal_uInt32 b(0L); b<nLoopCount; b++) + { + // add current point (always) and remember StartPointIndex for evtl. later corrections + const awt::Point aStartPoint(fround(aBezier.getStartPoint().getX()), + fround(aBezier.getStartPoint().getY())); + const sal_uInt32 nStartPointIndex(aPoints.size()); + aPoints.push_back(aStartPoint); + aFlags.push_back(drawing::PolygonFlags_NORMAL); + + // prepare next segment + const sal_uInt32 nNextIndex((b + 1) % nCount); + aBezier.setEndPoint(rPoly.getB2DPoint(nNextIndex)); + aBezier.setControlPointA(rPoly.getNextControlPoint(b)); + aBezier.setControlPointB(rPoly.getPrevControlPoint(nNextIndex)); + + if(aBezier.isBezier()) + { + // if one is used, add always two control points due to the old schema + aPoints.push_back( awt::Point(fround(aBezier.getControlPointA().getX()), + fround(aBezier.getControlPointA().getY())) ); + aFlags.push_back(drawing::PolygonFlags_CONTROL); + + aPoints.push_back( awt::Point(fround(aBezier.getControlPointB().getX()), + fround(aBezier.getControlPointB().getY())) ); + aFlags.push_back(drawing::PolygonFlags_CONTROL); + } + + // test continuity with previous control point to set flag value + if(aBezier.getControlPointA() != aBezier.getStartPoint() && (bClosed || b)) + { + const basegfx::B2VectorContinuity eCont(rPoly.getContinuityInPoint(b)); + + if(basegfx::CONTINUITY_C1 == eCont) + { + aFlags[nStartPointIndex] = drawing::PolygonFlags_SMOOTH; + } + else if(basegfx::CONTINUITY_C2 == eCont) + { + aFlags[nStartPointIndex] = drawing::PolygonFlags_SYMMETRIC; + } + } + + // prepare next polygon step + aBezier.setStartPoint(aBezier.getEndPoint()); + } + + if(bClosed) + { + // add first point again as closing point due to old definition + aPoints.push_back( aPoints[0] ); + aFlags.push_back(drawing::PolygonFlags_NORMAL); + } + else + { + // add last point as closing point + const basegfx::B2DPoint aClosingPoint(rPoly.getB2DPoint(nCount - 1L)); + const awt::Point aEnd(fround(aClosingPoint.getX()), + fround(aClosingPoint.getY())); + aPoints.push_back(aEnd); + aFlags.push_back(drawing::PolygonFlags_NORMAL); + } + + *pOuterSequence++ = comphelper::containerToSequence(aPoints); + *pOuterFlags++ = comphelper::containerToSequence(aFlags); + } + } + +} +} diff --git a/basegfx/test/basegfx3d.cxx b/basegfx/test/basegfx3d.cxx index 5ac16fafc6a4..691b51a5f981 100644 --- a/basegfx/test/basegfx3d.cxx +++ b/basegfx/test/basegfx3d.cxx @@ -67,33 +67,6 @@ public: }; // class b3dhommatrix -class b3dhompoint : public CppUnit::TestFixture -{ -public: - // initialise your test code values here. - void setUp() - { - } - - void tearDown() - { - } - - // insert your test code here. - void EmptyMethod() - { - } - - // Change the following lines only, if you add, remove or rename - // member functions of the current class, - // because these macros are need by auto register mechanism. - - CPPUNIT_TEST_SUITE(b3dhompoint); - CPPUNIT_TEST(EmptyMethod); - CPPUNIT_TEST_SUITE_END(); -}; // class b3dhompoint - - class b3dpoint : public CppUnit::TestFixture { public: @@ -207,7 +180,6 @@ public: // ----------------------------------------------------------------------------- CPPUNIT_TEST_SUITE_REGISTRATION(basegfx3d::b3dhommatrix); -CPPUNIT_TEST_SUITE_REGISTRATION(basegfx3d::b3dhompoint); CPPUNIT_TEST_SUITE_REGISTRATION(basegfx3d::b3dpoint); CPPUNIT_TEST_SUITE_REGISTRATION(basegfx3d::b3drange); CPPUNIT_TEST_SUITE_REGISTRATION(basegfx3d::b3dtuple); diff --git a/canvas/prj/build.lst b/canvas/prj/build.lst index 79acfc94af5f..7d6a51be6a5f 100644 --- a/canvas/prj/build.lst +++ b/canvas/prj/build.lst @@ -1,3 +1,3 @@ -cv canvas : javaunohelper comphelper cppuhelper offuh unoil tools svtools vcl basegfx CAIRO:cairo LIBXSLT:libxslt NULL +cv canvas : javaunohelper comphelper cppuhelper offapi unoil tools svtools vcl basegfx CAIRO:cairo LIBXSLT:libxslt NULL cv canvas\prj nmake - all cv_prj NULL diff --git a/canvas/prj/d.lst b/canvas/prj/d.lst index e69de29bb2d1..cde5ebec26c2 100644 --- a/canvas/prj/d.lst +++ b/canvas/prj/d.lst @@ -0,0 +1 @@ +..\%__SRC%\lib\*.a %_DEST%\lib\*.a diff --git a/canvas/source/cairo/cairo_canvashelper.cxx b/canvas/source/cairo/cairo_canvashelper.cxx index 2f1e39b8a19e..ebf0e1aac3e4 100644 --- a/canvas/source/cairo/cairo_canvashelper.cxx +++ b/canvas/source/cairo/cairo_canvashelper.cxx @@ -128,13 +128,11 @@ namespace cairocanvas { if( rColor.getLength() > 3 ) { - const double alpha = rColor[3]; - cairo_set_source_rgba( pCairo, - alpha*rColor[0], - alpha*rColor[1], - alpha*rColor[2], - alpha ); + rColor[0], + rColor[1], + rColor[2], + rColor[3] ); } else if( rColor.getLength() == 3 ) cairo_set_source_rgb( pCairo, diff --git a/canvas/source/cairo/cairo_quartz_cairo.cxx b/canvas/source/cairo/cairo_quartz_cairo.cxx index e24ba9c3ab80..23702f64b3ac 100644 --- a/canvas/source/cairo/cairo_quartz_cairo.cxx +++ b/canvas/source/cairo/cairo_quartz_cairo.cxx @@ -29,9 +29,9 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_canvas.hxx" -#ifdef QUARTZ +#if defined QUARTZ || defined IOS /************************************************************************ - * Mac OS X/Quartz surface backend for OpenOffice.org Cairo Canvas * + * Mac OS X/Quartz and iOS surface backend for OpenOffice.org Cairo Canvas * ************************************************************************/ #include <osl/diagnose.h> @@ -205,13 +205,19 @@ namespace cairo CGContextRef mrContext = getCGContext(); if (!mrContext) return; - +#ifndef IOS [mpView lockFocus]; +#endif +#ifndef IOS /** * This code is using same screen update code as in VCL (esp. AquaSalGraphics::UpdateWindow() ) */ CGContextRef rViewContext = reinterpret_cast<CGContextRef>([[NSGraphicsContext currentContext] graphicsPort]); +#else + // Just guessing for now... + CGContextRef rViewContext = UIGraphicsGetCurrentContext(); +#endif CGImageRef xImage = CGBitmapContextCreateImage(mrContext); CGContextDrawImage(rViewContext, CGRectMake( 0, 0, @@ -220,8 +226,9 @@ namespace cairo xImage); CGImageRelease( xImage ); CGContextFlush( rViewContext ); - +#ifndef IOS [mpView unlockFocus]; +#endif } /** diff --git a/canvas/source/cairo/cairo_quartz_cairo.hxx b/canvas/source/cairo/cairo_quartz_cairo.hxx index 0c6a7d56db95..5d131d735ab9 100644 --- a/canvas/source/cairo/cairo_quartz_cairo.hxx +++ b/canvas/source/cairo/cairo_quartz_cairo.hxx @@ -32,7 +32,13 @@ #include "cairo_cairo.hxx" #include "premac.h" +#include <TargetConditionals.h> +#if !defined(TARGET_OS_IPHONE) || !TARGET_OS_IPHONE #include <Cocoa/Cocoa.h> +#else +#include <UIKit/UIKit.h> +#define NSView UIView +#endif #include <cairo-quartz.h> #include "postmac.h" diff --git a/canvas/source/cairo/cairo_spritecanvashelper.cxx b/canvas/source/cairo/cairo_spritecanvashelper.cxx index cdac16cbf8b7..75a8884df252 100644 --- a/canvas/source/cairo/cairo_spritecanvashelper.cxx +++ b/canvas/source/cairo/cairo_spritecanvashelper.cxx @@ -524,8 +524,8 @@ namespace cairocanvas ::cairo::SurfaceSharedPtr SpriteCanvasHelper::getCompositingSurface( const ::basegfx::B2ISize& rNeededSize ) { - if( rNeededSize.getX() < maCompositingSurfaceSize.getX() || - rNeededSize.getY() < maCompositingSurfaceSize.getY() ) + if( rNeededSize.getX() > maCompositingSurfaceSize.getX() || + rNeededSize.getY() > maCompositingSurfaceSize.getY() ) { // need to give buffer more size mpCompositingSurface.reset(); diff --git a/canvas/source/cairo/cairo_textlayout.cxx b/canvas/source/cairo/cairo_textlayout.cxx index 9c1501a8245b..eb5a3358b460 100644 --- a/canvas/source/cairo/cairo_textlayout.cxx +++ b/canvas/source/cairo/cairo_textlayout.cxx @@ -352,7 +352,7 @@ namespace cairocanvas **/ bool TextLayout::isCairoRenderable(SystemFontData aSysFontData) const { -#if defined UNX && !defined QUARTZ +#if defined UNX && !defined QUARTZ && !defined IOS // is font usable? if (!aSysFontData.nFontId) return false; #endif @@ -502,9 +502,14 @@ namespace cairocanvas cairo_font_face_t* font_face = NULL; #ifdef CAIRO_HAS_QUARTZ_SURFACE + + #ifdef QUARTZ // TODO: use cairo_quartz_font_face_create_for_cgfont(cgFont) // when CGFont (Mac OS X 10.5 API) is provided by the AQUA VCL backend. font_face = cairo_quartz_font_face_create_for_atsu_font_id((ATSUFontID) rSysFontData.aATSUFontID); + #else // iOS + font_face = cairo_quartz_font_face_create_for_cgfont( rSysFontData.rFont); + #endif #elif defined CAIRO_HAS_WIN32_SURFACE #if (OSL_DEBUG_LEVEL > 1) diff --git a/canvas/source/factory/cf_service.cxx b/canvas/source/factory/cf_service.cxx index e96f31f5ba7a..316c4b7aecff 100644 --- a/canvas/source/factory/cf_service.cxx +++ b/canvas/source/factory/cf_service.cxx @@ -527,12 +527,6 @@ const ::cppu::ImplementationEntry s_entries [] = { extern "C" { -SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( - const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ ) -{ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} - SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( sal_Char const * pImplName, lang::XMultiServiceFactory * pServiceManager, diff --git a/comphelper/Library_comphelp.mk b/comphelper/Library_comphelp.mk index d00078860cc4..acacafccdf9b 100644 --- a/comphelper/Library_comphelp.mk +++ b/comphelper/Library_comphelp.mk @@ -37,7 +37,6 @@ $(eval $(call gb_Library_set_include,comphelper,\ -I$(realpath $(SRCDIR)/comphelper/inc/pch) \ -I$(realpath $(SRCDIR)/comphelper/source/inc) \ $$(INCLUDE) \ - -I$(OUTDIR)/inc/offuh \ )) $(eval $(call gb_Library_add_defs,comphelper,\ @@ -52,6 +51,11 @@ $(eval $(call gb_Library_add_linked_libs,comphelper,\ $(gb_STDLIBS) \ )) +$(eval $(call gb_Library_add_api,comphelper,\ + udkapi \ + offapi \ +)) + $(eval $(call gb_Library_add_exception_objects,comphelper,\ comphelper/source/compare/AnyCompareFactory \ comphelper/source/container/IndexedPropertyValuesContainer \ diff --git a/comphelper/inc/comphelper/componentmodule.hxx b/comphelper/inc/comphelper/componentmodule.hxx index 4bc917ef13d3..5893313c8497 100644 --- a/comphelper/inc/comphelper/componentmodule.hxx +++ b/comphelper/inc/comphelper/componentmodule.hxx @@ -270,103 +270,6 @@ namespace comphelper ) ); } - //========================================================================== - //= helpers - //========================================================================== - - //========================================================================== - // declaring a OModule for a component library - -#define DECLARE_COMPONENT_MODULE( ModuleClass, ClientClass ) \ - /* -------------------------------------------------------------------- */ \ - class ModuleClass : public ::comphelper::OModule \ - { \ - friend struct ModuleClass##Creator; \ - typedef ::comphelper::OModule BaseClass; \ - \ - public: \ - static ModuleClass& getInstance(); \ - \ - private: \ - ModuleClass(); \ - }; \ - \ - /* -------------------------------------------------------------------- */ \ - class ClientClass : public ::comphelper::OModuleClient \ - { \ - private: \ - typedef ::comphelper::OModuleClient BaseClass; \ - \ - public: \ - ClientClass() : BaseClass( ModuleClass::getInstance() ) \ - { \ - } \ - }; \ - \ - /* -------------------------------------------------------------------- */ \ - template < class TYPE > \ - class OAutoRegistration : public ::comphelper::OAutoRegistration< TYPE > \ - { \ - private: \ - typedef ::comphelper::OAutoRegistration< TYPE > BaseClass; \ - \ - public: \ - OAutoRegistration() : BaseClass( ModuleClass::getInstance() ) \ - { \ - } \ - }; \ - /* -------------------------------------------------------------------- */ \ - template < class TYPE > \ - class OSingletonRegistration : public ::comphelper::OSingletonRegistration< TYPE > \ - { \ - private: \ - typedef ::comphelper::OSingletonRegistration< TYPE > BaseClass; \ - \ - public: \ - OSingletonRegistration() : BaseClass( ModuleClass::getInstance() ) \ - { \ - } \ - }; - - //========================================================================== - //= implementing a OModule for a component library - -#define IMPLEMENT_COMPONENT_MODULE( ModuleClass ) \ - struct ModuleClass##Creator \ - { \ - ModuleClass m_aModuleClass; \ - }; \ - namespace \ - { \ - class the##ModuleClass##Instance : public rtl::Static<ModuleClass##Creator, the##ModuleClass##Instance> {}; \ - } \ - \ - ModuleClass::ModuleClass() \ - :BaseClass() \ - { \ - } \ - \ - ModuleClass& ModuleClass::getInstance() \ - { \ - return the##ModuleClass##Instance::get().m_aModuleClass; \ - } \ - - //========================================================================== - //= implementing the API of a component library (component_*) - -#define IMPLEMENT_COMPONENT_LIBRARY_API( module_class, initializer_function ) \ - extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( \ - const sal_Char **ppEnvTypeName, uno_Environment ** /*ppEnv*/ ) \ - { \ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; \ - } \ - extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( \ - const sal_Char* pImplementationName, void* pServiceManager, void* pRegistryKey ) \ - { \ - initializer_function(); \ - return module_class::getInstance().getComponentFactory( pImplementationName, pServiceManager, pRegistryKey ); \ - } - //........................................................................ } // namespace comphelper //........................................................................ diff --git a/comphelper/inc/comphelper/servicedecl.hxx b/comphelper/inc/comphelper/servicedecl.hxx index b025cc7ffdce..c5ab4b79f5f7 100644 --- a/comphelper/inc/comphelper/servicedecl.hxx +++ b/comphelper/inc/comphelper/servicedecl.hxx @@ -387,12 +387,6 @@ BOOST_PP_REPEAT_FROM_TO(1, COMPHELPER_SERVICEDECL_COMPONENT_HELPER_MAX_ARGS, #define COMPHELPER_SERVICEDECL_make_exports(varargs_ ) \ extern "C" \ { \ - SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( const sal_Char** ppEnvTypeName, \ - uno_Environment** /*ppEnv*/ ) \ - { \ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; \ - } \ - \ SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( sal_Char const* pImplName, \ ::com::sun::star::lang::XMultiServiceFactory* pServiceManager, \ ::com::sun::star::registry::XRegistryKey* pRegistryKey ) \ diff --git a/comphelper/inc/comphelper/storagehelper.hxx b/comphelper/inc/comphelper/storagehelper.hxx index 00da529ab967..078bfb81c885 100644 --- a/comphelper/inc/comphelper/storagehelper.hxx +++ b/comphelper/inc/comphelper/storagehelper.hxx @@ -128,14 +128,6 @@ public: const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage ) throw ( ::com::sun::star::uno::Exception ); - // The followin methods are related to creation of a storage of specified format - static ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > - GetTemporaryStorageOfFormat( - const ::rtl::OUString& aFormat, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory - = ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >() ) - throw ( ::com::sun::star::uno::Exception ); - static ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > GetStorageOfFormatFromURL( const ::rtl::OUString& aFormat, diff --git a/comphelper/prj/build.lst b/comphelper/prj/build.lst index a828870f2dbf..7dde46c47c7e 100644 --- a/comphelper/prj/build.lst +++ b/comphelper/prj/build.lst @@ -1,2 +1,2 @@ -ph comphelper : cppuhelper ucbhelper offuh salhelper LIBXSLT:libxslt NULL +ph comphelper : cppuhelper ucbhelper offapi salhelper LIBXSLT:libxslt NULL ch comphelper\prj nmake - all ch_all NULL diff --git a/comphelper/source/inc/comphelper_module.hxx b/comphelper/source/inc/comphelper_module.hxx index 9f8e32656715..dfa364df1983 100644 --- a/comphelper/source/inc/comphelper_module.hxx +++ b/comphelper/source/inc/comphelper_module.hxx @@ -35,7 +35,55 @@ namespace comphelper { namespace module { //........................................................................ - DECLARE_COMPONENT_MODULE( ComphelperModule, ComphelperModuleClient ) + class ComphelperModule : public ::comphelper::OModule + { + friend struct ComphelperModuleCreator; + typedef ::comphelper::OModule BaseClass; + + public: + static ComphelperModule& getInstance(); + + private: + ComphelperModule(); + }; + + /* -------------------------------------------------------------------- */ + class ComphelperModuleClient : public ::comphelper::OModuleClient + { + private: + typedef ::comphelper::OModuleClient BaseClass; + + public: + ComphelperModuleClient() : BaseClass( ComphelperModule::getInstance() ) + { + } + }; + + /* -------------------------------------------------------------------- */ + template < class TYPE > + class OAutoRegistration : public ::comphelper::OAutoRegistration< TYPE > + { + private: + typedef ::comphelper::OAutoRegistration< TYPE > BaseClass; + + public: + OAutoRegistration() : BaseClass( ComphelperModule::getInstance() ) + { + } + }; + + /* -------------------------------------------------------------------- */ + template < class TYPE > + class OSingletonRegistration : public ::comphelper::OSingletonRegistration< TYPE > + { + private: + typedef ::comphelper::OSingletonRegistration< TYPE > BaseClass; + + public: + OSingletonRegistration() : BaseClass( ComphelperModule::getInstance() ) + { + } + }; //........................................................................ } } // namespace comphelper::module diff --git a/comphelper/source/misc/comphelper_module.cxx b/comphelper/source/misc/comphelper_module.cxx index 8b9ee4221dfc..b2bdad6665cb 100644 --- a/comphelper/source/misc/comphelper_module.cxx +++ b/comphelper/source/misc/comphelper_module.cxx @@ -35,7 +35,24 @@ namespace comphelper { namespace module { //........................................................................ - IMPLEMENT_COMPONENT_MODULE( ComphelperModule ); + struct ComphelperModuleCreator + { + ComphelperModule m_aComphelperModule; + }; + namespace + { + class theComphelperModuleInstance : public rtl::Static<ComphelperModuleCreator, theComphelperModuleInstance> {}; + } + + ComphelperModule::ComphelperModule() + :BaseClass() + { + } + + ComphelperModule& ComphelperModule::getInstance() + { + return theComphelperModuleInstance::get().m_aComphelperModule; + } //........................................................................ } } // namespace comphelper::module diff --git a/comphelper/source/misc/comphelper_services.cxx b/comphelper/source/misc/comphelper_services.cxx index 32d1c53aff93..ad5558fb8ee7 100644 --- a/comphelper/source/misc/comphelper_services.cxx +++ b/comphelper/source/misc/comphelper_services.cxx @@ -85,6 +85,11 @@ namespace comphelper { namespace module } } // namespace comphelper::module //........................................................................ -IMPLEMENT_COMPONENT_LIBRARY_API( ::comphelper::module::ComphelperModule, ::comphelper::module::initializeModule ) +extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( + const sal_Char* pImplementationName, void* pServiceManager, void* pRegistryKey ) +{ + ::comphelper::module::initializeModule(); + return ::comphelper::module::ComphelperModule::getInstance().getComponentFactory( pImplementationName, pServiceManager, pRegistryKey ); +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/misc/storagehelper.cxx b/comphelper/source/misc/storagehelper.cxx index 3441e0a1736f..70b7852b579a 100644 --- a/comphelper/source/misc/storagehelper.cxx +++ b/comphelper/source/misc/storagehelper.cxx @@ -314,23 +314,6 @@ sal_Int32 OStorageHelper::GetXStorageFormat( } // ---------------------------------------------------------------------- -uno::Reference< embed::XStorage > OStorageHelper::GetTemporaryStorageOfFormat( - const ::rtl::OUString& aFormat, - const uno::Reference< lang::XMultiServiceFactory >& xFactory ) - throw ( uno::Exception ) -{ - uno::Reference< lang::XMultiServiceFactory > xFactoryToUse = xFactory.is() ? xFactory : ::comphelper::getProcessServiceFactory(); - if ( !xFactoryToUse.is() ) - throw uno::RuntimeException(); - - uno::Reference< io::XStream > xTmpStream( - xFactoryToUse->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.io.TempFile" ) ) ), - uno::UNO_QUERY_THROW ); - - return GetStorageOfFormatFromStream( aFormat, xTmpStream, embed::ElementModes::READWRITE, xFactoryToUse ); -} - -// ---------------------------------------------------------------------- uno::Reference< embed::XStorage > OStorageHelper::GetStorageOfFormatFromURL( const ::rtl::OUString& aFormat, const ::rtl::OUString& aURL, diff --git a/cppcanvas/prj/build.lst b/cppcanvas/prj/build.lst index 2e4230956e32..bab151c5c142 100644 --- a/cppcanvas/prj/build.lst +++ b/cppcanvas/prj/build.lst @@ -1,2 +1,2 @@ -cx cppcanvas : comphelper cppuhelper offuh tools vcl basegfx canvas NULL +cx cppcanvas : comphelper cppuhelper offapi tools vcl basegfx canvas NULL cx cppcanvas\prj nmake - all cx_prj NULL diff --git a/cppcanvas/source/uno/exports.dxp b/cppcanvas/source/uno/exports.dxp index f0e1c69934bc..70033078921a 100644 --- a/cppcanvas/source/uno/exports.dxp +++ b/cppcanvas/source/uno/exports.dxp @@ -1,2 +1 @@ -component_getImplementationEnvironment component_getFactory diff --git a/cppcanvas/source/uno/exports.map b/cppcanvas/source/uno/exports.map index a488d5d06a43..f1ded4b70d9a 100644 --- a/cppcanvas/source/uno/exports.map +++ b/cppcanvas/source/uno/exports.map @@ -1,7 +1,6 @@ UDK_3_0_0 { global: _ZTI*; _ZTS*; # weak RTTI symbols for C++ exceptions - component_getImplementationEnvironment; component_getFactory; local: *; diff --git a/dtrans/prj/build.lst b/dtrans/prj/build.lst index 6ee2b47d53af..519e1fda37c8 100644 --- a/dtrans/prj/build.lst +++ b/dtrans/prj/build.lst @@ -1,4 +1,4 @@ -dr dtrans : unotools offapi offuh rdbmaker stoc LIBXSLT:libxslt NULL +dr dtrans : unotools offapi DESKTOP:rdbmaker stoc LIBXSLT:libxslt NULL dr dtrans usr1 - all dr_mkout NULL dr dtrans\inc nmake - all dr_inc NULL dr dtrans\source\cnttype nmake - all dr_cnttype dr_generic dr_inc NULL diff --git a/dtrans/source/cnttype/exports.dxp b/dtrans/source/cnttype/exports.dxp index f0e1c69934bc..70033078921a 100644 --- a/dtrans/source/cnttype/exports.dxp +++ b/dtrans/source/cnttype/exports.dxp @@ -1,2 +1 @@ -component_getImplementationEnvironment component_getFactory diff --git a/dtrans/source/cnttype/mctfentry.cxx b/dtrans/source/cnttype/mctfentry.cxx index 5a4df1c21798..6b09a8e69ce6 100644 --- a/dtrans/source/cnttype/mctfentry.cxx +++ b/dtrans/source/cnttype/mctfentry.cxx @@ -83,23 +83,8 @@ namespace } } -//----------------------------------------------------------------------------------------------------------- -// the 3 important functions which will be exported -//----------------------------------------------------------------------------------------------------------- - extern "C" { - -//---------------------------------------------------------------------- -// component_getImplementationEnvironment -//---------------------------------------------------------------------- - -SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( - const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ ) -{ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} - //---------------------------------------------------------------------- // component_getFactory // returns a factory to create XFilePicker-Services diff --git a/dtrans/source/generic/clipboardmanager.cxx b/dtrans/source/generic/clipboardmanager.cxx index 5fdc78b19f4a..d6dc32226037 100644 --- a/dtrans/source/generic/clipboardmanager.cxx +++ b/dtrans/source/generic/clipboardmanager.cxx @@ -219,8 +219,7 @@ void SAL_CALL ClipboardManager::dispose() xComponent->removeEventListener(static_cast < XEventListener * > (this)); xComponent->dispose(); } - - catch(Exception e) + catch (const Exception&) { // exceptions can be safely ignored here. } diff --git a/dtrans/source/generic/dtrans.cxx b/dtrans/source/generic/dtrans.cxx index 7a47d12920a6..c9295644ea80 100644 --- a/dtrans/source/generic/dtrans.cxx +++ b/dtrans/source/generic/dtrans.cxx @@ -46,14 +46,6 @@ extern "C" //================================================================================================== -SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment(const sal_Char ** ppEnvTypeName, - uno_Environment ** /*ppEnv*/ ) -{ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} - -//================================================================================================== - SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, diff --git a/dtrans/source/generic/exports.dxp b/dtrans/source/generic/exports.dxp index f0e1c69934bc..70033078921a 100644 --- a/dtrans/source/generic/exports.dxp +++ b/dtrans/source/generic/exports.dxp @@ -1,2 +1 @@ -component_getImplementationEnvironment component_getFactory diff --git a/dtrans/source/test/test_dtrans.cxx b/dtrans/source/test/test_dtrans.cxx index 3bb0966e286d..d1a2611ca93c 100644 --- a/dtrans/source/test/test_dtrans.cxx +++ b/dtrans/source/test/test_dtrans.cxx @@ -465,13 +465,13 @@ int SAL_CALL main( int argc, const char* argv[] ) xClipboardManager->getClipboard( OUString(RTL_CONSTASCII_USTRINGPARAM("generic")) ); TRACE( "FAILED\n" ); } - catch( NoSuchElementException e ) + catch (const NoSuchElementException&) { TRACE( "passed\n" ); } } - catch ( Exception aException ) + catch (const Exception&) { ENSURE( sal_False, "*** ERROR *** exception caught." ); } diff --git a/dtrans/source/win32/clipb/WinClipbImpl.cxx b/dtrans/source/win32/clipb/WinClipbImpl.cxx index e2755bcd8123..0387f54c676f 100644 --- a/dtrans/source/win32/clipb/WinClipbImpl.cxx +++ b/dtrans/source/win32/clipb/WinClipbImpl.cxx @@ -36,11 +36,11 @@ #include "WinClipbImpl.hxx" #include <systools/win32/comtools.hxx> -#include "..\..\inc\DtObjFactory.hxx" -#include "..\dtobj\APNDataObject.hxx" +#include "../../inc/DtObjFactory.hxx" +#include "../dtobj/APNDataObject.hxx" #include "WinClipboard.hxx" #include <com/sun/star/datatransfer/clipboard/RenderingCapabilities.hpp> -#include "..\dtobj\XNotifyingDataObject.hxx" +#include "../dtobj/XNotifyingDataObject.hxx" #if defined _MSC_VER #pragma warning(push,1) @@ -200,11 +200,11 @@ sal_Int8 SAL_CALL CWinClipbImpl::getRenderingCapabilities( ) throw( RuntimeExce void SAL_CALL CWinClipbImpl::flushClipboard( ) throw( RuntimeException ) { // sollte eigentlich hier stehen: ClearableMutexGuard aGuard( m_ClipContentMutex ); - // geht aber nicht, da FlushClipboard zurückruft und das DataObject - // freigibt und damit würde es einen Deadlock in onReleaseDataObject geben - // FlushClipboard muß synchron sein, damit das runterfahren ggf. erst weitergeht, + // geht aber nicht, da FlushClipboard zurückruft und das DataObject + // freigibt und damit würde es einen Deadlock in onReleaseDataObject geben + // FlushClipboard muß synchron sein, damit das runterfahren ggf. erst weitergeht, // wenn alle Clipboard-Formate gerendert wurden - // die Abfrage ist nötig, damit nur geflusht wird, wenn wir wirklich Clipboardowner + // die Abfrage ist nötig, damit nur geflusht wird, wenn wir wirklich Clipboardowner // sind (ich weiss nicht genau was passiert, wenn man flusht und nicht Clipboard // owner ist). // eventuell kann man aber die Abfrage in den Clipboard STA Thread verlagern, indem diff --git a/dtrans/source/win32/clipb/WinClipbImpl.hxx b/dtrans/source/win32/clipb/WinClipbImpl.hxx index 97e7919ea174..aa7a98d62e00 100644 --- a/dtrans/source/win32/clipb/WinClipbImpl.hxx +++ b/dtrans/source/win32/clipb/WinClipbImpl.hxx @@ -39,7 +39,7 @@ #include <com/sun/star/datatransfer/XTransferable.hpp> #include <com/sun/star/datatransfer/clipboard/XClipboardListener.hpp> #include <com/sun/star/datatransfer/clipboard/XClipboardOwner.hpp> -#include "..\..\inc\MtaOleClipb.hxx" +#include "../../inc/MtaOleClipb.hxx" #if defined _MSC_VER #pragma warning(push,1) diff --git a/dtrans/source/win32/clipb/exports.dxp b/dtrans/source/win32/clipb/exports.dxp index 926e49f5f1a5..70033078921a 100644 --- a/dtrans/source/win32/clipb/exports.dxp +++ b/dtrans/source/win32/clipb/exports.dxp @@ -1,3 +1 @@ -component_getImplementationEnvironment component_getFactory - diff --git a/dtrans/source/win32/clipb/wcbentry.cxx b/dtrans/source/win32/clipb/wcbentry.cxx index cd0de3ebf9ff..5c61e6c3557f 100644 --- a/dtrans/source/win32/clipb/wcbentry.cxx +++ b/dtrans/source/win32/clipb/wcbentry.cxx @@ -81,23 +81,8 @@ namespace } } -//----------------------------------------------------------------------------------------------------------- -// the 3 important functions which will be exported -//----------------------------------------------------------------------------------------------------------- - extern "C" { - -//---------------------------------------------------------------------- -// component_getImplementationEnvironment -//---------------------------------------------------------------------- - -SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( - const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ ) -{ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} - //---------------------------------------------------------------------- // component_getFactory // returns a factory to create XFilePicker-Services diff --git a/dtrans/source/win32/dnd/dndentry.cxx b/dtrans/source/win32/dnd/dndentry.cxx index b089f95b6472..e7b56fcc5cf7 100644 --- a/dtrans/source/win32/dnd/dndentry.cxx +++ b/dtrans/source/win32/dnd/dndentry.cxx @@ -64,16 +64,6 @@ sal_Bool SAL_CALL component_canUnload( TimeValue *pTime ) } //---------------------------------------------------------------------- -// component_getImplementationEnvironment -//---------------------------------------------------------------------- - -SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( - const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ ) -{ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} - -//---------------------------------------------------------------------- // component_getFactory // returns a factory to create XFilePicker-Services //---------------------------------------------------------------------- diff --git a/dtrans/source/win32/dnd/exports.dxp b/dtrans/source/win32/dnd/exports.dxp index f0e1c69934bc..70033078921a 100644 --- a/dtrans/source/win32/dnd/exports.dxp +++ b/dtrans/source/win32/dnd/exports.dxp @@ -1,2 +1 @@ -component_getImplementationEnvironment component_getFactory diff --git a/dtrans/source/win32/dtobj/DOTransferable.cxx b/dtrans/source/win32/dtobj/DOTransferable.cxx index f63e13b59ae7..561204cc5c4c 100644 --- a/dtrans/source/win32/dtobj/DOTransferable.cxx +++ b/dtrans/source/win32/dtobj/DOTransferable.cxx @@ -36,10 +36,10 @@ #include <rtl/process.h> #include "DOTransferable.hxx" -#include "..\misc\ImplHelper.hxx" -#include "..\misc\WinClip.hxx" +#include "../misc/ImplHelper.hxx" +#include "../misc/WinClip.hxx" #include "DTransHelper.hxx" -#include "..\misc\ImplHelper.hxx" +#include "../misc/ImplHelper.hxx" #include "TxtCnvtHlp.hxx" #include "MimeAttrib.hxx" #include "FmtFilter.hxx" diff --git a/dtrans/source/win32/dtobj/DTransHelper.hxx b/dtrans/source/win32/dtobj/DTransHelper.hxx index 0e6003211f90..9b2db7fbec6d 100644 --- a/dtrans/source/win32/dtobj/DTransHelper.hxx +++ b/dtrans/source/win32/dtobj/DTransHelper.hxx @@ -41,7 +41,7 @@ #if defined _MSC_VER #pragma warning(pop) #endif -#include "..\misc\WinClip.hxx" +#include "../misc/WinClip.hxx" //------------------------------------------------------------------------ // defines diff --git a/dtrans/source/win32/dtobj/DataFmtTransl.cxx b/dtrans/source/win32/dtobj/DataFmtTransl.cxx index a1d56a562c53..98e4bf2f62e0 100644 --- a/dtrans/source/win32/dtobj/DataFmtTransl.cxx +++ b/dtrans/source/win32/dtobj/DataFmtTransl.cxx @@ -36,8 +36,8 @@ #include <rtl/string.hxx> #include <osl/diagnose.h> #include <rtl/tencinfo.h> -#include "..\misc\ImplHelper.hxx" -#include "..\misc\WinClip.hxx" +#include "../misc/ImplHelper.hxx" +#include "../misc/WinClip.hxx" #include "MimeAttrib.hxx" #include "DTransHelper.hxx" #include <rtl/string.h> diff --git a/dtrans/source/win32/dtobj/DtObjFactory.cxx b/dtrans/source/win32/dtobj/DtObjFactory.cxx index 0f69b389e8ce..c7cab6086195 100644 --- a/dtrans/source/win32/dtobj/DtObjFactory.cxx +++ b/dtrans/source/win32/dtobj/DtObjFactory.cxx @@ -32,7 +32,7 @@ //------------------------------------------------------------------------ // includes //------------------------------------------------------------------------ -#include "..\..\inc\DtObjFactory.hxx" +#include "../../inc/DtObjFactory.hxx" #include "XTDataObject.hxx" diff --git a/dtrans/source/win32/dtobj/Fetc.cxx b/dtrans/source/win32/dtobj/Fetc.cxx index f9bbe856436e..faa453569910 100644 --- a/dtrans/source/win32/dtobj/Fetc.cxx +++ b/dtrans/source/win32/dtobj/Fetc.cxx @@ -34,7 +34,7 @@ //------------------------------------------------------------------------ #include <osl/diagnose.h> #include "Fetc.hxx" -#include "..\misc\ImplHelper.hxx" +#include "../misc/ImplHelper.hxx" //------------------------------------------------------------------------ // diff --git a/dtrans/source/win32/dtobj/FetcList.cxx b/dtrans/source/win32/dtobj/FetcList.cxx index dec172f01d84..fdf8ac4487ac 100644 --- a/dtrans/source/win32/dtobj/FetcList.cxx +++ b/dtrans/source/win32/dtobj/FetcList.cxx @@ -39,8 +39,8 @@ #include <com/sun/star/datatransfer/XMimeContentType.hpp> #include "DataFmtTransl.hxx" -#include "..\misc\ImplHelper.hxx" -#include "..\misc\WinClip.hxx" +#include "../misc/ImplHelper.hxx" +#include "../misc/WinClip.hxx" #include <algorithm> diff --git a/dtrans/source/win32/dtobj/FmtFilter.cxx b/dtrans/source/win32/dtobj/FmtFilter.cxx index 677d382df729..099ee71d9263 100644 --- a/dtrans/source/win32/dtobj/FmtFilter.cxx +++ b/dtrans/source/win32/dtobj/FmtFilter.cxx @@ -36,9 +36,9 @@ #pragma warning(push,1) #pragma warning(disable:4917) #endif -#include <Shobjidl.h> +#include <shobjidl.h> #include <shlguid.h> -#include <ObjIdl.h> +#include <objidl.h> #include <shellapi.h> #if defined _MSC_VER #pragma warning(pop) diff --git a/dtrans/source/win32/dtobj/TxtCnvtHlp.cxx b/dtrans/source/win32/dtobj/TxtCnvtHlp.cxx index 669ee78eff6d..d11eec3cfbe2 100644 --- a/dtrans/source/win32/dtobj/TxtCnvtHlp.cxx +++ b/dtrans/source/win32/dtobj/TxtCnvtHlp.cxx @@ -35,7 +35,7 @@ #include <osl/diagnose.h> #include "TxtCnvtHlp.hxx" #include "DTransHelper.hxx" -#include "..\misc\ImplHelper.hxx" +#include "../misc/ImplHelper.hxx" using namespace ::com::sun::star::datatransfer; using namespace ::com::sun::star::uno; diff --git a/dtrans/source/win32/dtobj/XNotifyingDataObject.cxx b/dtrans/source/win32/dtobj/XNotifyingDataObject.cxx index e23ec150f1d4..fe0c9896fb08 100644 --- a/dtrans/source/win32/dtobj/XNotifyingDataObject.cxx +++ b/dtrans/source/win32/dtobj/XNotifyingDataObject.cxx @@ -30,9 +30,9 @@ #include "precompiled_dtrans.hxx" #include <osl/diagnose.h> #include "XNotifyingDataObject.hxx" -#include "..\clipb\WinClipbImpl.hxx" -#include "..\clipb\WinClipboard.hxx" -#include "..\..\inc\DtObjFactory.hxx" +#include "../clipb/WinClipbImpl.hxx" +#include "../clipb/WinClipboard.hxx" +#include "../../inc/DtObjFactory.hxx" #ifdef __MINGW32__ #define __uuidof(I) IID_##I diff --git a/dtrans/source/win32/dtobj/XTDataObject.cxx b/dtrans/source/win32/dtobj/XTDataObject.cxx index e263f7e58292..82b18dd3185f 100644 --- a/dtrans/source/win32/dtobj/XTDataObject.cxx +++ b/dtrans/source/win32/dtobj/XTDataObject.cxx @@ -36,7 +36,7 @@ #include "XTDataObject.hxx" #include <com/sun/star/datatransfer/DataFlavor.hpp> -#include "..\misc\ImplHelper.hxx" +#include "../misc/ImplHelper.hxx" #include "DTransHelper.hxx" #include "TxtCnvtHlp.hxx" #include <com/sun/star/datatransfer/clipboard/XClipboardEx.hpp> diff --git a/dtrans/source/win32/ftransl/exports.dxp b/dtrans/source/win32/ftransl/exports.dxp index f0e1c69934bc..70033078921a 100644 --- a/dtrans/source/win32/ftransl/exports.dxp +++ b/dtrans/source/win32/ftransl/exports.dxp @@ -1,2 +1 @@ -component_getImplementationEnvironment component_getFactory diff --git a/dtrans/source/win32/ftransl/ftransl.cxx b/dtrans/source/win32/ftransl/ftransl.cxx index 97bbe2b6634c..24e81e2b28a5 100644 --- a/dtrans/source/win32/ftransl/ftransl.cxx +++ b/dtrans/source/win32/ftransl/ftransl.cxx @@ -36,7 +36,7 @@ #include "ftransl.hxx" #include <com/sun/star/datatransfer/XMimeContentType.hpp> -#include "..\misc\ImplHelper.hxx" +#include "../misc/ImplHelper.hxx" #if defined _MSC_VER #pragma warning(push,1) diff --git a/dtrans/source/win32/ftransl/ftransl.hxx b/dtrans/source/win32/ftransl/ftransl.hxx index 7adbfdae61a2..a63d308bb93e 100644 --- a/dtrans/source/win32/ftransl/ftransl.hxx +++ b/dtrans/source/win32/ftransl/ftransl.hxx @@ -40,7 +40,7 @@ #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/datatransfer/XDataFormatTranslator.hpp> #include <com/sun/star/datatransfer/XMimeContentTypeFactory.hpp> -#include "..\misc\WinClip.hxx" +#include "../misc/WinClip.hxx" #include <vector> diff --git a/dtrans/source/win32/ftransl/ftranslentry.cxx b/dtrans/source/win32/ftransl/ftranslentry.cxx index fb0655ead9cd..e519b5361102 100644 --- a/dtrans/source/win32/ftransl/ftranslentry.cxx +++ b/dtrans/source/win32/ftransl/ftranslentry.cxx @@ -84,23 +84,8 @@ namespace } } -//----------------------------------------------------------------------------------------------------------- -// the 3 important functions which will be exported -//----------------------------------------------------------------------------------------------------------- - extern "C" { - -//---------------------------------------------------------------------- -// component_getImplementationEnvironment -//---------------------------------------------------------------------- - -SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( - const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ ) -{ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} - //---------------------------------------------------------------------- // component_getFactory // returns a factory to create XFilePicker-Services diff --git a/dtrans/source/win32/misc/ImplHelper.cxx b/dtrans/source/win32/misc/ImplHelper.cxx index c0db923d55d4..0a189577d880 100644 --- a/dtrans/source/win32/misc/ImplHelper.cxx +++ b/dtrans/source/win32/misc/ImplHelper.cxx @@ -47,7 +47,7 @@ #pragma warning(pop) #endif #ifdef __MINGW32__ -#include <excpt.h> +#include <sehandler.hxx> #endif //------------------------------------------------------------------------ @@ -188,7 +188,7 @@ sal_Bool SAL_CALL IsOEMCP( sal_uInt32 codepage ) 869, 874, 932, 936, 949, 950, 1361 }; for ( sal_Int8 i = 0; i < ( sizeof( arrOEMCP )/sizeof( sal_uInt32 ) ); ++i ) - if ( arrOEMCP[i] == codepage ) + if ( (sal_uInt32) arrOEMCP[i] == codepage ) return sal_True; return sal_False; diff --git a/dtrans/source/win32/mtaole/MtaOleClipb.cxx b/dtrans/source/win32/mtaole/MtaOleClipb.cxx index ee6da2ee5628..89a41edb2300 100644 --- a/dtrans/source/win32/mtaole/MtaOleClipb.cxx +++ b/dtrans/source/win32/mtaole/MtaOleClipb.cxx @@ -50,7 +50,7 @@ //#define UNICODE #include <osl/diagnose.h> -#include "..\..\inc\MtaOleClipb.hxx" +#include "../../inc/MtaOleClipb.hxx" #include <osl/conditn.hxx> #include <wchar.h> diff --git a/dtrans/source/win32/workbench/XTDo.cxx b/dtrans/source/win32/workbench/XTDo.cxx index 050cc349a41d..e036d1732336 100644 --- a/dtrans/source/win32/workbench/XTDo.cxx +++ b/dtrans/source/win32/workbench/XTDo.cxx @@ -34,7 +34,7 @@ //------------------------------------------------------------------------ #include <osl/diagnose.h> -#include "..\DTransHelper.hxx" +#include "../DTransHelper.hxx" #include "XTDo.hxx" diff --git a/dtrans/source/win32/workbench/test_wincb.cxx b/dtrans/source/win32/workbench/test_wincb.cxx index c41d5a79153f..395865449c85 100644 --- a/dtrans/source/win32/workbench/test_wincb.cxx +++ b/dtrans/source/win32/workbench/test_wincb.cxx @@ -35,7 +35,7 @@ //_________________________________________________________________________________________________________________________ -#include "..\misc\ImplHelper.hxx" +#include "../misc/ImplHelper.hxx" //_________________________________________________________________________________________________________________________ // other includes diff --git a/dtrans/test/win32/dnd/transferable.hxx b/dtrans/test/win32/dnd/transferable.hxx index 315b3f55c9b2..cc2863e8c237 100644 --- a/dtrans/test/win32/dnd/transferable.hxx +++ b/dtrans/test/win32/dnd/transferable.hxx @@ -53,7 +53,7 @@ #include <process.h> -#include "..\..\source\win32\ImplHelper.hxx" +#include "../../source/win32/ImplHelper.hxx" //------------------------------------------------------------- diff --git a/dtrans/util/exports.dxp b/dtrans/util/exports.dxp index f0e1c69934bc..70033078921a 100644 --- a/dtrans/util/exports.dxp +++ b/dtrans/util/exports.dxp @@ -1,2 +1 @@ -component_getImplementationEnvironment component_getFactory diff --git a/i18npool/inc/i18npool/lang.h b/i18npool/inc/i18npool/lang.h index 1870a7b48351..0059a1b6978e 100644 --- a/i18npool/inc/i18npool/lang.h +++ b/i18npool/inc/i18npool/lang.h @@ -78,7 +78,7 @@ /* It must be safe to include this file in plain C code, so only C style * comments are used. Do NOT use // C++ style comments. */ -/* disable typedef for usage in svx/source/dialog/langtab.src */ +/* disable typedef for usage in svtools/source/misc/langtab.src */ #ifndef RSC_RESOURCE_USAGE typedef unsigned short LanguageType; #endif diff --git a/i18npool/inc/i18npool/mslangid.hxx b/i18npool/inc/i18npool/mslangid.hxx index b2a9e054482c..a38ccdfd68c1 100644 --- a/i18npool/inc/i18npool/mslangid.hxx +++ b/i18npool/inc/i18npool/mslangid.hxx @@ -75,9 +75,7 @@ public: special value. @descr: NOTE: The "system" values may be overridden by the - application's configuration. If you need to access the system - values use <method>getRealLanguageWithoutConfig()</method> - instead. + application's configuration. @returns case LANGUAGE_PROCESS_OR_USER_DEFAULT : configured or system language @@ -154,13 +152,6 @@ public: static ::com::sun::star::lang::Locale getFallbackLocale( const ::com::sun::star::lang::Locale & rLocale ); - - /** Get fall-back LanguageType for LanguageType, resolving LANGUAGE_SYSTEM. - Returns the same LanguageType if an exact match was found. - */ - static LanguageType getFallbackLanguage( LanguageType nLang ); - - // ----------------------------- // - ConvertLanguageToIsoNames - // ----------------------------- @@ -184,34 +175,9 @@ public: const rtl::OString& rCountry ); static LanguageType convertIsoStringToLanguage( const rtl::OUString& rString, sal_Unicode cSep = '-' ); - static LanguageType convertIsoByteStringToLanguage( - const rtl::OString& rString, sal_Char cSep = '-' ); static LanguageType convertUnxByteStringToLanguage( const rtl::OString& rString ); - - /** @short: A real language/locale if the nLang parameter designates some - special value. - - @descr: NOTE: This is a raw interface to the system and does not take - any application configuration into account. If that is wanted, - which is most likely, use <method>getRealLanguage()</method> - instead. - - @returns - case LANGUAGE_PROCESS_OR_USER_DEFAULT : getSystemLanguage() - case LANGUAGE_SYSTEM_DEFAULT : getSystemLanguage() - case LANGUAGE_SYSTEM : getSystemLanguage() - case LANGUAGE_NONE : getSystemUILanguage() - case LANGUAGE_DONTKNOW : LANGUAGE_ENGLISH_US - else: nLang - - In case getSystemLanguage() or getSystemUILanguage() returned - LANGUAGE_DONTKNOW, LANGUAGE_ENGLISH_US is returned instead. - */ - static LanguageType getRealLanguageWithoutConfig( LanguageType nLang ); - - static LanguageType resolveSystemLanguageByScriptType( LanguageType nLang, sal_Int16 nType ); diff --git a/i18npool/prj/build.lst b/i18npool/prj/build.lst index 3a2e0c2d2b9c..113a9fa6c111 100644 --- a/i18npool/prj/build.lst +++ b/i18npool/prj/build.lst @@ -1,4 +1,4 @@ -inp i18npool : bridges sax stoc comphelper CPPUNIT:cppunit ICU:icu i18nutil regexp cpputools LIBXSLT:libxslt NULL +inp i18npool : bridges sax stoc comphelper CPPUNIT:cppunit ICU:icu i18nutil regexp DESKTOP:cpputools LIBXSLT:libxslt NULL inp i18npool usr1 - all inp_mkout NULL inp i18npool\inc nmake - all inp_inc NULL inp i18npool\source\registerservices nmake - all inp_rserv inp_inc NULL diff --git a/i18npool/prj/d.lst b/i18npool/prj/d.lst index 71e0ae3b4758..d6fd70f9adf9 100644 --- a/i18npool/prj/d.lst +++ b/i18npool/prj/d.lst @@ -40,11 +40,13 @@ mkdir: %_DEST%\inc\i18npool ..\%__SRC%\bin\i18nisol*.dll %_DEST%\bin\i18nisol*.dll ..\%__SRC%\lib\libi18nisolang*.so %_DEST%\lib\libi18nisolang*.so ..\%__SRC%\lib\libi18nisolang*.dylib %_DEST%\lib\libi18nisolang*.dylib +..\%__SRC%\lib\libi18nisolang*.a %_DEST%\lib\libi18nisolang*.a ..\%__SRC%\lib\ii18npaper*.lib %_DEST%\lib\ii18npaper*.lib ..\%__SRC%\bin\i18npaper*.dll %_DEST%\bin\i18npaper*.dll ..\%__SRC%\lib\libi18npaper*.so %_DEST%\lib\libi18npaper*.so ..\%__SRC%\lib\libi18npaper*.dylib %_DEST%\lib\libi18npaper*.dylib +..\%__SRC%\lib\libi18npaper*.a %_DEST%\lib\libi18npaper*.a ..\%__SRC%\misc\i18npool.component %_DEST%\xml\i18npool.component ..\%__SRC%\misc\i18nsearch.component %_DEST%\xml\i18nsearch.component diff --git a/i18npool/qa/cppunit/test_breakiterator.cxx b/i18npool/qa/cppunit/test_breakiterator.cxx index fc81cc9860fb..7740cf9188f6 100644 --- a/i18npool/qa/cppunit/test_breakiterator.cxx +++ b/i18npool/qa/cppunit/test_breakiterator.cxx @@ -57,11 +57,13 @@ public: void testLineBreaking(); void testGraphemeIteration(); void testWeak(); + void testAsian(); CPPUNIT_TEST_SUITE(TestBreakIterator); CPPUNIT_TEST(testLineBreaking); CPPUNIT_TEST(testGraphemeIteration); CPPUNIT_TEST(testWeak); + CPPUNIT_TEST(testAsian); CPPUNIT_TEST_SUITE_END(); private: @@ -104,7 +106,7 @@ void TestBreakIterator::testGraphemeIteration() aLocale.Country = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IN")); { - sal_Unicode BA_HALANT_LA[] = { 0x09AC, 0x09CD, 0x09AF }; + const sal_Unicode BA_HALANT_LA[] = { 0x09AC, 0x09CD, 0x09AF }; ::rtl::OUString aTest1(BA_HALANT_LA, SAL_N_ELEMENTS(BA_HALANT_LA)); sal_Int32 nDone=0; @@ -118,7 +120,7 @@ void TestBreakIterator::testGraphemeIteration() } { - sal_Unicode HA_HALANT_NA_VOWELSIGNI[] = { 0x09B9, 0x09CD, 0x09A3, 0x09BF }; + const sal_Unicode HA_HALANT_NA_VOWELSIGNI[] = { 0x09B9, 0x09CD, 0x09A3, 0x09BF }; ::rtl::OUString aTest1(HA_HALANT_NA_VOWELSIGNI, SAL_N_ELEMENTS(HA_HALANT_NA_VOWELSIGNI)); sal_Int32 nDone=0; @@ -132,7 +134,7 @@ void TestBreakIterator::testGraphemeIteration() } { - sal_Unicode TA_HALANT_MA_HALANT_YA [] = { 0x09A4, 0x09CD, 0x09AE, 0x09CD, 0x09AF }; + const sal_Unicode TA_HALANT_MA_HALANT_YA [] = { 0x09A4, 0x09CD, 0x09AE, 0x09CD, 0x09AF }; ::rtl::OUString aTest1(TA_HALANT_MA_HALANT_YA, SAL_N_ELEMENTS(TA_HALANT_MA_HALANT_YA)); sal_Int32 nDone=0; @@ -156,10 +158,12 @@ void TestBreakIterator::testWeak() aLocale.Country = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("US")); { - sal_Unicode WEAKS[] = + const sal_Unicode WEAKS[] = { 0x0001, 0x0002, 0x0020, 0x00A0, + 0x2150, 0x215F, //Number Forms, fractions + 0x2160, 0x2180, //Number Forms, roman numerals 0x2200, 0x22FF, //Mathematical Operators 0x27C0, 0x27EF, //Miscellaneous Mathematical Symbols-A 0x2980, 0x29FF, //Miscellaneous Mathematical Symbols-B @@ -184,6 +188,45 @@ void TestBreakIterator::testWeak() } } +//A test to ensure that certain ranges and codepoints that are categorized as +//asian remain as asian, so that existing docs that depend on this don't silently +//change font for those asian chars. +//See https://bugs.freedesktop.org/show_bug.cgi?id=38095 +void TestBreakIterator::testAsian() +{ + lang::Locale aLocale; + aLocale.Language = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("en")); + aLocale.Country = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("US")); + + { + const sal_Unicode ASIANS[] = + { + //some typical CJK chars + 0x4E00, 0x62FF, + //The full HalfWidth and FullWidth block has historically been + //designated as taking the CJK font :-( + //HalfWidth and FullWidth forms of ASCII 0-9, categorized under + //UAX24 as "Common" i.e. by that logic WEAK + 0xFF10, 0xFF19, + //HalfWidth and FullWidth forms of ASCII A-z, categorized under + //UAX25 as "Latin", i.e. by that logic LATIN + 0xFF21, 0xFF5A + }; + ::rtl::OUString aAsians(ASIANS, SAL_N_ELEMENTS(ASIANS)); + + for (sal_Int32 i = 0; i < aAsians.getLength(); ++i) + { + sal_Int16 nScript = m_xBreak->getScriptType(aAsians, i); + rtl::OStringBuffer aMsg; + aMsg.append(RTL_CONSTASCII_STRINGPARAM("Char 0x")); + aMsg.append(static_cast<sal_Int32>(aAsians.getStr()[i]), 16); + aMsg.append(RTL_CONSTASCII_STRINGPARAM(" should have been asian")); + CPPUNIT_ASSERT_MESSAGE(aMsg.getStr(), + nScript == i18n::ScriptType::ASIAN); + } + } +} + TestBreakIterator::TestBreakIterator() { m_xContext = cppu::defaultBootstrap_InitialComponentContext(); diff --git a/i18npool/source/breakiterator/breakiteratorImpl.cxx b/i18npool/source/breakiterator/breakiteratorImpl.cxx index 3cc974870c3d..e81bfff9452a 100644 --- a/i18npool/source/breakiterator/breakiteratorImpl.cxx +++ b/i18npool/source/breakiterator/breakiteratorImpl.cxx @@ -443,67 +443,155 @@ sal_Int16 SAL_CALL BreakIteratorImpl::getWordType( const OUString& /*Text*/, return 0; } -static sal_Int16 scriptTypes[] = { - ScriptType::WEAK, ScriptType::WEAK, ScriptType::COMPLEX, ScriptType::LATIN, ScriptType::COMPLEX, - ScriptType::ASIAN, ScriptType::LATIN, ScriptType::LATIN, ScriptType::LATIN, ScriptType::COMPLEX, - ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::LATIN, ScriptType::LATIN, ScriptType::LATIN, -// 15 - ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::ASIAN, ScriptType::ASIAN, ScriptType::COMPLEX, - ScriptType::ASIAN, ScriptType::COMPLEX, ScriptType::ASIAN, ScriptType::COMPLEX, ScriptType::COMPLEX, - ScriptType::LATIN, ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::LATIN, -// 30 - ScriptType::LATIN, ScriptType::COMPLEX, ScriptType::LATIN, ScriptType::COMPLEX, ScriptType::COMPLEX, - ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, - ScriptType::LATIN, ScriptType::ASIAN, ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, -// 45 - ScriptType::COMPLEX, ScriptType::LATIN, ScriptType::LATIN, ScriptType::COMPLEX, ScriptType::COMPLEX, - ScriptType::LATIN, ScriptType::LATIN, ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::LATIN, - ScriptType::COMPLEX, ScriptType::LATIN, ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, -// 60 - ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, - ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::LATIN, ScriptType::LATIN, ScriptType::COMPLEX, - ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::ASIAN, ScriptType::ASIAN, -// 75 - ScriptType::COMPLEX, ScriptType::LATIN, ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, - ScriptType::LATIN, ScriptType::LATIN, ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, - ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, -// 90 - ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, - ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, - ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::WEAK, ScriptType::WEAK, ScriptType::COMPLEX, -// 105 - ScriptType::ASIAN, ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, - ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, - ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::ASIAN, -// 120 - ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, - ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::WEAK, ScriptType::WEAK, - ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, -// 135 - ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, - ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, - ScriptType::COMPLEX, - ScriptType::WEAK}; - -#define scriptListCount SAL_N_ELEMENTS(scriptTypes) +namespace +{ + //See unicode/uscript.h + static sal_Int16 scriptTypes[] = + { + ScriptType::WEAK, ScriptType::WEAK, ScriptType::COMPLEX, ScriptType::LATIN, ScriptType::COMPLEX, + ScriptType::ASIAN, ScriptType::LATIN, ScriptType::LATIN, ScriptType::LATIN, ScriptType::COMPLEX, + ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::LATIN, ScriptType::LATIN, ScriptType::LATIN, + // 15 + ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::ASIAN, ScriptType::ASIAN, ScriptType::COMPLEX, + ScriptType::ASIAN, ScriptType::COMPLEX, ScriptType::ASIAN, ScriptType::COMPLEX, ScriptType::COMPLEX, + ScriptType::LATIN, ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::LATIN, + // 30 + ScriptType::LATIN, ScriptType::COMPLEX, ScriptType::LATIN, ScriptType::COMPLEX, ScriptType::COMPLEX, + ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, + ScriptType::LATIN, ScriptType::ASIAN, ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, + // 45 + ScriptType::COMPLEX, ScriptType::LATIN, ScriptType::LATIN, ScriptType::COMPLEX, ScriptType::COMPLEX, + ScriptType::LATIN, ScriptType::LATIN, ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::LATIN, + ScriptType::COMPLEX, ScriptType::LATIN, ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, + // 60 + ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, + ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::LATIN, ScriptType::LATIN, ScriptType::COMPLEX, + ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::ASIAN, ScriptType::ASIAN, + // 75 + ScriptType::COMPLEX, ScriptType::LATIN, ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, + ScriptType::LATIN, ScriptType::LATIN, ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, + ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, + // 90 + ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, + ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, + ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::WEAK, ScriptType::WEAK, ScriptType::COMPLEX, + // 105 + ScriptType::ASIAN, ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, + ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, + ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::ASIAN, + // 120 + ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, + ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::WEAK, ScriptType::WEAK, + ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, + // 135 + ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, + ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, ScriptType::COMPLEX, + ScriptType::COMPLEX, + ScriptType::WEAK + }; + +# define scriptTypesCount SAL_N_ELEMENTS(scriptTypes) + + sal_Int16 getScriptClassByUAX24Script(sal_uInt32 currentChar) + { + sal_Int16 nRet; + int32_t script = u_getIntPropertyValue(currentChar, UCHAR_SCRIPT); + if (script < 0) + nRet = ScriptType::WEAK; + else if (static_cast<size_t>(script) >= SAL_N_ELEMENTS(scriptTypes)) + nRet = ScriptType::COMPLEX; // anything new is going to be pretty wild + else + nRet = scriptTypes[script]; + return nRet; + } + + struct UBlock2Script + { + UBlockCode from; + UBlockCode to; + sal_Int16 script; + }; + + static UBlock2Script scriptList[] = + { + {UBLOCK_NO_BLOCK, UBLOCK_NO_BLOCK, ScriptType::WEAK}, + {UBLOCK_BASIC_LATIN, UBLOCK_ARMENIAN, ScriptType::LATIN}, + {UBLOCK_HEBREW, UBLOCK_MYANMAR, ScriptType::COMPLEX}, + {UBLOCK_GEORGIAN, UBLOCK_GEORGIAN, ScriptType::LATIN}, + {UBLOCK_HANGUL_JAMO, UBLOCK_HANGUL_JAMO, ScriptType::ASIAN}, + {UBLOCK_ETHIOPIC, UBLOCK_ETHIOPIC, ScriptType::COMPLEX}, + {UBLOCK_CHEROKEE, UBLOCK_RUNIC, ScriptType::LATIN}, + {UBLOCK_KHMER, UBLOCK_MONGOLIAN, ScriptType::COMPLEX}, + {UBLOCK_LATIN_EXTENDED_ADDITIONAL, UBLOCK_GREEK_EXTENDED, ScriptType::LATIN}, + {UBLOCK_NUMBER_FORMS, UBLOCK_NUMBER_FORMS, ScriptType::WEAK}, + {UBLOCK_CJK_RADICALS_SUPPLEMENT, UBLOCK_HANGUL_SYLLABLES, ScriptType::ASIAN}, + {UBLOCK_CJK_COMPATIBILITY_IDEOGRAPHS, UBLOCK_CJK_COMPATIBILITY_IDEOGRAPHS, ScriptType::ASIAN}, + {UBLOCK_ARABIC_PRESENTATION_FORMS_A, UBLOCK_ARABIC_PRESENTATION_FORMS_A, ScriptType::COMPLEX}, + {UBLOCK_CJK_COMPATIBILITY_FORMS, UBLOCK_CJK_COMPATIBILITY_FORMS, ScriptType::ASIAN}, + {UBLOCK_ARABIC_PRESENTATION_FORMS_B, UBLOCK_ARABIC_PRESENTATION_FORMS_B, ScriptType::COMPLEX}, + {UBLOCK_HALFWIDTH_AND_FULLWIDTH_FORMS, UBLOCK_HALFWIDTH_AND_FULLWIDTH_FORMS, ScriptType::ASIAN}, + {UBLOCK_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_B, UBLOCK_CJK_COMPATIBILITY_IDEOGRAPHS_SUPPLEMENT, ScriptType::ASIAN}, + {UBLOCK_CJK_STROKES, UBLOCK_CJK_STROKES, ScriptType::ASIAN}, + {UBLOCK_LATIN_EXTENDED_C, UBLOCK_LATIN_EXTENDED_D, ScriptType::LATIN} + }; + + #define scriptListCount SAL_N_ELEMENTS(scriptList) + + //always sets rScriptType + // + //returns true for characters historically explicitly assigned to + //latin/weak/asian + // + //returns false for characters that historically implicitly assigned to + //weak as unknown + bool getCompatibilityScriptClassByBlock(sal_uInt32 currentChar, sal_Int16 &rScriptType) + { + bool bKnown = true; + //handle specific characters always as weak: + // 0x01 - this breaks a word + // 0x02 - this can be inside a word + // 0x20 & 0xA0 - Bug 102975, declare western space and non-break space as WEAK char. + if( 0x01 == currentChar || 0x02 == currentChar || 0x20 == currentChar || 0xA0 == currentChar) + rScriptType = ScriptType::WEAK; + // workaround for Coptic + else if ( 0x2C80 <= currentChar && 0x2CE3 >= currentChar) + rScriptType = ScriptType::LATIN; + else + { + UBlockCode block=ublock_getCode(currentChar); + size_t i = 0; + while (i < scriptListCount) + { + if (block <= scriptList[i].to) + break; + ++i; + } + if (i < scriptListCount && block >= scriptList[i].from) + rScriptType = scriptList[i].script; + else + { + rScriptType = ScriptType::WEAK; + bKnown = false; + } + } + return bKnown; + } +} sal_Int16 BreakIteratorImpl::getScriptClass(sal_uInt32 currentChar) { - static sal_uInt32 lastChar = 0; - static sal_Int16 nRet = 0; + static sal_uInt32 lastChar = 0; + static sal_Int16 nRet = 0; - if (currentChar != lastChar) { - lastChar = currentChar; + if (currentChar != lastChar) + { + lastChar = currentChar; - int32_t script = u_getIntPropertyValue(currentChar, UCHAR_SCRIPT); - if (script < 0) - nRet = ScriptType::WEAK; - else if (static_cast<size_t>(script) >= SAL_N_ELEMENTS(scriptTypes)) - nRet = ScriptType::COMPLEX; // anything new is going to be pretty wild - else - nRet = scriptTypes[script]; - } - return nRet; + if (!getCompatibilityScriptClassByBlock(currentChar, nRet)) + nRet = getScriptClassByUAX24Script(currentChar); + } + + return nRet; } static inline sal_Bool operator == (const Locale& l1, const Locale& l2) { diff --git a/i18npool/source/breakiterator/data/makefile.mk b/i18npool/source/breakiterator/data/makefile.mk index 81bbbbd280e1..572446a80e15 100644 --- a/i18npool/source/breakiterator/data/makefile.mk +++ b/i18npool/source/breakiterator/data/makefile.mk @@ -34,7 +34,7 @@ LIBTARGET=NO .INCLUDE : settings.mk # Fix heap limit problem on MSC -.IF "$(OS)" == "WNT" +.IF "$(COM)" == "MSC" .IF "$(COMEX)" != "8" CDEFS+=-Zm300 .ENDIF diff --git a/i18npool/source/breakiterator/makefile.mk b/i18npool/source/breakiterator/makefile.mk index 434fdc9f5d88..961d7aa1ac6e 100644 --- a/i18npool/source/breakiterator/makefile.mk +++ b/i18npool/source/breakiterator/makefile.mk @@ -57,6 +57,8 @@ SLOFILES= \ $(SLO)/xdictionary.obj \ $(subst,$(MISC)/,$(SLO)/ $(MY_MISC_CXXFILES:s/.c/.obj/)) +.IF "$(CROSS_COMPILING)" != "YES" + OBJFILES = $(OBJ)/gendict.obj APP1TARGET = gendict @@ -67,6 +69,8 @@ APP1OBJS = $(DEPOBJFILES) APP1STDLIBS = $(SALLIB) +.ENDIF + # --- Targets ------------------------------------------------------ .IF "$(SYSTEM_ICU)" == "YES" diff --git a/i18npool/source/collator/data/makefile.mk b/i18npool/source/collator/data/makefile.mk index 59eb1a55f807..920e50609d8e 100644 --- a/i18npool/source/collator/data/makefile.mk +++ b/i18npool/source/collator/data/makefile.mk @@ -33,7 +33,7 @@ TARGET=collator_data .INCLUDE : settings.mk # Fix heap limit problem on MSC -.IF "$(OS)" == "WNT" +.IF "$(COM)" == "MSC" .IF "$(COMEX)" != "8" CDEFS+=-Zm300 .ENDIF diff --git a/i18npool/source/collator/makefile.mk b/i18npool/source/collator/makefile.mk index 654b857b7d25..b9be239a00e4 100644 --- a/i18npool/source/collator/makefile.mk +++ b/i18npool/source/collator/makefile.mk @@ -49,6 +49,8 @@ SLOFILES= \ $(SLO)$/chaptercollator.obj \ $(rules_obj) +.IF "$(CROSS_COMPILING)" != "YES" + APP1TARGET = gencoll_rule APP1RPATH = NONE @@ -61,6 +63,8 @@ APP1STDLIBS = $(SALLIB) \ $(ICUUCLIB) \ $(ICUDATALIB) +.ENDIF + # --- Targets ------------------------------------------------------ .INCLUDE : target.mk diff --git a/i18npool/source/indexentry/data/makefile.mk b/i18npool/source/indexentry/data/makefile.mk index 42378dab25bc..84d4281a3f53 100644 --- a/i18npool/source/indexentry/data/makefile.mk +++ b/i18npool/source/indexentry/data/makefile.mk @@ -34,7 +34,7 @@ LIBTARGET=NO .INCLUDE : settings.mk # Fix heap limit problem on MSC -.IF "$(OS)" == "WNT" +.IF "$(COM)" == "MSC" .IF "$(COMEX)" != "8" CDEFS+=-Zm300 .ENDIF diff --git a/i18npool/source/indexentry/makefile.mk b/i18npool/source/indexentry/makefile.mk index 6b4ea3ed5ff2..79e3eaf95c4e 100644 --- a/i18npool/source/indexentry/makefile.mk +++ b/i18npool/source/indexentry/makefile.mk @@ -37,7 +37,6 @@ ENABLE_EXCEPTIONS=TRUE .INCLUDE : settings.mk - # --- Files -------------------------------------------------------- SLOFILES= \ @@ -47,6 +46,8 @@ SLOFILES= \ $(SLO)$/indexentrysupplier_default.obj \ $(SLO)$/indexentrysupplier_common.obj +.IF "$(CROSS_COMPILING)" != "YES" + OBJFILES = $(OBJ)$/genindex_data.obj APP1TARGET = genindex_data @@ -60,6 +61,8 @@ APP1STDLIBS = $(SALLIB) \ $(ICUUCLIB) \ $(ICUDATALIB) +.ENDIF + # --- Targets ------------------------------------------------------ .INCLUDE : target.mk diff --git a/i18npool/source/isolang/isolang.cxx b/i18npool/source/isolang/isolang.cxx index a96f80719357..0a1d524d2cda 100644 --- a/i18npool/source/isolang/isolang.cxx +++ b/i18npool/source/isolang/isolang.cxx @@ -1012,26 +1012,6 @@ LanguageType MsLangId::convertIsoStringToLanguage( // ----------------------------------------------------------------------- -// static -LanguageType MsLangId::convertIsoByteStringToLanguage( - const rtl::OString& rString, sal_Char cSep ) -{ - rtl::OString aLang; - rtl::OString aCountry; - sal_Int32 nSepPos = rString.indexOf( cSep ); - if ( nSepPos >= 0 ) - { - aLang = rString.copy( 0, nSepPos ); - aCountry = rString.copy( nSepPos+1 ); - } - else - aLang = rString; - - return convertIsoNamesToLanguage( aLang, aCountry ); -} - -// ----------------------------------------------------------------------- - struct IsoLangGLIBCModifiersEntry { LanguageType mnLang; diff --git a/i18npool/source/isolang/makefile.mk b/i18npool/source/isolang/makefile.mk index b8f01460f67b..2ade308aa91c 100644 --- a/i18npool/source/isolang/makefile.mk +++ b/i18npool/source/isolang/makefile.mk @@ -43,7 +43,11 @@ SLOFILES= $(SLO)$/insys.obj \ $(SLO)$/mslangid.obj SHL1TARGET= $(ISOLANG_TARGET)$(ISOLANG_MAJOR)$(COMID) +.IF "$(COM)" == "MSC" SHL1IMPLIB= i$(ISOLANG_TARGET) +.ELSE +SHL1IMPLIB= $(ISOLANG_TARGET)$(ISOLANG_MAJOR)$(COMID) +.ENDIF DEF1DEPN= $(MISC)$/$(SHL1TARGET).flt SHL1DEF= $(MISC)$/$(SHL1TARGET).def diff --git a/i18npool/source/isolang/mslangid.cxx b/i18npool/source/isolang/mslangid.cxx index c11d4d6d1387..2b5c59e865a7 100644 --- a/i18npool/source/isolang/mslangid.cxx +++ b/i18npool/source/isolang/mslangid.cxx @@ -90,29 +90,6 @@ inline LanguageType MsLangId::simplifySystemLanguages( LanguageType nLang ) return nLang; } - -// static -LanguageType MsLangId::getRealLanguageWithoutConfig( LanguageType nLang ) -{ - switch (simplifySystemLanguages( nLang)) - { - case LANGUAGE_SYSTEM : - nLang = getSystemLanguage(); - break; - case LANGUAGE_NONE : - nLang = getSystemUILanguage(); - break; - default: - /* TODO: would this be useful here? */ - //nLang = MsLangId::getReplacementForObsoleteLanguage( nLang); - ; // nothing - } - if (nLang == LANGUAGE_DONTKNOW) - nLang = LANGUAGE_ENGLISH_US; - return nLang; -} - - // static LanguageType MsLangId::getRealLanguage( LanguageType nLang ) { @@ -252,14 +229,6 @@ LanguageType MsLangId::convertLocaleToLanguageWithFallback( return lookupFallbackLocale( rLocale); } - -// static -LanguageType MsLangId::getFallbackLanguage( LanguageType nLang ) -{ - return lookupFallbackLanguage( MsLangId::getRealLanguage( nLang)); -} - - // static bool MsLangId::isRightToLeft( LanguageType nLang ) { diff --git a/i18npool/source/localedata/LocaleNode.cxx b/i18npool/source/localedata/LocaleNode.cxx index 05f6156489a6..caa40746fd31 100644 --- a/i18npool/source/localedata/LocaleNode.cxx +++ b/i18npool/source/localedata/LocaleNode.cxx @@ -484,24 +484,24 @@ void LCCTYPENode::generateCode (const OFileWriter &of) const "DoubleQuotationEnd is an ASCII character but DoubleQuotationStart is not."); if (aQuoteStart.toChar() <= 127 && aQuoteEnd.toChar() <= 127) fprintf( stderr, "Warning: %s\n", - "QuotationStart and QuotationEnd are both ASCII characters. Not necessarily an error, but unusual."); + "QuotationStart and QuotationEnd are both ASCII characters. Not necessarily an issue, but unusual."); if (aDoubleQuoteStart.toChar() <= 127 && aDoubleQuoteEnd.toChar() <= 127) fprintf( stderr, "Warning: %s\n", - "DoubleQuotationStart and DoubleQuotationEnd are both ASCII characters. Not necessarily an error, but unusual."); + "DoubleQuotationStart and DoubleQuotationEnd are both ASCII characters. Not necessarily an issue, but unusual."); if (aQuoteStart == aQuoteEnd) fprintf( stderr, "Warning: %s\n", - "QuotationStart equals QuotationEnd. Not necessarily an error, but unusual."); + "QuotationStart equals QuotationEnd. Not necessarily an issue, but unusual."); if (aDoubleQuoteStart == aDoubleQuoteEnd) fprintf( stderr, "Warning: %s\n", - "DoubleQuotationStart equals DoubleQuotationEnd. Not necessarily an error, but unusual."); + "DoubleQuotationStart equals DoubleQuotationEnd. Not necessarily an issue, but unusual."); /* TODO: should equalness of single and double quotes be an error? Would * need to adapt quite some locales' data. */ if (aQuoteStart == aDoubleQuoteStart) fprintf( stderr, "Warning: %s\n", - "QuotationStart equals DoubleQuotationStart. Not necessarily an error, but unusual."); + "QuotationStart equals DoubleQuotationStart. Not necessarily an isue, but unusual."); if (aQuoteEnd == aDoubleQuoteEnd) fprintf( stderr, "Warning: %s\n", - "QuotationEnd equals DoubleQuotationEnd. Not necessarily an error, but unusual."); + "QuotationEnd equals DoubleQuotationEnd. Not necessarily an issue, but unusual."); // Known good values, exclude ASCII single (U+0027, ') and double (U+0022, ") quotes. int ic; switch (ic = aQuoteStart.toChar()) diff --git a/i18npool/source/localedata/data/gd_GB.xml b/i18npool/source/localedata/data/gd_GB.xml new file mode 100644 index 000000000000..0a1c64a0136d --- /dev/null +++ b/i18npool/source/localedata/data/gd_GB.xml @@ -0,0 +1,357 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE Locale SYSTEM "locale.dtd"> +<Locale versionDTD="2.0.3" allowUpdateFromCLDR="no" version="1.0"> +<LC_INFO> +<Language> +<LangID>gd</LangID> +<DefaultName>Gaelic, Scottish</DefaultName> +</Language> +<Country> +<CountryID>GB</CountryID> +<DefaultName>United Kingdom</DefaultName> +</Country> +</LC_INFO> +<LC_CTYPE unoid="generic"> +<Separators> +<DateSeparator>/</DateSeparator> +<ThousandSeparator>,</ThousandSeparator> +<DecimalSeparator>.</DecimalSeparator> +<TimeSeparator>:</TimeSeparator> +<Time100SecSeparator>.</Time100SecSeparator> +<ListSeparator>;</ListSeparator> +<LongDateDayOfWeekSeparator>, </LongDateDayOfWeekSeparator> +<LongDateDaySeparator>, </LongDateDaySeparator> +<LongDateMonthSeparator> </LongDateMonthSeparator> +<LongDateYearSeparator> </LongDateYearSeparator> +</Separators> +<Markers> +<QuotationStart>‘</QuotationStart> +<QuotationEnd>’</QuotationEnd> +<DoubleQuotationStart>“</DoubleQuotationStart> +<DoubleQuotationEnd>â€</DoubleQuotationEnd> +</Markers> +<TimeAM>m</TimeAM> +<TimePM>f</TimePM> +<MeasurementSystem>metric</MeasurementSystem> +</LC_CTYPE> +<LC_FORMAT replaceFrom="[CURRENCY]" replaceTo="[$£-43C]"> +<FormatElement msgid="FixedFormatskey1" default="true" type="medium" usage="FIXED_NUMBER" formatindex="0"> +<FormatCode>General</FormatCode> +</FormatElement> +<FormatElement msgid="FixedFormatskey2" default="true" type="short" usage="FIXED_NUMBER" formatindex="1"> +<FormatCode>0</FormatCode> +</FormatElement> +<FormatElement msgid="FixedFormatskey3" default="false" type="medium" usage="FIXED_NUMBER" formatindex="2"> +<FormatCode>0.00</FormatCode> +</FormatElement> +<FormatElement msgid="FixedFormatskey4" default="false" type="short" usage="FIXED_NUMBER" formatindex="3"> +<FormatCode>#,##0</FormatCode> +</FormatElement> +<FormatElement msgid="FixedFormatskey5" default="false" type="medium" usage="FIXED_NUMBER" formatindex="4"> +<FormatCode>#,##0.00</FormatCode> +</FormatElement> +<FormatElement msgid="FixedFormatskey6" default="false" type="medium" usage="FIXED_NUMBER" formatindex="5"> +<FormatCode>#,###.00</FormatCode> +</FormatElement> +<FormatElement msgid="ScientificFormatskey1" default="true" type="medium" usage="SCIENTIFIC_NUMBER" formatindex="6"> +<FormatCode>0.00E+00</FormatCode> +</FormatElement> +<FormatElement msgid="ScientificFormatskey2" default="false" type="medium" usage="SCIENTIFIC_NUMBER" formatindex="7"> +<FormatCode>0.00E+000</FormatCode> +</FormatElement> +<FormatElement msgid="PercentFormatskey1" default="true" type="short" usage="PERCENT_NUMBER" formatindex="8"> +<FormatCode>0%</FormatCode> +</FormatElement> +<FormatElement msgid="PercentFormatskey2" default="true" type="long" usage="PERCENT_NUMBER" formatindex="9"> +<FormatCode>0.00%</FormatCode> +</FormatElement> +<FormatElement msgid="CurrencyFormatskey1" default="true" type="short" usage="CURRENCY" formatindex="12"> +<FormatCode>[CURRENCY]#,##0;-[CURRENCY]#,##0</FormatCode> +</FormatElement> +<FormatElement msgid="CurrencyFormatskey2" default="false" type="medium" usage="CURRENCY" formatindex="13"> +<FormatCode>[CURRENCY]#,##0.00;-[CURRENCY]#,##0.00</FormatCode> +</FormatElement> +<FormatElement msgid="CurrencyFormatskey3" default="false" type="medium" usage="CURRENCY" formatindex="14"> +<FormatCode>[CURRENCY]#,##0;[RED]-[CURRENCY]#,##0</FormatCode> +</FormatElement> +<FormatElement msgid="CurrencyFormatskey4" default="true" type="medium" usage="CURRENCY" formatindex="15"> +<FormatCode>[CURRENCY]#,##0.00;[RED]-[CURRENCY]#,##0.00</FormatCode> +</FormatElement> +<FormatElement msgid="CurrencyFormatskey5" default="false" type="medium" usage="CURRENCY" formatindex="16"> +<FormatCode>CCC#,##0.00</FormatCode> +</FormatElement> +<FormatElement msgid="CurrencyFormatskey6" default="false" type="medium" usage="CURRENCY" formatindex="17"> +<FormatCode>[CURRENCY]#,##0.--;[RED]-[CURRENCY]#,##0.--</FormatCode> +</FormatElement> +<FormatElement msgid="DateFormatskey11" default="true" type="short" usage="DATE" formatindex="18"> +<FormatCode>D/MM/YY</FormatCode> +</FormatElement> +<FormatElement msgid="DateFormatskey14" default="true" type="long" usage="DATE" formatindex="19"> +<FormatCode>NNNNDD, MMMM YYYY</FormatCode> +</FormatElement> +<FormatElement msgid="DateFormatskey6" default="true" type="medium" usage="DATE" formatindex="20"> +<FormatCode>DD/MM/YY</FormatCode> +</FormatElement> +<FormatElement msgid="DateFormatskey5" default="false" type="medium" usage="DATE" formatindex="21"> +<FormatCode>DD/MM/YYYY</FormatCode> +</FormatElement> +<FormatElement msgid="DateFormatskey15" default="false" type="long" usage="DATE" formatindex="22"> +<FormatCode>D, MMM YY</FormatCode> +</FormatElement> +<FormatElement msgid="DateFormatskey16" default="false" type="long" usage="DATE" formatindex="23"> +<FormatCode>D, MMM YYYY</FormatCode> +</FormatElement> +<FormatElement msgid="DateFormatskey21" default="false" type="long" usage="DATE" formatindex="24"> +<FormatCode>D, MMM YYYY</FormatCode> +</FormatElement> +<FormatElement msgid="DateFormatskey17" default="false" type="long" usage="DATE" formatindex="25"> +<FormatCode>D, MMMM YYYY</FormatCode> +</FormatElement> +<FormatElement msgid="DateFormatskey22" default="false" type="long" usage="DATE" formatindex="26"> +<FormatCode>D, MMMM YY</FormatCode> +</FormatElement> +<FormatElement msgid="DateFormatskey10" default="false" type="medium" usage="DATE" formatindex="27"> +<FormatCode>NN, DD/MMM/YY</FormatCode> +</FormatElement> +<FormatElement msgid="DateFormatskey18" default="false" type="long" usage="DATE" formatindex="28"> +<FormatCode>NN, D, MMM YY</FormatCode> +</FormatElement> +<FormatElement msgid="DateFormatskey19" default="false" type="long" usage="DATE" formatindex="29"> +<FormatCode>NN, D, MMMM YYYY</FormatCode> +</FormatElement> +<FormatElement msgid="DateFormatskey20" default="false" type="long" usage="DATE" formatindex="30"> +<FormatCode>NNNND, MMMM YYYY</FormatCode> +</FormatElement> +<FormatElement msgid="DateFormatskey12" default="false" type="short" usage="DATE" formatindex="31"> +<FormatCode>MM/DD</FormatCode> +</FormatElement> +<FormatElement msgid="DateFormatskey7" default="false" type="medium" usage="DATE" formatindex="32"> +<FormatCode>YY-MM-DD</FormatCode> +<DefaultName>ISO 8601</DefaultName> +</FormatElement> +<FormatElement msgid="DateFormatskey8" default="false" type="medium" usage="DATE" formatindex="33"> +<FormatCode>YYYY-MM-DD</FormatCode> +<DefaultName>ISO 8601</DefaultName> +</FormatElement> +<FormatElement msgid="DateFormatskey1" default="false" type="medium" usage="DATE" formatindex="34"> +<FormatCode>MM/YY</FormatCode> +</FormatElement> +<FormatElement msgid="DateFormatskey2" default="false" type="medium" usage="DATE" formatindex="35"> +<FormatCode>MMM/DD</FormatCode> +</FormatElement> +<FormatElement msgid="DateFormatskey3" default="false" type="medium" usage="DATE" formatindex="36"> +<FormatCode>MMMM</FormatCode> +</FormatElement> +<FormatElement msgid="DateFormatskey4" default="false" type="medium" usage="DATE" formatindex="37"> +<FormatCode>QQ YY</FormatCode> +</FormatElement> +<FormatElement msgid="DateFormatskey9" default="false" type="medium" usage="DATE" formatindex="38"> +<FormatCode>WW</FormatCode> +</FormatElement> +<FormatElement msgid="TimeFormatskey1" default="false" type="short" usage="TIME" formatindex="39"> +<FormatCode>HH:MM</FormatCode> +</FormatElement> +<FormatElement msgid="TimeFormatskey2" default="false" type="medium" usage="TIME" formatindex="40"> +<FormatCode>HH:MM:SS</FormatCode> +</FormatElement> +<FormatElement msgid="TimeFormatskey3" default="true" type="short" usage="TIME" formatindex="41"> +<FormatCode>HH:MM AM/PM</FormatCode> +</FormatElement> +<FormatElement msgid="TimeFormatskey4" default="true" type="medium" usage="TIME" formatindex="42"> +<FormatCode>HH:MM:SS AM/PM</FormatCode> +</FormatElement> +<FormatElement msgid="TimeFormatskey5" default="false" type="medium" usage="TIME" formatindex="43"> +<FormatCode>[HH]:MM:SS</FormatCode> +</FormatElement> +<FormatElement msgid="TimeFormatskey6" default="false" type="short" usage="TIME" formatindex="44"> +<FormatCode>MM:SS.00</FormatCode> +</FormatElement> +<FormatElement msgid="TimeFormatskey7" default="false" type="medium" usage="TIME" formatindex="45"> +<FormatCode>[HH]:MM:SS.00</FormatCode> +</FormatElement> +<FormatElement msgid="DateTimeFormatskey1" default="true" type="medium" usage="DATE_TIME" formatindex="46"> +<FormatCode>DD/MM/YY HH:MM</FormatCode> +</FormatElement> +<FormatElement msgid="DateTimeFormatskey2" default="false" type="medium" usage="DATE_TIME" formatindex="47"> +<FormatCode>DD/MM/YYYY HH:MM:SS AM/PM</FormatCode> +</FormatElement> +</LC_FORMAT> +<LC_COLLATION> +<Collator default="true" unoid="alphanumeric"/> +<CollationOptions> +<TransliterationModules>IGNORE_CASE</TransliterationModules> +</CollationOptions> +</LC_COLLATION> +<LC_SEARCH> +<SearchOptions> +<TransliterationModules>IGNORE_CASE</TransliterationModules> +</SearchOptions> +</LC_SEARCH> +<LC_INDEX> +<IndexKey phonetic="false" default="true" unoid="alphanumeric">AÀÃBCDEÈÉFGHIJKÃŒLMNOÒÓPQRSTUÙVWXYZ</IndexKey> +<UnicodeScript>0</UnicodeScript> +<UnicodeScript>1</UnicodeScript> +<FollowPageWord>td</FollowPageWord> +<FollowPageWord>td</FollowPageWord> +</LC_INDEX> +<LC_CALENDAR> +<Calendar unoid="gregorian" default="true"> +<DaysOfWeek> +<Day> +<DayID>sun</DayID> +<DefaultAbbrvName>DiD</DefaultAbbrvName> +<DefaultFullName>DiDòmhnaich</DefaultFullName> +</Day> +<Day> +<DayID>mon</DayID> +<DefaultAbbrvName>DiL</DefaultAbbrvName> +<DefaultFullName>DiLuain</DefaultFullName> +</Day> +<Day> +<DayID>tue</DayID> +<DefaultAbbrvName>DiM</DefaultAbbrvName> +<DefaultFullName>DiMà irt</DefaultFullName> +</Day> +<Day> +<DayID>wed</DayID> +<DefaultAbbrvName>DiC</DefaultAbbrvName> +<DefaultFullName>DiCiadain</DefaultFullName> +</Day> +<Day> +<DayID>thu</DayID> +<DefaultAbbrvName>Dia</DefaultAbbrvName> +<DefaultFullName>DiarDaoin</DefaultFullName> +</Day> +<Day> +<DayID>fri</DayID> +<DefaultAbbrvName>Dih</DefaultAbbrvName> +<DefaultFullName>DihAoine</DefaultFullName> +</Day> +<Day> +<DayID>sat</DayID> +<DefaultAbbrvName>DiS</DefaultAbbrvName> +<DefaultFullName>DiSathairne</DefaultFullName> +</Day> +</DaysOfWeek> +<MonthsOfYear> +<Month> +<MonthID>jan</MonthID> +<DefaultAbbrvName>Faoi</DefaultAbbrvName> +<DefaultFullName>Faoilleach</DefaultFullName> +</Month> +<Month> +<MonthID>feb</MonthID> +<DefaultAbbrvName>Gearr</DefaultAbbrvName> +<DefaultFullName>Gearran</DefaultFullName> +</Month> +<Month> +<MonthID>mar</MonthID> +<DefaultAbbrvName>Mà rt</DefaultAbbrvName> +<DefaultFullName>Mà rt</DefaultFullName> +</Month> +<Month> +<MonthID>apr</MonthID> +<DefaultAbbrvName>Gibl</DefaultAbbrvName> +<DefaultFullName>Giblean</DefaultFullName> +</Month> +<Month> +<MonthID>may</MonthID> +<DefaultAbbrvName>Cèit</DefaultAbbrvName> +<DefaultFullName>Cèitean</DefaultFullName> +</Month> +<Month> +<MonthID>jun</MonthID> +<DefaultAbbrvName>Ã’gmh</DefaultAbbrvName> +<DefaultFullName>Ã’gmhios</DefaultFullName> +</Month> +<Month> +<MonthID>jul</MonthID> +<DefaultAbbrvName>Iuch</DefaultAbbrvName> +<DefaultFullName>Iuchar</DefaultFullName> +</Month> +<Month> +<MonthID>aug</MonthID> +<DefaultAbbrvName>Lùna</DefaultAbbrvName> +<DefaultFullName>Lùnastal</DefaultFullName> +</Month> +<Month> +<MonthID>sep</MonthID> +<DefaultAbbrvName>Sult</DefaultAbbrvName> +<DefaultFullName>Sultain</DefaultFullName> +</Month> +<Month> +<MonthID>oct</MonthID> +<DefaultAbbrvName>Dà mh</DefaultAbbrvName> +<DefaultFullName>Dà mhair</DefaultFullName> +</Month> +<Month> +<MonthID>nov</MonthID> +<DefaultAbbrvName>Samh</DefaultAbbrvName> +<DefaultFullName>Samhain</DefaultFullName> +</Month> +<Month> +<MonthID>dec</MonthID> +<DefaultAbbrvName>Dùbh</DefaultAbbrvName> +<DefaultFullName>Dùbhlachd</DefaultFullName> +</Month> +</MonthsOfYear> +<Eras> +<Era> +<EraID>bc</EraID> +<DefaultAbbrvName>RC</DefaultAbbrvName> +<DefaultFullName>ro Chrìost</DefaultFullName> +</Era> +<Era> +<EraID>ad</EraID> +<DefaultAbbrvName>AD</DefaultAbbrvName> +<DefaultFullName>as dèidh Chrìost</DefaultFullName> +</Era> +</Eras> +<StartDayOfWeek> +<DayID>mon</DayID> +</StartDayOfWeek> +<MinimalDaysInFirstWeek>1</MinimalDaysInFirstWeek> +</Calendar> +</LC_CALENDAR> +<LC_CURRENCY> +<Currency default="true" usedInCompatibleFormatCodes="true"> +<CurrencyID>GBP</CurrencyID> +<CurrencySymbol>£</CurrencySymbol> +<BankSymbol>GBP</BankSymbol> +<CurrencyName>Punnd Sasannach</CurrencyName> +<DecimalPlaces>2</DecimalPlaces> +</Currency> +</LC_CURRENCY> +<LC_TRANSLITERATION> +<Transliteration unoid="LOWERCASE_UPPERCASE"/> +<Transliteration unoid="UPPERCASE_LOWERCASE"/> +<Transliteration unoid="IGNORE_CASE"/> +</LC_TRANSLITERATION> +<LC_MISC> +<ReservedWords> +<trueWord>Fìor</trueWord> +<falseWord>Breug</falseWord> +<quarter1Word>Rà ithe 1</quarter1Word> +<quarter2Word>Rà ithe 2</quarter2Word> +<quarter3Word>Rà ithe 3</quarter3Word> +<quarter4Word>Rà ithe 4</quarter4Word> +<aboveWord>Os cionn</aboveWord> +<belowWord>Fo</belowWord> +<quarter1Abbreviation>R 1</quarter1Abbreviation> +<quarter2Abbreviation>R 2</quarter2Abbreviation> +<quarter3Abbreviation>R 3</quarter3Abbreviation> +<quarter4Abbreviation>R 4</quarter4Abbreviation> +</ReservedWords> +</LC_MISC> +<LC_NumberingLevel> +<NumberingLevel NumType="4" Prefix=" " Suffix=")"/> +<NumberingLevel NumType="4" Prefix=" " Suffix="."/> +<NumberingLevel NumType="4" Prefix="(" Suffix=")"/> +<NumberingLevel NumType="2" Prefix=" " Suffix="."/> +<NumberingLevel NumType="0" Prefix=" " Suffix=")"/> +<NumberingLevel NumType="1" Prefix=" " Suffix=")"/> +<NumberingLevel NumType="1" Prefix="(" Suffix=")"/> +<NumberingLevel NumType="3" Prefix=" " Suffix="."/> +</LC_NumberingLevel> +<LC_OutLineNumberingLevel ref="en_US"/> +</Locale> diff --git a/i18npool/source/localedata/data/localedata_euro.map b/i18npool/source/localedata/data/localedata_euro.map index b9dd20c724d7..db16f9f7f35c 100644 --- a/i18npool/source/localedata/data/localedata_euro.map +++ b/i18npool/source/localedata/data/localedata_euro.map @@ -31,6 +31,7 @@ getAllCalendars_fr_MC; getAllCalendars_fur_IT; getAllCalendars_fy_NL; getAllCalendars_ga_IE; +getAllCalendars_gd_GB; getAllCalendars_gsc_FR; getAllCalendars_hr_HR; getAllCalendars_hsb_DE; @@ -102,6 +103,7 @@ getAllCurrencies_fr_MC; getAllCurrencies_fur_IT; getAllCurrencies_fy_NL; getAllCurrencies_ga_IE; +getAllCurrencies_gd_GB; getAllCurrencies_gsc_FR; getAllCurrencies_hr_HR; getAllCurrencies_hsb_DE; @@ -173,6 +175,7 @@ getAllFormats0_fr_MC; getAllFormats0_fur_IT; getAllFormats0_fy_NL; getAllFormats0_ga_IE; +getAllFormats0_gd_GB; getAllFormats0_gsc_FR; getAllFormats0_hr_HR; getAllFormats0_hsb_DE; @@ -244,6 +247,7 @@ getBreakIteratorRules_fr_MC; getBreakIteratorRules_fur_IT; getBreakIteratorRules_fy_NL; getBreakIteratorRules_ga_IE; +getBreakIteratorRules_gd_GB; getBreakIteratorRules_gsc_FR; getBreakIteratorRules_hr_HR; getBreakIteratorRules_hsb_DE; @@ -315,6 +319,7 @@ getCollationOptions_fr_MC; getCollationOptions_fur_IT; getCollationOptions_fy_NL; getCollationOptions_ga_IE; +getCollationOptions_gd_GB; getCollationOptions_gsc_FR; getCollationOptions_hr_HR; getCollationOptions_hsb_DE; @@ -386,6 +391,7 @@ getCollatorImplementation_fr_MC; getCollatorImplementation_fur_IT; getCollatorImplementation_fy_NL; getCollatorImplementation_ga_IE; +getCollatorImplementation_gd_GB; getCollatorImplementation_gsc_FR; getCollatorImplementation_hr_HR; getCollatorImplementation_hsb_DE; @@ -457,6 +463,7 @@ getContinuousNumberingLevels_fr_MC; getContinuousNumberingLevels_fur_IT; getContinuousNumberingLevels_fy_NL; getContinuousNumberingLevels_ga_IE; +getContinuousNumberingLevels_gd_GB; getContinuousNumberingLevels_gsc_FR; getContinuousNumberingLevels_hr_HR; getContinuousNumberingLevels_hsb_DE; @@ -528,6 +535,7 @@ getFollowPageWords_fr_MC; getFollowPageWords_fur_IT; getFollowPageWords_fy_NL; getFollowPageWords_ga_IE; +getFollowPageWords_gd_GB; getFollowPageWords_gsc_FR; getFollowPageWords_hr_HR; getFollowPageWords_hsb_DE; @@ -599,6 +607,7 @@ getForbiddenCharacters_fr_MC; getForbiddenCharacters_fur_IT; getForbiddenCharacters_fy_NL; getForbiddenCharacters_ga_IE; +getForbiddenCharacters_gd_GB; getForbiddenCharacters_gsc_FR; getForbiddenCharacters_hr_HR; getForbiddenCharacters_hsb_DE; @@ -670,6 +679,7 @@ getIndexAlgorithm_fr_MC; getIndexAlgorithm_fur_IT; getIndexAlgorithm_fy_NL; getIndexAlgorithm_ga_IE; +getIndexAlgorithm_gd_GB; getIndexAlgorithm_gsc_FR; getIndexAlgorithm_hr_HR; getIndexAlgorithm_hsb_DE; @@ -741,6 +751,7 @@ getLCInfo_fr_MC; getLCInfo_fur_IT; getLCInfo_fy_NL; getLCInfo_ga_IE; +getLCInfo_gd_GB; getLCInfo_gsc_FR; getLCInfo_hr_HR; getLCInfo_hsb_DE; @@ -812,6 +823,7 @@ getLocaleItem_fr_MC; getLocaleItem_fur_IT; getLocaleItem_fy_NL; getLocaleItem_ga_IE; +getLocaleItem_gd_GB; getLocaleItem_gsc_FR; getLocaleItem_hr_HR; getLocaleItem_hsb_DE; @@ -883,6 +895,7 @@ getOutlineNumberingLevels_fr_MC; getOutlineNumberingLevels_fur_IT; getOutlineNumberingLevels_fy_NL; getOutlineNumberingLevels_ga_IE; +getOutlineNumberingLevels_gd_GB; getOutlineNumberingLevels_gsc_FR; getOutlineNumberingLevels_hr_HR; getOutlineNumberingLevels_hsb_DE; @@ -954,6 +967,7 @@ getReservedWords_fr_MC; getReservedWords_fur_IT; getReservedWords_fy_NL; getReservedWords_ga_IE; +getReservedWords_gd_GB; getReservedWords_gsc_FR; getReservedWords_hr_HR; getReservedWords_hsb_DE; @@ -1025,6 +1039,7 @@ getSearchOptions_fr_MC; getSearchOptions_fur_IT; getSearchOptions_fy_NL; getSearchOptions_ga_IE; +getSearchOptions_gd_GB; getSearchOptions_gsc_FR; getSearchOptions_hr_HR; getSearchOptions_hsb_DE; @@ -1096,6 +1111,7 @@ getTransliterations_fr_MC; getTransliterations_fur_IT; getTransliterations_fy_NL; getTransliterations_ga_IE; +getTransliterations_gd_GB; getTransliterations_gsc_FR; getTransliterations_hr_HR; getTransliterations_hsb_DE; @@ -1167,6 +1183,7 @@ getUnicodeScripts_fr_MC; getUnicodeScripts_fur_IT; getUnicodeScripts_fy_NL; getUnicodeScripts_ga_IE; +getUnicodeScripts_gd_GB; getUnicodeScripts_gsc_FR; getUnicodeScripts_hr_HR; getUnicodeScripts_hsb_DE; diff --git a/i18npool/source/localedata/data/makefile.mk b/i18npool/source/localedata/data/makefile.mk index 38595ee538e8..c67e9082d7ce 100644 --- a/i18npool/source/localedata/data/makefile.mk +++ b/i18npool/source/localedata/data/makefile.mk @@ -36,7 +36,7 @@ LIBTARGET=NO debug!= .ENDIF -.IF "$(OS)" == "WNT" +.IF "$(OS_FOR_BUILD)" == "WNT" my_file = file:/// .ELSE my_file = file:// @@ -167,6 +167,7 @@ SHL3OBJS= \ $(SLO)$/localedata_fur_IT.obj \ $(SLO)$/localedata_fy_NL.obj \ $(SLO)$/localedata_ga_IE.obj \ + $(SLO)$/localedata_gd_GB.obj \ $(SLO)$/localedata_gsc_FR.obj \ $(SLO)$/localedata_hr_HR.obj \ $(SLO)$/localedata_hsb_DE.obj \ @@ -326,12 +327,20 @@ MY_MISC_CXXFILES := $(foreach,i,$(DEPOBJFILES) $(MISC)/$(i:b).cxx) .INCLUDE : target.mk -$(MY_MISC_CXXFILES) : $(OUT_FOR_BUILD)$/bin$/saxparser$(EXECPOST) $(MISC)/saxparser.rdb +$(MY_MISC_CXXFILES) : $(OUT_FOR_BUILD)$/bin$/saxparser$(EXECPOST_FOR_BUILD) $(MISC)/saxparser.rdb + +.IF "$(CROSS_COMPILING)" == "YES" +# Always cross-compiling from some Unix, +# so the BUILD platform's lib directory is correct +sharedlibdir=$(SOLARLIBDIR_FOR_BUILD) +.ELSE +sharedlibdir=$(SOLARSHAREDBIN) +.ENDIF $(MISC)$/localedata_%.cxx : %.xml $(AUGMENT_LIBRARY_PATH) $(WRAPCMD) $(OUT_FOR_BUILD)$/bin$/saxparser $* $< $@ \ $(my_file)$(PWD)/$(MISC_FOR_BUILD)/saxparser.rdb $(SOLARBINDIR)$/types.rdb \ - -env:OOO_INBUILD_SHAREDLIB_DIR=$(my_file)$(SOLARSHAREDBIN) + -env:OOO_INBUILD_SHAREDLIB_DIR=$(my_file)$(sharedlibdir) $(RM) $(BIN)$/$(@:b).rdb $(MISC)/saxparser.rdb .ERRREMOVE : $(SOLARENV)/bin/packcomponents.xslt \ diff --git a/i18npool/source/localedata/localedata.cxx b/i18npool/source/localedata/localedata.cxx index d011865a7e35..b6245fca6268 100644 --- a/i18npool/source/localedata/localedata.cxx +++ b/i18npool/source/localedata/localedata.cxx @@ -149,6 +149,7 @@ static const struct { { "eu", lcl_DATA_EURO }, { "fo_FO", lcl_DATA_EURO }, { "ga_IE", lcl_DATA_EURO }, + { "gd_GB", lcl_DATA_EURO }, { "ka_GE", lcl_DATA_EURO }, { "be_BY", lcl_DATA_EURO }, { "kl_GL", lcl_DATA_EURO }, diff --git a/i18npool/source/localedata/makefile.mk b/i18npool/source/localedata/makefile.mk index 9a671e8bcd6b..798b401d21f7 100644 --- a/i18npool/source/localedata/makefile.mk +++ b/i18npool/source/localedata/makefile.mk @@ -58,6 +58,8 @@ CDEFS+=-D__STD_LIMITS SLOFILES= $(SLO)$/localedata.obj +.IF "$(CROSS_COMPILING)" != "YES" + OBJFILES = \ $(OBJ)$/saxparser.obj \ $(OBJ)$/LocaleNode.obj \ @@ -78,6 +80,8 @@ DEPOBJFILES = \ $(OBJ)$/LocaleNode.obj \ $(OBJ)$/filewriter.obj +.ENDIF + # --- Targets ------------------------------------------------------ .INCLUDE : target.mk diff --git a/i18npool/source/paper/makefile.mk b/i18npool/source/paper/makefile.mk index fa05cc21f3f9..f0b9bc8b02f1 100644 --- a/i18npool/source/paper/makefile.mk +++ b/i18npool/source/paper/makefile.mk @@ -44,7 +44,11 @@ SLOFILES=$(SLO)$/paper.obj SHL1OBJS=$(SLOFILES) SHL1TARGET=$(TARGET)$(DLLPOSTFIX) +.IF "$(COM)" == "MSC" SHL1IMPLIB=i$(TARGET) +.ELSE +SHL1IMPLIB=$(TARGET)$(DLLPOSTFIX) +.ENDIF DEF1DEPN=$(MISC)$/$(SHL1TARGET).flt SHL1DEF=$(MISC)$/$(SHL1TARGET).def diff --git a/i18npool/source/paper/paper.cxx b/i18npool/source/paper/paper.cxx index 913cc7d834ed..fe376184edba 100644 --- a/i18npool/source/paper/paper.cxx +++ b/i18npool/source/paper/paper.cxx @@ -247,7 +247,7 @@ PaperInfo PaperInfo::getSystemDefaultPaper() // try user-defined locale setting xConfigNA->getByName( CREATE_OUSTRING( "ooSetupSystemLocale" ) ) >>= aLocaleStr; } - catch( Exception& ) + catch(const Exception&) { } @@ -377,7 +377,9 @@ PaperInfo PaperInfo::getSystemDefaultPaper() xConfigNA->getByName( CREATE_OUSTRING( "Locale" ) ) >>= aLocaleStr; } } - catch( Exception& ) {} + catch(const Exception&) + { + } if (aLocaleStr.getLength() == 0) aLocaleStr = CREATE_OUSTRING("en-US"); diff --git a/i18npool/source/registerservices/registerservices.cxx b/i18npool/source/registerservices/registerservices.cxx index fd08933af2fa..5df7bb931b7c 100644 --- a/i18npool/source/registerservices/registerservices.cxx +++ b/i18npool/source/registerservices/registerservices.cxx @@ -576,11 +576,6 @@ static const struct InstancesArray { extern "C" { -SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( const sal_Char** ppEnvTypeName, uno_Environment** /*ppEnv*/ ) -{ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} - SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( const sal_Char* sImplementationName, void* _pServiceManager, void* /*_pRegistryKey*/ ) { void* pRet = NULL; diff --git a/i18npool/source/search/textsearch.cxx b/i18npool/source/search/textsearch.cxx index 756d6c863ff9..f407a614ed1f 100644 --- a/i18npool/source/search/textsearch.cxx +++ b/i18npool/source/search/textsearch.cxx @@ -982,12 +982,6 @@ SAL_CALL TextSearch_CreateInstance( extern "C" { -SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( - const sal_Char** ppEnvTypeName, uno_Environment** /*ppEnv*/ ) -{ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} - SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( const sal_Char* sImplementationName, void* _pServiceManager, void* /*_pRegistryKey*/ ) { diff --git a/i18npool/source/textconversion/data/makefile.mk b/i18npool/source/textconversion/data/makefile.mk index 967b4f982ea2..6f54d2033f0b 100644 --- a/i18npool/source/textconversion/data/makefile.mk +++ b/i18npool/source/textconversion/data/makefile.mk @@ -34,7 +34,7 @@ LIBTARGET=NO .INCLUDE : settings.mk # Fix heap limit problem on MSC -.IF "$(OS)" == "WNT" +.IF "$(COM)" == "MSC" .IF "$(COMEX)" != "8" CDEFS+=-Zm300 .ENDIF diff --git a/i18npool/source/textconversion/makefile.mk b/i18npool/source/textconversion/makefile.mk index 2b91d964b2ad..dca748309ca7 100644 --- a/i18npool/source/textconversion/makefile.mk +++ b/i18npool/source/textconversion/makefile.mk @@ -44,6 +44,8 @@ SLOFILES= \ $(SLO)$/textconversion_ko.obj \ $(SLO)$/textconversion_zh.obj +.IF "$(CROSS_COMPILING)" != "YES" + OBJFILES = $(OBJ)$/genconv_dict.obj APP1TARGET = genconv_dict @@ -53,6 +55,8 @@ APP1OBJS = $(OBJ)$/genconv_dict.obj APP1STDLIBS = $(SALLIB) +.ENDIF + # --- Targets ------------------------------------------------------ .INCLUDE : target.mk diff --git a/i18nutil/inc/i18nutil/oneToOneMapping.hxx b/i18nutil/inc/i18nutil/oneToOneMapping.hxx index ff88b3e5410d..9ad5cb1256a2 100644 --- a/i18nutil/inc/i18nutil/oneToOneMapping.hxx +++ b/i18nutil/inc/i18nutil/oneToOneMapping.hxx @@ -57,10 +57,6 @@ public: oneToOneMapping( OneToOneMappingTable_t *rpTable, const size_t rnSize, const size_t rnUnitSize = sizeof(OneToOneMappingTable_t) ); virtual ~oneToOneMapping(); - // make index for fast search - // bluedawrf: not used -// void makeIndex(); - // binary search virtual sal_Unicode find( const sal_Unicode nKey ) const; diff --git a/i18nutil/inc/i18nutil/x_rtl_ustring.h b/i18nutil/inc/i18nutil/x_rtl_ustring.h index 3b94c697d7f9..330c6bce3d6b 100644 --- a/i18nutil/inc/i18nutil/x_rtl_ustring.h +++ b/i18nutil/inc/i18nutil/x_rtl_ustring.h @@ -49,14 +49,6 @@ inline void SAL_CALL x_rtl_uString_new_WithLength( rtl_uString ** newStr, sal_In *newStr = (rtl_uString*) rtl_allocateMemory ( sizeof(rtl_uString) + sizeof(sal_Unicode) * nLen); (*newStr)->refCount = _refCount; (*newStr)->length = nLen; - - // rtl_uString is defined in rtl/ustring.h as below: - //typedef struct _rtl_uString - //{ - // sal_Int32 refCount; - // sal_Int32 length; - // sal_Unicode buffer[1]; - //} rtl_uString; } inline rtl_uString * SAL_CALL x_rtl_uString_new_WithLength( sal_Int32 nLen, sal_Int32 _refCount = 0 ) @@ -76,6 +68,6 @@ inline void SAL_CALL x_rtl_uString_release( rtl_uString * value ) } -#endif // #ifndef _I18N_X_RTL_USTRING_H_ +#endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/i18nutil/prj/build.lst b/i18nutil/prj/build.lst index 311b6d572943..55c86ad3038f 100644 --- a/i18nutil/prj/build.lst +++ b/i18nutil/prj/build.lst @@ -1,3 +1,3 @@ -inu i18nutil : sal cppu offuh NULL +inu i18nutil : sal cppu offapi NULL inu i18nutil usr1 - all inu_mkout NULL inu i18nutil\source\utility nmake - all inu_utility NULL diff --git a/i18nutil/prj/d.lst b/i18nutil/prj/d.lst index fd6c2683cb35..72625de7e392 100644 --- a/i18nutil/prj/d.lst +++ b/i18nutil/prj/d.lst @@ -10,4 +10,5 @@ mkdir: %_DEST%\inc\i18nutil ..\%__SRC%\bin\i18nutil*.dll %_DEST%\bin\i18nutil*.dll ..\%__SRC%\lib\libi18nutil*.so %_DEST%\lib\libi18nutil*.so ..\%__SRC%\lib\libi18nutil*.dylib %_DEST%\lib\libi18nutil*.dylib +..\%__SRC%\lib\libi18nutil*.a %_DEST%\lib\libi18nutil*.a ..\%__SRC%\lib\ii18nutil.lib %_DEST%\lib\ii18nutil.lib diff --git a/i18nutil/source/utility/makefile.mk b/i18nutil/source/utility/makefile.mk index adfddd91db2d..cece2847e9b1 100644 --- a/i18nutil/source/utility/makefile.mk +++ b/i18nutil/source/utility/makefile.mk @@ -47,7 +47,11 @@ SLOFILES= \ # Unicode utilities SHL1TARGET= $(TARGET)$(COMID) +.IF "$(COM)" == "MSC" SHL1IMPLIB= i$(TARGET) +.ELSE +SHL1IMPLIB= $(TARGET)$(COMID) +.ENDIF DEF1DEPN= $(MISC)$/$(SHL1TARGET).flt SHL1DEF= $(MISC)$/$(SHL1TARGET).def diff --git a/l10ntools/inc/cfgmerge.hxx b/l10ntools/inc/cfgmerge.hxx index 9308d0c727a8..c8f3d99a7b14 100644 --- a/l10ntools/inc/cfgmerge.hxx +++ b/l10ntools/inc/cfgmerge.hxx @@ -33,8 +33,7 @@ #include <boost/unordered_map.hpp> #include <vector> -typedef boost::unordered_map<ByteString , ByteString , hashByteString,equalByteString> - ByteStringHashMap; +typedef boost::unordered_map<rtl::OString, rtl::OString, rtl::OStringHash> ByteStringHashMap; // diff --git a/l10ntools/inc/export.hxx b/l10ntools/inc/export.hxx index 0d707abe9898..c33960fa8468 100644 --- a/l10ntools/inc/export.hxx +++ b/l10ntools/inc/export.hxx @@ -84,8 +84,7 @@ class PFormEntrys; class MergeData; typedef std::set<ByteString , lessByteString > ByteStringSet; -typedef boost::unordered_map<ByteString , ByteString , hashByteString,equalByteString> - ByteStringHashMap; +typedef boost::unordered_map<rtl::OString, rtl::OString, rtl::OStringHash> ByteStringHashMap; typedef boost::unordered_map<ByteString , bool , hashByteString,equalByteString> ByteStringBoolHashMap; @@ -197,8 +196,8 @@ public: void addFallbackData( ByteString& sId , const ByteString& sText ); bool getFallbackData( ByteString& sId , ByteString& sText); - void addMergedLanguage( ByteString& sLang ); - bool isMerged( ByteString& sLang ); + void addMergedLanguage(rtl::OString& rLang); + bool isMerged(rtl::OString& rLang); ResData( const ByteString &rPF, const ByteString &rGId ) : nWidth( 0 ), @@ -307,7 +306,7 @@ private: sal_Bool bNextMustBeDefineEOL; // define but no \ at lineend sal_uLong nLevel; // res. recursiv? how deep? sal_uInt16 nList; // cur. res. is String- or FilterList - ByteString nListLang; + rtl::OString m_sListLang; sal_uLong nListIndex; sal_uLong nListLevel; bool bSkipFile; @@ -345,23 +344,17 @@ public: static void QuotHTML( ByteString &rString ); static bool CopyFile( const ByteString& source , const ByteString& dest ); - static void QuotHTMLXRM( ByteString &rString ); static void UnquotHTML( ByteString &rString ); static const char* GetEnv( const char *pVar ); - static int getCurrentDirectory( rtl::OUString& base_fqurl , rtl::OUString& base ); static bool isSourceLanguage( const ByteString &sLanguage ); static bool isAllowed( const ByteString &sLanguage ); - static bool LanguageAllowed( const ByteString &nLanguage ); static void Languages( std::vector<ByteString>::const_iterator& begin , std::vector<ByteString>::const_iterator& end ); static void getRandomName( const ByteString& sPrefix , ByteString& sRandStr , const ByteString& sPostfix ); - static void getRandomName( ByteString& sRandStr ); static void getCurrentDir( std::string& dir ); - static void replaceEncoding( ByteString& rString ); - static ByteString GetFallbackLanguage( const ByteString nLanguage ); static void FillInFallbacks( ResData *pResData ); static void FillInListFallbacks( ExportList *pList, const ByteString &nSource, const ByteString &nFallback ); @@ -377,8 +370,6 @@ private: static std::vector<ByteString> aLanguages; static std::vector<ByteString> aForcedLanguages; - sal_Bool ListExists( ResData *pResData, sal_uInt16 nLst ); - sal_Bool WriteData( ResData *pResData, sal_Bool bCreateNew = sal_False );// called befor dest. cur ResData sal_Bool WriteExportList( ResData *pResData, ExportList *pExportList, const ByteString &rTyp, sal_Bool bCreateNew = sal_False ); @@ -393,13 +384,12 @@ private: ByteString GetPairedListString ( const ByteString& sText ); ByteString StripList ( const ByteString& sText ); - void UnmergeUTF8( ByteString& sOrig ); void InsertListEntry( const ByteString &rText, const ByteString &rLine ); void CleanValue( ByteString &rValue ); ByteString GetText( const ByteString &rSource, int nToken ); - sal_Bool PrepareTextToMerge( ByteString &rText, sal_uInt16 nTyp, - ByteString &nLangIndex, ResData *pResData ); + sal_Bool PrepareTextToMerge(ByteString &rText, sal_uInt16 nTyp, + rtl::OString &rLangIndex, ResData *pResData); void MergeRest( ResData *pResData, sal_uInt16 nMode = MERGE_MODE_NORMAL ); void ConvertMergeContent( ByteString &rText ); @@ -490,7 +480,6 @@ public: MergeData( const ByteString &rTyp, const ByteString &rGID, const ByteString &rLID , const ByteString &rFilename ) : sTyp( rTyp ), sGID( rGID ), sLID( rLID ) , sFilename( rFilename ) {}; ~MergeData(); - PFormEntrys* InsertEntry( const ByteString &rPForm ); PFormEntrys* GetPFormEntrys( ResData *pResData ); void Insert( const ByteString& rPFO , PFormEntrys* pfEntrys ); @@ -525,8 +514,6 @@ class MergeDataFile const ByteString &sFilename, bool bCaseSensitive ); ByteString Dump(); - void WriteError( const ByteString &rLine ); - public: MergeDataFile( const ByteString &rFileName, const ByteString& rFile , sal_Bool bErrLog, CharSet aCharSet, bool bCaseSensitive = false ); ~MergeDataFile(); diff --git a/l10ntools/inc/helpmerge.hxx b/l10ntools/inc/helpmerge.hxx index e2ec54daa637..25536244e357 100644 --- a/l10ntools/inc/helpmerge.hxx +++ b/l10ntools/inc/helpmerge.hxx @@ -48,13 +48,13 @@ private: /// @PRECOND 0 < langIdx_in < MAX_IDX static void FillInFallbacks( LangHashMap& rElem_out, ByteString sLangIdx_in ); -/// Debugmethod, prints the content of the map to stdout - static void Dump( LangHashMap* rElem_in , const ByteString sKey_in ); - -/// Debugmethod, prints the content of the map to stdout - static void Dump( XMLHashMap* rElem_in ) ; - +#if OSL_DEBUG_LEVEL > 2 + /// Debugmethod, prints the content of the map to stdout + static void Dump(LangHashMap* rElem_in , const ByteString sKey_in); + /// Debugmethod, prints the content of the map to stdout + static void Dump(XMLHashMap* rElem_in); +#endif public: HelpParser( const ByteString &rHelpFile, bool bUTF8 , bool bHasInputList ); @@ -79,7 +79,6 @@ private: ByteString GetOutpath( const ByteString& rPathX , const ByteString& sCur , const ByteString& rPathY ); bool MergeSingleFile( XMLFile* file , MergeDataFile& aMergeDataFile , const ByteString& sLanguage , ByteString sPath ); - void Process( LangHashMap* aLangHM , const ByteString& sCur , ResData *pResData , MergeDataFile& aMergeDataFile ); void ProcessHelp( LangHashMap* aLangHM , const ByteString& sCur , ResData *pResData , MergeDataFile& aMergeDataFile ); void MakeDir( const ByteString& sPath ); }; diff --git a/l10ntools/inc/l10ntools/directory.hxx b/l10ntools/inc/l10ntools/directory.hxx index 30ceb3f664fc..34e4a3a0cc65 100644 --- a/l10ntools/inc/l10ntools/directory.hxx +++ b/l10ntools/inc/l10ntools/directory.hxx @@ -47,7 +47,6 @@ class Directory Directory( const rtl::OUString sFullPath ); Directory( const rtl::OUString sFullPath , const rtl::OUString sEntry ) ; - Directory( const ByteString sFullPath ); static bool lessDir ( const Directory& rKey1, const Directory& rKey2 ) ; }; diff --git a/l10ntools/inc/l10ntools/file.hxx b/l10ntools/inc/l10ntools/file.hxx index 9b90c2766500..fae252e5f926 100644 --- a/l10ntools/inc/l10ntools/file.hxx +++ b/l10ntools/inc/l10ntools/file.hxx @@ -14,7 +14,6 @@ class File rtl::OUString getFileName(){ return sFileName; } rtl::OUString getFullName(){ return sFullName; } - File( const rtl::OUString sFile ); File( const rtl::OUString sFullName , const rtl::OUString sFile ); static bool lessFile ( const File& rKey1, const File& rKey2 ); diff --git a/l10ntools/source/cfglex.l b/l10ntools/source/cfglex.l index a6f6b366a8d5..feb2882632d8 100644 --- a/l10ntools/source/cfglex.l +++ b/l10ntools/source/cfglex.l @@ -137,7 +137,7 @@ int yywrap(void) } /*****************************************************************************/ -void YYWarning( char *s ) +void YYWarning( const char *s ) /*****************************************************************************/ { /* write warning to stderr */ @@ -147,9 +147,9 @@ void YYWarning( char *s ) /*****************************************************************************/ #ifdef GCC -void yyerror ( char *s, ... ) +void yyerror ( const char *s, ... ) #else -void yyerror ( char *s ) +void yyerror ( const char *s ) #endif /*****************************************************************************/ { diff --git a/l10ntools/source/cfgmerge.cxx b/l10ntools/source/cfgmerge.cxx index c4f24edeb487..55aed2c4210c 100644 --- a/l10ntools/source/cfgmerge.cxx +++ b/l10ntools/source/cfgmerge.cxx @@ -394,13 +394,6 @@ void CfgParser::AddText( pStackData->sText[ rIsoLang ] = rText; } - -/*****************************************************************************/ -void CfgParser::WorkOnRessourceEnd() -/*****************************************************************************/ -{ -} - /*****************************************************************************/ int CfgParser::ExecuteAnalyzedToken( int nToken, char *pToken ) /*****************************************************************************/ @@ -651,13 +644,13 @@ void CfgExport::WorkOnRessourceEnd() /*****************************************************************************/ { if ( pOutputStream && bLocalize ) { - if (( pStackData->sText[ ByteString("en-US") ].Len() + if (( pStackData->sText[rtl::OString(RTL_CONSTASCII_STRINGPARAM("en-US"))].getLength() ) || ( bForce && - ( pStackData->sText[ ByteString("de") ].Len() || - pStackData->sText[ ByteString("en-US") ].Len() ))) + ( pStackData->sText[rtl::OString(RTL_CONSTASCII_STRINGPARAM("de"))].getLength() || + pStackData->sText[rtl::OString(RTL_CONSTASCII_STRINGPARAM("en-US"))].getLength() ))) { - ByteString sFallback = pStackData->sText[ ByteString("en-US") ]; + ByteString sFallback = pStackData->sText[rtl::OString(RTL_CONSTASCII_STRINGPARAM("en-US"))]; ByteString sLocalId = pStackData->sIdentifier; ByteString sGroupId; if ( aStack.size() == 1 ) { @@ -670,29 +663,29 @@ void CfgExport::WorkOnRessourceEnd() ByteString sTimeStamp( Export::GetTimeStamp()); - ByteString sCur; - for( unsigned int n = 0; n < aLanguages.size(); n++ ){ - sCur = aLanguages[ n ]; + for (size_t n = 0; n < aLanguages.size(); n++) + { + ByteString sCur = aLanguages[ n ]; - ByteString sText = pStackData->sText[ sCur ]; - if ( !sText.Len()) - sText = sFallback; + ByteString sText = pStackData->sText[ sCur ]; + if ( !sText.Len()) + sText = sFallback; - Export::UnquotHTML( sText ); + Export::UnquotHTML( sText ); - ByteString sOutput( sPrj ); sOutput += "\t"; - sOutput += sPath; - sOutput += "\t0\t"; - sOutput += pStackData->sResTyp; sOutput += "\t"; - sOutput += sGroupId; sOutput += "\t"; - sOutput += sLocalId; sOutput += "\t\t\t0\t"; - sOutput += sCur; - sOutput += "\t"; + ByteString sOutput( sPrj ); sOutput += "\t"; + sOutput += sPath; + sOutput += "\t0\t"; + sOutput += pStackData->sResTyp; sOutput += "\t"; + sOutput += sGroupId; sOutput += "\t"; + sOutput += sLocalId; sOutput += "\t\t\t0\t"; + sOutput += sCur; + sOutput += "\t"; - sOutput += sText; sOutput += "\t\t\t\t"; - sOutput += sTimeStamp; + sOutput += sText; sOutput += "\t\t\t\t"; + sOutput += sTimeStamp; - pOutputStream->WriteLine( sOutput ); + pOutputStream->WriteLine( sOutput ); } } } diff --git a/l10ntools/source/directory.cxx b/l10ntools/source/directory.cxx index 97be7c2332fb..a7cba91f526b 100644 --- a/l10ntools/source/directory.cxx +++ b/l10ntools/source/directory.cxx @@ -54,12 +54,6 @@ Directory::Directory( const rtl::OUString sFullPath , const rtl::OUString sEntry sDirectoryName = sEntry; } - -Directory::Directory( const ByteString sFullPath ) : bSkipLinks( false ) -{ - sDirectoryName = rtl::OUString( sFullPath.GetBuffer() , RTL_TEXTENCODING_UTF8 , sFullPath.Len() ); -} - bool Directory::lessDir ( const Directory& rKey1, const Directory& rKey2 ) { rtl::OUString sName1( ( static_cast< Directory >( rKey1 ) ).getDirectoryName() ); diff --git a/l10ntools/source/export.cxx b/l10ntools/source/export.cxx index 69f1e967b13c..94f1650ef4b0 100644 --- a/l10ntools/source/export.cxx +++ b/l10ntools/source/export.cxx @@ -35,9 +35,10 @@ #include "tokens.h" #include <iostream> #include <vector> +#include <rtl/strbuf.hxx> -extern "C" { int yyerror( char * ); } -extern "C" { int YYWarning( char * ); } +extern "C" { int yyerror( const char * ); } +extern "C" { int YYWarning( const char * ); } Export *pExport = 0L; @@ -363,11 +364,14 @@ bool ResData::getFallbackData( ByteString& sId_in , ByteString& sText_inout ){ return sText_inout.Len() > 0; } -void ResData::addMergedLanguage( ByteString& sLang ){ - aMergedLanguages[ sLang ]=ByteString("1"); +void ResData::addMergedLanguage(rtl::OString& rLang) +{ + aMergedLanguages[rLang] = rtl::OString(RTL_CONSTASCII_STRINGPARAM("1")); } -bool ResData::isMerged( ByteString& sLang ){ - return aMergedLanguages[ sLang ].Equals("1"); + +bool ResData::isMerged(rtl::OString& rLang) +{ + return aMergedLanguages[rLang].equalsL(RTL_CONSTASCII_STRINGPARAM("1")); } /*****************************************************************************/ @@ -379,10 +383,10 @@ sal_Bool ResData::SetId( const ByteString &rId, sal_uInt16 nLevel ) nIdLevel = nLevel; sId = rId; - if ( bChild && bChildWithText ) { - ByteString sError( "ResId after child definition" ); - yyerror( sError.GetBufferAccess()); - sError.ReleaseBufferAccess(); + if ( bChild && bChildWithText ) + { + rtl::OString sError(RTL_CONSTASCII_STRINGPARAM("ResId after child definition")); + yyerror(sError.getStr()); SetError(); } @@ -500,7 +504,7 @@ void Export::Init() bNextMustBeDefineEOL = sal_False; nLevel = 0; nList = LIST_NON; - nListLang = ByteString( String::CreateFromAscii(""),RTL_TEXTENCODING_ASCII_US ); + m_sListLang = ByteString( String::CreateFromAscii(""),RTL_TEXTENCODING_ASCII_US ); nListIndex = 0; for ( size_t i = 0, n = aResStack.size(); i < n; ++i ) delete aResStack[ i ]; @@ -789,21 +793,21 @@ int Export::Execute( int nToken, const char * pToken ) else if ( sKey == "STRINGLIST" ) { pResData->bList = sal_True; nList = LIST_STRING; - nListLang = SOURCE_LANGUAGE; + m_sListLang = SOURCE_LANGUAGE; nListIndex = 0; nListLevel = 0; } else if ( sKey == "FILTERLIST" ) { pResData->bList = sal_True; nList = LIST_FILTER; - nListLang = SOURCE_LANGUAGE; + m_sListLang = SOURCE_LANGUAGE; nListIndex = 0; nListLevel = 0; } else if ( sKey == "UIENTRIES" ) { pResData->bList = sal_True; nList = LIST_UIENTRIES; - nListLang = SOURCE_LANGUAGE; + m_sListLang = SOURCE_LANGUAGE; nListIndex = 0; nListLevel = 0; } @@ -830,14 +834,14 @@ int Export::Execute( int nToken, const char * pToken ) if ( sKey.ToUpperAscii() == "STRINGLIST" ) { pResData->bList = sal_True; nList = LIST_STRING; - nListLang = SOURCE_LANGUAGE; + m_sListLang = SOURCE_LANGUAGE; nListIndex = 0; nListLevel = 0; } else if ( sKey == "FILTERLIST" ) { pResData->bList = sal_True; nList = LIST_FILTER; - nListLang = SOURCE_LANGUAGE; + m_sListLang = SOURCE_LANGUAGE; nListIndex = 0; nListLevel = 0; } @@ -845,7 +849,7 @@ int Export::Execute( int nToken, const char * pToken ) else if ( sKey == "PAIREDLIST" ) { pResData->bList = sal_True; nList = LIST_PAIRED; - nListLang = SOURCE_LANGUAGE; + m_sListLang = SOURCE_LANGUAGE; nListIndex = 0; nListLevel = 0; } @@ -853,14 +857,14 @@ int Export::Execute( int nToken, const char * pToken ) else if ( sKey == "ITEMLIST" ) { pResData->bList = sal_True; nList = LIST_ITEM; - nListLang = SOURCE_LANGUAGE; + m_sListLang = SOURCE_LANGUAGE; nListIndex = 0; nListLevel = 0; } else if ( sKey == "UIENTRIES" ) { pResData->bList = sal_True; nList = LIST_UIENTRIES; - nListLang = SOURCE_LANGUAGE; + m_sListLang = SOURCE_LANGUAGE; nListIndex = 0; nListLevel = 0; } @@ -883,7 +887,7 @@ int Export::Execute( int nToken, const char * pToken ) if ( nList ) { ByteString sLang=sToken.GetToken( 1, '[' ).GetToken( 0, ']' ); CleanValue( sLang ); - nListLang = sLang; + m_sListLang = sLang; nListIndex = 0; nListLevel = 0; } @@ -902,8 +906,9 @@ int Export::Execute( int nToken, const char * pToken ) if ( sEntry == "\\\"" ) sEntry = "\""; InsertListEntry( sEntry, sOrig ); - if ( bMergeMode && ( sEntry != "\"" )) { - PrepareTextToMerge( sOrig, nList, nListLang, pResData ); + if ( bMergeMode && ( sEntry != "\"" )) + { + PrepareTextToMerge( sOrig, nList, m_sListLang, pResData ); } } } @@ -926,7 +931,7 @@ int Export::Execute( int nToken, const char * pToken ) sLang = sToken.GetToken( 0, '=' ).GetToken( 1, '[' ).GetToken( 0, ']' ); CleanValue( sLang ); } - ByteString nLangIndex = sLang; + rtl::OString sLangIndex = sLang; ByteString sOrigKey = sKey; if ( sText.Len() && sLang.Len() ) { if (( sKey.ToUpperAscii() == "TEXT" ) || @@ -936,69 +941,82 @@ int Export::Execute( int nToken, const char * pToken ) ( sKey == "UINAME" )) { SetChildWithText(); - if ( Export::isSourceLanguage( nLangIndex ) ) + if ( Export::isSourceLanguage( sLangIndex ) ) pResData->SetId( sText, ID_LEVEL_TEXT ); pResData->bText = sal_True; pResData->sTextTyp = sOrigKey; if ( bMergeMode ) { - PrepareTextToMerge( sOrig, STRING_TYP_TEXT, nLangIndex, pResData ); + PrepareTextToMerge( sOrig, STRING_TYP_TEXT, sLangIndex, pResData ); } - else { - if ( pResData->sText[ nLangIndex ].Len()) { - ByteString sError( "Language " ); - sError += nLangIndex; - sError += " defined twice"; + else + { + if (pResData->sText[ sLangIndex ].getLength()) + { + rtl::OStringBuffer sError(RTL_CONSTASCII_STRINGPARAM("Language ")); + sError.append(sLangIndex); + sError.append(RTL_CONSTASCII_STRINGPARAM("defined twice")); + yyerror(sError.getStr()); } - pResData->sText[ nLangIndex ] = sText; + pResData->sText[ sLangIndex ] = sText; } } else if ( sKey == "HELPTEXT" ) { SetChildWithText(); pResData->bHelpText = sal_True; - if ( bBreakWhenHelpText ) { - ByteString sError( "\"HelpText\" found in source\n" ); - YYWarning( sError.GetBufferAccess()); - sError.ReleaseBufferAccess(); + if ( bBreakWhenHelpText ) + { + rtl::OString sError( + RTL_CONSTASCII_STRINGPARAM("\"HelpText\" found in source\n")); + YYWarning(sError.getStr()); SetError(); } if ( bMergeMode ) - PrepareTextToMerge( sOrig, STRING_TYP_HELPTEXT, nLangIndex, pResData ); - else { - if ( pResData->sHelpText[ nLangIndex ].Len()) { - ByteString sError( "Language " ); - sError += nLangIndex; - sError += " defined twice"; + PrepareTextToMerge( sOrig, STRING_TYP_HELPTEXT, sLangIndex, pResData ); + else + { + if (pResData->sHelpText[ sLangIndex ].getLength()) + { + rtl::OStringBuffer sError(RTL_CONSTASCII_STRINGPARAM("Language ")); + sError.append(sLangIndex); + sError.append(" defined twice"); + YYWarning(sError.getStr()); } - pResData->sHelpText[ nLangIndex ] = sText; + pResData->sHelpText[ sLangIndex ] = sText; } } else if ( sKey == "QUICKHELPTEXT" ) { SetChildWithText(); pResData->bQuickHelpText = sal_True; if ( bMergeMode ) - PrepareTextToMerge( sOrig, STRING_TYP_QUICKHELPTEXT, nLangIndex, pResData ); - else { - if ( pResData->sQuickHelpText[ nLangIndex ].Len()) { - ByteString sError( "Language " ); - sError += nLangIndex; - sError += " defined twice"; + PrepareTextToMerge( sOrig, STRING_TYP_QUICKHELPTEXT, sLangIndex, pResData ); + else + { + if (pResData->sQuickHelpText[ sLangIndex ].getLength()) + { + rtl::OStringBuffer sError(RTL_CONSTASCII_STRINGPARAM("Language ")); + sError.append(sLangIndex); + sError.append(RTL_CONSTASCII_STRINGPARAM(" defined twice")); + YYWarning(sError.getStr()); } - pResData->sQuickHelpText[ nLangIndex ] = sText; + pResData->sQuickHelpText[ sLangIndex ] = sText; } } else if ( sKey == "TITLE" ) { SetChildWithText(); pResData->bTitle = sal_True; if ( bMergeMode ) - PrepareTextToMerge( sOrig, STRING_TYP_TITLE, nLangIndex, pResData ); - else { - if ( pResData->sTitle[ nLangIndex ].Len()) { - ByteString sError( "Language " ); - sError += nLangIndex; - sError += " defined twice"; + PrepareTextToMerge( sOrig, STRING_TYP_TITLE, sLangIndex, pResData ); + else + { + if ( pResData->sTitle[ sLangIndex ].getLength()) + { + rtl::OStringBuffer sError(RTL_CONSTASCII_STRINGPARAM("Language ")); + sError.append(sLangIndex); + sError.append(RTL_CONSTASCII_STRINGPARAM(" defined twice")); + YYWarning(sError.getStr()); } - pResData->sTitle[ nLangIndex ] = sText; + pResData->sTitle[ sLangIndex ] = sText; } } else if ( sKey == "ACCESSPATH" ) { @@ -1155,31 +1173,6 @@ void Export::CutComment( ByteString &rText ) } } -void Export::UnmergeUTF8( ByteString& sOrig ){ - sal_uInt16 nPos1 = sOrig.Search('\"'); - sal_uInt16 nPos2 = sOrig.SearchBackward('\"'); - if( nPos1 > 0 && nPos2 > 0 && nPos1 < nPos2){ - ByteString sPart = sOrig.Copy(nPos1+1 , nPos2-1); - ByteString sPartUTF8 = sPart; - sPartUTF8.Convert( RTL_TEXTENCODING_MS_1252 , RTL_TEXTENCODING_UTF8 ); - sOrig.SearchAndReplace( sPart , sPartUTF8 ); - } -} - -/*****************************************************************************/ -sal_Bool Export::ListExists( ResData *pResData, sal_uInt16 nLst ) -/*****************************************************************************/ -{ - switch ( nLst ) { - case LIST_STRING: return pResData->pStringList != NULL; - case LIST_FILTER: return pResData->pFilterList != NULL; - case LIST_ITEM: return pResData->pItemList != NULL; - case LIST_PAIRED: return pResData->pPairedList != NULL; - case LIST_UIENTRIES: return pResData->pUIEntries != NULL; - } - return sal_False; -} - /*****************************************************************************/ sal_Bool Export::WriteData( ResData *pResData, sal_Bool bCreateNew ) /*****************************************************************************/ @@ -1194,13 +1187,13 @@ sal_Bool Export::WriteData( ResData *pResData, sal_Bool bCreateNew ) // mandatory to export: en-US - if (( pResData->sText[ SOURCE_LANGUAGE ].Len()) + if (( pResData->sText[ SOURCE_LANGUAGE ].getLength()) || - ( pResData->sHelpText[ SOURCE_LANGUAGE ].Len()) + ( pResData->sHelpText[ SOURCE_LANGUAGE ].getLength()) || - ( pResData->sQuickHelpText[ SOURCE_LANGUAGE ].Len()) + ( pResData->sQuickHelpText[ SOURCE_LANGUAGE ].getLength()) || - ( pResData->sTitle[ SOURCE_LANGUAGE ].Len())) + ( pResData->sTitle[ SOURCE_LANGUAGE ].getLength())) { FillInFallbacks( pResData ); @@ -1223,35 +1216,35 @@ sal_Bool Export::WriteData( ResData *pResData, sal_Bool bCreateNew ) for( unsigned int n = 0; n < aLanguages.size(); n++ ){ sCur = aLanguages[ n ]; if ( !sCur.EqualsIgnoreCaseAscii("x-comment") ){ - if ( pResData->sText[ sCur ].Len()) + if (pResData->sText[ sCur ].getLength()) sXText = pResData->sText[ sCur ]; else { sXText = pResData->sText[ SOURCE_LANGUAGE ]; } - if ( pResData->sHelpText[ sCur ].Len()) + if (pResData->sHelpText[ sCur ].getLength()) sXHText = pResData->sHelpText[ sCur ]; else { sXHText = pResData->sHelpText[ SOURCE_LANGUAGE ]; } - if ( pResData->sQuickHelpText[ sCur ].Len()) + if (pResData->sQuickHelpText[ sCur ].getLength()) sXQHText = pResData->sQuickHelpText[ sCur ]; else { sXQHText = pResData->sQuickHelpText[ SOURCE_LANGUAGE ]; } - if ( pResData->sTitle[ sCur ].Len()) + if (pResData->sTitle[ sCur ].getLength()) sXTitle = pResData->sTitle[ sCur ]; - else { + else sXTitle = pResData->sTitle[ SOURCE_LANGUAGE ]; - } if ( !sXText.Len()) sXText = "-"; - if ( !sXHText.Len()) { - if ( pResData->sHelpText[ SOURCE_LANGUAGE ].Len()) + if ( !sXHText.Len()) + { + if (pResData->sHelpText[ SOURCE_LANGUAGE ].getLength()) sXHText = pResData->sHelpText[ SOURCE_LANGUAGE ]; } } @@ -1268,7 +1261,7 @@ sal_Bool Export::WriteData( ResData *pResData, sal_Bool bCreateNew ) sOutput += sLID; sOutput += "\t"; sOutput += pResData->sHelpId; sOutput += "\t"; sOutput += pResData->sPForm; sOutput += "\t"; - sOutput += ByteString::CreateFromInt64( pResData->nWidth ); sOutput += "\t"; + sOutput += ByteString(rtl::OString::valueOf(static_cast<sal_Int64>(pResData->nWidth))); sOutput += "\t"; sOutput += sCur; sOutput += "\t"; @@ -1369,45 +1362,48 @@ sal_Bool Export::WriteExportList( ResData *pResData, ExportList *pExportList, // ByteString a("Export::WriteExportList::pEntry"); // Export::DumpMap( a, *pEntry ); - ByteString sLID( ByteString::CreateFromInt64( i + 1 )); - for( unsigned int n = 0; n < aLanguages.size(); n++ ){ + ByteString sLID(rtl::OString::valueOf(static_cast<sal_Int64>(i + 1))); + for (unsigned int n = 0; n < aLanguages.size(); ++n) + { sCur = aLanguages[ n ]; - if ( (*pEntry)[ SOURCE_LANGUAGE ].Len() ) + if ((*pEntry)[ SOURCE_LANGUAGE ].getLength()) + { + if ( bEnableExport ) { - if ( bEnableExport ) + ByteString sText((*pEntry)[ SOURCE_LANGUAGE ] ); + + // Strip PairList Line String + if( rTyp.EqualsIgnoreCaseAscii("pairedlist") ) { - ByteString sText((*pEntry)[ SOURCE_LANGUAGE ] ); - - // Strip PairList Line String - if( rTyp.EqualsIgnoreCaseAscii("pairedlist") ){ - sLID = GetPairedListID( sText ); - if ((*pEntry)[ sCur ].Len()) - sText = (*pEntry)[ sCur ]; - sText = GetPairedListString( sText ); - } - else{ - sText = StripList( (*pEntry)[ sCur ] ); - if( sText == "\\\"" ) - sText = "\""; - } + sLID = GetPairedListID( sText ); + if ((*pEntry)[ sCur ].getLength()) + sText = (*pEntry)[ sCur ]; + sText = GetPairedListString( sText ); + } + else + { + sText = StripList( (*pEntry)[ sCur ] ); + if( sText == "\\\"" ) + sText = "\""; + } - ByteString sOutput( sProject ); sOutput += "\t"; - if ( sRoot.Len()) - sOutput += sActFileName; - sOutput += "\t0\t"; - sOutput += rTyp; sOutput += "\t"; - sOutput += sGID; sOutput += "\t"; - sOutput += sLID; sOutput += "\t\t"; - sOutput += pResData->sPForm; sOutput += "\t0\t"; - sOutput += sCur; sOutput += "\t"; + ByteString sOutput( sProject ); sOutput += "\t"; + if ( sRoot.Len()) + sOutput += sActFileName; + sOutput += "\t0\t"; + sOutput += rTyp; sOutput += "\t"; + sOutput += sGID; sOutput += "\t"; + sOutput += sLID; sOutput += "\t\t"; + sOutput += pResData->sPForm; sOutput += "\t0\t"; + sOutput += sCur; sOutput += "\t"; - sOutput += sText; sOutput += "\t\t\t\t"; - sOutput += sTimeStamp; + sOutput += sText; sOutput += "\t\t\t\t"; + sOutput += sTimeStamp; - aOutput.WriteLine( sOutput ); + aOutput.WriteLine( sOutput ); - } } + } } if ( bCreateNew ) delete [] pEntry; @@ -1433,11 +1429,11 @@ ByteString Export::FullId() } } } - if ( sFull.Len() > 255 ) { - ByteString sError( "GroupId > 255 chars" ); - printf("GroupID = %s\n",sFull.GetBuffer()); - yyerror( sError.GetBufferAccess()); - sError.ReleaseBufferAccess(); + if ( sFull.Len() > 255 ) + { + rtl::OString sError(RTL_CONSTASCII_STRINGPARAM("GroupId > 255 chars")); + printf("GroupID = %s\n", sFull.GetBuffer()); + yyerror(sError.getStr()); } return sFull; @@ -1493,21 +1489,22 @@ void Export::InsertListEntry( const ByteString &rText, const ByteString &rLine ) else return; - if ( nListIndex + 1 > pList->size()) { + if ( nListIndex + 1 > pList->size()) + { ExportListEntry *pNew = new ExportListEntry(); - (*pNew)[ LIST_REFID ] = ByteString::CreateFromInt32( REFID_NONE ); - pList->push_back( pNew ); + (*pNew)[LIST_REFID] = rtl::OString::valueOf(static_cast<sal_Int32>(REFID_NONE)); + pList->push_back(pNew); } ExportListEntry *pCurEntry = (*pList)[ nListIndex ]; // For paired list use the line to set proper lid if( nList == LIST_PAIRED ){ - (*pCurEntry)[ nListLang ] = rLine; + (*pCurEntry)[ m_sListLang ] = rLine; }else - (*pCurEntry)[ nListLang ] = rText; + (*pCurEntry)[ m_sListLang ] = rText; // Remember en-US fallback string, so each list has the same amount of elements - if ( Export::isSourceLanguage( nListLang ) ) { + if ( Export::isSourceLanguage( m_sListLang ) ) { if( nList == LIST_PAIRED ){ const ByteString sPlist("pairedlist"); ByteString sKey = MergeDataFile::CreateKey( sPlist , pResData->sId , GetPairedListID( rLine ) , sFilename ); @@ -1520,14 +1517,14 @@ void Export::InsertListEntry( const ByteString &rText, const ByteString &rLine ) a.Append( "." ); a.Append( pResData->sId ); sal_Int64 x = nListIndex+1; - ByteString b( ByteString::CreateFromInt64( x ) ); + ByteString b(rtl::OString::valueOf(x)); ByteString sKey = MergeDataFile::CreateKey( sPlist , a , b , sFilename ); pResData->addFallbackData( sKey , rText ); } // new fallback } - if ( Export::isSourceLanguage( nListLang ) ) { + if ( Export::isSourceLanguage( m_sListLang ) ) { if( nList == LIST_PAIRED ){ (*pCurEntry)[ SOURCE_LANGUAGE ] = rLine; } @@ -1537,7 +1534,7 @@ void Export::InsertListEntry( const ByteString &rText, const ByteString &rLine ) pList->NewSourceLanguageListEntry(); } - //printf("Export::InsertListEntry ResData.id = %s ResData.ListData = %s\n",pResData->sId.GetBuffer() ,(*pCurEntry)[ nListLang ].GetBuffer()); + //printf("Export::InsertListEntry ResData.id = %s ResData.ListData = %s\n",pResData->sId.GetBuffer() ,(*pCurEntry)[ m_sListLang ].GetBuffer()); nListIndex++; } @@ -1752,10 +1749,8 @@ void Export::ConvertMergeContent( ByteString &rText ) rText += "\""; } -/*****************************************************************************/ -sal_Bool Export::PrepareTextToMerge( ByteString &rText, sal_uInt16 nTyp, - ByteString &nLangIndex, ResData *pResData ) -/*****************************************************************************/ +sal_Bool Export::PrepareTextToMerge(ByteString &rText, sal_uInt16 nTyp, + rtl::OString &rLangIndex, ResData *pResData) { // position to merge in: sal_uInt16 nStart = 0; @@ -1805,13 +1800,14 @@ sal_Bool Export::PrepareTextToMerge( ByteString &rText, sal_uInt16 nTyp, break; } - if ( pList ) { + if (pList) + { ExportListEntry *pCurEntry = (*pList)[ nListIndex - 1 ]; - if ( pCurEntry ) { + if ( pCurEntry ) + { rText = (*pCurEntry)[ SOURCE_LANGUAGE ]; - if( nTyp == LIST_PAIRED ){ - pResData->addMergedLanguage( nLangIndex ); - } + if( nTyp == LIST_PAIRED ) + pResData->addMergedLanguage(rLangIndex); } } @@ -1843,7 +1839,7 @@ sal_Bool Export::PrepareTextToMerge( ByteString &rText, sal_uInt16 nTyp, if ( pResData->sResTyp.EqualsIgnoreCaseAscii( "pairedlist" ) ){ pResData->sId = GetPairedListID( sLastListLine ); } - else pResData->sId = ByteString::CreateFromInt32( nListIndex ); + else pResData->sId = rtl::OString::valueOf(static_cast<sal_Int32>(nListIndex)); if ( pResData->sGId.Len()) pResData->sGId += "."; @@ -1918,15 +1914,15 @@ sal_Bool Export::PrepareTextToMerge( ByteString &rText, sal_uInt16 nTyp, } ByteString sContent; - pEntrys->GetTransex3Text( sContent, nTyp, nLangIndex ); - if ( !sContent.Len() && ( ! Export::isSourceLanguage( nLangIndex ) )) { + pEntrys->GetTransex3Text(sContent, nTyp, rLangIndex); + if (!sContent.Len() && (!Export::isSourceLanguage(rLangIndex))) + { rText = sOrigText; return sal_False; // no data found } - if ( Export::isSourceLanguage( nLangIndex ) ) { + if (Export::isSourceLanguage(rLangIndex)) return sal_False; - } ByteString sPostFix( rText.Copy( ++nEnd )); rText.Erase( nStart ); @@ -2128,8 +2124,9 @@ void Export::MergeRest( ResData *pResData, sal_uInt16 nMode ) case LIST_ITEM : pResData->sResTyp = "itemlist"; pList = pResData->pItemList; bPairedList = false; break; case LIST_PAIRED : pResData->sResTyp = "pairedlist"; pList = pResData->pPairedList; bPairedList = true; break; } - ByteString sCur; - for( unsigned int n = 0; n < aLanguages.size(); n++ ){ + rtl::OString sCur; + for( unsigned int n = 0; n < aLanguages.size(); n++ ) + { sCur = aLanguages[ n ]; sal_uInt16 nIdx = 1; @@ -2155,46 +2152,65 @@ void Export::MergeRest( ResData *pResData, sal_uInt16 nMode ) bText = pEntrys->GetTransex3Text( sText , STRING_TYP_TEXT, SOURCE_LANGUAGE , sal_False ); // Use fallback, if data is missing in sdf file - if( !bText && bPairedList ){ - if( pResData->isMerged( sCur ) ) break; + if( !bText && bPairedList ) + { + if( pResData->isMerged( sCur ) ) + break; const ByteString sPlist("pairedlist"); ByteString sKey = MergeDataFile::CreateKey( sPlist , pResData->sGId , pResData->sId , sFilename ); bText = pResData->getFallbackData( sKey , sText ); - }else if ( !bText ){// new fallback + } + else if ( !bText ) // new fallback + { if( pResData->isMerged( sCur ) ) break; const ByteString sPlist("list"); ByteString sKey = MergeDataFile::CreateKey( sPlist , pResData->sGId , pResData->sId , sFilename ); bText = pResData->getFallbackData( sKey , sText ); } // new fallback - if ( bText && sText.Len()) { - if ( nIdx == 1 ) { - ByteString sHead; + if ( bText && sText.Len()) + { + if ( nIdx == 1 ) + { + rtl::OStringBuffer sHead; if ( bNextMustBeDefineEOL ) - sHead = "\\\n\t"; - sHead += sSpace; - switch ( nT ) { - case LIST_STRING : sHead += "StringList "; break; - case LIST_FILTER : sHead += "FilterList "; break; - case LIST_ITEM : sHead += "ItemList "; break; - case LIST_PAIRED : sHead += "PairedList "; break; - case LIST_UIENTRIES : sHead += "UIEntries "; break; + sHead.append(RTL_CONSTASCII_STRINGPARAM("\\\n\t")); + sHead.append(sSpace); + switch ( nT ) + { + case LIST_STRING: + sHead.append(RTL_CONSTASCII_STRINGPARAM("StringList ")); + break; + case LIST_FILTER: + sHead.append(RTL_CONSTASCII_STRINGPARAM("FilterList ")); + break; + case LIST_ITEM: + sHead.append(RTL_CONSTASCII_STRINGPARAM("ItemList ")); + break; + case LIST_PAIRED: + sHead.append(RTL_CONSTASCII_STRINGPARAM("PairedList ")); + break; + case LIST_UIENTRIES: + sHead.append(RTL_CONSTASCII_STRINGPARAM("UIEntries ")); + break; } - sHead += "[ "; - sHead += sCur; - sHead += " ] "; + sHead.append(RTL_CONSTASCII_STRINGPARAM("[ ")); + sHead.append(sCur); + sHead.append(RTL_CONSTASCII_STRINGPARAM(" ] ")); //} - if ( bDefine || bNextMustBeDefineEOL ) { - sHead += "= \\\n"; - sHead += sSpace; - sHead += "\t{\\\n\t"; + if ( bDefine || bNextMustBeDefineEOL ) + { + sHead.append(RTL_CONSTASCII_STRINGPARAM("= \\\n")); + sHead.append(sSpace); + sHead.append(RTL_CONSTASCII_STRINGPARAM("\t{\\\n\t")); } - else { - sHead += "= \n"; - sHead += sSpace; - sHead += "\t{\n\t"; + else + { + sHead.append(RTL_CONSTASCII_STRINGPARAM("= \n")); + sHead.append(sSpace); + sHead.append(RTL_CONSTASCII_STRINGPARAM("\t{\n\t")); } - WriteToMerged( sHead , true); + WriteToMerged(sHead.makeStringAndClear() , true); } ByteString sLine; if ( pList && (*pList)[ nLIndex ] ) @@ -2254,7 +2270,7 @@ void Export::MergeRest( ResData *pResData, sal_uInt16 nMode ) } } else - pResData->sId = ByteString::CreateFromInt32( ++nIdx ); + pResData->sId = rtl::OString::valueOf(static_cast<sal_Int32>(++nIdx)); } else break; @@ -2316,7 +2332,7 @@ void Export::MergeRest( ResData *pResData, sal_uInt16 nMode ) } } - while( PrepareTextToMerge( sLine, nList, nListLang, pResData ) && ( nListIndex <= nMaxIndex )) { + while( PrepareTextToMerge( sLine, nList, m_sListLang, pResData ) && ( nListIndex <= nMaxIndex )) { ByteString sText( "\t" ); sText += sLine; sText += " ;"; diff --git a/l10ntools/source/export2.cxx b/l10ntools/source/export2.cxx index 0b7fb44d8a95..d7d39a453511 100644 --- a/l10ntools/source/export2.cxx +++ b/l10ntools/source/export2.cxx @@ -140,75 +140,6 @@ std::vector<ByteString> Export::GetForcedLanguages(){ std::vector<ByteString> Export::aLanguages = std::vector<ByteString>(); std::vector<ByteString> Export::aForcedLanguages = std::vector<ByteString>(); - -/*****************************************************************************/ -void Export::QuotHTMLXRM( ByteString &rString ) -/*****************************************************************************/ -{ - ByteString sReturn; - for ( sal_uInt16 i = 0; i < rString.Len(); i++ ) { - ByteString sTemp = rString.Copy( i ); - if ( sTemp.Search( "<Arg n=" ) == 0 ) { - while ( i < rString.Len() && rString.GetChar( i ) != '>' ) { - sReturn += rString.GetChar( i ); - i++; - } - if ( rString.GetChar( i ) == '>' ) { - sReturn += ">"; - i++; - } - } - - if ( i < rString.Len()) { - switch ( rString.GetChar( i )) { - case '<': - if( i+2 < rString.Len() && - (rString.GetChar( i+1 ) == 'b' || rString.GetChar( i+1 ) == 'B') && - rString.GetChar( i+2 ) == '>' ) - { - sReturn +="<b>"; - i += 2; - } - else if( i+3 < rString.Len() && - rString.GetChar( i+1 ) == '/' && - (rString.GetChar( i+2 ) == 'b' || rString.GetChar( i+2 ) == 'B') && - rString.GetChar( i+3 ) == '>' ) - { - sReturn +="</b>"; - i += 3; - } - else - sReturn += "<"; - break; - - case '>': - sReturn += ">"; - break; - - case '\"': - sReturn += """; - break; - - case '\'': - sReturn += "'"; - break; - - case '&': - if ((( i + 4 ) < rString.Len()) && - ( rString.Copy( i, 5 ) == "&" )) - sReturn += rString.GetChar( i ); - else - sReturn += "&"; - break; - - default: - sReturn += rString.GetChar( i ); - break; - } - } - } - rString = sReturn; -} /*****************************************************************************/ void Export::QuotHTML( ByteString &rString ) /*****************************************************************************/ @@ -402,12 +333,6 @@ bool Export::isSourceLanguage( const ByteString &sLanguage ) bool Export::isAllowed( const ByteString &sLanguage ){ return ! ( sLanguage.EqualsIgnoreCaseAscii("en-US") ); } -/*****************************************************************************/ -bool Export::LanguageAllowed( const ByteString &nLanguage ) -/*****************************************************************************/ -{ - return std::find( aLanguages.begin() , aLanguages.end() , nLanguage ) != aLanguages.end(); -} bool Export::isInitialized = false; @@ -452,52 +377,31 @@ ByteString Export::GetFallbackLanguage( const ByteString nLanguage ) return sFallback; } -void Export::replaceEncoding( ByteString& rString ) -{ -// ™ -> \u2122 - - for( xub_StrLen idx = 0; idx <= rString.Len()-8 ; idx++ ) - { - if( rString.GetChar( idx ) == '&' && - rString.GetChar( idx+1 ) == '#' && - rString.GetChar( idx+2 ) == 'x' && - rString.GetChar( idx+7 ) == ';' ) - { - ByteString sTmp = rString.Copy( 0 , idx ); - sTmp.Append( "\\u" ); - sTmp.Append( rString.GetChar( idx+3 ) ); - sTmp.Append( rString.GetChar( idx+4 ) ); - sTmp.Append( rString.GetChar( idx+5 ) ); - sTmp.Append( rString.GetChar( idx+6 ) ); - sTmp.Append( rString.Copy( idx+8 , rString.Len() ) ); - rString = sTmp; - } - } -} - /*****************************************************************************/ void Export::FillInFallbacks( ResData *pResData ) /*****************************************************************************/ { - ByteString sCur; - for( unsigned int n = 0; n < aLanguages.size(); n++ ){ - sCur = aLanguages[ n ]; - if( isAllowed( sCur ) ){ + for (size_t n = 0; n < aLanguages.size(); ++n) + { + ByteString sCur = aLanguages[ n ]; + if (isAllowed(sCur)) + { ByteString nFallbackIndex = GetFallbackLanguage( sCur ); - if( nFallbackIndex.Len() ){ - if ( !pResData->sText[ sCur ].Len()) + if( nFallbackIndex.Len() ) + { + if (pResData->sText[ sCur ].isEmpty()) pResData->sText[ sCur ] = pResData->sText[ nFallbackIndex ]; - if ( !pResData->sHelpText[ sCur ].Len()) + if (pResData->sHelpText[ sCur ].isEmpty()) pResData->sHelpText[ sCur ] = pResData->sHelpText[ nFallbackIndex ]; - if ( !pResData->sQuickHelpText[ sCur ].Len()) + if (pResData->sQuickHelpText[ sCur ].isEmpty()) pResData->sQuickHelpText[ sCur ] = pResData->sQuickHelpText[ nFallbackIndex ]; - if ( !pResData->sTitle[ sCur ].Len()) + if (!pResData->sTitle[ sCur ].isEmpty()) pResData->sTitle[ sCur ] = pResData->sTitle[ nFallbackIndex ]; @@ -530,11 +434,12 @@ void Export::FillInListFallbacks( ExportList *pList, const ByteString &nSource, const ByteString &nFallback ) /*****************************************************************************/ { - - for ( size_t i = 0; i < pList->size(); i++ ) { + for (size_t i = 0; i < pList->size(); ++i) + { ExportListEntry *pEntry = (*pList)[ i ]; - if ( !( *pEntry )[ nSource ].Len()){ - ( *pEntry )[ nSource ] = ( *pEntry )[ nFallback ]; + if ( (*pEntry )[nSource].isEmpty() ) + { + ( *pEntry )[ nSource ] = ( *pEntry )[ nFallback ]; ByteString x = ( *pEntry )[ nSource ]; ByteString y = ( *pEntry )[ nFallback ]; } @@ -611,15 +516,6 @@ const char* Export::GetEnv( const char *pVar ) return pRet; } - -int Export::getCurrentDirectory( rtl::OUString& base_fqurl_out, rtl::OUString& base_out ) -{ - DirEntry aDir("."); - aDir.ToAbs(); - base_out = rtl::OUString( aDir.GetFull() ); - return osl::File::getFileURLFromSystemPath( base_out , base_fqurl_out ); -} - void Export::getCurrentDir( string& dir ) { char buffer[64000]; @@ -667,12 +563,6 @@ void Export::getRandomName( const ByteString& sPrefix , ByteString& sRandStr , c sRandStr.Append( sPostfix ); } -void Export::getRandomName( ByteString& sRandStr ) -{ - const ByteString sEmpty; - getRandomName( sEmpty , sRandStr , sEmpty ); -} - /*****************************************************************************/ DirEntry Export::GetTempFile() /*****************************************************************************/ diff --git a/l10ntools/source/file.cxx b/l10ntools/source/file.cxx index d57c20d92c04..f87c24f59598 100644 --- a/l10ntools/source/file.cxx +++ b/l10ntools/source/file.cxx @@ -34,11 +34,6 @@ namespace transex { -File::File( const rtl::OUString sFile ) -{ - sFileName = sFile; -} - File::File( const rtl::OUString sFullPath , const rtl::OUString sFile ) { sFileName = sFile; diff --git a/l10ntools/source/gsicheck.cxx b/l10ntools/source/gsicheck.cxx index 89fb66775d54..2fd8b8b540b1 100644 --- a/l10ntools/source/gsicheck.cxx +++ b/l10ntools/source/gsicheck.cxx @@ -32,7 +32,8 @@ #include <tools/fsys.hxx> #include <tools/stream.hxx> -// local includes +#include <rtl/strbuf.hxx> + #include "tagtest.hxx" #include "gsicheck.hxx" @@ -165,7 +166,10 @@ GSILine::GSILine( const ByteString &rLine, sal_uLong nLine ) // limit GID and LID to MAX_GID_LID_LEN chars each for database conformity, see #137575# if ( rLine.GetToken( 4, '\t' ).Len() > MAX_GID_LID_LEN || rLine.GetToken( 5, '\t' ).Len() > MAX_GID_LID_LEN ) { - PrintError( ByteString("GID and LID may only be ").Append( ByteString::CreateFromInt32(MAX_GID_LID_LEN) ).Append( " chars long each!" ), "Line format", aLangId, sal_True, GetLineNumber(), GetUniqId() ); + PrintError(rtl::OStringBuffer(RTL_CONSTASCII_STRINGPARAM("GID and LID may only be ")) + .append(static_cast<sal_Int32>(MAX_GID_LID_LEN)) + .append(RTL_CONSTASCII_STRINGPARAM(" chars long each!" )).getStr(), + "Line format", aLangId, sal_True, GetLineNumber(), GetUniqId()); NotOK(); } } @@ -521,7 +525,9 @@ sal_Bool GSIBlock::TestUTF8( GSILine* pTestee, sal_Bool bFixTags ) if ( !IsUTF8( pTestee->GetText(), bFixTags, nErrorPos, aErrorMsg, bHasBeenFixed, aFixed ) ) { ByteString aContext( pTestee->GetText().Copy( nErrorPos, 20 ) ); - PrintError( aErrorMsg.Append(" in Text at Position " ).Append( ByteString::CreateFromInt32( nErrorPos ) ), "Text format", aContext, pTestee->GetLineNumber(), pTestee->GetUniqId() ); + PrintError(rtl::OStringBuffer(aErrorMsg).append(RTL_CONSTASCII_STRINGPARAM(" in Text at Position ")) + .append(static_cast<sal_Int32>(nErrorPos)).getStr(), + "Text format", aContext, pTestee->GetLineNumber(), pTestee->GetUniqId()); bError = sal_True; if ( bHasBeenFixed ) { @@ -532,7 +538,9 @@ sal_Bool GSIBlock::TestUTF8( GSILine* pTestee, sal_Bool bFixTags ) if ( !IsUTF8( pTestee->GetQuickHelpText(), bFixTags, nErrorPos, aErrorMsg, bHasBeenFixed, aFixed ) ) { ByteString aContext( pTestee->GetQuickHelpText().Copy( nErrorPos, 20 ) ); - PrintError( aErrorMsg.Append(" in QuickHelpText at Position " ).Append( ByteString::CreateFromInt32( nErrorPos ) ), "Text format", aContext, pTestee->GetLineNumber(), pTestee->GetUniqId() ); + PrintError(rtl::OStringBuffer(aErrorMsg).append(RTL_CONSTASCII_STRINGPARAM(" in QuickHelpText at Position ")) + .append(static_cast<sal_Int32>(nErrorPos)).getStr(), + "Text format", aContext, pTestee->GetLineNumber(), pTestee->GetUniqId()); bError = sal_True; if ( bHasBeenFixed ) { @@ -543,7 +551,9 @@ sal_Bool GSIBlock::TestUTF8( GSILine* pTestee, sal_Bool bFixTags ) if ( !IsUTF8( pTestee->GetTitle(), bFixTags, nErrorPos, aErrorMsg, bHasBeenFixed, aFixed ) ) { ByteString aContext( pTestee->GetTitle().Copy( nErrorPos, 20 ) ); - PrintError( aErrorMsg.Append(" in Title at Position " ).Append( ByteString::CreateFromInt32( nErrorPos ) ), "Text format", aContext, pTestee->GetLineNumber(), pTestee->GetUniqId() ); + PrintError(rtl::OStringBuffer(aErrorMsg).append(RTL_CONSTASCII_STRINGPARAM(" in Title at Position ")) + .append(static_cast<sal_Int32>(nErrorPos)).getStr(), + "Text format", aContext, pTestee->GetLineNumber(), pTestee->GetUniqId()); bError = sal_True; if ( bHasBeenFixed ) { @@ -568,7 +578,9 @@ sal_Bool GSIBlock::HasSuspiciousChars( GSILine* pTestee, GSILine* pSource ) String aUTF8Tester = String( pTestee->GetText(), 0, nPos, RTL_TEXTENCODING_UTF8 ); sal_uInt16 nErrorPos = aUTF8Tester.Len(); ByteString aContext( pTestee->GetText().Copy( nPos, 20 ) ); - PrintError( ByteString("Found double questionmark in translation only. Looks like an encoding problem at Position " ).Append( ByteString::CreateFromInt32( nErrorPos ) ), "Text format", aContext, pTestee->GetLineNumber(), pTestee->GetUniqId() ); + PrintError(rtl::OStringBuffer(RTL_CONSTASCII_STRINGPARAM("Found double questionmark in translation only. Looks like an encoding problem at Position ")) + .append(static_cast<sal_Int32>(nErrorPos)).getStr(), + "Text format", aContext, pTestee->GetLineNumber(), pTestee->GetUniqId()); pTestee->NotOK(); return sal_True; } @@ -747,7 +759,8 @@ void Help() fprintf( stdout, "gsicheck checks the syntax of tags in GSI-Files and SDF-Files\n" ); fprintf( stdout, " checks for inconsistencies and malicious UTF8 encoding\n" ); fprintf( stdout, " checks tags in Online Help\n" ); - fprintf( stdout, " checks for *new* KeyIDs and relax GID/LID length to %s\n", ByteString::CreateFromInt32(MAX_GID_LID_LEN).GetBuffer() ); + fprintf( stdout, " checks for *new* KeyIDs and relax GID/LID length to %s\n", + rtl::OString::valueOf(static_cast<sal_Int32>(MAX_GID_LID_LEN)).getStr() ); fprintf( stdout, "\n" ); fprintf( stdout, "Syntax: gsicheck [ -c ] [-f] [ -we ] [ -wef ErrorFilename ] [ -wc ]\n" ); fprintf( stdout, " [ -wcf CorrectFilename ] [ -s | -t ] [ -l LanguageID ]\n" ); diff --git a/l10ntools/source/help/HelpCompiler.cxx b/l10ntools/source/help/HelpCompiler.cxx index df2093931126..a3f2cd193a19 100644 --- a/l10ntools/source/help/HelpCompiler.cxx +++ b/l10ntools/source/help/HelpCompiler.cxx @@ -351,7 +351,7 @@ void myparser::traverse( xmlNodePtr parentNode ) embedded = std::string((const char*)embeddedxml); xmlFree (embeddedxml); std::transform (embedded.begin(), embedded.end(), - embedded.begin(), tolower); + embedded.begin(), tocharlower); } bool isEmbedded = !embedded.empty() && embedded.compare("true") == 0; @@ -437,7 +437,7 @@ bool HelpCompiler::compile( void ) throw( HelpProcessingException ) if (modulename[0] == 'S') { modulename = modulename.substr(1); - std::transform(modulename.begin(), modulename.end(), modulename.begin(), tolower); + std::transform(modulename.begin(), modulename.end(), modulename.begin(), tocharlower); } if (modulename != "DEFAULT" && modulename != module) continue; diff --git a/l10ntools/source/help/HelpCompiler.hxx b/l10ntools/source/help/HelpCompiler.hxx index 016f7eefb8bc..6642d571c67b 100644 --- a/l10ntools/source/help/HelpCompiler.hxx +++ b/l10ntools/source/help/HelpCompiler.hxx @@ -108,7 +108,7 @@ namespace fs { ::rtl::OUString ustrSystemPath; osl::File::getSystemPathFromFileURL(data, ustrSystemPath); - return ustrSystemPath.getStr(); + return (wchar_t const *) ustrSystemPath.getStr(); } #endif std::string native_directory_string() const { return native_file_string(); } @@ -322,6 +322,11 @@ private: bool bExtensionMode; }; +inline char tocharlower(char c) +{ + return static_cast<char>(tolower(c)); +} + #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/l10ntools/source/help/HelpLinker.cxx b/l10ntools/source/help/HelpLinker.cxx index 81a96ce37899..b1d7c1c2e849 100644 --- a/l10ntools/source/help/HelpLinker.cxx +++ b/l10ntools/source/help/HelpLinker.cxx @@ -351,7 +351,7 @@ void HelpLinker::addBookmark( DB* dbBase, FILE* pFile_DBHelp, std::string thishi size_t i = 0; dataB[i++] = static_cast<unsigned char>(fileLen); for (size_t j = 0; j < fileB.length(); ++j) - dataB[i++] = fileB[j]; + dataB[i++] = static_cast<unsigned char>(fileB[j]); if (!anchorB.empty()) { dataB[i++] = '#'; @@ -386,7 +386,7 @@ void HelpLinker::initIndexerPreProcessor() if( m_pIndexerPreProcessor ) delete m_pIndexerPreProcessor; std::string mod = module; - std::transform (mod.begin(), mod.end(), mod.begin(), tolower); + std::transform (mod.begin(), mod.end(), mod.begin(), tocharlower); m_pIndexerPreProcessor = new IndexerPreProcessor( mod, indexDirParentName, idxCaptionStylesheet, idxContentStylesheet ); } @@ -413,7 +413,7 @@ void HelpLinker::link() throw( HelpProcessingException ) #endif std::string mod = module; - std::transform (mod.begin(), mod.end(), mod.begin(), tolower); + std::transform (mod.begin(), mod.end(), mod.begin(), tocharlower); // do the work here // continue with introduction of the overall process thing into the @@ -666,7 +666,7 @@ void HelpLinker::link() throw( HelpProcessingException ) if (document) { std::string temp = module; - std::transform (temp.begin(), temp.end(), temp.begin(), tolower); + std::transform (temp.begin(), temp.end(), temp.begin(), tocharlower); m_pIndexerPreProcessor->processDocument(document, URLEncoder::encode(documentPath) ); } } diff --git a/l10ntools/source/helpmerge.cxx b/l10ntools/source/helpmerge.cxx index 9203fd94b5e7..ccb45e47105f 100644 --- a/l10ntools/source/helpmerge.cxx +++ b/l10ntools/source/helpmerge.cxx @@ -88,26 +88,29 @@ void HelpParser::FillInFallbacks( LangHashMap& rElem_out, ByteString sLangIdx_in } } -/*****************************************************************************/ -void HelpParser::Dump(XMLHashMap* rElem_in) { -/*****************************************************************************/ - for(XMLHashMap::iterator pos = rElem_in->begin();pos != rElem_in->end(); ++pos){ +#if OSL_DEBUG_LEVEL > 2 +void HelpParser::Dump(XMLHashMap* rElem_in) +{ + for(XMLHashMap::iterator pos = rElem_in->begin();pos != rElem_in->end(); ++pos) + { Dump(pos->second,pos->first); } } -/*****************************************************************************/ -void HelpParser::Dump(LangHashMap* rElem_in,const ByteString sKey_in) { -/*****************************************************************************/ + +void HelpParser::Dump(LangHashMap* rElem_in,const ByteString sKey_in) +{ ByteString x; OString y; fprintf(stdout,"+------------%s-----------+\n",sKey_in.GetBuffer() ); - for(LangHashMap::iterator posn=rElem_in->begin();posn!=rElem_in->end();++posn){ + for(LangHashMap::iterator posn=rElem_in->begin();posn!=rElem_in->end();++posn) + { x=posn->first; y=posn->second->ToOString(); fprintf(stdout,"key=%s value=%s\n",x.GetBuffer(),y.getStr()); } fprintf(stdout,"+--------------------------+\n"); } +#endif HelpParser::HelpParser( const ByteString &rHelpFile, bool rUTF8 , bool rHasInputList ) : sHelpFile( rHelpFile ), @@ -436,9 +439,11 @@ bool HelpParser::MergeSingleFile( XMLFile* file , MergeDataFile& aMergeDataFile { aLangHM = pos->second; - //printf("*********************DUMPING HASHMAP***************************************"); - //Dump( aXMLStrHM ); - //printf("DBG: sHelpFile = %s\n",sHelpFile.GetBuffer() ); +#if OSL_DEBUG_LEVEL > 2 + printf("*********************DUMPING HASHMAP***************************************"); + Dump(aXMLStrHM); + printf("DBG: sHelpFile = %s\n",sHelpFile.GetBuffer() ); +#endif pResData.sGId = pos->first; pResData.sFilename = sHelpFile; @@ -454,7 +459,7 @@ bool HelpParser::MergeSingleFile( XMLFile* file , MergeDataFile& aMergeDataFile static const ByteString INPATH = Export::GetEnv( "INPATH" ); Export::getRandomName( sPath , sTempFile , INPATH ); - Export::getRandomName( sPath , sTempFileCopy , INPATH ); + Export::getRandomName( sPath , sTempFileCopy , INPATH ); // Write in the temp file bool hasNoError = file->Write ( sTempFile ); if( !hasNoError ) @@ -628,77 +633,5 @@ void HelpParser::ProcessHelp( LangHashMap* aLangHM , const ByteString& sCur , Re } } -/* Process() Method merges */ -void HelpParser::Process( LangHashMap* aLangHM , const ByteString& sCur , ResData *pResData , MergeDataFile& aMergeDataFile ){ - - XMLElement* pXMLElement = NULL; - PFormEntrys *pEntrys = NULL; - XMLData *data = NULL; - XMLParentNode *parent = NULL; - XMLDefault *xmldefault = NULL; - - short curLang = 0; - String sNewdata; - bool isFallback = false; - ByteString sLId; - ByteString sGId; - - pEntrys = NULL; - -#ifdef MERGE_SOURCE_LANGUAGES - if( true ){ // Merge en-US! -#else - if( !sCur.EqualsIgnoreCaseAscii("en-US") ){ -#endif - pXMLElement = (*aLangHM)[ sCur ]; - if( pXMLElement == NULL ) - { - FillInFallbacks( *aLangHM , sCur ); - pXMLElement = ( *aLangHM )[ sCur ]; - isFallback = true; - } - if( pXMLElement != NULL ) - { - parent = pXMLElement->GetParent(); - sLId = pXMLElement->GetOldref(); - pResData->sId = sLId; - - pEntrys = aMergeDataFile.GetPFormEntrys( pResData ); - if( pEntrys != NULL) - { - ByteString sNewText; - pEntrys->GetText( sNewText, STRING_TYP_TEXT, sCur , true ); - sNewdata = String( sNewText , RTL_TEXTENCODING_UTF8 ); - if ( sNewdata.Len()) - { - printf("Entries found\n"); - if( pXMLElement != NULL ) - { - data = new XMLData( sNewdata , NULL , true ); // Add new one - if( pXMLElement->ToOUString().compareTo( OUString(data->GetData()) ) != 0 ) - { - pXMLElement->RemoveAndDeleteAllChilds(); - pXMLElement->AddChild( data ); - } - if( isFallback ) - { - xmldefault = new XMLDefault( String::CreateFromAscii("\n") , NULL ); - int pos = parent->GetPosition( pXMLElement->GetId() ); - if( pos != -1 ){ - parent->AddChild(xmldefault , pos+1 ); - parent->AddChild(pXMLElement , pos+2 ); - } - else fprintf(stdout,"ERROR: Can't find reference Element of id %s language %d\n",pXMLElement->GetId().GetBuffer(),curLang); - } - - aLangHM->erase( sCur ); - } - } - delete pResData; - }else if( pResData == NULL ){fprintf(stdout,"Can't find GID=%s LID=%s TYP=%s\n",pResData->sGId.GetBuffer(),pResData->sId.GetBuffer(),pResData->sResTyp.GetBuffer());} - } - - } -} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/l10ntools/source/lngmerge.cxx b/l10ntools/source/lngmerge.cxx index e89640015773..7af3293775f7 100644 --- a/l10ntools/source/lngmerge.cxx +++ b/l10ntools/source/lngmerge.cxx @@ -316,10 +316,13 @@ sal_Bool LngParser::Merge( nPos++; } ByteString sCur; - if ( nLastLangPos ) { - for( unsigned int n = 0; n < aLanguages.size(); n++ ){ + if ( nLastLangPos ) + { + for(size_t n = 0; n < aLanguages.size(); ++n) + { sCur = aLanguages[ n ]; - if( !sCur.EqualsIgnoreCaseAscii("en-US") && !Text[ sCur ].Len() && pEntrys ) { + if( !sCur.EqualsIgnoreCaseAscii("en-US") && Text[sCur].isEmpty() && pEntrys ) + { ByteString sNewText; pEntrys->GetText( sNewText, STRING_TYP_TEXT, sCur, sal_True ); diff --git a/l10ntools/source/localize.cxx b/l10ntools/source/localize.cxx index a0c3775b9ee7..9cacee6bebd6 100644 --- a/l10ntools/source/localize.cxx +++ b/l10ntools/source/localize.cxx @@ -204,13 +204,6 @@ private: const ByteString &rCollectMode ); void WorkOnDirectory( const ByteString &rDirectory ); - sal_Bool ExecuteMerge(); - sal_Bool MergeSingleFile( - const ByteString &rPrj, - const ByteString &rFile, - const ByteString &rSDFFile - ); - public: SourceTreeLocalizer( const ByteString &rRoot, const ByteString &rVersion , bool bLocal , bool skip_links ); ~SourceTreeLocalizer(); @@ -221,7 +214,6 @@ public: { sLanguageRestriction = rRestrictions; } int getFileCnt(); sal_Bool Extract( const ByteString &rDestinationFile ); - sal_Bool Merge( const ByteString &rSourceFile , const ByteString &rOutput ); int GetFileCnt(); virtual void OnExecuteDirectory( const rtl::OUString &rDirectory ); }; @@ -563,257 +555,6 @@ sal_Bool SourceTreeLocalizer::Extract( const ByteString &rDestinationFile ) return bReturn; } -/*****************************************************************************/ -sal_Bool SourceTreeLocalizer::MergeSingleFile( - const ByteString &rPrj, - const ByteString &rFile, - const ByteString &rSDFFile -) -/*****************************************************************************/ -{ - //printf("MergeSingleFile(%s,%s,%s)",rPrj.GetBuffer(),rFile.GetBuffer(),rSDFFile.GetBuffer()); - if ( !rFile.Len()) - return sal_True; - - ByteString sRoot( Export::GetEnv( "SRC_ROOT" )); - DirEntry aEntry( String( sRoot, RTL_TEXTENCODING_ASCII_US )); - aEntry += DirEntry( String( rPrj, RTL_TEXTENCODING_ASCII_US )); - - ByteString sDelimiter( - DirEntry::GetAccessDelimiter(), RTL_TEXTENCODING_ASCII_US ); - - ByteString sCur( rFile ); - sCur.SearchAndReplaceAll( "\\", sDelimiter ); - sCur.SearchAndReplaceAll( "/", sDelimiter ); - - aEntry += DirEntry( String( sCur, RTL_TEXTENCODING_ASCII_US )); - ByteString sFile( aEntry.GetFull(), RTL_TEXTENCODING_ASCII_US ); - - ByteString sBCur( aEntry.GetFull(), RTL_TEXTENCODING_ASCII_US ); - - sal_uLong nIndex = 0; - ByteString sExtension( aEntry.GetExtension(), RTL_TEXTENCODING_ASCII_US ); - ByteString sCandidate( ExeTable[ nIndex ][ 0 ] ); - - while( !sCandidate.Equals ("NULL") && !sCandidate.Equals(sExtension) ) - sCandidate = ExeTable[ ++nIndex ][ 0 ]; - - if ( !sCandidate.Equals( "NULL" ) ) { - if( !aEntry.Exists()) { - DirEntryKind theDir=FSYS_KIND_FILE; - Dir myDir( aEntry.GetPath(), theDir); - DirEntry current; - sal_Bool found=sal_False; - for( sal_uInt16 x=0; x < myDir.Count() && !found;){ - current=myDir[x++]; - StringCompare result=current.GetName().CompareIgnoreCaseToAscii( aEntry.GetName() ); - if( result==COMPARE_EQUAL ){ - fprintf(stderr,"WARNING: %s not found\n", ByteString(aEntry.GetFull(),RTL_TEXTENCODING_ASCII_US).GetBuffer() ); - fprintf(stderr,"but use %s instead \n" , ByteString(current.GetFull(), RTL_TEXTENCODING_ASCII_US).GetBuffer() ); - aEntry=current; - found=sal_True; - } - } - if(!found) return sal_True; - - } - - DirEntry aOut( Export::GetTempFile() ); - ByteString sOutput; - if( sOutputFile.Len() == 0 ) - sOutput = ByteString ( aOut.GetFull(), RTL_TEXTENCODING_ASCII_US ); - else - sOutput = sOutputFile; - ByteString sCommand( ExeTable[ nIndex ][ 1 ] ); - sCommand += " -i "; - sCommand += ByteString( aEntry.GetName(), RTL_TEXTENCODING_ASCII_US ); - sCommand += " -m "; - sCommand += rSDFFile; - sCommand += " -o "; - sCommand += sOutput; - sCommand += " "; - sCommand += ByteString( ExeTable[ nIndex ][ 2 ] ); - if ( sLanguageRestriction.Len()) { - sCommand += " -l "; - sCommand += sLanguageRestriction; - } - - DirEntry aPath( aEntry.GetPath()); - DirEntry aOldCWD; - aPath.SetCWD(); - - if (system(sCommand.GetBuffer()) == -1) - fprintf(stderr, "%s failed\n", sCommand.GetBuffer()); - nFileCnt++; - printf("."); - SvFileStream aInStream( aOut.GetFull(), STREAM_READ ); - if ( !aInStream.IsOpen()) { - fprintf( stderr, - "ERROR: Unable to open file %s for reading!\n", - sOutput.GetBuffer()); - } - else { - FileStat::SetReadOnlyFlag( aEntry, sal_False ); - String myStr2(aEntry.GetFull()); - String aTemp22 = String::CreateFromAscii("_tmp"); - myStr2.Append(aTemp22); - - ByteString test(myStr2,RTL_TEXTENCODING_ASCII_US); - SvFileStream aOutStream( myStr2, STREAM_STD_WRITE | STREAM_TRUNC ); - if ( !aOutStream.IsOpen()) { - ByteString test2(myStr2,RTL_TEXTENCODING_ASCII_US); - fprintf( stderr,"ERROR: Unable to open file %s for modification!\n", test2.GetBuffer()); - aInStream.Close(); - } - - else { - ByteString sLine; - aOutStream.SetLineDelimiter( LINEEND_LF ); - - aInStream.ReadLine( sLine ); - while ( !aInStream.IsEof()) { - aOutStream.WriteLine( sLine ); - aInStream.ReadLine( sLine ); - } - aInStream.Close(); - aOutStream.Close(); - - - DirEntry myTempFile(ByteString(myStr2,RTL_TEXTENCODING_ASCII_US)); // xxx_tmp -> - DirEntry myFile(ByteString(aEntry.GetFull(),RTL_TEXTENCODING_ASCII_US));// xxx - - DirEntry oldFile(ByteString(aEntry.GetFull(),RTL_TEXTENCODING_ASCII_US)); - - if(oldFile.Kill()==ERRCODE_NONE){ - if(myTempFile.MoveTo(myFile)!=ERRCODE_NONE){ - fprintf( stderr, "ERROR: Can't rename file %s\n",ByteString(myStr2,RTL_TEXTENCODING_ASCII_US).GetBuffer()); - } - } - else{ - fprintf( stderr, "ERROR: Can't remove file %s\n",ByteString(aEntry.GetFull(),RTL_TEXTENCODING_ASCII_US).GetBuffer()); - } - } // else - - aOldCWD.SetCWD(); - aOut.Kill(); - } // else - } - return sal_True; -} -/*****************************************************************************/ -sal_Bool SourceTreeLocalizer::ExecuteMerge( ) -/*****************************************************************************/ -{ - DirEntry aEntry( Export::GetTempFile()); - sal_Bool bReturn = sal_True; - bool bMerged = false; - - ByteString sFileName; - ByteString sCurFile; - ByteString sLine; - ByteString sFileKey; - - SvFileStream aFile; - - ByteString sOutputFileName = sOutputFile; - ByteString sInpath("."); - sInpath += Export::GetEnv("INPATH"); - ByteString sBlank(""); - - sOutputFileName.SearchAndReplaceAll( sInpath , sBlank ); - - String sDel = DirEntry::GetAccessDelimiter(); - ByteString sBDel( sDel.GetBuffer() , sDel.Len() , RTL_TEXTENCODING_UTF8 ); - if( bLocal ){ - xub_StrLen nPos = sOutputFileName.SearchBackward( sBDel.GetChar(0) ); - sOutputFileName = sOutputFileName.Copy( nPos+1 , sOutputFileName.Len()-nPos-1 ); - } - ByteStringBoolHashMap aFileHM; - // Read all possible files - while ( !aSDF.IsEof()) { - aSDF.ReadLine( sLine ); - sFileName = sLine.GetToken( 0, '\t' ); - sFileName += "#"; - sFileName += sLine.GetToken( 1, '\t' ); - aFileHM[sFileName]=true; - } - - for( ByteStringBoolHashMap::iterator iter = aFileHM.begin(); iter != aFileHM.end(); ++iter ){ - sFileKey = iter->first; - aSDF.Seek( 0 ); - aFile.Open( aEntry.GetFull(), STREAM_STD_WRITE |STREAM_TRUNC ); - - while ( !aSDF.IsEof()) { - aSDF.ReadLine( sLine ); - sFileName = sLine.GetToken( 0, '\t' ); - sFileName += "#"; - sFileName += sLine.GetToken( 1, '\t' ); - if( sFileName.Len() && ( sFileName.CompareTo(sFileKey) == COMPARE_EQUAL ) ){ - if ( aFile.IsOpen() && sLine.Len()) - aFile.WriteLine( sLine ); - } - } - if ( aFile.IsOpen()) - aFile.Close(); - - ByteString sPrj( sFileKey.GetToken( 0, '#' )); - ByteString sFile( sFileKey.GetToken( 1, '#' )); - ByteString sSDFFile( aFile.GetFileName(), RTL_TEXTENCODING_ASCII_US ); - - //printf("localize test sPrj = %s , sFile = %s , sSDFFile = %s sOutputFileName = %s\n",sPrj.GetBuffer(), sFile.GetBuffer() , sSDFFile.GetBuffer() , sOutputFileName.GetBuffer() ); - - // Test - bLocal = true; - // Test - - if( bLocal ){ - sal_uInt16 nPos = sFile.SearchBackward( '\\' ); - ByteString sTmp = sFile.Copy( nPos+1 , sFile.Len()-nPos-1 ); - //printf("'%s'='%s'\n",sTmp.GetBuffer(), sOutputFileName.GetBuffer()); - if( sTmp.CompareTo(sOutputFileName) == COMPARE_EQUAL ){ - bMerged = true; - if ( !MergeSingleFile( sPrj, sFile, sSDFFile )) - bReturn = sal_False; - }else{ - bMerged = true; - //printf("MergeSingleFile('%s','%s','%s')\n",sPrj.GetBuffer(),sFile.GetBuffer(),sSDFFile.GetBuffer()); - if ( !MergeSingleFile( sPrj, sFile, sSDFFile )) - bReturn = sal_False; - } - } - } - aEntry.Kill(); - // If Outputfile not included in the SDF file copy it without merge - - if( bLocal && !bMerged ){ - DirEntry aSourceFile( sOutputFileName.GetBuffer() ); - FSysError aErr = aSourceFile.CopyTo( DirEntry ( sOutputFile.GetBuffer() ) , FSYS_ACTION_COPYFILE ); - if( aErr != FSYS_ERR_OK ){ - printf("ERROR: Can't copy file '%s' to '%s' %d\n",sOutputFileName.GetBuffer(),sOutputFile.GetBuffer(),sal::static_int_cast<int>(aErr)); - } - } - return bReturn; - -} - -/*****************************************************************************/ -sal_Bool SourceTreeLocalizer::Merge( const ByteString &rSourceFile , const ByteString &rOutput ) -/*****************************************************************************/ -{ - sOutputFile = rOutput; - nMode = LOCALIZE_MERGE; - aSDF.Open( String( rSourceFile, RTL_TEXTENCODING_ASCII_US ), - STREAM_STD_READ ); - - sal_Bool bReturn = aSDF.IsOpen(); - if ( bReturn ) { - bReturn = ExecuteMerge(); - } - aSDF.Close(); - nMode = LOCALIZE_NONE; - return bReturn; -} - } using namespace transex3; diff --git a/l10ntools/source/merge.cxx b/l10ntools/source/merge.cxx index 35a61211bdbb..12ce24323cb9 100644 --- a/l10ntools/source/merge.cxx +++ b/l10ntools/source/merge.cxx @@ -155,14 +155,6 @@ PFormEntrys* MergeData::GetPFObject( const ByteString& rPFO ){ return NULL; } - -PFormEntrys *MergeData::InsertEntry( const ByteString &rPForm ) -{ - PFormEntrys* pFEntrys = new PFormEntrys( rPForm ); - aMap.insert( PFormEntrysHashMap::value_type( rPForm , pFEntrys ) ); - return pFEntrys; -} - sal_Bool MergeData::operator==( ResData *pData ) { ByteString sResTyp_upper( pData->sResTyp ); @@ -269,18 +261,6 @@ ByteString MergeDataFile::Dump(){ return sRet; } -void MergeDataFile::WriteError( const ByteString &rLine ) -{ - if ( bErrorLog ) - { - if ( !aErrLog.IsOpen()) - aErrLog.Open( String( sErrorLog, RTL_TEXTENCODING_ASCII_US ), STREAM_STD_WRITE | STREAM_TRUNC ); - aErrLog.WriteLine( rLine ); - } - else - fprintf( stderr, "%s\n", rLine.GetBuffer()); -} - std::vector<ByteString> MergeDataFile::GetLanguages(){ return std::vector<ByteString>(aLanguageSet.begin(),aLanguageSet.end()); } diff --git a/l10ntools/source/tagtest.cxx b/l10ntools/source/tagtest.cxx index c3706aa4cd30..1389cfec4749 100644 --- a/l10ntools/source/tagtest.cxx +++ b/l10ntools/source/tagtest.cxx @@ -29,6 +29,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_l10ntools.hxx" #include <tools/string.hxx> +#include <rtl/strbuf.hxx> #include "tagtest.hxx" #if OSL_DEBUG_LEVEL > 1 @@ -1342,20 +1343,21 @@ void TokenParser::ParseError( sal_uInt16 nErrNr, ByteString aErrMsg, const Token ParserMessage::ParserMessage( sal_uInt16 PnErrorNr, ByteString PaErrorText, const TokenInfo &rTag ) : nErrorNr( PnErrorNr ) - , aErrorText( PaErrorText ) , nTagBegin( 0 ) , nTagLength( 0 ) { String aLexem( SimpleParser::GetLexem( rTag ) ); - aErrorText.Append(": "); - aErrorText += ByteString( aLexem, RTL_TEXTENCODING_UTF8 ); + rtl::OStringBuffer aErrorBuffer(PaErrorText); + aErrorBuffer.append(RTL_CONSTASCII_STRINGPARAM(": ")); + aErrorBuffer.append(rtl::OUStringToOString(aLexem, RTL_TEXTENCODING_UTF8)); if ( rTag.nId == TAG_NOMORETAGS ) - aErrorText.Append(" at end of line "); + aErrorBuffer.append(RTL_CONSTASCII_STRINGPARAM(" at end of line ")); else if ( rTag.nPos != TOK_INVALIDPOS ) { - aErrorText.Append(" at Position "); - aErrorText.Append( ByteString::CreateFromInt32( rTag.nPos ) ); + aErrorBuffer.append(RTL_CONSTASCII_STRINGPARAM(" at Position ")); + aErrorBuffer.append(static_cast<sal_Int32>(rTag.nPos)); } + aErrorText = aErrorBuffer.makeStringAndClear(); nTagBegin = rTag.nPos; nTagLength = aLexem.Len(); } diff --git a/l10ntools/source/xrmlex.l b/l10ntools/source/xrmlex.l index 6229525d7e84..034812cf61f5 100644 --- a/l10ntools/source/xrmlex.l +++ b/l10ntools/source/xrmlex.l @@ -144,7 +144,7 @@ int yywrap(void) } /*****************************************************************************/ -void YYWarning( char *s ) +void YYWarning( const char *s ) /*****************************************************************************/ { /* write warning to stderr */ @@ -154,9 +154,9 @@ void YYWarning( char *s ) /*****************************************************************************/ #ifdef GCC -void yyerror ( char *s, ... ) +void yyerror ( const char *s, ... ) #else -void yyerror ( char *s ) +void yyerror ( const char *s ) #endif /*****************************************************************************/ { diff --git a/l10ntools/source/xrmmerge.cxx b/l10ntools/source/xrmmerge.cxx index 875fd457cf93..064d908ae04f 100644 --- a/l10ntools/source/xrmmerge.cxx +++ b/l10ntools/source/xrmmerge.cxx @@ -526,14 +526,16 @@ void XRMResExport::WorkOnText( { ByteString sLang( GetAttribute( rOpenTag, "xml:lang" )); - if ( !pResData ) { - ByteString sPlatform( "" ); - pResData = new ResData( sPlatform, GetGID() ); - pResData->sId = GetLID(); - } + if ( !pResData ) + { + ByteString sPlatform( "" ); + pResData = new ResData( sPlatform, GetGID() ); + pResData->sId = GetLID(); + } - pResData->sText[ sLang ] = rText; - ConvertStringToDBFormat( pResData->sText[ sLang ] ); + ByteString sText(rText); + ConvertStringToDBFormat(sText); + pResData->sText[sLang] = sText; } /*****************************************************************************/ @@ -648,7 +650,6 @@ void XRMResMerge::WorkOnText( { rText = sContent; ConvertStringToXMLFormat( rText ); - //Export::QuotHTMLXRM( rText ); } } } diff --git a/padmin/Executable_spadmin.bin.mk b/padmin/Executable_spadmin.bin.mk index eef72e115054..6b44b64fa22f 100644 --- a/padmin/Executable_spadmin.bin.mk +++ b/padmin/Executable_spadmin.bin.mk @@ -30,13 +30,17 @@ $(eval $(call gb_Executable_Executable,spadmin.bin)) $(eval $(call gb_Executable_set_include,spadmin.bin,\ $$(INCLUDE) \ -I$(OUTDIR)/inc \ - -I$(OUTDIR)/inc/offuh \ )) $(eval $(call gb_Executable_add_linked_static_libs,spadmin.bin,\ vclmain \ )) +$(eval $(call gb_Executable_add_api,spadmin.bin,\ + udkapi \ + offapi \ +)) + $(eval $(call gb_Executable_add_linked_libs,spadmin.bin,\ spa \ svt \ diff --git a/padmin/Library_spa.mk b/padmin/Library_spa.mk index 8d19fe41248f..87b08acd45be 100644 --- a/padmin/Library_spa.mk +++ b/padmin/Library_spa.mk @@ -27,15 +27,15 @@ $(eval $(call gb_Library_Library,spa)) -$(eval $(call gb_Library_set_include,spa,\ - $$(INCLUDE) \ - -I$(OUTDIR)/inc/offuh \ -)) - $(eval $(call gb_Library_add_defs,spa,\ -DSPA_DLLIMPLEMENTATION \ )) +$(eval $(call gb_Library_add_api,spa,\ + udkapi \ + offapi \ +)) + $(eval $(call gb_Library_add_linked_libs,spa,\ svt \ vcl \ diff --git a/padmin/source/cmddlg.cxx b/padmin/source/cmddlg.cxx index be87417891f4..4303757628ba 100644 --- a/padmin/source/cmddlg.cxx +++ b/padmin/source/cmddlg.cxx @@ -129,11 +129,11 @@ void CommandStore::getStoredCommands( const char* pGroup, ::std::list< String >& { Config& rConfig( getPadminRC() ); rConfig.SetGroup( pGroup ); - int nKeys = rConfig.GetKeyCount(); + sal_Int32 nKeys = rConfig.GetKeyCount(); ::std::list< String >::const_iterator it; while( nKeys-- ) { - String aCommand( rConfig.ReadKey( ByteString::CreateFromInt32( nKeys ), RTL_TEXTENCODING_UTF8 ) ); + String aCommand( rConfig.ReadKey(rtl::OString::valueOf(nKeys), RTL_TEXTENCODING_UTF8 ) ); if( aCommand.Len() ) { for( it = rCommands.begin(); it != rCommands.end() && *it != aCommand; ++it ) @@ -156,7 +156,7 @@ void CommandStore::setCommands( ::std::list< String >::const_iterator it, loop; ::std::list< String > aWriteList; - int nWritten = 0; + sal_Int32 nWritten = 0; for( it = rCommands.begin(); it != rCommands.end(); ++it ) { if( it->Len() ) @@ -176,7 +176,7 @@ void CommandStore::setCommands( nWritten--; } for( nWritten = 0, it = aWriteList.begin(); it != aWriteList.end(); ++it, ++nWritten ) - rConfig.WriteKey( ByteString::CreateFromInt32( nWritten ), ByteString( *it, RTL_TEXTENCODING_UTF8 ) ); + rConfig.WriteKey( rtl::OString::valueOf(nWritten), ByteString( *it, RTL_TEXTENCODING_UTF8 ) ); } diff --git a/padmin/source/newppdlg.cxx b/padmin/source/newppdlg.cxx index 6382ae1359dd..0da40ce90f02 100644 --- a/padmin/source/newppdlg.cxx +++ b/padmin/source/newppdlg.cxx @@ -77,9 +77,9 @@ PPDImportDialog::PPDImportDialog( Window* pParent ) : Config& rConfig = getPadminRC(); rConfig.SetGroup( PPDIMPORT_GROUP ); m_aPathBox.SetText( String( rConfig.ReadKey( "LastDir" ), RTL_TEXTENCODING_UTF8 ) ); - for( int i = 0; i < 11; i++ ) + for (sal_Int32 i = 0; i < 11; ++i) { - ByteString aEntry( rConfig.ReadKey( ByteString::CreateFromInt32( i ) ) ); + ByteString aEntry(rConfig.ReadKey(rtl::OString::valueOf(i))); if( aEntry.Len() ) m_aPathBox.InsertEntry( String( aEntry, RTL_TEXTENCODING_UTF8 ) ); } @@ -117,10 +117,10 @@ void PPDImportDialog::Import() break; if( nEntries < 0 ) { - int nNextEntry = rConfig.ReadKey( "NextEntry" ).ToInt32(); - rConfig.WriteKey( ByteString::CreateFromInt32( nNextEntry ), ByteString( aImportPath, RTL_TEXTENCODING_UTF8 ) ); + sal_Int32 nNextEntry = rConfig.ReadKey( "NextEntry" ).ToInt32(); + rConfig.WriteKey( rtl::OString::valueOf(nNextEntry), ByteString( aImportPath, RTL_TEXTENCODING_UTF8 ) ); nNextEntry = nNextEntry < 10 ? nNextEntry+1 : 0; - rConfig.WriteKey( "NextEntry", ByteString::CreateFromInt32( nNextEntry ) ); + rConfig.WriteKey( "NextEntry", rtl::OString::valueOf(nNextEntry) ); m_aPathBox.InsertEntry( aImportPath ); } while( m_aDriverLB.GetEntryCount() ) diff --git a/regexp/prj/d.lst b/regexp/prj/d.lst index e69de29bb2d1..3f38fbeea4f7 100644 --- a/regexp/prj/d.lst +++ b/regexp/prj/d.lst @@ -0,0 +1 @@ +..\%__SRC%\lib\libi18nregexp*.dll.a %_DEST%\lib\libi18nregexp*.dll.a diff --git a/regexp/source/reclass.cxx b/regexp/source/reclass.cxx index a5015a8aeca2..c57632a5863b 100644 --- a/regexp/source/reclass.cxx +++ b/regexp/source/reclass.cxx @@ -1357,13 +1357,6 @@ Regexpr::regex_compile() case (sal_Unicode)')': goto normal_backslash; - // unreachable (after goto): -#if 0 - if (COMPILE_STACK_EMPTY) { - FREE_STACK_RETURN(REG_ERPAREN); - } -#endif - handle_close: if (fixup_alt_jump) { /* Push a dummy failure point at the end of the diff --git a/rsc/inc/rscclass.hxx b/rsc/inc/rscclass.hxx index 7dc3e95488ad..36bc5be7c4ca 100644 --- a/rsc/inc/rscclass.hxx +++ b/rsc/inc/rscclass.hxx @@ -118,15 +118,6 @@ public: RscTypCont * pTC, sal_uInt32, sal_Bool bExtra ); }; -class RscFirstSysDepend : public RscSysDepend -{ -public: - RscFirstSysDepend( Atom nId, sal_uInt32 nTypId, - RscTop * pSuper ); - ERRTYPE WriteRc( const RSCINST &, RscWriteRc & aMem, - RscTypCont * pTC, sal_uInt32, sal_Bool bExtra ); -}; - class RscTupel : public RscClass { public: diff --git a/rsc/inc/rscdb.hxx b/rsc/inc/rscdb.hxx index 54c386dab315..012c340bc42e 100644 --- a/rsc/inc/rscdb.hxx +++ b/rsc/inc/rscdb.hxx @@ -336,9 +336,6 @@ public: aBaseLst.push_back( pType ); } RscTop * SearchType( Atom nTypId ); - RscTop * Search( Atom typ ); - CLASS_DATA Search( Atom typ, const RscId & rId ); - void Delete( Atom typ, const RscId & rId ); // loescht alle Resourceobjekte diese Datei void Delete( sal_uLong lFileKey ); RscTop * GetRoot() { return( pRoot ); }; @@ -353,8 +350,6 @@ public: const ByteString & rHxxName ); void WriteSyntax( FILE * fOutput ); void WriteRcCtor( FILE * fOutput ); - void FillNameIdList( REResourceList * pList, sal_uLong lFileKey ); - sal_Bool MakeConsistent(); sal_uInt32 PutTranslatorKey( sal_uInt64 nKey ); void IncFilePos( sal_uLong nOffset ){ nFilePos += nOffset; } }; diff --git a/rsc/inc/rscdef.hxx b/rsc/inc/rscdef.hxx index 4ff5e2201dd6..6d335d5544b0 100644 --- a/rsc/inc/rscdef.hxx +++ b/rsc/inc/rscdef.hxx @@ -30,6 +30,7 @@ #include <tools/unqidx.hxx> #include <rsctree.hxx> +#include <rtl/strbuf.hxx> #include <vector> /****************** C L A S S E S ****************************************/ @@ -70,7 +71,7 @@ public: ((sal_Int32)aExp.aLong.nHi << 16); } sal_Bool Evaluate( sal_Int32 * pValue ) const; - void GetMacro( ByteString & ) const; + void AppendMacro( rtl::OStringBuffer & ) const; }; /*********** R s c I d ***************************************************/ @@ -102,11 +103,9 @@ public: RscId& operator = ( const RscId& rRscId ); - static sal_Bool IsSetNames(); static void SetNames( sal_Bool bSet = sal_True ); operator sal_Int32() const; // Gibt Nummer zurueck ByteString GetName() const; // Gibt den Namen des Defines zurueck - ByteString GetMacro() const; // Gibt das Macro zurueck sal_Bool operator < ( const RscId& rRscId ) const; sal_Bool operator > ( const RscId& rRscId ) const; sal_Bool operator == ( const RscId& rRscId ) const; @@ -141,8 +140,6 @@ protected: void DecRef(); void DefineToNumber(); void SetName( const ByteString & rNewName ){ aName = rNewName; } - void ChangeMacro( RscExpression * pExpression ); - void ChangeMacro( sal_Int32 lIdentifier ); using StringNode::Search; public: @@ -165,9 +162,6 @@ private: sal_Int32 lDefId, size_t lPos ); RscDefine * New( sal_uLong lFileKey, const ByteString & rDefName, RscExpression * pExpression, size_t lPos ); - sal_Bool Befor( const RscDefine * pFree, const RscDefine * pDepend ); - sal_Bool Remove( RscDefine * pDef ); - sal_Bool Remove( size_t nIndex ); sal_Bool Remove(); size_t GetPos( RscDefine* item ) { for ( size_t i = 0, n = maList.size(); i < n; ++i ) @@ -220,7 +214,6 @@ public: RscFile(); ~RscFile(); sal_Bool InsertDependFile( sal_uLong lDepFile, size_t lPos ); - void RemoveDependFile( sal_uLong lDepFile ); sal_Bool Depend( sal_uLong lDepend, sal_uLong lFree ); void SetIncFlag(){ bIncFile = sal_True; }; sal_Bool IsIncFile(){ return bIncFile; }; @@ -236,7 +229,6 @@ public: RscDefTree(){ pDefRoot = NULL; } ~RscDefTree(); void Remove(); - sal_Bool Evaluate(); RscDefine * Search( const char * pName ); void Insert( RscDefine * pDef ); void Remove( RscDefine * pDef ); @@ -251,7 +243,6 @@ public: RscDefine * FindDef( const char * ); RscDefine * FindDef( const ByteString& rStr ) { return FindDef( rStr.GetBuffer() ); } - RscDefine * FindDef( sal_uLong lKey, const ByteString & ); sal_Bool Depend( sal_uLong lDepend, sal_uLong lFree ); sal_Bool TestDef( sal_uLong lFileKey, size_t lPos, @@ -264,17 +255,8 @@ public: RscDefine * NewDef( sal_uLong lKey, const ByteString & rDefName, RscExpression *, sal_uLong lPos ); - sal_Bool ChangeDef( const ByteString & rDefName, sal_Int32 lId ); - sal_Bool ChangeDef( const ByteString & rDefName, RscExpression * ); - - sal_Bool IsDefUsed( const ByteString & ); - void DeleteDef( const ByteString & ); - sal_Bool ChangeDefName( const ByteString & rDefName, - const ByteString & rNewName ); - // Alle Defines die in dieser Datei Definiert sind loeschen void DeleteFileContext( sal_uLong lKey ); - void DeleteFile( sal_uLong lKey ); sal_uLong NewCodeFile( const ByteString & rName ); sal_uLong NewIncFile( const ByteString & rName, const ByteString & rPath ); RscFile * GetFile( sal_uLong lFileKey ){ return Get( lFileKey ); } diff --git a/rsc/inc/rscinst.hxx b/rsc/inc/rscinst.hxx index b64016bfac72..13535411c4bd 100644 --- a/rsc/inc/rscinst.hxx +++ b/rsc/inc/rscinst.hxx @@ -206,8 +206,6 @@ public: const ByteString & rMacro ); sal_Bool IsDefUsed( const ByteString & ); void DeleteDef( const ByteString & rMacroName ); - ERRTYPE ChangeDefName( const ByteString & rMacroName, - const ByteString & rNewName ); // Dateinamen-Instanz holen RscFile * GetFileStruct(); diff --git a/rsc/inc/rsckey.hxx b/rsc/inc/rsckey.hxx index dd99b68b0fae..65125c2904d1 100644 --- a/rsc/inc/rsckey.hxx +++ b/rsc/inc/rsckey.hxx @@ -48,11 +48,9 @@ public: ~RscNameTable(); void SetSort( sal_Bool bSorted = sal_True ); Atom Put( Atom nName, sal_uInt32 nTyp, long nValue ); - Atom Put( Atom nName, sal_uInt32 nTyp ); Atom Put( const char * pName, sal_uInt32 nTyp, long nValue ); Atom Put( const char * pName, sal_uInt32 nTyp ); Atom Put( Atom nName, sal_uInt32 nTyp, RscTop * pClass ); - Atom Put( const char * pName, sal_uInt32 nTyp, RscTop * pClass ); // sal_True, wurde gefunden sal_Bool Get( Atom nName, KEY_STRUCT * pEle ); diff --git a/rsc/inc/rscpar.hxx b/rsc/inc/rscpar.hxx index 69037ba8c027..779f2572afb7 100644 --- a/rsc/inc/rscpar.hxx +++ b/rsc/inc/rscpar.hxx @@ -62,8 +62,6 @@ public: void Init(); // ctor initialisieren RscFileInst( RscTypCont * pTC, sal_uLong lIndexSrc, sal_uLong lFileIndex, FILE * fFile ); - RscFileInst( RscTypCont * pTC, sal_uLong lIndexSrc, - sal_uLong lFileIndex, const ByteString & ); ~RscFileInst(); sal_Bool IsEof() const { return bEof; } void SetFileIndex( sal_uLong lFIndex ) { lFileIndex = lFIndex; } @@ -88,7 +86,6 @@ public: /******************* F u n c t i o n *************************************/ void IncludeParser( RscFileInst * pFileInst ); ERRTYPE parser( RscFileInst * pFileInst ); -RscExpression * MacroParser( RscFileInst & rFileInst ); #endif // _RSCPAR_HXX diff --git a/rsc/inc/rscrsc.hxx b/rsc/inc/rscrsc.hxx index 367118858918..aa7ee437643a 100644 --- a/rsc/inc/rscrsc.hxx +++ b/rsc/inc/rscrsc.hxx @@ -76,12 +76,10 @@ public: std::list<OutputFile> m_aOutputFiles; std::list< std::pair< rtl::OString, rtl::OString > > m_aReplacements; - RscCmdLine( int argc, char ** argv, RscError * pEH ); - RscCmdLine(); + RscCmdLine( int argc, char ** argv, RscError * pEH ); + ~RscCmdLine(); - ~RscCmdLine(); - - ::rtl::OString substitutePaths( const ::rtl::OString& rIn ); + ::rtl::OString substitutePaths( const ::rtl::OString& rIn ); }; /****************** R s c ************************************************/ @@ -97,7 +95,6 @@ private: void CreateResFile( const char * pRc ); void Append( const ByteString& rOutputSrs, const ByteString& rTmpFile ); - void OpenInput( const ByteString& rInput ); bool GetImageFilePath( const RscCmdLine::OutputFile& rOutputFile, const WriteRcContext& rContext, @@ -119,7 +116,6 @@ public: ~RscCompiler(); ERRTYPE Start(); - ByteString GetTmpFileName(); // Die Dateien werden geloescht // Include Statements lesen ERRTYPE IncludeParser( sal_uLong lFileKey ); diff --git a/rsc/inc/rsctools.hxx b/rsc/inc/rsctools.hxx index b65207dafac3..5792c1de8cff 100644 --- a/rsc/inc/rsctools.hxx +++ b/rsc/inc/rsctools.hxx @@ -51,7 +51,6 @@ enum RSCBYTEORDER_TYPE { RSC_BIGENDIAN, RSC_LITTLEENDIAN, RSC_SYSTEMENDIAN }; ByteString GetTmpFileName(); sal_Bool Append( ByteString aDestFile, ByteString aSourceFile ); sal_Bool Append( FILE * fDest, ByteString aSourceFile ); -ByteString InputFile ( const char * pInput, const char * pExt ); ByteString OutputFile( ByteString aInput, const char * ext ); char * ResponseFile( RscPtrPtr * ppCmd, char ** ppArgv, sal_uInt32 nArgc ); diff --git a/rsc/prj/build.lst b/rsc/prj/build.lst index a26b9a055b60..d9e775d28e66 100644 --- a/rsc/prj/build.lst +++ b/rsc/prj/build.lst @@ -6,4 +6,4 @@ r rsc\source\res nmake - all rsc_res NULL r rsc\source\parser nmake - all rsc_pars NULL r rsc\source\rsc nmake - all rsc_rsc NULL r rsc\source\rscpp nmake - all rsc_cpp NULL -r rsc\source\prj nmake - all rsc_sprj rsc_misc rsc_pars rsc_res rsc_rsc rsc_tool NULL +r rsc\source\prj nmake - all rsc_sprj rsc_cpp rsc_misc rsc_pars rsc_res rsc_rsc rsc_tool NULL diff --git a/rsc/prj/d.lst b/rsc/prj/d.lst index 984a109cf0a6..9c670b37b25c 100644 --- a/rsc/prj/d.lst +++ b/rsc/prj/d.lst @@ -1,9 +1,5 @@ ..\%__SRC%\bin\rsc.exe %_DEST%\bin\rsc.exe -..\%__SRC%\bin\rsc2.exe %_DEST%\bin\rsc2.exe ..\%__SRC%\bin\rsc %_DEST%\bin\rsc -..\%__SRC%\bin\rsc2 %_DEST%\bin\rsc2 -..\%__SRC%\bin\rscpp.exe %_DEST%\bin\rscpp.exe -..\%__SRC%\bin\rscpp %_DEST%\bin\rscpp mkdir: %_DEST%\inc\rsc ..\inc\rsc/rscsfx.hxx %_DEST%\inc\rsc\rscsfx.hxx diff --git a/rsc/source/misc/rscdbl.cxx b/rsc/source/misc/rscdbl.cxx index 5e6faeb47c22..8de91ae9dbbd 100644 --- a/rsc/source/misc/rscdbl.cxx +++ b/rsc/source/misc/rscdbl.cxx @@ -37,11 +37,6 @@ #include <rsctop.hxx> #include "rsclst.hxx" -/************************************************************************* -|* -|* RscTypCont::FillNameIdList() -|* -*************************************************************************/ REResourceList * InsertList( Atom nClassName, const RscId& rId, REResourceList * pList ) { REResourceList * pSubList; @@ -52,7 +47,7 @@ REResourceList * InsertList( Atom nClassName, const RscId& rId, if( pStrClass ) aStrClass = pStrClass; else - aStrClass = ByteString::CreateFromInt32( (long)nClassName ); + aStrClass = rtl::OString::valueOf(static_cast<sal_Int32>(nClassName)); pSubList = new REResourceList( pList, aStrClass, rId ); @@ -110,8 +105,4 @@ void FillList( RscTop * pRscTop, REResourceList * pList, sal_uLong lFileKey ){ }; } -void RscTypCont::FillNameIdList( REResourceList * pList, sal_uLong lFileKey ){ - FillList( pRoot, pList, lFileKey ); -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/rsc/source/parser/erscerr.cxx b/rsc/source/parser/erscerr.cxx index 23337514b2c5..d323e5229d7b 100644 --- a/rsc/source/parser/erscerr.cxx +++ b/rsc/source/parser/erscerr.cxx @@ -123,9 +123,9 @@ void RscError::WriteError( const ERRTYPE& rError, const char * pMessage ) case ERR_ERROR: { StdLstErr( "!! " ); if( 1 == nErrors ) - StdLstErr( ByteString::CreateFromInt32( nErrors ).GetBuffer() ); + StdLstErr(rtl::OString::valueOf(static_cast<sal_Int32>(nErrors )).getStr()); else - StdLstErr( ByteString::CreateFromInt32( (nErrors -1) ).GetBuffer() ); + StdLstErr(rtl::OString::valueOf(static_cast<sal_Int32>(nErrors -1)).getStr()); StdLstErr( " Error" ); StdLstErr( " found!!" ); } diff --git a/rsc/source/parser/rscdb.cxx b/rsc/source/parser/rscdb.cxx index a71b4a51eea2..1c7e544e18eb 100644 --- a/rsc/source/parser/rscdb.cxx +++ b/rsc/source/parser/rscdb.cxx @@ -315,56 +315,6 @@ RscTop * RscTypCont::SearchType( Atom nId ) /************************************************************************* |* -|* RscTypCont :: Search -|* -*************************************************************************/ -RscTop * RscTypCont :: Search( Atom nRT ){ - return( (RscTop *)pRoot->Search( nRT ) ); -} - -CLASS_DATA RscTypCont :: Search( Atom nRT, const RscId & rId ){ - ObjNode *pObjNode; - RscTop *pRscTop; - - if( NULL != (pRscTop = Search( nRT )) ){ - if( NULL != (pObjNode = pRscTop->GetObjNode( rId )) ){ - return( pObjNode->GetRscObj() ); - } - } - return( (CLASS_DATA)0 ); -} - -/************************************************************************* -|* -|* RscTypCont :: Delete() -|* -*************************************************************************/ -void RscTypCont :: Delete( Atom nRT, const RscId & rId ){ - ObjNode * pObjNode; - RscTop * pRscTop; - - if( NULL != (pRscTop = Search( nRT )) ){ - if( NULL != (pObjNode = pRscTop->GetObjNode()) ){ - pObjNode = pObjNode->Search( rId ); - - if( pObjNode ){ - //Objekt aus Baum entfernen - pRscTop->pObjBiTree = - (ObjNode *)pRscTop->pObjBiTree->Remove( pObjNode ); - - if( pObjNode->GetRscObj() ){ - pRscTop->Destroy( RSCINST( pRscTop, - pObjNode->GetRscObj() ) ); - rtl_freeMemory( pObjNode->GetRscObj() ); - } - delete pObjNode; - } - } - } -} - -/************************************************************************* -|* |* RscTypCont :: PutSysName() |* *************************************************************************/ @@ -969,11 +919,6 @@ void RscTypCont :: Delete( sal_uLong lFileKey ){ aFileTab.DeleteFileContext( lFileKey ); } -/************************************************************************* -|* -|* RscTypCont :: MakeConsistent() -|* -*************************************************************************/ sal_Bool IsInstConsistent( ObjNode * pObjNode, RscTop * pRscTop ) { sal_Bool bRet = sal_True; @@ -1021,10 +966,6 @@ sal_Bool MakeConsistent( RscTop * pRscTop ) return bRet; } -sal_Bool RscTypCont :: MakeConsistent(){ - return( ::MakeConsistent( pRoot ) ); -} - sal_uInt32 RscTypCont::PutTranslatorKey( sal_uInt64 nKey ) { aIdTranslator[ nKey ] = nFilePos; diff --git a/rsc/source/parser/rsckey.cxx b/rsc/source/parser/rsckey.cxx index 621ab4d69598..bdd21e89742f 100644 --- a/rsc/source/parser/rsckey.cxx +++ b/rsc/source/parser/rsckey.cxx @@ -122,11 +122,6 @@ Atom RscNameTable::Put( const char * pName, sal_uInt32 nTyp, long nValue ) return( Put( pHS->getID( pName ), nTyp, nValue ) ); }; -Atom RscNameTable::Put( Atom nName, sal_uInt32 nTyp ) -{ - return( Put( nName, nTyp, (long)nName ) ); -}; - Atom RscNameTable::Put( const char * pName, sal_uInt32 nTyp ) { Atom nId; @@ -140,11 +135,6 @@ Atom RscNameTable::Put( Atom nName, sal_uInt32 nTyp, RscTop * pClass ) return( Put( nName, nTyp, (long)pClass ) ); }; -Atom RscNameTable::Put( const char * pName, sal_uInt32 nTyp, RscTop * pClass ) -{ - return( Put( pHS->getID( pName ), nTyp, (long)pClass ) ); -}; - /************************************************************************* |* |* RscNameTable::Get() diff --git a/rsc/source/parser/rsclex.cxx b/rsc/source/parser/rsclex.cxx index 47be75549220..e9e4a0ebb9d0 100644 --- a/rsc/source/parser/rsclex.cxx +++ b/rsc/source/parser/rsclex.cxx @@ -413,38 +413,4 @@ ERRTYPE parser( RscFileInst * pFileInst ) return( aError ); } -RscExpression * MacroParser( RscFileInst & rFileInst ) -{ - ERRTYPE aError; - RscExpression * pExpression; - - InitParser( &rFileInst ); - - //Ziel auf macro_expression setzen - aKeyVal[ 0 ].nKeyWord = MACROTARGET; - bTargetDefined = sal_True; - aError = yyparse(); - - pExpression = pExp; - //EndParser() wuerde pExp loeschen - if( pExp ) - pExp = NULL; - - EndParser(); - - // yyparser gibt 0 zurueck, wenn erfolgreich - if( 0 == aError ) - aError.Clear(); - if( rFileInst.pTypCont->pEH->nErrors ) - aError = ERR_ERROR; - rFileInst.SetError( aError ); - - //im Fehlerfall pExpression loeschen - if( aError.IsError() && pExpression ){ - delete pExpression; - pExpression = NULL; - }; - return( pExpression ); -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/rsc/source/parser/rscpar.cxx b/rsc/source/parser/rscpar.cxx index fc3c44c8754d..d3dc291c5631 100644 --- a/rsc/source/parser/rscpar.cxx +++ b/rsc/source/parser/rscpar.cxx @@ -72,23 +72,6 @@ RscFileInst::RscFileInst( RscTypCont * pTC, sal_uLong lIndexSrc, pInput = (char *)rtl_allocateMemory( nInputBufLen ); } -RscFileInst::RscFileInst( RscTypCont * pTC, sal_uLong lIndexSrc, - sal_uLong lFIndex, const ByteString& rBuf ) -{ - pTypCont = pTC; - Init(); - lFileIndex = lFIndex; - lSrcIndex = lIndexSrc; - fInputFile = NULL; - nInputPos = 0; - nInputEndPos = rBuf.Len(); - - // Muss groesser sein wegen Eingabeende bei nInputBufLen < nInputEndPos - nInputBufLen = nInputEndPos +1; - pInput = (char *)rtl_allocateMemory( nInputBufLen +100 ); - memcpy( pInput, rBuf.GetBuffer(), nInputEndPos ); -} - /************************************************************************* |* |* RscFileInst::~RscFileInst() diff --git a/rsc/source/parser/rscyacc.cxx b/rsc/source/parser/rscyacc.cxx index c795abcc1fc9..f812523d9dc1 100644 --- a/rsc/source/parser/rscyacc.cxx +++ b/rsc/source/parser/rscyacc.cxx @@ -111,15 +111,16 @@ void SetString( const RSCINST & rInst, const char * pVarName, const char * pStr RscId MakeRscId( RscExpType aExpType ) { - if( !aExpType.IsNothing() ){ - sal_Int32 lValue; + if( !aExpType.IsNothing() ) + { + sal_Int32 lValue(0); if( !aExpType.Evaluate( &lValue ) ) pTC->pEH->Error( ERR_ZERODIVISION, NULL, RscId() ); if( lValue < 1 || lValue > (sal_Int32)0x7FFF ) { pTC->pEH->Error( ERR_IDRANGE, NULL, RscId(), - ByteString::CreateFromInt32( lValue ).GetBuffer() ); + rtl::OString::valueOf(lValue).getStr() ); } if( aExpType.IsDefinition() ) diff --git a/rsc/source/prj/gui.cxx b/rsc/source/prj/gui.cxx index 42d45caeb433..a25413492e1d 100644 --- a/rsc/source/prj/gui.cxx +++ b/rsc/source/prj/gui.cxx @@ -31,7 +31,6 @@ #include <stdlib.h> #include <stdio.h> -#include <sal/main.h> #include <rscrsc.hxx> #include <rscdb.hxx> @@ -66,7 +65,8 @@ RscVerbosity lcl_determineVerbosity( int argc, char ** argv ) return RscVerbosityNormal; } -SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) { +int rsc2_main( int argc, char **argv ) +{ #ifndef UNX atexit( ExitProgram ); #endif @@ -107,11 +107,4 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) { return( 1 ); } -void RscExit( sal_uInt32 nExit ) -{ - if( nExit ) - printf( "Program exit is %ud\n", (unsigned int)nExit ); - exit( nExit ); -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/rsc/source/prj/makefile.mk b/rsc/source/prj/makefile.mk index 9a504e3de78e..d496919cca23 100644 --- a/rsc/source/prj/makefile.mk +++ b/rsc/source/prj/makefile.mk @@ -45,22 +45,17 @@ OBJFILES= $(OBJ)$/gui.obj \ APP1TARGET= rsc APP1STDLIBS=$(TOOLSLIB) $(I18NISOLANGLIB) $(SALLIB) # $(RTLLIB) -APP1LIBS= $(LB)$/rsctoo.lib -APP1OBJS= $(OBJ)$/start.obj +APP1LIBS= $(LB)$/rscmis.lib \ + $(LB)$/rscpar.lib \ + $(LB)$/rscres.lib \ + $(LB)$/rscrsc.lib \ + $(LB)$/rscpp.lib \ + $(LB)$/rsctoo.lib +APP1OBJS= $(OBJ)$/start.obj \ + $(OBJ)$/gui.obj APP1STACK=64000 APP1RPATH=NONE -APP2TARGET= rsc2 -APP2STDLIBS=$(TOOLSLIB) $(I18NISOLANGLIB) $(SALLIB) # $(RTLLIB) -APP2LIBS= $(LB)$/rsctoo.lib \ - $(LB)$/rscres.lib \ - $(LB)$/rscpar.lib \ - $(LB)$/rscrsc.lib \ - $(LB)$/rscmis.lib -APP2OBJS= $(OBJ)$/gui.obj -APP2STACK=64000 -APP2RPATH=NONE - # --- Targets ------------------------------------------------------------ .INCLUDE : target.mk diff --git a/rsc/source/prj/start.cxx b/rsc/source/prj/start.cxx index 8a949546ce3a..be085254354f 100644 --- a/rsc/source/prj/start.cxx +++ b/rsc/source/prj/start.cxx @@ -50,39 +50,20 @@ #include <tools/fsys.hxx> /*************** C O D E ************************************************/ -/****************************************************************/ -/* */ -/* Function : fuer Ansi kompatibilitaet */ -/* */ -/****************************************************************/ -#ifdef UNX -#define P_WAIT 0 - int spawnvp( int, const char * cmdname, char *const* argv ){ - int rc(0); - - switch( fork() ){ - case -1: - return( -1 ); - case 0: - if( execvp( cmdname, argv ) == -1 ) - // an error occurs - return( -1 ); - break; - default: - if( -1 == wait( &rc ) ) - return( -1 ); - } - return( WEXITSTATUS( rc ) ); - } -#endif + +// Entry point declaration for modules rscpp and rsc2 +extern "C" +{ + int rscpp_main(int, char**); +} +int rsc2_main(int, char**); /************************************************************************* |* CallPrePro() |* |* Beschreibung *************************************************************************/ -static sal_Bool CallPrePro( const ByteString& rPrePro, - const ByteString& rInput, +static sal_Bool CallPrePro( const ByteString& rInput, const ByteString& rOutput, RscPtrPtr * pCmdLine, sal_Bool bResponse ) @@ -90,7 +71,7 @@ static sal_Bool CallPrePro( const ByteString& rPrePro, RscPtrPtr aNewCmdL; // Kommandozeile RscPtrPtr aRespCmdL; // Kommandozeile RscPtrPtr * pCmdL = &aNewCmdL; - int i, nExit; + int i, nRet; FILE* fRspFile = NULL; ByteString aRspFileName; @@ -101,7 +82,7 @@ static sal_Bool CallPrePro( const ByteString& rPrePro, } if( !fRspFile ) - aNewCmdL.Append( rsc_strdup( rPrePro.GetBuffer() ) ); + aNewCmdL.Append( rsc_strdup( "rscpp" ) ); bool bVerbose = false; for( i = 1; i < int(pCmdLine->GetCount() -1); i++ ) @@ -137,7 +118,7 @@ static sal_Bool CallPrePro( const ByteString& rPrePro, if( fRspFile ) { - aRespCmdL.Append( rsc_strdup( rPrePro.GetBuffer() ) ); + aRespCmdL.Append( rsc_strdup( "rscpp" ) ); ByteString aTmpStr( '@' ); aTmpStr += aRspFileName; aRespCmdL.Append( rsc_strdup( aTmpStr.GetBuffer() ) ); @@ -162,11 +143,7 @@ static sal_Bool CallPrePro( const ByteString& rPrePro, } } -#if defined UNX - nExit = spawnvp( P_WAIT, rPrePro.GetBuffer(), (char* const*)pCmdL->GetBlock() ); -#else - nExit = spawnvp( P_WAIT, (char*)rPrePro.GetBuffer(), (const char**)pCmdL->GetBlock() ); -#endif + nRet = rscpp_main( pCmdL->GetCount()-1, (char**)pCmdL->GetBlock() ); if ( fRspFile ) #if OSL_DEBUG_LEVEL > 5 @@ -174,7 +151,7 @@ static sal_Bool CallPrePro( const ByteString& rPrePro, #else unlink( aRspFileName.GetBuffer() ); #endif - if ( nExit ) + if ( nRet ) return sal_False; return sal_True; @@ -186,93 +163,65 @@ static sal_Bool CallPrePro( const ByteString& rPrePro, |* |* Beschreibung *************************************************************************/ -static sal_Bool CallRsc2( ByteString aRsc2Name, - RscStrList * pInputList, +static sal_Bool CallRsc2( RscStrList * pInputList, ByteString aSrsName, RscPtrPtr * pCmdLine ) { - int nExit; - ByteString* pString; - ByteString aRspFileName; // Response-Datei - FILE * fRspFile; // Response-Datei + int nRet; + ByteString* pString; + RscVerbosity eVerbosity = RscVerbosityNormal; - aRspFileName = ::GetTmpFileName(); - fRspFile = fopen( aRspFileName.GetBuffer(), "w" ); + RscPtrPtr aNewCmdL; + aNewCmdL.Append( rsc_strdup( "rsc2" ) ); - RscVerbosity eVerbosity = RscVerbosityNormal; - if( fRspFile ) + for (int i = 1; i < (int)(pCmdLine->GetCount() -1); ++i) { - for (int i = 1; i < (int)(pCmdLine->GetCount() -1); ++i) + if ( !rsc_stricmp( (char *)pCmdLine->GetEntry( i ), "-verbose" ) ) { - if ( !rsc_stricmp( (char *)pCmdLine->GetEntry( i ), "-verbose" ) ) - { - eVerbosity = RscVerbosityVerbose; - continue; - } - if ( !rsc_stricmp( (char *)pCmdLine->GetEntry( i ), "-quiet" ) ) - { - eVerbosity = RscVerbositySilent; - continue; - } - if( !rsc_strnicmp( (char *)pCmdLine->GetEntry( i ), "-fp=", 4 ) - || !rsc_strnicmp( (char *)pCmdLine->GetEntry( i ), "-fo=", 4 ) - || !rsc_strnicmp( (char *)pCmdLine->GetEntry( i ), "-pp=", 4 ) - || !rsc_strnicmp( (char *)pCmdLine->GetEntry( i ), "-rsc2=", 6 ) - || !rsc_strnicmp( (char *)pCmdLine->GetEntry( i ), "-presponse", 9 ) - || !rsc_strnicmp( (char *)pCmdLine->GetEntry( i ), "-rc", 3 ) - || !rsc_stricmp( (char *)pCmdLine->GetEntry( i ), "-+" ) - || !rsc_stricmp( (char *)pCmdLine->GetEntry( i ), "-br" ) - || !rsc_stricmp( (char *)pCmdLine->GetEntry( i ), "-bz" ) - || !rsc_stricmp( (char *)pCmdLine->GetEntry( i ), "-r" ) - // Am I the only one that thinks the following line inludes all the tests before? - || ( '-' != *(char *)pCmdLine->GetEntry( i ) ) ) - { - } - else - fprintf( fRspFile, "%s ", - (const char *)pCmdLine->GetEntry( i ) ); - }; - - fprintf( fRspFile, "%s", aSrsName.GetBuffer() ); - - for ( size_t i = 0, n = pInputList->size(); i < n; ++i ) + eVerbosity = RscVerbosityVerbose; + continue; + } + if ( !rsc_stricmp( (char *)pCmdLine->GetEntry( i ), "-quiet" ) ) { - pString = (*pInputList)[ i ]; - fprintf( fRspFile, " %s", pString->GetBuffer() ); - }; - - fclose( fRspFile ); + eVerbosity = RscVerbositySilent; + continue; + } + if( !rsc_strnicmp( (char *)pCmdLine->GetEntry( i ), "-fp=", 4 ) + || !rsc_strnicmp( (char *)pCmdLine->GetEntry( i ), "-fo=", 4 ) + || !rsc_strnicmp( (char *)pCmdLine->GetEntry( i ), "-presponse", 9 ) + || !rsc_strnicmp( (char *)pCmdLine->GetEntry( i ), "-rc", 3 ) + || !rsc_stricmp( (char *)pCmdLine->GetEntry( i ), "-+" ) + || !rsc_stricmp( (char *)pCmdLine->GetEntry( i ), "-br" ) + || !rsc_stricmp( (char *)pCmdLine->GetEntry( i ), "-bz" ) + || !rsc_stricmp( (char *)pCmdLine->GetEntry( i ), "-r" ) + || ( '-' != *(char *)pCmdLine->GetEntry( i ) ) ) + { + } + else + aNewCmdL.Append( rsc_strdup( (char *)pCmdLine->GetEntry( i ) ) ); }; - RscPtrPtr aNewCmdL; // Kommandozeile - aNewCmdL.Append( rsc_strdup( aRsc2Name.GetBuffer() ) ); - ByteString aTmpStr( '@' ); - aTmpStr += aRspFileName; - aNewCmdL.Append( rsc_strdup( aTmpStr.GetBuffer() ) ); - aNewCmdL.Append( (void *)0 ); + aNewCmdL.Append( rsc_strdup( aSrsName.GetBuffer() ) ); + + for ( size_t i = 0, n = pInputList->size(); i < n; ++i ) + { + pString = (*pInputList)[ i ]; + aNewCmdL.Append( rsc_strdup( pString->GetBuffer() ) ); + }; if ( eVerbosity >= RscVerbosityVerbose ) { printf( "Rsc2 commandline: " ); - printf( "%s", (const char *)aNewCmdL.GetEntry( 0 ) ); - printf( " " ); - printf( "%s", (const char *)aNewCmdL.GetEntry( 1 ) ); + for( size_t i = 0; i < (unsigned int)(aNewCmdL.GetCount() -1); i++ ) + { + printf( " %s", (const char *)aNewCmdL.GetEntry( i ) ); + } printf( "\n" ); } -#if defined UNX - nExit = spawnvp( P_WAIT, aRsc2Name.GetBuffer(), (char* const*)aNewCmdL.GetBlock() ); -#else - nExit = spawnvp( P_WAIT, (char*)aRsc2Name.GetBuffer(), (const char**)aNewCmdL.GetBlock() ); -#endif + nRet = rsc2_main( aNewCmdL.GetCount(), (char**)aNewCmdL.GetBlock() ); - if( fRspFile ) - #if OSL_DEBUG_LEVEL > 5 - fprintf( stderr, "leaving response file %s\n", aRspFileName.GetBuffer() ); - #else - unlink( aRspFileName.GetBuffer() ); - #endif - if( nExit ) + if( nRet ) return( sal_False ); return( sal_True ); } @@ -288,10 +237,6 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) sal_Bool bHelp = sal_False; sal_Bool bError = sal_False; sal_Bool bResponse = sal_False; - ByteString aSolarbin(getenv("SOLARBINDIR")); - ByteString aDelim("/"); - ByteString aPrePro; //( aSolarbin + aDelim + ByteString("rscpp")); - ByteString aRsc2Name; //( aSolarbin + aDelim + ByteString("rsc2")); ByteString aSrsName; ByteString aResName; RscStrList aInputList; @@ -302,14 +247,6 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) sal_uInt32 i; ByteString* pString; - aPrePro = aSolarbin; - aPrePro += aDelim; - aPrePro += ByteString("rscpp"); - - aRsc2Name = aSolarbin; - aRsc2Name += aDelim; - aRsc2Name += ByteString("rsc2"); - pStr = ::ResponseFile( &aCmdLine, argv, argc ); if( pStr ) { @@ -335,17 +272,9 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) bHelp = sal_True; } else if( !rsc_strnicmp( (*ppStr) + 1, "presponse", 9 ) ) - { // anderer Name fuer den Preprozessor + { // whether to use response file when parameterising preprocessor bResponse = sal_True; } - else if( !rsc_strnicmp( (*ppStr) + 1, "pp=", 3 ) ) - { // anderer Name fuer den Preprozessor - aPrePro = (*ppStr) + 4; - } - else if( !rsc_strnicmp( (*ppStr) + 1, "rsc2=", 5 ) ) - { // Accept alternate name for the rsc2 compiler - aRsc2Name = (*ppStr) + 6; - } else if( !rsc_strnicmp( (*ppStr) + 1, "fo=", 3 ) ) { // anderer Name fuer .res-file aResName = (*ppStr) + 4; @@ -387,7 +316,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) { pString = aInputList[ k ]; aTmpName = ::GetTmpFileName(); - if( !CallPrePro( aPrePro, *pString, aTmpName, &aCmdLine, bResponse ) ) + if( !CallPrePro( *pString, aTmpName, &aCmdLine, bResponse ) ) { printf( "Error starting preprocessor\n" ); bError = sal_True; @@ -399,8 +328,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) if( !bError ) { - if( !CallRsc2( aRsc2Name, bPrePro ? &aTmpList : &aInputList, - aSrsName, &aCmdLine ) ) + if( !CallRsc2( bPrePro ? &aTmpList : &aInputList, aSrsName, &aCmdLine ) ) { if( !bHelp ) { diff --git a/rsc/source/res/rscclass.cxx b/rsc/source/res/rscclass.cxx index 6f2939cd2fd2..8060c3271240 100644 --- a/rsc/source/res/rscclass.cxx +++ b/rsc/source/res/rscclass.cxx @@ -1124,33 +1124,6 @@ ERRTYPE RscSysDepend::WriteRc( const RSCINST & rInst, RscWriteRc & rMem, /************************************************************************* |* -|* RscFirstSysDepend::RscFirstSysDepend() -|* -|* Beschreibung -|* -*************************************************************************/ -RscFirstSysDepend::RscFirstSysDepend( Atom nId, sal_uInt32 nTypeId, - RscTop * pSuper ) - : RscSysDepend( nId, nTypeId, pSuper ) -{} - -/************************************************************************* -|* -|* RscFirstSysDepend::WriteRc() -|* -|* Beschreibung -|* -*************************************************************************/ -ERRTYPE RscFirstSysDepend::WriteRc( const RSCINST & rInst, RscWriteRc & rMem, - RscTypCont * pTC, sal_uInt32 nDeep, sal_Bool bExtra ) -{ - ERRTYPE aError = RscClass::WriteRc( rInst, rMem, pTC, nDeep, bExtra ); - aError = WriteSysDependRc( rInst, rMem, pTC, nDeep, bExtra, sal_True ); - return aError; -} - -/************************************************************************* -|* |* RscTupel::RscTupel() |* |* Beschreibung diff --git a/rsc/source/rsc/rsc.cxx b/rsc/source/rsc/rsc.cxx index f8e308a7a47f..6dbf71c3983c 100644 --- a/rsc/source/rsc/rsc.cxx +++ b/rsc/source/rsc/rsc.cxx @@ -113,18 +113,6 @@ void RscCmdLine::Init() |* Beschreibung Kommandozeile interpretierten |* *************************************************************************/ -RscCmdLine::RscCmdLine() -{ - Init(); -} - -/************************************************************************* -|* -|* RscCmdLine::RscCmdLine() -|* -|* Beschreibung Kommandozeile interpretierten -|* -*************************************************************************/ RscCmdLine::RscCmdLine( int argc, char ** argv, RscError * pEH ) { char * pStr; @@ -1048,39 +1036,6 @@ void RscCompiler::Append( const ByteString& rOutputSrs, } } -/********************************************************************/ -/* */ -/* Function : GetTmpFileName() */ -/* */ -/* Description : Packt einen Dateinamen in Tmp-Dateiliste. */ -/* */ -/********************************************************************/ -ByteString RscCompiler::GetTmpFileName() -{ - ByteString aFileName; - - aFileName = ::GetTmpFileName(); - return( aFileName ); -} - -/********************************************************************/ -/* */ -/* Function : sal_Bool openinput() */ -/* */ -/* Description : Check to see if the input file exists and can */ -/* be opened for reading. */ -/********************************************************************/ - -void RscCompiler::OpenInput( const ByteString& rInput ) -{ - FILE *fp; - /* try to open the input file */ - if( NULL == (fp = fopen( rInput.GetBuffer(), "r"))) - pTC->pEH->FatalError( ERR_OPENFILE, RscId(), rInput.GetBuffer() ); - - fclose( fp ); -} - /************************************************************************* |* |* GetImageFilePath() @@ -1248,7 +1203,7 @@ void RscCompiler::PreprocessSrsFile( const RscCmdLine::OutputFile& rOutputFile, sal_Int32 nNumber = atoi( aLine.GetBuffer() ); if( nNumber < 10000 ) - aBaseFileName += ByteString::CreateFromInt32( 0 ); + aBaseFileName += '0'; if( GetImageFilePath( rOutputFile, rContext, aBaseFileName += aLine , aFilePath, pSysListFile ) ) aEntryVector.push_back( ::std::pair< ByteString, sal_Int32 >( aFilePath, nNumber ) ); @@ -1276,14 +1231,15 @@ void RscCompiler::PreprocessSrsFile( const RscCmdLine::OutputFile& rOutputFile, for( sal_uInt32 i = 0; i < aEntryVector.size(); ++i ) { - ByteString aEntryString( "< \"" ); + rtl::OStringBuffer aEntryString( + RTL_CONSTASCII_STRINGPARAM("< \"")); - aEntryString += aEntryVector[ i ].first; - aEntryString += "\"; "; - aEntryString += ByteString::CreateFromInt32( aEntryVector[ i ].second ); - aEntryString += "; >;"; + aEntryString.append(aEntryVector[i].first); + aEntryString.append(RTL_CONSTASCII_STRINGPARAM("\"; ")); + aEntryString.append(static_cast<sal_Int32>(aEntryVector[ i ].second)); + aEntryString.append(RTL_CONSTASCII_STRINGPARAM("; >;")); - aOStm.WriteLine( aEntryString ); + aOStm.WriteLine(aEntryString.makeStringAndClear()); } aOStm.WriteLine( "};" ); diff --git a/rsc/source/rscpp/cpp.h b/rsc/source/rscpp/cpp.h index 8ec451ab9d3d..ddcecc8114c2 100644 --- a/rsc/source/rscpp/cpp.h +++ b/rsc/source/rscpp/cpp.h @@ -290,9 +290,9 @@ extern SIZES size_table[]; /* For #if sizeof sizes */ #ifdef NOMAIN /* BP */ #ifndef _NO_PROTO -int start_cpp( int argc, char *argv[] ); +int rscpp_main( int argc, char **argv ); #endif -#define MAIN start_cpp /* fuer die cpp.lib muss main() geandert werden */ +#define MAIN rscpp_main /* fuer die cpp.lib muss main() geandert werden */ #else #ifdef WNT #define MAIN __cdecl main diff --git a/rsc/source/rscpp/cpp1.c b/rsc/source/rscpp/cpp1.c index 378adaa17c5e..014a14b1e65d 100644 --- a/rsc/source/rscpp/cpp1.c +++ b/rsc/source/rscpp/cpp1.c @@ -26,6 +26,8 @@ * ************************************************************************/ +#define NOMAIN + #include <stdio.h> #include <ctype.h> #include "cppdef.h" diff --git a/rsc/source/rscpp/makefile.mk b/rsc/source/rscpp/makefile.mk index 2cec0885ffad..980ef451f542 100644 --- a/rsc/source/rscpp/makefile.mk +++ b/rsc/source/rscpp/makefile.mk @@ -57,13 +57,6 @@ OBJFILES= \ $(OBJ)$/cpp5.obj \ $(OBJ)$/cpp6.obj \ -.IF "$(cpp)" == "" -LIBSALCPPRT=$(0) -APP1TARGET= $(TARGET) -APP1LIBS=$(LB)$/$(TARGET).lib -APP1STACK=32768 -.ENDIF - .IF "$(GUI)"=="UNX" CDEFS+=-Dunix .ENDIF @@ -79,12 +72,3 @@ NOOPTFILES=$(OBJ)$/cpp6.obj # --- Targets ------------------------------------------------------ .INCLUDE : target.mk - -cpp1.c: cppdef.h cpp.h -cpp2.c: cppdef.h cpp.h -cpp3.c: cppdef.h cpp.h -cpp4.c: cppdef.h cpp.h -cpp5.c: cppdef.h cpp.h -cpp6.c: cppdef.h cpp.h - - diff --git a/rsc/source/tools/rscdef.cxx b/rsc/source/tools/rscdef.cxx index ad4bab1412a2..8f8754d1b205 100644 --- a/rsc/source/tools/rscdef.cxx +++ b/rsc/source/tools/rscdef.cxx @@ -44,7 +44,6 @@ sal_Bool RscId::bNames = sal_True; |* *************************************************************************/ void RscId::SetNames( sal_Bool bSet ) { bNames = bSet; } -sal_Bool RscId::IsSetNames() { return bNames; } /************************************************************************* |* @@ -170,34 +169,17 @@ RscId::operator sal_Int32() const *************************************************************************/ ByteString RscId::GetName() const { - ByteString aStr; + rtl::OStringBuffer aStr; if ( !aExp.IsNothing() ) { if( bNames ) - aExp.GetMacro( aStr ); + aExp.AppendMacro(aStr); else - aStr = ByteString::CreateFromInt32( GetNumber() ); + aStr.append(GetNumber()); } - return aStr; -} - -/************************************************************************* -|* -|* RscId::GetMacro() -|* -*************************************************************************/ -ByteString RscId::GetMacro() const -{ - ByteString aStr; - - if ( aExp.IsDefinition() ) - aStr = aExp.aExp.pDef->GetMacro(); - else - aExp.GetMacro( aStr ); - - return aStr; + return aStr.makeStringAndClear(); } /****************** R s c D e f i n e ************************************/ @@ -259,27 +241,7 @@ void RscDefine::DefineToNumber() if( pExp ) delete pExp; pExp = NULL; - SetName( ByteString::CreateFromInt32( lId ) ); -} - -/************************************************************************* -|* -|* RscDefine::ChangeMacro() -|* -*************************************************************************/ -void RscDefine::ChangeMacro( RscExpression * pExpression ){ - if( pExp ) - delete pExp; - pExp = pExpression; - pExp->Evaluate( &lId ); -} - -void RscDefine::ChangeMacro( sal_Int32 lIdentifier ){ - if( pExp ){ - delete pExp; - pExp = NULL; - } - lId = lIdentifier; + SetName(rtl::OString::valueOf(lId)); } /************************************************************************* @@ -314,7 +276,7 @@ ByteString RscDefine::GetMacro() { if( pExp ) return pExp->GetMacro(); - return ByteString::CreateFromInt32( lId ); + return rtl::OString::valueOf(lId); } /****************** R s c D e f i n e L i s t ****************************/ @@ -359,35 +321,6 @@ RscDefine * RscDefineList::New( sal_uLong lFileKey, const ByteString & rDefName, return pDef; } -/************************************************************************* -|* -|* RscDefineList::Remove() -|* -*************************************************************************/ -sal_Bool RscDefineList::Remove( RscDefine * pDef ) { - for ( RscSubDefList::iterator it = maList.begin(); it < maList.end(); ++it ) { - if ( *it == pDef ) { - (*it)->DefineToNumber(); - (*it)->DecRef(); - maList.erase( it ); - return sal_True; - } - } - return sal_False; -} - -sal_Bool RscDefineList::Remove( size_t lIndex ) { - if ( lIndex < maList.size() ) { - RscSubDefList::iterator it = maList.begin(); - ::std::advance( it, lIndex ); - (*it)->DefineToNumber(); - (*it)->DecRef(); - maList.erase( it ); - return sal_True; - } - return sal_False; -} - sal_Bool RscDefineList::Remove() { if ( maList.empty() ) return sal_False; @@ -400,29 +333,6 @@ sal_Bool RscDefineList::Remove() { /************************************************************************* |* -|* RscDefineList::Befor() -|* -*************************************************************************/ -sal_Bool RscDefineList::Befor( const RscDefine * pFree, - const RscDefine * pDepend ) -{ - size_t i = 0; - size_t n = maList.size(); - while ( i < n ) { - if ( maList[ i ] == pFree ) { - for ( ++i ; i < n ; ++i ) { - if ( maList[ i ] == pDepend ) { - return sal_True; - } - } - } - ++i; - } - return sal_False; -} - -/************************************************************************* -|* |* RscDefineList::WriteAll() |* *************************************************************************/ @@ -459,23 +369,14 @@ sal_Bool RscExpType::Evaluate( sal_Int32 * plValue ) const{ return sal_True; } -/************************************************************************* -|* -|* RscExpType::GetMacro() -|* -*************************************************************************/ -void RscExpType::GetMacro( ByteString & rStr ) const +void RscExpType::AppendMacro(rtl::OStringBuffer& rStr) const { - ByteString aStr; - if( IsDefinition() ) - { - rStr += aExp.pDef->GetName(); - } + rStr.append(aExp.pDef->GetName()); else if( IsExpression() ) - rStr += aExp.pExp->GetMacro(); + rStr.append(aExp.pExp->GetMacro()); else if( IsNumber() ) - rStr += ByteString::CreateFromInt32( GetLong() ); + rStr.append(GetLong()); } @@ -555,38 +456,38 @@ sal_Bool RscExpression::Evaluate( sal_Int32 * plValue ){ *************************************************************************/ ByteString RscExpression::GetMacro() { - ByteString aLeft; + rtl::OStringBuffer aLeft; // Ausgabeoptimierung if( aLeftExp.IsNothing() ) { if ( '-' == cOperation ) { - aLeft += '('; - aLeft += '-'; + aLeft.append('('); + aLeft.append('-'); } - aRightExp.GetMacro( aLeft ); + aRightExp.AppendMacro(aLeft); if( '-' == cOperation ) - aLeft += ')'; + aLeft.append(')'); } else if( aRightExp.IsNothing() ) - aLeftExp.GetMacro( aLeft ); + aLeftExp.AppendMacro(aLeft); else{ - aLeft += '('; + aLeft.append('('); // linken Zweig auswerten - aLeftExp.GetMacro( aLeft ); + aLeftExp.AppendMacro(aLeft); - aLeft += cOperation; + aLeft.append(cOperation); - aLeft += '('; + aLeft.append('('); // rechten Zweig auswerten - aRightExp.GetMacro( aLeft ); - aLeft += ')'; + aRightExp.AppendMacro(aLeft); + aLeft.append(')'); - aLeft += ')'; + aLeft.append(')'); } - return aLeft; + return aLeft.makeStringAndClear(); } /****************** R s c F i l e ****************************************/ @@ -672,25 +573,6 @@ sal_Bool RscFile :: InsertDependFile( sal_uLong lIncFile, size_t lPos ) return sal_True; } -/************************************************************************* -|* -|* RscFile::RemoveDependFile() -|* -*************************************************************************/ -void RscFile :: RemoveDependFile( sal_uLong lDepFile ) -{ - for ( size_t i = aDepLst.size(); i > 0; ) - { - RscDepend* pDep = aDepLst[ --i ]; - if( pDep->GetFileKey() == lDepFile ) { - RscDependList::iterator it = aDepLst.begin(); - ::std::advance( it, i ); - delete *it; - aDepLst.erase( it ); - } - } -} - /****************** R s c D e f T r e e **********************************/ /************************************************************************* |* @@ -767,10 +649,6 @@ sal_Bool RscDefTree::Evaluate( RscDefine * pDef ){ return sal_True; } -sal_Bool RscDefTree::Evaluate(){ - return Evaluate( pDefRoot ); -} - /****************** R s c F i l e T a b **********************************/ /************************************************************************* |* @@ -828,23 +706,6 @@ RscDefine * RscFileTab::FindDef( const char * pName ){ /************************************************************************* |* -|* RscFileTab::FindDef() -|* -*************************************************************************/ -RscDefine * RscFileTab::FindDef( sal_uLong lFileKey, const ByteString & rName ) -{ - RscDefine * pDef = FindDef( rName ); - - if( pDef ) - //befindet sich das DEFINE in einer Include-Datei in der - //Datei lFileKey - if( Depend( lFileKey, pDef->GetFileKey() ) ) - return pDef; - return NULL; -} - -/************************************************************************* -|* |* RscFileTab::Depend() |* *************************************************************************/ @@ -972,113 +833,6 @@ RscDefine * RscFileTab::NewDef( sal_uLong lFileKey, const ByteString & rDefName, /************************************************************************* |* -|* RscFileTab::IsDefUsed() -|* -*************************************************************************/ -sal_Bool RscFileTab::IsDefUsed( const ByteString & rDefName ) -{ - RscDefine * pDef = FindDef( rDefName ); - - if( pDef ) - return( pDef->GetRefCount() != 2 ); - - return sal_False; -} - -/************************************************************************* -|* -|* RscFileTab::DeleteDef() -|* -*************************************************************************/ -void RscFileTab::DeleteDef( const ByteString & rDefName ) -{ - RscDefine * pDef = FindDef( rDefName ); - RscFile * pFile; - - if( pDef ){ - pFile = GetFile( pDef->GetFileKey() ); - if( pFile ){ - aDefTree.Remove( pDef ); - pFile->aDefLst.Remove( pDef ); - } - }; -} - -/************************************************************************* -|* -|* RscFileTab::ChangeDef() -|* -*************************************************************************/ -sal_Bool RscFileTab::ChangeDef( const ByteString & rDefName, sal_Int32 lId ) -{ - RscDefine * pDef = FindDef( rDefName ); - - if( pDef ){ - pDef->ChangeMacro( lId ); - //alle Macros neu bewerten - return aDefTree.Evaluate(); - }; - return( sal_False ); -} - -/************************************************************************* -|* -|* RscFileTab::ChangeDef() -|* -*************************************************************************/ -sal_Bool RscFileTab::ChangeDef( const ByteString & rDefName, - RscExpression * pExp ) -{ - RscDefine * pDef = FindDef( rDefName ); - RscFile * pFile; - - if( pDef ) - { - pFile = GetFile( pDef->GetFileKey() ); - sal_uLong lPos = 0; - if( pFile ) - lPos = pFile->aDefLst.GetPos( pDef ); - //Macros in den Expressions sind definiert ? - if( TestDef( pDef->GetFileKey(), lPos, pExp ) ){ - pDef->ChangeMacro( pExp ); - //alle Macros neu bewerten - return aDefTree.Evaluate(); - } - }; - - // pExp wird immer Eigentum und muss, wenn es nicht benoetigt wird - // geloescht werden - delete pExp; - - return( sal_False ); -} - -/************************************************************************* -|* -|* RscFileTab::ChangeDefName() -|* -*************************************************************************/ -sal_Bool RscFileTab::ChangeDefName( const ByteString & rDefName, - const ByteString & rNewName ) -{ - RscDefine * pDef = FindDef( rDefName ); - - //Name gefunden ? - if( pDef ){ - // und neuer Name noch nicht bekannt ? - if( !FindDef( pDef->GetFileKey(), rNewName ) ){ - aDefTree.Remove( pDef ); - pDef->SetName( rNewName ); - aDefTree.Insert( pDef ); - return( sal_True ); - } - }; - - return( sal_False ); -} - -/************************************************************************* -|* |* RscFileTab::DeleteFileContext() |* *************************************************************************/ @@ -1099,29 +853,6 @@ void RscFileTab :: DeleteFileContext( sal_uLong lFileKey ){ /************************************************************************* |* -|* RscFileTab::DeleteFile() -|* -*************************************************************************/ -void RscFileTab :: DeleteFile( sal_uLong lFileKey ){ - RscFile * pFName; - - //Defines freigeben - DeleteFileContext( lFileKey ); - - //Schleife ueber alle Abhaengigkeiten - pFName = First(); - while( pFName ){ - pFName->RemoveDependFile( lFileKey ); - pFName = Next(); - }; - - pFName = Remove( lFileKey ); - if( pFName ) - delete pFName; -} - -/************************************************************************* -|* |* RscFileTab::NewCodeFile() |* *************************************************************************/ diff --git a/rsc/source/tools/rsctools.cxx b/rsc/source/tools/rsctools.cxx index ec0931607c44..006b225c04ae 100644 --- a/rsc/source/tools/rsctools.cxx +++ b/rsc/source/tools/rsctools.cxx @@ -177,29 +177,6 @@ sal_Bool Append( ByteString aOutputSrs, ByteString aTmpFile ) /************************************************************************* |* -|* InputFile -|* -|* Beschreibung Haengt Extension an, wenn keine da ist -|* Parameter: pInput, der Input-Dateiname. -|* pExt, die Extension des Ausgabenamens -|* -*************************************************************************/ -ByteString InputFile ( const char * pInput, const char * pExt ) -{ - UniString aUniInput( pInput, RTL_TEXTENCODING_ASCII_US ); - DirEntry aFileName( aUniInput ); - - if ( 0 == aFileName.GetExtension().Len() ) - { - UniString aExt( pExt, RTL_TEXTENCODING_ASCII_US ); - aFileName.SetExtension( aExt ); - } - - return ByteString( aFileName.GetFull(), RTL_TEXTENCODING_ASCII_US ); -} - -/************************************************************************* -|* |* OutputFile |* |* Beschreibung Ersetzt Extension durch eine andere diff --git a/sax/prj/build.lst b/sax/prj/build.lst index 0a8a3789e1d8..940ef70e585c 100644 --- a/sax/prj/build.lst +++ b/sax/prj/build.lst @@ -1,3 +1,4 @@ ax sax : offapi cppuhelper EXPAT:expat comphelper LIBXSLT:libxslt NULL ax sax\prj nmake - all ax_prj NULL +ax sax\test nmake - all ax_test NULL diff --git a/sax/prj/d.lst b/sax/prj/d.lst index 7416200538a6..54fab394e8fc 100644 --- a/sax/prj/d.lst +++ b/sax/prj/d.lst @@ -1 +1,2 @@ +..\%__SRC%\lib\*.a %_DEST%\lib\*.a ..\inc\sax\tools\documenthandleradapter.hxx %_DEST%\inc\sax\tools\documenthandleradapter.hxx diff --git a/sax/source/expatwrap/sax_expat.cxx b/sax/source/expatwrap/sax_expat.cxx index 06258510ceca..34df91a83a26 100644 --- a/sax/source/expatwrap/sax_expat.cxx +++ b/sax/source/expatwrap/sax_expat.cxx @@ -1029,12 +1029,6 @@ using namespace sax_expatwrap; extern "C" { -SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( - const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ ) -{ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} - SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ ) { diff --git a/sax/source/fastparser/facreg.cxx b/sax/source/fastparser/facreg.cxx index e4152cfc1b58..8352b0cf4824 100644 --- a/sax/source/fastparser/facreg.cxx +++ b/sax/source/fastparser/facreg.cxx @@ -35,12 +35,6 @@ Reference< XInterface > SAL_CALL FastSaxSerializer_CreateInstance( const Referen extern "C" { -SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( - const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ ) -{ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} - SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ ) { void * pRet = 0; diff --git a/sax/test/sax/exports.dxp b/sax/test/sax/exports.dxp index ce95ae0f8deb..86214860d555 100644 --- a/sax/test/sax/exports.dxp +++ b/sax/test/sax/exports.dxp @@ -1,3 +1,2 @@ -component_getImplementationEnvironment component_getFactory -component_writeInfo
\ No newline at end of file +component_writeInfo diff --git a/sax/test/sax/testsax.cxx b/sax/test/sax/testsax.cxx index db58f193088f..aad3b9ed5f7c 100644 --- a/sax/test/sax/testsax.cxx +++ b/sax/test/sax/testsax.cxx @@ -786,14 +786,6 @@ using namespace sax_test; extern "C" { - -SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( - const sal_Char ** ppEnvTypeName, uno_Environment ** ppEnv ) -{ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} - - sal_Bool SAL_CALL component_writeInfo( void * pServiceManager, void * pRegistryKey ) { diff --git a/sax/test/saxdemo.cxx b/sax/test/saxdemo.cxx index 6aedffcb42b6..b00eb0703672 100644 --- a/sax/test/saxdemo.cxx +++ b/sax/test/saxdemo.cxx @@ -36,6 +36,7 @@ #include <stdio.h> #include <vector> +#include <cstring> #include <com/sun/star/registry/XImplementationRegistration.hpp> #include <com/sun/star/lang/XComponent.hpp> @@ -92,7 +93,7 @@ public: { return readBytes( aData, nMaxBytesToRead ); } - virtual void SAL_CALL skipBytes( sal_Int32 nBytesToSkip ) + virtual void SAL_CALL skipBytes( sal_Int32 /* nBytesToSkip */ ) throw(NotConnectedException, BufferSizeExceededException, IOException, RuntimeException) { // not implemented @@ -107,8 +108,8 @@ public: { // not needed } - sal_Int32 nPos; Sequence< sal_Int8> m_seq; + sal_Int32 nPos; }; //------------------------------- @@ -155,11 +156,11 @@ public: // Error handler Reference < XInterface >() , aSAXParseException ); } - virtual void SAL_CALL fatalError(const Any& aSAXParseException) throw (SAXException, RuntimeException) + virtual void SAL_CALL fatalError(const Any& /* aSAXParseException */) throw (SAXException, RuntimeException) { printf( "Fatal Error !\n" ); } - virtual void SAL_CALL warning(const Any& aSAXParseException) throw (SAXException, RuntimeException) + virtual void SAL_CALL warning(const Any& /* aSAXParseException */) throw (SAXException, RuntimeException) { printf( "Warning !\n" ); } @@ -182,7 +183,7 @@ public: // ExtendedDocumentHandler m_iElementCount, m_iAttributeCount, m_iWhitespaceCount , m_iCharCount ); } - virtual void SAL_CALL startElement(const OUString& aName, + virtual void SAL_CALL startElement(const OUString& /* aName */, const Reference< XAttributeList > & xAttribs) throw (SAXException,RuntimeException) { @@ -190,7 +191,7 @@ public: // ExtendedDocumentHandler m_iAttributeCount += xAttribs->getLength(); } - virtual void SAL_CALL endElement(const OUString& aName) throw (SAXException,RuntimeException) + virtual void SAL_CALL endElement(const OUString& /* aName */) throw (SAXException,RuntimeException) { // ignored } @@ -204,12 +205,12 @@ public: // ExtendedDocumentHandler m_iWhitespaceCount += aWhitespaces.getLength(); } - virtual void SAL_CALL processingInstruction(const OUString& aTarget, const OUString& aData) throw (SAXException,RuntimeException) + virtual void SAL_CALL processingInstruction(const OUString& /* aTarget */, const OUString& /* aData */) throw (SAXException,RuntimeException) { // ignored } - virtual void SAL_CALL setDocumentLocator(const Reference< XLocator> & xLocator) + virtual void SAL_CALL setDocumentLocator(const Reference< XLocator> & /* xLocator */) throw (SAXException,RuntimeException) { // ignored @@ -218,7 +219,7 @@ public: // ExtendedDocumentHandler virtual InputSource SAL_CALL resolveEntity( const OUString& sPublicId, const OUString& sSystemId) - throw (SAXException,RuntimeException) + throw (RuntimeException) { InputSource source; source.sSystemId = sSystemId; @@ -233,13 +234,13 @@ public: // ExtendedDocumentHandler virtual void SAL_CALL startCDATA(void) throw (SAXException,RuntimeException) { } - virtual void SAL_CALL endCDATA(void) throw (SAXException,RuntimeException) + virtual void SAL_CALL endCDATA(void) throw (RuntimeException) { } - virtual void SAL_CALL comment(const OUString& sComment) throw (SAXException,RuntimeException) + virtual void SAL_CALL comment(const OUString& /* sComment */) throw (SAXException,RuntimeException) { } - virtual void SAL_CALL unknown(const OUString& sString) throw (SAXException,RuntimeException) + virtual void SAL_CALL unknown(const OUString& /* sString */) throw (SAXException,RuntimeException) { } @@ -289,13 +290,13 @@ private: struct TagAttribute { TagAttribute(){} - TagAttribute( const OUString &sName, - const OUString &sType , - const OUString &sValue ) + TagAttribute( const OUString &s_Name, + const OUString &s_Type , + const OUString &s_Value ) { - this->sName = sName; - this->sType = sType; - this->sValue = sValue; + this->sName = s_Name; + this->sType = s_Type; + this->sValue = s_Value; } OUString sName; @@ -329,7 +330,7 @@ AttributeListImpl::AttributeListImpl( const AttributeListImpl &r ) OUString AttributeListImpl::getNameByIndex(sal_Int16 i) throw (RuntimeException) { - if( i < m_pImpl->vecAttribute.size() ) { + if( i < sal::static_int_cast<sal_Int16>(m_pImpl->vecAttribute.size()) ) { return m_pImpl->vecAttribute[i].sName; } return OUString(); @@ -338,7 +339,7 @@ OUString AttributeListImpl::getNameByIndex(sal_Int16 i) throw (RuntimeException OUString AttributeListImpl::getTypeByIndex(sal_Int16 i) throw (RuntimeException) { - if( i < m_pImpl->vecAttribute.size() ) { + if( i < sal::static_int_cast<sal_Int16>(m_pImpl->vecAttribute.size()) ) { return m_pImpl->vecAttribute[i].sType; } return OUString(); @@ -346,7 +347,7 @@ OUString AttributeListImpl::getTypeByIndex(sal_Int16 i) throw (RuntimeException OUString AttributeListImpl::getValueByIndex(sal_Int16 i) throw (RuntimeException) { - if( i < m_pImpl->vecAttribute.size() ) { + if( i < sal::static_int_cast<sal_Int16>(m_pImpl->vecAttribute.size()) ) { return m_pImpl->vecAttribute[i].sValue; } return OUString(); @@ -418,11 +419,12 @@ void writeParagraphHelper( { int nMax = s.getLength(); int nStart = 0; + int n = 1; Sequence<sal_uInt16> seq( s.getLength() ); memcpy( seq.getArray() , s.getStr() , s.getLength() * sizeof( sal_uInt16 ) ); - for( int n = 1 ; n < nMax ; n++ ){ + for( n = 1 ; n < nMax ; n++ ){ if( 32 == seq.getArray()[n] ) { r->allowLineBreak(); r->characters( s.copy( nStart , n - nStart ) ); diff --git a/sax/test/testcomponent.cxx b/sax/test/testcomponent.cxx index e395add9f662..c3b3e0a77423 100644 --- a/sax/test/testcomponent.cxx +++ b/sax/test/testcomponent.cxx @@ -82,7 +82,8 @@ int main (int argc, char **argv) OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.registry.ImplementationRegistration")) ); xReg = Reference< XImplementationRegistration > ( x , UNO_QUERY ); } - catch( Exception & ) { + catch (const Exception&) + { printf( "Couldn't create ImplementationRegistration service\n" ); exit(1); } @@ -107,7 +108,8 @@ int main (int argc, char **argv) xSimpleReg ); } } - catch( Exception &e ) { + catch (const Exception &e) + { printf( "Couldn't reach dll %s\n" , szBuf ); printf( "%s\n" , OUStringToOString( e.Message , RTL_TEXTENCODING_ASCII_US ).getStr() ); @@ -134,7 +136,7 @@ int main (int argc, char **argv) aDllName, xSimpleReg ); } - catch( Exception & e ) + catch (const Exception&) { printf( "Couldn't reach dll %s\n" , szBuf ); exit(1); @@ -178,12 +180,13 @@ int main (int argc, char **argv) nNewHandle = xTest->test( OStringToOUString( argv[1] , RTL_TEXTENCODING_ASCII_US ) , x , nHandle ); } - catch( Exception & e ) { + catch (const Exception &e) + { OString o = OUStringToOString( e.Message, RTL_TEXTENCODING_ASCII_US ); printf( "testcomponent : uncaught exception %s\n" , o.getStr() ); exit(1); } - catch( ... ) + catch (...) { printf( "testcomponent : uncaught unknown exception\n" ); exit(1); @@ -195,7 +198,7 @@ int main (int argc, char **argv) Sequence<OUString> seqWarnings = xTest->getWarnings(); if( seqWarnings.getLength() > nWarningCount ) { - printf( "Warnings during test %d!\n" , nHandle ); + printf( "Warnings during test %" SAL_PRIxUINT32 "!\n" , nHandle ); for( ; nWarningCount < seqWarnings.getLength() ; nWarningCount ++ ) { OString o = OUStringToOString( @@ -206,7 +209,7 @@ int main (int argc, char **argv) if( seqErrors.getLength() > nErrorCount ) { - printf( "Errors during test %d!\n" , nHandle ); + printf( "Errors during test %" SAL_PRIxUINT32 "!\n" , nHandle ); for( ; nErrorCount < seqErrors.getLength() ; nErrorCount ++ ) { OString o = OUStringToOString( seqErrors.getArray()[nErrorCount], RTL_TEXTENCODING_ASCII_US ); diff --git a/sot/Library_sot.mk b/sot/Library_sot.mk index 79f94858a688..dc4d1912e2be 100644 --- a/sot/Library_sot.mk +++ b/sot/Library_sot.mk @@ -36,7 +36,11 @@ $(eval $(call gb_Library_set_componentfile,sot,sot/util/sot)) $(eval $(call gb_Library_set_include,sot,\ -I$(realpath $(SRCDIR)/sot/inc/pch) \ $$(INCLUDE) \ - -I$(OUTDIR)/inc/offuh \ +)) + +$(eval $(call gb_Library_add_api,sot,\ + udkapi \ + offapi \ )) $(eval $(call gb_Library_add_defs,sot,\ diff --git a/sot/inc/sot/stg.hxx b/sot/inc/sot/stg.hxx index 2d17974d0a2d..df43ca771e3c 100644 --- a/sot/inc/sot/stg.hxx +++ b/sot/inc/sot/stg.hxx @@ -262,7 +262,6 @@ protected: ~UCBStorageStream(); public: TYPEINFO(); - UCBStorageStream( const String& rName, StreamMode nMode, sal_Bool bDirect, const ByteString* pKey=0 ); UCBStorageStream( const String& rName, StreamMode nMode, sal_Bool bDirect, const ByteString* pKey, sal_Bool bRepair, ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XProgressHandler > xProgress ); UCBStorageStream( UCBStorageStream_Impl* ); diff --git a/sot/inc/sot/storage.hxx b/sot/inc/sot/storage.hxx index e1ce95158b12..9913edaaa40f 100644 --- a/sot/inc/sot/storage.hxx +++ b/sot/inc/sot/storage.hxx @@ -208,9 +208,6 @@ public: SotStorageStream * OpenSotStream( const String & rEleName, StreamMode = STREAM_STD_READWRITE, StorageMode = 0 ); - SotStorageStream * OpenEncryptedSotStream( const String & rEleName, const ByteString& rKey, - StreamMode = STREAM_STD_READWRITE, - StorageMode = 0 ); SotStorage * OpenSotStorage( const String & rEleName, StreamMode = STREAM_STD_READWRITE, StorageMode = STORAGE_TRANSACTED ); @@ -242,9 +239,6 @@ public: static sal_Bool IsOLEStorage( const String & rFileName ); static sal_Bool IsOLEStorage( SvStream* pStream ); - // this is temporary HACK, _MUST_ be removed before release - ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > - GetUNOAPIDuplicate( const String& rEleName, sal_Int32 nUNOStorageMode ); void RemoveUNOStorageHolder( UNOStorageHolder* pHolder ); static SotStorage* OpenOLEStorage( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& xStorage, diff --git a/sot/source/base/factory.cxx b/sot/source/base/factory.cxx index 01d098e62a75..79393375138d 100644 --- a/sot/source/base/factory.cxx +++ b/sot/source/base/factory.cxx @@ -39,6 +39,7 @@ #include <sot/sotdata.hxx> #include <sot/clsids.hxx> #include <rtl/instance.hxx> +#include <rtl/strbuf.hxx> /************** class SotData_Impl *********************************************/ /************************************************************************* @@ -78,9 +79,9 @@ void SotFactory::DeInit() if( pSotData->nSvObjCount ) { #ifdef DBG_UTIL - ByteString aStr( "Objects alive: " ); - aStr.Append( ByteString::CreateFromInt32( pSotData->nSvObjCount ) ); - DBG_WARNING( aStr.GetBuffer() ); + rtl::OStringBuffer aStr(RTL_CONSTASCII_STRINGPARAM("Objects alive: ")); + aStr.append(static_cast<sal_Int32>(pSotData->nSvObjCount)); + DBG_WARNING(aStr.getStr()); #endif return; } diff --git a/sot/source/sdstor/stgdir.cxx b/sot/source/sdstor/stgdir.cxx index 4951daa70a6c..fc9610a6af3b 100644 --- a/sot/source/sdstor/stgdir.cxx +++ b/sot/source/sdstor/stgdir.cxx @@ -853,7 +853,10 @@ void StgDirStrm::SetupEntry( sal_Int32 n, StgDirEntry* pUpper ) } else { - rIo.SetError( SVSTREAM_CANNOT_MAKE ); + // bnc#682484: There are some really broken docs out there + // that contain duplicate entries in 'Directory' section + // so don't set the error flag here and just skip those + // (was: rIo.SetError( SVSTREAM_CANNOT_MAKE );) delete pCur; pCur = NULL; return; } diff --git a/sot/source/sdstor/stgstrms.cxx b/sot/source/sdstor/stgstrms.cxx index fe40be155b9e..48e8de3ede6d 100644 --- a/sot/source/sdstor/stgstrms.cxx +++ b/sot/source/sdstor/stgstrms.cxx @@ -798,7 +798,7 @@ void* StgDataStrm::GetPtr( sal_Int32 Pos, sal_Bool bForce, sal_Bool bDirty ) if( Pos2Page( Pos ) ) { StgPage* pPg = rIo.Get( nPage, bForce ); - if( pPg ) + if (pPg && nOffset < pPg->GetSize()) { pPg->SetOwner( pEntry ); if( bDirty ) diff --git a/sot/source/sdstor/storage.cxx b/sot/source/sdstor/storage.cxx index ef398d081904..50a30d89b45e 100644 --- a/sot/source/sdstor/storage.cxx +++ b/sot/source/sdstor/storage.cxx @@ -744,129 +744,6 @@ void SotStorage::RemoveUNOStorageHolder( UNOStorageHolder* pHolder ) } /************************************************************************* -|* SotStorage::GetUNOAPIDuplicate() -|* -|* Beschreibung -*************************************************************************/ -uno::Reference< embed::XStorage > SotStorage::GetUNOAPIDuplicate( const String& rEleName, sal_Int32 nUNOStorageMode ) -{ - // after we create a duplicate we will register wrapper - // for storage messages, the wrapper will control the real storage - // the real storage will be able to ask the duplicate to dispose if it's parent is disposed - - uno::Reference< embed::XStorage > xResult; - - UCBStorage* pStg = PTR_CAST( UCBStorage, m_pOwnStg ); - if ( !pStg ) - return xResult; - - UNOStorageHolderList* pUNOStorageHolderList = pStg->GetUNOStorageHolderList(); - if ( !pUNOStorageHolderList ) - return xResult; - - for ( UNOStorageHolderList::iterator aIter = pUNOStorageHolderList->begin(); - aIter != pUNOStorageHolderList->end(); ++aIter ) - if ( (*aIter) && (*aIter)->GetStorageName().Equals( rEleName ) ) - { - // the storage is already in use - return xResult; - } - - if ( IsStream( rEleName ) ) - return xResult; - - if ( GetError() == ERRCODE_NONE ) - { - StreamMode nMode = ( ( nUNOStorageMode & embed::ElementModes::WRITE ) == embed::ElementModes::WRITE ) ? - STREAM_WRITE : ( STREAM_READ | STREAM_NOCREATE ); - if ( nUNOStorageMode & embed::ElementModes::NOCREATE ) - nMode |= STREAM_NOCREATE; - - sal_Bool bStorageReady = !IsStorage( rEleName ); - SotStorageRef pChildStorage = OpenUCBStorage( rEleName, nMode, STORAGE_TRANSACTED ); - if ( pChildStorage->GetError() == ERRCODE_NONE && pChildStorage->m_pOwnStg ) - { - ::utl::TempFile* pTempFile = new ::utl::TempFile(); - if ( pTempFile->GetURL().Len() ) - { - if ( !bStorageReady ) - { - UCBStorage* pChildUCBStg = PTR_CAST( UCBStorage, pChildStorage->m_pOwnStg ); - if ( pChildUCBStg ) - { - UCBStorage* pTempStorage = new UCBStorage( pTempFile->GetURL(), STREAM_WRITE, sal_False, sal_True ); - if ( pTempStorage ) - { - pChildUCBStg->CopyTo( pTempStorage ); - - // CopyTo does not transport unknown media type - // just workaround it - uno::Any aMediaType; - - if ( pChildUCBStg->GetProperty( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MediaType")), aMediaType ) ) - pTempStorage->SetProperty( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MediaType")), aMediaType ); - - bStorageReady = !pChildUCBStg->GetError() && !pTempStorage->GetError() - && pTempStorage->Commit(); - - delete ((BaseStorage*)pTempStorage); - pTempStorage = NULL; - } - } - - OSL_ENSURE( bStorageReady, "Problem on storage copy!\n" ); - } - - if ( bStorageReady ) - { - try { - uno::Reference< lang::XSingleServiceFactory > xStorageFactory( - ::comphelper::getProcessServiceFactory()->createInstance( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.embed.StorageFactory")) ), - uno::UNO_QUERY ); - - OSL_ENSURE( xStorageFactory.is(), "Can't create storage factory!\n" ); - if ( xStorageFactory.is() ) - { - uno::Sequence< uno::Any > aArg( 2 ); - aArg[0] <<= ::rtl::OUString( pTempFile->GetURL() ); - aArg[1] <<= nUNOStorageMode; - uno::Reference< embed::XStorage > xDuplStorage( - xStorageFactory->createInstanceWithArguments( aArg ), - uno::UNO_QUERY ); - - OSL_ENSURE( xDuplStorage.is(), "Can't open storage!\n" ); - if ( xDuplStorage.is() ) - { - UNOStorageHolder* pHolder = - new UNOStorageHolder( *this, *pChildStorage, xDuplStorage, pTempFile ); - pHolder->acquire(); - pTempFile = NULL; - pUNOStorageHolderList->push_back( pHolder ); - xResult = xDuplStorage; - } - } - } - catch( uno::Exception& e ) - { - (void)e; - OSL_FAIL( ::rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_ASCII_US ) ); - } - } - } - - if ( pTempFile != NULL ) - delete pTempFile; - } - else - SetError( pChildStorage->GetError() ); - } - - return xResult; -} - -/************************************************************************* |* SotStorage::CreateMemoryStream() |* |* Beschreibung @@ -1110,38 +987,6 @@ sal_Bool SotStorage::Revert() return SVSTREAM_OK == GetError(); } -/************************************************************************* -|* SotStorage::OpenStream() -|* -|* Beschreibung -*************************************************************************/ -SotStorageStream * SotStorage::OpenEncryptedSotStream( const String & rEleName, const ByteString& rKey, - StreamMode nMode, - StorageMode nStorageMode ) -{ - DBG_ASSERT( !nStorageMode, "StorageModes ignored" ); - SotStorageStream * pStm = NULL; - DBG_ASSERT( Owner(), "must be owner" ); - if( m_pOwnStg ) - { - // volle Ole-Patches einschalten - // egal was kommt, nur exclusiv gestattet - nMode |= STREAM_SHARE_DENYALL; - ErrCode nE = m_pOwnStg->GetError(); - BaseStorageStream* p = m_pOwnStg->OpenStream( rEleName, nMode, - (nStorageMode & STORAGE_TRANSACTED) ? sal_False : sal_True, &rKey ); - pStm = new SotStorageStream( p ); - - if( !nE ) - m_pOwnStg->ResetError(); // kein Fehler setzen - if( nMode & STREAM_TRUNC ) - pStm->SetSize( 0 ); - } - else - SetError( SVSTREAM_GENERALERROR ); - return pStm; -} - SotStorageStream * SotStorage::OpenSotStream( const String & rEleName, StreamMode nMode, StorageMode nStorageMode ) diff --git a/sot/source/sdstor/ucbstorage.cxx b/sot/source/sdstor/ucbstorage.cxx index 198a6572dec3..dfc5024889a3 100644 --- a/sot/source/sdstor/ucbstorage.cxx +++ b/sot/source/sdstor/ucbstorage.cxx @@ -1336,15 +1336,6 @@ void UCBStorageStream_Impl::PrepareCachedForReopen( StreamMode nMode ) } } -UCBStorageStream::UCBStorageStream( const String& rName, StreamMode nMode, sal_Bool bDirect, const ByteString* pKey ) -{ - // pImp must be initialized in the body, because otherwise the vtable of the stream is not initialized - // to class UCBStorageStream ! - pImp = new UCBStorageStream_Impl( rName, nMode, this, bDirect, pKey ); - pImp->AddRef(); // use direct refcounting because in header file only a pointer should be used - StorageBase::m_nMode = pImp->m_nMode; -} - UCBStorageStream::UCBStorageStream( const String& rName, StreamMode nMode, sal_Bool bDirect, const ByteString* pKey, sal_Bool bRepair, Reference< XProgressHandler > xProgress ) { // pImp must be initialized in the body, because otherwise the vtable of the stream is not initialized @@ -3275,7 +3266,7 @@ sal_Bool UCBStorage::IsStorageFile( SvStream* pFile ) return sal_False; pFile->Seek(0); - sal_uInt32 nBytes; + sal_uInt32 nBytes(0); *pFile >> nBytes; // search for the magic bytes @@ -3286,6 +3277,7 @@ sal_Bool UCBStorage::IsStorageFile( SvStream* pFile ) bRet = ( nBytes == 0x08074b50 ); if ( bRet ) { + nBytes = 0; *pFile >> nBytes; bRet = ( nBytes == 0x04034b50 ); } diff --git a/sot/source/unoolestorage/register.cxx b/sot/source/unoolestorage/register.cxx index 696e0cefed93..2738a8054af3 100644 --- a/sot/source/unoolestorage/register.cxx +++ b/sot/source/unoolestorage/register.cxx @@ -41,12 +41,7 @@ using namespace ::com::sun::star; extern "C" { -SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ ) -{ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} - -SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ ) +SAL_DLLPUBLIC_EXPORT void * SAL_CALL sot_component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ ) { void * pRet = 0; diff --git a/sot/util/sot.component b/sot/util/sot.component index 7d17c7d54475..44ca8cea7a9a 100644 --- a/sot/util/sot.component +++ b/sot/util/sot.component @@ -26,7 +26,7 @@ * **********************************************************************--> -<component loader="com.sun.star.loader.SharedLibrary" +<component loader="com.sun.star.loader.SharedLibrary" prefix="sot" xmlns="http://openoffice.org/2010/uno-components"> <implementation name="com.sun.star.comp.embed.OLESimpleStorage"> <service name="com.sun.star.embed.OLESimpleStorage"/> diff --git a/svl/Library_fsstorage.mk b/svl/Library_fsstorage.mk index 3e27ae8f4357..121049b9cff7 100644 --- a/svl/Library_fsstorage.mk +++ b/svl/Library_fsstorage.mk @@ -37,10 +37,14 @@ $(eval $(call gb_Library_set_include,fsstorage,\ -I$(realpath $(SRCDIR)/svl/inc/svl) \ -I$(realpath $(SRCDIR)/svl/source/inc) \ -I$(realpath $(SRCDIR)/svl/inc/pch) \ - -I$(OUTDIR)/inc/offuh \ -I$(OUTDIR)/inc \ )) +$(eval $(call gb_Library_add_api,fsstorage,\ + udkapi \ + offapi \ +)) + $(eval $(call gb_Library_add_linked_libs,fsstorage,\ comphelper \ cppu \ diff --git a/svl/Library_passwordcontainer.mk b/svl/Library_passwordcontainer.mk index 58b4b6edb6a7..3826dca597dd 100644 --- a/svl/Library_passwordcontainer.mk +++ b/svl/Library_passwordcontainer.mk @@ -37,10 +37,14 @@ $(eval $(call gb_Library_set_include,passwordcontainer,\ -I$(realpath $(SRCDIR)/svl/inc/svl) \ -I$(realpath $(SRCDIR)/svl/source/inc) \ -I$(realpath $(SRCDIR)/svl/inc/pch) \ - -I$(OUTDIR)/inc/offuh \ -I$(OUTDIR)/inc \ )) +$(eval $(call gb_Library_add_api,passwordcontainer,\ + udkapi \ + offapi \ +)) + $(eval $(call gb_Library_add_linked_libs,passwordcontainer,\ cppu \ cppuhelper \ diff --git a/svl/Library_svl.mk b/svl/Library_svl.mk index d1996dc0dc52..08988c41f681 100644 --- a/svl/Library_svl.mk +++ b/svl/Library_svl.mk @@ -37,7 +37,12 @@ $(eval $(call gb_Library_set_include,svl,\ $$(SOLARINC) \ -I$(realpath $(SRCDIR)/svl/source/inc) \ -I$(realpath $(SRCDIR)/svl/inc/pch) \ - -I$(OUTDIR)/inc/offuh \ + -I$(SRCDIR)/svl/inc/pch \ +)) + +$(eval $(call gb_Library_add_api,svl,\ + udkapi \ + offapi \ )) $(eval $(call gb_Library_add_defs,svl,\ diff --git a/svl/inc/svl/adrparse.hxx b/svl/inc/svl/adrparse.hxx index dbb671889ec3..e9f479af9e09 100644 --- a/svl/inc/svl/adrparse.hxx +++ b/svl/inc/svl/adrparse.hxx @@ -67,28 +67,6 @@ public: inline UniString const & GetEmailAddress(sal_Int32 nIndex) const; inline UniString const &GetRealName(sal_Int32 nIndex) const; - - /** Create an RFC 822 <mailbox> (i.e., 'e-mail address'). - - @param rPhrase Either an empty string (the <mailbox> will have no - <phrase> an will be of the form <addr-spec>), or some text that will - become the <phrase> part of a <phrase route-addr> form <mailbox>. Non - US-ASCII characters within the text are put into a <qouted-string> - verbatim, so the result may actually not be a valid RFC 822 <mailbox>, - but a more human-readable representation. - - @param rAddrSpec A valid RFC 822 <addr-spec>. (An RFC 822 <mailbox> - including a <route> cannot be created by this method.) - - @param rMailbox If this method returns true, this parameter returns - the created RFC 822 <mailbox> (rather, a more human-readable - representation thereof). Otherwise, this parameter is not modified. - - @return True, if rAddrSpec is a valid RFC 822 <addr-spec>. - */ - static bool createRFC822Mailbox(String const & rPhrase, - String const & rAddrSpec, - String & rMailbox); }; inline UniString const & SvAddressParser::GetEmailAddress(sal_Int32 nIndex) diff --git a/svl/inc/svl/httpcook.hxx b/svl/inc/svl/httpcook.hxx index 2d5d434592af..40bf4e408015 100644 --- a/svl/inc/svl/httpcook.hxx +++ b/svl/inc/svl/httpcook.hxx @@ -33,6 +33,7 @@ #include <tools/stream.hxx> #include <tools/string.hxx> #include <svl/poolitem.hxx> +#include <vector> /*======================================================================= * @@ -132,21 +133,28 @@ enum CntHTTPCookieRequestType CNTHTTP_COOKIE_REQUEST_SEND }; +typedef ::std::vector< CntHTTPCookie* > CntHTTPCookieList_impl; + struct CntHTTPCookieRequest { - const String& m_rURL; - List& m_rCookieList; - CntHTTPCookieRequestType m_eType; - sal_uInt16 m_nRet; + const String& m_rURL; + CntHTTPCookieList_impl& m_rCookieList; + CntHTTPCookieRequestType m_eType; + sal_uInt16 m_nRet; CntHTTPCookieRequest ( const String& rURL, - List& rCookieList, + CntHTTPCookieList_impl& rCookieList, CntHTTPCookieRequestType eType) : m_rURL (rURL), m_rCookieList (rCookieList), m_eType(eType), m_nRet (CNTHTTP_COOKIE_POLICY_BANNED) {} + ~CntHTTPCookieRequest() { + for ( size_t i = 0, n = m_rCookieList.size(); i < n; ++i ) { + delete m_rCookieList[ i ]; + } + } }; #endif // SVTOOLS_HTTPCOOK_HXX diff --git a/svl/inc/svl/ilstitem.hxx b/svl/inc/svl/ilstitem.hxx index a0527cec556c..2973c066c4d8 100644 --- a/svl/inc/svl/ilstitem.hxx +++ b/svl/inc/svl/ilstitem.hxx @@ -32,8 +32,7 @@ #include "svl/svldllapi.h" #include <svl/poolitem.hxx> #include <com/sun/star/uno/Sequence.hxx> - -class SvULongs; +#include <vector> class SVL_DLLPUBLIC SfxIntegerListItem : public SfxPoolItem { @@ -43,7 +42,8 @@ public: TYPEINFO(); SfxIntegerListItem(); - SfxIntegerListItem( sal_uInt16 nWhich, const SvULongs& rList ); + SfxIntegerListItem( sal_uInt16 nWhich, const ::std::vector < sal_Int32 >& rList ); + SfxIntegerListItem( sal_uInt16 nWhich, const ::com::sun::star::uno::Sequence < sal_Int32 >& rList ); SfxIntegerListItem( const SfxIntegerListItem& rItem ); ~SfxIntegerListItem(); @@ -52,7 +52,7 @@ public: ::com::sun::star::uno::Sequence < sal_Int32 > GetConstSequence() const { return SAL_CONST_CAST(SfxIntegerListItem *, this)->GetSequence(); } - void GetList( SvULongs& rList ) const; + void GetList( ::std::vector < sal_Int32 >& rList ) const; virtual int operator==( const SfxPoolItem& ) const; virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; diff --git a/svl/inc/svl/inettype.hxx b/svl/inc/svl/inettype.hxx index 3abe09c0e37c..f88373dd5303 100644 --- a/svl/inc/svl/inettype.hxx +++ b/svl/inc/svl/inettype.hxx @@ -352,8 +352,6 @@ enum INetContentType class SVL_DLLPUBLIC INetContentTypes { public: - static void Uninitialize(); - static INetContentType RegisterContentType(UniString const & rTypeName, UniString const & rPresentation, @@ -369,8 +367,6 @@ public: static UniString GetPresentation(INetContentType eTypeID, const ::com::sun::star::lang::Locale& aLocale); - static UniString GetExtension(UniString const & rTypeName); - static INetContentType GetContentType4Extension(UniString const & rExtension); @@ -379,40 +375,6 @@ public: static bool GetExtensionFromURL(UniString const & rURL, UniString & rExtension); - static INetContentType MapStringToContentType(UniString const & - rPresentation); - - /** Parse the body of an RFC 2045 Content-Type header field. - - @param rMediaType The body of the Content-Type header field. It must - be of the form - - token "/" token *(";" token "=" (token / quoted-string)) - - with intervening linear white space and comments (cf. RFCs 822, 2045). - The RFC 2231 extension are supported. The encoding of rMediaType - should be US-ASCII, but any values in the range 0x80--0xFF are - interpretet 'as appropriate.' - - @param rType Returns the type (the first of the above tokens), in US- - ASCII encoding and converted to lower case. - - @param rSubType Returns the sub type (the second of the above - tokens), in US-ASCII encoding and converted to lower case. - - @param rParameters If not null, returns the parameters as a list of - INetContentTypeParameters (the attributes are in US-ASCII encoding and - converted to lower case, the values are in Unicode encoding). If - null, only the syntax of the parameters is checked, but they are not - returned. - - @return True if the syntax of the field body is correct. If false is - returned, none of the output parameters will be modified! - */ - static bool parse(ByteString const & rMediaType, ByteString & rType, - ByteString & rSubType, - INetContentTypeParameterList * pParameters = 0); - /** Parse the body of an RFC 2045 Content-Type header field. @param rMediaType The body of the Content-Type header field. It must @@ -443,42 +405,6 @@ public: static bool parse(UniString const & rMediaType, UniString & rType, UniString & rSubType, INetContentTypeParameterList * pParameters = 0); - - /** Append a parameter to the string representation of a MIME media type. - - @param rMediaType The string representation of a MIME media type. - - @param rAttribute The name of the parameter. Must be a valid RFC - 2045 token. - - @param rValue The value of the paramter. Must only consist of US- - ASCII characters. - - @return The string representation of rMediaType with the new - parameter appended. It is not checked whether a parameter with that - name already existed in rMediaType. - */ - static ByteString appendUSASCIIParameter(ByteString const & rMediaType, - ByteString const & rAttribute, - ByteString const & rValue); - - /** Append a parameter to the string representation of a MIME media type. - - @param rMediaType The string representation of a MIME media type. - - @param rAttribute The name of the parameter. Must be a valid RFC - 2045 token. - - @param rValue The value of the paramter. Must only consist of US- - ASCII characters. - - @return The string representation of rMediaType with the new - parameter appended. It is not checked whether a parameter with that - name already existed in rMediaType. - */ - static UniString appendUSASCIIParameter(UniString const & rMediaType, - UniString const & rAttribute, - UniString const & rValue); }; #endif // _INETTYPE_HXX diff --git a/svl/inc/svl/itempool.hxx b/svl/inc/svl/itempool.hxx index 3cec7f75dee2..bceedeee1591 100644 --- a/svl/inc/svl/itempool.hxx +++ b/svl/inc/svl/itempool.hxx @@ -266,7 +266,6 @@ public: sal_uInt16 GetFileFormatVersion() const { return _nFileFormatVersion; } void SetFileFormatVersion( sal_uInt16 nFileFormatVersion ); - sal_uInt16 GetLoadingVersion() const; bool IsCurrentVersionLoading() const; static int IsWhich(sal_uInt16 nId) { diff --git a/svl/inc/svl/ownlist.hxx b/svl/inc/svl/ownlist.hxx index 6bb9f311119b..ea1fc3842f4d 100644 --- a/svl/inc/svl/ownlist.hxx +++ b/svl/inc/svl/ownlist.hxx @@ -61,19 +61,6 @@ public: } const String & GetCommand() const { return aCommand; } const String & GetArgument() const { return aArgument; } - - friend SvStream& operator >> ( SvStream& rStm, SvCommand & rThis ) - { - rStm.ReadByteString( rThis.aCommand, gsl_getSystemTextEncoding() ); - rStm.ReadByteString( rThis.aArgument, gsl_getSystemTextEncoding() ); - return rStm; - } - friend SvStream& operator << ( SvStream& rStm, const SvCommand & rThis ) - { - rStm.WriteByteString( rThis.aCommand, gsl_getSystemTextEncoding() ); - rStm.WriteByteString( rThis.aArgument, gsl_getSystemTextEncoding() ); - return rStm; - } }; typedef ::std::vector< SvCommand > SvCommandList_impl; @@ -98,9 +85,6 @@ public: sal_Bool FillFromSequence( const com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue >& ); void FillSequence( com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue >& ); - SVL_DLLPUBLIC friend SvStream& operator >> ( SvStream& rStm, SvCommandList & ); - SVL_DLLPUBLIC friend SvStream& operator << ( SvStream&, const SvCommandList & ); - size_t size() const { return aCommandList.size(); } SvCommand operator[]( size_t i) { diff --git a/svl/inc/svl/style.hxx b/svl/inc/svl/style.hxx index 615d5d690aba..a6f0ca59cb2d 100644 --- a/svl/inc/svl/style.hxx +++ b/svl/inc/svl/style.hxx @@ -54,7 +54,7 @@ class SvStream; /* Everyone changing instances of SfxStyleSheetBasePool or SfxStyleSheetBase -mußt broadcast this using <SfxStyleSheetBasePool::GetBroadcaster()> broadcasten. +must broadcast this using <SfxStyleSheetBasePool::GetBroadcaster()> broadcasts. The class <SfxStyleSheetHint> is used for this, it contains an Action-Id and a pointer to the <SfxStyleSheetBase>. The actions are: diff --git a/svl/inc/svl/svstdarr.hxx b/svl/inc/svl/svstdarr.hxx index 0d46662237d4..bfeeb35d1c79 100644 --- a/svl/inc/svl/svstdarr.hxx +++ b/svl/inc/svl/svstdarr.hxx @@ -93,31 +93,11 @@ SV_DECL_PTRARR_VISIBILITY( SvByteStrings, ByteStringPtr, 1, 1, SVL_DLLPUBLIC ) #define _SVSTDARR_BYTESTRINGS_DECL #endif -#ifndef _SVSTDARR_BYTESTRINGSDTOR_DECL -SV_DECL_PTRARR_DEL_VISIBILITY( SvByteStringsDtor, ByteStringPtr, 1, 1, SVL_DLLPUBLIC ) -#define _SVSTDARR_BYTESTRINGSDTOR_DECL -#endif - -#ifndef _SVSTDARR_BYTESTRINGSSORT_DECL -SV_DECL_PTRARR_SORT_VISIBILITY( SvByteStringsSort, ByteStringPtr, 1, 1, SVL_DLLPUBLIC ) -#define _SVSTDARR_BYTESTRINGSSORT_DECL -#endif - #ifndef _SVSTDARR_BYTESTRINGSSORTDTOR_DECL SV_DECL_PTRARR_SORT_DEL_VISIBILITY( SvByteStringsSortDtor, ByteStringPtr, 1, 1, SVL_DLLPUBLIC ) #define _SVSTDARR_BYTESTRINGSSORTDTOR_DECL #endif -#ifndef _SVSTDARR_BYTESTRINGSISORT_DECL -SV_DECL_PTRARR_SORT_VISIBILITY( SvByteStringsISort, ByteStringPtr, 1, 1, SVL_DLLPUBLIC ) -#define _SVSTDARR_BYTESTRINGSISORT_DECL -#endif - -#ifndef _SVSTDARR_BYTESTRINGSISORTDTOR_DECL -SV_DECL_PTRARR_SORT_DEL_VISIBILITY( SvByteStringsISortDtor, ByteStringPtr, 1, 1, SVL_DLLPUBLIC ) -#define _SVSTDARR_BYTESTRINGSISORTDTOR_DECL -#endif - typedef std::deque< xub_StrLen > SvXub_StrLens; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svl/inc/svl/urihelper.hxx b/svl/inc/svl/urihelper.hxx index 3baab37f7896..61be9f6c831d 100644 --- a/svl/inc/svl/urihelper.hxx +++ b/svl/inc/svl/urihelper.hxx @@ -42,7 +42,6 @@ namespace com { namespace sun { namespace star { namespace uri { class XUriReference; } } } } namespace rtl { class OUString; } -class ByteString; class CharClass; class UniString; @@ -64,33 +63,6 @@ namespace URIHelper { */ SVL_DLLPUBLIC UniString SmartRel2Abs(INetURLObject const & rTheBaseURIRef, - ByteString const & rTheRelURIRef, - Link const & rMaybeFileHdl = Link(), - bool bCheckFileExists = true, - bool bIgnoreFragment = false, - INetURLObject::EncodeMechanism eEncodeMechanism - = INetURLObject::WAS_ENCODED, - INetURLObject::DecodeMechanism eDecodeMechanism - = INetURLObject::DECODE_TO_IURI, - rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8, - bool bRelativeNonURIs = false, - INetURLObject::FSysStyle eStyle = INetURLObject::FSYS_DETECT); - -/** - @ATT - Calling this function with defaulted arguments rMaybeFileHdl = Link() and - bCheckFileExists = true often leads to results that are not intended: - Whenever the given rTheBaseURIRef is a file URL, the given rTheRelURIRef is - relative, and rTheRelURIRef could also be smart-parsed as a non-file URL - (e.g., the relative URL "foo/bar" can be smart-parsed as "http://foo/bar"), - then SmartRel2Abs called with rMaybeFileHdl = Link() and bCheckFileExists = - true returns the non-file URL interpretation. To avoid this, either pass - some non-null rMaybeFileHdl if you want to check generated file URLs for - existence (see URIHelper::GetMaybeFileHdl), or use bCheckFileExists = false - if you want to generate file URLs without checking for their existence. -*/ -SVL_DLLPUBLIC UniString -SmartRel2Abs(INetURLObject const & rTheBaseURIRef, UniString const & rTheRelURIRef, Link const & rMaybeFileHdl = Link(), bool bCheckFileExists = true, @@ -205,32 +177,6 @@ removePassword(UniString const & rURI, INetURLObject::DecodeMechanism eDecodeMechanism = INetURLObject::DECODE_TO_IURI, rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8); - -//============================================================================ -/** Query the notational conventions used in the file system provided by some - file content provider. - - @param rFileUrl This file URL determines which file content provider is - used to query the desired information. (The UCB's usual mapping from URLs - to content providers is used.) - - @param bAddConvenienceStyles If true, the return value contains not only - the style bit corresponding to the queried content provider's conventions, - but may also contain additional style bits that make using this function - more convenient in certain situations. Currently, the effect is that - FSYS_UNX is extended with FSYS_VOS, and both FSYS_DOS and FSYS_MAC are - extended with FSYS_VOS and FSYS_UNX (i.e., the---unambiguous---detection - of VOS style and Unix style file system paths is always enabled); also, in - case the content provider's conventions cannot be determined, FSYS_DETECT - is returned instead of FSysStyle(0). - - @return The style bit corresponding to the queried content provider's - conventions, or FSysStyle(0) if these cannot be determined. - */ -SVL_DLLPUBLIC INetURLObject::FSysStyle queryFSysStyle(UniString const & rFileUrl, - bool bAddConvenienceStyles = true) - throw (com::sun::star::uno::RuntimeException); - } #endif // SVTOOLS_URIHELPER_HXX diff --git a/svl/prj/build.lst b/svl/prj/build.lst index 67366a6aee68..5fc7d0e223a3 100644 --- a/svl/prj/build.lst +++ b/svl/prj/build.lst @@ -1,3 +1,3 @@ -sl svl : TRANSLATIONS:translations rsc offuh ucbhelper unotools cppu cppuhelper comphelper sal sot LIBXSLT:libxslt NULL +sl svl : TRANSLATIONS:translations DESKTOP:rsc offapi ucbhelper unotools cppu cppuhelper comphelper sal sot LIBXSLT:libxslt NULL sl svl\prj nmake - all svl_prj NULL # sl svl\qa\unit nmake - all svl_qa_cppunit svl_util NULL diff --git a/svl/qa/complex/ConfigItems/helper/ConfigItemTest.cxx b/svl/qa/complex/ConfigItems/helper/ConfigItemTest.cxx index 3172fd9322d6..a287fa499886 100644 --- a/svl/qa/complex/ConfigItems/helper/ConfigItemTest.cxx +++ b/svl/qa/complex/ConfigItems/helper/ConfigItemTest.cxx @@ -222,13 +222,6 @@ static ::cppu::ImplementationEntry const lRegEntries[] = }; //============================================================================= -extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment(const char** pEnvTypeName, - uno_Environment** ) -{ - *pEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} - -//============================================================================= extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(const char* sImplName , void* pServiceManager, void* pRegistryKey ) diff --git a/svl/source/fsstor/fsfactory.cxx b/svl/source/fsstor/fsfactory.cxx index a641a5d80c04..61a8f7f15048 100644 --- a/svl/source/fsstor/fsfactory.cxx +++ b/svl/source/fsstor/fsfactory.cxx @@ -235,13 +235,7 @@ uno::Sequence< ::rtl::OUString > SAL_CALL FSStorageFactory::getSupportedServiceN extern "C" { -SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment ( - const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */) -{ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} - -SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory ( +SAL_DLLPUBLIC_EXPORT void * SAL_CALL fsstorage_component_getFactory ( const sal_Char * pImplementationName, void * pServiceManager, void * /* pRegistryKey */) { void * pResult = 0; diff --git a/svl/source/fsstor/fsstorage.component b/svl/source/fsstor/fsstorage.component index 3ef0be825972..f9f08487b8a5 100644 --- a/svl/source/fsstor/fsstorage.component +++ b/svl/source/fsstor/fsstorage.component @@ -26,7 +26,7 @@ * **********************************************************************--> -<component loader="com.sun.star.loader.SharedLibrary" +<component loader="com.sun.star.loader.SharedLibrary" prefix="fsstorage" xmlns="http://openoffice.org/2010/uno-components"> <implementation name="com.sun.star.comp.embed.FileSystemStorageFactory"> <service name="com.sun.star.comp.embed.FileSystemStorageFactory"/> diff --git a/svl/source/items/ilstitem.cxx b/svl/source/items/ilstitem.cxx index f8d575b52175..dbf8825e90ba 100644 --- a/svl/source/items/ilstitem.cxx +++ b/svl/source/items/ilstitem.cxx @@ -35,20 +35,25 @@ #include <svl/ilstitem.hxx> -#define _SVSTDARR_ULONGS -#include <svl/svstdarr.hxx> - TYPEINIT1_AUTOFACTORY(SfxIntegerListItem, SfxPoolItem); SfxIntegerListItem::SfxIntegerListItem() { } -SfxIntegerListItem::SfxIntegerListItem( sal_uInt16 which, const SvULongs& rList ) +SfxIntegerListItem::SfxIntegerListItem( sal_uInt16 which, const ::std::vector < sal_Int32 >& rList ) + : SfxPoolItem( which ) +{ + m_aList.realloc( rList.size() ); + for ( sal_uInt16 n=0; n<rList.size(); ++n ) + m_aList[n] = rList[n]; +} + +SfxIntegerListItem::SfxIntegerListItem( sal_uInt16 which, const ::com::sun::star::uno::Sequence < sal_Int32 >& rList ) : SfxPoolItem( which ) { - m_aList.realloc( rList.Count() ); - for ( sal_uInt16 n=0; n<rList.Count(); n++ ) + m_aList.realloc( rList.getLength() ); + for ( sal_Int32 n=0; n<rList.getLength(); ++n ) m_aList[n] = rList[n]; } @@ -97,10 +102,11 @@ bool SfxIntegerListItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 ) return true; } -void SfxIntegerListItem::GetList( SvULongs& rList ) const +void SfxIntegerListItem::GetList( ::std::vector< sal_Int32 >& rList ) const { - for ( sal_Int32 n=0; n<m_aList.getLength(); n++ ) - rList.Insert( m_aList[n], sal::static_int_cast< sal_uInt16 >(n) ); + rList.reserve( m_aList.getLength() ); + for ( sal_Int32 n=0; n<m_aList.getLength(); ++n ) + rList.push_back( m_aList[n] ); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svl/source/items/poolio.cxx b/svl/source/items/poolio.cxx index d75560f5a26d..4811340af938 100644 --- a/svl/source/items/poolio.cxx +++ b/svl/source/items/poolio.cxx @@ -1324,7 +1324,6 @@ void SfxItemPool::SetVersionMap <SfxItemPool::IsLoadingVersionCurrent()const> <SfxItemPool::GetNewWhich(sal_uInt16)> <SfxItemPool::GetVersion()const> - <SfxItemPool::GetLoadingVersion()const> */ { @@ -1381,7 +1380,6 @@ sal_uInt16 SfxItemPool::GetNewWhich <SfxItemPool::IsLoadingVersionCurrent()const> <SfxItemPool::SetVersionMap(sal_uInt16,sal_uInt16,sal_uInt16,sal_uInt16*)> <SfxItemPool::GetVersion()const> - <SfxItemPool::GetLoadingVersion()const> */ { @@ -1470,7 +1468,6 @@ bool SfxItemPool::IsCurrentVersionLoading() const <SfxItemPool::SetVersionMap(sal_uInt16,sal_uInt16,sal_uInt16,sal_uInt16*)> <SfxItemPool::GetNewWhich(sal_uInt16)const> <SfxItemPool::GetVersion()const> - <SfxItemPool::GetLoadingVersion()const> */ { @@ -1503,7 +1500,6 @@ sal_uInt16 SfxItemPool::GetVersion() const <SfxItemPool::IsLoadingVersionCurrent()const> <SfxItemPool::SetVersionMap(sal_uInt16,sal_uInt16,sal_uInt16,sal_uInt16*)> <SfxItemPool::GetNewWhich(sal_uInt16)const> - <SfxItemPool::GetLoadingVersion()const> */ { @@ -1512,36 +1508,6 @@ sal_uInt16 SfxItemPool::GetVersion() const // ----------------------------------------------------------------------- -sal_uInt16 SfxItemPool::GetLoadingVersion() const - -/* [Beschreibung] - - Diese Methode liefert die Versionsnummer des SfxItemPool-Aufbaus - (also des Which-Bereichs), die bei Laden vorgefunden wurde. - - Precondition: Pool mu\s geladen sein - Postcondition: unver"andert - Laufzeit: 2 - - - [Anmerkung] - - Achtung: Es mu\s ggf. die Versionsnummer von Sekund"arpools - ber"ucksichtigt werden. - - - [Querverweise] - - <SfxItemPool::IsLoadingVersionCurrent()const> - <SfxItemPool::SetVersionMap(sal_uInt16,sal_uInt16,sal_uInt16,sal_uInt16*)> - <SfxItemPool::GetNewWhich(sal_uInt16)const> - <SfxItemPool::GetVersion()const> -*/ - -{ - return pImp->nLoadingVersion; -} - //------------------------------------------------------------------------- bool SfxItemPool::IsVer2_Impl() const diff --git a/svl/source/items/style.cxx b/svl/source/items/style.cxx index 815247cb4724..2bfbfc40b269 100644 --- a/svl/source/items/style.cxx +++ b/svl/source/items/style.cxx @@ -1153,8 +1153,8 @@ sal_Bool SfxStyleSheetBasePool::Store( SvStream& rStream, sal_Bool bUsed ) sal_uInt16 nInsPos, nAdd = aSortConvNames.Count(); while( !aSortConvNames.Insert( pConvName, nInsPos ) ) - (pConvName->Append( '_' )).Append( - ByteString::CreateFromInt32( nAdd++ )); + (pConvName->Append( '_' )).Append(ByteString( + rtl::OString::valueOf(static_cast<sal_Int32>(nAdd++)))); aOrigNames.Insert( pName, nInsPos ); } } diff --git a/svl/source/items/whassert.hxx b/svl/source/items/whassert.hxx index 0fa492b19443..379d4794458d 100644 --- a/svl/source/items/whassert.hxx +++ b/svl/source/items/whassert.hxx @@ -29,7 +29,7 @@ #define _SFX_WHASSERT_HXX #include <tools/debug.hxx> -#include <tools/string.hxx> +#include <rtl/strbuf.hxx> //------------------------------------------------------------------------ @@ -40,10 +40,10 @@ { \ if ( !(bCondition) ) \ { \ - ByteString aMsg( sMessage ); \ - aMsg.Append(RTL_CONSTASCII_STRINGPARAM("\nwith Id/Pos: ")); \ - aMsg += ByteString::CreateFromInt32( nId ); \ - DbgError( aMsg.GetBuffer(), __FILE__, __LINE__); \ + rtl::OStringBuffer aMsg(sMessage); \ + aMsg.append(RTL_CONSTASCII_STRINGPARAM("\nwith Id/Pos: ")); \ + aMsg.append(static_cast<sal_Int32>(nId)); \ + DbgError(aMsg.getStr(), __FILE__, __LINE__); \ } \ } \ } diff --git a/svl/source/memtools/svarray.cxx b/svl/source/memtools/svarray.cxx index 43eb637ae991..4032800e0a8b 100644 --- a/svl/source/memtools/svarray.cxx +++ b/svl/source/memtools/svarray.cxx @@ -71,12 +71,8 @@ SV_IMPL_OP_PTRARR_SORT( SvStringsSort, StringPtr ) SV_IMPL_OP_PTRARR_SORT( SvStringsSortDtor, StringPtr ) SV_IMPL_PTRARR( SvByteStrings, ByteStringPtr ) -SV_IMPL_PTRARR( SvByteStringsDtor, ByteStringPtr ) -SV_IMPL_OP_PTRARR_SORT( SvByteStringsSort, ByteStringPtr ) SV_IMPL_OP_PTRARR_SORT( SvByteStringsSortDtor, ByteStringPtr ) - - // ---------------- strings ------------------------------------- // Array mit anderer Seek-Methode! @@ -171,97 +167,4 @@ sal_Bool SvStringsISortDtor::Seek_Entry( const StringPtr aE, sal_uInt16* pP ) co return sal_False; } -// ---------------- bytestrings ------------------------------------- - -// Array mit anderer Seek-Methode! -_SV_IMPL_SORTAR_ALG( SvByteStringsISort, ByteStringPtr ) -void SvByteStringsISort::DeleteAndDestroy( sal_uInt16 nP, sal_uInt16 nL ) -{ - if( nL ) - { - DBG_ASSERT( nP < nA && nP + nL <= nA, "ERR_VAR_DEL" ); - for( sal_uInt16 n=nP; n < nP + nL; n++ ) - delete *((ByteStringPtr*)pData+n); - SvPtrarr::Remove( nP, nL ); - } -} -sal_Bool SvByteStringsISort::Seek_Entry( const ByteStringPtr aE, sal_uInt16* pP ) const -{ - register sal_uInt16 nO = SvByteStringsISort_SAR::Count(), - nM, - nU = 0; - if( nO > 0 ) - { - nO--; - while( nU <= nO ) - { - nM = nU + ( nO - nU ) / 2; - StringCompare eCmp = (*((ByteStringPtr*)pData + nM))-> - CompareIgnoreCaseToAscii( *(aE) ); - if( COMPARE_EQUAL == eCmp ) - { - if( pP ) *pP = nM; - return sal_True; - } - else if( COMPARE_LESS == eCmp ) - nU = nM + 1; - else if( nM == 0 ) - { - if( pP ) *pP = nU; - return sal_False; - } - else - nO = nM - 1; - } - } - if( pP ) *pP = nU; - return sal_False; -} - - -// Array mit anderer Seek-Methode! -_SV_IMPL_SORTAR_ALG( SvByteStringsISortDtor, ByteStringPtr ) -void SvByteStringsISortDtor::DeleteAndDestroy( sal_uInt16 nP, sal_uInt16 nL ) -{ - if( nL ) - { - DBG_ASSERT( nP < nA && nP + nL <= nA, "ERR_VAR_DEL" ); - for( sal_uInt16 n=nP; n < nP + nL; n++ ) - delete *((ByteStringPtr*)pData+n); - SvPtrarr::Remove( nP, nL ); - } -} -sal_Bool SvByteStringsISortDtor::Seek_Entry( const ByteStringPtr aE, sal_uInt16* pP ) const -{ - register sal_uInt16 nO = SvByteStringsISortDtor_SAR::Count(), - nM, - nU = 0; - if( nO > 0 ) - { - nO--; - while( nU <= nO ) - { - nM = nU + ( nO - nU ) / 2; - StringCompare eCmp = (*((ByteStringPtr*)pData + nM))-> - CompareIgnoreCaseToAscii( *(aE) ); - if( COMPARE_EQUAL == eCmp ) - { - if( pP ) *pP = nM; - return sal_True; - } - else if( COMPARE_LESS == eCmp ) - nU = nM + 1; - else if( nM == 0 ) - { - if( pP ) *pP = nU; - return sal_False; - } - else - nO = nM - 1; - } - } - if( pP ) *pP = nU; - return sal_False; -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svl/source/misc/adrparse.cxx b/svl/source/misc/adrparse.cxx index e0087aa5220d..b6aa9d9e6ff2 100644 --- a/svl/source/misc/adrparse.cxx +++ b/svl/source/misc/adrparse.cxx @@ -780,142 +780,4 @@ SvAddressParser::~SvAddressParser() m_aRest.clear(); } -//============================================================================ -// static -bool SvAddressParser::createRFC822Mailbox(String const & rPhrase, - String const & rAddrSpec, - String & rMailbox) -{ - String aTheAddrSpec; - sal_Unicode const * p = rAddrSpec.GetBuffer(); - sal_Unicode const * pEnd = p + rAddrSpec.Len(); - {for (bool bSegment = false;;) - { - p = INetMIME::skipLinearWhiteSpaceComment(p, pEnd); - if (p == pEnd) - return false; - if (bSegment) - { - sal_Unicode c = *p++; - if (c == '@') - break; - else if (c != '.') - return false; - aTheAddrSpec += '.'; - p = INetMIME::skipLinearWhiteSpaceComment(p, pEnd); - if (p == pEnd) - return false; - } - else - bSegment = true; - if (*p == '"') - { - aTheAddrSpec += *p++; - for (;;) - { - if (INetMIME::startsWithLineFolding(p, pEnd)) - p += 2; - if (p == pEnd) - return false; - if (*p == '"') - break; - if (*p == '\x0D' || (*p == '\\' && ++p == pEnd) - || !INetMIME::isUSASCII(*p)) - return false; - if (INetMIME::needsQuotedStringEscape(*p)) - aTheAddrSpec += '\\'; - aTheAddrSpec += *p++; - } - aTheAddrSpec += *p++; - } - else if (INetMIME::isAtomChar(*p)) - while (p != pEnd && INetMIME::isAtomChar(*p)) - aTheAddrSpec += *p++; - else - return false; - }} - aTheAddrSpec += '@'; - {for (bool bSegment = false;;) - { - p = INetMIME::skipLinearWhiteSpaceComment(p, pEnd); - if (p == pEnd) - { - if (bSegment) - break; - else - return false; - } - if (bSegment) - { - if (*p++ != '.') - return false; - aTheAddrSpec += '.'; - p = INetMIME::skipLinearWhiteSpaceComment(p, pEnd); - if (p == pEnd) - return false; - } - else - bSegment = true; - if (*p == '[') - { - aTheAddrSpec += *p++; - for (;;) - { - if (INetMIME::startsWithLineFolding(p, pEnd)) - p += 2; - if (p == pEnd) - return false; - if (*p == ']') - break; - if (*p == '\x0D' || *p == '[' || (*p == '\\' && ++p == pEnd) - || !INetMIME::isUSASCII(*p)) - return false; - if (*p >= '[' && *p <= ']') - aTheAddrSpec += '\\'; - aTheAddrSpec += *p++; - } - aTheAddrSpec += *p++; - } - else if (INetMIME::isAtomChar(*p)) - while (p != pEnd && INetMIME::isAtomChar(*p)) - aTheAddrSpec += *p++; - else - return false; - }} - - if (rPhrase.Len() == 0) - rMailbox = aTheAddrSpec; - else - { - bool bQuotedString = false; - p = rPhrase.GetBuffer(); - pEnd = p + rPhrase.Len(); - for (;p != pEnd; ++p) - if (!(INetMIME::isAtomChar(*p))) - { - bQuotedString = true; - break; - } - String aTheMailbox; - if (bQuotedString) - { - aTheMailbox = '"'; - for (p = rPhrase.GetBuffer(); p != pEnd; ++p) - { - if (INetMIME::needsQuotedStringEscape(*p)) - aTheMailbox += '\\'; - aTheMailbox += *p; - } - aTheMailbox += '"'; - } - else - aTheMailbox = rPhrase; - aTheMailbox.AppendAscii(RTL_CONSTASCII_STRINGPARAM(" <")); - aTheMailbox += aTheAddrSpec; - aTheMailbox += '>'; - rMailbox = aTheMailbox; - } - return true; -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svl/source/misc/inethist.cxx b/svl/source/misc/inethist.cxx index eba1e4083d38..c52c03cf6cef 100644 --- a/svl/source/misc/inethist.cxx +++ b/svl/source/misc/inethist.cxx @@ -156,9 +156,6 @@ class INetURLHistory_Impl */ void initialize (void); - void downheap (hash_entry a[], sal_uInt16 n, sal_uInt16 k); - void heapsort (hash_entry a[], sal_uInt16 n); - /** capacity. */ sal_uInt16 capacity (void) const @@ -258,42 +255,6 @@ void INetURLHistory_Impl::initialize (void) } /* - * downheap. - */ -void INetURLHistory_Impl::downheap (hash_entry a[], sal_uInt16 n, sal_uInt16 k) -{ - hash_entry h = a[k]; - while (k < n / 2) - { - sal_uInt16 i = k + k + 1; - if (((i + 1) < n) && (a[i] < a[i + 1])) i++; - if (!(h < a[i])) break; - a[k] = a[i]; - k = i; - } - a[k] = h; -} - -/* - * heapsort. - */ -void INetURLHistory_Impl::heapsort (hash_entry a[], sal_uInt16 n) -{ - hash_entry h; - - for (sal_uInt16 k = (n - 1) / 2 + 1; k > 0; k--) - downheap (a, n, k - 1); - - while (n > 0) - { - h = a[0 ]; - a[0 ] = a[n - 1]; - a[n - 1] = h; - downheap (a, --n, 0); - } -} - -/* * find. */ sal_uInt16 INetURLHistory_Impl::find (sal_uInt32 nHash) const diff --git a/svl/source/misc/inettype.cxx b/svl/source/misc/inettype.cxx index cb16349ab487..6234bc0dbe02 100644 --- a/svl/source/misc/inettype.cxx +++ b/svl/source/misc/inettype.cxx @@ -116,8 +116,6 @@ public: static UniString GetPresentation(INetContentType eTypeID); - static UniString GetExtension(const UniString & rTypeName); - static INetContentType GetContentType4Extension(UniString const & rExtension); @@ -768,24 +766,6 @@ UniString Registration::GetPresentation(INetContentType eTypeID) //============================================================================ // static -UniString Registration::GetExtension(UniString const & rTypeName) -{ - if (!m_pRegistration) - m_pRegistration = new Registration; - - UniString aTheTypeName = rTypeName; - aTheTypeName.ToLowerAscii(); - sal_uInt16 nPos; - return m_pRegistration->m_aTypeNameMap.Seek_Entry(&aTheTypeName, &nPos) ? - static_cast< TypeNameMapEntry * >(m_pRegistration-> - m_aTypeNameMap. - GetObject(nPos))-> - m_aExtension : - UniString(); -} - -//============================================================================ -// static INetContentType Registration::GetContentType4Extension(UniString const & rExtension) { @@ -848,19 +828,6 @@ MediaTypeEntry const * seekEntry(UniString const & rTypeName, } -//============================================================================ -// -// INetContentTypes -// -//============================================================================ - -//static -void INetContentTypes::Uninitialize() -{ - Registration::deinitialize(); -} - -//============================================================================ //static INetContentType INetContentTypes::RegisterContentType(UniString const & rTypeName, @@ -970,25 +937,6 @@ UniString INetContentTypes::GetPresentation(INetContentType eTypeID, //============================================================================ //static -UniString INetContentTypes::GetExtension(UniString const & rTypeName) -{ - MediaTypeEntry const * pEntry = seekEntry(rTypeName, aStaticTypeNameMap, - CONTENT_TYPE_LAST + 1); - if (pEntry) - return UniString::CreateFromAscii(pEntry->m_pExtension); - - UniString aExtension = Registration::GetExtension(rTypeName); - if (aExtension.Len() != 0) - return aExtension; - // special handling of text types, which come in uncounted variations: - return rTypeName.EqualsIgnoreCaseAscii("text", 0, - RTL_CONSTASCII_LENGTH("text")) ? - UniString::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("txt")) : - UniString::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("tmp")); -} - -//============================================================================ -//static INetContentType INetContentTypes::GetContentType4Extension(UniString const & rExtension) { @@ -1136,63 +1084,6 @@ bool INetContentTypes::GetExtensionFromURL(UniString const & rURL, } //============================================================================ -//static -INetContentType INetContentTypes::MapStringToContentType(UniString const & - rPresentation) -{ - MediaTypeEntry const * pEntry = seekEntry(rPresentation, - aStaticPresentationMap, - sizeof aStaticPresentationMap - / sizeof (MediaTypeEntry)); - return pEntry ? pEntry->m_eTypeID : CONTENT_TYPE_UNKNOWN; -} - -//============================================================================ -// static -bool INetContentTypes::parse(ByteString const & rMediaType, - ByteString & rType, ByteString & rSubType, - INetContentTypeParameterList * pParameters) -{ - sal_Char const * p = rMediaType.GetBuffer(); - sal_Char const * pEnd = p + rMediaType.Len(); - - p = INetMIME::skipLinearWhiteSpaceComment(p, pEnd); - sal_Char const * pToken = p; - bool bDowncase = false; - while (p != pEnd && INetMIME::isTokenChar(*p)) - { - bDowncase = bDowncase || INetMIME::isUpperCase(*p); - ++p; - } - if (p == pToken) - return false; - rType = ByteString(pToken, sal::static_int_cast< xub_StrLen >(p - pToken)); - if (bDowncase) - rType.ToLowerAscii(); - - p = INetMIME::skipLinearWhiteSpaceComment(p, pEnd); - if (p == pEnd || *p++ != '/') - return false; - - p = INetMIME::skipLinearWhiteSpaceComment(p, pEnd); - pToken = p; - bDowncase = false; - while (p != pEnd && INetMIME::isTokenChar(*p)) - { - bDowncase = bDowncase || INetMIME::isUpperCase(*p); - ++p; - } - if (p == pToken) - return false; - rSubType = ByteString( - pToken, sal::static_int_cast< xub_StrLen >(p - pToken)); - if (bDowncase) - rSubType.ToLowerAscii(); - - return INetMIME::scanParameters(p, pEnd, pParameters) == pEnd; -} - -//============================================================================ // static bool INetContentTypes::parse(UniString const & rMediaType, UniString & rType, UniString & rSubType, @@ -1237,116 +1128,4 @@ bool INetContentTypes::parse(UniString const & rMediaType, return INetMIME::scanParameters(p, pEnd, pParameters) == pEnd; } -//============================================================================ -// static -ByteString INetContentTypes::appendUSASCIIParameter(ByteString const & - rMediaType, - ByteString const & - rAttribute, - ByteString const & rValue) -{ - ByteString aResult = rMediaType; - aResult.Append(RTL_CONSTASCII_STRINGPARAM("; ")); - aResult += rAttribute; - aResult += '='; - bool bQuote = false; - for (xub_StrLen i = 0; i < rValue.Len(); ++i) - { - // When the value contains any ' characters, use a quoted string - // instead of a token, in order to avoid confusion with RFC 2231 - // extensions: - sal_uInt32 nChar = sal_uChar(rValue.GetChar(i)); - DBG_ASSERT(INetMIME::isUSASCII(nChar), - "INetContentTypes::appendUSASCIIParameter(): Bad value"); - if (!INetMIME::isTokenChar(nChar) || nChar == '\'') - { - bQuote = true; - break; - } - } - if (bQuote) - { - aResult += '"'; - for (xub_StrLen i = 0; i < rValue.Len(); ++i) - { - // Escape LF as well as CR to avoid confusion with line folding: - sal_uInt32 nChar = sal_uChar(rValue.GetChar(i)); - DBG_ASSERT(INetMIME::isUSASCII(nChar), - "INetContentTypes::appendUSASCIIParameter():" - " Bad value"); - switch (nChar) - { - case 0x0A: // LF - case 0x0D: // CR - case '"': - case '\\': - aResult += '\\'; - default: - aResult += static_cast< char >(nChar); - break; - } - } - aResult += '"'; - } - else - aResult += rValue; - return aResult; -} - -//============================================================================ -// static -UniString INetContentTypes::appendUSASCIIParameter(UniString const & - rMediaType, - UniString const & - rAttribute, - UniString const & rValue) -{ - UniString aResult = rMediaType; - aResult.AppendAscii(RTL_CONSTASCII_STRINGPARAM("; ")); - aResult += rAttribute; - aResult += '='; - bool bQuote = false; - for (xub_StrLen i = 0; i < rValue.Len(); ++i) - { - // When the value contains any ' characters, use a quoted string - // instead of a token, in order to avoid confusion with RFC 2231 - // extensions: - sal_uInt32 nChar = rValue.GetChar(i); - DBG_ASSERT(INetMIME::isUSASCII(nChar), - "INetContentTypes::appendUSASCIIParameter(): Bad value"); - if (!INetMIME::isTokenChar(nChar) || nChar == '\'') - { - bQuote = true; - break; - } - } - if (bQuote) - { - aResult += '"'; - for (xub_StrLen i = 0; i < rValue.Len(); ++i) - { - // Escape LF as well as CR to avoid confusion with line folding: - sal_uInt32 nChar = rValue.GetChar(i); - DBG_ASSERT(INetMIME::isUSASCII(nChar), - "INetContentTypes::appendUSASCIIParameter():" - " Bad value"); - switch (nChar) - { - case 0x0A: // LF - case 0x0D: // CR - case '"': - case '\\': - aResult += '\\'; - default: - aResult += sal_Unicode(nChar); - break; - } - } - aResult += '"'; - } - else - aResult += rValue; - return aResult; -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svl/source/misc/ownlist.cxx b/svl/source/misc/ownlist.cxx index 0e3fae02ff8e..bb018ba85782 100644 --- a/svl/source/misc/ownlist.cxx +++ b/svl/source/misc/ownlist.cxx @@ -166,64 +166,6 @@ SvCommand & SvCommandList::Append return aCommandList.back(); } -//========================================================================= -SvStream & operator >> -( - SvStream & rStm, /* Stream aus dem gelesen wird */ - SvCommandList & rThis /* Die zu f"ullende Liste */ -) -/* [Beschreibung] - - Die Liste mit ihren Elementen wird gelesen. Das Format ist: - 1. Anzahl der Elemente - 2. Alle Elemente - - [R"uckgabewert] - - SvStream & Der "ubergebene Stream. -*/ -{ - sal_uInt32 nCount = 0; - rStm >> nCount; - if( !rStm.GetError() ) - { - while( nCount-- ) - { - SvCommand aCmd; - rStm >> aCmd; - rThis.aCommandList.push_back( aCmd ); - } - } - return rStm; -} - -//========================================================================= -SvStream & operator << -( - SvStream & rStm, /* Stream in den geschrieben wird */ - const SvCommandList & rThis /* Die zu schreibende Liste */ -) -/* [Beschreibung] - - Die Liste mit ihren Elementen wir geschrieben. Das Format ist: - 1. Anzahl der Elemente - 2. Alle Elemente - - [R"uckgabewert] - - SvStream & Der "ubergebene Stream. -*/ -{ - sal_uInt32 nCount = rThis.aCommandList.size(); - rStm << nCount; - - for( sal_uInt32 i = 0; i < nCount; i++ ) - { - rStm << rThis.aCommandList[ i ]; - } - return rStm; -} - sal_Bool SvCommandList::FillFromSequence( const com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue >& aCommandSequence ) { const sal_Int32 nCount = aCommandSequence.getLength(); diff --git a/svl/source/misc/strmadpt.cxx b/svl/source/misc/strmadpt.cxx index d7905f470290..79adbb551d02 100644 --- a/svl/source/misc/strmadpt.cxx +++ b/svl/source/misc/strmadpt.cxx @@ -178,7 +178,7 @@ ErrCode SvOutputStreamOpenLockBytes::Flush() const { m_xOutputStream->flush(); } - catch (io::IOException) + catch (const io::IOException&) { return ERRCODE_IO_CANTWRITE; } @@ -223,7 +223,7 @@ ErrCode SvOutputStreamOpenLockBytes::FillAppend(void const * pBuffer, writeBytes(uno::Sequence< sal_Int8 >( static_cast< sal_Int8 const * >(pBuffer), nCount)); } - catch (io::IOException) + catch (const io::IOException&) { return ERRCODE_IO_CANTWRITE; } @@ -252,11 +252,15 @@ sal_uLong SvOutputStreamOpenLockBytes::Seek(sal_uLong) void SvOutputStreamOpenLockBytes::Terminate() { if (m_xOutputStream.is()) + { try { m_xOutputStream->closeOutput(); } - catch (io::IOException) {} + catch (const io::IOException&) + { + } + } } //============================================================================ @@ -492,7 +496,7 @@ sal_uLong SvInputStream::GetData(void * pData, sal_uLong nSize) { m_xSeekable->seek(m_nSeekedFrom); } - catch (io::IOException) + catch (const io::IOException&) { SetError(ERRCODE_IO_CANTREAD); return 0; @@ -513,7 +517,7 @@ sal_uLong SvInputStream::GetData(void * pData, sal_uLong nSize) { nCount = m_xStream->readBytes(aBuffer, nRemain); } - catch (io::IOException) + catch (const io::IOException&) { SetError(ERRCODE_IO_CANTREAD); return nRead; @@ -550,7 +554,7 @@ sal_uLong SvInputStream::GetData(void * pData, sal_uLong nSize) { nCount = m_xStream->readBytes(aBuffer, nRemain); } - catch (io::IOException) + catch (const io::IOException&) { SetError(ERRCODE_IO_CANTREAD); break; @@ -604,7 +608,9 @@ sal_uLong SvInputStream::SeekPos(sal_uLong nPos) return sal_uLong(nLength); } } - catch (io::IOException) {} + catch (const io::IOException&) + { + } else return Tell(); //@@@ } @@ -617,13 +623,17 @@ sal_uLong SvInputStream::SeekPos(sal_uLong nPos) return nPos; } else if (m_xSeekable.is()) + { try { m_xSeekable->seek(nPos); m_nSeekedFrom = STREAM_SEEK_TO_END; return nPos; } - catch (io::IOException) {} + catch (const io::IOException&) + { + } + } else if (m_pPipe->setReadPosition(nPos) == SvDataPipe_Impl::SEEK_OK) { m_nSeekedFrom = STREAM_SEEK_TO_END; @@ -658,11 +668,15 @@ SvInputStream::SvInputStream( SvInputStream::~SvInputStream() { if (m_xStream.is()) + { try { m_xStream->closeInput(); } - catch (io::IOException) {} + catch (const io::IOException&) + { + } + } delete m_pPipe; } @@ -727,7 +741,7 @@ sal_uLong SvOutputStream::PutData(void const * pData, sal_uLong nSize) + nWritten, nRemain)); } - catch (io::IOException) + catch (const io::IOException&) { SetError(ERRCODE_IO_CANTWRITE); break; @@ -758,7 +772,9 @@ void SvOutputStream::FlushData() { m_xStream->flush(); } - catch (io::IOException) {} + catch (const io::IOException&) + { + } } //============================================================================ @@ -781,11 +797,15 @@ SvOutputStream::SvOutputStream(uno::Reference< io::XOutputStream > const & SvOutputStream::~SvOutputStream() { if (m_xStream.is()) + { try { m_xStream->closeOutput(); } - catch (io::IOException) {} + catch (const io::IOException&) + { + } + } } //============================================================================ diff --git a/svl/source/misc/urihelper.cxx b/svl/source/misc/urihelper.cxx index ac70f8a6e467..1bef290f3dfd 100644 --- a/svl/source/misc/urihelper.cxx +++ b/svl/source/misc/urihelper.cxx @@ -65,10 +65,6 @@ #include <unotools/charclass.hxx> #include "rtl/instance.hxx" -namespace unnamed_svl_urihelper {} -using namespace unnamed_svl_urihelper; - // unnamed namespaces don't work well yet... - namespace css = com::sun::star; using namespace com::sun::star; @@ -78,7 +74,7 @@ using namespace com::sun::star; // //============================================================================ -namespace unnamed_svl_urihelper { +namespace { inline UniString toUniString(ByteString const & rString) { @@ -152,24 +148,6 @@ inline UniString SmartRel2Abs_Impl(INetURLObject const & rTheBaseURIRef, UniString URIHelper::SmartRel2Abs(INetURLObject const & rTheBaseURIRef, - ByteString const & rTheRelURIRef, - Link const & rMaybeFileHdl, - bool bCheckFileExists, - bool bIgnoreFragment, - INetURLObject::EncodeMechanism eEncodeMechanism, - INetURLObject::DecodeMechanism eDecodeMechanism, - rtl_TextEncoding eCharset, - bool bRelativeNonURIs, - INetURLObject::FSysStyle eStyle) -{ - return SmartRel2Abs_Impl(rTheBaseURIRef, rTheRelURIRef, rMaybeFileHdl, - bCheckFileExists, bIgnoreFragment, - eEncodeMechanism, eDecodeMechanism, eCharset, - bRelativeNonURIs, eStyle); -} - -UniString -URIHelper::SmartRel2Abs(INetURLObject const & rTheBaseURIRef, UniString const & rTheRelURIRef, Link const & rMaybeFileHdl, bool bCheckFileExists, @@ -422,7 +400,7 @@ rtl::OUString URIHelper::simpleNormalizedMakeRelative( // //============================================================================ -namespace unnamed_svl_urihelper { +namespace { inline xub_StrLen nextChar(UniString const & rStr, xub_StrLen nPos) { @@ -887,65 +865,4 @@ URIHelper::removePassword(UniString const & rURI, String(aObj.GetURLNoPass(eDecodeMechanism, eCharset)); } -//============================================================================ -// -// queryFSysStyle -// -//============================================================================ - -INetURLObject::FSysStyle URIHelper::queryFSysStyle(UniString const & rFileUrl, - bool bAddConvenienceStyles) - throw (uno::RuntimeException) -{ - ::ucbhelper::ContentBroker const * pBroker = ::ucbhelper::ContentBroker::get(); - uno::Reference< ucb::XContentProviderManager > xManager; - if (pBroker) - xManager = pBroker->getContentProviderManagerInterface(); - uno::Reference< beans::XPropertySet > xProperties; - if (xManager.is()) - xProperties - = uno::Reference< beans::XPropertySet >( - xManager->queryContentProvider(rFileUrl), uno::UNO_QUERY); - sal_Int32 nNotation = ucb::FileSystemNotation::UNKNOWN_NOTATION; - if (xProperties.is()) - try - { - xProperties->getPropertyValue(rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( - "FileSystemNotation"))) - >>= nNotation; - } - catch (beans::UnknownPropertyException const &) {} - catch (lang::WrappedTargetException const &) {} - - // The following code depends on the fact that the - // com::sun::star::ucb::FileSystemNotation constants range from UNKNOWN to - // MAC, without any holes. The table below has two entries per notation, - // the first is used if bAddConvenienceStyles == false, while the second - // is used if bAddConvenienceStyles == true: - static INetURLObject::FSysStyle const aMap[][2] - = { { INetURLObject::FSysStyle(0), - INetURLObject::FSYS_DETECT }, - // UNKNOWN - { INetURLObject::FSYS_UNX, - INetURLObject::FSysStyle(INetURLObject::FSYS_VOS - | INetURLObject::FSYS_UNX) }, - // UNIX - { INetURLObject::FSYS_DOS, - INetURLObject::FSysStyle(INetURLObject::FSYS_VOS - | INetURLObject::FSYS_UNX - | INetURLObject::FSYS_DOS) }, - // DOS - { INetURLObject::FSYS_MAC, - INetURLObject::FSysStyle(INetURLObject::FSYS_VOS - | INetURLObject::FSYS_UNX - | INetURLObject::FSYS_MAC) } }; - return aMap[nNotation < ucb::FileSystemNotation::UNKNOWN_NOTATION - || nNotation > ucb::FileSystemNotation::MAC_NOTATION ? - 0 : - nNotation - - ucb::FileSystemNotation::UNKNOWN_NOTATION] - [bAddConvenienceStyles]; -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx index ffdb583261f7..8ff4867274c0 100644 --- a/svl/source/numbers/zforlist.cxx +++ b/svl/source/numbers/zforlist.cxx @@ -57,6 +57,7 @@ #include <unotools/digitgroupingiterator.hxx> #include <rtl/logfile.hxx> #include <rtl/instance.hxx> +#include <rtl/strbuf.hxx> #include <math.h> #include <limits> @@ -99,26 +100,28 @@ static sal_uInt32 theIndexTable[NF_INDEX_TABLE_ENTRIES]; also handles one instance of the SysLocale options */ +typedef ::std::vector< SvNumberFormatter* > SvNumberFormatterList_impl; + class SvNumberFormatterRegistry_Impl : public utl::ConfigurationListener { - List aFormatters; - SvtSysLocaleOptions aSysLocaleOptions; - LanguageType eSysLanguage; + SvNumberFormatterList_impl aFormatters; + SvtSysLocaleOptions aSysLocaleOptions; + LanguageType eSysLanguage; public: SvNumberFormatterRegistry_Impl(); virtual ~SvNumberFormatterRegistry_Impl(); - void Insert( SvNumberFormatter* pThis ) - { aFormatters.Insert( pThis, LIST_APPEND ); } - SvNumberFormatter* Remove( SvNumberFormatter* pThis ) - { return (SvNumberFormatter*)aFormatters.Remove( pThis ); } - sal_uInt32 Count() - { return aFormatters.Count(); } + void Insert( SvNumberFormatter* pThis ) + { aFormatters.push_back( pThis ); } - virtual void ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 ); -}; + SvNumberFormatter* Remove( SvNumberFormatter* pThis ); + size_t Count() + { return aFormatters.size(); } + + virtual void ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 ); +}; SvNumberFormatterRegistry_Impl::SvNumberFormatterRegistry_Impl() { @@ -133,26 +136,37 @@ SvNumberFormatterRegistry_Impl::~SvNumberFormatterRegistry_Impl() } -void SvNumberFormatterRegistry_Impl::ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 nHint ) +SvNumberFormatter* SvNumberFormatterRegistry_Impl::Remove( SvNumberFormatter* pThis ) { + for( + SvNumberFormatterList_impl::iterator it = aFormatters.begin(); + it < aFormatters.end(); + ++it + ) { + if ( *it == pThis ) { + aFormatters.erase( it ); + break; + } + } + return pThis; +} + +void SvNumberFormatterRegistry_Impl::ConfigurationChanged( + utl::ConfigurationBroadcaster*, + sal_uInt32 nHint +) { if ( nHint & SYSLOCALEOPTIONS_HINT_LOCALE ) { ::osl::MutexGuard aGuard( SvNumberFormatter::GetMutex() ); - for ( SvNumberFormatter* p = (SvNumberFormatter*)aFormatters.First(); - p; p = (SvNumberFormatter*)aFormatters.Next() ) - { - p->ReplaceSystemCL( eSysLanguage ); - } + for( size_t i = 0, n = aFormatters.size(); i < n; ++i ) + aFormatters[ i ]->ReplaceSystemCL( eSysLanguage ); eSysLanguage = MsLangId::getRealLanguage( LANGUAGE_SYSTEM ); } if ( nHint & SYSLOCALEOPTIONS_HINT_CURRENCY ) { ::osl::MutexGuard aGuard( SvNumberFormatter::GetMutex() ); - for ( SvNumberFormatter* p = (SvNumberFormatter*)aFormatters.First(); - p; p = (SvNumberFormatter*)aFormatters.Next() ) - { - p->ResetDefaultSystemCurrency(); - } + for( size_t i = 0, n = aFormatters.size(); i < n; ++i ) + aFormatters[ i ]->ResetDefaultSystemCurrency(); } } @@ -2091,8 +2105,9 @@ sal_Int32 SvNumberFormatter::ImpAdjustFormatCodeDefault( if ( !nCnt ) return -1; if (bCheckCorrectness && LocaleDataWrapper::areChecksEnabled()) - { // check the locale data for correctness - ByteString aMsg; + { + // check the locale data for correctness + rtl::OStringBuffer aMsg; sal_Int32 nElem, nShort, nMedium, nLong, nShortDef, nMediumDef, nLongDef; nShort = nMedium = nLong = nShortDef = nMediumDef = nLongDef = -1; for ( nElem = 0; nElem < nCnt; nElem++ ) @@ -2109,7 +2124,7 @@ sal_Int32 SvNumberFormatter::ImpAdjustFormatCodeDefault( nLong = nElem; break; default: - aMsg = "unknown type"; + aMsg.append(RTL_CONSTASCII_STRINGPARAM("unknown type")); } if ( pFormatArr[nElem].Default ) { @@ -2117,47 +2132,44 @@ sal_Int32 SvNumberFormatter::ImpAdjustFormatCodeDefault( { case i18n::KNumberFormatType::SHORT : if ( nShortDef != -1 ) - aMsg = "dupe short type default"; + aMsg.append(RTL_CONSTASCII_STRINGPARAM("dupe short type default")); nShortDef = nElem; break; case i18n::KNumberFormatType::MEDIUM : if ( nMediumDef != -1 ) - aMsg = "dupe medium type default"; + aMsg.append(RTL_CONSTASCII_STRINGPARAM("dupe medium type default")); nMediumDef = nElem; break; case i18n::KNumberFormatType::LONG : if ( nLongDef != -1 ) - aMsg = "dupe long type default"; + aMsg.append(RTL_CONSTASCII_STRINGPARAM("dupe long type default")); nLongDef = nElem; break; } } - if ( aMsg.Len() ) + if (aMsg.getLength()) { - aMsg.Insert( "SvNumberFormatter::ImpAdjustFormatCodeDefault: ", 0 ); - aMsg += "\nXML locale data FormatElement formatindex: "; - aMsg += ByteString::CreateFromInt32( pFormatArr[nElem].Index ); - String aUMsg( aMsg, RTL_TEXTENCODING_ASCII_US); - LocaleDataWrapper::outputCheckMessage( - xLocaleData->appendLocaleInfo( aUMsg)); - aMsg.Erase(); + aMsg.insert(0, RTL_CONSTASCII_STRINGPARAM("SvNumberFormatter::ImpAdjustFormatCodeDefault: ")); + aMsg.append(RTL_CONSTASCII_STRINGPARAM("\nXML locale data FormatElement formatindex: ")); + aMsg.append(static_cast<sal_Int32>(pFormatArr[nElem].Index)); + rtl::OUString aUMsg(rtl::OStringToOUString(aMsg.makeStringAndClear(), + RTL_TEXTENCODING_ASCII_US)); + LocaleDataWrapper::outputCheckMessage(xLocaleData->appendLocaleInfo(aUMsg)); } } if ( nShort != -1 && nShortDef == -1 ) - aMsg += "no short type default "; + aMsg.append(RTL_CONSTASCII_STRINGPARAM("no short type default ")); if ( nMedium != -1 && nMediumDef == -1 ) - aMsg += "no medium type default "; + aMsg.append(RTL_CONSTASCII_STRINGPARAM("no medium type default ")); if ( nLong != -1 && nLongDef == -1 ) - aMsg += "no long type default "; - if ( aMsg.Len() ) + aMsg.append(RTL_CONSTASCII_STRINGPARAM("no long type default ")); + if (aMsg.getLength()) { - aMsg.Insert( "SvNumberFormatter::ImpAdjustFormatCodeDefault: ", 0 ); - aMsg += "\nXML locale data FormatElement group of: "; - String aUMsg( aMsg, RTL_TEXTENCODING_ASCII_US); - aUMsg += String( pFormatArr[0].NameID ); + aMsg.insert(0, RTL_CONSTASCII_STRINGPARAM("SvNumberFormatter::ImpAdjustFormatCodeDefault: ")); + aMsg.append(RTL_CONSTASCII_STRINGPARAM("\nXML locale data FormatElement group of: ")); + rtl::OUString aUMsg(rtl::OStringToOUString(aMsg.makeStringAndClear(), RTL_TEXTENCODING_ASCII_US)); LocaleDataWrapper::outputCheckMessage( - xLocaleData->appendLocaleInfo( aUMsg)); - aMsg.Erase(); + xLocaleData->appendLocaleInfo(aUMsg + pFormatArr[0].NameID)); } } // find the default (medium preferred, then long) and reset all other defaults @@ -2749,7 +2761,6 @@ void SvNumberFormatter::GenerateFormat(String& sString, const String& rThSep = GetNumThousandSep(); SvNumberformat* pFormat = (SvNumberformat*) aFTable.Get(nIndex); - sal_Bool insertBrackets = pFormat->IsNegativeInBracket(); if (nAnzLeading == 0) { @@ -2843,36 +2854,42 @@ void SvNumberFormatter::GenerateFormat(String& sString, sString += ';'; sString += sNegStr; } - if ( (IsRed || insertBrackets ) && eType != NUMBERFORMAT_CURRENCY) + if (eType != NUMBERFORMAT_CURRENCY) { - String sTmpStr = sString; - - if ( pFormat->HasPositiveBracketPlaceholder() ) + bool insertBrackets = false; + if ( eType != NUMBERFORMAT_UNDEFINED) + insertBrackets = pFormat->IsNegativeInBracket(); + if (IsRed || insertBrackets) { - sTmpStr += '_'; - sTmpStr += ')'; - } - sTmpStr += ';'; + String sTmpStr = sString; - if (IsRed) - { - sTmpStr += '['; - sTmpStr += pFormatScanner->GetRedString(); - sTmpStr += ']'; - } + if ( pFormat->HasPositiveBracketPlaceholder() ) + { + sTmpStr += '_'; + sTmpStr += ')'; + } + sTmpStr += ';'; - if (insertBrackets) - { - sTmpStr += '('; - sTmpStr += sString; - sTmpStr += ')'; - } - else - { - sTmpStr += '-'; - sTmpStr +=sString; - } - sString = sTmpStr; + if (IsRed) + { + sTmpStr += '['; + sTmpStr += pFormatScanner->GetRedString(); + sTmpStr += ']'; + } + + if (insertBrackets) + { + sTmpStr += '('; + sTmpStr += sString; + sTmpStr += ')'; + } + else + { + sTmpStr += '-'; + sTmpStr +=sString; + } + sString = sTmpStr; + } } } @@ -3533,21 +3550,12 @@ void SvNumberFormatter::GetCompatibilityCurrency( String& rSymbol, String& rAbbr void lcl_CheckCurrencySymbolPosition( const NfCurrencyEntry& rCurr ) { - short nPos = -1; // -1:=unknown, 0:=vorne, 1:=hinten - short nNeg = -1; switch ( rCurr.GetPositiveFormat() ) { case 0: // $1 - nPos = 0; - break; case 1: // 1$ - nPos = 1; - break; case 2: // $ 1 - nPos = 0; - break; case 3: // 1 $ - nPos = 1; break; default: LocaleDataWrapper::outputCheckMessage( @@ -3557,75 +3565,27 @@ void lcl_CheckCurrencySymbolPosition( const NfCurrencyEntry& rCurr ) switch ( rCurr.GetNegativeFormat() ) { case 0: // ($1) - nNeg = 0; - break; case 1: // -$1 - nNeg = 0; - break; case 2: // $-1 - nNeg = 0; - break; case 3: // $1- - nNeg = 0; - break; case 4: // (1$) - nNeg = 1; - break; case 5: // -1$ - nNeg = 1; - break; case 6: // 1-$ - nNeg = 1; - break; case 7: // 1$- - nNeg = 1; - break; case 8: // -1 $ - nNeg = 1; - break; case 9: // -$ 1 - nNeg = 0; - break; case 10: // 1 $- - nNeg = 1; - break; case 11: // $ -1 - nNeg = 0; - break; case 12 : // $ 1- - nNeg = 0; - break; case 13 : // 1- $ - nNeg = 1; - break; case 14 : // ($ 1) - nNeg = 0; - break; case 15 : // (1 $) - nNeg = 1; break; default: LocaleDataWrapper::outputCheckMessage( "lcl_CheckCurrencySymbolPosition: unknown NegativeFormat"); break; } - if ( nPos >= 0 && nNeg >= 0 && nPos != nNeg ) - { - ByteString aStr( "positions of currency symbols differ\nLanguage: " ); - aStr += ByteString::CreateFromInt32( rCurr.GetLanguage() ); - aStr += " <"; - aStr += ByteString( rCurr.GetSymbol(), RTL_TEXTENCODING_UTF8 ); - aStr += "> positive: "; - aStr += ByteString::CreateFromInt32( rCurr.GetPositiveFormat() ); - aStr += ( nPos ? " (postfix)" : " (prefix)" ); - aStr += ", negative: "; - aStr += ByteString::CreateFromInt32( rCurr.GetNegativeFormat() ); - aStr += ( nNeg ? " (postfix)" : " (prefix)" ); -#if 0 -// seems that there really are some currencies which differ, e.g. YugoDinar - DBG_ERRORFILE( aStr.GetBuffer() ); -#endif - } } diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx index 00ebf41a3dd7..cfc916993885 100644 --- a/svl/source/numbers/zformat.cxx +++ b/svl/source/numbers/zformat.cxx @@ -2007,15 +2007,7 @@ sal_Bool SvNumberformat::GetOutputString(String& sString, } return sal_False; } -/* -void SvNumberformat::GetNextFareyNumber(sal_uLong nPrec, sal_uLong x0, sal_uLong x1, - sal_uLong y0, sal_uLong y1, - sal_uLong& x2,sal_uLong& y2) -{ - x2 = ((y0+nPrec)/y1)*x1 - x0; - y2 = ((y0+nPrec)/y1)*y1 - y0; -} -*/ + sal_uLong SvNumberformat::ImpGGT(sal_uLong x, sal_uLong y) { if (y == 0) @@ -2417,7 +2409,6 @@ sal_Bool SvNumberformat::GetOutputString(double fNumber, { sal_uLong x2 = ((y0+nBasis)/y1)*x1 - x0; // naechste Farey-Zahl sal_uLong y2 = ((y0+nBasis)/y1)*y1 - y0; -// GetNextFareyNumber(nBasis, x0, x1, y0, y1, x2, y2); x0 = x1; y0 = y1; x1 = x2; @@ -2446,11 +2437,6 @@ sal_Bool SvNumberformat::GetOutputString(double fNumber, else // grosse Nenner { // 0,1234->123/1000 sal_uLong nGgt; -/* - nDiv = nBasis+1; - nFrac = ((sal_uLong)floor(0.5 + fNumber * - pow(10.0,rInfo.nCntExp))); -*/ nDiv = 10000000; nFrac = ((sal_uLong)floor(0.5 + fNumber * 10000000.0)); nGgt = ImpGGT(nDiv, nFrac); @@ -4421,7 +4407,6 @@ String SvNumberformat::GetMappedFormatstring( case NF_SYMBOLTYPE_CALDEL : if ( pStr[j+1].EqualsAscii("buddhist") ) { - //aStr.InsertAscii( "[$-", aStr.Len() ); aStr.InsertAscii( "[$-", 0 ); if ( rNum.IsSet() && rNum.GetNatNum() == 1 && MsLangId::getRealLanguage( rNum.GetLang() ) == diff --git a/svl/source/passwordcontainer/passwordcontainer.component b/svl/source/passwordcontainer/passwordcontainer.component index 42eb47cf14dd..3fc55af1861e 100644 --- a/svl/source/passwordcontainer/passwordcontainer.component +++ b/svl/source/passwordcontainer/passwordcontainer.component @@ -26,7 +26,7 @@ * **********************************************************************--> -<component loader="com.sun.star.loader.SharedLibrary" +<component loader="com.sun.star.loader.SharedLibrary" prefix="passwordcontainer" xmlns="http://openoffice.org/2010/uno-components"> <implementation name="stardiv.svl.PasswordContainer"> <service name="com.sun.star.task.PasswordContainer"/> diff --git a/svl/source/passwordcontainer/passwordcontainer.cxx b/svl/source/passwordcontainer/passwordcontainer.cxx index 6e922ea29cd7..86c72fb3619b 100644 --- a/svl/source/passwordcontainer/passwordcontainer.cxx +++ b/svl/source/passwordcontainer/passwordcontainer.cxx @@ -1538,13 +1538,7 @@ MasterPasswordRequest_Impl::MasterPasswordRequest_Impl( PasswordRequestMode Mode extern "C" { -SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment ( - const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */) -{ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} - -SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory ( +SAL_DLLPUBLIC_EXPORT void * SAL_CALL passwordcontainer_component_getFactory ( const sal_Char * pImplementationName, void * pServiceManager, void * /* pRegistryKey */) { void * pResult = 0; diff --git a/svl/source/svdde/ddesvr.cxx b/svl/source/svdde/ddesvr.cxx index 99b8cce0ae71..08894db00556 100644 --- a/svl/source/svdde/ddesvr.cxx +++ b/svl/source/svdde/ddesvr.cxx @@ -88,7 +88,6 @@ HDDEDATA CALLBACK _export DdeInternal::SvrCallback( { int nTopics = 0; -#if 1 TCHAR chTopicBuf[250]; if( hText1 ) DdeQueryString( pInst->hDdeInstSvr, hText1, chTopicBuf, @@ -117,20 +116,6 @@ HDDEDATA CALLBACK _export DdeInternal::SvrCallback( } } -#else - for( pService = rAll.First();pService;pService = rAll.Next() ) - { - if ( !hText2 || ( *pService->pName == hText2 ) ) - { - std::vector<DdeTopic*>::const_iterator iter; - for (iter = pService->aTopics.begin(); iter != pService->aTopics.end(); ++iter) - { - if ( !hText1 || iter->pName == hText1 ) - nTopics++; - } - } - } -#endif if( !nTopics ) return (HDDEDATA)NULL; @@ -143,18 +128,6 @@ HDDEDATA CALLBACK _export DdeInternal::SvrCallback( { if ( !hText2 || (*pService->pName == hText2 ) ) { -#if 0 - for ( pTopic = pService->aTopics.First(); pTopic; - pTopic = pService->aTopics.Next() ) - { - if ( !hText1 || (*pTopic->pName == hText1) ) - { - q->hszSvc = *pService->pName; - q->hszTopic = *pTopic->pName; - q++; - } - } -#else String sTopics( pService->Topics() ); sal_uInt16 n = 0; while( STRING_NOTFOUND != n ) @@ -173,8 +146,6 @@ HDDEDATA CALLBACK _export DdeInternal::SvrCallback( } } } - -#endif } } diff --git a/svl/source/uno/registerservices.cxx b/svl/source/uno/registerservices.cxx index 5caca580694f..d001c73da633 100644 --- a/svl/source/uno/registerservices.cxx +++ b/svl/source/uno/registerservices.cxx @@ -55,13 +55,7 @@ DECLARE_CREATEINSTANCE( PathService ) extern "C" { -SVL_DLLPUBLIC void SAL_CALL component_getImplementationEnvironment ( - const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */) -{ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} - -SVL_DLLPUBLIC void* SAL_CALL component_getFactory ( +SVL_DLLPUBLIC void* SAL_CALL svl_component_getFactory ( const sal_Char * pImplementationName, void * _pServiceManager, void * /* _pRegistryKey*/) { void * pResult = 0; diff --git a/svl/util/svl.component b/svl/util/svl.component index 4af1a31f5782..78fc22928ac5 100644 --- a/svl/util/svl.component +++ b/svl/util/svl.component @@ -26,7 +26,7 @@ * **********************************************************************--> -<component loader="com.sun.star.loader.SharedLibrary" +<component loader="com.sun.star.loader.SharedLibrary" prefix="svl" xmlns="http://openoffice.org/2010/uno-components"> <implementation name="com.sun.star.comp.svl.PathService"> <service name="com.sun.star.config.SpecialConfigManager"/> diff --git a/svtools/CppunitTest_svtools_filters_test.mk b/svtools/CppunitTest_svtools_filters_test.mk new file mode 100755 index 000000000000..d091ede3f2f9 --- /dev/null +++ b/svtools/CppunitTest_svtools_filters_test.mk @@ -0,0 +1,69 @@ +#************************************************************************* +# Version: MPL 1.1 / GPLv3+ / LGPLv3+ +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License or as specified alternatively below. You may obtain a copy of +# the License at http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Initial Developer of the Original Code is +# Caolán McNamara, Red Hat, Inc. <caolanm@redhat.com> +# Portions created by the Initial Developer are Copyright (C) 2011 the +# Initial Developer. All Rights Reserved. +# +# Major Contributor(s): +# +# For minor contributions see the git repository. +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 3 or later (the "GPLv3+"), or +# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), +# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable +# instead of those above. +#************************************************************************* + +$(eval $(call gb_CppunitTest_CppunitTest,svtools_filters_test)) + +$(eval $(call gb_CppunitTest_add_exception_objects,svtools_filters_test, \ + svtools/qa/cppunit/filters-test \ +)) + +$(eval $(call gb_CppunitTest_add_linked_libs,svtools_filters_test, \ + comphelper \ + cppu \ + cppuhelper \ + sal \ + svt \ + tl \ + vcl \ + $(gb_STDLIBS) \ +)) + +$(eval $(call gb_CppunitTest_set_include,svtools_filters_test,\ + $$(INCLUDE) \ + -I$(OUTDIR)/inc \ +)) + +$(eval $(call gb_CppunitTest_add_api,svtools_filters_test,\ + udkapi \ + offapi \ +)) + +$(eval $(call gb_CppunitTest_uses_ure,svtools_filters_test)) + +$(eval $(call gb_CppunitTest_add_type_rdbs,svtools_filters_test,\ + types \ +)) + +$(eval $(call gb_CppunitTest_set_args,svtools_filters_test,\ + --headless \ + --invisible \ + --protector unoexceptionprotector$(gb_Library_DLLEXT) unoexceptionprotector \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/svtools/Executable_bmp.mk b/svtools/Executable_bmp.mk index 3b2fd2a1203c..f05013df4170 100644 --- a/svtools/Executable_bmp.mk +++ b/svtools/Executable_bmp.mk @@ -36,7 +36,11 @@ $(eval $(call gb_Executable_set_include,bmp,\ -I$(realpath $(SRCDIR)/svtools/inc/svtools) \ -I$(realpath $(SRCDIR)/svtools/source/inc) \ -I$(realpath $(SRCDIR)/svtools/inc/pch) \ - -I$(OUTDIR)/inc/offuh \ +)) + +$(eval $(call gb_Executable_add_api,bmp,\ + udkapi \ + offapi \ )) $(eval $(call gb_Executable_add_linked_libs,bmp,\ diff --git a/svtools/Executable_bmpsum.mk b/svtools/Executable_bmpsum.mk index 492dabeb58f8..1bef32c970de 100644 --- a/svtools/Executable_bmpsum.mk +++ b/svtools/Executable_bmpsum.mk @@ -30,12 +30,16 @@ $(eval $(call gb_Executable_Executable,bmpsum)) $(eval $(call gb_Executable_set_include,bmpsum,\ $$(INCLUDE) \ -I$(OUTDIR)/inc/ \ - -I$(OUTDIR)/inc/offuh/ \ -I$(realpath $(SRCDIR)/svtools/inc) \ -I$(realpath $(SRCDIR)/svtools/inc/pch) \ -I$(realpath $(SRCDIR)/svtools/inc/svtools) \ )) +$(eval $(call gb_Executable_add_api,bmpsum,\ + udkapi \ + offapi \ +)) + $(eval $(call gb_Executable_add_linked_libs,bmpsum,\ sal \ tl \ diff --git a/svtools/Executable_g2g.mk b/svtools/Executable_g2g.mk index c817cff43ccd..c41dae777dbd 100644 --- a/svtools/Executable_g2g.mk +++ b/svtools/Executable_g2g.mk @@ -30,12 +30,16 @@ $(eval $(call gb_Executable_Executable,g2g)) $(eval $(call gb_Executable_set_include,g2g,\ $$(INCLUDE) \ -I$(OUTDIR)/inc/ \ - -I$(OUTDIR)/inc/offuh/ \ -I$(realpath $(SRCDIR)/svtools/inc) \ -I$(realpath $(SRCDIR)/svtools/inc/pch) \ -I$(realpath $(SRCDIR)/svtools/inc/svtools) \ )) +$(eval $(call gb_Executable_add_api,g2g,\ + udkapi \ + offapi \ +)) + $(eval $(call gb_Executable_add_linked_libs,g2g,\ jvmfwk \ sal \ diff --git a/svtools/Library_hatchwindowfactory.mk b/svtools/Library_hatchwindowfactory.mk index 96e8f10c3306..91b92267ddd5 100644 --- a/svtools/Library_hatchwindowfactory.mk +++ b/svtools/Library_hatchwindowfactory.mk @@ -36,10 +36,14 @@ $(eval $(call gb_Library_set_include,hatchwindowfactory,\ -I$(realpath $(SRCDIR)/svtools/inc/pch) \ -I$(OUTDIR)/inc/ \ -I$(realpath $(SRCDIR)/svtools/inc) \ - -I$(OUTDIR)/inc/offuh \ -I$(OUTDIR)/inc \ )) +$(eval $(call gb_Library_add_api,hatchwindowfactory,\ + udkapi \ + offapi \ +)) + $(eval $(call gb_Library_add_linked_libs,hatchwindowfactory,\ cppu \ cppuhelper \ diff --git a/svtools/Library_productregistration.mk b/svtools/Library_productregistration.mk index 726e5a3b664b..44867f4530e3 100644 --- a/svtools/Library_productregistration.mk +++ b/svtools/Library_productregistration.mk @@ -36,10 +36,14 @@ $(eval $(call gb_Library_set_include,productregistration,\ -I$(realpath $(SRCDIR)/svtools/inc/pch) \ -I$(OUTDIR)/inc/ \ -I$(realpath $(SRCDIR)/svtools/inc) \ - -I$(OUTDIR)/inc/offuh \ -I$(OUTDIR)/inc \ )) +$(eval $(call gb_Library_add_api,productregistration,\ + udkapi \ + offapi \ +)) + $(eval $(call gb_Library_add_linked_libs,productregistration,\ cppu \ cppuhelper \ diff --git a/svtools/Library_svt.mk b/svtools/Library_svt.mk index 98f112864ab6..ea6a568da171 100644 --- a/svtools/Library_svt.mk +++ b/svtools/Library_svt.mk @@ -33,17 +33,21 @@ $(eval $(call gb_Library_add_precompiled_header,svt,$(SRCDIR)/svtools/inc/pch/pr $(eval $(call gb_Library_set_componentfile,svt,svtools/util/svt)) +$(eval $(call gb_Library_add_api,svt,\ + udkapi \ + offapi \ +)) + $(eval $(call gb_Library_set_include,svt,\ -I$(OUTDIR)/inc/external/jpeg \ $$(INCLUDE) \ -I$(WORKDIR)/inc/svtools \ -I$(WORKDIR)/inc/ \ -I$(OUTDIR)/inc/ \ - -I$(realpath $(SRCDIR)/svtools/inc) \ -I$(realpath $(SRCDIR)/svtools/inc/svtools) \ -I$(realpath $(SRCDIR)/svtools/source/inc) \ -I$(realpath $(SRCDIR)/svtools/inc/pch) \ - -I$(OUTDIR)/inc/offuh \ + -I$(realpath $(SRCDIR)/svtools/inc) \ )) $(eval $(call gb_Library_add_defs,svt,\ @@ -101,9 +105,7 @@ $(eval $(call gb_Library_add_exception_objects,svt,\ svtools/source/contnr/imivctl1 \ svtools/source/contnr/imivctl2 \ svtools/source/contnr/ivctrl \ - svtools/source/contnr/svicnvw \ svtools/source/contnr/svimpbox \ - svtools/source/contnr/svimpicn \ svtools/source/contnr/svlbitm \ svtools/source/contnr/svlbox \ svtools/source/contnr/svtabbx \ diff --git a/svtools/Module_svtools.mk b/svtools/Module_svtools.mk index 0b669d9dee1b..7adeaf80a64c 100644 --- a/svtools/Module_svtools.mk +++ b/svtools/Module_svtools.mk @@ -30,15 +30,24 @@ $(eval $(call gb_Module_Module,svtools)) $(eval $(call gb_Module_add_targets,svtools,\ AllLangResTarget_productregistration \ AllLangResTarget_svt \ - Executable_bmp \ - Executable_bmpsum \ - Executable_g2g \ Library_hatchwindowfactory \ Library_productregistration \ Library_svt \ Package_inc \ )) +ifneq ($(CROSS_COMPILING),YES) +$(eval $(call gb_Module_add_targets,svtools,\ + Executable_bmp \ + Executable_bmpsum \ + Executable_g2g \ +)) +endif + +$(eval $(call gb_Module_add_check_targets,svtools,\ + CppunitTest_svtools_filters_test \ +)) + $(eval $(call gb_Module_add_subsequentcheck_targets,svtools,\ JunitTest_svtools_unoapi \ )) diff --git a/svtools/Package_inc.mk b/svtools/Package_inc.mk index 39d2331641fc..428dac1f414f 100644 --- a/svtools/Package_inc.mk +++ b/svtools/Package_inc.mk @@ -133,7 +133,6 @@ $(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/statusbarcontroller.hx $(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/stdctrl.hxx,svtools/stdctrl.hxx)) $(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/stdmenu.hxx,svtools/stdmenu.hxx)) $(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/stringtransfer.hxx,svtools/stringtransfer.hxx)) -$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/svicnvw.hxx,svtools/svicnvw.hxx)) $(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/svlbitm.hxx,svtools/svlbitm.hxx)) $(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/svlbox.hxx,svtools/svlbox.hxx)) $(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/svmedit.hxx,svtools/svmedit.hxx)) diff --git a/svtools/bmpmaker/bmp.cxx b/svtools/bmpmaker/bmp.cxx index dce36f039730..a66312f60710 100644 --- a/svtools/bmpmaker/bmp.cxx +++ b/svtools/bmpmaker/bmp.cxx @@ -40,7 +40,6 @@ using namespace std; #include <vcl/svapp.hxx> #include "svl/solar.hrc" -#include <svtools/filedlg.hxx> #include "bmpcore.hxx" #include "bmp.hrc" diff --git a/svtools/bmpmaker/bmpsum.cxx b/svtools/bmpmaker/bmpsum.cxx index 8d7d34240d94..215329aa41ff 100644 --- a/svtools/bmpmaker/bmpsum.cxx +++ b/svtools/bmpmaker/bmpsum.cxx @@ -411,7 +411,7 @@ void BmpSum::ProcessFileList( const String& rInFileList, // write new entries for( sal_uInt32 i = 0; i < aFileNameVector.size(); ++i ) { - ByteString aStr( ByteString::CreateFromInt64( aPair.first ) ); + ByteString aStr(rtl::OString::valueOf(static_cast<sal_Int64>(aPair.first))); ByteString aFileName( aFileNameVector[ i ] ); DirEntry aSrcFile( aFileName ); diff --git a/svtools/inc/svtools/brwbox.hxx b/svtools/inc/svtools/brwbox.hxx index edfacfa77e00..42bf18ff62db 100644 --- a/svtools/inc/svtools/brwbox.hxx +++ b/svtools/inc/svtools/brwbox.hxx @@ -409,9 +409,6 @@ protected: long CalcReverseZoom(long nVal); - HeaderBar* GetHeaderBar() const; - // header bar access for derived classes - inline const DataFlavorExVector& GetDataFlavors() const; @@ -493,20 +490,10 @@ public: // inserting, changing, removing and freezing of columns void InsertHandleColumn( sal_uLong nWidth ); - void InsertDataColumn( sal_uInt16 nItemId, const Image& rImage, - long nSize, HeaderBarItemBits nBits = HIB_STDSTYLE, - sal_uInt16 nPos = HEADERBAR_APPEND ); void InsertDataColumn( sal_uInt16 nItemId, const XubString& rText, long nSize, HeaderBarItemBits nBits = HIB_STDSTYLE, sal_uInt16 nPos = HEADERBAR_APPEND ); - void InsertDataColumn( sal_uInt16 nItemId, - const Image& rImage, const XubString& rText, - long nSize, HeaderBarItemBits nBits = HIB_STDSTYLE, - sal_uInt16 nPos = HEADERBAR_APPEND, - // Hilfstext bei leerem rText - const String* pHelpText = 0 ); void SetColumnTitle( sal_uInt16 nColumnId, const String &rTitle ); - void SetColumnMode( sal_uInt16 nColumnId, BrowserColumnMode nFlags ); void SetColumnWidth( sal_uInt16 nColumnId, sal_uLong nWidth ); void SetColumnPos( sal_uInt16 nColumnId, sal_uInt16 nPos ); void FreezeColumn( sal_uInt16 nColumnId, sal_Bool bFreeze = sal_True ); @@ -534,14 +521,12 @@ public: void ResetScroll(); long ScrollColumns( long nColumns ); long ScrollRows( long nRows ); - long ScrollPages( long nPagesY ); sal_Bool MakeFieldVisible( long nRow, sal_uInt16 nColId, sal_Bool bComplete = sal_False ); // access and movement of cursor long GetCurRow() const { return nCurRow; } sal_uInt16 GetCurColumnId() const { return nCurColId; } sal_Bool GoToRow( long nRow ); - sal_Bool GoToRowAndDoNotModifySelection( long nRow ); sal_Bool GoToColumnId( sal_uInt16 nColId ); sal_Bool GoToRowColumnId( long nRow, sal_uInt16 nColId ); @@ -557,23 +542,18 @@ public: sal_uInt16 GetSelectColumnCount() const; virtual bool IsRowSelected( long nRow ) const; bool IsColumnSelected( sal_uInt16 nColumnId ) const; - sal_Bool IsAllSelected() const; long FirstSelectedRow( sal_Bool bInverse = sal_False ); long LastSelectedRow(); - long PrevSelectedRow(); long NextSelectedRow(); const MultiSelection* GetColumnSelection() const { return pColSel; } const MultiSelection* GetSelection() const { return bMultiSelection ? uRow.pSel : 0; } - void SetSelection( const MultiSelection &rSelection ); long FirstSelectedColumn( ) const; - long NextSelectedColumn( ) const; sal_Bool IsResizing() const { return bResizing; } // access to positions of fields, column and rows - Window& GetEventWindow() const; Window& GetDataWindow() const { return *pDataWin; } Rectangle GetRowRectPixel( long nRow, sal_Bool bRelToBrowser = sal_True ) const; @@ -599,7 +579,6 @@ public: void Dispatch( sal_uInt16 nId ); void SetMode( BrowserMode nMode = 0 ); BrowserMode GetMode( ) const { return m_nCurrentMode; } - bool IsInCommandEvent() const; void SetCursorColor(const Color& _rCol); Color GetCursorColor() const { return m_aCursorColor; } diff --git a/svtools/inc/svtools/ctrlbox.hxx b/svtools/inc/svtools/ctrlbox.hxx index 56c69e0d078b..d346b3b6af85 100644 --- a/svtools/inc/svtools/ctrlbox.hxx +++ b/svtools/inc/svtools/ctrlbox.hxx @@ -190,7 +190,8 @@ public: sal_uInt16 nPos = LISTBOX_APPEND ); virtual sal_uInt16 InsertEntry( const Color& rColor, const XubString& rStr, sal_uInt16 nPos = LISTBOX_APPEND ); - void InsertAutomaticEntry(); + void InsertAutomaticEntryColor(const Color &rAutoColorValue); + bool IsAutomaticSelected() { return !GetSelectEntryPos(); } using ListBox::RemoveEntry; virtual void RemoveEntry( sal_uInt16 nPos ); virtual void Clear(); diff --git a/svtools/inc/svtools/filter.hxx b/svtools/inc/svtools/filter.hxx index 4ea0bce85ee0..da3a7cb036c8 100644 --- a/svtools/inc/svtools/filter.hxx +++ b/svtools/inc/svtools/filter.hxx @@ -376,7 +376,6 @@ public: // ------------------------------------ SVT_DLLPUBLIC sal_Bool ReadWindowMetafile( SvStream& rStream, GDIMetaFile& rMTF, FilterConfigItem* pConfigItem ); -SVT_DLLPUBLIC sal_Bool WriteWindowMetafile( SvStream& rStream, const GDIMetaFile& rMTF ); SVT_DLLPUBLIC sal_Bool WriteWindowMetafileBits( SvStream& rStream, const GDIMetaFile& rMTF ); #endif //_FILTER_HXX diff --git a/svtools/inc/svtools/grfmgr.hxx b/svtools/inc/svtools/grfmgr.hxx index c99ea7a55bcd..f7560058c458 100644 --- a/svtools/inc/svtools/grfmgr.hxx +++ b/svtools/inc/svtools/grfmgr.hxx @@ -105,14 +105,14 @@ private: long mnTopCrop; long mnRightCrop; long mnBottomCrop; - sal_uInt16 mnRotate10; + sal_uInt16 mnRotate10; short mnContPercent; short mnLumPercent; short mnRPercent; short mnGPercent; short mnBPercent; - sal_Bool mbInvert; - sal_uInt8 mcTransparency; + sal_Bool mbInvert; + sal_uInt8 mcTransparency; GraphicDrawMode meDrawMode; void* mpDummy; @@ -122,14 +122,14 @@ public: GraphicAttr(); ~GraphicAttr(); - sal_Bool operator==( const GraphicAttr& rAttr ) const; - sal_Bool operator!=( const GraphicAttr& rAttr ) const { return !( *this == rAttr ); } + sal_Bool operator==( const GraphicAttr& rAttr ) const; + sal_Bool operator!=( const GraphicAttr& rAttr ) const { return !( *this == rAttr ); } void SetDrawMode( GraphicDrawMode eDrawMode ) { meDrawMode = eDrawMode; } GraphicDrawMode GetDrawMode() const { return meDrawMode; } void SetMirrorFlags( sal_uLong nMirrFlags ) { mnMirrFlags = nMirrFlags; } - sal_uLong GetMirrorFlags() const { return mnMirrFlags; } + sal_uLong GetMirrorFlags() const { return mnMirrFlags; } void SetCrop( long nLeft_100TH_MM, long nTop_100TH_MM, long nRight_100TH_MM, long nBottom_100TH_MM ) { @@ -142,7 +142,7 @@ public: long GetBottomCrop() const { return mnBottomCrop; } void SetRotation( sal_uInt16 nRotate10 ) { mnRotate10 = nRotate10; } - sal_uInt16 GetRotation() const { return mnRotate10; } + sal_uInt16 GetRotation() const { return mnRotate10; } void SetLuminance( short nLuminancePercent ) { mnLumPercent = nLuminancePercent; } short GetLuminance() const { return mnLumPercent; } @@ -163,21 +163,21 @@ public: double GetGamma() const { return mfGamma; } void SetInvert( sal_Bool bInvert ) { mbInvert = bInvert; } - sal_Bool IsInvert() const { return mbInvert; } + sal_Bool IsInvert() const { return mbInvert; } void SetTransparency( sal_uInt8 cTransparency ) { mcTransparency = cTransparency; } - sal_uInt8 GetTransparency() const { return mcTransparency; } + sal_uInt8 GetTransparency() const { return mcTransparency; } - sal_Bool IsSpecialDrawMode() const { return( meDrawMode != GRAPHICDRAWMODE_STANDARD ); } - sal_Bool IsMirrored() const { return( mnMirrFlags != 0UL ); } - sal_Bool IsCropped() const + sal_Bool IsSpecialDrawMode() const { return( meDrawMode != GRAPHICDRAWMODE_STANDARD ); } + sal_Bool IsMirrored() const { return( mnMirrFlags != 0UL ); } + sal_Bool IsCropped() const { return( mnLeftCrop != 0 || mnTopCrop != 0 || mnRightCrop != 0 || mnBottomCrop != 0 ); } - sal_Bool IsRotated() const { return( ( mnRotate10 % 3600 ) != 0 ); } - sal_Bool IsTransparent() const { return( mcTransparency > 0 ); } - sal_Bool IsAdjusted() const + sal_Bool IsRotated() const { return( ( mnRotate10 % 3600 ) != 0 ); } + sal_Bool IsTransparent() const { return( mcTransparency > 0 ); } + sal_Bool IsAdjusted() const { return( mnLumPercent != 0 || mnContPercent != 0 || mnRPercent != 0 || mnGPercent != 0 || mnBPercent != 0 || mfGamma != 1.0 || mbInvert ); @@ -203,7 +203,7 @@ private: GraphicAttr maAttr; Size maPrefSize; MapMode maPrefMapMode; - sal_uLong mnSizeBytes; + sal_uLong mnSizeBytes; GraphicType meType; GraphicManager* mpMgr; String* mpLink; @@ -211,7 +211,7 @@ private: String* mpUserData; Timer* mpSwapOutTimer; GrfSimpleCacheObj* mpSimpleCache; - sal_uLong mnAnimationLoopCount; + sal_uLong mnAnimationLoopCount; void* mpDummy1; void* mpDummy2; sal_Bool mbAutoSwapped : 1; @@ -227,13 +227,21 @@ private: void SVT_DLLPRIVATE ImplConstruct(); void SVT_DLLPRIVATE ImplAssignGraphicData(); - void SVT_DLLPRIVATE ImplSetGraphicManager( const GraphicManager* pMgr, - const ByteString* pID = NULL, - const GraphicObject* pCopyObj = NULL ); + void SVT_DLLPRIVATE ImplSetGraphicManager( + const GraphicManager* pMgr, + const ByteString* pID = NULL, + const GraphicObject* pCopyObj = NULL + ); void SVT_DLLPRIVATE ImplAutoSwapIn(); - sal_Bool SVT_DLLPRIVATE ImplIsAutoSwapped() const { return mbAutoSwapped; } - sal_Bool SVT_DLLPRIVATE ImplGetCropParams( OutputDevice* pOut, Point& rPt, Size& rSz, const GraphicAttr* pAttr, - PolyPolygon& rClipPolyPoly, sal_Bool& bRectClipRegion ) const; + sal_Bool SVT_DLLPRIVATE ImplIsAutoSwapped() const { return mbAutoSwapped; } + sal_Bool SVT_DLLPRIVATE ImplGetCropParams( + OutputDevice* pOut, + Point& rPt, + Size& rSz, + const GraphicAttr* pAttr, + PolyPolygon& rClipPolyPoly, + sal_Bool& bRectClipRegion + ) const; /** Render a given number of tiles in an optimized way @@ -276,33 +284,60 @@ private: @return true, if everything was successfully rendered. */ - bool SVT_DLLPRIVATE ImplRenderTempTile( VirtualDevice& rVDev, int nExponent, - int nNumTilesX, int nNumTilesY, - const Size& rTileSizePixel, - const GraphicAttr* pAttr, sal_uLong nFlags ); + bool SVT_DLLPRIVATE ImplRenderTempTile( + VirtualDevice& rVDev, + int nExponent, + int nNumTilesX, + int nNumTilesY, + const Size& rTileSizePixel, + const GraphicAttr* pAttr, + sal_uLong nFlags + ); /// internally called by ImplRenderTempTile() - bool SVT_DLLPRIVATE ImplRenderTileRecursive( VirtualDevice& rVDev, int nExponent, int nMSBFactor, - int nNumOrigTilesX, int nNumOrigTilesY, - int nRemainderTilesX, int nRemainderTilesY, - const Size& rTileSizePixel, const GraphicAttr* pAttr, - sal_uLong nFlags, ImplTileInfo& rTileInfo ); - - bool SVT_DLLPRIVATE ImplDrawTiled( OutputDevice* pOut, const Rectangle& rArea, const Size& rSizePixel, - const Size& rOffset, const GraphicAttr* pAttr, sal_uLong nFlags, int nTileCacheSize1D ); - - bool SVT_DLLPRIVATE ImplDrawTiled( OutputDevice& rOut, const Point& rPos, - int nNumTilesX, int nNumTilesY, - const Size& rTileSize, - const GraphicAttr* pAttr, sal_uLong nFlags ); - - void SVT_DLLPRIVATE ImplTransformBitmap( BitmapEx& rBmpEx, - const GraphicAttr& rAttr, - const Size& rCropLeftTop, - const Size& rCropRightBottom, - const Rectangle& rCropRect, - const Size& rDstSize, - sal_Bool bEnlarge ) const; + bool SVT_DLLPRIVATE ImplRenderTileRecursive( + VirtualDevice& rVDev, + int nExponent, + int nMSBFactor, + int nNumOrigTilesX, + int nNumOrigTilesY, + int nRemainderTilesX, + int nRemainderTilesY, + const Size& rTileSizePixel, + const GraphicAttr* pAttr, + sal_uLong nFlags, + ImplTileInfo& rTileInfo + ); + + bool SVT_DLLPRIVATE ImplDrawTiled( + OutputDevice* pOut, + const Rectangle& rArea, + const Size& rSizePixel, + const Size& rOffset, + const GraphicAttr* pAttr, + sal_uLong nFlags, + int nTileCacheSize1D + ); + + bool SVT_DLLPRIVATE ImplDrawTiled( + OutputDevice& rOut, + const Point& rPos, + int nNumTilesX, + int nNumTilesY, + const Size& rTileSize, + const GraphicAttr* pAttr, + sal_uLong nFlags + ); + + void SVT_DLLPRIVATE ImplTransformBitmap( + BitmapEx& rBmpEx, + const GraphicAttr& rAttr, + const Size& rCropLeftTop, + const Size& rCropRightBottom, + const Rectangle& rCropRect, + const Size& rDstSize, + sal_Bool bEnlarge + ) const; DECL_LINK( ImplAutoSwapOutHdl, void* ); @@ -312,7 +347,7 @@ protected: virtual SvStream* GetSwapStream() const; // !!! to be removed - virtual sal_uLong GetReleaseFromCache() const; + virtual sal_uLong GetReleaseFromCache() const; virtual void Load( SvStream& ); virtual void Save( SvStream& ); @@ -330,14 +365,14 @@ public: ~GraphicObject(); GraphicObject& operator=( const GraphicObject& rCacheObj ); - sal_Bool operator==( const GraphicObject& rCacheObj ) const; - sal_Bool operator!=( const GraphicObject& rCacheObj ) const { return !( *this == rCacheObj ); } + sal_Bool operator==( const GraphicObject& rCacheObj ) const; + sal_Bool operator!=( const GraphicObject& rCacheObj ) const { return !( *this == rCacheObj ); } - sal_Bool HasSwapStreamHdl() const { return( mpSwapStreamHdl != NULL && mpSwapStreamHdl->IsSet() ); } + sal_Bool HasSwapStreamHdl() const { return( mpSwapStreamHdl != NULL && mpSwapStreamHdl->IsSet() ); } void SetSwapStreamHdl(); void SetSwapStreamHdl( const Link& rHdl, const sal_uLong nSwapOutTimeout = 0UL ); Link GetSwapStreamHdl() const; - sal_uLong GetSwapOutTimeout() const { return( mpSwapOutTimer ? mpSwapOutTimer->GetTimeout() : 0 ); } + sal_uLong GetSwapOutTimeout() const { return( mpSwapOutTimer ? mpSwapOutTimer->GetTimeout() : 0 ); } void FireSwapInRequest(); void FireSwapOutRequest(); @@ -345,8 +380,13 @@ public: void SetGraphicManager( const GraphicManager& rMgr ); GraphicManager& GetGraphicManager() const { return *mpMgr; } - sal_Bool IsCached( OutputDevice* pOut, const Point& rPt, const Size& rSz, - const GraphicAttr* pAttr = NULL, sal_uLong nFlags = GRFMGR_DRAW_STANDARD) const; + sal_Bool IsCached( + OutputDevice* pOut, + const Point& rPt, + const Size& rSz, + const GraphicAttr* pAttr = NULL, + sal_uLong nFlags = GRFMGR_DRAW_STANDARD + ) const; void ReleaseFromCache(); const Graphic& GetGraphic() const; @@ -378,18 +418,22 @@ public: @return the readily transformed Graphic */ - Graphic GetTransformedGraphic( const Size& rDestSize, const MapMode& rDestMap, const GraphicAttr& rAttr ) const; + Graphic GetTransformedGraphic( + const Size& rDestSize, + const MapMode& rDestMap, + const GraphicAttr& rAttr + ) const; Graphic GetTransformedGraphic( const GraphicAttr* pAttr = NULL ) const; // TODO: Change to Impl void SetAttr( const GraphicAttr& rAttr ); const GraphicAttr& GetAttr() const { return maAttr; } - sal_Bool HasLink() const { return( mpLink != NULL && mpLink->Len() > 0 ); } + sal_Bool HasLink() const { return( mpLink != NULL && mpLink->Len() > 0 ); } void SetLink(); void SetLink( const String& rLink ); String GetLink() const; - sal_Bool HasUserData() const { return( mpUserData != NULL && mpUserData->Len() > 0 ); } + sal_Bool HasUserData() const { return( mpUserData != NULL && mpUserData->Len() > 0 ); } void SetUserData(); void SetUserData( const String& rUserData ); String GetUserData() const; @@ -409,28 +453,35 @@ public: sal_Bool HasRenderGraphic() const { return mbHasRenderGraphic; } void ResetAnimationLoopCount(); - List* GetAnimationInfoList() const; Link GetAnimationNotifyHdl() const { return maGraphic.GetAnimationNotifyHdl(); } void SetAnimationNotifyHdl( const Link& rLink ); - sal_Bool SwapOut(); - sal_Bool SwapOut( SvStream* pOStm ); - sal_Bool SwapIn(); - sal_Bool SwapIn( SvStream* pIStm ); + sal_Bool SwapOut(); + sal_Bool SwapOut( SvStream* pOStm ); + sal_Bool SwapIn(); + sal_Bool SwapIn( SvStream* pIStm ); - sal_Bool IsInSwapIn() const { return mbIsInSwapIn; } - sal_Bool IsInSwapOut() const { return mbIsInSwapOut; } - sal_Bool IsInSwap() const { return( mbIsInSwapOut || mbIsInSwapOut ); } - sal_Bool IsSwappedOut() const { return( mbAutoSwapped || maGraphic.IsSwapOut() ); } + sal_Bool IsInSwapIn() const { return mbIsInSwapIn; } + sal_Bool IsInSwapOut() const { return mbIsInSwapOut; } + sal_Bool IsInSwap() const { return( mbIsInSwapOut || mbIsInSwapOut ); } + sal_Bool IsSwappedOut() const { return( mbAutoSwapped || maGraphic.IsSwapOut() ); } void SetSwapState(); - sal_Bool Draw( OutputDevice* pOut, const Point& rPt, const Size& rSz, - const GraphicAttr* pAttr = NULL, sal_uLong nFlags = GRFMGR_DRAW_STANDARD ); - - sal_Bool DrawWithPDFHandling( OutputDevice& rOutDev, - const Point& rPt, const Size& rSz, - const GraphicAttr* pGrfAttr = NULL, - const sal_uLong nFlags = GRFMGR_DRAW_STANDARD ); + sal_Bool Draw( + OutputDevice* pOut, + const Point& rPt, + const Size& rSz, + const GraphicAttr* pAttr = NULL, + sal_uLong nFlags = GRFMGR_DRAW_STANDARD + ); + + sal_Bool DrawWithPDFHandling( + OutputDevice& rOutDev, + const Point& rPt, + const Size& rSz, + const GraphicAttr* pGrfAttr = NULL, + const sal_uLong nFlags = GRFMGR_DRAW_STANDARD + ); /** Draw the graphic repeatedly into the given output rectangle @@ -465,26 +516,40 @@ public: @return sal_True, if drawing completed successfully */ - sal_Bool DrawTiled( OutputDevice* pOut, const Rectangle& rArea, const Size& rSize, - const Size& rOffset, const GraphicAttr* pAttr = NULL, - sal_uLong nFlags = GRFMGR_DRAW_STANDARD, int nTileCacheSize1D=128 ); - - sal_Bool StartAnimation( OutputDevice* pOut, const Point& rPt, const Size& rSz, long nExtraData = 0L, - const GraphicAttr* pAttr = NULL, sal_uLong nFlags = GRFMGR_DRAW_STANDARD, - OutputDevice* pFirstFrameOutDev = NULL ); + sal_Bool DrawTiled( + OutputDevice* pOut, + const Rectangle& rArea, + const Size& rSize, + const Size& rOffset, + const GraphicAttr* pAttr = NULL, + sal_uLong nFlags = GRFMGR_DRAW_STANDARD, + int nTileCacheSize1D=128 + ); + + sal_Bool StartAnimation( + OutputDevice* pOut, + const Point& rPt, + const Size& rSz, + long nExtraData = 0L, + const GraphicAttr* pAttr = NULL, + sal_uLong nFlags = GRFMGR_DRAW_STANDARD, + OutputDevice* pFirstFrameOutDev = NULL + ); void StopAnimation( OutputDevice* pOut = NULL, long nExtraData = 0L ); friend SvStream& operator<<( SvStream& rOStm, const GraphicObject& rGraphicObj ); friend SvStream& operator>>( SvStream& rIStm, GraphicObject& rGraphicObj ); - static GraphicObject CreateGraphicObjectFromURL( const ::rtl::OUString &rURL ); + static GraphicObject CreateGraphicObjectFromURL( const ::rtl::OUString &rURL ); }; // ------------------ // - GraphicManager - // ------------------ +typedef ::std::vector< GraphicObject* > GraphicObjectList_impl; + class SVT_DLLPUBLIC GraphicManager { friend class GraphicObject; @@ -492,86 +557,158 @@ class SVT_DLLPUBLIC GraphicManager private: - List maObjList; - GraphicCache* mpCache; - - GraphicManager( const GraphicManager& ) {} - GraphicManager& operator=( const GraphicManager& ) { return *this; } - - sal_Bool SVT_DLLPRIVATE ImplDraw( OutputDevice* pOut, const Point& rPt, - const Size& rSz, GraphicObject& rObj, - const GraphicAttr& rAttr, - const sal_uLong nFlags, sal_Bool& rCached ); - - sal_Bool SVT_DLLPRIVATE ImplCreateOutput( OutputDevice* pOut, const Point& rPt, const Size& rSz, - const BitmapEx& rBmpEx, const GraphicAttr& rAttr, - const sal_uLong nFlags, BitmapEx* pBmpEx = NULL ); - sal_Bool SVT_DLLPRIVATE ImplCreateOutput( OutputDevice* pOut, - const Point& rPt, const Size& rSz, - const GDIMetaFile& rMtf, const GraphicAttr& rAttr, - const sal_uLong nFlags, GDIMetaFile& rOutMtf, BitmapEx& rOutBmpEx ); - - sal_Bool SVT_DLLPRIVATE ImplCreateScaled( const BitmapEx& rBmpEx, - long* pMapIX, long* pMapFX, long* pMapIY, long* pMapFY, - long nStartX, long nEndX, long nStartY, long nEndY, - BitmapEx& rOutBmpEx ); - - sal_Bool SVT_DLLPRIVATE ImplCreateRotatedScaled( const BitmapEx& rBmpEx, - sal_uInt16 nRot10, const Size& rOutSzPix, const Size& rUntSzPix, - long* pMapIX, long* pMapFX, long* pMapIY, long* pMapFY, - long nStartX, long nEndX, long nStartY, long nEndY, - BitmapEx& rOutBmpEx ); - - static void SVT_DLLPRIVATE ImplAdjust( BitmapEx& rBmpEx, const GraphicAttr& rAttr, sal_uLong nAdjustmentFlags ); - static void SVT_DLLPRIVATE ImplAdjust( GDIMetaFile& rMtf, const GraphicAttr& rAttr, sal_uLong nAdjustmentFlags ); - static void SVT_DLLPRIVATE ImplAdjust( Animation& rAnimation, const GraphicAttr& rAttr, sal_uLong nAdjustmentFlags ); - - static void SVT_DLLPRIVATE ImplDraw( OutputDevice* pOut, const Point& rPt, const Size& rSz, - const GDIMetaFile& rMtf, const GraphicAttr& rAttr ); + GraphicObjectList_impl maObjList; + GraphicCache* mpCache; + + GraphicManager( const GraphicManager& ) {} + GraphicManager& operator=( const GraphicManager& ) { return *this; } + + sal_Bool SVT_DLLPRIVATE ImplDraw( + OutputDevice* pOut, + const Point& rPt, + const Size& rSz, + GraphicObject& rObj, + const GraphicAttr& rAttr, + const sal_uLong nFlags, + sal_Bool& rCached + ); + + sal_Bool SVT_DLLPRIVATE ImplCreateOutput( + OutputDevice* pOut, + const Point& rPt, + const Size& rSz, + const BitmapEx& rBmpEx, + const GraphicAttr& rAttr, + const sal_uLong nFlags, + BitmapEx* pBmpEx = NULL + ); + sal_Bool SVT_DLLPRIVATE ImplCreateOutput( + OutputDevice* pOut, + const Point& rPt, + const Size& rSz, + const GDIMetaFile& rMtf, + const GraphicAttr& rAttr, + const sal_uLong nFlags, + GDIMetaFile& rOutMtf, + BitmapEx& rOutBmpEx + ); + + sal_Bool SVT_DLLPRIVATE ImplCreateScaled( + const BitmapEx& rBmpEx, + long* pMapIX, + long* pMapFX, + long* pMapIY, + long* pMapFY, + long nStartX, + long nEndX, + long nStartY, + long nEndY, + BitmapEx& rOutBmpEx + ); + + sal_Bool SVT_DLLPRIVATE ImplCreateRotatedScaled( + const BitmapEx& rBmpEx, + sal_uInt16 nRot10, + const Size& rOutSzPix, + const Size& rUntSzPix, + long* pMapIX, + long* pMapFX, + long* pMapIY, + long* pMapFY, + long nStartX, + long nEndX, + long nStartY, + long nEndY, + BitmapEx& rOutBmpEx + ); + + static void SVT_DLLPRIVATE ImplAdjust( + BitmapEx& rBmpEx, + const GraphicAttr& rAttr, + sal_uLong nAdjustmentFlags + ); + static void SVT_DLLPRIVATE ImplAdjust( + GDIMetaFile& rMtf, + const GraphicAttr& rAttr, + sal_uLong nAdjustmentFlags + ); + static void SVT_DLLPRIVATE ImplAdjust( + Animation& rAnimation, + const GraphicAttr& rAttr, + sal_uLong nAdjustmentFlags + ); + + static void SVT_DLLPRIVATE ImplDraw( + OutputDevice* pOut, + const Point& rPt, + const Size& rSz, + const GDIMetaFile& rMtf, + const GraphicAttr& rAttr + ); // Only used by GraphicObject's Ctor's and Dtor's - void SVT_DLLPRIVATE ImplRegisterObj( const GraphicObject& rObj, Graphic& rSubstitute, - const ByteString* pID = NULL, - const GraphicObject* pCopyObj = NULL ); - void SVT_DLLPRIVATE ImplUnregisterObj( const GraphicObject& rObj ); - inline sal_Bool SVT_DLLPRIVATE ImplHasObjects() const { return( maObjList.Count() > 0UL ); } + void SVT_DLLPRIVATE ImplRegisterObj( + const GraphicObject& rObj, + Graphic& rSubstitute, + const ByteString* pID = NULL, + const GraphicObject* pCopyObj = NULL + ); + void SVT_DLLPRIVATE ImplUnregisterObj( const GraphicObject& rObj ); + inline sal_Bool SVT_DLLPRIVATE ImplHasObjects() const { return !maObjList.empty(); } // Only used in swap case by GraphicObject - void SVT_DLLPRIVATE ImplGraphicObjectWasSwappedOut( const GraphicObject& rObj ); - sal_Bool SVT_DLLPRIVATE ImplFillSwappedGraphicObject( const GraphicObject& rObj, Graphic& rSubstitute ); - void SVT_DLLPRIVATE ImplGraphicObjectWasSwappedIn( const GraphicObject& rObj ); + void SVT_DLLPRIVATE ImplGraphicObjectWasSwappedOut( const GraphicObject& rObj ); + sal_Bool SVT_DLLPRIVATE ImplFillSwappedGraphicObject( + const GraphicObject& rObj, + Graphic& rSubstitute + ); + void SVT_DLLPRIVATE ImplGraphicObjectWasSwappedIn( const GraphicObject& rObj ); - ByteString SVT_DLLPRIVATE ImplGetUniqueID( const GraphicObject& rObj ) const; + ByteString SVT_DLLPRIVATE ImplGetUniqueID( const GraphicObject& rObj ) const; public: - GraphicManager( sal_uLong nCacheSize = 10000000UL, sal_uLong nMaxObjCacheSize = 2400000UL ); - ~GraphicManager(); + GraphicManager( sal_uLong nCacheSize = 10000000UL, sal_uLong nMaxObjCacheSize = 2400000UL ); + ~GraphicManager(); - void SetMaxCacheSize( sal_uLong nNewCacheSize ); + void SetMaxCacheSize( sal_uLong nNewCacheSize ); sal_uLong GetMaxCacheSize() const; - void SetMaxObjCacheSize( sal_uLong nNewMaxObjSize, sal_Bool bDestroyGreaterCached = sal_False ); + void SetMaxObjCacheSize( + sal_uLong nNewMaxObjSize, + sal_Bool bDestroyGreaterCached = sal_False + ); sal_uLong GetMaxObjCacheSize() const; sal_uLong GetUsedCacheSize() const; sal_uLong GetFreeCacheSize() const; - void SetCacheTimeout( sal_uLong nTimeoutSeconds ); + void SetCacheTimeout( sal_uLong nTimeoutSeconds ); sal_uLong GetCacheTimeout() const; - void ClearCache(); - - void ReleaseFromCache( const GraphicObject& rObj ); - - sal_Bool IsInCache( OutputDevice* pOut, const Point& rPt, const Size& rSz, - const GraphicObject& rObj, const GraphicAttr& rAttr ) const; - - sal_Bool DrawObj( OutputDevice* pOut, const Point& rPt, const Size& rSz, - GraphicObject& rObj, const GraphicAttr& rAttr, - const sal_uLong nFlags, sal_Bool& rCached ); + void ClearCache(); + + void ReleaseFromCache( const GraphicObject& rObj ); + + sal_Bool IsInCache( + OutputDevice* pOut, + const Point& rPt, + const Size& rSz, + const GraphicObject& rObj, + const GraphicAttr& rAttr + ) const; + + sal_Bool DrawObj( + OutputDevice* pOut, + const Point& rPt, + const Size& rSz, + GraphicObject& rObj, + const GraphicAttr& rAttr, + const sal_uLong nFlags, + sal_Bool& rCached + ); }; #endif // _GRFMGR_HXX -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/inc/svtools/helpopt.hxx b/svtools/inc/svtools/helpopt.hxx index 5947b8d034b1..92a2ad3793c7 100644 --- a/svtools/inc/svtools/helpopt.hxx +++ b/svtools/inc/svtools/helpopt.hxx @@ -85,10 +85,6 @@ public: void SetWelcomeScreen( sal_Bool b ); sal_Bool IsWelcomeScreen() const; - IdList* GetPIStarterList(); - void AddToPIStarterList( sal_Int32 nId ); - void RemoveFromPIStarterList( sal_Int32 nId ); - String GetLocale() const; String GetSystem() const; }; diff --git a/svtools/inc/svtools/imap.hxx b/svtools/inc/svtools/imap.hxx index 7e0124f70d0c..1d89ca30a49a 100644 --- a/svtools/inc/svtools/imap.hxx +++ b/svtools/inc/svtools/imap.hxx @@ -32,6 +32,7 @@ #include "svtools/svtdllapi.h" #include <tools/string.hxx> #include <tools/stream.hxx> +#include <vector> class Point; class Rectangle; @@ -45,22 +46,26 @@ class IMapObject; |* \******************************************************************************/ +typedef ::std::vector< IMapObject* > IMapObjectList_impl; + class SVT_DLLPUBLIC ImageMap { - List maList; +private: + + IMapObjectList_impl maList; String aName; protected: // Binaer laden/speichern void ImpWriteImageMap( SvStream& rOStm, const String& ) const ; - void ImpReadImageMap( SvStream& rIStm, sal_uInt16 nCount, const String& ); + void ImpReadImageMap( SvStream& rIStm, size_t nCount, const String& ); // Im-/Export void ImpWriteCERN( SvStream& rOStm, const String& rBaseURL ) const; void ImpWriteNCSA( SvStream& rOStm, const String& rBaseURL ) const; - sal_uLong ImpReadCERN( SvStream& rOStm, const String& rBaseURL ); - sal_uLong ImpReadNCSA( SvStream& rOStm, const String& rBaseURL ); + sal_uLong ImpReadCERN( SvStream& rOStm, const String& rBaseURL ); + sal_uLong ImpReadNCSA( SvStream& rOStm, const String& rBaseURL ); void ImpReadCERNLine( const ByteString& rLine, const String& rBaseURL ); Point ImpReadCERNCoords( const char** ppStr ); @@ -71,7 +76,7 @@ protected: String ImpReadNCSAURL( const char** ppStr, const String& rBaseURL ); Point ImpReadNCSACoords( const char** ppStr ); - sal_uLong ImpDetectFormat( SvStream& rIStm ); + sal_uLong ImpDetectFormat( SvStream& rIStm ); public: @@ -98,11 +103,10 @@ public: // Zugriff auf einzelne IMapObjekte; die Objekte // duerfen von aussen _nicht_ zerstoert werden - IMapObject* GetFirstIMapObject() { return (IMapObject*) maList.First(); } - IMapObject* GetNextIMapObject() { return (IMapObject*) maList.Next(); } - IMapObject* GetLastIMapObject() { return (IMapObject*) maList.Last(); } - IMapObject* GetPrevIMapObject() { return (IMapObject*) maList.Prev(); } - IMapObject* GetIMapObject( sal_uInt16 nPos ) const { return (IMapObject*) maList.GetObject( nPos ); } + IMapObject* GetIMapObject( size_t nPos ) const + { + return ( nPos < maList.size() ) ? maList[ nPos ] : NULL; + } // Gibt das Objekt zurueck, das zuerst getroffen wurde oder NULL; // Groessen- und Positionsangaben sind in 1/100mm; @@ -116,13 +120,13 @@ public: sal_uLong nFlags = 0 ); // Gibt die Gesamtanzahl der IMap-Objekte zurueck - sal_uInt16 GetIMapObjectCount() const { return (sal_uInt16) maList.Count(); } + size_t GetIMapObjectCount() const { return maList.size(); } // Loescht alle internen Objekte void ClearImageMap(); // liefert die aktuelle Versionsnummer - sal_uInt16 GetVersion() const; + sal_uInt16 GetVersion() const; // liefert / setzt den Namen der ImageMap const String& GetName() const { return aName; } diff --git a/svtools/inc/svtools/imapcirc.hxx b/svtools/inc/svtools/imapcirc.hxx index 1ae929374b4f..ea2168597e15 100644 --- a/svtools/inc/svtools/imapcirc.hxx +++ b/svtools/inc/svtools/imapcirc.hxx @@ -43,7 +43,7 @@ class Fraction; class SVT_DLLPUBLIC IMapCircleObject : public IMapObject { Point aCenter; - sal_uLong nRadius; + sal_Int32 nRadius; void ImpConstruct( const Point& rCenter, sal_uLong nRad, sal_Bool bPixel ); diff --git a/svtools/inc/svtools/imapobj.hxx b/svtools/inc/svtools/imapobj.hxx index fc907135fdaa..f97850c061de 100644 --- a/svtools/inc/svtools/imapobj.hxx +++ b/svtools/inc/svtools/imapobj.hxx @@ -32,6 +32,7 @@ #include "svtools/svtdllapi.h" #include <tools/string.hxx> #include <svl/macitem.hxx> +#include <rtl/strbuf.hxx> class Point; class Rectangle; @@ -77,7 +78,6 @@ class SVT_DLLPUBLIC IMapObject sal_Bool bActive; protected: - sal_uInt16 nReadVersion; // Binaer-Im-/Export @@ -85,10 +85,10 @@ protected: virtual void ReadIMapObject( SvStream& rIStm ) = 0; // Hilfsmethoden - void AppendCERNCoords( const Point& rPoint100, ByteString& rStr ) const; - void AppendCERNURL( ByteString& rStr, const String& rBaseURL ) const; - void AppendNCSACoords( const Point& rPoint100, ByteString& rStr ) const; - void AppendNCSAURL( ByteString& rStr, const String& rBaseURL ) const; + void AppendCERNCoords(rtl::OStringBuffer& rBuf, const Point& rPoint100) const; + void AppendCERNURL(rtl::OStringBuffer& rBuf, const String& rBaseURL) const; + void AppendNCSACoords(rtl::OStringBuffer& rBuf, const Point& rPoint100) const; + void AppendNCSAURL(rtl::OStringBuffer&rBuf, const String& rBaseURL) const; public: @@ -130,9 +130,6 @@ public: sal_Bool IsActive() const { return bActive; } void SetActive( sal_Bool bSetActive = sal_True ) { bActive = bSetActive; } - static Point GetPixelPoint( const Point& rLogPoint ); - static Point GetLogPoint( const Point& rPixelPoint ); - sal_Bool IsEqual( const IMapObject& rEqObj ); // IMap-Events diff --git a/svtools/inc/svtools/ivctrl.hxx b/svtools/inc/svtools/ivctrl.hxx index 13bf8bcdd24a..ba3daeed58f4 100644 --- a/svtools/inc/svtools/ivctrl.hxx +++ b/svtools/inc/svtools/ivctrl.hxx @@ -341,8 +341,6 @@ public: SvxIconChoiceCtrlEntry* GetEntry( const Point& rPosPixel, sal_Bool bHit = sal_False ) const; // Gibt den naechsten ueber pCurEntry liegenden Eintrag (ZOrder) SvxIconChoiceCtrlEntry* GetNextEntry( const Point& rPosPixel, SvxIconChoiceCtrlEntry* pCurEntry, sal_Bool ) const; - // Gibt den naechsten unter pCurEntry liegenden Eintrag (ZOrder) - SvxIconChoiceCtrlEntry* GetPrevEntry( const Point& rPosPixel, SvxIconChoiceCtrlEntry* pCurEntry, sal_Bool ) const; // in dem sal_uLong wird die Position in der Liste des gefunden Eintrags zurueckgegeben SvxIconChoiceCtrlEntry* GetSelectedEntry( sal_uLong& rPos ) const; diff --git a/svtools/inc/svtools/prnsetup.hxx b/svtools/inc/svtools/prnsetup.hxx index a7155032a238..4fc096c5a85e 100644 --- a/svtools/inc/svtools/prnsetup.hxx +++ b/svtools/inc/svtools/prnsetup.hxx @@ -90,7 +90,6 @@ public: virtual short Execute(); void SetOptionsHdl( const Link& rLink ); - const Link& GetOptionsHdl() const; }; // -------------------------------------- diff --git a/svtools/inc/svtools/svicnvw.hxx b/svtools/inc/svtools/svicnvw.hxx deleted file mode 100644 index 30773b101547..000000000000 --- a/svtools/inc/svtools/svicnvw.hxx +++ /dev/null @@ -1,289 +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. - * - ************************************************************************/ - -#ifndef _SVICNVW_HXX -#define _SVICNVW_HXX - -#include <vcl/image.hxx> -#include <svtools/svlbox.hxx> - -class SvImpIconView; -class SvLBoxEntry; -class SvLBoxItem; -class SvLBoxString; -class SvLBoxContextBmp; -class SvPtrarr; - -#define WB_ICON 0x0001 -#define WB_NAME 0x0002 -#define WB_TEXT 0x0004 -#define WB_FLOW 0x0008 - -#define ICNVW_FLAG_POS_LOCKED 0x0001 -#define ICNVW_FLAG_USER1 0x1000 -#define ICNVW_FLAG_USER2 0x2000 -#define ICNVW_FLAG_USER3 0x4000 -#define ICNVW_FLAG_USER4 0x8000 - -enum SvIconViewTextMode -{ - ShowTextFull = 1, - ShowTextShort, - ShowTextSmart, // not implemented - ShowTextDontKnow // only for entries (uses config? from the view) -}; - -class SvIcnVwDataEntry : public SvViewDataEntry -{ -friend class SvImpIconView; - sal_uInt16 nIcnVwFlags; - SvIconViewTextMode eTextMode; -public: - Rectangle aRect; // Bounding-Rect of the Entry - Rectangle aGridRect; // set in grid mode - Size aTextSize; // set in grid mode only - sal_uInt16 nX,nY; // for keyboard control - SvIcnVwDataEntry(); - virtual ~SvIcnVwDataEntry(); - - sal_Bool IsEntryPosLocked() const { return (sal_Bool)((nIcnVwFlags & ICNVW_FLAG_POS_LOCKED) !=0); } - void ClearVwFlags( sal_uInt16 nMask ) { nIcnVwFlags &= (~nMask); } - void SetVwFlags( sal_uInt16 nMask ) { nIcnVwFlags |= nMask; } - sal_uInt16 GetVwFlags() const { return nIcnVwFlags; } - SvIconViewTextMode GetTextMode() const { return eTextMode; } -}; - -#define SV_LISTBOX_ID_ICONVIEW 2 - -class SvIconView : public SvLBox -{ - friend class SvImpIconView; - - SvImpIconView* pImp; - Image aCollapsedEntryBmp; - Image aExpandedEntryBmp; - sal_uInt16 nIcnVwFlags; - void SetModel( SvLBoxTreeList* ); - -protected: - - using SvLBox::CreateEntry; - SvLBoxEntry* CreateEntry( const XubString&, const Image&, const Image&); - void ViewDataInitialized( SvLBoxEntry* ); - virtual SvViewData* CreateViewData( SvListEntry* ); - virtual void InitViewData( SvViewData* pData, SvListEntry* pEntry ); - - void EditingRequest(SvLBoxEntry*,SvLBoxItem*,const Point& ); - void EditedText( const XubString& ); - void EditItemText( SvLBoxEntry*,SvLBoxItem*,const Selection& ); - SvLBoxEntry* pCurEdEntry; - SvLBoxItem* pCurEdItem; - - virtual void WriteDragServerInfo( const Point&, SvLBoxDDInfo* ); - virtual void ReadDragServerInfo( const Point&, SvLBoxDDInfo* ); - virtual void Command( const CommandEvent& rCEvt ); - virtual void PreparePaint( SvLBoxEntry* ); - virtual void StateChanged( StateChangedType nStateChange ); - -public: - - SvIconView( Window* pParent,WinBits nWinStyle=0 ); - SvIconView( Window* pParent,const ResId& rResId ); - ~SvIconView(); - - void DisconnectFromModel(); - - SvLBoxEntry* InsertEntry( const XubString& rText, SvLBoxEntry* pParent = 0, - sal_Bool bChildsOnDemand = sal_False, - sal_uLong nPos=LIST_APPEND ); - - SvLBoxEntry* InsertEntry( const XubString& rText, - const Image& rExpandedEntryBmp, - const Image& rCollapsedEntryBmp, - SvLBoxEntry* pParent = 0, - sal_Bool bChildsOnDemand = sal_False, - sal_uLong nPos = LIST_APPEND ); - - const Image& GetDefaultExpandedEntryBmp() const { return aExpandedEntryBmp;} - const Image& GetDefaultCollapsedEntryBmp() const { return aCollapsedEntryBmp;} - void SetDefaultExpandedEntryBmp( const Image& rBmp) { aExpandedEntryBmp=rBmp;} - void SetDefaultCollapsedEntryBmp( const Image& rBmp ) { aCollapsedEntryBmp=rBmp;} - - void SetEntryText(SvLBoxEntry*, const XubString& ); - void SetExpandedEntryBmp(SvLBoxEntry*, const Image& ); - void SetCollapsedEntryBmp(SvLBoxEntry*, const Image& ); - - XubString GetEntryText(SvLBoxEntry*) const; - Image GetExpandedEntryBmp(SvLBoxEntry*) const; - Image GetCollapsedEntryBmp(SvLBoxEntry*) const; - - virtual SvLBoxEntry* CloneEntry( SvLBoxEntry* pSource ); - - virtual sal_uInt16 IsA(); - - virtual void RequestingChilds( SvLBoxEntry* pParent ); - - virtual void Paint( const Rectangle& rRect ); - virtual void MouseButtonDown( const MouseEvent& rMEvt ); - virtual void MouseButtonUp( const MouseEvent& rMEvt ); - virtual void MouseMove( const MouseEvent& rMEvt ); - virtual void KeyInput( const KeyEvent& rKEvt ); - virtual void Resize(); - virtual void GetFocus(); - virtual void LoseFocus(); - void SetUpdateMode( sal_Bool ); - - using SvListView::SetModel; - virtual void SetModel( SvLBoxTreeList*, SvLBoxEntry* pParent ); - virtual void ModelHasCleared(); - virtual void ModelHasInserted( SvListEntry* pEntry ); - virtual void ModelHasInsertedTree( SvListEntry* pEntry ); - virtual void ModelIsMoving(SvListEntry* pSource, - SvListEntry* pTargetParent, sal_uLong nChildPos ); - virtual void ModelHasMoved(SvListEntry* pSource ); - virtual void ModelIsRemoving( SvListEntry* pEntry ); - virtual void ModelHasRemoved( SvListEntry* pEntry ); - virtual void ModelHasEntryInvalidated( SvListEntry* pEntry ); - - virtual void ShowTargetEmphasis( SvLBoxEntry*, sal_Bool bShow ); - using Window::GetDropTarget; - virtual SvLBoxEntry* GetDropTarget( const Point& ); - virtual Region GetDragRegion() const; - // NotifyMoving/Copying is overloaded, since GetDropTarget - // returns a "magic pointer" if the drop happens in/on an empty - // area(?) of the IconView - virtual sal_Bool NotifyMoving( SvLBoxEntry* pTarget, SvLBoxEntry* pEntry, - SvLBoxEntry*& rpNewParent, sal_uLong& rNewChildPos); - virtual sal_Bool NotifyCopying( SvLBoxEntry* pTarget, SvLBoxEntry* pEntry, - SvLBoxEntry*& rpNewParent, sal_uLong& rNewChildPos); - - // returns TopLeft of the BoundingRect. Add MapMode.Origin to get the - // position relative to the window - Point GetEntryPosition( SvLBoxEntry* ) const; - void SetEntryPosition( SvLBoxEntry*, const Point& rDocPos); - void SetEntryPosition( SvLBoxEntry*, const Point& rDocPos, - sal_Bool bAdjustAtGrid ); - - void SetFont( const Font& rFont ); - void SetDefaultFont(); - - using SvLBox::GetEntry; - SvLBoxEntry* GetEntry( const Point& rPixPos, sal_Bool ) const; - // returns the entry just above pCurEntry (z-wise) - SvLBoxEntry* GetNextEntry( const Point& rPixPos, SvLBoxEntry* pCurEntry, sal_Bool ) const; - // returns the entry just below pCurEntry (z-wise) - SvLBoxEntry* GetPrevEntry( const Point& rPixPos, SvLBoxEntry* pCurEntry, sal_Bool ) const; - - SvLBoxEntry* GetEntryFromLogicPos( const Point& rDocPos ) const; - - virtual void PaintEntry( SvLBoxEntry* ); - virtual void PaintEntry( SvLBoxEntry*, const Point& rDocPos ); - Rectangle GetFocusRect( SvLBoxEntry* ); - void InvalidateEntry( SvLBoxEntry* ); - void MakeVisible( SvLBoxEntry* ); - - void SetDragDropMode( DragDropMode ); - void SetSelectionMode( SelectionMode ); - - using SvListView::Select; - sal_Bool Select( SvLBoxEntry* pEntry, sal_Bool bSelect=sal_True ); - void SelectAll( sal_Bool bSelect, sal_Bool bPaint=sal_True ); - virtual void SetCurEntry( SvLBoxEntry* _pEntry ); - virtual SvLBoxEntry* - GetCurEntry() const; - - // locigal coordinates - void SelectRect( - const Rectangle& rRect, - sal_Bool bAdd = sal_False, - // inverts the intersection with rRect - // (ignored if bAdd == sal_False) - SvPtrarr* pOtherRects = 0, - short nBorderOffs = -5 ); - sal_uLong GetSelectionCount() const; - - virtual void Arrange(); - void SetSpaceBetweenEntries( long nHor, long Ver ); - long GetHorSpaceBetweenEntries(); - long GetVerSpaceBetweenEntries(); - - void EnableInplaceEditing( sal_Bool bEnable ); - void EditEntry( SvLBoxEntry* pEntry = 0 ); - virtual sal_Bool EditingEntry( SvLBoxEntry* pEntry, Selection& ); - virtual sal_Bool EditedEntry( SvLBoxEntry*, const XubString& rNewText ); - - void SetCurParent( SvLBoxEntry* pNewParent ); - SvLBoxEntry* GetCurParent() const; - - virtual void ModelNotification( sal_uInt16 nActionId, SvListEntry* pEntry1, - SvListEntry* pEntry2, sal_uLong nPos ); - - // pass (0, 0) to switch off grid mode - void SetGrid( long nDX, long nDY ); - - // nDeltaY < 0 : View moves up relative to Doc - // nDeltaY > 0 : View moves down relative to Doc - // nDeltaX < 0 : View moves left relative to Doc - // nDeltaX > 0 : View moves right relative to Doc - using Window::Scroll; - virtual void Scroll( long nDeltaX, long nDeltaY, sal_uInt16 nFlags = 0 ); - - virtual void PrepareCommandEvent( const CommandEvent& ); - virtual void StartDrag( sal_Int8 nAction, const Point& ); - virtual void DragFinished( sal_Int8 ); - virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ); - using SvLBox::ExecuteDrop; - virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ); - - void ShowDDIcon( SvLBoxEntry* pRefEntry, const Point& rPos ); - void HideDDIcon(); - void HideShowDDIcon( SvLBoxEntry* pRefEntry, const Point& rPos ); - - // to scroll during Drag&Drop - void CalcScrollOffsets( - const Point& rRefPosPixel, - long& rScrollX, - long& rScrollY, - sal_Bool bInDragDrop = sal_False, - sal_uInt16 nBorderWidth = 10 ); - - using Window::EndTracking; - void EndTracking(); - void AdjustAtGrid( SvLBoxEntry* pEntry = 0 ); - void LockEntryPos( SvLBoxEntry* pEntry, sal_Bool bLock = sal_True ); - sal_Bool IsEntryPosLocked( const SvLBoxEntry* pEntry ) const; - - void SetTextMode( SvIconViewTextMode, SvLBoxEntry* pEntry = 0 ); - SvIconViewTextMode GetTextMode( const SvLBoxEntry* pEntry = 0 ) const; - - void ShowFocusRect( const SvLBoxEntry* pEntry ); -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/inc/svtools/svtreebx.hxx b/svtools/inc/svtools/svtreebx.hxx index 6edd32110317..96adfe73aea9 100644 --- a/svtools/inc/svtools/svtreebx.hxx +++ b/svtools/inc/svtools/svtreebx.hxx @@ -369,6 +369,8 @@ public: SvLBoxEntry* GetFirstEntryInView() const; SvLBoxEntry* GetNextEntryInView(SvLBoxEntry*) const; + SvLBoxEntry* GetLastEntryInView() const; + void ScrollToAbsPos( long nPos ); void ShowFocusRect( const SvLBoxEntry* pEntry ); void SetTabBar( TabBar* pTabBar ); diff --git a/svtools/inc/svtools/syntaxhighlight.hxx b/svtools/inc/svtools/syntaxhighlight.hxx index a9a0c5a2da58..f4bcca15a68d 100644 --- a/svtools/inc/svtools/syntaxhighlight.hxx +++ b/svtools/inc/svtools/syntaxhighlight.hxx @@ -129,14 +129,6 @@ class SimpleTokenizer_Impl sal_Bool getNextToken( /*out*/TokenTypes& reType, /*out*/const sal_Unicode*& rpStartPos, /*out*/const sal_Unicode*& rpEndPos ); - String getTokStr( /*out*/const sal_Unicode* pStartPos, /*out*/const sal_Unicode* pEndPos ); - -#ifdef DBG_UTIL - // TEST: Token ausgeben - String getFullTokenStr( /*out*/TokenTypes eType, - /*out*/const sal_Unicode* pStartPos, /*out*/const sal_Unicode* pEndPos ); -#endif - const char** ppListKeyWords; sal_uInt16 nKeyWordCount; diff --git a/svtools/inc/svtools/tabbar.hxx b/svtools/inc/svtools/tabbar.hxx index a8bdabdb6432..1478b0e690dd 100644 --- a/svtools/inc/svtools/tabbar.hxx +++ b/svtools/inc/svtools/tabbar.hxx @@ -450,7 +450,6 @@ public: void Clear(); - void EnablePage( sal_uInt16 nPageId, sal_Bool bEnable = sal_True ); sal_Bool IsPageEnabled( sal_uInt16 nPageId ) const; void SetPageBits( sal_uInt16 nPageId, TabBarPageBits nBits = 0 ); @@ -472,10 +471,6 @@ public: void MakeVisible( sal_uInt16 nPageId ); void SelectPage( sal_uInt16 nPageId, sal_Bool bSelect = sal_True ); - void SelectPageRange( sal_Bool bSelect = sal_False, - sal_uInt16 nStartPos = 0, - sal_uInt16 nEndPos = TabBar::APPEND ); - sal_uInt16 GetSelectPage( sal_uInt16 nSelIndex = 0 ) const; sal_uInt16 GetSelectPageCount() const; sal_Bool IsPageSelected( sal_uInt16 nPageId ) const; @@ -519,24 +514,17 @@ public: void EndSwitchPage(); sal_Bool IsInSwitching() { return mbInSwitching; } - void SetSelectColor(); - void SetSelectColor( const Color& rColor ); const Color& GetSelectColor() const { return maSelColor; } sal_Bool IsSelectColor() const { return mbSelColor; } - void SetSelectTextColor(); - void SetSelectTextColor( const Color& rColor ); const Color& GetSelectTextColor() const { return maSelTextColor; } sal_Bool IsSelectTextColor() const { return mbSelTextColor; } void SetPageText( sal_uInt16 nPageId, const XubString& rText ); XubString GetPageText( sal_uInt16 nPageId ) const; - void SetHelpText( sal_uInt16 nPageId, const XubString& rText ); XubString GetHelpText( sal_uInt16 nPageId ) const; - void SetHelpId( sal_uInt16 nPageId, const rtl::OString& nHelpId ); rtl::OString GetHelpId( sal_uInt16 nPageId ) const; long GetSplitSize() const { return mnSplitSize; } - long GetMinSize() const; void SetHelpText( const XubString& rText ) { Window::SetHelpText( rText ); } diff --git a/svtools/inc/svtools/taskbar.hxx b/svtools/inc/svtools/taskbar.hxx index 4fb126e5eefe..c29fe770f757 100644 --- a/svtools/inc/svtools/taskbar.hxx +++ b/svtools/inc/svtools/taskbar.hxx @@ -88,9 +88,7 @@ TaskStatusBar kann auch ein Notify-Object gesetzt werden, wenn man benachrichtigt werden will, wenn die Uhrzeit oder die TaskStatusBar angeklickt wird. Wenn der Notify fuer die Uhrzeit kommt, ist die Id TASKSTATUSBAR_CLOCKID, wenn er fuer die TaskStatusBar kommt, ist -die Id 0. Mit SetFieldFlags() kann am TaskStatusBar auch die Flags -hinterher umgesetzt werden, um zum Beispiel die Uhrzeit ein- und -auszuschalten. +die Id 0. TaskBar @@ -253,11 +251,6 @@ private: public: TaskStatusFieldItem(); TaskStatusFieldItem( const TaskStatusFieldItem& rItem ); - TaskStatusFieldItem( ITaskStatusNotify* pNotify, - const Image& rImage, - const XubString& rQuickHelpText, - const XubString& rHelpText, - sal_uInt16 nFlags ); ~TaskStatusFieldItem(); void SetNotifyObject( ITaskStatusNotify* pNotify ) { mpNotify = pNotify; } @@ -331,16 +324,9 @@ public: sal_uInt16 nFlags = TASKSTATUSFIELD_CLOCK ); void RemoveStatusField() { maTimer.Stop(); RemoveItem( TASKSTATUSBAR_STATUSFIELDID ); } - void SetFieldFlags( sal_uInt16 nFlags ); sal_uInt16 GetFieldFlags() const { return mnFieldFlags; } void SetNotifyObject( ITaskStatusNotify* pNotify ) { mpNotify = pNotify; } ITaskStatusNotify* GetNotifyObject() const { return mpNotify; } - - void AddStatusFieldItem( sal_uInt16 nItemId, const TaskStatusFieldItem& rItem, - sal_uInt16 nPos = 0xFFFF ); - void ModifyStatusFieldItem( sal_uInt16 nItemId, const TaskStatusFieldItem& rItem ); - void RemoveStatusFieldItem( sal_uInt16 nItemId ); - sal_Bool GetStatusFieldItem( sal_uInt16 nItemId, TaskStatusFieldItem& rItem ) const; }; // ----------- @@ -403,14 +389,9 @@ public: void Format(); - void SetLines( sal_uInt16 nLines ); sal_uInt16 GetLines() const { return mnLines; } - void EnableAutoHide( sal_Bool bAutoHide = sal_True ); sal_Bool IsAutoHideEnabled() const { return mbAutoHide; } - void ShowStatusText( const String& rText ); - void HideStatusText(); - void SetStatusSize( long nNewSize ) { mnStatusWidth=nNewSize; Resize(); } long GetStatusSize() const { return mnStatusWidth; } @@ -440,30 +421,39 @@ class ImplWindowArrangeList; // - class WindowArrange - // ----------------------- +typedef ::std::vector< Window* > WindowList_impl; + class SVT_DLLPUBLIC WindowArrange { private: - List* mpWinList; - void* mpDummy; - sal_uLong mnDummy; + WindowList_impl maWinList; #ifdef _TASKBAR_CXX - SVT_DLLPRIVATE void ImplTile( const Rectangle& rRect ); - SVT_DLLPRIVATE void ImplHorz( const Rectangle& rRect ); - SVT_DLLPRIVATE void ImplVert( const Rectangle& rRect ); - SVT_DLLPRIVATE void ImplCascade( const Rectangle& rRect ); + SVT_DLLPRIVATE void ImplTile( const Rectangle& rRect ); + SVT_DLLPRIVATE void ImplHorz( const Rectangle& rRect ); + SVT_DLLPRIVATE void ImplVert( const Rectangle& rRect ); + SVT_DLLPRIVATE void ImplCascade( const Rectangle& rRect ); #endif public: - WindowArrange(); - ~WindowArrange(); - - void AddWindow( Window* pWindow, sal_uLong nPos = LIST_APPEND ) - { mpWinList->Insert( (void*)pWindow, nPos ); } - void RemoveAllWindows() - { mpWinList->Clear(); } - - void Arrange( sal_uInt16 nType, const Rectangle& rRect ); + WindowArrange(); + ~WindowArrange(); + + void AddWindow( Window* pWindow, size_t nPos = size_t(-1) ) + { + if ( nPos < maWinList.size() ) { + maWinList.insert( maWinList.begin() + nPos, pWindow ); + } else { + maWinList.push_back( pWindow ); + } + } + + void RemoveAllWindows() + { + maWinList.clear(); + } + + void Arrange( sal_uInt16 nType, const Rectangle& rRect ); }; #endif // _TASKBAR_HXX diff --git a/svtools/inc/svtools/texteng.hxx b/svtools/inc/svtools/texteng.hxx index ba2c440f6d98..e9f0b6c51b06 100644 --- a/svtools/inc/svtools/texteng.hxx +++ b/svtools/inc/svtools/texteng.hxx @@ -196,7 +196,6 @@ protected: void FormatAndUpdate( TextView* pCurView = 0 ); sal_Bool IsFormatting() const { return mbIsFormatting; } void UpdateViews( TextView* pCurView = 0 ); - void SetUpdateMode( sal_Bool bUp, TextView* pCurView, sal_Bool bForceUpdate ); void ImpPaint( OutputDevice* pOut, const Point& rStartPos, Rectangle const* pPaintArea, TextSelection const* pPaintRange = 0, TextSelection const* pSelection = 0 ); @@ -245,7 +244,6 @@ public: void SetFont( const Font& rFont ); const Font& GetFont() const { return maFont; } - void SetDefTab( sal_uInt16 nDefTab ); sal_uInt16 GetDefTab() const; void SetLeftMargin( sal_uInt16 n ); @@ -325,7 +323,6 @@ public: ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XBreakIterator > GetBreakIterator(); static sal_Bool DoesKeyChangeText( const KeyEvent& rKeyEvent ); - static sal_Bool DoesKeyMoveCursor( const KeyEvent& rKeyEvent ); static sal_Bool IsSimpleCharInput( const KeyEvent& rKeyEvent ); }; diff --git a/svtools/inc/svtools/textview.hxx b/svtools/inc/svtools/textview.hxx index de8da807a3dd..ebf7a4f6f2eb 100644 --- a/svtools/inc/svtools/textview.hxx +++ b/svtools/inc/svtools/textview.hxx @@ -156,7 +156,6 @@ public: void Redo(); sal_Bool Read( SvStream& rInput ); - sal_Bool Write( SvStream& rOutput ); void SetStartDocPos( const Point& rPos ); const Point& GetStartDocPos() const; @@ -168,7 +167,6 @@ public: sal_Bool IsInsertMode() const; void SetAutoIndentMode( sal_Bool bAutoIndent ); - sal_Bool IsAutoIndentMode() const; void SetReadOnly( sal_Bool bReadOnly ); sal_Bool IsReadOnly() const; @@ -180,10 +178,6 @@ public: sal_Bool IsSelectionAtPoint( const Point& rPointPixel ); void SetPaintSelection( sal_Bool bPaint); - sal_Bool IsPaintSelection() const; - - void SetHighlightSelection( sal_Bool bSelectByHighlight ); - sal_Bool IsHighlightSelection() const; void EraseVirtualDevice(); @@ -204,10 +198,6 @@ public: TextPaM CursorStartOfDoc(); TextPaM CursorEndOfDoc(); - // Old, remove! - TextPaM CursorLeft( const TextPaM& rPaM, sal_Bool bWordMode = sal_False ); - TextPaM CursorRight( const TextPaM& rPaM, sal_Bool bWordMode = sal_False ); - /** Drag and Drop, deleting and selection regards all text that has an attribute TEXTATTR_PROTECTED set as one entitity. Drag and dropped text is automatically diff --git a/svtools/inc/svtools/transfer.hxx b/svtools/inc/svtools/transfer.hxx index 397dccfc0fe6..3b0d961a3623 100644 --- a/svtools/inc/svtools/transfer.hxx +++ b/svtools/inc/svtools/transfer.hxx @@ -267,10 +267,7 @@ protected: sal_Bool SetTransferableObjectDescriptor( const TransferableObjectDescriptor& rDesc, const ::com::sun::star::datatransfer::DataFlavor& rFlavor ); sal_Bool SetINetBookmark( const INetBookmark& rBmk, const ::com::sun::star::datatransfer::DataFlavor& rFlavor ); sal_Bool SetINetImage( const INetImage& rINtImg, const ::com::sun::star::datatransfer::DataFlavor& rFlavor ); - sal_Bool SetFileList( const FileList& rFileList, const ::com::sun::star::datatransfer::DataFlavor& rFlavor ); sal_Bool SetObject( void* pUserObject, sal_uInt32 nUserObjectId, const ::com::sun::star::datatransfer::DataFlavor& rFlavor ); - sal_Bool SetInterface( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rIf, - const ::com::sun::star::datatransfer::DataFlavor& rFlavor ); protected: @@ -398,7 +395,6 @@ public: sal_Bool GetInputStream( SotFormatStringId nFormat, ::com::sun::star::uno::Reference < com::sun::star::io::XInputStream >& xStream ); sal_Bool GetInputStream( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, ::com::sun::star::uno::Reference < com::sun::star::io::XInputStream >& xStream ); - sal_Bool GetInterface( SotFormatStringId nFormat, ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rIf ); sal_Bool GetInterface( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rIf ); public: @@ -565,8 +561,6 @@ public: TransferDataContainer(); ~TransferDataContainer(); - void ClearData(); - void CopyINetBookmark( const INetBookmark& rBkmk ); void CopyINetImage( const INetImage& rINtImg ); void CopyImageMap( const ImageMap& rImgMap ); diff --git a/svtools/inc/svtools/treelist.hxx b/svtools/inc/svtools/treelist.hxx index 6c296d26ea44..63545ed30cc1 100644 --- a/svtools/inc/svtools/treelist.hxx +++ b/svtools/inc/svtools/treelist.hxx @@ -494,9 +494,15 @@ public: SvListEntry* LastSelected() const { return pModel->LastSelected(this); } + SvListEntry* GetEntryAtAbsPos( sal_uLong nAbsPos ) const + { return pModel->GetEntryAtAbsPos(nAbsPos); } + SvListEntry* GetEntryAtVisPos( sal_uLong nVisPos ) const { return pModel->GetEntryAtVisPos((SvListView*)this,nVisPos); } + sal_uLong GetAbsPos( SvListEntry* pEntry ) const + { return pModel->GetAbsPos(pEntry); } + sal_uLong GetVisiblePos( SvListEntry* pEntry ) const { return pModel->GetVisiblePos((SvListView*)this,pEntry); } diff --git a/svtools/inc/svtools/txtattr.hxx b/svtools/inc/svtools/txtattr.hxx index 982e9c20be5a..bf4c8e38b007 100644 --- a/svtools/inc/svtools/txtattr.hxx +++ b/svtools/inc/svtools/txtattr.hxx @@ -59,10 +59,10 @@ public: virtual ~TextAttrib(); - sal_uInt16 Which() const { return mnWhich; } - + sal_uInt16 Which() const { return mnWhich; } virtual void SetFont( Font& rFont ) const = 0; virtual TextAttrib* Clone() const = 0; + virtual int operator==( const TextAttrib& rAttr ) const = 0; int operator!=( const TextAttrib& rAttr ) const { return !(*this == rAttr ); } @@ -114,8 +114,6 @@ private: Color maColor; public: - TextAttribHyperLink( const XubString& rURL ); - TextAttribHyperLink( const XubString& rURL, const XubString& rDescription ); TextAttribHyperLink( const TextAttribHyperLink& rAttr ); ~TextAttribHyperLink(); diff --git a/svtools/inc/svtools/unitconv.hxx b/svtools/inc/svtools/unitconv.hxx index 51aa3aa61f30..d50c89dc7c19 100644 --- a/svtools/inc/svtools/unitconv.hxx +++ b/svtools/inc/svtools/unitconv.hxx @@ -51,10 +51,6 @@ SVT_DLLPUBLIC long ItemToControl( long nIn, SfxMapUnit eItem, SfxFieldUnit SVT_DLLPUBLIC long ControlToItem( long nIn, SfxFieldUnit eCtrl, SfxMapUnit eItem ); SVT_DLLPUBLIC FieldUnit MapToFieldUnit( const SfxMapUnit eUnit ); -SVT_DLLPUBLIC MapUnit FieldToMapUnit( const SfxFieldUnit eUnit ); - -SVT_DLLPUBLIC long ConvertValueToMap( long nVal, SfxMapUnit eUnit ); -SVT_DLLPUBLIC long ConvertValueToUnit( long nVal, SfxMapUnit eUnit ); SVT_DLLPUBLIC void SetMetricValue( MetricField& rField, long lCoreValue, SfxMapUnit eUnit ); SVT_DLLPUBLIC long GetCoreValue( const MetricField& rField, SfxMapUnit eUnit ); diff --git a/svtools/inc/svtools/wmf.hxx b/svtools/inc/svtools/wmf.hxx index 3c1f07774a45..a455f443e26e 100644 --- a/svtools/inc/svtools/wmf.hxx +++ b/svtools/inc/svtools/wmf.hxx @@ -63,8 +63,6 @@ SVT_DLLPUBLIC sal_Bool ConvertGDIMetaFileToWMF( const GDIMetaFile & rMTF, SvStre sal_Bool ConvertGDIMetaFileToEMF( const GDIMetaFile & rMTF, SvStream & rTargetStream, FilterConfigItem* pConfigItem = NULL ); -SVT_DLLPUBLIC sal_Bool WriteWindowMetafile( SvStream& rStream, const GDIMetaFile& rMTF ); - SVT_DLLPUBLIC sal_Bool WriteWindowMetafileBits( SvStream& rStream, const GDIMetaFile& rMTF ); #endif diff --git a/svtools/prj/build.lst b/svtools/prj/build.lst index 7ac223ae1588..d18c9f9df2a2 100644 --- a/svtools/prj/build.lst +++ b/svtools/prj/build.lst @@ -1,2 +1,2 @@ -st svtools : TRANSLATIONS:translations svl offuh toolkit ucbhelper unotools JPEG:jpeg cppu cppuhelper comphelper sal salhelper sot jvmfwk LIBXSLT:libxslt NULL +st svtools : TRANSLATIONS:translations svl offapi toolkit ucbhelper unotools JPEG:jpeg cppu cppuhelper comphelper sal salhelper sot jvmfwk LIBXSLT:libxslt ure test NULL st svtools\prj nmake - all st_prj NULL diff --git a/svtools/qa/cppunit/data/emf/fail/.gitignore b/svtools/qa/cppunit/data/emf/fail/.gitignore new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/svtools/qa/cppunit/data/emf/fail/.gitignore diff --git a/svtools/qa/cppunit/data/emf/fail/CVE-2004-0209-1.emf b/svtools/qa/cppunit/data/emf/fail/CVE-2004-0209-1.emf Binary files differnew file mode 100644 index 000000000000..2f77fcda3b99 --- /dev/null +++ b/svtools/qa/cppunit/data/emf/fail/CVE-2004-0209-1.emf diff --git a/svtools/qa/cppunit/data/emf/fail/CVE-2008-1083-1.emf b/svtools/qa/cppunit/data/emf/fail/CVE-2008-1083-1.emf Binary files differnew file mode 100644 index 000000000000..0cbd952de2f6 --- /dev/null +++ b/svtools/qa/cppunit/data/emf/fail/CVE-2008-1083-1.emf diff --git a/svtools/qa/cppunit/data/emf/fail/CVE-2009-1217-1.emf b/svtools/qa/cppunit/data/emf/fail/CVE-2009-1217-1.emf Binary files differnew file mode 100644 index 000000000000..ee7db91e37fe --- /dev/null +++ b/svtools/qa/cppunit/data/emf/fail/CVE-2009-1217-1.emf diff --git a/svtools/qa/cppunit/data/emf/indeterminate/.gitignore b/svtools/qa/cppunit/data/emf/indeterminate/.gitignore new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/svtools/qa/cppunit/data/emf/indeterminate/.gitignore diff --git a/svtools/qa/cppunit/data/emf/pass/.gitignore b/svtools/qa/cppunit/data/emf/pass/.gitignore new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/svtools/qa/cppunit/data/emf/pass/.gitignore diff --git a/svtools/qa/cppunit/data/emf/pass/CVE-2008-1087-1.emf b/svtools/qa/cppunit/data/emf/pass/CVE-2008-1087-1.emf Binary files differnew file mode 100644 index 000000000000..9bc2a3f203fa --- /dev/null +++ b/svtools/qa/cppunit/data/emf/pass/CVE-2008-1087-1.emf diff --git a/svtools/qa/cppunit/data/wmf/fail/.gitignore b/svtools/qa/cppunit/data/wmf/fail/.gitignore new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/svtools/qa/cppunit/data/wmf/fail/.gitignore diff --git a/svtools/qa/cppunit/data/wmf/fail/CVE-2005-2124-1.wmf b/svtools/qa/cppunit/data/wmf/fail/CVE-2005-2124-1.wmf Binary files differnew file mode 100644 index 000000000000..5826a98277c2 --- /dev/null +++ b/svtools/qa/cppunit/data/wmf/fail/CVE-2005-2124-1.wmf diff --git a/svtools/qa/cppunit/data/wmf/fail/CVE-2006-0143-1.wmf b/svtools/qa/cppunit/data/wmf/fail/CVE-2006-0143-1.wmf Binary files differnew file mode 100644 index 000000000000..07db62c2a48c --- /dev/null +++ b/svtools/qa/cppunit/data/wmf/fail/CVE-2006-0143-1.wmf diff --git a/svtools/qa/cppunit/data/wmf/fail/CVE-2006-0143-2.wmf b/svtools/qa/cppunit/data/wmf/fail/CVE-2006-0143-2.wmf Binary files differnew file mode 100644 index 000000000000..5b99a4883ce8 --- /dev/null +++ b/svtools/qa/cppunit/data/wmf/fail/CVE-2006-0143-2.wmf diff --git a/svtools/qa/cppunit/data/wmf/indeterminate/.gitignore b/svtools/qa/cppunit/data/wmf/indeterminate/.gitignore new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/svtools/qa/cppunit/data/wmf/indeterminate/.gitignore diff --git a/svtools/qa/cppunit/data/wmf/pass/.gitignore b/svtools/qa/cppunit/data/wmf/pass/.gitignore new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/svtools/qa/cppunit/data/wmf/pass/.gitignore diff --git a/svtools/qa/cppunit/data/wmf/pass/CVE-2005-2123-1.wmf b/svtools/qa/cppunit/data/wmf/pass/CVE-2005-2123-1.wmf Binary files differnew file mode 100644 index 000000000000..6af243b587c5 --- /dev/null +++ b/svtools/qa/cppunit/data/wmf/pass/CVE-2005-2123-1.wmf diff --git a/svtools/qa/cppunit/data/wmf/pass/CVE-2006-4071-1.wmf b/svtools/qa/cppunit/data/wmf/pass/CVE-2006-4071-1.wmf Binary files differnew file mode 100644 index 000000000000..794a7ef9af08 --- /dev/null +++ b/svtools/qa/cppunit/data/wmf/pass/CVE-2006-4071-1.wmf diff --git a/svtools/qa/cppunit/data/wmf/pass/CVE-2007-1090-1.wmf b/svtools/qa/cppunit/data/wmf/pass/CVE-2007-1090-1.wmf Binary files differnew file mode 100644 index 000000000000..c050fa6e3b4d --- /dev/null +++ b/svtools/qa/cppunit/data/wmf/pass/CVE-2007-1090-1.wmf diff --git a/svtools/qa/cppunit/data/wmf/pass/CVE-2007-1238-1.wmf b/svtools/qa/cppunit/data/wmf/pass/CVE-2007-1238-1.wmf Binary files differnew file mode 100644 index 000000000000..a01e310089b0 --- /dev/null +++ b/svtools/qa/cppunit/data/wmf/pass/CVE-2007-1238-1.wmf diff --git a/svtools/qa/cppunit/data/wmf/pass/CVE-2007-1245-1.wmf b/svtools/qa/cppunit/data/wmf/pass/CVE-2007-1245-1.wmf Binary files differnew file mode 100644 index 000000000000..a01e310089b0 --- /dev/null +++ b/svtools/qa/cppunit/data/wmf/pass/CVE-2007-1245-1.wmf diff --git a/svtools/qa/cppunit/filters-test.cxx b/svtools/qa/cppunit/filters-test.cxx new file mode 100644 index 000000000000..c5d43af4bb9b --- /dev/null +++ b/svtools/qa/cppunit/filters-test.cxx @@ -0,0 +1,214 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is + * Caolán McNamara <caolanm@redhat.com> + * Portions created by the Initial Developer are Copyright (C) 2011 the + * Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Caolán McNamara <caolanm@redhat.com> + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#include <sal/cppunit.h> +#include <sal/config.h> + +#include <osl/file.hxx> +#include <osl/process.h> + +#include <vcl/svapp.hxx> + +#include <comphelper/processfactory.hxx> + +#include <cppuhelper/bootstrap.hxx> + +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> + +#include <svtools/filter.hxx> + +const int indeterminate = 2; + +using namespace ::com::sun::star; + +/* Implementation of Filters test */ + +class FiltersTest : public CppUnit::TestFixture +{ +public: + FiltersTest(); + ~FiltersTest(); + + virtual void setUp(); + virtual void tearDown(); + + void recursiveScan(const rtl::OUString &rURL, int nExpected); + bool load(const rtl::OUString &rURL); + + /** + * Ensure CVEs remain unbroken + */ + void testCVEs(); + + CPPUNIT_TEST_SUITE(FiltersTest); + CPPUNIT_TEST(testCVEs); + CPPUNIT_TEST_SUITE_END(); + +private: + uno::Reference<uno::XComponentContext> m_xContext; + uno::Reference<lang::XMultiComponentFactory> m_xFactory; + ::rtl::OUString m_aSrcRoot; +}; + +bool FiltersTest::load(const rtl::OUString &rURL) +{ + GraphicFilter aGraphicFilter(false); + SvFileStream aFileStream(rURL, STREAM_READ); + Graphic aGraphic; + return aGraphicFilter.ImportGraphic(aGraphic, rURL, aFileStream) == 0; +} + +void FiltersTest::recursiveScan(const rtl::OUString &rURL, int nExpected) +{ + osl::Directory aDir(rURL); + + CPPUNIT_ASSERT(osl::FileBase::E_None == aDir.open()); + osl::DirectoryItem aItem; + osl::FileStatus aFileStatus(osl_FileStatus_Mask_FileURL|osl_FileStatus_Mask_Type); + while (aDir.getNextItem(aItem) == osl::FileBase::E_None) + { + aItem.getFileStatus(aFileStatus); + rtl::OUString sURL = aFileStatus.getFileURL(); + if (aFileStatus.getFileType() == osl::FileStatus::Directory) + recursiveScan(sURL, nExpected); + else + { + sal_Int32 nLastSlash = sURL.lastIndexOf('/'); + + //ignore .files + if ( + (nLastSlash != -1) && (nLastSlash+1 < sURL.getLength()) && + (sURL.getStr()[nLastSlash+1] == '.') + ) + { + continue; + } + + rtl::OString aRes(rtl::OUStringToOString(sURL, + osl_getThreadTextEncoding())); + if (nExpected == indeterminate) + { + fprintf(stderr, "loading %s\n", aRes.getStr()); + } + sal_uInt32 nStartTime = osl_getGlobalTimer(); + bool bRes = load(sURL); + sal_uInt32 nEndTime = osl_getGlobalTimer(); + if (nExpected == indeterminate) + { + fprintf(stderr, "pass/fail was %d (%"SAL_PRIuUINT32" ms)\n", + bRes, nEndTime-nStartTime); + continue; + } + CPPUNIT_ASSERT_MESSAGE(aRes.getStr(), bRes == nExpected); + } + } + CPPUNIT_ASSERT(osl::FileBase::E_None == aDir.close()); +} + +void FiltersTest::testCVEs() +{ + recursiveScan(m_aSrcRoot + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/clone/libs-gui/svtools/qa/cppunit/data/wmf/pass")), true); + recursiveScan(m_aSrcRoot + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/clone/libs-gui/svtools/qa/cppunit/data/wmf/fail")), false); + recursiveScan(m_aSrcRoot + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/clone/libs-gui/svtools/qa/cppunit/data/wmf/indeterminate")), 2); + + recursiveScan(m_aSrcRoot + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/clone/libs-gui/svtools/qa/cppunit/data/emf/pass")), true); + recursiveScan(m_aSrcRoot + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/clone/libs-gui/svtools/qa/cppunit/data/emf/fail")), false); + recursiveScan(m_aSrcRoot + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/clone/libs-gui/svtools/qa/cppunit/data/emf/indeterminate")), 2); +} + +FiltersTest::FiltersTest() + : m_aSrcRoot(RTL_CONSTASCII_USTRINGPARAM("file://")) +{ + m_xContext = cppu::defaultBootstrap_InitialComponentContext(); + m_xFactory = m_xContext->getServiceManager(); + + uno::Reference<lang::XMultiServiceFactory> xSM(m_xFactory, uno::UNO_QUERY_THROW); + + //Without this we're crashing because callees are using + //getProcessServiceFactory. In general those should be removed in favour + //of retaining references to the root ServiceFactory as its passed around + comphelper::setProcessServiceFactory(xSM); +#if 0 + // initialise UCB-Broker + uno::Sequence<uno::Any> aUcbInitSequence(2); + aUcbInitSequence[0] <<= rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Local")); + aUcbInitSequence[1] <<= rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Office")); + bool bInitUcb = ucbhelper::ContentBroker::initialize(xSM, aUcbInitSequence); + CPPUNIT_ASSERT_MESSAGE("Should be able to initialize UCB", bInitUcb); + + uno::Reference<ucb::XContentProviderManager> xUcb = + ucbhelper::ContentBroker::get()->getContentProviderManagerInterface(); + uno::Reference<ucb::XContentProvider> xFileProvider(xSM->createInstance( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.FileContentProvider"))), uno::UNO_QUERY); + xUcb->registerContentProvider(xFileProvider, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("file")), sal_True); + + // force locale (and resource files loaded) to en-US + const LanguageType eLang=LANGUAGE_ENGLISH_US; + + rtl::OUString aLang, aCountry; + MsLangId::convertLanguageToIsoNames(eLang, aLang, aCountry); + lang::Locale aLocale(aLang, aCountry, rtl::OUString()); + ResMgr::SetDefaultLocale( aLocale ); + + SvtSysLocaleOptions aLocalOptions; + aLocalOptions.SetUILocaleConfigString( + MsLangId::convertLanguageToIsoString( eLang ) ); +#endif + + InitVCL(xSM); + + const char* pSrcRoot = getenv( "SRC_ROOT" ); + CPPUNIT_ASSERT_MESSAGE("SRC_ROOT env variable not set", pSrcRoot != NULL && pSrcRoot[0] != 0); + +#ifdef WNT + if (pSrcRoot[1] == ':') + m_aSrcRoot += rtl::OUString::createFromAscii( "/" ); +#endif + m_aSrcRoot += rtl::OUString::createFromAscii( pSrcRoot ); +} + +void FiltersTest::setUp() +{ +} + +FiltersTest::~FiltersTest() +{ + uno::Reference< lang::XComponent >(m_xContext, uno::UNO_QUERY_THROW)->dispose(); +} + +void FiltersTest::tearDown() +{ +} + +CPPUNIT_TEST_SUITE_REGISTRATION(FiltersTest); + +CPPUNIT_PLUGIN_IMPLEMENT(); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/brwbox/brwbox1.cxx b/svtools/source/brwbox/brwbox1.cxx index 31e4a187574f..3619355ce355 100644 --- a/svtools/source/brwbox/brwbox1.cxx +++ b/svtools/source/brwbox/brwbox1.cxx @@ -266,36 +266,6 @@ void BrowseBox::InsertHandleColumn( sal_uLong nWidth ) } //------------------------------------------------------------------- -void BrowseBox::InsertDataColumn( sal_uInt16 nItemId, const Image& rImage, - long nWidth, HeaderBarItemBits nBits, sal_uInt16 nPos ) -{ - DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants); - - if ( nPos < pCols->size() ) - { - BrowserColumns::iterator it = pCols->begin(); - ::std::advance( it, nPos ); - pCols->insert( it, new BrowserColumn( nItemId, rImage, String(), nWidth, GetZoom(), nBits ) ); - } - else - { - pCols->push_back( new BrowserColumn( nItemId, rImage, String(), nWidth, GetZoom(), nBits ) ); - } - if ( nCurColId == 0 ) - nCurColId = nItemId; - if ( getDataWindow()->pHeaderBar ) - { - // Handlecolumn nicht in der Headerbar - sal_uInt16 nHeaderPos = nPos; - if (nHeaderPos != HEADERBAR_APPEND && !GetColumnId(0)) - nHeaderPos--; - getDataWindow()->pHeaderBar->InsertItem( - nItemId, rImage, nWidth, nBits, nHeaderPos ); - } - ColumnInserted( nPos ); -} - -//------------------------------------------------------------------- void BrowseBox::InsertDataColumn( sal_uInt16 nItemId, const XubString& rText, long nWidth, HeaderBarItemBits nBits, sal_uInt16 nPos ) @@ -328,45 +298,6 @@ void BrowseBox::InsertDataColumn( sal_uInt16 nItemId, const XubString& rText, } //------------------------------------------------------------------- - -void BrowseBox::InsertDataColumn( sal_uInt16 nItemId, - const Image& rImage, const XubString& rText, - long nWidth, HeaderBarItemBits nBits, sal_uInt16 nPos, - const String* pHelpText ) -{ - DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants); - - if ( nPos < pCols->size() ) - { - BrowserColumns::iterator it = pCols->begin(); - ::std::advance( it, nPos ); - pCols->insert( it, new BrowserColumn( nItemId, rImage, rText, nWidth, GetZoom(), nBits ) ); - } - else - { - pCols->push_back( new BrowserColumn( nItemId, rImage, rText, nWidth, GetZoom(), nBits ) ); - } - - if ( nCurColId == 0 ) - nCurColId = nItemId; - if ( getDataWindow()->pHeaderBar ) - { - // Handlecolumn nicht in der Headerbar - sal_uInt16 nHeaderPos = nPos; - if (nHeaderPos != HEADERBAR_APPEND && !GetColumnId(0)) - nHeaderPos--; - - getDataWindow()->pHeaderBar->InsertItem( - nItemId, rImage, rText, nWidth, nBits, nHeaderPos ); - if( pHelpText && !rText.Len() ) - { - getDataWindow()->pHeaderBar->SetHelpText( - nItemId, *pHelpText ); - } - } - ColumnInserted( nPos ); -} -//------------------------------------------------------------------- sal_uInt16 BrowseBox::ToggleSelectedColumn() { sal_uInt16 nSelectedColId = USHRT_MAX; @@ -594,35 +525,6 @@ void BrowseBox::SetColumnPos( sal_uInt16 nColumnId, sal_uInt16 nPos ) //------------------------------------------------------------------- -void BrowseBox::SetColumnMode( sal_uInt16 nColumnId, BrowserColumnMode nFlags ) -{ - DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants); - - // never set mode of the handle-column - if ( nColumnId == 0 ) - return; - - // get the position in the current array - size_t nColumnPos = GetColumnPos( nColumnId ); - if ( nColumnPos >= pCols->size() ) - // not available! - return; - - // does the state change? - BrowserColumn *pCol = (*pCols)[ nColumnPos ]; - if ( pCol->Flags() != nFlags ) - { - pCol->Flags() = sal::static_int_cast< HeaderBarItemBits >(nFlags); - - // redraw visible colums - if ( GetUpdateMode() && ( pCol->IsFrozen() || nColumnPos > nFirstCol ) ) - Invalidate( Rectangle( Point(0,0), - Size( GetOutputSizePixel().Width(), GetTitleHeight() ) ) ); - } -} - -//------------------------------------------------------------------- - void BrowseBox::SetColumnTitle( sal_uInt16 nItemId, const String& rTitle ) { DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants); @@ -1213,15 +1115,6 @@ long BrowseBox::ScrollRows( long nRows ) //------------------------------------------------------------------- -long BrowseBox::ScrollPages( long ) -{ - DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants); - - return ScrollRows( pDataWin->GetSizePixel().Height() / GetDataRowHeight() ); -} - -//------------------------------------------------------------------- - void BrowseBox::RowModified( long nRow, sal_uInt16 nColId ) { DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants); @@ -1589,12 +1482,6 @@ sal_Bool BrowseBox::GoToRow( long nRow) //------------------------------------------------------------------- -sal_Bool BrowseBox::GoToRowAndDoNotModifySelection( long nRow ) -{ - return GoToRow( nRow, sal_False, sal_True ); -} - -//------------------------------------------------------------------- sal_Bool BrowseBox::GoToRow( long nRow, sal_Bool bRowColMove, sal_Bool bKeepSelection ) { DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants); @@ -1808,43 +1695,6 @@ void BrowseBox::SetNoSelection() //------------------------------------------------------------------- -void BrowseBox::SetSelection( const MultiSelection &rSel ) -{ - DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants); - DBG_ASSERT( bMultiSelection, "SetSelection only allowed with Multi-Selection-Mode" ); - - // prepare inverted areas - OSL_TRACE( "BrowseBox: %p->HideCursor", this ); - ToggleSelection(); - - // assign Selection - *uRow.pSel = rSel; - - // only highlight painted areas - pDataWin->Update(); - - // notify derived class - if ( !bSelecting ) - Select(); - else - bSelect = sal_True; - - // restore screen - ToggleSelection(); - OSL_TRACE( "BrowseBox: %p->ShowCursor", this ); - - if ( isAccessibleAlive() ) - { - commitTableEvent( - SELECTION_CHANGED, - Any(), - Any() - ); - } -} - -//------------------------------------------------------------------- - void BrowseBox::SelectAll() { DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants); @@ -2078,12 +1928,6 @@ long BrowseBox::FirstSelectedColumn( ) const } //------------------------------------------------------------------- -long BrowseBox::NextSelectedColumn( ) const -{ - return pColSel ? pColSel->NextSelected() : BROWSER_ENDOFSELECTION; -} - -//------------------------------------------------------------------- long BrowseBox::FirstSelectedRow( sal_Bool bInverse ) { @@ -2103,15 +1947,6 @@ long BrowseBox::NextSelectedRow() //------------------------------------------------------------------- -long BrowseBox::PrevSelectedRow() -{ - DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants); - - return bMultiSelection ? uRow.pSel->PrevSelected() : BROWSER_ENDOFSELECTION; -} - -//------------------------------------------------------------------- - long BrowseBox::LastSelectedRow() { DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants); @@ -2140,15 +1975,6 @@ bool BrowseBox::IsColumnSelected( sal_uInt16 nColumnId ) const //------------------------------------------------------------------- -sal_Bool BrowseBox::IsAllSelected() const -{ - DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants); - - return bMultiSelection && uRow.pSel->IsAllSelected(); -} - -//------------------------------------------------------------------- - sal_Bool BrowseBox::MakeFieldVisible ( long nRow, // Zeilen-Nr des Feldes (beginnend mit 0) @@ -2592,13 +2418,6 @@ long BrowseBox::GetDataRowHeight() const //------------------------------------------------------------------- -Window& BrowseBox::GetEventWindow() const -{ - return *getDataWindow()->pEventWin; -} - -//------------------------------------------------------------------- - BrowserHeader* BrowseBox::CreateHeaderBar( BrowseBox* pParent ) { BrowserHeader* pNewBar = new BrowserHeader( pParent ); @@ -2663,13 +2482,6 @@ long BrowseBox::CalcReverseZoom(long nVal) return nVal; } -//------------------------------------------------------------------- -HeaderBar* BrowseBox::GetHeaderBar() const -{ - return getDataWindow()->pHeaderBar; -} -//------------------------------------------------------------------- - void BrowseBox::CursorMoved() { // before implementing more here, please adjust the EditBrowseBox diff --git a/svtools/source/brwbox/brwbox2.cxx b/svtools/source/brwbox/brwbox2.cxx index 9c9796baa90b..f62a95170c6a 100644 --- a/svtools/source/brwbox/brwbox2.cxx +++ b/svtools/source/brwbox/brwbox2.cxx @@ -149,13 +149,6 @@ void BrowseBox::Command( const CommandEvent& rEvt ) //=================================================================== -bool BrowseBox::IsInCommandEvent() const -{ - return getDataWindow()->bInCommand; -} - -//=================================================================== - void BrowseBox::StateChanged( StateChangedType nStateChange ) { Control::StateChanged( nStateChange ); diff --git a/svtools/source/config/helpopt.cxx b/svtools/source/config/helpopt.cxx index 6e80db6fcf6c..f8cbbcc2b838 100644 --- a/svtools/source/config/helpopt.cxx +++ b/svtools/source/config/helpopt.cxx @@ -62,7 +62,6 @@ static sal_Int32 nRefCount = 0; class SvtHelpOptions_Impl : public utl::ConfigItem { - IdList* pList; sal_Int32 nHelpAgentTimeoutPeriod; sal_Int32 nHelpAgentRetryLimit; sal_Bool bExtendedHelp; @@ -105,9 +104,6 @@ public: void SetWelcomeScreen( sal_Bool b ) { bWelcomeScreen = b; SetModified(); } sal_Bool IsWelcomeScreen() const { return bWelcomeScreen; } - IdList* GetPIStarterList() { return pList; } - void AddToPIStarterList( sal_Int32 nId ); - void RemoveFromPIStarterList( sal_Int32 nId ); String GetLocale() const { return aLocale; } String GetSystem() const { return aSystem; } @@ -168,7 +164,6 @@ Sequence< OUString > SvtHelpOptions_Impl::GetPropertyNames() SvtHelpOptions_Impl::SvtHelpOptions_Impl() : ConfigItem( OUString( RTL_CONSTASCII_USTRINGPARAM( "Office.Common/Help" )) ) - , pList( 0 ) , bExtendedHelp( sal_False ) , bHelpTips( sal_True ) , bHelpAgentEnabled( sal_False ) @@ -733,19 +728,6 @@ sal_Bool SvtHelpOptions::IsWelcomeScreen() const return pImp->IsWelcomeScreen(); } -IdList* SvtHelpOptions::GetPIStarterList() -{ - return pImp->GetPIStarterList(); -} - -void SvtHelpOptions::AddToPIStarterList( sal_Int32 ) -{ -} - -void SvtHelpOptions::RemoveFromPIStarterList( sal_Int32 ) -{ -} - String SvtHelpOptions::GetLocale() const { return pImp->GetLocale(); diff --git a/svtools/source/config/optionsdrawinglayer.cxx b/svtools/source/config/optionsdrawinglayer.cxx index 410c430810b2..957792d85166 100644 --- a/svtools/source/config/optionsdrawinglayer.cxx +++ b/svtools/source/config/optionsdrawinglayer.cxx @@ -388,13 +388,12 @@ SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl() : DBG_ASSERT( !(seqNames.getLength()!=seqValues.getLength()), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nI miss some values of configuration keys!\n" ); - // Copy values from list in right order to ouer internal member. + // Copy values from list in right order to our internal member. sal_Int32 nPropertyCount = seqValues.getLength(); - sal_Int32 nProperty = 0; - - for( nProperty=0; nProperty<nPropertyCount; ++nProperty ) + for(sal_Int32 nProperty=0; nProperty<nPropertyCount; ++nProperty ) { - DBG_ASSERT( !(seqValues[nProperty].hasValue()==sal_False), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nInvalid property value for property detected!\n" ); + if (seqValues[nProperty].hasValue()==sal_False) + continue; switch( nProperty ) { diff --git a/svtools/source/contnr/fileview.cxx b/svtools/source/contnr/fileview.cxx index 6a511bdb4e4b..e8f6f9cc5b60 100644 --- a/svtools/source/contnr/fileview.cxx +++ b/svtools/source/contnr/fileview.cxx @@ -496,15 +496,12 @@ class NameTranslator_Impl : public ::svt::IContentTitleTranslation private: NameTranslationList* mpActFolder; public: - NameTranslator_Impl( void ); NameTranslator_Impl( const INetURLObject& rActualFolder ); virtual ~NameTranslator_Impl(); // IContentTitleTranslation virtual sal_Bool GetTranslation( const OUString& rOriginalName, OUString& rTranslatedName ) const; - void UpdateTranslationTable(); // reads the translation file again - void SetActualFolder( const INetURLObject& rActualFolder ); const String* GetTransTableFileName() const; // returns the name for the file, which contains the translation strings @@ -1810,11 +1807,6 @@ void SvtFileView::StateChanged( StateChangedType nStateChange ) // class NameTranslator_Impl // ----------------------------------------------------------------------- -NameTranslator_Impl::NameTranslator_Impl( void ) : - mpActFolder( NULL ) -{ -} - NameTranslator_Impl::NameTranslator_Impl( const INetURLObject& rActualFolder ) { mpActFolder = new NameTranslationList( rActualFolder ); @@ -1826,12 +1818,6 @@ NameTranslator_Impl::~NameTranslator_Impl() delete mpActFolder; } -void NameTranslator_Impl::UpdateTranslationTable() -{ - if( mpActFolder ) - mpActFolder->Update(); -} - void NameTranslator_Impl::SetActualFolder( const INetURLObject& rActualFolder ) { HashedEntry aActFolder( rActualFolder ); diff --git a/svtools/source/contnr/imivctl.hxx b/svtools/source/contnr/imivctl.hxx index 517f0f6b66f1..18b34b780fde 100644 --- a/svtools/source/contnr/imivctl.hxx +++ b/svtools/source/contnr/imivctl.hxx @@ -83,8 +83,8 @@ class IcnGridMap_Impl; // Breitenoffset Highlight-Rect bei Text #define LROFFS_TEXT 2 -#define DEFAULT_MAX_VIRT_WIDTH 200 -#define DEFAULT_MAX_VIRT_HEIGHT 200 +#define DEFAULT_MAX_VIRT_WIDTH 200 +#define DEFAULT_MAX_VIRT_HEIGHT 200 #define VIEWMODE_MASK (WB_ICON | WB_SMALLICON | WB_DETAILS) @@ -105,7 +105,7 @@ enum IcnViewFieldType // struct LocalFocus { - sal_Bool bOn; + sal_Bool bOn; Rectangle aRect; Color aPenColor; @@ -116,32 +116,47 @@ struct LocalFocus // // Entry-List // -class EntryList_Impl : public List +typedef ::std::vector< SvxIconChoiceCtrlEntry* > SvxIconChoiceCtrlEntryList_impl; + +class EntryList_Impl { private: - - using List::Replace; - + SvxIconChoiceCtrlEntryList_impl maIconChoiceCtrlEntryList; SvxIconChoiceCtrl_Impl* _pOwner; void Removed_Impl( SvxIconChoiceCtrlEntry* pEntry ); public: - EntryList_Impl( - SvxIconChoiceCtrl_Impl*, - sal_uInt16 _nInitSize = 1024, - sal_uInt16 _nReSize = 1024 ); - EntryList_Impl( - SvxIconChoiceCtrl_Impl*, - sal_uInt16 _nBlockSize, - sal_uInt16 _nInitSize, - sal_uInt16 _nReSize ); + EntryList_Impl( SvxIconChoiceCtrl_Impl* ); ~EntryList_Impl(); - void Clear(); - void Insert( SvxIconChoiceCtrlEntry* pEntry, sal_uLong nPos ); - SvxIconChoiceCtrlEntry* Remove( sal_uLong nPos ); - void Remove( SvxIconChoiceCtrlEntry* pEntry ); + void clear(); + + SvxIconChoiceCtrlEntry* remove( size_t nPos ); + void remove( SvxIconChoiceCtrlEntry* pEntry ); + + size_t size() + { + return maIconChoiceCtrlEntryList.size(); + } + size_t size() const + { + return maIconChoiceCtrlEntryList.size(); + } + + SvxIconChoiceCtrlEntry* operator[]( size_t nPos ) + { + return ( nPos < maIconChoiceCtrlEntryList.size() ) + ? maIconChoiceCtrlEntryList[ nPos ] + : NULL; + } + SvxIconChoiceCtrlEntry* operator[]( size_t nPos ) const + { + return ( nPos < maIconChoiceCtrlEntryList.size() ) + ? maIconChoiceCtrlEntryList[ nPos ] + : NULL; + } + void insert( size_t nPos, SvxIconChoiceCtrlEntry* pEntry ); }; @@ -155,388 +170,448 @@ class SvxIconChoiceCtrl_Impl friend class EntryList_Impl; friend class IcnGridMap_Impl; - sal_Bool bChooseWithCursor; - EntryList_Impl aEntries; - ScrollBar aVerSBar; - ScrollBar aHorSBar; - ScrollBarBox aScrBarBox; - Rectangle aCurSelectionRect; - SvPtrarr aSelectedRectList; - Timer aEditTimer; // fuer Inplace-Editieren - Timer aAutoArrangeTimer; - Timer aDocRectChangedTimer; - Timer aVisRectChangedTimer; - Timer aCallSelectHdlTimer; - Size aVirtOutputSize; - Size aImageSize; - Size aDefaultTextSize; - Size aOutputSize; // Pixel - Point aDDLastEntryPos; - Point aDDLastRectPos; - Point aDDPaintOffs; - Point aDDStartPos; + sal_Bool bChooseWithCursor; + EntryList_Impl aEntries; + ScrollBar aVerSBar; + ScrollBar aHorSBar; + ScrollBarBox aScrBarBox; + Rectangle aCurSelectionRect; + SvPtrarr aSelectedRectList; + Timer aEditTimer; // fuer Inplace-Editieren + Timer aAutoArrangeTimer; + Timer aDocRectChangedTimer; + Timer aVisRectChangedTimer; + Timer aCallSelectHdlTimer; + Size aVirtOutputSize; + Size aImageSize; + Size aDefaultTextSize; + Size aOutputSize; // Pixel + Point aDDLastEntryPos; + Point aDDLastRectPos; + Point aDDPaintOffs; + Point aDDStartPos; SvtIconChoiceCtrl* pView; - IcnCursor_Impl* pImpCursor; - IcnGridMap_Impl* pGridMap; - long nMaxVirtWidth; // max. Breite aVirtOutputSize bei ALIGN_TOP - long nMaxVirtHeight; // max. Hoehe aVirtOutputSize bei ALIGN_LEFT - List* pZOrderList; - SvPtrarr* pColumns; - IcnViewEdit_Impl* pEdit; - WinBits nWinBits; - long nMaxBoundHeight; // Hoehe des hoechsten BoundRects - sal_uInt16 nFlags; - sal_uInt16 nCurTextDrawFlags; - sal_uLong nUserEventAdjustScrBars; - sal_uLong nUserEventShowCursor; + IcnCursor_Impl* pImpCursor; + IcnGridMap_Impl* pGridMap; + long nMaxVirtWidth; // max. Breite aVirtOutputSize bei ALIGN_TOP + long nMaxVirtHeight; // max. Hoehe aVirtOutputSize bei ALIGN_LEFT + SvxIconChoiceCtrlEntryList_impl* pZOrderList; + SvPtrarr* pColumns; + IcnViewEdit_Impl* pEdit; + WinBits nWinBits; + long nMaxBoundHeight; // Hoehe des hoechsten BoundRects + sal_uInt16 nFlags; + sal_uInt16 nCurTextDrawFlags; + sal_uLong nUserEventAdjustScrBars; + sal_uLong nUserEventShowCursor; SvxIconChoiceCtrlEntry* pCurHighlightFrame; - sal_Bool bHighlightFramePressed; + sal_Bool bHighlightFramePressed; SvxIconChoiceCtrlEntry* pHead; // Eintrag oben links SvxIconChoiceCtrlEntry* pCursor; SvxIconChoiceCtrlEntry* pPrevDropTarget; SvxIconChoiceCtrlEntry* pHdlEntry; SvxIconChoiceCtrlEntry* pDDRefEntry; - VirtualDevice* pDDDev; - VirtualDevice* pDDBufDev; - VirtualDevice* pDDTempDev; - VirtualDevice* pEntryPaintDev; + VirtualDevice* pDDDev; + VirtualDevice* pDDBufDev; + VirtualDevice* pDDTempDev; + VirtualDevice* pEntryPaintDev; SvxIconChoiceCtrlEntry* pAnchor; // fuer Selektion - LocalFocus aFocus; // Data for focusrect + LocalFocus aFocus; // Data for focusrect ::svt::AccessibleFactoryAccess aAccFactory; - List* pDraggedSelection; + List* pDraggedSelection; SvxIconChoiceCtrlEntry* pCurEditedEntry; SvxIconChoiceCtrlTextMode eTextMode; - SelectionMode eSelectionMode; - sal_uLong nSelectionCount; + SelectionMode eSelectionMode; + sal_uLong nSelectionCount; SvxIconChoiceCtrlPositionMode ePositionMode; - sal_Bool bBoundRectsDirty; - sal_Bool bUpdateMode; - sal_Bool bEntryEditingEnabled; - sal_Bool bInDragDrop; - - void ShowCursor( sal_Bool bShow ); - - void ImpArrange( sal_Bool bKeepPredecessors = sal_False ); - void AdjustVirtSize( const Rectangle& ); - void ResetVirtSize(); - void CheckScrollBars(); - - DECL_LINK( ScrollUpDownHdl, ScrollBar * ); - DECL_LINK( ScrollLeftRightHdl, ScrollBar * ); - DECL_LINK( EditTimeoutHdl, Timer* ); - DECL_LINK( UserEventHdl, void* ); - DECL_LINK( EndScrollHdl, void* ); - DECL_LINK( AutoArrangeHdl, void* ); - DECL_LINK( DocRectChangedHdl, void* ); - DECL_LINK( VisRectChangedHdl, void* ); - DECL_LINK( CallSelectHdlHdl, void* ); - - void AdjustScrollBars( sal_Bool bVirtSizeGrowedOnly = sal_False); - void PositionScrollBars( long nRealWidth, long nRealHeight ); - long GetScrollBarPageSize( long nVisibleRange ) const { return ((nVisibleRange*75)/100); } - long GetScrollBarLineSize() const { return nMaxBoundHeight / 2; } + sal_Bool bBoundRectsDirty; + sal_Bool bUpdateMode; + sal_Bool bEntryEditingEnabled; + sal_Bool bInDragDrop; + + void ShowCursor( sal_Bool bShow ); + + void ImpArrange( sal_Bool bKeepPredecessors = sal_False ); + void AdjustVirtSize( const Rectangle& ); + void ResetVirtSize(); + void CheckScrollBars(); + + DECL_LINK( ScrollUpDownHdl, ScrollBar * ); + DECL_LINK( ScrollLeftRightHdl, ScrollBar * ); + DECL_LINK( EditTimeoutHdl, Timer* ); + DECL_LINK( UserEventHdl, void* ); + DECL_LINK( EndScrollHdl, void* ); + DECL_LINK( AutoArrangeHdl, void* ); + DECL_LINK( DocRectChangedHdl, void* ); + DECL_LINK( VisRectChangedHdl, void* ); + DECL_LINK( CallSelectHdlHdl, void* ); + + void AdjustScrollBars( sal_Bool bVirtSizeGrowedOnly = sal_False); + void PositionScrollBars( long nRealWidth, long nRealHeight ); + long GetScrollBarPageSize( long nVisibleRange ) const + { + return ((nVisibleRange*75)/100); + } + long GetScrollBarLineSize() const + { + return nMaxBoundHeight / 2; + } sal_Bool HandleScrollCommand( const CommandEvent& rCmd ); - void ToDocPos( Point& rPosPixel ) { rPosPixel -= pView->GetMapMode().GetOrigin(); } - void InitScrollBarBox(); + void ToDocPos( Point& rPosPixel ) + { + rPosPixel -= pView->GetMapMode().GetOrigin(); + } + void InitScrollBarBox(); SvxIconChoiceCtrlEntry* FindNewCursor(); - void ToggleSelection( SvxIconChoiceCtrlEntry* ); - void DeselectAllBut( SvxIconChoiceCtrlEntry*, sal_Bool bPaintSync=sal_False ); - void Center( SvxIconChoiceCtrlEntry* pEntry ) const; - void StopEditTimer() { aEditTimer.Stop(); } - void StartEditTimer() { aEditTimer.Start(); } - void ImpHideDDIcon(); - void CallSelectHandler( SvxIconChoiceCtrlEntry* ); - void SelectRect( - SvxIconChoiceCtrlEntry* pEntry1, - SvxIconChoiceCtrlEntry* pEntry2, - sal_Bool bAdd = sal_True, - SvPtrarr* pOtherRects = 0 ); - - void SelectRange( - SvxIconChoiceCtrlEntry* pStart, - SvxIconChoiceCtrlEntry* pEnd, - sal_Bool bAdd = sal_True ); - - void AddSelectedRect( const Rectangle& ); - void AddSelectedRect( - SvxIconChoiceCtrlEntry* pEntry1, - SvxIconChoiceCtrlEntry* pEntry2 ); - - void ClearSelectedRectList(); - void ClearColumnList(); - Rectangle CalcMaxTextRect( const SvxIconChoiceCtrlEntry* pEntry ) const; - - void ClipAtVirtOutRect( Rectangle& rRect ) const; - void AdjustAtGrid( const SvPtrarr& rRow, SvxIconChoiceCtrlEntry* pStart=0 ); - Point AdjustAtGrid( - const Rectangle& rCenterRect, // "Schwerpunkt" des Objekts (typ. Bmp-Rect) - const Rectangle& rBoundRect ) const; + void ToggleSelection( SvxIconChoiceCtrlEntry* ); + void DeselectAllBut( SvxIconChoiceCtrlEntry*, sal_Bool bPaintSync=sal_False ); + void Center( SvxIconChoiceCtrlEntry* pEntry ) const; + void StopEditTimer() { aEditTimer.Stop(); } + void StartEditTimer() { aEditTimer.Start(); } + void ImpHideDDIcon(); + void CallSelectHandler( SvxIconChoiceCtrlEntry* ); + void SelectRect( + SvxIconChoiceCtrlEntry* pEntry1, + SvxIconChoiceCtrlEntry* pEntry2, + sal_Bool bAdd = sal_True, + SvPtrarr* pOtherRects = 0 + ); + + void SelectRange( + SvxIconChoiceCtrlEntry* pStart, + SvxIconChoiceCtrlEntry* pEnd, + sal_Bool bAdd = sal_True + ); + + void AddSelectedRect( const Rectangle& ); + void AddSelectedRect( + SvxIconChoiceCtrlEntry* pEntry1, + SvxIconChoiceCtrlEntry* pEntry2 + ); + + void ClearSelectedRectList(); + void ClearColumnList(); + Rectangle CalcMaxTextRect( const SvxIconChoiceCtrlEntry* pEntry ) const; + + void ClipAtVirtOutRect( Rectangle& rRect ) const; + void AdjustAtGrid( const SvPtrarr& rRow, SvxIconChoiceCtrlEntry* pStart=0 ); + Point AdjustAtGrid( + const Rectangle& rCenterRect, // "Schwerpunkt" des Objekts (typ. Bmp-Rect) + const Rectangle& rBoundRect + ) const; sal_uLong GetPredecessorGrid( const Point& rDocPos) const; - void InitPredecessors(); - void ClearPredecessors(); + void InitPredecessors(); + void ClearPredecessors(); sal_Bool CheckVerScrollBar(); sal_Bool CheckHorScrollBar(); - void CancelUserEvents(); - void EntrySelected( SvxIconChoiceCtrlEntry* pEntry, sal_Bool bSelect, - sal_Bool bSyncPaint ); - void SaveSelection( List** ); - void RepaintEntries( sal_uInt16 nEntryFlagsMask ); - void SetListPositions(); - void SetDefaultTextSize(); - sal_Bool IsAutoArrange() const { - return (sal_Bool)(ePositionMode == IcnViewPositionModeAutoArrange); } - sal_Bool IsAutoAdjust() const { - return (sal_Bool)(ePositionMode == IcnViewPositionModeAutoAdjust); } - void DocRectChanged() { aDocRectChangedTimer.Start(); } - void VisRectChanged() { aVisRectChangedTimer.Start(); } - void SetOrigin( const Point&, sal_Bool bDoNotUpdateWallpaper = sal_False ); - - DECL_LINK( TextEditEndedHdl, IcnViewEdit_Impl* ); - - void ShowFocus ( Rectangle& rRect ); - void HideFocus (); - void DrawFocusRect ( OutputDevice* pOut ); + void CancelUserEvents(); + void EntrySelected( + SvxIconChoiceCtrlEntry* pEntry, + sal_Bool bSelect, + sal_Bool bSyncPaint + ); + void SaveSelection( List** ); + void RepaintEntries( sal_uInt16 nEntryFlagsMask ); + void SetListPositions(); + void SetDefaultTextSize(); + sal_Bool IsAutoArrange() const + { + return (sal_Bool)(ePositionMode == IcnViewPositionModeAutoArrange); + } + sal_Bool IsAutoAdjust() const + { + return (sal_Bool)(ePositionMode == IcnViewPositionModeAutoAdjust); + } + void DocRectChanged() { aDocRectChangedTimer.Start(); } + void VisRectChanged() { aVisRectChangedTimer.Start(); } + void SetOrigin( const Point&, sal_Bool bDoNotUpdateWallpaper = sal_False ); + + DECL_LINK( TextEditEndedHdl, IcnViewEdit_Impl* ); + + void ShowFocus ( Rectangle& rRect ); + void HideFocus (); + void DrawFocusRect ( OutputDevice* pOut ); sal_Bool IsMnemonicChar( sal_Unicode cChar, sal_uLong& rPos ) const; public: - long nGridDX, - nGridDY; - long nHorSBarHeight, - nVerSBarWidth; + long nGridDX; + long nGridDY; + long nHorSBarHeight; + long nVerSBarWidth; - SvxIconChoiceCtrl_Impl( SvtIconChoiceCtrl* pView, WinBits nWinStyle ); - ~SvxIconChoiceCtrl_Impl(); + SvxIconChoiceCtrl_Impl( SvtIconChoiceCtrl* pView, WinBits nWinStyle ); + ~SvxIconChoiceCtrl_Impl(); sal_Bool SetChoiceWithCursor ( sal_Bool bDo = sal_True ) { sal_Bool bOld=bChooseWithCursor; bChooseWithCursor = bDo; return bOld; } - void Clear( sal_Bool bInCtor = sal_False ); - void SetStyle( WinBits nWinStyle ); - WinBits GetStyle() const { return nWinBits; } - void InsertEntry( SvxIconChoiceCtrlEntry*, sal_uLong nPos, const Point* pPos=0 ); - void CreateAutoMnemonics( MnemonicGenerator* _pGenerator = NULL ); - void RemoveEntry( SvxIconChoiceCtrlEntry* pEntry ); - void FontModified(); - void SelectAll( sal_Bool bSelect = sal_True, sal_Bool bPaint = sal_True ); - void SelectEntry( - SvxIconChoiceCtrlEntry*, - sal_Bool bSelect, - sal_Bool bCallHdl = sal_True, - sal_Bool bAddToSelection = sal_False, - sal_Bool bSyncPaint = sal_False ); - void Paint( const Rectangle& rRect ); + void Clear( sal_Bool bInCtor = sal_False ); + void SetStyle( WinBits nWinStyle ); + WinBits GetStyle() const { return nWinBits; } + void InsertEntry( SvxIconChoiceCtrlEntry*, size_t nPos, const Point* pPos=0 ); + void CreateAutoMnemonics( MnemonicGenerator* _pGenerator = NULL ); + void RemoveEntry( SvxIconChoiceCtrlEntry* pEntry ); + void FontModified(); + void SelectAll( sal_Bool bSelect = sal_True, sal_Bool bPaint = sal_True ); + void SelectEntry( + SvxIconChoiceCtrlEntry*, + sal_Bool bSelect, + sal_Bool bCallHdl = sal_True, + sal_Bool bAddToSelection = sal_False, + sal_Bool bSyncPaint = sal_False + ); + void Paint( const Rectangle& rRect ); sal_Bool MouseButtonDown( const MouseEvent& ); sal_Bool MouseButtonUp( const MouseEvent& ); sal_Bool MouseMove( const MouseEvent&); sal_Bool RequestHelp( const HelpEvent& rHEvt ); - void SetCursor_Impl( - SvxIconChoiceCtrlEntry* pOldCursor, - SvxIconChoiceCtrlEntry* pNewCursor, - sal_Bool bMod1, - sal_Bool bShift, - sal_Bool bPaintSync = sal_False); + void SetCursor_Impl( + SvxIconChoiceCtrlEntry* pOldCursor, + SvxIconChoiceCtrlEntry* pNewCursor, + sal_Bool bMod1, + sal_Bool bShift, + sal_Bool bPaintSync = sal_False + ); sal_Bool KeyInput( const KeyEvent& ); - void Resize(); - void GetFocus(); - void LoseFocus(); - void SetUpdateMode( sal_Bool bUpdate ); + void Resize(); + void GetFocus(); + void LoseFocus(); + void SetUpdateMode( sal_Bool bUpdate ); sal_Bool GetUpdateMode() const { return bUpdateMode; } - void PaintEntry( SvxIconChoiceCtrlEntry* pEntry, sal_Bool bIsBackgroundPainted=sal_False ); - void PaintEntry( - SvxIconChoiceCtrlEntry*, - const Point&, - OutputDevice* pOut = 0, - sal_Bool bIsBackgroundPainted = sal_False); - void PaintEntryVirtOutDev( SvxIconChoiceCtrlEntry* ); - - void SetEntryPos( - SvxIconChoiceCtrlEntry* pEntry, - const Point& rPos, - sal_Bool bAdjustRow = sal_False, - sal_Bool bCheckScrollBars = sal_False, - sal_Bool bKeepGridMap = sal_False ); - - void InvalidateEntry( SvxIconChoiceCtrlEntry* ); + void PaintEntry( + SvxIconChoiceCtrlEntry* pEntry, + sal_Bool bIsBackgroundPainted=sal_False + ); + void PaintEntry( + SvxIconChoiceCtrlEntry*, + const Point&, + OutputDevice* pOut = 0, + sal_Bool bIsBackgroundPainted = sal_False + ); + void PaintEntryVirtOutDev( SvxIconChoiceCtrlEntry* ); + + void SetEntryPos( + SvxIconChoiceCtrlEntry* pEntry, + const Point& rPos, + sal_Bool bAdjustRow = sal_False, + sal_Bool bCheckScrollBars = sal_False, + sal_Bool bKeepGridMap = sal_False + ); + + void InvalidateEntry( SvxIconChoiceCtrlEntry* ); IcnViewFieldType GetItem( SvxIconChoiceCtrlEntry*, const Point& rAbsPos ); - void SetNoSelection(); + void SetNoSelection(); SvxIconChoiceCtrlEntry* GetCurEntry() const { return pCursor; } - void SetCursor( - SvxIconChoiceCtrlEntry*, - // sal_True == bei Single-Selection die Sel. mitfuehren - sal_Bool bSyncSingleSelection = sal_True, - sal_Bool bShowFocusAsync = sal_False ); + void SetCursor( + SvxIconChoiceCtrlEntry*, + // sal_True == bei Single-Selection die Sel. mitfuehren + sal_Bool bSyncSingleSelection = sal_True, + sal_Bool bShowFocusAsync = sal_False + ); SvxIconChoiceCtrlEntry* GetEntry( const Point& rDocPos, sal_Bool bHit = sal_False ); SvxIconChoiceCtrlEntry* GetNextEntry( const Point& rDocPos, SvxIconChoiceCtrlEntry* pCurEntry ); - SvxIconChoiceCtrlEntry* GetPrevEntry( const Point& rDocPos, SvxIconChoiceCtrlEntry* pCurEntry ); - - Point GetEntryPos( SvxIconChoiceCtrlEntry* ); - void MakeEntryVisible( SvxIconChoiceCtrlEntry* pEntry, sal_Bool bBound = sal_True ); - - void Arrange(sal_Bool bKeepPredecessors = sal_False, long nSetMaxVirtWidth =0, long nSetMaxVirtHeight =0 ); - - Rectangle CalcFocusRect( SvxIconChoiceCtrlEntry* ); - Rectangle CalcBmpRect( SvxIconChoiceCtrlEntry*, const Point* pPos = 0 ); - Rectangle CalcTextRect( - SvxIconChoiceCtrlEntry*, - const Point* pPos = 0, - sal_Bool bForInplaceEdit = sal_False, - const String* pStr = 0 ); - - long CalcBoundingWidth( SvxIconChoiceCtrlEntry* ) const; - long CalcBoundingHeight( SvxIconChoiceCtrlEntry* ) const; - Size CalcBoundingSize( SvxIconChoiceCtrlEntry* ) const; - void FindBoundingRect( SvxIconChoiceCtrlEntry* pEntry ); - void SetBoundingRect_Impl( - SvxIconChoiceCtrlEntry* pEntry, - const Point& rPos, - const Size& rBoundingSize ); + + Point GetEntryPos( SvxIconChoiceCtrlEntry* ); + void MakeEntryVisible( SvxIconChoiceCtrlEntry* pEntry, sal_Bool bBound = sal_True ); + + void Arrange( + sal_Bool bKeepPredecessors = sal_False, + long nSetMaxVirtWidth =0, + long nSetMaxVirtHeight =0 + ); + + Rectangle CalcFocusRect( SvxIconChoiceCtrlEntry* ); + Rectangle CalcBmpRect( SvxIconChoiceCtrlEntry*, const Point* pPos = 0 ); + Rectangle CalcTextRect( + SvxIconChoiceCtrlEntry*, + const Point* pPos = 0, + sal_Bool bForInplaceEdit = sal_False, + const String* pStr = 0 + ); + + long CalcBoundingWidth( SvxIconChoiceCtrlEntry* ) const; + long CalcBoundingHeight( SvxIconChoiceCtrlEntry* ) const; + Size CalcBoundingSize( SvxIconChoiceCtrlEntry* ) const; + void FindBoundingRect( SvxIconChoiceCtrlEntry* pEntry ); + void SetBoundingRect_Impl( + SvxIconChoiceCtrlEntry* pEntry, + const Point& rPos, + const Size& rBoundingSize + ); // berechnet alle BoundRects neu - void RecalcAllBoundingRects(); + void RecalcAllBoundingRects(); // berechnet alle ungueltigen BoundRects neu - void RecalcAllBoundingRectsSmart(); - const Rectangle& GetEntryBoundRect( SvxIconChoiceCtrlEntry* ); - void InvalidateBoundingRect( SvxIconChoiceCtrlEntry* ); - void InvalidateBoundingRect( Rectangle& rRect ) { rRect.Right() = LONG_MAX; bBoundRectsDirty = sal_True; } + void RecalcAllBoundingRectsSmart(); + const Rectangle& GetEntryBoundRect( SvxIconChoiceCtrlEntry* ); + void InvalidateBoundingRect( SvxIconChoiceCtrlEntry* ); + void InvalidateBoundingRect( Rectangle& rRect ) { rRect.Right() = LONG_MAX; bBoundRectsDirty = sal_True; } sal_Bool IsBoundingRectValid( const Rectangle& rRect ) const { return (sal_Bool)( rRect.Right() != LONG_MAX ); } - void PaintEmphasis( - const Rectangle& rRect1, - const Rectangle& rRect2, - sal_Bool bSelected, - sal_Bool bDropTarget, - sal_Bool bCursored, - OutputDevice* pOut, - sal_Bool bIsBackgroundPainted = sal_False); - - void PaintItem( - const Rectangle& rRect, - IcnViewFieldType eItem, - SvxIconChoiceCtrlEntry* pEntry, - sal_uInt16 nPaintFlags, - OutputDevice* pOut, - const String* pStr = 0, - ::vcl::ControlLayoutData* _pLayoutData = NULL ); + void PaintEmphasis( + const Rectangle& rRect1, + const Rectangle& rRect2, + sal_Bool bSelected, + sal_Bool bDropTarget, + sal_Bool bCursored, + OutputDevice* pOut, + sal_Bool bIsBackgroundPainted = sal_False + ); + + void PaintItem( + const Rectangle& rRect, + IcnViewFieldType eItem, + SvxIconChoiceCtrlEntry* pEntry, + sal_uInt16 nPaintFlags, + OutputDevice* pOut, + const String* pStr = 0, + ::vcl::ControlLayoutData* _pLayoutData = NULL + ); // berechnet alle BoundingRects neu, wenn bMustRecalcBoundingRects == sal_True - void CheckBoundingRects() { if (bBoundRectsDirty) RecalcAllBoundingRectsSmart(); } + void CheckBoundingRects() { if (bBoundRectsDirty) RecalcAllBoundingRectsSmart(); } // berechnet alle invalidierten BoundingRects neu - void UpdateBoundingRects(); - void ShowTargetEmphasis( SvxIconChoiceCtrlEntry* pEntry, sal_Bool bShow ); - void PrepareCommandEvent( const CommandEvent& ); - void Command( const CommandEvent& rCEvt ); - void ToTop( SvxIconChoiceCtrlEntry* ); + void UpdateBoundingRects(); + void ShowTargetEmphasis( SvxIconChoiceCtrlEntry* pEntry, sal_Bool bShow ); + void PrepareCommandEvent( const CommandEvent& ); + void Command( const CommandEvent& rCEvt ); + void ToTop( SvxIconChoiceCtrlEntry* ); sal_uLong GetSelectionCount() const; - void SetGrid( const Size& ); - Size GetMinGrid() const; + void SetGrid( const Size& ); + Size GetMinGrid() const; sal_uLong GetGridCount( const Size& rSize, sal_Bool bCheckScrBars, sal_Bool bSmartScrBar ) const; - void Scroll( long nDeltaX, long nDeltaY, sal_Bool bScrollBar = sal_False ); - const Size& GetItemSize( SvxIconChoiceCtrlEntry*, IcnViewFieldType ) const; + void Scroll( long nDeltaX, long nDeltaY, sal_Bool bScrollBar = sal_False ); + const Size& GetItemSize( SvxIconChoiceCtrlEntry*, IcnViewFieldType ) const; - void HideDDIcon(); - void ShowDDIcon( SvxIconChoiceCtrlEntry* pRefEntry, const Point& rPos ); - void HideShowDDIcon( - SvxIconChoiceCtrlEntry* pRefEntry, - const Point& rPos ); + void HideDDIcon(); + void ShowDDIcon( SvxIconChoiceCtrlEntry* pRefEntry, const Point& rPos ); + void HideShowDDIcon( + SvxIconChoiceCtrlEntry* pRefEntry, + const Point& rPos + ); sal_Bool IsOver( - SvPtrarr* pSelectedRectList, - const Rectangle& rEntryBoundRect ) const; - - void SelectRect( - const Rectangle&, - sal_Bool bAdd = sal_True, - SvPtrarr* pOtherRects = 0 ); - - void CalcScrollOffsets( - const Point& rRefPosPixel, - long& rX, - long& rY, - sal_Bool bDragDrop = sal_False, - sal_uInt16 nBorderWidth = 10 ); + SvPtrarr* pSelectedRectList, + const Rectangle& rEntryBoundRect + ) const; + + void SelectRect( + const Rectangle&, + sal_Bool bAdd = sal_True, + SvPtrarr* pOtherRects = 0 + ); + + void CalcScrollOffsets( + const Point& rRefPosPixel, + long& rX, + long& rY, + sal_Bool bDragDrop = sal_False, + sal_uInt16 nBorderWidth = 10 + ); sal_Bool IsTextHit( SvxIconChoiceCtrlEntry* pEntry, const Point& rDocPos ); - void MakeVisible( - const Rectangle& rDocPos, - sal_Bool bInScrollBarEvent=sal_False, - sal_Bool bCallRectChangedHdl = sal_True ); - - void AdjustEntryAtGrid( SvxIconChoiceCtrlEntry* pStart = 0 ); - void SetEntryTextMode( SvxIconChoiceCtrlTextMode, SvxIconChoiceCtrlEntry* pEntry = 0 ); + void MakeVisible( + const Rectangle& rDocPos, + sal_Bool bInScrollBarEvent=sal_False, + sal_Bool bCallRectChangedHdl = sal_True + ); + + void AdjustEntryAtGrid( SvxIconChoiceCtrlEntry* pStart = 0 ); + void SetEntryTextMode( + SvxIconChoiceCtrlTextMode, + SvxIconChoiceCtrlEntry* pEntry = 0 + ); SvxIconChoiceCtrlTextMode GetTextMode( const SvxIconChoiceCtrlEntry* pEntry = 0 ) const; - void ShowEntryFocusRect( const SvxIconChoiceCtrlEntry* pEntry ); - void EnableEntryEditing( sal_Bool bEnable ) { bEntryEditingEnabled = bEnable; } + void ShowEntryFocusRect( const SvxIconChoiceCtrlEntry* pEntry ); + void EnableEntryEditing( sal_Bool bEnable ) { bEntryEditingEnabled = bEnable; } sal_Bool IsEntryEditingEnabled() const { return bEntryEditingEnabled; } sal_Bool IsEntryEditing() const { return (sal_Bool)(pCurEditedEntry!=0); } - void EditEntry( SvxIconChoiceCtrlEntry* pEntry ); - void StopEntryEditing( sal_Bool bCancel ); - void LockEntryPos( SvxIconChoiceCtrlEntry* pEntry, sal_Bool bLock ); - sal_uLong GetEntryCount() const { return aEntries.Count(); } - SvxIconChoiceCtrlEntry* GetEntry( sal_uLong nPos ) const { return (SvxIconChoiceCtrlEntry*)aEntries.GetObject(nPos); } + void EditEntry( SvxIconChoiceCtrlEntry* pEntry ); + void StopEntryEditing( sal_Bool bCancel ); + void LockEntryPos( SvxIconChoiceCtrlEntry* pEntry, sal_Bool bLock ); + size_t GetEntryCount() const { return aEntries.size(); } + SvxIconChoiceCtrlEntry* GetEntry( size_t nPos ) + { + return aEntries[ nPos ]; + } + SvxIconChoiceCtrlEntry* GetEntry( size_t nPos ) const + { + return aEntries[ nPos ]; + } SvxIconChoiceCtrlEntry* GetFirstSelectedEntry( sal_uLong& ) const; SvxIconChoiceCtrlEntry* GetNextSelectedEntry( sal_uLong& ) const; SvxIconChoiceCtrlEntry* GetHdlEntry() const { return pHdlEntry; } - void SetHdlEntry( SvxIconChoiceCtrlEntry* pEntry ) { pHdlEntry = pEntry; } + void SetHdlEntry( SvxIconChoiceCtrlEntry* pEntry ) { pHdlEntry = pEntry; } SvxIconChoiceCtrlTextMode GetEntryTextModeSmart( const SvxIconChoiceCtrlEntry* pEntry ) const; - void SetSelectionMode( SelectionMode eMode ) { eSelectionMode=eMode; } - SelectionMode GetSelectionMode() const { return eSelectionMode; } + void SetSelectionMode( SelectionMode eMode ) { eSelectionMode=eMode; } + SelectionMode GetSelectionMode() const { return eSelectionMode; } sal_Bool AreEntriesMoved() const { return (sal_Bool)((nFlags & F_MOVED_ENTRIES)!=0); } - void SetEntriesMoved( sal_Bool bMoved ) - { - if( bMoved ) nFlags |= F_MOVED_ENTRIES; - else nFlags &= ~(F_MOVED_ENTRIES); - } + void SetEntriesMoved( sal_Bool bMoved ) + { + if( bMoved ) + nFlags |= F_MOVED_ENTRIES; + else + nFlags &= ~(F_MOVED_ENTRIES); + } sal_uLong GetEntryListPos( SvxIconChoiceCtrlEntry* ) const; - void SetEntryListPos( SvxIconChoiceCtrlEntry* pEntry, sal_uLong nNewPos ); - void SetEntryImageSize( const Size& rSize ) { aImageSize = rSize; } - void SetEntryFlags( SvxIconChoiceCtrlEntry* pEntry, sal_uInt16 nFlags ); + void SetEntryListPos( SvxIconChoiceCtrlEntry* pEntry, sal_uLong nNewPos ); + void SetEntryImageSize( const Size& rSize ) { aImageSize = rSize; } + void SetEntryFlags( SvxIconChoiceCtrlEntry* pEntry, sal_uInt16 nFlags ); SvxIconChoiceCtrlEntry* GoLeftRight( SvxIconChoiceCtrlEntry*, sal_Bool bRight ); SvxIconChoiceCtrlEntry* GoUpDown( SvxIconChoiceCtrlEntry*, sal_Bool bDown ); - void InitSettings(); - Rectangle GetOutputRect() const; + void InitSettings(); + Rectangle GetOutputRect() const; sal_Bool ArePredecessorsSet() const { return (sal_Bool)(pHead != 0); } SvxIconChoiceCtrlEntry* GetPredecessorHead() const { return pHead; } - void SetEntryPredecessor(SvxIconChoiceCtrlEntry* pEntry,SvxIconChoiceCtrlEntry* pPredecessor); + void SetEntryPredecessor(SvxIconChoiceCtrlEntry* pEntry,SvxIconChoiceCtrlEntry* pPredecessor); sal_Bool GetEntryPredecessor(SvxIconChoiceCtrlEntry* pEntry,SvxIconChoiceCtrlEntry** ppPredecessor); // liefert gueltige Ergebnisse nur im AutoArrange-Modus! SvxIconChoiceCtrlEntry* FindEntryPredecessor( SvxIconChoiceCtrlEntry* pEntry, const Point& ); - void SetPositionMode( SvxIconChoiceCtrlPositionMode ); + void SetPositionMode( SvxIconChoiceCtrlPositionMode ); SvxIconChoiceCtrlPositionMode GetPositionMode() const { return ePositionMode;} - void Flush(); - void SetColumn( sal_uInt16 nIndex, const SvxIconChoiceCtrlColumnInfo& ); + void Flush(); + void SetColumn( sal_uInt16 nIndex, const SvxIconChoiceCtrlColumnInfo& ); const SvxIconChoiceCtrlColumnInfo* GetColumn( sal_uInt16 nIndex ) const; const SvxIconChoiceCtrlColumnInfo* GetItemColumn( sal_uInt16 nSubItem, long& rLeft ) const; - Rectangle GetDocumentRect() const { return Rectangle( Point(), aVirtOutputSize ); } - Rectangle GetVisibleRect() const { return GetOutputRect(); } - - void SetEntryHighlightFrame( SvxIconChoiceCtrlEntry* pEntry,sal_Bool bKeepHighlightFlags=sal_False ); - void HideEntryHighlightFrame(); - void DrawHighlightFrame( OutputDevice* pOut, - const Rectangle& rBmpRect, sal_Bool bHide ); - void StopSelectTimer() { aCallSelectHdlTimer.Stop(); } - void Tracking( const TrackingEvent& rTEvt ); - Point GetPopupMenuPosPixel() const; + Rectangle GetDocumentRect() const { return Rectangle( Point(), aVirtOutputSize ); } + Rectangle GetVisibleRect() const { return GetOutputRect(); } + + void SetEntryHighlightFrame( + SvxIconChoiceCtrlEntry* pEntry, + sal_Bool bKeepHighlightFlags=sal_False + ); + void HideEntryHighlightFrame(); + void DrawHighlightFrame( + OutputDevice* pOut, + const Rectangle& rBmpRect, + sal_Bool bHide + ); + void StopSelectTimer() { aCallSelectHdlTimer.Stop(); } + void Tracking( const TrackingEvent& rTEvt ); + Point GetPopupMenuPosPixel() const; sal_Bool HandleShortCutKey( const KeyEvent& rKeyEvent ); - void CallEventListeners( sal_uLong nEvent, void* pData = NULL ); + void CallEventListeners( sal_uLong nEvent, void* pData = NULL ); - inline ::svt::IAccessibleFactory& - GetAccessibleFactory() { return aAccFactory.getFactory(); } + inline ::svt::IAccessibleFactory& GetAccessibleFactory() + { + return aAccFactory.getFactory(); + } }; // ---------------------------------------------------------------------------------------------- @@ -544,28 +619,40 @@ public: class IcnCursor_Impl { SvxIconChoiceCtrl_Impl* pView; - SvPtrarr* pColumns; - SvPtrarr* pRows; - long nCols; - long nRows; - short nDeltaWidth; - short nDeltaHeight; + SvPtrarr* pColumns; + SvPtrarr* pRows; + long nCols; + long nRows; + short nDeltaWidth; + short nDeltaHeight; SvxIconChoiceCtrlEntry* pCurEntry; - void SetDeltas(); - void ImplCreate(); - void Create() { if( !pColumns ) ImplCreate(); } - - sal_uInt16 GetSortListPos( SvPtrarr* pList, long nValue, int bVertical); - SvxIconChoiceCtrlEntry* SearchCol(sal_uInt16 nCol,sal_uInt16 nTop,sal_uInt16 nBottom,sal_uInt16 nPref, - sal_Bool bDown, sal_Bool bSimple ); - - SvxIconChoiceCtrlEntry* SearchRow(sal_uInt16 nRow,sal_uInt16 nRight,sal_uInt16 nLeft,sal_uInt16 nPref, - sal_Bool bRight, sal_Bool bSimple ); + void SetDeltas(); + void ImplCreate(); + void Create() { if( !pColumns ) ImplCreate(); } + + sal_uInt16 GetSortListPos( SvPtrarr* pList, long nValue, int bVertical); + SvxIconChoiceCtrlEntry* SearchCol( + sal_uInt16 nCol, + sal_uInt16 nTop, + sal_uInt16 nBottom, + sal_uInt16 nPref, + sal_Bool bDown, + sal_Bool bSimple + ); + + SvxIconChoiceCtrlEntry* SearchRow( + sal_uInt16 nRow, + sal_uInt16 nRight, + sal_uInt16 nLeft, + sal_uInt16 nPref, + sal_Bool bRight, + sal_Bool bSimple + ); public: - IcnCursor_Impl( SvxIconChoiceCtrl_Impl* pOwner ); - ~IcnCursor_Impl(); - void Clear(); + IcnCursor_Impl( SvxIconChoiceCtrl_Impl* pOwner ); + ~IcnCursor_Impl(); + void Clear(); // fuer Cursortravelling usw. SvxIconChoiceCtrlEntry* GoLeftRight( SvxIconChoiceCtrlEntry*, sal_Bool bRight ); @@ -576,8 +663,8 @@ public: // sortierte Liste der Eintraege, die in ihr stehen. Eine Liste kann // leer sein. Die Listen gehen in das Eigentum des Rufenden ueber und // muessen mit DestroyGridAdjustData geloescht werden - void CreateGridAjustData( SvPtrarr& pLists, SvxIconChoiceCtrlEntry* pRow=0); - static void DestroyGridAdjustData( SvPtrarr& rLists ); + void CreateGridAjustData( SvPtrarr& pLists, SvxIconChoiceCtrlEntry* pRow=0); + static void DestroyGridAdjustData( SvPtrarr& rLists ); }; // ---------------------------------------------------------------------------------------------- @@ -588,48 +675,46 @@ typedef sal_uLong GridId; class IcnGridMap_Impl { - Rectangle _aLastOccupiedGrid; + Rectangle _aLastOccupiedGrid; SvxIconChoiceCtrl_Impl* _pView; - sal_Bool* _pGridMap; - sal_uInt16 _nGridCols, _nGridRows; + sal_Bool* _pGridMap; + sal_uInt16 _nGridCols, _nGridRows; - void Expand(); - void Create_Impl(); - void Create() { if(!_pGridMap) Create_Impl(); } + void Expand(); + void Create_Impl(); + void Create() { if(!_pGridMap) Create_Impl(); } - void GetMinMapSize( sal_uInt16& rDX, sal_uInt16& rDY ) const; + void GetMinMapSize( sal_uInt16& rDX, sal_uInt16& rDY ) const; public: - IcnGridMap_Impl(SvxIconChoiceCtrl_Impl* pView); - ~IcnGridMap_Impl(); - - void Clear(); - - GridId GetGrid( const Point& rDocPos, sal_Bool* pbClipped = 0 ); - GridId GetGrid( sal_uInt16 nGridX, sal_uInt16 nGridY ); - GridId GetUnoccupiedGrid( sal_Bool bOccupyFound=sal_True ); - - void OccupyGrids( const Rectangle&, sal_Bool bOccupy = sal_True ); - void OccupyGrids( const SvxIconChoiceCtrlEntry*, sal_Bool bOccupy = sal_True ); - void OccupyGrid( GridId nId, sal_Bool bOccupy = sal_True ) - { - DBG_ASSERT(!_pGridMap || nId<(sal_uLong)(_nGridCols*_nGridRows),"OccupyGrid: Bad GridId"); - if(_pGridMap && nId < (sal_uLong)(_nGridCols *_nGridRows) ) - _pGridMap[ nId ] = bOccupy; - } - - Rectangle GetGridRect( GridId ); - void GetGridCoord( GridId, sal_uInt16& rGridX, sal_uInt16& rGridY ); - static sal_uLong GetGridCount( const Size& rSizePixel, sal_uInt16 nGridWidth, sal_uInt16 nGridHeight ); - - void OutputSizeChanged(); + IcnGridMap_Impl(SvxIconChoiceCtrl_Impl* pView); + ~IcnGridMap_Impl(); + + void Clear(); + + GridId GetGrid( const Point& rDocPos, sal_Bool* pbClipped = 0 ); + GridId GetGrid( sal_uInt16 nGridX, sal_uInt16 nGridY ); + GridId GetUnoccupiedGrid( sal_Bool bOccupyFound=sal_True ); + + void OccupyGrids( const SvxIconChoiceCtrlEntry*, sal_Bool bOccupy = sal_True ); + void OccupyGrid( GridId nId, sal_Bool bOccupy = sal_True ) + { + DBG_ASSERT(!_pGridMap || nId<(sal_uLong)(_nGridCols*_nGridRows),"OccupyGrid: Bad GridId"); + if(_pGridMap && nId < (sal_uLong)(_nGridCols *_nGridRows) ) + _pGridMap[ nId ] = bOccupy; + } + + Rectangle GetGridRect( GridId ); + void GetGridCoord( GridId, sal_uInt16& rGridX, sal_uInt16& rGridY ); + static sal_uLong GetGridCount( + const Size& rSizePixel, + sal_uInt16 nGridWidth, + sal_uInt16 nGridHeight + ); + + void OutputSizeChanged(); }; - - - - #endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/contnr/imivctl1.cxx b/svtools/source/contnr/imivctl1.cxx index 640f6c5ae923..8602fa4cacfd 100644 --- a/svtools/source/contnr/imivctl1.cxx +++ b/svtools/source/contnr/imivctl1.cxx @@ -103,8 +103,10 @@ public: sal_Bool IsGrabFocus() const { return bGrabFocus; } }; -SvxIconChoiceCtrl_Impl::SvxIconChoiceCtrl_Impl( SvtIconChoiceCtrl* pCurView, - WinBits nWinStyle ) : +SvxIconChoiceCtrl_Impl::SvxIconChoiceCtrl_Impl( + SvtIconChoiceCtrl* pCurView, + WinBits nWinStyle +) : aEntries( this ), aVerSBar( pCurView, WB_DRAG | WB_VSCROLL ), aHorSBar( pCurView, WB_DRAG | WB_HSCROLL ), @@ -129,7 +131,7 @@ SvxIconChoiceCtrl_Impl::SvxIconChoiceCtrl_Impl( SvtIconChoiceCtrl* pCurView, bHighlightFramePressed = sal_False; eSelectionMode = MULTIPLE_SELECTION; pView = pCurView; - pZOrderList = new List; //SvPtrarr; + pZOrderList = new SvxIconChoiceCtrlEntryList_impl(); ePositionMode = IcnViewPositionModeFree; SetStyle( nWinStyle ); nFlags = 0; @@ -218,19 +220,19 @@ void SvxIconChoiceCtrl_Impl::Clear( sal_Bool bInCtor ) nMaxVirtHeight = aSize.Height() - nHorSBarHeight; if( nMaxVirtHeight <= 0 ) nMaxVirtHeight = DEFAULT_MAX_VIRT_HEIGHT; - pZOrderList->Clear(); //Remove(0,pZOrderList->Count()); + pZOrderList->clear(); SetOrigin( Point() ); if( bUpdateMode ) pView->Invalidate(INVALIDATE_NOCHILDREN); } AdjustScrollBars(); - sal_uLong nCount = aEntries.Count(); - for( sal_uLong nCur = 0; nCur < nCount; nCur++ ) + size_t nCount = aEntries.size(); + for( size_t nCur = 0; nCur < nCount; nCur++ ) { - SvxIconChoiceCtrlEntry* pCur = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( nCur ); + SvxIconChoiceCtrlEntry* pCur = aEntries[ nCur ]; delete pCur; } - aEntries.Clear(); + aEntries.clear(); DocRectChanged(); VisRectChanged(); } @@ -292,19 +294,18 @@ void SvxIconChoiceCtrl_Impl::FontModified() ShowCursor( sal_True ); } -void SvxIconChoiceCtrl_Impl::InsertEntry( SvxIconChoiceCtrlEntry* pEntry, sal_uLong nPos, +void SvxIconChoiceCtrl_Impl::InsertEntry( SvxIconChoiceCtrlEntry* pEntry, size_t nPos, const Point* pPos ) { StopEditTimer(); - aEntries.Insert( pEntry, nPos ); - if( (nFlags & F_ENTRYLISTPOS_VALID) && nPos >= aEntries.Count() - 1 ) - pEntry->nPos = aEntries.Count() - 1; + aEntries.insert( nPos, pEntry ); + if( (nFlags & F_ENTRYLISTPOS_VALID) && nPos >= aEntries.size() - 1 ) + pEntry->nPos = aEntries.size() - 1; else nFlags &= ~F_ENTRYLISTPOS_VALID; - pZOrderList->Insert( (void*)pEntry, LIST_APPEND ); //pZOrderList->Count() ); + pZOrderList->push_back( pEntry ); pImpCursor->Clear(); -// pGridMap->Clear(); if( pPos ) { Size aSize( CalcBoundingSize( pEntry ) ); @@ -376,10 +377,10 @@ void SvxIconChoiceCtrl_Impl::SetListPositions() if( nFlags & F_ENTRYLISTPOS_VALID ) return; - sal_uLong nCount = aEntries.Count(); - for( sal_uLong nCur = 0; nCur < nCount; nCur++ ) + size_t nCount = aEntries.size(); + for( size_t nCur = 0; nCur < nCount; nCur++ ) { - SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( nCur ); + SvxIconChoiceCtrlEntry* pEntry = aEntries[ nCur ]; pEntry->nPos = nCur; } nFlags |= F_ENTRYLISTPOS_VALID; @@ -408,7 +409,7 @@ void SvxIconChoiceCtrl_Impl::RemoveEntry( SvxIconChoiceCtrlEntry* pEntry ) if( pEntry->IsSelected() ) CallSelectHandler( 0 ); - if( aEntries.Count() == 1 && aEntries.GetObject(0) == pEntry ) + if( aEntries.size() == 1 && aEntries[ 0 ] == pEntry ) { Clear(); return; @@ -435,21 +436,32 @@ void SvxIconChoiceCtrl_Impl::RemoveEntry( SvxIconChoiceCtrlEntry* pEntry ) } sal_Bool bCurEntryPosValid = (nFlags & F_ENTRYLISTPOS_VALID) ? sal_True : sal_False; - if( bCurEntryPosValid && aEntries.GetObject(aEntries.Count()-1) != pEntry ) + if( bCurEntryPosValid && aEntries[ aEntries.size()-1 ] != pEntry ) nFlags &= ~F_ENTRYLISTPOS_VALID; - sal_uLong nPos = pZOrderList->GetPos( (void*)pEntry ); - pZOrderList->Remove( nPos ); + + for ( + SvxIconChoiceCtrlEntryList_impl::iterator it = pZOrderList->begin(); + it < pZOrderList->end(); + ++it + ) { + if ( *it == pEntry ) + { + pZOrderList->erase( it ); + break; + } + } + if( bCurEntryPosValid ) { - DBG_ASSERT(aEntries.GetObject(pEntry->nPos)==pEntry,"RemoveEntry: Wrong nPos in entry"); - aEntries.Remove( pEntry->nPos ); + DBG_ASSERT(aEntries[ pEntry->nPos ] == pEntry,"RemoveEntry: Wrong nPos in entry"); + aEntries.remove( pEntry->nPos ); } else - aEntries.Remove( pEntry ); + aEntries.remove( pEntry ); pImpCursor->Clear(); pGridMap->Clear(); delete pEntry; - if( IsAutoArrange() && aEntries.Count() ) + if( IsAutoArrange() && aEntries.size() ) aAutoArrangeTimer.Start(); if( bSetNewCursor ) { @@ -544,10 +556,10 @@ void SvxIconChoiceCtrl_Impl::ResetVirtSize() StopEditTimer(); aVirtOutputSize.Width() = 0; aVirtOutputSize.Height() = 0; - const sal_uLong nCount = aEntries.Count(); - for( sal_uLong nCur = 0; nCur < nCount; nCur++ ) + const size_t nCount = aEntries.size(); + for( size_t nCur = 0; nCur < nCount; nCur++ ) { - SvxIconChoiceCtrlEntry* pCur = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( nCur ); + SvxIconChoiceCtrlEntry* pCur = aEntries[ nCur ]; pCur->ClearFlags( ICNVIEW_FLAG_POS_MOVED ); if( pCur->IsPosLocked() ) { @@ -616,25 +628,25 @@ void SvxIconChoiceCtrl_Impl::AdjustVirtSize( const Rectangle& rRect ) void SvxIconChoiceCtrl_Impl::InitPredecessors() { DBG_ASSERT(!pHead,"SvxIconChoiceCtrl_Impl::InitPredecessors() >> Already initialized"); - sal_uLong nCount = aEntries.Count(); + size_t nCount = aEntries.size(); if( nCount ) { - SvxIconChoiceCtrlEntry* pPrev = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( 0 ); - for( sal_uLong nCur = 1; nCur <= nCount; nCur++ ) + SvxIconChoiceCtrlEntry* pPrev = aEntries[ 0 ]; + for( size_t nCur = 1; nCur <= nCount; nCur++ ) { pPrev->ClearFlags( ICNVIEW_FLAG_POS_LOCKED | ICNVIEW_FLAG_POS_MOVED | ICNVIEW_FLAG_PRED_SET); SvxIconChoiceCtrlEntry* pNext; if( nCur == nCount ) - pNext = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( 0 ); + pNext = aEntries[ 0 ]; else - pNext = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( nCur ); + pNext = aEntries[ nCur ]; pPrev->pflink = pNext; pNext->pblink = pPrev; pPrev = pNext; } - pHead = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( 0 ); + pHead = aEntries[ 0 ]; } else pHead = 0; @@ -645,10 +657,10 @@ void SvxIconChoiceCtrl_Impl::ClearPredecessors() { if( pHead ) { - sal_uLong nCount = aEntries.Count(); - for( sal_uLong nCur = 0; nCur < nCount; nCur++ ) + size_t nCount = aEntries.size(); + for( size_t nCur = 0; nCur < nCount; nCur++ ) { - SvxIconChoiceCtrlEntry* pCur = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( nCur ); + SvxIconChoiceCtrlEntry* pCur = aEntries[ nCur ]; pCur->pflink = 0; pCur->pblink = 0; pCur->ClearFlags( ICNVIEW_FLAG_PRED_SET ); @@ -750,7 +762,7 @@ void SvxIconChoiceCtrl_Impl::Paint( const Rectangle& rRect ) #endif nFlags |= F_PAINTED; - if( !aEntries.Count() ) + if( !aEntries.size() ) return; if( !pCursor ) { @@ -767,14 +779,14 @@ void SvxIconChoiceCtrl_Impl::Paint( const Rectangle& rRect ) } if( !bfound ) - pCursor = (SvxIconChoiceCtrlEntry*)aEntries.First(); + pCursor = aEntries[ 0 ]; } // Show Focus at Init-Time if ( pView->HasFocus() ) GetFocus(); - sal_uLong nCount = pZOrderList->Count(); + size_t nCount = pZOrderList->size(); if( !nCount ) return; @@ -786,35 +798,33 @@ void SvxIconChoiceCtrl_Impl::Paint( const Rectangle& rRect ) pView->SetClipRegion( aOutputArea ); } - const sal_uInt16 nListInitSize = aEntries.Count() > USHRT_MAX ? - USHRT_MAX : (sal_uInt16)aEntries.Count(); - List* pNewZOrderList = new List( nListInitSize ); - List* pPaintedEntries = new List( nListInitSize ); + SvxIconChoiceCtrlEntryList_impl* pNewZOrderList = new SvxIconChoiceCtrlEntryList_impl(); + SvxIconChoiceCtrlEntryList_impl* pPaintedEntries = new SvxIconChoiceCtrlEntryList_impl(); - sal_uLong nPos = 0; + size_t nPos = 0; while( nCount ) { - SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)(pZOrderList->GetObject(nPos )); + SvxIconChoiceCtrlEntry* pEntry = (*pZOrderList)[ nPos ]; const Rectangle& rBoundRect = GetEntryBoundRect( pEntry ); if( rRect.IsOver( rBoundRect ) ) { PaintEntry( pEntry, rBoundRect.TopLeft(), pView, sal_True ); // Eintraege, die neu gezeichnet werden, auf Top setzen - pPaintedEntries->Insert( pEntry, LIST_APPEND ); + pPaintedEntries->push_back( pEntry ); } else - pNewZOrderList->Insert( pEntry, LIST_APPEND ); + pNewZOrderList->push_back( pEntry ); nCount--; nPos++; } delete pZOrderList; pZOrderList = pNewZOrderList; - nCount = pPaintedEntries->Count(); + nCount = pPaintedEntries->size(); if( nCount ) { - for( sal_uLong nCur = 0; nCur < nCount; nCur++ ) - pZOrderList->Insert( pPaintedEntries->GetObject(nCur), LIST_APPEND); + for( size_t nCur = 0; nCur < nCount; nCur++ ) + pZOrderList->push_back( (*pPaintedEntries)[ nCur ] ); } delete pPaintedEntries; @@ -824,7 +834,7 @@ void SvxIconChoiceCtrl_Impl::Paint( const Rectangle& rRect ) void SvxIconChoiceCtrl_Impl::RepaintEntries( sal_uInt16 nEntryFlagsMask ) { - const sal_uLong nCount = pZOrderList->Count(); + const size_t nCount = pZOrderList->size(); if( !nCount ) return; @@ -835,9 +845,9 @@ void SvxIconChoiceCtrl_Impl::RepaintEntries( sal_uInt16 nEntryFlagsMask ) bResetClipRegion = sal_True; pView->SetClipRegion( aOutRect ); } - for( sal_uLong nCur = 0; nCur < nCount; nCur++ ) + for( size_t nCur = 0; nCur < nCount; nCur++ ) { - SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)(pZOrderList->GetObject(nCur)); + SvxIconChoiceCtrlEntry* pEntry = (*pZOrderList)[ nCur ]; if( pEntry->GetFlags() & nEntryFlagsMask ) { const Rectangle& rBoundRect = GetEntryBoundRect( pEntry ); @@ -1379,7 +1389,7 @@ sal_Bool SvxIconChoiceCtrl_Impl::KeyInput( const KeyEvent& rKEvt ) case KEY_END: if( pCursor ) { - pNewCursor = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( aEntries.Count() - 1 ); + pNewCursor = aEntries[ aEntries.size() - 1 ]; SetCursor_Impl( pOldCursor, pNewCursor, bMod1, bShift, sal_True ); } break; @@ -1387,7 +1397,7 @@ sal_Bool SvxIconChoiceCtrl_Impl::KeyInput( const KeyEvent& rKEvt ) case KEY_HOME: if( pCursor ) { - pNewCursor = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( 0 ); + pNewCursor = aEntries[ 0 ]; SetCursor_Impl( pOldCursor, pNewCursor, bMod1, bShift, sal_True ); } break; @@ -1598,11 +1608,11 @@ sal_Bool SvxIconChoiceCtrl_Impl::CheckHorScrollBar() if(!( nWinBits & WB_HSCROLL) && !aOrigin.X() ) { long nWidth = aOutputSize.Width(); - const sal_uLong nCount = pZOrderList->Count(); + const size_t nCount = pZOrderList->size(); long nMostRight = 0; - for( sal_uLong nCur = 0; nCur < nCount; nCur++ ) + for( size_t nCur = 0; nCur < nCount; nCur++ ) { - SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)pZOrderList->GetObject(nCur); + SvxIconChoiceCtrlEntry* pEntry = (*pZOrderList)[ nCur ]; long nRight = GetEntryBoundRect(pEntry).Right(); if( nRight > nWidth ) return sal_False; @@ -1637,10 +1647,10 @@ sal_Bool SvxIconChoiceCtrl_Impl::CheckVerScrollBar() { long nDeepest = 0; long nHeight = aOutputSize.Height(); - const sal_uLong nCount = pZOrderList->Count(); - for( sal_uLong nCur = 0; nCur < nCount; nCur++ ) + const size_t nCount = pZOrderList->size(); + for( size_t nCur = 0; nCur < nCount; nCur++ ) { - SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)pZOrderList->GetObject(nCur); + SvxIconChoiceCtrlEntry* pEntry = (*pZOrderList)[ nCur ]; long nBottom = GetEntryBoundRect(pEntry).Bottom(); if( nBottom > nHeight ) return sal_False; @@ -2099,11 +2109,11 @@ SvxIconChoiceCtrlEntry* SvxIconChoiceCtrl_Impl::GetEntry( const Point& rDocPos, { CheckBoundingRects(); // Z-Order-Liste vom Ende her absuchen - sal_uLong nCount = pZOrderList->Count(); + size_t nCount = pZOrderList->size(); while( nCount ) { nCount--; - SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)(pZOrderList->GetObject(nCount)); + SvxIconChoiceCtrlEntry* pEntry = (*pZOrderList)[ nCount ]; if( pEntry->aRect.IsInside( rDocPos ) ) { if( bHit ) @@ -2126,45 +2136,32 @@ SvxIconChoiceCtrlEntry* SvxIconChoiceCtrl_Impl::GetEntry( const Point& rDocPos, return 0; } -SvxIconChoiceCtrlEntry* SvxIconChoiceCtrl_Impl::GetNextEntry( const Point& rDocPos, SvxIconChoiceCtrlEntry* pCurEntry ) -{ +SvxIconChoiceCtrlEntry* SvxIconChoiceCtrl_Impl::GetNextEntry( + const Point& rDocPos, + SvxIconChoiceCtrlEntry* pCurEntry +) { CheckBoundingRects(); SvxIconChoiceCtrlEntry* pTarget = 0; - const sal_uLong nStartPos = pZOrderList->GetPos( (void*)pCurEntry ); - if( nStartPos != LIST_ENTRY_NOTFOUND ) - { - const sal_uLong nCount = pZOrderList->Count(); - for( sal_uLong nCur = nStartPos+1; nCur < nCount; nCur++ ) + + for ( + SvxIconChoiceCtrlEntryList_impl::iterator it = pZOrderList->begin(); + it < pZOrderList->end(); + ++it + ) { + if ( *it == pCurEntry ) { - SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)(pZOrderList->GetObject(nCur)); - if( pEntry->aRect.IsInside( rDocPos ) ) + while ( ++it < pZOrderList->end() ) { - pTarget = pEntry; - break; + if ( (*it)->aRect.IsInside( rDocPos ) ) + { + pTarget = *it; + break; + } } + break; } } - return pTarget; -} -SvxIconChoiceCtrlEntry* SvxIconChoiceCtrl_Impl::GetPrevEntry( const Point& rDocPos, SvxIconChoiceCtrlEntry* pCurEntry ) -{ - CheckBoundingRects(); - SvxIconChoiceCtrlEntry* pTarget = 0; - sal_uLong nStartPos = pZOrderList->GetPos( (void*)pCurEntry ); - if( nStartPos != LIST_ENTRY_NOTFOUND && nStartPos != 0 ) - { - nStartPos--; - do - { - SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)(pZOrderList->GetObject(nStartPos)); - if( pEntry->aRect.IsInside( rDocPos ) ) - { - pTarget = pEntry; - break; - } - } while( nStartPos > 0 ); - } return pTarget; } @@ -2344,18 +2341,18 @@ Size SvxIconChoiceCtrl_Impl::CalcBoundingSize( SvxIconChoiceCtrlEntry* pEntry ) void SvxIconChoiceCtrl_Impl::RecalcAllBoundingRects() { nMaxBoundHeight = 0; - pZOrderList->Clear(); - sal_uLong nCount = aEntries.Count(); - sal_uLong nCur; + pZOrderList->clear(); + size_t nCount = aEntries.size(); + size_t nCur; SvxIconChoiceCtrlEntry* pEntry; if( !IsAutoArrange() || !pHead ) { for( nCur = 0; nCur < nCount; nCur++ ) { - pEntry = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( nCur ); + pEntry = aEntries[ nCur ]; FindBoundingRect( pEntry ); - pZOrderList->Insert( pEntry, LIST_APPEND ); + pZOrderList->push_back( pEntry ); } } else @@ -2366,7 +2363,7 @@ void SvxIconChoiceCtrl_Impl::RecalcAllBoundingRects() { DBG_ASSERT(pEntry->pflink&&pEntry->pblink,"SvxIconChoiceCtrl_Impl::RecalcAllBoundingRect > Bad link(s)"); FindBoundingRect( pEntry ); - pZOrderList->Insert( pEntry, pZOrderList->Count() ); + pZOrderList->push_back( pEntry ); pEntry = pEntry->pflink; nCur++; } @@ -2378,16 +2375,16 @@ void SvxIconChoiceCtrl_Impl::RecalcAllBoundingRects() void SvxIconChoiceCtrl_Impl::RecalcAllBoundingRectsSmart() { nMaxBoundHeight = 0; - pZOrderList->Clear(); - sal_uLong nCur; + pZOrderList->clear(); + size_t nCur; SvxIconChoiceCtrlEntry* pEntry; - const sal_uLong nCount = aEntries.Count(); + const size_t nCount = aEntries.size(); if( !IsAutoArrange() || !pHead ) { for( nCur = 0; nCur < nCount; nCur++ ) { - pEntry = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( nCur ); + pEntry = aEntries[ nCur ]; if( IsBoundingRectValid( pEntry->aRect )) { Size aBoundSize( pEntry->aRect.GetSize() ); @@ -2396,7 +2393,7 @@ void SvxIconChoiceCtrl_Impl::RecalcAllBoundingRectsSmart() } else FindBoundingRect( pEntry ); - pZOrderList->Insert( pEntry, LIST_APPEND ); + pZOrderList->push_back( pEntry ); } } else @@ -2414,7 +2411,7 @@ void SvxIconChoiceCtrl_Impl::RecalcAllBoundingRectsSmart() } else FindBoundingRect( pEntry ); - pZOrderList->Insert( pEntry, LIST_APPEND ); + pZOrderList->push_back( pEntry ); pEntry = pEntry->pflink; nCur++; } @@ -2424,10 +2421,10 @@ void SvxIconChoiceCtrl_Impl::RecalcAllBoundingRectsSmart() void SvxIconChoiceCtrl_Impl::UpdateBoundingRects() { - const sal_uLong nCount = aEntries.Count(); - for( sal_uLong nCur = 0; nCur < nCount; nCur++ ) + const size_t nCount = aEntries.size(); + for( size_t nCur = 0; nCur < nCount; nCur++ ) { - SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( nCur ); + SvxIconChoiceCtrlEntry* pEntry = aEntries[ nCur ]; GetEntryBoundRect( pEntry ); } } @@ -2754,25 +2751,28 @@ void SvxIconChoiceCtrl_Impl::Command( const CommandEvent& rCEvt ) (rCEvt.GetCommand() == COMMAND_STARTAUTOSCROLL) || (rCEvt.GetCommand() == COMMAND_AUTOSCROLL) ) { -#if 1 if( HandleScrollCommand( rCEvt ) ) return; -#else - ScrollBar* pHor = aHorSBar.IsVisible() ? &aHorSBar : 0; - ScrollBar* pVer = aVerSBar.IsVisible() ? &aVerSBar : 0; - if( pView->HandleScrollCommand( rCEvt, pHor, pVer ) ) - return; -#endif } } void SvxIconChoiceCtrl_Impl::ToTop( SvxIconChoiceCtrlEntry* pEntry ) { - if( pZOrderList->GetObject( pZOrderList->Count() - 1 ) != pEntry ) - { - sal_uLong nPos = pZOrderList->GetPos( (void*)pEntry ); - pZOrderList->Remove( nPos ); - pZOrderList->Insert( pEntry, LIST_APPEND ); + if( !pZOrderList->empty() + && pEntry != pZOrderList->back() + ) { + for( + SvxIconChoiceCtrlEntryList_impl::iterator it = pZOrderList->begin(); + it < pZOrderList->end(); + ++it + ) { + if ( *it == pEntry ) + { + pZOrderList->erase( it ); + pZOrderList->push_back( pEntry ); + break; + } + } } } @@ -2913,7 +2913,7 @@ SvxIconChoiceCtrlEntry* SvxIconChoiceCtrl_Impl::FindNewCursor() } } else - pNewCursor = (SvxIconChoiceCtrlEntry*)aEntries.First(); + pNewCursor = aEntries[ 0 ]; DBG_ASSERT(!pNewCursor|| (pCursor&&pCursor!=pNewCursor),"FindNewCursor failed"); return pNewCursor; } @@ -2942,10 +2942,10 @@ void SvxIconChoiceCtrl_Impl::DeselectAllBut( SvxIconChoiceCtrlEntry* pThisEntryN // // !!!!!!! Todo: Evtl. Z-Orderlist abarbeiten !!!!!!! // - sal_uLong nCount = aEntries.Count(); - for( sal_uLong nCur = 0; nCur < nCount; nCur++ ) + size_t nCount = aEntries.size(); + for( size_t nCur = 0; nCur < nCount; nCur++ ) { - SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( nCur ); + SvxIconChoiceCtrlEntry* pEntry = aEntries[ nCur ]; if( pEntry != pThisEntryNot && pEntry->IsSelected() ) SelectEntry( pEntry, sal_False, sal_True, sal_True, bPaintSync ); } @@ -3148,7 +3148,7 @@ void SvxIconChoiceCtrl_Impl::SelectRect( const Rectangle& rRect, sal_Bool bAdd, SvPtrarr* pOtherRects ) { aCurSelectionRect = rRect; - if( !pZOrderList || !pZOrderList->Count() ) + if( !pZOrderList || !pZOrderList->size() ) return; // Flag setzen, damit im Select kein ToTop gerufen wird @@ -3157,7 +3157,7 @@ void SvxIconChoiceCtrl_Impl::SelectRect( const Rectangle& rRect, sal_Bool bAdd, CheckBoundingRects(); pView->Update(); - const sal_uLong nCount = pZOrderList->Count(); + const size_t nCount = pZOrderList->size(); Rectangle aRect( rRect ); aRect.Justify(); @@ -3170,9 +3170,9 @@ void SvxIconChoiceCtrl_Impl::SelectRect( const Rectangle& rRect, sal_Bool bAdd, pView->SetClipRegion( GetOutputRect() ); } - for( sal_uLong nPos = 0; nPos < nCount; nPos++ ) + for( size_t nPos = 0; nPos < nCount; nPos++ ) { - SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)(pZOrderList->GetObject(nPos )); + SvxIconChoiceCtrlEntry* pEntry = (*pZOrderList)[ nPos ]; if( !IsBoundingRectValid( pEntry->aRect )) FindBoundingRect( pEntry ); @@ -3612,8 +3612,8 @@ sal_Bool SvxIconChoiceCtrl_Impl::IsMnemonicChar( sal_Unicode cChar, sal_uLong& r { sal_Bool bRet = sal_False; const vcl::I18nHelper& rI18nHelper = Application::GetSettings().GetUILocaleI18nHelper(); - sal_uLong nEntryCount = GetEntryCount(); - for ( sal_uLong i = 0; i < nEntryCount; ++i ) + size_t nEntryCount = GetEntryCount(); + for ( size_t i = 0; i < nEntryCount; ++i ) { if ( rI18nHelper.MatchMnemonic( GetEntry( i )->GetText(), cChar ) ) { @@ -3758,12 +3758,12 @@ SvxIconChoiceCtrlEntry* SvxIconChoiceCtrl_Impl::GetFirstSelectedEntry( sal_uLong return pCurHighlightFrame; } - sal_uLong nCount = aEntries.Count(); + size_t nCount = aEntries.size(); if( !pHead ) { - for( sal_uLong nCur = 0; nCur < nCount; nCur++ ) + for( size_t nCur = 0; nCur < nCount; nCur++ ) { - SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( nCur ); + SvxIconChoiceCtrlEntry* pEntry = aEntries[ nCur ]; if( pEntry->IsSelected() ) { rPos = nCur; @@ -3795,14 +3795,14 @@ SvxIconChoiceCtrlEntry* SvxIconChoiceCtrl_Impl::GetFirstSelectedEntry( sal_uLong // kein Round Robin! SvxIconChoiceCtrlEntry* SvxIconChoiceCtrl_Impl::GetNextSelectedEntry( sal_uLong& rStartPos ) const { - sal_uLong nCount = aEntries.Count(); + size_t nCount = aEntries.size(); if( rStartPos > nCount || !GetSelectionCount() ) return 0; if( !pHead ) { - for( sal_uLong nCur = rStartPos+1; nCur < nCount; nCur++ ) + for( size_t nCur = rStartPos+1; nCur < nCount; nCur++ ) { - SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( nCur ); + SvxIconChoiceCtrlEntry* pEntry = aEntries[ nCur ]; if( pEntry->IsSelected() ) { rStartPos = nCur; @@ -3812,7 +3812,7 @@ SvxIconChoiceCtrlEntry* SvxIconChoiceCtrl_Impl::GetNextSelectedEntry( sal_uLong& } else { - SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( rStartPos ); + SvxIconChoiceCtrlEntry* pEntry = aEntries[ rStartPos ]; pEntry = pEntry->pflink; while( pEntry != pHead ) { @@ -3833,10 +3833,10 @@ void SvxIconChoiceCtrl_Impl::SelectAll( sal_Bool bSelect, sal_Bool bPaint ) { bPaint = sal_True; - sal_uLong nCount = aEntries.Count(); - for( sal_uLong nCur = 0; nCur < nCount && (bSelect || GetSelectionCount() ); nCur++ ) + size_t nCount = aEntries.size(); + for( size_t nCur = 0; nCur < nCount && (bSelect || GetSelectionCount() ); nCur++ ) { - SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( nCur ); + SvxIconChoiceCtrlEntry* pEntry = aEntries[ nCur ]; SelectEntry( pEntry, bSelect, sal_True, sal_True, bPaint ); } nFlags &= (~F_ADD_MODE); @@ -3993,13 +3993,13 @@ sal_uLong SvxIconChoiceCtrl_Impl::GetEntryListPos( SvxIconChoiceCtrlEntry* pEntr void SvxIconChoiceCtrl_Impl::SetEntryListPos( SvxIconChoiceCtrlEntry* pListEntry, sal_uLong nNewPos ) { - sal_uLong nCurPos = GetEntryListPos( pListEntry ); + size_t nCurPos = GetEntryListPos( pListEntry ); if( nCurPos == nNewPos ) return; - aEntries.List::Remove( nCurPos ); - aEntries.List::Insert( (void*)pListEntry, nNewPos ); + aEntries.remove( nCurPos ); + aEntries.insert( nNewPos, pListEntry ); // Eintragspositionen anpassen - sal_uLong nStart, nEnd; + size_t nStart, nEnd; if( nNewPos < nCurPos ) { nStart = nNewPos; @@ -4012,7 +4012,7 @@ void SvxIconChoiceCtrl_Impl::SetEntryListPos( SvxIconChoiceCtrlEntry* pListEntry } for( ; nStart <= nEnd; nStart++ ) { - SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( nStart ); + SvxIconChoiceCtrlEntry* pEntry = aEntries[ nStart ]; pEntry->nPos = nStart; } } @@ -4080,15 +4080,7 @@ void SvxIconChoiceCtrl_Impl::InitSettings() } } -EntryList_Impl::EntryList_Impl( SvxIconChoiceCtrl_Impl* pOwner, sal_uInt16 _nInitSize , sal_uInt16 _nReSize ) : - List( _nInitSize, _nReSize ), - _pOwner( pOwner ) -{ - _pOwner->pHead = 0; -} - -EntryList_Impl::EntryList_Impl( SvxIconChoiceCtrl_Impl* pOwner, sal_uInt16 _nBlockSize, sal_uInt16 _nInitSize, sal_uInt16 _nReSize ) : - List( _nBlockSize, _nInitSize, _nReSize ), +EntryList_Impl::EntryList_Impl( SvxIconChoiceCtrl_Impl* pOwner ) : _pOwner( pOwner ) { _pOwner->pHead = 0; @@ -4099,31 +4091,47 @@ EntryList_Impl::~EntryList_Impl() _pOwner->pHead = 0; } -void EntryList_Impl::Clear() +void EntryList_Impl::clear() { _pOwner->pHead = 0; - List::Clear(); + maIconChoiceCtrlEntryList.clear(); } -void EntryList_Impl::Insert( SvxIconChoiceCtrlEntry* pEntry, sal_uLong nPos ) +void EntryList_Impl::insert( size_t nPos, SvxIconChoiceCtrlEntry* pEntry ) { - List::Insert( pEntry, nPos ); + if ( nPos < maIconChoiceCtrlEntryList.size() ) { + maIconChoiceCtrlEntryList.insert( maIconChoiceCtrlEntryList.begin() + nPos, pEntry ); + } else { + maIconChoiceCtrlEntryList.push_back( pEntry ); + } if( _pOwner->pHead ) pEntry->SetBacklink( _pOwner->pHead->pblink ); } -SvxIconChoiceCtrlEntry* EntryList_Impl::Remove( sal_uLong nPos ) +SvxIconChoiceCtrlEntry* EntryList_Impl::remove( size_t nPos ) { - SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)List::Remove( nPos ); - DBG_ASSERT(pEntry,"EntryList_Impl::Remove > Entry not found"); - Removed_Impl( pEntry ); + SvxIconChoiceCtrlEntry* pEntry = NULL; + if ( nPos < maIconChoiceCtrlEntryList.size() ) { + pEntry = maIconChoiceCtrlEntryList[ nPos ]; + maIconChoiceCtrlEntryList.erase( maIconChoiceCtrlEntryList.begin() + nPos ); + Removed_Impl( pEntry ); + } return pEntry; } -void EntryList_Impl::Remove( SvxIconChoiceCtrlEntry* pEntry ) +void EntryList_Impl::remove( SvxIconChoiceCtrlEntry* pEntry ) { - List::Remove( (void*)pEntry ); - Removed_Impl( pEntry ); + for ( + SvxIconChoiceCtrlEntryList_impl::iterator it = maIconChoiceCtrlEntryList.begin(); + it < maIconChoiceCtrlEntryList.end(); + ++it + ) { + if ( *it == pEntry ) { + maIconChoiceCtrlEntryList.erase( it ); + Removed_Impl( pEntry ); + break; + } + } } void EntryList_Impl::Removed_Impl( SvxIconChoiceCtrlEntry* pEntry ) @@ -4136,7 +4144,7 @@ void EntryList_Impl::Removed_Impl( SvxIconChoiceCtrlEntry* pEntry ) _pOwner->pHead = pEntry->pflink; else { - DBG_ASSERT(!Count(),"EntryList_Impl::Remove > Invalid predecessor" ); + DBG_ASSERT(!size(),"EntryList_Impl::Remove > Invalid predecessor" ); _pOwner->pHead = 0; } } @@ -4146,14 +4154,14 @@ void EntryList_Impl::Removed_Impl( SvxIconChoiceCtrlEntry* pEntry ) void SvxIconChoiceCtrl_Impl::SetPositionMode( SvxIconChoiceCtrlPositionMode eMode ) { - sal_uLong nCur; + size_t nCur; if( eMode == ePositionMode ) return; SvxIconChoiceCtrlPositionMode eOldMode = ePositionMode; ePositionMode = eMode; - sal_uLong nCount = aEntries.Count(); + size_t nCount = aEntries.size(); if( eOldMode == IcnViewPositionModeAutoArrange ) { @@ -4161,7 +4169,7 @@ void SvxIconChoiceCtrl_Impl::SetPositionMode( SvxIconChoiceCtrlPositionMode eMod // mit ungewollten Ueberlappungen, da diese Eintrage im Arrange // nicht beruecksichtigt werden. #if 1 - if( aEntries.Count() ) + if( aEntries.size() ) aAutoArrangeTimer.Start(); #else if( pHead ) @@ -4188,7 +4196,7 @@ void SvxIconChoiceCtrl_Impl::SetPositionMode( SvxIconChoiceCtrlPositionMode eMod List aMovedEntries; for( nCur = 0; nCur < nCount; nCur++ ) { - SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( nCur ); + SvxIconChoiceCtrlEntry* pEntry = aEntries[ nCur ]; if( pEntry->GetFlags() & (ICNVIEW_FLAG_POS_LOCKED | ICNVIEW_FLAG_POS_MOVED)) { SvxIconChoiceCtrlEntry_Impl* pE = new SvxIconChoiceCtrlEntry_Impl( @@ -4204,7 +4212,7 @@ void SvxIconChoiceCtrl_Impl::SetPositionMode( SvxIconChoiceCtrlPositionMode eMod } for( nCur = 0; nCur < nCount; nCur++ ) delete (SvxIconChoiceCtrlEntry_Impl*)aMovedEntries.GetObject( nCur ); - if( aEntries.Count() ) + if( aEntries.size() ) aAutoArrangeTimer.Start(); } else if( ePositionMode == IcnViewPositionModeAutoAdjust ) @@ -4274,7 +4282,7 @@ sal_Bool SvxIconChoiceCtrl_Impl::GetEntryPredecessor( SvxIconChoiceCtrlEntry* pE if( pEntry == pHead ) { - SvxIconChoiceCtrlEntry* pFirst = (SvxIconChoiceCtrlEntry*)aEntries.GetObject(0); + SvxIconChoiceCtrlEntry* pFirst = aEntries[ 0 ]; if( pFirst != pEntry ) return sal_True; return sal_False; @@ -4293,13 +4301,13 @@ SvxIconChoiceCtrlEntry* SvxIconChoiceCtrl_Impl::FindEntryPredecessor( SvxIconCho Rectangle aCenterRect( CalcBmpRect( pEntry, &aPos )); Point aNewPos( aCenterRect.Center() ); sal_uLong nGrid = GetPredecessorGrid( aNewPos ); - sal_uLong nCount = aEntries.Count(); + size_t nCount = aEntries.size(); if( nGrid == ULONG_MAX ) return 0; if( nGrid >= nCount ) nGrid = nCount - 1; if( !pHead ) - return (SvxIconChoiceCtrlEntry*)aEntries.GetObject( nGrid ); + return aEntries[ nGrid ]; SvxIconChoiceCtrlEntry* pCur = pHead; // Grid 0 // todo: Liste von hinten aufrollen wenn nGrid > nCount/2 diff --git a/svtools/source/contnr/imivctl2.cxx b/svtools/source/contnr/imivctl2.cxx index 93e2990d6658..1b0575fbd9bd 100644 --- a/svtools/source/contnr/imivctl2.cxx +++ b/svtools/source/contnr/imivctl2.cxx @@ -85,10 +85,10 @@ void IcnCursor_Impl::ImplCreate() pColumns = new SvPtrarr[ nCols ]; pRows = new SvPtrarr[ nRows ]; - sal_uLong nCount = pView->aEntries.Count(); - for( sal_uLong nCur = 0; nCur < nCount; nCur++ ) + size_t nCount = pView->aEntries.size(); + for( size_t nCur = 0; nCur < nCount; nCur++ ) { - SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)pView->aEntries.GetObject( nCur ); + SvxIconChoiceCtrlEntry* pEntry = pView->aEntries[ nCur ]; // const Rectangle& rRect = pView->GetEntryBoundRect( pEntry ); Rectangle rRect( pView->CalcBmpRect( pEntry,0 ) ); short nY = (short)( ((rRect.Top()+rRect.Bottom())/2) / nDeltaHeight ); @@ -357,8 +357,8 @@ SvxIconChoiceCtrlEntry* IcnCursor_Impl::GoPageUpDown( SvxIconChoiceCtrlEntry* pS if( bDown ) { nNewPos += nEntriesInView; - if( nNewPos >= (long)pView->aEntries.Count() ) - nNewPos = pView->aEntries.Count() - 1; + if( nNewPos >= (long)pView->aEntries.size() ) + nNewPos = pView->aEntries.size() - 1; } else { @@ -367,7 +367,7 @@ SvxIconChoiceCtrlEntry* IcnCursor_Impl::GoPageUpDown( SvxIconChoiceCtrlEntry* pS nNewPos = 0; } if( nPos != nNewPos ) - return (SvxIconChoiceCtrlEntry*)pView->aEntries.GetObject( (sal_uLong)nNewPos ); + return pView->aEntries[ (size_t)nNewPos ]; return 0; } long nOpt = pView->GetEntryBoundRect( pStart ).Top(); @@ -410,10 +410,10 @@ SvxIconChoiceCtrlEntry* IcnCursor_Impl::GoUpDown( SvxIconChoiceCtrlEntry* pCtrlE if( pView->IsAutoArrange() && !(pView->nWinBits & WB_ALIGN_TOP) ) { sal_uLong nPos = pView->GetEntryListPos( pCtrlEntry ); - if( bDown && nPos < (pView->aEntries.Count() - 1) ) - return (SvxIconChoiceCtrlEntry*)pView->aEntries.GetObject( nPos + 1 ); + if( bDown && nPos < (pView->aEntries.size() - 1) ) + return pView->aEntries[ nPos + 1 ]; else if( !bDown && nPos > 0 ) - return (SvxIconChoiceCtrlEntry*)pView->aEntries.GetObject( nPos - 1 ); + return pView->aEntries[ nPos - 1 ]; return 0; } @@ -504,10 +504,10 @@ void IcnCursor_Impl::CreateGridAjustData( SvPtrarr& rLists, SvxIconChoiceCtrlEnt SvPtrarr* pRow = new SvPtrarr; rLists.Insert( (void*)pRow, nCurList ); } - const sal_uLong nCount = pView->aEntries.Count(); - for( sal_uLong nCur = 0; nCur < nCount; nCur++ ) + const size_t nCount = pView->aEntries.size(); + for( size_t nCur = 0; nCur < nCount; nCur++ ) { - SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)pView->aEntries.GetObject( nCur ); + SvxIconChoiceCtrlEntry* pEntry = pView->aEntries[ nCur ]; const Rectangle& rRect = pView->GetEntryBoundRect( pEntry ); short nY = (short)( ((rRect.Top()+rRect.Bottom())/2) / pView->nGridDY ); sal_uInt16 nIns = GetSortListPos((SvPtrarr*)rLists[nY],rRect.Left(),sal_False); @@ -523,10 +523,10 @@ void IcnCursor_Impl::CreateGridAjustData( SvPtrarr& rLists, SvxIconChoiceCtrlEnt short nRefRow = (short)( ((rRefRect.Top()+rRefRect.Bottom())/2) / pView->nGridDY ); SvPtrarr* pRow = new SvPtrarr; rLists.Insert( (void*)pRow, 0 ); - sal_uLong nCount = pView->aEntries.Count(); - for( sal_uLong nCur = 0; nCur < nCount; nCur++ ) + size_t nCount = pView->aEntries.size(); + for( size_t nCur = 0; nCur < nCount; nCur++ ) { - SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)pView->aEntries.GetObject( nCur ); + SvxIconChoiceCtrlEntry* pEntry = pView->aEntries[ nCur ]; Rectangle rRect( pView->CalcBmpRect(pEntry) ); //const Rectangle& rRect = pView->GetEntryBoundRect( pEntry ); short nY = (short)( ((rRect.Top()+rRect.Bottom())/2) / pView->nGridDY ); @@ -601,9 +601,9 @@ void IcnGridMap_Impl::Create_Impl() _pGridMap = new sal_Bool[ _nGridRows * _nGridCols]; memset( (void*)_pGridMap, 0, _nGridRows * _nGridCols ); - const sal_uLong nCount = _pView->aEntries.Count(); - for( sal_uLong nCur=0; nCur < nCount; nCur++ ) - OccupyGrids( (SvxIconChoiceCtrlEntry*)_pView->aEntries.GetObject( nCur )); + const size_t nCount = _pView->aEntries.size(); + for( size_t nCur=0; nCur < nCount; nCur++ ) + OccupyGrids( _pView->aEntries[ nCur ] ); } void IcnGridMap_Impl::GetMinMapSize( sal_uInt16& rDX, sal_uInt16& rDY ) const @@ -728,60 +728,11 @@ GridId IcnGridMap_Impl::GetUnoccupiedGrid( sal_Bool bOccupyFound ) // ein Eintrag belegt nur das unter seinem Zentrum liegende GridRect // diese Variante ist bedeutend schneller als die Belegung ueber das // Bounding-Rect, kann aber zu kleinen Ueberlappungen fuehren -#define OCCUPY_CENTER - void IcnGridMap_Impl::OccupyGrids( const SvxIconChoiceCtrlEntry* pEntry, sal_Bool bOccupy ) { if( !_pGridMap || !_pView->IsBoundingRectValid( pEntry->aRect )) return; -#ifndef OCCUPY_CENTER - OccupyGrids( pEntry->aRect, bOccupy ); -#else OccupyGrid( GetGrid( pEntry->aRect.Center()), bOccupy ); -#endif - -} - -void IcnGridMap_Impl::OccupyGrids( const Rectangle& rRect, sal_Bool bUsed ) -{ - if( !_pGridMap ) - return; - - if( bUsed ) - { - if( _aLastOccupiedGrid == rRect ) - return; - _aLastOccupiedGrid = rRect; - } - else - _aLastOccupiedGrid.SetEmpty(); - - sal_Bool bTopLeftClipped, bBottomRightClipped; - GridId nIdTL = GetGrid( rRect.TopLeft(), &bTopLeftClipped ); - GridId nIdBR = GetGrid( rRect.BottomRight(), &bBottomRightClipped ); - - if( bTopLeftClipped && bBottomRightClipped ) - return; - - sal_uInt16 nX1,nX2,nY1,nY2; - GetGridCoord( nIdTL, nX1, nY1 ); - GetGridCoord( nIdBR, nX2, nY2 ); - sal_uInt16 nTemp; - if( nX1 > nX2 ) - { - nTemp = nX1; - nX1 = nX2; - nX2 = nTemp; - } - if( nY1 > nY2 ) - { - nTemp = nY1; - nY1 = nY2; - nY2 = nTemp; - } - for( ; nX1 <= nX2; nX1++ ) - for( ; nY1 <= nY2; nY1++ ) - OccupyGrid( GetGrid( nX1, nY1 ) ); } void IcnGridMap_Impl::Clear() diff --git a/svtools/source/contnr/ivctrl.cxx b/svtools/source/contnr/ivctrl.cxx index f26de38cc1ab..7f1b374cb34a 100644 --- a/svtools/source/contnr/ivctrl.cxx +++ b/svtools/source/contnr/ivctrl.cxx @@ -360,12 +360,6 @@ SvxIconChoiceCtrlEntry* SvtIconChoiceCtrl::GetNextEntry( const Point& rPixPos, S return ((SvtIconChoiceCtrl*)this)->_pImp->GetNextEntry( aPos, pCurEntry ); } -SvxIconChoiceCtrlEntry* SvtIconChoiceCtrl::GetPrevEntry( const Point& rPixPos, SvxIconChoiceCtrlEntry* pCurEntry, sal_Bool ) const -{ - Point aPos( rPixPos ); - aPos -= GetMapMode().GetOrigin(); - return ((SvtIconChoiceCtrl*)this)->_pImp->GetPrevEntry( aPos, pCurEntry ); -} sal_uLong SvtIconChoiceCtrl::GetEntryCount() const { return _pImp->GetEntryCount(); diff --git a/svtools/source/contnr/svicnvw.cxx b/svtools/source/contnr/svicnvw.cxx deleted file mode 100644 index 41d6a100c1f3..000000000000 --- a/svtools/source/contnr/svicnvw.cxx +++ /dev/null @@ -1,813 +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_svtools.hxx" - -#include <svtools/svlbox.hxx> -#include <svtools/svicnvw.hxx> -#include <svimpicn.hxx> -#include <svtools/svlbitm.hxx> - -#define ICNVW_BLOCK_ENTRYINS 0x0001 - -SvIcnVwDataEntry::SvIcnVwDataEntry() - : nIcnVwFlags(0),eTextMode(ShowTextDontKnow) -{ -} - -SvIcnVwDataEntry::~SvIcnVwDataEntry() -{ -} - -SvIconView::SvIconView( Window* pParent, WinBits nWinStyle ) : - SvLBox( pParent, nWinStyle | WB_BORDER ) -{ - nIcnVwFlags = 0; - pImp = new SvImpIconView( this, GetModel(), nWinStyle | WB_ICON ); - pImp->mpViewData = 0; - SetSelectionMode( SINGLE_SELECTION ); - SetLineColor(); - const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - SetBackground( Wallpaper( rStyleSettings.GetFieldColor() ) ); - SetDefaultFont(); -} - -SvIconView::SvIconView( Window* pParent , const ResId& rResId ) : - SvLBox( pParent, rResId ) -{ - pImp = new SvImpIconView( this, GetModel(), WB_BORDER | WB_ICON ); - nIcnVwFlags = 0; - pImp->mpViewData = 0; - SetLineColor(); - const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - SetBackground( Wallpaper( rStyleSettings.GetFieldColor() ) ); - SetDefaultFont(); - pImp->SetSelectionMode( GetSelectionMode() ); -} - -SvIconView::~SvIconView() -{ - delete pImp; -} - -void SvIconView::SetDefaultFont() -{ - SetFont( GetFont() ); -} - -SvLBoxEntry* SvIconView::CreateEntry( const XubString& rStr, - const Image& rCollEntryBmp, const Image& rExpEntryBmp ) -{ - SvLBoxEntry* pEntry = new SvLBoxEntry; - - SvLBoxContextBmp* pContextBmp = - new SvLBoxContextBmp( pEntry,0, rCollEntryBmp,rExpEntryBmp, 0xffff ); - pEntry->AddItem( pContextBmp ); - - SvLBoxString* pString = new SvLBoxString( pEntry, 0, rStr ); - pEntry->AddItem( pString ); - - return pEntry; -} - -void SvIconView::DisconnectFromModel() -{ - SvLBox::DisconnectFromModel(); - pImp->SetModel( GetModel(), 0 ); -} - - -SvLBoxEntry* SvIconView::InsertEntry( const XubString& rText, - SvLBoxEntry* pParent, sal_Bool bChildsOnDemand, sal_uLong nPos ) -{ - SvLBoxEntry* pEntry = CreateEntry( - rText, aCollapsedEntryBmp, aExpandedEntryBmp ); - pEntry->EnableChildsOnDemand( bChildsOnDemand ); - - if ( !pParent ) - SvLBox::Insert( pEntry, nPos ); - else - SvLBox::Insert( pEntry, pParent, nPos ); - return pEntry; -} - -SvLBoxEntry* SvIconView::InsertEntry( const XubString& rText, - const Image& rExpEntryBmp, - const Image& rCollEntryBmp, - SvLBoxEntry* pParent, sal_Bool bChildsOnDemand, sal_uLong nPos) -{ - SvLBoxEntry* pEntry = CreateEntry( - rText, rCollEntryBmp, rExpEntryBmp ); - - pEntry->EnableChildsOnDemand( bChildsOnDemand ); - if ( !pParent ) - SvLBox::Insert( pEntry, nPos ); - else - SvLBox::Insert( pEntry, pParent, nPos ); - return pEntry; -} - - -void SvIconView::SetEntryText(SvLBoxEntry* pEntry, const XubString& rStr) -{ - SvLBoxString* pItem = (SvLBoxString*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXSTRING)); - if ( pItem ) - { - pItem->SetText( pEntry, rStr ); - GetModel()->InvalidateEntry( pEntry ); - } -} - -void SvIconView::SetExpandedEntryBmp(SvLBoxEntry* pEntry, const Image& rBmp) -{ - SvLBoxContextBmp* pItem = (SvLBoxContextBmp*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP)); - if ( pItem ) - { - pItem->SetBitmap2( rBmp ); - GetModel()->InvalidateEntry( pEntry ); - } -} - -void SvIconView::SetCollapsedEntryBmp(SvLBoxEntry* pEntry, - const Image& rBmp ) -{ - SvLBoxContextBmp* pItem = (SvLBoxContextBmp*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP)); - if ( pItem ) - { - pItem->SetBitmap1( rBmp ); - GetModel()->InvalidateEntry( pEntry ); - } -} - -XubString SvIconView::GetEntryText(SvLBoxEntry* pEntry ) const -{ - XubString aStr; - SvLBoxString* pItem = (SvLBoxString*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXSTRING)); - if ( pItem ) - aStr = pItem->GetText(); - return aStr; -} - -Image SvIconView::GetExpandedEntryBmp(SvLBoxEntry* pEntry) const -{ - Image aBmp; - SvLBoxContextBmp* pItem = (SvLBoxContextBmp*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP)); - if ( pItem ) - aBmp = pItem->GetBitmap2(); - return aBmp; -} - -Image SvIconView::GetCollapsedEntryBmp(SvLBoxEntry* pEntry) const -{ - Image aBmp; - SvLBoxContextBmp* pItem = (SvLBoxContextBmp*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP)); - if ( pItem ) - aBmp = pItem->GetBitmap1(); - return aBmp; -} - - -SvLBoxEntry* SvIconView::CloneEntry( SvLBoxEntry* pSource ) -{ - XubString aStr; - Image aCollEntryBmp; - Image aExpEntryBmp; - - SvLBoxString* pStringItem = (SvLBoxString*)(pSource->GetFirstItem(SV_ITEM_ID_LBOXSTRING)); - if ( pStringItem ) - aStr = pStringItem->GetText(); - SvLBoxContextBmp* pBmpItem =(SvLBoxContextBmp*)(pSource->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP)); - if ( pBmpItem ) - { - aCollEntryBmp = pBmpItem->GetBitmap1(); - aExpEntryBmp = pBmpItem->GetBitmap2(); - } - SvLBoxEntry* pEntry = CreateEntry( aStr, aCollEntryBmp, aExpEntryBmp ); - pEntry->SvListEntry::Clone( pSource ); - pEntry->EnableChildsOnDemand( pSource->HasChildsOnDemand() ); - pEntry->SetUserData( pSource->GetUserData() ); - return pEntry; -} - - -sal_uInt16 SvIconView::IsA() -{ - return SV_LISTBOX_ID_ICONVIEW; -} - -void SvIconView::RequestingChilds( SvLBoxEntry* pParent ) -{ - if ( !pParent->HasChilds() ) - InsertEntry( String::CreateFromAscii("<dummy>"), pParent, sal_False, LIST_APPEND ); -} - -void SvIconView::Paint( const Rectangle& rRect ) -{ - pImp->Paint( rRect ); -} - -void SvIconView::MouseButtonDown( const MouseEvent& rMEvt ) -{ - pImp->MouseButtonDown( rMEvt ); -} - -void SvIconView::MouseButtonUp( const MouseEvent& rMEvt ) -{ - pImp->MouseButtonUp( rMEvt ); -} - -void SvIconView::MouseMove( const MouseEvent& rMEvt ) -{ - pImp->MouseMove( rMEvt ); -} - -void SvIconView::KeyInput( const KeyEvent& rKEvt ) -{ - // unter OS/2 bekommen wir auch beim Editieren Key-Up/Down - if( IsEditingActive() ) - return; - - nImpFlags |= SVLBOX_IS_TRAVELSELECT; - sal_Bool bKeyUsed = pImp->KeyInput( rKEvt ); - if ( !bKeyUsed ) - SvLBox::KeyInput( rKEvt ); - nImpFlags &= ~SVLBOX_IS_TRAVELSELECT; -} - -void SvIconView::Resize() -{ - pImp->Resize(); - SvLBox::Resize(); -} - -void SvIconView::GetFocus() -{ - pImp->GetFocus(); - SvLBox::GetFocus(); -} - -void SvIconView::LoseFocus() -{ - pImp->LoseFocus(); - SvLBox::LoseFocus(); -} - -void SvIconView::SetUpdateMode( sal_Bool bUpdate ) -{ - Control::SetUpdateMode( bUpdate ); - if ( bUpdate ) - pImp->UpdateAll(); -} - -void SvIconView::SetModel( SvLBoxTreeList* ) -{ -} - -void SvIconView::SetModel( SvLBoxTreeList* pNewModel, SvLBoxEntry* pParent ) -{ - nIcnVwFlags |= ICNVW_BLOCK_ENTRYINS; - SvLBox::SetModel( pNewModel ); - nIcnVwFlags &= (~ICNVW_BLOCK_ENTRYINS); - if ( pParent && pParent->HasChildsOnDemand() ) - RequestingChilds( pParent ); - pImp->SetModel( pNewModel, pParent ); -} - -void SvIconView::ModelHasCleared() -{ - SvLBox::ModelHasCleared(); - pImp->Clear(); -} - -void SvIconView::ModelHasInserted( SvListEntry* pEntry ) -{ - if( !(nIcnVwFlags & ICNVW_BLOCK_ENTRYINS ) ) - pImp->EntryInserted( (SvLBoxEntry*)pEntry ); -} - -void SvIconView::ModelHasInsertedTree( SvListEntry* pEntry ) -{ - pImp->TreeInserted( (SvLBoxEntry*)pEntry ); -} - -void SvIconView::ModelIsMoving(SvListEntry* pSource, - SvListEntry* /* pTargetParent */ , sal_uLong /* nChildPos */ ) -{ - pImp->MovingEntry( (SvLBoxEntry*)pSource ); -} - -void SvIconView::ModelHasMoved(SvListEntry* pSource ) -{ - pImp->EntryMoved( (SvLBoxEntry*)pSource ); -} - -void SvIconView::ModelIsRemoving( SvListEntry* pEntry ) -{ - pImp->RemovingEntry( (SvLBoxEntry*)pEntry ); - NotifyRemoving( (SvLBoxEntry*)pEntry ); -} - -void SvIconView::ModelHasRemoved( SvListEntry* /* pEntry */ ) -{ - pImp->EntryRemoved(); -} - -void SvIconView::ModelHasEntryInvalidated( SvListEntry* pEntry ) -{ - // die einzelnen Items des Entries reinitialisieren - SvLBox::ModelHasEntryInvalidated( pEntry ); - // painten - pImp->ModelHasEntryInvalidated( pEntry ); -} - -void SvIconView::ShowTargetEmphasis( SvLBoxEntry* pEntry, sal_Bool bShow ) -{ - pImp->ShowTargetEmphasis( pEntry, bShow ); -} - -Point SvIconView::GetEntryPosition( SvLBoxEntry* pEntry ) const -{ - return ((SvIconView*)this)->pImp->GetEntryPosition( pEntry ); -} - -void SvIconView::SetEntryPosition( SvLBoxEntry* pEntry, const Point& rPos) -{ - pImp->SetEntryPosition( pEntry, rPos, sal_False, sal_True ); -} - -void SvIconView::SetEntryPosition( SvLBoxEntry* pEntry, const Point& rPos, sal_Bool bAdjustAtGrid ) -{ - pImp->SetEntryPosition( pEntry, rPos, bAdjustAtGrid ); -} - -void SvIconView::SetFont( const Font& rFont ) -{ - Font aTempFont( rFont ); - aTempFont.SetTransparent( sal_True ); - SvLBox::SetFont( aTempFont ); - RecalcViewData(); - pImp->ChangedFont(); -} - -void SvIconView::ViewDataInitialized( SvLBoxEntry* pEntry ) -{ - pImp->ViewDataInitialized( pEntry ); -} - -SvLBoxEntry* SvIconView::GetDropTarget( const Point& rPos ) -{ - return pImp->GetDropTarget( rPos ); -} - -SvLBoxEntry* SvIconView::GetEntry( const Point& rPixPos, sal_Bool ) const -{ - Point aPos( rPixPos ); - aPos -= GetMapMode().GetOrigin(); - return ((SvIconView*)this)->pImp->GetEntry( aPos ); -} - -SvLBoxEntry* SvIconView::GetEntryFromLogicPos( const Point& rDocPos ) const -{ - return ((SvIconView*)this)->pImp->GetEntry( rDocPos ); -} - - -void SvIconView::StateChanged( StateChangedType i_nStateChange ) -{ - SvLBox::StateChanged( i_nStateChange ); - if ( i_nStateChange == STATE_CHANGE_STYLE ) - pImp->SetStyle( GetStyle() ); -} - -void SvIconView::PaintEntry( SvLBoxEntry* pEntry ) -{ - pImp->PaintEntry( pEntry ); -} - - -void SvIconView::PaintEntry( SvLBoxEntry* pEntry, const Point& rPos ) -{ - pImp->PaintEntry( pEntry, rPos ); -} - -Rectangle SvIconView::GetFocusRect( SvLBoxEntry* pEntry ) -{ - return pImp->CalcFocusRect( pEntry ); -} - -void SvIconView::InvalidateEntry( SvLBoxEntry* pEntry ) -{ - pImp->InvalidateEntry( pEntry ); -} - -void SvIconView::SetDragDropMode( DragDropMode nDDMode ) -{ - SvLBox::SetDragDropMode( nDDMode ); - pImp->SetDragDropMode( nDDMode ); -} - -void SvIconView::SetSelectionMode( SelectionMode eSelectMode ) -{ - SvLBox::SetSelectionMode( eSelectMode ); - pImp->SetSelectionMode( eSelectMode ); -} - -sal_Bool SvIconView::Select( SvLBoxEntry* pEntry, sal_Bool bSelect ) -{ - EndEditing(); - sal_Bool bRetVal = SvListView::Select( pEntry, bSelect ); - if( bRetVal ) - { - pImp->EntrySelected( pEntry, bSelect ); - pHdlEntry = pEntry; - SelectHdl(); - } - return bRetVal; -} - -void SvIconView::SelectAll( sal_Bool bSelect, sal_Bool ) -{ - SvLBoxEntry* pEntry = pImp->GetCurParent(); - pEntry = FirstChild( pEntry ); - while( pEntry ) - { - Select( pEntry, bSelect ); - pEntry = NextSibling( pEntry ); - } -} - -void SvIconView::SetCurEntry( SvLBoxEntry* _pEntry ) -{ - pImp->SetCursor( _pEntry ); - OnCurrentEntryChanged(); -} - -SvLBoxEntry* SvIconView::GetCurEntry() const -{ - return pImp->GetCurEntry(); -} - -void SvIconView::Arrange() -{ -#ifdef DBG_UTIL - sal_uInt16 n=1; - if( n == 1 && n-1 == 0 ) - { - pImp->Arrange(); - } - else - { - pImp->AdjustAtGrid(); - } -#else - pImp->Arrange(); -#endif -} - - -void SvIconView::SetSpaceBetweenEntries( long nX, long nY ) -{ - pImp->SetSpaceBetweenEntries( nX, nY ); -} - -sal_Bool SvIconView::NotifyMoving( SvLBoxEntry* pTarget, SvLBoxEntry* pEntry, - SvLBoxEntry*& rpNewParent, sal_uLong& rNewChildPos ) -{ - return pImp->NotifyMoving(pTarget,pEntry,rpNewParent,rNewChildPos); -} - -sal_Bool SvIconView::NotifyCopying( SvLBoxEntry* pTarget, SvLBoxEntry* pEntry, - SvLBoxEntry*& rpNewParent, sal_uLong& rNewChildPos ) -{ - return pImp->NotifyCopying(pTarget,pEntry,rpNewParent,rNewChildPos); -} - - -void SvIconView::EnableInplaceEditing( sal_Bool bEnable ) -{ - SvLBox::EnableInplaceEditing( bEnable ); -} - -void SvIconView::EditingRequest( SvLBoxEntry* pEntry, SvLBoxItem* pItem, - const Point& ) -{ - if ( pItem->IsA() == SV_ITEM_ID_LBOXSTRING ) - { - Selection aSel( SELECTION_MIN, SELECTION_MAX ); - if ( EditingEntry( pEntry, aSel ) ) - { - SelectAll( sal_False ); - EditItemText( pEntry, (SvLBoxString*)pItem, aSel ); - } - } -} - - -void SvIconView::EditItemText( SvLBoxEntry* pEntry, SvLBoxItem* pItem, - const Selection& rSel ) -{ - DBG_ASSERT(pEntry&&pItem,"EditItemText:Params?"); - pCurEdEntry = pEntry; - pCurEdItem = pItem; - Rectangle aRect( pImp->CalcTextRect( pEntry, (SvLBoxString*)pItem,0,sal_True )); - - aRect.Bottom() += 4; - pImp->MakeVisible( aRect ); // vor der Umrechnung in Pixel-Koord. rufen! - aRect.Bottom() -= 4; - - Point aPos( aRect.TopLeft() ); - aPos += GetMapMode().GetOrigin(); // Dok-Koord. -> Window-Koord. - aRect.SetPos( aPos ); - - aRect.Bottom() += 2; // sieht huebscher aus - - EditText( ((SvLBoxString*)pItem)->GetText(), aRect, rSel, sal_True ); -} - -void SvIconView::EditEntry( SvLBoxEntry* pEntry ) -{ - if( !pEntry ) - pEntry = pImp->GetCurEntry(); - if( pEntry ) - { - SvLBoxString* pItem = (SvLBoxString*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXSTRING)); - if( pItem ) - { - Selection aSel( SELECTION_MIN, SELECTION_MAX ); - if( EditingEntry( pEntry, aSel ) ) - { - SelectAll( sal_False ); - EditItemText( pEntry, pItem, aSel ); - } - } - } -} - -void SvIconView::EditedText( const XubString& rStr ) -{ - XubString aRefStr( ((SvLBoxString*)pCurEdItem)->GetText() ); - if ( EditedEntry( pCurEdEntry, rStr ) ) - { - ((SvLBoxString*)pCurEdItem)->SetText( pCurEdEntry, rStr ); - pModel->InvalidateEntry( pCurEdEntry ); - } - if( GetSelectionMode()==SINGLE_SELECTION && !GetSelectionCount()) - Select( pCurEdEntry ); -} - - -sal_Bool SvIconView::EditingEntry( SvLBoxEntry*, Selection& ) -{ - return sal_True; -} - -sal_Bool SvIconView::EditedEntry( SvLBoxEntry*, const XubString& ) -{ - return sal_True; -} - - -void SvIconView::WriteDragServerInfo( const Point& rPos, SvLBoxDDInfo* pInfo) -{ - pImp->WriteDragServerInfo( rPos, pInfo ); -} - -void SvIconView::ReadDragServerInfo( const Point& rPos, SvLBoxDDInfo* pInfo ) -{ - pImp->ReadDragServerInfo( rPos, pInfo ); -} - -void SvIconView::Command( const CommandEvent& rCEvt ) -{ - pImp->PrepareCommandEvent( rCEvt.GetMousePosPixel() ); -} - -void SvIconView::SetCurParent( SvLBoxEntry* pNewParent ) -{ - if ( pNewParent && pNewParent->HasChildsOnDemand() ) - RequestingChilds( pNewParent ); - pImp->SetCurParent( pNewParent ); -} - -SvLBoxEntry* SvIconView::GetCurParent() const -{ - return pImp->GetCurParent(); -} - -SvViewData* SvIconView::CreateViewData( SvListEntry* ) -{ - SvIcnVwDataEntry* pEntryData = new SvIcnVwDataEntry; - return (SvViewData*)pEntryData; -} - -void SvIconView::InitViewData( SvViewData* pData, SvListEntry* pEntry ) -{ - SvLBox::InitViewData( pData, pEntry ); - pImp->InvalidateBoundingRect( ((SvIcnVwDataEntry*)pData)->aRect ); -} - -Region SvIconView::GetDragRegion() const -{ - Rectangle aRect; - SvLBoxEntry* pEntry = GetCurEntry(); - if( pEntry ) - aRect = pImp->GetBoundingRect( pEntry ); - Region aRegion( aRect ); - return aRegion; -} - -sal_uLong SvIconView::GetSelectionCount() const -{ - return (sal_uLong)(pImp->GetSelectionCount()); -} - -void SvIconView::SetGrid( long nDX, long nDY ) -{ - pImp->SetGrid( nDX, nDY ); -} - -void SvIconView::ModelNotification( sal_uInt16 nActionId, SvListEntry* pEntry1, - SvListEntry* pEntry2, sal_uLong nPos ) -{ - SvLBox::ModelNotification( nActionId, pEntry1, pEntry2, nPos ); - switch( nActionId ) - { - case LISTACTION_RESORTING: - SetUpdateMode( sal_False ); - break; - - case LISTACTION_RESORTED: - SetUpdateMode( sal_True ); - Arrange(); - break; - - case LISTACTION_CLEARED: - if( IsUpdateMode() ) - Update(); - break; - } -} - - -void SvIconView::Scroll( long nDeltaX, long nDeltaY, sal_uInt16 ) -{ - pImp->Scroll( nDeltaX, nDeltaY, sal_False ); -} - -void SvIconView::PrepareCommandEvent( const CommandEvent& rCEvt ) -{ - pImp->PrepareCommandEvent( rCEvt.GetMousePosPixel() ); -} - -void SvIconView::StartDrag( sal_Int8 nAction, const Point& rPos ) -{ - pImp->SttDrag( rPos ); - SvLBoxEntry* pEntry = GetEntry( rPos, sal_True ); - pImp->mpViewData = pEntry; - SvLBox::StartDrag( nAction, rPos ); -} - -void SvIconView::DragFinished( sal_Int8 ) -{ - pImp->EndDrag(); -} - -sal_Int8 SvIconView::AcceptDrop( const AcceptDropEvent& rEvt ) -{ - if( pImp->mpViewData ) - pImp->HideDDIcon(); - sal_Int8 nRet = SvLBox::AcceptDrop( rEvt ); - if( DND_ACTION_NONE != nRet ) - pImp->ShowDDIcon( pImp->mpViewData, rEvt.maPosPixel ); - - return nRet; -} - -sal_Int8 SvIconView::ExecuteDrop( const ExecuteDropEvent& rEvt ) -{ - if( pImp->mpViewData ) - { - pImp->HideDDIcon(); - pImp->mpViewData = 0; - } - return SvLBox::ExecuteDrop( rEvt ); -} - -void SvIconView::ShowDDIcon( SvLBoxEntry* pRefEntry, const Point& rPos ) -{ - pImp->ShowDDIcon( pRefEntry, rPos ); -} - -void SvIconView::HideDDIcon() -{ - pImp->HideDDIcon(); -} - -void SvIconView::HideShowDDIcon( SvLBoxEntry* pRefEntry, const Point& rPos ) -{ - pImp->HideShowDDIcon( pRefEntry, rPos ); -} - -void SvIconView::SelectRect( const Rectangle& rRect, sal_Bool bAdd, - SvPtrarr* pRects, short nOffs ) -{ - pImp->SelectRect( rRect, bAdd, pRects, nOffs ); -} - -void SvIconView::CalcScrollOffsets( const Point& rRefPosPixel, long& rX, long& rY, - sal_Bool b, sal_uInt16 nBorderWidth ) -{ - pImp->CalcScrollOffsets( rRefPosPixel, rX, rY, b, nBorderWidth ); -} - -void SvIconView::EndTracking() -{ - pImp->EndTracking(); -} - -void SvIconView::MakeVisible( SvLBoxEntry* pEntry ) -{ - pImp->MakeVisible( pEntry ); -} - -void SvIconView::PreparePaint( SvLBoxEntry* ) -{ -} - -void SvIconView::AdjustAtGrid( SvLBoxEntry* pEntry ) -{ - pImp->AdjustAtGrid( pEntry ); -} - -void SvIconView::LockEntryPos( SvLBoxEntry* pEntry, sal_Bool bLock ) -{ - SvIcnVwDataEntry* pViewData = (SvIcnVwDataEntry*)GetViewData( pEntry ); - if( bLock ) - pViewData->SetVwFlags( ICNVW_FLAG_POS_LOCKED ); - else - pViewData->ClearVwFlags( ICNVW_FLAG_POS_LOCKED ); -} - -sal_Bool SvIconView::IsEntryPosLocked( const SvLBoxEntry* pEntry ) const -{ - const SvIcnVwDataEntry* pViewData = (const SvIcnVwDataEntry*)GetViewData( (SvListEntry*)pEntry ); - return pViewData->IsEntryPosLocked(); -} - -void SvIconView::SetTextMode( SvIconViewTextMode eMode, SvLBoxEntry* pEntry ) -{ - pImp->SetTextMode( eMode, pEntry ); -} - -SvIconViewTextMode SvIconView::GetTextMode( const SvLBoxEntry* pEntry ) const -{ - return pImp->GetTextMode( pEntry ); -} - -SvLBoxEntry* SvIconView::GetNextEntry( const Point& rPixPos, SvLBoxEntry* pCurEntry, sal_Bool ) const -{ - Point aPos( rPixPos ); - aPos -= GetMapMode().GetOrigin(); - return ((SvIconView*)this)->pImp->GetNextEntry( aPos, pCurEntry ); -} - -SvLBoxEntry* SvIconView::GetPrevEntry( const Point& rPixPos, SvLBoxEntry* pCurEntry, sal_Bool ) const -{ - Point aPos( rPixPos ); - aPos -= GetMapMode().GetOrigin(); - return ((SvIconView*)this)->pImp->GetPrevEntry( aPos, pCurEntry ); -} - -void SvIconView::ShowFocusRect( const SvLBoxEntry* pEntry ) -{ - pImp->ShowFocusRect( pEntry ); -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/contnr/svimpbox.cxx b/svtools/source/contnr/svimpbox.cxx index da5aff817b60..e0e9efca6f59 100644 --- a/svtools/source/contnr/svimpbox.cxx +++ b/svtools/source/contnr/svimpbox.cxx @@ -1012,6 +1012,34 @@ void SvImpLBox::MakeVisible( SvLBoxEntry* pEntry, sal_Bool bMoveToTop ) pView->Invalidate(); } +void SvImpLBox::ScrollToAbsPos( long nPos ) +{ + if( pView->GetVisibleCount() == 0 ) + return; + long nLastEntryPos = pView->GetAbsPos( pView->Last() ); + + if( nPos < 0 ) + nPos = 0; + else if( nPos > nLastEntryPos ) + nPos = nLastEntryPos; + + SvLBoxEntry* pEntry = (SvLBoxEntry*)pView->GetEntryAtAbsPos( nPos ); + if( !pEntry || pEntry == pStartEntry ) + return; + + if( pStartEntry || (m_nStyle & WB_FORCE_MAKEVISIBLE) ) + nFlags &= (~F_FILLING); + + if( pView->IsEntryVisible(pEntry) ) + { + pStartEntry = pEntry; + ShowCursor( sal_False ); + aVerSBar.SetThumbPos( nPos ); + ShowCursor( sal_True ); + if (GetUpdateMode()) + pView->Invalidate(); + } +} void SvImpLBox::RepaintSelectionItems() { @@ -1358,8 +1386,19 @@ void SvImpLBox::InitScrollBarBox() void SvImpLBox::Resize() { Size aSize( pView->Control::GetOutputSizePixel()); + long nEntryHeight = pView->GetEntryHeight(); + int nEntryCount = 0; + if( aSize.Width() <= 0 || aSize.Height() <= 0 ) return; + if( nEntryHeight ) + { + // Set the view height to an integer multiple of the entry height. + nEntryCount = (int) aSize.Height() / nEntryHeight; + aSize.Height() = pView->GetEntryHeight() * nEntryCount; + pView->Control::SetOutputSizePixel( aSize ); + } + nFlags |= F_IN_RESIZE; InitScrollBarBox(); diff --git a/svtools/source/contnr/svimpicn.cxx b/svtools/source/contnr/svimpicn.cxx deleted file mode 100644 index 3514c7b6a271..000000000000 --- a/svtools/source/contnr/svimpicn.cxx +++ /dev/null @@ -1,4093 +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_svtools.hxx" - -#include <limits.h> -#include <vcl/metric.hxx> -#include <vcl/svapp.hxx> -#ifdef DBG_UTIL -#include <vcl/sound.hxx> -#endif - -#include <svtools/svlbox.hxx> -#include <svtools/svicnvw.hxx> -#include <svimpicn.hxx> -#include <svtools/svlbitm.hxx> -#include <svl/svarray.hxx> - - - -#define VIEWMODE_ICON 0x0001 // Text unter Bitmap -#define VIEWMODE_NAME 0x0002 // Text rechts neben Bitmap -#define VIEWMODE_TEXT 0x0004 // Text ohne Bitmap - -#define DD_SCROLL_PIXEL 10 - -// alle Angaben in Pixel - -#define ICONVIEW_OFFS_BMP_STRING 3 - -// fuer das Bounding-Rectangle -#define LROFFS_BOUND 2 -#define TBOFFS_BOUND 2 - -// fuer das Focus-Rectangle um Icons -#define LROFFS_ICON 2 -#define TBOFFS_ICON 2 - -#define NAMEVIEW_OFFS_BMP_STRING 3 - -// Abstaende von Fensterraendern -#define LROFFS_WINBORDER 4 -#define TBOFFS_WINBORDER 4 - -// Breitenoffset Highlight-Rect bei Text -#define LROFFS_TEXT 2 - - -#define ICNVIEWDATA(xPtr) (SvIcnVwDataEntry*)(pView->GetViewDataEntry(xPtr)) -#define ICNVIEWDATA2(xPtr) (SvIcnVwDataEntry*)(pView->pView->GetViewDataEntry(xPtr)) - -//-------------------------------------------------------------------------- -//-------------------------------------------------------------------------- -//-------------------------------------------------------------------------- -// ------------------------------------------------------------------------- -// Hilfsfunktionen von Thomas Hosemann zur mehrzeiligen Ausgabe von -// Strings. Die Funktionen werden spaeter in StarView integriert. -// ------------------------------------------------------------------------- -//-------------------------------------------------------------------------- -//-------------------------------------------------------------------------- -//-------------------------------------------------------------------------- - -// keine doppelten Defines -#ifdef TEXT_DRAW_CLIP -#undef TEXT_DRAW_CLIP -#endif -#ifdef TEXT_DRAW_MULTILINE -#undef TEXT_DRAW_MULTILINE -#endif -#ifdef TEXT_DRAW_WORDBREAK -#undef TEXT_DRAW_WORDBREAK -#endif - -// #define TEXT_DRAW_DISABLE ((sal_uInt16)0x0001) -// #define TEXT_DRAW_3DLOOK ((sal_uInt16)0x0002) -// #define TEXT_DRAW_MNEMONIC ((sal_uInt16)0x0004) -#define TEXT_DRAW_LEFT ((sal_uInt16)0x0010) -#define TEXT_DRAW_CENTER ((sal_uInt16)0x0020) -#define TEXT_DRAW_RIGHT ((sal_uInt16)0x0040) -#define TEXT_DRAW_TOP ((sal_uInt16)0x0080) -#define TEXT_DRAW_VCENTER ((sal_uInt16)0x0100) -#define TEXT_DRAW_BOTTOM ((sal_uInt16)0x0200) -#define TEXT_DRAW_ENDELLIPSIS ((sal_uInt16)0x0400) -#define TEXT_DRAW_PATHELLIPSIS ((sal_uInt16)0x0800) -#define TEXT_DRAW_CLIP ((sal_uInt16)0x1000) -#define TEXT_DRAW_MULTILINE ((sal_uInt16)0x2000) -#define TEXT_DRAW_WORDBREAK ((sal_uInt16)0x4000) - -XubString GetEllipsisString( OutputDevice* pDev, - const XubString& rStr, long nMaxWidth, - sal_uInt16 nStyle = TEXT_DRAW_ENDELLIPSIS ) -{ - XubString aStr = rStr; - - if ( nStyle & TEXT_DRAW_ENDELLIPSIS ) - { - sal_uInt16 nIndex = pDev->GetTextBreak( rStr, nMaxWidth ); - if ( nIndex != STRING_LEN ) - { - aStr.Erase( nIndex ); - if ( nIndex > 1 ) - { - aStr.AppendAscii("..."); - while ( aStr.Len() && - (pDev->GetTextWidth( aStr ) > nMaxWidth) ) - { - if ( (nIndex > 1) || (nIndex == aStr.Len()) ) - nIndex--; - aStr.Erase( nIndex, 1 ); - } - } - - if ( !aStr.Len() && (nStyle & TEXT_DRAW_CLIP) ) - aStr += rStr.GetChar( 0 ); - } - } - - return aStr; -} - -class TextLineInfo -{ -private: - long mnWidth; - sal_uInt16 mnIndex; - sal_uInt16 mnLen; - -public: - TextLineInfo( long nWidth, sal_uInt16 nIndex, sal_uInt16 nLen ) - { - mnWidth = nWidth; - mnIndex = nIndex; - mnLen = nLen; - } - - long GetWidth() const { return mnWidth; } - sal_uInt16 GetIndex() const { return mnIndex; } - sal_uInt16 GetLen() const { return mnLen; } -}; - -#define MULTITEXTLINEINFO_RESIZE 16 -typedef TextLineInfo* PTextLineInfo; - -class MultiTextLineInfo -{ -private: - PTextLineInfo* mpLines; - sal_uInt16 mnLines; - sal_uInt16 mnSize; - -public: - MultiTextLineInfo(); - ~MultiTextLineInfo(); - - void AddLine( TextLineInfo* pLine ); - void Clear(); - - TextLineInfo* GetLine( sal_uInt16 nLine ) const - { return mpLines[nLine]; } - sal_uInt16 Count() const { return mnLines; } - -private: - MultiTextLineInfo( const MultiTextLineInfo& ); - MultiTextLineInfo& operator=( const MultiTextLineInfo& ); -}; - -MultiTextLineInfo::MultiTextLineInfo() -{ - mpLines = new PTextLineInfo[MULTITEXTLINEINFO_RESIZE]; - mnLines = 0; - mnSize = MULTITEXTLINEINFO_RESIZE; -} - -MultiTextLineInfo::~MultiTextLineInfo() -{ - for ( sal_uInt16 i = 0; i < mnLines; i++ ) - delete mpLines[i]; - delete [] mpLines; -} - -void MultiTextLineInfo::AddLine( TextLineInfo* pLine ) -{ - if ( mnSize == mnLines ) - { - mnSize += MULTITEXTLINEINFO_RESIZE; - PTextLineInfo* pNewLines = new PTextLineInfo[mnSize]; - memcpy( pNewLines, mpLines, mnLines*sizeof(PTextLineInfo) ); - mpLines = pNewLines; - } - - mpLines[mnLines] = pLine; - mnLines++; -} - -void MultiTextLineInfo::Clear() -{ - for ( sal_uInt16 i = 0; i < mnLines; i++ ) - delete mpLines[i]; - mnLines = 0; -} - -// ----------------------------------------------------------------------- - -long GetTextLines( OutputDevice* pDev, MultiTextLineInfo& rLineInfo, - long nWidth, const XubString& rStr, - sal_uInt16 nStyle = TEXT_DRAW_WORDBREAK ) -{ - rLineInfo.Clear(); - if ( !rStr.Len() ) - return 0; - if ( nWidth <= 0 ) - nWidth = 1; - - sal_uInt16 nStartPos = 0; // Start-Position der Zeile - sal_uInt16 nLastLineLen = 0; // Zeilenlaenge bis zum vorherigen Wort - sal_uInt16 nLastWordPos = 0; // Position des letzten Wortanfangs - sal_uInt16 i = 0; - sal_uInt16 nPos; // StartPositon der Zeile (nur Temp) - sal_uInt16 nLen; // Laenge der Zeile (nur Temp) - sal_uInt16 nStrLen = rStr.Len(); - long nMaxLineWidth = 0; // Maximale Zeilenlaenge - long nLineWidth; // Aktuelle Zeilenlaenge - long nLastLineWidth = 0; // Zeilenlaenge der letzten Zeile - xub_Unicode c; - xub_Unicode c2; - const xub_Unicode* pStr = rStr.GetBuffer(); - sal_Bool bHardBreak = sal_False; - - do - { - c = pStr[i]; - - // Auf Zeilenende ermitteln - if ( (c == _CR) || (c == _LF) ) - bHardBreak = sal_True; - else - bHardBreak = sal_False; - - // Testen, ob ein Wortende erreicht ist - if ( bHardBreak || (i == nStrLen) || - (((c == ' ') || (c == '-')) && (nStyle & TEXT_DRAW_WORDBREAK)) ) - { - nLen = i-nStartPos; - if ( c == '-' ) - nLen++; - nLineWidth = pDev->GetTextWidth( rStr, nStartPos, nLen ); - - // Findet ein Zeilenumbruch statt - if ( bHardBreak || (i == nStrLen) || - ((nLineWidth >= nWidth) && (nStyle & TEXT_DRAW_WORDBREAK)) ) - { - nPos = nStartPos; - - if ( (nLineWidth >= nWidth) && (nStyle & TEXT_DRAW_WORDBREAK) ) - { - nLineWidth = nLastLineWidth; - nLen = nLastLineLen; - nStartPos = nLastWordPos; - nLastLineLen = i-nStartPos; - nLastWordPos = nStartPos+nLastLineLen+1; - if ( c == '-' ) - nLastLineLen++; - else if ( bHardBreak && (i > nStartPos) ) - i--; - } - else - { - nStartPos = i; - // Zeilenende-Zeichen und '-' beruecksichtigen - if ( bHardBreak ) - { - nStartPos++; - c2 = pStr[i+1]; - if ( (c != c2) && ((c2 == _CR) || (c2 == _LF)) ) - { - nStartPos++; - i++; - } - } - else if ( c != '-' ) - nStartPos++; - nLastWordPos = nStartPos; - nLastLineLen = 0; - } - - if ( nLineWidth > nMaxLineWidth ) - nMaxLineWidth = nLineWidth; - - if ( nLen || bHardBreak ) - rLineInfo.AddLine( new TextLineInfo( nLineWidth, nPos, nLen ) ); - - // Testen, ob aktuelles Wort noch auf die Zeile passt, - // denn ansonsten mueessen wir es auftrennen - if ( nLastLineLen ) - { - nLineWidth = pDev->GetTextWidth( rStr, nStartPos, nLastLineLen ); - if ( nLineWidth > nWidth ) - { - // Wenn ein Wortumbruch in einem Wort stattfindet, - // ist die maximale Zeilenlaenge die Laenge - // des laengsten Wortes - if ( nLineWidth > nMaxLineWidth ) - nMaxLineWidth = nLineWidth; - - // Solange Wort auftrennen, bis es auf eine Zeile passt - do - { - nPos = pDev->GetTextBreak( rStr, nWidth, nStartPos, nLastLineLen ); - nLen = nPos-nStartPos; - if ( !nLen ) - { - nPos++; - nLen++; - } - nLineWidth = pDev->GetTextWidth( rStr, nStartPos, nLen ); - rLineInfo.AddLine( new TextLineInfo( nLineWidth, nStartPos, nLen ) ); - nStartPos = nPos; - nLastLineLen = nLastLineLen - nLen; - nLineWidth = pDev->GetTextWidth( rStr, nStartPos, nLastLineLen ); - } - while ( nLineWidth > nWidth ); - } - nLastLineWidth = nLineWidth; - - // Bei Stringende muessen wir die letzte Zeile auch noch - // dranhaengen - if ( (i == nStrLen) && nLastLineLen ) - rLineInfo.AddLine( new TextLineInfo( nLastLineWidth, nStartPos, nLastLineLen ) ); - } - else - nLastLineWidth = 0; - } - else - { - nLastLineWidth = nLineWidth; - nLastLineLen = nLen; - nLastWordPos = nStartPos+nLastLineLen; - if ( c != '-' ) - nLastWordPos++; - } - } - - i++; - } - while ( i <= nStrLen ); - - return nMaxLineWidth; -} - -// ----------------------------------------------------------------------- - -sal_uInt16 GetTextLines( OutputDevice* pDev, const Rectangle& rRect, - const XubString& rStr, - sal_uInt16 nStyle = TEXT_DRAW_WORDBREAK, - long* pMaxWidth = NULL ) -{ - MultiTextLineInfo aMultiLineInfo; - long nMaxWidth = GetTextLines( pDev, aMultiLineInfo, - rRect.GetWidth(), rStr, nStyle ); - if ( pMaxWidth ) - *pMaxWidth = nMaxWidth; - return aMultiLineInfo.Count(); -} - -// ----------------------------------------------------------------------- - -Rectangle GetTextRect( OutputDevice* pDev, const Rectangle& rRect, - const XubString& rStr, - sal_uInt16 nStyle = TEXT_DRAW_WORDBREAK ) -{ - Rectangle aRect = rRect; - sal_uInt16 nLines; - long nWidth = rRect.GetWidth(); - long nMaxWidth; - long nTextHeight; - - if ( nStyle & TEXT_DRAW_MULTILINE ) - { - MultiTextLineInfo aMultiLineInfo; - TextLineInfo* pLineInfo; - sal_uInt16 nFormatLines; - - nMaxWidth = 0; - GetTextLines( pDev, aMultiLineInfo, nWidth, rStr, nStyle ); - nFormatLines = aMultiLineInfo.Count(); - nTextHeight = pDev->GetTextHeight(); - nLines = (sal_uInt16)(aRect.GetHeight()/nTextHeight); - if ( nFormatLines <= nLines ) - nLines = nFormatLines; - else - { - if ( !(nStyle & TEXT_DRAW_ENDELLIPSIS) ) - nLines = nFormatLines; - else - nMaxWidth = nWidth; - } - for ( sal_uInt16 i = 0; i < nLines; i++ ) - { - pLineInfo = aMultiLineInfo.GetLine( i ); - if ( pLineInfo->GetWidth() > nMaxWidth ) - nMaxWidth = pLineInfo->GetWidth(); - } - } - else - { - nLines = 1; - nMaxWidth = pDev->GetTextWidth( rStr ); - nTextHeight = pDev->GetTextHeight(); - if ( (nMaxWidth > nWidth) && (nStyle & TEXT_DRAW_ENDELLIPSIS) ) - nMaxWidth = nWidth; - } - - if ( nStyle & TEXT_DRAW_RIGHT ) - aRect.Left() = aRect.Right()-nMaxWidth+1; - else if ( nStyle & TEXT_DRAW_CENTER ) - { - aRect.Left() += (nWidth-nMaxWidth)/2; - aRect.Right() = aRect.Left()+nMaxWidth-1; - } - else - aRect.Right() = aRect.Left()+nMaxWidth-1; - - if ( nStyle & TEXT_DRAW_BOTTOM ) - aRect.Top() = aRect.Bottom()-(nTextHeight*nLines)+1; - else if ( nStyle & TEXT_DRAW_VCENTER ) - { - aRect.Top() += (aRect.GetHeight()-(nTextHeight*nLines))/2; - aRect.Bottom() = aRect.Top()+(nTextHeight*nLines)-1; - } - else - aRect.Bottom() = aRect.Top()+(nTextHeight*nLines)-1; - - return aRect; -} - -// ----------------------------------------------------------------------- - -void DrawText( OutputDevice* pDev, const Rectangle& rRect, - const XubString& rStr, sal_uInt16 nStyle = 0 ) -{ - if ( !rStr.Len() || rRect.IsEmpty() ) - return; - - Point aPos = rRect.TopLeft(); - long nWidth = rRect.GetWidth(); - long nHeight = rRect.GetHeight(); - FontAlign eAlign = pDev->GetFont().GetAlign(); - - if ( ((nWidth <= 0) || (nHeight <= 0)) && (nStyle & TEXT_DRAW_CLIP) ) - return; - - // Mehrzeiligen Text behandeln wir anders - if ( nStyle & TEXT_DRAW_MULTILINE ) - { - String aLastLine; - Region aOldRegion; - MultiTextLineInfo aMultiLineInfo; - TextLineInfo* pLineInfo; - long nTextHeight = pDev->GetTextHeight(); - long nMaxTextWidth; - sal_uInt16 i; - sal_uInt16 nLines = (sal_uInt16)(nHeight/nTextHeight); - sal_uInt16 nFormatLines; - sal_Bool bIsClipRegion = sal_False; - nMaxTextWidth = GetTextLines( pDev, aMultiLineInfo, nWidth, rStr, nStyle ); - - nFormatLines = aMultiLineInfo.Count(); - if ( nFormatLines > nLines ) - { - if ( nStyle & TEXT_DRAW_ENDELLIPSIS ) - { - // Letzte Zeile zusammenbauen und kuerzen - nFormatLines = nLines-1; - pLineInfo = aMultiLineInfo.GetLine( nFormatLines ); - aLastLine = rStr.Copy( pLineInfo->GetIndex() ); - aLastLine.ConvertLineEnd( LINEEND_LF ); - aLastLine.SearchAndReplace( _LF, ' ' ); - aLastLine = GetEllipsisString( pDev, aLastLine, nWidth, nStyle ); - nStyle &= ~(TEXT_DRAW_VCENTER | TEXT_DRAW_BOTTOM); - nStyle |= TEXT_DRAW_TOP; - } - } - else - { - if ( nMaxTextWidth <= nWidth ) - nStyle &= ~TEXT_DRAW_CLIP; - } - - // Clipping setzen - if ( nStyle & TEXT_DRAW_CLIP ) - { - bIsClipRegion = pDev->IsClipRegion(); - if ( bIsClipRegion ) - { - aOldRegion = pDev->GetClipRegion(); - pDev->IntersectClipRegion( rRect ); - } - else - { - Region aRegion( rRect ); - pDev->SetClipRegion( aRegion ); - } - } - - // Vertikales Alignment - if ( nStyle & TEXT_DRAW_BOTTOM ) - aPos.Y() += nHeight-(nFormatLines*nTextHeight); - else if ( nStyle & TEXT_DRAW_VCENTER ) - aPos.Y() += (nHeight-(nFormatLines*nTextHeight))/2; - - // Font Alignment - if ( eAlign == ALIGN_BOTTOM ) - aPos.Y() += nTextHeight; - else if ( eAlign == ALIGN_BASELINE ) - aPos.Y() += pDev->GetFontMetric().GetAscent(); - - // Alle Zeilen ausgeben, bis auf die letzte - for ( i = 0; i < nFormatLines; i++ ) - { - pLineInfo = aMultiLineInfo.GetLine( i ); - if ( nStyle & TEXT_DRAW_RIGHT ) - aPos.X() += nWidth-pLineInfo->GetWidth(); - else if ( nStyle & TEXT_DRAW_CENTER ) - aPos.X() += (nWidth-pLineInfo->GetWidth())/2; - pDev->DrawText( aPos, rStr, pLineInfo->GetIndex(), pLineInfo->GetLen() ); - aPos.Y() += nTextHeight; - aPos.X() = rRect.Left(); - } - - // Gibt es noch eine letzte Zeile, dann diese linksbuendig ausgeben, - // da die Zeile gekuerzt wurde - if ( aLastLine.Len() ) - pDev->DrawText( aPos, aLastLine ); - - // Clipping zuruecksetzen - if ( nStyle & TEXT_DRAW_CLIP ) - { - if ( bIsClipRegion ) - pDev->SetClipRegion( aOldRegion ); - else - pDev->SetClipRegion(); - } - } - else - { - XubString aStr = rStr; - Size aTextSize(pDev->GetTextWidth( aStr ), pDev->GetTextHeight()); - - // Evt. Text kuerzen - if ( aTextSize.Width() > nWidth ) - { - if ( nStyle & TEXT_DRAW_ENDELLIPSIS ) - { - aStr = GetEllipsisString( pDev, rStr, nWidth, nStyle ); - nStyle &= ~(TEXT_DRAW_CENTER | TEXT_DRAW_RIGHT); - nStyle |= TEXT_DRAW_LEFT; - aTextSize.Width() = pDev->GetTextWidth(aStr); - } - } - else - { - if ( aTextSize.Height() <= nHeight ) - nStyle &= ~TEXT_DRAW_CLIP; - } - - // Vertikales Alignment - if ( nStyle & TEXT_DRAW_RIGHT ) - aPos.X() += nWidth-aTextSize.Width(); - else if ( nStyle & TEXT_DRAW_CENTER ) - aPos.X() += (nWidth-aTextSize.Width())/2; - - // Font Alignment - if ( eAlign == ALIGN_BOTTOM ) - aPos.Y() += aTextSize.Height(); - else if ( eAlign == ALIGN_BASELINE ) - aPos.Y() += pDev->GetFontMetric().GetAscent(); - - if ( nStyle & TEXT_DRAW_BOTTOM ) - aPos.Y() += nHeight-aTextSize.Height(); - else if ( nStyle & TEXT_DRAW_VCENTER ) - aPos.Y() += (nHeight-aTextSize.Height())/2; - - if ( nStyle & TEXT_DRAW_CLIP ) - { - sal_Bool bIsClipRegion = pDev->IsClipRegion(); - if ( bIsClipRegion ) - { - Region aOldRegion = pDev->GetClipRegion(); - pDev->IntersectClipRegion( rRect ); - pDev->DrawText( aPos, aStr ); - pDev->SetClipRegion( aOldRegion ); - } - else - { - Region aRegion( rRect ); - pDev->SetClipRegion( aRegion ); - pDev->DrawText( aPos, aStr ); - pDev->SetClipRegion(); - } - } - else - pDev->DrawText( aPos, aStr ); - } -} - -// ----------------------------------------------------------------------- - - -//-------------------------------------------------------------------------- -//-------------------------------------------------------------------------- -//-------------------------------------------------------------------------- - - -#define DRAWTEXT_FLAGS (TEXT_DRAW_CENTER|TEXT_DRAW_TOP|TEXT_DRAW_ENDELLIPSIS|\ - TEXT_DRAW_CLIP|TEXT_DRAW_MULTILINE|TEXT_DRAW_WORDBREAK) - - -class ImpIcnCursor -{ - SvImpIconView* pView; - SvPtrarr* pColumns; - SvPtrarr* pRows; - sal_Bool* pGridMap; - long nGridDX, nGridDY; - long nGridCols, nGridRows; - long nCols; - long nRows; - short nDeltaWidth; - short nDeltaHeight; - SvLBoxEntry* pCurEntry; - void SetDeltas(); - void ImplCreate(); - void Create() { if( !pColumns ) ImplCreate(); } - - sal_uInt16 GetSortListPos( SvPtrarr* pList, long nValue, int bVertical); - SvLBoxEntry* SearchCol(sal_uInt16 nCol,sal_uInt16 nTop,sal_uInt16 nBottom,sal_uInt16 nPref, - sal_Bool bDown, sal_Bool bSimple ); - SvLBoxEntry* SearchRow(sal_uInt16 nRow,sal_uInt16 nRight,sal_uInt16 nLeft,sal_uInt16 nPref, - sal_Bool bRight, sal_Bool bSimple ); - - void CreateGridMap(); - // Rueckgabe sal_False: Eintrag liegt nicht in der GridMap. rGridx,y werden - // dann an nGridCols, nGridRows geclippt - sal_Bool GetGrid( const Point& rDocPos, sal_uInt16& rGridX, sal_uInt16& rGridY ) const; - void SetGridUsed( sal_uInt16 nDX, sal_uInt16 nDY, sal_Bool bUsed ) - { - pGridMap[ (nDY * nGridCols) + nDX ] = bUsed; - } -public: - ImpIcnCursor( SvImpIconView* pOwner ); - ~ImpIcnCursor(); - void Clear( sal_Bool bGridToo = sal_True ); - - // fuer Cursortravelling usw. - SvLBoxEntry* GoLeftRight( SvLBoxEntry*, sal_Bool bRight ); - SvLBoxEntry* GoUpDown( SvLBoxEntry*, sal_Bool bDown ); - - // Rueckgaebe: sal_False == Das leere Rect steht hinter dem letzten - // Eintrag; d.h. beim naechsten Einfuegen ergibt sich das naechste - // leere Rechteck durch Addition. Hinweis: Das Rechteck kann dann - // ausserhalb des View-Space liegen - sal_Bool FindEmptyGridRect( Rectangle& rRect ); - - // Erzeugt fuer jede Zeile (Hoehe=nGridDY) eine nach BoundRect.Left() - // sortierte Liste der Eintraege, die in ihr stehen. Eine Liste kann - // leer sein. Die Listen gehen in das Eigentum des Rufenden ueber und - // muessen mit DestroyGridAdjustData geloescht werden - void CreateGridAjustData( SvPtrarr& pLists, SvLBoxEntry* pRow=0); - static void DestroyGridAdjustData( SvPtrarr& rLists ); - void SetGridUsed( const Rectangle&, sal_Bool bUsed = sal_True ); -}; - - - - -SvImpIconView::SvImpIconView( SvIconView* pCurView, SvLBoxTreeList* pTree, - WinBits i_nWinStyle ) : - aVerSBar( pCurView, WB_DRAG | WB_VSCROLL ), - aHorSBar( pCurView, WB_DRAG | WB_HSCROLL ) -{ - pView = pCurView; - pModel = pTree; - pCurParent = 0; - pZOrderList = new SvPtrarr; - SetStyle( i_nWinStyle ); - nHorDist = 0; - nVerDist = 0; - nFlags = 0; - nCurUserEvent = 0; - nMaxVirtWidth = 200; - pDDRefEntry = 0; - pDDDev = 0; - pDDBufDev = 0; - pDDTempDev = 0; - eTextMode = ShowTextShort; - pImpCursor = new ImpIcnCursor( this ); - - aVerSBar.SetScrollHdl( LINK( this, SvImpIconView, ScrollUpDownHdl ) ); - aHorSBar.SetScrollHdl( LINK( this, SvImpIconView, ScrollLeftRightHdl ) ); - nHorSBarHeight = aHorSBar.GetSizePixel().Height(); - nVerSBarWidth = aVerSBar.GetSizePixel().Width(); - - aMouseMoveTimer.SetTimeout( 20 ); - aMouseMoveTimer.SetTimeoutHdl(LINK(this,SvImpIconView,MouseMoveTimeoutHdl)); - - aEditTimer.SetTimeout( 800 ); - aEditTimer.SetTimeoutHdl(LINK(this,SvImpIconView,EditTimeoutHdl)); - - Clear( sal_True ); -} - -SvImpIconView::~SvImpIconView() -{ - StopEditTimer(); - CancelUserEvent(); - delete pZOrderList; - delete pImpCursor; - delete pDDDev; - delete pDDBufDev; - delete pDDTempDev; - ClearSelectedRectList(); -} - -void SvImpIconView::Clear( sal_Bool bInCtor ) -{ - StopEditTimer(); - CancelUserEvent(); - nMaxBmpWidth = 0; - nMaxBmpHeight = 0; - nMaxTextWidth = 0; - bMustRecalcBoundingRects = sal_False; - nMaxBoundHeight = 0; - - //XXX - nFlags |= F_GRID_INSERT; - nFlags &= ~F_PAINTED; - SetNextEntryPos( Point( LROFFS_WINBORDER, TBOFFS_WINBORDER ) ); - pCursor = 0; - if( !bInCtor ) - { - pImpCursor->Clear(); - aVirtOutputSize.Width() = 0; - aVirtOutputSize.Height() = 0; - pZOrderList->Remove(0,pZOrderList->Count()); - MapMode aMapMode( pView->GetMapMode()); - aMapMode.SetOrigin( Point() ); - pView->SetMapMode( aMapMode ); - if( pView->IsUpdateMode() ) - pView->Invalidate(); - } - AdjustScrollBars(); -} - -void SvImpIconView::SetStyle( const WinBits i_nWinStyle ) -{ - nViewMode = VIEWMODE_TEXT; - if( i_nWinStyle & WB_NAME ) - nViewMode = VIEWMODE_NAME; - if( i_nWinStyle & WB_ICON ) - nViewMode = VIEWMODE_ICON; -} - - -IMPL_LINK( SvImpIconView, ScrollUpDownHdl, ScrollBar *, pScrollBar ) -{ - pView->EndEditing( sal_True ); - // Pfeil hoch: delta=-1; Pfeil runter: delta=+1 - Scroll( 0, pScrollBar->GetDelta(), sal_True ); - return 0; -} - -IMPL_LINK( SvImpIconView, ScrollLeftRightHdl, ScrollBar *, pScrollBar ) -{ - pView->EndEditing( sal_True ); - // Pfeil links: delta=-1; Pfeil rechts: delta=+1 - Scroll( pScrollBar->GetDelta(), 0, sal_True ); - return 0; -} - -void SvImpIconView::ChangedFont() -{ - StopEditTimer(); - ImpArrange(); -} - - -void SvImpIconView::CheckAllSizes() -{ - nMaxTextWidth = 0; - nMaxBmpWidth = 0; - nMaxBmpHeight = 0; - SvLBoxEntry* pEntry = pModel->First(); - while( pEntry ) - { - CheckSizes( pEntry ); - pEntry = pModel->Next( pEntry ); - } -} - -void SvImpIconView::CheckSizes( SvLBoxEntry* pEntry, - const SvIcnVwDataEntry* pViewData ) -{ - Size aSize; - - if( !pViewData ) - pViewData = ICNVIEWDATA(pEntry); - - SvLBoxString* pStringItem = (SvLBoxString*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXSTRING)); - if( pStringItem ) - { - aSize = GetItemSize( pView, pEntry, pStringItem, pViewData ); - if( aSize.Width() > nMaxTextWidth ) - { - nMaxTextWidth = aSize.Width(); - if( !(nFlags & F_GRIDMODE ) ) - bMustRecalcBoundingRects = sal_True; - } - } - SvLBoxContextBmp* pBmpItem = (SvLBoxContextBmp*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP)); - if( pBmpItem ) - { - aSize = GetItemSize( pView, pEntry, pBmpItem, pViewData ); - if( aSize.Width() > nMaxBmpWidth ) - { - nMaxBmpWidth = aSize.Width(); - nMaxBmpWidth += (2*LROFFS_ICON); - if( !(nFlags & F_GRIDMODE ) ) - bMustRecalcBoundingRects = sal_True; - } - if( aSize.Height() > nMaxBmpHeight ) - { - nMaxBmpHeight = aSize.Height(); - nMaxBmpHeight += (2*TBOFFS_ICON);; - if( !(nFlags & F_GRIDMODE ) ) - bMustRecalcBoundingRects = sal_True; - } - } -} - -void SvImpIconView::EntryInserted( SvLBoxEntry* pEntry ) -{ - if( pModel->GetParent(pEntry) == pCurParent ) - { - StopEditTimer(); - DBG_ASSERT(pZOrderList->GetPos(pEntry)==0xffff,"EntryInserted:ZOrder?"); - pZOrderList->Insert( pEntry, pZOrderList->Count() ); - if( nFlags & F_GRIDMODE ) - pImpCursor->Clear( sal_False ); - else - pImpCursor->Clear( sal_True ); - SvIcnVwDataEntry* pViewData = ICNVIEWDATA(pEntry); - CheckSizes( pEntry, pViewData ); - if( pView->IsUpdateMode() ) - { - FindBoundingRect( pEntry, pViewData ); - PaintEntry( pEntry, pViewData ); - } - else - InvalidateBoundingRect( pViewData->aRect ); - } -} - -void SvImpIconView::RemovingEntry( SvLBoxEntry* pEntry ) -{ - if( pModel->GetParent(pEntry) == pCurParent) - { - StopEditTimer(); - DBG_ASSERT(pZOrderList->GetPos(pEntry)!=0xffff,"RemovingEntry:ZOrder?"); - SvIcnVwDataEntry* pViewData = ICNVIEWDATA(pEntry); - if( IsBoundingRectValid( pViewData->aRect ) ) - { - // bei gueltigem Bounding-Rect muss in EntryRemoved eine - // Sonderbehandlung erfolgen - nFlags |= F_ENTRY_REMOVED; - pView->Invalidate( pViewData->aRect ); - } - if( pEntry == pCursor ) - { - SvLBoxEntry* pNewCursor = GetNewCursor(); - ShowCursor( sal_False ); - pCursor = 0; // damit er nicht deselektiert wird - SetCursor( pNewCursor ); - } - sal_uInt16 nPos = pZOrderList->GetPos( (void*)pEntry ); - pZOrderList->Remove( nPos, 1 ); - pImpCursor->Clear(); - } -} - -void SvImpIconView::EntryRemoved() -{ - if( (nFlags & (F_ENTRY_REMOVED | F_PAINTED)) == (F_ENTRY_REMOVED | F_PAINTED)) - { - // Ein Eintrag mit gueltigem BoundRect wurde geloescht und wir - // haben schon mal gepaintet. In diesem Fall muessen wir die - // Position des naechsten Eintrags, der eingefuegt wird oder noch - // kein gueltiges BoundRect hat, "suchen" d.h. ein "Loch" in - // der View auffuellen. - nFlags &= ~( F_ENTRY_REMOVED | F_GRID_INSERT ); - } -} - - -void SvImpIconView::MovingEntry( SvLBoxEntry* pEntry ) -{ - DBG_ASSERT(pEntry,"MovingEntry: 0!"); - pNextCursor = 0; - StopEditTimer(); - if( pModel->GetParent(pEntry) == pCurParent ) - { - DBG_ASSERT(pZOrderList->GetPos(pEntry)!=0xffff,"MovingEntry:ZOrder?"); - nFlags |= F_MOVING_SIBLING; - SvIcnVwDataEntry* pViewData = ICNVIEWDATA(pEntry); - if( IsBoundingRectValid( pViewData->aRect ) ) - pView->Invalidate( pViewData->aRect ); - // falls Eintrag seinen Parent wechselt vorsichtshalber - // die neue Cursorposition berechnen - if( pEntry == pCursor ) - pNextCursor = GetNewCursor(); - pImpCursor->Clear(); - } -} - - -void SvImpIconView::EntryMoved( SvLBoxEntry* pEntry ) -{ - ShowCursor( sal_False ); - SvIcnVwDataEntry* pViewData = ICNVIEWDATA(pEntry); - if( pModel->GetParent(pEntry)==pCurParent ) - { - if( nFlags & F_MOVING_SIBLING ) - { - // die Neu-Positionierung eines Eintrags bei D&D innerhalb - // einer IconView findet bereits in NotifyMoving statt - // (MovingEntry/EntryMoved wird dann nicht mehr gerufen) - ToTop( pEntry ); - } - else - { - pImpCursor->Clear(); - pZOrderList->Insert( pEntry, pZOrderList->Count() ); - DBG_ASSERT(pZOrderList->Count()==pModel->GetChildCount(pCurParent),"EntryMoved:Bad zorder count"); - FindBoundingRect( pEntry, pViewData ); - } - PaintEntry( pEntry, pViewData ); - } - else - { - if( pEntry == pCursor ) - { - DBG_ASSERT(pNextCursor,"EntryMoved: Next cursor bad"); - SetCursor( pNextCursor ); - } - pImpCursor->Clear(); - sal_uInt16 nPos = pZOrderList->GetPos( (void*)pEntry ); - pZOrderList->Remove( nPos, 1 ); - pView->Select( pEntry, sal_False ); - // wenn er nochmal in dieser View auftaucht, muss sein - // Bounding-Rect neu berechnet werden - InvalidateBoundingRect( pViewData->aRect ); - } - nFlags &= (~F_MOVING_SIBLING); -} - -void SvImpIconView::TreeInserted( SvLBoxEntry* pEntry ) -{ - EntryMoved( pEntry ); // vorlaeufig -} - -void SvImpIconView::EntryExpanded( SvLBoxEntry* ) -{ -} - -void SvImpIconView::EntryCollapsed( SvLBoxEntry*) -{ -} - -void SvImpIconView::CollapsingEntry( SvLBoxEntry* ) -{ -} - -void SvImpIconView::EntrySelected( SvLBoxEntry* pEntry, sal_Bool bSelect ) -{ - if( pModel->GetParent(pEntry) != pCurParent ) - return; - - // bei SingleSelection dafuer sorgen, dass der Cursor immer - // auf dem (einzigen) selektierten Eintrag steht - if( bSelect && pCursor && - pView->GetSelectionMode() == SINGLE_SELECTION && - pEntry != pCursor ) - { - SetCursor( pEntry ); - DBG_ASSERT(pView->GetSelectionCount()==1,"selection count?"); - } - // bei Gummibandselektion ist uns das zu teuer - if( !(nFlags & F_RUBBERING )) - ToTop( pEntry ); - if( pView->IsUpdateMode() ) - { - if( pEntry == pCursor ) - ShowCursor( sal_False ); - if( nFlags & F_RUBBERING ) - PaintEntry( pEntry ); - else - pView->Invalidate( GetBoundingRect( pEntry ) ); - if( pEntry == pCursor ) - ShowCursor( sal_True ); - } -} - -void SvImpIconView::SetNextEntryPos(const Point& rPos) -{ - aPrevBoundRect.SetPos( rPos ); - aPrevBoundRect.Right() = LONG_MAX; // dont know -} - -Point SvImpIconView::FindNextEntryPos( const Size& rBoundSize ) -{ - if( nFlags & F_GRIDMODE ) - { - if( nFlags & F_GRID_INSERT ) - { - if( aPrevBoundRect.Right() != LONG_MAX ) - { - // passt der naechste Entry noch in die Zeile ? - long nNextWidth = aPrevBoundRect.Right() + nGridDX + LROFFS_WINBORDER; - if( nNextWidth > aVirtOutputSize.Width() ) - { - // darf aVirtOutputSize verbreitert werden ? - if( nNextWidth < nMaxVirtWidth ) - { - // verbreitern & in Zeile aufnehmen - aPrevBoundRect.Left() += nGridDX; - } - else - { - // erhoehen & neue Zeile beginnen - aPrevBoundRect.Top() += nGridDY; - aPrevBoundRect.Left() = LROFFS_WINBORDER; - } - } - else - { - // in die Zeile aufnehmen - aPrevBoundRect.Left() += nGridDX; - } - } - aPrevBoundRect.SetSize( Size( nGridDX, nGridDY ) ); - } - else - { - if( !pImpCursor->FindEmptyGridRect( aPrevBoundRect ) ) - { - // mitten in den Entries gibts keine Loecher mehr, - // wir koennen also wieder ins "Fast Insert" springen - nFlags |= F_GRID_INSERT; - } - } - } - else - { - if( aPrevBoundRect.Right() != LONG_MAX ) - { - // passt der naechste Entry noch in die Zeile ? - long nNextWidth=aPrevBoundRect.Right()+rBoundSize.Width()+LROFFS_BOUND+nHorDist; - if( nNextWidth > aVirtOutputSize.Width() ) - { - // darf aVirtOutputSize verbreitert werden ? - if( nNextWidth < nMaxVirtWidth ) - { - // verbreitern & in Zeile aufnehmen - aPrevBoundRect.SetPos( aPrevBoundRect.TopRight() ); - aPrevBoundRect.Left() += nHorDist; - } - else - { - // erhoehen & neue Zeile beginnen - aPrevBoundRect.Top() += nMaxBoundHeight + nVerDist + TBOFFS_BOUND; - aPrevBoundRect.Left() = LROFFS_WINBORDER; - } - } - else - { - // in die Zeile aufnehmen - aPrevBoundRect.SetPos( aPrevBoundRect.TopRight() ); - aPrevBoundRect.Left() += nHorDist; - } - } - aPrevBoundRect.SetSize( rBoundSize ); - } - return aPrevBoundRect.TopLeft(); -} - -void SvImpIconView::ResetVirtSize() -{ - StopEditTimer(); - aVirtOutputSize.Width() = 0; - aVirtOutputSize.Height() = 0; - sal_Bool bLockedEntryFound = sal_False; - nFlags &= (~F_GRID_INSERT); - SvLBoxEntry* pCur = pModel->FirstChild( pCurParent ); - while( pCur ) - { - SvIcnVwDataEntry* pViewData = ICNVIEWDATA(pCur); - if( pViewData->IsEntryPosLocked() ) - { - // VirtSize u.a. anpassen - if( !IsBoundingRectValid( pViewData->aRect ) ) - FindBoundingRect( pCur, pViewData ); - else - AdjustVirtSize( pViewData->aRect ); - bLockedEntryFound = sal_True; - } - else - InvalidateBoundingRect( pViewData->aRect ); - - pCur = pModel->NextSibling( pCur ); - } - if( !bLockedEntryFound ) - { - //XXX - nFlags |= F_GRID_INSERT; - } - - SetNextEntryPos( Point( LROFFS_WINBORDER, TBOFFS_WINBORDER ) ); - pImpCursor->Clear(); -} - - -void SvImpIconView::AdjustVirtSize( const Rectangle& rRect ) -{ - long nHeightOffs = 0; - long nWidthOffs = 0; - - if( aVirtOutputSize.Width() < (rRect.Right()+LROFFS_WINBORDER) ) - nWidthOffs = (rRect.Right()+LROFFS_WINBORDER) - aVirtOutputSize.Width(); - - if( aVirtOutputSize.Height() < (rRect.Bottom()+TBOFFS_WINBORDER) ) - nHeightOffs = (rRect.Bottom()+TBOFFS_WINBORDER) - aVirtOutputSize.Height(); - - if( nWidthOffs || nHeightOffs ) - { - Range aRange; - aVirtOutputSize.Width() += nWidthOffs; - aRange.Max() = aVirtOutputSize.Width(); - aHorSBar.SetRange( aRange ); - - aVirtOutputSize.Height() += nHeightOffs; - aRange.Max() = aVirtOutputSize.Height(); - aVerSBar.SetRange( aRange ); - - pImpCursor->Clear(); - AdjustScrollBars(); - } -} - -void SvImpIconView::Arrange() -{ - nMaxVirtWidth = aOutputSize.Width(); - ImpArrange(); -} - -void SvImpIconView::ImpArrange() -{ - StopEditTimer(); - ShowCursor( sal_False ); - ResetVirtSize(); - bMustRecalcBoundingRects = sal_False; - MapMode aMapMode( pView->GetMapMode()); - aMapMode.SetOrigin( Point() ); - pView->SetMapMode( aMapMode ); - CheckAllSizes(); - RecalcAllBoundingRectsSmart(); - pView->Invalidate(); - ShowCursor( sal_True ); -} - -void SvImpIconView::Paint( const Rectangle& rRect ) -{ - if( !pView->IsUpdateMode() ) - return; - -#if defined(DBG_UTIL) && defined(OV_DRAWGRID) - if( nFlags & F_GRIDMODE ) - { - Color aOldColor = pView->GetLineColor(); - Color aNewColor( COL_BLACK ); - pView->SetLineColor( aNewColor ); - Point aOffs( pView->GetMapMode().GetOrigin()); - Size aXSize( pView->GetOutputSizePixel() ); - for( long nDX = nGridDX; nDX <= aXSize.Width(); nDX += nGridDX ) - { - Point aStart( nDX+LROFFS_BOUND, 0 ); - Point aEnd( nDX+LROFFS_BOUND, aXSize.Height()); - aStart -= aOffs; - aEnd -= aOffs; - pView->DrawLine( aStart, aEnd ); - } - for( long nDY = nGridDY; nDY <= aXSize.Height(); nDY += nGridDY ) - { - Point aStart( 0, nDY+TBOFFS_BOUND ); - Point aEnd( aXSize.Width(), nDY+TBOFFS_BOUND ); - aStart -= aOffs; - aEnd -= aOffs; - pView->DrawLine( aStart, aEnd ); - } - pView->SetLineColor( aOldColor ); - } -#endif - nFlags |= F_PAINTED; - - if( !(pModel->HasChilds( pCurParent ) )) - return; - if( !pCursor ) - pCursor = pModel->FirstChild( pCurParent ); - - sal_uInt16 nCount = pZOrderList->Count(); - if( !nCount ) - return; - - SvPtrarr* pNewZOrderList = new SvPtrarr; - SvPtrarr* pPaintedEntries = new SvPtrarr; - - sal_uInt16 nPos = 0; - while( nCount ) - { - SvLBoxEntry* pEntry = (SvLBoxEntry*)(pZOrderList->GetObject(nPos )); - SvIcnVwDataEntry* pViewData = ICNVIEWDATA(pEntry); - const Rectangle& rBoundRect = GetBoundingRect( pEntry, pViewData ); - if( rRect.IsOver( rBoundRect ) ) - { - PaintEntry( pEntry, rBoundRect.TopLeft(), pViewData ); - // Eintraege, die neu gezeichnet werden, auf Top setzen - pPaintedEntries->Insert( pEntry, pPaintedEntries->Count() ); - } - else - pNewZOrderList->Insert( pEntry, pNewZOrderList->Count() ); - - nCount--; - nPos++; - } - delete pZOrderList; - pZOrderList = pNewZOrderList; - nCount = pPaintedEntries->Count(); - if( nCount ) - { - for( sal_uInt16 nCur = 0; nCur < nCount; nCur++ ) - pZOrderList->Insert( pPaintedEntries->GetObject( nCur ),pZOrderList->Count()); - } - delete pPaintedEntries; - - Rectangle aRect; - if( GetResizeRect( aRect )) - PaintResizeRect( aRect ); -} - -sal_Bool SvImpIconView::GetResizeRect( Rectangle& rRect ) -{ - if( aHorSBar.IsVisible() && aVerSBar.IsVisible() ) - { - const MapMode& rMapMode = pView->GetMapMode(); - Point aOrigin( rMapMode.GetOrigin()); - aOrigin *= -1; - aOrigin.X() += aOutputSize.Width(); - aOrigin.Y() += aOutputSize.Height(); - rRect.SetPos( aOrigin ); - rRect.SetSize( Size( nVerSBarWidth, nHorSBarHeight)); - return sal_True; - } - return sal_False; -} - -void SvImpIconView::PaintResizeRect( const Rectangle& rRect ) -{ - const StyleSettings& rStyleSettings = pView->GetSettings().GetStyleSettings(); - Color aNewColor = rStyleSettings.GetFaceColor(); - Color aOldColor = pView->GetFillColor(); - pView->SetFillColor( aNewColor ); - pView->DrawRect( rRect ); - pView->SetFillColor( aOldColor ); -} - -void SvImpIconView::RepaintSelectionItems() -{ - OSL_FAIL("RepaintSelectionItems"); - pView->Invalidate(); // vorlaeufig -} - -SvLBoxItem* SvImpIconView::GetItem( SvLBoxEntry* pEntry, - const Point& rAbsPos ) -{ - Rectangle aRect; - SvLBoxString* pStringItem = (SvLBoxString*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXSTRING)); - if( pStringItem ) - { - aRect = CalcTextRect( pEntry, pStringItem ); - if( aRect.IsInside( rAbsPos ) ) - return pStringItem; - } - SvLBoxContextBmp* pBmpItem = (SvLBoxContextBmp*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP)); - if( pBmpItem ) - { - aRect = CalcBmpRect( pEntry ); - if( aRect.IsInside( rAbsPos ) ) - return pBmpItem; - } - return 0; -} - -void SvImpIconView::CalcDocPos( Point& aMaeuschenPos ) -{ - aMaeuschenPos -= pView->GetMapMode().GetOrigin(); -} - -void SvImpIconView::MouseButtonDown( const MouseEvent& rMEvt) -{ - StopEditTimer(); - pView->GrabFocus(); - Point aDocPos( rMEvt.GetPosPixel() ); - if(aDocPos.X()>=aOutputSize.Width() || aDocPos.Y()>=aOutputSize.Height()) - return; - CalcDocPos( aDocPos ); - SvLBoxEntry* pEntry = GetEntry( aDocPos ); - if( !pEntry ) - { - if( pView->GetSelectionMode() != SINGLE_SELECTION ) - { - if( !rMEvt.IsMod1() ) // Ctrl - { - pView->SelectAll( sal_False ); - ClearSelectedRectList(); - } - else - nFlags |= F_ADD_MODE; - nFlags |= F_RUBBERING; - aCurSelectionRect.SetPos( aDocPos ); - pView->CaptureMouse(); - } - return; - } - - sal_Bool bSelected = pView->IsSelected( pEntry ); - sal_Bool bEditingEnabled = pView->IsInplaceEditingEnabled(); - - if( rMEvt.GetClicks() == 2 ) - { - DeselectAllBut( pEntry ); - pView->pHdlEntry = pEntry; - pView->DoubleClickHdl(); - } - else - { - // Inplace-Editing ? - if( rMEvt.IsMod2() ) // Alt? - { - if( bEditingEnabled ) - { - SvLBoxItem* pItem = GetItem(pEntry,aDocPos); - if( pItem ) - pView->EditingRequest( pEntry, pItem, aDocPos); - } - } - else if( pView->GetSelectionMode() == SINGLE_SELECTION ) - { - DeselectAllBut( pEntry ); - SetCursor( pEntry ); - pView->Select( pEntry, sal_True ); - if( bEditingEnabled && bSelected && !rMEvt.GetModifier() && - rMEvt.IsLeft() && IsTextHit( pEntry, aDocPos ) ) - { - nFlags |= F_START_EDITTIMER_IN_MOUSEUP; - } - } - else - { - if( !rMEvt.GetModifier() ) - { - if( !bSelected ) - { - DeselectAllBut( pEntry ); - SetCursor( pEntry ); - pView->Select( pEntry, sal_True ); - } - else - { - // erst im Up deselektieren, falls Move per D&D! - nFlags |= F_DOWN_DESELECT; - if( bEditingEnabled && IsTextHit( pEntry, aDocPos ) && - rMEvt.IsLeft()) - { - nFlags |= F_START_EDITTIMER_IN_MOUSEUP; - } - } - } - else if( rMEvt.IsMod1() ) - nFlags |= F_DOWN_CTRL; - } - } -} - -void SvImpIconView::MouseButtonUp( const MouseEvent& rMEvt ) -{ - aMouseMoveTimer.Stop(); - pView->ReleaseMouse(); - // HACK, da Einar noch nicht PrepareCommandEvent aufruft - if( rMEvt.IsRight() && (nFlags & (F_DOWN_CTRL | F_DOWN_DESELECT) )) - nFlags &= ~(F_DOWN_CTRL | F_DOWN_DESELECT); - - if( nFlags & F_RUBBERING ) - { - aMouseMoveTimer.Stop(); - AddSelectedRect( aCurSelectionRect ); - HideSelectionRect(); - nFlags &= ~(F_RUBBERING | F_ADD_MODE); - } - - SvLBoxEntry* pEntry = pView->GetEntry( rMEvt.GetPosPixel(), sal_True ); - if( pEntry ) - { - if( nFlags & F_DOWN_CTRL ) - { - // Ctrl & MultiSelection - ToggleSelection( pEntry ); - SetCursor( pEntry ); - } - else if( nFlags & F_DOWN_DESELECT ) - { - DeselectAllBut( pEntry ); - SetCursor( pEntry ); - pView->Select( pEntry, sal_True ); - } - } - - nFlags &= ~(F_DOWN_CTRL | F_DOWN_DESELECT); - if( nFlags & F_START_EDITTIMER_IN_MOUSEUP ) - { - StartEditTimer(); - nFlags &= ~F_START_EDITTIMER_IN_MOUSEUP; - } -} - -void SvImpIconView::MouseMove( const MouseEvent& rMEvt ) -{ - if( nFlags & F_RUBBERING ) - { - const Point& rPosPixel = rMEvt.GetPosPixel(); - if( !aMouseMoveTimer.IsActive() ) - { - aMouseMoveEvent = rMEvt; - aMouseMoveTimer.Start(); - // ausserhalb des Fensters liegende Move-Events muessen - // vom Timer kommen, damit die Scrollgeschwindigkeit - // unabhaengig von Mausbewegungen ist. - if( rPosPixel.X() < 0 || rPosPixel.Y() < 0 ) - return; - const Size& rSize = pView->GetOutputSizePixel(); - if( rPosPixel.X() > rSize.Width() || rPosPixel.Y() > rSize.Height()) - return; - } - - if( &rMEvt != &aMouseMoveEvent ) - aMouseMoveEvent = rMEvt; - - long nScrollDX, nScrollDY; - - CalcScrollOffsets(rMEvt.GetPosPixel(),nScrollDX,nScrollDY,sal_False ); - sal_Bool bSelRectHidden = sal_False; - if( nScrollDX || nScrollDY ) - { - HideSelectionRect(); - bSelRectHidden = sal_True; - pView->Scroll( nScrollDX, nScrollDY ); - } - Point aDocPos( rMEvt.GetPosPixel() ); - aDocPos = pView->PixelToLogic( aDocPos ); - Rectangle aRect( aCurSelectionRect.TopLeft(), aDocPos ); - if( aRect != aCurSelectionRect ) - { - HideSelectionRect(); - bSelRectHidden = sal_True; - sal_Bool bAdd = (nFlags & F_ADD_MODE) ? sal_True : sal_False; - SelectRect( aRect, bAdd, &aSelectedRectList ); - } - if( bSelRectHidden ) - DrawSelectionRect( aRect ); - } -} - -sal_Bool SvImpIconView::KeyInput( const KeyEvent& rKEvt ) -{ - StopEditTimer(); - sal_Bool bKeyUsed = sal_True; - sal_Bool bMod1 = rKEvt.GetKeyCode().IsMod1(); - sal_Bool bInAddMode = (sal_Bool)((nFlags & F_ADD_MODE) != 0); - int bDeselAll = (pView->GetSelectionMode() != SINGLE_SELECTION) && - !bInAddMode; - SvLBoxEntry* pNewCursor; - sal_uInt16 nCode = rKEvt.GetKeyCode().GetCode(); - switch( nCode ) - { - case KEY_UP: - if( pCursor ) - { - MakeVisible( pCursor ); - pNewCursor = pImpCursor->GoUpDown(pCursor,sal_False); - if( pNewCursor ) - { - if( bDeselAll ) - pView->SelectAll( sal_False ); - ShowCursor( sal_False ); - MakeVisible( pNewCursor ); - SetCursor( pNewCursor ); - if( !bInAddMode ) - pView->Select( pCursor, sal_True ); - } - else - { - Rectangle aRect( GetBoundingRect( pCursor ) ); - if( aRect.Top()) - { - aRect.Bottom() -= aRect.Top(); - aRect.Top() = 0; - MakeVisible( aRect ); - } - } - } - break; - - case KEY_DOWN: - if( pCursor ) - { - pNewCursor=pImpCursor->GoUpDown( pCursor,sal_True ); - if( pNewCursor ) - { - MakeVisible( pCursor ); - if( bDeselAll ) - pView->SelectAll( sal_False ); - ShowCursor( sal_False ); - MakeVisible( pNewCursor ); - SetCursor( pNewCursor ); - if( !bInAddMode ) - pView->Select( pCursor, sal_True ); - } - } - break; - - case KEY_RIGHT: - if( pCursor ) - { - pNewCursor=pImpCursor->GoLeftRight(pCursor,sal_True ); - if( pNewCursor ) - { - MakeVisible( pCursor ); - if( bDeselAll ) - pView->SelectAll( sal_False ); - ShowCursor( sal_False ); - MakeVisible( pNewCursor ); - SetCursor( pNewCursor ); - if( !bInAddMode ) - pView->Select( pCursor, sal_True ); - } - } - break; - - case KEY_LEFT: - if( pCursor ) - { - MakeVisible( pCursor ); - pNewCursor = pImpCursor->GoLeftRight(pCursor,sal_False ); - if( pNewCursor ) - { - if( bDeselAll ) - pView->SelectAll( sal_False ); - ShowCursor( sal_False ); - MakeVisible( pNewCursor ); - SetCursor( pNewCursor ); - if( !bInAddMode ) - pView->Select( pCursor, sal_True ); - } - else - { - Rectangle aRect( GetBoundingRect(pCursor)); - if( aRect.Left() ) - { - aRect.Right() -= aRect.Left(); - aRect.Left() = 0; - MakeVisible( aRect ); - } - } - } - break; - - case KEY_ESCAPE: - if( nFlags & F_RUBBERING ) - { - HideSelectionRect(); - pView->SelectAll( sal_False ); - nFlags &= ~F_RUBBERING; - } - break; - - case KEY_F8: - if( rKEvt.GetKeyCode().IsShift() ) - { - if( nFlags & F_ADD_MODE ) - nFlags &= (~F_ADD_MODE); - else - nFlags |= F_ADD_MODE; - } - break; - - case KEY_SPACE: - if( pCursor ) - { - ToggleSelection( pCursor ); - } - break; - - - case KEY_PAGEDOWN: - break; - case KEY_PAGEUP: - break; - - case KEY_ADD: - case KEY_DIVIDE : - if( bMod1 ) - pView->SelectAll( sal_True ); - break; - - case KEY_SUBTRACT: - case KEY_COMMA : - if( bMod1 ) - pView->SelectAll( sal_False ); - break; - - case KEY_RETURN: - if( bMod1 ) - { - if( pCursor && pView->IsInplaceEditingEnabled() ) - pView->EditEntry( pCursor ); - } - break; - - default: - bKeyUsed = sal_False; - - } - return bKeyUsed; -} - - -void SvImpIconView::PositionScrollBars( long nRealWidth, long nRealHeight ) -{ - // hor scrollbar - Point aPos( 0, nRealHeight ); - aPos.Y() -= nHorSBarHeight; - - if( aHorSBar.GetPosPixel() != aPos ) - aHorSBar.SetPosPixel( aPos ); - - // ver scrollbar - aPos.X() = nRealWidth; aPos.Y() = 0; - aPos.X() -= nVerSBarWidth; - -#if defined(WNT) - aPos.X()++; - aPos.Y()--; -#endif - - if( aVerSBar.GetPosPixel() != aPos ) - aVerSBar.SetPosPixel( aPos ); -} - - - -void SvImpIconView::AdjustScrollBars() -{ - long nVirtHeight = aVirtOutputSize.Height(); - long nVirtWidth = aVirtOutputSize.Width(); - - Size aOSize( pView->Control::GetOutputSizePixel() ); - long nRealHeight = aOSize.Height(); - long nRealWidth = aOSize.Width(); - - PositionScrollBars( nRealWidth, nRealHeight ); - - const MapMode& rMapMode = pView->GetMapMode(); - Point aOrigin( rMapMode.GetOrigin() ); - - long nVisibleWidth; - if( nRealWidth > nVirtWidth ) - nVisibleWidth = nVirtWidth + aOrigin.X(); - else - nVisibleWidth = nRealWidth; - - long nVisibleHeight; - if( nRealHeight > nVirtHeight ) - nVisibleHeight = nVirtHeight + aOrigin.Y(); - else - nVisibleHeight = nRealHeight; - - bool bVerSBar = (pView->GetStyle() & WB_VSCROLL) ? true : false; - bool bHorSBar = (pView->GetStyle() & WB_HSCROLL) ? true : false; - - sal_uInt16 nResult = 0; - if( nVirtHeight ) - { - // activate ver scrollbar ? - if( bVerSBar || ( nVirtHeight > nVisibleHeight) ) - { - nResult = 0x0001; - nRealWidth -= nVerSBarWidth; - - if( nRealWidth > nVirtWidth ) - nVisibleWidth = nVirtWidth + aOrigin.X(); - else - nVisibleWidth = nRealWidth; - - nFlags |= F_HOR_SBARSIZE_WITH_VBAR; - } - // activate hor scrollbar ? - if( bHorSBar || (nVirtWidth > nVisibleWidth) ) - { - nResult |= 0x0002; - nRealHeight -= nHorSBarHeight; - - if( nRealHeight > nVirtHeight ) - nVisibleHeight = nVirtHeight + aOrigin.Y(); - else - nVisibleHeight = nRealHeight; - - // brauchen wir jetzt doch eine senkrechte Scrollbar ? - if( !(nResult & 0x0001) && // nur wenn nicht schon da - ( (nVirtHeight > nVisibleHeight) || bVerSBar) ) - { - nResult = 3; // both are active - nRealWidth -= nVerSBarWidth; - - if( nRealWidth > nVirtWidth ) - nVisibleWidth = nVirtWidth + aOrigin.X(); - else - nVisibleWidth = nRealWidth; - - nFlags |= F_VER_SBARSIZE_WITH_HBAR; - } - } - } - - // size ver scrollbar - long nThumb = aVerSBar.GetThumbPos(); - Size aSize( nVerSBarWidth, nRealHeight ); -#if defined(WNT) - aSize.Height() += 2; -#endif - if( aSize != aVerSBar.GetSizePixel() ) - aVerSBar.SetSizePixel( aSize ); - aVerSBar.SetVisibleSize( nVisibleHeight ); - aVerSBar.SetPageSize( (nVisibleHeight*75)/100 ); - if( nResult & 0x0001 ) - { - aVerSBar.SetThumbPos( nThumb ); - aVerSBar.Show(); - } - else - { - aVerSBar.SetThumbPos( 0 ); - aVerSBar.Hide(); - } - - // size hor scrollbar - nThumb = aHorSBar.GetThumbPos(); - aSize.Width() = nRealWidth; - aSize.Height() = nHorSBarHeight; -#if defined(WNT) - aSize.Width()++; -#endif -#if defined(WNT) - if( nResult & 0x0001 ) // vertikale Scrollbar ? - { - aSize.Width()++; - nRealWidth++; - } -#endif - if( aSize != aHorSBar.GetSizePixel() ) - aHorSBar.SetSizePixel( aSize ); - aHorSBar.SetVisibleSize( nVisibleWidth ); //nRealWidth ); - aHorSBar.SetPageSize( (nVisibleWidth*75)/100 ); - if( nResult & 0x0002 ) - { - aHorSBar.SetThumbPos( nThumb ); - aHorSBar.Show(); - } - else - { - aHorSBar.SetThumbPos( 0 ); - aHorSBar.Hide(); - } - - aOutputSize.Width() = nRealWidth; -#if defined(WNT) - if( nResult & 0x0002 ) // hor scrollbar ? - nRealHeight++; // weil unterer Rand geclippt wird -#endif - aOutputSize.Height() = nRealHeight; -} - -void SvImpIconView::Resize() -{ - StopEditTimer(); - Rectangle aRect; - if( GetResizeRect(aRect) ) - pView->Invalidate( aRect ); - aOutputSize = pView->GetOutputSizePixel(); - pImpCursor->Clear(); - -#if 1 - const Size& rSize = pView->Control::GetOutputSizePixel(); - PositionScrollBars( rSize.Width(), rSize.Height() ); - // Die ScrollBars werden asynchron ein/ausgeblendet, damit abgeleitete - // Klassen im Resize ein Arrange durchfuehren koennen, ohne dass - // die ScrollBars aufblitzen (SfxExplorerIconView!) - nCurUserEvent = Application::PostUserEvent(LINK(this,SvImpIconView,UserEventHdl),0); -#else - AdjustScrollBars(); - if( GetResizeRect(aRect) ) - PaintResizeRect( aRect ); -#endif -} - -sal_Bool SvImpIconView::CheckHorScrollBar() -{ - if( !pZOrderList || !aHorSBar.IsVisible() ) - return sal_False; - const MapMode& rMapMode = pView->GetMapMode(); - Point aOrigin( rMapMode.GetOrigin() ); - if(!(pView->GetStyle() & WB_HSCROLL) && !aOrigin.X() ) - { - long nWidth = aOutputSize.Width(); - sal_uInt16 nCount = pZOrderList->Count(); - long nMostRight = 0; - for( sal_uInt16 nCur = 0; nCur < nCount; nCur++ ) - { - SvLBoxEntry* pEntry = (SvLBoxEntry*)pZOrderList->operator[](nCur); - long nRight = GetBoundingRect(pEntry).Right(); - if( nRight > nWidth ) - return sal_False; - if( nRight > nMostRight ) - nMostRight = nRight; - } - aHorSBar.Hide(); - aOutputSize.Height() += nHorSBarHeight; - aVirtOutputSize.Width() = nMostRight; - aHorSBar.SetThumbPos( 0 ); - Range aRange; - aRange.Max() = nMostRight - 1; - aHorSBar.SetRange( aRange ); - if( aVerSBar.IsVisible() ) - { - Size aSize( aVerSBar.GetSizePixel()); - aSize.Height() += nHorSBarHeight; - aVerSBar.SetSizePixel( aSize ); - } - return sal_True; - } - return sal_False; -} - -sal_Bool SvImpIconView::CheckVerScrollBar() -{ - if( !pZOrderList || !aVerSBar.IsVisible() ) - return sal_False; - const MapMode& rMapMode = pView->GetMapMode(); - Point aOrigin( rMapMode.GetOrigin() ); - if(!(pView->GetStyle() & WB_VSCROLL) && !aOrigin.Y() ) - { - long nDeepest = 0; - long nHeight = aOutputSize.Height(); - sal_uInt16 nCount = pZOrderList->Count(); - for( sal_uInt16 nCur = 0; nCur < nCount; nCur++ ) - { - SvLBoxEntry* pEntry = (SvLBoxEntry*)pZOrderList->operator[](nCur); - long nBottom = GetBoundingRect(pEntry).Bottom(); - if( nBottom > nHeight ) - return sal_False; - if( nBottom > nDeepest ) - nDeepest = nBottom; - } - aVerSBar.Hide(); - aOutputSize.Width() += nVerSBarWidth; - aVirtOutputSize.Height() = nDeepest; - aVerSBar.SetThumbPos( 0 ); - Range aRange; - aRange.Max() = nDeepest - 1; - aVerSBar.SetRange( aRange ); - if( aHorSBar.IsVisible() ) - { - Size aSize( aHorSBar.GetSizePixel()); - aSize.Width() += nVerSBarWidth; - aHorSBar.SetSizePixel( aSize ); - } - return sal_True; - } - return sal_False; -} - - -// blendet Scrollbars aus, wenn sie nicht mehr benoetigt werden -void SvImpIconView::CheckScrollBars() -{ - CheckVerScrollBar(); - if( CheckHorScrollBar() ) - CheckVerScrollBar(); -} - - -void SvImpIconView::GetFocus() -{ - if( pCursor ) - { - pView->SetEntryFocus( pCursor, sal_True ); - ShowCursor( sal_True ); - } -} - -void SvImpIconView::LoseFocus() -{ - StopEditTimer(); - if( pCursor ) - pView->SetEntryFocus( pCursor,sal_False ); - ShowCursor( sal_False ); -} - -void SvImpIconView::UpdateAll() -{ - AdjustScrollBars(); - pImpCursor->Clear(); - pView->Invalidate(); -} - -void SvImpIconView::PaintEntry( SvLBoxEntry* pEntry, SvIcnVwDataEntry* pViewData ) -{ - Point aPos( GetEntryPosition( pEntry ) ); - PaintEntry( pEntry, aPos, pViewData ); -} - -void SvImpIconView::PaintEmphasis( const Rectangle& rRect, sal_Bool bSelected, - sal_Bool bCursored, OutputDevice* pOut ) -{ - // HACK fuer D&D - if( nFlags & F_NO_EMPHASIS ) - return; - - if( !pOut ) - pOut = pView; - - // Selektion painten - Color aOldFillColor = pOut->GetFillColor(); - Color aOldLineColor = pOut->GetLineColor(); - Color aNewColor; - const StyleSettings& rStyleSettings = pOut->GetSettings().GetStyleSettings(); - if( bSelected ) - { - aNewColor = rStyleSettings.GetHighlightColor(); - } - else - { - aNewColor =rStyleSettings.GetFieldColor(); - } - - if( bCursored ) - { - pOut->SetLineColor( Color( COL_BLACK ) ); - } - pOut->SetFillColor( aNewColor ); - pOut->DrawRect( rRect ); - pOut->SetFillColor( aOldFillColor ); - pOut->SetLineColor( aOldLineColor ); -} - -void SvImpIconView::PaintItem( const Rectangle& rRect, - SvLBoxItem* pItem, SvLBoxEntry* pEntry, sal_uInt16 nPaintFlags, - OutputDevice* pOut ) -{ - if( nViewMode == VIEWMODE_ICON && pItem->IsA() == SV_ITEM_ID_LBOXSTRING ) - { - const String& rStr = ((SvLBoxString*)pItem)->GetText(); - DrawText( pOut, rRect, rStr, DRAWTEXT_FLAGS ); - } - else - { - Point aPos( rRect.TopLeft() ); - const Size& rSize = GetItemSize( pView, pEntry, pItem ); - if( nPaintFlags & PAINTFLAG_HOR_CENTERED ) - aPos.X() += (rRect.GetWidth() - rSize.Width() ) / 2; - if( nPaintFlags & PAINTFLAG_VER_CENTERED ) - aPos.Y() += (rRect.GetHeight() - rSize.Height() ) / 2; - pItem->Paint( aPos, *(SvLBox*)pOut, 0, pEntry ); - } -} - -void SvImpIconView::PaintEntry( SvLBoxEntry* pEntry, const Point& rPos, - SvIcnVwDataEntry* pViewData, OutputDevice* pOut ) -{ - if( !pView->IsUpdateMode() ) - return; - - if( !pOut ) - pOut = pView; - - SvLBoxContextBmp* pBmpItem; - - pView->PreparePaint( pEntry ); - - if( !pViewData ) - pViewData = ICNVIEWDATA(pEntry); - - SvLBoxString* pStringItem = (SvLBoxString*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXSTRING)); - - sal_Bool bSelected = pViewData->IsSelected(); - sal_Bool bCursored = pViewData->IsCursored(); - - Font aTempFont( pOut->GetFont() ); - // waehrend D&D nicht die Fontfarbe wechseln, da sonst auch die - // Emphasis gezeichnet werden muss! (weisser Adler auf weissem Grund) - if( bSelected && !(nFlags & F_NO_EMPHASIS) ) - { - const StyleSettings& rStyleSettings = pOut->GetSettings().GetStyleSettings(); - Font aNewFont( aTempFont ); - aNewFont.SetColor( rStyleSettings.GetHighlightTextColor() ); - pOut->SetFont( aNewFont ); - } - Rectangle aTextRect( CalcTextRect(pEntry,pStringItem,&rPos,sal_False,pViewData)); - Rectangle aBmpRect( CalcBmpRect(pEntry, &rPos, pViewData ) ); - - switch( nViewMode ) - { - case VIEWMODE_ICON: - pBmpItem = (SvLBoxContextBmp*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP)); - PaintEmphasis( aBmpRect, bSelected, bCursored, pOut ); - PaintItem( aBmpRect, pBmpItem, pEntry, - PAINTFLAG_HOR_CENTERED | PAINTFLAG_VER_CENTERED, pOut ); - PaintEmphasis( aTextRect, bSelected, sal_False, pOut ); - PaintItem( aTextRect, pStringItem, pEntry, PAINTFLAG_HOR_CENTERED, pOut ); - break; - - case VIEWMODE_NAME: - pBmpItem = (SvLBoxContextBmp*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP)); - PaintEmphasis( aBmpRect, bSelected, bCursored, pOut ); - PaintItem( aBmpRect, pBmpItem, pEntry, PAINTFLAG_VER_CENTERED, pOut ); - PaintEmphasis( aTextRect, bSelected, sal_False, pOut ); - PaintItem( aTextRect, pStringItem, pEntry,PAINTFLAG_VER_CENTERED, pOut ); - break; - - case VIEWMODE_TEXT: - PaintEmphasis( aTextRect, bSelected, bCursored, pOut ); - PaintItem( aTextRect, pStringItem, pEntry, PAINTFLAG_VER_CENTERED, pOut ); - break; - } - pOut->SetFont( aTempFont ); -} - -void SvImpIconView::SetEntryPosition( SvLBoxEntry* pEntry, const Point& rPos, - sal_Bool bAdjustAtGrid, sal_Bool bCheckScrollBars ) -{ - if( pModel->GetParent(pEntry) == pCurParent ) - { - ShowCursor( sal_False ); - SvIcnVwDataEntry* pViewData = ICNVIEWDATA(pEntry); - Rectangle aBoundRect( GetBoundingRect( pEntry, pViewData )); - pView->Invalidate( aBoundRect ); - ToTop( pEntry ); - if( rPos != aBoundRect.TopLeft() ) - { - Point aGridOffs = pViewData->aGridRect.TopLeft() - - pViewData->aRect.TopLeft(); - pImpCursor->Clear(); - nFlags &= ~F_GRID_INSERT; - aBoundRect.SetPos( rPos ); - pViewData->aRect = aBoundRect; - pViewData->aGridRect.SetPos( rPos + aGridOffs ); - AdjustVirtSize( aBoundRect ); - } - //HACK(Billigloesung, die noch verbessert werden muss) - if( bAdjustAtGrid ) - { - AdjustAtGrid( pEntry ); - ToTop( pEntry ); - } - if( bCheckScrollBars && pView->IsUpdateMode() ) - CheckScrollBars(); - - PaintEntry( pEntry, pViewData ); - ShowCursor( sal_True ); - } -} - -void SvImpIconView::ViewDataInitialized( SvLBoxEntry*) -{ -} - -void SvImpIconView::ModelHasEntryInvalidated( SvListEntry* pEntry ) -{ - if( pEntry == pCursor ) - ShowCursor( sal_False ); - SvIcnVwDataEntry* pViewData = ICNVIEWDATA(pEntry); - pView->Invalidate( pViewData->aRect ); - - if( nFlags & F_GRIDMODE ) - Center( (SvLBoxEntry*)pEntry, pViewData ); - else - pViewData->aRect.SetSize( CalcBoundingSize( - (SvLBoxEntry*)pEntry, pViewData ) ); - - ViewDataInitialized( (SvLBoxEntry*)pEntry ); - pView->Invalidate( pViewData->aRect ); - if( pEntry == pCursor ) - ShowCursor( sal_True ); -} - - -void SvImpIconView::InvalidateEntry( SvLBoxEntry* pEntry ) -{ - const Rectangle& rRect = GetBoundingRect( pEntry ); - pView->Invalidate( rRect ); -} - -void SvImpIconView::SetNoSelection() -{ -} - -void SvImpIconView::SetDragDropMode( DragDropMode ) -{ -} - -void SvImpIconView::SetSelectionMode( SelectionMode ) -{ -} - -sal_Bool SvImpIconView::IsEntryInView( SvLBoxEntry* ) -{ - return sal_False; -} - -SvLBoxEntry* SvImpIconView::GetDropTarget( const Point& rPos ) -{ - Point aDocPos( rPos ); - CalcDocPos( aDocPos ); - SvLBoxEntry* pTarget = GetEntry( aDocPos ); - if( !pTarget || !pTarget->HasChilds() ) - pTarget = pCurParent; - return pTarget; -} - -SvLBoxEntry* SvImpIconView::GetEntry( const Point& rDocPos ) -{ - CheckBoundingRects(); - SvLBoxEntry* pTarget = 0; - // Z-Order-Liste vom Ende her absuchen - sal_uInt16 nCount = pZOrderList->Count(); - while( nCount ) - { - nCount--; - SvLBoxEntry* pEntry = (SvLBoxEntry*)(pZOrderList->GetObject(nCount)); - SvIcnVwDataEntry* pViewData = ICNVIEWDATA(pEntry); - if( pViewData->aRect.IsInside( rDocPos ) ) - { - pTarget = pEntry; - break; - } - } - return pTarget; -} - -SvLBoxEntry* SvImpIconView::GetNextEntry( const Point& rDocPos, SvLBoxEntry* pCurEntry ) -{ - CheckBoundingRects(); - SvLBoxEntry* pTarget = 0; - sal_uInt16 nStartPos = pZOrderList->GetPos( (void*)pCurEntry ); - if( nStartPos != USHRT_MAX ) - { - sal_uInt16 nCount = pZOrderList->Count(); - for( sal_uInt16 nCur = nStartPos+1; nCur < nCount; nCur++ ) - { - SvLBoxEntry* pEntry = (SvLBoxEntry*)(pZOrderList->GetObject(nCur)); - SvIcnVwDataEntry* pViewData = ICNVIEWDATA(pEntry); - if( pViewData->aRect.IsInside( rDocPos ) ) - { - pTarget = pEntry; - break; - } - } - } - return pTarget; -} - -SvLBoxEntry* SvImpIconView::GetPrevEntry( const Point& rDocPos, SvLBoxEntry* pCurEntry ) -{ - CheckBoundingRects(); - SvLBoxEntry* pTarget = 0; - sal_uInt16 nStartPos = pZOrderList->GetPos( (void*)pCurEntry ); - if( nStartPos != USHRT_MAX && nStartPos != 0 ) - { - nStartPos--; - do - { - SvLBoxEntry* pEntry = (SvLBoxEntry*)(pZOrderList->GetObject(nStartPos)); - SvIcnVwDataEntry* pViewData = ICNVIEWDATA(pEntry); - if( pViewData->aRect.IsInside( rDocPos ) ) - { - pTarget = pEntry; - break; - } - } while( nStartPos > 0 ); - } - return pTarget; -} - - -Point SvImpIconView::GetEntryPosition( SvLBoxEntry* pEntry ) -{ - SvIcnVwDataEntry* pViewData = ICNVIEWDATA(pEntry); - DBG_ASSERT(pViewData,"Entry not in model"); - return pViewData->aRect.TopLeft(); -} - -const Rectangle& SvImpIconView::GetBoundingRect( SvLBoxEntry* pEntry, SvIcnVwDataEntry* pViewData ) -{ - if( !pViewData ) - pViewData = ICNVIEWDATA(pEntry); - DBG_ASSERT(pViewData,"Entry not in model"); - if( !IsBoundingRectValid( pViewData->aRect )) - FindBoundingRect( pEntry, pViewData ); - return pViewData->aRect; -} - -void SvImpIconView::SetSpaceBetweenEntries( long nHor, long nVer ) -{ - nHorDist = nHor; - nVerDist = nVer; -} - -Rectangle SvImpIconView::CalcBmpRect( SvLBoxEntry* pEntry, const Point* pPos, - SvIcnVwDataEntry* pViewData ) -{ - if( !pViewData ) - pViewData = ICNVIEWDATA(pEntry); - - Rectangle aBound = GetBoundingRect( pEntry, pViewData ); - if( pPos ) - aBound.SetPos( *pPos ); - Point aPos( aBound.TopLeft() ); - - switch( nViewMode ) - { - case VIEWMODE_ICON: - { - aPos.X() += ( aBound.GetWidth() - nMaxBmpWidth ) / 2; - Size aSize( nMaxBmpWidth, nMaxBmpHeight ); - // das Bitmap-Rechteck soll nicht das TextRect beruehren - aSize.Height() -= 3; - return Rectangle( aPos, aSize ); - } - - case VIEWMODE_NAME: - return Rectangle( aPos, - Size( nMaxBmpWidth, aBound.GetHeight() )); - - case VIEWMODE_TEXT: - return Rectangle( aPos, aBound.GetSize() ); - - default: - { - Rectangle aRect; - return aRect; - } - } -} - -Rectangle SvImpIconView::CalcTextRect( SvLBoxEntry* pEntry, - SvLBoxString* pItem, const Point* pPos, sal_Bool bForInplaceEdit, - SvIcnVwDataEntry* pViewData ) -{ - long nBmpHeight, nBmpWidth; - - if( !pItem ) - pItem = (SvLBoxString*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXSTRING)); - - if( !pViewData ) - pViewData = ICNVIEWDATA(pEntry); - - Size aTextSize( GetItemSize( pView, pEntry, pItem, pViewData )); - aTextSize.Width() += 2*LROFFS_TEXT; - - Size aContextBmpSize(pEntry->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP)->GetSize(pView,pEntry)); - Rectangle aBound = GetBoundingRect( pEntry, pViewData ); - if( pPos ) - aBound.SetPos( *pPos ); - Point aPos( aBound.TopLeft() ); - - switch( nViewMode ) - { - case VIEWMODE_ICON: - nBmpHeight = aContextBmpSize.Height(); - if( nBmpHeight < nMaxBmpHeight ) - nBmpHeight = nMaxBmpHeight; - aPos.Y() += nBmpHeight; - - // beim Inplace-Editieren, spendieren wir ein bisschen mehr Platz - if( bForInplaceEdit ) - { - // 20% rauf - long nMinWidth = (( (aContextBmpSize.Width()*10) / 100 ) * 2 ) + - aContextBmpSize.Width(); - if( nMinWidth > aBound.GetWidth() ) - nMinWidth = aBound.GetWidth(); - - if( aTextSize.Width() < nMinWidth ) - aTextSize.Width() = nMinWidth; - - // beim Inplace-Ed. darfs auch untere Eintraege ueberlappen - Rectangle aMaxGridTextRect = CalcMaxTextRect(pEntry, pViewData); - Size aOptSize = aMaxGridTextRect.GetSize(); - if( aOptSize.Height() > aTextSize.Height() ) - aTextSize.Height() = aOptSize.Height(); - } - - - aPos.X() += ( aBound.GetWidth() - aTextSize.Width() ) / 2; - break; - - case VIEWMODE_NAME: - nBmpWidth = aContextBmpSize.Width(); - if( nBmpWidth < nMaxBmpWidth ) - nBmpWidth = nMaxBmpWidth; - aPos.X() += nBmpWidth; - // vertikal ausrichten - aPos.Y() += ( nBmpWidth - aTextSize.Height() ) / 2; - break; - } - - Rectangle aRect( aPos, aTextSize ); -// KNALLT BEIM D&D, WENN GECLIPPT WIRD (In DrawText von Thomas) -// ClipAtVirtOutRect( aRect ); - return aRect; -} - - -long SvImpIconView::CalcBoundingWidth( SvLBoxEntry* pEntry, - const SvIcnVwDataEntry* pViewData ) const -{ - DBG_ASSERT(pEntry->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP),"No Bitmaps"); - DBG_ASSERT(pEntry->GetFirstItem(SV_ITEM_ID_LBOXSTRING),"No Text"); - long nStringWidth = GetItemSize( pView, pEntry, pEntry->GetFirstItem(SV_ITEM_ID_LBOXSTRING),pViewData).Width(); - nStringWidth += 2*LROFFS_TEXT; - long nBmpWidth = pEntry->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP)->GetSize(pView,pEntry).Width(); - long nWidth = 0; - - switch( nViewMode ) - { - case VIEWMODE_ICON: - nWidth = Max( nStringWidth, nBmpWidth ); - nWidth = Max( nWidth, nMaxBmpWidth ); - break; - - case VIEWMODE_NAME: - nWidth = Max( nBmpWidth, nMaxBmpWidth ); - nWidth += NAMEVIEW_OFFS_BMP_STRING; // Abstand Bitmap String - nWidth += nStringWidth; - break; - - case VIEWMODE_TEXT: - nWidth = nStringWidth; - break; - } - return nWidth; -} - -long SvImpIconView::CalcBoundingHeight( SvLBoxEntry* pEntry, - const SvIcnVwDataEntry* pViewData ) const -{ - DBG_ASSERT(pEntry->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP),"No Bitmaps"); - DBG_ASSERT(pEntry->GetFirstItem(SV_ITEM_ID_LBOXSTRING),"No Text"); - long nStringHeight = GetItemSize(pView,pEntry,pEntry->GetFirstItem(SV_ITEM_ID_LBOXSTRING),pViewData).Height(); - long nBmpHeight = pEntry->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP)->GetSize(pView,pEntry).Height(); - long nHeight = 0; - - switch( nViewMode ) - { - case VIEWMODE_ICON: - nHeight = Max( nBmpHeight, nMaxBmpHeight ); - nHeight += ICONVIEW_OFFS_BMP_STRING; // Abstand Bitmap String - nHeight += nStringHeight; - break; - - case VIEWMODE_NAME: - nHeight = Max( nBmpHeight, nMaxBmpHeight ); - nHeight = Max( nHeight, nStringHeight ); - break; - - case VIEWMODE_TEXT: - nHeight = nStringHeight; - break; - } - if( nHeight > nMaxBoundHeight ) - { - ((SvImpIconView*)this)->nMaxBoundHeight = nHeight; - ((SvImpIconView*)this)->aHorSBar.SetLineSize( nHeight / 2 ); - ((SvImpIconView*)this)->aVerSBar.SetLineSize( nHeight / 2 ); - } - return nHeight; -} - -Size SvImpIconView::CalcBoundingSize( SvLBoxEntry* pEntry, - SvIcnVwDataEntry* pViewData ) const -{ - if( !pViewData ) - pViewData = ICNVIEWDATA(pEntry); - return Size( CalcBoundingWidth(pEntry,pViewData), - CalcBoundingHeight(pEntry,pViewData) ); -} - -void SvImpIconView::RecalcAllBoundingRects() -{ - nMaxBoundHeight = 0; - pZOrderList->Remove(0, pZOrderList->Count() ); - SvLBoxEntry* pEntry = pModel->FirstChild( pCurParent ); - while( pEntry ) - { - FindBoundingRect( pEntry ); - pZOrderList->Insert( pEntry, pZOrderList->Count() ); - pEntry = pModel->NextSibling( pEntry ); - } - bMustRecalcBoundingRects = sal_False; - AdjustScrollBars(); -} - -void SvImpIconView::RecalcAllBoundingRectsSmart() -{ - nMaxBoundHeight = 0; - pZOrderList->Remove(0, pZOrderList->Count() ); - SvLBoxEntry* pEntry = pModel->FirstChild( pCurParent ); - while( pEntry ) - { - SvIcnVwDataEntry* pViewData = ICNVIEWDATA(pEntry); - if( IsBoundingRectValid( pViewData->aRect )) - { - Size aBoundSize( pViewData->aRect.GetSize() ); - if( aBoundSize.Height() > nMaxBoundHeight ) - nMaxBoundHeight = aBoundSize.Height(); - pZOrderList->Insert( pEntry, pZOrderList->Count() ); - } - else - { - FindBoundingRect( pEntry, pViewData ); - } - pZOrderList->Insert( pEntry, pZOrderList->Count() ); - pEntry = pModel->NextSibling( pEntry ); - } - AdjustScrollBars(); -} - -void SvImpIconView::UpdateBoundingRects() -{ - SvLBoxEntry* pEntry = pModel->FirstChild( pCurParent ); - while( pEntry ) - { - GetBoundingRect( pEntry ); - pEntry = pModel->NextSibling( pEntry ); - } -} - -void SvImpIconView::FindBoundingRect( SvLBoxEntry* pEntry, - SvIcnVwDataEntry* pViewData ) -{ - if( !pViewData ) - pViewData = ICNVIEWDATA(pEntry); - - Size aSize( CalcBoundingSize( pEntry, pViewData ) ); - Point aPos; - - DBG_ASSERT(!pViewData->IsEntryPosLocked(),"Locked entry pos in FindBoundingRect"); - // damits in der IconView nicht drunter & drueber geht - if( pViewData->IsEntryPosLocked() && IsBoundingRectValid(pViewData->aRect) ) - { - AdjustVirtSize( pViewData->aRect ); - return; - } - - aPos = FindNextEntryPos( aSize ); - - if( nFlags & F_GRIDMODE ) - { - Rectangle aGridRect( aPos, Size(nGridDX, nGridDY) ); - pViewData->aGridRect = aGridRect; - Center( pEntry, pViewData ); - AdjustVirtSize( pViewData->aRect ); - pImpCursor->SetGridUsed( pViewData->aRect ); - } - else - { - pViewData->aRect = Rectangle( aPos, aSize ); - AdjustVirtSize( pViewData->aRect ); - } -} - - -void SvImpIconView::SetCursor( SvLBoxEntry* pEntry ) -{ - if( pEntry == pCursor ) - return; - - ShowCursor( sal_False ); - if( pCursor ) - { - pView->SetEntryFocus( pCursor, sal_False ); - if( pView->GetSelectionMode() == SINGLE_SELECTION ) - pView->Select( pCursor, sal_False ); - } - pCursor = pEntry; - ToTop( pCursor ); - if( pCursor ) - { - pView->SetEntryFocus(pCursor, sal_True ); - if( pView->GetSelectionMode() == SINGLE_SELECTION ) - pView->Select( pCursor, sal_True ); - ShowCursor( sal_True ); - } -} - - -void SvImpIconView::ShowCursor( sal_Bool bShow ) -{ - if( !pCursor || !bShow || !pView->HasFocus() ) - { - pView->HideFocus(); - return; - } - Rectangle aRect ( CalcFocusRect( pCursor ) ); - pView->ShowFocus( aRect ); -} - - -void SvImpIconView::HideDDIcon() -{ - pView->Update(); - ImpHideDDIcon(); - pDDBufDev = pDDDev; - pDDDev = 0; -} - -void SvImpIconView::ImpHideDDIcon() -{ - if( pDDDev ) - { - Size aSize( pDDDev->GetOutputSizePixel() ); - // pView restaurieren - pView->DrawOutDev( aDDLastRectPos, aSize, Point(), aSize, *pDDDev ); - } -} - - -void SvImpIconView::ShowDDIcon( SvLBoxEntry* pRefEntry, const Point& rPosPix ) -{ - pView->Update(); - if( pRefEntry != pDDRefEntry ) - { - DELETEZ(pDDDev); - DELETEZ(pDDBufDev); - } - sal_Bool bSelected = pView->SvListView::Select( pRefEntry, sal_False ); - if( !pDDDev ) - { - if( pDDBufDev ) - { - // nicht bei jedem Move ein Device anlegen, da dies besonders - // auf Remote-Clients zu langsam ist - pDDDev = pDDBufDev; - pDDBufDev = 0; - } - else - { - pDDDev = new VirtualDevice( *pView ); - pDDDev->SetFont( pView->GetFont() ); - } - } - else - { - ImpHideDDIcon(); - } - const Rectangle& rRect = GetBoundingRect( pRefEntry ); - pDDDev->SetOutputSizePixel( rRect.GetSize() ); - - Point aPos( rPosPix ); - CalcDocPos( aPos ); - - Size aSize( pDDDev->GetOutputSizePixel() ); - pDDRefEntry = pRefEntry; - aDDLastEntryPos = aPos; - aDDLastRectPos = aPos; - - // Hintergrund sichern - pDDDev->DrawOutDev( Point(), aSize, aPos, aSize, *pView ); - // Icon in pView malen - nFlags |= F_NO_EMPHASIS; - PaintEntry( pRefEntry, aPos ); - nFlags &= ~F_NO_EMPHASIS; - if( bSelected ) - pView->SvListView::Select( pRefEntry, sal_True ); -} - -void SvImpIconView::HideShowDDIcon( SvLBoxEntry* pRefEntry, const Point& rPosPix ) -{ -/* In Notfaellen folgenden flackernden Code aktivieren: - - HideDDIcon(); - ShowDDIcon( pRefEntry, rPosPix ); - return; -*/ - if( !pDDDev ) - { - ShowDDIcon( pRefEntry, rPosPix ); - return; - } - - if( pRefEntry != pDDRefEntry ) - { - HideDDIcon(); - ShowDDIcon( pRefEntry, rPosPix ); - return; - } - - Point aEmptyPoint; - - Point aCurEntryPos( rPosPix ); - CalcDocPos( aCurEntryPos ); - - const Rectangle& rRect = GetBoundingRect( pRefEntry ); - Size aEntrySize( rRect.GetSize() ); - Rectangle aPrevEntryRect( aDDLastEntryPos, aEntrySize ); - Rectangle aCurEntryRect( aCurEntryPos, aEntrySize ); - - if( !aPrevEntryRect.IsOver( aCurEntryRect ) ) - { - HideDDIcon(); - ShowDDIcon( pRefEntry, rPosPix ); - return; - } - - // Ueberlappung des neuen und alten D&D-Pointers! - - Rectangle aFullRect( aPrevEntryRect.Union( aCurEntryRect ) ); - if( !pDDTempDev ) - { - pDDTempDev = new VirtualDevice( *pView ); - pDDTempDev->SetFont( pView->GetFont() ); - } - - Size aFullSize( aFullRect.GetSize() ); - Point aFullPos( aFullRect.TopLeft() ); - - pDDTempDev->SetOutputSizePixel( aFullSize ); - - // Hintergrund (mit dem alten D&D-Pointer!) sichern - pDDTempDev->DrawOutDev( aEmptyPoint, aFullSize, aFullPos, aFullSize, *pView ); - // den alten Buffer in den neuen Buffer pasten - aDDLastRectPos = aDDLastRectPos - aFullPos; - - pDDTempDev->DrawOutDev( - aDDLastRectPos, - pDDDev->GetOutputSizePixel(), - aEmptyPoint, - pDDDev->GetOutputSizePixel(), - *pDDDev ); - - // Swap - VirtualDevice* pTemp = pDDDev; - pDDDev = pDDTempDev; - pDDTempDev = pTemp; - - // in den restaurierten Hintergrund den neuen D&D-Pointer zeichnen - pDDTempDev->SetOutputSizePixel( pDDDev->GetOutputSizePixel() ); - pDDTempDev->DrawOutDev( - aEmptyPoint, aFullSize, aEmptyPoint, aFullSize, *pDDDev ); - Point aRelPos = aCurEntryPos - aFullPos; - nFlags |= F_NO_EMPHASIS; - PaintEntry( pRefEntry, aRelPos, 0, pDDTempDev ); - nFlags &= ~F_NO_EMPHASIS; - - aDDLastRectPos = aFullPos; - aDDLastEntryPos = aCurEntryPos; - - pView->DrawOutDev( - aDDLastRectPos, - pDDDev->GetOutputSizePixel(), - aEmptyPoint, - pDDDev->GetOutputSizePixel(), - *pDDTempDev ); - - sal_Bool bSelected = pView->SvListView::Select( pRefEntry, sal_False ); - if( bSelected ) - pView->SvListView::Select( pRefEntry, sal_True ); -} - -void SvImpIconView::ShowTargetEmphasis( SvLBoxEntry* pEntry, sal_Bool ) -{ - CheckBoundingRects(); - Rectangle aRect; - if( pEntry != pCurParent && - (pEntry->HasChilds() || pEntry->HasChildsOnDemand()) ) - aRect = CalcBmpRect( pEntry ); - else - { - aRect.SetSize( aOutputSize ); - const MapMode& rMapMode = pView->GetMapMode(); - Point aOrigin( rMapMode.GetOrigin()); - aOrigin *= -1; // in Doc-Koord wandeln - aRect.SetPos( aOrigin ); - aRect.Left()++; aRect.Top()++; - aRect.Right()--; aRect.Bottom()--; - } - ImpDrawXORRect( aRect ); -} - -sal_Bool SvImpIconView::NotifyMoving( SvLBoxEntry* pTarget, SvLBoxEntry* pEntry, - SvLBoxEntry*& rpNewPar, sal_uLong& rNewChildPos ) -{ - if( pTarget == pCurParent && pModel->GetParent(pEntry) == pCurParent ) - { - // D&D innerhalb einer Childlist - StopEditTimer(); - SvIcnVwDataEntry* pViewData = ICNVIEWDATA(pEntry); - Size aSize( pViewData->aRect.GetSize() ); - Point aNewPos = FindNextEntryPos( aSize ); - AdjustVirtSize( Rectangle( aNewPos, aSize ) ); - SetEntryPosition( pEntry, aNewPos, sal_False, sal_True ); - return sal_False; - } - return pView->SvLBox::NotifyMoving(pTarget,pEntry,rpNewPar,rNewChildPos); -} - -sal_Bool SvImpIconView::NotifyCopying( SvLBoxEntry* pTarget, SvLBoxEntry* pEntry, - SvLBoxEntry*& rpNewParent, sal_uLong& rNewChildPos ) -{ - return pView->SvLBox::NotifyCopying(pTarget,pEntry,rpNewParent,rNewChildPos); -} - -void SvImpIconView::WriteDragServerInfo( const Point& rPos, SvLBoxDDInfo* pInfo) -{ - SvLBoxEntry* pCurEntry = GetCurEntry(); - Point aEntryPos; - if( pCurEntry ) - { - aEntryPos = rPos; - aEntryPos -= GetEntryPosition( pCurEntry ); - } - pInfo->nMouseRelX = aEntryPos.X(); - pInfo->nMouseRelY = aEntryPos.Y(); -} - -void SvImpIconView::ReadDragServerInfo( const Point& rPos, SvLBoxDDInfo* pInfo ) -{ - Point aDropPos( rPos ); - aDropPos.X() -= pInfo->nMouseRelX; - aDropPos.Y() -= pInfo->nMouseRelY; - SetNextEntryPos( aDropPos ); -} - -void SvImpIconView::InvalidateBoundingRect( SvLBoxEntry* pEntry ) -{ - SvIcnVwDataEntry* pViewData = ICNVIEWDATA(pEntry); - InvalidateBoundingRect( pViewData->aRect ); -} - -void SvImpIconView::PrepareCommandEvent( const Point& rPt ) -{ - aMouseMoveTimer.Stop(); - StopEditTimer(); - nFlags |= F_CMD_ARRIVED; - SvLBoxEntry* pEntry = pView->GetEntry( rPt, sal_True ); - if( (nFlags & F_DOWN_CTRL) && pEntry && !pView->IsSelected(pEntry) ) - pView->Select( pEntry, sal_True ); - nFlags &= ~(F_DOWN_CTRL | F_DOWN_DESELECT); -} - -void SvImpIconView::SttDrag( const Point& rPos ) -{ - PrepareCommandEvent( rPos ); - - nFlags |= F_DRAG_SOURCE; - ShowCursor( sal_False ); -} - -void SvImpIconView::EndDrag() -{ - ShowCursor( sal_True ); - nFlags &= (~F_DRAG_SOURCE); -} - -void SvImpIconView::ToTop( SvLBoxEntry* pEntry ) -{ - DBG_ASSERT(pZOrderList->GetPos(pEntry)!=0xffff,"ToTop:ZOrder?"); - if( pZOrderList->GetObject( pZOrderList->Count() -1 ) != pEntry ) - { - sal_uInt16 nPos = pZOrderList->GetPos( (void*)pEntry ); - pZOrderList->Remove( nPos, 1 ); - pZOrderList->Insert( pEntry, pZOrderList->Count() ); - } -} - -void SvImpIconView::SetCurParent( SvLBoxEntry* pNewParent ) -{ - Clear(); - pCurParent = pNewParent; - ImpArrange(); -} - -void SvImpIconView::ClipAtVirtOutRect( Rectangle& rRect ) const -{ - if( rRect.Bottom() >= aVirtOutputSize.Height() ) - rRect.Bottom() = aVirtOutputSize.Height() - 1; - if( rRect.Right() >= aVirtOutputSize.Width() ) - rRect.Right() = aVirtOutputSize.Width() - 1; - if( rRect.Top() < 0 ) - rRect.Top() = 0; - if( rRect.Left() < 0 ) - rRect.Left() = 0; -} - -// rRect: Bereich des Dokumentes (in Dokumentkoordinaten), der -// sichtbar gemacht werden soll. -// bScrBar == sal_True: Das Rect wurde aufgrund eines ScrollBar-Events berechnet - -void SvImpIconView::MakeVisible( const Rectangle& rRect, sal_Bool bScrBar ) -{ - Rectangle aRect( rRect ); - ClipAtVirtOutRect( aRect ); - MapMode aMapMode( pView->GetMapMode() ); - Point aOrigin( aMapMode.GetOrigin() ); - // in Dokumentkoordinate umwandeln - aOrigin *= -1; - - Rectangle aOutputArea( aOrigin, aOutputSize ); - if( aOutputArea.IsInside( aRect ) ) - return; // ist schon sichtbar - - long nDy; - if( aRect.Top() < aOutputArea.Top() ) - { - // nach oben scrollen (nDy < 0) - nDy = aRect.Top() - aOutputArea.Top(); - } - else if( aRect.Bottom() > aOutputArea.Bottom() ) - { - // nach unten scrollen (nDy > 0) - nDy = aRect.Bottom() - aOutputArea.Bottom(); - } - else - nDy = 0; - - long nDx; - if( aRect.Left() < aOutputArea.Left() ) - { - // nach links scrollen (nDx < 0) - nDx = aRect.Left() - aOutputArea.Left(); - } - else if( aRect.Right() > aOutputArea.Right() ) - { - // nach rechts scrollen (nDx > 0) - nDx = aRect.Right() - aOutputArea.Right(); - } - else - nDx = 0; - - aOrigin.X() += nDx; - aOrigin.Y() += nDy; - aOutputArea.SetPos( aOrigin ); - - pView->Update(); - - // Origin fuer SV invertieren (damit wir in - // Dokumentkoordinaten scrollen/painten koennen) - aOrigin *= -1; - aMapMode.SetOrigin( aOrigin ); - pView->SetMapMode( aMapMode ); - - // in umgekehrte Richtung scrollen! - pView->Control::Scroll( -nDx, -nDy, aOutputArea, sal_True ); - if( aHorSBar.IsVisible() || aVerSBar.IsVisible() ) - { - if( !bScrBar ) - { - aOrigin *= -1; - // Thumbs korrigieren - if(aHorSBar.IsVisible() && aHorSBar.GetThumbPos() != aOrigin.X()) - aHorSBar.SetThumbPos( aOrigin.X() ); - if(aVerSBar.IsVisible() && aVerSBar.GetThumbPos() != aOrigin.Y()) - aVerSBar.SetThumbPos( aOrigin.Y() ); - } - } - // pruefen, ob ScrollBars noch benoetigt werden - CheckScrollBars(); - pView->Update(); -} - - -SvLBoxEntry* SvImpIconView::GetNewCursor() -{ - SvLBoxEntry* pNewCursor; - if( pCursor ) - { - pNewCursor = pImpCursor->GoLeftRight( pCursor, sal_False ); - if( !pNewCursor ) - { - pNewCursor = pImpCursor->GoLeftRight( pCursor, sal_True ); - if( !pNewCursor ) - { - pNewCursor = pImpCursor->GoUpDown( pCursor, sal_False ); - if( !pNewCursor ) - pNewCursor = pImpCursor->GoUpDown( pCursor, sal_True ); - } - } - } - else - pNewCursor = pModel->FirstChild( pCurParent ); - DBG_ASSERT(!pNewCursor|| (pCursor&&pCursor!=pNewCursor),"GetNewCursor failed"); - return pNewCursor; -} - - -sal_uInt16 SvImpIconView:: GetSelectionCount() const -{ - sal_uInt16 nSelected = 0; - SvLBoxEntry* pEntry = pModel->FirstChild( pCurParent); - while( pEntry ) - { - if( pView->IsSelected( pEntry ) ) - nSelected++; - pEntry = pModel->NextSibling( pEntry ); - } - return nSelected; -} - - -void SvImpIconView::ToggleSelection( SvLBoxEntry* pEntry ) -{ - sal_Bool bSel; - if( pView->IsSelected( pEntry ) ) - bSel = sal_False; - else - bSel = sal_True; - pView->Select( pEntry, bSel ); -} - -void SvImpIconView::DeselectAllBut( SvLBoxEntry* pThisEntryNot ) -{ - ClearSelectedRectList(); - SvLBoxEntry* pEntry = pModel->FirstChild( pCurParent ); - while( pEntry ) - { - if( pEntry != pThisEntryNot && pView->IsSelected( pEntry )) - pView->Select( pEntry, sal_False ); - pEntry = pModel->NextSibling( pEntry ); - } -} - -#define ICN_ROWS 50 -#define ICN_COLS 30 - -ImpIcnCursor::ImpIcnCursor( SvImpIconView* pOwner ) -{ - pView = pOwner; - pColumns = 0; - pRows = 0; - pCurEntry = 0; - nDeltaWidth = 0; - nDeltaHeight= 0; - nCols = 0; - nRows = 0; - nGridCols = 0; - nGridRows = 0; - pGridMap = 0; -} - -ImpIcnCursor::~ImpIcnCursor() -{ - delete[] pColumns; - delete[] pRows; - delete pGridMap; -} - -sal_uInt16 ImpIcnCursor::GetSortListPos( SvPtrarr* pList, long nValue, - int bVertical ) -{ - sal_uInt16 nCount = (sal_uInt16)pList->Count(); - if( !nCount ) - return 0; - - sal_uInt16 nCurPos = 0; - long nPrevValue = LONG_MIN; - while( nCount ) - { - const Rectangle& rRect= - pView->GetBoundingRect((SvLBoxEntry*)(pList->GetObject(nCurPos))); - long nCurValue; - if( bVertical ) - nCurValue = rRect.Top(); - else - nCurValue = rRect.Left(); - if( nValue >= nPrevValue && nValue <= nCurValue ) - return (sal_uInt16)nCurPos; - nPrevValue = nCurValue; - nCount--; - nCurPos++; - } - return pList->Count(); -} - -void ImpIcnCursor::ImplCreate() -{ - pView->CheckBoundingRects(); - DBG_ASSERT(pColumns==0&&pRows==0,"ImplCreate: Not cleared"); - - SetDeltas(); - - pColumns = new SvPtrarr[ nCols ]; - pRows = new SvPtrarr[ nRows ]; - - DELETEZ(pGridMap); - - SvLBoxTreeList* pModel = pView->pModel; - SvLBoxEntry* pEntry = pModel->FirstChild( pView->pCurParent ); - while( pEntry ) - { - SvIcnVwDataEntry* pViewData = ICNVIEWDATA2(pEntry); - // const Rectangle& rRect = pView->GetBoundingRect( pEntry ); - Rectangle rRect( pView->CalcBmpRect( pEntry,0,pViewData ) ); - short nY = (short)( ((rRect.Top()+rRect.Bottom())/2) / nDeltaHeight ); - short nX = (short)( ((rRect.Left()+rRect.Right())/2) / nDeltaWidth ); - - // Rundungsfehler abfangen - if( nY >= nRows ) - nY = sal::static_int_cast< short >(nRows - 1); - if( nX >= nCols ) - nX = sal::static_int_cast< short >(nCols - 1); - - sal_uInt16 nIns = GetSortListPos( &pColumns[nX], rRect.Top(), sal_True ); - pColumns[ nX ].Insert( pEntry, nIns ); - - nIns = GetSortListPos( &pRows[nY], rRect.Left(), sal_False ); - pRows[ nY ].Insert( pEntry, nIns ); - - pViewData->nX = nX; - pViewData->nY = nY; - - pEntry = pModel->NextSibling( pEntry ); - } -} - -void ImpIcnCursor::CreateGridMap() -{ - if( pGridMap ) - return; - - const Size& rSize = pView->aVirtOutputSize; - long nWidth = rSize.Width(); - if( nWidth < pView->nMaxVirtWidth ) - nWidth = pView->nMaxVirtWidth; - nWidth -= 2*LROFFS_WINBORDER; - if( nWidth <= 0 ) - nWidth = 1; - - nGridDX = pView->nGridDX; - nGridDY = pView->nGridDY; - - // Hinweis: Wegen der Abrundung bei Berechnung von nGridCols - // ist es moeglich, dass Eintrage nicht im Grid liegen. Diese - // wurden typischerweise manuell verschoben und gelockt - nGridCols = nWidth / nGridDX; - if( !nGridCols ) nGridCols = 1; - - nGridRows = rSize.Height() / nGridDY; - // nRows nicht abrunden, da zur Vermeidung von Ueberlappungen - // das gesamte BoundingRect des Eintrags zur Markierung im Grid - // herangezogen wird. - if( (nGridRows * nGridDY) < rSize.Height() ) - nGridRows++; - else if( !nGridRows ) - nGridRows = 1; - - //XXX - //nGridRows += 50; // in fuenfziger-Schritten - - pGridMap = new sal_Bool[ nGridRows*nGridCols]; - memset( (void*)pGridMap, 0, nGridRows*nGridCols ); - - SvLBoxTreeList* pModel = pView->pModel; - SvLBoxEntry* pEntry = pModel->FirstChild( pView->pCurParent ); - while( pEntry ) - { - SvIcnVwDataEntry* pViewData = ICNVIEWDATA2(pEntry); - const Rectangle& rRect = pViewData->aRect; - // nur, wenn der Entry schon plaziert ist - if( pView->IsBoundingRectValid( rRect )) - { - // Alle vom Eintrag beruehrten Grids kennzeichnen - SetGridUsed( pView->GetBoundingRect( pEntry, pViewData ) ); - } - pEntry = pModel->NextSibling( pEntry ); - } -} - -sal_Bool ImpIcnCursor::GetGrid( const Point& rDocPos, sal_uInt16& rGridX, sal_uInt16& rGridY ) const -{ - Point aPos( rDocPos ); - aPos.X() -= LROFFS_WINBORDER; - aPos.Y() -= TBOFFS_WINBORDER; - rGridX = (sal_uInt16)(aPos.X() / nGridDX); - rGridY = (sal_uInt16)(aPos.Y() / nGridDY); - sal_Bool bInGrid = sal_True; - if( rGridX >= nGridCols ) - { - rGridX = sal::static_int_cast< sal_uInt16 >(nGridCols - 1); - bInGrid = sal_False; - } - if( rGridY >= nGridRows ) - { - rGridY = sal::static_int_cast< sal_uInt16 >(nGridRows - 1); - if( !bInGrid ) - return sal_False; // beide Koordinaten nicht im Grid - } - return sal_True; -} - -void ImpIcnCursor::SetGridUsed( const Rectangle& rRect, sal_Bool bUsed ) -{ - CreateGridMap(); - sal_uInt16 nTLX, nTLY, nBRX, nBRY; - - sal_Bool bTLInGrid = GetGrid( rRect.TopLeft(), nTLX, nTLY ); - sal_Bool bBRInGrid = GetGrid( rRect.BottomRight(), nBRX, nBRY ); - - if( !bTLInGrid && !bBRInGrid ) - return; - - for( sal_uInt16 nCurY = nTLY; nCurY <= nBRY; nCurY++ ) - { - for( sal_uInt16 nCurX = nTLX; nCurX <= nBRX; nCurX++ ) - { - SetGridUsed( nCurX, nCurY, bUsed ); - } - } -} - -void ImpIcnCursor::Clear( sal_Bool bGridToo ) -{ - if( pColumns ) - { - delete[] pColumns; - delete[] pRows; - pColumns = 0; - pRows = 0; - pCurEntry = 0; - nDeltaWidth = 0; - nDeltaHeight = 0; - } - if( bGridToo && pGridMap ) - { - DELETEZ(pGridMap); - nGridRows = 0; - nGridCols = 0; - } -} - -SvLBoxEntry* ImpIcnCursor::SearchCol(sal_uInt16 nCol,sal_uInt16 nTop,sal_uInt16 nBottom, - sal_uInt16, sal_Bool bDown, sal_Bool bSimple ) -{ - DBG_ASSERT(pCurEntry,"SearchCol: No reference entry"); - SvPtrarr* pList = &(pColumns[ nCol ]); - sal_uInt16 nCount = pList->Count(); - if( !nCount ) - return 0; - - const Rectangle& rRefRect = pView->GetBoundingRect(pCurEntry); - - if( bSimple ) - { - sal_uInt16 nListPos = pList->GetPos( pCurEntry ); - DBG_ASSERT(nListPos!=0xffff,"Entry not in Col-List"); - if( bDown ) - { - while( nListPos < nCount-1 ) - { - nListPos++; - SvLBoxEntry* pEntry = (SvLBoxEntry*)pList->GetObject( nListPos ); - const Rectangle& rRect = pView->GetBoundingRect( pEntry ); - if( rRect.Top() > rRefRect.Top() ) - return pEntry; - } - return 0; - } - else - { - while( nListPos ) - { - nListPos--; - if( nListPos < nCount ) - { - SvLBoxEntry* pEntry = (SvLBoxEntry*)pList->GetObject( nListPos ); - const Rectangle& rRect = pView->GetBoundingRect( pEntry ); - if( rRect.Top() < rRefRect.Top() ) - return pEntry; - } - } - return 0; - } - } - - if( nTop > nBottom ) - { - sal_uInt16 nTemp = nTop; - nTop = nBottom; - nBottom = nTemp; - } - long nMinDistance = LONG_MAX; - SvLBoxEntry* pResult = 0; - for( sal_uInt16 nCur = 0; nCur < nCount; nCur++ ) - { - SvLBoxEntry* pEntry = (SvLBoxEntry*)(pList->GetObject( nCur )); - if( pEntry != pCurEntry ) - { - SvIcnVwDataEntry* pViewData = ICNVIEWDATA2(pEntry); - sal_uInt16 nY = pViewData->nY; - if( nY >= nTop && nY <= nBottom ) - { - const Rectangle& rRect = pView->GetBoundingRect( pEntry ); - long nDistance = rRect.Top() - rRefRect.Top(); - if( nDistance < 0 ) - nDistance *= -1; - if( nDistance && nDistance < nMinDistance ) - { - nMinDistance = nDistance; - pResult = pEntry; - } - } - } - } - return pResult; -} - -SvLBoxEntry* ImpIcnCursor::SearchRow(sal_uInt16 nRow,sal_uInt16 nLeft,sal_uInt16 nRight, - sal_uInt16, sal_Bool bRight, sal_Bool bSimple ) -{ - DBG_ASSERT(pCurEntry,"SearchRow: No reference entry"); - SvPtrarr* pList = &(pRows[ nRow ]); - sal_uInt16 nCount = pList->Count(); - if( !nCount ) - return 0; - - const Rectangle& rRefRect = pView->GetBoundingRect(pCurEntry); - - if( bSimple ) - { - sal_uInt16 nListPos = pList->GetPos( pCurEntry ); - DBG_ASSERT(nListPos!=0xffff,"Entry not in Row-List"); - if( bRight ) - { - while( nListPos < nCount-1 ) - { - nListPos++; - SvLBoxEntry* pEntry = (SvLBoxEntry*)pList->GetObject( nListPos ); - const Rectangle& rRect = pView->GetBoundingRect( pEntry ); - if( rRect.Left() > rRefRect.Left() ) - return pEntry; - } - return 0; - } - else - { - while( nListPos ) - { - nListPos--; - if( nListPos < nCount ) - { - SvLBoxEntry* pEntry = (SvLBoxEntry*)pList->GetObject( nListPos ); - const Rectangle& rRect = pView->GetBoundingRect( pEntry ); - if( rRect.Left() < rRefRect.Left() ) - return pEntry; - } - } - return 0; - } - - } - if( nRight < nLeft ) - { - sal_uInt16 nTemp = nRight; - nRight = nLeft; - nLeft = nTemp; - } - long nMinDistance = LONG_MAX; - SvLBoxEntry* pResult = 0; - for( sal_uInt16 nCur = 0; nCur < nCount; nCur++ ) - { - SvLBoxEntry* pEntry = (SvLBoxEntry*)(pList->GetObject( nCur )); - if( pEntry != pCurEntry ) - { - SvIcnVwDataEntry* pViewData = ICNVIEWDATA2(pEntry); - sal_uInt16 nX = pViewData->nX; - if( nX >= nLeft && nX <= nRight ) - { - const Rectangle& rRect = pView->GetBoundingRect( pEntry ); - long nDistance = rRect.Left() - rRefRect.Left(); - if( nDistance < 0 ) - nDistance *= -1; - if( nDistance && nDistance < nMinDistance ) - { - nMinDistance = nDistance; - pResult = pEntry; - } - } - } - } - return pResult; -} - - - -/* - Sucht ab dem uebergebenen Eintrag den naechsten rechts- bzw. - linksstehenden. Suchverfahren am Beispiel bRight = sal_True: - - c - b c - a b c - S 1 1 1 ====> Suchrichtung - a b c - b c - c - - S : Startposition - 1 : erstes Suchrechteck - a,b,c : 2., 3., 4. Suchrechteck -*/ - -SvLBoxEntry* ImpIcnCursor::GoLeftRight( SvLBoxEntry* pIcnEntry, sal_Bool bRight ) -{ - SvLBoxEntry* pResult; - pCurEntry = pIcnEntry; - Create(); - SvIcnVwDataEntry* pViewData = ICNVIEWDATA2(pIcnEntry); - sal_uInt16 nY = pViewData->nY; - sal_uInt16 nX = pViewData->nX; - DBG_ASSERT(nY< nRows,"GoLeftRight:Bad column"); - DBG_ASSERT(nX< nCols,"GoLeftRight:Bad row"); - // Nachbar auf gleicher Zeile ? - if( bRight ) - pResult = SearchRow( - nY, nX, sal::static_int_cast< sal_uInt16 >(nCols-1), nX, sal_True, sal_True ); - else - pResult = SearchRow( nY, nX ,0, nX, sal_False, sal_True ); - if( pResult ) - return pResult; - - long nCurCol = nX; - - long nColOffs, nLastCol; - if( bRight ) - { - nColOffs = 1; - nLastCol = nCols; - } - else - { - nColOffs = -1; - nLastCol = -1; // 0-1 - } - - sal_uInt16 nRowMin = nY; - sal_uInt16 nRowMax = nY; - do - { - SvLBoxEntry* pEntry = SearchCol((sal_uInt16)nCurCol,nRowMin,nRowMax,nY,sal_True, sal_False); - if( pEntry ) - return pEntry; - if( nRowMin ) - nRowMin--; - if( nRowMax < (nRows-1)) - nRowMax++; - nCurCol += nColOffs; - } while( nCurCol != nLastCol ); - return 0; -} - -SvLBoxEntry* ImpIcnCursor::GoUpDown( SvLBoxEntry* pIcnEntry, sal_Bool bDown) -{ - SvLBoxEntry* pResult; - pCurEntry = pIcnEntry; - Create(); - SvIcnVwDataEntry* pViewData = ICNVIEWDATA2(pIcnEntry); - sal_uInt16 nY = pViewData->nY; - sal_uInt16 nX = pViewData->nX; - DBG_ASSERT(nY<nRows,"GoUpDown:Bad column"); - DBG_ASSERT(nX<nCols,"GoUpDown:Bad row"); - - // Nachbar in gleicher Spalte ? - if( bDown ) - pResult = SearchCol( - nX, nY, sal::static_int_cast< sal_uInt16 >(nRows-1), nY, sal_True, sal_True ); - else - pResult = SearchCol( nX, nY ,0, nY, sal_False, sal_True ); - if( pResult ) - return pResult; - - long nCurRow = nY; - - long nRowOffs, nLastRow; - if( bDown ) - { - nRowOffs = 1; - nLastRow = nRows; - } - else - { - nRowOffs = -1; - nLastRow = -1; // 0-1 - } - - sal_uInt16 nColMin = nX; - sal_uInt16 nColMax = nX; - do - { - SvLBoxEntry* pEntry = SearchRow((sal_uInt16)nCurRow,nColMin,nColMax,nX,sal_True, sal_False); - if( pEntry ) - return pEntry; - if( nColMin ) - nColMin--; - if( nColMax < (nCols-1)) - nColMax++; - nCurRow += nRowOffs; - } while( nCurRow != nLastRow ); - return 0; -} - -void ImpIcnCursor::SetDeltas() -{ - const Size& rSize = pView->aVirtOutputSize; - if( pView->nFlags & F_GRIDMODE ) - { - nGridDX = pView->nGridDX; - nGridDY = pView->nGridDY; - } - else - { - nGridDX = 20; - nGridDY = 20; - } - nCols = rSize.Width() / nGridDX; - if( !nCols ) - nCols = 1; - nRows = rSize.Height() / nGridDY; - if( (nRows * nGridDY) < rSize.Height() ) - nRows++; - if( !nRows ) - nRows = 1; - - nDeltaWidth = (short)(rSize.Width() / nCols); - nDeltaHeight = (short)(rSize.Height() / nRows); - if( !nDeltaHeight ) - { - nDeltaHeight = 1; - DBG_WARNING("SetDeltas:Bad height"); - } - if( !nDeltaWidth ) - { - nDeltaWidth = 1; - DBG_WARNING("SetDeltas:Bad width"); - } -} - -sal_Bool ImpIcnCursor::FindEmptyGridRect( Rectangle& rRect ) -{ - CreateGridMap(); - sal_uInt16 nCount = (sal_uInt16)(nGridCols * nGridRows); - if( !nCount ) - return sal_False; - for( sal_uInt16 nCur = 0; nCur < nCount; nCur++ ) - { - if( !pGridMap[ nCur ] ) - { - sal_uInt16 nCol = (sal_uInt16)(nCur % nGridCols); - sal_uInt16 nRow = (sal_uInt16)(nCur / nGridCols); - rRect.Top() = nRow * nGridDY + TBOFFS_WINBORDER; - rRect.Bottom() = rRect.Top() + nGridDY; - rRect.Left() = nCol * nGridDX+ LROFFS_WINBORDER; - rRect.Right() = rRect.Left() + nGridDX; - SetGridUsed( nCol, nRow, sal_True ); - - DBG_ASSERT(pGridMap[nCur],"SetGridUsed failed"); - return sal_True; - } - } - // Gridmap ist voll: Um eine Zeile erweitern - rRect.Top() = nGridRows * nGridDY + TBOFFS_WINBORDER; - rRect.Bottom() = rRect.Top() + nGridDY; - rRect.Left() = LROFFS_WINBORDER; - rRect.Right() = rRect.Left() + nGridDX; - return sal_False; -} - -void ImpIcnCursor::CreateGridAjustData( SvPtrarr& rLists, SvLBoxEntry* pRefEntry) -{ - if( !pRefEntry ) - { - sal_uInt16 nAdjustRows = (sal_uInt16)(pView->aVirtOutputSize.Height() / pView->nGridDY); - nAdjustRows++; // wg. Abrundung! - - if( !nAdjustRows ) - return; - for( sal_uInt16 nCurList = 0; nCurList < nAdjustRows; nCurList++ ) - { - SvPtrarr* pRow = new SvPtrarr; - rLists.Insert( (void*)pRow, nCurList ); - } - SvLBoxEntry* pEntry = pView->pModel->FirstChild( pView->pCurParent ); - while( pEntry ) - { - const Rectangle& rRect = pView->GetBoundingRect( pEntry ); - short nY = (short)( ((rRect.Top()+rRect.Bottom())/2) / pView->nGridDY ); - sal_uInt16 nIns = GetSortListPos((SvPtrarr*)rLists[nY],rRect.Left(),sal_False); - ((SvPtrarr*)rLists[ nY ])->Insert( pEntry, nIns ); - pEntry = pView->pModel->NextSibling( pEntry ); - } - } - else - { - // Aufbau eines hor. "Schlauchs" auf der RefEntry-Zeile - - // UEBERLEGEN: BoundingRect nehmen wg. Ueberlappungen??? - - Rectangle rRefRect( pView->CalcBmpRect( pRefEntry ) ); - //const Rectangle& rRefRect = pView->GetBoundingRect( pRefEntry ); - short nRefRow = (short)( ((rRefRect.Top()+rRefRect.Bottom())/2) / pView->nGridDY ); - SvPtrarr* pRow = new SvPtrarr; - rLists.Insert( (void*)pRow, 0 ); - SvLBoxEntry* pEntry = pView->pModel->FirstChild( pView->pCurParent ); - while( pEntry ) - { - Rectangle rRect( pView->CalcBmpRect(pEntry) ); - //const Rectangle& rRect = pView->GetBoundingRect( pEntry ); - short nY = (short)( ((rRect.Top()+rRect.Bottom())/2) / pView->nGridDY ); - if( nY == nRefRow ) - { - sal_uInt16 nIns = GetSortListPos( pRow, rRect.Left(), sal_False ); - pRow->Insert( pEntry, nIns ); - } - pEntry = pView->pModel->NextSibling( pEntry ); - } - } -} - -//static -void ImpIcnCursor::DestroyGridAdjustData( SvPtrarr& rLists ) -{ - sal_uInt16 nCount = rLists.Count(); - for( sal_uInt16 nCur = 0; nCur < nCount; nCur++ ) - { - SvPtrarr* pArr = (SvPtrarr*)rLists[ nCur ]; - delete pArr; - } - rLists.Remove( 0, rLists.Count() ); -} - -void SvImpIconView::SetGrid( long nDX, long nDY ) -{ - nGridDX = nDX; - nGridDY = nDY; - nFlags |= F_GRIDMODE; -} - -Rectangle SvImpIconView::CalcMaxTextRect( const SvLBoxEntry* pEntry, - const SvIcnVwDataEntry* pViewData ) const -{ - Rectangle aRect = pViewData->aGridRect; - long nBmpHeight = ((SvLBoxEntry*)pEntry)->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP)->GetSize(pView,(SvLBoxEntry*)pEntry).Height(); - aRect.Top() += nBmpHeight; - aRect.Top() += ICONVIEW_OFFS_BMP_STRING; - if( aRect.Top() > aRect.Bottom()) - aRect.Top() = aRect.Bottom(); - aRect.Left() += LROFFS_BOUND; - aRect.Left()++; - aRect.Right() -= LROFFS_BOUND; - aRect.Right()--; - if( aRect.Left() > aRect.Right()) - aRect.Left() = aRect.Right(); - if( GetTextMode( pEntry, pViewData ) == ShowTextFull ) - aRect.Bottom() = LONG_MAX; - return aRect; -} - -void SvImpIconView::Center( SvLBoxEntry* pEntry, - SvIcnVwDataEntry* pViewData ) const -{ - SvLBoxString* pStringItem = (SvLBoxString*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXSTRING)); - const String& rEntryText = pStringItem->GetText(); - - Rectangle aTextRect = CalcMaxTextRect(pEntry,pViewData); - aTextRect = GetTextRect( pView, aTextRect, rEntryText, DRAWTEXT_FLAGS ); - pViewData->aTextSize = aTextRect.GetSize(); - - pViewData->aRect = pViewData->aGridRect; - Size aSize( CalcBoundingSize( pEntry, pViewData ) ); - long nBorder = pViewData->aGridRect.GetWidth() - aSize.Width(); - pViewData->aRect.Left() += nBorder / 2; - pViewData->aRect.Right() -= nBorder / 2; - pViewData->aRect.Bottom() = pViewData->aRect.Top() + aSize.Height(); -} - - -// Die Deltas entsprechen Offsets, um die die View auf dem Doc verschoben wird -// links, hoch: Offsets < 0 -// rechts, runter: Offsets > 0 -void SvImpIconView::Scroll( long nDeltaX, long nDeltaY, sal_Bool bScrollBar ) -{ - const MapMode& rMapMode = pView->GetMapMode(); - Point aOrigin( rMapMode.GetOrigin() ); - // in Dokumentkoordinate umwandeln - aOrigin *= -1; - aOrigin.Y() += nDeltaY; - aOrigin.X() += nDeltaX; - Rectangle aRect( aOrigin, aOutputSize ); - MakeVisible( aRect, bScrollBar ); -} - - -const Size& SvImpIconView::GetItemSize( SvIconView* pIconView, - SvLBoxEntry* pEntry, SvLBoxItem* pItem, const SvIcnVwDataEntry* pViewData) const -{ - if( (nFlags & F_GRIDMODE) && pItem->IsA() == SV_ITEM_ID_LBOXSTRING ) - { - if( !pViewData ) - pViewData = ICNVIEWDATA(pEntry); - return pViewData->aTextSize; - } - else - return pItem->GetSize( pIconView, pEntry ); -} - -Rectangle SvImpIconView::CalcFocusRect( SvLBoxEntry* pEntry ) -{ - SvLBoxString* pStringItem = (SvLBoxString*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXSTRING)); - DBG_ASSERT(pStringItem,"Text not set"); - return CalcTextRect( pEntry, pStringItem ); -} - - -void SvImpIconView::SelectRect( const Rectangle& rRect, sal_Bool bAdd, - SvPtrarr* pOtherRects, short nBorderOffs ) -{ - if( !pZOrderList || !pZOrderList->Count() ) - return; - - CheckBoundingRects(); - pView->Update(); - sal_uInt16 nCount = pZOrderList->Count(); - - Rectangle aRect( rRect ); - aRect.Justify(); - if( nBorderOffs ) - { - aRect.Left() -= nBorderOffs; - aRect.Right() += nBorderOffs; - aRect.Top() -= nBorderOffs; - aRect.Bottom() += nBorderOffs; - } - sal_Bool bCalcOverlap = (bAdd && pOtherRects && pOtherRects->Count()) ? sal_True : sal_False; - - for( sal_uInt16 nPos = 0; nPos < nCount; nPos++ ) - { - SvLBoxEntry* pEntry = (SvLBoxEntry*)(pZOrderList->GetObject(nPos )); - - SvIcnVwDataEntry* pViewData = ICNVIEWDATA(pEntry); - DBG_ASSERT(pViewData,"Entry not in model"); - if( !IsBoundingRectValid( pViewData->aRect )) - FindBoundingRect( pEntry, pViewData ); - const Rectangle& rBoundRect = pViewData->aRect; - sal_Bool bSelected = pViewData->IsSelected(); - - sal_Bool bOverlaps; - if( bCalcOverlap ) - bOverlaps = IsOver( pOtherRects, rBoundRect ); - else - bOverlaps = sal_False; - sal_Bool bOver = aRect.IsOver( rBoundRect ); - - if( bOver && !bOverlaps ) - { - // Ist im neuen Selektionsrechteck und in keinem alten - // => selektieren - if( !bSelected ) - pView->Select( pEntry, sal_True ); - } - else if( !bAdd ) - { - // ist ausserhalb des Selektionsrechtecks - // => Selektion entfernen - if( bSelected ) - pView->Select( pEntry, sal_False ); - } - else if( bAdd && bOverlaps ) - { - // Der Eintrag befindet sich in einem alten (=>Aufspannen - // mehrerer Rechtecke mit Ctrl!) Selektionsrechteck - - // Hier ist noch ein Bug! Der Selektionsstatus eines Eintrags - // in einem vorherigen Rechteck, muss restauriert werden, wenn - // er vom aktuellen Selektionsrechteck beruehrt wurde, jetzt aber - // nicht mehr in ihm liegt. Ich gehe hier der Einfachheit halber - // pauschal davon aus, dass die Eintraege in den alten Rechtecken - // alle selektiert sind. Ebenso ist es falsch, die Schnittmenge - // nur zu deselektieren. - // Loesungsmoeglichkeit: Snapshot der Selektion vor dem Auf- - // spannen des Rechtecks merken - if( rBoundRect.IsOver( rRect)) - { - // Schnittmenge zwischen alten Rects & aktuellem Rect desel. - if( bSelected ) - pView->Select( pEntry, sal_False ); - } - else - { - // Eintrag eines alten Rects selektieren - if( !bSelected ) - pView->Select( pEntry, sal_True ); - } - } - else if( !bOver && bSelected ) - { - // Der Eintrag liegt voellig ausserhalb und wird deshalb desel. - pView->Select( pEntry, sal_False ); - } - } - pView->Update(); -} - -sal_Bool SvImpIconView::IsOver( SvPtrarr* pRectList, const Rectangle& rBoundRect ) const -{ - sal_uInt16 nCount = pRectList->Count(); - for( sal_uInt16 nCur = 0; nCur < nCount; nCur++ ) - { - Rectangle* pRect = (Rectangle*)pRectList->GetObject( nCur ); - if( rBoundRect.IsOver( *pRect )) - return sal_True; - } - return sal_False; -} - -void SvImpIconView::AddSelectedRect( const Rectangle& rRect, short nBorderOffs ) -{ - Rectangle* pRect = new Rectangle( rRect ); - pRect->Justify(); - if( nBorderOffs ) - { - pRect->Left() -= nBorderOffs; - pRect->Right() += nBorderOffs; - pRect->Top() -= nBorderOffs; - pRect->Bottom() += nBorderOffs; - } - aSelectedRectList.Insert( (void*)pRect, aSelectedRectList.Count() ); -} - -void SvImpIconView::ClearSelectedRectList() -{ - sal_uInt16 nCount = aSelectedRectList.Count(); - for( sal_uInt16 nCur = 0; nCur < nCount; nCur++ ) - { - Rectangle* pRect = (Rectangle*)aSelectedRectList.GetObject( nCur ); - delete pRect; - } - aSelectedRectList.Remove( 0, aSelectedRectList.Count() ); -} - - -void SvImpIconView::DrawSelectionRect( const Rectangle& rRect ) -{ - pView->HideTracking(); - nFlags |= F_SELRECT_VISIBLE; - pView->ShowTracking( rRect, SHOWTRACK_SMALL | SHOWTRACK_WINDOW ); - aCurSelectionRect = rRect; -} - -void SvImpIconView::HideSelectionRect() -{ - if( nFlags & F_SELRECT_VISIBLE ) - { - pView->HideTracking(); - nFlags &= ~F_SELRECT_VISIBLE; - } -} - -void SvImpIconView::ImpDrawXORRect( const Rectangle& rRect ) -{ - RasterOp eOldOp = pView->GetRasterOp(); - pView->SetRasterOp( ROP_XOR ); - Color aOldColor = pView->GetFillColor(); - pView->SetFillColor(); - pView->DrawRect( rRect ); - pView->SetFillColor( aOldColor ); - pView->SetRasterOp( eOldOp ); -} - -void SvImpIconView::CalcScrollOffsets( const Point& rPosPixel, - long& rX, long& rY, sal_Bool bInDragDrop, sal_uInt16 nBorderWidth) -{ - // Scrolling der View, falls sich der Mauszeiger im Grenzbereich des - // Fensters befindet - long nPixelToScrollX = 0; - long nPixelToScrollY = 0; - Size aWndSize = aOutputSize; - - nBorderWidth = (sal_uInt16)(Min( (long)(aWndSize.Height()-1), (long)nBorderWidth )); - nBorderWidth = (sal_uInt16)(Min( (long)(aWndSize.Width()-1), (long)nBorderWidth )); - - if ( rPosPixel.X() < nBorderWidth ) - { - if( bInDragDrop ) - nPixelToScrollX = -DD_SCROLL_PIXEL; - else - nPixelToScrollX = rPosPixel.X()- nBorderWidth; - } - else if ( rPosPixel.X() > aWndSize.Width() - nBorderWidth ) - { - if( bInDragDrop ) - nPixelToScrollX = DD_SCROLL_PIXEL; - else - nPixelToScrollX = rPosPixel.X() - (aWndSize.Width() - nBorderWidth); - } - if ( rPosPixel.Y() < nBorderWidth ) - { - if( bInDragDrop ) - nPixelToScrollY = -DD_SCROLL_PIXEL; - else - nPixelToScrollY = rPosPixel.Y() - nBorderWidth; - } - else if ( rPosPixel.Y() > aWndSize.Height() - nBorderWidth ) - { - if( bInDragDrop ) - nPixelToScrollY = DD_SCROLL_PIXEL; - else - nPixelToScrollY = rPosPixel.Y() - (aWndSize.Height() - nBorderWidth); - } - - rX = nPixelToScrollX; - rY = nPixelToScrollY; -} - -IMPL_LINK(SvImpIconView, MouseMoveTimeoutHdl, Timer*, pTimer ) -{ - pTimer->Start(); - MouseMove( aMouseMoveEvent ); - return 0; -} - -void SvImpIconView::EndTracking() -{ - pView->ReleaseMouse(); - if( nFlags & F_RUBBERING ) - { - aMouseMoveTimer.Stop(); - nFlags &= ~(F_RUBBERING | F_ADD_MODE); - } -} - -sal_Bool SvImpIconView::IsTextHit( SvLBoxEntry* pEntry, const Point& rDocPos ) -{ - SvLBoxString* pItem = (SvLBoxString*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXSTRING)); - if( pItem ) - { - Rectangle aRect( CalcTextRect( pEntry, pItem )); - if( aRect.IsInside( rDocPos ) ) - return sal_True; - } - return sal_False; -} - -IMPL_LINK(SvImpIconView, EditTimeoutHdl, Timer*, EMPTYARG ) -{ - SvLBoxEntry* pEntry = GetCurEntry(); - if( pView->IsInplaceEditingEnabled() && pEntry && - pView->IsSelected( pEntry )) - { - pView->EditEntry( pEntry ); - } - return 0; -} - - -// -// Funktionen zum Ausrichten der Eintraege am Grid -// - -// pStart == 0: Alle Eintraege werden ausgerichtet -// sonst: Alle Eintraege der Zeile ab einschliesslich pStart werden ausgerichtet -void SvImpIconView::AdjustAtGrid( SvLBoxEntry* pStart ) -{ - SvPtrarr aLists; - pImpCursor->CreateGridAjustData( aLists, pStart ); - sal_uInt16 nCount = aLists.Count(); - for( sal_uInt16 nCur = 0; nCur < nCount; nCur++ ) - { - AdjustAtGrid( *(SvPtrarr*)aLists[ nCur ], pStart ); - } - ImpIcnCursor::DestroyGridAdjustData( aLists ); - CheckScrollBars(); -} - -// Richtet eine Zeile aus, erweitert ggf. die Breite; Bricht die Zeile nicht um -void SvImpIconView::AdjustAtGrid( const SvPtrarr& rRow, SvLBoxEntry* pStart ) -{ - if( !rRow.Count() ) - return; - - sal_Bool bGo; - if( !pStart ) - bGo = sal_True; - else - bGo = sal_False; - - long nCurRight = 0; - for( sal_uInt16 nCur = 0; nCur < rRow.Count(); nCur++ ) - { - SvLBoxEntry* pCur = (SvLBoxEntry*)rRow[ nCur ]; - if( !bGo && pCur == pStart ) - bGo = sal_True; - - SvIcnVwDataEntry* pViewData = ICNVIEWDATA(pCur); - // Massgebend (fuer das menschliche Auge) ist die Bitmap, da sonst - // durch lange Texte der Eintrag stark springen kann - const Rectangle& rBoundRect = GetBoundingRect( pCur, pViewData ); - Rectangle aCenterRect( CalcBmpRect( pCur, 0, pViewData )); - if( bGo && !pViewData->IsEntryPosLocked() ) - { - long nWidth = aCenterRect.GetSize().Width(); - Point aNewPos( AdjustAtGrid( aCenterRect, rBoundRect ) ); - while( aNewPos.X() < nCurRight ) - aNewPos.X() += nGridDX; - if( aNewPos != rBoundRect.TopLeft() ) - SetEntryPosition( pCur, aNewPos ); - nCurRight = aNewPos.X() + nWidth; - } - else - { - nCurRight = rBoundRect.Right(); - } - } -} - -// Richtet Rect am Grid aus, garantiert jedoch nicht, dass die -// neue Pos. frei ist. Die Pos. kann fuer SetEntryPos verwendet werden. -// Das CenterRect beschreibt den Teil des BoundRects, der fuer -// die Berechnung des Ziel-Rechtecks verwendet wird. -Point SvImpIconView::AdjustAtGrid( const Rectangle& rCenterRect, - const Rectangle& rBoundRect ) const -{ - Point aPos( rCenterRect.TopLeft() ); - Size aSize( rCenterRect.GetSize() ); - - aPos.X() -= LROFFS_WINBORDER; - aPos.Y() -= TBOFFS_WINBORDER; - - // align (ref ist mitte des rects) - short nGridX = (short)((aPos.X()+(aSize.Width()/2)) / nGridDX); - short nGridY = (short)((aPos.Y()+(aSize.Height()/2)) / nGridDY); - aPos.X() = nGridX * nGridDX; - aPos.Y() = nGridY * nGridDY; - // hor. center - aPos.X() += (nGridDX - rBoundRect.GetSize().Width() ) / 2; - - aPos.X() += LROFFS_WINBORDER; - aPos.Y() += TBOFFS_WINBORDER; - - return aPos; -} - - -void SvImpIconView::SetTextMode( SvIconViewTextMode eMode, SvLBoxEntry* pEntry ) -{ - if( !pEntry ) - { - if( eTextMode != eMode ) - { - if( eTextMode == ShowTextDontKnow ) - eTextMode = ShowTextShort; - eTextMode = eMode; - pView->Arrange(); - } - } - else - { - SvIcnVwDataEntry* pViewData = ICNVIEWDATA(pEntry); - if( pViewData->eTextMode != eMode ) - { - pViewData->eTextMode = eMode; - pModel->InvalidateEntry( pEntry ); - AdjustVirtSize( pViewData->aRect ); - } - } -} - -SvIconViewTextMode SvImpIconView::GetTextMode( const SvLBoxEntry* pEntry, - const SvIcnVwDataEntry* pViewData ) const -{ - if( !pEntry ) - return eTextMode; - else - { - if( !pViewData ) - pViewData = ICNVIEWDATA(((SvLBoxEntry*)pEntry)); - return pViewData->GetTextMode(); - } -} - -SvIconViewTextMode SvImpIconView::GetEntryTextModeSmart( const SvLBoxEntry* pEntry, - const SvIcnVwDataEntry* pViewData ) const -{ - DBG_ASSERT(pEntry,"GetEntryTextModeSmart: Entry not set"); - if( !pViewData ) - pViewData = ICNVIEWDATA(((SvLBoxEntry*)pEntry)); - SvIconViewTextMode eMode = pViewData->GetTextMode(); - if( eMode == ShowTextDontKnow ) - return eTextMode; - return eMode; -} - -void SvImpIconView::ShowFocusRect( const SvLBoxEntry* pEntry ) -{ - if( !pEntry ) - pView->HideFocus(); - else - { - Rectangle aRect ( CalcFocusRect( (SvLBoxEntry*)pEntry ) ); - pView->ShowFocus( aRect ); - } -} - -IMPL_LINK(SvImpIconView, UserEventHdl, void*, EMPTYARG ) -{ - nCurUserEvent = 0; - AdjustScrollBars(); - Rectangle aRect; - if( GetResizeRect(aRect) ) - PaintResizeRect( aRect ); - return 0; -} - -void SvImpIconView::CancelUserEvent() -{ - if( nCurUserEvent ) - { - Application::RemoveUserEvent( nCurUserEvent ); - nCurUserEvent = 0; - } -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/contnr/svtreebx.cxx b/svtools/source/contnr/svtreebx.cxx index d03b956bf571..7695137431f0 100644 --- a/svtools/source/contnr/svtreebx.cxx +++ b/svtools/source/contnr/svtreebx.cxx @@ -853,6 +853,11 @@ void SvTreeListBox::ScrollOutputArea( short nDeltaEntries ) NotifyEndScroll(); } +void SvTreeListBox::ScrollToAbsPos( long nPos ) +{ + pImp->ScrollToAbsPos( nPos ); +} + void SvTreeListBox::SetSelectionMode( SelectionMode eSelectMode ) { DBG_CHKTHIS(SvTreeListBox,0); @@ -2447,6 +2452,28 @@ SvLBoxEntry* SvTreeListBox::GetNextEntryInView(SvLBoxEntry* pEntry ) const return pNext; } +SvLBoxEntry* SvTreeListBox::GetLastEntryInView() const +{ + SvLBoxEntry* pEntry = GetFirstEntryInView(); + SvLBoxEntry* pNext = 0; + while( pEntry ) + { + pNext = (SvLBoxEntry*)NextVisible( pEntry ); + if( pNext ) + { + Point aPos( GetEntryPosition(pNext) ); + const Size& rSize = pImp->GetOutputSize(); + if( aPos.Y() < 0 || aPos.Y() >= rSize.Height() ) + break; + else + pEntry = pNext; + } + else + break; + } + return pEntry; +} + void SvTreeListBox::ShowFocusRect( const SvLBoxEntry* pEntry ) { pImp->ShowFocusRect( pEntry ); diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx index 14dae85f4ee8..e185705806be 100644 --- a/svtools/source/control/ctrlbox.cxx +++ b/svtools/source/control/ctrlbox.cxx @@ -180,10 +180,10 @@ sal_uInt16 ColorListBox::InsertEntry( const Color& rColor, const XubString& rStr // ----------------------------------------------------------------------- -void ColorListBox::InsertAutomaticEntry() +void ColorListBox::InsertAutomaticEntryColor(const Color &rColor) { // insert the "Automatic"-entry always on the first position - InsertEntry( Color( COL_AUTO ), SvtResId( STR_SVT_AUTOMATIC_COLOR ), 0 ); + InsertEntry( rColor, SvtResId( STR_SVT_AUTOMATIC_COLOR ), 0 ); } // ----------------------------------------------------------------------- diff --git a/svtools/source/control/tabbar.cxx b/svtools/source/control/tabbar.cxx index bc0ee75a845b..49309fd4f001 100644 --- a/svtools/source/control/tabbar.cxx +++ b/svtools/source/control/tabbar.cxx @@ -1978,29 +1978,6 @@ void TabBar::Clear() // ----------------------------------------------------------------------- -void TabBar::EnablePage( sal_uInt16 nPageId, sal_Bool bEnable ) -{ - sal_uInt16 nPos = GetPagePos( nPageId ); - - if ( nPos != PAGE_NOT_FOUND ) - { - ImplTabBarItem* pItem = (*mpItemList)[ nPos ]; - - if ( pItem->mbEnable != bEnable ) - { - pItem->mbEnable = bEnable; - - // Leiste neu ausgeben - if ( IsReallyVisible() && IsUpdateMode() ) - Invalidate( pItem->maRect ); - - CallEventListeners( bEnable ? VCLEVENT_TABBAR_PAGEENABLED : VCLEVENT_TABBAR_PAGEDISABLED, reinterpret_cast<void*>(sal::static_int_cast<sal_IntPtr>(nPageId)) ); - } - } -} - -// ----------------------------------------------------------------------- - sal_Bool TabBar::IsPageEnabled( sal_uInt16 nPageId ) const { sal_uInt16 nPos = GetPagePos( nPageId ); @@ -2302,48 +2279,6 @@ void TabBar::SelectPage( sal_uInt16 nPageId, sal_Bool bSelect ) // ----------------------------------------------------------------------- -void TabBar::SelectPageRange( sal_Bool bSelect, sal_uInt16 nStartPos, sal_uInt16 nEndPos ) -{ - Rectangle aPaintRect; - sal_uInt16 nPos = nStartPos; - ImplTabBarItem* pItem = seek( nPos ); - while ( pItem && (nPos <= nEndPos) ) - { - if ( (pItem->mbSelect != bSelect) && (pItem->mnId != mnCurPageId) ) - { - pItem->mbSelect = bSelect; - aPaintRect.Union( pItem->maRect ); - } - - nPos++; - pItem = next(); - } - - // Leiste neu ausgeben - if ( IsReallyVisible() && IsUpdateMode() && !aPaintRect.IsEmpty() ) - Invalidate( aPaintRect ); -} - -// ----------------------------------------------------------------------- - -sal_uInt16 TabBar::GetSelectPage( sal_uInt16 nSelIndex ) const -{ - sal_uInt16 nSelected = 0; - for ( size_t i = 0, n = mpItemList->size(); i < n; ++i ) - { - ImplTabBarItem* pItem = (*mpItemList)[ i ]; - if ( pItem->mbSelect ) - nSelected++; - - if ( nSelected == nSelIndex ) - return pItem->mnId; - } - - return 0; -} - -// ----------------------------------------------------------------------- - sal_uInt16 TabBar::GetSelectPageCount() const { sal_uInt16 nSelected = 0; @@ -2519,78 +2454,6 @@ void TabBar::SetMaxPageWidth( long nMaxWidth ) // ----------------------------------------------------------------------- -void TabBar::SetSelectColor() -{ - if ( mbSelColor ) - { - maSelColor = Color( COL_TRANSPARENT ); - mbSelColor = sal_False; - Invalidate(); - } -} - -// ----------------------------------------------------------------------- - -void TabBar::SetSelectColor( const Color& rColor ) -{ - if ( rColor.GetTransparency() ) - { - if ( mbSelColor ) - { - maSelColor = Color( COL_TRANSPARENT ); - mbSelColor = sal_False; - Invalidate(); - } - } - else - { - if ( maSelColor != rColor ) - { - maSelColor = rColor; - mbSelColor = sal_True; - Invalidate(); - } - } -} - -// ----------------------------------------------------------------------- - -void TabBar::SetSelectTextColor() -{ - if ( mbSelTextColor ) - { - maSelTextColor = Color( COL_TRANSPARENT ); - mbSelTextColor = sal_False; - Invalidate(); - } -} - -// ----------------------------------------------------------------------- - -void TabBar::SetSelectTextColor( const Color& rColor ) -{ - if ( rColor.GetTransparency() ) - { - if ( mbSelTextColor ) - { - maSelTextColor = Color( COL_TRANSPARENT ); - mbSelTextColor = sal_False; - Invalidate(); - } - } - else - { - if ( maSelTextColor != rColor ) - { - maSelTextColor = rColor; - mbSelTextColor = sal_True; - Invalidate(); - } - } -} - -// ----------------------------------------------------------------------- - void TabBar::SetPageText( sal_uInt16 nPageId, const XubString& rText ) { sal_uInt16 nPos = GetPagePos( nPageId ); @@ -2620,15 +2483,6 @@ XubString TabBar::GetPageText( sal_uInt16 nPageId ) const // ----------------------------------------------------------------------- -void TabBar::SetHelpText( sal_uInt16 nPageId, const XubString& rText ) -{ - sal_uInt16 nPos = GetPagePos( nPageId ); - if ( nPos != PAGE_NOT_FOUND ) - (*mpItemList)[ nPos ]->maHelpText = rText; -} - -// ----------------------------------------------------------------------- - XubString TabBar::GetHelpText( sal_uInt16 nPageId ) const { sal_uInt16 nPos = GetPagePos( nPageId ); @@ -2650,15 +2504,6 @@ XubString TabBar::GetHelpText( sal_uInt16 nPageId ) const // ----------------------------------------------------------------------- -void TabBar::SetHelpId( sal_uInt16 nPageId, const rtl::OString& rHelpId ) -{ - sal_uInt16 nPos = GetPagePos( nPageId ); - if ( nPos != PAGE_NOT_FOUND ) - (*mpItemList)[ nPos ]->maHelpId = rHelpId; -} - -// ----------------------------------------------------------------------- - rtl::OString TabBar::GetHelpId( sal_uInt16 nPageId ) const { sal_uInt16 nPos = GetPagePos( nPageId ); @@ -2670,18 +2515,6 @@ rtl::OString TabBar::GetHelpId( sal_uInt16 nPageId ) const // ----------------------------------------------------------------------- -long TabBar::GetMinSize() const -{ - long nMinSize = TABBAR_MINSIZE + TABBAR_OFFSET_X; - if ( mnWinStyle & WB_MINSCROLL ) - nMinSize += mpPrevBtn->GetSizePixel().Width()*2; - else if ( mnWinStyle & WB_SCROLL ) - nMinSize += mpFirstBtn->GetSizePixel().Width()*4; - return nMinSize; -} - -// ----------------------------------------------------------------------- - sal_Bool TabBar::StartDrag( const CommandEvent& rCEvt, Region& rRegion ) { if ( !(mnWinStyle & WB_DRAG) || (rCEvt.GetCommand() != COMMAND_STARTDRAG) ) diff --git a/svtools/source/control/taskbar.cxx b/svtools/source/control/taskbar.cxx index 8d3a6abce18f..a41730c3318b 100644 --- a/svtools/source/control/taskbar.cxx +++ b/svtools/source/control/taskbar.cxx @@ -464,70 +464,6 @@ void TaskBar::Format() // ----------------------------------------------------------------------- -void TaskBar::SetLines( sal_uInt16 nLines ) -{ - mnLines = nLines; -} - -// ----------------------------------------------------------------------- - -void TaskBar::EnableAutoHide( sal_Bool bAutoHide ) -{ - mbAutoHide = bAutoHide; - - if ( mbAutoHide ) - { - ImplNewHeight( TASKBAR_AUTOHIDE_HEIGHT ); - } - else - { - ImplNewHeight( CalcWindowSizePixel().Height() ); - } -} - -// ----------------------------------------------------------------------- - -void TaskBar::ShowStatusText( const String& rText ) -{ - if ( mpStatusBar ) - { - if ( !mbStatusText ) - { - mbStatusText = sal_True; - if ( mpStatusBar->AreItemsVisible() ) - { - mbShowItems = sal_True; - mpStatusBar->HideItems(); - } - else - mbShowItems = sal_True; - maOldText = mpStatusBar->GetText(); - Resize(); - mpStatusBar->SetText( rText ); - Update(); - mpStatusBar->Update(); - } - else - mpStatusBar->SetText( rText ); - } -} - -// ----------------------------------------------------------------------- - -void TaskBar::HideStatusText() -{ - if ( mbStatusText && mpStatusBar ) - { - mbStatusText = sal_False; - mpStatusBar->SetText( maOldText ); - Resize(); - if ( mbShowItems ) - mpStatusBar->ShowItems(); - } -} - -// ----------------------------------------------------------------------- - Size TaskBar::CalcWindowSizePixel() const { TaskButtonBar* pTempButtonBar = GetButtonBar(); diff --git a/svtools/source/control/taskmisc.cxx b/svtools/source/control/taskmisc.cxx index 1476cacb76fb..246d107fc1d1 100644 --- a/svtools/source/control/taskmisc.cxx +++ b/svtools/source/control/taskmisc.cxx @@ -61,14 +61,13 @@ void TaskButtonBar::RequestHelp( const HelpEvent& rHEvt ) WindowArrange::WindowArrange() { - mpWinList = new List; } // ----------------------------------------------------------------------- WindowArrange::~WindowArrange() { - delete mpWinList; + maWinList.clear(); } // ----------------------------------------------------------------------- @@ -103,22 +102,21 @@ static void ImplPosSizeWindow( Window* pWindow, void WindowArrange::ImplTile( const Rectangle& rRect ) { - sal_uInt16 nCount = (sal_uInt16)mpWinList->Count(); + size_t nCount = maWinList.size(); if ( nCount < 3 ) { ImplVert( rRect ); return; } - sal_uInt16 i; - sal_uInt16 j; - sal_uInt16 nCols; - sal_uInt16 nRows; - sal_uInt16 nActRows; - sal_uInt16 nOffset; + sal_uInt16 i; + sal_uInt16 j; + sal_uInt16 nCols; + sal_uInt16 nRows; + sal_uInt16 nActRows; + sal_uInt16 nOffset; long nOverWidth; long nOverHeight; - Window* pWindow; long nX = rRect.Left(); long nY = rRect.Top(); long nWidth = rRect.GetWidth(); @@ -144,7 +142,7 @@ void WindowArrange::ImplTile( const Rectangle& rRect ) nWidth = 1; nOverWidth = nRectWidth-(nWidth*nCols); - pWindow = (Window*)mpWinList->First(); + WindowList_impl::iterator it = maWinList.begin(); for ( i = 0; i < nCols; i++ ) { if ( i < nOffset ) @@ -172,18 +170,17 @@ void WindowArrange::ImplTile( const Rectangle& rRect ) nTempHeight++; nOverHeight--; } - ImplPosSizeWindow( pWindow, nX, nY, nTempWidth, nTempHeight ); + ImplPosSizeWindow( *it, nX, nY, nTempWidth, nTempHeight ); nY += nTempHeight; - pWindow = (Window*)mpWinList->Next(); - if ( !pWindow ) + if ( ++it == maWinList.end() ) break; } nX += nWidth; nY = nRectY; - if ( !pWindow ) + if ( it == maWinList.end() ) break; } } @@ -192,7 +189,7 @@ void WindowArrange::ImplTile( const Rectangle& rRect ) void WindowArrange::ImplHorz( const Rectangle& rRect ) { - long nCount = (long)mpWinList->Count(); + size_t nCount = maWinList.size(); long nX = rRect.Left(); long nY = rRect.Top(); long nWidth = rRect.GetWidth(); @@ -206,9 +203,9 @@ void WindowArrange::ImplHorz( const Rectangle& rRect ) if ( nHeight < 1 ) nHeight = 1; nOver = nRectHeight - (nCount*nHeight); - pWindow = (Window*)mpWinList->First(); - while ( pWindow ) + for( size_t index = 0; index < nCount; ++index ) { + pWindow = maWinList[ index ]; nTempHeight = nHeight; if ( nOver > 0 ) { @@ -217,8 +214,6 @@ void WindowArrange::ImplHorz( const Rectangle& rRect ) } ImplPosSizeWindow( pWindow, nX, nY, nWidth, nTempHeight ); nY += nTempHeight; - - pWindow = (Window*)mpWinList->Next(); } } @@ -226,7 +221,7 @@ void WindowArrange::ImplHorz( const Rectangle& rRect ) void WindowArrange::ImplVert( const Rectangle& rRect ) { - long nCount = (long)mpWinList->Count(); + size_t nCount = maWinList.size(); long nX = rRect.Left(); long nY = rRect.Top(); long nWidth = rRect.GetWidth(); @@ -240,9 +235,9 @@ void WindowArrange::ImplVert( const Rectangle& rRect ) if ( nWidth < 1 ) nWidth = 1; nOver = nRectWidth - (nCount*nWidth); - pWindow = (Window*)mpWinList->First(); - while ( pWindow ) + for( size_t index = 0; index < nCount; ++index ) { + pWindow = maWinList[ index ]; nTempWidth = nWidth; if ( nOver > 0 ) { @@ -251,8 +246,6 @@ void WindowArrange::ImplVert( const Rectangle& rRect ) } ImplPosSizeWindow( pWindow, nX, nY, nTempWidth, nHeight ); nX += nTempWidth; - - pWindow = (Window*)mpWinList->Next(); } } @@ -285,7 +278,7 @@ void WindowArrange::ImplCascade( const Rectangle& rRect ) Window* pTempWindow; // Border-Fenster suchen um den Versatz zu ermitteln - pTempWindow = (Window*)mpWinList->First(); + pTempWindow = maWinList.front(); pTempWindow->GetBorder( nLeftBorder, nTopBorder, nRightBorder, nBottomBorder ); while ( !nTopBorder ) { @@ -313,9 +306,9 @@ void WindowArrange::ImplCascade( const Rectangle& rRect ) nStartOverHeight = nRectHeight-(nHeight+(nCascadeWins*nOff)); i = 0; - pWindow = (Window*)mpWinList->First(); - while ( pWindow ) + for( size_t index = 0, count = maWinList.size(); index < count; ++index ) { + pWindow = maWinList[ index ]; if ( !i ) { nOverWidth = nStartOverWidth; @@ -346,8 +339,6 @@ void WindowArrange::ImplCascade( const Rectangle& rRect ) i++; else i = 0; - - pWindow = (Window*)mpWinList->Next(); } } @@ -355,7 +346,7 @@ void WindowArrange::ImplCascade( const Rectangle& rRect ) void WindowArrange::Arrange( sal_uInt16 nType, const Rectangle& rRect ) { - if ( !mpWinList->Count() ) + if ( maWinList.empty() ) return; switch ( nType ) diff --git a/svtools/source/control/taskstat.cxx b/svtools/source/control/taskstat.cxx index b94aae25a88f..08f2a25b4b2f 100644 --- a/svtools/source/control/taskstat.cxx +++ b/svtools/source/control/taskstat.cxx @@ -110,21 +110,6 @@ TaskStatusFieldItem::TaskStatusFieldItem( const TaskStatusFieldItem& rItem ) : // ----------------------------------------------------------------------- -TaskStatusFieldItem::TaskStatusFieldItem( ITaskStatusNotify* pNotify, - const Image& rImage, - const XubString& rQuickHelpText, - const XubString& rHelpText, - sal_uInt16 nFlags ) : - mpNotify( pNotify ), - maImage( rImage ), - maQuickHelpText( rQuickHelpText ), - maHelpText( rHelpText ), - mnFlags( nFlags ) -{ -} - -// ----------------------------------------------------------------------- - TaskStatusFieldItem::~TaskStatusFieldItem() { } @@ -563,90 +548,4 @@ void TaskStatusBar::InsertStatusField( long, sal_uInt16, ImplUpdateField( sal_False ); } -// ----------------------------------------------------------------------- - -void TaskStatusBar::SetFieldFlags( sal_uInt16 nFlags ) -{ - if ( mnFieldFlags != nFlags ) - { - mnFieldFlags = nFlags; - ImplUpdateField( sal_False ); - } -} - -// ----------------------------------------------------------------------- - -void TaskStatusBar::AddStatusFieldItem( sal_uInt16 nItemId, const TaskStatusFieldItem& rItem, - sal_uInt16 nPos ) -{ - DBG_ASSERT( nItemId, "TaskStatusBar::AddStatusFieldItem() - Item is 0" ); - DBG_ASSERT( !ImplGetFieldItem( nItemId ), "TaskStatusBar::AddStatusFieldItem() - Item-Id already exist" ); - - if ( !mpFieldItemList ) - mpFieldItemList = new ImplTaskSBItemList; - - ImplTaskSBFldItem* pItem = new ImplTaskSBFldItem; - pItem->maItem = rItem; - pItem->mnId = nItemId; - pItem->mnOffX = 0; - if ( nPos < mpFieldItemList->size() ) { - ImplTaskSBItemList::iterator it = mpFieldItemList->begin(); - ::std::advance( it, nPos ); - mpFieldItemList->insert( it, pItem ); - } else { - mpFieldItemList->push_back( pItem ); - } - - ImplUpdateField( sal_True ); -} - -// ----------------------------------------------------------------------- - -void TaskStatusBar::ModifyStatusFieldItem( sal_uInt16 nItemId, const TaskStatusFieldItem& rItem ) -{ - ImplTaskSBFldItem* pItem = ImplGetFieldItem( nItemId ); - if ( pItem ) - { - sal_Bool bUpdate = (pItem->maItem.GetImage() != rItem.GetImage()) || - (pItem->maItem.GetFlags() != rItem.GetFlags()); - pItem->maItem = rItem; - if ( bUpdate ) - ImplUpdateField( sal_True ); - } -} - -// ----------------------------------------------------------------------- - -void TaskStatusBar::RemoveStatusFieldItem( sal_uInt16 nItemId ) -{ - ImplTaskSBFldItem* pItem = ImplGetFieldItem( nItemId ); - if ( pItem ) - { - for ( ImplTaskSBItemList::iterator it = mpFieldItemList->begin(); - it < mpFieldItemList->end(); - ++it - ) { - if ( *it == pItem ) { - delete *it; - mpFieldItemList->erase( it ); - break; - } - } - } -} - -// ----------------------------------------------------------------------- - -sal_Bool TaskStatusBar::GetStatusFieldItem( sal_uInt16 nItemId, TaskStatusFieldItem& rItem ) const -{ - ImplTaskSBFldItem* pItem = ImplGetFieldItem( nItemId ); - if ( pItem ) - { - rItem = pItem->maItem; - return sal_True; - } - - return sal_False; -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/dialogs/mcvmath.cxx b/svtools/source/dialogs/mcvmath.cxx index 5d5ad14c82c2..f34737b8a4f0 100644 --- a/svtools/source/dialogs/mcvmath.cxx +++ b/svtools/source/dialogs/mcvmath.cxx @@ -71,23 +71,6 @@ Fix ImpMultBig2( const Fix& a, const Fix& b ) /************************************************************************** |* -|* ImpMultBig2() -|* -|* Beschreibung Multiplikation fuer FixPoint-Berechnungen -|* -**************************************************************************/ - -// first parameter should be the bigger one - -FixCpx ImpMultBig2( const FixCpx& ra, const FixCpx& rb ) -{ - Fix rr = ImpMultBig2(ra.r,rb.r)-ImpMultBig2(ra.i,rb.i); - Fix ii = ImpMultBig2(ra.r,rb.i)+ImpMultBig2(ra.i,rb.r); - return FixCpx( rr,ii ); -} - -/************************************************************************** -|* |* ImpSqrt() |* |* Beschreibung Wurzelfunktion fuer FixPoint-Berechnungen @@ -146,146 +129,4 @@ FixCpx ImpExPI( sal_uInt16 nPhi ) return aIter; } -/************************************************************************** -|* -|* ImpATanx2() -|* -|* Beschreibung ATANX2-Funktion fuer FixPoint-Berechnungen -|* -**************************************************************************/ - -// use for x*x+y*y==1 only - -static sal_uInt16 ImpATanx2( const Fix& rX, const Fix& rY ) -{ - sal_uInt16 phi0 = 0; // result angel higher part - sal_uInt16 phi = 0; // dito lower part - long x = rX.x; - long y = rY.x; - long z; - const char Sft=14-FIX_POST; - short i; - FixCpx aTry; - FixCpx aInc; - FixCpx aIter(1L); - sal_Bool Small = sal_False; - - if ( (x==0) && (y==0) ) - return 0; - - if ( y < 0) - { - // reduce 3. to 1. quadrant (0..90 Degree) - phi0 += 180L * 65536L / 360L; - // turn 180 degree - y *= -1; - x *= -1; - } - - if ( x < 0) - { - // 2. to 1. q. - phi0 += 90L * 65536L / 360L; - // turn 90 degree clockwise - z = y; - y = -x; - x = z; - } - - for ( i = 13; i >= 0; i-- ) - { - aInc.r.x = CosTab[i]>>Sft; // e**(i(phi1+phi2)) = - aInc.i.x = SinTab[i]>>Sft; // e**(i*phi1)) * e**(i*phi2)) - aTry = aIter*aInc; - - if ( Small ) - { - // is try ok - if ( aTry.r.x >= x ) - { - aIter = aTry; - phi += (1<<i); - } - } - else - { - // is try ok - if ( aTry.i.x <= y ) - { - aIter = aTry; - phi += (1<<i); - - if ( i > 11 ) - Small=sal_True; - } - } - } - - return phi0+phi; -} - -/************************************************************************** -|* -|* ImpATan2() -|* -|* Beschreibung ATAN-Funktion fuer FixPoint-Berechnungen -|* -**************************************************************************/ - -sal_uInt16 ImpATan2( const short x, const short y ) -{ - Fix rRad = ImpSqrt(sal_uLong(long(x)*x+long(y)*y)); - - if ( !rRad.x ) - return 0; - Fix fx = x; - fx.DivBig( rRad ); // Normiere auf Einheitskreis - Fix fy = y; - fy.DivBig( rRad ); - - return ImpATanx2( fx, fy ); -} - -/************************************************************************** -|* -|* ImpCartToPolar() -|* -|* Beschreibung Koordinaaten-Wandlung -|* -**************************************************************************/ - -void ImpCartToPolar( const short x, const short y, Fix& rRad, sal_uInt16& rPhi ) -{ - rRad = Fix( ImpSqrt( sal_uLong( long(x)*x+long(y)*y ) ) ); - - if ( !rRad.x ) - rPhi=0; - else - { - // Normiere auf Einheitskreis - Fix fx = x; - fx.DivBig(rRad); - Fix fy = y; - fy.DivBig(rRad); - rPhi = ImpATanx2(fx, fy); - } -} - -/************************************************************************** -|* -|* ImpPolarToCart() -|* -|* Beschreibung Koordinaaten-Wandlung -|* -**************************************************************************/ - -void ImpPolarToCart( const Fix& rR, const sal_uInt16 Phi, short& rX, short& rY ) -{ - FixCpx fc = ImpExPI( Phi ); // calculate sin() & cos() - fc.GetReal().MultBig( rR ); - rX = sal::static_int_cast< short >(long( fc.GetReal() )); - fc.GetImag().MultBig( rR ); - rY = sal::static_int_cast< short >(long( fc.GetImag() )); -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/dialogs/mcvmath.hxx b/svtools/source/dialogs/mcvmath.hxx index 5e0d47e655ef..c3e2005352ab 100644 --- a/svtools/source/dialogs/mcvmath.hxx +++ b/svtools/source/dialogs/mcvmath.hxx @@ -75,8 +75,6 @@ private: friend class FixCpx; friend class ColWheel; -// friend Fix ImpMultBig2( const Fix& a, const Fix& b ); - public: long x; @@ -122,8 +120,6 @@ public: class FixCpx { -// friend FixCpx ImpMultBig2( const FixCpx& ra, const FixCpx& rb ); - public: Fix r; Fix i; @@ -217,13 +213,8 @@ inline FixCpx operator/ ( const FixCpx& a, const FixCpx& b ) // ----------------------------------------------------------------------- Fix ImpMultBig2( const Fix& a, const Fix& b ); -FixCpx ImpMultBig2( const FixCpx& ra, const FixCpx& rb ); - -void ImpCartToPolar( const short x, const short y, Fix& rRad, sal_uInt16& rPhi ); -void ImpPolarToCart( const Fix& rR, const sal_uInt16 Phi, short& rX, short& rY ); sal_uInt16 ImpSqrt( sal_uLong nRadi ); -sal_uInt16 ImpATan2( const short x, const short y ); FixCpx ImpExPI( sal_uInt16 nPhi ); #endif // _MCVMATH_HXX diff --git a/svtools/source/dialogs/prnsetup.cxx b/svtools/source/dialogs/prnsetup.cxx index 728d0e6ea5c7..1c39b8e6f70d 100644 --- a/svtools/source/dialogs/prnsetup.cxx +++ b/svtools/source/dialogs/prnsetup.cxx @@ -281,11 +281,6 @@ void PrinterSetupDialog::SetOptionsHdl( const Link& rLink ) maBtnOptions.Show( rLink.IsSet() ); } -const Link& PrinterSetupDialog::GetOptionsHdl() const -{ - return maBtnOptions.GetClickHdl(); -} - void PrinterSetupDialog::ImplSetInfo() { const QueueInfo* pInfo = Printer::GetQueueInfo(maLbName.GetSelectEntry(), true); diff --git a/svtools/source/edit/syntaxhighlight.cxx b/svtools/source/edit/syntaxhighlight.cxx index f859e9930cf9..df9c9d1acea9 100644 --- a/svtools/source/edit/syntaxhighlight.cxx +++ b/svtools/source/edit/syntaxhighlight.cxx @@ -237,6 +237,8 @@ extern "C" int CDECL compare_strings( const void *arg1, const void *arg2 ) } +namespace { + class LetterTable { bool IsLetterTab[256]; @@ -252,6 +254,8 @@ public: bool isLetterUnicode( sal_Unicode c ); }; +} + class BasicSimpleCharClass { static LetterTable aLetterTable; @@ -671,41 +675,6 @@ sal_Bool SimpleTokenizer_Impl::getNextToken( /*out*/TokenTypes& reType, return sal_True; } -String SimpleTokenizer_Impl::getTokStr - ( /*out*/const sal_Unicode* pStartPos, /*out*/const sal_Unicode* pEndPos ) -{ - return String( pStartPos, (sal_uInt16)( pEndPos - pStartPos ) ); -} - -#ifdef DBG_UTIL -// TEST: Token ausgeben -String SimpleTokenizer_Impl::getFullTokenStr( /*out*/TokenTypes eType, - /*out*/const sal_Unicode* pStartPos, /*out*/const sal_Unicode* pEndPos ) -{ - String aOut; - switch( eType ) - { - case TT_UNKNOWN: aOut = String( RTL_CONSTASCII_USTRINGPARAM("TT_UNKNOWN:") ); break; - case TT_IDENTIFIER: aOut = String( RTL_CONSTASCII_USTRINGPARAM("TT_IDENTIFIER:") ); break; - case TT_WHITESPACE: aOut = String( RTL_CONSTASCII_USTRINGPARAM("TT_WHITESPACE:") ); break; - case TT_NUMBER: aOut = String( RTL_CONSTASCII_USTRINGPARAM("TT_NUMBER:") ); break; - case TT_STRING: aOut = String( RTL_CONSTASCII_USTRINGPARAM("TT_STRING:") ); break; - case TT_EOL: aOut = String( RTL_CONSTASCII_USTRINGPARAM("TT_EOL:") ); break; - case TT_COMMENT: aOut = String( RTL_CONSTASCII_USTRINGPARAM("TT_COMMENT:") ); break; - case TT_ERROR: aOut = String( RTL_CONSTASCII_USTRINGPARAM("TT_ERROR:") ); break; - case TT_OPERATOR: aOut = String( RTL_CONSTASCII_USTRINGPARAM("TT_OPERATOR:") ); break; - case TT_KEYWORDS: aOut = String( RTL_CONSTASCII_USTRINGPARAM("TT_KEYWORD:") ); break; - case TT_PARAMETER: aOut = String( RTL_CONSTASCII_USTRINGPARAM("TT_PARAMETER:") ); break; - } - if( eType != TT_EOL ) - { - aOut += String( pStartPos, (sal_uInt16)( pEndPos - pStartPos ) ); - } - aOut += String( RTL_CONSTASCII_USTRINGPARAM("\n") ); - return aOut; -} -#endif - SimpleTokenizer_Impl::SimpleTokenizer_Impl( HighlighterLanguage aLang ): aLanguage(aLang) { memset( aCharTypeTab, 0, sizeof( aCharTypeTab ) ); diff --git a/svtools/source/edit/textdoc.cxx b/svtools/source/edit/textdoc.cxx index fa7536035288..615ac1258f4d 100644 --- a/svtools/source/edit/textdoc.cxx +++ b/svtools/source/edit/textdoc.cxx @@ -216,23 +216,6 @@ void TextCharAttribList::DeleteEmptyAttribs() mbHasEmptyAttribs = sal_False; } -#ifdef DBG_UTIL -sal_Bool TextCharAttribList::DbgCheckAttribs() -{ - sal_Bool bOK = sal_True; - for ( sal_uInt16 nAttr = 0; nAttr < Count(); nAttr++ ) - { - TextCharAttrib* pAttr = GetObject( nAttr ); - if ( pAttr->GetStart() > pAttr->GetEnd() ) - { - bOK = sal_False; - OSL_FAIL( "Attr verdreht" ); - } - } - return bOK; -} -#endif - // ------------------------------------------------------------------------- // (+) class TextNode // ------------------------------------------------------------------------- @@ -307,10 +290,6 @@ void TextNode::ExpandAttribs( sal_uInt16 nIndex, sal_uInt16 nNew ) if ( bResort ) maCharAttribs.ResortAttribs(); - -#ifdef EDITDEBUG - DBG_ASSERT( CheckOrderedList( (TextCharAttribs*)&maCharAttribs ), "Expand: Start-Liste verdreht" ); -#endif } void TextNode::CollapsAttribs( sal_uInt16 nIndex, sal_uInt16 nDeleted ) @@ -374,10 +353,6 @@ void TextNode::CollapsAttribs( sal_uInt16 nIndex, sal_uInt16 nDeleted ) if ( bResort ) maCharAttribs.ResortAttribs(); - -#ifdef EDITDEBUG - DBG_ASSERT( CheckOrderedList( (TextCharAttribs)&maCharAttribs ), "Collaps: Start-Liste verdreht" ); -#endif } void TextNode::InsertText( sal_uInt16 nPos, const String& rText ) @@ -460,10 +435,6 @@ void TextNode::Append( const TextNode& rNode ) maText += rNode.GetText(); -#ifdef EDITDEBUG - DBG_ASSERT( maCharAttribs.DbgCheckAttribs(), "Attribute VOR AppendAttribs kaputt" ); -#endif - const sal_uInt16 nAttribs = rNode.GetCharAttribs().Count(); for ( sal_uInt16 nAttr = 0; nAttr < nAttribs; nAttr++ ) { @@ -499,10 +470,6 @@ void TextNode::Append( const TextNode& rNode ) maCharAttribs.InsertAttrib( pNewAttrib ); } } - -#ifdef EDITDEBUG - DBG_ASSERT( maCharAttribs.DbgCheckAttribs(), "Attribute NACH AppendAttribs kaputt" ); -#endif } // ------------------------------------------------------------------------- diff --git a/svtools/source/edit/textdoc.hxx b/svtools/source/edit/textdoc.hxx index c52190ca4d63..41a134da4899 100644 --- a/svtools/source/edit/textdoc.hxx +++ b/svtools/source/edit/textdoc.hxx @@ -69,10 +69,6 @@ public: TextCharAttrib* FindEmptyAttrib( sal_uInt16 nWhich, sal_uInt16 nPos ); sal_Bool HasAttrib( sal_uInt16 nWhich ) const; sal_Bool HasBoundingAttrib( sal_uInt16 nBound ); - -#ifdef DBG_UTIL - sal_Bool DbgCheckAttribs(); -#endif }; diff --git a/svtools/source/edit/texteng.cxx b/svtools/source/edit/texteng.cxx index 15412276e587..9decddde44f9 100644 --- a/svtools/source/edit/texteng.cxx +++ b/svtools/source/edit/texteng.cxx @@ -253,12 +253,6 @@ void TextEngine::SetFont( const Font& rFont ) } } -void TextEngine::SetDefTab( sal_uInt16 nDefTab ) -{ - mnDefTab = nDefTab; - // evtl neu setzen? -} - void TextEngine::SetMaxTextLen( sal_uLong nLen ) { mnMaxTextLen = nLen; @@ -359,29 +353,6 @@ void TextEngine::SetUpdateMode( sal_Bool bUpdate ) } } -sal_Bool TextEngine::DoesKeyMoveCursor( const KeyEvent& rKeyEvent ) -{ - sal_Bool bDoesMove = sal_False; - - switch ( rKeyEvent.GetKeyCode().GetCode() ) - { - case KEY_UP: - case KEY_DOWN: - case KEY_LEFT: - case KEY_RIGHT: - case KEY_HOME: - case KEY_END: - case KEY_PAGEUP: - case KEY_PAGEDOWN: - { - if ( !rKeyEvent.GetKeyCode().IsMod2() ) - bDoesMove = sal_True; - } - break; - } - return bDoesMove; -} - sal_Bool TextEngine::DoesKeyChangeText( const KeyEvent& rKeyEvent ) { sal_Bool bDoesChange = sal_False; @@ -1509,11 +1480,7 @@ void TextEngine::SeekCursor( sal_uLong nPara, sal_uInt16 nPos, Font& rFont, Outp if ( ( ( pAttrib->GetStart() < nPos ) && ( pAttrib->GetEnd() >= nPos ) ) || !pNode->GetText().Len() ) { - if ( pAttrib->Which() != TEXTATTR_FONTCOLOR ) - { - pAttrib->GetAttr().SetFont( rFont ); - } - else + if ( pAttrib->Which() == TEXTATTR_FONTCOLOR ) { if ( pOutDev ) pOutDev->SetTextColor( ((TextAttribFontColor&)pAttrib->GetAttr()).GetColor() ); @@ -1553,15 +1520,6 @@ void TextEngine::SeekCursor( sal_uLong nPara, sal_uInt16 nPos, Font& rFont, Outp } } -void TextEngine::SetUpdateMode( sal_Bool bUp, TextView* pCurView, sal_Bool bForceUpdate ) -{ - sal_Bool bChanged = ( GetUpdateMode() != bUp ); - - mbUpdate = bUp; - if ( mbUpdate && ( bChanged || bForceUpdate ) ) - FormatAndUpdate( pCurView ); -} - void TextEngine::FormatAndUpdate( TextView* pCurView ) { if ( mbDowning ) @@ -1953,9 +1911,6 @@ void TextEngine::CreateTextPortions( sal_uLong nPara, sal_uInt16 nStartPos ) } DBG_ASSERT( pTEParaPortion->GetTextPortions().Count(), "Keine Portions?!" ); -#ifdef EDITDEBUG - DBG_ASSERT( pTEParaPortion->DbgCheckTextPortions(), "Portions kaputt?" ); -#endif } void TextEngine::RecalcTextPortion( sal_uLong nPara, sal_uInt16 nStartPos, short nNewChars ) @@ -2048,10 +2003,6 @@ void TextEngine::RecalcTextPortion( sal_uLong nPara, sal_uInt16 nStartPos, short } DBG_ASSERT( pTEParaPortion->GetTextPortions().Count(), "RecalcTextPortions: Keine mehr da!" ); } - -#ifdef EDITDEBUG - DBG_ASSERT( pTEParaPortion->DbgCheckTextPortions(), "Portions kaputt?" ); -#endif } void TextEngine::ImpPaint( OutputDevice* pOutDev, const Point& rStartPos, Rectangle const* pPaintArea, TextSelection const* pPaintRange, TextSelection const* pSelection ) @@ -2242,13 +2193,6 @@ void TextEngine::ImpPaint( OutputDevice* pOutDev, const Point& rStartPos, Rectan pOutDev->Erase( aTabArea ); } } -#ifdef EDITDEBUG - Rectangle aTabArea( aTmpPos, Point( aTmpPos.X()+nTxtWidth, aTmpPos.Y()+mnCharHeight-1 ) ); - Color aOldColor = pOutDev->GetFillColor(); - pOutDev->SetFillColor( (y%2) ? COL_RED : COL_GREEN ); - pOutDev->DrawRect( aTabArea ); - pOutDev->SetFillColor( aOldColor ); -#endif } break; default: OSL_FAIL( "ImpPaint: Unknown Portion-Type !" ); diff --git a/svtools/source/edit/textundo.cxx b/svtools/source/edit/textundo.cxx index 660c272397f5..56aea0d2c0fa 100644 --- a/svtools/source/edit/textundo.cxx +++ b/svtools/source/edit/textundo.cxx @@ -43,7 +43,6 @@ TYPEINIT1( TextUndoConnectParas, TextUndo ); TYPEINIT1( TextUndoSplitPara, TextUndo ); TYPEINIT1( TextUndoInsertChars, TextUndo ); TYPEINIT1( TextUndoRemoveChars, TextUndo ); -TYPEINIT1( TextUndoSetAttribs, TextUndo ); TextUndoManager::TextUndoManager( TextEngine* p ) @@ -296,44 +295,4 @@ void TextUndoRemoveChars::Redo() SetSelection( aPaM ); } - -TextUndoSetAttribs::TextUndoSetAttribs( TextEngine* pTextEngine, const TextSelection& rSel ) - : TextUndo( pTextEngine ), maSelection( rSel ) -{ - maSelection.Justify(); -// aNewAttribs.Set( rNewItems ); -// mbSetIsRemove = sal_False; -// mnRemoveWhich = 0; -// mnSpecial = 0; -} - -TextUndoSetAttribs::~TextUndoSetAttribs() -{ - // ............... -} - -void TextUndoSetAttribs::Undo() -{ - for ( sal_uLong nPara = maSelection.GetStart().GetPara(); nPara <= maSelection.GetEnd().GetPara(); nPara++ ) - { -// ContentAttribsInfo* pInf = aPrevAttribs[ (sal_uInt16)(nPara-aESel.nStartPara) ]; -// GetTextEngine()->RemoveCharAttribs( nPara ); -// TextNode* pNode = GetTextEngine()->GetTextDoc().GetObject( nPara ); -// for ( sal_uInt16 nAttr = 0; nAttr < pInf->GetPrevCharAttribs().Count(); nAttr++ ) -// { -// GetTextEngine()->GetTextDoc().InsertAttrib( pNode, pX->GetStart(), pX->GetEnd(), *pX->GetItem() ); -// } - } - SetSelection( maSelection ); -} - -void TextUndoSetAttribs::Redo() -{ -// if ( !bSetIsRemove ) -// GetTextEngine()->SetAttribs( aSel, aNewAttribs, nSpecial ); -// else -// GetTextEngine()->RemoveCharAttribs( aSel, bRemoveParaAttribs, nRemoveWhich ); - SetSelection( maSelection ); -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/edit/textview.cxx b/svtools/source/edit/textview.cxx index f2b370a9a923..1ee50008aeaf 100644 --- a/svtools/source/edit/textview.cxx +++ b/svtools/source/edit/textview.cxx @@ -1427,22 +1427,6 @@ void TextView::InsertText( const XubString& rStr, sal_Bool bSelect ) } */ -// OLD -TextPaM TextView::CursorLeft( const TextPaM& rPaM, sal_Bool bWordMode ) -{ - return bWordMode ? CursorWordLeft( rPaM ) : CursorLeft( rPaM, (sal_uInt16)i18n::CharacterIteratorMode::SKIPCELL ); - - // Remove (sal_uInt16) typecasts in this file when removing this method! -} - -// OLD -TextPaM TextView::CursorRight( const TextPaM& rPaM, sal_Bool bWordMode ) -{ - return bWordMode ? CursorWordRight( rPaM ) : CursorRight( rPaM, (sal_uInt16)i18n::CharacterIteratorMode::SKIPCELL ); - - // Remove (sal_uInt16) typecasts in this file when removing this method! -} - TextPaM TextView::CursorLeft( const TextPaM& rPaM, sal_uInt16 nCharacterIteratorMode ) { TextPaM aPaM( rPaM ); @@ -2006,15 +1990,6 @@ void TextView::SetPaintSelection( sal_Bool bPaint ) } } -void TextView::SetHighlightSelection( sal_Bool bSelectByHighlight ) -{ - if ( bSelectByHighlight != mpImpl->mbHighlightSelection ) - { - // Falls umschalten zwischendurch moeglich... - mpImpl->mbHighlightSelection = bSelectByHighlight; - } -} - sal_Bool TextView::Read( SvStream& rInput ) { sal_Bool bDone = mpImpl->mpTextEngine->Read( rInput, &mpImpl->maSelection ); @@ -2022,11 +1997,6 @@ sal_Bool TextView::Read( SvStream& rInput ) return bDone; } -sal_Bool TextView::Write( SvStream& rOutput ) -{ - return mpImpl->mpTextEngine->Read( rOutput, &mpImpl->maSelection ); -} - bool TextView::ImplTruncateNewText( rtl::OUString& rNewText ) const { bool bTruncated = false; @@ -2439,18 +2409,12 @@ const Point& TextView::GetStartDocPos() const { return mpImpl->maStartDocPos; } void TextView::SetAutoIndentMode( sal_Bool bAutoIndent ) { mpImpl->mbAutoIndent = bAutoIndent; } -sal_Bool TextView::IsAutoIndentMode() const -{ return mpImpl->mbAutoIndent; } sal_Bool TextView::IsReadOnly() const { return mpImpl->mbReadOnly; } void TextView::SetAutoScroll( sal_Bool bAutoScroll ) { mpImpl->mbAutoScroll = bAutoScroll; } sal_Bool TextView::IsAutoScroll() const { return mpImpl->mbAutoScroll; } -sal_Bool TextView::IsPaintSelection() const -{ return mpImpl->mbPaintSelection; } -sal_Bool TextView::IsHighlightSelection() const -{ return mpImpl->mbHighlightSelection; } sal_Bool TextView::HasSelection() const { return mpImpl->maSelection.HasRange(); } sal_Bool TextView::IsInsertMode() const diff --git a/svtools/source/edit/txtattr.cxx b/svtools/source/edit/txtattr.cxx index 022a40ae848f..e932cbee585a 100644 --- a/svtools/source/edit/txtattr.cxx +++ b/svtools/source/edit/txtattr.cxx @@ -39,15 +39,6 @@ TextAttrib::~TextAttrib() { } -void TextAttrib::SetFont( Font& ) const -{ -} - -TextAttrib* TextAttrib::Clone() const -{ - return NULL; -} - int TextAttrib::operator==( const TextAttrib& rAttr ) const { return mnWhich == rAttr.mnWhich; @@ -115,18 +106,6 @@ int TextAttribFontWeight::operator==( const TextAttrib& rAttr ) const } -TextAttribHyperLink::TextAttribHyperLink( const XubString& rURL ) - : TextAttrib( TEXTATTR_HYPERLINK ), maURL( rURL ) -{ - maColor = COL_BLUE; -} - -TextAttribHyperLink::TextAttribHyperLink( const XubString& rURL, const XubString& rDescription ) - : TextAttrib( TEXTATTR_HYPERLINK ), maURL( rURL ), maDescription( rDescription ) -{ - maColor = COL_BLUE; -} - TextAttribHyperLink::TextAttribHyperLink( const TextAttribHyperLink& rAttr ) : TextAttrib( rAttr ), maURL( rAttr.maURL ), maDescription( rAttr.maDescription ) { diff --git a/svtools/source/filter/exportdialog.cxx b/svtools/source/filter/exportdialog.cxx index 0a03904cf176..47a7a690153f 100644 --- a/svtools/source/filter/exportdialog.cxx +++ b/svtools/source/filter/exportdialog.cxx @@ -1512,4 +1512,4 @@ IMPL_LINK( ExportDialog, OK, void *, EMPTYARG ) return 0; } -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/filter/filter2.cxx b/svtools/source/filter/filter2.cxx index d34825312470..b973c9bdb3b0 100644 --- a/svtools/source/filter/filter2.cxx +++ b/svtools/source/filter/filter2.cxx @@ -1352,4 +1352,4 @@ String GraphicDescriptor::GetImportFormatShortName( sal_uInt16 nFormat ) return String( aKeyName, RTL_TEXTENCODING_ASCII_US ); } -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/filter/sgfbram.cxx b/svtools/source/filter/sgfbram.cxx index 8559cbee30eb..0ba3c5ed5833 100644 --- a/svtools/source/filter/sgfbram.cxx +++ b/svtools/source/filter/sgfbram.cxx @@ -561,18 +561,6 @@ sal_Bool SgfVectFilter(SvStream& rInp, GDIMetaFile& rMtf) return(bRet); } - -/************************************************************************* -|* -|* SgfFilterPScr() -|* -*************************************************************************/ -sal_Bool SgfFilterPScr(SvStream&, SgfHeader&, SgfEntry&) -{ - return sal_False; // PostSrcipt wird noch nicht unterstuetzt ! -} - - /************************************************************************* |* |* CheckSgfTyp() diff --git a/svtools/source/filter/sgvtext.cxx b/svtools/source/filter/sgvtext.cxx index ddda27f2efa2..ed83389d8fee 100644 --- a/svtools/source/filter/sgvtext.cxx +++ b/svtools/source/filter/sgvtext.cxx @@ -235,23 +235,7 @@ short hPoint2Sgf(short a) return short(b); } -short Sgf2hPoint(short a) -{ - long b; - b=long(a)*5*144/(127*SgfDpmm); - return short(b); -} - // End of Misc.Pas -///////////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////////// - - - -///////////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////////// // AbsRead.Pas // ====================================================================== @@ -304,32 +288,6 @@ UCHAR ConvertTextChar(UCHAR c) return c; } - - -sal_uInt16 GetSchnittBit(UCHAR c) -{ - sal_uInt16 r=0; - switch (c) { - case EscBold : r=TextBoldBit; break; - case EscRSlnt: r=TextRSlnBit; break; - case EscUndln: r=TextUndlBit; break; - case EscStrik: r=TextStrkBit; break; - case EscDbUnd: r=TextDbUnBit; break; - case EscDbStk: r=TextDbStBit; break; - case EscSupSc: r=TextSupSBit; break; - case EscSubSc: r=TextSubSBit; break; - case EscKaptF: r=TextKaptBit; break; - case EscLSlnt: r=TextLSlnBit; break; - case Esc2DShd: r=TextSh2DBit; break; - case Esc3DShd: r=TextSh3DBit; break; - case Esc4DShd: r=TextSh4DBit; break; - case EscEbShd: r=TextShEbBit; - } - return r; -} - - - long ChgValue(long Def, long Min, long Max, UCHAR FlgVal, long NumVal) { long r=0; diff --git a/svtools/source/filter/wmf/emfwr.cxx b/svtools/source/filter/wmf/emfwr.cxx index 4efaa1bbbb88..09cd1876bf96 100644 --- a/svtools/source/filter/wmf/emfwr.cxx +++ b/svtools/source/filter/wmf/emfwr.cxx @@ -30,6 +30,7 @@ #include "precompiled_svtools.hxx" #include "emfwr.hxx" +#include <rtl/strbuf.hxx> #include <vcl/salbtype.hxx> #include <basegfx/polygon/b2dpolygon.hxx> #include <basegfx/polygon/b2dpolypolygon.hxx> @@ -1429,7 +1430,9 @@ void EMFWriter::ImplWrite( const GDIMetaFile& rMtf ) break; default: - OSL_FAIL( ( ByteString( "EMFWriter::ImplWriteActions: unsupported MetaAction #" ) += ByteString::CreateFromInt32( nType ) ).GetBuffer() ); + OSL_FAIL(rtl::OStringBuffer(RTL_CONSTASCII_STRINGPARAM( + "EMFWriter::ImplWriteActions: unsupported MetaAction #" )). + append(static_cast<sal_Int32>(nType)).getStr()); break; } } diff --git a/svtools/source/filter/wmf/enhwmf.cxx b/svtools/source/filter/wmf/enhwmf.cxx index 23990473aa60..ce7842b0c270 100644 --- a/svtools/source/filter/wmf/enhwmf.cxx +++ b/svtools/source/filter/wmf/enhwmf.cxx @@ -261,22 +261,27 @@ void EnhWMFReader::ReadEMFPlusComment(sal_uInt32 length, sal_Bool& bHaveDC) } bEMFPlus = true; + sal_Size pos = pWMF->Tell(); void *buffer = malloc( length ); - - int pos = pWMF->Tell(); pOut->PassEMFPlus( buffer, pWMF->Read( buffer, length ) ); + free( buffer ); pWMF->Seek( pos ); bHaveDC = false; - length -= 4; + OSL_ASSERT(length >= 4); + //reduce by 32bit length itself, skip in SeekRel if + //impossibly unavailble + sal_uInt32 nRemainder = length >= 4 ? length-4 : length; - while (length > 0) { - sal_uInt16 type, flags; - sal_uInt32 size, dataSize; - sal_uInt32 next; + const size_t nRequiredHeaderSize = 12; + while (nRemainder > nRequiredHeaderSize) + { + sal_uInt16 type(0), flags(0); + sal_uInt32 size(0), dataSize(0); *pWMF >> type >> flags >> size >> dataSize; + nRemainder -= nRequiredHeaderSize; EMFP_DEBUG(printf ("\t\tEMF+ record type: %d\n", type)); @@ -286,14 +291,16 @@ void EnhWMFReader::ReadEMFPlusComment(sal_uInt32 length, sal_Bool& bHaveDC) EMFP_DEBUG(printf ("\t\tEMF+ lock DC (device context)\n", type)); } - next = pWMF->Tell() + ( size - 12 ); - - length -= size; - - pWMF->Seek( next ); + //Get the length of the remaining data of this record based + //on the alleged size + sal_uInt32 nRemainingRecordData = size >= nRequiredHeaderSize ? + size-nRequiredHeaderSize : 0; + //clip to available size + nRemainingRecordData = std::min(nRemainingRecordData, nRemainder); + pWMF->SeekRel(nRemainingRecordData); + nRemainder -= nRemainingRecordData; } - - free( buffer ); + pWMF->SeekRel(nRemainder); } void EnhWMFReader::ReadGDIComment() diff --git a/svtools/source/filter/wmf/winmtf.hxx b/svtools/source/filter/wmf/winmtf.hxx index 16e9296a2b8f..270af93a4675 100644 --- a/svtools/source/filter/wmf/winmtf.hxx +++ b/svtools/source/filter/wmf/winmtf.hxx @@ -298,7 +298,6 @@ struct WMF_APMFILEHEADER; //============================ WMFReader ================================== - #ifdef WIN_MTF_ASSERT #define WIN_MTF_ASSERT_INIT 0x80000000 #define WIN_MTF_ASSERT_ONCE 0x40000000 @@ -319,35 +318,34 @@ public : void excludeClipRect( const Rectangle& rRect ); void moveClipRegion( const Size& rSize ); - bool isEmpty() const { return maClip.isCleared(); } + bool isEmpty() const { return maClip.isCleared(); } basegfx::B2DPolyPolygon getClipPath() const; - bool operator==( const WinMtfClipPath& rPath ) const - { - return maClip == rPath.maClip; - }; + bool operator==( const WinMtfClipPath& rPath ) const + { + return maClip == rPath.maClip; + }; }; class WinMtfPathObj : public PolyPolygon { - sal_Bool bClosed; + sal_Bool bClosed; - public : +public : WinMtfPathObj() { bClosed = sal_True; } - void Init() { Clear(); bClosed = sal_True; }; - void ClosePath(); - - void AddPoint( const Point& rPoint ); - void AddPolygon( const Polygon& rPoly ); - void AddPolyLine( const Polygon& rPoly ); - void AddPolyPolygon( const PolyPolygon& rPolyPolygon ); + void Init() { Clear(); bClosed = sal_True; }; + void ClosePath(); + void AddPoint( const Point& rPoint ); + void AddPolygon( const Polygon& rPoly ); + void AddPolyLine( const Polygon& rPoly ); + void AddPolyPolygon( const PolyPolygon& rPolyPolygon ); }; struct WinMtfFontStyle { - Font aFont; + Font aFont; WinMtfFontStyle( LOGFONTW& rLogFont ); }; @@ -362,7 +360,7 @@ typedef enum { struct WinMtfFillStyle { Color aFillColor; - sal_Bool bTransparent; + sal_Bool bTransparent; WinMtfFillStyleType aType; Bitmap aBmp; @@ -387,11 +385,35 @@ struct WinMtfFillStyle } sal_Bool operator==( const WinMtfFillStyle& rStyle ) - { return ( ( aFillColor == rStyle.aFillColor ) && ( bTransparent == rStyle.bTransparent ) && ( aType == rStyle.aType ) ); } + { + return ( ( aFillColor == rStyle.aFillColor ) + && ( bTransparent == rStyle.bTransparent ) + && ( aType == rStyle.aType ) + ); + } sal_Bool operator==( WinMtfFillStyle* pStyle ) - { return ( ( aFillColor == pStyle->aFillColor ) && ( bTransparent == pStyle->bTransparent ) && ( aType == pStyle->aType ) ); } - WinMtfFillStyle& operator=( const WinMtfFillStyle& rStyle ) { aFillColor = rStyle.aFillColor; bTransparent = rStyle.bTransparent; aBmp = rStyle.aBmp; aType = rStyle.aType; return *this; } - WinMtfFillStyle& operator=( WinMtfFillStyle* pStyle ) { aFillColor = pStyle->aFillColor; bTransparent = pStyle->bTransparent; aBmp = pStyle->aBmp; aType = pStyle->aType; return *this; } + { + return ( ( aFillColor == pStyle->aFillColor ) + && ( bTransparent == pStyle->bTransparent ) + && ( aType == pStyle->aType ) + ); + } + WinMtfFillStyle& operator=( const WinMtfFillStyle& rStyle ) + { + aFillColor = rStyle.aFillColor; + bTransparent = rStyle.bTransparent; + aBmp = rStyle.aBmp; + aType = rStyle.aType; + return *this; + } + WinMtfFillStyle& operator=( WinMtfFillStyle* pStyle ) + { + aFillColor = pStyle->aFillColor; + bTransparent = pStyle->bTransparent; + aBmp = pStyle->aBmp; + aType = pStyle->aType; + return *this; + } }; // ----------------------------------------------------------------------------- @@ -415,8 +437,20 @@ struct WinMtfLineStyle aLineInfo ( rStyle ), bTransparent( bTrans ) {} - sal_Bool operator==( const WinMtfLineStyle& rStyle ) { return ( ( aLineColor == rStyle.aLineColor ) && ( bTransparent == rStyle.bTransparent ) && ( aLineInfo == rStyle.aLineInfo ) ); } - sal_Bool operator==( WinMtfLineStyle* pStyle ) { return ( ( aLineColor == pStyle->aLineColor ) && ( bTransparent == pStyle->bTransparent ) && ( aLineInfo == pStyle->aLineInfo ) ); } + sal_Bool operator==( const WinMtfLineStyle& rStyle ) + { + return ( ( aLineColor == rStyle.aLineColor ) + && ( bTransparent == rStyle.bTransparent ) + && ( aLineInfo == rStyle.aLineInfo ) + ); + } + sal_Bool operator==( WinMtfLineStyle* pStyle ) + { + return ( ( aLineColor == pStyle->aLineColor ) + && ( bTransparent == pStyle->bTransparent ) + && ( aLineInfo == pStyle->aLineInfo ) + ); + } WinMtfLineStyle& operator=( const WinMtfLineStyle& rStyle ) { aLineColor = rStyle.aLineColor; @@ -490,13 +524,30 @@ struct BSaveStruct sal_uInt32 nWinRop; WinMtfFillStyle aStyle; - BSaveStruct( const Bitmap& rBmp, const Rectangle& rOutRect, sal_uInt32 nRop, WinMtfFillStyle& rStyle ) : - aBmp( rBmp ), aOutRect( rOutRect ), nWinRop( nRop ), aStyle ( rStyle ){} + BSaveStruct( + const Bitmap& rBmp, + const Rectangle& rOutRect, + sal_uInt32 nRop, + WinMtfFillStyle& rStyle + ) + : aBmp( rBmp ) + , aOutRect( rOutRect ) + , nWinRop( nRop ) + , aStyle ( rStyle ) + {} }; // ----------------------------------------------------------------------------- -enum GDIObjectType { GDI_DUMMY = 0, GDI_PEN = 1, GDI_BRUSH = 2, GDI_FONT = 3, GDI_PALETTE = 4, GDI_BITMAP = 5, GDI_REGION = 6 }; +enum GDIObjectType { + GDI_DUMMY = 0, + GDI_PEN = 1, + GDI_BRUSH = 2, + GDI_FONT = 3, + GDI_PALETTE = 4, + GDI_BITMAP = 5, + GDI_REGION = 6 +}; struct GDIObj { @@ -546,163 +597,193 @@ struct GDIObj class WinMtfOutput { - WinMtfPathObj aPathObj; - WinMtfClipPath aClipPath; - - WinMtfLineStyle maLatestLineStyle; - WinMtfLineStyle maLineStyle; - WinMtfFillStyle maLatestFillStyle; - WinMtfFillStyle maFillStyle; - Font maLatestFont; - Font maFont; - sal_uInt32 mnLatestTextAlign; - sal_uInt32 mnTextAlign; - Color maLatestTextColor; - Color maTextColor; - Color maLatestBkColor; - Color maBkColor; - sal_uInt32 mnLatestTextLayoutMode; - sal_uInt32 mnTextLayoutMode; - sal_uInt32 mnLatestBkMode; - sal_uInt32 mnBkMode; - RasterOp meLatestRasterOp; - RasterOp meRasterOp; - - std::vector< GDIObj* > vGDIObj; - - Point maActPos; - - sal_uInt32 mnRop; - sal_Bool mbNopMode; - sal_Bool mbFillStyleSelected; - sal_Bool mbClipNeedsUpdate; - sal_Bool mbComplexClip; - - std::vector< SaveStructPtr > vSaveStack; - - sal_uInt32 mnGfxMode; - sal_uInt32 mnMapMode; - sal_uInt16 mnUnitsPerInch; - - XForm maXForm; - sal_Int32 mnDevOrgX, mnDevOrgY; - sal_Int32 mnDevWidth, mnDevHeight; - sal_Int32 mnWinOrgX, mnWinOrgY; // aktuelles Window-Origin - sal_Int32 mnWinExtX, mnWinExtY; // aktuelles Window-Extent - - sal_Int32 mnPixX, mnPixY; // Reference Device in pixel - sal_Int32 mnMillX, mnMillY; // Reference Device in Mill - Rectangle mrclFrame; // rectangle in logical units 1/100th mm - Rectangle mrclBounds; - - GDIMetaFile* mpGDIMetaFile; - - void UpdateLineStyle(); - void UpdateFillStyle(); - - Point ImplMap( const Point& rPt ); - Size ImplMap( const Size& rSz ); - Rectangle ImplMap( const Rectangle& rRectangle ); - void ImplMap( Font& rFont ); - Polygon& ImplMap( Polygon& rPolygon ); - PolyPolygon& ImplMap( PolyPolygon& rPolyPolygon ); - void ImplResizeObjectArry( sal_uInt32 nNewEntry ); - void ImplSetNonPersistentLineColorTransparenz(); - void ImplDrawClippedPolyPolygon( const PolyPolygon& rPolyPoly ); - void ImplDrawBitmap( const Point& rPos, const Size& rSize, const BitmapEx rBitmap ); - - public: - - void SetDevOrg( const Point& rPoint ); - void SetDevOrgOffset( sal_Int32 nXAdd, sal_Int32 nYAdd ); - void SetDevExt( const Size& rSize ); - void ScaleDevExt( double fX, double fY ); - - void SetWinOrg( const Point& rPoint ); - void SetWinOrgOffset( sal_Int32 nX, sal_Int32 nY ); - void SetWinExt( const Size& rSize ); - void ScaleWinExt( double fX, double fY ); - - void SetrclBounds( const Rectangle& rRect ); - void SetrclFrame( const Rectangle& rRect ); - void SetRefPix( const Size& rSize ); - void SetRefMill( const Size& rSize ); - - sal_uInt32 GetMapMode() const { return mnMapMode; }; - void SetMapMode( sal_uInt32 mnMapMode ); - void SetUnitsPerInch( sal_uInt16 nUnitsPerInch ); - void SetWorldTransform( const XForm& rXForm ); - void ModifyWorldTransform( const XForm& rXForm, sal_uInt32 nMode ); - - void Push(); - void Pop(); - - sal_uInt32 SetRasterOp( sal_uInt32 nRasterOp ); - void StrokeAndFillPath( sal_Bool bStroke, sal_Bool bFill ); - - void SetGfxMode( sal_Int32 nGfxMode ){ mnGfxMode = nGfxMode; }; - sal_Int32 GetGfxMode() const { return mnGfxMode; }; - void SetBkMode( sal_uInt32 nMode ); - void SetBkColor( const Color& rColor ); - void SetTextColor( const Color& rColor ); - void SetTextAlign( sal_uInt32 nAlign ); - void CreateObject( GDIObjectType, void* pStyle = NULL ); - void CreateObject( sal_Int32 nIndex, GDIObjectType, void* pStyle = NULL ); - void DeleteObject( sal_Int32 nIndex ); - void SelectObject( sal_Int32 nIndex ); - CharSet GetCharSet(){ return maFont.GetCharSet(); }; - WinMtfFillStyle& GetFillStyle () { return maFillStyle; } - void SetFont( const Font& rFont ); - const Font& GetFont() const; - void SetTextLayoutMode( const sal_uInt32 nLayoutMode ); - sal_uInt32 GetTextLayoutMode() const; - - void ClearPath(){ aPathObj.Init(); }; - void ClosePath(){ aPathObj.ClosePath(); }; - const PolyPolygon& GetPathObj(){ return aPathObj; }; - - void MoveTo( const Point& rPoint, sal_Bool bRecordPath = sal_False ); - void LineTo( const Point& rPoint, sal_Bool bRecordPath = sal_False ); - void DrawPixel( const Point& rSource, const Color& rColor ); - void DrawLine( const Point& rSource, const Point& rDest ); - void DrawRect( const Rectangle& rRect, sal_Bool bEdge = sal_True ); - void DrawRoundRect( const Rectangle& rRect, const Size& rSize ); - void DrawEllipse( const Rectangle& rRect ); - void DrawArc( const Rectangle& rRect, const Point& rStartAngle, const Point& rEndAngle, sal_Bool bDrawTo = sal_False ); - void DrawPie( const Rectangle& rRect, const Point& rStartAngle, const Point& rEndAngle ); - void DrawChord( const Rectangle& rRect, const Point& rStartAngle, const Point& rEndAngle ); - void DrawPolygon( Polygon& rPolygon, sal_Bool bRecordPath = sal_False ); - void DrawPolyPolygon( PolyPolygon& rPolyPolygon, sal_Bool bRecordPath = sal_False ); - void DrawPolyLine( Polygon& rPolygon, sal_Bool bDrawTo = sal_False, sal_Bool bRecordPath = sal_False ); - void DrawPolyBezier( Polygon& rPolygin, sal_Bool bDrawTo = sal_False, sal_Bool bRecordPath = sal_False ); - void DrawText( Point& rPosition, String& rString, sal_Int32* pDXArry = NULL, sal_Bool bRecordPath = sal_False, - sal_Int32 nGraphicsMode = GM_COMPATIBLE ); - void ResolveBitmapActions( List& rSaveList ); - - void IntersectClipRect( const Rectangle& rRect ); - void ExcludeClipRect( const Rectangle& rRect ); - void MoveClipRegion( const Size& rSize ); - void SetClipPath( const PolyPolygon& rPolyPoly, sal_Int32 nClippingMode, sal_Bool bIsMapped ); - void UpdateClipRegion(); - void AddFromGDIMetaFile( GDIMetaFile& rGDIMetaFile ); - - void PassEMFPlus( void* pBuffer, sal_uInt32 nLength ); - void PassEMFPlusHeaderInfo(); - - WinMtfOutput( GDIMetaFile& rGDIMetaFile ); - virtual ~WinMtfOutput(); + WinMtfPathObj aPathObj; + WinMtfClipPath aClipPath; + + WinMtfLineStyle maLatestLineStyle; + WinMtfLineStyle maLineStyle; + WinMtfFillStyle maLatestFillStyle; + WinMtfFillStyle maFillStyle; + Font maLatestFont; + Font maFont; + sal_uInt32 mnLatestTextAlign; + sal_uInt32 mnTextAlign; + Color maLatestTextColor; + Color maTextColor; + Color maLatestBkColor; + Color maBkColor; + sal_uInt32 mnLatestTextLayoutMode; + sal_uInt32 mnTextLayoutMode; + sal_uInt32 mnLatestBkMode; + sal_uInt32 mnBkMode; + RasterOp meLatestRasterOp; + RasterOp meRasterOp; + + std::vector< GDIObj* > vGDIObj; + + Point maActPos; + + sal_uInt32 mnRop; + sal_Bool mbNopMode; + sal_Bool mbFillStyleSelected; + sal_Bool mbClipNeedsUpdate; + sal_Bool mbComplexClip; + + std::vector< SaveStructPtr > vSaveStack; + + sal_uInt32 mnGfxMode; + sal_uInt32 mnMapMode; + sal_uInt16 mnUnitsPerInch; + + XForm maXForm; + sal_Int32 mnDevOrgX, mnDevOrgY; + sal_Int32 mnDevWidth, mnDevHeight; + sal_Int32 mnWinOrgX, mnWinOrgY; // aktuelles Window-Origin + sal_Int32 mnWinExtX, mnWinExtY; // aktuelles Window-Extent + + sal_Int32 mnPixX, mnPixY; // Reference Device in pixel + sal_Int32 mnMillX, mnMillY; // Reference Device in Mill + Rectangle mrclFrame; // rectangle in logical units 1/100th mm + Rectangle mrclBounds; + + GDIMetaFile* mpGDIMetaFile; + + void UpdateLineStyle(); + void UpdateFillStyle(); + + Point ImplMap( const Point& rPt ); + Size ImplMap( const Size& rSz ); + Rectangle ImplMap( const Rectangle& rRectangle ); + void ImplMap( Font& rFont ); + Polygon& ImplMap( Polygon& rPolygon ); + PolyPolygon& ImplMap( PolyPolygon& rPolyPolygon ); + void ImplResizeObjectArry( sal_uInt32 nNewEntry ); + void ImplSetNonPersistentLineColorTransparenz(); + void ImplDrawClippedPolyPolygon( const PolyPolygon& rPolyPoly ); + void ImplDrawBitmap( const Point& rPos, const Size& rSize, const BitmapEx rBitmap ); + +public: + + void SetDevOrg( const Point& rPoint ); + void SetDevOrgOffset( sal_Int32 nXAdd, sal_Int32 nYAdd ); + void SetDevExt( const Size& rSize ); + void ScaleDevExt( double fX, double fY ); + + void SetWinOrg( const Point& rPoint ); + void SetWinOrgOffset( sal_Int32 nX, sal_Int32 nY ); + void SetWinExt( const Size& rSize ); + void ScaleWinExt( double fX, double fY ); + + void SetrclBounds( const Rectangle& rRect ); + void SetrclFrame( const Rectangle& rRect ); + void SetRefPix( const Size& rSize ); + void SetRefMill( const Size& rSize ); + + sal_uInt32 GetMapMode() const { return mnMapMode; }; + void SetMapMode( sal_uInt32 mnMapMode ); + void SetUnitsPerInch( sal_uInt16 nUnitsPerInch ); + void SetWorldTransform( const XForm& rXForm ); + void ModifyWorldTransform( const XForm& rXForm, sal_uInt32 nMode ); + + void Push(); + void Pop(); + + sal_uInt32 SetRasterOp( sal_uInt32 nRasterOp ); + void StrokeAndFillPath( sal_Bool bStroke, sal_Bool bFill ); + + void SetGfxMode( sal_Int32 nGfxMode ){ mnGfxMode = nGfxMode; }; + sal_Int32 GetGfxMode() const { return mnGfxMode; }; + void SetBkMode( sal_uInt32 nMode ); + void SetBkColor( const Color& rColor ); + void SetTextColor( const Color& rColor ); + void SetTextAlign( sal_uInt32 nAlign ); + void CreateObject( GDIObjectType, void* pStyle = NULL ); + void CreateObject( sal_Int32 nIndex, GDIObjectType, void* pStyle = NULL ); + void DeleteObject( sal_Int32 nIndex ); + void SelectObject( sal_Int32 nIndex ); + CharSet GetCharSet(){ return maFont.GetCharSet(); }; + WinMtfFillStyle& GetFillStyle () { return maFillStyle; } + void SetFont( const Font& rFont ); + const Font& GetFont() const; + void SetTextLayoutMode( const sal_uInt32 nLayoutMode ); + sal_uInt32 GetTextLayoutMode() const; + + void ClearPath(){ aPathObj.Init(); }; + void ClosePath(){ aPathObj.ClosePath(); }; + const PolyPolygon& GetPathObj(){ return aPathObj; }; + + void MoveTo( const Point& rPoint, sal_Bool bRecordPath = sal_False ); + void LineTo( const Point& rPoint, sal_Bool bRecordPath = sal_False ); + void DrawPixel( const Point& rSource, const Color& rColor ); + void DrawLine( const Point& rSource, const Point& rDest ); + void DrawRect( const Rectangle& rRect, sal_Bool bEdge = sal_True ); + void DrawRoundRect( const Rectangle& rRect, const Size& rSize ); + void DrawEllipse( const Rectangle& rRect ); + void DrawArc( + const Rectangle& rRect, + const Point& rStartAngle, + const Point& rEndAngle, + sal_Bool bDrawTo = sal_False + ); + void DrawPie( + const Rectangle& rRect, + const Point& rStartAngle, + const Point& rEndAngle + ); + void DrawChord( + const Rectangle& rRect, + const Point& rStartAngle, + const Point& rEndAngle + ); + void DrawPolygon( Polygon& rPolygon, sal_Bool bRecordPath = sal_False ); + void DrawPolyPolygon( PolyPolygon& rPolyPolygon, sal_Bool bRecordPath = sal_False ); + void DrawPolyLine( + Polygon& rPolygon, + sal_Bool bDrawTo = sal_False, + sal_Bool bRecordPath = sal_False + ); + void DrawPolyBezier( + Polygon& rPolygin, + sal_Bool bDrawTo = sal_False, + sal_Bool bRecordPath = sal_False + ); + void DrawText( + Point& rPosition, + String& rString, + sal_Int32* pDXArry = NULL, + sal_Bool bRecordPath = sal_False, + sal_Int32 nGraphicsMode = GM_COMPATIBLE + ); + void ResolveBitmapActions( List& rSaveList ); + + void IntersectClipRect( const Rectangle& rRect ); + void ExcludeClipRect( const Rectangle& rRect ); + void MoveClipRegion( const Size& rSize ); + void SetClipPath( + const PolyPolygon& rPolyPoly, + sal_Int32 nClippingMode, + sal_Bool bIsMapped + ); + void UpdateClipRegion(); + void AddFromGDIMetaFile( GDIMetaFile& rGDIMetaFile ); + + void PassEMFPlus( void* pBuffer, sal_uInt32 nLength ); + void PassEMFPlusHeaderInfo(); + + WinMtfOutput( GDIMetaFile& rGDIMetaFile ); + virtual ~WinMtfOutput(); }; // ----------------------------------------------------------------------------- class WinMtf { - protected: +protected: WinMtfOutput* pOut; // SvStream* pWMF; // Die einzulesende WMF/EMF-Datei - sal_uInt32 nStartPos, nEndPos; + sal_uInt32 nStartPos, nEndPos; List aBmpSaveList; FilterConfigItem* pFilterConfigItem; @@ -714,10 +795,14 @@ class WinMtf Color ReadColor(); void Callback( sal_uInt16 nPercent ); - WinMtf( WinMtfOutput* pOut, SvStream& rStreamWMF, FilterConfigItem* pConfigItem = NULL ); + WinMtf( + WinMtfOutput* pOut, + SvStream& rStreamWMF, + FilterConfigItem* pConfigItem = NULL + ); ~WinMtf(); - public: +public: }; @@ -730,16 +815,26 @@ class EnhWMFReader : public WinMtf sal_Bool bEMFPlus; - sal_Bool ReadHeader(); - Rectangle ReadRectangle( sal_Int32, sal_Int32, sal_Int32, sal_Int32 ); // Liesst und konvertiert ein Rechteck + sal_Bool ReadHeader(); + // Liesst und konvertiert ein Rechteck + Rectangle ReadRectangle( sal_Int32, sal_Int32, sal_Int32, sal_Int32 ); void ImplExtTextOut( sal_Bool bWideCharakter ); public: - EnhWMFReader( SvStream& rStreamWMF, GDIMetaFile& rGDIMetaFile, FilterConfigItem* pConfigItem = NULL ) - : WinMtf( new WinMtfOutput( rGDIMetaFile ), rStreamWMF, pConfigItem ), bRecordPath( sal_False ), bEMFPlus( sal_False ) {}; + EnhWMFReader( + SvStream& rStreamWMF, + GDIMetaFile& rGDIMetaFile, + FilterConfigItem* pConfigItem = NULL + ) + : WinMtf( new WinMtfOutput( rGDIMetaFile ) + , rStreamWMF + , pConfigItem ) + , bRecordPath( sal_False ) + , bEMFPlus( sal_False ) + {}; ~EnhWMFReader(); - sal_Bool ReadEnhWMF(); + sal_Bool ReadEnhWMF(); void ReadEMFPlusComment(sal_uInt32 length, sal_Bool& bHaveDC); void ReadGDIComment(); }; @@ -751,7 +846,7 @@ class WMFReader : public WinMtf private: VirtualDevice aVDev; // just for the purpose of "IsFontAvailable" - sal_uInt16 nUnitsPerInch; + sal_uInt16 nUnitsPerInch; sal_uInt32 nRecSize; // embedded EMF data @@ -771,7 +866,7 @@ private: sal_uInt32 nUnicodeEscapeAction; // Liesst den Kopf der WMF-Datei - sal_Bool ReadHeader(WMF_APMFILEHEADER *pAPMHeader); + sal_Bool ReadHeader( WMF_APMFILEHEADER *pAPMHeader ); // Liesst die Parameter des Rocords mit der Funktionsnummer nFunction. void ReadRecordParams( sal_uInt16 nFunction ); @@ -784,10 +879,14 @@ private: public: - WMFReader( SvStream& rStreamWMF, GDIMetaFile& rGDIMetaFile, FilterConfigItem* pConfigItem = NULL ) + WMFReader( + SvStream& rStreamWMF, + GDIMetaFile& rGDIMetaFile, + FilterConfigItem* pConfigItem = NULL + ) : WinMtf( new WinMtfOutput( rGDIMetaFile ), rStreamWMF, pConfigItem ) , pEMFStream(NULL) - {} + {} ~WMFReader(); diff --git a/svtools/source/filter/wmf/wmf.cxx b/svtools/source/filter/wmf/wmf.cxx index 9b2a8edf2d6e..03923ddc508a 100644 --- a/svtools/source/filter/wmf/wmf.cxx +++ b/svtools/source/filter/wmf/wmf.cxx @@ -102,13 +102,6 @@ sal_Bool ConvertGDIMetaFileToEMF( const GDIMetaFile & rMTF, SvStream & rTargetSt // ----------------------------------------------------------------------------- -sal_Bool WriteWindowMetafile( SvStream& rStream, const GDIMetaFile& rMTF ) -{ - return WMFWriter().WriteWMF( rMTF, rStream, NULL ); -} - -// ----------------------------------------------------------------------------- - sal_Bool WriteWindowMetafileBits( SvStream& rStream, const GDIMetaFile& rMTF ) { return WMFWriter().WriteWMF( rMTF, rStream, NULL, sal_False ); diff --git a/svtools/source/graphic/grfcache.cxx b/svtools/source/graphic/grfcache.cxx index df7bfa9f88b1..e0aa6595f6ac 100644 --- a/svtools/source/graphic/grfcache.cxx +++ b/svtools/source/graphic/grfcache.cxx @@ -162,15 +162,16 @@ class GraphicCacheEntry { private: - List maGraphicObjectList; + GraphicObjectList_impl maGraphicObjectList; + GraphicID maID; GfxLink maGfxLink; BitmapEx* mpBmpEx; GDIMetaFile* mpMtf; Animation* mpAnimation; - sal_Bool mbSwappedAll; + bool mbSwappedAll; - sal_Bool ImplInit( const GraphicObject& rObj ); + bool ImplInit( const GraphicObject& rObj ); void ImplFillSubstitute( Graphic& rSubstitute ); public: @@ -181,13 +182,13 @@ public: const GraphicID& GetID() const { return maID; } void AddGraphicObjectReference( const GraphicObject& rObj, Graphic& rSubstitute ); - sal_Bool ReleaseGraphicObjectReference( const GraphicObject& rObj ); - sal_uLong GetGraphicObjectReferenceCount() { return maGraphicObjectList.Count(); } - sal_Bool HasGraphicObjectReference( const GraphicObject& rObj ); + bool ReleaseGraphicObjectReference( const GraphicObject& rObj ); + size_t GetGraphicObjectReferenceCount() { return maGraphicObjectList.size(); } + bool HasGraphicObjectReference( const GraphicObject& rObj ); void TryToSwapIn(); void GraphicObjectWasSwappedOut( const GraphicObject& rObj ); - sal_Bool FillSwappedGraphicObject( const GraphicObject& rObj, Graphic& rSubstitute ); + bool FillSwappedGraphicObject( const GraphicObject& rObj, Graphic& rSubstitute ); void GraphicObjectWasSwappedIn( const GraphicObject& rObj ); }; @@ -200,14 +201,17 @@ GraphicCacheEntry::GraphicCacheEntry( const GraphicObject& rObj ) : mpAnimation ( NULL ), mbSwappedAll ( !ImplInit( rObj ) ) { - maGraphicObjectList.Insert( (void*) &rObj, LIST_APPEND ); + maGraphicObjectList.push_back( (GraphicObject*)&rObj ); } // ----------------------------------------------------------------------------- GraphicCacheEntry::~GraphicCacheEntry() { - DBG_ASSERT( !maGraphicObjectList.Count(), "GraphicCacheEntry::~GraphicCacheEntry(): Not all GraphicObjects are removed from this entry" ); + DBG_ASSERT( + maGraphicObjectList.empty(), + "GraphicCacheEntry::~GraphicCacheEntry(): Not all GraphicObjects are removed from this entry" + ); delete mpBmpEx; delete mpMtf; @@ -216,9 +220,9 @@ GraphicCacheEntry::~GraphicCacheEntry() // ----------------------------------------------------------------------------- -sal_Bool GraphicCacheEntry::ImplInit( const GraphicObject& rObj ) +bool GraphicCacheEntry::ImplInit( const GraphicObject& rObj ) { - sal_Bool bRet; + bool bRet = false; if( !rObj.IsSwappedOut() ) { @@ -260,10 +264,8 @@ sal_Bool GraphicCacheEntry::ImplInit( const GraphicObject& rObj ) else maGfxLink = GfxLink(); - bRet = sal_True; + bRet = true; } - else - bRet = sal_False; return bRet; } @@ -277,9 +279,9 @@ void GraphicCacheEntry::ImplFillSubstitute( Graphic& rSubstitute ) const MapMode aPrefMapMode( rSubstitute.GetPrefMapMode() ); const Link aAnimationNotifyHdl( rSubstitute.GetAnimationNotifyHdl() ); const String aDocFileName( rSubstitute.GetDocFileName() ); - const sal_uLong nDocFilePos = rSubstitute.GetDocFilePos(); + const sal_uLong nDocFilePos = rSubstitute.GetDocFilePos(); const GraphicType eOldType = rSubstitute.GetType(); - const sal_Bool bDefaultType = ( rSubstitute.GetType() == GRAPHIC_DEFAULT ); + const bool bDefaultType = ( rSubstitute.GetType() == GRAPHIC_DEFAULT ); if( rSubstitute.IsLink() && ( GFX_LINK_TYPE_NONE == maGfxLink.GetType() ) ) maGfxLink = rSubstitute.GetLink(); @@ -316,36 +318,37 @@ void GraphicCacheEntry::AddGraphicObjectReference( const GraphicObject& rObj, Gr mbSwappedAll = !ImplInit( rObj ); ImplFillSubstitute( rSubstitute ); - maGraphicObjectList.Insert( (void*) &rObj, LIST_APPEND ); + maGraphicObjectList.push_back( (GraphicObject*) &rObj ); } // ----------------------------------------------------------------------------- -sal_Bool GraphicCacheEntry::ReleaseGraphicObjectReference( const GraphicObject& rObj ) +bool GraphicCacheEntry::ReleaseGraphicObjectReference( const GraphicObject& rObj ) { - sal_Bool bRet = sal_False; - - for( void* pObj = maGraphicObjectList.First(); !bRet && pObj; pObj = maGraphicObjectList.Next() ) - { - if( &rObj == (GraphicObject*) pObj ) + for( + GraphicObjectList_impl::iterator it = maGraphicObjectList.begin(); + it != maGraphicObjectList.end(); + ++it + ) { + if( &rObj == *it ) { - maGraphicObjectList.Remove( pObj ); - bRet = sal_True; + maGraphicObjectList.erase( it ); + return true; } } - return bRet; + return false; } // ----------------------------------------------------------------------------- -sal_Bool GraphicCacheEntry::HasGraphicObjectReference( const GraphicObject& rObj ) +bool GraphicCacheEntry::HasGraphicObjectReference( const GraphicObject& rObj ) { - sal_Bool bRet = sal_False; + bool bRet = false; - for( void* pObj = maGraphicObjectList.First(); !bRet && pObj; pObj = maGraphicObjectList.Next() ) - if( &rObj == (GraphicObject*) pObj ) - bRet = sal_True; + for( size_t i = 0, n = maGraphicObjectList.size(); ( i < n ) && !bRet; ++i ) + if( &rObj == maGraphicObjectList[ i ] ) + bRet = true; return bRet; } @@ -354,41 +357,39 @@ sal_Bool GraphicCacheEntry::HasGraphicObjectReference( const GraphicObject& rObj void GraphicCacheEntry::TryToSwapIn() { - if( mbSwappedAll && maGraphicObjectList.Count() ) - ( (GraphicObject*) maGraphicObjectList.First() )->FireSwapInRequest(); + if( mbSwappedAll && !maGraphicObjectList.empty() ) + maGraphicObjectList.front()->FireSwapInRequest(); } // ----------------------------------------------------------------------------- void GraphicCacheEntry::GraphicObjectWasSwappedOut( const GraphicObject& /*rObj*/ ) { - mbSwappedAll = sal_True; + mbSwappedAll = true; - for( void* pObj = maGraphicObjectList.First(); mbSwappedAll && pObj; pObj = maGraphicObjectList.Next() ) - if( !( (GraphicObject*) pObj )->IsSwappedOut() ) - mbSwappedAll = sal_False; + for( size_t i = 0, n = maGraphicObjectList.size(); ( i < n ) && mbSwappedAll; ++i ) + if( !maGraphicObjectList[ i ]->IsSwappedOut() ) + mbSwappedAll = false; if( mbSwappedAll ) { delete mpBmpEx, mpBmpEx = NULL; - delete mpMtf, mpMtf = NULL; + mpMtf = NULL; // No need to delete it as it has already been dereferenced delete mpAnimation, mpAnimation = NULL; } } // ----------------------------------------------------------------------------- -sal_Bool GraphicCacheEntry::FillSwappedGraphicObject( const GraphicObject& rObj, Graphic& rSubstitute ) +bool GraphicCacheEntry::FillSwappedGraphicObject( const GraphicObject& rObj, Graphic& rSubstitute ) { - sal_Bool bRet; + bool bRet = false; if( !mbSwappedAll && rObj.IsSwappedOut() ) { ImplFillSubstitute( rSubstitute ); - bRet = sal_True; + bRet = true; } - else - bRet = sal_False; return bRet; } @@ -676,7 +677,7 @@ void GraphicCache::ReleaseGraphicObject( const GraphicObject& rObj ) { // Release cached object GraphicCacheEntry* pEntry = (GraphicCacheEntry*) maGraphicCache.First(); - sal_Bool bRemoved = sal_False; + bool bRemoved = false; while( !bRemoved && pEntry ) { diff --git a/svtools/source/graphic/grfmgr.cxx b/svtools/source/graphic/grfmgr.cxx index 19b09e8f67a7..63df21b3993d 100644 --- a/svtools/source/graphic/grfmgr.cxx +++ b/svtools/source/graphic/grfmgr.cxx @@ -547,11 +547,6 @@ void GraphicObject::SetAnimationNotifyHdl( const Link& rLink ) maGraphic.SetAnimationNotifyHdl( rLink ); } -List* GraphicObject::GetAnimationInfoList() const -{ - return maGraphic.GetAnimationInfoList(); -} - sal_Bool GraphicObject::Draw( OutputDevice* pOut, const Point& rPt, const Size& rSz, const GraphicAttr* pAttr, sal_uLong nFlags ) { @@ -1232,4 +1227,4 @@ GraphicObject GraphicObject::CreateGraphicObjectFromURL( const ::rtl::OUString & } } -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/graphic/grfmgr2.cxx b/svtools/source/graphic/grfmgr2.cxx index 1115635157a8..b5d7b2bcda15 100644 --- a/svtools/source/graphic/grfmgr2.cxx +++ b/svtools/source/graphic/grfmgr2.cxx @@ -122,8 +122,8 @@ GraphicManager::GraphicManager( sal_uLong nCacheSize, sal_uLong nMaxObjCacheSize GraphicManager::~GraphicManager() { - for( void* pObj = maObjList.First(); pObj; pObj = maObjList.Next() ) - ( (GraphicObject*) pObj )->GraphicManagerDestroyed(); + for( size_t i = 0, n = maObjList.size(); i < n; ++i ) + maObjList[ i ]->GraphicManagerDestroyed(); delete mpCache; } @@ -271,7 +271,7 @@ sal_Bool GraphicManager::DrawObj( OutputDevice* pOut, const Point& rPt, const Si void GraphicManager::ImplRegisterObj( const GraphicObject& rObj, Graphic& rSubstitute, const ByteString* pID, const GraphicObject* pCopyObj ) { - maObjList.Insert( (void*) &rObj, LIST_APPEND ); + maObjList.push_back( (GraphicObject*)&rObj ); mpCache->AddGraphicObject( rObj, rSubstitute, pID, pCopyObj ); } @@ -280,7 +280,13 @@ void GraphicManager::ImplRegisterObj( const GraphicObject& rObj, Graphic& rSubst void GraphicManager::ImplUnregisterObj( const GraphicObject& rObj ) { mpCache->ReleaseGraphicObject( rObj ); - maObjList.Remove( (void*) &rObj ); + for( GraphicObjectList_impl::iterator it = maObjList.begin(); it < maObjList.end(); ++it ) + { + if ( *it == &rObj ) { + maObjList.erase( it ); + break; + } + } } // ----------------------------------------------------------------------------- @@ -2384,4 +2390,4 @@ void GraphicObject::ImplTransformBitmap( BitmapEx& rBmpEx, } } -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/hatchwindow/hatchwindowfactory.component b/svtools/source/hatchwindow/hatchwindowfactory.component index 153fc8796281..b9ebbaefdd04 100644 --- a/svtools/source/hatchwindow/hatchwindowfactory.component +++ b/svtools/source/hatchwindow/hatchwindowfactory.component @@ -26,7 +26,7 @@ * **********************************************************************--> -<component loader="com.sun.star.loader.SharedLibrary" +<component loader="com.sun.star.loader.SharedLibrary" prefix="hatchwindowfactory" xmlns="http://openoffice.org/2010/uno-components"> <implementation name="com.sun.star.comp.embed.DocumentCloser"> <service name="com.sun.star.embed.DocumentCloser"/> diff --git a/svtools/source/hatchwindow/hatchwindowfactory.cxx b/svtools/source/hatchwindow/hatchwindowfactory.cxx index a0ff0d4daf17..93401d8f8f43 100644 --- a/svtools/source/hatchwindow/hatchwindowfactory.cxx +++ b/svtools/source/hatchwindow/hatchwindowfactory.cxx @@ -109,13 +109,7 @@ uno::Sequence< ::rtl::OUString > SAL_CALL OHatchWindowFactory::getSupportedServi extern "C" { -SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment ( - const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */) -{ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} - -SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory ( +SAL_DLLPUBLIC_EXPORT void * SAL_CALL hatchwindowfactory_component_getFactory ( const sal_Char * pImplementationName, void * pServiceManager, void * /* pRegistryKey */) { void * pResult = 0; diff --git a/svtools/source/inc/svimpbox.hxx b/svtools/source/inc/svimpbox.hxx index c7603827f61e..d38046a6f47c 100644 --- a/svtools/source/inc/svimpbox.hxx +++ b/svtools/source/inc/svimpbox.hxx @@ -313,6 +313,7 @@ public: void SetCurEntry( SvLBoxEntry* ); Point GetEntryPosition( SvLBoxEntry* ) const; void MakeVisible( SvLBoxEntry* pEntry, sal_Bool bMoveToTop=sal_False ); + void ScrollToAbsPos( long nPos ); void PaintDDCursor( SvLBoxEntry* ); diff --git a/svtools/source/misc/imap.cxx b/svtools/source/misc/imap.cxx index d4ee29924801..39bb9f83bd87 100644 --- a/svtools/source/misc/imap.cxx +++ b/svtools/source/misc/imap.cxx @@ -165,30 +165,6 @@ void IMapObject::Read( SvStream& rIStm, const String& rBaseURL ) /****************************************************************************** |* -|* Konvertierung der logischen Koordianten in Pixel -|* -\******************************************************************************/ - -Point IMapObject::GetPixelPoint( const Point& rLogPoint ) -{ - return Application::GetDefaultDevice()->LogicToPixel( rLogPoint, MapMode( MAP_100TH_MM ) ); -} - - -/****************************************************************************** -|* -|* Konvertierung der logischen Koordianten in Pixel -|* -\******************************************************************************/ - -Point IMapObject::GetLogPoint( const Point& rPixelPoint ) -{ - return Application::GetDefaultDevice()->PixelToLogic( rPixelPoint, MapMode( MAP_100TH_MM ) ); -} - - -/****************************************************************************** -|* |* |* \******************************************************************************/ @@ -433,7 +409,7 @@ sal_Bool IMapCircleObject::IsHit( const Point& rPoint ) const const Point aPoint( aCenter - rPoint ); sal_Bool bRet = sal_False; - if ( (sal_uLong) sqrt( (double) aPoint.X() * aPoint.X() + + if ( (sal_Int32) sqrt( (double) aPoint.X() * aPoint.X() + aPoint.Y() * aPoint.Y() ) <= nRadius ) { bRet = sal_True; @@ -743,8 +719,8 @@ sal_Bool IMapPolygonObject::IsEqual( const IMapPolygonObject& rEqObj ) |* \******************************************************************************/ -ImageMap::ImageMap( const String& rName ) : - aName ( rName ) +ImageMap::ImageMap( const String& rName ) +: aName( rName ) { } @@ -759,24 +735,24 @@ ImageMap::ImageMap( const ImageMap& rImageMap ) { DBG_CTOR( ImageMap, NULL ); - sal_uInt16 nCount = rImageMap.GetIMapObjectCount(); + size_t nCount = rImageMap.GetIMapObjectCount(); - for ( sal_uInt16 i = 0; i < nCount; i++ ) + for ( size_t i = 0; i < nCount; i++ ) { IMapObject* pCopyObj = rImageMap.GetIMapObject( i ); switch( pCopyObj->GetType() ) { case( IMAP_OBJ_RECTANGLE ): - maList.Insert( new IMapRectangleObject( *(IMapRectangleObject*) pCopyObj ), LIST_APPEND ); + maList.push_back( new IMapRectangleObject( *(IMapRectangleObject*) pCopyObj ) ); break; case( IMAP_OBJ_CIRCLE ): - maList.Insert( new IMapCircleObject( *(IMapCircleObject*) pCopyObj ), LIST_APPEND ); + maList.push_back( new IMapCircleObject( *(IMapCircleObject*) pCopyObj ) ); break; case( IMAP_OBJ_POLYGON ): - maList.Insert( new IMapPolygonObject( *(IMapPolygonObject*) pCopyObj ), LIST_APPEND ); + maList.push_back( new IMapPolygonObject( *(IMapPolygonObject*) pCopyObj ) ); break; default: @@ -810,15 +786,9 @@ ImageMap::~ImageMap() void ImageMap::ClearImageMap() { - IMapObject* pObj = (IMapObject*) maList.First(); - - while ( pObj ) - { - delete pObj; - pObj = (IMapObject*) maList.Next(); - } - - maList.Clear(); + for( size_t i = 0, n = maList.size(); i < n; ++i ) + delete maList[ i ]; + maList.clear(); aName = String(); } @@ -832,26 +802,26 @@ void ImageMap::ClearImageMap() ImageMap& ImageMap::operator=( const ImageMap& rImageMap ) { - sal_uInt16 nCount = rImageMap.GetIMapObjectCount(); + size_t nCount = rImageMap.GetIMapObjectCount(); ClearImageMap(); - for ( sal_uInt16 i = 0; i < nCount; i++ ) + for ( size_t i = 0; i < nCount; i++ ) { IMapObject* pCopyObj = rImageMap.GetIMapObject( i ); switch( pCopyObj->GetType() ) { case( IMAP_OBJ_RECTANGLE ): - maList.Insert( new IMapRectangleObject( *(IMapRectangleObject*) pCopyObj ), LIST_APPEND ); + maList.push_back( new IMapRectangleObject( *(IMapRectangleObject*) pCopyObj ) ); break; case( IMAP_OBJ_CIRCLE ): - maList.Insert( new IMapCircleObject( *(IMapCircleObject*) pCopyObj ), LIST_APPEND ); + maList.push_back( new IMapCircleObject( *(IMapCircleObject*) pCopyObj ) ); break; case( IMAP_OBJ_POLYGON ): - maList.Insert( new IMapPolygonObject( *(IMapPolygonObject*) pCopyObj ), LIST_APPEND ); + maList.push_back( new IMapPolygonObject( *(IMapPolygonObject*) pCopyObj ) ); break; default: @@ -873,17 +843,17 @@ ImageMap& ImageMap::operator=( const ImageMap& rImageMap ) sal_Bool ImageMap::operator==( const ImageMap& rImageMap ) { - const sal_uInt16 nCount = (sal_uInt16) maList.Count(); - const sal_uInt16 nEqCount = rImageMap.GetIMapObjectCount(); - sal_Bool bRet = sal_False; + const size_t nCount = maList.size(); + const size_t nEqCount = rImageMap.GetIMapObjectCount(); + sal_Bool bRet = sal_False; if ( nCount == nEqCount ) { sal_Bool bDifferent = ( aName != rImageMap.aName ); - for ( sal_uInt16 i = 0; ( i < nCount ) && !bDifferent; i++ ) + for ( size_t i = 0; ( i < nCount ) && !bDifferent; i++ ) { - IMapObject* pObj = (IMapObject*) maList.GetObject( i ); + IMapObject* pObj = maList[ i ]; IMapObject* pEqObj = rImageMap.GetIMapObject( i ); if ( pObj->GetType() == pEqObj->GetType() ) @@ -962,15 +932,15 @@ void ImageMap::InsertIMapObject( const IMapObject& rIMapObject ) switch( rIMapObject.GetType() ) { case( IMAP_OBJ_RECTANGLE ): - maList.Insert( new IMapRectangleObject( (IMapRectangleObject&) rIMapObject ), LIST_APPEND ); + maList.push_back( new IMapRectangleObject( (IMapRectangleObject&) rIMapObject ) ); break; case( IMAP_OBJ_CIRCLE ): - maList.Insert( new IMapCircleObject( (IMapCircleObject&) rIMapObject ), LIST_APPEND ); + maList.push_back( new IMapCircleObject( (IMapCircleObject&) rIMapObject ) ); break; case( IMAP_OBJ_POLYGON ): - maList.Insert( new IMapPolygonObject( (IMapPolygonObject&) rIMapObject ), LIST_APPEND ); + maList.push_back( new IMapPolygonObject( (IMapPolygonObject&) rIMapObject ) ); break; default: @@ -1005,13 +975,12 @@ IMapObject* ImageMap::GetHitIMapObject( const Size& rTotalSize, } // Alle Objekte durchlaufen und HitTest ausfuehren - IMapObject* pObj = (IMapObject*) maList.First(); - while ( pObj ) - { - if ( pObj->IsHit( aRelPoint ) ) + IMapObject* pObj = NULL; + for( size_t i = 0, n = maList.size(); i < n; ++i ) { + if ( maList[ i ]->IsHit( aRelPoint ) ) { + pObj = maList[ i ]; break; - - pObj = (IMapObject*) maList.Next(); + } } return( pObj ? ( pObj->IsActive() ? pObj : NULL ) : NULL ); @@ -1027,10 +996,10 @@ IMapObject* ImageMap::GetHitIMapObject( const Size& rTotalSize, Rectangle ImageMap::GetBoundRect() const { Rectangle aBoundRect; - sal_uLong nCount = maList.Count(); + size_t nCount = maList.size(); - for ( sal_uLong i = 0; i < nCount; i++ ) - aBoundRect.Union( ( (IMapObject*) maList.GetObject( i ) )->GetBoundRect() ); + for ( size_t i = 0; i < nCount; i++ ) + aBoundRect.Union( maList[ i ]->GetBoundRect() ); return aBoundRect; } @@ -1044,11 +1013,11 @@ Rectangle ImageMap::GetBoundRect() const void ImageMap::Scale( const Fraction& rFracX, const Fraction& rFracY ) { - sal_uInt16 nCount = (sal_uInt16) maList.Count(); + size_t nCount = maList.size(); - for ( sal_uInt16 i = 0; i < nCount; i++ ) + for ( size_t i = 0; i < nCount; i++ ) { - IMapObject* pObj = GetIMapObject( i ); + IMapObject* pObj = maList[ i ]; switch( pObj->GetType() ) { @@ -1080,11 +1049,11 @@ void ImageMap::Scale( const Fraction& rFracX, const Fraction& rFracY ) void ImageMap::ImpWriteImageMap( SvStream& rOStm, const String& rBaseURL ) const { IMapObject* pObj; - sal_uInt16 nCount = (sal_uInt16) maList.Count(); + size_t nCount = maList.size(); - for ( sal_uInt16 i = 0; i < nCount; i++ ) + for ( size_t i = 0; i < nCount; i++ ) { - pObj = (IMapObject*) maList.GetObject( i ); + pObj = maList[ i ]; pObj->Write( rOStm, rBaseURL ); } } @@ -1096,10 +1065,10 @@ void ImageMap::ImpWriteImageMap( SvStream& rOStm, const String& rBaseURL ) const |* \******************************************************************************/ -void ImageMap::ImpReadImageMap( SvStream& rIStm, sal_uInt16 nCount, const String& rBaseURL ) +void ImageMap::ImpReadImageMap( SvStream& rIStm, size_t nCount, const String& rBaseURL ) { // neue Objekte einlesen - for ( sal_uInt16 i = 0; i < nCount; i++ ) + for ( size_t i = 0; i < nCount; i++ ) { sal_uInt16 nType; @@ -1112,7 +1081,7 @@ void ImageMap::ImpReadImageMap( SvStream& rIStm, sal_uInt16 nCount, const String { IMapRectangleObject* pObj = new IMapRectangleObject; pObj->Read( rIStm, rBaseURL ); - maList.Insert( pObj, LIST_APPEND ); + maList.push_back( pObj ); } break; @@ -1120,7 +1089,7 @@ void ImageMap::ImpReadImageMap( SvStream& rIStm, sal_uInt16 nCount, const String { IMapCircleObject* pObj = new IMapCircleObject; pObj->Read( rIStm, rBaseURL ); - maList.Insert( pObj, LIST_APPEND ); + maList.push_back( pObj ); } break; @@ -1128,7 +1097,7 @@ void ImageMap::ImpReadImageMap( SvStream& rIStm, sal_uInt16 nCount, const String { IMapPolygonObject* pObj = new IMapPolygonObject; pObj->Read( rIStm, rBaseURL ); - maList.Insert( pObj, LIST_APPEND ); + maList.push_back( pObj ); } break; diff --git a/svtools/source/misc/imap2.cxx b/svtools/source/misc/imap2.cxx index 20e8ae6431b8..359615a1b2c2 100644 --- a/svtools/source/misc/imap2.cxx +++ b/svtools/source/misc/imap2.cxx @@ -48,209 +48,111 @@ #define NOTEOL(c) ((c)!='\0') - TYPEINIT0_AUTOFACTORY( ImageMap ); - -/******************************************************************************/ -/******************************************************************************/ - - -/****************************************************************************** -|* -|* -|* -\******************************************************************************/ - -void IMapObject::AppendCERNCoords( const Point& rPoint100, ByteString& rStr ) const +void IMapObject::AppendCERNCoords(rtl::OStringBuffer& rBuf, const Point& rPoint100) const { const Point aPixPt( Application::GetDefaultDevice()->LogicToPixel( rPoint100, MapMode( MAP_100TH_MM ) ) ); - rStr += '('; - rStr += ByteString::CreateFromInt32( aPixPt.X() ); - rStr += ','; - rStr += ByteString::CreateFromInt32( aPixPt.Y() ); - rStr += ") "; + rBuf.append('('); + rBuf.append(static_cast<sal_Int32>(aPixPt.X())); + rBuf.append(','); + rBuf.append(static_cast<sal_Int32>(aPixPt.Y())); + rBuf.append(RTL_CONSTASCII_STRINGPARAM(") ")); } - -/****************************************************************************** -|* -|* -|* -\******************************************************************************/ - -void IMapObject::AppendNCSACoords( const Point& rPoint100, ByteString& rStr ) const +void IMapObject::AppendNCSACoords(rtl::OStringBuffer& rBuf, const Point& rPoint100) const { const Point aPixPt( Application::GetDefaultDevice()->LogicToPixel( rPoint100, MapMode( MAP_100TH_MM ) ) ); - rStr += ByteString::CreateFromInt32( aPixPt.X() ); - rStr += ','; - rStr += ByteString::CreateFromInt32( aPixPt.Y() ); - rStr += ' '; + rBuf.append(static_cast<sal_Int32>(aPixPt.X())); + rBuf.append(','); + rBuf.append(static_cast<sal_Int32>(aPixPt.Y())); + rBuf.append(' '); } - -/****************************************************************************** -|* -|* -|* -\******************************************************************************/ - -void IMapObject::AppendCERNURL( ByteString& rStr, const String& rBaseURL ) const +void IMapObject::AppendCERNURL(rtl::OStringBuffer& rBuf, const String& rBaseURL) const { - rStr += ByteString( String(URIHelper::simpleNormalizedMakeRelative( rBaseURL, aURL )), gsl_getSystemTextEncoding() ); + rBuf.append(rtl::OUStringToOString(URIHelper::simpleNormalizedMakeRelative(rBaseURL, aURL), gsl_getSystemTextEncoding())); } - -/****************************************************************************** -|* -|* -|* -\******************************************************************************/ - -void IMapObject::AppendNCSAURL( ByteString& rStr, const String& rBaseURL ) const +void IMapObject::AppendNCSAURL(rtl::OStringBuffer& rBuf, const String& rBaseURL) const { - rStr += ByteString( String(URIHelper::simpleNormalizedMakeRelative( rBaseURL, aURL )), gsl_getSystemTextEncoding() ); - rStr += ' '; + rBuf.append(rtl::OUStringToOString(URIHelper::simpleNormalizedMakeRelative(rBaseURL, aURL), gsl_getSystemTextEncoding())); + rBuf.append(' '); } - -/******************************************************************************/ -/******************************************************************************/ - - -/****************************************************************************** -|* -|* -|* -\******************************************************************************/ - void IMapRectangleObject::WriteCERN( SvStream& rOStm, const String& rBaseURL ) const { - ByteString aStr( "rectangle " ); + rtl::OStringBuffer aStrBuf(RTL_CONSTASCII_STRINGPARAM("rectangle ")); - AppendCERNCoords( aRect.TopLeft(), aStr ); - AppendCERNCoords( aRect.BottomRight(), aStr ); - AppendCERNURL( aStr, rBaseURL ); + AppendCERNCoords(aStrBuf, aRect.TopLeft()); + AppendCERNCoords(aStrBuf, aRect.BottomRight()); + AppendCERNURL(aStrBuf, rBaseURL); - rOStm.WriteLine( aStr ); + rOStm.WriteLine(aStrBuf.makeStringAndClear()); } - -/****************************************************************************** -|* -|* -|* -\******************************************************************************/ - void IMapRectangleObject::WriteNCSA( SvStream& rOStm, const String& rBaseURL ) const { - ByteString aStr( "rect " ); + rtl::OStringBuffer aStrBuf(RTL_CONSTASCII_STRINGPARAM("rect ")); - AppendNCSAURL( aStr, rBaseURL ); - AppendNCSACoords( aRect.TopLeft(), aStr ); - AppendNCSACoords( aRect.BottomRight(), aStr ); + AppendNCSAURL(aStrBuf, rBaseURL); + AppendNCSACoords(aStrBuf, aRect.TopLeft()); + AppendNCSACoords(aStrBuf, aRect.BottomRight()); - rOStm.WriteLine( aStr ); + rOStm.WriteLine(aStrBuf.makeStringAndClear()); } - -/******************************************************************************/ -/******************************************************************************/ - - -/****************************************************************************** -|* -|* -|* -\******************************************************************************/ - void IMapCircleObject::WriteCERN( SvStream& rOStm, const String& rBaseURL ) const { - ByteString aStr( "circle " ); + rtl::OStringBuffer aStrBuf(RTL_CONSTASCII_STRINGPARAM("circle ")); - AppendCERNCoords( aCenter, aStr ); - aStr += ByteString::CreateFromInt32(nRadius); - aStr += ' '; - AppendCERNURL( aStr, rBaseURL ); + AppendCERNCoords(aStrBuf, aCenter); + aStrBuf.append(nRadius); + aStrBuf.append(' '); + AppendCERNURL(aStrBuf, rBaseURL); - rOStm.WriteLine( aStr ); + rOStm.WriteLine(aStrBuf.makeStringAndClear()); } - -/****************************************************************************** -|* -|* -|* -\******************************************************************************/ - void IMapCircleObject::WriteNCSA( SvStream& rOStm, const String& rBaseURL ) const { - ByteString aStr( "circle " ); + rtl::OStringBuffer aStrBuf(RTL_CONSTASCII_STRINGPARAM("circle ")); - AppendNCSAURL( aStr, rBaseURL ); - AppendNCSACoords( aCenter, aStr ); - AppendNCSACoords( aCenter + Point( nRadius, 0 ), aStr ); + AppendNCSAURL(aStrBuf, rBaseURL); + AppendNCSACoords(aStrBuf, aCenter); + AppendNCSACoords(aStrBuf, aCenter + Point(nRadius, 0)); - rOStm.WriteLine( aStr ); + rOStm.WriteLine(aStrBuf.makeStringAndClear()); } - -/******************************************************************************/ -/******************************************************************************/ - - -/****************************************************************************** -|* -|* -|* -\******************************************************************************/ - void IMapPolygonObject::WriteCERN( SvStream& rOStm, const String& rBaseURL ) const { - ByteString aStr( "polygon " ); - const sal_uInt16 nCount = aPoly.GetSize(); + rtl::OStringBuffer aStrBuf(RTL_CONSTASCII_STRINGPARAM("polygon ")); + const sal_uInt16 nCount = aPoly.GetSize(); - for ( sal_uInt16 i = 0; i < nCount; i++ ) - AppendCERNCoords( aPoly[ i ], aStr ); + for (sal_uInt16 i = 0; i < nCount; ++i) + AppendCERNCoords(aStrBuf, aPoly[i]); - AppendCERNURL( aStr, rBaseURL ); + AppendCERNURL(aStrBuf, rBaseURL); - rOStm.WriteLine( aStr ); + rOStm.WriteLine(aStrBuf.makeStringAndClear()); } - -/****************************************************************************** -|* -|* -|* -\******************************************************************************/ - void IMapPolygonObject::WriteNCSA( SvStream& rOStm, const String& rBaseURL ) const { - ByteString aStr( "poly " ); - const sal_uInt16 nCount = Min( aPoly.GetSize(), (sal_uInt16) 100 ); + rtl::OStringBuffer aStrBuf(RTL_CONSTASCII_STRINGPARAM("poly ")); + const sal_uInt16 nCount = Min( aPoly.GetSize(), (sal_uInt16) 100 ); - AppendNCSAURL( aStr, rBaseURL ); + AppendNCSAURL(aStrBuf, rBaseURL); - for ( sal_uInt16 i = 0; i < nCount; i++ ) - AppendNCSACoords( aPoly[ i ], aStr ); + for (sal_uInt16 i = 0; i < nCount; ++i) + AppendNCSACoords(aStrBuf, aPoly[i]); - rOStm.WriteLine( aStr ); + rOStm.WriteLine(aStrBuf.makeStringAndClear()); } - -/******************************************************************************/ -/******************************************************************************/ - - -/****************************************************************************** -|* -|* -|* -\******************************************************************************/ - void ImageMap::Write( SvStream& rOStm, sal_uLong nFormat, const String& rBaseURL ) const { switch( nFormat ) @@ -264,21 +166,14 @@ void ImageMap::Write( SvStream& rOStm, sal_uLong nFormat, const String& rBaseURL } } - -/****************************************************************************** -|* -|* -|* -\******************************************************************************/ - void ImageMap::ImpWriteCERN( SvStream& rOStm, const String& rBaseURL ) const { IMapObject* pObj; - sal_uInt16 nCount = (sal_uInt16) maList.Count(); + size_t nCount = maList.size(); - for ( sal_uInt16 i = 0; i < nCount; i++ ) + for ( size_t i = 0; i < nCount; i++ ) { - pObj = GetIMapObject( i ); + pObj = maList[ i ]; switch( pObj->GetType() ) { @@ -300,23 +195,16 @@ void ImageMap::ImpWriteCERN( SvStream& rOStm, const String& rBaseURL ) const } } - -/****************************************************************************** -|* -|* -|* -\******************************************************************************/ - void ImageMap::ImpWriteNCSA( SvStream& rOStm, const String& rBaseURL ) const { IMapObject* pObj; - sal_uInt16 nCount = (sal_uInt16) maList.Count(); + size_t nCount = maList.size(); - for ( sal_uInt16 i = 0; i < nCount; i++ ) + for ( size_t i = 0; i < nCount; i++ ) { - pObj = GetIMapObject( i ); + pObj = maList[ i ]; - switch( pObj->GetType() ) + switch( pObj->GetType() ) { case( IMAP_OBJ_RECTANGLE ): ( (IMapRectangleObject*) pObj )->WriteNCSA( rOStm, rBaseURL ); @@ -336,13 +224,6 @@ void ImageMap::ImpWriteNCSA( SvStream& rOStm, const String& rBaseURL ) const } } - -/****************************************************************************** -|* -|* -|* -\******************************************************************************/ - sal_uLong ImageMap::Read( SvStream& rIStm, sal_uLong nFormat, const String& rBaseURL ) { sal_uLong nRet = IMAP_ERR_FORMAT; @@ -366,13 +247,6 @@ sal_uLong ImageMap::Read( SvStream& rIStm, sal_uLong nFormat, const String& rBas return nRet; } - -/****************************************************************************** -|* -|* -|* -\******************************************************************************/ - sal_uLong ImageMap::ImpReadCERN( SvStream& rIStm, const String& rBaseURL ) { ByteString aStr; @@ -386,13 +260,6 @@ sal_uLong ImageMap::ImpReadCERN( SvStream& rIStm, const String& rBaseURL ) return IMAP_ERR_OK; } - -/****************************************************************************** -|* -|* -|* -\******************************************************************************/ - void ImageMap::ImpReadCERNLine( const ByteString& rLine, const String& rBaseURL ) { ByteString aStr( rLine ); @@ -423,7 +290,7 @@ void ImageMap::ImpReadCERNLine( const ByteString& rLine, const String& rBaseURL const Rectangle aRect( aTopLeft, aBottomRight ); IMapRectangleObject* pObj = new IMapRectangleObject( aRect, aURL, String(), String(), String(), String() ); - maList.Insert( pObj, LIST_APPEND ); + maList.push_back( pObj ); } else if ( ( aToken == "circle" ) || ( aToken == "circ" ) ) { @@ -432,7 +299,7 @@ void ImageMap::ImpReadCERNLine( const ByteString& rLine, const String& rBaseURL const String aURL( ImpReadCERNURL( &pStr, rBaseURL ) ); IMapCircleObject* pObj = new IMapCircleObject( aCenter, nRadius, aURL, String(), String(), String(), String() ); - maList.Insert( pObj, LIST_APPEND ); + maList.push_back( pObj ); } else if ( ( aToken == "polygon" ) || ( aToken == "poly" ) ) { @@ -446,18 +313,11 @@ void ImageMap::ImpReadCERNLine( const ByteString& rLine, const String& rBaseURL aURL = ImpReadCERNURL( &pStr, rBaseURL ); IMapPolygonObject* pObj = new IMapPolygonObject( aPoly, aURL, String(), String(), String(), String() ); - maList.Insert( pObj, LIST_APPEND ); + maList.push_back( pObj ); } } } - -/****************************************************************************** -|* -|* -|* -\******************************************************************************/ - Point ImageMap::ImpReadCERNCoords( const char** ppStr ) { String aStrX; @@ -498,13 +358,6 @@ Point ImageMap::ImpReadCERNCoords( const char** ppStr ) return aPt; } - -/****************************************************************************** -|* -|* -|* -\******************************************************************************/ - long ImageMap::ImpReadCERNRadius( const char** ppStr ) { String aStr; @@ -525,13 +378,6 @@ long ImageMap::ImpReadCERNRadius( const char** ppStr ) return aStr.ToInt32(); } - -/****************************************************************************** -|* -|* -|* -\******************************************************************************/ - String ImageMap::ImpReadCERNURL( const char** ppStr, const String& rBaseURL ) { String aStr( String::CreateFromAscii( *ppStr ) ); @@ -544,13 +390,6 @@ String ImageMap::ImpReadCERNURL( const char** ppStr, const String& rBaseURL ) return INetURLObject::GetAbsURL( rBaseURL, aStr ); } - -/****************************************************************************** -|* -|* -|* -\******************************************************************************/ - sal_uLong ImageMap::ImpReadNCSA( SvStream& rIStm, const String& rBaseURL ) { ByteString aStr; @@ -564,13 +403,6 @@ sal_uLong ImageMap::ImpReadNCSA( SvStream& rIStm, const String& rBaseURL ) return IMAP_ERR_OK; } - -/****************************************************************************** -|* -|* -|* -\******************************************************************************/ - void ImageMap::ImpReadNCSALine( const ByteString& rLine, const String& rBaseURL ) { ByteString aStr( rLine ); @@ -601,7 +433,7 @@ void ImageMap::ImpReadNCSALine( const ByteString& rLine, const String& rBaseURL const Rectangle aRect( aTopLeft, aBottomRight ); IMapRectangleObject* pObj = new IMapRectangleObject( aRect, aURL, String(), String(), String(), String() ); - maList.Insert( pObj, LIST_APPEND ); + maList.push_back( pObj ); } else if ( aToken == "circle" ) { @@ -612,7 +444,7 @@ void ImageMap::ImpReadNCSALine( const ByteString& rLine, const String& rBaseURL (double) aDX.Y() * aDX.Y() ); IMapCircleObject* pObj = new IMapCircleObject( aCenter, nRadius, aURL, String(), String(), String(), String() ); - maList.Insert( pObj, LIST_APPEND ); + maList.push_back( pObj ); } else if ( aToken == "poly" ) { @@ -624,18 +456,11 @@ void ImageMap::ImpReadNCSALine( const ByteString& rLine, const String& rBaseURL aPoly[ i ] = ImpReadNCSACoords( &pStr ); IMapPolygonObject* pObj = new IMapPolygonObject( aPoly, aURL, String(), String(), String(), String() ); - maList.Insert( pObj, LIST_APPEND ); + maList.push_back( pObj ); } } } - -/****************************************************************************** -|* -|* -|* -\******************************************************************************/ - String ImageMap::ImpReadNCSAURL( const char** ppStr, const String& rBaseURL ) { String aStr; @@ -656,13 +481,6 @@ String ImageMap::ImpReadNCSAURL( const char** ppStr, const String& rBaseURL ) return INetURLObject::GetAbsURL( rBaseURL, aStr ); } - -/****************************************************************************** -|* -|* -|* -\******************************************************************************/ - Point ImageMap::ImpReadNCSACoords( const char** ppStr ) { String aStrX; @@ -699,13 +517,6 @@ Point ImageMap::ImpReadNCSACoords( const char** ppStr ) return aPt; } - -/****************************************************************************** -|* -|* -|* -\******************************************************************************/ - sal_uLong ImageMap::ImpDetectFormat( SvStream& rIStm ) { sal_uLong nPos = rIStm.Tell(); diff --git a/svtools/source/misc/transfer.cxx b/svtools/source/misc/transfer.cxx index 4b24ed4330fd..cbb5eedb3bb3 100644 --- a/svtools/source/misc/transfer.cxx +++ b/svtools/source/misc/transfer.cxx @@ -65,6 +65,7 @@ #include <svtools/wmf.hxx> #include <svtools/imap.hxx> #include <svtools/transfer.hxx> +#include <rtl/strbuf.hxx> #include <cstdio> // -------------- @@ -879,15 +880,16 @@ sal_Bool TransferableHelper::SetINetBookmark( const INetBookmark& rBmk, { case( SOT_FORMATSTR_ID_SOLK ): { - ByteString sURL( rBmk.GetURL(), eSysCSet ), - sDesc( rBmk.GetDescription(), eSysCSet ); - ByteString sOut( ByteString::CreateFromInt32( sURL.Len() )); - ( sOut += '@' ) += sURL; - sOut += ByteString::CreateFromInt32( sDesc.Len() ); - ( sOut += '@' ) += sDesc; - - Sequence< sal_Int8 > aSeq( sOut.Len() ); - memcpy( aSeq.getArray(), sOut.GetBuffer(), sOut.Len() ); + rtl::OString sURL(rtl::OUStringToOString(rBmk.GetURL(), eSysCSet)); + rtl::OString sDesc(rtl::OUStringToOString(rBmk.GetDescription(), eSysCSet)); + rtl::OStringBuffer sOut; + sOut.append(sURL.getLength()); + sOut.append('@').append(sURL); + sOut.append(sDesc.getLength()); + sOut.append('@').append(sDesc); + + Sequence< sal_Int8 > aSeq(sOut.getLength()); + memcpy(aSeq.getArray(), sOut.getStr(), sOut.getLength()); maAny <<= aSeq; } break; @@ -973,22 +975,6 @@ sal_Bool TransferableHelper::SetINetImage( const INetImage& rINtImg, // ----------------------------------------------------------------------------- -sal_Bool TransferableHelper::SetFileList( const FileList& rFileList, - const ::com::sun::star::datatransfer::DataFlavor& ) -{ - SvMemoryStream aMemStm( 4096, 4096 ); - - aMemStm.SetVersion( SOFFICE_FILEFORMAT_50 ); - aMemStm << rFileList; - - maAny <<= Sequence< sal_Int8 >( static_cast< const sal_Int8* >( aMemStm.GetData() ), - aMemStm.Seek( STREAM_SEEK_TO_END ) ); - - return( maAny.hasValue() ); -} - -// ----------------------------------------------------------------------------- - sal_Bool TransferableHelper::SetObject( void* pUserObject, sal_uInt32 nUserObjectId, const DataFlavor& rFlavor ) { SotStorageStreamRef xStm( new SotStorageStream( String() ) ); @@ -1020,15 +1006,6 @@ sal_Bool TransferableHelper::SetObject( void* pUserObject, sal_uInt32 nUserObjec // ----------------------------------------------------------------------------- -sal_Bool TransferableHelper::SetInterface( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rIf, - const ::com::sun::star::datatransfer::DataFlavor& ) -{ - maAny <<= rIf; - return( maAny.hasValue() ); -} - -// ----------------------------------------------------------------------------- - sal_Bool TransferableHelper::WriteObject( SotStorageStreamRef&, void*, sal_uInt32, const DataFlavor& ) { OSL_FAIL( "TransferableHelper::WriteObject( ... ) not implemented" ); @@ -2212,15 +2189,6 @@ sal_Bool TransferableDataHelper::GetInputStream( const DataFlavor& rFlavor, Refe // ----------------------------------------------------------------------------- - -sal_Bool TransferableDataHelper::GetInterface( SotFormatStringId nFormat, Reference< XInterface >& rIf ) -{ - DataFlavor aFlavor; - return( SotExchange::GetFormatDataFlavor( nFormat, aFlavor ) && GetInterface( aFlavor, rIf ) ); -} - -// ----------------------------------------------------------------------------- - sal_Bool TransferableDataHelper::GetInterface( const DataFlavor& rFlavor, Reference< XInterface >& rIf ) { const Any aAny( GetAny( rFlavor ) ); diff --git a/svtools/source/misc/transfer2.cxx b/svtools/source/misc/transfer2.cxx index 5e4fa8e56077..fe8921061f8f 100644 --- a/svtools/source/misc/transfer2.cxx +++ b/svtools/source/misc/transfer2.cxx @@ -475,15 +475,6 @@ sal_Bool TransferDataContainer::GetData( const // ----------------------------------------------------------------------------- -void TransferDataContainer::ClearData() -{ - delete pImpl; - pImpl = new TransferDataContainer_Impl; - ClearFormats(); -} - -// ----------------------------------------------------------------------------- - void TransferDataContainer::CopyINetBookmark( const INetBookmark& rBkmk ) { if( !pImpl->pBookmk ) diff --git a/svtools/source/misc/unitconv.cxx b/svtools/source/misc/unitconv.cxx index 17adaeaecd81..189c7e24e4bb 100644 --- a/svtools/source/misc/unitconv.cxx +++ b/svtools/source/misc/unitconv.cxx @@ -293,64 +293,6 @@ FieldUnit MapToFieldUnit( const SfxMapUnit eUnit ) // ----------------------------------------------------------------------- -MapUnit FieldToMapUnit( const SfxFieldUnit /*eUnit*/ ) -{ - return MAP_APPFONT; -} - -// ----------------------------------------------------------------------- - -long ConvertValueToMap( long nVal, SfxMapUnit eUnit ) -{ - long nNew = nVal; - - switch ( eUnit ) - { - case SFX_MAPUNIT_10TH_MM: - case SFX_MAPUNIT_10TH_INCH: - nNew *= 10; - break; - - case SFX_MAPUNIT_100TH_MM: - case SFX_MAPUNIT_100TH_INCH: - nNew *= 100; - break; - - case SFX_MAPUNIT_1000TH_INCH: - nNew *= 1000; - default: ;//prevent warning - } - return nNew; -} - -// ----------------------------------------------------------------------- - -long ConvertValueToUnit( long nVal, SfxMapUnit eUnit ) -{ - long nNew = nVal; - - switch ( eUnit ) - { - case SFX_MAPUNIT_10TH_MM: - case SFX_MAPUNIT_10TH_INCH: - nNew /= 10; - break; - - case SFX_MAPUNIT_100TH_MM: - case SFX_MAPUNIT_100TH_INCH: - nNew /= 100; - break; - - case SFX_MAPUNIT_1000TH_INCH: - nNew /= 1000; - break; - default: ;//prevent warning - } - return nNew; -} - -// ----------------------------------------------------------------------- - long CalcToPoint( long nIn, SfxMapUnit eUnit, sal_uInt16 nFaktor ) { DBG_ASSERT( eUnit == SFX_MAPUNIT_TWIP || diff --git a/svtools/source/productregistration/productregistration.cxx b/svtools/source/productregistration/productregistration.cxx index a4251652aac2..a3312c107a52 100644 --- a/svtools/source/productregistration/productregistration.cxx +++ b/svtools/source/productregistration/productregistration.cxx @@ -453,13 +453,7 @@ namespace svt extern "C" { -SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment ( - const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */) -{ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} - -SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory ( +SAL_DLLPUBLIC_EXPORT void * SAL_CALL productregistration_component_getFactory ( const sal_Char * pImplementationName, void * pServiceManager, void * /* pRegistryKey */) { void * pResult = 0; diff --git a/svtools/source/productregistration/productregistration.uno.component b/svtools/source/productregistration/productregistration.uno.component index da2cfd37c483..f57860ef6463 100644 --- a/svtools/source/productregistration/productregistration.uno.component +++ b/svtools/source/productregistration/productregistration.uno.component @@ -26,7 +26,7 @@ * **********************************************************************--> -<component loader="com.sun.star.loader.SharedLibrary" +<component loader="com.sun.star.loader.SharedLibrary" prefix="productregistration" xmlns="http://openoffice.org/2010/uno-components"> <implementation name="com.sun.star.comp.setup.ProductRegistration"> <service name="com.sun.star.setup.ProductRegistration"/> diff --git a/svtools/source/svhtml/htmlout.cxx b/svtools/source/svhtml/htmlout.cxx index 31e60e1ab1a1..f1d56f7f6fc5 100644 --- a/svtools/source/svhtml/htmlout.cxx +++ b/svtools/source/svhtml/htmlout.cxx @@ -485,7 +485,7 @@ void lcl_ConvertCharToHTML( sal_Unicode c, ByteString& rDest, rDest += *pBuffer++; (((rDest += '&') += '#') += - ByteString::CreateFromInt64( (sal_uInt32)c )) += ';'; + ByteString(rtl::OString::valueOf(static_cast<sal_Int64>(c)))) += ';'; if( pNonConvertableChars && STRING_NOTFOUND == pNonConvertableChars->Search( c ) ) pNonConvertableChars->Append( c ); @@ -658,11 +658,16 @@ SvStream& HTMLOutFuncs::Out_ImageMap( SvStream& rStream, (const IMapRectangleObject *)pObj; pShape = OOO_STRING_SVTOOLS_HTML_SH_rect; Rectangle aRect( pRectObj->GetRectangle() ); - ((((((aCoords = - ByteString::CreateFromInt32(aRect.Left())) += ',') - += ByteString::CreateFromInt32(aRect.Top())) += ',') - += ByteString::CreateFromInt32(aRect.Right())) += ',') - += ByteString::CreateFromInt32(aRect.Bottom()); + + aCoords = rtl::OStringBuffer() + .append(static_cast<sal_Int32>(aRect.Left())) + .append(',') + .append(static_cast<sal_Int32>(aRect.Top())) + .append(',') + .append(static_cast<sal_Int32>(aRect.Right())) + .append(',') + .append(static_cast<sal_Int32>(aRect.Bottom())) + .makeStringAndClear(); } break; case( IMAP_OBJ_CIRCLE ): @@ -672,10 +677,14 @@ SvStream& HTMLOutFuncs::Out_ImageMap( SvStream& rStream, pShape= OOO_STRING_SVTOOLS_HTML_SH_circ; Point aCenter( pCirc->GetCenter() ); long nOff = pCirc->GetRadius(); - ((((aCoords = - ByteString::CreateFromInt32(aCenter.X())) += ',') - += ByteString::CreateFromInt32(aCenter.Y())) += ',') - += ByteString::CreateFromInt32(nOff); + + aCoords = rtl::OStringBuffer() + .append(static_cast<sal_Int32>(aCenter.X())) + .append(',') + .append(static_cast<sal_Int32>(aCenter.Y())) + .append(',') + .append(static_cast<sal_Int32>(nOff)) + .makeStringAndClear(); } break; case( IMAP_OBJ_POLYGON ): @@ -685,20 +694,23 @@ SvStream& HTMLOutFuncs::Out_ImageMap( SvStream& rStream, pShape= OOO_STRING_SVTOOLS_HTML_SH_poly; Polygon aPoly( pPolyObj->GetPolygon() ); sal_uInt16 nCount = aPoly.GetSize(); + rtl::OStringBuffer aTmpBuf; if( nCount>0 ) { const Point& rPoint = aPoly[0]; - ((aCoords = - ByteString::CreateFromInt32(rPoint.X())) += ',') - += ByteString::CreateFromInt32(rPoint.Y()); + aTmpBuf.append(static_cast<sal_Int32>(rPoint.X())) + .append(',') + .append(static_cast<sal_Int32>(rPoint.Y())); } for( sal_uInt16 j=1; j<nCount; j++ ) { const Point& rPoint = aPoly[j]; - (((aCoords += ',') - += ByteString::CreateFromInt32(rPoint.X())) += ',') - += ByteString::CreateFromInt32(rPoint.Y()); + aTmpBuf.append(',') + .append(static_cast<sal_Int32>(rPoint.X())) + .append(',') + .append(static_cast<sal_Int32>(rPoint.Y())); } + aCoords = aTmpBuf.makeStringAndClear(); } break; default: diff --git a/svtools/source/svhtml/parhtml.cxx b/svtools/source/svhtml/parhtml.cxx index 8cf6f406e2bd..b431d0d931c7 100644 --- a/svtools/source/svhtml/parhtml.cxx +++ b/svtools/source/svhtml/parhtml.cxx @@ -2266,11 +2266,10 @@ bool HTMLParser::ParseMetaOptions( rtl_TextEncoding HTMLParser::GetEncodingByMIME( const String& rMime ) { - ByteString sType; - ByteString sSubType; + String sType; + String sSubType; INetContentTypeParameterList aParameters; - ByteString sMime( rMime, RTL_TEXTENCODING_ASCII_US ); - if (INetContentTypes::parse(sMime, sType, sSubType, &aParameters)) + if (INetContentTypes::parse(rMime, sType, sSubType, &aParameters)) { const INetContentTypeParameter * pCharset = aParameters.find("charset"); diff --git a/svtools/source/svrtf/parrtf.cxx b/svtools/source/svrtf/parrtf.cxx index a475343dcaac..5a04328045c6 100644 --- a/svtools/source/svrtf/parrtf.cxx +++ b/svtools/source/svrtf/parrtf.cxx @@ -341,7 +341,27 @@ void SvRTFParser::ScanText( const sal_Unicode cBreak ) ByteString aByteString; while (1) { - aByteString.Append((char)GetHexValue()); + char c = (char)GetHexValue(); + + if (c) + { + aByteString.Append(c); + } + else + { + /* \'00 is a valid internal character in a + * string in RTF, however ByteString::Append + * does nothing if '\0' is passed in. It is + * otherwise capable of handling strings with + * embedded NULs, so add a '\1' and then + * change it, as ByteString::SetChar does not + * care if the character is '\0'. + */ + int nLen = aByteString.Len(); + + aByteString.Append('\001'); + aByteString.SetChar(nLen, '\0'); + } bool bBreak = false; sal_Char nSlash = '\\'; diff --git a/svtools/source/svrtf/rtfout.cxx b/svtools/source/svrtf/rtfout.cxx index 21368c0b14d3..065fc6ba5572 100644 --- a/svtools/source/svrtf/rtfout.cxx +++ b/svtools/source/svrtf/rtfout.cxx @@ -141,11 +141,15 @@ SvStream& RTFOutFuncs::Out_Char(SvStream& rStream, sal_Unicode c, // then write as unicode - character if (*pUCMode != nLen) { - rStream << "\\uc" << ByteString::CreateFromInt32(nLen).GetBuffer() << " "; // #i47831# add an additional whitespace, so that "document whitespaces" are not ignored.; + // #i47831# add an additional whitespace, so that + // "document whitespaces" are not ignored.; + rStream << "\\uc" + << rtl::OString::valueOf(nLen).getStr() << " "; *pUCMode = nLen; } - ByteString sNo(ByteString::CreateFromInt32(c)); - rStream << "\\u" << sNo.GetBuffer(); + rStream << "\\u" + << rtl::OString::valueOf( + static_cast<sal_Int32>(c)).getStr(); } for (sal_Int32 nI = 0; nI < nLen; ++nI) @@ -176,17 +180,6 @@ SvStream& RTFOutFuncs::Out_String( SvStream& rStream, const String& rStr, return rStream; } -SvStream& RTFOutFuncs::Out_Fontname(SvStream& rStream, const String& rStr, - rtl_TextEncoding eDestEnc, sal_Bool bWriteHelpFile) -{ - //Fontnames in word have a quirk in that \uc and usage of ansi replacement - //chars after a \u don't work and in wordpad \u doesn't work, so we are - //left with forcing ansi characters only for fontnames - for (xub_StrLen n = 0; n < rStr.Len(); ++n) - Out_Char(rStream, rStr.GetChar(n), 0, eDestEnc, bWriteHelpFile); - return rStream; -} - SvStream& RTFOutFuncs::Out_Hex( SvStream& rStream, sal_uLong nHex, sal_uInt8 nLen ) { sal_Char aNToABuf[] = "0000000000000000"; diff --git a/svtools/source/uno/miscservices.cxx b/svtools/source/uno/miscservices.cxx index c652b6028bf0..e49672bbac52 100644 --- a/svtools/source/uno/miscservices.cxx +++ b/svtools/source/uno/miscservices.cxx @@ -96,13 +96,7 @@ DECLARE_CREATEINSTANCE_NAMESPACE( unographic, GraphicRendererVCL ) extern "C" { -SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment ( - const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */) -{ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} - -SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory ( +SAL_DLLPUBLIC_EXPORT void * SAL_CALL svt_component_getFactory ( const sal_Char * pImplementationName, void * _pServiceManager, void * pRegistryKey) { void * pResult = 0; diff --git a/svtools/source/uno/unoiface.cxx b/svtools/source/uno/unoiface.cxx index d2cf9cbf12cf..4bc5cae12cb6 100644 --- a/svtools/source/uno/unoiface.cxx +++ b/svtools/source/uno/unoiface.cxx @@ -34,7 +34,6 @@ #include <vcl/svapp.hxx> #include <svtools/svmedit.hxx> #include <unoiface.hxx> -#include <svtools/filedlg.hxx> #include <svtools/filectrl.hxx> #include <svtools/roadmap.hxx> #include <svtools/fixedhyper.hxx> diff --git a/svtools/util/svt.component b/svtools/util/svt.component index e15970547a38..2ba695d72e92 100644 --- a/svtools/util/svt.component +++ b/svtools/util/svt.component @@ -26,7 +26,7 @@ * **********************************************************************--> -<component loader="com.sun.star.loader.SharedLibrary" +<component loader="com.sun.star.loader.SharedLibrary" prefix="svt" xmlns="http://openoffice.org/2010/uno-components"> <implementation name="com.sun.star.comp.graphic.GraphicProvider"> <service name="com.sun.star.graphic.GraphicProvider"/> diff --git a/svtools/workben/unodialog/udlg_services.cxx b/svtools/workben/unodialog/udlg_services.cxx index bf9386dd7aea..cb2949791e9c 100644 --- a/svtools/workben/unodialog/udlg_services.cxx +++ b/svtools/workben/unodialog/udlg_services.cxx @@ -56,6 +56,11 @@ namespace udlg } // namespace udlg //........................................................................ -IMPLEMENT_COMPONENT_LIBRARY_API( ::udlg::UdlgModule, ::udlg::initializeModule ) +extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( + const sal_Char* pImplementationName, void* pServiceManager, void* pRegistryKey ) +{ + ::udlg::initializeModule(); + return ::udlg::UdlgModule::getInstance().getComponentFactory( pImplementationName, pServiceManager, pRegistryKey ); +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/Library_tk.mk b/toolkit/Library_tk.mk index 6cae73035236..c663330c83db 100644 --- a/toolkit/Library_tk.mk +++ b/toolkit/Library_tk.mk @@ -38,13 +38,17 @@ $(eval $(call gb_Library_set_include,tk,\ -I$(realpath $(SRCDIR)/toolkit/inc) \ -I$(realpath $(SRCDIR)/toolkit/inc/pch) \ -I$(realpath $(SRCDIR)/toolkit/source) \ - -I$(OUTDIR)/inc/offuh \ )) $(eval $(call gb_Library_add_defs,tk,\ -DTOOLKIT_DLLIMPLEMENTATION \ )) +$(eval $(call gb_Library_add_api,tk,\ + udkapi \ + offapi \ +)) + $(eval $(call gb_Library_add_linked_libs,tk,\ comphelper \ cppu \ @@ -163,6 +167,11 @@ $(eval $(call gb_Library_add_cxxflags,tk,\ )) endif +ifeq ($(GUIBASE),cocoatouch) +$(eval $(call gb_Library_set_cxxflags,tk,\ + $$(CXXFLAGS) $(gb_OBJCXXFLAGS))) +endif + ifneq (,$(filter LINUX DRAGONFLY OPENBSD FREEBSD NETBSD, $(OS))) $(eval $(call gb_Library_add_linked_libs,tk,\ X11 \ diff --git a/toolkit/inc/toolkit/helper/macros.hxx b/toolkit/inc/toolkit/helper/macros.hxx index 255530a32628..7275b8a7ffd3 100644 --- a/toolkit/inc/toolkit/helper/macros.hxx +++ b/toolkit/inc/toolkit/helper/macros.hxx @@ -189,13 +189,13 @@ void ClassName::disposing( const ::com::sun::star::lang::EventObject& ) throw(:: { \ xListener->MethodName( aMulti, aMulti2 ); \ } \ - catch( ::com::sun::star::lang::DisposedException e ) \ + catch(const ::com::sun::star::lang::DisposedException& e) \ { \ OSL_ENSURE( e.Context.is(), "caught DisposedException with empty Context field" ); \ if ( e.Context == xListener || !e.Context.is() ) \ aIt.remove(); \ } \ - catch( ::com::sun::star::uno::RuntimeException e ) \ + catch(const ::com::sun::star::uno::RuntimeException& e) \ { \ DISPLAY_EXCEPTION( ClassName, MethodName, e ) \ } \ @@ -214,13 +214,13 @@ void ClassName::disposing( const ::com::sun::star::lang::EventObject& ) throw(:: { \ xListener->MethodName( aMulti ); \ } \ - catch( ::com::sun::star::lang::DisposedException e ) \ + catch(const ::com::sun::star::lang::DisposedException& e) \ { \ OSL_ENSURE( e.Context.is(), "caught DisposedException with empty Context field" ); \ if ( e.Context == xListener || !e.Context.is() ) \ aIt.remove(); \ } \ - catch( ::com::sun::star::uno::RuntimeException e ) \ + catch(const ::com::sun::star::uno::RuntimeException& e) \ { \ DISPLAY_EXCEPTION( ClassName, MethodName, e ) \ } \ @@ -240,13 +240,13 @@ void ClassName::disposing( const ::com::sun::star::lang::EventObject& ) throw(:: { \ xListener->MethodName( aMulti ); \ } \ - catch( ::com::sun::star::lang::DisposedException e ) \ + catch(const ::com::sun::star::lang::DisposedException& e) \ { \ OSL_ENSURE( e.Context.is(), "caught DisposedException with empty Context field" ); \ if ( e.Context == xListener || !e.Context.is() ) \ aIt.remove(); \ } \ - catch( ::com::sun::star::uno::RuntimeException e ) \ + catch(const ::com::sun::star::uno::RuntimeException& e) \ { \ DISPLAY_EXCEPTION( ClassName, MethodName, e ) \ } \ diff --git a/toolkit/source/awt/vclxgraphics.cxx b/toolkit/source/awt/vclxgraphics.cxx index dc2c84702664..8f29a5e5e86f 100644 --- a/toolkit/source/awt/vclxgraphics.cxx +++ b/toolkit/source/awt/vclxgraphics.cxx @@ -73,9 +73,17 @@ VCLXGraphics::VCLXGraphics() VCLXGraphics::~VCLXGraphics() { - List* pLst = mpOutputDevice ? mpOutputDevice->GetUnoGraphicsList() : NULL; + VCLXGraphicsList_impl* pLst = mpOutputDevice ? mpOutputDevice->GetUnoGraphicsList() : NULL; if ( pLst ) - pLst->Remove( this ); + { + for( VCLXGraphicsList_impl::iterator it = pLst->begin(); it < pLst->end(); ++it ) + { + if( *it == this ) { + pLst->erase( it ); + break; + } + } + } delete mpClipRegion; } @@ -100,10 +108,10 @@ void VCLXGraphics::Init( OutputDevice* pOutDev ) mpClipRegion = NULL; // Register at OutputDevice - List* pLst = mpOutputDevice->GetUnoGraphicsList(); + VCLXGraphicsList_impl* pLst = mpOutputDevice->GetUnoGraphicsList(); if ( !pLst ) pLst = mpOutputDevice->CreateUnoGraphicsList(); - pLst->Insert( this, LIST_APPEND ); + pLst->push_back( this ); } void VCLXGraphics::InitOutputDevice( sal_uInt16 nFlags ) diff --git a/toolkit/source/awt/vclxsystemdependentwindow.cxx b/toolkit/source/awt/vclxsystemdependentwindow.cxx index 7cb667b18528..646462521af6 100644 --- a/toolkit/source/awt/vclxsystemdependentwindow.cxx +++ b/toolkit/source/awt/vclxsystemdependentwindow.cxx @@ -46,6 +46,12 @@ #include "postmac.h" #endif +#ifdef IOS +#include "premac.h" +#include <UIKit/UIKit.h> +#include "postmac.h" +#endif + #include <vcl/svapp.hxx> #include <vcl/syschild.hxx> #include <vcl/sysdata.hxx> @@ -97,6 +103,11 @@ IMPL_XTYPEPROVIDER_END { aRet <<= (sal_IntPtr)pSysData->pView; } +#elif (defined IOS) + if( SystemType == ::com::sun::star::lang::SystemDependent::SYSTEM_IOS ) + { + aRet <<= (sal_IntPtr)pSysData->pView; + } #elif (defined UNX) if( SystemType == ::com::sun::star::lang::SystemDependent::SYSTEM_XWINDOW ) { diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx index f255777f5cb6..19a76c9052c8 100644 --- a/toolkit/source/awt/vclxtoolkit.cxx +++ b/toolkit/source/awt/vclxtoolkit.cxx @@ -64,6 +64,13 @@ #include <Cocoa/Cocoa.h> #include "postmac.h" #endif + +#ifdef IOS +#include "premac.h" +#include <UIKit/UIKit.h> +#include "postmac.h" +#endif + #include <vcl/sysdata.hxx> #include <toolkit/awt/vclxwindows.hxx> @@ -982,6 +989,8 @@ Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp, aParentData.nSize = sizeof( aParentData ); #if defined QUARTZ aParentData.pView = reinterpret_cast<NSView*>(nWindowHandle); + #elif defined IOS + aParentData.pView = reinterpret_cast<UIView*>(nWindowHandle); #elif defined UNX aParentData.aWindow = nWindowHandle; aParentData.bXEmbedSupport = bXEmbed; @@ -1069,7 +1078,7 @@ css::uno::Reference< css::awt::XWindowPeer > VCLXToolkit::ImplCreateWindow( { VCLXWindow* pParentComponent = VCLXWindow::GetImplementation( rDescriptor.Parent ); - // #103939# Don't through assertion, may be it's a system dependend window, used in ImplCreateWindow. + // #103939# Don't throw assertion, may be it's a system dependend window, used in ImplCreateWindow. // DBG_ASSERT( pParentComponent, "ParentComponent not valid" ); if ( pParentComponent ) @@ -1206,6 +1215,8 @@ css::uno::Reference< css::awt::XWindowPeer > VCLXToolkit::ImplCreateWindow( aParentData.nSize = sizeof( aParentData ); #if defined QUARTZ aParentData.pView = reinterpret_cast<NSView*>(nWindowHandle); + #elif defined IOS + aParentData.pView = reinterpret_cast<UIView*>(nWindowHandle); #elif defined UNX aParentData.aWindow = nWindowHandle; aParentData.bXEmbedSupport = bXEmbed; diff --git a/toolkit/source/awt/vclxtopwindow.cxx b/toolkit/source/awt/vclxtopwindow.cxx index 8bf3c861c01d..44f8f94cb50c 100644 --- a/toolkit/source/awt/vclxtopwindow.cxx +++ b/toolkit/source/awt/vclxtopwindow.cxx @@ -37,6 +37,12 @@ #include "postmac.h" #endif +#if defined ( IOS ) +#include "premac.h" +#include <UIKit/UIKit.h> +#include "postmac.h" +#endif + #include <vcl/syschild.hxx> #include <vcl/sysdata.hxx> #include <cppuhelper/typeprovider.hxx> @@ -109,6 +115,11 @@ Sequence< Type > VCLXTopWindow_Base::getTypes() throw(RuntimeException) { aRet <<= (sal_IntPtr)pSysData->pView; } +#elif (defined IOS) + if( SystemType == ::com::sun::star::lang::SystemDependent::SYSTEM_IOS ) + { + aRet <<= (sal_IntPtr)pSysData->pView; + } #elif (defined UNX) if( SystemType == ::com::sun::star::lang::SystemDependent::SYSTEM_XWINDOW ) { diff --git a/toolkit/source/awt/vclxwindow1.cxx b/toolkit/source/awt/vclxwindow1.cxx index 6a9c64ba3c95..28d97fcb826d 100644 --- a/toolkit/source/awt/vclxwindow1.cxx +++ b/toolkit/source/awt/vclxwindow1.cxx @@ -43,6 +43,10 @@ #include "premac.h" #include <Cocoa/Cocoa.h> #include "postmac.h" +#elif defined ( IOS ) +#include "premac.h" +#include <UIKit/UIKit.h> +#include "postmac.h" #endif #include <vcl/sysdata.hxx> @@ -96,6 +100,8 @@ void VCLXWindow::SetSystemParent_Impl( const com::sun::star::uno::Any& rHandle ) aSysParentData.hWnd = (HWND) nHandle; #elif defined( QUARTZ ) aSysParentData.pView = reinterpret_cast<NSView*>(nHandle); +#elif defined( IOS ) + aSysParentData.pView = reinterpret_cast<UIView*>(nHandle); #elif defined( UNX ) aSysParentData.aWindow = (long)nHandle; aSysParentData.bXEmbedSupport = bXEmbed; diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx index 1c6d5418dd38..f95ceb65f3ac 100644 --- a/toolkit/source/awt/vclxwindows.cxx +++ b/toolkit/source/awt/vclxwindows.cxx @@ -6470,7 +6470,7 @@ void VCLXPatternField::getMasks( ::rtl::OUString& EditMask, ::rtl::OUString& Lit PatternField* pPatternField = (PatternField*) GetWindow(); if ( pPatternField ) { - EditMask = String( pPatternField->GetEditMask(), RTL_TEXTENCODING_ASCII_US ); + EditMask = rtl::OStringToOUString(pPatternField->GetEditMask(), RTL_TEXTENCODING_ASCII_US); LiteralMask = pPatternField->GetLiteralMask(); } } diff --git a/toolkit/source/helper/registerservices.cxx b/toolkit/source/helper/registerservices.cxx index cadd228d1c4b..3a532b83de14 100644 --- a/toolkit/source/helper/registerservices.cxx +++ b/toolkit/source/helper/registerservices.cxx @@ -236,12 +236,7 @@ extern void * SAL_CALL comp_Layout_component_getFactory( const char * implName, extern "C" { -TOOLKIT_DLLPUBLIC void SAL_CALL component_getImplementationEnvironment( const sal_Char** ppEnvTypeName, uno_Environment** ) -{ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} - -TOOLKIT_DLLPUBLIC void* SAL_CALL component_getFactory( const sal_Char* sImplementationName, void* _pServiceManager, void* _pRegistryKey ) +TOOLKIT_DLLPUBLIC void* SAL_CALL tk_component_getFactory( const sal_Char* sImplementationName, void* _pServiceManager, void* _pRegistryKey ) { void* pRet = NULL; diff --git a/toolkit/source/helper/unowrapper.cxx b/toolkit/source/helper/unowrapper.cxx index b5abb11d632e..cc4992d250e0 100644 --- a/toolkit/source/helper/unowrapper.cxx +++ b/toolkit/source/helper/unowrapper.cxx @@ -206,12 +206,12 @@ void UnoWrapper::SetWindowInterface( Window* pWindow, ::com::sun::star::uno::Ref void UnoWrapper::ReleaseAllGraphics( OutputDevice* pOutDev ) { - List* pLst = pOutDev->GetUnoGraphicsList(); + VCLXGraphicsList_impl* pLst = pOutDev->GetUnoGraphicsList(); if ( pLst ) { - for ( sal_uInt32 n = 0; n < pLst->Count(); n++ ) + for ( size_t n = 0; n < pLst->size(); n++ ) { - VCLXGraphics* pGrf = (VCLXGraphics*)pLst->GetObject( n ); + VCLXGraphics* pGrf = (*pLst)[ n ]; pGrf->SetOutputDevice( NULL ); } } diff --git a/toolkit/source/layout/core/root.cxx b/toolkit/source/layout/core/root.cxx index 6a3ebe85e836..f83f42a94cec 100644 --- a/toolkit/source/layout/core/root.cxx +++ b/toolkit/source/layout/core/root.cxx @@ -71,7 +71,7 @@ LayoutRoot::~LayoutRoot() m_refCount++; // inhibit multiple destruction dispose(); } - catch( uno::Exception& ) + catch (const uno::Exception&) { } } @@ -186,7 +186,7 @@ void SAL_CALL LayoutRoot::initialize( const uno::Sequence< uno::Any >& aArgument { xParser->parseStream( source ); } - catch ( xml::sax::SAXParseException& e ) + catch (const xml::sax::SAXParseException& e) { OUString c(RTL_CONSTASCII_USTRINGPARAM(":")); error( aXMLName @@ -361,7 +361,7 @@ bool LayoutWidget::addChild( LayoutWidget *pChild ) { mxContainer->addChild( pChild->mxWidget ); } - catch( awt::MaxChildrenException ex ) + catch (const awt::MaxChildrenException&) { return false; } diff --git a/toolkit/source/layout/vcl/wbutton.cxx b/toolkit/source/layout/vcl/wbutton.cxx index 5e303ada03ba..96e6aeb5d251 100644 --- a/toolkit/source/layout/vcl/wbutton.cxx +++ b/toolkit/source/layout/vcl/wbutton.cxx @@ -276,7 +276,6 @@ public: if ( !mxRadioButton.is() ) return; -#if 1 // Have setState fire item event for // RadioGroups::RadioGroup::itemStateChanged () ::RadioButton *r = static_cast<RadioButton*>(mpWindow)->GetRadioButton (); @@ -284,9 +283,6 @@ public: r->EnableRadioCheck(); mxRadioButton->setState( !!bCheck ); r->EnableRadioCheck (state); -#else - mxRadioButton->setState( !!bCheck ); -#endif fireToggle(); } diff --git a/toolkit/util/tk.component b/toolkit/util/tk.component index 4d4713e87c45..f6638794de12 100644 --- a/toolkit/util/tk.component +++ b/toolkit/util/tk.component @@ -26,7 +26,7 @@ * **********************************************************************--> -<component loader="com.sun.star.loader.SharedLibrary" +<component loader="com.sun.star.loader.SharedLibrary" prefix="tk" xmlns="http://openoffice.org/2010/uno-components"> <implementation name="com.sun.star.awt.comp.AsyncCallback"> <service name="com.sun.star.awt.AsyncCallback"/> diff --git a/tools/Executable_mkunroll.mk b/tools/Executable_mkunroll.mk index c81bfb19b4b3..d423b73c755b 100644 --- a/tools/Executable_mkunroll.mk +++ b/tools/Executable_mkunroll.mk @@ -49,8 +49,4 @@ $(eval $(call gb_Executable_add_exception_objects,mkunroll,\ tools/bootstrp/mkunroll/mkunroll \ )) -$(eval $(call gb_Executable_add_linked_static_libs,rscdep,\ - toolshelpers \ -)) - # vim: set noet sw=4 ts=4: diff --git a/tools/Library_tl.mk b/tools/Library_tl.mk index 297484b39583..439f171f406b 100644 --- a/tools/Library_tl.mk +++ b/tools/Library_tl.mk @@ -38,7 +38,6 @@ $(eval $(call gb_Library_set_include,tl,\ -I$(realpath $(SRCDIR)/tools/inc/pch) \ -I$(SRCDIR)/solenv/inc \ -I$(SRCDIR)/solenv/inc/Xp31 \ - -I$(OUTDIR)/inc/offuh \ -I$(WORKDIR)/CustomTarget/tools/source/reversemap \ )) @@ -47,6 +46,11 @@ $(eval $(call gb_Library_add_defs,tl,\ -DVCL \ )) +$(eval $(call gb_Library_add_api,tl,\ + udkapi \ + offapi \ +)) + $(eval $(call gb_Library_add_linked_libs,tl,\ basegfx \ comphelper \ diff --git a/tools/Module_tools.mk b/tools/Module_tools.mk index a16310587a1f..064f6d74de7d 100644 --- a/tools/Module_tools.mk +++ b/tools/Module_tools.mk @@ -29,10 +29,6 @@ $(eval $(call gb_Module_Module,tools)) $(eval $(call gb_Module_add_targets,tools,\ - Executable_bestreversemap \ - Executable_mkunroll \ - Executable_rscdep \ - Executable_so_checksum \ Library_tl \ Package_inc \ Package_reversemap \ @@ -40,4 +36,13 @@ $(eval $(call gb_Module_add_targets,tools,\ StaticLibrary_toolshelpers \ )) +ifneq ($(CROSS_COMPILING),YES) +$(eval $(call gb_Module_add_targets,tools,\ + Executable_bestreversemap \ + Executable_mkunroll \ + Executable_rscdep \ + Executable_so_checksum \ +)) +endif + # vim: set noet sw=4 ts=4: diff --git a/tools/StaticLibrary_ooopathutils.mk b/tools/StaticLibrary_ooopathutils.mk index e58becb175d3..c5b2ea6ad846 100644 --- a/tools/StaticLibrary_ooopathutils.mk +++ b/tools/StaticLibrary_ooopathutils.mk @@ -39,7 +39,7 @@ $(eval $(call gb_StaticLibrary_add_exception_objects,ooopathutils,\ # Instead of this evil linking of an object from $(OUTDIR) define StaticLibrary_ooopathutils_hack $(call gb_StaticLibrary_get_target,ooopathutils) : $(OUTDIR)/lib/$(1) -$$(eval $$(call gb_Deliver_add_deliverable,$(OUTDIR)/lib/$(1),$(call gb_CxxObject_get_target,tools/source/misc/pathutils))) +$$(eval $$(call gb_Deliver_add_deliverable,$(OUTDIR)/lib/$(1),$(call gb_CxxObject_get_target,tools/source/misc/pathutils),$(1))) $(OUTDIR)/lib/$(1) : $(call gb_CxxObject_get_target,tools/source/misc/pathutils) $$(call gb_Deliver_deliver,$$<,$$@) diff --git a/tools/StaticLibrary_toolshelpers.mk b/tools/StaticLibrary_toolshelpers.mk index f8e306aab99d..5583c8b4a056 100644 --- a/tools/StaticLibrary_toolshelpers.mk +++ b/tools/StaticLibrary_toolshelpers.mk @@ -39,7 +39,6 @@ $(eval $(call gb_StaticLibrary_add_cxxflags,toolshelpers,\ )) $(eval $(call gb_StaticLibrary_add_exception_objects,toolshelpers,\ - tools/bootstrp/appdef \ tools/bootstrp/cppdep \ tools/bootstrp/prj \ )) diff --git a/tools/bootstrp/md5.cxx b/tools/bootstrp/md5.cxx index 1df85d32ff80..18ecb46ceb9d 100644 --- a/tools/bootstrp/md5.cxx +++ b/tools/bootstrp/md5.cxx @@ -34,7 +34,7 @@ #include <cstddef> #include <stdio.h> -#include <tools/string.hxx> +#include <rtl/strbuf.hxx> #ifdef WNT #define FILE_OPEN_READ "rb" @@ -93,13 +93,14 @@ void normalize_pe_image(sal_uInt8* buffer, size_t nBufferSize) } } -rtlDigestError calc_md5_checksum( const char *filename, ByteString &aChecksum ) +rtlDigestError calc_md5_checksum(const char *filename, rtl::OString &rChecksum) { const size_t BUFFER_SIZE = 0x1000; const size_t MINIMAL_SIZE = 512; sal_uInt8 checksum[RTL_DIGEST_LENGTH_MD5]; - rtlDigestError error = rtl_Digest_E_None; + rtlDigestError error = rtl_Digest_E_None; + rtl::OStringBuffer aChecksumBuf; FILE *fp = fopen( filename, FILE_OPEN_READ ); @@ -136,8 +137,8 @@ rtlDigestError calc_md5_checksum( const char *filename, ByteString &aChecksum ) for ( std::size_t i = 0; i < sizeof(checksum); i++ ) { if ( checksum[i] < 16 ) - aChecksum.Append( "0" ); - aChecksum += ByteString::CreateFromInt32( checksum[i], 16 ); + aChecksumBuf.append('0'); + aChecksumBuf.append(static_cast<sal_Int32>(checksum[i]), 16); } } @@ -146,6 +147,8 @@ rtlDigestError calc_md5_checksum( const char *filename, ByteString &aChecksum ) else error = rtl_Digest_E_Unknown; + rChecksum = aChecksumBuf.makeStringAndClear(); + return error; } diff --git a/tools/bootstrp/md5.hxx b/tools/bootstrp/md5.hxx index f8d6e6b9695a..9f6e4aea6100 100644 --- a/tools/bootstrp/md5.hxx +++ b/tools/bootstrp/md5.hxx @@ -27,8 +27,8 @@ ************************************************************************/ #include <rtl/digest.h> -class ByteString; +#include <rtl/string.hxx> -rtlDigestError calc_md5_checksum( const char *filename, ByteString &aChecksum ); +rtlDigestError calc_md5_checksum(const char *filename, rtl::OString &rChecksum); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/bootstrp/mkunroll/mkunroll.cxx b/tools/bootstrp/mkunroll/mkunroll.cxx index ff958ba8e717..c1b0252a65ca 100644 --- a/tools/bootstrp/mkunroll/mkunroll.cxx +++ b/tools/bootstrp/mkunroll/mkunroll.cxx @@ -212,7 +212,7 @@ void MkFilter::Filter() { MkLine *pMkLine = (*pLine->pPrivateTnrLst)[ i ]; ByteString aLine = pMkLine->aLine; - while( aLine.SearchAndReplace( aTnr, ByteString::CreateFromInt32( n )) != (sal_uInt16)-1 ) ; + while( aLine.SearchAndReplace( aTnr, rtl::OString::valueOf(static_cast<sal_Int32>(n)) ) != (sal_uInt16)-1 ) ; fputs( aLine.GetBuffer(), pOut ); fprintf( stderr, "o" ); } diff --git a/tools/bootstrp/prj.cxx b/tools/bootstrp/prj.cxx index 00be3bedddee..b44592c562ec 100644 --- a/tools/bootstrp/prj.cxx +++ b/tools/bootstrp/prj.cxx @@ -53,26 +53,26 @@ SimpleConfig::~SimpleConfig() aFileStream.Close (); } -ByteString SimpleConfig::GetNext() +rtl::OString SimpleConfig::getNext() { - if ( aStringBuffer =="" ) + if (aStringBuffer == "") while ((aStringBuffer = GetNextLine()) == "\t") ; //solange bis != "\t" - if ( aStringBuffer =="" ) - return ByteString(); + if ( aStringBuffer == "" ) + return rtl::OString(); - ByteString aString = aStringBuffer.GetToken(0,'\t'); - aStringBuffer.Erase(0, aString.Len()+1); + rtl::OString aString = aStringBuffer.GetToken(0,'\t'); + aStringBuffer.Erase(0, aString.getLength()+1); aStringBuffer.EraseLeadingChars( '\t' ); return aString; } -ByteString SimpleConfig::GetNextLine() +rtl::OString SimpleConfig::GetNextLine() { aFileStream.ReadLine ( aTmpStr ); if ( aTmpStr.Search( "#" ) == 0 ) - return "\t"; + return rtl::OString('\t'); aTmpStr = aTmpStr.EraseLeadingChars(); aTmpStr = aTmpStr.EraseTrailingChars(); while ( aTmpStr.SearchAndReplace(ByteString(' '),ByteString('\t') ) != STRING_NOTFOUND ) ; diff --git a/tools/bootstrp/rscdep.cxx b/tools/bootstrp/rscdep.cxx index 1ebd9e85ac9a..d1e26f21d27a 100644 --- a/tools/bootstrp/rscdep.cxx +++ b/tools/bootstrp/rscdep.cxx @@ -125,13 +125,13 @@ int main( int argc, char** argv ) } if (aBuf[0] == '@' ) { - ByteString aToken; + rtl::OString aToken; String aRespName( &aBuf[1], gsl_getSystemTextEncoding()); SimpleConfig aConfig( aRespName ); - while ( (aToken = aConfig.GetNext()) != "") + while ((aToken = aConfig.getNext()).getLength()) { char aBuf2[255]; - (void) strcpy( aBuf2, aToken.GetBuffer()); + strcpy( aBuf2, aToken.getStr()); if ( aBuf[0] == '-' && aBuf[1] == 'p' && aBuf[2] == '=' ) { strcpy(pFileNamePrefix, &aBuf[3]); diff --git a/tools/bootstrp/so_checksum.cxx b/tools/bootstrp/so_checksum.cxx index e38252ea2f70..9ff6a6832379 100644 --- a/tools/bootstrp/so_checksum.cxx +++ b/tools/bootstrp/so_checksum.cxx @@ -31,20 +31,20 @@ #include "md5.hxx" -#include <stdio.h> +#include <rtl/string.hxx> -#include <tools/string.hxx> +#include <stdio.h> int main( int argc, char * argv[] ) { - for ( int n = 1; n < argc; n++ ) + for (int n = 1; n < argc; ++n) { - ByteString aChecksum; - rtlDigestError error = calc_md5_checksum( argv[n], aChecksum ); + rtl::OString aChecksum; + rtlDigestError error = calc_md5_checksum(argv[n], aChecksum); if ( rtl_Digest_E_None == error ) { - printf( "%s %s\n", aChecksum.GetBuffer(), argv[n] ); + printf( "%s %s\n", aChecksum.getStr(), argv[n] ); } else printf( "ERROR: Unable to calculate MD5 checksum for %s\n", argv[n] ); diff --git a/tools/inc/bootstrp/prj.hxx b/tools/inc/bootstrp/prj.hxx index 496f47bc88d1..35896065d159 100644 --- a/tools/inc/bootstrp/prj.hxx +++ b/tools/inc/bootstrp/prj.hxx @@ -31,6 +31,7 @@ #include <tools/fsys.hxx> #include <tools/stream.hxx> +#include <rtl/string.hxx> /********************************************************************* * @@ -45,11 +46,11 @@ class SimpleConfig ByteString aTmpStr; ByteString aStringBuffer; - ByteString GetNextLine(); + rtl::OString GetNextLine(); public: SimpleConfig(const String& rSimpleConfigFileName); ~SimpleConfig(); - ByteString GetNext(); + rtl::OString getNext(); }; #endif diff --git a/tools/inc/impstrg.hxx b/tools/inc/impstrg.hxx index e99e2b3990b3..178bccec26e8 100644 --- a/tools/inc/impstrg.hxx +++ b/tools/inc/impstrg.hxx @@ -46,12 +46,6 @@ const char* DbgCheckUniString( const void* pString ); xub_StrLen ImplStringLen( const sal_Char* pStr ); xub_StrLen ImplStringLen( const sal_Unicode* pStr ); -// ------------------------------------ -// - Zugriff fuer International class - -// ------------------------------------ - -sal_Unicode* ImplGet1ByteUnicodeTab( rtl_TextEncoding eTextEncoding ); - #endif // _IMPSTRG_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/b3dtrans.hxx b/tools/inc/tools/b3dtrans.hxx index 2c136870d72b..420db468291a 100644 --- a/tools/inc/tools/b3dtrans.hxx +++ b/tools/inc/tools/b3dtrans.hxx @@ -147,7 +147,6 @@ public: void Reset(); // ObjectTrans - void SetObjectTrans(const basegfx::B3DHomMatrix& rObj); const basegfx::B3DHomMatrix& GetObjectTrans() { return maObjectTrans; } const basegfx::B3DHomMatrix& GetInvObjectTrans() { return maInvObjectTrans; } @@ -156,35 +155,26 @@ public: basegfx::B3DPoint aVRP = basegfx::B3DPoint(0.0,0.0,1.0), basegfx::B3DVector aVPN = basegfx::B3DVector(0.0,0.0,1.0), basegfx::B3DVector aVUP = basegfx::B3DVector(0.0,1.0,0.0)); - void SetOrientation(basegfx::B3DHomMatrix& mOrient); const basegfx::B3DHomMatrix& GetOrientation() { return maOrientation; } const basegfx::B3DHomMatrix& GetInvOrientation() { return maInvOrientation; } // Projection void SetProjection(const basegfx::B3DHomMatrix& mProject); const basegfx::B3DHomMatrix& GetProjection(); - const basegfx::B3DHomMatrix& GetInvProjection(); // Texture - void SetTexture(const basegfx::B2DHomMatrix& rTxt); const basegfx::B2DHomMatrix& GetTexture() { return maTexture; } // Seitenverhaeltnis und Modus zu dessen Aufrechterhaltung double GetRatio() { return mfRatio; } void SetRatio(double fNew=1.0); Base3DRatio GetRatioMode() { return meRatio; } - void SetRatioMode(Base3DRatio eNew=Base3DRatioGrow); // Parameter der ViewportTransformation void SetDeviceRectangle(double fL=-1.0, double fR=1.0, double fB=-1.0, double fT=1.0, sal_Bool bBroadCastChange=sal_True); - void SetDeviceVolume(const basegfx::B3DRange& rVol, sal_Bool bBroadCastChange=sal_True); - void GetDeviceRectangle(double &fL, double &fR, double& fB, double& fT); - basegfx::B3DRange GetDeviceVolume(); double GetDeviceRectangleWidth() const { return mfRightBound - mfLeftBound; } double GetDeviceRectangleHeight() const { return mfTopBound - mfBottomBound; } - void SetFrontClippingPlane(double fF=0.0); double GetFrontClippingPlane() { return mfNearBound; } - void SetBackClippingPlane(double fB=1.0); double GetBackClippingPlane() { return mfFarBound; } void SetPerspective(sal_Bool bNew); sal_Bool GetPerspective() { return mbPerspective; } @@ -193,44 +183,13 @@ public: const Rectangle& GetViewportRectangle() { return maViewportRectangle; } void CalcViewport(); - // Spezielle Matritzen anfordern - basegfx::B3DHomMatrix GetMatFromObjectToView(); - - // Transponierte Inverse fuer Vectortransformationen - const basegfx::B3DHomMatrix& GetInvTransObjectToEye(); - - // Speziell zum Umwandeln von Punkten Objekt -> Device - const basegfx::B3DHomMatrix& GetObjectToDevice(); - - // Speziell zum Umwandeln von Punkten World -> View - const basegfx::B3DHomMatrix& GetMatFromWorldToView(); - const basegfx::B3DHomMatrix& GetInvMatFromWorldToView(); - // Bounds des Viewports lesen - const Rectangle& GetLogicalViewportBounds(); const basegfx::B3DVector& GetScale(); const basegfx::B3DVector& GetTranslate(); // Direkter Zugriff auf verschiedene Transformationen const basegfx::B3DPoint WorldToEyeCoor(const basegfx::B3DPoint& rVec); const basegfx::B3DPoint EyeToWorldCoor(const basegfx::B3DPoint& rVec); - const basegfx::B3DPoint EyeToViewCoor(const basegfx::B3DPoint& rVec); - const basegfx::B3DPoint ViewToEyeCoor(const basegfx::B3DPoint& rVec); - const basegfx::B3DPoint WorldToViewCoor(const basegfx::B3DPoint& rVec); - const basegfx::B3DPoint ViewToWorldCoor(const basegfx::B3DPoint& rVec); - const basegfx::B3DPoint DeviceToViewCoor(const basegfx::B3DPoint& rVec); - const basegfx::B3DPoint ViewToDeviceCoor(const basegfx::B3DPoint& rVec); - const basegfx::B3DPoint ObjectToWorldCoor(const basegfx::B3DPoint& rVec); - const basegfx::B3DPoint WorldToObjectCoor(const basegfx::B3DPoint& rVec); - const basegfx::B3DPoint ObjectToViewCoor(const basegfx::B3DPoint& rVec); - const basegfx::B3DPoint ViewToObjectCoor(const basegfx::B3DPoint& rVec); - const basegfx::B3DPoint ObjectToEyeCoor(const basegfx::B3DPoint& rVec); - const basegfx::B3DPoint EyeToObjectCoor(const basegfx::B3DPoint& rVec); - const basegfx::B3DPoint DeviceToEyeCoor(const basegfx::B3DPoint& rVec); - const basegfx::B3DPoint EyeToDeviceCoor(const basegfx::B3DPoint& rVec); - - const basegfx::B3DPoint InvTransObjectToEye(const basegfx::B3DPoint& rVec); - const basegfx::B2DPoint TransTextureCoor(const basegfx::B2DPoint& rVec); static void Frustum( basegfx::B3DHomMatrix& rTarget, @@ -252,7 +211,6 @@ protected: void PostSetObjectTrans(); void PostSetOrientation(); void PostSetProjection(); - void PostSetTexture(); void PostSetViewport(); void CalcMatObjectToDevice(); @@ -282,8 +240,6 @@ public: B3dViewport(); virtual ~B3dViewport(); - void SetVRP(const basegfx::B3DPoint& rNewVRP); - void SetVPN(const basegfx::B3DVector& rNewVPN); void SetVUV(const basegfx::B3DVector& rNewVUV); void SetViewportValues( const basegfx::B3DPoint& rNewVRP, @@ -324,22 +280,16 @@ public: virtual ~B3dCamera(); // Positionen - void SetPosition(const basegfx::B3DPoint& rNewPos); const basegfx::B3DPoint& GetPosition() const { return aPosition; } - void SetLookAt(const basegfx::B3DVector& rNewLookAt); const basegfx::B3DVector& GetLookAt() const { return aLookAt; } - void SetPositionAndLookAt(const basegfx::B3DPoint& rNewPos, const basegfx::B3DVector& rNewLookAt); // Brennweite in mm - void SetFocalLength(double fLen); double GetFocalLength() const { return fFocalLength; } // Neigung links/rechts - void SetBankAngle(double fAngle); double GetBankAngle() const { return fBankAngle; } // FocalLength Flag - void SetUseFocalLength(sal_Bool bNew); sal_Bool GetUseFocalLength() const { return (sal_Bool)bUseFocalLength; } protected: diff --git a/tools/inc/tools/bigint.hxx b/tools/inc/tools/bigint.hxx index 58810fffdd99..1b1d60bdb6e3 100644 --- a/tools/inc/tools/bigint.hxx +++ b/tools/inc/tools/bigint.hxx @@ -105,7 +105,6 @@ public: sal_Bool IsOne() const; sal_Bool IsLong() const { return !bIsBig; } void Abs(); - void DivMod( const BigInt &rDivisor, BigInt &rMod ); #ifdef _TLBIGINT_INT64 sal_Bool INT64 ( SbxINT64 *p ) const; sal_Bool UINT64( SbxUINT64 *p ) const; diff --git a/tools/inc/tools/fsys.hxx b/tools/inc/tools/fsys.hxx index 440d3aeaeabb..a0a494f538ad 100644 --- a/tools/inc/tools/fsys.hxx +++ b/tools/inc/tools/fsys.hxx @@ -215,9 +215,6 @@ public: static sal_uIntPtr SetReadOnlyFlag( const DirEntry &rEntry, sal_Bool bRO = sal_True ); static sal_Bool GetReadOnlyFlag( const DirEntry &rEntry ); - static ErrCode QueryDiskSpace( const String &rPath, - BigInt &rFreeBytes, BigInt &rTotalBytes ); - static void SetDateTime( const String& rFileName, const DateTime& rNewDateTime ); }; @@ -254,10 +251,13 @@ private: TOOLS_DLLPRIVATE FSysError ImpParseName( const ByteString& rIntiName, FSysPathStyle eParser ); +#if defined(WNT) TOOLS_DLLPRIVATE FSysError ImpParseOs2Name( const ByteString& rPfad, FSysPathStyle eStyle ); +#else TOOLS_DLLPRIVATE FSysError ImpParseUnixName( const ByteString& rPfad, FSysPathStyle eStyle ); +#endif TOOLS_DLLPRIVATE const DirEntry* ImpGetTopPtr() const; TOOLS_DLLPRIVATE DirEntry* ImpGetTopPtr(); @@ -290,7 +290,6 @@ public: void SetExtension( const String& rExt, char cSep = '.' ); String GetExtension( char cSep = '.' ) const; - String CutExtension( char cSep = '.' ); void SetName( const String& rName, FSysPathStyle eFormatter = FSYS_STYLE_HOST ); inline const String GetNameDirect() const { return String(aName, osl_getThreadTextEncoding()); } String GetName( FSysPathStyle eFormatter = FSYS_STYLE_HOST ) const; @@ -336,19 +335,20 @@ public: sal_Bool operator !=( const DirEntry& rAnotherDir ) const { return !(DirEntry::operator==( rAnotherDir )); } - StringCompare NameCompare( const DirEntry &rWith ) const; inline StringCompare NameCompareDirect( const DirEntry &rWith ) const { #ifdef UNX return rWith.aName.CompareTo( aName ); #else - return rWith.aName.CompareIgnoreCaseToAscii( aName ); + rtl::OString aThis(rtl::OString(aName).toAsciiLowerCase()); + rtl::OString aWith(rtl::OString(rWith.aName).toAsciiLowerCase()); + return static_cast<StringCompare>(aWith.compareTo(aThis)); #endif } static String GetAccessDelimiter( FSysPathStyle eFormatter = FSYS_STYLE_HOST ); static String GetSearchDelimiter( FSysPathStyle eFormatter = FSYS_STYLE_HOST ); - static FSysPathStyle GetPathStyle( const String &rDevice ); + static FSysPathStyle GetPathStyle(); }; // -------------- @@ -445,18 +445,10 @@ protected: #endif public: - Dir(); Dir( const DirEntry& rDirEntry, DirEntryKind nKind = FSYS_KIND_ALL ); - Dir( const DirEntry& rDirEntry, - DirEntryKind nKind, - FSysSort nSort, ... ); ~Dir(); - const WildCard& GetNameMask() const { return aNameMask; } - - FSysError SetSort( FSysSort nSort, ... ); - void Reset(); sal_uInt16 Scan( sal_uInt16 nCount = 5 ); size_t Count( sal_Bool bUpdated = sal_True ) const; @@ -522,12 +514,6 @@ public: #endif // BOOTSTRP -//======================================================================== - -void FSysEnableSysErrorBox( sal_Bool bEnable ); - -//======================================================================== - #if defined(DBG_UTIL) void FSysTest(); #endif diff --git a/tools/inc/tools/inetmime.hxx b/tools/inc/tools/inetmime.hxx index d5b56b090725..4a3abe577101 100644 --- a/tools/inc/tools/inetmime.hxx +++ b/tools/inc/tools/inetmime.hxx @@ -352,15 +352,6 @@ public: */ static inline int getBase64Weight(sal_uInt32 nChar); - /** Get a decimal digit encoded as US-ASCII. - - @param nWeight Must be in the range 0--9, inclusive. - - @return The decimal digit corresponding to nWeight (US-ASCII - '0'--'9'). - */ - static sal_uInt32 getDigit(int nWeight); - /** Get a hexadecimal digit encoded as US-ASCII. @param nWeight Must be in the range 0--15, inclusive. @@ -370,15 +361,6 @@ public: */ static sal_uInt32 getHexDigit(int nWeight); - /** Get a Base 64 digit encoded as US-ASCII. - - @param nWeight Must be in the range 0--63, inclusive. - - @return The Base 64 digit corresponding to nWeight (US-ASCII 'A'-- - 'Z', 'a'--'z', '0'--'9', '+' or '/'). - */ - static sal_uInt32 getBase64Digit(int nWeight); - static inline bool isHighSurrogate(sal_uInt32 nUTF16); static inline bool isLowSurrogate(sal_uInt32 nUTF16); @@ -394,28 +376,6 @@ public: @param pEnd1 Points past the end of the first string, must be >= pBegin1. - @param pBegin2 Points to the start of the second string, must not be - null. - - @param pEnd2 Points past the end of the second string, must be >= - pBegin2. - - @return True if the two strings are equal, ignoring the case of US- - ASCII alphabetic characters (US-ASCII 'A'--'Z' and 'a'--'z'). - */ - static bool equalIgnoreCase(const sal_Char * pBegin1, - const sal_Char * pEnd1, - const sal_Char * pBegin2, - const sal_Char * pEnd2); - - /** Check two US-ASCII strings for equality, ignoring case. - - @param pBegin1 Points to the start of the first string, must not be - null. - - @param pEnd1 Points past the end of the first string, must be >= - pBegin1. - @param pString2 Points to the start of the null terminated second string, must not be null. @@ -472,9 +432,6 @@ public: static bool startsWithLinearWhiteSpace(const sal_Char * pBegin, const sal_Char * pEnd); - static const sal_Char * skipLinearWhiteSpace(const sal_Char * pBegin, - const sal_Char * pEnd); - static const sal_Unicode * skipLinearWhiteSpace(const sal_Unicode * pBegin, const sal_Unicode * pEnd); @@ -503,12 +460,6 @@ public: static const sal_Unicode * skipQuotedString(const sal_Unicode * pBegin, const sal_Unicode * pEnd); - static const sal_Char * scanAtom(const sal_Char * pBegin, - const sal_Char * pEnd); - - static const sal_Unicode * scanAtom(const sal_Unicode * pBegin, - const sal_Unicode * pEnd); - static bool scanUnsigned(const sal_Char *& rBegin, const sal_Char * pEnd, bool bLeadingZeroes, sal_uInt32 & rValue); @@ -516,21 +467,6 @@ public: const sal_Unicode * pEnd, bool bLeadingZeroes, sal_uInt32 & rValue); - static bool scanUnsignedHex(const sal_Char *& rBegin, - const sal_Char * pEnd, bool bLeadingZeroes, - sal_uInt32 & rValue); - - static bool scanUnsignedHex(const sal_Unicode *& rBegin, - const sal_Unicode * pEnd, bool bLeadingZeroes, - sal_uInt32 & rValue); - - static const sal_Char * scanQuotedBlock(const sal_Char * pBegin, - const sal_Char * pEnd, - sal_uInt32 nOpening, - sal_uInt32 nClosing, - sal_Size & rLength, - bool & rModify); - static const sal_Unicode * scanQuotedBlock(const sal_Unicode * pBegin, const sal_Unicode * pEnd, sal_uInt32 nOpening, @@ -559,9 +495,6 @@ public: static rtl_TextEncoding getCharsetEncoding(const sal_Char * pBegin, const sal_Char * pEnd); - static rtl_TextEncoding getCharsetEncoding(const sal_Unicode * pBegin, - const sal_Unicode * pEnd); - static inline bool isMIMECharsetEncoding(rtl_TextEncoding eEncoding); static INetMIMECharsetList_Impl * @@ -591,18 +524,6 @@ public: static void writeUTF8(INetMIMEOutputSink & rSink, sal_uInt32 nChar); - static void writeUnsigned(INetMIMEOutputSink & rSink, sal_uInt32 nValue, - int nMinDigits = 1); - - static void writeDateTime(INetMIMEOutputSink & rSink, - const DateTime & rUTC); - - static void writeHeaderFieldBody(INetMIMEOutputSink & rSink, - HeaderFieldType eType, - const ByteString & rBody, - rtl_TextEncoding ePreferredEncoding, - bool bInitialSpace = true); - static void writeHeaderFieldBody(INetMIMEOutputSink & rSink, HeaderFieldType eType, const UniString & rBody, diff --git a/tools/inc/tools/inetmsg.hxx b/tools/inc/tools/inetmsg.hxx index f59f9d1d3590..b06541a8323d 100644 --- a/tools/inc/tools/inetmsg.hxx +++ b/tools/inc/tools/inetmsg.hxx @@ -36,6 +36,7 @@ #include <tools/inetmime.hxx> #include <tools/stream.hxx> #include <tools/string.hxx> +#include <vector> class DateTime; @@ -108,13 +109,14 @@ public: * INetMessage Interface. * *=====================================================================*/ + typedef ::std::vector< INetMessageHeader* > HeaderList_impl; class INetMessage { - List m_aHeaderList; + HeaderList_impl m_aHeaderList; - sal_uIntPtr m_nDocSize; - UniString m_aDocName; - SvLockBytesRef m_xDocLB; + sal_uIntPtr m_nDocSize; + UniString m_aDocName; + SvLockBytesRef m_xDocLB; void ListCleanup_Impl (void); void ListCopy (const INetMessage& rMsg); @@ -123,38 +125,36 @@ protected: UniString GetHeaderName_Impl ( sal_uIntPtr nIndex, rtl_TextEncoding eEncoding) const { - INetMessageHeader *p = - (INetMessageHeader*)(m_aHeaderList.GetObject(nIndex)); - if (p) - return UniString(p->GetName(), eEncoding); - else + if ( nIndex < m_aHeaderList.size() ) { + return UniString( m_aHeaderList[ nIndex ]->GetName(), eEncoding ); + } else { return UniString(); + } } UniString GetHeaderValue_Impl ( sal_uIntPtr nIndex, INetMIME::HeaderFieldType eType) const { - INetMessageHeader *p = - (INetMessageHeader*)(m_aHeaderList.GetObject(nIndex)); - if (p) - return INetMIME::decodeHeaderFieldBody (eType, p->GetValue()); - else + if ( nIndex < m_aHeaderList.size() ) { + return INetMIME::decodeHeaderFieldBody(eType, m_aHeaderList[ nIndex ]->GetValue()); + } else { return UniString(); + } } void SetHeaderField_Impl ( const INetMessageHeader &rHeader, sal_uIntPtr &rnIndex) { INetMessageHeader *p = new INetMessageHeader (rHeader); - if (m_aHeaderList.Count() <= rnIndex) + if (m_aHeaderList.size() <= rnIndex) { - m_aHeaderList.Insert (p, LIST_APPEND); - rnIndex = m_aHeaderList.Count() - 1; + rnIndex = m_aHeaderList.size(); + m_aHeaderList.push_back( p ); } else { - p = (INetMessageHeader*)(m_aHeaderList.Replace(p, rnIndex)); - delete p; + delete m_aHeaderList[ rnIndex ]; + m_aHeaderList[ rnIndex ] = p; } } @@ -188,7 +188,7 @@ public: return *this; } - sal_uIntPtr GetHeaderCount (void) const { return m_aHeaderList.Count(); } + sal_uIntPtr GetHeaderCount (void) const { return m_aHeaderList.size(); } UniString GetHeaderName (sal_uIntPtr nIndex) const { @@ -202,21 +202,17 @@ public: INetMessageHeader GetHeaderField (sal_uIntPtr nIndex) const { - INetMessageHeader *p = - (INetMessageHeader*)(m_aHeaderList.GetObject(nIndex)); - if (p) - return INetMessageHeader(*p); - else + if ( nIndex < m_aHeaderList.size() ) { + return INetMessageHeader( *m_aHeaderList[ nIndex ] ); + } else { return INetMessageHeader(); + } } - sal_uIntPtr SetHeaderField ( - const UniString& rName, - const UniString& rValue, - sal_uIntPtr nIndex = LIST_APPEND); - virtual sal_uIntPtr SetHeaderField ( - const INetMessageHeader &rField, sal_uIntPtr nIndex = LIST_APPEND); + const INetMessageHeader &rField, + sal_uIntPtr nIndex = ((sal_uIntPtr)-1) + ); sal_uIntPtr GetDocumentSize (void) const { return m_nDocSize; } void SetDocumentSize (sal_uIntPtr nSize) { m_nDocSize = nSize; } @@ -242,36 +238,6 @@ public: /*======================================================================= * - * INetMessageHeaderIterator Interface. - * - *=====================================================================*/ -class INetMessageHeaderIterator -{ - sal_uIntPtr nValueCount; - List aValueList; - UniString aEmptyString; - -public: - INetMessageHeaderIterator ( - const INetMessage& rMsg, const UniString& rHdrName); - virtual ~INetMessageHeaderIterator (void); - - sal_uIntPtr GetValueCount (void) const { return nValueCount; } - const UniString& GetValue (sal_uIntPtr nIndex) const - { - if (nIndex < nValueCount) - { - return *((UniString*)(aValueList.GetObject(nIndex))); - } - else - { - return aEmptyString; - } - } -}; - -/*======================================================================= - * * INetRFC822Message Interface. * *=====================================================================*/ @@ -310,18 +276,17 @@ public: INetRFC822Message& operator= (const INetRFC822Message& rMsg); - static sal_Bool GenerateDateField ( - const DateTime& rDateTime, UniString& rDateField); static sal_Bool ParseDateField ( const UniString& rDateField, DateTime& rDateTime); using INetMessage::SetHeaderField; virtual sal_uIntPtr SetHeaderField ( - const INetMessageHeader &rHeader, sal_uIntPtr nIndex = LIST_APPEND); + const INetMessageHeader &rHeader, + sal_uIntPtr nIndex = ((sal_uIntPtr)-1) + ); /** Header fields. */ - void SetBCC (const UniString& rBCC); UniString GetBCC (void) const { return GetHeaderValue_Impl ( @@ -329,7 +294,6 @@ public: INetMIME::HEADER_FIELD_ADDRESS); } - void SetCC (const UniString& rCC); UniString GetCC (void) const { return GetHeaderValue_Impl ( @@ -337,7 +301,6 @@ public: INetMIME::HEADER_FIELD_ADDRESS); } - void SetComments (const UniString& rComments); UniString GetComments (void) const { return GetHeaderValue_Impl ( @@ -345,7 +308,6 @@ public: INetMIME::HEADER_FIELD_TEXT); } - void SetDate (const UniString& rDate); UniString GetDate (void) const { return GetHeaderValue_Impl ( @@ -353,7 +315,6 @@ public: INetMIME::HEADER_FIELD_STRUCTURED); } - void SetFrom (const UniString& rFrom); UniString GetFrom (void) const { return GetHeaderValue_Impl ( @@ -361,7 +322,6 @@ public: INetMIME::HEADER_FIELD_ADDRESS); } - void SetInReplyTo (const UniString& rInReplyTo); UniString GetInReplyTo (void) const { return GetHeaderValue_Impl ( @@ -369,7 +329,6 @@ public: INetMIME::HEADER_FIELD_ADDRESS); // ??? MESSAGE_ID ??? } - void SetKeywords (const UniString& rKeywords); UniString GetKeywords (void) const { return GetHeaderValue_Impl ( @@ -377,7 +336,6 @@ public: INetMIME::HEADER_FIELD_PHRASE); } - void SetMessageID (const UniString& rMessageID); UniString GetMessageID (void) const { return GetHeaderValue_Impl ( @@ -385,7 +343,6 @@ public: INetMIME::HEADER_FIELD_MESSAGE_ID); } - void SetReferences (const UniString& rReferences); UniString GetReferences (void) const { return GetHeaderValue_Impl ( @@ -393,7 +350,6 @@ public: INetMIME::HEADER_FIELD_ADDRESS); } - void SetReplyTo (const UniString& rReplyTo); UniString GetReplyTo (void) const { return GetHeaderValue_Impl ( @@ -401,7 +357,6 @@ public: INetMIME::HEADER_FIELD_ADDRESS); } - void SetReturnPath (const UniString& rReturnPath); UniString GetReturnPath (void) const { return GetHeaderValue_Impl ( @@ -409,7 +364,6 @@ public: INetMIME::HEADER_FIELD_ADDRESS); } - void SetReturnReceiptTo (const UniString& rReturnReceiptTo); UniString GetReturnReceiptTo (void) const { return GetHeaderValue_Impl ( @@ -417,7 +371,6 @@ public: INetMIME::HEADER_FIELD_ADDRESS); } - void SetSender (const UniString& rSender); UniString GetSender (void) const { return GetHeaderValue_Impl ( @@ -425,7 +378,6 @@ public: INetMIME::HEADER_FIELD_ADDRESS); } - void SetSubject (const UniString& rSubject); UniString GetSubject (void) const { return GetHeaderValue_Impl ( @@ -433,7 +385,6 @@ public: INetMIME::HEADER_FIELD_TEXT); } - void SetTo (const UniString& rTo); UniString GetTo (void) const { return GetHeaderValue_Impl ( @@ -481,19 +432,19 @@ enum INetMessageContainerType INETMSG_MULTIPART_FORM_DATA }; +class INetMIMEMessage; +typedef ::std::vector< INetMIMEMessage* > INetMIMEMessgeList_impl; class TOOLS_DLLPUBLIC INetMIMEMessage : public INetRFC822Message { - sal_uIntPtr m_nIndex[INETMSG_MIME_NUMHDR]; + sal_uIntPtr m_nIndex[INETMSG_MIME_NUMHDR]; - INetMIMEMessage *pParent; - sal_uIntPtr nNumChildren; - List aChildren; - ByteString m_aBoundary; - sal_Bool bHeaderParsed; + INetMIMEMessage* pParent; + INetMIMEMessgeList_impl aChildren; + ByteString m_aBoundary; + sal_Bool bHeaderParsed; friend class INetMIMEMessageStream; - void SetChildCount (sal_uIntPtr nCount) { nNumChildren = nCount; } const ByteString& GetMultipartBoundary (void) const { return m_aBoundary; } void SetMultipartBoundary (const ByteString& rBnd) { m_aBoundary = rBnd; } @@ -519,7 +470,9 @@ public: using INetRFC822Message::SetHeaderField; virtual sal_uIntPtr SetHeaderField ( - const INetMessageHeader &rHeader, sal_uIntPtr nIndex = LIST_APPEND); + const INetMessageHeader &rHeader, + sal_uIntPtr nIndex = ((sal_uIntPtr)-1) + ); /** Header fields. */ @@ -529,7 +482,6 @@ public: return GetHeaderValue (m_nIndex[INETMSG_MIME_VERSION]); } - void SetContentDescription (const UniString& rDescription); UniString GetContentDescription (void) const { return GetHeaderValue (m_nIndex[INETMSG_MIME_CONTENT_DESCRIPTION]); @@ -541,7 +493,6 @@ public: return GetHeaderValue (m_nIndex[INETMSG_MIME_CONTENT_DISPOSITION]); } - void SetContentID (const UniString& rID); UniString GetContentID (void) const { return GetHeaderValue (m_nIndex[INETMSG_MIME_CONTENT_ID]); @@ -578,10 +529,9 @@ public: return (aType.CompareIgnoreCaseToAscii("multipart/", 10) == 0); } - sal_uIntPtr GetChildCount (void) const { return nNumChildren; } INetMIMEMessage* GetChild (sal_uIntPtr nIndex) const { - return ((INetMIMEMessage *)(aChildren.GetObject (nIndex))); + return ( nIndex < aChildren.size() ) ? aChildren[ nIndex ] : NULL; } INetMIMEMessage* GetParent (void) const { return pParent; } @@ -589,8 +539,6 @@ public: INetMessageContainerType eType = INETMSG_MULTIPART_MIXED); sal_Bool AttachChild ( INetMIMEMessage& rChildMsg, sal_Bool bOwner = sal_True); - sal_Bool DetachChild ( - sal_uIntPtr nIndex, INetMIMEMessage& rChildMsg) const; /** Stream operators. */ diff --git a/tools/inc/tools/inetstrm.hxx b/tools/inc/tools/inetstrm.hxx index 16de7beedd98..4d82c8de9791 100644 --- a/tools/inc/tools/inetstrm.hxx +++ b/tools/inc/tools/inetstrm.hxx @@ -68,9 +68,6 @@ public: virtual ~INetIStream (void); int Read (sal_Char *pData, sal_uIntPtr nSize); - - static void Decode64 (SvStream& rIn, SvStream& rOut); - static void Encode64 (SvStream& rIn, SvStream& rOut); }; /* @@ -93,20 +90,6 @@ public: int Write (const sal_Char *pData, sal_uIntPtr nSize); }; -/* - * INetIOStream. - */ -class INetIOStream : public INetIStream, public INetOStream -{ - // Not implemented. - INetIOStream (const INetIOStream& rStrm); - INetIOStream& operator= (const INetIOStream& rStrm); - -public: - INetIOStream (sal_uIntPtr nIBufferSize = 0, sal_uIntPtr nOBufferSize = 0); - virtual ~INetIOStream (void); -}; - /*========================================================================= * * INetMessageStream Interface. diff --git a/tools/inc/tools/prex.h b/tools/inc/tools/prex.h index 151b0fe46279..e1e11f256b5a 100644 --- a/tools/inc/tools/prex.h +++ b/tools/inc/tools/prex.h @@ -44,22 +44,12 @@ extern "C" { #endif -// FIXME: should really check for xfree86 or for X11R6.1 and higher -#if defined(LINUX) || defined(FREEBSD) || defined(MACOSX) || defined(NETBSD) || \ - defined(OPENBSD) || defined(DRAGONFLY) -#define __XKeyboardExtension__ 1 -#else -#define __XKeyboardExtension__ 0 -#endif - #include <X11/X.h> #include <X11/Xlib.h> #include <X11/Xutil.h> #include <X11/StringDefs.h> #include <X11/extensions/Xrender.h> -#if __XKeyboardExtension__ #include <X11/XKBlib.h> -#endif typedef unsigned long Pixel; #undef DestroyAll diff --git a/tools/inc/tools/stream.hxx b/tools/inc/tools/stream.hxx index 0e5094561734..dc097b8c563f 100644 --- a/tools/inc/tools/stream.hxx +++ b/tools/inc/tools/stream.hxx @@ -34,6 +34,7 @@ #include <tools/errinf.hxx> #include <tools/ref.hxx> #include <tools/rtti.hxx> +#include <rtl/string.hxx> class FileCopier; class StreamData; @@ -304,7 +305,6 @@ public: SvStream( SvLockBytes *pLockBytes); virtual ~SvStream(); - ErrCode SetLockBytes( SvLockBytesRef& rBytes ); SvLockBytes* GetLockBytes() const { return xLockBytes; } sal_uInt32 GetError() const { return ERRCODE_TOERROR(nError); } @@ -390,6 +390,8 @@ public: sal_Size Seek( sal_Size nPos ); sal_Size SeekRel( sal_sSize nPos ); sal_Size Tell() const { return nBufFilePos+nBufActualPos; } + //length between current (Tell()) pos and end of stream + sal_Size remainingSize(); void Flush(); sal_Bool IsEof() const { return bIsEof; } // next Tell() <= nSize @@ -403,6 +405,7 @@ public: sal_Bool ReadCString( String& rStr ) { return ReadCString( rStr, GetStreamCharSet()); } sal_Bool ReadLine( ByteString& rStr ); + sal_Bool ReadLine( rtl::OString& rStr ); sal_Bool WriteLine( const ByteString& rStr ); sal_Bool WriteLines( const ByteString& rStr ); @@ -444,8 +447,6 @@ public: { return WriteUnicodeOrByteText( rStr, GetStreamCharSet() ); } /// Write a line of Unicode and append line end (endlu()) sal_Bool WriteUniStringLine( const String& rStr ); - /// Write multiple lines of Unicode (with CovertLineEnd) and append line end (endlu()) - sal_Bool WriteUniStringLines( const String& rStr ); /// Write a Unicode character if eDestCharSet==RTL_TEXTENCODING_UNICODE, /// otherwise write as Bytecode converted to eDestCharSet. @@ -515,7 +516,6 @@ public: void RefreshBuffer(); SvStream& PutBack( char aCh ); - void EatWhite(); sal_Bool IsWritable() const { return bIsWritable; } StreamMode GetStreamMode() const { return eStreamMode; } diff --git a/tools/inc/tools/string.hxx b/tools/inc/tools/string.hxx index f77d9630d962..9435d4fb9bd9 100644 --- a/tools/inc/tools/string.hxx +++ b/tools/inc/tools/string.hxx @@ -154,8 +154,6 @@ class TOOLS_DLLPUBLIC ByteString { friend class UniString; - TOOLS_DLLPRIVATE void InitStringRes( const UniString& rStr ); - private: ByteStringData* mpData; @@ -206,14 +204,8 @@ public: } static ByteString CreateFromInt32( sal_Int32 n, sal_Int16 nRadix = 10 ); - static ByteString CreateFromInt64( sal_Int64 n, sal_Int16 nRadix = 10 ); - static ByteString CreateFromFloat( float f ); - static ByteString CreateFromDouble( double d ); - static const ByteString& EmptyString(); sal_Int32 ToInt32() const; sal_Int64 ToInt64() const; - float ToFloat() const; - double ToDouble() const; ByteString& Assign( const ByteString& rStr ); ByteString& Assign( const rtl::OString& rStr ); @@ -247,8 +239,6 @@ public: xub_StrLen Len() const { return (xub_StrLen)mpData->mnLen; } ByteString& Insert( const ByteString& rStr, xub_StrLen nIndex = STRING_LEN ); - ByteString& Insert( const ByteString& rStr, xub_StrLen nPos, xub_StrLen nLen, - xub_StrLen nIndex = STRING_LEN ); ByteString& Insert( const sal_Char* pCharStr, xub_StrLen nIndex = STRING_LEN ); ByteString& Insert( sal_Char c, xub_StrLen nIndex = STRING_LEN ); ByteString& Replace( xub_StrLen nIndex, xub_StrLen nCount, const ByteString& rStr ); @@ -262,7 +252,6 @@ public: ByteString& EraseTrailingChars( sal_Char c = ' ' ); ByteString& EraseLeadingAndTrailingChars( sal_Char c = ' ' ); ByteString& EraseAllChars( sal_Char c = ' ' ); - ByteString& Reverse(); ByteString& Convert( rtl_TextEncoding eSource, rtl_TextEncoding eTarget, @@ -297,8 +286,6 @@ public: xub_StrLen nLen = STRING_LEN ) const; StringCompare CompareTo( const sal_Char* pCharStr, xub_StrLen nLen = STRING_LEN ) const; - StringCompare CompareIgnoreCaseToAscii( const ByteString& rStr, - xub_StrLen nLen = STRING_LEN ) const; StringCompare CompareIgnoreCaseToAscii( const sal_Char* pCharStr, xub_StrLen nLen = STRING_LEN ) const; sal_Bool Equals( const ByteString& rStr ) const; @@ -309,22 +296,14 @@ public: xub_StrLen nIndex, xub_StrLen nLen ) const; sal_Bool Equals( const sal_Char* pCharStr, xub_StrLen nIndex, xub_StrLen nLen ) const; - sal_Bool EqualsIgnoreCaseAscii( const ByteString& rStr, - xub_StrLen nIndex, xub_StrLen nLen ) const; - sal_Bool EqualsIgnoreCaseAscii( const sal_Char* pCharStr, - xub_StrLen nIndex, xub_StrLen nLen ) const; xub_StrLen Match( const ByteString& rStr ) const; - xub_StrLen Match( const sal_Char* pCharStr ) const; xub_StrLen Search( sal_Char c, xub_StrLen nIndex = 0 ) const; xub_StrLen Search( const ByteString& rStr, xub_StrLen nIndex = 0 ) const; xub_StrLen Search( const sal_Char* pCharStr, xub_StrLen nIndex = 0 ) const; xub_StrLen SearchBackward( sal_Char c, xub_StrLen nIndex = STRING_LEN ) const; - xub_StrLen SearchChar( const sal_Char* pChars, xub_StrLen nIndex = 0 ) const; - xub_StrLen SearchCharBackward( const sal_Char* pChars, xub_StrLen nIndex = STRING_LEN ) const; - xub_StrLen SearchAndReplace( sal_Char c, sal_Char cRep, xub_StrLen nIndex = 0 ); xub_StrLen SearchAndReplace( const ByteString& rStr, const ByteString& rRepStr, xub_StrLen nIndex = 0 ); xub_StrLen SearchAndReplace( const sal_Char* pCharStr, const ByteString& rRepStr, @@ -339,9 +318,6 @@ public: ByteString GetToken( xub_StrLen nToken, sal_Char cTok, xub_StrLen& rIndex ) const; ByteString GetToken( xub_StrLen nToken, sal_Char cTok = ';' ) const; - xub_StrLen GetQuotedTokenCount( const ByteString& rQuotedPairs, sal_Char cTok = ';' ) const; - ByteString GetQuotedToken( xub_StrLen nToken, const ByteString& rQuotedPairs, - sal_Char cTok, xub_StrLen& rIndex ) const; ByteString GetQuotedToken( xub_StrLen nToken, const ByteString& rQuotedPairs, sal_Char cTok = ';' ) const; @@ -399,13 +375,6 @@ inline ByteString ByteString::GetToken( xub_StrLen nToken, sal_Char cTok ) const return GetToken( nToken, cTok, nTempPos ); } -inline ByteString ByteString::GetQuotedToken( xub_StrLen nToken, const ByteString& rQuotedPairs, - sal_Char cTok ) const -{ - xub_StrLen nTempPos = 0; - return GetQuotedToken( nToken, rQuotedPairs, cTok, nTempPos ); -} - // ----------------------------------------------------------------------- // ------------------------ @@ -615,7 +584,6 @@ public: xub_StrLen SearchAscii( const sal_Char* pAsciiStr, xub_StrLen nIndex = 0 ) const; xub_StrLen SearchBackward( sal_Unicode c, xub_StrLen nIndex = STRING_LEN ) const; xub_StrLen SearchChar( const sal_Unicode* pChars, xub_StrLen nIndex = 0 ) const; - xub_StrLen SearchCharBackward( const sal_Unicode* pChars, xub_StrLen nIndex = STRING_LEN ) const; xub_StrLen SearchAndReplace( sal_Unicode c, sal_Unicode cRep, xub_StrLen nIndex = 0 ); diff --git a/tools/inc/tools/table.hxx b/tools/inc/tools/table.hxx index bfb91fbe7dc6..ec0c82cf663b 100644 --- a/tools/inc/tools/table.hxx +++ b/tools/inc/tools/table.hxx @@ -65,7 +65,6 @@ public: { return Container::GetObject( (nPos*2)+1 ); } sal_uIntPtr GetObjectKey( sal_uIntPtr nPos ) const { return (sal_uIntPtr)Container::GetObject( nPos*2 ); } - sal_uIntPtr GetUniqueKey( sal_uIntPtr nStartKey = 1 ) const; sal_uIntPtr SearchKey( sal_uIntPtr nKey, sal_uIntPtr* pPos = NULL ) const; void* Seek( sal_uIntPtr nKey ); @@ -102,7 +101,6 @@ public: \ using Table::Count; \ using Table::GetCurKey; \ using Table::GetObjectKey; \ - using Table::GetUniqueKey; \ using Table::SearchKey; \ using Table::IsKeyValid; \ \ diff --git a/tools/inc/tools/tempfile.hxx b/tools/inc/tools/tempfile.hxx index d356e7bf66fc..4ca220462898 100644 --- a/tools/inc/tools/tempfile.hxx +++ b/tools/inc/tools/tempfile.hxx @@ -65,14 +65,6 @@ public: // Only create a name for a temporary file that would be valid at that moment. static String CreateTempName( const String* pParent=NULL ); - - // The TempNameBase is a folder in the default ( system ) tempfile folder. - // This subfolder will be used if a TempFile or TempName is created without a parent name. - // The caller of the SetTempNameBase is responsible for deleting this folder and all temporary files in it. - // The argument must be a simple name, not a complete URL. - // The return value of both methods is the complete URL of the tempname base folder. - static String SetTempNameBaseDirectory( const String &rBaseName ); - static String GetTempNameBaseDirectory(); }; #endif diff --git a/tools/inc/tools/urlobj.hxx b/tools/inc/tools/urlobj.hxx index 67342db5d161..f8caeee0d11a 100644 --- a/tools/inc/tools/urlobj.hxx +++ b/tools/inc/tools/urlobj.hxx @@ -573,8 +573,6 @@ public: rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8) { return setUser(rTheUser, false, eMechanism, eCharset); } - void makeAuthCanonic(); - inline bool SetPass(ByteString const & rThePassword, EncodeMechanism eMechanism = WAS_ENCODED, rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8); @@ -622,51 +620,6 @@ public: bool SetPort(sal_uInt32 nThePort); - void makePortCanonic(); - - /** Encode the <hostport> part of a URL. - - @ATT Obsolete, because at the moment the <hostport> part of a URL may - not contain any escape sequences anyway, and because this method does - not inform the caller whether the given <hostport> part is legal. - - @param rTheHostPort The <hostport> part of a URL (for its - interpretation, see the general discussion for set-methods). - - @param eMechanism See the general discussion for set-methods. - - @param eCharset See the general discussion for set-methods. - - @return The <hostport> part, encoded according to the given mechanism - and charset ('forbidden' characters replaced by escape sequences). - */ - static inline rtl::OUString encodeHostPort(ByteString const & rTheHostPort, - EncodeMechanism eMechanism, - rtl_TextEncoding eCharset - = RTL_TEXTENCODING_UTF8); - - /** Encode the <hostport> part of a URL. - - @ATT Obsolete, because at the moment the <hostport> part of a URL may - not contain any escape sequences anyway, and because this method does - not inform the caller whether the given <hostport> part is legal. - - @param rTheHostPort The <hostport> part of a URL (for its - interpretation, see the general discussion for set-methods). - - @param eMechanism See the general discussion for set-methods. - - @param eCharset See the general discussion for set-methods. - - @return The <hostport> part, encoded according to the given mechanism - and charset ('forbidden' characters replaced by escape sequences). - */ - static inline rtl::OUString encodeHostPort(rtl::OUString const & rTheHostPort, - EncodeMechanism eMechanism, - rtl_TextEncoding eCharset - = RTL_TEXTENCODING_UTF8) - { return encodeHostPort(rTheHostPort, false, eMechanism, eCharset); } - //======================================================================== // Path: @@ -1058,8 +1011,6 @@ public: //======================================================================== // POP3 and URLs: - bool HasMsgId() const; - rtl::OUString GetMsgId(DecodeMechanism eMechanism = DECODE_TO_IURI, rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8) const; @@ -1279,9 +1230,6 @@ public: = RTL_TEXTENCODING_UTF8) const { return GetLastName(eMechanism, eCharset); } - rtl::OUString CutName(DecodeMechanism eMechanism = DECODE_TO_IURI, - rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8); - void SetExtension(rtl::OUString const & rTheExtension, EncodeMechanism eMechanism = WAS_ENCODED, rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8); @@ -1428,10 +1376,6 @@ private: EncodeMechanism eMechanism, rtl_TextEncoding eCharset, bool bNetBiosName, rtl::OUStringBuffer* pCanonic); - static rtl::OUString encodeHostPort( - rtl::OUString const & rTheHostPort, bool bOctets, - EncodeMechanism eMechanism, rtl_TextEncoding eCharset); - bool setHost( rtl::OUString const & rTheHost, bool bOctets, EncodeMechanism eMechanism, rtl_TextEncoding eCharset); @@ -1482,20 +1426,10 @@ private: rtl::OUString const & rTheMark, bool bOctets, EncodeMechanism eMechanism, rtl_TextEncoding eCharset); - // FTP URLs: - - enum FTPType { FTP_TYPE_NONE, FTP_TYPE_A, FTP_TYPE_I, FTP_TYPE_D }; - - TOOLS_DLLPRIVATE FTPType getFTPType() const; - // FILE URLs: TOOLS_DLLPRIVATE bool hasDosVolume(FSysStyle eStyle) const; - // IMAP URLs: - - TOOLS_DLLPRIVATE sal_uInt32 getIMAPUID() const; - // Coding: static inline rtl::OUString extend(ByteString const & rOctets) @@ -1822,15 +1756,6 @@ inline bool INetURLObject::SetUserAndPass(rtl::OUString const & rTheUser, setPassword(rThePassword, false, eMechanism, eCharset)); } -// static -inline rtl::OUString INetURLObject::encodeHostPort(ByteString const & - rTheHostPort, - EncodeMechanism eMechanism, - rtl_TextEncoding eCharset) -{ - return encodeHostPort(extend(rTheHostPort), true, eMechanism, eCharset); -} - inline bool INetURLObject::insertName(rtl::OUString const & rTheName, bool bAppendFinalSlash, sal_Int32 nIndex, diff --git a/tools/prj/build.lst b/tools/prj/build.lst index eeb470c384d6..ee6803567843 100644 --- a/tools/prj/build.lst +++ b/tools/prj/build.lst @@ -1,3 +1,3 @@ -tl tools : cppu external offuh ZLIB:zlib EXPAT:expat basegfx comphelper i18npool NULL +tl tools : cppu external offapi ZLIB:zlib EXPAT:expat basegfx comphelper i18npool NULL tl tools\prj nmake - all tl_prj NULL # tl tools\qa nmake - all tl_qa tl_utl NULL diff --git a/tools/source/fsys/dirent.cxx b/tools/source/fsys/dirent.cxx index a188569868e1..ea3db76c5c07 100644 --- a/tools/source/fsys/dirent.cxx +++ b/tools/source/fsys/dirent.cxx @@ -331,6 +331,7 @@ ByteString ImplCutPath( const ByteString& rStr, sal_uInt16 nMax, char cAccDel ) return aCutPath; } +#if defined(WNT) /************************************************************************* |* |* DirEntry::ImpParseOs2Name() @@ -402,9 +403,15 @@ FSysError DirEntry::ImpParseOs2Name( const ByteString& rPfad, FSysPathStyle eSty else { // liegt ein anderes Drive auf dem Stack? - if ( aStack.Count() && - COMPARE_EQUAL != aStack.Bottom()->aName.CompareIgnoreCaseToAscii(aName) ) - aStack.Clear(); + if ( aStack.Count() ) + { + rtl::OString aThis(aStack.Bottom()->aName); + aThis = aThis.toAsciiLowerCase(); + rtl::OString aOther(aName); + aOther = aOther.toAsciiLowerCase(); + if (aThis.compareTo(aOther) != 0) + aStack.Clear(); + } // liegt jetzt nichts mehr auf dem Stack? if ( !aStack.Count() ) @@ -502,6 +509,7 @@ FSysError DirEntry::ImpParseOs2Name( const ByteString& rPfad, FSysPathStyle eSty aName = rPfad; return nErr; } +#endif /************************************************************************* |* @@ -662,7 +670,6 @@ DirEntry::DirEntry( const String& rInitName, FSysPathStyle eStyle ) } #ifdef DBG_UTIL - // ASF nur bei Default eStyle, nicht z.B. aus MakeShortName() if( eStyle == FSYS_STYLE_HOST && aTmpName.Search( "://" ) != STRING_NOTFOUND ) { @@ -709,7 +716,6 @@ DirEntry::DirEntry( const ByteString& rInitName, FSysPathStyle eStyle ) } #ifdef DBG_UTIL else - // ASF nur bei Default eStyle, nicht z.B. aus MakeShortName() if( eStyle == FSYS_STYLE_HOST && rInitName.Search( "://" ) != STRING_NOTFOUND ) { @@ -1129,31 +1135,6 @@ String DirEntry::CutName( FSysPathStyle eStyle ) /************************************************************************* |* -|* DirEntry::NameCompare -|* -|* Beschreibung Vergleich nur die Namen (ohne Pfad, aber mit Gross/Klein) -|* -*************************************************************************/ - -StringCompare DirEntry::NameCompare( const DirEntry &rWith ) const -{ - ByteString aThisName; - ByteString aParameterName; - -#ifdef UNX - aThisName = aName; - aParameterName = rWith.aName; -#else - aThisName = ByteString(aName).ToLowerAscii(); - aParameterName = ByteString(rWith.aName).ToLowerAscii(); -#endif - - return aThisName.CompareTo( aParameterName ); -} - - -/************************************************************************* -|* |* DirEntry::operator==() |* *************************************************************************/ @@ -1369,31 +1350,6 @@ void DirEntry::SetExtension( const String& rExtension, char cSep ) /************************************************************************* |* -|* DirEntry::CutExtension() -|* -*************************************************************************/ - -String DirEntry::CutExtension( char cSep ) -{ - DBG_CHKTHIS( DirEntry, ImpCheckDirEntry ); - - const char *p0 = ( aName.GetBuffer() ); - const char *p1 = p0 + aName.Len() - 1; - while ( p1 >= p0 && *p1 != cSep ) - p1--; - - if ( p1 >= p0 ) - { - // es wurde ein cSep an der Position p1 gefunden - aName.Erase( static_cast< xub_StrLen >(p1-p0) ); - return String(p1 + 1, osl_getThreadTextEncoding()); - } - - return String(); -} - -/************************************************************************* -|* |* DirEntry::SetName() |* *************************************************************************/ @@ -1728,6 +1684,7 @@ const DirEntry &DirEntry::operator[]( sal_uInt16 nParentLevel ) const return *pRes; } +#if !defined(WNT) /************************************************************************* |* |* DirEntry::ImpParseUnixName() @@ -1843,200 +1800,12 @@ FSysError DirEntry::ImpParseUnixName( const ByteString& rPfad, FSysPathStyle eSt return FSYS_ERR_OK; } - -/************************************************************************* -|* -|* DirEntry::MakeShortName() -|* -*************************************************************************/ - -ErrCode CreateEntry_Impl( const DirEntry &rPath, DirEntryKind eKind ) -{ - // versuchen, anzulegen (ausser bei FSYS_KIND_ALL) - ErrCode eErr = ERRCODE_NONE; - if ( FSYS_KIND_FILE == eKind ) - { - SvFileStream aStream( rPath.GetFull(), STREAM_STD_WRITE ); - aStream.WriteLine( "" ); - eErr = aStream.GetError(); - } - else if ( FSYS_KIND_ALL != eKind ) - eErr = rPath.MakeDir() ? ERRCODE_NONE : ERRCODE_IO_UNKNOWN; - - // erfolgreich? - if ( !rPath.Exists() ) - eErr = ERRCODE_IO_UNKNOWN; // Doch was schiefgegangen ? - - // ggf. wieder l"oschen - if ( FSYS_KIND_NONE == eKind ) - rPath.Kill(); - - // Fehlercode zur?ckliefern - return eErr; -} - -sal_Bool IsValidEntry_Impl( const DirEntry &rPath, - const String &rLongName, - DirEntryKind eKind, - sal_Bool bIsShortened, - sal_Bool bUseDelim ) -{ - // Parameter-Pr"uefung - DBG_ASSERT( eKind == FSYS_KIND_NONE || eKind == FSYS_KIND_ALL || - eKind == FSYS_KIND_FILE || eKind == FSYS_KIND_DIR, - "invalid entry-kind" ); - - // Alle von MSDOS erreichbaren FSYS_STYLES muessen den - // MSDOS Filenamenanforderungen genuegen. Sonst wird probiert, - // ob sich eine Datei des gewuenschten Names anlegen laesst. - FSysPathStyle eStyle = DirEntry::GetPathStyle( rPath.GetDevice().GetName() ); - DirEntry aPath(rPath); - DirEntry aName(rLongName, eStyle); - if ( !aName.IsValid() || aName.Level() != 1 ) - return sal_False; - aPath += aName; - if ( 1 == aPath.Level() ) - return sal_False; - - // Pfad-Trenner sind nicht erlaubt (bei ungek"urzten auch nicht FSYS_SHORTNAME_DELIMITER) - char cDelim = bUseDelim == 2 ? FSYS_SHORTNAME_DELIMITER : char(0); - if ( - rLongName.Search(DirEntry::GetAccessDelimiter()) != STRING_NOTFOUND || - (!bIsShortened && rLongName.Search(cDelim) != STRING_NOTFOUND) - ) - { - return sal_False; - } - - // MI: Abfrage nach 'CON:' etc. wird jetzt in Exists() mitgemacht - if ( aPath.Exists() ) - return sal_False; - - return (ERRCODE_NONE == CreateEntry_Impl( aPath, eKind )); -} - -//------------------------------------------------------------------------- +#endif #define MAX_EXT_MAX 250 #define MAX_LEN_MAX 255 #define INVALID_CHARS_DEF "\\/\"':|^<>?*" -sal_Bool DirEntry::MakeShortName( const String& rLongName, DirEntryKind eKind, - sal_Bool bUseDelim, FSysPathStyle eStyle ) -{ - String aLongName(rLongName); - - // Alle '#' aus den Dateinamen entfernen, weil das INetURLObject - // damit Probleme hat. Siehe auch #51246# - aLongName.EraseAllChars( '#' ); - ByteString bLongName(aLongName, osl_getThreadTextEncoding()); - - // Auf Novell-Servern (wegen der rottigen Clients) nur 7bit ASCII - - // bei FSYS_KIND_ALL den alten Namen merken und abh"angen (rename) - ByteString aOldName; - if ( FSYS_KIND_ALL == eKind ) - { - aOldName = ByteString(CutName(), osl_getThreadTextEncoding()); - aOldName = CMP_LOWER(aOldName); - } - - // ist der Langname direkt verwendbar? - if ( IsValidEntry_Impl( *this, aLongName, eKind, sal_False, bUseDelim ) ) - { - operator+=( DirEntry(aLongName) ); - return sal_True; - } - - // max L"angen feststellen - sal_uInt16 nMaxExt, nMaxLen; - if ( FSYS_STYLE_DETECT == eStyle ) - eStyle = DirEntry::GetPathStyle( GetDevice().GetName() ); - ByteString aInvalidChars; - nMaxExt = MAX_EXT_MAX; - nMaxLen = MAX_LEN_MAX; - aInvalidChars = INVALID_CHARS_DEF; - - // Extension abschneiden und kuerzen - ByteString aExt; - ByteString aFName = bLongName; - DirEntry aUnparsed; - aUnparsed.aName = bLongName; - aExt = ByteString(aUnparsed.CutExtension(), osl_getThreadTextEncoding()); - aFName = aUnparsed.aName; - if ( aExt.Len() > nMaxExt ) - { - char c = aExt.GetChar( aExt.Len() - 1 ); - aExt.Erase(nMaxExt-1); - aExt += c; - } - - // ausser auf einem FAT-System geh"ort die Extension zur - // Maxl"ange. Muss also vorher mit dem Punkt abgezogen werden. - nMaxLen -= ( aExt.Len() + 1 ); - - // Name k"urzen - ByteString aSName; - for ( const char *pc = aFName.GetBuffer(); aSName.Len() < nMaxLen && *pc; ++pc ) - { - if ( STRING_NOTFOUND == aInvalidChars.Search( *pc ) && - (unsigned char) *pc >= (unsigned char) 32 && - ( !aSName.Len() || *pc != ' ' || aSName.GetChar(aSName.Len()-1) != ' ' ) ) - aSName += *pc; - } - aSName.EraseTrailingChars(); - - // HRO: #74246# Also cut leading spaces - aSName.EraseLeadingChars(); - - if ( !aSName.Len() ) - aSName = "noname"; - - // kommt dabei der alte Name raus? - ByteString aNewName = aSName; - if ( aExt.Len() ) - ( aNewName += '.' ) += aExt; - operator+=( DirEntry(String(aNewName, osl_getThreadTextEncoding())) ); - if ( FSYS_KIND_ALL == eKind && CMP_LOWER(aName) == aOldName ) - if ( FSYS_KIND_ALL == eKind && CMP_LOWER(ByteString(GetName(), osl_getThreadTextEncoding())) == aOldName ) - return sal_True; - - // kann der gek"urzte Name direkt verwendet werden? - if ( !Exists() && (ERRCODE_NONE == CreateEntry_Impl( *this, eKind )) ) - return sal_True; - - // darf '?##' verwendet werden, um eindeutigen Name zu erzeugen? - if ( bUseDelim ) - { - // eindeutigen Namen per '?##' erzeugen - aSName.Erase( nMaxLen-3 ); - if ( bUseDelim != 2 ) - aSName += FSYS_SHORTNAME_DELIMITER; - for ( int n = 1; n < 99; ++n ) - { - // Name zusammensetzen - ByteString aTmpStr( aSName ); - aTmpStr += ByteString::CreateFromInt32(n); - if ( aExt.Len() ) - ( aTmpStr += '.' ) += aExt; - - // noch nicht vorhanden? - SetName( String(aTmpStr, osl_getThreadTextEncoding()) ); - - if ( !Exists() ) - { - // Fehler setzen !!! - nError = CreateEntry_Impl( *this, eKind ); - return (ERRCODE_NONE == nError); - } - } - } - - // keine ## mehr frei / ?## soll nicht verwendet werden - nError = ERRCODE_IO_ALREADYEXISTS; - return sal_False; -} - /************************************************************************* |* |* DirEntry::CreatePath() diff --git a/tools/source/fsys/tdir.cxx b/tools/source/fsys/tdir.cxx index 6d16a5ed605a..db811f35e76b 100644 --- a/tools/source/fsys/tdir.cxx +++ b/tools/source/fsys/tdir.cxx @@ -386,27 +386,6 @@ sal_uInt16 Dir::Scan( sal_uInt16 nCount ) |* *************************************************************************/ -Dir::Dir( const DirEntry& rDirEntry, DirEntryKind nKindFlags, FSysSort nSort, ... ): - DirEntry( rDirEntry ), - pReader( 0 ) -{ - DBG_CTOR( Dir, NULL ); - - Construct( nKindFlags ); - - std::va_list pArgs; - va_start( pArgs, nSort ); - ImpSetSort( pArgs, nSort ); - - Reset(); -} - -/************************************************************************* -|* -|* Dir::Dir() -|* -*************************************************************************/ - Dir::Dir( const DirEntry& rDirEntry, DirEntryKind nKindFlags ): DirEntry( rDirEntry ), pReader( 0 ) @@ -419,24 +398,6 @@ Dir::Dir( const DirEntry& rDirEntry, DirEntryKind nKindFlags ): /************************************************************************* |* -|* Dir::Dir() -|* -*************************************************************************/ - -Dir::Dir(): - pReader( 0 ) -{ - DBG_CTOR( Dir, NULL ); - - pLst = NULL; - pSortLst = NULL; - pStatLst = NULL; - eAttrMask = FSYS_KIND_ALL; - aNameMask = String("*", osl_getThreadTextEncoding()); -} - -/************************************************************************* -|* |* Dir::~Dir() |* *************************************************************************/ @@ -587,19 +548,6 @@ FSysError Dir::ImpSetSort( std::va_list pArgs, int nFirstSort ) /************************************************************************* |* -|* Dir::SetSort() -|* -*************************************************************************/ - -FSysError Dir::SetSort( FSysSort nSort, ... ) -{ - std::va_list pArgs; - va_start( pArgs, nSort ); - return ImpSetSort( pArgs, nSort ); -} - -/************************************************************************* -|* |* Dir::operator[]() |* *************************************************************************/ diff --git a/tools/source/fsys/tempfile.cxx b/tools/source/fsys/tempfile.cxx index 078e91834975..b6a4b1e2b70e 100644 --- a/tools/source/fsys/tempfile.cxx +++ b/tools/source/fsys/tempfile.cxx @@ -267,37 +267,4 @@ String TempFile::GetName() const return aTmp; } -String TempFile::SetTempNameBaseDirectory( const String &rBaseName ) -{ - String aName( rBaseName ); - - ::rtl::OUString& rTempNameBase_Impl = TempNameBase_Impl::get(); - - FileBase::RC err= Directory::create( aName ); - if ( err == FileBase::E_None || err == FileBase::E_EXIST ) - { - rTempNameBase_Impl = aName; - rTempNameBase_Impl += String( '/' ); - - TempFile aBase( NULL, sal_True ); - if ( aBase.IsValid() ) - rTempNameBase_Impl = aBase.pImp->aName; - } - - rtl::OUString aTmp; - aTmp = rTempNameBase_Impl; - return aTmp; -} - -String TempFile::GetTempNameBaseDirectory() -{ - ::rtl::OUString& rTempNameBase_Impl = TempNameBase_Impl::get(); - if ( !rTempNameBase_Impl.getLength() ) - rTempNameBase_Impl = GetSystemTempDir_Impl(); - - rtl::OUString aTmp; - aTmp = rTempNameBase_Impl; - return aTmp; -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/fsys/unx.cxx b/tools/source/fsys/unx.cxx index b04a2e64904a..0adc7ce8fa03 100644 --- a/tools/source/fsys/unx.cxx +++ b/tools/source/fsys/unx.cxx @@ -44,7 +44,7 @@ extern "C" int mntctl( int cmd, size_t size, char* buf ); #elif defined(NETBSD) #include <sys/mount.h> #elif defined(FREEBSD) || defined(MACOSX) || defined(OPENBSD) || \ - defined(DRAGONFLY) + defined(DRAGONFLY) || defined(IOS) struct mnttab { char *mnt_dir; @@ -85,7 +85,7 @@ struct mymnttab #if defined(NETBSD) || defined(FREEBSD) || defined(MACOSX) || \ - defined(OPENBSD) || defined(DRAGONFLY) + defined(OPENBSD) || defined(DRAGONFLY) || defined(IOS) sal_Bool GetMountEntry(dev_t /* dev */, struct mymnttab * /* mytab */ ) { DBG_WARNING( "Sorry, not implemented: GetMountEntry" ); @@ -478,7 +478,7 @@ const char *TempDirImpl( char *pBuf ) |* *************************************************************************/ -FSysPathStyle DirEntry::GetPathStyle( const String & ) +FSysPathStyle DirEntry::GetPathStyle() { return FSYS_STYLE_UNX; } @@ -521,17 +521,4 @@ void FileStat::SetDateTime( const String& rFileName, } } -//========================================================================= - -ErrCode FileStat::QueryDiskSpace( const String &, BigInt &, BigInt & ) -{ - return ERRCODE_IO_NOTSUPPORTED; -} - -//========================================================================= - -void FSysEnableSysErrorBox( sal_Bool ) -{ -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/fsys/urlobj.cxx b/tools/source/fsys/urlobj.cxx index 6a855d7d85c8..bf3cf2e95a4d 100644 --- a/tools/source/fsys/urlobj.cxx +++ b/tools/source/fsys/urlobj.cxx @@ -2909,29 +2909,6 @@ bool INetURLObject::parseHostOrNetBiosName( } //============================================================================ -// static -rtl::OUString INetURLObject::encodeHostPort(rtl::OUString const & rTheHostPort, - bool bOctets, - EncodeMechanism eMechanism, - rtl_TextEncoding eCharset) -{ - sal_Int32 nPort = rTheHostPort.getLength(); - if (nPort != 0) - { - sal_Int32 i = nPort - 1; - while (i != 0 && INetMIME::isDigit(rTheHostPort.getStr()[i])) - --i; - if (rTheHostPort.getStr()[i] == ':') - nPort = i; - } - rtl::OUString aResult(encodeText(rTheHostPort.copy(0, nPort), bOctets, - PART_HOST_EXTRA, '%', eMechanism, eCharset, - true)); - aResult += rTheHostPort.copy(nPort); - return aResult; -} - -//============================================================================ bool INetURLObject::setHost(rtl::OUString const & rTheHost, bool bOctets, EncodeMechanism eMechanism, rtl_TextEncoding eCharset) @@ -3706,31 +3683,6 @@ bool INetURLObject::setFragment(rtl::OUString const & rTheFragment, } //============================================================================ -INetURLObject::FTPType INetURLObject::getFTPType() const -{ - if (m_eScheme == INET_PROT_FTP - && m_aPath.getLength() >= RTL_CONSTASCII_LENGTH(";type=") + 1 - && rtl::OUString(m_aAbsURIRef).copy( - m_aPath.getEnd() - (RTL_CONSTASCII_LENGTH(";type=") + 1), - RTL_CONSTASCII_LENGTH(";type=")).equalsIgnoreAsciiCaseAscii(";type=")) - switch (m_aAbsURIRef.charAt(m_aPath.getEnd())) - { - case 'A': - case 'a': - return FTP_TYPE_A; - - case 'D': - case 'd': - return FTP_TYPE_D; - - case 'I': - case 'i': - return FTP_TYPE_I; - } - return FTP_TYPE_NONE; -} - -//============================================================================ bool INetURLObject::hasDosVolume(FSysStyle eStyle) const { sal_Unicode const * p = m_aAbsURIRef.getStr() + m_aPath.getBegin(); @@ -3743,33 +3695,6 @@ bool INetURLObject::hasDosVolume(FSysStyle eStyle) const } //============================================================================ -sal_uInt32 INetURLObject::getIMAPUID() const -{ - if (m_eScheme == INET_PROT_IMAP - && m_aPath.getLength() >= RTL_CONSTASCII_LENGTH("/;uid=") + 1) - { - sal_Unicode const * pBegin = m_aAbsURIRef.getStr() - + m_aPath.getBegin() - + RTL_CONSTASCII_LENGTH("/;uid="); - sal_Unicode const * pEnd = pBegin + m_aPath.getLength(); - sal_Unicode const * p = pEnd; - while (p > pBegin && INetMIME::isDigit(p[-1])) - --p; - if (p < pEnd && *--p != '0' - && rtl::OUString(m_aAbsURIRef).copy( - p - RTL_CONSTASCII_LENGTH("/;uid=") - m_aAbsURIRef.getStr(), - RTL_CONSTASCII_LENGTH("/;uid=")).equalsIgnoreAsciiCaseAscii("/;uid=") - ) - { - sal_uInt32 nUID; - if (INetMIME::scanUnsigned(p, pEnd, false, nUID)) - return nUID; - } - } - return 0; -} - -//============================================================================ // static rtl::OUString INetURLObject::encodeText(sal_Unicode const * pBegin, sal_Unicode const * pEnd, bool bOctets, @@ -4369,22 +4294,6 @@ bool INetURLObject::hasPassword() const } //============================================================================ -void INetURLObject::makeAuthCanonic() -{ - if (m_eScheme == INET_PROT_IMAP && m_aAuth.getLength() == 1 - && m_aAbsURIRef.charAt(m_aAuth.getBegin()) == '*') - { - lcl_Erase(m_aAbsURIRef, m_aAuth.getBegin() - - RTL_CONSTASCII_LENGTH(";AUTH="), - RTL_CONSTASCII_LENGTH(";AUTH=*")); - sal_Int32 nDelta = m_aAuth.clear() - RTL_CONSTASCII_LENGTH(";AUTH="); - m_aPath += nDelta; - m_aQuery += nDelta; - m_aFragment += nDelta; - } -} - -//============================================================================ rtl::OUString INetURLObject::GetHostPort(DecodeMechanism eMechanism, rtl_TextEncoding eCharset) { @@ -4441,33 +4350,6 @@ bool INetURLObject::SetPort(sal_uInt32 nThePort) } //============================================================================ -void INetURLObject::makePortCanonic() -{ - if (m_aPort.isPresent()) - { - sal_Unicode const * p = m_aAbsURIRef.getStr() + m_aPort.getBegin(); - sal_Unicode const * pEnd = p + m_aPort.getLength(); - sal_uInt32 nThePort; - if (INetMIME::scanUnsigned(p, pEnd, true, nThePort) && p == pEnd) - { - sal_Int32 nDelta; - if (nThePort != 0 && nThePort == getSchemeInfo().m_nDefaultPort) - { - lcl_Erase(m_aAbsURIRef, m_aPort.getBegin() - 1, - m_aPort.getLength() + 1); - nDelta = m_aPort.clear() - 1; - } - else - nDelta = m_aPort.set(m_aAbsURIRef, - rtl::OUString::valueOf(sal_Int64(nThePort))); - m_aPath += nDelta; - m_aQuery += nDelta; - m_aFragment += nDelta; - } - } -} - -//============================================================================ sal_Int32 INetURLObject::getSegmentCount(bool bIgnoreFinalSlash) const { if (!checkHierarchical()) @@ -5137,19 +5019,6 @@ rtl::OUString INetURLObject::getFSysPath(FSysStyle eStyle, } //============================================================================ -bool INetURLObject::HasMsgId() const -{ - if (m_eScheme != INET_PROT_POP3) - return false; - sal_Unicode const * p = m_aAbsURIRef.getStr() + m_aPath.getBegin(); - sal_Unicode const * pEnd = p + m_aPath.getLength(); - for (; p < pEnd; ++p) - if (*p == '<') - return true; - return false; -} - -//============================================================================ rtl::OUString INetURLObject::GetMsgId(DecodeMechanism eMechanism, rtl_TextEncoding eCharset) const { @@ -5593,14 +5462,6 @@ void INetURLObject::SetName(rtl::OUString const & rTheName, } //============================================================================ -rtl::OUString INetURLObject::CutName(DecodeMechanism eMechanism, - rtl_TextEncoding eCharset) -{ - rtl::OUString aTheName(getName(LAST_SEGMENT, true, eMechanism, eCharset)); - return removeSegment(LAST_SEGMENT, true) ? aTheName : rtl::OUString(); -} - -//============================================================================ void INetURLObject::SetExtension(rtl::OUString const & rTheExtension, EncodeMechanism eMechanism, rtl_TextEncoding eCharset) diff --git a/tools/source/fsys/wntmsc.cxx b/tools/source/fsys/wntmsc.cxx index fa18aa46fcf1..ab783b45a161 100644 --- a/tools/source/fsys/wntmsc.cxx +++ b/tools/source/fsys/wntmsc.cxx @@ -114,7 +114,7 @@ int closedir( DIR *pDir ) |* *************************************************************************/ -FSysPathStyle DirEntry::GetPathStyle( const String & ) +FSysPathStyle DirEntry::GetPathStyle() { return FSYS_STYLE_NTFS; } @@ -872,42 +872,4 @@ const char* TempDirImpl( char *pBuf ) return pBuf; } -//======================================================================= - -ErrCode FileStat::QueryDiskSpace( const String &rPath, - BigInt &rFreeBytes, BigInt &rTotalBytes ) -{ - DWORD nSectorsPerCluster; /* address of sectors per cluster */ - DWORD nBytesPerSector; /* address of bytes per sector */ - DWORD nFreeClusters; /* address of number of free clusters */ - DWORD nClusters; /* address of total number of clusters */ - - ByteString aVol( DirEntry(rPath).ImpGetTopPtr()->GetName(), osl_getThreadTextEncoding()); - bool bOK = GetDiskFreeSpace( aVol.GetBuffer(), - &nSectorsPerCluster, &nBytesPerSector, - &nFreeClusters, &nClusters ); - if ( !bOK ) - return Sys2SolarError_Impl( GetLastError() ); - - BigInt aBytesPerCluster( BigInt(nSectorsPerCluster) * - BigInt(nBytesPerSector) ); - rFreeBytes = aBytesPerCluster * BigInt(nFreeClusters); - rTotalBytes = aBytesPerCluster * BigInt(nClusters); - return 0; -} - -//========================================================================= - -void FSysEnableSysErrorBox( sal_Bool bEnable ) -{ // Preserve other Bits!! - sal_uInt32 nErrorMode = SetErrorMode( bEnable ? 0 : SEM_FAILCRITICALERRORS|SEM_NOOPENFILEERRORBOX ); - if ( bEnable ) - nErrorMode &= ~(SEM_FAILCRITICALERRORS|SEM_NOOPENFILEERRORBOX); - else - nErrorMode |= (SEM_FAILCRITICALERRORS|SEM_NOOPENFILEERRORBOX); - SetErrorMode( nErrorMode ); -} - - - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/fsys/wntmsc.hxx b/tools/source/fsys/wntmsc.hxx index ba88e4eaf020..43b700fe17be 100644 --- a/tools/source/fsys/wntmsc.hxx +++ b/tools/source/fsys/wntmsc.hxx @@ -34,8 +34,8 @@ #ifndef ICC #include <io.h> #endif -#include <sys\types.h> -#include <sys\stat.h> +#include <sys/types.h> +#include <sys/stat.h> #include <direct.h> #include <windows.h> diff --git a/tools/source/generic/b3dtrans.cxx b/tools/source/generic/b3dtrans.cxx index 4af4b3edcb85..1f731e1fd387 100644 --- a/tools/source/generic/b3dtrans.cxx +++ b/tools/source/generic/b3dtrans.cxx @@ -182,16 +182,6 @@ void B3dTransformationSet::Reset() |* \************************************************************************/ -void B3dTransformationSet::SetObjectTrans(const basegfx::B3DHomMatrix& rObj) -{ - maObjectTrans = rObj; - - mbObjectToDeviceValid = sal_False; - mbInvTransObjectToEyeValid = sal_False; - - PostSetObjectTrans(); -} - void B3dTransformationSet::PostSetObjectTrans() { // Zuweisen und Inverse bestimmen @@ -217,17 +207,6 @@ void B3dTransformationSet::SetOrientation( basegfx::B3DPoint aVRP, basegfx::B3DV PostSetOrientation(); } -void B3dTransformationSet::SetOrientation(basegfx::B3DHomMatrix& mOrient) -{ - maOrientation = mOrient; - - mbInvTransObjectToEyeValid = sal_False; - mbObjectToDeviceValid = sal_False; - mbWorldToViewValid = sal_False; - - PostSetOrientation(); -} - void B3dTransformationSet::PostSetOrientation() { // Zuweisen und Inverse bestimmen @@ -254,13 +233,6 @@ const basegfx::B3DHomMatrix& B3dTransformationSet::GetProjection() return maProjection; } -const basegfx::B3DHomMatrix& B3dTransformationSet::GetInvProjection() -{ - if(!mbProjectionValid) - CalcViewport(); - return maInvProjection; -} - void B3dTransformationSet::PostSetProjection() { // Zuweisen und Inverse bestimmen @@ -274,22 +246,6 @@ void B3dTransformationSet::PostSetProjection() /************************************************************************* |* -|* Texturtransformation -|* -\************************************************************************/ - -void B3dTransformationSet::SetTexture(const basegfx::B2DHomMatrix& rTxt) -{ - maTexture = rTxt; - PostSetTexture(); -} - -void B3dTransformationSet::PostSetTexture() -{ -} - -/************************************************************************* -|* |* Viewport-Transformation |* \************************************************************************/ @@ -425,17 +381,6 @@ void B3dTransformationSet::SetRatio(double fNew) } } -void B3dTransformationSet::SetRatioMode(Base3DRatio eNew) -{ - if(meRatio != eNew) - { - meRatio = eNew; - mbProjectionValid = sal_False; - mbObjectToDeviceValid = sal_False; - mbWorldToViewValid = sal_False; - } -} - void B3dTransformationSet::SetDeviceRectangle(double fL, double fR, double fB, double fT, sal_Bool bBroadCastChange) { @@ -456,61 +401,10 @@ void B3dTransformationSet::SetDeviceRectangle(double fL, double fR, double fB, d } } -void B3dTransformationSet::SetDeviceVolume(const basegfx::B3DRange& rVol, sal_Bool bBroadCastChange) -{ - SetDeviceRectangle(rVol.getMinX(), rVol.getMaxX(), rVol.getMinY(), rVol.getMaxY(), bBroadCastChange); - SetFrontClippingPlane(rVol.getMinZ()); - SetBackClippingPlane(rVol.getMaxZ()); -} - void B3dTransformationSet::DeviceRectangleChange() { } -void B3dTransformationSet::GetDeviceRectangle(double &fL, double &fR, double& fB, double& fT) -{ - fL = mfLeftBound; - fR = mfRightBound; - fB = mfBottomBound; - fT = mfTopBound; - - mbProjectionValid = sal_False; - mbObjectToDeviceValid = sal_False; - mbWorldToViewValid = sal_False; -} - -basegfx::B3DRange B3dTransformationSet::GetDeviceVolume() -{ - basegfx::B3DRange aRet; - - aRet.expand(basegfx::B3DTuple(mfLeftBound, mfBottomBound, mfNearBound)); - aRet.expand(basegfx::B3DTuple(mfRightBound, mfTopBound, mfFarBound)); - - return aRet; -} - -void B3dTransformationSet::SetFrontClippingPlane(double fF) -{ - if(mfNearBound != fF) - { - mfNearBound = fF; - mbProjectionValid = sal_False; - mbObjectToDeviceValid = sal_False; - mbWorldToViewValid = sal_False; - } -} - -void B3dTransformationSet::SetBackClippingPlane(double fB) -{ - if(mfFarBound != fB) - { - mfFarBound = fB; - mbProjectionValid = sal_False; - mbObjectToDeviceValid = sal_False; - mbWorldToViewValid = sal_False; - } -} - void B3dTransformationSet::SetPerspective(sal_Bool bNew) { if(mbPerspective != bNew) @@ -539,13 +433,6 @@ void B3dTransformationSet::PostSetViewport() { } -const Rectangle& B3dTransformationSet::GetLogicalViewportBounds() -{ - if(!mbProjectionValid) - CalcViewport(); - return maSetBound; -} - const basegfx::B3DVector& B3dTransformationSet::GetScale() { if(!mbProjectionValid) @@ -577,13 +464,6 @@ void B3dTransformationSet::CalcMatObjectToDevice() mbObjectToDeviceValid = sal_True; } -const basegfx::B3DHomMatrix& B3dTransformationSet::GetObjectToDevice() -{ - if(!mbObjectToDeviceValid) - CalcMatObjectToDevice(); - return maObjectToDevice; -} - void B3dTransformationSet::CalcMatInvTransObjectToEye() { maInvTransObjectToEye = maObjectTrans; @@ -602,25 +482,6 @@ void B3dTransformationSet::CalcMatInvTransObjectToEye() mbInvTransObjectToEyeValid = sal_True; } -const basegfx::B3DHomMatrix& B3dTransformationSet::GetInvTransObjectToEye() -{ - if(!mbInvTransObjectToEyeValid) - CalcMatInvTransObjectToEye(); - return maInvTransObjectToEye; -} - -basegfx::B3DHomMatrix B3dTransformationSet::GetMatFromObjectToView() -{ - basegfx::B3DHomMatrix aFromObjectToView = GetObjectToDevice(); - - const basegfx::B3DVector& rScale(GetScale()); - aFromObjectToView.scale(rScale.getX(), rScale.getY(), rScale.getZ()); - const basegfx::B3DVector& rTranslate(GetTranslate()); - aFromObjectToView.translate(rTranslate.getX(), rTranslate.getY(), rTranslate.getZ()); - - return aFromObjectToView; -} - void B3dTransformationSet::CalcMatFromWorldToView() { maMatFromWorldToView = maOrientation; @@ -636,20 +497,6 @@ void B3dTransformationSet::CalcMatFromWorldToView() mbWorldToViewValid = sal_True; } -const basegfx::B3DHomMatrix& B3dTransformationSet::GetMatFromWorldToView() -{ - if(!mbWorldToViewValid) - CalcMatFromWorldToView(); - return maMatFromWorldToView; -} - -const basegfx::B3DHomMatrix& B3dTransformationSet::GetInvMatFromWorldToView() -{ - if(!mbWorldToViewValid) - CalcMatFromWorldToView(); - return maInvMatFromWorldToView; -} - /************************************************************************* |* |* Direkter Zugriff auf verschiedene Transformationen @@ -670,128 +517,6 @@ const basegfx::B3DPoint B3dTransformationSet::EyeToWorldCoor(const basegfx::B3DP return aVec; } -const basegfx::B3DPoint B3dTransformationSet::EyeToViewCoor(const basegfx::B3DPoint& rVec) -{ - basegfx::B3DPoint aVec(rVec); - aVec *= GetProjection(); - aVec *= GetScale(); - aVec += GetTranslate(); - return aVec; -} - -const basegfx::B3DPoint B3dTransformationSet::ViewToEyeCoor(const basegfx::B3DPoint& rVec) -{ - basegfx::B3DPoint aVec(rVec); - aVec -= GetTranslate(); - aVec = aVec / GetScale(); - aVec *= GetInvProjection(); - return aVec; -} - -const basegfx::B3DPoint B3dTransformationSet::WorldToViewCoor(const basegfx::B3DPoint& rVec) -{ - basegfx::B3DPoint aVec(rVec); - aVec *= GetMatFromWorldToView(); - return aVec; -} - -const basegfx::B3DPoint B3dTransformationSet::ViewToWorldCoor(const basegfx::B3DPoint& rVec) -{ - basegfx::B3DPoint aVec(rVec); - aVec *= GetInvMatFromWorldToView(); - return aVec; -} - -const basegfx::B3DPoint B3dTransformationSet::DeviceToViewCoor(const basegfx::B3DPoint& rVec) -{ - basegfx::B3DPoint aVec(rVec); - aVec *= GetScale(); - aVec += GetTranslate(); - return aVec; -} - -const basegfx::B3DPoint B3dTransformationSet::ViewToDeviceCoor(const basegfx::B3DPoint& rVec) -{ - basegfx::B3DPoint aVec(rVec); - aVec -= GetTranslate(); - aVec = aVec / GetScale(); - return aVec; -} - -const basegfx::B3DPoint B3dTransformationSet::ObjectToWorldCoor(const basegfx::B3DPoint& rVec) -{ - basegfx::B3DPoint aVec(rVec); - aVec *= GetObjectTrans(); - return aVec; -} - -const basegfx::B3DPoint B3dTransformationSet::WorldToObjectCoor(const basegfx::B3DPoint& rVec) -{ - basegfx::B3DPoint aVec(rVec); - aVec *= GetInvObjectTrans(); - return aVec; -} - -const basegfx::B3DPoint B3dTransformationSet::ObjectToViewCoor(const basegfx::B3DPoint& rVec) -{ - basegfx::B3DPoint aVec(rVec); - aVec *= GetObjectTrans(); - aVec *= GetMatFromWorldToView(); - return aVec; -} - -const basegfx::B3DPoint B3dTransformationSet::ViewToObjectCoor(const basegfx::B3DPoint& rVec) -{ - basegfx::B3DPoint aVec(rVec); - aVec *= GetInvMatFromWorldToView(); - aVec *= GetInvObjectTrans(); - return aVec; -} - -const basegfx::B3DPoint B3dTransformationSet::ObjectToEyeCoor(const basegfx::B3DPoint& rVec) -{ - basegfx::B3DPoint aVec(rVec); - aVec *= GetObjectTrans(); - aVec *= GetOrientation(); - return aVec; -} - -const basegfx::B3DPoint B3dTransformationSet::EyeToObjectCoor(const basegfx::B3DPoint& rVec) -{ - basegfx::B3DPoint aVec(rVec); - aVec *= GetInvOrientation(); - aVec *= GetInvObjectTrans(); - return aVec; -} - -const basegfx::B3DPoint B3dTransformationSet::DeviceToEyeCoor(const basegfx::B3DPoint& rVec) -{ - basegfx::B3DPoint aVec(rVec); - aVec *= GetInvProjection(); - return aVec; -} - -const basegfx::B3DPoint B3dTransformationSet::EyeToDeviceCoor(const basegfx::B3DPoint& rVec) -{ - basegfx::B3DPoint aVec(rVec); - aVec *= GetProjection(); - return aVec; -} - -const basegfx::B3DPoint B3dTransformationSet::InvTransObjectToEye(const basegfx::B3DPoint& rVec) -{ - basegfx::B3DPoint aVec(rVec); - aVec *= GetInvTransObjectToEye(); - return aVec; -} - -const basegfx::B2DPoint B3dTransformationSet::TransTextureCoor(const basegfx::B2DPoint& rVec) -{ - basegfx::B2DPoint aVec(rVec); - aVec *= GetTexture(); - return aVec; -} - /************************************************************************* |* |* Konstruktor B3dViewport @@ -811,18 +536,6 @@ B3dViewport::~B3dViewport() { } -void B3dViewport::SetVRP(const basegfx::B3DPoint& rNewVRP) -{ - aVRP = rNewVRP; - CalcOrientation(); -} - -void B3dViewport::SetVPN(const basegfx::B3DVector& rNewVPN) -{ - aVPN = rNewVPN; - CalcOrientation(); -} - void B3dViewport::SetVUV(const basegfx::B3DVector& rNewVUV) { aVUV = rNewVUV; @@ -869,81 +582,6 @@ B3dCamera::~B3dCamera() { } -void B3dCamera::SetPosition(const basegfx::B3DPoint& rNewPos) -{ - if(rNewPos != aPosition) - { - // Zuweisen - aCorrectedPosition = aPosition = rNewPos; - - // Neuberechnung - CalcNewViewportValues(); - } -} - -void B3dCamera::SetLookAt(const basegfx::B3DVector& rNewLookAt) -{ - if(rNewLookAt != aLookAt) - { - // Zuweisen - aLookAt = rNewLookAt; - - // Neuberechnung - CalcNewViewportValues(); - } -} - -void B3dCamera::SetPositionAndLookAt(const basegfx::B3DPoint& rNewPos, const basegfx::B3DVector& rNewLookAt) -{ - if(rNewPos != aPosition || rNewLookAt != aLookAt) - { - // Zuweisen - aPosition = rNewPos; - aLookAt = rNewLookAt; - - // Neuberechnung - CalcNewViewportValues(); - } -} - -void B3dCamera::SetFocalLength(double fLen) -{ - if(fLen != fFocalLength) - { - // Zuweisen - if(fLen < 5.0) - fLen = 5.0; - fFocalLength = fLen; - - // Neuberechnung - CalcNewViewportValues(); - } -} - -void B3dCamera::SetBankAngle(double fAngle) -{ - if(fAngle != fBankAngle) - { - // Zuweisen - fBankAngle = fAngle; - - // Neuberechnung - CalcNewViewportValues(); - } -} - -void B3dCamera::SetUseFocalLength(sal_Bool bNew) -{ - if(bNew != (sal_Bool)bUseFocalLength) - { - // Zuweisen - bUseFocalLength = bNew; - - // Neuberechnung - CalcNewViewportValues(); - } -} - void B3dCamera::DeviceRectangleChange() { // call parent diff --git a/tools/source/generic/bigint.cxx b/tools/source/generic/bigint.cxx index 4392e56d5e44..2312f3c5eeaf 100644 --- a/tools/source/generic/bigint.cxx +++ b/tools/source/generic/bigint.cxx @@ -855,75 +855,6 @@ BigInt& BigInt::operator/=( const BigInt& rVal ) // ----------------------------------------------------------------------- -void BigInt::DivMod( const BigInt& rVal, BigInt& rMod ) -{ - if ( !rVal.bIsBig ) - { - if ( rVal.nVal == 0 ) - { - OSL_FAIL( "BigInt::operator/ --> divide by zero" ); - return; - } - - if ( !bIsBig ) - { - // wir bewegen uns im ungefaehrlichem Bereich - rMod = BigInt( nVal % rVal.nVal ); - nVal /= rVal.nVal; - return; - } - - if ( rVal.nVal == 1 ) - { - rMod = BigInt( (long)0 ); - return; - } - - if ( rVal.nVal == -1 ) - { - rMod = BigInt( (long)0 ); - bIsNeg = !bIsNeg; - return; - } - - if ( rVal.nVal <= (long)0xFFFF && rVal.nVal >= -(long)0xFFFF ) - { - // ein BigInt durch ein sal_uInt16 teilen - sal_uInt16 nTmp; - if ( rVal.nVal < 0 ) - { - nTmp = (sal_uInt16) -rVal.nVal; - bIsNeg = !bIsNeg; - } - else - nTmp = (sal_uInt16) rVal.nVal; - - Div( nTmp, nTmp ); - rMod = BigInt( (long)nTmp ); - Normalize(); - return; - } - } - - if ( ABS_IsLess( rVal ) ) - { - rMod = *this; - *this = BigInt( (long)0 ); - return; - } - - // BigInt durch BigInt teilen - BigInt aTmp1, aTmp2; - aTmp1.MakeBigInt( *this ); - aTmp2.MakeBigInt( rVal ); - aTmp1.DivLong(aTmp2, *this); - Normalize(); - aTmp1.ModLong(aTmp2, rMod); // nicht optimal - rMod.Normalize(); -} - -// ----------------------------------------------------------------------- - BigInt& BigInt::operator%=( const BigInt& rVal ) { if ( !rVal.bIsBig ) diff --git a/tools/source/generic/config.cxx b/tools/source/generic/config.cxx index 6c533459f2a7..2075bf49e300 100644 --- a/tools/source/generic/config.cxx +++ b/tools/source/generic/config.cxx @@ -45,6 +45,7 @@ #include <tools/debug.hxx> #include <tools/config.hxx> #include <osl/security.h> +#include <rtl/strbuf.hxx> #define MAXBUFLEN 1024 // Fuer Buffer bei VOS-Funktionen @@ -1188,13 +1189,15 @@ sal_uInt16 Config::GetKeyCount() const ByteString Config::GetKeyName( sal_uInt16 nKey ) const { #ifdef DBG_UTIL - ByteString aTraceStr( "Config::GetKeyName( " ); - aTraceStr += ByteString::CreateFromInt32(nKey); - aTraceStr += " ) from "; - aTraceStr += GetGroup(); - aTraceStr += " in "; - aTraceStr += ByteString( maFileName, RTL_TEXTENCODING_UTF8 ); - OSL_TRACE( "%s", aTraceStr.GetBuffer() ); + rtl::OStringBuffer aTraceStr( + RTL_CONSTASCII_STRINGPARAM("Config::GetKeyName( ")); + aTraceStr.append(static_cast<sal_Int32>(nKey)); + aTraceStr.append(RTL_CONSTASCII_STRINGPARAM(" ) from ")); + aTraceStr.append(GetGroup()); + aTraceStr.append(RTL_CONSTASCII_STRINGPARAM(" in ")); + aTraceStr.append(rtl::OUStringToOString( + maFileName, RTL_TEXTENCODING_UTF8)); + OSL_TRACE("%s", aTraceStr.getStr()); #endif // Key suchen und Name zurueckgeben @@ -1223,13 +1226,15 @@ ByteString Config::GetKeyName( sal_uInt16 nKey ) const ByteString Config::ReadKey( sal_uInt16 nKey ) const { #ifdef DBG_UTIL - ByteString aTraceStr( "Config::ReadKey( " ); - aTraceStr += ByteString::CreateFromInt32( nKey ); - aTraceStr += " ) from "; - aTraceStr += GetGroup(); - aTraceStr += " in "; - aTraceStr += ByteString( maFileName, RTL_TEXTENCODING_UTF8 ); - OSL_TRACE( "%s", aTraceStr.GetBuffer() ); + rtl::OStringBuffer aTraceStr( + RTL_CONSTASCII_STRINGPARAM("Config::ReadKey( ")); + aTraceStr.append(static_cast<sal_Int32>(nKey)); + aTraceStr.append(RTL_CONSTASCII_STRINGPARAM(" ) from ")); + aTraceStr.append(GetGroup()); + aTraceStr.append(RTL_CONSTASCII_STRINGPARAM(" in ")); + aTraceStr.append(rtl::OUStringToOString(maFileName, + RTL_TEXTENCODING_UTF8)); + OSL_TRACE("%s", aTraceStr.getStr()); #endif // Key suchen und Value zurueckgeben diff --git a/tools/source/inet/inetmime.cxx b/tools/source/inet/inetmime.cxx index 78032e7d376e..d1178f29253e 100644 --- a/tools/source/inet/inetmime.cxx +++ b/tools/source/inet/inetmime.cxx @@ -492,18 +492,6 @@ bool INetMIME::isIMAPAtomChar(sal_uInt32 nChar) //============================================================================ // static -sal_uInt32 INetMIME::getDigit(int nWeight) -{ - DBG_ASSERT(nWeight >= 0 && nWeight < 10, - "INetMIME::getDigit(): Bad weight"); - - static const sal_Char aDigits[16] - = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' }; - return aDigits[nWeight]; -} - -//============================================================================ -// static sal_uInt32 INetMIME::getHexDigit(int nWeight) { DBG_ASSERT(nWeight >= 0 && nWeight < 16, @@ -517,40 +505,6 @@ sal_uInt32 INetMIME::getHexDigit(int nWeight) //============================================================================ // static -sal_uInt32 INetMIME::getBase64Digit(int nWeight) -{ - DBG_ASSERT(nWeight >= 0 && nWeight < 64, - "INetMIME::getBase64Digit(): Bad weight"); - - static const sal_Char aDigits[64] - = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', - 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', - 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', - 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', - '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/' }; - return aDigits[nWeight]; -} - -//============================================================================ -// static -bool INetMIME::equalIgnoreCase(const sal_Char * pBegin1, - const sal_Char * pEnd1, - const sal_Char * pBegin2, - const sal_Char * pEnd2) -{ - DBG_ASSERT(pBegin1 && pBegin1 <= pEnd1 && pBegin2 && pBegin2 <= pEnd2, - "INetMIME::equalIgnoreCase(): Bad sequences"); - - if (pEnd1 - pBegin1 != pEnd2 - pBegin2) - return false; - while (pBegin1 != pEnd1) - if (toUpperCase(*pBegin1++) != toUpperCase(*pBegin2++)) - return false; - return true; -} - -//============================================================================ -// static bool INetMIME::equalIgnoreCase(const sal_Char * pBegin1, const sal_Char * pEnd1, const sal_Char * pString2) @@ -583,35 +537,6 @@ bool INetMIME::equalIgnoreCase(const sal_Unicode * pBegin1, //============================================================================ // static -const sal_Char * INetMIME::skipLinearWhiteSpace(const sal_Char * pBegin, - const sal_Char * pEnd) -{ - DBG_ASSERT(pBegin && pBegin <= pEnd, - "INetMIME::skipLinearWhiteSpace(): Bad sequence"); - - while (pBegin != pEnd) - switch (*pBegin) - { - case '\t': - case ' ': - ++pBegin; - break; - - case 0x0D: // CR - if (startsWithLineFolding(pBegin, pEnd)) - pBegin += 3; - else - return pBegin; - break; - - default: - return pBegin; - } - return pBegin; -} - -//============================================================================ -// static const sal_Unicode * INetMIME::skipLinearWhiteSpace(const sal_Unicode * pBegin, const sal_Unicode * pEnd) { @@ -842,26 +767,6 @@ const sal_Unicode * INetMIME::skipQuotedString(const sal_Unicode * pBegin, //============================================================================ // static -const sal_Char * INetMIME::scanAtom(const sal_Char * pBegin, - const sal_Char * pEnd) -{ - while (pBegin != pEnd && isAtomChar(*pBegin)) - ++pBegin; - return pBegin; -} - -//============================================================================ -// static -const sal_Unicode * INetMIME::scanAtom(const sal_Unicode * pBegin, - const sal_Unicode * pEnd) -{ - while (pBegin != pEnd && isAtomChar(*pBegin)) - ++pBegin; - return pBegin; -} - -//============================================================================ -// static bool INetMIME::scanUnsigned(const sal_Char *& rBegin, const sal_Char * pEnd, bool bLeadingZeroes, sal_uInt32 & rValue) { @@ -909,127 +814,6 @@ bool INetMIME::scanUnsigned(const sal_Unicode *& rBegin, //============================================================================ // static -bool INetMIME::scanUnsignedHex(const sal_Char *& rBegin, - const sal_Char * pEnd, bool bLeadingZeroes, - sal_uInt32 & rValue) -{ - sal_uInt64 nTheValue = 0; - const sal_Char * p = rBegin; - for ( p = rBegin; p != pEnd; ++p) - { - int nWeight = getHexWeight(*p); - if (nWeight < 0) - break; - nTheValue = nTheValue << 4 | nWeight; - if (nTheValue > std::numeric_limits< sal_uInt32 >::max()) - return false; - } - if (nTheValue == 0 && (p == rBegin || (!bLeadingZeroes && p - rBegin != 1))) - return false; - rBegin = p; - rValue = sal_uInt32(nTheValue); - return true; -} - -//============================================================================ -// static -bool INetMIME::scanUnsignedHex(const sal_Unicode *& rBegin, - const sal_Unicode * pEnd, bool bLeadingZeroes, - sal_uInt32 & rValue) -{ - sal_uInt64 nTheValue = 0; - const sal_Unicode * p = rBegin; - for ( ; p != pEnd; ++p) - { - int nWeight = getHexWeight(*p); - if (nWeight < 0) - break; - nTheValue = nTheValue << 4 | nWeight; - if (nTheValue > std::numeric_limits< sal_uInt32 >::max()) - return false; - } - if (nTheValue == 0 && (p == rBegin || (!bLeadingZeroes && p - rBegin != 1))) - return false; - rBegin = p; - rValue = sal_uInt32(nTheValue); - return true; -} - -//============================================================================ -// static -const sal_Char * INetMIME::scanQuotedBlock(const sal_Char * pBegin, - const sal_Char * pEnd, - sal_uInt32 nOpening, - sal_uInt32 nClosing, - sal_Size & rLength, - bool & rModify) -{ - DBG_ASSERT(pBegin && pBegin <= pEnd, - "INetMIME::scanQuotedBlock(): Bad sequence"); - - if (pBegin != pEnd && static_cast< unsigned char >(*pBegin) == nOpening) - { - ++rLength; - ++pBegin; - while (pBegin != pEnd) - if (static_cast< unsigned char >(*pBegin) == nClosing) - { - ++rLength; - return ++pBegin; - } - else - { - sal_uInt32 c = *pBegin++; - switch (c) - { - case 0x0D: // CR - if (pBegin != pEnd && *pBegin == 0x0A) // LF - if (pEnd - pBegin >= 2 && isWhiteSpace(pBegin[1])) - { - ++rLength; - rModify = true; - pBegin += 2; - } - else - { - rLength += 3; - rModify = true; - ++pBegin; - } - else - ++rLength; - break; - - case '\\': - ++rLength; - if (pBegin != pEnd) - { - if (startsWithLineBreak(pBegin, pEnd) - && (pEnd - pBegin < 3 - || !isWhiteSpace(pBegin[2]))) - { - rLength += 3; - rModify = true; - pBegin += 2; - } - else - ++pBegin; - } - break; - - default: - ++rLength; - if (!isUSASCII(c)) - rModify = true; - break; - } - } - } - return pBegin; -} - -//============================================================================ -// static const sal_Unicode * INetMIME::scanQuotedBlock(const sal_Unicode * pBegin, const sal_Unicode * pEnd, sal_uInt32 nOpening, @@ -1767,14 +1551,6 @@ rtl_TextEncoding INetMIME::getCharsetEncoding(sal_Char const * pBegin, //============================================================================ // static -rtl_TextEncoding INetMIME::getCharsetEncoding(sal_Unicode const * pBegin, - sal_Unicode const * pEnd) -{ - return getCharsetEncoding_Impl(pBegin, pEnd); -} - -//============================================================================ -// static INetMIMECharsetList_Impl * INetMIME::createPreferredCharsetList(rtl_TextEncoding eEncoding) { @@ -2170,80 +1946,6 @@ void INetMIME::writeUTF8(INetMIMEOutputSink & rSink, sal_uInt32 nChar) //============================================================================ // static -void INetMIME::writeUnsigned(INetMIMEOutputSink & rSink, sal_uInt32 nValue, - int nMinDigits) -{ - sal_Char aBuffer[10]; - // max unsigned 32 bit value (4294967295) has 10 places - sal_Char * p = aBuffer; - for (; nValue > 0; nValue /= 10) - *p++ = sal_Char(getDigit(nValue % 10)); - nMinDigits -= p - aBuffer; - while (nMinDigits-- > 0) - rSink << '0'; - while (p != aBuffer) - rSink << *--p; -} - -//============================================================================ -// static -void INetMIME::writeDateTime(INetMIMEOutputSink & rSink, - const DateTime & rUTC) -{ - static const sal_Char aDay[7][3] - = { { 'M', 'o', 'n' }, - { 'T', 'u', 'e' }, - { 'W', 'e', 'd' }, - { 'T', 'h', 'u' }, - { 'F', 'r', 'i' }, - { 'S', 'a', 't' }, - { 'S', 'u', 'n' } }; - const sal_Char * pTheDay = aDay[rUTC.GetDayOfWeek()]; - rSink.write(pTheDay, pTheDay + 3); - rSink << ", "; - writeUnsigned(rSink, rUTC.GetDay()); - rSink << ' '; - static const sal_Char aMonth[12][3] - = { { 'J', 'a', 'n' }, - { 'F', 'e', 'b' }, - { 'M', 'a', 'r' }, - { 'A', 'p', 'r' }, - { 'M', 'a', 'y' }, - { 'J', 'u', 'n' }, - { 'J', 'u', 'l' }, - { 'A', 'u', 'g' }, - { 'S', 'e', 'p' }, - { 'O', 'c', 't' }, - { 'N', 'o', 'v' }, - { 'D', 'e', 'c' } }; - const sal_Char * pTheMonth = aMonth[rUTC.GetMonth() - 1]; - rSink.write(pTheMonth, pTheMonth + 3); - rSink << ' '; - writeUnsigned(rSink, rUTC.GetYear()); - rSink << ' '; - writeUnsigned(rSink, rUTC.GetHour(), 2); - rSink << ':'; - writeUnsigned(rSink, rUTC.GetMin(), 2); - rSink << ':'; - writeUnsigned(rSink, rUTC.GetSec(), 2); - rSink << " +0000"; -} - -//============================================================================ -// static -void INetMIME::writeHeaderFieldBody(INetMIMEOutputSink & rSink, - HeaderFieldType eType, - const ByteString & rBody, - rtl_TextEncoding ePreferredEncoding, - bool bInitialSpace) -{ - writeHeaderFieldBody(rSink, eType, - UniString(rBody, RTL_TEXTENCODING_UTF8), - ePreferredEncoding, bInitialSpace); -} - -//============================================================================ -// static void INetMIME::writeHeaderFieldBody(INetMIMEOutputSink & rSink, HeaderFieldType eType, const UniString & rBody, diff --git a/tools/source/inet/inetmsg.cxx b/tools/source/inet/inetmsg.cxx index 2fc9f5fcb8e3..1645e9ba7aea 100644 --- a/tools/source/inet/inetmsg.cxx +++ b/tools/source/inet/inetmsg.cxx @@ -34,6 +34,7 @@ #include <tools/inetmsg.hxx> #include <tools/inetstrm.hxx> #include <rtl/instance.hxx> +#include <rtl/strbuf.hxx> #include <stdio.h> @@ -63,7 +64,6 @@ inline sal_Unicode ascii_toLowerCase( sal_Unicode ch ) * *=====================================================================*/ #define CONSTASCII_STRINGPARAM(a) (a), RTL_TEXTENCODING_ASCII_US -#define HEADERFIELD INetMessageHeader /* * ~INetMessage. @@ -79,10 +79,10 @@ INetMessage::~INetMessage (void) void INetMessage::ListCleanup_Impl (void) { // Cleanup. - sal_uIntPtr i, n = m_aHeaderList.Count(); + sal_uIntPtr i, n = m_aHeaderList.size(); for (i = 0; i < n; i++) - delete ((HEADERFIELD*)(m_aHeaderList.GetObject(i))); - m_aHeaderList.Clear(); + delete m_aHeaderList[ i ]; + m_aHeaderList.clear(); } /* @@ -99,8 +99,8 @@ void INetMessage::ListCopy (const INetMessage &rMsg) sal_uIntPtr i, n = rMsg.GetHeaderCount(); for (i = 0; i < n; i++) { - HEADERFIELD *p = (HEADERFIELD*)(rMsg.m_aHeaderList.GetObject(i)); - m_aHeaderList.Insert (new HEADERFIELD(*p), LIST_APPEND); + INetMessageHeader *p = rMsg.m_aHeaderList[ i ]; + m_aHeaderList.push_back( new INetMessageHeader(*p) ); } } } @@ -125,20 +125,6 @@ void INetMessage::SetHeaderField_Impl ( * SetHeaderField. */ sal_uIntPtr INetMessage::SetHeaderField ( - const UniString& rName, const UniString& rValue, sal_uIntPtr nIndex) -{ - sal_uIntPtr nResult = nIndex; - SetHeaderField_Impl ( - INetMIME::HEADER_FIELD_TEXT, - ByteString (rName, RTL_TEXTENCODING_ASCII_US), rValue, - nResult); - return nResult; -} - -/* - * SetHeaderField. - */ -sal_uIntPtr INetMessage::SetHeaderField ( const INetMessageHeader &rHeader, sal_uIntPtr nIndex) { sal_uIntPtr nResult = nIndex; @@ -155,11 +141,11 @@ SvStream& INetMessage::operator<< (SvStream& rStrm) const rStrm << static_cast<sal_uInt32>(m_nDocSize); rStrm.WriteByteString (m_aDocName, RTL_TEXTENCODING_UTF8); - sal_uIntPtr i, n = m_aHeaderList.Count(); + sal_uIntPtr i, n = m_aHeaderList.size(); rStrm << static_cast<sal_uInt32>(n); for (i = 0; i < n; i++) - rStrm << *((HEADERFIELD *)(m_aHeaderList.GetObject(i))); + rStrm << *( m_aHeaderList[ i ] ); return rStrm; } @@ -187,9 +173,9 @@ SvStream& INetMessage::operator>> (SvStream& rStrm) for (i = 0; i < n; i++) { - HEADERFIELD *p = new HEADERFIELD(); + INetMessageHeader *p = new INetMessageHeader(); rStrm >> *p; - m_aHeaderList.Insert (p, LIST_APPEND); + m_aHeaderList.push_back( p ); } // Done. @@ -198,34 +184,6 @@ SvStream& INetMessage::operator>> (SvStream& rStrm) /*======================================================================= * - * INetMessageHeaderIterator Implementation. - * - *=====================================================================*/ -INetMessageHeaderIterator::INetMessageHeaderIterator ( - const INetMessage& rMsg, const UniString& rHdrName) -{ - sal_uIntPtr i, n = rMsg.GetHeaderCount(); - for (i = 0; i < n; i++) - { - if (rHdrName.CompareIgnoreCaseToAscii (rMsg.GetHeaderName(i)) == 0) - { - UniString *pValue = new UniString (rMsg.GetHeaderValue(i)); - aValueList.Insert (pValue, LIST_APPEND); - } - } - nValueCount = aValueList.Count(); -} - -INetMessageHeaderIterator::~INetMessageHeaderIterator (void) -{ - sal_uIntPtr i, n = aValueList.Count(); - for (i = 0; i < n; i++) - delete ((UniString*)(aValueList.GetObject(i))); - aValueList.Clear(); -} - -/*======================================================================= - * * INetRFC822Message Implementation. * *=====================================================================*/ @@ -324,13 +282,8 @@ INetRFC822Message::~INetRFC822Message (void) } /* - * <Generate|Parse>DateField and local helper functions. - * - * GenerateDateField. - * Generates a String from Date and Time objects in format: - * Wkd, 00 Mon 0000 00:00:00 [GMT] (rfc822, rfc1123) + * ParseDateField and local helper functions. * - * ParseDateField. * Parses a String in (implied) GMT format into class Date and Time objects. * Four formats are accepted: * @@ -349,62 +302,6 @@ static const sal_Char *months[12] = "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; -static const sal_Char *wkdays[7] = -{ - "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun" -}; - -/* - * GenerateDateField. - */ -sal_Bool INetRFC822Message::GenerateDateField ( - const DateTime& rDateTime, UniString& rDateFieldW) -{ - // Check arguments. - if (!rDateTime.IsValid() || - (rDateTime.GetSec() > 59) || - (rDateTime.GetMin() > 59) || - (rDateTime.GetHour() > 23) ) return sal_False; - - // Prepare output string. - ByteString rDateField; - - // Insert Date. - rDateField += wkdays[(sal_uInt16)(rDateTime.GetDayOfWeek())]; - rDateField += ", "; - - sal_uInt16 nNum = rDateTime.GetDay(); - if (nNum < 10) rDateField += '0'; - rDateField += ByteString::CreateFromInt32(nNum); - rDateField += ' '; - - rDateField += months[(sal_uInt16)(rDateTime.GetMonth() - 1)]; - rDateField += ' '; - - rDateField += ByteString::CreateFromInt32(rDateTime.GetYear()); - rDateField += ' '; - - // Insert Time. - nNum = rDateTime.GetHour(); - if (nNum < 10) rDateField += '0'; - rDateField += ByteString::CreateFromInt32(nNum); - rDateField += ':'; - - nNum = rDateTime.GetMin(); - if (nNum < 10) rDateField += '0'; - rDateField += ByteString::CreateFromInt32(nNum); - rDateField += ':'; - - nNum = rDateTime.GetSec(); - if (nNum < 10) rDateField += '0'; - rDateField += ByteString::CreateFromInt32(nNum); - rDateField += " GMT"; - - // Done. - rDateFieldW = UniString (rDateField, RTL_TEXTENCODING_ASCII_US); - return sal_True; -} - /* * ParseDateField and local helper functions. */ @@ -761,7 +658,7 @@ sal_uIntPtr INetRFC822Message::SetHeaderField ( case INETMSG_RFC822_OK: pData = pStop; SetHeaderField_Impl ( - HEADERFIELD (HDR(nIdx), rHeader.GetValue()), + INetMessageHeader (HDR(nIdx), rHeader.GetValue()), m_nIndex[nIdx]); nNewIndex = m_nIndex[nIdx]; break; @@ -776,129 +673,6 @@ sal_uIntPtr INetRFC822Message::SetHeaderField ( } /* - * Specific Set-Methods. - */ -void INetRFC822Message::SetBCC (const UniString& rBCC) -{ - SetHeaderField_Impl ( - INetMIME::HEADER_FIELD_ADDRESS, - HDR(INETMSG_RFC822_BCC), rBCC, - m_nIndex[INETMSG_RFC822_BCC]); -} - -void INetRFC822Message::SetCC (const UniString& rCC) -{ - SetHeaderField_Impl ( - INetMIME::HEADER_FIELD_ADDRESS, - HDR(INETMSG_RFC822_CC), rCC, - m_nIndex[INETMSG_RFC822_CC]); -} - -void INetRFC822Message::SetComments (const UniString& rComments) -{ - SetHeaderField_Impl ( - INetMIME::HEADER_FIELD_TEXT, - HDR(INETMSG_RFC822_COMMENTS), rComments, - m_nIndex[INETMSG_RFC822_COMMENTS]); -} - -void INetRFC822Message::SetDate (const UniString& rDate) -{ - SetHeaderField_Impl ( - INetMIME::HEADER_FIELD_STRUCTURED, - HDR(INETMSG_RFC822_DATE), rDate, - m_nIndex[INETMSG_RFC822_DATE]); -} - -void INetRFC822Message::SetFrom (const UniString& rFrom) -{ - SetHeaderField_Impl ( - INetMIME::HEADER_FIELD_ADDRESS, - HDR(INETMSG_RFC822_FROM), rFrom, - m_nIndex[INETMSG_RFC822_FROM]); -} - -void INetRFC822Message::SetInReplyTo (const UniString& rInReplyTo) -{ - SetHeaderField_Impl ( - INetMIME::HEADER_FIELD_ADDRESS, // ??? MESSAGE_ID ??? - HDR(INETMSG_RFC822_IN_REPLY_TO), rInReplyTo, - m_nIndex[INETMSG_RFC822_IN_REPLY_TO]); -} - -void INetRFC822Message::SetKeywords (const UniString& rKeywords) -{ - SetHeaderField_Impl ( - INetMIME::HEADER_FIELD_PHRASE, - HDR(INETMSG_RFC822_KEYWORDS), rKeywords, - m_nIndex[INETMSG_RFC822_KEYWORDS]); -} - -void INetRFC822Message::SetMessageID (const UniString& rMessageID) -{ - SetHeaderField_Impl ( - INetMIME::HEADER_FIELD_MESSAGE_ID, - HDR(INETMSG_RFC822_MESSAGE_ID), rMessageID, - m_nIndex[INETMSG_RFC822_MESSAGE_ID]); -} - -void INetRFC822Message::SetReferences (const UniString& rReferences) -{ - SetHeaderField_Impl ( - INetMIME::HEADER_FIELD_MESSAGE_ID, - HDR(INETMSG_RFC822_REFERENCES), rReferences, - m_nIndex[INETMSG_RFC822_REFERENCES]); -} - -void INetRFC822Message::SetReplyTo (const UniString& rReplyTo) -{ - SetHeaderField_Impl ( - INetMIME::HEADER_FIELD_ADDRESS, - HDR(INETMSG_RFC822_REPLY_TO), rReplyTo, - m_nIndex[INETMSG_RFC822_REPLY_TO]); -} - -void INetRFC822Message::SetReturnPath (const UniString& rReturnPath) -{ - SetHeaderField_Impl ( - INetMIME::HEADER_FIELD_ADDRESS, - HDR(INETMSG_RFC822_RETURN_PATH), rReturnPath, - m_nIndex[INETMSG_RFC822_RETURN_PATH]); -} - -void INetRFC822Message::SetReturnReceiptTo (const UniString& rValue) -{ - SetHeaderField_Impl ( - INetMIME::HEADER_FIELD_ADDRESS, - HDR(INETMSG_RFC822_RETURN_RECEIPT_TO), rValue, - m_nIndex[INETMSG_RFC822_RETURN_RECEIPT_TO]); -} - -void INetRFC822Message::SetSender (const UniString& rSender) -{ - SetHeaderField_Impl ( - INetMIME::HEADER_FIELD_ADDRESS, - HDR(INETMSG_RFC822_SENDER), rSender, - m_nIndex[INETMSG_RFC822_SENDER]); -} - -void INetRFC822Message::SetSubject (const UniString& rSubject) -{ - SetHeaderField_Impl ( - INetMIME::HEADER_FIELD_TEXT, - HDR(INETMSG_RFC822_SUBJECT), rSubject, - m_nIndex[INETMSG_RFC822_SUBJECT]); -} - -void INetRFC822Message::SetTo (const UniString& rTo) -{ - SetHeaderField_Impl ( - INetMIME::HEADER_FIELD_ADDRESS, - HDR(INETMSG_RFC822_TO), rTo, - m_nIndex[INETMSG_RFC822_TO]); -} - -/* * operator<< */ SvStream& INetRFC822Message::operator<< (SvStream& rStrm) const @@ -982,7 +756,6 @@ enum _ImplINetMIMEMessageHeaderState INetMIMEMessage::INetMIMEMessage (void) : INetRFC822Message (), pParent (NULL), - nNumChildren (0), bHeaderParsed (sal_False) { for (sal_uInt16 i = 0; i < INETMSG_MIME_NUMHDR; i++) @@ -1030,9 +803,10 @@ INetMIMEMessage::~INetMIMEMessage (void) */ void INetMIMEMessage::CleanupImp (void) { - INetMIMEMessage *pChild = NULL; - while ((pChild = (INetMIMEMessage *)(aChildren.Remove())) != NULL) - if (pChild->pParent == this) delete pChild; + for( size_t i = 0, n = aChildren.size(); i < n; ++i ) { + delete aChildren[ i ]; + } + aChildren.clear(); } /* @@ -1042,24 +816,22 @@ void INetMIMEMessage::CopyImp (const INetMIMEMessage& rMsg) { bHeaderParsed = rMsg.bHeaderParsed; - sal_uInt16 i; + size_t i; for (i = 0; i < INETMSG_MIME_NUMHDR; i++) m_nIndex[i] = rMsg.m_nIndex[i]; m_aBoundary = rMsg.m_aBoundary; - nNumChildren = rMsg.nNumChildren; - for (i = 0; i < rMsg.aChildren.Count(); i++) + for (i = 0; i < rMsg.aChildren.size(); i++) { - INetMIMEMessage *pChild = - (INetMIMEMessage *)(rMsg.aChildren.GetObject (i)); + INetMIMEMessage *pChild = rMsg.aChildren[ i ]; if (pChild->pParent == &rMsg) { pChild = pChild->CreateMessage (*pChild); pChild->pParent = this; } - aChildren.Insert (pChild, LIST_APPEND); + aChildren.push_back( pChild ); } } @@ -1207,7 +979,7 @@ sal_uIntPtr INetMIMEMessage::SetHeaderField ( case INETMSG_MIME_OK: pData = pStop; SetHeaderField_Impl ( - HEADERFIELD (MIMEHDR(nIdx), rHeader.GetValue()), + INetMessageHeader (MIMEHDR(nIdx), rHeader.GetValue()), m_nIndex[nIdx]); nNewIndex = m_nIndex[nIdx]; break; @@ -1233,14 +1005,6 @@ void INetMIMEMessage::SetMIMEVersion (const UniString& rVersion) m_nIndex[INETMSG_MIME_VERSION]); } -void INetMIMEMessage::SetContentDescription (const String& rDescription) -{ - SetHeaderField_Impl ( - INetMIME::HEADER_FIELD_TEXT, - MIMEHDR(INETMSG_MIME_CONTENT_DESCRIPTION), rDescription, - m_nIndex[INETMSG_MIME_CONTENT_DESCRIPTION]); -} - void INetMIMEMessage::SetContentDisposition (const String& rDisposition) { SetHeaderField_Impl ( @@ -1249,14 +1013,6 @@ void INetMIMEMessage::SetContentDisposition (const String& rDisposition) m_nIndex[INETMSG_MIME_CONTENT_DISPOSITION]); } -void INetMIMEMessage::SetContentID (const String& rID) -{ - SetHeaderField_Impl ( - INetMIME::HEADER_FIELD_TEXT, - MIMEHDR(INETMSG_MIME_CONTENT_ID), rID, - m_nIndex[INETMSG_MIME_CONTENT_ID]); -} - void INetMIMEMessage::SetContentType (const String& rType) { SetHeaderField_Impl ( @@ -1388,202 +1144,8 @@ sal_Bool INetMIMEMessage::AttachChild ( if (IsContainer() /*&& rChildMsg.GetContentType().Len() */) { if (bOwner) rChildMsg.pParent = this; - aChildren.Insert (&rChildMsg, LIST_APPEND); - nNumChildren = aChildren.Count(); - - return sal_True; - } - return sal_False; -} - -/* - * DetachChild. - */ -sal_Bool INetMIMEMessage::DetachChild ( - sal_uIntPtr nIndex, INetMIMEMessage& rChildMsg) const -{ - if (IsContainer()) - { - // Check document stream. - if (GetDocumentLB() == NULL) return sal_False; - SvStream *pDocStrm = new SvStream (GetDocumentLB()); - - // Initialize message buffer. - char pMsgBuffer[1024]; - char *pMsgRead, *pMsgWrite; - pMsgRead = pMsgWrite = pMsgBuffer; - - // Initialize message parser stream. - INetMIMEMessageStream *pMsgStrm = NULL; - - // Check for "multipart/uvw" or "message/xyz". - if (IsMultipart()) - { - // Multipart message body. Initialize multipart delimiters. - ByteString aDelim ("--"); - aDelim += GetMultipartBoundary(); - ByteString aClose = aDelim; - aClose += "--"; - - // Initialize line buffer. - SvMemoryStream aLineBuf; - - // Initialize control variables. - INetMessageStreamState eState = INETMSG_EOL_SCR; - int nCurIndex = -1; - - // Go! - while (nCurIndex < (int)(nIndex + 1)) - { - if ((pMsgRead - pMsgWrite) > 0) - { - // Bytes still in buffer. - if (eState == INETMSG_EOL_FCR) - { - // Check for 2nd line break character. - if ((*pMsgWrite == '\r') || (*pMsgWrite == '\n')) - aLineBuf << *pMsgWrite++; - - // Check current index. - if (nCurIndex == (int)nIndex) - { - // Found requested part. - if (pMsgStrm == NULL) - { - // Create message parser stream. - pMsgStrm = new INetMIMEMessageStream; - pMsgStrm->SetTargetMessage (&rChildMsg); - } - - // Put message down-stream. - int status = pMsgStrm->Write ( - (const sal_Char *) aLineBuf.GetData(), aLineBuf.Tell()); - if (status != INETSTREAM_STATUS_OK) - { - // Cleanup. - delete pDocStrm; - delete pMsgStrm; - - // Finish. - return (!(status == INETSTREAM_STATUS_OK)); - } - } - - // Reset to <Begin-of-Line>. - aLineBuf.Seek (STREAM_SEEK_TO_BEGIN); - eState = INETMSG_EOL_SCR; - } - else if ((*pMsgWrite == '\r') || (*pMsgWrite == '\n')) - { - /* - * Found any line break character. - * Compare buffered line with part/close delimiter. - * Increment current part index upon match. - */ - sal_uInt16 nLen = (sal_uInt16)(aLineBuf.Tell() & 0xffff); - if (nLen == aDelim.Len()) - { - if (aDelim.CompareTo ((const sal_Char *) aLineBuf.GetData(), nLen) - == COMPARE_EQUAL) nCurIndex++; - } - else if (nLen == aClose.Len()) - { - if (aClose.CompareTo ((const sal_Char *) aLineBuf.GetData(), nLen) - == COMPARE_EQUAL) nCurIndex++; - } - aLineBuf << *pMsgWrite++; - eState = INETMSG_EOL_FCR; - } - else - { - // Insert into line buffer. - aLineBuf << *pMsgWrite; - } - } - else - { - // Buffer empty. Reset to <Begin-of-Buffer>. - pMsgRead = pMsgWrite = pMsgBuffer; - - // Read document stream. - sal_uIntPtr nRead = pDocStrm->Read ( - pMsgBuffer, sizeof (pMsgBuffer)); - if (nRead > 0) - { - // Set read pointer. - pMsgRead += nRead; - } - else - { - // Premature end. - if (pMsgStrm) - { - // Assume end of requested part. - nCurIndex++; - } - else - { - // Requested part not found. - delete pDocStrm; - return sal_False; - } - } - } - } // while (nCurIndex < (nIndex + 1)) - } - else - { - // Encapsulated message body. Create message parser stream. - pMsgStrm = new INetMIMEMessageStream; - pMsgStrm->SetTargetMessage (&rChildMsg); - - // Initialize control variables. - INetMessageStreamState eState = INETMSG_EOL_BEGIN; - - // Go. - while (eState == INETMSG_EOL_BEGIN) - { - if ((pMsgRead - pMsgWrite) > 0) - { - // Bytes still in buffer. Put message down-stream. - int status = pMsgStrm->Write ( - pMsgBuffer, (pMsgRead - pMsgWrite)); - if (status != INETSTREAM_STATUS_OK) - { - // Cleanup. - delete pDocStrm; - delete pMsgStrm; - - // Finish. - return (!(status == INETSTREAM_STATUS_ERROR)); - } - pMsgWrite = pMsgBuffer + (pMsgRead - pMsgWrite); - } - else - { - // Buffer empty. Reset to <Begin-of-Buffer>. - pMsgRead = pMsgWrite = pMsgBuffer; - - // Read document stream. - sal_uIntPtr nRead = pDocStrm->Read ( - pMsgBuffer, sizeof (pMsgBuffer)); - if (nRead > 0) - { - // Set read pointer. - pMsgRead += nRead; - } - else - { - // Mark we're done. - eState = INETMSG_EOL_DONE; - } - } - } // while (eState == INETMSG_EOL_BEGIN) - } + aChildren.push_back( &rChildMsg ); - // Done. - if (pDocStrm) delete pDocStrm; - if (pMsgStrm) delete pMsgStrm; return sal_True; } return sal_False; @@ -1604,7 +1166,7 @@ SvStream& INetMIMEMessage::operator<< (SvStream& rStrm) const #else rStrm.WriteByteString (m_aBoundary); #endif - rStrm << static_cast<sal_uInt32>(nNumChildren); + rStrm << static_cast<sal_uInt32>(aChildren.size()); return rStrm; } @@ -1629,7 +1191,6 @@ SvStream& INetMIMEMessage::operator>> (SvStream& rStrm) rStrm.ReadByteString (m_aBoundary); #endif rStrm >> nTemp; - nNumChildren = nTemp; return rStrm; } diff --git a/tools/source/inet/inetstrm.cxx b/tools/source/inet/inetstrm.cxx index 07d404b090ad..7a04ea24af20 100644 --- a/tools/source/inet/inetstrm.cxx +++ b/tools/source/inet/inetstrm.cxx @@ -173,48 +173,6 @@ int INetIStream::Read (sal_Char *pData, sal_uIntPtr nSize) return GetData (pData, nSize); } -/* - * Decode64. - */ -void INetIStream::Decode64 (SvStream& rIn, SvStream& rOut) -{ - INetMessage aMsg; - aMsg.SetDocumentLB(new SvAsyncLockBytes(&rOut, sal_False)); - - INetMessageDecode64Stream_Impl aStream (8192); - aStream.SetTargetMessage (&aMsg); - - sal_Char* pBuf = new sal_Char[8192]; - - int nRead = 0; - while ((nRead = rIn.Read (pBuf, 8192)) > 0) - aStream.Write( pBuf, nRead ); - aStream.Write ("\r\n", 2); - - delete[] pBuf; -} - -/* - * Encode64. - */ -void INetIStream::Encode64 (SvStream& rIn, SvStream& rOut) -{ - INetMessage aMsg; - aMsg.SetDocumentLB ( - new SvLockBytes (&rIn, sal_False)); - - INetMessageEncode64Stream_Impl aStream (8192); - aStream.SetSourceMessage (&aMsg); - - sal_Char* pBuf = new sal_Char[8192]; - - int nRead = 0; - while ((nRead = aStream.Read (pBuf, 8192)) > 0) - rOut.Write( pBuf, nRead ); - - delete[] pBuf; -} - /*========================================================================= * * INetOStream Implementation. @@ -1621,7 +1579,6 @@ int INetMIMEMessageStream::PutMsgLine (const sal_Char *pData, sal_uIntPtr nSize) if( !pChildStrm ) { // Encapsulated message. - pMsg->SetChildCount( pMsg->GetChildCount() + 1); INetMIMEMessage* pNewMessage = new INetMIMEMessage; pNewMessage->SetDocumentLB ( new SvAsyncLockBytes(new SvCacheStream, sal_False)); @@ -1731,7 +1688,6 @@ int INetMIMEMessageStream::PutMsgLine (const sal_Char *pData, sal_uIntPtr nSize) != COMPARE_EQUAL ) { // Encapsulated message. - pMsg->SetChildCount(pMsg->GetChildCount() + 1); INetMIMEMessage* pNewMessage = new INetMIMEMessage; pNewMessage->SetDocumentLB ( diff --git a/tools/source/memtools/table.cxx b/tools/source/memtools/table.cxx index 75119ba6f142..e9c2239b1c82 100644 --- a/tools/source/memtools/table.cxx +++ b/tools/source/memtools/table.cxx @@ -257,45 +257,6 @@ sal_Bool Table::IsKeyValid( sal_uIntPtr nKey ) const // ----------------------------------------------------------------------- -sal_uIntPtr Table::GetUniqueKey( sal_uIntPtr nStartKey ) const -{ - DBG_ASSERT( (nStartKey > 1) && (nStartKey < 0xFFFFFFFF), - "Table::GetUniqueKey() - nStartKey == 0 or nStartKey >= 0xFFFFFFFF" ); - - if ( !nCount ) - return nStartKey; - - sal_uIntPtr nLastKey = (sal_uIntPtr)Container::GetObject( (nCount*2)-2 ); - if ( nLastKey < nStartKey ) - return nStartKey; - else - { - if ( nLastKey < 0xFFFFFFFE ) - return nLastKey+1; - else - { - sal_uIntPtr nPos; - sal_uIntPtr nTempPos = ImplGetIndex( nStartKey, &nPos ); - if ( nTempPos != TABLE_ENTRY_NOTFOUND ) - nPos = nTempPos; - nLastKey = (sal_uIntPtr)Container::GetObject( nPos ); - if ( nStartKey < nLastKey ) - return nStartKey; - while ( nLastKey < 0xFFFFFFFE ) - { - nPos += 2; - nLastKey++; - if ( nLastKey != (sal_uIntPtr)Container::GetObject( nPos ) ) - return nLastKey; - } - } - } - - return 0; -} - -// ----------------------------------------------------------------------- - sal_uIntPtr Table::SearchKey( sal_uIntPtr nKey, sal_uIntPtr* pPos ) const { *pPos = 0; diff --git a/tools/source/rc/isofallback.cxx b/tools/source/rc/isofallback.cxx index e2a82a865b94..2fae5cfc9eee 100644 --- a/tools/source/rc/isofallback.cxx +++ b/tools/source/rc/isofallback.cxx @@ -42,7 +42,7 @@ bool GetIsoFallback(rtl::OString& rLanguage) sal_Int32 nSepPos = rLanguage.indexOf('-'); if (nSepPos == -1) { - if (rLanguage == rtl::OString(RTL_CONSTASCII_STRINGPARAM("en"))) + if (rLanguage.equalsL(RTL_CONSTASCII_STRINGPARAM("en"))) { // en -> "" rLanguage = rtl::OString(); diff --git a/tools/source/rc/resmgr.cxx b/tools/source/rc/resmgr.cxx index d4b7225a22d4..8b53ebb81823 100644 --- a/tools/source/rc/resmgr.cxx +++ b/tools/source/rc/resmgr.cxx @@ -590,19 +590,20 @@ InternalResMgr::~InternalResMgr() { SvFileStream aStm( UniString( pLogFile, RTL_TEXTENCODING_ASCII_US ), STREAM_WRITE ); aStm.Seek( STREAM_SEEK_TO_END ); - ByteString aLine( "FileName: " ); - aLine.Append( ByteString( OUStringToOString( aFileName, RTL_TEXTENCODING_UTF8 ) ) ); - aStm.WriteLine( aLine ); + rtl::OStringBuffer aLine(RTL_CONSTASCII_STRINGPARAM("FileName: ")); + aLine.append(rtl::OUStringToOString(aFileName, + RTL_TEXTENCODING_UTF8)); + aStm.WriteLine(aLine.makeStringAndClear()); for( boost::unordered_map<sal_uInt64, int>::const_iterator it = pResUseDump->begin(); it != pResUseDump->end(); ++it ) { sal_uInt64 nKeyId = it->first; - aLine.Assign( "Type/Id: " ); - aLine.Append( ByteString::CreateFromInt32( sal::static_int_cast< sal_Int32 >((nKeyId >> 32) & 0xFFFFFFFF) ) ); - aLine.Append( '/' ); - aLine.Append( ByteString::CreateFromInt32( sal::static_int_cast< sal_Int32 >(nKeyId & 0xFFFFFFFF) ) ); - aStm.WriteLine( aLine ); + aLine.append(RTL_CONSTASCII_STRINGPARAM("Type/Id: ")); + aLine.append(sal::static_int_cast< sal_Int32 >((nKeyId >> 32) & 0xFFFFFFFF)); + aLine.append('/'); + aLine.append(sal::static_int_cast< sal_Int32 >(nKeyId & 0xFFFFFFFF)); + aStm.WriteLine(aLine.makeStringAndClear()); } } } @@ -817,31 +818,37 @@ void ResMgr::RscError_Impl( const sal_Char* pMessage, ResMgr* pResMgr, ResMgr* pNewResMgr = new ResMgr( pImp ); - ByteString aStr = OUStringToOString( pResMgr->GetFileName(), RTL_TEXTENCODING_UTF8 ); - if ( aStr.Len() ) - aStr += '\n'; + rtl::OStringBuffer aStr(rtl::OUStringToOString(pResMgr->GetFileName(), + RTL_TEXTENCODING_UTF8)); - aStr.Append( "Class: " ); - aStr.Append( ByteString( GetTypeRes_Impl( ResId( nRT, *pNewResMgr ) ), RTL_TEXTENCODING_UTF8 ) ); - aStr.Append( ", Id: " ); - aStr.Append( ByteString::CreateFromInt32( (long)nId ) ); - aStr.Append( ". " ); - aStr.Append( pMessage ); + if (aStr.getLength()) + aStr.append('\n'); - aStr.Append( "\nResource Stack\n" ); + aStr.append(RTL_CONSTASCII_STRINGPARAM("Class: ")); + aStr.append(rtl::OUStringToOString(GetTypeRes_Impl(ResId(nRT, *pNewResMgr)), + RTL_TEXTENCODING_UTF8)); + aStr.append(RTL_CONSTASCII_STRINGPARAM(", Id: ")); + aStr.append(static_cast<sal_Int32>(nId)); + aStr.append(RTL_CONSTASCII_STRINGPARAM(". ")); + aStr.append(pMessage); + + aStr.append(RTL_CONSTASCII_STRINGPARAM("\nResource Stack\n")); while( nDepth > 0 ) { - aStr.Append( "Class: " ); - aStr.Append( ByteString( GetTypeRes_Impl( ResId( rResStack[nDepth].pResource->GetRT(), *pNewResMgr ) ), RTL_TEXTENCODING_UTF8 ) ); - aStr.Append( ", Id: " ); - aStr.Append( ByteString::CreateFromInt32( (long)rResStack[nDepth].pResource->GetId() ) ); + aStr.append(RTL_CONSTASCII_STRINGPARAM("Class: ")); + aStr.append(rtl::OUStringToOString(GetTypeRes_Impl( + ResId(rResStack[nDepth].pResource->GetRT(), *pNewResMgr)), + RTL_TEXTENCODING_UTF8)); + aStr.append(RTL_CONSTASCII_STRINGPARAM(", Id: ")); + aStr.append(static_cast<sal_Int32>( + rResStack[nDepth].pResource->GetId())); nDepth--; } // clean up delete pNewResMgr; - OSL_FAIL( aStr.GetBuffer() ); + OSL_FAIL(aStr.getStr()); } #endif @@ -1207,15 +1214,18 @@ sal_Bool ResMgr::GetResource( const ResId& rId, const Resource* pResObj ) if( pFallbackResMgr ) { pTop->Flags |= RC_FALLBACK_DOWN; - #ifdef DBG_UTIL - ByteString aMess( "found resource " ); - aMess.Append( ByteString::CreateFromInt32( nId ) ); - aMess.Append( " in fallback " ); - aMess.Append( ByteString( OUStringToOString( pFallbackResMgr->GetFileName(), osl_getThreadTextEncoding() ) ) ); - aMess.Append( "\n" ); - RscError_Impl( aMess.GetBuffer(), - this, nRT, nId, aStack, nCurStack-1 ); - #endif +#ifdef DBG_UTIL + rtl::OStringBuffer aMess( + RTL_CONSTASCII_STRINGPARAM("found resource ")); + aMess.append(static_cast<sal_Int32>(nId)); + aMess.append(RTL_CONSTASCII_STRINGPARAM(" in fallback ")); + aMess.append(rtl::OUStringToOString( + pFallbackResMgr->GetFileName(), + osl_getThreadTextEncoding())); + aMess.append('\n'); + RscError_Impl(aMess.getStr(), + this, nRT, nId, aStack, nCurStack-1); +#endif } else { diff --git a/tools/source/ref/errinf.cxx b/tools/source/ref/errinf.cxx index 9ad9b71dcba3..9a3dece87cf9 100644 --- a/tools/source/ref/errinf.cxx +++ b/tools/source/ref/errinf.cxx @@ -34,6 +34,7 @@ #include <tools/debug.hxx> #include <tools/errinf.hxx> #include <tools/string.hxx> +#include <rtl/strbuf.hxx> class ErrorHandler; @@ -429,30 +430,33 @@ sal_Bool SimpleErrorHandler::CreateString( const ErrorInfo *pInfo, String &rStr, sal_uInt16 &) const { sal_uIntPtr nId = pInfo->GetErrorCode(); - ByteString aStr; - aStr="Id "; - aStr+=ByteString::CreateFromInt32(nId); - aStr+=" only handled by SimpleErrorHandler"; - aStr+="\nErrorCode: "; - aStr+=ByteString::CreateFromInt32(nId & ((1L << ERRCODE_CLASS_SHIFT) - 1 )); - aStr+="\nErrorClass: "; - aStr+=ByteString::CreateFromInt32((nId & ERRCODE_CLASS_MASK) >> ERRCODE_CLASS_SHIFT); - aStr+="\nErrorArea: "; - aStr+=ByteString::CreateFromInt32((nId & ERRCODE_ERROR_MASK & - ~((1 << ERRCODE_AREA_SHIFT ) -1 ) ) >> ERRCODE_AREA_SHIFT); + rtl::OStringBuffer aStr(RTL_CONSTASCII_STRINGPARAM("Id ")); + aStr.append(static_cast<sal_Int32>(nId)); + aStr.append(RTL_CONSTASCII_STRINGPARAM( + " only handled by SimpleErrorHandler")); + aStr.append(RTL_CONSTASCII_STRINGPARAM("\nErrorCode: ")); + aStr.append(static_cast<sal_Int32>( + nId & ((1L << ERRCODE_CLASS_SHIFT) - 1 ))); + aStr.append(RTL_CONSTASCII_STRINGPARAM("\nErrorClass: ")); + aStr.append(static_cast<sal_Int32>( + (nId & ERRCODE_CLASS_MASK) >> ERRCODE_CLASS_SHIFT)); + aStr.append(RTL_CONSTASCII_STRINGPARAM("\nErrorArea: ")); + aStr.append(static_cast<sal_Int32>((nId & ERRCODE_ERROR_MASK & + ~((1 << ERRCODE_AREA_SHIFT ) -1 ) ) >> ERRCODE_AREA_SHIFT)); DynamicErrorInfo *pDyn=PTR_CAST(DynamicErrorInfo,pInfo); if(pDyn) { - aStr+="\nDId "; - aStr+=ByteString::CreateFromInt32((sal_uIntPtr)*pDyn); + aStr.append(RTL_CONSTASCII_STRINGPARAM("\nDId ")); + aStr.append(static_cast<sal_Int32>(*pDyn)); } StandardErrorInfo *pStd=PTR_CAST(StandardErrorInfo,pInfo); if(pStd) { - aStr+="\nXId "; - aStr+=ByteString::CreateFromInt32(pStd->GetExtendedErrorCode()); + aStr.append(RTL_CONSTASCII_STRINGPARAM("\nXId ")); + aStr.append(static_cast<sal_Int32>(pStd->GetExtendedErrorCode())); } - rStr = String( aStr, RTL_TEXTENCODING_ASCII_US ); + rStr = rtl::OStringToOUString(aStr.makeStringAndClear(), + RTL_TEXTENCODING_ASCII_US); return sal_True; } diff --git a/tools/source/ref/globname.cxx b/tools/source/ref/globname.cxx index 05c7709931e6..e7f30b9d50df 100644 --- a/tools/source/ref/globname.cxx +++ b/tools/source/ref/globname.cxx @@ -33,6 +33,8 @@ #include <stdio.h> #include <string.h> +#include <rtl/strbuf.hxx> + #include <tools/stream.hxx> #include <tools/globname.hxx> @@ -208,10 +210,10 @@ sal_Bool SvGlobalName::operator < ( const SvGlobalName & rObj ) const else if( Data2_a == Data2_b ) { sal_uInt32 Data1_a; - memcpy(&Data1_a, pImp->szData+4, sizeof(sal_uInt32)); + memcpy(&Data1_a, pImp->szData, sizeof(sal_uInt32)); sal_uInt32 Data1_b; - memcpy(&Data1_b, rObj.pImp->szData+4, sizeof(sal_uInt32)); + memcpy(&Data1_b, rObj.pImp->szData, sizeof(sal_uInt32)); return Data1_a < Data1_b; } @@ -262,8 +264,9 @@ void SvGlobalName::MakeFromMemory( void * pData ) *************************************************************************/ sal_Bool SvGlobalName::MakeId( const String & rIdStr ) { - ByteString aStr( rIdStr, RTL_TEXTENCODING_ASCII_US ); - sal_Char * pStr = (sal_Char *)aStr.GetBuffer(); + rtl::OString aStr(rtl::OUStringToOString(rIdStr, + RTL_TEXTENCODING_ASCII_US)); + const sal_Char *pStr = aStr.getStr(); if( rIdStr.Len() == 36 && '-' == pStr[ 8 ] && '-' == pStr[ 13 ] && '-' == pStr[ 18 ] && '-' == pStr[ 23 ] ) @@ -342,29 +345,29 @@ sal_Bool SvGlobalName::MakeId( const String & rIdStr ) *************************************************************************/ String SvGlobalName::GetctorName() const { - ByteString aRet; + rtl::OStringBuffer aStrBuffer; sal_Char buf[ 20 ]; sal_uInt32 Data1; memcpy(&Data1, pImp->szData, sizeof(sal_uInt32)); sprintf( buf, "0x%8.8" SAL_PRIXUINT32, Data1 ); - aRet += buf; + aStrBuffer.append(buf); sal_uInt16 i; for( i = 4; i < 8; i += 2 ) { - aRet += ','; + aStrBuffer.append(','); sal_uInt16 Data2; memcpy(&Data2, pImp->szData+i, sizeof(sal_uInt16)); sprintf( buf, "0x%4.4X", Data2 ); - aRet += buf; + aStrBuffer.append(buf); } for( i = 8; i < 16; i++ ) { - aRet += ','; + aStrBuffer.append(','); sprintf( buf, "0x%2.2x", pImp->szData[ i ] ); - aRet += buf; + aStrBuffer.append(buf); } - return String( aRet, RTL_TEXTENCODING_ASCII_US ); + return rtl::OStringToOUString(aStrBuffer.makeStringAndClear(), RTL_TEXTENCODING_ASCII_US); } /************************************************************************* @@ -372,35 +375,35 @@ String SvGlobalName::GetctorName() const *************************************************************************/ String SvGlobalName::GetHexName() const { - ByteString aRet; + rtl::OStringBuffer aHexBuffer; sal_Char buf[ 10 ]; sal_uInt32 Data1; memcpy(&Data1, pImp->szData, sizeof(sal_uInt32)); sprintf( buf, "%8.8" SAL_PRIXUINT32, Data1 ); - aRet += buf; - aRet += '-'; + aHexBuffer.append(buf); + aHexBuffer.append('-'); sal_uInt16 i ; for( i = 4; i < 8; i += 2 ) { sal_uInt16 Data2; memcpy(&Data2, pImp->szData+i, sizeof(sal_uInt16)); sprintf( buf, "%4.4X", Data2 ); - aRet += buf; - aRet += '-'; + aHexBuffer.append(buf); + aHexBuffer.append('-'); } for( i = 8; i < 10; i++ ) { sprintf( buf, "%2.2x", pImp->szData[ i ] ); - aRet += buf; + aHexBuffer.append(buf); } - aRet += '-'; + aHexBuffer.append('-'); for( i = 10; i < 16; i++ ) { sprintf( buf, "%2.2x", pImp->szData[ i ] ); - aRet += buf; + aHexBuffer.append(buf); } - return String( aRet, RTL_TEXTENCODING_ASCII_US ); + return rtl::OStringToOUString(aHexBuffer.makeStringAndClear(), RTL_TEXTENCODING_ASCII_US); } /************** SvGlobalNameList ****************************************/ diff --git a/tools/source/ref/pstm.cxx b/tools/source/ref/pstm.cxx index 75781b427c89..51692e966848 100644 --- a/tools/source/ref/pstm.cxx +++ b/tools/source/ref/pstm.cxx @@ -31,6 +31,7 @@ #include <tools/debug.hxx> #include <tools/pstm.hxx> +#include <rtl/strbuf.hxx> #define STOR_NO_OPTIMIZE @@ -152,11 +153,12 @@ SvPersistStream& operator >> ( SvPersistStream & rStm, #ifdef DBG_UTIL if( nObjLen + nObjPos != rStm.Tell() ) { - ByteString aStr( "false list len: read = " ); - aStr += ByteString::CreateFromInt32( (long)(rStm.Tell() - nObjPos) ); - aStr += ", should = "; - aStr += ByteString::CreateFromInt64(nObjLen); - OSL_FAIL( aStr.GetBuffer() ); + rtl::OStringBuffer aStr( + RTL_CONSTASCII_STRINGPARAM("false list len: read = ")); + aStr.append(static_cast<sal_Int64>(rStm.Tell() - nObjPos)); + aStr.append(RTL_CONSTASCII_STRINGPARAM(", should = ")); + aStr.append(static_cast<sal_Int64>(nObjLen)); + OSL_FAIL(aStr.getStr()); } #else (void)nObjLen; @@ -760,10 +762,11 @@ sal_uInt32 SvPersistStream::ReadObj if( !pFunc ) { #ifdef DBG_UTIL - ByteString aStr( "no class with id: " ); - aStr += ByteString::CreateFromInt32( nClassId ); - aStr += " registered"; - DBG_WARNING( aStr.GetBuffer() ); + rtl::OStringBuffer aStr( + RTL_CONSTASCII_STRINGPARAM("no class with id: " )); + aStr.append(static_cast<sal_Int32>(nClassId)); + aStr.append(RTL_CONSTASCII_STRINGPARAM(" registered")); + DBG_WARNING(aStr.getStr()); #else (void)nObjLen; #endif @@ -788,11 +791,12 @@ sal_uInt32 SvPersistStream::ReadObj #ifdef DBG_UTIL if( nObjLen + nObjPos != Tell() ) { - ByteString aStr( "false object len: read = " ); - aStr += ByteString::CreateFromInt32( (long)(Tell() - nObjPos) ); - aStr += ", should = "; - aStr += ByteString::CreateFromInt32( nObjLen ); - OSL_FAIL( aStr.GetBuffer() ); + rtl::OStringBuffer aStr( + RTL_CONSTASCII_STRINGPARAM("false object len: read = ")); + aStr.append(static_cast<sal_Int64>((long)(Tell() - nObjPos))); + aStr.append(RTL_CONSTASCII_STRINGPARAM(", should = ")); + aStr.append(static_cast<sal_Int32>(nObjLen)); + OSL_FAIL(aStr.getStr()); } #endif rpObj->RestoreNoDelete(); diff --git a/tools/source/stream/stream.cxx b/tools/source/stream/stream.cxx index bf0c2f49b24c..2917776e6212 100644 --- a/tools/source/stream/stream.cxx +++ b/tools/source/stream/stream.cxx @@ -43,6 +43,7 @@ #include <tools/solar.h> + #define SWAPNIBBLES(c) \ unsigned char nSwapTmp=c; \ nSwapTmp <<= 4; \ @@ -372,13 +373,6 @@ sal_Size SvStream::GetData( void* pData, sal_Size nSize ) else return 0; } -ErrCode SvStream::SetLockBytes( SvLockBytesRef& rLB ) -{ - xLockBytes = rLB; - RefreshBuffer(); - return ERRCODE_NONE; -} - //======================================================================== sal_Size SvStream::PutData( const void* pData, sal_Size nSize ) @@ -719,6 +713,15 @@ sal_Bool SvStream::ReadLine( ByteString& rStr ) return bEnd; } +sal_Bool SvStream::ReadLine( rtl::OString& rStr ) +{ + ByteString aFoo; + sal_Bool ret; + ret = ReadLine(aFoo); + rStr = aFoo; + return ret; +} + sal_Bool SvStream::ReadUniStringLine( String& rStr ) { sal_Unicode buf[256+1]; @@ -939,14 +942,6 @@ sal_Bool SvStream::WriteLines( const ByteString& rStr ) return (sal_Bool)(nError == SVSTREAM_OK); } -sal_Bool SvStream::WriteUniStringLines( const String& rStr ) -{ - String aStr( rStr ); - aStr.ConvertLineEnd( eLineDelimiter ); - WriteUniStringLine( aStr ); - return nError == SVSTREAM_OK; -} - /************************************************************************* |* |* Stream::WriteUniOrByteChar() @@ -1802,6 +1797,18 @@ sal_Size SvStream::Seek( sal_Size nFilePos ) return nBufFilePos + nBufActualPos; } +//probably not as inefficient as it looks seeing as STREAM_SEEK_TO_END in the +//Seek backends is nomally special cased feel free to make this virtual and add +//good implementations for SvFileStream etc +sal_Size SvStream::remainingSize() +{ + sal_Size nCurr = Tell(); + sal_Size nEnd = Seek(STREAM_SEEK_TO_END); + sal_Size nMaxAvailable = nEnd-nCurr; + Seek(nCurr); + return nMaxAvailable; +} + /************************************************************************* |* |* Stream::Flush() @@ -1824,91 +1831,6 @@ void SvStream::Flush() FlushData(); } - -/************************************************************************* -|* -|* Stream::PutBack() -|* -*************************************************************************/ - -/* - 4 Faelle : - - 1. Datenzeiger steht mitten im Puffer (nBufActualPos >= 1) - 2. Datenzeiger auf Position 0, Puffer ist voll - 3. Datenzeiger auf Position 0, Puffer ist teilweise gefuellt - 4. Datenzeiger auf Position 0, Puffer ist leer -> Fehler! -*/ - -SvStream& SvStream::PutBack( char aCh ) -{ - // wenn kein Buffer oder Zurueckscrollen nicht moeglich -> Fehler - if( !pRWBuf || !nBufActualLen || ( !nBufActualPos && !nBufFilePos ) ) - { - // 4. Fall - SetError( SVSTREAM_GENERALERROR ); - return *this; - } - - // Flush() (Phys. Flushen aber nicht notwendig, deshalb selbst schreiben) - if( bIsConsistent && bIsDirty ) - { - SeekPos( nBufFilePos ); - if( nCryptMask ) - CryptAndWriteBuffer( pRWBuf, nBufActualLen ); - else - PutData( pRWBuf, nBufActualLen ); - bIsDirty = sal_False; - } - bIsConsistent = sal_False; // Puffer enthaelt jetzt TRASH - if( nBufActualPos ) - { - // 1. Fall - nBufActualPos--; - pBufPos--; - *pBufPos = aCh; - nBufFree++; - } - else // Puffer muss verschoben werden - { - // Ist Puffer am Anschlag ? - if( nBufSize == nBufActualLen ) - { - // 2. Fall - memmove( pRWBuf+1, pRWBuf, nBufSize-1 ); - // nBufFree behaelt den Wert! - } - else - { - // 3. Fall -> Puffer vergroessern - memmove( pRWBuf+1, pRWBuf, (sal_uInt16)nBufActualLen ); - nBufActualLen++; - nBufFree++; - } - nBufFilePos--; - *pRWBuf = aCh; - } - eIOMode = STREAM_IO_DONTKNOW; - bIsEof = sal_False; - return *this; -} - -/************************************************************************* -|* -|* Stream::EatWhite() -|* -*************************************************************************/ - -void SvStream::EatWhite() -{ - char aCh; - Read(&aCh, sizeof(char) ); - while( !bIsEof && isspace((int)aCh) ) //( aCh == ' ' || aCh == '\t' ) ) - Read(&aCh, sizeof(char) ); - if( !bIsEof ) // konnte das letzte Char gelesen werden ? - SeekRel( -1L ); -} - /************************************************************************* |* |* Stream::RefreshBuffer() diff --git a/tools/source/stream/strmunx.cxx b/tools/source/stream/strmunx.cxx index 1e8b75c5fe37..9c84eeae54f8 100644 --- a/tools/source/stream/strmunx.cxx +++ b/tools/source/stream/strmunx.cxx @@ -48,6 +48,7 @@ // class FileBase #include <osl/file.hxx> #include <rtl/instance.hxx> +#include <rtl/strbuf.hxx> using namespace osl; @@ -226,7 +227,8 @@ static sal_uInt32 GetSvError( int nErrno ) { EBADF, SVSTREAM_INVALID_HANDLE }, #if defined(RS6000) || defined(ALPHA) || defined(NETBSD) || \ defined(FREEBSD) || defined(MACOSX) || defined(OPENBSD) || \ - defined(__FreeBSD_kernel__) || defined (AIX) || defined(DRAGONFLY) + defined(__FreeBSD_kernel__) || defined (AIX) || defined(DRAGONFLY) || \ + defined(IOS) { EDEADLK, SVSTREAM_LOCKING_VIOLATION }, #else { EDEADLOCK, SVSTREAM_LOCKING_VIOLATION }, @@ -354,11 +356,13 @@ sal_uInt16 SvFileStream::IsA() const sal_Size SvFileStream::GetData( void* pData, sal_Size nSize ) { #ifdef DBG_UTIL - ByteString aTraceStr( "SvFileStream::GetData(): " ); - aTraceStr += ByteString::CreateFromInt64(nSize); - aTraceStr += " Bytes from "; - aTraceStr += ByteString(aFilename, osl_getThreadTextEncoding()); - OSL_TRACE( "%s", aTraceStr.GetBuffer() ); + rtl::OStringBuffer aTraceStr( + RTL_CONSTASCII_STRINGPARAM("SvFileStream::GetData(): ")); + aTraceStr.append(static_cast<sal_Int64>(nSize)); + aTraceStr.append(RTL_CONSTASCII_STRINGPARAM(" Bytes from ")); + aTraceStr.append(rtl::OUStringToOString(aFilename, + osl_getThreadTextEncoding())); + OSL_TRACE("%s", aTraceStr.getStr()); #endif int nRead = 0; @@ -380,11 +384,13 @@ sal_Size SvFileStream::GetData( void* pData, sal_Size nSize ) sal_Size SvFileStream::PutData( const void* pData, sal_Size nSize ) { #ifdef DBG_UTIL - ByteString aTraceStr( "SvFileStrean::PutData: " ); - aTraceStr += ByteString::CreateFromInt64(nSize); - aTraceStr += " Bytes to "; - aTraceStr += ByteString(aFilename, osl_getThreadTextEncoding()); - OSL_TRACE( "%s", aTraceStr.GetBuffer() ); + rtl::OStringBuffer aTraceStr( + RTL_CONSTASCII_STRINGPARAM("SvFileStream::PutData(): ")); + aTraceStr.append(static_cast<sal_Int64>(nSize)); + aTraceStr.append(RTL_CONSTASCII_STRINGPARAM(" Bytes to ")); + aTraceStr.append(rtl::OUStringToOString(aFilename, + osl_getThreadTextEncoding())); + OSL_TRACE("%s", aTraceStr.getStr()); #endif int nWrite = 0; diff --git a/tools/source/string/strcvt.cxx b/tools/source/string/strcvt.cxx index 54169c3c0716..c7519bdc6df5 100644 --- a/tools/source/string/strcvt.cxx +++ b/tools/source/string/strcvt.cxx @@ -169,61 +169,6 @@ struct Impl1ByteConvertTabData Impl1ByteConvertTabData* mpNext; }; -// ======================================================================= - -sal_Unicode* ImplGet1ByteUnicodeTab( rtl_TextEncoding eTextEncoding ) -{ -#ifndef BOOTSTRAP - TOOLSINDATA* pToolsData = ImplGetToolsInData(); -#else - TOOLSINDATA* pToolsData = 0x0; -#endif - Impl1ByteUnicodeTabData* pTab = pToolsData->mpFirstUniTabData; - - while ( pTab ) - { - if ( pTab->meTextEncoding == eTextEncoding ) - return pTab->maUniTab; - pTab = pTab->mpNext; - } - - // get TextEncodingInfo - rtl_TextEncodingInfo aTextEncInfo; - aTextEncInfo.StructSize = sizeof( aTextEncInfo ); - rtl_getTextEncodingInfo( eTextEncoding, &aTextEncInfo ); - - if ( aTextEncInfo.MaximumCharSize == 1 ) - { - pTab = new Impl1ByteUnicodeTabData; - pTab->meTextEncoding = eTextEncoding; - pTab->mpNext = pToolsData->mpFirstUniTabData; - - rtl_TextToUnicodeConverter hConverter; - sal_uInt32 nInfo; - sal_Size nSrcBytes; - sal_Size nDestChars; - hConverter = rtl_createTextToUnicodeConverter( eTextEncoding ); - nDestChars = rtl_convertTextToUnicode( hConverter, 0, - (const sal_Char*)aImplByteTab, 256, - pTab->maUniTab, 256, - RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_MAPTOPRIVATE | - RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_DEFAULT | - RTL_TEXTTOUNICODE_FLAGS_INVALID_DEFAULT, - &nInfo, &nSrcBytes ); - rtl_destroyTextToUnicodeConverter( hConverter ); - - if ( (nSrcBytes != 256) || (nDestChars != 256) ) - delete pTab; - else - { - pToolsData->mpFirstUniTabData = pTab; - return pTab->maUniTab; - } - } - - return NULL; -} - // ----------------------------------------------------------------------- static sal_uChar* ImplGet1ByteConvertTab( rtl_TextEncoding eSrcTextEncoding, diff --git a/tools/source/string/strimp.cxx b/tools/source/string/strimp.cxx index 21065f999958..2f79410a9c19 100644 --- a/tools/source/string/strimp.cxx +++ b/tools/source/string/strimp.cxx @@ -691,52 +691,6 @@ STRING& STRING::Insert( const STRING& rStr, xub_StrLen nIndex ) // ----------------------------------------------------------------------- -STRING& STRING::Insert( const STRING& rStr, xub_StrLen nPos, xub_StrLen nLen, - xub_StrLen nIndex ) -{ - DBG_CHKTHIS( STRING, DBGCHECKSTRING ); - DBG_CHKOBJ( &rStr, STRING, DBGCHECKSTRING ); - - // Stringlaenge ermitteln - if ( nPos > rStr.mpData->mnLen ) - nLen = 0; - else - { - // Laenge korrigieren, wenn noetig - sal_Int32 nMaxLen = rStr.mpData->mnLen-nPos; - if ( nLen > nMaxLen ) - nLen = static_cast< xub_StrLen >(nMaxLen); - } - - // Ueberlauf abfangen - sal_Int32 nCopyLen = ImplGetCopyLen( mpData->mnLen, nLen ); - - // Ist der einzufuegende String ein Leerstring - if ( !nCopyLen ) - return *this; - - // Index groesser als Laenge - if ( nIndex > mpData->mnLen ) - nIndex = static_cast< xub_StrLen >(mpData->mnLen); - - // Neue Laenge ermitteln und neuen String anlegen - STRINGDATA* pNewData = ImplAllocData( mpData->mnLen+nCopyLen ); - - // String kopieren - memcpy( pNewData->maStr, mpData->maStr, nIndex*sizeof( STRCODE ) ); - memcpy( pNewData->maStr+nIndex, rStr.mpData->maStr+nPos, nCopyLen*sizeof( STRCODE ) ); - memcpy( pNewData->maStr+nIndex+nCopyLen, mpData->maStr+nIndex, - (mpData->mnLen-nIndex)*sizeof( STRCODE ) ); - - // Alte Daten loeschen und Neue zuweisen - STRING_RELEASE((STRING_TYPE *)mpData); - mpData = pNewData; - - return *this; -} - -// ----------------------------------------------------------------------- - STRING& STRING::Insert( const STRCODE* pCharStr, xub_StrLen nIndex ) { DBG_CHKTHIS( STRING, DBGCHECKSTRING ); @@ -1061,30 +1015,6 @@ STRING& STRING::EraseAllChars( STRCODE c ) // ----------------------------------------------------------------------- -STRING& STRING::Reverse() -{ - DBG_CHKTHIS( STRING, DBGCHECKSTRING ); - - if ( !mpData->mnLen ) - return *this; - - // Daten kopieren, wenn noetig - ImplCopyData(); - - // Reverse - sal_Int32 nCount = mpData->mnLen / 2; - for ( sal_Int32 i = 0; i < nCount; ++i ) - { - STRCODE cTemp = mpData->maStr[i]; - mpData->maStr[i] = mpData->maStr[mpData->mnLen-i-1]; - mpData->maStr[mpData->mnLen-i-1] = cTemp; - } - - return *this; -} - -// ----------------------------------------------------------------------- - STRING& STRING::ToLowerAscii() { DBG_CHKTHIS( STRING, DBGCHECKSTRING ); @@ -1279,36 +1209,6 @@ StringCompare STRING::CompareTo( const STRCODE* pCharStr, xub_StrLen nLen ) cons // ----------------------------------------------------------------------- -StringCompare STRING::CompareIgnoreCaseToAscii( const STRING& rStr, - xub_StrLen nLen ) const -{ - DBG_CHKTHIS( STRING, DBGCHECKSTRING ); - DBG_CHKOBJ( &rStr, STRING, DBGCHECKSTRING ); - - // Auf Gleichheit der Pointer testen - if ( mpData == rStr.mpData ) - return COMPARE_EQUAL; - - // Maximale Laenge ermitteln - if ( mpData->mnLen < nLen ) - nLen = static_cast< xub_StrLen >(mpData->mnLen+1); - if ( rStr.mpData->mnLen < nLen ) - nLen = static_cast< xub_StrLen >(rStr.mpData->mnLen+1); - - // String vergleichen - sal_Int32 nCompare = ImplStringICompareWithoutZero( mpData->maStr, rStr.mpData->maStr, nLen ); - - // Rueckgabewert anpassen - if ( nCompare == 0 ) - return COMPARE_EQUAL; - else if ( nCompare < 0 ) - return COMPARE_LESS; - else - return COMPARE_GREATER; -} - -// ----------------------------------------------------------------------- - StringCompare STRING::CompareIgnoreCaseToAscii( const STRCODE* pCharStr, xub_StrLen nLen ) const { @@ -1419,41 +1319,6 @@ sal_Bool STRING::Equals( const STRCODE* pCharStr, xub_StrLen nIndex, xub_StrLen // ----------------------------------------------------------------------- -sal_Bool STRING::EqualsIgnoreCaseAscii( const STRING& rStr, xub_StrLen nIndex, xub_StrLen nLen ) const -{ - DBG_CHKTHIS( STRING, DBGCHECKSTRING ); - DBG_CHKOBJ( &rStr, STRING, DBGCHECKSTRING ); - - // Are there enough codes for comparing? - if ( nIndex > mpData->mnLen ) - return (rStr.mpData->mnLen == 0); - sal_Int32 nMaxLen = mpData->mnLen-nIndex; - if ( nMaxLen < nLen ) - { - if ( rStr.mpData->mnLen != nMaxLen ) - return sal_False; - nLen = static_cast< xub_StrLen >(nMaxLen); - } - - // String vergleichen - return (ImplStringICompareWithoutZero( mpData->maStr+nIndex, rStr.mpData->maStr, nLen ) == 0); -} - -// ----------------------------------------------------------------------- - -sal_Bool STRING::EqualsIgnoreCaseAscii( const STRCODE* pCharStr, xub_StrLen nIndex, xub_StrLen nLen ) const -{ - DBG_CHKTHIS( STRING, DBGCHECKSTRING ); - - // Are there enough codes for comparing? - if ( nIndex > mpData->mnLen ) - return (*pCharStr == 0); - - return (ImplStringICompare( mpData->maStr+nIndex, pCharStr, nLen ) == 0); -} - -// ----------------------------------------------------------------------- - xub_StrLen STRING::Match( const STRING& rStr ) const { DBG_CHKTHIS( STRING, DBGCHECKSTRING ); @@ -1482,32 +1347,6 @@ xub_StrLen STRING::Match( const STRING& rStr ) const // ----------------------------------------------------------------------- -xub_StrLen STRING::Match( const STRCODE* pCharStr ) const -{ - DBG_CHKTHIS( STRING, DBGCHECKSTRING ); - - // Ist dieser String leer - if ( !mpData->mnLen ) - return STRING_MATCH; - - // Suche bis Stringende nach dem ersten nicht uebereinstimmenden Zeichen - const STRCODE* pStr = mpData->maStr; - xub_StrLen i = 0; - while ( i < mpData->mnLen ) - { - // Stimmt das Zeichen nicht ueberein, dann abbrechen - if ( *pStr != *pCharStr ) - return i; - ++pStr, - ++pCharStr, - ++i; - } - - return STRING_MATCH; -} - -// ----------------------------------------------------------------------- - xub_StrLen STRING::Search( STRCODE c, xub_StrLen nIndex ) const { DBG_CHKTHIS( STRING, DBGCHECKSTRING ); @@ -1642,86 +1481,6 @@ xub_StrLen STRING::SearchBackward( STRCODE c, xub_StrLen nIndex ) const // ----------------------------------------------------------------------- -xub_StrLen STRING::SearchChar( const STRCODE* pChars, xub_StrLen nIndex ) const -{ - DBG_CHKTHIS( STRING, DBGCHECKSTRING ); - - sal_Int32 nLen = mpData->mnLen; - const STRCODE* pStr = mpData->maStr; - pStr += nIndex; - while ( nIndex < nLen ) - { - STRCODE c = *pStr; - const STRCODE* pCompStr = pChars; - while ( *pCompStr ) - { - if ( *pCompStr == c ) - return nIndex; - ++pCompStr; - } - ++pStr, - ++nIndex; - } - - return STRING_NOTFOUND; -} - -// ----------------------------------------------------------------------- - -xub_StrLen STRING::SearchCharBackward( const STRCODE* pChars, xub_StrLen nIndex ) const -{ - DBG_CHKTHIS( STRING, DBGCHECKSTRING ); - - if ( nIndex > mpData->mnLen ) - nIndex = (xub_StrLen)mpData->mnLen; - - const STRCODE* pStr = mpData->maStr; - pStr += nIndex; - - while ( nIndex ) - { - nIndex--; - pStr--; - - STRCODE c =*pStr; - const STRCODE* pCompStr = pChars; - while ( *pCompStr ) - { - if ( *pCompStr == c ) - return nIndex; - ++pCompStr; - } - } - - return STRING_NOTFOUND; -} - -// ----------------------------------------------------------------------- - -xub_StrLen STRING::SearchAndReplace( STRCODE c, STRCODE cRep, xub_StrLen nIndex ) -{ - DBG_CHKTHIS( STRING, DBGCHECKSTRING ); - - sal_Int32 nLen = mpData->mnLen; - const STRCODE* pStr = mpData->maStr; - pStr += nIndex; - while ( nIndex < nLen ) - { - if ( *pStr == c ) - { - ImplCopyData(); - mpData->maStr[nIndex] = cRep; - return nIndex; - } - ++pStr, - ++nIndex; - } - - return STRING_NOTFOUND; -} - -// ----------------------------------------------------------------------- - xub_StrLen STRING::SearchAndReplace( const STRING& rStr, const STRING& rRepStr, xub_StrLen nIndex ) { @@ -1923,141 +1682,6 @@ STRING STRING::GetToken( xub_StrLen nToken, STRCODE cTok, xub_StrLen& rIndex ) c // ----------------------------------------------------------------------- -xub_StrLen STRING::GetQuotedTokenCount( const STRING& rQuotedPairs, STRCODE cTok ) const -{ - DBG_CHKTHIS( STRING, DBGCHECKSTRING ); - DBG_CHKOBJ( &rQuotedPairs, STRING, DBGCHECKSTRING ); - DBG_ASSERT( !(rQuotedPairs.Len()%2), "String::GetQuotedTokenCount() - QuotedString%2 != 0" ); - DBG_ASSERT( rQuotedPairs.Search(cTok) == STRING_NOTFOUND, "String::GetQuotedTokenCount() - cTok in QuotedString" ); - - // Leerer String: TokenCount per Definition 0 - if ( !mpData->mnLen ) - return 0; - - xub_StrLen nTokCount = 1; - sal_Int32 nLen = mpData->mnLen; - xub_StrLen nQuotedLen = rQuotedPairs.Len(); - STRCODE cQuotedEndChar = 0; - const STRCODE* pQuotedStr = rQuotedPairs.mpData->maStr; - const STRCODE* pStr = mpData->maStr; - sal_Int32 nIndex = 0; - while ( nIndex < nLen ) - { - STRCODE c = *pStr; - if ( cQuotedEndChar ) - { - // Ende des Quotes erreicht ? - if ( c == cQuotedEndChar ) - cQuotedEndChar = 0; - } - else - { - // Ist das Zeichen ein Quote-Anfang-Zeichen ? - xub_StrLen nQuoteIndex = 0; - while ( nQuoteIndex < nQuotedLen ) - { - if ( pQuotedStr[nQuoteIndex] == c ) - { - cQuotedEndChar = pQuotedStr[nQuoteIndex+1]; - break; - } - else - nQuoteIndex += 2; - } - - // Stimmt das Tokenzeichen ueberein, dann erhoehe TokCount - if ( c == cTok ) - ++nTokCount; - } - - ++pStr, - ++nIndex; - } - - return nTokCount; -} - -// ----------------------------------------------------------------------- - -STRING STRING::GetQuotedToken( xub_StrLen nToken, const STRING& rQuotedPairs, - STRCODE cTok, xub_StrLen& rIndex ) const -{ - DBG_CHKTHIS( STRING, DBGCHECKSTRING ); - DBG_CHKOBJ( &rQuotedPairs, STRING, DBGCHECKSTRING ); - DBG_ASSERT( !(rQuotedPairs.Len()%2), "String::GetQuotedToken() - QuotedString%2 != 0" ); - DBG_ASSERT( rQuotedPairs.Search(cTok) == STRING_NOTFOUND, "String::GetQuotedToken() - cTok in QuotedString" ); - - const STRCODE* pStr = mpData->maStr; - const STRCODE* pQuotedStr = rQuotedPairs.mpData->maStr; - STRCODE cQuotedEndChar = 0; - xub_StrLen nQuotedLen = rQuotedPairs.Len(); - xub_StrLen nLen = (xub_StrLen)mpData->mnLen; - xub_StrLen nTok = 0; - xub_StrLen nFirstChar = rIndex; - xub_StrLen i = nFirstChar; - - // Bestimme die Token-Position und Laenge - pStr += i; - while ( i < nLen ) - { - STRCODE c = *pStr; - if ( cQuotedEndChar ) - { - // Ende des Quotes erreicht ? - if ( c == cQuotedEndChar ) - cQuotedEndChar = 0; - } - else - { - // Ist das Zeichen ein Quote-Anfang-Zeichen ? - xub_StrLen nQuoteIndex = 0; - while ( nQuoteIndex < nQuotedLen ) - { - if ( pQuotedStr[nQuoteIndex] == c ) - { - cQuotedEndChar = pQuotedStr[nQuoteIndex+1]; - break; - } - else - nQuoteIndex += 2; - } - - // Stimmt das Tokenzeichen ueberein, dann erhoehe TokCount - if ( c == cTok ) - { - ++nTok; - - if ( nTok == nToken ) - nFirstChar = i+1; - else - { - if ( nTok > nToken ) - break; - } - } - } - - ++pStr, - ++i; - } - - if ( nTok >= nToken ) - { - if ( i < nLen ) - rIndex = i+1; - else - rIndex = STRING_NOTFOUND; - return Copy( nFirstChar, i-nFirstChar ); - } - else - { - rIndex = STRING_NOTFOUND; - return STRING(); - } -} - -// ----------------------------------------------------------------------- - STRCODE* STRING::GetBufferAccess() { DBG_CHKTHIS( STRING, DBGCHECKSTRING ); diff --git a/tools/source/string/tstring.cxx b/tools/source/string/tstring.cxx index c7a5f380fb72..b89a51ba7cdc 100644 --- a/tools/source/string/tstring.cxx +++ b/tools/source/string/tstring.cxx @@ -38,7 +38,6 @@ #include <rtl/alloc.h> #include <rtl/memory.h> #include <rtl/tencinfo.h> -#include <rtl/instance.hxx> #include <tools/string.hxx> #include <impstrg.hxx> @@ -104,45 +103,6 @@ ByteString ByteString::CreateFromInt32( sal_Int32 n, sal_Int16 nRadix ) // ----------------------------------------------------------------------- -ByteString ByteString::CreateFromInt64( sal_Int64 n, sal_Int16 nRadix ) -{ - sal_Char aBuf[RTL_STR_MAX_VALUEOFINT64]; - BOOST_STATIC_ASSERT(RTL_STR_MAX_VALUEOFINT64 <= STRING_MAXLEN); - return ByteString( - aBuf, - static_cast< xub_StrLen >(rtl_str_valueOfInt64( aBuf, n, nRadix )) ); -} - -// ----------------------------------------------------------------------- - -ByteString ByteString::CreateFromFloat( float f ) -{ - sal_Char aBuf[RTL_STR_MAX_VALUEOFFLOAT]; - BOOST_STATIC_ASSERT(RTL_STR_MAX_VALUEOFFLOAT <= STRING_MAXLEN); - return ByteString( - aBuf, static_cast< xub_StrLen >(rtl_str_valueOfFloat( aBuf, f )) ); -} - -// ----------------------------------------------------------------------- - -ByteString ByteString::CreateFromDouble( double d ) -{ - sal_Char aBuf[RTL_STR_MAX_VALUEOFDOUBLE]; - BOOST_STATIC_ASSERT(RTL_STR_MAX_VALUEOFDOUBLE <= STRING_MAXLEN); - return ByteString( - aBuf, static_cast< xub_StrLen >(rtl_str_valueOfDouble( aBuf, d )) ); -} - -// ----------------------------------------------------------------------- - -namespace { struct Empty : public rtl::Static< const ByteString, Empty> {}; } -const ByteString& ByteString::EmptyString() -{ - return Empty::get(); -} - -// ----------------------------------------------------------------------- - sal_Int32 ByteString::ToInt32() const { DBG_CHKTHIS( ByteString, DbgCheckByteString ); @@ -161,26 +121,6 @@ sal_Int64 ByteString::ToInt64() const // ----------------------------------------------------------------------- -float ByteString::ToFloat() const -{ - DBG_CHKTHIS( ByteString, DbgCheckByteString ); - - OSL_FAIL("ByteString::ToFloat unusable"); - return 0; -} - -// ----------------------------------------------------------------------- - -double ByteString::ToDouble() const -{ - DBG_CHKTHIS( ByteString, DbgCheckByteString ); - - OSL_FAIL("ByteString::ToDouble unusable"); - return 0; -} - -// ----------------------------------------------------------------------- - sal_Bool ByteString::IsLowerAscii() const { DBG_CHKTHIS( ByteString, DbgCheckByteString ); diff --git a/tools/source/string/tustring.cxx b/tools/source/string/tustring.cxx index 5edd160b5d69..9ef026f6cce8 100644 --- a/tools/source/string/tustring.cxx +++ b/tools/source/string/tustring.cxx @@ -155,4 +155,350 @@ double UniString::ToDouble() const return rtl_ustr_toDouble( mpData->maStr ); } +// ----------------------------------------------------------------------- + +xub_StrLen STRING::SearchChar( const STRCODE* pChars, xub_StrLen nIndex ) const +{ + DBG_CHKTHIS( STRING, DBGCHECKSTRING ); + + sal_Int32 nLen = mpData->mnLen; + const STRCODE* pStr = mpData->maStr; + pStr += nIndex; + while ( nIndex < nLen ) + { + STRCODE c = *pStr; + const STRCODE* pCompStr = pChars; + while ( *pCompStr ) + { + if ( *pCompStr == c ) + return nIndex; + ++pCompStr; + } + ++pStr, + ++nIndex; + } + + return STRING_NOTFOUND; +} + +// ----------------------------------------------------------------------- + +xub_StrLen STRING::SearchAndReplace( STRCODE c, STRCODE cRep, xub_StrLen nIndex ) +{ + DBG_CHKTHIS( STRING, DBGCHECKSTRING ); + + sal_Int32 nLen = mpData->mnLen; + const STRCODE* pStr = mpData->maStr; + pStr += nIndex; + while ( nIndex < nLen ) + { + if ( *pStr == c ) + { + ImplCopyData(); + mpData->maStr[nIndex] = cRep; + return nIndex; + } + ++pStr, + ++nIndex; + } + + return STRING_NOTFOUND; +} + +// ----------------------------------------------------------------------- + +STRING& STRING::Reverse() +{ + DBG_CHKTHIS( STRING, DBGCHECKSTRING ); + + if ( !mpData->mnLen ) + return *this; + + // Daten kopieren, wenn noetig + ImplCopyData(); + + // Reverse + sal_Int32 nCount = mpData->mnLen / 2; + for ( sal_Int32 i = 0; i < nCount; ++i ) + { + STRCODE cTemp = mpData->maStr[i]; + mpData->maStr[i] = mpData->maStr[mpData->mnLen-i-1]; + mpData->maStr[mpData->mnLen-i-1] = cTemp; + } + + return *this; +} + +// ----------------------------------------------------------------------- + +xub_StrLen STRING::Match( const STRCODE* pCharStr ) const +{ + DBG_CHKTHIS( STRING, DBGCHECKSTRING ); + + // Ist dieser String leer + if ( !mpData->mnLen ) + return STRING_MATCH; + + // Suche bis Stringende nach dem ersten nicht uebereinstimmenden Zeichen + const STRCODE* pStr = mpData->maStr; + xub_StrLen i = 0; + while ( i < mpData->mnLen ) + { + // Stimmt das Zeichen nicht ueberein, dann abbrechen + if ( *pStr != *pCharStr ) + return i; + ++pStr, + ++pCharStr, + ++i; + } + + return STRING_MATCH; +} + +// ----------------------------------------------------------------------- + +STRING& STRING::Insert( const STRING& rStr, xub_StrLen nPos, xub_StrLen nLen, + xub_StrLen nIndex ) +{ + DBG_CHKTHIS( STRING, DBGCHECKSTRING ); + DBG_CHKOBJ( &rStr, STRING, DBGCHECKSTRING ); + + // Stringlaenge ermitteln + if ( nPos > rStr.mpData->mnLen ) + nLen = 0; + else + { + // Laenge korrigieren, wenn noetig + sal_Int32 nMaxLen = rStr.mpData->mnLen-nPos; + if ( nLen > nMaxLen ) + nLen = static_cast< xub_StrLen >(nMaxLen); + } + + // Ueberlauf abfangen + sal_Int32 nCopyLen = ImplGetCopyLen( mpData->mnLen, nLen ); + + // Ist der einzufuegende String ein Leerstring + if ( !nCopyLen ) + return *this; + + // Index groesser als Laenge + if ( nIndex > mpData->mnLen ) + nIndex = static_cast< xub_StrLen >(mpData->mnLen); + + // Neue Laenge ermitteln und neuen String anlegen + STRINGDATA* pNewData = ImplAllocData( mpData->mnLen+nCopyLen ); + + // String kopieren + memcpy( pNewData->maStr, mpData->maStr, nIndex*sizeof( STRCODE ) ); + memcpy( pNewData->maStr+nIndex, rStr.mpData->maStr+nPos, nCopyLen*sizeof( STRCODE ) ); + memcpy( pNewData->maStr+nIndex+nCopyLen, mpData->maStr+nIndex, + (mpData->mnLen-nIndex)*sizeof( STRCODE ) ); + + // Alte Daten loeschen und Neue zuweisen + STRING_RELEASE((STRING_TYPE *)mpData); + mpData = pNewData; + + return *this; +} + +// ----------------------------------------------------------------------- + +xub_StrLen STRING::GetQuotedTokenCount( const STRING& rQuotedPairs, STRCODE cTok ) const +{ + DBG_CHKTHIS( STRING, DBGCHECKSTRING ); + DBG_CHKOBJ( &rQuotedPairs, STRING, DBGCHECKSTRING ); + DBG_ASSERT( !(rQuotedPairs.Len()%2), "String::GetQuotedTokenCount() - QuotedString%2 != 0" ); + DBG_ASSERT( rQuotedPairs.Search(cTok) == STRING_NOTFOUND, "String::GetQuotedTokenCount() - cTok in QuotedString" ); + + // Leerer String: TokenCount per Definition 0 + if ( !mpData->mnLen ) + return 0; + + xub_StrLen nTokCount = 1; + sal_Int32 nLen = mpData->mnLen; + xub_StrLen nQuotedLen = rQuotedPairs.Len(); + STRCODE cQuotedEndChar = 0; + const STRCODE* pQuotedStr = rQuotedPairs.mpData->maStr; + const STRCODE* pStr = mpData->maStr; + sal_Int32 nIndex = 0; + while ( nIndex < nLen ) + { + STRCODE c = *pStr; + if ( cQuotedEndChar ) + { + // Ende des Quotes erreicht ? + if ( c == cQuotedEndChar ) + cQuotedEndChar = 0; + } + else + { + // Ist das Zeichen ein Quote-Anfang-Zeichen ? + xub_StrLen nQuoteIndex = 0; + while ( nQuoteIndex < nQuotedLen ) + { + if ( pQuotedStr[nQuoteIndex] == c ) + { + cQuotedEndChar = pQuotedStr[nQuoteIndex+1]; + break; + } + else + nQuoteIndex += 2; + } + + // Stimmt das Tokenzeichen ueberein, dann erhoehe TokCount + if ( c == cTok ) + ++nTokCount; + } + + ++pStr, + ++nIndex; + } + + return nTokCount; +} + +// ----------------------------------------------------------------------- + +STRING STRING::GetQuotedToken( xub_StrLen nToken, const STRING& rQuotedPairs, + STRCODE cTok, xub_StrLen& rIndex ) const +{ + DBG_CHKTHIS( STRING, DBGCHECKSTRING ); + DBG_CHKOBJ( &rQuotedPairs, STRING, DBGCHECKSTRING ); + DBG_ASSERT( !(rQuotedPairs.Len()%2), "String::GetQuotedToken() - QuotedString%2 != 0" ); + DBG_ASSERT( rQuotedPairs.Search(cTok) == STRING_NOTFOUND, "String::GetQuotedToken() - cTok in QuotedString" ); + + const STRCODE* pStr = mpData->maStr; + const STRCODE* pQuotedStr = rQuotedPairs.mpData->maStr; + STRCODE cQuotedEndChar = 0; + xub_StrLen nQuotedLen = rQuotedPairs.Len(); + xub_StrLen nLen = (xub_StrLen)mpData->mnLen; + xub_StrLen nTok = 0; + xub_StrLen nFirstChar = rIndex; + xub_StrLen i = nFirstChar; + + // Bestimme die Token-Position und Laenge + pStr += i; + while ( i < nLen ) + { + STRCODE c = *pStr; + if ( cQuotedEndChar ) + { + // Ende des Quotes erreicht ? + if ( c == cQuotedEndChar ) + cQuotedEndChar = 0; + } + else + { + // Ist das Zeichen ein Quote-Anfang-Zeichen ? + xub_StrLen nQuoteIndex = 0; + while ( nQuoteIndex < nQuotedLen ) + { + if ( pQuotedStr[nQuoteIndex] == c ) + { + cQuotedEndChar = pQuotedStr[nQuoteIndex+1]; + break; + } + else + nQuoteIndex += 2; + } + + // Stimmt das Tokenzeichen ueberein, dann erhoehe TokCount + if ( c == cTok ) + { + ++nTok; + + if ( nTok == nToken ) + nFirstChar = i+1; + else + { + if ( nTok > nToken ) + break; + } + } + } + + ++pStr, + ++i; + } + + if ( nTok >= nToken ) + { + if ( i < nLen ) + rIndex = i+1; + else + rIndex = STRING_NOTFOUND; + return Copy( nFirstChar, i-nFirstChar ); + } + else + { + rIndex = STRING_NOTFOUND; + return STRING(); + } +} + +// ----------------------------------------------------------------------- + +sal_Bool STRING::EqualsIgnoreCaseAscii( const STRING& rStr, xub_StrLen nIndex, xub_StrLen nLen ) const +{ + DBG_CHKTHIS( STRING, DBGCHECKSTRING ); + DBG_CHKOBJ( &rStr, STRING, DBGCHECKSTRING ); + + // Are there enough codes for comparing? + if ( nIndex > mpData->mnLen ) + return (rStr.mpData->mnLen == 0); + sal_Int32 nMaxLen = mpData->mnLen-nIndex; + if ( nMaxLen < nLen ) + { + if ( rStr.mpData->mnLen != nMaxLen ) + return sal_False; + nLen = static_cast< xub_StrLen >(nMaxLen); + } + + // String vergleichen + return (ImplStringICompareWithoutZero( mpData->maStr+nIndex, rStr.mpData->maStr, nLen ) == 0); +} + +// ----------------------------------------------------------------------- + +sal_Bool STRING::EqualsIgnoreCaseAscii( const STRCODE* pCharStr, xub_StrLen nIndex, xub_StrLen nLen ) const +{ + DBG_CHKTHIS( STRING, DBGCHECKSTRING ); + + // Are there enough codes for comparing? + if ( nIndex > mpData->mnLen ) + return (*pCharStr == 0); + + return (ImplStringICompare( mpData->maStr+nIndex, pCharStr, nLen ) == 0); +} + +// ----------------------------------------------------------------------- + +StringCompare STRING::CompareIgnoreCaseToAscii( const STRING& rStr, + xub_StrLen nLen ) const +{ + DBG_CHKTHIS( STRING, DBGCHECKSTRING ); + DBG_CHKOBJ( &rStr, STRING, DBGCHECKSTRING ); + + // Auf Gleichheit der Pointer testen + if ( mpData == rStr.mpData ) + return COMPARE_EQUAL; + + // Maximale Laenge ermitteln + if ( mpData->mnLen < nLen ) + nLen = static_cast< xub_StrLen >(mpData->mnLen+1); + if ( rStr.mpData->mnLen < nLen ) + nLen = static_cast< xub_StrLen >(rStr.mpData->mnLen+1); + + // String vergleichen + sal_Int32 nCompare = ImplStringICompareWithoutZero( mpData->maStr, rStr.mpData->maStr, nLen ); + + // Rueckgabewert anpassen + if ( nCompare == 0 ) + return COMPARE_EQUAL; + else if ( nCompare < 0 ) + return COMPARE_LESS; + else + return COMPARE_GREATER; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/ucbhelper/prj/build.lst b/ucbhelper/prj/build.lst index 2bc7d164cdff..07a598c4ddb0 100644 --- a/ucbhelper/prj/build.lst +++ b/ucbhelper/prj/build.lst @@ -1,3 +1,3 @@ -uh ucbhelper : offuh sal cppu cppuhelper salhelper NULL +uh ucbhelper : offapi sal cppu cppuhelper salhelper NULL uh ucbhelper\prj nmake - all uh_prj NULL diff --git a/ucbhelper/source/provider/propertyvalueset.cxx b/ucbhelper/source/provider/propertyvalueset.cxx index c6ab550237c1..361a8fd514af 100644 --- a/ucbhelper/source/provider/propertyvalueset.cxx +++ b/ucbhelper/source/provider/propertyvalueset.cxx @@ -221,10 +221,10 @@ class PropertyValues : public PropertyValuesVector {}; m_bWasNull = sal_False; \ } \ } \ - catch ( IllegalArgumentException ) \ + catch (const IllegalArgumentException&) \ { \ } \ - catch ( CannotConvertException ) \ + catch (const CannotConvertException&) \ { \ } \ } \ @@ -881,10 +881,10 @@ void PropertyValueSet::appendPropertySet( if ( aValue.hasValue() ) appendObject( rProp, aValue ); } - catch ( UnknownPropertyException ) + catch (const UnknownPropertyException&) { } - catch ( WrappedTargetException ) + catch (const WrappedTargetException&) { } } @@ -909,10 +909,10 @@ sal_Bool PropertyValueSet::appendPropertySetValue( return sal_True; } } - catch ( UnknownPropertyException ) + catch (const UnknownPropertyException&) { } - catch ( WrappedTargetException ) + catch (const WrappedTargetException&) { } } diff --git a/ucbhelper/workben/myucp/myucp_services.cxx b/ucbhelper/workben/myucp/myucp_services.cxx index 6551ca755a12..c455addd1a22 100644 --- a/ucbhelper/workben/myucp/myucp_services.cxx +++ b/ucbhelper/workben/myucp/myucp_services.cxx @@ -81,13 +81,6 @@ sal_Bool writeInfo( void * pRegistryKey, } //========================================================================= -extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( - const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ ) -{ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} - -//========================================================================= extern "C" sal_Bool SAL_CALL component_writeInfo( void * /*pServiceManager*/, void * pRegistryKey ) { diff --git a/unotools/Library_utl.mk b/unotools/Library_utl.mk index 70647da701ca..75c5ab1f5953 100644 --- a/unotools/Library_utl.mk +++ b/unotools/Library_utl.mk @@ -45,7 +45,6 @@ $(eval $(call gb_Library_set_include,utl,\ $$(INCLUDE) \ -I$(realpath $(SRCDIR)/unotools/inc/pch) \ -I$(OUTDIR)/inc \ - -I$(OUTDIR)/inc/offuh \ )) # add any additional definitions to be set for compilation here @@ -54,6 +53,11 @@ $(eval $(call gb_Library_add_defs,utl,\ -DUNOTOOLS_DLLIMPLEMENTATION \ )) +$(eval $(call gb_Library_add_api,utl,\ + offapi \ + udkapi \ +)) + # add libraries to be linked to utl; again these names need to be given as # specified in Repository.mk $(eval $(call gb_Library_add_linked_libs,utl,\ diff --git a/unotools/inc/unotools/localedatawrapper.hxx b/unotools/inc/unotools/localedatawrapper.hxx index 306316683b94..8ff4e46da058 100644 --- a/unotools/inc/unotools/localedatawrapper.hxx +++ b/unotools/inc/unotools/localedatawrapper.hxx @@ -346,7 +346,7 @@ public: /** Append locale info to string, used with locale data checking. A string similar to "de_DE requested\n en_US loaded" is appended. */ - String& appendLocaleInfo( String& rDebugMsg ) const; + rtl::OUString appendLocaleInfo(const rtl::OUString& rDebugMsg) const; /** Ouput a message during locale data checking. The (UTF-8) string is written to stderr and in a non-product build or if DBG_UTIL is enabled diff --git a/unotools/inc/unotools/regoptions.hxx b/unotools/inc/unotools/regoptions.hxx index e43d61f9ba6b..0303ca300e91 100644 --- a/unotools/inc/unotools/regoptions.hxx +++ b/unotools/inc/unotools/regoptions.hxx @@ -111,12 +111,6 @@ namespace utl <p>If this method is called, the reminder for the dialog will be removed. */ void removeReminder(); - - /** checks if the reminder date has come - - <p>Returns <true/> if the current date is greater or equal the reminder date. - */ - bool hasReminderDateCome() const; }; //........................................................................ diff --git a/unotools/inc/unotools/tempfile.hxx b/unotools/inc/unotools/tempfile.hxx index 3565396dd612..2030b1ab0791 100644 --- a/unotools/inc/unotools/tempfile.hxx +++ b/unotools/inc/unotools/tempfile.hxx @@ -154,7 +154,6 @@ public: It is not a URL because alle URLs must be "UCB compatible", so there may be no suitable URL at all. */ static String SetTempNameBaseDirectory( const String &rBaseName ); - static String GetTempNameBaseDirectory(); }; } diff --git a/unotools/prj/build.lst b/unotools/prj/build.lst index b7883fa2e3dd..8e182910f277 100644 --- a/unotools/prj/build.lst +++ b/unotools/prj/build.lst @@ -1,3 +1,3 @@ -ut unotools : LIBXSLT:libxslt comphelper cppuhelper offuh tools ucbhelper NULL +ut unotools : LIBXSLT:libxslt comphelper cppuhelper offapi tools ucbhelper NULL ut unotools\prj nmake - all ut_prj NULL diff --git a/unotools/source/config/configmgr.cxx b/unotools/source/config/configmgr.cxx index 2ddc11340bc7..4f83a861b416 100644 --- a/unotools/source/config/configmgr.cxx +++ b/unotools/source/config/configmgr.cxx @@ -156,21 +156,23 @@ Reference< XMultiServiceFactory > ConfigManager::GetConfigurationProvider() UNO_QUERY); } #if OSL_DEBUG_LEVEL > 1 - catch(Exception& rEx) - { - static sal_Bool bMessage = sal_True; - if(bMessage) - { - bMessage = sal_False; - OString sMsg("CreateInstance with arguments exception: "); - sMsg += OString(rEx.Message.getStr(), - rEx.Message.getLength(), - RTL_TEXTENCODING_ASCII_US); - OSL_FAIL(sMsg.getStr()); - } - } + catch (const Exception& rEx) + { + static sal_Bool bMessage = sal_True; + if(bMessage) + { + bMessage = sal_False; + OString sMsg("CreateInstance with arguments exception: "); + sMsg += OString(rEx.Message.getStr(), + rEx.Message.getLength(), + RTL_TEXTENCODING_ASCII_US); + OSL_FAIL(sMsg.getStr()); + } + } #else - catch(Exception&){} + catch (const Exception&) + { + } #endif } } @@ -282,7 +284,7 @@ Reference< XHierarchicalNameAccess> ConfigManager::AcquireTree(utl::ConfigItem& OUString::createFromAscii(pAccessSrvc), aArgs); } - catch(Exception& rEx) + catch (const Exception& rEx) { if (CONFIG_MODE_PROPAGATE_ERRORS & rCfgItem.GetMode()) { @@ -489,7 +491,9 @@ Any ConfigManager::GetDirectConfigProperty(ConfigProperty eProp) aArgs); } - catch(Exception&){} + catch (const Exception&) + { + } Reference<XNameAccess> xDirectAccess(xIFace, UNO_QUERY); if(xDirectAccess.is()) { @@ -514,7 +518,7 @@ Any ConfigManager::GetDirectConfigProperty(ConfigProperty eProp) { aRet = xDirectAccess->getByName(sProperty); } - catch(Exception&) + catch (const Exception&) { #if OSL_DEBUG_LEVEL > 0 rtl::OStringBuffer aBuf(256); @@ -619,7 +623,7 @@ Reference< XHierarchicalNameAccess> ConfigManager::GetHierarchyAccess(const OUSt aArgs); } #if OSL_DEBUG_LEVEL > 1 - catch(Exception& rEx) + catch (const Exception& rEx) { OString sMsg("CreateInstance exception: "); sMsg += OString(rEx.Message.getStr(), @@ -628,7 +632,9 @@ Reference< XHierarchicalNameAccess> ConfigManager::GetHierarchyAccess(const OUSt OSL_FAIL(sMsg.getStr()); } #else - catch(Exception&){} + catch (const Exception&) + { + } #endif } return Reference<XHierarchicalNameAccess>(xIFace, UNO_QUERY); @@ -650,7 +656,7 @@ Any ConfigManager::GetLocalProperty(const OUString& rProperty) aRet = xAccess->getByName(sProperty); } #if OSL_DEBUG_LEVEL > 1 - catch(Exception& rEx) + catch (const Exception& rEx) { OString sMsg("GetLocalProperty: "); sMsg += OString(rEx.Message.getStr(), @@ -659,7 +665,9 @@ Any ConfigManager::GetLocalProperty(const OUString& rProperty) OSL_FAIL(sMsg.getStr()); } #else - catch(Exception&){} + catch (const Exception&) + { + } #endif return aRet; } @@ -680,7 +688,7 @@ void ConfigManager::PutLocalProperty(const OUString& rProperty, const Any& rValu xNodeReplace->replaceByName(sProperty, rValue); } #if OSL_DEBUG_LEVEL > 1 - catch(Exception& rEx) + catch (const Exception& rEx) { OString sMsg("PutLocalProperty: "); sMsg += OString(rEx.Message.getStr(), @@ -689,7 +697,9 @@ void ConfigManager::PutLocalProperty(const OUString& rProperty, const Any& rValu OSL_FAIL(sMsg.getStr()); } #else - catch(Exception& ){} + catch (const Exception&) + { + } #endif } } diff --git a/unotools/source/config/fontcfg.cxx b/unotools/source/config/fontcfg.cxx index 46d92d121a66..c97f6fd505a0 100644 --- a/unotools/source/config/fontcfg.cxx +++ b/unotools/source/config/fontcfg.cxx @@ -165,7 +165,7 @@ DefaultFontConfiguration::DefaultFontConfiguration() } } } - catch( Exception& ) + catch (const Exception&) { // configuration is awry m_xConfigProvider.clear(); @@ -173,7 +173,7 @@ DefaultFontConfiguration::DefaultFontConfiguration() } } } - catch( WrappedTargetException& ) + catch (const WrappedTargetException&) { } #if OSL_DEBUG_LEVEL > 1 @@ -214,10 +214,10 @@ OUString DefaultFontConfiguration::tryLocale( const Locale& rLocale, const OUStr it->second.xAccess = xNode; } } - catch( NoSuchElementException ) + catch (const NoSuchElementException&) { } - catch( WrappedTargetException ) + catch (const WrappedTargetException&) { } } @@ -231,10 +231,10 @@ OUString DefaultFontConfiguration::tryLocale( const Locale& rLocale, const OUStr aAny >>= aRet; } } - catch( NoSuchElementException& ) + catch (const NoSuchElementException&) { } - catch( WrappedTargetException& ) + catch (const WrappedTargetException&) { } } @@ -451,7 +451,7 @@ FontSubstConfiguration::FontSubstConfiguration() : } } } - catch( Exception& ) + catch (const Exception&) { // configuration is awry m_xConfigProvider.clear(); @@ -459,7 +459,7 @@ FontSubstConfiguration::FontSubstConfiguration() : } } } - catch( WrappedTargetException& ) + catch (const WrappedTargetException&) { } #if OSL_DEBUG_LEVEL > 1 @@ -994,10 +994,10 @@ void FontSubstConfiguration::fillSubstVector( const com::sun::star::uno::Referen } } } - catch( NoSuchElementException ) + catch (const NoSuchElementException&) { } - catch( WrappedTargetException ) + catch (const WrappedTargetException&) { } } @@ -1025,10 +1025,10 @@ FontWeight FontSubstConfiguration::getSubstWeight( const com::sun::star::uno::Re #endif } } - catch( NoSuchElementException ) + catch (const NoSuchElementException&) { } - catch( WrappedTargetException ) + catch (const WrappedTargetException&) { } return (FontWeight)( weight >= 0 ? pWeightNames[weight].nEnum : WEIGHT_DONTKNOW ); @@ -1057,10 +1057,10 @@ FontWidth FontSubstConfiguration::getSubstWidth( const com::sun::star::uno::Refe #endif } } - catch( NoSuchElementException ) + catch (const NoSuchElementException&) { } - catch( WrappedTargetException ) + catch (const WrappedTargetException&) { } return (FontWidth)( width >= 0 ? pWidthNames[width].nEnum : WIDTH_DONTKNOW ); @@ -1092,10 +1092,10 @@ unsigned long FontSubstConfiguration::getSubstType( const com::sun::star::uno::R } } } - catch( NoSuchElementException ) + catch (const NoSuchElementException&) { } - catch( WrappedTargetException ) + catch (const WrappedTargetException&) { } @@ -1117,10 +1117,10 @@ void FontSubstConfiguration::readLocaleSubst( const com::sun::star::lang::Locale Any aAny = m_xConfigAccess->getByName( it->second.aConfigLocaleString ); aAny >>= xNode; } - catch( NoSuchElementException ) + catch (const NoSuchElementException&) { } - catch( WrappedTargetException ) + catch (const WrappedTargetException&) { } if( xNode.is() ) @@ -1147,10 +1147,10 @@ void FontSubstConfiguration::readLocaleSubst( const com::sun::star::lang::Locale Any aAny = xNode->getByName( pFontNames[i] ); aAny >>= xFont; } - catch( NoSuchElementException ) + catch (const NoSuchElementException&) { } - catch( WrappedTargetException ) + catch (const WrappedTargetException&) { } if( ! xFont.is() ) diff --git a/unotools/source/config/regoptions.cxx b/unotools/source/config/regoptions.cxx index 9b0550a8cdc5..6207c5544429 100644 --- a/unotools/source/config/regoptions.cxx +++ b/unotools/source/config/regoptions.cxx @@ -189,7 +189,6 @@ namespace utl void markSessionDone( ); void activateReminder( sal_Int32 _nDaysFromNow ); void removeReminder(); - bool hasReminderDateCome() const; }; //-------------------------------------------------------------------- @@ -383,48 +382,6 @@ namespace utl } //-------------------------------------------------------------------- - bool RegOptionsImpl::hasReminderDateCome() const - { - bool bRet = false; - sal_Int32 nDate = 0; - ::rtl::OUString sDate; - m_aRegistrationNode.getNodeValue( lcl_getReminderDateName() ) >>= sDate; - if ( sDate.getLength() ) - { - if ( sDate.indexOf( lcl_getPatchName() ) == 0) - { - if (sDate.equals( lcl_getPatchName() )) - bRet = true; - else if (sDate.getLength() > lcl_getPatchName().getLength() ) - { - // Check the build ID to determine if the registration - // dialog needs to be shown. - sal_Int32 nBuildId = getBuildId(); - ::rtl::OUString aStoredBuildId( sDate.copy(lcl_getPatchName().getLength())); - - // remind if the current build ID is not the same as the stored one - if ( nBuildId != aStoredBuildId.toInt32() ) - bRet = true; - } - } - else - { - nDate = lcl_convertString2Date( sDate ); - if ( nDate > 0 ) - { - Date aReminderDate; - aReminderDate.SetDate( nDate ); - bRet = aReminderDate <= Date(); - } - } - } - else - bRet = true; - - return bRet; - } - - //-------------------------------------------------------------------- void RegOptionsImpl::markSessionDone( ) { OSL_ENSURE( !s_bThisSessionDone, "RegOptionsImpl::markSessionDone: already marked!" ); @@ -533,14 +490,6 @@ namespace utl const_cast< RegOptions* >( this )->ensureImpl( ); m_pImpl->removeReminder(); } - - //-------------------------------------------------------------------- - bool RegOptions::hasReminderDateCome() const - { - const_cast< RegOptions* >( this )->ensureImpl( ); - return m_pImpl->hasReminderDateCome(); - } - //........................................................................ } // namespace utl //........................................................................ diff --git a/unotools/source/config/saveopt.cxx b/unotools/source/config/saveopt.cxx index 83aea5d7cc9f..28614e00975c 100644 --- a/unotools/source/config/saveopt.cxx +++ b/unotools/source/config/saveopt.cxx @@ -469,7 +469,6 @@ SvtSaveOptions_Impl::SvtSaveOptions_Impl() { for ( int nProp = 0; nProp < aNames.getLength(); nProp++ ) { - DBG_ASSERT( pValues[nProp].hasValue(), "property value missing" ); if ( pValues[nProp].hasValue() ) { sal_Int32 nTemp = 0; diff --git a/unotools/source/i18n/localedatawrapper.cxx b/unotools/source/i18n/localedatawrapper.cxx index 656453dde274..a8e1dccf0727 100644 --- a/unotools/source/i18n/localedatawrapper.cxx +++ b/unotools/source/i18n/localedatawrapper.cxx @@ -51,6 +51,7 @@ #include <com/sun/star/i18n/NumberFormatIndex.hdl> #include <rtl/instance.hxx> +#include <rtl/ustrbuf.hxx> #include <sal/macros.h> #define LOCALEDATA_LIBRARYNAME "i18npool" @@ -770,7 +771,7 @@ void LocaleDataWrapper::getCurrSymbolsImpl() { if (areChecksEnabled()) { - String aMsg( RTL_CONSTASCII_USTRINGPARAM( + rtl::OUString aMsg( RTL_CONSTASCII_USTRINGPARAM( "LocaleDataWrapper::getCurrSymbolsImpl: no default currency")); outputCheckMessage( appendLocaleInfo( aMsg ) ); } @@ -882,7 +883,7 @@ void LocaleDataWrapper::getCurrFormatsImpl() { // bad luck if (areChecksEnabled()) { - String aMsg( RTL_CONSTASCII_USTRINGPARAM( + rtl::OUString aMsg( RTL_CONSTASCII_USTRINGPARAM( "LocaleDataWrapper::getCurrFormatsImpl: no currency formats")); outputCheckMessage( appendLocaleInfo( aMsg ) ); } @@ -931,7 +932,7 @@ void LocaleDataWrapper::getCurrFormatsImpl() scanCurrFormatImpl( pFormatArr[nElem].Code, 0, nSign, nPar, nNum, nBlank, nSym ); if (areChecksEnabled() && (nNum == STRING_NOTFOUND || nSym == STRING_NOTFOUND)) { - String aMsg( RTL_CONSTASCII_USTRINGPARAM( + rtl::OUString aMsg( RTL_CONSTASCII_USTRINGPARAM( "LocaleDataWrapper::getCurrFormatsImpl: CurrPositiveFormat?")); outputCheckMessage( appendLocaleInfo( aMsg ) ); } @@ -962,7 +963,7 @@ void LocaleDataWrapper::getCurrFormatsImpl() nSym == STRING_NOTFOUND || (nPar == STRING_NOTFOUND && nSign == STRING_NOTFOUND))) { - String aMsg( RTL_CONSTASCII_USTRINGPARAM( + rtl::OUString aMsg( RTL_CONSTASCII_USTRINGPARAM( "LocaleDataWrapper::getCurrFormatsImpl: CurrNegativeFormat?")); outputCheckMessage( appendLocaleInfo( aMsg ) ); } @@ -1098,7 +1099,7 @@ DateFormat LocaleDataWrapper::scanDateFormatImpl( const String& rCode ) { if (areChecksEnabled()) { - String aMsg( RTL_CONSTASCII_USTRINGPARAM( + rtl::OUString aMsg( RTL_CONSTASCII_USTRINGPARAM( "LocaleDataWrapper::scanDateFormat: not all DMY present")); outputCheckMessage( appendLocaleInfo( aMsg ) ); } @@ -1121,7 +1122,7 @@ DateFormat LocaleDataWrapper::scanDateFormatImpl( const String& rCode ) { if (areChecksEnabled()) { - String aMsg( RTL_CONSTASCII_USTRINGPARAM( + rtl::OUString aMsg( RTL_CONSTASCII_USTRINGPARAM( "LocaleDataWrapper::scanDateFormat: no magic applyable")); outputCheckMessage( appendLocaleInfo( aMsg ) ); } @@ -1140,7 +1141,7 @@ void LocaleDataWrapper::getDateFormatsImpl() { // bad luck if (areChecksEnabled()) { - String aMsg( RTL_CONSTASCII_USTRINGPARAM( + rtl::OUString aMsg( RTL_CONSTASCII_USTRINGPARAM( "LocaleDataWrapper::getDateFormatsImpl: no date formats")); outputCheckMessage( appendLocaleInfo( aMsg ) ); } @@ -1185,7 +1186,7 @@ void LocaleDataWrapper::getDateFormatsImpl() { if (areChecksEnabled()) { - String aMsg( RTL_CONSTASCII_USTRINGPARAM( + rtl::OUString aMsg( RTL_CONSTASCII_USTRINGPARAM( "LocaleDataWrapper::getDateFormatsImpl: no edit")); outputCheckMessage( appendLocaleInfo( aMsg ) ); } @@ -1193,7 +1194,7 @@ void LocaleDataWrapper::getDateFormatsImpl() { if (areChecksEnabled()) { - String aMsg( RTL_CONSTASCII_USTRINGPARAM( + rtl::OUString aMsg( RTL_CONSTASCII_USTRINGPARAM( "LocaleDataWrapper::getDateFormatsImpl: no default")); outputCheckMessage( appendLocaleInfo( aMsg ) ); } @@ -1930,20 +1931,21 @@ String LocaleDataWrapper::getCurr( sal_Int64 nNumber, sal_uInt16 nDecimals, } -String& LocaleDataWrapper::appendLocaleInfo( String& rDebugMsg ) const +rtl::OUString LocaleDataWrapper::appendLocaleInfo(const rtl::OUString& rDebugMsg) const { ::utl::ReadWriteGuard aGuard( aMutex, ::utl::ReadWriteGuardMode::nBlockCritical ); - rDebugMsg += '\n'; - rDebugMsg += String( aLocale.Language); - rDebugMsg += '_'; - rDebugMsg += String( aLocale.Country); - rDebugMsg.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " requested\n" ) ); + rtl::OUStringBuffer aDebugMsg(rDebugMsg); + aDebugMsg.append(static_cast<sal_Unicode>('\n')); + aDebugMsg.append(aLocale.Language); + aDebugMsg.append(static_cast<sal_Unicode>('_')); + aDebugMsg.append(aLocale.Country); + aDebugMsg.appendAscii(RTL_CONSTASCII_STRINGPARAM(" requested\n")); lang::Locale aLoaded = getLoadedLocale(); - rDebugMsg += String( aLoaded.Language); - rDebugMsg += '_'; - rDebugMsg += String( aLoaded.Country); - rDebugMsg.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " loaded" ) ); - return rDebugMsg; + aDebugMsg.append(aLoaded.Language); + aDebugMsg.append(static_cast<sal_Unicode>('_')); + aDebugMsg.append(aLoaded.Country); + aDebugMsg.appendAscii(RTL_CONSTASCII_STRINGPARAM(" loaded")); + return aDebugMsg.makeStringAndClear(); } diff --git a/unotools/source/ucbhelper/tempfile.cxx b/unotools/source/ucbhelper/tempfile.cxx index 99f0b85d68b8..33a3ca6fb8f4 100644 --- a/unotools/source/ucbhelper/tempfile.cxx +++ b/unotools/source/ucbhelper/tempfile.cxx @@ -484,18 +484,6 @@ String TempFile::SetTempNameBaseDirectory( const String &rBaseName ) return aTmp; } - -String TempFile::GetTempNameBaseDirectory() -{ - const ::rtl::OUString &rTempNameBase_Impl = TempNameBase_Impl::get(); - if ( !rTempNameBase_Impl.getLength() ) - return String(); - - rtl::OUString aTmp; - FileBase::getSystemPathFromFileURL( rTempNameBase_Impl, aTmp ); - return aTmp; -} - } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/unotools/source/ucbhelper/ucblockbytes.cxx b/unotools/source/ucbhelper/ucblockbytes.cxx index c95608c3faaf..5393cb972813 100644 --- a/unotools/source/ucbhelper/ucblockbytes.cxx +++ b/unotools/source/ucbhelper/ucblockbytes.cxx @@ -696,7 +696,7 @@ Moderator::Result Moderator::getResult(const sal_uInt32 milliSec) // reset m_aResultType = NORESULT; } - catch(const salhelper::ConditionWaiter::timedout&) + catch (const salhelper::ConditionWaiter::timedout&) { ret.type = TIMEDOUT; } @@ -849,24 +849,24 @@ void SAL_CALL Moderator::run() aResult = m_aContent.executeCommand(m_aArg.Name,m_aArg.Argument); aResultType = RESULT; } - catch ( CommandAbortedException ) + catch (const CommandAbortedException&) { aResultType = COMMANDABORTED; } - catch ( CommandFailedException ) + catch (const CommandFailedException&) { aResultType = COMMANDFAILED; } - catch ( InteractiveIOException& r ) + catch (const InteractiveIOException& r) { nIOErrorCode = r.Code; aResultType = INTERACTIVEIO; } - catch ( UnsupportedDataSinkException& ) + catch (const UnsupportedDataSinkException ) { aResultType = UNSUPPORTED; } - catch ( Exception ) + catch (const Exception&) { aResultType = GENERAL; } @@ -950,10 +950,13 @@ static sal_Bool UCBOpenContentSync( bool bResultAchieved(false); Moderator* pMod = 0; - try { + try + { pMod = new Moderator(xContent,xInteract,xProgress,rArg); pMod->create(); - } catch(const ContentCreationException&) { + } + catch (const ContentCreationException&) + { bResultAchieved = bException = true; xLockBytes->SetError( ERRCODE_IO_GENERAL ); } @@ -1180,17 +1183,17 @@ static sal_Bool _UCBOpenContentSync( { aResult = aContent.executeCommand( rArg.Name, rArg.Argument ); } - catch ( CommandAbortedException ) + catch (const CommandAbortedException&) { bAborted = true; xLockBytes->SetError( ERRCODE_ABORT ); } - catch ( CommandFailedException ) + catch (const CommandFailedException&) { bAborted = true; xLockBytes->SetError( ERRCODE_ABORT ); } - catch ( InteractiveIOException& r ) + catch (const InteractiveIOException& r) { bException = true; if ( r.Code == IOErrorCode_ACCESS_DENIED || r.Code == IOErrorCode_LOCKING_VIOLATION ) @@ -1202,12 +1205,12 @@ static sal_Bool _UCBOpenContentSync( else xLockBytes->SetError( ERRCODE_IO_GENERAL ); } - catch ( UnsupportedDataSinkException& ) + catch (const UnsupportedDataSinkException&) { bException = true; xLockBytes->SetError( ERRCODE_IO_NOTSUPPORTED ); } - catch ( Exception ) + catch (const Exception&) { bException = true; xLockBytes->SetError( ERRCODE_IO_GENERAL ); @@ -1262,10 +1265,12 @@ UcbLockBytes::~UcbLockBytes() { m_xInputStream->closeInput(); } - catch ( RuntimeException const & ) - {} - catch ( IOException const & ) - {} + catch (const RuntimeException&) + { + } + catch (const IOException&) + { + } } } @@ -1275,10 +1280,12 @@ UcbLockBytes::~UcbLockBytes() { m_xOutputStream->closeOutput(); } - catch ( RuntimeException const & ) - {} - catch ( IOException const & ) - {} + catch (const RuntimeException&) + { + } + catch (const IOException&) + { + } } } @@ -1352,8 +1359,9 @@ sal_Bool UcbLockBytes::setInputStream_Impl( const Reference<XInputStream> &rxInp bRet = m_xInputStream.is(); } - catch( Exception& ) - {} + catch (const Exception&) + { + } if ( m_bStreamValid && m_xInputStream.is() ) m_aInitialized.set(); @@ -1420,11 +1428,11 @@ ErrCode UcbLockBytes::ReadAt ( sal_uLong nPos, void *pBuffer, sal_uLong nCount, { xSeekable->seek( nPos ); } - catch ( IOException ) + catch (const IOException&) { return ERRCODE_IO_CANTSEEK; } - catch (com::sun::star::lang::IllegalArgumentException) + catch (const com::sun::star::lang::IllegalArgumentException&) { return ERRCODE_IO_CANTSEEK; } @@ -1444,7 +1452,7 @@ ErrCode UcbLockBytes::ReadAt ( sal_uLong nPos, void *pBuffer, sal_uLong nCount, nSize = xStream->readBytes( aData, sal_Int32(nCount) ); } - catch (IOException) + catch (const IOException&) { return ERRCODE_IO_CANTREAD; } @@ -1474,7 +1482,7 @@ ErrCode UcbLockBytes::WriteAt ( sal_uLong nPos, const void *pBuffer, sal_uLong n { xSeekable->seek( nPos ); } - catch ( IOException ) + catch (const IOException&) { return ERRCODE_IO_CANTSEEK; } @@ -1487,7 +1495,7 @@ ErrCode UcbLockBytes::WriteAt ( sal_uLong nPos, const void *pBuffer, sal_uLong n if ( pWritten ) *pWritten = nCount; } - catch ( Exception ) + catch (const Exception&) { return ERRCODE_IO_CANTWRITE; } @@ -1506,7 +1514,7 @@ ErrCode UcbLockBytes::Flush() const { xOutputStream->flush(); } - catch( Exception ) + catch (const Exception&) { return ERRCODE_IO_CANTWRITE; } @@ -1577,7 +1585,7 @@ ErrCode UcbLockBytes::Stat( SvLockBytesStat *pStat, SvLockBytesStatFlag) const { pStat->nSize = sal_uLong(xSeekable->getLength()); } - catch (IOException) + catch (const IOException&) { return ERRCODE_IO_CANTTELL; } diff --git a/unotools/source/ucbhelper/xtempfile.cxx b/unotools/source/ucbhelper/xtempfile.cxx index 7883a3e85cb2..55733702039c 100644 --- a/unotools/source/ucbhelper/xtempfile.cxx +++ b/unotools/source/ucbhelper/xtempfile.cxx @@ -37,10 +37,6 @@ namespace css = com::sun::star; -// copy define from desktop\source\app\appinit.cxx - -#define DESKTOP_TEMPNAMEBASE_DIR "/temp/soffice.tmp" - OTempFileService::OTempFileService(::css::uno::Reference< ::css::uno::XComponentContext > const & context) : ::cppu::PropertySetMixin< ::css::io::XTempFile >( context @@ -484,14 +480,6 @@ throw ( ::css::uno::RuntimeException ) return ::cppu::createSingleComponentFactory( XTempFile_createInstance, getImplementationName_Static(), getSupportedServiceNames_Static() ); } -// C functions to implement this as a component - -extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( - const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ ) -{ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} - /** * This function is called to get service factories for an implementation. * @param pImplName name of implementation @@ -499,7 +487,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnviron * @param pRegistryKey registry data key to read and write component persistent data * @return a component factory (generic uno interface) */ -extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( +extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL utl_component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ ) { void * pRet = 0; diff --git a/unotools/util/utl.component b/unotools/util/utl.component index 8c8198741f55..ab4b67b61da4 100644 --- a/unotools/util/utl.component +++ b/unotools/util/utl.component @@ -26,7 +26,7 @@ * **********************************************************************--> -<component loader="com.sun.star.loader.SharedLibrary" +<component loader="com.sun.star.loader.SharedLibrary" prefix="utl" xmlns="http://openoffice.org/2010/uno-components"> <implementation name="com.sun.star.io.comp.TempFile"> <service name="com.sun.star.io.TempFile"/> diff --git a/vcl/Library_desktop_detector.mk b/vcl/Library_desktop_detector.mk index 8d4654c4e0b6..3673218468aa 100644 --- a/vcl/Library_desktop_detector.mk +++ b/vcl/Library_desktop_detector.mk @@ -36,7 +36,6 @@ $(eval $(call gb_Library_set_include,desktop_detector,\ -I$(realpath $(SRCDIR)/vcl/inc) \ -I$(realpath $(SRCDIR)/vcl/inc/pch) \ -I$(SRCDIR)/solenv/inc \ - -I$(OUTDIR)/inc/offuh \ -I$(OUTDIR)/inc \ )) @@ -44,6 +43,11 @@ $(eval $(call gb_Library_add_defs,desktop_detector,\ -DDESKTOP_DETECTOR_IMPLEMENTATION \ )) +$(eval $(call gb_Library_add_api,desktop_detector,\ + offapi \ + udkapi \ +)) + $(eval $(call gb_Library_add_linked_libs,desktop_detector,\ vcl \ tl \ diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk index fb7ab96aada3..7ca41baa4b62 100644 --- a/vcl/Library_vcl.mk +++ b/vcl/Library_vcl.mk @@ -31,6 +31,10 @@ ifeq ($(OS),MACOSX) $(eval $(call gb_Library_set_componentfile,vcl,vcl/vcl.macosx)) else ifeq ($(OS),WNT) $(eval $(call gb_Library_set_componentfile,vcl,vcl/vcl.windows)) +else ifeq ($(GUIBASE),android) +$(eval $(call gb_Library_set_componentfile,vcl,vcl/vcl.android,vcl/vcl)) +else ifeq ($(OS),IOS) +$(eval $(call gb_Library_set_componentfile,vcl,vcl/vcl.ios,vcl/vcl)) else $(eval $(call gb_Library_set_componentfile,vcl,vcl/vcl.unx)) endif @@ -38,18 +42,23 @@ endif $(eval $(call gb_Library_add_package_headers,vcl,vcl_inc)) $(eval $(call gb_Library_add_package_headers,vcl,vcl_afmhash)) +ifeq ($(OS)$(COM),WNTGCC) +WINEINCLUDE=-I$(OUTDIR)/inc/external/wine +endif + $(eval $(call gb_Library_set_include,vcl,\ $$(INCLUDE) \ -I$(realpath $(SRCDIR)/vcl/inc) \ -I$(realpath $(SRCDIR)/vcl/inc/pch) \ -I$(SRCDIR)/solenv/inc \ - -I$(OUTDIR)/inc/offuh \ -I$(OUTDIR)/inc \ + $(WINEINCLUDE) \ -I$(WORKDIR)/CustomTarget/vcl/unx/generic/fontmanager \ )) ifeq ($(GUIBASE),unx) $(eval $(call gb_Library_set_include,vcl,\ $$(INCLUDE) \ + $$(FONTCONFIG_CFLAGS) \ $$(FREETYPE_CFLAGS) \ )) endif @@ -60,6 +69,11 @@ $(eval $(call gb_Library_add_defs,vcl,\ -DDLLPOSTFIX=$(subst $(or $(gb_Library_DLLEXT),$(gb_Library_PLAINEXT)),,$(gb_Library_OOOEXT)) \ )) +$(eval $(call gb_Library_add_api,vcl,\ + offapi \ + udkapi \ +)) + $(eval $(call gb_Library_add_linked_libs,vcl,\ tl \ utl \ @@ -82,21 +96,10 @@ $(call gb_Library_use_externals,vcl,\ icuuc \ ) -ifeq ($(GUIBASE),unx) -$(eval $(call gb_Library_add_linked_libs,vcl,\ - freetype \ -)) -endif - ifeq ($(GUIBASE),aqua) $(eval $(call gb_Library_add_cxxflags,vcl,\ $(gb_OBJCXXFLAGS) \ )) -ifeq ($(ENABLE_CAIRO),TRUE) -$(eval $(call gb_Library_add_defs,vcl,\ - -DCAIRO \ -)) -endif $(eval $(call gb_Library_add_objcxxobjects,vcl,\ vcl/aqua/source/a11y/aqua11yactionwrapper \ vcl/aqua/source/a11y/aqua11ycomponentwrapper \ @@ -172,18 +175,12 @@ $(eval $(call gb_Library_add_defs,vcl,\ -DSAL_DLLPOSTFIX=\"$(gb_Library_OOOEXT)\" \ -D_XSALSET_LIBNAME=\"$(call gb_Library_get_runtime_filename,spa)\" \ )) -## handle fontconfig -ifneq ($(ENABLE_FONTCONFIG),) -$(eval $(call gb_Library_add_defs,vcl,\ - -DENABLE_FONTCONFIG \ -)) ## handle CUPS ifneq ($(ENABLE_CUPS),) $(eval $(call gb_Library_add_defs,vcl,\ -DENABLE_CUPS \ )) endif -endif $(eval $(call gb_Library_add_exception_objects,vcl,\ vcl/source/glyphs/gcach_ftyp \ vcl/source/glyphs/gcach_layout \ @@ -202,6 +199,19 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\ )) endif +ifeq ($(GUIBASE),android) +$(eval $(call gb_Library_set_defs,vcl,\ + $$(DEFS) \ + -DSAL_DLLPREFIX=\"$(gb_Library_SYSPRE)\" \ + -DSAL_DLLPOSTFIX=\"$(gb_Library_OOOEXT)\" \ + -D_XSALSET_LIBNAME=\"$(call gb_Library_get_runtime_filename,spa)\" \ +)) +$(eval $(call gb_Library_add_exception_objects,vcl,\ + vcl/unx/generic/plugadapt/salplug \ + vcl/null/printerinfomanager \ +)) +endif + ifeq ($(OS),WNT) $(eval $(call gb_Library_add_exception_objects,vcl,\ vcl/win/source/app/saldata \ @@ -225,7 +235,23 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\ )) $(eval $(call gb_Library_add_nativeres,vcl,src)) +endif +ifeq ($(GUIBASE),cocoatouch) +$(eval $(call gb_Library_set_cxxflags,vcl,\ + $$(CXXFLAGS) \ + $$(OBJCXXFLAGS) \ +)) +$(eval $(call gb_Library_add_objcxxobjects,vcl,\ + vcl/ios/source/app/salnstimer \ + vcl/ios/source/app/vcluiapp \ +)) +$(eval $(call gb_Library_add_exception_objects,vcl,\ + vcl/ios/source/app/saldata \ + vcl/ios/source/app/salinst \ + vcl/ios/source/app/salsys \ + vcl/ios/source/app/saltimer \ +)) endif $(eval $(call gb_Library_add_cobjects,vcl,\ @@ -256,7 +282,6 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\ vcl/source/components/dtranscomp \ vcl/source/components/factory \ vcl/source/components/fontident \ - vcl/source/components/rasterizer_rsvg \ vcl/source/components/stringmirror \ vcl/source/control/button \ vcl/source/control/combobox \ @@ -362,7 +387,6 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\ vcl/source/helper/strhelper \ vcl/source/helper/threadex \ vcl/source/helper/xconnection \ - vcl/source/salmain/salmain \ vcl/source/window/abstdlg \ vcl/source/window/accel \ vcl/source/window/accmgr \ @@ -411,7 +435,11 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\ vcl/source/window/wpropset \ vcl/source/window/wrkwin \ )) - +ifneq ($(OS),IOS) +$(eval $(call gb_Library_add_exception_objects,vcl,\ + vcl/source/salmain/salmain \ +)) +endif ## handle Graphite ifneq ($(ENABLE_GRAPHITE),) # add defines, graphite sources for all platforms @@ -438,6 +466,62 @@ endif $(call gb_Library_use_external,vcl,graphite) endif +## handle Cairo +ifneq ($(ENABLE_LIBRSVG),NO) + +$(eval $(call gb_Library_add_exception_objects,vcl,\ + vcl/source/components/rasterizer_rsvg \ +)) + +$(eval $(call gb_Library_set_defs,vcl,\ + $$(DEFS) \ + -DENABLE_LIBRSVG \ +)) +ifeq ($(SYSTEM_CAIRO),YES) +$(eval $(call gb_Library_set_cxxflags,vcl,\ + $$(CXXFLAGS) \ + $$(CAIRO_CFLAGS) \ + -DSYSTEM_CAIRO \ +)) + +# CAIRO_LIBS contains both -L and -l options. Thes sets LDFLAGS which +# goes early into the linking command line before the object files. So +# on platforms where libraries are searched for symbols undefined at +# that point as they occur on the command line, it is pointless to +# search the cairo library at that point as no references to cairo +# entries have been read from object files yet. +$(eval $(call gb_Library_set_ldflags,vcl,\ + $$(LDFLAGS) \ + $$(CAIRO_LIBS) \ +)) + +# Thus we also need to add cairo to the list of linked libs. These go +# after the object files on the linking command line. +$(eval $(call gb_Library_add_linked_libs,vcl,\ + cairo \ +)) + +else +$(eval $(call gb_Library_add_linked_libs,vcl,\ + cairo \ +)) +ifeq ($(OS),LINUX) +$(eval $(call gb_Library_add_linked_libs,vcl,\ + freetype \ + fontconfig \ +)) +endif +endif +endif + +ifeq ($(GUIBASE),unx) +$(eval $(call gb_Library_set_ldflags,vcl,\ + $$(LDFLAGS) \ + $$(FONTCONFIG_LIBS) \ + $$(FREETYPE_LIBS) \ +)) +endif + ifeq ($(OS),LINUX) $(eval $(call gb_Library_add_linked_libs,vcl,\ dl \ @@ -471,9 +555,16 @@ $(eval $(call gb_Library_add_libs,vcl,\ endif ifeq ($(OS),WNT) +ifeq ($(COM),MSC) $(eval $(call gb_Library_add_ldflags,vcl,\ /ENTRY:LibMain@12 \ )) +endif +ifeq ($(COM),GCC) +$(eval $(call gb_Library_set_ldflags,vcl,\ + $$(LDFLAGS) \ +)) +endif $(eval $(call gb_Library_add_linked_libs,vcl,\ advapi32 \ gdi32 \ @@ -483,7 +574,7 @@ $(eval $(call gb_Library_add_linked_libs,vcl,\ mpr \ msimg32 \ msvcrt \ - oldnames \ + $(gb_Library_win32_OLDNAMES) \ ole32 \ shell32 \ user32 \ @@ -492,4 +583,14 @@ $(eval $(call gb_Library_add_linked_libs,vcl,\ winspool \ )) endif + +ifeq ($(GUIBASE),cocoatouch) +$(eval $(call gb_Library_set_ldflags,vcl,\ + $$(LDFLAGS) \ + -framework UIKit \ + -framework CoreFoundation \ +)) +endif + + # vim: set noet sw=4 ts=4: diff --git a/vcl/Library_vclplug_gen.mk b/vcl/Library_vclplug_gen.mk index 95428ae53853..819d9ce8c301 100644 --- a/vcl/Library_vclplug_gen.mk +++ b/vcl/Library_vclplug_gen.mk @@ -32,10 +32,14 @@ $(eval $(call gb_Library_set_include,vclplug_gen,\ -I$(SRCDIR)/vcl/inc \ -I$(SRCDIR)/vcl/inc/pch \ -I$(SRCDIR)/solenv/inc \ - -I$(OUTDIR)/inc/offuh \ -I$(OUTDIR)/inc \ )) +$(eval $(call gb_Library_add_api,vclplug_gen,\ + offapi \ + udkapi \ +)) + $(eval $(call gb_Library_add_linked_libs,vclplug_gen,\ vcl \ tl \ @@ -63,6 +67,22 @@ $(call gb_Library_use_externals,vclplug_gen,\ icuuc \ ) +)) +$(eval $(call gb_Library_set_ldflags,vclplug_gen,\ + $$(LDFLAGS) \ + $$(CAIRO_LIBS) \ +)) +else +$(eval $(call gb_Library_set_cxxflags,vclplug_gen,\ + $$(CXXFLAGS) \ + $$(FONTCONFIG_CFLAGS) \ + $$(FREETYPE_CFLAGS) \ +)) +$(eval $(call gb_Library_add_linked_libs,vclplug_gen,\ + cairo \ +)) +endif + $(eval $(call gb_Library_add_exception_objects,vclplug_gen,\ vcl/unx/generic/app/i18n_cb \ vcl/unx/generic/app/i18n_ic \ @@ -117,7 +137,6 @@ $(eval $(call gb_Library_add_defs,vclplug_gen,\ -DVCLPLUG_GEN_IMPLEMENTATION \ )) - ## handle RandR ifneq ($(ENABLE_RANDR),) $(eval $(call gb_Library_add_defs,vclplug_gen,\ diff --git a/vcl/Library_vclplug_gtk.mk b/vcl/Library_vclplug_gtk.mk index cf4ac762022c..d9674f03cb8e 100644 --- a/vcl/Library_vclplug_gtk.mk +++ b/vcl/Library_vclplug_gtk.mk @@ -32,7 +32,6 @@ $(eval $(call gb_Library_set_include,vclplug_gtk,\ -I$(SRCDIR)/vcl/inc \ -I$(SRCDIR)/vcl/inc/pch \ -I$(SRCDIR)/solenv/inc \ - -I$(OUTDIR)/inc/offuh \ -I$(OUTDIR)/inc \ )) @@ -59,6 +58,11 @@ $(eval $(call gb_Library_add_libs,vclplug_gtk,\ )) endif +$(eval $(call gb_Library_add_api,vclplug_gtk,\ + offapi \ + udkapi \ +)) + $(eval $(call gb_Library_add_libs,vclplug_gtk,\ $$(GTK_LIBS) \ $$(GTHREAD_LIBS) \ diff --git a/vcl/Library_vclplug_gtk3.mk b/vcl/Library_vclplug_gtk3.mk index 83fb8306468d..587d69376500 100644 --- a/vcl/Library_vclplug_gtk3.mk +++ b/vcl/Library_vclplug_gtk3.mk @@ -32,7 +32,6 @@ $(eval $(call gb_Library_set_include,vclplug_gtk3,\ -I$(SRCDIR)/vcl/inc \ -I$(SRCDIR)/vcl/inc/pch \ -I$(SRCDIR)/solenv/inc \ - -I$(OUTDIR)/inc/offuh \ -I$(OUTDIR)/inc \ )) @@ -47,6 +46,11 @@ $(eval $(call gb_Library_set_defs,vclplug_gtk3,\ -DVERSION=\"$(UPD)$(LAST_MINOR)\" \ )) +$(eval $(call gb_Library_add_api,vclplug_gtk3,\ + offapi \ + udkapi \ +)) + ifneq ($(ENABLE_DBUS),) $(eval $(call gb_Library_set_include,vclplug_gtk3,\ $$(INCLUDE) \ diff --git a/vcl/Library_vclplug_kde.mk b/vcl/Library_vclplug_kde.mk index ddc429180528..e4586b8a108b 100644 --- a/vcl/Library_vclplug_kde.mk +++ b/vcl/Library_vclplug_kde.mk @@ -32,7 +32,6 @@ $(eval $(call gb_Library_set_include,vclplug_kde,\ -I$(SRCDIR)/vcl/inc \ -I$(SRCDIR)/vcl/inc/pch \ -I$(SRCDIR)/solenv/inc \ - -I$(OUTDIR)/inc/offuh \ -I$(OUTDIR)/inc \ )) @@ -45,6 +44,11 @@ $(eval $(call gb_Library_add_defs,vclplug_kde,\ -DVCLPLUG_KDE_IMPLEMENTATION \ )) +$(eval $(call gb_Library_add_api,vclplug_kde,\ + offapi \ + udkapi \ +)) + $(eval $(call gb_Library_add_libs,vclplug_kde,\ $$(KDE_LIBS) \ )) diff --git a/vcl/Library_vclplug_kde4.mk b/vcl/Library_vclplug_kde4.mk index 25695d9d5a33..bbc64aabcbdc 100644 --- a/vcl/Library_vclplug_kde4.mk +++ b/vcl/Library_vclplug_kde4.mk @@ -34,7 +34,6 @@ $(eval $(call gb_Library_set_include,vclplug_kde4,\ -I$(SRCDIR)/vcl/inc \ -I$(SRCDIR)/vcl/inc/pch \ -I$(SRCDIR)/solenv/inc \ - -I$(OUTDIR)/inc/offuh \ -I$(OUTDIR)/inc \ -I$(WORKDIR)/CustomTarget/vcl/unx/kde4 \ )) @@ -48,6 +47,11 @@ $(eval $(call gb_Library_add_defs,vclplug_kde4,\ -DVCLPLUG_KDE4_IMPLEMENTATION \ )) +$(eval $(call gb_Library_add_api,vclplug_kde4,\ + offapi \ + udkapi \ +)) + $(eval $(call gb_Library_add_libs,vclplug_kde4,\ $$(KDE4_LIBS) \ )) diff --git a/vcl/Library_vclplug_svp.mk b/vcl/Library_vclplug_svp.mk index 7df8f4790a17..7616e6c06025 100644 --- a/vcl/Library_vclplug_svp.mk +++ b/vcl/Library_vclplug_svp.mk @@ -32,7 +32,6 @@ $(eval $(call gb_Library_set_include,vclplug_svp,\ -I$(SRCDIR)/vcl/inc \ -I$(SRCDIR)/vcl/inc/pch \ -I$(SRCDIR)/solenv/inc \ - -I$(OUTDIR)/inc/offuh \ -I$(OUTDIR)/inc \ )) @@ -40,6 +39,11 @@ $(eval $(call gb_Library_add_defs,vclplug_svp,\ -DVCLPLUG_SVP_IMPLEMENTATION \ )) +$(eval $(call gb_Library_add_api,vclplug_svp,\ + offapi \ + udkapi \ +)) + $(eval $(call gb_Library_add_linked_libs,vclplug_svp,\ vcl \ vclplug_gen \ diff --git a/vcl/StaticLibrary_vclmain.mk b/vcl/StaticLibrary_vclmain.mk index 044ce10ca40c..4c313f88b082 100644 --- a/vcl/StaticLibrary_vclmain.mk +++ b/vcl/StaticLibrary_vclmain.mk @@ -27,15 +27,26 @@ $(eval $(call gb_StaticLibrary_StaticLibrary,vclmain)) +ifeq ($(OS),IOS) +$(eval $(call gb_StaticLibrary_set_cxxflags,vclmain,\ + $$(CXXFLAGS) \ + -x objective-c++ -fobjc-abi-version=2 -fobjc-legacy-dispatch -D__IPHONE_OS_VERSION_MIN_REQUIRED=40300 \ +)) +endif + $(eval $(call gb_StaticLibrary_set_include,vclmain,\ $$(INCLUDE) \ -I$(realpath $(SRCDIR)/vcl/inc) \ -I$(realpath $(SRCDIR)/vcl/inc/pch) \ -I$(SRCDIR)/solenv/inc \ - -I$(OUTDIR)/inc/offuh \ -I$(OUTDIR)/inc \ )) +$(eval $(call gb_StaticLibrary_add_api,vclmain,\ + offapi \ + udkapi \ +)) + $(eval $(call gb_StaticLibrary_add_exception_objects,vclmain,\ vcl/source/salmain/salmain \ )) @@ -45,7 +56,7 @@ $(eval $(call gb_StaticLibrary_add_exception_objects,vclmain,\ # Instead of this evil linking of an object from $(OUTDIR) define StaticLibrary_salmain_hack $(call gb_StaticLibrary_get_target,vclmain) : $(OUTDIR)/lib/$(1) -$$(eval $$(call gb_Deliver_add_deliverable,$(OUTDIR)/lib/$(1),$(call gb_CxxObject_get_target,vcl/source/salmain/salmain))) +$$(eval $$(call gb_Deliver_add_deliverable,$(OUTDIR)/lib/$(1),$(call gb_CxxObject_get_target,vcl/source/salmain/salmain),$(OUTDIR)/lib/$(1))) $(OUTDIR)/lib/$(1) : $(call gb_CxxObject_get_target,vcl/source/salmain/salmain) $$(call gb_Deliver_deliver,$$<,$$@) diff --git a/vcl/aqua/source/a11y/aqua11yactionwrapper.mm b/vcl/aqua/source/a11y/aqua11yactionwrapper.mm index e49ad251faad..d0f8ca91c73d 100644 --- a/vcl/aqua/source/a11y/aqua11yactionwrapper.mm +++ b/vcl/aqua/source/a11y/aqua11yactionwrapper.mm @@ -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. @@ -82,3 +83,5 @@ } @end + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11ycomponentwrapper.mm b/vcl/aqua/source/a11y/aqua11ycomponentwrapper.mm index c66e7c3d8515..0f50dad02c0e 100644 --- a/vcl/aqua/source/a11y/aqua11ycomponentwrapper.mm +++ b/vcl/aqua/source/a11y/aqua11ycomponentwrapper.mm @@ -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. @@ -108,3 +109,5 @@ using namespace ::com::sun::star::uno; } @end + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11yfactory.mm b/vcl/aqua/source/a11y/aqua11yfactory.mm index 41b66d19e578..944a8e9ea90a 100644 --- a/vcl/aqua/source/a11y/aqua11yfactory.mm +++ b/vcl/aqua/source/a11y/aqua11yfactory.mm @@ -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. @@ -198,3 +199,5 @@ static bool enabled = false; } @end + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11yrolehelper.mm b/vcl/aqua/source/a11y/aqua11yrolehelper.mm index cfc052e96beb..e989f38f4a1b 100644 --- a/vcl/aqua/source/a11y/aqua11yrolehelper.mm +++ b/vcl/aqua/source/a11y/aqua11yrolehelper.mm @@ -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. @@ -42,6 +43,10 @@ using namespace ::com::sun::star::uno; +(id)simpleMapNativeRoleFrom: (XAccessibleContext *) accessibleContext { id nativeRole = nil; + + if (accessibleContext == NULL) + return nativeRole; + switch( accessibleContext -> getAccessibleRole() ) { #define MAP(a,b) \ case a: nativeRole = b; break @@ -272,3 +277,5 @@ using namespace ::com::sun::star::uno; } @end + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11yselectionwrapper.mm b/vcl/aqua/source/a11y/aqua11yselectionwrapper.mm index 5b8d604f3b1a..960afb384caa 100644 --- a/vcl/aqua/source/a11y/aqua11yselectionwrapper.mm +++ b/vcl/aqua/source/a11y/aqua11yselectionwrapper.mm @@ -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. @@ -94,3 +95,5 @@ using namespace ::com::sun::star::uno; } @end + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11ytablewrapper.mm b/vcl/aqua/source/a11y/aqua11ytablewrapper.mm index 110cb42ffee7..47b766df2223 100644 --- a/vcl/aqua/source/a11y/aqua11ytablewrapper.mm +++ b/vcl/aqua/source/a11y/aqua11ytablewrapper.mm @@ -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. @@ -210,3 +211,5 @@ using namespace ::com::sun::star::uno; } @end + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11ytextattributeswrapper.mm b/vcl/aqua/source/a11y/aqua11ytextattributeswrapper.mm index 2122f56e9565..5a4628edb76e 100644 --- a/vcl/aqua/source/a11y/aqua11ytextattributeswrapper.mm +++ b/vcl/aqua/source/a11y/aqua11ytextattributeswrapper.mm @@ -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. @@ -254,3 +255,5 @@ using namespace ::rtl; } @end + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11ytextwrapper.mm b/vcl/aqua/source/a11y/aqua11ytextwrapper.mm index d956d2beb0b7..cb6fae77a7a9 100644 --- a/vcl/aqua/source/a11y/aqua11ytextwrapper.mm +++ b/vcl/aqua/source/a11y/aqua11ytextwrapper.mm @@ -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. @@ -299,3 +300,5 @@ using namespace ::rtl; } @end + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11yutil.mm b/vcl/aqua/source/a11y/aqua11yutil.mm index 74de0a19aa41..b244f1f67855 100644 --- a/vcl/aqua/source/a11y/aqua11yutil.mm +++ b/vcl/aqua/source/a11y/aqua11yutil.mm @@ -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. @@ -52,3 +53,5 @@ using namespace ::com::sun::star::awt; } @end + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11yvaluewrapper.mm b/vcl/aqua/source/a11y/aqua11yvaluewrapper.mm index fb257921b13e..fc10d44058d8 100644 --- a/vcl/aqua/source/a11y/aqua11yvaluewrapper.mm +++ b/vcl/aqua/source/a11y/aqua11yvaluewrapper.mm @@ -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. @@ -93,3 +94,5 @@ using namespace ::com::sun::star::uno; } @end + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11ywrapper.mm b/vcl/aqua/source/a11y/aqua11ywrapper.mm index bf8de98c3318..2376111eb427 100644 --- a/vcl/aqua/source/a11y/aqua11ywrapper.mm +++ b/vcl/aqua/source/a11y/aqua11ywrapper.mm @@ -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. @@ -1145,3 +1146,5 @@ Reference < XAccessibleContext > hitTestRunner ( com::sun::star::awt::Point poin } @end + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11ywrapperbutton.mm b/vcl/aqua/source/a11y/aqua11ywrapperbutton.mm index e51ceff14af9..dd9b95901d13 100644 --- a/vcl/aqua/source/a11y/aqua11ywrapperbutton.mm +++ b/vcl/aqua/source/a11y/aqua11ywrapperbutton.mm @@ -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. @@ -60,3 +61,5 @@ } @end + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11ywrappercheckbox.mm b/vcl/aqua/source/a11y/aqua11ywrappercheckbox.mm index 6bf2aa2f8340..1c70d774d0eb 100644 --- a/vcl/aqua/source/a11y/aqua11ywrappercheckbox.mm +++ b/vcl/aqua/source/a11y/aqua11ywrappercheckbox.mm @@ -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. @@ -64,3 +65,5 @@ } @end + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11ywrappercombobox.mm b/vcl/aqua/source/a11y/aqua11ywrappercombobox.mm index 6f8e9d05d112..1fd7468f8858 100644 --- a/vcl/aqua/source/a11y/aqua11ywrappercombobox.mm +++ b/vcl/aqua/source/a11y/aqua11ywrappercombobox.mm @@ -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. @@ -161,3 +162,5 @@ using namespace ::com::sun::star::uno; } @end + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11ywrappergroup.mm b/vcl/aqua/source/a11y/aqua11ywrappergroup.mm index 536cc9bba8eb..f3e1dcf769c5 100644 --- a/vcl/aqua/source/a11y/aqua11ywrappergroup.mm +++ b/vcl/aqua/source/a11y/aqua11ywrappergroup.mm @@ -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. @@ -55,3 +56,5 @@ } @end + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11ywrapperlist.mm b/vcl/aqua/source/a11y/aqua11ywrapperlist.mm index d70679ed6966..9c7f5f6fe932 100644 --- a/vcl/aqua/source/a11y/aqua11ywrapperlist.mm +++ b/vcl/aqua/source/a11y/aqua11ywrapperlist.mm @@ -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. @@ -46,3 +47,5 @@ using namespace ::com::sun::star::accessibility; } @end + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11ywrapperradiobutton.mm b/vcl/aqua/source/a11y/aqua11ywrapperradiobutton.mm index 4c1e9047d65e..af4fda68a86e 100644 --- a/vcl/aqua/source/a11y/aqua11ywrapperradiobutton.mm +++ b/vcl/aqua/source/a11y/aqua11ywrapperradiobutton.mm @@ -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. @@ -63,3 +64,5 @@ } @end + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11ywrapperradiogroup.mm b/vcl/aqua/source/a11y/aqua11ywrapperradiogroup.mm index 52e71620ceed..47668005376a 100644 --- a/vcl/aqua/source/a11y/aqua11ywrapperradiogroup.mm +++ b/vcl/aqua/source/a11y/aqua11ywrapperradiogroup.mm @@ -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. @@ -46,3 +47,5 @@ } @end + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11ywrapperrow.mm b/vcl/aqua/source/a11y/aqua11ywrapperrow.mm index 0fd65fd01365..8ecd37aafc1c 100644 --- a/vcl/aqua/source/a11y/aqua11ywrapperrow.mm +++ b/vcl/aqua/source/a11y/aqua11ywrapperrow.mm @@ -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. @@ -55,3 +56,5 @@ } @end + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11ywrapperscrollarea.mm b/vcl/aqua/source/a11y/aqua11ywrapperscrollarea.mm index 8a481b64926d..7c9c6f12fc63 100644 --- a/vcl/aqua/source/a11y/aqua11ywrapperscrollarea.mm +++ b/vcl/aqua/source/a11y/aqua11ywrapperscrollarea.mm @@ -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. @@ -83,3 +84,5 @@ } @end + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11ywrapperscrollbar.mm b/vcl/aqua/source/a11y/aqua11ywrapperscrollbar.mm index 42b67b739602..5087ae5e3f3e 100644 --- a/vcl/aqua/source/a11y/aqua11ywrapperscrollbar.mm +++ b/vcl/aqua/source/a11y/aqua11ywrapperscrollbar.mm @@ -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. @@ -49,3 +50,5 @@ using namespace ::com::sun::star::accessibility; } @end + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11ywrappersplitter.mm b/vcl/aqua/source/a11y/aqua11ywrappersplitter.mm index 37821f25e423..96f8c6413cc9 100644 --- a/vcl/aqua/source/a11y/aqua11ywrappersplitter.mm +++ b/vcl/aqua/source/a11y/aqua11ywrappersplitter.mm @@ -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. @@ -46,3 +47,5 @@ using namespace ::com::sun::star::accessibility; } @end + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11ywrapperstatictext.mm b/vcl/aqua/source/a11y/aqua11ywrapperstatictext.mm index d5afe0962904..d280264a36bd 100644 --- a/vcl/aqua/source/a11y/aqua11ywrapperstatictext.mm +++ b/vcl/aqua/source/a11y/aqua11ywrapperstatictext.mm @@ -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. @@ -54,3 +55,5 @@ } @end + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11ywrappertabgroup.mm b/vcl/aqua/source/a11y/aqua11ywrappertabgroup.mm index fb4e66ad9b90..09fa3d2b6947 100644 --- a/vcl/aqua/source/a11y/aqua11ywrappertabgroup.mm +++ b/vcl/aqua/source/a11y/aqua11ywrappertabgroup.mm @@ -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. @@ -48,3 +49,5 @@ } @end + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11ywrappertextarea.mm b/vcl/aqua/source/a11y/aqua11ywrappertextarea.mm index a90fe7ae28aa..074b6d84d427 100644 --- a/vcl/aqua/source/a11y/aqua11ywrappertextarea.mm +++ b/vcl/aqua/source/a11y/aqua11ywrappertextarea.mm @@ -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. @@ -46,3 +47,5 @@ } @end + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/a11y/aqua11ywrappertoolbar.mm b/vcl/aqua/source/a11y/aqua11ywrappertoolbar.mm index 29ddaf540266..636be7b2fd32 100644 --- a/vcl/aqua/source/a11y/aqua11ywrappertoolbar.mm +++ b/vcl/aqua/source/a11y/aqua11ywrappertoolbar.mm @@ -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. @@ -48,3 +49,5 @@ } @end + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/app/salnstimer.mm b/vcl/aqua/source/app/salnstimer.mm index f44c3d698f73..d78a3ae8462e 100755..100644 --- a/vcl/aqua/source/app/salnstimer.mm +++ b/vcl/aqua/source/app/salnstimer.mm @@ -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. @@ -55,3 +56,4 @@ } @end +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/app/vclnsapp.mm b/vcl/aqua/source/app/vclnsapp.mm index fc4945e1e184..2424d373b24e 100755..100644 --- a/vcl/aqua/source/app/vclnsapp.mm +++ b/vcl/aqua/source/app/vclnsapp.mm @@ -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. @@ -57,6 +58,10 @@ } @end +// If you wonder how this VCL_NSApplication stuff works, one thing you +// might have missed is that the NSPrincipalClass property in +// desktop/macosx/Info.plist has the value VCL_NSApplication. + @implementation VCL_NSApplication -(void)sendEvent:(NSEvent*)pEvent { @@ -520,3 +525,4 @@ @end +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/gdi/aquaprintaccessoryview.mm b/vcl/aqua/source/gdi/aquaprintaccessoryview.mm index 2bb67dcc1940..abe314f27f8f 100644 --- a/vcl/aqua/source/gdi/aquaprintaccessoryview.mm +++ b/vcl/aqua/source/gdi/aquaprintaccessoryview.mm @@ -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. @@ -1389,3 +1390,5 @@ static void addEdit( NSView* pCurParent, long& rCurX, long& rCurY, long nAttachO } @end + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/gdi/aquaprintview.mm b/vcl/aqua/source/gdi/aquaprintview.mm index 692435fc00f0..a7a527a9289b 100755..100644 --- a/vcl/aqua/source/gdi/aquaprintview.mm +++ b/vcl/aqua/source/gdi/aquaprintview.mm @@ -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. @@ -82,3 +83,5 @@ mpController->printFilteredPage( nPage-1 ); } @end + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/gdi/salatslayout.cxx b/vcl/aqua/source/gdi/salatslayout.cxx index 94022b763a03..1c193378b9cf 100644 --- a/vcl/aqua/source/gdi/salatslayout.cxx +++ b/vcl/aqua/source/gdi/salatslayout.cxx @@ -1043,7 +1043,6 @@ bool ATSLayout::GetDeltaY() const if( mpDeltaY != NULL ) return true; -#if 1 if( !maATSULayout ) return false; @@ -1069,7 +1068,6 @@ bool ATSLayout::GetDeltaY() const mpDeltaY = NULL; return false; } -#endif return true; } diff --git a/vcl/aqua/source/gdi/salbmp.cxx b/vcl/aqua/source/gdi/salbmp.cxx index bfb15f0a8076..6afad341e5b0 100644 --- a/vcl/aqua/source/gdi/salbmp.cxx +++ b/vcl/aqua/source/gdi/salbmp.cxx @@ -871,7 +871,6 @@ bool AquaSalBitmap::GetSystemData( BitmapSystemData& rData ) { bRet = true; -#ifdef CAIRO if ((CGBitmapContextGetBitsPerPixel(mxGraphicContext) == 32) && (CGBitmapContextGetBitmapInfo(mxGraphicContext) & kCGBitmapByteOrderMask) != kCGBitmapByteOrder32Host) { /** @@ -904,7 +903,6 @@ bool AquaSalBitmap::GetSystemData( BitmapSystemData& rData ) CGImageRelease( xImage ); mxGraphicContext = mxGraphicContextNew; } -#endif rData.rImageContext = (void *) mxGraphicContext; rData.mnWidth = mnWidth; diff --git a/vcl/aqua/source/window/salframeview.mm b/vcl/aqua/source/window/salframeview.mm index ade5594ec667..54ebe8090f1c 100755..100644 --- a/vcl/aqua/source/window/salframeview.mm +++ b/vcl/aqua/source/window/salframeview.mm @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /*n*********************************************************************** * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -1728,3 +1729,4 @@ private: @end +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/window/salnsmenu.mm b/vcl/aqua/source/window/salnsmenu.mm index b86caa49d870..c2f182773ce6 100755..100644 --- a/vcl/aqua/source/window/salnsmenu.mm +++ b/vcl/aqua/source/window/salnsmenu.mm @@ -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. @@ -213,3 +214,4 @@ @end +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/android/svsys.h b/vcl/inc/android/svsys.h new file mode 100644 index 000000000000..9dabc7187400 --- /dev/null +++ b/vcl/inc/android/svsys.h @@ -0,0 +1,36 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License or as specified alternatively below. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is Tor Lillqvist <tml@iki.fi> + * Portions created by the Initial Developer are Copyright (C) 2011 the + * Initial Developer. All Rights Reserved. + * + * For minor contributions see the git repository. + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#ifndef _VCL_ANDROID_SVSYS_H +#define _VCL_ANDROID_SVSYS_H + + +// ? + +#endif // _VCL_ANDROID_SVSYS_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/impgraph.hxx b/vcl/inc/impgraph.hxx index 6b6bce184770..592f6a73c050 100644 --- a/vcl/inc/impgraph.hxx +++ b/vcl/inc/impgraph.hxx @@ -144,8 +144,6 @@ private: sal_uLong ImplGetAnimationLoopCount() const; void ImplResetAnimationLoopCount(); - List* ImplGetAnimationInfoList() const; - private: GraphicReader* ImplGetContext(); diff --git a/vcl/inc/ios/iosvcltypes.h b/vcl/inc/ios/iosvcltypes.h new file mode 100644 index 000000000000..820547b6a013 --- /dev/null +++ b/vcl/inc/ios/iosvcltypes.h @@ -0,0 +1,37 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License or as specified alternatively below. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is Tor Lillqvist <tml@iki.fi> + * Portions created by the Initial Developer are Copyright (C) 2011 the + * Initial Developer. All Rights Reserved. + * + * For minor contributions see the git repository. + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#ifndef _IOSVCLTYPES_H +#define _IOSVCLTYPES_H + +#include "premac.h" +#import <UIKit/UIKit.h> +#include "postmac.h" + +#endif _IOSVCLTYPES_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/ios/salbmp.h b/vcl/inc/ios/salbmp.h new file mode 100644 index 000000000000..0c3e1468b154 --- /dev/null +++ b/vcl/inc/ios/salbmp.h @@ -0,0 +1,117 @@ +/* -*- 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. + * +************************************************************************/ + +#ifndef _SV_SALBMP_H +#define _SV_SALBMP_H + +#include "tools/gen.hxx" + +#include "basebmp/bitmapdevice.hxx" + +#include "vcl/salbtype.hxx" + +#include "ios/salgdi.h" + +#include "saldata.hxx" +#include "salinst.hxx" +#include "salvd.hxx" +#include "salbmp.hxx" + +#include "salcolorutils.hxx" + + +// -------------- +// - SalBitmap - +// -------------- + +struct BitmapBuffer; +class BitmapColor; +class BitmapPalette; +class IosSalVirtualDevice; +class IosSalGraphics; + +class IosSalBitmap : public SalBitmap +{ +public: + CGContextRef mxGraphicContext; + mutable CGImageRef mxCachedImage; + BitmapPalette maPalette; + basebmp::RawMemorySharedArray maUserBuffer; + basebmp::RawMemorySharedArray maContextBuffer; + sal_uInt16 mnBits; + int mnWidth; + int mnHeight; + sal_uInt32 mnBytesPerRow; + +public: + IosSalBitmap(); + virtual ~IosSalBitmap(); + +public: + + // SalBitmap methods + bool Create( const Size& rSize, sal_uInt16 nBitCount, const BitmapPalette& rPal ); + bool Create( const SalBitmap& rSalBmp ); + bool Create( const SalBitmap& rSalBmp, SalGraphics* pGraphics ); + bool Create( const SalBitmap& rSalBmp, sal_uInt16 nNewBitCount ); + virtual bool Create( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmapCanvas > xBitmapCanvas, + Size& rSize, + bool bMask = false ); + + void Destroy(); + + Size GetSize() const; + sal_uInt16 GetBitCount() const; + + BitmapBuffer *AcquireBuffer( bool bReadOnly ); + void ReleaseBuffer( BitmapBuffer* pBuffer, bool bReadOnly ); + + bool GetSystemData( BitmapSystemData& rData ); + +private: + // quartz helper + bool CreateContext(); + void DestroyContext(); + bool AllocateUserData(); + + void ConvertBitmapData( sal_uInt32 nWidth, sal_uInt32 nHeight, + sal_uInt16 nDestBits, sal_uInt32 nDestBytesPerRow, const BitmapPalette& rDestPalette, sal_uInt8* pDestData, + sal_uInt16 nSrcBits, sal_uInt32 nSrcBytesPerRow, const BitmapPalette& rSrcPalette, sal_uInt8* pSrcData ); + +public: + bool Create( CGLayerRef xLayer, int nBitCount, int nX, int nY, int nWidth, int nHeight, bool bMirrorVert = true ); + +public: + CGImageRef CreateWithMask( const IosSalBitmap& rMask, int nX, int nY, int nWidth, int nHeight ) const; + CGImageRef CreateColorMask( int nX, int nY, int nWidth, int nHeight, SalColor nMaskColor ) const; + CGImageRef CreateCroppedImage( int nX, int nY, int nWidth, int nHeight ) const; +}; + +#endif // _SV_SALBMP_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/bootstrp/appdef.hxx b/vcl/inc/ios/salcolorutils.hxx index 833cd404847f..d6db5f839e04 100644 --- a/tools/inc/bootstrp/appdef.hxx +++ b/vcl/inc/ios/salcolorutils.hxx @@ -26,24 +26,21 @@ * ************************************************************************/ -#ifndef _MHAPPDEF_HXX -#define _MHAPPDEF_HXX +#ifndef _SV_SALCOLORUTILS_HXX +#define _SV_SALCOLORUTILS_HXX +#include "vcl/salbtype.hxx" +#include "vcl/salgtype.hxx" +#include "salmathutils.hxx" -#ifdef UNX -#define PATH_SEPARATOR '/' -#define S_PATH_SEPARATOR "/" -#else -#define PATH_SEPARATOR '\\' -#define S_PATH_SEPARATOR "\\" -#endif +// ------------------------------------------------------------------ -// path conversion +SalColor GetSalColor( const float* pQuartzColor ); -const char* GetEnv( const char *pVar ); -const char* GetEnv( const char *pVar, const char *pDefault ); +void SetSalColor( const SalColor& rColor, float* pQuartzColor ); +// ------------------------------------------------------------------ -#endif +#endif // _SV_SALCOLORUTILS_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/ios/saldata.hxx b/vcl/inc/ios/saldata.hxx new file mode 100644 index 000000000000..764264e42462 --- /dev/null +++ b/vcl/inc/ios/saldata.hxx @@ -0,0 +1,126 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef _SV_SALDATA_HXX +#define _SV_SALDATA_HXX + +#include "premac.h" +#include <UIKit/UIKit.h> +#include "postmac.h" + +#include "com/sun/star/uno/Reference.hxx" + +#include "vcl/ptrstyle.hxx" + +#include "svdata.hxx" +#include "salwtype.hxx" + +#include <list> +#include <vector> +#include <map> +#include <boost/unordered_set.hpp> + +#include <cstdio> +#include <cstdarg> + +class IosSalInstance; +class SalObject; +class SalFrame; +class SalVirtualDevice; +class SalPrinter; +class SystemFontList; + +// ------------------ +// - Some constants - +// ------------------ + +#define SAL_CLIPRECT_COUNT 16 + +#define VER_TIGER 0x1040 +#define VER_LEOPARD 0x1050 + +// ----------- +// - SalData - +// ----------- + +class IosSalFrame; +struct FrameHash : public boost::hash<sal_IntPtr> +{ + size_t operator()(const IosSalFrame* frame) const + { return boost::hash<sal_IntPtr>::operator()( reinterpret_cast<const sal_IntPtr>(frame) ); } +}; + +struct SalData +{ + + SALTIMERPROC mpTimerProc; // timer callback proc + IosSalInstance *mpFirstInstance; // pointer of first instance + std::list<IosSalFrame*> maFrames; // pointer of first frame + boost::unordered_set<const IosSalFrame*,FrameHash> maFrameCheck; // for fast check of frame existance + SalObject *mpFirstObject; // pointer of first object window + SalVirtualDevice *mpFirstVD; // first VirDev + SalPrinter *mpFirstPrinter; // first printing printer + SystemFontList *mpFontList; + + CGColorSpaceRef mxRGBSpace; + CGColorSpaceRef mxGraySpace; + CGColorSpaceRef mxP50Space; + CGPatternRef mxP50Pattern; + + std::vector< UIMenuItem* > maFallbackMenu; + + static oslThreadKey s_aAutoReleaseKey; + + SInt32 mnSystemVersion; // Store System Version + + long mnDPIX; // #i100617# read DPI only once per office life + long mnDPIY; // #i100617# read DPI only once per office life + + com::sun::star::uno::Reference< com::sun::star::uno::XInterface > + mxClipboard; + + SalData(); + ~SalData(); + + static void ensureThreadAutoreleasePool(); + static void drainThreadAutoreleasePool(); +}; + +inline void SetSalData( SalData* pData ) { ImplGetSVData()->mpSalData = (void*)pData; } +inline SalData *GetSalData() { return (SalData*)ImplGetSVData()->mpSalData; } +inline SalData *GetAppSalData() { return (SalData*)ImplGetAppSVData()->mpSalData; } + +// --- Prototypes --- + +sal_Bool ImplSalYieldMutexTryToAcquire(); +void ImplSalYieldMutexAcquire(); +void ImplSalYieldMutexRelease(); + +#endif // _SV_SALDATA_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/ios/salframe.h b/vcl/inc/ios/salframe.h new file mode 100644 index 000000000000..14761fe36ebd --- /dev/null +++ b/vcl/inc/ios/salframe.h @@ -0,0 +1,208 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef _SV_SALFRAME_H +#define _SV_SALFRAME_H + +#include "vcl/sysdata.hxx" + +#include "ios/salmenu.h" +#include "ios/saldata.hxx" +#include "ios/iosvcltypes.h" + +#include "salframe.hxx" + +#include <vector> +#include <utility> +#include <stdexcept> + +#include <boost/shared_ptr.hpp> + +class IosSalGraphics; +class IosSalFrame; +class IosSalTimer; +class IosSalInstance; +class IosSalMenu; +class IosBlinker; + +typedef struct SalFrame::SalPointerState SalPointerState; + +// ---------------- +// - IosSalFrame - +// ---------------- + +class IosSalFrame : public SalFrame +{ +public: + UIWindow* mpWindow; + UIView* mpView; + CGRect maScreenRect; // for mirroring purposes + IosSalGraphics* mpGraphics; + IosSalFrame* mpParent; + SystemEnvData maSysData; + int mnMinWidth; // min. client width in pixels + int mnMinHeight; // min. client height in pixels + int mnMaxWidth; // max. client width in pixels + int mnMaxHeight; // max. client height in pixels + CGRect maFullScreenRect; // old window size when in FullScreen + bool mbGraphics:1; // is Graphics used? + bool mbShown:1; + bool mbInitShow:1; + bool mbPresentation:1; + + sal_uLong mnStyle; + unsigned int mnStyleMask; // our style mask from UIWindow creation + + sal_uLong mnLastEventTime; + unsigned int mnLastModifierFlags; + IosSalMenu* mpMenu; + + SalExtStyle mnExtStyle; // currently document frames are marked this way + + PointerStyle mePointerStyle; // currently active pointer style + + CGMutablePathRef mrClippingPath; // used for "shaping" + std::vector< CGRect > maClippingRects; + + std::list<IosBlinker*> maBlinkers; + + Rectangle maInvalidRect; + + sal_uLong mnICOptions; + + boost::shared_ptr< Timer > mpActivityTimer; // Timer to prevent system sleep during presentation +public: + /** Constructor + + Creates a system window and connects this frame with it. + + @throws std::runtime_error in case window creation fails + */ + IosSalFrame( SalFrame* pParent, sal_uLong salFrameStyle ); + + virtual ~IosSalFrame(); + + virtual SalGraphics* GetGraphics(); + virtual void ReleaseGraphics( SalGraphics* pGraphics ); + virtual sal_Bool PostEvent( void* pData ); + virtual void SetTitle( const XubString& rTitle ); + virtual void SetIcon( sal_uInt16 nIcon ); + virtual void SetRepresentedURL( const rtl::OUString& ); + virtual void SetMenu( SalMenu* pSalMenu ); + virtual void DrawMenuBar(); + virtual void Show( sal_Bool bVisible, sal_Bool bNoActivate = sal_False ); + virtual void Enable( sal_Bool bEnable ); + virtual void SetMinClientSize( long nWidth, long nHeight ); + virtual void SetMaxClientSize( long nWidth, long nHeight ); + virtual void SetPosSize( long nX, long nY, long nWidth, long nHeight, sal_uInt16 nFlags ); + virtual void GetClientSize( long& rWidth, long& rHeight ); + virtual void GetWorkArea( Rectangle& rRect ); + virtual SalFrame* GetParent() const; + virtual void SetWindowState( const SalFrameState* pState ); + virtual sal_Bool GetWindowState( SalFrameState* pState ); + virtual void ShowFullScreen( sal_Bool bFullScreen, sal_Int32 nDisplay ); + virtual void StartPresentation( sal_Bool bStart ); + virtual void SetAlwaysOnTop( sal_Bool bOnTop ); + virtual void ToTop( sal_uInt16 nFlags ); + virtual void SetPointer( PointerStyle ePointerStyle ); + virtual void CaptureMouse( sal_Bool bMouse ); + virtual void SetPointerPos( long nX, long nY ); + virtual void Flush( void ); + virtual void Flush( const Rectangle& ); + virtual void Sync(); + virtual void SetInputContext( SalInputContext* pContext ); + virtual void EndExtTextInput( sal_uInt16 nFlags ); + virtual String GetKeyName( sal_uInt16 nKeyCode ); + virtual String GetSymbolKeyName( const XubString& rFontName, sal_uInt16 nKeyCode ); + virtual sal_Bool MapUnicodeToKeyCode( sal_Unicode aUnicode, LanguageType aLangType, KeyCode& rKeyCode ); + virtual LanguageType GetInputLanguage(); + virtual SalBitmap* SnapShot(); + virtual void UpdateSettings( AllSettings& rSettings ); + virtual void Beep( SoundType eSoundType ); + virtual const SystemEnvData* GetSystemData() const; + virtual SalPointerState GetPointerState(); + virtual SalIndicatorState GetIndicatorState(); + virtual void SimulateKeyPress( sal_uInt16 nKeyCode ); + virtual void SetParent( SalFrame* pNewParent ); + virtual bool SetPluginParent( SystemParentData* pNewParent ); + virtual void SetExtendedFrameStyle( SalExtStyle ); + virtual void SetBackgroundBitmap( SalBitmap* ); + virtual void SetScreenNumber(unsigned int); + virtual void SetApplicationID( const rtl::OUString &rApplicationID ); + + // shaped system windows + // set clip region to none (-> rectangular windows, normal state) + virtual void ResetClipRegion(); + // start setting the clipregion consisting of nRects rectangles + virtual void BeginSetClipRegion( sal_uLong nRects ); + // add a rectangle to the clip region + virtual void UnionClipRegion( long nX, long nY, long nWidth, long nHeight ); + // done setting up the clipregion + virtual void EndSetClipRegion(); + + virtual void SetClientSize( long nWidth, long nHeight ); + + void UpdateFrameGeometry(); + + // trigger painting of the window + void SendPaintEvent( const Rectangle* pRect = NULL ); + + static bool isAlive( const IosSalFrame* pFrame ) + { return GetSalData()->maFrameCheck.find( pFrame ) != GetSalData()->maFrameCheck.end(); } + + static IosSalFrame* GetCaptureFrame() { return s_pCaptureFrame; } + + UIWindow* getWindow() const { return mpWindow; } + UIView* getView() const { return mpView; } + unsigned int getStyleMask() const { return mnStyleMask; } + + void getResolution( long& o_rDPIX, long& o_rDPIY ); + + CGMutablePathRef getClipPath() const { return mrClippingPath; } + + // called by VCL_UIApplication to indicate screen settings have changed + void screenParametersChanged(); + + private: // methods + /** do things on initial show (like centering on parent or on screen) + */ + void initShow(); + + void initWindowAndView(); + + private: // data + static IosSalFrame* s_pCaptureFrame; + + // make IosSalFrame non copyable + IosSalFrame( const IosSalFrame& ); + IosSalFrame& operator=(const IosSalFrame&); +}; + +#endif // _SV_SALFRAME_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/ios/salframeview.h b/vcl/inc/ios/salframeview.h new file mode 100644 index 000000000000..e631209c7b7f --- /dev/null +++ b/vcl/inc/ios/salframeview.h @@ -0,0 +1,144 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef _VCL_SALFRAMEVIEW_H +#define _VCL_SALFRAMEVIEW_H + +@interface SalFrameWindow : UIWindow +{ + IosSalFrame* mpFrame; + id mDraggingDestinationHandler; +} +-(id)initWithSalFrame: (IosSalFrame*)pFrame; +-(BOOL)canBecomeKeyWindow; +-(void)displayIfNeeded; +-(void)becomeKeyWindow; +-(void)resignKeyWindow; +-(IosSalFrame*)getSalFrame; +@end + +@interface SalFrameView : UIView <UITextInput> +{ + IosSalFrame* mpFrame; + + // for UITextInput + UIEvent* mpLastEvent; + BOOL mbNeedSpecialKeyHandle; + BOOL mbInKeyInput; + BOOL mbKeyHandled; + NSRange mMarkedRange; + NSRange mSelectedRange; + id mDraggingDestinationHandler; + UIEvent* mpLastSuperEvent; + + NSTimeInterval mfLastMagnifyTime; + float mfMagnifyDeltaSum; +} +-(id)initWithSalFrame: (IosSalFrame*)pFrame; +-(IosSalFrame*)getSalFrame; +-(BOOL)acceptsFirstResponder; +-(BOOL)isOpaque; +-(void)drawRect: (CGRect)aRect; +-(void)magnifyWithEvent: (UIEvent*)pEvent; +-(void)rotateWithEvent: (UIEvent*)pEvent; +-(void)swipeWithEvent: (UIEvent*)pEvent; +-(void)keyDown: (UIEvent*)pEvent; +-(void)flagsChanged: (UIEvent*)pEvent; +-(BOOL)sendKeyInputAndReleaseToFrame: (sal_uInt16)nKeyCode character: (sal_Unicode)aChar; +-(BOOL)sendKeyInputAndReleaseToFrame: (sal_uInt16)nKeyCode character: (sal_Unicode)aChar modifiers: (unsigned int)nMod; +-(BOOL)sendKeyToFrameDirect: (sal_uInt16)nKeyCode character: (sal_Unicode)aChar modifiers: (unsigned int)nMod; +-(BOOL)sendSingleCharacter:(UIEvent*)pEvent; +-(BOOL)handleKeyDownException:(UIEvent*)pEvent; +-(void)clearLastEvent; +/* + text action methods +*/ +-(void)insertText:(id)aString; +-(void)insertTab: (id)aSender; +-(void)insertBacktab: (id)aSender; +-(void)moveLeft: (id)aSender; +-(void)moveLeftAndModifySelection: (id)aSender; +-(void)moveBackwardAndModifySelection: (id)aSender; +-(void)moveRight: (id)aSender; +-(void)moveRightAndModifySelection: (id)aSender; +-(void)moveForwardAndModifySelection: (id)aSender; +-(void)moveUp: (id)aSender; +-(void)moveDown: (id)aSender; +-(void)moveWordBackward: (id)aSender; +-(void)moveWordBackwardAndModifySelection: (id)aSender; +-(void)moveWordLeftAndModifySelection: (id)aSender; +-(void)moveWordForward: (id)aSender; +-(void)moveWordForwardAndModifySelection: (id)aSender; +-(void)moveWordRightAndModifySelection: (id)aSender; +-(void)moveToEndOfLine: (id)aSender; +-(void)moveToRightEndOfLine: (id)aSender; +-(void)moveToLeftEndOfLine: (id)aSender; +-(void)moveToEndOfLineAndModifySelection: (id)aSender; +-(void)moveToRightEndOfLineAndModifySelection: (id)aSender; +-(void)moveToLeftEndOfLineAndModifySelection: (id)aSender; +-(void)moveToBeginningOfLine: (id)aSender; +-(void)moveToBeginningOfLineAndModifySelection: (id)aSender; +-(void)moveToEndOfParagraph: (id)aSender; +-(void)moveToEndOfParagraphAndModifySelection: (id)aSender; +-(void)moveToBeginningOfParagraph: (id)aSender; +-(void)moveToBeginningOfParagraphAndModifySelection: (id)aSender; +-(void)moveParagraphForward: (id)aSender; +-(void)moveParagraphForwardAndModifySelection: (id)aSender; +-(void)moveParagraphBackward: (id)aSender; +-(void)moveParagraphBackwardAndModifySelection: (id)aSender; +-(void)moveToEndOfDocument: (id)aSender; +-(void)scrollToEndOfDocument: (id)aSender; +-(void)moveToEndOfDocumentAndModifySelection: (id)aSender; +-(void)moveToBeginningOfDocument: (id)aSender; +-(void)scrollToBeginningOfDocument: (id)aSender; +-(void)moveToBeginningOfDocumentAndModifySelection: (id)aSender; +-(void)insertNewline: (id)aSender; +-(void)deleteBackward: (id)aSender; +-(void)deleteForward: (id)aSender; +-(void)cancelOperation: (id)aSender; +-(void)deleteBackwardByDecomposingPreviousCharacter: (id)aSender; +-(void)deleteWordBackward: (id)aSender; +-(void)deleteWordForward: (id)aSender; +-(void)deleteToBeginningOfLine: (id)aSender; +-(void)deleteToEndOfLine: (id)aSender; +-(void)deleteToBeginningOfParagraph: (id)aSender; +-(void)deleteToEndOfParagraph: (id)aSender; +-(void)insertLineBreak: (id)aSender; +-(void)insertParagraphSeparator: (id)aSender; +-(void)selectWord: (id)aSender; +-(void)selectLine: (id)aSender; +-(void)selectParagraph: (id)aSender; +-(void)selectAll: (id)aSender; +-(void)noop: (id)aSender; +-(id)parentAttribute; +-(UIView *)viewElementForParent; +@end + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/ios/salgdi.h b/vcl/inc/ios/salgdi.h new file mode 100644 index 000000000000..51ef49219e9a --- /dev/null +++ b/vcl/inc/ios/salgdi.h @@ -0,0 +1,401 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef _SV_SALGDI_H +#define _SV_SALGDI_H + +#include "basegfx/polygon/b2dpolypolygon.hxx" + +#include "ios/iosvcltypes.h" +#include <vcl/fontcapabilities.hxx> + +#include "outfont.hxx" +#include "salgdi.hxx" + +#include <vector> + +class IosSalFrame; +class IosSalBitmap; +class ImplDevFontAttributes; + +class CGRect; + +// mac specific physically available font face +class ImplIosFontData : public ImplFontData +{ +public: + ImplIosFontData( const ImplDevFontAttributes&, NSString * ); + + virtual ~ImplIosFontData(); + + virtual ImplFontData* Clone() const; + virtual ImplFontEntry* CreateFontInstance( ImplFontSelectData& ) const; + virtual sal_IntPtr GetFontId() const; + + const ImplFontCharMap* GetImplFontCharMap() const; + bool GetImplFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const; + bool HasChar( sal_uInt32 cChar ) const; + + void ReadOs2Table() const; + void ReadIosCmapEncoding() const; + bool HasCJKSupport() const; + +private: + mutable const ImplFontCharMap* mpCharMap; + mutable vcl::FontCapabilities maFontCapabilities; + mutable bool mbOs2Read; // true if OS2-table related info is valid + mutable bool mbHasOs2Table; + mutable bool mbCmapEncodingRead; // true if cmap encoding of Ios font is read + mutable bool mbHasCJKSupport; // #i78970# CJK fonts need extra leading + mutable bool mbFontCapabilitiesRead; +}; + +// abstracting quartz color instead of having to use an CGFloat[] array +class RGBAColor +{ +public: + RGBAColor( SalColor ); + RGBAColor( float fRed, float fGreen, float fBlue, float fAlpha ); //NOTUSEDYET + const float* AsArray() const { return &mfRed; } + bool IsVisible() const { return (mfAlpha > 0); } + void SetAlpha( float fAlpha ) { mfAlpha = fAlpha; } +private: + float mfRed, mfGreen, mfBlue, mfAlpha; +}; + +// ------------------- +// - IosSalGraphics - +// ------------------- +class IosSalGraphics : public SalGraphics +{ +protected: + IosSalFrame* mpFrame; + CGLayerRef mxLayer; // Quartz graphics layer + CGContextRef mrContext; // Quartz drawing context + class XorEmulation* mpXorEmulation; + int mnXorMode; // 0: off 1: on 2: invert only + int mnWidth; + int mnHeight; + int mnBitmapDepth; // zero unless bitmap + /// device resolution of this graphics + long mnRealDPIX; + long mnRealDPIY; + /// some graphics implementations (e.g. IosSalInfoPrinter) scale + /// everything down by a factor (see SetupPrinterGraphics for details) + /// so we have to compensate for it with the inverse factor + double mfFakeDPIScale; + + /// path representing current clip region + CGMutablePathRef mxClipPath; + + /// Drawing colors + /// pen color RGBA + RGBAColor maLineColor; + /// brush color RGBA + RGBAColor maFillColor; + + // Device Font settings + const ImplIosFontData* mpIosFontData; + /// <1.0: font is squeezed, >1.0 font is stretched, else 1.0 + float mfFontStretch; + /// allows text to be rendered without antialiasing + bool mbNonAntialiasedText; + + // Graphics types + + /// is this a printer graphics + bool mbPrinter; + /// is this a virtual device graphics + bool mbVirDev; + /// is this a window graphics + bool mbWindow; + +public: + IosSalGraphics(); + virtual ~IosSalGraphics(); + + bool IsPenVisible() const { return maLineColor.IsVisible(); } + bool IsBrushVisible() const { return maFillColor.IsVisible(); } + + void SetWindowGraphics( IosSalFrame* pFrame ); + void SetPrinterGraphics( CGContextRef, long nRealDPIX, long nRealDPIY, double fFakeScale ); + void SetVirDevGraphics( CGLayerRef, CGContextRef, int nBitDepth = 0 ); + + void initResolution( UIWindow* ); + void copyResolution( IosSalGraphics& ); + void updateResolution(); + + bool IsWindowGraphics() const { return mbWindow; } + bool IsPrinterGraphics() const { return mbPrinter; } + bool IsVirDevGraphics() const { return mbVirDev; } + IosSalFrame* getGraphicsFrame() const { return mpFrame; } + void setGraphicsFrame( IosSalFrame* pFrame ) { mpFrame = pFrame; } + + void ImplDrawPixel( long nX, long nY, const RGBAColor& ); // helper to draw single pixels + + bool CheckContext(); + void UpdateWindow( CGRect& ); // delivered in NSView coordinates + void RefreshRect( const CGRect& ); + void RefreshRect(float lX, float lY, float lWidth, float lHeight); + + void SetState(); + void UnsetState(); + // InvalidateContext does an UnsetState and sets mrContext to 0 + void InvalidateContext(); + + virtual bool setClipRegion( const Region& ); + + // draw --> LineColor and FillColor and RasterOp and ClipRegion + virtual void drawPixel( long nX, long nY ); + virtual void drawPixel( long nX, long nY, SalColor nSalColor ); + virtual void drawLine( long nX1, long nY1, long nX2, long nY2 ); + virtual void drawRect( long nX, long nY, long nWidth, long nHeight ); + virtual void drawPolyLine( sal_uLong nPoints, const SalPoint* pPtAry ); + virtual void drawPolygon( sal_uLong nPoints, const SalPoint* pPtAry ); + virtual void drawPolyPolygon( sal_uLong nPoly, const sal_uLong* pPoints, PCONSTSALPOINT* pPtAry ); + virtual bool drawPolyPolygon( const ::basegfx::B2DPolyPolygon&, double fTransparency ); + virtual sal_Bool drawPolyLineBezier( sal_uLong nPoints, const SalPoint* pPtAry, const sal_uInt8* pFlgAry ); + virtual sal_Bool drawPolygonBezier( sal_uLong nPoints, const SalPoint* pPtAry, const sal_uInt8* pFlgAry ); + virtual sal_Bool drawPolyPolygonBezier( sal_uLong nPoly, const sal_uLong* pPoints, const SalPoint* const* pPtAry, const sal_uInt8* const* pFlgAry ); + virtual bool drawPolyLine( const ::basegfx::B2DPolygon&, double fTransparency, const ::basegfx::B2DVector& rLineWidths, basegfx::B2DLineJoin ); + + // CopyArea --> No RasterOp, but ClipRegion + virtual void copyArea( long nDestX, long nDestY, long nSrcX, long nSrcY, long nSrcWidth, + long nSrcHeight, sal_uInt16 nFlags ); + + // CopyBits and DrawBitmap --> RasterOp and ClipRegion + // CopyBits() --> pSrcGraphics == NULL, then CopyBits on same Graphics + virtual void copyBits( const SalTwoRect* pPosAry, SalGraphics* pSrcGraphics ); + virtual void drawBitmap( const SalTwoRect* pPosAry, const SalBitmap& rSalBitmap ); + virtual void drawBitmap( const SalTwoRect* pPosAry, + const SalBitmap& rSalBitmap, + SalColor nTransparentColor ); + virtual void drawBitmap( const SalTwoRect* pPosAry, + const SalBitmap& rSalBitmap, + const SalBitmap& rTransparentBitmap ); + virtual void drawMask( const SalTwoRect* pPosAry, + const SalBitmap& rSalBitmap, + SalColor nMaskColor ); + + virtual SalBitmap* getBitmap( long nX, long nY, long nWidth, long nHeight ); + virtual SalColor getPixel( long nX, long nY ); + + // invert --> ClipRegion (only Windows or VirDevs) + virtual void invert( long nX, long nY, long nWidth, long nHeight, SalInvert nFlags); + virtual void invert( sal_uLong nPoints, const SalPoint* pPtAry, SalInvert nFlags ); + + virtual sal_Bool drawEPS( long nX, long nY, long nWidth, long nHeight, void* pPtr, sal_uLong nSize ); + + virtual bool drawAlphaBitmap( const SalTwoRect&, + const SalBitmap& rSourceBitmap, + const SalBitmap& rAlphaBitmap ); + + virtual bool drawAlphaRect( long nX, long nY, long nWidth, + long nHeight, sal_uInt8 nTransparency ); + + CGPoint* makeCGptArray(sal_uLong nPoints, const SalPoint* pPtAry); + // native widget rendering methods that require mirroring + virtual sal_Bool hitTestNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, + const Point& aPos, sal_Bool& rIsInside ); + virtual sal_Bool drawNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, + ControlState nState, const ImplControlValue& aValue, + const rtl::OUString& aCaption ); + virtual sal_Bool drawNativeControlText( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, + ControlState nState, const ImplControlValue& aValue, + const rtl::OUString& aCaption ); + virtual sal_Bool getNativeControlRegion( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, ControlState nState, + const ImplControlValue& aValue, const rtl::OUString& aCaption, + Rectangle &rNativeBoundingRegion, Rectangle &rNativeContentRegion ); + + // get device resolution + virtual void GetResolution( long& rDPIX, long& rDPIY ); + // get the depth of the device + virtual sal_uInt16 GetBitCount() const; + // get the width of the device + virtual long GetGraphicsWidth() const; + + // set the clip region to empty + virtual void ResetClipRegion(); + + // set the line color to transparent (= don't draw lines) + virtual void SetLineColor(); + // set the line color to a specific color + virtual void SetLineColor( SalColor nSalColor ); + // set the fill color to transparent (= don't fill) + virtual void SetFillColor(); + // set the fill color to a specific color, shapes will be + // filled accordingly + virtual void SetFillColor( SalColor nSalColor ); + // enable/disable XOR drawing + virtual void SetXORMode( bool bSet, bool bInvertOnly ); + // set line color for raster operations + virtual void SetROPLineColor( SalROPColor nROPColor ); + // set fill color for raster operations + virtual void SetROPFillColor( SalROPColor nROPColor ); + // set the text color to a specific color + virtual void SetTextColor( SalColor nSalColor ); + // set the font + virtual sal_uInt16 SetFont( ImplFontSelectData*, int nFallbackLevel ); + // get the current font's etrics + virtual void GetFontMetric( ImplFontMetricData*, int nFallbackLevel ); + // get kernign pairs of the current font + // return only PairCount if (pKernPairs == NULL) + virtual sal_uLong GetKernPairs( sal_uLong nPairs, ImplKernPairData* pKernPairs ); + // get the repertoire of the current font + virtual const ImplFontCharMap* GetImplFontCharMap() const; + virtual bool GetImplFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const; + // graphics must fill supplied font list + virtual void GetDevFontList( ImplDevFontList* ); + // graphics should call ImplAddDevFontSubstitute on supplied + // OutputDevice for all its device specific preferred font substitutions + virtual void GetDevFontSubstList( OutputDevice* ); + virtual bool AddTempDevFont( ImplDevFontList*, const String& rFileURL, const String& rFontName ); + // CreateFontSubset: a method to get a subset of glyhps of a font + // inside a new valid font file + // returns TRUE if creation of subset was successfull + // parameters: rToFile: contains a osl file URL to write the subset to + // pFont: describes from which font to create a subset + // pGlyphIDs: the glyph ids to be extracted + // pEncoding: the character code corresponding to each glyph + // pWidths: the advance widths of the correspoding glyphs (in PS font units) + // nGlyphs: the number of glyphs + // rInfo: additional outgoing information + // implementation note: encoding 0 with glyph id 0 should be added implicitly + // as "undefined character" + virtual sal_Bool CreateFontSubset( const rtl::OUString& rToFile, + const ImplFontData* pFont, + long* pGlyphIDs, + sal_uInt8* pEncoding, + sal_Int32* pWidths, + int nGlyphs, + FontSubsetInfo& rInfo // out parameter + ); + + // GetFontEncodingVector: a method to get the encoding map Unicode + // to font encoded character; this is only used for type1 fonts and + // may return NULL in case of unknown encoding vector + // if ppNonEncoded is set and non encoded characters (that is type1 + // glyphs with only a name) exist it is set to the corresponding + // map for non encoded glyphs; the encoding vector contains -1 + // as encoding for these cases + virtual const Ucs2SIntMap* GetFontEncodingVector( const ImplFontData*, const Ucs2OStrMap** ppNonEncoded ); + + // GetEmbedFontData: gets the font data for a font marked + // embeddable by GetDevFontList or NULL in case of error + // parameters: pFont: describes the font in question + // pWidths: the widths of all glyphs from char code 0 to 255 + // pWidths MUST support at least 256 members; + // rInfo: additional outgoing information + // pDataLen: out parameter, contains the byte length of the returned buffer + virtual const void* GetEmbedFontData( const ImplFontData*, + const sal_Ucs* pUnicodes, + sal_Int32* pWidths, + FontSubsetInfo& rInfo, + long* pDataLen ); + // frees the font data again + virtual void FreeEmbedFontData( const void* pData, long nDataLen ); + + virtual void GetGlyphWidths( const ImplFontData*, + bool bVertical, + Int32Vector& rWidths, + Ucs2UIntMap& rUnicodeEnc ); + + virtual sal_Bool GetGlyphBoundRect( sal_GlyphId nIndex, Rectangle& ); + virtual sal_Bool GetGlyphOutline( sal_GlyphId nIndex, basegfx::B2DPolyPolygon& ); + + virtual SalLayout* GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ); + virtual void DrawServerFontLayout( const ServerFontLayout& ); + virtual bool supportsOperation( OutDevSupportType ) const; + + // Query the platform layer for control support + virtual sal_Bool IsNativeControlSupported( ControlType nType, ControlPart nPart ); + + virtual SystemGraphicsData GetGraphicsData() const; + virtual SystemFontData GetSysFontData( int /* nFallbacklevel */ ) const; + +private: + // differences between VCL, Quartz and kHiThemeOrientation coordinate systems + // make some graphics seem to be vertically-mirrored from a VCL perspective + bool IsFlipped() const { return mbWindow; } + + void ApplyXorContext(); + void Pattern50Fill(); + UInt32 getState( ControlState nState ); + UInt32 getTrackState( ControlState nState ); +}; + +class XorEmulation +{ +public: + XorEmulation(); + /*final*/ ~XorEmulation(); + + void SetTarget( int nWidth, int nHeight, int nBitmapDepth, CGContextRef, CGLayerRef ); + bool UpdateTarget(); + void Enable() { mbIsEnabled = true; } + void Disable() { mbIsEnabled = false; } + bool IsEnabled() const { return mbIsEnabled; } + CGContextRef GetTargetContext() const { return mxTargetContext; } + CGContextRef GetMaskContext() const { return (mbIsEnabled ? mxMaskContext : NULL); } + +private: + CGLayerRef mxTargetLayer; + CGContextRef mxTargetContext; + CGContextRef mxMaskContext; + CGContextRef mxTempContext; + sal_uLong* mpMaskBuffer; + sal_uLong* mpTempBuffer; + int mnBufferLongs; + bool mbIsEnabled; +}; + + +// --- some trivial inlines + +inline void IosSalGraphics::RefreshRect( const CGRect& rRect ) +{ + RefreshRect( rRect.origin.x, rRect.origin.y, rRect.size.width, rRect.size.height ); +} + +inline RGBAColor::RGBAColor( SalColor nSalColor ) +: mfRed( SALCOLOR_RED(nSalColor) * (1.0/255)) +, mfGreen( SALCOLOR_GREEN(nSalColor) * (1.0/255)) +, mfBlue( SALCOLOR_BLUE(nSalColor) * (1.0/255)) +, mfAlpha( 1.0 ) // opaque +{} + +inline RGBAColor::RGBAColor( float fRed, float fGreen, float fBlue, float fAlpha ) +: mfRed( fRed ) +, mfGreen( fGreen ) +, mfBlue( fBlue ) +, mfAlpha( fAlpha ) +{} + +#endif // _SV_SALGDI_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/ios/salinst.h b/vcl/inc/ios/salinst.h new file mode 100644 index 000000000000..9983804bf665 --- /dev/null +++ b/vcl/inc/ios/salinst.h @@ -0,0 +1,199 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef _SV_SALINST_H +#define _SV_SALINST_H + +#include "osl/mutex.hxx" +#include "osl/thread.hxx" +#include "osl/conditn.h" +#include <vcl/solarmutex.hxx> + +#include "ios/iosvcltypes.h" + +#include "salinst.hxx" + +#include <list> + +class IosSalFrame; +class ApplicationEvent; +class Image; + +// ----------------- +// - SalYieldMutex - +// ----------------- + +class SalYieldMutex : public vcl::SolarMutexObject +{ + sal_uLong mnCount; + oslThreadIdentifier mnThreadId; + +public: + SalYieldMutex(); + virtual void acquire(); + virtual void release(); + virtual sal_Bool tryToAcquire(); + sal_uLong GetAcquireCount() const { return mnCount; } + oslThreadIdentifier GetThreadId() const { return mnThreadId; } +}; + +#define YIELD_GUARD osl::SolarGuard aGuard( GetSalData()->mpFirstInstance->GetYieldMutex() ) + + +// ------------------- +// - SalInstanceData - +// ------------------- + +//struct SalInstanceData +//{ +//public: +//}; + +// ------------------ +// - IosSalInstance - +// ------------------ + +class IosSalInstance : public SalInstance +{ + struct SalUserEvent + { + IosSalFrame* mpFrame; + void* mpData; + sal_uInt16 mnType; + + SalUserEvent( IosSalFrame* pFrame, void* pData, sal_uInt16 nType ) : + mpFrame( pFrame ), mpData( pData ), mnType( nType ) + {} + }; + +public: + SalYieldMutex* mpSalYieldMutex; + rtl::OUString maDefaultPrinter; + oslThreadIdentifier maMainThread; + bool mbWaitingYield; + int mnActivePrintJobs; + std::list< SalUserEvent > maUserEvents; + oslMutex maUserEventListMutex; + oslCondition maWaitingYieldCond; + + typedef std::list<const ApplicationEvent*> AppEventList; + static AppEventList aAppEventList; + +public: + IosSalInstance(); + virtual ~IosSalInstance(); + + virtual SalSystem* CreateSystem(); + virtual void DestroySystem(SalSystem*); + virtual SalFrame* CreateChildFrame( SystemParentData* pParent, sal_uLong nStyle ); + virtual SalFrame* CreateFrame( SalFrame* pParent, sal_uLong nStyle ); + virtual void DestroyFrame( SalFrame* pFrame ); + virtual SalObject* CreateObject( SalFrame* pParent, SystemWindowData* pWindowData, sal_Bool bShow = sal_True ); + virtual void DestroyObject( SalObject* pObject ); + virtual SalVirtualDevice* CreateVirtualDevice( SalGraphics* pGraphics, + long nDX, long nDY, + sal_uInt16 nBitCount, const SystemGraphicsData *pData ); + virtual void DestroyVirtualDevice( SalVirtualDevice* pDevice ); + + virtual SalInfoPrinter* CreateInfoPrinter( SalPrinterQueueInfo* pQueueInfo, + ImplJobSetup* pSetupData ); + virtual void DestroyInfoPrinter( SalInfoPrinter* pPrinter ); + virtual SalPrinter* CreatePrinter( SalInfoPrinter* pInfoPrinter ); + virtual void DestroyPrinter( SalPrinter* pPrinter ); + virtual void GetPrinterQueueInfo( ImplPrnQueueList* pList ); + virtual void GetPrinterQueueState( SalPrinterQueueInfo* pInfo ); + virtual void DeletePrinterQueueInfo( SalPrinterQueueInfo* pInfo ); + virtual String GetDefaultPrinter(); + virtual SalTimer* CreateSalTimer(); + virtual SalI18NImeStatus* CreateI18NImeStatus(); + virtual SalSystem* CreateSalSystem(); + virtual SalBitmap* CreateSalBitmap(); + virtual osl::SolarMutex* GetYieldMutex(); + virtual sal_uLong ReleaseYieldMutex(); + virtual void AcquireYieldMutex( sal_uLong nCount ); + virtual bool CheckYieldMutex(); + virtual void Yield( bool bWait, bool bHandleAllCurrentEvents ); + virtual bool AnyInput( sal_uInt16 nType ); + virtual SalMenu* CreateMenu( sal_Bool bMenuBar, Menu* pVCLMenu ); + virtual void DestroyMenu( SalMenu* ); + virtual SalMenuItem* CreateMenuItem( const SalItemParams* pItemData ); + virtual void DestroyMenuItem( SalMenuItem* ); + virtual SalSession* CreateSalSession(); + virtual void* GetConnectionIdentifier( ConnectionIdentifierType& rReturnedType, int& rReturnedBytes ); + virtual void AddToRecentDocumentList(const rtl::OUString& rFileUrl, const rtl::OUString& rMimeType); + virtual void SetEventCallback( void* pInstance, bool(*pCallback)(void*,void*,int) ); + virtual void SetErrorEventCallback( void* pInstance, bool(*pCallback)(void*,void*,int) ); + + // dtrans implementation + virtual com::sun::star::uno::Reference< com::sun::star::uno::XInterface > + CreateClipboard( const com::sun::star::uno::Sequence< com::sun::star::uno::Any >& i_rArguments ); + virtual com::sun::star::uno::Reference< com::sun::star::uno::XInterface > CreateDragSource(); + virtual com::sun::star::uno::Reference< com::sun::star::uno::XInterface > CreateDropTarget(); + + void wakeupYield(); + + public: + friend class IosSalFrame; + + void PostUserEvent( IosSalFrame* pFrame, sal_uInt16 nType, void* pData ); + void delayedSettingsChanged( bool bInvalidate ); + + bool isUIAppThread() const; + + void startedPrintJob() { mnActivePrintJobs++; } + void endedPrintJob() { mnActivePrintJobs--; } + + // event subtypes for NSApplicationDefined events + static const short AppExecuteSVMain = 0x7fff; + static const short AppEndLoopEvent = 1; + static const short AppStartTimerEvent = 10; + static const short AppleRemoteEvent = 15; + static const short YieldWakeupEvent = 20; +}; + +// helper class: inverted solar guard +class YieldMutexReleaser +{ + sal_uLong mnCount; + public: + YieldMutexReleaser(); + ~YieldMutexReleaser(); +}; + +// helper class +rtl::OUString GetOUString( CFStringRef ); +rtl::OUString GetOUString( NSString* ); +CFStringRef CreateCFString( const rtl::OUString& ); +NSString* CreateNSString( const rtl::OUString& ); + +CGImageRef CreateCGImage( const Image& ); +UIImage* CreateUIImage( const Image& ); + +#endif // _SV_SALINST_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/ios/salmathutils.hxx b/vcl/inc/ios/salmathutils.hxx new file mode 100644 index 000000000000..e81f68e46b0b --- /dev/null +++ b/vcl/inc/ios/salmathutils.hxx @@ -0,0 +1,90 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef _SV_SALMATHUTILS_HXX +#define _SV_SALMATHUTILS_HXX + +#ifdef __cplusplus +extern "C" { +#endif + +// ------------------------------------------------------------------ +// +// Structures +// +// ------------------------------------------------------------------ + +// LRectCoor is an abreviation for rectangular coordinates +// represented as long integers + +struct LRectCoor +{ + long x; + long y; + long z; +}; + +// ------------------------------------------------------------------ +// +// Type Definitions +// +// ------------------------------------------------------------------ + +// LRectCoorVec is an abreviation for vectors in rectangular +// coordinates represented as long integers + +typedef struct LRectCoor LRectCoor; +typedef LRectCoor *LRectCoorVector; +typedef LRectCoorVector *LRectCoorTensor; + +// ------------------------------------------------------------------ +// +// Function Headers +// +// ------------------------------------------------------------------ + +void CSwap ( char &rX, char &rY ); +void UCSwap ( unsigned char &rX, unsigned char &rY ); +void SSwap ( short &rX, short &rY ); +void USSwap ( unsigned short &rX, unsigned short &rY ); +void LSwap ( long &rX, long &rY ); +void ULSwap ( unsigned long &rX, unsigned long &rY ); + +// ------------------------------------------------------------------ + +unsigned long Euclidian2Norm ( const LRectCoorVector pVec ); + +// ------------------------------------------------------------------ + +#ifdef __cplusplus +} +#endif + +#endif // _SV_SALMATHUTILS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/ios/salmenu.h b/vcl/inc/ios/salmenu.h new file mode 100644 index 000000000000..3f143ac1d976 --- /dev/null +++ b/vcl/inc/ios/salmenu.h @@ -0,0 +1,122 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef _SV_SALMENU_H +#define _SV_SALMENU_H + +#include "premac.h" +#include <UIKit/UIKit.h> +#include "postmac.h" + +#include "salmenu.hxx" + +#include <vector> + +class IosSalFrame; +class IosSalMenuItem; + +class IosSalMenu : public SalMenu +{ + std::vector< IosSalMenuItem* > maItems; + +public: // for OOStatusView + struct MenuBarButtonEntry + { + SalMenuButtonItem maButton; + UIImage* mpUIImage; // cached image + NSString* mpToolTipString; + + MenuBarButtonEntry() : mpUIImage( nil ), mpToolTipString( nil ) {} + MenuBarButtonEntry( const SalMenuButtonItem& i_rItem ) + : maButton( i_rItem), mpUIImage( nil ), mpToolTipString( nil ) {} + }; +private: + std::vector< MenuBarButtonEntry > maButtons; + + MenuBarButtonEntry* findButtonItem( sal_uInt16 i_nItemId ); + void releaseButtonEntry( MenuBarButtonEntry& i_rEntry ); + static void statusLayout(); +public: + IosSalMenu( bool bMenuBar ); + virtual ~IosSalMenu(); + + virtual sal_Bool VisibleMenuBar(); // must return TRUE to actually DISPLAY native menu bars + // otherwise only menu messages are processed (eg, OLE on Windows) + + virtual void InsertItem( SalMenuItem* pSalMenuItem, unsigned nPos ); + virtual void RemoveItem( unsigned nPos ); + virtual void SetSubMenu( SalMenuItem* pSalMenuItem, SalMenu* pSubMenu, unsigned nPos ); + virtual void SetFrame( const SalFrame* pFrame ); + virtual void CheckItem( unsigned nPos, sal_Bool bCheck ); + virtual void EnableItem( unsigned nPos, sal_Bool bEnable ); + virtual void SetItemText( unsigned nPos, SalMenuItem* pSalMenuItem, const XubString& rText ); + virtual void SetItemImage( unsigned nPos, SalMenuItem* pSalMenuItem, const Image& rImage); + virtual void GetSystemMenuData( SystemMenuData* pData ); + virtual bool ShowNativePopupMenu(FloatingWindow * pWin, const Rectangle& rRect, sal_uLong nFlags); + virtual bool AddMenuBarButton( const SalMenuButtonItem& ); + virtual void RemoveMenuBarButton( sal_uInt16 nId ); + virtual Rectangle GetMenuBarButtonRectPixel( sal_uInt16 i_nItemId, SalFrame* i_pReferenceFrame ); + + int getItemIndexByPos( sal_uInt16 nPos ) const; + const IosSalFrame* getFrame() const; + + void setMainMenu(); + static void unsetMainMenu(); + static void setDefaultMenu(); + static void enableMainMenu( bool bEnable ); + static void addFallbackMenuItem( UIMenuItem* NewItem ); + static void removeFallbackMenuItem( UIMenuItem* pOldItem ); + + const std::vector< MenuBarButtonEntry >& getButtons() const { return maButtons; } + + bool mbMenuBar; // true - Menubar, false - Menu + UIMenuController* mpMenu; + Menu* mpVCLMenu; // the corresponding vcl Menu object + const IosSalFrame* mpFrame; // the frame to dispatch the menu events to + IosSalMenu* mpParentSalMenu; // the parent menu that contains us (and perhaps has a frame) + + static const IosSalMenu* pCurrentMenuBar; + +}; + +class IosSalMenuItem : public SalMenuItem +{ +public: + IosSalMenuItem( const SalItemParams* ); + virtual ~IosSalMenuItem(); + + sal_uInt16 mnId; // Item ID + Menu* mpVCLMenu; // VCL Menu into which this MenuItem is inserted + IosSalMenu* mpParentMenu; // The menu in which this menu item is inserted + IosSalMenu* mpSubMenu; // Sub menu of this item (if defined) + UIMenuItem* mpMenuItem; // The UIMenuItem +}; + +#endif // _SV_SALMENU_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/rsc/source/rscpp/cppmain.c b/vcl/inc/ios/salnstimer.h index 144576e2846b..cf98276747ee 100644 --- a/rsc/source/rscpp/cppmain.c +++ b/vcl/inc/ios/salnstimer.h @@ -25,19 +25,19 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ +#ifndef _VCL_SALNSTIMER_H +#define _VCL_SALNSTIMER_H -#define NOMAIN +#include "premac.h" +#include <Foundation/Foundation.h> +#include "postmac.h" -#include <stdio.h> -#include <ctype.h> -#include "cppdef.h" -#include "cpp.h" - -int main( argc, argv ) - int argc; - char *argv[]; +@interface TimerCallbackCaller : NSObject { - return( start_cpp( argc, argv ) ); } +-(void)timerElapsed:(NSTimer*)pTimer; +@end + +#endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/ios/salobj.h b/vcl/inc/ios/salobj.h new file mode 100644 index 000000000000..3203a0d46e93 --- /dev/null +++ b/vcl/inc/ios/salobj.h @@ -0,0 +1,86 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef _SV_SALOBJ_H +#define _SV_SALOBJ_H + +#include "vcl/sysdata.hxx" +#include "salobj.hxx" + +class IosSalFrame; +class IosSalObject; + + +// ----------------- +// - SalObjectData - +// ----------------- + +struct SalObjectData +{ +}; + +class IosSalObject : public SalObject +{ +public: + IosSalFrame* mpFrame; // parent frame + SystemEnvData maSysData; + + long mnClipX; + long mnClipY; + long mnClipWidth; + long mnClipHeight; + bool mbClip; + + long mnX; + long mnY; + long mnWidth; + long mnHeight; + + void setClippedPosSize(); + + IosSalObject( IosSalFrame* pFrame ); + virtual ~IosSalObject(); + + virtual void ResetClipRegion(); + virtual sal_uInt16 GetClipRegionType(); + virtual void BeginSetClipRegion( sal_uLong nRects ); + virtual void UnionClipRegion( long nX, long nY, long nWidth, long nHeight ); + virtual void EndSetClipRegion(); + virtual void SetPosSize( long nX, long nY, long nWidth, long nHeight ); + virtual void Show( sal_Bool bVisible ); + virtual void Enable( sal_Bool nEnable ); + virtual void GrabFocus(); + virtual void SetBackground(); + virtual void SetBackground( SalColor nSalColor ); + virtual const SystemEnvData* GetSystemData() const; + virtual void InterceptChildWindowKeyDown( sal_Bool bIntercept ); +}; + +#endif // _SV_SALOBJ_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/ios/salprn.h b/vcl/inc/ios/salprn.h new file mode 100644 index 000000000000..cd90a0f881df --- /dev/null +++ b/vcl/inc/ios/salprn.h @@ -0,0 +1,173 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef _SV_SALPRN_H +#define _SV_SALPRN_H + +#include "ios/iosvcltypes.h" + +#include "salprn.hxx" + +#include <boost/shared_array.hpp> + + +// --------------------- +// - IosSalInfoPrinter - +// --------------------- + +class IosSalGraphics; + +class IosSalInfoPrinter : public SalInfoPrinter +{ + /// Printer graphics + IosSalGraphics* mpGraphics; + /// is Graphics used + bool mbGraphics; + /// job active ? + bool mbJob; + + UIPrintFormatter* mpPrinter; + /// cocoa print info object + UIPrintInfo* mpPrintInfo; + + /// FIXME: get real printer context for infoprinter if possible + /// fake context for info printer + /// graphics context for Quartz 2D + CGContextRef mrContext; + /// memory for graphics bitmap context for querying metrics + boost::shared_array< sal_uInt8 > maContextMemory; + + // since changes to UIPrintInfo during a job are ignored + // we have to care for some settings ourselves + // currently we do this for orientation; + // really needed however is a solution for paper formats + Orientation mePageOrientation; + + int mnStartPageOffsetX; + int mnStartPageOffsetY; + sal_Int32 mnCurPageRangeStart; + sal_Int32 mnCurPageRangeCount; + + public: + IosSalInfoPrinter( const SalPrinterQueueInfo& pInfo ); + virtual ~IosSalInfoPrinter(); + + void SetupPrinterGraphics( CGContextRef i_xContext ) const; + + virtual SalGraphics* GetGraphics(); + virtual void ReleaseGraphics( SalGraphics* i_pGraphics ); + virtual sal_Bool Setup( SalFrame* i_pFrame, ImplJobSetup* i_pSetupData ); + virtual sal_Bool SetPrinterData( ImplJobSetup* pSetupData ); + virtual sal_Bool SetData( sal_uLong i_nFlags, ImplJobSetup* i_pSetupData ); + virtual void GetPageInfo( const ImplJobSetup* i_pSetupData, + long& o_rOutWidth, long& o_rOutHeight, + long& o_rPageOffX, long& o_rPageOffY, + long& o_rPageWidth, long& o_rPageHeight ); + virtual sal_uLong GetCapabilities( const ImplJobSetup* i_pSetupData, sal_uInt16 i_nType ); + virtual sal_uLong GetPaperBinCount( const ImplJobSetup* i_pSetupData ); + virtual String GetPaperBinName( const ImplJobSetup* i_pSetupData, sal_uLong i_nPaperBin ); + virtual void InitPaperFormats( const ImplJobSetup* i_pSetupData ); + virtual int GetLandscapeAngle( const ImplJobSetup* i_pSetupData ); + + // the artificial separation between InfoPrinter and Printer + // is not really useful for us + // so let's make IosSalPrinter just a forwarder to IosSalInfoPrinter + // and concentrate the real work in one class + // implement pull model print system + sal_Bool StartJob( const String* i_pFileName, + const String& rJobName, + const String& i_rAppName, + ImplJobSetup* i_pSetupData, + vcl::PrinterController& i_rController ); + sal_Bool EndJob(); + sal_Bool AbortJob(); + SalGraphics* StartPage( ImplJobSetup* i_pSetupData, sal_Bool i_bNewJobData ); + sal_Bool EndPage(); + sal_uLong GetErrorCode() const; + + UIPrintInfo* getPrintInfo() const { return mpPrintInfo; } + void setStartPageOffset( int nOffsetX, int nOffsetY ) { mnStartPageOffsetX = nOffsetX; mnStartPageOffsetY = nOffsetY; } + sal_Int32 getCurPageRangeStart() const { return mnCurPageRangeStart; } + sal_Int32 getCurPageRangeCount() const { return mnCurPageRangeCount; } + + // match width/height against known paper formats, possibly switching orientation + const PaperInfo* matchPaper( long i_nWidth, long i_nHeight, Orientation& o_rOrientation ) const; + void setPaperSize( long i_nWidth, long i_nHeight, Orientation i_eSetOrientation ); + + private: + IosSalInfoPrinter( const IosSalInfoPrinter& ); + IosSalInfoPrinter& operator=(const IosSalInfoPrinter&); +}; + +// ----------------- +// - IosSalPrinter - +// ----------------- + +class IosSalPrinter : public SalPrinter +{ + IosSalInfoPrinter* mpInfoPrinter; // pointer to the compatible InfoPrinter + public: + IosSalPrinter( IosSalInfoPrinter* i_pInfoPrinter ); + virtual ~IosSalPrinter(); + + virtual sal_Bool StartJob( const XubString* i_pFileName, + const XubString& i_rJobName, + const XubString& i_rAppName, + sal_uLong i_nCopies, + bool i_bCollate, + bool i_bDirect, + ImplJobSetup* i_pSetupData ); + // implement pull model print system + virtual sal_Bool StartJob( const String* i_pFileName, + const String& rJobName, + const String& i_rAppName, + ImplJobSetup* i_pSetupData, + vcl::PrinterController& i_rListener ); + + virtual sal_Bool EndJob(); + virtual sal_Bool AbortJob(); + virtual SalGraphics* StartPage( ImplJobSetup* i_pSetupData, sal_Bool i_bNewJobData ); + virtual sal_Bool EndPage(); + virtual sal_uLong GetErrorCode(); + + private: + IosSalPrinter( const IosSalPrinter& ); + IosSalPrinter& operator=(const IosSalPrinter&); +}; + +const double fPtTo100thMM = 35.27777778; + +inline int PtTo10Mu( double nPoints ) { return (int)(((nPoints)*fPtTo100thMM)+0.5); } + +inline double TenMuToPt( double nUnits ) { return floor(((nUnits)/fPtTo100thMM)+0.5); } + + + +#endif // _SV_SALPRN_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/ios/salsys.h b/vcl/inc/ios/salsys.h new file mode 100644 index 000000000000..e586c8dfb356 --- /dev/null +++ b/vcl/inc/ios/salsys.h @@ -0,0 +1,56 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef _SV_SALSYS_H +#define _SV_SALSYS_H + +#include "salsys.hxx" + +class VCL_DLLPUBLIC IosSalSystem : public SalSystem +{ +public: + IosSalSystem() {} + virtual ~IosSalSystem(); + + // get info about the display + virtual unsigned int GetDisplayScreenCount(); + virtual bool IsMultiDisplay(); + virtual unsigned int GetDefaultDisplayNumber(); + virtual Rectangle GetDisplayScreenPosSizePixel( unsigned int nScreen ); + virtual Rectangle GetDisplayWorkAreaPosSizePixel( unsigned int nScreen ); + + virtual rtl::OUString GetScreenName( unsigned int nScreen ); + virtual int ShowNativeMessageBox( const String& rTitle, + const String& rMessage, + int nButtonCombination, + int nDefaultButton); +}; + +#endif // _SV_SALSYS_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/ios/saltimer.h b/vcl/inc/ios/saltimer.h new file mode 100644 index 000000000000..b5974219437d --- /dev/null +++ b/vcl/inc/ios/saltimer.h @@ -0,0 +1,54 @@ +/* -*- 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. + * +************************************************************************/ + +#ifndef _SV_SALTIMER_H +#define _SV_SALTIMER_H + +#include "premac.h" +#include <Foundation/Foundation.h> +#include "postmac.h" + +#include "saltimer.hxx" + +class IosSalTimer : public SalTimer +{ + public: + + IosSalTimer(); + virtual ~IosSalTimer(); + + void Start( sal_uLong nMS ); + void Stop(); + + static NSTimer* pRunningTimer; + static bool bDispatchTimer; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/ios/saluimenu.h b/vcl/inc/ios/saluimenu.h new file mode 100644 index 000000000000..ef54daa2d631 --- /dev/null +++ b/vcl/inc/ios/saluimenu.h @@ -0,0 +1,62 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef _VCL_SALUIMENU_H +#define _VCL_SALUIMENU_H + +class IosSalMenu; +class IosSalMenuItem; + +@interface SalUIMenu : UIMenuController +{ + /* Caution: SalNSMenu instances occasionally are binary copied + in IosSalMenu::ShowNativePopupMenu. If any members are added, + please take this into account ! + */ + IosSalMenu* mpMenu; +} +-(id)initWithMenu: (IosSalMenu*)pMenu; +-(void)menuNeedsUpdate: (UIMenuController*)pMenu; +-(void)setSalMenu: (IosSalMenu*)pMenu; +@end + +@interface SalUIMenuItem : UIMenuItem +{ + /* Caution: SalUIMenuItem instances occasionally are binary copied + in IosSalMenu::ShowNativePopupMenu. If any members are added, + please take this into account ! + */ + IosSalMenuItem* mpMenuItem; +} +-(id)initWithMenuItem: (IosSalMenuItem*)pMenuItem; +-(void)menuItemTriggered: (id)aSender; +@end + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/ios/salvd.h b/vcl/inc/ios/salvd.h new file mode 100644 index 000000000000..e116c5c45bab --- /dev/null +++ b/vcl/inc/ios/salvd.h @@ -0,0 +1,79 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef _SV_SALVD_H +#define _SV_SALVD_H + +#include "ios/salcolorutils.hxx" +#include "ios/salgdi.h" + +#include "salvd.hxx" + +#if PRAGMA_ONCE + #pragma once +#endif + +struct SalVirDevData +{ +}; + +typedef struct SalVirDevData SalVirDevData; +typedef SalVirDevData *SalVirDevDataPtr; +typedef SalVirDevDataPtr *SalVirDevDataHandle; + +// ======================================================================= + +class IosSalGraphics; + +class IosSalVirtualDevice : public SalVirtualDevice +{ +private: + bool mbGraphicsUsed; // is Graphics used + bool mbForeignContext; // is mxContext from outside VCL + CGContextRef mxBitmapContext; + int mnBitmapDepth; + CGLayerRef mxLayer; // Quartz layer + IosSalGraphics* mpGraphics; // current VirDev graphics + + void Destroy(); + +public: + IosSalVirtualDevice( IosSalGraphics* pGraphic, long nDX, long nDY, sal_uInt16 nBitCount, const SystemGraphicsData *pData ); + virtual ~IosSalVirtualDevice(); + + virtual SalGraphics* GetGraphics(); + virtual void ReleaseGraphics( SalGraphics* pGraphics ); + virtual sal_Bool SetSize( long nNewDX, long nNewDY ); + virtual void GetSize( long& rWidth, long& rHeight ); +}; + +// ======================================================================= + +#endif // _SV_SALVD_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/ios/svsys.h b/vcl/inc/ios/svsys.h new file mode 100644 index 000000000000..a8edcab96eef --- /dev/null +++ b/vcl/inc/ios/svsys.h @@ -0,0 +1,36 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License or as specified alternatively below. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is Tor Lillqvist <tml@iki.fi> + * Portions created by the Initial Developer are Copyright (C) 2011 the + * Initial Developer. All Rights Reserved. + * + * For minor contributions see the git repository. + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#ifndef _VCL_IOS_SVSYS_H +#define _VCL_IOS_SVSYS_H + + +// ? + +#endif // _VCL_IOS_SVSYS_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/bootstrp/appdef.cxx b/vcl/inc/ios/vcluiapp.h index 9600272ca858..df4a01ead0de 100644 --- a/tools/bootstrp/appdef.cxx +++ b/vcl/inc/ios/vcluiapp.h @@ -26,29 +26,28 @@ * ************************************************************************/ -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_tools.hxx" +#ifndef _VCL_VCLUIAPP_H +#define _VCL_VCLUIAPP_H -#include <stdlib.h> -#include <stdio.h> -#include <string.h> +#include "premac.h" +#include "UIKit/UIKit.h" +#include "postmac.h" -#include "bootstrp/appdef.hxx" +class IosSalFrame; -const char* GetEnv( const char *pVar ) +// our very own application +@interface VCL_UIApplication : UIApplication { - char const *pRet = getenv( pVar ); - if ( !pRet ) - pRet = ""; - return pRet; } +-(void)sendEvent:(UIEvent*)pEvent; +-(void)sendSuperEvent:(UIEvent*)pEvent; +-(BOOL)application: (UIApplication*) app openFile: (NSString*)file; +-(void)application: (UIApplication*) app openFiles: (NSArray*)files; +-(void)applicationWillTerminate: (UIApplication *) app; +-(void)addFallbackMenuItem: (UIMenuItem*)pNewItem; +-(void)removeFallbackMenuItem: (UIMenuItem*)pOldItem; +@end -const char* GetEnv( const char *pVar, const char *pDefault ) -{ - char *pRet = getenv( pVar ); - if ( !pRet ) - return pDefault; - return pRet; -} +#endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/list.h b/vcl/inc/list.h index 78c7edce2839..34e9cee266b1 100644 --- a/vcl/inc/list.h +++ b/vcl/inc/list.h @@ -66,8 +66,6 @@ extern "C" int listAtLast(list); int listPosition(list); /* Expensive! */ #endif -/*- search */ - int listFind(list, void *); /* Returns true/false */ /*- positioning functions */ /*- return the number of elements by which the current position in the list changes */ @@ -75,7 +73,6 @@ extern "C" int listSkipForward(list, int n); int listToFirst(list); int listToLast(list); - int listPositionAt(list, int n); /* Expensive! */ /*- adding and removing elements */ list listAppend(list, void *); diff --git a/vcl/inc/sallayout.hxx b/vcl/inc/sallayout.hxx index b91185769b27..9c727a895581 100644 --- a/vcl/inc/sallayout.hxx +++ b/vcl/inc/sallayout.hxx @@ -149,7 +149,6 @@ sal_UCS4 GetVerticalChar( sal_UCS4 ); // #i80090# GetMirroredChar also needed outside vcl, moved to svapp.hxx // VCL_DLLPUBLIC sal_UCS4 GetMirroredChar( sal_UCS4 ); sal_UCS4 GetLocalizedChar( sal_UCS4, LanguageType ); -VCL_PLUGIN_PUBLIC const char* GetAutofallback( sal_UCS4 ) ; // ------------- // - SalLayout - diff --git a/vcl/inc/saltimer.hxx b/vcl/inc/saltimer.hxx index 38dd20e69ff3..11a90dc24bf1 100644 --- a/vcl/inc/saltimer.hxx +++ b/vcl/inc/saltimer.hxx @@ -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. @@ -67,3 +68,5 @@ public: }; #endif // _SV_SALTIMER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/svsys.h b/vcl/inc/svsys.h index df0b58c548ca..0976282bc898 100644 --- a/vcl/inc/svsys.h +++ b/vcl/inc/svsys.h @@ -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. @@ -34,9 +35,15 @@ #include "aqua/svsys.h" #elif defined OS2 #include "os2/svsys.h" +#elif defined IOS +#include "ios/svsys.h" +#elif defined ANDROID +#include "android/svsys.h" #else #include "unx/svsys.h" #endif #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/Xproto.h b/vcl/inc/unx/Xproto.h index 804b3ffa98cc..b6db98dbfe15 100644 --- a/vcl/inc/unx/Xproto.h +++ b/vcl/inc/unx/Xproto.h @@ -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. @@ -47,3 +48,5 @@ #include <tools/postx.h> #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/gtk/gtkdata.hxx b/vcl/inc/unx/gtk/gtkdata.hxx index 307a3f2b3e01..24860b8f80df 100644 --- a/vcl/inc/unx/gtk/gtkdata.hxx +++ b/vcl/inc/unx/gtk/gtkdata.hxx @@ -93,9 +93,8 @@ class GtkSalDisplay : public SalDisplay GdkDisplay* m_pGdkDisplay; GdkCursor *m_aCursors[ POINTER_COUNT ]; bool m_bStartupCompleted; - std::vector< int > m_aXineramaScreenIndexMap; - GdkCursor* getFromXPM( const unsigned char *pBitmap, const unsigned char *pMask, + GdkCursor* getFromXBM( const unsigned char *pBitmap, const unsigned char *pMask, int nWidth, int nHeight, int nXHot, int nYHot ); public: GtkSalDisplay( GdkDisplay* pDisplay ); diff --git a/vcl/inc/unx/gtk/gtkframe.hxx b/vcl/inc/unx/gtk/gtkframe.hxx index 6caf39dc9644..78aea06017a8 100644 --- a/vcl/inc/unx/gtk/gtkframe.hxx +++ b/vcl/inc/unx/gtk/gtkframe.hxx @@ -30,6 +30,7 @@ #define _VCL_GTKFRAME_HXX #include <tools/prex.h> +#include <cairo/cairo.h> #include <gdk/gdk.h> #include <gdk/gdkx.h> #include <gtk/gtk.h> diff --git a/vcl/inc/unx/gtk/gtkgdi.hxx b/vcl/inc/unx/gtk/gtkgdi.hxx index 41e500c49027..83d4aa827da9 100644 --- a/vcl/inc/unx/gtk/gtkgdi.hxx +++ b/vcl/inc/unx/gtk/gtkgdi.hxx @@ -39,6 +39,8 @@ #if GTK_CHECK_VERSION(3,0,0) +#include <unx/headless/svpgdi.hxx> + // Disabled for gtk3 - use legacy theming code #define GTK_GRAPHICS_DISABLED class GtkSalFrame; @@ -46,7 +48,6 @@ class GtkSalGraphics : public X11SalGraphics { public: GtkSalGraphics( GtkSalFrame *pFrame, GtkWidget *pWindow ); }; - #else class GtkSalGraphics : public X11SalGraphics diff --git a/vcl/unx/headless/svpbmp.hxx b/vcl/inc/unx/headless/svpbmp.hxx index b3adb3b9951f..b3adb3b9951f 100644 --- a/vcl/unx/headless/svpbmp.hxx +++ b/vcl/inc/unx/headless/svpbmp.hxx diff --git a/vcl/unx/headless/svpdummies.hxx b/vcl/inc/unx/headless/svpdummies.hxx index bc46e9b22f70..bc46e9b22f70 100644 --- a/vcl/unx/headless/svpdummies.hxx +++ b/vcl/inc/unx/headless/svpdummies.hxx diff --git a/vcl/unx/headless/svpelement.hxx b/vcl/inc/unx/headless/svpelement.hxx index c7f647cf3a03..c7f647cf3a03 100644 --- a/vcl/unx/headless/svpelement.hxx +++ b/vcl/inc/unx/headless/svpelement.hxx diff --git a/vcl/unx/headless/svpframe.hxx b/vcl/inc/unx/headless/svpframe.hxx index e57381780f61..e57381780f61 100644 --- a/vcl/unx/headless/svpframe.hxx +++ b/vcl/inc/unx/headless/svpframe.hxx diff --git a/vcl/unx/headless/svpgdi.hxx b/vcl/inc/unx/headless/svpgdi.hxx index 8291a3c2f7bc..8291a3c2f7bc 100644 --- a/vcl/unx/headless/svpgdi.hxx +++ b/vcl/inc/unx/headless/svpgdi.hxx diff --git a/vcl/unx/headless/svpinst.hxx b/vcl/inc/unx/headless/svpinst.hxx index 6fcafe0c7f66..6fcafe0c7f66 100644 --- a/vcl/unx/headless/svpinst.hxx +++ b/vcl/inc/unx/headless/svpinst.hxx diff --git a/vcl/unx/headless/svpprn.hxx b/vcl/inc/unx/headless/svpprn.hxx index f7e6a671f4b3..f7e6a671f4b3 100644 --- a/vcl/unx/headless/svpprn.hxx +++ b/vcl/inc/unx/headless/svpprn.hxx diff --git a/vcl/unx/headless/svppspgraphics.hxx b/vcl/inc/unx/headless/svppspgraphics.hxx index 1ce9109918d5..1ce9109918d5 100644 --- a/vcl/unx/headless/svppspgraphics.hxx +++ b/vcl/inc/unx/headless/svppspgraphics.hxx diff --git a/vcl/unx/headless/svpvd.hxx b/vcl/inc/unx/headless/svpvd.hxx index 211cf36846f9..211cf36846f9 100644 --- a/vcl/unx/headless/svpvd.hxx +++ b/vcl/inc/unx/headless/svpvd.hxx diff --git a/vcl/inc/unx/salbmp.h b/vcl/inc/unx/salbmp.h index a389195308d3..0fa69ae5a72f 100644 --- a/vcl/inc/unx/salbmp.h +++ b/vcl/inc/unx/salbmp.h @@ -36,6 +36,7 @@ #include <unx/saldisp.hxx> #include <salbmp.hxx> #include <vclpluginapi.h> +#include <list> struct BitmapBuffer; class BitmapPalette; @@ -51,80 +52,118 @@ class VCLPLUG_GEN_PUBLIC X11SalBitmap : public SalBitmap { private: - static BitmapBuffer* ImplCreateDIB( const Size& rSize, - sal_uInt16 nBitCount, - const BitmapPalette& rPal ); - static BitmapBuffer* ImplCreateDIB( Drawable aDrawable, - int nScreen, - long nDrawableDepth, - long nX, long nY, - long nWidth, long nHeight, - bool bGrey ); + static BitmapBuffer* ImplCreateDIB( + const Size& rSize, + sal_uInt16 nBitCount, + const BitmapPalette& rPal + ); + + static BitmapBuffer* ImplCreateDIB( + Drawable aDrawable, + int nScreen, + long nDrawableDepth, + long nX, + long nY, + long nWidth, + long nHeight, + bool bGrey + ); public: static ImplSalBitmapCache* mpCache; - static sal_uIntPtr mnCacheInstCount; + static sal_uIntPtr mnCacheInstCount; static void ImplCreateCache(); static void ImplDestroyCache(); void ImplRemovedFromCache(); bool SnapShot (Display* pDisplay, XLIB_Window hWindow); - bool ImplCreateFromXImage( Display* pDisplay, - XLIB_Window hWindow, - int nScreen, - XImage* pImage); + bool ImplCreateFromXImage( + Display* pDisplay, + XLIB_Window hWindow, + int nScreen, + XImage* pImage + ); private: - BitmapBuffer* mpDIB; ImplSalDDB* mpDDB; bool mbGrey; public: - SAL_DLLPRIVATE bool ImplCreateFromDrawable( Drawable aDrawable, - int nScreen, - long nDrawableDepth, - long nX, long nY, - long nWidth, long nHeight ); - - SAL_DLLPRIVATE XImage* ImplCreateXImage( SalDisplay* pSalDisp, - int nScreen, long nDepth, - const SalTwoRect& rTwoRect ) const; - - SAL_DLLPRIVATE ImplSalDDB* ImplGetDDB( Drawable, int nScreen, long nDrawableDepth, - const SalTwoRect& ) const; - void ImplDraw( Drawable aDrawable, int nScreen, long nDrawableDepth, - const SalTwoRect& rTwoRect, const GC& rGC ) const; + SAL_DLLPRIVATE bool ImplCreateFromDrawable( + Drawable aDrawable, + int nScreen, + long nDrawableDepth, + long nX, + long nY, + long nWidth, + long nHeight + ); + + SAL_DLLPRIVATE XImage* ImplCreateXImage( + SalDisplay* pSalDisp, + int nScreen, + long nDepth, + const SalTwoRect& rTwoRect + ) const; + + SAL_DLLPRIVATE ImplSalDDB* ImplGetDDB( + Drawable, + int nScreen, + long nDrawableDepth, + const SalTwoRect& + ) const; + + void ImplDraw( + Drawable aDrawable, + int nScreen, + long nDrawableDepth, + const SalTwoRect& rTwoRect, + const GC& rGC + ) const; public: - X11SalBitmap(); - virtual ~X11SalBitmap(); + X11SalBitmap(); + virtual ~X11SalBitmap(); // overload pure virtual methods - virtual bool Create( const Size& rSize, - sal_uInt16 nBitCount, - const BitmapPalette& rPal ); - virtual bool Create( const SalBitmap& rSalBmp ); - virtual bool Create( const SalBitmap& rSalBmp, - SalGraphics* pGraphics ); - virtual bool Create( const SalBitmap& rSalBmp, - sal_uInt16 nNewBitCount ); - virtual bool Create( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmapCanvas > xBitmapCanvas, + virtual bool Create( + const Size& rSize, + sal_uInt16 nBitCount, + const BitmapPalette& rPal + ); + + virtual bool Create( const SalBitmap& rSalBmp ); + virtual bool Create( + const SalBitmap& rSalBmp, + SalGraphics* pGraphics + ); + + virtual bool Create( + const SalBitmap& rSalBmp, + sal_uInt16 nNewBitCount + ); + + virtual bool Create( + const ::com::sun::star::uno::Reference< + ::com::sun::star::rendering::XBitmapCanvas + > xBitmapCanvas, Size& rSize, - bool bMask = false ); + bool bMask = false + ); - virtual void Destroy(); + virtual void Destroy(); - virtual Size GetSize() const; + virtual Size GetSize() const; virtual sal_uInt16 GetBitCount() const; - virtual BitmapBuffer* AcquireBuffer( bool bReadOnly ); - virtual void ReleaseBuffer( BitmapBuffer* pBuffer, bool bReadOnly ); - virtual bool GetSystemData( BitmapSystemData& rData ); + virtual BitmapBuffer* AcquireBuffer( bool bReadOnly ); + virtual void ReleaseBuffer( BitmapBuffer* pBuffer, bool bReadOnly ); + virtual bool GetSystemData( BitmapSystemData& rData ); }; // -------------- @@ -142,49 +181,81 @@ private: ImplSalDDB() {} - static void ImplDraw( Drawable aSrcDrawable, long nSrcDrawableDepth, - Drawable aDstDrawable, long nDstDrawableDepth, - long nSrcX, long nSrcY, - long nDestWidth, long nDestHeight, - long nDestX, long nDestY, const GC& rGC ); + static void ImplDraw( + Drawable aSrcDrawable, + long nSrcDrawableDepth, + Drawable aDstDrawable, + long nDstDrawableDepth, + long nSrcX, + long nSrcY, + long nDestWidth, + long nDestHeight, + long nDestX, + long nDestY, + const GC& rGC + ); public: - ImplSalDDB( XImage* pImage, - Drawable aDrawable, int nScreen, - const SalTwoRect& rTwoRect ); - ImplSalDDB( Drawable aDrawable, - int nScreen, - long nDrawableDepth, - long nX, long nY, long nWidth, long nHeight ); - ImplSalDDB( Display* pDisplay, - XLIB_Window hWindow, - int nScreen, - XImage* pImage); + ImplSalDDB( + XImage* pImage, + Drawable aDrawable, + int nScreen, + const SalTwoRect& rTwoRect + ); + + ImplSalDDB( + Drawable aDrawable, + int nScreen, + long nDrawableDepth, + long nX, + long nY, + long nWidth, + long nHeight + ); + + ImplSalDDB( + Display* pDisplay, + XLIB_Window hWindow, + int nScreen, + XImage* pImage + ); + ~ImplSalDDB(); Pixmap ImplGetPixmap() const { return maPixmap; } long ImplGetWidth() const { return maTwoRect.mnDestWidth; } long ImplGetHeight() const { return maTwoRect.mnDestHeight; } long ImplGetDepth() const { return mnDepth; } - sal_uIntPtr ImplGetMemSize() const { return( ( maTwoRect.mnDestWidth * maTwoRect.mnDestHeight * mnDepth ) >> 3 ); } + sal_uIntPtr ImplGetMemSize() const + { + return( ( maTwoRect.mnDestWidth * maTwoRect.mnDestHeight * mnDepth ) >> 3 ); + } int ImplGetScreen() const { return mnScreen; } bool ImplMatches( int nScreen, long nDepth, const SalTwoRect& rTwoRect ) const; - void ImplDraw( Drawable aDrawable, long nDrawableDepth, - const SalTwoRect& rTwoRect, const GC& rGC ) const; + + void ImplDraw( + Drawable aDrawable, + long nDrawableDepth, + const SalTwoRect& rTwoRect, + const GC& rGC + ) const; }; // ---------------------- // - ImplSalBitmapCache - // ---------------------- +struct ImplBmpObj; + class ImplSalBitmapCache { private: + typedef ::std::list< ImplBmpObj* > BmpList_impl; - List maBmpList; - sal_uIntPtr mnTotalSize; + BmpList_impl maBmpList; + sal_uIntPtr mnTotalSize; public: @@ -198,47 +269,4 @@ public: #endif // _SV_SALBMP_HXX - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/saldata.hxx b/vcl/inc/unx/saldata.hxx index 7bce61cc9ce7..825c148cfa1f 100644 --- a/vcl/inc/unx/saldata.hxx +++ b/vcl/inc/unx/saldata.hxx @@ -46,7 +46,8 @@ class SalPrinter; // -=-= typedefs -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= #if defined LINUX || defined NETBSD || defined AIX || \ - defined FREEBSD || defined OPENBSD || defined DRAGONFLY + defined FREEBSD || defined OPENBSD || defined DRAGONFLY || \ + defined ANDROID #include <pthread.h> #else typedef unsigned int pthread_t; diff --git a/vcl/inc/unx/saldisp.hxx b/vcl/inc/unx/saldisp.hxx index 6687762c1e9d..194e050df2b0 100644 --- a/vcl/inc/unx/saldisp.hxx +++ b/vcl/inc/unx/saldisp.hxx @@ -372,7 +372,7 @@ protected: KeySym nShiftKeySym_; // first shift modifier KeySym nCtrlKeySym_; // first control modifier KeySym nMod1KeySym_; // first mod1 modifier - ByteString m_aKeyboardName; + rtl::OString m_aKeyboardName; vcl_sal::WMAdaptor* m_pWMAdaptor; DtIntegrator* m_pDtIntegrator; @@ -420,8 +420,9 @@ public: bool DispatchInternalEvent(); void PrintInfo() const; - void PrintEvent( const ByteString &rComment, - XEvent *pEvent ) const; +#ifdef DBG_UTIL + void DbgPrintDisplayEvent(const char *pComment, XEvent *pEvent) const; +#endif void Beep() const; diff --git a/vcl/inc/unx/x11_cursors/salcursors.h b/vcl/inc/unx/x11_cursors/salcursors.h index e0d34e122336..6af2c111fb57 100644 --- a/vcl/inc/unx/x11_cursors/salcursors.h +++ b/vcl/inc/unx/x11_cursors/salcursors.h @@ -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. @@ -160,3 +161,5 @@ #include "unx/x11_cursors/tblselsw_mask.h" #include "unx/x11_cursors/paintbrush_curs.h" #include "unx/x11_cursors/paintbrush_mask.h" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/accel.hxx b/vcl/inc/vcl/accel.hxx index a7bf623cb20a..79109e08cd4c 100644 --- a/vcl/inc/vcl/accel.hxx +++ b/vcl/inc/vcl/accel.hxx @@ -83,9 +83,6 @@ public: void InsertItem( sal_uInt16 nItemId, const KeyCode& rKeyCode ); void InsertItem( const ResId& rResId ); - void RemoveItem( sal_uInt16 nItemId ); - void RemoveItem( const KeyCode rKeyCode ); - void Clear(); sal_uInt16 GetCurItemId() const { return mnCurId; } const KeyCode& GetCurKeyCode() const { return maCurKeyCode; } @@ -94,22 +91,9 @@ public: sal_uInt16 GetItemCount() const; sal_uInt16 GetItemId( sal_uInt16 nPos ) const; - KeyCode GetItemKeyCode( sal_uInt16 nPos ) const; - sal_uInt16 GetItemId( const KeyCode& rKeyCode ) const; KeyCode GetKeyCode( sal_uInt16 nItemId ) const; - sal_Bool IsIdValid( sal_uInt16 nItemId ) const; - sal_Bool IsKeyCodeValid( const KeyCode rKeyCode ) const; - sal_Bool Call( const KeyCode& rKeyCode, sal_uInt16 nRepeat = 0 ); - void SetAccel( sal_uInt16 nItemId, Accelerator* pAccel ); Accelerator* GetAccel( sal_uInt16 nItemId ) const; - void SetAccel( const KeyCode rKeyCode, Accelerator* pAccel ); - Accelerator* GetAccel( const KeyCode rKeyCode ) const; - - void EnableItem( sal_uInt16 nItemId, sal_Bool bEnable = sal_True ); - sal_Bool IsItemEnabled( sal_uInt16 nItemId ) const; - void EnableItem( const KeyCode rKeyCode, sal_Bool bEnable = sal_True ); - sal_Bool IsItemEnabled( const KeyCode rKeyCode ) const; void SetHelpText( const XubString& rHelpText ) { maHelpStr = rHelpText; } const XubString& GetHelpText() const { return maHelpStr; } diff --git a/vcl/inc/vcl/animate.hxx b/vcl/inc/vcl/animate.hxx index e53a51e0e932..956f63f330f8 100644 --- a/vcl/inc/vcl/animate.hxx +++ b/vcl/inc/vcl/animate.hxx @@ -71,20 +71,25 @@ struct VCL_DLLPUBLIC AnimationBitmap Size aSizePix; long nWait; Disposal eDisposal; - sal_Bool bUserInput; + sal_Bool bUserInput; AnimationBitmap() {} - AnimationBitmap( const BitmapEx& rBmpEx, const Point& rPosPix, - const Size& rSizePix, long _nWait = 0L, - Disposal _eDisposal = DISPOSE_NOT ) : - aBmpEx ( rBmpEx ), - aPosPix ( rPosPix ), - aSizePix ( rSizePix ), - nWait ( _nWait ), - eDisposal ( _eDisposal ), - bUserInput ( sal_False ) {} - - sal_Bool operator==( const AnimationBitmap& rAnimBmp ) const + AnimationBitmap( + const BitmapEx& rBmpEx, + const Point& rPosPix, + const Size& rSizePix, + long _nWait = 0L, + Disposal _eDisposal = DISPOSE_NOT + ) : + aBmpEx ( rBmpEx ), + aPosPix ( rPosPix ), + aSizePix ( rSizePix ), + nWait ( _nWait ), + eDisposal ( _eDisposal ), + bUserInput ( sal_False ) + {} + + sal_Bool operator==( const AnimationBitmap& rAnimBmp ) const { return( rAnimBmp.aBmpEx == aBmpEx && rAnimBmp.aPosPix == aPosPix && @@ -94,9 +99,10 @@ struct VCL_DLLPUBLIC AnimationBitmap rAnimBmp.bUserInput == bUserInput ); } - sal_Bool operator!=( const AnimationBitmap& rAnimBmp ) const { return !( *this == rAnimBmp ); } + sal_Bool operator!=( const AnimationBitmap& rAnimBmp ) const + { return !( *this == rAnimBmp ); } - sal_Bool IsEqual( const AnimationBitmap& rAnimBmp ) const + sal_Bool IsEqual( const AnimationBitmap& rAnimBmp ) const { return( rAnimBmp.aPosPix == aPosPix && rAnimBmp.aSizePix == aSizePix && @@ -106,7 +112,7 @@ struct VCL_DLLPUBLIC AnimationBitmap rAnimBmp.aBmpEx.IsEqual( aBmpEx ) ); } - sal_uLong GetChecksum() const; + sal_uLong GetChecksum() const; }; // ------------------- @@ -125,8 +131,8 @@ struct AInfo OutputDevice* pOutDev; void* pViewData; long nExtraData; - sal_Bool bWithSize; - sal_Bool bPause; + sal_Bool bWithSize; + sal_Bool bPause; AInfo() : pOutDev( NULL ), pViewData( NULL ), @@ -139,28 +145,31 @@ struct AInfo // - AnimationBitmap - // ------------------- +class ImplAnimView; +typedef ::std::vector< AnimationBitmap* > AnimationBitmapList_impl; +typedef ::std::vector< ImplAnimView* > AnimViewList_impl; + class VCL_DLLPUBLIC Animation { - SAL_DLLPRIVATE static sal_uLong mnAnimCount; + SAL_DLLPRIVATE static sal_uLong mnAnimCount; - List maList; - List maAInfoList; + AnimationBitmapList_impl maList; + AnimViewList_impl maViewList; Link maNotifyLink; BitmapEx maBitmapEx; Timer maTimer; Size maGlobalSize; - List* mpViewList; void* mpExtraData; long mnLoopCount; long mnLoops; - long mnPos; + size_t mnPos; Disposal meLastDisposal; CycleMode meCycleMode; - sal_Bool mbFirst; - sal_Bool mbIsInAnimation; - sal_Bool mbWithSize; - sal_Bool mbLoopTerminated; - sal_Bool mbIsWaiting; + sal_Bool mbFirst; + sal_Bool mbIsInAnimation; + sal_Bool mbWithSize; + sal_Bool mbLoopTerminated; + sal_Bool mbIsWaiting; SAL_DLLPRIVATE void ImplRestartTimer( sal_uLong nTimeout ); @@ -170,7 +179,7 @@ public: SAL_DLLPRIVATE static void ImplIncAnimCount() { mnAnimCount++; } SAL_DLLPRIVATE static void ImplDecAnimCount() { mnAnimCount--; } - SAL_DLLPRIVATE sal_uLong ImplGetCurPos() const { return mnPos; } + SAL_DLLPRIVATE sal_uLong ImplGetCurPos() const { return mnPos; } public: @@ -179,28 +188,36 @@ public: ~Animation(); Animation& operator=( const Animation& rAnimation ); - sal_Bool operator==( const Animation& rAnimation ) const; - sal_Bool operator!=( const Animation& rAnimation ) const { return !(*this==rAnimation); } - - sal_Bool IsEqual( const Animation& rAnimation ) const; + sal_Bool operator==( const Animation& rAnimation ) const; + sal_Bool operator!=( const Animation& rAnimation ) const + { return !(*this==rAnimation); } - sal_Bool IsEmpty() const; + sal_Bool IsEmpty() const; void SetEmpty(); void Clear(); - sal_Bool Start( OutputDevice* pOutDev, const Point& rDestPt, long nExtraData = 0, - OutputDevice* pFirstFrameOutDev = NULL ); - sal_Bool Start( OutputDevice* pOutDev, const Point& rDestPt, const Size& rDestSz, long nExtraData = 0, - OutputDevice* pFirstFrameOutDev = NULL ); + sal_Bool Start( + OutputDevice* pOutDev, + const Point& rDestPt, + long nExtraData = 0, + OutputDevice* pFirstFrameOutDev = NULL + ); + sal_Bool Start( + OutputDevice* pOutDev, + const Point& rDestPt, + const Size& rDestSz, + long nExtraData = 0, + OutputDevice* pFirstFrameOutDev = NULL + ); void Stop( OutputDevice* pOutDev = NULL, long nExtraData = 0 ); void Draw( OutputDevice* pOutDev, const Point& rDestPt ) const; void Draw( OutputDevice* pOutDev, const Point& rDestPt, const Size& rDestSz ) const; - sal_Bool IsInAnimation() const { return mbIsInAnimation; } - sal_Bool IsTransparent() const; - sal_Bool IsTerminated() const { return mbLoopTerminated; } + sal_Bool IsInAnimation() const { return mbIsInAnimation; } + sal_Bool IsTransparent() const; + sal_Bool IsTerminated() const { return mbLoopTerminated; } const Size& GetDisplaySizePixel() const { return maGlobalSize; } void SetDisplaySizePixel( const Size& rSize ) { maGlobalSize = rSize; } @@ -208,7 +225,7 @@ public: const BitmapEx& GetBitmapEx() const { return maBitmapEx; } void SetBitmapEx( const BitmapEx& rBmpEx ) { maBitmapEx = rBmpEx; } - sal_uLong GetLoopCount() const { return mnLoopCount; } + sal_uLong GetLoopCount() const { return mnLoopCount; } void SetLoopCount( const sal_uLong nLoopCount ); void ResetLoopCount(); @@ -218,36 +235,40 @@ public: void SetNotifyHdl( const Link& rLink ) { maNotifyLink = rLink; } const Link& GetNotifyHdl() const { return maNotifyLink; } - sal_uInt16 Count() const { return (sal_uInt16) maList.Count(); } - sal_Bool Insert( const AnimationBitmap& rAnimationBitmap ); + size_t Count() const { return maList.size(); } + sal_Bool Insert( const AnimationBitmap& rAnimationBitmap ); const AnimationBitmap& Get( sal_uInt16 nAnimation ) const; void Replace( const AnimationBitmap& rNewAnimationBmp, sal_uInt16 nAnimation ); - List* GetAInfoList() { return &maAInfoList; } - sal_uLong GetSizeBytes() const; - sal_uLong GetChecksum() const; + sal_uLong GetSizeBytes() const; + sal_uLong GetChecksum() const; public: - sal_Bool Convert( BmpConversion eConversion ); - sal_Bool ReduceColors( sal_uInt16 nNewColorCount, - BmpReduce eReduce = BMP_REDUCE_SIMPLE ); - sal_Bool Invert(); - sal_Bool Mirror( sal_uLong nMirrorFlags ); - sal_Bool Dither( sal_uLong nDitherFlags = BMP_DITHER_MATRIX ); - sal_Bool Adjust( short nLuminancePercent = 0, - short nContrastPercent = 0, - short nChannelRPercent = 0, - short nChannelGPercent = 0, - short nChannelBPercent = 0, - double fGamma = 1.0, - sal_Bool bInvert = sal_False ); - sal_Bool Filter( BmpFilter eFilter, - const BmpFilterParam* pFilterParam = NULL, - const Link* pProgress = NULL ); - - friend VCL_DLLPUBLIC SvStream& operator>>( SvStream& rIStream, Animation& rAnimation ); - friend VCL_DLLPUBLIC SvStream& operator<<( SvStream& rOStream, const Animation& rAnimation ); + sal_Bool Convert( BmpConversion eConversion ); + sal_Bool ReduceColors( + sal_uInt16 nNewColorCount, + BmpReduce eReduce = BMP_REDUCE_SIMPLE + ); + sal_Bool Invert(); + sal_Bool Mirror( sal_uLong nMirrorFlags ); + sal_Bool Adjust( + short nLuminancePercent = 0, + short nContrastPercent = 0, + short nChannelRPercent = 0, + short nChannelGPercent = 0, + short nChannelBPercent = 0, + double fGamma = 1.0, + sal_Bool bInvert = sal_False + ); + sal_Bool Filter( + BmpFilter eFilter, + const BmpFilterParam* pFilterParam = NULL, + const Link* pProgress = NULL + ); + + friend VCL_DLLPUBLIC SvStream& operator>>( SvStream& rIStream, Animation& rAnimation ); + friend VCL_DLLPUBLIC SvStream& operator<<( SvStream& rOStream, const Animation& rAnimation ); }; #endif // _SV_ANIMATE_HXX diff --git a/vcl/inc/vcl/bitmap.hxx b/vcl/inc/vcl/bitmap.hxx index e25bb482f53c..a6ff3129fada 100644 --- a/vcl/inc/vcl/bitmap.hxx +++ b/vcl/inc/vcl/bitmap.hxx @@ -234,7 +234,7 @@ struct BitmapSystemData #if defined( WNT ) void* pDIB; // device independent byte buffer void* pDDB; // if not NULL then this is actually an HBITMAP - #elif defined( QUARTZ ) + #elif defined( QUARTZ ) || defined( IOS ) void* rImageContext; //Image context (CGContextRef) #else void* aPixmap; diff --git a/vcl/inc/vcl/canvastools.hxx b/vcl/inc/vcl/canvastools.hxx index e82d397a92f0..ce6c7bcafe68 100644 --- a/vcl/inc/vcl/canvastools.hxx +++ b/vcl/inc/vcl/canvastools.hxx @@ -144,11 +144,6 @@ namespace vcl ::BitmapEx VCL_DLLPUBLIC bitmapExFromXBitmap( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XIntegerReadOnlyBitmap >& xInputBitmap ); - /** get a unique identifier for identification in XUnoTunnel interface - */ - enum TunnelIdentifierType { Id_BitmapEx = 0 }; - const com::sun::star::uno::Sequence< sal_Int8 > VCL_DLLPUBLIC getTunnelIdentifier( TunnelIdentifierType eType ); - // Color conversions (vcl/tools Color <-> canvas standard color space) // =================================================================== diff --git a/vcl/inc/vcl/displayconnectiondispatch.hxx b/vcl/inc/vcl/displayconnectiondispatch.hxx index fea1d0b7cba9..0804c9111153 100644 --- a/vcl/inc/vcl/displayconnectiondispatch.hxx +++ b/vcl/inc/vcl/displayconnectiondispatch.hxx @@ -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,3 +51,5 @@ protected: } #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/field.hxx b/vcl/inc/vcl/field.hxx index fd0ce90cb0d7..4af5e1a6128b 100644 --- a/vcl/inc/vcl/field.hxx +++ b/vcl/inc/vcl/field.hxx @@ -111,7 +111,7 @@ public: class VCL_DLLPUBLIC PatternFormatter : public FormatterBase { private: - ByteString maEditMask; + rtl::OString m_aEditMask; XubString maFieldString; XubString maLiteralMask; sal_uInt16 mnFormatFlags; @@ -122,7 +122,8 @@ protected: PatternFormatter(); SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId ); - SAL_DLLPRIVATE void ImplSetMask( const ByteString& rEditMask, const XubString& rLiteralMask ); + SAL_DLLPRIVATE void ImplSetMask(const rtl::OString& rEditMask, + const XubString& rLiteralMask); SAL_DLLPRIVATE sal_Bool ImplIsSameMask() const { return mbSameMask; } SAL_DLLPRIVATE sal_Bool& ImplGetInPattKeyInput() { return mbInPattKeyInput; } @@ -131,9 +132,8 @@ public: virtual void Reformat(); - void SetMask( const ByteString& rEditMask, - const XubString& rLiteralMask ); - const ByteString& GetEditMask() const { return maEditMask; } + void SetMask(const rtl::OString& rEditMask, const XubString& rLiteralMask ); + const rtl::OString& GetEditMask() const { return m_aEditMask; } const XubString& GetLiteralMask() const { return maLiteralMask; } void SetFormatFlags( sal_uInt16 nFlags ) { mnFormatFlags = nFlags; } @@ -475,8 +475,6 @@ public: void SetTime( const Time& rNewTime ); void SetUserTime( const Time& rNewTime ); Time GetTime() const; - Time GetRealTime() const; - sal_Bool IsTimeModified() const; void SetEmptyTime() { FormatterBase::SetEmptyFieldValue(); } sal_Bool IsEmptyTime() const { return FormatterBase::IsEmptyFieldValue(); } Time GetCorrectedTime() const { return maCorrectedTime; } @@ -866,7 +864,6 @@ class VCL_DLLPUBLIC TimeBox : public ComboBox, public TimeFormatter { public: TimeBox( Window* pParent, WinBits nWinStyle ); - TimeBox( Window* pParent, const ResId& rResId ); ~TimeBox(); virtual long PreNotify( NotifyEvent& rNEvt ); @@ -876,12 +873,6 @@ public: virtual void Modify(); virtual void ReformatAll(); - - void InsertTime( const Time& rTime, sal_uInt16 nPos = COMBOBOX_APPEND ); - void RemoveTime( const Time& rTime ); - using TimeFormatter::GetTime; - Time GetTime( sal_uInt16 nPos ) const; - sal_uInt16 GetTimePos( const Time& rTime ) const; }; #endif // _SV_FIELD_HXX diff --git a/vcl/inc/vcl/fontmanager.hxx b/vcl/inc/vcl/fontmanager.hxx index 145c4d0a2169..467297668b5a 100644 --- a/vcl/inc/vcl/fontmanager.hxx +++ b/vcl/inc/vcl/fontmanager.hxx @@ -333,7 +333,7 @@ class VCL_PLUGIN_PUBLIC PrintFontManager void getFontAttributesFromXLFD( PrintFont* pFont, const std::list< rtl::OString >& rXLFDs ) const; - bool analyzeFontFile( int nDirID, const rtl::OString& rFileName, const std::list< rtl::OString >& rXLFDs, std::list< PrintFont* >& rNewFonts ) const; + bool analyzeFontFile( int nDirID, const rtl::OString& rFileName, const std::list< rtl::OString >& rXLFDs, std::list< PrintFont* >& rNewFonts, const char *pFormat=NULL ) const; rtl::OUString convertTrueTypeName( void* pNameRecord ) const; // actually a NameRecord* formt font subsetting code void analyzeTrueTypeFamilyName( void* pTTFont, std::list< rtl::OUString >& rnames ) const; // actually a TrueTypeFont* from font subsetting code bool analyzeTrueTypeFile( PrintFont* pFont ) const; diff --git a/vcl/inc/vcl/gdimtf.hxx b/vcl/inc/vcl/gdimtf.hxx index 86f8dc5cbc77..e15a536ced0f 100644 --- a/vcl/inc/vcl/gdimtf.hxx +++ b/vcl/inc/vcl/gdimtf.hxx @@ -291,4 +291,4 @@ MetaCommentAction* makePluggableRendererAction( const rtl::OUString& rRendererSe #endif // _SV_GDIMTF_HXX -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/graph.hxx b/vcl/inc/vcl/graph.hxx index 61da922acce6..2ca801cfb97b 100644 --- a/vcl/inc/vcl/graph.hxx +++ b/vcl/inc/vcl/graph.hxx @@ -178,8 +178,6 @@ public: sal_uLong GetAnimationLoopCount() const; void ResetAnimationLoopCount(); - List* GetAnimationInfoList() const; - sal_uLong GetChecksum() const; public: @@ -222,4 +220,4 @@ public: #endif // _SV_GRAPH_HXX -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/graphictools.hxx b/vcl/inc/vcl/graphictools.hxx index edd29ab9db01..333c9163d57a 100644 --- a/vcl/inc/vcl/graphictools.hxx +++ b/vcl/inc/vcl/graphictools.hxx @@ -424,18 +424,6 @@ public: void setHatchType ( HatchType aHatchType ); /// Set color used for drawing the hatch void setHatchColor ( Color aHatchColor ); - /// Set type of gradient used - void setGradientType ( GradientType aGradType ); - /// Set start color of the gradient - void setGradient1stColor ( Color aColor ); - /// Set end color of the gradient - void setGradient2ndColor ( Color aColor ); - /** Set the numbers of steps to render the gradient. - - @param aCount - The step count. gradientStepsInfinite means use infinitely many. - */ - void setGradientStepCount( int aCount ); /// Set the texture graphic used void setGraphic ( const Graphic& rGraphic ); diff --git a/vcl/inc/vcl/help.hxx b/vcl/inc/vcl/help.hxx index ce7d1baf4fd6..54cdea8ccb25 100644 --- a/vcl/inc/vcl/help.hxx +++ b/vcl/inc/vcl/help.hxx @@ -86,14 +86,12 @@ public: static void EnableContextHelp(); static void DisableContextHelp(); static sal_Bool IsContextHelpEnabled(); - static sal_Bool StartContextHelp(); static void EnableExtHelp(); static void DisableExtHelp(); static sal_Bool IsExtHelpEnabled(); static sal_Bool StartExtHelp(); static sal_Bool EndExtHelp(); - static sal_Bool IsExtHelpActive(); static void EnableBalloonHelp(); static void DisableBalloonHelp(); diff --git a/vcl/inc/vcl/image.hxx b/vcl/inc/vcl/image.hxx index d536d6bd03d7..301af44bead9 100644 --- a/vcl/inc/vcl/image.hxx +++ b/vcl/inc/vcl/image.hxx @@ -87,9 +87,6 @@ public: ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > GetXGraphic() const; Image GetColorTransformedImage( ImageColorTransform eColorTransform ) const; - static void GetColorTransformArrays( ImageColorTransform eColorTransform, Color*& rpSrcColor, Color*& rpDstColor, sal_uLong& rColorCount ); - - void Invert(); sal_Bool operator!() const { return( !mpImplData ? true : false ); } Image& operator=( const Image& rImage ); diff --git a/vcl/inc/vcl/outdev.hxx b/vcl/inc/vcl/outdev.hxx index b0d694c5e75e..78c7ad938d1a 100644 --- a/vcl/inc/vcl/outdev.hxx +++ b/vcl/inc/vcl/outdev.hxx @@ -282,6 +282,9 @@ class VirtualDevice; class Printer; class ImplFontSelectData; class ImplFontMetricData; +class VCLXGraphics; + +typedef ::std::vector< VCLXGraphics* > VCLXGraphicsList_impl; const char* ImplDbgCheckOutputDevice( const void* pObj ); @@ -305,17 +308,17 @@ private: mutable SalGraphics* mpGraphics; mutable OutputDevice* mpPrevGraphics; mutable OutputDevice* mpNextGraphics; - GDIMetaFile* mpMetaFile; + GDIMetaFile* mpMetaFile; mutable ImplFontEntry* mpFontEntry; mutable ImplFontCache* mpFontCache; mutable ImplDevFontList* mpFontList; mutable ImplGetDevFontList* mpGetDevFontList; mutable ImplGetDevSizeList* mpGetDevSizeList; - ImplObjStack* mpObjStack; - ImplOutDevData* mpOutDevData; - List* mpUnoGraphicsList; - vcl::PDFWriterImpl* mpPDFWriter; - vcl::ExtOutDevData* mpExtOutDevData; + ImplObjStack* mpObjStack; + ImplOutDevData* mpOutDevData; + VCLXGraphicsList_impl* mpUnoGraphicsList; + vcl::PDFWriterImpl* mpPDFWriter; + vcl::ExtOutDevData* mpExtOutDevData; // TEMP TEMP TEMP VirtualDevice* mpAlphaVDev; @@ -1141,8 +1144,12 @@ public: ::com::sun::star::rendering::XCanvas > GetCanvas() const; ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics > CreateUnoGraphics(); - List* GetUnoGraphicsList() const { return mpUnoGraphicsList; } - List* CreateUnoGraphicsList() { mpUnoGraphicsList = new List; return mpUnoGraphicsList; } + VCLXGraphicsList_impl* GetUnoGraphicsList() const { return mpUnoGraphicsList; } + VCLXGraphicsList_impl* CreateUnoGraphicsList() + { + mpUnoGraphicsList = new VCLXGraphicsList_impl(); + return mpUnoGraphicsList; + } static void BeginFontSubstitution(); static void EndFontSubstitution(); diff --git a/vcl/inc/vcl/ppdparser.hxx b/vcl/inc/vcl/ppdparser.hxx index 7082c020c7a2..474d847e2607 100644 --- a/vcl/inc/vcl/ppdparser.hxx +++ b/vcl/inc/vcl/ppdparser.hxx @@ -186,12 +186,12 @@ private: PPDParser( const String& rFile ); ~PPDParser(); - void parseOrderDependency( const ByteString& rLine ); - void parseOpenUI( const ByteString& rLine ); - void parseConstraint( const ByteString& rLine ); - void parse( std::list< ByteString >& rLines ); + void parseOrderDependency(const rtl::OString& rLine); + void parseOpenUI(const rtl::OString& rLine); + void parseConstraint(const rtl::OString& rLine); + void parse( std::list< rtl::OString >& rLines ); - String handleTranslation( const ByteString& i_rString, bool i_bIsGlobalized ); + String handleTranslation(const rtl::OString& i_rString, bool i_bIsGlobalized); static void scanPPDDir( const String& rDir ); static void initPPDFiles(); diff --git a/vcl/inc/vcl/print.hxx b/vcl/inc/vcl/print.hxx index 182258aeb3c1..120198328e49 100644 --- a/vcl/inc/vcl/print.hxx +++ b/vcl/inc/vcl/print.hxx @@ -265,14 +265,12 @@ private: SAL_DLLPRIVATE void ImplUpdatePageData(); SAL_DLLPRIVATE void ImplUpdateFontList(); SAL_DLLPRIVATE void ImplFindPaperFormatForUserSize( JobSetup&, bool bMatchNearest ); - DECL_DLLPRIVATE_LINK( ImplDestroyPrinterAsync, void* ); SAL_DLLPRIVATE bool StartJob( const rtl::OUString& rJobName, boost::shared_ptr<vcl::PrinterController>& ); static SAL_DLLPRIVATE sal_uLong ImplSalPrinterErrorCodeToVCL( sal_uLong nError ); private: - SAL_DLLPRIVATE void ImplEndPrint(); SAL_DLLPRIVATE sal_Bool EndJob(); SAL_DLLPRIVATE Printer( const Printer& rPrinter ); SAL_DLLPRIVATE Printer& operator =( const Printer& rPrinter ); @@ -281,7 +279,6 @@ public: SAL_DLLPRIVATE void ImplEndPage(); public: void DrawGradientEx( OutputDevice* pOut, const Rectangle& rRect, const Gradient& rGradient ); - void DrawGradientEx( OutputDevice* pOut, const PolyPolygon& rPolyPoly, const Gradient& rGradient ); protected: @@ -290,7 +287,6 @@ protected: public: Printer(); - Printer( const Window* pWindow ); Printer( const JobSetup& rJobSetup ); Printer( const QueueInfo& rQueueInfo ); Printer( const XubString& rPrinterName ); @@ -329,7 +325,6 @@ public: sal_Bool SetOrientation( Orientation eOrient ); Orientation GetOrientation() const; - DuplexMode GetDuplexMode() const; sal_Bool SetDuplexMode( DuplexMode ); // returns the angle that a landscape page will be turned counterclockwise // wrt to portrait. The return value may be only valid for @@ -363,7 +358,6 @@ public: sal_Bool IsPrinting() const { return mbPrinting; } - sal_Bool AbortJob(); const XubString& GetCurJobName() const { return maJobName; } sal_uInt16 GetCurPage() const { return mnCurPage; } sal_Bool IsJobActive() const { return mbJobActive; } diff --git a/vcl/inc/vcl/quickselectionengine.hxx b/vcl/inc/vcl/quickselectionengine.hxx index f70736428010..d3dc157d2c6c 100644 --- a/vcl/inc/vcl/quickselectionengine.hxx +++ b/vcl/inc/vcl/quickselectionengine.hxx @@ -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. * @@ -93,3 +94,5 @@ namespace vcl //........................................................................ #endif // VCL_QUICKSELECTIONENGINE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/rendergraphic.hxx b/vcl/inc/vcl/rendergraphic.hxx index 0a0f475decd6..bee2abf4f6f1 100644 --- a/vcl/inc/vcl/rendergraphic.hxx +++ b/vcl/inc/vcl/rendergraphic.hxx @@ -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. @@ -122,3 +123,5 @@ namespace vcl } #endif // _SV_RENDERHRAPHIC_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/rendergraphicrasterizer.hxx b/vcl/inc/vcl/rendergraphicrasterizer.hxx index f2166b03ffb3..0f564a635beb 100644 --- a/vcl/inc/vcl/rendergraphicrasterizer.hxx +++ b/vcl/inc/vcl/rendergraphicrasterizer.hxx @@ -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. @@ -109,3 +110,5 @@ namespace vcl } #endif // _SV_RENDERGRAPHICRASTERIZER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/settings.hxx b/vcl/inc/vcl/settings.hxx index 0ade4c63f295..2494f4fa5d08 100644 --- a/vcl/inc/vcl/settings.hxx +++ b/vcl/inc/vcl/settings.hxx @@ -713,7 +713,6 @@ public: { CopyData(); mpData->mnHighContrast = bHighContrast; } sal_Bool GetHighContrastMode() const { return (sal_Bool) mpData->mnHighContrast; } - sal_Bool IsHighContrastBlackAndWhite() const; void SetUseSystemUIFonts( sal_Bool bUseSystemUIFonts ) { CopyData(); mpData->mnUseSystemUIFonts = bUseSystemUIFonts; } sal_Bool GetUseSystemUIFonts() const diff --git a/vcl/inc/vcl/strhelper.hxx b/vcl/inc/vcl/strhelper.hxx index 450139b0ba14..62e4fc072bdd 100644 --- a/vcl/inc/vcl/strhelper.hxx +++ b/vcl/inc/vcl/strhelper.hxx @@ -38,17 +38,17 @@ namespace psp { String VCL_DLLPUBLIC GetCommandLineToken( int, const String& ); -ByteString VCL_DLLPUBLIC GetCommandLineToken( int, const ByteString& ); +rtl::OString VCL_DLLPUBLIC GetCommandLineToken(int, const rtl::OString&); // gets one token of a unix command line style string // doublequote, singlequote and singleleftquote protect their respective // contents int VCL_DLLPUBLIC GetCommandLineTokenCount( const String& ); -int VCL_DLLPUBLIC GetCommandLineTokenCount( const ByteString& ); +int VCL_DLLPUBLIC GetCommandLineTokenCount(const rtl::OString&); // returns number of tokens (zero if empty or whitespace only) String VCL_DLLPUBLIC WhitespaceToSpace( const String&, sal_Bool bProtect = sal_True ); -ByteString VCL_DLLPUBLIC WhitespaceToSpace( const ByteString&, sal_Bool bProtect = sal_True ); +rtl::OString VCL_DLLPUBLIC WhitespaceToSpace(const rtl::OString&, sal_Bool bProtect = sal_True); // returns a string with multiple adjacent occurrences of whitespace // converted to a single space. if bProtect is sal_True (nonzero), then // doublequote, singlequote and singleleftquote protect their respective @@ -58,14 +58,12 @@ ByteString VCL_DLLPUBLIC WhitespaceToSpace( const ByteString&, sal_Bool bProtect // parses the first double in the string; decimal is '.' only inline double VCL_DLLPUBLIC StringToDouble( const String& rStr ) { - rtl_math_ConversionStatus eStatus; - return rtl::math::stringToDouble( rStr, sal_Unicode('.'), sal_Unicode(0), &eStatus, NULL); + return rtl::math::stringToDouble(rStr, sal_Unicode('.'), sal_Unicode(0)); } -inline double VCL_DLLPUBLIC StringToDouble( const ByteString& rStr ) +inline double VCL_DLLPUBLIC StringToDouble(const rtl::OString& rStr) { - rtl_math_ConversionStatus eStatus; - return rtl::math::stringToDouble( rtl::OStringToOUString( rStr, osl_getThreadTextEncoding() ), sal_Unicode('.'), sal_Unicode(0), &eStatus, NULL); + return rtl::math::stringToDouble(rStr, '.', static_cast<sal_Char>(0)); } // fills a character buffer with the string representation of a double diff --git a/vcl/inc/vcl/svapp.hxx b/vcl/inc/vcl/svapp.hxx index 85e902161a48..b233a3c07c03 100644 --- a/vcl/inc/vcl/svapp.hxx +++ b/vcl/inc/vcl/svapp.hxx @@ -161,14 +161,12 @@ inline sal_Bool ApplicationAddress::IsConnectToSame( const ApplicationAddress& r #define APPEVENT_OPEN_STRING "Open" #define APPEVENT_PRINT_STRING "Print" -#define APPEVENT_DISKINSERT_STRING "DiskInsert" -#define APPEVENT_SAVEDOCUMENTS_STRING "SaveDocuments" class VCL_DLLPUBLIC ApplicationEvent { private: UniString aSenderAppName; // Absender Applikationsname - ByteString aEvent; // Event + rtl::OString m_aEvent; // Event UniString aData; // Uebertragene Daten ApplicationAddress aAppAddr; // Absender Addresse @@ -176,57 +174,29 @@ public: ApplicationEvent() {} ApplicationEvent( const UniString& rSenderAppName, const ApplicationAddress& rAppAddr, - const ByteString& rEvent, + const rtl::OString& rEvent, const UniString& rData ); const UniString& GetSenderAppName() const { return aSenderAppName; } - const ByteString& GetEvent() const { return aEvent; } + const rtl::OString& GetEvent() const { return m_aEvent; } const UniString& GetData() const { return aData; } const ApplicationAddress& GetAppAddress() const { return aAppAddr; } - sal_Bool IsOpenEvent() const; - sal_Bool IsPrintEvent() const; - sal_Bool IsDiskInsertEvent() const; - sal_uInt16 GetParamCount() const { return aData.GetTokenCount( APPEVENT_PARAM_DELIMITER ); } UniString GetParam( sal_uInt16 nParam ) const { return aData.GetToken( nParam, APPEVENT_PARAM_DELIMITER ); } }; inline ApplicationEvent::ApplicationEvent( const UniString& rSenderAppName, const ApplicationAddress& rAppAddr, - const ByteString& rEvent, + const rtl::OString& rEvent, const UniString& rData ) : aSenderAppName( rSenderAppName ), - aEvent( rEvent ), + m_aEvent( rEvent ), aData( rData ), aAppAddr( rAppAddr ) { } -inline sal_Bool ApplicationEvent::IsOpenEvent() const -{ - if ( aEvent.Equals( APPEVENT_OPEN_STRING )) - return sal_True; - else - return sal_False; -} - -inline sal_Bool ApplicationEvent::IsPrintEvent() const -{ - if ( aEvent.Equals( APPEVENT_PRINT_STRING )) - return sal_True; - else - return sal_False; -} - -inline sal_Bool ApplicationEvent::IsDiskInsertEvent() const -{ - if ( aEvent.Equals( APPEVENT_DISKINSERT_STRING )) - return sal_True; - else - return sal_False; -} - class VCL_DLLPUBLIC PropertyHandler { public: @@ -262,8 +232,6 @@ public: virtual void InitFinished(); virtual void DeInit(); - static void InitAppRes( const ResId& rResId ); - static sal_uInt16 GetCommandLineParamCount(); static XubString GetCommandLineParam( sal_uInt16 nParam ); static const XubString& GetAppFileName(); @@ -286,7 +254,6 @@ public: static sal_Bool IsInMain(); static sal_Bool IsInExecute(); - static sal_Bool IsShutDown(); static sal_Bool IsInModalMode(); static sal_uInt16 GetModalModeCount(); @@ -294,7 +261,6 @@ public: static sal_Bool AnyInput( sal_uInt16 nType = INPUT_ANY ); static sal_uLong GetLastInputInterval(); static sal_Bool IsUICaptured(); - static sal_Bool IsUserActive( sal_uInt16 nTest = USERACTIVE_ALL ); virtual void SystemSettingsChanging( AllSettings& rSettings, Window* pFrame ); @@ -387,16 +353,11 @@ public: static sal_Bool InsertAccel( Accelerator* pAccel ); static void RemoveAccel( Accelerator* pAccel ); - static void FlushAccel(); static sal_Bool CallAccel( const KeyCode& rKeyCode, sal_uInt16 nRepeat = 0 ); - static sal_uLong AddHotKey( const KeyCode& rKeyCode, const Link& rLink, void* pData = NULL ); - static void RemoveHotKey( sal_uLong nId ); static sal_uLong AddEventHook( VCLEventHookProc pProc, void* pData = NULL ); static void RemoveEventHook( sal_uLong nId ); static long CallEventHooks( NotifyEvent& rEvt ); - static long CallPreNotify( NotifyEvent& rEvt ); - static long CallEvent( NotifyEvent& rEvt ); static void SetHelp( Help* pHelp = NULL ); static Help* GetHelp(); @@ -409,7 +370,6 @@ public: static sal_uLong GetReservedKeyCodeCount(); static const KeyCode* GetReservedKeyCode( sal_uLong i ); - static String GetReservedKeyCodeDescription( sal_uLong i ); static void SetDefDialogParent( Window* pWindow ); static Window* GetDefDialogParent(); @@ -421,9 +381,7 @@ public: static sal_uInt16 GetSystemWindowMode(); static void SetDialogScaleX( short nScale ); - static short GetDialogScaleX(); - static void SetFontPath( const String& rPath ); static const String& GetFontPath(); static UniqueItemId CreateUniqueId(); @@ -438,8 +396,6 @@ public: static void SetFilterHdl( const Link& rLink ); static const Link& GetFilterHdl(); - static sal_Bool IsAccessibilityEnabled(); - static void EnableHeadlessMode( sal_Bool bEnable = sal_True ); static sal_Bool IsHeadlessModeEnabled(); diff --git a/vcl/inc/vcl/svgread.hxx b/vcl/inc/vcl/svgread.hxx index 4427198eeb5a..cf4f8008c7ef 100644 --- a/vcl/inc/vcl/svgread.hxx +++ b/vcl/inc/vcl/svgread.hxx @@ -80,4 +80,4 @@ namespace vcl #endif -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/syschild.hxx b/vcl/inc/vcl/syschild.hxx index 275e41312f17..3a55d0b45a2c 100644 --- a/vcl/inc/vcl/syschild.hxx +++ b/vcl/inc/vcl/syschild.hxx @@ -63,7 +63,6 @@ public: // per default systemchildwindows erase their background for better plugin support // however, this might not always be required void EnableEraseBackground( sal_Bool bEnable = sal_True ); - sal_Bool IsEraseBackgroundEnabled(); void SetForwardKey( sal_Bool bEnable ); // return the platform specific handle/id of this window; // in case the flag bUseJava is set, a java compatible overlay window diff --git a/vcl/inc/vcl/sysdata.hxx b/vcl/inc/vcl/sysdata.hxx index cab614841e1d..b5daf28e579d 100644 --- a/vcl/inc/vcl/sysdata.hxx +++ b/vcl/inc/vcl/sysdata.hxx @@ -41,6 +41,18 @@ typedef struct CGLayer *CGLayerRef; class NSView; #endif #endif + +#ifdef IOS +typedef struct CGFont *CGFontRef; +typedef struct CGContext *CGContextRef; +typedef struct CGLayer *CGLayerRef; +#ifdef __OBJC__ +@class UIView; +#else +class UIView; +#endif +#endif + #if defined( WNT ) #include <windef.h> #endif @@ -56,6 +68,8 @@ struct SystemEnvData HWND hWnd; // the window hwnd #elif defined( QUARTZ ) NSView* pView; // the cocoa (NSView *) implementing this object +#elif defined( IOS ) + UIView* pView; // the CocoaTouch (UIView *) implementing this object #elif defined( UNX ) void* pDisplay; // the relevant display connection long aWindow; // the window of the object @@ -84,6 +98,8 @@ struct SystemParentData HWND hWnd; // the window hwnd #elif defined( QUARTZ ) NSView* pView; // the cocoa (NSView *) implementing this object +#elif defined( IOS ) + UIView* pView; // the CocoaTouch (UIView *) implementing this object #elif defined( UNX ) long aWindow; // the window of the object bool bXEmbedSupport:1; // decides whether the object in question @@ -116,8 +132,8 @@ struct SystemGraphicsData unsigned long nSize; // size in bytes of this structure #if defined( WNT ) HDC hDC; // handle to a device context -#elif defined( QUARTZ ) - CGContextRef rCGContext; // QUARTZ graphic context +#elif defined( QUARTZ ) || defined( IOS ) + CGContextRef rCGContext; // CoreGraphics graphic context #elif defined( UNX ) void* pDisplay; // the relevant display connection long hDrawable; // a drawable @@ -139,6 +155,7 @@ struct SystemWindowData unsigned long nSize; // size in bytes of this structure #if defined( WNT ) // meaningless on Windows #elif defined( QUARTZ ) // meaningless on Mac OS X / Quartz +#elif defined( IOS ) // and maybe on iOS, too, then #elif defined( UNX ) void* pVisual; // the visual to be used #endif @@ -169,6 +186,8 @@ struct SystemFontData HFONT hFont; // native font object #elif defined( QUARTZ ) void* aATSUFontID; // native font object +#elif defined( IOS ) + CGFontRef rFont; // native font object #elif defined( UNX ) void* nFontId; // native font id int nFontFlags; // native font flags diff --git a/vcl/inc/vcl/syswin.hxx b/vcl/inc/vcl/syswin.hxx index 0fd2fd8d1512..19cce93d44dd 100644 --- a/vcl/inc/vcl/syswin.hxx +++ b/vcl/inc/vcl/syswin.hxx @@ -204,10 +204,6 @@ public: // for systems like MacOSX which can display the URL a document is loaded from // separately from the window title void SetRepresentedURL( const rtl::OUString& ); - const rtl::OUString& GetRepresentedURL() const; - - void SetZLevel( sal_uInt8 nLevel ); - sal_uInt8 GetZLevel() const; void EnableSaveBackground( sal_Bool bSave = sal_True ); sal_Bool IsSaveBackgroundEnabled() const; @@ -231,8 +227,8 @@ public: const Size& GetMaxOutputSizePixel() const; Size GetResizeOutputSizePixel() const; - void SetWindowState( const ByteString& rStr ); - ByteString GetWindowState( sal_uLong nMask = WINDOWSTATE_MASK_ALL ) const; + void SetWindowState(const rtl::OString& rStr); + rtl::OString GetWindowState(sal_uLong nMask = WINDOWSTATE_MASK_ALL) const; void SetMenuBar( MenuBar* pMenuBar ); MenuBar* GetMenuBar() const { return mpMenuBar; } diff --git a/vcl/inc/vcl/tabctrl.hxx b/vcl/inc/vcl/tabctrl.hxx index c6525138f73b..380fb2e70883 100644 --- a/vcl/inc/vcl/tabctrl.hxx +++ b/vcl/inc/vcl/tabctrl.hxx @@ -158,7 +158,6 @@ public: void SetTabPage( sal_uInt16 nPageId, TabPage* pPage ); TabPage* GetTabPage( sal_uInt16 nPageId ) const; - sal_uInt16 GetTabPageResId( sal_uInt16 nPageId ) const; void SetPageText( sal_uInt16 nPageId, const XubString& rText ); XubString GetPageText( sal_uInt16 nPageId ) const; @@ -166,11 +165,9 @@ public: void SetHelpText( sal_uInt16 nPageId, const XubString& rText ); const XubString& GetHelpText( sal_uInt16 nPageId ) const; - void SetHelpId( sal_uInt16 nPageId, const rtl::OString& rHelpId ); rtl::OString GetHelpId( sal_uInt16 nPageId ) const; void SetPageImage( sal_uInt16 nPageId, const Image& rImage ); - const Image* GetPageImage( sal_uInt16 nPageId ) const; void SetHelpText( const XubString& rText ) { Control::SetHelpText( rText ); } diff --git a/vcl/inc/vcl/taskpanelist.hxx b/vcl/inc/vcl/taskpanelist.hxx index 102f755554f2..9042169e9898 100644 --- a/vcl/inc/vcl/taskpanelist.hxx +++ b/vcl/inc/vcl/taskpanelist.hxx @@ -37,7 +37,6 @@ class VCL_DLLPUBLIC TaskPaneList { ::std::vector<Window *> mTaskPanes; - Window *FindNextPane( Window *pWindow, sal_Bool bForward = sal_True ); Window *FindNextFloat( Window *pWindow, sal_Bool bForward = sal_True ); Window *FindNextSplitter( Window *pWindow, sal_Bool bForward = sal_True ); diff --git a/vcl/inc/vcl/threadex.hxx b/vcl/inc/vcl/threadex.hxx index 429b43e6ac7c..c5333d847fa1 100644 --- a/vcl/inc/vcl/threadex.hxx +++ b/vcl/inc/vcl/threadex.hxx @@ -39,24 +39,6 @@ namespace vcl { - class VCL_DLLPUBLIC ThreadExecutor - { - oslThread m_aThread; - oslCondition m_aFinish; - long m_nReturn; - - #ifdef THREADEX_IMPLEMENTATION - public: - SAL_DLLPRIVATE static void SAL_CALL worker( void* ); - #endif - public: - ThreadExecutor(); - virtual ~ThreadExecutor(); - - virtual long doIt() = 0; - long execute(); - }; - class VCL_DLLPUBLIC SolarThreadExecutor { oslCondition m_aStart; diff --git a/vcl/inc/vcl/throbber.hxx b/vcl/inc/vcl/throbber.hxx index ce45631d2fda..4cbd6dcdbce2 100644 --- a/vcl/inc/vcl/throbber.hxx +++ b/vcl/inc/vcl/throbber.hxx @@ -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. @@ -99,3 +100,4 @@ private: #endif // VCL_THROBBER_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/toolbox.hxx b/vcl/inc/vcl/toolbox.hxx index 5badbc2d13bd..dd482c610d95 100644 --- a/vcl/inc/vcl/toolbox.hxx +++ b/vcl/inc/vcl/toolbox.hxx @@ -265,8 +265,6 @@ private: using Window::ImplInvalidate; SAL_DLLPRIVATE void ImplInvalidate( sal_Bool bNewCalc = sal_False, sal_Bool bFullPaint = sal_False ); SAL_DLLPRIVATE void ImplUpdateItem( sal_uInt16 nIndex = 0xFFFF ); - SAL_DLLPRIVATE void ImplStartCustomizeMode(); - SAL_DLLPRIVATE void ImplEndCustomizeMode(); SAL_DLLPRIVATE const XubString& ImplConvertMenuString( const XubString& rStr ); SAL_DLLPRIVATE sal_Bool ImplHandleMouseMove( const MouseEvent& rMEvt, sal_Bool bRepeat = sal_False ); SAL_DLLPRIVATE sal_Bool ImplHandleMouseButtonUp( const MouseEvent& rMEvt, sal_Bool bCancel = sal_False ); @@ -274,7 +272,6 @@ private: SAL_DLLPRIVATE sal_Bool ImplChangeHighlightUpDn( sal_Bool bUp, sal_Bool bNoCycle = sal_False ); SAL_DLLPRIVATE sal_uInt16 ImplGetItemLine( ImplToolItem* pCurrentItem ); SAL_DLLPRIVATE ImplToolItem* ImplGetFirstValidItem( sal_uInt16 nLine ); - SAL_DLLPRIVATE ImplToolItem* ImplGetLastValidItem( sal_uInt16 nLine ); SAL_DLLPRIVATE sal_Bool ImplOpenItem( KeyCode aKeyCode ); SAL_DLLPRIVATE sal_Bool ImplActivateItem( KeyCode aKeyCode ); SAL_DLLPRIVATE void ImplShowFocus(); @@ -332,9 +329,6 @@ public: static SAL_DLLPRIVATE void ImplDrawToolArrow( ToolBox* pBox, long nX, long nY, sal_Bool bBlack, sal_Bool bColTransform, sal_Bool bLeft = sal_False, sal_Bool bTop = sal_False, long nSize = 6 ); - static SAL_DLLPRIVATE void SetToolArrowClipregion( ToolBox* pBox, long nX, long nY, - sal_Bool bLeft = sal_False, sal_Bool bTop = sal_False, - long nSize = 6 ); static SAL_DLLPRIVATE void ImplDrawMenubutton( ToolBox *pThis, sal_Bool bHighlight ); static SAL_DLLPRIVATE sal_uInt16 ImplCountLineBreaks( const ToolBox *pThis ); SAL_DLLPRIVATE ImplToolBoxPrivateData* ImplGetToolBoxPrivateData() const { return mpData; } @@ -401,12 +395,9 @@ public: sal_uInt16 nPixSize = 0 ); void InsertBreak( sal_uInt16 nPos = TOOLBOX_APPEND ); void RemoveItem( sal_uInt16 nPos ); - void MoveItem( sal_uInt16 nItemId, sal_uInt16 nNewPos = TOOLBOX_APPEND ); void CopyItem( const ToolBox& rToolBox, sal_uInt16 nItemId, sal_uInt16 nNewPos = TOOLBOX_APPEND ); - void CopyItems( const ToolBox& rToolBox ); void Clear(); - void RecalcItems(); const ImageList& GetImageList() const { return maImageList; } void SetImageList( const ImageList& rImageList ); @@ -429,7 +420,6 @@ public: // Used to enable/disable scrolling one page at a time for toolbar void SetPageScroll( sal_Bool b ); - sal_Bool GetPageScroll(); void SetNextToolBox( const XubString& rStr ); const XubString& GetNextToolBox() const { return maNextToolBoxStr; } @@ -442,14 +432,12 @@ public: sal_uInt16 GetItemId( const Point& rPos ) const; Rectangle GetItemRect( sal_uInt16 nItemId ) const; Rectangle GetItemPosRect( sal_uInt16 nPos ) const; - Rectangle GetItemDropDownRect( sal_uInt16 nItemId ) const; Rectangle GetItemPosDropDownRect( sal_uInt16 nPos ) const; // retrieves the optimal position to place a popup window for this item (subtoolbar or dropdown) Point GetItemPopupPosition( sal_uInt16 nItemId, const Size& rSize ) const; Rectangle GetScrollRect() const; - Rectangle GetMenubuttonRect() const; sal_uInt16 GetCurItemId() const { return mnCurItemId; } sal_uInt16 GetDownItemId() const { return mnDownItemId; } sal_uInt16 GetClicks() const { return mnMouseClicks; } @@ -464,11 +452,7 @@ public: void SetItemImage( sal_uInt16 nItemId, const Image& rImage ); Image GetItemImage( sal_uInt16 nItemId ) const; void SetItemImageAngle( sal_uInt16 nItemId, long nAngle10 ); - long GetItemImageAngle( sal_uInt16 nItemId ) const; void SetItemImageMirrorMode( sal_uInt16 nItemId, sal_Bool bMirror ); - sal_Bool GetItemImageMirrorMode( sal_uInt16 ) const; - void SetItemHighImage( sal_uInt16 nItemId, const Image& rImage ); - Image GetItemHighImage( sal_uInt16 nItemId ) const; void SetItemText( sal_uInt16 nItemId, const XubString& rText ); const XubString& GetItemText( sal_uInt16 nItemId ) const; void SetItemWindow( sal_uInt16 nItemId, Window* pNewWindow ); @@ -479,7 +463,6 @@ public: void EndSelection(); void SetItemDown( sal_uInt16 nItemId, sal_Bool bDown, sal_Bool bRelease = sal_True ); - sal_Bool IsItemDown( sal_uInt16 nItemId ) const; void SetItemState( sal_uInt16 nItemId, TriState eState ); TriState GetItemState( sal_uInt16 nItemId ) const; @@ -552,14 +535,8 @@ public: void EnableCustomize( sal_Bool bEnable = sal_True ); sal_Bool IsCustomize() { return mbCustomize; } - void StartCustomize( const Rectangle& rRect, void* pData = NULL ); - void SetCustomizeMode( sal_Bool ); sal_Bool IsInCustomizeMode() const { return mbCustomizeMode; } - static void StartCustomizeMode(); - static void EndCustomizeMode(); - static sal_Bool IsCustomizeMode(); - void SetHelpText( const XubString& rText ) { DockingWindow::SetHelpText( rText ); } const XubString& GetHelpText() const @@ -600,7 +577,6 @@ public: PopupMenu* GetMenu() const; void UpdateCustomMenu(); void SetMenuButtonHdl( const Link& rLink ); - const Link& GetMenuButtonHdl() const; // open custommenu void ExecuteCustomMenu(); @@ -625,13 +601,6 @@ public: // -1 is returned if no character is at that point // if an index is found the corresponding item id is filled in (else 0) long GetIndexForPoint( const Point& rPoint, sal_uInt16& rItemID ) const; - // returns the number of portions in the result of GetDisplayText() - long GetTextCount() const; - // returns the interval [start,end] of text portion nText - // returns [-1,-1] for an invalid text number - Pair GetTextStartEnd( long nText ) const; - // returns the item id for text portion nText or 0 if nText is invalid - sal_uInt16 GetDisplayItemId( long nText ) const; const Size& GetDefaultImageSize() const; void ChangeHighlight( sal_uInt16 nPos ); diff --git a/vcl/inc/vcl/wall.hxx b/vcl/inc/vcl/wall.hxx index 66a2a11038ed..f85d58c1200f 100644 --- a/vcl/inc/vcl/wall.hxx +++ b/vcl/inc/vcl/wall.hxx @@ -112,17 +112,14 @@ public: WallpaperStyle GetStyle() const; void SetBitmap( const BitmapEx& rBitmap ); - void SetBitmap(); BitmapEx GetBitmap() const; sal_Bool IsBitmap() const; void SetGradient( const Gradient& rGradient ); - void SetGradient(); Gradient GetGradient() const; sal_Bool IsGradient() const; void SetRect( const Rectangle& rRect ); - void SetRect(); Rectangle GetRect() const; sal_Bool IsRect() const; diff --git a/vcl/inc/vcl/window.hxx b/vcl/inc/vcl/window.hxx index df82b7870854..8cc7bfd0894f 100644 --- a/vcl/inc/vcl/window.hxx +++ b/vcl/inc/vcl/window.hxx @@ -914,7 +914,6 @@ public: void SetFakeFocus( bool bFocus ); sal_Bool IsCompoundControl() const; - sal_Bool HasCompoundControlFocus() const; static sal_uIntPtr SaveFocus(); static sal_Bool EndSaveFocus( sal_uIntPtr nSaveId, sal_Bool bRestore = sal_True ); diff --git a/vcl/inc/win/salbmp.h b/vcl/inc/win/salbmp.h index 5cf92bcf3591..5cf92bcf3591 100755..100644 --- a/vcl/inc/win/salbmp.h +++ b/vcl/inc/win/salbmp.h diff --git a/vcl/inc/win/saldata.hxx b/vcl/inc/win/saldata.hxx index ca0a19f4361a..ba9068628c8c 100644 --- a/vcl/inc/win/saldata.hxx +++ b/vcl/inc/win/saldata.hxx @@ -162,8 +162,6 @@ struct SalShlData UINT mnWheelScrollChars; // WheelScrollChars UINT mnWheelMsgId; // Wheel-Message-Id fuer W95 BOOL mbWXP; // Windows XP - BOOL mbWPrinter; // true: use unicode printer functions - // false: use anis compat printer functions OSVERSIONINFO maVersionInfo; }; diff --git a/vcl/inc/win/salframe.h b/vcl/inc/win/salframe.h index e62d60196a1e..e62d60196a1e 100755..100644 --- a/vcl/inc/win/salframe.h +++ b/vcl/inc/win/salframe.h diff --git a/vcl/inc/win/salmenu.h b/vcl/inc/win/salmenu.h index 99239d7b8191..99239d7b8191 100755..100644 --- a/vcl/inc/win/salmenu.h +++ b/vcl/inc/win/salmenu.h diff --git a/vcl/inc/win/salnativewidgets.h b/vcl/inc/win/salnativewidgets.h index 33ba8de4ba87..33ba8de4ba87 100755..100644 --- a/vcl/inc/win/salnativewidgets.h +++ b/vcl/inc/win/salnativewidgets.h diff --git a/vcl/inc/win/salobj.h b/vcl/inc/win/salobj.h index 068d65a611f2..068d65a611f2 100755..100644 --- a/vcl/inc/win/salobj.h +++ b/vcl/inc/win/salobj.h diff --git a/vcl/inc/win/salprn.h b/vcl/inc/win/salprn.h index 6b399f99f971..80399d5eb3e9 100755..100644 --- a/vcl/inc/win/salprn.h +++ b/vcl/inc/win/salprn.h @@ -37,15 +37,12 @@ // WNT3 #define SAL_DRIVERDATA_SYSSIGN ((sal_uIntPtr)0x574E5433) -#define SAL_DRIVERDATA_VERSION_A 1 -#define SAL_DRIVERDATA_VERSION_W 2 #pragma pack( 1 ) struct SalDriverData { sal_uIntPtr mnSysSignature; - sal_uInt16 mnVersion; sal_uInt16 mnDriverOffset; BYTE maDriverData[1]; }; diff --git a/vcl/inc/win/salsys.h b/vcl/inc/win/salsys.h index 6f133b57d15f..6f133b57d15f 100755..100644 --- a/vcl/inc/win/salsys.h +++ b/vcl/inc/win/salsys.h diff --git a/vcl/inc/win/saltimer.h b/vcl/inc/win/saltimer.h index d408e099eaaf..d408e099eaaf 100755..100644 --- a/vcl/inc/win/saltimer.h +++ b/vcl/inc/win/saltimer.h diff --git a/vcl/inc/win/salvd.h b/vcl/inc/win/salvd.h index 0f213ed5a6f3..0f213ed5a6f3 100755..100644 --- a/vcl/inc/win/salvd.h +++ b/vcl/inc/win/salvd.h diff --git a/vcl/inc/win/wincomp.hxx b/vcl/inc/win/wincomp.hxx index 6e20eb8e16e5..6e20eb8e16e5 100755..100644 --- a/vcl/inc/win/wincomp.hxx +++ b/vcl/inc/win/wincomp.hxx diff --git a/vcl/ios/source/app/saldata.cxx b/vcl/ios/source/app/saldata.cxx new file mode 100644 index 000000000000..f292b6fae585 --- /dev/null +++ b/vcl/ios/source/app/saldata.cxx @@ -0,0 +1,128 @@ +/* -*- 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 "ios/saldata.hxx" +#include "ios/saluimenu.h" +#include "ios/salinst.h" + +oslThreadKey SalData::s_aAutoReleaseKey = 0; + +static void SAL_CALL releasePool( void* pPool ) +{ + if( pPool ) + [(NSAutoreleasePool*)pPool release]; +} + +SalData::SalData() +: + mpTimerProc( NULL ), + mpFirstInstance( NULL ), + mpFirstObject( NULL ), + mpFirstVD( NULL ), + mpFirstPrinter( NULL ), + mpFontList( NULL ), + mxRGBSpace( CGColorSpaceCreateDeviceRGB( ) ), + mxGraySpace( CGColorSpaceCreateDeviceGray( ) ), + mxP50Space( NULL ), + mxP50Pattern( NULL ), + mnSystemVersion( VER_TIGER ), + mnDPIX( 0 ), + mnDPIY( 0 ) +{ + if( s_aAutoReleaseKey == 0 ) + s_aAutoReleaseKey = osl_createThreadKey( releasePool ); +} + +SalData::~SalData() +{ + CGPatternRelease( mxP50Pattern ); + CGColorSpaceRelease( mxP50Space ); + CGColorSpaceRelease( mxRGBSpace ); + CGColorSpaceRelease( mxGraySpace ); + if( s_aAutoReleaseKey ) + { + // release the last pool + NSAutoreleasePool* pPool = nil; + pPool = reinterpret_cast<NSAutoreleasePool*>( osl_getThreadKeyData( s_aAutoReleaseKey ) ); + if( pPool ) + { + osl_setThreadKeyData( s_aAutoReleaseKey, NULL ); + [pPool release]; + } + + osl_destroyThreadKey( s_aAutoReleaseKey ); + s_aAutoReleaseKey = 0; + } +} + +void SalData::ensureThreadAutoreleasePool() +{ + NSAutoreleasePool* pPool = nil; + if( s_aAutoReleaseKey ) + { + pPool = reinterpret_cast<NSAutoreleasePool*>( osl_getThreadKeyData( s_aAutoReleaseKey ) ); + if( ! pPool ) + { + pPool = [[NSAutoreleasePool alloc] init]; + osl_setThreadKeyData( s_aAutoReleaseKey, pPool ); + } + } + else + { + OSL_FAIL( "no autorelease key" ); + } +} + +void SalData::drainThreadAutoreleasePool() +{ + NSAutoreleasePool* pPool = nil; + if( s_aAutoReleaseKey ) + { + pPool = reinterpret_cast<NSAutoreleasePool*>( osl_getThreadKeyData( s_aAutoReleaseKey ) ); + if( pPool ) + { + // osl_setThreadKeyData( s_aAutoReleaseKey, NULL ); + // [pPool release]; + [pPool drain]; + } + else + { + pPool = [[NSAutoreleasePool alloc] init]; + osl_setThreadKeyData( s_aAutoReleaseKey, pPool ); + } + } + else + { + OSL_FAIL( "no autorelease key" ); + } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/ios/source/app/salinst.cxx b/vcl/ios/source/app/salinst.cxx new file mode 100644 index 000000000000..b4c944cd31a4 --- /dev/null +++ b/vcl/ios/source/app/salinst.cxx @@ -0,0 +1,828 @@ +/* -*- 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 <stdio.h> + +#include "tools/fsys.hxx" +#include "tools/getprocessworkingdir.hxx" +#include <tools/solarmutex.hxx> + +#include "osl/process.h" + +#include "rtl/ustrbuf.hxx" + +#include "vcl/svapp.hxx" +#include "vcl/window.hxx" +#include "vcl/timer.hxx" +#include "vcl/solarmutex.hxx" + +#include "ios/saldata.hxx" +#include "ios/salinst.h" +#include "ios/salframe.h" +#include "ios/salobj.h" +#include "ios/salsys.h" +#include "ios/salvd.h" +#include "ios/salbmp.h" +#include "ios/salprn.h" +#include "ios/saltimer.h" +#include "ios/vcluiapp.h" + +#include "print.h" +#include "impbmp.hxx" +#include "salimestatus.hxx" + +#include <comphelper/processfactory.hxx> + +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/uri/XExternalUriReferenceTranslator.hpp> +#include <com/sun/star/uri/ExternalUriReferenceTranslator.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> + +using namespace std; +using namespace ::com::sun::star; + +extern sal_Bool ImplSVMain(); + +static int* gpnInit = 0; +static bool bNoSVMain = true; +static bool bLeftMain = false; +// ----------------------------------------------------------------------- + +class IosDelayedSettingsChanged : public Timer +{ + bool mbInvalidate; + public: + IosDelayedSettingsChanged( bool bInvalidate ) : + mbInvalidate( bInvalidate ) + { + } + + virtual void Timeout() + { + SalData* pSalData = GetSalData(); + if( ! pSalData->maFrames.empty() ) + pSalData->maFrames.front()->CallCallback( SALEVENT_SETTINGSCHANGED, NULL ); + + if( mbInvalidate ) + { + for( std::list< IosSalFrame* >::iterator it = pSalData->maFrames.begin(); + it != pSalData->maFrames.end(); ++it ) + { + if( (*it)->mbShown ) + (*it)->SendPaintEvent( NULL ); + } + } + Stop(); + delete this; + } +}; + +void IosSalInstance::delayedSettingsChanged( bool bInvalidate ) +{ + osl::SolarGuard aGuard( *mpSalYieldMutex ); + IosDelayedSettingsChanged* pTimer = new IosDelayedSettingsChanged( bInvalidate ); + pTimer->SetTimeout( 50 ); + pTimer->Start(); +} + + +// the AppEventList must be available before any SalData/SalInst/etc. objects are ready +typedef std::list<const ApplicationEvent*> AppEventList; +AppEventList IosSalInstance::aAppEventList; + +// initialize the VCL_UIApplication object +static void initUIApp() +{ + [VCL_UIApplication sharedApplication]; + + SalData::ensureThreadAutoreleasePool(); +} + +sal_Bool ImplSVMainHook( int * pnInit ) +{ + gpnInit = pnInit; + + bNoSVMain = false; + initUIApp(); + + char* pArgv[] = { "main", NULL }; + UIApplicationMain( 1, pArgv, NULL, NULL ); + + return TRUE; // indicate that ImplSVMainHook is implemented +} + +// ======================================================================= + +void SalAbort( const XubString& rErrorText ) +{ + if( !rErrorText.Len() ) + fprintf( stderr, "Application Error " ); + else + fprintf( stderr, "%s ", + ByteString( rErrorText, gsl_getSystemTextEncoding() ).GetBuffer() ); + abort(); +} + +// ----------------------------------------------------------------------- + +void InitSalData() +{ + SalData *pSalData = new SalData; + SetSalData( pSalData ); +} + +// ----------------------------------------------------------------------- + +const ::rtl::OUString& SalGetDesktopEnvironment() +{ + static OUString aDesktopEnvironment(RTL_CONSTASCII_USTRINGPARAM( "CocoaTouch" )); + return aDesktopEnvironment; +} + +// ----------------------------------------------------------------------- + +void DeInitSalData() +{ + SalData *pSalData = GetSalData(); + delete pSalData; + SetSalData( NULL ); +} + +// ----------------------------------------------------------------------- + +void InitSalMain() +{ + rtl::OUString urlWorkDir; + rtl_uString *sysWorkDir = NULL; + if (tools::getProcessWorkingDir(urlWorkDir)) + { + oslFileError err2 = osl_getSystemPathFromFileURL(urlWorkDir.pData, &sysWorkDir); + if (err2 == osl_File_E_None) + { + ByteString aPath( getenv( "PATH" ) ); + ByteString aResPath( getenv( "STAR_RESOURCEPATH" ) ); + ByteString aCmdPath( OUStringToOString(OUString(sysWorkDir), RTL_TEXTENCODING_UTF8).getStr() ); + ByteString aTmpPath; + // Get absolute path of command's directory + if ( aCmdPath.Len() ) { + DirEntry aCmdDirEntry( aCmdPath ); + aCmdDirEntry.ToAbs(); + aCmdPath = ByteString( aCmdDirEntry.GetPath().GetFull(), RTL_TEXTENCODING_ASCII_US ); + } + // Assign to PATH environment variable + if ( aCmdPath.Len() ) + { + aTmpPath = ByteString( "PATH=" ); + aTmpPath += aCmdPath; + if ( aPath.Len() ) + aTmpPath += ByteString( DirEntry::GetSearchDelimiter(), RTL_TEXTENCODING_ASCII_US ); + aTmpPath += aPath; + putenv( (char*)aTmpPath.GetBuffer() ); + } + // Assign to STAR_RESOURCEPATH environment variable + if ( aCmdPath.Len() ) + { + aTmpPath = ByteString( "STAR_RESOURCEPATH=" ); + aTmpPath += aCmdPath; + if ( aResPath.Len() ) + aTmpPath += ByteString( DirEntry::GetSearchDelimiter(), RTL_TEXTENCODING_ASCII_US ); + aTmpPath += aResPath; + putenv( (char*)aTmpPath.GetBuffer() ); + } + } + } +} + +// ----------------------------------------------------------------------- + +void DeInitSalMain() +{ +} + +// ======================================================================= + +SalYieldMutex::SalYieldMutex() +{ + mnCount = 0; + mnThreadId = 0; +} + +void SalYieldMutex::acquire() +{ + SolarMutexObject::acquire(); + mnThreadId = osl::Thread::getCurrentIdentifier(); + mnCount++; +} + +void SalYieldMutex::release() +{ + if ( mnThreadId == osl::Thread::getCurrentIdentifier() ) + { + if ( mnCount == 1 ) + mnThreadId = 0; + mnCount--; + } + SolarMutexObject::release(); +} + +sal_Bool SalYieldMutex::tryToAcquire() +{ + if ( SolarMutexObject::tryToAcquire() ) + { + mnThreadId = osl::Thread::getCurrentIdentifier(); + mnCount++; + return sal_True; + } + else + return sal_False; +} + +// ----------------------------------------------------------------------- + +// some convenience functions regarding the yield mutex, aka solar mutex + +sal_Bool ImplSalYieldMutexTryToAcquire() +{ + IosSalInstance* pInst = (IosSalInstance*) GetSalData()->mpFirstInstance; + if ( pInst ) + return pInst->mpSalYieldMutex->tryToAcquire(); + else + return FALSE; +} + +void ImplSalYieldMutexAcquire() +{ + IosSalInstance* pInst = (IosSalInstance*) GetSalData()->mpFirstInstance; + if ( pInst ) + pInst->mpSalYieldMutex->acquire(); +} + +void ImplSalYieldMutexRelease() +{ + IosSalInstance* pInst = (IosSalInstance*) GetSalData()->mpFirstInstance; + if ( pInst ) + pInst->mpSalYieldMutex->release(); +} + +// ======================================================================= + +SalInstance* CreateSalInstance() +{ + // this is the case for not using SVMain + // not so good + if( bNoSVMain ) + initUIApp(); + + SalData* pSalData = GetSalData(); + DBG_ASSERT( pSalData->mpFirstInstance == NULL, "more than one instance created" ); + IosSalInstance* pInst = new IosSalInstance; + + // init instance (only one instance in this version !!!) + pSalData->mpFirstInstance = pInst; + // this one is for outside IosSalInstance::Yield + SalData::ensureThreadAutoreleasePool(); + // no focus rects on NWF ios + ImplGetSVData()->maNWFData.mbNoFocusRects = true; + ImplGetSVData()->maNWFData.mbNoBoldTabFocus = true; + ImplGetSVData()->maNWFData.mbNoActiveTabTextRaise = true; + ImplGetSVData()->maNWFData.mbCenteredTabs = true; + ImplGetSVData()->maNWFData.mbProgressNeedsErase = true; + ImplGetSVData()->maNWFData.mbCheckBoxNeedsErase = true; + ImplGetSVData()->maNWFData.mnStatusBarLowerRightOffset = 10; + ImplGetSVData()->maGDIData.mbNoXORClipping = true; + ImplGetSVData()->maWinData.mbNoSaveBackground = true; + + return pInst; +} + +// ----------------------------------------------------------------------- + +void DestroySalInstance( SalInstance* pInst ) +{ + delete pInst; +} + +// ----------------------------------------------------------------------- + +IosSalInstance::IosSalInstance() +{ + mpSalYieldMutex = new SalYieldMutex; + mpSalYieldMutex->acquire(); + ::tools::SolarMutex::SetSolarMutex( mpSalYieldMutex ); + maMainThread = osl::Thread::getCurrentIdentifier(); + mbWaitingYield = false; + maUserEventListMutex = osl_createMutex(); + mnActivePrintJobs = 0; + maWaitingYieldCond = osl_createCondition(); +} + +// ----------------------------------------------------------------------- + +IosSalInstance::~IosSalInstance() +{ + ::tools::SolarMutex::SetSolarMutex( 0 ); + mpSalYieldMutex->release(); + delete mpSalYieldMutex; + osl_destroyMutex( maUserEventListMutex ); + osl_destroyCondition( maWaitingYieldCond ); +} + +// ----------------------------------------------------------------------- + +void IosSalInstance::wakeupYield() +{ +} + +// ----------------------------------------------------------------------- + +void IosSalInstance::PostUserEvent( IosSalFrame* pFrame, sal_uInt16 nType, void* pData ) +{ + osl_acquireMutex( maUserEventListMutex ); + maUserEvents.push_back( SalUserEvent( pFrame, pData, nType ) ); + osl_releaseMutex( maUserEventListMutex ); + + // notify main loop that an event has arrived + wakeupYield(); +} + +// ----------------------------------------------------------------------- + +osl::SolarMutex* IosSalInstance::GetYieldMutex() +{ + return mpSalYieldMutex; +} + +// ----------------------------------------------------------------------- + +sal_uLong IosSalInstance::ReleaseYieldMutex() +{ + SalYieldMutex* pYieldMutex = mpSalYieldMutex; + if ( pYieldMutex->GetThreadId() == + osl::Thread::getCurrentIdentifier() ) + { + sal_uLong nCount = pYieldMutex->GetAcquireCount(); + sal_uLong n = nCount; + while ( n ) + { + pYieldMutex->release(); + n--; + } + + return nCount; + } + else + return 0; +} + +// ----------------------------------------------------------------------- + +void IosSalInstance::AcquireYieldMutex( sal_uLong nCount ) +{ + SalYieldMutex* pYieldMutex = mpSalYieldMutex; + while ( nCount ) + { + pYieldMutex->acquire(); + nCount--; + } +} + +// ----------------------------------------------------------------------- + +bool IosSalInstance::CheckYieldMutex() +{ + bool bRet = true; + + SalYieldMutex* pYieldMutex = mpSalYieldMutex; + if ( pYieldMutex->GetThreadId() != osl::Thread::getCurrentIdentifier()) + { + bRet = false; + } + + return bRet; +} + +// ----------------------------------------------------------------------- + +bool IosSalInstance::isUIAppThread() const +{ + return osl::Thread::getCurrentIdentifier() == maMainThread; +} + +// ----------------------------------------------------------------------- + +class ReleasePoolHolder +{ + NSAutoreleasePool* mpPool; + public: + ReleasePoolHolder() : mpPool( [[NSAutoreleasePool alloc] init] ) {} + ~ReleasePoolHolder() { [mpPool release]; } +}; + +void IosSalInstance::Yield( bool bWait, bool bHandleAllCurrentEvents ) +{ + // ensure that the per thread autorelease pool is top level and + // will therefore not be destroyed by cocoa implicitly + SalData::ensureThreadAutoreleasePool(); + + // NSAutoreleasePool documentation suggests we should have + // an own pool for each yield level + ReleasePoolHolder aReleasePool; + + // Release all locks so that we don't deadlock when we pull pending + // events from the event queue + bool bDispatchUser = true; + while( bDispatchUser ) + { + sal_uLong nCount = ReleaseYieldMutex(); + + // get one user event + osl_acquireMutex( maUserEventListMutex ); + SalUserEvent aEvent( NULL, NULL, 0 ); + if( ! maUserEvents.empty() ) + { + aEvent = maUserEvents.front(); + maUserEvents.pop_front(); + } + else + bDispatchUser = false; + osl_releaseMutex( maUserEventListMutex ); + + AcquireYieldMutex( nCount ); + + // dispatch it + if( aEvent.mpFrame && IosSalFrame::isAlive( aEvent.mpFrame ) ) + { + aEvent.mpFrame->CallCallback( aEvent.mnType, aEvent.mpData ); + osl_setCondition( maWaitingYieldCond ); + // return if only one event is asked for + if( ! bHandleAllCurrentEvents ) + return; + } + } + + // handle event queue + // events mye be only handled in the thread the app was created + if( mnActivePrintJobs == 0 ) + { + // we need to be woken up by a cocoa-event + // if a user event should be posted by the event handling below + bool bOldWaitingYield = mbWaitingYield; + mbWaitingYield = bWait; + + mbWaitingYield = bOldWaitingYield; + + // collect update rectangles + const std::list< IosSalFrame* > rFrames( GetSalData()->maFrames ); + for( std::list< IosSalFrame* >::const_iterator it = rFrames.begin(); it != rFrames.end(); ++it ) + { + if( (*it)->mbShown && ! (*it)->maInvalidRect.IsEmpty() ) + { + (*it)->Flush( (*it)->maInvalidRect ); + (*it)->maInvalidRect.SetEmpty(); + } + } + osl_setCondition( maWaitingYieldCond ); + } +} + +// ----------------------------------------------------------------------- + +bool IosSalInstance::AnyInput( sal_uInt16 nType ) +{ + if( nType & INPUT_APPEVENT ) + { + if( ! aAppEventList.empty() ) + return true; + if( nType == INPUT_APPEVENT ) + return false; + } + + if( nType & INPUT_TIMER ) + { + if( IosSalTimer::pRunningTimer ) + { + NSDate* pDt = [IosSalTimer::pRunningTimer fireDate]; + if( pDt && [pDt timeIntervalSinceNow] < 0 ) + { + return true; + } + } + } + return false; +} + +// ----------------------------------------------------------------------- + +SalFrame* IosSalInstance::CreateChildFrame( SystemParentData*, sal_uLong /*nSalFrameStyle*/ ) +{ + return NULL; +} + +// ----------------------------------------------------------------------- + +SalFrame* IosSalInstance::CreateFrame( SalFrame* pParent, sal_uLong nSalFrameStyle ) +{ + SalData::ensureThreadAutoreleasePool(); + + SalFrame* pFrame = new IosSalFrame( pParent, nSalFrameStyle ); + return pFrame; +} + +// ----------------------------------------------------------------------- + +void IosSalInstance::DestroyFrame( SalFrame* pFrame ) +{ + delete pFrame; +} + +// ----------------------------------------------------------------------- + +SalObject* IosSalInstance::CreateObject( SalFrame* pParent, SystemWindowData* /* pWindowData */, sal_Bool /* bShow */ ) +{ + // SystemWindowData is meaningless on Mac OS X + IosSalObject *pObject = NULL; + + if ( pParent ) + pObject = new IosSalObject( static_cast<IosSalFrame*>(pParent) ); + + return pObject; +} + +// ----------------------------------------------------------------------- + +void IosSalInstance::DestroyObject( SalObject* pObject ) +{ + delete ( pObject ); +} + +SalSystem* IosSalInstance::CreateSystem() +{ + return new IosSalSystem(); +} + +// ----------------------------------------------------------------------- + +void IosSalInstance::DestroySystem( SalSystem* pSystem ) +{ + delete pSystem; +} + +// ----------------------------------------------------------------------- + +void IosSalInstance::SetEventCallback( void*, bool(*)(void*,void*,int) ) +{ +} + +// ----------------------------------------------------------------------- + +void IosSalInstance::SetErrorEventCallback( void*, bool(*)(void*,void*,int) ) +{ +} + +// ----------------------------------------------------------------------- + +void* IosSalInstance::GetConnectionIdentifier( ConnectionIdentifierType& rReturnedType, int& rReturnedBytes ) +{ + rReturnedBytes = 1; + rReturnedType = AsciiCString; + return (void*)""; +} + +// We need to re-encode file urls because osl_getFileURLFromSystemPath converts +// to UTF-8 before encoding non ascii characters, which is not what other apps expect. +static rtl::OUString translateToExternalUrl(const rtl::OUString& internalUrl) +{ + rtl::OUString extUrl; + + uno::Reference< lang::XMultiServiceFactory > sm = comphelper::getProcessServiceFactory(); + if (sm.is()) + { + uno::Reference< beans::XPropertySet > pset; + sm->queryInterface( getCppuType( &pset )) >>= pset; + if (pset.is()) + { + uno::Reference< uno::XComponentContext > context; + static const rtl::OUString DEFAULT_CONTEXT( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ) ); + pset->getPropertyValue(DEFAULT_CONTEXT) >>= context; + if (context.is()) + extUrl = uri::ExternalUriReferenceTranslator::create(context)->translateToExternal(internalUrl); + } + } + return extUrl; +} + +// #i104525# many versions of OSX have problems with some URLs: +// when an app requests OSX to add one of these URLs to the "Recent Items" list +// then this app gets killed (TextEdit, Preview, etc. and also OOo) +static bool isDangerousUrl( const rtl::OUString& rUrl ) +{ + // use a heuristic that detects all known cases since there is no official comment + // on the exact impact and root cause of the OSX bug + const int nLen = rUrl.getLength(); + const sal_Unicode* p = rUrl.getStr(); + for( int i = 0; i < nLen-3; ++i, ++p ) { + if( p[0] != '%' ) + continue; + // escaped percent? + if( (p[1] == '2') && (p[2] == '5') ) + return true; + // escapes are considered to be UTF-8 encoded + // => check for invalid UTF-8 leading byte + if( (p[1] != 'f') && (p[1] != 'F') ) + continue; + int cLowNibble = p[2]; + if( (cLowNibble >= '0' ) && (cLowNibble <= '9')) + return false; + if( cLowNibble >= 'a' ) + cLowNibble -= 'a' - 'A'; + if( (cLowNibble < 'A') || (cLowNibble >= 'C')) + return true; + } + + return false; +} + +void IosSalInstance::AddToRecentDocumentList(const rtl::OUString& rFileUrl, const rtl::OUString& /*rMimeType*/) +{ +} + +// ----------------------------------------------------------------------- + +SalTimer* IosSalInstance::CreateSalTimer() +{ + return new IosSalTimer(); +} + +// ----------------------------------------------------------------------- + +SalSystem* IosSalInstance::CreateSalSystem() +{ + return new IosSalSystem(); +} + +// ----------------------------------------------------------------------- + +SalBitmap* IosSalInstance::CreateSalBitmap() +{ + return new IosSalBitmap(); +} + +// ----------------------------------------------------------------------- + +SalSession* IosSalInstance::CreateSalSession() +{ + return NULL; +} + +// ----------------------------------------------------------------------- + +// YieldMutexReleaser +YieldMutexReleaser::YieldMutexReleaser() : mnCount( 0 ) +{ + SalData* pSalData = GetSalData(); + if( ! pSalData->mpFirstInstance->isUIAppThread() ) + { + SalData::ensureThreadAutoreleasePool(); + mnCount = pSalData->mpFirstInstance->ReleaseYieldMutex(); + } +} + +YieldMutexReleaser::~YieldMutexReleaser() +{ + if( mnCount != 0 ) + GetSalData()->mpFirstInstance->AcquireYieldMutex( mnCount ); +} + +////////////////////////////////////////////////////////////// +rtl::OUString GetOUString( CFStringRef rStr ) +{ + if( rStr == 0 ) + return rtl::OUString(); + CFIndex nLength = CFStringGetLength( rStr ); + if( nLength == 0 ) + return rtl::OUString(); + const UniChar* pConstStr = CFStringGetCharactersPtr( rStr ); + if( pConstStr ) + return rtl::OUString( pConstStr, nLength ); + UniChar* pStr = reinterpret_cast<UniChar*>( rtl_allocateMemory( sizeof(UniChar)*nLength ) ); + CFRange aRange = { 0, nLength }; + CFStringGetCharacters( rStr, aRange, pStr ); + rtl::OUString aRet( pStr, nLength ); + rtl_freeMemory( pStr ); + return aRet; +} + +rtl::OUString GetOUString( NSString* pStr ) +{ + if( ! pStr ) + return rtl::OUString(); + int nLen = [pStr length]; + if( nLen == 0 ) + return rtl::OUString(); + + rtl::OUStringBuffer aBuf( nLen+1 ); + aBuf.setLength( nLen ); + [pStr getCharacters: const_cast<sal_Unicode*>(aBuf.getStr())]; + return aBuf.makeStringAndClear(); +} + +CFStringRef CreateCFString( const rtl::OUString& rStr ) +{ + return CFStringCreateWithCharacters(kCFAllocatorDefault, rStr.getStr(), rStr.getLength() ); +} + +NSString* CreateNSString( const rtl::OUString& rStr ) +{ + return [[NSString alloc] initWithCharacters: rStr.getStr() length: rStr.getLength()]; +} + +CGImageRef CreateCGImage( const Image& rImage ) +{ + BitmapEx aBmpEx( rImage.GetBitmapEx() ); + Bitmap aBmp( aBmpEx.GetBitmap() ); + + if( ! aBmp || ! aBmp.ImplGetImpBitmap() ) + return NULL; + + // simple case, no transparency + IosSalBitmap* pSalBmp = static_cast<IosSalBitmap*>(aBmp.ImplGetImpBitmap()->ImplGetSalBitmap()); + + if( ! pSalBmp ) + return NULL; + + CGImageRef xImage = NULL; + if( ! (aBmpEx.IsAlpha() || aBmpEx.IsTransparent() ) ) + xImage = pSalBmp->CreateCroppedImage( 0, 0, pSalBmp->mnWidth, pSalBmp->mnHeight ); + else if( aBmpEx.IsAlpha() ) + { + AlphaMask aAlphaMask( aBmpEx.GetAlpha() ); + Bitmap aMask( aAlphaMask.GetBitmap() ); + IosSalBitmap* pMaskBmp = static_cast<IosSalBitmap*>(aMask.ImplGetImpBitmap()->ImplGetSalBitmap()); + if( pMaskBmp ) + xImage = pSalBmp->CreateWithMask( *pMaskBmp, 0, 0, pSalBmp->mnWidth, pSalBmp->mnHeight ); + else + xImage = pSalBmp->CreateCroppedImage( 0, 0, pSalBmp->mnWidth, pSalBmp->mnHeight ); + } + else if( aBmpEx.GetTransparentType() == TRANSPARENT_BITMAP ) + { + Bitmap aMask( aBmpEx.GetMask() ); + IosSalBitmap* pMaskBmp = static_cast<IosSalBitmap*>(aMask.ImplGetImpBitmap()->ImplGetSalBitmap()); + if( pMaskBmp ) + xImage = pSalBmp->CreateWithMask( *pMaskBmp, 0, 0, pSalBmp->mnWidth, pSalBmp->mnHeight ); + else + xImage = pSalBmp->CreateCroppedImage( 0, 0, pSalBmp->mnWidth, pSalBmp->mnHeight ); + } + else if( aBmpEx.GetTransparentType() == TRANSPARENT_COLOR ) + { + Color aTransColor( aBmpEx.GetTransparentColor() ); + SalColor nTransColor = MAKE_SALCOLOR( aTransColor.GetRed(), aTransColor.GetGreen(), aTransColor.GetBlue() ); + xImage = pSalBmp->CreateColorMask( 0, 0, pSalBmp->mnWidth, pSalBmp->mnHeight, nTransColor ); + } + + return xImage; +} + +UIImage* CreateNSImage( const Image& rImage ) +{ + CGImageRef xImage = CreateCGImage( rImage ); + + if( ! xImage ) + return nil; + + Size aSize( rImage.GetSizePixel() ); + UIImage* pImage = [[UIImage alloc] initWithCGImage: xImage]; + CGImageRelease( xImage ); + + return pImage; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/ios/source/app/salnstimer.mm b/vcl/ios/source/app/salnstimer.mm new file mode 100644 index 000000000000..05445110d8ba --- /dev/null +++ b/vcl/ios/source/app/salnstimer.mm @@ -0,0 +1,59 @@ +/* -*- 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 "ios/saltimer.h" +#include "ios/salnstimer.h" +#include "ios/salinst.h" +#include "ios/saldata.hxx" + +#include "svdata.hxx" + +@implementation TimerCallbackCaller +-(void)timerElapsed:(NSTimer*)pTimer +{ + (void)pTimer; + ImplSVData* pSVData = ImplGetSVData(); + if( IosSalTimer::bDispatchTimer ) + { + if( pSVData->mpSalTimer ) + { + YIELD_GUARD; + pSVData->mpSalTimer->CallCallback(); + + // NSTimer does not end nextEventMatchingMask of NSApplication + // so we need to wakeup a waiting Yield to inform it something happened + GetSalData()->mpFirstInstance->wakeupYield(); + } + } +} +@end + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/ios/source/app/salsys.cxx b/vcl/ios/source/app/salsys.cxx new file mode 100644 index 000000000000..1baf357d85a9 --- /dev/null +++ b/vcl/ios/source/app/salsys.cxx @@ -0,0 +1,253 @@ +/* -*- 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 "tools/rc.hxx" + +#include "rtl/ustrbuf.hxx" + +#include "vcl/button.hxx" + +#include "ios/salsys.h" +#include "ios/saldata.hxx" +#include "ios/salinst.h" + +#include "svids.hrc" + +using ::rtl::OUString; + +// ======================================================================= + +IosSalSystem::~IosSalSystem() +{ +} + +unsigned int IosSalSystem::GetDisplayScreenCount() +{ + NSArray* pScreens = [UIScreen screens]; + return pScreens ? [pScreens count] : 1; +} + +bool IosSalSystem::IsMultiDisplay() +{ + return false; +} + +unsigned int IosSalSystem::GetDefaultDisplayNumber() +{ + return 0; +} + +Rectangle IosSalSystem::GetDisplayScreenPosSizePixel( unsigned int nScreen ) +{ + NSArray* pScreens = [UIScreen screens]; + Rectangle aRet; + UIScreen* pScreen = nil; + if( pScreens && nScreen < [pScreens count] ) + pScreen = [pScreens objectAtIndex: nScreen]; + else + pScreen = [UIScreen mainScreen]; + + if( pScreen ) + { + CGRect aFrame = pScreen.bounds; + aRet = Rectangle( Point( static_cast<long int>(aFrame.origin.x), static_cast<long int>(aFrame.origin.y) ), + Size( static_cast<long int>(aFrame.size.width), static_cast<long int>(aFrame.size.height) ) ); + } + return aRet; +} + +Rectangle IosSalSystem::GetDisplayWorkAreaPosSizePixel( unsigned int nScreen ) +{ + NSArray* pScreens = [UIScreen screens]; + Rectangle aRet; + UIScreen* pScreen = nil; + if( pScreens && nScreen < [pScreens count] ) + pScreen = [pScreens objectAtIndex: nScreen]; + else + pScreen = [UIScreen mainScreen]; + + if( pScreen ) + { + CGRect aFrame = pScreen.applicationFrame; + aRet = Rectangle( Point( static_cast<long int>(aFrame.origin.x), static_cast<long int>(aFrame.origin.y) ), + Size( static_cast<long int>(aFrame.size.width), static_cast<long int>(aFrame.size.height) ) ); + } + return aRet; +} + +rtl::OUString IosSalSystem::GetScreenName( unsigned int nScreen ) +{ + NSArray* pScreens = [UIScreen screens]; + OUString aRet; + if( nScreen < [pScreens count] ) + { + ResMgr* pMgr = ImplGetResMgr(); + if( pMgr ) + { + String aScreenName( ResId( SV_MAC_SCREENNNAME, *pMgr ) ); + aScreenName.SearchAndReplaceAllAscii( "%d", String::CreateFromInt32( nScreen ) ); + aRet = aScreenName; + } + } + return aRet; +} + +static NSString* getStandardString( int nButtonId ) +{ + rtl::OUString aText( Button::GetStandardText( nButtonId ) ); + if( ! aText.getLength() ) // this is for bad cases, we might be missing the vcl resource + { + switch( nButtonId ) + { + case BUTTON_OK: aText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OK" ) );break; + case BUTTON_ABORT: aText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Abort" ) );break; + case BUTTON_CANCEL: aText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Cancel" ) );break; + case BUTTON_RETRY: aText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Retry" ) );break; + case BUTTON_YES: aText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Yes" ) );break; + case BUTTON_NO : aText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "No" ) );break; + } + } + return aText.getLength() ? CreateNSString( aText) : nil; +} + +@interface MessageboxDelegate : NSObject <UIAlertViewDelegate> +{ + int *_resultPtr; +} +- (id)initWithResultPtr:(int *)resultPtr; +- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex; +@end + +@implementation MessageboxDelegate +- (id)initWithResultPtr:(int *)resultPtr +{ + _resultPtr = resultPtr; + return [super init]; +} + +- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex +{ + *_resultPtr = buttonIndex; +} +@end + +int IosSalSystem::ShowNativeMessageBox( const String& rTitle, + const String& rMessage, + int nButtonCombination, + int nDefaultButton) +{ + NSString* pTitle = CreateNSString( rTitle ); + NSString* pMessage = CreateNSString( rMessage ); + + struct id_entry + { + int nCombination; + int nDefaultButton; + int nTextIds[3]; + } aButtonIds[] = + { + { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_OK, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_OK, { BUTTON_OK, -1, -1 } }, + { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_OK_CANCEL, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_OK, { BUTTON_OK, BUTTON_CANCEL, -1 } }, + { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_OK_CANCEL, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_CANCEL, { BUTTON_CANCEL, BUTTON_OK, -1 } }, + { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_ABORT_RETRY_IGNORE, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_ABORT, { BUTTON_ABORT, BUTTON_IGNORE, BUTTON_RETRY } }, + { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_ABORT_RETRY_IGNORE, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_RETRY, { BUTTON_RETRY, BUTTON_IGNORE, BUTTON_ABORT } }, + { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_ABORT_RETRY_IGNORE, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_IGNORE, { BUTTON_IGNORE, BUTTON_IGNORE, BUTTON_ABORT } }, + { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_YES_NO_CANCEL, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_YES, { BUTTON_YES, BUTTON_NO, BUTTON_CANCEL } }, + { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_YES_NO_CANCEL, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_NO, { BUTTON_NO, BUTTON_YES, BUTTON_CANCEL } }, + { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_YES_NO_CANCEL, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_CANCEL, { BUTTON_CANCEL, BUTTON_YES, BUTTON_NO } }, + { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_YES_NO, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_YES, { BUTTON_YES, BUTTON_NO, -1 } }, + { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_YES_NO, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_NO, { BUTTON_NO, BUTTON_YES, -1 } }, + { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_RETRY_CANCEL, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_RETRY, { BUTTON_RETRY, BUTTON_CANCEL, -1 } }, + { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_RETRY_CANCEL, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_CANCEL, { BUTTON_CANCEL, BUTTON_RETRY, -1 } } + }; + + NSString* pDefText = nil; + NSString* pAltText = nil; + NSString* pOthText = nil; + + unsigned int nC; + for( nC = 0; nC < sizeof(aButtonIds)/sizeof(aButtonIds[0]); nC++ ) + { + if( aButtonIds[nC].nCombination == nButtonCombination ) + { + if( aButtonIds[nC].nDefaultButton == nDefaultButton ) + { + if( aButtonIds[nC].nTextIds[0] != -1 ) + pDefText = getStandardString( aButtonIds[nC].nTextIds[0] ); + if( aButtonIds[nC].nTextIds[1] != -1 ) + pAltText = getStandardString( aButtonIds[nC].nTextIds[1] ); + if( aButtonIds[nC].nTextIds[2] != -1 ) + pOthText = getStandardString( aButtonIds[nC].nTextIds[2] ); + break; + } + } + } + + int nResult = 1; // ??? + // How to do the delegate when this is C++? + MessageboxDelegate *delegate = [[MessageboxDelegate alloc] initWithResultPtr: &nResult]; + UIAlertView *view = [[UIAlertView alloc] initWithTitle: pTitle message: pMessage delegate: delegate + cancelButtonTitle: @"Cancel" otherButtonTitles: nil]; + [view show]; + [view dealloc]; + [delegate dealloc]; + + if( pTitle ) + [pTitle release]; + if( pMessage ) + [pMessage release]; + if( pDefText ) + [pDefText release]; + if( pAltText ) + [pAltText release]; + if( pOthText ) + [pOthText release]; + + int nRet = 0; + if( nC < sizeof(aButtonIds)/sizeof(aButtonIds[0]) && nResult >= 1 && nResult <= 3 ) + { + int nPressed = aButtonIds[nC].nTextIds[nResult-1]; + switch( nPressed ) + { + case BUTTON_NO: nRet = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_NO; break; + case BUTTON_YES: nRet = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_YES; break; + case BUTTON_OK: nRet = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_OK; break; + case BUTTON_CANCEL: nRet = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_CANCEL; break; + case BUTTON_ABORT: nRet = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_ABORT; break; + case BUTTON_RETRY: nRet = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_RETRY; break; + case BUTTON_IGNORE: nRet = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_IGNORE; break; + } + } + + return nRet; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/ios/source/app/saltimer.cxx b/vcl/ios/source/app/saltimer.cxx new file mode 100644 index 000000000000..69401ea502d7 --- /dev/null +++ b/vcl/ios/source/app/saltimer.cxx @@ -0,0 +1,104 @@ +/* -*- 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 "ios/saltimer.h" +#include "ios/salnstimer.h" +#include "ios/saldata.hxx" +#include "ios/salframe.h" +#include "ios/salinst.h" + +// ======================================================================= + +NSTimer* IosSalTimer::pRunningTimer = nil; +bool IosSalTimer::bDispatchTimer = false; + + +void ImplSalStartTimer( sal_uLong nMS ) +{ + SalData* pSalData = GetSalData(); + if( pSalData->mpFirstInstance->isUIAppThread() ) + { + IosSalTimer::bDispatchTimer = true; + NSTimeInterval aTI = double(nMS)/1000.0; + if( IosSalTimer::pRunningTimer != nil ) + { + if( [IosSalTimer::pRunningTimer timeInterval] == aTI ) + // set new fire date + [IosSalTimer::pRunningTimer setFireDate: [NSDate dateWithTimeIntervalSinceNow: aTI]]; + else + { + [IosSalTimer::pRunningTimer invalidate]; + IosSalTimer::pRunningTimer = nil; + } + } + if( IosSalTimer::pRunningTimer == nil ) + { + IosSalTimer::pRunningTimer = [NSTimer scheduledTimerWithTimeInterval: aTI + target: [[[TimerCallbackCaller alloc] init] autorelease] + selector: @selector(timerElapsed:) + userInfo: nil + repeats: YES]; + } + } + else + { + SalData::ensureThreadAutoreleasePool(); + // post an event so we can get into the main thread + // ??? + } +} + +void ImplSalStopTimer() +{ + IosSalTimer::bDispatchTimer = false; +} + +IosSalTimer::IosSalTimer( ) +{ +} + +IosSalTimer::~IosSalTimer() +{ + ImplSalStopTimer(); +} + +void IosSalTimer::Start( sal_uLong nMS ) +{ + ImplSalStartTimer( nMS ); +} + +void IosSalTimer::Stop() +{ + ImplSalStopTimer(); +} + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/ios/source/app/vcluiapp.mm b/vcl/ios/source/app/vcluiapp.mm new file mode 100644 index 000000000000..e40d8a7eb792 --- /dev/null +++ b/vcl/ios/source/app/vcluiapp.mm @@ -0,0 +1,101 @@ +/* -*- 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 "rtl/ustrbuf.hxx" + +#include "vcl/window.hxx" +#include "vcl/svapp.hxx" +#include "vcl/cmdevt.hxx" + +#include "ios/vcluiapp.h" +#include "ios/salinst.h" +#include "ios/saldata.hxx" +#include "ios/salframe.h" +#include "ios/salframeview.h" + +#include "impimagetree.hxx" + +@implementation VCL_UIApplication +-(void)sendEvent:(UIEvent*)pEvent +{ + UIEventType eType = [pEvent type]; + [super sendEvent: pEvent]; +} + +-(void)sendSuperEvent:(UIEvent*)pEvent +{ + [super sendEvent: pEvent]; +} + +-(BOOL)application: (UIApplication*)app openFile: (NSString*)pFile +{ + (void)app; + const rtl::OUString aFile( GetOUString( pFile ) ); + return YES; +} + +-(void)application: (UIApplication*) app openFiles: (NSArray*)files +{ + (void)app; + rtl::OUStringBuffer aFileList( 256 ); + + NSEnumerator* it = [files objectEnumerator]; + NSString* pFile = nil; + + while( (pFile = [it nextObject]) != nil ) + { + const rtl::OUString aFile( GetOUString( pFile ) ); + } + + if( aFileList.getLength() ) + { + // we have no back channel here, we have to assume success, in which case + // replyToOpenOrPrint does not need to be called according to documentation + // [app replyToOpenOrPrint: NSApplicationDelegateReplySuccess]; + const ApplicationEvent* pAppEvent = new ApplicationEvent( String(), ApplicationAddress(), + APPEVENT_OPEN_STRING, aFileList.makeStringAndClear() ); + IosSalInstance::aAppEventList.push_back( pAppEvent ); + } +} + +-(void)addFallbackMenuItem: (UIMenuItem*)pNewItem +{ + IosSalMenu::addFallbackMenuItem( pNewItem ); +} + +-(void)removeFallbackMenuItem: (UIMenuItem*)pItem +{ + IosSalMenu::removeFallbackMenuItem( pItem ); +} + +@end + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basegfx/source/point/b3dhompoint.cxx b/vcl/null/printerinfomanager.cxx index 3a6c33a50262..7361606c35b3 100644 --- a/basegfx/source/point/b3dhompoint.cxx +++ b/vcl/null/printerinfomanager.cxx @@ -27,21 +27,25 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_basegfx.hxx" -#include <basegfx/point/b3dhompoint.hxx> +#include "precompiled_vcl.hxx" -namespace basegfx -{ - void B3DHomPoint::implHomogenize() - { - const double fFactor(1.0 / mfW); - maTuple.setX(maTuple.getX() * fFactor); - maTuple.setY(maTuple.getY() * fFactor); - maTuple.setZ(maTuple.getZ() * fFactor); - mfW = 1.0; - } -} // end of namespace basegfx +#include "vcl/printerinfomanager.hxx" + +#include "unx/saldata.hxx" + +using namespace psp; +using namespace osl; -// eof +using ::rtl::OUString; +using ::rtl::OString; +using ::rtl::OStringToOUString; +using ::rtl::OUStringHash; + +void PrinterInfoManager::release() +{ + SalData* pSalData = GetSalData(); + delete pSalData->m_pPIManager; + pSalData->m_pPIManager = NULL; +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/prj/build.lst b/vcl/prj/build.lst index 9e0ccdba440b..29b3a4031e86 100644 --- a/vcl/prj/build.lst +++ b/vcl/prj/build.lst @@ -1,4 +1,4 @@ -vc vcl : TRANSLATIONS:translations apple_remote BOOST:boost rsc sot ucbhelper unotools ICU:icu GRAPHITE:graphite i18npool i18nutil unoil ridljar X11_EXTENSIONS:x11_extensions offuh basegfx basebmp tools l10ntools icc cpputools svl LIBXSLT:libxslt NULL +vc vcl : TRANSLATIONS:translations apple_remote BOOST:boost DESKTOP:rsc sot ucbhelper unotools ICU:icu GRAPHITE:graphite i18npool i18nutil unoil ridljar X11_EXTENSIONS:x11_extensions offapi basegfx basebmp tools DESKTOP:l10ntools icc DESKTOP:cpputools svl LIBXSLT:libxslt CAIRO:cairo NULL vc vcl usr1 - all vc_mkout NULL vc vcl\prj nmake - all vc_prj NULL diff --git a/vcl/source/app/help.cxx b/vcl/source/app/help.cxx index 75bab1a29694..3db6bcc841bf 100644 --- a/vcl/source/app/help.cxx +++ b/vcl/source/app/help.cxx @@ -112,27 +112,6 @@ sal_Bool Help::IsContextHelpEnabled() // ----------------------------------------------------------------------- -sal_Bool Help::StartContextHelp() -{ - ImplSVData* pSVData = ImplGetSVData(); - - if ( pSVData->maHelpData.mbContextHelp ) - { - Window* pWindow = pSVData->maWinData.mpFocusWin; - if ( pWindow ) - { - Point aMousePos = pWindow->OutputToScreenPixel( pWindow->GetPointerPosPixel() ); - HelpEvent aHelpEvent( aMousePos, HELPMODE_CONTEXT ); - pWindow->RequestHelp( aHelpEvent ); - return sal_True; - } - } - - return sal_False; -} - -// ----------------------------------------------------------------------- - void Help::EnableExtHelp() { ImplGetSVData()->maHelpData.mbExtHelp = sal_True; @@ -191,13 +170,6 @@ sal_Bool Help::EndExtHelp() // ----------------------------------------------------------------------- -sal_Bool Help::IsExtHelpActive() -{ - return ImplGetSVData()->maHelpData.mbExtHelpMode; -} - -// ----------------------------------------------------------------------- - void Help::EnableBalloonHelp() { ImplGetSVData()->maHelpData.mbBalloonHelp = sal_True; diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx index 9ffb8bc373da..1683faf1613a 100644 --- a/vcl/source/app/settings.cxx +++ b/vcl/source/app/settings.cxx @@ -964,46 +964,6 @@ inline sal_Bool ImplIsBackOrWhite( const Color& rColor ) return ( nLuminance < 8 ) || ( nLuminance > 250 ); } -sal_Bool StyleSettings::IsHighContrastBlackAndWhite() const -{ - sal_Bool bBWOnly = sal_True; - - // Only use B&W if fully B&W, like on GNOME. - // Some colors like CheckedColor and HighlightColor are not B&W in Windows Standard HC Black, - // and we don't want to be B&W then, so check these color first, very probably not B&W. - - // Unfortunately, GNOME uses a very very dark color (0x000033) instead of BLACK (0x000000) - - if ( !ImplIsBackOrWhite( GetFaceColor() ) ) - bBWOnly = sal_False; - else if ( !ImplIsBackOrWhite( GetHighlightTextColor() ) ) - bBWOnly = sal_False; - else if ( !ImplIsBackOrWhite( GetWindowColor() ) ) - bBWOnly = sal_False; - else if ( !ImplIsBackOrWhite( GetWindowTextColor() ) ) - bBWOnly = sal_False; - else if ( !ImplIsBackOrWhite( GetButtonTextColor() ) ) - bBWOnly = sal_False; - else if ( !ImplIsBackOrWhite( GetButtonTextColor() ) ) - bBWOnly = sal_False; - else if ( !ImplIsBackOrWhite( GetGroupTextColor() ) ) - bBWOnly = sal_False; - else if ( !ImplIsBackOrWhite( GetLabelTextColor() ) ) - bBWOnly = sal_False; - else if ( !ImplIsBackOrWhite( GetDialogColor() ) ) - bBWOnly = sal_False; - else if ( !ImplIsBackOrWhite( GetFieldColor() ) ) - bBWOnly = sal_False; - else if ( !ImplIsBackOrWhite( GetMenuColor() ) ) - bBWOnly = sal_False; - else if ( !ImplIsBackOrWhite( GetMenuBarColor() ) ) - bBWOnly = sal_False; - else if ( !ImplIsBackOrWhite( GetMenuHighlightColor() ) ) - bBWOnly = sal_False; - - return bBWOnly; -} - // ----------------------------------------------------------------------- sal_Bool StyleSettings::operator ==( const StyleSettings& rSet ) const diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index fe536addac98..9d54803f7f3b 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -241,12 +241,6 @@ Application::~Application() // ----------------------------------------------------------------------- -void Application::InitAppRes( const ResId& ) -{ -} - -// ----------------------------------------------------------------------- - sal_Bool Application::QueryExit() { WorkWindow* pAppWin = ImplGetSVData()->maWinData.mpAppWin; @@ -417,18 +411,6 @@ const KeyCode* Application::GetReservedKeyCode( sal_uLong i ) return &ImplReservedKeys::get()->first[i].mKeyCode; } -String Application::GetReservedKeyCodeDescription( sal_uLong i ) -{ - ResMgr* pResMgr = ImplGetResMgr(); - if( ! pResMgr ) - return String(); - ImplReservedKey *pImplReservedKeys = ImplReservedKeys::get()->first; - if( i >= GetReservedKeyCodeCount() || ! pImplReservedKeys[i].mnResId ) - return String(); - else - return String( ResId( pImplReservedKeys[i].mnResId, *pResMgr ) ); -} - // ----------------------------------------------------------------------- void Application::Execute() @@ -561,13 +543,6 @@ sal_Bool Application::IsInExecute() // ----------------------------------------------------------------------- -sal_Bool Application::IsShutDown() -{ - return ImplGetSVData()->maAppData.mbAppQuit; -} - -// ----------------------------------------------------------------------- - sal_Bool Application::IsInModalMode() { return (ImplGetSVData()->maAppData.mnModalMode != 0); @@ -621,34 +596,6 @@ sal_Bool Application::IsUICaptured() // ----------------------------------------------------------------------- -sal_Bool Application::IsUserActive( sal_uInt16 nTest ) -{ - if ( nTest & (USERACTIVE_MOUSEDRAG | USERACTIVE_INPUT) ) - { - if ( IsUICaptured() ) - return sal_True; - } - - if ( nTest & USERACTIVE_INPUT ) - { - if ( GetLastInputInterval() < 500 ) - return sal_True; - - if ( AnyInput( INPUT_KEYBOARD ) ) - return sal_True; - } - - if ( nTest & USERACTIVE_MODALDIALOG ) - { - if ( ImplGetSVData()->maAppData.mnModalDialog ) - return sal_True; - } - - return sal_False; -} - -// ----------------------------------------------------------------------- - void Application::SystemSettingsChanging( AllSettings& /*rSettings*/, Window* /*pFrame*/ ) { @@ -1465,16 +1412,6 @@ void Application::RemoveAccel( Accelerator* pAccel ) // ----------------------------------------------------------------------- -void Application::FlushAccel() -{ - ImplSVData* pSVData = ImplGetSVData(); - - if ( pSVData->maAppData.mpAccelMgr ) - pSVData->maAppData.mpAccelMgr->FlushAccel(); -} - -// ----------------------------------------------------------------------- - sal_Bool Application::CallAccel( const KeyCode& rKeyCode, sal_uInt16 nRepeat ) { ImplSVData* pSVData = ImplGetSVData(); @@ -1547,13 +1484,6 @@ void Application::SetDialogScaleX( short nScale ) // ----------------------------------------------------------------------- -short Application::GetDialogScaleX() -{ - return ImplGetSVData()->maAppData.mnDialogScaleX; -} - -// ----------------------------------------------------------------------- - void Application::SetDefDialogParent( Window* pWindow ) { ImplGetSVData()->maWinData.mpDefDialogParent = pWindow; @@ -1675,19 +1605,6 @@ const String& Application::GetFontPath() // ----------------------------------------------------------------------- -void Application::SetFontPath( const String& rPath ) -{ - ImplSVData* pSVData = ImplGetSVData(); - - // if it doesn't exist create a new one - if( !pSVData->maAppData.mpFontPath ) - pSVData->maAppData.mpFontPath = new String( rPath ); - else - *(pSVData->maAppData.mpFontPath) = rPath; -} - -// ----------------------------------------------------------------------- - UniqueItemId Application::CreateUniqueId() { ImplSVData* pSVData = ImplGetSVData(); @@ -1813,47 +1730,6 @@ void ImplFreeHotKeyData() // ----------------------------------------------------------------------- -sal_uIntPtr Application::AddHotKey( const KeyCode& rKeyCode, const Link& rLink, void* pData ) -{ - ImplSVData* pSVData = ImplGetSVData(); - ImplHotKey* pHotKeyData = new ImplHotKey; - pHotKeyData->mpUserData = pData; - pHotKeyData->maKeyCode = rKeyCode; - pHotKeyData->maLink = rLink; - pHotKeyData->mpNext = pSVData->maAppData.mpFirstHotKey; - pSVData->maAppData.mpFirstHotKey = pHotKeyData; - return (sal_uIntPtr)pHotKeyData; -} - -// ----------------------------------------------------------------------- - -void Application::RemoveHotKey( sal_uIntPtr nId ) -{ - ImplSVData* pSVData = ImplGetSVData(); - ImplHotKey* pFindHotKeyData = (ImplHotKey*)nId; - ImplHotKey* pPrevHotKeyData = NULL; - ImplHotKey* pHotKeyData = pSVData->maAppData.mpFirstHotKey; - while ( pHotKeyData ) - { - if ( pHotKeyData == pFindHotKeyData ) - { - if ( pPrevHotKeyData ) - pPrevHotKeyData->mpNext = pFindHotKeyData->mpNext; - else - pSVData->maAppData.mpFirstHotKey = pFindHotKeyData->mpNext; - delete pFindHotKeyData; - break; - } - - pPrevHotKeyData = pHotKeyData; - pHotKeyData = pHotKeyData->mpNext; - } - - DBG_ASSERT( pHotKeyData, "Application::RemoveHotKey() - HotKey is not added" ); -} - -// ----------------------------------------------------------------------- - void ImplFreeEventHookData() { ImplSVData* pSVData = ImplGetSVData(); @@ -1931,20 +1807,6 @@ long Application::CallEventHooks( NotifyEvent& rEvt ) // ----------------------------------------------------------------------- -long Application::CallPreNotify( NotifyEvent& rEvt ) -{ - return ImplCallPreNotify( rEvt ); -} - -// ----------------------------------------------------------------------- - -long Application::CallEvent( NotifyEvent& rEvt ) -{ - return ImplCallEvent( rEvt ); -} - -// ----------------------------------------------------------------------- - const LocaleDataWrapper& Application::GetAppLocaleDataWrapper() { return GetSettings().GetLocaleDataWrapper(); @@ -2020,11 +1882,6 @@ void Application::AddToRecentDocumentList(const rtl::OUString& rFileUrl, const r pSVData->mpDefInst->AddToRecentDocumentList(rFileUrl, rMimeType); } -sal_Bool Application::IsAccessibilityEnabled() -{ - return sal_False; -} - sal_Bool InitAccessBridge( sal_Bool bShowCancel, sal_Bool &rCancelled ) { sal_Bool bRet = true; @@ -2067,13 +1924,9 @@ void Application::Property( ApplicationProperty& rProp ) void Application::SetPropertyHandler( PropertyHandler* p ) { - if ( pHandler ) - delete pHandler; pHandler = p; } - - void Application::AppEvent( const ApplicationEvent& /*rAppEvent*/ ) { } diff --git a/vcl/source/app/svdata.cxx b/vcl/source/app/svdata.cxx index 7648dbbae75c..10f7e50d9aad 100644 --- a/vcl/source/app/svdata.cxx +++ b/vcl/source/app/svdata.cxx @@ -410,8 +410,7 @@ bool ImplInitAccessBridge(sal_Bool bAllowCancel, sal_Bool &rCancelled) return bSuccess; } - - catch(::com::sun::star::java::JavaNotConfiguredException e) + catch (const ::com::sun::star::java::JavaNotConfiguredException&) { ResMgr *pResMgr = ImplGetResMgr(); if( bErrorMessage && bAllowCancel && pResMgr ) @@ -435,8 +434,7 @@ bool ImplInitAccessBridge(sal_Bool bAllowCancel, sal_Bool &rCancelled) return false; } - - catch(::com::sun::star::java::JavaVMCreationFailureException e) + catch (const ::com::sun::star::java::JavaVMCreationFailureException&) { ResMgr *pResMgr = ImplGetResMgr(); if( bErrorMessage && bAllowCancel && pResMgr ) @@ -460,8 +458,7 @@ bool ImplInitAccessBridge(sal_Bool bAllowCancel, sal_Bool &rCancelled) return false; } - - catch(::com::sun::star::java::MissingJavaRuntimeException e) + catch (const ::com::sun::star::java::MissingJavaRuntimeException&) { ResMgr *pResMgr = ImplGetResMgr(); if( bErrorMessage && bAllowCancel && pResMgr ) @@ -485,8 +482,7 @@ bool ImplInitAccessBridge(sal_Bool bAllowCancel, sal_Bool &rCancelled) return false; } - - catch(::com::sun::star::java::JavaDisabledException e) + catch (const ::com::sun::star::java::JavaDisabledException&) { ResMgr *pResMgr = ImplGetResMgr(); if( bErrorMessage && bAllowCancel && pResMgr ) @@ -510,9 +506,7 @@ bool ImplInitAccessBridge(sal_Bool bAllowCancel, sal_Bool &rCancelled) return false; } - - - catch(::com::sun::star::uno::RuntimeException e) + catch (const ::com::sun::star::uno::RuntimeException& e) { ResMgr *pResMgr = ImplGetResMgr(); if( bErrorMessage && pResMgr ) @@ -564,7 +558,6 @@ bool ImplInitAccessBridge(sal_Bool bAllowCancel, sal_Bool &rCancelled) return false; } - catch (...) { return false; diff --git a/vcl/source/app/svmainhook.cxx b/vcl/source/app/svmainhook.cxx index dd446125a7aa..47c3854a2987 100644 --- a/vcl/source/app/svmainhook.cxx +++ b/vcl/source/app/svmainhook.cxx @@ -31,89 +31,13 @@ #include <tools/tools.h> #ifndef MACOSX +// MacOSX implementation of ImplSVMainHook is in aqua/source/app/salinst.cxx sal_Bool ImplSVMainHook( int * ) { return sal_False; // indicate that ImplSVMainHook is not implemented } -#else -// MACOSX cocoa implementation of ImplSVMainHook is in aqua/source/app/salinst.cxx -#ifndef QUARTZ // MACOSX (X11) needs the CFRunLoop() -#include <osl/thread.h> -#include <premac.h> -#include <CoreFoundation/CoreFoundation.h> -#include <postmac.h> -#include <unistd.h> - -extern sal_Bool ImplSVMain(); - -// ============================================================================ - - -static void SourceContextCallBack( void *pInfo ) -{ -} - -struct ThreadContext -{ - int* pRet; - CFRunLoopRef* pRunLoopRef; -}; - -static void RunSVMain(void *pData) -{ - ThreadContext* tcx = reinterpret_cast<ThreadContext*>(pData); - - // busy waiting (ok in this case) until the run loop is - // running - while (!CFRunLoopIsWaiting(*tcx->pRunLoopRef)) - usleep(100); - - *tcx->pRet = ImplSVMain(); - - // Force exit since some JVMs won't shutdown when only exit() is invoked - _exit( 0 ); -} - -sal_Bool ImplSVMainHook( int *pnInit ) -{ - // Mac OS X requires that any Cocoa code have a CFRunLoop started in the - // primordial thread. Since all of the AWT classes in Java 1.4 and higher - // are written in Cocoa, we need to start the CFRunLoop here and run - // ImplSVMain() in a secondary thread. - // See http://developer.apple.com/samplecode/simpleJavaLauncher/listing3.html - // for further details and an example - - CFRunLoopRef runLoopRef = CFRunLoopGetCurrent(); - ThreadContext tcx; - tcx.pRet = pnInit; // the return value - tcx.pRunLoopRef = &runLoopRef; - oslThread hThreadID = osl_createThread(RunSVMain, &tcx); - - // Start the CFRunLoop - CFRunLoopSourceContext aSourceContext; - aSourceContext.version = 0; - aSourceContext.info = NULL; - aSourceContext.retain = NULL; - aSourceContext.release = NULL; - aSourceContext.copyDescription = NULL; - aSourceContext.equal = NULL; - aSourceContext.hash = NULL; - aSourceContext.schedule = NULL; - aSourceContext.cancel = NULL; - aSourceContext.perform = &SourceContextCallBack; - CFRunLoopSourceRef aSourceRef = CFRunLoopSourceCreate(NULL, 0, &aSourceContext); - CFRunLoopAddSource(runLoopRef, aSourceRef, kCFRunLoopCommonModes); - CFRunLoopRun(); - - osl_joinWithThread( hThreadID ); - osl_destroyThread( hThreadID ); - - return sal_True; // indicate that ImplSVMainHook is implemented -} - -#endif // MACOSX #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/components/factory.cxx b/vcl/source/components/factory.cxx index 04b0e122cbce..9701e83e886a 100644 --- a/vcl/source/components/factory.cxx +++ b/vcl/source/components/factory.cxx @@ -83,14 +83,7 @@ namespace rsvg extern "C" { - VCL_DLLPUBLIC void SAL_CALL component_getImplementationEnvironment( - const sal_Char** ppEnvTypeName, - uno_Environment** /*ppEnv*/ ) - { - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; - } - - VCL_DLLPUBLIC void* SAL_CALL component_getFactory( + VCL_DLLPUBLIC void* SAL_CALL vcl_component_getFactory( const sal_Char* pImplementationName, void* pXUnoSMgr, void* /*pXUnoKey*/ @@ -144,12 +137,14 @@ extern "C" { xMgr, vcl::DropTarget_getImplementationName(), vcl::DropTarget_createInstance, vcl::DropTarget_getSupportedServiceNames() ); } +#ifdef ENABLE_LIBRSVG else if( vcl::rsvg::Rasterizer_getImplementationName().equalsAscii( pImplementationName ) ) { xFactory = ::cppu::createSingleFactory( xMgr, vcl::rsvg::Rasterizer_getImplementationName(), vcl::rsvg::Rasterizer_createInstance, vcl::rsvg::Rasterizer_getSupportedServiceNames() ); } +#endif if( xFactory.is() ) { xFactory->acquire(); diff --git a/vcl/source/components/makefile.mk b/vcl/source/components/makefile.mk deleted file mode 100644 index 41f21bfa3749..000000000000 --- a/vcl/source/components/makefile.mk +++ /dev/null @@ -1,55 +0,0 @@ -#************************************************************************* -# -# 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. -# -#************************************************************************* - -PRJ=..$/.. - -PRJNAME=vcl -TARGET=components -ENABLE_EXCEPTIONS=TRUE - -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/util$/makefile.pmk -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/util$/makefile2.pmk - -# --- Files -------------------------------------------------------- - -SLOFILES= $(SLO)$/display.obj \ - $(SLO)$/dtranscomp.obj \ - $(SLO)$/fontident.obj \ - $(SLO)$/stringmirror.obj \ - $(SLO)$/rasterizer_rsvg.obj \ - $(SLO)$/factory.obj - -EXCEPTIONSFILES= $(SLO)$/rasterizer_rsvg.obj - - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk -.INCLUDE : $(PRJ)$/util$/target.pmk diff --git a/vcl/source/components/rasterizer_rsvg.cxx b/vcl/source/components/rasterizer_rsvg.cxx index 006b30b28e28..ef0d5f82e937 100644 --- a/vcl/source/components/rasterizer_rsvg.cxx +++ b/vcl/source/components/rasterizer_rsvg.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. @@ -37,23 +38,25 @@ #include <cppuhelper/implbase2.hxx> #include <osl/module.h> +#ifdef SYSTEM_CAIRO +#include <cairo.h> +#else +#include <cairo/cairo.h> +#endif + #include <vector> #if defined MACOSX #define VCL_RSVG_GOBJECT_LIBNAME "libgobject-2.0.0.dylib" - #define VCL_RSVG_CAIRO_LIBNAME "libcairo.2.dylib" #define VCL_RSVG_LIBRSVG_LIBNAME "librsvg-2.2.dylib" #elif defined UNX #define VCL_RSVG_GOBJECT_LIBNAME "libgobject-2.0.so" - #define VCL_RSVG_CAIRO_LIBNAME "libcairo.so" #define VCL_RSVG_LIBRSVG_LIBNAME "librsvg-2.so" #elif defined WNT #define VCL_RSVG_GOBJECT_LIBNAME "gobjectlo.dll" - #define VCL_RSVG_CAIRO_LIBNAME "cairo.dll" #define VCL_RSVG_LIBRSVG_LIBNAME "librsvg-2-2.dll" #else #define VCL_RSVG_GOBJECT_LIBNAME "nogobjectlib" - #define VCL_RSVG_CAIRO_LIBNAME "nocairolib" #define VCL_RSVG_LIBRSVG_LIBNAME "nolibrsvglib" #endif @@ -72,18 +75,6 @@ typedef void* gpointer; struct GError; -enum cairo_format_t { CAIRO_FORMAT_ARGB32 = 0 }; -enum cairo_status_t { CAIRO_STATUS_SUCCESS = 0 }; - -struct cairo_surface_t; -struct cairo_t; -struct cairo_matrix_t -{ - double xx; double yx; - double xy; double yy; - double x0; double y0; -}; - struct RsvgHandle; struct RsvgDimensionData { @@ -126,30 +117,12 @@ public: static LibraryWrapper& get(); - bool isValid() const { return( ( mpGObjectLib != NULL ) && ( mpCairoLib != NULL ) && ( mpRSVGLib != NULL ) ); } + bool isValid() const { return( ( mpGObjectLib != NULL ) && ( mpRSVGLib != NULL ) ); } // G-Object gpointer g_object_unref( gpointer pointer ) { return( (*mp_g_object_unref)( pointer ) ); }; // LibRSVG - - // Cairo - cairo_surface_t* image_surface_create( cairo_format_t format, int width, int height ) { return( (*mp_image_surface_create)( format, width, height ) ); } - void surface_destroy( cairo_surface_t* surface ) { (*mp_surface_destroy)( surface ); } - cairo_status_t surface_status( cairo_surface_t* surface ) { return( (*mp_surface_status)( surface ) ); } - cairo_t* create( cairo_surface_t* surface ) { return( (*mp_create)( surface ) ); } - void destroy( cairo_t* cairo ) { (*mp_destroy )( cairo ); } - void matrix_init_identity( cairo_matrix_t* matrix ){ (*mp_matrix_init_identity)( matrix ); } - void matrix_translate( cairo_matrix_t* matrix, double nx, double ny ) { (*mp_matrix_translate)( matrix, nx, ny ); } - void matrix_scale( cairo_matrix_t* matrix, double sx, double sy ) {( *mp_matrix_scale )( matrix, sx, sy ); } - void matrix_rotate( cairo_matrix_t* matrix, double radians ) { ( *mp_matrix_rotate )( matrix, radians ); } - void transform( cairo_t* cairo, cairo_matrix_t *matrix ) { (*mp_transform)( cairo, matrix ); } - unsigned char* image_surface_get_data(cairo_surface_t* surface) { return( (*mp_image_surface_get_data)( surface ) ); } - int image_surface_get_width(cairo_surface_t* surface) { return( (*mp_image_surface_get_width)( surface ) ); } - int image_surface_get_height(cairo_surface_t* surface) { return( (*mp_image_surface_get_height)( surface ) ); } - int image_surface_get_stride(cairo_surface_t* surface) { return( (*mp_image_surface_get_stride)( surface ) ); } - - // LibRSVG void rsvg_init() { (*mp_rsvg_init)(); } RsvgHandle* rsvg_handle_new_from_data( const guint8* data, gsize size, GError** error) { return( (*mp_rsvg_handle_new_from_data)( data, size, error ) ); } gboolean rsvg_handle_close( RsvgHandle* handle, GError** error ) { return( (*mp_rsvg_handle_close)( handle, error ) ); } @@ -164,28 +137,11 @@ private: private: oslModule mpGObjectLib; - oslModule mpCairoLib; oslModule mpRSVGLib; // GObject gpointer (*mp_g_object_unref)( gpointer ); - // Cairo - cairo_surface_t* (*mp_image_surface_create)(cairo_format_t,int,int); - void (*mp_surface_destroy )(cairo_surface_t*); - cairo_status_t (*mp_surface_status)(cairo_surface_t*); - cairo_t* (*mp_create)(cairo_surface_t*); - void (*mp_destroy)(cairo_t*); - void (*mp_matrix_init_identity)(cairo_matrix_t*); - void (*mp_matrix_translate)( cairo_matrix_t*, double, double); - void (*mp_matrix_scale )( cairo_matrix_t*, double, double); - void (*mp_matrix_rotate)( cairo_matrix_t*, double); - void (*mp_transform)( cairo_t*, cairo_matrix_t*); - unsigned char* (*mp_image_surface_get_data)( cairo_surface_t* ); - int (*mp_image_surface_get_width)(cairo_surface_t* surface); - int (*mp_image_surface_get_height)(cairo_surface_t* surface); - int (*mp_image_surface_get_stride)(cairo_surface_t* surface); - // LibRSVG void (*mp_rsvg_init)( void ); RsvgHandle* (*mp_rsvg_handle_new_from_data)( const guint8*, gsize, GError** ); @@ -211,11 +167,9 @@ LibraryWrapper& LibraryWrapper::get() LibraryWrapper::LibraryWrapper() : mpGObjectLib( NULL ), - mpCairoLib( NULL ), mpRSVGLib( NULL ) { const ::rtl::OUString aGObjectLibName( RTL_CONSTASCII_USTRINGPARAM( VCL_RSVG_GOBJECT_LIBNAME ) ); - const ::rtl::OUString aCairoLibName( RTL_CONSTASCII_USTRINGPARAM( VCL_RSVG_CAIRO_LIBNAME ) ); const ::rtl::OUString aRSVGLibName( RTL_CONSTASCII_USTRINGPARAM( VCL_RSVG_LIBRSVG_LIBNAME ) ); bool bCont = true; @@ -235,47 +189,6 @@ LibraryWrapper::LibraryWrapper() : } } - // Cairo - if( bCont && ( NULL != ( mpCairoLib = osl_loadModule( aCairoLibName.pData, SAL_LOADMODULE_DEFAULT ) ) || - NULL != ( mpCairoLib = osl_loadModuleRelative( (oslGenericFunction)LibraryWrapper::get, - aCairoLibName.pData, SAL_LOADMODULE_DEFAULT ) ) - ) ) - { - mp_image_surface_create = ( cairo_surface_t* (*)( cairo_format_t, int, int ) ) osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_image_surface_create" ); - mp_surface_destroy = ( void (*)( cairo_surface_t* ) ) osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_surface_destroy" ); - mp_surface_status = ( cairo_status_t (*)( cairo_surface_t* ) ) osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_surface_status" ); - mp_create = ( cairo_t* (*)( cairo_surface_t* ) ) osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_create" ); - mp_destroy = ( void (*)( cairo_t* ) ) osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_destroy" ); - mp_matrix_init_identity = ( void (*)( cairo_matrix_t* ) ) osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_matrix_init_identity" ); - mp_matrix_translate = ( void (*)( cairo_matrix_t*, double, double ) ) osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_matrix_translate" ); - mp_matrix_scale = ( void (*)( cairo_matrix_t*, double, double ) ) osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_matrix_scale" ); - mp_matrix_rotate = ( void (*)( cairo_matrix_t*, double ) ) osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_matrix_rotate" ); - mp_transform = ( void (*)( cairo_t*, cairo_matrix_t* ) ) osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_transform" ); - mp_image_surface_get_data = ( unsigned char* (*)( cairo_surface_t* ) ) osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_image_surface_get_data" ); - mp_image_surface_get_width = ( int (*)( cairo_surface_t* ) ) osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_image_surface_get_width" ); - mp_image_surface_get_height = ( int (*)( cairo_surface_t* ) ) osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_image_surface_get_height" ); - mp_image_surface_get_stride = ( int (*)( cairo_surface_t* ) ) osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_image_surface_get_stride" ); - - if( !( mp_image_surface_create && - mp_surface_destroy && - mp_surface_status && - mp_create && - mp_destroy && - mp_matrix_init_identity && - mp_matrix_translate && - mp_matrix_scale && - mp_matrix_rotate && - mp_transform && - mp_image_surface_get_data && - mp_image_surface_get_width && - mp_image_surface_get_height && - mp_image_surface_get_stride ) ) - { - OSL_TRACE( "not all needed symbols were found in cairo library" ); - bCont = false; - } - } - // LibRSVG if( bCont && ( NULL != ( mpRSVGLib = osl_loadModule( aRSVGLibName.pData, SAL_LOADMODULE_DEFAULT ) ) || NULL != ( mpRSVGLib = osl_loadModuleRelative( (oslGenericFunction)LibraryWrapper::get, @@ -302,10 +215,9 @@ LibraryWrapper::LibraryWrapper() : } OSL_ENSURE( mpGObjectLib, "g-object library could not be loaded" ); - OSL_ENSURE( mpCairoLib, "cairo library could not be loaded" ); OSL_ENSURE( mpRSVGLib, "librsvg library could not be loaded" ); - bCont = bCont && mpGObjectLib != NULL && mpCairoLib != NULL && mpRSVGLib != NULL; + bCont = bCont && mpGObjectLib != NULL && mpRSVGLib != NULL; // unload all libraries in case of failure if( !bCont ) @@ -316,12 +228,6 @@ LibraryWrapper::LibraryWrapper() : mpRSVGLib = NULL; } - if( mpCairoLib ) - { - osl_unloadModule( mpCairoLib ); - mpCairoLib = NULL; - } - if( mpGObjectLib ) { osl_unloadModule( mpGObjectLib ); @@ -426,11 +332,10 @@ void Rasterizer::implFreeRsvgHandle() uno::Reference< graphic::XGraphic > Rasterizer::implGetXGraphicFromSurface( cairo_surface_t* pSurface ) const { - LibraryWrapper& rLib = LibraryWrapper::get(); - unsigned char* pData = rLib.image_surface_get_data( pSurface ); - const sal_Int32 nWidth = rLib.image_surface_get_width( pSurface ); - const sal_Int32 nHeight =rLib.image_surface_get_height( pSurface ); - const sal_Int32 nStride = rLib.image_surface_get_stride( pSurface ); + unsigned char* pData = cairo_image_surface_get_data( pSurface ); + const sal_Int32 nWidth = cairo_image_surface_get_width( pSurface ); + const sal_Int32 nHeight = cairo_image_surface_get_height( pSurface ); + const sal_Int32 nStride = cairo_image_surface_get_stride( pSurface ); uno::Reference< graphic::XGraphic > xRet; @@ -563,31 +468,31 @@ uno::Reference< graphic::XGraphic > SAL_CALL Rasterizer::rasterize( ::sal_uInt32 if( mpRsvgHandle && rLib.isValid() && nWidth && nHeight && mnDefaultWidth && mnDefaultHeight ) { - cairo_surface_t* pSurface = rLib.image_surface_create( CAIRO_FORMAT_ARGB32, nWidth, nHeight ); + cairo_surface_t* pSurface = cairo_image_surface_create( CAIRO_FORMAT_ARGB32, nWidth, nHeight ); - if( pSurface && ( CAIRO_STATUS_SUCCESS == rLib.surface_status( pSurface ) ) ) + if( pSurface && ( CAIRO_STATUS_SUCCESS == cairo_surface_status( pSurface ) ) ) { - cairo_t* pCr = rLib.create( pSurface ); + cairo_t* pCr = cairo_create( pSurface ); if( pCr ) { cairo_matrix_t aMatrix; - rLib.matrix_init_identity( &aMatrix ); - rLib.matrix_scale( &aMatrix, + cairo_matrix_init_identity( &aMatrix ); + cairo_matrix_scale( &aMatrix, static_cast< double >( nWidth ) / mnDefaultWidth, static_cast< double >( nHeight ) / mnDefaultHeight ); - rLib.transform( pCr, &aMatrix ); + cairo_transform( pCr, &aMatrix ); if( rLib.rsvg_handle_render_cairo( mpRsvgHandle, pCr ) ) { xRet = implGetXGraphicFromSurface( pSurface ); } - rLib.destroy( pCr ); + cairo_destroy( pCr ); } - rLib.surface_destroy( pSurface ); + cairo_surface_destroy( pSurface ); OSL_ENSURE( xRet.is(), "SVG *not* rendered successfully" ); } } @@ -638,3 +543,5 @@ uno::Reference< uno::XInterface > SAL_CALL Rasterizer_createInstance( const uno: } // namespace rsvg } // namespace vcl + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/components/stringmirror.cxx b/vcl/source/components/stringmirror.cxx index 78806914a7c4..70bf44b568d0 100644 --- a/vcl/source/components/stringmirror.cxx +++ b/vcl/source/components/stringmirror.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. @@ -121,3 +122,5 @@ Sequence< OUString > SAL_CALL StringMirror::getSupportedServiceNames() throw (Ru } } // namespace vcl + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/control/field2.cxx b/vcl/source/control/field2.cxx index 69a3fdbdce9d..4929a8bfa01a 100644 --- a/vcl/source/control/field2.cxx +++ b/vcl/source/control/field2.cxx @@ -241,11 +241,11 @@ static int ImplKommaPointCharEqual( xub_Unicode c1, xub_Unicode c2 ) // ----------------------------------------------------------------------- static XubString ImplPatternReformat( const XubString& rStr, - const ByteString& rEditMask, + const rtl::OString& rEditMask, const XubString& rLiteralMask, sal_uInt16 nFormatFlags ) { - if ( !rEditMask.Len() ) + if (rEditMask.isEmpty()) return rStr; XubString aStr = rStr; @@ -258,14 +258,14 @@ static XubString ImplPatternReformat( const XubString& rStr, xub_StrLen i = 0; xub_StrLen n; - while ( i < rEditMask.Len() ) + while ( i < rEditMask.getLength() ) { if ( nStrIndex >= aStr.Len() ) break; cChar = aStr.GetChar(nStrIndex); cLiteral = rLiteralMask.GetChar(i); - cMask = rEditMask.GetChar(i); + cMask = rEditMask[i]; // Aktuelle Position ein Literal if ( cMask == EDITMASK_LITERAL ) @@ -281,11 +281,11 @@ static XubString ImplPatternReformat( const XubString& rStr, // Dies ist dann der Fall, wenn es nicht in das Muster // des naechsten nicht Literal-Zeichens passt n = i+1; - while ( n < rEditMask.Len() ) + while ( n < rEditMask.getLength() ) { - if ( rEditMask.GetChar(n) != EDITMASK_LITERAL ) + if ( rEditMask[n] != EDITMASK_LITERAL ) { - if ( !ImplIsPatternChar( cChar, rEditMask.GetChar(n) ) ) + if ( !ImplIsPatternChar( cChar, rEditMask[n] ) ) nStrIndex++; break; } @@ -318,9 +318,9 @@ static XubString ImplPatternReformat( const XubString& rStr, if ( nFormatFlags & PATTERN_FORMAT_EMPTYLITERALS ) { n = i; - while ( n < rEditMask.Len() ) + while ( n < rEditMask.getLength() ) { - if ( rEditMask.GetChar( n ) == EDITMASK_LITERAL ) + if ( rEditMask[n] == EDITMASK_LITERAL ) { if ( ImplKommaPointCharEqual( cChar, rLiteralMask.GetChar( n ) ) ) i = n+1; @@ -346,7 +346,7 @@ static XubString ImplPatternReformat( const XubString& rStr, // ----------------------------------------------------------------------- -static void ImplPatternMaxPos( const XubString rStr, const ByteString& rEditMask, +static void ImplPatternMaxPos( const XubString rStr, const rtl::OString& rEditMask, sal_uInt16 nFormatFlags, sal_Bool bSameMask, sal_uInt16 nCursorPos, sal_uInt16& rPos ) { @@ -360,7 +360,7 @@ static void ImplPatternMaxPos( const XubString rStr, const ByteString& rEditMask { while ( nMaxPos ) { - if ( (rEditMask.GetChar(nMaxPos-1) != EDITMASK_LITERAL) && + if ( (rEditMask[nMaxPos-1] != EDITMASK_LITERAL) && (rStr.GetChar(nMaxPos-1) != ' ') ) break; nMaxPos--; @@ -369,9 +369,9 @@ static void ImplPatternMaxPos( const XubString rStr, const ByteString& rEditMask // Wenn wir vor einem Literal stehen, dann solange weitersuchen, // bis erste Stelle nach Literal xub_StrLen nTempPos = nMaxPos; - while ( nTempPos < rEditMask.Len() ) + while ( nTempPos < rEditMask.getLength() ) { - if ( rEditMask.GetChar(nTempPos) != EDITMASK_LITERAL ) + if ( rEditMask[nTempPos] != EDITMASK_LITERAL ) { nMaxPos = nTempPos; break; @@ -390,7 +390,7 @@ static void ImplPatternMaxPos( const XubString rStr, const ByteString& rEditMask // ----------------------------------------------------------------------- static void ImplPatternProcessStrictModify( Edit* pEdit, - const ByteString& rEditMask, + const rtl::OString& rEditMask, const XubString& rLiteralMask, sal_uInt16 nFormatFlags, sal_Bool bSameMask ) { @@ -403,14 +403,14 @@ static void ImplPatternProcessStrictModify( Edit* pEdit, xub_StrLen nMaxLen = aText.Len(); while ( i < nMaxLen ) { - if ( (rEditMask.GetChar( i ) != EDITMASK_LITERAL) && + if ( (rEditMask[i] != EDITMASK_LITERAL) && (aText.GetChar( i ) != ' ') ) break; i++; } // Alle Literalzeichen beibehalten - while ( i && (rEditMask.GetChar( i ) == EDITMASK_LITERAL) ) + while ( i && (rEditMask[i] == EDITMASK_LITERAL) ) i--; aText.Erase( 0, i ); } @@ -442,14 +442,14 @@ static void ImplPatternProcessStrictModify( Edit* pEdit, // ----------------------------------------------------------------------- -static xub_StrLen ImplPatternLeftPos( const ByteString& rEditMask, xub_StrLen nCursorPos ) +static xub_StrLen ImplPatternLeftPos(const rtl::OString& rEditMask, xub_StrLen nCursorPos) { // Vorheriges Zeichen suchen, was kein Literal ist xub_StrLen nNewPos = nCursorPos; xub_StrLen nTempPos = nNewPos; while ( nTempPos ) { - if ( rEditMask.GetChar(nTempPos-1) != EDITMASK_LITERAL ) + if ( rEditMask[nTempPos-1] != EDITMASK_LITERAL ) { nNewPos = nTempPos-1; break; @@ -461,16 +461,16 @@ static xub_StrLen ImplPatternLeftPos( const ByteString& rEditMask, xub_StrLen nC // ----------------------------------------------------------------------- -static xub_StrLen ImplPatternRightPos( const XubString& rStr, const ByteString& rEditMask, +static xub_StrLen ImplPatternRightPos( const XubString& rStr, const rtl::OString& rEditMask, sal_uInt16 nFormatFlags, sal_Bool bSameMask, xub_StrLen nCursorPos ) { // Naechstes Zeichen suchen, was kein Literal ist xub_StrLen nNewPos = nCursorPos; xub_StrLen nTempPos = nNewPos; - while ( nTempPos < rEditMask.Len() ) + while ( nTempPos < rEditMask.getLength() ) { - if ( rEditMask.GetChar(nTempPos+1) != EDITMASK_LITERAL ) + if ( rEditMask[nTempPos+1] != EDITMASK_LITERAL ) { nNewPos = nTempPos+1; break; @@ -484,14 +484,14 @@ static xub_StrLen ImplPatternRightPos( const XubString& rStr, const ByteString& // ----------------------------------------------------------------------- static sal_Bool ImplPatternProcessKeyInput( Edit* pEdit, const KeyEvent& rKEvt, - const ByteString& rEditMask, + const rtl::OString& rEditMask, const XubString& rLiteralMask, sal_Bool bStrictFormat, sal_uInt16 nFormatFlags, sal_Bool bSameMask, sal_Bool& rbInKeyInput ) { - if ( !rEditMask.Len() || !bStrictFormat ) + if ( rEditMask.isEmpty() || !bStrictFormat ) return sal_False; Selection aOldSel = pEdit->GetSelection(); @@ -533,8 +533,8 @@ static sal_Bool ImplPatternProcessKeyInput( Edit* pEdit, const KeyEvent& rKEvt, { // Home ist Position des ersten nicht literalen Zeichens nNewPos = 0; - while ( (nNewPos < rEditMask.Len()) && - (rEditMask.GetChar(nNewPos) == EDITMASK_LITERAL) ) + while ( (nNewPos < rEditMask.getLength()) && + (rEditMask[nNewPos] == EDITMASK_LITERAL) ) nNewPos++; // Home sollte nicht nach rechts wandern if ( nCursorPos < nNewPos ) @@ -548,9 +548,9 @@ static sal_Bool ImplPatternProcessKeyInput( Edit* pEdit, const KeyEvent& rKEvt, else if ( nKeyCode == KEY_END ) { // End ist die Position des letzten nicht literalen Zeichens - nNewPos = rEditMask.Len(); + nNewPos = rEditMask.getLength(); while ( nNewPos && - (rEditMask.GetChar(nNewPos-1) == EDITMASK_LITERAL) ) + (rEditMask[nNewPos-1] == EDITMASK_LITERAL) ) nNewPos--; // Hier nehmen wir Selectionsanfang als minimum, da falls durch // Focus alles selektiert ist, ist eine kleine Position schon @@ -601,7 +601,7 @@ static sal_Bool ImplPatternProcessKeyInput( Edit* pEdit, const KeyEvent& rKEvt, { if ( bSameMask ) { - if ( rEditMask.GetChar( nNewPos ) != EDITMASK_LITERAL ) + if ( rEditMask[nNewPos] != EDITMASK_LITERAL ) aStr.Erase( nNewPos, 1 ); } else @@ -647,9 +647,9 @@ static sal_Bool ImplPatternProcessKeyInput( Edit* pEdit, const KeyEvent& rKEvt, aSel.Justify(); nNewPos = (xub_StrLen)aSel.Min(); - if ( nNewPos < rEditMask.Len() ) + if ( nNewPos < rEditMask.getLength() ) { - xub_Unicode cPattChar = ImplPatternChar( cChar, rEditMask.GetChar(nNewPos) ); + xub_Unicode cPattChar = ImplPatternChar( cChar, rEditMask[nNewPos] ); if ( cPattChar ) cChar = cPattChar; else @@ -661,17 +661,17 @@ static sal_Bool ImplPatternProcessKeyInput( Edit* pEdit, const KeyEvent& rKEvt, // nicht dazu fuehren, das der Anwender dann da steht, wo // er nicht stehen wollte. if ( nNewPos && - (rEditMask.GetChar(nNewPos-1) != EDITMASK_LITERAL) && + (rEditMask[nNewPos-1] != EDITMASK_LITERAL) && !aSel.Len() ) { // Naechstes Zeichen suchen, was kein Literal ist nTempPos = nNewPos; - while ( nTempPos < rEditMask.Len() ) + while ( nTempPos < rEditMask.getLength() ) { - if ( rEditMask.GetChar(nTempPos) == EDITMASK_LITERAL ) + if ( rEditMask[nTempPos] == EDITMASK_LITERAL ) { // Gilt nur, wenn ein Literalzeichen vorhanden - if ( (rEditMask.GetChar(nTempPos+1) != EDITMASK_LITERAL ) && + if ( (rEditMask[nTempPos+1] != EDITMASK_LITERAL ) && ImplKommaPointCharEqual( cChar, rLiteralMask.GetChar(nTempPos) ) ) { nTempPos++; @@ -705,7 +705,7 @@ static sal_Bool ImplPatternProcessKeyInput( Edit* pEdit, const KeyEvent& rKEvt, while ( n && (n > nNewPos) ) { if ( (aStr.GetChar( n-1 ) != ' ') && - ((n > rEditMask.Len()) || (rEditMask.GetChar(n-1) != EDITMASK_LITERAL)) ) + ((n > rEditMask.getLength()) || (rEditMask[n-1] != EDITMASK_LITERAL)) ) break; n--; @@ -715,14 +715,14 @@ static sal_Bool ImplPatternProcessKeyInput( Edit* pEdit, const KeyEvent& rKEvt, if ( aSel.Len() ) aStr.Erase( (xub_StrLen)aSel.Min(), (xub_StrLen)aSel.Len() ); - if ( aStr.Len() < rEditMask.Len() ) + if ( aStr.Len() < rEditMask.getLength() ) { // String evtl. noch bis Cursor-Position erweitern if ( aStr.Len() < nNewPos ) aStr += rLiteralMask.Copy( aStr.Len(), nNewPos-aStr.Len() ); if ( nNewPos < aStr.Len() ) aStr.Insert( cChar, nNewPos ); - else if ( nNewPos < rEditMask.Len() ) + else if ( nNewPos < rEditMask.getLength() ) aStr += cChar; aStr = ImplPatternReformat( aStr, rEditMask, rLiteralMask, nFormatFlags ); } @@ -740,7 +740,7 @@ static sal_Bool ImplPatternProcessKeyInput( Edit* pEdit, const KeyEvent& rKEvt, if ( nNewPos < aStr.Len() ) aStr.SetChar( nNewPos, cChar ); - else if ( nNewPos < rEditMask.Len() ) + else if ( nNewPos < rEditMask.getLength() ) aStr += cChar; } @@ -764,19 +764,19 @@ static sal_Bool ImplPatternProcessKeyInput( Edit* pEdit, const KeyEvent& rKEvt, // ----------------------------------------------------------------------- -void PatternFormatter::ImplSetMask( const ByteString& rEditMask, - const XubString& rLiteralMask ) +void PatternFormatter::ImplSetMask(const rtl::OString& rEditMask, + const XubString& rLiteralMask) { - maEditMask = rEditMask; + m_aEditMask = rEditMask; maLiteralMask = rLiteralMask; mbSameMask = sal_True; - if ( maEditMask.Len() != maLiteralMask.Len() ) + if ( m_aEditMask.getLength() != maLiteralMask.Len() ) { - if ( maEditMask.Len() < maLiteralMask.Len() ) - maLiteralMask.Erase( maEditMask.Len() ); + if ( m_aEditMask.getLength() < maLiteralMask.Len() ) + maLiteralMask.Erase(m_aEditMask.getLength()); else - maLiteralMask.Expand( maEditMask.Len(), ' ' ); + maLiteralMask.Expand(m_aEditMask.getLength(), ' '); } // StrictModus erlaubt nur Input-Mode, wenn als Maske nur @@ -785,9 +785,9 @@ void PatternFormatter::ImplSetMask( const ByteString& rEditMask, // nicht zugelassen sind xub_StrLen i = 0; sal_Char c = 0; - while ( i < rEditMask.Len() ) + while ( i < rEditMask.getLength() ) { - sal_Char cTemp = rEditMask.GetChar( i ); + sal_Char cTemp = rEditMask[i]; if ( cTemp != EDITMASK_LITERAL ) { if ( (cTemp == EDITMASK_ALLCHAR) || @@ -830,7 +830,7 @@ PatternFormatter::PatternFormatter() void PatternFormatter::ImplLoadRes( const ResId& rResId ) { - ByteString aEditMask; + rtl::OString aEditMask; XubString aLiteralMask; ResMgr* pMgr = rResId.GetResMgr(); if( pMgr ) @@ -841,7 +841,10 @@ void PatternFormatter::ImplLoadRes( const ResId& rResId ) SetStrictFormat( (sal_Bool)pMgr->ReadShort() ); if ( PATTERNFORMATTER_EDITMASK & nMask ) - aEditMask = ByteString( pMgr->ReadString(), RTL_TEXTENCODING_ASCII_US ); + { + aEditMask = rtl::OUStringToOString(pMgr->ReadString(), + RTL_TEXTENCODING_ASCII_US); + } if ( PATTERNFORMATTER_LITTERALMASK & nMask ) aLiteralMask = pMgr->ReadString(); @@ -859,7 +862,7 @@ PatternFormatter::~PatternFormatter() // ----------------------------------------------------------------------- -void PatternFormatter::SetMask( const ByteString& rEditMask, +void PatternFormatter::SetMask( const rtl::OString& rEditMask, const XubString& rLiteralMask ) { ImplSetMask( rEditMask, rLiteralMask ); @@ -885,7 +888,7 @@ XubString PatternFormatter::GetString() const if ( !GetField() ) return ImplGetSVEmptyStr(); else - return ImplPatternReformat( GetField()->GetText(), maEditMask, maLiteralMask, mnFormatFlags ); + return ImplPatternReformat( GetField()->GetText(), m_aEditMask, maLiteralMask, mnFormatFlags ); } // ----------------------------------------------------------------------- @@ -894,7 +897,7 @@ void PatternFormatter::Reformat() { if ( GetField() ) { - ImplSetText( ImplPatternReformat( GetField()->GetText(), maEditMask, maLiteralMask, mnFormatFlags ) ); + ImplSetText( ImplPatternReformat( GetField()->GetText(), m_aEditMask, maLiteralMask, mnFormatFlags ) ); if ( !mbSameMask && IsStrictFormat() && !GetField()->IsReadOnly() ) GetField()->SetInsertMode( sal_False ); } @@ -3047,35 +3050,6 @@ Time TimeFormatter::GetTime() const // ----------------------------------------------------------------------- -Time TimeFormatter::GetRealTime() const -{ - Time aTime( 0, 0, 0 ); - - if ( GetField() ) - { - sal_Bool bAllowMailformed = ImplAllowMalformedInput(); - if ( !ImplTimeGetValue( GetField()->GetText(), aTime, GetFormat(), IsDuration(), ImplGetLocaleDataWrapper(), !bAllowMailformed ) ) - if ( bAllowMailformed ) - aTime = GetInvalidTime(); - } - - return aTime; -} - -// ----------------------------------------------------------------------- - -sal_Bool TimeFormatter::IsTimeModified() const -{ - if ( ImplGetEmptyFieldValue() ) - return !IsEmptyTime(); - else if ( GetTime() != maFieldTime ) - return sal_True; - else - return sal_False; -} - -// ----------------------------------------------------------------------- - void TimeFormatter::Reformat() { if ( !GetField() ) @@ -3320,26 +3294,6 @@ TimeBox::TimeBox( Window* pParent, WinBits nWinStyle ) : // ----------------------------------------------------------------------- -TimeBox::TimeBox( Window* pParent, const ResId& rResId ) : - ComboBox( WINDOW_TIMEBOX ) -{ - rResId.SetRT( RSC_TIMEBOX ); - WinBits nStyle = ImplInitRes( rResId ); - ComboBox::ImplInit( pParent, nStyle ); - SetField( this ); - SetText( ImplGetLocaleDataWrapper().getTime( maFieldTime, sal_False, sal_False ) ); - ComboBox::ImplLoadRes( rResId ); - ResMgr* pMgr = rResId.GetResMgr(); - if( pMgr ) - TimeFormatter::ImplLoadRes( ResId( (RSHEADER_TYPE *)GetClassRes(), *pMgr ) ); - Reformat(); - - if ( !(nStyle & WB_HIDE) ) - Show(); -} - -// ----------------------------------------------------------------------- - TimeBox::~TimeBox() { } @@ -3411,58 +3365,4 @@ void TimeBox::ReformatAll() SetUpdateMode( sal_True ); } -// ----------------------------------------------------------------------- - -void TimeBox::InsertTime( const Time& rTime, sal_uInt16 nPos ) -{ - Time aTime = rTime; - if ( aTime > GetMax() ) - aTime = GetMax(); - else if ( aTime < GetMin() ) - aTime = GetMin(); - - sal_Bool bSec = sal_False; - sal_Bool b100Sec = sal_False; - if ( GetFormat() == TIMEF_SEC ) - bSec = sal_True; - if ( GetFormat() == TIMEF_100TH_SEC || GetFormat() == TIMEF_SEC_CS ) - bSec = b100Sec = sal_True; - ComboBox::InsertEntry( ImplGetLocaleDataWrapper().getTime( aTime, bSec, b100Sec ), nPos ); -} - -// ----------------------------------------------------------------------- - -void TimeBox::RemoveTime( const Time& rTime ) -{ - sal_Bool bSec = sal_False; - sal_Bool b100Sec = sal_False; - if ( GetFormat() == TIMEF_SEC ) - bSec = sal_True; - if ( GetFormat() == TIMEF_100TH_SEC || TIMEF_SEC_CS ) - bSec = b100Sec = sal_True; - ComboBox::RemoveEntry( ImplGetLocaleDataWrapper().getTime( rTime, bSec, b100Sec ) ); -} - -// ----------------------------------------------------------------------- - -Time TimeBox::GetTime( sal_uInt16 nPos ) const -{ - Time aTime( 0, 0, 0 ); - ImplTimeGetValue( ComboBox::GetEntry( nPos ), aTime, GetFormat(), IsDuration(), ImplGetLocaleDataWrapper() ); - return aTime; -} - -// ----------------------------------------------------------------------- - -sal_uInt16 TimeBox::GetTimePos( const Time& rTime ) const -{ - sal_Bool bSec = sal_False; - sal_Bool b100Sec = sal_False; - if ( GetFormat() == TIMEF_SEC ) - bSec = sal_True; - if ( GetFormat() == TIMEF_100TH_SEC || TIMEF_SEC_CS ) - bSec = b100Sec = sal_True; - return ComboBox::GetEntryPos( ImplGetLocaleDataWrapper().getTime( rTime, bSec, b100Sec ) ); -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/control/quickselectionengine.cxx b/vcl/source/control/quickselectionengine.cxx index 2d32393bf79a..ee479d27ab20 100644 --- a/vcl/source/control/quickselectionengine.cxx +++ b/vcl/source/control/quickselectionengine.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. * @@ -181,3 +182,5 @@ namespace vcl //........................................................................ } // namespace vcl //........................................................................ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx index 765907721ed6..7bdd0d3af0bf 100644 --- a/vcl/source/control/tabctrl.cxx +++ b/vcl/source/control/tabctrl.cxx @@ -1981,18 +1981,6 @@ TabPage* TabControl::GetTabPage( sal_uInt16 nPageId ) const // ----------------------------------------------------------------------- -sal_uInt16 TabControl::GetTabPageResId( sal_uInt16 nPageId ) const -{ - ImplTabItem* pItem = ImplGetItem( nPageId ); - - if ( pItem ) - return pItem->mnTabPageResId; - else - return 0; -} - -// ----------------------------------------------------------------------- - void TabControl::SetPageText( sal_uInt16 nPageId, const XubString& rText ) { ImplTabItem* pItem = ImplGetItem( nPageId ); @@ -2059,16 +2047,6 @@ const XubString& TabControl::GetHelpText( sal_uInt16 nPageId ) const // ----------------------------------------------------------------------- -void TabControl::SetHelpId( sal_uInt16 nPageId, const rtl::OString& rHelpId ) -{ - ImplTabItem* pItem = ImplGetItem( nPageId ); - - if ( pItem ) - pItem->maHelpId = rHelpId; -} - -// ----------------------------------------------------------------------- - rtl::OString TabControl::GetHelpId( sal_uInt16 nPageId ) const { rtl::OString aRet; @@ -2097,14 +2075,6 @@ void TabControl::SetPageImage( sal_uInt16 i_nPageId, const Image& i_rImage ) // ----------------------------------------------------------------------- -const Image* TabControl::GetPageImage( sal_uInt16 i_nPageId ) const -{ - const ImplTabItem* pItem = ImplGetItem( i_nPageId ); - return pItem ? &pItem->maTabImage : NULL; -} - -// ----------------------------------------------------------------------- - Rectangle TabControl::GetCharacterBounds( sal_uInt16 nPageId, long nIndex ) const { Rectangle aRet; diff --git a/vcl/source/control/throbber.cxx b/vcl/source/control/throbber.cxx index a55fdb3eb379..4aa456c1ddcf 100644 --- a/vcl/source/control/throbber.cxx +++ b/vcl/source/control/throbber.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. @@ -323,3 +324,5 @@ IMPL_LINK( Throbber, TimeOutHdl, void*, EMPTYARG ) return 0; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/fontsubset/cff.cxx b/vcl/source/fontsubset/cff.cxx index eed5a9e1ac07..b6516fcc624b 100644 --- a/vcl/source/fontsubset/cff.cxx +++ b/vcl/source/fontsubset/cff.cxx @@ -1868,7 +1868,6 @@ const char* CffSubsetterContext::getGlyphName( int nGlyphIndex) class Type1Emitter { public: - explicit Type1Emitter( const char* pOutFileName, bool bPfbSubset = true); explicit Type1Emitter( FILE* pOutFile, bool bPfbSubset = true); /*virtual*/ ~Type1Emitter( void); void setSubsetName( const char* ); @@ -1895,20 +1894,6 @@ public: // -------------------------------------------------------------------- -Type1Emitter::Type1Emitter( const char* pPfbFileName, bool bPfbSubset) -: mpFileOut( NULL) -, mbCloseOutfile( true) -, mnEECryptR( 55665) // default eexec seed, TODO: mnEECryptSeed -, mpPtr( maBuffer) -, mbPfbSubset( bPfbSubset) -, mnHexLineCol( 0) -{ - mpFileOut = fopen( pPfbFileName, "wb"); - maSubsetName[0] = '\0'; -} - -// -------------------------------------------------------------------- - Type1Emitter::Type1Emitter( FILE* pOutFile, bool bPfbSubset) : mpFileOut( pOutFile) , mbCloseOutfile( false) diff --git a/vcl/source/fontsubset/gsub.cxx b/vcl/source/fontsubset/gsub.cxx index da0d84cec089..7dcdc42e88f4 100644 --- a/vcl/source/fontsubset/gsub.cxx +++ b/vcl/source/fontsubset/gsub.cxx @@ -162,7 +162,7 @@ int ReadGSUB( struct _TrueTypeFont* pTTFile, } } - if( !aFeatureIndexList.size() ) + if( aFeatureIndexList.empty() ) return true; UshortList aLookupIndexList; @@ -318,7 +318,7 @@ int ReadGSUB( struct _TrueTypeFont* pTTFile, } // now apply the glyph substitutions that have been collected in this subtable - if( aSubstVector.size() > 0 ) + if( !aSubstVector.empty() ) { GlyphSubstitution* pGSubstitution = new GlyphSubstitution; pTTFile->pGSubstitution = (void*)pGSubstitution; diff --git a/vcl/source/fontsubset/list.c b/vcl/source/fontsubset/list.c index def5faa7b553..8b0b0f827a20 100644 --- a/vcl/source/fontsubset/list.c +++ b/vcl/source/fontsubset/list.c @@ -140,24 +140,6 @@ int listIsEmpty(list this) return this->aCount == 0; } -int listFind(list this, void *el) -{ - lnode *ptr; - assert(this != 0); - - ptr = this->head; - - while (ptr) { - if (ptr->value == el) { - this->cptr = ptr; - return 1; - } - ptr = ptr->next; - } - - return 0; -} - int listNext(list this) { return listSkipForward(this, 1); @@ -201,21 +183,6 @@ int listToLast(list this) return 0; } -int listPositionAt(list this, int n) /*- returns the actual position number */ -{ - int m = 0; - assert(this != 0); - - this->cptr = this->head; - while (n != 0) { - if (this->cptr->next == 0) break; - this->cptr = this->cptr->next; - n--; - m++; - } - return m; -} - list listAppend(list this, void *el) { assert(this != 0); diff --git a/vcl/source/gdi/animate.cxx b/vcl/source/gdi/animate.cxx index 63d0010bd5d2..9dcbce01ffaf 100644 --- a/vcl/source/gdi/animate.cxx +++ b/vcl/source/gdi/animate.cxx @@ -100,7 +100,6 @@ Animation::Animation() : { DBG_CTOR( Animation, NULL ); maTimer.SetTimeoutHdl( LINK( this, Animation, ImplTimeoutHdl ) ); - mpViewList = new List; } // ----------------------------------------------------------------------- @@ -117,11 +116,10 @@ Animation::Animation( const Animation& rAnimation ) : { DBG_CTOR( Animation, NULL ); - for( long i = 0, nCount = rAnimation.maList.Count(); i < nCount; i++ ) - maList.Insert( new AnimationBitmap( *(AnimationBitmap*) rAnimation.maList.GetObject( i ) ), LIST_APPEND ); + for( size_t i = 0, nCount = rAnimation.maList.size(); i < nCount; i++ ) + maList.push_back( new AnimationBitmap( *rAnimation.maList[ i ] ) ); maTimer.SetTimeoutHdl( LINK( this, Animation, ImplTimeoutHdl ) ); - mpViewList = new List; mnLoops = mbLoopTerminated ? 0 : mnLoopCount; } @@ -134,13 +132,11 @@ Animation::~Animation() if( mbIsInAnimation ) Stop(); - for( void* pStepBmp = maList.First(); pStepBmp; pStepBmp = maList.Next() ) - delete (AnimationBitmap*) pStepBmp; + for( size_t i = 0, n = maList.size(); i < n; ++i ) + delete maList[ i ]; - for( void* pView = mpViewList->First(); pView; pView = mpViewList->Next() ) - delete (ImplAnimView*) pView; - - delete mpViewList; + for( size_t i = 0, n = maViewList.size(); i < n; ++i ) + delete maViewList[ i ]; } // ----------------------------------------------------------------------- @@ -149,8 +145,8 @@ Animation& Animation::operator=( const Animation& rAnimation ) { Clear(); - for( long i = 0, nCount = rAnimation.maList.Count(); i < nCount; i++ ) - maList.Insert( new AnimationBitmap( *(AnimationBitmap*) rAnimation.maList.GetObject( i ) ), LIST_APPEND ); + for( size_t i = 0, nCount = rAnimation.maList.size(); i < nCount; i++ ) + maList.push_back( new AnimationBitmap( *rAnimation.maList[ i ] ) ); maGlobalSize = rAnimation.maGlobalSize; maBitmapEx = rAnimation.maBitmapEx; @@ -168,20 +164,20 @@ Animation& Animation::operator=( const Animation& rAnimation ) sal_Bool Animation::operator==( const Animation& rAnimation ) const { - const sal_uLong nCount = maList.Count(); - sal_Bool bRet = sal_False; + const size_t nCount = maList.size(); + sal_Bool bRet = sal_False; - if( rAnimation.maList.Count() == nCount && - rAnimation.maBitmapEx == maBitmapEx && - rAnimation.maGlobalSize == maGlobalSize && - rAnimation.meCycleMode == meCycleMode ) + if( rAnimation.maList.size() == nCount + && rAnimation.maBitmapEx == maBitmapEx + && rAnimation.maGlobalSize == maGlobalSize + && rAnimation.meCycleMode == meCycleMode + ) { bRet = sal_True; - for( sal_uLong n = 0; n < nCount; n++ ) + for( size_t n = 0; n < nCount; n++ ) { - if( ( *(AnimationBitmap*) maList.GetObject( n ) ) != - ( *(AnimationBitmap*) rAnimation.maList.GetObject( n ) ) ) + if( ( *maList[ n ] ) != ( *rAnimation.maList[ n ] ) ) { bRet = sal_False; break; @@ -194,29 +190,9 @@ sal_Bool Animation::operator==( const Animation& rAnimation ) const // ------------------------------------------------------------------ -sal_Bool Animation::IsEqual( const Animation& rAnimation ) const -{ - const sal_uLong nCount = maList.Count(); - sal_Bool bRet = sal_False; - - if( rAnimation.maList.Count() == nCount && - rAnimation.maBitmapEx.IsEqual( maBitmapEx ) && - rAnimation.maGlobalSize == maGlobalSize && - rAnimation.meCycleMode == meCycleMode ) - { - for( sal_uLong n = 0; ( n < nCount ) && !bRet; n++ ) - if( ( (AnimationBitmap*) maList.GetObject( n ) )->IsEqual( *(AnimationBitmap*) rAnimation.maList.GetObject( n ) ) ) - bRet = sal_True; - } - - return bRet; -} - -// ------------------------------------------------------------------ - sal_Bool Animation::IsEmpty() const { - return( maBitmapEx.IsEmpty() && !maList.Count() ); + return( maBitmapEx.IsEmpty() && maList.empty() ); } // ------------------------------------------------------------------ @@ -228,13 +204,13 @@ void Animation::SetEmpty() maGlobalSize = Size(); maBitmapEx.SetEmpty(); - for( void* pStepBmp = maList.First(); pStepBmp; pStepBmp = maList.Next() ) - delete (AnimationBitmap*) pStepBmp; - maList.Clear(); + for( size_t i = 0, n = maList.size(); i < n; ++i ) + delete maList[ i ]; + maList.clear(); - for( void* pView = mpViewList->First(); pView; pView = mpViewList->Next() ) - delete (ImplAnimView*) pView; - mpViewList->Clear(); + for( size_t i = 0, n = maViewList.size(); i < n; ++i ) + delete maViewList[ i ]; + maViewList.clear(); } // ----------------------------------------------------------------------- @@ -256,11 +232,13 @@ sal_Bool Animation::IsTransparent() const // ersetzt werden soll, muessen wir 'transparent' sein, um // richtig dargestellt zu werden, da die Appl. aus Optimierungsgruenden // kein Invalidate auf nicht-transp. Grafiken ausfuehren - for( long i = 0, nCount = maList.Count(); i < nCount; i++ ) + for( size_t i = 0, nCount = maList.size(); i < nCount; i++ ) { - const AnimationBitmap* pAnimBmp = (AnimationBitmap*) maList.GetObject( i ); + const AnimationBitmap* pAnimBmp = maList[ i ]; - if( DISPOSE_BACK == pAnimBmp->eDisposal && Rectangle( pAnimBmp->aPosPix, pAnimBmp->aSizePix ) != aRect ) + if( DISPOSE_BACK == pAnimBmp->eDisposal + && Rectangle( pAnimBmp->aPosPix, pAnimBmp->aSizePix ) != aRect + ) { bRet = sal_True; break; @@ -279,9 +257,9 @@ sal_uLong Animation::GetSizeBytes() const { sal_uLong nSizeBytes = GetBitmapEx().GetSizeBytes(); - for( long i = 0, nCount = maList.Count(); i < nCount; i++ ) + for( size_t i = 0, nCount = maList.size(); i < nCount; i++ ) { - const AnimationBitmap* pAnimBmp = (AnimationBitmap*) maList.GetObject( i ); + const AnimationBitmap* pAnimBmp = maList[ i ]; nSizeBytes += pAnimBmp->aBmpEx.GetSizeBytes(); } @@ -295,7 +273,7 @@ sal_uLong Animation::GetChecksum() const SVBT32 aBT32; sal_uInt32 nCrc = GetBitmapEx().GetChecksum(); - UInt32ToSVBT32( maList.Count(), aBT32 ); + UInt32ToSVBT32( maList.size(), aBT32 ); nCrc = rtl_crc32( nCrc, aBT32, 4 ); UInt32ToSVBT32( maGlobalSize.Width(), aBT32 ); @@ -307,9 +285,9 @@ sal_uLong Animation::GetChecksum() const UInt32ToSVBT32( (long) meCycleMode, aBT32 ); nCrc = rtl_crc32( nCrc, aBT32, 4 ); - for( long i = 0, nCount = maList.Count(); i < nCount; i++ ) + for( size_t i = 0, nCount = maList.size(); i < nCount; i++ ) { - UInt32ToSVBT32( ( (AnimationBitmap*) maList.GetObject( i ) )->GetChecksum(), aBT32 ); + UInt32ToSVBT32( maList[ i ]->GetChecksum(), aBT32 ); nCrc = rtl_crc32( nCrc, aBT32, 4 ); } @@ -331,16 +309,19 @@ sal_Bool Animation::Start( OutputDevice* pOut, const Point& rDestPt, const Size& { sal_Bool bRet = sal_False; - if( maList.Count() ) + if( !maList.empty() ) { - if( ( pOut->GetOutDevType() == OUTDEV_WINDOW ) && !mbLoopTerminated && - ( ANIMATION_TIMEOUT_ON_CLICK != ( (AnimationBitmap*) maList.GetObject( mnPos ) )->nWait ) ) + if( ( pOut->GetOutDevType() == OUTDEV_WINDOW ) + && !mbLoopTerminated + && ( ANIMATION_TIMEOUT_ON_CLICK != maList[ mnPos ]->nWait ) + ) { ImplAnimView* pView; ImplAnimView* pMatch = NULL; - for( pView = (ImplAnimView*) mpViewList->First(); pView; pView = (ImplAnimView*) mpViewList->Next() ) + for( size_t i = 0; i < maViewList.size(); ++i ) { + pView = maViewList[ i ]; if( pView->ImplMatches( pOut, nExtraData ) ) { if( pView->ImplGetOutPos() == rDestPt && @@ -351,7 +332,8 @@ sal_Bool Animation::Start( OutputDevice* pOut, const Point& rDestPt, const Size& } else { - delete (ImplAnimView*) mpViewList->Remove( pView ); + delete maViewList[ i ]; + maViewList.erase( maViewList.begin() + i ); pView = NULL; } @@ -359,7 +341,7 @@ sal_Bool Animation::Start( OutputDevice* pOut, const Point& rDestPt, const Size& } } - if( !mpViewList->Count() ) + if( maViewList.empty() ) { maTimer.Stop(); mbIsInAnimation = sal_False; @@ -367,11 +349,11 @@ sal_Bool Animation::Start( OutputDevice* pOut, const Point& rDestPt, const Size& } if( !pMatch ) - mpViewList->Insert( new ImplAnimView( this, pOut, rDestPt, rDestSz, nExtraData, pFirstFrameOutDev ), LIST_APPEND ); + maViewList.push_back( new ImplAnimView( this, pOut, rDestPt, rDestSz, nExtraData, pFirstFrameOutDev ) ); if( !mbIsInAnimation ) { - ImplRestartTimer( ( (AnimationBitmap*) maList.GetObject( mnPos ) )->nWait ); + ImplRestartTimer( maList[ mnPos ]->nWait ); mbIsInAnimation = sal_True; } } @@ -388,20 +370,21 @@ sal_Bool Animation::Start( OutputDevice* pOut, const Point& rDestPt, const Size& void Animation::Stop( OutputDevice* pOut, long nExtraData ) { - ImplAnimView* pView = (ImplAnimView*) mpViewList->First(); - - while( pView ) + for( size_t i = 0; i < maViewList.size(); ) { + + + ImplAnimView* pView = maViewList[ i ]; if( pView->ImplMatches( pOut, nExtraData ) ) { - delete (ImplAnimView*) mpViewList->Remove( pView ); - pView = (ImplAnimView*) mpViewList->GetCurObject(); + delete pView; + maViewList.erase( maViewList.begin() + i ); } else - pView = (ImplAnimView*) mpViewList->Next(); + i++; } - if( !mpViewList->Count() ) + if( maViewList.empty() ) { maTimer.Stop(); mbIsInAnimation = sal_False; @@ -419,19 +402,21 @@ void Animation::Draw( OutputDevice* pOut, const Point& rDestPt ) const void Animation::Draw( OutputDevice* pOut, const Point& rDestPt, const Size& rDestSz ) const { - const sal_uLong nCount = maList.Count(); + const size_t nCount = maList.size(); if( nCount ) { - AnimationBitmap* pObj = (AnimationBitmap*) maList.GetObject( Min( mnPos, (long) nCount - 1L ) ); + AnimationBitmap* pObj = maList[ Min( mnPos, nCount - 1 ) ]; - if( pOut->GetConnectMetaFile() || ( pOut->GetOutDevType() == OUTDEV_PRINTER ) ) - ( (AnimationBitmap*) maList.GetObject( 0 ) )->aBmpEx.Draw( pOut, rDestPt, rDestSz ); + if( pOut->GetConnectMetaFile() + || ( pOut->GetOutDevType() == OUTDEV_PRINTER ) + ) + maList[ 0 ]->aBmpEx.Draw( pOut, rDestPt, rDestSz ); else if( ANIMATION_TIMEOUT_ON_CLICK == pObj->nWait ) pObj->aBmpEx.Draw( pOut, rDestPt, rDestSz ); else { - const sal_uLong nOldPos = mnPos; + const size_t nOldPos = mnPos; ( (Animation*) this )->mnPos = mbLoopTerminated ? ( nCount - 1UL ) : mnPos; delete new ImplAnimView( (Animation*) this, pOut, rDestPt, rDestSz, 0 ); ( (Animation*) this )->mnPos = nOldPos; @@ -448,35 +433,38 @@ void Animation::ImplRestartTimer( sal_uLong nTimeout ) } // ----------------------------------------------------------------------- +typedef ::std::vector< AInfo* > AInfoList_impl; IMPL_LINK( Animation, ImplTimeoutHdl, Timer*, EMPTYARG ) { - const sal_uLong nAnimCount = maList.Count(); + const size_t nAnimCount = maList.size(); + AInfoList_impl aAInfoList; if( nAnimCount ) { ImplAnimView* pView; - sal_Bool bGlobalPause = sal_True; + sal_Bool bGlobalPause = sal_True; if( maNotifyLink.IsSet() ) { AInfo* pAInfo; // create AInfo-List - for( pView = (ImplAnimView*) mpViewList->First(); pView; pView = (ImplAnimView*) mpViewList->Next() ) - maAInfoList.Insert( pView->ImplCreateAInfo() ); + for( size_t i = 0, n = maViewList.size(); i < n; ++i ) + aAInfoList.push_back( maViewList[ i ]->ImplCreateAInfo() ); maNotifyLink.Call( this ); // set view state from AInfo structure - for( pAInfo = (AInfo*) maAInfoList.First(); pAInfo; pAInfo = (AInfo*) maAInfoList.Next() ) + for( size_t i = 0, n = aAInfoList.size(); i < n; ++i ) { + pAInfo = aAInfoList[ i ]; if( !pAInfo->pViewData ) { pView = new ImplAnimView( this, pAInfo->pOutDev, pAInfo->aStartOrg, pAInfo->aStartSize, pAInfo->nExtraData ); - mpViewList->Insert( pView, LIST_APPEND ); + maViewList.push_back( pView ); } else pView = (ImplAnimView*) pAInfo->pViewData; @@ -486,18 +474,18 @@ IMPL_LINK( Animation, ImplTimeoutHdl, Timer*, EMPTYARG ) } // delete AInfo structures - for( pAInfo = (AInfo*) maAInfoList.First(); pAInfo; pAInfo = (AInfo*) maAInfoList.Next() ) - delete (AInfo*) pAInfo; - maAInfoList.Clear(); + for( size_t i = 0, n = aAInfoList.size(); i < n; ++i ) + delete aAInfoList[ i ]; + aAInfoList.clear(); // delete all unmarked views and reset marked state - pView = (ImplAnimView*) mpViewList->First(); - while( pView ) + for( size_t i = 0; i < maViewList.size(); ) { + pView = maViewList[ i ]; if( !pView->ImplIsMarked() ) { - delete (ImplAnimView*) mpViewList->Remove( pView ); - pView = (ImplAnimView*) mpViewList->GetCurObject(); + delete pView; + maViewList.erase( maViewList.begin() + i ); } else { @@ -505,20 +493,20 @@ IMPL_LINK( Animation, ImplTimeoutHdl, Timer*, EMPTYARG ) bGlobalPause = sal_False; pView->ImplSetMarked( sal_False ); - pView = (ImplAnimView*) mpViewList->Next(); + i++; } } } else bGlobalPause = sal_False; - if( !mpViewList->Count() ) + if( maViewList.empty() ) Stop(); else if( bGlobalPause ) ImplRestartTimer( 10 ); else { - AnimationBitmap* pStepBmp = (AnimationBitmap*) maList.GetObject( ++mnPos ); + AnimationBitmap* pStepBmp = (++mnPos < maList.size()) ? maList[ mnPos ] : NULL; if( !pStepBmp ) { @@ -527,7 +515,7 @@ IMPL_LINK( Animation, ImplTimeoutHdl, Timer*, EMPTYARG ) Stop(); mbLoopTerminated = sal_True; mnPos = nAnimCount - 1UL; - maBitmapEx = ( (AnimationBitmap*) maList.GetObject( mnPos ) )->aBmpEx; + maBitmapEx = maList[ mnPos ]->aBmpEx; return 0L; } else @@ -536,7 +524,7 @@ IMPL_LINK( Animation, ImplTimeoutHdl, Timer*, EMPTYARG ) mnLoops--; mnPos = 0; - pStepBmp = (AnimationBitmap*) maList.GetObject( mnPos ); + pStepBmp = maList[ mnPos ]; } } @@ -544,22 +532,22 @@ IMPL_LINK( Animation, ImplTimeoutHdl, Timer*, EMPTYARG ) // marked; in this case remove view, because area of output // lies out of display area of window; mark state is // set from view itself - pView = (ImplAnimView*) mpViewList->First(); - while( pView ) + for( size_t i = 0; i < maViewList.size(); ) { + pView = maViewList[ i ]; pView->ImplDraw( mnPos ); if( pView->ImplIsMarked() ) { - delete (ImplAnimView*) mpViewList->Remove( pView ); - pView = (ImplAnimView*) mpViewList->GetCurObject(); + delete pView; + maViewList.erase( maViewList.begin() + i ); } else - pView = (ImplAnimView*) mpViewList->Next(); + i++; } // stop or restart timer - if( !mpViewList->Count() ) + if( maViewList.empty() ) Stop(); else ImplRestartTimer( pStepBmp->nWait ); @@ -583,10 +571,10 @@ sal_Bool Animation::Insert( const AnimationBitmap& rStepBmp ) Rectangle aGlobalRect( aPoint, maGlobalSize ); maGlobalSize = aGlobalRect.Union( Rectangle( rStepBmp.aPosPix, rStepBmp.aSizePix ) ).GetSize(); - maList.Insert( new AnimationBitmap( rStepBmp ), LIST_APPEND ); + maList.push_back( new AnimationBitmap( rStepBmp ) ); // zunaechst nehmen wir die erste BitmapEx als Ersatz-BitmapEx - if( maList.Count() == 1 ) + if( maList.size() == 1 ) maBitmapEx = rStepBmp.aBmpEx; bRet = sal_True; @@ -599,24 +587,33 @@ sal_Bool Animation::Insert( const AnimationBitmap& rStepBmp ) const AnimationBitmap& Animation::Get( sal_uInt16 nAnimation ) const { - DBG_ASSERT( ( nAnimation < maList.Count() ), "No object at this position" ); - return *(AnimationBitmap*) maList.GetObject( nAnimation ); + DBG_ASSERT( ( nAnimation < maList.size() ), "No object at this position" ); + return *maList[ nAnimation ]; } // ----------------------------------------------------------------------- void Animation::Replace( const AnimationBitmap& rNewAnimationBitmap, sal_uInt16 nAnimation ) { - DBG_ASSERT( ( nAnimation < maList.Count() ), "No object at this position" ); + DBG_ASSERT( ( nAnimation < maList.size() ), "No object at this position" ); - delete (AnimationBitmap*) maList.Replace( new AnimationBitmap( rNewAnimationBitmap ), nAnimation ); + delete maList[ nAnimation ]; + maList[ nAnimation ] = new AnimationBitmap( rNewAnimationBitmap ); // Falls wir an erster Stelle einfuegen, // muessen wir natuerlich auch, // auch die Ersatzdarstellungs-BitmapEx // aktualisieren; - if ( ( !nAnimation && ( !mbLoopTerminated || ( maList.Count() == 1 ) ) ) || - ( ( nAnimation == maList.Count() - 1 ) && mbLoopTerminated ) ) + if ( ( !nAnimation + && ( !mbLoopTerminated + || ( maList.size() == 1 ) + ) + ) + || + ( ( nAnimation == maList.size() - 1 ) + && mbLoopTerminated + ) + ) { maBitmapEx = rNewAnimationBitmap.aBmpEx; } @@ -646,12 +643,12 @@ sal_Bool Animation::Convert( BmpConversion eConversion ) sal_Bool bRet; - if( !IsInAnimation() && maList.Count() ) + if( !IsInAnimation() && !maList.empty() ) { bRet = sal_True; - for( void* pStepBmp = maList.First(); pStepBmp && bRet; pStepBmp = maList.Next() ) - bRet = ( ( AnimationBitmap*) pStepBmp )->aBmpEx.Convert( eConversion ); + for( size_t i = 0, n = maList.size(); ( i < n ) && bRet; ++i ) + bRet = maList[ i ]->aBmpEx.Convert( eConversion ); maBitmapEx.Convert( eConversion ); } @@ -669,12 +666,12 @@ sal_Bool Animation::ReduceColors( sal_uInt16 nNewColorCount, BmpReduce eReduce ) sal_Bool bRet; - if( !IsInAnimation() && maList.Count() ) + if( !IsInAnimation() && !maList.empty() ) { bRet = sal_True; - for( void* pStepBmp = maList.First(); pStepBmp && bRet; pStepBmp = maList.Next() ) - bRet = ( ( AnimationBitmap*) pStepBmp )->aBmpEx.ReduceColors( nNewColorCount, eReduce ); + for( size_t i = 0, n = maList.size(); ( i < n ) && bRet; ++i ) + bRet = maList[ i ]->aBmpEx.ReduceColors( nNewColorCount, eReduce ); maBitmapEx.ReduceColors( nNewColorCount, eReduce ); } @@ -692,12 +689,12 @@ sal_Bool Animation::Invert() sal_Bool bRet; - if( !IsInAnimation() && maList.Count() ) + if( !IsInAnimation() && !maList.empty() ) { bRet = sal_True; - for( void* pStepBmp = maList.First(); pStepBmp && bRet; pStepBmp = maList.Next() ) - bRet = ( ( AnimationBitmap*) pStepBmp )->aBmpEx.Invert(); + for( size_t i = 0, n = maList.size(); ( i < n ) && bRet; ++i ) + bRet = maList[ i ]->aBmpEx.Invert(); maBitmapEx.Invert(); } @@ -715,16 +712,15 @@ sal_Bool Animation::Mirror( sal_uLong nMirrorFlags ) sal_Bool bRet; - if( !IsInAnimation() && maList.Count() ) + if( !IsInAnimation() && !maList.empty() ) { bRet = sal_True; if( nMirrorFlags ) { - for( AnimationBitmap* pStepBmp = (AnimationBitmap*) maList.First(); - pStepBmp && bRet; - pStepBmp = (AnimationBitmap*) maList.Next() ) + for( size_t i = 0, n = maList.size(); ( i < n ) && bRet; ++i ) { + AnimationBitmap* pStepBmp = maList[ i ]; if( ( bRet = pStepBmp->aBmpEx.Mirror( nMirrorFlags ) ) == sal_True ) { if( nMirrorFlags & BMP_MIRROR_HORZ ) @@ -746,29 +742,6 @@ sal_Bool Animation::Mirror( sal_uLong nMirrorFlags ) // ----------------------------------------------------------------------- -sal_Bool Animation::Dither( sal_uLong nDitherFlags ) -{ - DBG_ASSERT( !IsInAnimation(), "Animation modified while it is animated" ); - - sal_Bool bRet; - - if( !IsInAnimation() && maList.Count() ) - { - bRet = sal_True; - - for( void* pStepBmp = maList.First(); pStepBmp && bRet; pStepBmp = maList.Next() ) - bRet = ( ( AnimationBitmap*) pStepBmp )->aBmpEx.Dither( nDitherFlags ); - - maBitmapEx.Dither( nDitherFlags ); - } - else - bRet = sal_False; - - return bRet; -} - -// ----------------------------------------------------------------------- - sal_Bool Animation::Adjust( short nLuminancePercent, short nContrastPercent, short nChannelRPercent, short nChannelGPercent, short nChannelBPercent, double fGamma, sal_Bool bInvert ) @@ -777,15 +750,19 @@ sal_Bool Animation::Adjust( short nLuminancePercent, short nContrastPercent, sal_Bool bRet; - if( !IsInAnimation() && maList.Count() ) + if( !IsInAnimation() && !maList.empty() ) { bRet = sal_True; - for( void* pStepBmp = maList.First(); pStepBmp && bRet; pStepBmp = maList.Next() ) + for( size_t i = 0, n = maList.size(); ( i < n ) && bRet; ++i ) { - bRet = ( ( AnimationBitmap*) pStepBmp )->aBmpEx.Adjust( nLuminancePercent, nContrastPercent, - nChannelRPercent, nChannelGPercent, nChannelBPercent, - fGamma, bInvert ); + bRet = maList[ i ]->aBmpEx.Adjust( nLuminancePercent, + nContrastPercent, + nChannelRPercent, + nChannelGPercent, + nChannelBPercent, + fGamma, bInvert + ); } maBitmapEx.Adjust( nLuminancePercent, nContrastPercent, @@ -806,12 +783,12 @@ sal_Bool Animation::Filter( BmpFilter eFilter, const BmpFilterParam* pFilterPara sal_Bool bRet; - if( !IsInAnimation() && maList.Count() ) + if( !IsInAnimation() && !maList.empty() ) { bRet = sal_True; - for( void* pStepBmp = maList.First(); pStepBmp && bRet; pStepBmp = maList.Next() ) - bRet = ( ( AnimationBitmap*) pStepBmp )->aBmpEx.Filter( eFilter, pFilterParam, pProgress ); + for( size_t i = 0, n = maList.size(); ( i < n ) && bRet; ++i ) + bRet = maList[ i ]->aBmpEx.Filter( eFilter, pFilterParam, pProgress ); maBitmapEx.Filter( eFilter, pFilterParam, pProgress ); } @@ -830,7 +807,7 @@ SvStream& operator<<( SvStream& rOStm, const Animation& rAnimation ) if( nCount ) { const ByteString aDummyStr; - const sal_uInt32 nDummy32 = 0UL; + const sal_uInt32 nDummy32 = 0UL; // Falls keine BitmapEx gesetzt wurde, schreiben wir // einfach die erste Bitmap der Animation diff --git a/vcl/source/gdi/cvtsvm.cxx b/vcl/source/gdi/cvtsvm.cxx index 21f977a45396..193c066b1d98 100644 --- a/vcl/source/gdi/cvtsvm.cxx +++ b/vcl/source/gdi/cvtsvm.cxx @@ -41,6 +41,7 @@ #include <vcl/lineinfo.hxx> #include <vcl/salbtype.hxx> #include <vcl/cvtsvm.hxx> +#include <rtl/strbuf.hxx> // ----------- // - Defines - @@ -2431,10 +2432,11 @@ sal_uLong SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, #ifdef DBG_UTIL default: { - ByteString aStr( "Missing implementation for Action#: " ); - aStr += ByteString::CreateFromInt32( pAction->GetType() ); - aStr += '!'; - OSL_FAIL( aStr.GetBuffer() ); + rtl::OStringBuffer aStr(RTL_CONSTASCII_STRINGPARAM( + "Missing implementation for Action#: ")); + aStr.append(static_cast<sal_Int32>(pAction->GetType())); + aStr.append('!'); + OSL_FAIL(aStr.getStr()); } break; #endif diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx index 984386028cdc..30740176d676 100644 --- a/vcl/source/gdi/gdimtf.cxx +++ b/vcl/source/gdi/gdimtf.cxx @@ -254,6 +254,7 @@ size_t ImpLabelList::ImplGetLabelPos( const String& rLabelName ) // --------------- GDIMetaFile::GDIMetaFile() : + nCurrentActionElement( 0 ), aPrefSize ( 1, 1 ), pPrev ( NULL ), pNext ( NULL ), diff --git a/vcl/source/gdi/graph.cxx b/vcl/source/gdi/graph.cxx index eb22d31937df..8fa11e969aa8 100644 --- a/vcl/source/gdi/graph.cxx +++ b/vcl/source/gdi/graph.cxx @@ -662,13 +662,6 @@ void Graphic::ResetAnimationLoopCount() // ------------------------------------------------------------------------ -List* Graphic::GetAnimationInfoList() const -{ - return mpImpGraphic->ImplGetAnimationInfoList(); -} - -// ------------------------------------------------------------------------ - GraphicReader* Graphic::GetContext() { return mpImpGraphic->ImplGetContext(); diff --git a/vcl/source/gdi/graphictools.cxx b/vcl/source/gdi/graphictools.cxx index 2e20a3639790..251261d0943e 100644 --- a/vcl/source/gdi/graphictools.cxx +++ b/vcl/source/gdi/graphictools.cxx @@ -675,26 +675,6 @@ void SvtGraphicFill::setHatchColor( Color aHatchColor ) maHatchColor = aHatchColor; } -void SvtGraphicFill::setGradientType( GradientType aGradType ) -{ - maGradientType = aGradType; -} - -void SvtGraphicFill::setGradient1stColor( Color aColor ) -{ - maGradient1stColor = aColor; -} - -void SvtGraphicFill::setGradient2ndColor( Color aColor ) -{ - maGradient2ndColor = aColor; -} - -void SvtGraphicFill::setGradientStepCount( int aCount ) -{ - maGradientStepCount = aCount; -} - void SvtGraphicFill::setGraphic( const Graphic& rGraphic ) { maFillGraphic = rGraphic; diff --git a/vcl/source/gdi/image.cxx b/vcl/source/gdi/image.cxx index 18f927e5b0ff..f587bc29d2e9 100644 --- a/vcl/source/gdi/image.cxx +++ b/vcl/source/gdi/image.cxx @@ -276,45 +276,6 @@ uno::Reference< graphic::XGraphic > Image::GetXGraphic() const // ----------------------------------------------------------------------- -void Image::Invert() -{ - BitmapEx aInvertedBmp( GetBitmapEx() ); - aInvertedBmp.Invert(); - *this = aInvertedBmp; -} - -// ----------------------------------------------------------------------- - -void Image::GetColorTransformArrays( ImageColorTransform eColorTransform, - Color*& rpSrcColor, Color*& rpDstColor, sal_uLong& rColorCount ) -{ - if( IMAGECOLORTRANSFORM_HIGHCONTRAST == eColorTransform ) - { - rpSrcColor = new Color[ 4 ]; - rpDstColor = new Color[ 4 ]; - rColorCount = 4; - - rpSrcColor[ 0 ] = Color( COL_BLACK ); - rpDstColor[ 0 ] = Color( COL_WHITE ); - - rpSrcColor[ 1 ] = Color( COL_WHITE ); - rpDstColor[ 1 ] = Color( COL_BLACK ); - - rpSrcColor[ 2 ] = Color( COL_BLUE ); - rpDstColor[ 2 ] = Color( COL_WHITE ); - - rpSrcColor[ 3 ] = Color( COL_LIGHTBLUE ); - rpDstColor[ 3 ] = Color( COL_WHITE ); - } - else - { - rpSrcColor = rpDstColor = NULL; - rColorCount = 0; - } -} - -// ----------------------------------------------------------------------- - Image& Image::operator=( const Image& rImage ) { DBG_CHKTHIS( Image, NULL ); diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx index 9d995f361329..bd457f3fda22 100644 --- a/vcl/source/gdi/impgraph.cxx +++ b/vcl/source/gdi/impgraph.cxx @@ -928,13 +928,6 @@ void ImpGraphic::ImplResetAnimationLoopCount() // ------------------------------------------------------------------------ -List* ImpGraphic::ImplGetAnimationInfoList() const -{ - return( mpAnimation ? mpAnimation->GetAInfoList() : NULL ); -} - -// ------------------------------------------------------------------------ - GraphicReader* ImpGraphic::ImplGetContext() { return mpContext; diff --git a/vcl/source/gdi/makefile.mk b/vcl/source/gdi/makefile.mk deleted file mode 100755 index e124dc343eba..000000000000 --- a/vcl/source/gdi/makefile.mk +++ /dev/null @@ -1,127 +0,0 @@ -#************************************************************************* -# -# 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. -# -#************************************************************************* - -PRJ=..$/.. - -PRJNAME=vcl -TARGET=gdi - -.INCLUDE : $(PRJ)$/util$/makefile.pmk - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -.INCLUDE : $(PRJ)$/util$/makefile2.pmk - -.IF "$(COM)"=="ICC" -CDEFS+=-D_STD_NO_NAMESPACE -D_VOS_NO_NAMESPACE -D_UNO_NO_NAMESPACE -.ENDIF -.IF "$(ENABLE_GRAPHITE)" == "TRUE" -CDEFS+=-DENABLE_GRAPHITE -.IF "$(SYSTEM_GRAPHITE)" != "YES" -CDEFS+=-DGR2_STATIC -.ENDIF -.ENDIF - -# --- Files -------------------------------------------------------- - -EXCEPTIONSFILES= $(SLO)$/salmisc.obj \ - $(SLO)$/animate.obj \ - $(SLO)$/base14.obj \ - $(SLO)$/bitmap.obj \ - $(SLO)$/bitmap2.obj \ - $(SLO)$/bitmapex.obj \ - $(SLO)$/bmpconv.obj \ - $(SLO)$/configsettings.obj \ - $(SLO)$/cvtgrf.obj \ - $(SLO)$/cvtsvm.obj \ - $(SLO)$/gdimtf.obj \ - $(SLO)$/gfxlink.obj \ - $(SLO)$/graph.obj \ - $(SLO)$/graphictools.obj \ - $(SLO)$/image.obj \ - $(SLO)$/imagerepository.obj \ - $(SLO)$/impanmvw.obj \ - $(SLO)$/impgraph.obj \ - $(SLO)$/impimage.obj \ - $(SLO)$/impimagetree.obj \ - $(SLO)$/impvect.obj \ - $(SLO)$/jobset.obj \ - $(SLO)$/lineinfo.obj \ - $(SLO)$/metaact.obj \ - $(SLO)$/metric.obj \ - $(SLO)$/oldprintadaptor.obj \ - $(SLO)$/outdev.obj \ - $(SLO)$/outdev2.obj \ - $(SLO)$/outdev3.obj \ - $(SLO)$/outdev4.obj \ - $(SLO)$/outdev5.obj \ - $(SLO)$/outdev6.obj \ - $(SLO)$/outdevnative.obj \ - $(SLO)$/outmap.obj \ - $(SLO)$/pdfextoutdevdata.obj \ - $(SLO)$/pdffontcache.obj\ - $(SLO)$/pdfwriter.obj \ - $(SLO)$/pdfwriter_impl.obj \ - $(SLO)$/pdfwriter_impl2.obj \ - $(SLO)$/pngread.obj \ - $(SLO)$/pngwrite.obj \ - $(SLO)$/print.obj \ - $(SLO)$/print2.obj \ - $(SLO)$/print3.obj \ - $(SLO)$/rendergraphic.obj \ - $(SLO)$/rendergraphicrasterizer.obj \ - $(SLO)$/salgdilayout.obj \ - $(SLO)$/sallayout.obj \ - $(SLO)$/salnativewidgets-none.obj \ - $(SLO)$/svgread.obj \ - $(SLO)$/textlayout.obj \ - $(SLO)$/virdev.obj \ - $(SLO)$/wall.obj - -SLOFILES= $(EXCEPTIONSFILES) \ - $(SLO)$/bitmap3.obj \ - $(SLO)$/bitmap4.obj \ - $(SLO)$/alpha.obj \ - $(SLO)$/bmpacc.obj \ - $(SLO)$/bmpacc2.obj \ - $(SLO)$/bmpacc3.obj \ - $(SLO)$/bmpfast.obj \ - $(SLO)$/font.obj \ - $(SLO)$/gradient.obj \ - $(SLO)$/hatch.obj \ - $(SLO)$/impbmp.obj \ - $(SLO)$/mapmod.obj \ - $(SLO)$/octree.obj \ - $(SLO)$/regband.obj \ - $(SLO)$/region.obj \ - $(SLO)$/extoutdevdata.obj - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk diff --git a/vcl/source/gdi/metaact.cxx b/vcl/source/gdi/metaact.cxx index 2ffa3c68e4f7..32c4a589f54d 100644 --- a/vcl/source/gdi/metaact.cxx +++ b/vcl/source/gdi/metaact.cxx @@ -4409,4 +4409,4 @@ void MetaRenderGraphicAction::Read( SvStream& rIStm, ImplMetaReadData* ) rIStm >> maRenderGraphic >> maPoint >> maSize >> mfRotateAngle >> mfShearAngleX >> mfShearAngleY; } -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/pdfwriter_impl2.cxx b/vcl/source/gdi/pdfwriter_impl2.cxx index c1fd5a8c6ca5..0569de5e3464 100644 --- a/vcl/source/gdi/pdfwriter_impl2.cxx +++ b/vcl/source/gdi/pdfwriter_impl2.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. @@ -2050,3 +2051,5 @@ void PDFWriterImpl::writeG4Stream( BitmapReadAccess* i_pBitmap ) rtl_freeMemory( pFirstRefLine ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx index 4c9461fbcb97..440da9c5bb56 100644 --- a/vcl/source/gdi/print.cxx +++ b/vcl/source/gdi/print.cxx @@ -667,14 +667,6 @@ Printer::Printer() // ----------------------------------------------------------------------- -Printer::Printer( const Window* pWindow ) -{ - ImplInitData(); - ImplInitDisplay( pWindow ); -} - -// ----------------------------------------------------------------------- - Printer::Printer( const JobSetup& rJobSetup ) : maJobSetup( rJobSetup ) { @@ -1336,13 +1328,6 @@ const PaperInfo& Printer::GetPaperInfo( int nPaper ) const // ----------------------------------------------------------------------- -DuplexMode Printer::GetDuplexMode() const -{ - return maJobSetup.ImplGetConstData()->meDuplexMode; -} - -// ----------------------------------------------------------------------- - sal_Bool Printer::SetDuplexMode( DuplexMode eDuplex ) { if ( mbInPrintPage ) @@ -1455,25 +1440,6 @@ sal_uLong Printer::ImplSalPrinterErrorCodeToVCL( sal_uLong nError ) // ----------------------------------------------------------------------- -void Printer::ImplEndPrint() -{ - mbPrinting = sal_False; - mnCurPrintPage = 0; - maJobName.Erase(); -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( Printer, ImplDestroyPrinterAsync, void*, pSalPrinter ) -{ - SalPrinter* pPrinter = (SalPrinter*)pSalPrinter; - ImplSVData* pSVData = ImplGetSVData(); - pSVData->mpDefInst->DestroyPrinter( pPrinter ); - return 0; -} - -// ----------------------------------------------------------------------- - sal_Bool Printer::EndJob() { sal_Bool bRet = sal_False; @@ -1510,38 +1476,6 @@ sal_Bool Printer::EndJob() // ----------------------------------------------------------------------- -sal_Bool Printer::AbortJob() -{ - // Wenn wir einen Queue-Printer haben, kann man diesen noch mit - // AbortJob() abbrechen, solange dieser noch am Drucken ist - if ( !IsJobActive() && !IsPrinting() ) - return sal_False; - - mbJobActive = sal_False; - mbInPrintPage = sal_False; - mpJobGraphics = NULL; - - if ( mpPrinter ) - { - mbPrinting = sal_False; - mnCurPage = 0; - mnCurPrintPage = 0; - maJobName.Erase(); - - ImplReleaseGraphics(); - mbDevOutput = sal_False; - mpPrinter->AbortJob(); - Application::PostUserEvent( LINK( this, Printer, ImplDestroyPrinterAsync ), mpPrinter ); - mpPrinter = NULL; - - return sal_True; - } - - return sal_False; -} - -// ----------------------------------------------------------------------- - void Printer::ImplStartPage() { if ( !IsJobActive() ) diff --git a/vcl/source/gdi/print2.cxx b/vcl/source/gdi/print2.cxx index 42ef64a48289..2001968c60e8 100644 --- a/vcl/source/gdi/print2.cxx +++ b/vcl/source/gdi/print2.cxx @@ -1580,47 +1580,4 @@ void Printer::DrawGradientEx( OutputDevice* pOut, const Rectangle& rRect, const pOut->DrawGradient( rRect, rGradient ); } -// ----------------------------------------------------------------------------- - -void Printer::DrawGradientEx( OutputDevice* pOut, const PolyPolygon& rPolyPoly, const Gradient& rGradient ) -{ - const PrinterOptions& rPrinterOptions = GetPrinterOptions(); - - if( rPrinterOptions.IsReduceGradients() ) - { - if( PRINTER_GRADIENT_STRIPES == rPrinterOptions.GetReducedGradientMode() ) - { - if( !rGradient.GetSteps() || ( rGradient.GetSteps() > rPrinterOptions.GetReducedGradientStepCount() ) ) - { - Gradient aNewGradient( rGradient ); - - aNewGradient.SetSteps( rPrinterOptions.GetReducedGradientStepCount() ); - pOut->DrawGradient( rPolyPoly, aNewGradient ); - } - else - pOut->DrawGradient( rPolyPoly, rGradient ); - } - else - { - const Color& rStartColor = rGradient.GetStartColor(); - const Color& rEndColor = rGradient.GetEndColor(); - const long nR = ( ( (long) rStartColor.GetRed() * rGradient.GetStartIntensity() ) / 100L + - ( (long) rEndColor.GetRed() * rGradient.GetEndIntensity() ) / 100L ) >> 1; - const long nG = ( ( (long) rStartColor.GetGreen() * rGradient.GetStartIntensity() ) / 100L + - ( (long) rEndColor.GetGreen() * rGradient.GetEndIntensity() ) / 100L ) >> 1; - const long nB = ( ( (long) rStartColor.GetBlue() * rGradient.GetStartIntensity() ) / 100L + - ( (long) rEndColor.GetBlue() * rGradient.GetEndIntensity() ) / 100L ) >> 1; - const Color aColor( (sal_uInt8) nR, (sal_uInt8) nG, (sal_uInt8) nB ); - - pOut->Push( PUSH_LINECOLOR | PUSH_FILLCOLOR ); - pOut->SetLineColor( aColor ); - pOut->SetFillColor( aColor ); - pOut->DrawPolyPolygon( rPolyPoly ); - pOut->Pop(); - } - } - else - pOut->DrawGradient( rPolyPoly, rGradient ); -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx index 61a40af43bdd..dfe5bfb2aa73 100644 --- a/vcl/source/gdi/print3.cxx +++ b/vcl/source/gdi/print3.cxx @@ -250,7 +250,7 @@ static rtl::OUString queryFile( Printer* pPrinter ) // add arbitrary files xFilterMgr->appendFilter( String( VclResId( SV_STDTEXT_ALLFILETYPES ) ), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "*.*" ) ) ); } - catch( lang::IllegalArgumentException ) + catch (const lang::IllegalArgumentException&) { DBG_ERRORFILE( "caught IllegalArgumentException when registering filter\n" ); } @@ -460,7 +460,7 @@ void Printer::ImplPrintJob( const boost::shared_ptr<PrinterController>& i_pContr makeAny( sal_True ) ); } } - catch( std::bad_alloc& ) + catch (const std::bad_alloc&) { } } diff --git a/vcl/source/gdi/region.cxx b/vcl/source/gdi/region.cxx index 3992b774630d..e4c1a3a7c4f7 100644 --- a/vcl/source/gdi/region.cxx +++ b/vcl/source/gdi/region.cxx @@ -382,34 +382,6 @@ const char* ImplDbgTestRegion( const void* pObj ) return NULL; } -void TraceBands (const ImplRegionBand* pFirstBand) -{ - int nBandIndex (0); - const ImplRegionBand* pBand = pFirstBand; - while (pBand != NULL) - { - OSL_TRACE(" band %d %d->%d : ", nBandIndex++, - pBand->mnYTop, pBand->mnYBottom); - - ImplRegionBandPoint* pPoint = pBand->mpFirstBandPoint; - while (pPoint != NULL) - { - OSL_TRACE(" %d ", pPoint->mnX); - pPoint = pPoint->mpNextBandPoint; - } - OSL_TRACE(" | "); - - ImplRegionBandSep* pSep = pBand->mpFirstSep; - while (pSep != NULL) - { - OSL_TRACE(" %d->%d ", pSep->mnXLeft, pSep->mnXRight); - pSep = pSep->mpNextSep; - } - OSL_TRACE("\n"); - - pBand = pBand->mpNextBand; - } -} #endif // ======================================================================= diff --git a/vcl/source/gdi/rendergraphic.cxx b/vcl/source/gdi/rendergraphic.cxx index 10b6064cc57c..79771163fa2d 100644 --- a/vcl/source/gdi/rendergraphic.cxx +++ b/vcl/source/gdi/rendergraphic.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. @@ -238,3 +239,5 @@ void RenderGraphic::ImplGetDefaults() const } } // VCL + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/rendergraphicrasterizer.cxx b/vcl/source/gdi/rendergraphicrasterizer.cxx index 29c9863335b3..4c70d866245b 100644 --- a/vcl/source/gdi/rendergraphicrasterizer.cxx +++ b/vcl/source/gdi/rendergraphicrasterizer.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. @@ -398,3 +399,5 @@ void RenderGraphicRasterizer::ImplUpdateCache( const RenderGraphicRasterizer& rR } } // VCL + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx index 9679170df9b9..8b04476a1bea 100644 --- a/vcl/source/gdi/sallayout.cxx +++ b/vcl/source/gdi/sallayout.cxx @@ -159,91 +159,6 @@ VCL_DLLPUBLIC sal_UCS4 GetMirroredChar( sal_UCS4 nChar ) // ----------------------------------------------------------------------- -// Get simple approximations for unicodes -const char* GetAutofallback( sal_UCS4 nChar ) -{ - const char* pStr = NULL; - switch( nChar ) - { - case 0x01C0: - case 0x2223: - case 0x2758: - pStr = "|"; break; - case 0x02DC: - pStr = "~"; break; - case 0x037E: - pStr = ";"; break; - case 0x2000: - case 0x2001: - case 0x2002: - case 0x2003: - case 0x2004: - case 0x2005: - case 0x2006: - case 0x2007: - case 0x2008: - case 0x2009: - case 0x200A: - case 0x202F: - pStr = " "; break; - case 0x2010: - case 0x2011: - case 0x2012: - case 0x2013: - case 0x2014: - pStr = "-"; break; - case 0x2015: - pStr = "--"; break; - case 0x2016: - pStr = "||"; break; - case 0x2017: - pStr = "_"; break; - case 0x2018: - case 0x2019: - case 0x201B: - pStr = "\'"; break; - case 0x201A: - pStr = ","; break; - case 0x201C: - case 0x201D: - case 0x201E: - case 0x201F: - case 0x2033: - pStr = "\""; break; - case 0x2039: - pStr = "<"; break; - case 0x203A: - pStr = ">"; break; - case 0x203C: - pStr = "!!"; break; - case 0x203D: - pStr = "?"; break; - case 0x2044: - case 0x2215: - pStr = "/"; break; - case 0x2048: - pStr = "?!"; break; - case 0x2049: - pStr = "!?"; break; - case 0x2216: - pStr = "\\"; break; - case 0x2217: - pStr = "*"; break; - case 0x2236: - pStr = ":"; break; - case 0x2264: - pStr = "<="; break; - case 0x2265: - pStr = "<="; break; - case 0x2303: - pStr = "^"; break; - } - - return pStr; -} - -// ----------------------------------------------------------------------- - sal_UCS4 GetLocalizedChar( sal_UCS4 nChar, LanguageType eLang ) { // currently only conversion from ASCII digits is interesting diff --git a/vcl/source/gdi/svgread.cxx b/vcl/source/gdi/svgread.cxx index 554cfa804b1b..0573f924e277 100644 --- a/vcl/source/gdi/svgread.cxx +++ b/vcl/source/gdi/svgread.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,3 +130,5 @@ namespace vcl } } // namespace vcl + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/wall.cxx b/vcl/source/gdi/wall.cxx index a24d3b0cbd66..5529d9c06232 100644 --- a/vcl/source/gdi/wall.cxx +++ b/vcl/source/gdi/wall.cxx @@ -366,20 +366,6 @@ void Wallpaper::SetBitmap( const BitmapEx& rBitmap ) // ----------------------------------------------------------------------- -void Wallpaper::SetBitmap() -{ - DBG_CHKTHIS( Wallpaper, NULL ); - - if ( mpImplWallpaper->mpBitmap ) - { - ImplMakeUnique(); - delete mpImplWallpaper->mpBitmap; - mpImplWallpaper->mpBitmap = NULL; - } -} - -// ----------------------------------------------------------------------- - BitmapEx Wallpaper::GetBitmap() const { DBG_CHKTHIS( Wallpaper, NULL ); @@ -422,20 +408,6 @@ void Wallpaper::SetGradient( const Gradient& rGradient ) // ----------------------------------------------------------------------- -void Wallpaper::SetGradient() -{ - DBG_CHKTHIS( Wallpaper, NULL ); - - if ( mpImplWallpaper->mpGradient ) - { - ImplMakeUnique(); - delete mpImplWallpaper->mpGradient; - mpImplWallpaper->mpGradient = NULL; - } -} - -// ----------------------------------------------------------------------- - Gradient Wallpaper::GetGradient() const { DBG_CHKTHIS( Wallpaper, NULL ); @@ -504,20 +476,6 @@ void Wallpaper::SetRect( const Rectangle& rRect ) // ----------------------------------------------------------------------- -void Wallpaper::SetRect() -{ - DBG_CHKTHIS( Wallpaper, NULL ); - - if ( mpImplWallpaper->mpRect ) - { - ImplMakeUnique( sal_False ); - delete mpImplWallpaper->mpRect; - mpImplWallpaper->mpRect = NULL; - } -} - -// ----------------------------------------------------------------------- - Rectangle Wallpaper::GetRect() const { DBG_CHKTHIS( Wallpaper, NULL ); diff --git a/vcl/source/helper/canvastools.cxx b/vcl/source/helper/canvastools.cxx index ac8e658f7bd8..7b152938744b 100644 --- a/vcl/source/helper/canvastools.cxx +++ b/vcl/source/helper/canvastools.cxx @@ -185,23 +185,6 @@ namespace vcl //--------------------------------------------------------------------------------------- - const uno::Sequence< sal_Int8 > getTunnelIdentifier( TunnelIdentifierType eType ) - { - static boost::unordered_map< int, uno::Sequence< sal_Int8 > > aIds; - boost::unordered_map< int, uno::Sequence< sal_Int8 > >::iterator it = - aIds.find( eType ); - if( it == aIds.end() ) - { - uno::Sequence< sal_Int8 > aNewId( 16 ); - rtl_createUuid( (sal_uInt8*)aNewId.getArray(), NULL, sal_True ); - aIds[ eType ] = aNewId; - it = aIds.find( eType ); - } - return it->second; - } - - //--------------------------------------------------------------------------------------- - namespace { inline bool operator==( const rendering::IntegerBitmapLayout& rLHS, diff --git a/vcl/source/helper/strhelper.cxx b/vcl/source/helper/strhelper.cxx index c8b5cc7fbf22..c192431e87e6 100644 --- a/vcl/source/helper/strhelper.cxx +++ b/vcl/source/helper/strhelper.cxx @@ -173,15 +173,15 @@ String GetCommandLineToken( int nToken, const String& rLine ) return aRet; } -ByteString GetCommandLineToken( int nToken, const ByteString& rLine ) +rtl::OString GetCommandLineToken(int nToken, const rtl::OString& rLine) { - int nLen = rLine.Len(); - if( ! nLen ) - return ByteString(); + sal_Int32 nLen = rLine.getLength(); + if (!nLen) + return rLine; int nActualToken = 0; char* pBuffer = (char*)alloca( nLen + 1 ); - const char* pRun = rLine.GetBuffer(); + const char* pRun = rLine.getStr(); char* pLeap = NULL; while( *pRun && nActualToken <= nToken ) @@ -275,13 +275,13 @@ int GetCommandLineTokenCount( const String& rLine ) return nTokenCount; } -int GetCommandLineTokenCount( const ByteString& rLine ) +int GetCommandLineTokenCount(const rtl::OString& rLine) { - if( ! rLine.Len() ) + if (rLine.isEmpty()) return 0; int nTokenCount = 0; - const char *pRun = rLine.GetBuffer(); + const char *pRun = rLine.getStr(); while( *pRun ) @@ -383,14 +383,14 @@ String WhitespaceToSpace( const String& rLine, sal_Bool bProtect ) return aRet; } -ByteString WhitespaceToSpace( const ByteString& rLine, sal_Bool bProtect ) +rtl::OString WhitespaceToSpace(const rtl::OString& rLine, sal_Bool bProtect) { - int nLen = rLine.Len(); - if( ! nLen ) - return ByteString(); + sal_Int32 nLen = rLine.getLength(); + if (!nLen) + return rLine; char *pBuffer = (char*)alloca( nLen + 1 ); - const char *pRun = rLine.GetBuffer(); + const char *pRun = rLine.getStr(); char *pLeap = pBuffer; while( *pRun ) @@ -436,8 +436,7 @@ ByteString WhitespaceToSpace( const ByteString& rLine, sal_Bool bProtect ) if( *pLeap == ' ' ) *pLeap = 0; - ByteString aRet( *pBuffer == ' ' ? pBuffer+1 : pBuffer ); - return aRet; + return rtl::OString(*pBuffer == ' ' ? pBuffer+1 : pBuffer); } } // namespace diff --git a/vcl/source/helper/threadex.cxx b/vcl/source/helper/threadex.cxx index ad351410e2c2..f0db5e3a372f 100644 --- a/vcl/source/helper/threadex.cxx +++ b/vcl/source/helper/threadex.cxx @@ -35,46 +35,6 @@ using namespace vcl; -ThreadExecutor::ThreadExecutor() -{ - m_aFinish = osl_createCondition(); - m_aThread = NULL; -} - -ThreadExecutor::~ThreadExecutor() -{ - osl_destroyCondition( m_aFinish ); - if( m_aThread ) - osl_destroyThread( m_aThread ); -} - -extern "C" -{ - static void call_worker( void* pInstance ) - { - ThreadExecutor::worker( pInstance ); - } -} - -void ThreadExecutor::worker( void* pInstance ) -{ - ThreadExecutor* pThis = ((ThreadExecutor*)pInstance); - pThis->m_nReturn = pThis->doIt(); - osl_setCondition( pThis->m_aFinish ); -} - -long ThreadExecutor::execute() -{ - osl_resetCondition( m_aFinish ); - if( m_aThread ) - osl_destroyThread( m_aThread ), m_aThread = NULL; - m_aThread = osl_createThread( call_worker, this ); - while( ! osl_checkCondition( m_aFinish ) ) - Application::Reschedule(); - return m_nReturn; -} - - SolarThreadExecutor::SolarThreadExecutor() :m_nReturn( 0 ) ,m_bTimeout( false ) diff --git a/vcl/source/salmain/salmain.cxx b/vcl/source/salmain/salmain.cxx index 80e853b3b654..0c3adf887023 100644 --- a/vcl/source/salmain/salmain.cxx +++ b/vcl/source/salmain/salmain.cxx @@ -36,7 +36,7 @@ #include "salinst.hxx" -SAL_IMPLEMENT_MAIN() { +SAL_IMPLEMENT_MAIN_WITH_GUI() { tools::extendApplicationEnvironment(); return SVMain(); } diff --git a/vcl/source/window/accel.cxx b/vcl/source/window/accel.cxx index 525c8ad5a76a..3fb5aabc4a35 100644 --- a/vcl/source/window/accel.cxx +++ b/vcl/source/window/accel.cxx @@ -410,85 +410,6 @@ void Accelerator::InsertItem( const ResId& rResId ) // ----------------------------------------------------------------------- -void Accelerator::RemoveItem( sal_uInt16 nItemId ) -{ - DBG_CHKTHIS( Accelerator, NULL ); - - // Aus der Id-Liste entfernen - sal_uInt16 nIndex = ImplAccelEntryGetFirstPos( &(mpData->maIdList), nItemId ); - if ( nIndex != ACCELENTRY_NOTFOUND ) - { - sal_uInt16 nItemCount = GetItemCount(); - do - { - ImplAccelEntry* pEntry = ( nIndex < mpData->maIdList.size() ) ? mpData->maIdList[ nIndex ] : NULL; - if ( pEntry && pEntry->mnId == nItemId ) - { - mpData->maKeyTable.Remove( pEntry->maKeyCode.GetFullKeyCode() ); - - ImplAccelList::iterator it = mpData->maIdList.begin(); - ::std::advance( it, nIndex ); - mpData->maIdList.erase( it ); - - // AutoResAccel zerstoeren - if ( pEntry->mpAutoAccel ) - delete pEntry->mpAutoAccel; - - delete pEntry; - } - else - break; - } - while ( nIndex < nItemCount ); - } -} - -// ----------------------------------------------------------------------- - -void Accelerator::RemoveItem( const KeyCode rKeyCode ) -{ - DBG_CHKTHIS( Accelerator, NULL ); - - ImplAccelEntry* pEntry = ImplGetAccelData( rKeyCode ); - if ( pEntry ) - { - // Aus der Id-Liste entfernen - sal_uInt16 nIndex = ImplAccelEntryGetFirstPos( &(mpData->maIdList), pEntry->mnId ); - sal_uInt16 nItemCount = GetItemCount(); - do - { - if ( mpData->maIdList[ nIndex ] == pEntry ) - break; - nIndex++; - } - while ( nIndex < nItemCount ); - - mpData->maKeyTable.Remove( rKeyCode.GetFullKeyCode() ); - - ImplAccelList::iterator it = mpData->maIdList.begin(); - ::std::advance( it, nIndex ); - mpData->maIdList.erase( it ); - - // AutoResAccel zerstoeren - if ( pEntry->mpAutoAccel ) - delete pEntry->mpAutoAccel; - - delete pEntry; - } -} - -// ----------------------------------------------------------------------- - -void Accelerator::Clear() -{ - DBG_CHKTHIS( Accelerator, NULL ); - - ImplDeleteData(); - mpData->maKeyTable.Clear(); -} - -// ----------------------------------------------------------------------- - sal_uInt16 Accelerator::GetItemCount() const { DBG_CHKTHIS( Accelerator, NULL ); @@ -498,45 +419,6 @@ sal_uInt16 Accelerator::GetItemCount() const // ----------------------------------------------------------------------- -sal_uInt16 Accelerator::GetItemId( sal_uInt16 nPos ) const -{ - DBG_CHKTHIS( Accelerator, NULL ); - - ImplAccelEntry* pEntry = ( nPos < mpData->maIdList.size() ) ? mpData->maIdList[ nPos ] : NULL; - if ( pEntry ) - return pEntry->mnId; - else - return 0; -} - -// ----------------------------------------------------------------------- - -KeyCode Accelerator::GetItemKeyCode( sal_uInt16 nPos ) const -{ - DBG_CHKTHIS( Accelerator, NULL ); - - ImplAccelEntry* pEntry = ( nPos < mpData->maIdList.size() ) ? mpData->maIdList[ nPos ] : NULL; - if ( pEntry ) - return pEntry->maKeyCode; - else - return KeyCode(); -} - -// ----------------------------------------------------------------------- - -sal_uInt16 Accelerator::GetItemId( const KeyCode& rKeyCode ) const -{ - DBG_CHKTHIS( Accelerator, NULL ); - - ImplAccelEntry* pEntry = ImplGetAccelData( rKeyCode ); - if ( pEntry ) - return pEntry->mnId; - else - return 0; -} - -// ----------------------------------------------------------------------- - KeyCode Accelerator::GetKeyCode( sal_uInt16 nItemId ) const { DBG_CHKTHIS( Accelerator, NULL ); @@ -550,76 +432,15 @@ KeyCode Accelerator::GetKeyCode( sal_uInt16 nItemId ) const // ----------------------------------------------------------------------- -sal_Bool Accelerator::IsIdValid( sal_uInt16 nItemId ) const -{ - DBG_CHKTHIS( Accelerator, NULL ); - - sal_uInt16 nIndex = ImplAccelEntryGetIndex( &(mpData->maIdList), nItemId ); - return (nIndex != ACCELENTRY_NOTFOUND); -} - -// ----------------------------------------------------------------------- - -sal_Bool Accelerator::IsKeyCodeValid( const KeyCode rKeyCode ) const -{ - DBG_CHKTHIS( Accelerator, NULL ); - - ImplAccelEntry* pEntry = ImplGetAccelData( rKeyCode ); - return (pEntry != NULL); -} - -// ----------------------------------------------------------------------- - -sal_Bool Accelerator::Call( const KeyCode& rKeyCode, sal_uInt16 nRepeat ) +sal_uInt16 Accelerator::GetItemId( sal_uInt16 nPos ) const { DBG_CHKTHIS( Accelerator, NULL ); - ImplAccelEntry* pEntry = ImplGetAccelData( rKeyCode ); + ImplAccelEntry* pEntry = ( nPos < mpData->maIdList.size() ) ? mpData->maIdList[ nPos ] : NULL; if ( pEntry ) - { - if ( pEntry->mbEnabled ) - { - sal_Bool bDel = sal_False; - mnCurId = pEntry->mnId; - maCurKeyCode = rKeyCode; - mnCurRepeat = nRepeat; - mpDel = &bDel; - Select(); - if ( !bDel ) - { - mnCurId = 0; - maCurKeyCode = KeyCode(); - mnCurRepeat = 0; - } - - return sal_True; - } - } - - return sal_False; -} - -// ----------------------------------------------------------------------- - -void Accelerator::SetAccel( sal_uInt16 nItemId, Accelerator* pAccel ) -{ - DBG_CHKTHIS( Accelerator, NULL ); - - sal_uInt16 nIndex = ImplAccelEntryGetFirstPos( &(mpData->maIdList), nItemId ); - if ( nIndex != ACCELENTRY_NOTFOUND ) - { - sal_uInt16 nItemCount = GetItemCount(); - do - { - ImplAccelEntry* pEntry = mpData->maIdList[ nIndex ]; - if ( pEntry->mnId != nItemId ) - break; - - pEntry->mpAccel = pAccel; - nIndex++; - } - while ( nIndex < nItemCount ); - } + return pEntry->mnId; + else + return 0; } // ----------------------------------------------------------------------- @@ -637,90 +458,6 @@ Accelerator* Accelerator::GetAccel( sal_uInt16 nItemId ) const // ----------------------------------------------------------------------- -void Accelerator::SetAccel( const KeyCode rKeyCode, Accelerator* pAccel ) -{ - DBG_CHKTHIS( Accelerator, NULL ); - - ImplAccelEntry* pEntry = ImplGetAccelData( rKeyCode ); - if ( pEntry ) - pEntry->mpAccel = pAccel; -} - -// ----------------------------------------------------------------------- - -Accelerator* Accelerator::GetAccel( const KeyCode rKeyCode ) const -{ - DBG_CHKTHIS( Accelerator, NULL ); - - ImplAccelEntry* pEntry = ImplGetAccelData( rKeyCode ); - if ( pEntry ) - return pEntry->mpAccel; - else - return sal_False; -} - -// ----------------------------------------------------------------------- - -void Accelerator::EnableItem( sal_uInt16 nItemId, sal_Bool bEnable ) -{ - DBG_CHKTHIS( Accelerator, NULL ); - - sal_uInt16 nIndex = ImplAccelEntryGetFirstPos( &(mpData->maIdList), nItemId ); - if ( nIndex != ACCELENTRY_NOTFOUND ) - { - sal_uInt16 nItemCount = GetItemCount(); - do - { - ImplAccelEntry* pEntry = mpData->maIdList[ nIndex ]; - if ( pEntry->mnId != nItemId ) - break; - - pEntry->mbEnabled = bEnable; - nIndex++; - } - while ( nIndex < nItemCount ); - } -} - -// ----------------------------------------------------------------------- - -sal_Bool Accelerator::IsItemEnabled( sal_uInt16 nItemId ) const -{ - DBG_CHKTHIS( Accelerator, NULL ); - - sal_uInt16 nIndex = ImplAccelEntryGetIndex( &(mpData->maIdList), nItemId ); - if ( nIndex != ACCELENTRY_NOTFOUND ) - return mpData->maIdList[ nIndex ]->mbEnabled; - else - return sal_False; -} - -// ----------------------------------------------------------------------- - -void Accelerator::EnableItem( const KeyCode rKeyCode, sal_Bool bEnable ) -{ - DBG_CHKTHIS( Accelerator, NULL ); - - ImplAccelEntry* pEntry = ImplGetAccelData( rKeyCode ); - if ( pEntry ) - pEntry->mbEnabled = bEnable; -} - -// ----------------------------------------------------------------------- - -sal_Bool Accelerator::IsItemEnabled( const KeyCode rKeyCode ) const -{ - DBG_CHKTHIS( Accelerator, NULL ); - - ImplAccelEntry* pEntry = ImplGetAccelData( rKeyCode ); - if ( pEntry ) - return pEntry->mbEnabled; - else - return sal_False; -} - -// ----------------------------------------------------------------------- - Accelerator& Accelerator::operator=( const Accelerator& rAccel ) { DBG_CHKTHIS( Accelerator, NULL ); diff --git a/vcl/source/window/dndlcon.cxx b/vcl/source/window/dndlcon.cxx index 977e8611e70a..08c8e4d24c3b 100644 --- a/vcl/source/window/dndlcon.cxx +++ b/vcl/source/window/dndlcon.cxx @@ -193,8 +193,7 @@ sal_uInt32 DNDListenerContainer::fireDropEvent( const Reference< XDropTargetDrop nRet++; } } - - catch( RuntimeException ) + catch (const RuntimeException&) { pContainer->removeInterface( xElement ); } @@ -209,8 +208,7 @@ sal_uInt32 DNDListenerContainer::fireDropEvent( const Reference< XDropTargetDrop { context->rejectDrop(); } - - catch( RuntimeException exc ) + catch (const RuntimeException&) { } } @@ -253,8 +251,7 @@ sal_uInt32 DNDListenerContainer::fireDragExitEvent() nRet++; } } - - catch( RuntimeException ) + catch (const RuntimeException&) { pContainer->removeInterface( xElement ); } @@ -305,8 +302,7 @@ sal_uInt32 DNDListenerContainer::fireDragOverEvent( const Reference< XDropTarget nRet++; } } - - catch( RuntimeException ) + catch (const RuntimeException&) { pContainer->removeInterface( xElement ); } @@ -321,8 +317,7 @@ sal_uInt32 DNDListenerContainer::fireDragOverEvent( const Reference< XDropTarget { context->rejectDrag(); } - - catch( RuntimeException exc ) + catch (const RuntimeException&) { } } @@ -373,8 +368,7 @@ sal_uInt32 DNDListenerContainer::fireDragEnterEvent( const Reference< XDropTarge nRet++; } } - - catch( RuntimeException ) + catch (const RuntimeException&) { pContainer->removeInterface( xElement ); } @@ -389,8 +383,7 @@ sal_uInt32 DNDListenerContainer::fireDragEnterEvent( const Reference< XDropTarge { context->rejectDrag(); } - - catch( RuntimeException exc ) + catch (const RuntimeException&) { } } @@ -440,8 +433,7 @@ sal_uInt32 DNDListenerContainer::fireDropActionChangedEvent( const Reference< XD nRet++; } } - - catch( RuntimeException ) + catch (const RuntimeException&) { pContainer->removeInterface( xElement ); } @@ -456,8 +448,7 @@ sal_uInt32 DNDListenerContainer::fireDropActionChangedEvent( const Reference< XD { context->rejectDrag(); } - - catch( RuntimeException exc ) + catch (const RuntimeException&) { } } @@ -502,8 +493,7 @@ sal_uInt32 DNDListenerContainer::fireDragGestureEvent( sal_Int8 dragAction, sal_ nRet++; } } - - catch( RuntimeException ) + catch (const RuntimeException&) { pContainer->removeInterface( xElement ); } diff --git a/vcl/source/window/floatwin.cxx b/vcl/source/window/floatwin.cxx index 118c60f214cc..72847ab17bc7 100644 --- a/vcl/source/window/floatwin.cxx +++ b/vcl/source/window/floatwin.cxx @@ -697,13 +697,22 @@ void FloatingWindow::StartPopupMode( const Rectangle& rRect, sal_uLong nFlags ) // so they can be compared across different frames // !!! rRect is expected to be in screen coordinates of the parent frame window !!! maFloatRect = rRect; - if( GetParent()->ImplHasMirroredGraphics() ) + + Window *pReference = GetParent(); + + // compare coordinates in absolute screen coordinates + // Keep in sync with FloatingWindow::ImplFloatHitTest, e.g. fdo#33509 + if( pReference->ImplHasMirroredGraphics() ) { - maFloatRect.SetPos( GetParent()->ScreenToOutputPixel( rRect.TopLeft() ) ); - maFloatRect = GetParent()->ImplOutputToUnmirroredAbsoluteScreenPixel( maFloatRect ); + if(!pReference->IsRTLEnabled() ) + // --- RTL --- re-mirror back to get device coordiantes + pReference->ImplReMirror(maFloatRect); + + maFloatRect.SetPos(pReference->ScreenToOutputPixel(maFloatRect.TopLeft())); + maFloatRect = pReference->ImplOutputToUnmirroredAbsoluteScreenPixel(maFloatRect); } else - maFloatRect.SetPos( GetParent()->OutputToAbsoluteScreenPixel( GetParent()->ScreenToOutputPixel( rRect.TopLeft() ) ) ); + maFloatRect.SetPos(pReference->OutputToAbsoluteScreenPixel(pReference->ScreenToOutputPixel(rRect.TopLeft()))); maFloatRect.Left() -= 2; maFloatRect.Top() -= 2; diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index d4e16ed6c121..9e47d34716cb 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -156,7 +156,7 @@ struct MenuItemData pSalMenuItem ( NULL ) {} ~MenuItemData(); - bool HasCheck() + bool HasCheck() const { return bChecked || ( nBits & ( MIB_RADIOCHECK | MIB_CHECKABLE | MIB_AUTOCHECK ) ); } diff --git a/vcl/source/window/syschild.cxx b/vcl/source/window/syschild.cxx index 341d7f3bfff8..1de33b56b15b 100755..100644 --- a/vcl/source/window/syschild.cxx +++ b/vcl/source/window/syschild.cxx @@ -198,16 +198,6 @@ void SystemChildWindow::EnableEraseBackground( sal_Bool bEnable ) // ----------------------------------------------------------------------- -sal_Bool SystemChildWindow::IsEraseBackgroundEnabled() -{ - if ( mpWindowImpl->mpSysObj ) - return mpWindowImpl->mpSysObj->IsEraseBackgroundEnabled(); - else - return sal_False; -} - -// ----------------------------------------------------------------------- - void SystemChildWindow::ImplTestJavaException( void* pEnv ) { #ifdef SOLAR_JAVA @@ -260,6 +250,9 @@ sal_IntPtr SystemChildWindow::GetParentWindowHandle( sal_Bool bUseJava ) // FIXME: this is wrong nRet = reinterpret_cast< sal_IntPtr >( GetSystemData()->pView ); (void)bUseJava; +#elif defined IOS + // FIXME: this is wrong + nRet = reinterpret_cast< sal_IntPtr >( GetSystemData()->pView ); #elif defined UNX if( !bUseJava ) { diff --git a/vcl/source/window/syswin.cxx b/vcl/source/window/syswin.cxx index f6c7e422cc3b..77cfb7044740 100644 --- a/vcl/source/window/syswin.cxx +++ b/vcl/source/window/syswin.cxx @@ -39,6 +39,8 @@ #include <vcl/taskpanelist.hxx> #include <vcl/unowrap.hxx> +#include <rtl/strbuf.hxx> + #include <salframe.hxx> #include <svdata.hxx> #include <brdwin.hxx> @@ -242,36 +244,6 @@ void SystemWindow::Resizing( Size& ) // ----------------------------------------------------------------------- -void SystemWindow::SetZLevel( sal_uInt8 nLevel ) -{ - Window* pWindow = this; - while ( pWindow->mpWindowImpl->mpBorderWindow ) - pWindow = pWindow->mpWindowImpl->mpBorderWindow; - if ( pWindow->mpWindowImpl->mbOverlapWin && !pWindow->mpWindowImpl->mbFrame ) - { - sal_uInt8 nOldLevel = pWindow->mpWindowImpl->mpOverlapData->mnTopLevel; - pWindow->mpWindowImpl->mpOverlapData->mnTopLevel = nLevel; - // Wenn der neue Level groesser als der alte ist, schieben - // wir das Fenster nach hinten - if ( !IsReallyVisible() && (nLevel > nOldLevel) && pWindow->mpWindowImpl->mpNext ) - { - // Fenster aus der Liste entfernen - if ( pWindow->mpWindowImpl->mpPrev ) - pWindow->mpWindowImpl->mpPrev->mpWindowImpl->mpNext = pWindow->mpWindowImpl->mpNext; - else - pWindow->mpWindowImpl->mpOverlapWindow->mpWindowImpl->mpFirstOverlap = pWindow->mpWindowImpl->mpNext; - pWindow->mpWindowImpl->mpNext->mpWindowImpl->mpPrev = pWindow->mpWindowImpl->mpPrev; - pWindow->mpWindowImpl->mpNext = NULL; - // und Fenster wieder in die Liste am Ende eintragen - pWindow->mpWindowImpl->mpPrev = pWindow->mpWindowImpl->mpOverlapWindow->mpWindowImpl->mpLastOverlap; - pWindow->mpWindowImpl->mpOverlapWindow->mpWindowImpl->mpLastOverlap = pWindow; - pWindow->mpWindowImpl->mpPrev->mpWindowImpl->mpNext = pWindow; - } - } -} - -// ----------------------------------------------------------------------- - void SystemWindow::SetRepresentedURL( const rtl::OUString& i_rURL ) { bool bChanged = (i_rURL != mpImplData->maRepresentedURL); @@ -286,12 +258,6 @@ void SystemWindow::SetRepresentedURL( const rtl::OUString& i_rURL ) pWindow->mpWindowImpl->mpFrame->SetRepresentedURL( i_rURL ); } } -// ----------------------------------------------------------------------- - -const rtl::OUString& SystemWindow::GetRepresentedURL() const -{ - return mpImplData->maRepresentedURL; -} // ----------------------------------------------------------------------- @@ -315,19 +281,6 @@ void SystemWindow::SetIcon( sal_uInt16 nIcon ) // ----------------------------------------------------------------------- -sal_uInt8 SystemWindow::GetZLevel() const -{ - const Window* pWindow = this; - while ( pWindow->mpWindowImpl->mpBorderWindow ) - pWindow = pWindow->mpWindowImpl->mpBorderWindow; - if ( pWindow->mpWindowImpl->mpOverlapData ) - return pWindow->mpWindowImpl->mpOverlapData->mnTopLevel; - else - return sal_False; -} - -// ----------------------------------------------------------------------- - void SystemWindow::EnableSaveBackground( sal_Bool bSave ) { if( ImplGetSVData()->maWinData.mbNoSaveBackground ) @@ -498,16 +451,17 @@ Size SystemWindow::GetResizeOutputSizePixel() const // ----------------------------------------------------------------------- -static void ImplWindowStateFromStr( WindowStateData& rData, const ByteString& rStr ) +static void ImplWindowStateFromStr(WindowStateData& rData, + const rtl::OString& rStr) { sal_uLong nValidMask = 0; - xub_StrLen nIndex = 0; - ByteString aTokenStr; + sal_Int32 nIndex = 0; + rtl::OString aTokenStr; - aTokenStr = rStr.GetToken( 0, ',', nIndex ); - if ( aTokenStr.Len() ) + aTokenStr = rStr.getToken(0, ',', nIndex); + if (!aTokenStr.isEmpty()) { - rData.SetX( aTokenStr.ToInt32() ); + rData.SetX(aTokenStr.toInt32()); if( rData.GetX() > -16384 && rData.GetX() < 16384 ) nValidMask |= WINDOWSTATE_MASK_X; else @@ -515,10 +469,10 @@ static void ImplWindowStateFromStr( WindowStateData& rData, const ByteString& rS } else rData.SetX( 0 ); - aTokenStr = rStr.GetToken( 0, ',', nIndex ); - if ( aTokenStr.Len() ) + aTokenStr = rStr.getToken(0, ',', nIndex); + if (!aTokenStr.isEmpty()) { - rData.SetY( aTokenStr.ToInt32() ); + rData.SetY(aTokenStr.toInt32()); if( rData.GetY() > -16384 && rData.GetY() < 16384 ) nValidMask |= WINDOWSTATE_MASK_Y; else @@ -526,10 +480,10 @@ static void ImplWindowStateFromStr( WindowStateData& rData, const ByteString& rS } else rData.SetY( 0 ); - aTokenStr = rStr.GetToken( 0, ',', nIndex ); - if ( aTokenStr.Len() ) + aTokenStr = rStr.getToken(0, ',', nIndex); + if (!aTokenStr.isEmpty()) { - rData.SetWidth( aTokenStr.ToInt32() ); + rData.SetWidth(aTokenStr.toInt32()); if( rData.GetWidth() > 0 && rData.GetWidth() < 16384 ) nValidMask |= WINDOWSTATE_MASK_WIDTH; else @@ -537,10 +491,10 @@ static void ImplWindowStateFromStr( WindowStateData& rData, const ByteString& rS } else rData.SetWidth( 0 ); - aTokenStr = rStr.GetToken( 0, ';', nIndex ); - if ( aTokenStr.Len() ) + aTokenStr = rStr.getToken(0, ';', nIndex); + if (!aTokenStr.isEmpty()) { - rData.SetHeight( aTokenStr.ToInt32() ); + rData.SetHeight(aTokenStr.toInt32()); if( rData.GetHeight() > 0 && rData.GetHeight() < 16384 ) nValidMask |= WINDOWSTATE_MASK_HEIGHT; else @@ -548,12 +502,12 @@ static void ImplWindowStateFromStr( WindowStateData& rData, const ByteString& rS } else rData.SetHeight( 0 ); - aTokenStr = rStr.GetToken( 0, ';', nIndex ); - if ( aTokenStr.Len() ) + aTokenStr = rStr.getToken(0, ';', nIndex); + if (!aTokenStr.isEmpty()) { // #94144# allow Minimize again, should be masked out when read from configuration // 91625 - ignore Minimize - sal_uLong nState = (sal_uLong)aTokenStr.ToInt32(); + sal_uInt32 nState = (sal_uInt32)aTokenStr.toInt32(); //nState &= ~(WINDOWSTATE_STATE_MINIMIZED); rData.SetState( nState ); nValidMask |= WINDOWSTATE_MASK_STATE; @@ -562,10 +516,10 @@ static void ImplWindowStateFromStr( WindowStateData& rData, const ByteString& rS rData.SetState( 0 ); // read maximized pos/size - aTokenStr = rStr.GetToken( 0, ',', nIndex ); - if ( aTokenStr.Len() ) + aTokenStr = rStr.getToken(0, ',', nIndex); + if (!aTokenStr.isEmpty()) { - rData.SetMaximizedX( aTokenStr.ToInt32() ); + rData.SetMaximizedX(aTokenStr.toInt32()); if( rData.GetMaximizedX() > -16384 && rData.GetMaximizedX() < 16384 ) nValidMask |= WINDOWSTATE_MASK_MAXIMIZED_X; else @@ -573,10 +527,10 @@ static void ImplWindowStateFromStr( WindowStateData& rData, const ByteString& rS } else rData.SetMaximizedX( 0 ); - aTokenStr = rStr.GetToken( 0, ',', nIndex ); - if ( aTokenStr.Len() ) + aTokenStr = rStr.getToken(0, ',', nIndex); + if (!aTokenStr.isEmpty()) { - rData.SetMaximizedY( aTokenStr.ToInt32() ); + rData.SetMaximizedY(aTokenStr.toInt32()); if( rData.GetMaximizedY() > -16384 && rData.GetMaximizedY() < 16384 ) nValidMask |= WINDOWSTATE_MASK_MAXIMIZED_Y; else @@ -584,10 +538,10 @@ static void ImplWindowStateFromStr( WindowStateData& rData, const ByteString& rS } else rData.SetMaximizedY( 0 ); - aTokenStr = rStr.GetToken( 0, ',', nIndex ); - if ( aTokenStr.Len() ) + aTokenStr = rStr.getToken(0, ',', nIndex); + if (!aTokenStr.isEmpty()) { - rData.SetMaximizedWidth( aTokenStr.ToInt32() ); + rData.SetMaximizedWidth(aTokenStr.toInt32()); if( rData.GetMaximizedWidth() > 0 && rData.GetMaximizedWidth() < 16384 ) nValidMask |= WINDOWSTATE_MASK_MAXIMIZED_WIDTH; else @@ -595,10 +549,10 @@ static void ImplWindowStateFromStr( WindowStateData& rData, const ByteString& rS } else rData.SetMaximizedWidth( 0 ); - aTokenStr = rStr.GetToken( 0, ';', nIndex ); - if ( aTokenStr.Len() ) + aTokenStr = rStr.getToken(0, ';', nIndex); + if (!aTokenStr.isEmpty()) { - rData.SetMaximizedHeight( aTokenStr.ToInt32() ); + rData.SetMaximizedHeight(aTokenStr.toInt32()); if( rData.GetMaximizedHeight() > 0 && rData.GetMaximizedHeight() < 16384 ) nValidMask |= WINDOWSTATE_MASK_MAXIMIZED_HEIGHT; else @@ -613,45 +567,48 @@ static void ImplWindowStateFromStr( WindowStateData& rData, const ByteString& rS // ----------------------------------------------------------------------- -static void ImplWindowStateToStr( const WindowStateData& rData, ByteString& rStr ) +static rtl::OString ImplWindowStateToStr(const WindowStateData& rData) { sal_uLong nValidMask = rData.GetMask(); if ( !nValidMask ) - return; + return rtl::OString(); + + rtl::OStringBuffer rStrBuf; if ( nValidMask & WINDOWSTATE_MASK_X ) - rStr.Append( ByteString::CreateFromInt32( rData.GetX() ) ); - rStr.Append( ',' ); + rStrBuf.append(static_cast<sal_Int32>(rData.GetX())); + rStrBuf.append(','); if ( nValidMask & WINDOWSTATE_MASK_Y ) - rStr.Append( ByteString::CreateFromInt32( rData.GetY() ) ); - rStr.Append( ',' ); + rStrBuf.append(static_cast<sal_Int32>(rData.GetY())); + rStrBuf.append(','); if ( nValidMask & WINDOWSTATE_MASK_WIDTH ) - rStr.Append( ByteString::CreateFromInt32( rData.GetWidth() ) ); - rStr.Append( ',' ); + rStrBuf.append(static_cast<sal_Int32>(rData.GetWidth())); + rStrBuf.append(','); if ( nValidMask & WINDOWSTATE_MASK_HEIGHT ) - rStr.Append( ByteString::CreateFromInt32( rData.GetHeight() ) ); - rStr.Append( ';' ); + rStrBuf.append(static_cast<sal_Int32>(rData.GetHeight())); + rStrBuf.append( ';' ); if ( nValidMask & WINDOWSTATE_MASK_STATE ) { // #94144# allow Minimize again, should be masked out when read from configuration // 91625 - ignore Minimize - sal_uLong nState = rData.GetState(); - //nState &= ~(WINDOWSTATE_STATE_MINIMIZED); - rStr.Append( ByteString::CreateFromInt32( (long)nState ) ); + sal_uInt32 nState = rData.GetState(); + rStrBuf.append(static_cast<sal_Int32>(nState)); } - rStr.Append( ';' ); + rStrBuf.append(';'); if ( nValidMask & WINDOWSTATE_MASK_MAXIMIZED_X ) - rStr.Append( ByteString::CreateFromInt32( rData.GetMaximizedX() ) ); - rStr.Append( ',' ); + rStrBuf.append(static_cast<sal_Int32>(rData.GetMaximizedX())); + rStrBuf.append(','); if ( nValidMask & WINDOWSTATE_MASK_MAXIMIZED_Y ) - rStr.Append( ByteString::CreateFromInt32( rData.GetMaximizedY() ) ); - rStr.Append( ',' ); + rStrBuf.append(static_cast<sal_Int32>(rData.GetMaximizedY())); + rStrBuf.append( ',' ); if ( nValidMask & WINDOWSTATE_MASK_MAXIMIZED_WIDTH ) - rStr.Append( ByteString::CreateFromInt32( rData.GetMaximizedWidth() ) ); - rStr.Append( ',' ); + rStrBuf.append(static_cast<sal_Int32>(rData.GetMaximizedWidth())); + rStrBuf.append(','); if ( nValidMask & WINDOWSTATE_MASK_MAXIMIZED_HEIGHT ) - rStr.Append( ByteString::CreateFromInt32( rData.GetMaximizedHeight() ) ); - rStr.Append( ';' ); + rStrBuf.append(static_cast<sal_Int32>(rData.GetMaximizedHeight())); + rStrBuf.append(';'); + + return rStrBuf.makeStringAndClear(); } // ----------------------------------------------------------------------- @@ -955,9 +912,9 @@ void SystemWindow::GetWindowStateData( WindowStateData& rData ) const // ----------------------------------------------------------------------- -void SystemWindow::SetWindowState( const ByteString& rStr ) +void SystemWindow::SetWindowState(const rtl::OString& rStr) { - if ( !rStr.Len() ) + if (rStr.isEmpty()) return; WindowStateData aData; @@ -967,15 +924,13 @@ void SystemWindow::SetWindowState( const ByteString& rStr ) // ----------------------------------------------------------------------- -ByteString SystemWindow::GetWindowState( sal_uLong nMask ) const +rtl::OString SystemWindow::GetWindowState( sal_uLong nMask ) const { WindowStateData aData; aData.SetMask( nMask ); GetWindowStateData( aData ); - ByteString aStr; - ImplWindowStateToStr( aData, aStr ); - return aStr; + return ImplWindowStateToStr(aData); } // ----------------------------------------------------------------------- diff --git a/vcl/source/window/taskpanelist.cxx b/vcl/source/window/taskpanelist.cxx index 24c8ded6e4b4..bfb3be82b70f 100644 --- a/vcl/source/window/taskpanelist.cxx +++ b/vcl/source/window/taskpanelist.cxx @@ -262,41 +262,6 @@ sal_Bool TaskPaneList::HandleKeyEvent( KeyEvent aKeyEvent ) // -------------------------------------------------- -// returns next valid pane -Window* TaskPaneList::FindNextPane( Window *pWindow, sal_Bool bForward ) -{ - if( bForward ) - ::std::stable_sort( mTaskPanes.begin(), mTaskPanes.end(), LTRSort() ); - else - ::std::stable_sort( mTaskPanes.begin(), mTaskPanes.end(), LTRSortBackward() ); - - ::std::vector< Window* >::iterator p = mTaskPanes.begin(); - while( p != mTaskPanes.end() ) - { - if( *p == pWindow ) - { - unsigned n = mTaskPanes.size(); - while( --n ) - { - if( ++p == mTaskPanes.end() ) - p = mTaskPanes.begin(); - if( (*p)->IsReallyVisible() && !(*p)->IsDialog() && !(*p)->ImplIsSplitter() ) - { - pWindow = *p; - break; - } - } - break; - } - else - ++p; - } - - return pWindow; -} - -// -------------------------------------------------- - // returns next splitter Window* TaskPaneList::FindNextSplitter( Window *pWindow, sal_Bool bForward ) { diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx index 8ffe04c4208a..742d821a1f7e 100755..100644 --- a/vcl/source/window/toolbox.cxx +++ b/vcl/source/window/toolbox.cxx @@ -194,8 +194,6 @@ public: void UpdateDragRect(); DECL_LINK( SelectHdl, Accelerator* ); - void StartCustomizeMode(); - void EndCustomizeMode(); sal_Bool IsCustomizeMode() { return mbCustomizeMode; } sal_Bool IsResizeMode() { return mbResizeMode; } }; @@ -1503,29 +1501,6 @@ IMPL_LINK( ImplTBDragMgr, SelectHdl, Accelerator*, pAccel ) // ----------------------------------------------------------------------- -void ImplTBDragMgr::StartCustomizeMode() -{ - mbCustomizeMode = sal_True; - - for ( size_t i = 0, n = mpBoxList->size(); i < n; ++i ) { - (*mpBoxList)[ i ]->ImplStartCustomizeMode(); - } -} - -// ----------------------------------------------------------------------- - -void ImplTBDragMgr::EndCustomizeMode() -{ - mbCustomizeMode = sal_False; - - for ( size_t i = 0, n = mpBoxList->size(); i < n; ++i ) { - (*mpBoxList)[ i ]->ImplEndCustomizeMode(); - } -} - -// ----------------------------------------------------------------------- - - static void ImplDrawOutButton( OutputDevice* pOutDev, const Rectangle& rRect, sal_uInt16 nStyle ) { @@ -3178,60 +3153,6 @@ void ToolBox::ImplDrawToolArrow( ToolBox* pBox, long nX, long nY, sal_Bool bBlac } } -void ToolBox::SetToolArrowClipregion( ToolBox* pBox, long nX, long nY, - sal_Bool bLeft, sal_Bool bTop, long nSize ) -{ - WindowAlign eAlign = pBox->meAlign; - long nHalfSize; - if ( bLeft ) - eAlign = WINDOWALIGN_RIGHT; - else if ( bTop ) - eAlign = WINDOWALIGN_BOTTOM; - - nHalfSize = nSize/2; - - Point p[6]; - - switch ( eAlign ) - { - case WINDOWALIGN_LEFT: - p[0].X() = nX-1; p[0].Y() = nY-1; - p[1].X() = nX-1; p[1].Y() = nY+nSize+1; - p[2].X() = nX+1; p[2].Y() = nY+nSize+1; - p[3].X() = nX+nHalfSize+1; p[3].Y() = nY+nHalfSize+1; - p[4].X() = nX+nHalfSize+1; p[4].Y() = nY+nHalfSize-1; - p[5].X() = nX+1; p[5].Y() = nY-1; - break; - case WINDOWALIGN_TOP: - p[0].X() = nX-1; p[0].Y() = nY-1; - p[1].X() = nX-1; p[1].Y() = nY+1; - p[2].X() = nX+nHalfSize-1; p[2].Y() = nY+nHalfSize+1; - p[3].X() = nX+nHalfSize+1; p[3].Y() = nY+nHalfSize+1; - p[4].X() = nX+nSize+1; p[4].Y() = nY+1; - p[5].X() = nX+nSize+1; p[5].Y() = nY-1; - break; - case WINDOWALIGN_RIGHT: - p[0].X() = nX+nHalfSize-1; p[0].Y() = nY-1; - p[1].X() = nX-1; p[1].Y() = nY+nHalfSize-1; - p[2].X() = nX-1; p[2].Y() = nY+nHalfSize+1; - p[3].X() = nX+nHalfSize-1; p[3].Y() = nY+nSize+1; - p[4].X() = nX+nHalfSize+1; p[4].Y() = nY+nSize+1; - p[5].X() = nX+nHalfSize+1; p[5].Y() = nY-1; - break; - case WINDOWALIGN_BOTTOM: - p[0].X() = nX-1; p[0].Y() = nY+nHalfSize-1; - p[1].X() = nX-1; p[1].Y() = nY+nHalfSize+1; - p[2].X() = nX+nSize+1; p[2].Y() = nY+nHalfSize+1; - p[3].X() = nX+nSize+1; p[3].Y() = nY+nHalfSize-1; - p[4].X() = nX+nHalfSize+1; p[4].Y() = nY-1; - p[5].X() = nX+nHalfSize-1; p[5].Y() = nY-1; - break; - } - Polygon aPoly(6,p); - Region aRgn( aPoly ); - pBox->SetClipRegion( aRgn ); -} - // ----------------------------------------------------------------------- void ToolBox::ImplDrawMenubutton( ToolBox *pThis, sal_Bool bHighlight ) @@ -3847,60 +3768,6 @@ void ToolBox::ImplDrawItem( sal_uInt16 nPos, sal_uInt16 nHighlight, sal_Bool bPa // ----------------------------------------------------------------------- -void ToolBox::ImplStartCustomizeMode() -{ - mbCustomizeMode = sal_True; - - mpData->ImplClearLayoutData(); - - std::vector< ImplToolItem >::const_iterator it = mpData->m_aItems.begin(); - while ( it != mpData->m_aItems.end() ) - { - if ( it->mbShowWindow ) - { - it->mpWindow->Hide(); - - if ( !(it->maRect.IsEmpty()) ) - Invalidate( it->maRect ); - } - - ++it; - } -} - -void ToolBox::SetCustomizeMode( sal_Bool bSet ) -{ - if ( bSet ) - ImplStartCustomizeMode(); - else - ImplEndCustomizeMode(); -} - -// ----------------------------------------------------------------------- - -void ToolBox::ImplEndCustomizeMode() -{ - mbCustomizeMode = sal_False; - - mpData->ImplClearLayoutData(); - - std::vector< ImplToolItem >::const_iterator it = mpData->m_aItems.begin(); - while ( it != mpData->m_aItems.end() ) - { - if ( it->mbShowWindow ) - { - if ( !(it->maRect.IsEmpty()) ) - Invalidate( it->maRect ); - - it->mpWindow->Show(); - } - - ++it; - } -} - -// ----------------------------------------------------------------------- - void ToolBox::ImplDrawFloatwinBorder( ImplToolItem* pItem ) { if ( !pItem->maRect.IsEmpty() ) @@ -5545,49 +5412,6 @@ void ToolBox::EnableCustomize( sal_Bool bEnable ) // ----------------------------------------------------------------------- -void ToolBox::StartCustomize( const Rectangle& rRect, void* pData ) -{ - DBG_ASSERT( mbCustomize, - "ToolBox::StartCustomize(): ToolBox must be customized" ); - - ImplTBDragMgr* pMgr = ImplGetTBDragMgr(); - Point aMousePos = GetPointerPosPixel(); - Point aPos = ScreenToOutputPixel( rRect.TopLeft() ); - Rectangle aRect( aPos.X(), aPos.Y(), - aPos.X()+rRect.GetWidth()+SMALLBUTTON_HSIZE, - aPos.Y()+rRect.GetHeight()+SMALLBUTTON_VSIZE ); - aMousePos = ScreenToOutputPixel( aPos ); - Pointer aPtr; - SetPointer( aPtr ); - pMgr->StartDragging( this, aMousePos, aRect, 0, sal_False, pData ); -} - -// ----------------------------------------------------------------------- - -void ToolBox::StartCustomizeMode() -{ - ImplTBDragMgr* pMgr = ImplGetTBDragMgr(); - pMgr->StartCustomizeMode(); -} - -// ----------------------------------------------------------------------- - -void ToolBox::EndCustomizeMode() -{ - ImplTBDragMgr* pMgr = ImplGetTBDragMgr(); - pMgr->EndCustomizeMode(); -} - -// ----------------------------------------------------------------------- - -sal_Bool ToolBox::IsCustomizeMode() -{ - ImplTBDragMgr* pMgr = ImplGetTBDragMgr(); - return pMgr->IsCustomizeMode(); -} - -// ----------------------------------------------------------------------- - void ToolBox::GetFocus() { DockingWindow::GetFocus(); @@ -5985,39 +5809,6 @@ ImplToolItem* ToolBox::ImplGetFirstValidItem( sal_uInt16 nLine ) return (it == mpData->m_aItems.end()) ? NULL : &(*it); } -// returns the last displayable item in the given line -ImplToolItem* ToolBox::ImplGetLastValidItem( sal_uInt16 nLine ) -{ - if( !nLine || nLine > mnCurLines ) - return NULL; - - nLine--; - ImplToolItem *pFound = NULL; - std::vector< ImplToolItem >::iterator it = mpData->m_aItems.begin(); - while( it != mpData->m_aItems.end() ) - { - // find correct line - if ( it->mbBreak ) - nLine--; - if( !nLine ) - { - // find last useful item - while( it != mpData->m_aItems.end() && ((it->meType == TOOLBOXITEM_BUTTON) && - /*it->mbEnabled &&*/ it->mbVisible && !ImplIsFixedControl( &(*it) )) ) - { - pFound = &(*it); - ++it; - if( it == mpData->m_aItems.end() || it->mbBreak ) - return pFound; // end of line: return last useful item - } - return pFound; - } - ++it; - } - - return pFound; -} - // ----------------------------------------------------------------------- sal_uInt16 ToolBox::ImplFindItemPos( const ImplToolItem* pItem, const std::vector< ImplToolItem >& rList ) diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx index 348ecec00104..3e32f5d02bf2 100644 --- a/vcl/source/window/toolbox2.cxx +++ b/vcl/source/window/toolbox2.cxx @@ -828,41 +828,6 @@ void ToolBox::RemoveItem( sal_uInt16 nPos ) // ----------------------------------------------------------------------- -void ToolBox::MoveItem( sal_uInt16 nItemId, sal_uInt16 nNewPos ) -{ - sal_uInt16 nPos = GetItemPos( nItemId ); - - if ( nPos == nNewPos ) - return; - - if ( nPos < nNewPos ) - nNewPos--; - - // Existiert Item - if ( nPos != TOOLBOX_ITEM_NOTFOUND ) - { - // ToolBox-Item in der Liste verschieben - ImplToolItem aItem = mpData->m_aItems[nPos]; - mpData->m_aItems.erase( mpData->m_aItems.begin()+nPos ); - mpData->m_aItems.insert( (nNewPos < mpData->m_aItems.size()) ? mpData->m_aItems.begin()+nNewPos : mpData->m_aItems.end(), aItem ); - mpData->ImplClearLayoutData(); - - // ToolBox neu ausgeben - ImplInvalidate( sal_False ); - - // Notify - if( nPos < nNewPos ) // only send one event, all indices above this item are invalid anyway - ImplCallEventListeners( VCLEVENT_TOOLBOX_ITEMREMOVED, reinterpret_cast< void* >( nPos ) ); - else - { - sal_uInt16 nNewPos2 = sal::static_int_cast<sal_uInt16>(( nNewPos == TOOLBOX_APPEND ) ? ( mpData->m_aItems.size() - 1 ) : nNewPos); - ImplCallEventListeners( VCLEVENT_TOOLBOX_ITEMADDED, reinterpret_cast< void* >( nNewPos2 ) ); - } - } -} - -// ----------------------------------------------------------------------- - void ToolBox::CopyItem( const ToolBox& rToolBox, sal_uInt16 nItemId, sal_uInt16 nNewPos ) { @@ -893,29 +858,6 @@ void ToolBox::CopyItem( const ToolBox& rToolBox, sal_uInt16 nItemId, // ----------------------------------------------------------------------- -void ToolBox::CopyItems( const ToolBox& rToolBox ) -{ - mpData->ImplClearLayoutData(); - mpData->m_aItems = rToolBox.mpData->m_aItems; - // Absichern gegen das Loeschen im Select-Handler - mnCurItemId = 0; - mnHighItemId = 0; - - for( std::vector< ImplToolItem >::iterator it = mpData->m_aItems.begin(); - it != mpData->m_aItems.end(); ++it ) - { - it->mpWindow = NULL; - it->mbShowWindow = sal_False; - } - - ImplInvalidate( sal_True, sal_True ); - - // Notify - ImplCallEventListeners( VCLEVENT_TOOLBOX_ALLITEMSCHANGED ); -} - -// ----------------------------------------------------------------------- - void ToolBox::Clear() { mpData->m_aItems.clear(); @@ -1043,11 +985,6 @@ void ToolBox::SetPageScroll( sal_Bool b ) mpData->mbPageScroll = b; } -sal_Bool ToolBox::GetPageScroll() -{ - return mpData->mbPageScroll; -} - // ----------------------------------------------------------------------- void ToolBox::SetNextToolBox( const XubString& rStr ) @@ -1225,16 +1162,6 @@ Rectangle ToolBox::GetItemPosRect( sal_uInt16 nPos ) const } // ----------------------------------------------------------------------- -Rectangle ToolBox::GetItemDropDownRect( sal_uInt16 nItemId ) const -{ - if ( mbCalc || mbFormat ) - ((ToolBox*)this)->ImplFormat(); - - sal_uInt16 nPos = GetItemPos( nItemId ); - return GetItemPosDropDownRect( nPos ); -} - -// ----------------------------------------------------------------------- Rectangle ToolBox::GetItemPosDropDownRect( sal_uInt16 nPos ) const { @@ -1249,11 +1176,6 @@ Rectangle ToolBox::GetItemPosDropDownRect( sal_uInt16 nPos ) const // ----------------------------------------------------------------------- -Rectangle ToolBox::GetMenubuttonRect() const -{ - return mpData->maMenubuttonItem.maRect; -} - sal_Bool ToolBox::ImplHasExternalMenubutton() { // check if the borderwindow (i.e. the decoration) provides the menu button @@ -1459,55 +1381,6 @@ Image ToolBox::GetItemImage( sal_uInt16 nItemId ) const // ----------------------------------------------------------------------- -long ToolBox::GetItemImageAngle( sal_uInt16 nItemId ) const -{ - ImplToolItem* pItem = ImplGetItem( nItemId ); - - if ( pItem ) - return pItem->mnImageAngle; - else - return 0; -} - -// ----------------------------------------------------------------------- - -sal_Bool ToolBox::GetItemImageMirrorMode( sal_uInt16 nItemId ) const -{ - ImplToolItem* pItem = ImplGetItem( nItemId ); - - if ( pItem ) - return pItem->mbMirrorMode; - else - return sal_False; -} - -// ----------------------------------------------------------------------- - -void ToolBox::SetItemHighImage( sal_uInt16 nItemId, const Image& rImage ) -{ - ImplToolItem* pItem = ImplGetItem( nItemId ); - if ( pItem ) - { - DBG_ASSERT( (pItem->maImage.GetSizePixel() == rImage.GetSizePixel()) || - ((!rImage) == sal_True), "ToolBox::SetItemHighImage() - ImageSize != HighImageSize" ); - pItem->maHighImage = rImage; - } -} - -// ----------------------------------------------------------------------- - -Image ToolBox::GetItemHighImage( sal_uInt16 nItemId ) const -{ - ImplToolItem* pItem = ImplGetItem( nItemId ); - - if ( pItem ) - return pItem->maHighImage; - else - return Image(); -} - -// ----------------------------------------------------------------------- - void ToolBox::SetItemText( sal_uInt16 nItemId, const XubString& rText ) { sal_uInt16 nPos = GetItemPos( nItemId ); @@ -1668,18 +1541,6 @@ void ToolBox::SetItemDown( sal_uInt16 nItemId, sal_Bool bDown, sal_Bool bRelease // ----------------------------------------------------------------------- -sal_Bool ToolBox::IsItemDown( sal_uInt16 nItemId ) const -{ - sal_uInt16 nPos = GetItemPos( nItemId ); - - if ( nPos != TOOLBOX_ITEM_NOTFOUND ) - return (nPos == mnCurPos); - else - return sal_False; -} - -// ----------------------------------------------------------------------- - void ToolBox::SetItemState( sal_uInt16 nItemId, TriState eState ) { sal_uInt16 nPos = GetItemPos( nItemId ); @@ -1969,13 +1830,6 @@ void ToolBox::SetOutStyle( sal_uInt16 nNewStyle ) // ----------------------------------------------------------------------- -void ToolBox::RecalcItems() -{ - ImplInvalidate( sal_True ); -} - -// ----------------------------------------------------------------------- - // disable key input if all items are disabled void ToolBox::ImplUpdateInputEnable() @@ -2066,37 +1920,6 @@ long ToolBox::GetIndexForPoint( const Point& rPoint, sal_uInt16& rItemID ) const // ----------------------------------------------------------------------- -long ToolBox::GetTextCount() const -{ - if( ! mpData->m_pLayoutData ) - ImplFillLayoutData(); - return mpData->m_pLayoutData ? mpData->m_pLayoutData->GetLineCount() : 0; -} - -// ----------------------------------------------------------------------- - -Pair ToolBox::GetTextStartEnd( long nText ) const -{ - if( ! mpData->m_pLayoutData ) - ImplFillLayoutData(); - return mpData->m_pLayoutData ? mpData->m_pLayoutData->GetLineStartEnd( nText ) : Pair( -1, -1 ); -} - -// ----------------------------------------------------------------------- - -sal_uInt16 ToolBox::GetDisplayItemId( long nText ) const -{ - sal_uInt16 nItemId = 0; - if( ! mpData->m_pLayoutData ) - ImplFillLayoutData(); - if( mpData->m_pLayoutData && nText >= 0 && (sal_uLong)nText < mpData->m_pLayoutData->m_aLineItemIds.size() ) - nItemId = mpData->m_pLayoutData->m_aLineItemIds[nText]; - return nItemId; -} - - -// ----------------------------------------------------------------------- - void ToolBox::SetDropdownClickHdl( const Link& rLink ) { mpData->maDropdownClickHdl = rLink; @@ -2154,11 +1977,6 @@ void ToolBox::SetMenuButtonHdl( const Link& rLink ) mpData->maMenuButtonHdl = rLink; } -const Link& ToolBox::GetMenuButtonHdl() const -{ - return mpData->maMenuButtonHdl; -} - // ----------------------------------------------------------------------- sal_Bool ToolBox::ImplHasClippedItems() diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index b8457d1267a5..1e4157f5fcd3 100755..100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -4340,8 +4340,7 @@ Window::~Window() if( xComponent.is() ) xComponent->dispose(); } - - catch ( Exception ) + catch (const Exception&) { // can be safely ignored here. } @@ -8378,8 +8377,7 @@ uno::Reference< XDropTarget > Window::GetDropTarget() mpWindowImpl->mpFrameData->mbInternalDragGestureRecognizer = sal_True; } - - catch( RuntimeException ) + catch (const RuntimeException&) { // release all instances mpWindowImpl->mpFrameData->mxDropTarget.clear(); @@ -8430,6 +8428,16 @@ uno::Reference< XDragSource > Window::GetDragSource() aDropTargetSN = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.datatransfer.dnd.OleDropTarget")); aDragSourceAL[ 1 ] = makeAny( static_cast<sal_uInt64>( reinterpret_cast<sal_IntPtr>(pEnvData->pView) ) ); aDropTargetAL[ 0 ] = makeAny( static_cast<sal_uInt64>( reinterpret_cast<sal_IntPtr>(pEnvData->pView) ) ); +#elif defined IOS + /* What does LibreOffice's use of DND concepts mean on + * iOS, huh, is this both inter-app DND (which clearly is + * meaningless), or intra-app? Anyway, use the same code + * as for MacOSX for now, even if meaningless... + */ + aDragSourceSN = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.datatransfer.dnd.OleDragSource")); + aDropTargetSN = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.datatransfer.dnd.OleDropTarget")); + aDragSourceAL[ 1 ] = makeAny( static_cast<sal_uInt64>( reinterpret_cast<sal_IntPtr>(pEnvData->pView) ) ); + aDropTargetAL[ 0 ] = makeAny( static_cast<sal_uInt64>( reinterpret_cast<sal_IntPtr>(pEnvData->pView) ) ); #elif defined UNX aDropTargetAL.realloc( 3 ); aDragSourceAL.realloc( 3 ); @@ -8452,7 +8460,7 @@ uno::Reference< XDragSource > Window::GetDragSource() } // createInstance can throw any exception - catch( Exception ) + catch (const Exception&) { // release all instances mpWindowImpl->mpFrameData->mxDropTarget.clear(); @@ -8532,7 +8540,7 @@ uno::Reference< XClipboard > Window::GetClipboard() } // createInstance can throw any exception - catch( Exception ) + catch (const Exception&) { // release all instances mpWindowImpl->mpFrameData->mxClipboard.clear(); @@ -8584,7 +8592,7 @@ uno::Reference< XClipboard > Window::GetPrimarySelection() } // createInstance can throw any exception - catch( Exception ) + catch (const Exception&) { // release all instances mpWindowImpl->mpFrameData->mxSelection.clear(); diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx index bf81d2665f48..a2dd24378e37 100644 --- a/vcl/source/window/window2.cxx +++ b/vcl/source/window/window2.cxx @@ -1759,11 +1759,6 @@ sal_Bool Window::IsCompoundControl() const return mpWindowImpl->mbCompoundControl; } -sal_Bool Window::HasCompoundControlFocus() const -{ - return mpWindowImpl->mbCompoundControlHasFocus; -} - sal_Bool Window::IsChildPointerOverwrite() const { return mpWindowImpl->mbChildPtrOverwrite; diff --git a/vcl/source/window/window4.cxx b/vcl/source/window/window4.cxx index 775249c450ee..b4abcf229502 100644 --- a/vcl/source/window/window4.cxx +++ b/vcl/source/window/window4.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. @@ -223,3 +224,4 @@ uno::Sequence< beans::PropertyValue > Window::getProperties() const return aProps; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/wpropset.cxx b/vcl/source/window/wpropset.cxx index 10e3e8fa5e2f..ceca8f8784d6 100644 --- a/vcl/source/window/wpropset.cxx +++ b/vcl/source/window/wpropset.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. @@ -345,3 +346,5 @@ IMPL_LINK( vcl::WindowPropertySet, ChildEventListener, VclWindowEvent*, pEvent ) return 0; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/wrkwin.cxx b/vcl/source/window/wrkwin.cxx index 24ca3c9120d5..24ca3c9120d5 100755..100644 --- a/vcl/source/window/wrkwin.cxx +++ b/vcl/source/window/wrkwin.cxx diff --git a/vcl/unx/generic/app/i18n_xkb.cxx b/vcl/unx/generic/app/i18n_xkb.cxx index cb93f48b6bd7..c9e42dda6751 100644 --- a/vcl/unx/generic/app/i18n_xkb.cxx +++ b/vcl/unx/generic/app/i18n_xkb.cxx @@ -36,16 +36,10 @@ #include "unx/saldata.hxx" #include "unx/i18n_xkb.hxx" -SalI18N_KeyboardExtension::SalI18N_KeyboardExtension( Display* -#if __XKeyboardExtension__ -pDisplay -#endif -) - : mbUseExtension( (sal_Bool)__XKeyboardExtension__ ), +SalI18N_KeyboardExtension::SalI18N_KeyboardExtension( Display* pDisplay ) + : mbUseExtension( sal_True ), mnDefaultGroup( 0 ) { - #if __XKeyboardExtension__ - mpDisplay = pDisplay; // allow user to set the default keyboard group idx or to disable the usage @@ -94,19 +88,11 @@ pDisplay XkbGetState( mpDisplay, XkbUseCoreKbd, &aStateRecord ); mnGroup = aStateRecord.group; } - - #endif // __XKeyboardExtension__ } void -SalI18N_KeyboardExtension::Dispatch( XEvent* -#if __XKeyboardExtension__ -pEvent -#endif -) +SalI18N_KeyboardExtension::Dispatch( XEvent* pEvent ) { - #if __XKeyboardExtension__ - // must the event be handled? if ( !mbUseExtension || (pEvent->type != mnEventBase) ) @@ -130,21 +116,13 @@ pEvent #endif break; } - #endif // __XKeyboardExtension__ } -#if __XKeyboardExtension__ sal_uInt32 SalI18N_KeyboardExtension::LookupKeysymInGroup( sal_uInt32 nKeyCode, sal_uInt32 nShiftState, sal_uInt32 nGroup ) const -#else -sal_uInt32 -SalI18N_KeyboardExtension::LookupKeysymInGroup( sal_uInt32,sal_uInt32,sal_uInt32 ) const -#endif { - #if __XKeyboardExtension__ - if ( !mbUseExtension ) return NoSymbol; @@ -153,12 +131,6 @@ SalI18N_KeyboardExtension::LookupKeysymInGroup( sal_uInt32,sal_uInt32,sal_uInt32 KeySym nKeySymbol; nKeySymbol = XkbKeycodeToKeysym( mpDisplay, nKeyCode, nGroup, nShiftState ); return nKeySymbol; - - #else - - return NoSymbol; - - #endif // __XKeyboardExtension__ } diff --git a/vcl/unx/generic/app/keysymnames.cxx b/vcl/unx/generic/app/keysymnames.cxx index e164d06d5d07..c2db38c2a13a 100644 --- a/vcl/unx/generic/app/keysymnames.cxx +++ b/vcl/unx/generic/app/keysymnames.cxx @@ -583,7 +583,7 @@ static const keyboard_layout type6_layout[] = const char* SalDisplay::GetKeyboardName( bool bRefresh ) { - if( bRefresh || ! m_aKeyboardName.Len() ) + if (bRefresh || m_aKeyboardName.isEmpty()) { #if defined(SOLARIS) if( IsLocal() ) @@ -665,10 +665,10 @@ const char* SalDisplay::GetKeyboardName( bool bRefresh ) } } #endif - if( ! m_aKeyboardName.Len() ) + if (m_aKeyboardName.isEmpty()) m_aKeyboardName = "<unknown keyboard>"; } - return m_aKeyboardName.GetBuffer(); + return m_aKeyboardName.getStr(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/app/saldisp.cxx b/vcl/unx/generic/app/saldisp.cxx index 358bbc205004..8156b86cab08 100644 --- a/vcl/unx/generic/app/saldisp.cxx +++ b/vcl/unx/generic/app/saldisp.cxx @@ -885,10 +885,7 @@ void SalDisplay::Init() sscanf( pProperties, "%li", &nProperties_ ); else { -#if defined DBG_UTIL || defined SUN || defined LINUX || defined FREEBSD || \ - defined NETBSD || defined OPENBSD || defined DRAGONFLY nProperties_ |= PROPERTY_FEATURE_Maximize; -#endif // Server Bugs & Properties if( GetServerVendor() == vendor_excursion ) { @@ -909,31 +906,6 @@ void SalDisplay::Init() if( otherwm == eWindowManager_ ) eWindowManager_ = mwm; } else - if( GetServerVendor() == vendor_xfree ) - { - nProperties_ |= PROPERTY_BUG_XCopyArea_GXxor; -#if defined LINUX || defined FREEBSD || defined NETBSD || defined OPENBSD || \ - defined DRAGONFLY - // otherwm and olwm are a kind of default, which are not detected - // carefully. if we are running linux (i.e. not netbsd) on an xfree - // display, fvwm is most probable the wm to choose, confusing with mwm - // doesn't harm. #57791# start maximized if possible - if( (otherwm == eWindowManager_) - || (olwm == eWindowManager_ )) - { - eWindowManager_ = fvwm; // ??? - nProperties_ |= PROPERTY_FEATURE_Maximize; - } -#else - if( otherwm == eWindowManager_ ) eWindowManager_ = winmgr; -#endif -#if defined SOLARIS && defined SPARC - nProperties_ |= PROPERTY_BUG_Bitmap_Bit_Order; - // solaris xlib seems to have problems with putting images - // in correct bit order to xfree 8 bit displays -#endif - } - else if( GetServerVendor() == vendor_sun ) { // nicht alle! (bekannt: nur Sparc II CG3, CG6?) @@ -2358,7 +2330,7 @@ void SalX11Display::Yield() if( pXLib_->HasXErrorOccurred() ) { XFlush( pDisp_ ); - PrintEvent( "SalDisplay::Yield (WasXError)", &aEvent ); + DbgPrintDisplayEvent("SalDisplay::Yield (WasXError)", &aEvent); } #endif pXLib_->ResetXErrorOccurred(); @@ -2475,14 +2447,13 @@ long SalX11Display::Dispatch( XEvent *pEvent ) return 0; } -// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -void SalDisplay::PrintEvent( const ByteString &rComment, - XEvent *pEvent ) const +#ifdef DBG_UTIL +void SalDisplay::DbgPrintDisplayEvent(const char *pComment, XEvent *pEvent) const { if( pEvent->type <= MappingNotify ) { fprintf( stderr, "[%s] %s s=%d w=%ld\n", - rComment.GetBuffer(), + pComment, EventNames[pEvent->type], pEvent->xany.send_event, pEvent->xany.window ); @@ -2609,11 +2580,12 @@ void SalDisplay::PrintEvent( const ByteString &rComment, } else fprintf( stderr, "[%s] %d s=%d w=%ld\n", - rComment.GetBuffer(), + pComment, pEvent->type, pEvent->xany.send_event, pEvent->xany.window ); } +#endif // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= void SalDisplay::PrintInfo() const diff --git a/vcl/unx/generic/app/wmadaptor.cxx b/vcl/unx/generic/app/wmadaptor.cxx index ad9b5ee22d6c..7ad584953069 100644 --- a/vcl/unx/generic/app/wmadaptor.cxx +++ b/vcl/unx/generic/app/wmadaptor.cxx @@ -228,8 +228,9 @@ WMAdaptor* WMAdaptor::createWMAdaptor( SalDisplay* pSalDisplay ) pAdaptor = new WMAdaptor( pSalDisplay ); #if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "Window Manager's name is \"%s\"\n", - ByteString( pAdaptor->getWindowManagerName(), RTL_TEXTENCODING_ISO_8859_1 ).GetBuffer() ); + fprintf(stderr, "Window Manager's name is \"%s\"\n", + rtl::OUStringToOString(pAdaptor->getWindowManagerName(), + RTL_TEXTENCODING_UTF8).getStr()); #endif return pAdaptor; } @@ -1075,10 +1076,11 @@ void GnomeWMAdaptor::initAtoms() void WMAdaptor::setWMName( X11SalFrame* pFrame, const String& rWMName ) const { - ByteString aTitle( rWMName, osl_getThreadTextEncoding() ); + rtl::OString aTitle(rtl::OUStringToOString(rWMName, + osl_getThreadTextEncoding())); if( ! rWMName.Len() && m_aWMName.EqualsAscii( "Dtwm" ) ) - aTitle = " "; + aTitle = rtl::OString(' '); ::rtl::OString aWMLocale; rtl_Locale* pLocale = NULL; @@ -1140,7 +1142,7 @@ void WMAdaptor::setWMName( X11SalFrame* pFrame, const String& rWMName ) const } #endif - char* pT = const_cast<char*>(aTitle.GetBuffer()); + char* pT = const_cast<char*>(aTitle.getStr()); XTextProperty aProp = { NULL, None, 0, 0 }; if( bTrustXmb ) { @@ -1151,10 +1153,10 @@ void WMAdaptor::setWMName( X11SalFrame* pFrame, const String& rWMName ) const &aProp ); } - unsigned char* pData = aProp.nitems ? aProp.value : (unsigned char*)aTitle.GetBuffer(); - Atom nType = aProp.nitems ? aProp.encoding : XA_STRING; - int nFormat = aProp.nitems ? aProp.format : 8; - int nBytes = aProp.nitems ? aProp.nitems : aTitle.Len(); + unsigned char* pData = aProp.nitems ? aProp.value : (unsigned char*)aTitle.getStr(); + Atom nType = aProp.nitems ? aProp.encoding : XA_STRING; + int nFormat = aProp.nitems ? aProp.format : 8; + int nBytes = aProp.nitems ? aProp.nitems : aTitle.getLength(); const SystemEnvData* pEnv = pFrame->GetSystemData(); XChangeProperty( m_pDisplay, (XLIB_Window)pEnv->aShellWindow, @@ -1195,7 +1197,7 @@ void NetWMAdaptor::setWMName( X11SalFrame* pFrame, const String& rWMName ) const { WMAdaptor::setWMName( pFrame, rWMName ); - ByteString aTitle( rWMName, RTL_TEXTENCODING_UTF8 ); + rtl::OString aTitle(rtl::OUStringToOString(rWMName, RTL_TEXTENCODING_UTF8)); const SystemEnvData* pEnv = pFrame->GetSystemData(); if( m_aWMAtoms[ NET_WM_NAME ] ) XChangeProperty( m_pDisplay, @@ -1204,8 +1206,8 @@ void NetWMAdaptor::setWMName( X11SalFrame* pFrame, const String& rWMName ) const m_aWMAtoms[ UTF8_STRING ], 8, PropModeReplace, - (unsigned char*)aTitle.GetBuffer(), - aTitle.Len()+1 ); + (unsigned char*)aTitle.getStr(), + aTitle.getLength()+1 ); if( m_aWMAtoms[ NET_WM_ICON_NAME ] ) XChangeProperty( m_pDisplay, (XLIB_Window)pEnv->aShellWindow, @@ -1213,8 +1215,8 @@ void NetWMAdaptor::setWMName( X11SalFrame* pFrame, const String& rWMName ) const m_aWMAtoms[ UTF8_STRING ], 8, PropModeReplace, - (unsigned char*)aTitle.GetBuffer(), - aTitle.Len()+1 ); + (unsigned char*)aTitle.getStr(), + aTitle.getLength()+1 ); // The +1 copies the terminating null byte. Although // the spec says, this should not be necessary // at least the kwin implementation seems to depend diff --git a/vcl/unx/generic/fontmanager/fontcache.cxx b/vcl/unx/generic/fontmanager/fontcache.cxx index e7a4008f07f0..e47c95ec07ca 100644 --- a/vcl/unx/generic/fontmanager/fontcache.cxx +++ b/vcl/unx/generic/fontmanager/fontcache.cxx @@ -40,6 +40,8 @@ #include "tools/stream.hxx" +#include <rtl/strbuf.hxx> + #include <unistd.h> #include <sys/stat.h> @@ -132,13 +134,14 @@ void FontCache::flush() const FontDirMap& rDir( dir_it->second.m_aEntries ); ByteString aDirectory( rManager.getDirectory( dir_it->first ) ); - ByteString aLine( "FontCacheDirectory:" ); - aLine.Append( ByteString::CreateFromInt64( dir_it->second.m_nTimestamp ) ); - aLine.Append( ':' ); - aLine.Append( aDirectory ); + rtl::OStringBuffer aLine( + RTL_CONSTASCII_STRINGPARAM("FontCacheDirectory:")); + aLine.append(dir_it->second.m_nTimestamp); + aLine.append(':'); + aLine.append(aDirectory); if( rDir.empty() && dir_it->second.m_bNoFiles ) - aLine.Insert( "Empty", 0 ); - aStream.WriteLine( aLine ); + aLine.insert(0, RTL_CONSTASCII_STRINGPARAM("Empty")); + aStream.WriteLine(ByteString(aLine.makeStringAndClear())); for( FontDirMap::const_iterator entry_it = rDir.begin(); entry_it != rDir.end(); ++entry_it ) { @@ -147,16 +150,16 @@ void FontCache::flush() if( rEntry.begin() == rEntry.end() ) continue; - aLine = "File:"; - aLine.Append( ByteString( entry_it->first ) ); - aStream.WriteLine( aLine ); + aLine.append(RTL_CONSTASCII_STRINGPARAM("File:")); + aLine.append(entry_it->first); + aStream.WriteLine(ByteString(aLine.makeStringAndClear())); int nEntrySize = entry_it->second.m_aEntry.size(); // write: type;nfonts - aLine = ByteString::CreateFromInt32( rEntry.front()->m_eType ); - aLine.Append( ';' ); - aLine.Append( ByteString::CreateFromInt32( nEntrySize ) ); - aStream.WriteLine( aLine ); + aLine.append(static_cast<sal_Int32>(rEntry.front()->m_eType)); + aLine.append(';'); + aLine.append(static_cast<sal_Int32>(nEntrySize)); + aStream.WriteLine(ByteString(aLine.makeStringAndClear())); sal_Int32 nSubEntry = 0; for( FontCacheEntry::const_iterator it = rEntry.begin(); it != rEntry.end(); ++it, nSubEntry++ ) @@ -171,73 +174,73 @@ void FontCache::flush() else nSubEntry = -1; - aLine = OUStringToOString( pAtoms->getString( ATOM_FAMILYNAME, (*it)->m_nFamilyName ), RTL_TEXTENCODING_UTF8 ); + aLine.append(OUStringToOString(pAtoms->getString( ATOM_FAMILYNAME, (*it)->m_nFamilyName), RTL_TEXTENCODING_UTF8)); for( ::std::list< int >::const_iterator name_it = (*it)->m_aAliases.begin(); name_it != (*it)->m_aAliases.end(); ++name_it ) { const OUString& rAdd( pAtoms->getString( ATOM_FAMILYNAME, *name_it ) ); if( rAdd.getLength() ) { - aLine.Append( ';' ); - aLine.Append( ByteString( String( rAdd ), RTL_TEXTENCODING_UTF8 ) ); + aLine.append(';'); + aLine.append(OUStringToOString(rAdd, RTL_TEXTENCODING_UTF8)); } } - aStream.WriteLine( aLine ); + aStream.WriteLine(ByteString(aLine.makeStringAndClear())); const OUString& rPSName( pAtoms->getString( ATOM_PSNAME, (*it)->m_nPSName ) ); - aLine = ByteString::CreateFromInt32( nSubEntry ); - aLine.Append( ';' ); - aLine.Append( ByteString( String( rPSName ), RTL_TEXTENCODING_UTF8 ) ); - aLine.Append( ';' ); - aLine.Append( ByteString::CreateFromInt32( (*it)->m_eItalic ) ); - aLine.Append( ';' ); - aLine.Append( ByteString::CreateFromInt32( (*it)->m_eWeight ) ); - aLine.Append( ';' ); - aLine.Append( ByteString::CreateFromInt32( (*it)->m_eWidth ) ); - aLine.Append( ';' ); - aLine.Append( ByteString::CreateFromInt32( (*it)->m_ePitch ) ); - aLine.Append( ';' ); - aLine.Append( ByteString::CreateFromInt32( (*it)->m_aEncoding ) ); - aLine.Append( ';' ); - aLine.Append( ByteString::CreateFromInt32( (*it)->m_nAscend ) ); - aLine.Append( ';' ); - aLine.Append( ByteString::CreateFromInt32( (*it)->m_nDescend ) ); - aLine.Append( ';' ); - aLine.Append( ByteString::CreateFromInt32( (*it)->m_nLeading ) ); - aLine.Append( ';' ); - aLine.Append( (*it)->m_bHaveVerticalSubstitutedGlyphs ? "1" : "0" ); - aLine.Append( ';' ); - aLine.Append( ByteString::CreateFromInt32( (*it)->m_aGlobalMetricX.width ) ); - aLine.Append( ';' ); - aLine.Append( ByteString::CreateFromInt32( (*it)->m_aGlobalMetricX.height ) ); - aLine.Append( ';' ); - aLine.Append( ByteString::CreateFromInt32( (*it)->m_aGlobalMetricY.width ) ); - aLine.Append( ';' ); - aLine.Append( ByteString::CreateFromInt32( (*it)->m_aGlobalMetricY.height ) ); - aLine.Append( ';' ); - aLine.Append( (*it)->m_bUserOverride ? "1" : "0" ); - aLine.Append( ';' ); - aLine.Append( ByteString::CreateFromInt32( 0 ) ); - aLine.Append( ';' ); - aLine.Append( ByteString::CreateFromInt32( 0 ) ); + aLine.append(nSubEntry); + aLine.append(';'); + aLine.append(OUStringToOString(rPSName, RTL_TEXTENCODING_UTF8)); + aLine.append(';'); + aLine.append(static_cast<sal_Int32>((*it)->m_eItalic)); + aLine.append(';'); + aLine.append(static_cast<sal_Int32>((*it)->m_eWeight)); + aLine.append(';'); + aLine.append(static_cast<sal_Int32>((*it)->m_eWidth)); + aLine.append(';'); + aLine.append(static_cast<sal_Int32>((*it)->m_ePitch)); + aLine.append(';'); + aLine.append(static_cast<sal_Int32>((*it)->m_aEncoding)); + aLine.append(';'); + aLine.append(static_cast<sal_Int32>((*it)->m_nAscend)); + aLine.append(';'); + aLine.append(static_cast<sal_Int32>((*it)->m_nDescend)); + aLine.append(';'); + aLine.append(static_cast<sal_Int32>((*it)->m_nLeading)); + aLine.append(';'); + aLine.append((*it)->m_bHaveVerticalSubstitutedGlyphs ? '1' : '0'); + aLine.append(';'); + aLine.append(static_cast<sal_Int32>((*it)->m_aGlobalMetricX.width )); + aLine.append(';'); + aLine.append(static_cast<sal_Int32>((*it)->m_aGlobalMetricX.height)); + aLine.append(';'); + aLine.append(static_cast<sal_Int32>((*it)->m_aGlobalMetricY.width )); + aLine.append(';'); + aLine.append(static_cast<sal_Int32>((*it)->m_aGlobalMetricY.height)); + aLine.append(';'); + aLine.append((*it)->m_bUserOverride ? '1' : '0'); + aLine.append(';'); + aLine.append(static_cast<sal_Int32>(0)); + aLine.append(';'); + aLine.append(static_cast<sal_Int32>(0)); switch( (*it)->m_eType ) { case fonttype::Type1: - aLine.Append( ';' ); - aLine.Append( ByteString( static_cast<const PrintFontManager::Type1FontFile*>(*it)->m_aMetricFile ) ); + aLine.append(';'); + aLine.append(static_cast<const PrintFontManager::Type1FontFile*>(*it)->m_aMetricFile); break; case fonttype::TrueType: - aLine.Append( ';' ); - aLine.Append( ByteString::CreateFromInt32( static_cast<const PrintFontManager::TrueTypeFontFile*>(*it)->m_nTypeFlags ) ); + aLine.append(';'); + aLine.append(static_cast<sal_Int32>(static_cast<const PrintFontManager::TrueTypeFontFile*>(*it)->m_nTypeFlags)); break; default: break; } if( (*it)->m_aStyleName.getLength() ) { - aLine.Append( ';' ); - aLine.Append( ByteString( String( (*it)->m_aStyleName ), RTL_TEXTENCODING_UTF8 ) ); + aLine.append(';'); + aLine.append(OUStringToOString((*it)->m_aStyleName, RTL_TEXTENCODING_UTF8)); } - aStream.WriteLine( aLine ); + aStream.WriteLine(ByteString(aLine.makeStringAndClear())); } aStream.WriteLine( ByteString() ); } diff --git a/vcl/unx/generic/fontmanager/fontconfig.cxx b/vcl/unx/generic/fontmanager/fontconfig.cxx index c1d506d91d83..38a5e93e56f3 100644 --- a/vcl/unx/generic/fontmanager/fontconfig.cxx +++ b/vcl/unx/generic/fontmanager/fontconfig.cxx @@ -36,53 +36,40 @@ using namespace psp; -#ifdef ENABLE_FONTCONFIG - #include <fontconfig/fontconfig.h> - #include <ft2build.h> - #include <fontconfig/fcfreetype.h> - // allow compile on baseline (currently with fontconfig 2.2.0) - #ifndef FC_WEIGHT_BOOK // TODO: remove when baseline moves to fc>=2.2.1 - #define FC_WEIGHT_BOOK 75 - #endif - #ifndef FC_EMBEDDED_BITMAP // TODO: remove when baseline moves to fc>=2.3.92 - #define FC_EMBEDDED_BITMAP "embeddedbitmap" - #endif - #ifndef FC_FAMILYLANG // TODO: remove when baseline moves to fc>=2.2.97 - #define FC_FAMILYLANG "familylang" - #endif - #ifndef FC_CAPABILITY // TODO: remove when baseline moves to fc>=2.2.97 - #define FC_CAPABILITY "capability" - #endif - #ifndef FC_STYLELANG // TODO: remove when baseline moves to fc>=2.2.97 - #define FC_STYLELANG "stylelang" - #endif - #ifndef FC_HINT_STYLE // TODO: remove when baseline moves to fc>=2.2.91 - #define FC_HINT_STYLE "hintstyle" - #define FC_HINT_NONE 0 - #define FC_HINT_SLIGHT 1 - #define FC_HINT_MEDIUM 2 - #define FC_HINT_FULL 3 - #endif - #ifndef FC_FT_FACE - #define FC_FT_FACE "ftface" - #endif - #ifndef FC_EMBOLDEN - #define FC_EMBOLDEN "embolden" - #endif -#else - typedef void FcConfig; - typedef void FcObjectSet; - typedef void FcPattern; - typedef void FcFontSet; - typedef void FcCharSet; - typedef int FcResult; - typedef int FcBool; - typedef int FcMatchKind; - typedef char FcChar8; - typedef int FcChar32; - typedef unsigned int FT_UInt; - typedef void* FT_Face; - typedef int FcSetName; +#include <fontconfig/fontconfig.h> +#include <ft2build.h> +#include <fontconfig/fcfreetype.h> +// allow compile on baseline (currently with fontconfig 2.2.0) +#ifndef FC_WEIGHT_BOOK // TODO: remove when baseline moves to fc>=2.2.1 + #define FC_WEIGHT_BOOK 75 +#endif +#ifndef FC_EMBEDDED_BITMAP // TODO: remove when baseline moves to fc>=2.3.92 + #define FC_EMBEDDED_BITMAP "embeddedbitmap" +#endif +#ifndef FC_FAMILYLANG // TODO: remove when baseline moves to fc>=2.2.97 + #define FC_FAMILYLANG "familylang" +#endif +#ifndef FC_CAPABILITY // TODO: remove when baseline moves to fc>=2.2.97 + #define FC_CAPABILITY "capability" +#endif +#ifndef FC_STYLELANG // TODO: remove when baseline moves to fc>=2.2.97 + #define FC_STYLELANG "stylelang" +#endif +#ifndef FC_HINT_STYLE // TODO: remove when baseline moves to fc>=2.2.91 + #define FC_HINT_STYLE "hintstyle" + #define FC_HINT_NONE 0 + #define FC_HINT_SLIGHT 1 + #define FC_HINT_MEDIUM 2 + #define FC_HINT_FULL 3 +#endif +#ifndef FC_FT_FACE + #define FC_FT_FACE "ftface" +#endif +#ifndef FC_EMBOLDEN + #define FC_EMBOLDEN "embolden" +#endif +#ifndef FC_FONTFORMAT + #define FC_FONTFORMAT "fontformat" #endif #include <cstdio> @@ -114,53 +101,8 @@ namespace class FontCfgWrapper { - oslModule m_pLib; FcFontSet* m_pOutlineSet; - int m_nFcVersion; - FcBool (*m_pFcInit)(); - void (*m_pFcFini)(); - int (*m_pFcGetVersion)(); - FcConfig* (*m_pFcConfigGetCurrent)(); - FcObjectSet* (*m_pFcObjectSetVaBuild)(const char*,va_list); - void (*m_pFcObjectSetDestroy)(FcObjectSet* pSet); - FcPattern* (*m_pFcPatternCreate)(); - void (*m_pFcPatternDestroy)(FcPattern*); - FcBool (*m_pFcPatternEqual)(const FcPattern*,const FcPattern*); - FcFontSet* (*m_pFcConfigGetFonts)(FcConfig*,FcSetName); - FcFontSet* (*m_pFcFontSetCreate)(); - FcCharSet* (*m_pFcCharSetCreate)(); - FcBool (*m_pFcCharSetAddChar)(FcCharSet *, FcChar32); - FcBool (*m_pFcCharSetHasChar)(FcCharSet *, FcChar32); - void (*m_pFcCharSetDestroy)(FcCharSet*); - void (*m_pFcFontSetDestroy)(FcFontSet*); - FcBool (*m_pFcFontSetAdd)(FcFontSet*,FcPattern*); - void (*m_pFcPatternReference)(FcPattern*); - FcResult (*m_pFcPatternGetCharSet)(const FcPattern*,const char*,int,FcCharSet**); - FcResult (*m_pFcPatternGetString)(const FcPattern*,const char*,int,FcChar8**); - FcResult (*m_pFcPatternGetInteger)(const FcPattern*,const char*,int,int*); - FcResult (*m_pFcPatternGetDouble)(const FcPattern*,const char*,int,double*); - FcResult (*m_pFcPatternGetBool)(const FcPattern*,const char*,int,FcBool*); - void (*m_pFcDefaultSubstitute)(FcPattern *); - FcPattern* (*m_pFcFontSetMatch)(FcConfig*,FcFontSet**, int, FcPattern*,FcResult*); - FcPattern* (*m_pFcFontMatch)(FcConfig*,FcPattern*,FcResult*); - FcBool (*m_pFcConfigAppFontAddFile)(FcConfig*, const FcChar8*); - FcBool (*m_pFcConfigAppFontAddDir)(FcConfig*, const FcChar8*); - FcBool (*m_pFcConfigParseAndLoad)(FcConfig*,const FcChar8*,FcBool); - FcBool (*m_pFcConfigSubstitute)(FcConfig*,FcPattern*,FcMatchKind); - - FcPattern* (*m_pFcPatternDuplicate)(const FcPattern*); - FcBool (*m_pFcPatternAddInteger)(FcPattern*,const char*,int); - FcBool (*m_pFcPatternAddDouble)(FcPattern*,const char*,double); - FcBool (*m_pFcPatternAddBool)(FcPattern*,const char*,FcBool); - FcBool (*m_pFcPatternAddCharSet)(FcPattern*,const char*,const FcCharSet*); - FcBool (*m_pFcPatternAddString)(FcPattern*,const char*,const FcChar8*); - FcBool (*m_pFcPatternDel)(FcPattern*,const char*); - - FT_UInt (*m_pFcFreeTypeCharIndex)(FT_Face,FcChar32); - FcBool (*m_pFcPatternAddFTFace)(FcPattern*,const char*,const FT_Face); - - oslGenericFunction loadSymbol( const char* ); void addFontSet( FcSetName ); FontCfgWrapper(); @@ -170,127 +112,8 @@ public: static FontCfgWrapper& get(); static void release(); - bool isValid() const - { return m_pLib != NULL;} - FcFontSet* getFontSet(); - FcBool FcInit() - { return m_pFcInit(); } - - void FcFini() - { - //To-Do: get gtk vclplug smoketest to pass - //if (m_pFcFini) m_pFcFini(); - } - - int FcGetVersion() - { return m_pFcGetVersion(); } - - FcConfig* FcConfigGetCurrent() - { return m_pFcConfigGetCurrent(); } - - FcObjectSet* FcObjectSetBuild( const char* first, ... ) - { - va_list ap; - va_start( ap, first ); - FcObjectSet* pSet = m_pFcObjectSetVaBuild( first, ap ); - va_end( ap ); - return pSet; - } - - void FcObjectSetDestroy( FcObjectSet* pSet ) - { m_pFcObjectSetDestroy( pSet ); } - - FcPattern* FcPatternCreate() - { return m_pFcPatternCreate(); } - - void FcPatternDestroy( FcPattern* pPattern ) - { if (m_pFcPatternDestroy) m_pFcPatternDestroy( pPattern ); } - - FcBool FcPatternEqual( const FcPattern* pPatternA, const FcPattern *pPatternB ) - { return m_pFcPatternEqual( pPatternA, pPatternB ); } - - FcFontSet* FcConfigGetFonts( FcConfig* pConfig, FcSetName eSet) - { return m_pFcConfigGetFonts( pConfig, eSet ); } - - FcFontSet* FcFontSetCreate() - { return m_pFcFontSetCreate(); } - - FcCharSet* FcCharSetCreate() - { return m_pFcCharSetCreate(); } - - FcBool FcCharSetAddChar(FcCharSet *fcs, FcChar32 ucs4) - { return m_pFcCharSetAddChar(fcs, ucs4); } - - FcBool FcCharSetHasChar(FcCharSet *fcs, FcChar32 ucs4) - { return m_pFcCharSetHasChar(fcs, ucs4); } - - void FcCharSetDestroy( FcCharSet* pSet ) - { m_pFcCharSetDestroy( pSet );} - - void FcFontSetDestroy( FcFontSet* pSet ) - { m_pFcFontSetDestroy( pSet );} - - FcBool FcFontSetAdd( FcFontSet* pSet, FcPattern* pPattern ) - { return m_pFcFontSetAdd( pSet, pPattern ); } - - void FcPatternReference( FcPattern* pPattern ) - { m_pFcPatternReference( pPattern ); } - - FcResult FcPatternGetCharSet( const FcPattern* pPattern, const char* object, int n, FcCharSet** s ) - { return m_pFcPatternGetCharSet( pPattern, object, n, s ); } - - FcResult FcPatternGetString( const FcPattern* pPattern, const char* object, int n, FcChar8** s ) - { return m_pFcPatternGetString( pPattern, object, n, s ); } - - FcResult FcPatternGetInteger( const FcPattern* pPattern, const char* object, int n, int* s ) - { return m_pFcPatternGetInteger( pPattern, object, n, s ); } - - FcResult FcPatternGetDouble( const FcPattern* pPattern, const char* object, int n, double* s ) - { return m_pFcPatternGetDouble( pPattern, object, n, s ); } - - FcResult FcPatternGetBool( const FcPattern* pPattern, const char* object, int n, FcBool* s ) - { return m_pFcPatternGetBool( pPattern, object, n, s ); } - FcBool FcConfigAppFontAddFile( FcConfig* pConfig, const FcChar8* pFileName ) - { return m_pFcConfigAppFontAddFile( pConfig, pFileName ); } - FcBool FcConfigAppFontAddDir(FcConfig* pConfig, const FcChar8* pDirName ) - { return m_pFcConfigAppFontAddDir( pConfig, pDirName ); } - FcBool FcConfigParseAndLoad( FcConfig* pConfig, const FcChar8* pFileName, FcBool bComplain ) - { return m_pFcConfigParseAndLoad( pConfig, pFileName, bComplain ); } - - void FcDefaultSubstitute( FcPattern* pPattern ) - { m_pFcDefaultSubstitute( pPattern ); } - FcPattern* FcFontSetMatch( FcConfig* pConfig, FcFontSet **ppFontSet, int nset, FcPattern* pPattern, FcResult* pResult ) - { return m_pFcFontSetMatch ? m_pFcFontSetMatch( pConfig, ppFontSet, nset, pPattern, pResult ) : 0; } - FcPattern* FcFontMatch( FcConfig* pConfig, FcPattern* pPattern, FcResult* pResult ) - { return m_pFcFontMatch( pConfig, pPattern, pResult ); } - FcBool FcConfigSubstitute( FcConfig* pConfig, FcPattern* pPattern, FcMatchKind eKind ) - { return m_pFcConfigSubstitute( pConfig, pPattern, eKind ); } - - FcPattern* FcPatternDuplicate( const FcPattern* pPattern ) const - { return m_pFcPatternDuplicate( pPattern ); } - FcBool FcPatternAddInteger( FcPattern* pPattern, const char* pObject, int nValue ) - { return m_pFcPatternAddInteger( pPattern, pObject, nValue ); } - FcBool FcPatternAddDouble( FcPattern* pPattern, const char* pObject, double nValue ) - { return m_pFcPatternAddDouble( pPattern, pObject, nValue ); } - FcBool FcPatternAddString( FcPattern* pPattern, const char* pObject, const FcChar8* pString ) - { return m_pFcPatternAddString( pPattern, pObject, pString ); } - FcBool FcPatternAddBool( FcPattern* pPattern, const char* pObject, bool nValue ) - { return m_pFcPatternAddBool( pPattern, pObject, nValue ); } - FcBool FcPatternAddCharSet(FcPattern* pPattern,const char* pObject,const FcCharSet*pCharSet) - { return m_pFcPatternAddCharSet(pPattern,pObject,pCharSet); } - FcBool FcPatternDel(FcPattern* pPattern, const char* object) - { return m_pFcPatternDel( pPattern, object); } - - FT_UInt FcFreeTypeCharIndex( FT_Face face, FcChar32 ucs4 ) - { return m_pFcFreeTypeCharIndex ? m_pFcFreeTypeCharIndex( face, ucs4 ) : 0; } - FcBool FcPatternAddFTFace( FcPattern* pPattern, const char* pObject, const FT_Face nValue ) - { - return m_pFcPatternAddFTFace - ? m_pFcPatternAddFTFace( pPattern, pObject, nValue ) - : false; - } public: FcResult LocalizedElementFromPattern(FcPattern* pPattern, FcChar8 **family, const char *elementtype, const char *elementlangtype); @@ -301,189 +124,14 @@ private: void cacheLocalizedFontNames(FcChar8 *origfontname, FcChar8 *bestfontname, const std::vector< lang_and_element > &lang_and_elements); }; -oslGenericFunction FontCfgWrapper::loadSymbol( const char* pSymbol ) -{ - OUString aSym( OUString::createFromAscii( pSymbol ) ); - oslGenericFunction pSym = osl_getFunctionSymbol( m_pLib, aSym.pData ); -#if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "%s %s\n", pSymbol, pSym ? "found" : "not found" ); -#endif - return pSym; -} - FontCfgWrapper::FontCfgWrapper() - : m_pLib( NULL ), - m_pOutlineSet( NULL ), - m_nFcVersion( 0 ) + : m_pOutlineSet( NULL ) { - OUString aLib( RTL_CONSTASCII_USTRINGPARAM( "libfontconfig.so.1" ) ); - m_pLib = osl_loadModule( aLib.pData, SAL_LOADMODULE_LAZY ); - if( !m_pLib ) - { - aLib = OUString( RTL_CONSTASCII_USTRINGPARAM( "libfontconfig.so" ) ); - m_pLib = osl_loadModule( aLib.pData, SAL_LOADMODULE_LAZY ); - } - - if( ! m_pLib ) - { -#if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "no libfontconfig\n" ); -#endif - return; - } - - m_pFcInit = (FcBool(*)()) - loadSymbol( "FcInit" ); - m_pFcFini = (void(*)()) - loadSymbol( "FcFini" ); - m_pFcGetVersion = (int(*)()) - loadSymbol( "FcGetVersion" ); - m_pFcConfigGetCurrent = (FcConfig *(*)()) - loadSymbol( "FcConfigGetCurrent" ); - m_pFcObjectSetVaBuild = (FcObjectSet*(*)(const char*,va_list)) - loadSymbol( "FcObjectSetVaBuild" ); - m_pFcObjectSetDestroy = (void(*)(FcObjectSet*)) - loadSymbol( "FcObjectSetDestroy" ); - m_pFcPatternCreate = (FcPattern*(*)()) - loadSymbol( "FcPatternCreate" ); - m_pFcPatternDestroy = (void(*)(FcPattern*)) - loadSymbol( "FcPatternDestroy" ); - m_pFcPatternEqual = (FcBool(*)(const FcPattern*,const FcPattern*)) - loadSymbol( "FcPatternEqual" ); - m_pFcConfigGetFonts = (FcFontSet*(*)(FcConfig*,FcSetName)) - loadSymbol( "FcConfigGetFonts" ); - m_pFcFontSetCreate = (FcFontSet*(*)()) - loadSymbol( "FcFontSetCreate" ); - m_pFcCharSetCreate = (FcCharSet*(*)()) - loadSymbol( "FcCharSetCreate" ); - m_pFcCharSetAddChar = (FcBool(*)(FcCharSet*, FcChar32)) - loadSymbol( "FcCharSetAddChar" ); - m_pFcCharSetHasChar = (FcBool(*)(FcCharSet*, FcChar32)) - loadSymbol( "FcCharSetHasChar" ); - m_pFcCharSetDestroy = (void(*)(FcCharSet*)) - loadSymbol( "FcCharSetDestroy" ); - m_pFcFontSetDestroy = (void(*)(FcFontSet*)) - loadSymbol( "FcFontSetDestroy" ); - m_pFcFontSetAdd = (FcBool(*)(FcFontSet*,FcPattern*)) - loadSymbol( "FcFontSetAdd" ); - m_pFcPatternReference = (void(*)(FcPattern*)) - loadSymbol( "FcPatternReference" ); - m_pFcPatternGetCharSet = (FcResult(*)(const FcPattern*,const char*,int,FcCharSet**)) - loadSymbol( "FcPatternGetCharSet" ); - m_pFcPatternGetString = (FcResult(*)(const FcPattern*,const char*,int,FcChar8**)) - loadSymbol( "FcPatternGetString" ); - m_pFcPatternGetInteger = (FcResult(*)(const FcPattern*,const char*,int,int*)) - loadSymbol( "FcPatternGetInteger" ); - m_pFcPatternGetDouble = (FcResult(*)(const FcPattern*,const char*,int,double*)) - loadSymbol( "FcPatternGetDouble" ); - m_pFcPatternGetBool = (FcResult(*)(const FcPattern*,const char*,int,FcBool*)) - loadSymbol( "FcPatternGetBool" ); - m_pFcConfigAppFontAddFile = (FcBool(*)(FcConfig*, const FcChar8*)) - loadSymbol( "FcConfigAppFontAddFile" ); - m_pFcConfigAppFontAddDir = (FcBool(*)(FcConfig*, const FcChar8*)) - loadSymbol( "FcConfigAppFontAddDir" ); - m_pFcConfigParseAndLoad = (FcBool(*)(FcConfig*, const FcChar8*, FcBool)) - loadSymbol( "FcConfigParseAndLoad" ); - m_pFcDefaultSubstitute = (void(*)(FcPattern *)) - loadSymbol( "FcDefaultSubstitute" ); - m_pFcFontSetMatch = (FcPattern*(*)(FcConfig*,FcFontSet**,int,FcPattern*,FcResult*)) - loadSymbol( "FcFontSetMatch" ); - m_pFcFontMatch = (FcPattern*(*)(FcConfig*,FcPattern*,FcResult*)) - loadSymbol( "FcFontMatch" ); - m_pFcConfigSubstitute = (FcBool(*)(FcConfig*,FcPattern*,FcMatchKind)) - loadSymbol( "FcConfigSubstitute" ); - - m_pFcPatternDuplicate = (FcPattern*(*)(const FcPattern*)) - loadSymbol( "FcPatternDuplicate" ); - m_pFcPatternAddInteger = (FcBool(*)(FcPattern*,const char*,int)) - loadSymbol( "FcPatternAddInteger" ); - m_pFcPatternAddDouble = (FcBool(*)(FcPattern*,const char*,double)) - loadSymbol( "FcPatternAddDouble" ); - m_pFcPatternAddBool = (FcBool(*)(FcPattern*,const char*,FcBool)) - loadSymbol( "FcPatternAddBool" ); - m_pFcPatternAddCharSet = (FcBool(*)(FcPattern*,const char*,const FcCharSet *)) - loadSymbol( "FcPatternAddCharSet" ); - m_pFcPatternAddString = (FcBool(*)(FcPattern*,const char*,const FcChar8*)) - loadSymbol( "FcPatternAddString" ); - m_pFcPatternDel = (FcBool(*)(FcPattern*,const char*)) - loadSymbol( "FcPatternDel" ); - - m_pFcFreeTypeCharIndex = (FT_UInt(*)(FT_Face,FcChar32)) - loadSymbol( "FcFreeTypeCharIndex" ); - m_pFcPatternAddFTFace = (FcBool(*)(FcPattern*,const char*,const FT_Face)) - loadSymbol( "FcPatternAddFTFace" ); - - m_nFcVersion = FcGetVersion(); -#if (OSL_DEBUG_LEVEL > 1) - fprintf( stderr,"FC_VERSION = %05d\n", m_nFcVersion ); -#endif - // make minimum version configurable - const char* pMinFcVersion = getenv( "SAL_MIN_FC_VERSION"); - if( pMinFcVersion ) - { - const int nMinFcVersion = atoi( pMinFcVersion ); - if( m_nFcVersion < nMinFcVersion ) - m_pFcInit = NULL; - } - - if( ! ( - m_pFcInit && - m_pFcGetVersion && - m_pFcConfigGetCurrent && - m_pFcObjectSetVaBuild && - m_pFcObjectSetDestroy && - m_pFcPatternCreate && - m_pFcPatternDestroy && - m_pFcPatternEqual && - m_pFcConfigGetFonts && - m_pFcFontSetCreate && - m_pFcCharSetCreate && - m_pFcCharSetAddChar && - m_pFcCharSetHasChar && - m_pFcCharSetDestroy && - m_pFcFontSetDestroy && - m_pFcFontSetAdd && - m_pFcPatternReference && - m_pFcPatternGetCharSet && - m_pFcPatternGetString && - m_pFcPatternGetInteger && - m_pFcPatternGetDouble && - m_pFcPatternGetBool && - m_pFcConfigAppFontAddFile && - m_pFcConfigAppFontAddDir && - m_pFcConfigParseAndLoad && - m_pFcFontMatch && - m_pFcDefaultSubstitute && - m_pFcConfigSubstitute && - m_pFcPatternDuplicate && - m_pFcPatternAddInteger && - m_pFcPatternAddDouble && - m_pFcPatternAddCharSet && - m_pFcPatternAddBool && - m_pFcPatternAddString && - m_pFcPatternDel - ) ) - { - osl_unloadModule( (oslModule)m_pLib ); - m_pLib = NULL; -#if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "not all needed symbols were found in libfontconfig\n" ); -#endif - return; - } - - FcInit(); - if( ! FcConfigGetCurrent() ) - { - osl_unloadModule( (oslModule)m_pLib ); - m_pLib = NULL; - } } void FontCfgWrapper::addFontSet( FcSetName eSetName ) { - #ifdef ENABLE_FONTCONFIG /* add only acceptable outlined fonts to our config, for future fontconfig use @@ -506,20 +154,16 @@ void FontCfgWrapper::addFontSet( FcSetName eSetName ) } // TODO?: FcFontSetDestroy( pOrig ); - #else - (void)eSetName; // prevent compiler warning about unused parameter - #endif } -#ifdef ENABLE_FONTCONFIG namespace { - int compareFontNames(FontCfgWrapper& rWrapper, const FcPattern *a, const FcPattern *b) + int compareFontNames(const FcPattern *a, const FcPattern *b) { FcChar8 *pNameA=NULL, *pNameB=NULL; - bool bHaveA = rWrapper.FcPatternGetString(a, FC_FAMILY, 0, &pNameA) == FcResultMatch; - bool bHaveB = rWrapper.FcPatternGetString(b, FC_FAMILY, 0, &pNameB) == FcResultMatch; + bool bHaveA = FcPatternGetString(a, FC_FAMILY, 0, &pNameA) == FcResultMatch; + bool bHaveB = FcPatternGetString(b, FC_FAMILY, 0, &pNameB) == FcResultMatch; if (bHaveA && bHaveB) return strcmp((const char*)pNameA, (const char*)pNameB); @@ -531,21 +175,17 @@ namespace //those with higher version numbers first class SortFont : public ::std::binary_function< const FcPattern*, const FcPattern*, bool > { - private: - FontCfgWrapper& m_rWrapper; public: - SortFont(FontCfgWrapper& rWrapper) : m_rWrapper(rWrapper) {} - bool operator()(const FcPattern *a, const FcPattern *b) { - int comp = compareFontNames(m_rWrapper, a, b); + int comp = compareFontNames(a, b); if (comp != 0) return comp < 0; int nVersionA=0, nVersionB=0; - bool bHaveA = m_rWrapper.FcPatternGetInteger(a, FC_FONTVERSION, 0, &nVersionA) == FcResultMatch; - bool bHaveB = m_rWrapper.FcPatternGetInteger(b, FC_FONTVERSION, 0, &nVersionB) == FcResultMatch; + bool bHaveA = FcPatternGetInteger(a, FC_FONTVERSION, 0, &nVersionA) == FcResultMatch; + bool bHaveB = FcPatternGetInteger(b, FC_FONTVERSION, 0, &nVersionB) == FcResultMatch; if (bHaveA && bHaveB) return nVersionA > nVersionB; @@ -560,7 +200,7 @@ namespace //See if this font is a duplicate with equal attributes which has already been //inserted, or if it an older version of an inserted fonts. Depends on FcFontSet //on being sorted with SortFont - bool isPreviouslyDuplicateOrObsoleted(FontCfgWrapper& rWrapper, FcFontSet *pFSet, int i) + bool isPreviouslyDuplicateOrObsoleted(FcFontSet *pFSet, int i) { if (i == 0) return false; @@ -568,46 +208,41 @@ namespace const FcPattern *a = pFSet->fonts[i]; const FcPattern *b = pFSet->fonts[i-1]; - if (compareFontNames(rWrapper, a, b) != 0) + if (compareFontNames(a, b) != 0) return false; - FcPattern* pTestPatternA = rWrapper.FcPatternDuplicate(a); - rWrapper.FcPatternDel(pTestPatternA, FC_FILE); - rWrapper.FcPatternDel(pTestPatternA, FC_CHARSET); - rWrapper.FcPatternDel(pTestPatternA, FC_CAPABILITY); - rWrapper.FcPatternDel(pTestPatternA, FC_FONTVERSION); + FcPattern* pTestPatternA = FcPatternDuplicate(a); + FcPatternDel(pTestPatternA, FC_FILE); + FcPatternDel(pTestPatternA, FC_CHARSET); + FcPatternDel(pTestPatternA, FC_CAPABILITY); + FcPatternDel(pTestPatternA, FC_FONTVERSION); - FcPattern* pTestPatternB = rWrapper.FcPatternDuplicate(b); - rWrapper.FcPatternDel(pTestPatternB, FC_FILE); - rWrapper.FcPatternDel(pTestPatternB, FC_CHARSET); - rWrapper.FcPatternDel(pTestPatternB, FC_CAPABILITY); - rWrapper.FcPatternDel(pTestPatternB, FC_FONTVERSION); + FcPattern* pTestPatternB = FcPatternDuplicate(b); + FcPatternDel(pTestPatternB, FC_FILE); + FcPatternDel(pTestPatternB, FC_CHARSET); + FcPatternDel(pTestPatternB, FC_CAPABILITY); + FcPatternDel(pTestPatternB, FC_FONTVERSION); - bool bIsDup = false; - if (rWrapper.FcPatternEqual(pTestPatternA, pTestPatternB)) - bIsDup = true; + bool bIsDup = FcPatternEqual(pTestPatternA, pTestPatternB); - rWrapper.FcPatternDestroy(pTestPatternB); - rWrapper.FcPatternDestroy(pTestPatternA); + FcPatternDestroy(pTestPatternB); + FcPatternDestroy(pTestPatternA); return bIsDup; } } -#endif FcFontSet* FontCfgWrapper::getFontSet() { - #ifdef ENABLE_FONTCONFIG if( !m_pOutlineSet ) { m_pOutlineSet = FcFontSetCreate(); addFontSet( FcSetSystem ); - if( m_nFcVersion > 20400 ) // #i85462# prevent crashes + if( FcGetVersion() > 20400 ) // #i85462# prevent crashes addFontSet( FcSetApplication ); - ::std::sort(m_pOutlineSet->fonts,m_pOutlineSet->fonts+m_pOutlineSet->nfont,SortFont(*this)); + ::std::sort(m_pOutlineSet->fonts,m_pOutlineSet->fonts+m_pOutlineSet->nfont,SortFont()); } - #endif return m_pOutlineSet; } @@ -616,9 +251,8 @@ FontCfgWrapper::~FontCfgWrapper() { if( m_pOutlineSet ) FcFontSetDestroy( m_pOutlineSet ); - FcFini(); - if( m_pLib ) - osl_unloadModule( (oslModule)m_pLib ); + //To-Do: get gtk vclplug smoketest to pass + //FcFini(); } static FontCfgWrapper* pOneInstance = NULL; @@ -639,7 +273,6 @@ void FontCfgWrapper::release() } } -#ifdef ENABLE_FONTCONFIG namespace { class localizedsorter @@ -749,9 +382,7 @@ FcResult FontCfgWrapper::LocalizedElementFromPattern(FcPattern* pPattern, FcChar */ bool PrintFontManager::initFontconfig() { - FontCfgWrapper& rWrapper = FontCfgWrapper::get(); - if( ! rWrapper.isValid() ) - return false; + FontCfgWrapper::get(); return true; } @@ -827,8 +458,6 @@ int PrintFontManager::countFontconfigFonts( boost::unordered_map<rtl::OString, i int nFonts = 0; FontCfgWrapper& rWrapper = FontCfgWrapper::get(); - if( !rWrapper.isValid() ) - return 0; FcFontSet* pFSet = rWrapper.getFontSet(); if( pFSet ) @@ -841,20 +470,22 @@ int PrintFontManager::countFontconfigFonts( boost::unordered_map<rtl::OString, i FcChar8* file = NULL; FcChar8* family = NULL; FcChar8* style = NULL; + FcChar8* format = NULL; int slant = 0; int weight = 0; int spacing = 0; int nCollectionEntry = -1; FcBool outline = false; - FcResult eFileRes = rWrapper.FcPatternGetString( pFSet->fonts[i], FC_FILE, 0, &file ); + FcResult eFileRes = FcPatternGetString(pFSet->fonts[i], FC_FILE, 0, &file); FcResult eFamilyRes = rWrapper.LocalizedElementFromPattern( pFSet->fonts[i], &family, FC_FAMILY, FC_FAMILYLANG ); FcResult eStyleRes = rWrapper.LocalizedElementFromPattern( pFSet->fonts[i], &style, FC_STYLE, FC_STYLELANG ); - FcResult eSlantRes = rWrapper.FcPatternGetInteger( pFSet->fonts[i], FC_SLANT, 0, &slant ); - FcResult eWeightRes = rWrapper.FcPatternGetInteger( pFSet->fonts[i], FC_WEIGHT, 0, &weight ); - FcResult eSpacRes = rWrapper.FcPatternGetInteger( pFSet->fonts[i], FC_SPACING, 0, &spacing ); - FcResult eOutRes = rWrapper.FcPatternGetBool( pFSet->fonts[i], FC_OUTLINE, 0, &outline ); - FcResult eIndexRes = rWrapper.FcPatternGetInteger( pFSet->fonts[i], FC_INDEX, 0, &nCollectionEntry ); + FcResult eSlantRes = FcPatternGetInteger(pFSet->fonts[i], FC_SLANT, 0, &slant); + FcResult eWeightRes = FcPatternGetInteger(pFSet->fonts[i], FC_WEIGHT, 0, &weight); + FcResult eSpacRes = FcPatternGetInteger(pFSet->fonts[i], FC_SPACING, 0, &spacing); + FcResult eOutRes = FcPatternGetBool(pFSet->fonts[i], FC_OUTLINE, 0, &outline); + FcResult eIndexRes = FcPatternGetInteger(pFSet->fonts[i], FC_INDEX, 0, &nCollectionEntry); + FcResult eFormatRes = FcPatternGetString(pFSet->fonts[i], FC_FONTFORMAT, 0, &format); if( eFileRes != FcResultMatch || eFamilyRes != FcResultMatch || eOutRes != FcResultMatch ) continue; @@ -862,13 +493,14 @@ int PrintFontManager::countFontconfigFonts( boost::unordered_map<rtl::OString, i #if (OSL_DEBUG_LEVEL > 2) fprintf( stderr, "found font \"%s\" in file %s\n" " weight = %d, slant = %d, style = \"%s\"\n" - " spacing = %d, outline = %d\n" + " spacing = %d, outline = %d, format %s\n" , family, file , eWeightRes == FcResultMatch ? weight : -1 , eSpacRes == FcResultMatch ? slant : -1 , eStyleRes == FcResultMatch ? (const char*) style : "<nil>" , eSpacRes == FcResultMatch ? spacing : -1 , eOutRes == FcResultMatch ? outline : -1 + , eFormatRes == FcResultMatch ? (const char*)format : "<unknown>" ); #endif @@ -878,7 +510,7 @@ int PrintFontManager::countFontconfigFonts( boost::unordered_map<rtl::OString, i if( eOutRes == FcResultMatch && ! outline ) continue; - if (isPreviouslyDuplicateOrObsoleted(rWrapper, pFSet, i)) + if (isPreviouslyDuplicateOrObsoleted(pFSet, i)) { #if OSL_DEBUG_LEVEL > 2 fprintf(stderr, "Ditching %s as duplicate/obsolete\n", file); @@ -903,7 +535,9 @@ int PrintFontManager::countFontconfigFonts( boost::unordered_map<rtl::OString, i // not known, analyze font file to get attributes // not described by fontconfig (e.g. alias names, PSName) std::list< OString > aDummy; - analyzeFontFile( nDirID, aBase, aDummy, aFonts ); + if (eFormatRes != FcResultMatch) + format = NULL; + analyzeFontFile( nDirID, aBase, aDummy, aFonts, (const char*)format ); #if OSL_DEBUG_LEVEL > 1 if( aFonts.empty() ) fprintf( stderr, "Warning: file \"%s\" is unusable to psprint\n", aOrgPath.getStr() ); @@ -1004,25 +638,15 @@ void PrintFontManager::deinitFontconfig() FontCfgWrapper::release(); } -int PrintFontManager::FreeTypeCharIndex( void *pFace, sal_uInt32 aChar ) -{ - FontCfgWrapper& rWrapper = FontCfgWrapper::get(); - return rWrapper.isValid() ? rWrapper.FcFreeTypeCharIndex( (FT_Face)pFace, aChar ) : 0; -} - bool PrintFontManager::addFontconfigDir( const rtl::OString& rDirName ) { - FontCfgWrapper& rWrapper = FontCfgWrapper::get(); - if( ! rWrapper.isValid() ) - return false; - // workaround for a stability problems in older FC versions // when handling application specifc fonts - const int nVersion = rWrapper.FcGetVersion(); + const int nVersion = FcGetVersion(); if( nVersion <= 20400 ) return false; const char* pDirName = (const char*)rDirName.getStr(); - bool bDirOk = (rWrapper.FcConfigAppFontAddDir( rWrapper.FcConfigGetCurrent(), (FcChar8*)pDirName ) == FcTrue); + bool bDirOk = (FcConfigAppFontAddDir(FcConfigGetCurrent(), (FcChar8*)pDirName ) == FcTrue); #if OSL_DEBUG_LEVEL > 1 fprintf( stderr, "FcConfigAppFontAddDir( \"%s\") => %d\n", pDirName, bDirOk ); @@ -1037,8 +661,8 @@ bool PrintFontManager::addFontconfigDir( const rtl::OString& rDirName ) if( pCfgFile ) { fclose( pCfgFile); - bool bCfgOk = rWrapper.FcConfigParseAndLoad( rWrapper.FcConfigGetCurrent(), - (FcChar8*)aConfFileName.getStr(), FcTrue ); + bool bCfgOk = FcConfigParseAndLoad(FcConfigGetCurrent(), + (FcChar8*)aConfFileName.getStr(), FcTrue); if( !bCfgOk ) fprintf( stderr, "FcConfigParseAndLoad( \"%s\") => %d\n", aConfFileName.getStr(), bCfgOk ); } @@ -1046,7 +670,7 @@ bool PrintFontManager::addFontconfigDir( const rtl::OString& rDirName ) return true; } -static void addtopattern(FontCfgWrapper& rWrapper, FcPattern *pPattern, +static void addtopattern(FcPattern *pPattern, FontItalic eItalic, FontWeight eWeight, FontWidth eWidth, FontPitch ePitch) { if( eItalic != ITALIC_DONTKNOW ) @@ -1054,12 +678,16 @@ static void addtopattern(FontCfgWrapper& rWrapper, FcPattern *pPattern, int nSlant = FC_SLANT_ROMAN; switch( eItalic ) { - case ITALIC_NORMAL: nSlant = FC_SLANT_ITALIC;break; - case ITALIC_OBLIQUE: nSlant = FC_SLANT_OBLIQUE;break; + case ITALIC_NORMAL: + nSlant = FC_SLANT_ITALIC; + break; + case ITALIC_OBLIQUE: + nSlant = FC_SLANT_OBLIQUE; + break; default: break; } - rWrapper.FcPatternAddInteger( pPattern, FC_SLANT, nSlant ); + FcPatternAddInteger(pPattern, FC_SLANT, nSlant); } if( eWeight != WEIGHT_DONTKNOW ) { @@ -1079,7 +707,7 @@ static void addtopattern(FontCfgWrapper& rWrapper, FcPattern *pPattern, default: break; } - rWrapper.FcPatternAddInteger( pPattern, FC_WEIGHT, nWeight ); + FcPatternAddInteger(pPattern, FC_WEIGHT, nWeight); } if( eWidth != WIDTH_DONTKNOW ) { @@ -1098,7 +726,7 @@ static void addtopattern(FontCfgWrapper& rWrapper, FcPattern *pPattern, default: break; } - rWrapper.FcPatternAddInteger( pPattern, FC_WIDTH, nWidth ); + FcPatternAddInteger(pPattern, FC_WIDTH, nWidth); } if( ePitch != PITCH_DONTKNOW ) { @@ -1110,9 +738,9 @@ static void addtopattern(FontCfgWrapper& rWrapper, FcPattern *pPattern, default: break; } - rWrapper.FcPatternAddInteger( pPattern, FC_SPACING, nSpacing ); + FcPatternAddInteger(pPattern, FC_SPACING, nSpacing); if (nSpacing == FC_MONO) - rWrapper.FcPatternAddString( pPattern, FC_FAMILY, (FcChar8*)"monospace"); + FcPatternAddString(pPattern, FC_FAMILY, (FcChar8*)"monospace"); } } @@ -1123,18 +751,16 @@ rtl::OUString PrintFontManager::Substitute(const rtl::OUString& rFontName, { rtl::OUString aName; FontCfgWrapper& rWrapper = FontCfgWrapper::get(); - if( ! rWrapper.isValid() ) - return aName; // build pattern argument for fontconfig query - FcPattern* pPattern = rWrapper.FcPatternCreate(); + FcPattern* pPattern = FcPatternCreate(); // Prefer scalable fonts - rWrapper.FcPatternAddBool( pPattern, FC_SCALABLE, FcTrue ); + FcPatternAddBool(pPattern, FC_SCALABLE, FcTrue); const rtl::OString aTargetName = rtl::OUStringToOString( rFontName, RTL_TEXTENCODING_UTF8 ); const FcChar8* pTargetNameUtf8 = (FcChar8*)aTargetName.getStr(); - rWrapper.FcPatternAddString( pPattern, FC_FAMILY, pTargetNameUtf8 ); + FcPatternAddString(pPattern, FC_FAMILY, pTargetNameUtf8); if( rLangAttrib.getLength() ) { @@ -1143,42 +769,42 @@ rtl::OUString PrintFontManager::Substitute(const rtl::OUString& rFontName, pLangAttribUtf8 = (FcChar8*)"pa"; else pLangAttribUtf8 = (FcChar8*)rLangAttrib.getStr(); - rWrapper.FcPatternAddString( pPattern, FC_LANG, pLangAttribUtf8 ); + FcPatternAddString(pPattern, FC_LANG, pLangAttribUtf8); } // Add required Unicode characters, if any if ( rMissingCodes.getLength() ) { - FcCharSet *unicodes = rWrapper.FcCharSetCreate(); + FcCharSet *unicodes = FcCharSetCreate(); for( sal_Int32 nStrIndex = 0; nStrIndex < rMissingCodes.getLength(); ) { // also handle unicode surrogates const sal_uInt32 nCode = rMissingCodes.iterateCodePoints( &nStrIndex ); - rWrapper.FcCharSetAddChar( unicodes, nCode ); + FcCharSetAddChar( unicodes, nCode ); } - rWrapper.FcPatternAddCharSet( pPattern, FC_CHARSET, unicodes); - rWrapper.FcCharSetDestroy( unicodes ); + FcPatternAddCharSet(pPattern, FC_CHARSET, unicodes); + FcCharSetDestroy(unicodes); } - addtopattern(rWrapper, pPattern, rItalic, rWeight, rWidth, rPitch); + addtopattern(pPattern, rItalic, rWeight, rWidth, rPitch); // query fontconfig for a substitute - rWrapper.FcConfigSubstitute( rWrapper.FcConfigGetCurrent(), pPattern, FcMatchPattern ); - rWrapper.FcDefaultSubstitute( pPattern ); + FcConfigSubstitute(FcConfigGetCurrent(), pPattern, FcMatchPattern); + FcDefaultSubstitute(pPattern); // process the result of the fontconfig query FcResult eResult = FcResultNoMatch; FcFontSet* pFontSet = rWrapper.getFontSet(); - FcPattern* pResult = rWrapper.FcFontSetMatch( rWrapper.FcConfigGetCurrent(), &pFontSet, 1, pPattern, &eResult ); - rWrapper.FcPatternDestroy( pPattern ); + FcPattern* pResult = FcFontSetMatch(FcConfigGetCurrent(), &pFontSet, 1, pPattern, &eResult); + FcPatternDestroy( pPattern ); FcFontSet* pSet = NULL; if( pResult ) { - pSet = rWrapper.FcFontSetCreate(); + pSet = FcFontSetCreate(); // info: destroying the pSet destroys pResult implicitly // since pResult was "added" to pSet - rWrapper.FcFontSetAdd( pSet, pResult ); + FcFontSetAdd( pSet, pResult ); } if( pSet ) @@ -1187,7 +813,7 @@ rtl::OUString PrintFontManager::Substitute(const rtl::OUString& rFontName, { //extract the closest match FcChar8* family = NULL; - FcResult eFileRes = rWrapper.FcPatternGetString( pSet->fonts[0], FC_FAMILY, 0, &family ); + FcResult eFileRes = FcPatternGetString( pSet->fonts[0], FC_FAMILY, 0, &family ); // get the family name if( eFileRes == FcResultMatch ) @@ -1200,13 +826,13 @@ rtl::OUString PrintFontManager::Substitute(const rtl::OUString& rFontName, int val = 0; - if ( FcResultMatch == rWrapper.FcPatternGetInteger( pSet->fonts[0], FC_WEIGHT, 0, &val)) + if (FcResultMatch == FcPatternGetInteger(pSet->fonts[0], FC_WEIGHT, 0, &val)) rWeight = convertWeight(val); - if ( FcResultMatch == rWrapper.FcPatternGetInteger( pSet->fonts[0], FC_SLANT, 0, &val)) + if (FcResultMatch == FcPatternGetInteger(pSet->fonts[0], FC_SLANT, 0, &val)) rItalic = convertSlant(val); - if ( FcResultMatch == rWrapper.FcPatternGetInteger( pSet->fonts[0], FC_SPACING, 0, &val)) + if (FcResultMatch == FcPatternGetInteger(pSet->fonts[0], FC_SPACING, 0, &val)) rPitch = convertSpacing(val); - if ( FcResultMatch == rWrapper.FcPatternGetInteger( pSet->fonts[0], FC_WIDTH, 0, &val)) + if (FcResultMatch == FcPatternGetInteger(pSet->fonts[0], FC_WIDTH, 0, &val)) rWidth = convertWidth(val); } @@ -1216,13 +842,13 @@ rtl::OUString PrintFontManager::Substitute(const rtl::OUString& rFontName, sal_uInt32* pRemainingCodes = (sal_uInt32*)alloca( rMissingCodes.getLength() * sizeof(sal_uInt32) ); int nRemainingLen = 0; FcCharSet* unicodes; - if( !rWrapper.FcPatternGetCharSet( pSet->fonts[0], FC_CHARSET, 0, &unicodes ) ) + if (!FcPatternGetCharSet(pSet->fonts[0], FC_CHARSET, 0, &unicodes)) { for( sal_Int32 nStrIndex = 0; nStrIndex < rMissingCodes.getLength(); ) { // also handle unicode surrogates const sal_uInt32 nCode = rMissingCodes.iterateCodePoints( &nStrIndex ); - if( rWrapper.FcCharSetHasChar( unicodes, nCode ) != FcTrue ) + if (FcCharSetHasChar(unicodes, nCode) != FcTrue) pRemainingCodes[ nRemainingLen++ ] = nCode; } } @@ -1230,7 +856,7 @@ rtl::OUString PrintFontManager::Substitute(const rtl::OUString& rFontName, } } - rWrapper.FcFontSetDestroy( pSet ); + FcFontSetDestroy( pSet ); } return aName; @@ -1242,18 +868,15 @@ public: FontConfigFontOptions() : mpPattern(0) {} ~FontConfigFontOptions() { - FontCfgWrapper& rWrapper = FontCfgWrapper::get(); - if( rWrapper.isValid() ) - rWrapper.FcPatternDestroy( mpPattern ); + FcPatternDestroy(mpPattern); } virtual void *GetPattern(void * face, bool bEmbolden) const { - FontCfgWrapper& rWrapper = FontCfgWrapper::get(); - if( rWrapper.isValid() ) - { - rWrapper.FcPatternAddFTFace(mpPattern, FC_FT_FACE, static_cast<FT_Face>(face)); - rWrapper.FcPatternAddBool(mpPattern, FC_EMBOLDEN, bEmbolden ? FcTrue : FcFalse); - } + FcValue value; + value.type = FcTypeFTFace; + value.u.f = face; + FcPatternAdd (mpPattern, FC_FT_FACE, value, FcTrue); + FcPatternAddBool(mpPattern, FC_EMBOLDEN, bEmbolden ? FcTrue : FcFalse); return mpPattern; } FcPattern* mpPattern; @@ -1262,17 +885,11 @@ public: ImplFontOptions* PrintFontManager::getFontOptions( const FastPrintFontInfo& rInfo, int nSize, void (*subcallback)(void*)) const { -#ifndef ENABLE_FONTCONFIG - (void)rInfo;(void)nSize;(void)subcallback;(void)rOptions; - return NULL; -#else // ENABLE_FONTCONFIG FontCfgWrapper& rWrapper = FontCfgWrapper::get(); - if( ! rWrapper.isValid() ) - return NULL; FontConfigFontOptions* pOptions = NULL; - FcConfig* pConfig = rWrapper.FcConfigGetCurrent(); - FcPattern* pPattern = rWrapper.FcPatternCreate(); + FcConfig* pConfig = FcConfigGetCurrent(); + FcPattern* pPattern = FcPatternCreate(); OString sFamily = OUStringToOString( rInfo.m_aFamilyName, RTL_TEXTENCODING_UTF8 ); @@ -1280,32 +897,33 @@ ImplFontOptions* PrintFontManager::getFontOptions( if (aI != rWrapper.m_aLocalizedToCanonical.end()) sFamily = aI->second; if( sFamily.getLength() ) - rWrapper.FcPatternAddString( pPattern, FC_FAMILY, (FcChar8*)sFamily.getStr() ); + FcPatternAddString(pPattern, FC_FAMILY, (FcChar8*)sFamily.getStr()); - addtopattern(rWrapper, pPattern, rInfo.m_eItalic, rInfo.m_eWeight, rInfo.m_eWidth, rInfo.m_ePitch); - rWrapper.FcPatternAddDouble( pPattern, FC_PIXEL_SIZE, nSize); + addtopattern(pPattern, rInfo.m_eItalic, rInfo.m_eWeight, rInfo.m_eWidth, rInfo.m_ePitch); + FcPatternAddDouble(pPattern, FC_PIXEL_SIZE, nSize); FcBool embitmap = true, antialias = true, autohint = true, hinting = true; int hintstyle = FC_HINT_FULL; - rWrapper.FcConfigSubstitute( pConfig, pPattern, FcMatchPattern ); - if (subcallback) subcallback(pPattern); - rWrapper.FcDefaultSubstitute( pPattern ); + FcConfigSubstitute(pConfig, pPattern, FcMatchPattern); + if (subcallback) + subcallback(pPattern); + FcDefaultSubstitute(pPattern); FcResult eResult = FcResultNoMatch; FcFontSet* pFontSet = rWrapper.getFontSet(); - FcPattern* pResult = rWrapper.FcFontSetMatch( pConfig, &pFontSet, 1, pPattern, &eResult ); + FcPattern* pResult = FcFontSetMatch( pConfig, &pFontSet, 1, pPattern, &eResult ); if( pResult ) { - FcResult eEmbeddedBitmap = rWrapper.FcPatternGetBool(pResult, + FcResult eEmbeddedBitmap = FcPatternGetBool(pResult, FC_EMBEDDED_BITMAP, 0, &embitmap); - FcResult eAntialias = rWrapper.FcPatternGetBool(pResult, + FcResult eAntialias = FcPatternGetBool(pResult, FC_ANTIALIAS, 0, &antialias); - FcResult eAutoHint = rWrapper.FcPatternGetBool(pResult, + FcResult eAutoHint = FcPatternGetBool(pResult, FC_AUTOHINT, 0, &autohint); - FcResult eHinting = rWrapper.FcPatternGetBool(pResult, + FcResult eHinting = FcPatternGetBool(pResult, FC_HINTING, 0, &hinting); - /*FcResult eHintStyle =*/ rWrapper.FcPatternGetInteger(pResult, + /*FcResult eHintStyle =*/ FcPatternGetInteger(pResult, FC_HINT_STYLE, 0, &hintstyle); pOptions = new FontConfigFontOptions; @@ -1331,20 +949,17 @@ ImplFontOptions* PrintFontManager::getFontOptions( } // cleanup - rWrapper.FcPatternDestroy( pPattern ); + FcPatternDestroy( pPattern ); return pOptions; -#endif } bool PrintFontManager::matchFont( FastPrintFontInfo& rInfo, const com::sun::star::lang::Locale& rLocale ) { FontCfgWrapper& rWrapper = FontCfgWrapper::get(); - if( ! rWrapper.isValid() ) - return false; - FcConfig* pConfig = rWrapper.FcConfigGetCurrent(); - FcPattern* pPattern = rWrapper.FcPatternCreate(); + FcConfig* pConfig = FcConfigGetCurrent(); + FcPattern* pPattern = FcPatternCreate(); OString aLangAttrib; // populate pattern with font characteristics @@ -1360,29 +975,29 @@ bool PrintFontManager::matchFont( FastPrintFontInfo& rInfo, const com::sun::star aLangAttrib = OUStringToOString( aLang.makeStringAndClear(), RTL_TEXTENCODING_UTF8 ); } if( aLangAttrib.getLength() ) - rWrapper.FcPatternAddString( pPattern, FC_LANG, (FcChar8*)aLangAttrib.getStr() ); + FcPatternAddString(pPattern, FC_LANG, (FcChar8*)aLangAttrib.getStr()); OString aFamily = OUStringToOString( rInfo.m_aFamilyName, RTL_TEXTENCODING_UTF8 ); if( aFamily.getLength() ) - rWrapper.FcPatternAddString( pPattern, FC_FAMILY, (FcChar8*)aFamily.getStr() ); + FcPatternAddString(pPattern, FC_FAMILY, (FcChar8*)aFamily.getStr()); - addtopattern(rWrapper, pPattern, rInfo.m_eItalic, rInfo.m_eWeight, rInfo.m_eWidth, rInfo.m_ePitch); + addtopattern(pPattern, rInfo.m_eItalic, rInfo.m_eWeight, rInfo.m_eWidth, rInfo.m_ePitch); - rWrapper.FcConfigSubstitute( pConfig, pPattern, FcMatchPattern ); - rWrapper.FcDefaultSubstitute( pPattern ); + FcConfigSubstitute(pConfig, pPattern, FcMatchPattern); + FcDefaultSubstitute(pPattern); FcResult eResult = FcResultNoMatch; FcFontSet *pFontSet = rWrapper.getFontSet(); - FcPattern* pResult = rWrapper.FcFontSetMatch( pConfig, &pFontSet, 1, pPattern, &eResult ); + FcPattern* pResult = FcFontSetMatch(pConfig, &pFontSet, 1, pPattern, &eResult); bool bSuccess = false; if( pResult ) { - FcFontSet* pSet = rWrapper.FcFontSetCreate(); - rWrapper.FcFontSetAdd( pSet, pResult ); + FcFontSet* pSet = FcFontSetCreate(); + FcFontSetAdd( pSet, pResult ); if( pSet->nfont > 0 ) { //extract the closest match FcChar8* file = NULL; - FcResult eFileRes = rWrapper.FcPatternGetString( pSet->fonts[0], FC_FILE, 0, &file ); + FcResult eFileRes = FcPatternGetString(pSet->fonts[0], FC_FILE, 0, &file); if( eFileRes == FcResultMatch ) { OString aDir, aBase, aOrgPath( (sal_Char*)file ); @@ -1395,52 +1010,13 @@ bool PrintFontManager::matchFont( FastPrintFontInfo& rInfo, const com::sun::star } // info: destroying the pSet destroys pResult implicitly // since pResult was "added" to pSet - rWrapper.FcFontSetDestroy( pSet ); + FcFontSetDestroy( pSet ); } // cleanup - rWrapper.FcPatternDestroy( pPattern ); + FcPatternDestroy( pPattern ); return bSuccess; } -#else // ENABLE_FONTCONFIG not defined - -bool PrintFontManager::initFontconfig() -{ - return false; -} - -int PrintFontManager::countFontconfigFonts( boost::unordered_map<rtl::OString, int, rtl::OStringHash>& ) -{ - return 0; -} - -void PrintFontManager::deinitFontconfig() -{} - -bool PrintFontManager::addFontconfigDir( const rtl::OString& ) -{ - return false; -} - -bool PrintFontManager::matchFont( FastPrintFontInfo&, const com::sun::star::lang::Locale& ) -{ - return false; -} - -int PrintFontManager::FreeTypeCharIndex( void*, sal_uInt32 ) -{ - return 0; -} - -rtl::OUString PrintFontManager::Substitute( const rtl::OUString&, - rtl::OUString&, const rtl::OString&, FontItalic, FontWeight, FontWidth, FontPitch) const -{ - rtl::OUString aName; - return aName; -} - -#endif // ENABLE_FONTCONFIG - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/fontmanager/fontmanager.cxx b/vcl/unx/generic/fontmanager/fontmanager.cxx index 1427daedb193..8936df327aeb 100644 --- a/vcl/unx/generic/fontmanager/fontmanager.cxx +++ b/vcl/unx/generic/fontmanager/fontmanager.cxx @@ -1281,9 +1281,12 @@ int PrintFontManager::addFontFile( const ::rtl::OString& rFileName, int /*nFaceN return nFontId; } -// ------------------------------------------------------------------------- +enum fontFormat +{ + UNKNOWN, TRUETYPE, CFF, TYPE1, AFM +}; -bool PrintFontManager::analyzeFontFile( int nDirID, const OString& rFontFile, const ::std::list<OString>& rXLFDs, ::std::list< PrintFontManager::PrintFont* >& rNewFonts ) const +bool PrintFontManager::analyzeFontFile( int nDirID, const OString& rFontFile, const ::std::list<OString>& rXLFDs, ::std::list< PrintFontManager::PrintFont* >& rNewFonts, const char *pFormat ) const { rNewFonts.clear(); @@ -1297,8 +1300,32 @@ bool PrintFontManager::analyzeFontFile( int nDirID, const OString& rFontFile, co if( access( aFullPath.getStr(), R_OK ) ) return false; - ByteString aExt( rFontFile.copy( rFontFile.lastIndexOf( '.' )+1 ) ); - if( aExt.EqualsIgnoreCaseAscii( "pfb" ) || aExt.EqualsIgnoreCaseAscii( "pfa" ) ) + fontFormat eFormat = UNKNOWN; + if (pFormat) + { + if (!strcmp(pFormat, "TrueType")) + eFormat = TRUETYPE; + else if (!strcmp(pFormat, "CFF")) + eFormat = CFF; + else if (!strcmp(pFormat, "Type 1")) + eFormat = TYPE1; + } + if (eFormat == UNKNOWN) + { + ByteString aExt( rFontFile.copy( rFontFile.lastIndexOf( '.' )+1 ) ); + if( aExt.EqualsIgnoreCaseAscii( "pfb" ) || aExt.EqualsIgnoreCaseAscii( "pfa" ) ) + eFormat = TYPE1; + else if( aExt.EqualsIgnoreCaseAscii( "afm" ) ) + eFormat = AFM; + else if( aExt.EqualsIgnoreCaseAscii( "ttf" ) + || aExt.EqualsIgnoreCaseAscii( "ttc" ) + || aExt.EqualsIgnoreCaseAscii( "tte" ) ) // #i33947# for Gaiji support + eFormat = TRUETYPE; + else if( aExt.EqualsIgnoreCaseAscii( "otf" ) ) // check for TTF- and PS-OpenType too + eFormat = CFF; + } + + if (eFormat == TYPE1) { // check for corresponding afm metric // first look for an adjacent file @@ -1352,7 +1379,7 @@ bool PrintFontManager::analyzeFontFile( int nDirID, const OString& rFontFile, co } } } - else if( aExt.EqualsIgnoreCaseAscii( "afm" ) ) + else if (eFormat == AFM) { ByteString aFilePath( aDir ); aFilePath.Append( '/' ); @@ -1365,34 +1392,14 @@ bool PrintFontManager::analyzeFontFile( int nDirID, const OString& rFontFile, co else delete pFont; } - else if( aExt.EqualsIgnoreCaseAscii( "ttf" ) - || aExt.EqualsIgnoreCaseAscii( "tte" ) // #i33947# for Gaiji support - || aExt.EqualsIgnoreCaseAscii( "otf" ) ) // check for TTF- and PS-OpenType too - { - TrueTypeFontFile* pFont = new TrueTypeFontFile(); - pFont->m_nDirectory = nDirID; - pFont->m_aFontFile = rFontFile; - pFont->m_nCollectionEntry = -1; - - if( rXLFDs.size() ) - getFontAttributesFromXLFD( pFont, rXLFDs ); - // need to read the font anyway to get aliases inside the font file - if( ! analyzeTrueTypeFile( pFont ) ) - { - delete pFont; - pFont = NULL; - } - else - rNewFonts.push_back( pFont ); - } - else if( aExt.EqualsIgnoreCaseAscii( "ttc" ) ) + else if (eFormat == TRUETYPE || eFormat == CFF) { // get number of ttc entries int nLength = CountTTCFonts( aFullPath.getStr() ); if( nLength ) { #if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "%s contains %d fonts\n", aFullPath.getStr(), nLength ); + fprintf( stderr, "ttc: %s contains %d fonts\n", aFullPath.getStr(), nLength ); #endif for( int i = 0; i < nLength; i++ ) { @@ -1411,10 +1418,24 @@ bool PrintFontManager::analyzeFontFile( int nDirID, const OString& rFontFile, co rNewFonts.push_back( pFont ); } } -#if OSL_DEBUG_LEVEL > 1 else - fprintf( stderr, "CountTTCFonts( \"%s/%s\" ) failed\n", getDirectory(nDirID).getStr(), rFontFile.getStr() ); -#endif + { + TrueTypeFontFile* pFont = new TrueTypeFontFile(); + pFont->m_nDirectory = nDirID; + pFont->m_aFontFile = rFontFile; + pFont->m_nCollectionEntry = -1; + + if( rXLFDs.size() ) + getFontAttributesFromXLFD( pFont, rXLFDs ); + // need to read the font anyway to get aliases inside the font file + if( ! analyzeTrueTypeFile( pFont ) ) + { + delete pFont; + pFont = NULL; + } + else + rNewFonts.push_back( pFont ); + } } return ! rNewFonts.empty(); } diff --git a/vcl/unx/generic/gdi/salbmp.cxx b/vcl/unx/generic/gdi/salbmp.cxx index 3349e6ef3c01..22a5d1eddb26 100644 --- a/vcl/unx/generic/gdi/salbmp.cxx +++ b/vcl/unx/generic/gdi/salbmp.cxx @@ -32,6 +32,7 @@ #include <string.h> #include <stdio.h> #include <errno.h> + #ifdef FREEBSD #include <sys/types.h> #endif @@ -69,14 +70,14 @@ SalBitmap* X11SalInstance::CreateSalBitmap() } ImplSalBitmapCache* X11SalBitmap::mpCache = NULL; -sal_uLong X11SalBitmap::mnCacheInstCount = 0; +sal_uLong X11SalBitmap::mnCacheInstCount = 0; // ----------------------------------------------------------------------------- -X11SalBitmap::X11SalBitmap() : - mpDIB( NULL ), - mpDDB( NULL ), - mbGrey( false ) +X11SalBitmap::X11SalBitmap() + : mpDIB( NULL ) + , mpDDB( NULL ) + , mbGrey( false ) { } @@ -115,9 +116,19 @@ void X11SalBitmap::ImplRemovedFromCache() // ----------------------------------------------------------------------------- -BitmapBuffer* X11SalBitmap::ImplCreateDIB( const Size& rSize, sal_uInt16 nBitCount, const BitmapPalette& rPal ) -{ - DBG_ASSERT( nBitCount == 1 || nBitCount == 4 || nBitCount == 8 || nBitCount == 16 || nBitCount == 24, "Unsupported BitCount!" ); +BitmapBuffer* X11SalBitmap::ImplCreateDIB( + const Size& rSize, + sal_uInt16 nBitCount, + const BitmapPalette& rPal +) { + DBG_ASSERT( + nBitCount == 1 + || nBitCount == 4 + || nBitCount == 8 + || nBitCount == 16 + || nBitCount == 24 + , "Unsupported BitCount!" + ); BitmapBuffer* pDIB = NULL; @@ -192,13 +203,16 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB( const Size& rSize, sal_uInt16 nBitCou // ----------------------------------------------------------------------------- -BitmapBuffer* X11SalBitmap::ImplCreateDIB( Drawable aDrawable, - int nScreen, - long nDrawableDepth, - long nX, long nY, - long nWidth, long nHeight, - bool bGrey ) -{ +BitmapBuffer* X11SalBitmap::ImplCreateDIB( + Drawable aDrawable, + int nScreen, + long nDrawableDepth, + long nX, + long nY, + long nWidth, + long nHeight, + bool bGrey +) { BitmapBuffer* pDIB = NULL; if( aDrawable && nWidth && nHeight && nDrawableDepth ) @@ -221,7 +235,7 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB( Drawable aDrawable, { const SalTwoRect aTwoRect = { 0, 0, nWidth, nHeight, 0, 0, nWidth, nHeight }; BitmapBuffer aSrcBuf; - sal_uLong nDstFormat = BMP_FORMAT_BOTTOM_UP; + sal_uLong nDstFormat = BMP_FORMAT_BOTTOM_UP; const BitmapPalette* pDstPal = NULL; aSrcBuf.mnFormat = BMP_FORMAT_TOP_DOWN; @@ -239,14 +253,20 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB( Drawable aDrawable, { case( 1 ): { - aSrcBuf.mnFormat |= ( LSBFirst == pImage->bitmap_bit_order ? BMP_FORMAT_1BIT_LSB_PAL : BMP_FORMAT_1BIT_MSB_PAL ); + aSrcBuf.mnFormat |= ( LSBFirst == pImage->bitmap_bit_order + ? BMP_FORMAT_1BIT_LSB_PAL + : BMP_FORMAT_1BIT_MSB_PAL + ); nDstFormat |= BMP_FORMAT_1BIT_MSB_PAL; } break; case( 4 ): { - aSrcBuf.mnFormat |= ( LSBFirst == pImage->bitmap_bit_order ? BMP_FORMAT_4BIT_LSN_PAL : BMP_FORMAT_4BIT_MSN_PAL ); + aSrcBuf.mnFormat |= ( LSBFirst == pImage->bitmap_bit_order + ? BMP_FORMAT_4BIT_LSN_PAL + : BMP_FORMAT_4BIT_MSN_PAL + ); nDstFormat |= BMP_FORMAT_4BIT_MSN_PAL; } break; @@ -270,7 +290,6 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB( Drawable aDrawable, else { aSrcBuf.mnFormat |= BMP_FORMAT_16BIT_TC_MSB_MASK; - // aSrcBuf.maColorMask = ColorMask( pImage->red_mask ), SWAPSHORT( pImage->green_mask ), SWAPSHORT( pImage->blue_mask ) ); } } break; @@ -289,10 +308,15 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB( Drawable aDrawable, case( 32 ): { if( LSBFirst == pImage->byte_order ) - aSrcBuf.mnFormat |= ( pSalDisp->GetVisual(nScreen).red_mask == 0xFF ? BMP_FORMAT_32BIT_TC_RGBA : BMP_FORMAT_32BIT_TC_BGRA ); + aSrcBuf.mnFormat |= ( pSalDisp->GetVisual(nScreen).red_mask == 0xFF + ? BMP_FORMAT_32BIT_TC_RGBA + : BMP_FORMAT_32BIT_TC_BGRA + ); else - aSrcBuf.mnFormat |= ( pSalDisp->GetVisual(nScreen).red_mask == 0xFF ? BMP_FORMAT_32BIT_TC_ABGR : BMP_FORMAT_32BIT_TC_ARGB ); - + aSrcBuf.mnFormat |= ( pSalDisp->GetVisual(nScreen).red_mask == 0xFF + ? BMP_FORMAT_32BIT_TC_ABGR + : BMP_FORMAT_32BIT_TC_ARGB + ); nDstFormat |= BMP_FORMAT_24BIT_TC_BGR; } break; @@ -326,7 +350,9 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB( Drawable aDrawable, else if( aSrcBuf.mnBitCount <= 8 ) { const SalColormap& rColMap = pSalDisp->GetColormap( nScreen ); - const sal_uInt16 nCols = Min( (sal_uLong)rColMap.GetUsed(), (sal_uLong)(1 << nDrawableDepth) ); + const sal_uInt16 nCols = Min( (sal_uLong)rColMap.GetUsed() + , (sal_uLong)(1 << nDrawableDepth) + ); rPal.SetEntryCount( nCols ); pDstPal = &rPal; @@ -354,7 +380,12 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB( Drawable aDrawable, // ----------------------------------------------------------------------------- -XImage* X11SalBitmap::ImplCreateXImage( SalDisplay *pSalDisp, int nScreen, long nDepth, const SalTwoRect& rTwoRect ) const +XImage* X11SalBitmap::ImplCreateXImage( + SalDisplay *pSalDisp, + int nScreen, + long nDepth, + const SalTwoRect& rTwoRect +) const { XImage* pImage = NULL; @@ -393,11 +424,17 @@ XImage* X11SalBitmap::ImplCreateXImage( SalDisplay *pSalDisp, int nScreen, long switch( pImage->bits_per_pixel ) { case( 1 ): - nDstFormat |= ( LSBFirst == pImage->bitmap_bit_order ? BMP_FORMAT_1BIT_LSB_PAL : BMP_FORMAT_1BIT_MSB_PAL ); + nDstFormat |= ( LSBFirst == pImage->bitmap_bit_order + ? BMP_FORMAT_1BIT_LSB_PAL + : BMP_FORMAT_1BIT_MSB_PAL + ); break; case( 4 ): - nDstFormat |= ( LSBFirst == pImage->bitmap_bit_order ? BMP_FORMAT_4BIT_LSN_PAL : BMP_FORMAT_4BIT_MSN_PAL ); + nDstFormat |= ( LSBFirst == pImage->bitmap_bit_order + ? BMP_FORMAT_4BIT_LSN_PAL + : BMP_FORMAT_4BIT_MSN_PAL + ); break; case( 8 ): @@ -437,9 +474,15 @@ XImage* X11SalBitmap::ImplCreateXImage( SalDisplay *pSalDisp, int nScreen, long case( 32 ): { if( LSBFirst == pImage->byte_order ) - nDstFormat |= ( pImage->red_mask == 0xFF ? BMP_FORMAT_32BIT_TC_RGBA : BMP_FORMAT_32BIT_TC_BGRA ); + nDstFormat |= ( pImage->red_mask == 0xFF + ? BMP_FORMAT_32BIT_TC_RGBA + : BMP_FORMAT_32BIT_TC_BGRA + ); else - nDstFormat |= ( pImage->red_mask == 0xFF ? BMP_FORMAT_32BIT_TC_ABGR : BMP_FORMAT_32BIT_TC_ARGB ); + nDstFormat |= ( pImage->red_mask == 0xFF + ? BMP_FORMAT_32BIT_TC_ABGR + : BMP_FORMAT_32BIT_TC_ARGB + ); } break; } @@ -467,7 +510,9 @@ XImage* X11SalBitmap::ImplCreateXImage( SalDisplay *pSalDisp, int nScreen, long else if( pImage->depth <= 8 ) { const SalColormap& rColMap = pSalDisp->GetColormap( nScreen ); - const sal_uInt16 nCols = Min( (sal_uLong)rColMap.GetUsed(), (sal_uLong)(1 << pImage->depth) ); + const sal_uInt16 nCols = Min( (sal_uLong)rColMap.GetUsed() + , (sal_uLong)(1 << pImage->depth) + ); pPal = new BitmapPalette( nCols ); @@ -506,10 +551,15 @@ XImage* X11SalBitmap::ImplCreateXImage( SalDisplay *pSalDisp, int nScreen, long } // ----------------------------------------------------------------------------- -bool X11SalBitmap::ImplCreateFromDrawable( Drawable aDrawable, - int nScreen, long nDrawableDepth, - long nX, long nY, long nWidth, long nHeight ) -{ +bool X11SalBitmap::ImplCreateFromDrawable( + Drawable aDrawable, + int nScreen, + long nDrawableDepth, + long nX, + long nY, + long nWidth, + long nHeight +) { Destroy(); if( aDrawable && nWidth && nHeight && nDrawableDepth ) @@ -519,8 +569,7 @@ bool X11SalBitmap::ImplCreateFromDrawable( Drawable aDrawable, } // ----------------------------------------------------------------------------- -bool -X11SalBitmap::SnapShot (Display* pDisplay, XLIB_Window hWindow) +bool X11SalBitmap::SnapShot (Display* pDisplay, XLIB_Window hWindow) { if (hWindow != None) { @@ -598,9 +647,12 @@ X11SalBitmap::SnapShot (Display* pDisplay, XLIB_Window hWindow) return False; } -bool -X11SalBitmap::ImplCreateFromXImage (Display* pDisplay, XLIB_Window hWindow, int nScreen, XImage* pImage) -{ +bool X11SalBitmap::ImplCreateFromXImage ( + Display* pDisplay, + XLIB_Window hWindow, + int nScreen, + XImage* pImage +) { Destroy(); if (pImage != NULL && pImage->width != 0 && pImage->height != 0 && pImage->depth != 0) @@ -611,10 +663,12 @@ X11SalBitmap::ImplCreateFromXImage (Display* pDisplay, XLIB_Window hWindow, int return False; } -ImplSalDDB* X11SalBitmap::ImplGetDDB( Drawable aDrawable, - int nScreen, - long nDrawableDepth, - const SalTwoRect& rTwoRect ) const +ImplSalDDB* X11SalBitmap::ImplGetDDB( + Drawable aDrawable, + int nScreen, + long nDrawableDepth, + const SalTwoRect& rTwoRect +) const { if( !mpDDB || !mpDDB->ImplMatches( nScreen, nDrawableDepth, rTwoRect ) ) { @@ -708,11 +762,13 @@ ImplSalDDB* X11SalBitmap::ImplGetDDB( Drawable aDrawable, // ----------------------------------------------------------------------------- -void X11SalBitmap::ImplDraw( Drawable aDrawable, - int nScreen, - long nDrawableDepth, - const SalTwoRect& rTwoRect, - const GC& rGC ) const +void X11SalBitmap::ImplDraw( + Drawable aDrawable, + int nScreen, + long nDrawableDepth, + const SalTwoRect& rTwoRect, + const GC& rGC +) const { ImplGetDDB( aDrawable, nScreen, nDrawableDepth, rTwoRect ); if( mpDDB ) @@ -770,21 +826,26 @@ bool X11SalBitmap::Create( const SalBitmap& rSSalBmp ) bool X11SalBitmap::Create( const SalBitmap&, SalGraphics* ) { - return sal_False; + return false; } // ----------------------------------------------------------------------------- bool X11SalBitmap::Create( const SalBitmap&, sal_uInt16 ) { - return sal_False; + return false; } // ----------------------------------------------------------------------------- -bool X11SalBitmap::Create( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmapCanvas > xBitmapCanvas, Size& rSize, bool bMask ) -{ - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XFastPropertySet > xFastPropertySet( xBitmapCanvas, ::com::sun::star::uno::UNO_QUERY ); +bool X11SalBitmap::Create( + const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmapCanvas > xBitmapCanvas, + Size& rSize, + bool bMask +) { + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XFastPropertySet > + xFastPropertySet( xBitmapCanvas, ::com::sun::star::uno::UNO_QUERY ); + if( xFastPropertySet.get() ) { sal_Int32 depth; ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > args; @@ -794,7 +855,15 @@ bool X11SalBitmap::Create( const ::com::sun::star::uno::Reference< ::com::sun::s if( ( args[1] >>= pixmapHandle ) && ( args[2] >>= depth ) ) { mbGrey = bMask; - bool bSuccess = ImplCreateFromDrawable( pixmapHandle, 0, depth, 0, 0, (long) rSize.Width(), (long) rSize.Height() ); + bool bSuccess = ImplCreateFromDrawable( + pixmapHandle, + 0, + depth, + 0, + 0, + (long) rSize.Width(), + (long) rSize.Height() + ); bool bFreePixmap = false; if( bSuccess && (args[0] >>= bFreePixmap) && bFreePixmap ) XFreePixmap( GetX11SalData()->GetDisplay()->GetDisplay(), pixmapHandle ); @@ -860,10 +929,15 @@ BitmapBuffer* X11SalBitmap::AcquireBuffer( bool ) { if( !mpDIB && mpDDB ) { - mpDIB = ImplCreateDIB( mpDDB->ImplGetPixmap(), - mpDDB->ImplGetScreen(), - mpDDB->ImplGetDepth(), - 0, 0, mpDDB->ImplGetWidth(), mpDDB->ImplGetHeight(), mbGrey ); + mpDIB = ImplCreateDIB( + mpDDB->ImplGetPixmap(), + mpDDB->ImplGetScreen(), + mpDDB->ImplGetDepth(), + 0, 0, + mpDDB->ImplGetWidth(), + mpDDB->ImplGetHeight(), + mbGrey + ); } return mpDIB; @@ -905,11 +979,11 @@ bool X11SalBitmap::GetSystemData( BitmapSystemData& rData ) // - ImplSalDDB - // -------------- -ImplSalDDB::ImplSalDDB( XImage* pImage, Drawable aDrawable, int nScreen, const SalTwoRect& rTwoRect ) : - maPixmap ( 0 ), - maTwoRect ( rTwoRect ), - mnDepth ( pImage->depth ), - mnScreen ( nScreen ) +ImplSalDDB::ImplSalDDB( XImage* pImage, Drawable aDrawable, int nScreen, const SalTwoRect& rTwoRect ) + : maPixmap ( 0 ) + , maTwoRect ( rTwoRect ) + , mnDepth ( pImage->depth ) + , mnScreen ( nScreen ) { SalDisplay* pSalDisp = GetX11SalData()->GetDisplay(); Display* pXDisp = pSalDisp->GetDisplay(); @@ -937,8 +1011,8 @@ ImplSalDDB::ImplSalDDB( XImage* pImage, Drawable aDrawable, int nScreen, const S // ----------------------------------------------------------------------------------------- // create from XImage -ImplSalDDB::ImplSalDDB (Display* pDisplay, XLIB_Window hWindow, int nScreen, XImage* pImage) : - mnScreen( nScreen ) +ImplSalDDB::ImplSalDDB (Display* pDisplay, XLIB_Window hWindow, int nScreen, XImage* pImage) + : mnScreen( nScreen ) { maPixmap = XCreatePixmap (pDisplay, hWindow, pImage->width, pImage->height, pImage->depth); if (maPixmap != 0) @@ -975,9 +1049,16 @@ ImplSalDDB::ImplSalDDB (Display* pDisplay, XLIB_Window hWindow, int nScreen, XIm // ----------------------------------------------------------------------------- -ImplSalDDB::ImplSalDDB( Drawable aDrawable, int nScreen, long nDrawableDepth, long nX, long nY, long nWidth, long nHeight ) : - mnDepth( nDrawableDepth ), - mnScreen( nScreen ) +ImplSalDDB::ImplSalDDB( + Drawable aDrawable, + int nScreen, + long nDrawableDepth, + long nX, + long nY, + long nWidth, + long nHeight +) : mnDepth( nDrawableDepth ) + , mnScreen( nScreen ) { SalDisplay* pSalDisp = GetX11SalData()->GetDisplay(); Display* pXDisp = pSalDisp->GetDisplay(); @@ -1019,24 +1100,32 @@ ImplSalDDB::~ImplSalDDB() bool ImplSalDDB::ImplMatches( int nScreen, long nDepth, const SalTwoRect& rTwoRect ) const { - bool bRet = sal_False; + bool bRet = false; if( ( maPixmap != 0 ) && ( ( mnDepth == nDepth ) || ( 1 == mnDepth ) ) && nScreen == mnScreen) { - if( rTwoRect.mnSrcX == maTwoRect.mnSrcX && rTwoRect.mnSrcY == maTwoRect.mnSrcY && - rTwoRect.mnSrcWidth == maTwoRect.mnSrcWidth && rTwoRect.mnSrcHeight == maTwoRect.mnSrcHeight && - rTwoRect.mnDestWidth == maTwoRect.mnDestWidth && rTwoRect.mnDestHeight == maTwoRect.mnDestHeight ) + if ( rTwoRect.mnSrcX == maTwoRect.mnSrcX + && rTwoRect.mnSrcY == maTwoRect.mnSrcY + && rTwoRect.mnSrcWidth == maTwoRect.mnSrcWidth + && rTwoRect.mnSrcHeight == maTwoRect.mnSrcHeight + && rTwoRect.mnDestWidth == maTwoRect.mnDestWidth + && rTwoRect.mnDestHeight == maTwoRect.mnDestHeight + ) { // absolutely indentically - bRet = sal_True; + bRet = true; } - else if( rTwoRect.mnSrcWidth == rTwoRect.mnDestWidth && rTwoRect.mnSrcHeight == rTwoRect.mnDestHeight && - maTwoRect.mnSrcWidth == maTwoRect.mnDestWidth && maTwoRect.mnSrcHeight == maTwoRect.mnDestHeight && - rTwoRect.mnSrcX >= maTwoRect.mnSrcX && rTwoRect.mnSrcY >= maTwoRect.mnSrcY && - ( rTwoRect.mnSrcX + rTwoRect.mnSrcWidth ) <= ( maTwoRect.mnSrcX + maTwoRect.mnSrcWidth ) && - ( rTwoRect.mnSrcY + rTwoRect.mnSrcHeight ) <= ( maTwoRect.mnSrcY + maTwoRect.mnSrcHeight ) ) + else if( rTwoRect.mnSrcWidth == rTwoRect.mnDestWidth + && rTwoRect.mnSrcHeight == rTwoRect.mnDestHeight + && maTwoRect.mnSrcWidth == maTwoRect.mnDestWidth + && maTwoRect.mnSrcHeight == maTwoRect.mnDestHeight + && rTwoRect.mnSrcX >= maTwoRect.mnSrcX + && rTwoRect.mnSrcY >= maTwoRect.mnSrcY + && ( rTwoRect.mnSrcX + rTwoRect.mnSrcWidth ) <= ( maTwoRect.mnSrcX + maTwoRect.mnSrcWidth ) + && ( rTwoRect.mnSrcY + rTwoRect.mnSrcHeight ) <= ( maTwoRect.mnSrcY + maTwoRect.mnSrcHeight ) + ) { - bRet = sal_True; + bRet = true; } } @@ -1045,7 +1134,12 @@ bool ImplSalDDB::ImplMatches( int nScreen, long nDepth, const SalTwoRect& rTwoRe // ----------------------------------------------------------------------------- -void ImplSalDDB::ImplDraw( Drawable aDrawable, long nDrawableDepth, const SalTwoRect& rTwoRect, const GC& rGC ) const +void ImplSalDDB::ImplDraw( + Drawable aDrawable, + long nDrawableDepth, + const SalTwoRect& rTwoRect, + const GC& rGC +) const { ImplDraw( maPixmap, mnDepth, aDrawable, nDrawableDepth, rTwoRect.mnSrcX - maTwoRect.mnSrcX, rTwoRect.mnSrcY - maTwoRect.mnSrcY, @@ -1055,12 +1149,19 @@ void ImplSalDDB::ImplDraw( Drawable aDrawable, long nDrawableDepth, const SalTwo // ----------------------------------------------------------------------------- -void ImplSalDDB::ImplDraw( Drawable aSrcDrawable, long nSrcDrawableDepth, - Drawable aDstDrawable, long, - long nSrcX, long nSrcY, - long nDestWidth, long nDestHeight, - long nDestX, long nDestY, const GC& rGC ) -{ +void ImplSalDDB::ImplDraw( + Drawable aSrcDrawable, + long nSrcDrawableDepth, + Drawable aDstDrawable, + long, + long nSrcX, + long nSrcY, + long nDestWidth, + long nDestHeight, + long nDestX, + long nDestY, + const GC& rGC +) { SalDisplay* pSalDisp = GetX11SalData()->GetDisplay(); Display* pXDisp = pSalDisp->GetDisplay(); @@ -1108,12 +1209,18 @@ ImplSalBitmapCache::~ImplSalBitmapCache() void ImplSalBitmapCache::ImplAdd( X11SalBitmap* pBmp, sal_uLong nMemSize, sal_uLong nFlags ) { - ImplBmpObj* pObj; - bool bFound = sal_False; - - for( pObj = (ImplBmpObj*) maBmpList.Last(); pObj && !bFound; pObj = (ImplBmpObj*) maBmpList.Prev() ) + ImplBmpObj* pObj = NULL; + bool bFound = false; + + for( + BmpList_impl::iterator it = maBmpList.begin(); + (it != maBmpList.end() ) && !bFound ; + ++it + ) { + pObj = *it; if( pObj->mpBmp == pBmp ) - bFound = sal_True; + bFound = true; + } mnTotalSize += nMemSize; @@ -1123,21 +1230,24 @@ void ImplSalBitmapCache::ImplAdd( X11SalBitmap* pBmp, sal_uLong nMemSize, sal_uL pObj->mnMemSize = nMemSize, pObj->mnFlags = nFlags; } else - maBmpList.Insert( new ImplBmpObj( pBmp, nMemSize, nFlags ), LIST_APPEND ); + maBmpList.push_back( new ImplBmpObj( pBmp, nMemSize, nFlags ) ); } // ----------------------------------------------------------------------------- void ImplSalBitmapCache::ImplRemove( X11SalBitmap* pBmp ) { - for( ImplBmpObj* pObj = (ImplBmpObj*) maBmpList.Last(); pObj; pObj = (ImplBmpObj*) maBmpList.Prev() ) - { - if( pObj->mpBmp == pBmp ) + for( + BmpList_impl::iterator it = maBmpList.begin(); + it != maBmpList.end(); + ++it + ) { + if( (*it)->mpBmp == pBmp ) { - maBmpList.Remove( pObj ); - pObj->mpBmp->ImplRemovedFromCache(); - mnTotalSize -= pObj->mnMemSize; - delete pObj; + (*it)->mpBmp->ImplRemovedFromCache(); + mnTotalSize -= (*it)->mnMemSize; + delete *it; + maBmpList.erase( it ); break; } } @@ -1147,13 +1257,15 @@ void ImplSalBitmapCache::ImplRemove( X11SalBitmap* pBmp ) void ImplSalBitmapCache::ImplClear() { - for( ImplBmpObj* pObj = (ImplBmpObj*) maBmpList.First(); pObj; pObj = (ImplBmpObj*) maBmpList.Next() ) - { - pObj->mpBmp->ImplRemovedFromCache(); - delete pObj; + for( + BmpList_impl::iterator it = maBmpList.begin(); + it != maBmpList.end(); + ++it + ) { + (*it)->mpBmp->ImplRemovedFromCache(); + delete *it; } - - maBmpList.Clear(); + maBmpList.clear(); mnTotalSize = 0; } diff --git a/vcl/unx/generic/gdi/salgdi3.cxx b/vcl/unx/generic/gdi/salgdi3.cxx index dce2e5ccb793..4934ed7f83fa 100644 --- a/vcl/unx/generic/gdi/salgdi3.cxx +++ b/vcl/unx/generic/gdi/salgdi3.cxx @@ -78,28 +78,21 @@ #include "salframe.hxx" #include "outdev.h" - - #ifdef ENABLE_GRAPHITE #include <graphite_layout.hxx> #include <graphite_serverfont.hxx> #endif -struct cairo_surface_t; -struct cairo_t; -struct cairo_font_face_t; -typedef void* FT_Face; -struct cairo_matrix_t { - double xx; double yx; - double xy; double yy; - double x0; double y0; -}; -struct cairo_glyph_t -{ - unsigned long index; - double x; - double y; -}; +#ifdef SYSTEM_CAIRO +#include <cairo.h> +#include <cairo-ft.h> +#include <cairo-xlib-xrender.h> +#else +#include <cairo/cairo.h> +#include <cairo/cairo-ft.h> +#include <cairo/cairo-xlib-xrender.h> +#endif + struct BOX { short x1, x2, y1, y2; @@ -249,179 +242,12 @@ void ImplServerFontEntry::HandleFontOptions( void ) //-------------------------------------------------------------------------- -namespace { - -class CairoWrapper -{ -private: - osl::Module mpCairoLib; - - cairo_surface_t* (*mp_xlib_surface_create_with_xrender_format)(Display *, Drawable , Screen *, XRenderPictFormat *, int , int ); - void (*mp_surface_destroy)(cairo_surface_t *); - cairo_t* (*mp_create)(cairo_surface_t *); - void (*mp_destroy)(cairo_t*); - void (*mp_clip)(cairo_t*); - void (*mp_rectangle)(cairo_t*, double, double, double, double); - cairo_font_face_t * (*mp_ft_font_face_create_for_ft_face)(FT_Face, int); - cairo_font_face_t * (*mp_ft_font_face_create_for_pattern)(void*); - void (*mp_set_font_face)(cairo_t *, cairo_font_face_t *); - void (*mp_font_face_destroy)(cairo_font_face_t *); - void (*mp_matrix_init_identity)(cairo_matrix_t *); - void (*mp_matrix_scale)(cairo_matrix_t *, double, double); - void (*mp_matrix_rotate)(cairo_matrix_t *, double); - void (*mp_set_font_matrix)(cairo_t *, const cairo_matrix_t *); - void (*mp_show_glyphs)(cairo_t *, const cairo_glyph_t *, int ); - void (*mp_set_source_rgb)(cairo_t *, double , double , double ); - void (*mp_set_font_options)(cairo_t *, const void *); - void (*mp_ft_font_options_substitute)(const void*, void*); - - bool canEmbolden() const { return mp_ft_font_face_create_for_pattern != NULL; } - - CairoWrapper(); -public: - static CairoWrapper& get(); - bool isValid() const { return (mpCairoLib != NULL); } - bool isCairoRenderable(const ServerFont& rFont); - - cairo_surface_t* xlib_surface_create_with_xrender_format(Display *pDisplay, Drawable drawable, Screen *pScreen, XRenderPictFormat *pFormat, int width, int height) - { return (*mp_xlib_surface_create_with_xrender_format)(pDisplay, drawable, pScreen, pFormat, width, height); } - void surface_destroy(cairo_surface_t *surface) { (*mp_surface_destroy)(surface); } - cairo_t* create(cairo_surface_t *surface) { return (*mp_create)(surface); } - void destroy(cairo_t *cr) { (*mp_destroy)(cr); } - void clip(cairo_t *cr) { (*mp_clip)(cr); } - void rectangle(cairo_t *cr, double x, double y, double width, double height) - { (*mp_rectangle)(cr, x, y, width, height); } - cairo_font_face_t* ft_font_face_create_for_ft_face(FT_Face face, int load_flags) - { return (*mp_ft_font_face_create_for_ft_face)(face, load_flags); } - cairo_font_face_t* ft_font_face_create_for_pattern(void *pattern) - { - return mp_ft_font_face_create_for_pattern - ? (*mp_ft_font_face_create_for_pattern)(pattern) - : NULL; - } - void set_font_face(cairo_t *cr, cairo_font_face_t *font_face) - { (*mp_set_font_face)(cr, font_face); } - void font_face_destroy(cairo_font_face_t *font_face) - { (*mp_font_face_destroy)(font_face); } - void matrix_init_identity(cairo_matrix_t *matrix) - { (*mp_matrix_init_identity)(matrix); } - void matrix_scale(cairo_matrix_t *matrix, double sx, double sy) - { (*mp_matrix_scale)(matrix, sx, sy); } - void matrix_rotate(cairo_matrix_t *matrix, double radians) - { (*mp_matrix_rotate)(matrix, radians); } - void set_font_matrix(cairo_t *cr, const cairo_matrix_t *matrix) - { (*mp_set_font_matrix)(cr, matrix); } - void show_glyphs(cairo_t *cr, const cairo_glyph_t *glyphs, int no_glyphs) - { (*mp_show_glyphs)(cr, glyphs, no_glyphs); } - void set_source_rgb(cairo_t *cr, double red, double green, double blue) - { (*mp_set_source_rgb)(cr, red, green, blue); } - void set_font_options(cairo_t *cr, const void *options) - { (*mp_set_font_options)(cr, options); } - void ft_font_options_substitute(const void *options, void *pattern) - { (*mp_ft_font_options_substitute)(options, pattern); } -}; - -static CairoWrapper* pCairoInstance = NULL; - -CairoWrapper& CairoWrapper::get() -{ - if( ! pCairoInstance ) - pCairoInstance = new CairoWrapper(); - return *pCairoInstance; -} - -CairoWrapper::CairoWrapper() +namespace { - static const char* pDisableCairoText = getenv( "SAL_DISABLE_CAIROTEXT" ); - if( pDisableCairoText && (pDisableCairoText[0] != '0') ) - return; - - int nDummy; - if( !XQueryExtension( GetX11SalData()->GetDisplay()->GetDisplay(), "RENDER", &nDummy, &nDummy, &nDummy ) ) - return; - - OUString aLibName( RTL_CONSTASCII_USTRINGPARAM( "libcairo.so.2" )); - if ( !mpCairoLib.load( aLibName, SAL_LOADMODULE_DEFAULT ) ) - return; - -#ifdef DEBUG - // check cairo version - int (*p_version)(); - p_version = (int(*)()) osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_version" ); - const int nVersion = p_version ? (*p_version)() : 0; - fprintf( stderr, "CAIRO version=%d\n", nVersion ); -#endif - - mp_xlib_surface_create_with_xrender_format = (cairo_surface_t* (*)(Display *, Drawable , Screen *, XRenderPictFormat *, int , int )) - osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_xlib_surface_create_with_xrender_format" ); - mp_surface_destroy = (void(*)(cairo_surface_t*)) - osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_surface_destroy" ); - mp_create = (cairo_t*(*)(cairo_surface_t*)) - osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_create" ); - mp_destroy = (void(*)(cairo_t*)) - osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_destroy" ); - mp_clip = (void(*)(cairo_t*)) - osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_clip" ); - mp_rectangle = (void(*)(cairo_t*, double, double, double, double)) - osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_rectangle" ); - mp_ft_font_face_create_for_ft_face = (cairo_font_face_t * (*)(FT_Face, int)) - osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_ft_font_face_create_for_ft_face" ); - mp_ft_font_face_create_for_pattern = (cairo_font_face_t * (*)(void*)) - osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_ft_font_face_create_for_pattern" ); - mp_set_font_face = (void (*)(cairo_t *, cairo_font_face_t *)) - osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_set_font_face" ); - mp_font_face_destroy = (void (*)(cairo_font_face_t *)) - osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_font_face_destroy" ); - mp_matrix_init_identity = (void (*)(cairo_matrix_t *)) - osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_matrix_init_identity" ); - mp_matrix_scale = (void (*)(cairo_matrix_t *, double, double)) - osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_matrix_scale" ); - mp_matrix_rotate = (void (*)(cairo_matrix_t *, double)) - osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_matrix_rotate" ); - mp_set_font_matrix = (void (*)(cairo_t *, const cairo_matrix_t *)) - osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_set_font_matrix" ); - mp_show_glyphs = (void (*)(cairo_t *, const cairo_glyph_t *, int )) - osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_show_glyphs" ); - mp_set_source_rgb = (void (*)(cairo_t *, double , double , double )) - osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_set_source_rgb" ); - mp_set_font_options = (void (*)(cairo_t *, const void *options )) - osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_set_font_options" ); - mp_ft_font_options_substitute = (void (*)(const void *, void *)) - osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_ft_font_options_substitute" ); - - if( !( - mp_xlib_surface_create_with_xrender_format && - mp_surface_destroy && - mp_create && - mp_destroy && - mp_clip && - mp_rectangle && - mp_ft_font_face_create_for_ft_face && - mp_set_font_face && - mp_font_face_destroy && - mp_matrix_init_identity && - mp_matrix_scale && - mp_matrix_rotate && - mp_set_font_matrix && - mp_show_glyphs && - mp_set_source_rgb && - mp_set_font_options && - mp_ft_font_options_substitute - ) ) + bool isCairoRenderable(const ServerFont& rFont) { - mpCairoLib.unload(); -#if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "not all needed symbols were found\n" ); -#endif + return rFont.GetFtFace(); } -} - -bool CairoWrapper::isCairoRenderable(const ServerFont& rFont) -{ - return rFont.GetFtFace() && isValid() && rFont.GetAntialiasAdvice() && - (rFont.NeedsArtificialBold() ? canEmbolden() : true); -} - } //namespace CairoFontsCache::LRUFonts CairoFontsCache::maLRUFonts; @@ -437,10 +263,9 @@ CairoFontsCache::~CairoFontsCache() --mnRefCount; if (!mnRefCount && !maLRUFonts.empty()) { - CairoWrapper &rCairo = CairoWrapper::get(); LRUFonts::iterator aEnd = maLRUFonts.end(); for (LRUFonts::iterator aI = maLRUFonts.begin(); aI != aEnd; ++aI) - rCairo.font_face_destroy((cairo_font_face_t*)aI->first); + cairo_font_face_destroy((cairo_font_face_t*)aI->first); } } @@ -449,8 +274,7 @@ void CairoFontsCache::CacheFont(void *pFont, const CairoFontsCache::CacheId &rId maLRUFonts.push_front( std::pair<void*, CairoFontsCache::CacheId>(pFont, rId) ); if (maLRUFonts.size() > 8) { - CairoWrapper &rCairo = CairoWrapper::get(); - rCairo.font_face_destroy((cairo_font_face_t*)maLRUFonts.back().first); + cairo_font_face_destroy((cairo_font_face_t*)maLRUFonts.back().first); maLRUFonts.pop_back(); } } @@ -464,9 +288,18 @@ void* CairoFontsCache::FindCachedFont(const CairoFontsCache::CacheId &rId) return NULL; } +namespace +{ + bool hasRotation(int nRotation) + { + return nRotation != 0; + } +} + void X11SalGraphics::DrawCairoAAFontString( const ServerFontLayout& rLayout ) { std::vector<cairo_glyph_t> cairo_glyphs; + std::vector<int> glyph_extrarotation; cairo_glyphs.reserve( 256 ); Point aPos; @@ -478,6 +311,19 @@ void X11SalGraphics::DrawCairoAAFontString( const ServerFontLayout& rLayout ) aGlyph.x = aPos.X(); aGlyph.y = aPos.Y(); cairo_glyphs.push_back(aGlyph); + + switch (aGlyphId & GF_ROTMASK) + { + case GF_ROTL: // left + glyph_extrarotation.push_back(900); + break; + case GF_ROTR: // right + glyph_extrarotation.push_back(-900); + break; + default: + glyph_extrarotation.push_back(0); + break; + } } if (cairo_glyphs.empty()) @@ -489,11 +335,9 @@ void X11SalGraphics::DrawCairoAAFontString( const ServerFontLayout& rLayout ) if( !pVisualFormat ) return; - CairoWrapper &rCairo = CairoWrapper::get(); - Display* pDisplay = GetXDisplay(); - cairo_surface_t *surface = rCairo.xlib_surface_create_with_xrender_format (pDisplay, + cairo_surface_t *surface = cairo_xlib_surface_create_with_xrender_format (pDisplay, hDrawable_, ScreenOfDisplay(pDisplay, m_nScreen), pVisualFormat, SAL_MAX_INT16, SAL_MAX_INT16); /* @@ -502,26 +346,26 @@ void X11SalGraphics::DrawCairoAAFontString( const ServerFontLayout& rLayout ) * least change the SalFrame etc impls to dtor the SalGraphics *before* the * destruction of the windows they reference */ - cairo_t *cr = rCairo.create(surface); - rCairo.surface_destroy(surface); + cairo_t *cr = cairo_create(surface); + cairo_surface_destroy(surface); if (const void *pOptions = Application::GetSettings().GetStyleSettings().GetCairoFontOptions()) - rCairo.set_font_options( cr, pOptions); + cairo_set_font_options(cr, static_cast<const cairo_font_options_t*>(pOptions)); if( mpClipRegion && !XEmptyRegion( mpClipRegion ) ) { for (long i = 0; i < mpClipRegion->numRects; ++i) { - rCairo.rectangle(cr, - mpClipRegion->rects[i].x1, - mpClipRegion->rects[i].y1, - mpClipRegion->rects[i].x2 - mpClipRegion->rects[i].x1, - mpClipRegion->rects[i].y2 - mpClipRegion->rects[i].y1); + cairo_rectangle(cr, + mpClipRegion->rects[i].x1, + mpClipRegion->rects[i].y1, + mpClipRegion->rects[i].x2 - mpClipRegion->rects[i].x1, + mpClipRegion->rects[i].y2 - mpClipRegion->rects[i].y1); } - rCairo.clip(cr); + cairo_clip(cr); } - rCairo.set_source_rgb(cr, + cairo_set_source_rgb(cr, SALCOLOR_RED(nTextColor_)/255.0, SALCOLOR_GREEN(nTextColor_)/255.0, SALCOLOR_BLUE(nTextColor_)/255.0); @@ -541,30 +385,67 @@ void X11SalGraphics::DrawCairoAAFontString( const ServerFontLayout& rLayout ) const ImplFontOptions *pOptions = rFont.GetFontOptions().get(); void *pPattern = pOptions ? pOptions->GetPattern(pFace, aId.mbEmbolden) : NULL; if (pPattern) - font_face = rCairo.ft_font_face_create_for_pattern(pPattern); + font_face = cairo_ft_font_face_create_for_pattern(reinterpret_cast<FcPattern*>(pPattern)); if (!font_face) - font_face = rCairo.ft_font_face_create_for_ft_face(pFace, rFont.GetLoadFlags()); + font_face = cairo_ft_font_face_create_for_ft_face(reinterpret_cast<FT_Face>(pFace), rFont.GetLoadFlags()); m_aCairoFontsCache.CacheFont(font_face, aId); } - rCairo.set_font_face(cr, font_face); + cairo_set_font_face(cr, font_face); cairo_matrix_t m; const ImplFontSelectData& rFSD = rFont.GetFontSelData(); - int nWidth = rFSD.mnWidth ? rFSD.mnWidth : rFSD.mnHeight; + int nHeight = rFSD.mnHeight; + int nWidth = rFSD.mnWidth ? rFSD.mnWidth : nHeight; + + std::vector<int>::const_iterator aEnd = glyph_extrarotation.end(); + std::vector<int>::const_iterator aStart = glyph_extrarotation.begin(); + std::vector<int>::const_iterator aI = aStart; + while (aI != aEnd) + { + int nGlyphRotation = *aI; + + std::vector<int>::const_iterator aNext = std::find_if(aI+1, aEnd, hasRotation); + + cairo_matrix_init_identity(&m); + + if (rFont.NeedsArtificialItalic()) + m.xy = -m.xx * 0x6000L / 0x10000L; + + if (rLayout.GetOrientation()) + cairo_matrix_rotate(&m, (3600 - rLayout.GetOrientation()) * M_PI / 1800.0); - rCairo.matrix_init_identity(&m); + cairo_matrix_scale(&m, nWidth, nHeight); - if (rLayout.GetOrientation()) - rCairo.matrix_rotate(&m, (3600 - rLayout.GetOrientation()) * M_PI / 1800.0); + if (nGlyphRotation) + { + cairo_matrix_rotate(&m, (3600 - nGlyphRotation) * M_PI / 1800.0); + + cairo_font_extents_t extents; + cairo_font_extents(cr, &extents); + //gives the same positions as pre-cairo conversion, but I don't like them + double xdiff = -extents.descent/(extents.height+extents.descent); + cairo_matrix_translate(&m, xdiff, 1); + } - rCairo.matrix_scale(&m, nWidth, rFSD.mnHeight); - if (rFont.NeedsArtificialItalic()) - m.xy = -m.xx * 0x6000L / 0x10000L; + cairo_set_font_matrix(cr, &m); + size_t nStartIndex = std::distance(aStart, aI); + size_t nLen = std::distance(aI, aNext); + cairo_show_glyphs(cr, &cairo_glyphs[nStartIndex], nLen); + +#if OSL_DEBUG_LEVEL > 2 + //draw origin + cairo_save (cr); + cairo_rectangle (cr, cairo_glyphs[nStartIndex].x, cairo_glyphs[nStartIndex].y, 5, 5); + cairo_set_source_rgba (cr, 1, 0, 0, 0.80); + cairo_fill (cr); + cairo_restore (cr); +#endif - rCairo.set_font_matrix(cr, &m); - rCairo.show_glyphs(cr, &cairo_glyphs[0], cairo_glyphs.size()); - rCairo.destroy(cr); + aI = aNext; + } + + cairo_destroy(cr); } //-------------------------------------------------------------------------- @@ -924,7 +805,7 @@ void X11SalGraphics::DrawServerFontLayout( const ServerFontLayout& rLayout ) ServerFont& rFont = rLayout.GetServerFont(); const bool bVertical = rFont.GetFontSelData().mbVertical; - if( !bVertical && CairoWrapper::get().isCairoRenderable(rFont) ) + if( !bVertical && isCairoRenderable(rFont) ) DrawCairoAAFontString( rLayout ); else { @@ -1083,16 +964,14 @@ void X11SalGraphics::GetDevFontSubstList( OutputDevice* ) // ---------------------------------------------------------------------------- -void cairosubcallback( void* pPattern ) +void cairosubcallback(void* pPattern) { - CairoWrapper& rCairo = CairoWrapper::get(); - if( !rCairo.isValid() ) - return; const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); const void* pFontOptions = rStyleSettings.GetCairoFontOptions(); if( !pFontOptions ) return; - rCairo.ft_font_options_substitute( pFontOptions, pPattern ); + cairo_ft_font_options_substitute(static_cast<const cairo_font_options_t*>(pFontOptions), + static_cast<FcPattern*>(pPattern)); } ImplFontOptions* GetFCFontOptions( const ImplFontAttributes& rFontAttributes, int nSize) diff --git a/vcl/unx/generic/gdi/salprnpsp.cxx b/vcl/unx/generic/gdi/salprnpsp.cxx index 009621a9e22e..dbee65c589dc 100644 --- a/vcl/unx/generic/gdi/salprnpsp.cxx +++ b/vcl/unx/generic/gdi/salprnpsp.cxx @@ -271,11 +271,16 @@ static bool passFileToCommandLine( const String& rFilename, const String& rComma close( fd[0] ); char aBuffer[ 2048 ]; FILE* fp = fopen( aFilename.GetBuffer(), "r" ); - while( fp && ! feof( fp ) ) + while (fp && !feof(fp)) { - int nBytes = fread( aBuffer, 1, sizeof( aBuffer ), fp ); - if( nBytes ) - write( fd[ 1 ], aBuffer, nBytes ); + size_t nBytesRead = fread(aBuffer, 1, sizeof( aBuffer ), fp); + if (nBytesRead ) + { + size_t nBytesWritten = write(fd[1], aBuffer, nBytesRead); + OSL_ENSURE(nBytesWritten == nBytesRead, "short write"); + if (nBytesWritten != nBytesRead) + break; + } } fclose( fp ); close( fd[ 1 ] ); @@ -1342,7 +1347,12 @@ sal_Bool PspSalPrinter::StartJob( const String* i_pFileName, const String& i_rJo { osl_readFile( pFile, &buffer[0], buffer.size(), &nBytesRead ); if( nBytesRead > 0 ) - fwrite( &buffer[0], 1, nBytesRead, fp ); + { + size_t nBytesWritten = fwrite(&buffer[0], 1, nBytesRead, fp); + OSL_ENSURE(nBytesRead == nBytesWritten, "short write"); + if (nBytesRead != nBytesWritten) + break; + } } while( nBytesRead == buffer.size() ); rtl::OUStringBuffer aBuf( i_rJobName.Len() + 8 ); aBuf.append( i_rJobName ); diff --git a/vcl/unx/generic/plugadapt/salplug.cxx b/vcl/unx/generic/plugadapt/salplug.cxx index 3235aa9a58fa..8cadab79b0a7 100644 --- a/vcl/unx/generic/plugadapt/salplug.cxx +++ b/vcl/unx/generic/plugadapt/salplug.cxx @@ -272,7 +272,7 @@ void SalAbort( const XubString& rErrorText ) if( !rErrorText.Len() ) std::fprintf( stderr, "Application Error\n" ); else - std::fprintf( stderr, "%s\n", ByteString( rErrorText, gsl_getSystemTextEncoding() ).GetBuffer() ); + std::fprintf( stderr, "%s\n", rtl::OUStringToOString(rErrorText, gsl_getSystemTextEncoding()).getStr() ); exit(-1); } diff --git a/vcl/unx/generic/printer/cupsmgr.cxx b/vcl/unx/generic/printer/cupsmgr.cxx index a850ec14bb28..1e8c378c8166 100644 --- a/vcl/unx/generic/printer/cupsmgr.cxx +++ b/vcl/unx/generic/printer/cupsmgr.cxx @@ -436,7 +436,7 @@ extern "C" { static void lcl_signal_action(int nSignal) { - fprintf( stderr, "Signal %d during fontconfig initialization called, ignoring fontconfig\n", nSignal ); + fprintf( stderr, "Signal %d during cups initialization called, ignoring cups\n", nSignal ); siglongjmp( aViolationBuffer, 1 ); } } diff --git a/vcl/unx/generic/printer/jobdata.cxx b/vcl/unx/generic/printer/jobdata.cxx index 03d676470ecb..872e880adc61 100644 --- a/vcl/unx/generic/printer/jobdata.cxx +++ b/vcl/unx/generic/printer/jobdata.cxx @@ -34,7 +34,8 @@ #include "tools/stream.hxx" -#include "sal/alloca.h" +#include <sal/alloca.h> +#include <rtl/strbuf.hxx> using namespace psp; @@ -122,48 +123,52 @@ bool JobData::getStreamBuffer( void*& pData, int& bytes ) return false; SvMemoryStream aStream; - ByteString aLine; // write header job data aStream.WriteLine( "JobData 1" ); - aLine = "printer="; - aLine += ByteString( String( m_aPrinterName ), RTL_TEXTENCODING_UTF8 ); - aStream.WriteLine( aLine ); + rtl::OStringBuffer aLine; + + aLine.append(RTL_CONSTASCII_STRINGPARAM("printer=")); + aLine.append(rtl::OUStringToOString(m_aPrinterName, RTL_TEXTENCODING_UTF8)); + aStream.WriteLine(aLine.makeStringAndClear()); - aLine = "orientation="; - aLine += m_eOrientation == orientation::Landscape ? "Landscape" : "Portrait"; - aStream.WriteLine( aLine ); + aLine.append(RTL_CONSTASCII_STRINGPARAM("orientation=")); + if (m_eOrientation == orientation::Landscape) + aLine.append(RTL_CONSTASCII_STRINGPARAM("Landscape")); + else + aLine.append(RTL_CONSTASCII_STRINGPARAM("Portrait")); + aStream.WriteLine(aLine.makeStringAndClear()); - aLine = "copies="; - aLine += ByteString::CreateFromInt32( m_nCopies ); - aStream.WriteLine( aLine ); + aLine.append(RTL_CONSTASCII_STRINGPARAM("copies=")); + aLine.append(static_cast<sal_Int32>(m_nCopies)); + aStream.WriteLine(aLine.makeStringAndClear()); - aLine = "margindajustment="; - aLine += ByteString::CreateFromInt32( m_nLeftMarginAdjust ); - aLine += ','; - aLine += ByteString::CreateFromInt32( m_nRightMarginAdjust ); - aLine += ','; - aLine += ByteString::CreateFromInt32( m_nTopMarginAdjust ); - aLine += ','; - aLine += ByteString::CreateFromInt32( m_nBottomMarginAdjust ); - aStream.WriteLine( aLine ); + aLine.append(RTL_CONSTASCII_STRINGPARAM("margindajustment=")); + aLine.append(static_cast<sal_Int32>(m_nLeftMarginAdjust)); + aLine.append(','); + aLine.append(static_cast<sal_Int32>(m_nRightMarginAdjust)); + aLine.append(','); + aLine.append(static_cast<sal_Int32>(m_nTopMarginAdjust)); + aLine.append(','); + aLine.append(static_cast<sal_Int32>(m_nBottomMarginAdjust)); + aStream.WriteLine(aLine.makeStringAndClear()); - aLine = "colordepth="; - aLine += ByteString::CreateFromInt32( m_nColorDepth ); - aStream.WriteLine( aLine ); + aLine.append(RTL_CONSTASCII_STRINGPARAM("colordepth=")); + aLine.append(static_cast<sal_Int32>(m_nColorDepth)); + aStream.WriteLine(aLine.makeStringAndClear()); - aLine = "pslevel="; - aLine += ByteString::CreateFromInt32( m_nPSLevel ); - aStream.WriteLine( aLine ); + aLine.append(RTL_CONSTASCII_STRINGPARAM("pslevel=")); + aLine.append(static_cast<sal_Int32>(m_nPSLevel)); + aStream.WriteLine(aLine.makeStringAndClear()); - aLine = "pdfdevice="; - aLine += ByteString::CreateFromInt32( m_nPDFDevice ); - aStream.WriteLine( aLine ); + aLine.append(RTL_CONSTASCII_STRINGPARAM("pdfdevice=")); + aLine.append(static_cast<sal_Int32>(m_nPDFDevice)); + aStream.WriteLine(aLine.makeStringAndClear()); - aLine = "colordevice="; - aLine += ByteString::CreateFromInt32( m_nColorDevice ); - aStream.WriteLine( aLine ); + aLine.append(RTL_CONSTASCII_STRINGPARAM("colordevice=")); + aLine.append(static_cast<sal_Int32>(m_nColorDevice)); + aStream.WriteLine(aLine.makeStringAndClear()); // now append the PPDContext stream buffer aStream.WriteLine( "PPDContexData" ); diff --git a/vcl/unx/generic/printer/ppdparser.cxx b/vcl/unx/generic/printer/ppdparser.cxx index 3246e18fc806..91643d6646b2 100644 --- a/vcl/unx/generic/printer/ppdparser.cxx +++ b/vcl/unx/generic/printer/ppdparser.cxx @@ -696,7 +696,7 @@ PPDParser::PPDParser( const String& rFile ) : m_pTranslator( new PPDTranslator() ) { // read in the file - std::list< ByteString > aLines; + std::list< rtl::OString > aLines; PPDDecompressStream aStream( m_aFile ); bool bLanguageEncoding = false; if( aStream.IsOpen() ) @@ -897,11 +897,11 @@ static sal_uInt8 getNibble( sal_Char cChar ) return nRet; } -String PPDParser::handleTranslation( const ByteString& i_rString, bool bIsGlobalized ) +String PPDParser::handleTranslation(const rtl::OString& i_rString, bool bIsGlobalized) { - int nOrigLen = i_rString.Len(); + sal_Int32 nOrigLen = i_rString.getLength(); OStringBuffer aTrans( nOrigLen ); - const sal_Char* pStr = i_rString.GetBuffer(); + const sal_Char* pStr = i_rString.getStr(); const sal_Char* pEnd = pStr + nOrigLen; while( pStr < pEnd ) { @@ -923,9 +923,9 @@ String PPDParser::handleTranslation( const ByteString& i_rString, bool bIsGlobal return OStringToOUString( aTrans.makeStringAndClear(), bIsGlobalized ? RTL_TEXTENCODING_UTF8 : m_aFileEncoding ); } -void PPDParser::parse( ::std::list< ByteString >& rLines ) +void PPDParser::parse( ::std::list< rtl::OString >& rLines ) { - std::list< ByteString >::iterator line = rLines.begin(); + std::list< rtl::OString >::iterator line = rLines.begin(); PPDParser::hash_type::const_iterator keyit; while( line != rLines.end() ) { @@ -1027,7 +1027,7 @@ void PPDParser::parse( ::std::list< ByteString >& rLines ) { // copy the newlines also aLine += '\n'; - aLine += *line; + aLine += ByteString(*line); ++line; } } @@ -1142,7 +1142,9 @@ void PPDParser::parse( ::std::list< ByteString >& rLines ) if( nPos != STRING_NOTFOUND ) { aKey.Erase( nPos ); - String aOption( WhitespaceToSpace( aLine.Copy( nPos+9 ) ), RTL_TEXTENCODING_MS_1252 ); + rtl::OUString aOption(rtl::OStringToOUString( + WhitespaceToSpace(aLine.Copy(nPos+9)), + RTL_TEXTENCODING_MS_1252)); keyit = m_aKeys.find( aKey ); if( keyit != m_aKeys.end() ) { @@ -1171,7 +1173,7 @@ void PPDParser::parse( ::std::list< ByteString >& rLines ) } } -void PPDParser::parseOpenUI( const ByteString& rLine ) +void PPDParser::parseOpenUI(const rtl::OString& rLine) { String aTranslation; ByteString aKey = rLine; @@ -1202,7 +1204,8 @@ void PPDParser::parseOpenUI( const ByteString& rLine ) pKey->m_bUIOption = true; m_pTranslator->insertKey( pKey->getKey(), aTranslation ); - ByteString aValue = WhitespaceToSpace( rLine.GetToken( 1, ':' ) ); + sal_Int32 nIndex = 0; + ByteString aValue = WhitespaceToSpace( rLine.getToken( 1, ':', nIndex ) ); if( aValue.CompareIgnoreCaseToAscii( "boolean" ) == COMPARE_EQUAL ) pKey->m_eUIType = PPDKey::Boolean; else if( aValue.CompareIgnoreCaseToAscii( "pickmany" ) == COMPARE_EQUAL ) @@ -1211,16 +1214,16 @@ void PPDParser::parseOpenUI( const ByteString& rLine ) pKey->m_eUIType = PPDKey::PickOne; } -void PPDParser::parseOrderDependency( const ByteString& rLine ) +void PPDParser::parseOrderDependency(const rtl::OString& rLine) { - ByteString aLine( rLine ); - int nPos = aLine.Search( ':' ); - if( nPos != STRING_NOTFOUND ) - aLine.Erase( 0, nPos+1 ); + rtl::OString aLine(rLine); + sal_Int32 nPos = aLine.indexOf(':'); + if( nPos != -1 ) + aLine = aLine.copy( nPos+1 ); - int nOrder = GetCommandLineToken( 0, aLine ).ToInt32(); + sal_Int32 nOrder = GetCommandLineToken( 0, aLine ).toInt32(); ByteString aSetup = GetCommandLineToken( 1, aLine ); - String aKey( GetCommandLineToken( 2, aLine ), RTL_TEXTENCODING_MS_1252 ); + String aKey(rtl::OStringToOUString(GetCommandLineToken(2, aLine), RTL_TEXTENCODING_MS_1252)); if( aKey.GetChar( 0 ) != '*' ) return; // invalid order depency aKey.Erase( 0, 1 ); @@ -1250,12 +1253,12 @@ void PPDParser::parseOrderDependency( const ByteString& rLine ) pKey->m_eSetupType = PPDKey::AnySetup; } -void PPDParser::parseConstraint( const ByteString& rLine ) +void PPDParser::parseConstraint( const rtl::OString& rLine ) { bool bFailed = false; - String aLine( rLine, RTL_TEXTENCODING_MS_1252 ); - aLine.Erase( 0, rLine.Search( ':' )+1 ); + String aLine(rtl::OStringToOUString(rLine, RTL_TEXTENCODING_MS_1252)); + aLine.Erase(0, rLine.indexOf(':') + 1); PPDConstraint aConstraint; int nTokens = GetCommandLineTokenCount( aLine ); for( int i = 0; i < nTokens; i++ ) @@ -1291,7 +1294,7 @@ void PPDParser::parseConstraint( const ByteString& rLine ) if( ! aConstraint.m_pKey1 || ! aConstraint.m_pKey2 || bFailed ) { #ifdef __DEBUG - fprintf( stderr, "Warning: constraint \"%s\" is invalid\n", rLine.GetStr() ); + fprintf( stderr, "Warning: constraint \"%s\" is invalid\n", rLine.getStr() ); #endif } else diff --git a/vcl/unx/generic/printer/printerinfomanager.cxx b/vcl/unx/generic/printer/printerinfomanager.cxx index e29855c939d1..144821173962 100644 --- a/vcl/unx/generic/printer/printerinfomanager.cxx +++ b/vcl/unx/generic/printer/printerinfomanager.cxx @@ -772,30 +772,30 @@ bool PrinterInfoManager::writePrinterConfig() pConfig->DeleteGroup( it->second.m_aGroup ); // else some old keys may remain pConfig->SetGroup( it->second.m_aGroup ); - ByteString aValue( String( it->second.m_aInfo.m_aDriverName ), RTL_TEXTENCODING_UTF8 ); - aValue += '/'; - aValue += ByteString( String( it->first ), RTL_TEXTENCODING_UTF8 ); - pConfig->WriteKey( "Printer", aValue ); + rtl::OStringBuffer aValue(rtl::OUStringToOString(it->second.m_aInfo.m_aDriverName, RTL_TEXTENCODING_UTF8)); + aValue.append('/'); + aValue.append(rtl::OUStringToOString(it->first, RTL_TEXTENCODING_UTF8)); + pConfig->WriteKey("Printer", aValue.makeStringAndClear()); pConfig->WriteKey( "DefaultPrinter", it->first == m_aDefaultPrinter ? "1" : "0" ); pConfig->WriteKey( "Location", ByteString( String( it->second.m_aInfo.m_aLocation ), RTL_TEXTENCODING_UTF8 ) ); pConfig->WriteKey( "Comment", ByteString( String( it->second.m_aInfo.m_aComment ), RTL_TEXTENCODING_UTF8 ) ); pConfig->WriteKey( "Command", ByteString( String( it->second.m_aInfo.m_aCommand ), RTL_TEXTENCODING_UTF8 ) ); pConfig->WriteKey( "QuickCommand", ByteString( String( it->second.m_aInfo.m_aQuickCommand ), RTL_TEXTENCODING_UTF8 ) ); pConfig->WriteKey( "Features", ByteString( String( it->second.m_aInfo.m_aFeatures ), RTL_TEXTENCODING_UTF8 ) ); - pConfig->WriteKey( "Copies", ByteString::CreateFromInt32( it->second.m_aInfo.m_nCopies ) ); + pConfig->WriteKey("Copies", rtl::OString::valueOf(static_cast<sal_Int32>(it->second.m_aInfo.m_nCopies))); pConfig->WriteKey( "Orientation", it->second.m_aInfo.m_eOrientation == orientation::Landscape ? "Landscape" : "Portrait" ); - pConfig->WriteKey( "PSLevel", ByteString::CreateFromInt32( it->second.m_aInfo.m_nPSLevel ) ); - pConfig->WriteKey( "PDFDevice", ByteString::CreateFromInt32( it->second.m_aInfo.m_nPDFDevice ) ); - pConfig->WriteKey( "ColorDevice", ByteString::CreateFromInt32( it->second.m_aInfo.m_nColorDevice ) ); - pConfig->WriteKey( "ColorDepth", ByteString::CreateFromInt32( it->second.m_aInfo.m_nColorDepth ) ); - aValue = ByteString::CreateFromInt32( it->second.m_aInfo.m_nLeftMarginAdjust ); - aValue += ','; - aValue += ByteString::CreateFromInt32( it->second.m_aInfo.m_nRightMarginAdjust ); - aValue += ','; - aValue += ByteString::CreateFromInt32( it->second.m_aInfo.m_nTopMarginAdjust ); - aValue += ','; - aValue += ByteString::CreateFromInt32( it->second.m_aInfo.m_nBottomMarginAdjust ); - pConfig->WriteKey( "MarginAdjust", aValue ); + pConfig->WriteKey("PSLevel", rtl::OString::valueOf(static_cast<sal_Int32>(it->second.m_aInfo.m_nPSLevel))); + pConfig->WriteKey("PDFDevice", rtl::OString::valueOf(static_cast<sal_Int32>(it->second.m_aInfo.m_nPDFDevice))); + pConfig->WriteKey("ColorDevice", rtl::OString::valueOf(static_cast<sal_Int32>(it->second.m_aInfo.m_nColorDevice))); + pConfig->WriteKey("ColorDepth", rtl::OString::valueOf(static_cast<sal_Int32>(it->second.m_aInfo.m_nColorDepth))); + aValue.append(static_cast<sal_Int32>(it->second.m_aInfo.m_nLeftMarginAdjust)); + aValue.append(','); + aValue.append(static_cast<sal_Int32>(it->second.m_aInfo.m_nRightMarginAdjust)); + aValue.append(','); + aValue.append(static_cast<sal_Int32>(it->second.m_aInfo.m_nTopMarginAdjust)); + aValue.append(','); + aValue.append(static_cast<sal_Int32>(it->second.m_aInfo.m_nBottomMarginAdjust)); + pConfig->WriteKey("MarginAdjust", aValue.makeStringAndClear()); if( it->second.m_aInfo.m_aDriverName.compareToAscii( "CUPS:", 5 ) != 0 ) { @@ -807,8 +807,11 @@ bool PrinterInfoManager::writePrinterConfig() aKey += ByteString( pKey->getKey(), RTL_TEXTENCODING_ISO_8859_1 ); const PPDValue* pValue = it->second.m_aInfo.m_aContext.getValue( pKey ); - aValue = pValue ? ByteString( pValue->m_aOption, RTL_TEXTENCODING_ISO_8859_1 ) : ByteString( "*nil" ); - pConfig->WriteKey( aKey, aValue ); + if (pValue) + aValue.append(rtl::OUStringToOString(pValue->m_aOption, RTL_TEXTENCODING_ISO_8859_1)); + else + aValue.append(RTL_CONSTASCII_STRINGPARAM("*nil")); + pConfig->WriteKey(aKey, aValue.makeStringAndClear()); } } diff --git a/vcl/unx/generic/printergfx/common_gfx.cxx b/vcl/unx/generic/printergfx/common_gfx.cxx index 7cae4586bf6e..71ae6962ad73 100644 --- a/vcl/unx/generic/printergfx/common_gfx.cxx +++ b/vcl/unx/generic/printergfx/common_gfx.cxx @@ -1230,7 +1230,7 @@ PrinterGfx::DrawEPS( const Rectangle& rBoundingBox, void* pPtr, sal_uInt32 nSize static sal_uInt16 nEps = 0; if( ! aDocTitle.Len() ) - aDocTitle = ByteString::CreateFromInt32( (sal_Int32)(nEps++) ); + aDocTitle = rtl::OString::valueOf(static_cast<sal_Int32>(nEps++)); if( fLeft != fRight && fTop != fBottom ) { diff --git a/vcl/unx/generic/printergfx/printerjob.cxx b/vcl/unx/generic/printergfx/printerjob.cxx index 827b5c7cf269..9fb50947bcf4 100644 --- a/vcl/unx/generic/printergfx/printerjob.cxx +++ b/vcl/unx/generic/printergfx/printerjob.cxx @@ -1191,12 +1191,13 @@ bool PrinterJob::writeSetup( osl::File* pFile, const JobData& rJob ) if( ! bExternalDialog && rJob.m_nCopies > 1 ) { // setup code - ByteString aLine( "/#copies " ); - aLine += ByteString::CreateFromInt32( rJob.m_nCopies ); - aLine += " def\n"; + rtl::OStringBuffer aLine(RTL_CONSTASCII_STRINGPARAM("/#copies ")); + aLine.append(static_cast<sal_Int32>(rJob.m_nCopies)); + aLine.append(RTL_CONSTASCII_STRINGPARAM(" def\n")); sal_uInt64 nWritten = 0; - bSuccess = pFile->write( aLine.GetBuffer(), aLine.Len(), nWritten ) - || nWritten != aLine.Len() ? false : true; + bSuccess = pFile->write(aLine.getStr(), aLine.getLength(), nWritten) + || nWritten != static_cast<sal_uInt64>(aLine.getLength()) ? + false : true; if( bSuccess && GetPostscriptLevel( &rJob ) >= 2 ) WritePS (pFile, "<< /NumCopies null /Policies << /NumCopies 1 >> >> setpagedevice\n" ); diff --git a/vcl/unx/generic/window/salframe.cxx b/vcl/unx/generic/window/salframe.cxx index 1fdfc02c3916..2c1c94ae46c3 100644 --- a/vcl/unx/generic/window/salframe.cxx +++ b/vcl/unx/generic/window/salframe.cxx @@ -4241,7 +4241,7 @@ long X11SalFrame::Dispatch( XEvent *pEvent ) CaptureMouse( sal_True ); #ifdef DBG_UTIL if( -1 != nCaptured_ ) - pDisplay_->PrintEvent( "Captured", pEvent ); + pDisplay_->DbgPrintDisplayEvent("Captured", pEvent); #endif } diff --git a/vcl/unx/gtk/a11y/atkutil.cxx b/vcl/unx/gtk/a11y/atkutil.cxx index 78e0cb05d4de..8514e4417ca3 100644 --- a/vcl/unx/gtk/a11y/atkutil.cxx +++ b/vcl/unx/gtk/a11y/atkutil.cxx @@ -224,7 +224,7 @@ void DocumentFocusListener::notifyEvent( const accessibility::AccessibleEventObj if( accessibility::AccessibleStateType::FOCUSED == nState ) atk_wrapper_focus_tracker_notify_when_idle( getAccessible(aEvent) ); } - catch(const lang::IndexOutOfBoundsException &e) + catch (const lang::IndexOutOfBoundsException&) { g_warning("Focused object has invalid index in parent"); } @@ -559,7 +559,7 @@ static void handle_get_focus(::VclWindowEvent const * pEvent) { aDocumentFocusListener->attachRecursive(xAccessible, xContext, xStateSet); } - catch( const uno::Exception &e ) + catch (const uno::Exception&) { g_warning( "Exception caught processing focus events" ); } @@ -593,7 +593,7 @@ static void handle_menu_highlighted(::VclMenuEvent const * pEvent) } } } - catch( const uno::Exception& e ) + catch (const uno::Exception&) { g_warning( "Exception caught processing menu highlight events" ); } @@ -603,74 +603,76 @@ static void handle_menu_highlighted(::VclMenuEvent const * pEvent) long WindowEventHandler(void *, ::VclSimpleEvent const * pEvent) { - try { - switch (pEvent->GetId()) + try { - case VCLEVENT_WINDOW_SHOW: - break; - case VCLEVENT_WINDOW_HIDE: - break; - case VCLEVENT_WINDOW_CLOSE: - break; - case VCLEVENT_WINDOW_GETFOCUS: - handle_get_focus(static_cast< ::VclWindowEvent const * >(pEvent)); - break; - case VCLEVENT_WINDOW_LOSEFOCUS: - break; - case VCLEVENT_WINDOW_MINIMIZE: - break; - case VCLEVENT_WINDOW_NORMALIZE: - break; - case VCLEVENT_WINDOW_KEYINPUT: - case VCLEVENT_WINDOW_KEYUP: - case VCLEVENT_WINDOW_COMMAND: - case VCLEVENT_WINDOW_MOUSEMOVE: - break; - - case VCLEVENT_MENU_HIGHLIGHT: - if (const VclMenuEvent* pMenuEvent = dynamic_cast<const VclMenuEvent*>(pEvent)) - { - handle_menu_highlighted(pMenuEvent); - } - else if (const VclAccessibleEvent* pAccEvent = dynamic_cast<const VclAccessibleEvent*>(pEvent)) + switch (pEvent->GetId()) { - uno::Reference< accessibility::XAccessible > xAccessible = pAccEvent->GetAccessible(); - if (xAccessible.is()) - atk_wrapper_focus_tracker_notify_when_idle(xAccessible); + case VCLEVENT_WINDOW_SHOW: + break; + case VCLEVENT_WINDOW_HIDE: + break; + case VCLEVENT_WINDOW_CLOSE: + break; + case VCLEVENT_WINDOW_GETFOCUS: + handle_get_focus(static_cast< ::VclWindowEvent const * >(pEvent)); + break; + case VCLEVENT_WINDOW_LOSEFOCUS: + break; + case VCLEVENT_WINDOW_MINIMIZE: + break; + case VCLEVENT_WINDOW_NORMALIZE: + break; + case VCLEVENT_WINDOW_KEYINPUT: + case VCLEVENT_WINDOW_KEYUP: + case VCLEVENT_WINDOW_COMMAND: + case VCLEVENT_WINDOW_MOUSEMOVE: + break; + + case VCLEVENT_MENU_HIGHLIGHT: + if (const VclMenuEvent* pMenuEvent = dynamic_cast<const VclMenuEvent*>(pEvent)) + { + handle_menu_highlighted(pMenuEvent); + } + else if (const VclAccessibleEvent* pAccEvent = dynamic_cast<const VclAccessibleEvent*>(pEvent)) + { + uno::Reference< accessibility::XAccessible > xAccessible = pAccEvent->GetAccessible(); + if (xAccessible.is()) + atk_wrapper_focus_tracker_notify_when_idle(xAccessible); + } + break; + + case VCLEVENT_TOOLBOX_HIGHLIGHT: + handle_toolbox_highlight(static_cast< ::VclWindowEvent const * >(pEvent)->GetWindow()); + break; + + case VCLEVENT_TOOLBOX_BUTTONSTATECHANGED: + handle_toolbox_buttonchange(static_cast< ::VclWindowEvent const * >(pEvent)); + break; + + case VCLEVENT_OBJECT_DYING: + g_aWindowList.erase( static_cast< ::VclWindowEvent const * >(pEvent)->GetWindow() ); + // fallthrough intentional ! + case VCLEVENT_TOOLBOX_HIGHLIGHTOFF: + handle_toolbox_highlightoff(static_cast< ::VclWindowEvent const * >(pEvent)->GetWindow()); + break; + + case VCLEVENT_TABPAGE_ACTIVATE: + handle_tabpage_activated(static_cast< ::VclWindowEvent const * >(pEvent)->GetWindow()); + break; + + case VCLEVENT_COMBOBOX_SETTEXT: + // This looks quite strange to me. Stumbled over this when fixing #i104290#. + // This kicked in when leaving the combobox in the toolbar, after that the events worked. + // I guess this was a try to work around missing combobox events, which didn't do the full job, and shouldn't be necessary anymore. + // Fix for #i104290# was done in toolkit/source/awt/vclxaccessiblecomponent, FOCUSED state for compound controls in general. + // create_wrapper_for_children(static_cast< ::VclWindowEvent const * >(pEvent)->GetWindow()); + break; + + default: + break; } - break; - - case VCLEVENT_TOOLBOX_HIGHLIGHT: - handle_toolbox_highlight(static_cast< ::VclWindowEvent const * >(pEvent)->GetWindow()); - break; - - case VCLEVENT_TOOLBOX_BUTTONSTATECHANGED: - handle_toolbox_buttonchange(static_cast< ::VclWindowEvent const * >(pEvent)); - break; - - case VCLEVENT_OBJECT_DYING: - g_aWindowList.erase( static_cast< ::VclWindowEvent const * >(pEvent)->GetWindow() ); - // fallthrough intentional ! - case VCLEVENT_TOOLBOX_HIGHLIGHTOFF: - handle_toolbox_highlightoff(static_cast< ::VclWindowEvent const * >(pEvent)->GetWindow()); - break; - - case VCLEVENT_TABPAGE_ACTIVATE: - handle_tabpage_activated(static_cast< ::VclWindowEvent const * >(pEvent)->GetWindow()); - break; - - case VCLEVENT_COMBOBOX_SETTEXT: - // This looks quite strange to me. Stumbled over this when fixing #i104290#. - // This kicked in when leaving the combobox in the toolbar, after that the events worked. - // I guess this was a try to work around missing combobox events, which didn't do the full job, and shouldn't be necessary anymore. - // Fix for #i104290# was done in toolkit/source/awt/vclxaccessiblecomponent, FOCUSED state for compound controls in general. - // create_wrapper_for_children(static_cast< ::VclWindowEvent const * >(pEvent)->GetWindow()); - break; - - default: - break; } - } catch(lang::IndexOutOfBoundsException) + catch (const lang::IndexOutOfBoundsException&) { g_warning("Focused object has invalid index in parent"); } diff --git a/vcl/unx/gtk/app/gtkdata.cxx b/vcl/unx/gtk/app/gtkdata.cxx index 0a71ad01dab0..dde909ff27f2 100644 --- a/vcl/unx/gtk/app/gtkdata.cxx +++ b/vcl/unx/gtk/app/gtkdata.cxx @@ -333,25 +333,70 @@ long GtkSalDisplay::Dispatch( XEvent* pEvent ) return GDK_FILTER_CONTINUE; } -GdkCursor* GtkSalDisplay::getFromXPM( const unsigned char *pBitmap, +#if GTK_CHECK_VERSION(3,0,0) +namespace +{ + //cairo annoyingly won't take raw xbm data unless it fits + //the required cairo stride + unsigned char* ensurePaddedForCairo(const unsigned char *pXBM, + int nWidth, int nHeight, int nStride) + { + unsigned char *pPaddedXBM = const_cast<unsigned char*>(pXBM); + + int bytes_per_row = (nWidth + 7) / 8; + + if (nStride != bytes_per_row) + { + pPaddedXBM = new unsigned char[nStride * nHeight]; + for (int row = 0; row < nHeight; ++row) + { + memcpy(pPaddedXBM + (nStride * row), + pXBM + (bytes_per_row * row), bytes_per_row); + memset(pPaddedXBM + (nStride * row) + bytes_per_row, + 0, nStride - bytes_per_row); + } + } + + return pPaddedXBM; + } +} +#endif + +GdkCursor* GtkSalDisplay::getFromXBM( const unsigned char *pBitmap, const unsigned char *pMask, int nWidth, int nHeight, int nXHot, int nYHot ) { #if GTK_CHECK_VERSION(3,0,0) - g_warning ("FIXME: to use gdk_cursor_new_from_pixbuf instead of spiders"); - // We need to do something like: - /* - GdkPixbuf *pPix = gdk_pixbuf_new_from_xpm_data (pBitmap); - GdkPixbuf *pMask = gdk_pixbuf_new_from_xpm_data (pMask); - - GdkCursor* gdk_cursor_new_from_pixbuf (GdkDisplay *display, - GdkPixbuf *pixbuf, - gint x, - gint y); - */ - return gdk_cursor_new_for_display (gdk_display_get_default(), - GDK_SPIDER); + int cairo_stride = cairo_format_stride_for_width(CAIRO_FORMAT_A1, nWidth); + + unsigned char *pPaddedXBM = ensurePaddedForCairo(pBitmap, nWidth, nHeight, cairo_stride); + cairo_surface_t *s = cairo_image_surface_create_for_data( + pPaddedXBM, + CAIRO_FORMAT_A1, nWidth, nHeight, + cairo_stride); + + cairo_t *cr = cairo_create(s); + unsigned char *pPaddedMaskXBM = ensurePaddedForCairo(pMask, nWidth, nHeight, cairo_stride); + cairo_surface_t *mask = cairo_image_surface_create_for_data( + pPaddedMaskXBM, + CAIRO_FORMAT_A1, nWidth, nHeight, + cairo_stride); + cairo_mask_surface(cr, mask, 0, 0); + cairo_destroy(cr); + cairo_surface_destroy(mask); + if (pPaddedMaskXBM != pMask) + delete [] pPaddedMaskXBM; + + GdkPixbuf *pixbuf = gdk_pixbuf_get_from_surface(s, 0, 0, nWidth, nHeight); + cairo_surface_destroy(s); + if (pPaddedXBM != pBitmap) + delete [] pPaddedXBM; + + GdkCursor *cursor = gdk_cursor_new_from_pixbuf(m_pGdkDisplay, pixbuf, nXHot, nYHot); + g_object_unref(pixbuf); + + return cursor; #else GdkScreen *pScreen = gdk_display_get_default_screen( m_pGdkDisplay ); GdkDrawable *pDrawable = GDK_DRAWABLE( gdk_screen_get_root_window (pScreen) ); @@ -375,7 +420,7 @@ GdkCursor* GtkSalDisplay::getFromXPM( const unsigned char *pBitmap, #define MAKE_CURSOR( vcl_name, name ) \ case vcl_name: \ - pCursor = getFromXPM( name##curs##_bits, name##mask##_bits, \ + pCursor = getFromXBM( name##curs##_bits, name##mask##_bits, \ name##curs_width, name##curs_height, \ name##curs_x_hot, name##curs_y_hot ); \ break diff --git a/vcl/unx/gtk/app/gtksys.cxx b/vcl/unx/gtk/app/gtksys.cxx index 2076d39cc229..66987ef533e1 100644 --- a/vcl/unx/gtk/app/gtksys.cxx +++ b/vcl/unx/gtk/app/gtksys.cxx @@ -55,11 +55,11 @@ GtkSalSystem::~GtkSalSystem() } // convert ~ to indicate mnemonic to '_' -static ByteString MapToGtkAccelerator (const String &rStr) +static rtl::OString MapToGtkAccelerator(const String &rStr) { String aRet( rStr ); aRet.SearchAndReplaceAscii("~", String::CreateFromAscii("_")); - return ByteString( aRet, RTL_TEXTENCODING_UTF8 ); + return rtl::OUStringToOString(aRet, RTL_TEXTENCODING_UTF8); } int GtkSalSystem::ShowNativeDialog( const String& rTitle, @@ -76,14 +76,16 @@ int GtkSalSystem::ShowNativeDialog( const String& rTitle, std::fprintf( stderr, "GtkSalSystem::ShowNativeDialog\n"); #endif - ByteString aTitle( rTitle, RTL_TEXTENCODING_UTF8 ); - ByteString aMessage( rMessage, RTL_TEXTENCODING_UTF8 ); + rtl::OString aTitle(rtl::OUStringToOString(rTitle, + RTL_TEXTENCODING_UTF8)); + rtl::OString aMessage(rtl::OUStringToOString(rMessage, + RTL_TEXTENCODING_UTF8)); /* Create the dialogue */ GtkWidget* mainwin = gtk_message_dialog_new ( NULL, (GtkDialogFlags)0, GTK_MESSAGE_WARNING, - GTK_BUTTONS_NONE, aMessage.GetBuffer(), NULL ); - gtk_window_set_title( GTK_WINDOW( mainwin ), aTitle.GetBuffer() ); + GTK_BUTTONS_NONE, aMessage.getStr(), NULL ); + gtk_window_set_title( GTK_WINDOW( mainwin ), aTitle.getStr() ); gint nButtons = 0, nResponse; @@ -92,13 +94,16 @@ int GtkSalSystem::ShowNativeDialog( const String& rTitle, { if( nButton == nDefButton ) { - gtk_dialog_add_button( GTK_DIALOG( mainwin ), MapToGtkAccelerator(*it).GetBuffer(), nButtons ); - gtk_dialog_set_default_response( GTK_DIALOG( mainwin ), nButtons ); + gtk_dialog_add_button(GTK_DIALOG( mainwin ), + MapToGtkAccelerator(*it).getStr(), nButtons); + gtk_dialog_set_default_response(GTK_DIALOG(mainwin), nButtons); } else { - ByteString aLabel( *it, RTL_TEXTENCODING_UTF8 ); - gtk_dialog_add_button( GTK_DIALOG( mainwin ), aLabel.GetBuffer(), nButtons ); + rtl::OString aLabel(rtl::OUStringToOString(*it, + RTL_TEXTENCODING_UTF8)); + gtk_dialog_add_button(GTK_DIALOG(mainwin), aLabel.getStr(), + nButtons); } nButtons++; } diff --git a/vcl/unx/gtk/window/gtkframe.cxx b/vcl/unx/gtk/window/gtkframe.cxx index 8c151e782153..faa8a719b331 100644 --- a/vcl/unx/gtk/window/gtkframe.cxx +++ b/vcl/unx/gtk/window/gtkframe.cxx @@ -1431,7 +1431,7 @@ void GtkSalFrame::setMinMaxSize() int aHints = 0; if( m_nStyle & SAL_FRAME_STYLE_SIZEABLE ) { - if( m_aMinSize.Width() && m_aMinSize.Height() ) + if( m_aMinSize.Width() && m_aMinSize.Height() && ! m_bFullscreen ) { aGeo.min_width = m_aMinSize.Width()+CONTAINER_ADJUSTMENT; aGeo.min_height = m_aMinSize.Height()+CONTAINER_ADJUSTMENT; @@ -1446,11 +1446,12 @@ void GtkSalFrame::setMinMaxSize() } else { - aGeo.min_width = maGeometry.nWidth; - aGeo.min_height = maGeometry.nHeight; - aHints |= GDK_HINT_MIN_SIZE; if( ! m_bFullscreen ) { + aGeo.min_width = maGeometry.nWidth; + aGeo.min_height = maGeometry.nHeight; + aHints |= GDK_HINT_MIN_SIZE; + aGeo.max_width = maGeometry.nWidth; aGeo.max_height = maGeometry.nHeight; aHints |= GDK_HINT_MAX_SIZE; @@ -2371,6 +2372,8 @@ void GtkSalFrame::UpdateSettings( AllSettings& rSettings ) #ifndef GTK_GRAPHICS_DISABLED pGraphics->updateSettings( rSettings ); +#else + (void)rSettings; #endif if( bFreeGraphics ) @@ -3067,7 +3070,7 @@ gboolean GtkSalFrame::signalConfigure( GtkWidget*, GdkEventConfigure* pEvent, gp * - which is not good since the window manager will now size the window back to this * wrong size at some point. */ - if( (pThis->m_nStyle & (SAL_FRAME_STYLE_SIZEABLE | SAL_FRAME_STYLE_PLUG)) == SAL_FRAME_STYLE_SIZEABLE ) + if( pThis->m_bFullscreen || (pThis->m_nStyle & (SAL_FRAME_STYLE_SIZEABLE | SAL_FRAME_STYLE_PLUG)) == SAL_FRAME_STYLE_SIZEABLE ) { if( pEvent->width != (int)pThis->maGeometry.nWidth || pEvent->height != (int)pThis->maGeometry.nHeight ) { diff --git a/vcl/unx/gtk3/a11y/gtk3atkaction.cxx b/vcl/unx/gtk3/a11y/gtk3atkaction.cxx index 71a92c8e918b..80593f6af67c 100644 --- a/vcl/unx/gtk3/a11y/gtk3atkaction.cxx +++ b/vcl/unx/gtk3/a11y/gtk3atkaction.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * Version: MPL 1.1 / GPLv3+ / LGPLv3+ * @@ -26,3 +27,5 @@ */ #include "../../gtk/a11y/atkaction.cxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk3/a11y/gtk3atkbridge.cxx b/vcl/unx/gtk3/a11y/gtk3atkbridge.cxx index 34d094ff9d20..f7babdb8d95f 100644 --- a/vcl/unx/gtk3/a11y/gtk3atkbridge.cxx +++ b/vcl/unx/gtk3/a11y/gtk3atkbridge.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * Version: MPL 1.1 / GPLv3+ / LGPLv3+ * @@ -26,3 +27,5 @@ */ #include "../../gtk/a11y/atkbridge.cxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk3/a11y/gtk3atkcomponent.cxx b/vcl/unx/gtk3/a11y/gtk3atkcomponent.cxx index cd33fcf91e9d..8c300b125d79 100644 --- a/vcl/unx/gtk3/a11y/gtk3atkcomponent.cxx +++ b/vcl/unx/gtk3/a11y/gtk3atkcomponent.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * Version: MPL 1.1 / GPLv3+ / LGPLv3+ * @@ -26,3 +27,5 @@ */ #include "../../gtk/a11y/atkcomponent.cxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk3/a11y/gtk3atkeditabletext.cxx b/vcl/unx/gtk3/a11y/gtk3atkeditabletext.cxx index 6ba2164d2842..ae91ac31c63e 100644 --- a/vcl/unx/gtk3/a11y/gtk3atkeditabletext.cxx +++ b/vcl/unx/gtk3/a11y/gtk3atkeditabletext.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * Version: MPL 1.1 / GPLv3+ / LGPLv3+ * @@ -26,3 +27,5 @@ */ #include "../../gtk/a11y/atkeditabletext.cxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk3/a11y/gtk3atkfactory.cxx b/vcl/unx/gtk3/a11y/gtk3atkfactory.cxx index 3fd107f960c9..2a3c0dc8d76a 100644 --- a/vcl/unx/gtk3/a11y/gtk3atkfactory.cxx +++ b/vcl/unx/gtk3/a11y/gtk3atkfactory.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * Version: MPL 1.1 / GPLv3+ / LGPLv3+ * @@ -26,3 +27,5 @@ */ #include "../../gtk/a11y/atkfactory.cxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk3/a11y/gtk3atkhypertext.cxx b/vcl/unx/gtk3/a11y/gtk3atkhypertext.cxx index 29458829989c..f6b8cb651ffb 100644 --- a/vcl/unx/gtk3/a11y/gtk3atkhypertext.cxx +++ b/vcl/unx/gtk3/a11y/gtk3atkhypertext.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * Version: MPL 1.1 / GPLv3+ / LGPLv3+ * @@ -26,3 +27,5 @@ */ #include "../../gtk/a11y/atkhypertext.cxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk3/a11y/gtk3atkimage.cxx b/vcl/unx/gtk3/a11y/gtk3atkimage.cxx index e8404b199b0f..8167f6e8ecc9 100644 --- a/vcl/unx/gtk3/a11y/gtk3atkimage.cxx +++ b/vcl/unx/gtk3/a11y/gtk3atkimage.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * Version: MPL 1.1 / GPLv3+ / LGPLv3+ * @@ -26,3 +27,5 @@ */ #include "../../gtk/a11y/atkimage.cxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk3/a11y/gtk3atklistener.cxx b/vcl/unx/gtk3/a11y/gtk3atklistener.cxx index a43aeab9abcb..76ad3ba5c6ea 100644 --- a/vcl/unx/gtk3/a11y/gtk3atklistener.cxx +++ b/vcl/unx/gtk3/a11y/gtk3atklistener.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * Version: MPL 1.1 / GPLv3+ / LGPLv3+ * @@ -26,3 +27,5 @@ */ #include "../../gtk/a11y/atklistener.cxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk3/a11y/gtk3atkregistry.cxx b/vcl/unx/gtk3/a11y/gtk3atkregistry.cxx index 95c372a8c74e..3ad55519a892 100644 --- a/vcl/unx/gtk3/a11y/gtk3atkregistry.cxx +++ b/vcl/unx/gtk3/a11y/gtk3atkregistry.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * Version: MPL 1.1 / GPLv3+ / LGPLv3+ * @@ -26,3 +27,5 @@ */ #include "../../gtk/a11y/atkregistry.cxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk3/a11y/gtk3atkselection.cxx b/vcl/unx/gtk3/a11y/gtk3atkselection.cxx index 860e125d38cb..b233bbee9ef5 100644 --- a/vcl/unx/gtk3/a11y/gtk3atkselection.cxx +++ b/vcl/unx/gtk3/a11y/gtk3atkselection.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * Version: MPL 1.1 / GPLv3+ / LGPLv3+ * @@ -26,3 +27,5 @@ */ #include "../../gtk/a11y/atkselection.cxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk3/a11y/gtk3atktable.cxx b/vcl/unx/gtk3/a11y/gtk3atktable.cxx index 39dc5fc75407..bc0f473a773c 100644 --- a/vcl/unx/gtk3/a11y/gtk3atktable.cxx +++ b/vcl/unx/gtk3/a11y/gtk3atktable.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * Version: MPL 1.1 / GPLv3+ / LGPLv3+ * @@ -26,3 +27,5 @@ */ #include "../../gtk/a11y/atktable.cxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk3/a11y/gtk3atktext.cxx b/vcl/unx/gtk3/a11y/gtk3atktext.cxx index 3239c6630114..f6f69af3b4be 100644 --- a/vcl/unx/gtk3/a11y/gtk3atktext.cxx +++ b/vcl/unx/gtk3/a11y/gtk3atktext.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * Version: MPL 1.1 / GPLv3+ / LGPLv3+ * @@ -26,3 +27,5 @@ */ #include "../../gtk/a11y/atktext.cxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk3/a11y/gtk3atktextattributes.cxx b/vcl/unx/gtk3/a11y/gtk3atktextattributes.cxx index 61eeb47211d1..85ecf50da8bd 100644 --- a/vcl/unx/gtk3/a11y/gtk3atktextattributes.cxx +++ b/vcl/unx/gtk3/a11y/gtk3atktextattributes.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * Version: MPL 1.1 / GPLv3+ / LGPLv3+ * @@ -26,3 +27,5 @@ */ #include "../../gtk/a11y/atktextattributes.cxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk3/a11y/gtk3atkutil.cxx b/vcl/unx/gtk3/a11y/gtk3atkutil.cxx index 44b41f63e575..183a33c3ac27 100644 --- a/vcl/unx/gtk3/a11y/gtk3atkutil.cxx +++ b/vcl/unx/gtk3/a11y/gtk3atkutil.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * Version: MPL 1.1 / GPLv3+ / LGPLv3+ * @@ -26,3 +27,5 @@ */ #include "../../gtk/a11y/atkutil.cxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk3/a11y/gtk3atkvalue.cxx b/vcl/unx/gtk3/a11y/gtk3atkvalue.cxx index 8398e0f5f57f..346d7672d6d2 100644 --- a/vcl/unx/gtk3/a11y/gtk3atkvalue.cxx +++ b/vcl/unx/gtk3/a11y/gtk3atkvalue.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * Version: MPL 1.1 / GPLv3+ / LGPLv3+ * @@ -26,3 +27,5 @@ */ #include "../../gtk/a11y/atkvalue.cxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk3/a11y/gtk3atkwindow.cxx b/vcl/unx/gtk3/a11y/gtk3atkwindow.cxx index 3b11cf0f0780..c93b0ff4a8de 100644 --- a/vcl/unx/gtk3/a11y/gtk3atkwindow.cxx +++ b/vcl/unx/gtk3/a11y/gtk3atkwindow.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * Version: MPL 1.1 / GPLv3+ / LGPLv3+ * @@ -26,3 +27,5 @@ */ #include "../../gtk/a11y/atkwindow.cxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk3/a11y/gtk3atkwrapper.cxx b/vcl/unx/gtk3/a11y/gtk3atkwrapper.cxx index 9a6c2e9c5d22..fbcecd3495f8 100644 --- a/vcl/unx/gtk3/a11y/gtk3atkwrapper.cxx +++ b/vcl/unx/gtk3/a11y/gtk3atkwrapper.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * Version: MPL 1.1 / GPLv3+ / LGPLv3+ * @@ -26,3 +27,5 @@ */ #include "../../gtk/a11y/atkwrapper.cxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk3/app/gtk3gtkdata.cxx b/vcl/unx/gtk3/app/gtk3gtkdata.cxx index a6d7a0e2abc2..01d5c59104ca 100644 --- a/vcl/unx/gtk3/app/gtk3gtkdata.cxx +++ b/vcl/unx/gtk3/app/gtk3gtkdata.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * Version: MPL 1.1 / GPLv3+ / LGPLv3+ * @@ -26,3 +27,5 @@ */ #include "../../gtk/app/gtkdata.cxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk3/app/gtk3gtkinst.cxx b/vcl/unx/gtk3/app/gtk3gtkinst.cxx index ad2d59ac54a5..7d10b89e62a6 100644 --- a/vcl/unx/gtk3/app/gtk3gtkinst.cxx +++ b/vcl/unx/gtk3/app/gtk3gtkinst.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * Version: MPL 1.1 / GPLv3+ / LGPLv3+ * @@ -26,3 +27,5 @@ */ #include "../../gtk/app/gtkinst.cxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk3/app/gtk3gtksys.cxx b/vcl/unx/gtk3/app/gtk3gtksys.cxx index ee769b30e71a..8b103fa28e61 100644 --- a/vcl/unx/gtk3/app/gtk3gtksys.cxx +++ b/vcl/unx/gtk3/app/gtk3gtksys.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * Version: MPL 1.1 / GPLv3+ / LGPLv3+ * @@ -26,3 +27,5 @@ */ #include "../../gtk/app/gtksys.cxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx index 07dc4e58d395..aa68cc26e002 100644 --- a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * Version: MPL 1.1 / GPLv3+ / LGPLv3+ * @@ -25,4 +26,7 @@ * instead of those above. */ -#include "../../gtk/gdi/salnativewidgets-gtk.cxx" +#include "../../headless/svpdi.hxx" +#include "../../headless/svpdi.hxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk3/window/gtk3gtkframe.cxx b/vcl/unx/gtk3/window/gtk3gtkframe.cxx index a1d950ec5a15..47cbf2f41893 100644 --- a/vcl/unx/gtk3/window/gtk3gtkframe.cxx +++ b/vcl/unx/gtk3/window/gtk3gtkframe.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * Version: MPL 1.1 / GPLv3+ / LGPLv3+ * @@ -26,3 +27,5 @@ */ #include "../../gtk/window/gtkframe.cxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk3/window/gtk3gtkobject.cxx b/vcl/unx/gtk3/window/gtk3gtkobject.cxx index ab1628018e06..e91c849d8dff 100644 --- a/vcl/unx/gtk3/window/gtk3gtkobject.cxx +++ b/vcl/unx/gtk3/window/gtk3gtkobject.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * Version: MPL 1.1 / GPLv3+ / LGPLv3+ * @@ -26,3 +27,5 @@ */ #include "../../gtk/window/gtkobject.cxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/headless/svpbmp.cxx b/vcl/unx/headless/svpbmp.cxx index 2d8309af5eba..eccdd2bb97b3 100644 --- a/vcl/unx/headless/svpbmp.cxx +++ b/vcl/unx/headless/svpbmp.cxx @@ -26,7 +26,7 @@ * ************************************************************************/ -#include "svpbmp.hxx" +#include "unx/headless/svpbmp.hxx" #include <basegfx/vector/b2ivector.hxx> #include <basegfx/range/b2irange.hxx> diff --git a/vcl/unx/headless/svpdummies.cxx b/vcl/unx/headless/svpdummies.cxx index 3bf1a4da9cc0..326ad814651f 100644 --- a/vcl/unx/headless/svpdummies.cxx +++ b/vcl/unx/headless/svpdummies.cxx @@ -26,8 +26,8 @@ * ************************************************************************/ -#include "svpdummies.hxx" -#include "svpinst.hxx" +#include "unx/headless/svpdummies.hxx" +#include "unx/headless/svpinst.hxx" #include <rtl/ustrbuf.hxx> // SalObject diff --git a/vcl/unx/headless/svpelement.cxx b/vcl/unx/headless/svpelement.cxx index b6bf4822b576..785f3377e9af 100644 --- a/vcl/unx/headless/svpelement.cxx +++ b/vcl/unx/headless/svpelement.cxx @@ -26,7 +26,7 @@ * ************************************************************************/ -#include "svpelement.hxx" +#include "unx/headless/svpelement.hxx" #include <basebmp/scanlineformats.hxx> #include <tools/debug.hxx> @@ -39,9 +39,9 @@ #include <vcl/bitmap.hxx> #include <tools/stream.hxx> -#include "svpvd.hxx" -#include "svpbmp.hxx" -#include "svpframe.hxx" +#include "unx/headless/svpvd.hxx" +#include "unx/headless/svpbmp.hxx" +#include "unx/headless/svpframe.hxx" #include <list> #include <boost/unordered_map.hpp> diff --git a/vcl/unx/headless/svpframe.cxx b/vcl/unx/headless/svpframe.cxx index 1b8455557fac..bd15389cb1c0 100644 --- a/vcl/unx/headless/svpframe.cxx +++ b/vcl/unx/headless/svpframe.cxx @@ -26,9 +26,9 @@ * ************************************************************************/ -#include "svpframe.hxx" -#include "svpinst.hxx" -#include "svpgdi.hxx" +#include "unx/headless/svpframe.hxx" +#include "unx/headless/svpinst.hxx" +#include "unx/headless/svpgdi.hxx" #include <basebmp/scanlineformats.hxx> #include <basegfx/vector/b2ivector.hxx> diff --git a/vcl/unx/headless/svpgdi.cxx b/vcl/unx/headless/svpgdi.cxx index 0a7041661d4e..7025b7d18b7d 100644 --- a/vcl/unx/headless/svpgdi.cxx +++ b/vcl/unx/headless/svpgdi.cxx @@ -26,8 +26,8 @@ * ************************************************************************/ -#include "svpgdi.hxx" -#include "svpbmp.hxx" +#include "unx/headless/svpgdi.hxx" +#include "unx/headless/svpbmp.hxx" #include <vcl/sysdata.hxx> #include <basegfx/range/b2drange.hxx> @@ -46,7 +46,7 @@ #include <sys/stat.h> #endif -#include <svppspgraphics.hxx> +#include "unx/headless/svppspgraphics.hxx" #include <region.h> using namespace basegfx; diff --git a/vcl/unx/headless/svpinst.cxx b/vcl/unx/headless/svpinst.cxx index c9e011c1a67a..41d268a7a437 100644 --- a/vcl/unx/headless/svpinst.cxx +++ b/vcl/unx/headless/svpinst.cxx @@ -35,11 +35,11 @@ #include <vcl/apptypes.hxx> -#include "svpinst.hxx" -#include "svpframe.hxx" -#include "svpdummies.hxx" -#include "svpvd.hxx" -#include "svpbmp.hxx" +#include "unx/headless/svpinst.hxx" +#include "unx/headless/svpframe.hxx" +#include "unx/headless/svpdummies.hxx" +#include "unx/headless/svpvd.hxx" +#include "unx/headless/svpbmp.hxx" #include <salframe.hxx> #include <svdata.hxx> diff --git a/vcl/unx/headless/svpprn.cxx b/vcl/unx/headless/svpprn.cxx index 6f30f2d38969..64929876de17 100644 --- a/vcl/unx/headless/svpprn.cxx +++ b/vcl/unx/headless/svpprn.cxx @@ -41,9 +41,9 @@ #include "print.h" #include "salptype.hxx" -#include "svpprn.hxx" -#include "svppspgraphics.hxx" -#include "svpinst.hxx" +#include "unx/headless/svpprn.hxx" +#include "unx/headless/svppspgraphics.hxx" +#include "unx/headless/svpinst.hxx" using namespace psp; diff --git a/vcl/unx/headless/svppspgraphics.cxx b/vcl/unx/headless/svppspgraphics.cxx index 93fb0ced68b2..7b463a338e13 100644 --- a/vcl/unx/headless/svppspgraphics.cxx +++ b/vcl/unx/headless/svppspgraphics.cxx @@ -54,8 +54,8 @@ #include "outfont.hxx" #include "fontsubset.hxx" #include "printergfx.hxx" -#include "svppspgraphics.hxx" -#include "svpbmp.hxx" +#include "unx/headless/svppspgraphics.hxx" +#include "unx/headless/svpbmp.hxx" #include "region.h" using namespace psp; @@ -1135,10 +1135,12 @@ ImplDevFontAttributes PspGraphics::Info2DevFontAttributes( const psp::FastPrintF #if OSL_DEBUG_LEVEL > 2 if( bHasMapNames ) { - ByteString aOrigName( aDFA.maName, osl_getThreadTextEncoding() ); - ByteString aAliasNames( aDFA.maMapNames, osl_getThreadTextEncoding() ); + rtl::OString aOrigName(rtl::OUStringToOString(aDFA.maName, + osl_getThreadTextEncoding())); + rtl::OString aAliasNames(rtl::OUStringToOString(aDFA.maMapNames, + osl_getThreadTextEncoding())); fprintf( stderr, "using alias names \"%s\" for font family \"%s\"\n", - aAliasNames.GetBuffer(), aOrigName.GetBuffer() ); + aAliasNames.getStr(), aOrigName.getStr() ); } #endif diff --git a/vcl/unx/headless/svptext.cxx b/vcl/unx/headless/svptext.cxx index 18531baf1b52..4d3424605ba2 100644 --- a/vcl/unx/headless/svptext.cxx +++ b/vcl/unx/headless/svptext.cxx @@ -43,9 +43,9 @@ #include <impfont.hxx> #include <rtl/instance.hxx> -#include "svpgdi.hxx" -#include "svpbmp.hxx" -#include "svppspgraphics.hxx" +#include "unx/headless/svpgdi.hxx" +#include "unx/headless/svpbmp.hxx" +#include "unx/headless/svppspgraphics.hxx" using namespace basegfx; using namespace basebmp; diff --git a/vcl/unx/headless/svpvd.cxx b/vcl/unx/headless/svpvd.cxx index 8477da7b3bfc..c1de04b8d865 100644 --- a/vcl/unx/headless/svpvd.cxx +++ b/vcl/unx/headless/svpvd.cxx @@ -26,8 +26,8 @@ * ************************************************************************/ -#include "svpvd.hxx" -#include "svpgdi.hxx" +#include "unx/headless/svpvd.hxx" +#include "unx/headless/svpgdi.hxx" #include <basegfx/vector/b2ivector.hxx> #include <basebmp/scanlineformats.hxx> diff --git a/vcl/unx/kde4/KDESalFrame.cxx b/vcl/unx/kde4/KDESalFrame.cxx index 98b84ce54d7a..10e73502927c 100644 --- a/vcl/unx/kde4/KDESalFrame.cxx +++ b/vcl/unx/kde4/KDESalFrame.cxx @@ -88,8 +88,6 @@ static OUString readEntryUntranslated( KConfigGroup *pGroup, const char *pKey ) return OUString::createFromAscii( (const char *) pGroup->readEntryUntranslated( pKey ).toAscii() ); } -#if 0 -#endif /** Helper function to add information to Font from QFont. Mostly grabbed from the Gtk+ vclplug (salnativewidgets-gtk.cxx). diff --git a/vcl/util/makefile.mk b/vcl/util/makefile.mk deleted file mode 100755 index c8dc1012dd8f..000000000000 --- a/vcl/util/makefile.mk +++ /dev/null @@ -1,465 +0,0 @@ -#************************************************************************* -# -# 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. -# -#************************************************************************* - -PRJ=.. - -PRJNAME=vcl -TARGET=vcl -TARGETTYPE=GUI -USE_DEFFILE=TRUE -GEN_HID_OTHER=TRUE - -.IF "$(SNDFILE_LIBS)"!="" -SNDFILELIB=$(SNDFILE_LIBS) -.ENDIF - -# --- Settings ----------------------------------------------------------- - -.INCLUDE : settings.mk -.INCLUDE : makefile.pmk -.INCLUDE : makefile2.pmk - -.IF "$(OS)" == "SOLARIS" -.IF "$(CPUNAME)" == "SPARC" && "$(CPU)" == "U" -LINKFLAGSRUNPATH_OOO := -R/usr/sfw/lib/64 $(LINKFLAGSRUNPATH_OOO) -.ELSE -LINKFLAGSRUNPATH_OOO := -R/usr/sfw/lib $(LINKFLAGSRUNPATH_OOO) -.ENDIF -.ENDIF - -# --- Allgemein ---------------------------------------------------------- - -HXXDEPNLST= $(INC)$/vcl$/accel.hxx \ - $(INC)$/vcl$/animate.hxx \ - $(INC)$/vcl$/apptypes.hxx \ - $(INC)$/vcl$/bitmap.hxx \ - $(INC)$/vcl$/bitmapex.hxx \ - $(INC)$/vcl$/bmpacc.hxx \ - $(INC)$/vcl$/btndlg.hxx \ - $(INC)$/vcl$/button.hxx \ - $(INC)$/vcl$/ctrl.hxx \ - $(INC)$/vcl$/cursor.hxx \ - $(INC)$/vcl$/cmdevt.hxx \ - $(INC)$/vcl$/decoview.hxx \ - $(INC)$/vcl$/dialog.hxx \ - $(INC)$/vcl$/dllapi.h \ - $(INC)$/vcl$/dockwin.hxx \ - $(INC)$/vcl$/edit.hxx \ - $(INC)$/vcl$/event.hxx \ - $(INC)$/vcl$/field.hxx \ - $(INC)$/vcl$/fixed.hxx \ - $(INC)$/vcl$/floatwin.hxx \ - $(INC)$/vcl$/font.hxx \ - $(INC)$/vcl$/floatwin.hxx \ - $(INC)$/vcl$/graph.hxx \ - $(INC)$/vcl$/group.hxx \ - $(INC)$/vcl$/help.hxx \ - $(INC)$/vcl$/jobset.hxx \ - $(INC)$/vcl$/keycodes.hxx \ - $(INC)$/vcl$/keycod.hxx \ - $(INC)$/vcl$/image.hxx \ - $(INC)$/vcl$/lstbox.h \ - $(INC)$/vcl$/lstbox.hxx \ - $(INC)$/vcl$/mapmod.hxx \ - $(INC)$/vcl$/metaact.hxx \ - $(INC)$/vcl$/menu.hxx \ - $(INC)$/vcl$/menubtn.hxx \ - $(INC)$/vcl$/metric.hxx \ - $(INC)$/vcl$/morebtn.hxx \ - $(INC)$/vcl$/msgbox.hxx \ - $(INC)$/vcl$/octree.hxx \ - $(INC)$/vcl$/outdev.hxx \ - $(INC)$/vcl$/pointr.hxx \ - $(INC)$/vcl$/ptrstyle.hxx \ - $(INC)$/vcl$/prntypes.hxx \ - $(INC)$/vcl$/print.hxx \ - $(INC)$/vcl$/prndlg.hxx \ - $(INC)$/vcl$/region.hxx \ - $(INC)$/vcl$/rendergraphic.hxx \ - $(INC)$/vcl$/rendergraphicrasterizer.hxx \ - $(INC)$/vcl$/salbtype.hxx \ - $(INC)$/vcl$/scrbar.hxx \ - $(INC)$/vcl$/slider.hxx \ - $(INC)$/vcl$/seleng.hxx \ - $(INC)$/vcl$/settings.hxx \ - $(INC)$/vcl$/sound.hxx \ - $(INC)$/vcl$/sndstyle.hxx \ - $(INC)$/vcl$/split.hxx \ - $(INC)$/vcl$/splitwin.hxx \ - $(INC)$/vcl$/spin.hxx \ - $(INC)$/vcl$/spinfld.hxx \ - $(INC)$/vcl$/status.hxx \ - $(INC)$/vcl$/stdtext.hxx \ - $(INC)$/vcl$/sv.h \ - $(INC)$/vcl$/svapp.hxx \ - $(INC)$/vcl$/syschild.hxx \ - $(INC)$/vcl$/sysdata.hxx \ - $(INC)$/vcl$/syswin.hxx \ - $(INC)$/vcl$/tabctrl.hxx \ - $(INC)$/vcl$/tabdlg.hxx \ - $(INC)$/vcl$/tabpage.hxx \ - $(INC)$/vcl$/toolbox.hxx \ - $(INC)$/vcl$/timer.hxx \ - $(INC)$/vcl$/virdev.hxx \ - $(INC)$/vcl$/wall.hxx \ - $(INC)$/vcl$/waitobj.hxx \ - $(INC)$/vcl$/window.hxx \ - $(INC)$/vcl$/wrkwin.hxx - -.IF "$(linkinc)" != "" -SHL11FILE= $(MISC)$/app.slo -SHL12FILE= $(MISC)$/gdi.slo -SHL13FILE= $(MISC)$/win.slo -SHL14FILE= $(MISC)$/ctrl.slo -SHL16FILE= $(MISC)$/salapp.slo -SHL17FILE= $(MISC)$/salwin.slo -SHL18FILE= $(MISC)$/salgdi.slo -.ENDIF - -LIB1TARGET= $(SLB)$/$(TARGET).lib -LIB1FILES= $(SLB)$/app.lib \ - $(SLB)$/gdi.lib \ - $(SLB)$/win.lib \ - $(SLB)$/ctrl.lib \ - $(SLB)$/helper.lib \ - $(SLB)$/fontsubset.lib \ - $(SLB)$/components.lib - -.IF "$(GUI)" == "UNX" && "$(GUIBASE)"!="aqua" -LIB1FILES+= $(SLB)$/salplug.lib \ - $(SLB)$/fontman.lib \ - $(SLB)$/printer.lib -.ELSE -LIB1FILES+= \ - $(SLB)$/salwin.lib \ - $(SLB)$/salgdi.lib \ - $(SLB)$/salapp.lib -.IF "$(GUIBASE)" == "aqua" -LIB1FILES+= $(SLB)$/dtransaqua.lib -.ENDIF -.ENDIF - -SHL1TARGET= vcl$(DLLPOSTFIX) -SHL1IMPLIB= ivcl -SHL1STDLIBS+=\ - $(SOTLIB) \ - $(UNOTOOLSLIB) \ - $(TOOLSLIB) \ - $(I18NPAPERLIB) \ - $(I18NISOLANGLIB) \ - $(I18NUTILLIB) \ - $(COMPHELPERLIB) \ - $(UCBHELPERLIB) \ - $(CPPUHELPERLIB) \ - $(CPPULIB) \ - $(SALLIB) \ - $(BASEGFXLIB) \ - $(ICUUCLIB) \ - $(ICUDATALIB) \ - $(ICULELIB) \ - $(JVMACCESSLIB) - -.IF "$(GUI)" == "UNX" -.IF "$(ENABLE_GRAPHITE)" != "" -.IF "$(SYSTEM_GRAPHITE)" == "YES" -SHL1STDLIBS+= $(GRAPHITE_LIBS) -.ELSE -SHL1STDLIBS+= -lgraphite2_off -.ENDIF -.ENDIF -.ENDIF -SHL1USE_EXPORTS=name - -.IF "$(GUIBASE)"=="aqua" -SHL1STDLIBS+= \ - $(BASEBMPLIB) \ - -lAppleRemote$(DLLPOSTFIX) \ - -framework QuickTime - -LIB1FILES+= \ - $(SLB)$/sala11y.lib -.ENDIF - -.IF "$(USE_BUILTIN_RASTERIZER)"!="" - LIB1FILES += $(SLB)$/glyphs.lib - SHL1STDLIBS+= $(FREETYPELIB) -.ELSE -.IF "$(ENABLE_GRAPHITE)" == "TRUE" - LIB1FILES += $(SLB)$/glyphs.lib -.ENDIF -.ENDIF # USE_BUILTIN_RASTERIZER - -SHL1LIBS= $(LIB1TARGET) - -.IF "$(GUI)" != "UNX" -SHL1RES= $(RES)$/salsrc.res -.ENDIF - -SHL1DEF= $(MISC)$/$(SHL1TARGET).def - -DEF1NAME =$(SHL1TARGET) -DEF1DEPN = $(HXXDEPNLST) \ - $(LIB1TARGET) -DEF1DES =VCL -DEFLIB1NAME =vcl - -# --- W32 ---------------------------------------------------------------- - -.IF "$(GUI)" == "WNT" - -.IF "$(ENABLE_GRAPHITE)" == "TRUE" -.IF "$(COM)" == "GCC" -SHL1STDLIBS += -Wl,-Bstatic -lgraphite2_off -Wl,-Bdynamic -#SHL1STDLIBS += -lgraphite2_off -.ELSE -SHL1STDLIBS += graphite2_off.lib -.ENDIF -.ENDIF - -SHL1STDLIBS += $(UWINAPILIB) \ - $(GDI32LIB) \ - $(GDIPLUSLIB) \ - $(MSIMG32LIB) \ - $(WINSPOOLLIB) \ - $(OLE32LIB) \ - $(SHELL32LIB) \ - $(ADVAPI32LIB) \ - $(VERSIONLIB) - -SHL1STDLIBS += $(IMM32LIB) - -.IF "$(GUI)$(COM)$(CPU)" == "WNTMSCI" -LINKFLAGSSHL += /ENTRY:LibMain@12 -.ENDIF -.ENDIF - -# --- UNX ---------------------------------------------------------------- - -# UNX sal plugins -.IF "$(GUI)" == "UNX" && "$(GUIBASE)" != "aqua" - -# desktop detector -LIB7TARGET=$(SLB)$/idet -LIB7FILES=$(SLB)$/dtdetect.lib -SHL7TARGET=desktop_detector$(DLLPOSTFIX) -SHL7STDLIBS=\ - $(SALLIB) \ - $(X11LINK_DYNAMIC) -SHL7IMPLIB=idet -SHL7LIBS=$(LIB7TARGET) - -# basic pure X11 plugin -LIB2TARGET=$(SLB)$/ipure_x -LIB2FILES= \ - $(SLB)$/dtransX11.lib \ - $(SLB)$/printergfx.lib \ - $(SLB)$/salwin.lib \ - $(SLB)$/salgdi.lib \ - $(SLB)$/salapp.lib -SHL2TARGET=vclplug_gen$(DLLPOSTFIX) -SHL2IMPLIB=ipure_x -SHL2LIBS=$(LIB2TARGET) -SHL2DEPN=$(SHL1IMPLIBN) $(SHL1TARGETN) - -# libs for generic plugin -SHL2STDLIBS=\ - $(VCLLIB)\ - $(I18NPAPERLIB) \ - $(I18NISOLANGLIB) \ - $(TOOLSLIB) \ - $(BASEGFXLIB) \ - $(UNOTOOLSLIB) \ - $(COMPHELPERLIB) \ - $(CPPUHELPERLIB) \ - $(CPPULIB) \ - $(SALLIB) - -# prepare linking of Xinerama -.IF "$(USE_XINERAMA)" != "NO" - -.IF "$(OS)"=="MACOSX" || "$(OS)$(CPU)" == "LINUXX" -XINERAMALIBS=-lXinerama -.ELSE -.IF "$(OS)" != "SOLARIS" || "$(USE_XINERAMA_VERSION)" == "Xorg" -.IF "$(XINERAMA_LINK)" == "dynamic" -XINERAMALIBS= -lXinerama -.ELSE -XINERAMALIBS= -Wl,-Bstatic -lXinerama -Wl,-Bdynamic -.ENDIF # XINERAMA_LINK == dynamic -.ENDIF # OS == SOLARIS -.ENDIF # OS == MACOSX - -SHL2STDLIBS += $(XINERAMALIBS) -.ENDIF # USE_XINERAMA != NO - -.IF "$(XRENDER_LINK)" == "YES" -SHL2STDLIBS+=`pkg-config --libs xrender` -.ENDIF - -.IF "$(GUIBASE)"=="unx" - -SHL2STDLIBS += -lXext -lSM -lICE -lX11 -.IF "$(OS)"!="MACOSX" && "$(OS)"!="FREEBSD" && "$(OS)"!="NETBSD" && \ - && "$(OS)"!="OPENBSD" "$(OS)"!="DRAGONFLY" -# needed by salprnpsp.cxx -SHL2STDLIBS+= -ldl -.ENDIF - -.IF "$(ENABLE_RANDR)" != "" -.IF "$(XRANDR_DLOPEN)" == "FALSE" -SHL2STDLIBS+= $(XRANDR_LIBS) -.ENDIF -.ENDIF - -.ENDIF # "$(GUIBASE)"=="unx" - -# gtk plugin -.IF "$(ENABLE_GTK)" != "" -PKGCONFIG_MODULES=gtk+-2.0 gthread-2.0 -.IF "$(ENABLE_DBUS)" != "" -PKGCONFIG_MODULES+= dbus-glib-1 -.ENDIF -.INCLUDE: pkg_config.mk - -LIB4TARGET=$(SLB)$/igtk_plug_ -LIB4FILES=\ - $(SLB)$/gtkapp.lib\ - $(SLB)$/gtka11y.lib \ - $(SLB)$/gtkgdi.lib\ - $(SLB)$/gtkwin.lib - -SHL4TARGET=vclplug_gtk$(DLLPOSTFIX) -SHL4IMPLIB=igtk_plug_ -SHL4LIBS=$(LIB4TARGET) -SHL4DEPN=$(SHL1IMPLIBN) $(SHL1TARGETN) $(SHL2IMPLIBN) $(SHL2TARGETN) -# libs for gtk plugin -SHL4STDLIBS+=$(PKGCONFIG_LIBS:s/ -lpangoxft-1.0//) -# hack for faked SO environment -.IF "$(PKGCONFIG_ROOT)"!="" -SHL4SONAME+=-z nodefs -SHL4NOCHECK=TRUE -.ENDIF # "$(PKGCONFIG_ROOT)"!="" - - -SHL4STDLIBS+=-l$(SHL2TARGET) -SHL4STDLIBS+=\ - $(VCLLIB) \ - $(TOOLSLIB) \ - $(CPPUHELPERLIB) \ - $(CPPULIB) \ - $(SALLIB) \ - $(X11LINK_DYNAMIC) - -.IF "$(ENABLE_RANDR)" != "" -.IF "$(XRANDR_DLOPEN)" == "FALSE" -SHL4STDLIBS+= $(XRANDR_LIBS) -.ENDIF -.ENDIF - -.ENDIF # "$(ENABLE_GTK)" != "" - -# KDE plugin -.IF "$(ENABLE_KDE)" != "" -.IF "$(KDE_ROOT)"!="" -EXTRALIBPATHS+=-L$(KDE_ROOT)$/lib -.IF "$(OS)$(CPU)" == "LINUXX" -EXTRALIBPATHS+=-L$(KDE_ROOT)$/lib64 -.ENDIF -.ENDIF -LIB5TARGET=$(SLB)$/ikde_plug_ -LIB5FILES=$(SLB)$/kdeplug.lib -SHL5TARGET=vclplug_kde$(DLLPOSTFIX) -SHL5IMPLIB=ikde_plug_ -SHL5LIBS=$(LIB5TARGET) -SHL5DEPN=$(SHL2TARGETN) -# libs for KDE plugin -SHL5STDLIBS+=-l$(SHL2TARGET) -SHL5STDLIBS+=\ - $(VCLLIB) \ - $(TOOLSLIB) \ - $(SALLIB) \ - $(X11LINK_DYNAMIC) - -.IF "$(ENABLE_RANDR)" != "" -.IF "$(XRANDR_DLOPEN)" == "FALSE" -SHL5STDLIBS+= $(XRANDR_LIBS) -.ENDIF -.ENDIF - -SHL5LINKFLAGS+=$(KDE_LIBS) - -.ENDIF # "$(ENABLE_KDE)" != "" - -# KDE4 plugin -.IF "$(ENABLE_KDE4)" != "" -.IF "$(KDE4_ROOT)"!="" -EXTRALIBPATHS+=-L$(KDE4_ROOT)$/lib -.ENDIF -LIB6TARGET=$(SLB)$/ikde4_plug_ -LIB6FILES=$(SLB)$/kde4plug.lib -SHL6TARGET=vclplug_kde4$(DLLPOSTFIX) -SHL6IMPLIB=ikde4_plug_ -SHL6LIBS=$(LIB6TARGET) -SHL6DEPN=$(SHL2TARGETN) -# libs for KDE4 plugin -SHL6STDLIBS+=-l$(SHL2TARGET) -SHL6STDLIBS+=\ - $(VCLLIB) \ - $(PSPLIB) \ - $(TOOLSLIB) \ - $(SALLIB) \ - $(X11LINK_DYNAMIC) - -.IF "$(ENABLE_RANDR)" != "" -.IF "$(XRANDR_DLOPEN)" == "FALSE" -SHL6STDLIBS+= $(XRANDR_LIBS) -.ENDIF -.ENDIF - -SHL6STDLIBS+=$(KDE4_LIBS) $(KDE_GLIB_LIBS) - -.ENDIF # "$(ENABLE_KDE4)" != "" - -.ENDIF # UNX - -# --- Allgemein ---------------------------------------------------------- - -.INCLUDE : target.mk - -ALLTAR : $(MISC)/vcl.component - -.IF "$(OS)" == "MACOSX" -my_platform = .macosx -.ELIF "$(OS)" == "WNT" -my_platform = .windows -.END - -$(MISC)/vcl.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ - vcl.component - $(XSLTPROC) --nonet --stringparam uri \ - '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ - $(SOLARENV)/bin/createcomponent.xslt vcl$(my_platform).component diff --git a/vcl/vcl.android.component b/vcl/vcl.android.component new file mode 100644 index 000000000000..5dd80ebe0029 --- /dev/null +++ b/vcl/vcl.android.component @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* 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. +* +**********************************************************************--> + +<component loader="com.sun.star.loader.SharedLibrary" prefix="vcl" + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.frame.VCLSessionManagerClient"> + <service name="com.sun.star.frame.SessionManagerClient"/> + </implementation> + <implementation name="vcl::DisplayAccess"> + <service name="com.sun.star.awt.DisplayAccess"/> + </implementation> + <implementation name="vcl::FontIdentificator"> + <service name="com.sun.star.awt.FontIdentificator"/> + </implementation> + <implementation name="vcl::rsvg::Rasterizer"> + <service name="com.sun.star.graphic.GraphicRasterizer_RSVG"/> + </implementation> +</component> diff --git a/vcl/vcl.ios.component b/vcl/vcl.ios.component new file mode 100644 index 000000000000..5dd80ebe0029 --- /dev/null +++ b/vcl/vcl.ios.component @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* 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. +* +**********************************************************************--> + +<component loader="com.sun.star.loader.SharedLibrary" prefix="vcl" + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.frame.VCLSessionManagerClient"> + <service name="com.sun.star.frame.SessionManagerClient"/> + </implementation> + <implementation name="vcl::DisplayAccess"> + <service name="com.sun.star.awt.DisplayAccess"/> + </implementation> + <implementation name="vcl::FontIdentificator"> + <service name="com.sun.star.awt.FontIdentificator"/> + </implementation> + <implementation name="vcl::rsvg::Rasterizer"> + <service name="com.sun.star.graphic.GraphicRasterizer_RSVG"/> + </implementation> +</component> diff --git a/vcl/vcl.macosx.component b/vcl/vcl.macosx.component index 023f805672bd..a4f551c63a79 100644 --- a/vcl/vcl.macosx.component +++ b/vcl/vcl.macosx.component @@ -26,7 +26,7 @@ * **********************************************************************--> -<component loader="com.sun.star.loader.SharedLibrary" +<component loader="com.sun.star.loader.SharedLibrary" prefix="vcl" xmlns="http://openoffice.org/2010/uno-components"> <implementation name="com.sun.star.comp.datatransfer.dnd.OleDragSource_V1"> <service name="com.sun.star.datatransfer.dnd.OleDragSource"/> diff --git a/vcl/vcl.unx.component b/vcl/vcl.unx.component index ea14667d17c1..c58bb8fa3c47 100644 --- a/vcl/vcl.unx.component +++ b/vcl/vcl.unx.component @@ -26,7 +26,7 @@ * **********************************************************************--> -<component loader="com.sun.star.loader.SharedLibrary" +<component loader="com.sun.star.loader.SharedLibrary" prefix="vcl" xmlns="http://openoffice.org/2010/uno-components"> <implementation name="com.sun.star.datatransfer.X11ClipboardSupport"> <service name="com.sun.star.datatransfer.clipboard.SystemClipboard"/> diff --git a/vcl/vcl.windows.component b/vcl/vcl.windows.component index df786c4d832b..5dd80ebe0029 100644 --- a/vcl/vcl.windows.component +++ b/vcl/vcl.windows.component @@ -26,7 +26,7 @@ * **********************************************************************--> -<component loader="com.sun.star.loader.SharedLibrary" +<component loader="com.sun.star.loader.SharedLibrary" prefix="vcl" xmlns="http://openoffice.org/2010/uno-components"> <implementation name="com.sun.star.frame.VCLSessionManagerClient"> <service name="com.sun.star.frame.SessionManagerClient"/> diff --git a/vcl/win/source/app/saldata.cxx b/vcl/win/source/app/saldata.cxx index 805ca84dc906..805ca84dc906 100755..100644 --- a/vcl/win/source/app/saldata.cxx +++ b/vcl/win/source/app/saldata.cxx diff --git a/vcl/win/source/app/salinfo.cxx b/vcl/win/source/app/salinfo.cxx index 4436c0243f1d..4436c0243f1d 100755..100644 --- a/vcl/win/source/app/salinfo.cxx +++ b/vcl/win/source/app/salinfo.cxx diff --git a/vcl/win/source/app/salinst.cxx b/vcl/win/source/app/salinst.cxx index 6db248c0ddb4..5e8930f4155f 100644 --- a/vcl/win/source/app/salinst.cxx +++ b/vcl/win/source/app/salinst.cxx @@ -34,9 +34,6 @@ #include <svsys.h> #include <process.h> #endif -#ifdef __MINGW32__ -#include <excpt.h> -#endif #include <osl/file.hxx> #include <osl/mutex.hxx> @@ -72,15 +69,19 @@ #pragma warning( disable: 4917 ) #endif -#include <GdiPlus.h> -#include <GdiPlusEnums.h> -#include <GdiPlusColor.h> -#include <Shlobj.h> +#include <gdiplus.h> +#include <gdiplusenums.h> +#include <gdipluscolor.h> +#include <shlobj.h> #if defined _MSC_VER #pragma warning(pop) #endif +#ifdef __MINGW32__ +#include <sehandler.hxx> +#endif + // ======================================================================= void SalAbort( const XubString& rErrorText ) @@ -516,8 +517,6 @@ SalInstance* CreateSalInstance() // determine the windows version aSalShlData.mbWXP = 0; - aSalShlData.mbWPrinter = 0; - WORD nVer = (WORD)GetVersion(); rtl_zeroMemory( &aSalShlData.maVersionInfo, sizeof(aSalShlData.maVersionInfo) ); aSalShlData.maVersionInfo.dwOSVersionInfoSize = sizeof( aSalShlData.maVersionInfo ); if ( GetVersionEx( &aSalShlData.maVersionInfo ) ) @@ -526,8 +525,6 @@ SalInstance* CreateSalInstance() if ( aSalShlData.maVersionInfo.dwMajorVersion > 5 || ( aSalShlData.maVersionInfo.dwMajorVersion == 5 && aSalShlData.maVersionInfo.dwMinorVersion >= 1 ) ) aSalShlData.mbWXP = 1; - if( aSalShlData.maVersionInfo.dwMajorVersion >= 5 ) - aSalShlData.mbWPrinter = 1; } pSalData->mnAppThreadId = GetCurrentThreadId(); diff --git a/vcl/win/source/app/salshl.cxx b/vcl/win/source/app/salshl.cxx index caebe9ca5b18..caebe9ca5b18 100755..100644 --- a/vcl/win/source/app/salshl.cxx +++ b/vcl/win/source/app/salshl.cxx diff --git a/vcl/win/source/app/saltimer.cxx b/vcl/win/source/app/saltimer.cxx index 60c917475a94..5aab67d88cdd 100755..100644 --- a/vcl/win/source/app/saltimer.cxx +++ b/vcl/win/source/app/saltimer.cxx @@ -29,13 +29,14 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" #include <svsys.h> -#ifdef __MINGW32__ -#include <excpt.h> -#endif #include <win/saldata.hxx> #include <win/saltimer.h> #include <win/salinst.h> +#ifdef __MINGW32__ +#include <sehandler.hxx> +#endif + // ======================================================================= // Maximale Periode diff --git a/vcl/win/source/gdi/salbmp.cxx b/vcl/win/source/gdi/salbmp.cxx index 7661fa5f6ed1..7661fa5f6ed1 100755..100644 --- a/vcl/win/source/gdi/salbmp.cxx +++ b/vcl/win/source/gdi/salbmp.cxx diff --git a/vcl/win/source/gdi/salgdi_gdiplus.cxx b/vcl/win/source/gdi/salgdi_gdiplus.cxx index 3c55685f0aba..fd828d6c0878 100644 --- a/vcl/win/source/gdi/salgdi_gdiplus.cxx +++ b/vcl/win/source/gdi/salgdi_gdiplus.cxx @@ -50,9 +50,9 @@ #pragma warning(push, 1) #endif -#include <GdiPlus.h> -#include <GdiPlusEnums.h> -#include <GdiPlusColor.h> +#include <gdiplus.h> +#include <gdiplusenums.h> +#include <gdipluscolor.h> #if defined _MSC_VER #pragma warning(pop) @@ -62,7 +62,7 @@ // ----------------------------------------------------------------------- -void impAddB2DPolygonToGDIPlusGraphicsPathReal(Gdiplus::GraphicsPath& rPath, const basegfx::B2DPolygon& rPolygon, bool bNoLineJoin) +void impAddB2DPolygonToGDIPlusGraphicsPathReal(Gdiplus::GpPath *pPath, const basegfx::B2DPolygon& rPolygon, bool bNoLineJoin) { sal_uInt32 nCount(rPolygon.count()); @@ -71,44 +71,42 @@ void impAddB2DPolygonToGDIPlusGraphicsPathReal(Gdiplus::GraphicsPath& rPath, con const sal_uInt32 nEdgeCount(rPolygon.isClosed() ? nCount : nCount - 1); const bool bControls(rPolygon.areControlPointsUsed()); basegfx::B2DPoint aCurr(rPolygon.getB2DPoint(0)); - Gdiplus::PointF aFCurr(Gdiplus::REAL(aCurr.getX()), Gdiplus::REAL(aCurr.getY())); for(sal_uInt32 a(0); a < nEdgeCount; a++) { const sal_uInt32 nNextIndex((a + 1) % nCount); const basegfx::B2DPoint aNext(rPolygon.getB2DPoint(nNextIndex)); - const Gdiplus::PointF aFNext(Gdiplus::REAL(aNext.getX()), Gdiplus::REAL(aNext.getY())); if(bControls && (rPolygon.isNextControlPointUsed(a) || rPolygon.isPrevControlPointUsed(nNextIndex))) { const basegfx::B2DPoint aCa(rPolygon.getNextControlPoint(a)); const basegfx::B2DPoint aCb(rPolygon.getPrevControlPoint(nNextIndex)); - rPath.AddBezier( - aFCurr, - Gdiplus::PointF(Gdiplus::REAL(aCa.getX()), Gdiplus::REAL(aCa.getY())), - Gdiplus::PointF(Gdiplus::REAL(aCb.getX()), Gdiplus::REAL(aCb.getY())), - aFNext); + Gdiplus::DllExports::GdipAddPathBezier(pPath, + aCurr.getX(), aCurr.getY(), + aCa.getX(), aCa.getY(), + aCb.getX(), aCb.getY(), + aNext.getX(), aNext.getY()); } else { - rPath.AddLine(aFCurr, aFNext); + Gdiplus::DllExports::GdipAddPathLine(pPath, aCurr.getX(), aCurr.getY(), aNext.getX(), aNext.getY()); } if(a + 1 < nEdgeCount) { - aFCurr = aFNext; + aCurr = aNext; if(bNoLineJoin) { - rPath.StartFigure(); + Gdiplus::DllExports::GdipStartPathFigure(pPath); } } } } } -void impAddB2DPolygonToGDIPlusGraphicsPathInteger(Gdiplus::GraphicsPath& rPath, const basegfx::B2DPolygon& rPolygon, bool bNoLineJoin) +void impAddB2DPolygonToGDIPlusGraphicsPathInteger(Gdiplus::GpPath *pPath, const basegfx::B2DPolygon& rPolygon, bool bNoLineJoin) { sal_uInt32 nCount(rPolygon.count()); @@ -117,37 +115,36 @@ void impAddB2DPolygonToGDIPlusGraphicsPathInteger(Gdiplus::GraphicsPath& rPath, const sal_uInt32 nEdgeCount(rPolygon.isClosed() ? nCount : nCount - 1); const bool bControls(rPolygon.areControlPointsUsed()); basegfx::B2DPoint aCurr(rPolygon.getB2DPoint(0)); - Gdiplus::Point aICurr(INT(aCurr.getX()), INT(aCurr.getY())); for(sal_uInt32 a(0); a < nEdgeCount; a++) { const sal_uInt32 nNextIndex((a + 1) % nCount); const basegfx::B2DPoint aNext(rPolygon.getB2DPoint(nNextIndex)); - const Gdiplus::Point aINext(INT(aNext.getX()), INT(aNext.getY())); if(bControls && (rPolygon.isNextControlPointUsed(a) || rPolygon.isPrevControlPointUsed(nNextIndex))) { const basegfx::B2DPoint aCa(rPolygon.getNextControlPoint(a)); const basegfx::B2DPoint aCb(rPolygon.getPrevControlPoint(nNextIndex)); - rPath.AddBezier( - aICurr, - Gdiplus::Point(INT(aCa.getX()), INT(aCa.getY())), - Gdiplus::Point(INT(aCb.getX()), INT(aCb.getY())), - aINext); + Gdiplus::DllExports::GdipAddPathBezier( + pPath, + aCurr.getX(), aCurr.getY(), + aCa.getX(), aCa.getY(), + aCb.getX(), aCb.getY(), + aNext.getX(), aNext.getY()); } else { - rPath.AddLine(aICurr, aINext); + Gdiplus::DllExports::GdipAddPathLine(pPath, aCurr.getX(), aCurr.getY(), aNext.getX(), aNext.getY()); } if(a + 1 < nEdgeCount) { - aICurr = aINext; + aCurr = aNext; if(bNoLineJoin) { - rPath.StartFigure(); + Gdiplus::DllExports::GdipStartPathFigure(pPath); } } } @@ -160,33 +157,39 @@ bool WinSalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPoly if(mbBrush && nCount && (fTransparency >= 0.0 && fTransparency < 1.0)) { - Gdiplus::Graphics aGraphics(mhDC); + Gdiplus::GpGraphics *pGraphics = NULL; + Gdiplus::DllExports::GdipCreateFromHDC(mhDC, &pGraphics); const sal_uInt8 aTrans((sal_uInt8)255 - (sal_uInt8)basegfx::fround(fTransparency * 255.0)); Gdiplus::Color aTestColor(aTrans, SALCOLOR_RED(maFillColor), SALCOLOR_GREEN(maFillColor), SALCOLOR_BLUE(maFillColor)); - Gdiplus::SolidBrush aTestBrush(aTestColor); - Gdiplus::GraphicsPath aPath; + Gdiplus::GpSolidFill *pTestBrush; + Gdiplus::DllExports::GdipCreateSolidFill(aTestColor.GetValue(), &pTestBrush); + Gdiplus::GpPath *pPath = NULL; + Gdiplus::DllExports::GdipCreatePath(Gdiplus::FillModeAlternate, &pPath); for(sal_uInt32 a(0); a < nCount; a++) { if(0 != a) { - aPath.StartFigure(); // #i101491# not needed for first run + Gdiplus::DllExports::GdipStartPathFigure(pPath); // #i101491# not needed for first run } - impAddB2DPolygonToGDIPlusGraphicsPathReal(aPath, rPolyPolygon.getB2DPolygon(a), false); - aPath.CloseFigure(); + impAddB2DPolygonToGDIPlusGraphicsPathReal(pPath, rPolyPolygon.getB2DPolygon(a), false); + Gdiplus::DllExports::GdipClosePathFigure(pPath); } if(getAntiAliasB2DDraw()) { - aGraphics.SetSmoothingMode(Gdiplus::SmoothingModeAntiAlias); + Gdiplus::DllExports::GdipSetSmoothingMode(pGraphics, Gdiplus::SmoothingModeAntiAlias); } else { - aGraphics.SetSmoothingMode(Gdiplus::SmoothingModeNone); + Gdiplus::DllExports::GdipSetSmoothingMode(pGraphics, Gdiplus::SmoothingModeNone); } - aGraphics.FillPath(&aTestBrush, &aPath); + Gdiplus::DllExports::GdipFillPath(pGraphics, pTestBrush, pPath); + + Gdiplus::DllExports::GdipDeletePath(pPath); + Gdiplus::DllExports::GdipDeleteGraphics(pGraphics); } return true; @@ -198,11 +201,14 @@ bool WinSalGraphics::drawPolyLine( const basegfx::B2DPolygon& rPolygon, double f if(mbPen && nCount) { - Gdiplus::Graphics aGraphics(mhDC); + Gdiplus::GpGraphics *pGraphics = NULL; + Gdiplus::DllExports::GdipCreateFromHDC(mhDC, &pGraphics); const sal_uInt8 aTrans = (sal_uInt8)basegfx::fround( 255 * (1.0 - fTransparency) ); Gdiplus::Color aTestColor(aTrans, SALCOLOR_RED(maLineColor), SALCOLOR_GREEN(maLineColor), SALCOLOR_BLUE(maLineColor)); - Gdiplus::Pen aTestPen(aTestColor, Gdiplus::REAL(rLineWidths.getX())); - Gdiplus::GraphicsPath aPath; + Gdiplus::GpPen *pTestPen = NULL; + Gdiplus::DllExports::GdipCreatePen1(aTestColor.GetValue(), Gdiplus::REAL(rLineWidths.getX()), Gdiplus::UnitWorld, &pTestPen); + Gdiplus::GpPath *pPath; + Gdiplus::DllExports::GdipCreatePath(Gdiplus::FillModeAlternate, &pPath); bool bNoLineJoin(false); switch(eLineJoin) @@ -217,49 +223,53 @@ bool WinSalGraphics::drawPolyLine( const basegfx::B2DPolygon& rPolygon, double f } case basegfx::B2DLINEJOIN_BEVEL : { - aTestPen.SetLineJoin(Gdiplus::LineJoinBevel); + Gdiplus::DllExports::GdipSetPenLineJoin(pTestPen, Gdiplus::LineJoinBevel); break; } case basegfx::B2DLINEJOIN_MIDDLE : case basegfx::B2DLINEJOIN_MITER : { const Gdiplus::REAL aMiterLimit(15.0); - aTestPen.SetMiterLimit(aMiterLimit); - aTestPen.SetLineJoin(Gdiplus::LineJoinMiter); + Gdiplus::DllExports::GdipSetPenMiterLimit(pTestPen, aMiterLimit); + Gdiplus::DllExports::GdipSetPenLineJoin(pTestPen, Gdiplus::LineJoinMiter); break; } case basegfx::B2DLINEJOIN_ROUND : { - aTestPen.SetLineJoin(Gdiplus::LineJoinRound); + Gdiplus::DllExports::GdipSetPenLineJoin(pTestPen, Gdiplus::LineJoinRound); break; } } if(nCount > 250 && basegfx::fTools::more(rLineWidths.getX(), 1.5)) { - impAddB2DPolygonToGDIPlusGraphicsPathInteger(aPath, rPolygon, bNoLineJoin); + impAddB2DPolygonToGDIPlusGraphicsPathInteger(pPath, rPolygon, bNoLineJoin); } else { - impAddB2DPolygonToGDIPlusGraphicsPathReal(aPath, rPolygon, bNoLineJoin); + impAddB2DPolygonToGDIPlusGraphicsPathReal(pPath, rPolygon, bNoLineJoin); } if(rPolygon.isClosed() && !bNoLineJoin) { // #i101491# needed to create the correct line joins - aPath.CloseFigure(); + Gdiplus::DllExports::GdipClosePathFigure(pPath); } if(getAntiAliasB2DDraw()) { - aGraphics.SetSmoothingMode(Gdiplus::SmoothingModeAntiAlias); + Gdiplus::DllExports::GdipSetSmoothingMode(pGraphics, Gdiplus::SmoothingModeAntiAlias); } else { - aGraphics.SetSmoothingMode(Gdiplus::SmoothingModeNone); + Gdiplus::DllExports::GdipSetSmoothingMode(pGraphics, Gdiplus::SmoothingModeNone); } - aGraphics.DrawPath(&aTestPen, &aPath); + Gdiplus::DllExports::GdipDrawPath(pGraphics, pTestPen, pPath); + + Gdiplus::DllExports::GdipDeletePath(pPath); + Gdiplus::DllExports::GdipDeletePen(pTestPen); + Gdiplus::DllExports::GdipDeleteGraphics(pGraphics); } return true; diff --git a/vcl/win/source/gdi/salprn.cxx b/vcl/win/source/gdi/salprn.cxx index 07a6b633e11b..7fdd77394cc2 100644 --- a/vcl/win/source/gdi/salprn.cxx +++ b/vcl/win/source/gdi/salprn.cxx @@ -39,10 +39,6 @@ #include <tools/urlobj.hxx> -#ifdef __MINGW32__ -#include <excpt.h> -#endif - #include <win/wincomp.hxx> #include <win/saldata.hxx> #include <win/salinst.h> @@ -65,6 +61,10 @@ #include <malloc.h> #ifdef __MINGW32__ +#include <sehandler.hxx> +#endif + +#ifdef __MINGW32__ #define CATCH_DRIVER_EX_BEGIN \ jmp_buf jmpbuf; \ __SEHandler han; \ @@ -110,24 +110,11 @@ static char aImplWindows[] = "windows"; static char aImplDevices[] = "devices"; static char aImplDevice[] = "device"; -static LPDEVMODEA SAL_DEVMODE_A( const ImplJobSetup* pSetupData ) -{ - LPDEVMODEA pRet = NULL; - SalDriverData* pDrv = (SalDriverData*)pSetupData->mpDriverData; - if( pDrv->mnVersion == SAL_DRIVERDATA_VERSION_A && - pSetupData->mnDriverDataLen >= sizeof(DEVMODEA)+sizeof(SalDriverData)-1 - ) - pRet = ((LPDEVMODEA)((pSetupData->mpDriverData) + (pDrv->mnDriverOffset))); - return pRet; -} - static LPDEVMODEW SAL_DEVMODE_W( const ImplJobSetup* pSetupData ) { LPDEVMODEW pRet = NULL; SalDriverData* pDrv = (SalDriverData*)pSetupData->mpDriverData; - if( pDrv->mnVersion == SAL_DRIVERDATA_VERSION_W && - pSetupData->mnDriverDataLen >= sizeof(DEVMODEW)+sizeof(SalDriverData)-1 - ) + if( pSetupData->mnDriverDataLen >= sizeof(DEVMODEW)+sizeof(SalDriverData)-1 ) pRet = ((LPDEVMODEW)((pSetupData->mpDriverData) + (pDrv->mnDriverOffset))); return pRet; } @@ -192,140 +179,8 @@ static sal_uLong ImplWinQueueStatusToSal( DWORD nWinStatus ) // ----------------------------------------------------------------------- -static void getPrinterQueueInfoOldStyle( ImplPrnQueueList* pList ) -{ - DWORD i; - DWORD n; - DWORD nBytes = 0; - DWORD nInfoPrn2; - sal_Bool bFound = FALSE; - PRINTER_INFO_2* pWinInfo2 = NULL; - PRINTER_INFO_2* pGetInfo2; - EnumPrintersA( PRINTER_ENUM_LOCAL, NULL, 2, NULL, 0, &nBytes, &nInfoPrn2 ); - if ( nBytes ) - { - pWinInfo2 = (PRINTER_INFO_2*) rtl_allocateMemory( nBytes ); - if ( EnumPrintersA( PRINTER_ENUM_LOCAL, NULL, 2, (LPBYTE)pWinInfo2, nBytes, &nBytes, &nInfoPrn2 ) ) - { - pGetInfo2 = pWinInfo2; - for ( i = 0; i < nInfoPrn2; i++ ) - { - SalPrinterQueueInfo* pInfo = new SalPrinterQueueInfo; - pInfo->maPrinterName = ImplSalGetUniString( pGetInfo2->pPrinterName ); - pInfo->maDriver = ImplSalGetUniString( pGetInfo2->pDriverName ); - XubString aPortName; - if ( pGetInfo2->pPortName ) - aPortName = ImplSalGetUniString( pGetInfo2->pPortName ); - // pLocation can be 0 (the Windows docu doesn't describe this) - if ( pGetInfo2->pLocation && strlen( pGetInfo2->pLocation ) ) - pInfo->maLocation = ImplSalGetUniString( pGetInfo2->pLocation ); - else - pInfo->maLocation = aPortName; - // pComment can be 0 (the Windows docu doesn't describe this) - if ( pGetInfo2->pComment ) - pInfo->maComment = ImplSalGetUniString( pGetInfo2->pComment ); - pInfo->mnStatus = ImplWinQueueStatusToSal( pGetInfo2->Status ); - pInfo->mnJobs = pGetInfo2->cJobs; - pInfo->mpSysData = new XubString( aPortName ); - pList->Add( pInfo ); - pGetInfo2++; - } - - bFound = TRUE; - } - } - - // read printers from win.ini - // TODO: MSDN: GetProfileString() should not be called from server - // code because it is just there for WIN16 compatibility - UINT nSize = 4096; - char* pBuf = new char[nSize]; - UINT nRead = GetProfileStringA( aImplDevices, NULL, "", pBuf, nSize ); - while ( nRead >= nSize-2 ) - { - nSize += 2048; - delete []pBuf; - pBuf = new char[nSize]; - nRead = GetProfileStringA( aImplDevices, NULL, "", pBuf, nSize ); - } - - // extract printer names from buffer and fill list - char* pName = pBuf; - while ( *pName ) - { - char* pPortName; - char* pTmp; - char aPortBuf[256]; - GetProfileStringA( aImplDevices, pName, "", aPortBuf, sizeof( aPortBuf ) ); - - pPortName = aPortBuf; - - // create name - xub_StrLen nNameLen = sal::static_int_cast<xub_StrLen>(strlen( pName )); - XubString aName( ImplSalGetUniString( pName, nNameLen ) ); - - // get driver name - pTmp = pPortName; - while ( *pTmp != ',' ) - pTmp++; - XubString aDriver( ImplSalGetUniString( pPortName, (sal_uInt16)(pTmp-pPortName) ) ); - pPortName = pTmp; - - // get port names - do - { - pPortName++; - pTmp = pPortName; - while ( *pTmp && (*pTmp != ',') ) - pTmp++; - - String aPortName( ImplSalGetUniString( pPortName, (sal_uInt16)(pTmp-pPortName) ) ); - - // create new entry - // look up if printer was already found in first loop - sal_Bool bAdd = TRUE; - if ( pWinInfo2 ) - { - pGetInfo2 = pWinInfo2; - for ( n = 0; n < nInfoPrn2; n++ ) - { - if ( aName.EqualsIgnoreCaseAscii( pGetInfo2->pPrinterName ) ) - { - bAdd = FALSE; - break; - } - pGetInfo2++; - } - } - // if it's a new printer, add it - if ( bAdd ) - { - SalPrinterQueueInfo* pInfo = new SalPrinterQueueInfo; - pInfo->maPrinterName = aName; - pInfo->maDriver = aDriver; - pInfo->maLocation = aPortName; - pInfo->mnStatus = 0; - pInfo->mnJobs = QUEUE_JOBS_DONTKNOW; - pInfo->mpSysData = new XubString( aPortName ); - pList->Add( pInfo ); - } - } - while ( *pTmp == ',' ); - - pName += nNameLen + 1; - } - - delete []pBuf; - rtl_freeMemory( pWinInfo2 ); -} - void WinSalInstance::GetPrinterQueueInfo( ImplPrnQueueList* pList ) { - if( ! aSalShlData.mbWPrinter ) - { - getPrinterQueueInfoOldStyle( pList ); - return; - } DWORD i; DWORD nBytes = 0; DWORD nInfoPrn4 = 0; @@ -352,59 +207,8 @@ void WinSalInstance::GetPrinterQueueInfo( ImplPrnQueueList* pList ) // ----------------------------------------------------------------------- -static void getPrinterQueueStateOldStyle( SalPrinterQueueInfo* pInfo ) -{ - DWORD nBytes = 0; - DWORD nInfoRet; - PRINTER_INFO_2* pWinInfo2; - EnumPrintersA( PRINTER_ENUM_LOCAL, NULL, 2, NULL, 0, &nBytes, &nInfoRet ); - if ( nBytes ) - { - pWinInfo2 = (PRINTER_INFO_2*) rtl_allocateMemory( nBytes ); - if ( EnumPrintersA( PRINTER_ENUM_LOCAL, NULL, 2, (LPBYTE)pWinInfo2, nBytes, &nBytes, &nInfoRet ) ) - { - PRINTER_INFO_2* pGetInfo2 = pWinInfo2; - for ( DWORD i = 0; i < nInfoRet; i++ ) - { - if ( pInfo->maPrinterName.EqualsAscii( pGetInfo2->pPrinterName ) && - ( pInfo->maDriver.Len() == 0 || - pInfo->maDriver.EqualsAscii( pGetInfo2->pDriverName ) ) - ) - { - XubString aPortName; - if ( pGetInfo2->pPortName ) - aPortName = ImplSalGetUniString( pGetInfo2->pPortName ); - // pLocation can be 0 (the Windows docu doesn't describe this) - if ( pGetInfo2->pLocation && strlen( pGetInfo2->pLocation ) ) - pInfo->maLocation = ImplSalGetUniString( pGetInfo2->pLocation ); - else - pInfo->maLocation = aPortName; - // pComment can be 0 (the Windows docu doesn't describe this) - if ( pGetInfo2->pComment ) - pInfo->maComment = ImplSalGetUniString( pGetInfo2->pComment ); - pInfo->mnStatus = ImplWinQueueStatusToSal( pGetInfo2->Status ); - pInfo->mnJobs = pGetInfo2->cJobs; - if( ! pInfo->mpSysData ) - pInfo->mpSysData = new XubString( aPortName ); - break; - } - - pGetInfo2++; - } - } - - rtl_freeMemory( pWinInfo2 ); - } -} - void WinSalInstance::GetPrinterQueueState( SalPrinterQueueInfo* pInfo ) { - if( ! aSalShlData.mbWPrinter ) - { - getPrinterQueueStateOldStyle( pInfo ); - return; - } - HANDLE hPrinter = 0; LPWSTR pPrnName = reinterpret_cast<LPWSTR>(const_cast<sal_Unicode*>(pInfo->maPrinterName.GetBuffer())); if( OpenPrinterW( pPrnName, &hPrinter, NULL ) ) @@ -451,43 +255,19 @@ void WinSalInstance::DeletePrinterQueueInfo( SalPrinterQueueInfo* pInfo ) // ----------------------------------------------------------------------- XubString WinSalInstance::GetDefaultPrinter() { - static bool bGetDefPrtAPI = true; - static sal_Bool(WINAPI*pGetDefaultPrinter)(LPWSTR,LPDWORD) = NULL; - // try to use GetDefaultPrinter API (not available prior to W2000) - if( bGetDefPrtAPI ) + DWORD nChars = 0; + GetDefaultPrinterW( NULL, &nChars ); + if( nChars ) { - bGetDefPrtAPI = false; - // check for W2k and XP - if( aSalShlData.maVersionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT && aSalShlData.maVersionInfo.dwMajorVersion >= 5 ) + LPWSTR pStr = (LPWSTR)rtl_allocateMemory(nChars*sizeof(WCHAR)); + XubString aDefPrt; + if( GetDefaultPrinterW( pStr, &nChars ) ) { - OUString aLibraryName( RTL_CONSTASCII_USTRINGPARAM( "winspool.drv" ) ); - oslModule pLib = osl_loadModule( aLibraryName.pData, SAL_LOADMODULE_DEFAULT ); - oslGenericFunction pFunc = NULL; - if( pLib ) - { - OUString queryFuncName( RTL_CONSTASCII_USTRINGPARAM( "GetDefaultPrinterW" ) ); - pFunc = osl_getFunctionSymbol( pLib, queryFuncName.pData ); - } - - pGetDefaultPrinter = (sal_Bool(WINAPI*)(LPWSTR,LPDWORD)) pFunc; - } - } - if( pGetDefaultPrinter ) - { - DWORD nChars = 0; - pGetDefaultPrinter( NULL, &nChars ); - if( nChars ) - { - LPWSTR pStr = (LPWSTR)rtl_allocateMemory(nChars*sizeof(WCHAR)); - XubString aDefPrt; - if( pGetDefaultPrinter( pStr, &nChars ) ) - { - aDefPrt = reinterpret_cast<sal_Unicode* >(pStr); - } - rtl_freeMemory( pStr ); - if( aDefPrt.Len() ) - return aDefPrt; + aDefPrt = reinterpret_cast<sal_Unicode* >(pStr); } + rtl_freeMemory( pStr ); + if( aDefPrt.Len() ) + return aDefPrt; } // get default printer from win.ini @@ -511,30 +291,15 @@ XubString WinSalInstance::GetDefaultPrinter() static DWORD ImplDeviceCaps( WinSalInfoPrinter* pPrinter, WORD nCaps, BYTE* pOutput, const ImplJobSetup* pSetupData ) { - if( aSalShlData.mbWPrinter ) - { - DEVMODEW* pDevMode; - if ( !pSetupData || !pSetupData->mpDriverData ) - pDevMode = NULL; - else - pDevMode = SAL_DEVMODE_W( pSetupData ); - - return DeviceCapabilitiesW( reinterpret_cast<LPCWSTR>(pPrinter->maDeviceName.GetBuffer()), - reinterpret_cast<LPCWSTR>(pPrinter->maPortName.GetBuffer()), - nCaps, (LPWSTR)pOutput, pDevMode ); - } + DEVMODEW* pDevMode; + if ( !pSetupData || !pSetupData->mpDriverData ) + pDevMode = NULL; else - { - DEVMODEA* pDevMode; - if ( !pSetupData || !pSetupData->mpDriverData ) - pDevMode = NULL; - else - pDevMode = SAL_DEVMODE_A( pSetupData ); + pDevMode = SAL_DEVMODE_W( pSetupData ); - return DeviceCapabilitiesA( ImplSalGetWinAnsiString( pPrinter->maDeviceName, TRUE ).GetBuffer(), - ImplSalGetWinAnsiString( pPrinter->maPortName, TRUE ).GetBuffer(), - nCaps, (LPSTR)pOutput, pDevMode ); - } + return DeviceCapabilitiesW( reinterpret_cast<LPCWSTR>(pPrinter->maDeviceName.GetBuffer()), + reinterpret_cast<LPCWSTR>(pPrinter->maPortName.GetBuffer()), + nCaps, (LPWSTR)pOutput, pDevMode ); } // ----------------------------------------------------------------------- @@ -549,25 +314,15 @@ static sal_Bool ImplTestSalJobSetup( WinSalInfoPrinter* pPrinter, // initialize versions from jobsetup // those will be overwritten with driver's version - DEVMODEA* pDevModeA = NULL; DEVMODEW* pDevModeW = NULL; LONG dmSpecVersion = -1; LONG dmDriverVersion = -1; SalDriverData* pSalDriverData = (SalDriverData*)pSetupData->mpDriverData; BYTE* pDriverData = ((BYTE*)pSalDriverData) + pSalDriverData->mnDriverOffset; - if( pSalDriverData->mnVersion == SAL_DRIVERDATA_VERSION_W ) - { - if( aSalShlData.mbWPrinter ) - pDevModeW = (DEVMODEW*)pDriverData; - } - else if( pSalDriverData->mnVersion == SAL_DRIVERDATA_VERSION_A ) - { - if( ! aSalShlData.mbWPrinter ) - pDevModeA = (DEVMODEA*)pDriverData; - } + pDevModeW = (DEVMODEW*)pDriverData; long nSysJobSize = -1; - if( pPrinter && ( pDevModeA || pDevModeW ) ) + if( pPrinter && pDevModeW ) { // just too many driver crashes in that area -> check the dmSpecVersion and dmDriverVersion fields always !!! // this prevents using the jobsetup between different Windows versions (eg from XP to 9x) but we @@ -576,31 +331,16 @@ static sal_Bool ImplTestSalJobSetup( WinSalInfoPrinter* pPrinter, ByteString aPrinterNameA= ImplSalGetWinAnsiString( pPrinter->maDeviceName, TRUE ); HANDLE hPrn; LPWSTR pPrinterNameW = reinterpret_cast<LPWSTR>(const_cast<sal_Unicode*>(pPrinter->maDeviceName.GetBuffer())); - if ( ! aSalShlData.mbWPrinter ) - { - if ( !OpenPrinterA( (LPSTR)aPrinterNameA.GetBuffer(), &hPrn, NULL ) ) - return FALSE; - } - else - if ( !OpenPrinterW( pPrinterNameW, &hPrn, NULL ) ) - return FALSE; + if ( !OpenPrinterW( pPrinterNameW, &hPrn, NULL ) ) + return FALSE; // #131642# hPrn==HGDI_ERROR even though OpenPrinter() succeeded! if( hPrn == HGDI_ERROR ) return FALSE; - if( aSalShlData.mbWPrinter ) - { - nSysJobSize = DocumentPropertiesW( 0, hPrn, - pPrinterNameW, - NULL, NULL, 0 ); - } - else - { - nSysJobSize = DocumentPropertiesA( 0, hPrn, - (LPSTR)aPrinterNameA.GetBuffer(), - NULL, NULL, 0 ); - } + nSysJobSize = DocumentPropertiesW( 0, hPrn, + pPrinterNameW, + NULL, NULL, 0 ); if( nSysJobSize < 0 ) { @@ -609,18 +349,9 @@ static sal_Bool ImplTestSalJobSetup( WinSalInfoPrinter* pPrinter, } BYTE *pBuffer = (BYTE*)_alloca( nSysJobSize ); LONG nRet = -1; - if( aSalShlData.mbWPrinter ) - { - nRet = DocumentPropertiesW( 0, hPrn, - pPrinterNameW, - (LPDEVMODEW)pBuffer, NULL, DM_OUT_BUFFER ); - } - else - { - nRet = DocumentPropertiesA( 0, hPrn, - (LPSTR)aPrinterNameA.GetBuffer(), - (LPDEVMODEA)pBuffer, NULL, DM_OUT_BUFFER ); - } + nRet = DocumentPropertiesW( 0, hPrn, + pPrinterNameW, + (LPDEVMODEW)pBuffer, NULL, DM_OUT_BUFFER ); if( nRet < 0 ) { ClosePrinter( hPrn ); @@ -630,8 +361,8 @@ static sal_Bool ImplTestSalJobSetup( WinSalInfoPrinter* pPrinter, // the spec version differs between the windows platforms, ie 98,NT,2000/XP // this allows us to throw away printer settings from other platforms that might crash a buggy driver // we check the driver version as well - dmSpecVersion = aSalShlData.mbWPrinter ? ((DEVMODEW*)pBuffer)->dmSpecVersion : ((DEVMODEA*)pBuffer)->dmSpecVersion; - dmDriverVersion = aSalShlData.mbWPrinter ? ((DEVMODEW*)pBuffer)->dmDriverVersion : ((DEVMODEA*)pBuffer)->dmDriverVersion; + dmSpecVersion = ((DEVMODEW*)pBuffer)->dmSpecVersion; + dmDriverVersion = ((DEVMODEW*)pBuffer)->dmDriverVersion; ClosePrinter( hPrn ); } @@ -642,10 +373,6 @@ static sal_Bool ImplTestSalJobSetup( WinSalInfoPrinter* pPrinter, (long)(pSetupData->mnDriverDataLen - pSetupDriverData->mnDriverOffset) == nSysJobSize && pSetupDriverData->mnSysSignature == SAL_DRIVERDATA_SYSSIGN ) { - if( pDevModeA && - (dmSpecVersion == pDevModeA->dmSpecVersion) && - (dmDriverVersion == pDevModeA->dmDriverVersion) ) - return TRUE; if( pDevModeW && (dmSpecVersion == pDevModeW->dmSpecVersion) && (dmDriverVersion == pDevModeW->dmDriverVersion) ) @@ -670,16 +397,8 @@ static sal_Bool ImplUpdateSalJobSetup( WinSalInfoPrinter* pPrinter, ImplJobSetup ByteString aPrinterNameA = ImplSalGetWinAnsiString( pPrinter->maDeviceName, TRUE ); HANDLE hPrn; LPWSTR pPrinterNameW = reinterpret_cast<LPWSTR>(const_cast<sal_Unicode*>(pPrinter->maDeviceName.GetBuffer())); - if( aSalShlData.mbWPrinter ) - { - if ( !OpenPrinterW( pPrinterNameW, &hPrn, NULL ) ) - return FALSE; - } - else - { - if ( !OpenPrinterA( (LPSTR)aPrinterNameA.GetBuffer(), &hPrn, NULL ) ) - return FALSE; - } + if ( !OpenPrinterW( pPrinterNameW, &hPrn, NULL ) ) + return FALSE; // #131642# hPrn==HGDI_ERROR even though OpenPrinter() succeeded! if( hPrn == HGDI_ERROR ) return FALSE; @@ -692,16 +411,9 @@ static sal_Bool ImplUpdateSalJobSetup( WinSalInfoPrinter* pPrinter, ImplJobSetup SalDriverData* pOutBuffer = NULL; BYTE* pInBuffer = NULL; - if( aSalShlData.mbWPrinter ) - { - nSysJobSize = DocumentPropertiesW( hWnd, hPrn, - pPrinterNameW, - NULL, NULL, 0 ); - } - else - nSysJobSize = DocumentPropertiesA( hWnd, hPrn, - (LPSTR)ImplSalGetWinAnsiString( pPrinter->maDeviceName, TRUE ).GetBuffer(), - NULL, NULL, 0 ); + nSysJobSize = DocumentPropertiesW( hWnd, hPrn, + pPrinterNameW, + NULL, NULL, 0 ); if ( nSysJobSize < 0 ) { ClosePrinter( hPrn ); @@ -712,7 +424,6 @@ static sal_Bool ImplUpdateSalJobSetup( WinSalInfoPrinter* pPrinter, ImplJobSetup nDriverDataLen = sizeof(SalDriverData) + nSysJobSize-1; pOutBuffer = (SalDriverData*)rtl_allocateZeroMemory( nDriverDataLen ); pOutBuffer->mnSysSignature = SAL_DRIVERDATA_SYSSIGN; - pOutBuffer->mnVersion = aSalShlData.mbWPrinter ? SAL_DRIVERDATA_VERSION_W : SAL_DRIVERDATA_VERSION_A; // calculate driver data offset including structure padding pOutBuffer->mnDriverOffset = sal::static_int_cast<sal_uInt16>( (char*)pOutBuffer->maDriverData - @@ -738,18 +449,9 @@ static sal_Bool ImplUpdateSalJobSetup( WinSalInfoPrinter* pPrinter, ImplJobSetup nMutexCount = ImplSalReleaseYieldMutex(); BYTE* pOutDevMode = (((BYTE*)pOutBuffer) + pOutBuffer->mnDriverOffset); - if( aSalShlData.mbWPrinter ) - { - nRet = DocumentPropertiesW( hWnd, hPrn, - pPrinterNameW, - (LPDEVMODEW)pOutDevMode, (LPDEVMODEW)pInBuffer, nMode ); - } - else - { - nRet = DocumentPropertiesA( hWnd, hPrn, - (LPSTR)ImplSalGetWinAnsiString( pPrinter->maDeviceName, TRUE ).GetBuffer(), - (LPDEVMODEA)pOutDevMode, (LPDEVMODEA)pInBuffer, nMode ); - } + nRet = DocumentPropertiesW( hWnd, hPrn, + pPrinterNameW, + (LPDEVMODEW)pOutDevMode, (LPDEVMODEW)pInBuffer, nMode ); if ( pVisibleDlgParent ) ImplSalAcquireYieldMutex( nMutexCount ); ClosePrinter( hPrn ); @@ -761,35 +463,17 @@ static sal_Bool ImplUpdateSalJobSetup( WinSalInfoPrinter* pPrinter, ImplJobSetup } // fill up string buffers with 0 so they do not influence a JobSetup's memcmp - if( aSalShlData.mbWPrinter ) + if( ((LPDEVMODEW)pOutDevMode)->dmSize >= 64 ) { - if( ((LPDEVMODEW)pOutDevMode)->dmSize >= 64 ) - { - sal_Int32 nLen = rtl_ustr_getLength( (const sal_Unicode*)((LPDEVMODEW)pOutDevMode)->dmDeviceName ); - if ( nLen < sizeof( ((LPDEVMODEW)pOutDevMode)->dmDeviceName )/sizeof(sal_Unicode) ) - memset( ((LPDEVMODEW)pOutDevMode)->dmDeviceName+nLen, 0, sizeof( ((LPDEVMODEW)pOutDevMode)->dmDeviceName )-(nLen*sizeof(sal_Unicode)) ); - } - if( ((LPDEVMODEW)pOutDevMode)->dmSize >= 166 ) - { - sal_Int32 nLen = rtl_ustr_getLength( (const sal_Unicode*)((LPDEVMODEW)pOutDevMode)->dmFormName ); - if ( nLen < sizeof( ((LPDEVMODEW)pOutDevMode)->dmFormName )/sizeof(sal_Unicode) ) - memset( ((LPDEVMODEW)pOutDevMode)->dmFormName+nLen, 0, sizeof( ((LPDEVMODEW)pOutDevMode)->dmFormName )-(nLen*sizeof(sal_Unicode)) ); - } + sal_Int32 nLen = rtl_ustr_getLength( (const sal_Unicode*)((LPDEVMODEW)pOutDevMode)->dmDeviceName ); + if ( nLen < sizeof( ((LPDEVMODEW)pOutDevMode)->dmDeviceName )/sizeof(sal_Unicode) ) + memset( ((LPDEVMODEW)pOutDevMode)->dmDeviceName+nLen, 0, sizeof( ((LPDEVMODEW)pOutDevMode)->dmDeviceName )-(nLen*sizeof(sal_Unicode)) ); } - else + if( ((LPDEVMODEW)pOutDevMode)->dmSize >= 166 ) { - if( ((LPDEVMODEA)pOutDevMode)->dmSize >= 32 ) - { - sal_Int32 nLen = strlen( (const char*)((LPDEVMODEA)pOutDevMode)->dmDeviceName ); - if ( nLen < sizeof( ((LPDEVMODEA)pOutDevMode)->dmDeviceName ) ) - memset( ((LPDEVMODEA)pOutDevMode)->dmDeviceName+nLen, 0, sizeof( ((LPDEVMODEA)pOutDevMode)->dmDeviceName )-nLen ); - } - if( ((LPDEVMODEA)pOutDevMode)->dmSize >= 102 ) - { - sal_Int32 nLen = strlen( (const char*)((LPDEVMODEA)pOutDevMode)->dmFormName ); - if ( nLen < sizeof( ((LPDEVMODEA)pOutDevMode)->dmFormName ) ) - memset( ((LPDEVMODEA)pOutDevMode)->dmFormName+nLen, 0, sizeof( ((LPDEVMODEA)pOutDevMode)->dmFormName )-nLen ); - } + sal_Int32 nLen = rtl_ustr_getLength( (const sal_Unicode*)((LPDEVMODEW)pOutDevMode)->dmFormName ); + if ( nLen < sizeof( ((LPDEVMODEW)pOutDevMode)->dmFormName )/sizeof(sal_Unicode) ) + memset( ((LPDEVMODEW)pOutDevMode)->dmFormName+nLen, 0, sizeof( ((LPDEVMODEW)pOutDevMode)->dmFormName )-(nLen*sizeof(sal_Unicode)) ); } // update data @@ -805,13 +489,12 @@ static sal_Bool ImplUpdateSalJobSetup( WinSalInfoPrinter* pPrinter, ImplJobSetup // ----------------------------------------------------------------------- #define DECLARE_DEVMODE( i )\ - DEVMODEA* pDevModeA = SAL_DEVMODE_A(i);\ DEVMODEW* pDevModeW = SAL_DEVMODE_W(i);\ - if( pDevModeA == NULL && pDevModeW == NULL )\ + if( pDevModeW == NULL )\ return #define CHOOSE_DEVMODE(i)\ - (pDevModeW ? pDevModeW->i : pDevModeA->i) + (pDevModeW->i) static void ImplDevModeToJobSetup( WinSalInfoPrinter* pPrinter, ImplJobSetup* pSetupData, sal_uLong nFlags ) { @@ -1379,75 +1062,27 @@ static HDC ImplCreateICW_WithCatch( LPWSTR pDriver, return hDC; } -static HDC ImplCreateICA_WithCatch( char* pDriver, - char* pDevice, - LPDEVMODEA pDevMode ) -{ - HDC hDC = 0; - CATCH_DRIVER_EX_BEGIN; - hDC = CreateICA( pDriver, pDevice, 0, pDevMode ); - CATCH_DRIVER_EX_END_2( "exception in CreateICW" ); - return hDC; -} - - static HDC ImplCreateSalPrnIC( WinSalInfoPrinter* pPrinter, ImplJobSetup* pSetupData ) { HDC hDC = 0; - if( aSalShlData.mbWPrinter ) - { - LPDEVMODEW pDevMode; - if ( pSetupData && pSetupData->mpDriverData ) - pDevMode = SAL_DEVMODE_W( pSetupData ); - else - pDevMode = NULL; - // #95347 some buggy drivers (eg, OKI) write to those buffers in CreateIC, although declared const - so provide some space - // pl: does this hold true for Unicode functions ? - if( pPrinter->maDriverName.Len() > 2048 || pPrinter->maDeviceName.Len() > 2048 ) - return 0; - sal_Unicode pDriverName[ 4096 ]; - sal_Unicode pDeviceName[ 4096 ]; - rtl_copyMemory( pDriverName, pPrinter->maDriverName.GetBuffer(), pPrinter->maDriverName.Len()*sizeof(sal_Unicode)); - memset( pDriverName+pPrinter->maDriverName.Len(), 0, 32 ); - rtl_copyMemory( pDeviceName, pPrinter->maDeviceName.GetBuffer(), pPrinter->maDeviceName.Len()*sizeof(sal_Unicode)); - memset( pDeviceName+pPrinter->maDeviceName.Len(), 0, 32 ); - hDC = ImplCreateICW_WithCatch( reinterpret_cast< LPWSTR >(pDriverName), - reinterpret_cast< LPCWSTR >(pDeviceName), - pDevMode ); - } + LPDEVMODEW pDevMode; + if ( pSetupData && pSetupData->mpDriverData ) + pDevMode = SAL_DEVMODE_W( pSetupData ); else - { - LPDEVMODEA pDevMode; - if ( pSetupData && pSetupData->mpDriverData ) - pDevMode = SAL_DEVMODE_A( pSetupData ); - else - pDevMode = NULL; - // #95347 some buggy drivers (eg, OKI) write to those buffers in CreateIC, although declared const - so provide some space - ByteString aDriver ( ImplSalGetWinAnsiString( pPrinter->maDriverName, TRUE ) ); - ByteString aDevice ( ImplSalGetWinAnsiString( pPrinter->maDeviceName, TRUE ) ); - int n = aDriver.Len() > aDevice.Len() ? aDriver.Len() : aDevice.Len(); - // #125813# under some circumstances many printer drivers really - // seem to have a problem with the names and their conversions. - // We need to get on to of this, but haven't been able to reproduce - // the problem yet. Put the names on the stack so we get them - // with an eventual crash report. - if( n >= 2048 ) - return 0; - n += 2048; - char lpszDriverName[ 4096 ]; - char lpszDeviceName[ 4096 ]; - strncpy( lpszDriverName, aDriver.GetBuffer(), n ); - strncpy( lpszDeviceName, aDevice.GetBuffer(), n ); - // HDU: the crashes usually happen in a MBCS to unicode conversion, - // so I suspect the MBCS string's end is not properly recognized. - // The longest MBCS encoding I'm aware of has six bytes per code - // => add a couple of zeroes... - memset( lpszDriverName+aDriver.Len(), 0, 16 ); - memset( lpszDeviceName+aDevice.Len(), 0, 16 ); - hDC = ImplCreateICA_WithCatch( lpszDriverName, - lpszDeviceName, - pDevMode ); - } + pDevMode = NULL; + // #95347 some buggy drivers (eg, OKI) write to those buffers in CreateIC, although declared const - so provide some space + // pl: does this hold true for Unicode functions ? + if( pPrinter->maDriverName.Len() > 2048 || pPrinter->maDeviceName.Len() > 2048 ) + return 0; + sal_Unicode pDriverName[ 4096 ]; + sal_Unicode pDeviceName[ 4096 ]; + rtl_copyMemory( pDriverName, pPrinter->maDriverName.GetBuffer(), pPrinter->maDriverName.Len()*sizeof(sal_Unicode)); + memset( pDriverName+pPrinter->maDriverName.Len(), 0, 32 ); + rtl_copyMemory( pDeviceName, pPrinter->maDeviceName.GetBuffer(), pPrinter->maDeviceName.Len()*sizeof(sal_Unicode)); + memset( pDeviceName+pPrinter->maDeviceName.Len(), 0, 32 ); + hDC = ImplCreateICW_WithCatch( reinterpret_cast< LPWSTR >(pDriverName), + reinterpret_cast< LPCWSTR >(pDeviceName), + pDevMode ); return hDC; } @@ -1567,28 +1202,14 @@ void WinSalInfoPrinter::InitPaperFormats( const ImplJobSetup* pSetupData ) pPaperSizes = (POINT*)rtl_allocateZeroMemory(nCount*sizeof(POINT)); ImplDeviceCaps( this, DC_PAPERSIZE, (BYTE*)pPaperSizes, pSetupData ); - if( aSalShlData.mbWPrinter ) + sal_Unicode* pNamesBuffer = (sal_Unicode*)rtl_allocateMemory(nCount*64*sizeof(sal_Unicode)); + ImplDeviceCaps( this, DC_PAPERNAMES, (BYTE*)pNamesBuffer, pSetupData ); + for( DWORD i = 0; i < nCount; ++i ) { - sal_Unicode* pNamesBuffer = (sal_Unicode*)rtl_allocateMemory(nCount*64*sizeof(sal_Unicode)); - ImplDeviceCaps( this, DC_PAPERNAMES, (BYTE*)pNamesBuffer, pSetupData ); - for( DWORD i = 0; i < nCount; ++i ) - { - PaperInfo aInfo(pPaperSizes[i].x * 10, pPaperSizes[i].y * 10); - m_aPaperFormats.push_back( aInfo ); - } - rtl_freeMemory( pNamesBuffer ); - } - else - { - char* pNamesBuffer = (char*)rtl_allocateMemory(nCount*64); - ImplDeviceCaps( this, DC_PAPERNAMES, (BYTE*)pNamesBuffer, pSetupData ); - for( DWORD i = 0; i < nCount; ++i ) - { - PaperInfo aInfo(pPaperSizes[i].x * 10, pPaperSizes[i].y * 10); - m_aPaperFormats.push_back( aInfo ); - } - rtl_freeMemory( pNamesBuffer ); + PaperInfo aInfo(pPaperSizes[i].x * 10, pPaperSizes[i].y * 10); + m_aPaperFormats.push_back( aInfo ); } + rtl_freeMemory( pNamesBuffer ); rtl_freeMemory( pPaperSizes ); } @@ -1683,22 +1304,11 @@ XubString WinSalInfoPrinter::GetPaperBinName( const ImplJobSetup* pSetupData, sa DWORD nBins = ImplDeviceCaps( this, DC_BINNAMES, NULL, pSetupData ); if ( (nPaperBin < nBins) && (nBins != GDI_ERROR) ) { - if( aSalShlData.mbWPrinter ) - { - sal_Unicode* pBuffer = new sal_Unicode[nBins*24]; - DWORD nRet = ImplDeviceCaps( this, DC_BINNAMES, (BYTE*)pBuffer, pSetupData ); - if ( nRet && (nRet != GDI_ERROR) ) - aPaperBinName = pBuffer + (nPaperBin*24); - delete [] pBuffer; - } - else - { - char* pBuffer = new char[nBins*24]; - DWORD nRet = ImplDeviceCaps( this, DC_BINNAMES, (BYTE*)pBuffer, pSetupData ); - if ( nRet && (nRet != GDI_ERROR) ) - aPaperBinName = ImplSalGetUniString( (const char*)(pBuffer + (nPaperBin*24)) ); - delete [] pBuffer; - } + sal_Unicode* pBuffer = new sal_Unicode[nBins*24]; + DWORD nRet = ImplDeviceCaps( this, DC_BINNAMES, (BYTE*)pBuffer, pSetupData ); + if ( nRet && (nRet != GDI_ERROR) ) + aPaperBinName = pBuffer + (nPaperBin*24); + delete [] pBuffer; } return aPaperBinName; @@ -1832,29 +1442,6 @@ BOOL CALLBACK SalPrintAbortProc( HDC hPrnDC, int /* nError */ ) // ----------------------------------------------------------------------- -static LPDEVMODEA ImplSalSetCopies( LPDEVMODEA pDevMode, sal_uLong nCopies, sal_Bool bCollate ) -{ - LPDEVMODEA pNewDevMode = pDevMode; - if ( pDevMode && (nCopies > 1) ) - { - if ( nCopies > 32765 ) - nCopies = 32765; - sal_uLong nDevSize = pDevMode->dmSize+pDevMode->dmDriverExtra; - pNewDevMode = (LPDEVMODEA)rtl_allocateMemory( nDevSize ); - memcpy( pNewDevMode, pDevMode, nDevSize ); - pDevMode = pNewDevMode; - pDevMode->dmFields |= DM_COPIES; - pDevMode->dmCopies = (short)(sal_uInt16)nCopies; - pDevMode->dmFields |= DM_COLLATE; - if ( bCollate ) - pDevMode->dmCollate = DMCOLLATE_TRUE; - else - pDevMode->dmCollate = DMCOLLATE_FALSE; - } - - return pNewDevMode; -} - static LPDEVMODEW ImplSalSetCopies( LPDEVMODEW pDevMode, sal_uLong nCopies, sal_Bool bCollate ) { LPDEVMODEW pNewDevMode = pDevMode; @@ -1951,15 +1538,6 @@ static int lcl_StartDocW( HDC hDC, DOCINFOW* pInfo, WinSalPrinter* pPrt ) return nRet; } -static int lcl_StartDocA( HDC hDC, DOCINFOA* pInfo, WinSalPrinter* pPrt ) -{ - int nRet = 0; - CATCH_DRIVER_EX_BEGIN; - nRet = ::StartDocA( hDC, pInfo ); - CATCH_DRIVER_EX_END( "exception in StartDocW", pPrt ); - return nRet; -} - sal_Bool WinSalPrinter::StartJob( const XubString* pFileName, const XubString& rJobName, const XubString&, @@ -1973,65 +1551,28 @@ sal_Bool WinSalPrinter::StartJob( const XubString* pFileName, mnCopies = nCopies; mbCollate = bCollate; - LPDEVMODEA pOrgDevModeA = NULL; - LPDEVMODEA pDevModeA = NULL; LPDEVMODEW pOrgDevModeW = NULL; LPDEVMODEW pDevModeW = NULL; HDC hDC = 0; - if( aSalShlData.mbWPrinter ) - { - if ( pSetupData && pSetupData->mpDriverData ) - { - pOrgDevModeW = SAL_DEVMODE_W( pSetupData ); - pDevModeW = ImplSalSetCopies( pOrgDevModeW, nCopies, bCollate ); - } - else - pDevModeW = NULL; - - // #95347 some buggy drivers (eg, OKI) write to those buffers in CreateDC, although declared const - so provide some space - sal_Unicode aDrvBuf[4096]; - sal_Unicode aDevBuf[4096]; - rtl_copyMemory( aDrvBuf, mpInfoPrinter->maDriverName.GetBuffer(), (mpInfoPrinter->maDriverName.Len()+1)*sizeof(sal_Unicode)); - rtl_copyMemory( aDevBuf, mpInfoPrinter->maDeviceName.GetBuffer(), (mpInfoPrinter->maDeviceName.Len()+1)*sizeof(sal_Unicode)); - hDC = CreateDCW( reinterpret_cast<LPCWSTR>(aDrvBuf), - reinterpret_cast<LPCWSTR>(aDevBuf), - NULL, - pDevModeW ); - - if ( pDevModeW != pOrgDevModeW ) - rtl_freeMemory( pDevModeW ); - } - else + if ( pSetupData && pSetupData->mpDriverData ) { - if ( pSetupData && pSetupData->mpDriverData ) - { - pOrgDevModeA = SAL_DEVMODE_A( pSetupData ); - pDevModeA = ImplSalSetCopies( pOrgDevModeA, nCopies, bCollate ); - } - else - pDevModeA = NULL; - - // #95347 some buggy drivers (eg, OKI) write to those buffers in CreateDC, although declared const - so provide some space - ByteString aDriver ( ImplSalGetWinAnsiString( mpInfoPrinter->maDriverName, TRUE ) ); - ByteString aDevice ( ImplSalGetWinAnsiString( mpInfoPrinter->maDeviceName, TRUE ) ); - int n = aDriver.Len() > aDevice.Len() ? aDriver.Len() : aDevice.Len(); - n += 2048; - char *lpszDriverName = new char[n]; - char *lpszDeviceName = new char[n]; - strncpy( lpszDriverName, aDriver.GetBuffer(), n ); - strncpy( lpszDeviceName, aDevice.GetBuffer(), n ); - hDC = CreateDCA( lpszDriverName, - lpszDeviceName, - NULL, - pDevModeA ); - - delete [] lpszDriverName; - delete [] lpszDeviceName; - - if ( pDevModeA != pOrgDevModeA ) - rtl_freeMemory( pDevModeA ); + pOrgDevModeW = SAL_DEVMODE_W( pSetupData ); + pDevModeW = ImplSalSetCopies( pOrgDevModeW, nCopies, bCollate ); } + // #95347 some buggy drivers (eg, OKI) write to those buffers in CreateDC, although declared const - so provide some space + sal_Unicode aDrvBuf[4096]; + sal_Unicode aDevBuf[4096]; + rtl_copyMemory( aDrvBuf, mpInfoPrinter->maDriverName.GetBuffer(), (mpInfoPrinter->maDriverName.Len()+1)*sizeof(sal_Unicode)); + rtl_copyMemory( aDevBuf, mpInfoPrinter->maDeviceName.GetBuffer(), (mpInfoPrinter->maDeviceName.Len()+1)*sizeof(sal_Unicode)); + hDC = CreateDCW( reinterpret_cast<LPCWSTR>(aDrvBuf), + reinterpret_cast<LPCWSTR>(aDevBuf), + NULL, + pDevModeW ); + + if ( pDevModeW != pOrgDevModeW ) + rtl_freeMemory( pDevModeW ); + if ( !hDC ) { mnError = SAL_PRINTER_ERROR_GENERALERROR; @@ -2112,71 +1653,33 @@ sal_Bool WinSalPrinter::StartJob( const XubString* pFileName, } } - if( aSalShlData.mbWPrinter ) + DOCINFOW aInfo; + memset( &aInfo, 0, sizeof( DOCINFOW ) ); + aInfo.cbSize = sizeof( aInfo ); + aInfo.lpszDocName = (LPWSTR)rJobName.GetBuffer(); + if ( pFileName || aOutFileName.getLength() ) { - DOCINFOW aInfo; - memset( &aInfo, 0, sizeof( DOCINFOW ) ); - aInfo.cbSize = sizeof( aInfo ); - aInfo.lpszDocName = (LPWSTR)rJobName.GetBuffer(); - if ( pFileName || aOutFileName.getLength() ) + if ( (pFileName && pFileName->Len()) || aOutFileName.getLength() ) { - if ( (pFileName && pFileName->Len()) || aOutFileName.getLength() ) - { - aInfo.lpszOutput = (LPWSTR)( (pFileName && pFileName->Len()) ? pFileName->GetBuffer() : aOutFileName.getStr()); - } - else - aInfo.lpszOutput = L"FILE:"; + aInfo.lpszOutput = (LPWSTR)( (pFileName && pFileName->Len()) ? pFileName->GetBuffer() : aOutFileName.getStr()); } else - aInfo.lpszOutput = NULL; - - // start Job - int nRet = lcl_StartDocW( hDC, &aInfo, this ); - - if ( nRet <= 0 ) - { - long nError = GetLastError(); - if ( (nRet == SP_USERABORT) || (nRet == SP_APPABORT) || (nError == ERROR_PRINT_CANCELLED) || (nError == ERROR_CANCELLED) ) - mnError = SAL_PRINTER_ERROR_ABORT; - else - mnError = SAL_PRINTER_ERROR_GENERALERROR; - return FALSE; - } + aInfo.lpszOutput = L"FILE:"; } else + aInfo.lpszOutput = NULL; + + // start Job + int nRet = lcl_StartDocW( hDC, &aInfo, this ); + + if ( nRet <= 0 ) { - // Both strings must exist, if StartJob() is called - ByteString aJobName( ImplSalGetWinAnsiString( rJobName, TRUE ) ); - ByteString aFileName; - - DOCINFOA aInfo; - memset( &aInfo, 0, sizeof( DOCINFOA ) ); - aInfo.cbSize = sizeof( aInfo ); - aInfo.lpszDocName = (LPCSTR)aJobName.GetBuffer(); - if ( pFileName || aOutFileName.getLength() ) - { - if ( pFileName->Len() || aOutFileName.getLength() ) - { - aFileName = ImplSalGetWinAnsiString( pFileName ? *pFileName : static_cast<const XubString>(aOutFileName), TRUE ); - aInfo.lpszOutput = (LPCSTR)aFileName.GetBuffer(); - } - else - aInfo.lpszOutput = "FILE:"; - } + long nError = GetLastError(); + if ( (nRet == SP_USERABORT) || (nRet == SP_APPABORT) || (nError == ERROR_PRINT_CANCELLED) || (nError == ERROR_CANCELLED) ) + mnError = SAL_PRINTER_ERROR_ABORT; else - aInfo.lpszOutput = NULL; - - // start Job - int nRet = lcl_StartDocA( hDC, &aInfo, this ); - if ( nRet <= 0 ) - { - long nError = GetLastError(); - if ( (nRet == SP_USERABORT) || (nRet == SP_APPABORT) || (nError == ERROR_PRINT_CANCELLED) || (nError == ERROR_CANCELLED) ) - mnError = SAL_PRINTER_ERROR_ABORT; - else - mnError = SAL_PRINTER_ERROR_GENERALERROR; - return FALSE; - } + mnError = SAL_PRINTER_ERROR_GENERALERROR; + return FALSE; } return TRUE; @@ -2285,26 +1788,13 @@ SalGraphics* WinSalPrinter::StartPage( ImplJobSetup* pSetupData, sal_Bool bNewJo HDC hDC = mhDC; if ( pSetupData && pSetupData->mpDriverData && bNewJobData ) { - if( aSalShlData.mbWPrinter ) - { - LPDEVMODEW pOrgDevModeW; - LPDEVMODEW pDevModeW; - pOrgDevModeW = SAL_DEVMODE_W( pSetupData ); - pDevModeW = ImplSalSetCopies( pOrgDevModeW, mnCopies, mbCollate ); - ResetDCW( hDC, pDevModeW ); - if ( pDevModeW != pOrgDevModeW ) - rtl_freeMemory( pDevModeW ); - } - else - { - LPDEVMODEA pOrgDevModeA; - LPDEVMODEA pDevModeA; - pOrgDevModeA = SAL_DEVMODE_A( pSetupData ); - pDevModeA = ImplSalSetCopies( pOrgDevModeA, mnCopies, mbCollate ); - ResetDCA( hDC, pDevModeA ); - if ( pDevModeA != pOrgDevModeA ) - rtl_freeMemory( pDevModeA ); - } + LPDEVMODEW pOrgDevModeW; + LPDEVMODEW pDevModeW; + pOrgDevModeW = SAL_DEVMODE_W( pSetupData ); + pDevModeW = ImplSalSetCopies( pOrgDevModeW, mnCopies, mbCollate ); + ResetDCW( hDC, pDevModeW ); + if ( pDevModeW != pOrgDevModeW ) + rtl_freeMemory( pDevModeW ); } int nRet = 0; CATCH_DRIVER_EX_BEGIN; diff --git a/vcl/win/source/gdi/salvd.cxx b/vcl/win/source/gdi/salvd.cxx index 564a50d71ebb..564a50d71ebb 100755..100644 --- a/vcl/win/source/gdi/salvd.cxx +++ b/vcl/win/source/gdi/salvd.cxx diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx index ec4917f4201a..6eb423f72cf6 100644 --- a/vcl/win/source/gdi/winlayout.cxx +++ b/vcl/win/source/gdi/winlayout.cxx @@ -57,8 +57,8 @@ #define USE_UNISCRIBE #ifdef USE_UNISCRIBE -#include <Usp10.h> -#include <ShLwApi.h> +#include <usp10.h> +#include <shlwapi.h> #include <winver.h> #endif // USE_UNISCRIBE @@ -2807,7 +2807,7 @@ private: grutils::GrFeatureParser * mpFeatures; mutable GraphiteLayoutWinImpl maImpl; public: - GraphiteWinLayout(HDC hDC, const ImplWinFontData& rWFD, ImplWinFontEntry& rWFE); + GraphiteWinLayout(HDC hDC, const ImplWinFontData& rWFD, ImplWinFontEntry& rWFE) throw(); // used by upper layers virtual bool LayoutText( ImplLayoutArgs& ); // first step of layout diff --git a/vcl/win/source/src/salsrc.rc b/vcl/win/source/src/salsrc.rc index 11b967ff475b..147b80fc3e8c 100755..100644 --- a/vcl/win/source/src/salsrc.rc +++ b/vcl/win/source/src/salsrc.rc @@ -1,3 +1,4 @@ +/* -*- Mode: Fundamental; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,94 +29,94 @@ // for WINVER #include <windows.h> -#ifndef _SV_SALIDS_HRC #include <win/salids.hrc> -#endif -SAL_RESID_POINTER_NULL CURSOR NULLPTR.CUR +SAL_RESID_POINTER_NULL CURSOR nullptr.cur #if ( WINVER < 0x0400 ) -SAL_RESID_POINTER_HELP CURSOR HELP.CUR +SAL_RESID_POINTER_HELP CURSOR help.cur #endif #ifndef WNT -SAL_RESID_POINTER_HSIZE CURSOR HSIZE.CUR -SAL_RESID_POINTER_VSIZE CURSOR VSIZE.CUR -SAL_RESID_POINTER_NESWSIZE CURSOR NESWSIZE.CUR -SAL_RESID_POINTER_NWSESIZE CURSOR NWSESIZE.CUR +SAL_RESID_POINTER_HSIZE CURSOR hsize.cur +SAL_RESID_POINTER_VSIZE CURSOR vsize.cur +SAL_RESID_POINTER_NESWSIZE CURSOR neswsize.cur +SAL_RESID_POINTER_NWSESIZE CURSOR nwsesize.cur #endif -SAL_RESID_POINTER_CROSS CURSOR CROSS.CUR -SAL_RESID_POINTER_MOVE CURSOR MOVE.CUR -SAL_RESID_POINTER_HSPLIT CURSOR HSPLIT.CUR -SAL_RESID_POINTER_VSPLIT CURSOR VSPLIT.CUR -SAL_RESID_POINTER_HSIZEBAR CURSOR HSIZEBAR.CUR -SAL_RESID_POINTER_VSIZEBAR CURSOR VSIZEBAR.CUR -SAL_RESID_POINTER_HAND CURSOR HAND.CUR -SAL_RESID_POINTER_REFHAND CURSOR REFHAND.CUR -SAL_RESID_POINTER_PEN CURSOR PEN.CUR -SAL_RESID_POINTER_MAGNIFY CURSOR MAGNIFY.CUR -SAL_RESID_POINTER_FILL CURSOR FILL.CUR -SAL_RESID_POINTER_ROTATE CURSOR ROTATE.CUR -SAL_RESID_POINTER_HSHEAR CURSOR HSHEAR.CUR -SAL_RESID_POINTER_VSHEAR CURSOR VSHEAR.CUR -SAL_RESID_POINTER_MIRROR CURSOR MIRROR.CUR -SAL_RESID_POINTER_CROOK CURSOR CROOK.CUR -SAL_RESID_POINTER_CROP CURSOR CROP.CUR -SAL_RESID_POINTER_MOVEPOINT CURSOR MOVEPT.CUR -SAL_RESID_POINTER_MOVEBEZIERWEIGHT CURSOR MOVEBW.CUR -SAL_RESID_POINTER_MOVEDATA CURSOR MOVEDATA.CUR -SAL_RESID_POINTER_COPYDATA CURSOR COPYDATA.CUR -SAL_RESID_POINTER_LINKDATA CURSOR LINKDATA.CUR -SAL_RESID_POINTER_MOVEDATALINK CURSOR MOVEDLNK.CUR -SAL_RESID_POINTER_COPYDATALINK CURSOR COPYDLNK.CUR -SAL_RESID_POINTER_MOVEFILE CURSOR MOVEF.CUR -SAL_RESID_POINTER_COPYFILE CURSOR COPYF.CUR -SAL_RESID_POINTER_LINKFILE CURSOR LINKF.CUR -SAL_RESID_POINTER_MOVEFILELINK CURSOR MOVEFLNK.CUR -SAL_RESID_POINTER_COPYFILELINK CURSOR COPYFLNK.CUR -SAL_RESID_POINTER_MOVEFILES CURSOR MOVEF2.CUR -SAL_RESID_POINTER_COPYFILES CURSOR COPYF2.CUR -SAL_RESID_POINTER_NOTALLOWED CURSOR NOTALLOW.CUR -SAL_RESID_POINTER_DRAW_LINE CURSOR DLINE.CUR -SAL_RESID_POINTER_DRAW_RECT CURSOR DRECT.CUR -SAL_RESID_POINTER_DRAW_POLYGON CURSOR DPOLYGON.CUR -SAL_RESID_POINTER_DRAW_BEZIER CURSOR DBEZIER.CUR -SAL_RESID_POINTER_DRAW_ARC CURSOR DARC.CUR -SAL_RESID_POINTER_DRAW_PIE CURSOR DPIE.CUR -SAL_RESID_POINTER_DRAW_CIRCLECUT CURSOR DCIRCCUT.CUR -SAL_RESID_POINTER_DRAW_ELLIPSE CURSOR DELLIPSE.CUR -SAL_RESID_POINTER_DRAW_FREEHAND CURSOR DFREE.CUR -SAL_RESID_POINTER_DRAW_CONNECT CURSOR DCONNECT.CUR -SAL_RESID_POINTER_DRAW_TEXT CURSOR DTEXT.CUR -SAL_RESID_POINTER_DRAW_CAPTION CURSOR DCAPT.CUR -SAL_RESID_POINTER_CHART CURSOR CHART.CUR -SAL_RESID_POINTER_DETECTIVE CURSOR DETECTIV.CUR -SAL_RESID_POINTER_PIVOT_COL CURSOR PIVOTCOL.CUR -SAL_RESID_POINTER_PIVOT_ROW CURSOR PIVOTROW.CUR -SAL_RESID_POINTER_PIVOT_FIELD CURSOR PIVOTFLD.CUR -SAL_RESID_POINTER_PIVOT_DELETE CURSOR PIVOTDEL.CUR -SAL_RESID_POINTER_CHAIN CURSOR CHAIN.CUR -SAL_RESID_POINTER_CHAIN_NOTALLOWED CURSOR CHAINNOT.CUR -SAL_RESID_POINTER_TIMEEVENT_MOVE CURSOR TIMEMOVE.CUR -SAL_RESID_POINTER_TIMEEVENT_SIZE CURSOR TIMESIZE.CUR -SAL_RESID_POINTER_AUTOSCROLL_N CURSOR ASN.CUR -SAL_RESID_POINTER_AUTOSCROLL_S CURSOR ASS.CUR -SAL_RESID_POINTER_AUTOSCROLL_W CURSOR ASW.CUR -SAL_RESID_POINTER_AUTOSCROLL_E CURSOR ASE.CUR -SAL_RESID_POINTER_AUTOSCROLL_NW CURSOR ASNW.CUR -SAL_RESID_POINTER_AUTOSCROLL_NE CURSOR ASNE.CUR -SAL_RESID_POINTER_AUTOSCROLL_SW CURSOR ASSW.CUR -SAL_RESID_POINTER_AUTOSCROLL_SE CURSOR ASSE.CUR -SAL_RESID_POINTER_AUTOSCROLL_NS CURSOR ASNS.CUR -SAL_RESID_POINTER_AUTOSCROLL_WE CURSOR ASWE.CUR -SAL_RESID_POINTER_AUTOSCROLL_NSWE CURSOR ASNSWE.CUR -SAL_RESID_POINTER_AIRBRUSH CURSOR AIRBRUSH.CUR -SAL_RESID_POINTER_TEXT_VERTICAL CURSOR VTEXT.CUR -SAL_RESID_POINTER_TAB_SELECT_S CURSOR TBLSELS.CUR -SAL_RESID_POINTER_TAB_SELECT_E CURSOR TBLSELE.CUR -SAL_RESID_POINTER_TAB_SELECT_SE CURSOR TBLSELSE.CUR -SAL_RESID_POINTER_TAB_SELECT_W CURSOR TBLSELW.CUR -SAL_RESID_POINTER_TAB_SELECT_SW CURSOR TBLSELSW.CUR -SAL_RESID_POINTER_PAINTBRUSH CURSOR PNTBRSH.CUR +SAL_RESID_POINTER_CROSS CURSOR cross.cur +SAL_RESID_POINTER_MOVE CURSOR move.cur +SAL_RESID_POINTER_HSPLIT CURSOR hsplit.cur +SAL_RESID_POINTER_VSPLIT CURSOR vsplit.cur +SAL_RESID_POINTER_HSIZEBAR CURSOR hsizebar.cur +SAL_RESID_POINTER_VSIZEBAR CURSOR vsizebar.cur +SAL_RESID_POINTER_HAND CURSOR hand.cur +SAL_RESID_POINTER_REFHAND CURSOR refhand.cur +SAL_RESID_POINTER_PEN CURSOR pen.cur +SAL_RESID_POINTER_MAGNIFY CURSOR magnify.cur +SAL_RESID_POINTER_FILL CURSOR fill.cur +SAL_RESID_POINTER_ROTATE CURSOR rotate.cur +SAL_RESID_POINTER_HSHEAR CURSOR hshear.cur +SAL_RESID_POINTER_VSHEAR CURSOR vshear.cur +SAL_RESID_POINTER_MIRROR CURSOR mirror.cur +SAL_RESID_POINTER_CROOK CURSOR crook.cur +SAL_RESID_POINTER_CROP CURSOR crop.cur +SAL_RESID_POINTER_MOVEPOINT CURSOR movept.cur +SAL_RESID_POINTER_MOVEBEZIERWEIGHT CURSOR movebw.cur +SAL_RESID_POINTER_MOVEDATA CURSOR movedata.cur +SAL_RESID_POINTER_COPYDATA CURSOR copydata.cur +SAL_RESID_POINTER_LINKDATA CURSOR linkdata.cur +SAL_RESID_POINTER_MOVEDATALINK CURSOR movedlnk.cur +SAL_RESID_POINTER_COPYDATALINK CURSOR copydlnk.cur +SAL_RESID_POINTER_MOVEFILE CURSOR movef.cur +SAL_RESID_POINTER_COPYFILE CURSOR copyf.cur +SAL_RESID_POINTER_LINKFILE CURSOR linkf.cur +SAL_RESID_POINTER_MOVEFILELINK CURSOR moveflnk.cur +SAL_RESID_POINTER_COPYFILELINK CURSOR copyflnk.cur +SAL_RESID_POINTER_MOVEFILES CURSOR movef2.cur +SAL_RESID_POINTER_COPYFILES CURSOR copyf2.cur +SAL_RESID_POINTER_NOTALLOWED CURSOR notallow.cur +SAL_RESID_POINTER_DRAW_LINE CURSOR dline.cur +SAL_RESID_POINTER_DRAW_RECT CURSOR drect.cur +SAL_RESID_POINTER_DRAW_POLYGON CURSOR dpolygon.cur +SAL_RESID_POINTER_DRAW_BEZIER CURSOR dbezier.cur +SAL_RESID_POINTER_DRAW_ARC CURSOR darc.cur +SAL_RESID_POINTER_DRAW_PIE CURSOR dpie.cur +SAL_RESID_POINTER_DRAW_CIRCLECUT CURSOR dcirccut.cur +SAL_RESID_POINTER_DRAW_ELLIPSE CURSOR dellipse.cur +SAL_RESID_POINTER_DRAW_FREEHAND CURSOR dfree.cur +SAL_RESID_POINTER_DRAW_CONNECT CURSOR dconnect.cur +SAL_RESID_POINTER_DRAW_TEXT CURSOR dtext.cur +SAL_RESID_POINTER_DRAW_CAPTION CURSOR dcapt.cur +SAL_RESID_POINTER_CHART CURSOR chart.cur +SAL_RESID_POINTER_DETECTIVE CURSOR detectiv.cur +SAL_RESID_POINTER_PIVOT_COL CURSOR pivotcol.cur +SAL_RESID_POINTER_PIVOT_ROW CURSOR pivotrow.cur +SAL_RESID_POINTER_PIVOT_FIELD CURSOR pivotfld.cur +SAL_RESID_POINTER_PIVOT_DELETE CURSOR pivotdel.cur +SAL_RESID_POINTER_CHAIN CURSOR chain.cur +SAL_RESID_POINTER_CHAIN_NOTALLOWED CURSOR chainnot.cur +SAL_RESID_POINTER_TIMEEVENT_MOVE CURSOR timemove.cur +SAL_RESID_POINTER_TIMEEVENT_SIZE CURSOR timesize.cur +SAL_RESID_POINTER_AUTOSCROLL_N CURSOR asn.cur +SAL_RESID_POINTER_AUTOSCROLL_S CURSOR ass.cur +SAL_RESID_POINTER_AUTOSCROLL_W CURSOR asw.cur +SAL_RESID_POINTER_AUTOSCROLL_E CURSOR ase.cur +SAL_RESID_POINTER_AUTOSCROLL_NW CURSOR asnw.cur +SAL_RESID_POINTER_AUTOSCROLL_NE CURSOR asne.cur +SAL_RESID_POINTER_AUTOSCROLL_SW CURSOR assw.cur +SAL_RESID_POINTER_AUTOSCROLL_SE CURSOR asse.cur +SAL_RESID_POINTER_AUTOSCROLL_NS CURSOR asns.cur +SAL_RESID_POINTER_AUTOSCROLL_WE CURSOR aswe.cur +SAL_RESID_POINTER_AUTOSCROLL_NSWE CURSOR asnswe.cur +SAL_RESID_POINTER_AIRBRUSH CURSOR airbrush.cur +SAL_RESID_POINTER_TEXT_VERTICAL CURSOR vtext.cur +SAL_RESID_POINTER_TAB_SELECT_S CURSOR tblsels.cur +SAL_RESID_POINTER_TAB_SELECT_E CURSOR tblsele.cur +SAL_RESID_POINTER_TAB_SELECT_SE CURSOR tblselse.cur +SAL_RESID_POINTER_TAB_SELECT_W CURSOR tblselw.cur +SAL_RESID_POINTER_TAB_SELECT_SW CURSOR tblselsw.cur +SAL_RESID_POINTER_PAINTBRUSH CURSOR pntbrsh.cur + +SAL_RESID_BITMAP_50 BITMAP "50.bmp" -SAL_RESID_BITMAP_50 BITMAP 50.BMP +SAL_RESID_ICON_DEFAULT ICON sd.ico -SAL_RESID_ICON_DEFAULT ICON SD.ICO +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/win/source/window/salframe.cxx b/vcl/win/source/window/salframe.cxx index 9ed173ee6170..80051f321eac 100644 --- a/vcl/win/source/window/salframe.cxx +++ b/vcl/win/source/window/salframe.cxx @@ -48,9 +48,6 @@ #include <stdio.h> #include <svsys.h> -#ifdef __MINGW32__ -#include <excpt.h> -#endif #include <rtl/string.h> #include <rtl/ustring.h> @@ -100,6 +97,10 @@ using ::std::max; #include <time.h> +#ifdef __MINGW32__ +#include <sehandler.hxx> +#endif + using ::rtl::OUString; using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -107,30 +108,20 @@ using namespace ::com::sun::star::lang; using namespace ::com::sun::star::container; using namespace ::com::sun::star::beans; -// The following defines are newly added in Longhorn -#ifndef WM_MOUSEHWHEEL -# define WM_MOUSEHWHEEL 0x020E -#endif #ifndef SPI_GETWHEELSCROLLCHARS # define SPI_GETWHEELSCROLLCHARS 0x006C #endif #ifndef SPI_SETWHEELSCROLLCHARS # define SPI_SETWHEELSCROLLCHARS 0x006D #endif - - +#ifndef WM_MOUSEHWHEEL +# define WM_MOUSEHWHEEL 0x020E +#endif #if OSL_DEBUG_LEVEL > 1 void MyOutputDebugString( char *s) { OutputDebugString( s ); } #endif -// misssing prototypes and constants for LayeredWindows -extern "C" { - //WINUSERAPI sal_Bool WINAPI SetLayeredWindowAttributes(HWND,COLORREF,BYTE,DWORD); - typedef sal_Bool ( WINAPI * SetLayeredWindowAttributes_Proc_T ) (HWND,COLORREF,BYTE,DWORD); - static SetLayeredWindowAttributes_Proc_T lpfnSetLayeredWindowAttributes; -}; - // ======================================================================= const unsigned int WM_USER_SYSTEM_WINDOW_ACTIVATED = RegisterWindowMessageA("SYSTEM_WINDOW_ACTIVATED"); @@ -139,18 +130,6 @@ sal_Bool WinSalFrame::mbInReparent = FALSE; // ======================================================================= -// Wegen Fehler in Windows-Headerfiles -#ifndef IMN_OPENCANDIDATE -#define IMN_OPENCANDIDATE 0x0005 -#endif -#ifndef IMN_CLOSECANDIDATE -#define IMN_CLOSECANDIDATE 0x0004 -#endif - -#ifndef WM_THEMECHANGED -#define WM_THEMECHANGED 0x031A -#endif - // Macros for support of WM_UNICHAR & Keyman 6.0 #define Uni_UTF32ToSurrogate1(ch) (((unsigned long) (ch) - 0x10000) / 0x400 + 0xD800) #define Uni_UTF32ToSurrogate2(ch) (((unsigned long) (ch) - 0x10000) % 0x400 + 0xDC00) @@ -232,9 +211,6 @@ static void ImplSaveFrameState( WinSalFrame* pFrame ) // if pParentRect is set, the workarea of the monitor that contains pParentRect is returned void ImplSalGetWorkArea( HWND hWnd, RECT *pRect, const RECT *pParentRect ) { - static int winVerChecked = 0; - static int winVerOk = 0; - // check if we or our parent is fullscreen, then the taskbar should be ignored bool bIgnoreTaskbar = false; WinSalFrame* pFrame = GetWindowPtr( hWnd ); @@ -254,96 +230,64 @@ void ImplSalGetWorkArea( HWND hWnd, RECT *pRect, const RECT *pParentRect ) } } - if( !winVerChecked ) + // calculates the work area taking multiple monitors into account + static int nMonitors = GetSystemMetrics( SM_CMONITORS ); + if( nMonitors == 1 ) { - winVerChecked = 1; - winVerOk = 1; - - // multi monitor calls not available on Win95/NT - if ( aSalShlData.maVersionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT ) - { - if ( aSalShlData.maVersionInfo.dwMajorVersion <= 4 ) - winVerOk = 0; // NT - } - else if( aSalShlData.maVersionInfo.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS ) + if( bIgnoreTaskbar ) { - if ( aSalShlData.maVersionInfo.dwMajorVersion == 4 && aSalShlData.maVersionInfo.dwMinorVersion == 0 ) - winVerOk = 0; // Win95 + pRect->left = pRect->top = 0; + pRect->right = GetSystemMetrics( SM_CXSCREEN ); + pRect->bottom = GetSystemMetrics( SM_CYSCREEN ); } + else + SystemParametersInfo( SPI_GETWORKAREA, 0, pRect, 0 ); } - - // calculates the work area taking multiple monitors into account - if( winVerOk ) + else { - static int nMonitors = GetSystemMetrics( SM_CMONITORS ); - if( nMonitors == 1 ) + if( pParentRect != NULL ) { - if( bIgnoreTaskbar ) - { - pRect->left = pRect->top = 0; - pRect->right = GetSystemMetrics( SM_CXSCREEN ); - pRect->bottom = GetSystemMetrics( SM_CYSCREEN ); - } + // return the size of the monitor where pParentRect lives + HMONITOR hMonitor; + MONITORINFO mi; + + // get the nearest monitor to the passed rect. + hMonitor = MonitorFromRect(pParentRect, MONITOR_DEFAULTTONEAREST); + + // get the work area or entire monitor rect. + mi.cbSize = sizeof(mi); + GetMonitorInfo(hMonitor, &mi); + if( !bIgnoreTaskbar ) + *pRect = mi.rcWork; else - SystemParametersInfo( SPI_GETWORKAREA, 0, pRect, 0 ); + *pRect = mi.rcMonitor; } else { - if( pParentRect != NULL ) + // return the union of all monitors + pRect->left = GetSystemMetrics( SM_XVIRTUALSCREEN ); + pRect->top = GetSystemMetrics( SM_YVIRTUALSCREEN ); + pRect->right = pRect->left + GetSystemMetrics( SM_CXVIRTUALSCREEN ); + pRect->bottom = pRect->top + GetSystemMetrics( SM_CYVIRTUALSCREEN ); + + // virtualscreen does not take taskbar into account, so use the corresponding + // diffs between screen and workarea from the default screen + // however, this is still not perfect: the taskbar might not be on the primary screen + if( !bIgnoreTaskbar ) { - // return the size of the monitor where pParentRect lives - HMONITOR hMonitor; - MONITORINFO mi; - - // get the nearest monitor to the passed rect. - hMonitor = MonitorFromRect(pParentRect, MONITOR_DEFAULTTONEAREST); - - // get the work area or entire monitor rect. - mi.cbSize = sizeof(mi); - GetMonitorInfo(hMonitor, &mi); - if( !bIgnoreTaskbar ) - *pRect = mi.rcWork; - else - *pRect = mi.rcMonitor; + RECT wRect, scrRect; + SystemParametersInfo( SPI_GETWORKAREA, 0, &wRect, 0 ); + scrRect.left = 0; + scrRect.top = 0; + scrRect.right = GetSystemMetrics( SM_CXSCREEN ); + scrRect.bottom = GetSystemMetrics( SM_CYSCREEN ); + + pRect->left += wRect.left; + pRect->top += wRect.top; + pRect->right -= scrRect.right - wRect.right; + pRect->bottom -= scrRect.bottom - wRect.bottom; } - else - { - // return the union of all monitors - pRect->left = GetSystemMetrics( SM_XVIRTUALSCREEN ); - pRect->top = GetSystemMetrics( SM_YVIRTUALSCREEN ); - pRect->right = pRect->left + GetSystemMetrics( SM_CXVIRTUALSCREEN ); - pRect->bottom = pRect->top + GetSystemMetrics( SM_CYVIRTUALSCREEN ); - - // virtualscreen does not take taskbar into account, so use the corresponding - // diffs between screen and workarea from the default screen - // however, this is still not perfect: the taskbar might not be on the primary screen - if( !bIgnoreTaskbar ) - { - RECT wRect, scrRect; - SystemParametersInfo( SPI_GETWORKAREA, 0, &wRect, 0 ); - scrRect.left = 0; - scrRect.top = 0; - scrRect.right = GetSystemMetrics( SM_CXSCREEN ); - scrRect.bottom = GetSystemMetrics( SM_CYSCREEN ); - - pRect->left += wRect.left; - pRect->top += wRect.top; - pRect->right -= scrRect.right - wRect.right; - pRect->bottom -= scrRect.bottom - wRect.bottom; - } - } - } - } - else - { - if( bIgnoreTaskbar ) - { - pRect->left = pRect->top = 0; - pRect->right = GetSystemMetrics( SM_CXSCREEN ); - pRect->bottom = GetSystemMetrics( SM_CYSCREEN ); } - else - SystemParametersInfo( SPI_GETWORKAREA, 0, pRect, 0 ); } } @@ -361,24 +305,6 @@ SalFrame* ImplSalCreateFrame( WinSalInstance* pInst, if( getenv( "SAL_SYNCHRONIZE" ) ) // no buffering of drawing commands GdiSetBatchLimit( 1 ); - static int bLayeredAPI = -1; - if( bLayeredAPI == -1 ) - { - bLayeredAPI = 0; - // check for W2k and XP - if ( aSalShlData.maVersionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT && aSalShlData.maVersionInfo.dwMajorVersion >= 5 ) - { - OUString aLibraryName( RTL_CONSTASCII_USTRINGPARAM( "user32" ) ); - oslModule pLib = osl_loadModule( aLibraryName.pData, SAL_LOADMODULE_DEFAULT ); - oslGenericFunction pFunc = NULL; - if( pLib ) - pFunc = osl_getAsciiFunctionSymbol( pLib, "SetLayeredWindowAttributes" ); - - lpfnSetLayeredWindowAttributes = ( SetLayeredWindowAttributes_Proc_T ) pFunc; - - bLayeredAPI = pFunc ? 1 : 0; - } - } static const char* pEnvTransparentFloats = getenv("SAL_TRANSPARENT_FLOATS" ); // determine creation data @@ -449,7 +375,7 @@ SalFrame* ImplSalCreateFrame( WinSalInstance* pInst, { pFrame->mbNoIcon = TRUE; nExSysStyle |= WS_EX_TOOLWINDOW; - if ( pEnvTransparentFloats && bLayeredAPI == 1 /*&& !(nSalFrameStyle & SAL_FRAME_STYLE_MOVEABLE) */) + if ( pEnvTransparentFloats /*&& !(nSalFrameStyle & SAL_FRAME_STYLE_MOVEABLE) */) nExSysStyle |= WS_EX_LAYERED; } } @@ -458,7 +384,7 @@ SalFrame* ImplSalCreateFrame( WinSalInstance* pInst, nExSysStyle |= WS_EX_TOOLWINDOW; pFrame->mbFloatWin = TRUE; - if ( (bLayeredAPI == 1) && (pEnvTransparentFloats /* does not work remote! || (nSalFrameStyle & SAL_FRAME_STYLE_FLOAT_FOCUSABLE) */ ) ) + if ( (pEnvTransparentFloats /* does not work remote! || (nSalFrameStyle & SAL_FRAME_STYLE_FLOAT_FOCUSABLE) */ ) ) nExSysStyle |= WS_EX_LAYERED; } @@ -528,8 +454,8 @@ SalFrame* ImplSalCreateFrame( WinSalInstance* pInst, ImplWriteLastError( GetLastError(), "CreateWindowEx" ); #if OSL_DEBUG_LEVEL > 1 // set transparency value - if( bLayeredAPI == 1 && GetWindowExStyle( hWnd ) & WS_EX_LAYERED ) - lpfnSetLayeredWindowAttributes( hWnd, 0, 230, 0x00000002 /*LWA_ALPHA*/ ); + if( GetWindowExStyle( hWnd ) & WS_EX_LAYERED ) + SetLayeredWindowAttributes( hWnd, 0, 230, 0x00000002 /*LWA_ALPHA*/ ); #endif if ( !hWnd ) { @@ -794,8 +720,7 @@ static UINT ImplSalGetWheelScrollChars() { // Depending on Windows version, use proper default or 1 (when // driver emulates hscroll) - if( VER_PLATFORM_WIN32_NT == aSalShlData.maVersionInfo.dwPlatformId && - aSalShlData.maVersionInfo.dwMajorVersion < 6 ) + if( aSalShlData.maVersionInfo.dwMajorVersion < 6 ) { // Windows 2000 & WinXP : emulating driver, use step size // of 1 @@ -5274,7 +5199,11 @@ static void ImplHandleInputLangChange( HWND hWnd, WPARAM, LPARAM lParam ) // Feststellen, ob wir IME unterstuetzen WinSalFrame* pFrame = GetWindowPtr( hWnd ); - if ( pFrame && pFrame->mbIME && pFrame->mhDefIMEContext ) + + if ( !pFrame ) + return; + + if ( pFrame->mbIME && pFrame->mhDefIMEContext ) { HKL hKL = (HKL)lParam; UINT nImeProps = ImmGetProperty( hKL, IGP_PROPERTY ); diff --git a/vcl/win/source/window/salobj.cxx b/vcl/win/source/window/salobj.cxx index f79ad89fff45..f79ad89fff45 100755..100644 --- a/vcl/win/source/window/salobj.cxx +++ b/vcl/win/source/window/salobj.cxx diff --git a/vcl/workben/makefile.mk b/vcl/workben/makefile.mk index d52737507a20..810b1fb42a00 100644 --- a/vcl/workben/makefile.mk +++ b/vcl/workben/makefile.mk @@ -49,6 +49,10 @@ OBJFILES= \ # --- Targets ------------------------------------------------------ +.IF "$(OS)" == "IOS" +CFLAGS += -x objective-c++ -fobjc-abi-version=2 -fobjc-legacy-dispatch -D__IPHONE_OS_VERSION_MIN_REQUIRED=40300 +.ENDIF + # svdem APP1NOSAL= TRUE diff --git a/vcl/workben/svdem.cxx b/vcl/workben/svdem.cxx index 4898aed1a995..ee5cbb2ba420 100644 --- a/vcl/workben/svdem.cxx +++ b/vcl/workben/svdem.cxx @@ -51,7 +51,7 @@ void Main(); // ----------------------------------------------------------------------- -SAL_IMPLEMENT_MAIN() +SAL_IMPLEMENT_MAIN_WITH_GUI() { tools::extendApplicationEnvironment(); diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx index 547660fa1e1e..3c75c643fe4a 100644 --- a/vcl/workben/vcldemo.cxx +++ b/vcl/workben/vcldemo.cxx @@ -56,7 +56,7 @@ void Main(); // ----------------------------------------------------------------------- -SAL_IMPLEMENT_MAIN() +SAL_IMPLEMENT_MAIN_WITH_GUI() { tools::extendApplicationEnvironment(); |